mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
- Duke/RR: Initial implementation of scaled p->MotoSpeed
controller input.
This commit is contained in:
parent
578ded1db3
commit
ad10ea4cb5
3 changed files with 24 additions and 43 deletions
|
@ -775,10 +775,9 @@ static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, I
|
||||||
|
|
||||||
if (p->OnBoat || !p->moto_underwater)
|
if (p->OnBoat || !p->moto_underwater)
|
||||||
{
|
{
|
||||||
if (buttonMap.ButtonDown(gamefunc_Move_Forward) || buttonMap.ButtonDown(gamefunc_Strafe))
|
p->vehForwardScale = (buttonMap.ButtonDown(gamefunc_Move_Forward) || buttonMap.ButtonDown(gamefunc_Strafe)) + hidInput->dz;
|
||||||
loc.actions |= SB_JUMP;
|
p->vehReverseScale = buttonMap.ButtonDown(gamefunc_Move_Backward) + -hidInput->dz;
|
||||||
if (buttonMap.ButtonDown(gamefunc_Move_Backward))
|
|
||||||
p->vehicle_backwards = true;
|
|
||||||
if (loc.actions & SB_RUN)
|
if (loc.actions & SB_RUN)
|
||||||
loc.actions |= SB_CROUCH;
|
loc.actions |= SB_CROUCH;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1573,7 +1573,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
|
||||||
auto pact = p->GetActor();
|
auto pact = p->GetActor();
|
||||||
auto s = &pact->s;
|
auto s = &pact->s;
|
||||||
|
|
||||||
int braking, moveForward, moveBackward, turnLeft, turnRight;
|
int braking, turnLeft, turnRight;
|
||||||
short rng;
|
short rng;
|
||||||
if (p->MotoSpeed < 0)
|
if (p->MotoSpeed < 0)
|
||||||
p->MotoSpeed = 0;
|
p->MotoSpeed = 0;
|
||||||
|
@ -1585,10 +1585,8 @@ static void onMotorcycle(int snum, ESyncBits &actions)
|
||||||
else
|
else
|
||||||
braking = 0;
|
braking = 0;
|
||||||
|
|
||||||
if (actions & SB_JUMP)
|
if (p->vehForwardScale != 0)
|
||||||
{
|
{
|
||||||
moveForward = 1;
|
|
||||||
actions &= ~SB_JUMP;
|
|
||||||
if (p->on_ground)
|
if (p->on_ground)
|
||||||
{
|
{
|
||||||
if (p->MotoSpeed == 0 && braking)
|
if (p->MotoSpeed == 0 && braking)
|
||||||
|
@ -1614,7 +1612,6 @@ static void onMotorcycle(int snum, ESyncBits &actions)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
moveForward = 0;
|
|
||||||
if (S_CheckActorSoundPlaying(pact, 214))
|
if (S_CheckActorSoundPlaying(pact, 214))
|
||||||
{
|
{
|
||||||
S_StopSound(214, pact);
|
S_StopSound(214, pact);
|
||||||
|
@ -1630,13 +1627,6 @@ static void onMotorcycle(int snum, ESyncBits &actions)
|
||||||
if (!S_CheckActorSoundPlaying(pact, 189) && !S_CheckActorSoundPlaying(pact, 187))
|
if (!S_CheckActorSoundPlaying(pact, 189) && !S_CheckActorSoundPlaying(pact, 187))
|
||||||
S_PlayActorSound(187, pact);
|
S_PlayActorSound(187, pact);
|
||||||
}
|
}
|
||||||
if (p->vehicle_backwards)
|
|
||||||
{
|
|
||||||
moveBackward = 1;
|
|
||||||
p->vehicle_backwards = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
moveBackward = 0;
|
|
||||||
if (p->vehicle_turnl)
|
if (p->vehicle_turnl)
|
||||||
{
|
{
|
||||||
turnLeft = 1;
|
turnLeft = 1;
|
||||||
|
@ -1684,14 +1674,15 @@ static void onMotorcycle(int snum, ESyncBits &actions)
|
||||||
p->VBumpTarget = -30;
|
p->VBumpTarget = -30;
|
||||||
p->moto_do_bump = 1;
|
p->moto_do_bump = 1;
|
||||||
}
|
}
|
||||||
else if (moveForward && !braking)
|
else if (p->vehForwardScale != 0 && !braking)
|
||||||
{
|
{
|
||||||
if (p->MotoSpeed < 40)
|
if (p->MotoSpeed < 40)
|
||||||
{
|
{
|
||||||
p->VBumpTarget = 70;
|
p->VBumpTarget = 70;
|
||||||
p->moto_bump_fast = 1;
|
p->moto_bump_fast = 1;
|
||||||
}
|
}
|
||||||
p->MotoSpeed += 2;
|
p->MotoSpeed += 2 * p->vehForwardScale;
|
||||||
|
p->vehForwardScale = 0;
|
||||||
if (p->MotoSpeed > 120)
|
if (p->MotoSpeed > 120)
|
||||||
p->MotoSpeed = 120;
|
p->MotoSpeed = 120;
|
||||||
if (!p->NotOnWater)
|
if (!p->NotOnWater)
|
||||||
|
@ -1705,10 +1696,11 @@ static void onMotorcycle(int snum, ESyncBits &actions)
|
||||||
p->VBumpTarget = 0;
|
p->VBumpTarget = 0;
|
||||||
p->moto_do_bump = 0;
|
p->moto_do_bump = 0;
|
||||||
}
|
}
|
||||||
if (moveBackward && p->MotoSpeed <= 0 && !braking)
|
if (p->vehReverseScale != 0 && p->MotoSpeed <= 0 && !braking)
|
||||||
{
|
{
|
||||||
int temp;
|
int temp;
|
||||||
p->MotoSpeed = -15;
|
p->MotoSpeed = -15 * p->vehReverseScale;
|
||||||
|
p->vehReverseScale = 0;
|
||||||
temp = turnRight;
|
temp = turnRight;
|
||||||
turnRight = turnLeft;
|
turnRight = turnLeft;
|
||||||
turnLeft = temp;
|
turnLeft = temp;
|
||||||
|
@ -1866,7 +1858,7 @@ static void onBoat(int snum, ESyncBits &actions)
|
||||||
auto pact = p->GetActor();
|
auto pact = p->GetActor();
|
||||||
auto s = &pact->s;
|
auto s = &pact->s;
|
||||||
|
|
||||||
int heeltoe, braking, moveForward, moveBackward, turnLeft, turnRight;
|
int heeltoe, braking, turnLeft, turnRight;
|
||||||
short rng;
|
short rng;
|
||||||
if (p->NotOnWater)
|
if (p->NotOnWater)
|
||||||
{
|
{
|
||||||
|
@ -1883,19 +1875,17 @@ static void onBoat(int snum, ESyncBits &actions)
|
||||||
}
|
}
|
||||||
if (p->MotoSpeed < 0)
|
if (p->MotoSpeed < 0)
|
||||||
p->MotoSpeed = 0;
|
p->MotoSpeed = 0;
|
||||||
if ((actions & SB_CROUCH) && (actions & SB_JUMP))
|
if ((actions & SB_CROUCH) && (p->vehForwardScale != 0))
|
||||||
{
|
{
|
||||||
heeltoe = 1;
|
heeltoe = 1;
|
||||||
moveForward = 0;
|
|
||||||
braking = 0;
|
braking = 0;
|
||||||
actions &= ~(SB_JUMP|SB_CROUCH);
|
p->vehForwardScale = 0;
|
||||||
|
actions &= ~SB_CROUCH;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
heeltoe = 0;
|
heeltoe = 0;
|
||||||
if (actions & SB_JUMP)
|
if (p->vehForwardScale != 0)
|
||||||
{
|
{
|
||||||
moveForward = 1;
|
|
||||||
actions &= ~SB_JUMP;
|
|
||||||
if (p->MotoSpeed == 0 && !S_CheckActorSoundPlaying(pact, 89))
|
if (p->MotoSpeed == 0 && !S_CheckActorSoundPlaying(pact, 89))
|
||||||
{
|
{
|
||||||
if (S_CheckActorSoundPlaying(pact, 87))
|
if (S_CheckActorSoundPlaying(pact, 87))
|
||||||
|
@ -1909,7 +1899,6 @@ static void onBoat(int snum, ESyncBits &actions)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
moveForward = 0;
|
|
||||||
if (S_CheckActorSoundPlaying(pact, 89))
|
if (S_CheckActorSoundPlaying(pact, 89))
|
||||||
{
|
{
|
||||||
S_StopSound(89, pact);
|
S_StopSound(89, pact);
|
||||||
|
@ -1933,12 +1922,6 @@ static void onBoat(int snum, ESyncBits &actions)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
braking = 0;
|
braking = 0;
|
||||||
if (p->vehicle_backwards)
|
|
||||||
{
|
|
||||||
moveBackward = 1;
|
|
||||||
p->vehicle_backwards = false;
|
|
||||||
}
|
|
||||||
else moveBackward = 0;
|
|
||||||
if (p->vehicle_turnl)
|
if (p->vehicle_turnl)
|
||||||
{
|
{
|
||||||
turnLeft = 1;
|
turnLeft = 1;
|
||||||
|
@ -2007,7 +1990,7 @@ static void onBoat(int snum, ESyncBits &actions)
|
||||||
p->VBumpTarget = 30;
|
p->VBumpTarget = 30;
|
||||||
p->moto_do_bump = 1;
|
p->moto_do_bump = 1;
|
||||||
}
|
}
|
||||||
else if (moveForward)
|
else if (p->vehForwardScale != 0)
|
||||||
{
|
{
|
||||||
if (p->MotoSpeed < 40)
|
if (p->MotoSpeed < 40)
|
||||||
if (!p->NotOnWater)
|
if (!p->NotOnWater)
|
||||||
|
@ -2015,7 +1998,8 @@ static void onBoat(int snum, ESyncBits &actions)
|
||||||
p->VBumpTarget = -30;
|
p->VBumpTarget = -30;
|
||||||
p->moto_bump_fast = 1;
|
p->moto_bump_fast = 1;
|
||||||
}
|
}
|
||||||
p->MotoSpeed++;
|
p->MotoSpeed += 1 * p->vehForwardScale;
|
||||||
|
p->vehForwardScale = 0;
|
||||||
if (p->MotoSpeed > 120)
|
if (p->MotoSpeed > 120)
|
||||||
p->MotoSpeed = 120;
|
p->MotoSpeed = 120;
|
||||||
}
|
}
|
||||||
|
@ -2026,13 +2010,11 @@ static void onBoat(int snum, ESyncBits &actions)
|
||||||
p->VBumpTarget = 0;
|
p->VBumpTarget = 0;
|
||||||
p->moto_do_bump = 0;
|
p->moto_do_bump = 0;
|
||||||
}
|
}
|
||||||
if (moveBackward && p->MotoSpeed == 0 && !braking)
|
if (p->vehReverseScale != 0 && p->MotoSpeed == 0 && !braking)
|
||||||
{
|
{
|
||||||
int temp;
|
int temp;
|
||||||
if (!p->NotOnWater)
|
p->MotoSpeed = -(!p->NotOnWater ? 25 : 20) * p->vehReverseScale;
|
||||||
p->MotoSpeed = -25;
|
p->vehReverseScale = 0;
|
||||||
else
|
|
||||||
p->MotoSpeed = -20;
|
|
||||||
temp = turnRight;
|
temp = turnRight;
|
||||||
turnRight = turnLeft;
|
turnRight = turnLeft;
|
||||||
turnLeft = temp;
|
turnLeft = temp;
|
||||||
|
|
|
@ -275,8 +275,8 @@ struct player_struct
|
||||||
uint8_t hurt_delay2, nocheat;
|
uint8_t hurt_delay2, nocheat;
|
||||||
uint8_t OnMotorcycle, OnBoat, moto_underwater, NotOnWater, MotoOnGround;
|
uint8_t OnMotorcycle, OnBoat, moto_underwater, NotOnWater, MotoOnGround;
|
||||||
uint8_t moto_do_bump, moto_bump_fast, moto_on_oil, moto_on_mud;
|
uint8_t moto_do_bump, moto_bump_fast, moto_on_oil, moto_on_mud;
|
||||||
double MotoSpeed;
|
double vehForwardScale, vehReverseScale, MotoSpeed;
|
||||||
bool vehicle_turnl, vehicle_turnr, vehicle_backwards;
|
bool vehicle_turnl, vehicle_turnr;
|
||||||
|
|
||||||
int8_t crouch_toggle;
|
int8_t crouch_toggle;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue