diff --git a/CMakeLists.txt b/CMakeLists.txt index 37e27c3ad..d012e5f3c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -447,7 +447,7 @@ if(GPERF) find_package(Gperftools REQUIRED) endif() -target_include_directories(devilution PUBLIC Source SourceS ${CMAKE_CURRENT_BINARY_DIR}) +target_include_directories(devilution PUBLIC Source SourceS SourceX ${CMAKE_CURRENT_BINARY_DIR}) target_include_directories(${BIN_TARGET} PRIVATE SourceS SourceX diff --git a/DiabloUI/diabloui.h b/DiabloUI/diabloui.h deleted file mode 100644 index 28f369a47..000000000 --- a/DiabloUI/diabloui.h +++ /dev/null @@ -1,72 +0,0 @@ -//HEADER_GOES_HERE -#pragma once - -#include - -namespace devilution { - -enum _mainmenu_selections : uint8_t { - MAINMENU_NONE, - MAINMENU_SINGLE_PLAYER, - MAINMENU_MULTIPLAYER, - MAINMENU_REPLAY_INTRO, - MAINMENU_SHOW_SUPPORT, - MAINMENU_SHOW_CREDITS, - MAINMENU_EXIT_DIABLO, - MAINMENU_ATTRACT_MODE, -}; - -enum _selhero_selections : uint8_t { - SELHERO_NEW_DUNGEON, - SELHERO_CONTINUE, - SELHERO_CONNECT, - SELHERO_PREVIOUS, -}; - -struct _uidefaultstats { - Uint16 strength; - Uint16 magic; - Uint16 dexterity; - Uint16 vitality; -}; - -struct _uiheroinfo { - struct _uiheroinfo *next; - char name[16]; - Uint16 level; - HeroClass heroclass; - Uint8 herorank; - Uint16 strength; - Uint16 magic; - Uint16 dexterity; - Uint16 vitality; - Sint32 gold; - Sint32 hassaved; - bool spawned; -}; - -void UiDestroy(); -void UiTitleDialog(); -void UiSetSpawned(bool bSpawned); -void UiInitialize(); -bool UiValidPlayerName(const char *name); /* check */ -void UiSelHeroMultDialog(bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)), bool (*fncreate)(_uiheroinfo *), bool (*fnremove)(_uiheroinfo *), void (*fnstats)(unsigned int, _uidefaultstats *), _selhero_selections *dlgresult, char (*name)[16]); -void UiSelHeroSingDialog(bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)), bool (*fncreate)(_uiheroinfo *), bool (*fnremove)(_uiheroinfo *), void (*fnstats)(unsigned int, _uidefaultstats *), _selhero_selections *dlgresult, char (*name)[16], _difficulty *difficulty); -bool UiCreditsDialog(); -bool UiSupportDialog(); -bool UiMainMenuDialog(const char *name, _mainmenu_selections *pdwResult, void (*fnSound)(const char *file), int attractTimeOut); -bool UiProgressDialog(const char *msg, int (*fnfunc)(), int rate); -void UiProfileCallback(); -void UiProfileDraw(); -bool UiCategoryCallback(int a1, int a2, int a3, int a4, int a5, DWORD *a6, DWORD *a7); -bool UiGetDataCallback(int game_type, int data_code, void *a3, int a4, int a5); -bool UiAuthCallback(int a1, char *a2, char *a3, char a4, char *a5, char *lpBuffer, int cchBufferMax); -bool UiSoundCallback(int a1, int type, int a3); -bool UiDrawDescCallback(int game_type, DWORD color, const char *lpString, char *a4, int a5, UINT align, time_t a7, HDC *a8); -bool UiCreateGameCallback(int a1, int a2, int a3, int a4, int a5, int a6); -bool UiArtCallback(int game_type, unsigned int art_code, SDL_Color *pPalette, BYTE *pBuffer, DWORD dwBuffersize, DWORD *pdwWidth, DWORD *pdwHeight, DWORD *pdwBpp); -int UiSelectGame(GameData *gameData, int *playerId); -int UiSelectProvider(GameData *gameData); -void UiSetupPlayerInfo(char *infostr, _uiheroinfo *pInfo, Uint32 type); - -} // namespace devilution diff --git a/Source/appfat.cpp b/Source/appfat.cpp index dfa74a265..0253507c4 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -4,7 +4,7 @@ * Implementation of error dialogs. */ #include "all.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" #include namespace devilution { diff --git a/Source/appfat.h b/Source/appfat.h index 513fc67e5..b1d99e24c 100644 --- a/Source/appfat.h +++ b/Source/appfat.h @@ -7,6 +7,8 @@ #include +#include "miniwin.h" + namespace devilution { #define ErrSdl() ErrDlg("SDL Error", SDL_GetError(), __FILE__, __LINE__) diff --git a/Source/capture.cpp b/Source/capture.cpp index 16f89c308..150ac36d6 100644 --- a/Source/capture.cpp +++ b/Source/capture.cpp @@ -6,7 +6,7 @@ #include #include "all.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" #include "paths.h" #include "file_util.h" diff --git a/Source/diablo.cpp b/Source/diablo.cpp index e12805b96..dc9c9ebb7 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -9,8 +9,8 @@ #include "options.h" #include "multi.h" #include "sound.h" -#include "../3rdParty/Storm/Source/storm.h" -#include "../DiabloUI/diabloui.h" +#include "storm/storm.h" +#include "DiabloUI/diabloui.h" #include namespace devilution { diff --git a/Source/dthread.cpp b/Source/dthread.cpp index 2acdb9313..f5c0561b0 100644 --- a/Source/dthread.cpp +++ b/Source/dthread.cpp @@ -4,7 +4,7 @@ * Implementation of functions for updating game state from network commands. */ #include "all.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" namespace devilution { diff --git a/Source/dx.cpp b/Source/dx.cpp index 2adfcd153..d007da8e5 100644 --- a/Source/dx.cpp +++ b/Source/dx.cpp @@ -4,7 +4,7 @@ * Implementation of functions setting up the graphics pipeline. */ #include "all.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" #include "../SourceX/display.h" #include "options.h" #include diff --git a/Source/engine.cpp b/Source/engine.cpp index 13c44348a..5ad99fdcf 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -12,7 +12,7 @@ */ #include "all.h" #include "options.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" namespace devilution { diff --git a/Source/init.cpp b/Source/init.cpp index c6c21e5a7..2a302238b 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -8,8 +8,8 @@ #include "all.h" #include "paths.h" -#include "../3rdParty/Storm/Source/storm.h" -#include "../DiabloUI/diabloui.h" +#include "storm/storm.h" +#include "DiabloUI/diabloui.h" #include #include diff --git a/Source/itemdat.h b/Source/itemdat.h index bd567389a..1bb52e260 100644 --- a/Source/itemdat.h +++ b/Source/itemdat.h @@ -8,6 +8,8 @@ #include #include +#include "spelldat.h" + namespace devilution { /** @todo add missing values and apply */ diff --git a/Source/mainmenu.cpp b/Source/mainmenu.cpp index a01aa4609..c45ce29a9 100644 --- a/Source/mainmenu.cpp +++ b/Source/mainmenu.cpp @@ -5,8 +5,8 @@ */ #include "all.h" #include "options.h" -#include "../3rdParty/Storm/Source/storm.h" -#include "../DiabloUI/diabloui.h" +#include "storm/storm.h" +#include "DiabloUI/diabloui.h" namespace devilution { diff --git a/Source/monster.cpp b/Source/monster.cpp index a38b416a2..ce58b8e43 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -7,7 +7,7 @@ #include "all.h" #include "options.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" namespace devilution { diff --git a/Source/movie.cpp b/Source/movie.cpp index 1c26404c9..02a00f345 100644 --- a/Source/movie.cpp +++ b/Source/movie.cpp @@ -4,7 +4,7 @@ * Implementation of video playback. */ #include "all.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" #include "../SourceX/display.h" namespace devilution { diff --git a/Source/msg.cpp b/Source/msg.cpp index 28ca8b2b2..8d13fce21 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -4,8 +4,8 @@ * Implementation of function for sending and reciving network messages. */ #include "all.h" -#include "../3rdParty/Storm/Source/storm.h" -#include "../DiabloUI/diabloui.h" +#include "storm/storm.h" +#include "DiabloUI/diabloui.h" #include "objects.h" #include "options.h" diff --git a/Source/msg.h b/Source/msg.h index 55447a862..640eed567 100644 --- a/Source/msg.h +++ b/Source/msg.h @@ -11,6 +11,7 @@ #include "objects.h" #include "monster.h" #include "portal.h" +#include "items.h" namespace devilution { diff --git a/Source/multi.cpp b/Source/multi.cpp index 26e0eba17..0e722f263 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -6,8 +6,8 @@ #include "all.h" #include "diablo.h" #include "options.h" -#include "../3rdParty/Storm/Source/storm.h" -#include "../DiabloUI/diabloui.h" +#include "storm/storm.h" +#include "DiabloUI/diabloui.h" #include namespace devilution { diff --git a/Source/nthread.cpp b/Source/nthread.cpp index b55e356d4..b552f274b 100644 --- a/Source/nthread.cpp +++ b/Source/nthread.cpp @@ -4,7 +4,7 @@ * Implementation of functions for managing game ticks. */ #include "all.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" namespace devilution { diff --git a/Source/objects.h b/Source/objects.h index c5848fa2f..db3b14f66 100644 --- a/Source/objects.h +++ b/Source/objects.h @@ -7,6 +7,7 @@ #include "objdat.h" #include "textdat.h" +#include "itemdat.h" namespace devilution { diff --git a/Source/options.h b/Source/options.h index 6a68527ce..97faf8a9b 100644 --- a/Source/options.h +++ b/Source/options.h @@ -1,5 +1,7 @@ #pragma once +#include "pack.h" + namespace devilution { struct DiabloOptions { diff --git a/Source/palette.cpp b/Source/palette.cpp index f955fd539..0d13d9967 100644 --- a/Source/palette.cpp +++ b/Source/palette.cpp @@ -6,7 +6,7 @@ #include "all.h" #include "options.h" #include "../SourceX/display.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" namespace devilution { diff --git a/Source/pfile.cpp b/Source/pfile.cpp index 709996dc4..053b0e153 100644 --- a/Source/pfile.cpp +++ b/Source/pfile.cpp @@ -7,7 +7,7 @@ #include "all.h" #include "paths.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" #include "file_util.h" namespace devilution { diff --git a/Source/pfile.h b/Source/pfile.h index 78af9f12b..de74f38f8 100644 --- a/Source/pfile.h +++ b/Source/pfile.h @@ -6,7 +6,7 @@ #pragma once #include "player.h" -#include "../DiabloUI/diabloui.h" +#include "DiabloUI/diabloui.h" namespace devilution { diff --git a/Source/player.cpp b/Source/player.cpp index 71916f460..05d4d84b9 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -7,7 +7,7 @@ #include "all.h" #include "options.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" namespace devilution { diff --git a/Source/scrollrt.h b/Source/scrollrt.h index d6fbf7e96..7f7048503 100644 --- a/Source/scrollrt.h +++ b/Source/scrollrt.h @@ -7,6 +7,9 @@ #include +#include "engine.h" +#include "miniwin.h" + namespace devilution { #define PANELS_COVER (gnScreenWidth <= PANEL_WIDTH && gnScreenHeight <= SPANEL_HEIGHT + PANEL_HEIGHT) diff --git a/Source/sound.cpp b/Source/sound.cpp index 4e0f381f7..9bf586d72 100644 --- a/Source/sound.cpp +++ b/Source/sound.cpp @@ -5,7 +5,7 @@ */ #include "all.h" #include "options.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" #include "../SourceX/stubs.h" #include "../SourceX/storm_sdl_rw.h" #include diff --git a/Source/textdat.h b/Source/textdat.h index dab7584f4..0908d4fb4 100644 --- a/Source/textdat.h +++ b/Source/textdat.h @@ -5,6 +5,8 @@ */ #pragma once +#include "effects.h" + namespace devilution { enum _speech_id : int16_t { diff --git a/SourceX/DiabloUI/art.cpp b/SourceX/DiabloUI/art.cpp index 97760f52f..829c94e5a 100644 --- a/SourceX/DiabloUI/art.cpp +++ b/SourceX/DiabloUI/art.cpp @@ -1,6 +1,7 @@ #include "DiabloUI/art.h" #include "display.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" +#include "sdl_compat.h" namespace devilution { diff --git a/SourceX/DiabloUI/art.h b/SourceX/DiabloUI/art.h index 67cdb0330..b9d0ac369 100644 --- a/SourceX/DiabloUI/art.h +++ b/SourceX/DiabloUI/art.h @@ -1,8 +1,7 @@ #pragma once -#include "all.h" #include "../sdl_ptrs.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" namespace devilution { diff --git a/SourceX/DiabloUI/diabloui.cpp b/SourceX/DiabloUI/diabloui.cpp index 5fd825c50..c50e0e41c 100644 --- a/SourceX/DiabloUI/diabloui.cpp +++ b/SourceX/DiabloUI/diabloui.cpp @@ -3,7 +3,7 @@ #include #include -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" #include "controls/controller.h" #include "controls/menu_controls.h" diff --git a/SourceX/DiabloUI/diabloui.h b/SourceX/DiabloUI/diabloui.h index 5c226dd37..25abb5d58 100644 --- a/SourceX/DiabloUI/diabloui.h +++ b/SourceX/DiabloUI/diabloui.h @@ -8,6 +8,7 @@ #include "DiabloUI/art.h" #include "DiabloUI/ui_item.h" #include "display.h" +#include "player.h" namespace devilution { @@ -26,6 +27,46 @@ enum _artLogo : uint8_t { LOGO_BIG, }; +enum _mainmenu_selections : uint8_t { + MAINMENU_NONE, + MAINMENU_SINGLE_PLAYER, + MAINMENU_MULTIPLAYER, + MAINMENU_REPLAY_INTRO, + MAINMENU_SHOW_SUPPORT, + MAINMENU_SHOW_CREDITS, + MAINMENU_EXIT_DIABLO, + MAINMENU_ATTRACT_MODE, +}; + +enum _selhero_selections : uint8_t { + SELHERO_NEW_DUNGEON, + SELHERO_CONTINUE, + SELHERO_CONNECT, + SELHERO_PREVIOUS, +}; + +struct _uidefaultstats { + Uint16 strength; + Uint16 magic; + Uint16 dexterity; + Uint16 vitality; +}; + +struct _uiheroinfo { + struct _uiheroinfo *next; + char name[16]; + Uint16 level; + HeroClass heroclass; + Uint8 herorank; + Uint16 strength; + Uint16 magic; + Uint16 dexterity; + Uint16 vitality; + Sint32 gold; + Sint32 hassaved; + bool spawned; +}; + extern std::array ArtLogos; extern std::array ArtFocus; extern Art ArtBackground; @@ -42,6 +83,29 @@ inline SDL_Surface *DiabloUiSurface() return GetOutputSurface(); } +void UiDestroy(); +void UiTitleDialog(); +void UiSetSpawned(bool bSpawned); +void UiInitialize(); +bool UiValidPlayerName(const char *name); /* check */ +void UiSelHeroMultDialog(bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)), bool (*fncreate)(_uiheroinfo *), bool (*fnremove)(_uiheroinfo *), void (*fnstats)(unsigned int, _uidefaultstats *), _selhero_selections *dlgresult, char (*name)[16]); +void UiSelHeroSingDialog(bool (*fninfo)(bool (*fninfofunc)(_uiheroinfo *)), bool (*fncreate)(_uiheroinfo *), bool (*fnremove)(_uiheroinfo *), void (*fnstats)(unsigned int, _uidefaultstats *), _selhero_selections *dlgresult, char (*name)[16], _difficulty *difficulty); +bool UiCreditsDialog(); +bool UiSupportDialog(); +bool UiMainMenuDialog(const char *name, _mainmenu_selections *pdwResult, void (*fnSound)(const char *file), int attractTimeOut); +bool UiProgressDialog(const char *msg, int (*fnfunc)(), int rate); +void UiProfileCallback(); +void UiProfileDraw(); +bool UiCategoryCallback(int a1, int a2, int a3, int a4, int a5, DWORD *a6, DWORD *a7); +bool UiGetDataCallback(int game_type, int data_code, void *a3, int a4, int a5); +bool UiAuthCallback(int a1, char *a2, char *a3, char a4, char *a5, char *lpBuffer, int cchBufferMax); +bool UiSoundCallback(int a1, int type, int a3); +bool UiDrawDescCallback(int game_type, DWORD color, const char *lpString, char *a4, int a5, UINT align, time_t a7, HDC *a8); +bool UiCreateGameCallback(int a1, int a2, int a3, int a4, int a5, int a6); +bool UiArtCallback(int game_type, unsigned int art_code, SDL_Color *pPalette, BYTE *pBuffer, DWORD dwBuffersize, DWORD *pdwWidth, DWORD *pdwHeight, DWORD *pdwBpp); +int UiSelectGame(GameData *gameData, int *playerId); +int UiSelectProvider(GameData *gameData); +void UiSetupPlayerInfo(char *infostr, _uiheroinfo *pInfo, Uint32 type); void UiFadeIn(); void UiHandleEvents(SDL_Event *event); bool UiItemMouseEvents(SDL_Event *event, std::vector items); diff --git a/SourceX/DiabloUI/selconn.cpp b/SourceX/DiabloUI/selconn.cpp index 2b213f261..3bbf2c00a 100644 --- a/SourceX/DiabloUI/selconn.cpp +++ b/SourceX/DiabloUI/selconn.cpp @@ -3,7 +3,7 @@ #include "all.h" #include "DiabloUI/diabloui.h" #include "DiabloUI/text.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" namespace devilution { diff --git a/SourceX/DiabloUI/selgame.cpp b/SourceX/DiabloUI/selgame.cpp index c8c7dd850..bbb5b4b4c 100644 --- a/SourceX/DiabloUI/selgame.cpp +++ b/SourceX/DiabloUI/selgame.cpp @@ -1,7 +1,7 @@ #include "selgame.h" #include "all.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" #include "config.h" #include "DiabloUI/diabloui.h" #include "DiabloUI/text.h" diff --git a/SourceX/DiabloUI/selhero.cpp b/SourceX/DiabloUI/selhero.cpp index d6426a82e..985e59655 100644 --- a/SourceX/DiabloUI/selhero.cpp +++ b/SourceX/DiabloUI/selhero.cpp @@ -5,7 +5,6 @@ #include #include "DiabloUI/diabloui.h" -#include "../../DiabloUI/diabloui.h" #include "all.h" #include "DiabloUI/dialogs.h" #include "DiabloUI/scrollbar.h" diff --git a/SourceX/DiabloUI/ui_item.h b/SourceX/DiabloUI/ui_item.h index a3426c1bd..b89350eb0 100644 --- a/SourceX/DiabloUI/ui_item.h +++ b/SourceX/DiabloUI/ui_item.h @@ -5,7 +5,6 @@ #include #include -#include "all.h" #include "stubs.h" #include "DiabloUI/art.h" diff --git a/SourceX/controls/game_controls.h b/SourceX/controls/game_controls.h index 827bbcf90..dcdf675b2 100644 --- a/SourceX/controls/game_controls.h +++ b/SourceX/controls/game_controls.h @@ -4,8 +4,8 @@ #include #include +#include "controls/controller.h" #include "./axis_direction.h" -#include "./controller.h" namespace devilution { diff --git a/SourceX/controls/touch.cpp b/SourceX/controls/touch.cpp index c7ae5a822..f508a8e0e 100644 --- a/SourceX/controls/touch.cpp +++ b/SourceX/controls/touch.cpp @@ -2,6 +2,7 @@ #include "display.h" #include "options.h" #include "touch.h" +#include "ui_fwd.h" #include static int visible_width; diff --git a/SourceX/display.h b/SourceX/display.h index ec5d716a0..88e1a74c3 100644 --- a/SourceX/display.h +++ b/SourceX/display.h @@ -2,10 +2,15 @@ #include -#include "all.h" #include "sdl_ptrs.h" #include +#ifdef USE_SDL1 +#include "sdl2_to_1_2_backports.h" +#else +#include "sdl2_backports.h" +#endif + #include namespace devilution { diff --git a/SourceX/dvlnet/abstract_net.cpp b/SourceX/dvlnet/abstract_net.cpp index e306d4bf5..c9258c26a 100644 --- a/SourceX/dvlnet/abstract_net.cpp +++ b/SourceX/dvlnet/abstract_net.cpp @@ -8,7 +8,7 @@ #include "dvlnet/protocol_zt.h" #endif #include "dvlnet/loopback.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" namespace devilution { namespace net { diff --git a/SourceX/dvlnet/abstract_net.h b/SourceX/dvlnet/abstract_net.h index 8035892c5..c83bf4334 100644 --- a/SourceX/dvlnet/abstract_net.h +++ b/SourceX/dvlnet/abstract_net.h @@ -6,7 +6,7 @@ #include #include "all.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" namespace devilution { namespace net { diff --git a/SourceX/storm/storm.cpp b/SourceX/storm/storm.cpp index d17abebd3..dba6b05ef 100644 --- a/SourceX/storm/storm.cpp +++ b/SourceX/storm/storm.cpp @@ -5,7 +5,7 @@ #include "all.h" #include "options.h" #include "paths.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" #if !SDL_VERSION_ATLEAST(2, 0, 4) #include diff --git a/3rdParty/Storm/Source/storm.h b/SourceX/storm/storm.h similarity index 96% rename from 3rdParty/Storm/Source/storm.h rename to SourceX/storm/storm.h index 965fdb250..5e223b488 100644 --- a/3rdParty/Storm/Source/storm.h +++ b/SourceX/storm/storm.h @@ -3,6 +3,10 @@ #include #include #include + +#include "appfat.h" +#include "multi.h" + namespace devilution { enum game_info : uint8_t { diff --git a/SourceX/storm_sdl_rw.cpp b/SourceX/storm_sdl_rw.cpp index c14a53e1c..e83471dd6 100644 --- a/SourceX/storm_sdl_rw.cpp +++ b/SourceX/storm_sdl_rw.cpp @@ -4,7 +4,7 @@ #include #include "all.h" -#include "../3rdParty/Storm/Source/storm.h" +#include "storm/storm.h" #include "../Source/engine.h" namespace devilution {