summaryrefslogtreecommitdiff
path: root/StardewModdingAPI/Inheritance/SGame.cs
diff options
context:
space:
mode:
Diffstat (limited to 'StardewModdingAPI/Inheritance/SGame.cs')
-rw-r--r--StardewModdingAPI/Inheritance/SGame.cs39
1 files changed, 39 insertions, 0 deletions
diff --git a/StardewModdingAPI/Inheritance/SGame.cs b/StardewModdingAPI/Inheritance/SGame.cs
index 735cd58a..53d9df59 100644
--- a/StardewModdingAPI/Inheritance/SGame.cs
+++ b/StardewModdingAPI/Inheritance/SGame.cs
@@ -173,6 +173,15 @@ namespace StardewModdingAPI.Inheritance
public Farmer PreviousFarmer { get; private set; }
+ public Int32 CurrentUpdateTick { get; private set; }
+ public bool FirstUpdate { get; private set; }
+
+ public RenderTarget2D Screen
+ {
+ get { return typeof (Game1).GetBaseFieldValue<RenderTarget2D>(Program.gamePtr, "screen"); }
+ set { typeof (Game1).SetBaseFieldValue("screen", value); }
+ }
+
private static SGame instance;
public static SGame Instance { get { return instance; } }
@@ -181,7 +190,9 @@ namespace StardewModdingAPI.Inheritance
public SGame()
{
instance = this;
+ FirstUpdate = true;
+ /*
#if DEBUG
SaveGame.serializer = new XmlSerializer(typeof (SaveGame), new Type[28]
{
@@ -215,6 +226,7 @@ namespace StardewModdingAPI.Inheritance
typeof (SObject)
});
#endif
+ */
}
protected override void Initialize()
@@ -251,6 +263,33 @@ namespace StardewModdingAPI.Inheritance
}
Events.GameEvents.InvokeUpdateTick();
+ if (FirstUpdate)
+ {
+ GameEvents.InvokeFirstUpdateTick();
+ FirstUpdate = false;
+ }
+
+ if (CurrentUpdateTick % 2 == 0)
+ Events.GameEvents.InvokeSecondUpdateTick();
+
+ if (CurrentUpdateTick % 4 == 0)
+ Events.GameEvents.InvokeFourthUpdateTick();
+
+ if (CurrentUpdateTick % 8 == 0)
+ Events.GameEvents.InvokeEighthUpdateTick();
+
+ if (CurrentUpdateTick % 15 == 0)
+ Events.GameEvents.InvokeQuarterSecondTick();
+
+ if (CurrentUpdateTick % 30 == 0)
+ Events.GameEvents.InvokeHalfSecondTick();
+
+ if (CurrentUpdateTick % 60 == 0)
+ Events.GameEvents.InvokeOneSecondTick();
+
+ CurrentUpdateTick += 1;
+ if (CurrentUpdateTick >= 60)
+ CurrentUpdateTick = 0;
PreviouslyPressedKeys = CurrentlyPressedKeys;
for(PlayerIndex i = PlayerIndex.One; i <= PlayerIndex.Four; i++)