- another large batch of level references removed.

This commit is contained in:
Christoph Oelckers 2019-01-08 20:40:43 +01:00
parent d027ef95a3
commit e91971964f
27 changed files with 350 additions and 339 deletions

View file

@ -73,7 +73,7 @@ bool DBot::Reachable (AActor *rtarget)
double estimated_dist = player->mo->Distance2D(rtarget); double estimated_dist = player->mo->Distance2D(rtarget);
bool reachable = true; bool reachable = true;
FPathTraverse it(player->mo->X()+player->mo->Vel.X, player->mo->Y()+player->mo->Vel.Y, rtarget->X(), rtarget->Y(), PT_ADDLINES|PT_ADDTHINGS); FPathTraverse it(player->mo->Level, player->mo->X()+player->mo->Vel.X, player->mo->Y()+player->mo->Vel.Y, rtarget->X(), rtarget->Y(), PT_ADDLINES|PT_ADDTHINGS);
intercept_t *in; intercept_t *in;
while ((in = it.Next())) while ((in = it.Next()))
{ {

View file

@ -2042,7 +2042,7 @@ void FParser::SF_OpenDoor(void)
if(t_argc > 2) speed = intvalue(t_argv[2]); if(t_argc > 2) speed = intvalue(t_argv[2]);
else speed = 1; // 1= normal speed else speed = 1; // 1= normal speed
EV_DoDoor(wait_time ? DDoor::doorRaise : DDoor::doorOpen, NULL, NULL, sectag, 2. * clamp(speed, 1, 127), wait_time, 0, 0); EV_DoDoor(Level, wait_time ? DDoor::doorRaise : DDoor::doorOpen, NULL, NULL, sectag, 2. * clamp(speed, 1, 127), wait_time, 0, 0);
} }
} }
@ -2067,7 +2067,7 @@ void FParser::SF_CloseDoor(void)
if(t_argc > 1) speed = intvalue(t_argv[1]); if(t_argc > 1) speed = intvalue(t_argv[1]);
else speed = 1; // 1= normal speed else speed = 1; // 1= normal speed
EV_DoDoor(DDoor::doorClose, NULL, NULL, sectag, 2.*clamp(speed, 1, 127), 0, 0, 0); EV_DoDoor(Level, DDoor::doorClose, NULL, NULL, sectag, 2.*clamp(speed, 1, 127), 0, 0, 0);
} }
} }

View file

@ -3228,7 +3228,7 @@ void MapLoader::LoadLevel(MapData *map, const char *lumpname, int position)
SWRenderer->SetColormap(Level); //The SW renderer needs to do some special setup for the level's default colormap. SWRenderer->SetColormap(Level); //The SW renderer needs to do some special setup for the level's default colormap.
InitPortalGroups(Level); InitPortalGroups(Level);
P_InitHealthGroups(); P_InitHealthGroups(Level);
if (reloop) LoopSidedefs(false); if (reloop) LoopSidedefs(false);
PO_Init(); // Initialize the polyobjs PO_Init(); // Initialize the polyobjs

View file

@ -6670,17 +6670,17 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
FHealthGroup* grp; FHealthGroup* grp;
if (part == SECPART_Ceiling) if (part == SECPART_Ceiling)
{ {
return (ss->healthceilinggroup && (grp = P_GetHealthGroup(ss->healthceilinggroup))) return (ss->healthceilinggroup && (grp = P_GetHealthGroup(Level, ss->healthceilinggroup)))
? grp->health : ss->healthceiling; ? grp->health : ss->healthceiling;
} }
else if (part == SECPART_Floor) else if (part == SECPART_Floor)
{ {
return (ss->healthfloorgroup && (grp = P_GetHealthGroup(ss->healthfloorgroup))) return (ss->healthfloorgroup && (grp = P_GetHealthGroup(Level, ss->healthfloorgroup)))
? grp->health : ss->healthfloor; ? grp->health : ss->healthfloor;
} }
else if (part == SECPART_3D) else if (part == SECPART_3D)
{ {
return (ss->health3dgroup && (grp = P_GetHealthGroup(ss->health3dgroup))) return (ss->health3dgroup && (grp = P_GetHealthGroup(Level, ss->health3dgroup)))
? grp->health : ss->health3d; ? grp->health : ss->health3d;
} }
return 0; return 0;
@ -6695,7 +6695,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
line_t* ll = &Level->lines[l]; line_t* ll = &Level->lines[l];
if (ll->healthgroup > 0) if (ll->healthgroup > 0)
{ {
FHealthGroup* grp = P_GetHealthGroup(ll->healthgroup); FHealthGroup* grp = P_GetHealthGroup(Level, ll->healthgroup);
if (grp) return grp->health; if (grp) return grp->health;
} }

View file

@ -490,7 +490,7 @@ DEFINE_ACTION_FUNCTION(DCeiling, CreateCeiling)
// //
//============================================================================ //============================================================================
bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line, bool EV_DoCeiling (FLevelLocals *Level, DCeiling::ECeiling type, line_t *line,
int tag, double speed, double speed2, double height, int tag, double speed, double speed2, double height,
int crush, int silent, int change, DCeiling::ECrushMode hexencrush) int crush, int silent, int change, DCeiling::ECrushMode hexencrush)
{ {
@ -508,7 +508,7 @@ bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line,
secnum = sec->sectornum; secnum = sec->sectornum;
// [RH] Hack to let manual crushers be retriggerable, too // [RH] Hack to let manual crushers be retriggerable, too
tag ^= secnum | 0x1000000; tag ^= secnum | 0x1000000;
P_ActivateInStasisCeiling (tag); P_ActivateInStasisCeiling (Level, tag);
return P_CreateCeiling(sec, type, line, tag, speed, speed2, height, crush, silent, change, hexencrush); return P_CreateCeiling(sec, type, line, tag, speed, speed2, height, crush, silent, change, hexencrush);
} }
@ -516,14 +516,14 @@ bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line,
// This restarts a crusher after it has been stopped // This restarts a crusher after it has been stopped
if (type == DCeiling::ceilCrushAndRaise) if (type == DCeiling::ceilCrushAndRaise)
{ {
P_ActivateInStasisCeiling (tag); P_ActivateInStasisCeiling (Level, tag);
} }
// affects all sectors with the same tag as the linedef // affects all sectors with the same tag as the linedef
FSectorTagIterator it(tag); FSectorTagIterator it(tag);
while ((secnum = it.Next()) >= 0) while ((secnum = it.Next()) >= 0)
{ {
rtn |= P_CreateCeiling(&level.sectors[secnum], type, line, tag, speed, speed2, height, crush, silent, change, hexencrush); rtn |= P_CreateCeiling(&Level->sectors[secnum], type, line, tag, speed, speed2, height, crush, silent, change, hexencrush);
} }
return rtn; return rtn;
} }
@ -536,7 +536,7 @@ bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line,
// //
//============================================================================ //============================================================================
void P_ActivateInStasisCeiling (int tag) void P_ActivateInStasisCeiling (FLevelLocals *Level, int tag)
{ {
DCeiling *scan; DCeiling *scan;
TThinkerIterator<DCeiling> iterator; TThinkerIterator<DCeiling> iterator;
@ -559,7 +559,7 @@ void P_ActivateInStasisCeiling (int tag)
// //
//============================================================================ //============================================================================
bool EV_CeilingCrushStop (int tag, bool remove) bool EV_CeilingCrushStop (FLevelLocals *Level, int tag, bool remove)
{ {
bool rtn = false; bool rtn = false;
DCeiling *scan; DCeiling *scan;
@ -589,17 +589,17 @@ bool EV_CeilingCrushStop (int tag, bool remove)
return rtn; return rtn;
} }
bool EV_StopCeiling(int tag, line_t *line) bool EV_StopCeiling(FLevelLocals *Level, int tag, line_t *line)
{ {
int sec; int sec;
FSectorTagIterator it(tag, line); FSectorTagIterator it(tag, line);
while ((sec = it.Next()) >= 0) while ((sec = it.Next()) >= 0)
{ {
if (level.sectors[sec].ceilingdata) if (Level->sectors[sec].ceilingdata)
{ {
SN_StopSequence(&level.sectors[sec], CHAN_CEILING); SN_StopSequence(&Level->sectors[sec], CHAN_CEILING);
level.sectors[sec].ceilingdata->Destroy(); Level->sectors[sec].ceilingdata->Destroy();
level.sectors[sec].ceilingdata = nullptr; Level->sectors[sec].ceilingdata = nullptr;
} }
} }
return true; return true;

View file

@ -75,9 +75,9 @@ void P_SetHealthGroupHealth(FHealthGroup* grp, int health)
} }
} }
void P_SetHealthGroupHealth(int id, int health) void P_SetHealthGroupHealth(FLevelLocals *Level, int id, int health)
{ {
P_SetHealthGroupHealth(P_GetHealthGroup(id), health); P_SetHealthGroupHealth(P_GetHealthGroup(Level, id), health);
} }
void P_DamageHealthGroup(FHealthGroup* grp, void* object, AActor* source, int damage, FName damagetype, int side, int part, DVector3 position, bool isradius) void P_DamageHealthGroup(FHealthGroup* grp, void* object, AActor* source, int damage, FName damagetype, int side, int part, DVector3 position, bool isradius)
@ -133,6 +133,7 @@ void P_DamageLinedef(line_t* line, AActor* source, int damage, FName damagetype,
line->health -= damage; line->health -= damage;
if (line->health < 0) line->health = 0; if (line->health < 0) line->health = 0;
auto Level = line->GetLevel();
// callbacks here // callbacks here
// first off, call special if needed // first off, call special if needed
@ -145,7 +146,7 @@ void P_DamageLinedef(line_t* line, AActor* source, int damage, FName damagetype,
if (dogroups && line->healthgroup) if (dogroups && line->healthgroup)
{ {
FHealthGroup* grp = P_GetHealthGroup(line->healthgroup); FHealthGroup* grp = P_GetHealthGroup(Level, line->healthgroup);
if (grp) if (grp)
grp->health = line->health; grp->health = line->health;
P_DamageHealthGroup(grp, line, source, damage, damagetype, side, -1, position, isradius); P_DamageHealthGroup(grp, line, source, damage, damagetype, side, -1, position, isradius);
@ -166,6 +167,7 @@ void P_DamageSector(sector_t* sector, AActor* source, int damage, FName damagety
if (!damage) return; if (!damage) return;
auto Level = sector->Level;
int* sectorhealth; int* sectorhealth;
int group; int group;
int dmg; int dmg;
@ -209,7 +211,7 @@ void P_DamageSector(sector_t* sector, AActor* source, int damage, FName damagety
if (dogroups && group) if (dogroups && group)
{ {
FHealthGroup* grp = P_GetHealthGroup(group); FHealthGroup* grp = P_GetHealthGroup(Level, group);
if (grp) if (grp)
grp->health = newhealth; grp->health = newhealth;
P_DamageHealthGroup(grp, sector, source, damage, damagetype, 0, part, position, isradius); P_DamageHealthGroup(grp, sector, source, damage, damagetype, 0, part, position, isradius);
@ -225,35 +227,36 @@ void P_DamageSector(sector_t* sector, AActor* source, int damage, FName damagety
// //
//=========================================================================== //===========================================================================
FHealthGroup* P_GetHealthGroup(int id) FHealthGroup* P_GetHealthGroup(FLevelLocals *Level, int id)
{ {
FHealthGroup* grp = level.healthGroups.CheckKey(id); FHealthGroup* grp = Level->healthGroups.CheckKey(id);
return grp; return grp;
} }
FHealthGroup* P_GetHealthGroupOrNew(int id, int health) FHealthGroup* P_GetHealthGroupOrNew(FLevelLocals *Level, int id, int health)
{ {
FHealthGroup* grp = level.healthGroups.CheckKey(id); FHealthGroup* grp = Level->healthGroups.CheckKey(id);
if (!grp) if (!grp)
{ {
FHealthGroup newgrp; FHealthGroup newgrp;
newgrp.id = id; newgrp.id = id;
newgrp.health = health; newgrp.health = health;
grp = &(level.healthGroups.Insert(id, newgrp)); grp = &(Level->healthGroups.Insert(id, newgrp));
} }
return grp; return grp;
} }
void P_InitHealthGroups() void P_InitHealthGroups(FLevelLocals *Level)
{ {
level.healthGroups.Clear(); Level->healthGroups.Clear();
TArray<int> groupsInError; TArray<int> groupsInError;
for (unsigned i = 0; i < level.lines.Size(); i++)
for (unsigned i = 0; i < Level->lines.Size(); i++)
{ {
line_t* lline = &level.lines[i]; line_t* lline = &Level->lines[i];
if (lline->healthgroup > 0) if (lline->healthgroup > 0)
{ {
FHealthGroup* grp = P_GetHealthGroupOrNew(lline->healthgroup, lline->health); FHealthGroup* grp = P_GetHealthGroupOrNew(Level, lline->healthgroup, lline->health);
if (grp->health != lline->health) if (grp->health != lline->health)
{ {
Printf(TEXTCOLOR_RED "Warning: line %d in health group %d has different starting health (line health = %d, group health = %d)\n", i, lline->healthgroup, lline->health, grp->health); Printf(TEXTCOLOR_RED "Warning: line %d in health group %d has different starting health (line health = %d, group health = %d)\n", i, lline->healthgroup, lline->health, grp->health);
@ -264,12 +267,12 @@ void P_InitHealthGroups()
grp->lines.Push(lline); grp->lines.Push(lline);
} }
} }
for (unsigned i = 0; i < level.sectors.Size(); i++) for (unsigned i = 0; i < Level->sectors.Size(); i++)
{ {
sector_t* lsector = &level.sectors[i]; sector_t* lsector = &Level->sectors[i];
if (lsector->healthceilinggroup > 0) if (lsector->healthceilinggroup > 0)
{ {
FHealthGroup* grp = P_GetHealthGroupOrNew(lsector->healthceilinggroup, lsector->healthceiling); FHealthGroup* grp = P_GetHealthGroupOrNew(Level, lsector->healthceilinggroup, lsector->healthceiling);
if (grp->health != lsector->healthceiling) if (grp->health != lsector->healthceiling)
{ {
Printf(TEXTCOLOR_RED "Warning: sector ceiling %d in health group %d has different starting health (ceiling health = %d, group health = %d)\n", i, lsector->healthceilinggroup, lsector->healthceiling, grp->health); Printf(TEXTCOLOR_RED "Warning: sector ceiling %d in health group %d has different starting health (ceiling health = %d, group health = %d)\n", i, lsector->healthceilinggroup, lsector->healthceiling, grp->health);
@ -281,7 +284,7 @@ void P_InitHealthGroups()
} }
if (lsector->healthfloorgroup > 0) if (lsector->healthfloorgroup > 0)
{ {
FHealthGroup* grp = P_GetHealthGroupOrNew(lsector->healthfloorgroup, lsector->healthfloor); FHealthGroup* grp = P_GetHealthGroupOrNew(Level, lsector->healthfloorgroup, lsector->healthfloor);
if (grp->health != lsector->healthfloor) if (grp->health != lsector->healthfloor)
{ {
Printf(TEXTCOLOR_RED "Warning: sector floor %d in health group %d has different starting health (floor health = %d, group health = %d)\n", i, lsector->healthfloorgroup, lsector->healthfloor, grp->health); Printf(TEXTCOLOR_RED "Warning: sector floor %d in health group %d has different starting health (floor health = %d, group health = %d)\n", i, lsector->healthfloorgroup, lsector->healthfloor, grp->health);
@ -295,7 +298,7 @@ void P_InitHealthGroups()
} }
for (unsigned i = 0; i < groupsInError.Size(); i++) for (unsigned i = 0; i < groupsInError.Size(); i++)
{ {
FHealthGroup* grp = P_GetHealthGroup(groupsInError[i]); FHealthGroup* grp = P_GetHealthGroup(Level, groupsInError[i]);
Printf(TEXTCOLOR_GOLD "Health group %d is using the highest found health value of %d", groupsInError[i], grp->health); Printf(TEXTCOLOR_GOLD "Health group %d is using the highest found health value of %d", groupsInError[i], grp->health);
} }
} }
@ -520,7 +523,7 @@ void P_GeometryRadiusAttack(AActor* bombspot, AActor* bombsource, int bombdamage
// enumerate all lines around // enumerate all lines around
FBoundingBox bombbox(bombspot->X(), bombspot->Y(), bombdistance); FBoundingBox bombbox(bombspot->X(), bombspot->Y(), bombdistance);
FBlockLinesIterator it(bombbox); FBlockLinesIterator it(bombspot->Level, bombbox);
line_t* ln; line_t* ln;
int vc = validcount; int vc = validcount;
TArray<line_t*> lines; TArray<line_t*> lines;
@ -840,7 +843,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FHealthGroup& g, FHeal
return arc; return arc;
} }
void P_SerializeHealthGroups(FSerializer& arc) void P_SerializeHealthGroups(FLevelLocals *Level, FSerializer& arc)
{ {
// todo : stuff // todo : stuff
if (arc.BeginArray("healthgroups")) if (arc.BeginArray("healthgroups"))
@ -853,7 +856,7 @@ void P_SerializeHealthGroups(FSerializer& arc)
{ {
FHealthGroup grp; FHealthGroup grp;
arc(nullptr, grp); arc(nullptr, grp);
FHealthGroup* existinggrp = P_GetHealthGroup(grp.id); FHealthGroup* existinggrp = P_GetHealthGroup(Level, grp.id);
if (!existinggrp) if (!existinggrp)
continue; continue;
existinggrp->health = grp.health; existinggrp->health = grp.health;
@ -861,7 +864,7 @@ void P_SerializeHealthGroups(FSerializer& arc)
} }
else else
{ {
TMap<int, FHealthGroup>::ConstIterator it(level.healthGroups); TMap<int, FHealthGroup>::ConstIterator it(Level->healthGroups);
TMap<int, FHealthGroup>::ConstPair* pair; TMap<int, FHealthGroup>::ConstPair* pair;
while (it.NextPair(pair)) while (it.NextPair(pair))
{ {
@ -883,11 +886,11 @@ DEFINE_FIELD_X(HealthGroup, FHealthGroup, health)
DEFINE_FIELD_X(HealthGroup, FHealthGroup, sectors) DEFINE_FIELD_X(HealthGroup, FHealthGroup, sectors)
DEFINE_FIELD_X(HealthGroup, FHealthGroup, lines) DEFINE_FIELD_X(HealthGroup, FHealthGroup, lines)
DEFINE_ACTION_FUNCTION(FHealthGroup, Find) DEFINE_ACTION_FUNCTION(FLevelLocals, FindHealthGroup)
{ {
PARAM_PROLOGUE; PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals);
PARAM_INT(id); PARAM_INT(id);
FHealthGroup* grp = P_GetHealthGroup(id); FHealthGroup* grp = P_GetHealthGroup(self, id);
ACTION_RETURN_POINTER(grp); ACTION_RETURN_POINTER(grp);
} }
@ -993,7 +996,7 @@ DEFINE_ACTION_FUNCTION(_Line, GetHealth)
PARAM_SELF_STRUCT_PROLOGUE(line_t); PARAM_SELF_STRUCT_PROLOGUE(line_t);
if (self->healthgroup) if (self->healthgroup)
{ {
FHealthGroup* grp = P_GetHealthGroup(self->healthgroup); FHealthGroup* grp = P_GetHealthGroup(self->GetLevel(), self->healthgroup);
if (grp) ACTION_RETURN_INT(grp->health); if (grp) ACTION_RETURN_INT(grp->health);
} }
@ -1011,7 +1014,7 @@ DEFINE_ACTION_FUNCTION(_Line, SetHealth)
self->health = newhealth; self->health = newhealth;
if (self->healthgroup) if (self->healthgroup)
{ {
FHealthGroup* grp = P_GetHealthGroup(self->healthgroup); FHealthGroup* grp = P_GetHealthGroup(self->GetLevel(), self->healthgroup);
if (grp) P_SetHealthGroupHealth(grp, newhealth); if (grp) P_SetHealthGroupHealth(grp, newhealth);
} }
@ -1024,14 +1027,15 @@ DEFINE_ACTION_FUNCTION(_Sector, GetHealth)
PARAM_INT(part); PARAM_INT(part);
FHealthGroup* grp; FHealthGroup* grp;
auto Level = self->Level;
switch (part) switch (part)
{ {
case SECPART_Floor: case SECPART_Floor:
ACTION_RETURN_INT((self->healthfloorgroup && (grp = P_GetHealthGroup(self->healthfloorgroup))) ? grp->health : self->healthfloor); ACTION_RETURN_INT((self->healthfloorgroup && (grp = P_GetHealthGroup(Level, self->healthfloorgroup))) ? grp->health : self->healthfloor);
case SECPART_Ceiling: case SECPART_Ceiling:
ACTION_RETURN_INT((self->healthceilinggroup && (grp = P_GetHealthGroup(self->healthceilinggroup))) ? grp->health : self->healthceiling); ACTION_RETURN_INT((self->healthceilinggroup && (grp = P_GetHealthGroup(Level, self->healthceilinggroup))) ? grp->health : self->healthceiling);
case SECPART_3D: case SECPART_3D:
ACTION_RETURN_INT((self->health3dgroup && (grp = P_GetHealthGroup(self->health3dgroup))) ? grp->health : self->health3d); ACTION_RETURN_INT((self->health3dgroup && (grp = P_GetHealthGroup(Level, self->health3dgroup))) ? grp->health : self->health3d);
default: default:
ACTION_RETURN_INT(0); ACTION_RETURN_INT(0);
} }
@ -1066,7 +1070,7 @@ DEFINE_ACTION_FUNCTION(_Sector, SetHealth)
return 0; return 0;
} }
FHealthGroup* grp = group ? P_GetHealthGroup(group) : nullptr; FHealthGroup* grp = group ? P_GetHealthGroup(self->Level, group) : nullptr;
*health = newhealth; *health = newhealth;
if (grp) P_SetHealthGroupHealth(grp, newhealth); if (grp) P_SetHealthGroupHealth(grp, newhealth);
return 0; return 0;

View file

@ -21,13 +21,14 @@ enum
SECPART_3D = 2 SECPART_3D = 2
}; };
void P_InitHealthGroups(); struct FLevelLocals;
void P_InitHealthGroups(FLevelLocals *Level);
void P_SetHealthGroupHealth(FHealthGroup* group, int health); void P_SetHealthGroupHealth(FHealthGroup* group, int health);
void P_SetHealthGroupHealth(int group, int health); void P_SetHealthGroupHealth(FLevelLocals *Level, int group, int health);
FHealthGroup* P_GetHealthGroup(int id); FHealthGroup* P_GetHealthGroup(FLevelLocals *Level, int id);
FHealthGroup* P_GetHealthGroupOrNew(int id, int startinghealth); FHealthGroup* P_GetHealthGroupOrNew(FLevelLocals *Level, int id, int startinghealth);
void P_DamageSector(sector_t* sector, AActor* source, int damage, FName damagetype, int part, DVector3 position, bool isradius, bool dogroups); void P_DamageSector(sector_t* sector, AActor* source, int damage, FName damagetype, int part, DVector3 position, bool isradius, bool dogroups);
void P_DamageLinedef(line_t* line, AActor* source, int damage, FName damagetype, int side, DVector3 position, bool isradius, bool dogroups); void P_DamageLinedef(line_t* line, AActor* source, int damage, FName damagetype, int side, DVector3 position, bool isradius, bool dogroups);
@ -40,4 +41,4 @@ bool P_ProjectileHitPlane(AActor* projectile, int part);
bool P_CheckLinedefVulnerable(line_t* line, int side, int part = -1); bool P_CheckLinedefVulnerable(line_t* line, int side, int part = -1);
bool P_CheckSectorVulnerable(sector_t* sector, int part); bool P_CheckSectorVulnerable(sector_t* sector, int part);
void P_SerializeHealthGroups(FSerializer& arc); void P_SerializeHealthGroups(FLevelLocals *Level, FSerializer& arc);

View file

@ -136,7 +136,7 @@ void DDoor::Tick ()
// killough 10/98: implement gradual lighting effects // killough 10/98: implement gradual lighting effects
if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.fD()) if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.fD())
{ {
EV_LightTurnOnPartway (m_LightTag, EV_LightTurnOnPartway (Level, m_LightTag,
(m_Sector->ceilingplane.fD() + m_Sector->floorplane.fD()) / (m_TopDist + m_Sector->floorplane.fD())); (m_Sector->ceilingplane.fD() + m_Sector->floorplane.fD()) / (m_TopDist + m_Sector->floorplane.fD()));
} }
@ -182,7 +182,7 @@ void DDoor::Tick ()
// killough 10/98: implement gradual lighting effects // killough 10/98: implement gradual lighting effects
if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.fD()) if (m_LightTag != 0 && m_TopDist != -m_Sector->floorplane.fD())
{ {
EV_LightTurnOnPartway (m_LightTag, EV_LightTurnOnPartway (Level, m_LightTag,
(m_Sector->ceilingplane.fD() + m_Sector->floorplane.fD()) / (m_TopDist + m_Sector->floorplane.fD())); (m_Sector->ceilingplane.fD() + m_Sector->floorplane.fD()) / (m_TopDist + m_Sector->floorplane.fD()));
} }
@ -417,7 +417,7 @@ DDoor::DDoor (sector_t *sec, EVlDoor type, double speed, int delay, int lightTag
// //
//============================================================================ //============================================================================
bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, bool EV_DoDoor (FLevelLocals *Level, DDoor::EVlDoor type, line_t *line, AActor *thing,
int tag, double speed, int delay, int lock, int lightTag, bool boomgen, int topcountdown) int tag, double speed, int delay, int lock, int lightTag, bool boomgen, int topcountdown)
{ {
bool rtn = false; bool rtn = false;
@ -493,7 +493,7 @@ bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing,
FSectorTagIterator it(tag); FSectorTagIterator it(tag);
while ((secnum = it.Next()) >= 0) while ((secnum = it.Next()) >= 0)
{ {
sec = &level.sectors[secnum]; sec = &Level->sectors[secnum];
// if the ceiling is already moving, don't start the door action // if the ceiling is already moving, don't start the door action
if (sec->PlaneMoving(sector_t::ceiling)) if (sec->PlaneMoving(sector_t::ceiling))
continue; continue;
@ -748,7 +748,7 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay,
// //
//============================================================================ //============================================================================
bool EV_SlidingDoor (line_t *line, AActor *actor, int tag, int speed, int delay, DAnimatedDoor::EADType type) bool EV_SlidingDoor (FLevelLocals *Level, line_t *line, AActor *actor, int tag, int speed, int delay, DAnimatedDoor::EADType type)
{ {
sector_t *sec; sector_t *sec;
int secnum; int secnum;
@ -790,7 +790,7 @@ bool EV_SlidingDoor (line_t *line, AActor *actor, int tag, int speed, int delay,
FSectorTagIterator it(tag); FSectorTagIterator it(tag);
while ((secnum = it.Next()) >= 0) while ((secnum = it.Next()) >= 0)
{ {
sec = &level.sectors[secnum]; sec = &Level->sectors[secnum];
if (sec->ceilingdata != NULL) if (sec->ceilingdata != NULL)
{ {
continue; continue;

View file

@ -867,7 +867,7 @@ void P_NewChaseDir(AActor * actor)
!(actor->flags & MF_FLOAT) && !(i_compatflags & COMPATF_DROPOFF)) !(actor->flags & MF_FLOAT) && !(i_compatflags & COMPATF_DROPOFF))
{ {
FBoundingBox box(actor->X(), actor->Y(), actor->radius); FBoundingBox box(actor->X(), actor->Y(), actor->radius);
FBlockLinesIterator it(box); FBlockLinesIterator it(actor->Level, box);
line_t *line; line_t *line;
double deltax = 0; double deltax = 0;
@ -3140,13 +3140,13 @@ void A_BossDeath(AActor *self)
{ {
if (type == NAME_Fatso) if (type == NAME_Fatso)
{ {
EV_DoFloor (DFloor::floorLowerToLowest, NULL, 666, 1., 0, -1, 0, false); EV_DoFloor(Level, DFloor::floorLowerToLowest, NULL, 666, 1., 0, -1, 0, false);
return; return;
} }
if (type == NAME_Arachnotron) if (type == NAME_Arachnotron)
{ {
EV_DoFloor (DFloor::floorRaiseByTexture, NULL, 667, 1., 0, -1, 0, false); EV_DoFloor(Level, DFloor::floorRaiseByTexture, NULL, 667, 1., 0, -1, 0, false);
return; return;
} }
} }
@ -3155,15 +3155,15 @@ void A_BossDeath(AActor *self)
switch (Level->flags & LEVEL_SPECACTIONSMASK) switch (Level->flags & LEVEL_SPECACTIONSMASK)
{ {
case LEVEL_SPECLOWERFLOOR: case LEVEL_SPECLOWERFLOOR:
EV_DoFloor (DFloor::floorLowerToLowest, NULL, 666, 1., 0, -1, 0, false); EV_DoFloor(Level, DFloor::floorLowerToLowest, NULL, 666, 1., 0, -1, 0, false);
return; return;
case LEVEL_SPECLOWERFLOORTOHIGHEST: case LEVEL_SPECLOWERFLOORTOHIGHEST:
EV_DoFloor (DFloor::floorLowerToHighest, NULL, 666, 1., 0, -1, 0, false); EV_DoFloor(Level, DFloor::floorLowerToHighest, NULL, 666, 1., 0, -1, 0, false);
return; return;
case LEVEL_SPECOPENDOOR: case LEVEL_SPECOPENDOOR:
EV_DoDoor (DDoor::doorOpen, NULL, NULL, 666, 8., 0, 0, 0); EV_DoDoor(Level, DDoor::doorOpen, NULL, NULL, 666, 8., 0, 0, 0);
return; return;
} }
} }

View file

@ -192,19 +192,19 @@ void DFloor::Tick ()
sector_t *sec = m_Sector; sector_t *sec = m_Sector;
sec->stairlock = -1; // thinker done, promote lock to -1 sec->stairlock = -1; // thinker done, promote lock to -1
while (sec->prevsec != -1 && level.sectors[sec->prevsec].stairlock != -2) while (sec->prevsec != -1 && Level->sectors[sec->prevsec].stairlock != -2)
sec = &level.sectors[sec->prevsec]; // search for a non-done thinker sec = &Level->sectors[sec->prevsec]; // search for a non-done thinker
if (sec->prevsec == -1) // if all thinkers previous are done if (sec->prevsec == -1) // if all thinkers previous are done
{ {
sec = m_Sector; // search forward sec = m_Sector; // search forward
while (sec->nextsec != -1 && level.sectors[sec->nextsec].stairlock != -2) while (sec->nextsec != -1 && Level->sectors[sec->nextsec].stairlock != -2)
sec = &level.sectors[sec->nextsec]; sec = &Level->sectors[sec->nextsec];
if (sec->nextsec == -1) // if all thinkers ahead are done too if (sec->nextsec == -1) // if all thinkers ahead are done too
{ {
while (sec->prevsec != -1) // clear all locks while (sec->prevsec != -1) // clear all locks
{ {
sec->stairlock = 0; sec->stairlock = 0;
sec = &level.sectors[sec->prevsec]; sec = &Level->sectors[sec->prevsec];
} }
sec->stairlock = 0; sec->stairlock = 0;
} }
@ -525,7 +525,7 @@ DEFINE_ACTION_FUNCTION(DFloor, CreateFloor)
// //
//========================================================================== //==========================================================================
bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, bool EV_DoFloor (FLevelLocals *Level, DFloor::EFloor floortype, line_t *line, int tag,
double speed, double height, int crush, int change, bool hexencrush, bool hereticlower) double speed, double height, int crush, int change, bool hexencrush, bool hereticlower)
{ {
int secnum; int secnum;
@ -535,7 +535,7 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
FSectorTagIterator it(tag, line); FSectorTagIterator it(tag, line);
while ((secnum = it.Next()) >= 0) while ((secnum = it.Next()) >= 0)
{ {
rtn |= P_CreateFloor(&level.sectors[secnum], floortype, line, speed, height, crush, change, hexencrush, hereticlower); rtn |= P_CreateFloor(&Level->sectors[secnum], floortype, line, speed, height, crush, change, hexencrush, hereticlower);
} }
return rtn; return rtn;
} }
@ -548,13 +548,13 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag,
// //
//========================================================================== //==========================================================================
bool EV_FloorCrushStop (int tag, line_t *line) bool EV_FloorCrushStop (FLevelLocals *Level, int tag, line_t *line)
{ {
int secnum; int secnum;
FSectorTagIterator it(tag, line); FSectorTagIterator it(tag, line);
while ((secnum = it.Next()) >= 0) while ((secnum = it.Next()) >= 0)
{ {
sector_t *sec = &level.sectors[secnum]; sector_t *sec = &Level->sectors[secnum];
if (sec->floordata && sec->floordata->IsKindOf (RUNTIME_CLASS(DFloor)) && if (sec->floordata && sec->floordata->IsKindOf (RUNTIME_CLASS(DFloor)) &&
barrier_cast<DFloor *>(sec->floordata)->m_Type == DFloor::floorRaiseAndCrush) barrier_cast<DFloor *>(sec->floordata)->m_Type == DFloor::floorRaiseAndCrush)
@ -568,17 +568,17 @@ bool EV_FloorCrushStop (int tag, line_t *line)
} }
// same as above but stops any floor mover that was active on the given sector. // same as above but stops any floor mover that was active on the given sector.
bool EV_StopFloor(int tag, line_t *line) bool EV_StopFloor(FLevelLocals *Level, int tag, line_t *line)
{ {
int sec; int sec;
FSectorTagIterator it(tag, line); FSectorTagIterator it(tag, line);
while ((sec = it.Next()) >= 0) while ((sec = it.Next()) >= 0)
{ {
if (level.sectors[sec].floordata) if (Level->sectors[sec].floordata)
{ {
SN_StopSequence(&level.sectors[sec], CHAN_FLOOR); SN_StopSequence(&Level->sectors[sec], CHAN_FLOOR);
level.sectors[sec].floordata->Destroy(); Level->sectors[sec].floordata->Destroy();
level.sectors[sec].floordata = nullptr; Level->sectors[sec].floordata = nullptr;
} }
} }
return true; return true;
@ -593,7 +593,7 @@ bool EV_StopFloor(int tag, line_t *line)
// //
//========================================================================== //==========================================================================
bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, bool EV_BuildStairs (FLevelLocals *Level, int tag, DFloor::EStair type, line_t *line,
double stairsize, double speed, int delay, int reset, int igntxt, double stairsize, double speed, int delay, int reset, int igntxt,
int usespecials) int usespecials)
{ {
@ -625,7 +625,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
bool compatible = tag != 0 && (i_compatflags & COMPATF_STAIRINDEX); bool compatible = tag != 0 && (i_compatflags & COMPATF_STAIRINDEX);
while ((secnum = itr.NextCompat(compatible, secnum)) >= 0) while ((secnum = itr.NextCompat(compatible, secnum)) >= 0)
{ {
sec = &level.sectors[secnum]; sec = &Level->sectors[secnum];
// ALREADY MOVING? IF SO, KEEP GOING... // ALREADY MOVING? IF SO, KEEP GOING...
//jff 2/26/98 add special lockout condition to wait for entire //jff 2/26/98 add special lockout condition to wait for entire
@ -770,7 +770,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
} while (ok); } while (ok);
// [RH] make sure the first sector doesn't point to a previous one, otherwise // [RH] make sure the first sector doesn't point to a previous one, otherwise
// it can infinite loop when the first sector stops moving. // it can infinite loop when the first sector stops moving.
level.sectors[osecnum].prevsec = -1; Level->sectors[osecnum].prevsec = -1;
} }
return rtn; return rtn;
} }
@ -781,7 +781,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line,
// //
//========================================================================== //==========================================================================
bool EV_DoDonut (int tag, line_t *line, double pillarspeed, double slimespeed) bool EV_DoDonut (FLevelLocals *Level, int tag, line_t *line, double pillarspeed, double slimespeed)
{ {
sector_t* s1; sector_t* s1;
sector_t* s2; sector_t* s2;
@ -797,7 +797,7 @@ bool EV_DoDonut (int tag, line_t *line, double pillarspeed, double slimespeed)
FSectorTagIterator itr(tag, line); FSectorTagIterator itr(tag, line);
while ((secnum = itr.Next()) >= 0) while ((secnum = itr.Next()) >= 0)
{ {
s1 = &level.sectors[secnum]; // s1 is pillar's sector s1 = &Level->sectors[secnum]; // s1 is pillar's sector
// ALREADY MOVING? IF SO, KEEP GOING... // ALREADY MOVING? IF SO, KEEP GOING...
if (s1->PlaneMoving(sector_t::floor)) if (s1->PlaneMoving(sector_t::floor))
@ -994,7 +994,7 @@ void DElevator::StartFloorSound ()
// //
//========================================================================== //==========================================================================
bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype, bool EV_DoElevator (FLevelLocals *Level, line_t *line, DElevator::EElevator elevtype,
double speed, double height, int tag) double speed, double height, int tag)
{ {
int secnum; int secnum;
@ -1016,7 +1016,7 @@ bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype,
// act on all sectors with the same tag as the triggering linedef // act on all sectors with the same tag as the triggering linedef
while ((secnum = itr.Next()) >= 0) while ((secnum = itr.Next()) >= 0)
{ {
sec = &level.sectors[secnum]; sec = &Level->sectors[secnum];
// If either floor or ceiling is already activated, skip it // If either floor or ceiling is already activated, skip it
if (sec->PlaneMoving(sector_t::floor) || sec->ceilingdata) //jff 2/22/98 if (sec->PlaneMoving(sector_t::floor) || sec->ceilingdata) //jff 2/22/98
continue; // the loop used to break at the end if tag were 0, but would miss that step if "continue" occured [FDARI] continue; // the loop used to break at the end if tag were 0, but would miss that step if "continue" occured [FDARI]
@ -1097,7 +1097,7 @@ bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype,
// //
//========================================================================== //==========================================================================
bool EV_DoChange (line_t *line, EChange changetype, int tag) bool EV_DoChange (FLevelLocals *Level, line_t *line, EChange changetype, int tag)
{ {
int secnum; int secnum;
bool rtn; bool rtn;
@ -1109,7 +1109,7 @@ bool EV_DoChange (line_t *line, EChange changetype, int tag)
FSectorTagIterator it(tag); FSectorTagIterator it(tag);
while ((secnum = it.Next()) >= 0) while ((secnum = it.Next()) >= 0)
{ {
sec = &level.sectors[secnum]; sec = &Level->sectors[secnum];
rtn = true; rtn = true;
@ -1310,7 +1310,7 @@ void DCeilingWaggle::Tick ()
// //
//========================================================================== //==========================================================================
bool EV_StartWaggle (int tag, line_t *line, int height, int speed, int offset, bool EV_StartWaggle (FLevelLocals *Level, int tag, line_t *line, int height, int speed, int offset,
int timer, bool ceiling) int timer, bool ceiling)
{ {
int sectorIndex; int sectorIndex;
@ -1324,7 +1324,7 @@ bool EV_StartWaggle (int tag, line_t *line, int height, int speed, int offset,
while ((sectorIndex = itr.Next()) >= 0) while ((sectorIndex = itr.Next()) >= 0)
{ {
sector = &level.sectors[sectorIndex]; sector = &Level->sectors[sectorIndex];
if ((!ceiling && sector->PlaneMoving(sector_t::floor)) || if ((!ceiling && sector->PlaneMoving(sector_t::floor)) ||
(ceiling && sector->PlaneMoving(sector_t::ceiling))) (ceiling && sector->PlaneMoving(sector_t::ceiling)))
{ // Already busy with another thinker { // Already busy with another thinker

View file

@ -323,13 +323,13 @@ DFlicker::DFlicker (sector_t *sector, int upper, int lower)
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void EV_StartLightFlickering (int tag, int upper, int lower) void EV_StartLightFlickering (FLevelLocals *Level, int tag, int upper, int lower)
{ {
int secnum; int secnum;
FSectorTagIterator it(tag); FSectorTagIterator it(tag);
while ((secnum = it.Next()) >= 0) while ((secnum = it.Next()) >= 0)
{ {
Create<DFlicker> (&level.sectors[secnum], upper, lower); Create<DFlicker> (&Level->sectors[secnum], upper, lower);
} }
} }
@ -500,13 +500,13 @@ DStrobe::DStrobe (sector_t *sector, int utics, int ltics, bool inSync)
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void EV_StartLightStrobing (int tag, int upper, int lower, int utics, int ltics) void EV_StartLightStrobing (FLevelLocals *Level, int tag, int upper, int lower, int utics, int ltics)
{ {
int secnum; int secnum;
FSectorTagIterator it(tag); FSectorTagIterator it(tag);
while ((secnum = it.Next()) >= 0) while ((secnum = it.Next()) >= 0)
{ {
sector_t *sec = &level.sectors[secnum]; sector_t *sec = &Level->sectors[secnum];
if (sec->lightingdata) if (sec->lightingdata)
continue; continue;
@ -514,13 +514,13 @@ void EV_StartLightStrobing (int tag, int upper, int lower, int utics, int ltics)
} }
} }
void EV_StartLightStrobing (int tag, int utics, int ltics) void EV_StartLightStrobing (FLevelLocals *Level, int tag, int utics, int ltics)
{ {
int secnum; int secnum;
FSectorTagIterator it(tag); FSectorTagIterator it(tag);
while ((secnum = it.Next()) >= 0) while ((secnum = it.Next()) >= 0)
{ {
sector_t *sec = &level.sectors[secnum]; sector_t *sec = &Level->sectors[secnum];
if (sec->lightingdata) if (sec->lightingdata)
continue; continue;
@ -536,13 +536,13 @@ void EV_StartLightStrobing (int tag, int utics, int ltics)
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void EV_TurnTagLightsOff (int tag) void EV_TurnTagLightsOff (FLevelLocals *Level, int tag)
{ {
int secnum; int secnum;
FSectorTagIterator it(tag); FSectorTagIterator it(tag);
while ((secnum = it.Next()) >= 0) while ((secnum = it.Next()) >= 0)
{ {
sector_t *sector = &level.sectors[secnum]; sector_t *sector = &Level->sectors[secnum];
int min = sector->lightlevel; int min = sector->lightlevel;
for (auto ln : sector->Lines) for (auto ln : sector->Lines)
@ -565,13 +565,13 @@ void EV_TurnTagLightsOff (int tag)
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void EV_LightTurnOn (int tag, int bright) void EV_LightTurnOn (FLevelLocals *Level, int tag, int bright)
{ {
int secnum; int secnum;
FSectorTagIterator it(tag); FSectorTagIterator it(tag);
while ((secnum = it.Next()) >= 0) while ((secnum = it.Next()) >= 0)
{ {
sector_t *sector = &level.sectors[secnum]; sector_t *sector = &Level->sectors[secnum];
int tbright = bright; //jff 5/17/98 search for maximum PER sector int tbright = bright; //jff 5/17/98 search for maximum PER sector
// bright = -1 means to search ([RH] Not 0) // bright = -1 means to search ([RH] Not 0)
@ -615,7 +615,7 @@ void EV_LightTurnOn (int tag, int bright)
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void EV_LightTurnOnPartway (int tag, double frac) void EV_LightTurnOnPartway (FLevelLocals *Level, int tag, double frac)
{ {
frac = clamp(frac, 0., 1.); frac = clamp(frac, 0., 1.);
@ -624,7 +624,7 @@ void EV_LightTurnOnPartway (int tag, double frac)
FSectorTagIterator it(tag); FSectorTagIterator it(tag);
while ((secnum = it.Next()) >= 0) while ((secnum = it.Next()) >= 0)
{ {
sector_t *temp, *sector = &level.sectors[secnum]; sector_t *temp, *sector = &Level->sectors[secnum];
int bright = 0, min = sector->lightlevel; int bright = 0, min = sector->lightlevel;
for (auto ln : sector->Lines) for (auto ln : sector->Lines)
@ -650,17 +650,17 @@ void EV_LightTurnOnPartway (int tag, double frac)
// //
// [RH] New function to adjust tagged sectors' light levels // [RH] New function to adjust tagged sectors' light levels
// by a relative amount. Light levels are clipped to // by a relative amount. Light levels are clipped to
// be within range for sector_t::lightlevel. // be within range for sector_t::lightLevel->
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void EV_LightChange (int tag, int value) void EV_LightChange (FLevelLocals *Level, int tag, int value)
{ {
int secnum; int secnum;
FSectorTagIterator it(tag); FSectorTagIterator it(tag);
while ((secnum = it.Next()) >= 0) while ((secnum = it.Next()) >= 0)
{ {
level.sectors[secnum].SetLightLevel(level.sectors[secnum].lightlevel + value); Level->sectors[secnum].SetLightLevel(Level->sectors[secnum].lightlevel + value);
} }
} }
@ -806,7 +806,7 @@ DGlow2::DGlow2 (sector_t *sector, int start, int end, int tics, bool oneshot)
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void EV_StartLightGlowing (int tag, int upper, int lower, int tics) void EV_StartLightGlowing (FLevelLocals *Level, int tag, int upper, int lower, int tics)
{ {
int secnum; int secnum;
@ -826,7 +826,7 @@ void EV_StartLightGlowing (int tag, int upper, int lower, int tics)
FSectorTagIterator it(tag); FSectorTagIterator it(tag);
while ((secnum = it.Next()) >= 0) while ((secnum = it.Next()) >= 0)
{ {
sector_t *sec = &level.sectors[secnum]; sector_t *sec = &Level->sectors[secnum];
if (sec->lightingdata) if (sec->lightingdata)
continue; continue;
@ -840,13 +840,13 @@ void EV_StartLightGlowing (int tag, int upper, int lower, int tics)
// //
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void EV_StartLightFading (int tag, int value, int tics) void EV_StartLightFading (FLevelLocals *Level, int tag, int value, int tics)
{ {
int secnum; int secnum;
FSectorTagIterator it(tag); FSectorTagIterator it(tag);
while ((secnum = it.Next()) >= 0) while ((secnum = it.Next()) >= 0)
{ {
sector_t *sec = &level.sectors[secnum]; sector_t *sec = &Level->sectors[secnum];
if (sec->lightingdata) if (sec->lightingdata)
continue; continue;
@ -982,7 +982,7 @@ DPhased::DPhased (sector_t *sector, int baselevel, int phase)
// //
//============================================================================ //============================================================================
void EV_StopLightEffect (int tag) void EV_StopLightEffect (FLevelLocals *Level, int tag)
{ {
TThinkerIterator<DLighting> iterator; TThinkerIterator<DLighting> iterator;
DLighting *effect; DLighting *effect;

View file

@ -237,19 +237,19 @@ FUNC(LS_Polyobj_Stop)
FUNC(LS_Door_Close) FUNC(LS_Door_Close)
// Door_Close (tag, speed, lighttag) // Door_Close (tag, speed, lighttag)
{ {
return EV_DoDoor (DDoor::doorClose, ln, it, arg0, SPEED(arg1), 0, 0, arg2); return EV_DoDoor(Level, DDoor::doorClose, ln, it, arg0, SPEED(arg1), 0, 0, arg2);
} }
FUNC(LS_Door_Open) FUNC(LS_Door_Open)
// Door_Open (tag, speed, lighttag) // Door_Open (tag, speed, lighttag)
{ {
return EV_DoDoor (DDoor::doorOpen, ln, it, arg0, SPEED(arg1), 0, 0, arg2); return EV_DoDoor(Level, DDoor::doorOpen, ln, it, arg0, SPEED(arg1), 0, 0, arg2);
} }
FUNC(LS_Door_Raise) FUNC(LS_Door_Raise)
// Door_Raise (tag, speed, delay, lighttag) // Door_Raise (tag, speed, delay, lighttag)
{ {
return EV_DoDoor (DDoor::doorRaise, ln, it, arg0, SPEED(arg1), TICS(arg2), 0, arg3); return EV_DoDoor(Level, DDoor::doorRaise, ln, it, arg0, SPEED(arg1), TICS(arg2), 0, arg3);
} }
FUNC(LS_Door_LockedRaise) FUNC(LS_Door_LockedRaise)
@ -258,9 +258,9 @@ FUNC(LS_Door_LockedRaise)
#if 0 #if 0
// In Hexen this originally created a thinker running for nearly 4 years. // In Hexen this originally created a thinker running for nearly 4 years.
// Let's not do this unless it becomes necessary because this can hang tagwait. // Let's not do this unless it becomes necessary because this can hang tagwait.
return EV_DoDoor (arg2 || (Level->flags2 & LEVEL2_HEXENHACK) ? DDoor::doorRaise : DDoor::doorOpen, ln, it, return EV_DoDoor(Level, arg2 || (Level->flags2 & LEVEL2_HEXENHACK) ? DDoor::doorRaise : DDoor::doorOpen, ln, it,
#else #else
return EV_DoDoor (arg2 ? DDoor::doorRaise : DDoor::doorOpen, ln, it, return EV_DoDoor(Level, arg2 ? DDoor::doorRaise : DDoor::doorOpen, ln, it,
#endif #endif
arg0, SPEED(arg1), TICS(arg2), arg3, arg4); arg0, SPEED(arg1), TICS(arg2), arg3, arg4);
} }
@ -268,19 +268,19 @@ FUNC(LS_Door_LockedRaise)
FUNC(LS_Door_CloseWaitOpen) FUNC(LS_Door_CloseWaitOpen)
// Door_CloseWaitOpen (tag, speed, delay, lighttag) // Door_CloseWaitOpen (tag, speed, delay, lighttag)
{ {
return EV_DoDoor (DDoor::doorCloseWaitOpen, ln, it, arg0, SPEED(arg1), OCTICS(arg2), 0, arg3); return EV_DoDoor(Level, DDoor::doorCloseWaitOpen, ln, it, arg0, SPEED(arg1), OCTICS(arg2), 0, arg3);
} }
FUNC(LS_Door_WaitRaise) FUNC(LS_Door_WaitRaise)
// Door_WaitRaise(tag, speed, delay, wait, lighttag) // Door_WaitRaise(tag, speed, delay, wait, lighttag)
{ {
return EV_DoDoor(DDoor::doorWaitRaise, ln, it, arg0, SPEED(arg1), TICS(arg2), 0, arg4, false, TICS(arg3)); return EV_DoDoor(Level, DDoor::doorWaitRaise, ln, it, arg0, SPEED(arg1), TICS(arg2), 0, arg4, false, TICS(arg3));
} }
FUNC(LS_Door_WaitClose) FUNC(LS_Door_WaitClose)
// Door_WaitRaise(tag, speed, wait, lighttag) // Door_WaitRaise(tag, speed, wait, lighttag)
{ {
return EV_DoDoor(DDoor::doorWaitClose, ln, it, arg0, SPEED(arg1), 0, 0, arg3, false, TICS(arg2)); return EV_DoDoor(Level, DDoor::doorWaitClose, ln, it, arg0, SPEED(arg1), 0, 0, arg3, false, TICS(arg2));
} }
FUNC(LS_Door_Animated) FUNC(LS_Door_Animated)
@ -289,13 +289,13 @@ FUNC(LS_Door_Animated)
if (arg3 != 0 && !P_CheckKeys (it, arg3, arg0 != 0)) if (arg3 != 0 && !P_CheckKeys (it, arg3, arg0 != 0))
return false; return false;
return EV_SlidingDoor (ln, it, arg0, arg1, arg2, DAnimatedDoor::adOpenClose); return EV_SlidingDoor (Level, ln, it, arg0, arg1, arg2, DAnimatedDoor::adOpenClose);
} }
FUNC(LS_Door_AnimatedClose) FUNC(LS_Door_AnimatedClose)
// Door_AnimatedClose (tag, speed) // Door_AnimatedClose (tag, speed)
{ {
return EV_SlidingDoor(ln, it, arg0, arg1, -1, DAnimatedDoor::adClose); return EV_SlidingDoor(Level, ln, it, arg0, arg1, -1, DAnimatedDoor::adClose);
} }
FUNC(LS_Generic_Door) FUNC(LS_Generic_Door)
@ -326,203 +326,203 @@ FUNC(LS_Generic_Door)
tag = arg0; tag = arg0;
lightTag = 0; lightTag = 0;
} }
return EV_DoDoor (type, ln, it, tag, SPEED(arg1), OCTICS(arg3), arg4, lightTag, boomgen); return EV_DoDoor(Level, type, ln, it, tag, SPEED(arg1), OCTICS(arg3), arg4, lightTag, boomgen);
} }
FUNC(LS_Floor_LowerByValue) FUNC(LS_Floor_LowerByValue)
// Floor_LowerByValue (tag, speed, height, change) // Floor_LowerByValue (tag, speed, height, change)
{ {
return EV_DoFloor (DFloor::floorLowerByValue, ln, arg0, SPEED(arg1), arg2, -1, CHANGE(arg3), false); return EV_DoFloor(Level, DFloor::floorLowerByValue, ln, arg0, SPEED(arg1), arg2, -1, CHANGE(arg3), false);
} }
FUNC(LS_Floor_LowerToLowest) FUNC(LS_Floor_LowerToLowest)
// Floor_LowerToLowest (tag, speed, change) // Floor_LowerToLowest (tag, speed, change)
{ {
return EV_DoFloor (DFloor::floorLowerToLowest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false); return EV_DoFloor(Level, DFloor::floorLowerToLowest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false);
} }
FUNC(LS_Floor_LowerToHighest) FUNC(LS_Floor_LowerToHighest)
// Floor_LowerToHighest (tag, speed, adjust, hereticlower) // Floor_LowerToHighest (tag, speed, adjust, hereticlower)
{ {
return EV_DoFloor (DFloor::floorLowerToHighest, ln, arg0, SPEED(arg1), (arg2-128), -1, 0, false, arg3==1); return EV_DoFloor(Level, DFloor::floorLowerToHighest, ln, arg0, SPEED(arg1), (arg2-128), -1, 0, false, arg3==1);
} }
FUNC(LS_Floor_LowerToHighestEE) FUNC(LS_Floor_LowerToHighestEE)
// Floor_LowerToHighestEE (tag, speed, change) // Floor_LowerToHighestEE (tag, speed, change)
{ {
return EV_DoFloor (DFloor::floorLowerToHighest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false); return EV_DoFloor(Level, DFloor::floorLowerToHighest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false);
} }
FUNC(LS_Floor_LowerToNearest) FUNC(LS_Floor_LowerToNearest)
// Floor_LowerToNearest (tag, speed, change) // Floor_LowerToNearest (tag, speed, change)
{ {
return EV_DoFloor (DFloor::floorLowerToNearest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false); return EV_DoFloor(Level, DFloor::floorLowerToNearest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false);
} }
FUNC(LS_Floor_RaiseByValue) FUNC(LS_Floor_RaiseByValue)
// Floor_RaiseByValue (tag, speed, height, change, crush) // Floor_RaiseByValue (tag, speed, height, change, crush)
{ {
return EV_DoFloor (DFloor::floorRaiseByValue, ln, arg0, SPEED(arg1), arg2, CRUSH(arg4), CHANGE(arg3), true); return EV_DoFloor(Level, DFloor::floorRaiseByValue, ln, arg0, SPEED(arg1), arg2, CRUSH(arg4), CHANGE(arg3), true);
} }
FUNC(LS_Floor_RaiseToHighest) FUNC(LS_Floor_RaiseToHighest)
// Floor_RaiseToHighest (tag, speed, change, crush) // Floor_RaiseToHighest (tag, speed, change, crush)
{ {
return EV_DoFloor (DFloor::floorRaiseToHighest, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); return EV_DoFloor(Level, DFloor::floorRaiseToHighest, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true);
} }
FUNC(LS_Floor_RaiseToNearest) FUNC(LS_Floor_RaiseToNearest)
// Floor_RaiseToNearest (tag, speed, change, crush) // Floor_RaiseToNearest (tag, speed, change, crush)
{ {
return EV_DoFloor (DFloor::floorRaiseToNearest, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); return EV_DoFloor(Level, DFloor::floorRaiseToNearest, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true);
} }
FUNC(LS_Floor_RaiseToLowest) FUNC(LS_Floor_RaiseToLowest)
// Floor_RaiseToLowest (tag, change, crush) // Floor_RaiseToLowest (tag, change, crush)
{ {
// This is merely done for completeness as it's a rather pointless addition. // This is merely done for completeness as it's a rather pointless addition.
return EV_DoFloor (DFloor::floorRaiseToLowest, ln, arg0, 2., 0, CRUSH(arg3), CHANGE(arg2), true); return EV_DoFloor(Level, DFloor::floorRaiseToLowest, ln, arg0, 2., 0, CRUSH(arg3), CHANGE(arg2), true);
} }
FUNC(LS_Floor_RaiseAndCrush) FUNC(LS_Floor_RaiseAndCrush)
// Floor_RaiseAndCrush (tag, speed, crush, crushmode) // Floor_RaiseAndCrush (tag, speed, crush, crushmode)
{ {
return EV_DoFloor (DFloor::floorRaiseAndCrush, ln, arg0, SPEED(arg1), 0, arg2, 0, CRUSHTYPE(arg3)); return EV_DoFloor(Level, DFloor::floorRaiseAndCrush, ln, arg0, SPEED(arg1), 0, arg2, 0, CRUSHTYPE(arg3));
} }
FUNC(LS_Floor_RaiseAndCrushDoom) FUNC(LS_Floor_RaiseAndCrushDoom)
// Floor_RaiseAndCrushDoom (tag, speed, crush, crushmode) // Floor_RaiseAndCrushDoom (tag, speed, crush, crushmode)
{ {
return EV_DoFloor (DFloor::floorRaiseAndCrushDoom, ln, arg0, SPEED(arg1), 0, arg2, 0, CRUSHTYPE(arg3)); return EV_DoFloor(Level, DFloor::floorRaiseAndCrushDoom, ln, arg0, SPEED(arg1), 0, arg2, 0, CRUSHTYPE(arg3));
} }
FUNC(LS_Floor_RaiseByValueTimes8) FUNC(LS_Floor_RaiseByValueTimes8)
// FLoor_RaiseByValueTimes8 (tag, speed, height, change, crush) // FLoor_RaiseByValueTimes8 (tag, speed, height, change, crush)
{ {
return EV_DoFloor (DFloor::floorRaiseByValue, ln, arg0, SPEED(arg1), arg2*8, CRUSH(arg4), CHANGE(arg3), true); return EV_DoFloor(Level, DFloor::floorRaiseByValue, ln, arg0, SPEED(arg1), arg2*8, CRUSH(arg4), CHANGE(arg3), true);
} }
FUNC(LS_Floor_LowerByValueTimes8) FUNC(LS_Floor_LowerByValueTimes8)
// Floor_LowerByValueTimes8 (tag, speed, height, change) // Floor_LowerByValueTimes8 (tag, speed, height, change)
{ {
return EV_DoFloor (DFloor::floorLowerByValue, ln, arg0, SPEED(arg1), arg2*8, -1, CHANGE(arg3), false); return EV_DoFloor(Level, DFloor::floorLowerByValue, ln, arg0, SPEED(arg1), arg2*8, -1, CHANGE(arg3), false);
} }
FUNC(LS_Floor_CrushStop) FUNC(LS_Floor_CrushStop)
// Floor_CrushStop (tag) // Floor_CrushStop (tag)
{ {
return EV_FloorCrushStop (arg0, ln); return EV_FloorCrushStop (Level, arg0, ln);
} }
FUNC(LS_Floor_LowerInstant) FUNC(LS_Floor_LowerInstant)
// Floor_LowerInstant (tag, unused, height, change) // Floor_LowerInstant (tag, unused, height, change)
{ {
return EV_DoFloor (DFloor::floorLowerInstant, ln, arg0, 0., arg2*8, -1, CHANGE(arg3), false); return EV_DoFloor(Level, DFloor::floorLowerInstant, ln, arg0, 0., arg2*8, -1, CHANGE(arg3), false);
} }
FUNC(LS_Floor_RaiseInstant) FUNC(LS_Floor_RaiseInstant)
// Floor_RaiseInstant (tag, unused, height, change, crush) // Floor_RaiseInstant (tag, unused, height, change, crush)
{ {
return EV_DoFloor (DFloor::floorRaiseInstant, ln, arg0, 0., arg2*8, CRUSH(arg4), CHANGE(arg3), true); return EV_DoFloor(Level, DFloor::floorRaiseInstant, ln, arg0, 0., arg2*8, CRUSH(arg4), CHANGE(arg3), true);
} }
FUNC(LS_Floor_ToCeilingInstant) FUNC(LS_Floor_ToCeilingInstant)
// Floor_ToCeilingInstant (tag, change, crush, gap) // Floor_ToCeilingInstant (tag, change, crush, gap)
{ {
return EV_DoFloor (DFloor::floorLowerToCeiling, ln, arg0, 0, arg3, CRUSH(arg2), CHANGE(arg1), true); return EV_DoFloor(Level, DFloor::floorLowerToCeiling, ln, arg0, 0, arg3, CRUSH(arg2), CHANGE(arg1), true);
} }
FUNC(LS_Floor_MoveToValueTimes8) FUNC(LS_Floor_MoveToValueTimes8)
// Floor_MoveToValueTimes8 (tag, speed, height, negative, change) // Floor_MoveToValueTimes8 (tag, speed, height, negative, change)
{ {
return EV_DoFloor (DFloor::floorMoveToValue, ln, arg0, SPEED(arg1), return EV_DoFloor(Level, DFloor::floorMoveToValue, ln, arg0, SPEED(arg1),
arg2*8*(arg3?-1:1), -1, CHANGE(arg4), false); arg2*8*(arg3?-1:1), -1, CHANGE(arg4), false);
} }
FUNC(LS_Floor_MoveToValue) FUNC(LS_Floor_MoveToValue)
// Floor_MoveToValue (tag, speed, height, negative, change) // Floor_MoveToValue (tag, speed, height, negative, change)
{ {
return EV_DoFloor (DFloor::floorMoveToValue, ln, arg0, SPEED(arg1), return EV_DoFloor(Level, DFloor::floorMoveToValue, ln, arg0, SPEED(arg1),
arg2*(arg3?-1:1), -1, CHANGE(arg4), false); arg2*(arg3?-1:1), -1, CHANGE(arg4), false);
} }
FUNC(LS_Floor_MoveToValueAndCrush) FUNC(LS_Floor_MoveToValueAndCrush)
// Floor_MoveToValueAndCrush (tag, speed, height, crush, crushmode) // Floor_MoveToValueAndCrush (tag, speed, height, crush, crushmode)
{ {
return EV_DoFloor(DFloor::floorMoveToValue, ln, arg0, SPEED(arg1), return EV_DoFloor(Level, DFloor::floorMoveToValue, ln, arg0, SPEED(arg1),
arg2, CRUSH(arg3) -1, 0, CRUSHTYPE(arg4), false); arg2, CRUSH(arg3) -1, 0, CRUSHTYPE(arg4), false);
} }
FUNC(LS_Floor_RaiseToLowestCeiling) FUNC(LS_Floor_RaiseToLowestCeiling)
// Floor_RaiseToLowestCeiling (tag, speed, change, crush) // Floor_RaiseToLowestCeiling (tag, speed, change, crush)
{ {
return EV_DoFloor (DFloor::floorRaiseToLowestCeiling, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); return EV_DoFloor(Level, DFloor::floorRaiseToLowestCeiling, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true);
} }
FUNC(LS_Floor_LowerToLowestCeiling) FUNC(LS_Floor_LowerToLowestCeiling)
// Floor_LowerToLowestCeiling (tag, speed, change) // Floor_LowerToLowestCeiling (tag, speed, change)
{ {
return EV_DoFloor (DFloor::floorLowerToLowestCeiling, ln, arg0, SPEED(arg1), arg4, -1, CHANGE(arg2), true); return EV_DoFloor(Level, DFloor::floorLowerToLowestCeiling, ln, arg0, SPEED(arg1), arg4, -1, CHANGE(arg2), true);
} }
FUNC(LS_Floor_RaiseByTexture) FUNC(LS_Floor_RaiseByTexture)
// Floor_RaiseByTexture (tag, speed, change, crush) // Floor_RaiseByTexture (tag, speed, change, crush)
{ {
return EV_DoFloor (DFloor::floorRaiseByTexture, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); return EV_DoFloor(Level, DFloor::floorRaiseByTexture, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true);
} }
FUNC(LS_Floor_LowerByTexture) FUNC(LS_Floor_LowerByTexture)
// Floor_LowerByTexture (tag, speed, change, crush) // Floor_LowerByTexture (tag, speed, change, crush)
{ {
return EV_DoFloor (DFloor::floorLowerByTexture, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), true); return EV_DoFloor(Level, DFloor::floorLowerByTexture, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), true);
} }
FUNC(LS_Floor_RaiseToCeiling) FUNC(LS_Floor_RaiseToCeiling)
// Floor_RaiseToCeiling (tag, speed, change, crush, gap) // Floor_RaiseToCeiling (tag, speed, change, crush, gap)
{ {
return EV_DoFloor (DFloor::floorRaiseToCeiling, ln, arg0, SPEED(arg1), arg4, CRUSH(arg3), CHANGE(arg2), true); return EV_DoFloor(Level, DFloor::floorRaiseToCeiling, ln, arg0, SPEED(arg1), arg4, CRUSH(arg3), CHANGE(arg2), true);
} }
FUNC(LS_Floor_RaiseByValueTxTy) FUNC(LS_Floor_RaiseByValueTxTy)
// Floor_RaiseByValueTxTy (tag, speed, height) // Floor_RaiseByValueTxTy (tag, speed, height)
{ {
return EV_DoFloor (DFloor::floorRaiseAndChange, ln, arg0, SPEED(arg1), arg2, -1, 0, false); return EV_DoFloor(Level, DFloor::floorRaiseAndChange, ln, arg0, SPEED(arg1), arg2, -1, 0, false);
} }
FUNC(LS_Floor_LowerToLowestTxTy) FUNC(LS_Floor_LowerToLowestTxTy)
// Floor_LowerToLowestTxTy (tag, speed) // Floor_LowerToLowestTxTy (tag, speed)
{ {
return EV_DoFloor (DFloor::floorLowerAndChange, ln, arg0, SPEED(arg1), arg2, -1, 0, false); return EV_DoFloor(Level, DFloor::floorLowerAndChange, ln, arg0, SPEED(arg1), arg2, -1, 0, false);
} }
FUNC(LS_Floor_Waggle) FUNC(LS_Floor_Waggle)
// Floor_Waggle (tag, amplitude, frequency, delay, time) // Floor_Waggle (tag, amplitude, frequency, delay, time)
{ {
return EV_StartWaggle (arg0, ln, arg1, arg2, arg3, arg4, false); return EV_StartWaggle (Level, arg0, ln, arg1, arg2, arg3, arg4, false);
} }
FUNC(LS_Ceiling_Waggle) FUNC(LS_Ceiling_Waggle)
// Ceiling_Waggle (tag, amplitude, frequency, delay, time) // Ceiling_Waggle (tag, amplitude, frequency, delay, time)
{ {
return EV_StartWaggle (arg0, ln, arg1, arg2, arg3, arg4, true); return EV_StartWaggle (Level, arg0, ln, arg1, arg2, arg3, arg4, true);
} }
FUNC(LS_Floor_TransferTrigger) FUNC(LS_Floor_TransferTrigger)
// Floor_TransferTrigger (tag) // Floor_TransferTrigger (tag)
{ {
return EV_DoChange (ln, trigChangeOnly, arg0); return EV_DoChange (Level, ln, trigChangeOnly, arg0);
} }
FUNC(LS_Floor_TransferNumeric) FUNC(LS_Floor_TransferNumeric)
// Floor_TransferNumeric (tag) // Floor_TransferNumeric (tag)
{ {
return EV_DoChange (ln, numChangeOnly, arg0); return EV_DoChange (Level, ln, numChangeOnly, arg0);
} }
FUNC(LS_Floor_Donut) FUNC(LS_Floor_Donut)
// Floor_Donut (pillartag, pillarspeed, slimespeed) // Floor_Donut (pillartag, pillarspeed, slimespeed)
{ {
return EV_DoDonut (arg0, ln, SPEED(arg1), SPEED(arg2)); return EV_DoDonut (Level, arg0, ln, SPEED(arg1), SPEED(arg2));
} }
FUNC(LS_Generic_Floor) FUNC(LS_Generic_Floor)
@ -557,7 +557,7 @@ FUNC(LS_Generic_Floor)
} }
} }
return EV_DoFloor (type, ln, arg0, SPEED(arg1), arg2, return EV_DoFloor(Level, type, ln, arg0, SPEED(arg1), arg2,
(arg4 & 16) ? 20 : -1, arg4 & 7, false); (arg4 & 16) ? 20 : -1, arg4 & 7, false);
} }
@ -565,70 +565,70 @@ FUNC(LS_Generic_Floor)
FUNC(LS_Floor_Stop) FUNC(LS_Floor_Stop)
// Floor_Stop (tag) // Floor_Stop (tag)
{ {
return EV_StopFloor(arg0, ln); return EV_StopFloor(Level, arg0, ln);
} }
FUNC(LS_Stairs_BuildDown) FUNC(LS_Stairs_BuildDown)
// Stair_BuildDown (tag, speed, height, delay, reset) // Stair_BuildDown (tag, speed, height, delay, reset)
{ {
return EV_BuildStairs (arg0, DFloor::buildDown, ln, return EV_BuildStairs (Level, arg0, DFloor::buildDown, ln,
arg2, SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairUseSpecials); arg2, SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairUseSpecials);
} }
FUNC(LS_Stairs_BuildUp) FUNC(LS_Stairs_BuildUp)
// Stairs_BuildUp (tag, speed, height, delay, reset) // Stairs_BuildUp (tag, speed, height, delay, reset)
{ {
return EV_BuildStairs (arg0, DFloor::buildUp, ln, return EV_BuildStairs (Level, arg0, DFloor::buildUp, ln,
arg2, SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairUseSpecials); arg2, SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairUseSpecials);
} }
FUNC(LS_Stairs_BuildDownSync) FUNC(LS_Stairs_BuildDownSync)
// Stairs_BuildDownSync (tag, speed, height, reset) // Stairs_BuildDownSync (tag, speed, height, reset)
{ {
return EV_BuildStairs (arg0, DFloor::buildDown, ln, return EV_BuildStairs (Level, arg0, DFloor::buildDown, ln,
arg2, SPEED(arg1), 0, arg3, 0, DFloor::stairUseSpecials|DFloor::stairSync); arg2, SPEED(arg1), 0, arg3, 0, DFloor::stairUseSpecials|DFloor::stairSync);
} }
FUNC(LS_Stairs_BuildUpSync) FUNC(LS_Stairs_BuildUpSync)
// Stairs_BuildUpSync (tag, speed, height, reset) // Stairs_BuildUpSync (tag, speed, height, reset)
{ {
return EV_BuildStairs (arg0, DFloor::buildUp, ln, return EV_BuildStairs (Level, arg0, DFloor::buildUp, ln,
arg2, SPEED(arg1), 0, arg3, 0, DFloor::stairUseSpecials|DFloor::stairSync); arg2, SPEED(arg1), 0, arg3, 0, DFloor::stairUseSpecials|DFloor::stairSync);
} }
FUNC(LS_Stairs_BuildUpDoom) FUNC(LS_Stairs_BuildUpDoom)
// Stairs_BuildUpDoom (tag, speed, height, delay, reset) // Stairs_BuildUpDoom (tag, speed, height, delay, reset)
{ {
return EV_BuildStairs (arg0, DFloor::buildUp, ln, return EV_BuildStairs (Level, arg0, DFloor::buildUp, ln,
arg2, SPEED(arg1), TICS(arg3), arg4, 0, 0); arg2, SPEED(arg1), TICS(arg3), arg4, 0, 0);
} }
FUNC(LS_Stairs_BuildUpDoomCrush) FUNC(LS_Stairs_BuildUpDoomCrush)
// Stairs_BuildUpDoom (tag, speed, height, delay, reset) // Stairs_BuildUpDoom (tag, speed, height, delay, reset)
{ {
return EV_BuildStairs(arg0, DFloor::buildUp, ln, return EV_BuildStairs(Level, arg0, DFloor::buildUp, ln,
arg2, SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairCrush); arg2, SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairCrush);
} }
FUNC(LS_Stairs_BuildDownDoom) FUNC(LS_Stairs_BuildDownDoom)
// Stair_BuildDownDoom (tag, speed, height, delay, reset) // Stair_BuildDownDoom (tag, speed, height, delay, reset)
{ {
return EV_BuildStairs (arg0, DFloor::buildDown, ln, return EV_BuildStairs (Level, arg0, DFloor::buildDown, ln,
arg2, SPEED(arg1), TICS(arg3), arg4, 0, 0); arg2, SPEED(arg1), TICS(arg3), arg4, 0, 0);
} }
FUNC(LS_Stairs_BuildDownDoomSync) FUNC(LS_Stairs_BuildDownDoomSync)
// Stairs_BuildDownDoomSync (tag, speed, height, reset) // Stairs_BuildDownDoomSync (tag, speed, height, reset)
{ {
return EV_BuildStairs (arg0, DFloor::buildDown, ln, return EV_BuildStairs (Level, arg0, DFloor::buildDown, ln,
arg2, SPEED(arg1), 0, arg3, 0, DFloor::stairSync); arg2, SPEED(arg1), 0, arg3, 0, DFloor::stairSync);
} }
FUNC(LS_Stairs_BuildUpDoomSync) FUNC(LS_Stairs_BuildUpDoomSync)
// Stairs_BuildUpDoomSync (tag, speed, height, reset) // Stairs_BuildUpDoomSync (tag, speed, height, reset)
{ {
return EV_BuildStairs (arg0, DFloor::buildUp, ln, return EV_BuildStairs (Level, arg0, DFloor::buildUp, ln,
arg2, SPEED(arg1), 0, arg3, 0, DFloor::stairSync); arg2, SPEED(arg1), 0, arg3, 0, DFloor::stairSync);
} }
@ -637,7 +637,7 @@ FUNC(LS_Generic_Stairs)
// Generic_Stairs (tag, speed, step, dir/igntxt, reset) // Generic_Stairs (tag, speed, step, dir/igntxt, reset)
{ {
DFloor::EStair type = (arg3 & 1) ? DFloor::buildUp : DFloor::buildDown; DFloor::EStair type = (arg3 & 1) ? DFloor::buildUp : DFloor::buildDown;
bool res = EV_BuildStairs (arg0, type, ln, bool res = EV_BuildStairs (Level, arg0, type, ln,
arg2, SPEED(arg1), 0, arg4, arg3 & 2, 0); arg2, SPEED(arg1), 0, arg4, arg3 & 2, 0);
if (res && ln && (ln->flags & ML_REPEAT_SPECIAL) && ln->special == Generic_Stairs) if (res && ln && (ln->flags & ML_REPEAT_SPECIAL) && ln->special == Generic_Stairs)
@ -668,43 +668,43 @@ FUNC(LS_Pillar_Open)
FUNC(LS_Ceiling_LowerByValue) FUNC(LS_Ceiling_LowerByValue)
// Ceiling_LowerByValue (tag, speed, height, change, crush) // Ceiling_LowerByValue (tag, speed, height, change, crush)
{ {
return EV_DoCeiling (DCeiling::ceilLowerByValue, ln, arg0, SPEED(arg1), 0, arg2, CRUSH(arg4), 0, CHANGE(arg3)); return EV_DoCeiling(Level, DCeiling::ceilLowerByValue, ln, arg0, SPEED(arg1), 0, arg2, CRUSH(arg4), 0, CHANGE(arg3));
} }
FUNC(LS_Ceiling_RaiseByValue) FUNC(LS_Ceiling_RaiseByValue)
// Ceiling_RaiseByValue (tag, speed, height, change) // Ceiling_RaiseByValue (tag, speed, height, change)
{ {
return EV_DoCeiling (DCeiling::ceilRaiseByValue, ln, arg0, SPEED(arg1), 0, arg2, CRUSH(arg4), 0, CHANGE(arg3)); return EV_DoCeiling(Level, DCeiling::ceilRaiseByValue, ln, arg0, SPEED(arg1), 0, arg2, CRUSH(arg4), 0, CHANGE(arg3));
} }
FUNC(LS_Ceiling_LowerByValueTimes8) FUNC(LS_Ceiling_LowerByValueTimes8)
// Ceiling_LowerByValueTimes8 (tag, speed, height, change, crush) // Ceiling_LowerByValueTimes8 (tag, speed, height, change, crush)
{ {
return EV_DoCeiling (DCeiling::ceilLowerByValue, ln, arg0, SPEED(arg1), 0, arg2*8, -1, 0, CHANGE(arg3)); return EV_DoCeiling(Level, DCeiling::ceilLowerByValue, ln, arg0, SPEED(arg1), 0, arg2*8, -1, 0, CHANGE(arg3));
} }
FUNC(LS_Ceiling_RaiseByValueTimes8) FUNC(LS_Ceiling_RaiseByValueTimes8)
// Ceiling_RaiseByValueTimes8 (tag, speed, height, change) // Ceiling_RaiseByValueTimes8 (tag, speed, height, change)
{ {
return EV_DoCeiling (DCeiling::ceilRaiseByValue, ln, arg0, SPEED(arg1), 0, arg2*8, -1, 0, CHANGE(arg3)); return EV_DoCeiling(Level, DCeiling::ceilRaiseByValue, ln, arg0, SPEED(arg1), 0, arg2*8, -1, 0, CHANGE(arg3));
} }
FUNC(LS_Ceiling_CrushAndRaise) FUNC(LS_Ceiling_CrushAndRaise)
// Ceiling_CrushAndRaise (tag, speed, crush, crushtype) // Ceiling_CrushAndRaise (tag, speed, crush, crushtype)
{ {
return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), SPEED(arg1)/2, 8, arg2, 0, 0, CRUSHTYPE(arg3, false)); return EV_DoCeiling(Level, DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), SPEED(arg1)/2, 8, arg2, 0, 0, CRUSHTYPE(arg3, false));
} }
FUNC(LS_Ceiling_LowerAndCrush) FUNC(LS_Ceiling_LowerAndCrush)
// Ceiling_LowerAndCrush (tag, speed, crush, crushtype) // Ceiling_LowerAndCrush (tag, speed, crush, crushtype)
{ {
return EV_DoCeiling (DCeiling::ceilLowerAndCrush, ln, arg0, SPEED(arg1), SPEED(arg1), 8, arg2, 0, 0, CRUSHTYPE(arg3, arg1 == 8)); return EV_DoCeiling(Level, DCeiling::ceilLowerAndCrush, ln, arg0, SPEED(arg1), SPEED(arg1), 8, arg2, 0, 0, CRUSHTYPE(arg3, arg1 == 8));
} }
FUNC(LS_Ceiling_LowerAndCrushDist) FUNC(LS_Ceiling_LowerAndCrushDist)
// Ceiling_LowerAndCrush (tag, speed, crush, dist, crushtype) // Ceiling_LowerAndCrush (tag, speed, crush, dist, crushtype)
{ {
return EV_DoCeiling (DCeiling::ceilLowerAndCrush, ln, arg0, SPEED(arg1), SPEED(arg1), arg3, arg2, 0, 0, CRUSHTYPE(arg4, arg1 == 8)); return EV_DoCeiling(Level, DCeiling::ceilLowerAndCrush, ln, arg0, SPEED(arg1), SPEED(arg1), arg3, arg2, 0, 0, CRUSHTYPE(arg4, arg1 == 8));
} }
FUNC(LS_Ceiling_CrushStop) FUNC(LS_Ceiling_CrushStop)
@ -723,160 +723,160 @@ FUNC(LS_Ceiling_CrushStop)
remove = gameinfo.gametype == GAME_Hexen; remove = gameinfo.gametype == GAME_Hexen;
break; break;
} }
return EV_CeilingCrushStop (arg0, remove); return EV_CeilingCrushStop (Level, arg0, remove);
} }
FUNC(LS_Ceiling_CrushRaiseAndStay) FUNC(LS_Ceiling_CrushRaiseAndStay)
// Ceiling_CrushRaiseAndStay (tag, speed, crush, crushtype) // Ceiling_CrushRaiseAndStay (tag, speed, crush, crushtype)
{ {
return EV_DoCeiling (DCeiling::ceilCrushRaiseAndStay, ln, arg0, SPEED(arg1), SPEED(arg1)/2, 8, arg2, 0, 0, CRUSHTYPE(arg3, false)); return EV_DoCeiling(Level, DCeiling::ceilCrushRaiseAndStay, ln, arg0, SPEED(arg1), SPEED(arg1)/2, 8, arg2, 0, 0, CRUSHTYPE(arg3, false));
} }
FUNC(LS_Ceiling_MoveToValueTimes8) FUNC(LS_Ceiling_MoveToValueTimes8)
// Ceiling_MoveToValueTimes8 (tag, speed, height, negative, change) // Ceiling_MoveToValueTimes8 (tag, speed, height, negative, change)
{ {
return EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0, return EV_DoCeiling(Level, DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0,
arg2*8*((arg3) ? -1 : 1), -1, 0, CHANGE(arg4)); arg2*8*((arg3) ? -1 : 1), -1, 0, CHANGE(arg4));
} }
FUNC(LS_Ceiling_MoveToValue) FUNC(LS_Ceiling_MoveToValue)
// Ceiling_MoveToValue (tag, speed, height, negative, change) // Ceiling_MoveToValue (tag, speed, height, negative, change)
{ {
return EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0, return EV_DoCeiling(Level, DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0,
arg2*((arg3) ? -1 : 1), -1, 0, CHANGE(arg4)); arg2*((arg3) ? -1 : 1), -1, 0, CHANGE(arg4));
} }
FUNC(LS_Ceiling_MoveToValueAndCrush) FUNC(LS_Ceiling_MoveToValueAndCrush)
// Ceiling_MoveToValueAndCrush (tag, speed, height, crush, crushmode) // Ceiling_MoveToValueAndCrush (tag, speed, height, crush, crushmode)
{ {
return EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0, return EV_DoCeiling(Level, DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0,
arg2, CRUSH(arg3), 0, 0, CRUSHTYPE(arg4, arg1 == 8)); arg2, CRUSH(arg3), 0, 0, CRUSHTYPE(arg4, arg1 == 8));
} }
FUNC(LS_Ceiling_LowerToHighestFloor) FUNC(LS_Ceiling_LowerToHighestFloor)
// Ceiling_LowerToHighestFloor (tag, speed, change, crush, gap) // Ceiling_LowerToHighestFloor (tag, speed, change, crush, gap)
{ {
return EV_DoCeiling (DCeiling::ceilLowerToHighestFloor, ln, arg0, SPEED(arg1), 0, arg4, CRUSH(arg3), 0, CHANGE(arg2)); return EV_DoCeiling(Level, DCeiling::ceilLowerToHighestFloor, ln, arg0, SPEED(arg1), 0, arg4, CRUSH(arg3), 0, CHANGE(arg2));
} }
FUNC(LS_Ceiling_LowerInstant) FUNC(LS_Ceiling_LowerInstant)
// Ceiling_LowerInstant (tag, unused, height, change, crush) // Ceiling_LowerInstant (tag, unused, height, change, crush)
{ {
return EV_DoCeiling (DCeiling::ceilLowerInstant, ln, arg0, 0, 0, arg2*8, CRUSH(arg4), 0, CHANGE(arg3)); return EV_DoCeiling(Level, DCeiling::ceilLowerInstant, ln, arg0, 0, 0, arg2*8, CRUSH(arg4), 0, CHANGE(arg3));
} }
FUNC(LS_Ceiling_RaiseInstant) FUNC(LS_Ceiling_RaiseInstant)
// Ceiling_RaiseInstant (tag, unused, height, change) // Ceiling_RaiseInstant (tag, unused, height, change)
{ {
return EV_DoCeiling (DCeiling::ceilRaiseInstant, ln, arg0, 0, 0, arg2*8, -1, 0, CHANGE(arg3)); return EV_DoCeiling(Level, DCeiling::ceilRaiseInstant, ln, arg0, 0, 0, arg2*8, -1, 0, CHANGE(arg3));
} }
FUNC(LS_Ceiling_CrushRaiseAndStayA) FUNC(LS_Ceiling_CrushRaiseAndStayA)
// Ceiling_CrushRaiseAndStayA (tag, dnspeed, upspeed, damage, crushtype) // Ceiling_CrushRaiseAndStayA (tag, dnspeed, upspeed, damage, crushtype)
{ {
return EV_DoCeiling (DCeiling::ceilCrushRaiseAndStay, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg3, 0, 0, CRUSHTYPE(arg4, false)); return EV_DoCeiling(Level, DCeiling::ceilCrushRaiseAndStay, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg3, 0, 0, CRUSHTYPE(arg4, false));
} }
FUNC(LS_Ceiling_CrushRaiseAndStaySilA) FUNC(LS_Ceiling_CrushRaiseAndStaySilA)
// Ceiling_CrushRaiseAndStaySilA (tag, dnspeed, upspeed, damage, crushtype) // Ceiling_CrushRaiseAndStaySilA (tag, dnspeed, upspeed, damage, crushtype)
{ {
return EV_DoCeiling (DCeiling::ceilCrushRaiseAndStay, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg3, 1, 0, CRUSHTYPE(arg4, false)); return EV_DoCeiling(Level, DCeiling::ceilCrushRaiseAndStay, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg3, 1, 0, CRUSHTYPE(arg4, false));
} }
FUNC(LS_Ceiling_CrushAndRaiseA) FUNC(LS_Ceiling_CrushAndRaiseA)
// Ceiling_CrushAndRaiseA (tag, dnspeed, upspeed, damage, crushtype) // Ceiling_CrushAndRaiseA (tag, dnspeed, upspeed, damage, crushtype)
{ {
return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg3, 0, 0, CRUSHTYPE(arg4, arg1 == 8 && arg2 == 8)); return EV_DoCeiling(Level, DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg3, 0, 0, CRUSHTYPE(arg4, arg1 == 8 && arg2 == 8));
} }
FUNC(LS_Ceiling_CrushAndRaiseDist) FUNC(LS_Ceiling_CrushAndRaiseDist)
// Ceiling_CrushAndRaiseDist (tag, dist, speed, damage, crushtype) // Ceiling_CrushAndRaiseDist (tag, dist, speed, damage, crushtype)
{ {
return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg2), SPEED(arg2), arg1, arg3, 0, 0, CRUSHTYPE(arg4, arg2 == 8)); return EV_DoCeiling(Level, DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg2), SPEED(arg2), arg1, arg3, 0, 0, CRUSHTYPE(arg4, arg2 == 8));
} }
FUNC(LS_Ceiling_CrushAndRaiseSilentA) FUNC(LS_Ceiling_CrushAndRaiseSilentA)
// Ceiling_CrushAndRaiseSilentA (tag, dnspeed, upspeed, damage, crushtype) // Ceiling_CrushAndRaiseSilentA (tag, dnspeed, upspeed, damage, crushtype)
{ {
return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg3, 1, 0, CRUSHTYPE(arg4, arg1 == 8 && arg2 == 8)); return EV_DoCeiling(Level, DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg3, 1, 0, CRUSHTYPE(arg4, arg1 == 8 && arg2 == 8));
} }
FUNC(LS_Ceiling_CrushAndRaiseSilentDist) FUNC(LS_Ceiling_CrushAndRaiseSilentDist)
// Ceiling_CrushAndRaiseSilentDist (tag, dist, upspeed, damage, crushtype) // Ceiling_CrushAndRaiseSilentDist (tag, dist, upspeed, damage, crushtype)
{ {
return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg2), SPEED(arg2), arg1, arg3, 1, 0, CRUSHTYPE(arg4, arg2 == 8)); return EV_DoCeiling(Level, DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg2), SPEED(arg2), arg1, arg3, 1, 0, CRUSHTYPE(arg4, arg2 == 8));
} }
FUNC(LS_Ceiling_RaiseToNearest) FUNC(LS_Ceiling_RaiseToNearest)
// Ceiling_RaiseToNearest (tag, speed, change) // Ceiling_RaiseToNearest (tag, speed, change)
{ {
return EV_DoCeiling (DCeiling::ceilRaiseToNearest, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0); return EV_DoCeiling(Level, DCeiling::ceilRaiseToNearest, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0);
} }
FUNC(LS_Ceiling_RaiseToHighest) FUNC(LS_Ceiling_RaiseToHighest)
// Ceiling_RaiseToHighest (tag, speed, change) // Ceiling_RaiseToHighest (tag, speed, change)
{ {
return EV_DoCeiling (DCeiling::ceilRaiseToHighest, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0); return EV_DoCeiling(Level, DCeiling::ceilRaiseToHighest, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0);
} }
FUNC(LS_Ceiling_RaiseToLowest) FUNC(LS_Ceiling_RaiseToLowest)
// Ceiling_RaiseToLowest (tag, speed, change) // Ceiling_RaiseToLowest (tag, speed, change)
{ {
return EV_DoCeiling (DCeiling::ceilRaiseToLowest, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0); return EV_DoCeiling(Level, DCeiling::ceilRaiseToLowest, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0);
} }
FUNC(LS_Ceiling_RaiseToHighestFloor) FUNC(LS_Ceiling_RaiseToHighestFloor)
// Ceiling_RaiseToHighestFloor (tag, speed, change) // Ceiling_RaiseToHighestFloor (tag, speed, change)
{ {
return EV_DoCeiling (DCeiling::ceilRaiseToHighestFloor, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0); return EV_DoCeiling(Level, DCeiling::ceilRaiseToHighestFloor, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0);
} }
FUNC(LS_Ceiling_RaiseByTexture) FUNC(LS_Ceiling_RaiseByTexture)
// Ceiling_RaiseByTexture (tag, speed, change) // Ceiling_RaiseByTexture (tag, speed, change)
{ {
return EV_DoCeiling (DCeiling::ceilRaiseByTexture, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0); return EV_DoCeiling(Level, DCeiling::ceilRaiseByTexture, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0);
} }
FUNC(LS_Ceiling_LowerToLowest) FUNC(LS_Ceiling_LowerToLowest)
// Ceiling_LowerToLowest (tag, speed, change, crush) // Ceiling_LowerToLowest (tag, speed, change, crush)
{ {
return EV_DoCeiling (DCeiling::ceilLowerToLowest, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2)); return EV_DoCeiling(Level, DCeiling::ceilLowerToLowest, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2));
} }
FUNC(LS_Ceiling_LowerToNearest) FUNC(LS_Ceiling_LowerToNearest)
// Ceiling_LowerToNearest (tag, speed, change, crush) // Ceiling_LowerToNearest (tag, speed, change, crush)
{ {
return EV_DoCeiling (DCeiling::ceilLowerToNearest, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2)); return EV_DoCeiling(Level, DCeiling::ceilLowerToNearest, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2));
} }
FUNC(LS_Ceiling_ToHighestInstant) FUNC(LS_Ceiling_ToHighestInstant)
// Ceiling_ToHighestInstant (tag, change, crush) // Ceiling_ToHighestInstant (tag, change, crush)
{ {
return EV_DoCeiling (DCeiling::ceilLowerToHighest, ln, arg0, 2, 0, 0, CRUSH(arg2), 0, CHANGE(arg1)); return EV_DoCeiling(Level, DCeiling::ceilLowerToHighest, ln, arg0, 2, 0, 0, CRUSH(arg2), 0, CHANGE(arg1));
} }
FUNC(LS_Ceiling_ToFloorInstant) FUNC(LS_Ceiling_ToFloorInstant)
// Ceiling_ToFloorInstant (tag, change, crush, gap) // Ceiling_ToFloorInstant (tag, change, crush, gap)
{ {
return EV_DoCeiling (DCeiling::ceilRaiseToFloor, ln, arg0, 2, 0, arg3, CRUSH(arg2), 0, CHANGE(arg1)); return EV_DoCeiling(Level, DCeiling::ceilRaiseToFloor, ln, arg0, 2, 0, arg3, CRUSH(arg2), 0, CHANGE(arg1));
} }
FUNC(LS_Ceiling_LowerToFloor) FUNC(LS_Ceiling_LowerToFloor)
// Ceiling_LowerToFloor (tag, speed, change, crush, gap) // Ceiling_LowerToFloor (tag, speed, change, crush, gap)
{ {
return EV_DoCeiling (DCeiling::ceilLowerToFloor, ln, arg0, SPEED(arg1), 0, arg4, CRUSH(arg3), 0, CHANGE(arg2)); return EV_DoCeiling(Level, DCeiling::ceilLowerToFloor, ln, arg0, SPEED(arg1), 0, arg4, CRUSH(arg3), 0, CHANGE(arg2));
} }
FUNC(LS_Ceiling_LowerByTexture) FUNC(LS_Ceiling_LowerByTexture)
// Ceiling_LowerByTexture (tag, speed, change, crush) // Ceiling_LowerByTexture (tag, speed, change, crush)
{ {
return EV_DoCeiling (DCeiling::ceilLowerByTexture, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2)); return EV_DoCeiling(Level, DCeiling::ceilLowerByTexture, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2));
} }
FUNC(LS_Ceiling_Stop) FUNC(LS_Ceiling_Stop)
// Ceiling_Stop (tag) // Ceiling_Stop (tag)
{ {
return EV_StopCeiling(arg0, ln); return EV_StopCeiling(Level, arg0, ln);
} }
@ -907,14 +907,14 @@ FUNC(LS_Generic_Ceiling)
} }
} }
return EV_DoCeiling (type, ln, arg0, SPEED(arg1), SPEED(arg1), arg2, return EV_DoCeiling(Level, type, ln, arg0, SPEED(arg1), SPEED(arg1), arg2,
(arg4 & 16) ? 20 : -1, 0, arg4 & 7); (arg4 & 16) ? 20 : -1, 0, arg4 & 7);
} }
FUNC(LS_Generic_Crusher) FUNC(LS_Generic_Crusher)
// Generic_Crusher (tag, dnspeed, upspeed, silent, damage) // Generic_Crusher (tag, dnspeed, upspeed, silent, damage)
{ {
return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), return EV_DoCeiling(Level, DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1),
SPEED(arg2), 0, arg4, arg3 ? 2 : 0, 0, (arg1 <= 24 && arg2 <= 24)? DCeiling::ECrushMode::crushSlowdown : DCeiling::ECrushMode::crushDoom); SPEED(arg2), 0, arg4, arg3 ? 2 : 0, 0, (arg1 <= 24 && arg2 <= 24)? DCeiling::ECrushMode::crushSlowdown : DCeiling::ECrushMode::crushDoom);
} }
@ -922,7 +922,7 @@ FUNC(LS_Generic_Crusher2)
// Generic_Crusher2 (tag, dnspeed, upspeed, silent, damage) // Generic_Crusher2 (tag, dnspeed, upspeed, silent, damage)
{ {
// same as above but uses Hexen's crushing method. // same as above but uses Hexen's crushing method.
return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), return EV_DoCeiling(Level, DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1),
SPEED(arg2), 0, arg4, arg3 ? 2 : 0, 0, DCeiling::ECrushMode::crushHexen); SPEED(arg2), 0, arg4, arg3 ? 2 : 0, 0, DCeiling::ECrushMode::crushHexen);
} }
@ -2024,26 +2024,26 @@ FUNC(LS_FS_Execute)
FUNC(LS_FloorAndCeiling_LowerByValue) FUNC(LS_FloorAndCeiling_LowerByValue)
// FloorAndCeiling_LowerByValue (tag, speed, height) // FloorAndCeiling_LowerByValue (tag, speed, height)
{ {
return EV_DoElevator (ln, DElevator::elevateLower, SPEED(arg1), arg2, arg0); return EV_DoElevator (Level, ln, DElevator::elevateLower, SPEED(arg1), arg2, arg0);
} }
FUNC(LS_FloorAndCeiling_RaiseByValue) FUNC(LS_FloorAndCeiling_RaiseByValue)
// FloorAndCeiling_RaiseByValue (tag, speed, height) // FloorAndCeiling_RaiseByValue (tag, speed, height)
{ {
return EV_DoElevator (ln, DElevator::elevateRaise, SPEED(arg1), arg2, arg0); return EV_DoElevator (Level, ln, DElevator::elevateRaise, SPEED(arg1), arg2, arg0);
} }
FUNC(LS_FloorAndCeiling_LowerRaise) FUNC(LS_FloorAndCeiling_LowerRaise)
// FloorAndCeiling_LowerRaise (tag, fspeed, cspeed, boomemu) // FloorAndCeiling_LowerRaise (tag, fspeed, cspeed, boomemu)
{ {
bool res = EV_DoCeiling (DCeiling::ceilRaiseToHighest, ln, arg0, SPEED(arg2), 0, 0, 0, 0, 0); bool res = EV_DoCeiling(Level, DCeiling::ceilRaiseToHighest, ln, arg0, SPEED(arg2), 0, 0, 0, 0, 0);
// The switch based Boom equivalents of FloorandCeiling_LowerRaise do incorrect checks // The switch based Boom equivalents of FloorandCeiling_LowerRaise do incorrect checks
// which cause the floor only to move when the ceiling fails to do so. // which cause the floor only to move when the ceiling fails to do so.
// To avoid problems with maps that have incorrect args this only uses a // To avoid problems with maps that have incorrect args this only uses a
// more or less unintuitive value for the fourth arg to trigger Boom's broken behavior // more or less unintuitive value for the fourth arg to trigger Boom's broken behavior
if (arg3 != 1998 || !res) // (1998 for the year in which Boom was released... :P) if (arg3 != 1998 || !res) // (1998 for the year in which Boom was released... :P)
{ {
res |= EV_DoFloor (DFloor::floorLowerToLowest, ln, arg0, SPEED(arg1), 0, -1, 0, false); res |= EV_DoFloor(Level, DFloor::floorLowerToLowest, ln, arg0, SPEED(arg1), 0, -1, 0, false);
} }
return res; return res;
} }
@ -2051,19 +2051,19 @@ FUNC(LS_FloorAndCeiling_LowerRaise)
FUNC(LS_Elevator_MoveToFloor) FUNC(LS_Elevator_MoveToFloor)
// Elevator_MoveToFloor (tag, speed) // Elevator_MoveToFloor (tag, speed)
{ {
return EV_DoElevator (ln, DElevator::elevateCurrent, SPEED(arg1), 0, arg0); return EV_DoElevator (Level, ln, DElevator::elevateCurrent, SPEED(arg1), 0, arg0);
} }
FUNC(LS_Elevator_RaiseToNearest) FUNC(LS_Elevator_RaiseToNearest)
// Elevator_RaiseToNearest (tag, speed) // Elevator_RaiseToNearest (tag, speed)
{ {
return EV_DoElevator (ln, DElevator::elevateUp, SPEED(arg1), 0, arg0); return EV_DoElevator (Level, ln, DElevator::elevateUp, SPEED(arg1), 0, arg0);
} }
FUNC(LS_Elevator_LowerToNearest) FUNC(LS_Elevator_LowerToNearest)
// Elevator_LowerToNearest (tag, speed) // Elevator_LowerToNearest (tag, speed)
{ {
return EV_DoElevator (ln, DElevator::elevateDown, SPEED(arg1), 0, arg0); return EV_DoElevator (Level, ln, DElevator::elevateDown, SPEED(arg1), 0, arg0);
} }
FUNC(LS_Light_ForceLightning) FUNC(LS_Light_ForceLightning)
@ -2076,77 +2076,77 @@ FUNC(LS_Light_ForceLightning)
FUNC(LS_Light_RaiseByValue) FUNC(LS_Light_RaiseByValue)
// Light_RaiseByValue (tag, value) // Light_RaiseByValue (tag, value)
{ {
EV_LightChange (arg0, arg1); EV_LightChange (Level, arg0, arg1);
return true; return true;
} }
FUNC(LS_Light_LowerByValue) FUNC(LS_Light_LowerByValue)
// Light_LowerByValue (tag, value) // Light_LowerByValue (tag, value)
{ {
EV_LightChange (arg0, -arg1); EV_LightChange (Level, arg0, -arg1);
return true; return true;
} }
FUNC(LS_Light_ChangeToValue) FUNC(LS_Light_ChangeToValue)
// Light_ChangeToValue (tag, value) // Light_ChangeToValue (tag, value)
{ {
EV_LightTurnOn (arg0, arg1); EV_LightTurnOn (Level, arg0, arg1);
return true; return true;
} }
FUNC(LS_Light_Fade) FUNC(LS_Light_Fade)
// Light_Fade (tag, value, tics); // Light_Fade (tag, value, tics);
{ {
EV_StartLightFading (arg0, arg1, TICS(arg2)); EV_StartLightFading (Level, arg0, arg1, TICS(arg2));
return true; return true;
} }
FUNC(LS_Light_Glow) FUNC(LS_Light_Glow)
// Light_Glow (tag, upper, lower, tics) // Light_Glow (tag, upper, lower, tics)
{ {
EV_StartLightGlowing (arg0, arg1, arg2, TICS(arg3)); EV_StartLightGlowing (Level, arg0, arg1, arg2, TICS(arg3));
return true; return true;
} }
FUNC(LS_Light_Flicker) FUNC(LS_Light_Flicker)
// Light_Flicker (tag, upper, lower) // Light_Flicker (tag, upper, lower)
{ {
EV_StartLightFlickering (arg0, arg1, arg2); EV_StartLightFlickering (Level, arg0, arg1, arg2);
return true; return true;
} }
FUNC(LS_Light_Strobe) FUNC(LS_Light_Strobe)
// Light_Strobe (tag, upper, lower, u-tics, l-tics) // Light_Strobe (tag, upper, lower, u-tics, l-tics)
{ {
EV_StartLightStrobing (arg0, arg1, arg2, TICS(arg3), TICS(arg4)); EV_StartLightStrobing (Level, arg0, arg1, arg2, TICS(arg3), TICS(arg4));
return true; return true;
} }
FUNC(LS_Light_StrobeDoom) FUNC(LS_Light_StrobeDoom)
// Light_StrobeDoom (tag, u-tics, l-tics) // Light_StrobeDoom (tag, u-tics, l-tics)
{ {
EV_StartLightStrobing (arg0, TICS(arg1), TICS(arg2)); EV_StartLightStrobing (Level, arg0, TICS(arg1), TICS(arg2));
return true; return true;
} }
FUNC(LS_Light_MinNeighbor) FUNC(LS_Light_MinNeighbor)
// Light_MinNeighbor (tag) // Light_MinNeighbor (tag)
{ {
EV_TurnTagLightsOff (arg0); EV_TurnTagLightsOff (Level, arg0);
return true; return true;
} }
FUNC(LS_Light_MaxNeighbor) FUNC(LS_Light_MaxNeighbor)
// Light_MaxNeighbor (tag) // Light_MaxNeighbor (tag)
{ {
EV_LightTurnOn (arg0, -1); EV_LightTurnOn (Level, arg0, -1);
return true; return true;
} }
FUNC(LS_Light_Stop) FUNC(LS_Light_Stop)
// Light_Stop (tag) // Light_Stop (tag)
{ {
EV_StopLightEffect (arg0); EV_StopLightEffect (Level, arg0);
return true; return true;
} }
@ -3492,7 +3492,7 @@ FUNC(LS_Line_SetHealth)
line_t* line = &Level->lines[l]; line_t* line = &Level->lines[l];
line->health = arg1; line->health = arg1;
if (line->healthgroup) if (line->healthgroup)
P_SetHealthGroupHealth(line->healthgroup, arg1); P_SetHealthGroupHealth(Level, line->healthgroup, arg1);
} }
return true; return true;
} }
@ -3513,19 +3513,19 @@ FUNC(LS_Sector_SetHealth)
{ {
sector->healthceiling = arg2; sector->healthceiling = arg2;
if (sector->healthceilinggroup) if (sector->healthceilinggroup)
P_SetHealthGroupHealth(sector->healthceilinggroup, arg2); P_SetHealthGroupHealth(Level, sector->healthceilinggroup, arg2);
} }
else if (arg1 == SECPART_Floor) else if (arg1 == SECPART_Floor)
{ {
sector->healthfloor = arg2; sector->healthfloor = arg2;
if (sector->healthfloorgroup) if (sector->healthfloorgroup)
P_SetHealthGroupHealth(sector->healthfloorgroup, arg2); P_SetHealthGroupHealth(Level, sector->healthfloorgroup, arg2);
} }
else if (arg1 == SECPART_3D) else if (arg1 == SECPART_3D)
{ {
sector->health3d = arg2; sector->health3d = arg2;
if (sector->health3dgroup) if (sector->health3dgroup)
P_SetHealthGroupHealth(sector->health3dgroup, arg2); P_SetHealthGroupHealth(Level, sector->health3dgroup, arg2);
} }
} }
return true; return true;

View file

@ -1082,7 +1082,7 @@ static bool PIT_CheckPortal(FMultiBlockLinesIterator &mit, FMultiBlockLinesItera
tm.thing->AddZ(zofs); tm.thing->AddZ(zofs);
FBoundingBox pbox(cres.Position.X, cres.Position.Y, tm.thing->radius); FBoundingBox pbox(cres.Position.X, cres.Position.Y, tm.thing->radius);
FBlockLinesIterator it(pbox); FBlockLinesIterator it(tm.thing->Level, pbox);
bool ret = false; bool ret = false;
line_t *ld; line_t *ld;
@ -2930,7 +2930,7 @@ void FSlide::HitSlideLine(line_t* ld)
void FSlide::SlideTraverse(const DVector2 &start, const DVector2 &end) void FSlide::SlideTraverse(const DVector2 &start, const DVector2 &end)
{ {
FLineOpening open; FLineOpening open;
FPathTraverse it(start.X, start.Y, end.X, end.Y, PT_ADDLINES); FPathTraverse it(slidemo->Level, start.X, start.Y, end.X, end.Y, PT_ADDLINES);
intercept_t *in; intercept_t *in;
while ((in = it.Next())) while ((in = it.Next()))
@ -3287,7 +3287,7 @@ const secplane_t * P_CheckSlopeWalk(AActor *actor, DVector2 &move)
bool FSlide::BounceTraverse(const DVector2 &start, const DVector2 &end) bool FSlide::BounceTraverse(const DVector2 &start, const DVector2 &end)
{ {
FLineOpening open; FLineOpening open;
FPathTraverse it(start.X, start.Y, end.X, end.Y, PT_ADDLINES); FPathTraverse it(slidemo->Level, start.X, start.Y, end.X, end.Y, PT_ADDLINES);
intercept_t *in; intercept_t *in;
while ((in = it.Next())) while ((in = it.Next()))
@ -3979,7 +3979,7 @@ struct aim_t
if (ceilingportalstate) EnterSectorPortal(sector_t::ceiling, 0, lastsector, toppitch, MIN<DAngle>(0., bottompitch)); if (ceilingportalstate) EnterSectorPortal(sector_t::ceiling, 0, lastsector, toppitch, MIN<DAngle>(0., bottompitch));
if (floorportalstate) EnterSectorPortal(sector_t::floor, 0, lastsector, MAX<DAngle>(0., toppitch), bottompitch); if (floorportalstate) EnterSectorPortal(sector_t::floor, 0, lastsector, MAX<DAngle>(0., toppitch), bottompitch);
FPathTraverse it(startpos.X, startpos.Y, aimtrace.X, aimtrace.Y, PT_ADDLINES | PT_ADDTHINGS | PT_COMPATIBLE | PT_DELTA, startfrac); FPathTraverse it(shootthing->Level, startpos.X, startpos.Y, aimtrace.X, aimtrace.Y, PT_ADDLINES | PT_ADDTHINGS | PT_COMPATIBLE | PT_DELTA, startfrac);
intercept_t *in; intercept_t *in;
if (aimdebug) if (aimdebug)
@ -5380,7 +5380,7 @@ bool P_TalkFacing(AActor *player)
bool P_UseTraverse(AActor *usething, const DVector2 &start, const DVector2 &end, bool &foundline) bool P_UseTraverse(AActor *usething, const DVector2 &start, const DVector2 &end, bool &foundline)
{ {
FPathTraverse it(start.X, start.Y, end.X, end.Y, PT_ADDLINES | PT_ADDTHINGS); FPathTraverse it(usething->Level, start.X, start.Y, end.X, end.Y, PT_ADDLINES | PT_ADDTHINGS);
intercept_t *in; intercept_t *in;
DVector3 xpos = { start.X, start.Y, usething->Z() }; DVector3 xpos = { start.X, start.Y, usething->Z() };
@ -5523,7 +5523,7 @@ bool P_UseTraverse(AActor *usething, const DVector2 &start, const DVector2 &end,
bool P_NoWayTraverse(AActor *usething, const DVector2 &start, const DVector2 &end) bool P_NoWayTraverse(AActor *usething, const DVector2 &start, const DVector2 &end)
{ {
FPathTraverse it(start.X, start.Y, end.X, end.Y, PT_ADDLINES); FPathTraverse it(usething->Level, start.X, start.Y, end.X, end.Y, PT_ADDLINES);
intercept_t *in; intercept_t *in;
while ((in = it.Next())) while ((in = it.Next()))
@ -5600,7 +5600,7 @@ int P_UsePuzzleItem(AActor *PuzzleItemUser, int PuzzleItemType)
start = PuzzleItemUser->GetPortalTransition(PuzzleItemUser->Height / 2); start = PuzzleItemUser->GetPortalTransition(PuzzleItemUser->Height / 2);
end = PuzzleItemUser->Angles.Yaw.ToVector(usedist); end = PuzzleItemUser->Angles.Yaw.ToVector(usedist);
FPathTraverse it(start.X, start.Y, end.X, end.Y, PT_DELTA | PT_ADDLINES | PT_ADDTHINGS); FPathTraverse it(PuzzleItemUser->Level, start.X, start.Y, end.X, end.Y, PT_DELTA | PT_ADDLINES | PT_ADDTHINGS);
intercept_t *in; intercept_t *in;
while ((in = it.Next())) while ((in = it.Next()))

View file

@ -582,7 +582,7 @@ void AActor::SetOrigin(double x, double y, double z, bool moving)
// //
//=========================================================================== //===========================================================================
FBlockLinesIterator::FBlockLinesIterator(int _minx, int _miny, int _maxx, int _maxy, bool keepvalidcount) FBlockLinesIterator::FBlockLinesIterator(FLevelLocals *l, int _minx, int _miny, int _maxx, int _maxy, bool keepvalidcount) : Level(l)
{ {
if (!keepvalidcount) validcount++; if (!keepvalidcount) validcount++;
minx = _minx; minx = _minx;
@ -595,14 +595,14 @@ FBlockLinesIterator::FBlockLinesIterator(int _minx, int _miny, int _maxx, int _m
void FBlockLinesIterator::init(const FBoundingBox &box) void FBlockLinesIterator::init(const FBoundingBox &box)
{ {
validcount++; validcount++;
maxy = level.blockmap.GetBlockY(box.Top()); maxy = Level->blockmap.GetBlockY(box.Top());
miny = level.blockmap.GetBlockY(box.Bottom()); miny = Level->blockmap.GetBlockY(box.Bottom());
maxx = level.blockmap.GetBlockX(box.Right()); maxx = Level->blockmap.GetBlockX(box.Right());
minx = level.blockmap.GetBlockX(box.Left()); minx = Level->blockmap.GetBlockX(box.Left());
Reset(); Reset();
} }
FBlockLinesIterator::FBlockLinesIterator(const FBoundingBox &box) FBlockLinesIterator::FBlockLinesIterator(FLevelLocals *l, const FBoundingBox &box) : Level(l)
{ {
init(box); init(box);
} }
@ -617,13 +617,13 @@ void FBlockLinesIterator::StartBlock(int x, int y)
{ {
curx = x; curx = x;
cury = y; cury = y;
if (level.blockmap.isValidBlock(x, y)) if (Level->blockmap.isValidBlock(x, y))
{ {
unsigned offset = y*level.blockmap.bmapwidth + x; unsigned offset = y*Level->blockmap.bmapwidth + x;
polyLink = level.PolyBlockMap.Size() > offset? level.PolyBlockMap[offset] : nullptr; polyLink = Level->PolyBlockMap.Size() > offset? Level->PolyBlockMap[offset] : nullptr;
polyIndex = 0; polyIndex = 0;
list = level.blockmap.GetLines(x, y); list = Level->blockmap.GetLines(x, y);
} }
else else
{ {
@ -682,7 +682,7 @@ line_t *FBlockLinesIterator::Next()
{ {
while (*list != -1) while (*list != -1)
{ {
line_t *ld = &level.lines[*list]; line_t *ld = &Level->lines[*list];
list++; list++;
if (ld->validcount != validcount) if (ld->validcount != validcount)
@ -711,7 +711,7 @@ line_t *FBlockLinesIterator::Next()
//=========================================================================== //===========================================================================
FMultiBlockLinesIterator::FMultiBlockLinesIterator(FPortalGroupArray &check, AActor *origin, double checkradius) FMultiBlockLinesIterator::FMultiBlockLinesIterator(FPortalGroupArray &check, AActor *origin, double checkradius)
: checklist(check) : checklist(check), blockIterator(origin->Level)
{ {
checkpoint = origin->Pos(); checkpoint = origin->Pos();
if (!check.inited) P_CollectConnectedGroups(origin->Level, origin->Sector->PortalGroup, checkpoint, origin->Top(), checkradius, checklist); if (!check.inited) P_CollectConnectedGroups(origin->Level, origin->Sector->PortalGroup, checkpoint, origin->Top(), checkradius, checklist);
@ -722,7 +722,7 @@ FMultiBlockLinesIterator::FMultiBlockLinesIterator(FPortalGroupArray &check, AAc
} }
FMultiBlockLinesIterator::FMultiBlockLinesIterator(FPortalGroupArray &check, FLevelLocals *Level, double checkx, double checky, double checkz, double checkh, double checkradius, sector_t *newsec) FMultiBlockLinesIterator::FMultiBlockLinesIterator(FPortalGroupArray &check, FLevelLocals *Level, double checkx, double checky, double checkz, double checkh, double checkradius, sector_t *newsec)
: checklist(check) : checklist(check), blockIterator(Level)
{ {
checkpoint = { checkx, checky, checkz }; checkpoint = { checkx, checky, checkz };
if (newsec == NULL) newsec = P_PointInSector(checkx, checky); if (newsec == NULL) newsec = P_PointInSector(checkx, checky);
@ -848,7 +848,7 @@ bool FMultiBlockLinesIterator::Next(FMultiBlockLinesIterator::CheckResult *item)
bool FMultiBlockLinesIterator::startIteratorForGroup(int group) bool FMultiBlockLinesIterator::startIteratorForGroup(int group)
{ {
offset = level.Displacements.getOffset(basegroup, group); offset = blockIterator.Level->Displacements.getOffset(basegroup, group);
offset.X += checkpoint.X; offset.X += checkpoint.X;
offset.Y += checkpoint.Y; offset.Y += checkpoint.Y;
cursector = group == startsector->PortalGroup ? startsector : P_PointInSector(offset); cursector = group == startsector->PortalGroup ? startsector : P_PointInSector(offset);
@ -881,8 +881,8 @@ void FMultiBlockLinesIterator::Reset()
// //
//=========================================================================== //===========================================================================
FBlockThingsIterator::FBlockThingsIterator() FBlockThingsIterator::FBlockThingsIterator(FLevelLocals *l)
: DynHash(0) : Level(l), DynHash(0)
{ {
minx = maxx = 0; minx = maxx = 0;
miny = maxy = 0; miny = maxy = 0;
@ -890,8 +890,8 @@ FBlockThingsIterator::FBlockThingsIterator()
block = NULL; block = NULL;
} }
FBlockThingsIterator::FBlockThingsIterator(int _minx, int _miny, int _maxx, int _maxy) FBlockThingsIterator::FBlockThingsIterator(FLevelLocals *L, int _minx, int _miny, int _maxx, int _maxy)
: DynHash(0) : Level(L), DynHash(0)
{ {
minx = _minx; minx = _minx;
maxx = _maxx; maxx = _maxx;
@ -903,10 +903,10 @@ FBlockThingsIterator::FBlockThingsIterator(int _minx, int _miny, int _maxx, int
void FBlockThingsIterator::init(const FBoundingBox &box) void FBlockThingsIterator::init(const FBoundingBox &box)
{ {
maxy = level.blockmap.GetBlockY(box.Top()); maxy = Level->blockmap.GetBlockY(box.Top());
miny = level.blockmap.GetBlockY(box.Bottom()); miny = Level->blockmap.GetBlockY(box.Bottom());
maxx = level.blockmap.GetBlockX(box.Right()); maxx = Level->blockmap.GetBlockX(box.Right());
minx = level.blockmap.GetBlockX(box.Left()); minx = Level->blockmap.GetBlockX(box.Left());
ClearHash(); ClearHash();
Reset(); Reset();
} }
@ -934,9 +934,9 @@ void FBlockThingsIterator::StartBlock(int x, int y)
{ {
curx = x; curx = x;
cury = y; cury = y;
if (level.blockmap.isValidBlock(x, y)) if (Level->blockmap.isValidBlock(x, y))
{ {
block = level.blockmap.blocklinks[y*level.blockmap.bmapwidth + x]; block = Level->blockmap.blocklinks[y*Level->blockmap.bmapwidth + x];
} }
else else
{ {
@ -984,9 +984,9 @@ AActor *FBlockThingsIterator::Next(bool centeronly)
if (centeronly) if (centeronly)
{ {
// Block boundaries for compatibility mode // Block boundaries for compatibility mode
double blockleft = (curx * FBlockmap::MAPBLOCKUNITS) + level.blockmap.bmaporgx; double blockleft = (curx * FBlockmap::MAPBLOCKUNITS) + Level->blockmap.bmaporgx;
double blockright = blockleft + FBlockmap::MAPBLOCKUNITS; double blockright = blockleft + FBlockmap::MAPBLOCKUNITS;
double blockbottom = (cury * FBlockmap::MAPBLOCKUNITS) + level.blockmap.bmaporgy; double blockbottom = (cury * FBlockmap::MAPBLOCKUNITS) + Level->blockmap.bmaporgy;
double blocktop = blockbottom + FBlockmap::MAPBLOCKUNITS; double blocktop = blockbottom + FBlockmap::MAPBLOCKUNITS;
// only return actors with the center in this block // only return actors with the center in this block
@ -1053,7 +1053,7 @@ AActor *FBlockThingsIterator::Next(bool centeronly)
//=========================================================================== //===========================================================================
FMultiBlockThingsIterator::FMultiBlockThingsIterator(FPortalGroupArray &check, AActor *origin, double checkradius, bool ignorerestricted) FMultiBlockThingsIterator::FMultiBlockThingsIterator(FPortalGroupArray &check, AActor *origin, double checkradius, bool ignorerestricted)
: checklist(check) : checklist(check), blockIterator(origin->Level)
{ {
checkpoint = origin->Pos(); checkpoint = origin->Pos();
if (!check.inited) P_CollectConnectedGroups(origin->Level, origin->Sector->PortalGroup, checkpoint, origin->Top(), checkradius, checklist); if (!check.inited) P_CollectConnectedGroups(origin->Level, origin->Sector->PortalGroup, checkpoint, origin->Top(), checkradius, checklist);
@ -1063,7 +1063,7 @@ FMultiBlockThingsIterator::FMultiBlockThingsIterator(FPortalGroupArray &check, A
} }
FMultiBlockThingsIterator::FMultiBlockThingsIterator(FPortalGroupArray &check, FLevelLocals *Level, double checkx, double checky, double checkz, double checkh, double checkradius, bool ignorerestricted, sector_t *newsec) FMultiBlockThingsIterator::FMultiBlockThingsIterator(FPortalGroupArray &check, FLevelLocals *Level, double checkx, double checky, double checkz, double checkh, double checkradius, bool ignorerestricted, sector_t *newsec)
: checklist(check) : checklist(check), blockIterator(Level)
{ {
checkpoint.X = checkx; checkpoint.X = checkx;
checkpoint.Y = checky; checkpoint.Y = checky;
@ -1087,7 +1087,7 @@ bool FMultiBlockThingsIterator::Next(FMultiBlockThingsIterator::CheckResult *ite
if (thing != NULL) if (thing != NULL)
{ {
item->thing = thing; item->thing = thing;
item->Position = checkpoint + level.Displacements.getOffset(basegroup, thing->Sector->PortalGroup); item->Position = checkpoint + blockIterator.Level->Displacements.getOffset(basegroup, thing->Sector->PortalGroup);
item->portalflags = portalflags; item->portalflags = portalflags;
return true; return true;
} }
@ -1126,7 +1126,7 @@ bool FMultiBlockThingsIterator::Next(FMultiBlockThingsIterator::CheckResult *ite
void FMultiBlockThingsIterator::startIteratorForGroup(int group) void FMultiBlockThingsIterator::startIteratorForGroup(int group)
{ {
DVector2 offset = level.Displacements.getOffset(basegroup, group); DVector2 offset = blockIterator.Level->Displacements.getOffset(basegroup, group);
offset.X += checkpoint.X; offset.X += checkpoint.X;
offset.Y += checkpoint.Y; offset.Y += checkpoint.Y;
bbox.setBox(offset.X, offset.Y, checkpoint.Z); bbox.setBox(offset.X, offset.Y, checkpoint.Z);
@ -1169,7 +1169,7 @@ TArray<intercept_t> FPathTraverse::intercepts(128);
void FPathTraverse::AddLineIntercepts(int bx, int by) void FPathTraverse::AddLineIntercepts(int bx, int by)
{ {
FBlockLinesIterator it(bx, by, bx, by, true); FBlockLinesIterator it(Level, bx, by, bx, by, true);
line_t *ld; line_t *ld;
while ((ld = it.Next())) while ((ld = it.Next()))
@ -1459,13 +1459,13 @@ void FPathTraverse::init(double x1, double y1, double x2, double y2, int flags,
y2 += y1; y2 += y1;
} }
x1 -= level.blockmap.bmaporgx; x1 -= Level->blockmap.bmaporgx;
y1 -= level.blockmap.bmaporgy; y1 -= Level->blockmap.bmaporgy;
xt1 = x1 / FBlockmap::MAPBLOCKUNITS; xt1 = x1 / FBlockmap::MAPBLOCKUNITS;
yt1 = y1 / FBlockmap::MAPBLOCKUNITS; yt1 = y1 / FBlockmap::MAPBLOCKUNITS;
x2 -= level.blockmap.bmaporgx; x2 -= Level->blockmap.bmaporgx;
y2 -= level.blockmap.bmaporgy; y2 -= Level->blockmap.bmaporgy;
xt2 = x2 / FBlockmap::MAPBLOCKUNITS; xt2 = x2 / FBlockmap::MAPBLOCKUNITS;
yt2 = y2 / FBlockmap::MAPBLOCKUNITS; yt2 = y2 / FBlockmap::MAPBLOCKUNITS;
@ -1543,7 +1543,7 @@ void FPathTraverse::init(double x1, double y1, double x2, double y2, int flags,
bool compatible = (flags & PT_COMPATIBLE) && (i_compatflags & COMPATF_HITSCAN); bool compatible = (flags & PT_COMPATIBLE) && (i_compatflags & COMPATF_HITSCAN);
// we want to use one list of checked actors for the entire operation // we want to use one list of checked actors for the entire operation
FBlockThingsIterator btit; FBlockThingsIterator btit(Level);
for (count = 0 ; count < 1000 ; count++) for (count = 0 ; count < 1000 ; count++)
{ {
if (flags & PT_ADDLINES) if (flags & PT_ADDLINES)
@ -1789,7 +1789,7 @@ static AActor *RoughBlockCheck (AActor *mo, int index, void *param)
FBlockNode *link; FBlockNode *link;
for (link = level.blockmap.blocklinks[index]; link != NULL; link = link->NextActor) for (link = mo->Level->blockmap.blocklinks[index]; link != NULL; link = link->NextActor)
{ {
if (link->Me != mo) if (link->Me != mo)
{ {

View file

@ -117,7 +117,7 @@ struct FLineOpening
static const double LINEOPEN_MIN = -FLT_MAX; static const double LINEOPEN_MIN = -FLT_MAX;
static const double LINEOPEN_MAX = FLT_MAX; static const double LINEOPEN_MAX = FLT_MAX;
void P_LineOpening(FLineOpening &open, AActor *thing, const line_t *linedef, const DVector2 &xy, const DVector2 *ref = NULL, int flags = 0); void P_LineOpening(FLineOpening &open, AActor *thing, const line_t *linedef, const DVector2 &xy, const DVector2 *ref = nullptr, int flags = 0);
inline void P_LineOpening(FLineOpening &open, AActor *thing, const line_t *linedef, const DVector2 &xy, const DVector3 *ref, int flags = 0) inline void P_LineOpening(FLineOpening &open, AActor *thing, const line_t *linedef, const DVector2 &xy, const DVector3 *ref, int flags = 0)
{ {
P_LineOpening(open, thing, linedef, xy, reinterpret_cast<const DVector2*>(ref), flags); P_LineOpening(open, thing, linedef, xy, reinterpret_cast<const DVector2*>(ref), flags);
@ -206,6 +206,7 @@ private:
class FBlockLinesIterator class FBlockLinesIterator
{ {
friend class FMultiBlockLinesIterator; friend class FMultiBlockLinesIterator;
FLevelLocals *Level;
int minx, maxx; int minx, maxx;
int miny, maxy; int miny, maxy;
@ -216,11 +217,11 @@ class FBlockLinesIterator
void StartBlock(int x, int y); void StartBlock(int x, int y);
FBlockLinesIterator() {} FBlockLinesIterator(FLevelLocals *l) { Level = l; }
void init(const FBoundingBox &box); void init(const FBoundingBox &box);
public: public:
FBlockLinesIterator(int minx, int miny, int maxx, int maxy, bool keepvalidcount = false); FBlockLinesIterator(FLevelLocals *Level, int minx, int miny, int maxx, int maxy, bool keepvalidcount = false);
FBlockLinesIterator(const FBoundingBox &box); FBlockLinesIterator(FLevelLocals *Level, const FBoundingBox &box);
line_t *Next(); line_t *Next();
void Reset() { StartBlock(minx, miny); } void Reset() { StartBlock(minx, miny); }
}; };
@ -276,6 +277,7 @@ public:
class FBlockThingsIterator class FBlockThingsIterator
{ {
FLevelLocals *Level;
int minx, maxx; int minx, maxx;
int miny, maxy; int miny, maxy;
@ -302,14 +304,14 @@ class FBlockThingsIterator
// The following is only for use in the path traverser // The following is only for use in the path traverser
// and therefore declared private. // and therefore declared private.
FBlockThingsIterator(); FBlockThingsIterator(FLevelLocals *l);
friend class FPathTraverse; friend class FPathTraverse;
friend class FMultiBlockThingsIterator; friend class FMultiBlockThingsIterator;
public: public:
FBlockThingsIterator(int minx, int miny, int maxx, int maxy); FBlockThingsIterator(FLevelLocals *Level, int minx, int miny, int maxx, int maxy);
FBlockThingsIterator(const FBoundingBox &box) FBlockThingsIterator(FLevelLocals *Level, const FBoundingBox &box)
{ {
init(box); init(box);
} }
@ -331,7 +333,7 @@ class FMultiBlockThingsIterator
void startIteratorForGroup(int group); void startIteratorForGroup(int group);
protected: protected:
FMultiBlockThingsIterator(FPortalGroupArray &check) : checklist(check) {} //FMultiBlockThingsIterator(FPortalGroupArray &check) : checklist(check) {}
public: public:
struct CheckResult struct CheckResult
@ -358,6 +360,7 @@ class FPathTraverse
protected: protected:
static TArray<intercept_t> intercepts; static TArray<intercept_t> intercepts;
FLevelLocals *Level;
divline_t trace; divline_t trace;
double Startfrac; double Startfrac;
unsigned int intercept_index; unsigned int intercept_index;
@ -366,17 +369,18 @@ protected:
virtual void AddLineIntercepts(int bx, int by); virtual void AddLineIntercepts(int bx, int by);
virtual void AddThingIntercepts(int bx, int by, FBlockThingsIterator &it, bool compatible); virtual void AddThingIntercepts(int bx, int by, FBlockThingsIterator &it, bool compatible);
FPathTraverse() {} FPathTraverse(FLevelLocals *l) { Level = l; }
public: public:
intercept_t *Next(); intercept_t *Next();
FPathTraverse(double x1, double y1, double x2, double y2, int flags, double startfrac = 0) FPathTraverse(FLevelLocals *l, double x1, double y1, double x2, double y2, int flags, double startfrac = 0)
{ {
Level = l;
init(x1, y1, x2, y2, flags, startfrac); init(x1, y1, x2, y2, flags, startfrac);
} }
void init(double x1, double y1, double x2, double y2, int flags, double startfrac = 0); void init(double x1, double y1, double x2, double y2, int flags, double startfrac = 0);
int PortalRelocate(intercept_t *in, int flags, DVector3 *optpos = NULL); int PortalRelocate(intercept_t *in, int flags, DVector3 *optpos = nullptr);
void PortalRelocate(const DVector2 &disp, int flags, double hitfrac); void PortalRelocate(const DVector2 &disp, int flags, double hitfrac);
virtual ~FPathTraverse(); virtual ~FPathTraverse();
const divline_t &Trace() const { return trace; } const divline_t &Trace() const { return trace; }
@ -404,7 +408,7 @@ class FLinePortalTraverse : public FPathTraverse
void AddLineIntercepts(int bx, int by); void AddLineIntercepts(int bx, int by);
public: public:
FLinePortalTraverse() FLinePortalTraverse(FLevelLocals *l) : FPathTraverse(l)
{ {
} }
}; };

View file

@ -1007,7 +1007,7 @@ void G_SerializeLevel(FSerializer &arc, FLevelLocals *Level, bool hubload)
if (arc.isReading()) P_FinalizePortals(&level); if (arc.isReading()) P_FinalizePortals(&level);
// [ZZ] serialize health groups // [ZZ] serialize health groups
P_SerializeHealthGroups(arc); P_SerializeHealthGroups(Level, arc);
// [ZZ] serialize events // [ZZ] serialize events
E_SerializeEvents(arc); E_SerializeEvents(arc);
DThinker::SerializeThinkers(arc, hubload); DThinker::SerializeThinkers(arc, hubload);

View file

@ -238,7 +238,7 @@ msecnode_t *P_CreateSecNodeList(AActor *thing, double radius, msecnode_t *sector
} }
FBoundingBox box(thing->X(), thing->Y(), radius); FBoundingBox box(thing->X(), thing->Y(), radius);
FBlockLinesIterator it(box); FBlockLinesIterator it(thing->Level, box);
line_t *ld; line_t *ld;
while ((ld = it.Next())) while ((ld = it.Next()))

View file

@ -133,19 +133,19 @@ protected:
DLighting(); DLighting();
}; };
void EV_StartLightFlickering (int tag, int upper, int lower); void EV_StartLightFlickering (FLevelLocals *Level, int tag, int upper, int lower);
void EV_StartLightStrobing (int tag, int upper, int lower, int utics, int ltics); void EV_StartLightStrobing (FLevelLocals *Level, int tag, int upper, int lower, int utics, int ltics);
void EV_StartLightStrobing (int tag, int utics, int ltics); void EV_StartLightStrobing (FLevelLocals *Level, int tag, int utics, int ltics);
void EV_TurnTagLightsOff (int tag); void EV_TurnTagLightsOff (FLevelLocals *Level, int tag);
void EV_LightTurnOn (int tag, int bright); void EV_LightTurnOn (FLevelLocals *Level, int tag, int bright);
void EV_LightTurnOnPartway (int tag, double frac); // killough 10/98 void EV_LightTurnOnPartway (FLevelLocals *Level, int tag, double frac); // killough 10/98
void EV_LightChange (int tag, int value); void EV_LightChange (FLevelLocals *Level, int tag, int value);
void EV_StopLightEffect (int tag); void EV_StopLightEffect (FLevelLocals *Level, int tag);
void P_SpawnGlowingLight (sector_t *sector); void P_SpawnGlowingLight (sector_t *sector);
void EV_StartLightGlowing (int tag, int upper, int lower, int tics); void EV_StartLightGlowing (FLevelLocals *Level, int tag, int upper, int lower, int tics);
void EV_StartLightFading (int tag, int value, int tics); void EV_StartLightFading (FLevelLocals *Level, int tag, int value, int tics);
// //
@ -310,7 +310,7 @@ protected:
void DoorSound (bool raise, class DSeqNode *curseq=NULL) const; void DoorSound (bool raise, class DSeqNode *curseq=NULL) const;
friend bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, friend bool EV_DoDoor (FLevelLocals *Level, DDoor::EVlDoor type, line_t *line, AActor *thing,
int tag, double speed, int delay, int lock, int tag, double speed, int delay, int lock,
int lightTag, bool boomgen, int topcountdown); int lightTag, bool boomgen, int topcountdown);
private: private:
@ -318,7 +318,7 @@ private:
}; };
bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, bool EV_DoDoor (FLevelLocals *Level, DDoor::EVlDoor type, line_t *line, AActor *thing,
int tag, double speed, int delay, int lock, int tag, double speed, int delay, int lock,
int lightTag, bool boomgen = false, int topcountdown = 0); int lightTag, bool boomgen = false, int topcountdown = 0);
@ -360,12 +360,12 @@ protected:
int m_Delay; int m_Delay;
bool m_SetBlocking1, m_SetBlocking2; bool m_SetBlocking1, m_SetBlocking2;
friend bool EV_SlidingDoor (line_t *line, AActor *thing, int tag, int speed, int delay, EADType type); friend bool EV_SlidingDoor (FLevelLocals *Level, line_t *line, AActor *thing, int tag, int speed, int delay, EADType type);
private: private:
DAnimatedDoor (); DAnimatedDoor ();
}; };
bool EV_SlidingDoor (line_t *line, AActor *thing, int tag, int speed, int delay, DAnimatedDoor::EADType type); bool EV_SlidingDoor (FLevelLocals *Level, line_t *line, AActor *thing, int tag, int speed, int delay, DAnimatedDoor::EADType type);
// //
// P_CEILNG // P_CEILNG
@ -447,16 +447,16 @@ private:
DCeiling (); DCeiling ();
friend bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int tag, double speed, double speed2, double height, int crush, int silent, int change, DCeiling::ECrushMode hexencrush); friend bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int tag, double speed, double speed2, double height, int crush, int silent, int change, DCeiling::ECrushMode hexencrush);
friend bool EV_CeilingCrushStop (int tag, bool remove); friend bool EV_CeilingCrushStop (FLevelLocals *Level, int tag, bool remove);
friend void P_ActivateInStasisCeiling (int tag); friend void P_ActivateInStasisCeiling (FLevelLocals *Level, int tag);
}; };
bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int tag, double speed, double speed2, double height, int crush, int silent, int change, DCeiling::ECrushMode hexencrush); bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int tag, double speed, double speed2, double height, int crush, int silent, int change, DCeiling::ECrushMode hexencrush);
bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line, int tag, double speed, double speed2, double height, int crush, int silent, int change, DCeiling::ECrushMode hexencrush = DCeiling::ECrushMode::crushDoom); bool EV_DoCeiling (FLevelLocals *Level, DCeiling::ECeiling type, line_t *line, int tag, double speed, double speed2, double height, int crush, int silent, int change, DCeiling::ECrushMode hexencrush = DCeiling::ECrushMode::crushDoom);
bool EV_CeilingCrushStop (int tag, bool remove); bool EV_CeilingCrushStop (FLevelLocals *Level, int tag, bool remove);
bool EV_StopCeiling(int tag, line_t *line); bool EV_StopCeiling(FLevelLocals *Level, int tag, line_t *line);
void P_ActivateInStasisCeiling (int tag); void P_ActivateInStasisCeiling (FLevelLocals *Level, int tag);
@ -548,12 +548,12 @@ public:
void StartFloorSound (); void StartFloorSound ();
void SetFloorChangeType (sector_t *sec, int change); void SetFloorChangeType (sector_t *sec, int change);
friend bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, friend bool EV_BuildStairs (FLevelLocals *Level, int tag, DFloor::EStair type, line_t *line,
double stairsize, double speed, int delay, int reset, int igntxt, double stairsize, double speed, int delay, int reset, int igntxt,
int usespecials); int usespecials);
friend bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, friend bool EV_DoFloor (FLevelLocals *Level, DFloor::EFloor floortype, line_t *line, int tag,
double speed, double height, int crush, int change, bool hexencrush, bool hereticlower); double speed, double height, int crush, int change, bool hexencrush, bool hereticlower);
friend bool EV_DoDonut (int tag, line_t *line, double pillarspeed, double slimespeed); friend bool EV_DoDonut (FLevelLocals *Level, int tag, line_t *line, double pillarspeed, double slimespeed);
private: private:
DFloor (); DFloor ();
}; };
@ -561,15 +561,15 @@ private:
bool P_CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t *line, bool P_CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t *line,
double speed, double height, int crush, int change, bool hexencrush, bool hereticlower); double speed, double height, int crush, int change, bool hexencrush, bool hereticlower);
bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, bool EV_BuildStairs (FLevelLocals *Level, int tag, DFloor::EStair type, line_t *line,
double stairsize, double speed, int delay, int reset, int igntxt, double stairsize, double speed, int delay, int reset, int igntxt,
int usespecials); int usespecials);
bool EV_DoFloor(DFloor::EFloor floortype, line_t *line, int tag, bool EV_DoFloor(FLevelLocals *Level, DFloor::EFloor floortype, line_t *line, int tag,
double speed, double height, int crush, int change, bool hexencrush, bool hereticlower = false); double speed, double height, int crush, int change, bool hexencrush, bool hereticlower = false);
bool EV_FloorCrushStop (int tag, line_t *line); bool EV_FloorCrushStop (FLevelLocals *Level, int tag, line_t *line);
bool EV_StopFloor(int tag, line_t *line); bool EV_StopFloor(FLevelLocals *Level, int tag, line_t *line);
bool EV_DoDonut (int tag, line_t *line, double pillarspeed, double slimespeed); bool EV_DoDonut (FLevelLocals *Level, int tag, line_t *line, double pillarspeed, double slimespeed);
class DElevator : public DMover class DElevator : public DMover
{ {
@ -603,12 +603,12 @@ protected:
void StartFloorSound (); void StartFloorSound ();
friend bool EV_DoElevator (line_t *line, DElevator::EElevator type, double speed, double height, int tag); friend bool EV_DoElevator (FLevelLocals *Level, line_t *line, DElevator::EElevator type, double speed, double height, int tag);
private: private:
DElevator (); DElevator ();
}; };
bool EV_DoElevator (line_t *line, DElevator::EElevator type, double speed, double height, int tag); bool EV_DoElevator (FLevelLocals *Level, line_t *line, DElevator::EElevator type, double speed, double height, int tag);
class DWaggleBase : public DMover class DWaggleBase : public DMover
{ {
@ -629,15 +629,13 @@ protected:
int m_Ticker; int m_Ticker;
int m_State; int m_State;
friend bool EV_StartWaggle (int tag, line_t *line, int height, int speed, friend bool EV_StartWaggle (FLevelLocals *Level, int tag, line_t *line, int height, int speed, int offset, int timer, bool ceiling);
int offset, int timer, bool ceiling);
void DoWaggle (bool ceiling); void DoWaggle (bool ceiling);
DWaggleBase (); DWaggleBase ();
}; };
bool EV_StartWaggle (int tag, line_t *line, int height, int speed, bool EV_StartWaggle (FLevelLocals *Level, int tag, line_t *line, int height, int speed, int offset, int timer, bool ceiling);
int offset, int timer, bool ceiling);
class DFloorWaggle : public DWaggleBase class DFloorWaggle : public DWaggleBase
{ {
@ -666,7 +664,7 @@ enum EChange
numChangeOnly, numChangeOnly,
}; };
bool EV_DoChange (line_t *line, EChange changetype, int tag); bool EV_DoChange (FLevelLocals *Level, line_t *line, EChange changetype, int tag);

View file

@ -779,7 +779,7 @@ bool FTraceInfo::TraceTraverse (int ptflags)
// Do a 3D floor check in the starting sector // Do a 3D floor check in the starting sector
Setup3DFloors(); Setup3DFloors();
FPathTraverse it(Start.X, Start.Y, Vec.X * MaxDist, Vec.Y * MaxDist, ptflags | PT_DELTA, startfrac); FPathTraverse it(CurSector->Level, Start.X, Start.Y, Vec.X * MaxDist, Vec.Y * MaxDist, ptflags | PT_DELTA, startfrac);
intercept_t *in; intercept_t *in;
int lastsplashsector = -1; int lastsplashsector = -1;
@ -1022,7 +1022,7 @@ DEFINE_ACTION_FUNCTION(DLineTracer, Trace)
PARAM_FLOAT(start_x); PARAM_FLOAT(start_x);
PARAM_FLOAT(start_y); PARAM_FLOAT(start_y);
PARAM_FLOAT(start_z); PARAM_FLOAT(start_z);
PARAM_POINTER(sector, sector_t); PARAM_POINTER_NOT_NULL(sector, sector_t);
PARAM_FLOAT(direction_x); PARAM_FLOAT(direction_x);
PARAM_FLOAT(direction_y); PARAM_FLOAT(direction_y);
PARAM_FLOAT(direction_z); PARAM_FLOAT(direction_z);

View file

@ -1279,7 +1279,7 @@ void FPolyObj::LinkPolyobj ()
void FPolyObj::RecalcActorFloorCeil(FBoundingBox bounds) const void FPolyObj::RecalcActorFloorCeil(FBoundingBox bounds) const
{ {
FBlockThingsIterator it(bounds); FBlockThingsIterator it(GetLevel(), bounds);
AActor *actor; AActor *actor;
while ((actor = it.Next()) != nullptr) while ((actor = it.Next()) != nullptr)

View file

@ -637,7 +637,7 @@ PolyWallTextureCoordsU::PolyWallTextureCoordsU(FSoftwareTexture *tex, const seg_
PolyWallTextureCoordsV::PolyWallTextureCoordsV(FSoftwareTexture *tex, const line_t *line, const side_t *side, side_t::ETexpart wallpart, double topz, double bottomz, double unpeggedceil, double topTexZ, double bottomTexZ) PolyWallTextureCoordsV::PolyWallTextureCoordsV(FSoftwareTexture *tex, const line_t *line, const side_t *side, side_t::ETexpart wallpart, double topz, double bottomz, double unpeggedceil, double topTexZ, double bottomTexZ)
{ {
double yoffset = side->GetTextureYOffset(wallpart); double yoffset = side->GetTextureYOffset(wallpart);
if (tex->useWorldPanning()) if (tex->useWorldPanning(line->GetLevel()))
yoffset *= side->GetTextureYScale(wallpart) * tex->GetScale().Y; yoffset *= side->GetTextureYScale(wallpart) * tex->GetScale().Y;
switch (wallpart) switch (wallpart)

View file

@ -744,7 +744,7 @@ DVector2 P_GetOffsetPosition(FLevelLocals *Level, double x, double y, double dx,
bool repeat; bool repeat;
do do
{ {
FLinePortalTraverse it; FLinePortalTraverse it(Level);
it.init(actx, acty, dx, dy, PT_ADDLINES|PT_DELTA); it.init(actx, acty, dx, dy, PT_ADDLINES|PT_DELTA);
intercept_t *in; intercept_t *in;
@ -1261,7 +1261,7 @@ bool P_CollectConnectedGroups(FLevelLocals *Level, int startgroup, const DVector
{ {
DVector2 disp = Level->Displacements.getOffset(startgroup, thisgroup & ~FPortalGroupArray::FLAT); DVector2 disp = Level->Displacements.getOffset(startgroup, thisgroup & ~FPortalGroupArray::FLAT);
FBoundingBox box(position.X + disp.X, position.Y + disp.Y, checkradius); FBoundingBox box(position.X + disp.X, position.Y + disp.Y, checkradius);
FBlockLinesIterator it(box); FBlockLinesIterator it(Level, box);
line_t *ld; line_t *ld;
while ((ld = it.Next())) while ((ld = it.Next()))
{ {

View file

@ -444,7 +444,7 @@ namespace swrenderer
double yscale = (pic ? pic->GetScale().Y : 1.0) * sidedef->GetTextureYScale(side_t::mid); double yscale = (pic ? pic->GetScale().Y : 1.0) * sidedef->GetTextureYScale(side_t::mid);
fixed_t xoffset = FLOAT2FIXED(sidedef->GetTextureXOffset(side_t::mid)); fixed_t xoffset = FLOAT2FIXED(sidedef->GetTextureXOffset(side_t::mid));
if (pic && pic->useWorldPanning()) if (pic && pic->useWorldPanning(sidedef->sector->Level))
{ {
xoffset = xs_RoundToInt(xoffset * lwallscale); xoffset = xs_RoundToInt(xoffset * lwallscale);
} }
@ -822,7 +822,7 @@ namespace swrenderer
mTopPart.TextureMid = (mBackSector->GetPlaneTexZ(sector_t::ceiling) - Thread->Viewport->viewpoint.Pos.Z) * yrepeat; mTopPart.TextureMid = (mBackSector->GetPlaneTexZ(sector_t::ceiling) - Thread->Viewport->viewpoint.Pos.Z) * yrepeat;
} }
} }
if (mTopPart.Texture->useWorldPanning()) if (mTopPart.Texture->useWorldPanning(mLineSegment->frontsector->Level))
{ {
mTopPart.TextureMid += rowoffset * yrepeat; mTopPart.TextureMid += rowoffset * yrepeat;
} }
@ -880,7 +880,7 @@ namespace swrenderer
mMiddlePart.TextureMid = (mFrontSector->GetPlaneTexZ(sector_t::ceiling) - Thread->Viewport->viewpoint.Pos.Z) * yrepeat + mMiddlePart.Texture->GetHeight(); mMiddlePart.TextureMid = (mFrontSector->GetPlaneTexZ(sector_t::ceiling) - Thread->Viewport->viewpoint.Pos.Z) * yrepeat + mMiddlePart.Texture->GetHeight();
} }
} }
if (mMiddlePart.Texture->useWorldPanning()) if (mMiddlePart.Texture->useWorldPanning(mLineSegment->frontsector->Level))
{ {
mMiddlePart.TextureMid += rowoffset * yrepeat; mMiddlePart.TextureMid += rowoffset * yrepeat;
} }
@ -947,7 +947,7 @@ namespace swrenderer
mBottomPart.TextureMid = (mBackSector->GetPlaneTexZ(sector_t::floor) - Thread->Viewport->viewpoint.Pos.Z) * yrepeat + mBottomPart.Texture->GetHeight(); mBottomPart.TextureMid = (mBackSector->GetPlaneTexZ(sector_t::floor) - Thread->Viewport->viewpoint.Pos.Z) * yrepeat + mBottomPart.Texture->GetHeight();
} }
} }
if (mBottomPart.Texture->useWorldPanning()) if (mBottomPart.Texture->useWorldPanning(mLineSegment->frontsector->Level))
{ {
mBottomPart.TextureMid += rowoffset * yrepeat; mBottomPart.TextureMid += rowoffset * yrepeat;
} }
@ -1122,7 +1122,7 @@ namespace swrenderer
lwallscale = xscale; lwallscale = xscale;
} }
fixed_t offset; fixed_t offset;
if (mTopPart.Texture->useWorldPanning()) if (mTopPart.Texture->useWorldPanning(mLineSegment->frontsector->Level))
{ {
offset = xs_RoundToInt(mTopPart.TextureOffsetU * xscale); offset = xs_RoundToInt(mTopPart.TextureOffsetU * xscale);
} }
@ -1153,7 +1153,7 @@ namespace swrenderer
lwallscale = xscale; lwallscale = xscale;
} }
fixed_t offset; fixed_t offset;
if (mMiddlePart.Texture->useWorldPanning()) if (mMiddlePart.Texture->useWorldPanning(mLineSegment->frontsector->Level))
{ {
offset = xs_RoundToInt(mMiddlePart.TextureOffsetU * xscale); offset = xs_RoundToInt(mMiddlePart.TextureOffsetU * xscale);
} }
@ -1185,7 +1185,7 @@ namespace swrenderer
lwallscale = xscale; lwallscale = xscale;
} }
fixed_t offset; fixed_t offset;
if (mBottomPart.Texture->useWorldPanning()) if (mBottomPart.Texture->useWorldPanning(mLineSegment->frontsector->Level))
{ {
offset = xs_RoundToInt(mBottomPart.TextureOffsetU * xscale); offset = xs_RoundToInt(mBottomPart.TextureOffsetU * xscale);
} }

View file

@ -197,7 +197,7 @@ namespace swrenderer
MaskedScaleY = -MaskedScaleY; MaskedScaleY = -MaskedScaleY;
sprflipvert = true; sprflipvert = true;
} }
if (tex->useWorldPanning()) if (tex->useWorldPanning(curline->frontsector->Level))
{ {
// rowoffset is added before the multiply so that the masked texture will // rowoffset is added before the multiply so that the masked texture will
// still be positioned in world units rather than texels. // still be positioned in world units rather than texels.
@ -332,7 +332,7 @@ namespace swrenderer
} }
else else
{ // Texture does wrap vertically. { // Texture does wrap vertically.
if (tex->useWorldPanning()) if (tex->useWorldPanning(curline->frontsector->Level))
{ {
// rowoffset is added before the multiply so that the masked texture will // rowoffset is added before the multiply so that the masked texture will
// still be positioned in world units rather than texels. // still be positioned in world units rather than texels.
@ -447,7 +447,7 @@ namespace swrenderer
rowoffset += rw_pic->GetHeight(); rowoffset += rw_pic->GetHeight();
} }
double texturemid = (planez - Thread->Viewport->viewpoint.Pos.Z) * yscale; double texturemid = (planez - Thread->Viewport->viewpoint.Pos.Z) * yscale;
if (rw_pic->useWorldPanning()) if (rw_pic->useWorldPanning(curline->frontsector->Level))
{ {
// rowoffset is added before the multiply so that the masked texture will // rowoffset is added before the multiply so that the masked texture will
// still be positioned in world units rather than texels. // still be positioned in world units rather than texels.

View file

@ -45,9 +45,9 @@ public:
} }
// The feature from hell... :( // The feature from hell... :(
bool useWorldPanning() const bool useWorldPanning(FLevelLocals *Level) const
{ {
return mTexture->bWorldPanning || (level.flags3 & LEVEL3_FORCEWORLDPANNING); return mTexture->bWorldPanning || (Level->flags3 & LEVEL3_FORCEWORLDPANNING);
} }
bool isMasked() bool isMasked()

View file

@ -707,7 +707,8 @@ struct LevelLocals native
native SpotState GetSpotState(bool create = true); native SpotState GetSpotState(bool create = true);
native void ReplaceTextures(String from, String to, int flags); native void ReplaceTextures(String from, String to, int flags);
native Actor Spawn(class<Actor> type, vector3 pos = (0,0,0), int replace = NO_REPLACE); native Actor Spawn(class<Actor> type, vector3 pos = (0,0,0), int replace = NO_REPLACE);
clearscope native HealthGroup FindHealthGroup(int id);
native clearscope bool IsPointInMap(vector3 p); native clearscope bool IsPointInMap(vector3 p);
native clearscope vector2 Vec2Diff(vector2 v1, vector2 v2); native clearscope vector2 Vec2Diff(vector2 v1, vector2 v2);

View file

@ -1,6 +1,9 @@
struct HealthGroup native play struct HealthGroup native play
{ {
static clearscope native HealthGroup Find(int id); deprecated("3.8") static clearscope HealthGroup Find(int id)
{
return level.FindHealthGroup(id);
}
readonly int id; readonly int id;
readonly int health; readonly int health;