Browse Source

Use TRUE and FALSE enums for setlevel.

Also simplify if conditions to make
use of boolean values.

(If the cleanup4 PR ends up increasing
inserts/deletions, then this commit is
probably at fault.)
pull/197/head
Robin Eklind 7 years ago
parent
commit
105a583ce0
  1. 5
      Source/diablo.cpp
  2. 2
      Source/gendung.cpp
  3. 2
      Source/loadsave.cpp
  4. 2
      Source/missiles.cpp
  5. 2
      Source/multi.cpp
  6. 4
      Source/objects.cpp
  7. 6
      Source/portal.cpp
  8. 1
      Source/trigs.cpp

5
Source/diablo.cpp

@ -376,7 +376,7 @@ void diablo_parse_flags(char *args)
*/
break;
case 'l':
setlevel = 0;
setlevel = FALSE;
leveldebug = 1;
while (isspace(*args)) {
args++;
@ -440,7 +440,7 @@ void diablo_parse_flags(char *args)
break;
case 't':
leveldebug = 1;
setlevel = 1;
setlevel = TRUE;
while (isspace(*args)) {
args++;
}
@ -1834,7 +1834,6 @@ void LoadGameLevel(BOOL firstflag, int lvldir)
PlaySFX(USFX_SKING1);
}
// 525738: using guessed type int setseed;
// 5CF31D: using guessed type char setlevel;
// 679660: using guessed type char gbMaxPlayers;
void game_loop(BOOL bStartup)

2
Source/gendung.cpp

@ -950,6 +950,6 @@ void InitLevels()
if (!leveldebug) {
currlevel = 0;
leveltype = DTYPE_TOWN;
setlevel = 0;
setlevel = FALSE;
}
}

2
Source/loadsave.cpp

@ -595,7 +595,7 @@ void SaveLevel()
pfile_write_save_file(szName, SaveBuff, tbuff - SaveBuff, dwLen);
mem_free_dbg(SaveBuff);
if (setlevel == 0)
if (!setlevel)
plr[myplr]._pLvlVisited[currlevel] = TRUE;
else
plr[myplr]._pSLvlVisited[setlvlnum] = TRUE;

2
Source/missiles.cpp

@ -1299,7 +1299,7 @@ void AddRndTeleport(int mi, int sx, int sy, int dx, int dy, int midir, char mien
missile[mi]._miVar1 = 0;
missile[mi]._mirange = 2;
if (setlevel == 0 || setlvlnum != SL_VILEBETRAYER) {
if (!setlevel || setlvlnum != SL_VILEBETRAYER) {
missile[mi]._mix = sx + r1;
missile[mi]._miy = sy + r2;
if (!mienemy)

2
Source/multi.cpp

@ -772,7 +772,7 @@ void SetupLocalCoords()
if (!leveldebug || gbMaxPlayers > 1) {
currlevel = 0;
leveltype = DTYPE_TOWN;
setlevel = 0;
setlevel = FALSE;
}
x = 75;
y = 68;

4
Source/objects.cpp

@ -2462,7 +2462,7 @@ void OperateBook(int pnum, int i)
}
object[i]._oAnimFrame++;
object[i]._oSelFlag = 0;
if (setlevel == 0)
if (!setlevel)
return;
if (setlvlnum == SL_BONECHAMB) {
@ -2485,7 +2485,7 @@ void OperateBook(int pnum, int i)
0,
0);
}
if (setlevel != 0 && setlvlnum == SL_VILEBETRAYER) {
if (setlevel && setlvlnum == SL_VILEBETRAYER) {
ObjChangeMapResync(
object[i]._oVar1,
object[i]._oVar2,

6
Source/portal.cpp

@ -121,19 +121,19 @@ void SetCurrentPortal(int p)
void GetPortalLevel()
{
if (currlevel) {
setlevel = 0;
setlevel = FALSE;
currlevel = 0;
plr[myplr].plrlevel = 0;
leveltype = DTYPE_TOWN;
} else {
if (portal[portalindex].setlvl) {
setlevel = 1;
setlevel = TRUE;
setlvlnum = portal[portalindex].level;
currlevel = portal[portalindex].level;
plr[myplr].plrlevel = setlvlnum;
leveltype = portal[portalindex].ltype;
} else {
setlevel = 0;
setlevel = FALSE;
currlevel = portal[portalindex].level;
plr[myplr].plrlevel = currlevel;
leveltype = portal[portalindex].ltype;

1
Source/trigs.cpp

@ -695,7 +695,6 @@ void CheckTrigForce()
ClearPanel();
}
}
// 5CF31D: using guessed type char setlevel;
void CheckTriggers()
{

Loading…
Cancel
Save