200 Commits
Author SHA1 Message Date
obligaron bd3d17975c Fix MSVC SDL1 warnings 2023-12-22 17:03:01 +01:00
obligaron 82aa0635c1 Simplify delay player messages 2023-12-02 12:57:34 +01:00
Gleb Mazovetskiy eb51a8beb3 Reduce demo message size
`DemoMsg` struct and event data are now kept separately.

RAM usage for the timedemo messages: -85% (1.8 MiB -> 261 KiB)

Demo (`.dmo`) file size: -57% (590,790 bytes -> 253,410 bytes)
2023-08-27 16:49:13 +01:00
Gleb Mazovetskiy 14540164a7 Remove utils/stdcompat/optional.hpp 2023-08-14 01:54:29 +01:00
Gleb Mazovetskiy 23d68718b1 Clear screen before drawing the loading background 2023-06-02 20:07:51 +02:00
Anders Jenbo fc91b65958 Add widescreen hive loadscreen 2023-06-01 01:15:54 +02:00
Anders Jenbo 83a984d019 Add widescreen crypt loadscreen 2023-05-28 01:45:43 +02:00
Gleb Mazovetskiy 750cebc561 Delay reinitializing hwcursor until fade 1
With fade 0 the cursor is never visible because everything is black.

While this is a very minor optimization, it works around
one of the instances of a bug in certain drivers as seen in #5618.
2023-05-22 13:21:36 +01:00
Anders Jenbo 82d233baf9 Add widescreen version of level 16 loadscreen 2023-04-04 01:40:36 +02:00
Anders Jenbo 5a1f0f4280 Add widscreen load background for Hell 2023-03-27 01:33:26 +02:00
Anders Jenbo 839690a74f Add cutttw widescreen load screen (#5923) 2023-03-24 20:01:33 +01:00
Anders Jenbo 4bd0148f49 Add cave widescreen 2023-03-22 05:18:33 +01:00
Anders Jenbo 20eb12570f Add catacombs widescreen (#5889) 2023-03-16 18:31:31 +01:00
Anders Jenbo 28ea755e32 Add churche widescreen 2023-03-16 00:49:53 +01:00
obligaron 4cdd7ff2d9 Replace ReturnLevel/LevelTyp/LvlPosition 2023-03-12 19:30:57 +01:00
Gleb Mazovetskiy 1788d2f8ec Remove miniwin
Event handling code moved to `engine/events.{hpp,cpp}`.
2023-02-01 16:06:57 +00:00
Gleb Mazovetskiy 20c27d92e4 Disable fade-in/out in demomode
Disables FadeIn/FadeOut and progress bar updates in demo mode.
This makes the demo run much faster (6s -> 2s).
2022-11-25 23:13:11 +01:00
Gleb Mazovetskiy 37ec8d030f Fix loading screen glitches 2022-11-01 14:48:56 +00:00
Gleb Mazovetskiy 680ab5ec40 Overhaul backbuffer state handling
When rendering directly to the output buffer, we need to maintain the
state of what has been drawn and what needs redrawing per-buffer.

We previously tried to do it implicitly by checking `SDL_DOUBLEBUF` and
other flags. The previous implementation was broken in several
ways, resulting in rendering issues on devices that support 8-bit output
directly.

Changes this mechanism to explicitly maintain buffer state per output
buffer. The new mechanism doesn't require knowledge of the number of
buffers, and thus also works correctly with triple-buffering.

Fixes #5447
2022-11-01 02:43:24 +00:00
obligaron 795a43dd89 Add Arena Support 2022-10-14 16:25:30 +02:00
Gleb Mazovetskiy 41f43ea3f5 Support unpacked MPQs from devilutionx-mpq-tools
https://github.com/diasurgical/devilutionx-mpq-tools produces an unpacked MPQ
with all the graphics converted to CLX and the unused files removed.
This is primarily useful on RAM-constrained platforms, such as PS2,
because it eliminates the MPQ overhead.

Adds a build option to load from such unpacked directories instead of the MPQ.

These directories are searched for in the same locations
where the MPQs would be searched for otherwise.

Example directory layout:

* /usr/local/share/diasurgical/devilutionx/diabdat/ -- unpacked and converted diabdat.mpq
* /usr/local/share/diasurgical/devilutionx/hellfire/ -- unpacked and converted hellfire MPQs (all of them merged into 1 directory)
* /usr/local/share/diasurgical/devilutionx/fonts/ -- unpacked fonts.mpq
* /usr/local/share/diasurgical/devilutionx/pl/ -- unpacked pl.mpq

These directory structure is produced by calling `unpack_and_minify_mpq`
2022-10-11 18:00:57 +01:00
Gleb Mazovetskiy 6327e713e0 Lowercase all file paths
We want to be able to use unpacked MPQs on low-end platforms
(PS2/rg99/etc).

This is tricky on case-sensitive filesystems. Avoids case issues by
lowercasing all paths in the code (then we'll just need lowercased
listfiles).
2022-08-20 23:49:23 +01:00
obligaron 3318b8fae6 Fix vanilla compatibility for saving in quest maps 2022-08-05 19:32:51 +02:00
Gleb Mazovetskiy 17a97450bc Convert assets to CLX
Converted using the following commands:

```
cd Packaging/resources/assets
pcx2clx --transparent-color 1 --num-sprites 256 fonts/*.pcx && rm fonts/*.pcx
pcx2clx --num-sprites 2 ui_art/dvl_but_sml.pcx && rm ui_art/dvl_but_sml.pcx
pcx2clx --transparent-color 1 data/hintbox.pcx data/hintboxbackground.pcx && rm data/hintbox.pcx data/hintboxbackground.pcx
pcx2clx --transparent-color 1 --num-sprites 6 data/hinticons.pcx && rm data/hinticons.pcx
pcx2clx --num-sprites 2 data/panel8buc.pcx data/dirtybuc.pcx data/dirtybucp.pcx && rm data/panel8buc.pcx data/dirtybuc.pcx data/dirtybucp.pcx
pcx2clx --transparent-color 1 data/healthbox.pcx && rm data/healthbox.pcx
pcx2clx --transparent-color 1 --num-sprites 6 data/resistance.pcx && rm data/resistance.pcx
pcx2clx --transparent-color 1 --num-sprites 5 data/monstertags.pcx && rm data/monstertags.pcx
pcx2clx --transparent-color 1 data/stash.pcx && rm data/stash.pcx
pcx2clx --transparent-color 1 --num-sprites 5 data/stashnavbtns.pcx && rm data/stashnavbtns.pcx
pcx2clx **/*.pcx && rm **/*.pcx
git checkout master -- ui_art/black_diablo.pcx ui_art/black_hellfire.pcx data/charbg.pcx data/talkbutton.pcx data/panel8bucp.pcx
rm ui_art/black_diablo.clx ui_art/black_hellfire.clx data/charbg.clx data/talkbutton.clx data/panel8bucp.clx
```
2022-08-03 16:37:04 +02:00
Gleb Mazovetskiy ba34bafb3f Use SDL events directly
Removes redundant miniwin events and queue, using SDL events directly instead.

Demo migrated using this script: https://gist.github.com/glebm/8a73b04f695de96f344cc2e35151e03e
2022-08-03 03:50:19 +02:00
Gleb Mazovetskiy 961866e1c4 CLX: A new graphics format
The format is almost identical to CL2, except it uses the frame header
to store frame width and height instead of 5 32-line offsets.

This means we always have access to frame dimensions, so we can use it
as an on-disk format for our graphics as well.

Additionally, we may be able to optimize the rendering even more
in the future now that we have guaranteed knowledge of frame dimensions.
2022-08-03 02:38:55 +02:00
Gleb Mazovetskiy 0cd035ef61 Load PCX as CL2
Similar to #5059, which converted CEL to CL2 at load time,
we now do the same for PCX.

Some size stats: https://gist.github.com/glebm/067bf1ec73f9d14514932cfe237e4e8e

Notably, fonts RAM usage is decreased by ~35%.
2022-07-20 22:58:15 +01:00
Gleb Mazovetskiy 8ca71272b8 Load all CEL as CL2
Convert CEL files to CL2 at load time. CL2 format is more efficient and is about as fast to render.

CEL vs CL2 sizes, on dLvl 5: https://gist.github.com/glebm/9bbdd76962abcd4fd2405ecd3379af97

Memory:

* Peak memory (while loading): -300 KiB
* Memory in-game (dLvl5): -700 KiB
* RG99 binary size: -15 KiB (1333096 -> 1317192)

Performance on rg99:

* On average, -1 FPS in town.
* Same FPS in dungeon (20 FPS on dLvl 1).
2022-07-19 10:59:35 +02:00
Gleb Mazovetskiy 3d4f0b48b8 Remove TranslateMessage
It has become entirely redundant.
2022-07-17 11:44:52 +02:00
obligaron ebfb519ee0 Rename gbQuietMode to HeadlessMode 2022-07-13 18:54:36 +02:00
obligaron bab9baa42a Handle gbQuietMode for paths in StartGame 2022-07-13 18:54:36 +02:00
Gleb Mazovetskiy 2be823a468 Fix progress bar on already-visited levels
Fixes #4970
2022-07-11 23:02:09 +01:00
Anders Jenbo 3ae834148a Split event handeling from general miniwin features 2022-07-10 21:13:39 +02:00
Anders Jenbo a7be622aa3 Clean up naming of event handler 2022-07-10 21:13:39 +02:00
Anders Jenbo 2d21fc372e Remove more miniwin code 2022-07-10 21:13:39 +02:00
Gleb Mazovetskiy d152d2c0fb Add OptionalOwnedCelSprite 2022-07-03 12:26:39 +01:00
Gleb Mazovetskiy 5d1a4fd8af IncProgress: Do not render bar if not active
Loading the game from within the game calls `IncProgress` multiple times
but we should not render the progress bar when that happens.
2022-06-30 11:41:11 +02:00
obligaron 07de7e2d7c Fix "Restart in Town" when dying on a quest/set map 2022-06-24 23:15:59 +02:00
Anders Jenbo 72656b3011 Move path and palette to the engine folder 2022-06-24 16:34:20 +02:00
Anders Jenbo 99181fd709 Move more files to the engine folder 2022-06-24 11:08:15 +02:00
Gleb Mazovetskiy 8e9c9e0238 Reduced the size of OwnedCelSprite* by 8 bytes
`OwnedCelSpriteWithFrameHeight`: 40 -> 32
2022-06-20 01:11:22 +02:00
Gleb Mazovetskiy c1ea8d58e0 Fix wide-screen background paths
These files are lowercase when in a bundled filesystem.
2022-06-19 10:19:27 +02:00
obligaron 184290a977 Support setlevel in multiplayer 2022-06-18 17:05:30 +02:00
obligaron 9ac04314f4 Introduce Player::isOnLevel 2022-06-18 17:05:30 +02:00
obligaron 19749420b5 Introduce Player::isOnActiveLevel 2022-06-18 17:05:30 +02:00
obligaron 7afe7d2a70 Save Methods in loadsave gets MpqWriter passed 2022-06-16 09:43:34 +02:00
Gleb Mazovetskiy 9d2948c782 Loading screen: Free the background early
Frees the background after blitting it once in the loading screen.
This gives the game more RAM for the actual loading.
2022-06-15 12:22:28 +02:00
Gleb Mazovetskiy e8c57aae67 Render widescreen cutscene bg as PCX 2022-06-13 09:54:01 +01:00
Anders Jenbo 54cd839cf6 Clean up drlg tests 2022-06-05 16:43:06 +02:00
qndel 354e329644 Players[MyPlayerId] -> MyPlayer 2022-05-31 05:35:52 +02:00