diff --git a/src/deh_tables.c b/src/deh_tables.c index c8da6cabd..1474296f9 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -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", diff --git a/src/info.c b/src/info.c index c639c7c35..ffdf5daf8 100644 --- a/src/info.c +++ b/src/info.c @@ -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<player; + bool hasCustomHusk = pValid && 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); + 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 + fixed_t huskScale = FixedDiv(mapobjectscale, scale()); + spritexscale(FixedMul(spritexscale(), huskScale)); + spriteyscale(FixedMul(spriteyscale(), huskScale)); + } + health = 1; - state(S_KART_LEFTOVER_NOTIRES); + state(!hasCustomHusk ? S_KART_LEFTOVER_NOTIRES : S_KART_LEFTOVER_CUSTOM); cooldown(20); burning(burn_duration()); @@ -326,9 +345,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 +465,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(); diff --git a/src/p_mobj.c b/src/p_mobj.c index 7941c228a..e5f0e542a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9880,10 +9880,12 @@ static boolean P_MobjRegularThink(mobj_t *mobj) case MT_KART_LEFTOVER: { Obj_DestroyedKartThink(mobj); + if (P_MobjWasRemoved(mobj)) { return false; } + break; }