Browse Source

Clean up signedness

pull/197/head
Anders Jenbo 7 years ago
parent
commit
5ab9f4609a
  1. 4
      Source/_render.cpp
  2. 2
      Source/automap.cpp
  3. 6
      Source/control.cpp
  4. 6
      Source/control.h
  5. 4
      Source/diablo.cpp
  6. 10
      Source/drlg_l1.cpp
  7. 2
      Source/drlg_l1.h
  8. 18
      Source/drlg_l4.h
  9. 2
      Source/dthread.cpp
  10. 2
      Source/dthread.h
  11. 2
      Source/fault.cpp
  12. 2
      Source/fault.h
  13. 2
      Source/interfac.h
  14. 8
      Source/items.cpp
  15. 6
      Source/loadsave.cpp
  16. 4
      Source/minitext.cpp
  17. 4
      Source/minitext.h
  18. 2
      Source/monstdat.cpp
  19. 2
      Source/monstdat.h
  20. 2
      Source/monster.h
  21. 2
      Source/multi.cpp
  22. 6
      Source/objects.cpp
  23. 2
      Source/objects.h
  24. 6
      Source/pfile.cpp
  25. 2
      Source/pfile.h
  26. 18
      Source/plrmsg.cpp
  27. 2
      Source/plrmsg.h
  28. 398
      Source/render.cpp
  29. 16
      Source/render.h
  30. 2
      Source/scrollrt.cpp
  31. 14
      Source/setmaps.cpp
  32. 14
      Source/setmaps.h
  33. 24
      structs.h

4
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

2
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)

6
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,

6
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 */

4
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);

10
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];
}
}

2
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;

18
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__ */

2
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;

2
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 */

2
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;

2
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);

2
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__ */

8
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

6
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();

4
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,

4
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 */

2
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,

2
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__ */

2
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 */

2
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];

6
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];
}
}

2
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];

6
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)

2
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);

18
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);

2
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 */

398
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

16
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];

2
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;

14
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,

14
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__ */

24
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;

Loading…
Cancel
Save