Browse Source

🚚 Move all enums to there respective headers

pull/1458/head
Anders Jenbo 5 years ago
parent
commit
e7ae8ddd04
  1. 9
      3rdParty/Storm/Source/storm.h
  2. 2
      DiabloUI/diabloui.h
  3. 8
      Source/automap.h
  4. 8
      Source/capture.h
  5. 8
      Source/codec.h
  6. 23
      Source/control.cpp
  7. 18
      Source/control.h
  8. 4
      Source/cursor.h
  9. 12
      Source/dead.h
  10. 8
      Source/debug.h
  11. 2
      Source/diablo.cpp
  12. 8
      Source/doom.h
  13. 8
      Source/drlg_l1.h
  14. 16
      Source/drlg_l2.h
  15. 8
      Source/drlg_l3.h
  16. 8
      Source/drlg_l4.h
  17. 9
      Source/dthread.h
  18. 12
      Source/encrypt.h
  19. 3
      Source/engine.h
  20. 8
      Source/gamemenu.h
  21. 2
      Source/gendung.cpp
  22. 11
      Source/gendung.h
  23. 12
      Source/gmenu.h
  24. 8
      Source/help.h
  25. 8
      Source/init.h
  26. 27
      Source/interfac.h
  27. 49
      Source/inv.h
  28. 18
      Source/itemdat.h
  29. 4
      Source/items.cpp
  30. 4
      Source/items.h
  31. 12
      Source/lighting.h
  32. 6
      Source/loadsave.cpp
  33. 8
      Source/loadsave.h
  34. 8
      Source/mainmenu.h
  35. 8
      Source/minitext.h
  36. 36
      Source/monstdat.h
  37. 8
      Source/movie.h
  38. 20
      Source/mpqapi.h
  39. 2
      Source/msg.cpp
  40. 18
      Source/multi.h
  41. 8
      Source/nthread.h
  42. 6
      Source/objdat.h
  43. 17
      Source/pack.h
  44. 8
      Source/palette.h
  45. 11
      Source/path.h
  46. 8
      Source/pfile.h
  47. 15
      Source/player.cpp
  48. 44
      Source/player.h
  49. 12
      Source/plrmsg.h
  50. 2
      Source/portal.cpp
  51. 12
      Source/portal.h
  52. 50
      Source/quests.cpp
  53. 7
      Source/quests.h
  54. 8
      Source/render.h
  55. 8
      Source/restrict.h
  56. 2
      Source/scrollrt.h
  57. 8
      Source/setmaps.h
  58. 12
      Source/sha.h
  59. 2
      Source/sound.h
  60. 6
      Source/spelldat.h
  61. 18
      Source/stores.h
  62. 8
      Source/sync.h
  63. 20
      Source/tmsg.h
  64. 8
      Source/town.h
  65. 1
      Source/towners.h
  66. 8
      Source/track.h
  67. 14
      Source/trigs.h
  68. 2
      SourceS/console.h
  69. 2
      SourceS/file_util.h
  70. 2
      SourceS/miniwin/misc.h
  71. 2
      SourceS/paths.h
  72. 12
      SourceS/sdl2_to_1_2_backports.h
  73. 2
      SourceS/soundsample.h
  74. 5
      SourceS/storm_full.h
  75. 2
      SourceS/thread.h
  76. 2
      SourceS/ui_fwd.h
  77. 2
      SourceX/DiabloUI/art.h
  78. 2
      SourceX/DiabloUI/art_draw.h
  79. 2
      SourceX/DiabloUI/button.h
  80. 2
      SourceX/DiabloUI/credits_lines.h
  81. 11
      SourceX/DiabloUI/diabloui.h
  82. 2
      SourceX/DiabloUI/dialogs.h
  83. 2
      SourceX/DiabloUI/errorart.h
  84. 7
      SourceX/DiabloUI/fonts.h
  85. 6
      SourceX/DiabloUI/scrollbar.h
  86. 2
      SourceX/DiabloUI/selconn.h
  87. 2
      SourceX/DiabloUI/selgame.h
  88. 2
      SourceX/DiabloUI/selhero.h
  89. 2
      SourceX/DiabloUI/selok.h
  90. 2
      SourceX/DiabloUI/selyesno.h
  91. 2
      SourceX/DiabloUI/support_lines.h
  92. 2
      SourceX/DiabloUI/text.h
  93. 2
      SourceX/DiabloUI/text_draw.h
  94. 5
      SourceX/DiabloUI/ttf_render_wrapped.h
  95. 8
      SourceX/DiabloUI/ui_item.h
  96. 8
      SourceX/controls/axis_direction.h
  97. 2
      SourceX/controls/controller.h
  98. 6
      SourceX/controls/controller_buttons.h
  99. 2
      SourceX/controls/controller_motion.h
  100. 2
      SourceX/controls/devices/game_controller.h
  101. Some files were not shown because too many files have changed in this diff Show More

9
3rdParty/Storm/Source/storm.h vendored

@ -5,7 +5,12 @@
#include <string>
namespace devilution {
enum conn_type {
enum game_info : uint8_t {
GAMEINFO_NAME,
GAMEINFO_PASSWORD,
};
enum conn_type : uint8_t {
SELCONN_ZT,
SELCONN_TCP,
SELCONN_LOOPBACK,
@ -134,7 +139,7 @@ bool SNetDropPlayer(int playerid, DWORD flags);
*
* Returns true if the function was called successfully and false otherwise.
*/
bool SNetGetGameInfo(int type, void *dst, unsigned int length);
bool SNetGetGameInfo(game_info type, void *dst, unsigned int length);
/* SNetGetTurnsInTransit @ 115
*

2
DiabloUI/diabloui.h

@ -1,6 +1,8 @@
//HEADER_GOES_HERE
#pragma once
#include <stdint.h>
namespace devilution {
enum _mainmenu_selections : uint8_t {

8
Source/automap.h

@ -9,10 +9,6 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
/** Specifies whether the automap is enabled. */
extern bool automapflag;
/** Tracks the explored areas of the map. */
@ -87,8 +83,4 @@ void SetAutomapView(Sint32 x, Sint32 y);
*/
void AutomapZoomReset();
#ifdef __cplusplus
}
#endif
}

8
Source/capture.h

@ -7,14 +7,6 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
void CaptureScreen();
#ifdef __cplusplus
}
#endif
}

8
Source/codec.h

@ -7,16 +7,8 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
int codec_decode(BYTE *pbSrcDst, DWORD size, const char *pszPassword);
DWORD codec_get_encoded_len(DWORD dwSrcBytes);
void codec_encode(BYTE *pbSrcDst, DWORD size, int size_64, const char *pszPassword);
#ifdef __cplusplus
}
#endif
}

23
Source/control.cpp

@ -196,6 +196,18 @@ char SpellITbl[] = {
35,
35,
};
enum panel_button_id {
PANBTN_CHARINFO,
PANBTN_QLOG,
PANBTN_AUTOMAP,
PANBTN_MAINMENU,
PANBTN_INVENTORY,
PANBTN_SPELLBOOK,
PANBTN_SENDMSG,
PANBTN_FRIENDLY,
};
/** Maps from panel_button_id to the position and dimensions of a panel button. */
int PanBtnPos[8][5] = {
// clang-format off
@ -1093,17 +1105,6 @@ void CheckPanelInfo()
pcursinvitem = CheckInvHLight();
}
enum panel_button_id {
PANBTN_CHARINFO,
PANBTN_QLOG,
PANBTN_AUTOMAP,
PANBTN_MAINMENU,
PANBTN_INVENTORY,
PANBTN_SPELLBOOK,
PANBTN_SENDMSG,
PANBTN_FRIENDLY,
};
/**
* Check if the mouse is within a control panel button that's flagged.
* Takes apropiate action if so.

18
Source/control.h

@ -5,30 +5,28 @@
*/
#pragma once
#include <stdint.h>
#include "engine.h"
#include "spelldat.h"
#include "spells.h"
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
typedef enum text_color {
enum text_color : uint8_t {
COL_WHITE,
COL_BLUE,
COL_RED,
COL_GOLD,
COL_BLACK,
} text_color;
};
typedef struct RECT32 {
struct RECT32 {
int x;
int y;
int w;
int h;
} RECT32;
};
extern bool drawhpflag;
extern bool dropGoldFlag;
@ -153,8 +151,4 @@ extern const BYTE gbFontTransTbl[256];
extern RECT32 ChrBtnsRect[4];
#ifdef __cplusplus
}
#endif
}

4
Source/cursor.h

@ -5,9 +5,11 @@
*/
#pragma once
#include <stdint.h>
namespace devilution {
enum cursor_id {
enum cursor_id : uint8_t {
CURSOR_NONE,
CURSOR_HAND,
CURSOR_IDENTIFY,

12
Source/dead.h

@ -7,17 +7,13 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
typedef struct DeadStruct {
struct DeadStruct {
Uint8 *_deadData[8];
int _deadFrame;
int _deadWidth;
int _deadWidth2;
Uint8 _deadtrans;
} DeadStruct;
};
extern DeadStruct dead[MAXDEAD];
extern int stonendx;
@ -26,8 +22,4 @@ void InitDead();
void AddDead(int dx, int dy, char dv, int ddir);
void SetDead();
#ifdef __cplusplus
}
#endif
}

8
Source/debug.h

@ -7,10 +7,6 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
extern BYTE *pSquareCel;
void FreeDebugGFX();
@ -25,8 +21,4 @@ void PrintDebugQuest();
void GetDebugMonster();
void NextDebugMonster();
#ifdef __cplusplus
}
#endif
}

2
Source/diablo.cpp

@ -188,7 +188,7 @@ static void diablo_parse_flags(int argc, char **argv)
} else if (strcasecmp("-t", argv[i]) == 0) {
leveldebug = true;
setlevel = true;
setlvlnum = SDL_atoi(argv[++i]);
setlvlnum = (_setlevels)SDL_atoi(argv[++i]);
} else if (strcasecmp("-v", argv[i]) == 0) {
visiondebug = true;
} else if (strcasecmp("-w", argv[i]) == 0) {

8
Source/doom.h

@ -9,10 +9,6 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
extern bool doomflag;
extern int DoomQuestState;
@ -21,8 +17,4 @@ void doom_init();
void doom_close();
void doom_draw(CelOutputBuffer out);
#ifdef __cplusplus
}
#endif
}

8
Source/drlg_l1.h

@ -7,10 +7,6 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
extern int UberRow;
extern int UberCol;
extern bool IsUberRoomOpened;
@ -33,8 +29,4 @@ void drlg_l1_crypt_pattern5(int rndper);
void drlg_l1_crypt_pattern6(int rndper);
void drlg_l1_crypt_pattern7(int rndper);
#ifdef __cplusplus
}
#endif
}

16
Source/drlg_l2.h

@ -7,26 +7,22 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
typedef struct HALLNODE {
struct HALLNODE {
Sint32 nHallx1;
Sint32 nHally1;
Sint32 nHallx2;
Sint32 nHally2;
Sint32 nHalldir;
struct HALLNODE *pNext;
} HALLNODE;
};
typedef struct ROOMNODE {
struct ROOMNODE {
Sint32 nRoomx1;
Sint32 nRoomy1;
Sint32 nRoomx2;
Sint32 nRoomy2;
Sint32 nRoomDest;
} ROOMNODE;
};
extern BYTE predungeon[DMAXX][DMAXY];
@ -35,8 +31,4 @@ void LoadL2Dungeon(const char *sFileName, int vx, int vy);
void LoadPreL2Dungeon(const char *sFileName, int vx, int vy);
void CreateL2Dungeon(DWORD rseed, lvl_entry entry);
#ifdef __cplusplus
}
#endif
}

8
Source/drlg_l3.h

@ -7,17 +7,9 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
void AddFenceDoors();
void CreateL3Dungeon(DWORD rseed, lvl_entry entry);
void LoadL3Dungeon(const char *sFileName, int vx, int vy);
void LoadPreL3Dungeon(const char *sFileName, int vx, int vy);
#ifdef __cplusplus
}
#endif
}

8
Source/drlg_l4.h

@ -7,10 +7,6 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
extern int diabquad1x;
extern int diabquad1y;
extern int diabquad2x;
@ -23,8 +19,4 @@ bool IsDURWall(char d);
bool IsDLLWall(char dd);
void CreateL4Dungeon(DWORD rseed, lvl_entry entry);
#ifdef __cplusplus
}
#endif
}

9
Source/dthread.h

@ -7,18 +7,9 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
void dthread_remove_player(int pnum);
void dthread_send_delta(int pnum, char cmd, void *pbSrc, int dwLen);
void dthread_start();
void dthread_cleanup();
/* data */
#ifdef __cplusplus
}
#endif
}

12
Source/encrypt.h

@ -7,17 +7,13 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
typedef struct TDataInfo {
struct TDataInfo {
Uint8 *srcData;
Uint32 srcOffset;
Uint8 *destData;
Uint32 destOffset;
Uint32 size;
} TDataInfo;
};
void Decrypt(DWORD *castBlock, DWORD size, DWORD key);
void Encrypt(DWORD *castBlock, DWORD size, DWORD key);
@ -26,8 +22,4 @@ void InitHash();
DWORD PkwareCompress(BYTE *srcData, DWORD size);
void PkwareDecompress(BYTE *pbInBuff, int recv_size, int dwMaxBytes);
#ifdef __cplusplus
}
#endif
}

3
Source/engine.h

@ -15,6 +15,7 @@
#include <algorithm>
#include <cstddef>
#include <cstdlib>
#include <stdint.h>
#include <SDL.h>
@ -26,7 +27,7 @@
namespace devilution {
enum direction {
enum direction : uint8_t {
DIR_S,
DIR_SW,
DIR_W,

8
Source/gamemenu.h

@ -7,10 +7,6 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
void gamemenu_on();
void gamemenu_off();
void gamemenu_handle_previous();
@ -28,8 +24,4 @@ void gamemenu_gamma(bool bActivate);
void gamemenu_speed(bool bActivate);
void gamemenu_color_cycling(bool bActivate);
#ifdef __cplusplus
}
#endif
}

2
Source/gendung.cpp

@ -65,7 +65,7 @@ dungeon_type leveltype;
BYTE currlevel;
bool setlevel;
/** Specifies the active quest level of the current game. */
BYTE setlvlnum;
_setlevels setlvlnum;
/** Level type of the active quest level */
dungeon_type setlvltype;
/** Specifies the player viewpoint X-coordinate of the map. */

11
Source/gendung.h

@ -11,6 +11,15 @@
namespace devilution {
enum _setlevels : int8_t {
SL_NONE,
SL_SKELKING,
SL_BONECHAMB,
SL_MAZE,
SL_POISONWATER,
SL_VILEBETRAYER,
};
enum dungeon_type : int8_t {
DTYPE_TOWN,
DTYPE_CATHEDRAL,
@ -120,7 +129,7 @@ extern int dmaxy;
extern dungeon_type leveltype;
extern BYTE currlevel;
extern bool setlevel;
extern BYTE setlvlnum;
extern _setlevels setlvlnum;
extern dungeon_type setlvltype;
extern int ViewX;
extern int ViewY;

12
Source/gmenu.h

@ -9,15 +9,11 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
typedef struct TMenuItem {
struct TMenuItem {
Uint32 dwFlags;
const char *pszStr;
void (*fnMenu)(bool);
} TMenuItem;
};
extern TMenuItem *sgpCurrentMenu;
@ -35,8 +31,4 @@ void gmenu_slider_set(TMenuItem *pItem, int min, int max, int gamma);
int gmenu_slider_get(TMenuItem *pItem, int min, int max);
void gmenu_slider_steps(TMenuItem *pItem, int dwTicks);
#ifdef __cplusplus
}
#endif
}

8
Source/help.h

@ -7,10 +7,6 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
extern bool helpflag;
void InitHelp();
@ -19,8 +15,4 @@ void DisplayHelp();
void HelpScrollUp();
void HelpScrollDown();
#ifdef __cplusplus
}
#endif
}

8
Source/init.h

@ -7,10 +7,6 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
extern int gbActive;
extern HANDLE hellfire_mpq;
extern WNDPROC CurrentProc;
@ -40,8 +36,4 @@ WNDPROC SetWindowProc(WNDPROC NewProc);
extern char gszVersionNumber[64];
extern char gszProductName[64];
#ifdef __cplusplus
}
#endif
}

27
Source/interfac.h

@ -5,13 +5,26 @@
*/
#pragma once
#include <stdint.h>
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
enum interface_mode : uint16_t {
// clang-format off
WM_DIABNEXTLVL = 0x402, // WM_USER+2
WM_DIABPREVLVL = 0x403,
WM_DIABRTNLVL = 0x404,
WM_DIABSETLVL = 0x405,
WM_DIABWARPLVL = 0x406,
WM_DIABTOWNWARP = 0x407,
WM_DIABTWARPUP = 0x408,
WM_DIABRETOWN = 0x409,
WM_DIABNEWGAME = 0x40A,
WM_DIABLOADGAME = 0x40B
// clang-format on
};
typedef enum Cutscenes {
enum Cutscenes : uint8_t {
CutStart,
CutTown,
CutLevel1,
@ -23,14 +36,10 @@ typedef enum Cutscenes {
CutPortal,
CutPortalRed,
CutGate,
} Cutscenes;
};
void interface_msg_pump();
bool IncProgress();
void ShowProgress(interface_mode uMsg);
#ifdef __cplusplus
}
#endif
}

49
Source/inv.h

@ -5,12 +5,59 @@
*/
#pragma once
#include <stdint.h>
#include "items.h"
#include "player.h"
namespace devilution {
enum item_color {
enum inv_item : int8_t {
// clang-format off
INVITEM_HEAD = 0,
INVITEM_RING_LEFT = 1,
INVITEM_RING_RIGHT = 2,
INVITEM_AMULET = 3,
INVITEM_HAND_LEFT = 4,
INVITEM_HAND_RIGHT = 5,
INVITEM_CHEST = 6,
INVITEM_INV_FIRST = 7,
INVITEM_INV_LAST = 46,
INVITEM_BELT_FIRST = 47,
INVITEM_BELT_LAST = 54,
// clang-format on
NUM_INVELEM,
INVITEM_INVALID = -1,
};
// identifiers for each of the inventory squares
// see https://github.com/sanctuary/graphics/blob/master/inventory.png
enum inv_xy_slot : uint8_t {
// clang-format off
SLOTXY_HEAD_FIRST = 0,
SLOTXY_HEAD_LAST = 3,
SLOTXY_RING_LEFT = 4,
SLOTXY_RING_RIGHT = 5,
SLOTXY_AMULET = 6,
SLOTXY_HAND_LEFT_FIRST = 7,
SLOTXY_HAND_LEFT_LAST = 12,
SLOTXY_HAND_RIGHT_FIRST = 13,
SLOTXY_HAND_RIGHT_LAST = 18,
SLOTXY_CHEST_FIRST = 19,
SLOTXY_CHEST_LAST = 24,
// regular inventory
SLOTXY_INV_FIRST = 25,
SLOTXY_INV_LAST = 64,
// belt items
SLOTXY_BELT_FIRST = 65,
SLOTXY_BELT_LAST = 72,
NUM_XY_SLOTS = 73
// clang-format on
};
enum item_color : uint8_t {
// clang-format off
ICOL_WHITE = PAL16_YELLOW + 5,
ICOL_BLUE = PAL16_BLUE + 5,

18
Source/itemdat.h

@ -434,7 +434,7 @@ struct ItemDataStruct {
Uint16 iMaxValue;
};
enum item_effect_type {
enum item_effect_type : int8_t {
IPL_TOHIT,
IPL_TOHIT_CURSE,
IPL_DAMP,
@ -533,20 +533,20 @@ enum item_effect_type {
IPL_INVALID = -1,
};
enum goodorevil {
enum goodorevil : uint8_t {
GOE_ANY,
GOE_EVIL,
GOE_GOOD,
};
enum affix_item_type {
enum affix_item_type : uint8_t {
// clang-format off
PLT_MISC = 0x000001,
PLT_BOW = 0x000010,
PLT_STAFF = 0x000100,
PLT_WEAP = 0x001000,
PLT_SHLD = 0x010000,
PLT_ARMO = 0x100000,
PLT_MISC = 1 << 0,
PLT_BOW = 1 << 1,
PLT_STAFF = 1 << 2,
PLT_WEAP = 1 << 3,
PLT_SHLD = 1 << 4,
PLT_ARMO = 1 << 5,
// clang-format on
};

4
Source/items.cpp

@ -37,7 +37,7 @@ int gnNumGetRecords;
int OilLevels[] = { 1, 10, 1, 10, 4, 1, 5, 17, 1, 10 };
int OilValues[] = { 500, 2500, 500, 2500, 1500, 100, 2500, 15000, 500, 2500 };
enum item_misc_id OilMagic[] = {
item_misc_id OilMagic[] = {
IMISC_OILACC,
IMISC_OILMAST,
IMISC_OILSHARP,
@ -2338,7 +2338,7 @@ static void SaveItemSuffix(int i, int sufidx)
PL_Suffix[sufidx].PLMultVal);
}
void GetItemPower(int i, int minlvl, int maxlvl, int flgs, bool onlygood)
void GetItemPower(int i, int minlvl, int maxlvl, affix_item_type flgs, bool onlygood)
{
int pre, post, nt, nl, j, preidx, sufidx;
int l[256];

4
Source/items.h

@ -11,7 +11,7 @@
namespace devilution {
enum item_quality {
enum item_quality : uint8_t {
ITEM_QUALITY_NORMAL,
ITEM_QUALITY_MAGIC,
ITEM_QUALITY_UNIQUE,
@ -380,7 +380,7 @@ int AllocateItem();
void GetSuperItemLoc(int x, int y, int *xx, int *yy);
void GetItemAttrs(int i, int idata, int lvl);
void SaveItemPower(int i, item_effect_type power, int param1, int param2, int minval, int maxval, int multval);
void GetItemPower(int i, int minlvl, int maxlvl, int flgs, bool onlygood);
void GetItemPower(int i, int minlvl, int maxlvl, affix_item_type flgs, bool onlygood);
void SetupItem(int i);
int RndItem(int m);
void SpawnUnique(_unique_items uid, int x, int y);

12
Source/lighting.h

@ -7,11 +7,7 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
typedef struct LightListStruct {
struct LightListStruct {
int _lx;
int _ly;
int _lradius;
@ -24,7 +20,7 @@ typedef struct LightListStruct {
int _xoff;
int _yoff;
bool _lflags;
} LightListStruct;
};
extern LightListStruct VisionList[MAXVISION];
extern BYTE lightactive[MAXLIGHTS];
@ -68,8 +64,4 @@ void lighting_color_cycling();
extern const char CrawlTable[2749];
extern const BYTE vCrawlTable[23][30];
#ifdef __cplusplus
}
#endif
}

6
Source/loadsave.cpp

@ -733,7 +733,7 @@ static void LoadQuest(LoadHelper *file, int i)
pQuest->_qlvltype = (dungeon_type)file->nextLE<Uint8>();
pQuest->_qtx = file->nextLE<Sint32>();
pQuest->_qty = file->nextLE<Sint32>();
pQuest->_qslvl = file->nextLE<Uint8>();
pQuest->_qslvl = (_setlevels)file->nextLE<Uint8>();
pQuest->_qidx = file->nextLE<Uint8>();
if (gbIsHellfireSaveGame) {
file->skip(2); // Alignment
@ -842,7 +842,7 @@ static void ConvertLevels()
{
// Backup current level state
bool _setlevel = setlevel;
int _setlvlnum = setlvlnum;
_setlevels _setlvlnum = setlvlnum;
int _currlevel = currlevel;
dungeon_type _leveltype = leveltype;
@ -1002,7 +1002,7 @@ void LoadGame(bool firstflag)
}
setlevel = file.nextBool8();
setlvlnum = file.nextBE<Uint32>();
setlvlnum = (_setlevels)file.nextBE<Uint32>();
currlevel = file.nextBE<Uint32>();
leveltype = (dungeon_type)file.nextBE<Uint32>();
if (!setlevel)

8
Source/loadsave.h

@ -9,10 +9,6 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
extern bool gbIsHellfireSaveGame;
extern int giNumberOfLevels;
@ -34,8 +30,4 @@ void SaveGame();
void SaveLevel();
void LoadLevel();
#ifdef __cplusplus
}
#endif
}

8
Source/mainmenu.h

@ -9,17 +9,9 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
extern char gszHero[16];
bool mainmenu_select_hero_dialog(GameData *gameData);
void mainmenu_loop();
#ifdef __cplusplus
}
#endif
}

8
Source/minitext.h

@ -7,10 +7,6 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
extern bool qtextflag;
void FreeQuestText();
@ -27,8 +23,4 @@ void DrawQTextBack(CelOutputBuffer out);
*/
void DrawQText(CelOutputBuffer out);
#ifdef __cplusplus
}
#endif
}

36
Source/monstdat.h

@ -9,11 +9,7 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
typedef enum _mai_id : int8_t {
enum _mai_id : int8_t {
AI_ZOMBIE,
AI_FAT,
AI_SKELSD,
@ -55,15 +51,15 @@ typedef enum _mai_id : int8_t {
AI_NECROMORB,
AI_BONEDEMON,
AI_INVALID = -1,
} _mai_id;
};
typedef enum _mc_id : uint8_t {
enum _mc_id : uint8_t {
MC_UNDEAD,
MC_DEMON,
MC_ANIMAL,
} _mc_id;
};
typedef enum monster_resistance : uint8_t {
enum monster_resistance : uint8_t {
// clang-format off
RESIST_MAGIC = 0x01,
RESIST_FIRE = 0x02,
@ -74,9 +70,9 @@ typedef enum monster_resistance : uint8_t {
IMMUNE_NULL_40 = 0x40,
IMMUNE_ACID = 0x80,
// clang-format on
} monster_resistance;
};
typedef struct MonsterData {
struct MonsterData {
const char *mName;
const char *GraphicType;
const char *sndfile;
@ -114,9 +110,9 @@ typedef struct MonsterData {
Sint8 mSelFlag; // TODO Create enum
Uint16 mTreasure; // TODO Create enum
Uint16 mExp;
} MonsterData;
};
typedef enum _monster_id {
enum _monster_id : int16_t {
MT_NZOMBIE,
MT_BZOMBIE,
MT_GZOMBIE,
@ -257,15 +253,15 @@ typedef enum _monster_id {
MT_NAKRUL,
NUM_MTYPES,
MT_INVALID = -1,
} _monster_id;
};
typedef enum _monster_availability {
enum _monster_availability : uint8_t {
MAT_NEVER,
MAT_ALWAYS,
MAT_RETAIL,
} _monster_availability;
};
typedef struct UniqMonstStruct {
struct UniqMonstStruct {
_monster_id mtype;
const char *mName;
const char *mTrnName;
@ -281,15 +277,11 @@ typedef struct UniqMonstStruct {
Uint8 mUnqVar1;
Uint8 mUnqVar2;
Sint32 mtalkmsg;
} UniqMonstStruct;
};
extern const MonsterData monsterdata[];
extern const _monster_id MonstConvTbl[];
extern const char MonstAvailTbl[];
extern const UniqMonstStruct UniqMonst[];
#ifdef __cplusplus
}
#endif
}

8
Source/movie.h

@ -7,17 +7,9 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
extern BYTE movie_playing;
extern bool loop_movie;
void play_movie(const char *pszMovie, bool user_can_close);
#ifdef __cplusplus
}
#endif
}

20
Source/mpqapi.h

@ -9,11 +9,7 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _FILEHEADER {
struct _FILEHEADER {
int signature;
int headersize;
int filesize;
@ -24,20 +20,20 @@ typedef struct _FILEHEADER {
int hashcount;
int blockcount;
Uint8 pad[72];
} _FILEHEADER;
};
typedef struct _HASHENTRY {
struct _HASHENTRY {
Uint32 hashcheck[2];
Uint32 lcid;
Uint32 block;
} _HASHENTRY;
};
typedef struct _BLOCKENTRY {
struct _BLOCKENTRY {
Uint32 offset;
Uint32 sizealloc;
Uint32 sizefile;
Uint32 flags;
} _BLOCKENTRY;
};
void mpqapi_remove_hash_entry(const char *pszName);
void mpqapi_remove_hash_entries(bool (*fnGetName)(DWORD, char *));
@ -47,8 +43,4 @@ bool mpqapi_has_file(const char *pszName);
bool OpenMPQ(const char *pszArchive, DWORD dwChar);
bool mpqapi_flush_and_close(const char *pszArchive, bool bFree, DWORD dwChar);
#ifdef __cplusplus
}
#endif
}

2
Source/msg.cpp

@ -1931,7 +1931,7 @@ static DWORD On_NEWLVL(TCmd *pCmd, int pnum)
if (gbBufferMsgs == 1)
msg_send_packet(pnum, p, sizeof(*p));
else if (pnum != myplr)
StartNewLvl(pnum, p->wParam1, p->wParam2);
StartNewLvl(pnum, (interface_mode)p->wParam1, p->wParam2);
return sizeof(*p);
}

18
Source/multi.h

@ -5,15 +5,19 @@
*/
#pragma once
#include <stdint.h>
#include "msg.h"
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
enum event_type : uint8_t {
EVENT_TYPE_PLAYER_CREATE_GAME,
EVENT_TYPE_PLAYER_LEAVE_GAME,
EVENT_TYPE_PLAYER_MESSAGE,
};
typedef struct GameData {
struct GameData {
Sint32 size;
Sint32 dwSeed;
Uint32 programid;
@ -26,7 +30,7 @@ typedef struct GameData {
Uint8 bTheoQuest;
Uint8 bCowQuest;
Uint8 bFriendlyFire;
} GameData;
};
extern bool gbSomebodyWonGameKludge;
extern char szPlayerDescript[128];
@ -56,8 +60,4 @@ bool multi_init_single(GameData *gameData);
bool multi_init_multi(GameData *gameData, bool *pfExitProgram);
void recv_plrinfo(int pnum, TCmdPlrInfoHdr *p, bool recv);
#ifdef __cplusplus
}
#endif
}

8
Source/nthread.h

@ -7,10 +7,6 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
extern BYTE sgbNetUpdateRate;
extern DWORD gdwMsgLenTbl[MAX_PLRS];
extern DWORD gdwDeltaBytesSec;
@ -28,8 +24,4 @@ void nthread_cleanup();
void nthread_ignore_mutex(bool bStart);
bool nthread_has_500ms_passed();
#ifdef __cplusplus
}
#endif
}

6
Source/objdat.h

@ -5,6 +5,8 @@
*/
#pragma once
#include <stdint.h>
namespace devilution {
enum theme_id : int8_t {
@ -28,7 +30,7 @@ enum theme_id : int8_t {
THEME_NONE = -1,
};
enum object_graphic_id {
enum object_graphic_id : int8_t {
OFILE_L1BRAZ,
OFILE_L1DOORS,
OFILE_LEVER,
@ -88,7 +90,7 @@ enum object_graphic_id {
OFILE_NULL = -1,
};
enum _object_id {
enum _object_id : int8_t {
OBJ_L1LIGHT,
OBJ_L1LDOOR,
OBJ_L1RDOOR,

17
Source/pack.h

@ -10,12 +10,8 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
#pragma pack(push, 1)
typedef struct PkItemStruct {
struct PkItemStruct {
Uint32 iSeed;
Uint16 iCreateInfo;
Uint16 idx;
@ -26,9 +22,9 @@ typedef struct PkItemStruct {
Uint8 bMCh;
Uint16 wValue;
Uint32 dwBuff;
} PkItemStruct;
};
typedef struct PkPlayerStruct {
struct PkPlayerStruct {
Uint32 dwLowDateTime;
Uint32 dwHighDateTime;
Sint8 destAction;
@ -76,7 +72,7 @@ typedef struct PkPlayerStruct {
Uint32 pDifficulty;
Sint32 pDamAcFlags;
Sint32 dwReserved[5]; // For future use
} PkPlayerStruct;
};
#pragma pack(pop)
void PackPlayer(PkPlayerStruct *pPack, int pnum, bool manashield);
@ -84,9 +80,4 @@ void UnPackPlayer(PkPlayerStruct *pPack, int pnum, bool netSync);
void PackItem(PkItemStruct *id, const ItemStruct *is);
void UnPackItem(const PkItemStruct *is, ItemStruct *id, bool isHellfire);
/* rdata */
#ifdef __cplusplus
}
#endif
}

8
Source/palette.h

@ -7,10 +7,6 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
extern SDL_Color logical_palette[256];
extern SDL_Color system_palette[256];
extern SDL_Color orig_palette[256];
@ -34,8 +30,4 @@ void palette_update_crypt();
void palette_update_hive();
void palette_update_quest_palette(int n);
#ifdef __cplusplus
}
#endif
}

11
Source/path.h

@ -7,11 +7,7 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
typedef struct PATHNODE {
struct PATHNODE {
Uint8 f;
Uint8 h;
Uint8 g;
@ -20,7 +16,7 @@ typedef struct PATHNODE {
struct PATHNODE *Parent;
struct PATHNODE *Child[8];
struct PATHNODE *NextNode;
} PATHNODE;
};
int FindPath(bool (*PosOk)(int, int, int), int PosOkArg, int sx, int sy, int dx, int dy, Sint8 path[MAX_PATH_LENGTH]);
int path_get_h_cost(int sx, int sy, int dx, int dy);
@ -40,8 +36,5 @@ PATHNODE *path_new_step();
extern const char pathxdir[8];
extern const char pathydir[8];
#ifdef __cplusplus
}
#endif
}

8
Source/pfile.h

@ -10,10 +10,6 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
extern bool gbValidSaveFile;
const char *pfile_get_password();
@ -36,8 +32,4 @@ void pfile_write_save_file(const char *pszName, BYTE *pbData, DWORD dwLen, DWORD
BYTE *pfile_read(const char *pszName, DWORD *pdwLen);
void pfile_update(bool force_save);
#ifdef __cplusplus
}
#endif
}

15
Source/player.cpp

@ -2034,7 +2034,7 @@ void InitLevelChange(int pnum)
__attribute__((no_sanitize("shift-base")))
#endif
void
StartNewLvl(int pnum, int fom, int lvl)
StartNewLvl(int pnum, interface_mode fom, int lvl)
{
InitLevelChange(pnum);
@ -2052,7 +2052,7 @@ StartNewLvl(int pnum, int fom, int lvl)
plr[pnum].plrlevel = lvl;
break;
case WM_DIABSETLVL:
setlvlnum = lvl;
setlvlnum = (_setlevels)lvl;
break;
case WM_DIABTWARPUP:
plr[myplr].pTownWarps |= 1 << (leveltype - 2);
@ -2073,6 +2073,7 @@ StartNewLvl(int pnum, int fom, int lvl)
}
}
}
void RestartTownLvl(int pnum)
{
InitLevelChange(pnum);
@ -4230,6 +4231,16 @@ void InitDungMsgs(int pnum)
plr[pnum].pDungMsgs2 = 0;
}
enum {
// clang-format off
DMSG_CATHEDRAL = 1 << 0,
DMSG_CATACOMBS = 1 << 1,
DMSG_CAVES = 1 << 2,
DMSG_HELL = 1 << 3,
DMSG_DIABLO = 1 << 4,
// clang-format on
};
void PlayDungMsgs()
{
if ((DWORD)myplr >= MAX_PLRS) {

44
Source/player.h

@ -10,6 +10,7 @@
#include "gendung.h"
#include "items.h"
#include "spelldat.h"
#include "interfac.h"
namespace devilution {
@ -57,6 +58,23 @@ enum inv_body_loc : uint8_t {
NUM_INVLOC,
};
enum player_graphic : uint16_t {
// clang-format off
PFILE_STAND = 1 << 0,
PFILE_WALK = 1 << 1,
PFILE_ATTACK = 1 << 2,
PFILE_HIT = 1 << 3,
PFILE_LIGHTNING = 1 << 4,
PFILE_FIRE = 1 << 5,
PFILE_MAGIC = 1 << 6,
PFILE_DEATH = 1 << 7,
PFILE_BLOCK = 1 << 8,
// everything except PFILE_DEATH
// 0b1_0111_1111
PFILE_NONDEATH = 0x17F
// clang-format on
};
enum anim_weapon_id : uint8_t {
ANIM_ID_UNARMED,
ANIM_ID_UNARMED_SHIELD,
@ -69,7 +87,7 @@ enum anim_weapon_id : uint8_t {
ANIM_ID_STAFF,
};
typedef enum PLR_MODE {
enum PLR_MODE : uint8_t {
PM_STAND,
PM_WALK, //Movement towards N, NW, or NE
PM_WALK2, //Movement towards S, SW, or SE
@ -82,9 +100,9 @@ typedef enum PLR_MODE {
PM_SPELL,
PM_NEWLVL,
PM_QUIT,
} PLR_MODE;
};
typedef enum action_id {
enum action_id : int8_t {
// clang-format off
ACTION_WALK = -2, // Automatic walk when using gamepad
ACTION_NONE = -1,
@ -105,14 +123,14 @@ typedef enum action_id {
ACTION_SPELLPLR = 25,
ACTION_SPELLWALL = 26,
// clang-format on
} action_id;
};
typedef enum player_weapon_type {
enum player_weapon_type : uint8_t {
WT_MELEE,
WT_RANGED,
} player_weapon_type;
};
typedef struct PlayerStruct {
struct PlayerStruct {
PLR_MODE _pmode;
Sint8 walkpath[MAX_PATH_LENGTH];
bool plractive;
@ -300,11 +318,7 @@ typedef struct PlayerStruct {
* @return The maximum value for the requested attribute.
*/
Sint32 GetMaximumAttributeValue(attribute_id attribute) const;
} PlayerStruct;
#ifdef __cplusplus
extern "C" {
#endif
};
extern int myplr;
extern PlayerStruct plr[MAX_PLRS];
@ -342,7 +356,7 @@ void DropHalfPlayersGold(int pnum);
void StripTopGold(int pnum);
void SyncPlrKill(int pnum, int earflag);
void RemovePlrMissiles(int pnum);
void StartNewLvl(int pnum, int fom, int lvl);
void StartNewLvl(int pnum, interface_mode fom, int lvl);
void RestartTownLvl(int pnum);
void StartWarpLvl(int pnum, int pidx);
void ProcessPlayers();
@ -378,8 +392,4 @@ extern int DexterityTbl[NUM_CLASSES];
extern int VitalityTbl[NUM_CLASSES];
extern int ExpLvlsTbl[MAXCHARLEVEL];
#ifdef __cplusplus
}
#endif
}

12
Source/plrmsg.h

@ -9,15 +9,11 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _plrmsg {
struct _plrmsg {
Uint32 time;
Uint8 player;
char str[144];
} _plrmsg;
};
void plrmsg_delay(bool delay);
void ErrorPlrMsg(const char *pszMsg);
@ -27,8 +23,4 @@ void ClearPlrMsg();
void InitPlrMsg();
void DrawPlrMsg(CelOutputBuffer out);
#ifdef __cplusplus
}
#endif
}

2
Source/portal.cpp

@ -139,7 +139,7 @@ void GetPortalLevel()
} else {
if (portal[portalindex].setlvl) {
setlevel = true;
setlvlnum = portal[portalindex].level;
setlvlnum = (_setlevels)portal[portalindex].level;
currlevel = portal[portalindex].level;
plr[myplr].plrlevel = setlvlnum;
leveltype = portal[portalindex].ltype;

12
Source/portal.h

@ -7,18 +7,14 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
typedef struct PortalStruct {
struct PortalStruct {
bool open;
Sint32 x;
Sint32 y;
Sint32 level;
dungeon_type ltype;
bool setlvl;
} PortalStruct;
};
extern PortalStruct portal[MAXPORTAL];
@ -36,8 +32,4 @@ void GetPortalLevel();
void GetPortalLvlPos();
bool PosOkPortal(int lvl, int x, int y);
#ifdef __cplusplus
}
#endif
}

50
Source/quests.cpp

@ -25,31 +25,31 @@ int ReturnLvl;
/** Contains the data related to each quest_id. */
QuestData questlist[] = {
// clang-format off
// _qdlvl, _qdmultlvl, _qlvlt, _qdtype, _qdrnd, _qslvl, isSinglePlayerOnly, _qdmsg, _qlstr
{ 5, -1, DTYPE_NONE, Q_ROCK, 100, 0, true, TEXT_INFRA5, "The Magic Rock" },
{ 9, -1, DTYPE_NONE, Q_MUSHROOM, 100, 0, true, TEXT_MUSH8, "Black Mushroom" },
{ 4, -1, DTYPE_NONE, Q_GARBUD, 100, 0, true, TEXT_GARBUD1, "Gharbad The Weak" },
{ 8, -1, DTYPE_NONE, Q_ZHAR, 100, 0, true, TEXT_ZHAR1, "Zhar the Mad" },
{ 14, -1, DTYPE_NONE, Q_VEIL, 100, 0, true, TEXT_VEIL9, "Lachdanan" },
{ 15, -1, DTYPE_NONE, Q_DIABLO, 100, 0, false, TEXT_VILE3, "Diablo" },
{ 2, 2, DTYPE_NONE, Q_BUTCHER, 100, 0, false, TEXT_BUTCH9, "The Butcher" },
{ 4, -1, DTYPE_NONE, Q_LTBANNER, 100, 0, true, TEXT_BANNER2, "Ogden's Sign" },
{ 7, -1, DTYPE_NONE, Q_BLIND, 100, 0, true, TEXT_BLINDING, "Halls of the Blind" },
{ 5, -1, DTYPE_NONE, Q_BLOOD, 100, 0, true, TEXT_BLOODY, "Valor" },
{ 10, -1, DTYPE_NONE, Q_ANVIL, 100, 0, true, TEXT_ANVIL5, "Anvil of Fury" },
{ 13, -1, DTYPE_NONE, Q_WARLORD, 100, 0, true, TEXT_BLOODWAR, "Warlord of Blood" },
{ 3, 3, DTYPE_CATHEDRAL, Q_SKELKING, 100, 1, false, TEXT_KING2, "The Curse of King Leoric" },
{ 2, -1, DTYPE_CAVES, Q_PWATER, 100, 4, true, TEXT_POISON3, "Poisoned Water Supply" },
{ 6, -1, DTYPE_CATACOMBS, Q_SCHAMB, 100, 2, true, TEXT_BONER, "The Chamber of Bone" },
{ 15, 15, DTYPE_CATHEDRAL, Q_BETRAYER, 100, 5, false, TEXT_VILE1, "Archbishop Lazarus" },
{ 17, 17, DTYPE_NONE, Q_GRAVE, 100, 0, false, TEXT_GRAVE7, "Grave Matters" },
{ 9, 9, DTYPE_NONE, Q_FARMER, 100, 0, false, TEXT_FARMER1, "Farmer's Orchard" },
{ 17, -1, DTYPE_NONE, Q_GIRL, 100, 0, true, TEXT_GIRL2, "Little Girl" },
{ 19, -1, DTYPE_NONE, Q_TRADER, 100, 0, true, TEXT_TRADER, "Wandering Trader" },
{ 17, 17, DTYPE_NONE, Q_DEFILER, 100, 0, false, TEXT_DEFILER1, "The Defiler" },
{ 21, 21, DTYPE_NONE, Q_NAKRUL, 100, 0, false, TEXT_NAKRUL1, "Na-Krul" },
{ 21, -1, DTYPE_NONE, Q_CORNSTN, 100, 0, true, TEXT_CORNSTN, "Cornerstone of the World" },
{ 9, 9, DTYPE_NONE, Q_JERSEY, 100, 0, false, TEXT_JERSEY4, "The Jersey's Jersey" },
// _qdlvl, _qdmultlvl, _qlvlt, _qdtype, _qdrnd, _qslvl, isSinglePlayerOnly, _qdmsg, _qlstr
{ 5, -1, DTYPE_NONE, Q_ROCK, 100, SL_NONE, true, TEXT_INFRA5, "The Magic Rock" },
{ 9, -1, DTYPE_NONE, Q_MUSHROOM, 100, SL_NONE, true, TEXT_MUSH8, "Black Mushroom" },
{ 4, -1, DTYPE_NONE, Q_GARBUD, 100, SL_NONE, true, TEXT_GARBUD1, "Gharbad The Weak" },
{ 8, -1, DTYPE_NONE, Q_ZHAR, 100, SL_NONE, true, TEXT_ZHAR1, "Zhar the Mad" },
{ 14, -1, DTYPE_NONE, Q_VEIL, 100, SL_NONE, true, TEXT_VEIL9, "Lachdanan" },
{ 15, -1, DTYPE_NONE, Q_DIABLO, 100, SL_NONE, false, TEXT_VILE3, "Diablo" },
{ 2, 2, DTYPE_NONE, Q_BUTCHER, 100, SL_NONE, false, TEXT_BUTCH9, "The Butcher" },
{ 4, -1, DTYPE_NONE, Q_LTBANNER, 100, SL_NONE, true, TEXT_BANNER2, "Ogden's Sign" },
{ 7, -1, DTYPE_NONE, Q_BLIND, 100, SL_NONE, true, TEXT_BLINDING, "Halls of the Blind" },
{ 5, -1, DTYPE_NONE, Q_BLOOD, 100, SL_NONE, true, TEXT_BLOODY, "Valor" },
{ 10, -1, DTYPE_NONE, Q_ANVIL, 100, SL_NONE, true, TEXT_ANVIL5, "Anvil of Fury" },
{ 13, -1, DTYPE_NONE, Q_WARLORD, 100, SL_NONE, true, TEXT_BLOODWAR, "Warlord of Blood" },
{ 3, 3, DTYPE_CATHEDRAL, Q_SKELKING, 100, SL_SKELKING, false, TEXT_KING2, "The Curse of King Leoric" },
{ 2, -1, DTYPE_CAVES, Q_PWATER, 100, SL_POISONWATER, true, TEXT_POISON3, "Poisoned Water Supply" },
{ 6, -1, DTYPE_CATACOMBS, Q_SCHAMB, 100, SL_BONECHAMB, true, TEXT_BONER, "The Chamber of Bone" },
{ 15, 15, DTYPE_CATHEDRAL, Q_BETRAYER, 100, SL_VILEBETRAYER, false, TEXT_VILE1, "Archbishop Lazarus" },
{ 17, 17, DTYPE_NONE, Q_GRAVE, 100, SL_NONE, false, TEXT_GRAVE7, "Grave Matters" },
{ 9, 9, DTYPE_NONE, Q_FARMER, 100, SL_NONE, false, TEXT_FARMER1, "Farmer's Orchard" },
{ 17, -1, DTYPE_NONE, Q_GIRL, 100, SL_NONE, true, TEXT_GIRL2, "Little Girl" },
{ 19, -1, DTYPE_NONE, Q_TRADER, 100, SL_NONE, true, TEXT_TRADER, "Wandering Trader" },
{ 17, 17, DTYPE_NONE, Q_DEFILER, 100, SL_NONE, false, TEXT_DEFILER1, "The Defiler" },
{ 21, 21, DTYPE_NONE, Q_NAKRUL, 100, SL_NONE, false, TEXT_NAKRUL1, "Na-Krul" },
{ 21, -1, DTYPE_NONE, Q_CORNSTN, 100, SL_NONE, true, TEXT_CORNSTN, "Cornerstone of the World" },
{ 9, 9, DTYPE_NONE, Q_JERSEY, 100, SL_NONE, false, TEXT_JERSEY4, "The Jersey's Jersey" },
// clang-format on
};
/**

7
Source/quests.h

@ -5,7 +5,10 @@
*/
#pragma once
#include <stdint.h>
#include "engine.h"
#include "gendung.h"
namespace devilution {
@ -40,7 +43,7 @@ struct QuestStruct {
dungeon_type _qlvltype;
Sint32 _qtx;
Sint32 _qty;
Uint8 _qslvl;
_setlevels _qslvl;
Uint8 _qidx;
Sint32 _qmsg;
Uint8 _qvar1;
@ -54,7 +57,7 @@ struct QuestData {
dungeon_type _qlvlt;
Uint8 _qdtype;
Uint8 _qdrnd;
Uint8 _qslvl;
_setlevels _qslvl;
bool isSinglePlayerOnly;
Sint32 _qdmsg;
const char *_qlstr;

8
Source/render.h

@ -7,10 +7,6 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Blit current world CEL to the given buffer
* @param out Target buffer
@ -27,8 +23,4 @@ void RenderTile(CelOutputBuffer out, int x, int y);
*/
void world_draw_black_tile(CelOutputBuffer out, int sx, int sy);
#ifdef __cplusplus
}
#endif
}

8
Source/restrict.h

@ -7,14 +7,6 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
void ReadOnlyTest();
#ifdef __cplusplus
}
#endif
}

2
Source/scrollrt.h

@ -5,6 +5,8 @@
*/
#pragma once
#include <stdint.h>
namespace devilution {
enum _scroll_direction : uint8_t {

8
Source/setmaps.h

@ -7,18 +7,10 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
int ObjIndex(int x, int y);
void LoadSetMap();
/* rdata */
extern const char *const quest_level_names[];
#ifdef __cplusplus
}
#endif
}

12
Source/sha.h

@ -7,25 +7,17 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
#define SHA1HashSize 20
typedef struct SHA1Context {
struct SHA1Context {
Uint32 state[5];
Uint32 count[2];
char buffer[64];
} SHA1Context;
};
void SHA1Clear();
void SHA1Result(int n, char Message_Digest[SHA1HashSize]);
void SHA1Calculate(int n, const char *data, char Message_Digest[SHA1HashSize]);
void SHA1Reset(int n);
#ifdef __cplusplus
}
#endif
}

2
Source/sound.h

@ -5,6 +5,8 @@
*/
#pragma once
#include <stdint.h>
namespace devilution {
enum _music_id : uint8_t {

6
Source/spelldat.h

@ -5,6 +5,8 @@
*/
#pragma once
#include <stdint.h>
#include "effects.h"
namespace devilution {
@ -74,13 +76,13 @@ enum spell_id : int8_t {
SPL_INVALID = -1,
};
enum magic_type {
enum magic_type : uint8_t {
STYPE_FIRE,
STYPE_LIGHTNING,
STYPE_MAGIC,
};
enum missile_id {
enum missile_id : int8_t {
MIS_ARROW,
MIS_FIREBOLT,
MIS_GUARDIAN,

18
Source/stores.h

@ -9,11 +9,7 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
typedef enum talk_id {
enum talk_id : uint8_t {
STORE_NONE,
STORE_SMITH,
STORE_SBUY,
@ -38,9 +34,9 @@ typedef enum talk_id {
STORE_TAVERN,
STORE_DRUNK,
STORE_BARMAID,
} talk_id;
};
typedef struct STextStruct {
struct STextStruct {
int _sx;
int _syoff;
char _sstr[128];
@ -49,7 +45,7 @@ typedef struct STextStruct {
int _sline;
bool _ssel;
int _sval;
} STextStruct;
};
/** Shop frame graphics */
extern BYTE *pSTextBoxCels;
@ -114,10 +110,4 @@ void STextEnter();
void CheckStoreBtn();
void ReleaseStoreBtn();
/* rdata */
#ifdef __cplusplus
}
#endif
}

8
Source/sync.h

@ -7,16 +7,8 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
Uint32 sync_all_monsters(const Uint8 *pbBuf, Uint32 dwMaxLen);
Uint32 sync_update(int pnum, const Uint8 *pbBuf);
void sync_init();
#ifdef __cplusplus
}
#endif
}

20
Source/tmsg.h

@ -7,25 +7,19 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
#pragma pack(push, 1)
typedef struct TMsg TMsg;
typedef struct TMsgHdr {
TMsg *pNext;
struct TMsgHdr {
struct TMsg *pNext;
Sint32 dwTime;
Uint8 bLen;
} TMsgHdr;
};
typedef struct TMsg {
struct TMsg {
TMsgHdr hdr;
// this is actually alignment padding, but the message body is appended to the struct
// so it's convenient to use byte-alignment and name it "body"
Uint8 body[3];
} TMsg;
};
#pragma pack(pop)
int tmsg_get(Uint8 *pbMsg, Uint32 dwMaxLen);
@ -33,8 +27,4 @@ void tmsg_add(Uint8 *pbMsg, Uint8 bLen);
void tmsg_start();
void tmsg_cleanup();
#ifdef __cplusplus
}
#endif
}

8
Source/town.h

@ -7,16 +7,8 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
void TownOpenHive();
void TownOpenGrave();
void CreateTown(lvl_entry entry);
#ifdef __cplusplus
}
#endif
}

1
Source/towners.h

@ -8,6 +8,7 @@
#include <stdint.h>
namespace devilution {
enum _talker_id : uint8_t {
TOWN_SMITH,
TOWN_HEALER,

8
Source/track.h

@ -7,16 +7,8 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
void track_process();
void track_repeat_walk(bool rep);
bool track_isscrolling();
#ifdef __cplusplus
}
#endif
}

14
Source/trigs.h

@ -7,16 +7,12 @@
namespace devilution {
#ifdef __cplusplus
extern "C" {
#endif
typedef struct TriggerStruct {
struct TriggerStruct {
int _tx;
int _ty;
int _tmsg;
interface_mode _tmsg;
int _tlvl;
} TriggerStruct;
};
extern bool trigflag;
extern int numtrigs;
@ -37,8 +33,4 @@ void Freeupstairs();
void CheckTrigForce();
void CheckTriggers();
#ifdef __cplusplus
}
#endif
}

2
SourceS/console.h

@ -29,7 +29,7 @@ void printInConsole(const char *fmt, ...)
WriteConsole(stderrHandle, message, strlen(message), NULL, NULL);
}
} // namespace dvl
} // namespace devilution
#else
#define printInConsole printf
#endif

2
SourceS/file_util.h

@ -111,4 +111,4 @@ inline void RemoveFile(const char *lpFileName)
}
}
} // namespace dvl
} // namespace devilution

2
SourceS/miniwin/misc.h

@ -163,4 +163,4 @@ bool PostMessage(UINT Msg, WPARAM wParam, LPARAM lParam);
#define DVL_MK_LBUTTON 0x0001
#define DVL_MK_RBUTTON 0x0002
} // namespace dvl
} // namespace devilution

2
SourceS/paths.h

@ -16,4 +16,4 @@ void SetConfigPath(const char *path);
void SetTtfPath(const char *path);
void SetTtfName(const char *path);
} // namespace dvl
} // namespace devilution

12
SourceS/sdl2_to_1_2_backports.h

@ -96,11 +96,13 @@ inline void SDL_DisableScreenSaver()
//= Messagebox (simply logged to stderr for now)
typedef enum {
SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
SDL_MESSAGEBOX_INFORMATION = 0x00000040 /**< informational dialog */
} SDL_MessageBoxFlags;
enum {
// clang-format off
SDL_MESSAGEBOX_ERROR = 0x10, /**< error dialog */
SDL_MESSAGEBOX_WARNING = 0x20, /**< warning dialog */
SDL_MESSAGEBOX_INFORMATION = 0x40, /**< informational dialog */
// clang-format on
};
inline int SDL_ShowSimpleMessageBox(Uint32 flags,
const char *title,

2
SourceS/soundsample.h

@ -17,4 +17,4 @@ private:
Mix_Chunk *chunk;
};
} // namespace dvl
} // namespace devilution

5
SourceS/storm_full.h

@ -1,8 +1,7 @@
#pragma once
namespace devilution {
extern "C" {
extern DWORD nLastError;
}
} // namespace dvl
} // namespace devilution

2
SourceS/thread.h

@ -20,4 +20,4 @@ void ResetEvent(event_emul *e);
int WaitForEvent(event_emul *e);
SDL_Thread *CreateThread(unsigned int (*handler)(void *), SDL_threadID *ThreadID);
} // namespace dvl
} // namespace devilution

2
SourceS/ui_fwd.h

@ -10,4 +10,4 @@ extern Uint16 borderRight;
bool SpawnWindow(const char *lpWindowName);
void UiErrorOkDialog(const char *text, const char *caption, bool error = true);
} // namespace dvl
} // namespace devilution

2
SourceX/DiabloUI/art.h

@ -42,4 +42,4 @@ void LoadArt(const char *pszFile, Art *art, int frames = 1, SDL_Color *pPalette
void LoadMaskedArt(const char *pszFile, Art *art, int frames = 1, int mask = 250);
void LoadArt(Art *art, const BYTE *artData, int w, int h, int frames = 1);
} // namespace dvl
} // namespace devilution

2
SourceX/DiabloUI/art_draw.h

@ -14,4 +14,4 @@ void DrawAnimatedArt(Art *art, int screenX, int screenY);
int GetAnimationFrame(int frames, int fps = 60);
} // namespace dvl
} // namespace devilution

2
SourceX/DiabloUI/button.h

@ -18,4 +18,4 @@ void RenderButton(UiButton *button);
bool HandleMouseEventButton(const SDL_Event &event, UiButton *button);
void HandleGlobalMouseUpButton(UiButton *button);
} // namespace dvl
} // namespace devilution

2
SourceX/DiabloUI/credits_lines.h

@ -5,4 +5,4 @@ namespace devilution {
extern const char *const CREDITS_LINES[];
extern const std::size_t CREDITS_LINES_SIZE;
} // namespace dvl
} // namespace devilution

11
SourceX/DiabloUI/diabloui.h

@ -1,5 +1,6 @@
#pragma once
#include <stdint.h>
#include <array>
#include <cstddef>
#include <SDL.h>
@ -13,17 +14,17 @@ namespace devilution {
extern std::size_t SelectedItem;
extern bool textInputActive;
typedef enum _artFocus {
enum _artFocus : uint8_t {
FOCUS_SMALL,
FOCUS_MED,
FOCUS_BIG,
} _artFocus;
};
typedef enum _artLogo {
enum _artLogo : uint8_t {
LOGO_SMALL,
LOGO_MED,
LOGO_BIG,
} _artLogo;
};
extern std::array<Art, 3> ArtLogos;
extern std::array<Art, 3> ArtFocus;
@ -61,4 +62,4 @@ void UiRenderItems(std::vector<UiItemBase *> items);
void UiInitList_clear();
void mainmenu_restart_repintro();
} // namespace dvl
} // namespace devilution

2
SourceX/DiabloUI/dialogs.h

@ -10,4 +10,4 @@ void UiErrorOkDialog(const char *text, std::vector<UiItemBase *> renderBehind);
void UiErrorOkDialog(const char *text, const char *caption, std::vector<UiItemBase *> renderBehind);
void UiOkDialog(const char *text, const char *caption, bool error, std::vector<UiItemBase *> renderBehind);
} // namespace dvl
} // namespace devilution

2
SourceX/DiabloUI/errorart.h

@ -5,4 +5,4 @@ namespace devilution {
extern const unsigned char btnData[];
extern const unsigned char popupData[];
} // namespace dvl
} // namespace devilution

7
SourceX/DiabloUI/fonts.h

@ -2,20 +2,21 @@
#include "all.h"
#include <stdint.h>
#include <SDL_ttf.h>
#include "DiabloUI/art.h"
namespace devilution {
enum _artFontTables {
enum _artFontTables : uint8_t {
AFT_SMALL,
AFT_MED,
AFT_BIG,
AFT_HUGE,
};
enum _artFontColors {
enum _artFontColors : uint8_t {
AFC_SILVER,
AFC_GOLD,
};
@ -31,4 +32,4 @@ void LoadTtfFont();
void UnloadTtfFont();
void FontsCleanup();
} // namespace dvl
} // namespace devilution

6
SourceX/DiabloUI/scrollbar.h

@ -1,5 +1,7 @@
#pragma once
#include <stdint.h>
#include "DiabloUI/art.h"
#include "DiabloUI/ui_item.h"
@ -11,7 +13,7 @@ extern Art ArtScrollBarArrow;
const Uint16 SCROLLBAR_BG_WIDTH = 25;
extern Art ArtScrollBarArrow;
enum ScrollBarArrowFrame {
enum ScrollBarArrowFrame : uint8_t {
ScrollBarArrowFrame_UP_ACTIVE = 0,
ScrollBarArrowFrame_UP,
ScrollBarArrowFrame_DOWN_ACTIVE,
@ -77,4 +79,4 @@ inline SDL_Rect ThumbRect(const UiScrollBar *sb, std::size_t selected_index, std
void LoadScrollBar();
void UnloadScrollBar();
} // namespace dvl
} // namespace devilution

2
SourceX/DiabloUI/selconn.h

@ -4,4 +4,4 @@ void selconn_Esc();
void selconn_Focus(int value);
void selconn_Select(int value);
} // namespace dvl
} // namespace devilution

2
SourceX/DiabloUI/selgame.h

@ -20,4 +20,4 @@ void selgame_Password_Init(int value);
void selgame_Password_Select(int value);
void selgame_Password_Esc();
} // namespace dvl
} // namespace devilution

2
SourceX/DiabloUI/selhero.h

@ -22,4 +22,4 @@ void selhero_Name_Esc();
void selhero_Load_Focus(int value);
void selhero_Load_Select(int value);
} // namespace dvl
} // namespace devilution

2
SourceX/DiabloUI/selok.h

@ -8,4 +8,4 @@ void selok_Free();
void selok_Select(int value);
void selok_Esc();
} // namespace dvl
} // namespace devilution

2
SourceX/DiabloUI/selyesno.h

@ -8,4 +8,4 @@ void selyesno_Free();
void selyesno_Select(int value);
void selyesno_Esc();
} // namespace dvl
} // namespace devilution

2
SourceX/DiabloUI/support_lines.h

@ -5,4 +5,4 @@ namespace devilution {
extern const char *const SUPPORT_LINES[];
extern const std::size_t SUPPORT_LINES_SIZE;
} // namespace dvl
} // namespace devilution

2
SourceX/DiabloUI/text.h

@ -9,4 +9,4 @@ namespace devilution {
std::size_t GetArtStrWidth(const char *str, std::size_t size);
void WordWrapArtStr(char *text, std::size_t width);
} // namespace dvl
} // namespace devilution

2
SourceX/DiabloUI/text_draw.h

@ -17,4 +17,4 @@ void DrawTTF(const char *text, const SDL_Rect &rect, int flags,
void DrawArtStr(const char *text, const SDL_Rect &rect, int flags, bool drawTextCursor = false);
} // namespace dvl
} // namespace devilution

5
SourceX/DiabloUI/ttf_render_wrapped.h

@ -2,11 +2,12 @@
#include "all.h"
#include <stdint.h>
#include <SDL_ttf.h>
namespace devilution {
enum TextAlignment {
enum TextAlignment : uint8_t {
TextAlignment_BEGIN = 0,
TextAlignment_CENTER,
TextAlignment_END,
@ -21,4 +22,4 @@ enum TextAlignment {
SDL_Surface *RenderUTF8_Solid_Wrapped(
TTF_Font *font, const char *text, SDL_Color fg, Uint32 wrapLength, const int x_align = TextAlignment_BEGIN);
} // namespace dvl
} // namespace devilution

8
SourceX/DiabloUI/ui_item.h

@ -13,7 +13,7 @@
namespace devilution {
enum UiType {
enum UiType : uint8_t {
UI_TEXT,
UI_ART_TEXT,
UI_ART_TEXT_BUTTON,
@ -24,7 +24,7 @@ enum UiType {
UI_EDIT,
};
enum UiFlags {
enum UiFlags : uint16_t {
UIS_SMALL = 1 << 0,
UIS_MED = 1 << 1,
UIS_BIG = 1 << 2,
@ -260,7 +260,7 @@ public:
m_render_cache = NULL;
}
enum FrameKey {
enum FrameKey : uint8_t {
DEFAULT = 0,
PRESSED,
DISABLED
@ -348,4 +348,4 @@ public:
Uint16 m_width, m_height;
std::vector<UiListItem *> m_vecItems;
};
} // namespace dvl
} // namespace devilution

8
SourceX/controls/axis_direction.h

@ -1,13 +1,15 @@
#pragma once
#include <stdint.h>
namespace devilution {
enum AxisDirectionX {
enum AxisDirectionX : uint8_t {
AxisDirectionX_NONE = 0,
AxisDirectionX_LEFT,
AxisDirectionX_RIGHT
};
enum AxisDirectionY {
enum AxisDirectionY : uint8_t {
AxisDirectionY_NONE = 0,
AxisDirectionY_UP,
AxisDirectionY_DOWN
@ -45,4 +47,4 @@ private:
int min_interval_ms_;
};
} // namespace dvl
} // namespace devilution

2
SourceX/controls/controller.h

@ -20,4 +20,4 @@ bool IsControllerButtonPressed(ControllerButton button);
bool HandleControllerAddedOrRemovedEvent(const SDL_Event &event);
} // namespace dvl
} // namespace devilution

6
SourceX/controls/controller_buttons.h

@ -1,11 +1,13 @@
#pragma once
// Unifies joystick, gamepad, and keyboard controller APIs.
#include <stdint.h>
namespace devilution {
// NOTE: A, B, X, Y refer to physical positions on an XBox 360 controller.
// A<->B and X<->Y are reversed on a Nintendo controller.
enum ControllerButton {
enum ControllerButton : uint8_t {
ControllerButton_NONE = 0,
ControllerButton_IGNORE,
ControllerButton_AXIS_TRIGGERLEFT, // ZL (aka L2)
@ -34,4 +36,4 @@ inline bool IsDPadButton(ControllerButton button)
|| button == ControllerButton_BUTTON_DPAD_RIGHT;
}
} // namespace dvl
} // namespace devilution

2
SourceX/controls/controller_motion.h

@ -24,4 +24,4 @@ bool ProcessControllerMotion(const SDL_Event &event, ControllerButtonEvent ctrl_
// Returns direction of the left thumb stick or DPad (if allow_dpad = true).
AxisDirection GetLeftStickOrDpadDirection(bool allow_dpad = true);
} // namespace dvl
} // namespace devilution

2
SourceX/controls/devices/game_controller.h

@ -38,5 +38,5 @@ private:
bool trigger_right_is_down_ = false;
};
} // namespace dvl
} // namespace devilution
#endif

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save