Browse Source

Clean up ProcessPlayers (#347)

pull/4/head
Anders Jenbo 8 years ago committed by Robin Eklind
parent
commit
ff2f0bf8ab
  1. 4
      Source/objects.cpp
  2. 24
      Source/player.cpp
  3. 1
      Source/player.h
  4. 4
      structs.h

4
Source/objects.cpp

@ -6622,7 +6622,7 @@ void __fastcall BreakCrux(int i)
object[v1]._oAnimFlag = 1;
object[v1]._oAnimFrame = 1;
object[v1]._oAnimDelay = 1;
object[v1]._oSolidFlag = 1;
object[v1]._oSolidFlag = TRUE;
object[v1]._oMissFlag = 1;
if ( v2 <= 0 )
goto LABEL_15;
@ -6692,7 +6692,7 @@ void __fastcall BreakBarrel(int pnum, int i, int dam, unsigned char forcebreak,
object[v5]._oAnimFlag = 1;
object[v5]._oAnimFrame = 1;
object[v5]._oAnimDelay = 1;
object[v5]._oSolidFlag = 0;
object[v5]._oSolidFlag = FALSE;
object[v5]._oMissFlag = 1;
object[v5]._oSelFlag = 0;
object[v5]._oPreFlag = 1;

24
Source/player.cpp

@ -2152,6 +2152,11 @@ BOOL __fastcall PM_DoStand(int pnum)
return FALSE;
}
BOOL __fastcall PM_DoNewLvl(int pnum)
{
return FALSE;
}
BOOL __fastcall PM_DoWalk(int pnum)
{
if ( (DWORD)pnum >= MAX_PLRS ) {
@ -3436,7 +3441,7 @@ void __cdecl ProcessPlayers()
TermMsg("ProcessPlayers: illegal player %d", myplr);
}
if ( plr[myplr].pLvlLoad ) {
if ( plr[myplr].pLvlLoad > 0 ) {
plr[myplr].pLvlLoad--;
}
@ -3458,7 +3463,7 @@ void __cdecl ProcessPlayers()
}
if ( pnum == myplr ) {
if ( plr[pnum]._pIFlags & ISPL_DRAINLIFE ) {
if ( (plr[pnum]._pIFlags & ISPL_DRAINLIFE) && currlevel ) {
plr[pnum]._pHitPoints -= 4;
plr[pnum]._pHPBase -= 4;
if ( (plr[pnum]._pHitPoints >> 6) <= 0 ) {
@ -3475,8 +3480,7 @@ void __cdecl ProcessPlayers()
BOOL tplayer = FALSE;
do {
switch ( plr[pnum]._pmode )
{
switch ( plr[pnum]._pmode ) {
case PM_STAND:
tplayer = PM_DoStand(pnum);
break;
@ -3498,27 +3502,27 @@ void __cdecl ProcessPlayers()
case PM_BLOCK:
tplayer = PM_DoBlock(pnum);
break;
case PM_SPELL:
tplayer = PM_DoSpell(pnum);
break;
case PM_GOTHIT:
tplayer = PM_DoGotHit(pnum);
break;
case PM_DEATH:
tplayer = PM_DoDeath(pnum);
break;
case PM_SPELL:
tplayer = PM_DoSpell(pnum);
break;
case PM_NEWLVL:
tplayer = PM_DoStand(pnum);
tplayer = PM_DoNewLvl(pnum);
break;
}
CheckNewPath(pnum);
} while ( tplayer );
plr[pnum]._pAnimCnt++;
if ( plr[pnum]._pAnimDelay < plr[pnum]._pAnimCnt ) {
if ( plr[pnum]._pAnimCnt > plr[pnum]._pAnimDelay ) {
plr[pnum]._pAnimCnt = 0;
plr[pnum]._pAnimFrame++;
if ( plr[pnum]._pAnimLen < plr[pnum]._pAnimFrame ) {
if ( plr[pnum]._pAnimFrame > plr[pnum]._pAnimLen ) {
plr[pnum]._pAnimFrame = 1;
}
}

1
Source/player.h

@ -70,6 +70,7 @@ void __fastcall StartNewLvl(int pnum, int fom, int lvl);
void __fastcall RestartTownLvl(int pnum);
void __fastcall StartWarpLvl(int pnum, int pidx);
BOOL __fastcall PM_DoStand(int pnum);
BOOL __fastcall PM_DoNewLvl(int pnum);
BOOL __fastcall PM_DoWalk(int pnum);
BOOL __fastcall PM_DoWalk2(int pnum);
BOOL __fastcall PM_DoWalk3(int pnum);

4
structs.h

@ -661,7 +661,7 @@ struct ObjDataStruct
int oAnimDelay;
int oAnimLen;
int oAnimWidth;
int oSolidFlag;
BOOL oSolidFlag;
int oMissFlag;
int oLightFlag;
char oBreak;
@ -685,7 +685,7 @@ struct ObjectStruct
int _oAnimWidth2;
int _oDelFlag;
char _oBreak; // check
int _oSolidFlag;
BOOL _oSolidFlag;
int _oMissFlag;
char _oSelFlag; // check
int _oPreFlag;

Loading…
Cancel
Save