mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-19 08:01:50 +00:00
Wrap all iterator calls in the map loader into FLevelLocals methods.
This should later be done for everything else as well, but the map loader should really be free of global dependencies ASAP. Also replace TThinkerIterator<AActor> with FThinkerIterator globally because this only adds pointless type checks - with all actor subclasses being scripted this class has become redundant.
This commit is contained in:
parent
85b5f8d0a0
commit
65750bd7bf
11 changed files with 144 additions and 107 deletions
16
src/actor.h
16
src/actor.h
|
@ -1527,22 +1527,6 @@ private:
|
|||
int id;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class TActorIterator : public FActorIterator
|
||||
{
|
||||
public:
|
||||
TActorIterator (int id) : FActorIterator (id) {}
|
||||
T *Next ()
|
||||
{
|
||||
AActor *actor;
|
||||
do
|
||||
{
|
||||
actor = FActorIterator::Next ();
|
||||
} while (actor && !actor->IsKindOf (RUNTIME_CLASS(T)));
|
||||
return static_cast<T *>(actor);
|
||||
}
|
||||
};
|
||||
|
||||
class NActorIterator : public FActorIterator
|
||||
{
|
||||
const PClass *type;
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
#include "p_local.h"
|
||||
#include "po_man.h"
|
||||
#include "p_acs.h"
|
||||
#include "p_tags.h"
|
||||
#include "actor.h"
|
||||
#include "p_destructible.h"
|
||||
#include "r_data/r_sections.h"
|
||||
#include "r_data/r_canvastexture.h"
|
||||
|
@ -113,6 +115,51 @@ struct FLevelLocals : public FLevelData
|
|||
void ClearLevelData();
|
||||
void ClearPortals();
|
||||
bool CheckIfExitIsGood(AActor *self, level_info_t *newmap);
|
||||
FSectorTagIterator GetSectorTagIterator(int tag)
|
||||
{
|
||||
return FSectorTagIterator(tag);
|
||||
}
|
||||
FSectorTagIterator GetSectorTagIterator(int tag, line_t *line)
|
||||
{
|
||||
return FSectorTagIterator(tag, line);
|
||||
}
|
||||
FLineIdIterator GetLineIdIterator(int tag)
|
||||
{
|
||||
return FLineIdIterator(tag);
|
||||
}
|
||||
template<class T> TThinkerIterator<T> GetThinkerIterator(FName subtype = NAME_None)
|
||||
{
|
||||
if (subtype == NAME_None) return TThinkerIterator<T>();
|
||||
else return TThinkerIterator<T>(subtype);
|
||||
}
|
||||
FActorIterator GetActorIterator(int tid)
|
||||
{
|
||||
return FActorIterator(tid);
|
||||
}
|
||||
NActorIterator GetActorIterator(FName type, int tid)
|
||||
{
|
||||
return NActorIterator(type, tid);
|
||||
}
|
||||
bool SectorHasTags(sector_t *sector)
|
||||
{
|
||||
return tagManager.SectorHasTags(sector);
|
||||
}
|
||||
bool SectorHasTag(sector_t *sector, int tag)
|
||||
{
|
||||
return tagManager.SectorHasTag(sector, tag);
|
||||
}
|
||||
bool SectorHasTag(int sector, int tag)
|
||||
{
|
||||
return tagManager.SectorHasTag(sector, tag);
|
||||
}
|
||||
bool LineHasId(int line, int tag)
|
||||
{
|
||||
return tagManager.LineHasID(line, tag);
|
||||
}
|
||||
sector_t *PointInSector(const DVector2 &pos)
|
||||
{
|
||||
return P_PointInSector(pos);
|
||||
}
|
||||
|
||||
uint8_t md5[16]; // for savegame validation. If the MD5 does not match the savegame won't be loaded.
|
||||
int time; // time in the hub
|
||||
|
@ -328,4 +375,4 @@ inline bool line_t::hitSkyWall(AActor* mo) const
|
|||
backsector->GetTexture(sector_t::ceiling) == skyflatnum &&
|
||||
mo->Z() >= backsector->ceilingplane.ZatPoint(mo->PosRelative(this));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -113,8 +113,6 @@ void InitRenderInfo();
|
|||
|
||||
extern AActor *SpawnMapThing (int index, FMapThing *mthing, int position);
|
||||
|
||||
extern void P_TranslateTeleportThings (void);
|
||||
|
||||
EXTERN_CVAR(Bool, am_textured)
|
||||
|
||||
CVAR (Bool, genblockmap, false, CVAR_SERVERINFO|CVAR_GLOBALCONFIG);
|
||||
|
@ -125,6 +123,61 @@ inline bool P_LoadBuildMap(uint8_t *mapdata, size_t len, FMapThing **things, int
|
|||
return false;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Now that ZDoom again gives the option of using Doom's original teleport
|
||||
// behavior, only teleport dests in a sector with a 0 tag need to be
|
||||
// given a TID. And since Doom format maps don't have TIDs, we can safely
|
||||
// give them TID 1.
|
||||
//
|
||||
//===========================================================================
|
||||
|
||||
void MapLoader::TranslateTeleportThings ()
|
||||
{
|
||||
AActor *dest;
|
||||
auto iterator = Level->GetThinkerIterator<AActor>(NAME_TeleportDest);
|
||||
bool foundSomething = false;
|
||||
|
||||
while ( (dest = iterator.Next()) )
|
||||
{
|
||||
if (!Level->SectorHasTags(dest->Sector))
|
||||
{
|
||||
dest->tid = 1;
|
||||
dest->AddToHash ();
|
||||
foundSomething = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundSomething)
|
||||
{
|
||||
for (auto &line : Level->lines)
|
||||
{
|
||||
if (line.special == Teleport)
|
||||
{
|
||||
if (line.args[1] == 0)
|
||||
{
|
||||
line.args[0] = 1;
|
||||
}
|
||||
}
|
||||
else if (line.special == Teleport_NoFog)
|
||||
{
|
||||
if (line.args[2] == 0)
|
||||
{
|
||||
line.args[0] = 1;
|
||||
}
|
||||
}
|
||||
else if (line.special == Teleport_ZombieChanger)
|
||||
{
|
||||
if (line.args[1] == 0)
|
||||
{
|
||||
line.args[0] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// Sets a sidedef's texture and prints a message if it's not present.
|
||||
|
@ -1570,7 +1623,7 @@ void MapLoader::FinishLoadingLineDef(line_t *ld, int alpha)
|
|||
{
|
||||
for (unsigned j = 0; j < Level->lines.Size(); j++)
|
||||
{
|
||||
if (tagManager.LineHasID(j, ld->args[0]))
|
||||
if (Level->LineHasId(j, ld->args[0]))
|
||||
{
|
||||
Level->lines[j].alpha = dalpha;
|
||||
if (additive)
|
||||
|
@ -2074,7 +2127,7 @@ void MapLoader::ProcessSideTextures(bool checktranmap, side_t *sd, sector_t *sec
|
|||
{
|
||||
for (unsigned s = 0; s < Level->sectors.Size(); s++)
|
||||
{
|
||||
if (tagManager.SectorHasTag(s, tag))
|
||||
if (Level->SectorHasTag(s, tag))
|
||||
{
|
||||
if (colorgood)
|
||||
{
|
||||
|
@ -3198,7 +3251,7 @@ void MapLoader::LoadLevel(MapData *map, const char *lumpname, int position)
|
|||
players[i].health = players[i].mo->health;
|
||||
}
|
||||
if (!map->HasBehavior && !map->isText)
|
||||
P_TranslateTeleportThings(); // [RH] Assign teleport destination TIDs
|
||||
TranslateTeleportThings(); // [RH] Assign teleport destination TIDs
|
||||
|
||||
if (oldvertextable != nullptr)
|
||||
{
|
||||
|
|
|
@ -188,7 +188,8 @@ private:
|
|||
void SpawnSkybox(AActor *origin);
|
||||
void SetupFloorPortal (AActor *point);
|
||||
void SetupCeilingPortal (AActor *point);
|
||||
|
||||
void TranslateTeleportThings();
|
||||
|
||||
void SetTexture(side_t *side, int position, const char *name, FMissingTextureTracker &track);
|
||||
void SetTexture(sector_t *sector, int index, int position, const char *name, FMissingTextureTracker &track, bool truncate);
|
||||
void SetTexture(side_t *side, int position, uint32_t *blend, const char *name);
|
||||
|
|
|
@ -86,6 +86,8 @@ xx(PointPuller)
|
|||
|
||||
xx(UpperStackLookOnly)
|
||||
xx(LowerStackLookOnly)
|
||||
xx(StackPoint)
|
||||
xx(SkyCamCompat)
|
||||
|
||||
xx(BasicArmorBonus)
|
||||
xx(BasicArmorPickup)
|
||||
|
|
|
@ -5503,7 +5503,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
|
|||
}
|
||||
else
|
||||
{
|
||||
TActorIterator<AActor> iterator(args[0]);
|
||||
FActorIterator iterator(args[0]);
|
||||
|
||||
while ((actor = iterator.Next()))
|
||||
{
|
||||
|
@ -5529,7 +5529,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
|
|||
}
|
||||
else
|
||||
{
|
||||
TActorIterator<AActor> iterator(args[0]);
|
||||
FActorIterator iterator(args[0]);
|
||||
|
||||
while ( (actor = iterator.Next()) )
|
||||
{
|
||||
|
@ -5568,7 +5568,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
|
|||
}
|
||||
else
|
||||
{
|
||||
TActorIterator<AActor> iterator(args[0]);
|
||||
FActorIterator iterator(args[0]);
|
||||
|
||||
while ( (actor = iterator.Next()) )
|
||||
{
|
||||
|
@ -5699,7 +5699,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
|
|||
|
||||
if (args[1] == 0) return 1; // [KS] I'm sure the activator can see itself.
|
||||
|
||||
TActorIterator<AActor> dstiter (args[1]);
|
||||
FActorIterator dstiter (args[1]);
|
||||
|
||||
while ( (dest = dstiter.Next ()) )
|
||||
{
|
||||
|
@ -5708,13 +5708,13 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args)
|
|||
}
|
||||
else
|
||||
{
|
||||
TActorIterator<AActor> srciter (args[0]);
|
||||
FActorIterator srciter (args[0]);
|
||||
|
||||
while ( (source = srciter.Next ()) )
|
||||
{
|
||||
if (args[1] != 0)
|
||||
{
|
||||
TActorIterator<AActor> dstiter (args[1]);
|
||||
FActorIterator dstiter (args[1]);
|
||||
while ( (dest = dstiter.Next ()) )
|
||||
{
|
||||
if (P_CheckSight(source, dest, flags)) return 1;
|
||||
|
|
|
@ -1768,7 +1768,7 @@ FUNC(LS_Thing_Raise)
|
|||
}
|
||||
else
|
||||
{
|
||||
TActorIterator<AActor> iterator (arg0);
|
||||
FActorIterator iterator (arg0);
|
||||
|
||||
while ( (target = iterator.Next ()) )
|
||||
{
|
||||
|
@ -1795,7 +1795,7 @@ FUNC(LS_Thing_Stop)
|
|||
}
|
||||
else
|
||||
{
|
||||
TActorIterator<AActor> iterator (arg0);
|
||||
FActorIterator iterator (arg0);
|
||||
|
||||
while ( (target = iterator.Next ()) )
|
||||
{
|
||||
|
@ -1811,7 +1811,7 @@ FUNC(LS_Thing_Stop)
|
|||
FUNC(LS_Thing_SetGoal)
|
||||
// Thing_SetGoal (tid, goal, delay, chasegoal)
|
||||
{
|
||||
TActorIterator<AActor> selfiterator (arg0);
|
||||
FActorIterator selfiterator (arg0);
|
||||
NActorIterator goaliterator (NAME_PatrolPoint, arg1);
|
||||
AActor *self;
|
||||
AActor *goal = goaliterator.Next ();
|
||||
|
@ -1861,7 +1861,7 @@ enum
|
|||
FUNC(LS_Thing_SetTranslation)
|
||||
// Thing_SetTranslation (tid, range)
|
||||
{
|
||||
TActorIterator<AActor> iterator (arg0);
|
||||
FActorIterator iterator (arg0);
|
||||
int range;
|
||||
AActor *target;
|
||||
bool ok = false;
|
||||
|
|
|
@ -372,7 +372,7 @@ void MapLoader::SpawnPushers ()
|
|||
{
|
||||
case Sector_SetWind: // wind
|
||||
{
|
||||
FSectorTagIterator itr(l->args[0]);
|
||||
auto itr = Level->GetSectorTagIterator(l->args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
Create<DPusher>(DPusher::p_wind, l->args[3] ? l : nullptr, l->args[1], l->args[2], nullptr, s);
|
||||
l->special = 0;
|
||||
|
@ -381,7 +381,7 @@ void MapLoader::SpawnPushers ()
|
|||
|
||||
case Sector_SetCurrent: // current
|
||||
{
|
||||
FSectorTagIterator itr(l->args[0]);
|
||||
auto itr = Level->GetSectorTagIterator(l->args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
Create<DPusher>(DPusher::p_current, l->args[3] ? l : nullptr, l->args[1], l->args[2], nullptr, s);
|
||||
l->special = 0;
|
||||
|
@ -390,7 +390,7 @@ void MapLoader::SpawnPushers ()
|
|||
|
||||
case PointPush_SetForce: // push/pull
|
||||
if (l->args[0]) { // [RH] Find thing by sector
|
||||
FSectorTagIterator itr(l->args[0]);
|
||||
auto itr = Level->GetSectorTagIterator(l->args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
{
|
||||
AActor *thing = GetPushThing (s);
|
||||
|
@ -403,7 +403,7 @@ void MapLoader::SpawnPushers ()
|
|||
}
|
||||
} else { // [RH] Find thing by tid
|
||||
AActor *thing;
|
||||
FActorIterator iterator (l->args[1]);
|
||||
auto iterator = Level->GetActorIterator(l->args[1]);
|
||||
|
||||
while ( (thing = iterator.Next ()) )
|
||||
{
|
||||
|
|
|
@ -433,7 +433,7 @@ void MapLoader::SpawnScrollers()
|
|||
if (line.special == Sector_CopyScroller)
|
||||
{
|
||||
// don't allow copying the scroller if the sector has the same tag as it would just duplicate it.
|
||||
if (!tagManager.SectorHasTag(line.frontsector, line.args[0]))
|
||||
if (!Level->SectorHasTag(line.frontsector, line.args[0]))
|
||||
{
|
||||
copyscrollers.Push(line.Index());
|
||||
}
|
||||
|
@ -511,7 +511,7 @@ void MapLoader::SpawnScrollers()
|
|||
|
||||
case Scroll_Ceiling:
|
||||
{
|
||||
FSectorTagIterator itr(l->args[0]);
|
||||
auto itr = Level->GetSectorTagIterator(l->args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
{
|
||||
Create<DScroller>(EScroll::sc_ceiling, -dx, dy, control, &Level->sectors[s], nullptr, accel);
|
||||
|
@ -531,7 +531,7 @@ void MapLoader::SpawnScrollers()
|
|||
case Scroll_Floor:
|
||||
if (l->args[2] != 1)
|
||||
{ // scroll the floor texture
|
||||
FSectorTagIterator itr(l->args[0]);
|
||||
auto itr = Level->GetSectorTagIterator(l->args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
{
|
||||
Create<DScroller> (EScroll::sc_floor, -dx, dy, control, &Level->sectors[s], nullptr, accel);
|
||||
|
@ -549,7 +549,7 @@ void MapLoader::SpawnScrollers()
|
|||
|
||||
if (l->args[2] > 0)
|
||||
{ // carry objects on the floor
|
||||
FSectorTagIterator itr(l->args[0]);
|
||||
auto itr = Level->GetSectorTagIterator(l->args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
{
|
||||
Create<DScroller> (EScroll::sc_carry, dx, dy, control, &Level->sectors[s], nullptr, accel);
|
||||
|
@ -570,7 +570,7 @@ void MapLoader::SpawnScrollers()
|
|||
// (same direction and speed as scrolling floors)
|
||||
case Scroll_Texture_Model:
|
||||
{
|
||||
FLineIdIterator itr(l->args[0]);
|
||||
auto itr = Level->GetLineIdIterator(l->args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
{
|
||||
if (s != (int)i)
|
||||
|
@ -713,7 +713,7 @@ void SetScroller (FLevelLocals *Level, int tag, EScroll type, double dx, double
|
|||
{
|
||||
if (scroller->IsType (type))
|
||||
{
|
||||
if (tagManager.SectorHasTag(scroller->GetSector(), tag))
|
||||
if (Level->SectorHasTag(scroller->GetSector(), tag))
|
||||
{
|
||||
i++;
|
||||
scroller->SetRate (dx, dy);
|
||||
|
@ -727,7 +727,7 @@ void SetScroller (FLevelLocals *Level, int tag, EScroll type, double dx, double
|
|||
}
|
||||
|
||||
// Need to create scrollers for the sector(s)
|
||||
FSectorTagIterator itr(tag);
|
||||
auto itr = Level->GetSectorTagIterator(tag);
|
||||
while ((i = itr.Next()) >= 0)
|
||||
{
|
||||
Create<DScroller> (type, dx, dy, nullptr, &Level->sectors[i], nullptr, 0);
|
||||
|
|
|
@ -911,7 +911,7 @@ void DWallLightTransfer::DoTransfer (short lightlevel, int target, uint8_t flags
|
|||
|
||||
void MapLoader::SetupFloorPortal (AActor *point)
|
||||
{
|
||||
NActorIterator it (NAME_LowerStackLookOnly, point->tid);
|
||||
auto it = Level->GetActorIterator(NAME_LowerStackLookOnly, point->tid);
|
||||
sector_t *Sector = point->Sector;
|
||||
auto skyv = it.Next();
|
||||
if (skyv != nullptr)
|
||||
|
@ -926,7 +926,7 @@ void MapLoader::SetupFloorPortal (AActor *point)
|
|||
|
||||
void MapLoader::SetupCeilingPortal (AActor *point)
|
||||
{
|
||||
NActorIterator it (NAME_UpperStackLookOnly, point->tid);
|
||||
auto it = Level->GetActorIterator(NAME_UpperStackLookOnly, point->tid);
|
||||
sector_t *Sector = point->Sector;
|
||||
auto skyv = it.Next();
|
||||
if (skyv != nullptr)
|
||||
|
@ -941,7 +941,7 @@ void MapLoader::SetupCeilingPortal (AActor *point)
|
|||
|
||||
void MapLoader::SetupPortals()
|
||||
{
|
||||
TThinkerIterator<AActor> it("StackPoint");
|
||||
auto it = Level->GetThinkerIterator<AActor>(NAME_StackPoint);
|
||||
AActor *pt;
|
||||
TArray<AActor *> points;
|
||||
|
||||
|
@ -1017,7 +1017,7 @@ void MapLoader::SetPortal(sector_t *sector, int plane, unsigned pnum, double alp
|
|||
void MapLoader::CopyPortal(int sectortag, int plane, unsigned pnum, double alpha, bool tolines)
|
||||
{
|
||||
int s;
|
||||
FSectorTagIterator itr(sectortag);
|
||||
auto itr = Level->GetSectorTagIterator(sectortag);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
{
|
||||
SetPortal(&Level->sectors[s], plane, pnum, alpha);
|
||||
|
@ -1038,7 +1038,7 @@ void MapLoader::CopyPortal(int sectortag, int plane, unsigned pnum, double alpha
|
|||
}
|
||||
else
|
||||
{
|
||||
FSectorTagIterator itr(line.args[0]);
|
||||
auto itr = Level->GetSectorTagIterator(line.args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
{
|
||||
SetPortal(&Level->sectors[s], plane, pnum, alpha);
|
||||
|
@ -1055,7 +1055,7 @@ void MapLoader::CopyPortal(int sectortag, int plane, unsigned pnum, double alpha
|
|||
}
|
||||
else
|
||||
{
|
||||
FLineIdIterator itr(line.args[0]);
|
||||
auto itr = Level->GetLineIdIterator(line.args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
{
|
||||
Level->lines[s].portaltransferred = pnum;
|
||||
|
@ -1318,7 +1318,7 @@ void MapLoader::SpawnSpecials ()
|
|||
SpawnFriction(); // phares 3/12/98: New friction model using linedefs
|
||||
SpawnPushers(); // phares 3/20/98: New pusher model using linedefs
|
||||
|
||||
TThinkerIterator<AActor> it2("SkyCamCompat");
|
||||
auto it2 = Level->GetThinkerIterator<AActor>(NAME_SkyCamCompat);
|
||||
AActor *pt2;
|
||||
while ((pt2 = it2.Next()))
|
||||
{
|
||||
|
@ -1363,7 +1363,7 @@ void MapLoader::SpawnSpecials ()
|
|||
{
|
||||
sec->MoreFlags |= SECMF_NOFAKELIGHT;
|
||||
}
|
||||
FSectorTagIterator itr(line.args[0]);
|
||||
auto itr = Level->GetSectorTagIterator(line.args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
{
|
||||
Level->sectors[s].heightsec = sec;
|
||||
|
@ -1439,7 +1439,7 @@ void MapLoader::SpawnSpecials ()
|
|||
case Init_Gravity:
|
||||
{
|
||||
double grav = line.Delta().Length() / 100.;
|
||||
FSectorTagIterator itr(line.args[0]);
|
||||
auto itr = Level->GetSectorTagIterator(line.args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
Level->sectors[s].gravity = grav;
|
||||
}
|
||||
|
@ -1451,7 +1451,7 @@ void MapLoader::SpawnSpecials ()
|
|||
case Init_Damage:
|
||||
{
|
||||
int damage = int(line.Delta().Length());
|
||||
FSectorTagIterator itr(line.args[0]);
|
||||
auto itr = Level->GetSectorTagIterator(line.args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
{
|
||||
sector_t *sec = &Level->sectors[s];
|
||||
|
@ -1492,7 +1492,7 @@ void MapLoader::SpawnSpecials ()
|
|||
|
||||
case Init_TransferSky:
|
||||
{
|
||||
FSectorTagIterator itr(line.args[0]);
|
||||
auto itr = Level->GetSectorTagIterator(line.args[0]);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
Level->sectors[s].sky = (line.Index() + 1) | PL_SKYFLAT;
|
||||
break;
|
||||
|
@ -1600,7 +1600,7 @@ void P_SetSectorFriction (FLevelLocals *Level, int tag, int amount, bool alterFl
|
|||
// higher friction value actually means 'less friction'.
|
||||
movefactor = FrictionToMoveFactor(friction);
|
||||
|
||||
FSectorTagIterator itr(tag);
|
||||
auto itr = Level->GetSectorTagIterator(tag);
|
||||
while ((s = itr.Next()) >= 0)
|
||||
{
|
||||
// killough 8/28/98:
|
||||
|
|
|
@ -290,56 +290,6 @@ void P_TranslateLineDef (line_t *ld, maplinedef_t *mld, int lineindexforid)
|
|||
memset (ld->args, 0, sizeof(ld->args));
|
||||
}
|
||||
|
||||
// Now that ZDoom again gives the option of using Doom's original teleport
|
||||
// behavior, only teleport dests in a sector with a 0 tag need to be
|
||||
// given a TID. And since Doom format maps don't have TIDs, we can safely
|
||||
// give them TID 1.
|
||||
|
||||
void P_TranslateTeleportThings ()
|
||||
{
|
||||
AActor *dest;
|
||||
TThinkerIterator<AActor> iterator(NAME_TeleportDest);
|
||||
bool foundSomething = false;
|
||||
|
||||
while ( (dest = iterator.Next()) )
|
||||
{
|
||||
if (!tagManager.SectorHasTags(dest->Sector))
|
||||
{
|
||||
dest->tid = 1;
|
||||
dest->AddToHash ();
|
||||
foundSomething = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (foundSomething)
|
||||
{
|
||||
for (auto &line : level.lines)
|
||||
{
|
||||
if (line.special == Teleport)
|
||||
{
|
||||
if (line.args[1] == 0)
|
||||
{
|
||||
line.args[0] = 1;
|
||||
}
|
||||
}
|
||||
else if (line.special == Teleport_NoFog)
|
||||
{
|
||||
if (line.args[2] == 0)
|
||||
{
|
||||
line.args[0] = 1;
|
||||
}
|
||||
}
|
||||
else if (line.special == Teleport_ZombieChanger)
|
||||
{
|
||||
if (line.args[1] == 0)
|
||||
{
|
||||
line.args[0] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int P_TranslateSectorSpecial (int special)
|
||||
{
|
||||
int mask = 0;
|
||||
|
@ -498,4 +448,4 @@ const int* (*XlatExprEval[XEXP_COUNT])(int *dest, const int *xnode, FXlatExprSta
|
|||
Expr_Or,
|
||||
Expr_Xor,
|
||||
Expr_Neg
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue