Browse Source

Clean up PM_DoWalk2 && PM_DoWalk3

pull/4/head
Anders Jenbo 8 years ago committed by Dennis Duda
parent
commit
0900211d4a
  1. 203
      Source/player.cpp
  2. 4
      Source/player.h

203
Source/player.cpp

@ -2980,133 +2980,108 @@ BOOL __fastcall PM_DoWalk(int pnum)
} }
// 5BB1ED: using guessed type char leveltype; // 5BB1ED: using guessed type char leveltype;
int __fastcall PM_DoWalk2(int pnum) BOOL __fastcall PM_DoWalk2(int pnum)
{ {
int v1; // ebx if ( (DWORD)pnum >= MAX_PLRS ) {
int v2; // esi
int v3; // eax
int v4; // eax
int result; // eax
v1 = pnum;
if ( (unsigned int)pnum >= MAX_PLRS )
TermMsg("PM_DoWalk2: illegal player %d", pnum); TermMsg("PM_DoWalk2: illegal player %d", pnum);
v2 = v1; }
v3 = plr[v1]._pAnimFrame;
if ( v3 == 3 ) if ( plr[pnum]._pAnimFrame == 3
goto LABEL_8; || (plr[pnum]._pWFrames == 8 && plr[pnum]._pAnimFrame == 7)
if ( plr[v2]._pWFrames != 8 ) || (plr[pnum]._pWFrames != 8 && plr[pnum]._pAnimFrame == 4)
{ ) {
if ( v3 != 4 ) PlaySfxLoc(PS_WALK1, plr[pnum].WorldX, plr[pnum].WorldY);
goto LABEL_9; }
goto LABEL_8;
} int vel = 8;
if ( v3 == 7 ) if ( currlevel ) {
LABEL_8: vel = PWVel[3][plr[pnum]._pClass];
PlaySfxLoc(0, plr[v2].WorldX, plr[v2].WorldY); }
LABEL_9:
v4 = 8; if ( plr[pnum]._pVar8 == vel ) {
if ( currlevel ) dPlayer[plr[pnum]._pVar1][plr[pnum]._pVar2] = 0;
v4 = PWVel[3][SLOBYTE(plr[v2]._pClass)]; if ( leveltype != DTYPE_TOWN ) {
if ( plr[v2]._pVar8 == v4 ) ChangeLightXY(plr[pnum]._plid, plr[pnum].WorldX, plr[pnum].WorldY);
{ ChangeVisionXY(plr[pnum]._pvid, plr[pnum].WorldX, plr[pnum].WorldY);
dPlayer[plr[v2]._pVar1][plr[v2]._pVar2] = 0;
if ( leveltype )
{
ChangeLightXY(plr[v2]._plid, plr[v2].WorldX, plr[v2].WorldY);
ChangeVisionXY(plr[v2]._pvid, plr[v2].WorldX, plr[v2].WorldY);
} }
if ( v1 == myplr && ScrollInfo._sdir )
{ if ( pnum == myplr && ScrollInfo._sdir ) {
ViewX = plr[v2].WorldX - ScrollInfo._sdx; ViewX = plr[pnum].WorldX - ScrollInfo._sdx;
ViewY = plr[v2].WorldY - ScrollInfo._sdy; ViewY = plr[pnum].WorldY - ScrollInfo._sdy;
} }
if ( plr[v2].walkpath[0] == -1 )
StartStand(v1, plr[v2]._pVar3); if ( plr[pnum].walkpath[0] != -1 ) {
else StartWalkStand(pnum);
StartWalkStand(v1); } else {
ClearPlrPVars(v1); StartStand(pnum, plr[pnum]._pVar3);
if ( leveltype ) }
ChangeLightOff(plr[v2]._plid, 0, 0);
result = 1; ClearPlrPVars(pnum);
}
else if ( leveltype != DTYPE_TOWN ) {
{ ChangeLightOff(plr[pnum]._plid, 0, 0);
PM_ChangeOffset(v1); }
result = 0;
return TRUE;
} }
return result;
PM_ChangeOffset(pnum);
return FALSE;
} }
// 5BB1ED: using guessed type char leveltype; // 5BB1ED: using guessed type char leveltype;
int __fastcall PM_DoWalk3(int pnum) BOOL __fastcall PM_DoWalk3(int pnum)
{ {
int v1; // ebx if ( (DWORD)pnum >= MAX_PLRS ) {
int v2; // esi
int v3; // eax
int v4; // eax
int v5; // edx
char *v6; // eax
int v7; // eax
bool v8; // zf
int result; // eax
v1 = pnum;
if ( (unsigned int)pnum >= MAX_PLRS )
TermMsg("PM_DoWalk3: illegal player %d", pnum); TermMsg("PM_DoWalk3: illegal player %d", pnum);
v2 = v1; }
v3 = plr[v1]._pAnimFrame;
if ( v3 == 3 ) if ( plr[pnum]._pAnimFrame == 3
goto LABEL_8; || (plr[pnum]._pWFrames == 8 && plr[pnum]._pAnimFrame == 7)
if ( plr[v2]._pWFrames != 8 ) || (plr[pnum]._pWFrames != 8 && plr[pnum]._pAnimFrame == 4)
{ ) {
if ( v3 != 4 ) PlaySfxLoc(PS_WALK1, plr[pnum].WorldX, plr[pnum].WorldY);
goto LABEL_9; }
goto LABEL_8;
} int vel = 8;
if ( v3 == 7 ) if ( currlevel ) {
LABEL_8: vel = PWVel[3][plr[pnum]._pClass];
PlaySfxLoc(0, plr[v2].WorldX, plr[v2].WorldY); }
LABEL_9:
v4 = 8; if ( plr[pnum]._pVar8 == vel ) {
if ( currlevel ) dPlayer[plr[pnum].WorldX][plr[pnum].WorldY] = 0;
v4 = PWVel[3][SLOBYTE(plr[v2]._pClass)]; dFlags[plr[pnum]._pVar4][plr[pnum]._pVar5] &= 0xDFu;
if ( plr[v2]._pVar8 == v4 ) plr[pnum].WorldX = plr[pnum]._pVar1;
{ plr[pnum].WorldY = plr[pnum]._pVar2;
v5 = plr[v2]._pVar1; dPlayer[plr[pnum]._pVar1][plr[pnum]._pVar2] = pnum + 1;
dPlayer[plr[v2].WorldX][plr[v2].WorldY] = 0;
v6 = &dFlags[plr[v2]._pVar4][plr[v2]._pVar5]; if ( leveltype != DTYPE_TOWN ) {
plr[v2].WorldX = v5; ChangeLightXY(plr[pnum]._plid, plr[pnum]._pVar1, plr[pnum]._pVar2);
*v6 &= 0xDFu; ChangeVisionXY(plr[pnum]._pvid, plr[pnum].WorldX, plr[pnum].WorldY);
v7 = plr[v2]._pVar2;
v8 = leveltype == DTYPE_TOWN;
dPlayer[v5][v7] = v1 + 1;
plr[v2].WorldY = v7;
if ( !v8 )
{
ChangeLightXY(plr[v2]._plid, v5, v7);
ChangeVisionXY(plr[v2]._pvid, plr[v2].WorldX, plr[v2].WorldY);
} }
if ( v1 == myplr && ScrollInfo._sdir )
{ if ( pnum == myplr && ScrollInfo._sdir ) {
ViewX = plr[v2].WorldX - ScrollInfo._sdx; ViewX = plr[pnum].WorldX - ScrollInfo._sdx;
ViewY = plr[v2].WorldY - ScrollInfo._sdy; ViewY = plr[pnum].WorldY - ScrollInfo._sdy;
} }
if ( plr[v2].walkpath[0] == -1 )
StartStand(v1, plr[v2]._pVar3); if ( plr[pnum].walkpath[0] != -1 ) {
else StartWalkStand(pnum);
StartWalkStand(v1); } else {
ClearPlrPVars(v1); StartStand(pnum, plr[pnum]._pVar3);
if ( leveltype ) }
ChangeLightOff(plr[v2]._plid, 0, 0);
result = 1; ClearPlrPVars(pnum);
}
else if ( leveltype != DTYPE_TOWN ) {
{ ChangeLightOff(plr[pnum]._plid, 0, 0);
PM_ChangeOffset(v1); }
result = 0;
return TRUE;
} }
return result;
PM_ChangeOffset(pnum);
return FALSE;
} }
// 5BB1ED: using guessed type char leveltype; // 5BB1ED: using guessed type char leveltype;

4
Source/player.h

@ -71,8 +71,8 @@ void __fastcall RestartTownLvl(int pnum);
void __fastcall StartWarpLvl(int pnum, int pidx); void __fastcall StartWarpLvl(int pnum, int pidx);
BOOL __fastcall PM_DoStand(int pnum); BOOL __fastcall PM_DoStand(int pnum);
BOOL __fastcall PM_DoWalk(int pnum); BOOL __fastcall PM_DoWalk(int pnum);
int __fastcall PM_DoWalk2(int pnum); BOOL __fastcall PM_DoWalk2(int pnum);
int __fastcall PM_DoWalk3(int pnum); BOOL __fastcall PM_DoWalk3(int pnum);
BOOL __fastcall WeaponDur(int pnum, int durrnd); BOOL __fastcall WeaponDur(int pnum, int durrnd);
bool __fastcall PlrHitMonst(int pnum, int m); bool __fastcall PlrHitMonst(int pnum, int m);
bool __fastcall PlrHitPlr(int pnum, char p); bool __fastcall PlrHitPlr(int pnum, char p);

Loading…
Cancel
Save