diff --git a/CHANGELOG.md b/CHANGELOG.md index be50d95f5..cf4eaf566 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
Added - Pathfinding and navigation overhaul, including jetpack/jump-aware pathfinding. - Actors will now intelligently choose their path depending on how high they can jump, instead of always taking the shortest flying path. This will reduce instances of the AI getting stuck while trying to take paths that are impossible for them. + Actors will now choose their path depending on how high they can jump, instead of always taking the shortest flying path. This will reduce instances of the AI getting stuck while trying to take paths that are impossible for them. Improvements to both `ACrab` and `AHuman` navigation. `ACrab`s are now aware of how to pathfind and navigate using their jetpack, and will use it where applicable. Actors are better at using their jetpack, and will use automovers if their jetpack is not sufficient to reach a destination. Actors are now more capable and responsive when digging. They will dig to their target if they cannot reach it with their jetpack (for example if there is a long vertical shaft in the route they cannot get up), and they preferentially avoid rocks, metal and other hard substances by digging around them. Actors also dig faster and spend less time idle. In the `CalculatePath` and `CalculatePathAsync` functions, the parameter `movePathToGround` has been replaced with `jumpHeight`, which is the height in metres the pathfind can jump vertically. @@ -26,6 +26,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), Added new `Actor` INI and Lua (R/W) property `CanRun` which denotes whether the Actor can run or not. Added new `Actor` INI and Lua (R/W) property `CrouchWalkSpeedMultiplier` which is a walking speed multiplier when at max crouch amount. +- New hotkey system for `Actor` and `HeldDevice`. + Pressing a certain new hotkey will mark it as activated on `Actor` and `HeldDevice`, letting scripts make use of the new bindings easily. + `Enum` binding for `HeldDevice.HeldDeviceHotkeyType`: `PRIMARYHOTKEY = 0, AUXILIARYHOTKEY = 1, HELDDEVICEHOTKEYTYPECOUNT = 2`. + `Enum` binding for `Actor.ActorHotkeyType`: `PRIMARYHOTKEY = 0, AUXILIARYHOTKEY = 1, ACTORHOTKEYTYPECOUNT = 2`. + Both `Actor` and `HeldDevice` have the following functions: + `HotkeyActionIsActivated(hotkeyType)` returns whether a certain hotkey action is being activated or not. + `ActivateHotkeyAction(hotkeyType)` activates a certain hotkey action. + `DeactivateHotkeyAction(hotkeyType)` deactivates a certain hotkey action. + +- New hotkey bindings. + On Mouse+KB PC the defaults are: Weapon Primary Hotkey on V, Weapon Auxiliary Hotkey on H, Actor Primary Hotkey on X, Actor Auxiliary Hotkey on O. + Added new `Controller` states `WEAPON_PRIMARY_HOTKEYSTART`, `WEAPON_AUXILIARY_HOTKEYSTART`, `ACTOR_PRIMARY_HOTKEYSTART`, `ACTOR_AUXILIARY_HOTKEYSTART`, `WEAPON_PRIMARY_HOTKEY`, `WEAPON_AUXILIARY_HOTKEY`, `ACTOR_PRIMARY_HOTKEY`, `ACTOR_AUXILIARY_HOTKEY` + +- Added multiseat support for multiple mice and keyboards on one computer. + +- Added optional player argument to all `UInputMan:Key*` Lua Methods. (e.g. `KeyHeld(keycode, player)`) This allows checking individual player's keyboards, when multiple keyboards are available. + - New music system, including a dynamic horizontal sequencing system, under the new music manager `MusicMan`. `PlayDynamicSong(string songName, string songSectionName, bool playImmediately, bool playTransition, bool smoothFade)` to play a new DynamicSong. `SetNextDynamicSongSection(string songSectionName, bool playImmediately, bool playTransition, bool smoothFade)` to queue a new DynamicSongSection for the currently playing song. @@ -51,19 +68,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - New `AEmitter` and `PEmitter` INI and Lua (R/W) property `PlayBurstSound` which denotes whether the BurstSound should play when appropriate. This should not be confused for a trigger - it's just a enable/disable toggle to avoid having to remove and add BurstSound altogether. - New `MOSprite` INI and Lua (R/W) integer property `ForcedHFlip` which forces a certain flippedness and disallows anything else from ever changing it without clearing the forced value first. 0 is forced not flipped, 1 forced flipped, and -1 is no force. - -- New hotkey bindings. - On Mouse+KB PC the defaults are: Weapon Primary Hotkey on V, Weapon Auxiliary Hotkey on H, Actor Primary Hotkey on X, Actor Auxiliary Hotkey on O. - Added new `Controller` states `WEAPON_PRIMARY_HOTKEYSTART`, `WEAPON_AUXILIARY_HOTKEYSTART`, `ACTOR_PRIMARY_HOTKEYSTART`, `ACTOR_AUXILIARY_HOTKEYSTART`, `WEAPON_PRIMARY_HOTKEY`, `WEAPON_AUXILIARY_HOTKEY`, `ACTOR_PRIMARY_HOTKEY`, `ACTOR_AUXILIARY_HOTKEY` - -- New hotkey system for `Actor` and `HeldDevice`. - Pressing a certain new hotkey will mark it as activated on `Actor` and `HeldDevice`, letting scripts make use of the new bindings easily. - `Enum` binding for `HeldDevice.HeldDeviceHotkeyType`: `PRIMARYHOTKEY = 0, AUXILIARYHOTKEY = 1, HELDDEVICEHOTKEYTYPECOUNT = 2`. - `Enum` binding for `Actor.ActorHotkeyType`: `PRIMARYHOTKEY = 0, AUXILIARYHOTKEY = 1, ACTORHOTKEYTYPECOUNT = 2`. - Both `Actor` and `HeldDevice` have the following functions: - `HotkeyActionIsActivated(hotkeyType)` returns whether a certain hotkey action is being activated or not. - `ActivateHotkeyAction(hotkeyType)` activates a certain hotkey action. - `DeactivateHotkeyAction(hotkeyType)` deactivates a certain hotkey action. - New `Controller` state `WEAPON_RELOADHELD`, which is true every frame reload input is held (as opposed to `WEAPON_RELOAD` which is only true once when pressed). @@ -134,10 +138,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ``` Original bindings with no scale argument are untouched and can be called as they were. -- Added multiseat support for multiple mice and keyboards on one computer. - -- Added optional player argument to all `UInputMan:Key*` Lua Methods. (e.g. `KeyHeld(keycode, player)`) This allows checking individual player's keyboards, when multiple keyboards are available. -
Changed @@ -148,6 +148,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The Ronin Scrambler, the basic scanner, and `SceneMan:CastUnseenRay` have been changed to accomodate fog-of-war resolutions as fine as 1x1 and as coarse as 20x20. The fog-of-war revealing code is now multithreaded to increase performance. +- Save files are now compressed and stored in a single file, instead of a directory. + Savefiles have the extension `.ccsave`, but their underlying format is really just a `.zip` file. This can be opened and modified as before with any zip file viewer. + These savefiles can be safely renamed and moved without breaking the savegame, unlike before. + - All vanilla scenario activities have had their settings polished, respecting settings which make sense and disabling settings which don't. You can now have fog of war in the test scene, and can no longer require path to orbit in Zero-G Diggers-Only One Man Army. diff --git a/RTEA.vcxproj b/RTEA.vcxproj index bc8a3fa28..a116ff512 100644 --- a/RTEA.vcxproj +++ b/RTEA.vcxproj @@ -161,7 +161,7 @@ /bigobj /Zm300 %(AdditionalOptions) /bigobj %(AdditionalOptions) Disabled - $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public + $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public;$(ProjectDir)external\sources\fmem\include _ITERATOR_DEBUG_LEVEL=0;ZLIB_COMPAT;_WINDOWS;WIN32;DEBUG_BUILD;DEBUGMODE;TARGET_MACHINE_X86;%(PreprocessorDefinitions) false EnableFastChecks @@ -214,7 +214,7 @@ /bigobj /Zm300 %(AdditionalOptions) /bigobj %(AdditionalOptions) Disabled - $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public + $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public;$(ProjectDir)external\sources\fmem\include _ITERATOR_DEBUG_LEVEL=0;ZLIB_COMPAT;_WINDOWS;WIN32;DEBUG_BUILD;DEBUGMODE;%(PreprocessorDefinitions) false EnableFastChecks @@ -267,7 +267,7 @@ /bigobj /Zm300 %(AdditionalOptions) /bigobj %(AdditionalOptions) Disabled - $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public + $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public;$(ProjectDir)external\sources\fmem\include _ITERATOR_DEBUG_LEVEL=0;ZLIB_COMPAT;_WINDOWS;WIN32;MIN_DEBUG_BUILD;DEBUGMODE;TARGET_MACHINE_X86;%(PreprocessorDefinitions) false EnableFastChecks @@ -320,7 +320,7 @@ /bigobj /Zm300 %(AdditionalOptions) /bigobj %(AdditionalOptions) Disabled - $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public + $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public;$(ProjectDir)external\sources\fmem\include _ITERATOR_DEBUG_LEVEL=0;ZLIB_COMPAT;_WINDOWS;WIN32;MIN_DEBUG_BUILD;DEBUGMODE;%(PreprocessorDefinitions) false EnableFastChecks @@ -376,7 +376,7 @@ true Speed false - $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public + $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public;$(ProjectDir)external\sources\fmem\include _ITERATOR_DEBUG_LEVEL=0;ZLIB_COMPAT;_WINDOWS;WIN32;DEBUG_RELEASE_BUILD;NDEBUG;TRACY_ENABLE;TRACY_ON_DEMAND;TARGET_MACHINE_X86;%(PreprocessorDefinitions) Sync MultiThreadedDLL @@ -438,7 +438,7 @@ true Speed false - $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public + $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public;$(ProjectDir)external\sources\fmem\include _ITERATOR_DEBUG_LEVEL=0;ZLIB_COMPAT;_WINDOWS;WIN32;TRACY_ENABLE;TRACY_ON_DEMAND;PROFILING_BUILD;NDEBUG;TARGET_MACHINE_X86;%(PreprocessorDefinitions) Sync MultiThreadedDLL @@ -500,7 +500,7 @@ true Speed false - $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public + $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public;$(ProjectDir)external\sources\fmem\include _ITERATOR_DEBUG_LEVEL=0;ZLIB_COMPAT;_WINDOWS;WIN32;DEBUG_RELEASE_BUILD;NDEBUG;TRACY_ENABLE;TRACY_ON_DEMAND;%(PreprocessorDefinitions) Sync MultiThreadedDLL @@ -562,7 +562,7 @@ true Speed true - $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public + $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public;$(ProjectDir)external\sources\fmem\include _ITERATOR_DEBUG_LEVEL=0;ZLIB_COMPAT;_WINDOWS;WIN32;TRACY_ENABLE;TRACY_ON_DEMAND;PROFILING_BUILD;NDEBUG;%(PreprocessorDefinitions) Sync MultiThreadedDLL @@ -624,7 +624,7 @@ true Speed true - $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public + $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public;$(ProjectDir)external\sources\fmem\include _ITERATOR_DEBUG_LEVEL=0;ZLIB_COMPAT;_WINDOWS;WIN32;RELEASE_BUILD;NDEBUG;TRACY_ENABLE;TRACY_ON_DEMAND;TRACY_ONLY_LOCALHOST;TRACY_NO_BROADCAST;TARGET_MACHINE_X86;%(PreprocessorDefinitions) Sync MultiThreadedDLL @@ -684,7 +684,7 @@ true Speed true - $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public + $(ProjectDir);$(ProjectDir)\Source;$(ProjectDir)Source\System;$(ProjectDir)Source\Lua;$(ProjectDir)Source\Entities;$(ProjectDir)Source\Activities;$(ProjectDir)Source\Managers;$(ProjectDir)Source\Menus;$(ProjectDir)Source\GUI;$(ProjectDir)Source\GUI\Wrappers;$(ProjectDir)Source\GUI\imgui;$(ProjectDir)Source\GUI\imgui\backends;$(ProjectDir)Source\Renderer;$(ProjectDir)external\include\boost_1_75;$(ProjectDir)external\include\glm-0.9.9.8;$(ProjectDir)external\include\glad-2.0.0-beta;$(ProjectDir)external\include\LZ4-1.9.3\LZ4;$(ProjectDir)external\include\fmod-2.2.13;$(ProjectDir)external\include\thread-pool-3.5.0\include;$(ProjectDir)external\include\hopscotch-map-2.3.1\include;$(ProjectDir)external\sources\libpng-1.6.40\include;$(ProjectDir)external\sources\zlib-ng-2.1.3\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\include;$(ProjectDir)external\sources\allegro 4.4.3.1-custom\addons\loadpng;$(ProjectDir)external\sources\SDL3-3.2.10\include;$(ProjectDir)external\sources\SDL3_image-3.2.4\include;$(ProjectDir)external\sources\LuaJIT-2.1\src;$(ProjectDir)external\sources\luabind-0.7.1\;$(ProjectDir)external\sources\luabind-0.7.1\luabind;$(ProjectDir)external\sources\RakNet\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\include;$(ProjectDir)external\sources\minizip-ng-4.0.0\src;$(ProjectDir)external\sources\tracy\public;$(ProjectDir)external\sources\fmem\include _ITERATOR_DEBUG_LEVEL=0;ZLIB_COMPAT;_WINDOWS;WIN32;RELEASE_BUILD;NDEBUG;TRACY_ENABLE;TRACY_ON_DEMAND;TRACY_ONLY_LOCALHOST;TRACY_NO_BROADCAST;%(PreprocessorDefinitions) Sync MultiThreadedDLL @@ -1483,4 +1483,4 @@ - + \ No newline at end of file diff --git a/RTEA.vcxproj.filters b/RTEA.vcxproj.filters index 14673a2d7..819004bd7 100644 --- a/RTEA.vcxproj.filters +++ b/RTEA.vcxproj.filters @@ -484,9 +484,6 @@ Entities - - System - System @@ -657,6 +654,12 @@ Renderer\raylib + + + + + + diff --git a/Source/Entities/SLTerrain.cpp b/Source/Entities/SLTerrain.cpp index c86b98fd1..c8710987f 100644 --- a/Source/Entities/SLTerrain.cpp +++ b/Source/Entities/SLTerrain.cpp @@ -308,6 +308,12 @@ int SLTerrain::SaveData(const std::string& pathBase, bool doAsyncSaves) { return 0; } +void SLTerrain::CopyBitmapData(std::vector& layerInfos) const { + layerInfos.emplace_back(std::string("Mat"), SceneLayer::CopyBitmap()); + layerInfos.emplace_back(std::string("FG"), m_FGColorLayer->CopyBitmap()); + layerInfos.emplace_back(std::string("BG"), m_BGColorLayer->CopyBitmap()); +} + int SLTerrain::ClearData() { RTEAssert(SceneLayer::ClearData() == 0, "Failed to clear material bitmap data of an SLTerrain!"); RTEAssert(m_FGColorLayer && m_FGColorLayer->ClearData() == 0, "Failed to clear the foreground color bitmap data of an SLTerrain!"); diff --git a/Source/Entities/SLTerrain.h b/Source/Entities/SLTerrain.h index d558cc734..b3ac1f5a2 100644 --- a/Source/Entities/SLTerrain.h +++ b/Source/Entities/SLTerrain.h @@ -68,6 +68,10 @@ namespace RTE { /// @return An error return value signaling success or any particular failure. Anything below 0 is an error signal. int SaveData(const std::string& pathBase, bool doAsyncSaves = true) override; + /// Copies bitmap data into layerInfos. + /// @param layerInfos List of SceneLayerInfo to emplace our copied data into. + void CopyBitmapData(std::vector& layerInfos) const; + /// Clears out any previously loaded bitmap data from memory. /// @return An error return value signaling success or any particular failure. Anything below 0 is an error signal. int ClearData() override; @@ -86,6 +90,14 @@ namespace RTE { /// @param layerToDraw The layer that should be drawn. See LayerType enumeration. void SetLayerToDraw(LayerType layerToDraw) { m_LayerToDraw = layerToDraw; } + /// Gets the foreground scenelayer of this SLTerrain. + /// @return A pointer to the foreground scenelayer. + SceneLayer* GetFGSceneLayer() { return m_FGColorLayer.get(); } + + /// Gets the background scenelayer of this SLTerrain. + /// @return A pointer to the background scenelayer. + SceneLayer* GetBGSceneLayer() { return m_BGColorLayer.get(); } + /// Gets the foreground color bitmap of this SLTerrain. /// @return A pointer to the foreground color bitmap. BITMAP* GetFGColorBitmap() { return m_FGColorLayer->GetBitmap(); m_FGColorLayer->SetUpdated(); } diff --git a/Source/Entities/Scene.cpp b/Source/Entities/Scene.cpp index f99f0a4f4..178763556 100644 --- a/Source/Entities/Scene.cpp +++ b/Source/Entities/Scene.cpp @@ -847,6 +847,26 @@ int Scene::SaveData(std::string pathBase, bool doAsyncSaves) { return 0; } +std::vector Scene::GetCopiedSceneLayerBitmaps() const { + std::vector layerInfos; + + // Save Terrain's data + m_pTerrain->CopyBitmapData(layerInfos); + + // Don't bother saving background layers to disk, as they are never altered + + // Save unseen layers' data + for (int team = Activity::TeamOne; team < Activity::MaxTeamCount; ++team) + { + if (m_apUnseenLayer[team]) + { + layerInfos.emplace_back(std::format("UST{}", team), m_apUnseenLayer[team]->CopyBitmap()); + } + } + + return layerInfos; +} + int Scene::SavePreview(const std::string& bitmapPath) { // Do not save preview for MetaScenes! if (!m_MetasceneParent.empty()) { diff --git a/Source/Entities/Scene.h b/Source/Entities/Scene.h index 2c98766f8..580e14f25 100644 --- a/Source/Entities/Scene.h +++ b/Source/Entities/Scene.h @@ -9,6 +9,7 @@ #include "Box.h" #include "Activity.h" #include "PathFinder.h" +#include "SceneLayer.h" #include #include @@ -246,6 +247,10 @@ namespace RTE { /// Anything below 0 is an error signal. int SaveData(std::string pathBase, bool doAsyncSaves = true); + // Gets copied bitmaps of our scene layers, for saving. + // @return A list of SceneLayerInfo including our name and a copied bitmap. + std::vector GetCopiedSceneLayerBitmaps() const; + /// Saves preview bitmap for this scene. /// @param bitmapPath The full filepath the where to save the Bitmap data. int SavePreview(const std::string& bitmapPath); diff --git a/Source/Entities/SceneLayer.cpp b/Source/Entities/SceneLayer.cpp index d75751bae..735fc3c60 100644 --- a/Source/Entities/SceneLayer.cpp +++ b/Source/Entities/SceneLayer.cpp @@ -201,6 +201,11 @@ void SceneLayerImpl::InitScrollRatios(bool initF template int SceneLayerImpl::LoadData() { + if (m_MainBitmapOwned) { + destroy_bitmap(m_MainBitmap); + m_MainBitmap = nullptr; + } + // Load from disk and take ownership. Don't cache because the bitmap will be modified. m_MainBitmap = m_BitmapFile.GetAsBitmap(COLORCONV_NONE, false); m_MainBitmapOwned = true; @@ -245,6 +250,16 @@ int SceneLayerImpl::SaveData(const std::string& return 0; } +template +std::unique_ptr SceneLayerImpl::CopyBitmap() const { + BITMAP* outputBitmap = create_bitmap_ex(bitmap_color_depth(m_MainBitmap), m_MainBitmap->w, m_MainBitmap->h); + if (m_MainBitmap) { + outputBitmap = create_bitmap_ex(bitmap_color_depth(m_MainBitmap), m_MainBitmap->w, m_MainBitmap->h); + blit(m_MainBitmap, outputBitmap, 0, 0, 0, 0, m_MainBitmap->w, m_MainBitmap->h); + } + return std::unique_ptr(outputBitmap); +} + template int SceneLayerImpl::ClearData() { if (m_MainBitmap && m_MainBitmapOwned) { diff --git a/Source/Entities/SceneLayer.h b/Source/Entities/SceneLayer.h index a28b4b278..2ece19cea 100644 --- a/Source/Entities/SceneLayer.h +++ b/Source/Entities/SceneLayer.h @@ -11,6 +11,11 @@ namespace RTE { struct BigTexture; + struct SceneLayerInfo { + std::string name; + std::unique_ptr bitmap; + }; + /// A scrolling layer of the Scene. template class SceneLayerImpl : public Entity { @@ -76,6 +81,10 @@ namespace RTE { /// @return Whether this SceneLayer's bitmap data was loaded from a file or not. virtual bool IsLoadedFromDisk() const { return !m_BitmapFile.GetDataPath().empty(); } + /// Gets this SceneLayer's ContentFile. Used for saved games + /// @return This SceneLayer's ContentFile. + ContentFile& GetContentFile() { return m_BitmapFile; } + /// Loads previously specified/created data into memory. Has to be done before using this SceneLayer if the bitmap was not generated at runtime. /// @return An error return value signaling success or any particular failure. Anything below 0 is an error signal. virtual int LoadData(); @@ -89,6 +98,10 @@ namespace RTE { /// Clears out any previously loaded bitmap data from memory. /// @return An error return value signaling success or any particular failure. Anything below 0 is an error signal. virtual int ClearData(); + + /// Copies the bitmap. + /// @return The copied bitmap. + std::unique_ptr CopyBitmap() const; #pragma endregion #pragma region Getters and Setters diff --git a/Source/Managers/ActivityMan.cpp b/Source/Managers/ActivityMan.cpp index c9a2ee002..a3edb5310 100644 --- a/Source/Managers/ActivityMan.cpp +++ b/Source/Managers/ActivityMan.cpp @@ -25,6 +25,14 @@ #include "MusicMan.h" +#include "zip.h" +#include "unzip.h" + +#include "SDL3/SDL_surface.h" +#include + +#include + using namespace RTE; ActivityMan::ActivityMan() { @@ -67,6 +75,11 @@ bool ActivityMan::ForceAbortSave() { return SaveCurrentGame("AbortSave"); } +// For some reason these aren't defined on Linux/MacOS... so +#define HACK_MZ_COMPRESS_METHOD_STORE 0 +#define HACK_MZ_COMPRESS_LEVEL_FAST 2 +#define HACK_MZ_COMPRESS_METHOD_DEFLATE 8 + bool ActivityMan::SaveCurrentGame(const std::string& fileName) { m_SaveGameTask.wait(); m_SaveGameTask = BS::multi_future(); @@ -79,15 +92,6 @@ bool ActivityMan::SaveCurrentGame(const std::string& fileName) { return false; } - // TODO, save to a zip instead of a directory - std::filesystem::create_directory(g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/" + fileName); - - if (scene->SaveData(c_UserScriptedSavesModuleName + "/" + fileName + "/Save") < 0) { - // This print is actually pointless because game will abort if it fails to save layer bitmaps. It stays here for now because in reality the game doesn't properly abort if the layer bitmaps fail to save. It is what it is. - g_ConsoleMan.PrintString("ERROR: Failed to save scene bitmaps while saving!"); - return false; - } - // We need a copy of our scene, because we have to do some fixup to remove PLACEONLOAD items and only keep the current MovableMan state. std::unique_ptr modifiableScene(dynamic_cast(scene->Clone())); @@ -103,8 +107,28 @@ bool ActivityMan::SaveCurrentGame(const std::string& fileName) { modifiableScene->GetTerrain()->SetPresetName(fileName); modifiableScene->GetTerrain()->MigrateToModule(g_PresetMan.GetModuleID(c_UserScriptedSavesModuleName)); + // See our content files to point to our save game location. This won't actually save a file here- but it allows us to set these up as in-memory ContentFiles on load + // Meaning that our loading code doesn't need to care about whether it's loading a savegame or a file- it just sees it as an already loaded, cached bitmap + modifiableScene->GetTerrain()->GetContentFile().SetIsMemoryFile(true); + modifiableScene->GetTerrain()->GetFGSceneLayer()->GetContentFile().SetIsMemoryFile(true); + modifiableScene->GetTerrain()->GetBGSceneLayer()->GetContentFile().SetIsMemoryFile(true); + + modifiableScene->GetTerrain()->GetContentFile().SetDataPath(g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/Save Mat.png"); + modifiableScene->GetTerrain()->GetFGSceneLayer()->GetContentFile().SetDataPath(g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/Save FG.png"); + modifiableScene->GetTerrain()->GetBGSceneLayer()->GetContentFile().SetDataPath(g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/Save BG.png"); + + for (int i = 0; i < Activity::MaxTeamCount; ++i) { + SceneLayer* unseenLayer = modifiableScene->GetUnseenLayer(i); + if (unseenLayer) { + unseenLayer->GetContentFile().SetIsMemoryFile(true); + unseenLayer->GetContentFile().SetDataPath(g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + std::format("/Save UST{}.png", i)); + } + } + + std::unique_ptr iniStream = std::make_unique(); + // Block the main thread for a bit to let the Writer access the relevant data. - std::unique_ptr writer(std::make_unique(g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/" + fileName + "/Save.ini")); + std::unique_ptr writer(std::make_unique(std::move(iniStream))); writer->NewPropertyWithValue("Activity", activity); // Pull all stuff from MovableMan into the Scene for saving, so existing Actors/ADoors are saved, without transferring ownership, so the game can continue. @@ -121,9 +145,87 @@ bool ActivityMan::SaveCurrentGame(const std::string& fileName) { writer->NewPropertyWithValue("PlaceUnitsIfSceneIsRestarted", g_SceneMan.GetPlaceUnitsOnLoad()); writer->NewPropertyWithValue("Scene", modifiableScene.get()); - auto saveWriterData = [](Writer* writerToSave) { - writerToSave->EndWrite(); - delete writerToSave; + // Save a small little file with index info (activity and original scene name) so we can display info in the samegame menu without needing to decompress and read through the entire zip + std::unique_ptr indexStream = std::make_unique(); + Writer* indexWriter = new Writer(std::move(indexStream)); + indexWriter->NewPropertyWithValue("ActivityName", activity->GetPresetName()); + indexWriter->NewPropertyWithValue("OriginalScenePresetName", scene->GetPresetName()); + + // Get BITMAPS so save into our zip + // I tried std::moving this into the function directly but threadpool really doesn't like that + std::vector* sceneLayerInfos = new std::vector(); + *sceneLayerInfos = std::move(scene->GetCopiedSceneLayerBitmaps()); + + auto saveWriterData = [fileName, sceneLayerInfos, indexWriter](Writer* mainWriter) { + // Create zip sav file + zipFile zippedSaveFile = zipOpen((g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/" + fileName + ".ccsave").c_str(), APPEND_STATUS_CREATE); + if (!zippedSaveFile) { + g_ConsoleMan.PrintString("ERROR: Couldn't create zip save file!"); + delete mainWriter; + delete indexWriter; + delete sceneLayerInfos; + return; + } + + std::stringstream* mainStream = static_cast(mainWriter->GetStream()); + std::stringstream* indexStream = static_cast(indexWriter->GetStream()); + mainStream->flush(); + indexStream->flush(); + + std::string_view mainStreamView = mainStream->view(); + std::string_view indexStreamView = indexStream->view(); + + zip_fileinfo zfi = {0}; + + zipOpenNewFileInZip(zippedSaveFile, "Index.ini", &zfi, nullptr, 0, nullptr, 0, nullptr, HACK_MZ_COMPRESS_METHOD_STORE, HACK_MZ_COMPRESS_LEVEL_FAST); + zipWriteInFileInZip(zippedSaveFile, indexStreamView.data(), indexStreamView.size()); + zipCloseFileInZip(zippedSaveFile); + + zipOpenNewFileInZip(zippedSaveFile, "Save.ini", &zfi, nullptr, 0, nullptr, 0, nullptr, HACK_MZ_COMPRESS_METHOD_DEFLATE, HACK_MZ_COMPRESS_LEVEL_FAST); + zipWriteInFileInZip(zippedSaveFile, mainStreamView.data(), mainStreamView.size()); + zipCloseFileInZip(zippedSaveFile); + + std::for_each(std::execution::par_unseq, + sceneLayerInfos->begin(), sceneLayerInfos->end(), + [&](const SceneLayerInfo& layerInfo) { + // Save png into a memory buffer + SDL_IOStream* stream = SDL_IOFromDynamicMem(); + SDL_Surface* image = SDL_CreateSurfaceFrom(layerInfo.bitmap->w, layerInfo.bitmap->h, SDL_PIXELFORMAT_INDEX8, layerInfo.bitmap->dat, layerInfo.bitmap->w); + + SDL_Palette* palette = ContentFile::DefaultPaletteToSDL(); + SDL_SetSurfacePalette(image, palette); + + bool result = IMG_SavePNG_IO(image, stream, false); + SDL_FlushIO(stream); + + SDL_DestroyPalette(palette); + SDL_DestroySurface(image); + + if (!result) { + g_ConsoleMan.PrintString("ERROR: Failed to save scenelayers to PNG!"); + return; + } + + // Actually get the memory + void* buffer = SDL_GetPointerProperty(SDL_GetIOProperties(stream), SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER, nullptr); + size_t size = static_cast(SDL_GetIOSize(stream)); + if (!buffer || size < 0) { + g_ConsoleMan.PrintString("ERROR: Failed to save scenelayers to PNG!"); + return; + } + + zipOpenNewFileInZip(zippedSaveFile, ("Save " + layerInfo.name + ".png").c_str(), &zfi, nullptr, 0, nullptr, 0, nullptr, HACK_MZ_COMPRESS_METHOD_STORE, HACK_MZ_COMPRESS_LEVEL_FAST); + zipWriteInFileInZip(zippedSaveFile, static_cast(buffer), size); + zipCloseFileInZip(zippedSaveFile); + + SDL_CloseIO(stream); + }); + + zipClose(zippedSaveFile, fileName.c_str()); + + delete mainWriter; + delete indexWriter; + delete sceneLayerInfos; }; // For some reason I can't std::move a unique ptr in, so just releasing and deleting manually... @@ -137,16 +239,90 @@ bool ActivityMan::SaveCurrentGame(const std::string& fileName) { } bool ActivityMan::LoadAndLaunchGame(const std::string& fileName) { - m_SaveGameTask.wait(); + std::string filePath = g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/" + fileName; + + // load zip sav file + std::string saveFilePath = filePath + ".ccsave"; + unzFile zippedSaveFile = unzOpen(saveFilePath.c_str()); + if (!zippedSaveFile) { + // Might be trying to open one we're already saving too, wait until we finish saving and try again + m_SaveGameTask.wait(); + zippedSaveFile = unzOpen(saveFilePath.c_str()); + + if (!zippedSaveFile) { + // Some other process is stopping us from loading, oh well + RTEError::ShowMessageBox("Game loading failed! Make sure you have a saved game called \"" + fileName + "\""); + return false; + } + } + + unz_file_info info; + char* buffer = nullptr; + + auto unzipFileIntoBuffer = [&](std::string fullFileName) { + // These need to use NULL instead of nullptr to compile on Linux/OSX? + if (unzLocateFile(zippedSaveFile, fullFileName.c_str(), NULL) == UNZ_END_OF_LIST_OF_FILE) { + return false; + } + + unzOpenCurrentFile(zippedSaveFile); + unzGetCurrentFileInfo(zippedSaveFile, &info, nullptr, 0, nullptr, 0, nullptr, 0); + + buffer = (char*)malloc(info.uncompressed_size + 1); // add one so we can add a pretend null terminator on the end + if (!buffer) { + // If this ever hits I've lost all faith in modern OSes, but alas when one is writing C, one must dance along + RTEError::ShowMessageBox("Catastrophic failure! Failed to allocate memory for savegame"); + return false; + } + + unzReadCurrentFile(zippedSaveFile, buffer, info.uncompressed_size); + unzCloseCurrentFile(zippedSaveFile); + + return true; + }; + + auto loadMemPng = [](void* buffer, size_t size) { + SDL_IOStream* stream = SDL_IOFromConstMem(buffer, size); + SDL_Surface* image = stream ? IMG_LoadPNG_IO(stream) : nullptr; + SDL_CloseIO(stream); + + SDL_Palette* palette = ContentFile::DefaultPaletteToSDL(); + SDL_Surface* newImage = SDL_ConvertSurfaceAndColorspace(image, SDL_PIXELFORMAT_INDEX8, palette, SDL_COLORSPACE_UNKNOWN, 0); + SDL_DestroyPalette(palette); + SDL_DestroySurface(image); + image = newImage; - std::string saveFilePath = g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/" + fileName + "/Save.ini"; + free(buffer); + return image; + }; + + // Manually load all our bitmaps into our cache so the activity skips looking for the file and just gets it directly from us + if (unzipFileIntoBuffer("Save Mat.png")) { + ContentFile::ManuallyLoadDataPNG(g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/Save Mat.png", loadMemPng(buffer, info.uncompressed_size)); + } + + if (unzipFileIntoBuffer("Save FG.png")) { + ContentFile::ManuallyLoadDataPNG(g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/Save FG.png", loadMemPng(buffer, info.uncompressed_size)); + } + + if (unzipFileIntoBuffer("Save BG.png")) { + ContentFile::ManuallyLoadDataPNG(g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/Save BG.png", loadMemPng(buffer, info.uncompressed_size)); + } - if (!std::filesystem::exists(saveFilePath)) { - RTEError::ShowMessageBox("Game loading failed! Make sure you have a saved game called \"" + fileName + "\""); + for (int i = 0; i < Activity::MaxTeamCount; ++i) { + if (unzipFileIntoBuffer(std::format("Save UST{}.png", i))) { + ContentFile::ManuallyLoadDataPNG(g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + std::format("/Save UST{}.png", i), loadMemPng(buffer, info.uncompressed_size)); + } + } + + if (!unzipFileIntoBuffer("Save.ini")) { + RTEError::ShowMessageBox("Game loading failed! This save looks invalid or corrupted."); return false; } - Reader reader(saveFilePath, true, nullptr, false); + buffer[info.uncompressed_size] = 0; // null terminate + + Reader reader(std::make_unique(buffer), filePath + "/Save.ini", true, nullptr, false); std::unique_ptr scene(std::make_unique()); std::unique_ptr activity(std::make_unique()); @@ -169,6 +345,10 @@ bool ActivityMan::LoadAndLaunchGame(const std::string& fileName) { } } + free(buffer); + + unzClose(zippedSaveFile); + // SetSceneToLoad() doesn't Clone(), but when the Activity starts, it will eventually call LoadScene(), which does a Clone() of scene internally. g_SceneMan.SetSceneToLoad(scene.get(), true, true); // Saved Scenes get their presetname set to their filename to ensure they're separate from the preset Scene they're based off of. @@ -180,6 +360,7 @@ bool ActivityMan::LoadAndLaunchGame(const std::string& fileName) { g_SceneMan.SetSceneToLoad(originalScenePresetName, placeObjectsIfSceneIsRestarted, placeUnitsIfSceneIsRestarted); g_ConsoleMan.PrintString("SYSTEM: Game \"" + fileName + "\" loaded!"); + return true; } diff --git a/Source/Managers/ActivityMan.h b/Source/Managers/ActivityMan.h index 61369d7a4..d587b7084 100644 --- a/Source/Managers/ActivityMan.h +++ b/Source/Managers/ActivityMan.h @@ -129,6 +129,9 @@ namespace RTE { /// @param fileName Path to the file. /// @return Whether or not the saved game was successfully loaded. bool LoadAndLaunchGame(const std::string& fileName); + + /// Waits for the task that saves the game to complete. + void WaitForSaveGameTask() const { m_SaveGameTask.wait(); } #pragma endregion #pragma region Activity Start Handling diff --git a/Source/Managers/FrameMan.h b/Source/Managers/FrameMan.h index a64ae9338..72037a459 100644 --- a/Source/Managers/FrameMan.h +++ b/Source/Managers/FrameMan.h @@ -74,7 +74,7 @@ namespace RTE { std::shared_ptr GetBackBuffer() const { return m_BackBuffer; } #pragma endregion -#pragma region Split - Screen Handling +#pragma region Split-Screen Handling /// Gets whether the screen is split horizontally across the screen, ie as two splitscreens one above the other. /// @return Whether or not screen has a horizontal split. bool GetHSplit() const { return m_HSplit; } diff --git a/Source/Managers/LuaMan.h b/Source/Managers/LuaMan.h index 5a11b4b1f..62502714c 100644 --- a/Source/Managers/LuaMan.h +++ b/Source/Managers/LuaMan.h @@ -335,7 +335,7 @@ namespace RTE { const std::unordered_map GetScriptTimings() const; #pragma endregion -#pragma region File I / O Handling +#pragma region File I/O Handling /// Returns a vector of all the directories in path, which is relative to the working directory. /// @param path Directory path relative to the working directory. /// @return A vector of the directories in path. diff --git a/Source/Managers/PerformanceMan.cpp b/Source/Managers/PerformanceMan.cpp index 34b2a46f7..123235202 100644 --- a/Source/Managers/PerformanceMan.cpp +++ b/Source/Managers/PerformanceMan.cpp @@ -122,11 +122,11 @@ void PerformanceMan::Draw(BITMAP* bitmapToDrawTo) { std::snprintf(str, sizeof(str), "Frame: %.1fms | Update: %.1fms | Draw: %.1fms", m_MSPFAverage, m_MSPUAverage, m_MSPDAverage); guiFont->DrawAligned(&drawBitmap, c_StatsOffsetX, c_StatsHeight + 10, str, GUIFont::Left); - std::snprintf(str, sizeof(str), "Time Scale: x%.2f ([1]-, [2]+, [Ctrl+1]Rst) | Sim Speed: x%.2f", g_TimerMan.GetTimeScale(), g_TimerMan.GetSimSpeed()); + std::snprintf(str, sizeof(str), "Time Scale: x%.2f ([1]-, [2]+, [RAlt+1]Rst) | Sim Speed: x%.2f", g_TimerMan.GetTimeScale(), g_TimerMan.GetSimSpeed()); guiFont->DrawAligned(&drawBitmap, c_StatsOffsetX, c_StatsHeight + 20, str, GUIFont::Left); float deltaTime = g_TimerMan.GetDeltaTimeMS(); - std::snprintf(str, sizeof(str), "DeltaTime: %.2f ms ([5]-, [6]+, [Ctrl+5]Rst)", deltaTime); + std::snprintf(str, sizeof(str), "DeltaTime: %.2f ms ([5]-, [6]+, [RAlt+5]Rst)", deltaTime); guiFont->DrawAligned(&drawBitmap, c_StatsOffsetX, c_StatsHeight + 30, str, GUIFont::Left); std::snprintf(str, sizeof(str), "Actors: %li", g_MovableMan.GetActorCount()); diff --git a/Source/Managers/WindowMan.h b/Source/Managers/WindowMan.h index b8ca28997..62b891117 100644 --- a/Source/Managers/WindowMan.h +++ b/Source/Managers/WindowMan.h @@ -279,7 +279,7 @@ namespace RTE { void AttemptToRevertToPreviousResolution(bool revertToDefaults = false); #pragma endregion -#pragma region Multi - Display Handling +#pragma region Multi-Display Handling /// Clears all the multi-display data, resetting the game to a single-window-single-display state. void ClearMultiDisplayData(); diff --git a/Source/Menus/SaveLoadMenuGUI.cpp b/Source/Menus/SaveLoadMenuGUI.cpp index 04d83fa82..205f65a38 100644 --- a/Source/Menus/SaveLoadMenuGUI.cpp +++ b/Source/Menus/SaveLoadMenuGUI.cpp @@ -21,6 +21,9 @@ #include +#include "zip.h" +#include "unzip.h" + using namespace RTE; SaveLoadMenuGUI::SaveLoadMenuGUI(AllegroScreen* guiScreen, GUIInputWrapper* guiInput, bool createForPauseMenu) { @@ -75,6 +78,8 @@ SaveLoadMenuGUI::SaveLoadMenuGUI(AllegroScreen* guiScreen, GUIInputWrapper* guiI } void SaveLoadMenuGUI::PopulateSaveGamesList() { + g_ActivityMan.WaitForSaveGameTask(); + m_SaveGames.clear(); m_SaveGameName->SetText(""); @@ -82,10 +87,10 @@ void SaveLoadMenuGUI::PopulateSaveGamesList() { std::string saveFilePath = g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/"; for (const auto& entry: std::filesystem::directory_iterator(saveFilePath)) { - if (entry.is_directory()) { + if (entry.path().extension() == ".ccsave") { SaveRecord record; record.SavePath = entry.path(); - record.SaveDate = std::filesystem::last_write_time(entry.path() / "Save.ini"); + record.SaveDate = entry.last_write_time(); m_SaveGames.push_back(record); } } @@ -93,31 +98,48 @@ void SaveLoadMenuGUI::PopulateSaveGamesList() { std::for_each(std::execution::par_unseq, m_SaveGames.begin(), m_SaveGames.end(), [](SaveRecord& record) { - Reader reader(record.SavePath.string() + "/Save.ini", true, nullptr, true); + // load zip sav file + std::string filePath = record.SavePath.string(); + unzFile zippedSaveFile = unzOpen(filePath.c_str()); + if (!zippedSaveFile) { + return; + } + + // These need to use NULL instead of nullptr to compile on Linux/OSX? + if (unzLocateFile(zippedSaveFile, "Index.ini", NULL) == UNZ_END_OF_LIST_OF_FILE) { + unzClose(zippedSaveFile); + return; + } - bool readActivity = false; - bool readSceneName = false; + unz_file_info info; + unzOpenCurrentFile(zippedSaveFile); + unzGetCurrentFileInfo(zippedSaveFile, &info, nullptr, 0, nullptr, 0, nullptr, 0); - GAScripted activity; + char* buffer = (char*)malloc(info.uncompressed_size + 1); + if (!buffer) { + // If this ever hits I've lost all faith in modern OSes, but alas when one is writing C, one must dance along + RTEError::ShowMessageBox("Catastrophic failure! Failed to allocate memory for savegame"); + unzClose(zippedSaveFile); + return; + } + + unzReadCurrentFile(zippedSaveFile, buffer, info.uncompressed_size); + unzCloseCurrentFile(zippedSaveFile); + + buffer[info.uncompressed_size] = 0; // need to null-terminate manually - std::string originalScenePresetName; + Reader reader(std::make_unique(buffer), record.SavePath.string(), true, nullptr, false); while (reader.NextProperty()) { std::string propName = reader.ReadPropName(); - if (propName == "Activity") { - reader >> activity; - readActivity = true; + if (propName == "ActivityName") { + reader >> record.Activity; } else if (propName == "OriginalScenePresetName") { - reader >> originalScenePresetName; - readSceneName = true; - } - - if (readActivity && readSceneName) { - break; + reader >> record.Scene; } } - record.Activity = activity.GetPresetName(); - record.Scene = originalScenePresetName; + unzClose(zippedSaveFile); + free(buffer); }); UpdateSaveGamesGUIList(); @@ -191,9 +213,9 @@ void SaveLoadMenuGUI::CreateSave() { } void SaveLoadMenuGUI::DeleteSave() { - std::string saveFilePath = g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/" + m_SaveGameName->GetText(); + std::string saveFilePath = g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/" + m_SaveGameName->GetText() + ".ccsave"; - std::filesystem::remove_all(saveFilePath); + std::filesystem::remove(saveFilePath); g_GUISound.ConfirmSound()->Play(); PopulateSaveGamesList(); diff --git a/Source/System/Constants.h b/Source/System/Constants.h index 259d863d4..e1e451b17 100644 --- a/Source/System/Constants.h +++ b/Source/System/Constants.h @@ -365,7 +365,7 @@ namespace RTE { {Directions::Right, 0.0F}}; #pragma endregion -#pragma region Un - Definitions +#pragma region Un-Definitions // Allegro defines these via define in astdint.h and Boost with stdlib go crazy so we need to undefine them manually. #undef int8_t #undef uint8_t diff --git a/Source/System/ContentFile.cpp b/Source/System/ContentFile.cpp index 62f3e9a60..c11a99faa 100644 --- a/Source/System/ContentFile.cpp +++ b/Source/System/ContentFile.cpp @@ -19,6 +19,7 @@ using namespace RTE; const std::string ContentFile::c_ClassName = "ContentFile"; std::array, ContentFile::BitDepths::BitDepthCount> ContentFile::s_LoadedBitmaps; +std::unordered_map ContentFile::s_MemoryPNGs; std::unordered_map ContentFile::s_LoadedSamples; std::unordered_map ContentFile::s_PathHashes; @@ -30,6 +31,7 @@ void ContentFile::Clear() { m_FormattedReaderPosition.clear(); m_DataPathAndReaderPosition.clear(); m_DataModuleID = 0; + m_IsMemoryPNG = false; m_ImageFileInfo.fill(-1); } @@ -60,7 +62,9 @@ void ContentFile::FreeAllLoaded() { int ContentFile::ReadProperty(const std::string_view& propName, Reader& reader) { StartPropertyList(return Serializable::ReadProperty(propName, reader)); - MatchForwards("FilePath") MatchProperty("Path", { SetDataPath(reader.ReadPropValue()); }); + MatchForwards("FilePath") + MatchProperty("Path", { SetDataPath(reader.ReadPropValue()); }); + MatchProperty("IsMemoryPNG", { reader >> m_IsMemoryPNG; }); EndPropertyList; } @@ -71,6 +75,7 @@ int ContentFile::Save(Writer& writer) const { if (!m_DataPath.empty()) { writer.NewPropertyWithValue("FilePath", m_DataPath); } + writer.NewPropertyWithValue("IsMemoryPNG", m_IsMemoryPNG); return 0; } @@ -110,6 +115,15 @@ int ContentFile::GetImageFileInfo(ImageFileInfoType infoTypeToGet) { } } if (fetchFileInfo) { + if (m_IsMemoryPNG) { + if (const SDL_Surface* png = s_MemoryPNGs[m_DataPath]) { + m_ImageFileInfo[ImageFileInfoType::ImageBitDepth] = static_cast(SDL_BITSPERPIXEL(png->format)); + m_ImageFileInfo[ImageFileInfoType::ImageWidth] = static_cast(png->w); + m_ImageFileInfo[ImageFileInfoType::ImageHeight] = static_cast(png->h); + return m_ImageFileInfo[infoTypeToGet]; + } + } + FILE* imageFile = fopen(m_DataPath.c_str(), "rb"); RTEAssert(imageFile, "Failed to open file prior to reading info of image file with following path and name:\n\n" + m_DataPath + "\n\nThe file may not exist or be corrupt."); @@ -182,6 +196,22 @@ void ContentFile::ReadAndStoreBMPFileInfo(FILE* imageFile) { } } +void ContentFile::ManuallyLoadDataPNG(const std::string& filePath, SDL_Surface* surface) { + s_MemoryPNGs[filePath] = surface; + + int bitDepth = SDL_GetPixelFormatDetails(surface->format)->bits_per_pixel; + BITMAP* bitmap = create_bitmap_ex(bitDepth, surface->w, surface->h); + + // Allegro doesn't align lines, SDL does 4byte alignment + for (int y = 0; y < surface->h; y++) { + memcpy(bitmap->line[y], + static_cast(surface->pixels) + surface->pitch * y, + surface->w * SDL_BYTESPERPIXEL(surface->format)); + } + + s_LoadedBitmaps[BitDepths::Eight].try_emplace(filePath, bitmap); +} + void ContentFile::ReloadAllBitmaps() { for (const std::unordered_map& bitmapCache: s_LoadedBitmaps) { for (const auto& [filePath, oldBitmap]: bitmapCache) { @@ -205,9 +235,22 @@ BITMAP* ContentFile::GetAsBitmap(int conversionMode, bool storeBitmap, const std // Check if the file has already been read and loaded from the disk and, if so, use that data. std::unordered_map::iterator foundBitmap = s_LoadedBitmaps[bitDepth].find(dataPathToLoad); - if (storeBitmap && foundBitmap != s_LoadedBitmaps[bitDepth].end()) { - returnBitmap = (*foundBitmap).second; - } else { + if (foundBitmap != s_LoadedBitmaps[bitDepth].end()) { + if (storeBitmap) { + returnBitmap = (*foundBitmap).second; + } else if (SDL_Surface* surface = s_MemoryPNGs[dataPathToLoad]) { + std::unordered_map::iterator foundBitmap = s_LoadedBitmaps[BitDepths::Eight].find(dataPathToLoad); + if (foundBitmap != s_LoadedBitmaps[BitDepths::Eight].end()) { + returnBitmap = foundBitmap->second; + s_LoadedBitmaps[BitDepths::Eight].erase(dataPathToLoad); + } + + SDL_DestroySurface(surface); + s_MemoryPNGs.erase(dataPathToLoad); + } + } + + if (returnBitmap == nullptr) { if (!System::PathExistsCaseSensitive(dataPathToLoad)) { const std::string dataPathWithoutExtension = dataPathToLoad.substr(0, dataPathToLoad.length() - m_DataPathExtension.length()); const std::string altFileExtension = (m_DataPathExtension == ".png") ? ".bmp" : ".png"; @@ -227,6 +270,7 @@ BITMAP* ContentFile::GetAsBitmap(int conversionMode, bool storeBitmap, const std s_LoadedBitmaps[bitDepth].try_emplace(dataPathToLoad, returnBitmap); } } + return returnBitmap; } diff --git a/Source/System/ContentFile.h b/Source/System/ContentFile.h index 12d477220..bfcd119d6 100644 --- a/Source/System/ContentFile.h +++ b/Source/System/ContentFile.h @@ -84,6 +84,10 @@ namespace RTE { /// @param hash Hash value to get file path from. /// @return Path to ContentFile. static std::string GetPathFromHash(size_t hash) { return (s_PathHashes.find(hash) == s_PathHashes.end()) ? "" : s_PathHashes[hash]; } + + /// Sets this ContentFile to be a memory file, meaning we won't try loading from disk and instead will let external code set us up. + /// @param isMemoryFile Whether we'll be considered a memory file. + void SetIsMemoryFile(bool isMemoryFile) { m_IsMemoryPNG = isMemoryFile; } #pragma endregion #pragma region Logging @@ -115,6 +119,8 @@ namespace RTE { #pragma endregion #pragma region Data Handling + static void ManuallyLoadDataPNG(const std::string& filePath, SDL_Surface* bitmap); + /// Reloads all BITMAPs in the cache from disk, allowing any changes to be reflected at runtime. static void ReloadAllBitmaps(); @@ -173,6 +179,7 @@ namespace RTE { static std::unordered_map s_PathHashes; //!< Static map containing the hash values of paths of all loaded data files. static std::array, BitDepths::BitDepthCount> s_LoadedBitmaps; //!< Static map containing all the already loaded BITMAPs and their paths for each bit depth. + static std::unordered_map s_MemoryPNGs; //!< Static map containing in-memory PNG files for save/load static std::unordered_map s_LoadedSamples; //!< Static map containing all the already loaded FSOUND_SAMPLEs and their paths. std::string m_DataPath; //!< The path to this ContentFile's data file. In the case of an animation, this filename/name will be appended with 000, 001, 002 etc. @@ -186,6 +193,7 @@ namespace RTE { std::string m_DataPathAndReaderPosition; //!< The path to this ContentFile's data file combined with the ini file and line it is being read from. This is used for logging. int m_DataModuleID; //!< Data Module ID of where this was loaded from. + bool m_IsMemoryPNG; //!< If true, we will not attempt to read this file on disk, and instead will let external code set us up. #pragma region Image Info Getters /// Gets the specified image info from this ContentFile's data file on disk. diff --git a/Source/System/Reader.cpp b/Source/System/Reader.cpp index db3232e38..c88e5c169 100644 --- a/Source/System/Reader.cpp +++ b/Source/System/Reader.cpp @@ -33,16 +33,16 @@ Reader::Reader(const std::string& fileName, bool overwrites, const ProgressCallb Create(fileName, overwrites, progressCallback, failOK); } -Reader::Reader(std::unique_ptr&& stream, bool overwrites, const ProgressCallback& progressCallback, bool failOK) { +Reader::Reader(std::unique_ptr&& stream, const std::string& fileName, bool overwrites, const ProgressCallback& progressCallback, bool failOK) { Clear(); - Create(std::move(stream), overwrites, progressCallback, failOK); + Create(std::move(stream), fileName, overwrites, progressCallback, failOK); } int Reader::Create(const std::string& fileName, bool overwrites, const ProgressCallback& progressCallback, bool failOK) { if (fileName.empty()) { return -1; } - + if (m_NonModulePath) { m_FilePath = std::filesystem::path(fileName).generic_string(); // Associate non-module paths with Base to prevent implosions when dealing with creating Entities. @@ -56,17 +56,36 @@ int Reader::Create(const std::string& fileName, bool overwrites, const ProgressC m_DataModuleName = g_PresetMan.GetModuleNameFromPath(m_FilePath); m_DataModuleID = g_PresetMan.GetModuleID(m_DataModuleName); } - - return Create(std::make_unique(m_FilePath), overwrites, progressCallback, failOK); + + return Create(std::make_unique(m_FilePath), fileName, overwrites, progressCallback, failOK); } -int Reader::Create(std::unique_ptr&& stream, bool overwrites, const ProgressCallback& progressCallback, bool failOK) { +int Reader::Create(std::unique_ptr&& stream, const std::string& fileName, bool overwrites, const ProgressCallback& progressCallback, bool failOK) { + // We redundantly do this following block of code in both constructors, which feels really ugly and lazy + if (fileName.empty()) { + return -1; + } + + if (m_NonModulePath) { + m_FilePath = std::filesystem::path(fileName).generic_string(); + // Associate non-module paths with Base to prevent implosions when dealing with creating Entities. + m_DataModuleName = "Base.rte"; + m_DataModuleID = 0; + } else { + m_FilePath = g_PresetMan.GetFullModulePath(fileName); + + // Extract the file name and module name from the path + m_FileName = m_FilePath.substr(m_FilePath.find_last_of("/\\") + 1); + m_DataModuleName = g_PresetMan.GetModuleNameFromPath(m_FilePath); + m_DataModuleID = g_PresetMan.GetModuleID(m_DataModuleName); + } + m_CanFail = failOK; m_Stream = std::move(stream); if (!m_CanFail) { - RTEAssert(System::PathExistsCaseSensitive(m_FilePath) && m_Stream->good(), "Failed to open data file \"" + m_FilePath + "\"!"); + RTEAssert(m_Stream->good(), "Failed to open data file \"" + m_FilePath + "\"!"); } m_OverwriteExisting = overwrites; diff --git a/Source/System/Reader.h b/Source/System/Reader.h index 386c579d5..9159c3e0f 100644 --- a/Source/System/Reader.h +++ b/Source/System/Reader.h @@ -31,7 +31,7 @@ namespace RTE { /// @param overwrites Whether object definitions read here overwrite existing ones with the same names. /// @param progressCallback A function pointer to a function that will be called and sent a string with information about the progress of this Reader's reading. /// @param failOK Whether it's ok for the file to not be there, ie we're only trying to open, and if it's not there, then fail silently. - Reader(std::unique_ptr&& stream, bool overwrites = false, const ProgressCallback& progressCallback = nullptr, bool failOK = false); + Reader(std::unique_ptr&& stream, const std::string& fileName, bool overwrites = false, const ProgressCallback& progressCallback = nullptr, bool failOK = false); /// Makes the Reader object ready for use. /// @param fileName Path to the file to open for reading. If the file doesn't exist the stream will fail to open. @@ -47,7 +47,7 @@ namespace RTE { /// @param progressCallback A function pointer to a function that will be called and sent a string with information about the progress of this Reader's reading. /// @param failOK Whether it's ok for the file to not be there, ie we're only trying to open, and if it's not there, then fail silently. /// @return An error return value signaling success or any particular failure. Anything below 0 is an error signal. - int Create(std::unique_ptr&& stream, bool overwrites = false, const ProgressCallback& progressCallback = nullptr, bool failOK = false); + int Create(std::unique_ptr&& stream, const std::string& fileName, bool overwrites = false, const ProgressCallback& progressCallback = nullptr, bool failOK = false); #pragma endregion #pragma region Getters and Setters diff --git a/Source/System/Serializable.h b/Source/System/Serializable.h index c2befacae..ffc782c5f 100644 --- a/Source/System/Serializable.h +++ b/Source/System/Serializable.h @@ -44,10 +44,12 @@ namespace RTE { #define MatchForwards(propertyName) \ sm_Properties[propertyName] = __COUNTER__ + 1; \ + [[fallthrough]]; \ case __COUNTER__: #define MatchProperty(propertyName, matchedFunction) \ sm_Properties[propertyName] = __COUNTER__ + 1; \ + [[fallthrough]]; \ case __COUNTER__: \ if (sm_Initialized) { \ {matchedFunction}; \ diff --git a/Source/System/System.h b/Source/System/System.h index 4199ce5f0..379ba4761 100644 --- a/Source/System/System.h +++ b/Source/System/System.h @@ -84,7 +84,7 @@ namespace RTE { static bool PathExistsCaseSensitive(const std::string& pathToCheck); #pragma endregion -#pragma region Command - Line Interface +#pragma region Command-Line Interface /// Tells whether printing loading progress report and console to command-line is enabled or not. /// @return Whether printing to command-line is enabled or not. static bool IsLoggingToCLI() { return s_LogToCLI; } diff --git a/Source/System/Writer.h b/Source/System/Writer.h index cc8209fca..b6a2249c3 100644 --- a/Source/System/Writer.h +++ b/Source/System/Writer.h @@ -112,6 +112,9 @@ namespace RTE { /// @return Whether the writer is ready to start accepting data streamed to it or not. bool WriterOK() const { return m_Stream.get() && m_Stream->good(); } + /// Returns the underlying stream. + std::ostream* GetStream() { return m_Stream.get(); } + /// Flushes and closes the output stream of this Writer. This happens automatically at destruction but needs to be called manually if a written file must be read from in the same scope. void EndWrite() { m_Stream->flush(); diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-debug-32.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-debug-32.lib index 06bed6bcb..572d93611 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-debug-32.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-debug-32.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-debug-release-32.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-debug-release-32.lib index a79f14ec0..776913914 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-debug-release-32.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-debug-release-32.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-debug-release.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-debug-release.lib index 0f862d120..9f2ce24ae 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-debug-release.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-debug-release.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-debug.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-debug.lib index 04f5de269..399800e1e 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-debug.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-debug.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-release-32.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-release-32.lib index 746ab0553..ff66b906e 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-release-32.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-release-32.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-release.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-release.lib index d5b239b1c..0f6b4765d 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-release.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/allegro-release.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-debug-32.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-debug-32.lib index 602ebe3d4..ff5cfc6cf 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-debug-32.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-debug-32.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-debug-release-32.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-debug-release-32.lib index 311a7fce2..903f7191f 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-debug-release-32.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-debug-release-32.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-debug-release.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-debug-release.lib index a9aa14671..ea2e3f59f 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-debug-release.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-debug-release.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-debug.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-debug.lib index da08a49e0..0bbc86a03 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-debug.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-debug.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-release-32.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-release-32.lib index a80672715..dc6dc4ac9 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-release-32.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-release-32.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-release.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-release.lib index 632c87fda..e5426f585 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-release.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/allegrogl-release.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-debug-32.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-debug-32.lib index 794d1c034..d227d6c53 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-debug-32.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-debug-32.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-debug-release-32.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-debug-release-32.lib index 7bfb62eaf..0738bd33b 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-debug-release-32.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-debug-release-32.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-debug-release.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-debug-release.lib index 97f09839b..23d892aa1 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-debug-release.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-debug-release.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-debug.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-debug.lib index 28533ae93..ea8cbaeaf 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-debug.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-debug.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-release-32.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-release-32.lib index b2d28f9a6..bd2ba1157 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-release-32.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-release-32.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-release.lib b/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-release.lib index 5c0591f22..12a522768 100644 Binary files a/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-release.lib and b/external/sources/allegro 4.4.3.1-custom/_Bin/loadpng-release.lib differ diff --git a/external/sources/allegro 4.4.3.1-custom/addons/loadpng/loadpng.h b/external/sources/allegro 4.4.3.1-custom/addons/loadpng/loadpng.h index 35111d6e0..11abdfe88 100644 --- a/external/sources/allegro 4.4.3.1-custom/addons/loadpng/loadpng.h +++ b/external/sources/allegro 4.4.3.1-custom/addons/loadpng/loadpng.h @@ -25,14 +25,13 @@ extern "C" { #define APNG_FUNC(type, name, args) extern type name args #endif /* (defined LOADPNG_DYNAMIC) && (defined ALLEGRO_WINDOWS) */ - +#include /* Overkill :-) */ #define LOADPNG_VERSION 1 #define LOADPNG_SUBVERSION 5 #define LOADPNG_VERSIONSTR "1.5" - /* _png_screen_gamma is slightly overloaded (sorry): * * A value of 0.0 means: Don't do any gamma correction in load_png() @@ -66,6 +65,12 @@ APNG_FUNC(BITMAP *, load_memory_png, (AL_CONST void *buffer, int buffer_size, RG /* Save a bitmap to disk in PNG format. */ APNG_FUNC(int, save_png, (AL_CONST char *filename, BITMAP *bmp, AL_CONST RGB *pal)); +/* Save a bitmap to a PACKFILE in PNG format. */ +APNG_FUNC(int, save_png_pf, (PACKFILE *pack, BITMAP *bmp, AL_CONST RGB *pal)); + +/* Save a bitmap to a stream in PNG format. */ +APNG_FUNC(int, save_stream_png, (FILE *stream, BITMAP *bmp, AL_CONST RGB *pal)); + /* Adds `PNG' to Allegro's internal file type table. * You can then just use load_bitmap and save_bitmap as usual. */ diff --git a/external/sources/allegro 4.4.3.1-custom/addons/loadpng/savepng.c b/external/sources/allegro 4.4.3.1-custom/addons/loadpng/savepng.c index 4529233c8..7ce26a27b 100644 --- a/external/sources/allegro 4.4.3.1-custom/addons/loadpng/savepng.c +++ b/external/sources/allegro 4.4.3.1-custom/addons/loadpng/savepng.c @@ -292,7 +292,6 @@ static int really_save_png(PACKFILE *fp, BITMAP *bmp, AL_CONST RGB *pal) return -1; } - int save_png(AL_CONST char *filename, BITMAP *bmp, AL_CONST RGB *pal) { PACKFILE *fp; @@ -313,3 +312,143 @@ int save_png(AL_CONST char *filename, BITMAP *bmp, AL_CONST RGB *pal) return result; } + +int save_png_pf(PACKFILE *pack, BITMAP *bmp, AL_CONST RGB *pal) +{ + int result; + + ASSERT(pack); + ASSERT(bmp); + + acquire_bitmap(bmp); + result = really_save_png(pack, bmp, pal); + release_bitmap(bmp); + + return result; +} + +/* save_memory_png: + * Writes a non-interlaced, no-frills PNG, taking the usual save_xyz + * parameters. Returns non-zero on error. + */ +int save_stream_png(FILE *stream, BITMAP *bmp, AL_CONST RGB *pal) +{ + jmp_buf jmpbuf; + png_structp png_ptr = NULL; + png_infop info_ptr = NULL; + int depth; + int colour_type; + + depth = bitmap_color_depth(bmp); + if (depth == 8 && !pal) + return -1; + + /* Create and initialize the png_struct with the + * desired error handler functions. + */ + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, + (void *)NULL, NULL, NULL); + if (!png_ptr) + goto Error; + + /* Allocate/initialize the image information data. */ + info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) + goto Error; + + /* Set error handling. */ + if (setjmp(jmpbuf)) { + /* If we get here, we had a problem reading the file. */ + goto Error; + } + png_set_error_fn(png_ptr, jmpbuf, user_error_fn, NULL); + + /* Use stream routines. */ + png_set_write_fn(png_ptr, stream, NULL, NULL); + + /* Set the image information here. Width and height are up to 2^31, + * bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on + * the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY, + * PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB, + * or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or + * PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST + * currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. + */ + if (depth == 8) + colour_type = PNG_COLOR_TYPE_PALETTE; + else if (depth == 32) + colour_type = PNG_COLOR_TYPE_RGB_ALPHA; + else + colour_type = PNG_COLOR_TYPE_RGB; + + /* Set compression level. */ + png_set_compression_level(png_ptr, _png_compression_level); + + png_set_IHDR(png_ptr, info_ptr, bmp->w, bmp->h, 8, colour_type, + PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, + PNG_FILTER_TYPE_BASE); + + /* Set the palette if there is one. Required for indexed-color images. */ + if (colour_type == PNG_COLOR_TYPE_PALETTE) { + png_color palette[256]; + int i; + + for (i = 0; i < 256; i++) { + palette[i].red = pal[i].r; /* 64 -> 256 */ + palette[i].green = pal[i].g; + palette[i].blue = pal[i].b; + } + + /* Set palette colors. */ + png_set_PLTE(png_ptr, info_ptr, palette, 256); + } + + /* Optionally write comments into the image ... Nah. */ + + /* Write the file header information. */ + png_write_info(png_ptr, info_ptr); + + /* Once we write out the header, the compression type on the text + * chunks gets changed to PNG_TEXT_COMPRESSION_NONE_WR or + * PNG_TEXT_COMPRESSION_zTXt_WR, so it doesn't get written out again + * at the end. + */ + + /* Save the data. */ + switch (depth) { + case 8: + if (!save_indexed(png_ptr, bmp)) + goto Error; + break; + case 15: + case 16: + case 24: + if (!save_rgb(png_ptr, bmp)) + goto Error; + break; + case 32: + if (!save_rgba(png_ptr, bmp)) + goto Error; + break; + default: + ASSERT(FALSE); + goto Error; + } + + png_write_end(png_ptr, info_ptr); + + png_destroy_write_struct(&png_ptr, &info_ptr); + + return 0; + + Error: + + if (png_ptr) { + if (info_ptr) + png_destroy_write_struct(&png_ptr, &info_ptr); + else + png_destroy_write_struct(&png_ptr, NULL); + } + + return -1; +} diff --git a/external/sources/allegro 4.4.3.1-custom/allegro.vcxproj b/external/sources/allegro 4.4.3.1-custom/allegro.vcxproj index 2c3f310c8..523fc6229 100644 --- a/external/sources/allegro 4.4.3.1-custom/allegro.vcxproj +++ b/external/sources/allegro 4.4.3.1-custom/allegro.vcxproj @@ -333,7 +333,7 @@ - $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\src;%(AdditionalIncludeDirectories) + $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\src;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) EnableFastChecks @@ -358,7 +358,7 @@ - $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\src;%(AdditionalIncludeDirectories) + $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\src;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) EnableFastChecks @@ -383,7 +383,7 @@ - $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\src;%(AdditionalIncludeDirectories) + $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\src;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) @@ -408,7 +408,7 @@ - $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\src;%(AdditionalIncludeDirectories) + $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\src;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) @@ -433,7 +433,7 @@ - $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\src;%(AdditionalIncludeDirectories) + $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\src;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) ProgramDatabase @@ -457,7 +457,7 @@ - $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\src;%(AdditionalIncludeDirectories) + $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\src;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) ProgramDatabase diff --git a/external/sources/allegro 4.4.3.1-custom/allegrogl.vcxproj b/external/sources/allegro 4.4.3.1-custom/allegrogl.vcxproj index f659c92e0..17daa1fdb 100644 --- a/external/sources/allegro 4.4.3.1-custom/allegrogl.vcxproj +++ b/external/sources/allegro 4.4.3.1-custom/allegrogl.vcxproj @@ -111,7 +111,7 @@ - $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\addons\allegrogl\include;$(ProjectDir)\addons\allegrogl\src;%(AdditionalIncludeDirectories) + $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\addons\allegrogl\include;$(ProjectDir)\addons\allegrogl\src;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) EnableFastChecks @@ -134,7 +134,7 @@ - $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\addons\allegrogl\include;$(ProjectDir)\addons\allegrogl\src;%(AdditionalIncludeDirectories) + $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\addons\allegrogl\include;$(ProjectDir)\addons\allegrogl\src;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) EnableFastChecks @@ -157,7 +157,7 @@ - $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\addons\allegrogl\include;$(ProjectDir)\addons\allegrogl\src;%(AdditionalIncludeDirectories) + $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\addons\allegrogl\include;$(ProjectDir)\addons\allegrogl\src;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) @@ -180,7 +180,7 @@ - $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\addons\allegrogl\include;$(ProjectDir)\addons\allegrogl\src;%(AdditionalIncludeDirectories) + $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\addons\allegrogl\include;$(ProjectDir)\addons\allegrogl\src;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) @@ -203,7 +203,7 @@ - $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\addons\allegrogl\include;$(ProjectDir)\addons\allegrogl\src;%(AdditionalIncludeDirectories) + $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\addons\allegrogl\include;$(ProjectDir)\addons\allegrogl\src;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) ProgramDatabase @@ -225,7 +225,7 @@ - $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\addons\allegrogl\include;$(ProjectDir)\addons\allegrogl\src;%(AdditionalIncludeDirectories) + $(ProjectDir);$(ProjectDir)\include;$(ProjectDir)\addons\allegrogl\include;$(ProjectDir)\addons\allegrogl\src;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) ProgramDatabase diff --git a/external/sources/allegro 4.4.3.1-custom/loadpng.vcxproj b/external/sources/allegro 4.4.3.1-custom/loadpng.vcxproj index 21a340c7f..65062935d 100644 --- a/external/sources/allegro 4.4.3.1-custom/loadpng.vcxproj +++ b/external/sources/allegro 4.4.3.1-custom/loadpng.vcxproj @@ -111,7 +111,7 @@ - $(ProjectDir)\include;$(ProjectDir)\addons\loadpng;$(ProjectDir)..\zlib-ng-2.1.3\include;$(ProjectDir)..\libpng-1.6.40\include;%(AdditionalIncludeDirectories) + $(ProjectDir)\include;$(ProjectDir)\addons\loadpng;$(ProjectDir)..\zlib-ng-2.1.3\include;$(ProjectDir)..\libpng-1.6.40\include;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) EnableFastChecks @@ -134,7 +134,7 @@ - $(ProjectDir)\include;$(ProjectDir)\addons\loadpng;$(ProjectDir)..\zlib-ng-2.1.3\include;$(ProjectDir)..\libpng-1.6.40\include;%(AdditionalIncludeDirectories) + $(ProjectDir)\include;$(ProjectDir)\addons\loadpng;$(ProjectDir)..\zlib-ng-2.1.3\include;$(ProjectDir)..\libpng-1.6.40\include;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) EnableFastChecks @@ -157,7 +157,7 @@ - $(ProjectDir)\include;$(ProjectDir)\addons\loadpng;$(ProjectDir)..\zlib-ng-2.1.3\include;$(ProjectDir)..\libpng-1.6.40\include;%(AdditionalIncludeDirectories) + $(ProjectDir)\include;$(ProjectDir)\addons\loadpng;$(ProjectDir)..\zlib-ng-2.1.3\include;$(ProjectDir)..\libpng-1.6.40\include;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) @@ -180,7 +180,7 @@ - $(ProjectDir)\include;$(ProjectDir)\addons\loadpng;$(ProjectDir)..\zlib-ng-2.1.3\include;$(ProjectDir)..\libpng-1.6.40\include;%(AdditionalIncludeDirectories) + $(ProjectDir)\include;$(ProjectDir)\addons\loadpng;$(ProjectDir)..\zlib-ng-2.1.3\include;$(ProjectDir)..\libpng-1.6.40\include;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) @@ -203,7 +203,7 @@ - $(ProjectDir)\include;$(ProjectDir)\addons\loadpng;$(ProjectDir)..\zlib-ng-2.1.3\include;$(ProjectDir)..\libpng-1.6.40\include;%(AdditionalIncludeDirectories) + $(ProjectDir)\include;$(ProjectDir)\addons\loadpng;$(ProjectDir)..\zlib-ng-2.1.3\include;$(ProjectDir)..\libpng-1.6.40\include;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) ProgramDatabase @@ -225,7 +225,7 @@ - $(ProjectDir)\include;$(ProjectDir)\addons\loadpng;$(ProjectDir)..\zlib-ng-2.1.3\include;$(ProjectDir)..\libpng-1.6.40\include;%(AdditionalIncludeDirectories) + $(ProjectDir)\include;$(ProjectDir)\addons\loadpng;$(ProjectDir)..\zlib-ng-2.1.3\include;$(ProjectDir)..\libpng-1.6.40\include;$(ProjectDir)\..\tracy\public;%(AdditionalIncludeDirectories) %(AdditionalOptions) $(IntDir) ProgramDatabase diff --git a/imgui.ini b/imgui.ini new file mode 100644 index 000000000..9930887f2 --- /dev/null +++ b/imgui.ini @@ -0,0 +1,4 @@ +[Window][Debug##Default] +Pos=60,60 +Size=400,400 +