mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-31 04:02:37 +00:00
Weaker tumble, some effects + tumble on spring panel fail
This commit is contained in:
parent
061ad6587b
commit
3cd4c87df5
8 changed files with 78 additions and 7 deletions
|
|
@ -629,6 +629,7 @@ static inline void resynch_write_player(resynch_pak *rsp, const size_t i)
|
|||
rsp->tumbleBounces = players[i].tumbleBounces;
|
||||
rsp->tumbleHeight = SHORT(players[i].tumbleHeight);
|
||||
rsp->tumbleLastBounce = players[i].tumbleLastBounce;
|
||||
rsp->tumbleSound = players[i].tumbleSound;
|
||||
|
||||
// respawnvars_t
|
||||
rsp->respawn_state = players[i].respawn.state;
|
||||
|
|
@ -786,6 +787,7 @@ static void resynch_read_player(resynch_pak *rsp)
|
|||
players[i].tumbleBounces = rsp->tumbleBounces;
|
||||
players[i].tumbleHeight = SHORT(rsp->tumbleHeight);
|
||||
players[i].tumbleLastBounce = (boolean)rsp->tumbleLastBounce;
|
||||
players[i].tumbleSound = (boolean)rsp->tumbleSound;
|
||||
|
||||
// respawnvars_t
|
||||
players[i].respawn.state = rsp->respawn_state;
|
||||
|
|
|
|||
|
|
@ -294,6 +294,7 @@ typedef struct
|
|||
UINT8 tumbleBounces;
|
||||
UINT16 tumbleHeight;
|
||||
boolean tumbleLastBounce;
|
||||
boolean tumbleSound;
|
||||
|
||||
// respawnvars_t
|
||||
UINT8 respawn_state;
|
||||
|
|
|
|||
|
|
@ -2967,7 +2967,7 @@ static void Command_Respawn(void)
|
|||
UINT8 buf[4];
|
||||
UINT8 *cp = buf;
|
||||
|
||||
|
||||
|
||||
|
||||
if (!(gamestate == GS_LEVEL || gamestate == GS_INTERMISSION || gamestate == GS_VOTING))
|
||||
{
|
||||
|
|
@ -4572,7 +4572,7 @@ retryscramble:
|
|||
// Team B gets 2nd, 3rd, 5th, 7th.
|
||||
// So 1st on one team, 2nd/3rd on the other, then alternates afterwards.
|
||||
// Sounds strange on paper, but works really well in practice!
|
||||
else if (i != 2)
|
||||
else if (i != 2)
|
||||
{
|
||||
// We will only randomly pick the team for the first guy.
|
||||
// Otherwise, just alternate back and forth, distributing players.
|
||||
|
|
|
|||
|
|
@ -573,6 +573,7 @@ typedef struct player_s
|
|||
UINT8 tumbleBounces;
|
||||
UINT16 tumbleHeight;
|
||||
boolean tumbleLastBounce;
|
||||
boolean tumbleSound;
|
||||
|
||||
//
|
||||
|
||||
|
|
|
|||
63
src/k_kart.c
63
src/k_kart.c
|
|
@ -2522,6 +2522,7 @@ static void K_RemoveGrowShrink(player_t *player)
|
|||
|
||||
void K_TumblePlayer(player_t *player, mobj_t *inflictor, mobj_t *source)
|
||||
{
|
||||
fixed_t gravityadjust;
|
||||
(void)source;
|
||||
|
||||
player->tumbleBounces = 1;
|
||||
|
|
@ -2530,6 +2531,7 @@ void K_TumblePlayer(player_t *player, mobj_t *inflictor, mobj_t *source)
|
|||
player->mo->momy = 2 * player->mo->momy / 3;
|
||||
|
||||
player->tumbleHeight = 30;
|
||||
player->tumbleSound = 0;
|
||||
|
||||
if (inflictor && !P_MobjWasRemoved(inflictor))
|
||||
{
|
||||
|
|
@ -2537,18 +2539,31 @@ void K_TumblePlayer(player_t *player, mobj_t *inflictor, mobj_t *source)
|
|||
player->tumbleHeight += (addHeight / player->mo->scale);
|
||||
}
|
||||
|
||||
player->mo->momz = player->tumbleHeight * player->mo->scale * P_MobjFlip(player->mo);
|
||||
S_StartSound(player->mo, sfx_s3k9b);
|
||||
|
||||
// adapt momz w/ gravity?
|
||||
// as far as kart goes normal gravity is 2 (FRACUNIT*2)
|
||||
|
||||
gravityadjust = P_GetMobjGravity(player->mo)/2; // so we'll halve it for our calculations.
|
||||
|
||||
if (player->mo->eflags & MFE_UNDERWATER)
|
||||
gravityadjust /= 2; // halve "gravity" underwater
|
||||
|
||||
// and then modulate momz like that...
|
||||
player->mo->momz = -gravityadjust * player->tumbleHeight;
|
||||
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SPINOUT);
|
||||
|
||||
if (P_IsDisplayPlayer(player))
|
||||
P_StartQuake(64<<FRACBITS, 5);
|
||||
P_StartQuake(64<<FRACBITS, 10);
|
||||
}
|
||||
|
||||
static void K_HandleTumbleBounce(player_t *player)
|
||||
{
|
||||
fixed_t gravityadjust;
|
||||
player->tumbleBounces++;
|
||||
player->tumbleHeight = (player->tumbleHeight * 4) / 5;
|
||||
player->tumbleSound = 0;
|
||||
|
||||
if (player->tumbleHeight < 10)
|
||||
{
|
||||
|
|
@ -2556,7 +2571,7 @@ static void K_HandleTumbleBounce(player_t *player)
|
|||
player->tumbleHeight = 10;
|
||||
}
|
||||
|
||||
if (player->tumbleBounces > 4 && player->tumbleHeight < 30)
|
||||
if (player->tumbleBounces > 4 && player->tumbleHeight < 50)
|
||||
{
|
||||
// Leave tumble state when below 30 height, and have bounced off the ground enough
|
||||
|
||||
|
|
@ -2571,13 +2586,41 @@ static void K_HandleTumbleBounce(player_t *player)
|
|||
// One last bounce at the minimum height, to reset the animation
|
||||
player->tumbleHeight = 10;
|
||||
player->tumbleLastBounce = true;
|
||||
player->mo->rollangle = 0; // p_user.c will sotp rotating the player automatically
|
||||
}
|
||||
}
|
||||
|
||||
if (P_IsDisplayPlayer(player) && player->tumbleHeight >= 50)
|
||||
P_StartQuake((player->tumbleHeight*3/2)<<FRACBITS, 6); // funny earthquakes for the FEEL
|
||||
|
||||
S_StartSound(player->mo, (player->tumbleHeight < 50) ? sfx_s3k5d : sfx_s3k5f); // s3k5d is bounce < 50, s3k5f otherwise!
|
||||
|
||||
player->mo->momx = player->mo->momx / 2;
|
||||
player->mo->momy = player->mo->momy / 2;
|
||||
|
||||
player->mo->momz = player->tumbleHeight * player->mo->scale * P_MobjFlip(player->mo);
|
||||
// adapt momz w/ gravity?
|
||||
// as far as kart goes normal gravity is 2 (FRACUNIT*2)
|
||||
|
||||
gravityadjust = P_GetMobjGravity(player->mo)/2; // so we'll halve it for our calculations.
|
||||
|
||||
if (player->mo->eflags & MFE_UNDERWATER)
|
||||
gravityadjust /= 2; // halve "gravity" underwater
|
||||
|
||||
// and then modulate momz like that...
|
||||
player->mo->momz = -gravityadjust * player->tumbleHeight;
|
||||
}
|
||||
|
||||
// Play a falling sound when you start falling while tumbling and you're nowhere near done bouncing
|
||||
static void K_HandleTumbleSound(player_t *player)
|
||||
{
|
||||
fixed_t momz;
|
||||
momz = player->mo->momz * P_MobjFlip(player->mo);
|
||||
|
||||
if (!player->tumbleSound && momz < -25*player->mo->scale)
|
||||
{
|
||||
S_StartSound(player->mo, sfx_s3k51);
|
||||
player->tumbleSound = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void K_ExplodePlayer(player_t *player, mobj_t *inflictor, mobj_t *source) // A bit of a hack, we just throw the player up higher here and extend their spinout timer
|
||||
|
|
@ -6002,6 +6045,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
|
||||
if (player->tumbleBounces > 0)
|
||||
{
|
||||
K_HandleTumbleSound(player);
|
||||
if (P_IsObjectOnGround(player->mo) && player->mo->momz * P_MobjFlip(player->mo) <= 0)
|
||||
K_HandleTumbleBounce(player);
|
||||
}
|
||||
|
|
@ -8018,8 +8062,17 @@ void K_MoveKartPlayer(player_t *player, boolean onground)
|
|||
|
||||
// debug shit
|
||||
//CONS_Printf("%d\n", player->mo->momz / mapobjectscale);
|
||||
if (momz < -20*FRACUNIT) // :youfuckedup:
|
||||
{
|
||||
// tumble if you let your chance pass!!
|
||||
player->tumbleBounces = 1;
|
||||
player->tumbleSound = 0;
|
||||
player->tumbleHeight = 30; // Base tumble bounce height
|
||||
player->trickpanel = 0;
|
||||
P_SetPlayerMobjState(player->mo, S_KART_SPINOUT);
|
||||
}
|
||||
|
||||
if (player->trickdelay <= 0)
|
||||
else if (player->trickdelay <= 0) // don't allow tricking at the same frame you tumble obv
|
||||
{
|
||||
|
||||
if (cmd->turning > 0)
|
||||
|
|
|
|||
|
|
@ -118,6 +118,14 @@ void K_DoIngameRespawn(player_t *player)
|
|||
|
||||
player->kartstuff[k_ringboost] = 0;
|
||||
player->kartstuff[k_driftboost] = 0;
|
||||
|
||||
// If player was tumbling, set variables so that they don't tumble like crazy after they're done respawning
|
||||
if (player->tumbleBounces > 0)
|
||||
{
|
||||
player->tumbleBounces = 3; // Max # of bounces-1 (so you still tumble once)
|
||||
player->tumbleLastBounce = 0; // Still force them to bounce at least once for the funny
|
||||
players->tumbleHeight = 20; // force tumble height
|
||||
}
|
||||
|
||||
P_ResetPlayer(player);
|
||||
|
||||
|
|
|
|||
|
|
@ -220,6 +220,8 @@ static int player_get(lua_State *L)
|
|||
lua_pushinteger(L, plr->tumbleHeight);
|
||||
else if (fastcmp(field,"tumbleLastBounce"))
|
||||
lua_pushboolean(L, plr->tumbleLastBounce);
|
||||
else if (fastcmp(field,"tumbleSound"))
|
||||
lua_pushboolean(L, plr->tumbleSound);
|
||||
else if (fastcmp(field,"trickpanel"))
|
||||
lua_pushinteger(L, plr->trickpanel);
|
||||
else if (fastcmp(field,"trickdelay"))
|
||||
|
|
@ -525,6 +527,8 @@ static int player_set(lua_State *L)
|
|||
plr->tumbleHeight = (UINT16)luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"tumbleLastBounce"))
|
||||
plr->tumbleLastBounce = luaL_checkboolean(L, 3);
|
||||
else if (fastcmp(field,"tumbleSound"))
|
||||
plr->tumbleSound = luaL_checkboolean(L, 3);
|
||||
else if (fastcmp(field,"trickpanel"))
|
||||
plr->trickpanel = luaL_checkinteger(L, 3);
|
||||
else if (fastcmp(field,"trickdelay"))
|
||||
|
|
|
|||
|
|
@ -269,6 +269,7 @@ static void P_NetArchivePlayers(void)
|
|||
WRITEUINT8(save_p, players[i].tumbleBounces);
|
||||
WRITEUINT16(save_p, players[i].tumbleHeight);
|
||||
WRITEUINT8(save_p, players[i].tumbleLastBounce);
|
||||
WRITEUINT8(save_p, players[i].tumbleSound);
|
||||
|
||||
// respawnvars_t
|
||||
WRITEUINT8(save_p, players[i].respawn.state);
|
||||
|
|
@ -468,6 +469,7 @@ static void P_NetUnArchivePlayers(void)
|
|||
players[i].tumbleBounces = READUINT8(save_p);
|
||||
players[i].tumbleHeight = READUINT16(save_p);
|
||||
players[i].tumbleLastBounce = (boolean)READUINT8(save_p);
|
||||
players[i].tumbleSound = (boolean)READUINT8(save_p);
|
||||
|
||||
// respawnvars_t
|
||||
players[i].respawn.state = READUINT8(save_p);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue