383 Commits
Author SHA1 Message Date
obligaron ccaf8d1dac Use uint8_t in msg/multi/sync and fix MSVC warnings (#6856)
* Fix MSVC warnings in msg.cpp

* Move TBuffer to multi.cpp

* Fix MSVC warnings in multi.cpp

* SNet* change databytes to size_t

* msg/muli/sync: Change playerId to uint8_t
2023-12-16 18:56:06 +01:00
obligaron 75f68e1b8f Introduce Player::occupyTile 2023-11-26 23:38:34 +01:00
Gleb Mazovetskiy e350d9be06 Remove SNetGet/SetLastError
The only named code that was ever set is `STORM_ERROR_NO_MESSAGES_WAITING`.
There was also a call in `menu.cpp` which as far as I can tell is not
needed (if it is, it should be replaced by something else).
2023-11-14 02:53:49 +00:00
obligaron b810c808f5 Msg: Change OnXYZ to get a Player reference instead of a player index 2023-11-12 22:17:59 +01:00
Anders Jenbo af295b9f48 Fix warnings with conversion between size_t and int for playerId 2023-11-07 22:07:07 +01:00
staphen 444ac9d820 Use memmove when shifting data in high/low priority buffers 2023-09-27 21:51:13 +02:00
ephphatha da76e131e4 Add getter/setter for character levels to ensure _pNextExper stays synced 2023-08-24 05:46:44 +02:00
Gleb Mazovetskiy 8c1a847f41 Remove utils/stdcompat/string_view.hpp 2023-08-14 09:59:14 +01:00
Gleb Mazovetskiy 74755c8be7 Remove utils/stdcompat/cstddef.hpp 2023-08-14 01:54:29 +01:00
staphen b1711739c6 Immediately drop player who sends invalid player data 2023-07-20 05:44:19 +02:00
Eric Robinson 074a1f2e0c Rename: Loopback -> Offline (#6300) 2023-07-03 06:37:53 +02:00
staphen c2814088d2 Add fields to PlayerNetPack for validation 2023-06-28 15:46:54 +02:00
Anders Jenbo 63277a842d Clean up player packing 2023-06-24 04:18:14 +02:00
Anders Jenbo efa51993e3 Split network player sync and hero save file 2023-06-24 04:18:14 +02:00
Gleb Mazovetskiy 4fa3732526 Add missing <cstdint> includes
Done with the following script:

```ruby
Dir["Source/**/*.{h,c,cc,cpp,hpp}"].each do |path|
  v = File.read(path)
  next if !v.include?("uint32_t") || v.include?("cstdint")

  lines = v.lines
  line_num = if lines[2].start_with?(" *")
    lines.index { |l| l.start_with?(" */") } + 3
  else
    3
  end

  lines.insert(line_num, "#include <cstdint>\n")

  File.write(path, lines.join(""))
end
```

then fixed-up manually
2023-05-10 13:50:12 +01:00
Anders Jenbo 5a12f7b0d5 Always spawn players in a valid location 2023-04-29 15:34:41 -04:00
staphen 08592377a7 Clean up logic for PT_MESSAGE prioritization 2023-04-25 05:34:08 +02:00
obligaron e1cdec438e When player position desyncs ensure position.old is also updated 2023-04-17 01:35:34 +02:00
qndel ce2ce86070 inspect players command 2023-04-14 02:40:17 +02:00
obligaron 04b66114f2 Multiplayer: When updating remote player tile ensures that it's free 2023-03-31 15:11:37 +02:00
obligaron 4826e5819e Multiplayer: Fix desync when teleporting 2023-03-20 07:04:54 +01:00
obligaron adeeae2c52 Add option to enable singleplayer quests in multiplayer 2023-02-27 05:00:07 +01:00
Anders Jenbo a29fc3a074 Correct casing for Player::isWalking() 2023-01-12 09:42:49 +01:00
Gleb Mazovetskiy ca69237d59 Big-endian support for multiplayer
Not sure if this works but it's a start
2022-12-15 05:59:17 +01:00
Gleb Mazovetskiy ec12d7ce44 Player: Optimize to save 40 bytes 2022-10-11 10:17:01 +01:00
obligaron 5b6beac375 Introduce Player::getAnimationFramesAndTicksPerFrame 2022-09-04 17:58:18 +02:00
Anders Jenbo 872456ae5d Use size_t for a select few pnum variables 2022-08-26 13:22:04 +09:00
Gleb Mazovetskiy 188dc79f6e Make Players a vector 2022-08-26 13:22:04 +09:00
Anders Jenbo f6b167683c Correct some header includes (#5239) 2022-08-15 10:57:28 +09:00
Vladimir Olteanu 74232f13bf Get rid of dthread 2022-08-03 02:18:54 +02:00
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
Anders Jenbo acc4f27f63 Remove last usage of DWORD 2022-07-16 09:39:50 +02:00
Anders Jenbo 9cae6dad7d Clean up most usages of DWORD 2022-07-14 23:50:12 +02:00
Gleb Mazovetskiy 33ac2cca8e ♻️ Make Monster counters size_t 2022-07-12 03:04:53 +01:00
Anders Jenbo a7be622aa3 Clean up naming of event handler 2022-07-10 21:13:39 +02: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
ephphatha 1fb45a7f25 Take Player reference in FixPlrWalkTags 2022-07-10 06:03:10 +02:00
Mikołaj Piróg 15989609a8 Members' name changes and comments in Monster struct (#4861) 2022-07-06 10:21:22 +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
Anders Jenbo 0b7ad34c9d Take player by reference in StartWalkStand and RemovePlrMissiles (#4874) 2022-07-03 21:17:07 +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 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 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 223fbe8387 Correctly check size of glpMsgTbl 2022-06-30 02:59:23 +02:00
Anders Jenbo bf47c95fe6 Consistant variable comparisons 2022-06-30 02:59:23 +02:00
obligaron 184290a977 Support setlevel in multiplayer 2022-06-18 17:05:30 +02:00