Merge branch 'funny-spikes' into 'master'

Funny Debt Spikes

See merge request KartKrew/Kart!366
This commit is contained in:
James R 2021-02-07 05:51:57 -05:00
commit c7783945ca
8 changed files with 162 additions and 47 deletions

View file

@ -9432,6 +9432,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
@ -9573,6 +9589,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",

View file

@ -133,6 +133,7 @@ char sprnames[NUMSPRITES + 1][5] =
// Collectible Items
"RING",
"DEBT",
"TRNG", // Team Rings
"TOKE", // Special Stage Token
"RFLG", // Red CTF Flag
@ -5170,6 +5171,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
@ -8120,6 +8137,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

View file

@ -404,6 +404,7 @@ typedef enum sprite
// Collectible Items
SPR_RING,
SPR_DEBT,
SPR_TRNG, // Team Rings
SPR_TOKE, // Special Stage Token
SPR_RFLG, // Red CTF Flag
@ -5304,6 +5305,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
@ -5465,6 +5481,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,

View file

@ -2881,8 +2881,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
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
{
INT32 ringburst = 10;
(void)source;
player->mo->momz = 18*mapobjectscale*P_MobjFlip(player->mo); // please stop forgetting mobjflip checks!!!!
@ -2897,6 +2899,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;
}
}
@ -2907,6 +2910,8 @@ void K_ExplodePlayer(player_t *player, mobj_t *inflictor, mobj_t *source) // A b
if (P_IsDisplayPlayer(player))
P_StartQuake(64<<FRACBITS, 5);
return ringburst;
}
// This kind of wipeout happens with no rings -- doesn't remove a bumper, has no invulnerability, and is much shorter.

View file

@ -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);
void 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);

View file

@ -3440,8 +3440,8 @@ static int lib_kExplodePlayer(lua_State *L)
inflictor = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
if (!lua_isnone(L, 3) && lua_isuserdata(L, 3))
source = *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ));
K_ExplodePlayer(player, inflictor, source);
return 0;
lua_pushinteger(L, K_ExplodePlayer(player, inflictor, source));
return 1;
}
static int lib_kTakeBumpersFromPlayer(lua_State *L)

View file

@ -2046,10 +2046,11 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
break;
case DMG_TUMBLE:
K_TumblePlayer(player, inflictor, source);
ringburst = 10;
break;
case DMG_EXPLODE:
case DMG_KARMA:
K_ExplodePlayer(player, inflictor, source);
ringburst = K_ExplodePlayer(player, inflictor, source);
break;
case DMG_WIPEOUT:
if (P_IsDisplayPlayer(player))
@ -2134,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<<FRACBITS, momz = 12<<FRACBITS; // base horizonal/vertical thrusts
INT32 mx = (i + 1) >> 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<<FRACBITS);
if (i & 1)
fa += ANGLE_180;
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, 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.
@ -2143,12 +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<<FRACBITS, momz = 12<<FRACBITS; // base horizonal/vertical thrusts
// Rings shouldn't be in Battle!
if (gametyperules & GTR_SPHERES)
@ -2168,52 +2220,26 @@ 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;
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++)
{
INT32 objType = mobjinfo[MT_RING].reactiontime;
P_FlingBurst(player, fa, z,
MT_FLINGRING, 60*TICRATE, player->mo->scale, i);
}
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;
mo->fuse = 60*TICRATE;
P_SetTarget(&mo->target, player->mo);
mo->destscale = player->mo->scale;
P_SetScale(mo, player->mo->scale);
// Angle / height offset changes every other ring
if (i != 0)
{
if (i & 1)
{
momxy -= FRACUNIT;
momz += 2<<FRACBITS;
}
fa += ANGLE_180;
}
ns = FixedMul(momxy, 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);
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++);
}
}

View file

@ -2292,6 +2292,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))
@ -9192,6 +9197,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: