mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-27 06:01:24 +00:00
Merge branch 'movement-refactor' into udmf-fofs-mkii
# Conflicts: # src/p_mobj.c # src/p_user.c
This commit is contained in:
commit
245d5be047
3 changed files with 329 additions and 304 deletions
73
src/p_map.c
73
src/p_map.c
|
@ -3310,73 +3310,43 @@ static boolean P_IsClimbingValid(player_t *player, angle_t angle)
|
|||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// PTR_SlideTraverse
|
||||
//
|
||||
static boolean PTR_SlideTraverse(intercept_t *in)
|
||||
static boolean PTR_LineIsBlocking(line_t *li)
|
||||
{
|
||||
line_t *li;
|
||||
|
||||
I_Assert(in->isaline);
|
||||
|
||||
li = in->d.line;
|
||||
|
||||
// one-sided linedefs are always solid to sliding movement.
|
||||
// one-sided linedef
|
||||
if (!li->backsector)
|
||||
{
|
||||
if (P_PointOnLineSide(slidemo->x, slidemo->y, li))
|
||||
return true; // don't hit the back side
|
||||
goto isblocking;
|
||||
}
|
||||
return !P_PointOnLineSide(slidemo->x, slidemo->y, li);
|
||||
|
||||
if (!(slidemo->flags & MF_MISSILE))
|
||||
{
|
||||
if (li->flags & ML_IMPASSIBLE)
|
||||
goto isblocking;
|
||||
return true;
|
||||
|
||||
if ((slidemo->flags & (MF_ENEMY|MF_BOSS)) && li->flags & ML_BLOCKMONSTERS)
|
||||
goto isblocking;
|
||||
return true;
|
||||
}
|
||||
|
||||
// set openrange, opentop, openbottom
|
||||
P_LineOpening(li, slidemo);
|
||||
|
||||
if (openrange < slidemo->height)
|
||||
goto isblocking; // doesn't fit
|
||||
return true; // doesn't fit
|
||||
|
||||
if (opentop - slidemo->z < slidemo->height)
|
||||
goto isblocking; // mobj is too high
|
||||
return true; // mobj is too high
|
||||
|
||||
if (openbottom - slidemo->z > FixedMul(MAXSTEPMOVE, slidemo->scale))
|
||||
goto isblocking; // too big a step up
|
||||
return true; // too big a step up
|
||||
|
||||
// this line doesn't block movement
|
||||
return true;
|
||||
|
||||
// the line does block movement,
|
||||
// see if it is closer than best so far
|
||||
isblocking:
|
||||
if (li->polyobj && slidemo->player)
|
||||
{
|
||||
if ((li->polyobj->lines[0]->backsector->flags & SF_TRIGGERSPECIAL_TOUCH) && !(li->polyobj->flags & POF_NOSPECIALS))
|
||||
P_ProcessSpecialSector(slidemo->player, slidemo->subsector->sector, li->polyobj->lines[0]->backsector);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (slidemo->player && (slidemo->player->pflags & PF_GLIDING || slidemo->player->climbing)
|
||||
&& slidemo->player->charability == CA_GLIDEANDCLIMB)
|
||||
static void PTR_GlideClimbTraverse(line_t *li)
|
||||
{
|
||||
line_t *checkline = li;
|
||||
sector_t *checksector;
|
||||
ffloor_t *rover;
|
||||
fixed_t topheight, bottomheight;
|
||||
boolean fofline = false;
|
||||
INT32 side = P_PointOnLineSide(slidemo->x, slidemo->y, li);
|
||||
|
||||
if (!side && li->backsector)
|
||||
checksector = li->backsector;
|
||||
else
|
||||
checksector = li->frontsector;
|
||||
sector_t *checksector = (li->backsector && !P_PointOnLineSide(slidemo->x, slidemo->y, li)) ? li->backsector : li->frontsector;
|
||||
|
||||
if (checksector->ffloors)
|
||||
{
|
||||
|
@ -3467,6 +3437,29 @@ isblocking:
|
|||
}
|
||||
}
|
||||
|
||||
static boolean PTR_SlideTraverse(intercept_t *in)
|
||||
{
|
||||
line_t *li;
|
||||
|
||||
I_Assert(in->isaline);
|
||||
|
||||
li = in->d.line;
|
||||
|
||||
if (!PTR_LineIsBlocking(li))
|
||||
return true;
|
||||
|
||||
// the line blocks movement,
|
||||
// see if it is closer than best so far
|
||||
if (li->polyobj && slidemo->player)
|
||||
{
|
||||
if ((li->polyobj->lines[0]->backsector->flags & SF_TRIGGERSPECIAL_TOUCH) && !(li->polyobj->flags & POF_NOSPECIALS))
|
||||
P_ProcessSpecialSector(slidemo->player, slidemo->subsector->sector, li->polyobj->lines[0]->backsector);
|
||||
}
|
||||
|
||||
if (slidemo->player && slidemo->player->charability == CA_GLIDEANDCLIMB
|
||||
&& (slidemo->player->pflags & PF_GLIDING || slidemo->player->climbing))
|
||||
PTR_GlideClimbTraverse(li);
|
||||
|
||||
if (in->frac < bestslidefrac && (!slidemo->player || !slidemo->player->climbing))
|
||||
{
|
||||
secondslidefrac = bestslidefrac;
|
||||
|
|
28
src/p_mobj.c
28
src/p_mobj.c
|
@ -1673,28 +1673,34 @@ static void P_PushableCheckBustables(mobj_t *mo)
|
|||
P_SetThingPosition(mo);
|
||||
|
||||
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||
{
|
||||
if (!node->m_sector)
|
||||
break;
|
||||
|
||||
if (node->m_sector->ffloors)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
fixed_t topheight, bottomheight;
|
||||
|
||||
if (!node->m_sector)
|
||||
break;
|
||||
|
||||
if (!node->m_sector->ffloors)
|
||||
continue;
|
||||
|
||||
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS)) continue;
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
continue;
|
||||
|
||||
if (!(rover->flags & FF_BUSTUP)) continue;
|
||||
if (!(rover->flags & FF_BUSTUP))
|
||||
continue;
|
||||
|
||||
// Bustable by pushables?
|
||||
if (!(rover->master->args[3] & TMFB_PUSHABLES)) continue;
|
||||
if (!(rover->master->args[3] & TMFB_PUSHABLES))
|
||||
continue;
|
||||
|
||||
if (rover->master->frontsector->crumblestate != CRUMBLE_NONE)
|
||||
continue;
|
||||
|
||||
if (rover->master->frontsector->crumblestate == CRUMBLE_NONE)
|
||||
{
|
||||
topheight = P_GetFOFTopZ(mo, node->m_sector, rover, mo->x, mo->y, NULL);
|
||||
bottomheight = P_GetFOFBottomZ(mo, node->m_sector, rover, mo->x, mo->y, NULL);
|
||||
|
||||
// Height checks
|
||||
if (rover->flags & FF_SHATTERBOTTOM)
|
||||
{
|
||||
|
@ -1738,8 +1744,6 @@ static void P_PushableCheckBustables(mobj_t *mo)
|
|||
goto bustupdone;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bustupdone:
|
||||
P_UnsetThingPosition(mo);
|
||||
mo->x = oldx;
|
||||
|
|
118
src/p_user.c
118
src/p_user.c
|
@ -2532,6 +2532,72 @@ boolean P_InQuicksand(mobj_t *mo) // Returns true if you are in quicksand
|
|||
return false; // No sand here, Captain!
|
||||
}
|
||||
|
||||
static boolean P_PlayerCanBust(player_t *player, ffloor_t *rover)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS))
|
||||
return false;
|
||||
|
||||
if (!(rover->flags & FF_BUSTUP))
|
||||
return false;
|
||||
|
||||
/*if (rover->master->frontsector->crumblestate != CRUMBLE_NONE)
|
||||
return false;*/
|
||||
|
||||
// If it's an FF_SHATTER, you can break it just by touching it.
|
||||
if (rover->flags & FF_SHATTER)
|
||||
return true;
|
||||
|
||||
// If it's an FF_SPINBUST, you can break it if you are in your spinning frames
|
||||
// (either from jumping or spindashing).
|
||||
if (rover->flags & FF_SPINBUST)
|
||||
{
|
||||
if ((player->pflags & PF_SPINNING) && !(player->pflags & PF_STARTDASH))
|
||||
return true;
|
||||
|
||||
if ((player->pflags & PF_JUMPED) && !(player->pflags & PF_NOJUMPDAMAGE))
|
||||
return true;
|
||||
}
|
||||
|
||||
// Strong abilities can break even FF_STRONGBUST.
|
||||
if (player->charability == CA_GLIDEANDCLIMB)
|
||||
return true;
|
||||
|
||||
if (player->pflags & PF_BOUNCING)
|
||||
return true;
|
||||
|
||||
if (player->charability == CA_TWINSPIN && player->panim == PA_ABILITY)
|
||||
return true;
|
||||
|
||||
if (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2)
|
||||
return true;
|
||||
|
||||
// Everyone else is out of luck.
|
||||
if (rover->flags & FF_STRONGBUST)
|
||||
return false;
|
||||
|
||||
// Spinning (and not jumping)
|
||||
if ((player->pflags & PF_SPINNING) && !(player->pflags & PF_JUMPED))
|
||||
return true;
|
||||
|
||||
// Super
|
||||
if (player->powers[pw_super])
|
||||
return true;
|
||||
|
||||
// Dashmode
|
||||
if ((player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE) && player->dashmode >= DASHMODE_THRESHOLD)
|
||||
return true;
|
||||
|
||||
// NiGHTS drill
|
||||
if (player->pflags & PF_DRILLING)
|
||||
return true;
|
||||
|
||||
// Recording for Metal Sonic
|
||||
if (metalrecording)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void P_CheckBustableBlocks(player_t *player)
|
||||
{
|
||||
msecnode_t *node;
|
||||
|
@ -2553,57 +2619,21 @@ static void P_CheckBustableBlocks(player_t *player)
|
|||
}
|
||||
|
||||
for (node = player->mo->touching_sectorlist; node; node = node->m_sectorlist_next)
|
||||
{
|
||||
if (!node->m_sector)
|
||||
break;
|
||||
|
||||
if (node->m_sector->ffloors)
|
||||
{
|
||||
ffloor_t *rover;
|
||||
fixed_t topheight, bottomheight;
|
||||
|
||||
if (!node->m_sector)
|
||||
break;
|
||||
|
||||
if (!node->m_sector->ffloors)
|
||||
continue;
|
||||
|
||||
for (rover = node->m_sector->ffloors; rover; rover = rover->next)
|
||||
{
|
||||
if (!(rover->flags & FF_EXISTS)) continue;
|
||||
|
||||
if ((rover->flags & FF_BUSTUP)/* && rover->master->frontsector->crumblestate == CRUMBLE_NONE*/)
|
||||
{
|
||||
// If it's an FF_SHATTER, you can break it just by touching it.
|
||||
if (rover->flags & FF_SHATTER)
|
||||
goto bust;
|
||||
|
||||
// If it's an FF_SPINBUST, you can break it if you are in your spinning frames
|
||||
// (either from jumping or spindashing).
|
||||
if (rover->flags & FF_SPINBUST
|
||||
&& (((player->pflags & PF_SPINNING) && !(player->pflags & PF_STARTDASH))
|
||||
|| (player->pflags & PF_JUMPED && !(player->pflags & PF_NOJUMPDAMAGE))))
|
||||
goto bust;
|
||||
|
||||
// You can always break it if you have CA_GLIDEANDCLIMB
|
||||
// or if you are bouncing on it
|
||||
// or you are using CA_TWINSPIN/CA2_MELEE.
|
||||
if (player->charability == CA_GLIDEANDCLIMB
|
||||
|| (player->pflags & PF_BOUNCING)
|
||||
|| ((player->charability == CA_TWINSPIN) && (player->panim == PA_ABILITY))
|
||||
|| (player->charability2 == CA2_MELEE && player->panim == PA_ABILITY2))
|
||||
goto bust;
|
||||
|
||||
if (rover->flags & FF_STRONGBUST)
|
||||
if (!P_PlayerCanBust(player, rover))
|
||||
continue;
|
||||
|
||||
// If it's not an FF_STRONGBUST, you can break if you are spinning (and not jumping)
|
||||
// or you are super
|
||||
// or you are in dashmode with SF_DASHMODE
|
||||
// or you are drilling in NiGHTS
|
||||
// or you are recording for Metal Sonic
|
||||
if (!((player->pflags & PF_SPINNING) && !(player->pflags & PF_JUMPED))
|
||||
&& !(player->powers[pw_super])
|
||||
&& !(((player->charflags & (SF_DASHMODE|SF_MACHINE)) == (SF_DASHMODE|SF_MACHINE)) && (player->dashmode >= DASHMODE_THRESHOLD))
|
||||
&& !(player->pflags & PF_DRILLING)
|
||||
&& !metalrecording)
|
||||
continue;
|
||||
|
||||
bust:
|
||||
topheight = P_GetFOFTopZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL);
|
||||
bottomheight = P_GetFOFBottomZ(player->mo, node->m_sector, rover, player->mo->x, player->mo->y, NULL);
|
||||
|
||||
|
@ -2669,8 +2699,6 @@ static void P_CheckBustableBlocks(player_t *player)
|
|||
goto bustupdone;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
bustupdone:
|
||||
if (!(player->pflags & PF_BOUNCING))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue