From f0683f05cabafcfcf4a673931731f0f380d899d9 Mon Sep 17 00:00:00 2001 From: NepDisk <16447892+NepDisk@users.noreply.github.com> Date: Fri, 16 Aug 2024 14:42:30 -0400 Subject: [PATCH] Restore MF_BOUNCE --- src/info.c | 54 ++++++++--------- src/k_collide.c | 2 +- src/p_map.c | 7 +++ src/p_mobj.c | 151 +++++++++++++++++++++++++----------------------- src/p_mobj.h | 3 +- 5 files changed, 115 insertions(+), 102 deletions(-) diff --git a/src/info.c b/src/info.c index 3dac340ea..3d39db131 100644 --- a/src/info.c +++ b/src/info.c @@ -12861,7 +12861,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_s3k64, // activesound - MF_SPECIAL, // flags + MF_SPECIAL|MF_BOUNCE, // flags S_NULL // raisestate }, @@ -12888,7 +12888,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_s3k64, // activesound - MF_SPECIAL, // flags + MF_SPECIAL|MF_BOUNCE, // flags S_NULL // raisestate }, @@ -12915,7 +12915,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_NORMAL, // mass 0, // damage sfx_None, // activesound - MF_SCENERY|MF_PAIN|MF_NOGRAVITY|MF_RUNSPAWNFUNC, // flags + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags S_NULL // raisestate }, @@ -12942,7 +12942,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_NORMAL, // mass 0, // damage sfx_None, // activesound - MF_SCENERY|MF_PAIN|MF_NOGRAVITY|MF_RUNSPAWNFUNC, // flags + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags S_NULL // raisestate }, @@ -12969,7 +12969,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_NORMAL, // mass 0, // damage sfx_None, // activesound - MF_SCENERY|MF_PAIN|MF_NOGRAVITY|MF_RUNSPAWNFUNC, // flags + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags S_NULL // raisestate }, @@ -12996,7 +12996,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_NORMAL, // mass 0, // damage sfx_None, // activesound - MF_SCENERY|MF_PAIN|MF_NOGRAVITY|MF_RUNSPAWNFUNC, // flags + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags S_NULL // raisestate }, @@ -13023,7 +13023,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_NORMAL, // mass 0, // damage sfx_None, // activesound - MF_SOLID|MF_SCENERY|MF_PAIN, // flags + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags S_NULL // raisestate }, @@ -13050,7 +13050,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_NORMAL, // mass 0, // damage sfx_None, // activesound - MF_SOLID|MF_SCENERY|MF_PAIN, // flags + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags S_NULL // raisestate }, @@ -13077,7 +13077,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_NORMAL, // mass 0, // damage sfx_None, // activesound - MF_SOLID|MF_SCENERY|MF_PAIN, // flags + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags S_NULL // raisestate }, @@ -13104,7 +13104,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_NORMAL, // mass 0, // damage sfx_None, // activesound - MF_SOLID|MF_SCENERY|MF_PAIN, // flags + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags S_NULL // raisestate }, @@ -13131,7 +13131,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_NORMAL, // mass 0, // damage sfx_None, // activesound - MF_SOLID|MF_SCENERY|MF_PAIN, // flags + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags S_NULL // raisestate }, @@ -13158,7 +13158,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_NORMAL, // mass 0, // damage sfx_None, // activesound - MF_SCENERY|MF_PAIN|MF_NOGRAVITY|MF_RUNSPAWNFUNC, // flags + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags S_NULL // raisestate }, @@ -13185,7 +13185,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_NORMAL, // mass 0, // damage sfx_None, // activesound - MF_SCENERY|MF_PAIN|MF_NOGRAVITY|MF_RUNSPAWNFUNC, // flags + MF_NOTHINK|MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY, // flags S_NULL // raisestate }, @@ -19517,7 +19517,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 1, // damage sfx_bnce1, // activesound - MF_NOBLOCKMAP|MF_MISSILE|MF_NOGRAVITY, // flags + MF_NOBLOCKMAP|MF_MISSILE|MF_BOUNCE|MF_NOGRAVITY, // flags S_NULL // raisestate }, @@ -19652,7 +19652,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 1, // damage sfx_s3k5d, // activesound - MF_NOBLOCKMAP|MF_MISSILE|MF_GRENADEBOUNCE, // flags + MF_NOBLOCKMAP|MF_MISSILE|MF_BOUNCE|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -19868,7 +19868,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 1, // damage sfx_mario1, // activesound - MF_SPECIAL|MF_SHOOTABLE, // flags + MF_SPECIAL|MF_SHOOTABLE|MF_BOUNCE, // flags S_NULL // raisestate }, @@ -21760,7 +21760,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 0, // damage sfx_rocks1, // activesound - MF_SOLID, // flags + MF_BOUNCE, // flags S_NULL // raisestate }, @@ -22922,7 +22922,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_cdfm28, // activesound - MF_SHOOTABLE|MF_DONTENCOREMAP|MF_APPLYTERRAIN, // flags + MF_BOUNCE|MF_SHOOTABLE|MF_DONTENCOREMAP|MF_APPLYTERRAIN, // flags S_NULL // raisestate }, @@ -22976,7 +22976,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_peel, // activesound - MF_SHOOTABLE|MF_DONTENCOREMAP|MF_APPLYTERRAIN, // flags + MF_BOUNCE|MF_SHOOTABLE|MF_DONTENCOREMAP|MF_APPLYTERRAIN, // flags S_NULL // raisestate }, @@ -23030,7 +23030,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_s3k96, // activesound - MF_SHOOTABLE|MF_DONTENCOREMAP|MF_APPLYTERRAIN, // flags + MF_BOUNCE|MF_SHOOTABLE|MF_DONTENCOREMAP|MF_APPLYTERRAIN, // flags S_NULL // raisestate }, @@ -23192,7 +23192,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_s3k5c, // activesound - MF_SHOOTABLE|MF_DONTENCOREMAP|MF_APPLYTERRAIN, // flags + MF_BOUNCE|MF_SHOOTABLE|MF_DONTENCOREMAP|MF_APPLYTERRAIN, // flags S_NULL // raisestate }, @@ -23273,7 +23273,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOGRAVITY|MF_SCENERY|MF_DONTENCOREMAP, // flags + MF_NOBLOCKMAP|MF_BOUNCE|MF_NOGRAVITY|MF_SCENERY|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, @@ -23300,7 +23300,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_SCENERY|MF_DONTENCOREMAP, // flags + MF_NOBLOCKMAP|MF_BOUNCE|MF_SCENERY|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, @@ -23354,7 +23354,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_s3k96, // activesound - MF_SPECIAL|MF_DONTENCOREMAP|MF_APPLYTERRAIN, // flags + MF_SPECIAL|MF_BOUNCE|MF_DONTENCOREMAP|MF_APPLYTERRAIN, // flags S_NULL // raisestate }, @@ -23408,7 +23408,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_None, // activesound - MF_SHOOTABLE|MF_DONTENCOREMAP|MF_APPLYTERRAIN, // flags + MF_SHOOTABLE|MF_BOUNCE|MF_DONTENCOREMAP|MF_APPLYTERRAIN, // flags S_NULL // raisestate }, @@ -23678,7 +23678,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_s3k5c, // activesound - MF_SHOOTABLE|MF_DONTENCOREMAP|MF_APPLYTERRAIN, // flags + MF_SHOOTABLE|MF_BOUNCE|MF_DONTENCOREMAP|MF_APPLYTERRAIN, // flags S_NULL // raisestate }, @@ -27919,7 +27919,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 0, // damage sfx_None, // activesound - MF_NOCLIPTHING|MF_GRENADEBOUNCE, // flags + MF_NOCLIPTHING|MF_BOUNCE|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, diff --git a/src/k_collide.c b/src/k_collide.c index 175b843b8..61bddb9b3 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -806,7 +806,7 @@ boolean K_FallingRockCollide(mobj_t *t1, mobj_t *t2) boolean K_SMKIceBlockCollide(mobj_t *t1, mobj_t *t2) { - if (!(t2->flags & MF_SOLID || t2->flags & MF_SHOOTABLE)) + if (!(t2->flags & MF_SOLID || t2->flags & MF_SHOOTABLE || t2->flags & MF_BOUNCE)) return true; if (!(t2->health)) diff --git a/src/p_map.c b/src/p_map.c index 3eb010f59..8af8e2bc1 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3658,6 +3658,13 @@ retry: 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_NOTBOUNCY)) // SRB2kart - All walls are bouncy unless specified otherwise + { + P_BounceMove(mo); + return; + } papercollision: // move up to the wall diff --git a/src/p_mobj.c b/src/p_mobj.c index 1517ff318..2728d9b54 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -11,6 +11,7 @@ /// \file p_mobj.c /// \brief Moving object handling. Spawn functions +#include "p_mobj.h" #include "d_netcmd.h" #include "doomdef.h" #include "doomtype.h" @@ -1608,6 +1609,66 @@ void P_XYMovement(mobj_t *mo) } } //} + else if (mo->flags & MF_BOUNCE) + { + P_BounceMove(mo); + if (P_MobjWasRemoved(mo)) + return; + xmove = ymove = 0; + S_StartSound(mo, mo->info->activesound); + + //{ SRB2kart - Orbinaut, Ballhog + // Ballhog dies on contact with walls + if (mo->type == MT_ORBINAUT || mo->type == MT_BALLHOG) + { + mobj_t *fx; + fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP); + if (mo->eflags & MFE_VERTICALFLIP) + fx->eflags |= MFE_VERTICALFLIP; + else + fx->eflags &= ~MFE_VERTICALFLIP; + fx->scale = mo->scale; + } + + switch (mo->type) + { + case MT_ORBINAUT: // Orbinaut speed decreasing + if (mo->health > 1) + { + S_StartSound(mo, mo->info->attacksound); + mo->health--; + // This prevents an item thrown at a wall from + // phasing through you on its return. + mo->threshold = 0; + } + /*FALLTHRU*/ + + case MT_JAWZ: + if (mo->health == 1) + { + // This Item Damage + S_StartSound(mo, mo->info->deathsound); + P_KillMobj(mo, NULL, NULL, DMG_NORMAL); + + P_SetObjectMomZ(mo, 8*FRACUNIT, false); + P_InstaThrust(mo, R_PointToAngle2(mo->x, mo->y, mo->x + xmove, mo->y + ymove)+ANGLE_90, 16*FRACUNIT); + } + break; + + case MT_BUBBLESHIELDTRAP: + S_StartSound(mo, sfx_s3k44); // Bubble bounce + break; + + case MT_DROPTARGET: + // This prevents an item thrown at a wall from + // phasing through you on its return. + mo->threshold = 0; + break; + + default: + break; + } + } else if (mo->flags & MF_MISSILE) { // explode a missile @@ -1667,79 +1728,14 @@ void P_XYMovement(mobj_t *mo) return; } } - else + if (mo->flags & MF_SLIDEME|MF_PUSHABLE) { - - { - if (mo->flags & MF_SLIDEME) - { - P_SlideMove(mo); - if (P_MobjWasRemoved(mo)) - return; - xmove = ymove = 0; - } - else - { - P_BounceMove(mo); - if (P_MobjWasRemoved(mo)) - return; - xmove = ymove = 0; - S_StartSound(mo, mo->info->activesound); - - //{ SRB2kart - Orbinaut, Ballhog - // Ballhog dies on contact with walls - if (mo->type == MT_ORBINAUT || mo->type == MT_BALLHOG) - { - mobj_t *fx; - fx = P_SpawnMobj(mo->x, mo->y, mo->z, MT_BUMP); - if (mo->eflags & MFE_VERTICALFLIP) - fx->eflags |= MFE_VERTICALFLIP; - else - fx->eflags &= ~MFE_VERTICALFLIP; - fx->scale = mo->scale; - } - - switch (mo->type) - { - case MT_ORBINAUT: // Orbinaut speed decreasing - if (mo->health > 1) - { - S_StartSound(mo, mo->info->attacksound); - mo->health--; - // This prevents an item thrown at a wall from - // phasing through you on its return. - mo->threshold = 0; - } - /*FALLTHRU*/ - - case MT_JAWZ: - if (mo->health == 1) - { - // This Item Damage - S_StartSound(mo, mo->info->deathsound); - P_KillMobj(mo, NULL, NULL, DMG_NORMAL); - - P_SetObjectMomZ(mo, 8*FRACUNIT, false); - P_InstaThrust(mo, R_PointToAngle2(mo->x, mo->y, mo->x + xmove, mo->y + ymove)+ANGLE_90, 16*FRACUNIT); - } - break; - - case MT_BUBBLESHIELDTRAP: - S_StartSound(mo, sfx_s3k44); // Bubble bounce - break; - - case MT_DROPTARGET: - // This prevents an item thrown at a wall from - // phasing through you on its return. - mo->threshold = 0; - break; - - default: - break; - } - } - } + P_SlideMove(mo); + if (P_MobjWasRemoved(mo)) + return; + xmove = ymove = 0; } + // } else moved = true; @@ -2224,7 +2220,7 @@ boolean P_ZMovement(mobj_t *mo) break; case MT_FLAMEJET: case MT_VERTICALFLAMEJET: - if (mo->flags & MF_SLIDEME) + if (mo->flags & MF_BOUNCE) return true; break; case MT_SPIKE: @@ -2860,7 +2856,7 @@ boolean P_SceneryZMovement(mobj_t *mo) { case MT_BOOMEXPLODE: case MT_BOOMPARTICLE: - if (!(mo->flags & MF_SLIDEME) && (mo->z <= mo->floorz || mo->z+mo->height >= mo->ceilingz)) + if (!(mo->flags & MF_BOUNCE) && (mo->z <= mo->floorz || mo->z+mo->height >= mo->ceilingz)) { // set standingslope P_TryMove(mo, mo->x, mo->y, true); @@ -12820,7 +12816,16 @@ static mobj_t *P_SpawnMobjFromMapThing(mapthing_t *mthing, fixed_t x, fixed_t y, P_SetAmbush(mobj); if (mthing->options & MTF_OBJECTSPECIAL) + { P_SetObjectSpecial(mobj); + + // Pushables bounce and slide coolly with object special flag set + if (mobj->flags & MF_PUSHABLE) + { + mobj->flags2 |= MF2_SLIDEPUSH; + mobj->flags |= MF_BOUNCE; + } + } } // Generic reverse gravity for individual objects flag. diff --git a/src/p_mobj.h b/src/p_mobj.h index b6109765d..1e9f6c3aa 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -159,7 +159,8 @@ typedef enum MF_DONTENCOREMAP = 1<<28, // Hitbox extends just as far below as above. MF_PICKUPFROMBELOW = 1<<29, - //free = 1<<30, + // Bounce off walls and things. + MF_BOUNCE = 1<<30, //free = (INT32)(1U<<31), // no more free slots, next up I suppose we can get rid of shit like MF_BOXICON? } mobjflag_t;