Untangles dependencies by splitting up `engine.{h,cpp}` into 3 files:
1. `primitive_render`
2. `ticks` -- only contains `GetAnimationFrame` for now.
3. `GetWidth2` renamed to `CalculateSpriteTileCenterX` and moved to `levels/dun_tile.hpp`.
`DrawHalfTransparentBlendedRectTo` takes up a significant chunk of time
when rendering store and quest dialogs.
Optimize the function to read 2 pixels at a time and write 4 pixels at a
time.
Identified and removed an instance of Direction being used as an argument for a bool parameter
Removed a single-use temporary variable being cast from sprite frame to direction to size_t
Co-authored-by: Anders Jenbo <anders@jenbo.dk>
Fix alignment of WalkSettings array
* 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
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.
It was documented as if this stored a seed in the previous LCG cycle but it actually stored the initial seed for the current cycle. This value is never used.
Disabled by default because of these known issues:
1. When clicking on inventory item, it briefly appears a bit shifted (in the wrong coordinates).
This issue can happen with software cursor as well, but is a lot more
obvious with the hardware cursor.
2. Cursor is scaled with nearest-neighbour scaling, which may look a bit different from
how the rest of the graphics are scaled.
See also previous attempt: https://github.com/diasurgical/devilutionX/pull/955 by @viciious
Co-authored-by: Victor Luchits <vluchits@gmail.com>
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`.
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.
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.
`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.
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.