mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 04:24:39 +00:00
- Duke: Move RRRA vehicle tilting out of the input code and into the playsim.
This commit is contained in:
parent
c13745efc8
commit
03eb105df1
5 changed files with 19 additions and 28 deletions
|
@ -119,7 +119,7 @@ void displayweapon_r(int snum, double interpfrac)
|
|||
weapon_sway = interpolatedvalue<double>(p->oweapon_sway, p->weapon_sway, interpfrac);
|
||||
hard_landing = interpolatedvalue<double>(p->ohard_landing, p->hard_landing, interpfrac);
|
||||
gun_pos = 80 - interpolatedvalue<double>(p->oweapon_pos * p->oweapon_pos, p->weapon_pos * p->weapon_pos, interpfrac);
|
||||
TiltStatus = !SyncInput() ? p->TiltStatus : interpolatedvalue<double>(p->oTiltStatus, p->TiltStatus, interpfrac);
|
||||
TiltStatus = interpolatedvalue<double>(p->oTiltStatus, p->TiltStatus, interpfrac);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -508,17 +508,6 @@ void hud_input(int plnum)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void doVehicleTilting(player_struct* const p, const int turndir, const float factor)
|
||||
{
|
||||
if (turndir)
|
||||
{
|
||||
p->oTiltStatus = p->TiltStatus;
|
||||
p->TiltStatus += factor * turndir;
|
||||
if (abs(p->TiltStatus) > 10)
|
||||
p->TiltStatus = 10.f * turndir;
|
||||
}
|
||||
}
|
||||
|
||||
static float getVehicleTurnVel(player_struct* p, HIDInput* const hidInput, const float factor, const float baseVel, const float velScale)
|
||||
{
|
||||
float turnvel = 0;
|
||||
|
@ -534,16 +523,8 @@ static float getVehicleTurnVel(player_struct* p, HIDInput* const hidInput, const
|
|||
const bool hidRight = hidInput->mouseturnx > 0 || hidInput->joyaxes[JOYAXIS_Yaw] < 0;
|
||||
const int turndir = (kbdRight || hidRight) - (kbdLeft || hidLeft);
|
||||
|
||||
if (p->OnMotorcycle && (p->MotoSpeed == 0 || !p->on_ground))
|
||||
if ((p->OnMotorcycle || p->MotoSpeed) && (turndir || p->moto_drink))
|
||||
{
|
||||
resetTurnHeldAmt();
|
||||
doVehicleTilting(p, turndir, factor);
|
||||
}
|
||||
else if ((p->OnMotorcycle || p->MotoSpeed) && (turndir || p->moto_drink))
|
||||
{
|
||||
if (p->OnMotorcycle || !p->NotOnWater)
|
||||
doVehicleTilting(p, turndir, factor);
|
||||
|
||||
const bool noattenuate = (isTurboTurnTime() || hidLeft || hidRight) && (!p->OnMotorcycle || p->MotoSpeed > 0);
|
||||
const auto vel = (noattenuate) ? (baseVel) : (baseVel * velScale);
|
||||
|
||||
|
@ -558,15 +539,11 @@ static float getVehicleTurnVel(player_struct* p, HIDInput* const hidInput, const
|
|||
if (hidInput->mouseturnx)
|
||||
turnvel += sqrtf(abs(vel * hidInput->mouseturnx / factor) * (7.f / 20.f)) * Sgn(vel) * Sgn(hidInput->mouseturnx);
|
||||
}
|
||||
else if (p->OnMotorcycle || !p->NotOnWater)
|
||||
else
|
||||
{
|
||||
resetTurnHeldAmt();
|
||||
p->TiltStatus -= factor * Sgn(p->TiltStatus);
|
||||
}
|
||||
|
||||
if (fabs(p->TiltStatus) < factor)
|
||||
p->TiltStatus = 0;
|
||||
|
||||
return turnvel * factor;
|
||||
}
|
||||
|
||||
|
|
|
@ -1491,6 +1491,18 @@ static unsigned outVehicleFlags(player_struct* p, ESyncBits& actions)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void doVehicleTilting(player_struct* const p, const int turndir, const bool canTilt)
|
||||
{
|
||||
p->oTiltStatus = p->TiltStatus;
|
||||
p->TiltStatus = clamp(p->TiltStatus + (turndir && canTilt ? turndir : -Sgn(p->TiltStatus)), -10, 10);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void doVehicleBumping(player_struct* p, DDukeActor* pact, unsigned flags, bool bumptest, int bumpscale)
|
||||
{
|
||||
if (p->MotoSpeed != 0 && p->on_ground == 1)
|
||||
|
@ -1718,6 +1730,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
|
|||
p->MotoSpeed = 0;
|
||||
|
||||
unsigned flags = outVehicleFlags(p, actions);
|
||||
doVehicleTilting(p, Sgn(p->sync.avel), !p->on_ground || p->sync.avel);
|
||||
doVehicleSounds(p, pact, flags, 187, 188, 214, 189);
|
||||
doVehicleDrunk(p);
|
||||
doVehicleThrottling(p, pact, flags, 2, 15, p->moto_on_oil ? 2 : 4, 70, -30);
|
||||
|
@ -1809,6 +1822,7 @@ static void onBoat(int snum, ESyncBits &actions)
|
|||
p->MotoSpeed = 0;
|
||||
|
||||
unsigned flags = outVehicleFlags(p, actions);
|
||||
doVehicleTilting(p, Sgn(p->sync.avel), (p->MotoSpeed != 0 && (p->sync.avel || p->moto_drink)) || !p->NotOnWater);
|
||||
doVehicleSounds(p, pact, flags, 87, 88, 89, 90);
|
||||
|
||||
if (!p->NotOnWater)
|
||||
|
|
|
@ -299,7 +299,7 @@ struct player_struct
|
|||
int SeaSick;
|
||||
short MamaEnd; // raat609
|
||||
short moto_drink;
|
||||
float TiltStatus, oTiltStatus;
|
||||
short TiltStatus, oTiltStatus;
|
||||
double VBumpNow, VBumpTarget;
|
||||
short TurbCount;
|
||||
short drug_stat[3]; // raat5f1..5
|
||||
|
|
|
@ -325,7 +325,7 @@ struct DukePlayer native
|
|||
native int SeaSick;
|
||||
native int16 MamaEnd; // raat609
|
||||
native int16 moto_drink;
|
||||
native float TiltStatus, oTiltStatus;
|
||||
native int16 TiltStatus, oTiltStatus;
|
||||
native double VBumpNow, VBumpTarget;
|
||||
native int16 TurbCount;
|
||||
native int16 drug_stat[3]; // raat5f1..5
|
||||
|
|
Loading…
Reference in a new issue