From e40b1963f9df2f78c24dcb3a31f0e23a84d42ea6 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Wed, 16 Jun 2021 11:17:10 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=9A=20engine.h:=20Extract=20`CelSprite?= =?UTF-8?q?`=20and=20file=20loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CMakeLists.txt | 2 + Source/DiabloUI/fonts.cpp | 1 + Source/automap.cpp | 1 + Source/control.cpp | 2 + Source/cursor.cpp | 1 + Source/cursor.h | 1 + Source/debug.cpp | 2 + Source/diablo.cpp | 3 + Source/doom.cpp | 2 + Source/drlg_l1.cpp | 1 + Source/drlg_l2.cpp | 1 + Source/drlg_l3.cpp | 1 + Source/drlg_l4.cpp | 2 + Source/engine.cpp | 41 ----------- Source/engine.h | 100 --------------------------- Source/engine/animationinfo.h | 2 +- Source/engine/cel_sprite.hpp | 62 +++++++++++++++++ Source/engine/load_cel.cpp | 17 +++++ Source/engine/load_cel.hpp | 13 ++++ Source/engine/load_file.cpp | 38 ++++++++++ Source/engine/load_file.hpp | 54 +++++++++++++++ Source/engine/render/cel_render.hpp | 1 + Source/engine/render/cl2_render.hpp | 1 + Source/engine/render/text_render.cpp | 1 + Source/engine/render/text_render.hpp | 1 + Source/gendung.cpp | 2 + Source/gendung.h | 1 + Source/gmenu.cpp | 2 + Source/interfac.cpp | 2 + Source/inv.cpp | 2 + Source/items.cpp | 2 + Source/lighting.cpp | 1 + Source/minitext.cpp | 2 + Source/missiles.cpp | 1 + Source/monster.cpp | 1 + Source/monster.h | 1 + Source/objects.cpp | 1 + Source/palette.cpp | 2 +- Source/player.cpp | 1 + Source/player.h | 7 +- Source/quests.cpp | 2 + Source/quests.h | 1 + Source/setmaps.cpp | 1 + Source/stores.cpp | 1 + Source/stores.h | 1 + Source/town.cpp | 1 + Source/towners.cpp | 1 + 47 files changed, 241 insertions(+), 146 deletions(-) create mode 100644 Source/engine/cel_sprite.hpp create mode 100644 Source/engine/load_cel.cpp create mode 100644 Source/engine/load_cel.hpp create mode 100644 Source/engine/load_file.cpp create mode 100644 Source/engine/load_file.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index b87b058da..169c375e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -391,6 +391,8 @@ set(libdevilutionx_SRCS Source/controls/touch.cpp Source/controls/keymapper.cpp Source/engine/animationinfo.cpp + Source/engine/load_cel.cpp + Source/engine/load_file.cpp Source/engine/render/automap_render.cpp Source/engine/render/cel_render.cpp Source/engine/render/cl2_render.cpp diff --git a/Source/DiabloUI/fonts.cpp b/Source/DiabloUI/fonts.cpp index dd5c66f3c..81fa2b73f 100644 --- a/Source/DiabloUI/fonts.cpp +++ b/Source/DiabloUI/fonts.cpp @@ -1,6 +1,7 @@ #include "DiabloUI/fonts.h" #include "diablo.h" +#include "engine/load_file.hpp" #include "utils/file_util.h" #include "utils/paths.h" #include "utils/log.hpp" diff --git a/Source/automap.cpp b/Source/automap.cpp index 0da4f90b3..197eaba75 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -8,6 +8,7 @@ #include #include "control.h" +#include "engine/load_file.hpp" #include "engine/render/automap_render.hpp" #include "inv.h" #include "monster.h" diff --git a/Source/control.cpp b/Source/control.cpp index 9a41a780c..86110e3a0 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -14,6 +14,8 @@ #include "automap.h" #include "controls/keymapper.hpp" #include "cursor.h" +#include "engine/cel_sprite.hpp" +#include "engine/load_cel.hpp" #include "engine/render/cel_render.hpp" #include "error.h" #include "gamemenu.h" diff --git a/Source/cursor.cpp b/Source/cursor.cpp index 1036e0561..e30a08318 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -9,6 +9,7 @@ #include "control.h" #include "doom.h" +#include "engine/load_cel.hpp" #include "engine/point.hpp" #include "engine.h" #include "engine/render/cel_render.hpp" diff --git a/Source/cursor.h b/Source/cursor.h index 6d02f486a..ae1d0a5a5 100644 --- a/Source/cursor.h +++ b/Source/cursor.h @@ -9,6 +9,7 @@ #include #include "engine.h" +#include "engine/cel_sprite.hpp" #include "miniwin/miniwin.h" #include "utils/stdcompat/optional.hpp" diff --git a/Source/debug.cpp b/Source/debug.cpp index 9a78904f1..0fa128a93 100644 --- a/Source/debug.cpp +++ b/Source/debug.cpp @@ -5,6 +5,8 @@ */ #include "cursor.h" +#include "engine/cel_sprite.hpp" +#include "engine/load_cel.hpp" #include "engine/point.hpp" #include "inv.h" #include "spells.h" diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 0bacc6fa1..6c787bba0 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -25,6 +25,9 @@ #include "drlg_l4.h" #include "dx.h" #include "encrypt.h" +#include "engine/cel_sprite.hpp" +#include "engine/load_cel.hpp" +#include "engine/load_file.hpp" #include "error.h" #include "gamemenu.h" #include "gmenu.h" diff --git a/Source/doom.cpp b/Source/doom.cpp index 165cd0736..686c28d27 100644 --- a/Source/doom.cpp +++ b/Source/doom.cpp @@ -7,6 +7,8 @@ #include "control.h" #include "engine.h" +#include "engine/cel_sprite.hpp" +#include "engine/load_cel.hpp" #include "engine/render/cel_render.hpp" #include "utils/stdcompat/optional.hpp" diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index d0f4d1c26..dae4ebb1d 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -6,6 +6,7 @@ #include "drlg_l1.h" #include "engine/point.hpp" +#include "engine/load_file.hpp" #include "gendung.h" #include "lighting.h" #include "player.h" diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index 756800f42..5ea6da802 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -10,6 +10,7 @@ #include "diablo.h" #include "drlg_l1.h" +#include "engine/load_file.hpp" #include "objects.h" #include "player.h" #include "quests.h" diff --git a/Source/drlg_l3.cpp b/Source/drlg_l3.cpp index 987880c48..551220542 100644 --- a/Source/drlg_l3.cpp +++ b/Source/drlg_l3.cpp @@ -7,6 +7,7 @@ #include #include "drlg_l1.h" +#include "engine/load_file.hpp" #include "lighting.h" #include "monster.h" #include "objdat.h" diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index 532c76868..26b94af8b 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -3,8 +3,10 @@ * * Implementation of the hell level generation algorithms. */ +#include "drlg_l4.h" #include "drlg_l1.h" +#include "engine/load_file.hpp" #include "monster.h" #include "multi.h" #include "objdat.h" diff --git a/Source/engine.cpp b/Source/engine.cpp index 9210f6e5a..7c615caaa 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -17,7 +17,6 @@ #include "lighting.h" #include "movie.h" #include "options.h" -#include "storm/storm.h" namespace devilution { @@ -80,16 +79,6 @@ void CelOutputBuffer::BlitFromSkipColorIndexZero(const CelOutputBuffer &src, SDL BufferBlit(src, srcRect, *this, targetPosition); } -CelSprite LoadCel(const char *pszName, int width) -{ - return CelSprite(LoadFileInMem(pszName), width); -} - -CelSprite LoadCel(const char *pszName, const int *widths) -{ - return CelSprite(LoadFileInMem(pszName), widths); -} - void DrawHorizontalLine(const CelOutputBuffer &out, Point from, int width, std::uint8_t colorIndex) { if (from.y < 0 || from.y >= out.h() || from.x >= out.w() || width <= 0 || from.x + width <= 0) @@ -296,36 +285,6 @@ int32_t GenerateRnd(int32_t v) return AdvanceRndSeed() % v; } -size_t GetFileSize(const char *pszName) -{ - HANDLE file; - if (!SFileOpenFile(pszName, &file)) { - if (!gbQuietMode) - app_fatal("GetFileSize - SFileOpenFile failed for file:\n%s", pszName); - return 0; - } - const size_t fileLen = SFileGetFileSize(file); - SFileCloseFileThreadSafe(file); - - return fileLen; -} - -void LoadFileData(const char *pszName, byte *buffer, size_t fileLen) -{ - HANDLE file; - if (!SFileOpenFile(pszName, &file)) { - if (!gbQuietMode) - app_fatal("LoadFileData - SFileOpenFile failed for file:\n%s", pszName); - return; - } - - if (fileLen == 0) - app_fatal("Zero length SFILE:\n%s", pszName); - - SFileReadFileThreadSafe(file, buffer, fileLen); - SFileCloseFileThreadSafe(file); -} - /** * @brief Fade to black and play a video * @param pszMovie file path of movie diff --git a/Source/engine.h b/Source/engine.h index 79a136150..1d8d5bc5f 100644 --- a/Source/engine.h +++ b/Source/engine.h @@ -275,64 +275,6 @@ struct CelOutputBuffer { void BlitFromSkipColorIndexZero(const CelOutputBuffer &src, SDL_Rect srcRect, Point targetPosition) const; }; -/** - * Stores a CEL or CL2 sprite and its width(s). - * - * The data may be unowned. - * Eventually we'd like to remove the unowned version. - */ -class CelSprite { -public: - CelSprite(std::unique_ptr data, int width) - : data_(std::move(data)) - , data_ptr_(data_.get()) - , width_(width) - { - } - - CelSprite(std::unique_ptr data, const int *widths) - : data_(std::move(data)) - , data_ptr_(data_.get()) - , widths_(widths) - { - } - - /** - * Constructs an unowned sprite. - * Ideally we'd like to remove all uses of this constructor. - */ - CelSprite(const byte *data, int width) - : data_ptr_(data) - , width_(width) - { - } - - CelSprite(CelSprite &&) noexcept = default; - CelSprite &operator=(CelSprite &&) noexcept = default; - - [[nodiscard]] const byte *Data() const - { - return data_ptr_; - } - - [[nodiscard]] int Width(std::size_t frame = 1) const - { - return widths_ == nullptr ? width_ : widths_[frame]; - } - -private: - std::unique_ptr data_; - const byte *data_ptr_; - int width_ = 0; - const int *widths_ = nullptr; // unowned -}; - -/** - * @brief Loads a Cel sprite and sets its width - */ -CelSprite LoadCel(const char *pszName, int width); -CelSprite LoadCel(const char *pszName, const int *widths); - /** * @brief Draw a horizontal line segment in the target buffer (left to right) * @param out Target buffer @@ -391,48 +333,6 @@ int32_t GetRndSeed(); uint32_t GetLCGEngineState(); int32_t GenerateRnd(int32_t v); -size_t GetFileSize(const char *pszName); -void LoadFileData(const char *pszName, byte *buffer, size_t bufferSize); - -template -void LoadFileInMem(const char *path, T *data, std::size_t count = 0) -{ - if (count == 0) - count = GetFileSize(path); - - LoadFileData(path, reinterpret_cast(data), count * sizeof(T)); -} - -template -void LoadFileInMem(const char *path, std::array &data) -{ - LoadFileInMem(path, &data, N); -} - -/** - * @brief Load a file in to a buffer - * @param path Path of file - * @param elements Number of T elements read - * @return Buffer with content of file - */ -template -std::unique_ptr LoadFileInMem(const char *path, size_t *elements = nullptr) -{ - const size_t fileLen = GetFileSize(path); - - if ((fileLen % sizeof(T)) != 0) - app_fatal("File size does not align with type\n%s", path); - - if (elements != nullptr) - *elements = fileLen / sizeof(T); - - std::unique_ptr buf { new T[fileLen / sizeof(T)] }; - - LoadFileData(path, reinterpret_cast(buf.get()), fileLen); - - return buf; -} - void PlayInGameMovie(const char *pszMovie); } // namespace devilution diff --git a/Source/engine/animationinfo.h b/Source/engine/animationinfo.h index 873b20cdb..e435b9052 100644 --- a/Source/engine/animationinfo.h +++ b/Source/engine/animationinfo.h @@ -8,7 +8,7 @@ #include #include -#include "engine.h" +#include "engine/cel_sprite.hpp" namespace devilution { diff --git a/Source/engine/cel_sprite.hpp b/Source/engine/cel_sprite.hpp new file mode 100644 index 000000000..96fa12a61 --- /dev/null +++ b/Source/engine/cel_sprite.hpp @@ -0,0 +1,62 @@ +#pragma once + +#include +#include + +#include "utils/stdcompat/cstddef.hpp" + +namespace devilution { + +/** + * Stores a CEL or CL2 sprite and its width(s). + * + * The data may be unowned. + * Eventually we'd like to remove the unowned version. + */ +class CelSprite { +public: + CelSprite(std::unique_ptr data, int width) + : data_(std::move(data)) + , data_ptr_(data_.get()) + , width_(width) + { + } + + CelSprite(std::unique_ptr data, const int *widths) + : data_(std::move(data)) + , data_ptr_(data_.get()) + , widths_(widths) + { + } + + /** + * Constructs an unowned sprite. + * Ideally we'd like to remove all uses of this constructor. + */ + CelSprite(const byte *data, int width) + : data_ptr_(data) + , width_(width) + { + } + + CelSprite(CelSprite &&) noexcept = default; + CelSprite &operator=(CelSprite &&) noexcept = default; + + [[nodiscard]] const byte *Data() const + { + return data_ptr_; + } + + [[nodiscard]] int Width(std::size_t frame = 1) const + { + return widths_ == nullptr ? width_ : widths_[frame]; + } + +private: + std::unique_ptr data_; + const byte *data_ptr_; + int width_ = 0; + const int *widths_ = nullptr; // unowned +}; + +} // namespace devilution diff --git a/Source/engine/load_cel.cpp b/Source/engine/load_cel.cpp new file mode 100644 index 000000000..93220eed6 --- /dev/null +++ b/Source/engine/load_cel.cpp @@ -0,0 +1,17 @@ +#include "engine/load_cel.hpp" + +#include "engine/load_file.hpp" + +namespace devilution { + +CelSprite LoadCel(const char *pszName, int width) +{ + return CelSprite(LoadFileInMem(pszName), width); +} + +CelSprite LoadCel(const char *pszName, const int *widths) +{ + return CelSprite(LoadFileInMem(pszName), widths); +} + +} // namespace devilution diff --git a/Source/engine/load_cel.hpp b/Source/engine/load_cel.hpp new file mode 100644 index 000000000..545ae2533 --- /dev/null +++ b/Source/engine/load_cel.hpp @@ -0,0 +1,13 @@ +#pragma once + +#include "engine/cel_sprite.hpp" + +namespace devilution { + +/** + * @brief Loads a Cel sprite and sets its width + */ +CelSprite LoadCel(const char *pszName, int width); +CelSprite LoadCel(const char *pszName, const int *widths); + +} // namespace devilution diff --git a/Source/engine/load_file.cpp b/Source/engine/load_file.cpp new file mode 100644 index 000000000..51aade796 --- /dev/null +++ b/Source/engine/load_file.cpp @@ -0,0 +1,38 @@ +#include "load_file.hpp" + +#include "diablo.h" +#include "storm/storm.h" + +namespace devilution { + +size_t GetFileSize(const char *pszName) +{ + HANDLE file; + if (!SFileOpenFile(pszName, &file)) { + if (!gbQuietMode) + app_fatal("GetFileSize - SFileOpenFile failed for file:\n%s", pszName); + return 0; + } + const size_t fileLen = SFileGetFileSize(file); + SFileCloseFileThreadSafe(file); + + return fileLen; +} + +void LoadFileData(const char *pszName, byte *buffer, size_t fileLen) +{ + HANDLE file; + if (!SFileOpenFile(pszName, &file)) { + if (!gbQuietMode) + app_fatal("LoadFileData - SFileOpenFile failed for file:\n%s", pszName); + return; + } + + if (fileLen == 0) + app_fatal("Zero length SFILE:\n%s", pszName); + + SFileReadFileThreadSafe(file, buffer, fileLen); + SFileCloseFileThreadSafe(file); +} + +} // namespace devilution diff --git a/Source/engine/load_file.hpp b/Source/engine/load_file.hpp new file mode 100644 index 000000000..084951c5d --- /dev/null +++ b/Source/engine/load_file.hpp @@ -0,0 +1,54 @@ +#pragma once + +#include +#include + +#include "appfat.h" +#include "utils/stdcompat/cstddef.hpp" + +namespace devilution { + +size_t GetFileSize(const char *pszName); + +void LoadFileData(const char *pszName, byte *buffer, size_t bufferSize); + +template +void LoadFileInMem(const char *path, T *data, std::size_t count = 0) +{ + if (count == 0) + count = GetFileSize(path); + + LoadFileData(path, reinterpret_cast(data), count * sizeof(T)); +} + +template +void LoadFileInMem(const char *path, std::array &data) +{ + LoadFileInMem(path, &data, N); +} + +/** + * @brief Load a file in to a buffer + * @param path Path of file + * @param elements Number of T elements read + * @return Buffer with content of file + */ +template +std::unique_ptr LoadFileInMem(const char *path, size_t *elements = nullptr) +{ + const size_t fileLen = GetFileSize(path); + + if ((fileLen % sizeof(T)) != 0) + app_fatal("File size does not align with type\n%s", path); + + if (elements != nullptr) + *elements = fileLen / sizeof(T); + + std::unique_ptr buf { new T[fileLen / sizeof(T)] }; + + LoadFileData(path, reinterpret_cast(buf.get()), fileLen); + + return buf; +} + +} // namespace devilution diff --git a/Source/engine/render/cel_render.hpp b/Source/engine/render/cel_render.hpp index fe699e6d2..487782979 100644 --- a/Source/engine/render/cel_render.hpp +++ b/Source/engine/render/cel_render.hpp @@ -8,6 +8,7 @@ #include #include "engine.h" +#include "engine/cel_sprite.hpp" #include "engine/point.hpp" namespace devilution { diff --git a/Source/engine/render/cl2_render.hpp b/Source/engine/render/cl2_render.hpp index 086613e4b..7c3c6b981 100644 --- a/Source/engine/render/cl2_render.hpp +++ b/Source/engine/render/cl2_render.hpp @@ -9,6 +9,7 @@ #include #include "engine.h" +#include "engine/cel_sprite.hpp" #include "engine/point.hpp" namespace devilution { diff --git a/Source/engine/render/text_render.cpp b/Source/engine/render/text_render.cpp index 30e8d23e4..39fc182fb 100644 --- a/Source/engine/render/text_render.cpp +++ b/Source/engine/render/text_render.cpp @@ -8,6 +8,7 @@ #include "DiabloUI/ui_item.h" #include "cel_render.hpp" #include "engine.h" +#include "engine/load_cel.hpp" #include "engine/point.hpp" #include "palette.h" diff --git a/Source/engine/render/text_render.hpp b/Source/engine/render/text_render.hpp index 5d10f2b3f..325d6d830 100644 --- a/Source/engine/render/text_render.hpp +++ b/Source/engine/render/text_render.hpp @@ -11,6 +11,7 @@ #include "DiabloUI/ui_item.h" #include "engine.h" +#include "engine/cel_sprite.hpp" #include "utils/stdcompat/optional.hpp" namespace devilution { diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 9e80f3036..4bbea7cd0 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -3,7 +3,9 @@ * * Implementation of general dungeon generation code. */ +#include "gendung.h" +#include "engine/load_file.hpp" #include "init.h" #include "options.h" diff --git a/Source/gendung.h b/Source/gendung.h index 5b4a7aa4d..51067e109 100644 --- a/Source/gendung.h +++ b/Source/gendung.h @@ -9,6 +9,7 @@ #include #include "engine.h" +#include "engine/cel_sprite.hpp" #include "engine/point.hpp" #include "scrollrt.h" #include "utils/stdcompat/optional.hpp" diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index 675da8751..542f8d5d5 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -9,6 +9,8 @@ #include "controls/axis_direction.h" #include "controls/controller_motion.h" #include "engine.h" +#include "engine/cel_sprite.hpp" +#include "engine/load_cel.hpp" #include "engine/render/cel_render.hpp" #include "engine/render/text_render.hpp" #include "stores.h" diff --git a/Source/interfac.cpp b/Source/interfac.cpp index 448927fe7..08a985935 100644 --- a/Source/interfac.cpp +++ b/Source/interfac.cpp @@ -10,6 +10,8 @@ #include "control.h" #include "dx.h" #include "engine.h" +#include "engine/cel_sprite.hpp" +#include "engine/load_cel.hpp" #include "engine/render/cel_render.hpp" #include "hwcursor.hpp" #include "init.h" diff --git a/Source/inv.cpp b/Source/inv.cpp index 758841414..42565cc21 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -9,6 +9,8 @@ #include #include "cursor.h" +#include "engine/cel_sprite.hpp" +#include "engine/load_cel.hpp" #include "engine/render/cel_render.hpp" #include "engine/render/text_render.hpp" #include "engine/size.hpp" diff --git a/Source/items.cpp b/Source/items.cpp index db711975e..84643b16c 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -14,6 +14,8 @@ #include "cursor.h" #include "doom.h" #include "dx.h" +#include "engine/cel_sprite.hpp" +#include "engine/load_cel.hpp" #include "engine/render/cel_render.hpp" #include "engine/render/text_render.hpp" #include "init.h" diff --git a/Source/lighting.cpp b/Source/lighting.cpp index da6f1ad02..d6d21d225 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -7,6 +7,7 @@ #include "automap.h" #include "diablo.h" +#include "engine/load_file.hpp" #include "player.h" namespace devilution { diff --git a/Source/minitext.cpp b/Source/minitext.cpp index 9944a0e05..d406562f3 100644 --- a/Source/minitext.cpp +++ b/Source/minitext.cpp @@ -9,6 +9,8 @@ #include "control.h" #include "dx.h" #include "engine.h" +#include "engine/cel_sprite.hpp" +#include "engine/load_cel.hpp" #include "engine/render/cel_render.hpp" #include "engine/render/text_render.hpp" #include "textdat.h" diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 60e581c73..214d29cf8 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -10,6 +10,7 @@ #include "control.h" #include "cursor.h" #include "dead.h" +#include "engine/load_file.hpp" #include "init.h" #include "inv.h" #include "lighting.h" diff --git a/Source/monster.cpp b/Source/monster.cpp index cfe398c4c..0cb796901 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -16,6 +16,7 @@ #include "dead.h" #include "drlg_l1.h" #include "drlg_l4.h" +#include "engine/load_file.hpp" #include "engine/render/cl2_render.hpp" #include "init.h" #include "lighting.h" diff --git a/Source/monster.h b/Source/monster.h index e1c5e9e41..3368c70d5 100644 --- a/Source/monster.h +++ b/Source/monster.h @@ -10,6 +10,7 @@ #include "engine.h" #include "engine/actor_position.hpp" +#include "engine/cel_sprite.hpp" #include "engine/point.hpp" #include "miniwin/miniwin.h" #include "utils/stdcompat/optional.hpp" diff --git a/Source/objects.cpp b/Source/objects.cpp index ad41c8e69..4986a51d9 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -12,6 +12,7 @@ #include "cursor.h" #include "drlg_l1.h" #include "drlg_l4.h" +#include "engine/load_file.hpp" #include "error.h" #include "init.h" #include "lighting.h" diff --git a/Source/palette.cpp b/Source/palette.cpp index 7ce116d84..346db48b9 100644 --- a/Source/palette.cpp +++ b/Source/palette.cpp @@ -5,9 +5,9 @@ */ #include "dx.h" +#include "engine/load_file.hpp" #include "hwcursor.hpp" #include "options.h" -#include "storm/storm.h" #include "utils/display.h" #include "utils/sdl_compat.h" diff --git a/Source/player.cpp b/Source/player.cpp index 99913d00b..7691aa8c6 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -9,6 +9,7 @@ #include "control.h" #include "cursor.h" #include "dead.h" +#include "engine/load_file.hpp" #include "gamemenu.h" #include "init.h" #include "lighting.h" diff --git a/Source/player.h b/Source/player.h index 3a828a44b..0a6d680cc 100644 --- a/Source/player.h +++ b/Source/player.h @@ -11,15 +11,16 @@ #include "diablo.h" #include "engine.h" #include "engine/actor_position.hpp" +#include "engine/animationinfo.h" +#include "engine/cel_sprite.hpp" #include "engine/point.hpp" #include "gendung.h" +#include "interfac.h" #include "items.h" #include "multi.h" -#include "spelldat.h" #include "path.h" -#include "interfac.h" +#include "spelldat.h" #include "utils/enum_traits.h" -#include "engine/animationinfo.h" namespace devilution { diff --git a/Source/quests.cpp b/Source/quests.cpp index fcbbe39f5..5ef4461e8 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -3,11 +3,13 @@ * * Implementation of functionality for handling quests. */ +#include "quests.h" #include #include "control.h" #include "cursor.h" +#include "engine/load_file.hpp" #include "engine/render/cel_render.hpp" #include "engine/render/text_render.hpp" #include "gendung.h" diff --git a/Source/quests.h b/Source/quests.h index 55a05be46..10e714267 100644 --- a/Source/quests.h +++ b/Source/quests.h @@ -8,6 +8,7 @@ #include #include "engine.h" +#include "engine/cel_sprite.hpp" #include "engine/point.hpp" #include "gendung.h" #include "textdat.h" diff --git a/Source/setmaps.cpp b/Source/setmaps.cpp index 1ac22904c..0dfce0299 100644 --- a/Source/setmaps.cpp +++ b/Source/setmaps.cpp @@ -8,6 +8,7 @@ #include "drlg_l1.h" #include "drlg_l2.h" #include "drlg_l3.h" +#include "engine/load_file.hpp" #include "objdat.h" #include "objects.h" #include "palette.h" diff --git a/Source/stores.cpp b/Source/stores.cpp index e5b2ea2c1..b7aea56ef 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -10,6 +10,7 @@ #include #include "cursor.h" +#include "engine/load_cel.hpp" #include "engine/render/cel_render.hpp" #include "engine/render/text_render.hpp" #include "init.h" diff --git a/Source/stores.h b/Source/stores.h index e15cc21cf..3a0ce65ad 100644 --- a/Source/stores.h +++ b/Source/stores.h @@ -7,6 +7,7 @@ #include "control.h" #include "engine.h" +#include "engine/cel_sprite.hpp" #include "utils/stdcompat/optional.hpp" namespace devilution { diff --git a/Source/town.cpp b/Source/town.cpp index cbebd6c2f..ea6b7b7cb 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -6,6 +6,7 @@ #include "town.h" #include "drlg_l1.h" +#include "engine/load_file.hpp" #include "init.h" #include "player.h" #include "quests.h" diff --git a/Source/towners.cpp b/Source/towners.cpp index 49feea0a7..7d82e0494 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -1,6 +1,7 @@ #include "towners.h" #include "cursor.h" +#include "engine/load_file.hpp" #include "inv.h" #include "minitext.h" #include "stores.h"