mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-22 02:42:20 +00:00
* Springs no longer need MF_SOLID to function. (I tried to add a special Sonic 1-3 style "springs are solid from the side" thing with native support, but it turns out that requires too many hacks for an optional extra feature not used in the campaign, so No.)
* Springs no longer send you flying relative to the slope whilst you're on a slope. (I tried fixing this before, but this is a much more solid fix.)
This commit is contained in:
parent
5cc1befcad
commit
dbc0ac2303
2 changed files with 43 additions and 37 deletions
20
src/info.c
20
src/info.c
|
@ -6066,7 +6066,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
11*FRACUNIT, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_SOLID|MF_SPRING, // flags
|
||||
MF_SPRING, // flags
|
||||
S_BLUESPRING2 // raisestate
|
||||
},
|
||||
|
||||
|
@ -6093,7 +6093,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
20*FRACUNIT, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_SOLID|MF_SPRING, // flags
|
||||
MF_SPRING, // flags
|
||||
S_YELLOWSPRING2 // raisestate
|
||||
},
|
||||
|
||||
|
@ -6120,7 +6120,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
32*FRACUNIT, // mass
|
||||
0, // damage
|
||||
sfx_None, // activesound
|
||||
MF_SOLID|MF_SPRING, // flags
|
||||
MF_SPRING, // flags
|
||||
S_REDSPRING2 // raisestate
|
||||
},
|
||||
|
||||
|
@ -6147,7 +6147,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
20*FRACUNIT, // mass
|
||||
20*FRACUNIT, // damage
|
||||
sfx_None, // activesound
|
||||
MF_SOLID|MF_SPRING, // flags
|
||||
MF_SPRING, // flags
|
||||
S_YDIAG2 // raisestate
|
||||
},
|
||||
|
||||
|
@ -6174,7 +6174,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
32*FRACUNIT, // mass
|
||||
32*FRACUNIT, // damage
|
||||
sfx_None, // activesound
|
||||
MF_SOLID|MF_SPRING, // flags
|
||||
MF_SPRING, // flags
|
||||
S_RDIAG2 // raisestate
|
||||
},
|
||||
|
||||
|
@ -6201,7 +6201,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // mass
|
||||
36*FRACUNIT, // damage
|
||||
sfx_None, // activesound
|
||||
MF_SOLID|MF_SPRING|MF_NOGRAVITY, // flags
|
||||
MF_SPRING|MF_NOGRAVITY, // flags
|
||||
S_YHORIZ2 // raisestate
|
||||
},
|
||||
|
||||
|
@ -6228,7 +6228,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // mass
|
||||
72*FRACUNIT, // damage
|
||||
sfx_None, // activesound
|
||||
MF_SOLID|MF_SPRING|MF_NOGRAVITY, // flags
|
||||
MF_SPRING|MF_NOGRAVITY, // flags
|
||||
S_RHORIZ2 // raisestate
|
||||
},
|
||||
|
||||
|
@ -6255,7 +6255,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
0, // mass
|
||||
4*FRACUNIT, // damage
|
||||
sfx_None, // activesound
|
||||
MF_SOLID|MF_SPRING|MF_NOGRAVITY, // flags
|
||||
MF_SPRING|MF_NOGRAVITY, // flags
|
||||
S_BHORIZ2 // raisestate
|
||||
},
|
||||
|
||||
|
@ -9738,7 +9738,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
20*FRACUNIT, // mass
|
||||
0, // damage
|
||||
sfx_mswing, // activesound
|
||||
MF_SCENERY|MF_SOLID|MF_SPRING|MF_NOGRAVITY, // flags
|
||||
MF_SCENERY|MF_SPRING|MF_NOGRAVITY, // flags
|
||||
S_YELLOWSPRINGBALL2 // raisestate
|
||||
},
|
||||
|
||||
|
@ -9765,7 +9765,7 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
|
|||
32*FRACUNIT, // mass
|
||||
0, // damage
|
||||
sfx_mswing, // activesound
|
||||
MF_SCENERY|MF_SOLID|MF_SPRING|MF_NOGRAVITY, // flags
|
||||
MF_SCENERY|MF_SPRING|MF_NOGRAVITY, // flags
|
||||
S_REDSPRINGBALL2 // raisestate
|
||||
},
|
||||
|
||||
|
|
60
src/p_map.c
60
src/p_map.c
|
@ -117,7 +117,12 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
|||
fixed_t horizspeed = spring->info->damage;
|
||||
UINT8 secondjump;
|
||||
|
||||
if (object->eflags & MFE_SPRUNG) // Object was already sprung this tic
|
||||
// Does nothing?
|
||||
if (!vertispeed && !horizspeed)
|
||||
return false;
|
||||
|
||||
// Object was already sprung this tic
|
||||
if (object->eflags & MFE_SPRUNG)
|
||||
return false;
|
||||
|
||||
// Spectators don't trigger springs.
|
||||
|
@ -130,17 +135,26 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (spring->eflags & MFE_VERTICALFLIP)
|
||||
vertispeed *= -1;
|
||||
|
||||
#ifdef ESLOPE
|
||||
object->standingslope = NULL; // Okay, now we know it's not going to be relevant - no launching off at silly angles for you.
|
||||
#endif
|
||||
|
||||
if (object->player
|
||||
&& ((object->player->charability == CA_TWINSPIN && object->player->panim == PA_ABILITY)
|
||||
|| (object->player->charability2 == CA2_MELEE && object->player->panim == PA_ABILITY2)))
|
||||
{
|
||||
S_StartSound(object, sfx_s3k8b);
|
||||
horizspeed = FixedMul(horizspeed, (4*FRACUNIT)/3);
|
||||
vertispeed = FixedMul(vertispeed, (6*FRACUNIT)/5); // aprox square root of above
|
||||
if (horizspeed)
|
||||
horizspeed = FixedMul(horizspeed, (4*FRACUNIT)/3);
|
||||
if (vertispeed)
|
||||
vertispeed = FixedMul(vertispeed, (6*FRACUNIT)/5); // aprox square root of above
|
||||
}
|
||||
|
||||
object->eflags |= MFE_SPRUNG; // apply this flag asap!
|
||||
spring->flags &= ~(MF_SOLID|MF_SPECIAL); // De-solidify
|
||||
spring->flags &= ~(MF_SPRING|MF_SPECIAL); // De-solidify
|
||||
|
||||
if ((horizspeed && vertispeed) || (object->player && object->player->homing)) // Mimic SA
|
||||
{
|
||||
|
@ -148,9 +162,6 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
|||
P_TryMove(object, spring->x, spring->y, true);
|
||||
}
|
||||
|
||||
if (spring->eflags & MFE_VERTICALFLIP)
|
||||
vertispeed *= -1;
|
||||
|
||||
if (vertispeed > 0)
|
||||
object->z = spring->z + spring->height + 1;
|
||||
else if (vertispeed < 0)
|
||||
|
@ -186,7 +197,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
|||
P_InstaThrustEvenIn2D(object, spring->angle, FixedMul(horizspeed,FixedSqrt(FixedMul(object->scale, spring->scale))));
|
||||
|
||||
// Re-solidify
|
||||
spring->flags |= (spring->info->flags & (MF_SPECIAL|MF_SOLID));
|
||||
spring->flags |= (spring->info->flags & (MF_SPRING|MF_SPECIAL));
|
||||
|
||||
P_SetMobjState(spring, spring->info->raisestate);
|
||||
|
||||
|
@ -239,7 +250,7 @@ boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
|||
}
|
||||
|
||||
#ifdef ESLOPE
|
||||
object->standingslope = NULL; // Okay, now we know it's not going to be relevant - no launching off at silly angles for you.
|
||||
object->standingslope = NULL; // And again.
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
@ -398,7 +409,6 @@ static void P_DoTailsCarry(player_t *sonic, player_t *tails)
|
|||
static boolean PIT_CheckThing(mobj_t *thing)
|
||||
{
|
||||
fixed_t blockdist;
|
||||
boolean iwassprung = false;
|
||||
|
||||
// don't clip against self
|
||||
if (thing == tmthing)
|
||||
|
@ -514,7 +524,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!(thing->flags & (MF_SOLID|MF_SPECIAL|MF_PAIN|MF_SHOOTABLE)))
|
||||
if (!(thing->flags & (MF_SOLID|MF_SPECIAL|MF_PAIN|MF_SHOOTABLE|MF_SPRING)))
|
||||
return true;
|
||||
|
||||
// Don't collide with your buddies while NiGHTS-flying.
|
||||
|
@ -1062,12 +1072,17 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
if (tmthing->flags & MF_PUSHABLE)
|
||||
{
|
||||
if (thing->type == MT_FAN || thing->type == MT_STEAM)
|
||||
{
|
||||
P_DoFanAndGasJet(thing, tmthing);
|
||||
return true;
|
||||
}
|
||||
else if (thing->flags & MF_SPRING)
|
||||
{
|
||||
if ( thing->z <= tmthing->z + tmthing->height
|
||||
&& tmthing->z <= thing->z + thing->height)
|
||||
iwassprung = P_DoSpring(thing, tmthing);
|
||||
if (P_DoSpring(thing, tmthing))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1158,7 +1173,9 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
{
|
||||
if ( thing->z <= tmthing->z + tmthing->height
|
||||
&& tmthing->z <= thing->z + thing->height)
|
||||
iwassprung = P_DoSpring(thing, tmthing);
|
||||
if (P_DoSpring(thing, tmthing))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
// Are you touching the side of the object you're interacting with?
|
||||
else if (thing->z - FixedMul(FRACUNIT, thing->scale) <= tmthing->z + tmthing->height
|
||||
|
@ -1206,15 +1223,8 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
}
|
||||
}
|
||||
|
||||
if (!(tmthing->player) && (thing->player))
|
||||
if ((!tmthing->player) && (thing->player))
|
||||
; // no solid thing should ever be able to step up onto a player
|
||||
else if (thing->flags & MF_SPRING && (tmthing->player || tmthing->flags & MF_PUSHABLE))
|
||||
{
|
||||
if (iwassprung) // this spring caused you to gain MFE_SPRUNG just now...
|
||||
return false; // "cancel" P_TryMove via blocking so you keep your current position
|
||||
}
|
||||
else if (tmthing->flags & MF_SPRING && (thing->flags & MF_PUSHABLE))
|
||||
; // Fix a few nasty spring-jumping bugs that happen sometimes.
|
||||
// Monitors are not treated as solid to players who are jumping, spinning or gliding,
|
||||
// unless it's a CTF team monitor and you're on the wrong team
|
||||
else if (thing->flags & MF_MONITOR && tmthing->player
|
||||
|
@ -1253,13 +1263,11 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
|
||||
topz = thing->z - thing->scale; // FixedMul(FRACUNIT, thing->scale), but thing->scale == FRACUNIT in base scale anyways
|
||||
|
||||
if (thing->flags & MF_SPRING)
|
||||
;
|
||||
// block only when jumping not high enough,
|
||||
// (dont climb max. 24units while already in air)
|
||||
// since return false doesn't handle momentum properly,
|
||||
// we lie to P_TryMove() so it's always too high
|
||||
else if (tmthing->player && tmthing->z + tmthing->height > topz
|
||||
if (tmthing->player && tmthing->z + tmthing->height > topz
|
||||
&& tmthing->z + tmthing->height < tmthing->ceilingz)
|
||||
{
|
||||
if (thing->flags & MF_GRENADEBOUNCE && (thing->flags & MF_MONITOR || thing->flags2 & MF2_STANDONME)) // Gold monitor hack...
|
||||
|
@ -1299,13 +1307,11 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
|
||||
topz = thing->z + thing->height + thing->scale; // FixedMul(FRACUNIT, thing->scale), but thing->scale == FRACUNIT in base scale anyways
|
||||
|
||||
if (thing->flags & MF_SPRING)
|
||||
;
|
||||
// block only when jumping not high enough,
|
||||
// (dont climb max. 24units while already in air)
|
||||
// since return false doesn't handle momentum properly,
|
||||
// we lie to P_TryMove() so it's always too high
|
||||
else if (tmthing->player && tmthing->z < topz
|
||||
if (tmthing->player && tmthing->z < topz
|
||||
&& tmthing->z > tmthing->floorz)
|
||||
{
|
||||
if (thing->flags & MF_GRENADEBOUNCE && (thing->flags & MF_MONITOR || thing->flags2 & MF2_STANDONME)) // Gold monitor hack...
|
||||
|
|
Loading…
Reference in a new issue