Browse Source

Strip eflag logic now that it is fixed in the render

pull/691/head
Anders Jenbo 6 years ago
parent
commit
f7de4c46a7
  1. 6
      Source/diablo.cpp
  2. 8
      Source/loadsave.cpp
  3. 52
      Source/monster.cpp
  4. 70
      Source/player.cpp

6
Source/diablo.cpp

@ -1272,12 +1272,6 @@ void PressChar(int vkey)
case 'd':
PrintDebugPlayer(FALSE);
return;
case 'e':
if (debug_mode_key_d) {
sprintf(tempstr, "EFlag = %i", plr[myplr]._peflag);
NetSendCmdString(1 << myplr, tempstr);
}
return;
case 'L':
case 'l':
if (debug_mode_key_inverted_v) {

8
Source/loadsave.cpp

@ -309,7 +309,7 @@ void LoadPlayer(int i)
CopyInt(tbuff, &pPlayer->_pAnimFrame);
CopyInt(tbuff, &pPlayer->_pAnimWidth);
CopyInt(tbuff, &pPlayer->_pAnimWidth2);
CopyInt(tbuff, &pPlayer->_peflag);
tbuff += 4; // Skip _peflag
CopyInt(tbuff, &pPlayer->_plid);
CopyInt(tbuff, &pPlayer->_pvid);
@ -504,7 +504,7 @@ void LoadMonster(int i)
CopyInt(tbuff, &pMonster->_mAnimCnt);
CopyInt(tbuff, &pMonster->_mAnimLen);
CopyInt(tbuff, &pMonster->_mAnimFrame);
CopyInt(tbuff, &pMonster->_meflag);
tbuff += 4; // Skip _meflag
CopyInt(tbuff, &pMonster->_mDelFlag);
CopyInt(tbuff, &pMonster->_mVar1);
CopyInt(tbuff, &pMonster->_mVar2);
@ -1034,7 +1034,7 @@ void SavePlayer(int i)
CopyInt(&pPlayer->_pAnimFrame, tbuff);
CopyInt(&pPlayer->_pAnimWidth, tbuff);
CopyInt(&pPlayer->_pAnimWidth2, tbuff);
CopyInt(&pPlayer->_peflag, tbuff);
tbuff += 4; // Skip _peflag
CopyInt(&pPlayer->_plid, tbuff);
CopyInt(&pPlayer->_pvid, tbuff);
@ -1230,7 +1230,7 @@ void SaveMonster(int i)
CopyInt(&pMonster->_mAnimCnt, tbuff);
CopyInt(&pMonster->_mAnimLen, tbuff);
CopyInt(&pMonster->_mAnimFrame, tbuff);
CopyInt(&pMonster->_meflag, tbuff);
tbuff += 4; // Skip _meflag
CopyInt(&pMonster->_mDelFlag, tbuff);
CopyInt(&pMonster->_mVar1, tbuff);
CopyInt(&pMonster->_mVar2, tbuff);

52
Source/monster.cpp

@ -1204,39 +1204,6 @@ int M_GetDir(int i)
return GetDirection(monster[i]._mx, monster[i]._my, monster[i]._menemyx, monster[i]._menemyy);
}
void M_CheckEFlag(int i)
{
int f, j;
int x, y;
WORD *m;
x = monster[i]._mx - 1;
y = monster[i]._my + 1;
if (x < 0 || y >= MAXDUNY) {
monster[i]._meflag = FALSE;
return;
}
f = 0;
// BUGFIX check (x > 0 && y < MAXDUNY) (fixed)
m = dpiece_defs_map_2[x][y].mt;
if (m >= dpiece_defs_map_2[0][0].mt) {
for (j = 2; j < 10; j++) {
f |= m[j];
}
} else {
monster[i]._meflag = FALSE;
return;
}
if (f | dSpecial[x][y])
monster[i]._meflag = TRUE;
else {
monster[i]._meflag = FALSE;
}
}
void M_StartStand(int i, int md)
{
ClearMVars(i);
@ -1254,7 +1221,6 @@ void M_StartStand(int i, int md)
monster[i]._moldx = monster[i]._mx;
monster[i]._moldy = monster[i]._my;
monster[i]._mdir = md;
M_CheckEFlag(i);
M_Enemy(i);
}
@ -1281,7 +1247,6 @@ void M_StartSpStand(int i, int md)
monster[i]._moldx = monster[i]._mx;
monster[i]._moldy = monster[i]._my;
monster[i]._mdir = md;
M_CheckEFlag(i);
}
void M_StartWalk(int i, int xvel, int yvel, int xadd, int yadd, int EndDir)
@ -1305,7 +1270,6 @@ void M_StartWalk(int i, int xvel, int yvel, int xadd, int yadd, int EndDir)
monster[i]._mVar6 = 0;
monster[i]._mVar7 = 0;
monster[i]._mVar8 = 0;
M_CheckEFlag(i);
}
void M_StartWalk2(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int yadd, int EndDir)
@ -1336,7 +1300,6 @@ void M_StartWalk2(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int y
monster[i]._mVar6 = 16 * xoff;
monster[i]._mVar7 = 16 * yoff;
monster[i]._mVar8 = 0;
M_CheckEFlag(i);
}
void M_StartWalk3(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int yadd, int mapx, int mapy, int EndDir)
@ -1371,7 +1334,6 @@ void M_StartWalk3(int i, int xvel, int yvel, int xoff, int yoff, int xadd, int y
monster[i]._mVar6 = 16 * xoff;
monster[i]._mVar7 = 16 * yoff;
monster[i]._mVar8 = 0;
M_CheckEFlag(i);
}
void M_StartAttack(int i)
@ -1386,7 +1348,6 @@ void M_StartAttack(int i)
monster[i]._moldx = monster[i]._mx;
monster[i]._moldy = monster[i]._my;
monster[i]._mdir = md;
M_CheckEFlag(i);
}
void M_StartRAttack(int i, int missile_type, int dam)
@ -1403,7 +1364,6 @@ void M_StartRAttack(int i, int missile_type, int dam)
monster[i]._moldx = monster[i]._mx;
monster[i]._moldy = monster[i]._my;
monster[i]._mdir = md;
M_CheckEFlag(i);
}
void M_StartRSpAttack(int i, int missile_type, int dam)
@ -1421,7 +1381,6 @@ void M_StartRSpAttack(int i, int missile_type, int dam)
monster[i]._moldx = monster[i]._mx;
monster[i]._moldy = monster[i]._my;
monster[i]._mdir = md;
M_CheckEFlag(i);
}
void M_StartSpAttack(int i)
@ -1436,7 +1395,6 @@ void M_StartSpAttack(int i)
monster[i]._moldx = monster[i]._mx;
monster[i]._moldy = monster[i]._my;
monster[i]._mdir = md;
M_CheckEFlag(i);
}
void M_StartEat(int i)
@ -1449,7 +1407,6 @@ void M_StartEat(int i)
monster[i]._mfuty = monster[i]._my;
monster[i]._moldx = monster[i]._mx;
monster[i]._moldy = monster[i]._my;
M_CheckEFlag(i);
}
void M_ClearSquares(int i)
@ -1494,7 +1451,6 @@ void M_GetKnockback(int i)
// BUGFIX useless assignment
monster[i]._moldx = monster[i]._mx;
monster[i]._moldy = monster[i]._my;
M_CheckEFlag(i);
M_ClearSquares(i);
dMonster[monster[i]._mx][monster[i]._my] = i + 1;
}
@ -1531,7 +1487,6 @@ void M_StartHit(int i, int pnum, int dam)
monster[i]._my = monster[i]._moldy;
monster[i]._mfutx = monster[i]._moldx;
monster[i]._mfuty = monster[i]._moldy;
M_CheckEFlag(i);
M_ClearSquares(i);
dMonster[monster[i]._mx][monster[i]._my] = i + 1;
}
@ -1571,7 +1526,6 @@ void M_DiabloDeath(int i, BOOL sendmsg)
monster[k]._mmode = MM_DEATH;
monster[k]._mx = _moldx;
monster[k]._mfutx = _moldx;
M_CheckEFlag(k);
M_ClearSquares(k);
dMonster[pmonster->_mx][pmonster->_my] = k + 1;
}
@ -1630,7 +1584,6 @@ void M2MStartHit(int mid, int i, int dam)
monster[mid]._my = monster[mid]._moldy;
monster[mid]._mfutx = monster[mid]._moldx;
monster[mid]._mfuty = monster[mid]._moldy;
M_CheckEFlag(mid);
M_ClearSquares(mid);
dMonster[monster[mid]._mx][monster[mid]._my] = mid + 1;
}
@ -1679,7 +1632,6 @@ void MonstStartKill(int i, int pnum, BOOL sendmsg)
monster[i]._my = monster[i]._moldy;
monster[i]._mfutx = monster[i]._moldx;
monster[i]._mfuty = monster[i]._moldy;
M_CheckEFlag(i);
M_ClearSquares(i);
dMonster[monster[i]._mx][monster[i]._my] = i + 1;
CheckQuestKill(i, sendmsg);
@ -1735,7 +1687,6 @@ void M2MStartKill(int i, int mid)
monster[mid]._my = monster[mid]._moldy;
monster[mid]._mfutx = monster[mid]._moldx;
monster[mid]._mfuty = monster[mid]._moldy;
M_CheckEFlag(mid);
M_ClearSquares(mid);
dMonster[monster[mid]._mx][monster[mid]._my] = mid + 1;
CheckQuestKill(mid, TRUE);
@ -1802,7 +1753,6 @@ void M_StartFadein(int i, int md, BOOL backwards)
monster[i]._mfuty = monster[i]._my;
monster[i]._moldx = monster[i]._mx;
monster[i]._moldy = monster[i]._my;
M_CheckEFlag(i);
monster[i]._mdir = md;
monster[i]._mFlags &= ~MFLAG_HIDDEN;
if (backwards) {
@ -1826,7 +1776,6 @@ void M_StartFadeout(int i, int md, BOOL backwards)
monster[i]._mfuty = monster[i]._my;
monster[i]._moldx = monster[i]._mx;
monster[i]._moldy = monster[i]._my;
M_CheckEFlag(i);
monster[i]._mdir = md;
if (backwards) {
monster[i]._mFlags |= MFLAG_LOCK_ANIMATION;
@ -2489,7 +2438,6 @@ void M_Teleport(int i)
Monst->_moldx = x;
Monst->_moldy = y;
Monst->_mdir = M_GetDir(i);
M_CheckEFlag(i);
}
}

70
Source/player.cpp

@ -882,7 +882,6 @@ void InitPlayer(int pnum, BOOL FirstTime)
}
plr[pnum]._pdir = DIR_S;
plr[pnum]._peflag = 0;
if (pnum == myplr) {
if (!FirstTime || currlevel != 0) {
@ -957,62 +956,6 @@ void InitMultiView()
ViewY = plr[myplr].WorldY;
}
void CheckEFlag(int pnum, BOOL flag)
{
int x, y, i;
int bitflags;
MICROS *pieces;
if ((DWORD)pnum >= MAX_PLRS) {
app_fatal("InitPlayer: illegal player %d", pnum);
}
x = plr[pnum].WorldX - 1;
y = plr[pnum].WorldY + 1;
bitflags = 0;
pieces = &dpiece_defs_map_2[x][y];
for (i = 2; i < 10; i++) {
bitflags |= pieces->mt[i];
}
if (bitflags | nSolidTable[dPiece[x][y]] | dSpecial[x][y]) {
plr[pnum]._peflag = 1;
} else {
plr[pnum]._peflag = 0;
}
if (flag != 1 || plr[pnum]._peflag != 1) {
return;
}
x = plr[pnum].WorldX;
y = plr[pnum].WorldY + 2;
bitflags = 0;
pieces = &dpiece_defs_map_2[x][y];
for (i = 2; i < 10; i++) {
bitflags |= pieces->mt[i];
}
if (bitflags | dSpecial[x][y]) {
return;
}
x = plr[pnum].WorldX - 2;
y = plr[pnum].WorldY + 1;
bitflags = 0;
pieces = &dpiece_defs_map_2[x][y];
for (i = 2; i < 10; i++) {
bitflags |= pieces->mt[i];
}
if (bitflags | dSpecial[x][y]) {
plr[pnum]._peflag = 2;
}
}
BOOL SolidLoc(int x, int y)
{
if (x < 0 || y < 0 || x >= MAXDUNX || y >= MAXDUNY) {
@ -1100,7 +1043,6 @@ void FixPlayerLocation(int pnum, int bDir)
plr[pnum]._ptargy = plr[pnum].WorldY;
plr[pnum]._pxoff = 0;
plr[pnum]._pyoff = 0;
CheckEFlag(pnum, FALSE);
plr[pnum]._pdir = bDir;
if (pnum == myplr) {
ScrollInfo._sxoff = 0;
@ -1145,8 +1087,6 @@ void StartWalkStand(int pnum)
plr[pnum]._pxoff = 0;
plr[pnum]._pyoff = 0;
CheckEFlag(pnum, FALSE);
if (pnum == myplr) {
ScrollInfo._sxoff = 0;
ScrollInfo._syoff = 0;
@ -1277,8 +1217,6 @@ void StartWalk(int pnum, int xvel, int yvel, int xadd, int yadd, int EndDir, int
plr[pnum]._pVar7 = 0;
plr[pnum]._pVar8 = 0;
CheckEFlag(pnum, FALSE);
if (pnum != myplr) {
return;
}
@ -1355,12 +1293,6 @@ void StartWalk2(int pnum, int xvel, int yvel, int xoff, int yoff, int xadd, int
plr[pnum]._pdir = EndDir;
plr[pnum]._pVar8 = 0;
if (EndDir == DIR_SE) {
CheckEFlag(pnum, TRUE);
} else {
CheckEFlag(pnum, FALSE);
}
if (pnum != myplr) {
return;
}
@ -1442,8 +1374,6 @@ void StartWalk3(int pnum, int xvel, int yvel, int xoff, int yoff, int xadd, int
plr[pnum]._pdir = EndDir;
plr[pnum]._pVar8 = 0;
CheckEFlag(pnum, FALSE);
if (pnum != myplr) {
return;
}

Loading…
Cancel
Save