Commit graph

192 commits

Author SHA1 Message Date
qndel
9ba64ad08b
TRN rewrite + bugfix (#4056)
* working new TRN system
* apply TRNs to all unique missiles
2022-02-20 14:28:51 +01:00
Gleb Mazovetskiy
48ff656dc0 Load monster graphics into a single buffer
Follow-up to a5e1fa5bbe, which loaded
the missiles into a single buffer.
2022-02-17 22:02:41 +00:00
obligaron
79b926c375 Move more options to OptionEntryBase 2022-02-05 20:51:54 +01:00
Gleb Mazovetskiy
a5e1fa5bbe Load missile frames into a single buffer
Previously, the memory for each frame was allocated separately.

Changes it to allocate a single buffer for all the frames.

This has the following advantages:

1. Less bookkeeping overhead in the allocator.
2. Less alignment overhead (allocator results are max-aligned by default).

We can follow this up with a similar treatment for other multi-file
animations.
2022-02-01 04:04:59 +00:00
Gleb Mazovetskiy
1519e995cf Move store graphics out of stores.cpp
These graphics are used in various places outside of `stores.cpp`.
2022-01-30 14:56:04 +01:00
ephphatha
fb21ffb635 Define a column major iterator for code requiring that iteration order.
GCC and specifically GCC6 really don't like inheriting common code, requires redefining almost everything.
2022-01-19 03:05:27 +01:00
ephphatha
c4c664c6be Add class to allow iterating over all points in a rectangle
Co-authored-by: Gleb Mazovetskiy <glex.spb@gmail.com>
2022-01-19 03:05:27 +01:00
obligaron
2843d99485 Fix walk stuttering with Preview Frame 2022-01-15 14:40:35 +01:00
obligaron
75760382ef Regard preview frame in AnimationInfo 2022-01-12 12:26:39 +01:00
obligaron
a7f361de41 AnimationInfo: Change TicksSinceSequenceStarted and relevantAnimationTicksWithSkipping to float 2022-01-12 12:26:39 +01:00
Gleb Mazovetskiy
e12adf689e Fix windows build 2022-01-06 13:43:01 +00:00
KPhoenix
a08026097a
Chat Interface Revision (#3840)
Co-authored-by: Anders Jenbo <anders@jenbo.dk>
2021-12-25 10:11:42 +00:00
Anders Jenbo
b6bdbcfc98 Stip stippled transparency 2021-12-21 12:55:30 +01:00
obligaron
9a14edfcd9 Add OptionEntries for Hardware Cursor 2021-12-17 20:12:17 +01:00
Gleb Mazovetskiy
9bc9bb6d33 Fix demomode file comments 2021-12-17 16:27:19 +00:00
Gleb Mazovetskiy
1f2d67f98b Fix demomode line endings 2021-12-17 16:27:19 +00:00
Gleb Mazovetskiy
076b0c0c05 Overhaul tests
1. Adds a `libdevilution_so` target when tests are enabled.
2. Each test file is now a separate binary target linked against `libdevilutionx_so` (can now run tests in parallel).
3. Tests are now defined in a separate `test/CMakeLists.txt` file.
4. Building the tests is now controlled by the standard `BUILD_TESTING` option (defined by CTest).
5. Tests are now built by default.
6. On CI, test errors are now reported.

Also:

* `.clang-format`: Enable SortIncludes in tests
* `path_test.cpp`: Fix -Wsign-compare
2021-12-16 20:26:51 +00:00
obligaron
5e2ad66e64 Add OptionEntry Resolution 2021-12-08 00:37:06 +01:00
Gleb Mazovetskiy
0f924528ba macOS/iOS: Add resources to the bundle 2021-12-05 20:33:24 +01:00
obligaron
2e5a488d5f Add OptionEntry for graphics 2021-12-05 02:00:27 +01:00
Gleb Mazovetskiy
1de202cfe0 DrawString: Fix IsCJK definition
Fix IsCJK to include Hiragana, Katakana, Bopomofo, etc.
2021-11-27 15:11:52 +01:00
Gleb Mazovetskiy
48ddb2ea06 DrawString: Fix line height for tall codepoints 2021-11-27 15:11:52 +01:00
obligaron
6273f700fa
Add some Graphic Settings to Settingsmenu (#3617) 2021-11-27 00:25:48 +01:00
Gleb Mazovetskiy
1425bec3e4 Add missing GetLineWidth declaration to header 2021-11-25 12:22:27 +01:00
Gleb Mazovetskiy
bffe7dd071 DrawStringWithColors: Fix {} support 2021-11-25 12:22:27 +01:00
Gleb Mazovetskiy
c57644970f Move UiFlags and UiPanels into their own files
The first breaks circular dependency between `DiabloUI` and `text_render`.
The latter one moves `UiPanels` to a more appropriate place.
2021-11-25 12:22:27 +01:00
Gleb Mazovetskiy
af168fd8df Add DrawStringWithColors
A way to color parts of the string differently while keeping the color
information out of the string itself.

This is an alternative to #3546.
2021-11-25 00:26:16 +00:00
Gleb Mazovetskiy
7e1fea6f76 clang-format all files in {Source,test}/
Also includes a few manual tweaks to comments and newlines for better results.

Co-authored-by: Anders Jenbo <anders@jenbo.dk>
2021-11-24 23:44:12 +01:00
Anders Jenbo
9ea6d9c9d1 Tweak Hangul font width 2021-11-19 03:40:00 +01:00
Anders Jenbo
a6f17fe072 Adjust width of CJK and Hangul fonts 2021-11-18 02:26:11 +01:00
Gleb Mazovetskiy
fa90679416 game_assets.* -> assets.* 2021-11-17 11:49:57 +01:00
Gleb Mazovetskiy
720d210d95 utils/mpq* -> mpq/* 2021-11-17 11:49:57 +01:00
Anders Jenbo
5e97bfa1e8 Adjust to new CJK font width 2021-11-16 04:10:07 +01:00
Gleb Mazovetskiy
f45270e9ab RenderString: Fix width calculation after \n
Fixes #3456
2021-11-10 01:48:55 +00:00
Gleb Mazovetskiy
bc9031ad54 WordWrapString: Fix state after starting a new line
After starting a new line, we restart the processing from the line break
position, so we need to set `nextCodepoint` correctly.

Fixes #3449
2021-11-10 01:48:55 +00:00
Gleb Mazovetskiy
e3dc241c2f Correctly handle ZWSP in WordWrapString 2021-11-10 01:48:55 +00:00
Gleb Mazovetskiy
40b1dc7a12 WordWrap: Require whitespace to break after Latin punctuation
This fixes cases such as `github.com`.

As we now require a space after Latin punctuation, we can remove
the list of Latin punctuation symbols and break on the space itself.

We still disallow linebreaks between consecutive fullwidth punctuation
symbols.
2021-11-08 00:11:04 +01:00
Gleb Mazovetskiy
e1dc7df3a5 Fix crash in WordWrapString
Fixes #3433
2021-11-07 23:21:21 +01:00
Gleb Mazovetskiy
8e5bc0597a Don't line-break in the middle of a punct sequence
Also removes a redundant copy of the input string.

Fixes #3420
2021-11-07 19:03:35 +00:00
Gleb Mazovetskiy
e9a9daa794 DrawString: Stop allocating
Switch to a state-machine UTF-8 decoder from the branchless one.
This allows us to avoid copying the string on every `DrawString` call.
2021-11-07 04:17:50 +01:00
Gleb Mazovetskiy
3d308983a8 Migrate to libmpq
libmpq is a much simpler alternative to StormLib for reading MPQ archives.

We use our own fork of libmpq: https://github.com/diasurgical/libmpq

Impact:

* DevilutionX is now a lot more portable. Unlike StormLib, libmpq only
  needs platform-specific code for Windows.
* Locks around file access **removed** (instead we duplicate the file descriptor for streamed audio only).
* RAM usage is **300 KiB** lower than StormLib.
* Stripped release linux_x86_64 binary is **32 KiB** smaller.
* Amiga build now hangs instead of crashing.
2021-11-06 23:51:42 +00:00
Gleb Mazovetskiy
117695489b
DrawArt: Fix bounds check (#3395)
The bounds checks were performed against the global screen dimensions
instead of the output buffer dimensions.

Also includes some minor cleanup of DrawArt.

Fixes #3388
2021-11-05 14:17:56 +00:00
qndel
5a35e0640b shorter & better MeasureSolidHorizontalBounds 2021-11-02 14:10:44 +01:00
Anders Jenbo
9cee65da6c Correct calculation for KerningFitSpacing 2021-10-24 16:28:28 +02:00
Anders Jenbo
b227afc4c4 Do not render text past first encoding error
Continuing past the error allows for CTD attacks using special crafted
invalid UTF-8 with a multiby indicator at the end the string
2021-10-24 16:28:28 +02:00
Anders Jenbo
11e37e972a Port essential parts to use SDL abstraction for file access 2021-10-20 21:52:59 +02:00
Gleb Mazovetskiy
dec45920eb Text rendering: Support Zero-width space
Zero-width space is a non-printing character that indicates a word
boundary.

https://en.wikipedia.org/wiki/Zero-width_space
2021-10-20 02:33:25 +02:00
Anders Jenbo
5b3abbd315 Correct dialog font full width 2021-10-17 08:40:45 +02:00
Anders Jenbo
b3546e3254
Load full width kerning programmatically 2021-10-16 02:00:30 +02:00
Anders Jenbo
f022a341b0 Avoid crashing from missing fonts 2021-10-12 21:05:19 +02:00