From a5547631280d6beeb12e9b485996e6bb42af452a Mon Sep 17 00:00:00 2001 From: TehRealSalt Date: Sun, 10 Jun 2018 16:10:24 -0400 Subject: [PATCH] Maintenence - Fix merge issues - Update invincibility flash to use its own object instead of MT_OVERLAY, so extra hacks don't need baked into overlay thinking - K_SpawnSparkleTrail can accept mobjs now, since there really wasn't any reason it needed a player. - Comment out a few old MK/vanilla SRB2 effects for now --- src/dehacked.c | 1 + src/info.c | 29 ++++++++++++++++++++++++++++- src/info.h | 1 + src/k_kart.c | 36 ++++++++++++++++-------------------- src/k_kart.h | 2 +- src/lua_baselib.c | 22 +++++++++++----------- src/p_inter.c | 4 ++-- src/p_mobj.c | 26 +++++++++++++++++--------- src/p_user.c | 7 +++++-- 9 files changed, 82 insertions(+), 46 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 8e472d3d..bc5814e4 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -7106,6 +7106,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_SNEAKERTRAIL", "MT_SPARKLETRAIL", + "MT_INVULNFLASH", "MT_DRIFT", "MT_DRIFTDUST", diff --git a/src/info.c b/src/info.c index 821978bb..94c4ae0d 100644 --- a/src/info.c +++ b/src/info.c @@ -14324,7 +14324,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_SPARKLETRAIL -1, // doomednum S_KARTINVULN_SMALL1, // spawnstate - 1, // spawnhealth + 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound 8, // reactiontime @@ -14348,6 +14348,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_INVULNFLASH + -1, // doomednum + S_INVULNFLASH1, // 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 + 8, // speed + 8*FRACUNIT, // radius + 8*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY, // flags + S_NULL // raisestate + }, + { // MT_DRIFT -1, // doomednum S_DRIFTSPARK1, // spawnstate diff --git a/src/info.h b/src/info.h index 0eab772a..42d3dacb 100644 --- a/src/info.h +++ b/src/info.h @@ -3965,6 +3965,7 @@ typedef enum mobj_type MT_SNEAKERTRAIL, MT_SPARKLETRAIL, + MT_INVULNFLASH, MT_DRIFT, MT_DRIFTDUST, diff --git a/src/k_kart.c b/src/k_kart.c index 71da5668..853c8bde 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -1011,7 +1011,7 @@ void K_LakituChecker(player_t *player) { ticcmd_t *cmd = &player->cmd; - if (player->kartstuff[k_lakitu] == 44) + /*if (player->kartstuff[k_lakitu] == 44) { mobj_t *mo; angle_t newangle; @@ -1033,7 +1033,7 @@ void K_LakituChecker(player_t *player) mo->angle = newangle+ANGLE_180; P_SetTarget(&mo->target, player->mo); } - } + }*/ if (player->kartstuff[k_lakitu] > 3) { @@ -1873,34 +1873,32 @@ void K_SpawnBoostTrail(player_t *player) } } -void K_SpawnSparkleTrail(player_t *player) +void K_SpawnSparkleTrail(mobj_t *mo) { - const INT32 rad = (player->mo->radius*2)>>FRACBITS; - fixed_t newx, newy, newz; + const INT32 rad = (mo->radius*2)>>FRACBITS; mobj_t *sparkle; INT32 i; - I_Assert(player != NULL); - I_Assert(player->mo != NULL); - I_Assert(!P_MobjWasRemoved(player->mo)); + I_Assert(mo != NULL); + I_Assert(!P_MobjWasRemoved(mo)); for (i = 0; i < 3; i++) { - newx = player->mo->x + player->mo->momx + (P_RandomRange(-rad, rad)<mo->y + player->mo->momy + (P_RandomRange(-rad, rad)<mo->z + player->mo->momz + (P_RandomRange(0, player->mo->height>>FRACBITS)<x + mo->momx + (P_RandomRange(-rad, rad)<y + mo->momy + (P_RandomRange(-rad, rad)<z + mo->momz + (P_RandomRange(0, mo->height>>FRACBITS)<target, player->mo); - sparkle->destscale = player->mo->destscale; - P_SetScale(sparkle, player->mo->scale); - sparkle->eflags = (sparkle->eflags & ~MFE_VERTICALFLIP)|(player->mo->eflags & MFE_VERTICALFLIP); - sparkle->color = player->mo->color; - //sparkle->colorized = player->mo->colorized; + P_SetTarget(&sparkle->target, mo); + sparkle->destscale = mo->destscale; + P_SetScale(sparkle, mo->scale); + sparkle->eflags = (sparkle->eflags & ~MFE_VERTICALFLIP)|(mo->eflags & MFE_VERTICALFLIP); + sparkle->color = mo->color; + //sparkle->colorized = mo->colorized; } } @@ -2932,9 +2930,8 @@ void K_MoveKartPlayer(player_t *player, boolean onground) S_StartSound(player->mo, sfx_kinvnc); if (!player->kartstuff[k_invincibilitytimer]) { - mobj_t *overlay = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_OVERLAY); + mobj_t *overlay = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_INVULNFLASH); P_SetTarget(&overlay->target, player->mo); - P_SetMobjState(overlay, S_INVULNFLASH1); overlay->destscale = player->mo->scale; P_SetScale(overlay, player->mo->scale); } @@ -3244,7 +3241,6 @@ void K_MoveKartPlayer(player_t *player, boolean onground) player->kartstuff[k_itemamount]--; K_PlayTauntSound(player->mo); - player->kartstuff[k_sounds] = 50; } break; case KITEM_GROW: diff --git a/src/k_kart.h b/src/k_kart.h index 6a62915e..081d0fc0 100644 --- a/src/k_kart.h +++ b/src/k_kart.h @@ -30,8 +30,8 @@ void K_StealBalloon(player_t *player, player_t *victim, boolean force); void K_SpawnKartExplosion(fixed_t x, fixed_t y, fixed_t z, fixed_t radius, INT32 number, mobjtype_t type, angle_t rotangle, boolean spawncenter, boolean ghostit, mobj_t *source); void K_SpawnMineExplosion(mobj_t *source, UINT8 color); void K_SpawnBoostTrail(player_t *player); +void K_SpawnSparkleTrail(mobj_t *mo); void K_DriftDustHandling(mobj_t *spawner); -void K_SpawnSparkleTrail(player_t *player); void K_DoSneaker(player_t *player, boolean doPFlag); void K_DoPogoSpring(mobj_t *mo, fixed_t vertispeed); boolean K_CheckPlayersRespawnColliding(INT32 playernum, fixed_t x, fixed_t y); diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 46b4cab6..30f1feb2 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -2090,6 +2090,16 @@ static int lib_kSpawnBoostTrail(lua_State *L) return 0; } +static int lib_kSpawnSparkleTrail(lua_State *L) +{ + mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); + NOHUD + if (!mo) + return LUA_ErrInvalid(L, "mobj_t"); + K_SpawnSparkleTrail(mo); + return 0; +} + static int lib_kDriftDustHandling(lua_State *L) { mobj_t *spawner = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); @@ -2100,16 +2110,6 @@ static int lib_kDriftDustHandling(lua_State *L) return 0; } -static int lib_kSpawnSparkleTrail(lua_State *L) -{ - player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); - NOHUD - if (!player) - return LUA_ErrInvalid(L, "player_t"); - K_SpawnDriftTrail(player); - return 0; -} - static int lib_kDoSneaker(lua_State *L) { player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER)); @@ -2355,8 +2355,8 @@ static luaL_Reg lib[] = { {"K_StealBalloon",lib_kStealBalloon}, {"K_SpawnKartExplosion",lib_kSpawnKartExplosion}, {"K_SpawnBoostTrail",lib_kSpawnBoostTrail}, - {"K_DriftDustHandling",lib_kDriftDustHandling}, {"K_SpawnSparkleTrail",lib_kSpawnSparkleTrail}, + {"K_DriftDustHandling",lib_kDriftDustHandling}, {"K_DoSneaker",lib_kDoSneaker}, {"K_DoPogoSpring",lib_kDoPogoSpring}, {"K_MomentumToFacing",lib_kMomentumToFacing}, diff --git a/src/p_inter.c b/src/p_inter.c index ad465d5f..9b2cf4c8 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -3105,7 +3105,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da player->kartstuff[k_sneakertimer] = 0; - // Size Down + // Shrink if (damage == 64) { if (player == source->player) @@ -3126,7 +3126,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da player->kartstuff[k_growshrinktimer] = 2; } // Invincible or not, we still need this. - P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_LIGHTNING); + //P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_LIGHTNING); return true; } diff --git a/src/p_mobj.c b/src/p_mobj.c index 2fc4f8de..2a216661 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8122,6 +8122,23 @@ void P_MobjThinker(mobj_t *mobj) S_StartSound(mobj, sfx_prloop); mobj->health--; break; + case MT_SPARKLETRAIL: + if (!mobj->target) + { + P_RemoveMobj(mobj); + return; + } + mobj->color = mobj->target->color; + mobj->colorized = mobj->target->colorized; + break; + case MT_INVULNFLASH: + if (!mobj->target || (mobj->target->player && !mobj->target->player->kartstuff[k_invincibilitytimer])) + { + P_RemoveMobj(mobj); + return; + } + A_CapeChase(mobj); + break; //} case MT_TURRET: P_MobjCheckWater(mobj); @@ -8181,15 +8198,6 @@ void P_MobjThinker(mobj_t *mobj) mobj->tracer->y, mobj->tracer->floorz, SPLATDRAWMODE_SHADE); #endif break; - case MT_SPARKLETRAIL: - if (!mobj->target) - { - P_RemoveMobj(mobj); - return; - } - mobj->color = mobj->target->color; - mobj->colorized = mobj->target->colorized; - break; case MT_SPINFIRE: case MT_SNEAKERTRAIL: if (mobj->eflags & MFE_VERTICALFLIP) diff --git a/src/p_user.c b/src/p_user.c index f010fde1..a3d5bfdd 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -2304,12 +2304,12 @@ static void P_CheckInvincibilityTimer(player_t *player) //if (mariomode && !player->powers[pw_super]) // SRB2kart player->mo->color = (UINT8)(1 + (leveltime % (MAXSKINCOLORS-1))); - if (leveltime % (TICRATE/7) == 0) + /*if (leveltime % (TICRATE/7) == 0) { mobj_t *sparkle = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, MT_IVSP); sparkle->destscale = player->mo->scale; P_SetScale(sparkle, player->mo->scale); - } + }*/ // Resume normal music stuff. if (player->powers[pw_invulnerability] == 1 || player->kartstuff[k_invincibilitytimer] == 1) @@ -6925,6 +6925,9 @@ static void P_MovePlayer(player_t *player) if (player->kartstuff[k_sneakertimer] > 0 && onground && (leveltime & 1)) K_SpawnBoostTrail(player); + if (player->kartstuff[k_invincibilitytimer] > 0) + K_SpawnSparkleTrail(player->mo); + K_DriftDustHandling(player->mo); /* // SRB2kart - nadah