mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-26 20:11:47 +00:00
Merge remote-tracking branch 'origin/tripwire-leniency'
This commit is contained in:
commit
8164d63078
6 changed files with 126 additions and 3 deletions
|
|
@ -437,6 +437,8 @@ typedef struct player_s
|
||||||
UINT16 draftleeway; // Leniency timer before removing draft power
|
UINT16 draftleeway; // Leniency timer before removing draft power
|
||||||
SINT8 lastdraft; // (-1 to 15) - Last player being drafted
|
SINT8 lastdraft; // (-1 to 15) - Last player being drafted
|
||||||
|
|
||||||
|
UINT16 tripwireLeniency; // When reaching a state that lets you go thru tripwire, you get an extra second leniency after it ends to still go through it.
|
||||||
|
|
||||||
UINT16 itemroulette; // Used for the roulette when deciding what item to give you (was "pw_kartitem")
|
UINT16 itemroulette; // Used for the roulette when deciding what item to give you (was "pw_kartitem")
|
||||||
UINT8 roulettetype; // Used for the roulette, for deciding type (0 = normal, 1 = better, 2 = eggman mark)
|
UINT8 roulettetype; // Used for the roulette, for deciding type (0 = normal, 1 = better, 2 = eggman mark)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,7 @@ boolean K_BotCanTakeCut(player_t *player)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
#if 1
|
#if 1
|
||||||
K_TripwirePass(player) == true
|
K_TripwirePassConditions(player) == true
|
||||||
#else
|
#else
|
||||||
K_ApplyOffroad(player) == false
|
K_ApplyOffroad(player) == false
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
116
src/k_kart.c
116
src/k_kart.c
|
|
@ -2104,9 +2104,15 @@ void K_SpawnNormalSpeedLines(player_t *player)
|
||||||
|
|
||||||
K_MatchGenericExtraFlags(fast, player->mo);
|
K_MatchGenericExtraFlags(fast, player->mo);
|
||||||
|
|
||||||
// Make it red when you have the eggman speed boost
|
if (player->tripwireLeniency)
|
||||||
|
{
|
||||||
|
fast->destscale = fast->destscale * 2;
|
||||||
|
P_SetScale(fast, 3*fast->scale/2);
|
||||||
|
}
|
||||||
|
|
||||||
if (player->eggmanexplode)
|
if (player->eggmanexplode)
|
||||||
{
|
{
|
||||||
|
// Make it red when you have the eggman speed boost
|
||||||
fast->color = SKINCOLOR_RED;
|
fast->color = SKINCOLOR_RED;
|
||||||
fast->colorized = true;
|
fast->colorized = true;
|
||||||
}
|
}
|
||||||
|
|
@ -2123,6 +2129,12 @@ void K_SpawnNormalSpeedLines(player_t *player)
|
||||||
}
|
}
|
||||||
fast->colorized = true;
|
fast->colorized = true;
|
||||||
}
|
}
|
||||||
|
else if (player->tripwireLeniency)
|
||||||
|
{
|
||||||
|
// Make it pink+blue+big when you can go through tripwire
|
||||||
|
fast->color = (leveltime & 1) ? SKINCOLOR_BLOSSOM : SKINCOLOR_JAWZ;
|
||||||
|
fast->colorized = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void K_SpawnInvincibilitySpeedLines(mobj_t *mo)
|
void K_SpawnInvincibilitySpeedLines(mobj_t *mo)
|
||||||
|
|
@ -2758,7 +2770,7 @@ boolean K_SlopeResistance(player_t *player)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean K_TripwirePass(player_t *player)
|
boolean K_TripwirePassConditions(player_t *player)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
player->invincibilitytimer ||
|
player->invincibilitytimer ||
|
||||||
|
|
@ -2771,6 +2783,11 @@ boolean K_TripwirePass(player_t *player)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean K_TripwirePass(player_t *player)
|
||||||
|
{
|
||||||
|
return (K_TripwirePassConditions(player) || (player->tripwireLeniency > 0));
|
||||||
|
}
|
||||||
|
|
||||||
boolean K_WaterRun(player_t *player)
|
boolean K_WaterRun(player_t *player)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
|
|
@ -4653,6 +4670,90 @@ void K_DriftDustHandling(mobj_t *spawner)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void K_SpawnTripwireVFX(mobj_t *mo)
|
||||||
|
{
|
||||||
|
tic_t t = leveltime;
|
||||||
|
angle_t ang, aoff;
|
||||||
|
SINT8 sign = 1;
|
||||||
|
boolean altColor = false;
|
||||||
|
mobj_t *dust;
|
||||||
|
boolean drifting = false;
|
||||||
|
UINT8 i;
|
||||||
|
|
||||||
|
I_Assert(mo != NULL);
|
||||||
|
I_Assert(!P_MobjWasRemoved(mo));
|
||||||
|
|
||||||
|
if (!P_IsObjectOnGround(mo))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (mo->player)
|
||||||
|
{
|
||||||
|
ang = mo->player->drawangle;
|
||||||
|
|
||||||
|
if (mo->player->drift != 0)
|
||||||
|
{
|
||||||
|
drifting = true;
|
||||||
|
ang += (mo->player->drift * ((ANGLE_270 + ANGLE_22h) / 5)); // -112.5 doesn't work. I fucking HATE SRB2 angles
|
||||||
|
if (mo->player->drift < 0)
|
||||||
|
sign = 1;
|
||||||
|
else
|
||||||
|
sign = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ang = mo->angle;
|
||||||
|
|
||||||
|
if (drifting == false)
|
||||||
|
{
|
||||||
|
i = (t & 1);
|
||||||
|
|
||||||
|
if (i & 1)
|
||||||
|
sign = -1;
|
||||||
|
else
|
||||||
|
sign = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (t & 1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
t /= 2;
|
||||||
|
i = (t & 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
aoff = (ang + ANGLE_180) + (ANGLE_45 * sign);
|
||||||
|
|
||||||
|
dust = P_SpawnMobj(mo->x + FixedMul(24*mo->scale, FINECOSINE(aoff>>ANGLETOFINESHIFT)),
|
||||||
|
mo->y + FixedMul(24*mo->scale, FINESINE(aoff>>ANGLETOFINESHIFT)),
|
||||||
|
mo->z, MT_DRIFTDUST);
|
||||||
|
|
||||||
|
P_SetTarget(&dust->target, mo);
|
||||||
|
P_InitAngle(dust, ang - (ANGLE_90 * sign)); // point completely perpendicular from the player
|
||||||
|
P_SetScale(dust, mo->scale);
|
||||||
|
dust->destscale = mo->scale * 6;
|
||||||
|
dust->scalespeed = mo->scale/12;
|
||||||
|
K_FlipFromObject(dust, mo);
|
||||||
|
|
||||||
|
altColor = (sign > 0);
|
||||||
|
|
||||||
|
if ((t / 2) & 1)
|
||||||
|
{
|
||||||
|
dust->tics++; // "randomize" animation
|
||||||
|
altColor = !altColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
dust->colorized = true;
|
||||||
|
dust->color = altColor ? SKINCOLOR_BLOSSOM : SKINCOLOR_JAWZ;
|
||||||
|
|
||||||
|
dust->momx = (4*mo->momx)/5;
|
||||||
|
dust->momy = (4*mo->momy)/5;
|
||||||
|
dust->momz = (4*P_GetMobjZMovement(mo))/5;
|
||||||
|
|
||||||
|
P_Thrust(dust, dust->angle, 4*mo->scale);
|
||||||
|
}
|
||||||
|
|
||||||
void K_Squish(mobj_t *mo)
|
void K_Squish(mobj_t *mo)
|
||||||
{
|
{
|
||||||
const fixed_t maxstretch = 4*FRACUNIT;
|
const fixed_t maxstretch = 4*FRACUNIT;
|
||||||
|
|
@ -7190,6 +7291,17 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
||||||
K_HandleTumbleBounce(player);
|
K_HandleTumbleBounce(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player->tripwireLeniency > 0)
|
||||||
|
{
|
||||||
|
player->tripwireLeniency--;
|
||||||
|
K_SpawnTripwireVFX(player->mo);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (K_TripwirePassConditions(player) == true)
|
||||||
|
{
|
||||||
|
player->tripwireLeniency = max(player->tripwireLeniency, TICRATE);
|
||||||
|
}
|
||||||
|
|
||||||
K_KartPlayerHUDUpdate(player);
|
K_KartPlayerHUDUpdate(player);
|
||||||
|
|
||||||
if (battleovertime.enabled && !(player->pflags & PF_ELIMINATED) && player->bumpers <= 0 && player->karmadelay <= 0)
|
if (battleovertime.enabled && !(player->pflags & PF_ELIMINATED) && player->bumpers <= 0 && player->karmadelay <= 0)
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,7 @@ void K_StripOther(player_t *player);
|
||||||
void K_MomentumToFacing(player_t *player);
|
void K_MomentumToFacing(player_t *player);
|
||||||
boolean K_ApplyOffroad(player_t *player);
|
boolean K_ApplyOffroad(player_t *player);
|
||||||
boolean K_SlopeResistance(player_t *player);
|
boolean K_SlopeResistance(player_t *player);
|
||||||
|
boolean K_TripwirePassConditions(player_t *player);
|
||||||
boolean K_TripwirePass(player_t *player);
|
boolean K_TripwirePass(player_t *player);
|
||||||
boolean K_WaterRun(player_t *player);
|
boolean K_WaterRun(player_t *player);
|
||||||
void K_ApplyTripWire(player_t *player, tripwirestate_t state);
|
void K_ApplyTripWire(player_t *player, tripwirestate_t state);
|
||||||
|
|
|
||||||
|
|
@ -288,6 +288,8 @@ static int player_get(lua_State *L)
|
||||||
lua_pushinteger(L, plr->draftleeway);
|
lua_pushinteger(L, plr->draftleeway);
|
||||||
else if (fastcmp(field,"lastdraft"))
|
else if (fastcmp(field,"lastdraft"))
|
||||||
lua_pushinteger(L, plr->lastdraft);
|
lua_pushinteger(L, plr->lastdraft);
|
||||||
|
else if (fastcmp(field,"tripwireLeniency"))
|
||||||
|
lua_pushinteger(L, plr->tripwireLeniency);
|
||||||
else if (fastcmp(field,"itemroulette"))
|
else if (fastcmp(field,"itemroulette"))
|
||||||
lua_pushinteger(L, plr->itemroulette);
|
lua_pushinteger(L, plr->itemroulette);
|
||||||
else if (fastcmp(field,"roulettetype"))
|
else if (fastcmp(field,"roulettetype"))
|
||||||
|
|
@ -630,6 +632,8 @@ static int player_set(lua_State *L)
|
||||||
plr->draftleeway = luaL_checkinteger(L, 3);
|
plr->draftleeway = luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"lastdraft"))
|
else if (fastcmp(field,"lastdraft"))
|
||||||
plr->lastdraft = luaL_checkinteger(L, 3);
|
plr->lastdraft = luaL_checkinteger(L, 3);
|
||||||
|
else if (fastcmp(field,"tripwireLeniency"))
|
||||||
|
plr->tripwireLeniency = luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"itemroulette"))
|
else if (fastcmp(field,"itemroulette"))
|
||||||
plr->itemroulette = luaL_checkinteger(L, 3);
|
plr->itemroulette = luaL_checkinteger(L, 3);
|
||||||
else if (fastcmp(field,"roulettetype"))
|
else if (fastcmp(field,"roulettetype"))
|
||||||
|
|
|
||||||
|
|
@ -278,6 +278,8 @@ static void P_NetArchivePlayers(void)
|
||||||
WRITEUINT16(save_p, players[i].draftleeway);
|
WRITEUINT16(save_p, players[i].draftleeway);
|
||||||
WRITESINT8(save_p, players[i].lastdraft);
|
WRITESINT8(save_p, players[i].lastdraft);
|
||||||
|
|
||||||
|
WRITEUINT16(save_p, players[i].tripwireLeniency);
|
||||||
|
|
||||||
WRITEUINT16(save_p, players[i].itemroulette);
|
WRITEUINT16(save_p, players[i].itemroulette);
|
||||||
WRITEUINT8(save_p, players[i].roulettetype);
|
WRITEUINT8(save_p, players[i].roulettetype);
|
||||||
|
|
||||||
|
|
@ -546,6 +548,8 @@ static void P_NetUnArchivePlayers(void)
|
||||||
players[i].draftleeway = READUINT16(save_p);
|
players[i].draftleeway = READUINT16(save_p);
|
||||||
players[i].lastdraft = READSINT8(save_p);
|
players[i].lastdraft = READSINT8(save_p);
|
||||||
|
|
||||||
|
players[i].tripwireLeniency = READUINT16(save_p);
|
||||||
|
|
||||||
players[i].itemroulette = READUINT16(save_p);
|
players[i].itemroulette = READUINT16(save_p);
|
||||||
players[i].roulettetype = READUINT8(save_p);
|
players[i].roulettetype = READUINT8(save_p);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue