Special effects!

Tire grease waves, colored stars
This commit is contained in:
TehRealSalt 2019-09-23 03:15:08 -04:00
parent 5023abd279
commit 9d8cb5247a
7 changed files with 149 additions and 14 deletions

View file

@ -328,6 +328,8 @@ typedef enum
k_spectatewait, // How long have you been waiting as a spectator
k_growcancel, // Hold the item button down to cancel Grow
k_tiregrease, // Reduced friction timer after hitting a horizontal spring
k_springstars, // Spawn stars around a player when they hit a spring
k_springcolor, // Color of spring stars
NUMKARTSTUFF
} kartstufftype_t;

View file

@ -7212,6 +7212,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit
"S_DRAFTDUST4",
"S_DRAFTDUST5",
"S_TIREGREASE",
#ifdef SEENAMES
"S_NAMECHECK",
#endif
@ -8004,6 +8006,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s
"MT_KARMAFIREWORK",
"MT_RINGSPARKS",
"MT_DRAFTDUST",
"MT_TIREGREASE",
#ifdef SEENAMES
"MT_NAMECHECK",
@ -8491,7 +8494,9 @@ static const char *const KARTSTUFF_LIST[] = {
"JAWZTARGETDELAY",
"SPECTATEWAIT",
"GROWCANCEL",
"TIREGREASE"
"TIREGREASE",
"SPRINGSTARS",
"SPRINGCOLOR"
};
#endif

View file

@ -70,7 +70,7 @@ char sprnames[NUMSPRITES + 1][5] =
"DUCK","GTRE","CHES","CHIM","DRGN","LZMN","PGSS","ZTCH","MKMA","MKMP",
"RTCH","BOWL","BOWH","BRRL","BRRR","HRSE","TOAH","BFRT","OFRT","RFRT",
"PFRT","ASPK","HBST","HBSO","HBSF","WBLZ","WBLN","FWRK","MXCL","RGSP",
"DRAF","XMS4","XMS5","VIEW"
"DRAF","GRES","XMS4","XMS5","VIEW"
};
// Doesn't work with g++, needs actionf_p1 (don't modify this comment)
@ -3452,6 +3452,8 @@ state_t states[NUMSTATES] =
{SPR_DRAF, 3, 1, {NULL}, 0, 0, S_DRAFTDUST5}, // S_DRAFTDUST4
{SPR_DRAF, 4, 1, {NULL}, 0, 0, S_NULL}, // S_DRAFTDUST5
{SPR_GRES, FF_ANIMATE|FF_PAPERSPRITE, -1, {NULL}, 2, 4, S_NULL}, // S_TIREGREASE
#ifdef SEENAMES
{SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK
#endif
@ -6082,7 +6084,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
SKINCOLOR_YELLOW, // painchance
sfx_s3kb1, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@ -6109,7 +6111,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
SKINCOLOR_SALMON, // painchance
sfx_s3kb1, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@ -6136,7 +6138,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
SKINCOLOR_PASTEL, // painchance
sfx_s3kb1, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@ -6163,7 +6165,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
SKINCOLOR_POPCORN, // painchance
sfx_s3kb1, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@ -6190,7 +6192,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
SKINCOLOR_YELLOW, // painchance
sfx_s3kb1, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@ -6217,7 +6219,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
SKINCOLOR_SALMON, // painchance
sfx_s3kb1, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@ -6244,7 +6246,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
SKINCOLOR_PASTEL, // painchance
sfx_s3kb1, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@ -6271,7 +6273,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
SKINCOLOR_POPCORN, // painchance
sfx_s3kb1, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@ -6298,7 +6300,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
SKINCOLOR_YELLOW, // painchance
sfx_s3kb1, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@ -6325,7 +6327,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
SKINCOLOR_SALMON, // painchance
sfx_s3kb1, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@ -6352,7 +6354,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
SKINCOLOR_PASTEL, // painchance
sfx_s3kb1, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@ -6379,7 +6381,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
8, // reactiontime
sfx_None, // attacksound
S_NULL, // painstate
0, // painchance
SKINCOLOR_POPCORN, // painchance
sfx_s3kb1, // painsound
S_NULL, // meleestate
S_NULL, // missilestate
@ -20271,6 +20273,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
S_NULL // raisestate
},
{ // MT_TIREGREASE
-1, // doomednum
S_TIREGREASE, // 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
0, // speed
8<<FRACBITS, // radius
16<<FRACBITS, // height
0, // display offset
100, // mass
0, // damage
sfx_None, // activesound
MF_NOBLOCKMAP|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags
S_NULL // raisestate
},
// ============================================================================================================================//
#ifdef SEENAMES

View file

@ -782,6 +782,7 @@ typedef enum sprite
SPR_MXCL,
SPR_RGSP,
SPR_DRAF,
SPR_GRES,
// Xmas-specific sprites that don't fit aboxe
SPR_XMS4,
@ -4113,6 +4114,8 @@ typedef enum state
S_DRAFTDUST4,
S_DRAFTDUST5,
S_TIREGREASE,
#ifdef SEENAMES
S_NAMECHECK,
#endif
@ -4922,6 +4925,7 @@ typedef enum mobj_type
MT_KARMAFIREWORK,
MT_RINGSPARKS,
MT_DRAFTDUST,
MT_TIREGREASE,
#ifdef SEENAMES
MT_NAMECHECK,

View file

@ -5061,6 +5061,29 @@ void K_KartPlayerThink(player_t *player, ticcmd_t *cmd)
if (P_IsDisplayPlayer(player))
debtflag->flags2 |= MF2_DONTDRAW;
}
if (player->kartstuff[k_springstars] && (leveltime & 1))
{
fixed_t randx = P_RandomRange(-40, 40) * player->mo->scale;
fixed_t randy = P_RandomRange(-40, 40) * player->mo->scale;
fixed_t randz = P_RandomRange(0, player->mo->height >> FRACBITS) << FRACBITS;
mobj_t *star = P_SpawnMobj(
player->mo->x + randx,
player->mo->y + randy,
player->mo->z + randz,
MT_KARMAFIREWORK);
star->color = player->kartstuff[k_springcolor];
star->flags |= MF_NOGRAVITY;
star->momx = player->mo->momx / 2;
star->momy = player->mo->momy / 2;
star->momz = player->mo->momz / 2;
star->fuse = 12;
star->scale = player->mo->scale;
star->destscale = star->scale / 2;
player->kartstuff[k_springstars]--;
}
}
if (player->playerstate == PST_DEAD || player->kartstuff[k_respawn] > 1) // Ensure these are set correctly here

View file

@ -122,6 +122,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
const fixed_t vscale = mapobjectscale + (object->scale - mapobjectscale);
fixed_t vertispeed = spring->info->mass;
fixed_t horizspeed = spring->info->damage;
UINT8 starcolor = spring->info->painchance;
fixed_t savemomx = 0;
fixed_t savemomy = 0;
@ -251,7 +252,22 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
{
// Less friction when hitting horizontal springs
if (!vertispeed)
{
if (!object->player->kartstuff[k_tiregrease])
{
UINT8 i;
for (i = 0; i < 2; i++)
{
mobj_t *grease;
grease = P_SpawnMobj(object->x, object->y, object->z, MT_TIREGREASE);
P_SetTarget(&grease->target, object);
grease->angle = R_PointToAngle2(0, 0, object->momx, object->momy);
grease->extravalue1 = i;
}
}
object->player->kartstuff[k_tiregrease] = greasetics; //FixedMul(greasetics << FRACBITS, finalSpeed/72) >> FRACBITS
}
}
// Horizontal speed is used as a minimum thrust, not a direct replacement
@ -271,6 +287,9 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
P_SetTarget(&spring->target, object);
P_ResetPlayer(object->player);
object->player->kartstuff[k_springstars] = max(vertispeed, horizspeed) / FRACUNIT / 2;
object->player->kartstuff[k_springcolor] = starcolor;
}
return true;

View file

@ -8368,6 +8368,56 @@ void P_MobjThinker(mobj_t *mobj)
z);
}
break;
case MT_TIREGREASE:
if (!mobj->target || P_MobjWasRemoved(mobj->target) || !mobj->target->player
|| !mobj->target->player->kartstuff[k_tiregrease])
{
P_RemoveMobj(mobj);
return;
}
K_MatchGenericExtraFlags(mobj, mobj->target);
{
const angle_t off = FixedAngle(40*FRACUNIT);
angle_t ang = mobj->target->angle;
fixed_t z;
UINT8 trans = (mobj->target->player->kartstuff[k_tiregrease] * (NUMTRANSMAPS+1)) / greasetics;
if (trans > NUMTRANSMAPS)
trans = NUMTRANSMAPS;
trans = NUMTRANSMAPS - trans;
z = mobj->target->z;
if (mobj->eflags & MFE_VERTICALFLIP)
z += mobj->target->height;
if (mobj->target->momx || mobj->target->momy)
ang = R_PointToAngle2(0, 0, mobj->target->momx, mobj->target->momy);
if (mobj->extravalue1)
ang = (signed)(ang - off);
else
ang = (signed)(ang + off);
P_TeleportMove(mobj,
mobj->target->x - FixedMul(mobj->target->radius, FINECOSINE(ang >> ANGLETOFINESHIFT)),
mobj->target->y - FixedMul(mobj->target->radius, FINESINE(ang >> ANGLETOFINESHIFT)),
z);
mobj->angle = ang;
if (leveltime & 1)
mobj->flags2 |= MF2_DONTDRAW;
if (trans >= NUMTRANSMAPS)
mobj->flags2 |= MF2_DONTDRAW;
else if (trans == 0)
mobj->frame = (mobj->frame & ~FF_TRANSMASK);
else
mobj->frame = (mobj->frame & ~FF_TRANSMASK)|(trans << FF_TRANSSHIFT);
}
break;
case MT_THUNDERSHIELD:
{
fixed_t destx, desty;
@ -9070,6 +9120,9 @@ void P_MobjThinker(mobj_t *mobj)
}
break;
case MT_KARMAFIREWORK:
if (mobj->flags & MF_NOGRAVITY)
break;
if (mobj->momz == 0)
{
P_RemoveMobj(mobj);