Gleb Mazovetskiy
d152d2c0fb
Add OptionalOwnedCelSprite
4 years ago
Gleb Mazovetskiy
21dc7f553d
Add OptionalCelSprite: smaller than std::optional
...
`CelSprite` data pointer can never be `nullptr`.
We implement a smaller `optional` for it by taking advantage of that.
4 years ago
obligaron
a6132a1aa8
Ensure that no overflow happens when loading (invalid) data
4 years ago
obligaron
e87aca38bb
Change animation frames and tick per frame to int8_t
4 years ago
obligaron
d4638f290c
Don't call player.AnimInfo.ProcessAnimation if player death animation is finished
4 years ago
Anders Jenbo
ab55877adc
Take player by reference in UseMana
4 years ago
Anders Jenbo
b00ae287b8
Minimize propegation of global Players index
4 years ago
Gleb Mazovetskiy
92b6be4302
Fix `Point#*Distance` functions for unsigned types ( #4857 )
...
The `-` converts everything to unsigned if one of the operands is
unsigned. Convert everything to int before calculating.
4 years ago
ephphatha
0f1ac758d8
use a smaller buffer
...
fmt::memory_buffer uses 500 bytes by default, go back to a 12 byte char array to avoid all the cruft
4 years ago
ephphatha
d6120f05bc
Only call fmt::format_to when the FPS value updates
...
Don't even need to initialise the buffer since the last update time is set when DiabloInit is called, then as long as the loading screen takes more than a second the threshold gets hit to call format_to on the first frame of gameplay.
4 years ago
k-bar
21b6365589
missile from berserked monster try to hit every monster
4 years ago
Andrew James
ace09d5f45
Address int-arithmetic-overflow in loadsave.cpp ( #4853 )
4 years ago
Andrew James
a083b76ec4
Avoid casting unnecessarily in worldToNormalScreen ( #4852 )
...
This doesn't trigger warnings on msvc, not sure about other compilers. Also added asserts to all functions performing rotations to match Rotate()
4 years ago
Gleb Mazovetskiy
72660d9189
Migrate snprintf to fmt ( #4845 )
...
* Migrate `app_fatal` from printf to libfmt
* Migrate snprintf to fmt
4 years ago
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
4 years ago
Mikołaj Piróg
7cab074aa5
Correct members' names in monster.h ( #4850 )
...
* Fix case in AnimStruct
* Rename CMonster members
4 years ago
Gleb Mazovetskiy
ad7ca97ae1
Fix black background palette ( #4831 )
...
Diablo and Hellfire have different palettes in `ui_art\black.pcx`.
We now ship our own tiny `black.pcx` that takes priority over the
other ones. This `black.pcx` had the Diablo palette which resulted in an
incorrect palette in the Settings screen.
Split our own `black.pcx` file into `black_diablo.pcx` and
`black_hellfire.pcx` and load the correct one depending on the mode.
4 years ago
Andrew James
36bf343de6
Avoid unnecessary iterations in missile routines ( #4843 )
...
* early return from MI_FireRing
* Dedupe Nova missile routines
4 years ago
Gleb Mazovetskiy
010dda42cf
Remove PCX->CEL conversion
...
It is no longer used as we render all assets directly as PCX.
4 years ago
Gleb Mazovetskiy
7e582a5840
DiabloUi: Render focus indicators as PCX
...
They're slightly larger as PCX then CEL but are tiny overall.
This was the last use of `LoadPcxAssetAsCel`.
4 years ago
Gleb Mazovetskiy
0c7e36e81a
DiabloUI: Clean up portrait loading
...
1. Load portraits as PCX (~30% smaller).
2. Simplify the portrait override logic.
4 years ago
Gleb Mazovetskiy
3178dd5158
Replace most uses of `sprintf` with `fmt` ( #4837 )
4 years ago
Vladimir Olteanu
5a5111f1d8
Refactor CrawlTable ( #4833 )
4 years ago
Mikołaj Piróg
405d9d18b6
Monster cleanup ( #4832 )
4 years ago
Gleb Mazovetskiy
bd66e7d6d8
pcx_render: Fix line skipping for odd widths ( #4828 )
...
When line skipping PCX sprites with odd widths, skip the padding pixel
as well.
4 years ago
Gleb Mazovetskiy
7a58f800f4
DiabloUI: Clean up logo handling ( #4830 )
...
1. There is no small logo. Simply use 2 variables.
2. The medium logo is much smaller as PCX:
* Hellfire (`ui_art\hf_logo2.pcx`): 1591816 bytes -> 195850 bytes
* Diablo (`ui_art\smlogo.pcx`): 341923 bytes -> 333099 bytes
* Move `ArtLogoBig` to `title.cpp`
It is only ever used there
4 years ago
Mikołaj Piróg
2e7ff45fbf
Monster global constants cleanup ( #4827 )
...
* Change #defines to constexpr const, add constexpr where applicable, fix typos
4 years ago
Cesar Canassa
1b3360e98a
🐛 fix town boundaries
4 years ago
k-bar
c2432d23e8
Berserk light fix
4 years ago
Gleb Mazovetskiy
5d1a4fd8af
`IncProgress`: Do not render bar if not active
...
Loading the game from within the game calls `IncProgress` multiple times
but we should not render the progress bar when that happens.
4 years ago
Anders Jenbo
223fbe8387
Correctly check size of glpMsgTbl
4 years ago
Anders Jenbo
bf47c95fe6
Consistant variable comparisons
4 years ago
Anders Jenbo
cb63e0c8e8
Better name for function that weakens Na-Krul
4 years ago
Anders Jenbo
e5054a51db
Remove useless code
4 years ago
Anders Jenbo
0cc5ee4344
Clean up variable definitions
4 years ago
Cesar Canassa
ddafe87ed3
♻️ Fix inconsistent monster id variables
...
The monster id naming convention was inconsistent with several names being used: i, mid, mon, mi, monsterId
This chanage normalises all names to monsterId
4 years ago
Trihedraf
e002de4d69
show item labels toggle in menu
...
Co-Authored-By: obligaron <25415264+obligaron@users.noreply.github.com>
4 years ago
Anders Jenbo
54598e2a8f
CreatePlayer by reference
4 years ago
Anders Jenbo
b68fd1ff5e
Use player by reference in OperateShrine
4 years ago
Anders Jenbo
488a052ce6
Clean up OperateShrine
4 years ago
Anders Jenbo
ba4ee58c9f
Pass along bools instead of player index
4 years ago
Anders Jenbo
1c286b5624
Directly call StartMonsterDeath instead of feeding M_StartKill invalid input
4 years ago
Anders Jenbo
d82f2ebc9e
Pass players by reference instead of an index
4 years ago
Anders Jenbo
e47599c45f
Clean up BreakBarrel
4 years ago
Anders Jenbo
0d27761ac2
Make _oAnimFlag a boolean
4 years ago
Anders Jenbo
4c62905381
Deduplicate OperateLever
4 years ago
Anders Jenbo
21fd0fb686
Split delta sync from realtime sync
4 years ago
obligaron
c955722c32
Fix portal don't deactive on set levels
4 years ago
Anders Jenbo
9d167e22c1
Clean up Operate Door
4 years ago
Vladimir Olteanu
84687fec42
Remove spurious "I can't cast that here"
4 years ago