- Duke: Replace player_struct posxv with vel.X calls.

This commit is contained in:
Mitchell Richters 2021-12-30 22:14:55 +11:00
parent 10a167ab42
commit 31ed257f39
11 changed files with 72 additions and 72 deletions

View file

@ -759,11 +759,11 @@ int ifhitbyweapon_d(DDukeActor *actor)
case SEENINE: case SEENINE:
case OOZFILTER: case OOZFILTER:
case EXPLODINGBARREL: case EXPLODINGBARREL:
ps[p].posxv += actor->extra * bcos(actor->ang, 2); ps[p].vel.X += actor->extra * bcos(actor->ang, 2);
ps[p].posyv += actor->extra * bsin(actor->ang, 2); ps[p].posyv += actor->extra * bsin(actor->ang, 2);
break; break;
default: default:
ps[p].posxv += actor->extra * bcos(actor->ang, 1); ps[p].vel.X += actor->extra * bcos(actor->ang, 1);
ps[p].posyv += actor->extra * bsin(actor->ang, 1); ps[p].posyv += actor->extra * bsin(actor->ang, 1);
break; break;
} }
@ -1985,7 +1985,7 @@ void movetransports_d(void)
ps[p].opos.Z = ps[p].pos.Z = ps[p].opos.Z = ps[p].pos.Z =
Owner->sector()->ceilingz + (7 << 8); Owner->sector()->ceilingz + (7 << 8);
ps[p].posxv = 4096 - (krand() & 8192); ps[p].vel.X = 4096 - (krand() & 8192);
ps[p].posyv = 4096 - (krand() & 8192); ps[p].posyv = 4096 - (krand() & 8192);
} }
@ -3699,7 +3699,7 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
{ {
int newx, newy; int newx, newy;
newx = ps[playernum].pos.X + (ps[playernum].posxv / 768); newx = ps[playernum].pos.X + (ps[playernum].vel.X / 768);
newy = ps[playernum].pos.Y + (ps[playernum].posyv / 768); newy = ps[playernum].pos.Y + (ps[playernum].posyv / 768);
goalang = getangle(newx - actor->spr.pos.X, newy - actor->spr.pos.Y); goalang = getangle(newx - actor->spr.pos.X, newy - actor->spr.pos.Y);
angdif = getincangle(actor->spr.ang, goalang) >> 2; angdif = getincangle(actor->spr.ang, goalang) >> 2;
@ -3805,12 +3805,12 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (xvel < 512) if (xvel < 512)
{ {
ps[playernum].posxv = 0; ps[playernum].vel.X = 0;
ps[playernum].posyv = 0; ps[playernum].posyv = 0;
} }
else else
{ {
ps[playernum].posxv = MulScale(ps[playernum].posxv, gs.playerfriction - 0x2000, 16); ps[playernum].vel.X = MulScale(ps[playernum].vel.X, gs.playerfriction - 0x2000, 16);
ps[playernum].posyv = MulScale(ps[playernum].posyv, gs.playerfriction - 0x2000, 16); ps[playernum].posyv = MulScale(ps[playernum].posyv, gs.playerfriction - 0x2000, 16);
} }
} }

View file

@ -683,11 +683,11 @@ int ifhitbyweapon_r(DDukeActor *actor)
case EXPLODINGBARREL: case EXPLODINGBARREL:
case TRIPBOMBSPRITE: case TRIPBOMBSPRITE:
case RPG2: case RPG2:
ps[p].posxv += actor->extra * bcos(actor->ang, 2); ps[p].vel.X += actor->extra * bcos(actor->ang, 2);
ps[p].posyv += actor->extra * bsin(actor->ang, 2); ps[p].posyv += actor->extra * bsin(actor->ang, 2);
break; break;
default: default:
ps[p].posxv += actor->extra * bcos(actor->ang, 1); ps[p].vel.X += actor->extra * bcos(actor->ang, 1);
ps[p].posyv += actor->extra * bsin(actor->ang, 1); ps[p].posyv += actor->extra * bsin(actor->ang, 1);
break; break;
} }
@ -3744,7 +3744,7 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
{ {
int newx, newy; int newx, newy;
newx = ps[pnum].pos.X + (ps[pnum].posxv / 768); newx = ps[pnum].pos.X + (ps[pnum].vel.X / 768);
newy = ps[pnum].pos.Y + (ps[pnum].posyv / 768); newy = ps[pnum].pos.Y + (ps[pnum].posyv / 768);
goalang = getangle(newx - actor->spr.pos.X, newy - actor->spr.pos.Y); goalang = getangle(newx - actor->spr.pos.X, newy - actor->spr.pos.Y);
angdif = getincangle(actor->spr.ang, goalang) >> 2; angdif = getincangle(actor->spr.ang, goalang) >> 2;
@ -3854,12 +3854,12 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (xvel < 512) if (xvel < 512)
{ {
ps[pnum].posxv = 0; ps[pnum].vel.X = 0;
ps[pnum].posyv = 0; ps[pnum].posyv = 0;
} }
else else
{ {
ps[pnum].posxv = MulScale(ps[pnum].posxv, gs.playerfriction - 0x2000, 16); ps[pnum].vel.X = MulScale(ps[pnum].vel.X, gs.playerfriction - 0x2000, 16);
ps[pnum].posyv = MulScale(ps[pnum].posyv, gs.playerfriction - 0x2000, 16); ps[pnum].posyv = MulScale(ps[pnum].posyv, gs.playerfriction - 0x2000, 16);
} }
} }

View file

@ -403,8 +403,8 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break; break;
case PLAYER_POSXV: case PLAYER_POSXV:
if (bSet) ps[iPlayer].posxv = lValue; if (bSet) ps[iPlayer].vel.X = lValue;
else SetGameVarID(lVar2, ps[iPlayer].posxv, sActor, sPlayer); else SetGameVarID(lVar2, ps[iPlayer].vel.X, sActor, sPlayer);
break; break;
case PLAYER_POSYV: case PLAYER_POSYV:
@ -2276,7 +2276,7 @@ int ParseState::parse(void)
ps[g_p].footprintcount = 0; ps[g_p].footprintcount = 0;
ps[g_p].weapreccnt = 0; ps[g_p].weapreccnt = 0;
ps[g_p].ftq = 0; ps[g_p].ftq = 0;
ps[g_p].posxv = ps[g_p].posyv = 0; ps[g_p].vel.X = ps[g_p].posyv = 0;
if (!isRR()) ps[g_p].angle.orotscrnang = ps[g_p].angle.rotscrnang = buildang(0); if (!isRR()) ps[g_p].angle.orotscrnang = ps[g_p].angle.rotscrnang = buildang(0);
ps[g_p].falling_counter = 0; ps[g_p].falling_counter = 0;
@ -2473,7 +2473,7 @@ int ParseState::parse(void)
case concmd_slapplayer: case concmd_slapplayer:
insptr++; insptr++;
forceplayerangle(g_p); forceplayerangle(g_p);
ps[g_p].posxv -= ps[g_p].angle.ang.bcos(7); ps[g_p].vel.X -= ps[g_p].angle.ang.bcos(7);
ps[g_p].posyv -= ps[g_p].angle.ang.bsin(7); ps[g_p].posyv -= ps[g_p].angle.ang.bsin(7);
return 0; return 0;
case concmd_wackplayer: case concmd_wackplayer:
@ -2482,7 +2482,7 @@ int ParseState::parse(void)
forceplayerangle(g_p); forceplayerangle(g_p);
else else
{ {
ps[g_p].posxv -= ps[g_p].angle.ang.bcos(10); ps[g_p].vel.X -= ps[g_p].angle.ang.bcos(10);
ps[g_p].posyv -= ps[g_p].angle.ang.bsin(10); ps[g_p].posyv -= ps[g_p].angle.ang.bsin(10);
ps[g_p].jumping_counter = 767; ps[g_p].jumping_counter = 767;
ps[g_p].jumping_toggle = 1; ps[g_p].jumping_toggle = 1;

View file

@ -1086,7 +1086,7 @@ DEFINE_FIELD_X(DukePlayer, player_struct, bobposy)
//DEFINE_FIELD_X(DukePlayer, player_struct, oposz) //DEFINE_FIELD_X(DukePlayer, player_struct, oposz)
DEFINE_FIELD_X(DukePlayer, player_struct, pyoff) DEFINE_FIELD_X(DukePlayer, player_struct, pyoff)
DEFINE_FIELD_X(DukePlayer, player_struct, opyoff) DEFINE_FIELD_X(DukePlayer, player_struct, opyoff)
DEFINE_FIELD_X(DukePlayer, player_struct, posxv) //DEFINE_FIELD_X(DukePlayer, player_struct, posxv)
DEFINE_FIELD_X(DukePlayer, player_struct, posyv) DEFINE_FIELD_X(DukePlayer, player_struct, posyv)
DEFINE_FIELD_X(DukePlayer, player_struct, poszv) DEFINE_FIELD_X(DukePlayer, player_struct, poszv)
DEFINE_FIELD_X(DukePlayer, player_struct, last_pissed_time) DEFINE_FIELD_X(DukePlayer, player_struct, last_pissed_time)

View file

@ -1917,7 +1917,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz, int
{ {
p->jumping_counter = 0; p->jumping_counter = 0;
if (p->poszv < 0) if (p->poszv < 0)
p->posxv = p->posyv = 0; p->vel.X = p->posyv = 0;
p->poszv = 128; p->poszv = 128;
p->pos.Z = cz + (4 << 8); p->pos.Z = cz + (4 << 8);
} }
@ -2783,7 +2783,7 @@ void processinput_d(int snum)
else if (badguy(clz.actor()) && clz.actor()->spr.xrepeat > 24 && abs(pact->spr.pos.Z - clz.actor()->spr.pos.Z) < (84 << 8)) else if (badguy(clz.actor()) && clz.actor()->spr.xrepeat > 24 && abs(pact->spr.pos.Z - clz.actor()->spr.pos.Z) < (84 << 8))
{ {
j = getangle(clz.actor()->spr.pos.X - p->pos.X, clz.actor()->spr.pos.Y - p->pos.Y); j = getangle(clz.actor()->spr.pos.X - p->pos.X, clz.actor()->spr.pos.Y - p->pos.Y);
p->posxv -= bcos(j, 4); p->vel.X -= bcos(j, 4);
p->posyv -= bsin(j, 4); p->posyv -= bsin(j, 4);
} }
} }
@ -2829,7 +2829,7 @@ void processinput_d(int snum)
if (p->newOwner != nullptr) if (p->newOwner != nullptr)
{ {
p->posxv = p->posyv = pact->spr.xvel = 0; p->vel.X = p->posyv = pact->spr.xvel = 0;
fi.doincrements(p); fi.doincrements(p);
@ -2876,7 +2876,7 @@ void processinput_d(int snum)
if (movementBlocked(p)) if (movementBlocked(p))
{ {
doubvel = 0; doubvel = 0;
p->posxv = 0; p->vel.X = 0;
p->posyv = 0; p->posyv = 0;
} }
else if (SyncInput()) else if (SyncInput())
@ -2928,7 +2928,7 @@ void processinput_d(int snum)
} }
} }
if (p->posxv || p->posyv || sb_fvel || sb_svel) if (p->vel.X || p->posyv || sb_fvel || sb_svel)
{ {
p->crack_time = CRACK_TIME; p->crack_time = CRACK_TIME;
@ -2970,7 +2970,7 @@ void processinput_d(int snum)
if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400) if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400)
doubvel <<= 1; doubvel <<= 1;
p->posxv += ((sb_fvel * doubvel) << 6); p->vel.X += ((sb_fvel * doubvel) << 6);
p->posyv += ((sb_svel * doubvel) << 6); p->posyv += ((sb_svel * doubvel) << 6);
bool check; bool check;
@ -2979,30 +2979,30 @@ void processinput_d(int snum)
else check = ((aplWeaponWorksLike(p->curr_weapon, snum) == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH))); else check = ((aplWeaponWorksLike(p->curr_weapon, snum) == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH)));
if (check) if (check)
{ {
p->posxv = MulScale(p->posxv, gs.playerfriction - 0x2000, 16); p->vel.X = MulScale(p->vel.X, gs.playerfriction - 0x2000, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction - 0x2000, 16); p->posyv = MulScale(p->posyv, gs.playerfriction - 0x2000, 16);
} }
else else
{ {
if (psectlotag == 2) if (psectlotag == 2)
{ {
p->posxv = MulScale(p->posxv, gs.playerfriction - 0x1400, 16); p->vel.X = MulScale(p->vel.X, gs.playerfriction - 0x1400, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1400, 16); p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1400, 16);
} }
else else
{ {
p->posxv = MulScale(p->posxv, gs.playerfriction, 16); p->vel.X = MulScale(p->vel.X, gs.playerfriction, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction, 16); p->posyv = MulScale(p->posyv, gs.playerfriction, 16);
} }
} }
if (abs(p->posxv) < 2048 && abs(p->posyv) < 2048) if (abs(p->vel.X) < 2048 && abs(p->posyv) < 2048)
p->posxv = p->posyv = 0; p->vel.X = p->posyv = 0;
if (shrunk) if (shrunk)
{ {
p->posxv = p->vel.X =
MulScale(p->posxv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16); MulScale(p->vel.X, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
p->posyv = p->posyv =
MulScale(p->posyv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16); MulScale(p->posyv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
} }
@ -3019,13 +3019,13 @@ HORIZONLY:
Collision clip{}; Collision clip{};
if (ud.clipping) if (ud.clipping)
{ {
p->pos.X += p->posxv >> 14; p->pos.X += p->vel.X >> 14;
p->pos.Y += p->posyv >> 14; p->pos.Y += p->posyv >> 14;
updatesector(p->pos.X, p->pos.Y, &p->cursector); updatesector(p->pos.X, p->pos.Y, &p->cursector);
ChangeActorSect(pact, p->cursector); ChangeActorSect(pact, p->cursector);
} }
else else
clipmove(p->pos, &p->cursector, p->posxv, p->posyv, 164, (4 << 8), ii, CLIPMASK0, clip); clipmove(p->pos, &p->cursector, p->vel.X, p->posyv, 164, (4 << 8), ii, CLIPMASK0, clip);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk) if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
p->pos.Z += 32 << 8; p->pos.Z += 32 << 8;

View file

@ -1323,7 +1323,7 @@ int doincrements_r(struct player_struct* p)
{ {
p->noise_radius = 16384; p->noise_radius = 16384;
madenoise(screenpeek); madenoise(screenpeek);
p->posxv += p->angle.ang.bcos(4); p->vel.X += p->angle.ang.bcos(4);
p->posyv += p->angle.ang.bsin(4); p->posyv += p->angle.ang.bsin(4);
} }
p->eat -= 4; p->eat -= 4;
@ -1798,7 +1798,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
} }
} }
p->posxv += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4); p->vel.X += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4); p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
p->angle.addadjustment(getincanglebam(p->angle.ang, p->angle.ang - bamang(angAdjustment))); p->angle.addadjustment(getincanglebam(p->angle.ang, p->angle.ang - bamang(angAdjustment)));
} }
@ -1807,7 +1807,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
rng = krand() & 1; rng = krand() & 1;
velAdjustment = rng == 0 ? -10 : 10; velAdjustment = rng == 0 ? -10 : 10;
currSpeed = MulScale(currSpeed, p->moto_on_oil ? 10 : 5, 7); currSpeed = MulScale(currSpeed, p->moto_on_oil ? 10 : 5, 7);
p->posxv += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4); p->vel.X += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4); p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
} }
@ -2042,7 +2042,7 @@ static void onBoat(int snum, ESyncBits &actions)
angAdjustment >>= 6; angAdjustment >>= 6;
} }
p->posxv += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4); p->vel.X += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4); p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
p->angle.addadjustment(getincanglebam(p->angle.ang, p->angle.ang - bamang(angAdjustment))); p->angle.addadjustment(getincanglebam(p->angle.ang, p->angle.ang - bamang(angAdjustment)));
} }
@ -2274,7 +2274,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz, int
{ {
p->jumping_counter = 0; p->jumping_counter = 0;
if (p->poszv < 0) if (p->poszv < 0)
p->posxv = p->posyv = 0; p->vel.X = p->posyv = 0;
p->poszv = 128; p->poszv = 128;
p->pos.Z = cz + (4 << 8); p->pos.Z = cz + (4 << 8);
} }
@ -2798,7 +2798,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
p->visibility = 0; p->visibility = 0;
if (psectlotag != 857) if (psectlotag != 857)
{ {
p->posxv -= p->angle.ang.bcos(4); p->vel.X -= p->angle.ang.bcos(4);
p->posyv -= p->angle.ang.bsin(4); p->posyv -= p->angle.ang.bsin(4);
} }
} }
@ -2898,13 +2898,13 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
if (psectlotag != 857) if (psectlotag != 857)
{ {
p->posxv -= p->angle.ang.bcos(5); p->vel.X -= p->angle.ang.bcos(5);
p->posyv -= p->angle.ang.bsin(5); p->posyv -= p->angle.ang.bsin(5);
} }
} }
else if (psectlotag != 857) else if (psectlotag != 857)
{ {
p->posxv -= p->angle.ang.bcos(4); p->vel.X -= p->angle.ang.bcos(4);
p->posyv -= p->angle.ang.bsin(4); p->posyv -= p->angle.ang.bsin(4);
} }
} }
@ -2992,7 +2992,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
if (psectlotag != 857) if (psectlotag != 857)
{ {
p->posxv -= p->angle.ang.bcos(4); p->vel.X -= p->angle.ang.bcos(4);
p->posyv -= p->angle.ang.bsin(4); p->posyv -= p->angle.ang.bsin(4);
} }
checkavailweapon(p); checkavailweapon(p);
@ -3133,7 +3133,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
} }
else if (p->kickback_pic == 12) else if (p->kickback_pic == 12)
{ {
p->posxv -= p->angle.ang.bcos(4); p->vel.X -= p->angle.ang.bcos(4);
p->posyv -= p->angle.ang.bsin(4); p->posyv -= p->angle.ang.bsin(4);
p->horizon.addadjustment(20); p->horizon.addadjustment(20);
p->recoil += 20; p->recoil += 20;
@ -3183,7 +3183,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
} }
if (p->kickback_pic < 30) if (p->kickback_pic < 30)
{ {
p->posxv += p->angle.ang.bcos(4); p->vel.X += p->angle.ang.bcos(4);
p->posyv += p->angle.ang.bsin(4); p->posyv += p->angle.ang.bsin(4);
} }
p->kickback_pic++; p->kickback_pic++;
@ -3474,7 +3474,7 @@ void processinput_r(int snum)
else if (badguy(clz.actor()) && clz.actor()->spr.xrepeat > 24 && abs(pact->spr.pos.Z - clz.actor()->spr.pos.Z) < (84 << 8)) else if (badguy(clz.actor()) && clz.actor()->spr.xrepeat > 24 && abs(pact->spr.pos.Z - clz.actor()->spr.pos.Z) < (84 << 8))
{ {
int j = getangle(clz.actor()->spr.pos.X - p->pos.X, clz.actor()->spr.pos.Y - p->pos.Y); int j = getangle(clz.actor()->spr.pos.X - p->pos.X, clz.actor()->spr.pos.Y - p->pos.Y);
p->posxv -= bcos(j, 4); p->vel.X -= bcos(j, 4);
p->posyv -= bsin(j, 4); p->posyv -= bsin(j, 4);
} }
if (clz.actor()->spr.picnum == LADDER) if (clz.actor()->spr.picnum == LADDER)
@ -3545,7 +3545,7 @@ void processinput_r(int snum)
if (p->newOwner != nullptr) if (p->newOwner != nullptr)
{ {
p->posxv = p->posyv = pact->spr.xvel = 0; p->vel.X = p->posyv = pact->spr.xvel = 0;
fi.doincrements(p); fi.doincrements(p);
@ -3607,7 +3607,7 @@ void processinput_r(int snum)
if (movementBlocked(p)) if (movementBlocked(p))
{ {
doubvel = 0; doubvel = 0;
p->posxv = 0; p->vel.X = 0;
p->posyv = 0; p->posyv = 0;
} }
else if (SyncInput()) else if (SyncInput())
@ -3641,7 +3641,7 @@ void processinput_r(int snum)
} }
} }
if (p->posxv || p->posyv || sb_fvel || sb_svel) if (p->vel.X || p->posyv || sb_fvel || sb_svel)
{ {
p->crack_time = CRACK_TIME; p->crack_time = CRACK_TIME;
@ -3690,24 +3690,24 @@ void processinput_r(int snum)
if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400) if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400)
doubvel <<= 1; doubvel <<= 1;
p->posxv += ((sb_fvel * doubvel) << 6); p->vel.X += ((sb_fvel * doubvel) << 6);
p->posyv += ((sb_svel * doubvel) << 6); p->posyv += ((sb_svel * doubvel) << 6);
if (!isRRRA() && ((p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH)))) if (!isRRRA() && ((p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH))))
{ {
p->posxv = MulScale(p->posxv, gs.playerfriction - 0x2000, 16); p->vel.X = MulScale(p->vel.X, gs.playerfriction - 0x2000, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction - 0x2000, 16); p->posyv = MulScale(p->posyv, gs.playerfriction - 0x2000, 16);
} }
else else
{ {
if (psectlotag == 2) if (psectlotag == 2)
{ {
p->posxv = MulScale(p->posxv, gs.playerfriction - 0x1400, 16); p->vel.X = MulScale(p->vel.X, gs.playerfriction - 0x1400, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1400, 16); p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1400, 16);
} }
else else
{ {
p->posxv = MulScale(p->posxv, gs.playerfriction, 16); p->vel.X = MulScale(p->vel.X, gs.playerfriction, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction, 16); p->posyv = MulScale(p->posyv, gs.playerfriction, 16);
} }
} }
@ -3729,7 +3729,7 @@ void processinput_r(int snum)
p->boot_amount--; p->boot_amount--;
else else
{ {
p->posxv = MulScale(p->posxv, gs.playerfriction, 16); p->vel.X = MulScale(p->vel.X, gs.playerfriction, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction, 16); p->posyv = MulScale(p->posyv, gs.playerfriction, 16);
} }
} }
@ -3741,7 +3741,7 @@ void processinput_r(int snum)
{ {
if (p->on_ground) if (p->on_ground)
{ {
p->posxv = MulScale(p->posxv, gs.playerfriction - 0x1800, 16); p->vel.X = MulScale(p->vel.X, gs.playerfriction - 0x1800, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1800, 16); p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1800, 16);
} }
} }
@ -3750,18 +3750,18 @@ void processinput_r(int snum)
p->boot_amount--; p->boot_amount--;
else else
{ {
p->posxv = MulScale(p->posxv, gs.playerfriction - 0x1800, 16); p->vel.X = MulScale(p->vel.X, gs.playerfriction - 0x1800, 16);
p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1800, 16); p->posyv = MulScale(p->posyv, gs.playerfriction - 0x1800, 16);
} }
} }
if (abs(p->posxv) < 2048 && abs(p->posyv) < 2048) if (abs(p->vel.X) < 2048 && abs(p->posyv) < 2048)
p->posxv = p->posyv = 0; p->vel.X = p->posyv = 0;
if (shrunk) if (shrunk)
{ {
p->posxv = p->vel.X =
MulScale(p->posxv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16); MulScale(p->vel.X, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
p->posyv = p->posyv =
MulScale(p->posyv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16); MulScale(p->posyv, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
} }
@ -3778,13 +3778,13 @@ HORIZONLY:
Collision clip{}; Collision clip{};
if (ud.clipping) if (ud.clipping)
{ {
p->pos.X += p->posxv >> 14; p->pos.X += p->vel.X >> 14;
p->pos.Y += p->posyv >> 14; p->pos.Y += p->posyv >> 14;
updatesector(p->pos.X, p->pos.Y, &p->cursector); updatesector(p->pos.X, p->pos.Y, &p->cursector);
ChangeActorSect(pact, p->cursector); ChangeActorSect(pact, p->cursector);
} }
else else
clipmove(p->pos, &p->cursector, p->posxv, p->posyv, 164, (4 << 8), i, CLIPMASK0, clip); clipmove(p->pos, &p->cursector, p->vel.X, p->posyv, 164, (4 << 8), i, CLIPMASK0, clip);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk) if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
p->pos.Z += 32 << 8; p->pos.Z += 32 << 8;
@ -4038,7 +4038,7 @@ void OnMotorcycle(struct player_struct *p, DDukeActor* motosprite)
p->last_full_weapon = p->curr_weapon; p->last_full_weapon = p->curr_weapon;
p->curr_weapon = MOTORCYCLE_WEAPON; p->curr_weapon = MOTORCYCLE_WEAPON;
p->gotweapon[MOTORCYCLE_WEAPON] = true; p->gotweapon[MOTORCYCLE_WEAPON] = true;
p->posxv = 0; p->vel.X = 0;
p->posyv = 0; p->posyv = 0;
p->horizon.horiz = q16horiz(0); p->horizon.horiz = q16horiz(0);
} }
@ -4079,9 +4079,9 @@ void OffMotorcycle(struct player_struct *p)
p->VBumpTarget = 0; p->VBumpTarget = 0;
p->VBumpNow = 0; p->VBumpNow = 0;
p->TurbCount = 0; p->TurbCount = 0;
p->posxv = 0; p->vel.X = 0;
p->posyv = 0; p->posyv = 0;
p->posxv -= p->angle.ang.bcos(7); p->vel.X -= p->angle.ang.bcos(7);
p->posyv -= p->angle.ang.bsin(7); p->posyv -= p->angle.ang.bsin(7);
p->moto_underwater = 0; p->moto_underwater = 0;
auto spawned = spawn(p->GetActor(), EMPTYBIKE); auto spawned = spawn(p->GetActor(), EMPTYBIKE);
@ -4118,7 +4118,7 @@ void OnBoat(struct player_struct *p, DDukeActor* boat)
p->last_full_weapon = p->curr_weapon; p->last_full_weapon = p->curr_weapon;
p->curr_weapon = BOAT_WEAPON; p->curr_weapon = BOAT_WEAPON;
p->gotweapon[BOAT_WEAPON] = true; p->gotweapon[BOAT_WEAPON] = true;
p->posxv = 0; p->vel.X = 0;
p->posyv = 0; p->posyv = 0;
p->horizon.horiz = q16horiz(0); p->horizon.horiz = q16horiz(0);
} }
@ -4146,9 +4146,9 @@ void OffBoat(struct player_struct *p)
p->VBumpTarget = 0; p->VBumpTarget = 0;
p->VBumpNow = 0; p->VBumpNow = 0;
p->TurbCount = 0; p->TurbCount = 0;
p->posxv = 0; p->vel.X = 0;
p->posyv = 0; p->posyv = 0;
p->posxv -= p->angle.ang.bcos(7); p->vel.X -= p->angle.ang.bcos(7);
p->posyv -= p->angle.ang.bsin(7); p->posyv -= p->angle.ang.bsin(7);
p->moto_underwater = 0; p->moto_underwater = 0;
auto spawned = spawn(p->GetActor(), EMPTYBOAT); auto spawned = spawn(p->GetActor(), EMPTYBOAT);

View file

@ -148,7 +148,7 @@ void resetplayerstats(int snum)
p->newOwner =nullptr; p->newOwner =nullptr;
p->jumping_counter = 0; p->jumping_counter = 0;
p->hard_landing = 0; p->hard_landing = 0;
p->posxv = 0; //!! p->vel.X = 0; //!!
p->posyv = 0; p->posyv = 0;
p->poszv = 0; p->poszv = 0;
p->fric.X = 0; p->fric.X = 0;

View file

@ -125,7 +125,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
("bobposx", w.bobposx) ("bobposx", w.bobposx)
("bobposy", w.bobposy) ("bobposy", w.bobposy)
("pyoff", w.pyoff) ("pyoff", w.pyoff)
("posxv", w.posxv) ("posxv", w.vel.X)
("posyv", w.posyv) ("posyv", w.posyv)
("poszv", w.poszv) ("poszv", w.poszv)
("last_pissed_time", w.last_pissed_time) ("last_pissed_time", w.last_pissed_time)

View file

@ -927,7 +927,7 @@ void checkplayerhurt_d(struct player_struct* p, const Collision& coll)
p->hurt_delay = 16; p->hurt_delay = 16;
SetPlayerPal(p, PalEntry(32, 32, 0, 0)); SetPlayerPal(p, PalEntry(32, 32, 0, 0));
p->posxv = -p->angle.ang.bcos(8); p->vel.X = -p->angle.ang.bcos(8);
p->posyv = -p->angle.ang.bsin(8); p->posyv = -p->angle.ang.bsin(8);
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor()); S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor());

View file

@ -174,7 +174,7 @@ struct player_struct
// This is basically the version from JFDuke but this first block contains a few changes to make it work with other parts of Raze. // This is basically the version from JFDuke but this first block contains a few changes to make it work with other parts of Raze.
// The sound code wants to read a vector out of this so we need to define one for the main coordinate. // The sound code wants to read a vector out of this so we need to define one for the main coordinate.
vec3_t pos, opos; vec3_t pos, opos, vel;
// player's horizon and angle structs. // player's horizon and angle structs.
PlayerHorizon horizon; PlayerHorizon horizon;
@ -205,7 +205,7 @@ struct player_struct
int exitx, exity, loogiex[64], loogiey[64], numloogs, loogcnt; int exitx, exity, loogiex[64], loogiey[64], numloogs, loogcnt;
int invdisptime; int invdisptime;
int bobposx, bobposy, pyoff, opyoff; int bobposx, bobposy, pyoff, opyoff;
int posxv, posyv, poszv, last_pissed_time, truefz, truecz; int posyv, poszv, last_pissed_time, truefz, truecz;
int player_par, visibility; int player_par, visibility;
int bobcounter; int bobcounter;
int randomflamex, crack_time; int randomflamex, crack_time;

View file

@ -153,7 +153,7 @@ struct DukePlayer
native int exitx, exity, loogiex[64], loogiey[64], numloogs, loogcnt; native int exitx, exity, loogiex[64], loogiey[64], numloogs, loogcnt;
native int invdisptime; native int invdisptime;
native int bobposx, bobposy, pyoff, opyoff; native int bobposx, bobposy, pyoff, opyoff;
native int posxv, posyv, poszv, last_pissed_time, truefz, truecz; native int posyv, poszv, last_pissed_time, truefz, truecz;
native int player_par, visibility; native int player_par, visibility;
native int bobcounter; native int bobcounter;
native int randomflamex, crack_time; native int randomflamex, crack_time;