Merge branch 'map-features' into 'master'

Minor but handy new mapping features

See merge request KartKrew/Kart!218
This commit is contained in:
Sal 2020-03-23 00:44:18 -04:00
commit 8d763afae6
7 changed files with 161 additions and 36 deletions

View file

@ -8203,8 +8203,8 @@ static const char *const PLAYERFLAG_LIST[] = {
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
// Linedef flags // Linedef flags
static const char *const ML_LIST[16] = { static const char *const ML_LIST[16] = {
"IMPASSIBLE", "IMPASSABLE",
"BLOCKMONSTERS", "BLOCKPLAYERS",
"TWOSIDED", "TWOSIDED",
"DONTPEGTOP", "DONTPEGTOP",
"DONTPEGBOTTOM", "DONTPEGBOTTOM",

View file

@ -97,10 +97,10 @@ typedef struct
// //
// Solid, is an obstacle. // Solid, is an obstacle.
#define ML_IMPASSIBLE 1 #define ML_IMPASSABLE 1
// Blocks monsters only. // SRB2Kart: Blocks players only; items can be thrown through these.
#define ML_BLOCKMONSTERS 2 #define ML_BLOCKPLAYERS 2
// Backside will not be present at all if not two sided. // Backside will not be present at all if not two sided.
#define ML_TWOSIDED 4 #define ML_TWOSIDED 4

View file

@ -484,7 +484,7 @@ INT32 EV_DoCeiling(line_t *line, ceiling_e type)
} }
// chained linedef executing ability // chained linedef executing ability
if (line->flags & ML_BLOCKMONSTERS) if (line->flags & ML_BLOCKPLAYERS)
{ {
// only set it on ONE of the moving sectors (the smallest numbered) // only set it on ONE of the moving sectors (the smallest numbered)
// and front side x offset must be positive // and front side x offset must be positive

View file

@ -2747,7 +2747,7 @@ INT32 EV_DoFloor(line_t *line, floor_e floortype)
dofloor->direction = -1; // down dofloor->direction = -1; // down
// chained linedef executing ability // chained linedef executing ability
if (line->flags & ML_BLOCKMONSTERS) if (line->flags & ML_BLOCKPLAYERS)
{ {
// Only set it on one of the moving sectors (the // Only set it on one of the moving sectors (the
// smallest numbered) and only if the front side // smallest numbered) and only if the front side

View file

@ -1814,10 +1814,10 @@ static boolean PIT_CheckLine(line_t *ld)
// missiles can cross uncrossable lines // missiles can cross uncrossable lines
if (!(tmthing->flags & MF_MISSILE)) if (!(tmthing->flags & MF_MISSILE))
{ {
if (ld->flags & ML_IMPASSIBLE) // block objects from moving through this linedef. if (ld->flags & ML_IMPASSABLE) // block objects from moving through this linedef.
return false; return false;
if ((tmthing->flags & (MF_ENEMY|MF_BOSS)) && ld->flags & ML_BLOCKMONSTERS) if (tmthing->player && ld->flags & ML_BLOCKPLAYERS)
return false; // block monsters only return false; // SRB2Kart: Only block players, not items
} }
// set openrange, opentop, openbottom // set openrange, opentop, openbottom
@ -3179,10 +3179,10 @@ static boolean PTR_SlideTraverse(intercept_t *in)
if (!(slidemo->flags & MF_MISSILE)) if (!(slidemo->flags & MF_MISSILE))
{ {
if (li->flags & ML_IMPASSIBLE) if (li->flags & ML_IMPASSABLE)
goto isblocking; goto isblocking;
if ((slidemo->flags & (MF_ENEMY|MF_BOSS)) && li->flags & ML_BLOCKMONSTERS) if (slidemo->player && li->flags & ML_BLOCKPLAYERS)
goto isblocking; goto isblocking;
} }

View file

@ -2174,7 +2174,7 @@ boolean P_CheckSolidLava(mobj_t *mo, ffloor_t *rover)
*rover->topheight; *rover->topheight;
if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3 if (rover->flags & FF_SWIMMABLE && GETSECSPECIAL(rover->master->frontsector->special, 1) == 3
&& !(rover->master->flags & ML_BLOCKMONSTERS) && !(rover->master->flags & ML_BLOCKPLAYERS)
&& ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > topheight - FixedMul(16*FRACUNIT, mo->scale))) && ((rover->master->flags & ML_EFFECT3) || mo->z-mo->momz > topheight - FixedMul(16*FRACUNIT, mo->scale)))
return true; return true;
} }
@ -7909,6 +7909,13 @@ void P_MobjThinker(mobj_t *mobj)
case MT_ORBINAUT: case MT_ORBINAUT:
{ {
boolean grounded = P_IsObjectOnGround(mobj); boolean grounded = P_IsObjectOnGround(mobj);
if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true))
{
P_RemoveMobj(mobj);
return;
}
if (mobj->flags2 & MF2_AMBUSH) if (mobj->flags2 & MF2_AMBUSH)
{ {
if (grounded && (mobj->flags & MF_NOCLIPTHING)) if (grounded && (mobj->flags & MF_NOCLIPTHING))
@ -7979,6 +7986,12 @@ void P_MobjThinker(mobj_t *mobj)
{ {
mobj_t *ghost = P_SpawnGhostMobj(mobj); mobj_t *ghost = P_SpawnGhostMobj(mobj);
if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true))
{
P_RemoveMobj(mobj);
return;
}
if (mobj->target && !P_MobjWasRemoved(mobj->target) && mobj->target->player) if (mobj->target && !P_MobjWasRemoved(mobj->target) && mobj->target->player)
{ {
ghost->color = mobj->target->player->skincolor; ghost->color = mobj->target->player->skincolor;
@ -8002,6 +8015,13 @@ void P_MobjThinker(mobj_t *mobj)
case MT_JAWZ_DUD: case MT_JAWZ_DUD:
{ {
boolean grounded = P_IsObjectOnGround(mobj); boolean grounded = P_IsObjectOnGround(mobj);
if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true))
{
P_RemoveMobj(mobj);
return;
}
if (mobj->flags2 & MF2_AMBUSH) if (mobj->flags2 & MF2_AMBUSH)
{ {
if (grounded && (mobj->flags & MF_NOCLIPTHING)) if (grounded && (mobj->flags & MF_NOCLIPTHING))
@ -8062,6 +8082,12 @@ void P_MobjThinker(mobj_t *mobj)
case MT_EGGMANITEM: case MT_EGGMANITEM:
mobj->friction = ORIG_FRICTION/4; mobj->friction = ORIG_FRICTION/4;
if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true))
{
P_RemoveMobj(mobj);
return;
}
if (mobj->momx || mobj->momy) if (mobj->momx || mobj->momy)
{ {
mobj_t *ghost = P_SpawnGhostMobj(mobj); mobj_t *ghost = P_SpawnGhostMobj(mobj);
@ -8091,6 +8117,12 @@ void P_MobjThinker(mobj_t *mobj)
mobj_t *ghost = P_SpawnGhostMobj(mobj); mobj_t *ghost = P_SpawnGhostMobj(mobj);
ghost->fuse = 3; ghost->fuse = 3;
if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true))
{
P_RemoveMobj(mobj);
return;
}
if (mobj->target && !P_MobjWasRemoved(mobj->target) && mobj->target->player) if (mobj->target && !P_MobjWasRemoved(mobj->target) && mobj->target->player)
{ {
ghost->color = mobj->target->player->skincolor; ghost->color = mobj->target->player->skincolor;
@ -8123,6 +8155,12 @@ void P_MobjThinker(mobj_t *mobj)
mobj->threshold--; mobj->threshold--;
break; break;
case MT_SSMINE: case MT_SSMINE:
if (P_MobjTouchingSectorSpecial(mobj, 4, 7, true))
{
P_RemoveMobj(mobj);
return;
}
if (mobj->target && mobj->target->player) if (mobj->target && mobj->target->player)
mobj->color = mobj->target->player->skincolor; mobj->color = mobj->target->player->skincolor;
else else

View file

@ -1651,7 +1651,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
if (rings > dist) if (rings > dist)
return false; return false;
} }
else if (triggerline->flags & ML_BLOCKMONSTERS) else if (triggerline->flags & ML_BLOCKPLAYERS)
{ {
if (rings < dist) if (rings < dist)
return false; return false;
@ -1705,6 +1705,7 @@ boolean P_RunTriggerLinedef(line_t *triggerline, mobj_t *actor, sector_t *caller
if (!(ALL7EMERALDS(emeralds))) if (!(ALL7EMERALDS(emeralds)))
return false; return false;
} }
// If we were not triggered by a sector type especially for the purpose, // If we were not triggered by a sector type especially for the purpose,
// a Linedef Executor linedef trigger is not handling sector triggers properly, return. // a Linedef Executor linedef trigger is not handling sector triggers properly, return.
@ -2162,7 +2163,7 @@ static void K_HandleLapIncrement(player_t *player)
if (lap < (sides[lines[i].sidenum[0]].textureoffset >> FRACBITS)) if (lap < (sides[lines[i].sidenum[0]].textureoffset >> FRACBITS))
continue; continue;
} }
else if (lines[i].flags & ML_BLOCKMONSTERS) // Need lower than or equal to else if (lines[i].flags & ML_BLOCKPLAYERS) // Need lower than or equal to
{ {
if (lap > (sides[lines[i].sidenum[0]].textureoffset >> FRACBITS)) if (lap > (sides[lines[i].sidenum[0]].textureoffset >> FRACBITS))
continue; continue;
@ -2448,8 +2449,8 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
return; return;
if (bot) if (bot)
P_Teleport(bot, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, (line->flags & ML_BLOCKMONSTERS) == 0, (line->flags & ML_EFFECT4) == ML_EFFECT4); P_Teleport(bot, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, (line->flags & ML_BLOCKPLAYERS) == 0, (line->flags & ML_EFFECT4) == ML_EFFECT4);
if (line->flags & ML_BLOCKMONSTERS) if (line->flags & ML_BLOCKPLAYERS)
P_Teleport(mo, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, false, (line->flags & ML_EFFECT4) == ML_EFFECT4); P_Teleport(mo, dest->x, dest->y, dest->z, (line->flags & ML_NOCLIMB) ? mo->angle : dest->angle, false, (line->flags & ML_EFFECT4) == ML_EFFECT4);
else else
{ {
@ -2511,7 +2512,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
mapmusname[6] = 0; mapmusname[6] = 0;
mapmusflags = tracknum & MUSIC_TRACKMASK; mapmusflags = tracknum & MUSIC_TRACKMASK;
if (!(line->flags & ML_BLOCKMONSTERS)) if (!(line->flags & ML_BLOCKPLAYERS))
mapmusflags |= MUSIC_RELOADRESET; mapmusflags |= MUSIC_RELOADRESET;
if (line->flags & ML_BOUNCY) if (line->flags & ML_BOUNCY)
mapmusflags |= MUSIC_FORCERESET; mapmusflags |= MUSIC_FORCERESET;
@ -2531,7 +2532,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
} }
} }
// Except, you can use the ML_BLOCKMONSTERS flag to change this behavior. // Except, you can use the ML_BLOCKPLAYERS flag to change this behavior.
// if (mapmusflags & MUSIC_RELOADRESET) then it will reset the music in G_PlayerReborn. // if (mapmusflags & MUSIC_RELOADRESET) then it will reset the music in G_PlayerReborn.
} }
break; break;
@ -2601,7 +2602,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
// play the sound from nowhere // play the sound from nowhere
S_StartSound(NULL, sfxnum); S_StartSound(NULL, sfxnum);
} }
else if (line->flags & ML_BLOCKMONSTERS) else if (line->flags & ML_BLOCKPLAYERS)
{ {
// play the sound from calling sector's soundorg // play the sound from calling sector's soundorg
if (callsec) if (callsec)
@ -2950,7 +2951,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
var1 = sides[line->sidenum[0]].toptexture; //(line->dx>>FRACBITS)-1; var1 = sides[line->sidenum[0]].toptexture; //(line->dx>>FRACBITS)-1;
if (line->sidenum[1] != 0xffff && line->flags & ML_BLOCKMONSTERS) // read power from back sidedef if (line->sidenum[1] != 0xffff && line->flags & ML_BLOCKPLAYERS) // read power from back sidedef
var2 = sides[line->sidenum[1]].toptexture; var2 = sides[line->sidenum[1]].toptexture;
else if (line->flags & ML_NOCLIMB) // 'Infinite' else if (line->flags & ML_NOCLIMB) // 'Infinite'
var2 = UINT16_MAX; var2 = UINT16_MAX;
@ -3551,6 +3552,97 @@ sector_t *P_MobjTouchingSectorSpecial(mobj_t *mo, INT32 section, INT32 number, b
return rover->master->frontsector; return rover->master->frontsector;
} }
#ifdef POLYOBJECTS
// Allow sector specials to be applied to polyobjects!
if (mo->subsector->polyList)
{
polyobj_t *po = mo->subsector->polyList;
sector_t *polysec;
boolean touching = false;
boolean inside = false;
while (po)
{
if (po->flags & POF_NOSPECIALS)
{
po = (polyobj_t *)(po->link.next);
continue;
}
polysec = po->lines[0]->backsector;
if (GETSECSPECIAL(polysec->special, section) != number)
{
po = (polyobj_t *)(po->link.next);
continue;
}
if ((polysec->flags & SF_TRIGGERSPECIAL_TOUCH))
touching = P_MobjTouchingPolyobj(po, mo);
else
touching = false;
inside = P_MobjInsidePolyobj(po, mo);
if (!(inside || touching))
{
po = (polyobj_t *)(po->link.next);
continue;
}
topheight = polysec->ceilingheight;
bottomheight = polysec->floorheight;
// We're inside it! Yess...
if (!(po->flags & POF_TESTHEIGHT)) // Don't do height checking
{
}
else if (po->flags & POF_SOLID)
{
// Thing must be on top of the floor to be affected...
if ((polysec->flags & SF_FLIPSPECIAL_FLOOR)
&& !(polysec->flags & SF_FLIPSPECIAL_CEILING))
{
if ((mo->eflags & MFE_VERTICALFLIP) || mo->z != topheight)
{
po = (polyobj_t *)(po->link.next);
continue;
}
}
else if ((polysec->flags & SF_FLIPSPECIAL_CEILING)
&& !(polysec->flags & SF_FLIPSPECIAL_FLOOR))
{
if (!(mo->eflags & MFE_VERTICALFLIP) || mo->z + mo->height != bottomheight)
{
po = (polyobj_t *)(po->link.next);
continue;
}
}
else if (polysec->flags & SF_FLIPSPECIAL_BOTH)
{
if (!((mo->eflags & MFE_VERTICALFLIP && mo->z + mo->height == bottomheight)
|| (!(mo->eflags & MFE_VERTICALFLIP) && mo->z == topheight)))
{
po = (polyobj_t *)(po->link.next);
continue;
}
}
}
else
{
// Water and DEATH FOG!!! heh
if (mo->z > topheight || (mo->z + mo->height) < bottomheight)
{
po = (polyobj_t *)(po->link.next);
continue;
}
}
return polysec;
}
}
#endif
for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next) for (node = mo->touching_sectorlist; node; node = node->m_sectorlist_next)
{ {
if (GETSECSPECIAL(node->m_sector->special, section) == number) if (GETSECSPECIAL(node->m_sector->special, section) == number)
@ -3611,8 +3703,7 @@ sector_t *P_MobjTouchingSectorSpecial(mobj_t *mo, INT32 section, INT32 number, b
else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING) else if ((rover->master->frontsector->flags & SF_FLIPSPECIAL_CEILING)
&& !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR)) && !(rover->master->frontsector->flags & SF_FLIPSPECIAL_FLOOR))
{ {
if (!(mo->eflags & MFE_VERTICALFLIP) if (!(mo->eflags & MFE_VERTICALFLIP) || mo->z + mo->height != bottomheight)
|| mo->z + mo->height != bottomheight)
continue; continue;
} }
else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH) else if (rover->master->frontsector->flags & SF_FLIPSPECIAL_BOTH)
@ -4106,7 +4197,7 @@ DoneSection2:
if (gametype == GT_COOP && lineindex != -1) // Custom exit! if (gametype == GT_COOP && lineindex != -1) // Custom exit!
{ {
// Special goodies with the block monsters flag depending on emeralds collected // Special goodies with the block monsters flag depending on emeralds collected
if ((lines[lineindex].flags & ML_BLOCKMONSTERS) && ALL7EMERALDS(emeralds)) if ((lines[lineindex].flags & ML_BLOCKPLAYERS) && ALL7EMERALDS(emeralds))
nextmapoverride = (INT16)(lines[lineindex].frontsector->ceilingheight>>FRACBITS); nextmapoverride = (INT16)(lines[lineindex].frontsector->ceilingheight>>FRACBITS);
else else
nextmapoverride = (INT16)(lines[lineindex].frontsector->floorheight>>FRACBITS); nextmapoverride = (INT16)(lines[lineindex].frontsector->floorheight>>FRACBITS);
@ -4205,11 +4296,7 @@ DoneSection2:
} }
break; break;
case 7: // SRB2kart 190117 - Oil Slick (deprecated) case 7: // SRB2Kart: Destroy items
if (roversector || P_MobjReadyToTrigger(player->mo, sector))
{
K_SpinPlayer(player, NULL, 0, NULL, false);
}
break; break;
case 8: // Zoom Tube Start case 8: // Zoom Tube Start
@ -5394,7 +5481,7 @@ static void P_AddRaiseThinker(sector_t *sec, line_t *sourceline)
raise->thinker.function.acp1 = (actionf_p1)T_RaiseSector; raise->thinker.function.acp1 = (actionf_p1)T_RaiseSector;
if (sourceline->flags & ML_BLOCKMONSTERS) if (sourceline->flags & ML_BLOCKPLAYERS)
raise->vars[0] = 1; raise->vars[0] = 1;
else else
raise->vars[0] = 0; raise->vars[0] = 0;
@ -5453,7 +5540,7 @@ static void P_AddOldAirbob(sector_t *sec, line_t *sourceline, boolean noadjust)
airbob->vars[3] = airbob->vars[2]; airbob->vars[3] = airbob->vars[2];
if (sourceline->flags & ML_BLOCKMONSTERS) if (sourceline->flags & ML_BLOCKPLAYERS)
airbob->vars[0] = 1; airbob->vars[0] = 1;
else else
airbob->vars[0] = 0; airbob->vars[0] = 0;
@ -6037,7 +6124,7 @@ void P_SpawnSpecials(INT32 fromnetsave)
break; break;
case 64: // Appearing/Disappearing FOF option case 64: // Appearing/Disappearing FOF option
if (lines[i].flags & ML_BLOCKMONSTERS) { // Find FOFs by control sector tag if (lines[i].flags & ML_BLOCKPLAYERS) { // Find FOFs by control sector tag
for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;) for (s = -1; (s = P_FindSectorFromLineTag(lines + i, s)) >= 0 ;)
for (j = 0; (unsigned)j < sectors[s].linecount; j++) for (j = 0; (unsigned)j < sectors[s].linecount; j++)
if (sectors[s].lines[j]->special >= 100 && sectors[s].lines[j]->special < 300) if (sectors[s].lines[j]->special >= 100 && sectors[s].lines[j]->special < 300)
@ -6265,7 +6352,7 @@ void P_SpawnSpecials(INT32 fromnetsave)
case 150: // Air bobbing platform case 150: // Air bobbing platform
case 151: // Adjustable air bobbing platform case 151: // Adjustable air bobbing platform
P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers); P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL, secthinkers);
lines[i].flags |= ML_BLOCKMONSTERS; lines[i].flags |= ML_BLOCKPLAYERS;
P_AddOldAirbob(lines[i].frontsector, lines + i, (lines[i].special != 151)); P_AddOldAirbob(lines[i].frontsector, lines + i, (lines[i].special != 151));
break; break;
case 152: // Adjustable air bobbing platform in reverse case 152: // Adjustable air bobbing platform in reverse
@ -6320,14 +6407,14 @@ void P_SpawnSpecials(INT32 fromnetsave)
case 176: // Air bobbing platform that will crumble and bob on the water when it falls and hits case 176: // Air bobbing platform that will crumble and bob on the water when it falls and hits
P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_FLOATBOB|FF_CRUMBLE, secthinkers); P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_FLOATBOB|FF_CRUMBLE, secthinkers);
lines[i].flags |= ML_BLOCKMONSTERS; lines[i].flags |= ML_BLOCKPLAYERS;
P_AddOldAirbob(lines[i].frontsector, lines + i, true); P_AddOldAirbob(lines[i].frontsector, lines + i, true);
break; break;
case 177: // Air bobbing platform that will crumble and bob on case 177: // Air bobbing platform that will crumble and bob on
// the water when it falls and hits, then never return // the water when it falls and hits, then never return
P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_FLOATBOB|FF_CRUMBLE|FF_NORETURN, secthinkers); P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_FLOATBOB|FF_CRUMBLE|FF_NORETURN, secthinkers);
lines[i].flags |= ML_BLOCKMONSTERS; lines[i].flags |= ML_BLOCKPLAYERS;
P_AddOldAirbob(lines[i].frontsector, lines + i, true); P_AddOldAirbob(lines[i].frontsector, lines + i, true);
break; break;
@ -6341,7 +6428,7 @@ void P_SpawnSpecials(INT32 fromnetsave)
case 180: // Air bobbing platform that will crumble case 180: // Air bobbing platform that will crumble
P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_CRUMBLE, secthinkers); P_AddFakeFloorsByLine(i, FF_EXISTS|FF_SOLID|FF_RENDERALL|FF_CUTLEVEL|FF_CRUMBLE, secthinkers);
lines[i].flags |= ML_BLOCKMONSTERS; lines[i].flags |= ML_BLOCKPLAYERS;
P_AddOldAirbob(lines[i].frontsector, lines + i, true); P_AddOldAirbob(lines[i].frontsector, lines + i, true);
break; break;