mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Implemented SPR2_DKRT and integrated it into the state system
This commit is contained in:
parent
51112a07f7
commit
af16e3f993
5 changed files with 36 additions and 6 deletions
|
|
@ -369,6 +369,7 @@ const char *const STATE_LIST[] = { // array length left dynamic for sanity testi
|
|||
|
||||
"S_KART_LEFTOVER",
|
||||
"S_KART_LEFTOVER_NOTIRES",
|
||||
"S_KART_LEFTOVER_CUSTOM",
|
||||
|
||||
"S_KART_TIRE1",
|
||||
"S_KART_TIRE2",
|
||||
|
|
|
|||
|
|
@ -795,6 +795,7 @@ char spr2names[NUMPLAYERSPRITES][5] =
|
|||
"SIGN", "SIGL", "SSIG", // Finish signpost
|
||||
"XTRA", // Three Faces of Darkness
|
||||
"TALK", // Dialogue
|
||||
"DKRT", // Kart husk
|
||||
};
|
||||
playersprite_t free_spr2 = SPR2_FIRSTFREESLOT;
|
||||
|
||||
|
|
@ -839,13 +840,14 @@ playersprite_t spr2defaults[NUMPLAYERSPRITES] = {
|
|||
SPR2_SIGN, // SPR2_SSIG
|
||||
0, // SPR2_XTRA
|
||||
0, // SPR2_TALK
|
||||
0, // SPR2_DKRT
|
||||
};
|
||||
|
||||
// Doesn't work with g++, needs actionf_p1 (don't modify this comment)
|
||||
state_t states[NUMSTATES] =
|
||||
{
|
||||
// frame is masked through FF_FRAMEMASK
|
||||
// FF_ANIMATE makes simple state animations (var1 #frames, var2 tic delay)
|
||||
// FF_ANIMATE makes simple state animations (var1 #frames, var2 tic delay) (var1 is ignored in P_SetupStateAnimation() if sprite is SPR_PLAY)
|
||||
// FF_FULLBRIGHT activates the fullbright colormap
|
||||
// use FF_TRANS10 - FF_TRANS90 for easy translucency
|
||||
// (or tr_trans10<<FF_TRANSSHIFT if you want to make it hard on yourself)
|
||||
|
|
@ -903,6 +905,7 @@ state_t states[NUMSTATES] =
|
|||
|
||||
{SPR_KART, 0, -1, {NULL}, 0, 0, S_NULL}, // S_KART_LEFTOVER
|
||||
{SPR_DIEF, 0, -1, {NULL}, 0, 0, S_NULL}, // S_KART_LEFTOVER_NOTIRES
|
||||
{SPR_PLAY, SPR2_DKRT,3,{NULL},0,0,S_KART_LEFTOVER_CUSTOM},// S_KART_LEFTOVER_CUSTOM
|
||||
|
||||
{SPR_TIRE, 0, -1, {NULL}, 0, 0, S_NULL}, // S_KART_TIRE1
|
||||
{SPR_TIRE, 1, -1, {NULL}, 0, 0, S_NULL}, // S_KART_TIRE2
|
||||
|
|
|
|||
|
|
@ -1329,6 +1329,7 @@ typedef enum playersprite
|
|||
SPR2_SIGN, SPR2_SIGL, SPR2_SSIG,
|
||||
SPR2_XTRA,
|
||||
SPR2_TALK,
|
||||
SPR2_DKRT,
|
||||
|
||||
SPR2_FIRSTFREESLOT,
|
||||
SPR2_LASTFREESLOT = 0x7f,
|
||||
|
|
@ -1389,6 +1390,7 @@ typedef enum state
|
|||
|
||||
S_KART_LEFTOVER,
|
||||
S_KART_LEFTOVER_NOTIRES,
|
||||
S_KART_LEFTOVER_CUSTOM,
|
||||
|
||||
S_KART_TIRE1,
|
||||
S_KART_TIRE2,
|
||||
|
|
|
|||
|
|
@ -309,15 +309,37 @@ struct Kart : Mobj
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (health <= 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Mobj* p = player();
|
||||
bool pValid = Mobj::valid(p);
|
||||
bool hasCustomHusk = pValid && p->player && skins[p->player->skin].sprites[SPR2_DKRT].numframes;
|
||||
|
||||
if(hasCustomHusk)
|
||||
{
|
||||
skin = (void*)(&skins[p->player->skin]);
|
||||
frame = 0;
|
||||
}
|
||||
|
||||
Particle::spew(this);
|
||||
scale(3 * scale() / 2);
|
||||
|
||||
auto oldScale = scale();
|
||||
scale(3*scale()/2);
|
||||
|
||||
if(hasCustomHusk){
|
||||
flags |= MF_NOSQUISH; //K_Squish() automates spritexscale/spriteyscale & this flag prevents that at the cost of no squish visual when the kart husk hits the ground
|
||||
float div = ((float)1/(float)oldScale)*(float)scale();
|
||||
auto formula = [&](fixed_t subject){return (fixed_t)((float)subject/div);};
|
||||
spritexscale(formula(spritexscale()));
|
||||
spriteyscale(formula(spriteyscale()));
|
||||
}
|
||||
|
||||
health = 1;
|
||||
state(S_KART_LEFTOVER_NOTIRES);
|
||||
state(!hasCustomHusk ? S_KART_LEFTOVER_NOTIRES : S_KART_LEFTOVER_CUSTOM);
|
||||
cooldown(20);
|
||||
burning(burn_duration());
|
||||
|
||||
|
|
@ -326,9 +348,9 @@ struct Kart : Mobj
|
|||
voice(sfx_die00);
|
||||
}
|
||||
|
||||
if (Mobj* p = player(); Mobj::valid(p))
|
||||
if(pValid)
|
||||
{
|
||||
if (p->player && skins[p->player->skin].flags & SF_BADNIK)
|
||||
if((skins[p->player->skin].flags & SF_BADNIK))
|
||||
{
|
||||
P_SpawnBadnikExplosion(p);
|
||||
p->spritescale({2*FRACUNIT, 2*FRACUNIT});
|
||||
|
|
@ -446,7 +468,7 @@ private:
|
|||
P_PlayDeathSound(p);
|
||||
}
|
||||
|
||||
// First tick after hitlag: destroyed kart appears!
|
||||
// First tick after hitlag: destroyed kart appears! State will change away from S_INVISIBLE inside destroy() where S_INVISIBLE was set in static spawn()
|
||||
if (state()->num() == S_INVISIBLE)
|
||||
{
|
||||
destroy();
|
||||
|
|
|
|||
|
|
@ -9886,10 +9886,12 @@ static boolean P_MobjRegularThink(mobj_t *mobj)
|
|||
case MT_KART_LEFTOVER:
|
||||
{
|
||||
Obj_DestroyedKartThink(mobj);
|
||||
|
||||
if (P_MobjWasRemoved(mobj))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue