285 Commits
Author SHA1 Message Date
Gleb Mazovetskiy 961866e1c4 CLX: A new graphics format
The format is almost identical to CL2, except it uses the frame header
to store frame width and height instead of 5 32-line offsets.

This means we always have access to frame dimensions, so we can use it
as an on-disk format for our graphics as well.

Additionally, we may be able to optimize the rendering even more
in the future now that we have guaranteed knowledge of frame dimensions.
2022-08-03 02:38:55 +02:00
ephphatha 0ce76a3f13 Add Object lookup method to mimic map::at() 2022-07-28 12:47:13 +02:00
ephphatha 35bf79b007 Use Monster& in PrintDebugMonster 2022-07-25 14:43:50 +02:00
Gleb Mazovetskiy 8ca71272b8 Load all CEL as CL2
Convert CEL files to CL2 at load time. CL2 format is more efficient and is about as fast to render.

CEL vs CL2 sizes, on dLvl 5: https://gist.github.com/glebm/9bbdd76962abcd4fd2405ecd3379af97

Memory:

* Peak memory (while loading): -300 KiB
* Memory in-game (dLvl5): -700 KiB
* RG99 binary size: -15 KiB (1333096 -> 1317192)

Performance on rg99:

* On average, -1 FPS in town.
* Same FPS in dungeon (20 FPS on dLvl 1).
2022-07-19 10:59:35 +02:00
Gleb Mazovetskiy 4c1dbaba72 Demo mode: Handle endianness 2022-07-18 10:35:27 +01:00
Anders Jenbo d1189388f5 Use user by reference 2022-07-17 18:41:05 +02:00
Gleb Mazovetskiy 3d4f0b48b8 Remove TranslateMessage
It has become entirely redundant.
2022-07-17 11:44:52 +02:00
Anders Jenbo 16b65120ea Clean up LevelMonsterTypes related code 2022-07-15 19:36:47 +02:00
Mikołaj Piróg 262fa9ac2d Rename MonsterData members (#5000) 2022-07-15 16:20:13 +02:00
Mikołaj Piróg c38db60d0b Remove monster name member from monster struct (#4986) 2022-07-14 10:16:19 +02:00
ephphatha c2ccaf2080 Use ObjectAtPosition helpers for dun export 2022-07-13 11:44:07 +02:00
ephphatha 1337ff6ea2 Add check if a monster potentially has leashed minions 2022-07-13 07:13:34 +02:00
ephphathaandAnders Jenbo 4fef842b0b Remove use of ID/index from PlaceGroup
use getId helper for leader id

Co-authored-by: Anders Jenbo <[email protected]>
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 3ae834148a Split event handeling from general miniwin features 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
Gleb Mazovetskiy c8ddf7df65 Crawl: Move implementation from header to cpp 2022-07-09 11:29:31 +02:00
Vladimir Olteanu bed5bd9ec1 Eliminate CrawlTable 2022-07-07 18:55:34 +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 de971c6a8b ♻️ Refactor AddMonster to return a monster pointer (#4894) 2022-07-06 02:36:02 +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
Gleb Mazovetskiy d152d2c0fb Add OptionalOwnedCelSprite 2022-07-03 12:26:39 +01: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
Gleb Mazovetskiy 3178dd5158 Replace most uses of sprintf with fmt (#4837) 2022-07-01 17:02:56 +02:00
Vladimir Olteanu 5a5111f1d8 Refactor CrawlTable (#4833) 2022-07-01 06:19:33 +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
obligaron 3cb55c95a4 DebugCmdLoadQuestMap: Don't load entry quest lvl if the hero is already on this level 2022-06-25 13:02:48 +02:00
Anders Jenbo 6d56058708 Move level generation to subfolder 2022-06-23 09:21:58 +02:00
Gleb Mazovetskiy de3c9874c7 Migrate large bool arrays to std::bitset
E.g. `dRendered` size is reduced by 10 KiB
2022-06-21 01:59:13 +02:00
Anders Jenbo 860bd1cebf Operate directly on SOL data 2022-06-18 21:27:05 +02:00
obligaron 9ac04314f4 Introduce Player::isOnLevel 2022-06-18 17:05:30 +02:00
Andrew James 4bd1e06336 Point mega <-> world conversion helpers 2022-06-13 00:27:57 +02:00
Anders Jenbo afec954c9a Convert dflags to boolean 2022-06-09 09:30:46 +02:00
Anders Jenbo 1203514383 Clean up use of currlevel 2022-06-07 21:35:01 +02:00
Anders Jenbo 6d2311931f [debug] Export levels as dun maps 2022-06-03 08:37:37 +02:00
qndel 354e329644 Players[MyPlayerId] -> MyPlayer 2022-05-31 05:35:52 +02:00
Anders Jenbo 6c6999235f Add debug command for testing custom levels 2022-05-14 09:11:42 +02:00
DakkJaniels dad46e1905 Item special effect enum (#4129) 2022-04-19 15:44:46 +02:00
Anders Jenbo dc706e8ed5 Use HoldItem for determining if an item is held
This cleans up a bit of code and solves a few edge cases where an item
could be lost, the game be unresponsive, or miss fire an event during
lag cause of the cursor not reflecting the currently held item.
2022-04-18 11:27:07 +02:00
Anders Jenbo 1ba817ca53 Unify gold handling (withdraw any amount from stash) 2022-03-22 21:38:51 +01:00
Andrew James f64d17bfa9 Initial clean up of code related to creating items (#2943)
* Move declaration of dItems to items.cpp

This array is never used in dungeon generation, it's closely related to Items so should be kept together. Ideally managing dItems can become responsibility of a container for Items, which will handle adding/removing items from the list and keeping the positions in sync.

* Rename SetPlrHandItem to match purpose/use

* Give more descriptive name to GetPlrHandSeed

This function sets a new seed on a given item struct, not just the held item.

* Don't use HoldItem as a temporary for the players initial inventory

* Take Item by reference in RespawnItem

* Don't use holdItem as a temporary when dropping gold on death

* Update DeadItem to take item by reference, and refer to it consistently

Move code which invalidates the source of dropped items to the caller

Most call sites use a temporary item instance or remove the item from the container, so there's no real point invalidating the item after it's been copied to the drop list.

Update DeadItem to take position instead of player references
2022-03-06 14:53:29 +11:00
Gleb Mazovetskiy 7fede6c4cb Clean up owned/unowned CelSprite ambiguity
Makes `CelSprite` unowned and adds a new `OwnedCelSprite` class for
owned sprites.

This clarifies ownership and makes the code cleaner in a number of
places.

Additionally, because the `CelSprite` class is now tiny (1 less
pointer), we can pass it by-value instead of by-reference, removing a
pointer indirection in the rendering functions.
2022-03-06 04:49:13 +01:00
qndel d3995736b9 fix spawning unique monsters 2022-02-23 22:37:12 +01:00
Stephen C. Wills e2a9dbca91 Fix format strings in PrintDebugMonster() (#4087) 2022-02-22 18:50:29 +01:00
qndel 73a5f4861e changemp/hp commands 2022-01-25 20:49:13 +01:00
qndel c2b2d0c0e6 use RestoreFullHP/Mana functions 2022-01-25 20:13:50 +01:00
ephphatha 903b661307 Use ObjectAtPosition for debug object type display
The other use of dObject is displaying the contents of that array so makes sense to leave as is. We're also able to remove the map since we can reference the current object type value directly on the returned object.
2021-12-28 16:01:37 +01:00
KPhoenixandAnders Jenbo a08026097a Chat Interface Revision (#3840)
Co-authored-by: Anders Jenbo <[email protected]>
2021-12-25 10:11:42 +00:00