- controller: Move inventory coordinates logic to outside of the method to ease visibility and changes; Fix cursor offset when holding items on the inventory; Move cursor between edges of the inventory to ease movement inside.
- Renamed InvGetCoord to InvGetSlotCoord.
- adding more SLOTXY_xxx options to improve controls code
- changed inventory slots comment to improve legibility
- fixing bugs and centering sprite on the slot
- fix belt item movement
- slots 9 and 10 move to belt 8 when moving down using a controller
- creating function to return correct mousePos slot to remove code duplication
- create BeltGetSlotCoord to get coords for belts and remove duplicates; code cleanup.
- adding INV_ROW_SLOT_SIZE to hold the amount of slots on an inv row
- improve code for moving item to the belt when it's the last 2 slots.
- fix bug that would not update the cursor position when going up on certain conditions.
- equip equipment when pressing [use] on the controller
- moving items in the inventory as a single instance, and blocking them from moving accordingly.
- move item to belt when clicking the spell button (Y)
- resetting the cursor takes into consideration if the current slot has an item that is bigger than 1x1
- change whitespace to tabs on inv.h changes
- fixing plrctrls.cpp formatting
* Extract loop body into GoldAutoPlaceInInventorySlot()
* Improve placement of gold in inventory
When adding gold to the inventory, this now finds a free slot as
follows:
1) Start at X, and work left until row 3 is full
2) Start at Y, and work up until column 9 is full
3) Move one column left, start at row 2 and work up
4) Repeat step 3 until there is no free space
| |0|1|2|3|4|5|6|7|8|9|
|-|-|-|-|-|-|-|-|-|-|-|
|0| | | | | | | | | | |
|1| | | | | | | | | | |
|2| | | | | | | | | |Y|
|3| | | | | | | | | |X|
* Improve inventory placement for single-height items
When adding single-height items (which in practice are all 1x1) to the
inventory, this now finds a free slot as follows:
1) Start at X, and work right until row 3 is full
2) Start at Y, and work up until column 9 is full
3) Move one column left, start at row 2 and work up
4) Repeat step 3 until there is no free space
| |0|1|2|3|4|5|6|7|8|9|
|-|-|-|-|-|-|-|-|-|-|-|
|0| | | | | | | | | | |
|1| | | | | | | | | | |
|2| | | | | | | | | |Y|
|3|X| | | | | | | | | |
* Improve inventory placement for two-height items
When adding 1x2 items to the inventory, this now finds a free slot as
follows:
1) Start at X, and work down until column 9 is full
2) Move one column left, start at row 0 and work down
3) Repeat step 2 until there is no free space
| |0|1|2|3|4|5|6|7|8|9|
|-|-|-|-|-|-|-|-|-|-|-|
|0| | | | | | | |Z|Y|X|
|1| | | | | | | | | | |
|2| | | | | | | | | | |
|3| | | | | | | | | | |
When adding 2x2 items, it first tries to place them in even columns,
then goes to odd columns of no space was found:
1) Start at Y, and work down until columns 8/9 are full
2) Move two columns left, start at row 0 and work down
3) Repeat step 2 until there is no free space in columns 0/1
4) Go to Z, and work down until columns 7/8 are full
5) Move two columns left, start at row 0 and work down
3) Repeat step 5 until there is no free space
The 'saveFlag' argument used for persisting the changes into the
inventory is never leveraged on this function: all existing consumers
provide 'FALSE'. It was probably a copy-paste leftover from the
standard 'AutoPlace'.