From c1f51094bfdf8d3eb0a093da1c7acb1ef9ec30f4 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 7 Jul 2019 12:06:45 +0200 Subject: [PATCH 01/23] TNT barrels are no longer enemies, but still aimable for Fang --- src/info.c | 2 +- src/p_mobj.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/info.c b/src/info.c index 074e31ba2..ba57e6c04 100644 --- a/src/info.c +++ b/src/info.c @@ -11742,7 +11742,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 0, // damage sfx_None, // activesound - MF_SOLID|MF_SHOOTABLE|MF_ENEMY|MF_PUSHABLE, // flags + MF_SOLID|MF_SHOOTABLE|MF_PUSHABLE, // flags S_NULL // raisestate }, diff --git a/src/p_mobj.c b/src/p_mobj.c index 69550fa73..84a50b934 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9321,6 +9321,7 @@ mobj_t *P_SpawnMobj(fixed_t x, fixed_t y, fixed_t z, mobjtype_t type) } case MT_TNTBARREL: mobj->momx = 1; //stack hack + mobj->flags2 |= MF2_INVERTAIMABLE; break; case MT_MINECARTEND: mobj->tracer = P_SpawnMobjFromMobj(mobj, 0, 0, 0, MT_MINECARTENDSOLID); From 906103a184eec3b986e6f2e2220d2d5357ba41b5 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 7 Jul 2019 17:02:10 +0200 Subject: [PATCH 02/23] Fixed teetering on TNT barrels --- src/p_map.c | 69 ++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 33 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 86fa68ad8..046bf14e1 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -589,6 +589,41 @@ static void P_SlapStick(mobj_t *fang, mobj_t *pole) P_SetTarget(&pole->tracer, NULL); } +static void P_BarrelCollide(mobj_t *toucher, mobj_t *barrel) +{ + if (toucher->momz < 0) + { + if (toucher->z + toucher->momz > barrel->z + barrel->height) + return; + } + else + { + if (toucher->z > barrel->z + barrel->height) + return; + } + + if (toucher->momz > 0) + { + if (toucher->z + toucher->height + toucher->momz < barrel->z) + return; + } + else + { + if (toucher->z + toucher->height < barrel->z) + return; + } + + if ((toucher->player->pflags & (PF_SPINNING|PF_GLIDING)) + || ((toucher->player->pflags & PF_JUMPED) + && (!(toucher->player->pflags & PF_NOJUMPDAMAGE) + || (toucher->player->charability == CA_TWINSPIN && toucher->player->panim == PA_ABILITY))) + || (toucher->player->charability2 == CA2_MELEE && toucher->player->panim == PA_ABILITY2) + || ((toucher->player->charflags & SF_STOMPDAMAGE || toucher->player->pflags & PF_BOUNCING) + && (P_MobjFlip(toucher)*(toucher->z - (barrel->z + barrel->height/2)) > 0) && (P_MobjFlip(toucher)*toucher->momz < 0)) + || (((toucher->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (toucher->player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (toucher->player->pflags & PF_SHIELDABILITY))) + P_DamageMobj(barrel, toucher, toucher, 1, 0); +} + // // PIT_CheckThing // @@ -850,39 +885,7 @@ static boolean PIT_CheckThing(mobj_t *thing) } if (thing->type == MT_TNTBARREL && tmthing->player) - { - if (tmthing->momz < 0) - { - if (tmthing->z + tmthing->momz > thing->z + thing->height) - return true; - } - else - { - if (tmthing->z > thing->z + thing->height) - return true; - } - - if (tmthing->momz > 0) - { - if (tmthing->z + tmthing->height + tmthing->momz < thing->z) - return true; - } - else - { - if (tmthing->z + tmthing->height < thing->z) - return true; - } - - if ((tmthing->player->pflags & (PF_SPINNING | PF_GLIDING)) - || ((tmthing->player->pflags & PF_JUMPED) - && (!(tmthing->player->pflags & PF_NOJUMPDAMAGE) - || (tmthing->player->charability == CA_TWINSPIN && tmthing->player->panim == PA_ABILITY))) - || (tmthing->player->charability2 == CA2_MELEE && tmthing->player->panim == PA_ABILITY2) - || ((tmthing->player->charflags & SF_STOMPDAMAGE || tmthing->player->pflags & PF_BOUNCING) - && (P_MobjFlip(tmthing)*(tmthing->z - (thing->z + thing->height / 2)) > 0) && (P_MobjFlip(tmthing)*tmthing->momz < 0)) - || (((tmthing->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (tmthing->player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (tmthing->player->pflags & PF_SHIELDABILITY))) - P_DamageMobj(thing, tmthing, tmthing, 1, 0); - } + P_BarrelCollide(tmthing, thing); if (thing->type == MT_VULTURE && tmthing->type == MT_VULTURE) { From 1e5682d4a234780b680bea0ffcb698b6b70b46f4 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Wed, 10 Jul 2019 09:08:57 +0200 Subject: [PATCH 03/23] Used toaster's new P_PlayerCanDamage function for the barrel collision --- src/p_map.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 0c08e3de3..3ee9e59a2 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -604,7 +604,7 @@ static void P_SlapStick(mobj_t *fang, mobj_t *pole) P_SetTarget(&pole->tracer, NULL); } -static void P_BarrelCollide(mobj_t *toucher, mobj_t *barrel) +static void P_PlayerBarrelCollide(mobj_t *toucher, mobj_t *barrel) { if (toucher->momz < 0) { @@ -628,14 +628,7 @@ static void P_BarrelCollide(mobj_t *toucher, mobj_t *barrel) return; } - if ((toucher->player->pflags & (PF_SPINNING|PF_GLIDING)) - || ((toucher->player->pflags & PF_JUMPED) - && (!(toucher->player->pflags & PF_NOJUMPDAMAGE) - || (toucher->player->charability == CA_TWINSPIN && toucher->player->panim == PA_ABILITY))) - || (toucher->player->charability2 == CA2_MELEE && toucher->player->panim == PA_ABILITY2) - || ((toucher->player->charflags & SF_STOMPDAMAGE || toucher->player->pflags & PF_BOUNCING) - && (P_MobjFlip(toucher)*(toucher->z - (barrel->z + barrel->height/2)) > 0) && (P_MobjFlip(toucher)*toucher->momz < 0)) - || (((toucher->player->powers[pw_shield] & SH_NOSTACK) == SH_ELEMENTAL || (toucher->player->powers[pw_shield] & SH_NOSTACK) == SH_BUBBLEWRAP) && (toucher->player->pflags & PF_SHIELDABILITY))) + if (P_PlayerCanDamage(toucher->player, barrel)) P_DamageMobj(barrel, toucher, toucher, 1, 0); } @@ -921,7 +914,7 @@ static boolean PIT_CheckThing(mobj_t *thing) } if (thing->type == MT_TNTBARREL && tmthing->player) - P_BarrelCollide(tmthing, thing); + P_PlayerBarrelCollide(tmthing, thing); if (thing->type == MT_VULTURE && tmthing->type == MT_VULTURE) { From 9809e15033a722ab4b34a7155de126949a4339c8 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 24 Aug 2019 11:29:08 +0200 Subject: [PATCH 04/23] Green Snapper: Use TryMove instead of TeleportMove for the head, so it doesn't snap up to higher floors. --- src/p_enemy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index f33ce6810..1dc265676 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13325,7 +13325,8 @@ static void P_SnapperLegPlace(mobj_t *mo) fixed_t rad = mo->radius; INT32 necklen = (32*(mo->info->reactiontime - mo->reactiontime))/mo->info->reactiontime; // Not in FU - P_TeleportMove(seg, mo->x + FixedMul(c, rad) + necklen*c, mo->y + FixedMul(s, rad) + necklen*s, mo->z + mo->height/3); + P_TryMove(seg, mo->x + FixedMul(c, rad) + necklen*c, mo->y + FixedMul(s, rad) + necklen*s, true); + seg->z = mo->z + mo->height/3; seg->angle = a; // Move as many legs as available. From dbbb805e924c61b7858745c293d1dc407e41c9b3 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sat, 24 Aug 2019 20:23:28 +0200 Subject: [PATCH 05/23] Green Snapper: Update Z position of legs during movement --- src/p_enemy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 1dc265676..f61f2a09b 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13325,8 +13325,8 @@ static void P_SnapperLegPlace(mobj_t *mo) fixed_t rad = mo->radius; INT32 necklen = (32*(mo->info->reactiontime - mo->reactiontime))/mo->info->reactiontime; // Not in FU - P_TryMove(seg, mo->x + FixedMul(c, rad) + necklen*c, mo->y + FixedMul(s, rad) + necklen*s, true); seg->z = mo->z + mo->height/3; + P_TryMove(seg, mo->x + FixedMul(c, rad) + necklen*c, mo->y + FixedMul(s, rad) + necklen*s, true); seg->angle = a; // Move as many legs as available. @@ -13346,6 +13346,7 @@ static void P_SnapperLegPlace(mobj_t *mo) { x = c*o2 + s*o1; y = s*o2 - c*o1; + seg->z = mo->z; P_TryMove(seg, x0 + x, y0 + y, true); P_SetMobjState(seg, seg->info->raisestate); } From 592a98a3e84f295bbd3c9af715372c7bc8e4186c Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 30 Sep 2019 01:25:21 -0400 Subject: [PATCH 06/23] Fix the sky on the intro cutscene not scrolling. --- src/f_finale.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/f_finale.c b/src/f_finale.c index ee22ecb2f..7dc96163a 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -637,6 +637,7 @@ static void F_IntroDrawScene(void) } else { + menuanimtimer = animtimer; // Reusing this variable for the intro, better than changing the function around. F_SkyScroll(80*4, 0, "TITLESKY"); if (timetonext == 6) { From ebe99dad7a029d68e2581f85d894201bf8aa522b Mon Sep 17 00:00:00 2001 From: Steel Titanium Date: Mon, 30 Sep 2019 01:29:57 -0400 Subject: [PATCH 07/23] Make comment more clear --- src/f_finale.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/f_finale.c b/src/f_finale.c index 7dc96163a..e84d82279 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -637,7 +637,7 @@ static void F_IntroDrawScene(void) } else { - menuanimtimer = animtimer; // Reusing this variable for the intro, better than changing the function around. + menuanimtimer = animtimer; // Reusing this variable for the intro to fix the scrolling sky, better than changing the function around. F_SkyScroll(80*4, 0, "TITLESKY"); if (timetonext == 6) { From e75dee77479646372040f755d5c06f320055c563 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Mon, 30 Sep 2019 20:35:47 +0200 Subject: [PATCH 08/23] Fix various minus carrying bugs --- src/p_enemy.c | 29 ++++++++++++++++++++++++++--- src/p_inter.c | 13 +++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index f61f2a09b..0343c8bf6 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5177,20 +5177,28 @@ static mobj_t *minus; static boolean PIT_MinusCarry(mobj_t *thing) { + if (minus->tracer) + return true; + if (minus->type == thing->type) return true; - if (!(thing->flags & MF_SHOOTABLE) || !(thing->flags & MF_ENEMY)) + if (!(thing->flags & (MF_PUSHABLE|MF_ENEMY))) return true; - if (P_AproxDistance(minus->x - thing->x, minus->y - thing->y) >= minus->radius * 3) + if (P_AproxDistance(minus->x - thing->x, minus->y - thing->y) >= minus->radius*3) return true; if (abs(thing->z - minus->z) > minus->height) return true; P_SetTarget(&minus->tracer, thing); - minus->tracer->flags &= ~MF_PUSHABLE; + P_SetTarget(&thing->tracer, minus); + if (thing->flags & MF_PUSHABLE) + { + minus->flags2 |= MF2_STRONGBOX; + thing->flags &= ~MF_PUSHABLE; + } return true; } @@ -5276,7 +5284,15 @@ void A_MinusDigging(mobj_t *actor) if (P_TryMove(actor->tracer, actor->x, actor->y, false)) actor->tracer->z = mz; else + { + if (actor->flags2 & MF2_STRONGBOX) + { + actor->flags2 &= ~MF2_STRONGBOX; + actor->tracer->flags |= MF_PUSHABLE; + } + P_SetTarget(&actor->tracer->tracer, NULL); P_SetTarget(&actor->tracer, NULL); + } } } @@ -13096,6 +13112,13 @@ void A_TNTExplode(mobj_t *actor) if (LUA_CallAction("A_TNTExplode", actor)) return; #endif + + if (actor->tracer) + { + P_SetTarget(&actor->tracer->tracer, NULL); + P_SetTarget(&actor->tracer, NULL); + } + P_UnsetThingPosition(actor); if (sector_list) { diff --git a/src/p_inter.c b/src/p_inter.c index bdf88ff44..8b4629e2e 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2631,6 +2631,19 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget P_KillMobj(target->target, target, source, 0); break; + case MT_MINUS: + if (target->tracer) + { + if (target->flags2 & MF2_STRONGBOX) + { + target->flags2 &= ~MF2_STRONGBOX; + target->tracer->flags |= MF_PUSHABLE; + } + P_SetTarget(&target->tracer->tracer, NULL); + P_SetTarget(&target->tracer, NULL); + } + break; + case MT_PLAYER: { target->fuse = TICRATE*3; // timer before mobj disappears from view (even if not an actual player) From 0235d9e7ec4d0eec2104cc17a7c15b3866a8b3c8 Mon Sep 17 00:00:00 2001 From: toaster Date: Sat, 5 Oct 2019 13:21:35 +0100 Subject: [PATCH 09/23] Fix Saloon doors. * Make the center be the object stuff collides with, so that if the door is open people can't slip through. * Add an MF_AMBUSH enhancement to allow non-minecart players to travel through. * Make A_SaloonDoorSpawn more customisable. (var1 = object type, var2 = distance sides should be placed apart) --- src/dehacked.c | 4 ++-- src/info.c | 11 +++++------ src/info.h | 5 ++--- src/p_enemy.c | 52 +++++++++++++++++++++----------------------------- src/p_map.c | 28 +++++++++++++++++---------- 5 files changed, 49 insertions(+), 51 deletions(-) diff --git a/src/dehacked.c b/src/dehacked.c index 4cdffd5ed..b901b541e 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -5861,7 +5861,7 @@ static const char *const STATE_LIST[] = { // array length left dynamic for sanit // Saloon door "S_SALOONDOOR", - "S_SALOONDOORTHINKER", + "S_SALOONDOORCENTER", // Train cameo "S_TRAINCAMEOSPAWNER_1", @@ -7601,7 +7601,7 @@ static const char *const MOBJTYPE_LIST[] = { // array length left dynamic for s "MT_MINECARTSIDEMARK", "MT_MINECARTSPARK", "MT_SALOONDOOR", - "MT_SALOONDOORTHINKER", + "MT_SALOONDOORCENTER", "MT_TRAINCAMEOSPAWNER", "MT_TRAINSEG", "MT_TRAINDUSTSPAWNER", diff --git a/src/info.c b/src/info.c index 5fb4d3070..0553e32d5 100644 --- a/src/info.c +++ b/src/info.c @@ -263,7 +263,6 @@ char sprnames[NUMSPRITES + 1][5] = "ADST", // Arid dust "MCRT", // Minecart "MCSP", // Minecart spark - "NON2", // Saloon door thinker "SALD", // Saloon door "TRAE", // Train cameo locomotive "TRAI", // Train cameo wagon @@ -2462,8 +2461,8 @@ state_t states[NUMSTATES] = {SPR_MCSP, FF_FULLBRIGHT, 1, {A_MinecartSparkThink}, 0, 0, S_MINECARTSPARK}, // S_MINECARTSPARK // Saloon door - {SPR_SALD, 0|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_SALOONDOOR - {SPR_NON2, 0, -1, {A_SaloonDoorSpawn}, 0, 0, S_NULL}, // S_SALONDOORTHINKER + {SPR_SALD, 0|FF_PAPERSPRITE, -1, {NULL}, 0, 0, S_NULL}, // S_SALOONDOOR + {SPR_NULL, 0, -1, {A_SaloonDoorSpawn}, MT_SALOONDOOR, 48, S_NULL}, // S_SALOONDOORCENTER // Train cameo {SPR_NULL, 0, -1, {NULL}, 0, 0, S_TRAINCAMEOSPAWNER_2}, // S_TRAINCAMEOSPAWNER_1 @@ -12527,9 +12526,9 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = S_NULL // raisestate }, - { // MT_SALOONDOORTHINKER + { // MT_SALOONDOORCENTER 1221, // doomednum - S_SALOONDOORTHINKER, // spawnstate + S_SALOONDOORCENTER, // spawnstate 1, // spawnhealth S_NULL, // seestate sfx_None, // seesound @@ -12550,7 +12549,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 0, // damage sfx_None, // activesound - MF_NOGRAVITY|MF_RUNSPAWNFUNC, // flags + MF_SOLID|MF_NOGRAVITY|MF_RUNSPAWNFUNC|MF_PAPERCOLLISION|MF_NOCLIPHEIGHT, // flags S_NULL // raisestate }, diff --git a/src/info.h b/src/info.h index 79a191ccc..56e864298 100644 --- a/src/info.h +++ b/src/info.h @@ -511,7 +511,6 @@ typedef enum sprite SPR_ADST, // Arid dust SPR_MCRT, // Minecart SPR_MCSP, // Minecart spark - SPR_NON2, // Saloon door thinker SPR_SALD, // Saloon door SPR_TRAE, // Train cameo locomotive SPR_TRAI, // Train cameo wagon @@ -2576,7 +2575,7 @@ typedef enum state // Saloon door S_SALOONDOOR, - S_SALOONDOORTHINKER, + S_SALOONDOORCENTER, // Train cameo S_TRAINCAMEOSPAWNER_1, @@ -4338,7 +4337,7 @@ typedef enum mobj_type MT_MINECARTSIDEMARK, MT_MINECARTSPARK, MT_SALOONDOOR, - MT_SALOONDOORTHINKER, + MT_SALOONDOORCENTER, MT_TRAINCAMEOSPAWNER, MT_TRAINSEG, MT_TRAINDUSTSPAWNER, diff --git a/src/p_enemy.c b/src/p_enemy.c index 000b5cbfb..8f150a4e4 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13893,51 +13893,43 @@ void A_SnapperThinker(mobj_t *actor) // // Description: Spawns a saloon door. // -// var1 = unused -// var2 = unused +// var1 = mobjtype for sides +// var2 = distance sides should be placed apart // void A_SaloonDoorSpawn(mobj_t *actor) { + INT32 locvar1 = var1; + INT32 locvar2 = var2; angle_t ang = actor->angle; angle_t fa = (ang >> ANGLETOFINESHIFT) & FINEMASK; - fixed_t c = FINECOSINE(fa); - fixed_t s = FINESINE(fa); - INT32 d = 48; - fixed_t x = actor->x; - fixed_t y = actor->y; - fixed_t z = actor->z; + fixed_t c = FINECOSINE(fa)*locvar2; + fixed_t s = FINESINE(fa)*locvar2; mobj_t *door; + mobjflag2_t ambush = (actor->flags & MF2_AMBUSH); #ifdef HAVE_BLUA if (LUA_CallAction("A_SaloonDoorSpawn", actor)) return; #endif - //Front - door = P_SpawnMobj(x + c*d, y + s*d, z, MT_SALOONDOOR); + if (!locvar1) + return; + + // One door... + if (!(door = P_SpawnMobjFromMobj(actor, c, s, 0, locvar1))) return; door->angle = ang + ANGLE_180; + door->extravalue1 = AngleFixed(door->angle); // Origin angle + door->extravalue2 = 0; // Angular speed + P_SetTarget(&door->tracer, actor); // Origin door + door->flags2 |= ambush; // Can be opened by normal players? - // Origin angle - door->extravalue1 = AngleFixed(door->angle); - - // Angular speed - door->extravalue2 = 0; - - // Origin door - P_SetTarget(&door->tracer, actor); - - //Back - door = P_SpawnMobj(x - c*d, y - s*d, z, MT_SALOONDOOR); + // ...two door! + if (!(door = P_SpawnMobjFromMobj(actor, -c, -s, 0, locvar1))) return; door->angle = ang; - - // Origin angle - door->extravalue1 = AngleFixed(door->angle); - - // Angular speed - door->extravalue2 = 0; - - // Origin door - P_SetTarget(&door->tracer, actor); + door->extravalue1 = AngleFixed(door->angle); // Origin angle + door->extravalue2 = 0; // Angular speed + P_SetTarget(&door->tracer, actor); // Origin door + door->flags2 |= ambush; // Can be opened by normal players? } // Function: A_MinecartSparkThink diff --git a/src/p_map.c b/src/p_map.c index 8035d64a5..f187897aa 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -870,19 +870,27 @@ static boolean PIT_CheckThing(mobj_t *thing) } } - if (thing->type == MT_SALOONDOOR && tmthing->player) + if (thing->type == MT_SALOONDOOR) { - if (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer) && tmthing->tracer->health) + if (tmthing->player) { - fixed_t dx = tmthing->tracer->momx; - fixed_t dy = tmthing->tracer->momy; - fixed_t dm = min(FixedHypot(dx, dy), 16*FRACUNIT); - angle_t ang = R_PointToAngle2(0, 0, dx, dy) - thing->angle; - fixed_t s = FINESINE((ang >> ANGLETOFINESHIFT) & FINEMASK); - S_StartSound(tmthing, thing->info->activesound); - thing->extravalue2 += 2*FixedMul(s, dm)/3; - return true; + mobj_t *ref = (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer)) ? tmthing->tracer : tmthing; + if ((thing->flags & MF2_AMBUSH) || ref != tmthing) + { + fixed_t dm = min(FixedHypot(ref->momx, ref->momy), 16*FRACUNIT); + angle_t ang = R_PointToAngle2(0, 0, ref->momx, ref->momy) - thing->angle; + fixed_t s = FINESINE((ang >> ANGLETOFINESHIFT) & FINEMASK); + S_StartSound(tmthing, thing->info->activesound); + thing->extravalue2 += 2*FixedMul(s, dm)/3; + } } + return true; + } + + if (thing->type == MT_SALOONDOORCENTER && tmthing->player) + { + if ((thing->flags & MF2_AMBUSH) || (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer))) + return true; } if (thing->type == MT_TNTBARREL && tmthing->player) From df2600cbea624caff102a04cf1bc8e2a4dd497f3 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 6 Oct 2019 12:13:13 +0100 Subject: [PATCH 10/23] Resolve #208. * Tailsbots can't get into Minecarts. * Tailsbots will stop trying to move around when the player gets pw_carry, which usually means some sort of big gimmick is happening and trying to move along with it would make the tailsbot look stupid. --- src/b_bot.c | 5 ++++- src/p_inter.c | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/b_bot.c b/src/b_bot.c index 17211b353..e027ec03c 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -140,6 +140,9 @@ void B_BuildTiccmd(player_t *player, ticcmd_t *cmd) void B_KeysToTiccmd(mobj_t *mo, ticcmd_t *cmd, boolean forward, boolean backward, boolean left, boolean right, boolean strafeleft, boolean straferight, boolean jump, boolean spin) { + // don't try to do stuff if your sonic is in a minecart or something + if (players[consoleplayer].powers[pw_carry]) + return; // Turn the virtual keypresses into ticcmd_t. if (twodlevel || mo->flags2 & MF2_TWOD) { if (players[consoleplayer].climbing @@ -218,7 +221,7 @@ boolean B_CheckRespawn(player_t *player) return false; // Low ceiling, do not want! - if (sonic->ceilingz - sonic->z < 2*sonic->height) + if (sonic->ceilingz - sonic->z < (sonic->player->exiting ? 6 : 3)*sonic->height) // increased for new camera height return false; // If you're dead, wait a few seconds to respawn. diff --git a/src/p_inter.c b/src/p_inter.c index 403f36b53..3def80f51 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1765,7 +1765,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) return; case MT_MINECARTSPAWNER: - if (!special->fuse || player->powers[pw_carry] != CR_MINECART) + if (!player->bot && (special->fuse < TICRATE || player->powers[pw_carry] != CR_MINECART)) { mobj_t *mcart = P_SpawnMobj(special->x, special->y, special->z, MT_MINECART); P_SetTarget(&mcart->target, toucher); @@ -1775,7 +1775,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) P_ResetPlayer(player); player->pflags |= PF_JUMPDOWN; player->powers[pw_carry] = CR_MINECART; - toucher->player->pflags &= ~PF_APPLYAUTOBRAKE; + player->pflags &= ~PF_APPLYAUTOBRAKE; P_SetTarget(&toucher->tracer, mcart); toucher->momx = toucher->momy = toucher->momz = 0; From 93ce5bb94d249ec1f9e6e77b6dc7d2498c67ed0d Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 6 Oct 2019 12:14:18 +0100 Subject: [PATCH 11/23] Add solidity back to MT_SALOONDOOR, to work as a backup in case MT_SALOONDOORCENTER doesn't work (which it has issues with in one location in ACZ2 for some reason, and I can't identify why). Fully resolves #209, in any case. --- src/p_map.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index f187897aa..fbea6c271 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -870,21 +870,18 @@ static boolean PIT_CheckThing(mobj_t *thing) } } - if (thing->type == MT_SALOONDOOR) + if (thing->type == MT_SALOONDOOR && tmthing->player) { - if (tmthing->player) + mobj_t *ref = (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer)) ? tmthing->tracer : tmthing; + if ((thing->flags & MF2_AMBUSH) || ref != tmthing) { - mobj_t *ref = (tmthing->player->powers[pw_carry] == CR_MINECART && tmthing->tracer && !P_MobjWasRemoved(tmthing->tracer)) ? tmthing->tracer : tmthing; - if ((thing->flags & MF2_AMBUSH) || ref != tmthing) - { - fixed_t dm = min(FixedHypot(ref->momx, ref->momy), 16*FRACUNIT); - angle_t ang = R_PointToAngle2(0, 0, ref->momx, ref->momy) - thing->angle; - fixed_t s = FINESINE((ang >> ANGLETOFINESHIFT) & FINEMASK); - S_StartSound(tmthing, thing->info->activesound); - thing->extravalue2 += 2*FixedMul(s, dm)/3; - } + fixed_t dm = min(FixedHypot(ref->momx, ref->momy), 16*FRACUNIT); + angle_t ang = R_PointToAngle2(0, 0, ref->momx, ref->momy) - thing->angle; + fixed_t s = FINESINE((ang >> ANGLETOFINESHIFT) & FINEMASK); + S_StartSound(tmthing, thing->info->activesound); + thing->extravalue2 += 2*FixedMul(s, dm)/3; + return true; } - return true; } if (thing->type == MT_SALOONDOORCENTER && tmthing->player) From a5704238c7b37c588df0721dbb47621684fb271b Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 6 Oct 2019 14:34:25 +0100 Subject: [PATCH 12/23] Resolve #242 by adding SF_TRIGGERSPECIAL_HEADBUMP, enabled by ML_EFFECT2. Also, readd SF_INVERTPRECIP, which was done in a random branch last year and then lost because it was never merged. Enabled by ML_EFFECT1. --- src/p_mobj.c | 8 +-- src/p_spec.c | 180 ++++++++++++--------------------------------------- src/r_defs.h | 13 ++-- 3 files changed, 55 insertions(+), 146 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 5c4609f04..af959433c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -2369,9 +2369,9 @@ boolean P_CheckDeathPitCollide(mobj_t *mo) return false; if (((mo->z <= mo->subsector->sector->floorheight - && !(mo->eflags & MFE_VERTICALFLIP) && (mo->subsector->sector->flags & SF_FLIPSPECIAL_FLOOR)) + && ((mo->subsector->sector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(mo->eflags & MFE_VERTICALFLIP)) && (mo->subsector->sector->flags & SF_FLIPSPECIAL_FLOOR)) || (mo->z + mo->height >= mo->subsector->sector->ceilingheight - && (mo->eflags & MFE_VERTICALFLIP) && (mo->subsector->sector->flags & SF_FLIPSPECIAL_CEILING))) + && ((mo->subsector->sector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (mo->eflags & MFE_VERTICALFLIP)) && (mo->subsector->sector->flags & SF_FLIPSPECIAL_CEILING))) && (GETSECSPECIAL(mo->subsector->sector->special, 1) == 6 || GETSECSPECIAL(mo->subsector->sector->special, 1) == 7)) return true; @@ -10237,7 +10237,7 @@ void P_SpawnPrecipitation(void) if (curWeather == PRECIP_SNOW) { // Not in a sector with visible sky -- exception for NiGHTS. - if (!(maptol & TOL_NIGHTS) && precipsector->sector->ceilingpic != skyflatnum) + if ((!(maptol & TOL_NIGHTS) && (precipsector->sector->ceilingpic != skyflatnum)) == !(precipsector->sector->flags & SF_INVERTPRECIP)) continue; rainmo = P_SpawnSnowMobj(x, y, height, MT_SNOWFLAKE); @@ -10250,7 +10250,7 @@ void P_SpawnPrecipitation(void) else // everything else. { // Not in a sector with visible sky. - if (precipsector->sector->ceilingpic != skyflatnum) + if ((precipsector->sector->ceilingpic != skyflatnum) == !(precipsector->sector->flags & SF_INVERTPRECIP)) continue; rainmo = P_SpawnRainMobj(x, y, height, MT_RAIN); diff --git a/src/p_spec.c b/src/p_spec.c index 256ca3453..5b8e25050 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4174,26 +4174,11 @@ sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 n // Check the 3D floor's type... if (rover->flags & FF_BLOCKPLAYER) { + boolean floorallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z == topheight)); + boolean ceilingallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z + player->mo->height == bottomheight)); // Thing must be on top of the floor to be affected... - if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) - && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)) - { - if ((player->mo->eflags & MFE_VERTICALFLIP) || player->mo->z != topheight) - continue; - } - else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) - && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)) - { - if (!(player->mo->eflags & MFE_VERTICALFLIP) - || player->mo->z + player->mo->height != bottomheight) - continue; - } - else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH) - { - if (!((player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height == bottomheight) - || (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z == topheight))) - continue; - } + if (!(floorallowed || ceilingallowed)) + continue; } else { @@ -4234,26 +4219,11 @@ sector_t *P_PlayerTouchingSectorSpecial(player_t *player, INT32 section, INT32 n // Check the 3D floor's type... if (rover->flags & FF_BLOCKPLAYER) { + boolean floorallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z == topheight)); + boolean ceilingallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z + player->mo->height == bottomheight)); // Thing must be on top of the floor to be affected... - if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) - && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)) - { - if ((player->mo->eflags & MFE_VERTICALFLIP) || player->mo->z != topheight) - continue; - } - else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) - && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)) - { - if (!(player->mo->eflags & MFE_VERTICALFLIP) - || player->mo->z + player->mo->height != bottomheight) - continue; - } - else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH) - { - if (!((player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height == bottomheight) - || (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z == topheight))) - continue; - } + if (!(floorallowed || ceilingallowed)) + continue; } else { @@ -4304,26 +4274,11 @@ static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *tar // Check the 3D floor's type... if (rover->flags & FF_BLOCKPLAYER) { + boolean floorallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(mo->eflags & MFE_VERTICALFLIP)) && (mo->z == top)); + boolean ceilingallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (mo->eflags & MFE_VERTICALFLIP)) && (mo->z + mo->height == bottom)); // Thing must be on top of the floor to be affected... - if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) - && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)) - { - if ((mo->eflags & MFE_VERTICALFLIP) || mo->z != top) - return false; - } - else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) - && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)) - { - if (!(mo->eflags & MFE_VERTICALFLIP) - || mo->z + mo->height != bottom) - return false; - } - else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH) - { - if (!((mo->eflags & MFE_VERTICALFLIP && mo->z + mo->height == bottom) - || (!(mo->eflags & MFE_VERTICALFLIP) && mo->z == top))) - return false; - } + if (!(floorallowed || ceilingallowed)) + continue; } else { @@ -4345,10 +4300,10 @@ static boolean P_ThingIsOnThe3DFloor(mobj_t *mo, sector_t *sector, sector_t *tar // static boolean P_MobjReadyToTrigger(mobj_t *mo, sector_t *sec) { - if (mo->eflags & MFE_VERTICALFLIP) - return (mo->z+mo->height == P_GetSpecialTopZ(mo, sec, sec) && sec->flags & SF_FLIPSPECIAL_CEILING); - else - return (mo->z == P_GetSpecialBottomZ(mo, sec, sec) && sec->flags & SF_FLIPSPECIAL_FLOOR); + boolean floorallowed = ((sec->flags & SF_FLIPSPECIAL_FLOOR) && ((sec->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(mo->eflags & MFE_VERTICALFLIP)) && (mo->z == P_GetSpecialBottomZ(mo, sec, sec))); + boolean ceilingallowed = ((sec->flags & SF_FLIPSPECIAL_CEILING) && ((sec->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (mo->eflags & MFE_VERTICALFLIP)) && (mo->z + mo->height == P_GetSpecialTopZ(mo, sec, sec))); + // Thing must be on top of the floor to be affected... + return (floorallowed || ceilingallowed); } /** Applies a sector special to a player. @@ -5312,26 +5267,11 @@ sector_t *P_ThingOnSpecial3DFloor(mobj_t *mo) if (((rover->flags & FF_BLOCKPLAYER) && mo->player) || ((rover->flags & FF_BLOCKOTHERS) && !mo->player)) { + boolean floorallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(mo->eflags & MFE_VERTICALFLIP)) && (mo->z == topheight)); + boolean ceilingallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (mo->eflags & MFE_VERTICALFLIP)) && (mo->z + mo->height == bottomheight)); // Thing must be on top of the floor to be affected... - if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) - && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)) - { - if ((mo->eflags & MFE_VERTICALFLIP) || mo->z != topheight) - continue; - } - else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) - && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)) - { - if (!(mo->eflags & MFE_VERTICALFLIP) - || mo->z + mo->height != bottomheight) - continue; - } - else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH) - { - if (!((mo->eflags & MFE_VERTICALFLIP && mo->z + mo->height == bottomheight) - || (!(mo->eflags & MFE_VERTICALFLIP) && mo->z == topheight))) - continue; - } + if (!(floorallowed || ceilingallowed)) + continue; } else { @@ -5374,26 +5314,11 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector) // Check the 3D floor's type... if (rover->flags & FF_BLOCKPLAYER) { + boolean floorallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z == topheight)); + boolean ceilingallowed = ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) && ((rover->master->frontsector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z + player->mo->height == bottomheight)); // Thing must be on top of the floor to be affected... - if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR) - && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)) - { - if ((player->mo->eflags & MFE_VERTICALFLIP) || player->mo->z != topheight) - continue; - } - else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) - && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)) - { - if (!(player->mo->eflags & MFE_VERTICALFLIP) - || player->mo->z + player->mo->height != bottomheight) - continue; - } - else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH) - { - if (!((player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height == bottomheight) - || (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z == topheight))) - continue; - } + if (!(floorallowed || ceilingallowed)) + continue; } else { @@ -5450,38 +5375,16 @@ static void P_PlayerOnSpecial3DFloor(player_t *player, sector_t *sector) } if (!(po->flags & POF_TESTHEIGHT)) // Don't do height checking - { - } + ; else if (po->flags & POF_SOLID) { + boolean floorallowed = ((polysec->flags & SF_FLIPSPECIAL_FLOOR) && ((polysec->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z == polysec->ceilingheight)); + boolean ceilingallowed = ((polysec->flags & SF_FLIPSPECIAL_CEILING) && ((polysec->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z + player->mo->height == polysec->floorheight)); // Thing must be on top of the floor to be affected... - if ((polysec->flags & SF_FLIPSPECIAL_FLOOR) - && !(polysec->flags & SF_FLIPSPECIAL_CEILING)) + if (!(floorallowed || ceilingallowed)) { - if ((player->mo->eflags & MFE_VERTICALFLIP) || player->mo->z != polysec->ceilingheight) - { - po = (polyobj_t *)(po->link.next); - continue; - } - } - else if ((polysec->flags & SF_FLIPSPECIAL_CEILING) - && !(polysec->flags & SF_FLIPSPECIAL_FLOOR)) - { - if (!(player->mo->eflags & MFE_VERTICALFLIP) - || player->mo->z + player->mo->height != polysec->floorheight) - { - po = (polyobj_t *)(po->link.next); - continue; - } - } - else if (polysec->flags & SF_FLIPSPECIAL_BOTH) - { - if (!((player->mo->eflags & MFE_VERTICALFLIP && player->mo->z + player->mo->height == polysec->floorheight) - || (!(player->mo->eflags & MFE_VERTICALFLIP) && player->mo->z == polysec->ceilingheight))) - { - po = (polyobj_t *)(po->link.next); - continue; - } + po = (polyobj_t *)(po->link.next); + continue; } } else @@ -5580,17 +5483,13 @@ static void P_RunSpecialSectorCheck(player_t *player, sector_t *sector) f_affectpoint = P_GetSpecialBottomZ(player->mo, sector, sector); c_affectpoint = P_GetSpecialTopZ(player->mo, sector, sector); - // Only go further if on the ground - if ((sector->flags & SF_FLIPSPECIAL_FLOOR) && !(sector->flags & SF_FLIPSPECIAL_CEILING) && player->mo->z != f_affectpoint) - return; - - if ((sector->flags & SF_FLIPSPECIAL_CEILING) && !(sector->flags & SF_FLIPSPECIAL_FLOOR) && player->mo->z + player->mo->height != c_affectpoint) - return; - - if ((sector->flags & SF_FLIPSPECIAL_BOTH) - && player->mo->z != f_affectpoint - && player->mo->z + player->mo->height != c_affectpoint) - return; + { + boolean floorallowed = ((sector->flags & SF_FLIPSPECIAL_FLOOR) && ((sector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || !(player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z == f_affectpoint)); + boolean ceilingallowed = ((sector->flags & SF_FLIPSPECIAL_CEILING) && ((sector->flags & SF_TRIGGERSPECIAL_HEADBUMP) || (player->mo->eflags & MFE_VERTICALFLIP)) && (player->mo->z + player->mo->height == c_affectpoint)); + // Thing must be on top of the floor to be affected... + if (!(floorallowed || ceilingallowed)) + return; + } P_ProcessSpecialSector(player, sector, NULL); } @@ -6683,6 +6582,11 @@ void P_SpawnSpecials(INT32 fromnetsave) if (lines[i].flags & ML_EFFECT3) sectors[s].flags |= SF_TRIGGERSPECIAL_TOUCH; + if (lines[i].flags & ML_EFFECT2) + sectors[s].flags |= SF_TRIGGERSPECIAL_HEADBUMP; + + if (lines[i].flags & ML_EFFECT1) + sectors[s].flags |= SF_INVERTPRECIP; if (lines[i].frontsector && GETSECSPECIAL(lines[i].frontsector->special, 4) == 12) sectors[s].camsec = sides[*lines[i].sidenum].sector-sectors; diff --git a/src/r_defs.h b/src/r_defs.h index def7b46f3..6aeb0671c 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -263,10 +263,15 @@ typedef struct pslope_s typedef enum { - SF_FLIPSPECIAL_FLOOR = 1, - SF_FLIPSPECIAL_CEILING = 2, - SF_FLIPSPECIAL_BOTH = 3, - SF_TRIGGERSPECIAL_TOUCH = 4, + // flipspecial - planes with effect + SF_FLIPSPECIAL_FLOOR = 1, + SF_FLIPSPECIAL_CEILING = 1<<1, + SF_FLIPSPECIAL_BOTH = (SF_FLIPSPECIAL_FLOOR|SF_FLIPSPECIAL_CEILING), + // triggerspecial - conditions under which plane touch causes effect + SF_TRIGGERSPECIAL_TOUCH = 1<<2, + SF_TRIGGERSPECIAL_HEADBUMP = 1<<3, + // invertprecip - inverts presence of precipitation + SF_INVERTPRECIP = 1<<4, } sectorflags_t; // From 79b95a53ed8f267bffa11f3a33aeebddd1bb91ab Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 6 Oct 2019 15:04:04 +0100 Subject: [PATCH 13/23] Fix Snapper's head snapping to higher planes, and add gravflip support. --- src/info.c | 4 ++-- src/p_enemy.c | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/info.c b/src/info.c index 0553e32d5..a5292b2de 100644 --- a/src/info.c +++ b/src/info.c @@ -4779,7 +4779,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 0, // damage sfx_None, // activesound - MF_SCENERY|MF_PAIN|MF_NOCLIPHEIGHT|MF_NOBLOCKMAP|MF_NOGRAVITY, // flags + MF_SCENERY|MF_PAIN|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOBLOCKMAP|MF_NOGRAVITY, // flags S_SNAPPER_LEGRAISE // raisestate }, @@ -4806,7 +4806,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 0, // damage sfx_None, // activesound - MF_PAIN|MF_NOBLOCKMAP|MF_NOGRAVITY, // flags + MF_PAIN|MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOBLOCKMAP|MF_NOGRAVITY, // flags S_NULL // raisestate }, diff --git a/src/p_enemy.c b/src/p_enemy.c index 8f150a4e4..7804465ff 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -13668,8 +13668,6 @@ void A_KillSegments(mobj_t *actor) static void P_SnapperLegPlace(mobj_t *mo) { mobj_t *seg = mo->tracer; - fixed_t x0 = mo->x; - fixed_t y0 = mo->y; angle_t a = mo->angle; angle_t fa = (a >> ANGLETOFINESHIFT) & FINEMASK; fixed_t c = FINECOSINE(fa); @@ -13684,7 +13682,7 @@ static void P_SnapperLegPlace(mobj_t *mo) fixed_t rad = mo->radius; INT32 necklen = (32*(mo->info->reactiontime - mo->reactiontime))/mo->info->reactiontime; // Not in FU - P_TeleportMove(seg, mo->x + FixedMul(c, rad) + necklen*c, mo->y + FixedMul(s, rad) + necklen*s, mo->z + mo->height/3); + P_TeleportMove(seg, mo->x + FixedMul(c, rad) + necklen*c, mo->y + FixedMul(s, rad) + necklen*s, mo->z + ((mo->eflags & MFE_VERTICALFLIP) ? (((mo->height<<1)/3) - seg->height) : mo->height/3)); seg->angle = a; // Move as many legs as available. @@ -13704,13 +13702,13 @@ static void P_SnapperLegPlace(mobj_t *mo) { x = c*o2 + s*o1; y = s*o2 - c*o1; - P_TryMove(seg, x0 + x, y0 + y, true); + P_TeleportMove(seg, mo->x + x, mo->y + y, mo->z + (((mo->eflags & MFE_VERTICALFLIP) ? (mo->height - seg->height) : 0))); P_SetMobjState(seg, seg->info->raisestate); } else P_SetMobjState(seg, seg->info->spawnstate); - seg->angle = R_PointToAngle2(x0, y0, seg->x, seg->y); + seg->angle = R_PointToAngle2(mo->x, mo->y, seg->x, seg->y); seg = seg->tracer; } while (seg); @@ -13738,14 +13736,14 @@ void A_SnapperSpawn(mobj_t *actor) #endif // It spawns 1 head. - seg = P_SpawnMobj(actor->x, actor->y, actor->z, headtype); + seg = P_SpawnMobjFromMobj(actor, 0, 0, 0, headtype); P_SetTarget(&ptr->tracer, seg); ptr = seg; // It spawns 4 legs which will be handled in the thinker function. for (i = 1; i <= 4; i++) { - seg = P_SpawnMobj(actor->x, actor->y, actor->z, legtype); + seg = P_SpawnMobjFromMobj(actor, 0, 0, 0, legtype); P_SetTarget(&ptr->tracer, seg); ptr = seg; From cc87ba39c246d928a65cb7446bf670063bcce6d6 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 6 Oct 2019 15:11:00 +0100 Subject: [PATCH 14/23] There's code in B_RespawnBot that handles gravflip, but none in B_CheckRespawn. This commit fixes that. (Only done on this branch since bots had already been touched.) --- src/b_bot.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/b_bot.c b/src/b_bot.c index e027ec03c..651aeb03d 100644 --- a/src/b_bot.c +++ b/src/b_bot.c @@ -221,7 +221,12 @@ boolean B_CheckRespawn(player_t *player) return false; // Low ceiling, do not want! - if (sonic->ceilingz - sonic->z < (sonic->player->exiting ? 6 : 3)*sonic->height) // increased for new camera height + if (sonic->eflags & MFE_VERTICALFLIP) + { + if (sonic->z - sonic->floorz < (sonic->player->exiting ? 5 : 2)*sonic->height) + return false; + } + else if (sonic->ceilingz - sonic->z < (sonic->player->exiting ? 6 : 3)*sonic->height) return false; // If you're dead, wait a few seconds to respawn. @@ -255,11 +260,11 @@ void B_RespawnBot(INT32 playernum) y = sonic->y; if (sonic->eflags & MFE_VERTICALFLIP) { tails->eflags |= MFE_VERTICALFLIP; - z = sonic->z - FixedMul(512*FRACUNIT,sonic->scale); + z = sonic->z - (512*sonic->scale); if (z < sonic->floorz) z = sonic->floorz; } else { - z = sonic->z + sonic->height + FixedMul(512*FRACUNIT,sonic->scale); + z = sonic->z + sonic->height + (512*sonic->scale); if (z > sonic->ceilingz - sonic->height) z = sonic->ceilingz - sonic->height; } From aec5f26819f285d5cbdeaedf393fcca2ee40584b Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 6 Oct 2019 15:44:24 +0100 Subject: [PATCH 15/23] Fix entering an intangible FOF causing minecart derailment explosions. (Probably; I didn't get the bug to happen in the first place, but this looks like a likely culprit.) --- src/p_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_user.c b/src/p_user.c index e4792c107..c8d5ba877 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -10254,7 +10254,7 @@ static sector_t *P_GetMinecartSector(fixed_t x, fixed_t y, fixed_t z, fixed_t *n ffloor_t *rover; for (rover = sec->ffloors; rover; rover = rover->next) { - if (!(rover->flags & FF_EXISTS)) + if (!(rover->flags & (FF_EXISTS|FF_BLOCKOTHERS))) continue; *nz = *rover->t_slope ? P_GetZAt(*rover->t_slope, x, y) : *rover->topheight; From 8b1a20f4152c14a70257f718387ab4c3936f59fd Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 6 Oct 2019 16:04:19 +0100 Subject: [PATCH 16/23] Fix Minus causing crashes if it picks up a Snapper. --- src/p_enemy.c | 5 +++-- src/p_inter.c | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index f2ea9f867..1c044191e 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5359,7 +5359,6 @@ static boolean PIT_MinusCarry(mobj_t *thing) return true; P_SetTarget(&minus->tracer, thing); - P_SetTarget(&thing->tracer, minus); if (thing->flags & MF_PUSHABLE) { minus->flags2 |= MF2_STRONGBOX; @@ -5428,6 +5427,9 @@ void A_MinusDigging(mobj_t *actor) A_Chase(actor); // Carry over shit, maybe + if (P_MobjWasRemoved(actor->tracer) || !actor->tracer->health) + P_SetTarget(&actor->tracer, NULL); + if (!actor->tracer) { fixed_t radius = 3*actor->radius; @@ -5456,7 +5458,6 @@ void A_MinusDigging(mobj_t *actor) actor->flags2 &= ~MF2_STRONGBOX; actor->tracer->flags |= MF_PUSHABLE; } - P_SetTarget(&actor->tracer->tracer, NULL); P_SetTarget(&actor->tracer, NULL); } } diff --git a/src/p_inter.c b/src/p_inter.c index 3ece610e7..7f65d2d7a 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2689,7 +2689,6 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget target->flags2 &= ~MF2_STRONGBOX; target->tracer->flags |= MF_PUSHABLE; } - P_SetTarget(&target->tracer->tracer, NULL); P_SetTarget(&target->tracer, NULL); } break; From df172ee33f6a6a269e333e91eaacc1002a942ad3 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 6 Oct 2019 16:09:33 +0100 Subject: [PATCH 17/23] Fix Minus being intangible after it pops up. --- 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 1c044191e..00ce28e07 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5486,7 +5486,6 @@ void A_MinusPopup(mobj_t *actor) else actor->momz = 10*FRACUNIT; - actor->flags |= MF_SPECIAL|MF_SHOOTABLE; S_StartSound(actor, sfx_s3k82); for (i = 1; i <= num; i++) { @@ -5499,6 +5498,7 @@ void A_MinusPopup(mobj_t *actor) if (actor->tracer) P_DamageMobj(actor->tracer, actor, actor, 1, 0); + actor->flags = (actor->flags &~ MF_NOCLIPTHING)|MF_SPECIAL|MF_SHOOTABLE; } // Function: A_MinusCheck From d19aebb01a185011aeeb67ce0a7667341dc653a1 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 6 Oct 2019 16:15:13 +0100 Subject: [PATCH 18/23] * Fix Minus being intangible after launch. * Implement MS's temp bodge-fix for the TNT getting stuck on the player. --- src/p_enemy.c | 12 ------------ src/p_inter.c | 12 ------------ 2 files changed, 24 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 00ce28e07..2a5f2d46e 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5359,11 +5359,6 @@ static boolean PIT_MinusCarry(mobj_t *thing) return true; P_SetTarget(&minus->tracer, thing); - if (thing->flags & MF_PUSHABLE) - { - minus->flags2 |= MF2_STRONGBOX; - thing->flags &= ~MF_PUSHABLE; - } return true; } @@ -5452,14 +5447,7 @@ void A_MinusDigging(mobj_t *actor) if (P_TryMove(actor->tracer, actor->x, actor->y, false)) actor->tracer->z = mz; else - { - if (actor->flags2 & MF2_STRONGBOX) - { - actor->flags2 &= ~MF2_STRONGBOX; - actor->tracer->flags |= MF_PUSHABLE; - } P_SetTarget(&actor->tracer, NULL); - } } } diff --git a/src/p_inter.c b/src/p_inter.c index 7f65d2d7a..3def80f51 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -2681,18 +2681,6 @@ void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damaget P_KillMobj(target->target, target, source, 0); break; - case MT_MINUS: - if (target->tracer) - { - if (target->flags2 & MF2_STRONGBOX) - { - target->flags2 &= ~MF2_STRONGBOX; - target->tracer->flags |= MF_PUSHABLE; - } - P_SetTarget(&target->tracer, NULL); - } - break; - case MT_PLAYER: { target->fuse = TICRATE*3; // timer before mobj disappears from view (even if not an actual player) From a2f8b84b5a36a7a7e8cb2e9ec759e680a5f2fc7e Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 6 Oct 2019 16:17:11 +0100 Subject: [PATCH 19/23] Good catch by MS. --- src/p_enemy.c | 2 +- src/p_user.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_enemy.c b/src/p_enemy.c index 2a5f2d46e..26b28b0c9 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -5486,7 +5486,7 @@ void A_MinusPopup(mobj_t *actor) if (actor->tracer) P_DamageMobj(actor->tracer, actor, actor, 1, 0); - actor->flags = (actor->flags &~ MF_NOCLIPTHING)|MF_SPECIAL|MF_SHOOTABLE; + actor->flags = (actor->flags & ~MF_NOCLIPTHING)|MF_SPECIAL|MF_SHOOTABLE; } // Function: A_MinusCheck diff --git a/src/p_user.c b/src/p_user.c index c8d5ba877..a72a00a11 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8855,7 +8855,7 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius) continue; if (mo->type == MT_MINUS && !(mo->flags & (MF_SPECIAL|MF_SHOOTABLE))) - mo->flags |= MF_SPECIAL|MF_SHOOTABLE; + mo->flags = (mo->flags & ~MF_NOCLIPTHING)|MF_SPECIAL|MF_SHOOTABLE; if (mo->type == MT_EGGGUARD && mo->tracer) //nuke Egg Guard's shield! P_KillMobj(mo->tracer, inflictor, source, DMG_NUKE); From 058ed632de5e63e5f9108aa2d682ea1c2958f508 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 6 Oct 2019 19:53:54 +0200 Subject: [PATCH 20/23] Fixed solid objects (such as Minus-carried TNT barrels) not colliding with players. Springs and gas jets are exempt because all hell might break loose otherwise. --- src/p_map.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 161f5b14a..59a2f9b51 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1561,8 +1561,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 ((thing->flags & MF_SPRING || thing->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 fe2f3839970831491a2e58cf31f13462c0b15a10 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Mon, 7 Oct 2019 08:36:40 +0200 Subject: [PATCH 21/23] Fixed a typo --- 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 59a2f9b51..658f918f3 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1561,7 +1561,7 @@ static boolean PIT_CheckThing(mobj_t *thing) } } - if ((thing->flags & MF_SPRING || thing->type == MT_STEAM) && (thing->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! From 2113774a6a968c501945dcde9670277afdd139d0 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Mon, 7 Oct 2019 09:01:17 +0200 Subject: [PATCH 22/23] Don't deplete special stage timer in water if you have water protection --- src/p_tick.c | 2 +- src/st_stuff.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/p_tick.c b/src/p_tick.c index 7606510fe..6b5c7980c 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -482,7 +482,7 @@ static inline void P_DoSpecialStageStuff(void) countspheres += players[i].spheres; // If in water, deplete timer 6x as fast. - if (players[i].mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER)) + if (players[i].mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER) && !(players[i].powers[pw_shield] & SH_PROTECTWATER)) players[i].nightstime -= 5; if (--players[i].nightstime > 6) { diff --git a/src/st_stuff.c b/src/st_stuff.c index 20a132b3a..b9ca0850a 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -1857,7 +1857,8 @@ static void ST_drawNiGHTSHUD(void) numbersize = 48/2; if ((oldspecialstage && leveltime & 2) - && (stplyr->mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER))) + && (stplyr->mo->eflags & (MFE_TOUCHWATER|MFE_UNDERWATER)) + && !(stplyr->powers[pw_shield] & SH_PROTECTWATER)) col = SKINCOLOR_ORANGE; ST_DrawNightsOverlayNum((160 + numbersize)< Date: Mon, 7 Oct 2019 13:08:49 +0100 Subject: [PATCH 23/23] Change the time NiGHTS bumpers aren't responded to to 5 tics rather than 9. --- src/p_inter.c | 2 +- src/p_map.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 403f36b53..84dcbe403 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -1074,7 +1074,7 @@ void P_TouchSpecialThing(mobj_t *special, mobj_t *toucher, boolean heightcheck) if (player->exiting) return; - if (player->bumpertime < TICRATE/4) + if (player->bumpertime <= (TICRATE/2)-5) { S_StartSound(toucher, special->info->seesound); if (player->powers[pw_carry] == CR_NIGHTSMODE) diff --git a/src/p_map.c b/src/p_map.c index 8035d64a5..c3c5f6088 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -208,7 +208,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object) { angle_t nightsangle = 0; - if (object->player->bumpertime >= TICRATE/4) + if (object->player->bumpertime > (TICRATE/2)-5) return false; if ((object->player->pflags & PF_TRANSFERTOCLOSEST) && object->player->axis1 && object->player->axis2)