From 10feb446fab5fc362119993178c3021ef36fd51d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 26 Jan 2019 08:28:45 +0100 Subject: [PATCH] - made most of the EV_* functions part of FLevelLocals. --- src/fragglescript/t_func.cpp | 14 +- src/g_levellocals.h | 23 ++ src/p_acs.cpp | 4 +- src/p_ceiling.cpp | 47 ++-- src/p_doors.cpp | 20 +- src/p_enemy.cpp | 39 +-- src/p_floor.cpp | 87 +++---- src/p_lnspec.cpp | 228 +++++++++--------- src/p_pillar.cpp | 10 +- src/p_plats.cpp | 50 ++-- src/p_spec.h | 95 ++------ wadsrc/static/zscript/base.txt | 14 +- .../static/zscript/strife/thingstoblowup.txt | 2 +- 13 files changed, 282 insertions(+), 351 deletions(-) diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index 4e087519c..00162b3a4 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -1586,7 +1586,7 @@ void FParser::SF_MoveFloor(void) auto itr = Level->GetSectorTagIterator(tagnum); while ((secnum = itr.Next()) >= 0) { - P_CreateFloor(&Level->sectors[secnum], DFloor::floorMoveToValue, NULL, platspeed, destheight, crush, 0, false, false); + Level->CreateFloor(&Level->sectors[secnum], DFloor::floorMoveToValue, NULL, platspeed, destheight, crush, 0, false, false); } } } @@ -1678,7 +1678,7 @@ void FParser::SF_MoveCeiling(void) auto itr = Level->GetSectorTagIterator(tagnum); while ((secnum = itr.Next()) >= 0) { - P_CreateCeiling(&Level->sectors[secnum], DCeiling::ceilMoveToValue, NULL, tagnum, platspeed, platspeed, destheight, crush, silent | 4, 0, DCeiling::ECrushMode::crushDoom); + Level->CreateCeiling(&Level->sectors[secnum], DCeiling::ceilMoveToValue, NULL, tagnum, platspeed, platspeed, destheight, crush, silent | 4, 0, DCeiling::ECrushMode::crushDoom); } } } @@ -2015,7 +2015,7 @@ void FParser::SF_OpenDoor(void) if(t_argc > 2) speed = intvalue(t_argv[2]); 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); + Level->EV_DoDoor(wait_time ? DDoor::doorRaise : DDoor::doorOpen, NULL, NULL, sectag, 2. * clamp(speed, 1, 127), wait_time, 0, 0); } } @@ -2040,7 +2040,7 @@ void FParser::SF_CloseDoor(void) if(t_argc > 1) speed = intvalue(t_argv[1]); else speed = 1; // 1= normal speed - EV_DoDoor(DDoor::doorClose, NULL, NULL, sectag, 2.*clamp(speed, 1, 127), 0, 0, 0); + Level->EV_DoDoor(DDoor::doorClose, NULL, NULL, sectag, 2.*clamp(speed, 1, 127), 0, 0, 0); } } @@ -3617,8 +3617,8 @@ void FParser::SF_ThingCount(void) // If we want to count map items we must consider actor replacement pClass = pClass->GetReplacement(); -again: - TThinkerIterator it; + again: + auto it = Level->GetThinkerIterator(); if (t_argc<2 || intvalue(t_argv[1])==0 || pClass->IsDescendantOf(NAME_Inventory)) { @@ -3759,7 +3759,7 @@ void FParser::SF_KillInSector() { if (CheckArgs(1)) { - TThinkerIterator it; + auto it = Level->GetThinkerIterator(); AActor * mo; int tag=intvalue(t_argv[0]); diff --git a/src/g_levellocals.h b/src/g_levellocals.h index 63c6be177..f8b90b858 100644 --- a/src/g_levellocals.h +++ b/src/g_levellocals.h @@ -45,6 +45,7 @@ #include "po_man.h" #include "p_acs.h" #include "p_tags.h" +#include "p_spec.h" #include "actor.h" #include "p_destructible.h" #include "r_data/r_sections.h" @@ -192,6 +193,28 @@ public: DVector2 GetPortalOffsetPosition(double x, double y, double dx, double dy); bool CollectConnectedGroups(int startgroup, const DVector3 &position, double upperz, double checkradius, FPortalGroupArray &out); + void ActivateInStasisPlat(int tag); + bool 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); + void ActivateInStasisCeiling(int tag); + bool CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t *line, double speed, double height, int crush, int change, bool hexencrush, bool hereticlower); + + bool EV_DoPlat(int tag, line_t *line, DPlat::EPlatType type, double height, double speed, int delay, int lip, int change); + void EV_StopPlat(int tag, bool remove); + bool EV_DoPillar(DPillar::EPillar type, line_t *line, int tag, double speed, double height, double height2, int crush, bool hexencrush); + bool EV_DoDoor(DDoor::EVlDoor type, line_t *line, AActor *thing, int tag, double speed, int delay, int lock, int lightTag, bool boomgen = false, int topcountdown = 0); + bool EV_SlidingDoor(line_t *line, AActor *thing, int tag, int speed, int delay, DAnimatedDoor::EADType type); + 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_CeilingCrushStop(int tag, bool remove); + bool EV_StopCeiling(int tag, line_t *line); + bool EV_BuildStairs(int tag, DFloor::EStair type, line_t *line, double stairsize, double speed, int delay, int reset, int igntxt, int usespecials); + bool EV_DoFloor(DFloor::EFloor floortype, line_t *line, int tag, double speed, double height, int crush, int change, bool hexencrush, bool hereticlower = false); + bool EV_FloorCrushStop(int tag, line_t *line); + bool EV_StopFloor(int tag, line_t *line); + bool EV_DoDonut(int tag, line_t *line, double pillarspeed, double slimespeed); + bool EV_DoElevator(line_t *line, DElevator::EElevator type, double speed, double height, int tag); + bool EV_StartWaggle(int tag, line_t *line, int height, int speed, int offset, int timer, bool ceiling); + bool EV_DoChange(line_t *line, EChange changetype, int tag); + private: // Work data for CollectConnectedGroups. FPortalBits processMask; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 0063059fd..0cdaad45b 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -3626,7 +3626,7 @@ do_count: } else { - TThinkerIterator iterator; + auto iterator = Level->GetThinkerIterator(); while ( (actor = iterator.Next ()) ) { if (actor->health > 0 && @@ -9340,7 +9340,7 @@ scriptwait: case PCD_CANCELFADE: { - TThinkerIterator iterator; + auto iterator = Level->GetThinkerIterator(); DFlashFader *fader; while ( (fader = iterator.Next()) ) diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index 976cc45b4..99744de51 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -47,10 +47,6 @@ IMPLEMENT_CLASS(DCeiling, false, false) -DCeiling::DCeiling () -{ -} - //============================================================================ // // @@ -235,7 +231,7 @@ DCeiling::DCeiling (sector_t *sec, double speed1, double speed2, int silent) // //============================================================================ -bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int tag, +bool FLevelLocals::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) { @@ -465,9 +461,9 @@ bool P_CreateCeiling(sector_t *sec, DCeiling::ECeiling type, line_t *line, int t return ceiling != NULL; } -DEFINE_ACTION_FUNCTION(DCeiling, CreateCeiling) +DEFINE_ACTION_FUNCTION(FLevelLocals, CreateCeiling) { - PARAM_PROLOGUE; + PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals); PARAM_POINTER_NOT_NULL(sec, sector_t); PARAM_INT(type); PARAM_POINTER(ln, line_t); @@ -478,7 +474,7 @@ DEFINE_ACTION_FUNCTION(DCeiling, CreateCeiling) PARAM_INT(silent); PARAM_INT(change); PARAM_INT(crushmode); - ACTION_RETURN_BOOL(P_CreateCeiling(sec, (DCeiling::ECeiling)type, ln, 0, speed, speed2, height, crush, silent, change, (DCeiling::ECrushMode)crushmode)); + ACTION_RETURN_BOOL(self->CreateCeiling(sec, (DCeiling::ECeiling)type, ln, 0, speed, speed2, height, crush, silent, change, (DCeiling::ECrushMode)crushmode)); } //============================================================================ @@ -490,7 +486,7 @@ DEFINE_ACTION_FUNCTION(DCeiling, CreateCeiling) // //============================================================================ -bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line, +bool FLevelLocals::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) { @@ -508,22 +504,22 @@ bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line, secnum = sec->sectornum; // [RH] Hack to let manual crushers be retriggerable, too tag ^= secnum | 0x1000000; - P_ActivateInStasisCeiling (tag); - return P_CreateCeiling(sec, type, line, tag, speed, speed2, height, crush, silent, change, hexencrush); + ActivateInStasisCeiling (tag); + return CreateCeiling(sec, type, line, tag, speed, speed2, height, crush, silent, change, hexencrush); } // Reactivate in-stasis ceilings...for certain types. // This restarts a crusher after it has been stopped if (type == DCeiling::ceilCrushAndRaise) { - P_ActivateInStasisCeiling (tag); + ActivateInStasisCeiling (tag); } // affects all sectors with the same tag as the linedef - auto it = level.GetSectorTagIterator(tag); + auto it = GetSectorTagIterator(tag); while ((secnum = it.Next()) >= 0) { - rtn |= P_CreateCeiling(&level.sectors[secnum], type, line, tag, speed, speed2, height, crush, silent, change, hexencrush); + rtn |= CreateCeiling(§ors[secnum], type, line, tag, speed, speed2, height, crush, silent, change, hexencrush); } return rtn; } @@ -536,10 +532,10 @@ bool EV_DoCeiling (DCeiling::ECeiling type, line_t *line, // //============================================================================ -void P_ActivateInStasisCeiling (int tag) +void FLevelLocals::ActivateInStasisCeiling (int tag) { DCeiling *scan; - TThinkerIterator iterator; + auto iterator = GetThinkerIterator(); while ( (scan = iterator.Next ()) ) { @@ -559,13 +555,12 @@ void P_ActivateInStasisCeiling (int tag) // //============================================================================ -bool EV_CeilingCrushStop (int tag, bool remove) +bool FLevelLocals::EV_CeilingCrushStop (int tag, bool remove) { bool rtn = false; - DCeiling *scan; - TThinkerIterator iterator; + auto iterator = GetThinkerIterator(); - scan = iterator.Next(); + auto scan = iterator.Next(); while (scan != nullptr) { DCeiling *next = iterator.Next(); @@ -589,17 +584,17 @@ bool EV_CeilingCrushStop (int tag, bool remove) return rtn; } -bool EV_StopCeiling(int tag, line_t *line) +bool FLevelLocals::EV_StopCeiling(int tag, line_t *line) { int sec; - auto it = level.GetSectorTagIterator(tag, line); + auto it = GetSectorTagIterator(tag, line); while ((sec = it.Next()) >= 0) { - if (level.sectors[sec].ceilingdata) + if (sectors[sec].ceilingdata) { - SN_StopSequence(&level.sectors[sec], CHAN_CEILING); - level.sectors[sec].ceilingdata->Destroy(); - level.sectors[sec].ceilingdata = nullptr; + SN_StopSequence(§ors[sec], CHAN_CEILING); + sectors[sec].ceilingdata->Destroy(); + sectors[sec].ceilingdata = nullptr; } } return true; diff --git a/src/p_doors.cpp b/src/p_doors.cpp index a90b73b31..2fbdd19f3 100644 --- a/src/p_doors.cpp +++ b/src/p_doors.cpp @@ -47,10 +47,6 @@ IMPLEMENT_CLASS(DDoor, false, false) -DDoor::DDoor () -{ -} - void DDoor::Serialize(FSerializer &arc) { Super::Serialize (arc); @@ -417,7 +413,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 FLevelLocals::EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, int tag, double speed, int delay, int lock, int lightTag, bool boomgen, int topcountdown) { bool rtn = false; @@ -490,10 +486,10 @@ bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, else { // [RH] Remote door - auto it = level.GetSectorTagIterator(tag); + auto it = GetSectorTagIterator(tag); while ((secnum = it.Next()) >= 0) { - sec = &level.sectors[secnum]; + sec = §ors[secnum]; // if the ceiling is already moving, don't start the door action if (sec->PlaneMoving(sector_t::ceiling)) continue; @@ -514,10 +510,6 @@ bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, IMPLEMENT_CLASS(DAnimatedDoor, false, false) -DAnimatedDoor::DAnimatedDoor () -{ -} - DAnimatedDoor::DAnimatedDoor (sector_t *sec) : DMovingCeiling (sec, false) { @@ -748,7 +740,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 FLevelLocals::EV_SlidingDoor (line_t *line, AActor *actor, int tag, int speed, int delay, DAnimatedDoor::EADType type) { sector_t *sec; int secnum; @@ -787,10 +779,10 @@ bool EV_SlidingDoor (line_t *line, AActor *actor, int tag, int speed, int delay, return false; } - auto it = level.GetSectorTagIterator(tag); + auto it = GetSectorTagIterator(tag); while ((secnum = it.Next()) >= 0) { - sec = &level.sectors[secnum]; + sec = §ors[secnum]; if (sec->ceilingdata != NULL) { continue; diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 8550eb7b6..773313323 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -3074,9 +3074,10 @@ void A_BossDeath(AActor *self) // Do generic special death actions first bool checked = false; - for (unsigned i = 0; i < level.info->specialactions.Size(); i++) + auto Level = &level; + for (unsigned i = 0; i < Level->info->specialactions.Size(); i++) { - FSpecialAction *sa = &level.info->specialactions[i]; + FSpecialAction *sa = &Level->info->specialactions[i]; if (type == sa->Type || mytype == sa->Type) { @@ -3094,7 +3095,7 @@ void A_BossDeath(AActor *self) // [RH] These all depend on the presence of level flags now // rather than being hard-coded to specific levels/episodes. - if ((level.flags & (LEVEL_MAP07SPECIAL| + if ((Level->flags & (LEVEL_MAP07SPECIAL| LEVEL_BRUISERSPECIAL| LEVEL_CYBORGSPECIAL| LEVEL_SPIDERSPECIAL| @@ -3104,13 +3105,13 @@ void A_BossDeath(AActor *self) return; if ((i_compatflags & COMPATF_ANYBOSSDEATH) || ( // [GZ] Added for UAC_DEAD - ((level.flags & LEVEL_MAP07SPECIAL) && (type == NAME_Fatso || type == NAME_Arachnotron)) || - ((level.flags & LEVEL_BRUISERSPECIAL) && (type == NAME_BaronOfHell)) || - ((level.flags & LEVEL_CYBORGSPECIAL) && (type == NAME_Cyberdemon)) || - ((level.flags & LEVEL_SPIDERSPECIAL) && (type == NAME_SpiderMastermind)) || - ((level.flags & LEVEL_HEADSPECIAL) && (type == NAME_Ironlich)) || - ((level.flags & LEVEL_MINOTAURSPECIAL) && (type == NAME_Minotaur)) || - ((level.flags & LEVEL_SORCERER2SPECIAL) && (type == NAME_Sorcerer2)) + ((Level->flags & LEVEL_MAP07SPECIAL) && (type == NAME_Fatso || type == NAME_Arachnotron)) || + ((Level->flags & LEVEL_BRUISERSPECIAL) && (type == NAME_BaronOfHell)) || + ((Level->flags & LEVEL_CYBORGSPECIAL) && (type == NAME_Cyberdemon)) || + ((Level->flags & LEVEL_SPIDERSPECIAL) && (type == NAME_SpiderMastermind)) || + ((Level->flags & LEVEL_HEADSPECIAL) && (type == NAME_Ironlich)) || + ((Level->flags & LEVEL_MINOTAURSPECIAL) && (type == NAME_Minotaur)) || + ((Level->flags & LEVEL_SORCERER2SPECIAL) && (type == NAME_Sorcerer2)) )) ; else @@ -3122,43 +3123,43 @@ void A_BossDeath(AActor *self) } // victory! - if (level.flags & LEVEL_SPECKILLMONSTERS) + if (Level->flags & LEVEL_SPECKILLMONSTERS) { // Kill any remaining monsters P_Massacre (); } - if (level.flags & LEVEL_MAP07SPECIAL) + if (Level->flags & LEVEL_MAP07SPECIAL) { if (type == NAME_Fatso) { - EV_DoFloor (DFloor::floorLowerToLowest, NULL, 666, 1., 0, -1, 0, false); + Level->EV_DoFloor (DFloor::floorLowerToLowest, NULL, 666, 1., 0, -1, 0, false); return; } if (type == NAME_Arachnotron) { - EV_DoFloor (DFloor::floorRaiseByTexture, NULL, 667, 1., 0, -1, 0, false); + Level->EV_DoFloor (DFloor::floorRaiseByTexture, NULL, 667, 1., 0, -1, 0, false); return; } } else { - switch (level.flags & LEVEL_SPECACTIONSMASK) + switch (Level->flags & LEVEL_SPECACTIONSMASK) { case LEVEL_SPECLOWERFLOOR: - EV_DoFloor (DFloor::floorLowerToLowest, NULL, 666, 1., 0, -1, 0, false); + Level->EV_DoFloor (DFloor::floorLowerToLowest, NULL, 666, 1., 0, -1, 0, false); return; case LEVEL_SPECLOWERFLOORTOHIGHEST: - EV_DoFloor (DFloor::floorLowerToHighest, NULL, 666, 1., 0, -1, 0, false); + Level->EV_DoFloor (DFloor::floorLowerToHighest, NULL, 666, 1., 0, -1, 0, false); return; case LEVEL_SPECOPENDOOR: - EV_DoDoor (DDoor::doorOpen, NULL, NULL, 666, 8., 0, 0, 0); + Level->EV_DoDoor (DDoor::doorOpen, NULL, NULL, 666, 8., 0, 0, 0); return; } } - // [RH] If noexit, then don't end the level. + // [RH] If noexit, then don't end the Level-> if ((deathmatch || alwaysapplydmflags) && (dmflags & DF_NO_EXIT)) return; diff --git a/src/p_floor.cpp b/src/p_floor.cpp index cfcfbe4d5..c818670d3 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -73,10 +73,6 @@ static void StartFloorSound (sector_t *sec) IMPLEMENT_CLASS(DFloor, false, false) -DFloor::DFloor () -{ -} - void DFloor::Serialize(FSerializer &arc) { Super::Serialize (arc); @@ -270,7 +266,7 @@ DFloor::DFloor (sector_t *sec) // //========================================================================== -bool P_CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t *line, +bool FLevelLocals::CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t *line, double speed, double height, int crush, int change, bool hexencrush, bool hereticlower) { bool rtn; @@ -502,9 +498,9 @@ bool P_CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t *line, return true; } -DEFINE_ACTION_FUNCTION(DFloor, CreateFloor) +DEFINE_ACTION_FUNCTION(FLevelLocals, CreateFloor) { - PARAM_PROLOGUE; + PARAM_SELF_STRUCT_PROLOGUE(FLevelLocals); PARAM_POINTER_NOT_NULL(sec, sector_t); PARAM_INT(floortype); PARAM_POINTER(ln, line_t); @@ -514,7 +510,7 @@ DEFINE_ACTION_FUNCTION(DFloor, CreateFloor) PARAM_INT(change); PARAM_BOOL(hereticlower); PARAM_BOOL(hexencrush); - ACTION_RETURN_BOOL(P_CreateFloor(sec, (DFloor::EFloor)floortype, ln, speed, height, crush, change, hexencrush, hereticlower)); + ACTION_RETURN_BOOL(self->CreateFloor(sec, (DFloor::EFloor)floortype, ln, speed, height, crush, change, hexencrush, hereticlower)); } //========================================================================== @@ -525,17 +521,17 @@ DEFINE_ACTION_FUNCTION(DFloor, CreateFloor) // //========================================================================== -bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, +bool FLevelLocals::EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, double speed, double height, int crush, int change, bool hexencrush, bool hereticlower) { int secnum; bool rtn = false; // check if a manual trigger; if so do just the sector on the backside - auto it = level.GetSectorTagIterator(tag, line); + auto it = GetSectorTagIterator(tag, line); while ((secnum = it.Next()) >= 0) { - rtn |= P_CreateFloor(&level.sectors[secnum], floortype, line, speed, height, crush, change, hexencrush, hereticlower); + rtn |= CreateFloor(§ors[secnum], floortype, line, speed, height, crush, change, hexencrush, hereticlower); } return rtn; } @@ -548,13 +544,13 @@ bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, // //========================================================================== -bool EV_FloorCrushStop (int tag, line_t *line) +bool FLevelLocals::EV_FloorCrushStop (int tag, line_t *line) { int secnum; - auto it = level.GetSectorTagIterator(tag, line); + auto it = GetSectorTagIterator(tag, line); while ((secnum = it.Next()) >= 0) { - sector_t *sec = &level.sectors[secnum]; + sector_t *sec = §ors[secnum]; if (sec->floordata && sec->floordata->IsKindOf (RUNTIME_CLASS(DFloor)) && barrier_cast(sec->floordata)->m_Type == DFloor::floorRaiseAndCrush) @@ -568,17 +564,17 @@ bool EV_FloorCrushStop (int tag, line_t *line) } // same as above but stops any floor mover that was active on the given sector. -bool EV_StopFloor(int tag, line_t *line) +bool FLevelLocals::EV_StopFloor(int tag, line_t *line) { int sec; - auto it = level.GetSectorTagIterator(tag, line); + auto it = GetSectorTagIterator(tag, line); while ((sec = it.Next()) >= 0) { - if (level.sectors[sec].floordata) + if (sectors[sec].floordata) { - SN_StopSequence(&level.sectors[sec], CHAN_FLOOR); - level.sectors[sec].floordata->Destroy(); - level.sectors[sec].floordata = nullptr; + SN_StopSequence(§ors[sec], CHAN_FLOOR); + sectors[sec].floordata->Destroy(); + sectors[sec].floordata = nullptr; } } return true; @@ -593,9 +589,7 @@ bool EV_StopFloor(int tag, line_t *line) // //========================================================================== -bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, - double stairsize, double speed, int delay, int reset, int igntxt, - int usespecials) +bool FLevelLocals::EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, double stairsize, double speed, int delay, int reset, int igntxt, int usespecials) { int secnum = -1; int osecnum; //jff 3/4/98 save old loop index @@ -619,13 +613,13 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, persteptime = int(stairsize / speed); // check if a manual trigger, if so do just the sector on the backside - auto itr = level.GetSectorTagIterator(tag, line); + auto itr = GetSectorTagIterator(tag, line); // The compatibility mode doesn't work with a hashing algorithm. // It needs the original linear search method. This was broken in Boom. bool compatible = tag != 0 && (i_compatflags & COMPATF_STAIRINDEX); while ((secnum = itr.NextCompat(compatible, secnum)) >= 0) { - sec = &level.sectors[secnum]; + sec = §ors[secnum]; // ALREADY MOVING? IF SO, KEEP GOING... //jff 2/26/98 add special lockout condition to wait for entire @@ -770,7 +764,7 @@ bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, } while (ok); // [RH] make sure the first sector doesn't point to a previous one, otherwise // it can infinite loop when the first sector stops moving. - level.sectors[osecnum].prevsec = -1; + sectors[osecnum].prevsec = -1; } return rtn; } @@ -781,7 +775,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 FLevelLocals::EV_DoDonut (int tag, line_t *line, double pillarspeed, double slimespeed) { sector_t* s1; sector_t* s2; @@ -794,10 +788,10 @@ bool EV_DoDonut (int tag, line_t *line, double pillarspeed, double slimespeed) rtn = false; - auto itr = level.GetSectorTagIterator(tag, line); + auto itr = GetSectorTagIterator(tag, line); while ((secnum = itr.Next()) >= 0) { - s1 = &level.sectors[secnum]; // s1 is pillar's sector + s1 = §ors[secnum]; // s1 is pillar's sector // ALREADY MOVING? IF SO, KEEP GOING... if (s1->PlaneMoving(sector_t::floor)) @@ -864,10 +858,6 @@ IMPLEMENT_POINTERS_START(DElevator) IMPLEMENT_POINTER(m_Interp_Ceiling) IMPLEMENT_POINTERS_END -DElevator::DElevator () -{ -} - DElevator::DElevator (sector_t *sec) : Super (sec) { @@ -994,7 +984,7 @@ void DElevator::StartFloorSound () // //========================================================================== -bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype, +bool FLevelLocals::EV_DoElevator (line_t *line, DElevator::EElevator elevtype, double speed, double height, int tag) { int secnum; @@ -1011,12 +1001,12 @@ bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype, secnum = -1; rtn = false; - auto itr = level.GetSectorTagIterator(tag, line); + auto itr = GetSectorTagIterator(tag, line); // act on all sectors with the same tag as the triggering linedef while ((secnum = itr.Next()) >= 0) { - sec = &level.sectors[secnum]; + sec = §ors[secnum]; // If either floor or ceiling is already activated, skip it 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] @@ -1097,7 +1087,7 @@ bool EV_DoElevator (line_t *line, DElevator::EElevator elevtype, // //========================================================================== -bool EV_DoChange (line_t *line, EChange changetype, int tag) +bool FLevelLocals::EV_DoChange (line_t *line, EChange changetype, int tag) { int secnum; bool rtn; @@ -1106,10 +1096,10 @@ bool EV_DoChange (line_t *line, EChange changetype, int tag) rtn = false; // change all sectors with the same tag as the linedef - auto it = level.GetSectorTagIterator(tag); + auto it = GetSectorTagIterator(tag); while ((secnum = it.Next()) >= 0) { - sec = &level.sectors[secnum]; + sec = §ors[secnum]; rtn = true; @@ -1151,10 +1141,6 @@ IMPLEMENT_CLASS(DWaggleBase, false, false) IMPLEMENT_CLASS(DFloorWaggle, false, false) IMPLEMENT_CLASS(DCeilingWaggle, false, false) -DWaggleBase::DWaggleBase () -{ -} - void DWaggleBase::Serialize(FSerializer &arc) { Super::Serialize (arc); @@ -1266,10 +1252,6 @@ void DWaggleBase::DoWaggle (bool ceiling) // //========================================================================== -DFloorWaggle::DFloorWaggle () -{ -} - DFloorWaggle::DFloorWaggle (sector_t *sec) : Super (sec) { @@ -1288,10 +1270,6 @@ void DFloorWaggle::Tick () // //========================================================================== -DCeilingWaggle::DCeilingWaggle () -{ -} - DCeilingWaggle::DCeilingWaggle (sector_t *sec) : Super (sec) { @@ -1310,8 +1288,7 @@ void DCeilingWaggle::Tick () // //========================================================================== -bool EV_StartWaggle (int tag, line_t *line, int height, int speed, int offset, - int timer, bool ceiling) +bool FLevelLocals::EV_StartWaggle (int tag, line_t *line, int height, int speed, int offset, int timer, bool ceiling) { int sectorIndex; sector_t *sector; @@ -1320,11 +1297,11 @@ bool EV_StartWaggle (int tag, line_t *line, int height, int speed, int offset, retCode = false; - auto itr = level.GetSectorTagIterator(tag, line); + auto itr = GetSectorTagIterator(tag, line); while ((sectorIndex = itr.Next()) >= 0) { - sector = &level.sectors[sectorIndex]; + sector = §ors[sectorIndex]; if ((!ceiling && sector->PlaneMoving(sector_t::floor)) || (ceiling && sector->PlaneMoving(sector_t::ceiling))) { // Already busy with another thinker diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index e67ed311c..9d184d54f 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -237,19 +237,19 @@ FUNC(LS_Polyobj_Stop) FUNC(LS_Door_Close) // Door_Close (tag, speed, lighttag) { - return EV_DoDoor (DDoor::doorClose, ln, it, arg0, SPEED(arg1), 0, 0, arg2); + return Level->EV_DoDoor (DDoor::doorClose, ln, it, arg0, SPEED(arg1), 0, 0, arg2); } FUNC(LS_Door_Open) // Door_Open (tag, speed, lighttag) { - return EV_DoDoor (DDoor::doorOpen, ln, it, arg0, SPEED(arg1), 0, 0, arg2); + return Level->EV_DoDoor (DDoor::doorOpen, ln, it, arg0, SPEED(arg1), 0, 0, arg2); } FUNC(LS_Door_Raise) // Door_Raise (tag, speed, delay, lighttag) { - return EV_DoDoor (DDoor::doorRaise, ln, it, arg0, SPEED(arg1), TICS(arg2), 0, arg3); + return Level->EV_DoDoor (DDoor::doorRaise, ln, it, arg0, SPEED(arg1), TICS(arg2), 0, arg3); } FUNC(LS_Door_LockedRaise) @@ -258,9 +258,9 @@ FUNC(LS_Door_LockedRaise) #if 0 // 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. - return EV_DoDoor (arg2 || (Level->flags2 & LEVEL2_HEXENHACK) ? DDoor::doorRaise : DDoor::doorOpen, ln, it, + return Level->EV_DoDoor (arg2 || (Level->flags2 & LEVEL2_HEXENHACK) ? DDoor::doorRaise : DDoor::doorOpen, ln, it, #else - return EV_DoDoor (arg2 ? DDoor::doorRaise : DDoor::doorOpen, ln, it, + return Level->EV_DoDoor (arg2 ? DDoor::doorRaise : DDoor::doorOpen, ln, it, #endif arg0, SPEED(arg1), TICS(arg2), arg3, arg4); } @@ -268,19 +268,19 @@ FUNC(LS_Door_LockedRaise) FUNC(LS_Door_CloseWaitOpen) // Door_CloseWaitOpen (tag, speed, delay, lighttag) { - return EV_DoDoor (DDoor::doorCloseWaitOpen, ln, it, arg0, SPEED(arg1), OCTICS(arg2), 0, arg3); + return Level->EV_DoDoor (DDoor::doorCloseWaitOpen, ln, it, arg0, SPEED(arg1), OCTICS(arg2), 0, arg3); } FUNC(LS_Door_WaitRaise) // 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 Level->EV_DoDoor(DDoor::doorWaitRaise, ln, it, arg0, SPEED(arg1), TICS(arg2), 0, arg4, false, TICS(arg3)); } FUNC(LS_Door_WaitClose) // Door_WaitRaise(tag, speed, wait, lighttag) { - return EV_DoDoor(DDoor::doorWaitClose, ln, it, arg0, SPEED(arg1), 0, 0, arg3, false, TICS(arg2)); + return Level->EV_DoDoor(DDoor::doorWaitClose, ln, it, arg0, SPEED(arg1), 0, 0, arg3, false, TICS(arg2)); } FUNC(LS_Door_Animated) @@ -289,13 +289,13 @@ FUNC(LS_Door_Animated) if (arg3 != 0 && !P_CheckKeys (it, arg3, arg0 != 0)) return false; - return EV_SlidingDoor (ln, it, arg0, arg1, arg2, DAnimatedDoor::adOpenClose); + return Level->EV_SlidingDoor (ln, it, arg0, arg1, arg2, DAnimatedDoor::adOpenClose); } FUNC(LS_Door_AnimatedClose) // Door_AnimatedClose (tag, speed) { - return EV_SlidingDoor(ln, it, arg0, arg1, -1, DAnimatedDoor::adClose); + return Level->EV_SlidingDoor(ln, it, arg0, arg1, -1, DAnimatedDoor::adClose); } FUNC(LS_Generic_Door) @@ -326,203 +326,203 @@ FUNC(LS_Generic_Door) tag = arg0; lightTag = 0; } - return EV_DoDoor (type, ln, it, tag, SPEED(arg1), OCTICS(arg3), arg4, lightTag, boomgen); + return Level->EV_DoDoor (type, ln, it, tag, SPEED(arg1), OCTICS(arg3), arg4, lightTag, boomgen); } FUNC(LS_Floor_LowerByValue) // Floor_LowerByValue (tag, speed, height, change) { - return EV_DoFloor (DFloor::floorLowerByValue, ln, arg0, SPEED(arg1), arg2, -1, CHANGE(arg3), false); + return Level->EV_DoFloor (DFloor::floorLowerByValue, ln, arg0, SPEED(arg1), arg2, -1, CHANGE(arg3), false); } FUNC(LS_Floor_LowerToLowest) // Floor_LowerToLowest (tag, speed, change) { - return EV_DoFloor (DFloor::floorLowerToLowest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false); + return Level->EV_DoFloor (DFloor::floorLowerToLowest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false); } FUNC(LS_Floor_LowerToHighest) // Floor_LowerToHighest (tag, speed, adjust, hereticlower) { - return EV_DoFloor (DFloor::floorLowerToHighest, ln, arg0, SPEED(arg1), (arg2-128), -1, 0, false, arg3==1); + return Level->EV_DoFloor (DFloor::floorLowerToHighest, ln, arg0, SPEED(arg1), (arg2-128), -1, 0, false, arg3==1); } FUNC(LS_Floor_LowerToHighestEE) // Floor_LowerToHighestEE (tag, speed, change) { - return EV_DoFloor (DFloor::floorLowerToHighest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false); + return Level->EV_DoFloor (DFloor::floorLowerToHighest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false); } FUNC(LS_Floor_LowerToNearest) // Floor_LowerToNearest (tag, speed, change) { - return EV_DoFloor (DFloor::floorLowerToNearest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false); + return Level->EV_DoFloor (DFloor::floorLowerToNearest, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), false); } FUNC(LS_Floor_RaiseByValue) // Floor_RaiseByValue (tag, speed, height, change, crush) { - return EV_DoFloor (DFloor::floorRaiseByValue, ln, arg0, SPEED(arg1), arg2, CRUSH(arg4), CHANGE(arg3), true); + return Level->EV_DoFloor (DFloor::floorRaiseByValue, ln, arg0, SPEED(arg1), arg2, CRUSH(arg4), CHANGE(arg3), true); } FUNC(LS_Floor_RaiseToHighest) // Floor_RaiseToHighest (tag, speed, change, crush) { - return EV_DoFloor (DFloor::floorRaiseToHighest, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); + return Level->EV_DoFloor (DFloor::floorRaiseToHighest, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); } FUNC(LS_Floor_RaiseToNearest) // Floor_RaiseToNearest (tag, speed, change, crush) { - return EV_DoFloor (DFloor::floorRaiseToNearest, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); + return Level->EV_DoFloor (DFloor::floorRaiseToNearest, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); } FUNC(LS_Floor_RaiseToLowest) // Floor_RaiseToLowest (tag, change, crush) { // 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 Level->EV_DoFloor (DFloor::floorRaiseToLowest, ln, arg0, 2., 0, CRUSH(arg3), CHANGE(arg2), true); } FUNC(LS_Floor_RaiseAndCrush) // Floor_RaiseAndCrush (tag, speed, crush, crushmode) { - return EV_DoFloor (DFloor::floorRaiseAndCrush, ln, arg0, SPEED(arg1), 0, arg2, 0, CRUSHTYPE(arg3)); + return Level->EV_DoFloor (DFloor::floorRaiseAndCrush, ln, arg0, SPEED(arg1), 0, arg2, 0, CRUSHTYPE(arg3)); } FUNC(LS_Floor_RaiseAndCrushDoom) // Floor_RaiseAndCrushDoom (tag, speed, crush, crushmode) { - return EV_DoFloor (DFloor::floorRaiseAndCrushDoom, ln, arg0, SPEED(arg1), 0, arg2, 0, CRUSHTYPE(arg3)); + return Level->EV_DoFloor (DFloor::floorRaiseAndCrushDoom, ln, arg0, SPEED(arg1), 0, arg2, 0, CRUSHTYPE(arg3)); } FUNC(LS_Floor_RaiseByValueTimes8) // FLoor_RaiseByValueTimes8 (tag, speed, height, change, crush) { - return EV_DoFloor (DFloor::floorRaiseByValue, ln, arg0, SPEED(arg1), arg2*8, CRUSH(arg4), CHANGE(arg3), true); + return Level->EV_DoFloor (DFloor::floorRaiseByValue, ln, arg0, SPEED(arg1), arg2*8, CRUSH(arg4), CHANGE(arg3), true); } FUNC(LS_Floor_LowerByValueTimes8) // Floor_LowerByValueTimes8 (tag, speed, height, change) { - return EV_DoFloor (DFloor::floorLowerByValue, ln, arg0, SPEED(arg1), arg2*8, -1, CHANGE(arg3), false); + return Level->EV_DoFloor (DFloor::floorLowerByValue, ln, arg0, SPEED(arg1), arg2*8, -1, CHANGE(arg3), false); } FUNC(LS_Floor_CrushStop) // Floor_CrushStop (tag) { - return EV_FloorCrushStop (arg0, ln); + return Level->EV_FloorCrushStop (arg0, ln); } FUNC(LS_Floor_LowerInstant) // Floor_LowerInstant (tag, unused, height, change) { - return EV_DoFloor (DFloor::floorLowerInstant, ln, arg0, 0., arg2*8, -1, CHANGE(arg3), false); + return Level->EV_DoFloor (DFloor::floorLowerInstant, ln, arg0, 0., arg2*8, -1, CHANGE(arg3), false); } FUNC(LS_Floor_RaiseInstant) // Floor_RaiseInstant (tag, unused, height, change, crush) { - return EV_DoFloor (DFloor::floorRaiseInstant, ln, arg0, 0., arg2*8, CRUSH(arg4), CHANGE(arg3), true); + return Level->EV_DoFloor (DFloor::floorRaiseInstant, ln, arg0, 0., arg2*8, CRUSH(arg4), CHANGE(arg3), true); } FUNC(LS_Floor_ToCeilingInstant) // Floor_ToCeilingInstant (tag, change, crush, gap) { - return EV_DoFloor (DFloor::floorLowerToCeiling, ln, arg0, 0, arg3, CRUSH(arg2), CHANGE(arg1), true); + return Level->EV_DoFloor (DFloor::floorLowerToCeiling, ln, arg0, 0, arg3, CRUSH(arg2), CHANGE(arg1), true); } FUNC(LS_Floor_MoveToValueTimes8) // Floor_MoveToValueTimes8 (tag, speed, height, negative, change) { - return EV_DoFloor (DFloor::floorMoveToValue, ln, arg0, SPEED(arg1), + return Level->EV_DoFloor (DFloor::floorMoveToValue, ln, arg0, SPEED(arg1), arg2*8*(arg3?-1:1), -1, CHANGE(arg4), false); } FUNC(LS_Floor_MoveToValue) // Floor_MoveToValue (tag, speed, height, negative, change) { - return EV_DoFloor (DFloor::floorMoveToValue, ln, arg0, SPEED(arg1), + return Level->EV_DoFloor (DFloor::floorMoveToValue, ln, arg0, SPEED(arg1), arg2*(arg3?-1:1), -1, CHANGE(arg4), false); } FUNC(LS_Floor_MoveToValueAndCrush) // Floor_MoveToValueAndCrush (tag, speed, height, crush, crushmode) { - return EV_DoFloor(DFloor::floorMoveToValue, ln, arg0, SPEED(arg1), + return Level->EV_DoFloor(DFloor::floorMoveToValue, ln, arg0, SPEED(arg1), arg2, CRUSH(arg3) -1, 0, CRUSHTYPE(arg4), false); } FUNC(LS_Floor_RaiseToLowestCeiling) // Floor_RaiseToLowestCeiling (tag, speed, change, crush) { - return EV_DoFloor (DFloor::floorRaiseToLowestCeiling, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); + return Level->EV_DoFloor (DFloor::floorRaiseToLowestCeiling, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); } FUNC(LS_Floor_LowerToLowestCeiling) // Floor_LowerToLowestCeiling (tag, speed, change) { - return EV_DoFloor (DFloor::floorLowerToLowestCeiling, ln, arg0, SPEED(arg1), arg4, -1, CHANGE(arg2), true); + return Level->EV_DoFloor (DFloor::floorLowerToLowestCeiling, ln, arg0, SPEED(arg1), arg4, -1, CHANGE(arg2), true); } FUNC(LS_Floor_RaiseByTexture) // Floor_RaiseByTexture (tag, speed, change, crush) { - return EV_DoFloor (DFloor::floorRaiseByTexture, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); + return Level->EV_DoFloor (DFloor::floorRaiseByTexture, ln, arg0, SPEED(arg1), 0, CRUSH(arg3), CHANGE(arg2), true); } FUNC(LS_Floor_LowerByTexture) // Floor_LowerByTexture (tag, speed, change, crush) { - return EV_DoFloor (DFloor::floorLowerByTexture, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), true); + return Level->EV_DoFloor (DFloor::floorLowerByTexture, ln, arg0, SPEED(arg1), 0, -1, CHANGE(arg2), true); } FUNC(LS_Floor_RaiseToCeiling) // Floor_RaiseToCeiling (tag, speed, change, crush, gap) { - return EV_DoFloor (DFloor::floorRaiseToCeiling, ln, arg0, SPEED(arg1), arg4, CRUSH(arg3), CHANGE(arg2), true); + return Level->EV_DoFloor (DFloor::floorRaiseToCeiling, ln, arg0, SPEED(arg1), arg4, CRUSH(arg3), CHANGE(arg2), true); } FUNC(LS_Floor_RaiseByValueTxTy) // Floor_RaiseByValueTxTy (tag, speed, height) { - return EV_DoFloor (DFloor::floorRaiseAndChange, ln, arg0, SPEED(arg1), arg2, -1, 0, false); + return Level->EV_DoFloor (DFloor::floorRaiseAndChange, ln, arg0, SPEED(arg1), arg2, -1, 0, false); } FUNC(LS_Floor_LowerToLowestTxTy) // Floor_LowerToLowestTxTy (tag, speed) { - return EV_DoFloor (DFloor::floorLowerAndChange, ln, arg0, SPEED(arg1), arg2, -1, 0, false); + return Level->EV_DoFloor (DFloor::floorLowerAndChange, ln, arg0, SPEED(arg1), arg2, -1, 0, false); } FUNC(LS_Floor_Waggle) // Floor_Waggle (tag, amplitude, frequency, delay, time) { - return EV_StartWaggle (arg0, ln, arg1, arg2, arg3, arg4, false); + return Level->EV_StartWaggle (arg0, ln, arg1, arg2, arg3, arg4, false); } FUNC(LS_Ceiling_Waggle) // Ceiling_Waggle (tag, amplitude, frequency, delay, time) { - return EV_StartWaggle (arg0, ln, arg1, arg2, arg3, arg4, true); + return Level->EV_StartWaggle (arg0, ln, arg1, arg2, arg3, arg4, true); } FUNC(LS_Floor_TransferTrigger) // Floor_TransferTrigger (tag) { - return EV_DoChange (ln, trigChangeOnly, arg0); + return Level->EV_DoChange (ln, trigChangeOnly, arg0); } FUNC(LS_Floor_TransferNumeric) // Floor_TransferNumeric (tag) { - return EV_DoChange (ln, numChangeOnly, arg0); + return Level->EV_DoChange (ln, numChangeOnly, arg0); } FUNC(LS_Floor_Donut) // Floor_Donut (pillartag, pillarspeed, slimespeed) { - return EV_DoDonut (arg0, ln, SPEED(arg1), SPEED(arg2)); + return Level->EV_DoDonut (arg0, ln, SPEED(arg1), SPEED(arg2)); } FUNC(LS_Generic_Floor) @@ -557,7 +557,7 @@ FUNC(LS_Generic_Floor) } } - return EV_DoFloor (type, ln, arg0, SPEED(arg1), arg2, + return Level->EV_DoFloor (type, ln, arg0, SPEED(arg1), arg2, (arg4 & 16) ? 20 : -1, arg4 & 7, false); } @@ -565,70 +565,70 @@ FUNC(LS_Generic_Floor) FUNC(LS_Floor_Stop) // Floor_Stop (tag) { - return EV_StopFloor(arg0, ln); + return Level->EV_StopFloor(arg0, ln); } FUNC(LS_Stairs_BuildDown) // Stair_BuildDown (tag, speed, height, delay, reset) { - return EV_BuildStairs (arg0, DFloor::buildDown, ln, + return Level->EV_BuildStairs (arg0, DFloor::buildDown, ln, arg2, SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairUseSpecials); } FUNC(LS_Stairs_BuildUp) // Stairs_BuildUp (tag, speed, height, delay, reset) { - return EV_BuildStairs (arg0, DFloor::buildUp, ln, + return Level->EV_BuildStairs (arg0, DFloor::buildUp, ln, arg2, SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairUseSpecials); } FUNC(LS_Stairs_BuildDownSync) // Stairs_BuildDownSync (tag, speed, height, reset) { - return EV_BuildStairs (arg0, DFloor::buildDown, ln, + return Level->EV_BuildStairs (arg0, DFloor::buildDown, ln, arg2, SPEED(arg1), 0, arg3, 0, DFloor::stairUseSpecials|DFloor::stairSync); } FUNC(LS_Stairs_BuildUpSync) // Stairs_BuildUpSync (tag, speed, height, reset) { - return EV_BuildStairs (arg0, DFloor::buildUp, ln, + return Level->EV_BuildStairs (arg0, DFloor::buildUp, ln, arg2, SPEED(arg1), 0, arg3, 0, DFloor::stairUseSpecials|DFloor::stairSync); } FUNC(LS_Stairs_BuildUpDoom) // Stairs_BuildUpDoom (tag, speed, height, delay, reset) { - return EV_BuildStairs (arg0, DFloor::buildUp, ln, + return Level->EV_BuildStairs (arg0, DFloor::buildUp, ln, arg2, SPEED(arg1), TICS(arg3), arg4, 0, 0); } FUNC(LS_Stairs_BuildUpDoomCrush) // Stairs_BuildUpDoom (tag, speed, height, delay, reset) { - return EV_BuildStairs(arg0, DFloor::buildUp, ln, + return Level->EV_BuildStairs(arg0, DFloor::buildUp, ln, arg2, SPEED(arg1), TICS(arg3), arg4, 0, DFloor::stairCrush); } FUNC(LS_Stairs_BuildDownDoom) // Stair_BuildDownDoom (tag, speed, height, delay, reset) { - return EV_BuildStairs (arg0, DFloor::buildDown, ln, + return Level->EV_BuildStairs (arg0, DFloor::buildDown, ln, arg2, SPEED(arg1), TICS(arg3), arg4, 0, 0); } FUNC(LS_Stairs_BuildDownDoomSync) // Stairs_BuildDownDoomSync (tag, speed, height, reset) { - return EV_BuildStairs (arg0, DFloor::buildDown, ln, + return Level->EV_BuildStairs (arg0, DFloor::buildDown, ln, arg2, SPEED(arg1), 0, arg3, 0, DFloor::stairSync); } FUNC(LS_Stairs_BuildUpDoomSync) // Stairs_BuildUpDoomSync (tag, speed, height, reset) { - return EV_BuildStairs (arg0, DFloor::buildUp, ln, + return Level->EV_BuildStairs (arg0, DFloor::buildUp, ln, arg2, SPEED(arg1), 0, arg3, 0, DFloor::stairSync); } @@ -637,7 +637,7 @@ FUNC(LS_Generic_Stairs) // Generic_Stairs (tag, speed, step, dir/igntxt, reset) { DFloor::EStair type = (arg3 & 1) ? DFloor::buildUp : DFloor::buildDown; - bool res = EV_BuildStairs (arg0, type, ln, + bool res = Level->EV_BuildStairs (arg0, type, ln, arg2, SPEED(arg1), 0, arg4, arg3 & 2, 0); if (res && ln && (ln->flags & ML_REPEAT_SPECIAL) && ln->special == Generic_Stairs) @@ -650,61 +650,61 @@ FUNC(LS_Generic_Stairs) FUNC(LS_Pillar_Build) // Pillar_Build (tag, speed, height) { - return EV_DoPillar (DPillar::pillarBuild, ln, arg0, SPEED(arg1), arg2, 0, -1, false); + return Level->EV_DoPillar (DPillar::pillarBuild, ln, arg0, SPEED(arg1), arg2, 0, -1, false); } FUNC(LS_Pillar_BuildAndCrush) // Pillar_BuildAndCrush (tag, speed, height, crush, crushtype) { - return EV_DoPillar (DPillar::pillarBuild, ln, arg0, SPEED(arg1), arg2, 0, arg3, CRUSHTYPE(arg4)); + return Level->EV_DoPillar (DPillar::pillarBuild, ln, arg0, SPEED(arg1), arg2, 0, arg3, CRUSHTYPE(arg4)); } FUNC(LS_Pillar_Open) // Pillar_Open (tag, speed, f_height, c_height) { - return EV_DoPillar (DPillar::pillarOpen, ln, arg0, SPEED(arg1), arg2, arg3, -1, false); + return Level->EV_DoPillar (DPillar::pillarOpen, ln, arg0, SPEED(arg1), arg2, arg3, -1, false); } FUNC(LS_Ceiling_LowerByValue) // Ceiling_LowerByValue (tag, speed, height, change, crush) { - return EV_DoCeiling (DCeiling::ceilLowerByValue, ln, arg0, SPEED(arg1), 0, arg2, CRUSH(arg4), 0, CHANGE(arg3)); + return Level->EV_DoCeiling (DCeiling::ceilLowerByValue, ln, arg0, SPEED(arg1), 0, arg2, CRUSH(arg4), 0, CHANGE(arg3)); } FUNC(LS_Ceiling_RaiseByValue) // Ceiling_RaiseByValue (tag, speed, height, change) { - return EV_DoCeiling (DCeiling::ceilRaiseByValue, ln, arg0, SPEED(arg1), 0, arg2, CRUSH(arg4), 0, CHANGE(arg3)); + return Level->EV_DoCeiling (DCeiling::ceilRaiseByValue, ln, arg0, SPEED(arg1), 0, arg2, CRUSH(arg4), 0, CHANGE(arg3)); } FUNC(LS_Ceiling_LowerByValueTimes8) // Ceiling_LowerByValueTimes8 (tag, speed, height, change, crush) { - return EV_DoCeiling (DCeiling::ceilLowerByValue, ln, arg0, SPEED(arg1), 0, arg2*8, -1, 0, CHANGE(arg3)); + return Level->EV_DoCeiling (DCeiling::ceilLowerByValue, ln, arg0, SPEED(arg1), 0, arg2*8, -1, 0, CHANGE(arg3)); } FUNC(LS_Ceiling_RaiseByValueTimes8) // Ceiling_RaiseByValueTimes8 (tag, speed, height, change) { - return EV_DoCeiling (DCeiling::ceilRaiseByValue, ln, arg0, SPEED(arg1), 0, arg2*8, -1, 0, CHANGE(arg3)); + return Level->EV_DoCeiling (DCeiling::ceilRaiseByValue, ln, arg0, SPEED(arg1), 0, arg2*8, -1, 0, CHANGE(arg3)); } FUNC(LS_Ceiling_CrushAndRaise) // 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 Level->EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), SPEED(arg1)/2, 8, arg2, 0, 0, CRUSHTYPE(arg3, false)); } FUNC(LS_Ceiling_LowerAndCrush) // 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 Level->EV_DoCeiling (DCeiling::ceilLowerAndCrush, ln, arg0, SPEED(arg1), SPEED(arg1), 8, arg2, 0, 0, CRUSHTYPE(arg3, arg1 == 8)); } FUNC(LS_Ceiling_LowerAndCrushDist) // 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 Level->EV_DoCeiling (DCeiling::ceilLowerAndCrush, ln, arg0, SPEED(arg1), SPEED(arg1), arg3, arg2, 0, 0, CRUSHTYPE(arg4, arg1 == 8)); } FUNC(LS_Ceiling_CrushStop) @@ -723,160 +723,160 @@ FUNC(LS_Ceiling_CrushStop) remove = gameinfo.gametype == GAME_Hexen; break; } - return EV_CeilingCrushStop (arg0, remove); + return Level->EV_CeilingCrushStop (arg0, remove); } FUNC(LS_Ceiling_CrushRaiseAndStay) // 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 Level->EV_DoCeiling (DCeiling::ceilCrushRaiseAndStay, ln, arg0, SPEED(arg1), SPEED(arg1)/2, 8, arg2, 0, 0, CRUSHTYPE(arg3, false)); } FUNC(LS_Ceiling_MoveToValueTimes8) // Ceiling_MoveToValueTimes8 (tag, speed, height, negative, change) { - return EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0, + return Level->EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0, arg2*8*((arg3) ? -1 : 1), -1, 0, CHANGE(arg4)); } FUNC(LS_Ceiling_MoveToValue) // Ceiling_MoveToValue (tag, speed, height, negative, change) { - return EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0, + return Level->EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0, arg2*((arg3) ? -1 : 1), -1, 0, CHANGE(arg4)); } FUNC(LS_Ceiling_MoveToValueAndCrush) // Ceiling_MoveToValueAndCrush (tag, speed, height, crush, crushmode) { - return EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0, + return Level->EV_DoCeiling (DCeiling::ceilMoveToValue, ln, arg0, SPEED(arg1), 0, arg2, CRUSH(arg3), 0, 0, CRUSHTYPE(arg4, arg1 == 8)); } FUNC(LS_Ceiling_LowerToHighestFloor) // Ceiling_LowerToHighestFloor (tag, speed, change, crush, gap) { - return EV_DoCeiling (DCeiling::ceilLowerToHighestFloor, ln, arg0, SPEED(arg1), 0, arg4, CRUSH(arg3), 0, CHANGE(arg2)); + return Level->EV_DoCeiling (DCeiling::ceilLowerToHighestFloor, ln, arg0, SPEED(arg1), 0, arg4, CRUSH(arg3), 0, CHANGE(arg2)); } FUNC(LS_Ceiling_LowerInstant) // Ceiling_LowerInstant (tag, unused, height, change, crush) { - return EV_DoCeiling (DCeiling::ceilLowerInstant, ln, arg0, 0, 0, arg2*8, CRUSH(arg4), 0, CHANGE(arg3)); + return Level->EV_DoCeiling (DCeiling::ceilLowerInstant, ln, arg0, 0, 0, arg2*8, CRUSH(arg4), 0, CHANGE(arg3)); } FUNC(LS_Ceiling_RaiseInstant) // Ceiling_RaiseInstant (tag, unused, height, change) { - return EV_DoCeiling (DCeiling::ceilRaiseInstant, ln, arg0, 0, 0, arg2*8, -1, 0, CHANGE(arg3)); + return Level->EV_DoCeiling (DCeiling::ceilRaiseInstant, ln, arg0, 0, 0, arg2*8, -1, 0, CHANGE(arg3)); } FUNC(LS_Ceiling_CrushRaiseAndStayA) // 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 Level->EV_DoCeiling (DCeiling::ceilCrushRaiseAndStay, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg3, 0, 0, CRUSHTYPE(arg4, false)); } FUNC(LS_Ceiling_CrushRaiseAndStaySilA) // 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 Level->EV_DoCeiling (DCeiling::ceilCrushRaiseAndStay, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg3, 1, 0, CRUSHTYPE(arg4, false)); } FUNC(LS_Ceiling_CrushAndRaiseA) // 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 Level->EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg3, 0, 0, CRUSHTYPE(arg4, arg1 == 8 && arg2 == 8)); } FUNC(LS_Ceiling_CrushAndRaiseDist) // 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 Level->EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg2), SPEED(arg2), arg1, arg3, 0, 0, CRUSHTYPE(arg4, arg2 == 8)); } FUNC(LS_Ceiling_CrushAndRaiseSilentA) // 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 Level->EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg3, 1, 0, CRUSHTYPE(arg4, arg1 == 8 && arg2 == 8)); } FUNC(LS_Ceiling_CrushAndRaiseSilentDist) // 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 Level->EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg2), SPEED(arg2), arg1, arg3, 1, 0, CRUSHTYPE(arg4, arg2 == 8)); } FUNC(LS_Ceiling_RaiseToNearest) // Ceiling_RaiseToNearest (tag, speed, change) { - return EV_DoCeiling (DCeiling::ceilRaiseToNearest, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0); + return Level->EV_DoCeiling (DCeiling::ceilRaiseToNearest, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0); } FUNC(LS_Ceiling_RaiseToHighest) // Ceiling_RaiseToHighest (tag, speed, change) { - return EV_DoCeiling (DCeiling::ceilRaiseToHighest, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0); + return Level->EV_DoCeiling (DCeiling::ceilRaiseToHighest, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0); } FUNC(LS_Ceiling_RaiseToLowest) // Ceiling_RaiseToLowest (tag, speed, change) { - return EV_DoCeiling (DCeiling::ceilRaiseToLowest, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0); + return Level->EV_DoCeiling (DCeiling::ceilRaiseToLowest, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0); } FUNC(LS_Ceiling_RaiseToHighestFloor) // Ceiling_RaiseToHighestFloor (tag, speed, change) { - return EV_DoCeiling (DCeiling::ceilRaiseToHighestFloor, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0); + return Level->EV_DoCeiling (DCeiling::ceilRaiseToHighestFloor, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0); } FUNC(LS_Ceiling_RaiseByTexture) // Ceiling_RaiseByTexture (tag, speed, change) { - return EV_DoCeiling (DCeiling::ceilRaiseByTexture, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0); + return Level->EV_DoCeiling (DCeiling::ceilRaiseByTexture, ln, arg0, SPEED(arg1), 0, 0, -1, CHANGE(arg2), 0); } FUNC(LS_Ceiling_LowerToLowest) // Ceiling_LowerToLowest (tag, speed, change, crush) { - return EV_DoCeiling (DCeiling::ceilLowerToLowest, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2)); + return Level->EV_DoCeiling (DCeiling::ceilLowerToLowest, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2)); } FUNC(LS_Ceiling_LowerToNearest) // Ceiling_LowerToNearest (tag, speed, change, crush) { - return EV_DoCeiling (DCeiling::ceilLowerToNearest, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2)); + return Level->EV_DoCeiling (DCeiling::ceilLowerToNearest, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2)); } FUNC(LS_Ceiling_ToHighestInstant) // Ceiling_ToHighestInstant (tag, change, crush) { - return EV_DoCeiling (DCeiling::ceilLowerToHighest, ln, arg0, 2, 0, 0, CRUSH(arg2), 0, CHANGE(arg1)); + return Level->EV_DoCeiling (DCeiling::ceilLowerToHighest, ln, arg0, 2, 0, 0, CRUSH(arg2), 0, CHANGE(arg1)); } FUNC(LS_Ceiling_ToFloorInstant) // Ceiling_ToFloorInstant (tag, change, crush, gap) { - return EV_DoCeiling (DCeiling::ceilRaiseToFloor, ln, arg0, 2, 0, arg3, CRUSH(arg2), 0, CHANGE(arg1)); + return Level->EV_DoCeiling (DCeiling::ceilRaiseToFloor, ln, arg0, 2, 0, arg3, CRUSH(arg2), 0, CHANGE(arg1)); } FUNC(LS_Ceiling_LowerToFloor) // Ceiling_LowerToFloor (tag, speed, change, crush, gap) { - return EV_DoCeiling (DCeiling::ceilLowerToFloor, ln, arg0, SPEED(arg1), 0, arg4, CRUSH(arg3), 0, CHANGE(arg2)); + return Level->EV_DoCeiling (DCeiling::ceilLowerToFloor, ln, arg0, SPEED(arg1), 0, arg4, CRUSH(arg3), 0, CHANGE(arg2)); } FUNC(LS_Ceiling_LowerByTexture) // Ceiling_LowerByTexture (tag, speed, change, crush) { - return EV_DoCeiling (DCeiling::ceilLowerByTexture, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2)); + return Level->EV_DoCeiling (DCeiling::ceilLowerByTexture, ln, arg0, SPEED(arg1), 0, 0, CRUSH(arg3), 0, CHANGE(arg2)); } FUNC(LS_Ceiling_Stop) // Ceiling_Stop (tag) { - return EV_StopCeiling(arg0, ln); + return Level->EV_StopCeiling(arg0, ln); } @@ -907,14 +907,14 @@ FUNC(LS_Generic_Ceiling) } } - return EV_DoCeiling (type, ln, arg0, SPEED(arg1), SPEED(arg1), arg2, + return Level->EV_DoCeiling (type, ln, arg0, SPEED(arg1), SPEED(arg1), arg2, (arg4 & 16) ? 20 : -1, 0, arg4 & 7); } FUNC(LS_Generic_Crusher) // Generic_Crusher (tag, dnspeed, upspeed, silent, damage) { - return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), + return Level->EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg4, arg3 ? 2 : 0, 0, (arg1 <= 24 && arg2 <= 24)? DCeiling::ECrushMode::crushSlowdown : DCeiling::ECrushMode::crushDoom); } @@ -922,20 +922,20 @@ FUNC(LS_Generic_Crusher2) // Generic_Crusher2 (tag, dnspeed, upspeed, silent, damage) { // same as above but uses Hexen's crushing method. - return EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), + return Level->EV_DoCeiling (DCeiling::ceilCrushAndRaise, ln, arg0, SPEED(arg1), SPEED(arg2), 0, arg4, arg3 ? 2 : 0, 0, DCeiling::ECrushMode::crushHexen); } FUNC(LS_Plat_PerpetualRaise) // Plat_PerpetualRaise (tag, speed, delay) { - return EV_DoPlat (arg0, ln, DPlat::platPerpetualRaise, 0, SPEED(arg1), TICS(arg2), 8, 0); + return Level->EV_DoPlat (arg0, ln, DPlat::platPerpetualRaise, 0, SPEED(arg1), TICS(arg2), 8, 0); } FUNC(LS_Plat_PerpetualRaiseLip) // Plat_PerpetualRaiseLip (tag, speed, delay, lip) { - return EV_DoPlat (arg0, ln, DPlat::platPerpetualRaise, 0, SPEED(arg1), TICS(arg2), arg3, 0); + return Level->EV_DoPlat (arg0, ln, DPlat::platPerpetualRaise, 0, SPEED(arg1), TICS(arg2), arg3, 0); } FUNC(LS_Plat_Stop) @@ -954,20 +954,20 @@ FUNC(LS_Plat_Stop) remove = gameinfo.gametype == GAME_Hexen; break; } - EV_StopPlat(arg0, remove); + Level->EV_StopPlat(arg0, remove); return true; } FUNC(LS_Plat_DownWaitUpStay) // Plat_DownWaitUpStay (tag, speed, delay) { - return EV_DoPlat (arg0, ln, DPlat::platDownWaitUpStay, 0, SPEED(arg1), TICS(arg2), 8, 0); + return Level->EV_DoPlat (arg0, ln, DPlat::platDownWaitUpStay, 0, SPEED(arg1), TICS(arg2), 8, 0); } FUNC(LS_Plat_DownWaitUpStayLip) // Plat_DownWaitUpStayLip (tag, speed, delay, lip, floor-sound?) { - return EV_DoPlat (arg0, ln, + return Level->EV_DoPlat (arg0, ln, arg4 ? DPlat::platDownWaitUpStayStone : DPlat::platDownWaitUpStay, 0, SPEED(arg1), TICS(arg2), arg3, 0); } @@ -975,25 +975,25 @@ FUNC(LS_Plat_DownWaitUpStayLip) FUNC(LS_Plat_DownByValue) // Plat_DownByValue (tag, speed, delay, height) { - return EV_DoPlat (arg0, ln, DPlat::platDownByValue, arg3*8, SPEED(arg1), TICS(arg2), 0, 0); + return Level->EV_DoPlat (arg0, ln, DPlat::platDownByValue, arg3*8, SPEED(arg1), TICS(arg2), 0, 0); } FUNC(LS_Plat_UpByValue) // Plat_UpByValue (tag, speed, delay, height) { - return EV_DoPlat (arg0, ln, DPlat::platUpByValue, arg3*8, SPEED(arg1), TICS(arg2), 0, 0); + return Level->EV_DoPlat (arg0, ln, DPlat::platUpByValue, arg3*8, SPEED(arg1), TICS(arg2), 0, 0); } FUNC(LS_Plat_UpWaitDownStay) // Plat_UpWaitDownStay (tag, speed, delay) { - return EV_DoPlat (arg0, ln, DPlat::platUpWaitDownStay, 0, SPEED(arg1), TICS(arg2), 0, 0); + return Level->EV_DoPlat (arg0, ln, DPlat::platUpWaitDownStay, 0, SPEED(arg1), TICS(arg2), 0, 0); } FUNC(LS_Plat_UpNearestWaitDownStay) // Plat_UpNearestWaitDownStay (tag, speed, delay) { - return EV_DoPlat (arg0, ln, DPlat::platUpNearestWaitDownStay, 0, SPEED(arg1), TICS(arg2), 0, 0); + return Level->EV_DoPlat (arg0, ln, DPlat::platUpNearestWaitDownStay, 0, SPEED(arg1), TICS(arg2), 0, 0); } FUNC(LS_Plat_RaiseAndStayTx0) @@ -1015,19 +1015,19 @@ FUNC(LS_Plat_RaiseAndStayTx0) } - return EV_DoPlat (arg0, ln, type, 0, SPEED(arg1), 0, 0, 1); + return Level->EV_DoPlat (arg0, ln, type, 0, SPEED(arg1), 0, 0, 1); } FUNC(LS_Plat_UpByValueStayTx) // Plat_UpByValueStayTx (tag, speed, height) { - return EV_DoPlat (arg0, ln, DPlat::platUpByValueStay, arg2*8, SPEED(arg1), 0, 0, 2); + return Level->EV_DoPlat (arg0, ln, DPlat::platUpByValueStay, arg2*8, SPEED(arg1), 0, 0, 2); } FUNC(LS_Plat_ToggleCeiling) // Plat_ToggleCeiling (tag) { - return EV_DoPlat (arg0, ln, DPlat::platToggle, 0, 0, 0, 0, 0); + return Level->EV_DoPlat (arg0, ln, DPlat::platToggle, 0, 0, 0, 0, 0); } FUNC(LS_Generic_Lift) @@ -1054,7 +1054,7 @@ FUNC(LS_Generic_Lift) break; } - return EV_DoPlat (arg0, ln, type, arg4*8, SPEED(arg1), OCTICS(arg2), 0, 0); + return Level->EV_DoPlat (arg0, ln, type, arg4*8, SPEED(arg1), OCTICS(arg2), 0, 0); } FUNC(LS_Exit_Normal) @@ -2024,26 +2024,26 @@ FUNC(LS_FS_Execute) FUNC(LS_FloorAndCeiling_LowerByValue) // FloorAndCeiling_LowerByValue (tag, speed, height) { - return EV_DoElevator (ln, DElevator::elevateLower, SPEED(arg1), arg2, arg0); + return Level->EV_DoElevator (ln, DElevator::elevateLower, SPEED(arg1), arg2, arg0); } FUNC(LS_FloorAndCeiling_RaiseByValue) // FloorAndCeiling_RaiseByValue (tag, speed, height) { - return EV_DoElevator (ln, DElevator::elevateRaise, SPEED(arg1), arg2, arg0); + return Level->EV_DoElevator (ln, DElevator::elevateRaise, SPEED(arg1), arg2, arg0); } FUNC(LS_FloorAndCeiling_LowerRaise) // FloorAndCeiling_LowerRaise (tag, fspeed, cspeed, boomemu) { - bool res = EV_DoCeiling (DCeiling::ceilRaiseToHighest, ln, arg0, SPEED(arg2), 0, 0, 0, 0, 0); + bool res = Level->EV_DoCeiling (DCeiling::ceilRaiseToHighest, ln, arg0, SPEED(arg2), 0, 0, 0, 0, 0); // 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. // 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 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 |= Level->EV_DoFloor (DFloor::floorLowerToLowest, ln, arg0, SPEED(arg1), 0, -1, 0, false); } return res; } @@ -2051,19 +2051,19 @@ FUNC(LS_FloorAndCeiling_LowerRaise) FUNC(LS_Elevator_MoveToFloor) // Elevator_MoveToFloor (tag, speed) { - return EV_DoElevator (ln, DElevator::elevateCurrent, SPEED(arg1), 0, arg0); + return Level->EV_DoElevator (ln, DElevator::elevateCurrent, SPEED(arg1), 0, arg0); } FUNC(LS_Elevator_RaiseToNearest) // Elevator_RaiseToNearest (tag, speed) { - return EV_DoElevator (ln, DElevator::elevateUp, SPEED(arg1), 0, arg0); + return Level->EV_DoElevator (ln, DElevator::elevateUp, SPEED(arg1), 0, arg0); } FUNC(LS_Elevator_LowerToNearest) // Elevator_LowerToNearest (tag, speed) { - return EV_DoElevator (ln, DElevator::elevateDown, SPEED(arg1), 0, arg0); + return Level->EV_DoElevator (ln, DElevator::elevateDown, SPEED(arg1), 0, arg0); } FUNC(LS_Light_ForceLightning) diff --git a/src/p_pillar.cpp b/src/p_pillar.cpp index 5c3453b4f..a681bee23 100644 --- a/src/p_pillar.cpp +++ b/src/p_pillar.cpp @@ -48,10 +48,6 @@ IMPLEMENT_POINTERS_START(DPillar) IMPLEMENT_POINTER(m_Interp_Ceiling) IMPLEMENT_POINTERS_END -DPillar::DPillar () -{ -} - void DPillar::OnDestroy() { if (m_Interp_Ceiling != nullptr) @@ -210,7 +206,7 @@ DPillar::DPillar (sector_t *sector, EPillar type, double speed, } } -bool EV_DoPillar (DPillar::EPillar type, line_t *line, int tag, +bool FLevelLocals::EV_DoPillar (DPillar::EPillar type, line_t *line, int tag, double speed, double height, double height2, int crush, bool hexencrush) { int secnum; @@ -218,10 +214,10 @@ bool EV_DoPillar (DPillar::EPillar type, line_t *line, int tag, bool rtn = false; // check if a manual trigger; if so do just the sector on the backside - auto itr = level.GetSectorTagIterator(tag, line); + auto itr = GetSectorTagIterator(tag, line); while ((secnum = itr.Next()) >= 0) { - sec = &level.sectors[secnum]; + sec = §ors[secnum]; if (sec->PlaneMoving(sector_t::floor) || sec->PlaneMoving(sector_t::ceiling)) continue; diff --git a/src/p_plats.cpp b/src/p_plats.cpp index e368fcaa5..2a39ef323 100644 --- a/src/p_plats.cpp +++ b/src/p_plats.cpp @@ -41,10 +41,6 @@ static FRandom pr_doplat ("DoPlat"); IMPLEMENT_CLASS(DPlat, false, false) -DPlat::DPlat () -{ -} - void DPlat::Serialize(FSerializer &arc) { Super::Serialize (arc); @@ -204,6 +200,21 @@ void DPlat::Tick () } } +void DPlat::Reactivate() +{ + if (m_Type == platToggle) //jff 3/14/98 reactivate toggle type + m_Status = m_OldStatus == up ? down : up; + else + m_Status = m_OldStatus; +} + + +void DPlat::Stop() +{ + m_OldStatus = m_Status; + m_Status = in_stasis; +} + DPlat::DPlat (sector_t *sector) : DMovingFloor (sector) { @@ -214,8 +225,7 @@ DPlat::DPlat (sector_t *sector) // [RH] Changed amount to height and added delay, // lip, change, tag, and speed parameters. // -bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, double height, - double speed, int delay, int lip, int change) +bool FLevelLocals::EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, double height, double speed, int delay, int lip, int change) { DPlat *plat; int secnum; @@ -233,7 +243,7 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, double height, case DPlat::platToggle: rtn = true; case DPlat::platPerpetualRaise: - P_ActivateInStasis (tag); + ActivateInStasisPlat (tag); break; default: @@ -244,10 +254,10 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, double height, // [RH] If tag is zero, use the sector on the back side // of the activating line (if any). - auto itr = level.GetSectorTagIterator(tag, line); + auto itr = GetSectorTagIterator(tag, line); while ((secnum = itr.Next()) >= 0) { - sec = &level.sectors[secnum]; + sec = §ors[secnum]; if (sec->PlaneMoving(sector_t::floor)) { @@ -392,18 +402,10 @@ bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, double height, return rtn; } -void DPlat::Reactivate () -{ - if (m_Type == platToggle) //jff 3/14/98 reactivate toggle type - m_Status = m_OldStatus == up ? down : up; - else - m_Status = m_OldStatus; -} - -void P_ActivateInStasis (int tag) +void FLevelLocals::ActivateInStasisPlat (int tag) { DPlat *scan; - TThinkerIterator iterator; + auto iterator = GetThinkerIterator(); while ( (scan = iterator.Next ()) ) { @@ -412,16 +414,10 @@ void P_ActivateInStasis (int tag) } } -void DPlat::Stop () -{ - m_OldStatus = m_Status; - m_Status = in_stasis; -} - -void EV_StopPlat (int tag, bool remove) +void FLevelLocals::EV_StopPlat (int tag, bool remove) { DPlat *scan; - TThinkerIterator iterator; + auto iterator = GetThinkerIterator(); scan = iterator.Next(); while (scan != nullptr) diff --git a/src/p_spec.h b/src/p_spec.h index 957ac9703..ab9514d88 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -210,19 +210,11 @@ protected: void Stop (); private: - DPlat (); + DPlat() = default; - friend bool EV_DoPlat (int tag, line_t *line, EPlatType type, - double height, double speed, int delay, int lip, int change); - friend void EV_StopPlat (int tag, bool remove); - friend void P_ActivateInStasis (int tag); + friend struct FLevelLocals; }; -bool EV_DoPlat (int tag, line_t *line, DPlat::EPlatType type, - double height, double speed, int delay, int lip, int change); -void EV_StopPlat (int tag, bool remove); -void P_ActivateInStasis (int tag); - // // [RH] // P_PILLAR @@ -259,11 +251,9 @@ protected: TObjPtr m_Interp_Floor; private: - DPillar (); + DPillar() = default; }; -bool EV_DoPillar (DPillar::EPillar type, line_t *line, int tag, - double speed, double height, double height2, int crush, bool hexencrush); // // P_DOORS @@ -307,19 +297,12 @@ protected: void DoorSound (bool raise, class DSeqNode *curseq=NULL) const; - friend bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, - int tag, double speed, int delay, int lock, - int lightTag, bool boomgen, int topcountdown); private: - DDoor (); + friend struct FLevelLocals; + DDoor() = default; }; -bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, - int tag, double speed, int delay, int lock, - int lightTag, bool boomgen = false, int topcountdown = 0); - - class DAnimatedDoor : public DMovingCeiling { DECLARE_CLASS (DAnimatedDoor, DMovingCeiling) @@ -357,15 +340,13 @@ protected: int m_Delay; bool m_SetBlocking1, m_SetBlocking2; - friend bool EV_SlidingDoor (line_t *line, AActor *thing, int tag, int speed, int delay, EADType type); + friend struct FLevelLocals; private: - DAnimatedDoor (); + DAnimatedDoor() = default; }; -bool EV_SlidingDoor (line_t *line, AActor *thing, int tag, int speed, int delay, DAnimatedDoor::EADType type); - // -// P_CEILNG +// P_CEILING // // [RH] Changed these @@ -441,22 +422,11 @@ protected: void PlayCeilingSound (); private: - DCeiling (); + DCeiling() = default; + friend struct FLevelLocals; - 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 void P_ActivateInStasisCeiling (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 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_CeilingCrushStop (int tag, bool remove); -bool EV_StopCeiling(int tag, line_t *line); -void P_ActivateInStasisCeiling (int tag); - - - // // P_FLOOR // @@ -544,30 +514,12 @@ public: void StartFloorSound (); void SetFloorChangeType (sector_t *sec, int change); + friend struct FLevelLocals; - friend bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, - double stairsize, double speed, int delay, int reset, int igntxt, - int usespecials); - friend bool EV_DoFloor (DFloor::EFloor floortype, line_t *line, int tag, - 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); private: - DFloor (); + DFloor() = default; }; -bool P_CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t *line, - double speed, double height, int crush, int change, bool hexencrush, bool hereticlower); - -bool EV_BuildStairs (int tag, DFloor::EStair type, line_t *line, - double stairsize, double speed, int delay, int reset, int igntxt, - int usespecials); -bool EV_DoFloor(DFloor::EFloor floortype, line_t *line, int tag, - double speed, double height, int crush, int change, bool hexencrush, bool hereticlower = false); - -bool EV_FloorCrushStop (int tag, line_t *line); -bool EV_StopFloor(int tag, line_t *line); -bool EV_DoDonut (int tag, line_t *line, double pillarspeed, double slimespeed); - class DElevator : public DMover { DECLARE_CLASS (DElevator, DMover) @@ -599,13 +551,11 @@ protected: TObjPtr m_Interp_Floor; void StartFloorSound (); - - friend bool EV_DoElevator (line_t *line, DElevator::EElevator type, double speed, double height, int tag); + friend struct FLevelLocals; private: - DElevator (); + DElevator() = default; }; -bool EV_DoElevator (line_t *line, DElevator::EElevator type, double speed, double height, int tag); class DWaggleBase : public DMover { @@ -626,16 +576,11 @@ protected: int m_Ticker; int m_State; - friend bool EV_StartWaggle (int tag, line_t *line, int height, int speed, - int offset, int timer, bool ceiling); - + friend struct FLevelLocals; void DoWaggle (bool ceiling); - DWaggleBase (); + DWaggleBase() = default; }; -bool EV_StartWaggle (int tag, line_t *line, int height, int speed, - int offset, int timer, bool ceiling); - class DFloorWaggle : public DWaggleBase { DECLARE_CLASS (DFloorWaggle, DWaggleBase) @@ -643,7 +588,7 @@ public: DFloorWaggle (sector_t *sec); void Tick (); private: - DFloorWaggle (); + DFloorWaggle() = default; }; class DCeilingWaggle : public DWaggleBase @@ -653,7 +598,7 @@ public: DCeilingWaggle (sector_t *sec); void Tick (); private: - DCeilingWaggle (); + DCeilingWaggle() = default; }; //jff 3/15/98 pure texture/type change for better generalized support @@ -663,10 +608,6 @@ enum EChange numChangeOnly, }; -bool EV_DoChange (line_t *line, EChange changetype, int tag); - - - // // P_TELEPT // diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index 5263aebf8..d31692b9f 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -721,6 +721,10 @@ struct LevelLocals native int sec = Thinker.Tics2Seconds(totals? totaltime : time); return String.Format("%02d:%02d:%02d", sec / 3600, (sec % 3600) / 60, sec % 60); } + + native bool CreateCeiling(sector sec, int type, line ln, double speed, double speed2, double height = 0, int crush = -1, int silent = 0, int change = 0, int crushmode = crushDoom); + native bool CreateFloor(sector sec, EFloor floortype, line ln, double speed, double height = 0, int crush = -1, int change = 0, bool crushmode = false, bool hereticlower = false); + } struct StringTable native @@ -922,7 +926,10 @@ class Floor : MovingFloor native genFloorChg }; - native static bool CreateFloor(sector sec, EFloor floortype, line ln, double speed, double height = 0, int crush = -1, int change = 0, bool crushmode = false, bool hereticlower = false); + deprecated("3.8") static bool CreateFloor(sector sec, EFloor floortype, line ln, double speed, double height = 0, int crush = -1, int change = 0, bool crushmode = false, bool hereticlower = false) + { + return level.CreateFloor(sec, floortype, ln, speed, height, crush, change, crushmode, hereticlower); + } } class Ceiling : MovingCeiling native @@ -965,7 +972,10 @@ class Ceiling : MovingCeiling native crushSlowdown = 2 } - native static bool CreateCeiling(sector sec, int type, line ln, double speed, double speed2, double height = 0, int crush = -1, int silent = 0, int change = 0, int crushmode = crushDoom); + deprecated("3.8") static bool CreateCeiling(sector sec, int type, line ln, double speed, double speed2, double height = 0, int crush = -1, int silent = 0, int change = 0, int crushmode = crushDoom) + { + return level.CreateCeiling(sec, type, ln, speed, speed2, height, crush, silent, change, crushmode); + } } diff --git a/wadsrc/static/zscript/strife/thingstoblowup.txt b/wadsrc/static/zscript/strife/thingstoblowup.txt index 8c17f8802..b3c6d636c 100644 --- a/wadsrc/static/zscript/strife/thingstoblowup.txt +++ b/wadsrc/static/zscript/strife/thingstoblowup.txt @@ -213,7 +213,7 @@ class PowerCrystal : Actor sec.Flags |= Sector.SECF_SILENTMOVE; sec.lightlevel = 0; // Do this right with proper checks instead of just hacking the floor height. - Floor.CreateFloor(sec, Floor.floorLowerToLowest, null, 65536.); + level.CreateFloor(sec, Floor.floorLowerToLowest, null, 65536.); for (int i = 0; i < 8; ++i)