- renamed player_struct::vel

This commit is contained in:
Christoph Oelckers 2022-09-12 00:00:45 +02:00
parent 03a0eb7284
commit 8171927c2a
13 changed files with 201 additions and 201 deletions

View file

@ -2090,7 +2090,7 @@ bool money(DDukeActor* actor, int BLOODPOOL)
{
auto sectp = actor->sector();
actor->set_int_xvel((krand() & 7) + bsin(actor->temp_data[0], -9));
actor->set_int_xvel((krand() & 7) + BobVal(actor->temp_data[0]) * 32);
actor->temp_data[0] += (krand() & 63);
if ((actor->temp_data[0] & 2047) > 512 && (actor->temp_data[0] & 2047) < 1596)
{

View file

@ -631,13 +631,13 @@ int ifhitbyweapon_d(DDukeActor *actor)
if (attackerflag(actor, SFLAG2_DOUBLEDMGTHRUST))
{
ps[p].vel.X += actor->hitextra * bcos(actor->hitang, 2);
ps[p].vel.Y += actor->hitextra * bsin(actor->hitang, 2);
ps[p].__vel.X += actor->hitextra * bcos(actor->hitang, 2);
ps[p].__vel.Y += actor->hitextra * bsin(actor->hitang, 2);
}
else
{
ps[p].vel.X += actor->hitextra * bcos(actor->hitang, 1);
ps[p].vel.Y += actor->hitextra * bsin(actor->hitang, 1);
ps[p].__vel.X += actor->hitextra * bcos(actor->hitang, 1);
ps[p].__vel.Y += actor->hitextra * bsin(actor->hitang, 1);
}
}
else
@ -1848,7 +1848,7 @@ void movetransports_d(void)
int k = 0;
if (onfloorz && sectlotag == ST_1_ABOVE_WATER && ps[p].on_ground && ps[p].pos.Z > (sectp->floorz - 16) && (PlayerInput(p, SB_CROUCH) || ps[p].vel.Z > 2048))
if (onfloorz && sectlotag == ST_1_ABOVE_WATER && ps[p].on_ground && ps[p].pos.Z > (sectp->floorz - 16) && (PlayerInput(p, SB_CROUCH) || ps[p].__vel.Z > 2048))
// if( onfloorz && sectlotag == 1 && ps[p].pos.z > (sectp->floorz-(6<<8)) )
{
k = 1;
@ -1861,8 +1861,8 @@ void movetransports_d(void)
ps[p].pos.Z = Owner->sector()->ceilingz + 7;
ps[p].backupz();
ps[p].vel.X = 4096 - (krand() & 8192);
ps[p].vel.Y = 4096 - (krand() & 8192);
ps[p].__vel.X = 4096 - (krand() & 8192);
ps[p].__vel.Y = 4096 - (krand() & 8192);
}
@ -3526,8 +3526,8 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (a & face_player_smart)
{
double newx = ps[playernum].pos.X + (ps[playernum].vel.X / 768) * inttoworld;
double newy = ps[playernum].pos.Y + (ps[playernum].vel.Y / 768) * inttoworld;
double newx = ps[playernum].pos.X + (ps[playernum].__vel.X / 768) * inttoworld;
double newy = ps[playernum].pos.Y + (ps[playernum].__vel.Y / 768) * inttoworld;
goalang = getangle(newx - actor->spr.pos.X, newy - actor->spr.pos.Y);
angdif = getincangle(actor->int_ang(), goalang) >> 2;
if (angdif > -8 && angdif < 0) angdif = 0;
@ -3637,13 +3637,13 @@ void move_d(DDukeActor *actor, int playernum, int xvel)
if (xvel < 512)
{
ps[playernum].vel.X = 0;
ps[playernum].vel.Y = 0;
ps[playernum].__vel.X = 0;
ps[playernum].__vel.Y = 0;
}
else
{
ps[playernum].vel.X = MulScale(ps[playernum].vel.X, gs.playerfriction - 0x2000, 16);
ps[playernum].vel.Y = MulScale(ps[playernum].vel.Y, gs.playerfriction - 0x2000, 16);
ps[playernum].__vel.X = MulScale(ps[playernum].__vel.X, gs.playerfriction - 0x2000, 16);
ps[playernum].__vel.Y = MulScale(ps[playernum].__vel.Y, gs.playerfriction - 0x2000, 16);
}
}
else if (actor->spr.picnum != DRONE && actor->spr.picnum != SHARK && actor->spr.picnum != COMMANDER)

View file

@ -534,13 +534,13 @@ int ifhitbyweapon_r(DDukeActor *actor)
if (attackerflag(actor, SFLAG2_DOUBLEDMGTHRUST))
{
ps[p].vel.X += actor->hitextra * bcos(actor->hitang, 2);
ps[p].vel.Y += actor->hitextra * bsin(actor->hitang, 2);
ps[p].__vel.X += actor->hitextra * bcos(actor->hitang, 2);
ps[p].__vel.Y += actor->hitextra * bsin(actor->hitang, 2);
}
else
{
ps[p].vel.X += actor->hitextra * bcos(actor->hitang, 1);
ps[p].vel.Y += actor->hitextra * bsin(actor->hitang, 1);
ps[p].__vel.X += actor->hitextra * bcos(actor->hitang, 1);
ps[p].__vel.Y += actor->hitextra * bsin(actor->hitang, 1);
}
}
else
@ -3564,8 +3564,8 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (a & face_player_smart)
{
double newx = ps[pnum].pos.X + (ps[pnum].vel.X / 768) * inttoworld;
double newy = ps[pnum].pos.Y + (ps[pnum].vel.Y / 768) * inttoworld;
double newx = ps[pnum].pos.X + (ps[pnum].__vel.X / 768) * inttoworld;
double newy = ps[pnum].pos.Y + (ps[pnum].__vel.Y / 768) * inttoworld;
goalang = getangle(newx - actor->spr.pos.X, newy - actor->spr.pos.Y);
angdif = getincangle(actor->int_ang(), goalang) >> 2;
if (angdif > -8 && angdif < 0) angdif = 0;
@ -3669,13 +3669,13 @@ void move_r(DDukeActor *actor, int pnum, int xvel)
if (xvel < 512)
{
ps[pnum].vel.X = 0;
ps[pnum].vel.Y = 0;
ps[pnum].__vel.X = 0;
ps[pnum].__vel.Y = 0;
}
else
{
ps[pnum].vel.X = MulScale(ps[pnum].vel.X, gs.playerfriction - 0x2000, 16);
ps[pnum].vel.Y = MulScale(ps[pnum].vel.Y, gs.playerfriction - 0x2000, 16);
ps[pnum].__vel.X = MulScale(ps[pnum].__vel.X, gs.playerfriction - 0x2000, 16);
ps[pnum].__vel.Y = MulScale(ps[pnum].__vel.Y, gs.playerfriction - 0x2000, 16);
}
}
else if ((isRRRA() && actor->spr.picnum != DRONE && actor->spr.picnum != SHARK && actor->spr.picnum != UFO1_RRRA) ||

View file

@ -403,18 +403,18 @@ void DoPlayer(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;
case PLAYER_POSXV:
if (bSet) ps[iPlayer].vel.X = lValue;
else SetGameVarID(lVar2, ps[iPlayer].vel.X, sActor, sPlayer);
if (bSet) ps[iPlayer].__vel.X = lValue;
else SetGameVarID(lVar2, ps[iPlayer].__vel.X, sActor, sPlayer);
break;
case PLAYER_POSYV:
if (bSet) ps[iPlayer].vel.Y = lValue;
else SetGameVarID(lVar2, ps[iPlayer].vel.Y, sActor, sPlayer);
if (bSet) ps[iPlayer].__vel.Y = lValue;
else SetGameVarID(lVar2, ps[iPlayer].__vel.Y, sActor, sPlayer);
break;
case PLAYER_POSZV:
if (bSet) ps[iPlayer].vel.Z = lValue;
else SetGameVarID(lVar2, ps[iPlayer].vel.Z, sActor, sPlayer);
if (bSet) ps[iPlayer].__vel.Z = lValue;
else SetGameVarID(lVar2, ps[iPlayer].__vel.Z, sActor, sPlayer);
break;
case PLAYER_LAST_PISSED_TIME:
@ -2250,7 +2250,7 @@ int ParseState::parse(void)
ps[g_p].footprintcount = 0;
ps[g_p].weapreccnt = 0;
ps[g_p].ftq = 0;
ps[g_p].vel.X = ps[g_p].vel.Y = 0;
ps[g_p].__vel.X = ps[g_p].__vel.Y = 0;
if (!isRR()) ps[g_p].angle.orotscrnang = ps[g_p].angle.rotscrnang = nullAngle;
ps[g_p].falling_counter = 0;
@ -2388,7 +2388,7 @@ int ParseState::parse(void)
// sigh.. this was yet another place where number literals were used as bit masks for every single value, making the code totally unreadable.
if( (l& pducking) && ps[g_p].on_ground && PlayerInput(g_p, SB_CROUCH))
j = 1;
else if( (l& pfalling) && ps[g_p].jumping_counter == 0 && !ps[g_p].on_ground && ps[g_p].vel.Z > 2048 )
else if( (l& pfalling) && ps[g_p].jumping_counter == 0 && !ps[g_p].on_ground && ps[g_p].__vel.Z > 2048 )
j = 1;
else if( (l& pjumping) && ps[g_p].jumping_counter > 348 )
j = 1;
@ -2447,8 +2447,8 @@ int ParseState::parse(void)
case concmd_slapplayer:
insptr++;
forceplayerangle(g_p);
ps[g_p].vel.X -= ps[g_p].angle.ang.Cos() * (1 << 21);
ps[g_p].vel.Y -= ps[g_p].angle.ang.Sin() * (1 << 21);
ps[g_p].__vel.X -= ps[g_p].angle.ang.Cos() * (1 << 21);
ps[g_p].__vel.Y -= ps[g_p].angle.ang.Sin() * (1 << 21);
return 0;
case concmd_wackplayer:
insptr++;
@ -2456,8 +2456,8 @@ int ParseState::parse(void)
forceplayerangle(g_p);
else
{
ps[g_p].vel.X -= ps[g_p].angle.ang.Cos() * (1 << 24);
ps[g_p].vel.Y -= ps[g_p].angle.ang.Sin() * (1 << 24);
ps[g_p].__vel.X -= ps[g_p].angle.ang.Cos() * (1 << 24);
ps[g_p].__vel.Y -= ps[g_p].angle.ang.Sin() * (1 << 24);
ps[g_p].jumping_counter = 767;
ps[g_p].jumping_toggle = 1;
}

View file

@ -433,7 +433,7 @@ void hud_input(int plnum)
else
{
p->hard_landing = 0;
p->vel.Z = 0;
p->__vel.Z = 0;
S_PlayActorSound(DUKE_JETPACK_OFF, pact);
S_StopSound(DUKE_JETPACK_IDLE, pact);
S_StopSound(DUKE_JETPACK_ON, pact);

View file

@ -1797,16 +1797,16 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
else
{
p->on_ground = 0;
p->vel.Z += (gs.gravity + 80); // (TICSPERFRAME<<6);
if (p->vel.Z >= (4096 + 2048)) p->vel.Z = (4096 + 2048);
if (p->vel.Z > 2400 && p->falling_counter < 255)
p->__vel.Z += (gs.gravity + 80); // (TICSPERFRAME<<6);
if (p->__vel.Z >= (4096 + 2048)) p->__vel.Z = (4096 + 2048);
if (p->__vel.Z > 2400 && p->falling_counter < 255)
{
p->falling_counter++;
if (p->falling_counter == 38 && !S_CheckActorSoundPlaying(pact, DUKE_SCREAM))
S_PlayActorSound(DUKE_SCREAM, pact);
}
if (p->pos.Z + p->vel.Z * zinttoworld >= floorz - i) // hit the ground
if (p->pos.Z + p->__vel.Z * zinttoworld >= floorz - i) // hit the ground
{
S_StopSound(DUKE_SCREAM, pact);
if (!p->insector() || p->cursector->lotag != 1)
@ -1830,7 +1830,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
SetPlayerPal(p, PalEntry(32, 16, 0, 0));
}
else if (p->vel.Z > 2048) S_PlayActorSound(DUKE_LAND, pact);
else if (p->__vel.Z > 2048) S_PlayActorSound(DUKE_LAND, pact);
}
}
}
@ -1841,8 +1841,8 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
p->falling_counter = 0;
S_StopSound(-1, pact, CHAN_VOICE);
if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground == 0 && p->vel.Z > (6144 >> 1))
p->hard_landing = p->vel.Z >> 10;
if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground == 0 && p->__vel.Z > (6144 >> 1))
p->hard_landing = p->__vel.Z >> 10;
p->on_ground = 1;
@ -1853,8 +1853,8 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
double k = (floorz - i - p->pos.Z) * 0.5;
if (abs(k) < 1) k = 0;
p->pos.Z += k;
p->vel.Z -= 768;
if (p->vel.Z < 0) p->vel.Z = 0;
p->__vel.Z -= 768;
if (p->__vel.Z < 0) p->__vel.Z = 0;
}
else if (p->jumping_counter == 0)
{
@ -1862,7 +1862,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
if (p->on_warping_sector == 0 && p->pos.Z > floorz - 16)
{
p->pos.Z = floorz - 16;
p->vel.Z >>= 1;
p->__vel.Z >>= 1;
}
}
@ -1896,11 +1896,11 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
if (psectlotag == 1 && p->jumping_counter > 768)
{
p->jumping_counter = 0;
p->vel.Z = -512;
p->__vel.Z = -512;
}
else
{
p->vel.Z -= bsin(2048 - 128 + p->jumping_counter) / 12;
p->__vel.Z -= bsin(2048 - 128 + p->jumping_counter) / 12;
p->jumping_counter += 180;
p->on_ground = 0;
}
@ -1908,18 +1908,18 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
else
{
p->jumping_counter = 0;
p->vel.Z = 0;
p->__vel.Z = 0;
}
}
p->pos.Z += p->vel.Z * zinttoworld;
p->pos.Z += p->__vel.Z * zinttoworld;
if (p->pos.Z < ceilingz + 4)
{
p->jumping_counter = 0;
if (p->vel.Z < 0)
p->vel.X = p->vel.Y = 0;
p->vel.Z = 128;
if (p->__vel.Z < 0)
p->__vel.X = p->__vel.Y = 0;
p->__vel.Z = 128;
p->pos.Z = ceilingz + 4;
}
}
@ -1950,38 +1950,38 @@ static void underwater(int snum, ESyncBits actions, int fz_, int cz_)
if (actions & SB_JUMP)
{
// jump
if (p->vel.Z > 0) p->vel.Z = 0;
p->vel.Z -= 348;
if (p->vel.Z < -(256 * 6)) p->vel.Z = -(256 * 6);
if (p->__vel.Z > 0) p->__vel.Z = 0;
p->__vel.Z -= 348;
if (p->__vel.Z < -(256 * 6)) p->__vel.Z = -(256 * 6);
}
else if (actions & SB_CROUCH)
{
// crouch
if (p->vel.Z < 0) p->vel.Z = 0;
p->vel.Z += 348;
if (p->vel.Z > (256 * 6)) p->vel.Z = (256 * 6);
if (p->__vel.Z < 0) p->__vel.Z = 0;
p->__vel.Z += 348;
if (p->__vel.Z > (256 * 6)) p->__vel.Z = (256 * 6);
}
else
{
// normal view
if (p->vel.Z < 0)
if (p->__vel.Z < 0)
{
p->vel.Z += 256;
if (p->vel.Z > 0)
p->vel.Z = 0;
p->__vel.Z += 256;
if (p->__vel.Z > 0)
p->__vel.Z = 0;
}
if (p->vel.Z > 0)
if (p->__vel.Z > 0)
{
p->vel.Z -= 256;
if (p->vel.Z < 0)
p->vel.Z = 0;
p->__vel.Z -= 256;
if (p->__vel.Z < 0)
p->__vel.Z = 0;
}
}
if (p->vel.Z > 2048)
p->vel.Z >>= 1;
if (p->__vel.Z > 2048)
p->__vel.Z >>= 1;
p->pos.Z += p->vel.Z * zinttoworld;
p->pos.Z += p->__vel.Z * zinttoworld;
if (p->pos.Z > floorz - 15)
p->pos.Z += (((floorz - 15) - p->pos.Z) * 0.5);
@ -1989,7 +1989,7 @@ static void underwater(int snum, ESyncBits actions, int fz_, int cz_)
if (p->pos.Z < ceilingz + 4)
{
p->pos.Z = ceilingz + 4;
p->vel.Z = 0;
p->__vel.Z = 0;
}
if (p->scuba_on && (krand() & 255) < 8)
@ -2047,7 +2047,7 @@ int operateTripbomb(int snum)
if (delta.LengthSquared() < (18.125 * 18.125))
{
p->pos.Z = p->opos.Z;
p->vel.Z = 0;
p->__vel.Z = 0;
return 1;
}
}
@ -2584,7 +2584,7 @@ static void operateweapon(int snum, ESyncBits actions)
if (p->kickback_pic < 4)
{
p->pos.Z = p->opos.Z;
p->vel.Z = 0;
p->__vel.Z = 0;
if (p->kickback_pic == 3)
fi.shoot(pact, HANDHOLDINGLASER);
}
@ -2787,8 +2787,8 @@ void processinput_d(int snum)
else if (badguy(clz.actor()) && clz.actor()->spr.xrepeat > 24 && abs(pact->int_pos().Z - clz.actor()->int_pos().Z) < (84 << 8))
{
j = getangle(clz.actor()->int_pos().X - p->player_int_pos().X, clz.actor()->int_pos().Y - p->player_int_pos().Y);
p->vel.X -= bcos(j, 4);
p->vel.Y -= bsin(j, 4);
p->__vel.X -= bcos(j, 4);
p->__vel.Y -= bsin(j, 4);
}
}
@ -2846,7 +2846,7 @@ void processinput_d(int snum)
if (p->newOwner != nullptr)
{
p->vel.X = p->vel.Y = 0;
p->__vel.X = p->__vel.Y = 0;
pact->vel.X = 0;
fi.doincrements(p);
@ -2895,8 +2895,8 @@ void processinput_d(int snum)
if (movementBlocked(p))
{
doubvel = 0;
p->vel.X = 0;
p->vel.Y = 0;
p->__vel.X = 0;
p->__vel.Y = 0;
}
else if (SyncInput())
{
@ -2947,7 +2947,7 @@ void processinput_d(int snum)
}
}
if (p->vel.X || p->vel.Y || sb_fvel || sb_svel)
if (p->__vel.X || p->__vel.Y || sb_fvel || sb_svel)
{
p->crack_time = CRACK_TIME;
@ -2989,8 +2989,8 @@ void processinput_d(int snum)
if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400)
doubvel <<= 1;
p->vel.X += ((sb_fvel * doubvel) << 6);
p->vel.Y += ((sb_svel * doubvel) << 6);
p->__vel.X += ((sb_fvel * doubvel) << 6);
p->__vel.Y += ((sb_svel * doubvel) << 6);
bool check;
@ -2998,32 +2998,32 @@ 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)));
if (check)
{
p->vel.X = MulScale(p->vel.X, gs.playerfriction - 0x2000, 16);
p->vel.Y = MulScale(p->vel.Y, gs.playerfriction - 0x2000, 16);
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction - 0x2000, 16);
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction - 0x2000, 16);
}
else
{
if (psectlotag == 2)
{
p->vel.X = MulScale(p->vel.X, gs.playerfriction - 0x1400, 16);
p->vel.Y = MulScale(p->vel.Y, gs.playerfriction - 0x1400, 16);
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction - 0x1400, 16);
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction - 0x1400, 16);
}
else
{
p->vel.X = MulScale(p->vel.X, gs.playerfriction, 16);
p->vel.Y = MulScale(p->vel.Y, gs.playerfriction, 16);
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction, 16);
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction, 16);
}
}
if (abs(p->vel.X) < 2048 && abs(p->vel.Y) < 2048)
p->vel.X = p->vel.Y = 0;
if (abs(p->__vel.X) < 2048 && abs(p->__vel.Y) < 2048)
p->__vel.X = p->__vel.Y = 0;
if (shrunk)
{
p->vel.X =
MulScale(p->vel.X, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
p->vel.Y =
MulScale(p->vel.Y, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
p->__vel.X =
MulScale(p->__vel.X, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
p->__vel.Y =
MulScale(p->__vel.Y, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
}
}
@ -3038,12 +3038,12 @@ HORIZONLY:
Collision clip{};
if (ud.clipping)
{
p->player_add_int_xy({ p->vel.X >> 14, p->vel.Y >> 14 });
p->player_add_int_xy({ p->__vel.X >> 14, p->__vel.Y >> 14 });
updatesector(p->pos, &p->cursector);
ChangeActorSect(pact, p->cursector);
}
else
clipmove(p->pos, &p->cursector, p->vel.X, p->vel.Y, 164, (4 << 8), ii, CLIPMASK0, clip);
clipmove(p->pos, &p->cursector, p->__vel.X, p->__vel.Y, 164, (4 << 8), ii, CLIPMASK0, clip);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
p->pos.Z += 32;

View file

@ -1319,8 +1319,8 @@ int doincrements_r(player_struct* p)
{
p->noise_radius = 16384;
madenoise(screenpeek);
p->vel.X += p->angle.ang.Cos() * (1 << 18);
p->vel.Y += p->angle.ang.Sin() * (1 << 18);
p->__vel.X += p->angle.ang.Cos() * (1 << 18);
p->__vel.Y += p->angle.ang.Sin() * (1 << 18);
}
p->eat -= 4;
if (p->eat < 0)
@ -1799,8 +1799,8 @@ static void onMotorcycle(int snum, ESyncBits &actions)
}
}
p->vel.X += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.Buildang(), 4);
p->vel.Y += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.Buildang(), 4);
p->__vel.X += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.Buildang(), 4);
p->__vel.Y += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.Buildang(), 4);
p->angle.addadjustment(deltaangle(p->angle.ang, p->angle.ang - DAngle::fromBam(angAdjustment)));
}
else if (p->MotoSpeed >= 20 && p->on_ground == 1 && (p->moto_on_mud || p->moto_on_oil))
@ -1808,8 +1808,8 @@ static void onMotorcycle(int snum, ESyncBits &actions)
rng = krand() & 1;
velAdjustment = rng == 0 ? -10 : 10;
currSpeed = MulScale(currSpeed, p->moto_on_oil ? 10 : 5, 7);
p->vel.X += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.Buildang(), 4);
p->vel.Y += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.Buildang(), 4);
p->__vel.X += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.Buildang(), 4);
p->__vel.Y += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.Buildang(), 4);
}
p->moto_on_mud = p->moto_on_oil = 0;
@ -2043,8 +2043,8 @@ static void onBoat(int snum, ESyncBits &actions)
angAdjustment >>= 6;
}
p->vel.X += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.Buildang(), 4);
p->vel.Y += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.Buildang(), 4);
p->__vel.X += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.Buildang(), 4);
p->__vel.Y += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.Buildang(), 4);
p->angle.addadjustment(deltaangle(p->angle.ang, p->angle.ang - DAngle::fromBam(angAdjustment)));
}
if (p->NotOnWater && p->MotoSpeed > 50)
@ -2129,7 +2129,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
{
p->VBumpTarget = 80;
p->moto_bump_fast = 1;
p->vel.Z -= int(gs.gravity * p->MotoSpeed * (1. / 16.));
p->__vel.Z -= int(gs.gravity * p->MotoSpeed * (1. / 16.));
p->MotoOnGround = 0;
if (S_CheckActorSoundPlaying(pact, 188))
S_StopSound(188, pact);
@ -2137,23 +2137,23 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
}
else
{
p->vel.Z += gs.gravity - 80 + int(120 - p->MotoSpeed);
p->__vel.Z += gs.gravity - 80 + int(120 - p->MotoSpeed);
if (!S_CheckActorSoundPlaying(pact, 189) && !S_CheckActorSoundPlaying(pact, 190))
S_PlayActorSound(190, pact);
}
}
else
p->vel.Z += (gs.gravity + 80); // (TICSPERFRAME<<6);
p->__vel.Z += (gs.gravity + 80); // (TICSPERFRAME<<6);
if (p->vel.Z >= (4096 + 2048)) p->vel.Z = (4096 + 2048);
if (p->vel.Z > 2400 && p->falling_counter < 255)
if (p->__vel.Z >= (4096 + 2048)) p->__vel.Z = (4096 + 2048);
if (p->__vel.Z > 2400 && p->falling_counter < 255)
{
p->falling_counter++;
if (p->falling_counter == 38 && !S_CheckActorSoundPlaying(pact, DUKE_SCREAM))
S_PlayActorSound(DUKE_SCREAM, pact);
}
if (p->pos.Z + p->vel.Z * zinttoworld >= floorz - i) // hit the ground
if (p->pos.Z + p->__vel.Z * zinttoworld >= floorz - i) // hit the ground
{
S_StopSound(DUKE_SCREAM, pact);
if (!p->insector() || p->cursector->lotag != 1)
@ -2178,7 +2178,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
SetPlayerPal(p, PalEntry(32, 16, 0, 0));
}
else if (p->vel.Z > 2048)
else if (p->__vel.Z > 2048)
{
if (p->OnMotorcycle)
{
@ -2189,7 +2189,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
}
else S_PlayActorSound(DUKE_LAND, pact);
}
else if (p->vel.Z > 1024 && p->OnMotorcycle)
else if (p->__vel.Z > 1024 && p->OnMotorcycle)
{
S_PlayActorSound(DUKE_LAND, pact);
p->TurbCount = 12;
@ -2204,8 +2204,8 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
p->falling_counter = 0;
S_StopSound(-1, pact, CHAN_VOICE);
if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground == 0 && p->vel.Z > (6144 >> 1))
p->hard_landing = p->vel.Z >> 10;
if (psectlotag != ST_1_ABOVE_WATER && psectlotag != ST_2_UNDERWATER && p->on_ground == 0 && p->__vel.Z > (6144 >> 1))
p->hard_landing = p->__vel.Z >> 10;
p->on_ground = 1;
@ -2216,8 +2216,8 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
double k = (floorz - i - p->pos.Z) * 0.5;
if (abs(k) < 1) k = 0;
p->pos.Z += k;
p->vel.Z -= 768;
if (p->vel.Z < 0) p->vel.Z = 0;
p->__vel.Z -= 768;
if (p->__vel.Z < 0) p->__vel.Z = 0;
}
else if (p->jumping_counter == 0)
{
@ -2225,7 +2225,7 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
if (p->on_warping_sector == 0 && p->pos.Z > floorz - 16)
{
p->pos.Z = floorz - 16;
p->vel.Z >>= 1;
p->__vel.Z >>= 1;
}
}
@ -2255,11 +2255,11 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
if (psectlotag == ST_1_ABOVE_WATER && p->jumping_counter > 768)
{
p->jumping_counter = 0;
p->vel.Z = -512;
p->__vel.Z = -512;
}
else
{
p->vel.Z -= bsin(2048 - 128 + p->jumping_counter) / 12;
p->__vel.Z -= bsin(2048 - 128 + p->jumping_counter) / 12;
p->jumping_counter += 180;
p->on_ground = 0;
}
@ -2267,18 +2267,18 @@ static void movement(int snum, ESyncBits actions, sectortype* psect, int fz_, in
else
{
p->jumping_counter = 0;
p->vel.Z = 0;
p->__vel.Z = 0;
}
}
p->pos.Z += p->vel.Z * zinttoworld;
p->pos.Z += p->__vel.Z * zinttoworld;
if (p->pos.Z < ceilingz + 4)
{
p->jumping_counter = 0;
if (p->vel.Z < 0)
p->vel.X = p->vel.Y = 0;
p->vel.Z = 128;
if (p->__vel.Z < 0)
p->__vel.X = p->__vel.Y = 0;
p->__vel.Z = 128;
p->pos.Z = ceilingz + 4;
}
}
@ -2307,36 +2307,36 @@ static void underwater(int snum, ESyncBits actions, int fz_, int cz_)
if ((actions & SB_JUMP) && !p->OnMotorcycle)
{
if (p->vel.Z > 0) p->vel.Z = 0;
p->vel.Z -= 348;
if (p->vel.Z < -(256 * 6)) p->vel.Z = -(256 * 6);
if (p->__vel.Z > 0) p->__vel.Z = 0;
p->__vel.Z -= 348;
if (p->__vel.Z < -(256 * 6)) p->__vel.Z = -(256 * 6);
}
else if ((actions & SB_CROUCH) || p->OnMotorcycle)
{
if (p->vel.Z < 0) p->vel.Z = 0;
p->vel.Z += 348;
if (p->vel.Z > (256 * 6)) p->vel.Z = (256 * 6);
if (p->__vel.Z < 0) p->__vel.Z = 0;
p->__vel.Z += 348;
if (p->__vel.Z > (256 * 6)) p->__vel.Z = (256 * 6);
}
else
{
if (p->vel.Z < 0)
if (p->__vel.Z < 0)
{
p->vel.Z += 256;
if (p->vel.Z > 0)
p->vel.Z = 0;
p->__vel.Z += 256;
if (p->__vel.Z > 0)
p->__vel.Z = 0;
}
if (p->vel.Z > 0)
if (p->__vel.Z > 0)
{
p->vel.Z -= 256;
if (p->vel.Z < 0)
p->vel.Z = 0;
p->__vel.Z -= 256;
if (p->__vel.Z < 0)
p->__vel.Z = 0;
}
}
if (p->vel.Z > 2048)
p->vel.Z >>= 1;
if (p->__vel.Z > 2048)
p->__vel.Z >>= 1;
p->pos.Z += p->vel.Z * zinttoworld;
p->pos.Z += p->__vel.Z * zinttoworld;
if (p->pos.Z > floorz - 15)
p->pos.Z += (((floorz - 15) - p->pos.Z) * 0.5);
@ -2344,7 +2344,7 @@ static void underwater(int snum, ESyncBits actions, int fz_, int cz_)
if (p->pos.Z < ceilingz + 4)
{
p->pos.Z = ceilingz + 4;
p->vel.Z = 0;
p->__vel.Z = 0;
}
if (p->scuba_on && (krand() & 255) < 8)
@ -2800,8 +2800,8 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
p->visibility = 0;
if (psectlotag != 857)
{
p->vel.X -= p->angle.ang.Cos() * (1 << 18);
p->vel.Y -= p->angle.ang.Sin() * (1 << 18);
p->__vel.X -= p->angle.ang.Cos() * (1 << 18);
p->__vel.Y -= p->angle.ang.Sin() * (1 << 18);
}
}
else if (p->kickback_pic == 2)
@ -2900,14 +2900,14 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
if (psectlotag != 857)
{
p->vel.X -= p->angle.ang.Cos() * (1 << 19);
p->vel.Y -= p->angle.ang.Sin() * (1 << 19);
p->__vel.X -= p->angle.ang.Cos() * (1 << 19);
p->__vel.Y -= p->angle.ang.Sin() * (1 << 19);
}
}
else if (psectlotag != 857)
{
p->vel.X -= p->angle.ang.Cos() * (1 << 18);
p->vel.Y -= p->angle.ang.Sin() * (1 << 18);
p->__vel.X -= p->angle.ang.Cos() * (1 << 18);
p->__vel.Y -= p->angle.ang.Sin() * (1 << 18);
}
}
@ -2993,8 +2993,8 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
if (psectlotag != 857)
{
p->vel.X -= p->angle.ang.Cos() * (1 << 18);
p->vel.Y -= p->angle.ang.Sin() * (1 << 18);
p->__vel.X -= p->angle.ang.Cos() * (1 << 18);
p->__vel.Y -= p->angle.ang.Sin() * (1 << 18);
}
checkavailweapon(p);
@ -3134,8 +3134,8 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
}
else if (p->kickback_pic == 12)
{
p->vel.X -= p->angle.ang.Cos() * (1 << 18);
p->vel.Y -= p->angle.ang.Sin() * (1 << 18);
p->__vel.X -= p->angle.ang.Cos() * (1 << 18);
p->__vel.Y -= p->angle.ang.Sin() * (1 << 18);
p->horizon.addadjustment(buildhoriz(20));
p->recoil += 20;
}
@ -3184,8 +3184,8 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
}
if (p->kickback_pic < 30)
{
p->vel.X -= p->angle.ang.Cos() * (1 << 18);
p->vel.Y -= p->angle.ang.Sin() * (1 << 18);
p->__vel.X -= p->angle.ang.Cos() * (1 << 18);
p->__vel.Y -= p->angle.ang.Sin() * (1 << 18);
}
p->kickback_pic++;
if (p->kickback_pic > 40)
@ -3475,8 +3475,8 @@ void processinput_r(int snum)
else if (badguy(clz.actor()) && clz.actor()->spr.xrepeat > 24 && abs(pact->int_pos().Z - clz.actor()->int_pos().Z) < (84 << 8))
{
int j = getangle(clz.actor()->int_pos().X - p->player_int_pos().X, clz.actor()->int_pos().Y - p->player_int_pos().Y);
p->vel.X -= bcos(j, 4);
p->vel.Y -= bsin(j, 4);
p->__vel.X -= bcos(j, 4);
p->__vel.Y -= bsin(j, 4);
}
if (clz.actor()->spr.picnum == LADDER)
{
@ -3559,7 +3559,7 @@ void processinput_r(int snum)
if (p->newOwner != nullptr)
{
p->vel.X = p->vel.Y = 0;
p->__vel.X = p->__vel.Y = 0;
pact->vel.X = 0;
fi.doincrements(p);
@ -3624,8 +3624,8 @@ void processinput_r(int snum)
if (movementBlocked(p))
{
doubvel = 0;
p->vel.X = 0;
p->vel.Y = 0;
p->__vel.X = 0;
p->__vel.Y = 0;
}
else if (SyncInput())
{
@ -3658,7 +3658,7 @@ void processinput_r(int snum)
}
}
if (p->vel.X || p->vel.Y || sb_fvel || sb_svel)
if (p->__vel.X || p->__vel.Y || sb_fvel || sb_svel)
{
p->crack_time = CRACK_TIME;
@ -3707,25 +3707,25 @@ void processinput_r(int snum)
if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400)
doubvel <<= 1;
p->vel.X += ((sb_fvel * doubvel) << 6);
p->vel.Y += ((sb_svel * doubvel) << 6);
p->__vel.X += ((sb_fvel * doubvel) << 6);
p->__vel.Y += ((sb_svel * doubvel) << 6);
if (!isRRRA() && ((p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH))))
{
p->vel.X = MulScale(p->vel.X, gs.playerfriction - 0x2000, 16);
p->vel.Y = MulScale(p->vel.Y, gs.playerfriction - 0x2000, 16);
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction - 0x2000, 16);
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction - 0x2000, 16);
}
else
{
if (psectlotag == 2)
{
p->vel.X = MulScale(p->vel.X, gs.playerfriction - 0x1400, 16);
p->vel.Y = MulScale(p->vel.Y, gs.playerfriction - 0x1400, 16);
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction - 0x1400, 16);
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction - 0x1400, 16);
}
else
{
p->vel.X = MulScale(p->vel.X, gs.playerfriction, 16);
p->vel.Y = MulScale(p->vel.Y, gs.playerfriction, 16);
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction, 16);
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction, 16);
}
}
@ -3746,8 +3746,8 @@ void processinput_r(int snum)
p->boot_amount--;
else
{
p->vel.X = MulScale(p->vel.X, gs.playerfriction, 16);
p->vel.Y = MulScale(p->vel.Y, gs.playerfriction, 16);
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction, 16);
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction, 16);
}
}
else
@ -3758,8 +3758,8 @@ void processinput_r(int snum)
{
if (p->on_ground)
{
p->vel.X = MulScale(p->vel.X, gs.playerfriction - 0x1800, 16);
p->vel.Y = MulScale(p->vel.Y, gs.playerfriction - 0x1800, 16);
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction - 0x1800, 16);
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction - 0x1800, 16);
}
}
else
@ -3767,20 +3767,20 @@ void processinput_r(int snum)
p->boot_amount--;
else
{
p->vel.X = MulScale(p->vel.X, gs.playerfriction - 0x1800, 16);
p->vel.Y = MulScale(p->vel.Y, gs.playerfriction - 0x1800, 16);
p->__vel.X = MulScale(p->__vel.X, gs.playerfriction - 0x1800, 16);
p->__vel.Y = MulScale(p->__vel.Y, gs.playerfriction - 0x1800, 16);
}
}
if (abs(p->vel.X) < 2048 && abs(p->vel.Y) < 2048)
p->vel.X = p->vel.Y = 0;
if (abs(p->__vel.X) < 2048 && abs(p->__vel.Y) < 2048)
p->__vel.X = p->__vel.Y = 0;
if (shrunk)
{
p->vel.X =
MulScale(p->vel.X, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
p->vel.Y =
MulScale(p->vel.Y, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
p->__vel.X =
MulScale(p->__vel.X, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
p->__vel.Y =
MulScale(p->__vel.Y, gs.playerfriction - (gs.playerfriction >> 1) + (gs.playerfriction >> 2), 16);
}
}
@ -3795,12 +3795,12 @@ HORIZONLY:
Collision clip{};
if (ud.clipping)
{
p->player_add_int_xy({ p->vel.X >> 14, p->vel.Y >> 14 });
p->player_add_int_xy({ p->__vel.X >> 14, p->__vel.Y >> 14 });
updatesector(p->player_int_pos().X, p->player_int_pos().Y, &p->cursector);
ChangeActorSect(pact, p->cursector);
}
else
clipmove(p->pos, &p->cursector, p->vel.X, p->vel.Y, 164, (4 << 8), i, CLIPMASK0, clip);
clipmove(p->pos, &p->cursector, p->__vel.X, p->__vel.Y, 164, (4 << 8), i, CLIPMASK0, clip);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
p->pos.Z += 32;
@ -4057,8 +4057,8 @@ void OnMotorcycle(player_struct *p, DDukeActor* motosprite)
p->last_full_weapon = p->curr_weapon;
p->curr_weapon = MOTORCYCLE_WEAPON;
p->gotweapon[MOTORCYCLE_WEAPON] = true;
p->vel.X = 0;
p->vel.Y = 0;
p->__vel.X = 0;
p->__vel.Y = 0;
p->horizon.horiz = q16horiz(0);
}
if (!S_CheckActorSoundPlaying(p->GetActor(),186))
@ -4098,8 +4098,8 @@ void OffMotorcycle(player_struct *p)
p->VBumpTarget = 0;
p->VBumpNow = 0;
p->TurbCount = 0;
p->vel.X = 0 - p->angle.ang.Cos() * (1 << 7);
p->vel.Y = 0 - p->angle.ang.Sin() * (1 << 7);
p->__vel.X = 0 - p->angle.ang.Cos() * (1 << 7);
p->__vel.Y = 0 - p->angle.ang.Sin() * (1 << 7);
p->moto_underwater = 0;
auto spawned = spawn(p->GetActor(), EMPTYBIKE);
if (spawned)
@ -4133,8 +4133,8 @@ void OnBoat(player_struct *p, DDukeActor* boat)
p->last_full_weapon = p->curr_weapon;
p->curr_weapon = BOAT_WEAPON;
p->gotweapon[BOAT_WEAPON] = true;
p->vel.X = 0;
p->vel.Y = 0;
p->__vel.X = 0;
p->__vel.Y = 0;
p->horizon.horiz = q16horiz(0);
}
}
@ -4161,8 +4161,8 @@ void OffBoat(player_struct *p)
p->VBumpTarget = 0;
p->VBumpNow = 0;
p->TurbCount = 0;
p->vel.X = 0 - p->angle.ang.Cos() * (1 << 7);
p->vel.Y = 0 - p->angle.ang.Sin() * (1 << 7);
p->__vel.X = 0 - p->angle.ang.Cos() * (1 << 7);
p->__vel.Y = 0 - p->angle.ang.Sin() * (1 << 7);
p->moto_underwater = 0;
auto spawned = spawn(p->GetActor(), EMPTYBOAT);
if (spawned)

View file

@ -438,7 +438,7 @@ void operateweapon_ww(int snum, ESyncBits actions)
&& p->kickback_pic < (aplWeaponFireDelay(p->curr_weapon, snum) + 1))
{
p->pos.Z = p->opos.Z;
p->vel.Z = 0;
p->__vel.Z = 0;
}
if (p->kickback_pic == aplWeaponSound2Time(p->curr_weapon, snum))
{

View file

@ -183,9 +183,9 @@ void resetplayerstats(int snum)
p->newOwner =nullptr;
p->jumping_counter = 0;
p->hard_landing = 0;
p->vel.X = 0; //!!
p->vel.Y = 0;
p->vel.Z = 0;
p->__vel.X = 0; //!!
p->__vel.Y = 0;
p->__vel.Z = 0;
p->fric.X = 0;
p->fric.Y = 0;
p->somethingonplayer = nullptr;

View file

@ -122,9 +122,9 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w,
("bobposx", w.bobpos.X)
("bobposy", w.bobpos.Y)
("pyoff", w.pyoff)
("posxv", w.vel.X)
("posyv", w.vel.Y)
("poszv", w.vel.Z)
("posxv", w.__vel.X)
("posyv", w.__vel.Y)
("poszv", w.__vel.Z)
("last_pissed_time", w.last_pissed_time)
("truefz", w.truefz)
("truecz", w.truecz)

View file

@ -392,7 +392,7 @@ void doanimations(void)
if (ps[p].GetActor()->GetOwner() != nullptr)
{
ps[p].player_add_int_z(v);
ps[p].vel.Z = 0;
ps[p].__vel.Z = 0;
}
DukeSectIterator it(dasectp);

View file

@ -916,8 +916,8 @@ void checkplayerhurt_d(player_struct* p, const Collision& coll)
p->hurt_delay = 16;
SetPlayerPal(p, PalEntry(32, 32, 0, 0));
p->vel.X = -p->angle.ang.Cos() * (1 << 22);
p->vel.Y = -p->angle.ang.Sin() * (1 << 22);
p->__vel.X = -p->angle.ang.Cos() * (1 << 22);
p->__vel.Y = -p->angle.ang.Sin() * (1 << 22);
S_PlayActorSound(DUKE_LONGTERM_PAIN, p->GetActor());
fi.checkhitwall(p->GetActor(), wal, p->pos + p->angle.ang.ToVector() * 2, -1);

View file

@ -201,7 +201,7 @@ struct CraneDef
struct player_struct
{
vec3_t vel;
vec3_t __vel;
DVector3 pos, opos;
DVector2 bobpos;