Commit Graph
405 Commits
Author SHA1 Message Date
qndel 216febfe8a fix rotating right (#6020) 2023-04-22 16:14:01 +02:00
qndel 731ad1ada5 use std::rotate (#6019) 2023-04-22 13:53:03 +02:00
Anders Jenbo dc2d97c112 Split lighting shades from trn tables 2023-04-21 07:40:19 +02:00
Anders Jenbo ec9d1b5550 Rename _oLight to applyLighting 2023-04-19 19:41:10 +02:00
Gleb Mazovetskiy ac0627f029 Add a debug function that describes a CLX
Example output (also demonstrates a bug in our encoder):

CLX sprite: 16x20 pixelDataSize=97b

command | width | bytes | color(s)
--------|------:|------:|---------
Transp. |    80 |     1 |
Pixels  |     2 |     3 | 203 199
Fill    |     3 |     2 | 202
Pixels  |     2 |     3 | 199 201
Fill    |     1 |     2 | 205
Transp. |     8 |     1 |
Pixels  |     3 |     4 | 205 199 196
Fill    |     4 |     2 | 197
Fill    |     1 |     2 | 202
Transp. |     9 |     1 |
Pixels  |     6 |     7 | 206 199 197 203 206 202
Fill    |     1 |     2 | 204
Transp. |    10 |     1 |
Pixels  |     4 |     5 | 206 199 197 205
Fill    |     1 |     2 | 207
Transp. |    12 |     1 |
Pixels  |     3 |     4 | 206 197 197
Fill    |     1 |     2 | 205
Transp. |     9 |     1 |
Pixels  |     7 |     8 | 207 205 203 206 206 197 197
Fill    |     1 |     2 | 206
Transp. |     8 |     1 |
Pixels  |     3 |     4 | 204 197 199
Fill    |     1 |     2 | 205
Transp. |     1 |     1 |
Pixels  |     2 |     3 | 202 197
Fill    |     1 |     2 | 204
Transp. |     8 |     1 |
Pixels  |     7 |     8 | 206 197 199 207 206 199 196
Fill    |     1 |     2 | 205
Transp. |     9 |     1 |
Pixels  |     1 |     2 | 203
Fill    |     4 |     2 | 197
Fill    |     1 |     2 | 202
Transp. |    10 |     1 |
Pixels  |     5 |     6 | 207 205 199 199 203
Fill    |     1 |     2 | 207
Transp. |    89 |     1 |
2023-04-11 08:50:07 +02:00
Gleb Mazovetskiy 8408743eed Draw item labels before the monster health bar
Fixes #5867
2023-03-26 11:57:49 +01:00
Gleb Mazovetskiy 3f0d089928 Blitter: Minor optimization
`src < end - 3` is one more instruction than `src + 3 < end`.

Godbolt: https://godbolt.org/z/PPfhYYWG8

RG-99 binary becomes 224 bytes smaller.
2023-03-24 11:50:49 +00:00
Gleb Mazovetskiy e81f8affba Fix rendering issues introduced by #5913
Fixes #5914
2023-03-23 11:43:50 +01:00
Gleb Mazovetskiy 774993c6d0 dun_renderer: Avoid calling 0-width Blit*
A slight optimization to avoid calling blit functions entirely
when the width is zero.
2023-03-22 10:30:06 +00:00
Gleb Mazovetskiy c5e6bf630f demomode.cpp: Set mouse.*.which to 0
Otherwise it can end up as `-1`, triggering the `VirtualGamepad` input
type (-1 is `SDL_TOUCH_MOUSEID`).
2023-03-21 17:04:01 +00:00
Gleb Mazovetskiy 397529bf0f Rendering: Unify and optimize pixel blitters
1. Unifies the underlying CLX and dun_render blitters.
2. Optimizes them by unrolling loops and using pointer comparison rather
   than length comparison (saves a length decrement).
3. In `dun_render`, extracts `RenderLineTransparent/Opaque` branches into
   functions via explicit template specialization.

Example RG-99 FPS (non-PGO'd): 17.4->18.4
2023-03-21 13:42:23 +00:00
obligaron 36ecc50fcb Always use infravision in Arenas 2023-03-13 01:00:30 +01:00
Gleb Mazovetskiy 957bd03b98 Remove FMT_COMPILE in "cold" places
Removes most `FMT_COMPILE` calls.
`FMT_COMPILE` results in better performance but larger code size.

Removes `FMT_COMPILE` calls for places that are called infrequently,
i.e. not on every frame.

RG-99 binary size reduced by ~4 KiB.
2023-03-12 19:29:35 +01:00
staphen c7766cfc96 Fix the path used for streaming in LoadAudioFile() 2023-02-26 00:14:18 +00:00
Gleb Mazovetskiy 1a1a282d9a Use C FILE instead of C++ streams throughout
Reduces binary size by ~2 KiB and may improve compatibility with oddball
systems (e.g. PS2).
2023-02-15 18:15:07 +00:00
Gleb Mazovetskiy f7580f188c Fix multiline DrawStringWithColors alignment
For center or right alignment, the lines past the first line were
aligned incorrectly. The alignment was based on the width of the
format string.
2023-02-14 09:42:14 +00:00
Gleb Mazovetskiy e87f68b2b5 Open fewer files concurrently at load time
For `MultiFileLoader` and `LoadMultipleCl2Sheet`, we now open one file
at a time.

This can help on platforms that limit the number of concurrently open
files, such as the PS2.
2023-02-14 09:16:17 +00:00
staphen b46482f414 Clear padmapper state when changing event handlers 2023-02-12 09:28:37 +01:00
KPhoenix a1fbf5253f enum talk_id -> enum class TalkID 2023-02-09 13:04:01 +01:00
Gleb Mazovetskiy 98294e0ad5 Optimize MissileData: 32 bytes -> 24
23 bytes used, 1 spare byte in the padding.
2023-02-07 08:08:04 +01:00
Gleb Mazovetskiy 0a6a8e8aa0 Clean up missile data access
Replace enum static casts with `GetMissile(Sprite)Data`.
2023-02-03 14:37:44 +00:00
KPhoenix 7947b99511 Implement new enum class 2023-02-03 05:05:12 +01:00
Gleb Mazovetskiy 1788d2f8ec Remove miniwin
Event handling code moved to `engine/events.{hpp,cpp}`.
2023-02-01 16:06:57 +00:00
staphen dd6ce177f7 Derive viewport geometry from player position 2023-01-30 04:22:33 +01:00
Gleb Mazovetskiy 0e0cc9d1b0 Reduce to just STREAM_ALL_AUDIO_MIN_FILE_SIZE
This does result in a bit more code and RAM usage for soundsample when
`STREAM_ALL_AUDIO` is on, but not by much.
2023-01-22 15:19:50 +00:00
Gleb Mazovetskiy 0dd95adcd1 Add a minimum threshold for STREAM_ALL_AUDIO 2023-01-22 15:19:50 +00:00
Gleb Mazovetskiy 527e876fff Disable item labels when in store
Also disable ground item outlines on hover when in store.
2023-01-22 15:58:12 +01:00
c99f7cf644 Floating numbers (#5639)
Co-authored-by: qndel <[email protected]>
Co-authored-by: Stephen C. Wills <[email protected]>
2023-01-22 07:20:10 +01:00
Gleb Mazovetskiy 6b338eac9f Display path in LoadAudioFile error dialog 2023-01-18 23:45:59 +00:00
Gleb Mazovetskiy 6d274c9547 UNPACKED_SAVES: Saves without MPQs
Reduces rg99 binary size by ~70 KiB.
2023-01-18 23:40:30 +00:00
KPhoenix 8db521727d enum missile_id -> enum class MissileID
Changes `enum missile_id` to `enum class MissileID`
2023-01-18 17:17:25 +00:00
Anders Jenbo e50e21e0e4 Use outline for spell icon texts 2023-01-12 11:04:53 +01:00
Anders Jenbo bb2463862c Use Position in AddItemToLabelQueue() 2023-01-12 09:56:47 +01:00
Anders Jenbo a29fc3a074 Correct casing for Player::isWalking() 2023-01-12 09:42:49 +01:00
Gleb Mazovetskiy 5bf9dfd7ee Demo mode: Force resolution to that of the demo 2023-01-12 03:38:29 +00:00
ephphatha 9da76e0003 Update CheckReflect to return applied damage
Instead of modifying the damage value by reference
2022-12-31 22:42:58 +01:00
qndel efaf334965 typos and code cleanup 2022-12-19 17:34:15 +01:00
KPhoenix 75d785a5f0 Bugfix: AnimationInfo integer division by 0 2022-12-19 01:32:37 +00:00
obligaron 5b11dfa2ed Fix preview frame shown fragment overflow 2022-12-17 10:30:36 +00:00
Gleb Mazovetskiy fab6f362c3 Point: Avoid construction in distance functions
This reduces the runtime of timedemo_test by 25% in debug mode.
Makes no difference to optimized mode of course.
2022-12-16 10:22:19 +01:00
Gleb Mazovetskiy 9b1ff3d50b demomode.cpp: Fix creating a bogus event
The `eof()` does not return true until a failed read attempt.

> Note that the value returned by this function depends on the last operation performed on the stream (and not on the next).
2022-12-15 05:59:17 +01:00
Gleb Mazovetskiy 45757856c1 DemoMode: Add a debug define to log events 2022-12-15 05:59:17 +01:00
obligaron 5180bd02b4 Timedemo: don't update ProgressToNextGameTick in pause menu 2022-12-15 05:37:33 +01:00
obligaron 028f630848 Timedemo: don't play and record messages in loading screens 2022-12-15 05:37:33 +01:00
obligaron 6e08ad658f Timedemo: represent game tick progress as uint8_t 2022-12-15 05:37:33 +01:00
Gleb Mazovetskiy f4b8edb5dc Surface.pitch(): int -> uint16_t 2022-12-14 10:12:24 +01:00
Gleb Mazovetskiy e06ca9a016 dun_render: Remove unused argument from RenderTile
Now that we pass the mask into `RenderTile`, we no longer need to pass
`levelPieceId`.
2022-12-14 10:12:24 +01:00
Gleb Mazovetskiy 9a1587060d Use real CalculateSoundPosition with NOSOUND
Fixes big-endian tests, which currently build with `-DNOSOUND`
to reduce build time.
2022-12-09 11:09:05 +00:00
Gleb Mazovetskiy cffb2566df Fix timedemo on SDL1 2022-12-09 12:05:54 +01:00
Gleb Mazovetskiy aa2f88e5f6 Remove software cursor state for hardware cursor
Switching between software and hardware cursor could cause a glitch
as described in #5560.

Fixes #5560
2022-12-08 12:09:36 +01:00