mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-04-01 07:21:34 +00:00
Replace most P_FindSpecialLineFromTag() cases with Tag_FindLineSpecial(), which settle with the first found result.
This commit is contained in:
parent
d518703334
commit
439fde3434
9 changed files with 38 additions and 21 deletions
|
@ -6107,7 +6107,7 @@ void A_RockSpawn(mobj_t *actor)
|
|||
{
|
||||
mobj_t *mo;
|
||||
mobjtype_t type;
|
||||
INT32 i = P_FindSpecialLineFromTag(12, (INT16)actor->threshold, -1);
|
||||
INT32 i = Tag_FindLineSpecial(12, (INT16)actor->threshold);
|
||||
line_t *line;
|
||||
fixed_t dist;
|
||||
fixed_t randomoomph;
|
||||
|
@ -8794,19 +8794,19 @@ void A_Dye(mobj_t *actor)
|
|||
#endif
|
||||
if (color >= MAXTRANSLATIONS)
|
||||
return;
|
||||
|
||||
|
||||
if (!color)
|
||||
target->colorized = false;
|
||||
else
|
||||
target->colorized = true;
|
||||
|
||||
|
||||
// What if it's a player?
|
||||
if (target->player)
|
||||
{
|
||||
target->player->powers[pw_dye] = color;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
target->color = color;
|
||||
}
|
||||
|
||||
|
|
|
@ -2549,7 +2549,7 @@ void EV_CrumbleChain(sector_t *sec, ffloor_t *rover)
|
|||
|
||||
if (controlsec->tag != 0)
|
||||
{
|
||||
INT32 tagline = P_FindSpecialLineFromTag(14, controlsec->tag, -1);
|
||||
INT32 tagline = Tag_FindLineSpecial(14, controlsec->tag);
|
||||
if (tagline != -1)
|
||||
{
|
||||
if (sides[lines[tagline].sidenum[0]].toptexture)
|
||||
|
|
|
@ -3552,7 +3552,7 @@ static boolean P_CameraCheckHeat(camera_t *thiscam)
|
|||
// see if we are in water
|
||||
sector = thiscam->subsector->sector;
|
||||
|
||||
if (P_FindSpecialLineFromTag(13, sector->tag, -1) != -1)
|
||||
if (Tag_FindLineSpecial(13, sector->tag) != -1)
|
||||
return true;
|
||||
|
||||
if (sector->ffloors)
|
||||
|
@ -3573,7 +3573,7 @@ static boolean P_CameraCheckHeat(camera_t *thiscam)
|
|||
*rover->bottomheight))
|
||||
continue;
|
||||
|
||||
if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1)
|
||||
if (Tag_FindLineSpecial(13, rover->master->frontsector->tag) != -1)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -12035,8 +12035,7 @@ static boolean P_SetupMace(mapthing_t *mthing, mobj_t *mobj, boolean *doangle)
|
|||
const size_t mthingi = (size_t)(mthing - mapthings);
|
||||
|
||||
// Find the corresponding linedef special, using angle as tag
|
||||
// P_FindSpecialLineFromTag works here now =D
|
||||
line = P_FindSpecialLineFromTag(9, mthing->angle, -1);
|
||||
line = Tag_FindLineSpecial(9, mthing->angle);
|
||||
|
||||
if (line == -1)
|
||||
{
|
||||
|
@ -12346,7 +12345,7 @@ static boolean P_SetupParticleGen(mapthing_t *mthing, mobj_t *mobj)
|
|||
const size_t mthingi = (size_t)(mthing - mapthings);
|
||||
|
||||
// Find the corresponding linedef special, using angle as tag
|
||||
line = P_FindSpecialLineFromTag(15, mthing->angle, -1);
|
||||
line = Tag_FindLineSpecial(15, mthing->angle);
|
||||
|
||||
if (line == -1)
|
||||
{
|
||||
|
|
|
@ -238,7 +238,7 @@ boolean P_BBoxInsidePolyobj(polyobj_t *po, fixed_t *bbox)
|
|||
//
|
||||
void Polyobj_GetInfo(INT16 poid, INT32 *poflags, INT32 *parentID, INT32 *potrans)
|
||||
{
|
||||
INT32 i = P_FindSpecialLineFromTag(POLYINFO_SPECIALNUM, poid, -1);
|
||||
INT32 i = Tag_FindLineSpecial(POLYINFO_SPECIALNUM, poid);
|
||||
|
||||
if (i == -1)
|
||||
return; // no extra settings to apply, let's leave it
|
||||
|
|
|
@ -139,7 +139,7 @@ void T_DynamicSlopeVert (dynplanethink_t* th)
|
|||
INT32 l;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
l = P_FindSpecialLineFromTag(799, th->tags[i], -1);
|
||||
l = Tag_FindLineSpecial(799, th->tags[i]);
|
||||
if (l != -1) {
|
||||
th->vex[i].z = lines[l].frontsector->floorheight;
|
||||
}
|
||||
|
|
10
src/p_spec.c
10
src/p_spec.c
|
@ -4535,7 +4535,7 @@ DoneSection2:
|
|||
if (player->powers[pw_flashing] != 0 && player->powers[pw_flashing] < TICRATE/2)
|
||||
break;
|
||||
|
||||
i = P_FindSpecialLineFromTag(4, sector->tag, -1);
|
||||
i = Tag_FindLineSpecial(4, sector->tag);
|
||||
|
||||
if (i != -1)
|
||||
{
|
||||
|
@ -4647,7 +4647,7 @@ DoneSection2:
|
|||
// important: use sector->tag on next line instead of player->mo->subsector->tag
|
||||
// this part is different from in P_PlayerThink, this is what was causing
|
||||
// FOF custom exits not to work.
|
||||
lineindex = P_FindSpecialLineFromTag(2, sector->tag, -1);
|
||||
lineindex = Tag_FindLineSpecial(2, sector->tag);
|
||||
|
||||
if (gametype == GT_COOP && lineindex != -1) // Custom exit!
|
||||
{
|
||||
|
@ -4772,7 +4772,7 @@ DoneSection2:
|
|||
break;
|
||||
|
||||
// Find line #3 tagged to this sector
|
||||
lineindex = P_FindSpecialLineFromTag(3, sector->tag, -1);
|
||||
lineindex = Tag_FindLineSpecial(3, sector->tag);
|
||||
|
||||
if (lineindex == -1)
|
||||
{
|
||||
|
@ -4854,7 +4854,7 @@ DoneSection2:
|
|||
break;
|
||||
|
||||
// Find line #3 tagged to this sector
|
||||
lineindex = P_FindSpecialLineFromTag(3, sector->tag, -1);
|
||||
lineindex = Tag_FindLineSpecial(3, sector->tag);
|
||||
|
||||
if (lineindex == -1)
|
||||
{
|
||||
|
@ -5001,7 +5001,7 @@ DoneSection2:
|
|||
memset(&resulthigh, 0x00, sizeof(resulthigh));
|
||||
|
||||
// Find line #11 tagged to this sector
|
||||
lineindex = P_FindSpecialLineFromTag(11, sector->tag, -1);
|
||||
lineindex = Tag_FindLineSpecial(11, sector->tag);
|
||||
|
||||
if (lineindex == -1)
|
||||
{
|
||||
|
|
|
@ -10654,7 +10654,7 @@ static void P_CalcPostImg(player_t *player)
|
|||
|
||||
// see if we are in heat (no, not THAT kind of heat...)
|
||||
|
||||
if (P_FindSpecialLineFromTag(13, sector->tag, -1) != -1)
|
||||
if (Tag_FindLineSpecial(13, sector->tag) != -1)
|
||||
*type = postimg_heat;
|
||||
else if (sector->ffloors)
|
||||
{
|
||||
|
@ -10673,7 +10673,7 @@ static void P_CalcPostImg(player_t *player)
|
|||
if (pviewheight >= topheight || pviewheight <= bottomheight)
|
||||
continue;
|
||||
|
||||
if (P_FindSpecialLineFromTag(13, rover->master->frontsector->tag, -1) != -1)
|
||||
if (Tag_FindLineSpecial(13, rover->master->frontsector->tag) != -1)
|
||||
*type = postimg_heat;
|
||||
}
|
||||
}
|
||||
|
@ -10778,7 +10778,7 @@ static INT32 P_GetMinecartSpecialLine(sector_t *sec)
|
|||
return line;
|
||||
|
||||
if (sec->tag != 0)
|
||||
line = P_FindSpecialLineFromTag(16, sec->tag, -1);
|
||||
line = Tag_FindLineSpecial(16, sec->tag);
|
||||
|
||||
// Also try for lines facing the sector itself, with tag 0.
|
||||
{
|
||||
|
@ -12213,7 +12213,7 @@ void P_PlayerThink(player_t *player)
|
|||
player->powers[pw_nocontrol]--;
|
||||
else
|
||||
player->powers[pw_nocontrol] = 0;
|
||||
|
||||
|
||||
//pw_super acts as a timer now
|
||||
if (player->powers[pw_super]
|
||||
&& (player->mo->state < &states[S_PLAY_SUPER_TRANS1]
|
||||
|
|
|
@ -111,3 +111,19 @@ INT32 Tag_Iterate_Things (const INT16 tag, const size_t p)
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
INT32 Tag_FindLineSpecial(const INT16 tag, const INT16 special)
|
||||
{
|
||||
TAG_ITER_C
|
||||
INT32 i;
|
||||
|
||||
TAG_ITER_LINES(tag, i)
|
||||
{
|
||||
if (i == -1)
|
||||
return -1;
|
||||
|
||||
if (lines[i].special == special)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@ INT32 Tag_Iterate_Sectors (const INT16 tag, const size_t p);
|
|||
INT32 Tag_Iterate_Lines (const INT16 tag, const size_t p);
|
||||
INT32 Tag_Iterate_Things (const INT16 tag, const size_t p);
|
||||
|
||||
INT32 Tag_FindLineSpecial(const INT16 tag, const INT16 special);
|
||||
|
||||
#define TAG_ITER_C size_t kkkk;
|
||||
#define TAG_ITER(fn, tag, id) for(kkkk = 0; (id = fn(tag, kkkk)) >= 0; kkkk++)
|
||||
|
||||
|
|
Loading…
Reference in a new issue