- use map time, not hub time for map actions.

This commit is contained in:
Christoph Oelckers 2019-01-10 03:42:54 +01:00
parent 7e3ef4d72d
commit ad17bce1f0
9 changed files with 38 additions and 38 deletions

View file

@ -637,9 +637,9 @@ struct LevelLocals native
native readonly Array<@Vertex> Vertexes; native readonly Array<@Vertex> Vertexes;
native internal Array<@SectorPortal> SectorPortals; native internal Array<@SectorPortal> SectorPortals;
native readonly int time; deprecated("3.8") native readonly int time;
native readonly int maptime; native readonly int maptime;
native readonly int totaltime; deprecated("3.8") native readonly int totaltime;
native readonly int starttime; native readonly int starttime;
native readonly int partime; native readonly int partime;
native readonly int sucktime; native readonly int sucktime;
@ -650,10 +650,10 @@ struct LevelLocals native
native readonly String MapName; native readonly String MapName;
native String NextMap; native String NextMap;
native String NextSecretMap; native String NextSecretMap;
native String F1Pic; deprecated("3.8") native readonly String F1Pic;
native readonly int maptype; native readonly int maptype;
native readonly String Music; deprecated("3.8") native readonly String Music;
native readonly int musicorder; deprecated("3.8") native readonly int musicorder;
native readonly TextureID skytexture1; native readonly TextureID skytexture1;
native readonly TextureID skytexture2; native readonly TextureID skytexture2;
native float skyspeed1; native float skyspeed1;
@ -699,7 +699,7 @@ struct LevelLocals native
native bool ExecuteSpecial(int special, Actor activator, line linedef, bool lineside, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0, int arg5 = 0); native bool ExecuteSpecial(int special, Actor activator, line linedef, bool lineside, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0, int arg5 = 0);
native void GiveSecret(Actor activator, bool printmsg = true, bool playsound = true); native void GiveSecret(Actor activator, bool printmsg = true, bool playsound = true);
native void StartSlideshow(Name whichone = 'none'); native void StartSlideshow(Name whichone = 'none');
native static void WorldDone(); native void WorldDone();
native static void RemoveAllBots(bool fromlist); native static void RemoveAllBots(bool fromlist);
native static Vector2 GetAutomapPosition(); native static Vector2 GetAutomapPosition();
native void SetInterMusic(String nextmap); native void SetInterMusic(String nextmap);

View file

@ -310,7 +310,7 @@ class Whirlwind : Actor
target.Vel.Y += Random2[WhirlwindDamage]() / 64.; target.Vel.Y += Random2[WhirlwindDamage]() / 64.;
} }
if ((Level.time & 16) && !target.bBoss && !target.bDontThrust) if ((Level.maptime & 16) && !target.bBoss && !target.bDontThrust)
{ {
randVal = min(160, random[WhirlwindSeek]()); randVal = min(160, random[WhirlwindSeek]());
target.Vel.Z += randVal / 32.; target.Vel.Z += randVal / 32.;
@ -319,7 +319,7 @@ class Whirlwind : Actor
target.Vel.Z = 12; target.Vel.Z = 12;
} }
} }
if (!(Level.time & 7)) if (!(Level.maptime & 7))
{ {
target.DamageMobj (null, target, 3, 'Melee'); target.DamageMobj (null, target, 3, 'Melee');
} }

View file

@ -461,7 +461,7 @@ class HolySpirit : Actor
} }
VelFromAngle(); VelFromAngle();
if (!(Level.time&15) if (!(Level.maptime&15)
|| pos.z > target.pos.z + target.height || pos.z > target.pos.z + target.height
|| pos.z + height < target.pos.z) || pos.z + height < target.pos.z)
{ {
@ -503,7 +503,7 @@ class HolySpirit : Actor
if (tracer) if (tracer)
{ {
CHolySeekerMissile (args[0], args[0]*2.); CHolySeekerMissile (args[0], args[0]*2.);
if (!((Level.time+7)&15)) if (!((Level.maptime+7)&15))
{ {
args[0] = 5+(random[HolySeeker]()/20); args[0] = 5+(random[HolySeeker]()/20);
} }
@ -677,4 +677,4 @@ extend class Actor
} }
} }
} }

View file

@ -430,7 +430,7 @@ class KoraxSpirit : Actor
} }
VelFromAngle(); VelFromAngle();
if (!(Level.time&15) if (!(Level.maptime&15)
|| pos.z > target.pos.z + target.Default.Height || pos.z > target.pos.z + target.Default.Height
|| pos.z + height < target.pos.z) || pos.z + height < target.pos.z)
{ {

View file

@ -121,7 +121,7 @@ class Lightning : Actor
thing.Vel.X += Vel.X / 16; thing.Vel.X += Vel.X / 16;
thing.Vel.Y += Vel.Y / 16; thing.Vel.Y += Vel.Y / 16;
} }
if ((!thing.player && !thing.bBoss) || !(Level.time&1)) if ((!thing.player && !thing.bBoss) || !(Level.maptime & 1))
{ {
thing.DamageMobj(self, target, 3, 'Electric'); thing.DamageMobj(self, target, 3, 'Electric');
A_PlaySound(AttackSound, CHAN_WEAPON|CHAN_NOSTOP, 1, false); A_PlaySound(AttackSound, CHAN_WEAPON|CHAN_NOSTOP, 1, false);
@ -411,7 +411,7 @@ class LightningZap : Actor
{ {
lmo.tracer = thing; lmo.tracer = thing;
} }
if (!(Level.time&3)) if (!(Level.maptime&3))
{ {
lmo.health--; lmo.health--;
} }

View file

@ -364,7 +364,7 @@ class PowerInvulnerable : Powerup
// Don't mess with the translucency settings if an // Don't mess with the translucency settings if an
// invisibility powerup is active. // invisibility powerup is active.
let alpha = Owner.Alpha; let alpha = Owner.Alpha;
if (!(Level.time & 7) && alpha > 0 && alpha < 1) if (!(Level.maptime & 7) && alpha > 0 && alpha < 1)
{ {
if (alpha == HX_SHADOW) if (alpha == HX_SHADOW)
{ {
@ -376,7 +376,7 @@ class PowerInvulnerable : Powerup
Owner.bNonShootable = true; Owner.bNonShootable = true;
} }
} }
if (!(Level.time & 31)) if (!(Level.maptime & 31))
{ {
if (alpha == 0) if (alpha == 0)
{ {
@ -806,7 +806,7 @@ class PowerMask : PowerIronFeet
override void DoEffect () override void DoEffect ()
{ {
Super.DoEffect (); Super.DoEffect ();
if (!(Level.time & 0x3f)) if (!(Level.maptime & 0x3f))
{ {
Owner.A_PlaySound ("misc/mask", CHAN_AUTO); Owner.A_PlaySound ("misc/mask", CHAN_AUTO);
} }
@ -894,7 +894,7 @@ class PowerTorch : PowerLightAmp
{ {
Powerup.DoEffect (); Powerup.DoEffect ();
if (!(Level.time & 16) && Owner.player != NULL) if (!(Level.maptime & 16) && Owner.player != NULL)
{ {
if (NewTorch != 0) if (NewTorch != 0)
{ {
@ -1014,7 +1014,7 @@ class PowerFlight : Powerup
} }
TextureID picnum = TexMan.CheckForTexture ("SPFLY0", TexMan.Type_MiscPatch); TextureID picnum = TexMan.CheckForTexture ("SPFLY0", TexMan.Type_MiscPatch);
int frame = (Level.time/3) & 15; int frame = (Level.maptime/3) & 15;
if (!picnum.isValid()) if (!picnum.isValid())
{ {
@ -1191,7 +1191,7 @@ class PowerSpeed : Powerup
if (NoTrail) if (NoTrail)
return; return;
if (Level.time & 1) if (Level.maptime & 1)
return; return;
// Check if another speed item is present to avoid multiple drawing of the speed trail. // Check if another speed item is present to avoid multiple drawing of the speed trail.
@ -1529,7 +1529,7 @@ class PowerTimeFreezer : Powerup
EffectTics++; EffectTics++;
} }
// Make sure the effect starts and ends on an even tic. // Make sure the effect starts and ends on an even tic.
if ((Level.time & 1) == 0) if ((Level.maptime & 1) == 0)
{ {
Level.frozen = true;; Level.frozen = true;;
} }
@ -1553,13 +1553,13 @@ class PowerTimeFreezer : Powerup
// [RH] Do not change LEVEL_FROZEN on odd tics, or the Revenant's tracer // [RH] Do not change LEVEL_FROZEN on odd tics, or the Revenant's tracer
// will get thrown off. // will get thrown off.
// [ED850] Don't change it if the player is predicted either. // [ED850] Don't change it if the player is predicted either.
if (Level.time & 1 || (Owner != null && Owner.player != null && Owner.player.cheats & CF_PREDICTING)) if (Level.maptime & 1 || (Owner != null && Owner.player != null && Owner.player.cheats & CF_PREDICTING))
{ {
return; return;
} }
// [RH] The "blinking" can't check against EffectTics exactly or it will // [RH] The "blinking" can't check against EffectTics exactly or it will
// never happen, because InitEffect ensures that EffectTics will always // never happen, because InitEffect ensures that EffectTics will always
// be odd when Level.time is even. // be odd when Level.maptime is even.
Level.frozen = ( EffectTics > 4*32 Level.frozen = ( EffectTics > 4*32
|| (( EffectTics > 3*32 && EffectTics <= 4*32 ) && ((EffectTics + 1) & 15) != 0 ) || (( EffectTics > 3*32 && EffectTics <= 4*32 ) && ((EffectTics + 1) & 15) != 0 )
|| (( EffectTics > 2*32 && EffectTics <= 3*32 ) && ((EffectTics + 1) & 7) != 0 ) || (( EffectTics > 2*32 && EffectTics <= 3*32 ) && ((EffectTics + 1) & 7) != 0 )
@ -1791,7 +1791,7 @@ class PowerRegeneration : Powerup
override void DoEffect() override void DoEffect()
{ {
Super.DoEffect(); Super.DoEffect();
if (Owner != null && Owner.health > 0 && (Level.time & 31) == 0) if (Owner != null && Owner.health > 0 && (Level.maptime & 31) == 0)
{ {
if (Owner.GiveBody(int(Strength))) if (Owner.GiveBody(int(Strength)))
{ {

View file

@ -267,12 +267,12 @@ class PathFollower : Actor
bJustStepped = false; bJustStepped = false;
if (CurrNode.args[2]) if (CurrNode.args[2])
{ {
HoldTime = Level.time + CurrNode.args[2] * TICRATE / 8; HoldTime = Level.maptime + CurrNode.args[2] * TICRATE / 8;
SetXYZ(CurrNode.Pos); SetXYZ(CurrNode.Pos);
} }
} }
if (HoldTime > Level.time) if (HoldTime > Level.maptime)
return; return;
// Splines must have a previous node. // Splines must have a previous node.

View file

@ -585,7 +585,7 @@ class PlayerPawn : Actor
{ {
if (player.health > 0) if (player.health > 0)
{ {
angle = Level.time / (120 * TICRATE / 35.) * 360.; angle = Level.maptime / (120 * TICRATE / 35.) * 360.;
bob = player.GetStillBob() * sin(angle); bob = player.GetStillBob() * sin(angle);
} }
else else
@ -595,7 +595,7 @@ class PlayerPawn : Actor
} }
else else
{ {
angle = Level.time / (20 * TICRATE / 35.) * 360.; angle = Level.maptime / (20 * TICRATE / 35.) * 360.;
bob = player.bob * sin(angle) * (waterlevel > 1 ? 0.25f : 0.5f); bob = player.bob * sin(angle) * (waterlevel > 1 ? 0.25f : 0.5f);
} }
@ -734,7 +734,7 @@ class PlayerPawn : Actor
if ((player.cmd.buttons & BT_USE || if ((player.cmd.buttons & BT_USE ||
((multiplayer || alwaysapplydmflags) && sv_forcerespawn)) && !sv_norespawn) ((multiplayer || alwaysapplydmflags) && sv_forcerespawn)) && !sv_norespawn)
{ {
if (Level.time >= player.respawn_time || ((player.cmd.buttons & BT_USE) && player.Bot == NULL)) if (Level.maptime >= player.respawn_time || ((player.cmd.buttons & BT_USE) && player.Bot == NULL))
{ {
player.cls = NULL; // Force a new class if the player is using a random class player.cls = NULL; // Force a new class if the player is using a random class
player.playerstate = (multiplayer || Level.AllowRespawn || sv_singleplayerrespawn || G_SkillPropertyInt(SKILLP_PlayerRespawn)) ? PST_REBORN : PST_ENTER; player.playerstate = (multiplayer || Level.AllowRespawn || sv_singleplayerrespawn || G_SkillPropertyInt(SKILLP_PlayerRespawn)) ? PST_REBORN : PST_ENTER;
@ -1518,7 +1518,7 @@ class PlayerPawn : Actor
virtual void CheckPoison() virtual void CheckPoison()
{ {
let player = self.player; let player = self.player;
if (player.poisoncount && !(Level.time & 15)) if (player.poisoncount && !(Level.maptime & 15))
{ {
player.poisoncount -= 5; player.poisoncount -= 5;
if (player.poisoncount < 0) if (player.poisoncount < 0)
@ -1542,7 +1542,7 @@ class PlayerPawn : Actor
{ {
let player = self.player; let player = self.player;
int maxhealth = GetMaxHealth(true); int maxhealth = GetMaxHealth(true);
if ((Level.time % TICRATE) == 0 && player.health > maxhealth) if ((Level.maptime % TICRATE) == 0 && player.health > maxhealth)
{ {
if (player.health - 5 < maxhealth) if (player.health - 5 < maxhealth)
player.health = maxhealth; player.health = maxhealth;
@ -1570,9 +1570,9 @@ class PlayerPawn : Actor
{ {
ResetAirSupply(); ResetAirSupply();
} }
else if (player.air_finished <= Level.time && !(Level.time & 31)) else if (player.air_finished <= Level.maptime && !(Level.maptime & 31))
{ {
DamageMobj(NULL, NULL, 2 + ((Level.time - player.air_finished) / TICRATE), 'Drowning'); DamageMobj(NULL, NULL, 2 + ((Level.maptime - player.air_finished) / TICRATE), 'Drowning');
} }
} }
} }
@ -1647,7 +1647,7 @@ class PlayerPawn : Actor
if (player.hazardcount) if (player.hazardcount)
{ {
player.hazardcount--; player.hazardcount--;
if (!(Level.time % player.hazardinterval) && player.hazardcount > 16*TICRATE) if (!(Level.maptime % player.hazardinterval) && player.hazardcount > 16*TICRATE)
player.mo.DamageMobj (NULL, NULL, 5, player.hazardtype); player.mo.DamageMobj (NULL, NULL, 5, player.hazardtype);
} }
player.mo.CheckPoison(); player.mo.CheckPoison();
@ -2333,7 +2333,7 @@ class PlayerPawn : Actor
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
// Bob the weapon based on movement speed. ([SP] And user's bob speed setting) // Bob the weapon based on movement speed. ([SP] And user's bob speed setting)
double angle = (BobSpeed * player.GetWBobSpeed() * 35 / TICRATE*(Level.time - 1 + i)) * (360. / 8192.); double angle = (BobSpeed * player.GetWBobSpeed() * 35 / TICRATE*(Level.maptime - 1 + i)) * (360. / 8192.);
// [RH] Smooth transitions between bobbing and not-bobbing frames. // [RH] Smooth transitions between bobbing and not-bobbing frames.
// This also fixes the bug where you can "stick" a weapon off-center by // This also fixes the bug where you can "stick" a weapon off-center by
@ -2431,13 +2431,13 @@ class PlayerPawn : Actor
virtual bool ResetAirSupply (bool playgasp = true) virtual bool ResetAirSupply (bool playgasp = true)
{ {
let player = self.player; let player = self.player;
bool wasdrowning = (player.air_finished < Level.time); bool wasdrowning = (player.air_finished < Level.maptime);
if (playgasp && wasdrowning) if (playgasp && wasdrowning)
{ {
A_PlaySound("*gasp", CHAN_VOICE); A_PlaySound("*gasp", CHAN_VOICE);
} }
if (Level.airsupply > 0 && AirCapacity > 0) player.air_finished = Level.time + int(Level.airsupply * AirCapacity); if (Level.airsupply > 0 && AirCapacity > 0) player.air_finished = Level.maptime + int(Level.airsupply * AirCapacity);
else player.air_finished = int.max; else player.air_finished = int.max;
return wasdrowning; return wasdrowning;
} }

View file

@ -7,7 +7,7 @@ extend class Actor
void A_FLoopActiveSound() void A_FLoopActiveSound()
{ {
if (ActiveSound != 0 && !(Level.time & 7)) if (ActiveSound != 0 && !(Level.maptime & 7))
{ {
A_PlaySound (ActiveSound, CHAN_VOICE); A_PlaySound (ActiveSound, CHAN_VOICE);
} }