From f9c6a5e8b5d1870c5505dc91a27462263556a740 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 6 Feb 2021 02:31:24 -0800 Subject: [PATCH 1/4] Drop Funny Spikes when getting stung DEBTA0-DEBTH0 Instead of dropping rings, drop non collectable spikes! --- src/dehacked.c | 17 +++++++++++++++++ src/info.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/info.h | 17 +++++++++++++++++ src/p_inter.c | 31 +++++++++++++++++++++---------- src/p_mobj.c | 6 ++++++ 5 files changed, 105 insertions(+), 10 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index e151b18ab..16e29d22b 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -9414,6 +9414,22 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FINISHBEAMEND1", "S_FINISHBEAMEND2", + // Funny Spike + "S_DEBTSPIKE1", + "S_DEBTSPIKE2", + "S_DEBTSPIKE3", + "S_DEBTSPIKE4", + "S_DEBTSPIKE5", + "S_DEBTSPIKE6", + "S_DEBTSPIKE7", + "S_DEBTSPIKE8", + "S_DEBTSPIKE9", + "S_DEBTSPIKEA", + "S_DEBTSPIKEB", + "S_DEBTSPIKEC", + "S_DEBTSPIKED", + "S_DEBTSPIKEE", + #ifdef SEENAMES "S_NAMECHECK", #endif @@ -9553,6 +9569,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s // Collectible Items "MT_RING", "MT_FLINGRING", // Lost ring + "MT_DEBTSPIKE", // Ring debt funny spike "MT_BLUESPHERE", // Blue sphere for special stages "MT_FLINGBLUESPHERE", // Lost blue sphere "MT_BOMBSPHERE", diff --git a/src/info.c b/src/info.c index 5e6060dd6..82dfa7add 100644 --- a/src/info.c +++ b/src/info.c @@ -131,6 +131,7 @@ char sprnames[NUMSPRITES + 1][5] = // Collectible Items "RING", + "DEBT", "TRNG", // Team Rings "TOKE", // Special Stage Token "RFLG", // Red CTF Flag @@ -5126,6 +5127,22 @@ state_t states[NUMSTATES] = {SPR_FLBM, FF_PAPERSPRITE|5, 1, {NULL}, 0, 0, S_NULL}, // S_FINISHBEAMEND1 {SPR_FLBM, FF_PAPERSPRITE|6, 1, {NULL}, 0, 0, S_NULL}, // S_FINISHBEAMEND2 + // Funny Spike + {SPR_DEBT, 0|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKE2}, // S_DEBTSPIKE1 + {SPR_DEBT, 7|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKE3}, // S_DEBTSPIKE2 + {SPR_DEBT, 1|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKE4}, // S_DEBTSPIKE3 + {SPR_DEBT, 7|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKE5}, // S_DEBTSPIKE4 + {SPR_DEBT, 2|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKE6}, // S_DEBTSPIKE5 + {SPR_DEBT, 7|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKE7}, // S_DEBTSPIKE6 + {SPR_DEBT, 3|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKE8}, // S_DEBTSPIKE7 + {SPR_DEBT, 7|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKE9}, // S_DEBTSPIKE8 + {SPR_DEBT, 4|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKEA}, // S_DEBTSPIKE9 + {SPR_DEBT, 7|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKEB}, // S_DEBTSPIKEA + {SPR_DEBT, 5|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKEC}, // S_DEBTSPIKEB + {SPR_DEBT, 7|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKED}, // S_DEBTSPIKEC + {SPR_DEBT, 6|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKEE}, // S_DEBTSPIKED + {SPR_DEBT, 7|FF_FULLBRIGHT, 1, {NULL}, 0, 0, S_DEBTSPIKE1}, // S_DEBTSPIKEE + #ifdef SEENAMES {SPR_NULL, 0, 1, {NULL}, 0, 0, S_NULL}, // S_NAMECHECK #endif @@ -8022,6 +8039,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_DEBTSPIKE + -1, // doomednum + S_DEBTSPIKE1, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + MT_FLINGRING, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + MT_RING, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_SPRK1, // deathstate + S_NULL, // xdeathstate + sfx_itemup, // deathsound + 38*FRACUNIT, // speed + 24*FRACUNIT, // radius + 48*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_DONTENCOREMAP, // flags + S_NULL // raisestate + }, + { // MT_BLUESPHERE -1, // doomednum S_BLUESPHERE_SPAWN, // spawnstate diff --git a/src/info.h b/src/info.h index 2c7a3ed23..17b111c55 100644 --- a/src/info.h +++ b/src/info.h @@ -402,6 +402,7 @@ typedef enum sprite // Collectible Items SPR_RING, + SPR_DEBT, SPR_TRNG, // Team Rings SPR_TOKE, // Special Stage Token SPR_RFLG, // Red CTF Flag @@ -5281,6 +5282,21 @@ typedef enum state S_FINISHBEAMEND1, S_FINISHBEAMEND2, + S_DEBTSPIKE1, + S_DEBTSPIKE2, + S_DEBTSPIKE3, + S_DEBTSPIKE4, + S_DEBTSPIKE5, + S_DEBTSPIKE6, + S_DEBTSPIKE7, + S_DEBTSPIKE8, + S_DEBTSPIKE9, + S_DEBTSPIKEA, + S_DEBTSPIKEB, + S_DEBTSPIKEC, + S_DEBTSPIKED, + S_DEBTSPIKEE, + #ifdef SEENAMES S_NAMECHECK, #endif @@ -5440,6 +5456,7 @@ typedef enum mobj_type // Collectible Items MT_RING, MT_FLINGRING, // Lost ring + MT_DEBTSPIKE, // Ring debt funny spike MT_BLUESPHERE, // Blue sphere for special stages MT_FLINGBLUESPHERE, // Lost blue sphere MT_BOMBSPHERE, diff --git a/src/p_inter.c b/src/p_inter.c index 5be3cc736..deb79df4a 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2115,6 +2115,9 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) fixed_t ns; fixed_t z; fixed_t momxy = 5<mo->scale; // Rings shouldn't be in Battle! if (gametyperules & GTR_SPHERES) @@ -2134,9 +2137,19 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) else if (num_rings <= 0) return; - // Cap the maximum loss automatically to 2 in ring debt - if (player->rings <= 0 && num_rings > 2) - num_rings = 2; + if (player->rings <= 0) + { + // In ring debt, spill the Funny Spikes + objType = MT_DEBTSPIKE; + objFuse = 90; + + objScale = 3 * objScale / 2; + } + else + { + objType = MT_FLINGRING; + objFuse = 60*TICRATE; + } P_GivePlayerRings(player, -num_rings); @@ -2145,8 +2158,6 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) for (i = 0; i < num_rings; i++) { - INT32 objType = mobjinfo[MT_RING].reactiontime; - z = player->mo->z; if (player->mo->eflags & MFE_VERTICALFLIP) z += player->mo->height - mobjinfo[objType].height; @@ -2154,11 +2165,11 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) mo = P_SpawnMobj(player->mo->x, player->mo->y, z, objType); mo->threshold = 10; - mo->fuse = 60*TICRATE; + mo->fuse = objFuse; P_SetTarget(&mo->target, player->mo); - mo->destscale = player->mo->scale; - P_SetScale(mo, player->mo->scale); + mo->destscale = objScale; + P_SetScale(mo, objScale); // Angle / height offset changes every other ring if (i != 0) @@ -2172,11 +2183,11 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) fa += ANGLE_180; } - ns = FixedMul(momxy, mo->scale); + ns = FixedMul(momxy, player->mo->scale); mo->momx = (mo->target->momx/2) + FixedMul(FINECOSINE(fa>>ANGLETOFINESHIFT), ns); mo->momy = (mo->target->momy/2) + FixedMul(FINESINE(fa>>ANGLETOFINESHIFT), ns); - ns = FixedMul(momz, mo->scale); + ns = FixedMul(momz, player->mo->scale); P_SetObjectMomZ(mo, (mo->target->momz/2) + ns, false); if (player->mo->eflags & MFE_VERTICALFLIP) diff --git a/src/p_mobj.c b/src/p_mobj.c index 2cbabfd9a..f4f14c663 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2280,6 +2280,11 @@ boolean P_ZMovement(mobj_t *mo) else mo->flags2 ^= MFD_DONTDRAW; } + else if (mo->type == MT_DEBTSPIKE) + { + mom.x = mom.y = 0; + mom.z = -mom.z/2; + } else if (mo->flags & MF_MISSILE) { if (!(mo->flags & MF_NOCLIP)) @@ -9124,6 +9129,7 @@ static void P_DefaultMobjShadowScale(mobj_t *thing) thing->shadowscale = FRACUNIT; break; case MT_RING: + case MT_DEBTSPIKE: case MT_FLOATINGITEM: case MT_BLUESPHERE: case MT_EMERALD: From 45b98298d91d6da1491409860fb3afe9196bff41 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 6 Feb 2021 02:45:23 -0800 Subject: [PATCH 2/4] Ring burst adjustment Explosions and Tumble - 10 rings SPB - 20 rings --- src/k_kart.c | 7 ++++++- src/k_kart.h | 2 +- src/lua_baselib.c | 4 ++-- src/p_inter.c | 3 ++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index fd485a5cf..3ebbd89e3 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2616,8 +2616,10 @@ static void K_HandleTumbleSound(player_t *player) } } -void K_ExplodePlayer(player_t *player, mobj_t *inflictor, mobj_t *source) // A bit of a hack, we just throw the player up higher here and extend their spinout timer +int K_ExplodePlayer(player_t *player, mobj_t *inflictor, mobj_t *source) // A bit of a hack, we just throw the player up higher here and extend their spinout timer { + int ringburst = 10; + (void)source; player->mo->momz = 18*mapobjectscale*P_MobjFlip(player->mo); // please stop forgetting mobjflip checks!!!! @@ -2632,6 +2634,7 @@ void K_ExplodePlayer(player_t *player, mobj_t *inflictor, mobj_t *source) // A b { player->kartstuff[k_spinouttimer] = ((5*player->kartstuff[k_spinouttimer])/2)+1; player->mo->momz *= 2; + ringburst = 20; } } @@ -2642,6 +2645,8 @@ void K_ExplodePlayer(player_t *player, mobj_t *inflictor, mobj_t *source) // A b if (P_IsDisplayPlayer(player)) P_StartQuake(64< Date: Sat, 6 Feb 2021 20:22:15 -0800 Subject: [PATCH 3/4] Drop spikes once ring burst puts you into debt --- src/p_inter.c | 120 ++++++++++++++++++++++++++++---------------------- 1 file changed, 67 insertions(+), 53 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index e0a571a0f..e9fae2943 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2135,6 +2135,59 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da return true; } +static void P_FlingBurst +( player_t *player, + angle_t fa, + fixed_t z, + mobjtype_t objType, + tic_t objFuse, + fixed_t objScale, + INT32 i) +{ + mobj_t *mo; + fixed_t ns; + fixed_t momxy = 5<> 1; + + z = player->mo->z; + if (player->mo->eflags & MFE_VERTICALFLIP) + z += player->mo->height - mobjinfo[objType].height; + + mo = P_SpawnMobj(player->mo->x, player->mo->y, z, objType); + + mo->threshold = 10; // not useful for spikes + mo->fuse = objFuse; + P_SetTarget(&mo->target, player->mo); + + mo->destscale = objScale; + P_SetScale(mo, objScale); + + /* + 0: 0 + 1: 1 = (1+1)/2 = 1 + 2: 1 = (2+1)/2 = 1 + 3: 2 = (3+1)/2 = 2 + 4: 2 = (4+1)/2 = 2 + 5: 3 = (4+1)/2 = 2 + */ + // Angle / height offset changes every other ring + momxy -= mx * FRACUNIT; + momz += mx * (2<mo->scale); + mo->momx = (mo->target->momx/2) + FixedMul(FINECOSINE(fa>>ANGLETOFINESHIFT), ns); + mo->momy = (mo->target->momy/2) + FixedMul(FINESINE(fa>>ANGLETOFINESHIFT), ns); + + ns = FixedMul(momz, player->mo->scale); + P_SetObjectMomZ(mo, (mo->target->momz/2) + ns, false); + + if (player->mo->eflags & MFE_VERTICALFLIP) + mo->momz *= -1; +} + /** Spills an injured player's rings. * * \param player The player who is losing rings. @@ -2144,15 +2197,10 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da */ void P_PlayerRingBurst(player_t *player, INT32 num_rings) { + INT32 num_fling_rings; INT32 i; - mobj_t *mo; angle_t fa; - fixed_t ns; fixed_t z; - fixed_t momxy = 5<mo->scale; // Rings shouldn't be in Battle! if (gametyperules & GTR_SPHERES) @@ -2172,60 +2220,26 @@ void P_PlayerRingBurst(player_t *player, INT32 num_rings) else if (num_rings <= 0) return; - if (player->rings <= 0) - { - // In ring debt, spill the Funny Spikes - objType = MT_DEBTSPIKE; - objFuse = 90; - - objScale = 3 * objScale / 2; - } - else - { - objType = MT_FLINGRING; - objFuse = 60*TICRATE; - } + num_fling_rings = min(num_rings, player->rings); P_GivePlayerRings(player, -num_rings); // determine first angle fa = player->mo->angle + ((P_RandomByte() & 1) ? -ANGLE_90 : ANGLE_90); - for (i = 0; i < num_rings; i++) + z = player->mo->z; + if (player->mo->eflags & MFE_VERTICALFLIP) + z += player->mo->height - mobjinfo[MT_RING].height; + + for (i = 0; i < num_fling_rings; i++) { - z = player->mo->z; - if (player->mo->eflags & MFE_VERTICALFLIP) - z += player->mo->height - mobjinfo[objType].height; + P_FlingBurst(player, fa, z, + MT_FLINGRING, 60*TICRATE, player->mo->scale, i); + } - mo = P_SpawnMobj(player->mo->x, player->mo->y, z, objType); - - mo->threshold = 10; - mo->fuse = objFuse; - P_SetTarget(&mo->target, player->mo); - - mo->destscale = objScale; - P_SetScale(mo, objScale); - - // Angle / height offset changes every other ring - if (i != 0) - { - if (i & 1) - { - momxy -= FRACUNIT; - momz += 2<mo->scale); - mo->momx = (mo->target->momx/2) + FixedMul(FINECOSINE(fa>>ANGLETOFINESHIFT), ns); - mo->momy = (mo->target->momy/2) + FixedMul(FINESINE(fa>>ANGLETOFINESHIFT), ns); - - ns = FixedMul(momz, player->mo->scale); - P_SetObjectMomZ(mo, (mo->target->momz/2) + ns, false); - - if (player->mo->eflags & MFE_VERTICALFLIP) - mo->momz *= -1; + while (i < num_rings) + { + P_FlingBurst(player, fa, z, + MT_DEBTSPIKE, 90, 3 * player->mo->scale / 2, i++); } } From e9572232de86dc914f0d504c225c5a75853435b9 Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 6 Feb 2021 20:24:39 -0800 Subject: [PATCH 4/4] Fine, int32 --- src/k_kart.c | 4 ++-- src/k_kart.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 4731358eb..2a86f97bb 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -2873,9 +2873,9 @@ static void K_HandleTumbleSound(player_t *player) } } -int K_ExplodePlayer(player_t *player, mobj_t *inflictor, mobj_t *source) // A bit of a hack, we just throw the player up higher here and extend their spinout timer +INT32 K_ExplodePlayer(player_t *player, mobj_t *inflictor, mobj_t *source) // A bit of a hack, we just throw the player up higher here and extend their spinout timer { - int ringburst = 10; + INT32 ringburst = 10; (void)source; diff --git a/src/k_kart.h b/src/k_kart.h index fdee34c8a..0c8b3680c 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -45,7 +45,7 @@ void K_DoInstashield(player_t *player); void K_BattleAwardHit(player_t *player, player_t *victim, mobj_t *inflictor, UINT8 bumpersRemoved); void K_SpinPlayer(player_t *player, mobj_t *inflictor, mobj_t *source, INT32 type); void K_TumblePlayer(player_t *player, mobj_t *inflictor, mobj_t *source); -int K_ExplodePlayer(player_t *player, mobj_t *inflictor, mobj_t *source); +INT32 K_ExplodePlayer(player_t *player, mobj_t *inflictor, mobj_t *source); void K_DebtStingPlayer(player_t *player, mobj_t *source); void K_HandleBumperChanges(player_t *player, UINT8 prevBumpers); void K_DestroyBumpers(player_t *player, UINT8 amount);