Skip to content

Commit

Permalink
🎨 Clean up overuse of SDL types
Browse files Browse the repository at this point in the history
  • Loading branch information
AJenbo committed Apr 24, 2021
1 parent 2754040 commit 7912e51
Show file tree
Hide file tree
Showing 59 changed files with 1,775 additions and 1,755 deletions.
20 changes: 10 additions & 10 deletions Source/DiabloUI/diabloui.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ enum _selhero_selections : uint8_t {
};

struct _uidefaultstats {
Uint16 strength;
Uint16 magic;
Uint16 dexterity;
Uint16 vitality;
uint16_t strength;
uint16_t magic;
uint16_t dexterity;
uint16_t vitality;
};

struct _uiheroinfo {
char name[16];
Uint16 level;
uint16_t level;
HeroClass heroclass;
Uint8 herorank;
Uint16 strength;
Uint16 magic;
Uint16 dexterity;
Uint16 vitality;
uint8_t herorank;
uint16_t strength;
uint16_t magic;
uint16_t dexterity;
uint16_t vitality;
bool hassaved;
bool spawned;
};
Expand Down
16 changes: 8 additions & 8 deletions Source/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,15 @@ void DrawSpellList(const CelOutputBuffer &out)
{
int c;
int s;
Uint64 mask;
uint64_t mask;

pSpell = SPL_INVALID;
infostr[0] = '\0';
int x = PANEL_X + 12 + SPLICONLENGTH * SPLROWICONLS;
int y = PANEL_Y - 17;
ClearPanel();

for (Sint32 i = RSPLTYPE_SKILL; i < RSPLTYPE_INVALID; i++) {
for (int i = RSPLTYPE_SKILL; i < RSPLTYPE_INVALID; i++) {
switch ((spell_type)i) {
case RSPLTYPE_SKILL:
SetSpellTrans(RSPLTYPE_SKILL);
Expand All @@ -405,7 +405,7 @@ void DrawSpellList(const CelOutputBuffer &out)
case RSPLTYPE_INVALID:
break;
}
Sint32 j = SPL_FIREBOLT;
int8_t j = SPL_FIREBOLT;
for (uint64_t spl = 1; j < MAX_SPELLS; spl <<= 1, j++) {
if ((mask & spl) == 0)
continue;
Expand Down Expand Up @@ -527,7 +527,7 @@ void SetSpeedSpell(int slot)

void ToggleSpell(int slot)
{
Uint64 spells;
uint64_t spells;

if (plr[myplr]._pSplHotKey[slot] == SPL_INVALID) {
return;
Expand Down Expand Up @@ -876,7 +876,7 @@ void DoSpeedBook()

if (plr[myplr]._pRSpell != SPL_INVALID) {
for (int i = RSPLTYPE_SKILL; i <= RSPLTYPE_CHARGES; i++) {
Uint64 spells;
uint64_t spells;
switch (i) {
case RSPLTYPE_SKILL:
spells = plr[myplr]._pAblSpells;
Expand All @@ -891,7 +891,7 @@ void DoSpeedBook()
spells = plr[myplr]._pISpells;
break;
}
Uint64 spell = 1;
uint64_t spell = 1;
for (int j = 1; j < MAX_SPELLS; j++) {
if ((spell & spells) != 0) {
if (j == plr[myplr]._pRSpell && i == plr[myplr]._pRSplType) {
Expand Down Expand Up @@ -1821,7 +1821,7 @@ void DrawSpellBook(const CelOutputBuffer &out)
}
CelDrawTo(out, sx, 348, pSBkBtnCel, sbooktab + 1, 76);
}
Uint64 spl = plr[myplr]._pMemSpells | plr[myplr]._pISpells | plr[myplr]._pAblSpells;
uint64_t spl = plr[myplr]._pMemSpells | plr[myplr]._pISpells | plr[myplr]._pAblSpells;

int yp = 55;
for (int i = 1; i < 8; i++) {
Expand Down Expand Up @@ -1877,7 +1877,7 @@ void CheckSBook()
{
if (MouseX >= RIGHT_PANEL + 11 && MouseX < RIGHT_PANEL + 48 && MouseY >= 18 && MouseY < 314) {
spell_id sn = SpellPages[sbooktab][(MouseY - 18) / 43];
Uint64 spl = plr[myplr]._pMemSpells | plr[myplr]._pISpells | plr[myplr]._pAblSpells;
uint64_t spl = plr[myplr]._pMemSpells | plr[myplr]._pISpells | plr[myplr]._pAblSpells;
if (sn != SPL_INVALID && (spl & GetSpellBitmask(sn)) != 0) {
spell_type st = RSPLTYPE_SPELL;
if ((plr[myplr]._pISpells & GetSpellBitmask(sn)) != 0) {
Expand Down
2 changes: 1 addition & 1 deletion Source/controls/plrctrls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int GetDistance(int dx, int dy, int maxDistance)
return 0;
}

Sint8 walkpath[MAX_PATH_LENGTH];
int8_t walkpath[MAX_PATH_LENGTH];
int steps = FindPath(PosOkPlayer, myplr, plr[myplr].position.future.x, plr[myplr].position.future.y, dx, dy, walkpath);
if (steps > maxDistance)
return 0;
Expand Down
2 changes: 0 additions & 2 deletions Source/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* Implementation of debug functions.
*/

#include <SDL.h>

#include "cursor.h"
#include "inv.h"
#include "spells.h"
Expand Down
20 changes: 10 additions & 10 deletions Source/drlg_l2.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
namespace devilution {

struct HALLNODE {
Sint32 nHallx1;
Sint32 nHally1;
Sint32 nHallx2;
Sint32 nHally2;
Sint32 nHalldir;
int nHallx1;
int nHally1;
int nHallx2;
int nHally2;
int nHalldir;
struct HALLNODE *pNext;
};

struct ROOMNODE {
Sint32 nRoomx1;
Sint32 nRoomy1;
Sint32 nRoomx2;
Sint32 nRoomy2;
Sint32 nRoomDest;
int nRoomx1;
int nRoomy1;
int nRoomx2;
int nRoomy2;
int nRoomDest;
};

extern BYTE predungeon[DMAXX][DMAXY];
Expand Down
2 changes: 1 addition & 1 deletion Source/drlg_l3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace devilution {
namespace {

/** This will be true if a lava pool has been generated for the level */
Uint8 lavapool;
uint8_t lavapool;
int lockoutcnt;
bool lockout[DMAXX][DMAXY];

Expand Down
2 changes: 1 addition & 1 deletion Source/effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ enum sfx_flag : uint8_t {
};

struct TSFX {
Uint8 bFlags;
uint8_t bFlags;
const char *pszName;
TSnd *pSnd;
};
Expand Down
12 changes: 6 additions & 6 deletions Source/encrypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
*/
#pragma once

#include <SDL.h>
#include <stdint.h>

#include "miniwin/miniwin.h"

namespace devilution {

struct TDataInfo {
Uint8 *srcData;
Uint32 srcOffset;
Uint8 *destData;
Uint32 destOffset;
Uint32 size;
BYTE *srcData;
uint32_t srcOffset;
BYTE *destData;
uint32_t destOffset;
uint32_t size;
};

void Decrypt(DWORD *castBlock, DWORD size, DWORD key);
Expand Down
26 changes: 13 additions & 13 deletions Source/gendung.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,25 +90,25 @@ struct ScrollStruct {
};

struct THEME_LOC {
Sint16 x;
Sint16 y;
Sint16 ttval;
Sint16 width;
Sint16 height;
int16_t x;
int16_t y;
int16_t ttval;
int16_t width;
int16_t height;
};

struct MICROS {
Uint16 mt[16];
uint16_t mt[16];
};

struct ShadowStruct {
Uint8 strig;
Uint8 s1;
Uint8 s2;
Uint8 s3;
Uint8 nv1;
Uint8 nv2;
Uint8 nv3;
uint8_t strig;
uint8_t s1;
uint8_t s2;
uint8_t s3;
uint8_t nv1;
uint8_t nv2;
uint8_t nv3;
};

extern BYTE dungeon[DMAXX][DMAXY];
Expand Down
4 changes: 3 additions & 1 deletion Source/gmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/
#pragma once

#include <stdint.h>

#include "engine.h"

namespace devilution {
Expand All @@ -13,7 +15,7 @@ namespace devilution {
#define GMENU_ENABLED 0x80000000

struct TMenuItem {
Uint32 dwFlags;
uint32_t dwFlags;
const char *pszStr;
void (*fnMenu)(bool);
};
Expand Down
6 changes: 4 additions & 2 deletions Source/interfac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* Implementation of load screens.
*/

#include <stdint.h>

#include "control.h"
#include "DiabloUI/art_draw.h"
#include "dx.h"
Expand All @@ -16,7 +18,7 @@
namespace devilution {

BYTE *sgpBackCel;
Uint32 sgdwProgress;
uint32_t sgdwProgress;
int progress_id;

/** The color used for the progress bar as an index into the palette. */
Expand Down Expand Up @@ -173,7 +175,7 @@ static void DrawCutscene()
DrawArt(out, PANEL_X - (ArtCutsceneWidescreen.w() - PANEL_WIDTH) / 2, UI_OFFSET_Y, &ArtCutsceneWidescreen);
CelDrawTo(out, PANEL_X, 480 - 1 + UI_OFFSET_Y, sgpBackCel, 1, 640);

for (Uint32 i = 0; i < sgdwProgress; i++) {
for (unsigned i = 0; i < sgdwProgress; i++) {
DrawProgress(
out,
BarPos[progress_id][0] + i + PANEL_X,
Expand Down
4 changes: 2 additions & 2 deletions Source/inv.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ enum item_color : uint8_t {
};

struct InvXY {
Sint32 X;
Sint32 Y;
int X;
int Y;
};

extern bool invflag;
Expand Down
68 changes: 34 additions & 34 deletions Source/itemdat.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,21 +420,21 @@ struct ItemDataStruct {
enum unique_base_item iItemId;
const char *iName;
const char *iSName;
Uint8 iMinMLvl;
Uint8 iDurability;
Uint8 iMinDam;
Uint8 iMaxDam;
Uint8 iMinAC;
Uint8 iMaxAC;
Uint8 iMinStr;
Uint8 iMinMag;
Uint8 iMinDex;
Sint32 iFlags; // item_special_effect as bit flags
uint8_t iMinMLvl;
uint8_t iDurability;
uint8_t iMinDam;
uint8_t iMaxDam;
uint8_t iMinAC;
uint8_t iMaxAC;
uint8_t iMinStr;
uint8_t iMinMag;
uint8_t iMinDex;
uint32_t iFlags; // item_special_effect as bit flags
enum item_misc_id iMiscId;
enum spell_id iSpell;
bool iUsable;
Uint16 iValue;
Uint16 iMaxValue;
uint16_t iValue;
uint16_t iMaxValue;
};

enum item_effect_type : int8_t {
Expand Down Expand Up @@ -556,42 +556,42 @@ enum affix_item_type : uint8_t {
struct PLStruct {
const char *PLName;
enum item_effect_type PLPower;
Sint32 PLParam1;
Sint32 PLParam2;
Sint8 PLMinLvl;
Sint32 PLIType; // affix_item_type as bit flags
int PLParam1;
int PLParam2;
int8_t PLMinLvl;
int PLIType; // affix_item_type as bit flags
enum goodorevil PLGOE;
bool PLDouble;
bool PLOk;
Sint32 PLMinVal;
Sint32 PLMaxVal;
Sint32 PLMultVal;
int PLMinVal;
int PLMaxVal;
int PLMultVal;
};

struct UItemStruct {
const char *UIName;
enum unique_base_item UIItemId;
Sint8 UIMinLvl;
Sint8 UINumPL;
Sint32 UIValue;
int8_t UIMinLvl;
int8_t UINumPL;
int UIValue;
enum item_effect_type UIPower1;
Sint32 UIParam1;
Sint32 UIParam2;
int UIParam1;
int UIParam2;
enum item_effect_type UIPower2;
Sint32 UIParam3;
Sint32 UIParam4;
int UIParam3;
int UIParam4;
enum item_effect_type UIPower3;
Sint32 UIParam5;
Sint32 UIParam6;
int UIParam5;
int UIParam6;
enum item_effect_type UIPower4;
Sint32 UIParam7;
Sint32 UIParam8;
int UIParam7;
int UIParam8;
enum item_effect_type UIPower5;
Sint32 UIParam9;
Sint32 UIParam10;
int UIParam9;
int UIParam10;
enum item_effect_type UIPower6;
Sint32 UIParam11;
Sint32 UIParam12;
int UIParam11;
int UIParam12;
};

extern ItemDataStruct AllItemsList[];
Expand Down
Loading

0 comments on commit 7912e51

Please sign in to comment.