Commit Graph
431 Commits
Author SHA1 Message Date
Cesar Canassa f0d1d58499 ♻️ Remove monsterId from delta_kill_monster 2022-07-13 14:48:31 +02:00
ephphatha 1337ff6ea2 Add check if a monster potentially has leashed minions 2022-07-13 07:13:34 +02:00
ephphatha b60bdf8b9b Unset leader of minions when the leader dies 2022-07-13 07:13:34 +02:00
Gleb Mazovetskiy 33ac2cca8e ♻️ Make Monster counters size_t 2022-07-12 03:04:53 +01:00
Anders Jenbo 2d21fc372e Remove more miniwin code 2022-07-10 21:13:39 +02:00
Anders Jenbo 6a8fd04067 Use player by references (#4938) 2022-07-10 11:40:04 +02:00
Gleb Mazovetskiy 197e1180b2 Add StrCat and StrAppend
Adds simple string / integer concatenation functions.

Many of the uses of `fmt::format` are simply concatenation
of a few strings and integers.

`StrCat` is an easier-to-read alternative to such uses of `fmt`.
2022-07-10 06:14:58 +02:00
Anders Jenbo ce4595b440 Split Crypt from Cathedral 2022-07-09 11:07:47 +02:00
staphen 4a3a8f5a57 Validate spell IDs that are sent over the network 2022-07-09 04:04:22 +02:00
Mikołaj Piróg 15989609a8 Members' name changes and comments in Monster struct (#4861) 2022-07-06 10:21:22 +02:00
Cesar Canassa 0d106beaf3 ♻️ Refactor M_StartHit to receive a Monster reference 2022-07-05 17:37:53 +02:00
Mikołaj Piróg dda0b96ea5 Remove #defines in player.h and add constexpr where applicable (#4896)
* Change defines to constexpr int in player.h

* Add const or constexpr to player.h/cpp where applicable

* Update tests with changed names of player constatns

* remove unecessary variable
2022-07-05 17:25:23 +02:00
Cesar Canassa 76da2d14c9 Remove monsterId from M_GetKnockback (#4882) 2022-07-04 11:54:53 +02:00
Cesar Canassa 79f5cdb2be ♻️ change delta_monster_hp to receive a Monster reference (#4873) 2022-07-03 20:59:03 +02:00
ephphatha fce4d23ba8 Iterate over all monsters when applying delta 2022-07-03 18:52:12 +02:00
ephphatha 2da2ea7b03 Take monster reference in M_ClearSquares 2022-07-03 18:52:12 +02:00
k-bar 26de74f4a2 AnimationInfo class correct style (#4870)
* AnimationInfo class correct case-style for private members

clang-tidy warnings:
readability-identifier-naming    invalid case style for private member

* AnimationInfo class correct case-style for members

clang-tidy warnings:
readability-identifier-naming    invalid case style for member

* AnimationInfo class correct case-style for methods

clang-tidy warnings:
readability-identifier-naming    invalid case style for method

* AnimationInfo class use nodiscard

clang-tidy warnings:
modernize-use-nodiscard    function  should be marked [[nodiscard]]
2022-07-03 16:55:37 +02:00
Gleb Mazovetskiy 6949a6f418 Monster: Remove MType/MData pointers
These pointers are redundant, replaces them with methods.
2022-07-03 13:21:11 +01:00
Anders Jenbo b00ae287b8 Minimize propegation of global Players index 2022-07-03 06:10:42 +02:00
Gleb Mazovetskiy 72660d9189 Migrate snprintf to fmt (#4845)
* Migrate `app_fatal` from printf to libfmt
* Migrate snprintf to fmt
2022-07-02 02:36:17 +02:00
Gleb Mazovetskiy 3b2e560fa0 Non-int versions of Point and Displacement (#4824)
* Non-int versions of `Point` and `Displacement`

This will allow us to make some structs, such as `ActorPosition`, much
smaller.

* ActorPosition: Use smaller types

`Monsters`: 56K -> 46K

* player.cpp: Reduce size of `DirectionSettings`

* CrawlTable: Displacement -> DisplacementOf<int8_t>

* CrawlTable: vector<vector> -> array<vector>

Also only allocate one vector during construction instead of two.
A bit less indirection.

* Monster#enemyPosition: Point -> WorldTilePosition

sizeof(Monster): 240 -> 232

* Monster: Further optimize field layout and sizes

sizeof(Monster): 232 -> 208

`Monsters` is down to 40,000 bytes

* DMonsterStr: _mx/_my -> position
2022-07-02 01:49:17 +02:00
Mikołaj Piróg 7cab074aa5 Correct members' names in monster.h (#4850)
* Fix case in AnimStruct
* Rename CMonster members
2022-07-01 23:34:32 +02:00
Mikołaj Piróg 2e7ff45fbf Monster global constants cleanup (#4827)
* Change #defines to constexpr const, add constexpr where applicable, fix typos
2022-07-01 00:43:03 +02:00
Anders Jenbo bf47c95fe6 Consistant variable comparisons 2022-06-30 02:59:23 +02:00
Anders Jenbo cb63e0c8e8 Better name for function that weakens Na-Krul 2022-06-30 02:59:23 +02:00
Anders Jenbo d82f2ebc9e Pass players by reference instead of an index 2022-06-28 00:30:00 +02:00
Anders Jenbo 4c62905381 Deduplicate OperateLever 2022-06-27 10:17:22 +02:00
Anders Jenbo 21fd0fb686 Split delta sync from realtime sync 2022-06-27 10:17:22 +02:00
obligaron 88a0b5ba60 IsValidLevelForMultiplayer: Fix last set level is wrongly assumed as invalid 2022-06-25 18:02:28 +02:00
obligaron d94380953e Fix automap not saved in multiplayer quest/set-maps 2022-06-25 13:06:16 +02:00
Anders Jenbo 6d56058708 Move level generation to subfolder 2022-06-23 09:21:58 +02:00
obligaron 184290a977 Support setlevel in multiplayer 2022-06-18 17:05:30 +02:00
obligaron e151274fdf Introduce IsValidLevel 2022-06-18 17:05:30 +02:00
obligaron 22a113d3a6 Introduce GetLevelForMultiplayer 2022-06-18 17:05:30 +02:00
obligaron 766fdf74df Change IOwnLevel from nReqLevel to player 2022-06-18 17:05:30 +02:00
obligaron 6210f57e82 Change DeltaSyncObject and DeltaPutItem from bLevel to Player 2022-06-18 17:05:30 +02:00
obligaron 8637e05650 Remove bLevel from delta_kill_monster_ and delta_monster_hp 2022-06-18 17:05:30 +02:00
obligaron 783db07cbf Replace CMD_DLEVEL_0/_1/... with generic CMD_DLEVEL 2022-06-18 17:05:30 +02:00
obligaron 303735777e Store delta level information in unordered_map 2022-06-18 17:05:30 +02:00
obligaron 29e4ec4ef1 Move delta structs to msg.cpp 2022-06-18 17:05:30 +02:00
obligaron 316279fdd2 Reduce use of sgLevels 2022-06-18 17:05:30 +02:00
obligaron d0c14fe92f Introduce Player::setlevel 2022-06-18 17:05:30 +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
staphen a2fe3a981e Fix issues with ears due to translation 2022-06-06 07:26:43 +02:00
qndel 354e329644 Players[MyPlayerId] -> MyPlayer 2022-05-31 05:35:52 +02:00
Anders Jenbo 895057584e Use mtype instead of index id to check for golem monsters 2022-05-23 07:31:50 +02:00
obligaron 2b0b944afb Manage friendly mode per player and sync state between clients 2022-05-20 22:46:48 +02:00