Devilutionx: [Suggestion] Increase MaxGold per slot

Created on 6 Jun 2019  路  16Comments  路  Source: diasurgical/devilutionX

Just 5000 will fill a lot of slots and typically we drop gold in town at the start of the game and take it back at the end.

Increasing the max amount would relieve this tedious operation :)

Considerations could be taken given the character level, i.e., the higher the char the greater the gold amount per slot... or just top it at a very comfortable value...

enhancement question

Most helpful comment

My humble opinion is that such a move breaks the intended (or unintended) game mechanics. It would simply just not be Diablo anymore.
With time there will of course be more and more demands of this kind, might i suggest that all alterations in gameplay will be implemented as optional features?

All 16 comments

My humble opinion is that such a move breaks the intended (or unintended) game mechanics. It would simply just not be Diablo anymore.
With time there will of course be more and more demands of this kind, might i suggest that all alterations in gameplay will be implemented as optional features?

DevilutionX intention is to keep things vanilla, but make the game mod friendly.
The few changes that are introduced will in general be configurable and off by default in most cases

The easy way to fix this is to eventually replace all 2500/5000 with defines so you can change with one line of code. Hellfire added some hacky stuff to allow 10000 with that unique amulet (can't remember the name).

I'll create defines for 1000/2500/5000 (probably) tomorrow. Is GOLD_SMALL_LIMIT/GOLD_MEDIUM_LIMIT/GOLD_LARGE_LIMIT okay?

Wow! Amazing, thanks!

In the meantime i just tinkered with it and i think i've succeeded:

Here's what i did:

In enums.h i added the following enum
enum gold_quantity {
GOLD_SMALL = 1000,
GOLD_MEDIUM = 2500,
GOLD_MAX = 10000,
};

The i carefully grepped for 1000, 2500 and 5000 and sed-ed where appropriate (being careful not to change every instance blindly, hence some extra sed's)

= devilutionX-master/Source folder =

player.cpp

sed -i 's/5000/GOLD_MAX/g' Source/player.cpp

stores.cpp

sed -i 's/5000/GOLD_MAX/g' Source/stores.cpp
sed -i 's/2500/GOLD_MEDIUM/g' Source/stores.cpp
sed -i 's/_ivalue <= 1000/_ivalue <= GOLD_SMALL/g' Source/stores.cpp

debug.cpp

sed -i 's/5000/GOLD_MAX/g' Source/debug.cpp

inv.cpp

sed -i 's/5000/GOLD_MAX/g' Source/inv.cpp
sed -i 's/sgdwLastTime >= GOLD_MAX/sgdwLastTime >= 5000/g' Source/inv.cpp # undoing the sole line where this 5000 doesn't refer to gold. (i know there are better sed ways but i'm no expert :) )
sed -i 's/2500/GOLD_MEDIUM/g' Source/inv.cpp
sed -i 's/1000/GOLD_SMALL/g' Source/inv.cpp

items.cpp

sed -i 's/5000/GOLD_MAX/g' Source/items.cpp
sed -i 's/2500/GOLD_MEDIUM/g' Source/items.cpp
sed -i 's/ivalue <= 1000/ivalue <= GOLD_SMALL/g' Source/items.cpp
sed -i 's/rndv > 1000/rndv > GOLD_SMALL/g' Source/items.cpp

control.cpp

sed -i 's/2500/GOLD_MEDIUM/g' Source/control.cpp
sed -i 's/1000/GOLD_SMALL/g' Source/control.cpp

... i think i found a bug here:

Source/items.cpp
-> void CreatePlrItems(int p)
-> line 930 & 931:
plr[p].HoldItem._ivalue = 100; <--- Probably here should be 1000? (and changed to GOLD_SMALL)
plr[p].HoldItem._iCurs = ICURS_GOLD_SMALL;

I did change to GOLD_SMALL and things are looking good.

Just tried to top at 10000 and after reaching that limit it started adding gold on a new slot. I think i'll top that to 50k :) (int is 4 bytes here so there shouldn't be any problems but i'll post if there are)

... i think i found a bug here:

Source/items.cpp
-> void CreatePlrItems(int p)
-> line 930 & 931:
plr[p].HoldItem._ivalue = 100; <--- Probably here should be 1000? (and changed to GOLD_SMALL)
plr[p].HoldItem._iCurs = ICURS_GOLD_SMALL;

This comes from the decompiler:
https://github.com/diasurgical/devilution/blob/dde68ff89e9a41d684d1bf533446ba11a2c321c6/Source/items.cpp#L1596

As the fn is marked as bin-exact, the bug (if real) is left by the original developers. How does it manifest if at all?

@AJenbo wrote:

DevilutionX intention is to keep things vanilla, but make the game mod friendly.
The few changes that are introduced will in general be configurable and off by default in most cases

IIRC, all modifications should go to the devilution-plus-plus. Which sadly isn't updated since Aug 18, 2018 already.

@dalvim, maybe create an issue there, then ask @ApertureSecurity (or @galaxyhaxz or whatever guy having admin access here) to rebase that repo to the current devilution?

@dalvim If you've already done the work, then I don't have to recreate it. Please create a PR against devilution that has the default values for all three constants. I would be happier with the names if they all contained _LIMIT somewhere.

... i think i found a bug here:
Source/items.cpp
-> void CreatePlrItems(int p)
-> line 930 & 931:
plr[p].HoldItem._ivalue = 100; <--- Probably here should be 1000? (and changed to GOLD_SMALL)
plr[p].HoldItem._iCurs = ICURS_GOLD_SMALL;

This comes from the decompiler:
https://github.com/diasurgical/devilution/blob/dde68ff89e9a41d684d1bf533446ba11a2c321c6/Source/items.cpp#L1596

As the fn is marked as bin-exact, the bug (if real) is left by the original developers. How does it manifest if at all?

This is the function that creates the start equipment, all players start with a small pile of 100 gold pieces, so not a bug.

I should have known that, because I looked at the code yesterday and I still wondered if it was a bug. That's what happens if you only see a small slice of code.

... i think i found a bug here:
Source/items.cpp
-> void CreatePlrItems(int p)
-> line 930 & 931:
plr[p].HoldItem._ivalue = 100; <--- Probably here should be 1000? (and changed to GOLD_SMALL)
plr[p].HoldItem._iCurs = ICURS_GOLD_SMALL;

This comes from the decompiler:
https://github.com/diasurgical/devilution/blob/dde68ff89e9a41d684d1bf533446ba11a2c321c6/Source/items.cpp#L1596
As the fn is marked as bin-exact, the bug (if real) is left by the original developers. How does it manifest if at all?

This is the function that creates the start equipment, all players start with a small pile of 100 gold pieces, so not a bug.

... ok so i guess the enum could get an added entry like GOLD_START and that 100 changed to it...

IMO just ignore it. The rest of the starting equipment is hard-coded as well.

First time doing a pull request :) I think everything is ok. Please let me know if there's any problem. :)

@Manuel-K I added the _LIMIT suffix as you suggested and left the 100 untouched

@dalvim Do you know how to move the patch to the other repo?

If you don't want to do it yourself, I've prepared something on my fork.

Closing as this would be something for a different mod, also Hellfire allows for 10k gold stacks and support is coming (83% done).

Actually we should have closed this when the PR was merged into devilution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mbreskovec picture mbreskovec  路  49Comments

AJenbo picture AJenbo  路  19Comments

predator8bit picture predator8bit  路  22Comments

predator8bit picture predator8bit  路  21Comments

julealgon picture julealgon  路  16Comments