diff --git a/src/info.c b/src/info.c index ec7061340..501550db7 100644 --- a/src/info.c +++ b/src/info.c @@ -3756,7 +3756,7 @@ state_t states[NUMSTATES] = {SPR_SHLP, 1, 15, {NULL}, 0, 0, S_SHLEEP1}, // S_SHLEEP4 {SPR_SHLP, 3, 1, {A_Scream}, 0, 0, S_SHLEEPBOUNCE2}, // S_SHLEEPBOUNCE1 {SPR_SHLP, 3, 1, {A_ZThrust}, 9, 0, S_SHLEEPBOUNCE3}, // S_SHLEEPBOUNCE2 - {SPR_SHLP, 3, 400, {A_SetObjectFlags}, MF_SLIDEME|MF_ENEMY|MF_BOUNCE|MF_NOCLIP|MF_NOCLIPHEIGHT, 0, S_NULL}, // S_SHLEEPBOUNCE3 + {SPR_SHLP, 3, 400, {A_SetObjectFlags}, MF_SLIDEME|MF_ENEMY|MF_NOCLIP|MF_NOCLIPHEIGHT, 0, S_NULL}, // S_SHLEEPBOUNCE3 // Secret badniks and hazards, shhhh {SPR_PENG, 0, 2, {A_Look}, 0, 0, S_PENGUINATOR_LOOK}, // S_PENGUINATOR_LOOK @@ -5487,7 +5487,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_SPIKE, // mass 0, // damage sfx_s3kaa, // activesound - MF_ENEMY|MF_SPECIAL|MF_SHOOTABLE|MF_BOUNCE, // flags + MF_ENEMY|MF_SPECIAL|MF_SHOOTABLE, // flags S_NULL // raisestate }, @@ -7673,7 +7673,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 48*FRACUNIT, // damage sfx_s3k5d, // activesound - MF_NOBLOCKMAP|MF_MISSILE|MF_BOUNCE|MF_GRENADEBOUNCE, // flags + MF_NOBLOCKMAP|MF_MISSILE|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -7700,7 +7700,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 32*FRACUNIT, // damage sfx_s3k99, // activesound - MF_NOBLOCKMAP|MF_MISSILE|MF_BOUNCE, // flags + MF_NOBLOCKMAP|MF_MISSILE, // flags S_NULL // raisestate }, @@ -7890,7 +7890,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 0, // damage sfx_None, // activesound - MF_SLIDEME|MF_SPECIAL|MF_NOGRAVITY|MF_NOCLIPHEIGHT|MF_DONTENCOREMAP, // flags + MF_SPECIAL|MF_NOGRAVITY|MF_NOCLIPHEIGHT|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, @@ -7917,7 +7917,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 0, // damage sfx_None, // activesound - MF_SLIDEME|MF_BOUNCE|MF_SPECIAL|MF_DONTENCOREMAP, // flags + MF_SPECIAL|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, @@ -13338,7 +13338,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_s3k64, // activesound - MF_SPECIAL|MF_BOUNCE, // flags + MF_SPECIAL, // flags S_NULL // raisestate }, @@ -13365,7 +13365,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_s3k64, // activesound - MF_SPECIAL|MF_BOUNCE, // flags + MF_SPECIAL, // flags S_NULL // raisestate }, @@ -14148,7 +14148,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 0, // damage sfx_None, // activesound - MF_BOUNCE|MF_NOCLIPTHING|MF_GRENADEBOUNCE, // flags + MF_NOCLIPTHING|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -19994,7 +19994,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 1, // damage sfx_bnce1, // activesound - MF_NOBLOCKMAP|MF_MISSILE|MF_NOGRAVITY|MF_BOUNCE, // flags + MF_NOBLOCKMAP|MF_MISSILE|MF_NOGRAVITY, // flags S_NULL // raisestate }, @@ -20129,7 +20129,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 1, // damage sfx_s3k5d, // activesound - MF_NOBLOCKMAP|MF_MISSILE|MF_BOUNCE|MF_GRENADEBOUNCE, // flags + MF_NOBLOCKMAP|MF_MISSILE|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -20291,7 +20291,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = DMG_FIRE, // mass 1, // damage sfx_None, // activesound - MF_FIRE|MF_BOUNCE|MF_MISSILE, // flags + MF_FIRE|MF_MISSILE, // flags S_NULL // raisestate }, @@ -20345,7 +20345,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 1, // damage sfx_mario1, // activesound - MF_SPECIAL|MF_SHOOTABLE|MF_BOUNCE, // flags + MF_SPECIAL|MF_SHOOTABLE, // flags S_NULL // raisestate }, @@ -22237,7 +22237,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 0, // damage sfx_rocks1, // activesound - MF_SOLID|MF_BOUNCE, // flags + MF_SOLID, // flags S_NULL // raisestate }, @@ -23048,7 +23048,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_DONTENCOREMAP|MF_GRENADEBOUNCE|MF_BOUNCE, // flags + MF_NOBLOCKMAP|MF_DONTENCOREMAP|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, @@ -23399,7 +23399,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_cdfm28, // activesound - MF_BOUNCE|MF_SHOOTABLE|MF_DONTENCOREMAP, // flags + MF_SHOOTABLE|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, @@ -23453,7 +23453,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_peel, // activesound - MF_BOUNCE|MF_SHOOTABLE|MF_DONTENCOREMAP, // flags + MF_SHOOTABLE|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, @@ -23507,7 +23507,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_s3k96, // activesound - MF_SHOOTABLE|MF_BOUNCE|MF_DONTENCOREMAP, // flags + MF_SHOOTABLE|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, @@ -23669,7 +23669,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_s3k5c, // activesound - MF_BOUNCE|MF_SHOOTABLE|MF_DONTENCOREMAP, // flags + MF_SHOOTABLE|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, @@ -23804,7 +23804,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_NOGRAVITY|MF_BOUNCE|MF_SCENERY|MF_DONTENCOREMAP, // flags + MF_NOBLOCKMAP|MF_NOGRAVITY|MF_SCENERY|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, @@ -23831,7 +23831,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 0, // mass 0, // damage sfx_None, // activesound - MF_NOBLOCKMAP|MF_BOUNCE|MF_SCENERY|MF_DONTENCOREMAP, // flags + MF_NOBLOCKMAP|MF_SCENERY|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, @@ -23858,7 +23858,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_None, // activesound - MF_SHOOTABLE|MF_BOUNCE|MF_DONTENCOREMAP, // flags + MF_SHOOTABLE|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, @@ -24101,7 +24101,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 16, // mass 0, // damage sfx_None, // activesound - MF_SPECIAL|MF_BOUNCE|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags + MF_SPECIAL|MF_NOGRAVITY|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, @@ -24128,7 +24128,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 1, // damage sfx_s3k5c, // activesound - MF_BOUNCE|MF_SHOOTABLE|MF_DONTENCOREMAP, // flags + MF_SHOOTABLE|MF_DONTENCOREMAP, // flags S_NULL // raisestate }, @@ -28288,7 +28288,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = 100, // mass 0, // damage sfx_None, // activesound - MF_NOCLIPTHING|MF_BOUNCE|MF_GRENADEBOUNCE, // flags + MF_NOCLIPTHING|MF_GRENADEBOUNCE, // flags S_NULL // raisestate }, diff --git a/src/k_collide.c b/src/k_collide.c index 35db892b0..6ebdf650b 100644 --- a/src/k_collide.c +++ b/src/k_collide.c @@ -381,7 +381,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 || t2->flags & MF_BOUNCE)) + if (!(t2->flags & MF_SOLID || t2->flags & MF_SHOOTABLE)) return true; if (!(t2->health)) diff --git a/src/p_enemy.c b/src/p_enemy.c index 06fb048ac..a9fdd1454 100644 --- a/src/p_enemy.c +++ b/src/p_enemy.c @@ -14045,7 +14045,7 @@ void A_KillSegments(mobj_t *actor) mobj_t *kseg = seg; seg = seg->tracer; - kseg->flags = MF_NOBLOCKMAP|MF_BOUNCE; + kseg->flags = MF_NOBLOCKMAP; kseg->flags2 = 0; kseg->fuse = fuse; P_Thrust(kseg, R_PointToAngle2(actor->x, actor->y, kseg->x, kseg->y), 3*actor->scale); diff --git a/src/p_mobj.c b/src/p_mobj.c index 26a185b12..b35998411 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -1527,136 +1527,6 @@ void P_XYMovement(mobj_t *mo) } } //} - else if (mo->flags & MF_BOUNCE) - { - P_BounceMove(mo); - xmove = ymove = 0; - S_StartSound(mo, mo->info->activesound); - - //{ SRB2kart - Orbinaut, Ballhog - // Bump sparks - 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; - } - - if (mo->type == MT_ORBINAUT) // Orbinaut speed decreasing - { - if (mo->health > 1) - { - S_StartSound(mo, mo->info->attacksound); - mo->health--; - mo->threshold = 0; - } - else if (mo->health == 1) - { - // This Item Damage - S_StartSound(mo, mo->info->deathsound); - P_KillMobj(mo, NULL, NULL, 0); - - 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); - } - } - - // Bubble bounce - if (mo->type == MT_BUBBLESHIELDTRAP) - S_StartSound(mo, sfx_s3k44); - //} - - // Bounce ring algorithm - if (mo->type == MT_THROWNBOUNCE) - { - mo->threshold++; - - // Gain lower amounts of time on each bounce. - if (mo->fuse && mo->threshold < 5) - mo->fuse += ((5 - mo->threshold) * TICRATE); - - // Check for hit against sky here - if (P_CheckSkyHit(mo)) - { - // Hack to prevent missiles exploding - // against the sky. - // Does not handle sky floors. - // Check frontsector as well. - - P_RemoveMobj(mo); - return; - } - } - } - else if (mo->flags & MF_STICKY) - { - S_StartSound(mo, mo->info->activesound); - mo->momx = mo->momy = mo->momz = 0; //Full stop! - mo->flags |= MF_NOGRAVITY; //Stay there! - mo->flags &= ~MF_STICKY; //Don't check again! - - // Check for hit against sky here - if (P_CheckSkyHit(mo)) - { - // Hack to prevent missiles exploding - // against the sky. - // Does not handle sky floors. - // Check frontsector as well. - - P_RemoveMobj(mo); - return; - } - } - else if (player || mo->flags & (MF_SLIDEME|MF_PUSHABLE)) - { // try to slide along it - // Wall transfer part 1. - pslope_t *transferslope = NULL; - fixed_t transfermomz = 0; - if (oldslope && (P_MobjFlip(mo)*(predictedz - mo->z) > 0)) // Only for moving up (relative to gravity), otherwise there's a failed launch when going down slopes and hitting walls - { - transferslope = ((mo->standingslope) ? mo->standingslope : oldslope); - if (((transferslope->zangle < ANGLE_180) ? transferslope->zangle : InvAngle(transferslope->zangle)) >= ANGLE_45) // Prevent some weird stuff going on on shallow slopes. - transfermomz = P_GetWallTransferMomZ(mo, transferslope); - } - - P_SlideMove(mo); - - if (player) - player->powers[pw_pushing] = 3; - xmove = ymove = 0; - - // Wall transfer part 2. - if (transfermomz && transferslope) // Are we "transferring onto the wall" (really just a disguised vertical launch)? - { - angle_t relation; // Scale transfer momentum based on how head-on it is to the slope. - if (mo->momx || mo->momy) // "Guess" the angle of the wall you hit using new momentum - relation = transferslope->xydirection - R_PointToAngle2(0, 0, mo->momx, mo->momy); - else // Give it for free, I guess. - relation = ANGLE_90; - transfermomz = FixedMul(transfermomz, - abs(FINESINE((relation >> ANGLETOFINESHIFT) & FINEMASK))); - if (P_MobjFlip(mo)*(transfermomz - mo->momz) > 2*FRACUNIT) // Do the actual launch! - { - mo->momz = transfermomz; - mo->standingslope = NULL; - if (player) - { - player->powers[pw_justlaunched] = 2; - if (player->pflags & PF_SPINNING) - player->pflags |= PF_THOKKED; - } - } - } - } - else if (mo->type == MT_SPINFIRE) - { - P_RemoveMobj(mo); - return; - } else if (mo->flags & MF_MISSILE) { // explode a missile @@ -1697,8 +1567,125 @@ void P_XYMovement(mobj_t *mo) P_ExplodeMissile(mo); return; } + else if (mo->flags & MF_STICKY) + { + S_StartSound(mo, mo->info->activesound); + mo->momx = mo->momy = mo->momz = 0; //Full stop! + mo->flags |= MF_NOGRAVITY; //Stay there! + mo->flags &= ~MF_STICKY; //Don't check again! + + // Check for hit against sky here + if (P_CheckSkyHit(mo)) + { + // Hack to prevent missiles exploding + // against the sky. + // Does not handle sky floors. + // Check frontsector as well. + + P_RemoveMobj(mo); + return; + } + } else - mo->momx = mo->momy = 0; + { + boolean walltransferred = false; + + if (player || mo->flags & MF_SLIDEME) + { // try to slide along it + // Wall transfer part 1. + pslope_t *transferslope = NULL; + fixed_t transfermomz = 0; + if (oldslope && (P_MobjFlip(mo)*(predictedz - mo->z) > 0)) // Only for moving up (relative to gravity), otherwise there's a failed launch when going down slopes and hitting walls + { + transferslope = ((mo->standingslope) ? mo->standingslope : oldslope); + if (((transferslope->zangle < ANGLE_180) ? transferslope->zangle : InvAngle(transferslope->zangle)) >= ANGLE_45) // Prevent some weird stuff going on on shallow slopes. + transfermomz = P_GetWallTransferMomZ(mo, transferslope); + } + + // Wall transfer part 2. + if (transfermomz && transferslope) // Are we "transferring onto the wall" (really just a disguised vertical launch)? + { + angle_t relation; // Scale transfer momentum based on how head-on it is to the slope. + + walltransferred = true; + + P_SlideMove(mo); + + if (player) + player->powers[pw_pushing] = 3; + xmove = ymove = 0; + + if (mo->momx || mo->momy) // "Guess" the angle of the wall you hit using new momentum + relation = transferslope->xydirection - R_PointToAngle2(0, 0, mo->momx, mo->momy); + else // Give it for free, I guess. + relation = ANGLE_90; + transfermomz = FixedMul(transfermomz, + abs(FINESINE((relation >> ANGLETOFINESHIFT) & FINEMASK))); + if (P_MobjFlip(mo)*(transfermomz - mo->momz) > 2*FRACUNIT) // Do the actual launch! + { + mo->momz = transfermomz; + mo->standingslope = NULL; + if (player) + { + player->powers[pw_justlaunched] = 2; + if (player->pflags & PF_SPINNING) + player->pflags |= PF_THOKKED; + } + } + } + } + + if (walltransferred == false) + { + if (mo->flags & MF_SLIDEME) + { + P_SlideMove(mo); + xmove = ymove = 0; + } + else + { + P_BounceMove(mo); + xmove = ymove = 0; + S_StartSound(mo, mo->info->activesound); + + //{ SRB2kart - Orbinaut, Ballhog + // Bump sparks + 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; + } + + if (mo->type == MT_ORBINAUT) // Orbinaut speed decreasing + { + if (mo->health > 1) + { + S_StartSound(mo, mo->info->attacksound); + mo->health--; + mo->threshold = 0; + } + else if (mo->health == 1) + { + // This Item Damage + S_StartSound(mo, mo->info->deathsound); + P_KillMobj(mo, NULL, NULL, 0); + + 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); + } + } + + // Bubble bounce + if (mo->type == MT_BUBBLESHIELDTRAP) + S_StartSound(mo, sfx_s3k44); + } + } + } } else moved = true; @@ -2057,20 +2044,6 @@ boolean P_ZMovement(mobj_t *mo) switch (mo->type) { - case MT_THROWNBOUNCE: - if ((mo->flags & MF_BOUNCE) && (mo->z <= mo->floorz || mo->z+mo->height >= mo->ceilingz)) - { - mo->momz = -mo->momz; - mo->z += mo->momz; - S_StartSound(mo, mo->info->activesound); - mo->threshold++; - - // Be sure to change the XY one too if you change this. - // Gain lower amounts of time on each bounce. - if (mo->fuse && mo->threshold < 5) - mo->fuse += ((5 - mo->threshold) * TICRATE); - } - break; case MT_SKIM: // skims don't bounce if (mo->z > mo->watertop && mo->z - mo->momz <= mo->watertop) @@ -2179,7 +2152,7 @@ boolean P_ZMovement(mobj_t *mo) break; case MT_FLAMEJET: case MT_VERTICALFLAMEJET: - if (!(mo->flags & MF_BOUNCE)) + if (mo->flags & MF_SLIDEME) return true; break; case MT_SPIKE: @@ -2733,7 +2706,7 @@ boolean P_SceneryZMovement(mobj_t *mo) { case MT_BOOMEXPLODE: case MT_BOOMPARTICLE: - if ((mo->flags & MF_BOUNCE) && (mo->z <= mo->floorz || mo->z+mo->height >= mo->ceilingz)) + if (!(mo->flags & MF_SLIDEME) && (mo->z <= mo->floorz || mo->z+mo->height >= mo->ceilingz)) { // set standingslope P_TryMove(mo, mo->x, mo->y, true); @@ -11577,7 +11550,7 @@ static void P_SetObjectSpecial(mobj_t *mobj) if (mobj->flags & MF_PUSHABLE) { mobj->flags2 |= MF2_SLIDEPUSH; - mobj->flags |= MF_BOUNCE; + mobj->flags &= ~MF_SLIDEME; } } diff --git a/src/p_mobj.h b/src/p_mobj.h index d6eee5fca..9557bf6fb 100644 --- a/src/p_mobj.h +++ b/src/p_mobj.h @@ -133,35 +133,33 @@ typedef enum MF_MISSILE = 1<<15, // Item is a spring. MF_SPRING = 1<<16, - // Bounce off walls and things. - MF_BOUNCE = 1<<17, // Item box - MF_MONITOR = 1<<18, + MF_MONITOR = 1<<17, // Don't run the thinker for this object. - MF_NOTHINK = 1<<19, + MF_NOTHINK = 1<<18, // Fire object. Doesn't harm if you have fire shield. - MF_FIRE = 1<<20, + MF_FIRE = 1<<19, // Don't adjust z if below or above floorz/ceilingz - MF_NOCLIPHEIGHT = 1<<21, + MF_NOCLIPHEIGHT = 1<<20, // This mobj is an enemy! - MF_ENEMY = 1<<22, + MF_ENEMY = 1<<21, // Scenery (uses scenery thinker). - MF_SCENERY = 1<<23, + MF_SCENERY = 1<<22, // Painful (shit hurts). - MF_PAIN = 1<<24, + MF_PAIN = 1<<23, // This mobj will stick to any surface or solid object it touches. - MF_STICKY = 1<<25, + MF_STICKY = 1<<24, // NiGHTS hidden item. Goes to seestate and turns MF_SPECIAL when paralooped. - MF_NIGHTSITEM = 1<<26, + MF_NIGHTSITEM = 1<<25, // for chase camera, don't be blocked by things (partial clipping) - MF_NOCLIPTHING = 1<<27, + MF_NOCLIPTHING = 1<<26, // Missile bounces like a grenade. - MF_GRENADEBOUNCE = 1<<28, + MF_GRENADEBOUNCE = 1<<27, // Run the action thinker on spawn. - MF_RUNSPAWNFUNC = 1<<29, + MF_RUNSPAWNFUNC = 1<<28, // Don't remap in Encore mode. (Not a drawflag so that it's settable by mobjinfo.) - MF_DONTENCOREMAP = 1<<30, - // free: 1<<31 + MF_DONTENCOREMAP = 1<<29, + // free: to and including 1<<31 } mobjflag_t; typedef enum