diff --git a/src/dehacked.c b/src/dehacked.c index 856788f48..a82672306 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2421,6 +2421,7 @@ static actionpointer_t actionpointers[] = {{A_SnapperThinker}, "A_SNAPPERTHINKER"}, {{A_SaloonDoorSpawn}, "A_SALOONDOORSPAWN"}, {{A_MinecartSparkThink}, "A_MINECARTSPARKTHINK"}, + {{A_ModuloToState}, "A_MODULOTOSTATE"}, {{NULL}, "NONE"}, // This NULL entry must be the last in the list @@ -7133,7 +7134,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_CRUMBLE2", // Spark - "S_SPRK", + "S_SPRK1", + "S_SPRK2", + "S_SPRK3", // Robot Explosion "S_XPLD_FLICKY", diff --git a/src/info.c b/src/info.c index 7a225ee8c..9aed563c7 100644 --- a/src/info.c +++ b/src/info.c @@ -3833,7 +3833,9 @@ state_t states[NUMSTATES] = {SPR_NULL, 0, 105, {A_Scream}, 0, 0, S_NULL}, // S_CRUMBLE2 // Spark - {SPR_SPRK, FF_TRANS20|FF_ANIMATE|0, 18, {NULL}, 8, 2, S_NULL}, // S_SPRK + {SPR_NULL, 0, 1, {A_ModuloToState}, 2, S_SPRK2, S_SPRK3}, // S_SPRK1 + {SPR_SPRK, FF_TRANS20|FF_ANIMATE|0, 18, {NULL}, 8, 2, S_NULL}, // S_SPRK2 + {SPR_SPRK, FF_TRANS20|FF_ANIMATE|9, 18, {NULL}, 8, 2, S_NULL}, // S_SPRK3 // Robot Explosion {SPR_BOM1, 0, 0, {A_FlickySpawn}, 0, 0, S_XPLD1}, // S_XPLD_FLICKY @@ -5603,7 +5605,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_None, // deathsound 10*FRACUNIT, // speed @@ -6440,7 +6442,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_itemup, // deathsound 38*FRACUNIT, // speed @@ -6467,7 +6469,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_itemup, // deathsound 38*FRACUNIT, // speed @@ -6575,7 +6577,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_itemup, // deathsound 38*FRACUNIT, // speed @@ -6602,7 +6604,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_itemup, // deathsound 38*FRACUNIT, // speed @@ -6629,7 +6631,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_None, // deathsound 0, // speed @@ -6710,7 +6712,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_ncitem, // deathsound 1, // speed @@ -6737,7 +6739,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_cgot, // deathsound EMERALD1, // speed @@ -6763,7 +6765,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_cgot, // deathsound EMERALD2, // speed @@ -6789,7 +6791,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_cgot, // deathsound EMERALD3, // speed @@ -6815,7 +6817,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_cgot, // deathsound EMERALD4, // speed @@ -6841,7 +6843,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_cgot, // deathsound EMERALD5, // speed @@ -6867,7 +6869,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_cgot, // deathsound EMERALD6, // speed @@ -6893,7 +6895,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_cgot, // deathsound EMERALD7, // speed @@ -6920,7 +6922,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_cgot, // deathsound 8, // speed @@ -6974,7 +6976,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_cgot, // deathsound 60*FRACUNIT, // speed @@ -17165,8 +17167,8 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate - S_SPRK, // xdeathstate + S_SPRK1, // deathstate + S_SPRK1, // xdeathstate sfx_None, // deathsound 60*FRACUNIT, // speed 16*FRACUNIT, // radius @@ -17192,7 +17194,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_itemup, // deathsound 60*FRACUNIT, // speed @@ -17220,7 +17222,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_itemup, // deathsound 60*FRACUNIT, // speed @@ -17247,7 +17249,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_itemup, // deathsound 60*FRACUNIT, // speed @@ -17274,7 +17276,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_itemup, // deathsound 60*FRACUNIT, // speed @@ -17301,7 +17303,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_itemup, // deathsound 60*FRACUNIT, // speed @@ -17328,7 +17330,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_itemup, // deathsound 60*FRACUNIT, // speed @@ -17355,7 +17357,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_itemup, // deathsound 60*FRACUNIT, // speed @@ -17382,7 +17384,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_itemup, // deathsound 60*FRACUNIT, // speed @@ -17572,7 +17574,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_itemup, // deathsound 60*FRACUNIT, // speed @@ -17599,7 +17601,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_itemup, // deathsound 60*FRACUNIT, // speed @@ -17626,7 +17628,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_itemup, // deathsound 60*FRACUNIT, // speed @@ -17653,7 +17655,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_itemup, // deathsound 60*FRACUNIT, // speed @@ -18543,7 +18545,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_s3k33, // painsound S_RING, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_ncchip, // deathsound 1, // speed @@ -18570,7 +18572,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_ncchip, // deathsound 38*FRACUNIT, // speed @@ -18597,7 +18599,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_s3k33, // painsound S_RING, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_ncitem, // deathsound 1, // speed @@ -18624,7 +18626,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_ncspec, // deathsound 20*TICRATE, // speed @@ -18651,7 +18653,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_ncspec, // deathsound 96*20, // speed @@ -18678,7 +18680,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_ncspec, // deathsound 20*TICRATE, // speed @@ -18705,7 +18707,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_ncspec, // deathsound 30*TICRATE, // speed @@ -18732,7 +18734,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate - S_SPRK, // deathstate + S_SPRK1, // deathstate S_NULL, // xdeathstate sfx_ncspec, // deathsound 15*TICRATE, // speed @@ -19615,7 +19617,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_SPARK -1, // doomednum - S_SPRK, // spawnstate + S_SPRK1, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound diff --git a/src/info.h b/src/info.h index 1c60ea24c..bb27ac3e3 100644 --- a/src/info.h +++ b/src/info.h @@ -265,6 +265,7 @@ void A_SnapperSpawn(); void A_SnapperThinker(); void A_SaloonDoorSpawn(); void A_MinecartSparkThink(); +void A_ModuloToState(); // ratio of states to sprites to mobj types is roughly 6 : 1 : 1 #define NUMMOBJFREESLOTS 512 @@ -3890,7 +3891,9 @@ typedef enum state S_CRUMBLE2, // Spark - S_SPRK, + S_SPRK1, + S_SPRK2, + S_SPRK3, // Robot Explosion S_XPLD_FLICKY, diff --git a/src/p_enemy.c b/src/p_enemy.c index d7bc7a583..4f046fe06 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -37,6 +37,8 @@ boolean LUA_CallAction(const char *action, mobj_t *actor); player_t *stplyr; INT32 var1; INT32 var2; +INT32 modulothing; + // // P_NewChaseDir related LUT. // @@ -293,6 +295,7 @@ void A_SnapperSpawn(mobj_t *actor); void A_SnapperThinker(mobj_t *actor); void A_SaloonDoorSpawn(mobj_t *actor); void A_MinecartSparkThink(mobj_t *actor); +void A_ModuloToState(mobj_t *actor); //for p_enemy.c @@ -13677,4 +13680,25 @@ void A_MinecartSparkThink(mobj_t *actor) P_SetScale(trail, trail->scale/4); trail->destscale = trail->scale; } +} + +// Function: A_ModuloToState +// +// Description: Modulo operation to state +// +// var1 = Modulo +// var2 = State +// +void A_ModuloToState(mobj_t *actor) +{ + INT32 locvar1 = var1; + INT32 locvar2 = var2; +#ifdef HAVE_BLUA + if (LUA_CallAction("A_ModuloToState", actor)) + return; +#endif + + if ((modulothing % locvar1 == 0)) + P_SetMobjState(actor, (locvar2)); + modulothing++; } \ No newline at end of file diff --git a/src/p_mobj.h b/src/p_mobj.h index 77791f928..a9d5244b0 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -464,6 +464,8 @@ void P_SetScale(mobj_t *mobj, fixed_t newscale); void P_XYMovement(mobj_t *mo); void P_EmeraldManager(void); +extern INT32 modulothing; + #define MAXHUNTEMERALDS 64 extern mapthing_t *huntemeralds[MAXHUNTEMERALDS]; extern INT32 numhuntemeralds; diff --git a/src/p_saveg.c b/src/p_saveg.c index 24b68b971..996143c01 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3999,6 +3999,7 @@ static void P_NetArchiveMisc(void) WRITEINT32(save_p, sstimer); WRITEUINT32(save_p, bluescore); WRITEUINT32(save_p, redscore); + WRITEINT32(save_p, modulothing); WRITEINT16(save_p, autobalance); WRITEINT16(save_p, teamscramble); @@ -4077,6 +4078,7 @@ static inline boolean P_NetUnArchiveMisc(void) sstimer = READINT32(save_p); bluescore = READUINT32(save_p); redscore = READUINT32(save_p); + modulothing = READUINT32(save_p); autobalance = READINT16(save_p); teamscramble = READINT16(save_p); diff --git a/src/p_setup.c b/src/p_setup.c index c2872a836..f3468383c 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -2610,6 +2610,7 @@ boolean P_SetupLevel(boolean skipprecip) boolean loadedbm = false; sector_t *ss; boolean chase; + modulothing = 0; levelloading = true;