Commit Graph
234 Commits
Author SHA1 Message Date
Juliano Leal Goncalves d55cd99dd5 🚚 Rename 'direction' enum to 'Direction' 2021-05-24 04:46:08 +02:00
Anders Jenbo a095bc0bf7 ♻️Migrate more code away from miniwin 2021-05-13 02:30:18 +02:00
staphen 3e5e5b2696 Synchronize SFileCloseFile() access 2021-05-08 04:01:07 +02:00
Gleb Mazovetskiy 9a9941efdd 🚚 Move CL2 rendering to engine/render/cl2_render.cpp 2021-05-07 01:02:03 +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
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 92db72719d 🔥 Remove some unused code 2021-05-05 10:16:45 +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
Gleb Mazovetskiy 987ab2533b 🐞 Synchronize SFileReadFile access
StormLib read function is not thread-safe: https://github.com/ladislav-zezula/StormLib/issues/175
2021-05-03 02:35:22 +02:00
Anders Jenbo 654a2b8834 ♻️Clean up automap code
Use Point for x,y pairs. Make helpers for drawing door and squares
2021-05-02 15:27:38 +02:00
Gleb Mazovetskiy f33f7ae7eb 💨 Do not zero-initalize arrays we write to
`std::make_unique<T[]>(size)` always zero-initalizes the array.

C++20 has `std::make_unique_for_overwrite` to avoid that, while
older C++ versions can use the approach applied here.
2021-05-02 05:52:11 +02:00
Gleb Mazovetskiy 63e0e60956 Add MeasureSolidHorizontalBounds
Adds a function to measure the X-coordinates of the solid
(non-transparent) bounding box of a CEL.
2021-05-02 00:22:07 +02:00
Gleb Mazovetskiy 1b8b62a8c2 ♻️ Store CEL width with the sprite itself
Instead of passing the CEL sprite width when drawing, store the CEL
width at load time in the new `CelSprite` struct.

Implemented for most sprites except towners, missiles, or monsters.
2021-05-01 20:51:55 +02:00
Gleb Mazovetskiy 144dd6cd93 ♻️ engine.cpp: Minor cleanup in draw functions
1. Introduce a couple of constants.
2. Extract a helper function for getting the light table pointer.
2021-04-28 11:53:39 +01:00
thebigMuh ad8f342db0 Adding constness 2021-04-26 23:30:02 +02:00
obligaron 239a43cc1c Remove "AnimWidth2" expect for missiles (#1680) 2021-04-25 13:32:33 +02:00
Anders Jenbo f77c52941a ♻️Make GetDirection take Points instead of ints 2021-04-25 02:25:52 +02:00
Anders Jenbo bd389e9ef6 ♻️ Clean up bool logic in engine.cpp 2021-04-23 02:47:10 +02:00
Anders Jenbo 1e3ed903be 🎨 strip redundant else 2021-04-22 00:39:48 +02:00
Anders Jenbo 593c6a6f17 🎨 Drop unused param and rename random_ to GenerateRnd 2021-04-22 00:08:19 +02:00
Anders Jenbo d024f79b0e 🧹 performance-unnecessary-value-param 2021-04-22 00:08:19 +02:00
Jmgr 1d84156509 Simplify bitshift divisions/multiplications 2021-04-21 05:31:17 +02:00
Anders Jenbo bb4e1960e7 🎨 modernize-use-nullptr 2021-04-19 16:02:05 +02:00
Anders Jenbo c89bd9c001 🚨 Fix remaning warnings for clang and gcc 2021-04-19 02:44:39 +02:00
Anders Jenbo 997c1dba55 🚚 Split up all.h in to proper header relations 2021-04-16 01:04:54 +02:00
Anders Jenbo 6e1a106a38 🚚 Move header we implement into the project 2021-04-16 01:04:54 +02:00
Gleb Mazovetskiy 26a9930a70 Stop relying on buffer padding in CelBlitSafeTo 2021-04-10 19:09:28 +01:00
Anders Jenbo 20186e0370 🎨 Replace TRUE/FALSE with true/false
fix


Fix


fix
2021-04-09 15:13:02 +02:00
Anders Jenbo 93d42b62b8 ♻️ Change BOOL to bool 2021-04-09 15:13:02 +02:00
Anders Jenbo bfb3c11c2b 🎨 Change namespace to devilution 2021-04-06 15:21:25 +02:00
Anders Jenbo 630e507f63 🚚 Apply namespace 2021-04-06 15:21:25 +02:00
Gleb Mazovetskiy 21a4a671e4 Cleanup DiabloAllocPtr
1. Removes a lock around allocation. `malloc` is required to be thread-safe in C11.

2. Defines it as a macro so that:

   1. We provide the correct location for the OOM error.
   2. We get better attribution from memory profilers.
2021-04-06 11:38:47 +02:00
FluffyQuack c0f57f3020 🐮 Draw outline for color in index 0 for inventory icons. (#1318) 2021-04-03 03:39:44 +02:00
Juliano Leal Goncalves 800dbce066 ♻️ Move options-related structs to new 'options.h' file 2021-03-27 03:26:44 +01:00
Anders Jenbo fbd86cd3c5 🎨 Mark noreturn functions as such 2021-03-26 02:24:32 +01:00
Anders Jenbo 17803d5923 ♻️ Apply proper types to PlayerStruct 2021-03-14 15:38:23 +01:00
Gleb Mazovetskiy cd59a1c323 Completely replace gpBuffer with CelOutputBuffer
`CelOutputBuffer` now contains an `SDL_Surface` and an `SDL_Rect`.

We now have access to SDL surface manipulation functions.

`gpBuffer` and `gpBufEnd` are completely gone 🧹

This results in some FPS loss (250 -> 195) recovered in a subsequent
commit.
2021-03-13 05:13:26 +01:00
Xadhoom cb65d308cf RNG: do not rely on implicit conversions in arithmetic expressions 2021-03-13 01:35:09 +01:00
Juliano Leal Goncalves 103cde53ff ♻️ Make options struct hierarchical 2021-03-10 10:11:42 +01:00
Gleb Mazovetskiy ba6a78ebc8 Migrate Cl2DrawOutline to accept a buffer 2021-03-06 09:55:14 +01:00
Gleb Mazovetskiy 819b5b05df Migrate Cl2DrawLightTbl to accept a buffer 2021-03-06 09:55:14 +01:00
Gleb Mazovetskiy 07f4dbbd2e Migrate Cl2Light to accept a buffer 2021-03-06 09:55:14 +01:00
Gleb Mazovetskiy bb3ba369df Migrate Cl2Draw to accept a buffer 2021-03-06 09:55:14 +01:00
Gleb Mazovetskiy d55a1c8a7d Pass CelOutputBuffer to game text printing (#1095)
* Pass CelOutputBuffer to game text printing
* DrawHalfTransparentRectTo: minor cleanup
2021-03-03 18:20:24 +01:00
Gleb Mazovetskiy 83ce7c27af Enginify trans_rect
Moves `trans_rect` to `engine` as `DrawHalfTransparentRectTo` and makes
it operate on `CelOutputBuf`.
2021-03-03 12:07:07 +01:00
Gleb Mazovetskiy 188d3d5ec0 automap: Migrate away from gpBuffer/gpBufEnd 2021-03-01 13:30:57 +01:00