Skip to content

Commit 6f77602

Browse files
committed
Major overhaul to Timing and other fixes
- Overhaul to timing methods to increase timing accuracies and fix issues related to pause spamming - Fixed double splitting in HL2 Survivor - Added an option to disable pausing timer when starting from game pause - Code cleanups and refactoring
1 parent b3b617f commit 6f77602

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+596
-310
lines changed

Extensions/Detour.cs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using LiveSplit.ComponentUtil;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Diagnostics;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace LiveSplit.SourceSplit.Extensions
10+
{
11+
public class ByteReplacement
12+
{
13+
private byte[] _old;
14+
private int _count;
15+
private IntPtr _address;
16+
Process _process;
17+
18+
public ByteReplacement(Process p, IntPtr address, int count)
19+
{
20+
_address = address;
21+
_process = p;
22+
_count = count;
23+
_old = p.ReadBytes(_address, _count);
24+
}
25+
26+
public void Replace(byte[] newBytes)
27+
{
28+
Trace.Assert(newBytes.Length == _count);
29+
_process.WriteBytes(_address, newBytes);
30+
}
31+
32+
public void Restore()
33+
{
34+
_process.WriteBytes(_address, _old);
35+
}
36+
}
37+
public class Detour
38+
{
39+
private ByteReplacement _replaced;
40+
41+
public Detour(Process p, IntPtr from, IntPtr to, int preserve, byte[] newBytes, bool preserveAfter = false)
42+
{
43+
_replaced = new ByteReplacement(p, from, preserve);
44+
45+
p.WriteBytes(to + (preserveAfter ? newBytes.Length : 0), p.ReadBytes(from, preserve));
46+
p.WriteJumpInstruction(from, to);
47+
p.WriteBytes(to + (preserveAfter ? 0 : preserve), newBytes);
48+
49+
p.WriteJumpInstruction(to + preserve + newBytes.Length, from + preserve);
50+
Debug.WriteLine($"Written detour from 0x{from.ToString("X")} to 0x{to.ToString("X")} [{newBytes.Length} bytes]");
51+
}
52+
53+
public void Restore()
54+
{
55+
_replaced.Restore();
56+
}
57+
}
58+
}

GameMemory.cs

Lines changed: 265 additions & 145 deletions
Large diffs are not rendered by default.

GameSpecific/ApertureTag.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public override GameSupportResult OnUpdate(GameState state)
4646
if (this.IsFirstMap)
4747
{
4848
// first tick player out of shower
49-
if (state.PlayerPosition.Distance(_startPos) < 1.0f)
49+
if (state.PlayerPosition.Current.Distance(_startPos) < 1.0f)
5050
{
5151
Debug.WriteLine("aperture tag start");
5252
_onceFlag = true;

GameSpecific/BMSRetail.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ public override GameSupportResult OnUpdate(GameState state)
131131
}
132132
else if (_ebEndCommand.BValue && state.CurrentMap.ToLower() == _ebEndMap)
133133
{
134-
if (state.PlayerViewEntityIndex == _ebCamIndex && state.PrevPlayerViewEntityIndex == 1)
134+
if (state.PlayerViewEntityIndex.Current == _ebCamIndex && state.PlayerViewEntityIndex.Old == 1)
135135
return DefaultEnd("bms eb end");
136136
}
137137
else if ((_xenStartCommand.BValue || _xenSplitCommand.BValue) && state.CurrentMap.ToLower() == _xenStartMap)
138138
{
139-
if (state.PlayerViewEntityIndex == 1 && state.PrevPlayerViewEntityIndex == _xenCamIndex)
139+
if (state.PlayerViewEntityIndex.Current == 1 && state.PlayerViewEntityIndex.Old == _xenCamIndex)
140140
{
141141
_onceFlag = true;
142142
Debug.WriteLine("bms xen start");

GameSpecific/GameSupport.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,24 +145,24 @@ public virtual GameSupportResult OnUpdate(GameState state)
145145
return GameSupportResult.DoNothing;
146146

147147
if (this.AutoStartType == AutoStart.Unfrozen
148-
&& !state.PlayerFlags.HasFlag(FL.FROZEN)
149-
&& state.PrevPlayerFlags.HasFlag(FL.FROZEN))
148+
&& !state.PlayerFlags.Current.HasFlag(FL.FROZEN)
149+
&& state.PlayerFlags.Old.HasFlag(FL.FROZEN))
150150
{
151151
Debug.WriteLine("FL_FROZEN removed from player");
152152
_onceFlag = true;
153153
return GameSupportResult.PlayerGainedControl;
154154
}
155155
else if (this.AutoStartType == AutoStart.ViewEntityChanged
156-
&& state.PrevPlayerViewEntityIndex != GameState.ENT_INDEX_PLAYER
157-
&& state.PlayerViewEntityIndex == GameState.ENT_INDEX_PLAYER)
156+
&& state.PlayerViewEntityIndex.Old != GameState.ENT_INDEX_PLAYER
157+
&& state.PlayerViewEntityIndex.Current == GameState.ENT_INDEX_PLAYER)
158158
{
159159
Debug.WriteLine("view entity changed to player");
160160
_onceFlag = true;
161161
return GameSupportResult.PlayerGainedControl;
162162
}
163163
else if (this.AutoStartType == AutoStart.ParentEntityChanged
164-
&& state.PrevPlayerParentEntityHandle != -1
165-
&& state.PlayerParentEntityHandle == -1)
164+
&& state.PlayerParentEntityHandle.Old != -1
165+
&& state.PlayerParentEntityHandle.Current == -1)
166166
{
167167
Debug.WriteLine("player no longer parented");
168168
_onceFlag = true;

GameSpecific/HDTF.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ public override GameSupportResult OnUpdate(GameState state)
9191
if (_onceFlag)
9292
return GameSupportResult.DoNothing;
9393

94-
if (state.CurrentMap.ToLower() == "a0c0p1" && state.PlayerPosition.DistanceXY(_startPos) <= 3f)
94+
if (state.CurrentMap.ToLower() == "a0c0p1" && state.PlayerPosition.Current.DistanceXY(_startPos) <= 3f)
9595
{
9696
bool ifIntroNotDeleted = File.Exists(state.GameProcess.ReadString(state.GameOffsets.GameDirPtr, 255) + "/media/a0b0c0s0.bik");
9797
if (_tutResetFlag &&
9898
(ifIntroNotDeleted && _isInCutscene.Current - _isInCutscene.Old == -1) ^
99-
(!ifIntroNotDeleted && !_resetFlag && state.TickCount <= 1 && state.RawTickCount <= 150))
99+
(!ifIntroNotDeleted && !_resetFlag && state.TickCount <= 1 && state.RawTickCount.Current <= 150))
100100
{
101101
Debug.WriteLine("hdtf start");
102102
_onceFlag = true;

GameSpecific/HL2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public override GameSupportResult OnUpdate(GameState state)
5050
// "OnTrigger" "point_teleport_destination,Teleport,,0.1,-1"
5151

5252
// first tick player is moveable and on the train
53-
if (state.PlayerPosition.DistanceXY(_startPos) <= 1.0)
53+
if (state.PlayerPosition.Current.DistanceXY(_startPos) <= 1.0)
5454
{
5555
Debug.WriteLine("hl2 start");
5656
_onceFlag = true;

GameSpecific/HL2Ep2.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ public override GameSupportResult OnUpdate(GameState state)
7676
{
7777
// "OnTrigger4" "cvehicle.hangar,EnterVehicle,,0,1"
7878

79-
if (state.PlayerParentEntityHandle != -1
80-
&& state.PrevPlayerParentEntityHandle == -1)
79+
if (state.PlayerParentEntityHandle.Current != -1
80+
&& state.PlayerParentEntityHandle.Old == -1)
8181
{
8282
Debug.WriteLine("ep2 end");
8383
_onceFlag = true;

GameSpecific/HL2Mods/HL2Mods_1187Ep1.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public override GameSupportResult OnUpdate(GameState state)
9191

9292
if (IsFirstMap)
9393
{
94-
if (state.PrevPlayerViewEntityIndex == _startCamIndex && state.PlayerViewEntityIndex == 1)
94+
if (state.PlayerViewEntityIndex.Old == _startCamIndex && state.PlayerViewEntityIndex.Current == 1)
9595
{
9696
Debug.WriteLine("1187ep1 start");
9797
_onceFlag = true;

GameSpecific/HL2Mods/HL2Mods_Crates.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public override GameSupportResult OnUpdate(GameState state)
4444
if (this.IsFirstMap)
4545
{
4646
_counterSkin.Update(state.GameProcess);
47-
if (_counterSkin.Current == 10 && state.PlayerViewEntityIndex == _camIndex && state.PrevPlayerViewEntityIndex == 1)
47+
if (_counterSkin.Current == 10 && state.PlayerViewEntityIndex.Current == _camIndex && state.PlayerViewEntityIndex.Old == 1)
4848
{
4949
_onceFlag = true;
5050
Debug.WriteLine("toomanycrates end");

GameSpecific/HL2Mods/HL2Mods_DaBaby.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public override GameSupportResult OnUpdate(GameState state)
4040

4141
if (_startCamIndex != -1)
4242
{
43-
if (state.PlayerViewEntityIndex == 1 && state.PrevPlayerViewEntityIndex == _startCamIndex)
43+
if (state.PlayerViewEntityIndex.Current == 1 && state.PlayerViewEntityIndex.Old == _startCamIndex)
4444
{
4545
Debug.WriteLine("da baby start");
4646
return GameSupportResult.PlayerGainedControl;
@@ -49,7 +49,7 @@ public override GameSupportResult OnUpdate(GameState state)
4949

5050
if (_endingCamIndex != -1)
5151
{
52-
if (state.PlayerViewEntityIndex == _endingCamIndex && state.PrevPlayerViewEntityIndex == 1)
52+
if (state.PlayerViewEntityIndex.Current == _endingCamIndex && state.PlayerViewEntityIndex.Old == 1)
5353
{
5454
Debug.WriteLine("da baby end");
5555
_onceFlag = true;

GameSpecific/HL2Mods/HL2Mods_DayHard.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ public override GameSupportResult OnUpdate(GameState state)
4646

4747
if (this.IsFirstMap && _camIndex != -1)
4848
{
49-
if (state.PlayerViewEntityIndex == 1 &&
50-
state.PrevPlayerViewEntityIndex == _camIndex)
49+
if (state.PlayerViewEntityIndex.Current == 1 &&
50+
state.PlayerViewEntityIndex.Old == _camIndex)
5151
{
5252
Debug.WriteLine("DayHard start");
5353
_onceFlag = true;

GameSpecific/HL2Mods/HL2Mods_DeeperDown.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public override GameSupportResult OnUpdate(GameState state)
4747

4848
if (this.IsFirstMap)
4949
{
50-
if (state.PlayerViewEntityIndex == 1 && state.PrevPlayerViewEntityIndex == _camIndex)
50+
if (state.PlayerViewEntityIndex.Current == 1 && state.PlayerViewEntityIndex.Old == _camIndex)
5151
{
5252
_onceFlag = true;
5353
Debug.WriteLine("deeper down start");

GameSpecific/HL2Mods/HL2Mods_Downfall.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ public override GameSupportResult OnUpdate(GameState state)
4242

4343
if (this.IsFirstMap)
4444
{
45-
if (state.PrevPlayerViewEntityIndex != GameState.ENT_INDEX_PLAYER
46-
&& state.PlayerViewEntityIndex == GameState.ENT_INDEX_PLAYER)
45+
if (state.PlayerViewEntityIndex.Old != GameState.ENT_INDEX_PLAYER
46+
&& state.PlayerViewEntityIndex.Current == GameState.ENT_INDEX_PLAYER)
4747
{
4848
Debug.WriteLine("downfall start");
4949
_onceFlag = true;

GameSpecific/HL2Mods/HL2Mods_Exit2.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public override GameSupportResult OnUpdate(GameState state)
4040

4141
if (this.IsFirstMap && this._camIndex != -1)
4242
{
43-
if (state.PlayerViewEntityIndex == 1 &&
44-
state.PrevPlayerViewEntityIndex == _camIndex)
43+
if (state.PlayerViewEntityIndex.Current == 1 &&
44+
state.PlayerViewEntityIndex.Old == _camIndex)
4545
{
4646
Debug.WriteLine("exit2 start");
4747
_onceFlag = true;
@@ -50,8 +50,8 @@ public override GameSupportResult OnUpdate(GameState state)
5050
}
5151
else if (this.IsLastMap)
5252
{
53-
if (state.PlayerViewEntityIndex == _camIndex &&
54-
state.PrevPlayerViewEntityIndex == 1)
53+
if (state.PlayerViewEntityIndex.Current == _camIndex &&
54+
state.PlayerViewEntityIndex.Old == 1)
5555
{
5656
Debug.WriteLine("exit2 end");
5757
_onceFlag = true;

GameSpecific/HL2Mods/HL2Mods_ExperimentalFuel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public override GameSupportResult OnUpdate(GameState state)
5050
var newMote = state.GetEntInfoByIndex(_dustmoteIndex);
5151
var newBrush = state.GetEntInfoByIndex(_blockBrushIndex);
5252

53-
if (state.PlayerPosition.DistanceXY(new Vector3f(7784.5f, 7284f, -15107f)) >= 2
54-
&& state.PrevPlayerPosition.DistanceXY(new Vector3f(7784.5f, 7284f, -15107f)) < 2
53+
if (state.PlayerPosition.Current.DistanceXY(new Vector3f(7784.5f, 7284f, -15107f)) >= 2
54+
&& state.PlayerPosition.Old.DistanceXY(new Vector3f(7784.5f, 7284f, -15107f)) < 2
5555
&& newBrush.EntityPtr == IntPtr.Zero && !_resetFlag)
5656
{
5757
Debug.WriteLine("exp fuel start");

GameSpecific/HL2Mods/HL2Mods_Freakman2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public override GameSupportResult OnUpdate(GameState state)
6161

6262
else if (this.IsLastMap && _camIndex != -1)
6363
{
64-
if (state.PrevPlayerViewEntityIndex != _camIndex && state.PlayerViewEntityIndex == _camIndex)
64+
if (state.PlayerViewEntityIndex.Old != _camIndex && state.PlayerViewEntityIndex.Current == _camIndex)
6565
{
6666
_onceFlag = true;
6767
Debug.WriteLine("freakman2 end");

GameSpecific/HL2Mods/HL2Mods_GetALife.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public override GameSupportResult OnUpdate(GameState state)
4444

4545
if (this.IsFirstMap)
4646
{
47-
if (state.PlayerViewEntityIndex == 1 && state.PrevPlayerViewEntityIndex == _startCamIndex)
47+
if (state.PlayerViewEntityIndex.Current == 1 && state.PlayerViewEntityIndex.Old == _startCamIndex)
4848
{
4949
_onceFlag = true;
5050
Debug.WriteLine("get a life start");
@@ -53,7 +53,7 @@ public override GameSupportResult OnUpdate(GameState state)
5353
}
5454
else if (this.IsLastMap)
5555
{
56-
if (state.PrevPlayerViewEntityIndex == 1 && state.PlayerViewEntityIndex == _endCamIndex)
56+
if (state.PlayerViewEntityIndex.Old == 1 && state.PlayerViewEntityIndex.Current == _endCamIndex)
5757
{
5858
_onceFlag = true;
5959
Debug.WriteLine("get a life end");

GameSpecific/HL2Mods/HL2Mods_Grey.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public override GameSupportResult OnUpdate(GameState state)
4545

4646
if (this.IsFirstMap)
4747
{
48-
if (state.PrevPlayerViewEntityIndex == _startcamIndex && state.PlayerViewEntityIndex == 1)
48+
if (state.PlayerViewEntityIndex.Old == _startcamIndex && state.PlayerViewEntityIndex.Current == 1)
4949
{
5050
_onceFlag = true;
5151
Debug.WriteLine("grey start");
@@ -54,7 +54,7 @@ public override GameSupportResult OnUpdate(GameState state)
5454
}
5555
else if (this.IsLastMap)
5656
{
57-
if (state.PrevPlayerViewEntityIndex == 1 && state.PlayerViewEntityIndex == _endcamIndex)
57+
if (state.PlayerViewEntityIndex.Old == 1 && state.PlayerViewEntityIndex.Current == _endcamIndex)
5858
{
5959
_onceFlag = true;
6060
Debug.WriteLine("grey end");

GameSpecific/HL2Mods/HL2Mods_Hangover.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public override GameSupportResult OnUpdate(GameState state)
4040

4141
if (this.IsFirstMap)
4242
{
43-
if (state.PrevPlayerViewEntityIndex == _startCamIndex &&
44-
state. PlayerViewEntityIndex == 1)
43+
if (state.PlayerViewEntityIndex.Old == _startCamIndex &&
44+
state.PlayerViewEntityIndex.Current == 1)
4545
{
4646
_onceFlag = true;
4747
Debug.WriteLine("hangover start");

GameSpecific/HL2Mods/HL2Mods_KillTheMonk.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public override GameSupportResult OnUpdate(GameState state)
5656

5757
if (this.IsFirstMap)
5858
{
59-
if (state.PrevPlayerViewEntityIndex == _camIndex && state.PlayerViewEntityIndex == 1)
59+
if (state.PlayerViewEntityIndex.Old == _camIndex && state.PlayerViewEntityIndex.Current == 1)
6060
{
6161
_onceFlag = true;
6262
Debug.WriteLine("kill the monk start");

GameSpecific/HL2Mods/HL2Mods_MImp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public override GameSupportResult OnUpdate(GameState state)
5656
}
5757
else if (this.IsLastMap && _camIndex != -1)
5858
{
59-
if (state.PlayerViewEntityIndex == _camIndex && state.PrevPlayerViewEntityIndex != _camIndex)
59+
if (state.PlayerViewEntityIndex.Current == _camIndex && state.PlayerViewEntityIndex.Old != _camIndex)
6060
{
6161
Debug.WriteLine("mimp end");
6262
_onceFlag = true;

GameSpecific/HL2Mods/HL2Mods_Others.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class HL2Mods_Misc : GameSupport
1919

2020
public override void OnGenericUpdate(GameState state)
2121
{
22-
if (IsLastMap && state.HostState == HostState.GameShutdown)
22+
if (IsLastMap && state.HostState.Current == HostState.GameShutdown)
2323
OnUpdate(state);
2424
}
2525

@@ -175,7 +175,7 @@ public override GameSupportResult OnUpdate(GameState state)
175175
return GameSupportResult.DoNothing;
176176

177177
// todo: probably should use the helicopter's position?
178-
if (IsLastMap && state.PlayerPosition.Distance(_endSector) <= 300f)
178+
if (IsLastMap && state.PlayerPosition.Current.Distance(_endSector) <= 300f)
179179
{
180180
float splitTime = state.FindOutputFireTime("game_end", 10);
181181
_splitTime = (splitTime == 0f) ? _splitTime : splitTime;
@@ -207,7 +207,7 @@ public override GameSupportResult OnUpdate(GameState state)
207207
if (_onceFlag)
208208
return GameSupportResult.DoNothing;
209209

210-
if (IsLastMap && state.PlayerViewEntityIndex != GameState.ENT_INDEX_PLAYER)
210+
if (IsLastMap && state.PlayerViewEntityIndex.Current != GameState.ENT_INDEX_PLAYER)
211211
{
212212
float splitTime = state.FindOutputFireTime("clientcommand", 8);
213213
_splitTime = (splitTime == 0f) ? _splitTime : splitTime;
@@ -442,8 +442,8 @@ public override GameSupportResult OnUpdate(GameState state)
442442

443443
if (this.IsLastMap && _endCameraIndex != -1)
444444
{
445-
if (state.PrevPlayerViewEntityIndex == 1 &&
446-
state.PlayerViewEntityIndex == _endCameraIndex)
445+
if (state.PlayerViewEntityIndex.Old == 1 &&
446+
state.PlayerViewEntityIndex.Current == _endCameraIndex)
447447
{
448448
_onceFlag = true;
449449
Debug.WriteLine("school_adventures end");

GameSpecific/HL2Mods/HL2Mods_Precursor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public override GameSupportResult OnUpdate(GameState state)
4545

4646
if (this.IsFirstMap)
4747
{
48-
if (state.PrevPlayerViewEntityIndex == _startCamIndex && state.PlayerViewEntityIndex == 1)
48+
if (state.PlayerViewEntityIndex.Old == _startCamIndex && state.PlayerViewEntityIndex.Current == 1)
4949
{
5050
_onceFlag = true;
5151
Debug.WriteLine("precursor start");
@@ -54,7 +54,7 @@ public override GameSupportResult OnUpdate(GameState state)
5454
}
5555
else if (this.IsLastMap)
5656
{
57-
if (state.PrevPlayerViewEntityIndex == 1 && state.PlayerViewEntityIndex == _endCamIndex)
57+
if (state.PlayerViewEntityIndex.Old == 1 && state.PlayerViewEntityIndex.Current == _endCamIndex)
5858
{
5959
_onceFlag = true;
6060
Debug.WriteLine("precursor end");

GameSpecific/HL2Mods/HL2Mods_Ptsd1.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public override GameSupportResult OnUpdate(GameState state)
5050

5151
if (this.IsFirstMap && _camIndex != -1)
5252
{
53-
if (state.PrevPlayerViewEntityIndex == _camIndex
54-
&& state.PlayerViewEntityIndex == GameState.ENT_INDEX_PLAYER)
53+
if (state.PlayerViewEntityIndex.Old == _camIndex
54+
&& state.PlayerViewEntityIndex.Current == GameState.ENT_INDEX_PLAYER)
5555
{
5656
Debug.WriteLine("ptsd start");
5757
_onceFlag = true;

GameSpecific/HL2Mods/HL2Mods_SnipersEp.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public override GameSupportResult OnUpdate(GameState state)
5454

5555
if (this.IsFirstMap)
5656
{
57-
if (state.PrevPlayerPosition.BitEqualsXY(_startPos) && !state.PlayerPosition.BitEqualsXY(_startPos) && !_resetFlag)
57+
if (state.PlayerPosition.Old.BitEqualsXY(_startPos) && !state.PlayerPosition.Current.BitEqualsXY(_startPos) && !_resetFlag)
5858
{
5959
_resetFlag = true;
6060
return GameSupportResult.PlayerGainedControl;

0 commit comments

Comments
 (0)