Browse Source

applied enums to _pmode and untangled ifs

pull/256/head
qndel 7 years ago committed by Anders Jenbo
parent
commit
a17e34c4bf
  1. 8
      Source/missiles.cpp
  2. 2
      Source/player.cpp
  3. 4
      Source/scrollrt.cpp
  4. 2
      Source/spells.cpp

8
Source/missiles.cpp

@ -718,7 +718,7 @@ BOOL PlayerMHit(int pnum, int m, int dist, int mind, int maxd, int mtype, BOOLEA
hper = 30;
}
if (!((plr[pnum]._pmode && plr[pnum]._pmode != PM_ATTACK) || !plr[pnum]._pBlockFlag)) {
if ((plr[pnum]._pmode == PM_STAND || plr[pnum]._pmode == PM_ATTACK) && plr[pnum]._pBlockFlag) {
blk = random(73, 100);
} else {
blk = 100;
@ -885,7 +885,7 @@ BOOL Plr2PlrMHit(int pnum, int p, int mindam, int maxdam, int dist, int mtype, B
if (hit > 95)
hit = 95;
if (hper < hit) {
if (!((plr[p]._pmode && plr[p]._pmode != PM_ATTACK) || !plr[p]._pBlockFlag)) {
if ((plr[p]._pmode == PM_STAND || plr[p]._pmode == PM_ATTACK) && plr[p]._pBlockFlag) {
blkper = random(73, 100);
} else {
blkper = 100;
@ -3011,11 +3011,11 @@ 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 && 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].WorldX == missile[i]._mix && plr[p].WorldY == missile[i]._miy) {
ClrPlrPath(p);
if (p == myplr) {
NetSendCmdParam1(TRUE, CMD_WARP, missile[i]._misource);
plr[p]._pmode = 10;
plr[p]._pmode = PM_NEWLVL;
}
}
}

2
Source/player.cpp

@ -1114,7 +1114,7 @@ void StartWalkStand(int pnum)
app_fatal("StartWalkStand: illegal player %d", pnum);
}
plr[pnum]._pmode = 0;
plr[pnum]._pmode = PM_STAND;
plr[pnum]._px = plr[pnum].WorldX;
plr[pnum]._py = plr[pnum].WorldY;
plr[pnum]._pxoff = 0;

4
Source/scrollrt.cpp

@ -238,7 +238,7 @@ void DrawPlayer(int pnum, int x, int y, int px, int py, BYTE *pCelBuff, int nCel
if (nCel < 1 || pFrameTable[0] > 50 || nCel > (int)pFrameTable[0]) {
/*
const char *szMode = "unknown action";
if(plr[pnum]._pmode <= 11)
if(plr[pnum]._pmode <= PM_QUIT)
szMode = szPlrModeAssert[plr[pnum]._pmode];
app_fatal(
"Drawing player %d \"%s\" %s: facing %d, frame %d of %d",
@ -311,7 +311,7 @@ void DrawClippedPlayer(int pnum, int x, int y, int px, int py, BYTE *pCelBuff, i
if (nCel < 1 || pFrameTable[0] > 50 || nCel > (int)pFrameTable[0]) {
/*
const char *szMode = "unknown action";
if(plr[pnum]._pmode <= 11)
if(plr[pnum]._pmode <= PM_QUIT)
szMode = szPlrModeAssert[plr[pnum]._pmode];
app_fatal(
"Drawing player %d \"%s\" %s clipped: facing %d, frame %d of %d",

2
Source/spells.cpp

@ -185,7 +185,7 @@ void DoResurrect(int pnum, int rid)
if (plr[rid].plrlevel == currlevel) {
StartStand(rid, plr[rid]._pdir);
} else {
plr[rid]._pmode = 0;
plr[rid]._pmode = PM_STAND;
}
}
}

Loading…
Cancel
Save