From f1c216e68897976a6d9a3b4759db32ffadf0e278 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Tue, 7 Apr 2020 03:11:45 +0200 Subject: [PATCH 01/33] Make player struct x/y fields match monster struct --- Source/automap.cpp | 8 +- Source/cursor.cpp | 4 +- Source/debug.cpp | 2 +- Source/diablo.cpp | 8 +- Source/effects.cpp | 4 +- Source/interfac.cpp | 2 +- Source/inv.cpp | 56 +++---- Source/items.cpp | 2 +- Source/lighting.cpp | 4 +- Source/missiles.cpp | 86 +++++------ Source/monster.cpp | 52 +++---- Source/msg.cpp | 20 +-- Source/multi.cpp | 36 ++--- Source/objects.cpp | 74 ++++----- Source/pack.cpp | 8 +- Source/player.cpp | 356 ++++++++++++++++++++++---------------------- Source/quests.cpp | 6 +- Source/scrollrt.cpp | 2 +- Source/spells.cpp | 14 +- Source/sync.cpp | 4 +- Source/towners.cpp | 12 +- Source/trigs.cpp | 16 +- structs.h | 4 +- 23 files changed, 390 insertions(+), 390 deletions(-) diff --git a/Source/automap.cpp b/Source/automap.cpp index f4c6286e7..feb25ad67 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -445,15 +445,15 @@ void DrawAutomapPlr() int x, y; if (plr[myplr]._pmode == PM_WALK3) { - x = plr[myplr]._px; - y = plr[myplr]._py; + x = plr[myplr]._pfutx; + y = plr[myplr]._pfuty; if (plr[myplr]._pdir == DIR_W) x++; else y++; } else { - x = plr[myplr].WorldX; - y = plr[myplr].WorldY; + x = plr[myplr]._px; + y = plr[myplr]._py; } px = x - 2 * AutoMapXOfs - ViewX; py = y - 2 * AutoMapYOfs - ViewY; diff --git a/Source/cursor.cpp b/Source/cursor.cpp index 8fa3aa31b..66c70a3bf 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -488,7 +488,7 @@ void CheckCursMove() } if (dFlags[mx][my] & BFLAG_DEAD_PLAYER) { for (i = 0; i < MAX_PLRS; i++) { - if (plr[i].WorldX == mx && plr[i].WorldY == my && i != myplr) { + if (plr[i]._px == mx && plr[i]._py == my && i != myplr) { cursmx = mx; cursmy = my; pcursplr = i; @@ -500,7 +500,7 @@ void CheckCursMove() for (yy = -1; yy < 2; yy++) { if (dFlags[mx + xx][my + yy] & BFLAG_DEAD_PLAYER) { for (i = 0; i < MAX_PLRS; i++) { - if (plr[i].WorldX == mx + xx && plr[i].WorldY == my + yy && i != myplr) { + if (plr[i]._px == mx + xx && plr[i]._py == my + yy && i != myplr) { cursmx = mx + xx; cursmy = my + yy; pcursplr = i; diff --git a/Source/debug.cpp b/Source/debug.cpp index 243a763f1..01882320e 100644 --- a/Source/debug.cpp +++ b/Source/debug.cpp @@ -211,7 +211,7 @@ void PrintDebugPlayer(BOOL bNextPlayer) NetSendCmdString(1 << myplr, dstr); sprintf(dstr, " Lvl = %i : Change = %i", plr[dbgplr].plrlevel, plr[dbgplr]._pLvlChanging); NetSendCmdString(1 << myplr, dstr); - sprintf(dstr, " x = %i, y = %i : tx = %i, ty = %i", plr[dbgplr].WorldX, plr[dbgplr].WorldY, plr[dbgplr]._ptargx, plr[dbgplr]._ptargy); + sprintf(dstr, " x = %i, y = %i : tx = %i, ty = %i", plr[dbgplr]._px, plr[dbgplr]._py, plr[dbgplr]._ptargx, plr[dbgplr]._ptargy); NetSendCmdString(1 << myplr, dstr); sprintf(dstr, " mode = %i : daction = %i : walk[0] = %i", plr[dbgplr]._pmode, plr[dbgplr].destAction, plr[dbgplr].walkpath[0]); NetSendCmdString(1 << myplr, dstr); diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 3a7c39778..4212497d4 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -860,7 +860,7 @@ BOOL LeftMouseCmd(BOOL bShift) if (pcursitem == -1 && pcursmonst == -1 && pcursplr == -1) return TRUE; } else { - bNear = abs(plr[myplr].WorldX - cursmx) < 2 && abs(plr[myplr].WorldY - cursmy) < 2; + bNear = abs(plr[myplr]._px - cursmx) < 2 && abs(plr[myplr]._py - cursmy) < 2; if (pcursitem != -1 && pcurs == CURSOR_HAND && !bShift) { NetSendCmdLocParam1(TRUE, invflag ? CMD_GOTOGETITEM : CMD_GOTOAGETITEM, cursmx, cursmy, pcursitem); } else if (pcursobj != -1 && (!bShift || bNear && object[pcursobj]._oBreak == 1)) { @@ -1491,7 +1491,7 @@ void PressChar(int vkey) case 'T': case 't': if (debug_mode_key_inverted_v) { - sprintf(tempstr, "PX = %i PY = %i", plr[myplr].WorldX, plr[myplr].WorldY); + sprintf(tempstr, "PX = %i PY = %i", plr[myplr]._px, plr[myplr]._py); NetSendCmdString(1 << myplr, tempstr); sprintf(tempstr, "CX = %i CY = %i DP = %i", cursmx, cursmy, dungeon[cursmx][cursmy]); NetSendCmdString(1 << myplr, tempstr); @@ -1791,11 +1791,11 @@ void LoadGameLevel(BOOL firstflag, int lvldir) if (plr[i].plractive && plr[i].plrlevel == currlevel && (!plr[i]._pLvlChanging || i == myplr)) { if (plr[i]._pHitPoints > 0) { if (gbMaxPlayers == 1) - dPlayer[plr[i].WorldX][plr[i].WorldY] = i + 1; + dPlayer[plr[i]._px][plr[i]._py] = i + 1; else SyncInitPlrPos(i); } else { - dFlags[plr[i].WorldX][plr[i].WorldY] |= BFLAG_DEAD_PLAYER; + dFlags[plr[i]._px][plr[i]._py] |= BFLAG_DEAD_PLAYER; } } } diff --git a/Source/effects.cpp b/Source/effects.cpp index 9285a0121..68bb52a29 100644 --- a/Source/effects.cpp +++ b/Source/effects.cpp @@ -1016,8 +1016,8 @@ BOOL calc_snd_position(int x, int y, int *plVolume, int *plPan) { int pan, volume; - x -= plr[myplr].WorldX; - y -= plr[myplr].WorldY; + x -= plr[myplr]._px; + y -= plr[myplr]._py; pan = (x - y) << 8; *plPan = pan; diff --git a/Source/interfac.cpp b/Source/interfac.cpp index 8c987f123..b4232a765 100644 --- a/Source/interfac.cpp +++ b/Source/interfac.cpp @@ -230,7 +230,7 @@ void ShowProgress(unsigned int uMsg) saveProc = SetWindowProc(saveProc); /// ASSERT: assert(saveProc == DisableInputWndProc); - NetSendCmdLocParam1(TRUE, CMD_PLAYER_JOINLEVEL, plr[myplr].WorldX, plr[myplr].WorldY, plr[myplr].plrlevel); + NetSendCmdLocParam1(TRUE, CMD_PLAYER_JOINLEVEL, plr[myplr]._px, plr[myplr]._py, plr[myplr].plrlevel); plrmsg_delay(FALSE); ResetPal(); diff --git a/Source/inv.cpp b/Source/inv.cpp index 0b621d6dc..b518f5da1 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -1510,7 +1510,7 @@ void InvGetItem(int pnum, int ii) if (dItem[item[ii]._ix][item[ii]._iy]) { if (myplr == pnum && pcurs >= CURSOR_FIRSTITEM) - NetSendCmdPItem(TRUE, CMD_SYNCPUTITEM, plr[myplr].WorldX, plr[myplr].WorldY); + NetSendCmdPItem(TRUE, CMD_SYNCPUTITEM, plr[myplr]._px, plr[myplr]._py); item[ii]._iCreateInfo &= ~0x8000; plr[pnum].HoldItem = item[ii]; CheckQuestItem(pnum); @@ -1765,22 +1765,22 @@ BOOL TryInvPut() if (numitems >= 127) return FALSE; - dir = GetDirection(plr[myplr].WorldX, plr[myplr].WorldY, cursmx, cursmy); - if (CanPut(plr[myplr].WorldX + offset_x[dir], plr[myplr].WorldY + offset_y[dir])) { + dir = GetDirection(plr[myplr]._px, plr[myplr]._py, cursmx, cursmy); + if (CanPut(plr[myplr]._px + offset_x[dir], plr[myplr]._py + offset_y[dir])) { return TRUE; } dir = (dir - 1) & 7; - if (CanPut(plr[myplr].WorldX + offset_x[dir], plr[myplr].WorldY + offset_y[dir])) { + if (CanPut(plr[myplr]._px + offset_x[dir], plr[myplr]._py + offset_y[dir])) { return TRUE; } dir = (dir + 2) & 7; - if (CanPut(plr[myplr].WorldX + offset_x[dir], plr[myplr].WorldY + offset_y[dir])) { + if (CanPut(plr[myplr]._px + offset_x[dir], plr[myplr]._py + offset_y[dir])) { return TRUE; } - return CanPut(plr[myplr].WorldX, plr[myplr].WorldY); + return CanPut(plr[myplr]._px, plr[myplr]._py); } void DrawInvMsg(char *msg) @@ -1810,28 +1810,28 @@ int InvPutItem(int pnum, int x, int y) SyncGetItem(x, y, plr[pnum].HoldItem.IDidx, plr[pnum].HoldItem._iCreateInfo, plr[pnum].HoldItem._iSeed); } - d = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, x, y); - xx = x - plr[pnum].WorldX; - yy = y - plr[pnum].WorldY; + d = GetDirection(plr[pnum]._px, plr[pnum]._py, x, y); + xx = x - plr[pnum]._px; + yy = y - plr[pnum]._py; if (abs(xx) > 1 || abs(yy) > 1) { - x = plr[pnum].WorldX + offset_x[d]; - y = plr[pnum].WorldY + offset_y[d]; + x = plr[pnum]._px + offset_x[d]; + y = plr[pnum]._py + offset_y[d]; } if (!CanPut(x, y)) { d = (d - 1) & 7; - x = plr[pnum].WorldX + offset_x[d]; - y = plr[pnum].WorldY + offset_y[d]; + x = plr[pnum]._px + offset_x[d]; + y = plr[pnum]._py + offset_y[d]; if (!CanPut(x, y)) { d = (d + 2) & 7; - x = plr[pnum].WorldX + offset_x[d]; - y = plr[pnum].WorldY + offset_y[d]; + x = plr[pnum]._px + offset_x[d]; + y = plr[pnum]._py + offset_y[d]; if (!CanPut(x, y)) { done = FALSE; for (l = 1; l < 50 && !done; l++) { for (j = -l; j <= l && !done; j++) { - yp = j + plr[pnum].WorldY; + yp = j + plr[pnum]._py; for (i = -l; i <= l && !done; i++) { - xp = i + plr[pnum].WorldX; + xp = i + plr[pnum]._px; if (CanPut(xp, yp)) { done = TRUE; x = xp; @@ -1879,28 +1879,28 @@ int SyncPutItem(int pnum, int x, int y, int idx, WORD icreateinfo, int iseed, in SyncGetItem(x, y, idx, icreateinfo, iseed); } - d = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, x, y); - xx = x - plr[pnum].WorldX; - yy = y - plr[pnum].WorldY; + d = GetDirection(plr[pnum]._px, plr[pnum]._py, x, y); + xx = x - plr[pnum]._px; + yy = y - plr[pnum]._py; if (abs(xx) > 1 || abs(yy) > 1) { - x = plr[pnum].WorldX + offset_x[d]; - y = plr[pnum].WorldY + offset_y[d]; + x = plr[pnum]._px + offset_x[d]; + y = plr[pnum]._py + offset_y[d]; } if (!CanPut(x, y)) { d = (d - 1) & 7; - x = plr[pnum].WorldX + offset_x[d]; - y = plr[pnum].WorldY + offset_y[d]; + x = plr[pnum]._px + offset_x[d]; + y = plr[pnum]._py + offset_y[d]; if (!CanPut(x, y)) { d = (d + 2) & 7; - x = plr[pnum].WorldX + offset_x[d]; - y = plr[pnum].WorldY + offset_y[d]; + x = plr[pnum]._px + offset_x[d]; + y = plr[pnum]._py + offset_y[d]; if (!CanPut(x, y)) { done = FALSE; for (l = 1; l < 50 && !done; l++) { for (j = -l; j <= l && !done; j++) { - yp = j + plr[pnum].WorldY; + yp = j + plr[pnum]._py; for (i = -l; i <= l && !done; i++) { - xp = i + plr[pnum].WorldX; + xp = i + plr[pnum]._px; if (CanPut(xp, yp)) { done = TRUE; x = xp; diff --git a/Source/items.cpp b/Source/items.cpp index b83a139db..7a51f1d94 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -2532,7 +2532,7 @@ void DoRepair(int pnum, int cii) ItemStruct *pi; p = &plr[pnum]; - PlaySfxLoc(IS_REPAIR, p->WorldX, p->WorldY); + PlaySfxLoc(IS_REPAIR, p->_px, p->_py); if (cii >= NUM_INVLOC) { pi = &p->InvList[cii - NUM_INVLOC]; diff --git a/Source/lighting.cpp b/Source/lighting.cpp index adde0a7f0..5446a221a 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -983,7 +983,7 @@ void ToggleLighting_2() memset(dLight, lightmax, sizeof(dLight)); for (i = 0; i < MAX_PLRS; i++) { if (plr[i].plractive && plr[i].plrlevel == currlevel) { - DoLighting(plr[i].WorldX, plr[i].WorldY, plr[i]._pLightRad, -1); + DoLighting(plr[i]._px, plr[i]._py, plr[i]._pLightRad, -1); } } } @@ -1001,7 +1001,7 @@ void ToggleLighting() memcpy(dLight, dPreLight, sizeof(dLight)); for (i = 0; i < MAX_PLRS; i++) { if (plr[i].plractive && plr[i].plrlevel == currlevel) { - DoLighting(plr[i].WorldX, plr[i].WorldY, plr[i]._pLightRad, -1); + DoLighting(plr[i]._px, plr[i]._py, plr[i]._pLightRad, -1); } } } diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 649ae6b9e..f9be5c521 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -668,8 +668,8 @@ BOOL MonsterMHit(int pnum, int m, int mindam, int maxdam, int dist, int t, BOOLE if (!monster[m]._msquelch) { monster[m]._msquelch = UCHAR_MAX; - monster[m]._lastx = plr[pnum].WorldX; - monster[m]._lasty = plr[pnum].WorldY; + monster[m]._lastx = plr[pnum]._px; + monster[m]._lasty = plr[pnum]._py; } return TRUE; } @@ -796,12 +796,12 @@ BOOL PlayerMHit(int pnum, int m, int dist, int mind, int maxd, int mtype, BOOLEA SyncPlrKill(pnum, earflag); } else { if (plr[pnum]._pClass == PC_WARRIOR) { - PlaySfxLoc(PS_WARR69, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(PS_WARR69, plr[pnum]._px, plr[pnum]._py); #ifndef SPAWN } else if (plr[pnum]._pClass == PC_ROGUE) { - PlaySfxLoc(PS_ROGUE69, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(PS_ROGUE69, plr[pnum]._px, plr[pnum]._py); } else if (plr[pnum]._pClass == PC_SORCERER) { - PlaySfxLoc(PS_MAGE69, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(PS_MAGE69, plr[pnum]._px, plr[pnum]._py); #endif } drawhpflag = TRUE; @@ -809,7 +809,7 @@ BOOL PlayerMHit(int pnum, int m, int dist, int mind, int maxd, int mtype, BOOLEA } else { if (blk < blkper) { if (m != -1) { - tac = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, monster[m]._mx, monster[m]._my); + tac = GetDirection(plr[pnum]._px, plr[pnum]._py, monster[m]._mx, monster[m]._my); } else { tac = plr[pnum]._pdir; } @@ -933,10 +933,10 @@ BOOL Plr2PlrMHit(int pnum, int p, int mindam, int maxdam, int dist, int mtype, B } else { return TRUE; } - PlaySfxLoc(tac, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(tac, plr[pnum]._px, plr[pnum]._py); } else { if (blkper < blk) { - StartPlrBlock(p, GetDirection(plr[p].WorldX, plr[p].WorldY, plr[pnum].WorldX, plr[pnum].WorldY)); + StartPlrBlock(p, GetDirection(plr[p]._px, plr[p]._py, plr[pnum]._px, plr[pnum]._py)); } else { if (pnum == myplr) NetSendCmdDamage(TRUE, p, dam); @@ -1409,8 +1409,8 @@ void AddLightball(int mi, int sx, int sy, int dx, int dy, int midir, char mienem missile[mi]._miVar1 = sx; missile[mi]._miVar2 = sy; } else { - missile[mi]._miVar1 = plr[id].WorldX; - missile[mi]._miVar2 = plr[id].WorldY; + missile[mi]._miVar1 = plr[id]._px; + missile[mi]._miVar2 = plr[id]._py; } } @@ -2414,8 +2414,8 @@ void AddDiabApoca(int mi, int sx, int sy, int dx, int dy, int midir, char mienem for (pnum = 0; pnum < gbMaxPlayers; pnum++) { if (plr[pnum].plractive) { - if (LineClear(sx, sy, plr[pnum]._px, plr[pnum]._py)) { - AddMissile(0, 0, plr[pnum]._px, plr[pnum]._py, 0, MIS_BOOM2, mienemy, id, dam, 0); + if (LineClear(sx, sy, plr[pnum]._pfutx, plr[pnum]._pfuty)) { + AddMissile(0, 0, plr[pnum]._pfutx, plr[pnum]._pfuty, 0, MIS_BOOM2, mienemy, id, dam, 0); } } } @@ -2839,8 +2839,8 @@ void MI_Fireball(int i) missile[i]._mirange--; if (missile[i]._micaster == 0) { - px = plr[id].WorldX; - py = plr[id].WorldY; + px = plr[id]._px; + py = plr[id]._py; } else { px = monster[id]._mx; py = monster[id]._my; @@ -3030,7 +3030,7 @@ void MI_Town(int i) } for (p = 0; p < MAX_PLRS; p++) { - if (plr[p].plractive && currlevel == plr[p].plrlevel && !plr[p]._pLvlChanging && plr[p]._pmode == PM_STAND && plr[p].WorldX == missile[i]._mix && plr[p].WorldY == missile[i]._miy) { + if (plr[p].plractive && currlevel == plr[p].plrlevel && !plr[p]._pLvlChanging && plr[p]._pmode == PM_STAND && plr[p]._px == missile[i]._mix && plr[p]._py == missile[i]._miy) { ClrPlrPath(p); if (p == myplr) { NetSendCmdParam1(TRUE, CMD_WARP, missile[i]._misource); @@ -3094,16 +3094,16 @@ void MI_Manashield(int i) int id, diff; id = missile[i]._misource; - missile[i]._mix = plr[id].WorldX; - missile[i]._miy = plr[id].WorldY; + missile[i]._mix = plr[id]._px; + missile[i]._miy = plr[id]._py; missile[i]._mitxoff = plr[id]._pxoff << 16; missile[i]._mityoff = plr[id]._pyoff << 16; if (plr[id]._pmode == PM_WALK3) { + missile[i]._misx = plr[id]._pfutx; + missile[i]._misy = plr[id]._pfuty; + } else { missile[i]._misx = plr[id]._px; missile[i]._misy = plr[id]._py; - } else { - missile[i]._misx = plr[id].WorldX; - missile[i]._misy = plr[id].WorldY; } GetMissilePos(i); if (plr[id]._pmode == PM_WALK3) { @@ -3170,16 +3170,16 @@ void MI_Etherealize(int i) missile[i]._mirange--; src = missile[i]._misource; - missile[i]._mix = plr[src].WorldX; - missile[i]._miy = plr[src].WorldY; + missile[i]._mix = plr[src]._px; + missile[i]._miy = plr[src]._py; missile[i]._mitxoff = plr[src]._pxoff << 16; missile[i]._mityoff = plr[src]._pyoff << 16; if (plr[src]._pmode == PM_WALK3) { + missile[i]._misx = plr[src]._pfutx; + missile[i]._misy = plr[src]._pfuty; + } else { missile[i]._misx = plr[src]._px; missile[i]._misy = plr[src]._py; - } else { - missile[i]._misx = plr[src].WorldX; - missile[i]._misy = plr[src].WorldY; } GetMissilePos(i); if (plr[src]._pmode == PM_WALK3) { @@ -3434,24 +3434,24 @@ void MI_Teleport(int i) if (missile[i]._mirange <= 0) { missile[i]._miDelFlag = TRUE; } else { - dPlayer[plr[id].WorldX][plr[id].WorldY] = 0; - PlrClrTrans(plr[id].WorldX, plr[id].WorldY); - plr[id].WorldX = missile[i]._mix; - plr[id].WorldY = missile[i]._miy; - plr[id]._px = plr[id].WorldX; - plr[id]._py = plr[id].WorldY; - plr[id]._poldx = plr[id].WorldX; - plr[id]._poldy = plr[id].WorldY; - PlrDoTrans(plr[id].WorldX, plr[id].WorldY); + dPlayer[plr[id]._px][plr[id]._py] = 0; + PlrClrTrans(plr[id]._px, plr[id]._py); + plr[id]._px = missile[i]._mix; + plr[id]._py = missile[i]._miy; + plr[id]._pfutx = plr[id]._px; + plr[id]._pfuty = plr[id]._py; + plr[id]._poldx = plr[id]._px; + plr[id]._poldy = plr[id]._py; + PlrDoTrans(plr[id]._px, plr[id]._py); missile[i]._miVar1 = 1; - dPlayer[plr[id].WorldX][plr[id].WorldY] = id + 1; + dPlayer[plr[id]._px][plr[id]._py] = id + 1; if (leveltype != DTYPE_TOWN) { - ChangeLightXY(plr[id]._plid, plr[id].WorldX, plr[id].WorldY); - ChangeVisionXY(plr[id]._pvid, plr[id].WorldX, plr[id].WorldY); + ChangeLightXY(plr[id]._plid, plr[id]._px, plr[id]._py); + ChangeVisionXY(plr[id]._pvid, plr[id]._px, plr[id]._py); } if (id == myplr) { - ViewX = plr[id].WorldX - ScrollInfo._sdx; - ViewY = plr[id].WorldY - ScrollInfo._sdy; + ViewX = plr[id]._px - ScrollInfo._sdx; + ViewY = plr[id]._py - ScrollInfo._sdy; } } } @@ -3557,8 +3557,8 @@ void mi_null_32(int i) by = missile[i]._miy; enemy = monster[src]._menemy; if (!(monster[src]._mFlags & MFLAG_TARGETS_MONSTER)) { - cx = plr[enemy].WorldX; - cy = plr[enemy].WorldY; + cx = plr[enemy]._px; + cy = plr[enemy]._py; } else { cx = monster[enemy]._mx; cy = monster[enemy]._my; @@ -3887,8 +3887,8 @@ void MI_Element(int i) if (missile[i]._miAnimType == MFILE_BIGEXP) { cx = missile[i]._mix; cy = missile[i]._miy; - px = plr[id].WorldX; - py = plr[id].WorldY; + px = plr[id]._px; + py = plr[id]._py; ChangeLight(missile[i]._mlid, cx, cy, missile[i]._miAnimFrame); if (!CheckBlock(px, py, cx, cy)) CheckMissileCol(i, dam, dam, TRUE, cx, cy, TRUE); diff --git a/Source/monster.cpp b/Source/monster.cpp index d3c4527ec..5c51ff4cf 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -511,8 +511,8 @@ void ClrAllMonsters() Monst->_mFlags = 0; Monst->_mDelFlag = FALSE; Monst->_menemy = random_(89, gbActivePlayers); - Monst->_menemyx = plr[Monst->_menemy]._px; - Monst->_menemyy = plr[Monst->_menemy]._py; + Monst->_menemyx = plr[Monst->_menemy]._pfutx; + Monst->_menemyy = plr[Monst->_menemy]._pfuty; } } @@ -1136,22 +1136,22 @@ void M_Enemy(int i) for (pnum = 0; pnum < MAX_PLRS; pnum++) { if (!plr[pnum].plractive || currlevel != plr[pnum].plrlevel || plr[pnum]._pLvlChanging || (plr[pnum]._pHitPoints == 0 && gbMaxPlayers != 1)) continue; - if (dTransVal[Monst->_mx][Monst->_my] == dTransVal[plr[pnum].WorldX][plr[pnum].WorldY]) + if (dTransVal[Monst->_mx][Monst->_my] == dTransVal[plr[pnum]._px][plr[pnum]._py]) sameroom = TRUE; else sameroom = FALSE; - if (abs(Monst->_mx - plr[pnum].WorldX) > abs(Monst->_my - plr[pnum].WorldY)) - dist = Monst->_mx - plr[pnum].WorldX; + if (abs(Monst->_mx - plr[pnum]._px) > abs(Monst->_my - plr[pnum]._py)) + dist = Monst->_mx - plr[pnum]._px; else - dist = Monst->_my - plr[pnum].WorldY; + dist = Monst->_my - plr[pnum]._py; dist = abs(dist); if ((sameroom && !bestsameroom) || ((sameroom || !bestsameroom) && dist < best_dist) || (_menemy == -1)) { Monst->_mFlags &= ~MFLAG_TARGETS_MONSTER; _menemy = pnum; - enemyx = plr[pnum]._px; - enemyy = plr[pnum]._py; + enemyx = plr[pnum]._pfutx; + enemyy = plr[pnum]._pfuty; best_dist = dist; bestsameroom = sameroom; } @@ -1505,8 +1505,8 @@ void M_StartHit(int i, int pnum, int dam) if (pnum >= 0) { monster[i]._mFlags &= ~MFLAG_TARGETS_MONSTER; monster[i]._menemy = pnum; - monster[i]._menemyx = plr[pnum]._px; - monster[i]._menemyy = plr[pnum]._py; + monster[i]._menemyx = plr[pnum]._pfutx; + monster[i]._menemyy = plr[pnum]._pfuty; monster[i]._mdir = M_GetDir(i); } if (monster[i].MType->mtype == MT_BLINK) { @@ -2048,8 +2048,8 @@ void M_TryH2HHit(int i, int pnum, int Hit, int MinDam, int MaxDam) } if (plr[pnum]._pHitPoints >> 6 <= 0 || plr[pnum]._pInvincible || plr[pnum]._pSpellFlags & 1) return; - dx = abs(monster[i]._mx - plr[pnum].WorldX); - dy = abs(monster[i]._my - plr[pnum].WorldY); + dx = abs(monster[i]._mx - plr[pnum]._px); + dy = abs(monster[i]._my - plr[pnum]._py); if (dx >= 2 || dy >= 2) return; @@ -2088,7 +2088,7 @@ void M_TryH2HHit(int i, int pnum, int Hit, int MinDam, int MaxDam) if (hper >= hit) return; if (blkper < blk) { - StartPlrBlock(pnum, GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, monster[i]._mx, monster[i]._my)); + StartPlrBlock(pnum, GetDirection(plr[pnum]._px, plr[pnum]._py, monster[i]._mx, monster[i]._my)); return; } if (monster[i].MType->mtype == MT_YZOMBIE && pnum == myplr) { @@ -2152,11 +2152,11 @@ void M_TryH2HHit(int i, int pnum, int Hit, int MinDam, int MaxDam) if (monster[i]._mFlags & MFLAG_KNOCKBACK) { if (plr[pnum]._pmode != PM_GOTHIT) StartPlrHit(pnum, 0, TRUE); - newx = plr[pnum].WorldX + offset_x[monster[i]._mdir]; - newy = plr[pnum].WorldY + offset_y[monster[i]._mdir]; + newx = plr[pnum]._px + offset_x[monster[i]._mdir]; + newy = plr[pnum]._py + offset_y[monster[i]._mdir]; if (PosOkPlayer(pnum, newx, newy)) { - plr[pnum].WorldX = newx; - plr[pnum].WorldY = newy; + plr[pnum]._px = newx; + plr[pnum]._py = newy; FixPlayerLocation(pnum, plr[pnum]._pdir); FixPlrWalkTags(pnum); dPlayer[newx][newy] = pnum + 1; @@ -4343,7 +4343,7 @@ void MAI_Lazurus(int i) md = M_GetDir(i); if (dFlags[mx][my] & BFLAG_VISIBLE) { if (gbMaxPlayers == 1) { - if (Monst->mtalkmsg == TEXT_VILE13 && Monst->_mgoal == MGOAL_INQUIRING && plr[myplr].WorldX == TEXT_VILE13 && plr[myplr].WorldY == 46) { + if (Monst->mtalkmsg == TEXT_VILE13 && Monst->_mgoal == MGOAL_INQUIRING && plr[myplr]._px == TEXT_VILE13 && plr[myplr]._py == 46) { PlayInGameMovie("gendata\\fprst3.smk"); Monst->_mmode = MM_TALK; quests[Q_BETRAYER]._qvar1 = 5; @@ -4560,12 +4560,12 @@ void ProcessMonsters() if ((DWORD)_menemy >= MAX_PLRS) { app_fatal("Illegal enemy player %d for monster \"%s\"", _menemy, Monst->mName); } - Monst->_menemyx = plr[Monst->_menemy]._px; - Monst->_menemyy = plr[Monst->_menemy]._py; + Monst->_menemyx = plr[Monst->_menemy]._pfutx; + Monst->_menemyy = plr[Monst->_menemy]._pfuty; if (dFlags[mx][my] & BFLAG_VISIBLE) { Monst->_msquelch = 255; - Monst->_lastx = plr[Monst->_menemy]._px; - Monst->_lasty = plr[Monst->_menemy]._py; + Monst->_lastx = plr[Monst->_menemy]._pfutx; + Monst->_lasty = plr[Monst->_menemy]._pfuty; } else if (Monst->_msquelch != 0 && Monst->_mAi != MT_DIABLO) { /// BUGFIX: change '_mAi' to 'MType->mtype' Monst->_msquelch--; } @@ -5153,8 +5153,8 @@ void MissToMonst(int i, int x, int y) newx = oldx + offset_x[Monst->_mdir]; newy = oldy + offset_y[Monst->_mdir]; if (PosOkPlayer(pnum, newx, newy)) { - plr[pnum].WorldX = newx; - plr[pnum].WorldY = newy; + plr[pnum]._px = newx; + plr[pnum]._py = newy; FixPlayerLocation(pnum, plr[pnum]._pdir); FixPlrWalkTags(pnum); dPlayer[newx][newy] = pnum + 1; @@ -5538,8 +5538,8 @@ void decode_enemy(int m, int enemy) if (enemy < MAX_PLRS) { monster[m]._mFlags &= ~MFLAG_TARGETS_MONSTER; monster[m]._menemy = enemy; - monster[m]._menemyx = plr[enemy]._px; - monster[m]._menemyy = plr[enemy]._py; + monster[m]._menemyx = plr[enemy]._pfutx; + monster[m]._menemyy = plr[enemy]._pfuty; } else { monster[m]._mFlags |= MFLAG_TARGETS_MONSTER; enemy -= MAX_PLRS; diff --git a/Source/msg.cpp b/Source/msg.cpp index c8f825f7c..5e50813f4 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -1449,7 +1449,7 @@ DWORD On_GETITEM(TCmd *pCmd, int pnum) if ((currlevel == p->bLevel || p->bPnum == myplr) && p->bMaster != myplr) { if (p->bPnum == myplr) { if (currlevel != p->bLevel) { - ii = SyncPutItem(myplr, plr[myplr].WorldX, plr[myplr].WorldY, p->wIndx, p->wCI, p->dwSeed, p->bId, p->bDur, p->bMDur, p->bCh, p->bMCh, p->wValue, p->dwBuff); + ii = SyncPutItem(myplr, plr[myplr]._px, plr[myplr]._py, p->wIndx, p->wCI, p->dwSeed, p->bId, p->bDur, p->bMDur, p->bCh, p->bMCh, p->wValue, p->dwBuff); if (ii != -1) InvGetItem(myplr, ii); } else @@ -1571,7 +1571,7 @@ DWORD On_AGETITEM(TCmd *pCmd, int pnum) if ((currlevel == p->bLevel || p->bPnum == myplr) && p->bMaster != myplr) { if (p->bPnum == myplr) { if (currlevel != p->bLevel) { - int ii = SyncPutItem(myplr, plr[myplr].WorldX, plr[myplr].WorldY, p->wIndx, p->wCI, p->dwSeed, p->bId, p->bDur, p->bMDur, p->bCh, p->bMCh, p->wValue, p->dwBuff); + int ii = SyncPutItem(myplr, plr[myplr]._px, plr[myplr]._py, p->wIndx, p->wCI, p->dwSeed, p->bId, p->bDur, p->bMDur, p->bCh, p->bMCh, p->wValue, p->dwBuff); if (ii != -1) AutoGetItem(myplr, ii); } else @@ -1863,8 +1863,8 @@ DWORD On_ATTACKID(TCmd *pCmd, int pnum) TCmdParam1 *p = (TCmdParam1 *)pCmd; if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - int distx = abs(plr[pnum].WorldX - monster[p->wParam1]._mfutx); - int disty = abs(plr[pnum].WorldY - monster[p->wParam1]._mfuty); + int distx = abs(plr[pnum]._px - monster[p->wParam1]._mfutx); + int disty = abs(plr[pnum]._py - monster[p->wParam1]._mfuty); if (distx > 1 || disty > 1) MakePlrPath(pnum, monster[p->wParam1]._mfutx, monster[p->wParam1]._mfuty, FALSE); plr[pnum].destAction = ACTION_ATTACKMON; @@ -1879,7 +1879,7 @@ DWORD On_ATTACKPID(TCmd *pCmd, int pnum) TCmdParam1 *p = (TCmdParam1 *)pCmd; if (gbBufferMsgs != 1 && currlevel == plr[pnum].plrlevel) { - MakePlrPath(pnum, plr[p->wParam1]._px, plr[p->wParam1]._py, FALSE); + MakePlrPath(pnum, plr[p->wParam1]._pfutx, plr[p->wParam1]._pfuty, FALSE); plr[pnum].destAction = ACTION_ATTACKPLR; plr[pnum].destParam1 = p->wParam1; } @@ -2121,7 +2121,7 @@ DWORD On_AWAKEGOLEM(TCmd *pCmd, int pnum) } } if (addGolem) - AddMissile(plr[pnum].WorldX, plr[pnum].WorldY, p->_mx, p->_my, p->_mdir, MIS_GOLEM, 0, pnum, 0, 1); + AddMissile(plr[pnum]._px, plr[pnum]._py, p->_mx, p->_my, p->_mdir, MIS_GOLEM, 0, pnum, 0, 1); } return sizeof(*p); @@ -2349,8 +2349,8 @@ DWORD On_PLAYER_JOINLEVEL(TCmd *pCmd, int pnum) } if (plr[pnum].plractive && myplr != pnum) { - plr[pnum].WorldX = p->x; - plr[pnum].WorldY = p->y; + plr[pnum]._px = p->x; + plr[pnum]._py = p->y; plr[pnum].plrlevel = p->wParam1; plr[pnum]._pGFXLoad = 0; if (currlevel == plr[pnum].plrlevel) { @@ -2365,10 +2365,10 @@ DWORD On_PLAYER_JOINLEVEL(TCmd *pCmd, int pnum) NewPlrAnim(pnum, plr[pnum]._pDAnim[0], plr[pnum]._pDFrames, 1, plr[pnum]._pDWidth); plr[pnum]._pAnimFrame = plr[pnum]._pAnimLen - 1; plr[pnum]._pVar8 = plr[pnum]._pAnimLen << 1; - dFlags[plr[pnum].WorldX][plr[pnum].WorldY] |= BFLAG_DEAD_PLAYER; + dFlags[plr[pnum]._px][plr[pnum]._py] |= BFLAG_DEAD_PLAYER; } - plr[pnum]._pvid = AddVision(plr[pnum].WorldX, plr[pnum].WorldY, plr[pnum]._pLightRad, pnum == myplr); + plr[pnum]._pvid = AddVision(plr[pnum]._px, plr[pnum]._py, plr[pnum]._pLightRad, pnum == myplr); plr[pnum]._plid = -1; } } diff --git a/Source/multi.cpp b/Source/multi.cpp index c4c9f4a42..1eca34566 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -128,8 +128,8 @@ void multi_send_packet(void *packet, BYTE dwSize) void NetRecvPlrData(TPkt *pkt) { pkt->hdr.wCheck = 'ip'; - pkt->hdr.px = plr[myplr].WorldX; - pkt->hdr.py = plr[myplr].WorldY; + pkt->hdr.px = plr[myplr]._px; + pkt->hdr.py = plr[myplr]._py; pkt->hdr.targx = plr[myplr]._ptargx; pkt->hdr.targy = plr[myplr]._ptargy; pkt->hdr.php = plr[myplr]._pHitPoints; @@ -485,31 +485,31 @@ void multi_process_network_packets() plr[dwID]._pBaseDex = pkt->bdex; if (!cond && plr[dwID].plractive && plr[dwID]._pHitPoints) { if (currlevel == plr[dwID].plrlevel && !plr[dwID]._pLvlChanging) { - dx = abs(plr[dwID].WorldX - pkt->px); - dy = abs(plr[dwID].WorldY - pkt->py); + dx = abs(plr[dwID]._px - pkt->px); + dy = abs(plr[dwID]._py - pkt->py); if ((dx > 3 || dy > 3) && dPlayer[pkt->px][pkt->py] == 0) { FixPlrWalkTags(dwID); - plr[dwID]._poldx = plr[dwID].WorldX; - plr[dwID]._poldy = plr[dwID].WorldY; + plr[dwID]._poldx = plr[dwID]._px; + plr[dwID]._poldy = plr[dwID]._py; FixPlrWalkTags(dwID); - plr[dwID].WorldX = pkt->px; - plr[dwID].WorldY = pkt->py; plr[dwID]._px = pkt->px; plr[dwID]._py = pkt->py; - dPlayer[plr[dwID].WorldX][plr[dwID].WorldY] = dwID + 1; + plr[dwID]._pfutx = pkt->px; + plr[dwID]._pfuty = pkt->py; + dPlayer[plr[dwID]._px][plr[dwID]._py] = dwID + 1; } - dx = abs(plr[dwID]._px - plr[dwID].WorldX); - dy = abs(plr[dwID]._py - plr[dwID].WorldY); + dx = abs(plr[dwID]._pfutx - plr[dwID]._px); + dy = abs(plr[dwID]._pfuty - plr[dwID]._py); if (dx > 1 || dy > 1) { - plr[dwID]._px = plr[dwID].WorldX; - plr[dwID]._py = plr[dwID].WorldY; + plr[dwID]._pfutx = plr[dwID]._px; + plr[dwID]._pfuty = plr[dwID]._py; } MakePlrPath(dwID, pkt->targx, pkt->targy, TRUE); } else { - plr[dwID].WorldX = pkt->px; - plr[dwID].WorldY = pkt->py; plr[dwID]._px = pkt->px; plr[dwID]._py = pkt->py; + plr[dwID]._pfutx = pkt->px; + plr[dwID]._pfuty = pkt->py; plr[dwID]._ptargx = pkt->targx; plr[dwID]._ptargy = pkt->targy; } @@ -831,10 +831,10 @@ void SetupLocalCoords() #endif x += plrxoff[myplr]; y += plryoff[myplr]; - plr[myplr].WorldX = x; - plr[myplr].WorldY = y; plr[myplr]._px = x; plr[myplr]._py = y; + plr[myplr]._pfutx = x; + plr[myplr]._pfuty = y; plr[myplr]._ptargx = x; plr[myplr]._ptargy = y; plr[myplr].plrlevel = currlevel; @@ -985,7 +985,7 @@ void recv_plrinfo(int pnum, TCmdPlrInfoHdr *p, BOOL recv) NewPlrAnim(pnum, plr[pnum]._pDAnim[0], plr[pnum]._pDFrames, 1, plr[pnum]._pDWidth); plr[pnum]._pAnimFrame = plr[pnum]._pAnimLen - 1; plr[pnum]._pVar8 = 2 * plr[pnum]._pAnimLen; - dFlags[plr[pnum].WorldX][plr[pnum].WorldY] |= BFLAG_DEAD_PLAYER; + dFlags[plr[pnum]._px][plr[pnum]._py] |= BFLAG_DEAD_PLAYER; } } #ifdef _DEBUG diff --git a/Source/objects.cpp b/Source/objects.cpp index 696552697..2f75c9127 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -1476,8 +1476,8 @@ void Obj_Light(int i, int lr) for (p = 0; p < MAX_PLRS && !turnon; p++) { if (plr[p].plractive) { if (currlevel == plr[p].plrlevel) { - dx = abs(plr[p].WorldX - ox); - dy = abs(plr[p].WorldY - oy); + dx = abs(plr[p]._px - ox); + dy = abs(plr[p]._py - oy); if (dx < tr && dy < tr) turnon = TRUE; } @@ -1502,8 +1502,8 @@ void Obj_Circle(int i) ox = object[i]._ox; oy = object[i]._oy; - wx = plr[myplr].WorldX; - wy = plr[myplr].WorldY; + wx = plr[myplr]._px; + wy = plr[myplr]._py; if (wx == ox && wy == oy) { if (object[i]._otype == OBJ_MCIRCLE1) object[i]._oAnimFrame = 2; @@ -1521,7 +1521,7 @@ void Obj_Circle(int i) ObjChangeMapResync(object[i]._oVar1, object[i]._oVar2, object[i]._oVar3, object[i]._oVar4); if (quests[Q_BETRAYER]._qactive == QUEST_ACTIVE) quests[Q_BETRAYER]._qvar1 = 4; - AddMissile(plr[myplr].WorldX, plr[myplr].WorldY, 35, 46, plr[myplr]._pdir, MIS_RNDTELEPORT, 0, myplr, 0, 0); + AddMissile(plr[myplr]._px, plr[myplr]._py, 35, 46, plr[myplr]._pdir, MIS_RNDTELEPORT, 0, myplr, 0, 0); track_repeat_walk(FALSE); sgbMouseDown = 0; ReleaseCapture(); @@ -1695,7 +1695,7 @@ void Obj_BCrossDamage(int i) if (fire_resist > 0) damage[leveltype - 1] -= fire_resist * damage[leveltype - 1] / 100; - if (plr[myplr].WorldX != object[i]._ox || plr[myplr].WorldY != object[i]._oy - 1) + if (plr[myplr]._px != object[i]._ox || plr[myplr]._py != object[i]._oy - 1) return; plr[myplr]._pHitPoints -= damage[leveltype - 1]; @@ -1704,12 +1704,12 @@ void Obj_BCrossDamage(int i) SyncPlrKill(myplr, 0); } else { if (plr[myplr]._pClass == PC_WARRIOR) { - PlaySfxLoc(PS_WARR68, plr[myplr].WorldX, plr[myplr].WorldY); + PlaySfxLoc(PS_WARR68, plr[myplr]._px, plr[myplr]._py); #ifndef SPAWN } else if (plr[myplr]._pClass == PC_ROGUE) { - PlaySfxLoc(PS_ROGUE68, plr[myplr].WorldX, plr[myplr].WorldY); + PlaySfxLoc(PS_ROGUE68, plr[myplr]._px, plr[myplr]._py); } else if (plr[myplr]._pClass == PC_SORCERER) { - PlaySfxLoc(PS_MAGE68, plr[myplr].WorldX, plr[myplr].WorldY); + PlaySfxLoc(PS_MAGE68, plr[myplr]._px, plr[myplr]._py); #endif } } @@ -2020,7 +2020,7 @@ void RedoPlayerVision() for (p = 0; p < MAX_PLRS; p++) { if (plr[p].plractive && currlevel == plr[p].plrlevel) { - ChangeVisionXY(plr[p]._pvid, plr[p].WorldX, plr[p].WorldY); + ChangeVisionXY(plr[p]._pvid, plr[p]._px, plr[p]._py); } } } @@ -2387,8 +2387,8 @@ void OperateL1Door(int pnum, int i, BOOL sendflag) { int dpx, dpy; - dpx = abs(object[i]._ox - plr[pnum].WorldX); - dpy = abs(object[i]._oy - plr[pnum].WorldY); + dpx = abs(object[i]._ox - plr[pnum]._px); + dpy = abs(object[i]._oy - plr[pnum]._py); if (dpx == 1 && dpy <= 1 && object[i]._otype == OBJ_L1LDOOR) OperateL1LDoor(pnum, i, sendflag); if (dpx <= 1 && dpy == 1 && object[i]._otype == OBJ_L1RDOOR) @@ -2452,7 +2452,7 @@ void OperateBook(int pnum, int i) } if (do_add_missile) { object[dObject[35][36] - 1]._oVar5++; - AddMissile(plr[pnum].WorldX, plr[pnum].WorldY, dx, dy, plr[pnum]._pdir, MIS_RNDTELEPORT, 0, pnum, 0, 0); + AddMissile(plr[pnum]._px, plr[pnum]._py, dx, dy, plr[pnum]._pdir, MIS_RNDTELEPORT, 0, pnum, 0, 0); missile_added = TRUE; do_add_missile = FALSE; } @@ -2474,8 +2474,8 @@ void OperateBook(int pnum, int i) PlaySfxLoc(IS_QUESTDN, object[i]._ox, object[i]._oy); InitDiabloMsg(EMSG_BONECHAMB); AddMissile( - plr[myplr].WorldX, - plr[myplr].WorldY, + plr[myplr]._px, + plr[myplr]._py, object[i]._ox - 2, object[i]._oy - 4, plr[myplr]._pdir, @@ -2591,7 +2591,7 @@ void OperateChest(int pnum, int i, BOOL sendmsg) } } if (object[i]._oTrapFlag && object[i]._otype >= OBJ_TCHEST1 && object[i]._otype <= OBJ_TCHEST3) { - mdir = GetDirection(object[i]._ox, object[i]._oy, plr[pnum].WorldX, plr[pnum].WorldY); + mdir = GetDirection(object[i]._ox, object[i]._oy, plr[pnum]._px, plr[pnum]._py); switch (object[i]._oVar4) { case 0: mtype = MIS_ARROW; @@ -2603,7 +2603,7 @@ void OperateChest(int pnum, int i, BOOL sendmsg) mtype = MIS_NOVA; break; } - AddMissile(object[i]._ox, object[i]._oy, plr[pnum].WorldX, plr[pnum].WorldY, mdir, mtype, 1, -1, 0, 0); + AddMissile(object[i]._ox, object[i]._oy, plr[pnum]._px, plr[pnum]._py, mdir, mtype, 1, -1, 0, 0); object[i]._oTrapFlag = FALSE; } if (pnum == myplr) @@ -2682,17 +2682,17 @@ void OperateSlainHero(int pnum, int i, BOOL sendmsg) if (plr[pnum]._pClass == PC_WARRIOR) { CreateMagicArmor(object[i]._ox, object[i]._oy, ITYPE_HARMOR, ICURS_BREAST_PLATE, FALSE, TRUE); #ifndef SPAWN - PlaySfxLoc(PS_WARR9, plr[myplr].WorldX, plr[myplr].WorldY); + PlaySfxLoc(PS_WARR9, plr[myplr]._px, plr[myplr]._py); #endif } else if (plr[pnum]._pClass == PC_ROGUE) { CreateMagicWeapon(object[i]._ox, object[i]._oy, ITYPE_BOW, ICURS_LONG_WAR_BOW, FALSE, TRUE); #ifndef SPAWN - PlaySfxLoc(PS_ROGUE9, plr[myplr].WorldX, plr[myplr].WorldY); + PlaySfxLoc(PS_ROGUE9, plr[myplr]._px, plr[myplr]._py); #endif } else if (plr[pnum]._pClass == PC_SORCERER) { CreateSpellBook(object[i]._ox, object[i]._oy, SPL_LIGHTNING, FALSE, TRUE); #ifndef SPAWN - PlaySfxLoc(PS_MAGE9, plr[myplr].WorldX, plr[myplr].WorldY); + PlaySfxLoc(PS_MAGE9, plr[myplr]._px, plr[myplr]._py); #endif } if (pnum == myplr) @@ -2757,8 +2757,8 @@ void OperateL2Door(int pnum, int i, BOOL sendflag) { int dpx, dpy; - dpx = abs(object[i]._ox - plr[pnum].WorldX); - dpy = abs(object[i]._oy - plr[pnum].WorldY); + dpx = abs(object[i]._ox - plr[pnum]._px); + dpy = abs(object[i]._oy - plr[pnum]._py); if (dpx == 1 && dpy <= 1 && object[i]._otype == OBJ_L2LDOOR) OperateL2LDoor(pnum, i, sendflag); if (dpx <= 1 && dpy == 1 && object[i]._otype == OBJ_L2RDOOR) @@ -2769,8 +2769,8 @@ void OperateL3Door(int pnum, int i, BOOL sendflag) { int dpx, dpy; - dpx = abs(object[i]._ox - plr[pnum].WorldX); - dpy = abs(object[i]._oy - plr[pnum].WorldY); + dpx = abs(object[i]._ox - plr[pnum]._px); + dpy = abs(object[i]._oy - plr[pnum]._py); if (dpx == 1 && dpy <= 1 && object[i]._otype == OBJ_L3RDOOR) OperateL3RDoor(pnum, i, sendflag); if (dpx <= 1 && dpy == 1 && object[i]._otype == OBJ_L3LDOOR) @@ -3034,10 +3034,10 @@ void OperateShrine(int pnum, int i, int sType) if (deltaload) return; AddMissile( - plr[pnum].WorldX, - plr[pnum].WorldY, - plr[pnum].WorldX, - plr[pnum].WorldY, + plr[pnum]._px, + plr[pnum]._py, + plr[pnum]._px, + plr[pnum]._py, plr[pnum]._pdir, MIS_MANASHIELD, -1, @@ -3164,10 +3164,10 @@ void OperateShrine(int pnum, int i, int sType) if (deltaload) return; AddMissile( - plr[pnum].WorldX, - plr[pnum].WorldY, - plr[pnum].WorldX, - plr[pnum].WorldY, + plr[pnum]._px, + plr[pnum]._py, + plr[pnum]._px, + plr[pnum]._py, plr[pnum]._pdir, MIS_NOVA, -1, @@ -3262,7 +3262,7 @@ void OperateShrine(int pnum, int i, int sType) break; lv = dPiece[xx][yy]; } while (nSolidTable[lv] || dObject[xx][yy] || dMonster[xx][yy]); - AddMissile(plr[pnum].WorldX, plr[pnum].WorldY, xx, yy, plr[pnum]._pdir, MIS_RNDTELEPORT, -1, pnum, 0, 2 * leveltype); + AddMissile(plr[pnum]._px, plr[pnum]._py, xx, yy, plr[pnum]._pdir, MIS_RNDTELEPORT, -1, pnum, 0, 2 * leveltype); if (pnum != myplr) return; InitDiabloMsg(EMSG_SHRINE_HOLY); @@ -3641,10 +3641,10 @@ BOOL OperateFountains(int pnum, int i) if (deltaload) return FALSE; AddMissile( - plr[pnum].WorldX, - plr[pnum].WorldY, - plr[pnum].WorldX, - plr[pnum].WorldY, + plr[pnum]._px, + plr[pnum]._py, + plr[pnum]._px, + plr[pnum]._py, plr[pnum]._pdir, MIS_INFRA, -1, diff --git a/Source/pack.cpp b/Source/pack.cpp index f514d1314..25fe66cf2 100644 --- a/Source/pack.cpp +++ b/Source/pack.cpp @@ -44,8 +44,8 @@ void PackPlayer(PkPlayerStruct *pPack, int pnum, BOOL manashield) pPack->destParam1 = pPlayer->destParam1; pPack->destParam2 = pPlayer->destParam2; pPack->plrlevel = pPlayer->plrlevel; - pPack->px = pPlayer->WorldX; - pPack->py = pPlayer->WorldY; + pPack->px = pPlayer->_px; + pPack->py = pPlayer->_py; pPack->targx = pPlayer->_ptargx; pPack->targy = pPlayer->_ptargy; strcpy(pPack->pName, pPlayer->_pName); @@ -171,10 +171,10 @@ void UnPackPlayer(PkPlayerStruct *pPack, int pnum, BOOL killok) pPlayer = &plr[pnum]; ClearPlrRVars(pPlayer); - pPlayer->WorldX = pPack->px; - pPlayer->WorldY = pPack->py; pPlayer->_px = pPack->px; pPlayer->_py = pPack->py; + pPlayer->_pfutx = pPack->px; + pPlayer->_pfuty = pPack->py; pPlayer->_ptargx = pPack->targx; pPlayer->_ptargy = pPack->targy; pPlayer->plrlevel = pPack->plrlevel; diff --git a/Source/player.cpp b/Source/player.cpp index 4d3a858bf..b731b287b 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -876,31 +876,31 @@ void InitPlayer(int pnum, BOOL FirstTime) if (pnum == myplr) { if (!FirstTime || currlevel != 0) { - plr[pnum].WorldX = ViewX; - plr[pnum].WorldY = ViewY; + plr[pnum]._px = ViewX; + plr[pnum]._py = ViewY; } - plr[pnum]._ptargx = plr[pnum].WorldX; - plr[pnum]._ptargy = plr[pnum].WorldY; + plr[pnum]._ptargx = plr[pnum]._px; + plr[pnum]._ptargy = plr[pnum]._py; } else { - plr[pnum]._ptargx = plr[pnum].WorldX; - plr[pnum]._ptargy = plr[pnum].WorldY; - for (i = 0; i < 8 && !PosOkPlayer(pnum, plrxoff2[i] + plr[pnum].WorldX, plryoff2[i] + plr[pnum].WorldY); i++) + plr[pnum]._ptargx = plr[pnum]._px; + plr[pnum]._ptargy = plr[pnum]._py; + for (i = 0; i < 8 && !PosOkPlayer(pnum, plrxoff2[i] + plr[pnum]._px, plryoff2[i] + plr[pnum]._py); i++) ; - plr[pnum].WorldX += plrxoff2[i]; - plr[pnum].WorldY += plryoff2[i]; + plr[pnum]._px += plrxoff2[i]; + plr[pnum]._py += plryoff2[i]; } - plr[pnum]._px = plr[pnum].WorldX; - plr[pnum]._py = plr[pnum].WorldY; + plr[pnum]._pfutx = plr[pnum]._px; + plr[pnum]._pfuty = plr[pnum]._py; plr[pnum].walkpath[0] = WALK_NONE; plr[pnum].destAction = ACTION_NONE; if (pnum == myplr) { - plr[pnum]._plid = AddLight(plr[pnum].WorldX, plr[pnum].WorldY, plr[pnum]._pLightRad); + plr[pnum]._plid = AddLight(plr[pnum]._px, plr[pnum]._py, plr[pnum]._pLightRad); } else { plr[pnum]._plid = -1; } - plr[pnum]._pvid = AddVision(plr[pnum].WorldX, plr[pnum].WorldY, plr[pnum]._pLightRad, pnum == myplr); + plr[pnum]._pvid = AddVision(plr[pnum]._px, plr[pnum]._py, plr[pnum]._pLightRad, pnum == myplr); } if (plr[pnum]._pClass == PC_WARRIOR) { @@ -943,8 +943,8 @@ void InitMultiView() app_fatal("InitPlayer: illegal player %d", myplr); } - ViewX = plr[myplr].WorldX; - ViewY = plr[myplr].WorldY; + ViewX = plr[myplr]._px; + ViewY = plr[myplr]._py; } void CheckEFlag(int pnum, BOOL flag) @@ -957,8 +957,8 @@ void CheckEFlag(int pnum, BOOL flag) app_fatal("InitPlayer: illegal player %d", pnum); } - x = plr[pnum].WorldX - 1; - y = plr[pnum].WorldY + 1; + x = plr[pnum]._px - 1; + y = plr[pnum]._py + 1; bitflags = 0; pieces = &dpiece_defs_map_1[IsometricCoord(x, y)]; @@ -976,8 +976,8 @@ void CheckEFlag(int pnum, BOOL flag) return; } - x = plr[pnum].WorldX; - y = plr[pnum].WorldY + 2; + x = plr[pnum]._px; + y = plr[pnum]._py + 2; bitflags = 0; pieces = &dpiece_defs_map_1[IsometricCoord(x, y)]; @@ -989,8 +989,8 @@ void CheckEFlag(int pnum, BOOL flag) return; } - x = plr[pnum].WorldX - 2; - y = plr[pnum].WorldY + 1; + x = plr[pnum]._px - 2; + y = plr[pnum]._py + 1; bitflags = 0; pieces = &dpiece_defs_map_1[IsometricCoord(x, y)]; @@ -1021,8 +1021,8 @@ BOOL PlrDirOK(int pnum, int dir) app_fatal("PlrDirOK: illegal player %d", pnum); } - px = plr[pnum].WorldX + offset_x[dir]; - py = plr[pnum].WorldY + offset_y[dir]; + px = plr[pnum]._px + offset_x[dir]; + py = plr[pnum]._py + offset_y[dir]; if (px < 0 || !dPiece[px][py] || !PosOkPlayer(pnum, px, py)) { return FALSE; @@ -1074,8 +1074,8 @@ void SetPlayerOld(int pnum) app_fatal("SetPlayerOld: illegal player %d", pnum); } - plr[pnum]._poldx = plr[pnum].WorldX; - plr[pnum]._poldy = plr[pnum].WorldY; + plr[pnum]._poldx = plr[pnum]._px; + plr[pnum]._poldy = plr[pnum]._py; } void FixPlayerLocation(int pnum, int bDir) @@ -1084,10 +1084,10 @@ void FixPlayerLocation(int pnum, int bDir) app_fatal("FixPlayerLocation: illegal player %d", pnum); } - plr[pnum]._px = plr[pnum].WorldX; - plr[pnum]._py = plr[pnum].WorldY; - plr[pnum]._ptargx = plr[pnum].WorldX; - plr[pnum]._ptargy = plr[pnum].WorldY; + plr[pnum]._pfutx = plr[pnum]._px; + plr[pnum]._pfuty = plr[pnum]._py; + plr[pnum]._ptargx = plr[pnum]._px; + plr[pnum]._ptargy = plr[pnum]._py; plr[pnum]._pxoff = 0; plr[pnum]._pyoff = 0; CheckEFlag(pnum, FALSE); @@ -1096,8 +1096,8 @@ void FixPlayerLocation(int pnum, int bDir) ScrollInfo._sxoff = 0; ScrollInfo._syoff = 0; ScrollInfo._sdir = SDIR_NONE; - ViewX = plr[pnum].WorldX; - ViewY = plr[pnum].WorldY; + ViewX = plr[pnum]._px; + ViewY = plr[pnum]._py; } } @@ -1116,7 +1116,7 @@ void StartStand(int pnum, int dir) plr[pnum]._pmode = PM_STAND; FixPlayerLocation(pnum, dir); FixPlrWalkTags(pnum); - dPlayer[plr[pnum].WorldX][plr[pnum].WorldY] = pnum + 1; + dPlayer[plr[pnum]._px][plr[pnum]._py] = pnum + 1; SetPlayerOld(pnum); } else { SyncPlrKill(pnum, -1); @@ -1130,8 +1130,8 @@ void StartWalkStand(int pnum) } plr[pnum]._pmode = PM_STAND; - plr[pnum]._px = plr[pnum].WorldX; - plr[pnum]._py = plr[pnum].WorldY; + plr[pnum]._pfutx = plr[pnum]._px; + plr[pnum]._pfuty = plr[pnum]._py; plr[pnum]._pxoff = 0; plr[pnum]._pyoff = 0; @@ -1141,8 +1141,8 @@ void StartWalkStand(int pnum) ScrollInfo._sxoff = 0; ScrollInfo._syoff = 0; ScrollInfo._sdir = SDIR_NONE; - ViewX = plr[pnum].WorldX; - ViewY = plr[pnum].WorldY; + ViewX = plr[pnum]._px; + ViewY = plr[pnum]._py; } } @@ -1227,19 +1227,19 @@ void StartWalk(int pnum, int xvel, int yvel, int xadd, int yadd, int EndDir, int SetPlayerOld(pnum); - px = xadd + plr[pnum].WorldX; - py = yadd + plr[pnum].WorldY; + px = xadd + plr[pnum]._px; + py = yadd + plr[pnum]._py; if (!PlrDirOK(pnum, EndDir)) { return; } - plr[pnum]._px = px; - plr[pnum]._py = py; + plr[pnum]._pfutx = px; + plr[pnum]._pfuty = py; if (pnum == myplr) { - ScrollInfo._sdx = plr[pnum].WorldX - ViewX; - ScrollInfo._sdy = plr[pnum].WorldY - ViewY; + ScrollInfo._sdx = plr[pnum]._px - ViewX; + ScrollInfo._sdy = plr[pnum]._py - ViewY; } dPlayer[px][py] = -(pnum + 1); @@ -1296,31 +1296,31 @@ void StartWalk2(int pnum, int xvel, int yvel, int xoff, int yoff, int xadd, int } SetPlayerOld(pnum); - px = xadd + plr[pnum].WorldX; - py = yadd + plr[pnum].WorldY; + px = xadd + plr[pnum]._px; + py = yadd + plr[pnum]._py; if (!PlrDirOK(pnum, EndDir)) { return; } - plr[pnum]._px = px; - plr[pnum]._py = py; + plr[pnum]._pfutx = px; + plr[pnum]._pfuty = py; if (pnum == myplr) { - ScrollInfo._sdx = plr[pnum].WorldX - ViewX; - ScrollInfo._sdy = plr[pnum].WorldY - ViewY; + ScrollInfo._sdx = plr[pnum]._px - ViewX; + ScrollInfo._sdy = plr[pnum]._py - ViewY; } - dPlayer[plr[pnum].WorldX][plr[pnum].WorldY] = -1 - pnum; - plr[pnum]._pVar1 = plr[pnum].WorldX; - plr[pnum]._pVar2 = plr[pnum].WorldY; - plr[pnum].WorldX = px; - plr[pnum].WorldY = py; - dPlayer[plr[pnum].WorldX][plr[pnum].WorldY] = pnum + 1; + dPlayer[plr[pnum]._px][plr[pnum]._py] = -1 - pnum; + plr[pnum]._pVar1 = plr[pnum]._px; + plr[pnum]._pVar2 = plr[pnum]._py; + plr[pnum]._px = px; + plr[pnum]._py = py; + dPlayer[plr[pnum]._px][plr[pnum]._py] = pnum + 1; plr[pnum]._pxoff = xoff; plr[pnum]._pyoff = yoff; - ChangeLightXY(plr[pnum]._plid, plr[pnum].WorldX, plr[pnum].WorldY); + ChangeLightXY(plr[pnum]._plid, plr[pnum]._px, plr[pnum]._py); PM_ChangeLightOff(pnum); plr[pnum]._pmode = PM_WALK2; @@ -1375,24 +1375,24 @@ void StartWalk3(int pnum, int xvel, int yvel, int xoff, int yoff, int xadd, int } SetPlayerOld(pnum); - px = xadd + plr[pnum].WorldX; - py = yadd + plr[pnum].WorldY; - x = mapx + plr[pnum].WorldX; - y = mapy + plr[pnum].WorldY; + px = xadd + plr[pnum]._px; + py = yadd + plr[pnum]._py; + x = mapx + plr[pnum]._px; + y = mapy + plr[pnum]._py; if (!PlrDirOK(pnum, EndDir)) { return; } - plr[pnum]._px = px; - plr[pnum]._py = py; + plr[pnum]._pfutx = px; + plr[pnum]._pfuty = py; if (pnum == myplr) { - ScrollInfo._sdx = plr[pnum].WorldX - ViewX; - ScrollInfo._sdy = plr[pnum].WorldY - ViewY; + ScrollInfo._sdx = plr[pnum]._px - ViewX; + ScrollInfo._sdy = plr[pnum]._py - ViewY; } - dPlayer[plr[pnum].WorldX][plr[pnum].WorldY] = -1 - pnum; + dPlayer[plr[pnum]._px][plr[pnum]._py] = -1 - pnum; dPlayer[px][py] = -1 - pnum; plr[pnum]._pVar4 = x; plr[pnum]._pVar5 = y; @@ -1496,7 +1496,7 @@ void StartPlrBlock(int pnum, int dir) return; } - PlaySfxLoc(IS_ISWORD, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(IS_ISWORD, plr[pnum]._px, plr[pnum]._py); if (!(plr[pnum]._pGFXLoad & PFILE_BLOCK)) { LoadPlrGFX(pnum, PFILE_BLOCK); @@ -1541,7 +1541,7 @@ void StartSpell(int pnum, int d, int cx, int cy) } } - PlaySfxLoc(spelldata[plr[pnum]._pSpell].sSFX, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(spelldata[plr[pnum]._pSpell].sSFX, plr[pnum]._px, plr[pnum]._py); plr[pnum]._pmode = PM_SPELL; @@ -1615,12 +1615,12 @@ void StartPlrHit(int pnum, int dam, BOOL forcehit) } if (plr[pnum]._pClass == PC_WARRIOR) { - PlaySfxLoc(PS_WARR69, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(PS_WARR69, plr[pnum]._px, plr[pnum]._py); #ifndef SPAWN } else if (plr[pnum]._pClass == PC_ROGUE) { - PlaySfxLoc(PS_ROGUE69, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(PS_ROGUE69, plr[pnum]._px, plr[pnum]._py); } else if (plr[pnum]._pClass == PC_SORCERER) { - PlaySfxLoc(PS_MAGE69, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(PS_MAGE69, plr[pnum]._px, plr[pnum]._py); #endif } @@ -1637,7 +1637,7 @@ void StartPlrHit(int pnum, int dam, BOOL forcehit) FixPlayerLocation(pnum, pd); plr[pnum]._pVar8 = 1; FixPlrWalkTags(pnum); - dPlayer[plr[pnum].WorldX][plr[pnum].WorldY] = pnum + 1; + dPlayer[plr[pnum]._px][plr[pnum]._py] = pnum + 1; SetPlayerOld(pnum); } } @@ -1690,12 +1690,12 @@ void StartPlayerKill(int pnum, int earflag) } if (plr[pnum]._pClass == PC_WARRIOR) { - PlaySfxLoc(PS_DEAD, plr[pnum].WorldX, plr[pnum].WorldY); // BUGFIX: should use `PS_WARR71` like other classes + PlaySfxLoc(PS_DEAD, p->_px, p->_py); // BUGFIX: should use `PS_WARR71` like other classes #ifndef SPAWN } else if (plr[pnum]._pClass == PC_ROGUE) { - PlaySfxLoc(PS_ROGUE71, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(PS_ROGUE71, p->_px, p->_py); } else if (plr[pnum]._pClass == PC_SORCERER) { - PlaySfxLoc(PS_MAGE71, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(PS_MAGE71, p->_px, p->_py); #endif } @@ -1728,7 +1728,7 @@ void StartPlayerKill(int pnum, int earflag) if (plr[pnum].plrlevel == currlevel) { FixPlayerLocation(pnum, plr[pnum]._pdir); RemovePlrFromMap(pnum); - dFlags[plr[pnum].WorldX][plr[pnum].WorldY] |= BFLAG_DEAD_PLAYER; + dFlags[p->_px][p->_py] |= BFLAG_DEAD_PLAYER; SetPlayerOld(pnum); if (pnum == myplr) { @@ -1792,8 +1792,8 @@ void PlrDeadItem(int pnum, ItemStruct *itm, int xx, int yy) app_fatal("PlrDeadItem: illegal player %d", pnum); } - x = xx + plr[pnum].WorldX; - y = yy + plr[pnum].WorldY; + x = xx + plr[pnum]._px; + y = yy + plr[pnum]._py; if ((xx || yy) && ItemSpaceOk(x, y)) { RespawnDeadItem(itm, x, y); plr[pnum].HoldItem = *itm; @@ -1803,9 +1803,9 @@ void PlrDeadItem(int pnum, ItemStruct *itm, int xx, int yy) for (k = 1; k < 50; k++) { for (j = -k; j <= k; j++) { - y = j + plr[pnum].WorldY; + y = j + plr[pnum]._py; for (i = -k; i <= k; i++) { - x = i + plr[pnum].WorldX; + x = i + plr[pnum]._px; if (ItemSpaceOk(x, y)) { RespawnDeadItem(itm, x, y); plr[pnum].HoldItem = *itm; @@ -1994,7 +1994,7 @@ void InitLevelChange(int pnum) RemovePlrFromMap(pnum); SetPlayerOld(pnum); if (pnum == myplr) { - dPlayer[plr[myplr].WorldX][plr[myplr].WorldY] = myplr + 1; + dPlayer[plr[myplr]._px][plr[myplr]._py] = myplr + 1; } else { plr[pnum]._pLvlVisited[plr[pnum].plrlevel] = TRUE; } @@ -2108,7 +2108,7 @@ BOOL PM_DoWalk(int pnum) if (plr[pnum]._pAnimFrame == 3 || (plr[pnum]._pWFrames == 8 && plr[pnum]._pAnimFrame == 7) || (plr[pnum]._pWFrames != 8 && plr[pnum]._pAnimFrame == 4)) { - PlaySfxLoc(PS_WALK1, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(PS_WALK1, plr[pnum]._px, plr[pnum]._py); } anim_len = 8; @@ -2117,19 +2117,19 @@ BOOL PM_DoWalk(int pnum) } if (plr[pnum]._pVar8 == anim_len) { - dPlayer[plr[pnum].WorldX][plr[pnum].WorldY] = 0; - plr[pnum].WorldX += plr[pnum]._pVar1; - plr[pnum].WorldY += plr[pnum]._pVar2; - dPlayer[plr[pnum].WorldX][plr[pnum].WorldY] = pnum + 1; + dPlayer[plr[pnum]._px][plr[pnum]._py] = 0; + plr[pnum]._px += plr[pnum]._pVar1; + plr[pnum]._py += plr[pnum]._pVar2; + dPlayer[plr[pnum]._px][plr[pnum]._py] = pnum + 1; if (leveltype != DTYPE_TOWN) { - ChangeLightXY(plr[pnum]._plid, plr[pnum].WorldX, plr[pnum].WorldY); - ChangeVisionXY(plr[pnum]._pvid, plr[pnum].WorldX, plr[pnum].WorldY); + ChangeLightXY(plr[pnum]._plid, plr[pnum]._px, plr[pnum]._py); + ChangeVisionXY(plr[pnum]._pvid, plr[pnum]._px, plr[pnum]._py); } if (pnum == myplr && ScrollInfo._sdir) { - ViewX = plr[pnum].WorldX - ScrollInfo._sdx; - ViewY = plr[pnum].WorldY - ScrollInfo._sdy; + ViewX = plr[pnum]._px - ScrollInfo._sdx; + ViewY = plr[pnum]._py - ScrollInfo._sdy; } if (plr[pnum].walkpath[0] != WALK_NONE) { @@ -2162,7 +2162,7 @@ BOOL PM_DoWalk2(int pnum) if (plr[pnum]._pAnimFrame == 3 || (plr[pnum]._pWFrames == 8 && plr[pnum]._pAnimFrame == 7) || (plr[pnum]._pWFrames != 8 && plr[pnum]._pAnimFrame == 4)) { - PlaySfxLoc(PS_WALK1, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(PS_WALK1, plr[pnum]._px, plr[pnum]._py); } anim_len = 8; @@ -2174,13 +2174,13 @@ BOOL PM_DoWalk2(int pnum) dPlayer[plr[pnum]._pVar1][plr[pnum]._pVar2] = 0; if (leveltype != DTYPE_TOWN) { - ChangeLightXY(plr[pnum]._plid, plr[pnum].WorldX, plr[pnum].WorldY); - ChangeVisionXY(plr[pnum]._pvid, plr[pnum].WorldX, plr[pnum].WorldY); + ChangeLightXY(plr[pnum]._plid, plr[pnum]._px, plr[pnum]._py); + ChangeVisionXY(plr[pnum]._pvid, plr[pnum]._px, plr[pnum]._py); } if (pnum == myplr && ScrollInfo._sdir) { - ViewX = plr[pnum].WorldX - ScrollInfo._sdx; - ViewY = plr[pnum].WorldY - ScrollInfo._sdy; + ViewX = plr[pnum]._px - ScrollInfo._sdx; + ViewY = plr[pnum]._py - ScrollInfo._sdy; } if (plr[pnum].walkpath[0] != WALK_NONE) { @@ -2213,7 +2213,7 @@ BOOL PM_DoWalk3(int pnum) if (plr[pnum]._pAnimFrame == 3 || (plr[pnum]._pWFrames == 8 && plr[pnum]._pAnimFrame == 7) || (plr[pnum]._pWFrames != 8 && plr[pnum]._pAnimFrame == 4)) { - PlaySfxLoc(PS_WALK1, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(PS_WALK1, plr[pnum]._px, plr[pnum]._py); } anim_len = 8; @@ -2222,20 +2222,20 @@ BOOL PM_DoWalk3(int pnum) } if (plr[pnum]._pVar8 == anim_len) { - dPlayer[plr[pnum].WorldX][plr[pnum].WorldY] = 0; + dPlayer[plr[pnum]._px][plr[pnum]._py] = 0; dFlags[plr[pnum]._pVar4][plr[pnum]._pVar5] &= ~BFLAG_PLAYERLR; - plr[pnum].WorldX = plr[pnum]._pVar1; - plr[pnum].WorldY = plr[pnum]._pVar2; - dPlayer[plr[pnum].WorldX][plr[pnum].WorldY] = pnum + 1; + plr[pnum]._px = plr[pnum]._pVar1; + plr[pnum]._py = plr[pnum]._pVar2; + dPlayer[plr[pnum]._px][plr[pnum]._py] = pnum + 1; if (leveltype != DTYPE_TOWN) { - ChangeLightXY(plr[pnum]._plid, plr[pnum].WorldX, plr[pnum].WorldY); - ChangeVisionXY(plr[pnum]._pvid, plr[pnum].WorldX, plr[pnum].WorldY); + ChangeLightXY(plr[pnum]._plid, plr[pnum]._px, plr[pnum]._py); + ChangeVisionXY(plr[pnum]._pvid, plr[pnum]._px, plr[pnum]._py); } if (pnum == myplr && ScrollInfo._sdir) { - ViewX = plr[pnum].WorldX - ScrollInfo._sdx; - ViewY = plr[pnum].WorldY - ScrollInfo._sdy; + ViewX = plr[pnum]._px - ScrollInfo._sdx; + ViewY = plr[pnum]._py - ScrollInfo._sdy; } if (plr[pnum].walkpath[0] != WALK_NONE) { @@ -2563,7 +2563,7 @@ BOOL PlrHitPlr(int pnum, char p) if (hit < hper) { if (blk < blkper) { - dir = GetDirection(plr[p].WorldX, plr[p].WorldY, plr[pnum].WorldX, plr[pnum].WorldY); + dir = GetDirection(plr[p]._px, plr[p]._py, plr[pnum]._px, plr[pnum]._py); StartPlrBlock(p, dir); } else { mind = plr[pnum]._pIMinDam; @@ -2643,13 +2643,13 @@ BOOL PM_DoAttack(int pnum) plr[pnum]._pAnimFrame += 2; } if (plr[pnum]._pAnimFrame == plr[pnum]._pAFNum - 1) { - PlaySfxLoc(PS_SWING, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(PS_SWING, plr[pnum]._px, plr[pnum]._py); } if (plr[pnum]._pAnimFrame == plr[pnum]._pAFNum) { dir = plr[pnum]._pdir; - dx = plr[pnum].WorldX + offset_x[dir]; - dy = plr[pnum].WorldY + offset_y[dir]; + dx = plr[pnum]._px + offset_x[dir]; + dy = plr[pnum]._py + offset_y[dir]; if (dMonster[dx][dy]) { if (dMonster[dx][dy] > 0) { @@ -2732,8 +2732,8 @@ BOOL PM_DoRangeAttack(int pnum) mistype = MIS_LARROW; } AddMissile( - plr[pnum].WorldX, - plr[pnum].WorldY, + plr[pnum]._px, + plr[pnum]._py, plr[pnum]._pVar1, plr[pnum]._pVar2, plr[pnum]._pdir, @@ -2743,7 +2743,7 @@ BOOL PM_DoRangeAttack(int pnum) 4, 0); - PlaySfxLoc(PS_BFIRE, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(PS_BFIRE, plr[pnum]._px, plr[pnum]._py); if (WeaponDur(pnum, 40)) { StartStand(pnum, plr[pnum]._pdir); @@ -2829,8 +2829,8 @@ BOOL PM_DoSpell(int pnum) CastSpell( pnum, plr[pnum]._pSpell, - plr[pnum].WorldX, - plr[pnum].WorldY, + plr[pnum]._px, + plr[pnum]._py, plr[pnum]._pVar1, plr[pnum]._pVar2, 0, @@ -2975,7 +2975,7 @@ BOOL PM_DoDeath(int pnum) plr[pnum]._pAnimDelay = 10000; plr[pnum]._pAnimFrame = plr[pnum]._pAnimLen; - dFlags[plr[pnum].WorldX][plr[pnum].WorldY] |= BFLAG_DEAD_PLAYER; + dFlags[plr[pnum]._px][plr[pnum]._py] |= BFLAG_DEAD_PLAYER; } if (plr[pnum]._pVar8 < 100) { @@ -3004,7 +3004,7 @@ void CheckNewPath(int pnum) } if (plr[pnum].destAction == ACTION_ATTACKPLR) { - MakePlrPath(pnum, plr[plr[pnum].destParam1]._px, plr[plr[pnum].destParam1]._py, FALSE); + MakePlrPath(pnum, plr[plr[pnum].destParam1]._pfutx, plr[plr[pnum].destParam1]._pfuty, FALSE); } if (plr[pnum].walkpath[0] != WALK_NONE) { @@ -3014,13 +3014,13 @@ void CheckNewPath(int pnum) i = plr[pnum].destParam1; if (plr[pnum].destAction == ACTION_ATTACKMON) { - x = abs(plr[pnum]._px - monster[i]._mfutx); - y = abs(plr[pnum]._py - monster[i]._mfuty); - d = GetDirection(plr[pnum]._px, plr[pnum]._py, monster[i]._mfutx, monster[i]._mfuty); + x = abs(plr[pnum]._pfutx - monster[i]._mfutx); + y = abs(plr[pnum]._pfuty - monster[i]._mfuty); + d = GetDirection(plr[pnum]._pfutx, plr[pnum]._pfuty, monster[i]._mfutx, monster[i]._mfuty); } else { - x = abs(plr[pnum]._px - plr[i]._px); - y = abs(plr[pnum]._py - plr[i]._py); - d = GetDirection(plr[pnum]._px, plr[pnum]._py, plr[i]._px, plr[i]._py); + x = abs(plr[pnum]._pfutx - plr[i]._pfutx); + y = abs(plr[pnum]._pfuty - plr[i]._pfuty); + d = GetDirection(plr[pnum]._pfutx, plr[pnum]._pfuty, plr[i]._pfutx, plr[i]._pfuty); } if (x < 2 && y < 2) { @@ -3093,15 +3093,15 @@ void CheckNewPath(int pnum) if (plr[pnum]._pmode == PM_STAND) { switch (plr[pnum].destAction) { case ACTION_ATTACK: - d = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, plr[pnum].destParam1, plr[pnum].destParam2); + d = GetDirection(plr[pnum]._px, plr[pnum]._py, plr[pnum].destParam1, plr[pnum].destParam2); StartAttack(pnum, d); break; case ACTION_ATTACKMON: i = plr[pnum].destParam1; - x = abs(plr[pnum].WorldX - monster[i]._mfutx); - y = abs(plr[pnum].WorldY - monster[i]._mfuty); + x = abs(plr[pnum]._px - monster[i]._mfutx); + y = abs(plr[pnum]._py - monster[i]._mfuty); if (x <= 1 && y <= 1) { - d = GetDirection(plr[pnum]._px, plr[pnum]._py, monster[i]._mfutx, monster[i]._mfuty); + d = GetDirection(plr[pnum]._pfutx, plr[pnum]._pfuty, monster[i]._mfutx, monster[i]._mfuty); if (monster[i].mtalkmsg && monster[i].mtalkmsg != TEXT_VILE14) { TalktoMonster(i); } else { @@ -3111,20 +3111,20 @@ void CheckNewPath(int pnum) break; case ACTION_ATTACKPLR: i = plr[pnum].destParam1; - x = abs(plr[pnum].WorldX - plr[i]._px); - y = abs(plr[pnum].WorldY - plr[i]._py); + x = abs(plr[pnum]._px - plr[i]._pfutx); + y = abs(plr[pnum]._py - plr[i]._pfuty); if (x <= 1 && y <= 1) { - d = GetDirection(plr[pnum]._px, plr[pnum]._py, plr[i]._px, plr[i]._py); + d = GetDirection(plr[pnum]._pfutx, plr[pnum]._pfuty, plr[i]._pfutx, plr[i]._pfuty); StartAttack(pnum, d); } break; case ACTION_RATTACK: - d = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, plr[pnum].destParam1, plr[pnum].destParam2); + d = GetDirection(plr[pnum]._px, plr[pnum]._py, plr[pnum].destParam1, plr[pnum].destParam2); StartRangeAttack(pnum, d, plr[pnum].destParam1, plr[pnum].destParam2); break; case ACTION_RATTACKMON: i = plr[pnum].destParam1; - d = GetDirection(plr[pnum]._px, plr[pnum]._py, monster[i]._mfutx, monster[i]._mfuty); + d = GetDirection(plr[pnum]._pfutx, plr[pnum]._pfuty, monster[i]._mfutx, monster[i]._mfuty); if (monster[i].mtalkmsg && monster[i].mtalkmsg != TEXT_VILE14) { TalktoMonster(i); } else { @@ -3133,11 +3133,11 @@ void CheckNewPath(int pnum) break; case ACTION_RATTACKPLR: i = plr[pnum].destParam1; - d = GetDirection(plr[pnum]._px, plr[pnum]._py, plr[i]._px, plr[i]._py); - StartRangeAttack(pnum, d, plr[i]._px, plr[i]._py); + d = GetDirection(plr[pnum]._pfutx, plr[pnum]._pfuty, plr[i]._pfutx, plr[i]._pfuty); + StartRangeAttack(pnum, d, plr[i]._pfutx, plr[i]._pfuty); break; case ACTION_SPELL: - d = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, plr[pnum].destParam1, plr[pnum].destParam2); + d = GetDirection(plr[pnum]._px, plr[pnum]._py, plr[pnum].destParam1, plr[pnum].destParam2); StartSpell(pnum, d, plr[pnum].destParam1, plr[pnum].destParam2); plr[pnum]._pVar4 = plr[pnum].destParam3; break; @@ -3148,26 +3148,26 @@ void CheckNewPath(int pnum) break; case ACTION_SPELLMON: i = plr[pnum].destParam1; - d = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, monster[i]._mfutx, monster[i]._mfuty); + d = GetDirection(plr[pnum]._px, plr[pnum]._py, monster[i]._mfutx, monster[i]._mfuty); StartSpell(pnum, d, monster[i]._mfutx, monster[i]._mfuty); plr[pnum]._pVar4 = plr[pnum].destParam2; break; case ACTION_SPELLPLR: i = plr[pnum].destParam1; - d = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, plr[i]._px, plr[i]._py); - StartSpell(pnum, d, plr[i]._px, plr[i]._py); + d = GetDirection(plr[pnum]._px, plr[pnum]._py, plr[i]._pfutx, plr[i]._pfuty); + StartSpell(pnum, d, plr[i]._pfutx, plr[i]._pfuty); plr[pnum]._pVar4 = plr[pnum].destParam2; break; case ACTION_OPERATE: i = plr[pnum].destParam1; - x = abs(plr[pnum].WorldX - object[i]._ox); - y = abs(plr[pnum].WorldY - object[i]._oy); + x = abs(plr[pnum]._px - object[i]._ox); + y = abs(plr[pnum]._py - object[i]._oy); if (y > 1 && dObject[object[i]._ox][object[i]._oy - 1] == -1 - i) { - y = abs(plr[pnum].WorldY - object[i]._oy + 1); + y = abs(plr[pnum]._py - object[i]._oy + 1); } if (x <= 1 && y <= 1) { if (object[i]._oBreak == 1) { - d = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, object[i]._ox, object[i]._oy); + d = GetDirection(plr[pnum]._px, plr[pnum]._py, object[i]._ox, object[i]._oy); StartAttack(pnum, d); } else { OperateObject(pnum, i, FALSE); @@ -3176,14 +3176,14 @@ void CheckNewPath(int pnum) break; case ACTION_DISARM: i = plr[pnum].destParam1; - x = abs(plr[pnum].WorldX - object[i]._ox); - y = abs(plr[pnum].WorldY - object[i]._oy); + x = abs(plr[pnum]._px - object[i]._ox); + y = abs(plr[pnum]._py - object[i]._oy); if (y > 1 && dObject[object[i]._ox][object[i]._oy - 1] == -1 - i) { - y = abs(plr[pnum].WorldY - object[i]._oy + 1); + y = abs(plr[pnum]._py - object[i]._oy + 1); } if (x <= 1 && y <= 1) { if (object[i]._oBreak == 1) { - d = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, object[i]._ox, object[i]._oy); + d = GetDirection(plr[pnum]._px, plr[pnum]._py, object[i]._ox, object[i]._oy); StartAttack(pnum, d); } else { TryDisarm(pnum, i); @@ -3200,8 +3200,8 @@ void CheckNewPath(int pnum) case ACTION_PICKUPITEM: if (pnum == myplr) { i = plr[pnum].destParam1; - x = abs(plr[pnum].WorldX - item[i]._ix); - y = abs(plr[pnum].WorldY - item[i]._iy); + x = abs(plr[pnum]._px - item[i]._ix); + y = abs(plr[pnum]._py - item[i]._iy); if (x <= 1 && y <= 1 && pcurs == CURSOR_HAND && !item[i]._iRequest) { NetSendCmdGItem(TRUE, CMD_REQUESTGITEM, myplr, myplr, i); item[i]._iRequest = TRUE; @@ -3211,8 +3211,8 @@ void CheckNewPath(int pnum) case ACTION_PICKUPAITEM: if (pnum == myplr) { i = plr[pnum].destParam1; - x = abs(plr[pnum].WorldX - item[i]._ix); - y = abs(plr[pnum].WorldY - item[i]._iy); + x = abs(plr[pnum]._px - item[i]._ix); + y = abs(plr[pnum]._py - item[i]._iy); if (x <= 1 && y <= 1 && pcurs == CURSOR_HAND) { NetSendCmdGItem(TRUE, CMD_REQUESTAGITEM, myplr, myplr, i); } @@ -3233,37 +3233,37 @@ void CheckNewPath(int pnum) if (plr[pnum]._pmode == PM_ATTACK && plr[pnum]._pAnimFrame > plr[myplr]._pAFNum) { if (plr[pnum].destAction == ACTION_ATTACK) { - d = GetDirection(plr[pnum]._px, plr[pnum]._py, plr[pnum].destParam1, plr[pnum].destParam2); + d = GetDirection(plr[pnum]._pfutx, plr[pnum]._pfuty, plr[pnum].destParam1, plr[pnum].destParam2); StartAttack(pnum, d); plr[pnum].destAction = ACTION_NONE; } else if (plr[pnum].destAction == ACTION_ATTACKMON) { i = plr[pnum].destParam1; - x = abs(plr[pnum].WorldX - monster[i]._mfutx); - y = abs(plr[pnum].WorldY - monster[i]._mfuty); + x = abs(plr[pnum]._px - monster[i]._mfutx); + y = abs(plr[pnum]._py - monster[i]._mfuty); if (x <= 1 && y <= 1) { - d = GetDirection(plr[pnum]._px, plr[pnum]._py, monster[i]._mfutx, monster[i]._mfuty); + d = GetDirection(plr[pnum]._pfutx, plr[pnum]._pfuty, monster[i]._mfutx, monster[i]._mfuty); StartAttack(pnum, d); } plr[pnum].destAction = ACTION_NONE; } else if (plr[pnum].destAction == ACTION_ATTACKPLR) { i = plr[pnum].destParam1; - x = abs(plr[pnum].WorldX - plr[i]._px); - y = abs(plr[pnum].WorldY - plr[i]._py); + x = abs(plr[pnum]._px - plr[i]._pfutx); + y = abs(plr[pnum]._py - plr[i]._pfuty); if (x <= 1 && y <= 1) { - d = GetDirection(plr[pnum]._px, plr[pnum]._py, plr[i]._px, plr[i]._py); + d = GetDirection(plr[pnum]._pfutx, plr[pnum]._pfuty, plr[i]._pfutx, plr[i]._pfuty); StartAttack(pnum, d); } plr[pnum].destAction = ACTION_NONE; } else if (plr[pnum].destAction == ACTION_OPERATE) { i = plr[pnum].destParam1; - x = abs(plr[pnum].WorldX - object[i]._ox); - y = abs(plr[pnum].WorldY - object[i]._oy); + x = abs(plr[pnum]._px - object[i]._ox); + y = abs(plr[pnum]._py - object[i]._oy); if (y > 1 && dObject[object[i]._ox][object[i]._oy - 1] == -1 - i) { - y = abs(plr[pnum].WorldY - object[i]._oy + 1); + y = abs(plr[pnum]._py - object[i]._oy + 1); } if (x <= 1 && y <= 1) { if (object[i]._oBreak == 1) { - d = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, object[i]._ox, object[i]._oy); + d = GetDirection(plr[pnum]._px, plr[pnum]._py, object[i]._ox, object[i]._oy); StartAttack(pnum, d); } else { OperateObject(pnum, i, FALSE); @@ -3274,36 +3274,36 @@ void CheckNewPath(int pnum) if (plr[pnum]._pmode == PM_RATTACK && plr[pnum]._pAnimFrame > plr[myplr]._pAFNum) { if (plr[pnum].destAction == ACTION_RATTACK) { - d = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, plr[pnum].destParam1, plr[pnum].destParam2); + d = GetDirection(plr[pnum]._px, plr[pnum]._py, plr[pnum].destParam1, plr[pnum].destParam2); StartRangeAttack(pnum, d, plr[pnum].destParam1, plr[pnum].destParam2); plr[pnum].destAction = ACTION_NONE; } else if (plr[pnum].destAction == ACTION_RATTACKMON) { i = plr[pnum].destParam1; - d = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, monster[i]._mfutx, monster[i]._mfuty); + d = GetDirection(plr[pnum]._px, plr[pnum]._py, monster[i]._mfutx, monster[i]._mfuty); StartRangeAttack(pnum, d, monster[i]._mfutx, monster[i]._mfuty); plr[pnum].destAction = ACTION_NONE; } else if (plr[pnum].destAction == ACTION_RATTACKPLR) { i = plr[pnum].destParam1; - d = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, plr[i]._px, plr[i]._py); - StartRangeAttack(pnum, d, plr[i]._px, plr[i]._py); + d = GetDirection(plr[pnum]._px, plr[pnum]._py, plr[i]._pfutx, plr[i]._pfuty); + StartRangeAttack(pnum, d, plr[i]._pfutx, plr[i]._pfuty); plr[pnum].destAction = ACTION_NONE; } } if (plr[pnum]._pmode == PM_SPELL && plr[pnum]._pAnimFrame > plr[pnum]._pSFNum) { if (plr[pnum].destAction == ACTION_SPELL) { - d = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, plr[pnum].destParam1, plr[pnum].destParam2); + d = GetDirection(plr[pnum]._px, plr[pnum]._py, plr[pnum].destParam1, plr[pnum].destParam2); StartSpell(pnum, d, plr[pnum].destParam1, plr[pnum].destParam2); plr[pnum].destAction = ACTION_NONE; } else if (plr[pnum].destAction == ACTION_SPELLMON) { i = plr[pnum].destParam1; - d = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, monster[i]._mfutx, monster[i]._mfuty); + d = GetDirection(plr[pnum]._px, plr[pnum]._py, monster[i]._mfutx, monster[i]._mfuty); StartSpell(pnum, d, monster[i]._mfutx, monster[i]._mfuty); plr[pnum].destAction = ACTION_NONE; } else if (plr[pnum].destAction == ACTION_SPELLPLR) { i = plr[pnum].destParam1; - d = GetDirection(plr[pnum].WorldX, plr[pnum].WorldY, plr[i]._px, plr[i]._py); - StartSpell(pnum, d, plr[i]._px, plr[i]._py); + d = GetDirection(plr[pnum]._px, plr[pnum]._py, plr[i]._pfutx, plr[i]._pfuty); + StartSpell(pnum, d, plr[i]._pfutx, plr[i]._pfuty); plr[pnum].destAction = ACTION_NONE; } } @@ -3577,11 +3577,11 @@ void MakePlrPath(int pnum, int xx, int yy, BOOL endspace) plr[pnum]._ptargx = xx; plr[pnum]._ptargy = yy; - if (plr[pnum]._px == xx && plr[pnum]._py == yy) { + if (plr[pnum]._pfutx == xx && plr[pnum]._pfuty == yy) { return; } - path = FindPath(PosOkPlayer, pnum, plr[pnum]._px, plr[pnum]._py, xx, yy, plr[pnum].walkpath); + path = FindPath(PosOkPlayer, pnum, plr[pnum]._pfutx, plr[pnum]._pfuty, xx, yy, plr[pnum].walkpath); if (!path) { return; } @@ -3690,7 +3690,7 @@ void CheckPlrSpell() if (addflag) { if (plr[myplr]._pRSpell == SPL_FIREWALL) { - sd = GetDirection(plr[myplr].WorldX, plr[myplr].WorldY, cursmx, cursmy); + sd = GetDirection(plr[myplr]._px, plr[myplr]._py, cursmx, cursmy); sl = GetSpellLevel(myplr, plr[myplr]._pRSpell); NetSendCmdLocParam3(TRUE, CMD_SPELLXYD, cursmx, cursmy, plr[myplr]._pRSpell, sd, sl); } else if (pcursmonst != -1) { @@ -3782,16 +3782,16 @@ void SyncInitPlrPos(int pnum) DWORD i; BOOL posOk; - plr[pnum]._ptargx = plr[pnum].WorldX; - plr[pnum]._ptargy = plr[pnum].WorldY; + plr[pnum]._ptargx = plr[pnum]._px; + plr[pnum]._ptargy = plr[pnum]._py; if (gbMaxPlayers == 1 || plr[pnum].plrlevel != currlevel) { return; } for (i = 0; i < 8; i++) { - x = plr[pnum].WorldX + plrxoff2[i]; - y = plr[pnum].WorldY + plryoff2[i]; + x = plr[pnum]._px + plrxoff2[i]; + y = plr[pnum]._py + plryoff2[i]; if (PosOkPlayer(pnum, x, y)) { break; } @@ -3801,9 +3801,9 @@ void SyncInitPlrPos(int pnum) posOk = FALSE; for (range = 1; range < 50 && !posOk; range++) { for (yy = -range; yy <= range && !posOk; yy++) { - y = yy + plr[pnum].WorldY; + y = yy + plr[pnum]._py; for (xx = -range; xx <= range && !posOk; xx++) { - x = xx + plr[pnum].WorldX; + x = xx + plr[pnum]._px; if (PosOkPlayer(pnum, x, y) && !PosOkPortal(currlevel, x, y)) { posOk = TRUE; } @@ -3812,13 +3812,13 @@ void SyncInitPlrPos(int pnum) } } - plr[pnum].WorldX = x; - plr[pnum].WorldY = y; + plr[pnum]._px = x; + plr[pnum]._py = y; dPlayer[x][y] = pnum + 1; if (pnum == myplr) { - plr[pnum]._px = x; - plr[pnum]._py = y; + plr[pnum]._pfutx = x; + plr[pnum]._pfuty = y; plr[pnum]._ptargx = x; plr[pnum]._ptargy = y; ViewX = x; diff --git a/Source/quests.cpp b/Source/quests.cpp index a208a664e..bd2075eb0 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -179,7 +179,7 @@ void CheckQuests() && nummonsters == 4 && quests[Q_PWATER]._qactive != QUEST_DONE) { quests[Q_PWATER]._qactive = QUEST_DONE; - PlaySfxLoc(IS_QUESTDN, plr[myplr].WorldX, plr[myplr].WorldY); + PlaySfxLoc(IS_QUESTDN, plr[myplr]._px, plr[myplr]._py); LoadPalette("Levels\\L3Data\\L3pwater.pal"); WaterDone = 32; } @@ -192,8 +192,8 @@ void CheckQuests() if (currlevel == quests[i]._qlevel && quests[i]._qslvl != 0 && quests[i]._qactive != QUEST_NOTAVAIL - && plr[myplr].WorldX == quests[i]._qtx - && plr[myplr].WorldY == quests[i]._qty) { + && plr[myplr]._px == quests[i]._qtx + && plr[myplr]._py == quests[i]._qty) { if (quests[i]._qlvltype != DTYPE_NONE) { setlvltype = quests[i]._qlvltype; } diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index a71ec611c..c4037dada 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -670,7 +670,7 @@ void DrawDeadPlayer(int x, int y, int sx, int sy, int CelSkip, int CelCap, BOOL for (i = 0; i < MAX_PLRS; i++) { p = &plr[i]; - if (p->plractive && !p->_pHitPoints && p->plrlevel == (BYTE)currlevel && p->WorldX == x && p->WorldY == y) { + if (p->plractive && !p->_pHitPoints && p->plrlevel == (BYTE)currlevel && p->_px == x && p->_py == y) { pCelBuff = p->_pAnimData; if (!pCelBuff) { // app_fatal("Drawing dead player %d \"%s\": NULL Cel Buffer", i, p->_pName); diff --git a/Source/spells.cpp b/Source/spells.cpp index f3c723b72..710928998 100644 --- a/Source/spells.cpp +++ b/Source/spells.cpp @@ -151,8 +151,8 @@ static void PlacePlayer(int pnum) if (plr[pnum].plrlevel == currlevel) { for (i = 0; i < 8; i++) { - nx = plr[pnum].WorldX + plrxoff2[i]; - ny = plr[pnum].WorldY + plryoff2[i]; + nx = plr[pnum]._px + plrxoff2[i]; + ny = plr[pnum]._py + plryoff2[i]; if (PosOkPlayer(pnum, nx, ny)) { break; @@ -164,10 +164,10 @@ static void PlacePlayer(int pnum) for (max = 1, min = -1; min > -50 && !done; max++, min--) { for (y = min; y <= max && !done; y++) { - ny = plr[pnum].WorldY + y; + ny = plr[pnum]._py + y; for (x = min; x <= max && !done; x++) { - nx = plr[pnum].WorldX + x; + nx = plr[pnum]._px + x; if (PosOkPlayer(pnum, nx, ny)) { done = TRUE; @@ -177,8 +177,8 @@ static void PlacePlayer(int pnum) } } - plr[pnum].WorldX = nx; - plr[pnum].WorldY = ny; + plr[pnum]._px = nx; + plr[pnum]._py = ny; dPlayer[nx][ny] = pnum + 1; @@ -198,7 +198,7 @@ void DoResurrect(int pnum, int rid) int hp; if ((char)rid != -1) { - AddMissile(plr[rid].WorldX, plr[rid].WorldY, plr[rid].WorldX, plr[rid].WorldY, 0, MIS_RESURRECTBEAM, 0, pnum, 0, 0); + AddMissile(plr[rid]._px, plr[rid]._py, plr[rid]._px, plr[rid]._py, 0, MIS_RESURRECTBEAM, 0, pnum, 0, 0); } if (pnum == myplr) { diff --git a/Source/sync.cpp b/Source/sync.cpp index 636c8afc5..7e33d9573 100644 --- a/Source/sync.cpp +++ b/Source/sync.cpp @@ -55,7 +55,7 @@ void sync_one_monster() for (i = 0; i < nummonsters; i++) { m = monstactive[i]; - sync_word_6AA708[m] = abs(plr[myplr].WorldX - monster[m]._mx) + abs(plr[myplr].WorldY - monster[m]._my); + sync_word_6AA708[m] = abs(plr[myplr]._px - monster[m]._mx) + abs(plr[myplr]._py - monster[m]._my); if (monster[m]._msquelch == 0) { sync_word_6AA708[m] += 0x1000; } else if (sgwLRU[m] != 0) { @@ -237,7 +237,7 @@ void sync_monster(int pnum, const TSyncMonster *p) } } - delta = abs(plr[myplr].WorldX - monster[ndx]._mx) + abs(plr[myplr].WorldY - monster[ndx]._my); + delta = abs(plr[myplr]._px - monster[ndx]._mx) + abs(plr[myplr]._py - monster[ndx]._my); if (delta > 255) { delta = 255; } diff --git a/Source/towners.cpp b/Source/towners.cpp index b8f502eeb..19121d91a 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -412,8 +412,8 @@ void TownCtrlMsg(int i) if (towner[i]._tbtcnt) { p = towner[i]._tVar1; - dx = abs(towner[i]._tx - plr[p].WorldX); - dy = abs(towner[i]._ty - plr[p].WorldY); + dx = abs(towner[i]._tx - plr[p]._px); + dy = abs(towner[i]._ty - plr[p]._py); if (dx >= 2 || dy >= 2) towner[i]._tbtcnt = 0; if (!towner[i]._tbtcnt) { @@ -599,8 +599,8 @@ void TalkToTowner(int p, int t) rv2 = random_(6, 4); /* unused */ rv3 = random_(6, 5); /* unused */ - dx = abs(plr[p].WorldX - towner[t]._tx); - dy = abs(plr[p].WorldY - towner[t]._ty); + dx = abs(plr[p]._px - towner[t]._tx); + dy = abs(plr[p]._py - towner[t]._ty); #ifdef _DEBUG if (!debug_mode_key_d && (dx >= 2 || dy >= 2)) { return; @@ -949,7 +949,7 @@ void CowSFX(int pnum) } #else if (sgdwCowClicks >= 8) { - PlaySfxLoc(TSFX_COW1, plr[pnum].WorldX, plr[pnum].WorldY + 5); + PlaySfxLoc(TSFX_COW1, plr[pnum]._px, plr[pnum]._py + 5); sgdwCowClicks = 4; CowPlaying = snSFX[sgnCowMsg][plr[pnum]._pClass]; /* snSFX is local */ sgnCowMsg++; @@ -959,6 +959,6 @@ void CowSFX(int pnum) CowPlaying = sgdwCowClicks == 4 ? TSFX_COW2 : TSFX_COW1; } #endif - PlaySfxLoc(CowPlaying, plr[pnum].WorldX, plr[pnum].WorldY); + PlaySfxLoc(CowPlaying, plr[pnum]._px, plr[pnum]._py); } } diff --git a/Source/trigs.cpp b/Source/trigs.cpp index c8f30722b..0171b911b 100644 --- a/Source/trigs.cpp +++ b/Source/trigs.cpp @@ -651,7 +651,7 @@ void CheckTriggers() return; for (i = 0; i < numtrigs; i++) { - if (plr[myplr].WorldX != trigs[i]._tx || plr[myplr].WorldY != trigs[i]._ty) { + if (plr[myplr]._px != trigs[i]._tx || plr[myplr]._py != trigs[i]._ty) { continue; } @@ -659,7 +659,7 @@ void CheckTriggers() case WM_DIABNEXTLVL: #ifdef SPAWN if (currlevel >= 2) { - NetSendCmdLoc(TRUE, CMD_WALKXY, plr[myplr].WorldX, plr[myplr].WorldY + 1); + NetSendCmdLoc(TRUE, CMD_WALKXY, plr[myplr]._px, plr[myplr]._py + 1); PlaySFX(PS_WARR18); InitDiabloMsg(EMSG_NOT_IN_SHAREWARE); } else { @@ -685,22 +685,22 @@ void CheckTriggers() if (trigs[i]._tlvl == 5 && plr[myplr]._pLevel < 8) { abort = TRUE; - x = plr[myplr].WorldX; - y = plr[myplr].WorldY + 1; + x = plr[myplr]._px; + y = plr[myplr]._py + 1; abortflag = EMSG_REQUIRES_LVL_8; } if (trigs[i]._tlvl == 9 && plr[myplr]._pLevel < 13) { abort = TRUE; - x = plr[myplr].WorldX + 1; - y = plr[myplr].WorldY; + x = plr[myplr]._px + 1; + y = plr[myplr]._py; abortflag = EMSG_REQUIRES_LVL_13; } if (trigs[i]._tlvl == 13 && plr[myplr]._pLevel < 17) { abort = TRUE; - x = plr[myplr].WorldX; - y = plr[myplr].WorldY + 1; + x = plr[myplr]._px; + y = plr[myplr]._py + 1; abortflag = EMSG_REQUIRES_LVL_17; } diff --git a/structs.h b/structs.h index bba113e92..16efd7a04 100644 --- a/structs.h +++ b/structs.h @@ -185,10 +185,10 @@ typedef struct PlayerStruct { int destParam3; int destParam4; int plrlevel; - int WorldX; - int WorldY; int _px; int _py; + int _pfutx; + int _pfuty; int _ptargx; int _ptargy; int _pownerx; From c384711a5f5e461cbfa36178d4779fb5e5ede567 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 8 Apr 2020 20:16:32 +0200 Subject: [PATCH 02/33] Backport cleanups from hellfire branch --- Source/appfat.cpp | 2 +- Source/control.cpp | 12 +++-- Source/cursor.cpp | 14 ++--- Source/cursor.h | 8 +-- Source/diablo.cpp | 35 ++++++------ Source/diablo.h | 2 +- Source/drlg_l2.cpp | 2 +- Source/drlg_l2.h | 2 +- Source/drlg_l4.cpp | 6 +-- Source/drlg_l4.h | 6 +-- Source/effects.cpp | 7 +-- Source/error.cpp | 4 +- Source/error.h | 2 +- Source/gamemenu.cpp | 23 +++----- Source/gendung.cpp | 110 +++++++++++++++++++------------------- Source/gendung.h | 96 +++++++++++++++++---------------- Source/inv.cpp | 5 +- Source/itemdat.cpp | 2 +- Source/items.cpp | 28 +++++----- Source/items.h | 10 ++-- Source/lighting.cpp | 3 +- Source/monster.cpp | 80 ++++++++++++++-------------- Source/monster.h | 1 + Source/mpqapi.cpp | 8 +-- Source/multi.cpp | 2 +- Source/objects.cpp | 126 +++++++++++++++++++++----------------------- Source/palette.cpp | 8 +-- Source/player.cpp | 82 +++++++++++++++------------- Source/quests.cpp | 2 +- Source/quests.h | 2 +- Source/scrollrt.cpp | 2 - Source/sound.cpp | 4 +- Source/textdat.cpp | 2 +- Source/textdat.h | 2 +- Source/towners.cpp | 62 ++++++++++++---------- Source/towners.h | 2 +- defs.h | 2 + enums.h | 5 +- 38 files changed, 388 insertions(+), 383 deletions(-) diff --git a/Source/appfat.cpp b/Source/appfat.cpp index d6ccf73d7..f18c51742 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -523,7 +523,7 @@ void __cdecl DrawDlg(char *pszFmt, ...) va_start(arglist, pszFmt); wvsprintf(text, pszFmt, arglist); va_end(arglist); - SDrawMessageBox(text, "Diablo", MB_TASKMODAL | MB_ICONEXCLAMATION); + SDrawMessageBox(text, APP_NAME, MB_TASKMODAL | MB_ICONEXCLAMATION); } #ifdef _DEBUG diff --git a/Source/control.cpp b/Source/control.cpp index de19d6716..016b40f4a 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1136,9 +1136,12 @@ void DrawFlask(BYTE *pCelBuff, int w, int nSrcOff, BYTE *pBuff, int nDstOff, int */ void DrawLifeFlask() { - int filled = (double)plr[myplr]._pHitPoints / (double)plr[myplr]._pMaxHP * 80.0; - plr[myplr]._pHPPer = filled; + double p; + int filled; + p = (double)plr[myplr]._pHitPoints / (double)plr[myplr]._pMaxHP * 80.0; + plr[myplr]._pHPPer = p; + filled = plr[myplr]._pHPPer; if (filled > 80) filled = 80; filled = 80 - filled; @@ -1158,7 +1161,10 @@ void DrawLifeFlask() */ void UpdateLifeFlask() { - int filled = (double)plr[myplr]._pHitPoints / (double)plr[myplr]._pMaxHP * 80.0; + double p; + int filled; + p = (double)plr[myplr]._pHitPoints / (double)plr[myplr]._pMaxHP * 80.0; + filled = p; plr[myplr]._pHPPer = filled; if (filled > 69) diff --git a/Source/cursor.cpp b/Source/cursor.cpp index 66c70a3bf..577b08d7b 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -5,17 +5,17 @@ */ #include "all.h" -int cursH; -int icursH28; int cursW; +int cursH; int pcursmonst; int icursW28; +int icursH28; BYTE *pCursCels; -int icursH; /** inv_item value */ char pcursinvitem; int icursW; +int icursH; char pcursitem; char pcursobj; char pcursplr; @@ -26,7 +26,7 @@ int pcurs; /* rdata */ /** Maps from objcurs.cel frame number to frame width. */ -const int InvItemWidth[180] = { +const int InvItemWidth[] = { // Cursors 0, 33, 32, 32, 32, 32, 32, 32, 32, 32, 32, 23, // Items @@ -46,11 +46,11 @@ const int InvItemWidth[180] = { 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, - 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28 + 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, }; /** Maps from objcurs.cel frame number to frame height. */ -const int InvItemHeight[180] = { +const int InvItemHeight[] = { // Cursors 0, 29, 32, 32, 32, 32, 32, 32, 32, 32, 32, 35, // Items @@ -70,7 +70,7 @@ const int InvItemHeight[180] = { 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, - 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28 + 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, }; void InitCursor() diff --git a/Source/cursor.h b/Source/cursor.h index 42b1df215..42da1ff94 100644 --- a/Source/cursor.h +++ b/Source/cursor.h @@ -6,11 +6,11 @@ #ifndef __CURSOR_H__ #define __CURSOR_H__ -extern int cursH; -extern int icursH28; extern int cursW; +extern int cursH; extern int pcursmonst; extern int icursW28; +extern int icursH28; extern BYTE *pCursCels; extern int icursH; extern char pcursinvitem; @@ -34,7 +34,7 @@ void CheckRportal(); void CheckCursMove(); /* rdata */ -extern const int InvItemWidth[180]; -extern const int InvItemHeight[180]; +extern const int InvItemWidth[]; +extern const int InvItemHeight[]; #endif /* __CURSOR_H__ */ diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 4212497d4..405142fb3 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -11,8 +11,8 @@ HWND ghMainWnd; int glMid1Seed[NUMLEVELS]; int glMid2Seed[NUMLEVELS]; int gnLevelTypeTbl[NUMLEVELS]; -int MouseY; int MouseX; +int MouseY; BOOL gbGameLoopStartup; DWORD glSeedTbl[NUMLEVELS]; BOOL gbRunGame; @@ -119,11 +119,11 @@ BOOL StartGame(BOOL bNewGame, BOOL bSinglePlayer) InitPortals(); InitDungMsgs(myplr); } - if (!gbValidSaveFile || !gbLoadGame) + if (!gbValidSaveFile || !gbLoadGame) { uMsg = WM_DIABNEWGAME; - else + } else { uMsg = WM_DIABLOADGAME; - + } run_game_loop(uMsg); NetClose(); pfile_create_player_description(0, 0); @@ -284,7 +284,9 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi fault_get_filter(); bNoEvent = diablo_get_not_running(); - if (!diablo_find_window("DIABLO") && bNoEvent) { + if (diablo_find_window(GAME_NAME) || !bNoEvent) + return 0; + #ifdef _DEBUG SFileEnableDirectAccess(TRUE); #endif @@ -305,11 +307,11 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi #ifndef SPAWN { char szValueName[] = "Intro"; - if (!SRegLoadValue("Diablo", szValueName, 0, &nData)) + if (!SRegLoadValue(APP_NAME, szValueName, 0, &nData)) nData = 1; if (nData) play_movie("gendata\\diablo1.smk", TRUE); - SRegSaveValue("Diablo", szValueName, 0, 0); + SRegSaveValue(APP_NAME, szValueName, 0, 0); } #endif @@ -330,9 +332,8 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi Sleep(300); DestroyWindow(ghMainWnd); } - } - return FALSE; + return 0; } void diablo_parse_flags(char *args) @@ -349,13 +350,18 @@ void diablo_parse_flags(char *args) if (_strnicmp("dd_emulate", args, strlen("dd_emulate")) == 0) { gbEmulate = 1; args += strlen("dd_emulate"); - } else if (_strnicmp("dd_backbuf", args, strlen("dd_backbuf")) == 0) { + continue; + } + if (_strnicmp("dd_backbuf", args, strlen("dd_backbuf")) == 0) { gbBackBuf = 1; args += strlen("dd_backbuf"); - } else if (_strnicmp("ds_noduplicates", args, strlen("ds_noduplicates")) == 0) { + continue; + } + if (_strnicmp("ds_noduplicates", args, strlen("ds_noduplicates")) == 0) { gbDupSounds = FALSE; args += strlen("ds_noduplicates"); - } else { + continue; + } c = tolower(*args); args++; #ifdef _DEBUG @@ -483,7 +489,6 @@ void diablo_parse_flags(char *args) #endif } } -} void diablo_init_screen() { @@ -1921,7 +1926,8 @@ void diablo_color_cyc_logic() tc = GetTickCount(); if (tc - color_cycle_timer >= 50) { color_cycle_timer = tc; - if (palette_get_color_cycling()) { + if (!palette_get_color_cycling()) + return; if (leveltype == DTYPE_HELL) { lighting_color_cycling(); } else if (leveltype == DTYPE_CAVES) { @@ -1930,4 +1936,3 @@ void diablo_color_cyc_logic() } } } -} diff --git a/Source/diablo.h b/Source/diablo.h index 1e3f50020..10197bd18 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -10,8 +10,8 @@ extern HWND ghMainWnd; extern int glMid1Seed[NUMLEVELS]; extern int glMid2Seed[NUMLEVELS]; extern int gnLevelTypeTbl[NUMLEVELS]; -extern int MouseY; extern int MouseX; +extern int MouseY; extern BOOL gbGameLoopStartup; extern DWORD glSeedTbl[NUMLEVELS]; extern BOOL gbRunGame; diff --git a/Source/drlg_l2.cpp b/Source/drlg_l2.cpp index 6ca206290..17608cba6 100644 --- a/Source/drlg_l2.cpp +++ b/Source/drlg_l2.cpp @@ -7,8 +7,8 @@ #include "all.h" int nSx1; -int nSx2; int nSy1; +int nSx2; int nSy2; int nRoomCnt; BYTE predungeon[DMAXX][DMAXY]; diff --git a/Source/drlg_l2.h b/Source/drlg_l2.h index 8b9e86906..c0a7a0184 100644 --- a/Source/drlg_l2.h +++ b/Source/drlg_l2.h @@ -7,8 +7,8 @@ #define __DRLG_L2_H__ extern int nSx1; -extern int nSx2; extern int nSy1; +extern int nSx2; extern int nSy2; extern int nRoomCnt; extern BYTE predungeon[DMAXX][DMAXY]; diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index 8a0f6a5ff..0be518c0b 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -7,10 +7,10 @@ int diabquad1x; int diabquad1y; -int diabquad3x; -int diabquad3y; int diabquad2x; int diabquad2y; +int diabquad3x; +int diabquad3y; int diabquad4x; int diabquad4y; #ifndef SPAWN @@ -18,8 +18,8 @@ BOOL hallok[20]; int l4holdx; int l4holdy; int SP4x1; -int SP4x2; int SP4y1; +int SP4x2; int SP4y2; BYTE L4dungeon[80][80]; BYTE dung[20][20]; diff --git a/Source/drlg_l4.h b/Source/drlg_l4.h index cf64e9176..b2e52c776 100644 --- a/Source/drlg_l4.h +++ b/Source/drlg_l4.h @@ -8,18 +8,18 @@ extern int diabquad1x; extern int diabquad1y; -extern int diabquad3x; -extern int diabquad3y; extern int diabquad2x; extern int diabquad2y; +extern int diabquad3x; +extern int diabquad3y; extern int diabquad4x; extern int diabquad4y; extern BOOL hallok[20]; extern int l4holdx; extern int l4holdy; extern int SP4x1; -extern int SP4x2; extern int SP4y1; +extern int SP4x2; extern int SP4y2; extern BYTE L4dungeon[80][80]; extern BYTE dung[20][20]; diff --git a/Source/effects.cpp b/Source/effects.cpp index 68bb52a29..c75005dca 100644 --- a/Source/effects.cpp +++ b/Source/effects.cpp @@ -914,6 +914,7 @@ TSFX sgSFX[] = { // clang-format on }; +#define PLRSFXS (SFX_WARRIOR | SFX_ROGUE | SFX_SORCEROR) BOOL effect_is_playing(int nSFX) { TSFX *sfx = &sgSFX[nSFX]; @@ -1224,7 +1225,7 @@ void sound_init() { BYTE mask = 0; if (gbMaxPlayers > 1) { - mask = SFX_WARRIOR | SFX_ROGUE | SFX_SORCEROR; + mask = PLRSFXS; } else if (plr[myplr]._pClass == PC_WARRIOR) { mask = SFX_WARRIOR; } else if (plr[myplr]._pClass == PC_ROGUE) { @@ -1247,7 +1248,7 @@ void priv_sound_init(BYTE bLoadMask) return; } - pc = bLoadMask & (SFX_ROGUE | SFX_WARRIOR | SFX_SORCEROR); + pc = bLoadMask & PLRSFXS; bLoadMask ^= pc; for (i = 0; i < sizeof(sgSFX) / sizeof(TSFX); i++) { @@ -1263,7 +1264,7 @@ void priv_sound_init(BYTE bLoadMask) continue; } - if (sgSFX[i].bFlags & (SFX_ROGUE | SFX_WARRIOR | SFX_SORCEROR) && !(sgSFX[i].bFlags & pc)) { + if (sgSFX[i].bFlags & PLRSFXS && !(sgSFX[i].bFlags & pc)) { continue; } diff --git a/Source/error.cpp b/Source/error.cpp index 2df97ac30..5d09863d6 100644 --- a/Source/error.cpp +++ b/Source/error.cpp @@ -11,7 +11,7 @@ char msgflag; char msgcnt; /** Maps from error_id to error message. */ -char *MsgStrings[44] = { +char *MsgStrings[] = { "", "No automap available in town", "No multiplayer functions in demo", @@ -55,7 +55,7 @@ char *MsgStrings[44] = { "You must be at least level 8 to use this.", "You must be at least level 13 to use this.", "You must be at least level 17 to use this.", - "Arcane knowledge gained!" + "Arcane knowledge gained!", }; void InitDiabloMsg(char e) diff --git a/Source/error.h b/Source/error.h index 046307b88..770506b18 100644 --- a/Source/error.h +++ b/Source/error.h @@ -16,6 +16,6 @@ void ClrDiabloMsg(); void DrawDiabloMsg(); /* data */ -extern char *MsgStrings[44]; +extern char *MsgStrings[]; #endif /* __ERROR_H__ */ diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index b761e8d49..bc1e6bdea 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -217,42 +217,31 @@ void gamemenu_get_gamma() void gamemenu_music_volume(BOOL bActivate) { int volume; + if (bActivate) { if (gbMusicOn) { gbMusicOn = FALSE; music_stop(); sound_get_or_set_music_volume(VOLUME_MIN); - gamemenu_get_music(); - return; - } + } else { gbMusicOn = TRUE; sound_get_or_set_music_volume(VOLUME_MAX); music_start(leveltype); - gamemenu_get_music(); - return; } - + } else { volume = gamemenu_slider_music_sound(sgOptionsMenu); sound_get_or_set_music_volume(volume); if (volume == VOLUME_MIN) { - if (gbMusicOn) { gbMusicOn = FALSE; music_stop(); } - - gamemenu_get_music(); - return; - } - - if (gbMusicOn) { - gamemenu_get_music(); - return; - } - + } else if (!gbMusicOn) { gbMusicOn = TRUE; music_start(leveltype); + } + } gamemenu_get_music(); } diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 3133dc170..964994c3e 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -5,87 +5,85 @@ */ #include "all.h" -WORD level_frame_types[MAXTILES]; -int themeCount; -/** - * List of transparent dPieces - */ -BOOLEAN nTransTable[2049]; -//int dword_52D204; -int dMonster[MAXDUNX][MAXDUNY]; BYTE dungeon[DMAXX][DMAXY]; -char dObject[MAXDUNX][MAXDUNY]; -BYTE *pSpeedCels; -int nlevel_frames; BYTE pdungeon[DMAXX][DMAXY]; -char dDead[MAXDUNX][MAXDUNY]; -MICROS dpiece_defs_map_1[MAXDUNX * MAXDUNY]; -char dPreLight[MAXDUNX][MAXDUNY]; -char TransVal; -int MicroTileLen; char dflags[DMAXX][DMAXY]; -int dPiece[MAXDUNX][MAXDUNY]; -char dLight[MAXDUNX][MAXDUNY]; +int setpc_x; +int setpc_y; +int setpc_w; +int setpc_h; +BYTE *pSetPiece; BOOL setloadflag; -int tile_defs[MAXTILES]; +BYTE *pSpecialCels; BYTE *pMegaTiles; BYTE *pLevelPieces; -int gnDifficulty; +BYTE *pDungeonCels; +BYTE *pSpeedCels; +int SpeedFrameTbl[128][16]; /** * List of transparancy masks to use for dPieces */ char block_lvid[2049]; -//char byte_5B78EB; -char dTransVal[MAXDUNX][MAXDUNY]; -BOOLEAN nTrapTable[2049]; -BYTE leveltype; -BYTE currlevel; -BOOLEAN TransList[256]; +int level_frame_count[MAXTILES]; +int tile_defs[MAXTILES]; +WORD level_frame_types[MAXTILES]; +int level_frame_sizes[MAXTILES]; +int nlevel_frames; +/** + * List of light blocking dPieces + */ +BOOLEAN nBlockTable[2049]; /** * List of path blocking dPieces */ BOOLEAN nSolidTable[2049]; -int level_frame_count[MAXTILES]; -ScrollStruct ScrollInfo; -BYTE *pDungeonCels; -int SpeedFrameTbl[128][16]; -THEME_LOC themeLoc[MAXTHEMES]; -char dPlayer[MAXDUNX][MAXDUNY]; -int ViewBX; -int ViewBY; -int ViewDX; -int ViewDY; -char dSpecial[MAXDUNX][MAXDUNY]; /** - * List of light blocking dPieces + * List of transparent dPieces */ -BOOLEAN nBlockTable[2049]; -BYTE *pSpecialCels; -char dFlags[MAXDUNX][MAXDUNY]; -char dItem[MAXDUNX][MAXDUNY]; -BYTE setlvlnum; -int level_frame_sizes[MAXTILES]; +BOOLEAN nTransTable[2049]; /** * List of missile blocking dPieces */ BOOLEAN nMissileTable[2049]; -BYTE *pSetPiece; -char setlvltype; -BOOLEAN setlevel; -int LvlViewY; -int LvlViewX; +BOOLEAN nTrapTable[2049]; +int dminx; +int dminy; int dmaxx; int dmaxy; -int setpc_h; -int setpc_w; -int setpc_x; +int gnDifficulty; +BYTE leveltype; +BYTE currlevel; +BOOLEAN setlevel; +BYTE setlvlnum; +char setlvltype; int ViewX; int ViewY; -int setpc_y; -char dMissile[MAXDUNX][MAXDUNY]; -int dminx; -int dminy; +int ViewBX; +int ViewBY; +int ViewDX; +int ViewDY; +ScrollStruct ScrollInfo; +int LvlViewX; +int LvlViewY; +int MicroTileLen; +char TransVal; +BOOLEAN TransList[256]; +int dPiece[MAXDUNX][MAXDUNY]; MICROS dpiece_defs_map_2[MAXDUNX][MAXDUNY]; +MICROS dpiece_defs_map_1[MAXDUNX * MAXDUNY]; +char dTransVal[MAXDUNX][MAXDUNY]; +char dLight[MAXDUNX][MAXDUNY]; +char dPreLight[MAXDUNX][MAXDUNY]; +char dFlags[MAXDUNX][MAXDUNY]; +char dPlayer[MAXDUNX][MAXDUNY]; +int dMonster[MAXDUNX][MAXDUNY]; +char dDead[MAXDUNX][MAXDUNY]; +char dObject[MAXDUNX][MAXDUNY]; +char dItem[MAXDUNX][MAXDUNY]; +char dMissile[MAXDUNX][MAXDUNY]; +char dSpecial[MAXDUNX][MAXDUNY]; +int themeCount; +THEME_LOC themeLoc[MAXTHEMES]; void FillSolidBlockTbls() { diff --git a/Source/gendung.h b/Source/gendung.h index 3de618721..3a34834b2 100644 --- a/Source/gendung.h +++ b/Source/gendung.h @@ -6,72 +6,70 @@ #ifndef __GENDUNG_H__ #define __GENDUNG_H__ -extern WORD level_frame_types[MAXTILES]; -extern int themeCount; -extern BOOLEAN nTransTable[2049]; -//int dword_52D204; -extern int dMonster[MAXDUNX][MAXDUNY]; extern BYTE dungeon[DMAXX][DMAXY]; -extern char dObject[MAXDUNX][MAXDUNY]; -extern BYTE *pSpeedCels; -extern int nlevel_frames; extern BYTE pdungeon[DMAXX][DMAXY]; -extern char dDead[MAXDUNX][MAXDUNY]; -extern MICROS dpiece_defs_map_1[MAXDUNX * MAXDUNY]; -extern char dPreLight[MAXDUNX][MAXDUNY]; -extern char TransVal; -extern int MicroTileLen; extern char dflags[DMAXX][DMAXY]; -extern int dPiece[MAXDUNX][MAXDUNY]; -extern char dLight[MAXDUNX][MAXDUNY]; +extern int setpc_x; +extern int setpc_y; +extern int setpc_w; +extern int setpc_h; +extern BYTE *pSetPiece; extern BOOL setloadflag; -extern int tile_defs[MAXTILES]; +extern BYTE *pSpecialCels; extern BYTE *pMegaTiles; extern BYTE *pLevelPieces; -extern int gnDifficulty; +extern BYTE *pDungeonCels; +extern BYTE *pSpeedCels; +extern int SpeedFrameTbl[128][16]; extern char block_lvid[2049]; -//char byte_5B78EB; -extern char dTransVal[MAXDUNX][MAXDUNY]; +extern int level_frame_count[MAXTILES]; +extern int tile_defs[MAXTILES]; +extern WORD level_frame_types[MAXTILES]; +extern int level_frame_sizes[MAXTILES]; +extern int nlevel_frames; +extern BOOLEAN nBlockTable[2049]; +extern BOOLEAN nSolidTable[2049]; +extern BOOLEAN nTransTable[2049]; +extern BOOLEAN nMissileTable[2049]; extern BOOLEAN nTrapTable[2049]; +extern int dminx; +extern int dminy; +extern int dmaxx; +extern int dmaxy; +extern int gnDifficulty; extern BYTE leveltype; extern BYTE currlevel; -extern BOOLEAN TransList[256]; -extern BOOLEAN nSolidTable[2049]; -extern int level_frame_count[MAXTILES]; -extern ScrollStruct ScrollInfo; -extern BYTE *pDungeonCels; -extern int SpeedFrameTbl[128][16]; -extern THEME_LOC themeLoc[MAXTHEMES]; -extern char dPlayer[MAXDUNX][MAXDUNY]; +extern BOOLEAN setlevel; +extern BYTE setlvlnum; +extern char setlvltype; +extern int ViewX; +extern int ViewY; extern int ViewBX; extern int ViewBY; extern int ViewDX; extern int ViewDY; -extern char dSpecial[MAXDUNX][MAXDUNY]; -extern BOOLEAN nBlockTable[2049]; -extern BYTE *pSpecialCels; +extern ScrollStruct ScrollInfo; +extern int LvlViewX; +extern int LvlViewY; +extern int MicroTileLen; +extern char TransVal; +extern BOOLEAN TransList[256]; +extern int dPiece[MAXDUNX][MAXDUNY]; +extern MICROS dpiece_defs_map_2[MAXDUNX][MAXDUNY]; +extern MICROS dpiece_defs_map_1[MAXDUNX * MAXDUNY]; +extern char dTransVal[MAXDUNX][MAXDUNY]; +extern char dLight[MAXDUNX][MAXDUNY]; +extern char dPreLight[MAXDUNX][MAXDUNY]; extern char dFlags[MAXDUNX][MAXDUNY]; +extern char dPlayer[MAXDUNX][MAXDUNY]; +extern int dMonster[MAXDUNX][MAXDUNY]; +extern char dDead[MAXDUNX][MAXDUNY]; +extern char dObject[MAXDUNX][MAXDUNY]; extern char dItem[MAXDUNX][MAXDUNY]; -extern BYTE setlvlnum; -extern int level_frame_sizes[MAXTILES]; -extern BOOLEAN nMissileTable[2049]; -extern BYTE *pSetPiece; -extern char setlvltype; -extern BOOLEAN setlevel; -extern int LvlViewY; -extern int LvlViewX; -extern int dmaxx; -extern int dmaxy; -extern int setpc_h; -extern int setpc_w; -extern int setpc_x; -extern int ViewX; -extern int ViewY; -extern int setpc_y; extern char dMissile[MAXDUNX][MAXDUNY]; -extern int dminx; -extern int dminy; -extern MICROS dpiece_defs_map_2[MAXDUNX][MAXDUNY]; +extern char dSpecial[MAXDUNX][MAXDUNY]; +extern int themeCount; +extern THEME_LOC themeLoc[MAXTHEMES]; void FillSolidBlockTbls(); void MakeSpeedCels(); diff --git a/Source/inv.cpp b/Source/inv.cpp index b518f5da1..1304a07a7 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -1542,8 +1542,9 @@ void AutoGetItem(int pnum, int ii) dropGoldValue = 0; } - if (ii != MAXITEMS && !dItem[item[ii]._ix][item[ii]._iy]) { - return; + if (ii != MAXITEMS) { + if (dItem[item[ii]._ix][item[ii]._iy] == 0) + return; } item[ii]._iCreateInfo &= 0x7FFF; diff --git a/Source/itemdat.cpp b/Source/itemdat.cpp index 2def88407..4d7a5ffa6 100644 --- a/Source/itemdat.cpp +++ b/Source/itemdat.cpp @@ -17,7 +17,7 @@ ItemDataStruct AllItemsList[] = { { IDROP_NEVER, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_SHORT_STAFF, 10, UITYPE_NONE, "Short Staff of Charged Bolt", NULL, 1, 25, 2, 4, 0, 0, 0, 20, 0, ISPL_NONE, IMISC_STAFF, SPL_CBOLT, FALSE, 520, 520 }, { IDROP_NEVER, ICLASS_WEAPON, ILOC_TWOHAND, ICURS_CLEAVER, 2, UITYPE_CLEAVER, "Cleaver", NULL, 10, 10, 4, 24, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 2000, 2000 }, { IDROP_NEVER, ICLASS_ARMOR, ILOC_HELM, ICURS_THE_UNDEAD_CROWN, 7, UITYPE_SKCROWN, "The Undead Crown", NULL, 0, 50, 0, 0, 15, 15, 0, 0, 0, ISPL_RNDSTEALLIFE, IMISC_UNIQUE, SPL_NULL, FALSE, 10000, 10000 }, - { IDROP_NEVER, ICLASS_MISC, ILOC_RING, ICURS_EMPYREAN_BAND, 12, UITYPE_INFRARING, "Empyrean Band", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 8000, 8000 }, + { IDROP_NEVER, ICLASS_MISC, ILOC_RING, ICURS_EMPYREAN_BAND, 12, UITYPE_INFRARING, "Empyrean Band", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 8000, 8000 }, { IDROP_NEVER, ICLASS_QUEST, ILOC_UNEQUIPABLE, ICURS_MAGIC_ROCK, 0, UITYPE_NONE, "Magic Rock", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_NONE, SPL_NULL, FALSE, 0, 0 }, { IDROP_NEVER, ICLASS_MISC, ILOC_AMULET, ICURS_OPTIC_AMULET, 13, UITYPE_OPTAMULET, "Optic Amulet", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 5000, 5000 }, { IDROP_NEVER, ICLASS_MISC, ILOC_RING, ICURS_RING_OF_TRUTH, 12, UITYPE_TRING, "Ring of Truth", NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, ISPL_NONE, IMISC_UNIQUE, SPL_NULL, FALSE, 1000, 1000 }, diff --git a/Source/items.cpp b/Source/items.cpp index 7a51f1d94..557802247 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -19,7 +19,7 @@ int gnNumGetRecords; /* data */ -BYTE ItemCAnimTbl[169] = { +BYTE ItemCAnimTbl[] = { 20, 16, 16, 16, 4, 4, 4, 12, 12, 12, 12, 12, 12, 12, 12, 21, 21, 25, 12, 28, 28, 28, 0, 0, 0, 32, 0, 0, 0, 24, @@ -38,7 +38,7 @@ BYTE ItemCAnimTbl[169] = { 14, 17, 17, 17, 0, 34, 1, 0, 3, 17, 8, 8, 6, 1, 3, 3, 11, 3, 4 }; -char *ItemDropNames[ITEMTYPES] = { +char *ItemDropNames[] = { "Armor2", "Axe", "FBttle", @@ -73,9 +73,9 @@ char *ItemDropNames[ITEMTYPES] = { "Innsign", "Bldstn", "Fanvil", - "FLazStaf" + "FLazStaf", }; -BYTE ItemAnimLs[ITEMTYPES] = { +BYTE ItemAnimLs[] = { 15, 13, 16, @@ -110,9 +110,9 @@ BYTE ItemAnimLs[ITEMTYPES] = { 13, 13, 13, - 8 + 8, }; -int ItemDropSnds[ITEMTYPES] = { +int ItemDropSnds[] = { IS_FHARM, IS_FAXE, IS_FPOT, @@ -147,9 +147,9 @@ int ItemDropSnds[ITEMTYPES] = { IS_ISIGN, IS_FBLST, IS_FANVL, - IS_FSTAF + IS_FSTAF, }; -int ItemInvSnds[ITEMTYPES] = { +int ItemInvSnds[] = { IS_IHARM, IS_IAXE, IS_IPOT, @@ -184,7 +184,7 @@ int ItemInvSnds[ITEMTYPES] = { IS_ISIGN, IS_IBLST, IS_IANVL, - IS_ISTAF + IS_ISTAF, }; int idoppely = 16; int premiumlvladd[6] = { -1, -1, 0, 0, 1, 2 }; @@ -340,8 +340,8 @@ void CalcPlrItemVals(int p, BOOL Loadgfx) ItemStruct *itm = &plr[p].InvBody[i]; if (itm->_itype != ITYPE_NONE && itm->_iStatFlag) { - mind += itm->_iMinDam; tac += itm->_iAC; + mind += itm->_iMinDam; maxd += itm->_iMaxDam; if (itm->_iSpell != SPL_NULL) { @@ -357,7 +357,6 @@ void CalcPlrItemVals(int p, BOOL Loadgfx) tmpac = 1; bac += tmpac; } - dmod += itm->_iPLDamMod; iflgs |= itm->_iFlags; sadd += itm->_iPLStr; madd += itm->_iPLMag; @@ -366,6 +365,7 @@ void CalcPlrItemVals(int p, BOOL Loadgfx) fr += itm->_iPLFR; lr += itm->_iPLLR; mr += itm->_iPLMR; + dmod += itm->_iPLDamMod; ghit += itm->_iPLGetHit; lrad += itm->_iPLLight; ihp += itm->_iPLHP; @@ -393,15 +393,15 @@ void CalcPlrItemVals(int p, BOOL Loadgfx) } } + plr[p]._pIMinDam = mind; plr[p]._pIMaxDam = maxd; plr[p]._pIAC = tac; plr[p]._pIBonusDam = bdam; plr[p]._pIBonusToHit = btohit; plr[p]._pIBonusAC = bac; plr[p]._pIFlags = iflgs; - plr[p]._pIGetHit = ghit; - plr[p]._pIMinDam = mind; plr[p]._pIBonusDamMod = dmod; + plr[p]._pIGetHit = ghit; if (lrad < 2) { lrad = 2; @@ -2480,7 +2480,7 @@ void FreeItemGFX() { int i; - for (i = 0; i < 35; i++) { + for (i = 0; i < ITEMTYPES; i++) { MemFreeDbg(itemanims[i]); } } diff --git a/Source/items.h b/Source/items.h index 729761e96..0e4548e47 100644 --- a/Source/items.h +++ b/Source/items.h @@ -132,11 +132,11 @@ void PutItemRecord(int nSeed, WORD wCI, int nIndex); /* data */ -extern BYTE ItemCAnimTbl[169]; -extern char *ItemDropNames[ITEMTYPES]; -extern BYTE ItemAnimLs[ITEMTYPES]; -extern int ItemDropSnds[ITEMTYPES]; -extern int ItemInvSnds[ITEMTYPES]; +extern BYTE ItemCAnimTbl[]; +extern char *ItemDropNames[]; +extern BYTE ItemAnimLs[]; +extern int ItemDropSnds[]; +extern int ItemInvSnds[]; extern int idoppely; extern int premiumlvladd[6]; diff --git a/Source/lighting.cpp b/Source/lighting.cpp index 5446a221a..3895944d1 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -654,9 +654,8 @@ void DoUnLight(int nXPos, int nYPos, int nRadius) for (y = min_y; y < max_y; y++) { for (x = min_x; x < max_x; x++) { - if (x >= 0 && x < MAXDUNX && y >= 0 && y < MAXDUNY) { + if (x >= 0 && x < MAXDUNX && y >= 0 && y < MAXDUNY) dLight[x][y] = dPreLight[x][y]; - } } } } diff --git a/Source/monster.cpp b/Source/monster.cpp index 5c51ff4cf..c993c0ead 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -17,6 +17,7 @@ BOOLEAN sgbSaveSoundOn; MonsterStruct monster[MAXMONSTERS]; int totalmonsters; CMonster Monsters[MAX_LVLMTYPES]; +BYTE GraphicTable[NUMLEVELS][MAX_LVLMTYPES]; int monstimgtot; int uniquetrans; int nummtypes; @@ -689,15 +690,9 @@ void PlaceUniqueMonst(int uniqindex, int miniontype, int unpackfilesize) Monst->mtalkmsg = Uniq->mtalkmsg; Monst->mlid = AddLight(Monst->_mx, Monst->_my, 3); - if (gbMaxPlayers == 1) { - if (Monst->mtalkmsg) { - Monst->_mgoal = MGOAL_INQUIRING; - } - } else { - if (Monst->_mAi == AI_LAZHELP) { + if (gbMaxPlayers != 1) { + if (Monst->_mAi == AI_LAZHELP) Monst->mtalkmsg = 0; - } - if (Monst->_mAi != AI_LAZURUS || quests[Q_BETRAYER]._qvar1 <= 3) { if (Monst->mtalkmsg) { Monst->_mgoal = MGOAL_INQUIRING; @@ -706,10 +701,12 @@ void PlaceUniqueMonst(int uniqindex, int miniontype, int unpackfilesize) Monst->_mgoal = MGOAL_NORMAL; } } + else if (Monst->mtalkmsg) + Monst->_mgoal = MGOAL_INQUIRING; if (gnDifficulty == DIFF_NIGHTMARE) { - Monst->mLevel += 15; Monst->_mmaxhp = 3 * Monst->_mmaxhp + 64; + Monst->mLevel += 15; Monst->_mhitpoints = Monst->_mmaxhp; Monst->mExp = 2 * (Monst->mExp + 1000); Monst->mMinDamage = 2 * (Monst->mMinDamage + 2); @@ -719,8 +716,8 @@ void PlaceUniqueMonst(int uniqindex, int miniontype, int unpackfilesize) } if (gnDifficulty == DIFF_HELL) { - Monst->mLevel += 30; Monst->_mmaxhp = 4 * Monst->_mmaxhp + 192; + Monst->mLevel += 30; Monst->_mhitpoints = Monst->_mmaxhp; Monst->mExp = 4 * (Monst->mExp + 1000); Monst->mMinDamage = 4 * Monst->mMinDamage + 6; @@ -1632,6 +1629,7 @@ void M2MStartHit(int mid, int i, int dam) void MonstStartKill(int i, int pnum, BOOL sendmsg) { int md; + MonsterStruct *Monst; if ((DWORD)i >= MAXMONSTERS) { app_fatal("MonstStartKill: Invalid monster %d", i); @@ -1640,19 +1638,20 @@ void MonstStartKill(int i, int pnum, BOOL sendmsg) app_fatal("MonstStartKill: Monster %d \"%s\" MType NULL", i, monster[i].mName); } + Monst = &monster[i]; if (pnum >= 0) - monster[i].mWhoHit |= 1 << pnum; + Monst->mWhoHit |= 1 << pnum; if (pnum < MAX_PLRS && i > MAX_PLRS) - AddPlrMonstExper(monster[i].mLevel, monster[i].mExp, monster[i].mWhoHit); - monstkills[monster[i].MType->mtype]++; - monster[i]._mhitpoints = 0; - SetRndSeed(monster[i]._mRndSeed); - if (QuestStatus(Q_GARBUD) && monster[i].mName == UniqMonst[UMT_GARBUD].mName) { - CreateTypeItem(monster[i]._mx + 1, monster[i]._my + 1, TRUE, ITYPE_MACE, IMISC_NONE, TRUE, FALSE); + AddPlrMonstExper(Monst->mLevel, Monst->mExp, Monst->mWhoHit); + monstkills[Monst->MType->mtype]++; + Monst->_mhitpoints = 0; + SetRndSeed(Monst->_mRndSeed); + if (QuestStatus(Q_GARBUD) && Monst->mName == UniqMonst[UMT_GARBUD].mName) { + CreateTypeItem(Monst->_mx + 1, Monst->_my + 1, TRUE, ITYPE_MACE, IMISC_NONE, TRUE, FALSE); } else if (i > MAX_PLRS - 1) { // Golems should not spawn items - SpawnItem(i, monster[i]._mx, monster[i]._my, sendmsg); + SpawnItem(i, Monst->_mx, Monst->_my, sendmsg); } - if (monster[i].MType->mtype == MT_DIABLO) + if (Monst->MType->mtype == MT_DIABLO) M_DiabloDeath(i, TRUE); else PlayEffect(i, 2); @@ -1660,24 +1659,24 @@ void MonstStartKill(int i, int pnum, BOOL sendmsg) if (pnum >= 0) md = M_GetDir(i); else - md = monster[i]._mdir; - monster[i]._mdir = md; - NewMonsterAnim(i, monster[i].MType->Anims[MA_DEATH], md); - monster[i]._mmode = MM_DEATH; - monster[i]._mxoff = 0; - monster[i]._myoff = 0; - monster[i]._mVar1 = 0; - monster[i]._mx = monster[i]._moldx; - monster[i]._my = monster[i]._moldy; - monster[i]._mfutx = monster[i]._moldx; - monster[i]._mfuty = monster[i]._moldy; + md = Monst->_mdir; + Monst->_mdir = md; + NewMonsterAnim(i, Monst->MType->Anims[MA_DEATH], md); + Monst->_mmode = MM_DEATH; + Monst->_mxoff = 0; + Monst->_myoff = 0; + Monst->_mVar1 = 0; + Monst->_mx = Monst->_moldx; + Monst->_my = Monst->_moldy; + Monst->_mfutx = Monst->_moldx; + Monst->_mfuty = Monst->_moldy; M_CheckEFlag(i); M_ClearSquares(i); - dMonster[monster[i]._mx][monster[i]._my] = i + 1; + dMonster[Monst->_mx][Monst->_my] = i + 1; CheckQuestKill(i, sendmsg); - M_FallenFear(monster[i]._mx, monster[i]._my); - if (monster[i].MType->mtype >= MT_NACID && monster[i].MType->mtype <= MT_XACID) - AddMissile(monster[i]._mx, monster[i]._my, 0, 0, 0, MIS_ACIDPUD, 1, i, monster[i]._mint + 1, 0); + M_FallenFear(Monst->_mx, Monst->_my); + if (Monst->MType->mtype >= MT_NACID && Monst->MType->mtype <= MT_XACID) + AddMissile(Monst->_mx, Monst->_my, 0, 0, 0, MIS_ACIDPUD, 1, i, Monst->_mint + 1, 0); } void M2MStartKill(int i, int mid) @@ -5510,19 +5509,20 @@ BOOL CheckMonsterHit(int m, BOOL &ret) } if (monster[m]._mAi == AI_GARG && monster[m]._mFlags & MFLAG_ALLOW_SPECIAL) { - monster[m]._mmode = MM_SATTACK; monster[m]._mFlags &= ~MFLAG_ALLOW_SPECIAL; + monster[m]._mmode = MM_SATTACK; ret = TRUE; return TRUE; } - if (monster[m].MType->mtype < MT_COUNSLR || monster[m].MType->mtype > MT_ADVOCATE || monster[m]._mgoal == MGOAL_NORMAL) { - return FALSE; - } else { - ret = FALSE; + if (monster[m].MType->mtype >= MT_COUNSLR && monster[m].MType->mtype <= MT_ADVOCATE) { + if (monster[m]._mgoal != MGOAL_NORMAL) { + ret = FALSE; + return TRUE; + } } - return TRUE; + return FALSE; } int encode_enemy(int m) diff --git a/Source/monster.h b/Source/monster.h index 881e4cabd..c5028c8da 100644 --- a/Source/monster.h +++ b/Source/monster.h @@ -13,6 +13,7 @@ extern int nummonsters; extern MonsterStruct monster[MAXMONSTERS]; extern int totalmonsters; extern CMonster Monsters[MAX_LVLMTYPES]; +extern BYTE GraphicTable[NUMLEVELS][MAX_LVLMTYPES]; extern int monstimgtot; extern int uniquetrans; extern int nummtypes; diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 6c88bff4f..6d33ffdb6 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -62,9 +62,9 @@ BOOL mpqapi_reg_load_modification_time(char *dst, int size) pszDst = dst; memset(dst, 0, size); #ifdef SPAWN - if (!SRegLoadData("Diablo", "Audio Playback ", 0, (BYTE *)pszDst, size, &nbytes_read)) { + if (!SRegLoadData(APP_NAME, "Audio Playback ", 0, (BYTE *)pszDst, size, &nbytes_read)) { #else - if (!SRegLoadData("Diablo", "Video Player ", 0, (BYTE *)pszDst, size, &nbytes_read)) { + if (!SRegLoadData(APP_NAME, "Video Player ", 0, (BYTE *)pszDst, size, &nbytes_read)) { #endif return FALSE; } @@ -132,9 +132,9 @@ BOOLEAN mpqapi_reg_store_modification_time(char *pbData, DWORD dwLen) } #ifdef SPAWN - return SRegSaveData("Diablo", "Audio Playback ", 0, (BYTE *)pbData, dwLen); + return SRegSaveData(APP_NAME, "Audio Playback ", 0, (BYTE *)pbData, dwLen); #else - return SRegSaveData("Diablo", "Video Player ", 0, (BYTE *)pbData, dwLen); + return SRegSaveData(APP_NAME, "Video Player ", 0, (BYTE *)pbData, dwLen); #endif } diff --git a/Source/multi.cpp b/Source/multi.cpp index 1eca34566..76a0c4d95 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -772,7 +772,7 @@ BOOL NetInit(BOOL bSinglePlayer, BOOL *pfExitProgram) gnDifficulty = sgGameInitInfo.bDiff; SetRndSeed(sgGameInitInfo.dwSeed); - for (i = 0; i < 17; i++) { + for (i = 0; i < NUMLEVELS; i++) { glSeedTbl[i] = GetRndSeed(); gnLevelTypeTbl[i] = InitLevelType(i); } diff --git a/Source/objects.cpp b/Source/objects.cpp index 2f75c9127..ec16cbae5 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -196,12 +196,13 @@ void InitRndLocBigObj(int min, int max, int objtype) void InitRndLocObj5x5(int min, int max, int objtype) { BOOL exit; - int xp, yp, numobjs, i, k, m, n; + int xp, yp, numobjs, i, cnt, m, n; numobjs = min + random_(139, max - min); for (i = 0; i < numobjs; i++) { - k = 0; - for (;;) { + cnt = 0; + exit = FALSE; + while (!exit) { exit = TRUE; xp = random_(139, 80) + 16; yp = random_(139, 80) + 16; @@ -211,11 +212,11 @@ void InitRndLocObj5x5(int min, int max, int objtype) exit = FALSE; } } - if (exit) - break; - k++; - if (k > 20000) - return; + if (!exit) { + cnt++; + if (cnt > 20000) + return; + } } AddObject(objtype, xp, yp); } @@ -286,11 +287,12 @@ void AddCandles() void AddBookLever(int lx1, int ly1, int lx2, int ly2, int x1, int y1, int x2, int y2, int msg) { - BOOL exit; - int xp, yp, ob, k, m, n; + DIABOOL exit; + int xp, yp, ob, cnt, m, n; - k = 0; - for (;;) { + cnt = 0; + exit = FALSE; + while (!exit) { exit = TRUE; xp = random_(139, 80) + 16; yp = random_(139, 80) + 16; @@ -300,11 +302,11 @@ void AddBookLever(int lx1, int ly1, int lx2, int ly2, int x1, int y1, int x2, in exit = FALSE; } } - if (exit) - break; - k++; - if (k > 20000) + if (!exit) { + cnt++; + if (cnt > 20000) return; + } } if (QuestStatus(Q_BLIND)) @@ -619,7 +621,8 @@ void AddStoryBooks() BOOL done; cnt = 0; - while (TRUE) { + done = FALSE; + while (!done) { done = TRUE; xp = random_(139, 80) + 16; yp = random_(139, 80) + 16; @@ -629,11 +632,11 @@ void AddStoryBooks() done = FALSE; } } - if (done) - break; + if (!done) { cnt++; if (cnt > 20000) return; + } } AddObject(OBJ_STORYBOOK, xp, yp); AddObject(OBJ_STORYCANDLE, xp - 2, yp + 1); @@ -707,8 +710,9 @@ void AddLazStand() BOOL found; cnt = 0; - while (TRUE) { - found = 1; + found = FALSE; + while (!found) { + found = TRUE; xp = random_(139, 80) + 16; yp = random_(139, 80) + 16; for (yy = -3; yy <= 3; yy++) { @@ -717,15 +721,14 @@ void AddLazStand() found = FALSE; } } - if (found) - break; - + if (!found) { cnt++; if (cnt > 10000) { InitRndLocObj(1, 1, OBJ_LAZSTAND); return; } } + } AddObject(OBJ_LAZSTAND, xp, yp); AddObject(OBJ_TNUDEM2, xp, yp + 2); AddObject(OBJ_STORYCANDLE, xp + 1, yp + 2); @@ -829,9 +832,9 @@ void InitObjects() InitRndBarrels(); AddL4Goodies(); } - InitRndLocObj(5, 10, 5); - InitRndLocObj(3, 6, 6); - InitRndLocObj(1, 5, 7); + InitRndLocObj(5, 10, OBJ_CHEST1); + InitRndLocObj(3, 6, OBJ_CHEST2); + InitRndLocObj(1, 5, OBJ_CHEST3); if (leveltype != DTYPE_HELL) AddObjTraps(); if (leveltype > DTYPE_CATHEDRAL) @@ -1104,7 +1107,8 @@ void AddBarrel(int i, int t) void AddShrine(int i) { - int val, j, slist[NUM_SHRINETYPE]; + int val, j; + BOOL slist[NUM_SHRINETYPE]; object[i]._oPreFlag = TRUE; for (j = 0; j < NUM_SHRINETYPE; j++) { @@ -1113,22 +1117,16 @@ void AddShrine(int i) } else { slist[j] = 1; } - if (gbMaxPlayers != 1) { - if (shrineavail[j] == 1) { + if (gbMaxPlayers != 1 && shrineavail[j] == 1) { slist[j] = 0; } - } else { - if (shrineavail[j] == 2) { + if (gbMaxPlayers == 1 && shrineavail[j] == 2) { slist[j] = 0; } } - } - while (1) { + do { val = random_(150, NUM_SHRINETYPE); - if (slist[val]) { - break; - } - } + } while (!slist[val]); object[i]._oVar1 = val; if (random_(150, 2)) { @@ -1548,21 +1546,21 @@ void Obj_StopAnim(int i) void Obj_Door(int i) { int dx, dy; + BOOL dok; - if (!object[i]._oVar4) { - object[i]._oMissFlag = FALSE; + if (object[i]._oVar4 == 0) { object[i]._oSelFlag = 3; + object[i]._oMissFlag = FALSE; } else { - dy = object[i]._oy; dx = object[i]._ox; + dy = object[i]._oy; + dok = !dMonster[dx][dy]; + dok = dok & !dItem[dx][dy]; + dok = dok & !dDead[dx][dy]; + dok = dok & !dPlayer[dx][dy]; object[i]._oSelFlag = 2; + object[i]._oVar4 = dok ? 1 : 2; object[i]._oMissFlag = TRUE; - object[i]._oVar4 = (((dItem[dx][dy] == 0 ? 1 : 0) - & (dDead[dx][dy] == 0 ? 1 : 0) - & (dPlayer[dx][dy] == 0 ? 1 : 0) - & (dMonster[dx][dy] == 0 ? 1 : 0)) - == 0) - + 1; } } @@ -2427,6 +2425,7 @@ void OperateBook(int pnum, int i) { int j, oi; int dx, dy; + int otype; BOOL do_add_missile, missile_added; if (object[i]._oSelFlag == 0) @@ -2436,20 +2435,19 @@ void OperateBook(int pnum, int i) missile_added = FALSE; for (j = 0; j < nobjects; j++) { oi = objectactive[j]; - if (object[oi]._otype == OBJ_MCIRCLE2) { - if (object[oi]._oVar6 == 1) { + otype = object[oi]._otype; + if (otype == OBJ_MCIRCLE2 && object[oi]._oVar6 == 1) { dx = 27; dy = 29; object[oi]._oVar6 = 4; do_add_missile = TRUE; } - if (object[oi]._oVar6 == 2) { + if (otype == OBJ_MCIRCLE2 && object[oi]._oVar6 == 2) { dx = 43; dy = 29; object[oi]._oVar6 = 4; do_add_missile = TRUE; } - } if (do_add_missile) { object[dObject[35][36] - 1]._oVar5++; AddMissile(plr[pnum]._px, plr[pnum]._py, dx, dy, plr[pnum]._pdir, MIS_RNDTELEPORT, 0, pnum, 0, 0); @@ -2460,8 +2458,8 @@ void OperateBook(int pnum, int i) if (!missile_added) return; } - object[i]._oAnimFrame++; object[i]._oSelFlag = 0; + object[i]._oAnimFrame++; if (!setlevel) return; @@ -2574,8 +2572,8 @@ void OperateChest(int pnum, int i, BOOL sendmsg) if (object[i]._oSelFlag != 0) { if (!deltaload) PlaySfxLoc(IS_CHEST, object[i]._ox, object[i]._oy); - object[i]._oAnimFrame += 2; object[i]._oSelFlag = 0; + object[i]._oAnimFrame += 2; if (!deltaload) { SetRndSeed(object[i]._oRndSeed); if (setlevel) { @@ -2664,8 +2662,8 @@ void OperateInnSignChest(int pnum, int i) if (object[i]._oSelFlag != 0) { if (!deltaload) PlaySfxLoc(IS_CHEST, object[i]._ox, object[i]._oy); - object[i]._oAnimFrame += 2; object[i]._oSelFlag = 0; + object[i]._oAnimFrame += 2; if (!deltaload) { GetSuperItemLoc(object[i]._ox, object[i]._oy, x, y); SpawnQuestItem(IDI_BANNER, x, y, 0, 0); @@ -3462,8 +3460,8 @@ void OperateSkelBook(int pnum, int i, BOOL sendmsg) if (object[i]._oSelFlag != 0) { if (!deltaload) PlaySfxLoc(IS_ISCROL, object[i]._ox, object[i]._oy); - object[i]._oAnimFrame += 2; object[i]._oSelFlag = 0; + object[i]._oAnimFrame += 2; if (!deltaload) { SetRndSeed(object[i]._oRndSeed); if (random_(161, 5)) @@ -3481,8 +3479,8 @@ void OperateBookCase(int pnum, int i, BOOL sendmsg) if (object[i]._oSelFlag != 0) { if (!deltaload) PlaySfxLoc(IS_ISCROL, object[i]._ox, object[i]._oy); - object[i]._oAnimFrame -= 2; object[i]._oSelFlag = 0; + object[i]._oAnimFrame -= 2; if (!deltaload) { SetRndSeed(object[i]._oRndSeed); CreateTypeItem(object[i]._ox, object[i]._oy, FALSE, ITYPE_MISC, IMISC_BOOK, sendmsg, FALSE); @@ -3519,8 +3517,8 @@ void OperateArmorStand(int pnum, int i, BOOL sendmsg) BOOL uniqueRnd; if (object[i]._oSelFlag != 0) { - object[i]._oAnimFrame++; object[i]._oSelFlag = 0; + object[i]._oAnimFrame++; if (!deltaload) { SetRndSeed(object[i]._oRndSeed); uniqueRnd = random_(0, 2); @@ -3728,8 +3726,8 @@ void OperateWeaponRack(int pnum, int i, BOOL sendmsg) break; } - object[i]._oAnimFrame++; object[i]._oSelFlag = 0; + object[i]._oAnimFrame++; if (deltaload) return; @@ -3898,9 +3896,7 @@ void SyncOpL1Door(int pnum, int cmd, int i) return; do_sync = FALSE; - if (cmd == CMD_OPENDOOR) { - if (object[i]._oVar4 != 0) - return; + if (cmd == CMD_OPENDOOR && object[i]._oVar4 == 0) { do_sync = TRUE; } if (cmd == CMD_CLOSEDOOR && object[i]._oVar4 == 1) @@ -3921,9 +3917,7 @@ void SyncOpL2Door(int pnum, int cmd, int i) return; do_sync = FALSE; - if (cmd == CMD_OPENDOOR) { - if (object[i]._oVar4 != 0) - return; + if (cmd == CMD_OPENDOOR && object[i]._oVar4 == 0) { do_sync = TRUE; } if (cmd == CMD_CLOSEDOOR && object[i]._oVar4 == 1) @@ -3944,9 +3938,7 @@ void SyncOpL3Door(int pnum, int cmd, int i) return; do_sync = FALSE; - if (cmd == CMD_OPENDOOR) { - if (object[i]._oVar4 != 0) - return; + if (cmd == CMD_OPENDOOR && object[i]._oVar4 == 0) { do_sync = TRUE; } if (cmd == CMD_CLOSEDOOR && object[i]._oVar4 == 1) diff --git a/Source/palette.cpp b/Source/palette.cpp index 83fc04f19..ec4f7ba04 100644 --- a/Source/palette.cpp +++ b/Source/palette.cpp @@ -46,8 +46,8 @@ static void ApplyGamma(PALETTEENTRY *dst, PALETTEENTRY *src, int n) void SaveGamma() { - SRegSaveValue("Diablo", "Gamma Correction", 0, gamma_correction); - SRegSaveValue("Diablo", "Color Cycling", FALSE, color_cycling_enabled); + SRegSaveValue(APP_NAME, "Gamma Correction", 0, gamma_correction); + SRegSaveValue(APP_NAME, "Color Cycling", FALSE, color_cycling_enabled); } static void LoadGamma() @@ -56,7 +56,7 @@ static void LoadGamma() int value; value = gamma_correction; - if (!SRegLoadValue("Diablo", "Gamma Correction", 0, &value)) + if (!SRegLoadValue(APP_NAME, "Gamma Correction", 0, &value)) value = 100; gamma_value = value; if (value < 30) { @@ -65,7 +65,7 @@ static void LoadGamma() gamma_value = 100; } gamma_correction = gamma_value - gamma_value % 5; - if (!SRegLoadValue("Diablo", "Color Cycling", 0, &value)) + if (!SRegLoadValue(APP_NAME, "Color Cycling", 0, &value)) value = 1; color_cycling_enabled = value; } diff --git a/Source/player.cpp b/Source/player.cpp index b731b287b..d3bbfa7d9 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -835,11 +835,11 @@ void InitPlayer(int pnum, BOOL FirstTime) ClearPlrRVars(&plr[pnum]); if (FirstTime) { + plr[pnum]._pRSplType = RSPLTYPE_INVALID; plr[pnum]._pRSpell = SPL_INVALID; plr[pnum]._pSBkSpell = SPL_INVALID; - plr[pnum]._pSpell = SPL_INVALID; - plr[pnum]._pRSplType = RSPLTYPE_INVALID; - plr[pnum]._pSplType = RSPLTYPE_INVALID; + plr[pnum]._pSpell = plr[pnum]._pRSpell; + plr[pnum]._pSplType = plr[pnum]._pRSplType; if ((plr[pnum]._pgfxnum & 0xF) == ANIM_ID_BOW) { plr[pnum]._pwtype = WT_RANGED; } else { @@ -1204,9 +1204,12 @@ void PM_ChangeOffset(int pnum) plr[pnum]._pxoff = plr[pnum]._pVar6 >> 8; plr[pnum]._pyoff = plr[pnum]._pVar7 >> 8; + px -= plr[pnum]._pVar6 >> 8; + py -= plr[pnum]._pVar7 >> 8; + if (pnum == myplr && ScrollInfo._sdir) { - ScrollInfo._sxoff += px - plr[pnum]._pxoff; - ScrollInfo._syoff += py - plr[pnum]._pyoff; + ScrollInfo._sxoff += px; + ScrollInfo._syoff += py; } PM_ChangeLightOff(pnum); @@ -1675,7 +1678,8 @@ void StartPlayerKill(int pnum, int earflag) ItemStruct ear; ItemStruct *pi; - if (plr[pnum]._pHitPoints <= 0 && plr[pnum]._pmode == PM_DEATH) { + p = &plr[pnum]; + if (p->_pHitPoints <= 0 && p->_pmode == PM_DEATH) { return; } @@ -1699,34 +1703,33 @@ void StartPlayerKill(int pnum, int earflag) #endif } - if (plr[pnum]._pgfxnum) { - plr[pnum]._pgfxnum = 0; - plr[pnum]._pGFXLoad = 0; + if (p->_pgfxnum) { + p->_pgfxnum = 0; + p->_pGFXLoad = 0; SetPlrAnims(pnum); } - if (!(plr[pnum]._pGFXLoad & PFILE_DEATH)) { + if (!(p->_pGFXLoad & PFILE_DEATH)) { LoadPlrGFX(pnum, PFILE_DEATH); } - p = &plr[pnum]; - NewPlrAnim(pnum, p->_pDAnim[plr[pnum]._pdir], p->_pDFrames, 1, p->_pDWidth); + NewPlrAnim(pnum, p->_pDAnim[p->_pdir], p->_pDFrames, 1, p->_pDWidth); - plr[pnum]._pBlockFlag = FALSE; - plr[pnum]._pmode = PM_DEATH; - plr[pnum]._pInvincible = TRUE; + p->_pBlockFlag = FALSE; + p->_pmode = PM_DEATH; + p->_pInvincible = TRUE; SetPlayerHitPoints(pnum, 0); - plr[pnum]._pVar8 = 1; + p->_pVar8 = 1; if (pnum != myplr && !earflag && !diablolevel) { for (i = 0; i < NUM_INVLOC; i++) { - plr[pnum].InvBody[i]._itype = ITYPE_NONE; + p->InvBody[i]._itype = ITYPE_NONE; } CalcPlrInv(pnum, FALSE); } if (plr[pnum].plrlevel == currlevel) { - FixPlayerLocation(pnum, plr[pnum]._pdir); + FixPlayerLocation(pnum, p->_pdir); RemovePlrFromMap(pnum); dFlags[p->_px][p->_py] |= BFLAG_DEAD_PLAYER; SetPlayerOld(pnum); @@ -1736,7 +1739,7 @@ void StartPlayerKill(int pnum, int earflag) deathdelay = 30; if (pcurs >= CURSOR_FIRSTITEM) { - PlrDeadItem(pnum, &plr[pnum].HoldItem, 0, 0); + PlrDeadItem(pnum, &p->HoldItem, 0, 0); SetCursor_(CURSOR_HAND); } @@ -1762,11 +1765,10 @@ void StartPlayerKill(int pnum, int earflag) PlrDeadItem(pnum, &ear, 0, 0); } } else { - pi = &plr[pnum].InvBody[0]; + pi = &p->InvBody[0]; i = NUM_INVLOC; - while (i != 0) { - i--; - pdd = (i + plr[pnum]._pdir) & 7; + while (i--) { + pdd = (i + p->_pdir) & 7; PlrDeadItem(pnum, pi, offset_x[pdd], offset_y[pdd]); pi++; } @@ -1827,7 +1829,8 @@ void DropHalfPlayersGold(int pnum) hGold = plr[pnum]._pGold >> 1; for (i = 0; i < MAXBELTITEMS && hGold > 0; i++) { - if (plr[pnum].SpdList[i]._itype == ITYPE_GOLD && plr[pnum].SpdList[i]._ivalue != GOLD_MAX_LIMIT) { + if (plr[pnum].SpdList[i]._itype == ITYPE_GOLD && + plr[pnum].SpdList[i]._ivalue != GOLD_MAX_LIMIT) { if (hGold < plr[pnum].SpdList[i]._ivalue) { plr[pnum].SpdList[i]._ivalue -= hGold; SetSpdbarGoldCurs(pnum, i); @@ -2100,6 +2103,7 @@ BOOL PM_DoStand(int pnum) BOOL PM_DoWalk(int pnum) { int anim_len; + BOOL rv; if ((DWORD)pnum >= MAX_PLRS) { app_fatal("PM_DoWalk: illegal player %d", pnum); @@ -2143,17 +2147,19 @@ BOOL PM_DoWalk(int pnum) if (leveltype != DTYPE_TOWN) { ChangeLightOff(plr[pnum]._plid, 0, 0); } - - return TRUE; + rv = TRUE; + } else { + PM_ChangeOffset(pnum); + rv = FALSE; } - PM_ChangeOffset(pnum); - return FALSE; + return rv; } BOOL PM_DoWalk2(int pnum) { int anim_len; + BOOL rv; if ((DWORD)pnum >= MAX_PLRS) { app_fatal("PM_DoWalk2: illegal player %d", pnum); @@ -2190,21 +2196,22 @@ BOOL PM_DoWalk2(int pnum) } ClearPlrPVars(pnum); - if (leveltype != DTYPE_TOWN) { ChangeLightOff(plr[pnum]._plid, 0, 0); } - - return TRUE; + rv = TRUE; + } else { + PM_ChangeOffset(pnum); + rv = FALSE; } - PM_ChangeOffset(pnum); - return FALSE; + return rv; } BOOL PM_DoWalk3(int pnum) { int anim_len; + BOOL rv; if ((DWORD)pnum >= MAX_PLRS) { app_fatal("PM_DoWalk3: illegal player %d", pnum); @@ -2249,12 +2256,13 @@ BOOL PM_DoWalk3(int pnum) if (leveltype != DTYPE_TOWN) { ChangeLightOff(plr[pnum]._plid, 0, 0); } - - return TRUE; + rv = TRUE; + } else { + PM_ChangeOffset(pnum); + rv = FALSE; } - PM_ChangeOffset(pnum); - return FALSE; + return rv; } BOOL WeaponDur(int pnum, int durrnd) diff --git a/Source/quests.cpp b/Source/quests.cpp index bd2075eb0..678a06090 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -8,8 +8,8 @@ int qline; int qlist[MAXQUESTS]; int numqlines; int WaterDone; -int ReturnLvlY; int ReturnLvlX; +int ReturnLvlY; int ReturnLvlT; int ALLQUESTS; /** current frame # for the pentagram selector */ int ReturnLvl; diff --git a/Source/quests.h b/Source/quests.h index 3d4ee9ccf..cf52fb578 100644 --- a/Source/quests.h +++ b/Source/quests.h @@ -10,8 +10,8 @@ extern int qline; extern int qlist[MAXQUESTS]; extern int numqlines; extern int WaterDone; -extern int ReturnLvlY; extern int ReturnLvlX; +extern int ReturnLvlY; extern int ReturnLvlT; extern int ALLQUESTS; extern int ReturnLvl; diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index c4037dada..298031cf0 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -2142,8 +2142,6 @@ static void DrawGame(int x, int y) } switch (ScrollInfo._sdir) { - case SDIR_NONE: - break; case SDIR_NE: chunks++; case SDIR_N: diff --git a/Source/sound.cpp b/Source/sound.cpp index f06dcab56..38288ba7b 100644 --- a/Source/sound.cpp +++ b/Source/sound.cpp @@ -270,7 +270,7 @@ void snd_init(HWND hWnd) void snd_get_volume(char *value_name, int *value) { int v = *value; - if (!SRegLoadValue("Diablo", value_name, 0, &v)) { + if (!SRegLoadValue(APP_NAME, value_name, 0, &v)) { v = VOLUME_MAX; } *value = v; @@ -362,7 +362,7 @@ void sound_cleanup() void snd_set_volume(char *key, int value) { - SRegSaveValue("Diablo", key, 0, value); + SRegSaveValue(APP_NAME, key, 0, value); } void music_stop() diff --git a/Source/textdat.cpp b/Source/textdat.cpp index 7df9be0d7..0eeff858d 100644 --- a/Source/textdat.cpp +++ b/Source/textdat.cpp @@ -783,7 +783,7 @@ const TextDataStruct alltext[] = { 1, 3, PS_NAR9 }, #endif { "Thank goodness you've returned!\nMuch has changed since you lived here, my friend. All was peaceful until the dark riders came and destroyed our village. Many were cut down where they stood, and those who took up arms were slain or dragged away to become slaves - or worse. The church at the edge of town has been desecrated and is being used for dark rituals. The screams that echo in the night are inhuman, but some of our townsfolk may yet survive. Follow the path that lies between my tavern and the blacksmith shop to find the church and save who you can. \n \nPerhaps I can tell you more if we speak again. Good luck.|", - 1, 5, TSFX_TAVERN0 } + 1, 5, TSFX_TAVERN0 }, }; /** unused */ const DWORD gdwAllTextEntries = 259; diff --git a/Source/textdat.h b/Source/textdat.h index 96445a648..2edb4f4ad 100644 --- a/Source/textdat.h +++ b/Source/textdat.h @@ -2,7 +2,7 @@ #ifndef __TEXTDAT_H__ #define __TEXTDAT_H__ -extern const TextDataStruct alltext[259]; +extern const TextDataStruct alltext[]; extern const DWORD gdwAllTextEntries; #endif /* __TEXTDAT_H__ */ diff --git a/Source/towners.cpp b/Source/towners.cpp index 19121d91a..5754f4830 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -91,8 +91,8 @@ int TownCowY[3] = { 16, 14, 20 }; int TownCowDir[3] = { 1, 3, 4 }; int cowoffx[8] = { -1, 0, -1, -1, -1, 0, -1, -1 }; int cowoffy[8] = { -1, -1, -1, 0, -1, -1, -1, 0 }; -QuestTalkData Qtalklist[11] = { - // clang-format off +QuestTalkData Qtalklist[] = { +// clang-format off // _qinfra, _qblkm, _qgarb, _qzhar, _qveil, _qmod, _qbutch, _qbol, _qblind, _qblood, _qanvil, _qwarlrd, _qking, _qpw, _qbone, _qvb { TEXT_INFRA6, TEXT_MUSH6, -1, -1, TEXT_VEIL5, -1, TEXT_BUTCH5, TEXT_BANNER6, TEXT_BLIND5, TEXT_BLOOD5, TEXT_ANVIL6, TEXT_WARLRD5, TEXT_KING7, TEXT_POISON7, TEXT_BONE5, TEXT_VILE9 }, { TEXT_INFRA3, -1, -1, -1, TEXT_VEIL3, -1, TEXT_BUTCH3, TEXT_BANNER4, TEXT_BLIND3, TEXT_BLOOD3, TEXT_ANVIL3, TEXT_WARLRD3, TEXT_KING5, TEXT_POISON4, TEXT_BONE3, TEXT_VILE7 }, @@ -446,12 +446,13 @@ void TownDead() tidx = GetActiveTowner(TOWN_DEADGUY); TownCtrlMsg(tidx); if (!qtextflag) { - if ((quests[Q_BUTCHER]._qactive != QUEST_ACTIVE || quests[Q_BUTCHER]._qlog) && quests[Q_BUTCHER]._qactive != QUEST_INIT) { + if (quests[Q_BUTCHER]._qactive == QUEST_ACTIVE && quests[Q_BUTCHER]._qlog == 0) { + return; + } + if (quests[Q_BUTCHER]._qactive != QUEST_INIT) { towner[tidx]._tAnimDelay = 1000; towner[tidx]._tAnimFrame = 1; strcpy(towner[tidx]._tName, "Slain Townsman"); - } else { - return; } } if (quests[Q_BUTCHER]._qactive != QUEST_INIT) @@ -665,15 +666,17 @@ void TalkToTowner(int p, int t) InitQTextMsg(TEXT_BANNER2); towner[t]._tMsgSaid = TRUE; } - if (quests[Q_LTBANNER]._qvar2 == 1 && PlrHasItem(p, IDI_BANNER, i) != NULL && !towner[t]._tMsgSaid) { - quests[Q_LTBANNER]._qactive = QUEST_DONE; - quests[Q_LTBANNER]._qvar1 = 3; - RemoveInvItem(p, i); - CreateItem(UITEM_HARCREST, towner[t]._tx, towner[t]._ty + 1); - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - InitQTextMsg(TEXT_BANNER3); - towner[t]._tMsgSaid = TRUE; + if (quests[Q_LTBANNER]._qvar2 == 1 && PlrHasItem(p, IDI_BANNER, i) != NULL) { + if (!towner[t]._tMsgSaid) { + quests[Q_LTBANNER]._qactive = QUEST_DONE; + quests[Q_LTBANNER]._qvar1 = 3; + RemoveInvItem(p, i); + CreateItem(UITEM_HARCREST, towner[t]._tx, towner[t]._ty + 1); + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + InitQTextMsg(TEXT_BANNER3); + towner[t]._tMsgSaid = TRUE; + } } } if (!qtextflag) { @@ -729,16 +732,18 @@ void TalkToTowner(int p, int t) InitQTextMsg(TEXT_INFRA5); towner[t]._tMsgSaid = TRUE; } - if (quests[Q_ROCK]._qvar2 == 1 && PlrHasItem(p, IDI_ROCK, i) != NULL && !towner[t]._tMsgSaid) { - quests[Q_ROCK]._qactive = QUEST_DONE; - quests[Q_ROCK]._qvar2 = 2; - quests[Q_ROCK]._qvar1 = 2; - RemoveInvItem(p, i); - CreateItem(UITEM_INFRARING, towner[t]._tx, towner[t]._ty + 1); - towner[t]._tbtcnt = 150; - towner[t]._tVar1 = p; - InitQTextMsg(TEXT_INFRA7); - towner[t]._tMsgSaid = TRUE; + if (quests[Q_ROCK]._qvar2 == 1 && PlrHasItem(p, IDI_ROCK, i) != NULL) { + if (!towner[t]._tMsgSaid) { + quests[Q_ROCK]._qactive = QUEST_DONE; + quests[Q_ROCK]._qvar2 = 2; + quests[Q_ROCK]._qvar1 = 2; + RemoveInvItem(p, i); + CreateItem(UITEM_INFRARING, towner[t]._tx, towner[t]._ty + 1); + towner[t]._tbtcnt = 150; + towner[t]._tVar1 = p; + InitQTextMsg(TEXT_INFRA7); + towner[t]._tMsgSaid = TRUE; + } } } if (plr[p]._pLvlVisited[9] && quests[Q_ANVIL]._qactive != QUEST_NOTAVAIL) { @@ -894,16 +899,16 @@ void TalkToTowner(int p, int t) towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; InitQTextMsg(TEXT_VILE1); + towner[t]._tMsgSaid = TRUE; quests[Q_BETRAYER]._qactive = QUEST_ACTIVE; quests[Q_BETRAYER]._qlog = TRUE; - towner[t]._tMsgSaid = TRUE; } else if (quests[Q_BETRAYER]._qactive == QUEST_DONE && quests[Q_BETRAYER]._qvar1 == 7) { quests[Q_BETRAYER]._qvar1 = 8; towner[t]._tbtcnt = 150; towner[t]._tVar1 = p; InitQTextMsg(TEXT_VILE3); - quests[Q_DIABLO]._qlog = TRUE; towner[t]._tMsgSaid = TRUE; + quests[Q_DIABLO]._qlog = TRUE; } } if (gbMaxPlayers != 1) { @@ -931,8 +936,9 @@ void TalkToTowner(int p, int t) StartStore(STORE_STORY); } } - } else if (towner[t]._ttype == TOWN_COW && !qtextflag) { - CowSFX(p); + } else if (towner[t]._ttype == TOWN_COW) { + if (!qtextflag) + CowSFX(p); } } diff --git a/Source/towners.h b/Source/towners.h index fccb6eb18..4fe06a318 100644 --- a/Source/towners.h +++ b/Source/towners.h @@ -40,6 +40,6 @@ void CowSFX(int pnum); /* data */ -extern QuestTalkData Qtalklist[11]; +extern QuestTalkData Qtalklist[]; #endif /* __TOWNERS_H__ */ diff --git a/defs.h b/defs.h index 9385c921b..6c5ea2cb6 100644 --- a/defs.h +++ b/defs.h @@ -4,7 +4,9 @@ * Global definitions and Macros. */ +#define DIABOOL BOOL #define GAME_NAME "DIABLO" +#define APP_NAME "Diablo" #define DMAXX 40 #define DMAXY 40 diff --git a/enums.h b/enums.h index cf9712c95..6d8562ba2 100644 --- a/enums.h +++ b/enums.h @@ -1802,7 +1802,7 @@ typedef enum _speech_id { TEXT_BOOK31 = 0xFF, TEXT_BOOK32 = 0x100, TEXT_BOOK33 = 0x101, - TEXT_INTRO = 0x102 + TEXT_INTRO = 0x102, } _speech_id; typedef enum object_graphic_id { @@ -2560,7 +2560,8 @@ typedef enum quest_id { Q_SKELKING = 0xC, Q_PWATER = 0xD, Q_SCHAMB = 0xE, - Q_BETRAYER = 0xF + Q_BETRAYER = 0xF, + Q_INVALID = -1, } quest_id; typedef enum quest_state { From 7db4ed749a5d0d75a60081d42c0a2d448fce8b88 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 8 Apr 2020 17:37:58 +0200 Subject: [PATCH 03/33] Apply more enums, defines and types --- Source/codec.cpp | 40 +++++++------ Source/control.cpp | 8 +-- Source/cursor.cpp | 8 +-- Source/diablo.cpp | 60 +++++++++---------- Source/dthread.cpp | 6 +- Source/effects.cpp | 3 +- Source/gamemenu.cpp | 2 +- Source/gendung.cpp | 4 +- Source/gmenu.cpp | 6 +- Source/monstdat.cpp | 141 ++++++++++++++++++++++++++++++++++++++++---- enums.h | 3 +- 11 files changed, 200 insertions(+), 81 deletions(-) diff --git a/Source/codec.cpp b/Source/codec.cpp index 04f81d0fc..cb78b9835 100644 --- a/Source/codec.cpp +++ b/Source/codec.cpp @@ -12,6 +12,8 @@ typedef struct CodecSignature { WORD unused; } CodecSignature; +#define BLOCKSIZE 64 + int codec_decode(BYTE *pbSrcDst, DWORD size, char *pszPassword) { char buf[128]; @@ -20,20 +22,20 @@ int codec_decode(BYTE *pbSrcDst, DWORD size, char *pszPassword) CodecSignature *sig; codec_init_key(0, pszPassword); - if (size <= 8) + if (size <= sizeof(CodecSignature)) return 0; - size = size - 8; - if (size % 64 != 0) + size -= sizeof(CodecSignature); + if (size % BLOCKSIZE != 0) return 0; - for (i = size; i != 0; pbSrcDst += 64, i -= 64) { - memcpy(buf, pbSrcDst, 64); + for (i = size; i != 0; pbSrcDst += BLOCKSIZE, i -= BLOCKSIZE) { + memcpy(buf, pbSrcDst, BLOCKSIZE); SHA1Result(0, dst); - for (int j = 0; j < 64; j++) { + for (int j = 0; j < BLOCKSIZE; j++) { buf[j] ^= dst[j % SHA1HashSize]; } SHA1Calculate(0, buf, NULL); memset(dst, 0, sizeof(dst)); - memcpy(pbSrcDst, buf, 64); + memcpy(pbSrcDst, buf, BLOCKSIZE); } memset(buf, 0, sizeof(buf)); @@ -48,7 +50,7 @@ int codec_decode(BYTE *pbSrcDst, DWORD size, char *pszPassword) goto error; } - size += sig->last_chunk_size - 64; + size += sig->last_chunk_size - BLOCKSIZE; SHA1Clear(); return size; error: @@ -67,7 +69,7 @@ void codec_init_key(int unused, char *pszPassword) srand(0x7058); keyInit = key; - for (i = 0; i < 136; i++) { + for (i = 0; i < sizeof(key); i++) { *keyInit = rand(); keyInit++; } @@ -81,7 +83,7 @@ void codec_init_key(int unused, char *pszPassword) SHA1Reset(0); SHA1Calculate(0, pw, digest); SHA1Clear(); - for (i = 0; (DWORD)i < 136; i++) + for (i = 0; i < sizeof(key); i++) key[i] ^= digest[i % SHA1HashSize]; memset(pw, 0, sizeof(pw)); memset(digest, 0, sizeof(digest)); @@ -94,9 +96,9 @@ void codec_init_key(int unused, char *pszPassword) DWORD codec_get_encoded_len(DWORD dwSrcBytes) { - if (dwSrcBytes % 64 != 0) - dwSrcBytes += 64 - (dwSrcBytes % 64); - return dwSrcBytes + 8; + if (dwSrcBytes % BLOCKSIZE != 0) + dwSrcBytes += BLOCKSIZE - (dwSrcBytes % BLOCKSIZE); + return dwSrcBytes + sizeof(CodecSignature); } void codec_encode(BYTE *pbSrcDst, DWORD size, int size_64, char *pszPassword) @@ -114,19 +116,19 @@ void codec_encode(BYTE *pbSrcDst, DWORD size, int size_64, char *pszPassword) last_chunk = 0; while (size != 0) { - chunk = size < 64 ? size : 64; + chunk = size < BLOCKSIZE ? size : BLOCKSIZE; memcpy(buf, pbSrcDst, chunk); - if (chunk < 64) - memset(buf + chunk, 0, 64 - chunk); + if (chunk < BLOCKSIZE) + memset(buf + chunk, 0, BLOCKSIZE - chunk); SHA1Result(0, dst); SHA1Calculate(0, buf, NULL); - for (int j = 0; j < 64; j++) { + for (int j = 0; j < BLOCKSIZE; j++) { buf[j] ^= dst[j % SHA1HashSize]; } memset(dst, 0, sizeof(dst)); - memcpy(pbSrcDst, buf, 64); + memcpy(pbSrcDst, buf, BLOCKSIZE); last_chunk = chunk; - pbSrcDst += 64; + pbSrcDst += BLOCKSIZE; size -= chunk; } memset(buf, 0, sizeof(buf)); diff --git a/Source/control.cpp b/Source/control.cpp index 016b40f4a..8482c6150 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1774,7 +1774,7 @@ void CPrintString(int y, char *str, BOOL center, int lines) lineOffset = 0; lineStart = lineOffsets[lines][y] + PANEL_LEFT; - if (center == 1) { + if (center == TRUE) { strWidth = 0; tmp = str; while (*tmp) { @@ -2106,7 +2106,7 @@ void DrawLevelUpIcon() { int nCel; - if (!stextflag) { + if (stextflag == STORE_NONE) { nCel = lvlbtndown ? 3 : 2; ADD_PlrStringXY(PANEL_LEFT + 0, PANEL_TOP - 49, PANEL_LEFT + 120, "Level Up", COL_WHITE); CelDraw(40 + PANEL_X, -17 + PANEL_Y, pChrButtons, nCel, 41); @@ -2480,7 +2480,7 @@ void DrawGoldSplit(int amount) ADD_PlrStringXY(366, 121, 600, "you want to remove?", COL_GOLD); if (amount > 0) { sprintf(tempstr, "%u", amount); - PrintGameStr(388, 140, tempstr, 0); + PrintGameStr(388, 140, tempstr, COL_WHITE); for (i = 0; i < tempstr[i]; i++) { screen_x += fontkern[fontframe[gbFontTransTbl[(BYTE)tempstr[i]]]] + 1; } @@ -2598,7 +2598,7 @@ void DrawTalkPan() CelBlitFrame(gpBuffer + x, pSPentSpn2Cels, frame, 12); frame = (frame & 7) + 1; talk_btn = 0; - for (i = 0; i < 4; i++) { + for (i = 0; i < MAX_PLRS; i++) { if (i == myplr) continue; if (whisper[i]) { diff --git a/Source/cursor.cpp b/Source/cursor.cpp index 577b08d7b..07b564775 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -185,14 +185,14 @@ void CheckCursMove() sy = MouseY; if (chrflag || questlog) { - if (sx >= 160) { - sx -= 160; + if (sx >= SCREEN_WIDTH / 4) { + sx -= SCREEN_WIDTH / 4; } else { sx = 0; } } else if (invflag || sbookflag) { - if (sx <= 320) { - sx += 160; + if (sx <= SCREEN_WIDTH / 2) { + sx += SCREEN_WIDTH / 4; } else { sx = 0; } diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 405142fb3..6d6d2df6c 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -348,12 +348,12 @@ void diablo_parse_flags(char *args) args++; } if (_strnicmp("dd_emulate", args, strlen("dd_emulate")) == 0) { - gbEmulate = 1; + gbEmulate = TRUE; args += strlen("dd_emulate"); continue; } if (_strnicmp("dd_backbuf", args, strlen("dd_backbuf")) == 0) { - gbBackBuf = 1; + gbBackBuf = TRUE; args += strlen("dd_backbuf"); continue; } @@ -367,25 +367,25 @@ void diablo_parse_flags(char *args) #ifdef _DEBUG switch (c) { case '^': - debug_mode_key_inverted_v = 1; + debug_mode_key_inverted_v = TRUE; break; case '$': - debug_mode_dollar_sign = 1; + debug_mode_dollar_sign = TRUE; break; case 'b': /* - debug_mode_key_b = 1; + debug_mode_key_b = TRUE; */ break; case 'd': - showintrodebug = 0; - debug_mode_key_d = 1; + showintrodebug = FALSE; + debug_mode_key_d = TRUE; break; case 'f': EnableFrameCount(); break; case 'i': - debug_mode_key_i = 1; + debug_mode_key_i = TRUE; break; case 'j': /* @@ -436,7 +436,7 @@ void diablo_parse_flags(char *args) DebugMonsters[debugmonsttypes++] = i; break; case 'n': - showintrodebug = 0; + showintrodebug = FALSE; break; case 'q': while (isspace(*args)) { @@ -461,7 +461,7 @@ void diablo_parse_flags(char *args) setseed = i; break; case 's': - debug_mode_key_s = 1; + debug_mode_key_s = TRUE; break; case 't': leveldebug = TRUE; @@ -480,7 +480,7 @@ void diablo_parse_flags(char *args) visiondebug = TRUE; break; case 'w': - debug_mode_key_w = 1; + debug_mode_key_w = TRUE; break; case 'x': fullscreen = FALSE; @@ -512,12 +512,12 @@ BOOL diablo_find_window(LPCSTR lpClassName) { HWND hWnd, active; - hWnd = FindWindow(lpClassName, 0); - if (!hWnd) + hWnd = FindWindow(lpClassName, NULL); + if (hWnd == NULL) return FALSE; active = GetLastActivePopup(hWnd); - if (active) + if (active != NULL) hWnd = active; active = GetTopWindow(hWnd); @@ -802,7 +802,7 @@ LRESULT CALLBACK GM_Game(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) BOOL LeftMouseDown(int wParam) { - if (!gmenu_left_mouse(TRUE) && !control_check_talk_btn() && !sgnTimeoutCurs) { + if (!gmenu_left_mouse(TRUE) && !control_check_talk_btn() && sgnTimeoutCurs == CURSOR_NONE) { if (deathflag) { control_check_btn_press(); } else if (PauseMode != 2) { @@ -810,7 +810,7 @@ BOOL LeftMouseDown(int wParam) doom_close(); } else if (spselflag) { SetSpell(); - } else if (stextflag) { + } else if (stextflag != STORE_NONE) { CheckStoreBtn(); } else if (MouseY < PANEL_TOP) { if (!gmenu_is_active() && !TryIconCurs()) { @@ -966,7 +966,7 @@ void LeftMouseUp() ReleaseChrBtns(); if (lvlbtndown) ReleaseLvlBtn(); - if (stextflag) + if (stextflag != STORE_NONE) ReleaseStoreBtn(); } @@ -975,7 +975,7 @@ void RightMouseDown() if (!gmenu_is_active() && sgnTimeoutCurs == CURSOR_NONE && PauseMode != 2 && !plr[myplr]._pInvincible) { if (doomflag) { doom_close(); - } else if (!stextflag) { + } else if (stextflag == STORE_NONE) { if (spselflag) { SetSpell(); } else if (MouseY >= SPANEL_HEIGHT @@ -1038,7 +1038,7 @@ void PressKey(int vkey) } if (deathflag) { - if (sgnTimeoutCurs != 0) { + if (sgnTimeoutCurs != CURSOR_NONE) { return; } if (vkey == VK_F9) { @@ -1068,7 +1068,7 @@ void PressKey(int vkey) return; } - if (sgnTimeoutCurs != 0 || dropGoldFlag) { + if (sgnTimeoutCurs != CURSOR_NONE || dropGoldFlag) { return; } if (vkey == VK_PAUSE) { @@ -1090,7 +1090,7 @@ void PressKey(int vkey) } else if (vkey == VK_F1) { if (helpflag) { helpflag = FALSE; - } else if (stextflag) { + } else if (stextflag != STORE_NONE) { ClearPanel(); AddPanelString("No help available", TRUE); /// BUGFIX: message isn't displayed AddPanelString("while in stores", TRUE); @@ -1253,7 +1253,7 @@ void diablo_pause_game() */ void PressChar(int vkey) { - if (gmenu_is_active() || control_talk_last_key(vkey) || sgnTimeoutCurs != 0 || deathflag) { + if (gmenu_is_active() || control_talk_last_key(vkey) || sgnTimeoutCurs != CURSOR_NONE || deathflag) { return; } if ((char)vkey == 'p' || (char)vkey == 'P') { @@ -1283,7 +1283,7 @@ void PressChar(int vkey) return; case 'I': case 'i': - if (!stextflag) { + if (stextflag == STORE_NONE) { sbookflag = FALSE; invflag = !invflag; if (!invflag || chrflag) { @@ -1299,7 +1299,7 @@ void PressChar(int vkey) return; case 'C': case 'c': - if (!stextflag) { + if (stextflag == STORE_NONE) { questlog = FALSE; chrflag = !chrflag; if (!chrflag || invflag) { @@ -1315,7 +1315,7 @@ void PressChar(int vkey) return; case 'Q': case 'q': - if (!stextflag) { + if (stextflag == STORE_NONE) { chrflag = FALSE; if (!questlog) { StartQuestlog(); @@ -1330,7 +1330,7 @@ void PressChar(int vkey) return; case 'S': case 's': - if (!stextflag) { + if (stextflag == STORE_NONE) { invflag = FALSE; if (!spselflag) { DoSpeedBook(); @@ -1342,7 +1342,7 @@ void PressChar(int vkey) return; case 'B': case 'b': - if (!stextflag) { + if (stextflag == STORE_NONE) { invflag = FALSE; sbookflag = !sbookflag; } @@ -1864,7 +1864,7 @@ void game_logic() return; } - if (!gmenu_is_active() && sgnTimeoutCurs == 0) { + if (!gmenu_is_active() && sgnTimeoutCurs == CURSOR_NONE) { CheckCursMove(); track_process(); } @@ -1911,9 +1911,9 @@ void timeout_cursor(BOOL bTimeout) force_redraw = 255; } scrollrt_draw_game_screen(TRUE); - } else if (sgnTimeoutCurs) { + } else if (sgnTimeoutCurs != CURSOR_NONE) { SetCursor_(sgnTimeoutCurs); - sgnTimeoutCurs = 0; + sgnTimeoutCurs = CURSOR_NONE; ClearPanel(); force_redraw = 255; } diff --git a/Source/dthread.cpp b/Source/dthread.cpp index deeb473e6..b525bc783 100644 --- a/Source/dthread.cpp +++ b/Source/dthread.cpp @@ -62,7 +62,7 @@ void dthread_start() } sghWorkToDoEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - if (!sghWorkToDoEvent) { + if (sghWorkToDoEvent == NULL) { error_buf = TraceLastError(); app_fatal("dthread:1\n%s", error_buf); } @@ -83,7 +83,7 @@ unsigned int __stdcall dthread_handler(void *data) DWORD dwMilliseconds; while (dthread_running) { - if (!sgpInfoHead && WaitForSingleObject(sghWorkToDoEvent, INFINITE) == -1) { + if (!sgpInfoHead && WaitForSingleObject(sghWorkToDoEvent, INFINITE) == WAIT_FAILED) { error_buf = TraceLastError(); app_fatal("dthread4:\n%s", error_buf); } @@ -126,7 +126,7 @@ void dthread_cleanup() dthread_running = FALSE; SetEvent(sghWorkToDoEvent); if (sghThread != INVALID_HANDLE_VALUE && glpDThreadId != GetCurrentThreadId()) { - if (WaitForSingleObject(sghThread, INFINITE) == -1) { + if (WaitForSingleObject(sghThread, INFINITE) == WAIT_FAILED) { error_buf = TraceLastError(); app_fatal("dthread3:\n(%s)", error_buf); } diff --git a/Source/effects.cpp b/Source/effects.cpp index c75005dca..2ef02dd31 100644 --- a/Source/effects.cpp +++ b/Source/effects.cpp @@ -915,6 +915,7 @@ TSFX sgSFX[] = { }; #define PLRSFXS (SFX_WARRIOR | SFX_ROGUE | SFX_SORCEROR) + BOOL effect_is_playing(int nSFX) { TSFX *sfx = &sgSFX[nSFX]; @@ -1096,7 +1097,7 @@ void stream_play(TSFX *pSFX, int lVolume, int lPan) SFileEnableDirectAccess(TRUE); #endif if (!success) { - sghStream = 0; + sghStream = NULL; } else { if (!SFileDdaBeginEx(sghStream, 0x40000, 0, 0, lVolume, lPan, 0)) stream_stop(); diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index bc1e6bdea..b336d8324 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -82,7 +82,7 @@ void gamemenu_update_multi(TMenuItem *pMenuItems) void gamemenu_off() { - gmenu_set_items(0, NULL); + gmenu_set_items(NULL, NULL); } void gamemenu_handle_previous() diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 964994c3e..8e0297f95 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -663,7 +663,7 @@ void DRLG_SetPC() for (j = 0; j < h; j++) { for (i = 0; i < w; i++) { - dFlags[i + x][j + y] |= 8; + dFlags[i + x][j + y] |= BFLAG_POPULATED; } } } @@ -680,7 +680,7 @@ void Make_SetPC(int x, int y, int w, int h) for (j = 0; j < dh; j++) { for (i = 0; i < dw; i++) { - dFlags[i + dx][j + dy] |= 8; + dFlags[i + dx][j + dy] |= BFLAG_POPULATED; } } } diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index c28a65476..6163a1ecd 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -81,8 +81,8 @@ void gmenu_init_menu() { PentSpin_frame = 1; sgpCurrentMenu = NULL; - sgpCurrItem = 0; - dword_63447C = 0; + sgpCurrItem = NULL; + dword_63447C = NULL; sgCurrentMenuIdx = 0; mouseNavigation = FALSE; sgpLogo = LoadFileInMem("Data\\Diabsmal.CEL", NULL); @@ -246,7 +246,7 @@ BOOL gmenu_presskeys(int vkey) break; case VK_ESCAPE: PlaySFX(IS_TITLEMOV); - gmenu_set_items(0, 0); + gmenu_set_items(NULL, NULL); break; case VK_SPACE: return FALSE; diff --git a/Source/monstdat.cpp b/Source/monstdat.cpp index 7db551da7..3af6488b0 100644 --- a/Source/monstdat.cpp +++ b/Source/monstdat.cpp @@ -124,19 +124,134 @@ MonsterData monsterdata[] = { }; char MonstConvTbl[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, 27, 29, 30, - 31, 32, 34, 35, 36, 37, 38, 40, 39, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 52, - 53, 54, 55, 56, 57, 59, 58, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 70, 71, 0, - 0, 0, 0, 72, 73, 74, 75, 0, 0, 0, - 0, 77, 76, 78, 79, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, 92, 91, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 0, 110, 0, 109, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 80, 111 + MT_NZOMBIE, + MT_BZOMBIE, + MT_GZOMBIE, + MT_YZOMBIE, + MT_RFALLSP, + MT_DFALLSP, + MT_YFALLSP, + MT_BFALLSP, + MT_WSKELAX, + MT_TSKELAX, + MT_RSKELAX, + MT_XSKELAX, + MT_RFALLSD, + MT_DFALLSD, + MT_YFALLSD, + MT_BFALLSD, + MT_NSCAV, + MT_BSCAV, + MT_WSCAV, + MT_YSCAV, + MT_WSKELBW, + MT_TSKELBW, + MT_RSKELBW, + MT_XSKELBW, + MT_WSKELSD, + MT_TSKELSD, + MT_RSKELSD, + MT_XSKELSD, + MT_SNEAK, + MT_STALKER, + MT_UNSEEN, + MT_ILLWEAV, + MT_NGOATMC, + MT_BGOATMC, + MT_RGOATMC, + MT_GGOATMC, + MT_FIEND, + MT_GLOOM, + MT_BLINK, + MT_FAMILIAR, + MT_NGOATBW, + MT_BGOATBW, + MT_RGOATBW, + MT_GGOATBW, + MT_NACID, + MT_RACID, + MT_BACID, + MT_XACID, + MT_SKING, + MT_FAT, + MT_MUDMAN, + MT_TOAD, + MT_FLAYED, + MT_WYRM, + MT_CAVSLUG, + MT_DEVOUR, + MT_DVLWYRM, + MT_NMAGMA, + MT_YMAGMA, + MT_BMAGMA, + MT_WMAGMA, + MT_HORNED, + MT_MUDRUN, + MT_FROSTC, + MT_OBLORD, + MT_BONEDMN, + MT_REDDTH, + MT_LTCHDMN, + MT_UDEDBLRG, + MT_NZOMBIE, + MT_NZOMBIE, + MT_NZOMBIE, + MT_NZOMBIE, + MT_INCIN, + MT_FLAMLRD, + MT_DOOMFIRE, + MT_HELLBURN, + MT_NZOMBIE, + MT_NZOMBIE, + MT_NZOMBIE, + MT_NZOMBIE, + MT_RSTORM, + MT_STORM, + MT_STORML, + MT_MAEL, + MT_WINGED, + MT_GARGOYLE, + MT_BLOODCLW, + MT_DEATHW, + MT_MEGA, + MT_GUARD, + MT_VTEXLRD, + MT_BALROG, + MT_NSNAKE, + MT_RSNAKE, + MT_GSNAKE, + MT_BSNAKE, + MT_NBLACK, + MT_RTBLACK, + MT_BTBLACK, + MT_RBLACK, + MT_UNRAV, + MT_HOLOWONE, + MT_PAINMSTR, + MT_REALWEAV, + MT_SUCCUBUS, + MT_SNOWWICH, + MT_HLSPWN, + MT_SOLBRNR, + MT_COUNSLR, + MT_MAGISTR, + MT_CABALIST, + MT_ADVOCATE, + MT_NZOMBIE, + MT_DIABLO, + MT_NZOMBIE, + MT_GOLEM, + MT_NZOMBIE, + MT_NZOMBIE, + MT_NZOMBIE, + MT_NZOMBIE, + MT_NZOMBIE, + MT_NZOMBIE, + MT_NZOMBIE, + MT_NZOMBIE, + MT_NZOMBIE, + MT_BIGFALL, + MT_DARKMAGE, }; /** diff --git a/enums.h b/enums.h index 6d8562ba2..47407cc6b 100644 --- a/enums.h +++ b/enums.h @@ -1482,7 +1482,8 @@ typedef enum _monster_id { MT_ADVOCATE = 0x6C, MT_GOLEM = 0x6D, MT_DIABLO = 0x6E, - NUM_MTYPES, + MT_DARKMAGE = 0x6F, + NUM_MTYPES = 0x6F, /// BUGFIX the count is off by one } _monster_id; // this enum contains indexes from UniqMonst array for special unique monsters (usually quest related) From c09c37ec2197610c13de26641a9548fbb5ee377b Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 8 Apr 2020 17:39:48 +0200 Subject: [PATCH 04/33] Create define for monsterAvailTbl --- Source/monstdat.cpp | 231 ++++++++++++++++++++++---------------------- 1 file changed, 116 insertions(+), 115 deletions(-) diff --git a/Source/monstdat.cpp b/Source/monstdat.cpp index 3af6488b0..727d79908 100644 --- a/Source/monstdat.cpp +++ b/Source/monstdat.cpp @@ -254,124 +254,125 @@ char MonstConvTbl[128] = { MT_DARKMAGE, }; +#define MAT_NEVER 0 +#define MAT_ALWAYS 1 +#define MAT_RETAIL 2 /** - * 0 = Never avalible - * 1 = Avalible in retail and shareware - * 2 = avalible in retail only + * Define what version a monster type is available in */ BYTE MonstAvailTbl[] = { - 1, // Zombie - 1, // Ghoul - 1, // Rotting Carcass - 1, // Black Death - 1, // Fallen One - 1, // Carver - 1, // Devil Kin - 1, // Dark One - 1, // Skeleton - 1, // Corpse Axe - 1, // Burning Dead - 1, // Horror - 1, // Fallen One - 1, // Carver - 1, // Devil Kin - 1, // Dark One - 1, // Scavenger - 1, // Plague Eater - 1, // Shadow Beast - 1, // Bone Gasher - 1, // Skeleton - 1, // Corpse Bow - 1, // Burning Dead - 1, // Horror - 1, // Skeleton Captain - 1, // Corpse Captain - 1, // Burning Dead Captain - 1, // Horror Captain - 0, // Invisible Lord - 2, // Hidden - 2, // Stalker - 2, // Unseen - 2, // Illusion Weaver - 0, // Lord Sayter - 2, // Flesh Clan - 2, // Stone Clan - 2, // Fire Clan - 2, // Night Clan - 1, // Fiend - 1, // Blink - 1, // Gloom - 1, // Familiar - 2, // Flesh Clan - 2, // Stone Clan - 2, // Fire Clan - 2, // Night Clan - 2, // Acid Beast - 2, // Poison Spitter - 2, // Pit Beast - 2, // Lava Maw - 0, // Skeleton King - 0, // The Butcher - 2, // Overlord - 2, // Mud Man - 2, // Toad Demon - 2, // Flayed One - 0, // Wyrm - 0, // Cave Slug - 0, // Devil Wyrm - 0, // Devourer - 2, // Magma Demon - 2, // Blood Stone - 2, // Hell Stone - 2, // Lava Lord - 2, // Horned Demon - 2, // Mud Runner - 2, // Frost Charger - 2, // Obsidian Lord - 0, // Bone Demon (oldboned in Hellfire) - 0, // Red Death - 0, // Litch Demon - 0, // Undead Balrog - 0, // Incinerator - 0, // Flame Lord - 0, // Doom Fire - 0, // Hell Burner - 2, // Red Storm - 2, // Storm Rider - 2, // Storm Lord - 2, // Maelstorm - 0, // Devil Kin Brute - 2, // Winged-Demon - 2, // Gargoyle - 2, // Blood Claw - 2, // Death Wing - 2, // Slayer - 2, // Guardian - 2, // Vortex Lord - 2, // Balrog - 2, // Cave Viper - 2, // Fire Drake - 2, // Gold Viper - 2, // Azure Drake - 2, // Black Knight - 2, // Doom Guard - 2, // Steel Lord - 2, // Blood Knight - 0, // Unraveler - 0, // Hollow One - 0, // Pain Master - 0, // Reality Weaver - 2, // Succubus - 2, // Snow Witch - 2, // Hell Spawn - 2, // Soul Burner - 2, // Counselor - 2, // Magistrate - 2, // Cabalist - 2, // Advocate - 0, // Golem - 0, // The Dark Lord - 0, // The Arch-Litch Malignus + MAT_ALWAYS, // Zombie + MAT_ALWAYS, // Ghoul + MAT_ALWAYS, // Rotting Carcass + MAT_ALWAYS, // Black Death + MAT_ALWAYS, // Fallen One + MAT_ALWAYS, // Carver + MAT_ALWAYS, // Devil Kin + MAT_ALWAYS, // Dark One + MAT_ALWAYS, // Skeleton + MAT_ALWAYS, // Corpse Axe + MAT_ALWAYS, // Burning Dead + MAT_ALWAYS, // Horror + MAT_ALWAYS, // Fallen One + MAT_ALWAYS, // Carver + MAT_ALWAYS, // Devil Kin + MAT_ALWAYS, // Dark One + MAT_ALWAYS, // Scavenger + MAT_ALWAYS, // Plague Eater + MAT_ALWAYS, // Shadow Beast + MAT_ALWAYS, // Bone Gasher + MAT_ALWAYS, // Skeleton + MAT_ALWAYS, // Corpse Bow + MAT_ALWAYS, // Burning Dead + MAT_ALWAYS, // Horror + MAT_ALWAYS, // Skeleton Captain + MAT_ALWAYS, // Corpse Captain + MAT_ALWAYS, // Burning Dead Captain + MAT_ALWAYS, // Horror Captain + MAT_NEVER, // Invisible Lord + MAT_RETAIL, // Hidden + MAT_RETAIL, // Stalker + MAT_RETAIL, // Unseen + MAT_RETAIL, // Illusion Weaver + MAT_NEVER, // Lord Sayter + MAT_RETAIL, // Flesh Clan + MAT_RETAIL, // Stone Clan + MAT_RETAIL, // Fire Clan + MAT_RETAIL, // Night Clan + MAT_ALWAYS, // Fiend + MAT_ALWAYS, // Blink + MAT_ALWAYS, // Gloom + MAT_ALWAYS, // Familiar + MAT_RETAIL, // Flesh Clan + MAT_RETAIL, // Stone Clan + MAT_RETAIL, // Fire Clan + MAT_RETAIL, // Night Clan + MAT_RETAIL, // Acid Beast + MAT_RETAIL, // Poison Spitter + MAT_RETAIL, // Pit Beast + MAT_RETAIL, // Lava Maw + MAT_NEVER, // Skeleton King + MAT_NEVER, // The Butcher + MAT_RETAIL, // Overlord + MAT_RETAIL, // Mud Man + MAT_RETAIL, // Toad Demon + MAT_RETAIL, // Flayed One + MAT_NEVER, // Wyrm + MAT_NEVER, // Cave Slug + MAT_NEVER, // Devil Wyrm + MAT_NEVER, // Devourer + MAT_RETAIL, // Magma Demon + MAT_RETAIL, // Blood Stone + MAT_RETAIL, // Hell Stone + MAT_RETAIL, // Lava Lord + MAT_RETAIL, // Horned Demon + MAT_RETAIL, // Mud Runner + MAT_RETAIL, // Frost Charger + MAT_RETAIL, // Obsidian Lord + MAT_NEVER, // Bone Demon (oldboned in Hellfire) + MAT_NEVER, // Red Death + MAT_NEVER, // Litch Demon + MAT_NEVER, // Undead Balrog + MAT_NEVER, // Incinerator + MAT_NEVER, // Flame Lord + MAT_NEVER, // Doom Fire + MAT_NEVER, // Hell Burner + MAT_RETAIL, // Red Storm + MAT_RETAIL, // Storm Rider + MAT_RETAIL, // Storm Lord + MAT_RETAIL, // Maelstorm + MAT_NEVER, // Devil Kin Brute + MAT_RETAIL, // Winged-Demon + MAT_RETAIL, // Gargoyle + MAT_RETAIL, // Blood Claw + MAT_RETAIL, // Death Wing + MAT_RETAIL, // Slayer + MAT_RETAIL, // Guardian + MAT_RETAIL, // Vortex Lord + MAT_RETAIL, // Balrog + MAT_RETAIL, // Cave Viper + MAT_RETAIL, // Fire Drake + MAT_RETAIL, // Gold Viper + MAT_RETAIL, // Azure Drake + MAT_RETAIL, // Black Knight + MAT_RETAIL, // Doom Guard + MAT_RETAIL, // Steel Lord + MAT_RETAIL, // Blood Knight + MAT_NEVER, // Unraveler + MAT_NEVER, // Hollow One + MAT_NEVER, // Pain Master + MAT_NEVER, // Reality Weaver + MAT_RETAIL, // Succubus + MAT_RETAIL, // Snow Witch + MAT_RETAIL, // Hell Spawn + MAT_RETAIL, // Soul Burner + MAT_RETAIL, // Counselor + MAT_RETAIL, // Magistrate + MAT_RETAIL, // Cabalist + MAT_RETAIL, // Advocate + MAT_NEVER, // Golem + MAT_NEVER, // The Dark Lord + MAT_NEVER, // The Arch-Litch Malignus }; UniqMonstStruct UniqMonst[] = { From 1340192b594e984af3e9f84f5570c20f02b32a57 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 8 Apr 2020 17:52:07 +0200 Subject: [PATCH 05/33] Correct array sizes --- Source/diablo.cpp | 8 ++++---- Source/diablo.h | 8 ++++---- Source/gamemenu.cpp | 6 +++--- Source/gmenu.cpp | 6 +++--- Source/gmenu.h | 4 ++-- Source/monstdat.cpp | 2 +- Source/monstdat.h | 2 +- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 6d6d2df6c..29ab4a27f 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -8,19 +8,19 @@ #include "../DiabloUI/diabloui.h" HWND ghMainWnd; -int glMid1Seed[NUMLEVELS]; -int glMid2Seed[NUMLEVELS]; +int glMid1Seed[NUMLEVELS + 1]; +int glMid2Seed[NUMLEVELS + 1]; int gnLevelTypeTbl[NUMLEVELS]; int MouseX; int MouseY; BOOL gbGameLoopStartup; DWORD glSeedTbl[NUMLEVELS]; BOOL gbRunGame; -int glMid3Seed[NUMLEVELS]; +int glMid3Seed[NUMLEVELS + 1]; BOOL gbRunGameResult; BOOL zoomflag; BOOL gbProcessPlayers; -int glEndSeed[NUMLEVELS]; +int glEndSeed[NUMLEVELS + 1]; BOOL gbLoadGame; HINSTANCE ghInst; int DebugMonsters[10]; diff --git a/Source/diablo.h b/Source/diablo.h index 10197bd18..0fa2d3467 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -7,19 +7,19 @@ #define __DIABLO_H__ extern HWND ghMainWnd; -extern int glMid1Seed[NUMLEVELS]; -extern int glMid2Seed[NUMLEVELS]; +extern int glMid1Seed[NUMLEVELS + 1]; +extern int glMid2Seed[NUMLEVELS + 1]; extern int gnLevelTypeTbl[NUMLEVELS]; extern int MouseX; extern int MouseY; extern BOOL gbGameLoopStartup; extern DWORD glSeedTbl[NUMLEVELS]; extern BOOL gbRunGame; -extern int glMid3Seed[NUMLEVELS]; +extern int glMid3Seed[NUMLEVELS + 1]; extern BOOL gbRunGameResult; extern BOOL zoomflag; extern BOOL gbProcessPlayers; -extern int glEndSeed[NUMLEVELS]; +extern int glEndSeed[NUMLEVELS + 1]; extern BOOL gbLoadGame; extern HINSTANCE ghInst; extern int DebugMonsters[10]; diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index b336d8324..354622e14 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -6,7 +6,7 @@ #include "all.h" /** Contains the game menu items of the single player menu. */ -TMenuItem sgSingleMenu[6] = { +TMenuItem sgSingleMenu[] = { // clang-format off // dwFlags, pszStr, fnMenu { GMENU_ENABLED, "Save Game", &gamemenu_save_game }, @@ -18,7 +18,7 @@ TMenuItem sgSingleMenu[6] = { // clang-format on }; /** Contains the game menu items of the multi player menu. */ -TMenuItem sgMultiMenu[5] = { +TMenuItem sgMultiMenu[] = { // clang-format off // dwFlags, pszStr, fnMenu { GMENU_ENABLED, "Options", &gamemenu_options }, @@ -28,7 +28,7 @@ TMenuItem sgMultiMenu[5] = { { GMENU_ENABLED, NULL, NULL } // clang-format on }; -TMenuItem sgOptionsMenu[6] = { +TMenuItem sgOptionsMenu[] = { // clang-format off // dwFlags, pszStr, fnMenu { GMENU_ENABLED | GMENU_SLIDER, NULL, &gamemenu_music_volume }, diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index 6163a1ecd..8235e1c1c 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -19,7 +19,7 @@ BYTE *sgpLogo; int sgCurrentMenuIdx; /** Maps from font index to bigtgold.cel frame number. */ -const BYTE lfontframe[127] = { +const BYTE lfontframe[] = { 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, @@ -32,11 +32,11 @@ const BYTE lfontframe[127] = { 26, 42, 0, 43, 0, 0, 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, 20, 0, 21, 0 + 24, 25, 26, 20, 0, 21, 0, 0 }; /** Maps from bigtgold.cel frame number to character width. */ -const BYTE lfontkern[56] = { +const BYTE lfontkern[] = { 18, 33, 21, 26, 28, 19, 19, 26, 25, 11, 12, 25, 19, 34, 28, 32, 20, 32, 28, 20, 28, 36, 35, 46, 33, 33, 24, 11, 23, 22, diff --git a/Source/gmenu.h b/Source/gmenu.h index 8cdb3878c..2f028b214 100644 --- a/Source/gmenu.h +++ b/Source/gmenu.h @@ -40,7 +40,7 @@ void gmenu_slider_steps(TMenuItem *pItem, int dwTicks); /* rdata */ -extern const BYTE lfontframe[127]; -extern const BYTE lfontkern[56]; +extern const BYTE lfontframe[]; +extern const BYTE lfontkern[]; #endif /* __GMENU_H__ */ diff --git a/Source/monstdat.cpp b/Source/monstdat.cpp index 727d79908..fb86ee003 100644 --- a/Source/monstdat.cpp +++ b/Source/monstdat.cpp @@ -123,7 +123,7 @@ MonsterData monsterdata[] = { // clang-format on }; -char MonstConvTbl[128] = { +BYTE MonstConvTbl[] = { MT_NZOMBIE, MT_BZOMBIE, MT_GZOMBIE, diff --git a/Source/monstdat.h b/Source/monstdat.h index 2a4e845c5..28de9975f 100644 --- a/Source/monstdat.h +++ b/Source/monstdat.h @@ -7,7 +7,7 @@ #define __MONSTDAT_H__ extern MonsterData monsterdata[]; -extern char MonstConvTbl[128]; +extern BYTE MonstConvTbl[]; extern BYTE MonstAvailTbl[]; extern UniqMonstStruct UniqMonst[]; From 6704657e7124f544a9658b2c1d80ea64cb67b528 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 8 Apr 2020 17:46:48 +0200 Subject: [PATCH 06/33] Apply sematic codestyle --- Source/automap.cpp | 14 ++--- Source/codec.cpp | 2 +- Source/control.cpp | 6 +- Source/diablo.cpp | 4 +- Source/encrypt.cpp | 4 +- Source/engine.cpp | 142 ++++++++++++++++++++++---------------------- Source/gamemenu.cpp | 18 +++--- Source/gendung.cpp | 10 ++-- Source/gmenu.cpp | 2 +- 9 files changed, 101 insertions(+), 101 deletions(-) diff --git a/Source/automap.cpp b/Source/automap.cpp index feb25ad67..557f12ec7 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -96,7 +96,7 @@ void InitAutomap() return; } - dwTiles >>= 1; + dwTiles /= 2; pTmp = pAFile; for (i = 1; i <= dwTiles; i++) { @@ -234,7 +234,7 @@ void DrawAutomap() for (j = 0; j < cells; j++) { WORD maptype = GetAutomapType(mapx + j, mapy - j, TRUE); - if (maptype) + if (maptype != 0) DrawAutomapTile(x, sy, maptype); x += AmLine64; } @@ -243,7 +243,7 @@ void DrawAutomap() y = sy + AmLine16; for (j = 0; j <= cells; j++) { WORD maptype = GetAutomapType(mapx + j, mapy - j, TRUE); - if (maptype) + if (maptype != 0) DrawAutomapTile(x, y, maptype); x += AmLine64; } @@ -366,7 +366,7 @@ void DrawAutomapTile(int sx, int sy, WORD automap_type) DrawLine(sx, sy, x1, y2, COLOR_DIM); DrawLine(sx, sy, x2, y2, COLOR_DIM); } - if (!(flags & (MAPFLAG_VERTDOOR | MAPFLAG_VERTGRATE | MAPFLAG_VERTARCH))) + if ((flags & (MAPFLAG_VERTDOOR | MAPFLAG_VERTGRATE | MAPFLAG_VERTARCH)) == 0) DrawLine(sx, sy - AmLine16, sx - AmLine32, sy, COLOR_DIM); } @@ -399,7 +399,7 @@ void DrawAutomapTile(int sx, int sy, WORD automap_type) DrawLine(sx, sy, x1, y2, COLOR_DIM); DrawLine(sx, sy, x2, y2, COLOR_DIM); } - if (!(flags & (MAPFLAG_HORZDOOR | MAPFLAG_HORZGRATE | MAPFLAG_HORZARCH))) + if ((flags & (MAPFLAG_HORZDOOR | MAPFLAG_HORZGRATE | MAPFLAG_HORZARCH)) == 0) DrawLine(sx, sy - AmLine16, sx + AmLine32, sy, COLOR_DIM); } @@ -567,9 +567,9 @@ void DrawAutomapText() nextline = 50; } } - if (setlevel) + if (setlevel) { PrintGameStr(8, nextline, quest_level_names[(BYTE)setlvlnum], COL_GOLD); - else if (currlevel) { + } else if (currlevel) { sprintf(desc, "Level: %i", currlevel); PrintGameStr(8, nextline, desc, COL_GOLD); } diff --git a/Source/codec.cpp b/Source/codec.cpp index cb78b9835..0411fcefd 100644 --- a/Source/codec.cpp +++ b/Source/codec.cpp @@ -136,7 +136,7 @@ void codec_encode(BYTE *pbSrcDst, DWORD size, int size_64, char *pszPassword) sig = (CodecSignature *)pbSrcDst; sig->error = 0; sig->unused = 0; - sig->checksum = *(DWORD *)tmp; + sig->checksum = *(DWORD *)&tmp[0]; sig->last_chunk_size = last_chunk; SHA1Clear(); } diff --git a/Source/control.cpp b/Source/control.cpp index 8482c6150..5bdd2ea44 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -2515,7 +2515,7 @@ void control_drop_gold(char vkey) input[strlen(input) - 1] = '\0'; dropGoldValue = atoi(input); } else if (vkey - '0' >= 0 && vkey - '0' <= 9) { - if (dropGoldValue || atoi(input) <= initialDropGoldValue) { + if (dropGoldValue != 0 || atoi(input) <= initialDropGoldValue) { input[strlen(input)] = vkey; if (atoi(input) > initialDropGoldValue) return; @@ -2643,7 +2643,7 @@ char *control_print_talk_msg(char *msg, int x, int y, int *nOffset, int color) if (width > 514 + PANEL_LEFT) return msg; msg++; - if (c) { + if (c != 0) { PrintChar(*nOffset, c, color); } *nOffset += fontkern[c] + 1; @@ -2795,7 +2795,7 @@ void control_press_enter() int i; BYTE talk_save; - if (sgszTalkMsg[0]) { + if (sgszTalkMsg[0] != 0) { control_reset_talk_msg(sgszTalkMsg); for (i = 0; i < 8; i++) { if (!strcmp(sgszTalkSave[i], sgszTalkMsg)) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 29ab4a27f..97bc81910 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -585,7 +585,7 @@ void diablo_reload_process(HINSTANCE hInstance) ExitProcess(0); } - if (InterlockedIncrement(plMap) == 0) { + if (InterlockedIncrement(&plMap[0]) == 0) { plMap[1] = GetCurrentProcessId(); } else { hPrev = GetForegroundWindow(); @@ -832,7 +832,7 @@ BOOL LeftMouseDown(int wParam) SetCursor_(CURSOR_HAND); } } else { - if (plr[myplr]._pStatPts && !spselflag) + if (plr[myplr]._pStatPts != 0 && !spselflag) CheckLvlBtn(); if (!lvlbtndown) return LeftMouseCmd(wParam == MK_SHIFT + MK_LBUTTON); diff --git a/Source/encrypt.cpp b/Source/encrypt.cpp index dd4d0a4a2..f3f81d4d4 100644 --- a/Source/encrypt.cpp +++ b/Source/encrypt.cpp @@ -85,8 +85,8 @@ int PkwareCompress(void *buf, int size) ptr = (char *)DiabloAllocPtr(CMP_BUFFER_SIZE); destSize = 2 * size; - if (destSize < 8192) - destSize = 8192; + if (destSize < 2 * 4096) + destSize = 2 * 4096; destData = (BYTE *)DiabloAllocPtr(destSize); diff --git a/Source/engine.cpp b/Source/engine.cpp index 2107a8333..ab70bbd7d 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -83,10 +83,10 @@ void CelBlit(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) int w; /// ASSERT: assert(pDecodeTo != NULL); - if (!pDecodeTo) + if (pDecodeTo == NULL) return; /// ASSERT: assert(pRLEBytes != NULL); - if (!pRLEBytes) + if (pRLEBytes == NULL) return; #ifdef USE_ASM @@ -191,10 +191,10 @@ void CelDraw(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) BYTE *pRLEBytes; /// ASSERT: assert(gpBuffer); - if (!gpBuffer) + if (gpBuffer == NULL) return; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; pRLEBytes = CelGetFrame(pCelBuff, nCel, &nDataSize); @@ -214,10 +214,10 @@ void CelBlitFrame(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth) BYTE *pRLEBytes; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; /// ASSERT: assert(pBuff != NULL); - if (!pBuff) + if (pBuff == NULL) return; pRLEBytes = CelGetFrame(pCelBuff, nCel, &nDataSize); @@ -241,10 +241,10 @@ void CelClippedDraw(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Ce int nDataStart, nDataSize, nDataCap; /// ASSERT: assert(gpBuffer); - if (!gpBuffer) + if (gpBuffer == NULL) return; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; pFrameTable = (DWORD *)pCelBuff; @@ -287,10 +287,10 @@ void CelClippedBlit(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int CelSk int nDataStart, nDataSize, nDataCap; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; /// ASSERT: assert(pBuff != NULL); - if (!pBuff) + if (pBuff == NULL) return; pFrameTable = (DWORD *)pCelBuff; @@ -326,10 +326,10 @@ void CelBlitLight(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) BYTE *tbl; /// ASSERT: assert(pDecodeTo != NULL); - if (!pDecodeTo) + if (pDecodeTo == NULL) return; /// ASSERT: assert(pRLEBytes != NULL); - if (!pRLEBytes) + if (pRLEBytes == NULL) return; #ifdef USE_ASM @@ -487,10 +487,10 @@ void CelBlitLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWid BYTE *tbl; /// ASSERT: assert(pDecodeTo != NULL); - if (!pDecodeTo) + if (pDecodeTo == NULL) return; /// ASSERT: assert(pRLEBytes != NULL); - if (!pRLEBytes) + if (pRLEBytes == NULL) return; #ifdef USE_ASM @@ -681,10 +681,10 @@ void CelDrawLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) BYTE *pDecodeTo, *pRLEBytes; /// ASSERT: assert(gpBuffer); - if (!gpBuffer) + if (gpBuffer == NULL) return; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; pRLEBytes = CelGetFrame(pCelBuff, nCel, &nDataSize); @@ -713,10 +713,10 @@ void CelClippedDrawLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i DWORD *pFrameTable; /// ASSERT: assert(gpBuffer); - if (!gpBuffer) + if (gpBuffer == NULL) return; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; pFrameTable = (DWORD *)pCelBuff; @@ -761,10 +761,10 @@ void CelClippedBlitLightTrans(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, DWORD *pFrameTable; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; /// ASSERT: assert(pBuff != NULL); - if (!pBuff) + if (pBuff == NULL) return; pFrameTable = (DWORD *)pCelBuff; @@ -812,10 +812,10 @@ void CelDrawLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int C DWORD *pFrameTable; /// ASSERT: assert(gpBuffer); - if (!gpBuffer) + if (gpBuffer == NULL) return; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; pFrameTable = (DWORD *)pCelBuff; @@ -840,7 +840,7 @@ void CelDrawLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int C idx = light4flag ? 1024 : 4096; if (light == 2) - idx += 256; + idx += 256; // gray colors if (light >= 4) idx += (light - 1) << 8; @@ -930,13 +930,13 @@ void CelBlitSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) int w; /// ASSERT: assert(pDecodeTo != NULL); - if (!pDecodeTo) + if (pDecodeTo == NULL) return; /// ASSERT: assert(pRLEBytes != NULL); - if (!pRLEBytes) + if (pRLEBytes == NULL) return; /// ASSERT: assert(gpBuffer); - if (!gpBuffer) + if (gpBuffer == NULL) return; #ifdef USE_ASM @@ -1055,10 +1055,10 @@ void CelClippedDrawSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in int nDataStart, nDataSize, nDataCap; /// ASSERT: assert(gpBuffer); - if (!gpBuffer) + if (gpBuffer == NULL) return; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; pFrameTable = (DWORD *)pCelBuff; @@ -1101,10 +1101,10 @@ void CelClippedBlitSafe(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int C int nDataStart, nDataSize, nDataCap; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; /// ASSERT: assert(pBuff != NULL); - if (!pBuff) + if (pBuff == NULL) return; pFrameTable = (DWORD *)pCelBuff; @@ -1140,13 +1140,13 @@ void CelBlitLightSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidt BYTE *tbl; /// ASSERT: assert(pDecodeTo != NULL); - if (!pDecodeTo) + if (pDecodeTo == NULL) return; /// ASSERT: assert(pRLEBytes != NULL); - if (!pRLEBytes) + if (pRLEBytes == NULL) return; /// ASSERT: assert(gpBuffer); - if (!gpBuffer) + if (gpBuffer == NULL) return; #ifdef USE_ASM @@ -1316,13 +1316,13 @@ void CelBlitLightTransSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int BYTE *tbl; /// ASSERT: assert(pDecodeTo != NULL); - if (!pDecodeTo) + if (pDecodeTo == NULL) return; /// ASSERT: assert(pRLEBytes != NULL); - if (!pRLEBytes) + if (pRLEBytes == NULL) return; /// ASSERT: assert(gpBuffer); - if (!gpBuffer) + if (gpBuffer == NULL) return; #ifdef USE_ASM @@ -1527,10 +1527,10 @@ void CelDrawLightSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int DWORD *pFrameTable; /// ASSERT: assert(gpBuffer); - if (!gpBuffer) + if (gpBuffer == NULL) return; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; pFrameTable = (DWORD *)pCelBuff; @@ -1575,7 +1575,7 @@ void CelClippedBlitLightTransSafe(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWi DWORD *pFrameTable; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; pFrameTable = (DWORD *)pCelBuff; @@ -1623,10 +1623,10 @@ void CelDrawLightRedSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i DWORD *pFrameTable; /// ASSERT: assert(gpBuffer); - if (!gpBuffer) + if (gpBuffer == NULL) return; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; pFrameTable = (DWORD *)pCelBuff; @@ -1651,7 +1651,7 @@ void CelDrawLightRedSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i idx = light4flag ? 1024 : 4096; if (light == 2) - idx += 256; + idx += 256; // gray colors if (light >= 4) idx += (light - 1) << 8; @@ -1752,10 +1752,10 @@ void CelBlitWidth(BYTE *pBuff, int x, int y, int wdt, BYTE *pCelBuff, int nCel, BYTE *pRLEBytes, *dst, *end; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; /// ASSERT: assert(pBuff != NULL); - if (!pBuff) + if (pBuff == NULL) return; #ifdef USE_ASM @@ -1878,10 +1878,10 @@ void CelBlitOutline(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWid BYTE *pRLEBytes, *dst; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; /// ASSERT: assert(gpBuffer); - if (!gpBuffer) + if (gpBuffer == NULL) return; #ifdef USE_ASM @@ -1906,11 +1906,11 @@ void CelBlitOutline(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWid mov nDataCap, eax } - if (!nDataStart) return; + if (nDataStart == 0) return; if (CelCap == 8) nDataCap = 0; - if (nDataCap) + if (nDataCap != 0) nDataSize = nDataCap - nDataStart; else nDataSize -= nDataStart; @@ -2026,10 +2026,10 @@ void CelBlitOutlineSafe(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int BYTE *pRLEBytes, *dst; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; /// ASSERT: assert(gpBuffer); - if (!gpBuffer) + if (gpBuffer == NULL) return; #ifdef USE_ASM @@ -2054,11 +2054,11 @@ void CelBlitOutlineSafe(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int mov nDataCap, eax } - if (!nDataStart) return; + if (nDataStart == 0) return; if (CelCap == 8) nDataCap = 0; - if (nDataCap) + if (nDataCap != 0) nDataSize = nDataCap - nDataStart; else nDataSize -= nDataStart; @@ -2741,12 +2741,12 @@ void Cl2Draw(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int nDataStart, nDataSize; /// ASSERT: assert(gpBuffer != NULL); - if (!gpBuffer) + if (gpBuffer == NULL) return; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; - /// ASSERT: assert(nCel > 0); + assert(nCel > 0); if (nCel <= 0) return; @@ -2937,10 +2937,10 @@ void Cl2DrawOutline(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWid DWORD *pFrameTable; /// ASSERT: assert(gpBuffer != NULL); - if (!gpBuffer) + if (gpBuffer == NULL) return; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; /// ASSERT: assert(nCel > 0); if (nCel <= 0) @@ -3156,10 +3156,10 @@ void Cl2DrawLightTbl(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int C DWORD *pFrameTable; /// ASSERT: assert(gpBuffer != NULL); - if (!gpBuffer) + if (gpBuffer == NULL) return; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; /// ASSERT: assert(nCel > 0); if (nCel <= 0) @@ -3185,7 +3185,7 @@ void Cl2DrawLightTbl(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int C idx = light4flag ? 1024 : 4096; if (light == 2) - idx += 256; + idx += 256; // gray colors if (light >= 4) idx += (light - 1) << 8; @@ -3372,10 +3372,10 @@ void Cl2DrawLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelS DWORD *pFrameTable; /// ASSERT: assert(gpBuffer != NULL); - if (!gpBuffer) + if (gpBuffer == NULL) return; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; /// ASSERT: assert(nCel > 0); if (nCel <= 0) @@ -3422,10 +3422,10 @@ void Cl2DrawSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSk int nDataStart, nDataSize; /// ASSERT: assert(gpBuffer != NULL); - if (!gpBuffer) + if (gpBuffer == NULL) return; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; /// ASSERT: assert(nCel > 0); if (nCel <= 0) @@ -3631,10 +3631,10 @@ void Cl2DrawOutlineSafe(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int DWORD *pFrameTable; /// ASSERT: assert(gpBuffer != NULL); - if (!gpBuffer) + if (gpBuffer == NULL) return; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; /// ASSERT: assert(nCel > 0); if (nCel <= 0) @@ -3863,10 +3863,10 @@ void Cl2DrawLightTblSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i DWORD *pFrameTable; /// ASSERT: assert(gpBuffer != NULL); - if (!gpBuffer) + if (gpBuffer == NULL) return; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; /// ASSERT: assert(nCel > 0); if (nCel <= 0) @@ -3892,7 +3892,7 @@ void Cl2DrawLightTblSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i idx = light4flag ? 1024 : 4096; if (light == 2) - idx += 256; + idx += 256; // gray colors if (light >= 4) idx += (light - 1) << 8; @@ -4092,10 +4092,10 @@ void Cl2DrawLightSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int DWORD *pFrameTable; /// ASSERT: assert(gpBuffer != NULL); - if (!gpBuffer) + if (gpBuffer == NULL) return; /// ASSERT: assert(pCelBuff != NULL); - if (!pCelBuff) + if (pCelBuff == NULL) return; /// ASSERT: assert(nCel > 0); if (nCel <= 0) diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index 354622e14..ede26776e 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -72,7 +72,7 @@ void gamemenu_update_single(TMenuItem *pMenuItems) if (plr[myplr]._pmode != PM_DEATH && !deathflag) enable = TRUE; - gmenu_enable(sgSingleMenu, enable); + gmenu_enable(&sgSingleMenu[0], enable); } void gamemenu_update_multi(TMenuItem *pMenuItems) @@ -229,14 +229,14 @@ void gamemenu_music_volume(BOOL bActivate) music_start(leveltype); } } else { - volume = gamemenu_slider_music_sound(sgOptionsMenu); - sound_get_or_set_music_volume(volume); - - if (volume == VOLUME_MIN) { - if (gbMusicOn) { - gbMusicOn = FALSE; - music_stop(); - } + volume = gamemenu_slider_music_sound(&sgOptionsMenu[0]); + sound_get_or_set_music_volume(volume); + + if (volume == VOLUME_MIN) { + if (gbMusicOn) { + gbMusicOn = FALSE; + music_stop(); + } } else if (!gbMusicOn) { gbMusicOn = TRUE; music_start(leveltype); diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 8e0297f95..3b0cbfc9e 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -364,7 +364,7 @@ void MakeSpeedCels() if (total_frames > 128) total_frames = 128; - frameidx = 0; /* move into loop ? */ + frameidx = 0; if (light4flag) blk_cnt = 3; @@ -483,7 +483,7 @@ void MakeSpeedCels() for (y = 0; y < MAXDUNY; y++) { for (x = 0; x < MAXDUNX; x++) { - if (dPiece[x][y]) { + if (dPiece[x][y] != 0) { pMap = &dpiece_defs_map_2[x][y]; for (i = 0; i < blocks; i++) { if (pMap->mt[i]) { @@ -539,7 +539,7 @@ void SetDungeonMicros() for (x = 0; x < MAXDUNX; x++) { lv = dPiece[x][y]; pMap = &dpiece_defs_map_2[x][y]; - if (lv) { + if (lv != 0) { lv--; if (leveltype != DTYPE_HELL) pPiece = (WORD *)&pLevelPieces[20 * lv]; @@ -616,7 +616,7 @@ void DRLG_CopyTrans(int sx, int sy, int dx, int dy) void DRLG_ListTrans(int num, BYTE *List) { int i; - BYTE x1, x2, y1, y2; + BYTE x1, y1, x2, y2; for (i = 0; i < num; i++) { x1 = *List++; @@ -630,7 +630,7 @@ void DRLG_ListTrans(int num, BYTE *List) void DRLG_AreaTrans(int num, BYTE *List) { int i; - BYTE x1, x2, y1, y2; + BYTE x1, y1, x2, y2; for (i = 0; i < num; i++) { x1 = *List++; diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index 8235e1c1c..fee71eb71 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -62,7 +62,7 @@ void gmenu_print_text(int x, int y, char *pszStr) while (*pszStr) { c = gbFontTransTbl[(BYTE)*pszStr++]; c = lfontframe[c]; - if (c) + if (c != 0) CelDrawLight(x, y, BigTGold_cel, c, 46); x += lfontkern[c] + 2; } From c3cdc1c4ab8d36f4b78d5a069efc950736cee6f8 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 8 Apr 2020 17:50:18 +0200 Subject: [PATCH 07/33] Decompose magic numbers --- Source/control.cpp | 3 ++- Source/dx.cpp | 4 ++-- Source/gendung.cpp | 12 ++++++------ Source/gendung.h | 12 ++++++------ 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Source/control.cpp b/Source/control.cpp index 5bdd2ea44..46a249eb0 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -2634,8 +2634,9 @@ char *control_print_talk_msg(char *msg, int x, int y, int *nOffset, int color) int width; x += 264; + y += 182 + PANEL_TOP; width = x; - *nOffset = PitchTbl[y + 182 + PANEL_TOP] + x; + *nOffset = PitchTbl[y] + x; while (*msg) { c = fontframe[gbFontTransTbl[(BYTE)*msg]]; diff --git a/Source/dx.cpp b/Source/dx.cpp index ce9c25d90..54efb059a 100644 --- a/Source/dx.cpp +++ b/Source/dx.cpp @@ -44,12 +44,12 @@ static void dx_create_back_buffer() } memset(&ddsd, 0, sizeof(ddsd)); - ddsd.dwWidth = BUFFER_WIDTH; - ddsd.lPitch = BUFFER_WIDTH; ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_PIXELFORMAT | DDSD_PITCH | DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; ddsd.dwHeight = BUFFER_HEIGHT; + ddsd.dwWidth = BUFFER_WIDTH; + ddsd.lPitch = BUFFER_WIDTH; ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat); error_code = lpDDSPrimary->GetPixelFormat(&ddsd.ddpfPixelFormat); if (error_code != DD_OK) diff --git a/Source/gendung.cpp b/Source/gendung.cpp index 3b0cbfc9e..0233fb299 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -23,7 +23,7 @@ int SpeedFrameTbl[128][16]; /** * List of transparancy masks to use for dPieces */ -char block_lvid[2049]; +char block_lvid[MAXTILES + 1]; int level_frame_count[MAXTILES]; int tile_defs[MAXTILES]; WORD level_frame_types[MAXTILES]; @@ -32,20 +32,20 @@ int nlevel_frames; /** * List of light blocking dPieces */ -BOOLEAN nBlockTable[2049]; +BOOLEAN nBlockTable[MAXTILES + 1]; /** * List of path blocking dPieces */ -BOOLEAN nSolidTable[2049]; +BOOLEAN nSolidTable[MAXTILES + 1]; /** * List of transparent dPieces */ -BOOLEAN nTransTable[2049]; +BOOLEAN nTransTable[MAXTILES + 1]; /** * List of missile blocking dPieces */ -BOOLEAN nMissileTable[2049]; -BOOLEAN nTrapTable[2049]; +BOOLEAN nMissileTable[MAXTILES + 1]; +BOOLEAN nTrapTable[MAXTILES + 1]; int dminx; int dminy; int dmaxx; diff --git a/Source/gendung.h b/Source/gendung.h index 3a34834b2..1cd240605 100644 --- a/Source/gendung.h +++ b/Source/gendung.h @@ -21,17 +21,17 @@ extern BYTE *pLevelPieces; extern BYTE *pDungeonCels; extern BYTE *pSpeedCels; extern int SpeedFrameTbl[128][16]; -extern char block_lvid[2049]; +extern char block_lvid[MAXTILES + 1]; extern int level_frame_count[MAXTILES]; extern int tile_defs[MAXTILES]; extern WORD level_frame_types[MAXTILES]; extern int level_frame_sizes[MAXTILES]; extern int nlevel_frames; -extern BOOLEAN nBlockTable[2049]; -extern BOOLEAN nSolidTable[2049]; -extern BOOLEAN nTransTable[2049]; -extern BOOLEAN nMissileTable[2049]; -extern BOOLEAN nTrapTable[2049]; +extern BOOLEAN nBlockTable[MAXTILES + 1]; +extern BOOLEAN nSolidTable[MAXTILES + 1]; +extern BOOLEAN nTransTable[MAXTILES + 1]; +extern BOOLEAN nMissileTable[MAXTILES + 1]; +extern BOOLEAN nTrapTable[MAXTILES + 1]; extern int dminx; extern int dminy; extern int dmaxx; From 6c6ae344dedb3642d2d509c8bd2d375339e473ea Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 8 Apr 2020 17:56:28 +0200 Subject: [PATCH 08/33] Deduplicate strings in argument parsing --- Source/diablo.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 97bc81910..0ae5c913f 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -347,19 +347,22 @@ void diablo_parse_flags(char *args) while (isspace(*args)) { args++; } - if (_strnicmp("dd_emulate", args, strlen("dd_emulate")) == 0) { + static char de[] = "dd_emulate"; + if (_strnicmp(de, args, strlen(de)) == 0) { gbEmulate = TRUE; - args += strlen("dd_emulate"); + args += strlen(de); continue; } - if (_strnicmp("dd_backbuf", args, strlen("dd_backbuf")) == 0) { + static char db[] = "dd_backbuf"; + if (_strnicmp(db, args, strlen(db)) == 0) { gbBackBuf = TRUE; - args += strlen("dd_backbuf"); + args += strlen(db); continue; } - if (_strnicmp("ds_noduplicates", args, strlen("ds_noduplicates")) == 0) { + static char ds[] = "ds_noduplicates"; + if (_strnicmp(ds, args, strlen(ds)) == 0) { gbDupSounds = FALSE; - args += strlen("ds_noduplicates"); + args += strlen(ds); continue; } c = tolower(*args); From be1a3f15038cd5032692d2ec6e0c12ace71e0c0d Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 8 Apr 2020 17:58:40 +0200 Subject: [PATCH 09/33] Clean up gamemenu_on --- Source/gamemenu.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index ede26776e..76cec1a83 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -48,17 +48,11 @@ char *color_cycling_toggle_names[] = { "Color Cycling Off", "Color Cycling On" } void gamemenu_on() { - void (*proc)(TMenuItem *); - TMenuItem *item; - if (gbMaxPlayers == 1) { - proc = gamemenu_update_single; - item = sgSingleMenu; + gmenu_set_items(sgSingleMenu, gamemenu_update_single); } else { - proc = gamemenu_update_multi; - item = sgMultiMenu; + gmenu_set_items(sgMultiMenu, gamemenu_update_multi); } - gmenu_set_items(item, proc); PressEscKey(); } From cd18914026301e186d9573839663e23e3ba7d5ff Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 8 Apr 2020 18:01:24 +0200 Subject: [PATCH 10/33] Avoid void pointers --- Source/encrypt.cpp | 18 ++++++------------ Source/encrypt.h | 8 ++++---- Source/engine.cpp | 2 +- Source/engine.h | 2 +- Source/mpqapi.cpp | 14 +++++++------- Source/mpqapi.h | 2 +- 6 files changed, 20 insertions(+), 26 deletions(-) diff --git a/Source/encrypt.cpp b/Source/encrypt.cpp index f3f81d4d4..77abe2f2d 100644 --- a/Source/encrypt.cpp +++ b/Source/encrypt.cpp @@ -8,12 +8,10 @@ DWORD hashtable[1280]; -void Decrypt(void *block, DWORD size, DWORD key) +void Decrypt(DWORD *castBlock, DWORD size, DWORD key) { - DWORD *castBlock; DWORD seed, i; - castBlock = (DWORD *)block; seed = 0xEEEEEEEE; for (i = 0; i < (size >> 2); i++) { seed += hashtable[0x400 + (key & 0xFF)]; @@ -24,12 +22,10 @@ void Decrypt(void *block, DWORD size, DWORD key) } } -void Encrypt(void *block, DWORD size, DWORD key) +void Encrypt(DWORD *castBlock, DWORD size, DWORD key) { - DWORD *castBlock; DWORD seed, i, ch; - castBlock = (DWORD *)block; seed = 0xEEEEEEEE; for (i = 0; i < (size >> 2); i++) { ch = *castBlock; @@ -74,14 +70,13 @@ void InitHash() } } -int PkwareCompress(void *buf, int size) +int PkwareCompress(BYTE *srcData, int size) { - BYTE *srcData, *destData; + BYTE *destData; char *ptr; unsigned int destSize, type, dsize; TDataInfo param; - srcData = (BYTE *)buf; ptr = (char *)DiabloAllocPtr(CMP_BUFFER_SIZE); destSize = 2 * size; @@ -140,14 +135,13 @@ void __cdecl PkwareBufferWrite(char *buf, unsigned int *size, void *param) pInfo->destOffset += *size; } -void PkwareDecompress(void *param, int recv_size, int dwMaxBytes) +void PkwareDecompress(BYTE *pbInBuff, int recv_size, int dwMaxBytes) { char *ptr; - BYTE *pbInBuff, *pbOutBuff; + BYTE *pbOutBuff; TDataInfo info; ptr = (char *)DiabloAllocPtr(CMP_BUFFER_SIZE); - pbInBuff = (BYTE *)param; pbOutBuff = DiabloAllocPtr(dwMaxBytes); info.srcData = pbInBuff; diff --git a/Source/encrypt.h b/Source/encrypt.h index 552bed221..14e0b20f7 100644 --- a/Source/encrypt.h +++ b/Source/encrypt.h @@ -8,13 +8,13 @@ extern DWORD hashtable[1280]; -void Decrypt(void *block, DWORD size, DWORD key); -void Encrypt(void *block, DWORD size, DWORD key); +void Decrypt(DWORD *castBlock, DWORD size, DWORD key); +void Encrypt(DWORD *castBlock, DWORD size, DWORD key); DWORD Hash(const char *s, int type); void InitHash(); -int PkwareCompress(void *buf, int size); +int PkwareCompress(BYTE *srcData, int size); unsigned int __cdecl PkwareBufferRead(char *buf, unsigned int *size, void *param); void __cdecl PkwareBufferWrite(char *buf, unsigned int *size, void *param); -void PkwareDecompress(void *param, int recv_size, int dwMaxBytes); +void PkwareDecompress(BYTE *pbInBuff, int recv_size, int dwMaxBytes); #endif /* __ENCRYPT_H__ */ diff --git a/Source/engine.cpp b/Source/engine.cpp index ab70bbd7d..619cd9d38 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -2656,7 +2656,7 @@ BYTE *LoadFileInMem(char *pszName, DWORD *pdwFileLen) * @param p Target buffer * @return Size of file */ -DWORD LoadFileWithMem(const char *pszName, void *p) +DWORD LoadFileWithMem(const char *pszName, BYTE *p) { DWORD dwFileLen; HANDLE hsFile; diff --git a/Source/engine.h b/Source/engine.h index 9027445b8..9fce6d3a4 100644 --- a/Source/engine.h +++ b/Source/engine.h @@ -62,7 +62,7 @@ void engine_debug_trap(BOOL show_cursor); BYTE *DiabloAllocPtr(DWORD dwBytes); void mem_free_dbg(void *p); BYTE *LoadFileInMem(char *pszName, DWORD *pdwFileLen); -DWORD LoadFileWithMem(const char *pszName, void *p); +DWORD LoadFileWithMem(const char *pszName, BYTE *p); void Cl2ApplyTrans(BYTE *p, BYTE *ttbl, int nCel); void Cl2Draw(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, int CelCap); void Cl2Blit(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth); diff --git a/Source/mpqapi.cpp b/Source/mpqapi.cpp index 6d33ffdb6..6d1ca02a6 100644 --- a/Source/mpqapi.cpp +++ b/Source/mpqapi.cpp @@ -7,7 +7,7 @@ #include "../3rdParty/Storm/Source/storm.h" DWORD sgdwMpqOffset; -char mpq_buf[4096]; +BYTE mpq_buf[4096]; _HASHENTRY *sgpHashTbl; /** Has the savegame-file been modified in memory. */ BOOL save_archive_modified; @@ -466,7 +466,7 @@ BOOL OpenMPQ(const char *pszArchive, BOOL hidden, DWORD dwChar) if (!ReadFile(sghArchive, sgpBlockTbl, 0x8000, &dwTemp, NULL)) goto on_error; key = Hash("(block table)", 3); - Decrypt(sgpBlockTbl, 0x8000, key); + Decrypt((DWORD *)sgpBlockTbl, 0x8000, key); } sgpHashTbl = (_HASHENTRY *)DiabloAllocPtr(0x8000); memset(sgpHashTbl, 255, 0x8000); @@ -476,7 +476,7 @@ BOOL OpenMPQ(const char *pszArchive, BOOL hidden, DWORD dwChar) if (!ReadFile(sghArchive, sgpHashTbl, 0x8000, &dwTemp, NULL)) goto on_error; key = Hash("(hash table)", 3); - Decrypt(sgpHashTbl, 0x8000, key); + Decrypt((DWORD *)sgpHashTbl, 0x8000, key); } return TRUE; } @@ -615,9 +615,9 @@ BOOL mpqapi_write_block_table() if (SetFilePointer(sghArchive, 104, NULL, FILE_BEGIN) == -1) return FALSE; - Encrypt(sgpBlockTbl, 0x8000, Hash("(block table)", 3)); + Encrypt((DWORD *)sgpBlockTbl, 0x8000, Hash("(block table)", 3)); success = WriteFile(sghArchive, sgpBlockTbl, 0x8000, &NumberOfBytesWritten, 0); - Decrypt(sgpBlockTbl, 0x8000, Hash("(block table)", 3)); + Decrypt((DWORD *)sgpBlockTbl, 0x8000, Hash("(block table)", 3)); return success && NumberOfBytesWritten == 0x8000; } @@ -629,9 +629,9 @@ BOOL mpqapi_write_hash_table() if (SetFilePointer(sghArchive, 32872, NULL, FILE_BEGIN) == -1) return FALSE; - Encrypt(sgpHashTbl, 0x8000, Hash("(hash table)", 3)); + Encrypt((DWORD *)sgpHashTbl, 0x8000, Hash("(hash table)", 3)); success = WriteFile(sghArchive, sgpHashTbl, 0x8000, &NumberOfBytesWritten, 0); - Decrypt(sgpHashTbl, 0x8000, Hash("(hash table)", 3)); + Decrypt((DWORD *)sgpHashTbl, 0x8000, Hash("(hash table)", 3)); return success && NumberOfBytesWritten == 0x8000; } diff --git a/Source/mpqapi.h b/Source/mpqapi.h index ff6e61129..3f9e2f33a 100644 --- a/Source/mpqapi.h +++ b/Source/mpqapi.h @@ -6,7 +6,7 @@ #ifndef __MPQAPI_H__ #define __MPQAPI_H__ -extern char mpq_buf[4096]; +extern BYTE mpq_buf[4096]; extern BOOL save_archive_modified; extern BOOLEAN save_archive_open; From a94c2d656f4a72324c9cd37ff6369e1524c974d5 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 8 Apr 2020 18:02:39 +0200 Subject: [PATCH 11/33] Make hashtable in to a 2d array --- Source/encrypt.cpp | 10 +++++----- Source/encrypt.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/encrypt.cpp b/Source/encrypt.cpp index 77abe2f2d..368b291f0 100644 --- a/Source/encrypt.cpp +++ b/Source/encrypt.cpp @@ -6,7 +6,7 @@ #include "all.h" #include "../3rdParty/PKWare/pkware.h" -DWORD hashtable[1280]; +DWORD hashtable[5][256]; void Decrypt(DWORD *castBlock, DWORD size, DWORD key) { @@ -14,7 +14,7 @@ void Decrypt(DWORD *castBlock, DWORD size, DWORD key) seed = 0xEEEEEEEE; for (i = 0; i < (size >> 2); i++) { - seed += hashtable[0x400 + (key & 0xFF)]; + seed += hashtable[4][(key & 0xFF)]; *castBlock ^= seed + key; seed += *castBlock + (seed << 5) + 3; key = ((~key << 0x15) + 0x11111111) | (key >> 0x0B); @@ -29,7 +29,7 @@ void Encrypt(DWORD *castBlock, DWORD size, DWORD key) seed = 0xEEEEEEEE; for (i = 0; i < (size >> 2); i++) { ch = *castBlock; - seed += hashtable[0x400 + (key & 0xFF)]; + seed += hashtable[4][(key & 0xFF)]; *castBlock ^= seed + key; seed += ch + (seed << 5) + 3; key = ((~key << 0x15) + 0x11111111) | (key >> 0x0B); @@ -47,7 +47,7 @@ DWORD Hash(const char *s, int type) while (s != NULL && *s) { ch = *s++; ch = toupper(ch); - seed1 = hashtable[(type << 8) + ch] ^ (seed1 + seed2); + seed1 = hashtable[type][ch] ^ (seed1 + seed2); seed2 += ch + seed1 + (seed2 << 5) + 3; } return seed1; @@ -65,7 +65,7 @@ void InitHash() seed = (125 * seed + 3) % 0x2AAAAB; ch = (seed & 0xFFFF); seed = (125 * seed + 3) % 0x2AAAAB; - hashtable[i + j * 256] = ch << 16 | (seed & 0xFFFF); + hashtable[i][j] = ch << 16 | (seed & 0xFFFF); } } } diff --git a/Source/encrypt.h b/Source/encrypt.h index 14e0b20f7..6d02bf6e4 100644 --- a/Source/encrypt.h +++ b/Source/encrypt.h @@ -6,7 +6,7 @@ #ifndef __ENCRYPT_H__ #define __ENCRYPT_H__ -extern DWORD hashtable[1280]; +extern DWORD hashtable[5][256]; void Decrypt(DWORD *castBlock, DWORD size, DWORD key); void Encrypt(DWORD *castBlock, DWORD size, DWORD key); From 3ac90dc03f915f24b8c8aaeb12316cd80c72c5e5 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 8 Apr 2020 18:04:11 +0200 Subject: [PATCH 12/33] Use NewCursor to set cursor --- Source/diablo.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 0ae5c913f..8a273b096 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -832,7 +832,7 @@ BOOL LeftMouseDown(int wParam) } else if (pcurs >= CURSOR_FIRSTITEM) { if (TryInvPut()) { NetSendCmdPItem(TRUE, CMD_PUTITEM, cursmx, cursmy); - SetCursor_(CURSOR_HAND); + NewCursor(CURSOR_HAND); } } else { if (plr[myplr]._pStatPts != 0 && !spselflag) @@ -846,7 +846,7 @@ BOOL LeftMouseDown(int wParam) CheckInvScrn(); DoPanBtn(); if (pcurs > CURSOR_HAND && pcurs < CURSOR_FIRSTITEM) - SetCursor_(CURSOR_HAND); + NewCursor(CURSOR_HAND); } } } @@ -924,21 +924,21 @@ BOOL TryIconCurs() if (pcursinvitem != -1) { CheckIdentify(myplr, pcursinvitem); } else { - SetCursor_(CURSOR_HAND); + NewCursor(CURSOR_HAND); } return TRUE; } else if (pcurs == CURSOR_REPAIR) { if (pcursinvitem != -1) { DoRepair(myplr, pcursinvitem); } else { - SetCursor_(CURSOR_HAND); + NewCursor(CURSOR_HAND); } return TRUE; } else if (pcurs == CURSOR_RECHARGE) { if (pcursinvitem != -1) { DoRecharge(myplr, pcursinvitem); } else { - SetCursor_(CURSOR_HAND); + NewCursor(CURSOR_HAND); } return TRUE; } else if (pcurs == CURSOR_TELEPORT) { @@ -949,10 +949,10 @@ BOOL TryIconCurs() } else { NetSendCmdLocParam2(TRUE, CMD_TSPELLXY, cursmx, cursmy, plr[myplr]._pTSpell, GetSpellLevel(myplr, plr[myplr]._pTSpell)); } - SetCursor_(CURSOR_HAND); + NewCursor(CURSOR_HAND); return TRUE; } else if (pcurs == CURSOR_DISARM && pcursobj == -1) { - SetCursor_(CURSOR_HAND); + NewCursor(CURSOR_HAND); return TRUE; } @@ -989,7 +989,7 @@ void RightMouseDown() if (pcursinvitem == -1 || !UseInvItem(myplr, pcursinvitem)) CheckPlrSpell(); } else if (pcurs > CURSOR_HAND && pcurs < CURSOR_FIRSTITEM) { - SetCursor_(CURSOR_HAND); + NewCursor(CURSOR_HAND); } } } @@ -1910,7 +1910,7 @@ void timeout_cursor(BOOL bTimeout) ClearPanel(); AddPanelString("-- Network timeout --", TRUE); AddPanelString("-- Waiting for players --", TRUE); - SetCursor_(CURSOR_HOURGLASS); + NewCursor(CURSOR_HOURGLASS); force_redraw = 255; } scrollrt_draw_game_screen(TRUE); From c9db23de5b337dab1205471d6ec26cdcc7001401 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 8 Apr 2020 18:05:16 +0200 Subject: [PATCH 13/33] Correct sfx_* names, can be seen in assert strings --- Source/effects.cpp | 1730 ++++++++++++++++++++++---------------------- enums.h | 16 +- 2 files changed, 873 insertions(+), 873 deletions(-) diff --git a/Source/effects.cpp b/Source/effects.cpp index 2ef02dd31..35df489b8 100644 --- a/Source/effects.cpp +++ b/Source/effects.cpp @@ -27,894 +27,894 @@ const char MonstSndChar[] = { 'a', 'h', 'd', 's' }; TSFX sgSFX[] = { // clang-format off // bFlags, pszName, pSnd - { SFX_MISC, "Sfx\\Misc\\Walk1.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Walk2.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Walk3.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Walk4.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\BFire.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Fmag.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Tmag.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Lghit.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Lghit1.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Swing.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Swing2.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Dead.wav", NULL }, - { SFX_STREAM, "Sfx\\Misc\\Questdon.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Armrfkd.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Barlfire.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Barrel.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Bhit.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Bhit1.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Chest.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Doorclos.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Dooropen.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipanvl.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipaxe.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipblst.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipbody.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipbook.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipbow.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipcap.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipharm.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Fliplarm.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipmag.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipmag1.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipmush.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flippot.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipring.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Fliprock.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipscrl.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipshld.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipsign.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipstaf.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Flipswor.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Gold.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Hlmtfkd.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invanvl.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invaxe.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invblst.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invbody.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invbook.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invbow.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invcap.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invgrab.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invharm.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invlarm.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invmush.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invpot.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invring.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invrock.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invscrol.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invshiel.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invsign.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invstaf.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Invsword.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Lever.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Magic.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Magic1.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Readbook.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Sarc.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Shielfkd.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Swrdfkd.wav", NULL }, - { SFX_UI, "Sfx\\Items\\Titlemov.wav", NULL }, - { SFX_UI, "Sfx\\Items\\Titlslct.wav", NULL }, - { SFX_UI, "Sfx\\Misc\\blank.wav", NULL }, - { SFX_MISC, "Sfx\\Items\\Trap.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Cast1.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Cast10.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Cast12.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Cast2.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Cast3.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Cast4.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Cast5.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Cast6.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Cast7.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Cast8.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Cast9.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Healing.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Repair.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Acids1.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Acids2.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Apoc.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Arrowall.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Bldboil.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Blodstar.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Blsimpt.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Bonesp.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Bsimpct.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Caldron.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Cbolt.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Chltning.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\DSerp.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Elecimp1.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Elementl.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Ethereal.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Fball.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Fbolt1.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Fbolt2.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Firimp1.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Firimp2.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Flamwave.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Flash.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Fountain.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Golum.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Golumded.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Gshrine.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Guard.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Grdlanch.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Holybolt.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Hyper.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Infravis.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Invisibl.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Invpot.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Lning1.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Ltning.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Mshield.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Nova.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Portal.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Puddle.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Resur.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Scurse.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Scurimp.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Sentinel.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Shatter.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Soulfire.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Spoutlop.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Spoutstr.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Storm.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Trapdis.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Teleport.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Vtheft.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Wallloop.wav", NULL }, - { SFX_MISC, "Sfx\\Misc\\Wallstrt.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Walk1.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Walk2.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Walk3.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Walk4.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\BFire.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Fmag.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Tmag.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Lghit.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Lghit1.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Swing.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Swing2.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Dead.wav", NULL }, + { sfx_STREAM, "Sfx\\Misc\\Questdon.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Armrfkd.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Barlfire.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Barrel.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Bhit.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Bhit1.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Chest.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Doorclos.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Dooropen.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipanvl.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipaxe.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipblst.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipbody.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipbook.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipbow.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipcap.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipharm.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Fliplarm.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipmag.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipmag1.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipmush.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flippot.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipring.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Fliprock.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipscrl.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipshld.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipsign.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipstaf.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Flipswor.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Gold.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Hlmtfkd.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invanvl.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invaxe.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invblst.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invbody.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invbook.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invbow.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invcap.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invgrab.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invharm.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invlarm.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invmush.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invpot.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invring.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invrock.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invscrol.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invshiel.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invsign.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invstaf.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Invsword.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Lever.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Magic.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Magic1.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Readbook.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Sarc.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Shielfkd.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Swrdfkd.wav", NULL }, + { sfx_UI, "Sfx\\Items\\Titlemov.wav", NULL }, + { sfx_UI, "Sfx\\Items\\Titlslct.wav", NULL }, + { sfx_UI, "Sfx\\Misc\\blank.wav", NULL }, + { sfx_MISC, "Sfx\\Items\\Trap.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Cast1.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Cast10.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Cast12.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Cast2.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Cast3.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Cast4.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Cast5.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Cast6.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Cast7.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Cast8.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Cast9.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Healing.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Repair.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Acids1.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Acids2.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Apoc.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Arrowall.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Bldboil.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Blodstar.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Blsimpt.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Bonesp.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Bsimpct.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Caldron.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Cbolt.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Chltning.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\DSerp.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Elecimp1.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Elementl.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Ethereal.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Fball.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Fbolt1.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Fbolt2.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Firimp1.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Firimp2.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Flamwave.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Flash.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Fountain.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Golum.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Golumded.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Gshrine.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Guard.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Grdlanch.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Holybolt.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Hyper.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Infravis.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Invisibl.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Invpot.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Lning1.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Ltning.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Mshield.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Nova.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Portal.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Puddle.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Resur.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Scurse.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Scurimp.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Sentinel.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Shatter.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Soulfire.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Spoutlop.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Spoutstr.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Storm.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Trapdis.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Teleport.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Vtheft.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Wallloop.wav", NULL }, + { sfx_MISC, "Sfx\\Misc\\Wallstrt.wav", NULL }, #ifndef SPAWN - { SFX_STREAM, "Sfx\\Towners\\Bmaid01.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid02.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid03.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid04.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid05.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid06.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid07.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid08.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid09.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid10.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid11.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid12.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid13.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid14.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid15.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid16.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid17.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid18.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid19.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid20.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid21.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid22.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid23.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid24.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid25.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid26.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid27.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid28.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid29.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid30.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid01.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid02.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid03.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid04.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid05.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid06.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid07.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid08.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid09.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid10.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid11.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid12.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid13.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid14.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid15.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid16.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid17.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid18.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid19.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid20.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid21.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid22.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid23.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid24.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid25.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid26.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid27.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid28.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid29.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid30.wav", NULL }, #endif - { SFX_STREAM, "Sfx\\Towners\\Bmaid31.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid31.wav", NULL }, #ifndef SPAWN - { SFX_STREAM, "Sfx\\Towners\\Bmaid32.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid33.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid34.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid35.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid36.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid37.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid38.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid39.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bmaid40.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith01.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith02.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith03.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith04.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith05.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith06.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith07.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith08.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith09.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith10.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith11.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith12.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith13.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith14.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith15.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith16.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith17.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith18.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith19.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith20.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith21.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith22.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith23.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith24.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith25.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith26.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith27.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith28.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith29.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith30.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith31.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith32.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith33.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith34.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith35.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith36.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith37.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith38.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith39.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith40.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith41.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith42.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith43.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid32.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid33.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid34.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid35.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid36.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid37.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid38.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid39.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bmaid40.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith01.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith02.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith03.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith04.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith05.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith06.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith07.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith08.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith09.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith10.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith11.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith12.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith13.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith14.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith15.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith16.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith17.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith18.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith19.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith20.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith21.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith22.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith23.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith24.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith25.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith26.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith27.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith28.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith29.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith30.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith31.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith32.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith33.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith34.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith35.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith36.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith37.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith38.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith39.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith40.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith41.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith42.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith43.wav", NULL }, #endif - { SFX_STREAM, "Sfx\\Towners\\Bsmith44.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith44.wav", NULL }, #ifndef SPAWN - { SFX_STREAM, "Sfx\\Towners\\Bsmith45.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith46.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith47.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith48.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith49.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith50.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith51.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith52.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith53.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith54.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith55.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Bsmith56.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith45.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith46.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith47.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith48.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith49.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith50.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith51.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith52.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith53.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith54.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith55.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Bsmith56.wav", NULL }, #endif { 0, "Sfx\\Towners\\Cow1.wav", NULL }, { 0, "Sfx\\Towners\\Cow2.wav", NULL }, #ifndef SPAWN - { SFX_STREAM, "Sfx\\Towners\\Deadguy2.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk01.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk02.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk03.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk04.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk05.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk06.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk07.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk08.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk09.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk10.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk11.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk12.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk13.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk14.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk15.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk16.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk17.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk18.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk19.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk20.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk21.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk22.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk23.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk24.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk25.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk26.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Deadguy2.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk01.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk02.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk03.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk04.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk05.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk06.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk07.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk08.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk09.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk10.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk11.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk12.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk13.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk14.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk15.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk16.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk17.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk18.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk19.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk20.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk21.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk22.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk23.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk24.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk25.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk26.wav", NULL }, #endif - { SFX_STREAM, "Sfx\\Towners\\Drunk27.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk27.wav", NULL }, #ifndef SPAWN - { SFX_STREAM, "Sfx\\Towners\\Drunk28.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk29.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk30.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk31.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk32.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk33.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk34.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Drunk35.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer01.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer02.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer03.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer04.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer05.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer06.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer07.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer08.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer09.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer10.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer11.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer12.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer13.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer14.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer15.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer16.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer17.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer18.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer19.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer20.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer21.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer22.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer23.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer24.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer25.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer26.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer27.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer28.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer29.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer30.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer31.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer32.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer33.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer34.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer35.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer36.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk28.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk29.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk30.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk31.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk32.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk33.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk34.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Drunk35.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer01.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer02.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer03.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer04.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer05.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer06.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer07.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer08.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer09.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer10.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer11.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer12.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer13.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer14.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer15.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer16.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer17.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer18.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer19.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer20.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer21.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer22.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer23.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer24.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer25.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer26.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer27.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer28.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer29.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer30.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer31.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer32.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer33.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer34.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer35.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer36.wav", NULL }, #endif - { SFX_STREAM, "Sfx\\Towners\\Healer37.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer37.wav", NULL }, #ifndef SPAWN - { SFX_STREAM, "Sfx\\Towners\\Healer38.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer39.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer40.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer41.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer42.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer43.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer44.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer45.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer46.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Healer47.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy01.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy02.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy03.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy04.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy05.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy06.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy07.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy08.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy09.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy10.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy11.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy12.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy13.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy14.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy15.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy16.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy17.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy18.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy19.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy20.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy21.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy22.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy23.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy24.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy25.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy26.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy27.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy28.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy29.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy30.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy31.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer38.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer39.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer40.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer41.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer42.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer43.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer44.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer45.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer46.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Healer47.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy01.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy02.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy03.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy04.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy05.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy06.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy07.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy08.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy09.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy10.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy11.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy12.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy13.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy14.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy15.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy16.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy17.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy18.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy19.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy20.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy21.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy22.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy23.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy24.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy25.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy26.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy27.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy28.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy29.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy30.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy31.wav", NULL }, #endif - { SFX_STREAM, "Sfx\\Towners\\Pegboy32.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy32.wav", NULL }, #ifndef SPAWN - { SFX_STREAM, "Sfx\\Towners\\Pegboy33.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy34.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy35.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy36.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy37.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy38.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy39.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy40.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy41.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy42.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Pegboy43.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Priest00.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Priest01.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Priest02.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Priest03.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Priest04.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Priest05.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Priest06.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Priest07.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt00.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt01.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt02.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt03.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt04.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt05.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt06.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt07.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt08.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt09.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt10.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt11.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt12.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt13.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt14.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt15.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt16.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt17.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt18.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt19.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt20.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt21.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt22.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt23.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt24.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy33.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy34.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy35.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy36.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy37.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy38.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy39.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy40.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy41.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy42.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Pegboy43.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Priest00.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Priest01.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Priest02.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Priest03.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Priest04.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Priest05.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Priest06.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Priest07.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt00.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt01.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt02.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt03.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt04.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt05.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt06.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt07.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt08.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt09.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt10.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt11.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt12.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt13.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt14.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt15.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt16.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt17.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt18.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt19.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt20.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt21.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt22.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt23.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt24.wav", NULL }, #endif - { SFX_STREAM, "Sfx\\Towners\\Storyt25.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt25.wav", NULL }, #ifndef SPAWN - { SFX_STREAM, "Sfx\\Towners\\Storyt26.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt27.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt28.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt29.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt30.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt31.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt32.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt33.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt34.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt35.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt36.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt37.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Storyt38.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt26.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt27.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt28.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt29.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt30.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt31.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt32.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt33.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt34.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt35.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt36.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt37.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Storyt38.wav", NULL }, #endif - { SFX_STREAM, "Sfx\\Towners\\Tavown00.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown00.wav", NULL }, #ifndef SPAWN - { SFX_STREAM, "Sfx\\Towners\\Tavown01.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown02.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown03.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown04.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown05.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown06.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown07.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown08.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown09.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown10.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown11.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown12.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown13.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown14.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown15.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown16.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown17.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown18.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown19.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown20.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown21.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown22.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown23.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown24.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown25.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown26.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown27.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown28.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown29.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown30.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown31.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown32.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown33.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown34.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown35.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown01.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown02.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown03.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown04.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown05.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown06.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown07.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown08.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown09.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown10.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown11.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown12.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown13.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown14.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown15.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown16.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown17.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown18.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown19.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown20.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown21.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown22.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown23.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown24.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown25.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown26.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown27.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown28.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown29.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown30.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown31.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown32.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown33.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown34.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown35.wav", NULL }, #endif - { SFX_STREAM, "Sfx\\Towners\\Tavown36.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown36.wav", NULL }, #ifndef SPAWN - { SFX_STREAM, "Sfx\\Towners\\Tavown37.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown38.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown39.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown40.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown41.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown42.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown43.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown44.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Tavown45.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch01.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch02.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch03.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch04.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch05.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch06.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch07.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch08.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch09.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch10.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch11.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch12.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch13.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch14.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch15.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch16.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch17.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch18.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch19.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch20.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch21.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch22.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch23.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch24.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch25.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch26.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch27.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch28.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch29.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch30.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch31.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch32.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch33.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch34.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch35.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch36.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch37.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown37.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown38.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown39.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown40.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown41.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown42.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown43.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown44.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Tavown45.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch01.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch02.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch03.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch04.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch05.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch06.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch07.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch08.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch09.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch10.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch11.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch12.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch13.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch14.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch15.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch16.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch17.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch18.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch19.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch20.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch21.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch22.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch23.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch24.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch25.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch26.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch27.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch28.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch29.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch30.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch31.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch32.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch33.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch34.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch35.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch36.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch37.wav", NULL }, #endif - { SFX_STREAM, "Sfx\\Towners\\Witch38.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch38.wav", NULL }, #ifndef SPAWN - { SFX_STREAM, "Sfx\\Towners\\Witch39.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch40.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch41.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch42.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch43.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch44.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch45.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch46.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch47.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch48.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch49.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Witch50.wav", NULL }, - { SFX_STREAM, "Sfx\\Towners\\Wound01.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage01.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage02.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage03.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage04.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage05.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage06.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage07.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage08.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage09.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage10.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage11.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage12.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage13.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage14.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage15.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage16.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage17.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage18.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage19.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage20.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage21.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage22.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage23.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage24.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage25.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage26.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage27.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage28.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage29.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage30.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage31.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage32.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage33.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage34.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage35.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage36.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage37.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage38.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage39.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage40.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage41.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage42.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage43.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage44.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage45.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage46.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage47.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage48.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage49.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage50.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage51.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage52.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage53.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage54.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage55.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage56.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage57.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage58.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage59.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage60.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage61.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage62.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage63.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage64.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage65.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage66.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage67.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage68.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage69.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage69b.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage70.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage71.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage72.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage73.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage74.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage75.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage76.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage77.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage78.wav", NULL }, - { SFX_SORCEROR, "Sfx\\Sorceror\\Mage79.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage80.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage81.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage82.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage83.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage84.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage85.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage86.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage87.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage88.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage89.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage90.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage91.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage92.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage93.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage94.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage95.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage96.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage97.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage98.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage99.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage100.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage101.wav", NULL }, - { SFX_STREAM | SFX_SORCEROR, "Sfx\\Sorceror\\Mage102.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue01.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue02.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue03.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue04.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue05.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue06.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue07.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue08.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue09.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue10.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue11.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue12.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue13.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue14.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue15.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue16.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue17.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue18.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue19.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue20.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue21.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue22.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue23.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue24.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue25.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue26.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue27.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue28.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue29.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue30.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue31.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue32.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue33.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue34.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue35.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue36.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue37.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue38.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue39.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue40.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue41.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue42.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue43.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue44.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue45.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue46.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue47.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue48.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue49.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue50.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue51.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue52.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue53.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue54.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue55.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue56.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue57.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue58.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue59.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue60.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue61.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue62.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue63.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue64.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue65.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue66.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue67.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue68.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue69.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue69b.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue70.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue71.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue72.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue73.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue74.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue75.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue76.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue77.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue78.wav", NULL }, - { SFX_ROGUE, "Sfx\\Rogue\\Rogue79.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue80.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue81.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue82.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue83.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue84.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue85.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue86.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue87.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue88.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue89.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue90.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue91.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue92.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue93.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue94.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue95.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue96.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue97.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue98.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue99.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue100.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue101.wav", NULL }, - { SFX_STREAM | SFX_ROGUE, "Sfx\\Rogue\\Rogue102.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior01.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior02.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior03.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior04.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior05.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior06.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior07.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior08.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior09.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior10.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior11.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior12.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch39.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch40.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch41.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch42.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch43.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch44.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch45.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch46.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch47.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch48.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch49.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Witch50.wav", NULL }, + { sfx_STREAM, "Sfx\\Towners\\Wound01.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage01.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage02.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage03.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage04.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage05.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage06.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage07.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage08.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage09.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage10.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage11.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage12.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage13.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage14.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage15.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage16.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage17.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage18.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage19.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage20.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage21.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage22.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage23.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage24.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage25.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage26.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage27.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage28.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage29.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage30.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage31.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage32.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage33.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage34.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage35.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage36.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage37.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage38.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage39.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage40.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage41.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage42.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage43.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage44.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage45.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage46.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage47.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage48.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage49.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage50.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage51.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage52.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage53.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage54.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage55.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage56.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage57.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage58.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage59.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage60.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage61.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage62.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage63.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage64.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage65.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage66.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage67.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage68.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage69.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage69b.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage70.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage71.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage72.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage73.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage74.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage75.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage76.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage77.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage78.wav", NULL }, + { sfx_SORCEROR, "Sfx\\Sorceror\\Mage79.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage80.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage81.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage82.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage83.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage84.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage85.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage86.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage87.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage88.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage89.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage90.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage91.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage92.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage93.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage94.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage95.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage96.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage97.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage98.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage99.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage100.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage101.wav", NULL }, + { sfx_STREAM | sfx_SORCEROR, "Sfx\\Sorceror\\Mage102.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue01.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue02.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue03.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue04.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue05.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue06.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue07.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue08.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue09.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue10.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue11.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue12.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue13.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue14.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue15.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue16.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue17.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue18.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue19.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue20.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue21.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue22.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue23.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue24.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue25.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue26.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue27.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue28.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue29.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue30.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue31.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue32.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue33.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue34.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue35.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue36.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue37.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue38.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue39.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue40.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue41.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue42.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue43.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue44.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue45.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue46.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue47.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue48.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue49.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue50.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue51.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue52.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue53.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue54.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue55.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue56.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue57.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue58.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue59.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue60.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue61.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue62.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue63.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue64.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue65.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue66.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue67.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue68.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue69.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue69b.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue70.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue71.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue72.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue73.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue74.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue75.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue76.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue77.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue78.wav", NULL }, + { sfx_ROGUE, "Sfx\\Rogue\\Rogue79.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue80.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue81.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue82.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue83.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue84.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue85.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue86.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue87.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue88.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue89.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue90.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue91.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue92.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue93.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue94.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue95.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue96.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue97.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue98.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue99.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue100.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue101.wav", NULL }, + { sfx_STREAM | sfx_ROGUE, "Sfx\\Rogue\\Rogue102.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior01.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior02.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior03.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior04.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior05.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior06.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior07.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior08.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior09.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior10.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior11.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior12.wav", NULL }, #endif - { SFX_WARRIOR, "Sfx\\Warrior\\Warior13.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior14.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Wario14b.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Wario14c.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior15.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Wario15b.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Wario15c.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior16.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Wario16b.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Wario16c.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior17.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior18.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior19.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior20.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior21.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior22.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior23.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior24.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior25.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior26.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior27.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior28.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior29.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior30.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior31.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior32.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior33.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior34.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior35.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior36.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior37.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior38.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior39.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior40.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior41.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior42.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior43.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior44.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior45.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior46.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior47.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior48.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior49.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior50.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior51.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior52.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior53.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior54.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior55.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior56.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior57.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior58.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior59.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior60.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior61.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior62.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior63.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior64.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior65.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior66.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior67.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior68.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior69.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Wario69b.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior70.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior71.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior72.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior73.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior74.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior75.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior76.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior77.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior78.wav", NULL }, - { SFX_WARRIOR, "Sfx\\Warrior\\Warior79.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior13.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior14.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Wario14b.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Wario14c.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior15.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Wario15b.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Wario15c.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior16.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Wario16b.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Wario16c.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior17.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior18.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior19.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior20.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior21.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior22.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior23.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior24.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior25.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior26.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior27.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior28.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior29.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior30.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior31.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior32.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior33.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior34.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior35.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior36.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior37.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior38.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior39.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior40.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior41.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior42.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior43.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior44.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior45.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior46.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior47.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior48.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior49.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior50.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior51.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior52.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior53.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior54.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior55.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior56.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior57.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior58.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior59.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior60.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior61.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior62.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior63.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior64.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior65.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior66.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior67.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior68.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior69.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Wario69b.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior70.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior71.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior72.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior73.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior74.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior75.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior76.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior77.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior78.wav", NULL }, + { sfx_WARRIOR, "Sfx\\Warrior\\Warior79.wav", NULL }, #ifndef SPAWN - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior80.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior81.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior82.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior83.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior84.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior85.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior86.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior87.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior88.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior89.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior90.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior91.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior92.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior93.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior94.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior95.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Wario95b.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Wario95c.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Wario95d.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Wario95e.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Wario95f.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior80.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior81.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior82.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior83.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior84.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior85.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior86.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior87.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior88.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior89.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior90.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior91.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior92.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior93.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior94.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior95.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario95b.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario95c.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario95d.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario95e.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario95f.wav", NULL }, #endif - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Wario96b.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Wario97.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Wario98.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Warior99.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario96b.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario97.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario98.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Warior99.wav", NULL }, #ifndef SPAWN - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Wario100.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Wario101.wav", NULL }, - { SFX_STREAM | SFX_WARRIOR, "Sfx\\Warrior\\Wario102.wav", NULL }, - { SFX_STREAM, "Sfx\\Narrator\\Nar01.wav", NULL }, - { SFX_STREAM, "Sfx\\Narrator\\Nar02.wav", NULL }, - { SFX_STREAM, "Sfx\\Narrator\\Nar03.wav", NULL }, - { SFX_STREAM, "Sfx\\Narrator\\Nar04.wav", NULL }, - { SFX_STREAM, "Sfx\\Narrator\\Nar05.wav", NULL }, - { SFX_STREAM, "Sfx\\Narrator\\Nar06.wav", NULL }, - { SFX_STREAM, "Sfx\\Narrator\\Nar07.wav", NULL }, - { SFX_STREAM, "Sfx\\Narrator\\Nar08.wav", NULL }, - { SFX_STREAM, "Sfx\\Narrator\\Nar09.wav", NULL }, - { SFX_STREAM, "Sfx\\Misc\\Lvl16int.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Butcher.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Garbud01.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Garbud02.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Garbud03.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Garbud04.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Izual01.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Lach01.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Lach02.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Lach03.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Laz01.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Laz02.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Sking01.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Snot01.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Snot02.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Snot03.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Warlrd01.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Wlock01.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Zhar01.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\Zhar02.wav", NULL }, - { SFX_STREAM, "Sfx\\Monsters\\DiabloD.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario100.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario101.wav", NULL }, + { sfx_STREAM | sfx_WARRIOR, "Sfx\\Warrior\\Wario102.wav", NULL }, + { sfx_STREAM, "Sfx\\Narrator\\Nar01.wav", NULL }, + { sfx_STREAM, "Sfx\\Narrator\\Nar02.wav", NULL }, + { sfx_STREAM, "Sfx\\Narrator\\Nar03.wav", NULL }, + { sfx_STREAM, "Sfx\\Narrator\\Nar04.wav", NULL }, + { sfx_STREAM, "Sfx\\Narrator\\Nar05.wav", NULL }, + { sfx_STREAM, "Sfx\\Narrator\\Nar06.wav", NULL }, + { sfx_STREAM, "Sfx\\Narrator\\Nar07.wav", NULL }, + { sfx_STREAM, "Sfx\\Narrator\\Nar08.wav", NULL }, + { sfx_STREAM, "Sfx\\Narrator\\Nar09.wav", NULL }, + { sfx_STREAM, "Sfx\\Misc\\Lvl16int.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Butcher.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Garbud01.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Garbud02.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Garbud03.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Garbud04.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Izual01.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Lach01.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Lach02.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Lach03.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Laz01.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Laz02.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Sking01.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Snot01.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Snot02.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Snot03.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Warlrd01.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Wlock01.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Zhar01.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\Zhar02.wav", NULL }, + { sfx_STREAM, "Sfx\\Monsters\\DiabloD.wav", NULL }, #endif // clang-format on }; -#define PLRSFXS (SFX_WARRIOR | SFX_ROGUE | SFX_SORCEROR) +#define PLRSFXS (sfx_WARRIOR | sfx_ROGUE | sfx_SORCEROR) BOOL effect_is_playing(int nSFX) { @@ -922,7 +922,7 @@ BOOL effect_is_playing(int nSFX) if (sfx->pSnd) return snd_playing(sfx->pSnd); - if (sfx->bFlags & SFX_STREAM) + if (sfx->bFlags & sfx_STREAM) return sfx == sgpStreamSFX; return FALSE; @@ -1056,7 +1056,7 @@ void PlaySFX_priv(TSFX *pSFX, BOOL loc, int x, int y) return; } - if (!(pSFX->bFlags & (SFX_STREAM | SFX_MISC)) && pSFX->pSnd != 0 && snd_playing(pSFX->pSnd)) { + if (!(pSFX->bFlags & (sfx_STREAM | sfx_MISC)) && pSFX->pSnd != 0 && snd_playing(pSFX->pSnd)) { return; } @@ -1066,7 +1066,7 @@ void PlaySFX_priv(TSFX *pSFX, BOOL loc, int x, int y) return; } - if (pSFX->bFlags & SFX_STREAM) { + if (pSFX->bFlags & sfx_STREAM) { stream_play(pSFX, lVolume, lPan); return; } @@ -1228,11 +1228,11 @@ void sound_init() if (gbMaxPlayers > 1) { mask = PLRSFXS; } else if (plr[myplr]._pClass == PC_WARRIOR) { - mask = SFX_WARRIOR; + mask = sfx_WARRIOR; } else if (plr[myplr]._pClass == PC_ROGUE) { - mask = SFX_ROGUE; + mask = sfx_ROGUE; } else if (plr[myplr]._pClass == PC_SORCERER) { - mask = SFX_SORCEROR; + mask = sfx_SORCEROR; } else { app_fatal("effects:1"); } @@ -1257,7 +1257,7 @@ void priv_sound_init(BYTE bLoadMask) continue; } - if (sgSFX[i].bFlags & SFX_STREAM) { + if (sgSFX[i].bFlags & sfx_STREAM) { continue; } @@ -1275,7 +1275,7 @@ void priv_sound_init(BYTE bLoadMask) void ui_sound_init() { - priv_sound_init(SFX_UI); + priv_sound_init(sfx_UI); } void __stdcall effects_play_sound(char *snd_file) diff --git a/enums.h b/enums.h index 47407cc6b..b0607fa0d 100644 --- a/enums.h +++ b/enums.h @@ -1167,14 +1167,14 @@ typedef enum _sfx_id { } _sfx_id; typedef enum sfx_flag { - SFX_STREAM = 0x01, - SFX_MISC = 0x02, - SFX_UI = 0x04, - SFX_MONK = 0x08, - SFX_ROGUE = 0x10, - SFX_WARRIOR = 0x20, - SFX_SORCEROR = 0x40, - SFX_LOADED = 0x80, + sfx_STREAM = 0x01, + sfx_MISC = 0x02, + sfx_UI = 0x04, + sfx_MONK = 0x08, + sfx_ROGUE = 0x10, + sfx_WARRIOR = 0x20, + sfx_SORCEROR = 0x40, + sfx_LOADED = 0x80, } sfx_flag; typedef enum item_equip_type { From cc280eeba3ee3b42bd432b80c3d3e26c41a7d5cb Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 8 Apr 2020 18:05:51 +0200 Subject: [PATCH 14/33] Enable asserts in files that where cleaned --- Source/cursor.cpp | 2 +- Source/diablo.cpp | 10 +++++----- Source/dx.cpp | 8 ++++---- Source/effects.cpp | 4 ++-- Source/engine.cpp | 30 +++++++++++++++--------------- Source/error.cpp | 2 +- Source/gmenu.cpp | 2 +- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Source/cursor.cpp b/Source/cursor.cpp index 07b564775..798f5719b 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -75,7 +75,7 @@ const int InvItemHeight[] = { void InitCursor() { - /// ASSERT: assert(! pCursCels); + assert(! pCursCels); pCursCels = LoadFileInMem("Data\\Inv\\Objcurs.CEL", NULL); ClearCursor(); } diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 8a273b096..c68dea101 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -858,7 +858,7 @@ BOOL LeftMouseCmd(BOOL bShift) { BOOL bNear; - /// ASSERT: assert(MouseY < 352); // PANEL_TOP + assert(MouseY < PANEL_TOP); // 352 if (leveltype == DTYPE_TOWN) { if (pcursitem != -1 && pcurs == CURSOR_HAND) @@ -1023,7 +1023,7 @@ void diablo_hotkey_msg(DWORD dwMsg) } strcat(szFileName, "\\Diablo.ini"); - /// ASSERT: assert(dwMsg < sizeof(spszMsgTbl) / sizeof(spszMsgTbl[0])); + assert(dwMsg < sizeof(spszMsgTbl) / sizeof(spszMsgTbl[0])); GetPrivateProfileString("NetMsg", spszMsgHotKeyTbl[dwMsg], spszMsgTbl[dwMsg], szMsg, sizeof(szMsg), szFileName); NetSendCmdString(-1, szMsg); } @@ -1521,7 +1521,7 @@ void PressChar(int vkey) void LoadLvlGFX() { - /// ASSERT: assert(! pDungeonCels); + assert(! pDungeonCels); switch (leveltype) { case DTYPE_TOWN: @@ -1564,7 +1564,7 @@ void LoadLvlGFX() void LoadAllGFX() { - /// ASSERT: assert(! pSpeedCels); + assert(! pSpeedCels); pSpeedCels = DiabloAllocPtr(0x100000); IncProgress(); IncProgress(); @@ -1756,7 +1756,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir) ResyncMPQuests(); #ifndef SPAWN } else { - /// ASSERT: assert(! pSpeedCels); + assert(! pSpeedCels); pSpeedCels = DiabloAllocPtr(0x100000); LoadSetMap(); IncProgress(); diff --git a/Source/dx.cpp b/Source/dx.cpp index 54efb059a..b6b114f11 100644 --- a/Source/dx.cpp +++ b/Source/dx.cpp @@ -99,9 +99,9 @@ void dx_init(HWND hWnd) BOOL bSuccess; GUID *lpGUID; - /// ASSERT: assert(! gpBuffer); - /// ASSERT: assert(! sgdwLockCount); - /// ASSERT: assert(! sgpBackBuf); + assert(! gpBuffer); + assert(! sgdwLockCount); + assert(! sgpBackBuf); SetFocus(hWnd); ShowWindow(hWnd, SW_SHOWNORMAL); @@ -157,7 +157,7 @@ void dx_init(HWND hWnd) GdiSetBatchLimit(1); dx_create_back_buffer(); bSuccess = SDrawManualInitialize(hWnd, lpDDInterface, lpDDSPrimary, NULL, NULL, lpDDSBackBuf, lpDDPalette, NULL); - /// ASSERT: assert(bSuccess); + assert(bSuccess); } static void lock_buf_priv() diff --git a/Source/effects.cpp b/Source/effects.cpp index 35df489b8..477f442f1 100644 --- a/Source/effects.cpp +++ b/Source/effects.cpp @@ -1082,8 +1082,8 @@ void stream_play(TSFX *pSFX, int lVolume, int lPan) { BOOL success; - /// ASSERT: assert(pSFX); - /// ASSERT: assert(pSFX->bFlags & sfx_STREAM); + assert(pSFX); + assert(pSFX->bFlags & sfx_STREAM); stream_stop(); lVolume += sound_get_or_set_sound_volume(1); if (lVolume >= VOLUME_MIN) { diff --git a/Source/engine.cpp b/Source/engine.cpp index 619cd9d38..6fe623b17 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -2751,7 +2751,7 @@ void Cl2Draw(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + assert(nCel <= (int)pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -2942,12 +2942,12 @@ void Cl2DrawOutline(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWid /// ASSERT: assert(pCelBuff != NULL); if (pCelBuff == NULL) return; - /// ASSERT: assert(nCel > 0); + assert(nCel > 0); if (nCel <= 0) return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + assert(nCel <= (int)pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -3161,12 +3161,12 @@ void Cl2DrawLightTbl(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int C /// ASSERT: assert(pCelBuff != NULL); if (pCelBuff == NULL) return; - /// ASSERT: assert(nCel > 0); + assert(nCel > 0); if (nCel <= 0) return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + assert(nCel <= (int)pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -3377,12 +3377,12 @@ void Cl2DrawLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelS /// ASSERT: assert(pCelBuff != NULL); if (pCelBuff == NULL) return; - /// ASSERT: assert(nCel > 0); + assert(nCel > 0); if (nCel <= 0) return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + assert(nCel <= (int)pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -3427,12 +3427,12 @@ void Cl2DrawSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSk /// ASSERT: assert(pCelBuff != NULL); if (pCelBuff == NULL) return; - /// ASSERT: assert(nCel > 0); + assert(nCel > 0); if (nCel <= 0) return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + assert(nCel <= (int)pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -3636,12 +3636,12 @@ void Cl2DrawOutlineSafe(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int /// ASSERT: assert(pCelBuff != NULL); if (pCelBuff == NULL) return; - /// ASSERT: assert(nCel > 0); + assert(nCel > 0); if (nCel <= 0) return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + assert(nCel <= (int)pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -3868,12 +3868,12 @@ void Cl2DrawLightTblSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i /// ASSERT: assert(pCelBuff != NULL); if (pCelBuff == NULL) return; - /// ASSERT: assert(nCel > 0); + assert(nCel > 0); if (nCel <= 0) return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + assert(nCel <= (int)pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) @@ -4097,12 +4097,12 @@ void Cl2DrawLightSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int /// ASSERT: assert(pCelBuff != NULL); if (pCelBuff == NULL) return; - /// ASSERT: assert(nCel > 0); + assert(nCel > 0); if (nCel <= 0) return; pFrameTable = (DWORD *)pCelBuff; - /// ASSERT: assert(nCel <= (int) pFrameTable[0]); + assert(nCel <= (int)pFrameTable[0]); pRLEBytes = &pCelBuff[pFrameTable[nCel]]; nDataStart = *(WORD *)&pRLEBytes[CelSkip]; if (!nDataStart) diff --git a/Source/error.cpp b/Source/error.cpp index 5d09863d6..3ac8bdbce 100644 --- a/Source/error.cpp +++ b/Source/error.cpp @@ -109,7 +109,7 @@ void DrawDiabloMsg() sy += 12; } - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); #define TRANS_RECT_X (PANEL_LEFT + 104) #define TRANS_RECT_Y (DIALOG_TOP - 8) diff --git a/Source/gmenu.cpp b/Source/gmenu.cpp index fee71eb71..347d7292f 100644 --- a/Source/gmenu.cpp +++ b/Source/gmenu.cpp @@ -384,7 +384,7 @@ void gmenu_slider_set(TMenuItem *pItem, int min, int max, int value) { int nSteps; - /// ASSERT: assertassert(pItem, "gmenu.cpp", 445); + assert(pItem); nSteps = (int)(pItem->dwFlags & 0xFFF000) >> 12; if (nSteps < 2) nSteps = 2; From edcd92e012ee6edd1f802c7fb064f0cd06dfdc40 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 8 Apr 2020 21:39:13 +0200 Subject: [PATCH 15/33] Misc clean ups that missed last round --- Source/control.cpp | 4 ++-- Source/effects.cpp | 4 ++-- Source/gamemenu.cpp | 4 ++-- Source/monstdat.cpp | 3 +++ 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Source/control.cpp b/Source/control.cpp index 46a249eb0..fd5ff1ffa 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -1274,7 +1274,7 @@ void InitControlPan() pMultiBtns = LoadFileInMem("CtrlPan\\P8But2.CEL", NULL); pTalkBtns = LoadFileInMem("CtrlPan\\TalkButt.CEL", NULL); sgbPlrTalkTbl = 0; - sgszTalkMsg[0] = 0; + sgszTalkMsg[0] = '\0'; for (i = 0; i < MAX_PLRS; i++) whisper[i] = TRUE; for (i = 0; i < sizeof(talkbtndown) / sizeof(talkbtndown[0]); i++) @@ -2720,7 +2720,7 @@ void control_type_message() } talkflag = TRUE; - sgszTalkMsg[0] = 0; + sgszTalkMsg[0] = '\0'; frame = 1; for (i = 0; i < 3; i++) { talkbtndown[i] = FALSE; diff --git a/Source/effects.cpp b/Source/effects.cpp index 477f442f1..2ffb2d95e 100644 --- a/Source/effects.cpp +++ b/Source/effects.cpp @@ -1021,14 +1021,14 @@ BOOL calc_snd_position(int x, int y, int *plVolume, int *plPan) x -= plr[myplr]._px; y -= plr[myplr]._py; - pan = (x - y) << 8; + pan = (x - y) * 256; *plPan = pan; if (abs(pan) > 6400) return FALSE; volume = abs(x) > abs(y) ? abs(x) : abs(y); - volume <<= 6; + volume *= 64; *plVolume = volume; if (volume >= 6400) diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index 76cec1a83..27bb701e7 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -35,8 +35,8 @@ TMenuItem sgOptionsMenu[] = { { GMENU_ENABLED | GMENU_SLIDER, NULL, &gamemenu_sound_volume }, { GMENU_ENABLED | GMENU_SLIDER, "Gamma", &gamemenu_gamma }, { GMENU_ENABLED , NULL, &gamemenu_color_cycling }, - { GMENU_ENABLED , "Previous Menu", &gamemenu_previous }, - { GMENU_ENABLED , NULL, NULL } + { GMENU_ENABLED , "Previous Menu", &gamemenu_previous }, + { GMENU_ENABLED , NULL, NULL }, // clang-format on }; /** Specifies the menu names for music enabled and disabled. */ diff --git a/Source/monstdat.cpp b/Source/monstdat.cpp index fb86ee003..cd49c6977 100644 --- a/Source/monstdat.cpp +++ b/Source/monstdat.cpp @@ -123,6 +123,9 @@ MonsterData monsterdata[] = { // clang-format on }; +/** + * Map between .DUN file value and monster type enum + */ BYTE MonstConvTbl[] = { MT_NZOMBIE, MT_BZOMBIE, From cee695c8903eebd201a6b8f6b7355e29bee3c270 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 8 Apr 2020 21:39:25 +0200 Subject: [PATCH 16/33] Clean up menu structures --- Source/gamemenu.cpp | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index 27bb701e7..4278861ef 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -7,42 +7,48 @@ /** Contains the game menu items of the single player menu. */ TMenuItem sgSingleMenu[] = { - // clang-format off - // dwFlags, pszStr, fnMenu - { GMENU_ENABLED, "Save Game", &gamemenu_save_game }, - { GMENU_ENABLED, "Options", &gamemenu_options }, - { GMENU_ENABLED, "New Game", &gamemenu_new_game }, - { GMENU_ENABLED, "Load Game", &gamemenu_load_game }, - { GMENU_ENABLED, "Quit Diablo", &gamemenu_quit_game }, - { GMENU_ENABLED, NULL, NULL } - // clang-format on +// clang-format off +// dwFlags, pszStr, fnMenu + { GMENU_ENABLED, "Save Game", &gamemenu_save_game }, + { GMENU_ENABLED, "Options", &gamemenu_options }, + { GMENU_ENABLED, "New Game", &gamemenu_new_game }, + { GMENU_ENABLED, "Load Game", &gamemenu_load_game }, + { GMENU_ENABLED, "Quit Diablo", &gamemenu_quit_game }, + { GMENU_ENABLED, NULL, NULL } +// clang-format on }; /** Contains the game menu items of the multi player menu. */ TMenuItem sgMultiMenu[] = { - // clang-format off - // dwFlags, pszStr, fnMenu +// clang-format off +// dwFlags, pszStr, fnMenu { GMENU_ENABLED, "Options", &gamemenu_options }, { GMENU_ENABLED, "New Game", &gamemenu_new_game }, { GMENU_ENABLED, "Restart In Town", &gamemenu_restart_town }, { GMENU_ENABLED, "Quit Diablo", &gamemenu_quit_game }, - { GMENU_ENABLED, NULL, NULL } - // clang-format on + { GMENU_ENABLED, NULL, NULL }, +// clang-format on }; TMenuItem sgOptionsMenu[] = { - // clang-format off - // dwFlags, pszStr, fnMenu +// clang-format off +// dwFlags, pszStr, fnMenu { GMENU_ENABLED | GMENU_SLIDER, NULL, &gamemenu_music_volume }, { GMENU_ENABLED | GMENU_SLIDER, NULL, &gamemenu_sound_volume }, { GMENU_ENABLED | GMENU_SLIDER, "Gamma", &gamemenu_gamma }, { GMENU_ENABLED , NULL, &gamemenu_color_cycling }, { GMENU_ENABLED , "Previous Menu", &gamemenu_previous }, { GMENU_ENABLED , NULL, NULL }, - // clang-format on +// clang-format on }; /** Specifies the menu names for music enabled and disabled. */ -char *music_toggle_names[] = { "Music", "Music Disabled" }; +char *music_toggle_names[] = { + "Music", + "Music Disabled", +}; /** Specifies the menu names for sound enabled and disabled. */ -char *sound_toggle_names[] = { "Sound", "Sound Disabled" }; +char *sound_toggle_names[] = { + "Sound", + "Sound Disabled", +}; /** Specifies the menu names for colour cycling disabled and enabled. */ char *color_cycling_toggle_names[] = { "Color Cycling Off", "Color Cycling On" }; From 2ec7c78eae218fa81cc1cb152f84e6441aded3b3 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Wed, 8 Apr 2020 22:28:53 +0200 Subject: [PATCH 17/33] Format source --- Source/appfat.cpp | 2 +- Source/cursor.cpp | 6 +- Source/diablo.cpp | 278 ++++++++++++++++++++++---------------------- Source/dx.cpp | 6 +- Source/gamemenu.cpp | 54 ++++----- Source/missiles.cpp | 48 ++++---- Source/monstdat.cpp | 2 +- Source/monster.cpp | 31 +++-- Source/objects.cpp | 46 ++++---- Source/player.cpp | 3 +- Source/sound.cpp | 2 +- Source/tmsg.cpp | 2 +- Source/towners.cpp | 2 +- enums.h | 40 +++---- resource.h | 24 ++-- 15 files changed, 274 insertions(+), 272 deletions(-) diff --git a/Source/appfat.cpp b/Source/appfat.cpp index f18c51742..64a14846a 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -573,7 +573,7 @@ void center_window(HWND hDlg) } } -static BOOL CALLBACK FuncDlg(HWND hDlg, UINT uMsg,WPARAM wParam, LPARAM lParam) +static BOOL CALLBACK FuncDlg(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: diff --git a/Source/cursor.cpp b/Source/cursor.cpp index 798f5719b..62bd5f8e6 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -27,6 +27,7 @@ int pcurs; /* rdata */ /** Maps from objcurs.cel frame number to frame width. */ const int InvItemWidth[] = { + // clang-format off // Cursors 0, 33, 32, 32, 32, 32, 32, 32, 32, 32, 32, 23, // Items @@ -47,10 +48,12 @@ const int InvItemWidth[] = { 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, 2 * 28, + // clang-format on }; /** Maps from objcurs.cel frame number to frame height. */ const int InvItemHeight[] = { + // clang-format off // Cursors 0, 29, 32, 32, 32, 32, 32, 32, 32, 32, 32, 35, // Items @@ -71,11 +74,12 @@ const int InvItemHeight[] = { 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, 3 * 28, + // clang-format on }; void InitCursor() { - assert(! pCursCels); + assert(!pCursCels); pCursCels = LoadFileInMem("Data\\Inv\\Objcurs.CEL", NULL); ClearCursor(); } diff --git a/Source/diablo.cpp b/Source/diablo.cpp index c68dea101..a059eb0ba 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -288,50 +288,50 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi return 0; #ifdef _DEBUG - SFileEnableDirectAccess(TRUE); + SFileEnableDirectAccess(TRUE); #endif - diablo_init_screen(); - diablo_parse_flags(lpCmdLine); - init_create_window(nCmdShow); - ui_sound_init(); - UiInitialize(); + diablo_init_screen(); + diablo_parse_flags(lpCmdLine); + init_create_window(nCmdShow); + ui_sound_init(); + UiInitialize(); #ifdef SPAWN - UiSetSpawned(TRUE); + UiSetSpawned(TRUE); #endif #ifdef _DEBUG - if (showintrodebug) + if (showintrodebug) #endif - play_movie("gendata\\logo.smk", TRUE); + play_movie("gendata\\logo.smk", TRUE); #ifndef SPAWN - { - char szValueName[] = "Intro"; + { + char szValueName[] = "Intro"; if (!SRegLoadValue(APP_NAME, szValueName, 0, &nData)) - nData = 1; - if (nData) - play_movie("gendata\\diablo1.smk", TRUE); + nData = 1; + if (nData) + play_movie("gendata\\diablo1.smk", TRUE); SRegSaveValue(APP_NAME, szValueName, 0, 0); - } + } #endif #ifdef _DEBUG - if (showintrodebug) { + if (showintrodebug) { #endif - UiTitleDialog(7); - BlackPalette(); + UiTitleDialog(7); + BlackPalette(); #ifdef _DEBUG - } + } #endif - mainmenu_loop(); - UiDestroy(); - SaveGamma(); + mainmenu_loop(); + UiDestroy(); + SaveGamma(); - if (ghMainWnd) { - Sleep(300); - DestroyWindow(ghMainWnd); - } + if (ghMainWnd) { + Sleep(300); + DestroyWindow(ghMainWnd); + } return 0; } @@ -365,33 +365,33 @@ void diablo_parse_flags(char *args) args += strlen(ds); continue; } - c = tolower(*args); - args++; + c = tolower(*args); + args++; #ifdef _DEBUG - switch (c) { - case '^': + switch (c) { + case '^': debug_mode_key_inverted_v = TRUE; - break; - case '$': + break; + case '$': debug_mode_dollar_sign = TRUE; - break; - case 'b': - /* + break; + case 'b': + /* debug_mode_key_b = TRUE; */ - break; - case 'd': + break; + case 'd': showintrodebug = FALSE; debug_mode_key_d = TRUE; - break; - case 'f': - EnableFrameCount(); - break; - case 'i': + break; + case 'f': + EnableFrameCount(); + break; + case 'i': debug_mode_key_i = TRUE; - break; - case 'j': - /* + break; + case 'j': + /* while(isspace(*args)) { args++; } @@ -402,96 +402,96 @@ void diablo_parse_flags(char *args) } debug_mode_key_J_trigger = i; */ - break; - case 'l': - setlevel = FALSE; - leveldebug = TRUE; - while (isspace(*args)) { - args++; - } - i = 0; - while (isdigit(*args)) { - i = *args + 10 * i - '0'; - args++; - } - leveltype = i; - while (isspace(*args)) { - args++; - } - i = 0; - while (isdigit(*args)) { - i = *args + 10 * i - '0'; - args++; - } - currlevel = i; - plr[0].plrlevel = i; - break; - case 'm': - monstdebug = TRUE; - while (isspace(*args)) { - args++; - } - i = 0; - while (isdigit(*args)) { - i = *args + 10 * i - '0'; - args++; - } - DebugMonsters[debugmonsttypes++] = i; - break; - case 'n': + break; + case 'l': + setlevel = FALSE; + leveldebug = TRUE; + while (isspace(*args)) { + args++; + } + i = 0; + while (isdigit(*args)) { + i = *args + 10 * i - '0'; + args++; + } + leveltype = i; + while (isspace(*args)) { + args++; + } + i = 0; + while (isdigit(*args)) { + i = *args + 10 * i - '0'; + args++; + } + currlevel = i; + plr[0].plrlevel = i; + break; + case 'm': + monstdebug = TRUE; + while (isspace(*args)) { + args++; + } + i = 0; + while (isdigit(*args)) { + i = *args + 10 * i - '0'; + args++; + } + DebugMonsters[debugmonsttypes++] = i; + break; + case 'n': showintrodebug = FALSE; - break; - case 'q': - while (isspace(*args)) { - args++; - } - i = 0; - while (isdigit(*args)) { - i = *args + 10 * i - '0'; - args++; - } - questdebug = i; - break; - case 'r': - while (isspace(*args)) { - args++; - } - i = 0; - while (isdigit(*args)) { - i = *args + 10 * i - '0'; - args++; - } - setseed = i; - break; - case 's': + break; + case 'q': + while (isspace(*args)) { + args++; + } + i = 0; + while (isdigit(*args)) { + i = *args + 10 * i - '0'; + args++; + } + questdebug = i; + break; + case 'r': + while (isspace(*args)) { + args++; + } + i = 0; + while (isdigit(*args)) { + i = *args + 10 * i - '0'; + args++; + } + setseed = i; + break; + case 's': debug_mode_key_s = TRUE; - break; - case 't': - leveldebug = TRUE; - setlevel = TRUE; - while (isspace(*args)) { - args++; - } - i = 0; - while (isdigit(*args)) { - i = *args + 10 * i - '0'; - args++; - } - setlvlnum = i; - break; - case 'v': - visiondebug = TRUE; - break; - case 'w': - debug_mode_key_w = TRUE; - break; - case 'x': - fullscreen = FALSE; - break; + break; + case 't': + leveldebug = TRUE; + setlevel = TRUE; + while (isspace(*args)) { + args++; } -#endif + i = 0; + while (isdigit(*args)) { + i = *args + 10 * i - '0'; + args++; + } + setlvlnum = i; + break; + case 'v': + visiondebug = TRUE; + break; + case 'w': + debug_mode_key_w = TRUE; + break; + case 'x': + fullscreen = FALSE; + break; } +#endif } +} void diablo_init_screen() { @@ -1521,7 +1521,7 @@ void PressChar(int vkey) void LoadLvlGFX() { - assert(! pDungeonCels); + assert(!pDungeonCels); switch (leveltype) { case DTYPE_TOWN: @@ -1564,7 +1564,7 @@ void LoadLvlGFX() void LoadAllGFX() { - assert(! pSpeedCels); + assert(!pSpeedCels); pSpeedCels = DiabloAllocPtr(0x100000); IncProgress(); IncProgress(); @@ -1756,7 +1756,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir) ResyncMPQuests(); #ifndef SPAWN } else { - assert(! pSpeedCels); + assert(!pSpeedCels); pSpeedCels = DiabloAllocPtr(0x100000); LoadSetMap(); IncProgress(); @@ -1931,11 +1931,11 @@ void diablo_color_cyc_logic() color_cycle_timer = tc; if (!palette_get_color_cycling()) return; - if (leveltype == DTYPE_HELL) { - lighting_color_cycling(); - } else if (leveltype == DTYPE_CAVES) { - if (fullscreen) - palette_update_caves(); - } + if (leveltype == DTYPE_HELL) { + lighting_color_cycling(); + } else if (leveltype == DTYPE_CAVES) { + if (fullscreen) + palette_update_caves(); } } +} diff --git a/Source/dx.cpp b/Source/dx.cpp index b6b114f11..197d1d1ca 100644 --- a/Source/dx.cpp +++ b/Source/dx.cpp @@ -99,9 +99,9 @@ void dx_init(HWND hWnd) BOOL bSuccess; GUID *lpGUID; - assert(! gpBuffer); - assert(! sgdwLockCount); - assert(! sgpBackBuf); + assert(!gpBuffer); + assert(!sgdwLockCount); + assert(!sgpBackBuf); SetFocus(hWnd); ShowWindow(hWnd, SW_SHOWNORMAL); diff --git a/Source/gamemenu.cpp b/Source/gamemenu.cpp index 4278861ef..35e4c68b6 100644 --- a/Source/gamemenu.cpp +++ b/Source/gamemenu.cpp @@ -7,37 +7,37 @@ /** Contains the game menu items of the single player menu. */ TMenuItem sgSingleMenu[] = { -// clang-format off -// dwFlags, pszStr, fnMenu + // clang-format off + // dwFlags, pszStr, fnMenu { GMENU_ENABLED, "Save Game", &gamemenu_save_game }, { GMENU_ENABLED, "Options", &gamemenu_options }, { GMENU_ENABLED, "New Game", &gamemenu_new_game }, { GMENU_ENABLED, "Load Game", &gamemenu_load_game }, { GMENU_ENABLED, "Quit Diablo", &gamemenu_quit_game }, { GMENU_ENABLED, NULL, NULL } -// clang-format on + // clang-format on }; /** Contains the game menu items of the multi player menu. */ TMenuItem sgMultiMenu[] = { -// clang-format off -// dwFlags, pszStr, fnMenu + // clang-format off + // dwFlags, pszStr, fnMenu { GMENU_ENABLED, "Options", &gamemenu_options }, { GMENU_ENABLED, "New Game", &gamemenu_new_game }, { GMENU_ENABLED, "Restart In Town", &gamemenu_restart_town }, { GMENU_ENABLED, "Quit Diablo", &gamemenu_quit_game }, { GMENU_ENABLED, NULL, NULL }, -// clang-format on + // clang-format on }; TMenuItem sgOptionsMenu[] = { -// clang-format off -// dwFlags, pszStr, fnMenu + // clang-format off + // dwFlags, pszStr, fnMenu { GMENU_ENABLED | GMENU_SLIDER, NULL, &gamemenu_music_volume }, { GMENU_ENABLED | GMENU_SLIDER, NULL, &gamemenu_sound_volume }, { GMENU_ENABLED | GMENU_SLIDER, "Gamma", &gamemenu_gamma }, { GMENU_ENABLED , NULL, &gamemenu_color_cycling }, { GMENU_ENABLED , "Previous Menu", &gamemenu_previous }, { GMENU_ENABLED , NULL, NULL }, -// clang-format on + // clang-format on }; /** Specifies the menu names for music enabled and disabled. */ char *music_toggle_names[] = { @@ -223,25 +223,25 @@ void gamemenu_music_volume(BOOL bActivate) gbMusicOn = FALSE; music_stop(); sound_get_or_set_music_volume(VOLUME_MIN); - } else { - gbMusicOn = TRUE; - sound_get_or_set_music_volume(VOLUME_MAX); - music_start(leveltype); + } else { + gbMusicOn = TRUE; + sound_get_or_set_music_volume(VOLUME_MAX); + music_start(leveltype); + } + } else { + volume = gamemenu_slider_music_sound(&sgOptionsMenu[0]); + sound_get_or_set_music_volume(volume); + + if (volume == VOLUME_MIN) { + if (gbMusicOn) { + gbMusicOn = FALSE; + music_stop(); + } + } else if (!gbMusicOn) { + gbMusicOn = TRUE; + music_start(leveltype); + } } - } else { - volume = gamemenu_slider_music_sound(&sgOptionsMenu[0]); - sound_get_or_set_music_volume(volume); - - if (volume == VOLUME_MIN) { - if (gbMusicOn) { - gbMusicOn = FALSE; - music_stop(); - } - } else if (!gbMusicOn) { - gbMusicOn = TRUE; - music_start(leveltype); - } - } gamemenu_get_music(); } diff --git a/Source/missiles.cpp b/Source/missiles.cpp index f9be5c521..9860c8e9d 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -971,13 +971,13 @@ void CheckMissileCol(int i, int mindam, int maxdam, BOOL shift, int mx, int my, if (dMonster[mx][my] < 0 && monster[-(dMonster[mx][my] + 1)]._mmode == MM_STONE && MonsterMHit( - missile[i]._misource, - -(dMonster[mx][my] + 1), - mindam, - maxdam, - missile[i]._midist, - missile[i]._mitype, - shift)) { + missile[i]._misource, + -(dMonster[mx][my] + 1), + mindam, + maxdam, + missile[i]._midist, + missile[i]._mitype, + shift)) { if (!nodel) missile[i]._mirange = 0; missile[i]._miHitFlag = TRUE; @@ -986,13 +986,13 @@ void CheckMissileCol(int i, int mindam, int maxdam, BOOL shift, int mx, int my, if (dPlayer[mx][my] > 0 && dPlayer[mx][my] - 1 != missile[i]._misource && Plr2PlrMHit( - missile[i]._misource, - dPlayer[mx][my] - 1, - mindam, - maxdam, - missile[i]._midist, - missile[i]._mitype, - shift)) { + missile[i]._misource, + dPlayer[mx][my] - 1, + mindam, + maxdam, + missile[i]._midist, + missile[i]._mitype, + shift)) { if (!nodel) missile[i]._mirange = 0; missile[i]._miHitFlag = TRUE; @@ -1008,14 +1008,14 @@ void CheckMissileCol(int i, int mindam, int maxdam, BOOL shift, int mx, int my, } if (dPlayer[mx][my] > 0 && PlayerMHit( - dPlayer[mx][my] - 1, - missile[i]._misource, - missile[i]._midist, - mindam, - maxdam, - missile[i]._mitype, - shift, - 0)) { + dPlayer[mx][my] - 1, + missile[i]._misource, + missile[i]._midist, + mindam, + maxdam, + missile[i]._mitype, + shift, + 0)) { if (!nodel) missile[i]._mirange = 0; missile[i]._miHitFlag = TRUE; @@ -2887,12 +2887,12 @@ void MI_Fireball(int i) } if (missile[i]._miyvel > 0 && (TransList[dTransVal[mx + 1][my]] && nSolidTable[dPiece[mx + 1][my]] - || TransList[dTransVal[mx - 1][my]] && nSolidTable[dPiece[mx - 1][my]])) { + || TransList[dTransVal[mx - 1][my]] && nSolidTable[dPiece[mx - 1][my]])) { missile[i]._miyoff -= 32; } if (missile[i]._mixvel > 0 && (TransList[dTransVal[mx][my + 1]] && nSolidTable[dPiece[mx][my + 1]] - || TransList[dTransVal[mx][my - 1]] && nSolidTable[dPiece[mx][my - 1]])) { + || TransList[dTransVal[mx][my - 1]] && nSolidTable[dPiece[mx][my - 1]])) { missile[i]._mixoff -= 32; } missile[i]._mimfnum = 0; diff --git a/Source/monstdat.cpp b/Source/monstdat.cpp index cd49c6977..eeb3a612f 100644 --- a/Source/monstdat.cpp +++ b/Source/monstdat.cpp @@ -257,7 +257,7 @@ BYTE MonstConvTbl[] = { MT_DARKMAGE, }; -#define MAT_NEVER 0 +#define MAT_NEVER 0 #define MAT_ALWAYS 1 #define MAT_RETAIL 2 /** diff --git a/Source/monster.cpp b/Source/monster.cpp index c993c0ead..ce7e3507c 100644 --- a/Source/monster.cpp +++ b/Source/monster.cpp @@ -700,8 +700,7 @@ void PlaceUniqueMonst(int uniqindex, int miniontype, int unpackfilesize) } else { Monst->_mgoal = MGOAL_NORMAL; } - } - else if (Monst->mtalkmsg) + } else if (Monst->mtalkmsg) Monst->_mgoal = MGOAL_INQUIRING; if (gnDifficulty == DIFF_NIGHTMARE) { @@ -1164,7 +1163,7 @@ void M_Enemy(int i) continue; if (!(Monst->_mFlags & MFLAG_GOLEM) && ((abs(monster[mi]._mx - Monst->_mx) >= 2 || abs(monster[mi]._my - Monst->_my) >= 2) && !M_Ranged(i) - || (!(Monst->_mFlags & MFLAG_GOLEM) && !(monster[mi]._mFlags & MFLAG_GOLEM)))) { + || (!(Monst->_mFlags & MFLAG_GOLEM) && !(monster[mi]._mFlags & MFLAG_GOLEM)))) { continue; } sameroom = dTransVal[Monst->_mx][Monst->_my] == dTransVal[monster[mi]._mx][monster[mi]._my]; @@ -3641,11 +3640,11 @@ void MAI_Scav(int i) continue; done = dDead[Monst->_mx + x][Monst->_my + y] != 0 && LineClearF( - CheckNoSolid, - Monst->_mx, - Monst->_my, - Monst->_mx + x, - Monst->_my + y); + CheckNoSolid, + Monst->_mx, + Monst->_my, + Monst->_mx + x, + Monst->_my + y); } } x--; @@ -3658,11 +3657,11 @@ void MAI_Scav(int i) continue; done = dDead[Monst->_mx + x][Monst->_my + y] != 0 && LineClearF( - CheckNoSolid, - Monst->_mx, - Monst->_my, - Monst->_mx + x, - Monst->_my + y); + CheckNoSolid, + Monst->_mx, + Monst->_my, + Monst->_mx + x, + Monst->_my + y); } } x++; @@ -4089,8 +4088,8 @@ void MAI_Rhino(int i) v = random_(134, 100); if (v >= 2 * Monst->_mint + 33 && (Monst->_mVar1 != MM_WALK && Monst->_mVar1 != MM_WALK2 && Monst->_mVar1 != MM_WALK3 - || Monst->_mVar2 - || v >= 2 * Monst->_mint + 83)) { + || Monst->_mVar2 + || v >= 2 * Monst->_mint + 83)) { M_StartDelay(i, random_(135, 10) + 10); } else { M_CallWalk(i, md); @@ -5522,7 +5521,7 @@ BOOL CheckMonsterHit(int m, BOOL &ret) } } - return FALSE; + return FALSE; } int encode_enemy(int m) diff --git a/Source/objects.cpp b/Source/objects.cpp index ec16cbae5..302a76906 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -305,7 +305,7 @@ void AddBookLever(int lx1, int ly1, int lx2, int ly2, int x1, int y1, int x2, in if (!exit) { cnt++; if (cnt > 20000) - return; + return; } } @@ -633,9 +633,9 @@ void AddStoryBooks() } } if (!done) { - cnt++; - if (cnt > 20000) - return; + cnt++; + if (cnt > 20000) + return; } } AddObject(OBJ_STORYBOOK, xp, yp); @@ -722,13 +722,13 @@ void AddLazStand() } } if (!found) { - cnt++; - if (cnt > 10000) { - InitRndLocObj(1, 1, OBJ_LAZSTAND); - return; + cnt++; + if (cnt > 10000) { + InitRndLocObj(1, 1, OBJ_LAZSTAND); + return; + } } } - } AddObject(OBJ_LAZSTAND, xp, yp); AddObject(OBJ_TNUDEM2, xp, yp + 2); AddObject(OBJ_STORYCANDLE, xp + 1, yp + 2); @@ -1118,12 +1118,12 @@ void AddShrine(int i) slist[j] = 1; } if (gbMaxPlayers != 1 && shrineavail[j] == 1) { - slist[j] = 0; - } + slist[j] = 0; + } if (gbMaxPlayers == 1 && shrineavail[j] == 2) { - slist[j] = 0; - } + slist[j] = 0; } + } do { val = random_(150, NUM_SHRINETYPE); } while (!slist[val]); @@ -2437,17 +2437,17 @@ void OperateBook(int pnum, int i) oi = objectactive[j]; otype = object[oi]._otype; if (otype == OBJ_MCIRCLE2 && object[oi]._oVar6 == 1) { - dx = 27; - dy = 29; - object[oi]._oVar6 = 4; - do_add_missile = TRUE; - } + dx = 27; + dy = 29; + object[oi]._oVar6 = 4; + do_add_missile = TRUE; + } if (otype == OBJ_MCIRCLE2 && object[oi]._oVar6 == 2) { - dx = 43; - dy = 29; - object[oi]._oVar6 = 4; - do_add_missile = TRUE; - } + dx = 43; + dy = 29; + object[oi]._oVar6 = 4; + do_add_missile = TRUE; + } if (do_add_missile) { object[dObject[35][36] - 1]._oVar5++; AddMissile(plr[pnum]._px, plr[pnum]._py, dx, dy, plr[pnum]._pdir, MIS_RNDTELEPORT, 0, pnum, 0, 0); diff --git a/Source/player.cpp b/Source/player.cpp index d3bbfa7d9..4ea454d3e 100644 --- a/Source/player.cpp +++ b/Source/player.cpp @@ -1829,8 +1829,7 @@ void DropHalfPlayersGold(int pnum) hGold = plr[pnum]._pGold >> 1; for (i = 0; i < MAXBELTITEMS && hGold > 0; i++) { - if (plr[pnum].SpdList[i]._itype == ITYPE_GOLD && - plr[pnum].SpdList[i]._ivalue != GOLD_MAX_LIMIT) { + if (plr[pnum].SpdList[i]._itype == ITYPE_GOLD && plr[pnum].SpdList[i]._ivalue != GOLD_MAX_LIMIT) { if (hGold < plr[pnum].SpdList[i]._ivalue) { plr[pnum].SpdList[i]._ivalue -= hGold; SetSpdbarGoldCurs(pnum, i); diff --git a/Source/sound.cpp b/Source/sound.cpp index 38288ba7b..829148044 100644 --- a/Source/sound.cpp +++ b/Source/sound.cpp @@ -379,7 +379,7 @@ void music_start(int nTrack) { BOOL success; - assert((DWORD) nTrack < NUM_MUSIC); + assert((DWORD)nTrack < NUM_MUSIC); music_stop(); if (sglpDS && gbMusicOn) { #ifdef _DEBUG diff --git a/Source/tmsg.cpp b/Source/tmsg.cpp index e4f6a9637..e2d6683c1 100644 --- a/Source/tmsg.cpp +++ b/Source/tmsg.cpp @@ -38,7 +38,7 @@ void tmsg_add(BYTE *pbMsg, BYTE bLen) void tmsg_start() { - assert(! sgpTimedMsgHead); + assert(!sgpTimedMsgHead); } void tmsg_cleanup() diff --git a/Source/towners.cpp b/Source/towners.cpp index 5754f4830..7364cda8d 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -92,7 +92,7 @@ int TownCowDir[3] = { 1, 3, 4 }; int cowoffx[8] = { -1, 0, -1, -1, -1, 0, -1, -1 }; int cowoffy[8] = { -1, -1, -1, 0, -1, -1, -1, 0 }; QuestTalkData Qtalklist[] = { -// clang-format off + // clang-format off // _qinfra, _qblkm, _qgarb, _qzhar, _qveil, _qmod, _qbutch, _qbol, _qblind, _qblood, _qanvil, _qwarlrd, _qking, _qpw, _qbone, _qvb { TEXT_INFRA6, TEXT_MUSH6, -1, -1, TEXT_VEIL5, -1, TEXT_BUTCH5, TEXT_BANNER6, TEXT_BLIND5, TEXT_BLOOD5, TEXT_ANVIL6, TEXT_WARLRD5, TEXT_KING7, TEXT_POISON7, TEXT_BONE5, TEXT_VILE9 }, { TEXT_INFRA3, -1, -1, -1, TEXT_VEIL3, -1, TEXT_BUTCH3, TEXT_BANNER4, TEXT_BLIND3, TEXT_BLOOD3, TEXT_ANVIL3, TEXT_WARLRD3, TEXT_KING5, TEXT_POISON4, TEXT_BONE3, TEXT_VILE7 }, diff --git a/enums.h b/enums.h index b0607fa0d..7b9a5e116 100644 --- a/enums.h +++ b/enums.h @@ -2546,23 +2546,23 @@ typedef enum _setlevels { } _setlevels; typedef enum quest_id { - Q_ROCK = 0x0, - Q_MUSHROOM = 0x1, - Q_GARBUD = 0x2, - Q_ZHAR = 0x3, - Q_VEIL = 0x4, - Q_DIABLO = 0x5, - Q_BUTCHER = 0x6, - Q_LTBANNER = 0x7, - Q_BLIND = 0x8, - Q_BLOOD = 0x9, - Q_ANVIL = 0xA, - Q_WARLORD = 0xB, - Q_SKELKING = 0xC, - Q_PWATER = 0xD, - Q_SCHAMB = 0xE, - Q_BETRAYER = 0xF, - Q_INVALID = -1, + Q_ROCK = 0x0, + Q_MUSHROOM = 0x1, + Q_GARBUD = 0x2, + Q_ZHAR = 0x3, + Q_VEIL = 0x4, + Q_DIABLO = 0x5, + Q_BUTCHER = 0x6, + Q_LTBANNER = 0x7, + Q_BLIND = 0x8, + Q_BLOOD = 0x9, + Q_ANVIL = 0xA, + Q_WARLORD = 0xB, + Q_SKELKING = 0xC, + Q_PWATER = 0xD, + Q_SCHAMB = 0xE, + Q_BETRAYER = 0xF, + Q_INVALID = -1, } quest_id; typedef enum quest_state { @@ -2712,9 +2712,9 @@ typedef enum plr_class { } plr_class; typedef enum _ui_classes { - UI_WARRIOR = 0x0, - UI_ROGUE = 0x1, - UI_SORCERER = 0x2, + UI_WARRIOR = 0x0, + UI_ROGUE = 0x1, + UI_SORCERER = 0x2, UI_NUM_CLASSES, } _ui_classes; diff --git a/resource.h b/resource.h index 962c28389..faa3d232c 100644 --- a/resource.h +++ b/resource.h @@ -5,18 +5,18 @@ * Used by Diablo.rc */ -#define IDI_ICON1 101 -#define IDD_DIALOG1 104 // DX -#define IDD_DIALOG2 105 // NOMEMORY -#define IDD_DIALOG3 106 // NOFILE -#define IDD_DIALOG4 107 // DDRAW -#define IDD_DIALOG5 108 // DSOUND -#define IDD_DIALOG6 109 // PENTIUM (deprecated in 1.00) -#define IDD_DIALOG7 110 // DISKSPACE -#define IDD_DIALOG8 111 // VIDEOMODE -#define IDD_DIALOG9 112 // INSERTCD -#define IDD_DIALOG10 113 // RESTRICTED -#define IDD_DIALOG11 114 // READONLY +#define IDI_ICON1 101 +#define IDD_DIALOG1 104 // DX +#define IDD_DIALOG2 105 // NOMEMORY +#define IDD_DIALOG3 106 // NOFILE +#define IDD_DIALOG4 107 // DDRAW +#define IDD_DIALOG5 108 // DSOUND +#define IDD_DIALOG6 109 // PENTIUM (deprecated in 1.00) +#define IDD_DIALOG7 110 // DISKSPACE +#define IDD_DIALOG8 111 // VIDEOMODE +#define IDD_DIALOG9 112 // INSERTCD +#define IDD_DIALOG10 113 // RESTRICTED +#define IDD_DIALOG11 114 // READONLY // Next default values for new objects // From 9e2cefa52299269e41333095d074e801645b1ae8 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Thu, 9 Apr 2020 00:13:15 +0200 Subject: [PATCH 18/33] Fix InitHash --- Source/encrypt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/encrypt.cpp b/Source/encrypt.cpp index 368b291f0..f19fde8f0 100644 --- a/Source/encrypt.cpp +++ b/Source/encrypt.cpp @@ -65,7 +65,7 @@ void InitHash() seed = (125 * seed + 3) % 0x2AAAAB; ch = (seed & 0xFFFF); seed = (125 * seed + 3) % 0x2AAAAB; - hashtable[i][j] = ch << 16 | (seed & 0xFFFF); + hashtable[j][i] = ch << 16 | (seed & 0xFFFF); } } } From 346c0949e74eaf6a2d73a32e8d11f7d1180a768c Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Thu, 9 Apr 2020 02:06:42 +0200 Subject: [PATCH 19/33] Correct seed tables --- Source/diablo.cpp | 10 +++++----- Source/diablo.h | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index a059eb0ba..e230ca9a1 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -8,19 +8,19 @@ #include "../DiabloUI/diabloui.h" HWND ghMainWnd; -int glMid1Seed[NUMLEVELS + 1]; -int glMid2Seed[NUMLEVELS + 1]; +DWORD glSeedTbl[NUMLEVELS]; int gnLevelTypeTbl[NUMLEVELS]; +int glEndSeed[NUMLEVELS]; +int glMid1Seed[NUMLEVELS]; +int glMid2Seed[NUMLEVELS]; +int glMid3Seed[NUMLEVELS]; int MouseX; int MouseY; BOOL gbGameLoopStartup; -DWORD glSeedTbl[NUMLEVELS]; BOOL gbRunGame; -int glMid3Seed[NUMLEVELS + 1]; BOOL gbRunGameResult; BOOL zoomflag; BOOL gbProcessPlayers; -int glEndSeed[NUMLEVELS + 1]; BOOL gbLoadGame; HINSTANCE ghInst; int DebugMonsters[10]; diff --git a/Source/diablo.h b/Source/diablo.h index 0fa2d3467..2d0d9d294 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -7,19 +7,19 @@ #define __DIABLO_H__ extern HWND ghMainWnd; -extern int glMid1Seed[NUMLEVELS + 1]; -extern int glMid2Seed[NUMLEVELS + 1]; +extern DWORD glSeedTbl[NUMLEVELS]; extern int gnLevelTypeTbl[NUMLEVELS]; +extern int glEndSeed[NUMLEVELS]; +extern int glMid1Seed[NUMLEVELS]; +extern int glMid2Seed[NUMLEVELS]; +extern int glMid3Seed[NUMLEVELS]; extern int MouseX; extern int MouseY; extern BOOL gbGameLoopStartup; -extern DWORD glSeedTbl[NUMLEVELS]; extern BOOL gbRunGame; -extern int glMid3Seed[NUMLEVELS + 1]; extern BOOL gbRunGameResult; extern BOOL zoomflag; extern BOOL gbProcessPlayers; -extern int glEndSeed[NUMLEVELS + 1]; extern BOOL gbLoadGame; extern HINSTANCE ghInst; extern int DebugMonsters[10]; From 295dc35429d6a108fd1a1026557d636e3b06f504 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 10 Apr 2020 23:08:23 +0200 Subject: [PATCH 20/33] Renable delete operator This aligns the first instructions, now that we only target C++ it's we can safly enable it. Should be moved to storm.h. --- Source/appfat.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/appfat.cpp b/Source/appfat.cpp index 64a14846a..3a718c08b 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -13,12 +13,12 @@ BOOL terminating; int cleanup_thread_id; // delete overloads the delete operator. -//void operator delete(void *ptr) -//{ -// if (ptr != NULL) { -// SMemFree(ptr, "delete", -1, 0); -// } -//} +void __cdecl operator delete(void *ptr) +{ + if (ptr != NULL) { + SMemFree(ptr, "delete", -1, 0); + } +} void TriggerBreak() { From 67d659448e102370c41122862f1c0179fd56872c Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 10 Apr 2020 23:09:03 +0200 Subject: [PATCH 21/33] Correct build options Disable minimal rebuild. Target Pentium --- MakefileVC | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MakefileVC b/MakefileVC index 0c768814a..24c0cdc5c 100644 --- a/MakefileVC +++ b/MakefileVC @@ -37,7 +37,7 @@ else VC6_LINK = wine $(VC6_BIN_DIR)/link.exe endif -CFLAGS=/nologo /c /GX /W3 /O1 /I $(VC6_INC_DIR) /FD /Gr /MT /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fp"Diablo.pch" /YX /Gm /Zi /FAs +CFLAGS=/nologo /c /GX /W3 /O1 /I $(VC6_INC_DIR) /FD /Gr /MT /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /Fp"Diablo.pch" /YX /G5 /Zi /FAs LINKFLAGS=/nologo /subsystem:windows /machine:I386 /incremental:no ifeq ($(SPAWN),1) From f4c181dd7099fddef4cf2d76b5d5517b130eb2ad Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 10 Apr 2020 23:11:06 +0200 Subject: [PATCH 22/33] Correct size of app_fatal The call to ExitProcess(1) can be seen in the original ASM, but still isen't emitted by the compiler for our code :/ --- Source/appfat.cpp | 1 + comparer-config/diablo.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/appfat.cpp b/Source/appfat.cpp index 3a718c08b..c319e04d2 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -484,6 +484,7 @@ void __cdecl app_fatal(const char *pszFmt, ...) init_cleanup(FALSE); exit(1); + ExitProcess(1); } void MsgBox(const char *pszFmt, va_list va) diff --git a/comparer-config/diablo.toml b/comparer-config/diablo.toml index d021375de..e94444af4 100644 --- a/comparer-config/diablo.toml +++ b/comparer-config/diablo.toml @@ -30,7 +30,7 @@ size = 0xD [[func]] name = "app_fatal" addr = 0x401947 -size = 0x24 +size = 0x2E [[func]] name = "MsgBox" From af7db10bacf05800d7619b8937d1453f048b4851 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Fri, 10 Apr 2020 23:18:20 +0200 Subject: [PATCH 23/33] Correct switch order for TraceErrorDD This fixes the jump table at the end of the function https://github.com/galaxyhaxz/devastation/blob/master/FIXES/appfat.cpp --- Source/appfat.cpp | 374 +++++++++++++++++++++++----------------------- 1 file changed, 187 insertions(+), 187 deletions(-) diff --git a/Source/appfat.cpp b/Source/appfat.cpp index c319e04d2..90ad6f0ae 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -96,188 +96,161 @@ void TraceErrorDD(HRESULT hError, char *pszBuffer, DWORD dwMaxChars) const char *szError; switch (hError) { - case DDERR_CANTPAGEUNLOCK: - szError = "DDERR_CANTPAGEUNLOCK"; - break; - case DDERR_NOTPAGELOCKED: - szError = "DDERR_NOTPAGELOCKED"; - break; case DD_OK: szError = "DD_OK"; break; - case DDERR_CANTPAGELOCK: - szError = "DDERR_CANTPAGELOCK"; + case DDERR_ALREADYINITIALIZED: + szError = "DDERR_ALREADYINITIALIZED"; break; case DDERR_BLTFASTCANTCLIP: szError = "DDERR_BLTFASTCANTCLIP"; break; - case DDERR_NOBLTHW: - szError = "DDERR_NOBLTHW"; - break; - case DDERR_NODDROPSHW: - szError = "DDERR_NODDROPSHW"; - break; - case DDERR_OVERLAYNOTVISIBLE: - szError = "DDERR_OVERLAYNOTVISIBLE"; - break; - case DDERR_NOOVERLAYDEST: - szError = "DDERR_NOOVERLAYDEST"; - break; - case DDERR_INVALIDPOSITION: - szError = "DDERR_INVALIDPOSITION"; - break; - case DDERR_NOTAOVERLAYSURFACE: - szError = "DDERR_NOTAOVERLAYSURFACE"; + case DDERR_CANNOTATTACHSURFACE: + szError = "DDERR_CANNOTATTACHSURFACE"; break; - case DDERR_EXCLUSIVEMODEALREADYSET: - szError = "DDERR_EXCLUSIVEMODEALREADYSET"; + case DDERR_CANNOTDETACHSURFACE: + szError = "DDERR_CANNOTDETACHSURFACE"; break; - case DDERR_NOTFLIPPABLE: - szError = "DDERR_NOTFLIPPABLE"; + case DDERR_CANTCREATEDC: + szError = "DDERR_CANTCREATEDC"; break; case DDERR_CANTDUPLICATE: szError = "DDERR_CANTDUPLICATE"; break; - case DDERR_NOTLOCKED: - szError = "DDERR_NOTLOCKED"; - break; - case DDERR_CANTCREATEDC: - szError = "DDERR_CANTCREATEDC"; - break; - case DDERR_NODC: - szError = "DDERR_NODC"; + case DDERR_CLIPPERISUSINGHWND: + szError = "DDERR_CLIPPERISUSINGHWND"; break; - case DDERR_WRONGMODE: - szError = "DDERR_WRONGMODE"; + case DDERR_COLORKEYNOTSET: + szError = "DDERR_COLORKEYNOTSET"; break; - case DDERR_IMPLICITLYCREATED: - szError = "DDERR_IMPLICITLYCREATED"; + case DDERR_CURRENTLYNOTAVAIL: + szError = "DDERR_CURRENTLYNOTAVAIL"; break; - case DDERR_NOTPALETTIZED: - szError = "DDERR_NOTPALETTIZED"; + case DDERR_DIRECTDRAWALREADYCREATED: + szError = "DDERR_DIRECTDRAWALREADYCREATED"; break; - case DDERR_NOMIPMAPHW: - szError = "DDERR_NOMIPMAPHW"; + case DDERR_EXCEPTION: + szError = "DDERR_EXCEPTION"; break; - case DDERR_INVALIDSURFACETYPE: - szError = "DDERR_INVALIDSURFACETYPE"; + case DDERR_EXCLUSIVEMODEALREADYSET: + szError = "DDERR_EXCLUSIVEMODEALREADYSET"; break; - case DDERR_DCALREADYCREATED: - szError = "DDERR_DCALREADYCREATED"; + case DDERR_GENERIC: + szError = "DDERR_GENERIC"; break; - case DDERR_NOPALETTEHW: - szError = "DDERR_NOPALETTEHW"; + case DDERR_HEIGHTALIGN: + szError = "DDERR_HEIGHTALIGN"; break; - case DDERR_DIRECTDRAWALREADYCREATED: - szError = "DDERR_DIRECTDRAWALREADYCREATED"; + case DDERR_HWNDALREADYSET: + szError = "DDERR_HWNDALREADYSET"; break; - case DDERR_NODIRECTDRAWHW: - szError = "DDERR_NODIRECTDRAWHW"; + case DDERR_HWNDSUBCLASSED: + szError = "DDERR_HWNDSUBCLASSED"; break; - case DDERR_PRIMARYSURFACEALREADYEXISTS: - szError = "DDERR_PRIMARYSURFACEALREADYEXISTS"; + case DDERR_IMPLICITLYCREATED: + szError = "DDERR_IMPLICITLYCREATED"; break; - case DDERR_NOEMULATION: - szError = "DDERR_NOEMULATION"; + case DDERR_INCOMPATIBLEPRIMARY: + szError = "DDERR_INCOMPATIBLEPRIMARY"; break; - case DDERR_REGIONTOOSMALL: - szError = "DDERR_REGIONTOOSMALL"; + case DDERR_INVALIDCAPS: + szError = "DDERR_INVALIDCAPS"; break; - case DDERR_CLIPPERISUSINGHWND: - szError = "DDERR_CLIPPERISUSINGHWND"; + case DDERR_INVALIDCLIPLIST: + szError = "DDERR_INVALIDCLIPLIST"; break; - case DDERR_NOCLIPPERATTACHED: - szError = "DDERR_NOCLIPPERATTACHED"; + case DDERR_INVALIDDIRECTDRAWGUID: + szError = "DDERR_INVALIDDIRECTDRAWGUID"; break; - case DDERR_NOHWND: - szError = "DDERR_NOHWND"; + case DDERR_INVALIDMODE: + szError = "DDERR_INVALIDMODE"; break; - case DDERR_HWNDSUBCLASSED: - szError = "DDERR_HWNDSUBCLASSED"; + case DDERR_INVALIDOBJECT: + szError = "DDERR_INVALIDOBJECT"; break; - case DDERR_HWNDALREADYSET: - szError = "DDERR_HWNDALREADYSET"; + case DDERR_INVALIDPARAMS: + szError = "DDERR_INVALIDPARAMS"; break; - case DDERR_NOPALETTEATTACHED: - szError = "DDERR_NOPALETTEATTACHED"; + case DDERR_INVALIDPIXELFORMAT: + szError = "DDERR_INVALIDPIXELFORMAT"; break; - case DDERR_INVALIDDIRECTDRAWGUID: - szError = "DDERR_INVALIDDIRECTDRAWGUID"; + case DDERR_INVALIDPOSITION: + szError = "DDERR_INVALIDPOSITION"; break; - case DDERR_UNSUPPORTEDFORMAT: - szError = "DDERR_UNSUPPORTEDFORMAT"; + case DDERR_INVALIDRECT: + szError = "DDERR_INVALIDRECT"; break; - case DDERR_UNSUPPORTEDMASK: - szError = "DDERR_UNSUPPORTEDMASK"; + case DDERR_LOCKEDSURFACES: + szError = "DDERR_LOCKEDSURFACES"; break; - case DDERR_VERTICALBLANKINPROGRESS: - szError = "DDERR_VERTICALBLANKINPROGRESS"; + case DDERR_NO3D: + szError = "DDERR_NO3D"; break; - case DDERR_WASSTILLDRAWING: - szError = "DDERR_WASSTILLDRAWING"; + case DDERR_NOALPHAHW: + szError = "DDERR_NOALPHAHW"; break; - case DDERR_XALIGN: - szError = "DDERR_XALIGN"; + case DDERR_NOBLTHW: + szError = "DDERR_NOBLTHW"; break; - case DDERR_TOOBIGWIDTH: - szError = "DDERR_TOOBIGWIDTH"; + case DDERR_NOCLIPLIST: + szError = "DDERR_NOCLIPLIST"; break; - case DDERR_CANTLOCKSURFACE: - szError = "DDERR_CANTLOCKSURFACE"; + case DDERR_NOCLIPPERATTACHED: + szError = "DDERR_NOCLIPPERATTACHED"; break; - case DDERR_SURFACEISOBSCURED: - szError = "DDERR_SURFACEISOBSCURED"; + case DDERR_NOCOLORCONVHW: + szError = "DDERR_NOCOLORCONVHW"; break; - case DDERR_SURFACELOST: - szError = "DDERR_SURFACELOST"; + case DDERR_NOCOLORKEY: + szError = "DDERR_NOCOLORKEY"; break; - case DDERR_SURFACENOTATTACHED: - szError = "DDERR_SURFACENOTATTACHED"; + case DDERR_NOCOLORKEYHW: + szError = "DDERR_NOCOLORKEYHW"; break; - case DDERR_TOOBIGHEIGHT: - szError = "DDERR_TOOBIGHEIGHT"; + case DDERR_NOCOOPERATIVELEVELSET: + szError = "DDERR_NOCOOPERATIVELEVELSET"; break; - case DDERR_TOOBIGSIZE: - szError = "DDERR_TOOBIGSIZE"; + case DDERR_NODC: + szError = "DDERR_NODC"; break; - case DDERR_SURFACEBUSY: - szError = "DDERR_SURFACEBUSY"; + case DDERR_NODDROPSHW: + szError = "DDERR_NODDROPSHW"; break; - case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: - szError = "DDERR_OVERLAYCOLORKEYONLYONEACTIVE"; + case DDERR_NODIRECTDRAWHW: + szError = "DDERR_NODIRECTDRAWHW"; break; - case DDERR_PALETTEBUSY: - szError = "DDERR_PALETTEBUSY"; + case DDERR_NOEMULATION: + szError = "DDERR_NOEMULATION"; break; - case DDERR_COLORKEYNOTSET: - szError = "DDERR_COLORKEYNOTSET"; + case DDERR_NOEXCLUSIVEMODE: + szError = "DDERR_NOEXCLUSIVEMODE"; break; - case DDERR_SURFACEALREADYATTACHED: - szError = "DDERR_SURFACEALREADYATTACHED"; + case DDERR_NOFLIPHW: + szError = "DDERR_NOFLIPHW"; break; - case DDERR_SURFACEALREADYDEPENDENT: - szError = "DDERR_SURFACEALREADYDEPENDENT"; + case DDERR_NOGDI: + szError = "DDERR_NOGDI"; break; - case DDERR_OVERLAYCANTCLIP: - szError = "DDERR_OVERLAYCANTCLIP"; + case DDERR_NOHWND: + szError = "DDERR_NOHWND"; break; - case DDERR_NOVSYNCHW: - szError = "DDERR_NOVSYNCHW"; + case DDERR_NOMIRRORHW: + szError = "DDERR_NOMIRRORHW"; break; - case DDERR_NOZBUFFERHW: - szError = "DDERR_NOZBUFFERHW"; + case DDERR_NOOVERLAYDEST: + szError = "DDERR_NOOVERLAYDEST"; break; - case DDERR_NOZOVERLAYHW: - szError = "DDERR_NOZOVERLAYHW"; + case DDERR_NOOVERLAYHW: + szError = "DDERR_NOOVERLAYHW"; break; - case DDERR_OUTOFCAPS: - szError = "DDERR_OUTOFCAPS"; + case DDERR_NOPALETTEATTACHED: + szError = "DDERR_NOPALETTEATTACHED"; break; - case DDERR_OUTOFVIDEOMEMORY: - szError = "DDERR_OUTOFVIDEOMEMORY"; + case DDERR_NOPALETTEHW: + szError = "DDERR_NOPALETTEHW"; break; - case DDERR_NOTEXTUREHW: - szError = "DDERR_NOTEXTUREHW"; + case DDERR_NORASTEROPHW: + szError = "DDERR_NORASTEROPHW"; break; case DDERR_NOROTATIONHW: szError = "DDERR_NOROTATIONHW"; @@ -294,101 +267,128 @@ void TraceErrorDD(HRESULT hError, char *pszBuffer, DWORD dwMaxChars) case DDERR_NOT8BITCOLOR: szError = "DDERR_NOT8BITCOLOR"; break; - case DDERR_NORASTEROPHW: - szError = "DDERR_NORASTEROPHW"; - break; - case DDERR_NOEXCLUSIVEMODE: - szError = "DDERR_NOEXCLUSIVEMODE"; - break; - case DDERR_NOFLIPHW: - szError = "DDERR_NOFLIPHW"; + case DDERR_NOTAOVERLAYSURFACE: + szError = "DDERR_NOTAOVERLAYSURFACE"; break; - case DDERR_NOGDI: - szError = "DDERR_NOGDI"; + case DDERR_NOTEXTUREHW: + szError = "DDERR_NOTEXTUREHW"; break; - case DDERR_NOMIRRORHW: - szError = "DDERR_NOMIRRORHW"; + case DDERR_NOTFLIPPABLE: + szError = "DDERR_NOTFLIPPABLE"; break; case DDERR_NOTFOUND: szError = "DDERR_NOTFOUND"; break; - case DDERR_NOOVERLAYHW: - szError = "DDERR_NOOVERLAYHW"; + case DDERR_NOTLOCKED: + szError = "DDERR_NOTLOCKED"; break; - case DDERR_NOCOLORKEYHW: - szError = "DDERR_NOCOLORKEYHW"; + case DDERR_NOTPALETTIZED: + szError = "DDERR_NOTPALETTIZED"; break; - case DDERR_NOALPHAHW: - szError = "DDERR_NOALPHAHW"; + case DDERR_NOVSYNCHW: + szError = "DDERR_NOVSYNCHW"; break; - case DDERR_NOCLIPLIST: - szError = "DDERR_NOCLIPLIST"; + case DDERR_NOZBUFFERHW: + szError = "DDERR_NOZBUFFERHW"; break; - case DDERR_NOCOLORCONVHW: - szError = "DDERR_NOCOLORCONVHW"; + case DDERR_NOZOVERLAYHW: + szError = "DDERR_NOZOVERLAYHW"; break; - case DDERR_NOCOOPERATIVELEVELSET: - szError = "DDERR_NOCOOPERATIVELEVELSET"; + case DDERR_OUTOFCAPS: + szError = "DDERR_OUTOFCAPS"; break; - case DDERR_NOCOLORKEY: - szError = "DDERR_NOCOLORKEY"; + case DDERR_OUTOFMEMORY: + szError = "DDERR_OUTOFMEMORY"; break; - case DDERR_NO3D: - szError = "DDERR_NO3D"; + case DDERR_OUTOFVIDEOMEMORY: + szError = "DDERR_OUTOFVIDEOMEMORY"; break; - case DDERR_INVALIDMODE: - szError = "DDERR_INVALIDMODE"; + case DDERR_OVERLAYCANTCLIP: + szError = "DDERR_OVERLAYCANTCLIP"; break; - case DDERR_INVALIDOBJECT: - szError = "DDERR_INVALIDOBJECT"; + case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: + szError = "DDERR_OVERLAYCOLORKEYONLYONEACTIVE"; break; - case DDERR_INVALIDPIXELFORMAT: - szError = "DDERR_INVALIDPIXELFORMAT"; + case DDERR_OVERLAYNOTVISIBLE: + szError = "DDERR_OVERLAYNOTVISIBLE"; break; - case DDERR_INVALIDRECT: - szError = "DDERR_INVALIDRECT"; + case DDERR_PALETTEBUSY: + szError = "DDERR_PALETTEBUSY"; break; - case DDERR_LOCKEDSURFACES: - szError = "DDERR_LOCKEDSURFACES"; + case DDERR_PRIMARYSURFACEALREADYEXISTS: + szError = "DDERR_PRIMARYSURFACEALREADYEXISTS"; break; - case DDERR_INVALIDCLIPLIST: - szError = "DDERR_INVALIDCLIPLIST"; + case DDERR_REGIONTOOSMALL: + szError = "DDERR_REGIONTOOSMALL"; break; - case DDERR_CURRENTLYNOTAVAIL: - szError = "DDERR_CURRENTLYNOTAVAIL"; + case DDERR_SURFACEALREADYATTACHED: + szError = "DDERR_SURFACEALREADYATTACHED"; break; - case DDERR_EXCEPTION: - szError = "DDERR_EXCEPTION"; + case DDERR_SURFACEALREADYDEPENDENT: + szError = "DDERR_SURFACEALREADYDEPENDENT"; break; - case DDERR_HEIGHTALIGN: - szError = "DDERR_HEIGHTALIGN"; + case DDERR_SURFACEBUSY: + szError = "DDERR_SURFACEBUSY"; break; - case DDERR_INCOMPATIBLEPRIMARY: - szError = "DDERR_INCOMPATIBLEPRIMARY"; + case DDERR_SURFACEISOBSCURED: + szError = "DDERR_SURFACEISOBSCURED"; break; - case DDERR_INVALIDCAPS: - szError = "DDERR_INVALIDCAPS"; + case DDERR_SURFACELOST: + szError = "DDERR_SURFACELOST"; break; - case DDERR_CANNOTDETACHSURFACE: - szError = "DDERR_CANNOTDETACHSURFACE"; + case DDERR_SURFACENOTATTACHED: + szError = "DDERR_SURFACENOTATTACHED"; + break; + case DDERR_TOOBIGHEIGHT: + szError = "DDERR_TOOBIGHEIGHT"; + break; + case DDERR_TOOBIGSIZE: + szError = "DDERR_TOOBIGSIZE"; + break; + case DDERR_TOOBIGWIDTH: + szError = "DDERR_TOOBIGWIDTH"; break; case DDERR_UNSUPPORTED: szError = "DDERR_UNSUPPORTED"; break; - case DDERR_GENERIC: - szError = "DDERR_GENERIC"; + case DDERR_UNSUPPORTEDFORMAT: + szError = "DDERR_UNSUPPORTEDFORMAT"; break; - case DDERR_OUTOFMEMORY: - szError = "DDERR_OUTOFMEMORY"; + case DDERR_UNSUPPORTEDMASK: + szError = "DDERR_UNSUPPORTEDMASK"; break; - case DDERR_INVALIDPARAMS: - szError = "DDERR_INVALIDPARAMS"; + case DDERR_VERTICALBLANKINPROGRESS: + szError = "DDERR_VERTICALBLANKINPROGRESS"; break; - case DDERR_ALREADYINITIALIZED: - szError = "DDERR_ALREADYINITIALIZED"; + case DDERR_WASSTILLDRAWING: + szError = "DDERR_WASSTILLDRAWING"; break; - case DDERR_CANNOTATTACHSURFACE: - szError = "DDERR_CANNOTATTACHSURFACE"; + case DDERR_WRONGMODE: + szError = "DDERR_WRONGMODE"; + break; + case DDERR_XALIGN: + szError = "DDERR_XALIGN"; + break; + case DDERR_CANTLOCKSURFACE: + szError = "DDERR_CANTLOCKSURFACE"; + break; + case DDERR_CANTPAGELOCK: + szError = "DDERR_CANTPAGELOCK"; + break; + case DDERR_CANTPAGEUNLOCK: + szError = "DDERR_CANTPAGEUNLOCK"; + break; + case DDERR_DCALREADYCREATED: + szError = "DDERR_DCALREADYCREATED"; + break; + case DDERR_INVALIDSURFACETYPE: + szError = "DDERR_INVALIDSURFACETYPE"; + break; + case DDERR_NOMIPMAPHW: + szError = "DDERR_NOMIPMAPHW"; + break; + case DDERR_NOTPAGELOCKED: + szError = "DDERR_NOTPAGELOCKED"; break; default: { const char szUnknown[] = "DDERR unknown 0x%x"; From d008af43b05b101d60b31d08cd41e3bf9ef9d391 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 11 Apr 2020 14:33:44 +0200 Subject: [PATCH 24/33] Semantic code style cleanups --- Source/help.cpp | 2 +- Source/init.cpp | 18 +++++++-------- Source/inv.cpp | 24 ++++++++++---------- Source/items.cpp | 53 +++++++++++++++++++++------------------------ Source/lighting.cpp | 28 ++++++++++++------------ Source/loadsave.cpp | 4 ++-- Source/movie.cpp | 2 +- Source/scrollrt.cpp | 2 +- Source/setmaps.cpp | 16 +++++++------- Source/themes.cpp | 2 +- 10 files changed, 74 insertions(+), 77 deletions(-) diff --git a/Source/help.cpp b/Source/help.cpp index 60f5ca4ec..84dc9a2b2 100644 --- a/Source/help.cpp +++ b/Source/help.cpp @@ -458,7 +458,7 @@ void DrawHelp() PrintSString(0, 2, TRUE, "Diablo Help", COL_GOLD, 0); DrawSLine(5); - s = gszHelpText; + s = &gszHelpText[0]; for (i = 0; i < help_select_line; i++) { c = 0; diff --git a/Source/init.cpp b/Source/init.cpp index 338374fbb..610052766 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -27,7 +27,7 @@ char gszProductName[MAX_PATH] = "Diablo v1.09"; void init_cleanup(BOOL show_cursor) { pfile_flush_W(); - init_disable_screensaver(0); + init_disable_screensaver(FALSE); init_run_office_from_start_menu(); if (diabdat_mpq) { @@ -130,7 +130,7 @@ void init_disable_screensaver(BOOLEAN disable) if (disable) { cbData = 16; - success = RegQueryValueEx(phkResult, "ScreenSaveActive", 0, &Type, (LPBYTE)Data, &cbData); + success = RegQueryValueEx(phkResult, "ScreenSaveActive", NULL, &Type, (LPBYTE)Data, &cbData); if (success == ERROR_SUCCESS) screensaver_enabled_prev = Data[0] != '0'; enabled = FALSE; @@ -138,9 +138,9 @@ void init_disable_screensaver(BOOLEAN disable) enabled = screensaver_enabled_prev; } - Data[1] = 0; Data[0] = enabled ? '1' : '0'; - RegSetValueEx(phkResult, "ScreenSaveActive", 0, REG_SZ, (const BYTE *)Data, 2); + Data[1] = 0; + RegSetValueEx(phkResult, "ScreenSaveActive", NULL, REG_SZ, (const BYTE *)Data, 2); RegCloseKey(phkResult); } @@ -158,7 +158,7 @@ void init_create_window(int nCmdShow) wcex.lpfnWndProc = WindowProc; wcex.hInstance = ghInst; wcex.hIcon = LoadIcon(ghInst, MAKEINTRESOURCE(IDI_ICON1)); - wcex.hCursor = LoadCursor(0, IDC_ARROW); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wcex.lpszMenuName = GAME_NAME; wcex.lpszClassName = "DIABLO"; @@ -183,7 +183,7 @@ void init_create_window(int nCmdShow) BlackPalette(); snd_init(hWnd); init_archives(); - init_disable_screensaver(1); + init_disable_screensaver(TRUE); } void init_kill_mom_parent() @@ -191,7 +191,7 @@ void init_kill_mom_parent() HWND handle; handle = init_find_mom_parent(); - if (handle) { + if (handle != NULL) { PostMessage(handle, WM_CLOSE, 0, 0); killed_mom_parent = TRUE; } @@ -223,7 +223,7 @@ void init_await_mom_parent_exit() } do { Sleep(250); - } while (GetTickCount() - tick <= 4000 && init_find_mom_parent()); + } while (GetTickCount() - tick <= 4000 && init_find_mom_parent() != NULL); } void init_archives() @@ -406,7 +406,7 @@ LRESULT __stdcall MainWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) break; case WM_DESTROY: init_cleanup(TRUE); - ghMainWnd = 0; + ghMainWnd = NULL; PostQuitMessage(0); break; case WM_PAINT: diff --git a/Source/inv.cpp b/Source/inv.cpp index 1304a07a7..1cb54a7c7 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -26,7 +26,7 @@ int sgdwLastTime; // check name * 65 66 67 68 69 70 71 72 * @see graphics/inv/inventory.png */ -const InvXY InvRect[73] = { +const InvXY InvRect[] = { // clang-format off // X, Y { RIGHT_PANEL + 132, 31 }, // helmet @@ -321,14 +321,14 @@ void DrawInv() if (plr[myplr].InvBody[INVLOC_HAND_LEFT]._iLoc == ILOC_TWOHAND) { InvDrawSlotBack(RIGHT_PANEL_X + 247, 160 + SCREEN_Y, 2 * INV_SLOT_SIZE_PX, 3 * INV_SLOT_SIZE_PX); light_table_index = 0; - cel_transparency_active = 1; + cel_transparency_active = TRUE; pBuff = frame_width == INV_SLOT_SIZE_PX ? &gpBuffer[SCREENXY(RIGHT_PANEL_X + 197, SCREEN_Y)] : &gpBuffer[SCREENXY(RIGHT_PANEL_X + 183, SCREEN_Y)]; CelClippedBlitLightTrans(pBuff, pCursCels, frame, frame_width, 0, 8); - cel_transparency_active = 0; + cel_transparency_active = FALSE; } } if (plr[myplr].InvBody[INVLOC_HAND_RIGHT]._itype != ITYPE_NONE) { @@ -1233,7 +1233,7 @@ void CheckInvCut(int pnum, int mx, int my) if (r >= SLOTXY_INV_FIRST && r <= SLOTXY_INV_LAST) { ig = r - SLOTXY_INV_FIRST; ii = plr[pnum].InvGrid[ig]; - if (ii) { + if (ii != 0) { iv = ii; if (ii <= 0) { iv = -ii; @@ -1408,7 +1408,7 @@ void CheckBookLevel(int pnum) if (plr[pnum].HoldItem._iMiscId == IMISC_BOOK) { plr[pnum].HoldItem._iMinMag = spelldata[plr[pnum].HoldItem._iSpell].sMinInt; slvl = plr[pnum]._pSplLvl[plr[pnum].HoldItem._iSpell]; - while (slvl) { + while (slvl != 0) { plr[pnum].HoldItem._iMinMag += 20 * plr[pnum].HoldItem._iMinMag / 100; slvl--; if (plr[pnum].HoldItem._iMinMag + 20 * plr[pnum].HoldItem._iMinMag / 100 > 255) { @@ -1442,7 +1442,7 @@ void CheckQuestItem(int pnum) quests[Q_ANVIL]._qvar1 = 1; } #ifndef SPAWN - if (quests[Q_ANVIL]._qlog == 1) { + if (quests[Q_ANVIL]._qlog == TRUE) { sfxdelay = 10; if (plr[myplr]._pClass == PC_WARRIOR) { sfxdnum = PS_WARR89; @@ -1472,7 +1472,7 @@ void CheckQuestItem(int pnum) quests[Q_ROCK]._qvar1 = 1; } #ifndef SPAWN - if (quests[Q_ROCK]._qlog == 1) { + if (quests[Q_ROCK]._qlog == TRUE) { sfxdelay = 10; if (plr[myplr]._pClass == PC_WARRIOR) { sfxdnum = PS_WARR87; @@ -1508,7 +1508,7 @@ void InvGetItem(int pnum, int ii) dropGoldValue = 0; } - if (dItem[item[ii]._ix][item[ii]._iy]) { + if (dItem[item[ii]._ix][item[ii]._iy] != 0) { if (myplr == pnum && pcurs >= CURSOR_FIRSTITEM) NetSendCmdPItem(TRUE, CMD_SYNCPUTITEM, plr[myplr]._px, plr[myplr]._py); item[ii]._iCreateInfo &= ~0x8000; @@ -1731,7 +1731,7 @@ BOOL CanPut(int x, int y) if (nSolidTable[dPiece[x][y]]) return FALSE; - if (dObject[x][y]) { + if (dObject[x][y] != 0) { if (object[dObject[x][y] > 0 ? dObject[x][y] - 1 : -1 - dObject[x][y]]._oSolidFlag) return FALSE; } @@ -1994,7 +1994,7 @@ char CheckInvHLight() pi = &p->InvBody[rv]; } else if (r >= 25 && r <= 64) { r = abs(p->InvGrid[r - 25]); - if (!r) + if (r == 0) return -1; ii = r - 1; rv = ii + 7; @@ -2131,7 +2131,7 @@ BOOL UseInvItem(int pnum, int cii) return TRUE; if (pcurs != CURSOR_HAND) return TRUE; - if (stextflag) + if (stextflag != STORE_NONE) return TRUE; if (cii <= INVITEM_HAND_RIGHT) return FALSE; @@ -2236,7 +2236,7 @@ void DoTelekinesis() NetSendCmdParam1(TRUE, CMD_OPOBJT, pcursobj); if (pcursitem != -1) NetSendCmdGItem(TRUE, CMD_REQUESTAGITEM, myplr, myplr, pcursitem); - if (pcursmonst != -1 && !M_Talker(pcursmonst) && !monster[pcursmonst].mtalkmsg) + if (pcursmonst != -1 && !M_Talker(pcursmonst) && monster[pcursmonst].mtalkmsg == 0) NetSendCmdParam1(TRUE, CMD_KNOCKBACK, pcursmonst); SetCursor_(CURSOR_HAND); } diff --git a/Source/items.cpp b/Source/items.cpp index 557802247..fc4b0eba2 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -203,13 +203,13 @@ void InitItemGFX() BOOL ItemPlace(int xp, int yp) { - if (dMonster[xp][yp]) + if (dMonster[xp][yp] != 0) return FALSE; - if (dPlayer[xp][yp]) + if (dPlayer[xp][yp] != 0) return FALSE; - if (dItem[xp][yp]) + if (dItem[xp][yp] != 0) return FALSE; - if (dObject[xp][yp]) + if (dObject[xp][yp] != 0) return FALSE; if (dFlags[xp][yp] & BFLAG_POPULATED) return FALSE; @@ -469,19 +469,16 @@ void CalcPlrItemVals(int p, BOOL Loadgfx) lr = 0; } - if (mr > 75) { - mr = 75; - } + if (mr > MAXRESIST) + mr = MAXRESIST; plr[p]._pMagResist = mr; - if (fr > 75) { - fr = 75; - } + if (fr > MAXRESIST) + fr = MAXRESIST; plr[p]._pFireResist = fr; - if (lr > 75) { - lr = 75; - } + if (lr > MAXRESIST) + lr = MAXRESIST; plr[p]._pLghtResist = lr; if (plr[p]._pClass == PC_WARRIOR) { @@ -734,7 +731,7 @@ void CalcPlrBookVals(int p) { int i, slvl; - if (!currlevel) { + if (currlevel == 0) { for (i = 1; witchitem[i]._itype != ITYPE_NONE; i++) { WitchBookLevel(i); witchitem[i]._iStatFlag = StoreStatOk(&witchitem[i]); @@ -746,7 +743,7 @@ void CalcPlrBookVals(int p) plr[p].InvList[i]._iMinMag = spelldata[plr[p].InvList[i]._iSpell].sMinInt; slvl = plr[p]._pSplLvl[plr[p].InvList[i]._iSpell]; - while (slvl) { + while (slvl != 0) { plr[p].InvList[i]._iMinMag += 20 * plr[p].InvList[i]._iMinMag / 100; slvl--; if (plr[p].InvList[i]._iMinMag + 20 * plr[p].InvList[i]._iMinMag / 100 > 255) { @@ -769,7 +766,7 @@ void CalcPlrInv(int p, BOOL Loadgfx) CalcPlrBookVals(p); CalcPlrScrolls(p); CalcPlrStaff(p); - if (p == myplr && !currlevel) + if (p == myplr && currlevel == 0) RecalcStoreStats(); } } @@ -879,7 +876,7 @@ void CreatePlrItems(int p) plr[p]._pNumInv = 0; - pi = plr[p].SpdList; + pi = &plr[p].SpdList[0]; for (i = MAXBELTITEMS; i != 0; i--) { pi->_itype = ITYPE_NONE; pi++; @@ -967,16 +964,16 @@ BOOL ItemSpaceOk(int i, int j) if (i < 0 || i >= MAXDUNX || j < 0 || j >= MAXDUNY) return FALSE; - if (dMonster[i][j]) + if (dMonster[i][j] != 0) return FALSE; - if (dPlayer[i][j]) + if (dPlayer[i][j] != 0) return FALSE; - if (dItem[i][j]) + if (dItem[i][j] != 0) return FALSE; - if (dObject[i][j]) { + if (dObject[i][j] != 0) { oi = dObject[i][j] > 0 ? dObject[i][j] - 1 : -(dObject[i][j] + 1); if (object[oi]._oSolidFlag) return FALSE; @@ -1121,7 +1118,7 @@ void GetBookSpell(int i, int lvl) if (lvl > 5) lvl = 5; #endif - s = 1; + s = SPL_FIREBOLT; while (rv > 0) { if (spelldata[s].sBookLvl != -1 && lvl >= spelldata[s].sBookLvl) { rv--; @@ -1226,7 +1223,7 @@ void GetStaffSpell(int i, int lvl, BOOL onlygood) if (lvl > 10) lvl = 10; #endif - s = 1; + s = SPL_FIREBOLT; while (rv > 0) { if (spelldata[s].sStaffLvl != -1 && l >= spelldata[s].sStaffLvl) { rv--; @@ -1238,7 +1235,7 @@ void GetStaffSpell(int i, int lvl, BOOL onlygood) if (gbMaxPlayers == 1 && s == SPL_HEALOTHER) s = SPL_FLARE; if (s == MAX_SPELLS) - s = 1; + s = SPL_FIREBOLT; } sprintf(istr, "%s of %s", item[i]._iName, spelldata[bs].sNameText); if (!control_WriteStringToBuffer((BYTE *)istr)) @@ -1683,7 +1680,7 @@ void GetItemPower(int i, int minlvl, int maxlvl, int flgs, BOOL onlygood) goe = 0; if (!onlygood && random_(0, 3)) onlygood = TRUE; - if (!pre) { + if (pre == 0) { nt = 0; for (j = 0; PL_Prefix[j].PLPower != -1; j++) { if (flgs & PL_Prefix[j].PLIType) { @@ -1697,7 +1694,7 @@ void GetItemPower(int i, int minlvl, int maxlvl, int flgs, BOOL onlygood) } } } - if (nt) { + if (nl != 0) { preidx = l[random_(23, nt)]; sprintf(istr, "%s %s", PL_Prefix[preidx].PLName, item[i]._iIName); strcpy(item[i]._iIName, istr); @@ -1725,7 +1722,7 @@ void GetItemPower(int i, int minlvl, int maxlvl, int flgs, BOOL onlygood) nl++; } } - if (nl) { + if (nl != 0) { sufidx = l[random_(23, nl)]; sprintf(istr, "%s of %s", item[i]._iIName, PL_Suffix[sufidx].PLName); strcpy(item[i]._iIName, istr); @@ -1960,7 +1957,7 @@ int CheckUnique(int i, int lvl, int uper, BOOL recreate) } } - if (!numu) + if (numu == 0) return -1; random_(29, 10); /// BUGFIX: unused, last unique in array always gets chosen diff --git a/Source/lighting.cpp b/Source/lighting.cpp index 3895944d1..eb368fba5 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -994,7 +994,7 @@ void ToggleLighting() lightflag ^= TRUE; - if (lightflag) { + if (lightflag != 0) { memset(dLight, 0, sizeof(dLight)); } else { memcpy(dLight, dPreLight, sizeof(dLight)); @@ -1033,7 +1033,7 @@ int AddLight(int x, int y, int r) { int lid; - if (lightflag) { + if (lightflag != 0) { return -1; } @@ -1046,8 +1046,8 @@ int AddLight(int x, int y, int r) LightList[lid]._lradius = r; LightList[lid]._xoff = 0; LightList[lid]._yoff = 0; - LightList[lid]._ldel = 0; - LightList[lid]._lunflag = 0; + LightList[lid]._ldel = FALSE; + LightList[lid]._lunflag = FALSE; dolighting = TRUE; } @@ -1060,7 +1060,7 @@ void AddUnLight(int i) return; } - LightList[i]._ldel = 1; + LightList[i]._ldel = TRUE; dolighting = TRUE; } @@ -1070,7 +1070,7 @@ void ChangeLightRadius(int i, int r) return; } - LightList[i]._lunflag = 1; + LightList[i]._lunflag = TRUE; LightList[i]._lunx = LightList[i]._lx; LightList[i]._luny = LightList[i]._ly; LightList[i]._lunr = LightList[i]._lradius; @@ -1084,7 +1084,7 @@ void ChangeLightXY(int i, int x, int y) return; } - LightList[i]._lunflag = 1; + LightList[i]._lunflag = TRUE; LightList[i]._lunx = LightList[i]._lx; LightList[i]._luny = LightList[i]._ly; LightList[i]._lunr = LightList[i]._lradius; @@ -1099,7 +1099,7 @@ void ChangeLightOff(int i, int x, int y) return; } - LightList[i]._lunflag = 1; + LightList[i]._lunflag = TRUE; LightList[i]._lunx = LightList[i]._lx; LightList[i]._luny = LightList[i]._ly; LightList[i]._lunr = LightList[i]._lradius; @@ -1114,7 +1114,7 @@ void ChangeLight(int i, int x, int y, int r) return; } - LightList[i]._lunflag = 1; + LightList[i]._lunflag = TRUE; LightList[i]._lunx = LightList[i]._lx; LightList[i]._luny = LightList[i]._ly; LightList[i]._lunr = LightList[i]._lradius; @@ -1129,7 +1129,7 @@ void ProcessLightList() int i, j; BYTE temp; - if (lightflag) { + if (lightflag != 0) { return; } @@ -1141,7 +1141,7 @@ void ProcessLightList() } if (LightList[j]._lunflag) { DoUnLight(LightList[j]._lunx, LightList[j]._luny, LightList[j]._lunr); - LightList[j]._lunflag = 0; + LightList[j]._lunflag = FALSE; } } for (i = 0; i < numlights; i++) { @@ -1210,7 +1210,7 @@ void ChangeVisionRadius(int id, int r) for (i = 0; i < numvision; i++) { if (VisionList[i]._lid == id) { - VisionList[i]._lunflag = 1; + VisionList[i]._lunflag = TRUE; VisionList[i]._lunx = VisionList[i]._lx; VisionList[i]._luny = VisionList[i]._ly; VisionList[i]._lunr = VisionList[i]._lradius; @@ -1226,7 +1226,7 @@ void ChangeVisionXY(int id, int x, int y) for (i = 0; i < numvision; i++) { if (VisionList[i]._lid == id) { - VisionList[i]._lunflag = 1; + VisionList[i]._lunflag = TRUE; VisionList[i]._lunx = VisionList[i]._lx; VisionList[i]._luny = VisionList[i]._ly; VisionList[i]._lunr = VisionList[i]._lradius; @@ -1249,7 +1249,7 @@ void ProcessVisionList() } if (VisionList[i]._lunflag) { DoUnVision(VisionList[i]._lunx, VisionList[i]._luny, VisionList[i]._lunr); - VisionList[i]._lunflag = 0; + VisionList[i]._lunflag = FALSE; } } for (i = 0; i < TransVal; i++) { diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index a3dde56ca..352a6dc38 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -521,7 +521,7 @@ void SaveLevel() int dwLen; BYTE *SaveBuff; - if (!currlevel) + if (currlevel == 0) glSeedTbl[0] = GetRndSeed(); dwLen = codec_get_encoded_len(FILEBUFF); @@ -694,7 +694,7 @@ void LoadLevel() for (i = 0; i < MAX_PLRS; i++) { if (plr[i].plractive && currlevel == plr[i].plrlevel) - LightList[plr[i]._plid]._lunflag = 1; + LightList[plr[i]._plid]._lunflag = TRUE; } mem_free_dbg(LoadBuff); diff --git a/Source/movie.cpp b/Source/movie.cpp index 1e3f81293..4b1ec3484 100644 --- a/Source/movie.cpp +++ b/Source/movie.cpp @@ -21,7 +21,7 @@ void play_movie(char *pszMovie, BOOL user_can_close) } saveProc = SetWindowProc(MovieWndProc); - InvalidateRect(ghMainWnd, 0, 0); + InvalidateRect(ghMainWnd, NULL, 0); UpdateWindow(ghMainWnd); movie_playing = TRUE; sound_disable_music(TRUE); diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 298031cf0..63640afee 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -2843,7 +2843,7 @@ void scrollrt_draw_game_screen(BOOL draw_cursor) unlock_buf(0); } - DrawMain(hgt, 0, 0, 0, 0, 0); + DrawMain(hgt, FALSE, FALSE, FALSE, FALSE, FALSE); if (draw_cursor) { lock_buf(0); diff --git a/Source/setmaps.cpp b/Source/setmaps.cpp index 286d6cd0a..53666bd74 100644 --- a/Source/setmaps.cpp +++ b/Source/setmaps.cpp @@ -61,7 +61,7 @@ char *quest_level_names[] = { "Bone Chamber", "Maze", "Poisoned Water Supply", - "Archbishop Lazarus' Lair" + "Archbishop Lazarus' Lair", }; int ObjIndex(int x, int y) @@ -140,10 +140,10 @@ void LoadSetMap() LoadPreL1Dungeon("Levels\\L1Data\\SklKng1.DUN", 83, 45); LoadL1Dungeon("Levels\\L1Data\\SklKng2.DUN", 83, 45); LoadPalette("Levels\\L1Data\\L1_2.pal"); - DRLG_AreaTrans(sizeof(SkelKingTrans1) / 4, SkelKingTrans1); - DRLG_ListTrans(sizeof(SkelKingTrans2) / 4, SkelKingTrans2); - DRLG_AreaTrans(sizeof(SkelKingTrans3) / 4, SkelKingTrans3); - DRLG_ListTrans(sizeof(SkelKingTrans4) / 4, SkelKingTrans4); + DRLG_AreaTrans(sizeof(SkelKingTrans1) / 4, &SkelKingTrans1[0]); + DRLG_ListTrans(sizeof(SkelKingTrans2) / 4, &SkelKingTrans2[0]); + DRLG_AreaTrans(sizeof(SkelKingTrans3) / 4, &SkelKingTrans3[0]); + DRLG_ListTrans(sizeof(SkelKingTrans4) / 4, &SkelKingTrans4[0]); AddL1Objs(0, 0, MAXDUNX, MAXDUNY); AddSKingObjs(); InitSKingTriggers(); @@ -152,9 +152,9 @@ void LoadSetMap() LoadPreL2Dungeon("Levels\\L2Data\\Bonecha2.DUN", 69, 39); LoadL2Dungeon("Levels\\L2Data\\Bonecha1.DUN", 69, 39); LoadPalette("Levels\\L2Data\\L2_2.pal"); - DRLG_ListTrans(sizeof(SkelChamTrans1) / 4, SkelChamTrans1); - DRLG_AreaTrans(sizeof(SkelChamTrans2) / 4, SkelChamTrans2); - DRLG_ListTrans(sizeof(SkelChamTrans3) / 4, SkelChamTrans3); + DRLG_ListTrans(sizeof(SkelChamTrans1) / 4, &SkelChamTrans1[0]); + DRLG_AreaTrans(sizeof(SkelChamTrans2) / 4, &SkelChamTrans2[0]); + DRLG_ListTrans(sizeof(SkelChamTrans3) / 4, &SkelChamTrans3[0]); AddL2Objs(0, 0, MAXDUNX, MAXDUNY); AddSChamObjs(); InitSChambTriggers(); diff --git a/Source/themes.cpp b/Source/themes.cpp index 541e63550..604666d6e 100644 --- a/Source/themes.cpp +++ b/Source/themes.cpp @@ -988,7 +988,7 @@ void UpdateL4Trans() for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) { - if (dTransVal[i][j]) { + if (dTransVal[i][j] != 0) { dTransVal[i][j] = 1; } } From 350646fe9520b9112685a305712453cc27574459 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 11 Apr 2020 14:46:39 +0200 Subject: [PATCH 25/33] Correct signatures --- Source/init.cpp | 3 +-- Source/init.h | 2 +- Source/interfac.cpp | 4 ++-- Source/inv.cpp | 6 +++--- Source/setmaps.cpp | 14 +++++++------- Source/wave.cpp | 7 +++---- Source/wave.h | 4 ++-- 7 files changed, 19 insertions(+), 21 deletions(-) diff --git a/Source/init.cpp b/Source/init.cpp index 610052766..473c1b7df 100644 --- a/Source/init.cpp +++ b/Source/init.cpp @@ -319,7 +319,7 @@ HANDLE init_test_access(char *mpq_path, char *mpq_name, char *reg_loc, int dwPri return NULL; } -char *init_strip_trailing_slash(char *path) +void init_strip_trailing_slash(char *path) { char *result; @@ -328,7 +328,6 @@ char *init_strip_trailing_slash(char *path) if (!result[1]) *result = 0; } - return result; } BOOL init_read_test_file(char *pszPath, char *pszArchive, int dwPriority, HANDLE *phArchive) diff --git a/Source/init.h b/Source/init.h index 6867b23b4..6f66a452c 100644 --- a/Source/init.h +++ b/Source/init.h @@ -28,7 +28,7 @@ HWND init_find_mom_parent(); void init_await_mom_parent_exit(); void init_archives(); HANDLE init_test_access(char *mpq_path, char *mpq_name, char *reg_loc, int flags, int fs); -char *init_strip_trailing_slash(char *path); +void init_strip_trailing_slash(char *path); BOOL init_read_test_file(char *pszPath, char *pszArchive, int flags, HANDLE *phArchive); void init_get_file_info(); LRESULT __stdcall MainWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); diff --git a/Source/interfac.cpp b/Source/interfac.cpp index b4232a765..1cd6a3351 100644 --- a/Source/interfac.cpp +++ b/Source/interfac.cpp @@ -6,7 +6,7 @@ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" -void *sgpBackCel; +BYTE *sgpBackCel; int sgdwProgress; int progress_id; @@ -43,7 +43,7 @@ void DrawCutscene() DWORD i; lock_buf(1); - CelDraw(PANEL_X, 480 + SCREEN_Y - 1, (BYTE *)sgpBackCel, 1, 640); + CelDraw(PANEL_X, 480 + SCREEN_Y - 1, sgpBackCel, 1, 640); for (i = 0; i < sgdwProgress; i++) { DrawProgress( diff --git a/Source/inv.cpp b/Source/inv.cpp index 1cb54a7c7..50b76d3fd 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -1860,7 +1860,7 @@ int InvPutItem(int pnum, int x, int y) item[ii]._iy = y; RespawnItem(ii, TRUE); numitems++; - SetCursor_(CURSOR_HAND); + NewCursor(CURSOR_HAND); return ii; } @@ -2238,7 +2238,7 @@ void DoTelekinesis() NetSendCmdGItem(TRUE, CMD_REQUESTAGITEM, myplr, myplr, pcursitem); if (pcursmonst != -1 && !M_Talker(pcursmonst) && monster[pcursmonst].mtalkmsg == 0) NetSendCmdParam1(TRUE, CMD_KNOCKBACK, pcursmonst); - SetCursor_(CURSOR_HAND); + NewCursor(CURSOR_HAND); } int CalculateGold(int pnum) @@ -2264,7 +2264,7 @@ BOOL DropItemBeforeTrig() { if (TryInvPut()) { NetSendCmdPItem(TRUE, CMD_PUTITEM, cursmx, cursmy); - SetCursor_(CURSOR_HAND); + NewCursor(CURSOR_HAND); return TRUE; } diff --git a/Source/setmaps.cpp b/Source/setmaps.cpp index 53666bd74..2c6baf629 100644 --- a/Source/setmaps.cpp +++ b/Source/setmaps.cpp @@ -1,17 +1,17 @@ #include "all.h" // BUGFIX: constant data should be const -BYTE SkelKingTrans1[8] = { +BYTE SkelKingTrans1[] = { 19, 47, 26, 55, 26, 49, 30, 53 }; -BYTE SkelKingTrans2[8] = { +BYTE SkelKingTrans2[] = { 33, 19, 47, 29, 37, 29, 43, 39 }; -BYTE SkelKingTrans3[20] = { +BYTE SkelKingTrans3[] = { 27, 53, 35, 61, 27, 35, 34, 42, 45, 35, 53, 43, @@ -19,7 +19,7 @@ BYTE SkelKingTrans3[20] = { 31, 39, 49, 57 }; -BYTE SkelKingTrans4[28] = { +BYTE SkelKingTrans4[] = { 49, 45, 58, 51, 57, 31, 62, 37, 63, 31, 69, 40, @@ -29,7 +29,7 @@ BYTE SkelKingTrans4[28] = { 79, 43, 89, 53 }; -BYTE SkelChamTrans1[20] = { +BYTE SkelChamTrans1[] = { 43, 19, 50, 26, 51, 19, 59, 26, 35, 27, 42, 34, @@ -37,12 +37,12 @@ BYTE SkelChamTrans1[20] = { 50, 27, 59, 34 }; -BYTE SkelChamTrans2[8] = { +BYTE SkelChamTrans2[] = { 19, 31, 34, 47, 34, 35, 42, 42 }; -BYTE SkelChamTrans3[36] = { +BYTE SkelChamTrans3[] = { 43, 35, 50, 42, 51, 35, 62, 42, 63, 31, 66, 46, diff --git a/Source/wave.cpp b/Source/wave.cpp index fa8bd7999..e0fc8128e 100644 --- a/Source/wave.cpp +++ b/Source/wave.cpp @@ -1,9 +1,9 @@ #include "all.h" #include "../3rdParty/Storm/Source/storm.h" -BOOL WCloseFile(HANDLE file) +void WCloseFile(HANDLE file) { - return SFileCloseFile(file); + SFileCloseFile(file); } LONG WGetFileSize(HANDLE hsFile, DWORD *lpFileSizeHigh) @@ -82,7 +82,7 @@ BOOL LoadWaveFormat(HANDLE hsFile, WAVEFORMATEX *pwfx) return ret; } -void *AllocateMemFile(HANDLE hsFile, MEMFILE *pMemFile, DWORD dwPos) +void AllocateMemFile(HANDLE hsFile, MEMFILE *pMemFile, DWORD dwPos) { DWORD length; @@ -97,7 +97,6 @@ void *AllocateMemFile(HANDLE hsFile, MEMFILE *pMemFile, DWORD dwPos) pMemFile->buf_len = length; pMemFile->buf = DiabloAllocPtr(length); pMemFile->file = hsFile; - return pMemFile->buf; } void FreeMemFile(MEMFILE *pMemFile) diff --git a/Source/wave.h b/Source/wave.h index 4f662fba1..7a608f688 100644 --- a/Source/wave.h +++ b/Source/wave.h @@ -2,14 +2,14 @@ #ifndef __WAVE_H__ #define __WAVE_H__ -BOOL WCloseFile(HANDLE file); +void WCloseFile(HANDLE file); LONG WGetFileSize(HANDLE hsFile, DWORD *lpFileSizeHigh); void WGetFileArchive(HANDLE hsFile, DWORD *retry, const char *FileName); BOOL WOpenFile(const char *FileName, HANDLE *phsFile, BOOL mayNotExist); void WReadFile(HANDLE hsFile, LPVOID buf, DWORD to_read); int WSetFilePointer(HANDLE file1, int offset, HANDLE file2, int whence); BOOL LoadWaveFormat(HANDLE hsFile, WAVEFORMATEX *pwfx); -void *AllocateMemFile(HANDLE hsFile, MEMFILE *pMemFile, DWORD dwPos); +void AllocateMemFile(HANDLE hsFile, MEMFILE *pMemFile, DWORD dwPos); void FreeMemFile(MEMFILE *pMemFile); BOOL ReadWaveFile(MEMFILE *pMemFile, WAVEFORMATEX *pwfx, CKINFO *chunk); BOOL ReadMemFile(MEMFILE *pMemFile, void *lpBuf, size_t length); From e7567859eeb5f1c7791bae49eb95c48bfec358f8 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 11 Apr 2020 14:48:01 +0200 Subject: [PATCH 26/33] Remove C fallback code --- Source/scrollrt.cpp | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 63640afee..e46e50826 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -2615,11 +2615,7 @@ static void DoBlitScreen(DWORD dwX, DWORD dwY, DWORD dwWdt, DWORD dwHgt) /// ASSERT: assert(! gpBuffer); dwTicks = GetTickCount(); while (1) { -#ifdef __cplusplus hDDVal = lpDDSPrimary->BltFast(dwX, dwY, lpDDSBackBuf, &SrcRect, DDBLTFAST_WAIT); -#else - hDDVal = lpDDSPrimary->lpVtbl->BltFast(lpDDSPrimary, dwX, dwY, lpDDSBackBuf, &SrcRect, DDBLTFAST_WAIT); -#endif if (hDDVal == DD_OK) { break; } @@ -2716,17 +2712,10 @@ static void DrawMain(int dwHgt, BOOL draw_desc, BOOL draw_hp, BOOL draw_mana, BO return; } -#ifdef __cplusplus if (lpDDSPrimary->IsLost() == DDERR_SURFACELOST) { if (lpDDSPrimary->Restore() != DD_OK) { return; } -#else - if (lpDDSPrimary->lpVtbl->IsLost(lpDDSPrimary) == DDERR_SURFACELOST) { - if (lpDDSPrimary->lpVtbl->Restore(lpDDSPrimary) != DD_OK) { - return; - } -#endif ResetPal(); ysize = SCREEN_HEIGHT; } @@ -2736,11 +2725,7 @@ static void DrawMain(int dwHgt, BOOL draw_desc, BOOL draw_hp, BOOL draw_mana, BO dwTicks = GetTickCount(); while (1) { DDS_desc.dwSize = sizeof(DDS_desc); -#ifdef __cplusplus hDDVal = lpDDSPrimary->Lock(NULL, &DDS_desc, DDLOCK_WRITEONLY | DDLOCK_WAIT, NULL); -#else - hDDVal = lpDDSPrimary->lpVtbl->Lock(lpDDSPrimary, NULL, &DDS_desc, DDLOCK_WRITEONLY | DDLOCK_WAIT, NULL); -#endif if (hDDVal == DD_OK) { break; } @@ -2807,11 +2792,7 @@ static void DrawMain(int dwHgt, BOOL draw_desc, BOOL draw_hp, BOOL draw_mana, BO } if (lpDDSBackBuf == NULL) { -#ifdef __cplusplus hDDVal = lpDDSPrimary->Unlock(NULL); -#else - hDDVal = lpDDSPrimary->lpVtbl->Unlock(lpDDSPrimary, NULL); -#endif if (hDDVal != DDERR_SURFACELOST && hDDVal != DD_OK) { DDErrMsg(hDDVal, 3779, "C:\\Src\\Diablo\\Source\\SCROLLRT.CPP"); } From 3b8bcf98bf9a959717f9a60baa5d5710337de925 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 11 Apr 2020 14:49:02 +0200 Subject: [PATCH 27/33] Enable assertions --- Source/engine.cpp | 140 ++++++++++++++++++++++---------------------- Source/interfac.cpp | 18 +++--- Source/inv.cpp | 14 ++--- Source/items.cpp | 4 +- Source/lighting.cpp | 2 +- Source/missiles.cpp | 4 +- Source/scrollrt.cpp | 8 +-- Source/sync.cpp | 6 +- Source/town.cpp | 12 ++-- 9 files changed, 102 insertions(+), 106 deletions(-) diff --git a/Source/engine.cpp b/Source/engine.cpp index 6fe623b17..14d367569 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -82,10 +82,10 @@ void CelBlit(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) { int w; - /// ASSERT: assert(pDecodeTo != NULL); + assert(pDecodeTo != NULL); if (pDecodeTo == NULL) return; - /// ASSERT: assert(pRLEBytes != NULL); + assert(pRLEBytes != NULL); if (pRLEBytes == NULL) return; @@ -190,10 +190,10 @@ void CelDraw(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) int nDataSize; BYTE *pRLEBytes; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); if (gpBuffer == NULL) return; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; @@ -213,10 +213,10 @@ void CelBlitFrame(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth) int nDataSize; BYTE *pRLEBytes; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; - /// ASSERT: assert(pBuff != NULL); + assert(pBuff != NULL); if (pBuff == NULL) return; @@ -240,10 +240,10 @@ void CelClippedDraw(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int Ce DWORD *pFrameTable; int nDataStart, nDataSize, nDataCap; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); if (gpBuffer == NULL) return; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; @@ -286,10 +286,10 @@ void CelClippedBlit(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int CelSk DWORD *pFrameTable; int nDataStart, nDataSize, nDataCap; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; - /// ASSERT: assert(pBuff != NULL); + assert(pBuff != NULL); if (pBuff == NULL) return; @@ -325,10 +325,10 @@ void CelBlitLight(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) int w; BYTE *tbl; - /// ASSERT: assert(pDecodeTo != NULL); + assert(pDecodeTo != NULL); if (pDecodeTo == NULL) return; - /// ASSERT: assert(pRLEBytes != NULL); + assert(pRLEBytes != NULL); if (pRLEBytes == NULL) return; @@ -486,10 +486,10 @@ void CelBlitLightTrans(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWid BOOL shift; BYTE *tbl; - /// ASSERT: assert(pDecodeTo != NULL); + assert(pDecodeTo != NULL); if (pDecodeTo == NULL) return; - /// ASSERT: assert(pRLEBytes != NULL); + assert(pRLEBytes != NULL); if (pRLEBytes == NULL) return; @@ -680,10 +680,10 @@ void CelDrawLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth) int nDataSize; BYTE *pDecodeTo, *pRLEBytes; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); if (gpBuffer == NULL) return; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; @@ -712,10 +712,10 @@ void CelClippedDrawLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i BYTE *pRLEBytes, *pDecodeTo; DWORD *pFrameTable; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); if (gpBuffer == NULL) return; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; @@ -760,10 +760,10 @@ void CelClippedBlitLightTrans(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, BYTE *pRLEBytes; DWORD *pFrameTable; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; - /// ASSERT: assert(pBuff != NULL); + assert(pBuff != NULL); if (pBuff == NULL) return; @@ -811,10 +811,10 @@ void CelDrawLightRed(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int C BYTE *pRLEBytes, *dst, *tbl; DWORD *pFrameTable; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); if (gpBuffer == NULL) return; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; @@ -929,13 +929,13 @@ void CelBlitSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) { int w; - /// ASSERT: assert(pDecodeTo != NULL); + assert(pDecodeTo != NULL); if (pDecodeTo == NULL) return; - /// ASSERT: assert(pRLEBytes != NULL); + assert(pRLEBytes != NULL); if (pRLEBytes == NULL) return; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); if (gpBuffer == NULL) return; @@ -1054,10 +1054,10 @@ void CelClippedDrawSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, in DWORD *pFrameTable; int nDataStart, nDataSize, nDataCap; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); if (gpBuffer == NULL) return; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; @@ -1100,10 +1100,10 @@ void CelClippedBlitSafe(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWidth, int C DWORD *pFrameTable; int nDataStart, nDataSize, nDataCap; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; - /// ASSERT: assert(pBuff != NULL); + assert(pBuff != NULL); if (pBuff == NULL) return; @@ -1139,13 +1139,13 @@ void CelBlitLightSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidt int w; BYTE *tbl; - /// ASSERT: assert(pDecodeTo != NULL); + assert(pDecodeTo != NULL); if (pDecodeTo == NULL) return; - /// ASSERT: assert(pRLEBytes != NULL); + assert(pRLEBytes != NULL); if (pRLEBytes == NULL) return; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); if (gpBuffer == NULL) return; @@ -1315,13 +1315,13 @@ void CelBlitLightTransSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int BOOL shift; BYTE *tbl; - /// ASSERT: assert(pDecodeTo != NULL); + assert(pDecodeTo != NULL); if (pDecodeTo == NULL) return; - /// ASSERT: assert(pRLEBytes != NULL); + assert(pRLEBytes != NULL); if (pRLEBytes == NULL) return; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); if (gpBuffer == NULL) return; @@ -1526,10 +1526,10 @@ void CelDrawLightSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int BYTE *pRLEBytes, *pDecodeTo; DWORD *pFrameTable; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); if (gpBuffer == NULL) return; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; @@ -1574,7 +1574,7 @@ void CelClippedBlitLightTransSafe(BYTE *pBuff, BYTE *pCelBuff, int nCel, int nWi BYTE *pRLEBytes; DWORD *pFrameTable; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; @@ -1622,10 +1622,10 @@ void CelDrawLightRedSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i BYTE *pRLEBytes, *dst, *tbl; DWORD *pFrameTable; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); if (gpBuffer == NULL) return; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; @@ -1751,10 +1751,10 @@ void CelBlitWidth(BYTE *pBuff, int x, int y, int wdt, BYTE *pCelBuff, int nCel, { BYTE *pRLEBytes, *dst, *end; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; - /// ASSERT: assert(pBuff != NULL); + assert(pBuff != NULL); if (pBuff == NULL) return; @@ -1877,10 +1877,10 @@ void CelBlitOutline(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWid int nDataStart, nDataSize, nDataCap, w; BYTE *pRLEBytes, *dst; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); if (gpBuffer == NULL) return; @@ -2025,10 +2025,10 @@ void CelBlitOutlineSafe(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int int nDataStart, nDataSize, nDataCap, w; BYTE *pRLEBytes, *dst; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); if (gpBuffer == NULL) return; @@ -2209,7 +2209,7 @@ void ENG_set_pixel(int sx, int sy, BYTE col) { BYTE *dst; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); if (sy < 0 || sy >= SCREEN_HEIGHT + SCREEN_Y || sx < SCREEN_X || sx >= SCREEN_WIDTH + SCREEN_X) return; @@ -2240,7 +2240,7 @@ void engine_draw_pixel(int sx, int sy) { BYTE *dst; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); if (gbRotateMap) { if (gbNotInView && (sx < 0 || sx >= SCREEN_HEIGHT + SCREEN_Y || sy < SCREEN_X || sy >= SCREEN_WIDTH + SCREEN_X)) @@ -2661,7 +2661,7 @@ DWORD LoadFileWithMem(const char *pszName, BYTE *p) DWORD dwFileLen; HANDLE hsFile; - /// ASSERT: assert(pszName); + assert(pszName); if (p == NULL) { app_fatal("LoadFileWithMem(NULL):\n%s", pszName); } @@ -2692,8 +2692,8 @@ void Cl2ApplyTrans(BYTE *p, BYTE *ttbl, int nCel) BYTE *dst; DWORD *pFrameTable; - /// ASSERT: assert(p != NULL); - /// ASSERT: assert(ttbl != NULL); + assert(p != NULL); + assert(ttbl != NULL); for (i = 1; i <= nCel; i++) { pFrameTable = (DWORD *)&p[4 * i]; @@ -2702,17 +2702,17 @@ void Cl2ApplyTrans(BYTE *p, BYTE *ttbl, int nCel) while (nDataSize) { width = *dst++; nDataSize--; - /// ASSERT: assert(nDataSize >= 0); + assert(nDataSize >= 0); if (width < 0) { width = -width; if (width > 65) { nDataSize--; - /// ASSERT: assert(nDataSize >= 0); + assert(nDataSize >= 0); *dst = ttbl[*dst]; dst++; } else { nDataSize -= width; - /// ASSERT: assert(nDataSize >= 0); + assert(nDataSize >= 0); while (width) { *dst = ttbl[*dst]; dst++; @@ -2740,10 +2740,10 @@ void Cl2Draw(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip, DWORD *pFrameTable; int nDataStart, nDataSize; - /// ASSERT: assert(gpBuffer != NULL); + assert(gpBuffer != NULL); if (gpBuffer == NULL) return; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; assert(nCel > 0); @@ -2936,10 +2936,10 @@ void Cl2DrawOutline(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWid BYTE *pRLEBytes; DWORD *pFrameTable; - /// ASSERT: assert(gpBuffer != NULL); + assert(gpBuffer != NULL); if (gpBuffer == NULL) return; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; assert(nCel > 0); @@ -3155,10 +3155,10 @@ void Cl2DrawLightTbl(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int C BYTE *pRLEBytes, *pDecodeTo; DWORD *pFrameTable; - /// ASSERT: assert(gpBuffer != NULL); + assert(gpBuffer != NULL); if (gpBuffer == NULL) return; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; assert(nCel > 0); @@ -3371,10 +3371,10 @@ void Cl2DrawLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelS BYTE *pRLEBytes, *pDecodeTo; DWORD *pFrameTable; - /// ASSERT: assert(gpBuffer != NULL); + assert(gpBuffer != NULL); if (gpBuffer == NULL) return; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; assert(nCel > 0); @@ -3421,10 +3421,10 @@ void Cl2DrawSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSk DWORD *pFrameTable; int nDataStart, nDataSize; - /// ASSERT: assert(gpBuffer != NULL); + assert(gpBuffer != NULL); if (gpBuffer == NULL) return; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; assert(nCel > 0); @@ -3630,10 +3630,10 @@ void Cl2DrawOutlineSafe(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int BYTE *pRLEBytes; DWORD *pFrameTable; - /// ASSERT: assert(gpBuffer != NULL); + assert(gpBuffer != NULL); if (gpBuffer == NULL) return; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; assert(nCel > 0); @@ -3862,10 +3862,10 @@ void Cl2DrawLightTblSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i BYTE *pRLEBytes, *pDecodeTo; DWORD *pFrameTable; - /// ASSERT: assert(gpBuffer != NULL); + assert(gpBuffer != NULL); if (gpBuffer == NULL) return; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; assert(nCel > 0); @@ -4091,10 +4091,10 @@ void Cl2DrawLightSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int BYTE *pRLEBytes, *pDecodeTo; DWORD *pFrameTable; - /// ASSERT: assert(gpBuffer != NULL); + assert(gpBuffer != NULL); if (gpBuffer == NULL) return; - /// ASSERT: assert(pCelBuff != NULL); + assert(pCelBuff != NULL); if (pCelBuff == NULL) return; assert(nCel > 0); diff --git a/Source/interfac.cpp b/Source/interfac.cpp index 1cd6a3351..a09523c96 100644 --- a/Source/interfac.cpp +++ b/Source/interfac.cpp @@ -76,7 +76,7 @@ void ShowProgress(unsigned int uMsg) gbSomebodyWonGameKludge = FALSE; plrmsg_delay(TRUE); - /// ASSERT: assert(ghMainWnd); + assert(ghMainWnd); saveProc = SetWindowProc(DisableInputWndProc); interface_msg_pump(); @@ -114,7 +114,7 @@ void ShowProgress(unsigned int uMsg) FreeGameMem(); currlevel++; leveltype = gnLevelTypeTbl[currlevel]; - /// ASSERT: assert(plr[myplr].plrlevel == currlevel); + assert(plr[myplr].plrlevel == currlevel); IncProgress(); LoadGameLevel(FALSE, 0); IncProgress(); @@ -130,7 +130,7 @@ void ShowProgress(unsigned int uMsg) FreeGameMem(); currlevel--; leveltype = gnLevelTypeTbl[currlevel]; - /// ASSERT: assert(plr[myplr].plrlevel == currlevel); + assert(plr[myplr].plrlevel == currlevel); IncProgress(); LoadGameLevel(FALSE, 1); IncProgress(); @@ -185,7 +185,7 @@ void ShowProgress(unsigned int uMsg) FreeGameMem(); currlevel = plr[myplr].plrlevel; leveltype = gnLevelTypeTbl[currlevel]; - /// ASSERT: assert(plr[myplr].plrlevel == currlevel); + assert(plr[myplr].plrlevel == currlevel); IncProgress(); LoadGameLevel(FALSE, 6); IncProgress(); @@ -200,7 +200,7 @@ void ShowProgress(unsigned int uMsg) FreeGameMem(); currlevel = plr[myplr].plrlevel; leveltype = gnLevelTypeTbl[currlevel]; - /// ASSERT: assert(plr[myplr].plrlevel == currlevel); + assert(plr[myplr].plrlevel == currlevel); IncProgress(); LoadGameLevel(FALSE, 7); IncProgress(); @@ -215,20 +215,20 @@ void ShowProgress(unsigned int uMsg) FreeGameMem(); currlevel = plr[myplr].plrlevel; leveltype = gnLevelTypeTbl[currlevel]; - /// ASSERT: assert(plr[myplr].plrlevel == currlevel); + assert(plr[myplr].plrlevel == currlevel); IncProgress(); LoadGameLevel(FALSE, 0); IncProgress(); break; } - /// ASSERT: assert(ghMainWnd); + assert(ghMainWnd); PaletteFadeOut(8); FreeInterface(); saveProc = SetWindowProc(saveProc); - /// ASSERT: assert(saveProc == DisableInputWndProc); + assert(saveProc == DisableInputWndProc); NetSendCmdLocParam1(TRUE, CMD_PLAYER_JOINLEVEL, plr[myplr]._px, plr[myplr]._py, plr[myplr].plrlevel); plrmsg_delay(FALSE); @@ -248,7 +248,7 @@ void FreeInterface() void InitCutscene(unsigned int uMsg) { - /// ASSERT: assert(! sgpBackCel); + assert(!sgpBackCel); switch (uMsg) { case WM_DIABNEXTLVL: diff --git a/Source/inv.cpp b/Source/inv.cpp index 50b76d3fd..441d78e2a 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -134,7 +134,7 @@ void InvDrawSlotBack(int X, int Y, int W, int H) { BYTE *dst; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); dst = &gpBuffer[X + PitchTbl[Y]]; @@ -1710,15 +1710,13 @@ void SyncGetItem(int x, int y, int idx, WORD ci, int iseed) if (itemactive[i] == ii) { DeleteItem(itemactive[i], i); FindGetItem(idx, ci, iseed); - /// ASSERT: assert(FindGetItem(idx,ci,iseed) == -1); - FindGetItem(idx, ci, iseed); /* todo: replace with above */ + assert(FindGetItem(idx,ci,iseed) == -1); i = 0; } else { i++; } } - /// ASSERT: assert(FindGetItem(idx, ci, iseed) == -1); - FindGetItem(idx, ci, iseed); /* todo: replace with above */ + assert(FindGetItem(idx, ci, iseed) == -1); } } @@ -1847,9 +1845,7 @@ int InvPutItem(int pnum, int x, int y) } } - CanPut(x, y); //if (!CanPut(x, y)) { - // assertion_failed(1524, "C:\\Diablo\\Direct\\inv.cpp", "CanPut(x,y)"); - //} + assert(CanPut(x, y)); ii = itemavail[0]; dItem[x][y] = ii + 1; @@ -1916,7 +1912,7 @@ int SyncPutItem(int pnum, int x, int y, int idx, WORD icreateinfo, int iseed, in } } - CanPut(x, y); + assert(CanPut(x, y)); ii = itemavail[0]; dItem[x][y] = ii + 1; diff --git a/Source/items.cpp b/Source/items.cpp index fc4b0eba2..b162a2d08 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -580,7 +580,7 @@ void CalcPlrItemVals(int p, BOOL Loadgfx) d = plr[p]._pdir; - // TODO: Add debug assert here ( plr[p]._pNAnim[d] != NULL ) + assert(plr[p]._pNAnim[d]); plr[p]._pAnimData = plr[p]._pNAnim[d]; plr[p]._pAnimLen = plr[p]._pNFrames; @@ -2957,7 +2957,7 @@ void PrintUString(int x, int y, BOOL cjustflag, char *str, int col) void DrawULine(int y) { - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); #ifdef USE_ASM int yy; diff --git a/Source/lighting.cpp b/Source/lighting.cpp index eb368fba5..4a083214f 100644 --- a/Source/lighting.cpp +++ b/Source/lighting.cpp @@ -786,7 +786,7 @@ void FreeLightTable() void InitLightTable() { - /// ASSERT: assert(! pLightTbl); + assert(!pLightTbl); pLightTbl = DiabloAllocPtr(LIGHTSIZE); } diff --git a/Source/missiles.cpp b/Source/missiles.cpp index 9860c8e9d..d7bc2f976 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -23,8 +23,8 @@ void GetDamageAmt(int i, int *mind, int *maxd) { int k, sl; - /// ASSERT: assert((DWORD)myplr < MAX_PLRS); - /// ASSERT: assert((DWORD)i < 64); + assert((DWORD)myplr < MAX_PLRS); + assert((DWORD)i < 64); sl = plr[myplr]._pSplLvl[i] + plr[myplr]._pISplLvlAdd; switch (i) { diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index e46e50826..c0ff46e0e 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -2318,7 +2318,7 @@ static void DrawZoom(int x, int y) wdt = SCREEN_WIDTH / 2; } - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); #ifdef USE_ASM __asm { @@ -2441,7 +2441,7 @@ void ClearScreenBuffer() { lock_buf(3); - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); #ifdef USE_ASM __asm { @@ -2604,8 +2604,8 @@ static void DoBlitScreen(DWORD dwX, DWORD dwY, DWORD dwWdt, DWORD dwHgt) HRESULT hDDVal; RECT SrcRect; - /// ASSERT: assert(! (dwX & 3)); - /// ASSERT: assert(! (dwWdt & 3)); + assert(!(dwX & 3)); + assert(!(dwWdt & 3)); if (lpDDSBackBuf != NULL) { SrcRect.left = dwX + SCREEN_X; diff --git a/Source/sync.cpp b/Source/sync.cpp index 7e33d9573..a630ff74c 100644 --- a/Source/sync.cpp +++ b/Source/sync.cpp @@ -27,7 +27,7 @@ DWORD sync_all_monsters(const BYTE *pbBuf, DWORD dwMaxLen) pHdr->bLevel = currlevel; pHdr->wLen = 0; SyncPlrInv(pHdr); - /// ASSERT: assert(dwMaxLen <= 0xffff); + assert(dwMaxLen <= 0xffff); sync_one_monster(); for (i = 0; i < nummonsters && dwMaxLen >= sizeof(TSyncMonster); i++) { @@ -168,7 +168,7 @@ void SyncPlrInv(TSyncHeader *pHdr) pHdr->bItemI = -1; } - /// ASSERT: assert((DWORD) sgnSyncPInv < NUM_INVLOC); + assert((DWORD)sgnSyncPInv < NUM_INVLOC); pItem = &plr[myplr].InvBody[sgnSyncPInv]; if (pItem->_itype != ITYPE_NONE) { pHdr->bPInvLoc = sgnSyncPInv; @@ -215,7 +215,7 @@ DWORD sync_update(int pnum, const BYTE *pbBuf) pbBuf += sizeof(TSyncMonster); } - /// ASSERT: assert(wLen == 0); + assert(wLen == 0); return pHdr->wLen + sizeof(*pHdr); } diff --git a/Source/town.cpp b/Source/town.cpp index 18c25a1cd..43234ac73 100644 --- a/Source/town.cpp +++ b/Source/town.cpp @@ -7,7 +7,7 @@ */ void town_clear_upper_buf(BYTE *pBuff) { - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); #ifdef USE_ASM __asm { @@ -74,7 +74,7 @@ void town_clear_upper_buf(BYTE *pBuff) */ void town_clear_low_buf(BYTE *pBuff) { - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); #ifdef USE_ASM __asm { @@ -430,7 +430,7 @@ void town_draw_clipped_town(BYTE *pBuff, int sx, int sy, int dx, int dy, int efl int mi, px, py; char bv; - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); pBuff = &gpBuffer[dx + PitchTbl[dy]]; @@ -1228,7 +1228,7 @@ void T_DrawZoom(int x, int y) break; } - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); gpBufEnd = &gpBuffer[PitchTbl[-17 + SCREEN_Y]]; for (i = 0; i < 7; i++) { town_draw_upper(x, y, sx, sy, chunks, i, 0); @@ -1240,7 +1240,7 @@ void T_DrawZoom(int x, int y) sx += 32; sy += 16; } - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); gpBufEnd = &gpBuffer[PitchTbl[160 + SCREEN_Y]]; for (i = 0; i < blocks; i++) { town_draw_lower(x, y, sx, sy, chunks, 0); @@ -1277,7 +1277,7 @@ void T_DrawZoom(int x, int y) wdt = SCREEN_WIDTH / 2; } - /// ASSERT: assert(gpBuffer); + assert(gpBuffer); #ifdef USE_ASM __asm { From 8c3ec9123265edd5f1c87da6f3a2e389b1e6830d Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Mon, 13 Apr 2020 19:36:07 +0200 Subject: [PATCH 28/33] Use enums in the ObjTypeConv map --- Source/objdat.cpp | 228 +++++++++++++++++++++++----------------------- Source/objdat.h | 2 +- 2 files changed, 115 insertions(+), 115 deletions(-) diff --git a/Source/objdat.cpp b/Source/objdat.cpp index 3fd9cd1d6..4c4911ae5 100644 --- a/Source/objdat.cpp +++ b/Source/objdat.cpp @@ -1,120 +1,120 @@ #include "all.h" /** Maps from dun_object_id to object_id. */ -int ObjTypeConv[113] = { - 0, - 4, - 20, - 21, - 22, - 24, - 11, - 12, - 13, - 0, - 0, - 0, - 0, - 0, - 25, - 41, - 26, - 0, - 8, - 9, - 10, - 80, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 49, - 0, - 0, - 0, - 0, - 0, - 84, - 85, - 3, - 14, - 15, - 16, - 17, - 18, - 19, - 0, - 0, - 0, - 0, - 0, - 0, - 28, - 0, - 53, - 54, - 36, - 37, - 38, - 39, - 40, - 0, - 0, - 0, - 0, - 0, - 27, - 0, - 0, - 0, - 0, - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 5, - 5, - 5, - 6, - 6, - 6, - 7, - 7, - 7, - 0, - 0, - 0, - 0, - 0, - 73, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 83, - 0, - 0, - 89, - 90, - 47, - 46, - 94 +int ObjTypeConv[] = { + OBJ_L1LIGHT, + OBJ_LEVER, + OBJ_CRUX1, + OBJ_CRUX2, + OBJ_CRUX3, + OBJ_ANGEL, + OBJ_BANNERL, + OBJ_BANNERM, + OBJ_BANNERR, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_BOOK2L, + OBJ_BOOK2R, + OBJ_BCROSS, + OBJ_L1LIGHT, + OBJ_CANDLE1, + OBJ_CANDLE2, + OBJ_CANDLEO, + OBJ_CAULDRON, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_GOATSHRINE, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_MCIRCLE1, + OBJ_MCIRCLE2, + OBJ_SKFIRE, + OBJ_SKPILE, + OBJ_SKSTICK1, + OBJ_SKSTICK2, + OBJ_SKSTICK3, + OBJ_SKSTICK4, + OBJ_SKSTICK5, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_SWITCHSKL, + OBJ_L1LIGHT, + OBJ_TRAPL, + OBJ_TRAPR, + OBJ_TORTURE1, + OBJ_TORTURE2, + OBJ_TORTURE3, + OBJ_TORTURE4, + OBJ_TORTURE5, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_NUDEW2R, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_TNUDEM1, + OBJ_TNUDEM2, + OBJ_TNUDEM3, + OBJ_TNUDEM4, + OBJ_TNUDEW1, + OBJ_TNUDEW2, + OBJ_TNUDEW3, + OBJ_CHEST1, + OBJ_CHEST1, + OBJ_CHEST1, + OBJ_CHEST2, + OBJ_CHEST2, + OBJ_CHEST2, + OBJ_CHEST3, + OBJ_CHEST3, + OBJ_CHEST3, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_PEDISTAL, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_ALTBOY, + OBJ_L1LIGHT, + OBJ_L1LIGHT, + OBJ_WARARMOR, + OBJ_WARWEAP, + OBJ_TORCHR2, + OBJ_TORCHL2, + OBJ_MUSHPATCH, }; /** Contains the data related to each object ID. */ diff --git a/Source/objdat.h b/Source/objdat.h index ff879f15c..29c33bc19 100644 --- a/Source/objdat.h +++ b/Source/objdat.h @@ -2,7 +2,7 @@ #ifndef __OBJDAT_H__ #define __OBJDAT_H__ -extern int ObjTypeConv[113]; +extern int ObjTypeConv[]; extern ObjDataStruct AllObjects[99]; extern char *ObjMasterLoadList[56]; From 10be0c66e01c5822d93fc5383f9c30fe71bd171a Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Mon, 13 Apr 2020 20:32:05 +0200 Subject: [PATCH 29/33] Correct ObjTypeConv --- Source/objdat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/objdat.cpp b/Source/objdat.cpp index 4c4911ae5..712bc0eff 100644 --- a/Source/objdat.cpp +++ b/Source/objdat.cpp @@ -32,7 +32,7 @@ int ObjTypeConv[] = { OBJ_L1LIGHT, OBJ_L1LIGHT, OBJ_L1LIGHT, - OBJ_GOATSHRINE, + OBJ_FLAMEHOLE, OBJ_L1LIGHT, OBJ_L1LIGHT, OBJ_L1LIGHT, From 7873bd4356b27933cb75a7ad78bbc9b86ae028ef Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Tue, 14 Apr 2020 00:34:12 +0200 Subject: [PATCH 30/33] minitext: fix variable names of minitext.cpp The variable names were mixed up. sgLastScroll -> qtextSpd scrolltexty -> qtextDelay qtextSpd -> sgLastScroll --- Source/minitext.cpp | 28 ++++++++++++++-------------- Source/minitext.h | 2 -- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Source/minitext.cpp b/Source/minitext.cpp index 54ca65f17..3484b31af 100644 --- a/Source/minitext.cpp +++ b/Source/minitext.cpp @@ -7,10 +7,10 @@ int qtexty; char *qtextptr; -int qtextSpd; -BOOLEAN qtextflag; -int scrolltexty; int sgLastScroll; +BOOLEAN qtextflag; +int qtextDelay; +int qtextSpd; BYTE *pMedTextCels; BYTE *pTextBoxCels; @@ -72,9 +72,9 @@ void InitQTextMsg(int m) qtextptr = alltext[m].txtstr; qtextflag = TRUE; qtexty = 500; - sgLastScroll = qscroll_spd_tbl[alltext[m].txtspd - 1]; - scrolltexty = sgLastScroll; - qtextSpd = GetTickCount(); + qtextSpd = qscroll_spd_tbl[alltext[m].txtspd - 1]; + qtextDelay = qtextSpd; + sgLastScroll = GetTickCount(); } PlaySFX(alltext[m].sfxnr); } @@ -272,17 +272,17 @@ void DrawQText() currTime = GetTickCount(); while (1) { - if (sgLastScroll <= 0) { + if (qtextSpd <= 0) { qtexty--; - qtexty += sgLastScroll; + qtexty += qtextSpd; } else { - scrolltexty--; - if (scrolltexty != 0) { + qtextDelay--; + if (qtextDelay != 0) { qtexty--; } } - if (scrolltexty == 0) { - scrolltexty = sgLastScroll; + if (qtextDelay == 0) { + qtextDelay = qtextSpd; } if (qtexty <= 209) { qtexty += 38; @@ -292,8 +292,8 @@ void DrawQText() } break; } - qtextSpd += 50; - if (currTime - qtextSpd >= 0x7FFFFFFF) { + sgLastScroll += 50; + if (currTime - sgLastScroll >= 0x7FFFFFFF) { break; } } diff --git a/Source/minitext.h b/Source/minitext.h index 568e51b6f..27b740e5c 100644 --- a/Source/minitext.h +++ b/Source/minitext.h @@ -8,9 +8,7 @@ extern int qtexty; extern char *qtextptr; -extern int qtextSpd; extern BOOLEAN qtextflag; -extern int scrolltexty; extern BYTE *pMedTextCels; extern BYTE *pTextBoxCels; From 23dca91a95b57eddb8a27ca099cfb0c9e53a8210 Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Tue, 14 Apr 2020 05:25:48 +0200 Subject: [PATCH 31/33] docs: add function documentation to appfat.cpp --- Source/appfat.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/Source/appfat.cpp b/Source/appfat.cpp index 90ad6f0ae..b6d38c35a 100644 --- a/Source/appfat.cpp +++ b/Source/appfat.cpp @@ -55,6 +55,9 @@ LONG __stdcall BreakFilter(PEXCEPTION_POINTERS pExc) } #endif +/** + * @brief Returns a formatted error message based on the given error code. + */ char *GetErrorStr(DWORD error_code) { int size; @@ -462,11 +465,17 @@ void TraceErrorDS(HRESULT hError, char *pszBuffer, DWORD dwMaxChars) strncpy(pszBuffer, szError, dwMaxChars); } +/** + * @brief Returns a formatted error message of the last error. + */ char *TraceLastError() { return GetErrorStr(GetLastError()); } +/** + * @brief Terminates the game and displays an error message box. + */ void __cdecl app_fatal(const char *pszFmt, ...) { va_list va; @@ -487,6 +496,9 @@ void __cdecl app_fatal(const char *pszFmt, ...) ExitProcess(1); } +/** + * @brief Displays an error message box based on the given format string and variable argument list. + */ void MsgBox(const char *pszFmt, va_list va) { char Text[256]; @@ -497,6 +509,9 @@ void MsgBox(const char *pszFmt, va_list va) MessageBox(ghMainWnd, Text, "ERROR", MB_TASKMODAL | MB_ICONHAND); } +/** + * @brief Cleans up after a fatal application error. + */ void FreeDlg() { if (terminating && cleanup_thread_id != GetCurrentThreadId()) @@ -516,6 +531,9 @@ void FreeDlg() ShowCursor(TRUE); } +/** + * @brief Displays a warning message box based on the given formatted error message. + */ void __cdecl DrawDlg(char *pszFmt, ...) { char text[256]; @@ -534,6 +552,9 @@ void assert_fail(int nLineNo, const char *pszFile, const char *pszFail) } #endif +/** + * @brief Terminates the game with a DirectDraw assertion message box. + */ void DDErrMsg(DWORD error_code, int log_line_nr, char *log_file_path) { char *msg; @@ -544,6 +565,9 @@ void DDErrMsg(DWORD error_code, int log_line_nr, char *log_file_path) } } +/** + * @brief Terminates the game with a DirectSound assertion message box. + */ void DSErrMsg(DWORD error_code, int log_line_nr, char *log_file_path) { char *msg; @@ -554,6 +578,9 @@ void DSErrMsg(DWORD error_code, int log_line_nr, char *log_file_path) } } +/** + * @brief Centres the given dialog box. + */ void center_window(HWND hDlg) { LONG w, h; @@ -574,6 +601,9 @@ void center_window(HWND hDlg) } } +/** + * @brief Callback function which processes messages sent to the given dialog box. + */ static BOOL CALLBACK FuncDlg(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { @@ -594,7 +624,10 @@ static BOOL CALLBACK FuncDlg(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) return TRUE; } -void ErrDlg(int template_id, DWORD error_code, char *log_file_path, int log_line_nr) +/** + * @brief Terminates the game and displays an error dialog box based on the given dialog_id. + */ +void ErrDlg(int dialog_id, DWORD error_code, char *log_file_path, int log_line_nr) { char *size; LPARAM dwInitParam[128]; @@ -606,12 +639,15 @@ void ErrDlg(int template_id, DWORD error_code, char *log_file_path, int log_line log_file_path = size + 1; wsprintf((LPSTR)dwInitParam, "%s\nat: %s line %d", GetErrorStr(error_code), log_file_path, log_line_nr); - if (DialogBoxParam(ghInst, MAKEINTRESOURCE(template_id), ghMainWnd, FuncDlg, (LPARAM)dwInitParam) == -1) - app_fatal("ErrDlg: %d", template_id); + if (DialogBoxParam(ghInst, MAKEINTRESOURCE(dialog_id), ghMainWnd, FuncDlg, (LPARAM)dwInitParam) == -1) + app_fatal("ErrDlg: %d", dialog_id); app_fatal(NULL); } +/** + * @brief Sets the text of the given dialog. + */ static void TextDlg(HWND hDlg, char *text) { center_window(hDlg); @@ -620,7 +656,10 @@ static void TextDlg(HWND hDlg, char *text) SetDlgItemText(hDlg, 1000, text); } -void ErrOkDlg(int template_id, DWORD error_code, char *log_file_path, int log_line_nr) +/** + * @brief Displays a warning dialog box based on the given dialog_id and error code. + */ +void ErrOkDlg(int dialog_id, DWORD error_code, char *log_file_path, int log_line_nr) { char *size; LPARAM dwInitParam[128]; @@ -630,9 +669,12 @@ void ErrOkDlg(int template_id, DWORD error_code, char *log_file_path, int log_li log_file_path = size + 1; wsprintf((LPSTR)dwInitParam, "%s\nat: %s line %d", GetErrorStr(error_code), log_file_path, log_line_nr); - DialogBoxParam(ghInst, MAKEINTRESOURCE(template_id), ghMainWnd, FuncDlg, (LPARAM)dwInitParam); + DialogBoxParam(ghInst, MAKEINTRESOURCE(dialog_id), ghMainWnd, FuncDlg, (LPARAM)dwInitParam); } +/** + * @brief Terminates the game with a file not found error dialog. + */ void FileErrDlg(const char *error) { FreeDlg(); @@ -646,6 +688,9 @@ void FileErrDlg(const char *error) app_fatal(NULL); } +/** + * @brief Terminates the game with an out of disk space error dialog. + */ void DiskFreeDlg(char *error) { FreeDlg(); @@ -656,6 +701,9 @@ void DiskFreeDlg(char *error) app_fatal(NULL); } +/** + * @brief Terminates the game with an insert CD error dialog. + */ BOOL InsertCDDlg() { int nResult; @@ -671,6 +719,9 @@ BOOL InsertCDDlg() return nResult == IDOK; } +/** + * @brief Terminates the game with a read-only directory error dialog. + */ void DirErrorDlg(char *error) { FreeDlg(); From 452d6d25cc94fe918a1ff522b3770198f3e152c0 Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Tue, 14 Apr 2020 06:51:06 +0200 Subject: [PATCH 32/33] docs: add function documentation to automap.cpp --- Source/automap.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/Source/automap.cpp b/Source/automap.cpp index 557f12ec7..911bc20ce 100644 --- a/Source/automap.cpp +++ b/Source/automap.cpp @@ -45,6 +45,9 @@ int AmLine4; #define MAPFLAG_DIRT 0x40 #define MAPFLAG_STAIRS 0x80 +/** + * @brief Initializes the automap. + */ void InitAutomapOnce() { automapflag = FALSE; @@ -56,6 +59,9 @@ void InitAutomapOnce() AmLine4 = 2; } +/** + * @brief Loads the mapping between tile IDs and automap shapes. + */ void InitAutomap() { BYTE b1, b2; @@ -114,6 +120,9 @@ void InitAutomap() } } +/** + * @brief Displays the automap. + */ void StartAutomap() { AutoMapXOfs = 0; @@ -121,30 +130,45 @@ void StartAutomap() automapflag = TRUE; } +/** + * @brief Scrolls the automap upwards. + */ void AutomapUp() { AutoMapXOfs--; AutoMapYOfs--; } +/** + * @brief Scrolls the automap downwards. + */ void AutomapDown() { AutoMapXOfs++; AutoMapYOfs++; } +/** + * @brief Scrolls the automap leftwards. + */ void AutomapLeft() { AutoMapXOfs--; AutoMapYOfs++; } +/** + * @brief Scrolls the automap rightwards. + */ void AutomapRight() { AutoMapXOfs++; AutoMapYOfs--; } +/** + * @brief Increases the zoom level of the automap. + */ void AutomapZoomIn() { if (AutoMapScale < 200) { @@ -157,6 +181,9 @@ void AutomapZoomIn() } } +/** + * @brief Decreases the zoom level of the automap. + */ void AutomapZoomOut() { if (AutoMapScale > 50) { @@ -169,6 +196,9 @@ void AutomapZoomOut() } } +/** + * @brief Renders the automap on screen. + */ void DrawAutomap() { int cells; @@ -254,6 +284,9 @@ void DrawAutomap() DrawAutomapText(); } +/** + * @brief Renders the given automap shape at the specified screen coordinates. + */ void DrawAutomapTile(int sx, int sy, WORD automap_type) { BOOL do_vert; @@ -439,6 +472,9 @@ void DrawAutomapTile(int sx, int sy, WORD automap_type) } } +/** + * @brief Renders an arrow on the automap, centered on and facing the direction of the player. + */ void DrawAutomapPlr() { int px, py; @@ -511,6 +547,9 @@ void DrawAutomapPlr() } } +/** + * @brief Returns the automap shape at the given coordinate. + */ WORD GetAutomapType(int x, int y, BOOL view) { WORD rv; @@ -552,6 +591,9 @@ WORD GetAutomapType(int x, int y, BOOL view) return rv; } +/** + * @brief Renders game info, such as the name of the current level, and in multi player the name of the game and the game password. + */ void DrawAutomapText() { char desc[256]; @@ -575,6 +617,9 @@ void DrawAutomapText() } } +/** + * @brief Marks the given coordinate as within view on the automap. + */ void SetAutomapView(int x, int y) { WORD maptype, solid; @@ -647,6 +692,9 @@ void SetAutomapView(int x, int y) } } +/** + * @brief Resets the zoom level of the automap. + */ void AutomapZoomReset() { AutoMapXOfs = 0; From 46224337d8ee5353379f9dba7891b990f13672b5 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Tue, 14 Apr 2020 12:29:47 +0200 Subject: [PATCH 33/33] Fix bin diff --- Source/inv.cpp | 12 ++++++++---- Source/items.cpp | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Source/inv.cpp b/Source/inv.cpp index 441d78e2a..618fc8289 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -1710,13 +1710,15 @@ void SyncGetItem(int x, int y, int idx, WORD ci, int iseed) if (itemactive[i] == ii) { DeleteItem(itemactive[i], i); FindGetItem(idx, ci, iseed); - assert(FindGetItem(idx,ci,iseed) == -1); + /// ASSERT: assert(FindGetItem(idx,ci,iseed) == -1); + FindGetItem(idx, ci, iseed); /* todo: replace with above */ i = 0; } else { i++; } } - assert(FindGetItem(idx, ci, iseed) == -1); + /// ASSERT: assert(FindGetItem(idx, ci, iseed) == -1); + FindGetItem(idx, ci, iseed); /* todo: replace with above */ } } @@ -1845,7 +1847,9 @@ int InvPutItem(int pnum, int x, int y) } } - assert(CanPut(x, y)); + CanPut(x, y); //if (!CanPut(x, y)) { + // assertion_failed(1524, "C:\\Diablo\\Direct\\inv.cpp", "CanPut(x,y)"); + //} ii = itemavail[0]; dItem[x][y] = ii + 1; @@ -1912,7 +1916,7 @@ int SyncPutItem(int pnum, int x, int y, int idx, WORD icreateinfo, int iseed, in } } - assert(CanPut(x, y)); + CanPut(x, y); ii = itemavail[0]; dItem[x][y] = ii + 1; diff --git a/Source/items.cpp b/Source/items.cpp index b162a2d08..c49429b85 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -1680,7 +1680,7 @@ void GetItemPower(int i, int minlvl, int maxlvl, int flgs, BOOL onlygood) goe = 0; if (!onlygood && random_(0, 3)) onlygood = TRUE; - if (pre == 0) { + if (!pre) { nt = 0; for (j = 0; PL_Prefix[j].PLPower != -1; j++) { if (flgs & PL_Prefix[j].PLIType) {