- removed most global references to the tag manager by routing most access to FLevelocals.

This commit is contained in:
Christoph Oelckers 2019-01-24 01:40:09 +01:00
commit 7e9340f3b7
33 changed files with 291 additions and 262 deletions

View file

@ -1838,7 +1838,7 @@ DPlaneWatcher::DPlaneWatcher (AActor *it, line_t *line, int lineSide, bool ceili
Args[2] = arg2;
Args[3] = arg3;
Args[4] = arg4;
secnum = P_FindFirstSectorFromTag (tag);
secnum = level.FindFirstSectorFromTag (tag);
if (secnum >= 0)
{
secplane_t plane;
@ -3609,7 +3609,7 @@ do_count:
if (actor->health > 0 &&
(kind == NULL || actor->IsA (kind)))
{
if (tag == -1 || tagManager.SectorHasTag(actor->Sector, tag))
if (tag == -1 || level.SectorHasTag(actor->Sector, tag))
{
// Don't count items in somebody's inventory
if (actor->IsMapActor())
@ -3628,7 +3628,7 @@ do_count:
if (actor->health > 0 &&
(kind == NULL || actor->IsA (kind)))
{
if (tag == -1 || tagManager.SectorHasTag(actor->Sector, tag))
if (tag == -1 || level.SectorHasTag(actor->Sector, tag))
{
// Don't count items in somebody's inventory
if (actor->IsMapActor())
@ -3664,7 +3664,7 @@ void DLevelScript::ChangeFlat (int tag, int name, bool floorOrCeiling)
flat = TexMan.GetTextureID(flatname, ETextureType::Flat, FTextureManager::TEXMAN_Overridable);
FSectorTagIterator it(tag);
auto it = level.GetSectorTagIterator(tag);
while ((secnum = it.Next()) >= 0)
{
int pos = floorOrCeiling? sector_t::ceiling : sector_t::floor;
@ -3696,7 +3696,7 @@ void DLevelScript::SetLineTexture (int lineid, int side, int position, int name)
texture = TexMan.GetTextureID(texname, ETextureType::Wall, FTextureManager::TEXMAN_Overridable);
FLineIdIterator itr(lineid);
auto itr = level.GetLineIdIterator(lineid);
while ((linenum = itr.Next()) >= 0)
{
side_t *sidedef;
@ -4802,7 +4802,7 @@ int DLevelScript::SideFromID(int id, int side)
}
else
{
int line = P_FindFirstLineFromID(id);
int line = level.FindFirstLineFromID(id);
if (line == -1) return -1;
if (level.lines[line].sidedef[side] == NULL) return -1;
return level.lines[line].sidedef[side]->UDMFIndex;
@ -4818,7 +4818,7 @@ int DLevelScript::LineFromID(int id)
}
else
{
return P_FindFirstLineFromID(id);
return level.FindFirstLineFromID(id);
}
}
@ -5304,10 +5304,10 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
return 0; // Not implemented yet
case ACSF_GetSectorUDMFInt:
return GetUDMFInt(UDMF_Sector, P_FindFirstSectorFromTag(args[0]), level.Behaviors.LookupString(args[1]));
return GetUDMFInt(UDMF_Sector, level.FindFirstSectorFromTag(args[0]), level.Behaviors.LookupString(args[1]));
case ACSF_GetSectorUDMFFixed:
return DoubleToACS(GetUDMFFloat(UDMF_Sector, P_FindFirstSectorFromTag(args[0]), level.Behaviors.LookupString(args[1])));
return DoubleToACS(GetUDMFFloat(UDMF_Sector, level.FindFirstSectorFromTag(args[0]), level.Behaviors.LookupString(args[1])));
case ACSF_GetSideUDMFInt:
return GetUDMFInt(UDMF_Side, SideFromID(args[0], args[1]), level.Behaviors.LookupString(args[2]));
@ -5639,7 +5639,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
int space = args[2] < CHAN_FLOOR || args[2] > CHAN_INTERIOR ? CHAN_FULLHEIGHT : args[2];
if (seqname != NULL)
{
FSectorTagIterator it(args[0]);
auto it = level.GetSectorTagIterator(args[0]);
int s;
while ((s = it.Next()) >= 0)
{
@ -6187,7 +6187,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
if (argCount >= 2)
{
int line;
FLineIdIterator itr(args[0]);
auto itr = level.GetLineIdIterator(args[0]);
while ((line = itr.Next()) >= 0)
{
level.lines[line].activation = args[1];
@ -6198,7 +6198,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
case ACSF_GetLineActivation:
if (argCount > 0)
{
int line = P_FindFirstLineFromID(args[0]);
int line = level.FindFirstLineFromID(args[0]);
return line >= 0 ? level.lines[line].activation : 0;
}
break;
@ -6411,7 +6411,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
case ACSF_SetSectorDamage:
if (argCount >= 2)
{
FSectorTagIterator it(args[0]);
auto it = level.GetSectorTagIterator(args[0]);
int s;
while ((s = it.Next()) >= 0)
{
@ -6431,7 +6431,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
if (args[1] == sector_t::floor || args[1] == sector_t::ceiling)
{
int terrain = P_FindTerrain(level.Behaviors.LookupString(args[2]));
FSectorTagIterator it(args[0]);
auto it = level.GetSectorTagIterator(args[0]);
int s;
while ((s = it.Next()) >= 0)
{
@ -6572,7 +6572,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
float height = float(args[5]);
if (args[2] == -1) color = -1;
FSectorTagIterator it(args[0]);
auto it = level.GetSectorTagIterator(args[0]);
int s;
while ((s = it.Next()) >= 0)
{
@ -6584,7 +6584,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
case ACSF_SetFogDensity:
{
FSectorTagIterator it(args[0]);
auto it = level.GetSectorTagIterator(args[0]);
int s;
int d = clamp(args[1]/2, 0, 255);
while ((s = it.Next()) >= 0)
@ -6644,7 +6644,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
case ACSF_GetSectorHealth:
{
int part = args[1];
FSectorTagIterator it(args[0]);
auto it = level.GetSectorTagIterator(args[0]);
int s = it.Next();
if (s < 0)
return 0;
@ -6670,7 +6670,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
case ACSF_GetLineHealth:
{
FLineIdIterator it(args[0]);
auto it = level.GetLineIdIterator(args[0]);
int l = it.Next();
if (l < 0)
return 0;
@ -6687,7 +6687,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
case ACSF_GetLineX:
case ACSF_GetLineY:
{
FLineIdIterator it(args[0]);
auto it = level.GetLineIdIterator(args[0]);
int lineno = it.Next();
if (lineno < 0) return 0;
DVector2 delta = level.lines[lineno].Delta();
@ -6803,7 +6803,7 @@ int DLevelScript::RunScript ()
// state running
{
int secnum;
FSectorTagIterator it(statedata);
auto it = level.GetSectorTagIterator(statedata);
while ((secnum = it.Next()) >= 0)
{
if (level.sectors[secnum].floordata || level.sectors[secnum].ceilingdata)
@ -8911,7 +8911,7 @@ scriptwait:
{
int lineno;
FLineIdIterator itr(STACK(2));
auto itr = level.GetLineIdIterator(STACK(2));
while ((lineno = itr.Next()) >= 0)
{
auto &line = level.lines[lineno];
@ -8948,7 +8948,7 @@ scriptwait:
{
int line;
FLineIdIterator itr(STACK(2));
auto itr = level.GetLineIdIterator(STACK(2));
while ((line = itr.Next()) >= 0)
{
if (STACK(1))
@ -8974,7 +8974,7 @@ scriptwait:
arg0 = -FName(level.Behaviors.LookupString(arg0));
}
FLineIdIterator itr(STACK(7));
auto itr = level.GetLineIdIterator(STACK(7));
while ((linenum = itr.Next()) >= 0)
{
line_t *line = &level.lines[linenum];
@ -9450,9 +9450,9 @@ scriptwait:
double z = 0;
if (tag != 0)
secnum = P_FindFirstSectorFromTag (tag);
secnum = level.FindFirstSectorFromTag (tag);
else
secnum = P_PointInSector (x, y)->sectornum;
secnum = level.PointInSector (DVector2(x, y))->sectornum;
if (secnum >= 0)
{
@ -9472,7 +9472,7 @@ scriptwait:
case PCD_GETSECTORLIGHTLEVEL:
{
int secnum = P_FindFirstSectorFromTag (STACK(1));
int secnum = level.FindFirstSectorFromTag (STACK(1));
int z = -1;
if (secnum >= 0)