This commit is contained in:
Rachael Alexanderson 2016-12-27 19:37:53 -05:00
commit 92e4eef553
19 changed files with 178 additions and 91 deletions

View File

@ -215,6 +215,9 @@ Note: All <bool> fields default to false unless mentioned otherwise.
floorterrain = <string>; // Sets the terrain for the sector's floor. Default = 'use the flat texture's terrain definition.' floorterrain = <string>; // Sets the terrain for the sector's floor. Default = 'use the flat texture's terrain definition.'
ceilingterrain = <string>; // Sets the terrain for the sector's ceiling. Default = 'use the flat texture's terrain definition.' ceilingterrain = <string>; // Sets the terrain for the sector's ceiling. Default = 'use the flat texture's terrain definition.'
floor_reflect = <float>; // reflectiveness of floor (OpenGL only, not functional on sloped sectors)
ceiling_reflect = <float>; // reflectiveness of ceiling (OpenGL only, not functional on sloped sectors)
portal_ceil_alpha = <float> // translucency of ceiling portal (default is 0 (not visible)) portal_ceil_alpha = <float> // translucency of ceiling portal (default is 0 (not visible))
portal_ceil_blocksound = <bool> // ceiling portal blocks sound. portal_ceil_blocksound = <bool> // ceiling portal blocks sound.
portal_ceil_disabled = <bool> // ceiling portal disabled. portal_ceil_disabled = <bool> // ceiling portal disabled.
@ -406,6 +409,9 @@ Added 'moreids' for linedefs and sectors.
added clarification about character encoding added clarification about character encoding
added sector damage properties. added sector damage properties.
1.27 05.01.2016
floor_reflect and ceiling_reflect.
=============================================================================== ===============================================================================
EOF EOF
=============================================================================== ===============================================================================

View File

@ -552,3 +552,9 @@ void DObject::CheckIfSerialized () const
} }
} }
DEFINE_ACTION_FUNCTION(DObject, GetClassName)
{
PARAM_SELF_PROLOGUE(DObject);
ACTION_RETURN_INT(self->GetClass()->TypeName);
}

View File

@ -134,17 +134,17 @@ DMovingCeiling::DMovingCeiling (sector_t *sector, bool interpolate)
if (interpolate) interpolation = sector->SetInterpolation(sector_t::CeilingMove, true); 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; 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_MoveLinkedSectors(this, crush, -move, !!floorOrCeiling, instant);
P_Scroll3dMidtex(this, crush, -move, !!floorOrCeiling); P_Scroll3dMidtex(this, crush, -move, !!floorOrCeiling, instant);
return false; return false;
} }
return true; 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) // (Use -1 to prevent it from trying to crush)
// dest is the desired d value for the plane // 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; bool flag;
double lastpos; double lastpos;
@ -174,15 +174,15 @@ EMoveResult sector_t::MoveFloor(double speed, double dest, int crush, int direct
{ {
move = floorplane.HeightDiff(lastpos, dest); 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); floorplane.setD(dest);
flag = P_ChangeSector(this, crush, move, 0, false); flag = P_ChangeSector(this, crush, move, 0, false, instant);
if (flag) if (flag)
{ {
floorplane.setD(lastpos); floorplane.setD(lastpos);
P_ChangeSector(this, crush, -move, 0, true); P_ChangeSector(this, crush, -move, 0, true, instant);
MoveAttached(crush, -move, 0, false); MoveAttached(crush, -move, 0, false, instant);
} }
else else
{ {
@ -193,16 +193,16 @@ EMoveResult sector_t::MoveFloor(double speed, double dest, int crush, int direct
} }
else else
{ {
if (!MoveAttached(crush, -speed, 0, true)) return EMoveResult::crushed; if (!MoveAttached(crush, -speed, 0, true, instant)) return EMoveResult::crushed;
floorplane.setD(movedest); floorplane.setD(movedest);
flag = P_ChangeSector(this, crush, -speed, 0, false); flag = P_ChangeSector(this, crush, -speed, 0, false, instant);
if (flag) if (flag)
{ {
floorplane.setD(lastpos); floorplane.setD(lastpos);
P_ChangeSector(this, crush, speed, 0, true); P_ChangeSector(this, crush, speed, 0, true, instant);
MoveAttached(crush, speed, 0, false); MoveAttached(crush, speed, 0, false, instant);
return EMoveResult::crushed; return EMoveResult::crushed;
} }
else else
@ -231,16 +231,16 @@ EMoveResult sector_t::MoveFloor(double speed, double dest, int crush, int direct
{ {
move = floorplane.HeightDiff(lastpos, dest); 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); floorplane.setD(dest);
flag = P_ChangeSector(this, crush, move, 0, false); flag = P_ChangeSector(this, crush, move, 0, false, instant);
if (flag) if (flag)
{ {
floorplane.setD(lastpos); floorplane.setD(lastpos);
P_ChangeSector(this, crush, -move, 0, true); P_ChangeSector(this, crush, -move, 0, true, instant);
MoveAttached(crush, -move, 0, false); MoveAttached(crush, -move, 0, false, instant);
} }
else else
{ {
@ -251,12 +251,12 @@ EMoveResult sector_t::MoveFloor(double speed, double dest, int crush, int direct
} }
else else
{ {
if (!MoveAttached(crush, speed, 0, true)) return EMoveResult::crushed; if (!MoveAttached(crush, speed, 0, true, instant)) return EMoveResult::crushed;
floorplane.setD(movedest); floorplane.setD(movedest);
// COULD GET CRUSHED // COULD GET CRUSHED
flag = P_ChangeSector(this, crush, speed, 0, false); flag = P_ChangeSector(this, crush, speed, 0, false, instant);
if (flag) if (flag)
{ {
if (crush >= 0 && !hexencrush) if (crush >= 0 && !hexencrush)
@ -266,8 +266,8 @@ EMoveResult sector_t::MoveFloor(double speed, double dest, int crush, int direct
return EMoveResult::crushed; return EMoveResult::crushed;
} }
floorplane.setD(lastpos); floorplane.setD(lastpos);
P_ChangeSector(this, crush, -speed, 0, true); P_ChangeSector(this, crush, -speed, 0, true, instant);
MoveAttached(crush, -speed, 0, false); MoveAttached(crush, -speed, 0, false, instant);
return EMoveResult::crushed; return EMoveResult::crushed;
} }
ChangePlaneTexZ(sector_t::floor, floorplane.HeightDiff(lastpos)); ChangePlaneTexZ(sector_t::floor, floorplane.HeightDiff(lastpos));

View File

@ -1894,7 +1894,7 @@ void APowerMorph::InitEffect( )
if (Owner != nullptr && Owner->player != nullptr && PlayerClass != nullptr) if (Owner != nullptr && Owner->player != nullptr && PlayerClass != nullptr)
{ {
player_t *realplayer = Owner->player; // Remember the identity of the player 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 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) ItemFlags |= IF_CREATECOPYMOVED; // Let the caller know the "real" owner has changed (to the morphed actor)

View File

@ -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. // If this isn't the unmorphed original copy of a player, destroy it, because it's extra.
for (i = 0; i < MAXPLAYERS; ++i) 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; break;
} }

View File

@ -575,6 +575,8 @@ xx(damageterraineffect)
xx(damagehazard) xx(damagehazard)
xx(floorterrain) xx(floorterrain)
xx(ceilingterrain) xx(ceilingterrain)
xx(floor_reflect)
xx(ceiling_reflect)
// USDF keywords // USDF keywords
xx(Amount) xx(Amount)

View File

@ -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; 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++) 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; return !res;
} }

View File

@ -9,14 +9,14 @@ struct sector_t;
struct line_t; struct line_t;
class AActor; 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<DInterpolation *> &list, sector_t *sec, bool ceiling); void P_Start3dMidtexInterpolations(TArray<DInterpolation *> &list, sector_t *sec, bool ceiling);
void P_Attach3dMidtexLinesToSector(sector_t *dest, int lineid, int tag, 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_GetMidTexturePosition(const line_t *line, int sideno, double *ptextop, double *ptexbot);
bool P_Check3dMidSwitch(AActor *actor, line_t *line, int side); 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_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<DInterpolation *> &list, sector_t *sector, bool ceiling); void P_StartLinkedSectorInterpolations(TArray<DInterpolation *> &list, sector_t *sector, bool ceiling);
bool P_AddSectorLinks(sector_t *control, int tag, INTBOOL ceiling, int movetype); bool P_AddSectorLinks(sector_t *control, int tag, INTBOOL ceiling, int movetype);
void P_AddSectorLinksByID(sector_t *control, int id, INTBOOL ceiling); void P_AddSectorLinksByID(sector_t *control, int id, INTBOOL ceiling);

View File

@ -343,6 +343,23 @@ FACSStack::~FACSStack()
ACSStringPool GlobalACSStrings; 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() ACSStringPool::ACSStringPool()
{ {
memset(PoolBuckets, 0xFF, sizeof(PoolBuckets)); memset(PoolBuckets, 0xFF, sizeof(PoolBuckets));
@ -430,7 +447,7 @@ void ACSStringPool::LockString(int strnum)
assert((strnum & LIBRARYID_MASK) == STRPOOL_LIBRARYID_OR); assert((strnum & LIBRARYID_MASK) == STRPOOL_LIBRARYID_OR);
strnum &= ~LIBRARYID_MASK; strnum &= ~LIBRARYID_MASK;
assert((unsigned)strnum < Pool.Size()); 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); assert((strnum & LIBRARYID_MASK) == STRPOOL_LIBRARYID_OR);
strnum &= ~LIBRARYID_MASK; strnum &= ~LIBRARYID_MASK;
assert((unsigned)strnum < Pool.Size()); assert((unsigned)strnum < Pool.Size());
assert(Pool[strnum].LockCount > 0); Pool[strnum].Unlock();
Pool[strnum].LockCount--;
} }
//============================================================================ //============================================================================
@ -464,7 +480,7 @@ void ACSStringPool::MarkString(int strnum)
assert((strnum & LIBRARYID_MASK) == STRPOOL_LIBRARYID_OR); assert((strnum & LIBRARYID_MASK) == STRPOOL_LIBRARYID_OR);
strnum &= ~LIBRARYID_MASK; strnum &= ~LIBRARYID_MASK;
assert((unsigned)strnum < Pool.Size()); 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; num &= ~LIBRARYID_MASK;
if ((unsigned)num < Pool.Size()) 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; num &= ~LIBRARYID_MASK;
if ((unsigned)num < Pool.Size()) if ((unsigned)num < Pool.Size())
{ {
assert(Pool[num].LockCount > 0); Pool[num].Unlock();
Pool[num].LockCount--;
} }
} }
} }
@ -538,7 +553,7 @@ void ACSStringPool::MarkStringArray(const int *strnum, unsigned int count)
num &= ~LIBRARYID_MASK; num &= ~LIBRARYID_MASK;
if ((unsigned)num < Pool.Size()) 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; num &= ~LIBRARYID_MASK;
if ((unsigned)num < Pool.Size()) 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) 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]; PoolEntry *entry = &Pool[i];
if (entry->Next != FREE_ENTRY) if (entry->Next != FREE_ENTRY)
{ {
if (entry->LockCount == 0) if (entry->Locks.Size() == 0 && !entry->Mark)
{ {
freedcount++; freedcount++;
// Mark this entry as free. // Mark this entry as free.
@ -627,7 +643,7 @@ void ACSStringPool::PurgeStrings()
entry->Next = PoolBuckets[h]; entry->Next = PoolBuckets[h];
PoolBuckets[h] = i; PoolBuckets[h] = i;
// Remove MarkString's mark. // 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->Str = str;
entry->Hash = h; entry->Hash = h;
entry->Next = PoolBuckets[bucketnum]; entry->Next = PoolBuckets[bucketnum];
entry->LockCount = 0; entry->Mark = false;
entry->Locks.Clear();
PoolBuckets[bucketnum] = index; PoolBuckets[bucketnum] = index;
return index | STRPOOL_LIBRARYID_OR; return index | STRPOOL_LIBRARYID_OR;
} }
@ -735,7 +752,8 @@ void ACSStringPool::ReadStrings(FSerializer &file, const char *key)
for (auto &p : Pool) for (auto &p : Pool)
{ {
p.Next = FREE_ENTRY; p.Next = FREE_ENTRY;
p.LockCount = 0; p.Mark = false;
p.Locks.Clear();
} }
if (file.BeginArray("pool")) if (file.BeginArray("pool"))
{ {
@ -749,7 +767,7 @@ void ACSStringPool::ReadStrings(FSerializer &file, const char *key)
if (ii < Pool.Size()) if (ii < Pool.Size())
{ {
file("string", Pool[ii].Str) file("string", Pool[ii].Str)
("lockcount", Pool[ii].LockCount); ("locks", Pool[ii].Locks);
unsigned h = SuperFastHash(Pool[ii].Str, Pool[ii].Str.Len()); unsigned h = SuperFastHash(Pool[ii].Str, Pool[ii].Str.Len());
unsigned bucketnum = h % NUM_BUCKETS; unsigned bucketnum = h % NUM_BUCKETS;
@ -792,13 +810,9 @@ void ACSStringPool::WriteStrings(FSerializer &file, const char *key) const
{ {
if (file.BeginObject(nullptr)) if (file.BeginObject(nullptr))
{ {
if (i == 430)
{
int a = 0;
}
file("index", i) file("index", i)
("string", entry->Str) ("string", entry->Str)
("lockcount", entry->LockCount) ("locks", entry->Locks)
.EndObject(); .EndObject();
} }
} }
@ -823,12 +837,28 @@ void ACSStringPool::Dump() const
{ {
if (Pool[i].Next != FREE_ENTRY) 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); 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 // P_MarkWorldVarStrings
@ -1573,19 +1603,7 @@ void FBehavior::StaticLockLevelVarStrings()
void FBehavior::StaticUnlockLevelVarStrings() void FBehavior::StaticUnlockLevelVarStrings()
{ {
// Unlock map variables. GlobalACSStrings.UnlockForLevel(level.levelnum);
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();
}
}
} }
void FBehavior::MarkMapVarStrings() const void FBehavior::MarkMapVarStrings() const

View File

@ -95,6 +95,7 @@ public:
void PurgeStrings(); void PurgeStrings();
void Clear(); void Clear();
void Dump() const; void Dump() const;
void UnlockForLevel(int level) ;
void ReadStrings(FSerializer &file, const char *key); void ReadStrings(FSerializer &file, const char *key);
void WriteStrings(FSerializer &file, const char *key) const; void WriteStrings(FSerializer &file, const char *key) const;
@ -112,7 +113,11 @@ private:
FString Str; FString Str;
unsigned int Hash; unsigned int Hash;
unsigned int Next; unsigned int Next;
unsigned int LockCount; bool Mark;
TArray<int> Locks;
void Lock();
void Unlock();
}; };
TArray<PoolEntry> Pool; TArray<PoolEntry> Pool;
unsigned int PoolBuckets[NUM_BUCKETS]; unsigned int PoolBuckets[NUM_BUCKETS];

View File

@ -86,7 +86,8 @@ void DFloor::Serialize(FSerializer &arc)
("pausetime", m_PauseTime) ("pausetime", m_PauseTime)
("steptime", m_StepTime) ("steptime", m_StepTime)
("persteptime", m_PerStepTime) ("persteptime", m_PerStepTime)
("crushmode", m_Hexencrush); ("crushmode", m_Hexencrush)
("instant", m_Instant);
} }
//========================================================================== //==========================================================================
@ -129,7 +130,7 @@ void DFloor::Tick ()
if (m_Type == waitStair) if (m_Type == waitStair)
return; 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) 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_Speed = speed;
floor->m_ResetCount = 0; // [RH] floor->m_ResetCount = 0; // [RH]
floor->m_OrgDist = sec->floorplane.fD(); // [RH] floor->m_OrgDist = sec->floorplane.fD(); // [RH]
floor->m_Instant = false;
switch (floortype) 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->m_Speed >= fabs(sec->floorplane.fD() - floor->m_FloorDestDist))) // moving in one step
{ {
floor->StopInterpolation(true); floor->StopInterpolation(true);
floor->m_Instant = true;
// [Graf Zahl] // [Graf Zahl]
// Don't make sounds for instant movement hacks but make an exception for // Don't make sounds for instant movement hacks but make an exception for

View File

@ -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->ceilingplane.ChangeHeight (move);
sector->ChangePlaneTexZ(sector_t::ceiling, 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 // Don't let the ceiling go below the floor
if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() && if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() &&
@ -108,12 +108,12 @@ static bool MoveCeiling(sector_t *sector, int crush, double move)
return true; 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->floorplane.ChangeHeight (move);
sector->ChangePlaneTexZ(sector_t::floor, 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 // Don't let the floor go above the ceiling
if (!sector->ceilingplane.isSlope() && !sector->floorplane.isSlope() && 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; extsector_t::linked::plane &scrollplane = ceiling? sector->e->Linked.Ceiling : sector->e->Linked.Floor;
bool ok = true; bool ok = true;
@ -143,55 +143,55 @@ bool P_MoveLinkedSectors(sector_t *sector, int crush, double move, bool ceiling)
switch(scrollplane.Sectors[i].Type) switch(scrollplane.Sectors[i].Type)
{ {
case LINK_FLOOR: case LINK_FLOOR:
ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move); ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move, instant);
break; break;
case LINK_CEILING: case LINK_CEILING:
ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move); ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move, instant);
break; break;
case LINK_BOTH: case LINK_BOTH:
if (move < 0) if (move < 0)
{ {
ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move); ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move, instant);
ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move); ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move, instant);
} }
else else
{ {
ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move); ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move, instant);
ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move); ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move, instant);
} }
break; break;
case LINK_FLOORMIRROR: case LINK_FLOORMIRROR:
ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move); ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move, instant);
break; break;
case LINK_CEILINGMIRROR: case LINK_CEILINGMIRROR:
ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move); ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move, instant);
break; break;
case LINK_BOTHMIRROR: case LINK_BOTHMIRROR:
if (move > 0) if (move > 0)
{ {
ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move); ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move, instant);
ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move); ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move, instant);
} }
else else
{ {
ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move); ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move, instant);
ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move); ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move, instant);
} }
break; break;
case LINK_FLOOR+LINK_CEILINGMIRROR: case LINK_FLOOR+LINK_CEILINGMIRROR:
ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move); ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, move, instant);
ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move); ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, -move, instant);
break; break;
case LINK_CEILING+LINK_FLOORMIRROR: case LINK_CEILING+LINK_FLOORMIRROR:
ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move); ok &= MoveFloor(scrollplane.Sectors[i].Sector, crush, -move, instant);
ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move); ok &= MoveCeiling(scrollplane.Sectors[i].Sector, crush, move, instant);
break; break;
default: default:

View File

@ -303,7 +303,7 @@ enum
}; };
void P_FindFloorCeiling (AActor *actor, int flags=0); 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); DAngle P_AimLineAttack(AActor *t1, DAngle angle, double distance, FTranslatedLineTarget *pLineTarget = NULL, DAngle vrange = 0., int flags = 0, AActor *target = NULL, AActor *friender = NULL);

View File

@ -5713,6 +5713,7 @@ struct FChangePosition
int crushchange; int crushchange;
bool nofit; bool nofit;
bool movemidtex; bool movemidtex;
bool instant;
}; };
TArray<AActor *> intersectors; TArray<AActor *> intersectors;
@ -5993,6 +5994,12 @@ int P_PushUp(AActor *thing, FChangePosition *cpos)
intersect->SetZ(oldz); intersect->SetZ(oldz);
return 2; return 2;
} }
if (cpos->instant)
{
intersect->Prev.Z += intersect->Z() - oldz;
if (intersect->CheckLocalView(consoleplayer)) R_ResetViewInterpolation();
}
intersect->UpdateRenderSectorList(); intersect->UpdateRenderSectorList();
} }
thing->CheckPortalTransition(true); thing->CheckPortalTransition(true);
@ -6084,6 +6091,11 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos)
(((cpos->sector->Flags & SECF_FLOORDROP) || cpos->moveamt < 9) (((cpos->sector->Flags & SECF_FLOORDROP) || cpos->moveamt < 9)
&& thing->Z() - thing->floorz <= cpos->moveamt)) && 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); thing->SetZ(thing->floorz);
P_CheckFakeFloorTriggers(thing, oldz); P_CheckFakeFloorTriggers(thing, oldz);
thing->UpdateRenderSectorList(); thing->UpdateRenderSectorList();
@ -6093,6 +6105,11 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos)
{ {
if ((thing->flags & MF_NOGRAVITY) && (thing->flags6 & MF6_RELATIVETOFLOOR)) 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); thing->AddZ(-oldfloorz + thing->floorz);
P_CheckFakeFloorTriggers(thing, oldz); P_CheckFakeFloorTriggers(thing, oldz);
thing->UpdateRenderSectorList(); thing->UpdateRenderSectorList();
@ -6128,6 +6145,12 @@ void PIT_FloorRaise(AActor *thing, FChangePosition *cpos)
return; // do not move bridge things return; // do not move bridge things
} }
intersectors.Clear(); intersectors.Clear();
if (cpos->instant)
{
thing->Prev.Z += thing->floorz - thing->Z();
if (thing->CheckLocalView(consoleplayer)) R_ResetViewInterpolation();
}
thing->SetZ(thing->floorz); thing->SetZ(thing->floorz);
} }
else else
@ -6136,6 +6159,11 @@ void PIT_FloorRaise(AActor *thing, FChangePosition *cpos)
{ {
intersectors.Clear(); intersectors.Clear();
thing->AddZ(-oldfloorz + thing->floorz); thing->AddZ(-oldfloorz + thing->floorz);
if (cpos->instant)
{
thing->Prev.Z += -oldfloorz + thing->floorz;
if (thing->CheckLocalView(consoleplayer)) R_ResetViewInterpolation();
}
} }
else return; 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; FChangePosition cpos;
void(*iterator)(AActor *, FChangePosition *); 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.moveamt = fabs(amt);
cpos.movemidtex = false; cpos.movemidtex = false;
cpos.sector = sector; cpos.sector = sector;
cpos.instant = instant;
// Also process all sectors that have 3D floors transferred from the // Also process all sectors that have 3D floors transferred from the
// changed sector. // changed sector.

View File

@ -4080,6 +4080,13 @@ void P_SetupLevel (const char *lumpname, int position)
// set up world state // set up world state
P_SpawnSpecials (); 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!!! // This must be done BEFORE the PolyObj Spawn!!!
Renderer->PreprocessLevel(); Renderer->PreprocessLevel();

View File

@ -515,6 +515,7 @@ public:
EFloor m_Type; EFloor m_Type;
int m_Crush; int m_Crush;
bool m_Hexencrush; bool m_Hexencrush;
bool m_Instant;
int m_Direction; int m_Direction;
secspecial_t m_NewSpecial; secspecial_t m_NewSpecial;
FTextureID m_Texture; FTextureID m_Texture;

View File

@ -1563,6 +1563,14 @@ public:
sec->terrainnum[sector_t::ceiling] = P_FindTerrain(CheckString(key)); sec->terrainnum[sector_t::ceiling] = P_FindTerrain(CheckString(key));
break; 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: case NAME_MoreIds:
// delay parsing of the tag string until parsing of the sector is complete // 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. // This ensures that the ID is always the first tag in the list.

View File

@ -627,9 +627,9 @@ struct sector_t
// Member functions // Member functions
private: 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: 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); EMoveResult MoveCeiling(double speed, double dest, int crush, int direction, bool hexencrush);
inline EMoveResult MoveFloor(double speed, double dest, int direction) inline EMoveResult MoveFloor(double speed, double dest, int direction)

View File

@ -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 void C_MidPrint(string fontname, string textlabel, bool bold = false); // always uses the stringtable.
native static uint BAM(double angle); native static uint BAM(double angle);
native Name GetClassName();
/*virtual*/ native void Destroy(); /*virtual*/ native void Destroy();
} }