Commit graph

401 commits

Author SHA1 Message Date
Anders Jenbo
6ce8f13751 Apply clang-tidy to more code and do some related cleanups 2021-05-24 05:27:06 +02:00
Juliano Leal Goncalves
21fdb0dcd9 ♻️ Replace manual direction displacement logic with 'Point' add operator 2021-05-24 04:46:08 +02:00
Juliano Leal Goncalves
d55cd99dd5 🚚 Rename 'direction' enum to 'Direction' 2021-05-24 04:46:08 +02:00
Juliano Leal Goncalves
15c46b9eb0 💬 Rename HeroSpeech members to improve discoverability 2021-05-23 22:01:47 +02:00
Juliano Leal Goncalves
5350250a76 🚚 Rename speech functions to 'Say' variations 2021-05-23 05:32:34 +02:00
Juliano Leal Goncalves
8c620ce29e ♻️ Extract 'HeroSpeech' enum class for hero sounds instead of using raw ints 2021-05-23 05:32:34 +02:00
Jmgr
0e7ada15fc Apply new format to ngexttext translations 2021-05-21 01:02:45 +02:00
Anders Jenbo
34744c068f ♻️Consitantly use %i and not %d 2021-05-15 14:17:52 +02:00
Stefan Mielke
30bfe45781 One pixel was not being calculated on the X axis when trying to find for an inventory slot to put the item. 2021-05-15 12:27:48 +02:00
qndel
89c40eaa7b
inventory items rendering cleanup (#1938) 2021-05-14 12:46:16 +02:00
Anders Jenbo
0c2042fa52 ♻️ Player by reference
Update Source/items.cpp
Update Source/lighting.cpp
Update Source/pack.cpp
asd


ads


as
2021-05-13 01:47:46 +02:00
Anders Jenbo
68e73c0dfe 🐛 Fix infopanel text color 2021-05-12 11:40:31 +02:00
Anders Jenbo
ad97ebe980 🔥 Remove redundant code from towners.cpp
This changes one bavious. Previously walking away from the dead guy
would interupt the "Your death shall be reveanged", the interuption
seamed un natural and the code didn't seam to have been specifically
made for this case (TownCtrlMsg).

Fix several edge cases in quests where the incorrect state could be reached
2021-05-10 23:17:43 +02:00
Stefan Mielke
dfece830ad
Controller Inventory Improvements (#1885)
- 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
2021-05-09 17:00:48 +02:00
Aneurin
2365b5f440
Improve inventory filling algorithm (#1876)
* 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
2021-05-09 06:34:57 +02:00
Anders Jenbo
8361e70087 ♻️Use DrawString in error.cpp 2021-05-08 18:48:19 +02:00
Anders Jenbo
68923c6c33 Generic game text render function
This should gradually replace all the direct rendering of game texts
throughout the code. The interface is made to closly mirror that of the
art fonts as that is what will eventually be used for rendering Unicode
fonts both in the menus and ingame.

fixup!  Generic game text render function
2021-05-08 18:48:19 +02:00
Anders Jenbo
4b577329f4 ♻️Refactor towner initialization 2021-05-07 00:30:23 +02:00
Anders Jenbo
6321bf04d5 ♻️Pass player to towner by reference instead of index 2021-05-07 00:29:46 +02:00
Gleb Mazovetskiy
0edfa3de66 🚚 Move CEL rendering to engine/render/cel_render.cpp 2021-05-07 00:16:40 +02:00
Gleb Mazovetskiy
34b4ed759a 🐞 Clean up and fix inventory sprite handling 2021-05-02 04:01:03 +02:00
Anders Jenbo
22d7d41615 🌐 Fix remaning plural form of gold related texts 2021-05-02 00:31:02 +02:00
Gleb Mazovetskiy
1b8b62a8c2 ♻️ Store CEL width with the sprite itself
Instead of passing the CEL sprite width when drawing, store the CEL
width at load time in the new `CelSprite` struct.

Implemented for most sprites except towners, missiles, or monsters.
2021-05-01 20:51:55 +02:00
Mathieu Maret
a87f1d8d2e Avoid a strcpy
if _iIdentified is true, the first strcpy was not usefull
2021-05-01 02:48:25 +02:00
Anders Jenbo
f884ba5340 🔥 Remove more miniwin dependencies 2021-04-29 23:04:56 +02:00
Anders Jenbo
d5173f4c9c ♻️Clean up PutItem 2021-04-29 21:36:31 +02:00
Anders Jenbo
5745f099ba ♻️Use Point for positions in msg.cpp functions 2021-04-29 21:36:31 +02:00
Anders Jenbo
bd515ac75d ♻️Apply Point equality operator 2021-04-29 16:04:30 +02:00
thebigMuh
ad8f342db0 Adding constness 2021-04-26 23:30:02 +02:00
John Törnblom
e0dddf508a
Add automatically translated string literals (#1694) 2021-04-25 18:14:58 +02:00
Anders Jenbo
f77c52941a ♻️Make GetDirection take Points instead of ints 2021-04-25 02:25:52 +02:00
Anders Jenbo
2bd13451a1 ♻️Apply point positioning to all remaning entities 2021-04-25 01:25:48 +02:00
Anders Jenbo
e4cfad3196 ♻️Use points instead of individual fileds for player structure 2021-04-24 04:46:08 +02:00
Anders Jenbo
d99522b9a5 ♻️ Clean up direction related code 2021-04-23 17:39:18 +02:00
Anders Jenbo
4b4d757514 🐛 Update drop position 2021-04-23 16:11:50 +02:00
Anders Jenbo
f20828706e ♻️Deduplicate PutItem 2021-04-23 04:53:46 +02:00
Anders Jenbo
a32ac83090 🎨 cleanup trivial trype comparisons 2021-04-23 02:48:25 +02:00
Anders Jenbo
1e3ed903be 🎨 strip redundant else 2021-04-22 00:39:48 +02:00
Anders Jenbo
d024f79b0e 🧹 performance-unnecessary-value-param 2021-04-22 00:08:19 +02:00
Jmgr
1d84156509 Simplify bitshift divisions/multiplications 2021-04-21 05:31:17 +02:00
qndel
ec74917cb4 class sounds cleanup 2021-04-20 23:35:16 +02:00
Anders Jenbo
373f28736f 🎨 Acceptable parts of modernize-* 2021-04-19 22:42:19 +02:00
Anders Jenbo
bb4e1960e7 🎨 modernize-use-nullptr 2021-04-19 16:02:05 +02:00
Anders Jenbo
c89bd9c001 🚨 Fix remaning warnings for clang and gcc 2021-04-19 02:44:39 +02:00
Anders Jenbo
5fdb9ce459 🎨 Format code 2021-04-19 00:37:33 +02:00
Gleb Mazovetskiy
95946e3a7c
🧹 Cleanup unused variables (#1584)
Fixes `unused-variable` and `unused-but-set-variable` compiler warnings.
2021-04-18 18:15:47 +02:00
Juliano Leal Goncalves
0df491eeac 🐛 Ensure picked up items on the ground are removed 2021-04-16 06:44:05 +02:00
qndel
d8444ed695
Clean DrawInvBelt + outline colors
* fix right hand items
2021-04-16 02:17:28 +02:00
Anders Jenbo
997c1dba55 🚚 Split up all.h in to proper header relations 2021-04-16 01:04:54 +02:00
FluffyQuack
051ac249db 🐮 Fixed a legacy bug causing network desync if a player tries to swap sword+shield with a two-handed weapon without sufficient inventory space. 2021-04-16 00:35:21 +02:00