From 45d32b7f7cd3e54a1d6fd1df8f7adcc54f000c27 Mon Sep 17 00:00:00 2001 From: toasterbabe Date: Sun, 23 Oct 2016 20:34:43 +0100 Subject: [PATCH] * Flameaura shield now has boosh sprites. * MF2_SHIELD calls shield thinker (P_AddShield/P_ShieldLook). * Multiple types of force shields now handled. --- src/dehacked.c | 67 ++++++++++++++++++++++++++++---------------------- src/info.c | 14 ++++++++--- src/info.h | 8 ++++++ src/p_mobj.c | 48 +++++++++++++++++++++++++++--------- src/p_mobj.h | 1 + src/p_user.c | 2 ++ 6 files changed, 96 insertions(+), 44 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index a0eee8229..224b4393d 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5407,6 +5407,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_ELEM11", "S_ELEM12", + "S_ELEM13", + "S_ELEM14", + "S_ELEMF1", "S_ELEMF2", "S_ELEMF3", @@ -5439,6 +5442,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FIRS8", "S_FIRS9", + "S_FIRS10", + "S_FIRS11", + "S_FIRSB1", "S_FIRSB2", "S_FIRSB3", @@ -5449,6 +5455,8 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FIRSB8", "S_FIRSB9", + "S_FIRSB10", + "S_BUBS1", "S_BUBS2", "S_BUBS3", @@ -6653,35 +6661,36 @@ static const char *const MOBJFLAG_LIST[] = { // \tMF2_(\S+).*// (.+) --> \t"\1", // \2 static const char *const MOBJFLAG2_LIST[] = { - "AXIS", // It's a NiGHTS axis! (For faster checking) - "TWOD", // Moves like it's in a 2D level - "DONTRESPAWN", // Don't respawn this object! - "DONTDRAW", // Don't generate a vissprite - "AUTOMATIC", // Thrown ring has automatic properties - "RAILRING", // Thrown ring has rail properties - "BOUNCERING", // Thrown ring has bounce properties - "EXPLOSION", // Thrown ring has explosive properties - "SCATTER", // Thrown ring has scatter properties - "BEYONDTHEGRAVE",// Source of this missile has died and has since respawned. - "SLIDEPUSH", // MF_PUSHABLE that pushes continuously. - "CLASSICPUSH", // Drops straight down when object has negative Z. - "STANDONME", // While not pushable, stand on me anyway. - "INFLOAT", // Floating to a height for a move, don't auto float to target's height. - "DEBRIS", // Splash ring from explosion ring - "NIGHTSPULL", // Attracted from a paraloop - "JUSTATTACKED", // can be pushed by other moving mobjs - "FIRING", // turret fire - "SUPERFIRE", // Firing something with Super Sonic-stopping properties. Or, if mobj has MF_MISSILE, this is the actual fire from it. - "SHADOW", // Fuzzy draw, makes targeting harder. - "STRONGBOX", // Flag used for "strong" random monitors. - "OBJECTFLIP", // Flag for objects that always have flipped gravity. - "SKULLFLY", // Special handling: skull in flight. - "FRET", // Flashing from a previous hit - "BOSSNOTRAP", // No Egg Trap after boss - "BOSSFLEE", // Boss is fleeing! - "BOSSDEAD", // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.) - "AMBUSH", // Alternate behaviour typically set by MTF_AMBUSH - "LINKDRAW", // Draw vissprite of mobj immediately before/after tracer's vissprite (dependent on dispoffset and position) + "AXIS", // It's a NiGHTS axis! (For faster checking) + "TWOD", // Moves like it's in a 2D level + "DONTRESPAWN", // Don't respawn this object! + "DONTDRAW", // Don't generate a vissprite + "AUTOMATIC", // Thrown ring has automatic properties + "RAILRING", // Thrown ring has rail properties + "BOUNCERING", // Thrown ring has bounce properties + "EXPLOSION", // Thrown ring has explosive properties + "SCATTER", // Thrown ring has scatter properties + "BEYONDTHEGRAVE", // Source of this missile has died and has since respawned. + "SLIDEPUSH", // MF_PUSHABLE that pushes continuously. + "CLASSICPUSH", // Drops straight down when object has negative Z. + "STANDONME", // While not pushable, stand on me anyway. + "INFLOAT", // Floating to a height for a move, don't auto float to target's height. + "DEBRIS", // Splash ring from explosion ring + "NIGHTSPULL", // Attracted from a paraloop + "JUSTATTACKED", // can be pushed by other moving mobjs + "FIRING", // turret fire + "SUPERFIRE", // Firing something with Super Sonic-stopping properties. Or, if mobj has MF_MISSILE, this is the actual fire from it. + "SHADOW", // Fuzzy draw, makes targeting harder. + "STRONGBOX", // Flag used for "strong" random monitors. + "OBJECTFLIP", // Flag for objects that always have flipped gravity. + "SKULLFLY", // Special handling: skull in flight. + "FRET", // Flashing from a previous hit + "BOSSNOTRAP", // No Egg Trap after boss + "BOSSFLEE", // Boss is fleeing! + "BOSSDEAD", // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.) + "AMBUSH", // Alternate behaviour typically set by MTF_AMBUSH + "LINKDRAW", // Draw vissprite of mobj immediately before/after tracer's vissprite (dependent on dispoffset and position) + "SHIELD", // Thinker calls P_AddShield/P_ShieldLook (must be partnered with MF_SCENERY to use) NULL }; diff --git a/src/info.c b/src/info.c index 2c0514634..802f90f26 100644 --- a/src/info.c +++ b/src/info.c @@ -2119,6 +2119,9 @@ state_t states[NUMSTATES] = {SPR_ELEM, FF_TRANS50|10, 4, {NULL}, 0, 0, S_ELEM12}, // S_ELEM11 {SPR_ELEM, FF_TRANS50|11, 4, {NULL}, 0, 0, S_ELEM1 }, // S_ELEM12 + {SPR_NULL, 0, 1, {NULL}, 0, 0, S_ELEM14}, // S_ELEM13 + {SPR_ELEM, FF_TRANS50|11, 1, {NULL}, 0, 0, S_ELEM1 }, // S_ELEM14 + {SPR_ELEM, FF_FULLBRIGHT|12, 3, {NULL}, 0, 0, S_ELEMF2 }, // S_ELEMF1 {SPR_ELEM, FF_FULLBRIGHT|13, 3, {NULL}, 0, 0, S_ELEMF3 }, // S_ELEMF2 {SPR_ELEM, FF_FULLBRIGHT|14, 3, {NULL}, 0, 0, S_ELEMF4 }, // S_ELEMF3 @@ -2152,6 +2155,9 @@ state_t states[NUMSTATES] = {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|7, 2, {NULL}, 0, 0, S_FIRS9}, // S_FIRS8 {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|8, 2, {NULL}, 0, 0, S_FIRS1}, // S_FIRS9 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|18, 1, {NULL}, 0, 0, S_FIRS11}, // S_FIRS10 + {SPR_NULL, 0, 1, {NULL}, 0, 0, S_FIRS1 }, // S_FIRS11 + {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40| 9, 2, {NULL}, 0, 0, S_FIRSB2}, // S_FIRSB1 {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|10, 2, {NULL}, 0, 0, S_FIRSB3}, // S_FIRSB2 {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|11, 2, {NULL}, 0, 0, S_FIRSB4}, // S_FIRSB3 @@ -2162,6 +2168,8 @@ state_t states[NUMSTATES] = {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|16, 2, {NULL}, 0, 0, S_FIRSB9}, // S_FIRSB8 {SPR_FIRS, FF_FULLBRIGHT|FF_TRANS40|17, 2, {NULL}, 0, 0, S_FIRSB1}, // S_FIRSB9 + {SPR_NULL, 0, 2, {NULL}, 0, 0, S_FIRSB1 }, // S_FIRSB10 + {SPR_BUBS, FF_TRANS30 , 3, {NULL}, 0, 0, S_BUBS2}, // S_BUBS1 {SPR_BUBS, FF_TRANS30|1, 3, {NULL}, 0, 0, S_BUBS3}, // S_BUBS2 {SPR_BUBS, FF_TRANS30|2, 3, {NULL}, 0, 0, S_BUBS4}, // S_BUBS3 @@ -10697,7 +10705,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // seesound 0, // reactiontime sfx_None, // attacksound - S_NULL, // painstate + S_ELEM13, // painstate SKINCOLOR_NONE, // painchance sfx_None, // painsound S_NULL, // meleestate @@ -10859,7 +10867,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // seesound 8, // reactiontime sfx_None, // attacksound - S_NULL, // painstate + S_FIRSB10, // painstate SKINCOLOR_NONE, // painchance sfx_None, // painsound S_NULL, // meleestate @@ -10875,7 +10883,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // damage sfx_None, // activesound MF_NOBLOCKMAP|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY|MF_SCENERY, // flags - S_NULL // raisestate + S_FIRS10 // raisestate }, { // MT_BUBBLEWRAP_ORB diff --git a/src/info.h b/src/info.h index 914d04d16..b9dc034bf 100644 --- a/src/info.h +++ b/src/info.h @@ -2304,6 +2304,9 @@ typedef enum state S_ELEM11, S_ELEM12, + S_ELEM13, + S_ELEM14, + S_ELEMF1, S_ELEMF2, S_ELEMF3, @@ -2336,6 +2339,9 @@ typedef enum state S_FIRS8, S_FIRS9, + S_FIRS10, + S_FIRS11, + S_FIRSB1, S_FIRSB2, S_FIRSB3, @@ -2346,6 +2352,8 @@ typedef enum state S_FIRSB8, S_FIRSB9, + S_FIRSB10, + S_BUBS1, S_BUBS2, S_BUBS3, diff --git a/src/p_mobj.c b/src/p_mobj.c index ecf0133f1..e49c3e797 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6392,7 +6392,7 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) // TODO: Make an MT_SHIELDORB which changes color/states to always match the appropriate shield, // instead of having completely seperate mobjtypes. - if (shield != SH_FORCE) + if (!(shield & SH_FORCE)) { // Regular shields check for themselves only if ((shieldtype_t)(thing->target->player->powers[pw_shield] & SH_NOSTACK) != shield) { @@ -6406,7 +6406,7 @@ static boolean P_ShieldLook(mobj_t *thing, shieldtype_t shield) return false; } - if (shield == SH_FORCE && thing->movecount != (thing->target->player->powers[pw_shield] & SH_FORCEHP)) + if (shield & SH_FORCE && thing->movecount != (thing->target->player->powers[pw_shield] & SH_FORCEHP)) { thing->movecount = (thing->target->player->powers[pw_shield] & SH_FORCEHP); if (thing->movecount < 1) @@ -6458,7 +6458,7 @@ void P_RunShields(void) // run shields for (i = 0; i < numshields; i++) { - P_ShieldLook(shields[i], shields[i]->info->speed); + P_ShieldLook(shields[i], shields[i]->threshold); P_SetTarget(&shields[i], NULL); } numshields = 0; @@ -6466,7 +6466,7 @@ void P_RunShields(void) static boolean P_AddShield(mobj_t *thing) { - shieldtype_t shield = thing->info->speed; + shieldtype_t shield = thing->threshold; if (!thing->target || thing->target->health <= 0 || !thing->target->player || (thing->target->player->powers[pw_shield] & SH_NOSTACK) == SH_NONE || thing->target->player->powers[pw_super] @@ -6476,7 +6476,7 @@ static boolean P_AddShield(mobj_t *thing) return false; } - if (shield != SH_FORCE) + if (!(shield & SH_FORCE)) { // Regular shields check for themselves only if ((shieldtype_t)(thing->target->player->powers[pw_shield] & SH_NOSTACK) != shield) { @@ -6743,6 +6743,11 @@ void P_MobjThinker(mobj_t *mobj) if (P_MobjWasRemoved(mobj)) return; #endif + + if (mobj->flags2 & MF2_SHIELD) + if (!P_AddShield(mobj)) + return; + switch (mobj->type) { case MT_HOOP: @@ -6802,12 +6807,11 @@ void P_MobjThinker(mobj_t *mobj) case MT_PITY_ORB: case MT_WHIRLWIND_ORB: case MT_ARMAGEDDON_ORB: - case MT_FLAMEAURA_ORB: - if (!P_AddShield(mobj)) + if (!(mobj->flags2 & MF2_SHIELD)) return; break; case MT_ATTRACT_ORB: - if (!P_AddShield(mobj)) + if (!(mobj->flags2 & MF2_SHIELD)) return; if (/*(mobj->target) -- the following is implicit by P_AddShield && (mobj->target->player) @@ -6818,7 +6822,7 @@ void P_MobjThinker(mobj_t *mobj) } break; case MT_ELEMENTAL_ORB: - if (!P_AddShield(mobj)) + if (!(mobj->flags2 & MF2_SHIELD)) return; if (mobj->tracer /* && mobj->target -- the following is implicit by P_AddShield @@ -6828,12 +6832,14 @@ void P_MobjThinker(mobj_t *mobj) && ((statenum_t)(mobj->tracer->state-states) < mobj->info->raisestate || (mobj->tracer->state->nextstate < mobj->info->raisestate && mobj->tracer->tics == 1))) { + P_SetMobjState(mobj, mobj->info->painstate); + mobj->tics++; P_SetMobjState(mobj->tracer, mobj->info->raisestate); mobj->tracer->tics++; } break; case MT_FORCE_ORB: - if (!P_AddShield(mobj)) + if (!(mobj->flags2 & MF2_SHIELD)) return; if (/* && mobj->target -- the following is implicit by P_AddShield @@ -6849,8 +6855,26 @@ void P_MobjThinker(mobj_t *mobj) whoosh->height = 42*FRACUNIT; mobj->target->player->pflags &= ~PF_SHIELDABILITY; // prevent eternal whoosh } + case MT_FLAMEAURA_ORB: + if (!(mobj->flags2 & MF2_SHIELD)) + return; + mobj->angle = mobj->target->angle; // implicitly okay because of P_AddShield + if (mobj->tracer + /* && mobj->target -- the following is implicit by P_AddShield + && mobj->target->player + && (mobj->target->player->powers[pw_shield] & SH_NOSTACK) == SH_FLAMEAURA */ + && mobj->target->player->pflags & PF_SHIELDABILITY + && ((statenum_t)(mobj->tracer->state-states) < mobj->info->raisestate + || (mobj->tracer->state->nextstate < mobj->info->raisestate && mobj->tracer->tics == 1))) + { + P_SetMobjState(mobj, mobj->info->painstate); + mobj->tics++; + P_SetMobjState(mobj->tracer, mobj->info->raisestate); + mobj->tracer->tics++; + } + break; case MT_BUBBLEWRAP_ORB: - if (!P_AddShield(mobj)) + if (!(mobj->flags2 & MF2_SHIELD)) return; if (mobj->tracer /* && mobj->target -- the following is implicit by P_AddShield @@ -6878,7 +6902,7 @@ void P_MobjThinker(mobj_t *mobj) } break; case MT_THUNDERCOIN_ORB: - if (!P_AddShield(mobj)) + if (!(mobj->flags2 & MF2_SHIELD)) return; if (mobj->tracer /* && mobj->target -- the following is implicit by P_AddShield diff --git a/src/p_mobj.h b/src/p_mobj.h index 69e0e11aa..40d5a732e 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -193,6 +193,7 @@ typedef enum MF2_BOSSDEAD = 1<<26, // Boss is dead! (Not necessarily fleeing, if a fleeing point doesn't exist.) MF2_AMBUSH = 1<<27, // Alternate behaviour typically set by MTF_AMBUSH MF2_LINKDRAW = 1<<28, // Draw vissprite of mobj immediately before/after tracer's vissprite (dependent on dispoffset and position) + MF2_SHIELD = 1<<29, // Thinker calls P_AddShield/P_ShieldLook (must be partnered with MF_SCENERY to use) // free: to and including 1<<31 } mobjflag2_t; diff --git a/src/p_user.c b/src/p_user.c index 8cb1b7607..c5490abe0 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1395,8 +1395,10 @@ void P_SpawnShieldOrb(player_t *player) } shieldobj = P_SpawnMobj(player->mo->x, player->mo->y, player->mo->z, orbtype); + shieldobj->flags2 |= MF2_SHIELD; P_SetTarget(&shieldobj->target, player->mo); shieldobj->color = (UINT8)shieldobj->info->painchance; + shieldobj->threshold = (player->powers[pw_shield] & SH_FORCE) ? SH_FORCE : (player->powers[pw_shield] & SH_NOSTACK); if (shieldobj->info->seestate) {