Start hill-parking

This commit is contained in:
lachwright 2020-05-09 06:24:53 +08:00
parent b99e75c298
commit 9b1ec81622
5 changed files with 16 additions and 23 deletions

View file

@ -1248,7 +1248,7 @@ INT32 JoyAxis(axis_input_e axissel, UINT8 p)
INT32 localaiming[MAXSPLITSCREENPLAYERS];
angle_t localangle[MAXSPLITSCREENPLAYERS];
static fixed_t forwardmove[2] = {25<<FRACBITS>>16, 50<<FRACBITS>>16};
static fixed_t forwardmove = 50<<FRACBITS>>16;
static fixed_t sidemove[2] = {2<<FRACBITS>>16, 4<<FRACBITS>>16};
static fixed_t angleturn[3] = {KART_FULLTURN/2, KART_FULLTURN, KART_FULLTURN/4}; // + slow turn
@ -1418,9 +1418,9 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
cmd->buttons |= BT_BRAKE;
axis = JoyAxis(AXISAIM, ssplayer);
if (InputDown(gc_aimforward, ssplayer) || (usejoystick && axis < 0))
forward += forwardmove[1];
forward += forwardmove;
if (InputDown(gc_aimbackward, ssplayer) || (usejoystick && axis > 0))
forward -= forwardmove[1];
forward -= forwardmove;
}
else
{
@ -1429,13 +1429,13 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
if (InputDown(gc_accelerate, ssplayer) || (gamepadjoystickmove && axis > 0) || EITHERSNEAKER(player))
{
cmd->buttons |= BT_ACCELERATE;
forward = forwardmove[1]; // 50
forward = forwardmove; // 50
}
else if (analogjoystickmove && axis > 0)
{
cmd->buttons |= BT_ACCELERATE;
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
forward += ((axis * forwardmove[1]) >> 10)*2;
forward += ((axis * forwardmove) >> 10)*2;
}
axis = JoyAxis(AXISBRAKE, ssplayer);
@ -1443,14 +1443,14 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
{
cmd->buttons |= BT_BRAKE;
if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0)
forward -= forwardmove[0]; // 25 - Halved value so clutching is possible
forward -= forwardmove;
}
else if (analogjoystickmove && axis > 0)
{
cmd->buttons |= BT_BRAKE;
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
if (cmd->buttons & BT_ACCELERATE || cmd->forwardmove <= 0)
forward -= ((axis * forwardmove[0]) >> 10);
forward -= ((axis * forwardmove) >> 10);
}
// But forward/backward IS used for aiming.

View file

@ -2728,7 +2728,6 @@ fixed_t K_3dKartMovement(player_t *player, boolean onground, fixed_t forwardmove
// forwardmove is:
// 50 while accelerating,
// 25 while clutching,
// 0 with no gas, and
// -25 when only braking.
@ -7889,11 +7888,13 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
// Friction
if (!player->kartstuff[k_offroad])
{
if (player->speed > 0 && cmd->forwardmove == 0 && player->mo->friction == 59392)
if (player->speed > 0 && cmd->forwardmove == 0 && !(cmd->buttons & BT_BRAKE) && player->mo->friction == 59392)
player->mo->friction += 4608;
}
if (player->speed > 0 && cmd->forwardmove < 0) // change friction while braking no matter what, otherwise it's not any more effective than just letting go off accel
if ((cmd->buttons & (BT_BRAKE|BT_ACCELERATE)) == (BT_BRAKE|BT_ACCELERATE) && !(player->kartstuff[k_drift]))
player->mo->friction -= 3072;
else if (player->speed > 0 && cmd->forwardmove < 0) // change friction while braking no matter what, otherwise it's not any more effective than just letting go off accel
player->mo->friction -= 2048;
// Karma ice physics

View file

@ -1439,7 +1439,7 @@ static void P_XYFriction(mobj_t *mo, fixed_t oldx, fixed_t oldy)
&& abs(player->rmomy) < FixedMul(STOPSPEED, mo->scale)
&& (!(player->cmd.forwardmove && !(twodlevel || mo->flags2 & MF2_TWOD)) && !player->cmd.sidemove && !(player->pflags & PF_SPINNING))
#ifdef ESLOPE
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)) && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2))
&& !(player->mo->standingslope && (!(player->mo->standingslope->flags & SL_NOPHYSICS)))// && (abs(player->mo->standingslope->zdelta) >= FRACUNIT/2))
#endif
)
{

View file

@ -883,6 +883,10 @@ void P_ButteredSlope(mobj_t *mo)
return; // don't slide down slopes if you can't touch them or you're not affected by gravity
if (mo->player) {
// SRB2Kart - spindash negates slopes
if (((mo->player->cmd.buttons & (BT_BRAKE|BT_ACCELERATE)) == (BT_BRAKE|BT_ACCELERATE)) && !mo->player->kartstuff[k_drift])
return;
// Changed in kart to only not apply physics on very slight slopes (I think about 4 degree angles)
if (abs(mo->standingslope->zdelta) < FRACUNIT/21 && !(mo->player->pflags & PF_SPINNING))
return; // Don't slide on non-steep slopes unless spinning

View file

@ -4108,18 +4108,6 @@ static void P_3dMovement(player_t *player)
if (player->mo->movefactor != FRACUNIT) // Friction-scaled acceleration...
movepushforward = FixedMul(movepushforward, player->mo->movefactor);
if (cmd->buttons & BT_BRAKE && !cmd->forwardmove) // SRB2kart - braking isn't instant
movepushforward /= 64;
if (cmd->forwardmove > 0)
player->kartstuff[k_brakestop] = 0;
else if (player->kartstuff[k_brakestop] < 6) // Don't start reversing with brakes until you've made a stop first
{
if (player->speed < 8*FRACUNIT)
player->kartstuff[k_brakestop]++;
movepushforward = 0;
}
#ifdef ESLOPE
totalthrust.x += P_ReturnThrustX(player->mo, movepushangle, movepushforward);
totalthrust.y += P_ReturnThrustY(player->mo, movepushangle, movepushforward);