Commit graph

182 commits

Author SHA1 Message Date
Andrew James
021c7a652f
Add helpers for checking object type (#3357)
* Add helper to test if an object is a trap source
* Add helper to test if an object is a barrel
* Add helper to test if an object is a crucifix
* Add helpers to check if an object is a chest (and statuses)
* Add helpers to check if an object is a (basic) shrine
2021-11-06 18:32:52 +01:00
Anders Jenbo
74b57558c9 🚚 Move local code to anonymous namespace 2021-07-10 17:30:15 -07:00
Gleb Mazovetskiy
cb0dae8590 🚚 Rename CelOutputBuf to Surface and extract 2021-07-03 05:33:32 -07:00
qndel
373f1db22e
If cleanup + bugfixes (#2273) 2021-07-01 18:32:25 +02:00
ephphatha
357f6f1dc3 Move RNG functions to their own header/source files 2021-06-27 03:09:41 -07:00
Andrew James
20190ee687
Update random number functions to avoid IB (#2226)
* Update random number functions to avoid IB

Most calls to set seed were using uint32_t already, there were a few variables which were better served by having their type changed from signed to unsigned. The one exception is ItemStruct::_iSeed. This is an identifier that also happens to be used as a seed occasionally so a comment was added documenting this exception.

Includes suggested style changes for Source/towners.h; Source/towners.cpp; Source/msg.h; Source/multi.h
2021-06-27 10:37:09 +02:00
Anders Jenbo
af254601d6 ♻️ Apply clang-tidy to engine 2021-06-25 13:22:08 +02:00
Gleb Mazovetskiy
14218080b6 🚚 engine.h: Extract CelGetFrame and friends 2021-06-21 02:34:28 -07:00
Gleb Mazovetskiy
4ea7ba0f5f 🚚 engine.h: Extract LoadLE32 and LoadBE32 2021-06-21 02:34:28 -07:00
Gleb Mazovetskiy
1bc9c3973f 🚚 engine.h: Extract Rectangle 2021-06-21 02:34:28 -07:00
Gleb Mazovetskiy
e40b1963f9 🚚 engine.h: Extract CelSprite and file loading 2021-06-21 01:36:20 -07:00
Gleb Mazovetskiy
aa54675d83 🚚 engine.h: Extract Size 2021-06-21 01:36:20 -07:00
Gleb Mazovetskiy
dcf3397139 🚚 engine.h: Extract ActorPosition 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
Juliano Leal Goncalves
25eaac78c1 ♻️ Leverage 'Size' to represent a 'Rectangle's width/height 2021-06-20 18:27:45 -07:00
Juliano Leal Goncalves
e3ea6a9042 ♻️ Leverage 'Point' to represent a 'Rectangle's position 2021-06-20 18:27:45 -07:00
Juliano Leal Goncalves
ff147f9280 🚚 Rename 'RECT32' to 'Rectangle' to match naming style of other core structs 2021-06-20 18:27:45 -07:00
Juliano Leal Goncalves
4490340a47 🚚 Move 'RECT32' type to 'engine.h' alongside other core types 2021-06-20 18:27:45 -07:00
ephphatha
8d5b5e833b Add tests for LCG random engine
This documents the chosen LCG parameters and the default mapping function used in random number generation.

GetLCGEngineState() is a helper needed for testing because AdvanceRndSeed combines a distribution with a call to progress the engine. I'll split those eventually but this at least shows the current behaviour and should flag any bugs introduced by future changes.
2021-06-20 16:27:06 -07:00
Gleb Mazovetskiy
982260d94e Clip control.cpp draw calls
No longer crashes there when running at a resolution smaller than
640x480
2021-06-16 03:12:54 +02:00
Juliano Leal Goncalves
1328c9ea93 🎨 Make 'Size' fields camelCase 2021-06-12 19:47:52 +02:00
qndel
4ba2c755c3
attempt to fix CI (#2113)
fix CI build
2021-06-03 01:23:48 +02:00
Vladimir Olteanu
02ffada9b8 constexpr version of abs 2021-06-02 13:36:17 +02:00
Vladimir Olteanu
fce8f7a503 Make Point stuff constexpr 2021-06-02 13:36:17 +02:00
Vladimir Olteanu
e37e7e408c Introduce Point::WalkingDistance 2021-06-02 13:36:17 +02:00
Vladimir Olteanu
690211a699 replace Point::Absolute with abs 2021-06-02 13:36:17 +02:00
Vladimir Olteanu
ba3f0aef8b Introduce Point::Absolute and Point::ManhattanDistance 2021-06-02 13:36:17 +02:00
Juliano Leal Goncalves
8622130966 ♻️ Add '==' and '!=' operators to 'Size' struct 2021-05-31 06:13:24 +02:00
Juliano Leal Goncalves
58501cab26 🚚 Move 'Size' struct to engine.h 2021-05-31 06:05:13 +02:00
Kalebe Alves
0461529176 Move byte from engine.h 2021-05-27 16:04:27 +02:00
Juliano Leal Goncalves
94164812f4 🏷️ Add integer overload for Point multiplication operator 2021-05-25 04:09:02 +02:00
Anders Jenbo
43f26084d0 Fix warnigns 2021-05-24 05:27:06 +02:00
Juliano Leal Goncalves
21fdb0dcd9 ♻️ Replace manual direction displacement logic with 'Point' add operator 2021-05-24 04:46:08 +02:00
Juliano Leal Goncalves
d55cd99dd5 🚚 Rename 'direction' enum to 'Direction' 2021-05-24 04:46:08 +02:00
Gleb Mazovetskiy
2f3fa76320 Fix gkd350h build
Works around a GCC bug on some platforms:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97044
2021-05-18 18:22:48 +02:00
obligaron
be13a0f727 Point: Add operator* float and operator- 2021-05-16 21:24:36 +02:00
Gleb Mazovetskiy
1181cc68ac 🎉 Remove buffer padding
The padding is no longer needed
2021-05-11 07:57:08 +02:00
Vladimir Olteanu
4ff0221a8d Fix https://github.com/diasurgical/devilutionX/issues/1928 2021-05-11 02:49:17 +01:00
Gleb Mazovetskiy
710ddb9af6 ♻️ Make SetPixel a method 2021-05-07 01:02:03 +02:00
Gleb Mazovetskiy
9a9941efdd 🚚 Move CL2 rendering to engine/render/cl2_render.cpp 2021-05-07 01:02:03 +02:00
Gleb Mazovetskiy
febaf0dc8b 🐞 Fix misaligned load in GetCelFrame 2021-05-07 00:16:40 +02:00
Gleb Mazovetskiy
0edfa3de66 🚚 Move CEL rendering to engine/render/cel_render.cpp 2021-05-07 00:16:40 +02:00
Gleb Mazovetskiy
473d1b0b14 🎉 Clip CEL drawing functions
Implements clipping for all CEL drawing functions except stippled and outline.
2021-05-07 00:16:40 +02:00
Gleb Mazovetskiy
59dd42692f 🚚 Move render.cpp to engine/render/dun_render.cpp 2021-05-06 21:30:06 +02:00
Anders Jenbo
f579b2f287 Handle cel/cl2 files as byte arrays 2021-05-06 13:17:54 +02:00
Gleb Mazovetskiy
e7a9293153 ♻️ engine.h: Minor refactoring
1. Move `SetPixel` definition to the header to make it easier for the
   compiler to inline (make it inlinable even without LTO).
2. Add an `operator[](Point)` overload to `CelOutputBuffer`.
2021-05-06 12:58:06 +02:00
Gleb Mazovetskiy
afef72f916 🎉 New map renderer
Uses integer math only: This speeds up the rendering and eliminates some
zoom artifacts.

Improves player indicator look -- it's now symmetric and more legible.
2021-05-06 12:58:06 +02:00
Anders Jenbo
3746723f52 ♻️Add type to MIN-files and TRN-files 2021-05-05 04:03:23 +02:00
Anders Jenbo
fa0b286693 ♻️Typed file loading
Tthis gives us the option to specify what type a file should be loaded
as, avoidng the need to case it and does some automatic checks on the
fitness of the data, while making the process simpler.

If no type is given then the type will be set to std::byte which limit
what operations can be performed on the data.
2021-05-04 19:08:37 +02:00
thebigMuh
24f32a1d53
Fix sound volume/panning attenuation (#1789)
* Fixing volume adjustment and scaling
2021-05-03 02:11:22 +02:00