Browse Source

Semantic code style cleanups

pull/704/head
Anders Jenbo 6 years ago
parent
commit
d008af43b0
  1. 2
      Source/help.cpp
  2. 18
      Source/init.cpp
  3. 24
      Source/inv.cpp
  4. 53
      Source/items.cpp
  5. 28
      Source/lighting.cpp
  6. 4
      Source/loadsave.cpp
  7. 2
      Source/movie.cpp
  8. 2
      Source/scrollrt.cpp
  9. 16
      Source/setmaps.cpp
  10. 2
      Source/themes.cpp

2
Source/help.cpp

@ -458,7 +458,7 @@ void DrawHelp()
PrintSString(0, 2, TRUE, "Diablo Help", COL_GOLD, 0); PrintSString(0, 2, TRUE, "Diablo Help", COL_GOLD, 0);
DrawSLine(5); DrawSLine(5);
s = gszHelpText; s = &gszHelpText[0];
for (i = 0; i < help_select_line; i++) { for (i = 0; i < help_select_line; i++) {
c = 0; c = 0;

18
Source/init.cpp

@ -27,7 +27,7 @@ char gszProductName[MAX_PATH] = "Diablo v1.09";
void init_cleanup(BOOL show_cursor) void init_cleanup(BOOL show_cursor)
{ {
pfile_flush_W(); pfile_flush_W();
init_disable_screensaver(0); init_disable_screensaver(FALSE);
init_run_office_from_start_menu(); init_run_office_from_start_menu();
if (diabdat_mpq) { if (diabdat_mpq) {
@ -130,7 +130,7 @@ void init_disable_screensaver(BOOLEAN disable)
if (disable) { if (disable) {
cbData = 16; cbData = 16;
success = RegQueryValueEx(phkResult, "ScreenSaveActive", 0, &Type, (LPBYTE)Data, &cbData); success = RegQueryValueEx(phkResult, "ScreenSaveActive", NULL, &Type, (LPBYTE)Data, &cbData);
if (success == ERROR_SUCCESS) if (success == ERROR_SUCCESS)
screensaver_enabled_prev = Data[0] != '0'; screensaver_enabled_prev = Data[0] != '0';
enabled = FALSE; enabled = FALSE;
@ -138,9 +138,9 @@ void init_disable_screensaver(BOOLEAN disable)
enabled = screensaver_enabled_prev; enabled = screensaver_enabled_prev;
} }
Data[1] = 0;
Data[0] = enabled ? '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); RegCloseKey(phkResult);
} }
@ -158,7 +158,7 @@ void init_create_window(int nCmdShow)
wcex.lpfnWndProc = WindowProc; wcex.lpfnWndProc = WindowProc;
wcex.hInstance = ghInst; wcex.hInstance = ghInst;
wcex.hIcon = LoadIcon(ghInst, MAKEINTRESOURCE(IDI_ICON1)); 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.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wcex.lpszMenuName = GAME_NAME; wcex.lpszMenuName = GAME_NAME;
wcex.lpszClassName = "DIABLO"; wcex.lpszClassName = "DIABLO";
@ -183,7 +183,7 @@ void init_create_window(int nCmdShow)
BlackPalette(); BlackPalette();
snd_init(hWnd); snd_init(hWnd);
init_archives(); init_archives();
init_disable_screensaver(1); init_disable_screensaver(TRUE);
} }
void init_kill_mom_parent() void init_kill_mom_parent()
@ -191,7 +191,7 @@ void init_kill_mom_parent()
HWND handle; HWND handle;
handle = init_find_mom_parent(); handle = init_find_mom_parent();
if (handle) { if (handle != NULL) {
PostMessage(handle, WM_CLOSE, 0, 0); PostMessage(handle, WM_CLOSE, 0, 0);
killed_mom_parent = TRUE; killed_mom_parent = TRUE;
} }
@ -223,7 +223,7 @@ void init_await_mom_parent_exit()
} }
do { do {
Sleep(250); Sleep(250);
} while (GetTickCount() - tick <= 4000 && init_find_mom_parent()); } while (GetTickCount() - tick <= 4000 && init_find_mom_parent() != NULL);
} }
void init_archives() void init_archives()
@ -406,7 +406,7 @@ LRESULT __stdcall MainWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
break; break;
case WM_DESTROY: case WM_DESTROY:
init_cleanup(TRUE); init_cleanup(TRUE);
ghMainWnd = 0; ghMainWnd = NULL;
PostQuitMessage(0); PostQuitMessage(0);
break; break;
case WM_PAINT: case WM_PAINT:

24
Source/inv.cpp

@ -26,7 +26,7 @@ int sgdwLastTime; // check name
* 65 66 67 68 69 70 71 72 * 65 66 67 68 69 70 71 72
* @see graphics/inv/inventory.png * @see graphics/inv/inventory.png
*/ */
const InvXY InvRect[73] = { const InvXY InvRect[] = {
// clang-format off // clang-format off
// X, Y // X, Y
{ RIGHT_PANEL + 132, 31 }, // helmet { RIGHT_PANEL + 132, 31 }, // helmet
@ -321,14 +321,14 @@ void DrawInv()
if (plr[myplr].InvBody[INVLOC_HAND_LEFT]._iLoc == ILOC_TWOHAND) { 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); InvDrawSlotBack(RIGHT_PANEL_X + 247, 160 + SCREEN_Y, 2 * INV_SLOT_SIZE_PX, 3 * INV_SLOT_SIZE_PX);
light_table_index = 0; light_table_index = 0;
cel_transparency_active = 1; cel_transparency_active = TRUE;
pBuff = frame_width == INV_SLOT_SIZE_PX pBuff = frame_width == INV_SLOT_SIZE_PX
? &gpBuffer[SCREENXY(RIGHT_PANEL_X + 197, SCREEN_Y)] ? &gpBuffer[SCREENXY(RIGHT_PANEL_X + 197, SCREEN_Y)]
: &gpBuffer[SCREENXY(RIGHT_PANEL_X + 183, SCREEN_Y)]; : &gpBuffer[SCREENXY(RIGHT_PANEL_X + 183, SCREEN_Y)];
CelClippedBlitLightTrans(pBuff, pCursCels, frame, frame_width, 0, 8); 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) { 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) { if (r >= SLOTXY_INV_FIRST && r <= SLOTXY_INV_LAST) {
ig = r - SLOTXY_INV_FIRST; ig = r - SLOTXY_INV_FIRST;
ii = plr[pnum].InvGrid[ig]; ii = plr[pnum].InvGrid[ig];
if (ii) { if (ii != 0) {
iv = ii; iv = ii;
if (ii <= 0) { if (ii <= 0) {
iv = -ii; iv = -ii;
@ -1408,7 +1408,7 @@ void CheckBookLevel(int pnum)
if (plr[pnum].HoldItem._iMiscId == IMISC_BOOK) { if (plr[pnum].HoldItem._iMiscId == IMISC_BOOK) {
plr[pnum].HoldItem._iMinMag = spelldata[plr[pnum].HoldItem._iSpell].sMinInt; plr[pnum].HoldItem._iMinMag = spelldata[plr[pnum].HoldItem._iSpell].sMinInt;
slvl = plr[pnum]._pSplLvl[plr[pnum].HoldItem._iSpell]; slvl = plr[pnum]._pSplLvl[plr[pnum].HoldItem._iSpell];
while (slvl) { while (slvl != 0) {
plr[pnum].HoldItem._iMinMag += 20 * plr[pnum].HoldItem._iMinMag / 100; plr[pnum].HoldItem._iMinMag += 20 * plr[pnum].HoldItem._iMinMag / 100;
slvl--; slvl--;
if (plr[pnum].HoldItem._iMinMag + 20 * plr[pnum].HoldItem._iMinMag / 100 > 255) { 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; quests[Q_ANVIL]._qvar1 = 1;
} }
#ifndef SPAWN #ifndef SPAWN
if (quests[Q_ANVIL]._qlog == 1) { if (quests[Q_ANVIL]._qlog == TRUE) {
sfxdelay = 10; sfxdelay = 10;
if (plr[myplr]._pClass == PC_WARRIOR) { if (plr[myplr]._pClass == PC_WARRIOR) {
sfxdnum = PS_WARR89; sfxdnum = PS_WARR89;
@ -1472,7 +1472,7 @@ void CheckQuestItem(int pnum)
quests[Q_ROCK]._qvar1 = 1; quests[Q_ROCK]._qvar1 = 1;
} }
#ifndef SPAWN #ifndef SPAWN
if (quests[Q_ROCK]._qlog == 1) { if (quests[Q_ROCK]._qlog == TRUE) {
sfxdelay = 10; sfxdelay = 10;
if (plr[myplr]._pClass == PC_WARRIOR) { if (plr[myplr]._pClass == PC_WARRIOR) {
sfxdnum = PS_WARR87; sfxdnum = PS_WARR87;
@ -1508,7 +1508,7 @@ void InvGetItem(int pnum, int ii)
dropGoldValue = 0; 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) if (myplr == pnum && pcurs >= CURSOR_FIRSTITEM)
NetSendCmdPItem(TRUE, CMD_SYNCPUTITEM, plr[myplr]._px, plr[myplr]._py); NetSendCmdPItem(TRUE, CMD_SYNCPUTITEM, plr[myplr]._px, plr[myplr]._py);
item[ii]._iCreateInfo &= ~0x8000; item[ii]._iCreateInfo &= ~0x8000;
@ -1731,7 +1731,7 @@ BOOL CanPut(int x, int y)
if (nSolidTable[dPiece[x][y]]) if (nSolidTable[dPiece[x][y]])
return FALSE; 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) if (object[dObject[x][y] > 0 ? dObject[x][y] - 1 : -1 - dObject[x][y]]._oSolidFlag)
return FALSE; return FALSE;
} }
@ -1994,7 +1994,7 @@ char CheckInvHLight()
pi = &p->InvBody[rv]; pi = &p->InvBody[rv];
} else if (r >= 25 && r <= 64) { } else if (r >= 25 && r <= 64) {
r = abs(p->InvGrid[r - 25]); r = abs(p->InvGrid[r - 25]);
if (!r) if (r == 0)
return -1; return -1;
ii = r - 1; ii = r - 1;
rv = ii + 7; rv = ii + 7;
@ -2131,7 +2131,7 @@ BOOL UseInvItem(int pnum, int cii)
return TRUE; return TRUE;
if (pcurs != CURSOR_HAND) if (pcurs != CURSOR_HAND)
return TRUE; return TRUE;
if (stextflag) if (stextflag != STORE_NONE)
return TRUE; return TRUE;
if (cii <= INVITEM_HAND_RIGHT) if (cii <= INVITEM_HAND_RIGHT)
return FALSE; return FALSE;
@ -2236,7 +2236,7 @@ void DoTelekinesis()
NetSendCmdParam1(TRUE, CMD_OPOBJT, pcursobj); NetSendCmdParam1(TRUE, CMD_OPOBJT, pcursobj);
if (pcursitem != -1) if (pcursitem != -1)
NetSendCmdGItem(TRUE, CMD_REQUESTAGITEM, myplr, myplr, pcursitem); 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); NetSendCmdParam1(TRUE, CMD_KNOCKBACK, pcursmonst);
SetCursor_(CURSOR_HAND); SetCursor_(CURSOR_HAND);
} }

53
Source/items.cpp

@ -203,13 +203,13 @@ void InitItemGFX()
BOOL ItemPlace(int xp, int yp) BOOL ItemPlace(int xp, int yp)
{ {
if (dMonster[xp][yp]) if (dMonster[xp][yp] != 0)
return FALSE; return FALSE;
if (dPlayer[xp][yp]) if (dPlayer[xp][yp] != 0)
return FALSE; return FALSE;
if (dItem[xp][yp]) if (dItem[xp][yp] != 0)
return FALSE; return FALSE;
if (dObject[xp][yp]) if (dObject[xp][yp] != 0)
return FALSE; return FALSE;
if (dFlags[xp][yp] & BFLAG_POPULATED) if (dFlags[xp][yp] & BFLAG_POPULATED)
return FALSE; return FALSE;
@ -469,19 +469,16 @@ void CalcPlrItemVals(int p, BOOL Loadgfx)
lr = 0; lr = 0;
} }
if (mr > 75) { if (mr > MAXRESIST)
mr = 75; mr = MAXRESIST;
}
plr[p]._pMagResist = mr; plr[p]._pMagResist = mr;
if (fr > 75) { if (fr > MAXRESIST)
fr = 75; fr = MAXRESIST;
}
plr[p]._pFireResist = fr; plr[p]._pFireResist = fr;
if (lr > 75) { if (lr > MAXRESIST)
lr = 75; lr = MAXRESIST;
}
plr[p]._pLghtResist = lr; plr[p]._pLghtResist = lr;
if (plr[p]._pClass == PC_WARRIOR) { if (plr[p]._pClass == PC_WARRIOR) {
@ -734,7 +731,7 @@ void CalcPlrBookVals(int p)
{ {
int i, slvl; int i, slvl;
if (!currlevel) { if (currlevel == 0) {
for (i = 1; witchitem[i]._itype != ITYPE_NONE; i++) { for (i = 1; witchitem[i]._itype != ITYPE_NONE; i++) {
WitchBookLevel(i); WitchBookLevel(i);
witchitem[i]._iStatFlag = StoreStatOk(&witchitem[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; plr[p].InvList[i]._iMinMag = spelldata[plr[p].InvList[i]._iSpell].sMinInt;
slvl = plr[p]._pSplLvl[plr[p].InvList[i]._iSpell]; 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; plr[p].InvList[i]._iMinMag += 20 * plr[p].InvList[i]._iMinMag / 100;
slvl--; slvl--;
if (plr[p].InvList[i]._iMinMag + 20 * plr[p].InvList[i]._iMinMag / 100 > 255) { 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); CalcPlrBookVals(p);
CalcPlrScrolls(p); CalcPlrScrolls(p);
CalcPlrStaff(p); CalcPlrStaff(p);
if (p == myplr && !currlevel) if (p == myplr && currlevel == 0)
RecalcStoreStats(); RecalcStoreStats();
} }
} }
@ -879,7 +876,7 @@ void CreatePlrItems(int p)
plr[p]._pNumInv = 0; plr[p]._pNumInv = 0;
pi = plr[p].SpdList; pi = &plr[p].SpdList[0];
for (i = MAXBELTITEMS; i != 0; i--) { for (i = MAXBELTITEMS; i != 0; i--) {
pi->_itype = ITYPE_NONE; pi->_itype = ITYPE_NONE;
pi++; pi++;
@ -967,16 +964,16 @@ BOOL ItemSpaceOk(int i, int j)
if (i < 0 || i >= MAXDUNX || j < 0 || j >= MAXDUNY) if (i < 0 || i >= MAXDUNX || j < 0 || j >= MAXDUNY)
return FALSE; return FALSE;
if (dMonster[i][j]) if (dMonster[i][j] != 0)
return FALSE; return FALSE;
if (dPlayer[i][j]) if (dPlayer[i][j] != 0)
return FALSE; return FALSE;
if (dItem[i][j]) if (dItem[i][j] != 0)
return FALSE; return FALSE;
if (dObject[i][j]) { if (dObject[i][j] != 0) {
oi = dObject[i][j] > 0 ? dObject[i][j] - 1 : -(dObject[i][j] + 1); oi = dObject[i][j] > 0 ? dObject[i][j] - 1 : -(dObject[i][j] + 1);
if (object[oi]._oSolidFlag) if (object[oi]._oSolidFlag)
return FALSE; return FALSE;
@ -1121,7 +1118,7 @@ void GetBookSpell(int i, int lvl)
if (lvl > 5) if (lvl > 5)
lvl = 5; lvl = 5;
#endif #endif
s = 1; s = SPL_FIREBOLT;
while (rv > 0) { while (rv > 0) {
if (spelldata[s].sBookLvl != -1 && lvl >= spelldata[s].sBookLvl) { if (spelldata[s].sBookLvl != -1 && lvl >= spelldata[s].sBookLvl) {
rv--; rv--;
@ -1226,7 +1223,7 @@ void GetStaffSpell(int i, int lvl, BOOL onlygood)
if (lvl > 10) if (lvl > 10)
lvl = 10; lvl = 10;
#endif #endif
s = 1; s = SPL_FIREBOLT;
while (rv > 0) { while (rv > 0) {
if (spelldata[s].sStaffLvl != -1 && l >= spelldata[s].sStaffLvl) { if (spelldata[s].sStaffLvl != -1 && l >= spelldata[s].sStaffLvl) {
rv--; rv--;
@ -1238,7 +1235,7 @@ void GetStaffSpell(int i, int lvl, BOOL onlygood)
if (gbMaxPlayers == 1 && s == SPL_HEALOTHER) if (gbMaxPlayers == 1 && s == SPL_HEALOTHER)
s = SPL_FLARE; s = SPL_FLARE;
if (s == MAX_SPELLS) if (s == MAX_SPELLS)
s = 1; s = SPL_FIREBOLT;
} }
sprintf(istr, "%s of %s", item[i]._iName, spelldata[bs].sNameText); sprintf(istr, "%s of %s", item[i]._iName, spelldata[bs].sNameText);
if (!control_WriteStringToBuffer((BYTE *)istr)) if (!control_WriteStringToBuffer((BYTE *)istr))
@ -1683,7 +1680,7 @@ void GetItemPower(int i, int minlvl, int maxlvl, int flgs, BOOL onlygood)
goe = 0; goe = 0;
if (!onlygood && random_(0, 3)) if (!onlygood && random_(0, 3))
onlygood = TRUE; onlygood = TRUE;
if (!pre) { if (pre == 0) {
nt = 0; nt = 0;
for (j = 0; PL_Prefix[j].PLPower != -1; j++) { for (j = 0; PL_Prefix[j].PLPower != -1; j++) {
if (flgs & PL_Prefix[j].PLIType) { 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)]; preidx = l[random_(23, nt)];
sprintf(istr, "%s %s", PL_Prefix[preidx].PLName, item[i]._iIName); sprintf(istr, "%s %s", PL_Prefix[preidx].PLName, item[i]._iIName);
strcpy(item[i]._iIName, istr); strcpy(item[i]._iIName, istr);
@ -1725,7 +1722,7 @@ void GetItemPower(int i, int minlvl, int maxlvl, int flgs, BOOL onlygood)
nl++; nl++;
} }
} }
if (nl) { if (nl != 0) {
sufidx = l[random_(23, nl)]; sufidx = l[random_(23, nl)];
sprintf(istr, "%s of %s", item[i]._iIName, PL_Suffix[sufidx].PLName); sprintf(istr, "%s of %s", item[i]._iIName, PL_Suffix[sufidx].PLName);
strcpy(item[i]._iIName, istr); 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; return -1;
random_(29, 10); /// BUGFIX: unused, last unique in array always gets chosen random_(29, 10); /// BUGFIX: unused, last unique in array always gets chosen

28
Source/lighting.cpp

@ -994,7 +994,7 @@ void ToggleLighting()
lightflag ^= TRUE; lightflag ^= TRUE;
if (lightflag) { if (lightflag != 0) {
memset(dLight, 0, sizeof(dLight)); memset(dLight, 0, sizeof(dLight));
} else { } else {
memcpy(dLight, dPreLight, sizeof(dLight)); memcpy(dLight, dPreLight, sizeof(dLight));
@ -1033,7 +1033,7 @@ int AddLight(int x, int y, int r)
{ {
int lid; int lid;
if (lightflag) { if (lightflag != 0) {
return -1; return -1;
} }
@ -1046,8 +1046,8 @@ int AddLight(int x, int y, int r)
LightList[lid]._lradius = r; LightList[lid]._lradius = r;
LightList[lid]._xoff = 0; LightList[lid]._xoff = 0;
LightList[lid]._yoff = 0; LightList[lid]._yoff = 0;
LightList[lid]._ldel = 0; LightList[lid]._ldel = FALSE;
LightList[lid]._lunflag = 0; LightList[lid]._lunflag = FALSE;
dolighting = TRUE; dolighting = TRUE;
} }
@ -1060,7 +1060,7 @@ void AddUnLight(int i)
return; return;
} }
LightList[i]._ldel = 1; LightList[i]._ldel = TRUE;
dolighting = TRUE; dolighting = TRUE;
} }
@ -1070,7 +1070,7 @@ void ChangeLightRadius(int i, int r)
return; return;
} }
LightList[i]._lunflag = 1; LightList[i]._lunflag = TRUE;
LightList[i]._lunx = LightList[i]._lx; LightList[i]._lunx = LightList[i]._lx;
LightList[i]._luny = LightList[i]._ly; LightList[i]._luny = LightList[i]._ly;
LightList[i]._lunr = LightList[i]._lradius; LightList[i]._lunr = LightList[i]._lradius;
@ -1084,7 +1084,7 @@ void ChangeLightXY(int i, int x, int y)
return; return;
} }
LightList[i]._lunflag = 1; LightList[i]._lunflag = TRUE;
LightList[i]._lunx = LightList[i]._lx; LightList[i]._lunx = LightList[i]._lx;
LightList[i]._luny = LightList[i]._ly; LightList[i]._luny = LightList[i]._ly;
LightList[i]._lunr = LightList[i]._lradius; LightList[i]._lunr = LightList[i]._lradius;
@ -1099,7 +1099,7 @@ void ChangeLightOff(int i, int x, int y)
return; return;
} }
LightList[i]._lunflag = 1; LightList[i]._lunflag = TRUE;
LightList[i]._lunx = LightList[i]._lx; LightList[i]._lunx = LightList[i]._lx;
LightList[i]._luny = LightList[i]._ly; LightList[i]._luny = LightList[i]._ly;
LightList[i]._lunr = LightList[i]._lradius; LightList[i]._lunr = LightList[i]._lradius;
@ -1114,7 +1114,7 @@ void ChangeLight(int i, int x, int y, int r)
return; return;
} }
LightList[i]._lunflag = 1; LightList[i]._lunflag = TRUE;
LightList[i]._lunx = LightList[i]._lx; LightList[i]._lunx = LightList[i]._lx;
LightList[i]._luny = LightList[i]._ly; LightList[i]._luny = LightList[i]._ly;
LightList[i]._lunr = LightList[i]._lradius; LightList[i]._lunr = LightList[i]._lradius;
@ -1129,7 +1129,7 @@ void ProcessLightList()
int i, j; int i, j;
BYTE temp; BYTE temp;
if (lightflag) { if (lightflag != 0) {
return; return;
} }
@ -1141,7 +1141,7 @@ void ProcessLightList()
} }
if (LightList[j]._lunflag) { if (LightList[j]._lunflag) {
DoUnLight(LightList[j]._lunx, LightList[j]._luny, LightList[j]._lunr); DoUnLight(LightList[j]._lunx, LightList[j]._luny, LightList[j]._lunr);
LightList[j]._lunflag = 0; LightList[j]._lunflag = FALSE;
} }
} }
for (i = 0; i < numlights; i++) { for (i = 0; i < numlights; i++) {
@ -1210,7 +1210,7 @@ void ChangeVisionRadius(int id, int r)
for (i = 0; i < numvision; i++) { for (i = 0; i < numvision; i++) {
if (VisionList[i]._lid == id) { if (VisionList[i]._lid == id) {
VisionList[i]._lunflag = 1; VisionList[i]._lunflag = TRUE;
VisionList[i]._lunx = VisionList[i]._lx; VisionList[i]._lunx = VisionList[i]._lx;
VisionList[i]._luny = VisionList[i]._ly; VisionList[i]._luny = VisionList[i]._ly;
VisionList[i]._lunr = VisionList[i]._lradius; VisionList[i]._lunr = VisionList[i]._lradius;
@ -1226,7 +1226,7 @@ void ChangeVisionXY(int id, int x, int y)
for (i = 0; i < numvision; i++) { for (i = 0; i < numvision; i++) {
if (VisionList[i]._lid == id) { if (VisionList[i]._lid == id) {
VisionList[i]._lunflag = 1; VisionList[i]._lunflag = TRUE;
VisionList[i]._lunx = VisionList[i]._lx; VisionList[i]._lunx = VisionList[i]._lx;
VisionList[i]._luny = VisionList[i]._ly; VisionList[i]._luny = VisionList[i]._ly;
VisionList[i]._lunr = VisionList[i]._lradius; VisionList[i]._lunr = VisionList[i]._lradius;
@ -1249,7 +1249,7 @@ void ProcessVisionList()
} }
if (VisionList[i]._lunflag) { if (VisionList[i]._lunflag) {
DoUnVision(VisionList[i]._lunx, VisionList[i]._luny, VisionList[i]._lunr); DoUnVision(VisionList[i]._lunx, VisionList[i]._luny, VisionList[i]._lunr);
VisionList[i]._lunflag = 0; VisionList[i]._lunflag = FALSE;
} }
} }
for (i = 0; i < TransVal; i++) { for (i = 0; i < TransVal; i++) {

4
Source/loadsave.cpp

@ -521,7 +521,7 @@ void SaveLevel()
int dwLen; int dwLen;
BYTE *SaveBuff; BYTE *SaveBuff;
if (!currlevel) if (currlevel == 0)
glSeedTbl[0] = GetRndSeed(); glSeedTbl[0] = GetRndSeed();
dwLen = codec_get_encoded_len(FILEBUFF); dwLen = codec_get_encoded_len(FILEBUFF);
@ -694,7 +694,7 @@ void LoadLevel()
for (i = 0; i < MAX_PLRS; i++) { for (i = 0; i < MAX_PLRS; i++) {
if (plr[i].plractive && currlevel == plr[i].plrlevel) if (plr[i].plractive && currlevel == plr[i].plrlevel)
LightList[plr[i]._plid]._lunflag = 1; LightList[plr[i]._plid]._lunflag = TRUE;
} }
mem_free_dbg(LoadBuff); mem_free_dbg(LoadBuff);

2
Source/movie.cpp

@ -21,7 +21,7 @@ void play_movie(char *pszMovie, BOOL user_can_close)
} }
saveProc = SetWindowProc(MovieWndProc); saveProc = SetWindowProc(MovieWndProc);
InvalidateRect(ghMainWnd, 0, 0); InvalidateRect(ghMainWnd, NULL, 0);
UpdateWindow(ghMainWnd); UpdateWindow(ghMainWnd);
movie_playing = TRUE; movie_playing = TRUE;
sound_disable_music(TRUE); sound_disable_music(TRUE);

2
Source/scrollrt.cpp

@ -2843,7 +2843,7 @@ void scrollrt_draw_game_screen(BOOL draw_cursor)
unlock_buf(0); unlock_buf(0);
} }
DrawMain(hgt, 0, 0, 0, 0, 0); DrawMain(hgt, FALSE, FALSE, FALSE, FALSE, FALSE);
if (draw_cursor) { if (draw_cursor) {
lock_buf(0); lock_buf(0);

16
Source/setmaps.cpp

@ -61,7 +61,7 @@ char *quest_level_names[] = {
"Bone Chamber", "Bone Chamber",
"Maze", "Maze",
"Poisoned Water Supply", "Poisoned Water Supply",
"Archbishop Lazarus' Lair" "Archbishop Lazarus' Lair",
}; };
int ObjIndex(int x, int y) int ObjIndex(int x, int y)
@ -140,10 +140,10 @@ void LoadSetMap()
LoadPreL1Dungeon("Levels\\L1Data\\SklKng1.DUN", 83, 45); LoadPreL1Dungeon("Levels\\L1Data\\SklKng1.DUN", 83, 45);
LoadL1Dungeon("Levels\\L1Data\\SklKng2.DUN", 83, 45); LoadL1Dungeon("Levels\\L1Data\\SklKng2.DUN", 83, 45);
LoadPalette("Levels\\L1Data\\L1_2.pal"); LoadPalette("Levels\\L1Data\\L1_2.pal");
DRLG_AreaTrans(sizeof(SkelKingTrans1) / 4, SkelKingTrans1); DRLG_AreaTrans(sizeof(SkelKingTrans1) / 4, &SkelKingTrans1[0]);
DRLG_ListTrans(sizeof(SkelKingTrans2) / 4, SkelKingTrans2); DRLG_ListTrans(sizeof(SkelKingTrans2) / 4, &SkelKingTrans2[0]);
DRLG_AreaTrans(sizeof(SkelKingTrans3) / 4, SkelKingTrans3); DRLG_AreaTrans(sizeof(SkelKingTrans3) / 4, &SkelKingTrans3[0]);
DRLG_ListTrans(sizeof(SkelKingTrans4) / 4, SkelKingTrans4); DRLG_ListTrans(sizeof(SkelKingTrans4) / 4, &SkelKingTrans4[0]);
AddL1Objs(0, 0, MAXDUNX, MAXDUNY); AddL1Objs(0, 0, MAXDUNX, MAXDUNY);
AddSKingObjs(); AddSKingObjs();
InitSKingTriggers(); InitSKingTriggers();
@ -152,9 +152,9 @@ void LoadSetMap()
LoadPreL2Dungeon("Levels\\L2Data\\Bonecha2.DUN", 69, 39); LoadPreL2Dungeon("Levels\\L2Data\\Bonecha2.DUN", 69, 39);
LoadL2Dungeon("Levels\\L2Data\\Bonecha1.DUN", 69, 39); LoadL2Dungeon("Levels\\L2Data\\Bonecha1.DUN", 69, 39);
LoadPalette("Levels\\L2Data\\L2_2.pal"); LoadPalette("Levels\\L2Data\\L2_2.pal");
DRLG_ListTrans(sizeof(SkelChamTrans1) / 4, SkelChamTrans1); DRLG_ListTrans(sizeof(SkelChamTrans1) / 4, &SkelChamTrans1[0]);
DRLG_AreaTrans(sizeof(SkelChamTrans2) / 4, SkelChamTrans2); DRLG_AreaTrans(sizeof(SkelChamTrans2) / 4, &SkelChamTrans2[0]);
DRLG_ListTrans(sizeof(SkelChamTrans3) / 4, SkelChamTrans3); DRLG_ListTrans(sizeof(SkelChamTrans3) / 4, &SkelChamTrans3[0]);
AddL2Objs(0, 0, MAXDUNX, MAXDUNY); AddL2Objs(0, 0, MAXDUNX, MAXDUNY);
AddSChamObjs(); AddSChamObjs();
InitSChambTriggers(); InitSChambTriggers();

2
Source/themes.cpp

@ -988,7 +988,7 @@ void UpdateL4Trans()
for (j = 0; j < MAXDUNY; j++) { for (j = 0; j < MAXDUNY; j++) {
for (i = 0; i < MAXDUNX; i++) { for (i = 0; i < MAXDUNX; i++) {
if (dTransVal[i][j]) { if (dTransVal[i][j] != 0) {
dTransVal[i][j] = 1; dTransVal[i][j] = 1;
} }
} }

Loading…
Cancel
Save