diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index 835f3780e3..3499500ee6 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -214,6 +214,9 @@ Note: All fields default to false unless mentioned otherwise. damagehazard = ; // Changes damage model to Strife's delayed damage for the given sector. Default = false. floorterrain = ; // Sets the terrain for the sector's floor. Default = 'use the flat texture's terrain definition.' ceilingterrain = ; // Sets the terrain for the sector's ceiling. Default = 'use the flat texture's terrain definition.' + + floor_reflect = ; // reflectiveness of floor (OpenGL only, not functional on sloped sectors) + ceiling_reflect = ; // reflectiveness of ceiling (OpenGL only, not functional on sloped sectors) portal_ceil_alpha = // translucency of ceiling portal (default is 0 (not visible)) portal_ceil_blocksound = // ceiling portal blocks sound. @@ -406,6 +409,9 @@ Added 'moreids' for linedefs and sectors. added clarification about character encoding added sector damage properties. +1.27 05.01.2016 +floor_reflect and ceiling_reflect. + =============================================================================== EOF =============================================================================== diff --git a/src/dobject.cpp b/src/dobject.cpp index 6b973de336..fd84f1574a 100644 --- a/src/dobject.cpp +++ b/src/dobject.cpp @@ -552,3 +552,9 @@ void DObject::CheckIfSerialized () const } } + +DEFINE_ACTION_FUNCTION(DObject, GetClassName) +{ + PARAM_SELF_PROLOGUE(DObject); + ACTION_RETURN_INT(self->GetClass()->TypeName); +} \ No newline at end of file diff --git a/src/dsectoreffect.cpp b/src/dsectoreffect.cpp index 3c33d1634c..072b89f02c 100644 --- a/src/dsectoreffect.cpp +++ b/src/dsectoreffect.cpp @@ -134,17 +134,17 @@ DMovingCeiling::DMovingCeiling (sector_t *sector, bool interpolate) if (interpolate) interpolation = sector->SetInterpolation(sector_t::CeilingMove, true); } -bool sector_t::MoveAttached(int crush, double move, int floorOrCeiling, bool resetfailed) +bool sector_t::MoveAttached(int crush, double move, int floorOrCeiling, bool resetfailed, bool instant) { - if (!P_Scroll3dMidtex(this, crush, move, !!floorOrCeiling) && resetfailed) + if (!P_Scroll3dMidtex(this, crush, move, !!floorOrCeiling, instant) && resetfailed) { - P_Scroll3dMidtex(this, crush, -move, !!floorOrCeiling); + P_Scroll3dMidtex(this, crush, -move, !!floorOrCeiling, instant); return false; } - if (!P_MoveLinkedSectors(this, crush, move, !!floorOrCeiling) && resetfailed) + if (!P_MoveLinkedSectors(this, crush, move, !!floorOrCeiling, instant) && resetfailed) { - P_MoveLinkedSectors(this, crush, -move, !!floorOrCeiling); - P_Scroll3dMidtex(this, crush, -move, !!floorOrCeiling); + P_MoveLinkedSectors(this, crush, -move, !!floorOrCeiling, instant); + P_Scroll3dMidtex(this, crush, -move, !!floorOrCeiling, instant); return false; } return true; @@ -156,7 +156,7 @@ bool sector_t::MoveAttached(int crush, double move, int floorOrCeiling, bool res // (Use -1 to prevent it from trying to crush) // dest is the desired d value for the plane // -EMoveResult sector_t::MoveFloor(double speed, double dest, int crush, int direction, bool hexencrush) +EMoveResult sector_t::MoveFloor(double speed, double dest, int crush, int direction, bool hexencrush, bool instant) { bool flag; double lastpos; @@ -174,15 +174,15 @@ EMoveResult sector_t::MoveFloor(double speed, double dest, int crush, int direct { move = floorplane.HeightDiff(lastpos, dest); - if (!MoveAttached(crush, move, 0, true)) return EMoveResult::crushed; + if (!MoveAttached(crush, move, 0, true, instant)) return EMoveResult::crushed; floorplane.setD(dest); - flag = P_ChangeSector(this, crush, move, 0, false); + flag = P_ChangeSector(this, crush, move, 0, false, instant); if (flag) { floorplane.setD(lastpos); - P_ChangeSector(this, crush, -move, 0, true); - MoveAttached(crush, -move, 0, false); + P_ChangeSector(this, crush, -move, 0, true, instant); + MoveAttached(crush, -move, 0, false, instant); } else { @@ -193,16 +193,16 @@ EMoveResult sector_t::MoveFloor(double speed, double dest, int crush, int direct } else { - if (!MoveAttached(crush, -speed, 0, true)) return EMoveResult::crushed; + if (!MoveAttached(crush, -speed, 0, true, instant)) return EMoveResult::crushed; floorplane.setD(movedest); - flag = P_ChangeSector(this, crush, -speed, 0, false); + flag = P_ChangeSector(this, crush, -speed, 0, false, instant); if (flag) { floorplane.setD(lastpos); - P_ChangeSector(this, crush, speed, 0, true); - MoveAttached(crush, speed, 0, false); + P_ChangeSector(this, crush, speed, 0, true, instant); + MoveAttached(crush, speed, 0, false, instant); return EMoveResult::crushed; } else @@ -231,16 +231,16 @@ EMoveResult sector_t::MoveFloor(double speed, double dest, int crush, int direct { move = floorplane.HeightDiff(lastpos, dest); - if (!MoveAttached(crush, move, 0, true)) return EMoveResult::crushed; + if (!MoveAttached(crush, move, 0, true, instant)) return EMoveResult::crushed; floorplane.setD(dest); - flag = P_ChangeSector(this, crush, move, 0, false); + flag = P_ChangeSector(this, crush, move, 0, false, instant); if (flag) { floorplane.setD(lastpos); - P_ChangeSector(this, crush, -move, 0, true); - MoveAttached(crush, -move, 0, false); + P_ChangeSector(this, crush, -move, 0, true, instant); + MoveAttached(crush, -move, 0, false, instant); } else { @@ -251,12 +251,12 @@ EMoveResult sector_t::MoveFloor(double speed, double dest, int crush, int direct } else { - if (!MoveAttached(crush, speed, 0, true)) return EMoveResult::crushed; + if (!MoveAttached(crush, speed, 0, true, instant)) return EMoveResult::crushed; floorplane.setD(movedest); // COULD GET CRUSHED - flag = P_ChangeSector(this, crush, speed, 0, false); + flag = P_ChangeSector(this, crush, speed, 0, false, instant); if (flag) { if (crush >= 0 && !hexencrush) @@ -266,8 +266,8 @@ EMoveResult sector_t::MoveFloor(double speed, double dest, int crush, int direct return EMoveResult::crushed; } floorplane.setD(lastpos); - P_ChangeSector(this, crush, -speed, 0, true); - MoveAttached(crush, -speed, 0, false); + P_ChangeSector(this, crush, -speed, 0, true, instant); + MoveAttached(crush, -speed, 0, false, instant); return EMoveResult::crushed; } ChangePlaneTexZ(sector_t::floor, floorplane.HeightDiff(lastpos)); diff --git a/src/g_inventory/a_artifacts.cpp b/src/g_inventory/a_artifacts.cpp index 572022f66a..35bfa6e78e 100644 --- a/src/g_inventory/a_artifacts.cpp +++ b/src/g_inventory/a_artifacts.cpp @@ -1894,7 +1894,7 @@ void APowerMorph::InitEffect( ) if (Owner != nullptr && Owner->player != nullptr && PlayerClass != nullptr) { player_t *realplayer = Owner->player; // Remember the identity of the player - if (P_MorphPlayer(realplayer, realplayer, PlayerClass, -1/*INDEFINITELY*/, MorphStyle, MorphFlash, UnMorphFlash)) + if (P_MorphPlayer(realplayer, realplayer, PlayerClass, INT_MAX/*INDEFINITELY*/, MorphStyle, MorphFlash, UnMorphFlash)) { Owner = realplayer->mo; // Replace the new owner in our owner; safe because we are not attached to anything yet ItemFlags |= IF_CREATECOPYMOVED; // Let the caller know the "real" owner has changed (to the morphed actor) diff --git a/src/g_level.cpp b/src/g_level.cpp index f8ccd13be0..af6bb62301 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1569,7 +1569,7 @@ void G_UnSnapshotLevel (bool hubLoad) // If this isn't the unmorphed original copy of a player, destroy it, because it's extra. for (i = 0; i < MAXPLAYERS; ++i) { - if (playeringame[i] && players[i].morphTics && players[i].mo->tracer == pawn) + if (playeringame[i] && players[i].morphTics && players[i].mo->alternative == pawn) { break; } diff --git a/src/namedef.h b/src/namedef.h index 62d513437c..61d7303a45 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -575,6 +575,8 @@ xx(damageterraineffect) xx(damagehazard) xx(floorterrain) xx(ceilingterrain) +xx(floor_reflect) +xx(ceiling_reflect) // USDF keywords xx(Amount) diff --git a/src/p_3dmidtex.cpp b/src/p_3dmidtex.cpp index 26e9cf58b1..39263dd91d 100644 --- a/src/p_3dmidtex.cpp +++ b/src/p_3dmidtex.cpp @@ -51,7 +51,7 @@ // //============================================================================ -bool P_Scroll3dMidtex(sector_t *sector, int crush, double move, bool ceiling) +bool P_Scroll3dMidtex(sector_t *sector, int crush, double move, bool ceiling, bool instant) { extsector_t::midtex::plane &scrollplane = ceiling? sector->e->Midtex.Ceiling : sector->e->Midtex.Floor; @@ -69,7 +69,7 @@ bool P_Scroll3dMidtex(sector_t *sector, int crush, double move, bool ceiling) for(unsigned i = 0; i < scrollplane.AttachedSectors.Size(); i++) { - res |= P_ChangeSector(scrollplane.AttachedSectors[i], crush, move, 2, true); + res |= P_ChangeSector(scrollplane.AttachedSectors[i], crush, move, 2, true, instant); } return !res; } diff --git a/src/p_3dmidtex.h b/src/p_3dmidtex.h index a24daff832..c363e2f2ba 100644 --- a/src/p_3dmidtex.h +++ b/src/p_3dmidtex.h @@ -9,14 +9,14 @@ struct sector_t; struct line_t; class AActor; -bool P_Scroll3dMidtex(sector_t *sector, int crush, double move, bool ceiling); +bool P_Scroll3dMidtex(sector_t *sector, int crush, double move, bool ceiling, bool instant = false); void P_Start3dMidtexInterpolations(TArray &list, sector_t *sec, bool ceiling); void P_Attach3dMidtexLinesToSector(sector_t *dest, int lineid, int tag, bool ceiling); bool P_GetMidTexturePosition(const line_t *line, int sideno, double *ptextop, double *ptexbot); bool P_Check3dMidSwitch(AActor *actor, line_t *line, int side); bool P_LineOpening_3dMidtex(AActor *thing, const line_t *linedef, struct FLineOpening &open, bool restrict=false); -bool P_MoveLinkedSectors(sector_t *sector, int crush, double move, bool ceiling); +bool P_MoveLinkedSectors(sector_t *sector, int crush, double move, bool ceiling, bool instant = false); void P_StartLinkedSectorInterpolations(TArray &list, sector_t *sector, bool ceiling); bool P_AddSectorLinks(sector_t *control, int tag, INTBOOL ceiling, int movetype); void P_AddSectorLinksByID(sector_t *control, int id, INTBOOL ceiling); diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 6a7c9d10c7..87db324ccd 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -343,6 +343,23 @@ FACSStack::~FACSStack() ACSStringPool GlobalACSStrings; +void ACSStringPool::PoolEntry::Lock() +{ + if (Locks.Find(level.levelnum) == Locks.Size()) + { + Locks.Push(level.levelnum); + } +} + +void ACSStringPool::PoolEntry::Unlock() +{ + auto ndx = Locks.Find(level.levelnum); + if (ndx < Locks.Size()) + { + Locks.Delete(ndx); + } +} + ACSStringPool::ACSStringPool() { memset(PoolBuckets, 0xFF, sizeof(PoolBuckets)); @@ -430,7 +447,7 @@ void ACSStringPool::LockString(int strnum) assert((strnum & LIBRARYID_MASK) == STRPOOL_LIBRARYID_OR); strnum &= ~LIBRARYID_MASK; assert((unsigned)strnum < Pool.Size()); - Pool[strnum].LockCount++; + Pool[strnum].Lock(); } //============================================================================ @@ -446,8 +463,7 @@ void ACSStringPool::UnlockString(int strnum) assert((strnum & LIBRARYID_MASK) == STRPOOL_LIBRARYID_OR); strnum &= ~LIBRARYID_MASK; assert((unsigned)strnum < Pool.Size()); - assert(Pool[strnum].LockCount > 0); - Pool[strnum].LockCount--; + Pool[strnum].Unlock(); } //============================================================================ @@ -464,7 +480,7 @@ void ACSStringPool::MarkString(int strnum) assert((strnum & LIBRARYID_MASK) == STRPOOL_LIBRARYID_OR); strnum &= ~LIBRARYID_MASK; assert((unsigned)strnum < Pool.Size()); - Pool[strnum].LockCount |= 0x80000000; + Pool[strnum].Mark = true; } //============================================================================ @@ -489,7 +505,7 @@ void ACSStringPool::LockStringArray(const int *strnum, unsigned int count) num &= ~LIBRARYID_MASK; if ((unsigned)num < Pool.Size()) { - Pool[num].LockCount++; + Pool[num].Lock(); } } } @@ -513,8 +529,7 @@ void ACSStringPool::UnlockStringArray(const int *strnum, unsigned int count) num &= ~LIBRARYID_MASK; if ((unsigned)num < Pool.Size()) { - assert(Pool[num].LockCount > 0); - Pool[num].LockCount--; + Pool[num].Unlock(); } } } @@ -538,7 +553,7 @@ void ACSStringPool::MarkStringArray(const int *strnum, unsigned int count) num &= ~LIBRARYID_MASK; if ((unsigned)num < Pool.Size()) { - Pool[num].LockCount |= 0x80000000; + Pool[num].Mark = true; } } } @@ -565,7 +580,7 @@ void ACSStringPool::MarkStringMap(const FWorldGlobalArray &aray) num &= ~LIBRARYID_MASK; if ((unsigned)num < Pool.Size()) { - Pool[num].LockCount |= 0x80000000; + Pool[num].Mark |= true; } } } @@ -584,7 +599,8 @@ void ACSStringPool::UnlockAll() { for (unsigned int i = 0; i < Pool.Size(); ++i) { - Pool[i].LockCount = 0; + Pool[i].Mark = false; + Pool[i].Locks.Clear(); } } @@ -607,7 +623,7 @@ void ACSStringPool::PurgeStrings() PoolEntry *entry = &Pool[i]; if (entry->Next != FREE_ENTRY) { - if (entry->LockCount == 0) + if (entry->Locks.Size() == 0 && !entry->Mark) { freedcount++; // Mark this entry as free. @@ -627,7 +643,7 @@ void ACSStringPool::PurgeStrings() entry->Next = PoolBuckets[h]; PoolBuckets[h] = i; // Remove MarkString's mark. - entry->LockCount &= 0x7FFFFFFF; + entry->Mark = false; } } } @@ -692,7 +708,8 @@ int ACSStringPool::InsertString(FString &str, unsigned int h, unsigned int bucke entry->Str = str; entry->Hash = h; entry->Next = PoolBuckets[bucketnum]; - entry->LockCount = 0; + entry->Mark = false; + entry->Locks.Clear(); PoolBuckets[bucketnum] = index; return index | STRPOOL_LIBRARYID_OR; } @@ -735,7 +752,8 @@ void ACSStringPool::ReadStrings(FSerializer &file, const char *key) for (auto &p : Pool) { p.Next = FREE_ENTRY; - p.LockCount = 0; + p.Mark = false; + p.Locks.Clear(); } if (file.BeginArray("pool")) { @@ -749,7 +767,7 @@ void ACSStringPool::ReadStrings(FSerializer &file, const char *key) if (ii < Pool.Size()) { file("string", Pool[ii].Str) - ("lockcount", Pool[ii].LockCount); + ("locks", Pool[ii].Locks); unsigned h = SuperFastHash(Pool[ii].Str, Pool[ii].Str.Len()); unsigned bucketnum = h % NUM_BUCKETS; @@ -792,13 +810,9 @@ void ACSStringPool::WriteStrings(FSerializer &file, const char *key) const { if (file.BeginObject(nullptr)) { - if (i == 430) - { - int a = 0; - } file("index", i) ("string", entry->Str) - ("lockcount", entry->LockCount) + ("locks", entry->Locks) .EndObject(); } } @@ -823,12 +837,28 @@ void ACSStringPool::Dump() const { if (Pool[i].Next != FREE_ENTRY) { - Printf("%4u. (%2d) \"%s\"\n", i, Pool[i].LockCount, Pool[i].Str.GetChars()); + Printf("%4u. (%2d) \"%s\"\n", i, Pool[i].Locks.Size(), Pool[i].Str.GetChars()); } } Printf("First free %u\n", FirstFreeEntry); } + +void ACSStringPool::UnlockForLevel(int lnum) +{ + for (unsigned int i = 0; i < Pool.Size(); ++i) + { + if (Pool[i].Next != FREE_ENTRY) + { + auto ndx = Pool[i].Locks.Find(lnum); + if (ndx < Pool[i].Locks.Size()) + { + Pool[i].Locks.Delete(ndx); + } + } + } +} + //============================================================================ // // P_MarkWorldVarStrings @@ -1573,19 +1603,7 @@ void FBehavior::StaticLockLevelVarStrings() void FBehavior::StaticUnlockLevelVarStrings() { - // Unlock map variables. - for (DWORD modnum = 0; modnum < StaticModules.Size(); ++modnum) - { - StaticModules[modnum]->UnlockMapVarStrings(); - } - // Unlock running scripts' local variables. - if (DACSThinker::ActiveThinker != NULL) - { - for (DLevelScript *script = DACSThinker::ActiveThinker->Scripts; script != NULL; script = script->GetNext()) - { - script->UnlockLocalVarStrings(); - } - } + GlobalACSStrings.UnlockForLevel(level.levelnum); } void FBehavior::MarkMapVarStrings() const diff --git a/src/p_acs.h b/src/p_acs.h index a0136ae183..52665a39ba 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -95,6 +95,7 @@ public: void PurgeStrings(); void Clear(); void Dump() const; + void UnlockForLevel(int level) ; void ReadStrings(FSerializer &file, const char *key); void WriteStrings(FSerializer &file, const char *key) const; @@ -112,7 +113,11 @@ private: FString Str; unsigned int Hash; unsigned int Next; - unsigned int LockCount; + bool Mark; + TArray Locks; + + void Lock(); + void Unlock(); }; TArray Pool; unsigned int PoolBuckets[NUM_BUCKETS]; diff --git a/src/p_floor.cpp b/src/p_floor.cpp index 4b1f243d5b..fbfa70f2e7 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -86,7 +86,8 @@ void DFloor::Serialize(FSerializer &arc) ("pausetime", m_PauseTime) ("steptime", m_StepTime) ("persteptime", m_PerStepTime) - ("crushmode", m_Hexencrush); + ("crushmode", m_Hexencrush) + ("instant", m_Instant); } //========================================================================== @@ -129,7 +130,7 @@ void DFloor::Tick () if (m_Type == waitStair) return; - res = m_Sector->MoveFloor (m_Speed, m_FloorDestDist, m_Crush, m_Direction, m_Hexencrush); + res = m_Sector->MoveFloor (m_Speed, m_FloorDestDist, m_Crush, m_Direction, m_Hexencrush, m_Instant); if (res == EMoveResult::pastdest) { @@ -286,6 +287,7 @@ bool P_CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t *line, floor->m_Speed = speed; floor->m_ResetCount = 0; // [RH] floor->m_OrgDist = sec->floorplane.fD(); // [RH] + floor->m_Instant = false; switch (floortype) { @@ -451,6 +453,7 @@ bool P_CreateFloor(sector_t *sec, DFloor::EFloor floortype, line_t *line, (floor->m_Speed >= fabs(sec->floorplane.fD() - floor->m_FloorDestDist))) // moving in one step { floor->StopInterpolation(true); + floor->m_Instant = true; // [Graf Zahl] // Don't make sounds for instant movement hacks but make an exception for diff --git a/src/p_linkedsectors.cpp b/src/p_linkedsectors.cpp index 37743455de..0487ede18e 100644 --- a/src/p_linkedsectors.cpp +++ b/src/p_linkedsectors.cpp @@ -93,12 +93,12 @@ bool sector_t::IsLinked(sector_t *other, bool ceiling) const // //============================================================================ -static bool MoveCeiling(sector_t *sector, int crush, double move) +static bool MoveCeiling(sector_t *sector, int crush, double move, bool instant) { sector->ceilingplane.ChangeHeight (move); sector->ChangePlaneTexZ(sector_t::ceiling, move); - if (P_ChangeSector(sector, crush, move, 1, true)) return false; + if (P_ChangeSector(sector, crush, move, 1, true, instant)) return false; // Don't let the ceiling go below the floor if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() && @@ -108,12 +108,12 @@ static bool MoveCeiling(sector_t *sector, int crush, double move) return true; } -static bool MoveFloor(sector_t *sector, int crush, double move) +static bool MoveFloor(sector_t *sector, int crush, double move, bool instant) { sector->floorplane.ChangeHeight (move); sector->ChangePlaneTexZ(sector_t::floor, move); - if (P_ChangeSector(sector, crush, move, 0, true)) return false; + if (P_ChangeSector(sector, crush, move, 0, true, instant)) return false; // Don't let the floor go above the ceiling if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() && @@ -133,7 +133,7 @@ static bool MoveFloor(sector_t *sector, int crush, double move) // //============================================================================ -bool P_MoveLinkedSectors(sector_t *sector, int crush, double move, bool ceiling) +bool P_MoveLinkedSectors(sector_t *sector, int crush, double move, bool ceiling, bool instant) { extsector_t::linked::plane &scrollplane = ceiling? sector->e->Linked.Ceiling : sector->e->Linked.Floor; bool ok = true; @@ -143,55 +143,55 @@ bool P_MoveLinkedSectors(sector_t *sector, int crush, double move, bool ceiling) switch(scrollplane.Sectors[i].Type) { case LINK_FLOOR: - ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move); + ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move, instant); break; case LINK_CEILING: - ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move); + ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move, instant); break; case LINK_BOTH: if (move < 0) { - ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move); - ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move); + ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move, instant); + ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move, instant); } else { - ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move); - ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move); + ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move, instant); + ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move, instant); } break; case LINK_FLOORMIRROR: - ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move); + ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move, instant); break; case LINK_CEILINGMIRROR: - ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move); + ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move, instant); break; case LINK_BOTHMIRROR: if (move > 0) { - ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move); - ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move); + ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move, instant); + ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move, instant); } else { - ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move); - ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move); + ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move, instant); + ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move, instant); } break; case LINK_FLOOR+LINK_CEILINGMIRROR: - ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move); - ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move); + ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move, instant); + ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move, instant); break; case LINK_CEILING+LINK_FLOORMIRROR: - ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move); - ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move); + ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move, instant); + ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move, instant); break; default: diff --git a/src/p_local.h b/src/p_local.h index 41f980d442..c66792549c 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -303,7 +303,7 @@ enum }; void P_FindFloorCeiling (AActor *actor, int flags=0); -bool P_ChangeSector (sector_t* sector, int crunch, double amt, int floorOrCeil, bool isreset); +bool P_ChangeSector (sector_t* sector, int crunch, double amt, int floorOrCeil, bool isreset, bool instant = false); DAngle P_AimLineAttack(AActor *t1, DAngle angle, double distance, FTranslatedLineTarget *pLineTarget = NULL, DAngle vrange = 0., int flags = 0, AActor *target = NULL, AActor *friender = NULL); diff --git a/src/p_map.cpp b/src/p_map.cpp index 9b21a4c025..1f53181f16 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -5713,6 +5713,7 @@ struct FChangePosition int crushchange; bool nofit; bool movemidtex; + bool instant; }; TArray intersectors; @@ -5993,6 +5994,12 @@ int P_PushUp(AActor *thing, FChangePosition *cpos) intersect->SetZ(oldz); return 2; } + if (cpos->instant) + { + intersect->Prev.Z += intersect->Z() - oldz; + if (intersect->CheckLocalView(consoleplayer)) R_ResetViewInterpolation(); + } + intersect->UpdateRenderSectorList(); } thing->CheckPortalTransition(true); @@ -6084,6 +6091,11 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos) (((cpos->sector->Flags & SECF_FLOORDROP) || cpos->moveamt < 9) && thing->Z() - thing->floorz <= cpos->moveamt)) { + if (cpos->instant) + { + thing->Prev.Z += thing->floorz - oldz; + if (thing->CheckLocalView(consoleplayer)) R_ResetViewInterpolation(); + } thing->SetZ(thing->floorz); P_CheckFakeFloorTriggers(thing, oldz); thing->UpdateRenderSectorList(); @@ -6093,6 +6105,11 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos) { if ((thing->flags & MF_NOGRAVITY) && (thing->flags6 & MF6_RELATIVETOFLOOR)) { + if (cpos->instant) + { + thing->Prev.Z += -oldfloorz + thing->floorz; + if (thing->CheckLocalView(consoleplayer)) R_ResetViewInterpolation(); + } thing->AddZ(-oldfloorz + thing->floorz); P_CheckFakeFloorTriggers(thing, oldz); thing->UpdateRenderSectorList(); @@ -6128,6 +6145,12 @@ void PIT_FloorRaise(AActor *thing, FChangePosition *cpos) return; // do not move bridge things } intersectors.Clear(); + if (cpos->instant) + { + thing->Prev.Z += thing->floorz - thing->Z(); + if (thing->CheckLocalView(consoleplayer)) R_ResetViewInterpolation(); + } + thing->SetZ(thing->floorz); } else @@ -6136,6 +6159,11 @@ void PIT_FloorRaise(AActor *thing, FChangePosition *cpos) { intersectors.Clear(); thing->AddZ(-oldfloorz + thing->floorz); + if (cpos->instant) + { + thing->Prev.Z += -oldfloorz + thing->floorz; + if (thing->CheckLocalView(consoleplayer)) R_ResetViewInterpolation(); + } } else return; } @@ -6268,7 +6296,7 @@ void PIT_CeilingRaise(AActor *thing, FChangePosition *cpos) // //============================================================================= -bool P_ChangeSector(sector_t *sector, int crunch, double amt, int floorOrCeil, bool isreset) +bool P_ChangeSector(sector_t *sector, int crunch, double amt, int floorOrCeil, bool isreset, bool instant) { FChangePosition cpos; void(*iterator)(AActor *, FChangePosition *); @@ -6280,6 +6308,7 @@ bool P_ChangeSector(sector_t *sector, int crunch, double amt, int floorOrCeil, b cpos.moveamt = fabs(amt); cpos.movemidtex = false; cpos.sector = sector; + cpos.instant = instant; // Also process all sectors that have 3D floors transferred from the // changed sector. diff --git a/src/p_setup.cpp b/src/p_setup.cpp index d3bcc742d7..43d1833afe 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -4080,6 +4080,13 @@ void P_SetupLevel (const char *lumpname, int position) // set up world state P_SpawnSpecials (); + // disable reflective planes on sloped sectors. + for (auto i = 0; i < numsectors; i++) + { + if (sectors[i].floorplane.isSlope()) sectors[i].reflect[sector_t::floor] = 0; + if (sectors[i].ceilingplane.isSlope()) sectors[i].reflect[sector_t::ceiling] = 0; + } + // This must be done BEFORE the PolyObj Spawn!!! Renderer->PreprocessLevel(); diff --git a/src/p_spec.h b/src/p_spec.h index 8a0729d6a1..ea98c82c14 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -515,6 +515,7 @@ public: EFloor m_Type; int m_Crush; bool m_Hexencrush; + bool m_Instant; int m_Direction; secspecial_t m_NewSpecial; FTextureID m_Texture; diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 2ef8a9ced0..15d1b48d3b 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -1563,6 +1563,14 @@ public: sec->terrainnum[sector_t::ceiling] = P_FindTerrain(CheckString(key)); break; + case NAME_floor_reflect: + sec->reflect[sector_t::floor] = (float)CheckFloat(key); + break; + + case NAME_ceiling_reflect: + sec->reflect[sector_t::ceiling] = (float)CheckFloat(key); + break; + case NAME_MoreIds: // delay parsing of the tag string until parsing of the sector is complete // This ensures that the ID is always the first tag in the list. diff --git a/src/r_defs.h b/src/r_defs.h index 36318be856..ece4218673 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -627,9 +627,9 @@ struct sector_t // Member functions private: - bool MoveAttached(int crush, double move, int floorOrCeiling, bool resetfailed); + bool MoveAttached(int crush, double move, int floorOrCeiling, bool resetfailed, bool instant = false); public: - EMoveResult MoveFloor(double speed, double dest, int crush, int direction, bool hexencrush); + EMoveResult MoveFloor(double speed, double dest, int crush, int direction, bool hexencrush, bool instant = false); EMoveResult MoveCeiling(double speed, double dest, int crush, int direction, bool hexencrush); inline EMoveResult MoveFloor(double speed, double dest, int direction) diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index 6db88ab0ad..658c4aa510 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -13,6 +13,8 @@ class Object native native static void C_MidPrint(string fontname, string textlabel, bool bold = false); // always uses the stringtable. native static uint BAM(double angle); + native Name GetClassName(); + /*virtual*/ native void Destroy(); }