From 2a5c576c1c9759cb359da8942d4d3192d7ba409f Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 25 Aug 2019 12:40:32 +0200 Subject: [PATCH 01/50] Hardcoded the RVZ scenery --- src/dehacked.c | 16 ++++ src/hardware/hw_light.c | 3 + src/info.c | 174 ++++++++++++++++++++++++++++++++++++++++ src/info.h | 19 +++++ src/p_mobj.c | 19 +++++ 5 files changed, 231 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 04ac2ef4b..ae2eb9214 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5824,6 +5824,15 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLAMEJETFLAMEB2", "S_FLAMEJETFLAMEB3", + // RVZ scenery + "S_BIGFERNLEAF", + "S_BIGFERN1", + "S_BIGFERN2", + "S_JUNGLEPALM", + "S_TORCHFLOWER", + "S_WALLVINE_LONG", + "S_WALLVINE_SHORT", + // Trapgoyles "S_TRAPGOYLE", "S_TRAPGOYLE_CHECK", @@ -7539,6 +7548,13 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_FLAMEJETFLAMEB", // Blade's flame + "MT_BIGFERNLEAF", + "MT_BIGFERN", + "MT_JUNGLEPALM", + "MT_TORCHFLOWER", + "MT_WALLVINE_LONG", + "MT_WALLVINE_SHORT", + // Dark City Scenery // Egg Rock Scenery diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index a52d72869..e1f2a9699 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -373,6 +373,9 @@ light_t *t_lspr[NUMSPRITES] = // Red Volcano Scenery &lspr[REDBALL_L], // SPR_FLME &lspr[REDBALL_L], // SPR_DFLM + &lspr[NOLIGHT], // SPR_JPLA + &lspr[NOLIGHT], // SPR_TFLO + &lspr[NOLIGHT], // SPR_WVIN // Dark City Scenery diff --git a/src/info.c b/src/info.c index 18f0e838a..20b09d3cd 100644 --- a/src/info.c +++ b/src/info.c @@ -268,6 +268,9 @@ char sprnames[NUMSPRITES + 1][5] = // Red Volcano Scenery "FLME", // Flame jet "DFLM", // Blade's flame + "JPLA", // Jungle palm + "TFLO", // Torch flower + "WVIN", // Wall vines // Dark City Scenery @@ -2453,6 +2456,15 @@ state_t states[NUMSTATES] = {SPR_DFLM, FF_FULLBRIGHT|FF_TRANS40, 1, {A_MoveRelative}, 0, 7, S_FLAMEJETFLAMEB3}, // S_FLAMEJETFLAMEB2 {SPR_DFLM, FF_FULLBRIGHT|FF_TRANS40|FF_ANIMATE, (12*7), {NULL}, 7, 12, S_NULL}, // S_FLAMEJETFLAMEB3 + // RVZ scenery + {SPR_JPLA, FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_BIGFERNLEAF + {SPR_JPLA, 1, 1, {NULL}, 0, 0, S_BIGFERN2}, // S_BIGFERN1 + {SPR_JPLA, 1, -1, {NULL}, 0, 0, S_NULL}, // S_BIGFERN2 + {SPR_JPLA, 2, -1, {NULL}, 0, 0, S_NULL}, // S_JUNGLEPALM + {SPR_TFLO, FF_FULLBRIGHT, -1, {NULL}, 0, 0, S_TORCHFLOWER}, // S_TORCHFLOWER + {SPR_WVIN, FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_WALLVINE_LONG + {SPR_WVIN, 1|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_WALLVINE_SHORT + // Trapgoyles {SPR_GARG, 0, 67, {NULL}, 0, 0, S_TRAPGOYLE_CHECK}, // S_TRAPGOYLE {SPR_GARG, 0, 3, {NULL}, 0, 0, S_TRAPGOYLE_FIRE1}, // S_TRAPGOYLE_CHECK @@ -12563,6 +12575,168 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_BIGFERNLEAF + -1, // doomednum + S_BIGFERNLEAF, // 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 + 0, // speed + 32*FRACUNIT, // radius + 48*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SCENERY|MF_NOBLOCKMAP, // flags + S_NULL // raisestate + }, + + { // MT_BIGFERN + 1307, // doomednum + S_BIGFERN1, // 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 + 0, // speed + 32*FRACUNIT, // radius + 48*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SCENERY|MF_NOBLOCKMAP|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + + { // MT_JUNGLEPALM + 1308, // doomednum + S_JUNGLEPALM, // 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 + 0, // speed + 32*FRACUNIT, // radius + 48*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SCENERY|MF_NOBLOCKMAP, // flags + S_NULL // raisestate + }, + + { // MT_TORCHFLOWER + 1309, // doomednum + S_TORCHFLOWER, // 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 + 0, // speed + 14*FRACUNIT, // radius + 110*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SCENERY|MF_NOBLOCKMAP, // flags + S_NULL // raisestate + }, + + { // MT_WALLVINE_LONG + 1310, // doomednum + S_WALLVINE_LONG, // 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 + 0, // speed + 1*FRACUNIT, // radius + 288*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SCENERY|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP, // flags + S_NULL // raisestate + }, + + { // MT_WALLVINE_SHORT + 1311, // doomednum + S_WALLVINE_SHORT, // 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 + 0, // speed + 1*FRACUNIT, // radius + 288*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SCENERY|MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP, // flags + S_NULL // raisestate + }, + { // MT_TRAPGOYLE 1500, // doomednum S_TRAPGOYLE, // spawnstate diff --git a/src/info.h b/src/info.h index 593c1fb7c..9f7249f19 100644 --- a/src/info.h +++ b/src/info.h @@ -514,6 +514,9 @@ typedef enum sprite // Red Volcano Scenery SPR_FLME, // Flame jet SPR_DFLM, // Blade's flame + SPR_JPLA, // Jungle palm + SPR_TFLO, // Torch flower + SPR_WVIN, // Wall vines // Dark City Scenery @@ -2572,6 +2575,15 @@ typedef enum state S_FLAMEJETFLAMEB2, S_FLAMEJETFLAMEB3, + // RVZ scenery + S_BIGFERNLEAF, + S_BIGFERN1, + S_BIGFERN2, + S_JUNGLEPALM, + S_TORCHFLOWER, + S_WALLVINE_LONG, + S_WALLVINE_SHORT, + // Trapgoyles S_TRAPGOYLE, S_TRAPGOYLE_CHECK, @@ -4309,6 +4321,13 @@ typedef enum mobj_type MT_FLAMEJETFLAMEB, // Blade's flame + MT_BIGFERNLEAF, + MT_BIGFERN, + MT_JUNGLEPALM, + MT_TORCHFLOWER, + MT_WALLVINE_LONG, + MT_WALLVINE_SHORT, + // Dark City Scenery // Egg Rock Scenery diff --git a/src/p_mobj.c b/src/p_mobj.c index 1ee90d250..b42067453 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9800,6 +9800,25 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) P_SetTarget(&mobj->tracer, P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_MINECARTENDSOLID)); mobj->tracer->angle = mobj->angle + ANGLE_90; break; + case MT_BIGFERN: + { + UINT8 i; + for (i = 0; i < 8; i++) + { + UINT8 j = (i + 2) % 8; + fixed_t xoffs = (j % 4) ? FRACUNIT : 0; + fixed_t yoffs = (i % 4) ? FRACUNIT : 0; + mobj_t *leaf = P_SpawnMobjFromMobj(mobj, (j > 3) ? -xoffs : xoffs, (i > 3) ? -yoffs : yoffs, 0, MT_BIGFERNLEAF); + leaf->angle = (angle_t)i * ANGLE_45; + } + break; + } + case MT_TORCHFLOWER: + { + mobj_t *fire = P_SpawnMobjFromMobj(mobj, 0, 0, 46*FRACUNIT, MT_FLAME); + P_SetTarget(&mobj->target, fire); + break; + } default: break; } From 57d28c7814b1346311bfc5216edb8a64a2735f9a Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 25 Aug 2019 20:01:08 +0200 Subject: [PATCH 02/50] Rejig the thing type numbers --- src/info.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/info.c b/src/info.c index 20b09d3cd..86fe138c5 100644 --- a/src/info.c +++ b/src/info.c @@ -12603,7 +12603,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = }, { // MT_BIGFERN - 1307, // doomednum + 1306, // doomednum S_BIGFERN1, // spawnstate 1000, // spawnhealth S_NULL, // seestate @@ -12630,7 +12630,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = }, { // MT_JUNGLEPALM - 1308, // doomednum + 1307, // doomednum S_JUNGLEPALM, // spawnstate 1000, // spawnhealth S_NULL, // seestate @@ -12657,7 +12657,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = }, { // MT_TORCHFLOWER - 1309, // doomednum + 1308, // doomednum S_TORCHFLOWER, // spawnstate 1000, // spawnhealth S_NULL, // seestate @@ -12684,7 +12684,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = }, { // MT_WALLVINE_LONG - 1310, // doomednum + 1309, // doomednum S_WALLVINE_LONG, // spawnstate 1000, // spawnhealth S_NULL, // seestate @@ -12711,7 +12711,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = }, { // MT_WALLVINE_SHORT - 1311, // doomednum + 1310, // doomednum S_WALLVINE_SHORT, // spawnstate 1000, // spawnhealth S_NULL, // seestate From 50e51c137ef085971675087b1c019c6d090aa416 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 25 Aug 2019 23:05:38 +0200 Subject: [PATCH 03/50] Hardcoded the lavafall --- src/dehacked.c | 19 +++++++++ src/hardware/hw_light.c | 1 + src/info.c | 94 +++++++++++++++++++++++++++++++++++++++++ src/info.h | 20 +++++++++ src/p_enemy.c | 69 ++++++++++++++++++++++++++++++ src/p_mobj.c | 33 +++++++++++++++ src/sounds.c | 1 + src/sounds.h | 1 + 8 files changed, 238 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index ae2eb9214..72db4306c 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2431,6 +2431,9 @@ static actionpointer_t actionpointers[] = {{A_SaloonDoorSpawn}, "A_SALOONDOORSPAWN"}, {{A_MinecartSparkThink}, "A_MINECARTSPARKTHINK"}, {{A_ModuloToState}, "A_MODULOTOSTATE"}, + {{A_LavafallRocks}, "A_LAVAFALLROCKS"}, + {{A_LavafallLava}, "A_LAVAFALLLAVA"}, + {{A_FallingLavaCheck}, "A_FALLINGLAVACHECK"}, {{NULL}, "NONE"}, // This NULL entry must be the last in the list @@ -5824,6 +5827,18 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_FLAMEJETFLAMEB2", "S_FLAMEJETFLAMEB3", + // Lavafall + "S_LAVAFALL_DORMANT", + "S_LAVAFALL_TELL", + "S_LAVAFALL_SHOOT", + "S_LAVAFALL_LAVA1", + "S_LAVAFALL_LAVA2", + "S_LAVAFALL_LAVA3", + "S_LAVAFALLROCK1", + "S_LAVAFALLROCK2", + "S_LAVAFALLROCK3", + "S_LAVAFALLROCK4", + // RVZ scenery "S_BIGFERNLEAF", "S_BIGFERN1", @@ -7548,6 +7563,10 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_FLAMEJETFLAMEB", // Blade's flame + "MT_LAVAFALL", + "MT_LAVAFALL_LAVA", + "MT_LAVAFALLROCK", + "MT_BIGFERNLEAF", "MT_BIGFERN", "MT_JUNGLEPALM", diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index e1f2a9699..1e5a01674 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -373,6 +373,7 @@ light_t *t_lspr[NUMSPRITES] = // Red Volcano Scenery &lspr[REDBALL_L], // SPR_FLME &lspr[REDBALL_L], // SPR_DFLM + &lspr[NOLIGHT], // SPR_LFAL &lspr[NOLIGHT], // SPR_JPLA &lspr[NOLIGHT], // SPR_TFLO &lspr[NOLIGHT], // SPR_WVIN diff --git a/src/info.c b/src/info.c index 86fe138c5..88e857716 100644 --- a/src/info.c +++ b/src/info.c @@ -268,6 +268,7 @@ char sprnames[NUMSPRITES + 1][5] = // Red Volcano Scenery "FLME", // Flame jet "DFLM", // Blade's flame + "LFAL", // Lavafall "JPLA", // Jungle palm "TFLO", // Torch flower "WVIN", // Wall vines @@ -2456,6 +2457,18 @@ state_t states[NUMSTATES] = {SPR_DFLM, FF_FULLBRIGHT|FF_TRANS40, 1, {A_MoveRelative}, 0, 7, S_FLAMEJETFLAMEB3}, // S_FLAMEJETFLAMEB2 {SPR_DFLM, FF_FULLBRIGHT|FF_TRANS40|FF_ANIMATE, (12*7), {NULL}, 7, 12, S_NULL}, // S_FLAMEJETFLAMEB3 + // Lavafall + {SPR_LFAL, 5, 1, {NULL}, 0, 0, S_LAVAFALL_DORMANT}, // S_LAVAFALL_DORMANT + {SPR_LFAL, 6|FF_ANIMATE, 4, {A_LavafallRocks}, 2, 2, S_LAVAFALL_TELL}, // S_LAVAFALL_TELL + {SPR_LFAL, 9|FF_FULLBRIGHT|FF_ANIMATE, 2, {A_LavafallLava}, 2, 1, S_LAVAFALL_SHOOT}, // S_LAVAFALL_SHOOT + {SPR_LFAL, FF_FULLBRIGHT, 1, {A_FallingLavaCheck}, 0, 0, S_LAVAFALL_LAVA2}, // S_LAVAFALL_LAVA1 + {SPR_LFAL, FF_FULLBRIGHT, 1, {A_FallingLavaCheck}, 0, 0, S_LAVAFALL_LAVA1}, // S_LAVAFALL_LAVA2 + {SPR_LFAL, 2|FF_FULLBRIGHT|FF_ANIMATE, 9, {NULL}, 3, 3, S_NULL}, // S_LAVAFALL_LAVA3 + {SPR_LFAL, 11, 3, {NULL}, 0, 0, S_LAVAFALLROCK2}, // S_LAVAFALLROCK1 + {SPR_LFAL, 12, 3, {NULL}, 0, 0, S_LAVAFALLROCK3}, // S_LAVAFALLROCK2 + {SPR_LFAL, 13, 3, {NULL}, 0, 0, S_LAVAFALLROCK4}, // S_LAVAFALLROCK3 + {SPR_LFAL, 14, 3, {NULL}, 0, 0, S_LAVAFALLROCK1}, // S_LAVAFALLROCK4 + // RVZ scenery {SPR_JPLA, FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_BIGFERNLEAF {SPR_JPLA, 1, 1, {NULL}, 0, 0, S_BIGFERN2}, // S_BIGFERN1 @@ -12575,6 +12588,87 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_LAVAFALL + 1304, // doomednum + S_LAVAFALL_DORMANT, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_lvfal1, // seesound + 8, // reactiontime + sfx_s3kd5l, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_NULL, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 30*FRACUNIT, // radius + 32*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOGRAVITY|MF_SPAWNCEILING, // flags + S_NULL // raisestate + }, + + { // MT_LAVAFALL_LAVA + -1, // doomednum + S_LAVAFALL_LAVA1, // 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_LAVAFALL_LAVA3, // deathstate + S_NULL, // xdeathstate + sfx_None, // deathsound + 0, // speed + 30*FRACUNIT, // radius + 48*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL|MF_PAIN|MF_NOGRAVITY, // flags + S_NULL // raisestate + }, + + { // MT_LAVAFALLROCK + -1, // doomednum + S_LAVAFALLROCK1, // 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 + 0, // speed + 8*FRACUNIT, // radius + 8*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP, // flags + S_NULL // raisestate + }, + { // MT_BIGFERNLEAF -1, // doomednum S_BIGFERNLEAF, // spawnstate diff --git a/src/info.h b/src/info.h index 9f7249f19..0fe200cbd 100644 --- a/src/info.h +++ b/src/info.h @@ -266,6 +266,9 @@ void A_SnapperThinker(); void A_SaloonDoorSpawn(); void A_MinecartSparkThink(); void A_ModuloToState(); +void A_LavafallRocks(); +void A_LavafallLava(); +void A_FallingLavaCheck(); // ratio of states to sprites to mobj types is roughly 6 : 1 : 1 #define NUMMOBJFREESLOTS 512 @@ -514,6 +517,7 @@ typedef enum sprite // Red Volcano Scenery SPR_FLME, // Flame jet SPR_DFLM, // Blade's flame + SPR_LFAL, // Lavafall SPR_JPLA, // Jungle palm SPR_TFLO, // Torch flower SPR_WVIN, // Wall vines @@ -2575,6 +2579,18 @@ typedef enum state S_FLAMEJETFLAMEB2, S_FLAMEJETFLAMEB3, + // Lavafall + S_LAVAFALL_DORMANT, + S_LAVAFALL_TELL, + S_LAVAFALL_SHOOT, + S_LAVAFALL_LAVA1, + S_LAVAFALL_LAVA2, + S_LAVAFALL_LAVA3, + S_LAVAFALLROCK1, + S_LAVAFALLROCK2, + S_LAVAFALLROCK3, + S_LAVAFALLROCK4, + // RVZ scenery S_BIGFERNLEAF, S_BIGFERN1, @@ -4321,6 +4337,10 @@ typedef enum mobj_type MT_FLAMEJETFLAMEB, // Blade's flame + MT_LAVAFALL, + MT_LAVAFALL_LAVA, + MT_LAVAFALLROCK, + MT_BIGFERNLEAF, MT_BIGFERN, MT_JUNGLEPALM, diff --git a/src/p_enemy.c b/src/p_enemy.c index e3f169784..5b82e45b4 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -296,6 +296,9 @@ void A_SnapperThinker(mobj_t *actor); void A_SaloonDoorSpawn(mobj_t *actor); void A_MinecartSparkThink(mobj_t *actor); void A_ModuloToState(mobj_t *actor); +void A_LavafallRocks(mobj_t *actor); +void A_LavafallLava(mobj_t *actor); +void A_FallingLavaCheck(mobj_t *actor); //for p_enemy.c @@ -13738,3 +13741,69 @@ void A_ModuloToState(mobj_t *actor) P_SetMobjState(actor, (locvar2)); modulothing++; } + +// Function: A_LavafallRocks +// +// Description: Spawn random rock particles. +// +// var1 = unused +// var2 = unused +// +void A_LavafallRocks(mobj_t *actor) +{ +#ifdef HAVE_BLUA + if (LUA_CallAction("A_LavafallRocks", actor)) + return; +#endif + + angle_t fa = (FixedAngle(P_RandomKey(360) << FRACBITS) >> ANGLETOFINESHIFT) & FINEMASK; + fixed_t offset = P_RandomRange(4, 12) << FRACBITS; + fixed_t xoffs = FixedMul(FINECOSINE(fa), actor->radius + offset); + fixed_t yoffs = FixedMul(FINESINE(fa), actor->radius + offset); + mobj_t *particle = P_SpawnMobjFromMobj(actor, xoffs, yoffs, 0, MT_LAVAFALLROCK); + P_SetMobjState(particle, S_LAVAFALLROCK1 + P_RandomRange(0, 3)); +} + +// Function: A_LavafallLava +// +// Description: Spawn lava from lavafall. +// +// var1 = unused +// var2 = unused +// +void A_LavafallLava(mobj_t *actor) +{ +#ifdef HAVE_BLUA + if (LUA_CallAction("A_LavafallLava", actor)) + return; +#endif + + if ((40 - actor->fuse) % (2*(actor->scale >> FRACBITS))) + return; + + mobj_t *lavafall = P_SpawnMobjFromMobj(actor, 0, 0, -8*FRACUNIT, MT_LAVAFALL_LAVA); + lavafall->momz = -25*FRACUNIT; +} + +// Function: A_FallingLavaCheck +// +// Description: If actor hits the ground or a water surface, enter the death animation. +// +// var1 = unused +// var2 = unused +// +void A_FallingLavaCheck(mobj_t *actor) +{ +#ifdef HAVE_BLUA + if (LUA_CallAction("A_FallingLavaCheck", actor)) + return; +#endif + + if (actor->eflags & MFE_TOUCHWATER || P_IsObjectOnGround(actor)) + { + actor->flags = MF_NOGRAVITY|MF_NOCLIPTHING; + actor->momz = 0; + actor->z = actor->watertop; + P_SetMobjState(actor, actor->info->deathstate); + } +} \ No newline at end of file diff --git a/src/p_mobj.c b/src/p_mobj.c index b42067453..13d2d82c0 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9008,6 +9008,10 @@ void P_MobjThinker(mobj_t *mobj) } mobj->flags2 ^= MF2_DONTDRAW; break; + case MT_LAVAFALLROCK: + if (P_IsObjectOnGround(mobj)) + P_RemoveMobj(mobj); + break; case MT_SPINFIRE: if (mobj->flags & MF_NOGRAVITY) { @@ -9223,6 +9227,27 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s case MT_NIGHTSCORE: P_RemoveMobj(mobj); return; + case MT_LAVAFALL: + if (mobj->state - states == S_LAVAFALL_DORMANT) + { + mobj->fuse = 30; + P_SetMobjState(mobj, S_LAVAFALL_TELL); + S_StartSound(mobj, mobj->info->seesound); + } + else if (mobj->state - states == S_LAVAFALL_TELL) + { + mobj->fuse = 40; + P_SetMobjState(mobj, S_LAVAFALL_SHOOT); + S_StopSound(mobj); + S_StartSound(mobj, mobj->info->attacksound); + } + else + { + mobj->fuse = 30; + P_SetMobjState(mobj, S_LAVAFALL_DORMANT); + S_StopSound(mobj); + } + return; case MT_PLAYER: break; // don't remove default: @@ -11831,6 +11856,14 @@ ML_EFFECT5 : Don't stop thinking when too far away if (mthing->angle > 0) mobj->tics += mthing->angle; break; + case MT_LAVAFALL: + mobj->fuse = 30 + mthing->angle; + if (mthing->options & MTF_AMBUSH) + { + P_SetScale(mobj, 2*mobj->scale); + mobj->destscale = mobj->scale; + } + break; default: break; } diff --git a/src/sounds.c b/src/sounds.c index 11ba1e0bc..5a498b358 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -199,6 +199,7 @@ sfxinfo_t S_sfx[NUMSFX] = {"chuchu", false, 32, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Train horn"}, {"bsnipe", false, 200, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Home-run smash"}, {"sprong", false, 112, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Power spring"}, + {"lvfal1", true, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Rumble"}, // Menu, interface {"chchng", false, 120, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Score"}, diff --git a/src/sounds.h b/src/sounds.h index 20f89d9fb..f1221e6fe 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -265,6 +265,7 @@ typedef enum sfx_chuchu, sfx_bsnipe, sfx_sprong, + sfx_lvfal1, // Menu, interface sfx_chchng, From 7ca67a86886ffeaba7adff0060e8f71fb52fb938 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 25 Aug 2019 23:31:12 +0200 Subject: [PATCH 04/50] Added reverse gravity support to lavafalls --- src/p_enemy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 5b82e45b4..4de633b4a 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13782,7 +13782,7 @@ void A_LavafallLava(mobj_t *actor) return; mobj_t *lavafall = P_SpawnMobjFromMobj(actor, 0, 0, -8*FRACUNIT, MT_LAVAFALL_LAVA); - lavafall->momz = -25*FRACUNIT; + lavafall->momz = -P_MobjFlip(actor)*25*FRACUNIT; } // Function: A_FallingLavaCheck From 671da01607e240e2ed4b54f1c2c2e3d0d0dfa000 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 25 Aug 2019 23:43:07 +0200 Subject: [PATCH 05/50] Only spawn lavafall rocks if a player is nearby --- src/p_enemy.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 4de633b4a..85dc15ab2 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13751,17 +13751,28 @@ void A_ModuloToState(mobj_t *actor) // void A_LavafallRocks(mobj_t *actor) { + UINT8 i; + #ifdef HAVE_BLUA if (LUA_CallAction("A_LavafallRocks", actor)) return; #endif - angle_t fa = (FixedAngle(P_RandomKey(360) << FRACBITS) >> ANGLETOFINESHIFT) & FINEMASK; - fixed_t offset = P_RandomRange(4, 12) << FRACBITS; - fixed_t xoffs = FixedMul(FINECOSINE(fa), actor->radius + offset); - fixed_t yoffs = FixedMul(FINESINE(fa), actor->radius + offset); - mobj_t *particle = P_SpawnMobjFromMobj(actor, xoffs, yoffs, 0, MT_LAVAFALLROCK); - P_SetMobjState(particle, S_LAVAFALLROCK1 + P_RandomRange(0, 3)); + // Don't spawn rocks unless a player is relatively close by. + for (i = 0; i < MAXPLAYERS; ++i) + if (playeringame[i] && players[i].mo + && P_AproxDistance(actor->x - players[i].mo->x, actor->y - players[i].mo->y) < (1600 << FRACBITS)) + break; // Stop looking. + + if (i < MAXPLAYERS) + { + angle_t fa = (FixedAngle(P_RandomKey(360) << FRACBITS) >> ANGLETOFINESHIFT) & FINEMASK; + fixed_t offset = P_RandomRange(4, 12) << FRACBITS; + fixed_t xoffs = FixedMul(FINECOSINE(fa), actor->radius + offset); + fixed_t yoffs = FixedMul(FINESINE(fa), actor->radius + offset); + mobj_t *particle = P_SpawnMobjFromMobj(actor, xoffs, yoffs, 0, MT_LAVAFALLROCK); + P_SetMobjState(particle, S_LAVAFALLROCK1 + P_RandomRange(0, 3)); + } } // Function: A_LavafallLava From 2933ec3e9c13d115667f10e78710eca07cb098b5 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Tue, 27 Aug 2019 19:33:54 +0200 Subject: [PATCH 06/50] Simplified the lavafall rock states with FF_RANDOMANIM, fixed Var1 for the FF_ANIMATE states --- src/dehacked.c | 5 +---- src/info.c | 13 +++++-------- src/info.h | 5 +---- src/p_enemy.c | 3 +-- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 72db4306c..7878f876f 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5834,10 +5834,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_LAVAFALL_LAVA1", "S_LAVAFALL_LAVA2", "S_LAVAFALL_LAVA3", - "S_LAVAFALLROCK1", - "S_LAVAFALLROCK2", - "S_LAVAFALLROCK3", - "S_LAVAFALLROCK4", + "S_LAVAFALLROCK", // RVZ scenery "S_BIGFERNLEAF", diff --git a/src/info.c b/src/info.c index 88e857716..a41547c5d 100644 --- a/src/info.c +++ b/src/info.c @@ -2459,15 +2459,12 @@ state_t states[NUMSTATES] = // Lavafall {SPR_LFAL, 5, 1, {NULL}, 0, 0, S_LAVAFALL_DORMANT}, // S_LAVAFALL_DORMANT - {SPR_LFAL, 6|FF_ANIMATE, 4, {A_LavafallRocks}, 2, 2, S_LAVAFALL_TELL}, // S_LAVAFALL_TELL - {SPR_LFAL, 9|FF_FULLBRIGHT|FF_ANIMATE, 2, {A_LavafallLava}, 2, 1, S_LAVAFALL_SHOOT}, // S_LAVAFALL_SHOOT + {SPR_LFAL, 6|FF_ANIMATE, 4, {A_LavafallRocks}, 1, 2, S_LAVAFALL_TELL}, // S_LAVAFALL_TELL + {SPR_LFAL, 9|FF_FULLBRIGHT|FF_ANIMATE, 2, {A_LavafallLava}, 1, 1, S_LAVAFALL_SHOOT}, // S_LAVAFALL_SHOOT {SPR_LFAL, FF_FULLBRIGHT, 1, {A_FallingLavaCheck}, 0, 0, S_LAVAFALL_LAVA2}, // S_LAVAFALL_LAVA1 {SPR_LFAL, FF_FULLBRIGHT, 1, {A_FallingLavaCheck}, 0, 0, S_LAVAFALL_LAVA1}, // S_LAVAFALL_LAVA2 - {SPR_LFAL, 2|FF_FULLBRIGHT|FF_ANIMATE, 9, {NULL}, 3, 3, S_NULL}, // S_LAVAFALL_LAVA3 - {SPR_LFAL, 11, 3, {NULL}, 0, 0, S_LAVAFALLROCK2}, // S_LAVAFALLROCK1 - {SPR_LFAL, 12, 3, {NULL}, 0, 0, S_LAVAFALLROCK3}, // S_LAVAFALLROCK2 - {SPR_LFAL, 13, 3, {NULL}, 0, 0, S_LAVAFALLROCK4}, // S_LAVAFALLROCK3 - {SPR_LFAL, 14, 3, {NULL}, 0, 0, S_LAVAFALLROCK1}, // S_LAVAFALLROCK4 + {SPR_LFAL, 2|FF_FULLBRIGHT|FF_ANIMATE, 9, {NULL}, 2, 3, S_NULL}, // S_LAVAFALL_LAVA3 + {SPR_LFAL, 11|FF_ANIMATE|FF_RANDOMANIM, 12, {NULL}, 3, 3, S_LAVAFALLROCK}, // S_LAVAFALLROCK // RVZ scenery {SPR_JPLA, FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_BIGFERNLEAF @@ -12644,7 +12641,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = { // MT_LAVAFALLROCK -1, // doomednum - S_LAVAFALLROCK1, // spawnstate + S_LAVAFALLROCK, // spawnstate 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound diff --git a/src/info.h b/src/info.h index 0fe200cbd..1a2bb838e 100644 --- a/src/info.h +++ b/src/info.h @@ -2586,10 +2586,7 @@ typedef enum state S_LAVAFALL_LAVA1, S_LAVAFALL_LAVA2, S_LAVAFALL_LAVA3, - S_LAVAFALLROCK1, - S_LAVAFALLROCK2, - S_LAVAFALLROCK3, - S_LAVAFALLROCK4, + S_LAVAFALLROCK, // RVZ scenery S_BIGFERNLEAF, diff --git a/src/p_enemy.c b/src/p_enemy.c index 85dc15ab2..a22e727b7 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13770,8 +13770,7 @@ void A_LavafallRocks(mobj_t *actor) fixed_t offset = P_RandomRange(4, 12) << FRACBITS; fixed_t xoffs = FixedMul(FINECOSINE(fa), actor->radius + offset); fixed_t yoffs = FixedMul(FINESINE(fa), actor->radius + offset); - mobj_t *particle = P_SpawnMobjFromMobj(actor, xoffs, yoffs, 0, MT_LAVAFALLROCK); - P_SetMobjState(particle, S_LAVAFALLROCK1 + P_RandomRange(0, 3)); + P_SpawnMobjFromMobj(actor, xoffs, yoffs, 0, MT_LAVAFALLROCK); } } From 806b106905626a0106bf83ed1d86f2605e010d7d Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Fri, 30 Aug 2019 08:17:25 +0200 Subject: [PATCH 07/50] Hardcoded the Pyre Fly --- src/dehacked.c | 8 ++++ src/hardware/hw_light.c | 1 + src/info.c | 60 +++++++++++++++++++++++++ src/info.h | 9 ++++ src/p_enemy.c | 22 +++++++++ src/p_mobj.c | 98 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 198 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index 7878f876f..1664c6cb2 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2434,6 +2434,7 @@ static actionpointer_t actionpointers[] = {{A_LavafallRocks}, "A_LAVAFALLROCKS"}, {{A_LavafallLava}, "A_LAVAFALLLAVA"}, {{A_FallingLavaCheck}, "A_FALLINGLAVACHECK"}, + {{A_FireShrink}, "A_FIRESHRINK"}, {{NULL}, "NONE"}, // This NULL entry must be the last in the list @@ -4576,6 +4577,11 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_CANARIVOREGAS_7", "S_CANARIVOREGAS_8", + // Pyre Fly + "S_PYREFLY_FLY", + "S_PYREFIRE1", + "S_PYREFIRE2", + // Boss Explosion "S_BOSSEXPLODE", @@ -7224,6 +7230,8 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_UNIBALL", // Unidus Ball "MT_CANARIVORE", // Canarivore "MT_CANARIVORE_GAS", // Canarivore gas + "MT_PYREFLY", // Pyre Fly + "MT_PYREFLY_FIRE", // Pyre Fly fire // Generic Boss Items "MT_BOSSEXPLODE", diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 1e5a01674..57dfc57ab 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -180,6 +180,7 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_UNID &lspr[NOLIGHT], // SPR_CANA &lspr[NOLIGHT], // SPR_CANG + &lspr[NOLIGHT], // SPR_PYRE // Generic Boos Items &lspr[JETLIGHT_L], // SPR_JETF // Boss jet fumes diff --git a/src/info.c b/src/info.c index a41547c5d..b82c64e52 100644 --- a/src/info.c +++ b/src/info.c @@ -68,6 +68,7 @@ char sprnames[NUMSPRITES + 1][5] = "UNID", // Unidus "CANA", // Canarivore "CANG", // Canarivore gas + "PYRE", // Pyre Fly // Generic Boss Items "JETF", // Boss jet fumes @@ -1172,6 +1173,11 @@ state_t states[NUMSTATES] = {SPR_CANG, 0|FF_TRANS80, 10, {NULL}, 0, 0, S_CANARIVOREGAS_8}, // S_CANARIVOREGAS_7 {SPR_CANG, 0|FF_TRANS90, 10, {NULL}, 0, 0, S_NULL}, // S_CANARIVOREGAS_8 + // Pyre Fly + {SPR_PYRE, FF_ANIMATE, 8, {NULL}, 4, 2, S_PYREFLY_FLY}, // S_PYREFLY_FLY + {SPR_FLAM, FF_FULLBRIGHT, 10, {NULL}, 0, 0, S_PYREFIRE2}, // S_PYREFIRE1 + {SPR_FLAM, 1|FF_FULLBRIGHT, 10, {A_FireShrink}, 0, 16, S_NULL}, // S_PYREFIRE2 + // Boss Explosion {SPR_BOM2, FF_FULLBRIGHT|FF_ANIMATE, (5*7), {NULL}, 6, 5, S_NULL}, // S_BOSSEXPLODE @@ -5004,6 +5010,60 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_PYREFLY + 136, // doomednum + S_PYREFLY_FLY, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_None, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_XPLD_FLICKY, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 1, // speed + 24*FRACUNIT, // radius + 34*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOGRAVITY|MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY|MF_SLIDEME, // flags + S_NULL // raisestate + }, + + { // MT_PYREFLY_FIRE + -1, // doomednum + S_PYREFIRE1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // 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 + 0, // speed + 24*FRACUNIT, // radius + 34*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOGRAVITY|MF_NOBLOCKMAP|MF_FIRE|MF_PAIN, // flags + S_NULL // raisestate + }, + { // MT_BOSSEXPLODE -1, // doomednum S_BOSSEXPLODE, // spawnstate diff --git a/src/info.h b/src/info.h index 1a2bb838e..8d2023c3d 100644 --- a/src/info.h +++ b/src/info.h @@ -269,6 +269,7 @@ void A_ModuloToState(); void A_LavafallRocks(); void A_LavafallLava(); void A_FallingLavaCheck(); +void A_FireShrink(); // ratio of states to sprites to mobj types is roughly 6 : 1 : 1 #define NUMMOBJFREESLOTS 512 @@ -317,6 +318,7 @@ typedef enum sprite SPR_UNID, // Unidus SPR_CANA, // Canarivore SPR_CANG, // Canarivore gas + SPR_PYRE, // Pyre Fly // Generic Boss Items SPR_JETF, // Boss jet fumes @@ -1328,6 +1330,11 @@ typedef enum state S_CANARIVOREGAS_7, S_CANARIVOREGAS_8, + // Pyre Fly + S_PYREFLY_FLY, + S_PYREFIRE1, + S_PYREFIRE2, + // Boss Explosion S_BOSSEXPLODE, @@ -3998,6 +4005,8 @@ typedef enum mobj_type MT_UNIBALL, // Unidus Ball MT_CANARIVORE, // Canarivore MT_CANARIVORE_GAS, // Canarivore gas + MT_PYREFLY, // Pyre Fly + MT_PYREFLY_FIRE, // Pyre Fly fire // Generic Boss Items MT_BOSSEXPLODE, diff --git a/src/p_enemy.c b/src/p_enemy.c index a22e727b7..e37eea19d 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -299,6 +299,7 @@ void A_ModuloToState(mobj_t *actor); void A_LavafallRocks(mobj_t *actor); void A_LavafallLava(mobj_t *actor); void A_FallingLavaCheck(mobj_t *actor); +void A_FireShrink(mobj_t *actor); //for p_enemy.c @@ -13816,4 +13817,25 @@ void A_FallingLavaCheck(mobj_t *actor) actor->z = actor->watertop; P_SetMobjState(actor, actor->info->deathstate); } +} + +// Function: A_FireShrink +// +// Description: Shrink the actor down to the specified scale at the specified speed. +// +// var1 = Scale to shrink to +// var2 = Shrinking speed +// +void A_FireShrink(mobj_t *actor) +{ + INT32 locvar1 = var1; + INT32 locvar2 = var2; + +#ifdef HAVE_BLUA + if (LUA_CallAction("A_FireShrink", actor)) + return; +#endif + + actor->destscale = locvar1; + actor->scalespeed = FRACUNIT/locvar2; } \ No newline at end of file diff --git a/src/p_mobj.c b/src/p_mobj.c index 13d2d82c0..6b36020f0 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -6986,6 +6986,16 @@ void P_HandleMinecartSegments(mobj_t *mobj) P_UpdateMinecartSegments(mobj); } +static void P_PyreFlyBurn(mobj_t *mobj, fixed_t hoffs, INT16 vrange, mobjtype_t mobjtype, fixed_t momz) +{ + angle_t fa = (FixedAngle(P_RandomKey(360)*FRACUNIT) >> ANGLETOFINESHIFT) & FINEMASK; + fixed_t xoffs = FixedMul(FINECOSINE(fa), mobj->radius + hoffs); + fixed_t yoffs = FixedMul(FINESINE(fa), mobj->radius + hoffs); + fixed_t zoffs = P_RandomRange(-vrange, vrange)*FRACUNIT; + mobj_t *particle = P_SpawnMobjFromMobj(mobj, xoffs, yoffs, zoffs, mobjtype); + particle->momz = momz; +} + // // P_MobjThinker // @@ -9012,6 +9022,60 @@ void P_MobjThinker(mobj_t *mobj) if (P_IsObjectOnGround(mobj)) P_RemoveMobj(mobj); break; + case MT_PYREFLY: + { + fixed_t hdist; + + mobj->extravalue1 = (mobj->extravalue1 + 3) % 360; + mobj->z += FINESINE(((mobj->extravalue1*ANG1) >> ANGLETOFINESHIFT) & FINEMASK); + + if (mobj->extravalue2 == 1) + P_PyreFlyBurn(mobj, 0, 20, MT_SMOKE, 4*FRACUNIT); + else if (mobj->extravalue2 == 2) + { + INT32 fireradius = min(100 - mobj->fuse, 52); + mobj->frame |= FF_FULLBRIGHT; + P_PyreFlyBurn(mobj, P_RandomRange(0, fireradius)*FRACUNIT, 20, MT_FLAMEPARTICLE, 4*FRACUNIT); + P_PyreFlyBurn(mobj, fireradius*FRACUNIT, 40, MT_PYREFLY_FIRE, 0); + } + + if (!(mobj->flags2 & MF2_AMBUSH)) + P_LookForPlayers(mobj, true, false, 1500*FRACUNIT); + + if (!mobj->target) + break; + + hdist = R_PointToDist2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); + + if (!(mobj->flags2 & MF2_AMBUSH) && hdist <= 450*FRACUNIT) + mobj->flags2 |= MF2_AMBUSH; + + if (!(mobj->flags2 & MF2_AMBUSH)) + break; + + if (hdist < 1000*FRACUNIT) + { + fixed_t dist = P_AproxDistance(hdist, mobj->target->z - mobj->z); + P_InstaThrust(mobj, R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y), 2*FRACUNIT); + //aim for player z position; if too close to floor, aim just above them + if (mobj->z - mobj->floorz >= 80*FRACUNIT) + mobj->momz = FixedMul(FixedDiv(mobj->target->z - mobj->z, dist), 2*FRACUNIT); + else + mobj->momz = FixedMul(FixedDiv((mobj->target->z + 70*FRACUNIT) - mobj->z, dist), 2*FRACUNIT); + } + else + { + mobj->momx = 0; + mobj->momy = 0; + mobj->momz = 0; + if (hdist >= 1500*FRACUNIT) + { + mobj->flags2 &= ~MF2_AMBUSH; + P_SetTarget(&mobj->target, NULL); + } + } + break; + } case MT_SPINFIRE: if (mobj->flags & MF_NOGRAVITY) { @@ -9248,6 +9312,26 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s S_StopSound(mobj); } return; + case MT_PYREFLY: + mobj->extravalue2 = (mobj->extravalue2 + 1) % 3; + if (mobj->extravalue2 == 0) + { + mobj->fuse = 100; + S_StopSound(mobj); + S_StartSound(mobj, sfx_s3k8c); + } + else if (mobj->extravalue2 == 1) + { + mobj->fuse = 50; + S_StartSound(mobj, sfx_s3ka3); + } + else + { + mobj->fuse = 100; + S_StopSound(mobj); + S_StartSound(mobj, sfx_s3kc2l); + } + return; case MT_PLAYER: break; // don't remove default: @@ -9844,6 +9928,11 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) P_SetTarget(&mobj->target, fire); break; } + case MT_PYREFLY: + mobj->extravalue1 = (FixedHypot(mobj->x, mobj->y)/FRACUNIT) % 360; + mobj->extravalue2 = 0; + mobj->fuse = 100; + break; default: break; } @@ -11864,6 +11953,15 @@ ML_EFFECT5 : Don't stop thinking when too far away mobj->destscale = mobj->scale; } break; + case MT_PYREFLY: + //start on fire if Ambush flag is set, otherwise behave normally + if (mthing->options & MTF_AMBUSH) + { + mobj->extravalue2 = 2; + S_StartSound(mobj, sfx_s3kd3l); + mthing->options &= ~MTF_AMBUSH; //Prevent MF2_AMBUSH from being set, since we use it for chasing + } + break; default: break; } From 4cece9fe36d4da3e02f4471f234f045ea8e5e077 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Fri, 30 Aug 2019 08:55:29 +0200 Subject: [PATCH 08/50] Pyre Fly: Don't run the fuse code when dead --- src/p_mobj.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index 6b36020f0..a28c0a0f5 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9313,6 +9313,9 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s } return; case MT_PYREFLY: + if (mobj->health <= 0) + break; + mobj->extravalue2 = (mobj->extravalue2 + 1) % 3; if (mobj->extravalue2 == 0) { From 8ddcced6f0943758c9318fafe96472e93e120e6e Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Fri, 30 Aug 2019 09:05:49 +0200 Subject: [PATCH 09/50] Pyre Fly: Don't spawn smoke and flames if no player is in range --- src/p_mobj.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index a28c0a0f5..4fb441b15 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9029,6 +9029,12 @@ void P_MobjThinker(mobj_t *mobj) mobj->extravalue1 = (mobj->extravalue1 + 3) % 360; mobj->z += FINESINE(((mobj->extravalue1*ANG1) >> ANGLETOFINESHIFT) & FINEMASK); + if (!(mobj->flags2 & MF2_AMBUSH)) + P_LookForPlayers(mobj, true, false, 1500*FRACUNIT); + + if (!mobj->target) + break; + if (mobj->extravalue2 == 1) P_PyreFlyBurn(mobj, 0, 20, MT_SMOKE, 4*FRACUNIT); else if (mobj->extravalue2 == 2) @@ -9039,12 +9045,6 @@ void P_MobjThinker(mobj_t *mobj) P_PyreFlyBurn(mobj, fireradius*FRACUNIT, 40, MT_PYREFLY_FIRE, 0); } - if (!(mobj->flags2 & MF2_AMBUSH)) - P_LookForPlayers(mobj, true, false, 1500*FRACUNIT); - - if (!mobj->target) - break; - hdist = R_PointToDist2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); if (!(mobj->flags2 & MF2_AMBUSH) && hdist <= 450*FRACUNIT) From a5ae8abdb22434e327e8e085f05d0017bb851c8d Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 31 Aug 2019 12:53:55 +0200 Subject: [PATCH 10/50] Pyre Fly: Use MF2_BOSSNOTRAP instead of MF2_AMBUSH --- src/p_mobj.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 4fb441b15..bb86df067 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9029,7 +9029,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->extravalue1 = (mobj->extravalue1 + 3) % 360; mobj->z += FINESINE(((mobj->extravalue1*ANG1) >> ANGLETOFINESHIFT) & FINEMASK); - if (!(mobj->flags2 & MF2_AMBUSH)) + if (!(mobj->flags2 & MF2_BOSSNOTRAP)) P_LookForPlayers(mobj, true, false, 1500*FRACUNIT); if (!mobj->target) @@ -9047,10 +9047,10 @@ void P_MobjThinker(mobj_t *mobj) hdist = R_PointToDist2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); - if (!(mobj->flags2 & MF2_AMBUSH) && hdist <= 450*FRACUNIT) - mobj->flags2 |= MF2_AMBUSH; + if (!(mobj->flags2 & MF2_BOSSNOTRAP) && hdist <= 450*FRACUNIT) + mobj->flags2 |= MF2_BOSSNOTRAP; - if (!(mobj->flags2 & MF2_AMBUSH)) + if (!(mobj->flags2 & MF2_BOSSNOTRAP)) break; if (hdist < 1000*FRACUNIT) @@ -9070,7 +9070,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->momz = 0; if (hdist >= 1500*FRACUNIT) { - mobj->flags2 &= ~MF2_AMBUSH; + mobj->flags2 &= ~MF2_BOSSNOTRAP; P_SetTarget(&mobj->target, NULL); } } @@ -11962,7 +11962,6 @@ ML_EFFECT5 : Don't stop thinking when too far away { mobj->extravalue2 = 2; S_StartSound(mobj, sfx_s3kd3l); - mthing->options &= ~MTF_AMBUSH; //Prevent MF2_AMBUSH from being set, since we use it for chasing } break; default: From 598047ae8b97f525728878ff9e4ece85ed7311a4 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 29 Sep 2019 10:39:09 +0200 Subject: [PATCH 11/50] Hardcoded the Pterabyte (without the grabbing mechanic) --- src/dehacked.c | 15 +++++++ src/hardware/hw_light.c | 1 + src/info.c | 92 +++++++++++++++++++++++++++++++++++++++++ src/info.h | 16 +++++++ src/p_enemy.c | 76 +++++++++++++++++++++++++++++++++- src/p_mobj.c | 70 +++++++++++++++++++++++++++++++ src/sounds.c | 1 + src/sounds.h | 1 + 8 files changed, 271 insertions(+), 1 deletion(-) diff --git a/src/dehacked.c b/src/dehacked.c index 1664c6cb2..b2a0239c6 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2435,6 +2435,8 @@ static actionpointer_t actionpointers[] = {{A_LavafallLava}, "A_LAVAFALLLAVA"}, {{A_FallingLavaCheck}, "A_FALLINGLAVACHECK"}, {{A_FireShrink}, "A_FIRESHRINK"}, + {{A_SpawnPterabytes}, "A_SPAWNPTERABYTES"}, + {{A_PterabyteHover}, "A_PTERABYTEHOVER"}, {{NULL}, "NONE"}, // This NULL entry must be the last in the list @@ -4582,6 +4584,16 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_PYREFIRE1", "S_PYREFIRE2", + // Pterabyte + "S_PTERABYTESPAWNER", + "S_PTERABYTEWAYPOINT", + "S_PTERABYTE_FLY1", + "S_PTERABYTE_FLY2", + "S_PTERABYTE_FLY3", + "S_PTERABYTE_FLY4", + "S_PTERABYTE_SWOOPDOWN", + "S_PTERABYTE_SWOOPUP", + // Boss Explosion "S_BOSSEXPLODE", @@ -7232,6 +7244,9 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_CANARIVORE_GAS", // Canarivore gas "MT_PYREFLY", // Pyre Fly "MT_PYREFLY_FIRE", // Pyre Fly fire + "MT_PTERABYTESPAWNER", // Pterabyte spawner + "MT_PTERABYTEWAYPOINT", // Pterabyte waypoint + "MT_PTERABYTE", // Pterabyte // Generic Boss Items "MT_BOSSEXPLODE", diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 57dfc57ab..f3b2b4f87 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -181,6 +181,7 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_CANA &lspr[NOLIGHT], // SPR_CANG &lspr[NOLIGHT], // SPR_PYRE + &lspr[NOLIGHT], // SPR_PTER // Generic Boos Items &lspr[JETLIGHT_L], // SPR_JETF // Boss jet fumes diff --git a/src/info.c b/src/info.c index b82c64e52..6800ba4be 100644 --- a/src/info.c +++ b/src/info.c @@ -69,6 +69,7 @@ char sprnames[NUMSPRITES + 1][5] = "CANA", // Canarivore "CANG", // Canarivore gas "PYRE", // Pyre Fly + "PTER", // Pterabyte // Generic Boss Items "JETF", // Boss jet fumes @@ -1178,6 +1179,16 @@ state_t states[NUMSTATES] = {SPR_FLAM, FF_FULLBRIGHT, 10, {NULL}, 0, 0, S_PYREFIRE2}, // S_PYREFIRE1 {SPR_FLAM, 1|FF_FULLBRIGHT, 10, {A_FireShrink}, 0, 16, S_NULL}, // S_PYREFIRE2 + // Pterabyte + {SPR_NULL, 0, -1, {A_SpawnPterabytes}, 0, 0, S_PTERABYTESPAWNER}, // S_PTERABYTESPAWNER + {SPR_NULL, 0, 1, {A_PterabyteHover}, 0, 0, S_PTERABYTEWAYPOINT}, // S_PTERABYTEWAYPOINT + {SPR_PTER, 0, 6, {NULL}, 0, 0, S_PTERABYTE_FLY2}, // S_PTERABYTE_FLY1 + {SPR_PTER, 1, 2, {NULL}, 0, 0, S_PTERABYTE_FLY3}, // S_PTERABYTE_FLY2 + {SPR_PTER, 2, 6, {NULL}, 0, 0, S_PTERABYTE_FLY4}, // S_PTERABYTE_FLY3 + {SPR_PTER, 3, 2, {NULL}, 0, 0, S_PTERABYTE_FLY1}, // S_PTERABYTE_FLY4 + {SPR_PTER, 4, 1, {NULL}, 0, 0, S_PTERABYTE_SWOOPDOWN}, // S_PTERABYTE_SWOOPDOWN + {SPR_PTER, 0, 1, {NULL}, 0, 0, S_PTERABYTE_SWOOPUP}, // S_PTERABYTE_SWOOPUP + // Boss Explosion {SPR_BOM2, FF_FULLBRIGHT|FF_ANIMATE, (5*7), {NULL}, 6, 5, S_NULL}, // S_BOSSEXPLODE @@ -5064,6 +5075,87 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_PTERABYTESPAWNER + 135, // doomednum + S_PTERABYTESPAWNER, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // 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 + 0, // speed + 16*FRACUNIT, // radius + 16*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOGRAVITY|MF_NOCLIPTHING|MF_NOBLOCKMAP|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + + { // MT_PTERABYTEWAYPOINT + -1, // doomednum + S_PTERABYTEWAYPOINT, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // 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 + 4*FRACUNIT, // speed + 24*FRACUNIT, // radius + 48*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOGRAVITY|MF_NOCLIPTHING|MF_NOBLOCKMAP|MF_RUNSPAWNFUNC, // flags + S_NULL // raisestate + }, + + { // MT_PTERABYTE + -1, // doomednum + S_PTERABYTE_FLY1, // spawnstate + 1, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // reactiontime + sfx_pscree, // attacksound + S_NULL, // painstate + 0, // painchance + sfx_None, // painsound + S_NULL, // meleestate + S_NULL, // missilestate + S_XPLD_FLICKY, // deathstate + S_NULL, // xdeathstate + sfx_pop, // deathsound + 4*FRACUNIT, // speed + 24*FRACUNIT, // radius + 48*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_SPECIAL|MF_SHOOTABLE|MF_ENEMY|MF_NOGRAVITY|MF_SLIDEME, // flags + S_NULL // raisestate + }, + { // MT_BOSSEXPLODE -1, // doomednum S_BOSSEXPLODE, // spawnstate diff --git a/src/info.h b/src/info.h index 8d2023c3d..98a5db4ca 100644 --- a/src/info.h +++ b/src/info.h @@ -270,6 +270,8 @@ void A_LavafallRocks(); void A_LavafallLava(); void A_FallingLavaCheck(); void A_FireShrink(); +void A_SpawnPterabytes(); +void A_PterabyteHover(); // ratio of states to sprites to mobj types is roughly 6 : 1 : 1 #define NUMMOBJFREESLOTS 512 @@ -319,6 +321,7 @@ typedef enum sprite SPR_CANA, // Canarivore SPR_CANG, // Canarivore gas SPR_PYRE, // Pyre Fly + SPR_PTER, // Pterabyte // Generic Boss Items SPR_JETF, // Boss jet fumes @@ -1335,6 +1338,16 @@ typedef enum state S_PYREFIRE1, S_PYREFIRE2, + // Pterabyte + S_PTERABYTESPAWNER, + S_PTERABYTEWAYPOINT, + S_PTERABYTE_FLY1, + S_PTERABYTE_FLY2, + S_PTERABYTE_FLY3, + S_PTERABYTE_FLY4, + S_PTERABYTE_SWOOPDOWN, + S_PTERABYTE_SWOOPUP, + // Boss Explosion S_BOSSEXPLODE, @@ -4007,6 +4020,9 @@ typedef enum mobj_type MT_CANARIVORE_GAS, // Canarivore gas MT_PYREFLY, // Pyre Fly MT_PYREFLY_FIRE, // Pyre Fly fire + MT_PTERABYTESPAWNER, // Pterabyte spawner + MT_PTERABYTEWAYPOINT, // Pterabyte waypoint + MT_PTERABYTE, // Pterabyte // Generic Boss Items MT_BOSSEXPLODE, diff --git a/src/p_enemy.c b/src/p_enemy.c index e37eea19d..894bd3090 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -300,6 +300,8 @@ void A_LavafallRocks(mobj_t *actor); void A_LavafallLava(mobj_t *actor); void A_FallingLavaCheck(mobj_t *actor); void A_FireShrink(mobj_t *actor); +void A_SpawnPterabytes(mobj_t *actor); +void A_PterabyteHover(mobj_t *actor); //for p_enemy.c @@ -13784,6 +13786,8 @@ void A_LavafallRocks(mobj_t *actor) // void A_LavafallLava(mobj_t *actor) { + mobj_t *lavafall; + #ifdef HAVE_BLUA if (LUA_CallAction("A_LavafallLava", actor)) return; @@ -13792,7 +13796,7 @@ void A_LavafallLava(mobj_t *actor) if ((40 - actor->fuse) % (2*(actor->scale >> FRACBITS))) return; - mobj_t *lavafall = P_SpawnMobjFromMobj(actor, 0, 0, -8*FRACUNIT, MT_LAVAFALL_LAVA); + lavafall = P_SpawnMobjFromMobj(actor, 0, 0, -8*FRACUNIT, MT_LAVAFALL_LAVA); lavafall->momz = -P_MobjFlip(actor)*25*FRACUNIT; } @@ -13838,4 +13842,74 @@ void A_FireShrink(mobj_t *actor) actor->destscale = locvar1; actor->scalespeed = FRACUNIT/locvar2; +} + +// Function: A_SpawnPterabytes +// +// Description: Spawn Pterabytes around the actor in a circle. +// +// var1 = unused +// var2 = unused +// +void A_SpawnPterabytes(mobj_t *actor) +{ + mobj_t *waypoint, *ptera; + fixed_t c, s; + fixed_t rad = 280*FRACUNIT; + angle_t ang = 0; + angle_t interval, fa; + UINT8 amount = 1; + UINT8 i; + +#ifdef HAVE_BLUA + if (LUA_CallAction("A_SpawnPterabytes", actor)) + return; +#endif + + if (actor->spawnpoint) + { + amount = actor->spawnpoint->extrainfo + 1; + if (actor->spawnpoint->angle) + rad = actor->spawnpoint->angle*FRACUNIT; + } + + interval = FixedAngle(FRACUNIT*360/amount); + + for (i = 0; i < amount; i++) + { + fa = (ang >> ANGLETOFINESHIFT) & FINEMASK; + c = FINECOSINE(fa); + s = FINESINE(fa); + waypoint = P_SpawnMobjFromMobj(actor, FixedMul(c, rad), FixedMul(s, rad), 0, MT_PTERABYTEWAYPOINT); + waypoint->angle = ang + ANGLE_90; + ptera = P_SpawnMobjFromMobj(waypoint, 0, 0, 0, MT_PTERABYTE); + ptera->angle = waypoint->angle; + P_SetTarget(&ptera->tracer, waypoint); + ptera->extravalue1 = 0; + ang += interval; + } +} + +// Function: A_PterabyteHover +// +// Description: Hover in a circular fashion, bobbing up and down slightly. +// +// var1 = unused +// var2 = unused +// +void A_PterabyteHover(mobj_t *actor) +{ + angle_t ang, fa; + +#ifdef HAVE_BLUA + if (LUA_CallAction("A_PterabyteHover", actor)) + return; +#endif + + P_InstaThrust(actor, actor->angle, actor->info->speed); + actor->angle += ANG1; + actor->extravalue1 = (actor->extravalue1 + 3) % 360; + ang = actor->extravalue1*ANG1; + fa = (ang >> ANGLETOFINESHIFT) & FINEMASK; + actor->z += FINESINE(fa); } \ No newline at end of file diff --git a/src/p_mobj.c b/src/p_mobj.c index bb86df067..4258ac402 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9076,6 +9076,76 @@ void P_MobjThinker(mobj_t *mobj) } break; } + case MT_PTERABYTE: + { + if (mobj->extravalue1 == 0) // Hovering + { + fixed_t vdist, hdist, time; + fixed_t hspeed = 3*mobj->info->speed; + angle_t fa; + + var1 = 1; + var2 = 0; + A_CapeChase(mobj); + P_LookForPlayers(mobj, true, false, 256*FRACUNIT); + + if (!mobj->target) + break; + + vdist = mobj->z - mobj->target->z; + if (vdist <= 0) + break; + + hdist = R_PointToDist2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); + if (hdist > 450*FRACUNIT) + break; + + P_SetMobjState(mobj, S_PTERABYTE_SWOOPDOWN); + mobj->extravalue1 = 1; + S_StartSound(mobj, mobj->info->attacksound); + time = FixedDiv(hdist, hspeed); + mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); + fa = (mobj->angle >> ANGLETOFINESHIFT) & FINEMASK; + mobj->momx = FixedMul(FINECOSINE(fa), hspeed); + mobj->momy = FixedMul(FINESINE(fa), hspeed); + mobj->momz = -2*FixedDiv(vdist, time); + mobj->extravalue2 = -FixedDiv(mobj->momz, time); //Z accel + mobj->movecount = time >> FRACBITS; + mobj->reactiontime = mobj->movecount; + } + else if (mobj->extravalue1 == 1) // Swooping + { + mobj->reactiontime--; + mobj->momz += mobj->extravalue2; + if (mobj->reactiontime) + break; + + if (mobj->state - states == S_PTERABYTE_SWOOPDOWN) + { + P_SetMobjState(mobj, S_PTERABYTE_SWOOPUP); + mobj->reactiontime = mobj->movecount; + } + else if (mobj->state - states == S_PTERABYTE_SWOOPUP) + { + P_SetMobjState(mobj, S_PTERABYTE_FLY1); + mobj->extravalue1 = 2; + P_SetTarget(&mobj->target, NULL); + mobj->momx = mobj->momy = mobj->momz = 0; + } + } + else // Returning + { + var1 = 2*mobj->info->speed; + var2 = 1; + A_HomingChase(mobj); + if (P_AproxDistance(mobj->x - mobj->tracer->x, mobj->y - mobj->tracer->y) <= mobj->info->speed) + { + mobj->extravalue1 = 0; + mobj->momx = mobj->momy = mobj->momz = 0; + } + } + break; + } case MT_SPINFIRE: if (mobj->flags & MF_NOGRAVITY) { diff --git a/src/sounds.c b/src/sounds.c index 5a498b358..c2b9a09d7 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -200,6 +200,7 @@ sfxinfo_t S_sfx[NUMSFX] = {"bsnipe", false, 200, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Home-run smash"}, {"sprong", false, 112, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Power spring"}, {"lvfal1", true, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Rumble"}, + {"pscree", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "SCREE!"}, // Menu, interface {"chchng", false, 120, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Score"}, diff --git a/src/sounds.h b/src/sounds.h index f1221e6fe..be6969e56 100644 --- a/src/sounds.h +++ b/src/sounds.h @@ -266,6 +266,7 @@ typedef enum sfx_bsnipe, sfx_sprong, sfx_lvfal1, + sfx_pscree, // Menu, interface sfx_chchng, From 22e3c37e5dea8681b9213af3aea1c82a1bcca71f Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 29 Sep 2019 11:58:33 +0200 Subject: [PATCH 12/50] Don't make the Pterabyte radius adjustable (doesn't work correctly right now) --- src/p_enemy.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 894bd3090..db76ab4f4 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13867,11 +13867,7 @@ void A_SpawnPterabytes(mobj_t *actor) #endif if (actor->spawnpoint) - { amount = actor->spawnpoint->extrainfo + 1; - if (actor->spawnpoint->angle) - rad = actor->spawnpoint->angle*FRACUNIT; - } interval = FixedAngle(FRACUNIT*360/amount); From 8abb6129c1f38d01f6171cab79c950cec5896c46 Mon Sep 17 00:00:00 2001 From: lachwright Date: Sun, 29 Sep 2019 20:18:40 +0800 Subject: [PATCH 13/50] Hardcode pumice ball Current known issues: players detached from the ball via any means other than jumping or pain do not have their ball reset properly --- src/d_player.h | 3 +- src/dehacked.c | 10 ++++ src/hardware/hw_light.c | 1 + src/info.c | 59 +++++++++++++++++++++ src/info.h | 10 ++++ src/p_enemy.c | 111 +++++++++++++++++++++++++++++++++++++++- src/p_map.c | 53 +++++++++++++++++++ src/p_user.c | 79 ++++++++++++++++++++++++---- 8 files changed, 313 insertions(+), 13 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index c133af703..e26c9602f 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -234,7 +234,8 @@ typedef enum CR_ZOOMTUBE, CR_ROPEHANG, CR_MACESPIN, - CR_MINECART + CR_MINECART, + CR_ROLLOUT } carrytype_t; // pw_carry // Player powers. (don't edit this comment) diff --git a/src/dehacked.c b/src/dehacked.c index 1664c6cb2..ff33c4ce1 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -2435,6 +2435,8 @@ static actionpointer_t actionpointers[] = {{A_LavafallLava}, "A_LAVAFALLLAVA"}, {{A_FallingLavaCheck}, "A_FALLINGLAVACHECK"}, {{A_FireShrink}, "A_FIRESHRINK"}, + {{A_RolloutSpawn}, "A_ROLLOUTSPAWN"}, + {{A_RolloutRock}, "A_ROLLOUTROCK"}, {{NULL}, "NONE"}, // This NULL entry must be the last in the list @@ -5842,6 +5844,10 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_LAVAFALL_LAVA3", "S_LAVAFALLROCK", + // Rollout Rock + "S_ROLLOUTSPAWN", + "S_ROLLOUTROCK", + // RVZ scenery "S_BIGFERNLEAF", "S_BIGFERN1", @@ -7572,6 +7578,9 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_LAVAFALL_LAVA", "MT_LAVAFALLROCK", + "MT_ROLLOUTSPAWN", + "MT_ROLLOUTROCK", + "MT_BIGFERNLEAF", "MT_BIGFERN", "MT_JUNGLEPALM", @@ -8579,6 +8588,7 @@ struct { {"CR_ROPEHANG",CR_ROPEHANG}, {"CR_MACESPIN",CR_MACESPIN}, {"CR_MINECART",CR_MINECART}, + {"CR_ROLLOUT", CR_ROLLOUT}, // Ring weapons (ringweapons_t) // Useful for A_GiveWeapon diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index 57dfc57ab..81f00cdf2 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -257,6 +257,7 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_WSPB &lspr[NOLIGHT], // SPR_STPT &lspr[NOLIGHT], // SPR_BMNE + &lspr[NOLIGHT], // SPR_PUMI // Monitor Boxes &lspr[NOLIGHT], // SPR_MSTV diff --git a/src/info.c b/src/info.c index b82c64e52..31488cad5 100644 --- a/src/info.c +++ b/src/info.c @@ -146,6 +146,7 @@ char sprnames[NUMSPRITES + 1][5] = "WSPB", // Wall spike base "STPT", // Starpost "BMNE", // Big floating mine + "PUMI", // Rollout Rock // Monitor Boxes "MSTV", // MiSc TV sprites @@ -2472,6 +2473,10 @@ state_t states[NUMSTATES] = {SPR_LFAL, 2|FF_FULLBRIGHT|FF_ANIMATE, 9, {NULL}, 2, 3, S_NULL}, // S_LAVAFALL_LAVA3 {SPR_LFAL, 11|FF_ANIMATE|FF_RANDOMANIM, 12, {NULL}, 3, 3, S_LAVAFALLROCK}, // S_LAVAFALLROCK + // Rollout Rock + {SPR_NULL, 0, 1, {A_RolloutSpawn}, 256*FRACUNIT, MT_ROLLOUTROCK, S_ROLLOUTSPAWN}, // S_ROLLOUTSPAWN + {SPR_PUMI, 0, 1, {A_RolloutRock}, 63*FRACUNIT/64, 6*FRACUNIT/10, S_ROLLOUTROCK}, // S_ROLLOUTROCK + // RVZ scenery {SPR_JPLA, FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_BIGFERNLEAF {SPR_JPLA, 1, 1, {NULL}, 0, 0, S_BIGFERN2}, // S_BIGFERN1 @@ -12726,6 +12731,60 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_ROLLOUTSPAWN + 1305, // doomednum + S_ROLLOUTSPAWN, // spawnstate + 1000, // spawnhealth + S_NULL, // seestate + sfx_None, // seesound + 0, // 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 + 0, // speed + 8*FRACUNIT, // radius + 8*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOGRAVITY|MF_NOCLIP|MF_SPAWNCEILING, // flags + S_NULL // raisestate + }, + + { // MT_ROLLOUTROCK + -1, // doomednum + S_ROLLOUTROCK, // 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 + 32*FRACUNIT, // speed + 30*FRACUNIT, // radius + 60*FRACUNIT, // height + 0, // display offset + 100, // mass + 0, // damage + sfx_None, // activesound + MF_PUSHABLE|MF_SOLID|MF_SLIDEME, // flags + S_NULL // raisestate + }, + { // MT_BIGFERNLEAF -1, // doomednum S_BIGFERNLEAF, // spawnstate diff --git a/src/info.h b/src/info.h index 8d2023c3d..be49d64f7 100644 --- a/src/info.h +++ b/src/info.h @@ -270,6 +270,8 @@ void A_LavafallRocks(); void A_LavafallLava(); void A_FallingLavaCheck(); void A_FireShrink(); +void A_RolloutSpawn(); +void A_RolloutRock(); // ratio of states to sprites to mobj types is roughly 6 : 1 : 1 #define NUMMOBJFREESLOTS 512 @@ -396,6 +398,7 @@ typedef enum sprite SPR_WSPB, // Wall spike base SPR_STPT, // Starpost SPR_BMNE, // Big floating mine + SPR_PUMI, // Rollout Rock // Monitor Boxes SPR_MSTV, // MiSc TV sprites @@ -2595,6 +2598,10 @@ typedef enum state S_LAVAFALL_LAVA3, S_LAVAFALLROCK, + // Rollout Rock + S_ROLLOUTSPAWN, + S_ROLLOUTROCK, + // RVZ scenery S_BIGFERNLEAF, S_BIGFERN1, @@ -4347,6 +4354,9 @@ typedef enum mobj_type MT_LAVAFALL_LAVA, MT_LAVAFALLROCK, + MT_ROLLOUTSPAWN, + MT_ROLLOUTROCK, + MT_BIGFERNLEAF, MT_BIGFERN, MT_JUNGLEPALM, diff --git a/src/p_enemy.c b/src/p_enemy.c index e37eea19d..19bb30b29 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -300,6 +300,8 @@ void A_LavafallRocks(mobj_t *actor); void A_LavafallLava(mobj_t *actor); void A_FallingLavaCheck(mobj_t *actor); void A_FireShrink(mobj_t *actor); +void A_RolloutSpawn(mobj_t *actor); +void A_RolloutRock(mobj_t *actor); //for p_enemy.c @@ -13838,4 +13840,111 @@ void A_FireShrink(mobj_t *actor) actor->destscale = locvar1; actor->scalespeed = FRACUNIT/locvar2; -} \ No newline at end of file +} + +// Function: A_RolloutSpawn +// +// Description: Spawns a new Rollout Rock when the currently spawned rock is destroyed or moves far enough away. +// +// var1 = Distance currently spawned rock should travel before spawning a new one +// var2 = Object type to spawn +// +void A_RolloutSpawn(mobj_t *actor) +{ + INT32 locvar1 = var1; + INT32 locvar2 = var2; + +#ifdef HAVE_BLUA + if (LUA_CallAction("A_RolloutSpawn", actor)) + return; +#endif + + if (!(actor->target) + || P_MobjWasRemoved(actor->target) + || P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) > locvar1) + { + actor->target = P_SpawnMobj(actor->x, actor->y, actor->z, locvar2); + } +} + +// Function: A_RolloutRock +// +// Description: Thinker for Rollout Rock. +// +// var1 = Drag +// var2 = Vertical bobbing speed factor +// +void A_RolloutRock(mobj_t *actor) +{ + INT32 locvar1 = var1; + INT32 locvar2 = var2; + +#ifdef HAVE_BLUA + if (LUA_CallAction("A_RolloutRock", actor)) + return; +#endif + + UINT8 maxframes = actor->info->reactiontime; + fixed_t pi = (22*FRACUNIT/7); + fixed_t circumference = FixedMul(2 * pi, actor->radius); + fixed_t oldspeed = P_AproxDistance(actor->momx, actor->momy), newspeed, topspeed = actor->info->speed; + mobj_t *target = actor->target; + player_t *player; + boolean inwater = actor->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER); + + actor->friction = FRACUNIT; + + if (inwater) + { + fixed_t height; + if (actor->eflags & MFE_VERTICALFLIP) + { + height = actor->waterbottom + (actor->height>>2); + if (actor->z + actor->height > height) + { + actor->z = height; + actor->momz = 0; + } + } + else + { + height = actor->watertop - (actor->height>>2); + if (actor->z < height) + { + actor->z = height; + actor->momz = 0; + } + } + actor->momz += P_MobjFlip(actor) * FixedMul(locvar2, actor->scale); + } + + if (oldspeed > topspeed) + { + actor->momx = FixedMul(FixedDiv(actor->momx, oldspeed), topspeed); + actor->momy = FixedMul(FixedDiv(actor->momy, oldspeed), topspeed); + } + + actor->momx = FixedMul(actor->momx, locvar1); + actor->momy = FixedMul(actor->momy, locvar1); + + newspeed = P_AproxDistance(actor->momx, actor->momy); + + if (newspeed < actor->scale >> 1) + { + actor->momx = 0; + actor->momy = 0; + } + else if (newspeed > actor->scale) + { + actor->angle = R_PointToAngle2(0, 0, actor->momx, actor->momy); + actor->movefactor += newspeed; + if (actor->movefactor > circumference / maxframes) + { + actor->reactiontime++; + actor->reactiontime %= maxframes; + actor->movefactor = 0; + } + } + + actor->frame = actor->reactiontime % maxframes; +} diff --git a/src/p_map.c b/src/p_map.c index cc9209ea8..2dedff36a 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -920,6 +920,59 @@ static boolean PIT_CheckThing(mobj_t *thing) P_DamageMobj(thing, tmthing, tmthing, 1, 0); } + if (thing->type == MT_ROLLOUTROCK) + { + if (tmthing->player) + { + if (tmthing->player->powers[pw_carry] == CR_ROLLOUT) + { + return true; + } + if ((thing->flags & MF_PUSHABLE) // carrying a player + && ((tmthing->eflags & MFE_VERTICALFLIP) == (thing->eflags & MFE_VERTICALFLIP)) + && (P_AproxDistance(thing->x - tmthing->x, thing->y - tmthing->y) < (thing->radius)) + && (P_MobjFlip(tmthing)*tmthing->momz <= 0) + && ((!(tmthing->eflags & MFE_VERTICALFLIP) && abs(thing->z + thing->height - tmthing->z) < (thing->height>>2)) + || (tmthing->eflags & MFE_VERTICALFLIP && abs(tmthing->z + tmthing->height - thing->z) < (thing->height>>2)))) + { + thing->flags &= ~MF_PUSHABLE; + P_SetTarget(&thing->target, tmthing); + P_ResetPlayer(tmthing->player); + P_SetPlayerMobjState(tmthing, S_PLAY_WALK); + tmthing->player->powers[pw_carry] = CR_ROLLOUT; + P_SetTarget(&tmthing->tracer, thing); + return false; + } + } + else if (tmthing->type == thing->type) + { + if (tmthing->z > thing->z + thing->height || thing->z > tmthing->z + tmthing->height) + return true; + + fixed_t tempmomx = thing->momx, tempmomy = thing->momy; + thing->momx = tmthing->momx; + thing->momy = tmthing->momy; + tmthing->momx = tempmomx; + tmthing->momy = tempmomy; + } + } + else if (tmthing->type == MT_ROLLOUTROCK) + { + if (tmthing->z > thing->z + thing->height || thing->z > tmthing->z + tmthing->height || !thing->health) + return true; + + if (thing->flags & MF_SPRING) + { + P_DoSpring(thing, tmthing); + return true; + } + else if (thing->flags & MF_MONITOR && thing->flags & MF_SHOOTABLE && !(tmthing->flags & MF_PUSHABLE)) // carrying a player + { + P_KillMobj(thing, tmthing, tmthing->target, 0); + return true; + } + } + if (thing->type == MT_VULTURE && tmthing->type == MT_VULTURE) { fixed_t dx = thing->x - tmthing->x; diff --git a/src/p_user.c b/src/p_user.c index 1ca955e49..c7d5095d8 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -948,6 +948,17 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) if (player->powers[pw_carry] == CR_ROPEHANG) P_SetTarget(&player->mo->tracer, NULL); + if (player->powers[pw_carry] == CR_ROLLOUT) + { + if (player->mo->tracer && !P_MobjWasRemoved(player->mo->tracer)) + { + player->mo->tracer->flags |= MF_PUSHABLE; + P_SetTarget(&player->mo->tracer->target, NULL); + } + P_SetTarget(&player->mo->tracer, NULL); + player->powers[pw_carry] = CR_NONE; + } + { angle_t ang; fixed_t fallbackspeed; @@ -4292,6 +4303,8 @@ void P_DoJump(player_t *player, boolean soundandstate) { player->mo->momz = 9*FRACUNIT; player->powers[pw_carry] = CR_NONE; + player->mo->tracer->flags |= MF_PUSHABLE; + P_SetTarget(&player->mo->tracer->target, NULL); P_SetTarget(&player->mo->tracer, NULL); } else if (player->powers[pw_carry] == CR_ROPEHANG) @@ -4300,6 +4313,14 @@ void P_DoJump(player_t *player, boolean soundandstate) player->powers[pw_carry] = CR_NONE; P_SetTarget(&player->mo->tracer, NULL); } + else if (player->powers[pw_carry] == CR_ROLLOUT) + { + player->mo->momz = 9*FRACUNIT + player->mo->tracer->momz; + player->powers[pw_carry] = CR_NONE; + player->mo->tracer->flags |= MF_PUSHABLE; + P_SetTarget(&player->mo->tracer->target, NULL); + P_SetTarget(&player->mo->tracer, NULL); + } else if (player->mo->eflags & MFE_GOOWATER) { player->mo->momz = 7*FRACUNIT; @@ -11121,6 +11142,8 @@ void P_PlayerThink(player_t *player) // deez New User eXperiences. { + angle_t diff = 0; + UINT8 factor; // Directionchar! // Camera angle stuff. if (player->exiting // no control, no modification @@ -11149,6 +11172,13 @@ void P_PlayerThink(player_t *player) case CR_GENERIC: player->drawangle = player->mo->tracer->angle; break; + case CR_ROLLOUT: + if (cmd->forwardmove || cmd->sidemove) // only when you're pressing movement keys + { // inverse direction! + diff = ((player->mo->angle + R_PointToAngle2(0, 0, -cmd->forwardmove<sidemove<drawangle); + factor = 4; + } + break; /* -- in case we wanted to have the camera freely movable during zoom tubes case CR_ZOOMTUBE:*/ case CR_ROPEHANG: @@ -11169,9 +11199,6 @@ void P_PlayerThink(player_t *player) ; else { - angle_t diff; - UINT8 factor; - if (player->pflags & PF_SLIDING) { #if 0 // fun hydrocity style horizontal spin @@ -11207,15 +11234,15 @@ void P_PlayerThink(player_t *player) diff = (player->mo->angle - player->drawangle); factor = 8; } + } - if (diff) - { - if (diff > ANGLE_180) - diff = InvAngle(InvAngle(diff)/factor); - else - diff /= factor; - player->drawangle += diff; - } + if (diff) + { + if (diff > ANGLE_180) + diff = InvAngle(InvAngle(diff)/factor); + else + diff /= factor; + player->drawangle += diff; } // Autobrake! check ST_drawInput if you modify this @@ -11831,6 +11858,36 @@ void P_PlayerAfterThink(player_t *player) } break; } + case CR_ROLLOUT: + { + mobj_t *mo = player->mo, *rock = player->mo->tracer; + UINT8 walktics = mo->state->tics - P_GetPlayerControlDirection(player); + + if (!rock || P_MobjWasRemoved(rock)) + { + P_SetTarget(&player->mo->tracer, NULL); + player->powers[pw_carry] = CR_NONE; + break; + } + + if (player->cmd.forwardmove || player->cmd.sidemove) + { + rock->movedir = (player->cmd.angleturn << FRACBITS) + R_PointToAngle2(0, 0, player->cmd.forwardmove << FRACBITS, -player->cmd.sidemove << FRACBITS); + P_Thrust(rock, rock->movedir, rock->scale >> 1); + } + + mo->momx = rock->momx; + mo->momy = rock->momy; + mo->momz = 0; + + if (player->panim == PA_WALK && mo->tics > walktics) + { + mo->tics = walktics; + } + + P_TeleportMove(player->mo, rock->x, rock->y, rock->z + rock->height); + break; + } default: break; } From 60cbc2e6b4520cb340bef01413af7c1938da21e7 Mon Sep 17 00:00:00 2001 From: lachwright Date: Sun, 29 Sep 2019 21:29:37 +0800 Subject: [PATCH 14/50] Remove unused locals --- src/p_enemy.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 8eda4ce15..b83f8db85 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13957,8 +13957,6 @@ void A_RolloutRock(mobj_t *actor) fixed_t pi = (22*FRACUNIT/7); fixed_t circumference = FixedMul(2 * pi, actor->radius); fixed_t oldspeed = P_AproxDistance(actor->momx, actor->momy), newspeed, topspeed = actor->info->speed; - mobj_t *target = actor->target; - player_t *player; boolean inwater = actor->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER); actor->friction = FRACUNIT; From 26ecab14d79462c35bff155e6753c4611d6ebd6b Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 29 Sep 2019 18:42:17 +0200 Subject: [PATCH 15/50] Implemented the Pterabyte grabbing mechanic --- src/d_player.h | 3 +- src/dehacked.c | 1 + src/p_enemy.c | 1 + src/p_inter.c | 8 +++++ src/p_map.c | 37 +++++++++++++++++++++ src/p_mobj.c | 36 +++++++++++++++++---- src/p_user.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 165 insertions(+), 8 deletions(-) diff --git a/src/d_player.h b/src/d_player.h index c133af703..eff8e54f5 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -234,7 +234,8 @@ typedef enum CR_ZOOMTUBE, CR_ROPEHANG, CR_MACESPIN, - CR_MINECART + CR_MINECART, + CR_PTERABYTE } carrytype_t; // pw_carry // Player powers. (don't edit this comment) diff --git a/src/dehacked.c b/src/dehacked.c index b2a0239c6..d19f43f9c 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8594,6 +8594,7 @@ struct { {"CR_ROPEHANG",CR_ROPEHANG}, {"CR_MACESPIN",CR_MACESPIN}, {"CR_MINECART",CR_MINECART}, + {"CR_PTERABYTE",CR_PTERABYTE}, // Ring weapons (ringweapons_t) // Useful for A_GiveWeapon diff --git a/src/p_enemy.c b/src/p_enemy.c index db76ab4f4..7ad65c1d0 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13878,6 +13878,7 @@ void A_SpawnPterabytes(mobj_t *actor) s = FINESINE(fa); waypoint = P_SpawnMobjFromMobj(actor, FixedMul(c, rad), FixedMul(s, rad), 0, MT_PTERABYTEWAYPOINT); waypoint->angle = ang + ANGLE_90; + P_SetTarget(&waypoint->tracer, actor); ptera = P_SpawnMobjFromMobj(waypoint, 0, 0, 0, MT_PTERABYTE); ptera->angle = waypoint->angle; P_SetTarget(&ptera->tracer, waypoint); diff --git a/src/p_inter.c b/src/p_inter.c index 0030e8e58..cbf8153b4 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -456,6 +456,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (P_PlayerCanDamage(player, special)) // Do you possess the ability to subdue the object? { + if (special->type == MT_PTERABYTE && special->target == player->mo && special->extravalue1 == 1) + return; // Can't hurt a Pterabyte if it's trying to pick you up + if ((P_MobjFlip(toucher)*toucher->momz < 0) && (elementalpierce != 1)) { if (elementalpierce == 2) @@ -477,7 +480,12 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_TwinSpinRejuvenate(player, player->thokitem); } else + { + if (special->type == MT_PTERABYTE && special->target == player->mo) + return; // Don't hurt the player you're trying to grab + P_DamageMobj(toucher, special, special, 1, 0); + } return; } diff --git a/src/p_map.c b/src/p_map.c index cc9209ea8..1455f3a4f 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -490,6 +490,40 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object) } } +static void P_DoPterabyteCarry(player_t *player, mobj_t *ptera) +{ + if (player->powers[pw_carry]) + return; + if (ptera->extravalue1 != 1) + return; // Not swooping + if (ptera->target != player->mo) + return; // Not swooping for you! + + if (player->spectator) + return; + + if ((player->mo->eflags & MFE_VERTICALFLIP) != (ptera->eflags & MFE_VERTICALFLIP)) + return; // Both should be in same gravity + + if (ptera->eflags & MFE_VERTICALFLIP) + { + if (ptera->ceilingz - (ptera->z + ptera->height) < player->mo->height - FixedMul(2*FRACUNIT, player->mo->scale)) + return; + } + else if (ptera->z - ptera->floorz < player->mo->height - FixedMul(2*FRACUNIT, player->mo->scale)) + return; // No room to pick up this guy! + + P_ResetPlayer(player); + P_SetTarget(&player->mo->tracer, ptera); + player->powers[pw_carry] = CR_PTERABYTE; + S_StartSound(player->mo, sfx_s3k4a); + P_UnsetThingPosition(player->mo); + player->mo->x = ptera->x; + player->mo->y = ptera->y; + P_SetThingPosition(player->mo); + ptera->movefactor = 3*TICRATE; +} + static void P_DoTailsCarry(player_t *sonic, player_t *tails) { INT32 p; @@ -920,6 +954,9 @@ static boolean PIT_CheckThing(mobj_t *thing) P_DamageMobj(thing, tmthing, tmthing, 1, 0); } + if (thing->type == MT_PTERABYTE && tmthing->player) + P_DoPterabyteCarry(tmthing->player, thing); + if (thing->type == MT_VULTURE && tmthing->type == MT_VULTURE) { fixed_t dx = thing->x - tmthing->x; diff --git a/src/p_mobj.c b/src/p_mobj.c index 4258ac402..4388c1bd6 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9078,7 +9078,18 @@ void P_MobjThinker(mobj_t *mobj) } case MT_PTERABYTE: { - if (mobj->extravalue1 == 0) // Hovering + if (mobj->extravalue1 & 4) // Cooldown after grabbing + { + if (mobj->movefactor) + mobj->movefactor--; + else + { + P_SetTarget(&mobj->target, NULL); + mobj->extravalue1 &= 3; + } + } + + if ((mobj->extravalue1 & 3) == 0) // Hovering { fixed_t vdist, hdist, time; fixed_t hspeed = 3*mobj->info->speed; @@ -9087,21 +9098,31 @@ void P_MobjThinker(mobj_t *mobj) var1 = 1; var2 = 0; A_CapeChase(mobj); + + if (mobj->target) + break; // Still carrying a player or in cooldown + P_LookForPlayers(mobj, true, false, 256*FRACUNIT); if (!mobj->target) break; - vdist = mobj->z - mobj->target->z; + vdist = mobj->z - mobj->target->z - mobj->target->height; if (vdist <= 0) + { + P_SetTarget(&mobj->target, NULL); break; + } hdist = R_PointToDist2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); if (hdist > 450*FRACUNIT) + { + P_SetTarget(&mobj->target, NULL); break; + } P_SetMobjState(mobj, S_PTERABYTE_SWOOPDOWN); - mobj->extravalue1 = 1; + mobj->extravalue1++; S_StartSound(mobj, mobj->info->attacksound); time = FixedDiv(hdist, hspeed); mobj->angle = R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y); @@ -9113,7 +9134,7 @@ void P_MobjThinker(mobj_t *mobj) mobj->movecount = time >> FRACBITS; mobj->reactiontime = mobj->movecount; } - else if (mobj->extravalue1 == 1) // Swooping + else if ((mobj->extravalue1 & 3) == 1) // Swooping { mobj->reactiontime--; mobj->momz += mobj->extravalue2; @@ -9128,8 +9149,9 @@ void P_MobjThinker(mobj_t *mobj) else if (mobj->state - states == S_PTERABYTE_SWOOPUP) { P_SetMobjState(mobj, S_PTERABYTE_FLY1); - mobj->extravalue1 = 2; - P_SetTarget(&mobj->target, NULL); + mobj->extravalue1++; + if (mobj->target && mobj->target->tracer != mobj) + P_SetTarget(&mobj->target, NULL); // Failed to grab the target mobj->momx = mobj->momy = mobj->momz = 0; } } @@ -9140,7 +9162,7 @@ void P_MobjThinker(mobj_t *mobj) A_HomingChase(mobj); if (P_AproxDistance(mobj->x - mobj->tracer->x, mobj->y - mobj->tracer->y) <= mobj->info->speed) { - mobj->extravalue1 = 0; + mobj->extravalue1 -= 2; mobj->momx = mobj->momy = mobj->momz = 0; } } diff --git a/src/p_user.c b/src/p_user.c index 1ca955e49..4895095f2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4279,6 +4279,9 @@ void P_DoJump(player_t *player, boolean soundandstate) if (player->mo->ceilingz-player->mo->floorz <= player->mo->height-1) return; + if (player->powers[pw_carry] == CR_PTERABYTE) + return; + // Jump this high. if (player->powers[pw_carry] == CR_PLAYER) { @@ -11518,6 +11521,36 @@ void P_PlayerThink(player_t *player) }*/ } +// Checks if the mobj is above lava. Used by Pterabyte. +static boolean P_MobjAboveLava(mobj_t *mobj) +{ + sector_t *sector = mobj->subsector->sector; + + if (sector->ffloors) + { + ffloor_t *rover; + + for (rover = sector->ffloors; rover; rover = rover->next) + { + if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_SWIMMABLE) || GETSECSPECIAL(rover->master->frontsector->special, 1) != 3) + continue; + + if (mobj->eflags & MFE_VERTICALFLIP) + { + if (*rover->bottomheight <= mobj->ceilingz && *rover->bottomheight >= mobj->z) + return true; + } + else + { + if (*rover->topheight >= mobj->floorz && *rover->topheight <= mobj->z) + return true; + } + } + } + + return false; +} + // // P_PlayerAfterThink // @@ -11831,6 +11864,60 @@ void P_PlayerAfterThink(player_t *player) } break; } + case CR_PTERABYTE: // being carried by a Pterabyte + { + mobj_t *ptera = player->mo->tracer; + mobj_t *spawnpoint = ptera->tracer->tracer; + player->mo->height = FixedDiv(P_GetPlayerHeight(player), FixedDiv(14 * FRACUNIT, 10 * FRACUNIT)); + + if (ptera->health <= 0) + goto dropoff; + + if (P_MobjAboveLava(ptera)) + goto dropoff; + + if (player->mo->eflags & MFE_VERTICALFLIP) + { + if ((ptera->z + ptera->height + player->mo->height + FixedMul(FRACUNIT, player->mo->scale)) <= ptera->ceilingz + && (ptera->eflags & MFE_VERTICALFLIP)) // Reverse gravity check for the carrier - Flame + player->mo->z = ptera->z + ptera->height + FixedMul(FRACUNIT, player->mo->scale); + + if (ptera->ceilingz - ptera->z > spawnpoint->ceilingz - spawnpoint->z + 512*FRACUNIT) + goto dropoff; + } + else + { + if ((ptera->z - player->mo->height - FixedMul(FRACUNIT, player->mo->scale)) >= ptera->floorz + && !(ptera->eflags & MFE_VERTICALFLIP)) // Correct gravity check for the carrier - Flame + player->mo->z = ptera->z - player->mo->height - FixedMul(FRACUNIT, player->mo->scale); + + if (ptera->z - ptera->floorz > spawnpoint->z - spawnpoint->floorz + 512 * FRACUNIT) + goto dropoff; + } + + ptera->movefactor--; + if (!ptera->movefactor) + goto dropoff; + + P_TryMove(player->mo, ptera->x, ptera->y, true); + player->mo->momx = ptera->momx; + player->mo->momy = ptera->momy; + player->mo->momz = ptera->momz; + + if (P_AproxDistance(player->mo->x - ptera->x, player->mo->y - ptera->y) > player->mo->radius) + goto dropoff; + + if (player->mo->state-states != S_PLAY_RIDE) + P_SetPlayerMobjState(player->mo, S_PLAY_RIDE); + break; + + dropoff: + player->powers[pw_carry] = CR_NONE; + P_SetTarget(&player->mo->tracer, NULL); + ptera->movefactor = TICRATE; + ptera->extravalue1 |= 4; + break; + } default: break; } From c00144a4f8a3693899f71182ab364255441feb0e Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 29 Sep 2019 19:29:34 +0200 Subject: [PATCH 16/50] Pterabyte: Don't target players who are invincible after being hurt --- src/dehacked.c | 1 + src/p_mobj.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/dehacked.c b/src/dehacked.c index bb1785695..192f2c712 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -8605,6 +8605,7 @@ struct { {"CR_MINECART",CR_MINECART}, {"CR_ROLLOUT", CR_ROLLOUT}, {"CR_PTERABYTE",CR_PTERABYTE}, + // Ring weapons (ringweapons_t) // Useful for A_GiveWeapon {"RW_AUTO",RW_AUTO}, diff --git a/src/p_mobj.c b/src/p_mobj.c index 4388c1bd6..5cd9c27e2 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9107,6 +9107,12 @@ void P_MobjThinker(mobj_t *mobj) if (!mobj->target) break; + if (mobj->target->player->powers[pw_flashing]) + { + P_SetTarget(&mobj->target, NULL); + break; + } + vdist = mobj->z - mobj->target->z - mobj->target->height; if (vdist <= 0) { From cd45bca84840609f034a8c7878cceeca95d28407 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 29 Sep 2019 19:51:27 +0200 Subject: [PATCH 17/50] Pterabyte: Don't drop off player in the first ten tics after grabbing --- src/p_user.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index ec431a86a..54429c8f8 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -11930,7 +11930,7 @@ void P_PlayerAfterThink(player_t *player) if (ptera->health <= 0) goto dropoff; - if (P_MobjAboveLava(ptera)) + if (P_MobjAboveLava(ptera) && ptera->movefactor <= 3*TICRATE - 10) goto dropoff; if (player->mo->eflags & MFE_VERTICALFLIP) @@ -11939,7 +11939,7 @@ void P_PlayerAfterThink(player_t *player) && (ptera->eflags & MFE_VERTICALFLIP)) // Reverse gravity check for the carrier - Flame player->mo->z = ptera->z + ptera->height + FixedMul(FRACUNIT, player->mo->scale); - if (ptera->ceilingz - ptera->z > spawnpoint->ceilingz - spawnpoint->z + 512*FRACUNIT) + if (ptera->ceilingz - ptera->z > spawnpoint->ceilingz - spawnpoint->z + 512*FRACUNIT && ptera->movefactor <= 3 * TICRATE - 10) goto dropoff; } else @@ -11948,7 +11948,7 @@ void P_PlayerAfterThink(player_t *player) && !(ptera->eflags & MFE_VERTICALFLIP)) // Correct gravity check for the carrier - Flame player->mo->z = ptera->z - player->mo->height - FixedMul(FRACUNIT, player->mo->scale); - if (ptera->z - ptera->floorz > spawnpoint->z - spawnpoint->floorz + 512 * FRACUNIT) + if (ptera->z - ptera->floorz > spawnpoint->z - spawnpoint->floorz + 512 * FRACUNIT && ptera->movefactor <= 3 * TICRATE - 10) goto dropoff; } From e57b0f7126844a13b2b07590f7ee19be881770ce Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 30 Sep 2019 03:05:08 +0800 Subject: [PATCH 18/50] (Hopefully) cover all cases for resetting rock usability --- src/p_map.c | 1 + src/p_user.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 14b69b575..39f7d1c54 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -975,6 +975,7 @@ static boolean PIT_CheckThing(mobj_t *thing) P_SetPlayerMobjState(tmthing, S_PLAY_WALK); tmthing->player->powers[pw_carry] = CR_ROLLOUT; P_SetTarget(&tmthing->tracer, thing); + P_SetObjectMomZ(thing, tmthing->momz, true); return false; } } diff --git a/src/p_user.c b/src/p_user.c index ec431a86a..5ce582dfc 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -948,17 +948,6 @@ void P_DoPlayerPain(player_t *player, mobj_t *source, mobj_t *inflictor) if (player->powers[pw_carry] == CR_ROPEHANG) P_SetTarget(&player->mo->tracer, NULL); - if (player->powers[pw_carry] == CR_ROLLOUT) - { - if (player->mo->tracer && !P_MobjWasRemoved(player->mo->tracer)) - { - player->mo->tracer->flags |= MF_PUSHABLE; - P_SetTarget(&player->mo->tracer->target, NULL); - } - P_SetTarget(&player->mo->tracer, NULL); - player->powers[pw_carry] = CR_NONE; - } - { angle_t ang; fixed_t fallbackspeed; @@ -1042,6 +1031,17 @@ void P_ResetPlayer(player_t *player) { player->pflags &= ~(PF_SPINNING|PF_STARTDASH|PF_STARTJUMP|PF_JUMPED|PF_NOJUMPDAMAGE|PF_GLIDING|PF_THOKKED|PF_CANCARRY|PF_SHIELDABILITY|PF_BOUNCING); + if (player->powers[pw_carry] == CR_ROLLOUT) + { + if (player->mo->tracer && !P_MobjWasRemoved(player->mo->tracer)) + { + player->mo->tracer->flags |= MF_PUSHABLE; + P_SetTarget(&player->mo->tracer->target, NULL); + } + P_SetTarget(&player->mo->tracer, NULL); + player->powers[pw_carry] = CR_NONE; + } + if (!(player->powers[pw_carry] == CR_NIGHTSMODE || player->powers[pw_carry] == CR_NIGHTSFALL || player->powers[pw_carry] == CR_BRAKGOOP || player->powers[pw_carry] == CR_MINECART)) player->powers[pw_carry] = CR_NONE; From 3d985c1b9e3fb9247a8030d0464f8361c71b46a2 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 29 Sep 2019 22:13:10 +0200 Subject: [PATCH 19/50] Pterabytes can now swoop you off a rollout rock --- src/p_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index 39f7d1c54..13a49acd4 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -492,7 +492,7 @@ static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object) static void P_DoPterabyteCarry(player_t *player, mobj_t *ptera) { - if (player->powers[pw_carry]) + if (player->powers[pw_carry] && players->powers[pw_carry] != CR_ROLLOUT) return; if (ptera->extravalue1 != 1) return; // Not swooping From 4375ea808921d1ab11bc23e49912b26af4d8b6f1 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 29 Sep 2019 23:11:21 +0200 Subject: [PATCH 20/50] Lava now melts rings! --- src/p_mobj.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 5cd9c27e2..dc1ab7277 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -4111,6 +4111,45 @@ void P_RainThinker(precipmobj_t *mobj) P_SetPrecipMobjState(mobj, S_SPLASH1); } +static void P_KillRingsInLava(mobj_t *mo) +{ + msecnode_t *node; + I_Assert(mo != NULL); + I_Assert(!P_MobjWasRemoved(mo)); + + // go through all sectors being touched by the ring + for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next) + { + if (!node->m_sector) + break; + + if (node->m_sector->ffloors) + { + ffloor_t *rover; + fixed_t topheight, bottomheight; + + for (rover = node->m_sector->ffloors; rover; rover = rover->next) // go through all fofs in the sector + { + if (!(rover->flags & FF_EXISTS)) continue; // fof must be real + + if (!(rover->flags & FF_SWIMMABLE // fof must be water + && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3)) // fof must be lava water + continue; + + // find heights of FOF + topheight = P_GetFOFTopZ(mo, node->m_sector, rover, mo->x, mo->y, NULL); + bottomheight = P_GetFOFBottomZ(mo, node->m_sector, rover, mo->x, mo->y, NULL); + + if (mo->z <= topheight || mo->z + mo->height >= bottomheight) // if ring touches it, KILL IT + { + P_KillMobj(mo, NULL, NULL, DMG_FIRE); + return; + } + } + } + } +} + static void P_RingThinker(mobj_t *mobj) { if (mobj->momx || mobj->momy) @@ -8802,12 +8841,16 @@ void P_MobjThinker(mobj_t *mobj) break; case MT_RING: case MT_COIN: + case MT_REDTEAMRING: + case MT_BLUETEAMRING: + P_KillRingsInLava(mobj); + if (P_MobjWasRemoved(mobj)) + return; + /* FALLTHRU */ case MT_BLUESPHERE: case MT_BOMBSPHERE: case MT_NIGHTSCHIP: case MT_NIGHTSSTAR: - case MT_REDTEAMRING: - case MT_BLUETEAMRING: // No need to check water. Who cares? P_RingThinker(mobj); if (mobj->flags2 & MF2_NIGHTSPULL) @@ -8818,6 +8861,10 @@ void P_MobjThinker(mobj_t *mobj) // Flung items case MT_FLINGRING: case MT_FLINGCOIN: + P_KillRingsInLava(mobj); + if (P_MobjWasRemoved(mobj)) + return; + /* FALLTHRU */ case MT_FLINGBLUESPHERE: case MT_FLINGNIGHTSCHIP: if (mobj->flags2 & MF2_NIGHTSPULL) From d301d2bba4ea733025dec4edcbeade0a4322e0a5 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 29 Sep 2019 23:22:38 +0200 Subject: [PATCH 21/50] Fixed a bug with the ring lava melting --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index dc1ab7277..ea3fd1330 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -4140,7 +4140,7 @@ static void P_KillRingsInLava(mobj_t *mo) topheight = P_GetFOFTopZ(mo, node->m_sector, rover, mo->x, mo->y, NULL); bottomheight = P_GetFOFBottomZ(mo, node->m_sector, rover, mo->x, mo->y, NULL); - if (mo->z <= topheight || mo->z + mo->height >= bottomheight) // if ring touches it, KILL IT + if (mo->z <= topheight && mo->z + mo->height >= bottomheight) // if ring touches it, KILL IT { P_KillMobj(mo, NULL, NULL, DMG_FIRE); return; From 24e80c9b23a70d4cbc958dc8fb8e0e4b3cbff975 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Tue, 1 Oct 2019 21:17:33 +0200 Subject: [PATCH 22/50] Made solid lava walls damaging --- src/p_map.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index 13a49acd4..2d99a749e 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3573,6 +3573,67 @@ stairstep: goto retry; } +static void P_CheckLavaWall(mobj_t *mo, sector_t *sec) +{ + ffloor_t *rover; + fixed_t topheight, bottomheight; + + for (rover = sec->ffloors; rover; rover = rover->next) + { + if (!(rover->flags & FF_EXISTS)) + continue; + + if (!(rover->flags & FF_SWIMMABLE)) + continue; + + if (GETSECSPECIAL(rover->master->frontsector->special, 1) != 3) + continue; + + if (!(rover->master->flags & ML_EFFECT3)) + continue; + + if (rover->master->flags & ML_BLOCKMONSTERS) + continue; + + topheight = +#ifdef ESLOPE + *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : +#endif + *rover->topheight; + + if (mo->eflags & MFE_VERTICALFLIP) + { + if (topheight < mo->z - mo->height) + continue; + } + else + { + if (topheight < mo->z) + continue; + } + + bottomheight = +#ifdef ESLOPE + *rover->b_slope ? P_GetZAt(*rover->b_slope, mo->x, mo->y) : +#endif + *rover->bottomheight; + + if (mo->eflags & MFE_VERTICALFLIP) + { + if (bottomheight > mo->z) + continue; + } + else + { + if (bottomheight > mo->z + mo->height) + continue; + } + + P_DamageMobj(mo, NULL, NULL, 1, DMG_FIRE); + return; + } +} + // // P_SlideMove // The momx / momy move is bad, so try to slide @@ -3733,6 +3794,12 @@ retry: P_PathTraverse(leadx, traily, leadx + mo->momx, traily + mo->momy, PT_ADDLINES, PTR_SlideTraverse); + if (bestslideline && mo->player && bestslideline->sidenum[1] != 0xffff) + { + sector_t *sec = P_PointOnLineSide(mo->x, mo->y, bestslideline) ? bestslideline->frontsector : bestslideline->backsector; + P_CheckLavaWall(mo, sec); + } + // Some walls are bouncy even if you're not if (bestslideline && bestslideline->flags & ML_BOUNCY) { From 5c1fabfaaefc8c5bf31122855b07db227d90707f Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Tue, 1 Oct 2019 21:58:18 +0200 Subject: [PATCH 23/50] Lava is now either completely solid or completely intangible. No more half-assing --- src/lua_baselib.c | 5 +---- src/p_local.h | 2 +- src/p_map.c | 5 +---- src/p_maputl.c | 4 ++-- src/p_mobj.c | 22 +++++----------------- src/p_user.c | 2 +- 6 files changed, 11 insertions(+), 29 deletions(-) diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 3c136a436..cfe0844ee 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -802,15 +802,12 @@ static int lib_pCheckDeathPitCollide(lua_State *L) static int lib_pCheckSolidLava(lua_State *L) { - mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ)); ffloor_t *rover = *((ffloor_t **)luaL_checkudata(L, 2, META_FFLOOR)); //HUDSAFE INLEVEL - if (!mo) - return LUA_ErrInvalid(L, "mobj_t"); if (!rover) return LUA_ErrInvalid(L, "ffloor_t"); - lua_pushboolean(L, P_CheckSolidLava(mo, rover)); + lua_pushboolean(L, P_CheckSolidLava(rover)); return 1; } diff --git a/src/p_local.h b/src/p_local.h index 3a0146e54..cad802910 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -303,7 +303,7 @@ fixed_t P_CameraCeilingZ(camera_t *mobj, sector_t *sector, sector_t *boundsec, f boolean P_InsideANonSolidFFloor(mobj_t *mobj, ffloor_t *rover); boolean P_CheckDeathPitCollide(mobj_t *mo); -boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover); +boolean P_CheckSolidLava(ffloor_t *rover); void P_AdjustMobjFloorZ_FFloors(mobj_t *mo, sector_t *sector, UINT8 motype); mobj_t *P_SpawnMobjFromMobj(mobj_t *mobj, fixed_t xofs, fixed_t yofs, fixed_t zofs, mobjtype_t type); diff --git a/src/p_map.c b/src/p_map.c index 2d99a749e..56412a3b4 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2055,7 +2055,7 @@ boolean P_CheckPosition(mobj_t *thing, fixed_t x, fixed_t y) continue; } - if (thing->player && (P_CheckSolidLava(thing, rover) || P_CanRunOnWater(thing->player, rover))) + if (thing->player && (P_CheckSolidLava(rover) || P_CanRunOnWater(thing->player, rover))) ; else if (thing->type == MT_SKIM && (rover->flags & FF_SWIMMABLE)) ; @@ -3589,9 +3589,6 @@ static void P_CheckLavaWall(mobj_t *mo, sector_t *sec) if (GETSECSPECIAL(rover->master->frontsector->special, 1) != 3) continue; - if (!(rover->master->flags & ML_EFFECT3)) - continue; - if (rover->master->flags & ML_BLOCKMONSTERS) continue; diff --git a/src/p_maputl.c b/src/p_maputl.c index 45fc82fbf..22998c60e 100644 --- a/src/p_maputl.c +++ b/src/p_maputl.c @@ -662,7 +662,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (!(rover->flags & FF_EXISTS)) continue; - if (mobj->player && (P_CheckSolidLava(mobj, rover) || P_CanRunOnWater(mobj->player, rover))) + if (mobj->player && (P_CheckSolidLava(rover) || P_CanRunOnWater(mobj->player, rover))) ; else if (!((rover->flags & FF_BLOCKPLAYER && mobj->player) || (rover->flags & FF_BLOCKOTHERS && !mobj->player))) @@ -708,7 +708,7 @@ void P_LineOpening(line_t *linedef, mobj_t *mobj) if (!(rover->flags & FF_EXISTS)) continue; - if (mobj->player && (P_CheckSolidLava(mobj, rover) || P_CanRunOnWater(mobj->player, rover))) + if (mobj->player && (P_CheckSolidLava(rover) || P_CanRunOnWater(mobj->player, rover))) ; else if (!((rover->flags & FF_BLOCKPLAYER && mobj->player) || (rover->flags & FF_BLOCKOTHERS && !mobj->player))) diff --git a/src/p_mobj.c b/src/p_mobj.c index ea3fd1330..15aaa6ec0 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2222,7 +2222,7 @@ void P_AdjustMobjFloorZ_FFloors(mobj_t *mo, sector_t *sector, UINT8 motype) topheight = P_GetFOFTopZ(mo, sector, rover, mo->x, mo->y, NULL); bottomheight = P_GetFOFBottomZ(mo, sector, rover, mo->x, mo->y, NULL); - if (mo->player && (P_CheckSolidLava(mo, rover) || P_CanRunOnWater(mo->player, rover))) // only the player should stand on lava or run on water + if (mo->player && (P_CheckSolidLava(rover) || P_CanRunOnWater(mo->player, rover))) // only the player should stand on lava or run on water ; else if (motype != 0 && rover->flags & FF_SWIMMABLE) // "scenery" only continue; @@ -2379,23 +2379,11 @@ boolean P_CheckDeathPitCollide(mobj_t *mo) return false; } -boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover) +boolean P_CheckSolidLava(ffloor_t *rover) { - I_Assert(mo != NULL); - I_Assert(!P_MobjWasRemoved(mo)); - - { - fixed_t topheight = - #ifdef ESLOPE - *rover->t_slope ? P_GetZAt(*rover->t_slope, mo->x, mo->y) : - #endif - *rover->topheight; - - if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3 - && !(rover->master->flags & ML_BLOCKMONSTERS) - && ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > topheight - FixedMul(16*FRACUNIT, mo->scale))) - return true; - } + if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3 + && !(rover->master->flags & ML_BLOCKMONSTERS)) + return true; return false; } diff --git a/src/p_user.c b/src/p_user.c index 45c94827c..61492ab3e 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -3683,7 +3683,7 @@ static void P_DoTeeter(player_t *player) bottomheight = *rover->bottomheight; #endif - if (P_CheckSolidLava(player->mo, rover)) + if (P_CheckSolidLava(rover)) ; else if (!(rover->flags & FF_BLOCKPLAYER || rover->flags & FF_QUICKSAND)) continue; // intangible 3d floor From 27c9fe5047ff44357f62375d029cd8c58fcac26d Mon Sep 17 00:00:00 2001 From: lachwright Date: Thu, 3 Oct 2019 02:31:32 +0800 Subject: [PATCH 24/50] Fix false comment --- src/p_map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_map.c b/src/p_map.c index 56412a3b4..fdb0128ac 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -962,7 +962,7 @@ static boolean PIT_CheckThing(mobj_t *thing) { return true; } - if ((thing->flags & MF_PUSHABLE) // carrying a player + if ((thing->flags & MF_PUSHABLE) // not carrying a player && ((tmthing->eflags & MFE_VERTICALFLIP) == (thing->eflags & MFE_VERTICALFLIP)) && (P_AproxDistance(thing->x - tmthing->x, thing->y - tmthing->y) < (thing->radius)) && (P_MobjFlip(tmthing)*tmthing->momz <= 0) From cabc4e029415b386ca76752fa1ba99b40a91a8df Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 5 Oct 2019 10:00:59 +0200 Subject: [PATCH 25/50] Implemented lava splish. Feel free to suggest a different "splish" sound. --- src/dehacked.c | 4 ++++ src/hardware/hw_light.c | 1 + src/info.c | 31 +++++++++++++++++++++++++++++++ src/info.h | 5 +++++ src/p_enemy.c | 2 +- src/p_floor.c | 1 + src/p_mobj.c | 26 ++++++++++++++++---------- src/p_mobj.h | 2 ++ src/p_user.c | 10 ++++++++-- 9 files changed, 69 insertions(+), 13 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 192f2c712..aa52c9f82 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -6598,6 +6598,9 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit "S_SPLISH8", "S_SPLISH9", + // Lava splish + "S_LAVASPLISH", + // added water splash "S_SPLASH1", "S_SPLASH2", @@ -7769,6 +7772,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_RAIN", // Rain "MT_SNOWFLAKE", // Snowflake "MT_SPLISH", // Water splish! + "MT_LAVASPLISH", // Lava splish! "MT_SMOKE", "MT_SMALLBUBBLE", // small bubble "MT_MEDIUMBUBBLE", // medium bubble diff --git a/src/hardware/hw_light.c b/src/hardware/hw_light.c index e5e9e77a7..1d0b79882 100644 --- a/src/hardware/hw_light.c +++ b/src/hardware/hw_light.c @@ -477,6 +477,7 @@ light_t *t_lspr[NUMSPRITES] = &lspr[NOLIGHT], // SPR_RAIN &lspr[NOLIGHT], // SPR_SNO1 &lspr[NOLIGHT], // SPR_SPLH + &lspr[NOLIGHT], // SPR_LSPL &lspr[NOLIGHT], // SPR_SPLA &lspr[NOLIGHT], // SPR_SMOK &lspr[NOLIGHT], // SPR_BUBL diff --git a/src/info.c b/src/info.c index 076f12d40..ae96b2691 100644 --- a/src/info.c +++ b/src/info.c @@ -372,6 +372,7 @@ char sprnames[NUMSPRITES + 1][5] = "RAIN", // Rain "SNO1", // Snowflake "SPLH", // Water Splish + "LSPL", // Lava Splish "SPLA", // Water Splash "SMOK", "BUBL", // Bubble @@ -3233,6 +3234,9 @@ state_t states[NUMSTATES] = {SPR_SPLH, FF_TRANS50|7, 2, {NULL}, 0, 0, S_SPLISH9}, // S_SPLISH8 {SPR_SPLH, FF_TRANS50|8, 2, {NULL}, 0, 0, S_NULL}, // S_SPLISH9 + // Lava splish + {SPR_LSPL, FF_ANIMATE, 16, {NULL}, 7, 2, S_NULL}, // S_LAVASPLISH + // Water Splash {SPR_SPLA, FF_TRANS50 , 3, {NULL}, 0, 0, S_SPLASH2}, // S_SPLASH1 {SPR_SPLA, FF_TRANS70|1, 3, {NULL}, 0, 0, S_SPLASH3}, // S_SPLASH2 @@ -16823,6 +16827,33 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, + { // MT_LAVASPLISH + -1, // doomednum + S_LAVASPLISH, // 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 + 0, // speed + 6*FRACUNIT, // radius + 1*FRACUNIT, // height + 0, // display offset + 100, // mass + 1, // damage + sfx_None, // activesound + MF_NOBLOCKMAP|MF_NOCLIP|MF_NOGRAVITY|MF_SCENERY, // flags + S_NULL // raisestate + }, + { // MT_SMOKE -1, // doomednum S_SMOKE1, // spawnstate diff --git a/src/info.h b/src/info.h index 8663b0576..ef6b05f13 100644 --- a/src/info.h +++ b/src/info.h @@ -626,6 +626,7 @@ typedef enum sprite SPR_RAIN, // Rain SPR_SNO1, // Snowflake SPR_SPLH, // Water Splish + SPR_LSPL, // Lava Splish SPR_SPLA, // Water Splash SPR_SMOK, SPR_BUBL, // Bubble @@ -3353,6 +3354,9 @@ typedef enum state S_SPLISH8, S_SPLISH9, + // Lava Splish + S_LAVASPLISH, + // added water splash S_SPLASH1, S_SPLASH2, @@ -4546,6 +4550,7 @@ typedef enum mobj_type MT_RAIN, // Rain MT_SNOWFLAKE, // Snowflake MT_SPLISH, // Water splish! + MT_LAVASPLISH, // Lava splish! MT_SMOKE, MT_SMALLBUBBLE, // small bubble MT_MEDIUMBUBBLE, // medium bubble diff --git a/src/p_enemy.c b/src/p_enemy.c index 359bc7d3b..594d8f978 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -12042,7 +12042,7 @@ void A_MineExplode(mobj_t *actor) #undef dist if (actor->watertop != INT32_MAX) - P_SpawnMobj(actor->x, actor->y, actor->watertop, MT_SPLISH); + P_SpawnMobj(actor->x, actor->y, actor->watertop, (actor->eflags & MFE_TOUCHLAVA) ? MT_LAVASPLISH : MT_SPLISH); } } diff --git a/src/p_floor.c b/src/p_floor.c index 7887dc530..19b7611b8 100644 --- a/src/p_floor.c +++ b/src/p_floor.c @@ -1778,6 +1778,7 @@ static mobj_t *SearchMarioNode(msecnode_t *node) case MT_RAIN: case MT_SNOWFLAKE: case MT_SPLISH: + case MT_LAVASPLISH: case MT_SMOKE: case MT_SMALLBUBBLE: case MT_MEDIUMBUBBLE: diff --git a/src/p_mobj.c b/src/p_mobj.c index 15aaa6ec0..5c53c6ebc 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3318,7 +3318,7 @@ void P_MobjCheckWater(mobj_t *mobj) mobj->watertop = mobj->waterbottom = mobj->z - 1000*FRACUNIT; // Reset water state. - mobj->eflags &= ~(MFE_UNDERWATER|MFE_TOUCHWATER|MFE_GOOWATER); + mobj->eflags &= ~(MFE_UNDERWATER|MFE_TOUCHWATER|MFE_GOOWATER|MFE_TOUCHLAVA); for (rover = sector->ffloors; rover; rover = rover->next) { @@ -3359,16 +3359,18 @@ void P_MobjCheckWater(mobj_t *mobj) // Just touching the water? if (((mobj->eflags & MFE_VERTICALFLIP) && thingtop - height < bottomheight) || (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z + height > topheight)) - { mobj->eflags |= MFE_TOUCHWATER; - if (rover->flags & FF_GOOWATER && !(mobj->flags & MF_NOGRAVITY)) - mobj->eflags |= MFE_GOOWATER; - } + // Actually in the water? if (((mobj->eflags & MFE_VERTICALFLIP) && thingtop - (height>>1) > bottomheight) || (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z + (height>>1) < topheight)) - { mobj->eflags |= MFE_UNDERWATER; + + if (mobj->eflags & (MFE_TOUCHWATER|MFE_TOUCHLAVA)) + { + if (GETSECSPECIAL(rover->master->frontsector->special, 1) == 3) + mobj->eflags |= MFE_TOUCHLAVA; + if (rover->flags & FF_GOOWATER && !(mobj->flags & MF_NOGRAVITY)) mobj->eflags |= MFE_GOOWATER; } @@ -3446,14 +3448,15 @@ void P_MobjCheckWater(mobj_t *mobj) { // Spawn a splash mobj_t *splish; + mobjtype_t splishtype = (mobj->eflags & MFE_TOUCHLAVA) ? MT_LAVASPLISH : MT_SPLISH; if (mobj->eflags & MFE_VERTICALFLIP) { - splish = P_SpawnMobj(mobj->x, mobj->y, mobj->waterbottom-FixedMul(mobjinfo[MT_SPLISH].height, mobj->scale), MT_SPLISH); + splish = P_SpawnMobj(mobj->x, mobj->y, mobj->waterbottom-FixedMul(mobjinfo[splishtype].height, mobj->scale), splishtype); splish->flags2 |= MF2_OBJECTFLIP; splish->eflags |= MFE_VERTICALFLIP; } else - splish = P_SpawnMobj(mobj->x, mobj->y, mobj->watertop, MT_SPLISH); + splish = P_SpawnMobj(mobj->x, mobj->y, mobj->watertop, splishtype); splish->destscale = mobj->scale; P_SetScale(splish, mobj->scale); } @@ -3481,14 +3484,15 @@ void P_MobjCheckWater(mobj_t *mobj) { // Spawn a splash mobj_t *splish; + mobjtype_t splishtype = (mobj->eflags & MFE_TOUCHLAVA) ? MT_LAVASPLISH : MT_SPLISH; if (mobj->eflags & MFE_VERTICALFLIP) { - splish = P_SpawnMobj(mobj->x, mobj->y, mobj->waterbottom-FixedMul(mobjinfo[MT_SPLISH].height, mobj->scale), MT_SPLISH); + splish = P_SpawnMobj(mobj->x, mobj->y, mobj->waterbottom-FixedMul(mobjinfo[splishtype].height, mobj->scale), splishtype); splish->flags2 |= MF2_OBJECTFLIP; splish->eflags |= MFE_VERTICALFLIP; } else - splish = P_SpawnMobj(mobj->x, mobj->y, mobj->watertop, MT_SPLISH); + splish = P_SpawnMobj(mobj->x, mobj->y, mobj->watertop, splishtype); splish->destscale = mobj->scale; P_SetScale(splish, mobj->scale); } @@ -3504,6 +3508,8 @@ void P_MobjCheckWater(mobj_t *mobj) if (mobj->eflags & MFE_GOOWATER || wasingoo) S_StartSound(mobj, sfx_ghit); + else if (mobj->eflags & MFE_TOUCHLAVA) + S_StartSound(mobj, sfx_splash); else S_StartSound(mobj, sfx_splish); // And make a sound! diff --git a/src/p_mobj.h b/src/p_mobj.h index a9d5244b0..ae2ff6c1e 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -242,6 +242,8 @@ typedef enum // Compute and trigger on mobj angle relative to tracer // See Linedef Exec 457 (Track mobj angle to point) MFE_TRACERANGLE = 1<<10, + // The mobj is touching a lava block + MFE_TOUCHLAVA = 1<<11, // free: to and including 1<<15 } mobjeflag_t; diff --git a/src/p_user.c b/src/p_user.c index 61492ab3e..51c3a04f8 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -7150,10 +7150,13 @@ static void P_NiGHTSMovement(player_t *player) && player->mo->z + player->mo->height - P_GetPlayerHeight(player) <= player->mo->waterbottom && player->mo->z + player->mo->height >= player->mo->waterbottom)) && player->speed > 9000 && leveltime % (TICRATE/7) == 0 && !player->spectator) { + mobjtype_t splishtype = (player->mo->eflags & MFE_TOUCHLAVA) ? MT_LAVASPLISH : MT_SPLISH; mobj_t *water = P_SpawnMobj(player->mo->x, player->mo->y, - ((player->mo->eflags & MFE_VERTICALFLIP) ? player->mo->waterbottom - FixedMul(mobjinfo[MT_SPLISH].height, player->mo->scale) : player->mo->watertop), MT_SPLISH); + ((player->mo->eflags & MFE_VERTICALFLIP) ? player->mo->waterbottom - FixedMul(mobjinfo[splishtype].height, player->mo->scale) : player->mo->watertop), splishtype); if (player->mo->eflags & MFE_GOOWATER) S_StartSound(water, sfx_ghit); + else if (player->mo->eflags & MFE_TOUCHLAVA) + S_StartSound(water, sfx_splash); else S_StartSound(water, sfx_wslap); if (player->mo->eflags & MFE_VERTICALFLIP) @@ -7915,10 +7918,13 @@ static void P_MovePlayer(player_t *player) && (player->speed > runspd || (player->pflags & PF_STARTDASH)) && leveltime % (TICRATE/7) == 0 && player->mo->momz == 0 && !(player->pflags & PF_SLIDING) && !player->spectator) { + mobjtype_t splishtype = (player->mo->eflags & MFE_TOUCHLAVA) ? MT_LAVASPLISH : MT_SPLISH; mobj_t *water = P_SpawnMobj(player->mo->x - P_ReturnThrustX(NULL, player->mo->angle, player->mo->radius), player->mo->y - P_ReturnThrustY(NULL, player->mo->angle, player->mo->radius), - ((player->mo->eflags & MFE_VERTICALFLIP) ? player->mo->waterbottom - FixedMul(mobjinfo[MT_SPLISH].height, player->mo->scale) : player->mo->watertop), MT_SPLISH); + ((player->mo->eflags & MFE_VERTICALFLIP) ? player->mo->waterbottom - FixedMul(mobjinfo[splishtype].height, player->mo->scale) : player->mo->watertop), splishtype); if (player->mo->eflags & MFE_GOOWATER) S_StartSound(water, sfx_ghit); + else if (player->mo->eflags & MFE_TOUCHLAVA) + S_StartSound(water, sfx_splash); else S_StartSound(water, sfx_wslap); if (player->mo->eflags & MFE_VERTICALFLIP) From 99220ae48b991b30019e722480bddd268260f80e Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 5 Oct 2019 10:45:24 +0200 Subject: [PATCH 26/50] Fixed a typo --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 5c53c6ebc..67a05d484 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3366,7 +3366,7 @@ void P_MobjCheckWater(mobj_t *mobj) || (!(mobj->eflags & MFE_VERTICALFLIP) && mobj->z + (height>>1) < topheight)) mobj->eflags |= MFE_UNDERWATER; - if (mobj->eflags & (MFE_TOUCHWATER|MFE_TOUCHLAVA)) + if (mobj->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER)) { if (GETSECSPECIAL(rover->master->frontsector->special, 1) == 3) mobj->eflags |= MFE_TOUCHLAVA; From 16d077fde3b35c8a7f53e5744ced16c68de13451 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 5 Oct 2019 20:00:54 +0200 Subject: [PATCH 27/50] Coins don't melt in lava and lavafalls have displayoffset 1 --- src/info.c | 2 +- src/p_mobj.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/info.c b/src/info.c index ae96b2691..2374c8515 100644 --- a/src/info.c +++ b/src/info.c @@ -12765,7 +12765,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // speed 30*FRACUNIT, // radius 32*FRACUNIT, // height - 0, // display offset + 1, // display offset 100, // mass 0, // damage sfx_None, // activesound diff --git a/src/p_mobj.c b/src/p_mobj.c index 67a05d484..f4fe43ecf 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -8834,13 +8834,13 @@ void P_MobjThinker(mobj_t *mobj) } break; case MT_RING: - case MT_COIN: case MT_REDTEAMRING: case MT_BLUETEAMRING: P_KillRingsInLava(mobj); if (P_MobjWasRemoved(mobj)) return; /* FALLTHRU */ + case MT_COIN: case MT_BLUESPHERE: case MT_BOMBSPHERE: case MT_NIGHTSCHIP: @@ -8854,11 +8854,11 @@ void P_MobjThinker(mobj_t *mobj) return; // Flung items case MT_FLINGRING: - case MT_FLINGCOIN: P_KillRingsInLava(mobj); if (P_MobjWasRemoved(mobj)) return; /* FALLTHRU */ + case MT_FLINGCOIN: case MT_FLINGBLUESPHERE: case MT_FLINGNIGHTSCHIP: if (mobj->flags2 & MF2_NIGHTSPULL) From b9c3f72112bca8363b54c475d93dd03d294d56e7 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 5 Oct 2019 20:10:07 +0200 Subject: [PATCH 28/50] Grouped MFE_TOUCHLAVA together with the other liquid-related flags --- src/p_mobj.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/p_mobj.h b/src/p_mobj.h index ae2ff6c1e..94fcc2987 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -233,17 +233,17 @@ typedef enum MFE_VERTICALFLIP = 1<<5, // Goo water MFE_GOOWATER = 1<<6, + // The mobj is touching a lava block + MFE_TOUCHLAVA = 1<<7, // Mobj was already pushed this tic - MFE_PUSHED = 1<<7, + MFE_PUSHED = 1<<8, // Mobj was already sprung this tic - MFE_SPRUNG = 1<<8, + MFE_SPRUNG = 1<<9, // Platform movement - MFE_APPLYPMOMZ = 1<<9, + MFE_APPLYPMOMZ = 1<<10, // Compute and trigger on mobj angle relative to tracer // See Linedef Exec 457 (Track mobj angle to point) - MFE_TRACERANGLE = 1<<10, - // The mobj is touching a lava block - MFE_TOUCHLAVA = 1<<11, + MFE_TRACERANGLE = 1<<11, // free: to and including 1<<15 } mobjeflag_t; From 2f4edc0cb9b09db5e5e1ebe2f9f5e9a2b1178b61 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 5 Oct 2019 20:29:47 +0200 Subject: [PATCH 29/50] Players carried by Pterabyte cannot adjust their angle and are in their falling state --- src/p_user.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index 51c3a04f8..9d6f3f643 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -11179,6 +11179,7 @@ void P_PlayerThink(player_t *player) /* FALLTHRU */ case CR_MINECART: case CR_GENERIC: + case CR_PTERABYTE: player->drawangle = player->mo->tracer->angle; break; case CR_ROLLOUT: @@ -11970,8 +11971,8 @@ void P_PlayerAfterThink(player_t *player) if (P_AproxDistance(player->mo->x - ptera->x, player->mo->y - ptera->y) > player->mo->radius) goto dropoff; - if (player->mo->state-states != S_PLAY_RIDE) - P_SetPlayerMobjState(player->mo, S_PLAY_RIDE); + if (player->mo->state-states != S_PLAY_FALL) + P_SetPlayerMobjState(player->mo, S_PLAY_FALL); break; dropoff: From a7d6ebd5bd901409c29b1717d0edb67e7aa85bd6 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 5 Oct 2019 20:37:48 +0200 Subject: [PATCH 30/50] Lavafall lava also kills rings --- src/p_map.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/p_map.c b/src/p_map.c index 56412a3b4..719a637b4 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -888,6 +888,15 @@ static boolean PIT_CheckThing(mobj_t *thing) } #endif + if (tmthing->type == MT_LAVAFALL_LAVA && (thing->type == MT_RING || thing->type == MT_REDTEAMRING || thing->type == MT_BLUETEAMRING || thing->type == MT_FLINGRING)) + { + //height check + if (tmthing->z > thing->z + thing->height || thing->z > tmthing->z + tmthing->height || !(thing->health)) + return true; + + P_KillMobj(thing, tmthing, tmthing, DMG_FIRE); + } + if (tmthing->type == MT_MINECART) { //height check From 357baeaa604573b4cf34fd50f3444c286f20fd91 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 5 Oct 2019 22:20:48 +0200 Subject: [PATCH 31/50] Added gravflip support to lavafall, Pyre Fly and Pterabyte --- src/p_enemy.c | 3 ++- src/p_mobj.c | 12 +++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 594d8f978..e6ca4f2f1 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13820,7 +13820,8 @@ void A_FallingLavaCheck(mobj_t *actor) { actor->flags = MF_NOGRAVITY|MF_NOCLIPTHING; actor->momz = 0; - actor->z = actor->watertop; + if (actor->eflags & MFE_TOUCHWATER) + actor->z = (actor->eflags & MFE_VERTICALFLIP) ? actor->waterbottom : actor->watertop; P_SetMobjState(actor, actor->info->deathstate); } } diff --git a/src/p_mobj.c b/src/p_mobj.c index f4fe43ecf..5bf4323c3 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9096,13 +9096,11 @@ void P_MobjThinker(mobj_t *mobj) if (hdist < 1000*FRACUNIT) { - fixed_t dist = P_AproxDistance(hdist, mobj->target->z - mobj->z); + //Aim for player z position. If too close to floor/ceiling, aim just above/below them. + fixed_t destz = min(max(mobj->target->z, mobj->target->floorz + 70*FRACUNIT), mobj->target->ceilingz - 80*FRACUNIT - mobj->height); + fixed_t dist = P_AproxDistance(hdist, destz - mobj->z); P_InstaThrust(mobj, R_PointToAngle2(mobj->x, mobj->y, mobj->target->x, mobj->target->y), 2*FRACUNIT); - //aim for player z position; if too close to floor, aim just above them - if (mobj->z - mobj->floorz >= 80*FRACUNIT) - mobj->momz = FixedMul(FixedDiv(mobj->target->z - mobj->z, dist), 2*FRACUNIT); - else - mobj->momz = FixedMul(FixedDiv((mobj->target->z + 70*FRACUNIT) - mobj->z, dist), 2*FRACUNIT); + mobj->momz = FixedMul(FixedDiv(destz - mobj->z, dist), 2*FRACUNIT); } else { @@ -9155,7 +9153,7 @@ void P_MobjThinker(mobj_t *mobj) } vdist = mobj->z - mobj->target->z - mobj->target->height; - if (vdist <= 0) + if (P_MobjFlip(mobj)*vdist <= 0) { P_SetTarget(&mobj->target, NULL); break; From 17a2d1071c082f5aaa282dfe3f8f47e9d2fbbb80 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 6 Oct 2019 10:30:22 +0200 Subject: [PATCH 32/50] Spawn big fern leaves relative to angle --- src/p_mobj.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 5bf4323c3..48d5474e9 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -10049,19 +10049,6 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) P_SetTarget(&mobj->tracer, P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_MINECARTENDSOLID)); mobj->tracer->angle = mobj->angle + ANGLE_90; break; - case MT_BIGFERN: - { - UINT8 i; - for (i = 0; i < 8; i++) - { - UINT8 j = (i + 2) % 8; - fixed_t xoffs = (j % 4) ? FRACUNIT : 0; - fixed_t yoffs = (i % 4) ? FRACUNIT : 0; - mobj_t *leaf = P_SpawnMobjFromMobj(mobj, (j > 3) ? -xoffs : xoffs, (i > 3) ? -yoffs : yoffs, 0, MT_BIGFERNLEAF); - leaf->angle = (angle_t)i * ANGLE_45; - } - break; - } case MT_TORCHFLOWER: { mobj_t *fire = P_SpawnMobjFromMobj(mobj, 0, 0, 46*FRACUNIT, MT_FLAME); @@ -12101,6 +12088,21 @@ ML_EFFECT5 : Don't stop thinking when too far away S_StartSound(mobj, sfx_s3kd3l); } break; + case MT_BIGFERN: + { + angle_t angle = FixedAngle((mthing->angle % 45) << FRACBITS); + UINT8 i; + for (i = 0; i < 8; i++) + { + UINT8 j = (i + 2) % 8; + fixed_t xoffs = (j % 4) ? FRACUNIT : 0; + fixed_t yoffs = (i % 4) ? FRACUNIT : 0; + mobj_t *leaf = P_SpawnMobjFromMobj(mobj, (j > 3) ? -xoffs : xoffs, (i > 3) ? -yoffs : yoffs, 0, MT_BIGFERNLEAF); + leaf->angle = angle; + angle += ANGLE_45; + } + break; + } default: break; } From defffd667eb661a89be4ce4d80c7902446752c5d Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 6 Oct 2019 14:18:27 +0200 Subject: [PATCH 33/50] Fixed and simplified the big fern leaf spawning code --- src/p_mobj.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 48d5474e9..1df7d5b97 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -12090,14 +12090,14 @@ ML_EFFECT5 : Don't stop thinking when too far away break; case MT_BIGFERN: { - angle_t angle = FixedAngle((mthing->angle % 45) << FRACBITS); + angle_t angle = FixedAngle(mthing->angle << FRACBITS); UINT8 i; for (i = 0; i < 8; i++) { - UINT8 j = (i + 2) % 8; - fixed_t xoffs = (j % 4) ? FRACUNIT : 0; - fixed_t yoffs = (i % 4) ? FRACUNIT : 0; - mobj_t *leaf = P_SpawnMobjFromMobj(mobj, (j > 3) ? -xoffs : xoffs, (i > 3) ? -yoffs : yoffs, 0, MT_BIGFERNLEAF); + angle_t fa = (angle >> ANGLETOFINESHIFT) & FINEMASK; + fixed_t xoffs = FINECOSINE(fa); + fixed_t yoffs = FINESINE(fa); + mobj_t *leaf = P_SpawnMobjFromMobj(mobj, xoffs, yoffs, 0, MT_BIGFERNLEAF); leaf->angle = angle; angle += ANGLE_45; } From 7850d4372533da2deb53252c24384d3e4753849c Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 7 Oct 2019 13:14:23 +0800 Subject: [PATCH 34/50] Let ridden rollout rocks collide with other players --- src/p_map.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index ed35b0cf1..9751856d0 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -985,7 +985,7 @@ static boolean PIT_CheckThing(mobj_t *thing) tmthing->player->powers[pw_carry] = CR_ROLLOUT; P_SetTarget(&tmthing->tracer, thing); P_SetObjectMomZ(thing, tmthing->momz, true); - return false; + return true; } } else if (tmthing->type == thing->type) @@ -1004,6 +1004,9 @@ static boolean PIT_CheckThing(mobj_t *thing) { if (tmthing->z > thing->z + thing->height || thing->z > tmthing->z + tmthing->height || !thing->health) return true; + + if (thing == tmthing->target) + return true; if (thing->flags & MF_SPRING) { @@ -1660,8 +1663,8 @@ static boolean PIT_CheckThing(mobj_t *thing) } } - if ((!tmthing->player) && (thing->player)) - ; // no solid thing should ever be able to step up onto a player + if ((tmthing->flags & MF_SPRING || tmthing->type == MT_STEAM) && (thing->player)) + ; // springs and gas jets should never be able to step up onto a player // z checking at last // Treat noclip things as non-solid! else if ((thing->flags & (MF_SOLID|MF_NOCLIP)) == MF_SOLID From 306779fac0e1d447b0dcda375278aacfa9c31823 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 7 Oct 2019 13:35:10 +0800 Subject: [PATCH 35/50] Readability changes --- src/p_map.c | 57 ++++++++++++++++++++++++----------------------------- 1 file changed, 26 insertions(+), 31 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 9751856d0..380f85ac3 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -963,41 +963,27 @@ static boolean PIT_CheckThing(mobj_t *thing) P_DamageMobj(thing, tmthing, tmthing, 1, 0); } - if (thing->type == MT_ROLLOUTROCK) + if (thing->type == MT_ROLLOUTROCK && tmthing->player) { - if (tmthing->player) + if (tmthing->player->powers[pw_carry] == CR_ROLLOUT) { - if (tmthing->player->powers[pw_carry] == CR_ROLLOUT) - { - return true; - } - if ((thing->flags & MF_PUSHABLE) // not carrying a player - && ((tmthing->eflags & MFE_VERTICALFLIP) == (thing->eflags & MFE_VERTICALFLIP)) - && (P_AproxDistance(thing->x - tmthing->x, thing->y - tmthing->y) < (thing->radius)) - && (P_MobjFlip(tmthing)*tmthing->momz <= 0) - && ((!(tmthing->eflags & MFE_VERTICALFLIP) && abs(thing->z + thing->height - tmthing->z) < (thing->height>>2)) - || (tmthing->eflags & MFE_VERTICALFLIP && abs(tmthing->z + tmthing->height - thing->z) < (thing->height>>2)))) - { - thing->flags &= ~MF_PUSHABLE; - P_SetTarget(&thing->target, tmthing); - P_ResetPlayer(tmthing->player); - P_SetPlayerMobjState(tmthing, S_PLAY_WALK); - tmthing->player->powers[pw_carry] = CR_ROLLOUT; - P_SetTarget(&tmthing->tracer, thing); - P_SetObjectMomZ(thing, tmthing->momz, true); - return true; - } + return true; } - else if (tmthing->type == thing->type) + if ((thing->flags & MF_PUSHABLE) // not carrying a player + && ((tmthing->eflags & MFE_VERTICALFLIP) == (thing->eflags & MFE_VERTICALFLIP)) + && (P_AproxDistance(thing->x - tmthing->x, thing->y - tmthing->y) < (thing->radius)) + && (P_MobjFlip(tmthing)*tmthing->momz <= 0) + && ((!(tmthing->eflags & MFE_VERTICALFLIP) && abs(thing->z + thing->height - tmthing->z) < (thing->height>>2)) + || (tmthing->eflags & MFE_VERTICALFLIP && abs(tmthing->z + tmthing->height - thing->z) < (thing->height>>2)))) { - if (tmthing->z > thing->z + thing->height || thing->z > tmthing->z + tmthing->height) - return true; - - fixed_t tempmomx = thing->momx, tempmomy = thing->momy; - thing->momx = tmthing->momx; - thing->momy = tmthing->momy; - tmthing->momx = tempmomx; - tmthing->momy = tempmomy; + thing->flags &= ~MF_PUSHABLE; + P_SetTarget(&thing->target, tmthing); + P_ResetPlayer(tmthing->player); + P_SetPlayerMobjState(tmthing, S_PLAY_WALK); + tmthing->player->powers[pw_carry] = CR_ROLLOUT; + P_SetTarget(&tmthing->tracer, thing); + P_SetObjectMomZ(thing, tmthing->momz, true); + return true; } } else if (tmthing->type == MT_ROLLOUTROCK) @@ -1007,6 +993,15 @@ static boolean PIT_CheckThing(mobj_t *thing) if (thing == tmthing->target) return true; + + if (thing->type == tmthing->type) + { + fixed_t tempmomx = thing->momx, tempmomy = thing->momy; + thing->momx = tmthing->momx; + thing->momy = tmthing->momy; + tmthing->momx = tempmomx; + tmthing->momy = tempmomy; + } if (thing->flags & MF_SPRING) { From bed9dff077637f2ed5881a26f7b481f252ae45e0 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 7 Oct 2019 13:36:36 +0800 Subject: [PATCH 36/50] Readability changes --- src/p_map.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 380f85ac3..734def202 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -976,7 +976,7 @@ static boolean PIT_CheckThing(mobj_t *thing) && ((!(tmthing->eflags & MFE_VERTICALFLIP) && abs(thing->z + thing->height - tmthing->z) < (thing->height>>2)) || (tmthing->eflags & MFE_VERTICALFLIP && abs(tmthing->z + tmthing->height - thing->z) < (thing->height>>2)))) { - thing->flags &= ~MF_PUSHABLE; + thing->flags &= ~MF_PUSHABLE; // prevent riding player from applying pushable movement logic P_SetTarget(&thing->target, tmthing); P_ResetPlayer(tmthing->player); P_SetPlayerMobjState(tmthing, S_PLAY_WALK); @@ -991,10 +991,21 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->z > thing->z + thing->height || thing->z > tmthing->z + tmthing->height || !thing->health) return true; - if (thing == tmthing->target) + if (thing == tmthing->target) // don't collide with rider return true; + + if (thing->flags & MF_SPRING) // bounce on springs + { + P_DoSpring(thing, tmthing); + return true; + } + else if (thing->flags & (MF_MONITOR|MF_SHOOTABLE) == (MF_MONITOR|MF_SHOOTABLE) && !(tmthing->flags & MF_PUSHABLE)) // pop monitors while carrying a player + { + P_KillMobj(thing, tmthing, tmthing->target, 0); + return true; + } - if (thing->type == tmthing->type) + if (thing->type == tmthing->type) // bounce against other rollout rocks { fixed_t tempmomx = thing->momx, tempmomy = thing->momy; thing->momx = tmthing->momx; @@ -1002,17 +1013,6 @@ static boolean PIT_CheckThing(mobj_t *thing) tmthing->momx = tempmomx; tmthing->momy = tempmomy; } - - if (thing->flags & MF_SPRING) - { - P_DoSpring(thing, tmthing); - return true; - } - else if (thing->flags & MF_MONITOR && thing->flags & MF_SHOOTABLE && !(tmthing->flags & MF_PUSHABLE)) // carrying a player - { - P_KillMobj(thing, tmthing, tmthing->target, 0); - return true; - } } if (thing->type == MT_PTERABYTE && tmthing->player) From bfb9bac5bdad44812484422ca3d062a2de76dac9 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 7 Oct 2019 14:51:32 +0800 Subject: [PATCH 37/50] Collision polish --- src/p_map.c | 14 ++++++++------ src/p_user.c | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 734def202..b62e33372 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -963,13 +963,14 @@ static boolean PIT_CheckThing(mobj_t *thing) P_DamageMobj(thing, tmthing, tmthing, 1, 0); } - if (thing->type == MT_ROLLOUTROCK && tmthing->player) + if (thing->type == MT_ROLLOUTROCK && tmthing->player && tmthing->health) { if (tmthing->player->powers[pw_carry] == CR_ROLLOUT) { return true; } if ((thing->flags & MF_PUSHABLE) // not carrying a player + && (tmthing->player->powers[pw_carry] == CR_NONE) // player is not already riding something && ((tmthing->eflags & MFE_VERTICALFLIP) == (thing->eflags & MFE_VERTICALFLIP)) && (P_AproxDistance(thing->x - tmthing->x, thing->y - tmthing->y) < (thing->radius)) && (P_MobjFlip(tmthing)*tmthing->momz <= 0) @@ -977,7 +978,7 @@ static boolean PIT_CheckThing(mobj_t *thing) || (tmthing->eflags & MFE_VERTICALFLIP && abs(tmthing->z + tmthing->height - thing->z) < (thing->height>>2)))) { thing->flags &= ~MF_PUSHABLE; // prevent riding player from applying pushable movement logic - P_SetTarget(&thing->target, tmthing); + P_SetTarget(&thing->tracer, tmthing); P_ResetPlayer(tmthing->player); P_SetPlayerMobjState(tmthing, S_PLAY_WALK); tmthing->player->powers[pw_carry] = CR_ROLLOUT; @@ -991,7 +992,7 @@ static boolean PIT_CheckThing(mobj_t *thing) if (tmthing->z > thing->z + thing->height || thing->z > tmthing->z + tmthing->height || !thing->health) return true; - if (thing == tmthing->target) // don't collide with rider + if (thing == tmthing->tracer) // don't collide with rider return true; if (thing->flags & MF_SPRING) // bounce on springs @@ -999,13 +1000,14 @@ static boolean PIT_CheckThing(mobj_t *thing) P_DoSpring(thing, tmthing); return true; } - else if (thing->flags & (MF_MONITOR|MF_SHOOTABLE) == (MF_MONITOR|MF_SHOOTABLE) && !(tmthing->flags & MF_PUSHABLE)) // pop monitors while carrying a player + else if ((thing->flags & (MF_MONITOR|MF_SHOOTABLE)) == (MF_MONITOR|MF_SHOOTABLE) && !(tmthing->flags & MF_PUSHABLE)) // pop monitors while carrying a player { - P_KillMobj(thing, tmthing, tmthing->target, 0); + P_KillMobj(thing, tmthing, tmthing->tracer, 0); return true; } - if (thing->type == tmthing->type) // bounce against other rollout rocks + if (thing->type == tmthing->type // bounce against other rollout rocks + && (tmthing->momx || tmthing->momy || thing->momx || thing->momy)) { fixed_t tempmomx = thing->momx, tempmomy = thing->momy; thing->momx = tmthing->momx; diff --git a/src/p_user.c b/src/p_user.c index 9d6f3f643..836d7935b 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -1036,7 +1036,7 @@ void P_ResetPlayer(player_t *player) if (player->mo->tracer && !P_MobjWasRemoved(player->mo->tracer)) { player->mo->tracer->flags |= MF_PUSHABLE; - P_SetTarget(&player->mo->tracer->target, NULL); + P_SetTarget(&player->mo->tracer->tracer, NULL); } P_SetTarget(&player->mo->tracer, NULL); player->powers[pw_carry] = CR_NONE; @@ -4321,7 +4321,7 @@ void P_DoJump(player_t *player, boolean soundandstate) player->mo->momz = 9*FRACUNIT + player->mo->tracer->momz; player->powers[pw_carry] = CR_NONE; player->mo->tracer->flags |= MF_PUSHABLE; - P_SetTarget(&player->mo->tracer->target, NULL); + P_SetTarget(&player->mo->tracer->tracer, NULL); P_SetTarget(&player->mo->tracer, NULL); } else if (player->mo->eflags & MFE_GOOWATER) From 95f6e2008f594f2223570ba0c35b728812f665c2 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 7 Oct 2019 15:25:32 +0800 Subject: [PATCH 38/50] Better rollout behavior in lava --- src/info.c | 2 +- src/p_enemy.c | 30 ++++++------------------------ src/p_user.c | 5 +++++ 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/info.c b/src/info.c index 2374c8515..5d82fe06e 100644 --- a/src/info.c +++ b/src/info.c @@ -2487,7 +2487,7 @@ state_t states[NUMSTATES] = // Rollout Rock {SPR_NULL, 0, 1, {A_RolloutSpawn}, 256*FRACUNIT, MT_ROLLOUTROCK, S_ROLLOUTSPAWN}, // S_ROLLOUTSPAWN - {SPR_PUMI, 0, 1, {A_RolloutRock}, 63*FRACUNIT/64, 6*FRACUNIT/10, S_ROLLOUTROCK}, // S_ROLLOUTROCK + {SPR_PUMI, 0, 1, {A_RolloutRock}, 63*FRACUNIT/64, 7*FRACUNIT/10, S_ROLLOUTROCK}, // S_ROLLOUTROCK // RVZ scenery {SPR_JPLA, FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_BIGFERNLEAF diff --git a/src/p_enemy.c b/src/p_enemy.c index e6ca4f2f1..cf074d176 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13958,36 +13958,18 @@ void A_RolloutRock(mobj_t *actor) UINT8 maxframes = actor->info->reactiontime; fixed_t pi = (22*FRACUNIT/7); fixed_t circumference = FixedMul(2 * pi, actor->radius); - fixed_t oldspeed = P_AproxDistance(actor->momx, actor->momy), newspeed, topspeed = actor->info->speed; + fixed_t speed = P_AproxDistance(actor->momx, actor->momy), topspeed = actor->info->speed; boolean inwater = actor->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER); actor->friction = FRACUNIT; if (inwater) { - fixed_t height; - if (actor->eflags & MFE_VERTICALFLIP) - { - height = actor->waterbottom + (actor->height>>2); - if (actor->z + actor->height > height) - { - actor->z = height; - actor->momz = 0; - } - } - else - { - height = actor->watertop - (actor->height>>2); - if (actor->z < height) - { - actor->z = height; - actor->momz = 0; - } - } + actor->momz = FixedMul(actor->momz, locvar2); actor->momz += P_MobjFlip(actor) * FixedMul(locvar2, actor->scale); } - if (oldspeed > topspeed) + if (speed > topspeed) { actor->momx = FixedMul(FixedDiv(actor->momx, oldspeed), topspeed); actor->momy = FixedMul(FixedDiv(actor->momy, oldspeed), topspeed); @@ -13996,14 +13978,14 @@ void A_RolloutRock(mobj_t *actor) actor->momx = FixedMul(actor->momx, locvar1); actor->momy = FixedMul(actor->momy, locvar1); - newspeed = P_AproxDistance(actor->momx, actor->momy); + speed = P_AproxDistance(actor->momx, actor->momy); - if (newspeed < actor->scale >> 1) + if (speed < actor->scale >> 1) { actor->momx = 0; actor->momy = 0; } - else if (newspeed > actor->scale) + else if (speed > actor->scale) { actor->angle = R_PointToAngle2(0, 0, actor->momx, actor->momy); actor->movefactor += newspeed; diff --git a/src/p_user.c b/src/p_user.c index 836d7935b..5bfb24df4 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -11919,6 +11919,11 @@ void P_PlayerAfterThink(player_t *player) mo->momx = rock->momx; mo->momy = rock->momy; mo->momz = 0; + + if (player->panim == PA_IDLE && (mo->momx || mo->momy)) + { + P_SetPlayerMobjState(player->mo, S_PLAY_WALK); + } if (player->panim == PA_WALK && mo->tics > walktics) { From c64997bfe5186da521f735c3186f8f0bbac386ec Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 7 Oct 2019 20:55:58 +0800 Subject: [PATCH 39/50] Add Ambush and Flip flag behaviors --- src/p_enemy.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index cf074d176..6fdb68ac4 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13935,6 +13935,8 @@ void A_RolloutSpawn(mobj_t *actor) || P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) > locvar1) { actor->target = P_SpawnMobj(actor->x, actor->y, actor->z, locvar2); + actor->target->flags2 |= (actor->flags2 & (MF2_AMBUSH | MF2_OBJECTFLIP)); + actor->target->eflags |= (actor->eflags & MFE_VERTICALFLIP); } } @@ -13958,12 +13960,12 @@ void A_RolloutRock(mobj_t *actor) UINT8 maxframes = actor->info->reactiontime; fixed_t pi = (22*FRACUNIT/7); fixed_t circumference = FixedMul(2 * pi, actor->radius); - fixed_t speed = P_AproxDistance(actor->momx, actor->momy), topspeed = actor->info->speed; + fixed_t speed = P_AproxDistance(actor->momx, actor->momy), topspeed = FixedMul(actor->info->speed, actor->scale); boolean inwater = actor->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER); actor->friction = FRACUNIT; - if (inwater) + if (inwater && !(actor->flags2 & MF2_AMBUSH)) { actor->momz = FixedMul(actor->momz, locvar2); actor->momz += P_MobjFlip(actor) * FixedMul(locvar2, actor->scale); @@ -13971,8 +13973,8 @@ void A_RolloutRock(mobj_t *actor) if (speed > topspeed) { - actor->momx = FixedMul(FixedDiv(actor->momx, oldspeed), topspeed); - actor->momy = FixedMul(FixedDiv(actor->momy, oldspeed), topspeed); + actor->momx = FixedMul(FixedDiv(actor->momx, speed), topspeed); + actor->momy = FixedMul(FixedDiv(actor->momy, speed), topspeed); } actor->momx = FixedMul(actor->momx, locvar1); @@ -13988,7 +13990,7 @@ void A_RolloutRock(mobj_t *actor) else if (speed > actor->scale) { actor->angle = R_PointToAngle2(0, 0, actor->momx, actor->momy); - actor->movefactor += newspeed; + actor->movefactor += speed; if (actor->movefactor > circumference / maxframes) { actor->reactiontime++; From 77dd5260abc3865a7e8bae446d7309703f5f6177 Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 7 Oct 2019 22:22:51 +0800 Subject: [PATCH 40/50] Allow rock to disappear if unridden for 12 seconds --- src/info.c | 4 ++-- src/p_enemy.c | 41 +++++++++++++++++++++++++++-------------- src/p_map.c | 1 + 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/src/info.c b/src/info.c index 5d82fe06e..3b99615d3 100644 --- a/src/info.c +++ b/src/info.c @@ -12860,10 +12860,10 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 1000, // spawnhealth S_NULL, // seestate sfx_None, // seesound - 8, // reactiontime + 8, // reactiontime (sets number of frames the rock cycles through) sfx_None, // attacksound S_NULL, // painstate - 0, // painchance + 12*TICRATE, // painchance (sets how long an unridden rock should last before disappearing - set to 0 to disable) sfx_None, // painsound S_NULL, // meleestate S_NULL, // missilestate diff --git a/src/p_enemy.c b/src/p_enemy.c index 6fdb68ac4..20b9f9b03 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13935,7 +13935,7 @@ void A_RolloutSpawn(mobj_t *actor) || P_AproxDistance(actor->x - actor->target->x, actor->y - actor->target->y) > locvar1) { actor->target = P_SpawnMobj(actor->x, actor->y, actor->z, locvar2); - actor->target->flags2 |= (actor->flags2 & (MF2_AMBUSH | MF2_OBJECTFLIP)); + actor->target->flags2 |= (actor->flags2 & (MF2_AMBUSH | MF2_OBJECTFLIP)) | MF2_SLIDEPUSH; actor->target->eflags |= (actor->eflags & MFE_VERTICALFLIP); } } @@ -13957,41 +13957,45 @@ void A_RolloutRock(mobj_t *actor) return; #endif - UINT8 maxframes = actor->info->reactiontime; + UINT8 maxframes = actor->info->reactiontime; // number of frames the mobj cycles through fixed_t pi = (22*FRACUNIT/7); - fixed_t circumference = FixedMul(2 * pi, actor->radius); + fixed_t circumference = FixedMul(2 * pi, actor->radius); // used to calculate when to change frame fixed_t speed = P_AproxDistance(actor->momx, actor->momy), topspeed = FixedMul(actor->info->speed, actor->scale); boolean inwater = actor->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER); - actor->friction = FRACUNIT; + actor->friction = FRACUNIT; // turns out riding on solids sucks, so let's just make it easier on ourselves - if (inwater && !(actor->flags2 & MF2_AMBUSH)) + if (inwater && !(actor->flags2 & MF2_AMBUSH)) // buoyancy in water (or lava) { actor->momz = FixedMul(actor->momz, locvar2); actor->momz += P_MobjFlip(actor) * FixedMul(locvar2, actor->scale); } - if (speed > topspeed) + if (speed > topspeed) // cap speed { actor->momx = FixedMul(FixedDiv(actor->momx, speed), topspeed); actor->momy = FixedMul(FixedDiv(actor->momy, speed), topspeed); } + + if (P_IsObjectOnGround(actor) || inwater) // apply drag to speed (compensates for lack of friction but also works in liquids) + { + actor->momx = FixedMul(actor->momx, locvar1); + actor->momy = FixedMul(actor->momy, locvar1); + } - actor->momx = FixedMul(actor->momx, locvar1); - actor->momy = FixedMul(actor->momy, locvar1); + speed = P_AproxDistance(actor->momx, actor->momy); // recalculate speed for visual rolling - speed = P_AproxDistance(actor->momx, actor->momy); - - if (speed < actor->scale >> 1) + if (speed < actor->scale >> 1) // stop moving if speed is insignificant { actor->momx = 0; actor->momy = 0; } else if (speed > actor->scale) { - actor->angle = R_PointToAngle2(0, 0, actor->momx, actor->momy); + actor->movecount = 1; // rock has moved; fuse should be set so we don't have a trillion rocks lying around + actor->angle = R_PointToAngle2(0, 0, actor->momx, actor->momy); // set rock's angle to movement direction actor->movefactor += speed; - if (actor->movefactor > circumference / maxframes) + if (actor->movefactor > circumference / maxframes) // if distance moved is enough to change frame, change it! { actor->reactiontime++; actor->reactiontime %= maxframes; @@ -13999,5 +14003,14 @@ void A_RolloutRock(mobj_t *actor) } } - actor->frame = actor->reactiontime % maxframes; + actor->frame = actor->reactiontime % maxframes; // set frame + + if (!(actor->flags & MF_PUSHABLE)) // if being ridden, don't disappear + actor->fuse = 0; + else if (!actor->fuse && actor->movecount == 1) // otherwise if rock has moved, set its fuse + actor->fuse = actor->info->painchance; + + if (actor->fuse && actor->fuse < 2*TICRATE) + actor->flags2 ^= MF2_DONTDRAW; + } diff --git a/src/p_map.c b/src/p_map.c index b62e33372..e470de240 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -978,6 +978,7 @@ static boolean PIT_CheckThing(mobj_t *thing) || (tmthing->eflags & MFE_VERTICALFLIP && abs(tmthing->z + tmthing->height - thing->z) < (thing->height>>2)))) { thing->flags &= ~MF_PUSHABLE; // prevent riding player from applying pushable movement logic + thing->flags2 &= ~MF2_DONTDRAW; // don't leave the rock invisible if it was flashing prior to boarding P_SetTarget(&thing->tracer, tmthing); P_ResetPlayer(tmthing->player); P_SetPlayerMobjState(tmthing, S_PLAY_WALK); From 3412eb655af5f6bf0309fc49ac3182dc7448457f Mon Sep 17 00:00:00 2001 From: lachwright Date: Mon, 7 Oct 2019 22:51:13 +0800 Subject: [PATCH 41/50] Colorize non-buoyant rollout rocks (MF2_AMBUSH distinguishability) --- src/p_enemy.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/p_enemy.c b/src/p_enemy.c index 20b9f9b03..6792623d3 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13937,6 +13937,12 @@ void A_RolloutSpawn(mobj_t *actor) actor->target = P_SpawnMobj(actor->x, actor->y, actor->z, locvar2); actor->target->flags2 |= (actor->flags2 & (MF2_AMBUSH | MF2_OBJECTFLIP)) | MF2_SLIDEPUSH; actor->target->eflags |= (actor->eflags & MFE_VERTICALFLIP); + + if (actor->target->flags2 & MF2_AMBUSH) + { + actor->target->color = SKINCOLOR_SUPERRUST3; + actor->target->colorized = true; + } } } From 8062422f131d708f9f57f8326e1456849ade2264 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Mon, 7 Oct 2019 19:11:36 +0200 Subject: [PATCH 42/50] Fixed wrong sound being played by Pyreflies with Ambush --- src/p_mobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 1df7d5b97..7aaec2721 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -12085,7 +12085,7 @@ ML_EFFECT5 : Don't stop thinking when too far away if (mthing->options & MTF_AMBUSH) { mobj->extravalue2 = 2; - S_StartSound(mobj, sfx_s3kd3l); + S_StartSound(mobj, sfx_s3kc2l); } break; case MT_BIGFERN: From 0fceb66e7160894a4a9217ecabb14c77064e5dd6 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Mon, 7 Oct 2019 22:23:52 +0200 Subject: [PATCH 43/50] Make the Pyrefly glowing and damaging in its fire-spawning state --- src/dehacked.c | 1 + src/info.c | 5 +++-- src/info.h | 1 + src/p_inter.c | 3 +++ src/p_mobj.c | 4 +++- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index aa52c9f82..9cc5b9b7f 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -4583,6 +4583,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // Pyre Fly "S_PYREFLY_FLY", + "S_PYREFLY_BURN", "S_PYREFIRE1", "S_PYREFIRE2", diff --git a/src/info.c b/src/info.c index 3b99615d3..4a02e1d0a 100644 --- a/src/info.c +++ b/src/info.c @@ -1177,7 +1177,8 @@ state_t states[NUMSTATES] = {SPR_CANG, 0|FF_TRANS90, 10, {NULL}, 0, 0, S_NULL}, // S_CANARIVOREGAS_8 // Pyre Fly - {SPR_PYRE, FF_ANIMATE, 8, {NULL}, 4, 2, S_PYREFLY_FLY}, // S_PYREFLY_FLY + {SPR_PYRE, FF_ANIMATE, -1, {NULL}, 3, 2, S_NULL}, // S_PYREFLY_FLY + {SPR_PYRE, 4|FF_ANIMATE|FF_FULLBRIGHT, -1, {NULL}, 3, 2, S_NULL}, // S_PYREFLY_BURN {SPR_FLAM, FF_FULLBRIGHT, 10, {NULL}, 0, 0, S_PYREFIRE2}, // S_PYREFIRE1 {SPR_FLAM, 1|FF_FULLBRIGHT, 10, {A_FireShrink}, 0, 16, S_NULL}, // S_PYREFIRE2 @@ -5041,7 +5042,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL, // painstate 0, // painchance sfx_None, // painsound - S_NULL, // meleestate + S_PYREFLY_BURN, // meleestate S_NULL, // missilestate S_XPLD_FLICKY, // deathstate S_NULL, // xdeathstate diff --git a/src/info.h b/src/info.h index ef6b05f13..aad778823 100644 --- a/src/info.h +++ b/src/info.h @@ -1339,6 +1339,7 @@ typedef enum state // Pyre Fly S_PYREFLY_FLY, + S_PYREFLY_BURN, S_PYREFIRE1, S_PYREFIRE2, diff --git a/src/p_inter.c b/src/p_inter.c index cbf8153b4..404335657 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -450,6 +450,9 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) } } break; + case MT_PYREFLY: + if (special->extravalue2 == 2 && P_DamageMobj(player->mo, special, special, 1, DMG_FIRE)) + return; default: break; } diff --git a/src/p_mobj.c b/src/p_mobj.c index 7aaec2721..107f9f0f7 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9081,7 +9081,6 @@ void P_MobjThinker(mobj_t *mobj) else if (mobj->extravalue2 == 2) { INT32 fireradius = min(100 - mobj->fuse, 52); - mobj->frame |= FF_FULLBRIGHT; P_PyreFlyBurn(mobj, P_RandomRange(0, fireradius)*FRACUNIT, 20, MT_FLAMEPARTICLE, 4*FRACUNIT); P_PyreFlyBurn(mobj, fireradius*FRACUNIT, 40, MT_PYREFLY_FIRE, 0); } @@ -9456,6 +9455,7 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s mobj->extravalue2 = (mobj->extravalue2 + 1) % 3; if (mobj->extravalue2 == 0) { + P_SetMobjState(mobj, mobj->info->spawnstate); mobj->fuse = 100; S_StopSound(mobj); S_StartSound(mobj, sfx_s3k8c); @@ -9467,6 +9467,7 @@ for (i = ((mobj->flags2 & MF2_STRONGBOX) ? strongboxamt : weakboxamt); i; --i) s } else { + P_SetMobjState(mobj, mobj->info->meleestate); mobj->fuse = 100; S_StopSound(mobj); S_StartSound(mobj, sfx_s3kc2l); @@ -12084,6 +12085,7 @@ ML_EFFECT5 : Don't stop thinking when too far away //start on fire if Ambush flag is set, otherwise behave normally if (mthing->options & MTF_AMBUSH) { + P_SetMobjState(mobj, mobj->info->meleestate); mobj->extravalue2 = 2; S_StartSound(mobj, sfx_s3kc2l); } From 788415a4dbe94f96dc4a396b6c5de4bd2c329c11 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Mon, 7 Oct 2019 22:33:06 +0200 Subject: [PATCH 44/50] Don't apply autobrake to Pterabyte-carried players --- src/p_map.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/p_map.c b/src/p_map.c index e470de240..ee91b42f8 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -515,6 +515,7 @@ static void P_DoPterabyteCarry(player_t *player, mobj_t *ptera) P_ResetPlayer(player); P_SetTarget(&player->mo->tracer, ptera); + player->pflags &= ~PF_APPLYAUTOBRAKE; player->powers[pw_carry] = CR_PTERABYTE; S_StartSound(player->mo, sfx_s3k4a); P_UnsetThingPosition(player->mo); From bc794a222734cfabf2b1b16af3efcf939a112565 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Tue, 8 Oct 2019 00:00:41 +0200 Subject: [PATCH 45/50] Players can jostle free from Pterabytes --- src/p_map.c | 1 + src/p_user.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index ee91b42f8..d17b5190c 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -523,6 +523,7 @@ static void P_DoPterabyteCarry(player_t *player, mobj_t *ptera) player->mo->y = ptera->y; P_SetThingPosition(player->mo); ptera->movefactor = 3*TICRATE; + ptera->watertop = ptera->waterbottom = ptera->cusval = 0; } static void P_DoTailsCarry(player_t *sonic, player_t *tails) diff --git a/src/p_user.c b/src/p_user.c index 5bfb24df4..696bfc3b2 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4291,7 +4291,14 @@ void P_DoJump(player_t *player, boolean soundandstate) return; if (player->powers[pw_carry] == CR_PTERABYTE) + { + S_StartSound(player->mo, sfx_s3kd7s); + player->mo->tracer->cusval += 10; + player->mo->tracer->watertop = P_RandomRange(-player->mo->tracer->cusval, player->mo->tracer->cusval) << (FRACBITS - 1); + player->mo->tracer->waterbottom = P_RandomRange(-player->mo->tracer->cusval, player->mo->tracer->cusval) << (FRACBITS - 1); + player->mo->tracer->cvmem = P_RandomRange(-player->mo->tracer->cusval, player->mo->tracer->cusval) << (FRACBITS - 1); return; + } // Jump this high. if (player->powers[pw_carry] == CR_PLAYER) @@ -11968,14 +11975,33 @@ void P_PlayerAfterThink(player_t *player) if (!ptera->movefactor) goto dropoff; - P_TryMove(player->mo, ptera->x, ptera->y, true); + if (ptera->cusval >= 50) + { + player->powers[pw_carry] = CR_NONE; + P_SetTarget(&player->mo->tracer, NULL); + P_KillMobj(ptera, player->mo, player->mo, 0); + player->mo->momz = 9*FRACUNIT; + player->pflags |= PF_APPLYAUTOBRAKE|PF_JUMPED|PF_THOKKED; + P_SetMobjState(player->mo, S_PLAY_ROLL); + break; + } + + if (ptera->cusval) + ptera->cusval--; + + P_TryMove(player->mo, ptera->x + ptera->watertop, ptera->y + ptera->waterbottom, true); + player->mo->z += ptera->cvmem; player->mo->momx = ptera->momx; player->mo->momy = ptera->momy; player->mo->momz = ptera->momz; - if (P_AproxDistance(player->mo->x - ptera->x, player->mo->y - ptera->y) > player->mo->radius) + if (P_AproxDistance(player->mo->x - ptera->x - ptera->watertop, player->mo->y - ptera->y - ptera->waterbottom) > player->mo->radius) goto dropoff; + ptera->watertop >>= 1; + ptera->waterbottom >>= 1; + ptera->cvmem >>= 1; + if (player->mo->state-states != S_PLAY_FALL) P_SetPlayerMobjState(player->mo, S_PLAY_FALL); break; From 43e13b38c9638626820bb39bfd8c2a6fc8a5b55c Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 8 Oct 2019 19:45:43 +0100 Subject: [PATCH 46/50] Change one of the Pyrefly captions. --- src/sounds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sounds.c b/src/sounds.c index 67cf81b53..cc4f59a0c 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -557,7 +557,7 @@ sfxinfo_t S_sfx[NUMSFX] = {"s3ka0", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Launch"}, {"s3ka1", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, {"s3ka2", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Launch"}, - {"s3ka3", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Lift"}, + {"s3ka3", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Rising charge"}, {"s3ka4", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Powering up"}, {"s3ka5", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, {"s3ka6", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Attraction fizzle"}, From 82fcdf4d43d591aff8ae1a2ab97adf73f5c5da79 Mon Sep 17 00:00:00 2001 From: lachwright Date: Wed, 9 Oct 2019 14:24:27 +0800 Subject: [PATCH 47/50] Make MT_PUMA not hurt players' ears when placed in groups or loading the map (new functionality for A_PlaySound) --- src/info.c | 2 +- src/p_enemy.c | 9 ++++++--- src/sounds.c | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/info.c b/src/info.c index b2e6d5689..889402add 100644 --- a/src/info.c +++ b/src/info.c @@ -3594,7 +3594,7 @@ state_t states[NUMSTATES] = // Puma (Mario fireball) {SPR_PUMA, FF_FULLBRIGHT|2, 1, {A_FishJump}, 0, MT_PUMATRAIL, S_PUMA_START2}, // S_PUMA_START1 - {SPR_PUMA, FF_FULLBRIGHT|2, 1, {A_PlaySound}, sfx_s3k70, 1, S_PUMA_UP1}, // S_PUMA_START2 + {SPR_PUMA, FF_FULLBRIGHT|2, 1, {A_PlaySound}, sfx_s3k70, 1 + (1<<16), S_PUMA_UP1}, // S_PUMA_START2 {SPR_PUMA, FF_FULLBRIGHT , 2, {A_FishJump}, 0, MT_PUMATRAIL, S_PUMA_UP2}, // S_PUMA_UP1 {SPR_PUMA, FF_FULLBRIGHT|1, 2, {A_FishJump}, 0, MT_PUMATRAIL, S_PUMA_UP3}, // S_PUMA_UP2 {SPR_PUMA, FF_FULLBRIGHT|2, 2, {A_FishJump}, 0, MT_PUMATRAIL, S_PUMA_UP1}, // S_PUMA_UP3 diff --git a/src/p_enemy.c b/src/p_enemy.c index 1d14ebfc9..4add7a576 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -8416,8 +8416,8 @@ void A_ChangeAngleAbsolute(mobj_t *actor) // // var1 = sound # to play // var2: -// 0 = Play sound without an origin -// 1 = Play sound using calling object as origin +// lower 16 bits = If 1, play sound using calling object as origin. If 0, play sound without an origin +// upper 16 bits = If 1, do not play sound during preticker. // void A_PlaySound(mobj_t *actor) { @@ -8428,7 +8428,10 @@ void A_PlaySound(mobj_t *actor) return; #endif - S_StartSound(locvar2 ? actor : NULL, locvar1); + if (leveltime < 2 && (locvar2 >> 16)) + return; + + S_StartSound((locvar2 & 65535) ? actor : NULL, locvar1); } // Function: A_FindTarget diff --git a/src/sounds.c b/src/sounds.c index cc4f59a0c..e5dfeec8a 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -506,7 +506,7 @@ sfxinfo_t S_sfx[NUMSFX] = {"s3k6d", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, ""}, {"s3k6e", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Mechanical damage"}, {"s3k6f", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Ominous rumbling"}, - {"s3k70", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Burst"}, + {"s3k70", true, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Burst"}, {"s3k71", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Basic Shield"}, {"s3k72", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Movement"}, {"s3k73", false, 64, 0, -1, NULL, 0, -1, -1, LUMPERROR, "Warp"}, From d553b6a0117ef3e30e60e194997570c7c3be7966 Mon Sep 17 00:00:00 2001 From: lachwright Date: Wed, 9 Oct 2019 15:06:50 +0800 Subject: [PATCH 48/50] Add sounds to rollout rock in lava --- src/p_enemy.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 4add7a576..81535c345 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -14236,8 +14236,22 @@ void A_RolloutRock(mobj_t *actor) if (inwater && !(actor->flags2 & MF2_AMBUSH)) // buoyancy in water (or lava) { + UINT8 flip = P_MobjFlip(actor); + fixed_t prevmomz = actor->momz; actor->momz = FixedMul(actor->momz, locvar2); - actor->momz += P_MobjFlip(actor) * FixedMul(locvar2, actor->scale); + actor->momz += flip * FixedMul(locvar2, actor->scale); + if (actor->threshold) + actor->threshold--; + if (flip*prevmomz < 0 && flip*actor->momz >= 0) + { + if (actor->eflags & MFE_UNDERWATER) + S_StartSound(actor, sfx_splash); + else if (!actor->threshold) + { + S_StartSound(actor, sfx_splish); + actor->threshold = max((topspeed - speed) >> FRACBITS, 0); + } + } } if (speed > topspeed) // cap speed From a01373741baaf95a4422db406235e2b4cc1ddae5 Mon Sep 17 00:00:00 2001 From: lachwright Date: Sat, 12 Oct 2019 04:35:51 +0800 Subject: [PATCH 49/50] Don't spam splash sounds on the rollout rock --- src/p_enemy.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 63b4f693c..f9c82bb60 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -14246,15 +14246,13 @@ void A_RolloutRock(mobj_t *actor) actor->momz += flip * FixedMul(locvar2, actor->scale); if (actor->threshold) actor->threshold--; - if (flip*prevmomz < 0 && flip*actor->momz >= 0) + if (flip*prevmomz < 0 && flip*actor->momz >= 0 && !actor->threshold) { if (actor->eflags & MFE_UNDERWATER) S_StartSound(actor, sfx_splash); else if (!actor->threshold) - { S_StartSound(actor, sfx_splish); - actor->threshold = max((topspeed - speed) >> FRACBITS, 0); - } + actor->threshold = max((topspeed - speed) >> FRACBITS, 8); } } From 3600e1b140de92bd733bacb916de6a273d99d172 Mon Sep 17 00:00:00 2001 From: lachwright Date: Sat, 12 Oct 2019 04:41:50 +0800 Subject: [PATCH 50/50] Allow rollout rock's splash sound delay reduction to occur above water --- src/p_enemy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index f9c82bb60..10251910e 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -14237,6 +14237,9 @@ void A_RolloutRock(mobj_t *actor) boolean inwater = actor->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER); actor->friction = FRACUNIT; // turns out riding on solids sucks, so let's just make it easier on ourselves + + if (actor->threshold) + actor->threshold--; if (inwater && !(actor->flags2 & MF2_AMBUSH)) // buoyancy in water (or lava) { @@ -14244,8 +14247,6 @@ void A_RolloutRock(mobj_t *actor) fixed_t prevmomz = actor->momz; actor->momz = FixedMul(actor->momz, locvar2); actor->momz += flip * FixedMul(locvar2, actor->scale); - if (actor->threshold) - actor->threshold--; if (flip*prevmomz < 0 && flip*actor->momz >= 0 && !actor->threshold) { if (actor->eflags & MFE_UNDERWATER)