Simplify blackness code
This commit is contained in:
parent
bf444802a4
commit
149ea61008
@ -336,7 +336,7 @@ namespace rabi_splitter_WPF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool readyToStartGame = false;
|
public int previousBlackness = -1;
|
||||||
public string oldtitle;
|
public string oldtitle;
|
||||||
public int veridx;
|
public int veridx;
|
||||||
public int lastmoney;
|
public int lastmoney;
|
||||||
|
@ -98,32 +98,15 @@ namespace rabi_splitter_WPF
|
|||||||
#region Detect Start Game
|
#region Detect Start Game
|
||||||
|
|
||||||
{
|
{
|
||||||
int blackness = MemoryHelper.GetMemoryValue<int>(process, StaticData.BlacknessAddr[mainContext.veridx]); // blackness
|
int blackness = MemoryHelper.GetMemoryValue<int>(process, StaticData.BlacknessAddr[mainContext.veridx]);
|
||||||
if (blackness == 0)
|
if (mainContext.previousBlackness == 0 && blackness >= 100000)
|
||||||
{
|
{
|
||||||
if (!mainContext.readyToStartGame)
|
// Sudden increase by 100000
|
||||||
{
|
// Have to be careful, though. I don't know whether anything else causes blackness to increase by 100000
|
||||||
mainContext.readyToStartGame = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (blackness >= 100000)
|
|
||||||
{
|
|
||||||
if (mainContext.readyToStartGame)
|
|
||||||
{
|
|
||||||
// suddent jump to 100000.
|
|
||||||
mainContext.readyToStartGame = false;
|
|
||||||
if (mainContext.AutoStart) sendstarttimer();
|
if (mainContext.AutoStart) sendstarttimer();
|
||||||
DebugLog("Start Game!");
|
DebugLog("Start Game!");
|
||||||
}
|
}
|
||||||
}
|
mainContext.previousBlackness = blackness;
|
||||||
else // 0 < blackness < 100000
|
|
||||||
{
|
|
||||||
if (mainContext.readyToStartGame)
|
|
||||||
{
|
|
||||||
// disarm ready trigger.
|
|
||||||
mainContext.readyToStartGame = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
Loading…
x
Reference in New Issue
Block a user