Commit Graph
205 Commits
Author SHA1 Message Date
Anders Jenbo d1189388f5 Use user by reference 2022-07-17 18:41:05 +02:00
Anders Jenbo f6f05da485 Clean up game name and password variables 2022-07-16 20:15:07 +02:00
Gleb Mazovetskiy 04c3d85179 Remove MAX_PATH
Rather than using the Windows-like `MAX_PATH`, what we really want is 2
things:

1. Maximum path of a file in an MPQ. This is now `MaxMpqPathSize`.
2. Max size for the known monster paths. This is now 64 for sounds and
   TRNs, which is more than enough (picked arbitrarily).
2022-07-16 11:14:16 +01:00
Gleb Mazovetskiy 643c707c55 Remove strncmp 2022-07-16 10:59:40 +01:00
Anders Jenbo 3ae834148a Split event handeling from general miniwin features 2022-07-10 21:13:39 +02:00
Cesar Canassa 6579aa53c5 Normalise the player and monster walking function naming (#4877)
Both player and monster walking functions are not named WalkNorthwards, WalkSouthwards and WalkSideways.

Also renames the PLT_MODE enum to follow the same pattern and removes the comments that are now unnecessary
2022-07-03 20:28:06 +02:00
Anders Jenbo 72656b3011 Move path and palette to the engine folder 2022-06-24 16:34:20 +02:00
Anders Jenbo 6d56058708 Move level generation to subfolder 2022-06-23 09:21:58 +02:00
obligaron 19749420b5 Introduce Player::isOnActiveLevel 2022-06-18 17:05:30 +02:00
Gleb Mazovetskiy 1fc8ecb6f6 Add fmt::runtime annotations for C++20 support
`fmt` requires non-contexpr format string arguments to be wrapped in
`fmt::runtime` in C++20.
2022-06-14 12:46:36 +01:00
Gleb Mazovetskiy 779ccaca17 Overhaul translation fetching
1. Do not modify the map after loading. Instead, return string views
   (guaranteed to be null-terminated) from look up functions and return
   the key directly if not found.
2. Use an `unorded_map` instead of `map` where available (C++20).
   Saves a bit of RAM (~50 KiB) and improves lookup performance.
2022-06-14 12:46:36 +01:00
Anders Jenbo 1203514383 Clean up use of currlevel 2022-06-07 21:35:01 +02:00
qndel 354e329644 Players[MyPlayerId] -> MyPlayer 2022-05-31 05:35:52 +02:00
obligaron bc15bdf3a9 Remove PANEL_ defines and replace them with GetMainPanel() 2022-05-29 20:20:44 +02:00
obligaron 1124dd1bd2 Don't show hostile players in automap 2022-05-20 22:46:48 +02:00
obligaron 70c5cf6cad Fix item label text with open stash (#4595)
* Item labels: check if stash is open in IsMouseOverGameArea

* Add IsLeft/RightPanelOpen
2022-05-20 09:12:54 +02:00
Anders Jenbo 0645d9b2a1 Correct missing hellfire level mapping in leveltype
Hellfire never added the 2 new dungion types, instead it makes
additional checks on currlevel. This is confusing and mess, so cleaned
it up.
2022-05-10 15:16:38 +02:00
Anders Jenbo 1409e604f5 Reduce string conversions 2022-03-20 11:04:15 +01:00
KPhoenix d544a467e6 Show game Difficulty in Automap (#3867) 2021-12-31 05:28:51 +01:00
Andrew James 796e2813cf Use scoped enums for DungeonFlags/BFLAG (#3135) 2021-11-07 03:11:16 +01:00
qndel 7250aeae66 tweak automap colors 2021-10-25 16:57:16 +02:00
Anders Jenbo b9b4b9eea0 Fix OOB in DrawAutomapTile 2021-10-25 04:43:35 +02:00
qndel e567953bc9 Sharing automap exploration in multiplayer 2021-10-25 02:58:41 +02:00
staphen ffbbcc6d62 Support unencrypted multiplayer games with no password 2021-10-25 01:14:37 +02:00
qndel 9f7c69f4f5 improve southeast arrow 2021-10-01 12:44:11 +02:00
qndel 560066585a center automap arrow 2021-10-01 12:44:11 +02:00
qndel 6bd48907e0 fix jumping arrow 2021-10-01 09:28:10 +02:00
ephphathaandAnders Jenbo b12de6fe12 Use scoped enum for Direction
Identified and removed an instance of Direction being used as an argument for a bool parameter

Removed a single-use temporary variable being cast from sprite frame to direction to size_t

Co-authored-by: Anders Jenbo <[email protected]>

Fix alignment of WalkSettings array
2021-09-12 02:27:47 +02:00
Anders Jenbo 7169882b1f ✨ Implement new font rendering 2021-09-12 01:37:28 +02:00
Juliano Leal Goncalves 940a120bf9 ♻️ Replace 'ViewX' and 'ViewY' globals with single 'ViewPosition' 2021-09-04 18:06:28 -04:00
Anders Jenbo df636c0afc Remove DIR_OMNI 2021-08-23 10:51:06 +02:00
Anders Jenbo 23fdb5aa27 [vanilla] Fix missing dirt corners in automap 2021-08-11 02:33:22 +02:00
Anders Jenbo 0b68a8b2d3 Fix missing dirt tiles in automap 2021-08-11 02:33:22 +02:00
Andrew James 8d9c46290d Automap: Scoped enums and wrappers to minimise bitwise operations (#2534) 2021-08-08 19:25:05 +02:00
Anders Jenbo 26756b82dc ♻️Split up DrawAutomapTile 2021-08-08 19:25:05 +02:00
Anders Jenbo f2d858af4b Cleanup magic numbers in automap.cpp 2021-08-08 19:25:05 +02:00
obligaron cb62e7bf2d Fix automap jiggling for player arrow 2021-07-19 17:19:49 +02:00
obligaron dae9d7eff5 Enable ADL (GetOffsetForWalking) for automap 2021-07-18 21:41:07 +02:00
Anders Jenbo 9ebdb6db69 General clean up 2021-07-08 03:30:25 -07:00
Anders Jenbo 9b8bf92575 Rename quest globals 2021-07-08 02:01:14 -07:00
Anders Jenbo 96bf75b502 Rename player globals 2021-07-08 02:01:14 -07:00
Gleb Mazovetskiy cb0dae8590 🚚 Rename CelOutputBuf to Surface and extract 2021-07-03 05:33:32 -07:00
Juliano Leal Goncalves cbb84199c2 ♻️ Replace Point addition with 'Point + Displacement' 2021-06-28 20:37:44 -07:00
Andrew James 60a47caf1b Refactor Draw* functions to use Rectangle and Point types
Added overload for DrawString taking a Point to avoid creating a rect for callers which only use position. This also documents the way DrawString operates when passed a clipping rectangle with a dimension of 0.
As part of this overload removed the logic for 0 width regions from DrawString. This does change the behaviour of the Rectangle version if called with a rect with width 0, all callers using that behaviour have been updated in this commit.

Using Rectangle/Size allowed simplifying the logic for certain calls where they could use DrawText alignment flags, previously this was manually aligning by calculating dimensions and offsetting the position. This also fixes #2169

Also includes a few instances where a temporary buffer was used to set the text to be drawn with unbounded sprintf calls, replaced those with snprintf as is recommended in modern C applications. Moving to C++ strings would be good in a future refactor.
2021-06-24 01:36:06 +02:00
Gleb Mazovetskiy e40b1963f9 🚚 engine.h: Extract CelSprite and file loading 2021-06-21 01:36:20 -07:00
Gleb Mazovetskiy f9f301b054 🚚 engine.h: Extract Point, Direction, clamp
`engine.h` is getting quite bloated. Moves this code to their own files.
2021-06-21 01:36:20 -07:00
Anders Jenbo 1c13f283cf Fix Clang warning 2021-06-15 00:23:35 +02:00
Anders Jenbo 8a7ec56d3a Player by reference part 2
This mostly change player to be by reference instead of by index.
But additionally it does stript checks for gold in the belt, move some
value types to the initialization and short circute a few functiongs.
2021-05-24 21:00:32 +02:00
Jmgr bbd39aa513 Replace sprintfs with strcpy for translatable strings 2021-05-21 01:02:45 +02:00
Jmgr 6e85cde978 Update format strings 2021-05-21 01:02:45 +02:00