Simplify blackness code

rabi_display
wcko87 8 years ago
parent bf444802a4
commit 149ea61008
  1. 2
      rabi_splitter_WPF/MainContext.cs
  2. 31
      rabi_splitter_WPF/MainWindow.xaml.cs

@ -336,7 +336,7 @@ namespace rabi_splitter_WPF
}
}
public bool readyToStartGame = false;
public int previousBlackness = -1;
public string oldtitle;
public int veridx;
public int lastmoney;

@ -98,32 +98,15 @@ namespace rabi_splitter_WPF
#region Detect Start Game
{
int blackness = MemoryHelper.GetMemoryValue<int>(process, StaticData.BlacknessAddr[mainContext.veridx]); // blackness
if (blackness == 0)
int blackness = MemoryHelper.GetMemoryValue<int>(process, StaticData.BlacknessAddr[mainContext.veridx]);
if (mainContext.previousBlackness == 0 && blackness >= 100000)
{
if (!mainContext.readyToStartGame)
{
mainContext.readyToStartGame = true;
}
}
else if (blackness >= 100000)
{
if (mainContext.readyToStartGame)
{
// suddent jump to 100000.
mainContext.readyToStartGame = false;
if (mainContext.AutoStart) sendstarttimer();
DebugLog("Start Game!");
}
}
else // 0 < blackness < 100000
{
if (mainContext.readyToStartGame)
{
// disarm ready trigger.
mainContext.readyToStartGame = false;
}
// Sudden increase by 100000
// Have to be careful, though. I don't know whether anything else causes blackness to increase by 100000
if (mainContext.AutoStart) sendstarttimer();
DebugLog("Start Game!");
}
mainContext.previousBlackness = blackness;
}
#endregion

Loading…
Cancel
Save