mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-04-03 17:01:19 +00:00
Brake drfit effect
This commit is contained in:
parent
3378888cff
commit
ea4ca2eb1f
7 changed files with 118 additions and 12 deletions
|
@ -308,6 +308,7 @@ typedef enum
|
|||
k_destboostcam, // Ditto
|
||||
k_timeovercam, // Camera timer for leaving behind or not
|
||||
k_aizdriftstrat, // Let go of your drift while boosting? Helper for the SICK STRATZ you have just unlocked
|
||||
k_brakedrift, // Helper for brake-drift spark spawning
|
||||
|
||||
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)
|
||||
|
|
|
@ -6247,6 +6247,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
|
|||
"S_DRIFTSPARK_C1",
|
||||
"S_DRIFTSPARK_C2",
|
||||
|
||||
// Brake drift sparks
|
||||
"S_BRAKEDRIFT",
|
||||
|
||||
// Drift Smoke
|
||||
"S_DRIFTDUST1",
|
||||
"S_DRIFTDUST2",
|
||||
|
@ -7393,6 +7396,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
|
|||
"MT_INVULNFLASH",
|
||||
"MT_WIPEOUTTRAIL",
|
||||
"MT_DRIFTSPARK",
|
||||
"MT_BRAKEDRIFT",
|
||||
"MT_DRIFTDUST",
|
||||
|
||||
"MT_ROCKETSNEAKER", // Rocket sneakers
|
||||
|
@ -7895,6 +7899,7 @@ static const char *const KARTSTUFF_LIST[] = {
|
|||
"DESTBOOSTCAM",
|
||||
"TIMEOVERCAM",
|
||||
"AIZDRIFTSTRAT",
|
||||
"BRAKEDRIFT",
|
||||
|
||||
"ITEMROULETTE",
|
||||
"ROULETTETYPE",
|
||||
|
|
43
src/info.c
43
src/info.c
|
@ -56,13 +56,13 @@ char sprnames[NUMSPRITES + 1][5] =
|
|||
"SRBJ","SRBK","SRBL","SRBM","SRBN","SRBO",
|
||||
//SRB2kart Sprites
|
||||
"SPRG","BSPR","RNDM","RPOP","SGNS","FAST","DSHR","BOST","BOSM","KFRE",
|
||||
"KINV","KINF","WIPD","DRIF","DUST","RSHE","FITM","BANA","ORBN","JAWZ",
|
||||
"SSMN","KRBM","BHOG","BHBM","SPBM","THNS","SINK","SITR","KBLN","DEZL",
|
||||
"POKE","AUDI","DECO","DOOD","SNES","GBAS","SPRS","BUZB","CHOM","SACO",
|
||||
"CRAB","SHAD","BRNG","BUMP","FLEN","CLAS","PSHW","ISTA","ISTB","ARRO",
|
||||
"ITEM","ITMO","ITMI","ITMN","WANT","PBOM","RETI","AIDU","KSPK","LZI1",
|
||||
"LZI2","KLIT","FZSM","FZBM","FPRT","SPTL","ENM1","GARU","MARR","REAP",
|
||||
"JITB","CDMO","CDBU","VIEW"
|
||||
"KINV","KINF","WIPD","DRIF","BDRF","DUST","RSHE","FITM","BANA","ORBN",
|
||||
"JAWZ","SSMN","KRBM","BHOG","BHBM","SPBM","THNS","SINK","SITR","KBLN",
|
||||
"DEZL","POKE","AUDI","DECO","DOOD","SNES","GBAS","SPRS","BUZB","CHOM",
|
||||
"SACO","CRAB","SHAD","BRNG","BUMP","FLEN","CLAS","PSHW","ISTA","ISTB",
|
||||
"ARRO","ITEM","ITMO","ITMI","ITMN","WANT","PBOM","RETI","AIDU","KSPK",
|
||||
"LZI1","LZI2","KLIT","FZSM","FZBM","FPRT","SPTL","ENM1","GARU","MARR",
|
||||
"REAP","JITB","CDMO","CDBU","VIEW"
|
||||
};
|
||||
|
||||
// Doesn't work with g++, needs actionf_p1 (don't modify this comment)
|
||||
|
@ -2561,6 +2561,8 @@ state_t states[NUMSTATES] =
|
|||
{SPR_DRIF, FF_FULLBRIGHT, 2, {NULL}, 0, 0, S_DRIFTSPARK_C2}, // S_DRIFTSPARK_C1
|
||||
{SPR_DRIF, FF_FULLBRIGHT|FF_TRANS20, 1, {NULL}, 0, 0, S_DRIFTSPARK_A3}, // S_DRIFTSPARK_C2 (Loop back to A3)
|
||||
|
||||
{SPR_BDRF, FF_FULLBRIGHT|FF_PAPERSPRITE|FF_ANIMATE, -1, {NULL}, 5, 2, S_BRAKEDRIFT}, // S_BRAKEDRIFT
|
||||
|
||||
{SPR_DUST, 0, 3, {NULL}, 0, 0, S_DRIFTDUST2}, // S_DRIFTDUST1
|
||||
{SPR_DUST, 1, 3, {NULL}, 0, 0, S_DRIFTDUST3}, // S_DRIFTDUST2
|
||||
{SPR_DUST, FF_TRANS20|2, 3, {NULL}, 0, 0, S_DRIFTDUST4}, // S_DRIFTDUST3
|
||||
|
@ -14873,6 +14875,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
{ // MT_BRAKEDRIFT
|
||||
-1, // doomednum
|
||||
S_BRAKEDRIFT, // spawnstate
|
||||
1000, // spawnhealth
|
||||
S_NULL, // seestate
|
||||
sfx_None, // seesound
|
||||
8, // reactiontime
|
||||
sfx_None, // attacksound
|
||||
S_NULL, // painstate
|
||||
0, // painchance
|
||||
sfx_None, // painsound
|
||||
S_NULL, // meleestate
|
||||
S_NULL, // missilestate
|
||||
S_NULL, // deathstate
|
||||
S_NULL, // xdeathstate
|
||||
sfx_None, // deathsound
|
||||
8, // speed
|
||||
8*FRACUNIT, // radius
|
||||
8*FRACUNIT, // height
|
||||
1, // display offset
|
||||
100, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags
|
||||
S_NULL // raisestate
|
||||
},
|
||||
|
||||
{ // MT_DRIFTDUST
|
||||
-1, // doomednum
|
||||
S_DRIFTDUST1, // spawnstate
|
||||
|
|
|
@ -601,6 +601,7 @@ typedef enum sprite
|
|||
SPR_KINF, // Invincibility flash
|
||||
SPR_WIPD, // Wipeout dust trail
|
||||
SPR_DRIF, // Drift Sparks
|
||||
SPR_BDRF, // Brake drift sparks
|
||||
SPR_DUST, // Drift Dust
|
||||
|
||||
// Kart Items
|
||||
|
@ -3109,6 +3110,9 @@ typedef enum state
|
|||
S_DRIFTSPARK_C1,
|
||||
S_DRIFTSPARK_C2,
|
||||
|
||||
// Brake drift sparks
|
||||
S_BRAKEDRIFT,
|
||||
|
||||
// Drift Smoke
|
||||
S_DRIFTDUST1,
|
||||
S_DRIFTDUST2,
|
||||
|
@ -4272,6 +4276,7 @@ typedef enum mobj_type
|
|||
MT_INVULNFLASH,
|
||||
MT_WIPEOUTTRAIL,
|
||||
MT_DRIFTSPARK,
|
||||
MT_BRAKEDRIFT,
|
||||
MT_DRIFTDUST,
|
||||
|
||||
MT_ROCKETSNEAKER,
|
||||
|
|
33
src/k_kart.c
33
src/k_kart.c
|
@ -1330,6 +1330,23 @@ static void K_SpawnDashDustRelease(player_t *player)
|
|||
}
|
||||
}
|
||||
|
||||
static void K_SpawnBrakeDriftSparks(player_t *player) // Be sure to update the mobj thinker case too!
|
||||
{
|
||||
mobj_t *sparks;
|
||||
|
||||
I_Assert(player != NULL);
|
||||
I_Assert(player->mo != NULL);
|
||||
I_Assert(!P_MobjWasRemoved(player->mo));
|
||||
|
||||
// Position & etc are handled in its thinker, and its spawned invisible.
|
||||
// This avoids needing to dupe code if we don't need it.
|
||||
sparks = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_BRAKEDRIFT);
|
||||
P_SetTarget(&sparks->target, player->mo);
|
||||
P_SetScale(sparks, (sparks->destscale = player->mo->scale));
|
||||
K_MatchGenericExtraFlags(sparks, player->mo);
|
||||
sparks->flags2 |= MF2_DONTDRAW;
|
||||
}
|
||||
|
||||
/** \brief Calculates the respawn timer and drop-boosting
|
||||
|
||||
\param player player object passed from K_KartPlayerThink
|
||||
|
@ -3879,6 +3896,7 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
|
|||
fast->momx = 3*player->mo->momx/4;
|
||||
fast->momy = 3*player->mo->momy/4;
|
||||
fast->momz = 3*player->mo->momz/4;
|
||||
K_MatchGenericExtraFlags(fast, player->mo);
|
||||
}
|
||||
|
||||
if (player->playerstate == PST_DEAD || player->kartstuff[k_respawn] > 1) // Ensure these are set correctly here
|
||||
|
@ -4454,7 +4472,8 @@ static void K_KartDrift(player_t *player, boolean onground)
|
|||
if (player->kartstuff[k_spinouttimer] > 0 // banana peel
|
||||
|| player->speed < FixedMul(10<<16, player->mo->scale)) // you're too slow!
|
||||
{
|
||||
player->kartstuff[k_drift] = player->kartstuff[k_driftcharge] = player->kartstuff[k_aizdriftstrat] = 0;
|
||||
player->kartstuff[k_drift] = player->kartstuff[k_driftcharge] = 0;
|
||||
player->kartstuff[k_aizdriftstrat] = player->kartstuff[k_brakedrift] = 0;
|
||||
}
|
||||
|
||||
if ((!player->kartstuff[k_sneakertimer])
|
||||
|
@ -4468,6 +4487,18 @@ static void K_KartDrift(player_t *player, boolean onground)
|
|||
}
|
||||
else if (player->kartstuff[k_aizdriftstrat] && !player->kartstuff[k_drift])
|
||||
K_SpawnAIZDust(player);
|
||||
|
||||
if (player->kartstuff[k_drift]
|
||||
&& ((player->cmd.buttons & BT_BRAKE)
|
||||
|| !(player->cmd.buttons & BT_ACCELERATE))
|
||||
&& P_IsObjectOnGround(player->mo))
|
||||
{
|
||||
if (!player->kartstuff[k_brakedrift])
|
||||
K_SpawnBrakeDriftSparks(player);
|
||||
player->kartstuff[k_brakedrift] = 1;
|
||||
}
|
||||
else
|
||||
player->kartstuff[k_brakedrift] = 0;
|
||||
}
|
||||
//
|
||||
// K_KartUpdatePosition
|
||||
|
|
|
@ -8435,6 +8435,7 @@ void A_SPBChase(mobj_t *actor)
|
|||
//fast->momz = 3*actor->momz/4;
|
||||
fast->color = SKINCOLOR_RED;
|
||||
fast->colorized = true;
|
||||
K_MatchGenericExtraFlags(fast, actor);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
42
src/p_mobj.c
42
src/p_mobj.c
|
@ -8301,6 +8301,43 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
}
|
||||
P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
|
||||
break;
|
||||
case MT_BRAKEDRIFT:
|
||||
if ((!mobj->target || !mobj->target->health || !mobj->target->player || !P_IsObjectOnGround(mobj->target))
|
||||
|| !mobj->target->player->kartstuff[k_drift] || !mobj->target->player->kartstuff[k_brakedrift]
|
||||
|| !((mobj->target->player->cmd.buttons & BT_BRAKE)
|
||||
|| !(mobj->target->player->cmd.buttons & BT_ACCELERATE))) // Letting go of accel functions about the same as brake-drifting
|
||||
{
|
||||
P_RemoveMobj(mobj);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
fixed_t newx, newy;
|
||||
angle_t travelangle;
|
||||
|
||||
travelangle = mobj->target->angle - ((ANGLE_45/5)*mobj->target->player->kartstuff[k_drift]);
|
||||
|
||||
newx = mobj->target->x + P_ReturnThrustX(mobj->target, travelangle+ANGLE_180, 24*mobj->target->scale);
|
||||
newy = mobj->target->y + P_ReturnThrustY(mobj->target, travelangle+ANGLE_180, 24*mobj->target->scale);
|
||||
P_TeleportMove(mobj, newx, newy, mobj->target->z);
|
||||
|
||||
mobj->angle = travelangle - ((ANGLE_90/5)*mobj->target->player->kartstuff[k_drift]);
|
||||
P_SetScale(mobj, (mobj->destscale = mobj->target->scale));
|
||||
|
||||
if (mobj->target->player->kartstuff[k_driftcharge] >= K_GetKartDriftSparkValue(mobj->target->player)*4)
|
||||
mobj->color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1)));
|
||||
else if (mobj->target->player->kartstuff[k_driftcharge] >= K_GetKartDriftSparkValue(mobj->target->player)*2)
|
||||
mobj->color = SKINCOLOR_KETCHUP;
|
||||
else if (mobj->target->player->kartstuff[k_driftcharge] >= K_GetKartDriftSparkValue(mobj->target->player))
|
||||
mobj->color = SKINCOLOR_SAPPHIRE;
|
||||
else
|
||||
mobj->color = SKINCOLOR_YELLOW;
|
||||
|
||||
K_MatchGenericExtraFlags(mobj, mobj->target);
|
||||
if (leveltime & 1)
|
||||
mobj->flags2 |= MF2_DONTDRAW;
|
||||
}
|
||||
break;
|
||||
case MT_PLAYERRETICULE:
|
||||
if (!mobj->target || !mobj->target->health)
|
||||
{
|
||||
|
@ -8310,10 +8347,7 @@ void P_MobjThinker(mobj_t *mobj)
|
|||
P_TeleportMove(mobj, mobj->target->x, mobj->target->y, mobj->target->z);
|
||||
break;
|
||||
case MT_INSTASHIELDB:
|
||||
if (leveltime & 1)
|
||||
mobj->flags2 |= MF2_DONTDRAW;
|
||||
else
|
||||
mobj->flags2 &= ~MF2_DONTDRAW;
|
||||
mobj->flags2 ^= MF2_DONTDRAW;
|
||||
/* FALLTHRU */
|
||||
case MT_INSTASHIELDA:
|
||||
if (!mobj->target || !mobj->target->health || (mobj->target->player && !mobj->target->player->kartstuff[k_instashield]))
|
||||
|
|
Loading…
Reference in a new issue