262 Commits
Author SHA1 Message Date
staphen 4f8dc6c4d0 Remove byte order logic from half-transparency lookups 2023-12-20 00:05:49 +01:00
Gleb Mazovetskiy 55b0fc5c26 Text inputs: Selection, copy, cut
Adds shift selection, Ctrl+C, and Ctrl+X handling.

Also fixes left-right movement for non-ASCII characters.
2023-10-30 20:34:12 +00:00
Eric Robinson 4c7e2edd06 Automap: Transparency (#6607) 2023-09-24 21:30:44 +00:00
Gleb Mazovetskiy b83637add8 Use a C array for transparency LUT for debug perf
In a debug build, `std::array` accesses are function calls.

Timedemo on my machine:
* Before: 45.39 seconds	141.3 FPS
* After:  40.20 seconds	159.5 FPS
2023-09-10 17:57:15 +01:00
qndel 731ad1ada5 use std::rotate (#6019) 2023-04-22 13:53:03 +02:00
Gleb Mazovetskiy 46e755f680 Simplify spell icon handling
Hide the internals of spell icon rendering behind simple functions.
2022-11-22 02:37:19 +01:00
Gleb Mazovetskiy 0f0f57080c render: Move common_impl.h into clx_render.cpp
We no longer have other renderers.
2022-08-03 02:38:55 +02:00
Anders Jenbo 2d21fc372e Remove more miniwin code 2022-07-10 21:13:39 +02:00
Cesar Canassa e538acb248 📝 Fixes Doxygen warnings (#4904) 2022-07-07 12:51:24 +02:00
Gleb Mazovetskiy ba71949ebb Add 2 options to reduce static memory use 2022-06-19 18:59:06 +02:00
Anders Jenbo b6bdbcfc98 Stip stippled transparency 2021-12-21 12:55:30 +01:00
obligaron 6273f700fa Add some Graphic Settings to Settingsmenu (#3617) 2021-11-27 00:25:48 +01:00
Gleb Mazovetskiy b7beb2fbe9 Optimize DrawHalfTransparentBlendedRectTo
`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.
2021-11-07 19:18:49 +00:00
ephphathaandAnders Jenbo b12de6fe12 Use scoped enum for Direction
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 <[email protected]>

Fix alignment of WalkSettings array
2021-09-12 02:27:47 +02:00
Anders Jenbo 90960f0c14 Remove dead code 2021-08-07 00:36:38 +02:00
Anders Jenbo 35ccc8eb1c Apply clang-tidy to code 2021-07-10 17:30:15 -07:00
Anders Jenbo 74b57558c9 🚚 Move local code to anonymous namespace 2021-07-10 17:30:15 -07:00
ephphatha b680e3fef1 Align end comment markers for doxygen comments
Including a bunch from previous PRs (since I was responsible for the broken formatting for most 😓)
2021-07-09 18:00:15 +02:00
Gleb Mazovetskiy cb0dae8590 🚚 Rename CelOutputBuf to Surface and extract 2021-07-03 05:33:32 -07: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
Gleb Mazovetskiy e40b1963f9 🚚 engine.h: Extract CelSprite and file loading 2021-06-21 01:36:20 -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
ephphatha fa8eada221 Remove unused variable.
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.
2021-06-20 02:51:04 -07:00
Gleb MazovetskiyandVictor Luchits f9d20b44d6 🎉 Hardware cursor (SDL2-only)
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 <[email protected]>
2021-06-19 01:03:40 +02: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
qndel b1d74d2791 alt highlighting (#2060) 2021-05-25 23:47:29 +02:00
obligaron 60616f2497 LoadFile support in Unittests 2021-05-24 20:12:43 +02:00
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