mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-15 17:21:34 +00:00
Boost cam
This commit is contained in:
parent
1548e59b2b
commit
36356f8a64
4 changed files with 36 additions and 4 deletions
|
@ -300,6 +300,8 @@ typedef enum
|
|||
k_dashpadcooldown, // Separate the vanilla SA-style dash pads from using pw_flashing
|
||||
k_speedboost, // Boost value smoothing for max speed
|
||||
k_accelboost, // Boost value smoothing for acceleration
|
||||
k_boostcam, // Camera push forward on boost
|
||||
k_destboostcam, // Ditto
|
||||
|
||||
k_itemroulette, // Used for the roulette when deciding what item to give you (was "pw_kartitem")
|
||||
k_roulettetype, // Used for the roulette, for deciding type (currently only used for Battle, to give you better items from Karma items)
|
||||
|
|
|
@ -7684,6 +7684,8 @@ static const char *const KARTSTUFF_LIST[] = {
|
|||
"DASHPADCOOLDOWN",
|
||||
"SPEEDBOOST",
|
||||
"ACCELBOOST",
|
||||
"BOOSTCAM",
|
||||
"DESTBOOSTCAM",
|
||||
|
||||
"ITEMROULETTE",
|
||||
"ROULETTETYPE",
|
||||
|
|
32
src/k_kart.c
32
src/k_kart.c
|
@ -1502,12 +1502,12 @@ static void K_GetKartBoostPower(player_t *player)
|
|||
// just take the highest we want instead
|
||||
|
||||
if (boostpower + speedboost > player->kartstuff[k_speedboost])
|
||||
player->kartstuff[k_speedboost] += ((boostpower+speedboost) - player->kartstuff[k_speedboost])/(TICRATE/2); // Quick increase if higher
|
||||
player->kartstuff[k_speedboost] = boostpower + speedboost; // Immediate increase if higher
|
||||
else
|
||||
player->kartstuff[k_speedboost] += ((boostpower+speedboost) - player->kartstuff[k_speedboost])/TICRATE; // Smoothly decrease if lower
|
||||
player->kartstuff[k_speedboost] += ((boostpower + speedboost) - player->kartstuff[k_speedboost])/TICRATE; // Smoothly decrease if lower
|
||||
|
||||
// Accel isn't affected by boostpower, hence the FRACUNIT. Probably for making acceleration feel consistent in offroad.
|
||||
player->kartstuff[k_accelboost] = FRACUNIT+accelboost;
|
||||
player->kartstuff[k_accelboost] = FRACUNIT + accelboost;
|
||||
}
|
||||
|
||||
fixed_t K_GetKartSpeed(player_t *player, boolean doboostpower)
|
||||
|
@ -2672,6 +2672,8 @@ static void K_DoHyudoroSteal(player_t *player)
|
|||
|
||||
void K_DoSneaker(player_t *player, boolean doPFlag)
|
||||
{
|
||||
const fixed_t prevboost = player->kartstuff[k_speedboost];
|
||||
|
||||
if (!player->kartstuff[k_floorboost] || player->kartstuff[k_floorboost] == 3)
|
||||
S_StartSound(player->mo, sfx_cdfm01);
|
||||
|
||||
|
@ -2681,6 +2683,11 @@ void K_DoSneaker(player_t *player, boolean doPFlag)
|
|||
player->pflags |= PF_ATTACKDOWN;
|
||||
|
||||
K_PlayTauntSound(player->mo);
|
||||
|
||||
K_GetKartBoostPower(player);
|
||||
|
||||
// Push the camera forward, the amount depending on how much the speed boost increases
|
||||
player->kartstuff[k_destboostcam] = FixedMul(FRACUNIT, player->kartstuff[k_speedboost]-prevboost);
|
||||
}
|
||||
|
||||
static void K_DoShrink(player_t *player)
|
||||
|
@ -3237,6 +3244,25 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
player->kartstuff[k_dashpadcooldown]--;
|
||||
}
|
||||
|
||||
// DKR style camera for boosting
|
||||
if (player->kartstuff[k_boostcam] != 0 || player->kartstuff[k_destboostcam] != 0)
|
||||
{
|
||||
if (player->kartstuff[k_boostcam] < player->kartstuff[k_destboostcam]
|
||||
&& player->kartstuff[k_destboostcam] != 0)
|
||||
{
|
||||
player->kartstuff[k_boostcam] += FRACUNIT/8;
|
||||
if (player->kartstuff[k_boostcam] >= player->kartstuff[k_destboostcam])
|
||||
player->kartstuff[k_destboostcam] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->kartstuff[k_boostcam] -= FRACUNIT/8;
|
||||
if (player->kartstuff[k_boostcam] < player->kartstuff[k_destboostcam])
|
||||
player->kartstuff[k_boostcam] = player->kartstuff[k_destboostcam] = 0;
|
||||
}
|
||||
//CONS_Printf("cam: %d, dest: %d\n", player->kartstuff[k_boostcam], player->kartstuff[k_destboostcam]);
|
||||
}
|
||||
|
||||
if (player->kartstuff[k_spinouttimer])
|
||||
{
|
||||
if ((P_IsObjectOnGround(player->mo) || player->kartstuff[k_spinouttype] == 1)
|
||||
|
|
|
@ -8372,7 +8372,9 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
dist = camdist;
|
||||
|
||||
if (player->speed > K_GetKartSpeed(player, false))
|
||||
dist += 3*(player->speed - K_GetKartSpeed(player, false));
|
||||
dist += 4*(player->speed - K_GetKartSpeed(player, false));
|
||||
if (player->kartstuff[k_boostcam])
|
||||
dist -= FixedMul(dist/2, player->kartstuff[k_boostcam]);
|
||||
|
||||
if (player->climbing || player->playerstate == PST_DEAD || (player->pflags & (PF_MACESPIN|PF_ITEMHANG|PF_ROPEHANG)))
|
||||
dist <<= 1;
|
||||
|
|
Loading…
Reference in a new issue