mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
Merge branch 'spring-fixes' into 'next'
Spring fixes Remember how a while back I fixed things like being stuck under a spring after jumping from below? Or how you could touch multiple springs at the same time and subsequently cause a loud racket? I accidentally broke something else in the process it turns out! (this sounds familiar...) Namely, diagonal springs can't send you to their centers anymore, because of several changes I made to player-spring collision towards the other issues. This branch fixes that particular issue, while making sure none of the old bugs were broken again. Took a lot of testing to make sure of this. As a bonus, the P_DoSpring function returns a boolean now, which can be used by Lua for whatever: true = you touched spring; false = you didn't See merge request !20
This commit is contained in:
commit
8f8fbf0ccf
3 changed files with 17 additions and 13 deletions
|
@ -1009,8 +1009,8 @@ static int lib_pDoSpring(lua_State *L)
|
|||
NOHUD
|
||||
if (!spring || !object)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
P_DoSpring(spring, object);
|
||||
return 0;
|
||||
lua_pushboolean(L, P_DoSpring(spring, object));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// P_INTER
|
||||
|
|
|
@ -316,7 +316,7 @@ void P_RadiusAttack(mobj_t *spot, mobj_t *source, fixed_t damagedist);
|
|||
fixed_t P_FloorzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height);
|
||||
boolean PIT_PushableMoved(mobj_t *thing);
|
||||
|
||||
void P_DoSpring(mobj_t *spring, mobj_t *object);
|
||||
boolean P_DoSpring(mobj_t *spring, mobj_t *object);
|
||||
|
||||
//
|
||||
// P_SETUP
|
||||
|
|
24
src/p_map.c
24
src/p_map.c
|
@ -102,7 +102,7 @@ boolean P_TeleportMove(mobj_t *thing, fixed_t x, fixed_t y, fixed_t z)
|
|||
// MOVEMENT ITERATOR FUNCTIONS
|
||||
// =========================================================================
|
||||
|
||||
void P_DoSpring(mobj_t *spring, mobj_t *object)
|
||||
boolean P_DoSpring(mobj_t *spring, mobj_t *object)
|
||||
{
|
||||
INT32 pflags;
|
||||
fixed_t offx, offy;
|
||||
|
@ -110,16 +110,16 @@ void P_DoSpring(mobj_t *spring, mobj_t *object)
|
|||
fixed_t horizspeed = spring->info->damage;
|
||||
|
||||
if (object->eflags & MFE_SPRUNG) // Object was already sprung this tic
|
||||
return;
|
||||
return false;
|
||||
|
||||
// Spectators don't trigger springs.
|
||||
if (object->player && object->player->spectator)
|
||||
return;
|
||||
return false;
|
||||
|
||||
if (object->player && (object->player->pflags & PF_NIGHTSMODE))
|
||||
{
|
||||
/*Someone want to make these work like bumpers?*/
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
object->eflags |= MFE_SPRUNG; // apply this flag asap!
|
||||
|
@ -209,6 +209,7 @@ void P_DoSpring(mobj_t *spring, mobj_t *object)
|
|||
P_SetPlayerMobjState(object, S_PLAY_ATK1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void P_DoFanAndGasJet(mobj_t *spring, mobj_t *object)
|
||||
|
@ -365,6 +366,7 @@ 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)
|
||||
|
@ -819,7 +821,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
{
|
||||
if ( thing->z <= tmthing->z + tmthing->height
|
||||
&& tmthing->z <= thing->z + thing->height)
|
||||
P_DoSpring(thing, tmthing);
|
||||
iwassprung = P_DoSpring(thing, tmthing);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -906,7 +908,7 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
{
|
||||
if ( thing->z <= tmthing->z + tmthing->height
|
||||
&& tmthing->z <= thing->z + thing->height)
|
||||
P_DoSpring(thing, tmthing);
|
||||
iwassprung = P_DoSpring(thing, tmthing);
|
||||
}
|
||||
// Are you touching the side of the object you're interacting with?
|
||||
else if (thing->z - FixedMul(FRACUNIT, thing->scale) <= tmthing->z + tmthing->height
|
||||
|
@ -928,12 +930,14 @@ static boolean PIT_CheckThing(mobj_t *thing)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (thing->flags & MF_SPRING && (tmthing->player || tmthing->flags & MF_PUSHABLE));
|
||||
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
|
||||
}
|
||||
// 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
|
||||
if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)
|
||||
else if (thing->flags & MF_MONITOR && tmthing->player && tmthing->player->pflags & (PF_JUMPED|PF_SPINNING|PF_GLIDING)
|
||||
&& !((thing->type == MT_REDRINGBOX && tmthing->player->ctfteam != 1) || (thing->type == MT_BLUERINGBOX && tmthing->player->ctfteam != 2)))
|
||||
;
|
||||
// z checking at last
|
||||
|
|
Loading…
Reference in a new issue