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

This commit is contained in:
Christoph Oelckers 2019-01-28 18:42:56 +01:00
parent 3364988680
commit 3c14a7db76
11 changed files with 42 additions and 42 deletions

View file

@ -182,9 +182,9 @@ static FRandom pr_bbannounce ("BBAnnounce");
void DoVoiceAnnounce (const char *sound) void DoVoiceAnnounce (const char *sound)
{ {
// Don't play announcements too close together // Don't play announcements too close together
if (LastAnnounceTime == 0 || LastAnnounceTime <= level.time-5) if (LastAnnounceTime == 0 || LastAnnounceTime <= currentUILevel->time-5)
{ {
LastAnnounceTime = level.time; LastAnnounceTime = currentUILevel->time;
S_Sound (CHAN_VOICE, sound, 1, ATTN_NONE); S_Sound (CHAN_VOICE, sound, 1, ATTN_NONE);
} }
} }

View file

@ -95,7 +95,7 @@ void P_Ticker (void)
DPSprite::NewTick(); DPSprite::NewTick();
// [RH] Frozen mode is only changed every 4 tics, to make it work with A_Tracer(). // [RH] Frozen mode is only changed every 4 tics, to make it work with A_Tracer().
if ((level.time & 3) == 0) if ((level.maptime & 3) == 0)
{ {
if (bglobal.changefreeze) if (bglobal.changefreeze)
{ {

View file

@ -635,9 +635,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;
@ -648,10 +648,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;
@ -696,7 +696,7 @@ struct LevelLocals native
native int 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 int 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 static void GiveSecret(Actor activator, bool printmsg = true, bool playsound = true); native static void GiveSecret(Actor activator, bool printmsg = true, bool playsound = true);
native static void StartSlideshow(Name whichone = 'none'); native static 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 ui Vector2 GetAutomapPosition(); native ui 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);
} }

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,14 +1553,14 @@ 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 )
|| (( EffectTics > 32 && EffectTics <= 2*32 ) && ((EffectTics + 1) & 3) != 0 ) || (( EffectTics > 32 && EffectTics <= 2*32 ) && ((EffectTics + 1) & 3) != 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();
@ -1898,7 +1898,7 @@ class PlayerPawn : Actor
// This problem is only detectable when it's too late to do something about it... // This problem is only detectable when it's too late to do something about it...
ThrowAbortException("Cannot give morph item '%s' when starting a game!", di.Name); ThrowAbortException("Cannot give morph item '%s' when starting a game!", di.Name);
} }
} }
let weap = Weapon(item); let weap = Weapon(item);
if (weap != NULL && weap.CheckAmmo(Weapon.EitherFire, false)) if (weap != NULL && weap.CheckAmmo(Weapon.EitherFire, false))
{ {
@ -2334,7 +2334,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
@ -2432,13 +2432,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);
} }