diff --git a/Source/_render.cpp b/Source/_render.cpp index f1f6ce061..582ce3786 100644 --- a/Source/_render.cpp +++ b/Source/_render.cpp @@ -2303,7 +2303,7 @@ __declspec(naked) void drawTopArchesUpperScreen(BYTE *pBuff) } } -__declspec(naked) void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) +__declspec(naked) void drawBottomArchesUpperScreen(BYTE *pBuff, DWORD *pMask) { __asm { push ebx @@ -7350,7 +7350,7 @@ __declspec(naked) void drawTopArchesLowerScreen(BYTE *pBuff) } } -__declspec(naked) void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) +__declspec(naked) void drawBottomArchesLowerScreen(BYTE *pBuff, DWORD *pMask) { __asm { push ebx diff --git a/Source/automap.cpp b/Source/automap.cpp index 034ed43d0..f2446d3c5 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -173,7 +173,7 @@ void DrawAutomap() return; } - gpBufEnd = (unsigned char *)&gpBuffer[(PANEL_Y) * BUFFER_WIDTH]; + gpBufEnd = &gpBuffer[(PANEL_Y) * BUFFER_WIDTH]; MapX = (ViewX - 16) >> 1; while (MapX + AutoMapXOfs < 0) diff --git a/Source/control.cpp b/Source/control.cpp index 56baf06d6..a4945e628 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -56,7 +56,7 @@ BOOL panbtndown; BYTE *pTalkPanel; int spselflag; -const unsigned char fontframe[128] = { +const BYTE fontframe[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, 44, 57, 58, 56, 55, 47, 40, 41, 59, 39, 50, 37, 51, 52, @@ -66,7 +66,7 @@ const unsigned char fontframe[128] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 40, 66, 41, 67, 0 }; -const unsigned char fontkern[68] = { +const BYTE fontkern[68] = { 8, 10, 7, 9, 8, 7, 6, 8, 8, 3, 3, 8, 6, 11, 9, 10, 6, 9, 9, 6, 9, 11, 10, 13, 10, 11, 7, 5, 7, 7, @@ -102,7 +102,7 @@ const int lineoffset[25] = { BUFFER_WIDTH * 606 + 241, BUFFER_WIDTH * 617 + 241 }; -const unsigned char gbFontTransTbl[256] = { +const BYTE gbFontTransTbl[256] = { // clang-format off '\0', 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, diff --git a/Source/control.h b/Source/control.h index 91507b899..9435477a9 100644 --- a/Source/control.h +++ b/Source/control.h @@ -121,10 +121,10 @@ void control_press_enter(); void control_up_down(int v); /* rdata */ -extern const unsigned char fontframe[128]; -extern const unsigned char fontkern[68]; +extern const BYTE fontframe[128]; +extern const BYTE fontkern[68]; extern const int lineoffset[25]; -extern const unsigned char gbFontTransTbl[256]; +extern const BYTE gbFontTransTbl[256]; /* data */ diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 6fd9239e7..0383993a5 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -1201,7 +1201,7 @@ void PressKey(int vkey) void diablo_pause_game() { - if ((unsigned char)gbMaxPlayers <= 1u) { + if (gbMaxPlayers <= 1) { if (PauseMode) { PauseMode = 0; } else { @@ -1483,7 +1483,7 @@ void LoadLvlGFX() { /// ASSERT: assert(! pDungeonCels); - switch ((unsigned char)leveltype) { + switch (leveltype) { case DTYPE_TOWN: pDungeonCels = LoadFileInMem("Levels\\TownData\\Town.CEL", NULL); pMegaTiles = LoadFileInMem("Levels\\TownData\\Town.TIL", NULL); diff --git a/Source/drlg_l1.cpp b/Source/drlg_l1.cpp index c9f454a49..7ac1efd76 100644 --- a/Source/drlg_l1.cpp +++ b/Source/drlg_l1.cpp @@ -1,6 +1,6 @@ #include "diablo.h" -char L5dungeon[80][80]; +BYTE L5dungeon[80][80]; BYTE L5dflags[DMAXX][DMAXY]; BOOL setloadflag; int HR1; @@ -1033,10 +1033,10 @@ void L5makeDmt() for (j = 0, dmty = 1; dmty <= 77; j++, dmty += 2) { for (i = 0, dmtx = 1; dmtx <= 77; i++, dmtx += 2) { - int val = (unsigned char)L5dungeon[dmtx + 1][dmty + 1]; /* todo: unsigned */ - val = 2 * val + (unsigned char)L5dungeon[dmtx][dmty + 1]; - val = 2 * val + (unsigned char)L5dungeon[dmtx + 1][dmty]; - val = 2 * val + (unsigned char)L5dungeon[dmtx][dmty]; + int val = L5dungeon[dmtx + 1][dmty + 1]; + val = 2 * val + L5dungeon[dmtx][dmty + 1]; + val = 2 * val + L5dungeon[dmtx + 1][dmty]; + val = 2 * val + L5dungeon[dmtx][dmty]; dungeon[i][j] = L5ConvTbl[val]; } } diff --git a/Source/drlg_l1.h b/Source/drlg_l1.h index ae9f38a61..b392eaa85 100644 --- a/Source/drlg_l1.h +++ b/Source/drlg_l1.h @@ -2,7 +2,7 @@ #ifndef __DRLG_L1_H__ #define __DRLG_L1_H__ -extern char L5dungeon[80][80]; +extern BYTE L5dungeon[80][80]; extern BYTE L5dflags[DMAXX][DMAXY]; extern BOOL setloadflag; extern int HR1; diff --git a/Source/drlg_l4.h b/Source/drlg_l4.h index 330c4f0a8..d4ec873d5 100644 --- a/Source/drlg_l4.h +++ b/Source/drlg_l4.h @@ -17,8 +17,8 @@ extern int SP4x1; extern int SP4x2; extern int SP4y1; extern int SP4y2; -extern unsigned char L4dungeon[80][80]; -extern unsigned char dung[20][20]; +extern BYTE L4dungeon[80][80]; +extern BYTE dung[20][20]; //int dword_52A4DC; void DRLG_LoadL4SP(); @@ -58,12 +58,12 @@ void DRLG_L4Corners(); void DRLG_L4Pass3(); /* rdata */ -extern const unsigned char L4ConvTbl[16]; -extern const unsigned char L4USTAIRS[42]; -extern const unsigned char L4TWARP[42]; -extern const unsigned char L4DSTAIRS[52]; -extern const unsigned char L4PENTA[52]; -extern const unsigned char L4PENTA2[52]; -extern const unsigned char L4BTYPES[140]; +extern const BYTE L4ConvTbl[16]; +extern const BYTE L4USTAIRS[42]; +extern const BYTE L4TWARP[42]; +extern const BYTE L4DSTAIRS[52]; +extern const BYTE L4PENTA[52]; +extern const BYTE L4PENTA2[52]; +extern const BYTE L4BTYPES[140]; #endif /* __DRLG_L4_H__ */ diff --git a/Source/dthread.cpp b/Source/dthread.cpp index 9449e1def..396ce655c 100644 --- a/Source/dthread.cpp +++ b/Source/dthread.cpp @@ -81,7 +81,7 @@ void dthread_start() } } -unsigned int __stdcall dthread_handler(void *unused) +unsigned int __stdcall dthread_handler(void *) { char *error_buf; TMegaPkt *pkt; diff --git a/Source/dthread.h b/Source/dthread.h index c029a277b..4ad5d3fb6 100644 --- a/Source/dthread.h +++ b/Source/dthread.h @@ -8,7 +8,7 @@ extern BOOLEAN dthread_running; void dthread_remove_player(int pnum); void dthread_send_delta(int pnum, char cmd, void *pbSrc, int dwLen); void dthread_start(); -unsigned int __stdcall dthread_handler(void *unused); +unsigned int __stdcall dthread_handler(void *); void dthread_cleanup(); /* data */ diff --git a/Source/fault.cpp b/Source/fault.cpp index bd158df68..261215e66 100644 --- a/Source/fault.cpp +++ b/Source/fault.cpp @@ -81,7 +81,7 @@ LONG __stdcall TopLevelExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo) return EXCEPTION_CONTINUE_SEARCH; } -void fault_hex_format(BYTE *ptr, unsigned int numBytes) +void fault_hex_format(BYTE *ptr, DWORD numBytes) { DWORD i, bytesRead; const char *fmt; diff --git a/Source/fault.h b/Source/fault.h index beb2e61ab..0dc743cbc 100644 --- a/Source/fault.h +++ b/Source/fault.h @@ -14,7 +14,7 @@ void fault_init_filter(); void fault_cleanup_filter_atexit(); LPTOP_LEVEL_EXCEPTION_FILTER __cdecl fault_cleanup_filter(); LONG __stdcall TopLevelExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo); -void fault_hex_format(BYTE *ptr, unsigned int numBytes); +void fault_hex_format(BYTE *ptr, DWORD numBytes); void fault_unknown_module(LPCVOID lpAddress, LPSTR lpModuleName, int iMaxLength, int *sectionNum, int *sectionOffset); void fault_call_stack(void *instr, STACK_FRAME *stackAddr); char *fault_get_error_type(DWORD dwMessageId, LPSTR lpString1, DWORD nSize); diff --git a/Source/interfac.h b/Source/interfac.h index 7686471b6..7b63e34cb 100644 --- a/Source/interfac.h +++ b/Source/interfac.h @@ -14,7 +14,7 @@ void InitCutscene(unsigned int uMsg); /* rdata */ -extern const unsigned char progress_bar_colours[3]; +extern const BYTE progress_bar_colours[3]; extern const int progress_bar_screen_pos[3][2]; #endif /* __INTERFAC_H__ */ diff --git a/Source/items.cpp b/Source/items.cpp index ff004d09b..208d9cf1d 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -310,14 +310,14 @@ void CalcPlrItemVals(int p, BOOL Loadgfx) unsigned __int64 spl = 0; // bitarray for all enabled/active spells - signed int fr = 0; // fire resistance - signed int lr = 0; // lightning resistance - signed int mr = 0; // magic resistance + int fr = 0; // fire resistance + int lr = 0; // lightning resistance + int mr = 0; // magic resistance int dmod = 0; // bonus damage mod? int ghit = 0; // increased damage from enemies - signed int lrad = 10; // light radius + int lrad = 10; // light radius int ihp = 0; // increased HP int imana = 0; // increased mana diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index a2b51b465..1e593e0df 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -282,10 +282,10 @@ void SaveGame() tbuff = SaveBuff; ISave('RETL'); - OSave((unsigned char)setlevel); + OSave(setlevel); WSave(setlvlnum); WSave(currlevel); - WSave((unsigned char)leveltype); + WSave(leveltype); WSave(ViewX); WSave(ViewY); OSave(invflag); @@ -514,7 +514,7 @@ void SaveLevel() int i, j; char szName[MAX_PATH]; int dwLen; - unsigned char *SaveBuff; + BYTE *SaveBuff; if (!currlevel) glSeedTbl[0] = GetRndSeed(); diff --git a/Source/minitext.cpp b/Source/minitext.cpp index 8d558d181..4d15cd67d 100644 --- a/Source/minitext.cpp +++ b/Source/minitext.cpp @@ -9,7 +9,7 @@ int sgLastScroll; void *pMedTextCels; void *pTextBoxCels; -const unsigned char mfontframe[127] = { +const BYTE mfontframe[127] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -24,7 +24,7 @@ const unsigned char mfontframe[127] = { 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 48, 0, 49, 0 }; -const unsigned char mfontkern[56] = { +const BYTE mfontkern[56] = { 5, 15, 10, 13, 14, 10, 9, 13, 11, 5, 5, 11, 10, 16, 13, 16, 10, 15, 12, 10, 14, 17, 17, 22, 17, 16, 11, 5, 11, 11, diff --git a/Source/minitext.h b/Source/minitext.h index e83883d3e..851ac220c 100644 --- a/Source/minitext.h +++ b/Source/minitext.h @@ -19,8 +19,8 @@ void DrawQText(); /* rdata */ -extern const unsigned char mfontframe[127]; -extern const unsigned char mfontkern[56]; +extern const BYTE mfontframe[127]; +extern const BYTE mfontkern[56]; /* data */ diff --git a/Source/monstdat.cpp b/Source/monstdat.cpp index 17b501168..980453653 100644 --- a/Source/monstdat.cpp +++ b/Source/monstdat.cpp @@ -134,7 +134,7 @@ char MonstConvTbl[128] = { 0, 0, 0, 0, 0, 0, 80, 111 }; -unsigned char MonstAvailTbl[112] = { +BYTE MonstAvailTbl[112] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, diff --git a/Source/monstdat.h b/Source/monstdat.h index b61679b2e..6922cb4db 100644 --- a/Source/monstdat.h +++ b/Source/monstdat.h @@ -4,7 +4,7 @@ extern MonsterData monsterdata[112]; extern char MonstConvTbl[128]; -extern unsigned char MonstAvailTbl[112]; +extern BYTE MonstAvailTbl[112]; extern UniqMonstStruct UniqMonst[98]; #endif /* __MONSTDAT_H__ */ diff --git a/Source/monster.h b/Source/monster.h index bb36d761e..8d0c9adac 100644 --- a/Source/monster.h +++ b/Source/monster.h @@ -163,7 +163,7 @@ void decode_enemy(int m, int enemy); /* rdata */ extern const char plr2monst[9]; -extern const unsigned char counsmiss[4]; +extern const BYTE counsmiss[4]; /* data */ diff --git a/Source/multi.cpp b/Source/multi.cpp index 3364b15ca..25b6c1491 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -22,7 +22,7 @@ char byte_678640; int sglTimeoutStart; int sgdwPlayerLeftReasonTbl[MAX_PLRS]; TBuffer sgLoPriBuf; -unsigned int sgdwGameLoops; +DWORD sgdwGameLoops; BYTE gbMaxPlayers; BOOLEAN sgbTimeout; char szPlayerName[128]; diff --git a/Source/objects.cpp b/Source/objects.cpp index b640aaa96..c891ce71d 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -53,7 +53,7 @@ char shrinemax[NUM_SHRINETYPE] = { 16, 16, 16, 16, 16, 16 }; // 0 - sp+mp, 1 - sp only, 2 - mp only -unsigned char shrineavail[NUM_SHRINETYPE] = { +BYTE shrineavail[NUM_SHRINETYPE] = { 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 2 @@ -1250,7 +1250,7 @@ void AddStoryBook(int i) object[i]._oVar2 = StoryText[bookframe][1]; if (currlevel == 12) object[i]._oVar2 = StoryText[bookframe][2]; - object[i]._oVar3 = ((unsigned int)currlevel >> 2) + 3 * bookframe - 1; + object[i]._oVar3 = (currlevel >> 2) + 3 * bookframe - 1; object[i]._oAnimFrame = 5 - 2 * bookframe; object[i]._oVar4 = object[i]._oAnimFrame + 1; } @@ -2371,7 +2371,7 @@ void ObjChangeMapResync(int x1, int y1, int x2, int y2) for (j = y1; j <= y2; j++) { for (i = x1; i <= x2; i++) { - ObjSetMini(i, j, (unsigned char)pdungeon[i][j]); + ObjSetMini(i, j, (BYTE)pdungeon[i][j]); dungeon[i][j] = pdungeon[i][j]; } } diff --git a/Source/objects.h b/Source/objects.h index 31807a27d..9c2c10f2b 100644 --- a/Source/objects.h +++ b/Source/objects.h @@ -159,7 +159,7 @@ extern int byadd[8]; extern char *shrinestrs[NUM_SHRINETYPE]; extern char shrinemin[NUM_SHRINETYPE]; extern char shrinemax[NUM_SHRINETYPE]; -extern unsigned char shrineavail[NUM_SHRINETYPE]; +extern BYTE shrineavail[NUM_SHRINETYPE]; extern char *StoryBookName[9]; extern int StoryText[3][3]; diff --git a/Source/pfile.cpp b/Source/pfile.cpp index 10fefc83b..23d38ff7a 100644 --- a/Source/pfile.cpp +++ b/Source/pfile.cpp @@ -208,13 +208,13 @@ void game_2_ui_player(const PlayerStruct *p, _uiheroinfo *heroinfo, BOOL bHasSav heroinfo->vitality = p->_pVitality; heroinfo->gold = p->_pGold; heroinfo->hassaved = bHasSaveFile; - heroinfo->herorank = (unsigned char)p->pDiabloKillLevel; + heroinfo->herorank = p->pDiabloKillLevel; heroinfo->spawned = 0; } -unsigned char game_2_ui_class(const PlayerStruct *p) +BYTE game_2_ui_class(const PlayerStruct *p) { - unsigned char uiclass; + BYTE uiclass; if (p->_pClass == PC_WARRIOR) uiclass = UI_WARRIOR; else if (p->_pClass == PC_ROGUE) diff --git a/Source/pfile.h b/Source/pfile.h index 94233dfea..f619748ec 100644 --- a/Source/pfile.h +++ b/Source/pfile.h @@ -16,7 +16,7 @@ BOOL pfile_create_player_description(char *dst, DWORD len); BOOL pfile_rename_hero(const char *name_1, const char *name_2); void pfile_flush_W(); void game_2_ui_player(const PlayerStruct *p, _uiheroinfo *heroinfo, BOOL bHasSaveFile); -unsigned char game_2_ui_class(const PlayerStruct *p); +BYTE game_2_ui_class(const PlayerStruct *p); BOOL __stdcall pfile_ui_set_hero_infos(BOOL(__stdcall *ui_add_hero_info)(_uiheroinfo *)); char *GetSaveDirectory(char *dst, int dst_size, DWORD save_num); BOOL pfile_read_hero(HANDLE archive, PkPlayerStruct *pPack); diff --git a/Source/plrmsg.cpp b/Source/plrmsg.cpp index 0ffc1c06b..5369377f5 100644 --- a/Source/plrmsg.cpp +++ b/Source/plrmsg.cpp @@ -1,6 +1,6 @@ #include "diablo.h" -static unsigned char plr_msg_slot; +static BYTE plr_msg_slot; _plrmsg plr_msgs[PMSG_COUNT]; const char text_color_from_player_num[MAX_PLRS + 1] = { COL_WHITE, COL_WHITE, COL_WHITE, COL_WHITE, COL_GOLD }; @@ -81,9 +81,9 @@ void InitPlrMsg() void DrawPlrMsg() { int i; - int x = 74; - int y = 230; - int width = 620; + DWORD x = 74; + DWORD y = 230; + DWORD width = 620; _plrmsg *pMsg; if (chrflag || questlog) { @@ -103,20 +103,20 @@ void DrawPlrMsg() } } -void PrintPlrMsg(unsigned int x, unsigned int y, unsigned int width, const char *str, unsigned char col) +void PrintPlrMsg(DWORD x, DWORD y, DWORD width, const char *str, BYTE col) { int line = 0; while (*str) { - unsigned char c; + BYTE c; int screen = PitchTbl[y] + x; const char *sstr = str; - unsigned int len = 0; + DWORD len = 0; const char *endstr = sstr; while (1) { if (*sstr) { - c = gbFontTransTbl[(unsigned char)*sstr++]; + c = gbFontTransTbl[(BYTE)*sstr++]; c = fontframe[c]; len += fontkern[c] + 1; if (!c) // allow wordwrap on blank glyph @@ -130,7 +130,7 @@ void PrintPlrMsg(unsigned int x, unsigned int y, unsigned int width, const char } while (str < endstr) { - c = gbFontTransTbl[(unsigned char)*str++]; + c = gbFontTransTbl[(BYTE)*str++]; c = fontframe[c]; if (c) CPrintString(screen, c, col); diff --git a/Source/plrmsg.h b/Source/plrmsg.h index 233ee80fe..10b78b48c 100644 --- a/Source/plrmsg.h +++ b/Source/plrmsg.h @@ -11,7 +11,7 @@ void SendPlrMsg(int pnum, const char *pszStr); void ClearPlrMsg(); void InitPlrMsg(); void DrawPlrMsg(); -void PrintPlrMsg(unsigned int x, unsigned int y, unsigned int width, const char *str, unsigned char just); +void PrintPlrMsg(DWORD x, DWORD y, DWORD width, const char *str, BYTE col); /* rdata */ diff --git a/Source/render.cpp b/Source/render.cpp index f1e87651a..d536eff08 100644 --- a/Source/render.cpp +++ b/Source/render.cpp @@ -2,13 +2,13 @@ #include "_asm.cpp" int WorldBoolFlag = 0; -unsigned int gdwCurrentMask = 0; +DWORD gdwCurrentMask = 0; // char world_4B3264 = 0; -unsigned char *gpCelFrame = NULL; -unsigned int *gpDrawMask = NULL; +BYTE *gpCelFrame = NULL; +DWORD *gpDrawMask = NULL; // char world_4B326D[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -unsigned int RightMask[32] = { +DWORD RightMask[32] = { 0xEAAAAAAA, 0xF5555555, 0xFEAAAAAA, 0xFF555555, 0xFFEAAAAA, 0xFFF55555, @@ -27,7 +27,7 @@ unsigned int RightMask[32] = { 0xFFFFFFFF, 0xFFFFFFFF }; -unsigned int LeftMask[32] = { +DWORD LeftMask[32] = { 0xAAAAAAAB, 0x5555555F, 0xAAAAAABF, 0x555555FF, 0xAAAAABFF, 0x55555FFF, @@ -46,7 +46,7 @@ unsigned int LeftMask[32] = { 0xFFFFFFFF, 0xFFFFFFFF }; -unsigned int WallMask[32] = { +DWORD WallMask[32] = { 0xAAAAAAAA, 0x55555555, 0xAAAAAAAA, 0x55555555, 0xAAAAAAAA, 0x55555555, @@ -116,35 +116,32 @@ int WorldTbl17_2[17] = { 0, 32, 60, 88, 112, 136, 156, 176, 192, 208, 220, 232, #else void drawTopArchesUpperScreen(BYTE *pBuff) { - unsigned char *dst; // edi MAPDST - unsigned char *tbl; // ebx - unsigned char *src; // esi MAPDST - short cel_type_16; // ax MAPDST - signed int xx_32; // ebp MAPDST - signed int yy_32; // edx MAPDST - unsigned int width; // eax MAPDST - unsigned int chk_sh_and; // ecx MAPDST - unsigned int n_draw_shift; // ecx MAPDST - unsigned int x_minus; // ecx MAPDST - unsigned int y_minus; // ecx MAPDST - signed int i; // edx MAPDST - signed int j; // ecx MAPDST + BYTE *dst, *src; + BYTE *tbl; + short cel_type_16; + unsigned int width; + unsigned int chk_sh_and; + unsigned int n_draw_shift; + unsigned int x_minus; + unsigned int y_minus; + int xx_32, yy_32; + int i, j; - gpCelFrame = (unsigned char *)SpeedFrameTbl; + gpCelFrame = (BYTE *)SpeedFrameTbl; dst = pBuff; if (!(BYTE)light_table_index) { if (level_cel_block & 0x8000) level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] - + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + + (WORD)(level_cel_block & 0xF000); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = ((level_cel_block >> 12) & 7) + 8; goto LABEL_11; } if ((BYTE)light_table_index != lightmax) { if (!(level_cel_block & 0x8000)) { - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); tbl = &pLightTbl[256 * light_table_index]; - cel_type_16 = (unsigned char)(level_cel_block >> 12); + cel_type_16 = (BYTE)(level_cel_block >> 12); switch (cel_type_16) { case 0: // upper (top transparent), with lighting i = 16; @@ -161,13 +158,13 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } while (i); break; case 1: // upper (top transparent), with lighting - WorldBoolFlag = (unsigned char)pBuff & 1; + WorldBoolFlag = (BYTE)pBuff & 1; xx_32 = 32; do { yy_32 = 32; do { while (1) { - width = (unsigned char)*src++; + width = *src++; if ((width & 0x80u) == 0) break; _LOBYTE(width) = -(char)width; @@ -178,7 +175,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } if (dst < gpBufEnd) return; - if (((unsigned char)dst & 1) == WorldBoolFlag) { + if (((BYTE)dst & 1) == WorldBoolFlag) { asm_trans_light_cel_0_2(width, tbl, &dst, &src); } else { asm_trans_light_cel_1_3(width, tbl, &dst, &src); @@ -235,7 +232,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } else { asm_trans_light_cel_1_3(32 - xx_32, tbl, &dst, &src); } - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; if (xx_32 < 0) { @@ -249,7 +246,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } else { asm_trans_light_cel_1_3(32 - yy_32, tbl, &dst, &src); } - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[yy_32 - (SCREEN_WIDTH + 160)]; yy_32 += 2; } while (yy_32 != 32); @@ -298,7 +295,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } else { asm_trans_light_cel_1_3(32 - xx_32, tbl, &dst, &src); } - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; if (xx_32 < 0) { @@ -321,9 +318,9 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } return; } - src = (unsigned char *)pSpeedCels + src = pSpeedCels + *(DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; - cel_type_16 = (unsigned char)(level_cel_block >> 12); + cel_type_16 = (BYTE)(level_cel_block >> 12); LABEL_11: switch (cel_type_16) { @@ -356,13 +353,13 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } while (i); break; case 9: // upper (top transparent), without lighting - WorldBoolFlag = (unsigned char)pBuff & 1; + WorldBoolFlag = (BYTE)pBuff & 1; yy_32 = 32; LABEL_251: xx_32 = 32; while (1) { while (1) { - width = (unsigned char)*src++; + width = *src++; if ((width & 0x80u) == 0) break; _LOBYTE(width) = -(char)width; @@ -380,7 +377,7 @@ void drawTopArchesUpperScreen(BYTE *pBuff) xx_32 -= width; if (dst < gpBufEnd) return; - if (((unsigned char)dst & 1) == WorldBoolFlag) { + if (((BYTE)dst & 1) == WorldBoolFlag) { chk_sh_and = width >> 1; if (!(width & 1)) goto LABEL_258; @@ -741,8 +738,8 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } if (level_cel_block & 0x8000) level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] - + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + + (WORD)(level_cel_block & 0xF000); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = (level_cel_block >> 12) & 7; switch (cel_type_16) { case 0: // upper (top transparent), black @@ -772,20 +769,20 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } while (i); break; case 1: // upper (top transparent), black - WorldBoolFlag = (unsigned char)pBuff & 1; + WorldBoolFlag = (BYTE)pBuff & 1; xx_32 = 32; while (1) { yy_32 = 32; do { while (1) { - width = (unsigned char)*src++; + width = *src++; if ((width & 0x80u) != 0) break; yy_32 -= width; if (dst < gpBufEnd) return; src += width; - if (((unsigned char)dst & 1) == WorldBoolFlag) { + if (((BYTE)dst & 1) == WorldBoolFlag) { chk_sh_and = width >> 1; if (!(width & 1)) goto LABEL_378; @@ -1140,28 +1137,26 @@ void drawTopArchesUpperScreen(BYTE *pBuff) } } -void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) +void drawBottomArchesUpperScreen(BYTE *pBuff, DWORD *pMask) { - unsigned char *dst; // edi MAPDST - unsigned char *src; // esi MAPDST - short cel_type_16; // ax MAPDST - int xx_32; // edx MAPDST - unsigned int left_shift; // edx MAPDST - int yy_32; // edx MAPDST - int width; // eax MAPDST - int and80_i; // ecx MAPDST - unsigned int n_draw_shift; // ecx MAPDST - signed int i; // ecx MAPDST - unsigned char *tbl; + BYTE *dst, *src; + BYTE *tbl; + short cel_type_16; + unsigned int left_shift; + unsigned int n_draw_shift; + int width; + int and80_i; + int i; + int xx_32, yy_32; - gpCelFrame = (unsigned char *)SpeedFrameTbl; + gpCelFrame = (BYTE *)SpeedFrameTbl; dst = pBuff; gpDrawMask = pMask; if (!(BYTE)light_table_index) { if (level_cel_block & 0x8000) level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] - + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + + (WORD)(level_cel_block & 0xF000); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = ((level_cel_block >> 12) & 7) + 8; LABEL_12: switch (cel_type_16) { @@ -1192,7 +1187,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) yy_32 = 32; do { while (1) { - width = (unsigned char)*src++; + width = *src++; if ((width & 0x80u) == 0) break; _LOBYTE(width) = -(char)width; @@ -1383,7 +1378,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) ++dst; --i; } while (i); - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst -= (SCREEN_WIDTH + 160); --gpDrawMask; --yy_32; @@ -1397,9 +1392,9 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) } if ((BYTE)light_table_index != lightmax) { if (!(level_cel_block & 0x8000)) { - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); tbl = &pLightTbl[256 * light_table_index]; - cel_type_16 = (unsigned char)(level_cel_block >> 12); + cel_type_16 = (BYTE)(level_cel_block >> 12); switch (cel_type_16) { case 0: // upper (bottom transparent), with lighting xx_32 = 32; @@ -1419,7 +1414,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) yy_32 = 32; do { while (1) { - width = (unsigned char)*src++; + width = *src++; if ((width & 0x80u) == 0) break; _LOBYTE(width) = -(char)width; @@ -1468,7 +1463,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) xx_32 = 30; while (dst >= gpBufEnd) { asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; if (xx_32 < 0) { @@ -1477,7 +1472,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) if (dst < gpBufEnd) break; asm_cel_light_edge(32 - yy_32, tbl, &dst, &src); - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[yy_32 - (SCREEN_WIDTH + 160)]; yy_32 += 2; } while (yy_32 != 32); @@ -1499,7 +1494,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) do { if (dst < gpBufEnd) break; - src += (unsigned char)src & 2; + src += (BYTE)src & 2; asm_trans_light_mask(32, tbl, &dst, &src, *gpDrawMask); dst -= (SCREEN_WIDTH + 160); --gpDrawMask; @@ -1513,7 +1508,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) xx_32 = 30; while (dst >= gpBufEnd) { asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; if (xx_32 < 0) { @@ -1523,7 +1518,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) if (dst < gpBufEnd) break; asm_trans_light_mask(32, tbl, &dst, &src, *gpDrawMask); - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst -= (SCREEN_WIDTH + 160); --gpDrawMask; --yy_32; @@ -1535,15 +1530,15 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) } return; } - src = (unsigned char *)pSpeedCels + src = pSpeedCels + *(DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; - cel_type_16 = (unsigned char)(level_cel_block >> 12); + cel_type_16 = (BYTE)(level_cel_block >> 12); goto LABEL_12; } if (level_cel_block & 0x8000) level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] - + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + + (WORD)(level_cel_block & 0xF000); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = (level_cel_block >> 12) & 7; switch (cel_type_16) { case 0: // upper (bottom transparent), black @@ -1572,7 +1567,7 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) yy_32 = 32; do { while (1) { - width = (unsigned char)*src++; + width = *src++; if ((width & 0x80u) == 0) break; _LOBYTE(width) = -(char)width; @@ -1776,17 +1771,14 @@ void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask) void drawUpperScreen(BYTE *pBuff) { - unsigned char *dst; // edi MAPDST - unsigned char *tbl; // ebx - unsigned char *src; // esi MAPDST - short cel_type_16; // ax MAPDST - signed int xx_32; // ebp MAPDST - signed int yy_32; // edx MAPDST - unsigned int width; // eax MAPDST - unsigned int chk_sh_and; // ecx MAPDST - unsigned int n_draw_shift; // ecx MAPDST - signed int i; // edx MAPDST - signed int j; // ecx MAPDST + BYTE *dst, *src; + BYTE *tbl; + short cel_type_16; + unsigned int width; + unsigned int chk_sh_and; + unsigned int n_draw_shift; + int i, j; + int xx_32, yy_32; if (cel_transparency_active) { if (!arch_draw_type) { @@ -1806,13 +1798,13 @@ void drawUpperScreen(BYTE *pBuff) } } } - gpCelFrame = (unsigned char *)SpeedFrameTbl; + gpCelFrame = (BYTE *)SpeedFrameTbl; dst = pBuff; if (!(BYTE)light_table_index) { if (level_cel_block & 0x8000) level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] - + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + + (WORD)(level_cel_block & 0xF000); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = ((level_cel_block >> 12) & 7) + 8; LABEL_22: switch (cel_type_16) { @@ -2038,9 +2030,9 @@ void drawUpperScreen(BYTE *pBuff) } if ((BYTE)light_table_index != lightmax) { if (!(level_cel_block & 0x8000)) { - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); tbl = &pLightTbl[256 * light_table_index]; - cel_type_16 = (unsigned short)level_cel_block >> 12; + cel_type_16 = (WORD)level_cel_block >> 12; switch (cel_type_16) { case 0: // upper (solid), with lighting xx_32 = 32; @@ -2104,7 +2096,7 @@ void drawUpperScreen(BYTE *pBuff) xx_32 = 30; while (dst >= gpBufEnd) { asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; if (xx_32 < 0) { @@ -2113,7 +2105,7 @@ void drawUpperScreen(BYTE *pBuff) if (dst < gpBufEnd) break; asm_cel_light_edge(32 - yy_32, tbl, &dst, &src); - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[yy_32 - (SCREEN_WIDTH + 160)]; yy_32 += 2; } while (yy_32 != 32); @@ -2146,7 +2138,7 @@ void drawUpperScreen(BYTE *pBuff) xx_32 = 30; while (dst >= gpBufEnd) { asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; if (xx_32 < 0) { @@ -2165,15 +2157,15 @@ void drawUpperScreen(BYTE *pBuff) } return; } - src = (unsigned char *)pSpeedCels + src = pSpeedCels + *(DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; - cel_type_16 = (unsigned short)level_cel_block >> 12; + cel_type_16 = (WORD)level_cel_block >> 12; goto LABEL_22; } if (level_cel_block & 0x8000) level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] - + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + + (WORD)(level_cel_block & 0xF000); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = ((unsigned int)level_cel_block >> 12) & 7; switch (cel_type_16) { case 0: // upper (solid), black @@ -2396,37 +2388,34 @@ void drawUpperScreen(BYTE *pBuff) void drawTopArchesLowerScreen(BYTE *pBuff) { - unsigned char *dst; // edi MAPDST - unsigned char *tbl; // ebx - unsigned char *src; // esi MAPDST - short cel_type_16; // ax MAPDST - signed int tile_42_45; // eax MAPDST - unsigned int world_tbl; // ecx MAPDST - unsigned int width; // eax MAPDST - unsigned int chk_sh_and; // ecx MAPDST - int xx_32; // edx MAPDST - unsigned int x_minus; // ecx MAPDST - unsigned int n_draw_shift; // ecx MAPDST - int yy_32; // edx MAPDST - unsigned int y_minus; // ecx MAPDST - signed int i; // edx MAPDST - signed int j; // ecx MAPDST + BYTE *dst, *src; + BYTE *tbl; + short cel_type_16; + unsigned int world_tbl; + unsigned int width; + unsigned int chk_sh_and; + unsigned int x_minus; + unsigned int n_draw_shift; + unsigned int y_minus; + int tile_42_45; + int xx_32, yy_32; + int i, j; - gpCelFrame = (unsigned char *)SpeedFrameTbl; + gpCelFrame = (BYTE *)SpeedFrameTbl; dst = pBuff; if (!(BYTE)light_table_index) { if (level_cel_block & 0x8000) level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] - + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + + (WORD)(level_cel_block & 0xF000); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = ((level_cel_block >> 12) & 7) + 8; goto LABEL_11; } if ((BYTE)light_table_index == lightmax) { if (level_cel_block & 0x8000) level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] - + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + + (WORD)(level_cel_block & 0xF000); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = (level_cel_block >> 12) & 7; switch (cel_type_16) { case 0: // lower (top transparent), black @@ -2462,13 +2451,13 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } while (i); break; case 1: // lower (top transparent), black - WorldBoolFlag = (unsigned char)pBuff & 1; + WorldBoolFlag = (BYTE)pBuff & 1; xx_32 = 32; LABEL_412: yy_32 = 32; while (1) { while (1) { - width = (unsigned char)*src++; + width = *src++; if ((width & 0x80u) == 0) break; _LOBYTE(width) = -(char)width; @@ -2486,7 +2475,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) yy_32 -= width; if (dst < gpBufEnd) { src += width; - if (((unsigned char)dst & 1) == WorldBoolFlag) { + if (((BYTE)dst & 1) == WorldBoolFlag) { chk_sh_and = width >> 1; if (!(width & 1)) goto LABEL_420; @@ -2867,9 +2856,9 @@ void drawTopArchesLowerScreen(BYTE *pBuff) return; } if (!(level_cel_block & 0x8000)) { - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); tbl = &pLightTbl[256 * light_table_index]; - cel_type_16 = (unsigned char)(level_cel_block >> 12); + cel_type_16 = (BYTE)(level_cel_block >> 12); switch (cel_type_16) { case 0: // lower (top transparent), with lighting i = 16; @@ -2892,13 +2881,13 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } while (i); break; case 1: // lower (top transparent), with lighting - WorldBoolFlag = (unsigned char)pBuff & 1; + WorldBoolFlag = (BYTE)pBuff & 1; xx_32 = 32; do { yy_32 = 32; do { while (1) { - width = (unsigned char)*src++; + width = *src++; if ((width & 0x80u) == 0) break; _LOBYTE(width) = -(char)width; @@ -2909,7 +2898,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } yy_32 -= width; if (dst < gpBufEnd) { - if (((unsigned char)dst & 1) == WorldBoolFlag) { + if (((BYTE)dst & 1) == WorldBoolFlag) { asm_trans_light_cel_0_2(width, tbl, &dst, &src); } else { asm_trans_light_cel_1_3(width, tbl, &dst, &src); @@ -3008,7 +2997,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } else { asm_trans_light_cel_1_3(32 - yy_32, tbl, &dst, &src); } - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[yy_32 - (SCREEN_WIDTH + 160)]; yy_32 += 2; } while (yy_32 != 32); @@ -3028,7 +3017,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } else { asm_trans_light_cel_1_3(32 - xx_32, tbl, &dst, &src); } - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; } while (xx_32 >= 0); @@ -3125,7 +3114,7 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } else { asm_trans_light_cel_1_3(32 - xx_32, tbl, &dst, &src); } - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; } while (xx_32 >= 0); @@ -3133,8 +3122,8 @@ void drawTopArchesLowerScreen(BYTE *pBuff) } return; } - src = (unsigned char *)pSpeedCels + *(DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; - cel_type_16 = (unsigned char)(level_cel_block >> 12); + src = pSpeedCels + *(DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; + cel_type_16 = (BYTE)(level_cel_block >> 12); LABEL_11: switch (cel_type_16) { case 8: // lower (top transparent), without lighting @@ -3172,18 +3161,18 @@ LABEL_11: } while (i); break; case 9: // lower (top transparent), without lighting - WorldBoolFlag = (unsigned char)pBuff & 1; + WorldBoolFlag = (BYTE)pBuff & 1; xx_32 = 32; while (1) { yy_32 = 32; do { while (1) { - width = (unsigned char)*src++; + width = *src++; if ((width & 0x80u) != 0) break; yy_32 -= width; if (dst < gpBufEnd) { - if (((unsigned char)dst & 1) == WorldBoolFlag) { + if (((BYTE)dst & 1) == WorldBoolFlag) { chk_sh_and = width >> 1; if (!(width & 1)) goto LABEL_280; @@ -3633,31 +3622,29 @@ LABEL_11: } } -void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) +void drawBottomArchesLowerScreen(BYTE *pBuff, DWORD *pMask) { - unsigned char *dst; // edi MAPDST - short cel_type_16; // ax MAPDST - unsigned char *src; // esi MAPDST - int and80_i; // ecx MAPDST - signed int tile_42_45; // eax MAPDST - unsigned int world_tbl; // ecx MAPDST - int xx_32; // ecx MAPDST - int yy_32; // edx MAPDST - int width; // eax MAPDST - unsigned int left_shift; // edx MAPDST - signed int i; // edx MAPDST - unsigned int n_draw_shift; // ecx MAPDST - unsigned char *tbl; + BYTE *dst, *src; + BYTE *tbl; + short cel_type_16; + int and80_i; + unsigned int world_tbl; + unsigned int left_shift; + unsigned int n_draw_shift; + int tile_42_45; + int width; + int xx_32, yy_32; + int i; - gpCelFrame = (unsigned char *)SpeedFrameTbl; + gpCelFrame = (BYTE *)SpeedFrameTbl; dst = pBuff; gpDrawMask = pMask; if ((BYTE)light_table_index) { if ((BYTE)light_table_index == lightmax) { if (level_cel_block & 0x8000) level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] - + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + + (WORD)(level_cel_block & 0xF000); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = (level_cel_block >> 12) & 7; switch (cel_type_16) { case 0: // lower (bottom transparent), black @@ -3689,7 +3676,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) yy_32 = 32; do { while (1) { - width = (unsigned char)*src++; + width = *src++; if ((width & 0x80u) != 0) break; yy_32 -= width; @@ -3915,9 +3902,9 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) return; } if (!(level_cel_block & 0x8000)) { - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); tbl = &pLightTbl[256 * light_table_index]; - cel_type_16 = (unsigned char)(level_cel_block >> 12); + cel_type_16 = (BYTE)(level_cel_block >> 12); switch (cel_type_16) { case 0: // lower (bottom transparent), with lighting yy_32 = 32; @@ -3940,7 +3927,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) yy_32 = 32; do { while (1) { - width = (unsigned char)*src++; + width = *src++; if ((width & 0x80u) != 0) break; yy_32 -= width; @@ -4026,7 +4013,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) do { asm_cel_light_edge(32 - yy_32, tbl, &dst, &src); /// BUGFIX: uncomment this line - // src += (unsigned char)src & 2; + // src += (BYTE)src & 2; dst = &dst[yy_32 - (SCREEN_WIDTH + 160)]; yy_32 += 2; } while (yy_32 != 32); @@ -4039,7 +4026,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) } do { asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; } while (xx_32 >= 0); @@ -4093,7 +4080,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) do { if (dst < gpBufEnd) { asm_trans_light_mask(32, tbl, &dst, &src, *gpDrawMask); - src += (unsigned char)src & 2; + src += (BYTE)src & 2; } else { src += 32; dst += 32; @@ -4111,7 +4098,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) } do { asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; } while (xx_32 >= 0); @@ -4119,14 +4106,14 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) } return; } - src = (unsigned char *)pSpeedCels + src = pSpeedCels + *(DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; - cel_type_16 = (unsigned char)(level_cel_block >> 12); + cel_type_16 = (BYTE)(level_cel_block >> 12); } else { if (level_cel_block & 0x8000) level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] - + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + + (WORD)(level_cel_block & 0xF000); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = ((level_cel_block >> 12) & 7) + 8; } switch (cel_type_16) { @@ -4160,7 +4147,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) yy_32 = 32; do { while (1) { - width = (unsigned char)*src++; + width = *src++; if ((width & 0x80u) != 0) break; yy_32 -= width; @@ -4393,7 +4380,7 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) ++dst; --i; } while (i); - src += (unsigned char)src & 2; + src += (BYTE)src & 2; } else { src += 32; dst += 32; @@ -4429,19 +4416,16 @@ void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask) void drawLowerScreen(BYTE *pBuff) { - unsigned char *dst; // edi MAPDST - unsigned char *src; // esi MAPDST - unsigned char *tbl; // ebx - short cel_type_16; // ax MAPDST - int xx_32; // edx MAPDST - int yy_32; // ebp MAPDST - unsigned int chk_sh_and; // ecx MAPDST - signed int tile_42_45; // eax MAPDST - unsigned int world_tbl; // ecx MAPDST - unsigned int n_draw_shift; // ecx MAPDST - unsigned int width; // eax MAPDST - signed int i; // edx MAPDST - signed int j; // ecx MAPDST + BYTE *dst, *src; + BYTE *tbl; + short cel_type_16; + unsigned int chk_sh_and; + unsigned int world_tbl; + unsigned int n_draw_shift; + unsigned int width; + int tile_42_45; + int xx_32, yy_32; + int i, j; if (cel_transparency_active) { if (!arch_draw_type) { @@ -4461,14 +4445,14 @@ void drawLowerScreen(BYTE *pBuff) } } } - gpCelFrame = (unsigned char *)SpeedFrameTbl; + gpCelFrame = (BYTE *)SpeedFrameTbl; dst = pBuff; if ((BYTE)light_table_index) { if ((BYTE)light_table_index == lightmax) { if (level_cel_block & 0x8000) level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] - + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + + (WORD)(level_cel_block & 0xF000); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = (level_cel_block >> 12) & 7; switch (cel_type_16) { case 0: // lower (solid), black @@ -4495,7 +4479,7 @@ void drawLowerScreen(BYTE *pBuff) yy_32 = 32; do { while (1) { - width = (unsigned char)*src++; + width = *src++; if ((width & 0x80u) == 0) break; _LOBYTE(width) = -(char)width; @@ -4717,9 +4701,9 @@ void drawLowerScreen(BYTE *pBuff) return; } if (!(level_cel_block & 0x8000)) { - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); tbl = &pLightTbl[256 * light_table_index]; - cel_type_16 = (unsigned short)level_cel_block >> 12; + cel_type_16 = (WORD)level_cel_block >> 12; switch (cel_type_16) { case 0: // lower (solid), with lighting xx_32 = 32; @@ -4739,7 +4723,7 @@ void drawLowerScreen(BYTE *pBuff) do { yy_32 = 32; do { - width = (unsigned char)*src++; + width = *src++; if ((width & 0x80u) == 0) { yy_32 -= width; if (dst < gpBufEnd) { @@ -4818,7 +4802,7 @@ void drawLowerScreen(BYTE *pBuff) } do { asm_cel_light_edge(32 - yy_32, tbl, &dst, &src); - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[yy_32 - (SCREEN_WIDTH + 160)]; yy_32 += 2; } while (yy_32 != 32); @@ -4831,7 +4815,7 @@ void drawLowerScreen(BYTE *pBuff) } do { asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; } while (xx_32 >= 0); @@ -4898,7 +4882,7 @@ void drawLowerScreen(BYTE *pBuff) } do { asm_cel_light_edge(32 - xx_32, tbl, &dst, &src); - src += (unsigned char)src & 2; + src += (BYTE)src & 2; dst = &dst[xx_32 - (SCREEN_WIDTH + 160)]; xx_32 -= 2; } while (xx_32 >= 0); @@ -4906,14 +4890,14 @@ void drawLowerScreen(BYTE *pBuff) } return; } - src = (unsigned char *)pSpeedCels + src = pSpeedCels + *(DWORD *)&gpCelFrame[4 * (light_table_index + 16 * (level_cel_block & 0xFFF))]; - cel_type_16 = (unsigned short)level_cel_block >> 12; + cel_type_16 = (WORD)level_cel_block >> 12; } else { if (level_cel_block & 0x8000) level_cel_block = *(DWORD *)&gpCelFrame[64 * (level_cel_block & 0xFFF)] - + (unsigned short)(level_cel_block & 0xF000); - src = (unsigned char *)pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); + + (WORD)(level_cel_block & 0xF000); + src = pDungeonCels + *((DWORD *)pDungeonCels + (level_cel_block & 0xFFF)); cel_type_16 = (((unsigned int)level_cel_block >> 12) & 7) + 8; } switch (cel_type_16) { @@ -4942,7 +4926,7 @@ void drawLowerScreen(BYTE *pBuff) yy_32 = 32; do { while (1) { - width = (unsigned char)*src++; + width = *src++; if ((width & 0x80u) == 0) break; _LOBYTE(width) = -(char)width; @@ -5209,40 +5193,40 @@ void drawLowerScreen(BYTE *pBuff) void world_draw_black_tile(BYTE *pBuff) { - unsigned char *dst; // edi MAPDST - signed int xx_32; // edx - signed int i; // ebx MAPDST - signed int j; // ecx MAPDST - signed int yy_32; // edx + BYTE *dst; + int i, j; + int xx, yy; dst = pBuff; - xx_32 = 30; - for (i = 1;; ++i) { - dst += xx_32; + + xx = 30; + for (i = 1;; i++) { + dst += xx; j = i; do { *(DWORD *)dst = 0; dst += 4; - --j; + j--; } while (j); - dst = &dst[xx_32 - 832]; - if (!xx_32) + dst = &dst[xx - 832]; + if (!xx) break; - xx_32 -= 2; + xx -= 2; } - yy_32 = 2; + + yy = 2; i = 15; do { - dst += yy_32; + dst += yy; j = i; do { *(DWORD *)dst = 0; dst += 4; - --j; + j--; } while (j); - dst = &dst[yy_32 - 832]; - --i; - yy_32 += 2; - } while (yy_32 != 32); + dst = &dst[yy - 832]; + i--; + yy += 2; + } while (yy != 32); } #endif diff --git a/Source/render.h b/Source/render.h index 6c5aec946..f872fb7aa 100644 --- a/Source/render.h +++ b/Source/render.h @@ -3,24 +3,24 @@ #define __RENDER_H__ void drawTopArchesUpperScreen(BYTE *pBuff); -void drawBottomArchesUpperScreen(BYTE *pBuff, unsigned int *pMask); +void drawBottomArchesUpperScreen(BYTE *pBuff, DWORD *pMask); void drawUpperScreen(BYTE *pBuff); void drawTopArchesLowerScreen(BYTE *pBuff); -void drawBottomArchesLowerScreen(BYTE *pBuff, unsigned int *pMask); +void drawBottomArchesLowerScreen(BYTE *pBuff, DWORD *pMask); void drawLowerScreen(BYTE *pBuff); void world_draw_black_tile(BYTE *pBuff); /* rdata */ extern int WorldBoolFlag; -extern unsigned int gdwCurrentMask; +extern DWORD gdwCurrentMask; // extern char world_4B3264; -extern unsigned char *gpCelFrame; -extern unsigned int *gpDrawMask; +extern BYTE *gpCelFrame; +extern DWORD *gpDrawMask; // extern char world_4B326D[16]; -extern unsigned int RightMask[32]; -extern unsigned int LeftMask[32]; -extern unsigned int WallMask[32]; +extern DWORD RightMask[32]; +extern DWORD LeftMask[32]; +extern DWORD WallMask[32]; extern int WorldTbl3x16[48]; extern int WorldTbl17_1[17]; extern int WorldTbl17_2[17]; diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 70d265b34..cbcb1f2df 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -1358,7 +1358,7 @@ void scrollrt_draw_clipped_dungeon_2(BYTE *pBuff, int sx, int sy, int skipChunks } } -void scrollrt_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, signed int CelSkip, int sx, int sy) +void scrollrt_draw_clipped_e_flag_2(BYTE *pBuff, int x, int y, int skipChunks, int CelSkip, int sx, int sy) { int lti_old, cta_old, lpi_old; BYTE *dst; diff --git a/Source/setmaps.cpp b/Source/setmaps.cpp index a4f466d8c..94dd659a1 100644 --- a/Source/setmaps.cpp +++ b/Source/setmaps.cpp @@ -1,17 +1,17 @@ #include "diablo.h" // BUGFIX: constant data should be const -unsigned char SkelKingTrans1[8] = { +BYTE SkelKingTrans1[8] = { 19, 47, 26, 55, 26, 49, 30, 53 }; -unsigned char SkelKingTrans2[8] = { +BYTE SkelKingTrans2[8] = { 33, 19, 47, 29, 37, 29, 43, 39 }; -unsigned char SkelKingTrans3[20] = { +BYTE SkelKingTrans3[20] = { 27, 53, 35, 61, 27, 35, 34, 42, 45, 35, 53, 43, @@ -19,7 +19,7 @@ unsigned char SkelKingTrans3[20] = { 31, 39, 49, 57 }; -unsigned char SkelKingTrans4[28] = { +BYTE SkelKingTrans4[28] = { 49, 45, 58, 51, 57, 31, 62, 37, 63, 31, 69, 40, @@ -29,7 +29,7 @@ unsigned char SkelKingTrans4[28] = { 79, 43, 89, 53 }; -unsigned char SkelChamTrans1[20] = { +BYTE SkelChamTrans1[20] = { 43, 19, 50, 26, 51, 19, 59, 26, 35, 27, 42, 34, @@ -37,12 +37,12 @@ unsigned char SkelChamTrans1[20] = { 50, 27, 59, 34 }; -unsigned char SkelChamTrans2[8] = { +BYTE SkelChamTrans2[8] = { 19, 31, 34, 47, 34, 35, 42, 42 }; -unsigned char SkelChamTrans3[36] = { +BYTE SkelChamTrans3[36] = { 43, 35, 50, 42, 51, 35, 62, 42, 63, 31, 66, 46, diff --git a/Source/setmaps.h b/Source/setmaps.h index 8b86f3048..e5a3a0338 100644 --- a/Source/setmaps.h +++ b/Source/setmaps.h @@ -10,13 +10,13 @@ void DRLG_SetMapTrans(char *sFileName); void LoadSetMap(); /* rdata */ -extern unsigned char SkelKingTrans1[8]; -extern unsigned char SkelKingTrans2[8]; -extern unsigned char SkelKingTrans3[20]; -extern unsigned char SkelKingTrans4[28]; -extern unsigned char SkelChamTrans1[20]; -extern unsigned char SkelChamTrans2[8]; -extern unsigned char SkelChamTrans3[36]; +extern BYTE SkelKingTrans1[8]; +extern BYTE SkelKingTrans2[8]; +extern BYTE SkelKingTrans3[20]; +extern BYTE SkelKingTrans4[28]; +extern BYTE SkelChamTrans1[20]; +extern BYTE SkelChamTrans2[8]; +extern BYTE SkelChamTrans3[36]; extern char *quest_level_names[]; #endif /* __SETMAPS_H__ */ diff --git a/structs.h b/structs.h index 494860fba..c0f5a77d6 100644 --- a/structs.h +++ b/structs.h @@ -1210,26 +1210,26 @@ typedef struct DeadStruct { typedef struct _gamedata { int dwSeed; - unsigned char bDiff; + BYTE bDiff; } _gamedata; typedef struct _uidefaultstats { - unsigned short strength; - unsigned short magic; - unsigned short dexterity; - unsigned short vitality; + WORD strength; + WORD magic; + WORD dexterity; + WORD vitality; } _uidefaultstats; typedef struct _uiheroinfo { struct _uiheroinfo *next; char name[16]; - unsigned short level; - unsigned char heroclass; - unsigned char herorank; - unsigned short strength; - unsigned short magic; - unsigned short dexterity; - unsigned short vitality; + WORD level; + BYTE heroclass; + BYTE herorank; + WORD strength; + WORD magic; + WORD dexterity; + WORD vitality; int gold; int hassaved; int spawned;