- SW: Remove fixed-point math from panel x/y coordinate updating.

This commit is contained in:
Mitchell Richters 2021-07-04 12:00:29 +10:00
parent 8dd0f947f7
commit 27f1e487a2
3 changed files with 81 additions and 360 deletions

View file

@ -777,8 +777,6 @@ SpawnSwordBlur(PANEL_SPRITEp psp)
nsp = pSpawnSprite(psp->PlayerP, NULL, PRI_BACK, psp->x, psp->y); nsp = pSpawnSprite(psp->PlayerP, NULL, PRI_BACK, psp->x, psp->y);
SET(nsp->flags, PANF_WEAPON_SPRITE); SET(nsp->flags, PANF_WEAPON_SPRITE);
nsp->xfract = psp->xfract;
nsp->yfract = psp->yfract;
nsp->ang = psp->ang; nsp->ang = psp->ang;
nsp->vel = psp->vel; nsp->vel = psp->vel;
nsp->PanelSpriteFunc = SwordBlur; nsp->PanelSpriteFunc = SwordBlur;
@ -1011,64 +1009,37 @@ pSwordPresent(PANEL_SPRITEp psp)
void void
pSwordSlide(PANEL_SPRITEp psp) pSwordSlide(PANEL_SPRITEp psp)
{ {
double nx, ny;
short vel_adj;
nx = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
ny = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
if (!cl_nomeleeblur) if (!cl_nomeleeblur)
{ {
SpawnSwordBlur(psp); SpawnSwordBlur(psp);
} }
vel_adj = 24;
nx += psp->vel * synctics * bcosf(psp->ang, -6);
ny += psp->vel * synctics * -bsinf(psp->ang, -6);
psp->ox = psp->x; psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
psp->xfract = LSW(nx); psp->x += psp->vel * synctics * bcosf(psp->ang, -6) * (1. / FRACUNIT);
psp->x = nx * (1. / FRACUNIT); psp->y += psp->vel * synctics * -bsinf(psp->ang, -6) * (1. / FRACUNIT);
psp->yfract = LSW(ny);
psp->y = ny * (1. / FRACUNIT);
psp->vel += vel_adj * synctics; psp->vel += 24 * synctics;
} }
void void
pSwordSlideDown(PANEL_SPRITEp psp) pSwordSlideDown(PANEL_SPRITEp psp)
{ {
double nx, ny;
short vel, vel_adj;
nx = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
ny = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
if (!cl_nomeleeblur) if (!cl_nomeleeblur)
{ {
SpawnSwordBlur(psp); SpawnSwordBlur(psp);
} }
vel_adj = 20;
vel = 2500;
auto ang = SwordAng + psp->ang + psp->PlayerP->SwordAng; auto ang = SwordAng + psp->ang + psp->PlayerP->SwordAng;
nx += psp->vel * synctics * bcosf(ang, -6);
ny += psp->vel * synctics * -bsinf(ang, -6);
psp->ox = psp->x; psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
psp->xfract = LSW(nx); psp->x += psp->vel * synctics * bcosf(ang, -6) * (1. / FRACUNIT);
psp->x = nx * (1. / FRACUNIT); psp->y += psp->vel * synctics * -bsinf(ang, -6) * (1. / FRACUNIT);
psp->yfract = LSW(ny);
psp->y = ny * (1. / FRACUNIT);
psp->vel += vel_adj * synctics; psp->vel += 20 * synctics;
if (psp->x < -40) if (psp->x < -40)
{ {
@ -1085,7 +1056,7 @@ pSwordSlideDown(PANEL_SPRITEp psp)
psp->yorig = psp->y; psp->yorig = psp->y;
psp->ang = 1024; psp->ang = 1024;
psp->PlayerP->SwordAng = SwordAngTable[RANDOM_RANGE(SIZ(SwordAngTable))]; psp->PlayerP->SwordAng = SwordAngTable[RANDOM_RANGE(SIZ(SwordAngTable))];
psp->vel = vel; psp->vel = 2500;
DoPlayerSpriteThrow(psp->PlayerP); DoPlayerSpriteThrow(psp->PlayerP);
return; return;
} }
@ -1106,64 +1077,37 @@ pSwordSlideDown(PANEL_SPRITEp psp)
void void
pSwordSlideR(PANEL_SPRITEp psp) pSwordSlideR(PANEL_SPRITEp psp)
{ {
double nx, ny;
short vel_adj;
nx = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
ny = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
if (!cl_nomeleeblur) if (!cl_nomeleeblur)
{ {
SpawnSwordBlur(psp); SpawnSwordBlur(psp);
} }
vel_adj = 24;
nx += psp->vel * synctics * -bcosf(psp->ang, -6);
ny += psp->vel * synctics * bsinf(psp->ang, -6);
psp->ox = psp->x; psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
psp->xfract = LSW(nx); psp->x += psp->vel * synctics * -bcosf(psp->ang, -6) * (1. / FRACUNIT);
psp->x = nx * (1. / FRACUNIT); psp->y += psp->vel * synctics * bsinf(psp->ang, -6) * (1. / FRACUNIT);
psp->yfract = LSW(ny);
psp->y = ny * (1. / FRACUNIT);
psp->vel += vel_adj * synctics; psp->vel += 24 * synctics;
} }
void void
pSwordSlideDownR(PANEL_SPRITEp psp) pSwordSlideDownR(PANEL_SPRITEp psp)
{ {
double nx, ny;
short vel, vel_adj;
nx = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
ny = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
if (!cl_nomeleeblur) if (!cl_nomeleeblur)
{ {
SpawnSwordBlur(psp); SpawnSwordBlur(psp);
} }
vel_adj = 24;
vel = 2500;
auto ang = SwordAng + psp->ang - psp->PlayerP->SwordAng; auto ang = SwordAng + psp->ang - psp->PlayerP->SwordAng;
nx += psp->vel * synctics * -bcosf(ang, -6);
ny += psp->vel * synctics * bsinf(ang, -6);
psp->ox = psp->x; psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
psp->xfract = LSW(nx); psp->x += psp->vel * synctics * -bcosf(ang, -6) * (1. / FRACUNIT);
psp->x = nx * (1. / FRACUNIT); psp->y += psp->vel * synctics * bsinf(ang, -6) * (1. / FRACUNIT);
psp->yfract = LSW(ny);
psp->y = ny * (1. / FRACUNIT);
psp->vel += vel_adj * synctics; psp->vel += 24 * synctics;
if (psp->x > 350) if (psp->x > 350)
{ {
@ -1180,7 +1124,7 @@ pSwordSlideDownR(PANEL_SPRITEp psp)
psp->yorig = psp->y; psp->yorig = psp->y;
psp->PlayerP->SwordAng = SwordAngTable[RANDOM_RANGE(SIZ(SwordAngTable))]; psp->PlayerP->SwordAng = SwordAngTable[RANDOM_RANGE(SIZ(SwordAngTable))];
psp->ang = 1024; psp->ang = 1024;
psp->vel = vel; psp->vel = 2500;
DoPlayerSpriteThrow(psp->PlayerP); DoPlayerSpriteThrow(psp->PlayerP);
return; return;
} }
@ -1875,44 +1819,21 @@ pSpawnUziReload(PANEL_SPRITEp oclip)
void void
pUziReload(PANEL_SPRITEp nclip) pUziReload(PANEL_SPRITEp nclip)
{ {
double nx, ny;
double x = xs_CRoundToInt(nclip->x * FRACUNIT) | nclip->xfract;
double y = xs_CRoundToInt(nclip->y * FRACUNIT) | nclip->yfract;
PANEL_SPRITEp gun = nclip->sibling; PANEL_SPRITEp gun = nclip->sibling;
double xgun = xs_CRoundToInt(gun->x * FRACUNIT) | gun->xfract;
double ygun = xs_CRoundToInt(gun->y * FRACUNIT) | gun->yfract;
nx = nclip->vel * synctics * bcosf(nclip->ang, -6);
ny = nclip->vel * synctics * -bsinf(nclip->ang, -6);
nclip->vel += 14 * synctics; nclip->vel += 14 * synctics;
x += nx;
y += ny;
nclip->ox = nclip->x; nclip->ox = nclip->x;
nclip->oy = nclip->y; nclip->oy = nclip->y;
nclip->xfract = LSW(x); nclip->x += nclip->vel * synctics * bcosf(nclip->ang, -6) * (1. / FRACUNIT);
nclip->x = x / FRACUNIT; nclip->y += nclip->vel * synctics * -bsinf(nclip->ang, -6) * (1. / FRACUNIT);
nclip->yfract = LSW(y);
nclip->y = y / FRACUNIT;
nx = gun->vel * synctics * bcosf(gun->ang, -6);
ny = gun->vel * synctics * -bsinf(gun->ang, -6);
xgun -= nx;
ygun -= ny;
gun->ox = gun->x; gun->ox = gun->x;
gun->oy = gun->y; gun->oy = gun->y;
gun->xfract = LSW(xgun); gun->x -= gun->vel * synctics * bcosf(gun->ang, -6) * (1. / FRACUNIT);
gun->x = xgun / FRACUNIT; gun->y -= gun->vel * synctics * -bsinf(gun->ang, -6) * (1. / FRACUNIT);
gun->yfract = LSW(ygun);
gun->y = ygun / FRACUNIT;
if (TEST(nclip->flags, PANF_XFLIP)) if (TEST(nclip->flags, PANF_XFLIP))
{ {
@ -1947,41 +1868,24 @@ pUziReload(PANEL_SPRITEp nclip)
void void
pUziReloadRetract(PANEL_SPRITEp nclip) pUziReloadRetract(PANEL_SPRITEp nclip)
{ {
double nx, ny;
double x = xs_CRoundToInt(nclip->x * FRACUNIT) | nclip->xfract;
double y = xs_CRoundToInt(nclip->y * FRACUNIT) | nclip->yfract;
PANEL_SPRITEp gun = nclip->sibling; PANEL_SPRITEp gun = nclip->sibling;
double xgun = xs_CRoundToInt(gun->x * FRACUNIT) | gun->xfract;
double ygun = xs_CRoundToInt(gun->y * FRACUNIT) | gun->yfract;
nx = nclip->vel * synctics * bcosf(nclip->ang, -6); double xadj = nclip->vel * synctics * bcosf(nclip->ang, -6) * (1. / FRACUNIT);
ny = nclip->vel * synctics * -bsinf(nclip->ang, -6); double yadj = nclip->vel * synctics * -bsinf(nclip->ang, -6) * (1. / FRACUNIT);
nclip->vel += 18 * synctics; nclip->vel += 18 * synctics;
x -= nx;
y -= ny;
nclip->ox = nclip->x; nclip->ox = nclip->x;
nclip->oy = nclip->y; nclip->oy = nclip->y;
nclip->xfract = LSW(x); nclip->x -= xadj;
nclip->x = x / FRACUNIT; nclip->y -= yadj;
nclip->yfract = LSW(y);
nclip->y = y / FRACUNIT;
xgun -= nx;
ygun -= ny;
gun->ox = gun->x; gun->ox = gun->x;
gun->oy = gun->y; gun->oy = gun->y;
gun->xfract = LSW(xgun); gun->x -= xadj;
gun->x = xgun / FRACUNIT; gun->y -= yadj;
gun->yfract = LSW(ygun);
gun->y = ygun / FRACUNIT;
if (gun->y > UZI_RELOAD_YOFF + tileHeight(gun->picndx)) if (gun->y > UZI_RELOAD_YOFF + tileHeight(gun->picndx))
{ {
@ -2038,28 +1942,12 @@ pUziDoneReload(PANEL_SPRITEp psp)
void void
pUziClip(PANEL_SPRITEp oclip) pUziClip(PANEL_SPRITEp oclip)
{ {
double nx, ny, ox, oy;
double x = xs_CRoundToInt(oclip->x * FRACUNIT) | oclip->xfract;
double y = xs_CRoundToInt(oclip->y * FRACUNIT) | oclip->yfract;
ox = x;
oy = y;
nx = oclip->vel * synctics * bcosf(oclip->ang, -6);
ny = oclip->vel * synctics * -bsinf(oclip->ang, -6);
oclip->vel += 16 * synctics;
x += nx;
y += ny;
oclip->ox = oclip->x; oclip->ox = oclip->x;
oclip->oy = oclip->y; oclip->oy = oclip->y;
oclip->xfract = LSW(x); oclip->x += oclip->vel * synctics * bcosf(oclip->ang, -6) * (1. / FRACUNIT);
oclip->x = x / FRACUNIT; oclip->y += oclip->vel * synctics * -bsinf(oclip->ang, -6) * (1. / FRACUNIT);
oclip->yfract = LSW(y);
oclip->y = y / FRACUNIT;
if (oclip->y > UZI_RELOAD_YOFF) if (oclip->y > UZI_RELOAD_YOFF)
{ {
@ -2068,24 +1956,18 @@ pUziClip(PANEL_SPRITEp oclip)
// as synctics gets bigger, oclip->x can be way off // as synctics gets bigger, oclip->x can be way off
// when clip goes off the screen - recalc oclip->x from scratch // when clip goes off the screen - recalc oclip->x from scratch
// so it will end up the same for all synctic values // so it will end up the same for all synctic values
for (x = ox, y = oy; oclip->y < UZI_RELOAD_YOFF; ) for (oclip->x = oclip->ox, oclip->y = oclip->oy; oclip->y < UZI_RELOAD_YOFF; )
{ {
x += oclip->vel * bcosf(oclip->ang, -6); oclip->x += oclip->vel * bcosf(oclip->ang, -6) * (1. / FRACUNIT);
y += oclip->vel * -bsinf(oclip->ang, -6); oclip->y += oclip->vel * -bsinf(oclip->ang, -6) * (1. / FRACUNIT);
} }
oclip->xfract = LSW(x);
oclip->x = x / FRACUNIT;
oclip->yfract = LSW(y);
oclip->y = y / FRACUNIT;
oclip->ox = oclip->x; oclip->ox = oclip->x;
oclip->oy = oclip->y = UZI_RELOAD_YOFF; oclip->oy = oclip->y = UZI_RELOAD_YOFF;
gun->vel = 800; gun->vel = 800;
gun->ang = NORM_ANGLE(oclip->ang + 1024); gun->ang = NORM_ANGLE(oclip->ang + 1024);
pSpawnUziReload(oclip); pSpawnUziReload(oclip);
pKillSprite(oclip); pKillSprite(oclip);
} }
@ -2641,8 +2523,6 @@ SpawnShotgunShell(PANEL_SPRITEp psp)
void void
pShotgunShell(PANEL_SPRITEp psp) pShotgunShell(PANEL_SPRITEp psp)
{ {
double x = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
if (TEST(psp->flags, PANF_JUMPING)) if (TEST(psp->flags, PANF_JUMPING))
{ {
DoPanelJump(psp); DoPanelJump(psp);
@ -2652,12 +2532,9 @@ pShotgunShell(PANEL_SPRITEp psp)
DoPanelFall(psp); DoPanelFall(psp);
} }
x += psp->xspeed;
psp->ox = psp->x; psp->ox = psp->x;
psp->xfract = LSW(x); psp->x += psp->xspeed * (1. / FRACUNIT);
psp->x = x / FRACUNIT;
if (psp->x > 320 || psp->x < 0 || psp->y > 200) if (psp->x > 320 || psp->x < 0 || psp->y > 200)
{ {
@ -2839,26 +2716,13 @@ pShotgunSetRecoil(PANEL_SPRITEp psp)
void void
pShotgunRecoilDown(PANEL_SPRITEp psp) pShotgunRecoilDown(PANEL_SPRITEp psp)
{ {
int targetvel; int targetvel = psp->PlayerP->WpnShotgunType == 1 ? 890 : 780;
double x = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
double y = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
if (psp->PlayerP->WpnShotgunType == 1)
targetvel = 890;
else
targetvel = 780;
x += psp->vel * synctics * bcosf(psp->ang, -6);
y += psp->vel * synctics * -bsinf(psp->ang, -6);
psp->ox = psp->x; psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
psp->xfract = LSW(x); psp->x += psp->vel * synctics * bcosf(psp->ang, -6) * (1. / FRACUNIT);
psp->x = x / FRACUNIT; psp->y += psp->vel * synctics * -bsinf(psp->ang, -6) * (1. / FRACUNIT);
psp->yfract = LSW(y);
psp->y = y / FRACUNIT;
psp->vel -= 24 * synctics; psp->vel -= 24 * synctics;
@ -2874,19 +2738,11 @@ pShotgunRecoilDown(PANEL_SPRITEp psp)
void void
pShotgunRecoilUp(PANEL_SPRITEp psp) pShotgunRecoilUp(PANEL_SPRITEp psp)
{ {
double x = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
double y = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
x += psp->vel * synctics * bcosf(psp->ang, -6);
y += psp->vel * synctics * -bsinf(psp->ang, -6);
psp->ox = psp->x; psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
psp->xfract = LSW(x); psp->x += psp->vel * synctics * bcosf(psp->ang, -6) * (1. / FRACUNIT);
psp->x = x / FRACUNIT; psp->y += psp->vel * synctics * -bsinf(psp->ang, -6) * (1. / FRACUNIT);
psp->yfract = LSW(y);
psp->y = y / FRACUNIT;
psp->vel += 15 * synctics; psp->vel += 15 * synctics;
@ -3352,19 +3208,11 @@ pRailSetRecoil(PANEL_SPRITEp psp)
void void
pRailRecoilDown(PANEL_SPRITEp psp) pRailRecoilDown(PANEL_SPRITEp psp)
{ {
double x = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
double y = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
x += psp->vel * synctics * bcosf(psp->ang, -6);
y += psp->vel * synctics * -bsinf(psp->ang, -6);
psp->ox = psp->x; psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
psp->xfract = LSW(x); psp->x += psp->vel * synctics * bcosf(psp->ang, -6) * (1. / FRACUNIT);
psp->x = x / FRACUNIT; psp->y += psp->vel * synctics * -bsinf(psp->ang, -6) * (1. / FRACUNIT);
psp->yfract = LSW(y);
psp->y = y / FRACUNIT;
psp->vel -= 24 * synctics; psp->vel -= 24 * synctics;
@ -3380,19 +3228,11 @@ pRailRecoilDown(PANEL_SPRITEp psp)
void void
pRailRecoilUp(PANEL_SPRITEp psp) pRailRecoilUp(PANEL_SPRITEp psp)
{ {
double x = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
double y = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
x += psp->vel * synctics * bcosf(psp->ang, -6);
y += psp->vel * synctics * -bsinf(psp->ang, -6);
psp->ox = psp->x; psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
psp->xfract = LSW(x); psp->x += psp->vel * synctics * bcosf(psp->ang, -6) * (1. / FRACUNIT);
psp->x = x / FRACUNIT; psp->y += psp->vel * synctics * -bsinf(psp->ang, -6) * (1. / FRACUNIT);
psp->yfract = LSW(y);
psp->y = y / FRACUNIT;
psp->vel += 15 * synctics; psp->vel += 15 * synctics;
@ -4234,19 +4074,11 @@ InitWeaponMicro(PLAYERp pp)
void void
pMicroRecoilDown(PANEL_SPRITEp psp) pMicroRecoilDown(PANEL_SPRITEp psp)
{ {
double x = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
double y = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
x += psp->vel * synctics * bcosf(psp->ang, -6);
y += psp->vel * synctics * -bsinf(psp->ang, -6);
psp->ox = psp->x; psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
psp->xfract = LSW(x); psp->x += psp->vel * synctics * bcosf(psp->ang, -6) * (1. / FRACUNIT);
psp->x = x / FRACUNIT; psp->y += psp->vel * synctics * -bsinf(psp->ang, -6) * (1. / FRACUNIT);
psp->yfract = LSW(y);
psp->y = y / FRACUNIT;
psp->vel -= 24 * synctics; psp->vel -= 24 * synctics;
@ -4262,19 +4094,11 @@ pMicroRecoilDown(PANEL_SPRITEp psp)
void void
pMicroRecoilUp(PANEL_SPRITEp psp) pMicroRecoilUp(PANEL_SPRITEp psp)
{ {
double x = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
double y = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
x += psp->vel * synctics * bcosf(psp->ang, -6);
y += psp->vel * synctics * -bsinf(psp->ang, -6);
psp->ox = psp->x; psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
psp->xfract = LSW(x); psp->x += psp->vel * synctics * bcosf(psp->ang, -6) * (1. / FRACUNIT);
psp->x = x / FRACUNIT; psp->y += psp->vel * synctics * -bsinf(psp->ang, -6) * (1. / FRACUNIT);
psp->yfract = LSW(y);
psp->y = y / FRACUNIT;
psp->vel += 15 * synctics; psp->vel += 15 * synctics;
@ -4985,8 +4809,6 @@ SpawnSmallHeartBlood(PANEL_SPRITEp psp)
void void
pHeartBlood(PANEL_SPRITEp psp) pHeartBlood(PANEL_SPRITEp psp)
{ {
double x = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
if (TEST(psp->flags, PANF_JUMPING)) if (TEST(psp->flags, PANF_JUMPING))
{ {
DoPanelJump(psp); DoPanelJump(psp);
@ -4996,12 +4818,8 @@ pHeartBlood(PANEL_SPRITEp psp)
DoPanelFall(psp); DoPanelFall(psp);
} }
x += psp->xspeed;
psp->ox = psp->x; psp->ox = psp->x;
psp->x += psp->xspeed * (1. / FRACUNIT);
psp->xfract = LSW(x);
psp->x = x / FRACUNIT;
if (psp->x > 320 || psp->x < 0 || psp->y > 200) if (psp->x > 320 || psp->x < 0 || psp->y > 200)
{ {
@ -5029,16 +4847,9 @@ DoBeginPanelJump(PANEL_SPRITEp psp)
int int
DoPanelJump(PANEL_SPRITEp psp) DoPanelJump(PANEL_SPRITEp psp)
{ {
int jump_adj;
double y = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
// precalculate jump value to adjust jump speed by
jump_adj = psp->jump_grav;
// adjust jump speed by gravity - if jump speed greater than 0 player // adjust jump speed by gravity - if jump speed greater than 0 player
// have started falling // have started falling
if ((psp->jump_speed += jump_adj) > 0) if ((psp->jump_speed += psp->jump_grav) > 0)
{ {
// Start falling // Start falling
DoBeginPanelFall(psp); DoBeginPanelFall(psp);
@ -5046,12 +4857,8 @@ DoPanelJump(PANEL_SPRITEp psp)
} }
// adjust height by jump speed // adjust height by jump speed
y += psp->jump_speed * synctics;
psp->oy = psp->y; psp->oy = psp->y;
psp->y += psp->jump_speed * synctics * (1. / FRACUNIT);
psp->yfract = LSW(y);
psp->y = y / FRACUNIT;
return 0; return 0;
} }
@ -5074,18 +4881,12 @@ DoBeginPanelFall(PANEL_SPRITEp psp)
int int
DoPanelFall(PANEL_SPRITEp psp) DoPanelFall(PANEL_SPRITEp psp)
{ {
double y = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
// adjust jump speed by gravity // adjust jump speed by gravity
psp->jump_speed += psp->jump_grav; psp->jump_speed += psp->jump_grav;
// adjust player height by jump speed // adjust player height by jump speed
y += psp->jump_speed * synctics;
psp->oy = psp->y; psp->oy = psp->y;
psp->y += psp->jump_speed * synctics * (1. / FRACUNIT);
psp->yfract = LSW(y);
psp->y = y / FRACUNIT;
return 0; return 0;
} }
@ -5228,19 +5029,11 @@ pGrenadeRecoilDown(PANEL_SPRITEp psp)
{ {
// short picnum = psp->picndx; // short picnum = psp->picndx;
double x = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
double y = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
x += psp->vel * synctics * bcosf(psp->ang, -6);
y += psp->vel * synctics * -bsinf(psp->ang, -6);
psp->ox = psp->x; psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
psp->xfract = LSW(x); psp->x += psp->vel * synctics * bcosf(psp->ang, -6) * (1. / FRACUNIT);
psp->x = x / FRACUNIT; psp->y += psp->vel * synctics * -bsinf(psp->ang, -6) * (1. / FRACUNIT);
psp->yfract = LSW(y);
psp->y = y / FRACUNIT;
psp->vel -= 24 * synctics; psp->vel -= 24 * synctics;
@ -5259,19 +5052,11 @@ pGrenadeRecoilDown(PANEL_SPRITEp psp)
void void
pGrenadeRecoilUp(PANEL_SPRITEp psp) pGrenadeRecoilUp(PANEL_SPRITEp psp)
{ {
double x = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
double y = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
x += psp->vel * synctics * bcosf(psp->ang, -6);
y += psp->vel * synctics * -bsinf(psp->ang, -6);
psp->ox = psp->x; psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
psp->xfract = LSW(x); psp->x += psp->vel * synctics * bcosf(psp->ang, -6) * (1. / FRACUNIT);
psp->x = x / FRACUNIT; psp->y += psp->vel * synctics * -bsinf(psp->ang, -6) * (1. / FRACUNIT);
psp->yfract = LSW(y);
psp->y = y / FRACUNIT;
psp->vel += 15 * synctics; psp->vel += 15 * synctics;
@ -5290,22 +5075,14 @@ pGrenadeRecoilUp(PANEL_SPRITEp psp)
void void
pGrenadePresent(PANEL_SPRITEp psp) pGrenadePresent(PANEL_SPRITEp psp)
{ {
double x = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
double y = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
if (TEST(psp->PlayerP->Flags, PF_WEAPON_RETRACT)) if (TEST(psp->PlayerP->Flags, PF_WEAPON_RETRACT))
return; return;
x += psp->vel * synctics * bcosf(psp->ang, -6);
y += psp->vel * synctics * -bsinf(psp->ang, -6);
psp->ox = psp->x; psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
psp->xfract = LSW(x); psp->x += psp->vel * synctics * bcosf(psp->ang, -6) * (1. / FRACUNIT);
psp->x = x / FRACUNIT; psp->y += psp->vel * synctics * -bsinf(psp->ang, -6) * (1. / FRACUNIT);
psp->yfract = LSW(y);
psp->y = y / FRACUNIT;
psp->rotate_ang = NORM_ANGLE(psp->rotate_ang + (6 * synctics)); psp->rotate_ang = NORM_ANGLE(psp->rotate_ang + (6 * synctics));
@ -5971,8 +5748,6 @@ SpawnFistBlur(PANEL_SPRITEp psp)
nsp = pSpawnSprite(psp->PlayerP, NULL, PRI_BACK, psp->x, psp->y); nsp = pSpawnSprite(psp->PlayerP, NULL, PRI_BACK, psp->x, psp->y);
SET(nsp->flags, PANF_WEAPON_SPRITE); SET(nsp->flags, PANF_WEAPON_SPRITE);
nsp->xfract = psp->xfract;
nsp->yfract = psp->yfract;
nsp->ang = psp->ang; nsp->ang = psp->ang;
nsp->vel = psp->vel; nsp->vel = psp->vel;
nsp->PanelSpriteFunc = FistBlur; nsp->PanelSpriteFunc = FistBlur;
@ -6225,70 +6000,45 @@ pFistPresent(PANEL_SPRITEp psp)
void void
pFistSlide(PANEL_SPRITEp psp) pFistSlide(PANEL_SPRITEp psp)
{ {
//double nx;
double ny;
short vel_adj;
//nx = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
ny = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
if (!cl_nomeleeblur) if (!cl_nomeleeblur)
{ {
SpawnFistBlur(psp); SpawnFistBlur(psp);
} }
vel_adj = 68;
//nx += psp->vel * synctics * bsinf(psp->ang, -6);
ny += psp->vel * synctics * -bsinf(psp->ang, -6);
//psp->ox = psp->x; //psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
//psp->xfract = LSW(nx); //psp->x += psp->vel * synctics * bsinf(psp->ang, -6) * (1. / FRACUNIT);
//psp->x = FixedToFloat(nx); psp->y += psp->vel * synctics * -bsinf(psp->ang, -6) * (1. / FRACUNIT);
psp->yfract = LSW(ny);
psp->y = ny * (1. / FRACUNIT);
psp->vel += vel_adj * synctics; psp->vel += 68 * synctics;
} }
void void
pFistSlideDown(PANEL_SPRITEp psp) pFistSlideDown(PANEL_SPRITEp psp)
{ {
double nx, ny;
short vel, vel_adj;
nx = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
ny = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
if (!cl_nomeleeblur) if (!cl_nomeleeblur)
{ {
SpawnFistBlur(psp); SpawnFistBlur(psp);
} }
vel_adj = 48; short vel = 3500;
vel = 3500;
auto ang = FistAng + psp->ang + psp->PlayerP->FistAng; auto ang = FistAng + psp->ang + psp->PlayerP->FistAng;
if (psp->ActionState == ps_Kick || psp->PlayerP->WpnKungFuMove == 3)
ny += psp->vel * synctics * -bsinf(ang, -6);
else
{
nx -= psp->vel * synctics * bsinf(ang, -6);
ny += psp->vel * synctics * -bsinf(ang, -6) * 3;
}
psp->ox = psp->x; psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
psp->xfract = LSW(nx); if (psp->ActionState == ps_Kick || psp->PlayerP->WpnKungFuMove == 3)
psp->x = nx * (1. / FRACUNIT); {
psp->yfract = LSW(ny); psp->y += psp->vel * synctics * -bsinf(ang, -6) * (1. / FRACUNIT);
psp->y = ny * (1. / FRACUNIT); }
else
{
psp->x -= psp->vel * synctics * bsinf(ang, -6) * (1. / FRACUNIT);
psp->y += psp->vel * synctics * -bsinf(ang, -6) * (1. / FRACUNIT) * 3;
}
psp->vel += vel_adj * synctics; psp->vel += 48 * synctics;
if (psp->y > 440) if (psp->y > 440)
{ {
@ -6354,70 +6104,45 @@ pFistSlideDown(PANEL_SPRITEp psp)
void void
pFistSlideR(PANEL_SPRITEp psp) pFistSlideR(PANEL_SPRITEp psp)
{ {
//double nx
double ny;
short vel_adj;
//nx = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
ny = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
if (!cl_nomeleeblur) if (!cl_nomeleeblur)
{ {
SpawnFistBlur(psp); SpawnFistBlur(psp);
} }
vel_adj = 68;
//nx += psp->vel * synctics * bsinf(psp->ang, -6);
ny += psp->vel * synctics * bsinf(psp->ang, -6);
//psp->ox = psp->x; //psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
//psp->xfract = LSW(nx); //psp->x += psp->vel * synctics * bsinf(psp->ang, -6) * (1. / FRACUNIT);
//psp->x = FixedToFloat(nx); psp->y += psp->vel * synctics * bsinf(psp->ang, -6) * (1. / FRACUNIT);
psp->yfract = LSW(ny);
psp->y = ny * (1. / FRACUNIT);
psp->vel += vel_adj * synctics; psp->vel += 68 * synctics;
} }
void void
pFistSlideDownR(PANEL_SPRITEp psp) pFistSlideDownR(PANEL_SPRITEp psp)
{ {
double nx, ny;
short vel, vel_adj;
nx = xs_CRoundToInt(psp->x * FRACUNIT) | psp->xfract;
ny = xs_CRoundToInt(psp->y * FRACUNIT) | psp->yfract;
if (!cl_nomeleeblur) if (!cl_nomeleeblur)
{ {
SpawnFistBlur(psp); SpawnFistBlur(psp);
} }
vel_adj = 48; short vel = 3500;
vel = 3500;
auto ang = FistAng + psp->ang + psp->PlayerP->FistAng; auto ang = FistAng + psp->ang + psp->PlayerP->FistAng;
if (psp->ActionState == ps_Kick || psp->PlayerP->WpnKungFuMove == 3)
ny += psp->vel * synctics * -bsinf(ang, -6);
else
{
nx -= psp->vel * synctics * bsinf(ang, -6);
ny += psp->vel * synctics * -bsinf(ang, -6) * 3;
}
psp->ox = psp->x; psp->ox = psp->x;
psp->oy = psp->y; psp->oy = psp->y;
psp->xfract = LSW(nx); if (psp->ActionState == ps_Kick || psp->PlayerP->WpnKungFuMove == 3)
psp->x = nx * (1. / FRACUNIT); {
psp->yfract = LSW(ny); psp->y += psp->vel * synctics * -bsinf(ang, -6) * (1. / FRACUNIT);
psp->y = ny * (1. / FRACUNIT); }
else
{
psp->x -= psp->vel * synctics * bsinf(ang, -6) * (1. / FRACUNIT);
psp->y += psp->vel * synctics * -bsinf(ang, -6) * (1. / FRACUNIT) * 3;
}
psp->vel += vel_adj * synctics; psp->vel += 48 * synctics;
if (psp->y > 440) if (psp->y > 440)
{ {

View file

@ -107,9 +107,7 @@ struct PANEL_SPRITEstruct
PANEL_STATEp State, RetractState, PresentState, ActionState, RestState; PANEL_STATEp State, RetractState, PresentState, ActionState, RestState;
PLAYERp PlayerP; PLAYERp PlayerP;
// Do not change the order of this line // Do not change the order of this line
uint16_t xfract;
double x, xorig; double x, xorig;
uint16_t yfract;
double y, yorig; // Do not change the order of this double y, yorig; // Do not change the order of this
// line // line

View file

@ -350,9 +350,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PANEL_SPRITEstruct
("PresentState", w.PresentState) ("PresentState", w.PresentState)
("ActionState", w.ActionState) ("ActionState", w.ActionState)
("RestState", w.RestState) ("RestState", w.RestState)
("xfract", w.xfract)
("x", w.x) ("x", w.x)
("yfract", w.yfract)
("y", w.y) ("y", w.y)
.Array("over", w.over, countof(w.over)) .Array("over", w.over, countof(w.over))
("id", w.ID) ("id", w.ID)