- SW: Factor out bob coordinate backups.

This commit is contained in:
Mitchell Richters 2021-07-04 12:32:26 +10:00
parent 9575f8a3d3
commit 55cef642b6
2 changed files with 37 additions and 48 deletions

View file

@ -1014,7 +1014,7 @@ pSwordPresent(PANEL_SPRITEp psp)
if (psp->y < SWORD_YOFF)
{
psp->oy = psp->y = SWORD_YOFF;
psp->yorig = psp->y;
psp->backupboby();
pSetState(psp, psp->RestState);
}
}
@ -1068,7 +1068,7 @@ pSwordSlideDown(PANEL_SPRITEp psp)
pStatePlusOne(psp);
psp->ox = psp->x = SWORDR_XOFF;
psp->oy = psp->y = SWORD_YOFF;
psp->yorig = psp->y;
psp->backupboby();
psp->ang = 1024;
psp->PlayerP->SwordAng = SwordAngTable[RANDOM_RANGE(SIZ(SwordAngTable))];
psp->vel = 2500;
@ -1081,7 +1081,7 @@ pSwordSlideDown(PANEL_SPRITEp psp)
pSetState(psp, psp->PresentState);
psp->ox = psp->x = SWORD_XOFF;
psp->oy = psp->y = SWORD_YOFF + tileHeight(psp->picndx);
psp->yorig = psp->y;
psp->backupboby();
}
}
@ -1134,7 +1134,7 @@ pSwordSlideDownR(PANEL_SPRITEp psp)
pStatePlusOne(psp);
psp->ox = psp->x = SWORD_XOFF + 80;
psp->oy = psp->y = SWORD_YOFF;
psp->yorig = psp->y;
psp->backupboby();
psp->PlayerP->SwordAng = SwordAngTable[RANDOM_RANGE(SIZ(SwordAngTable))];
psp->ang = 1024;
psp->vel = 2500;
@ -1147,7 +1147,7 @@ pSwordSlideDownR(PANEL_SPRITEp psp)
pSetState(psp, psp->PresentState);
psp->ox = psp->x = SWORD_XOFF;
psp->oy = psp->y = SWORD_YOFF + tileHeight(psp->picndx);
psp->yorig = psp->y;
psp->backupboby();
}
}
@ -1157,8 +1157,7 @@ pSwordBobSetup(PANEL_SPRITEp psp)
if (TEST(psp->flags, PANF_BOB))
return;
psp->xorig = psp->x;
psp->yorig = psp->y;
psp->backupbobcoords();
psp->sin_amt = SWORD_SWAY_AMT;
psp->sin_ndx = 0;
@ -1443,8 +1442,7 @@ pStarBobSetup(PANEL_SPRITEp psp)
if (TEST(psp->flags, PANF_BOB))
return;
psp->xorig = psp->x;
psp->yorig = psp->y;
psp->backupbobcoords();
psp->sin_amt = 10;
psp->sin_ndx = 0;
@ -1457,8 +1455,7 @@ pLStarBobSetup(PANEL_SPRITEp psp)
if (TEST(psp->flags, PANF_BOB))
return;
psp->xorig = psp->x;
psp->yorig = psp->y;
psp->backupbobcoords();
psp->sin_amt = 6;
psp->sin_ndx = 0;
@ -2154,8 +2151,7 @@ pUziPresent(PANEL_SPRITEp psp)
psp->oy = psp->y = UZI_YOFF;
psp->backupx();
psp->xorig = psp->x;
psp->yorig = psp->y;
psp->backupbobcoords();
pSetState(psp, psp->RestState);
}
}
@ -2176,8 +2172,7 @@ pUziPresentReload(PANEL_SPRITEp psp)
{
psp->oy = psp->y = UZI_YOFF;
psp->backupx();
psp->xorig = psp->x;
psp->yorig = psp->y;
psp->backupbobcoords();
pSetState(psp, psp->RestState);
}
}
@ -2188,8 +2183,7 @@ pUziBobSetup(PANEL_SPRITEp psp)
if (TEST(psp->flags, PANF_BOB))
return;
psp->xorig = psp->x;
psp->yorig = psp->y;
psp->backupbobcoords();
psp->sin_amt = 12;
psp->sin_ndx = 0;
@ -2826,7 +2820,7 @@ pShotgunPresent(PANEL_SPRITEp psp)
if (psp->y < SHOTGUN_YOFF)
{
psp->oy = psp->y = SHOTGUN_YOFF;
psp->yorig = psp->y;
psp->backupboby();
pSetState(psp, psp->RestState);
}
}
@ -2837,8 +2831,7 @@ pShotgunBobSetup(PANEL_SPRITEp psp)
if (TEST(psp->flags, PANF_BOB))
return;
psp->xorig = psp->x;
psp->yorig = psp->y;
psp->backupbobcoords();
psp->sin_amt = 12;
psp->sin_ndx = 0;
@ -3274,7 +3267,7 @@ pRailPresent(PANEL_SPRITEp psp)
if (psp->y < RAIL_YOFF)
{
psp->oy = psp->y = RAIL_YOFF;
psp->yorig = psp->y;
psp->backupboby();
pSetState(psp, psp->RestState);
}
}
@ -3285,8 +3278,7 @@ pRailBobSetup(PANEL_SPRITEp psp)
if (TEST(psp->flags, PANF_BOB))
return;
psp->xorig = psp->x;
psp->yorig = psp->y;
psp->backupbobcoords();
psp->sin_amt = 12;
psp->sin_ndx = 0;
@ -3696,7 +3688,7 @@ pHotheadPresent(PANEL_SPRITEp psp)
if (psp->y < HOTHEAD_YOFF)
{
psp->oy = psp->y = HOTHEAD_YOFF;
psp->yorig = psp->y;
psp->backupboby();
pSetState(psp, psp->RestState);
//pSetState(psp, HotheadTurnStates[psp->PlayerP->WpnFlameType]);
}
@ -3708,8 +3700,7 @@ pHotheadBobSetup(PANEL_SPRITEp psp)
if (TEST(psp->flags, PANF_BOB))
return;
psp->xorig = psp->x;
psp->yorig = psp->y;
psp->backupbobcoords();
psp->sin_amt = HOTHEAD_BOB_X_AMT;
psp->sin_ndx = 0;
@ -4140,7 +4131,7 @@ pMicroPresent(PANEL_SPRITEp psp)
if (psp->y < MICRO_YOFF)
{
psp->oy = psp->y = MICRO_YOFF;
psp->yorig = psp->y;
psp->backupboby();
if (pp->WpnRocketType == 2 && !pp->NukeInitialized)
{
pp->TestNukeInit = false;
@ -4157,8 +4148,7 @@ pMicroBobSetup(PANEL_SPRITEp psp)
if (TEST(psp->flags, PANF_BOB))
return;
psp->xorig = psp->x;
psp->yorig = psp->y;
psp->backupbobcoords();
psp->sin_amt = MICRO_BOB_X_AMT;
psp->sin_ndx = 0;
@ -4404,7 +4394,7 @@ pNukeAction(PANEL_SPRITEp psp)
if (psp->y < MICRO_YOFF)
{
psp->oy = psp->y = MICRO_YOFF;
psp->yorig = psp->y;
psp->backupboby();
}
#endif
@ -4564,7 +4554,7 @@ pHeartPresent(PANEL_SPRITEp psp)
if (psp->y < HEART_YOFF)
{
psp->oy = psp->y = HEART_YOFF;
psp->yorig = psp->y;
psp->backupboby();
pSetState(psp, psp->RestState);
}
}
@ -4575,8 +4565,7 @@ pHeartBobSetup(PANEL_SPRITEp psp)
if (TEST(psp->flags, PANF_BOB))
return;
psp->xorig = psp->x;
psp->yorig = psp->y;
psp->backupbobcoords();
psp->sin_amt = 12;
psp->sin_ndx = 0;
@ -5098,7 +5087,7 @@ pGrenadePresent(PANEL_SPRITEp psp)
psp->ox = psp->x = GRENADE_XOFF;
psp->oy = psp->y = GRENADE_YOFF;
psp->rotate_ang = 0;
psp->yorig = psp->y;
psp->backupboby();
pSetState(psp, psp->RestState);
}
}
@ -5109,8 +5098,7 @@ pGrenadeBobSetup(PANEL_SPRITEp psp)
if (TEST(psp->flags, PANF_BOB))
return;
psp->xorig = psp->x;
psp->yorig = psp->y;
psp->backupbobcoords();
psp->sin_amt = 12;
psp->sin_ndx = 0;
@ -5349,7 +5337,7 @@ pMinePresent(PANEL_SPRITEp psp)
{
psp->oy = psp->y = MINE_YOFF;
psp->rotate_ang = 0;
psp->yorig = psp->y;
psp->backupboby();
pSetState(psp, psp->RestState);
}
}
@ -5360,8 +5348,7 @@ pMineBobSetup(PANEL_SPRITEp psp)
if (TEST(psp->flags, PANF_BOB))
return;
psp->xorig = psp->x;
psp->yorig = psp->y;
psp->backupbobcoords();
psp->sin_amt = 12;
psp->sin_ndx = 0;
@ -5978,7 +5965,7 @@ pFistPresent(PANEL_SPRITEp psp)
if (psp->y < FIST_YOFF)
{
psp->oy = psp->y = FIST_YOFF;
psp->yorig = psp->y;
psp->backupboby();
rnd = RANDOM_RANGE(1000);
if (rnd > 500)
@ -6065,7 +6052,7 @@ pFistSlideDown(PANEL_SPRITEp psp)
psp->ox = psp->x = FIST_XOFF;
psp->oy = psp->y = FIST_YOFF;
psp->yorig = psp->y;
psp->backupboby();
psp->PlayerP->FistAng = FistAngTable[RANDOM_RANGE(SIZ(FistAngTable))];
psp->ang = 1024;
psp->vel = vel;
@ -6081,7 +6068,7 @@ pFistSlideDown(PANEL_SPRITEp psp)
psp->ox = psp->x = FISTR_XOFF+100;
psp->oy = psp->y = FIST_YOFF;
psp->yorig = psp->y;
psp->backupboby();
psp->ang = 1024;
psp->PlayerP->FistAng = FistAngTable[RANDOM_RANGE(SIZ(FistAngTable))];
psp->vel = vel;
@ -6094,7 +6081,7 @@ pFistSlideDown(PANEL_SPRITEp psp)
pSetState(psp, psp->PresentState);
psp->ox = psp->x = FIST_XOFF;
psp->oy = psp->y = FIST_YOFF + tileHeight(psp->picndx);
psp->yorig = psp->y;
psp->backupboby();
}
}
@ -6161,7 +6148,7 @@ pFistSlideDownR(PANEL_SPRITEp psp)
psp->ox = psp->x = FISTR_XOFF+100;
psp->oy = psp->y = FIST_YOFF;
psp->yorig = psp->y;
psp->backupboby();
psp->ang = 1024;
psp->PlayerP->FistAng = FistAngTable[RANDOM_RANGE(SIZ(FistAngTable))];
psp->vel = vel;
@ -6177,7 +6164,7 @@ pFistSlideDownR(PANEL_SPRITEp psp)
psp->ox = psp->x = FIST_XOFF;
psp->oy = psp->y = FIST_YOFF;
psp->yorig = psp->y;
psp->backupboby();
psp->PlayerP->FistAng = FistAngTable[RANDOM_RANGE(SIZ(FistAngTable))];
psp->ang = 1024;
psp->vel = vel;
@ -6190,7 +6177,7 @@ pFistSlideDownR(PANEL_SPRITEp psp)
pSetState(psp, psp->PresentState);
psp->ox = psp->x = FIST_XOFF;
psp->oy = psp->y = FIST_YOFF + tileHeight(psp->picndx);
psp->yorig = psp->y;
psp->backupboby();
}
}
@ -6200,8 +6187,7 @@ pFistBobSetup(PANEL_SPRITEp psp)
if (TEST(psp->flags, PANF_BOB))
return;
psp->xorig = psp->x;
psp->yorig = psp->y;
psp->backupbobcoords();
psp->sin_amt = FIST_SWAY_AMT;
psp->sin_ndx = 0;

View file

@ -137,6 +137,9 @@ struct PANEL_SPRITEstruct
void backupx() { ox = x; };
void backupy() { oy = y; };
void backupcoords() { backupx(); backupy(); };
void backupbobx() { xorig = x; };
void backupboby() { yorig = y; };
void backupbobcoords() { backupbobx(); backupboby(); };
};
typedef struct