diff options
| author | Zoryn <Zoryn4163@users.noreply.github.com> | 2016-03-27 07:15:17 -0400 |
|---|---|---|
| committer | Zoryn <Zoryn4163@users.noreply.github.com> | 2016-03-27 07:15:17 -0400 |
| commit | 8c2c3b6d035a413b0d5892e10f28bf7cbc08107c (patch) | |
| tree | 3ad2068fc419338432c128e8e56a4ffdc5e2a767 /StardewModdingAPI | |
| parent | 11ed5a612b3e8265cc9cba400094417bf4c26208 (diff) | |
| parent | 36a3401e14ce911e1c2a7855d2d4d9a709fbf526 (diff) | |
| download | SMAPI-8c2c3b6d035a413b0d5892e10f28bf7cbc08107c.tar.gz SMAPI-8c2c3b6d035a413b0d5892e10f28bf7cbc08107c.tar.bz2 SMAPI-8c2c3b6d035a413b0d5892e10f28bf7cbc08107c.zip | |
Merge pull request #69 from Zoryn4163/master
lots of things
Diffstat (limited to 'StardewModdingAPI')
| -rw-r--r-- | StardewModdingAPI/Constants.cs | 5 | ||||
| -rw-r--r-- | StardewModdingAPI/Events/Controls.cs | 16 | ||||
| -rw-r--r-- | StardewModdingAPI/Events/EventArgs.cs | 13 | ||||
| -rw-r--r-- | StardewModdingAPI/Events/Game.cs | 22 | ||||
| -rw-r--r-- | StardewModdingAPI/Events/Graphics.cs | 93 | ||||
| -rw-r--r-- | StardewModdingAPI/Events/Location.cs | 4 | ||||
| -rw-r--r-- | StardewModdingAPI/Events/Menu.cs | 2 | ||||
| -rw-r--r-- | StardewModdingAPI/Events/Mine.cs | 2 | ||||
| -rw-r--r-- | StardewModdingAPI/Events/Player.cs | 8 | ||||
| -rw-r--r-- | StardewModdingAPI/Events/Time.cs | 18 | ||||
| -rw-r--r-- | StardewModdingAPI/Inheritance/SGame.cs | 947 | ||||
| -rw-r--r-- | StardewModdingAPI/Manifest.cs | 35 | ||||
| -rw-r--r-- | StardewModdingAPI/Program.cs | 4 |
13 files changed, 1084 insertions, 85 deletions
diff --git a/StardewModdingAPI/Constants.cs b/StardewModdingAPI/Constants.cs index ddd46115..4a01c38a 100644 --- a/StardewModdingAPI/Constants.cs +++ b/StardewModdingAPI/Constants.cs @@ -58,5 +58,10 @@ namespace StardewModdingAPI /// Do not mark as 'const' or else 'if' checks will complain that the expression is always true in ReSharper /// </summary> public static bool EnableDrawingIntoRenderTarget => true; + + /// <summary> + /// Completely overrides the base game's draw call to the one is SGame + /// </summary> + public static bool EnableCompletelyOverridingBaseCalls => true; } }
\ No newline at end of file diff --git a/StardewModdingAPI/Events/Controls.cs b/StardewModdingAPI/Events/Controls.cs index 87319f37..6415561a 100644 --- a/StardewModdingAPI/Events/Controls.cs +++ b/StardewModdingAPI/Events/Controls.cs @@ -15,42 +15,42 @@ namespace StardewModdingAPI.Events public static event EventHandler<EventArgsControllerTriggerPressed> ControllerTriggerPressed = delegate { };
public static event EventHandler<EventArgsControllerTriggerReleased> ControllerTriggerReleased = delegate { };
- public static void InvokeKeyboardChanged(KeyboardState priorState, KeyboardState newState)
+ internal static void InvokeKeyboardChanged(KeyboardState priorState, KeyboardState newState)
{
KeyboardChanged.Invoke(null, new EventArgsKeyboardStateChanged(priorState, newState));
}
- public static void InvokeMouseChanged(MouseState priorState, MouseState newState)
+ internal static void InvokeMouseChanged(MouseState priorState, MouseState newState)
{
MouseChanged.Invoke(null, new EventArgsMouseStateChanged(priorState, newState));
}
- public static void InvokeKeyPressed(Keys key)
+ internal static void InvokeKeyPressed(Keys key)
{
KeyPressed.Invoke(null, new EventArgsKeyPressed(key));
}
- public static void InvokeKeyReleased(Keys key)
+ internal static void InvokeKeyReleased(Keys key)
{
KeyReleased.Invoke(null, new EventArgsKeyPressed(key));
}
- public static void InvokeButtonPressed(PlayerIndex playerIndex, Buttons buttons)
+ internal static void InvokeButtonPressed(PlayerIndex playerIndex, Buttons buttons)
{
ControllerButtonPressed.Invoke(null, new EventArgsControllerButtonPressed(playerIndex, buttons));
}
- public static void InvokeButtonReleased(PlayerIndex playerIndex, Buttons buttons)
+ internal static void InvokeButtonReleased(PlayerIndex playerIndex, Buttons buttons)
{
ControllerButtonReleased.Invoke(null, new EventArgsControllerButtonReleased(playerIndex, buttons));
}
- public static void InvokeTriggerPressed(PlayerIndex playerIndex, Buttons buttons, float value)
+ internal static void InvokeTriggerPressed(PlayerIndex playerIndex, Buttons buttons, float value)
{
ControllerTriggerPressed.Invoke(null, new EventArgsControllerTriggerPressed(playerIndex, buttons, value));
}
- public static void InvokeTriggerReleased(PlayerIndex playerIndex, Buttons buttons, float value)
+ internal static void InvokeTriggerReleased(PlayerIndex playerIndex, Buttons buttons, float value)
{
ControllerTriggerReleased.Invoke(null, new EventArgsControllerTriggerReleased(playerIndex, buttons, value));
}
diff --git a/StardewModdingAPI/Events/EventArgs.cs b/StardewModdingAPI/Events/EventArgs.cs index 91151e86..d057796a 100644 --- a/StardewModdingAPI/Events/EventArgs.cs +++ b/StardewModdingAPI/Events/EventArgs.cs @@ -236,6 +236,19 @@ namespace StardewModdingAPI.Events public bool LoadedGame { get; private set; }
}
+ public class EventArgsNewDay : EventArgs
+ {
+ public EventArgsNewDay(int prevDay, int curDay, bool newDay)
+ {
+ PreviousDay = prevDay;
+ CurrentDay = curDay;
+ IsNewDay = newDay;
+ }
+
+ public int PreviousDay { get; private set; }
+ public int CurrentDay { get; private set; }
+ public bool IsNewDay { get; private set; }
+ }
public class EventArgsCommand : EventArgs
{
diff --git a/StardewModdingAPI/Events/Game.cs b/StardewModdingAPI/Events/Game.cs index c8052962..8b8042ed 100644 --- a/StardewModdingAPI/Events/Game.cs +++ b/StardewModdingAPI/Events/Game.cs @@ -44,12 +44,12 @@ namespace StardewModdingAPI.Events /// </summary>
public static event EventHandler OneSecondTick = delegate { };
- public static void InvokeGameLoaded()
+ internal static void InvokeGameLoaded()
{
GameLoaded.Invoke(null, EventArgs.Empty);
}
- public static void InvokeInitialize()
+ internal static void InvokeInitialize()
{
try
{
@@ -61,7 +61,7 @@ namespace StardewModdingAPI.Events }
}
- public static void InvokeLoadContent()
+ internal static void InvokeLoadContent()
{
try
{
@@ -73,7 +73,7 @@ namespace StardewModdingAPI.Events }
}
- public static void InvokeUpdateTick()
+ internal static void InvokeUpdateTick()
{
try
{
@@ -85,37 +85,37 @@ namespace StardewModdingAPI.Events }
}
- public static void InvokeSecondUpdateTick()
+ internal static void InvokeSecondUpdateTick()
{
SecondUpdateTick.Invoke(null, EventArgs.Empty);
}
- public static void InvokeFourthUpdateTick()
+ internal static void InvokeFourthUpdateTick()
{
FourthUpdateTick.Invoke(null, EventArgs.Empty);
}
- public static void InvokeEighthUpdateTick()
+ internal static void InvokeEighthUpdateTick()
{
EighthUpdateTick.Invoke(null, EventArgs.Empty);
}
- public static void InvokeQuarterSecondTick()
+ internal static void InvokeQuarterSecondTick()
{
QuarterSecondTick.Invoke(null, EventArgs.Empty);
}
- public static void InvokeHalfSecondTick()
+ internal static void InvokeHalfSecondTick()
{
HalfSecondTick.Invoke(null, EventArgs.Empty);
}
- public static void InvokeOneSecondTick()
+ internal static void InvokeOneSecondTick()
{
OneSecondTick.Invoke(null, EventArgs.Empty);
}
- public static void InvokeFirstUpdateTick()
+ internal static void InvokeFirstUpdateTick()
{
FirstUpdateTick.Invoke(null, EventArgs.Empty);
}
diff --git a/StardewModdingAPI/Events/Graphics.cs b/StardewModdingAPI/Events/Graphics.cs index 2b91144a..79c5b4aa 100644 --- a/StardewModdingAPI/Events/Graphics.cs +++ b/StardewModdingAPI/Events/Graphics.cs @@ -2,11 +2,47 @@ namespace StardewModdingAPI.Events
{
+ /// <summary>
+ ///
+ /// </summary>
public static class GraphicsEvents
{
+ /// <summary>
+ /// Occurs when the form (game) is resized.
+ /// </summary>
public static event EventHandler Resize = delegate { };
- public static event EventHandler DrawTick = delegate { };
- public static event EventHandler DrawInRenderTargetTick = delegate { };
+
+
+
+ /// <summary>
+ /// Occurs before anything is drawn.
+ /// </summary>
+ public static event EventHandler OnPreRenderEvent = delegate { };
+
+ /// <summary>
+ /// Occurs before the GUI is drawn.
+ /// </summary>
+ public static event EventHandler OnPreRenderGuiEvent = delegate { };
+
+ /// <summary>
+ /// Occurs after the GUI is drawn.
+ /// </summary>
+ public static event EventHandler OnPostRenderGuiEvent = delegate { };
+
+ /// <summary>
+ /// Occurs before the HUD is drawn.
+ /// </summary>
+ public static event EventHandler OnPreRenderHudEvent = delegate { };
+
+ /// <summary>
+ /// Occurs after the HUD is drawn.
+ /// </summary>
+ public static event EventHandler OnPostRenderHudEvent = delegate { };
+
+ /// <summary>
+ /// Occurs after everything is drawn.
+ /// </summary>
+ public static event EventHandler OnPostRenderEvent = delegate { };
/// <summary>
/// Draws when SGame.Debug is true. F3 toggles this.
@@ -16,6 +52,52 @@ namespace StardewModdingAPI.Events /// </summary>
public static event EventHandler DrawDebug = delegate { };
+ internal static void InvokeDrawDebug(object sender, EventArgs e)
+ {
+ DrawDebug.Invoke(sender, e);
+ }
+
+ internal static void InvokeOnPreRenderEvent(object sender, EventArgs e)
+ {
+ OnPreRenderEvent.Invoke(sender, e);
+ }
+
+ internal static void InvokeOnPreRenderGuiEvent(object sender, EventArgs e)
+ {
+ OnPreRenderGuiEvent.Invoke(sender, e);
+ }
+
+ internal static void InvokeOnPostRenderGuiEvent(object sender, EventArgs e)
+ {
+ OnPostRenderGuiEvent.Invoke(sender, e);
+ }
+
+ internal static void InvokeOnPreRenderHudEvent(object sender, EventArgs e)
+ {
+ OnPreRenderHudEvent.Invoke(sender, e);
+ }
+
+ internal static void InvokeOnPostRenderHudEvent(object sender, EventArgs e)
+ {
+ OnPostRenderHudEvent.Invoke(sender, e);
+ }
+
+ internal static void InvokeOnPostRenderEvent(object sender, EventArgs e)
+ {
+ OnPostRenderEvent.Invoke(sender, e);
+ }
+
+
+
+ #region To Remove
+
+ [Obsolete("Use the other Pre/Post render events instead.")]
+ public static event EventHandler DrawTick = delegate { };
+
+ [Obsolete("Use the other Pre/Post render events instead. All of them will automatically be drawn into the render target if needed.")]
+ public static event EventHandler DrawInRenderTargetTick = delegate { };
+
+ [Obsolete("Should not be used.")]
public static void InvokeDrawTick()
{
try
@@ -28,19 +110,18 @@ namespace StardewModdingAPI.Events }
}
+ [Obsolete("Should not be used.")]
public static void InvokeDrawInRenderTargetTick()
{
DrawInRenderTargetTick.Invoke(null, EventArgs.Empty);
}
+ [Obsolete("Should not be used.")]
public static void InvokeResize(object sender, EventArgs e)
{
Resize.Invoke(sender, e);
}
- public static void InvokeDrawDebug(object sender, EventArgs e)
- {
- DrawDebug.Invoke(sender, e);
- }
+ #endregion
}
}
\ No newline at end of file diff --git a/StardewModdingAPI/Events/Location.cs b/StardewModdingAPI/Events/Location.cs index d5b6cdec..f951ab95 100644 --- a/StardewModdingAPI/Events/Location.cs +++ b/StardewModdingAPI/Events/Location.cs @@ -12,12 +12,12 @@ namespace StardewModdingAPI.Events public static event EventHandler<EventArgsLocationObjectsChanged> LocationObjectsChanged = delegate { };
public static event EventHandler<EventArgsCurrentLocationChanged> CurrentLocationChanged = delegate { };
- public static void InvokeLocationsChanged(List<GameLocation> newLocations)
+ internal static void InvokeLocationsChanged(List<GameLocation> newLocations)
{
LocationsChanged.Invoke(null, new EventArgsGameLocationsChanged(newLocations));
}
- public static void InvokeCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
+ internal static void InvokeCurrentLocationChanged(GameLocation priorLocation, GameLocation newLocation)
{
CurrentLocationChanged.Invoke(null, new EventArgsCurrentLocationChanged(priorLocation, newLocation));
}
diff --git a/StardewModdingAPI/Events/Menu.cs b/StardewModdingAPI/Events/Menu.cs index 8acfc863..466a364e 100644 --- a/StardewModdingAPI/Events/Menu.cs +++ b/StardewModdingAPI/Events/Menu.cs @@ -7,7 +7,7 @@ namespace StardewModdingAPI.Events {
public static event EventHandler<EventArgsClickableMenuChanged> MenuChanged = delegate { };
- public static void InvokeMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu)
+ internal static void InvokeMenuChanged(IClickableMenu priorMenu, IClickableMenu newMenu)
{
MenuChanged.Invoke(null, new EventArgsClickableMenuChanged(priorMenu, newMenu));
}
diff --git a/StardewModdingAPI/Events/Mine.cs b/StardewModdingAPI/Events/Mine.cs index 2f89c91d..55514d42 100644 --- a/StardewModdingAPI/Events/Mine.cs +++ b/StardewModdingAPI/Events/Mine.cs @@ -6,7 +6,7 @@ namespace StardewModdingAPI.Events {
public static event EventHandler<EventArgsMineLevelChanged> MineLevelChanged = delegate { };
- public static void InvokeMineLevelChanged(int previousMinelevel, int currentMineLevel)
+ internal static void InvokeMineLevelChanged(int previousMinelevel, int currentMineLevel)
{
MineLevelChanged.Invoke(null, new EventArgsMineLevelChanged(previousMinelevel, currentMineLevel));
}
diff --git a/StardewModdingAPI/Events/Player.cs b/StardewModdingAPI/Events/Player.cs index a658259e..22f572b7 100644 --- a/StardewModdingAPI/Events/Player.cs +++ b/StardewModdingAPI/Events/Player.cs @@ -12,22 +12,22 @@ namespace StardewModdingAPI.Events public static event EventHandler<EventArgsLevelUp> LeveledUp = delegate { };
public static event EventHandler<EventArgsLoadedGameChanged> LoadedGame = delegate { };
- public static void InvokeFarmerChanged(Farmer priorFarmer, Farmer newFarmer)
+ internal static void InvokeFarmerChanged(Farmer priorFarmer, Farmer newFarmer)
{
FarmerChanged.Invoke(null, new EventArgsFarmerChanged(priorFarmer, newFarmer));
}
- public static void InvokeInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems)
+ internal static void InvokeInventoryChanged(List<Item> inventory, List<ItemStackChange> changedItems)
{
InventoryChanged.Invoke(null, new EventArgsInventoryChanged(inventory, changedItems));
}
- public static void InvokeLeveledUp(EventArgsLevelUp.LevelType type, int newLevel)
+ internal static void InvokeLeveledUp(EventArgsLevelUp.LevelType type, int newLevel)
{
LeveledUp.Invoke(null, new EventArgsLevelUp(type, newLevel));
}
- public static void InvokeLoadedGame(EventArgsLoadedGameChanged loaded)
+ internal static void InvokeLoadedGame(EventArgsLoadedGameChanged loaded)
{
LoadedGame.Invoke(null, loaded);
}
diff --git a/StardewModdingAPI/Events/Time.cs b/StardewModdingAPI/Events/Time.cs index 56b23dc3..39ca642a 100644 --- a/StardewModdingAPI/Events/Time.cs +++ b/StardewModdingAPI/Events/Time.cs @@ -9,24 +9,34 @@ namespace StardewModdingAPI.Events public static event EventHandler<EventArgsIntChanged> YearOfGameChanged = delegate { };
public static event EventHandler<EventArgsStringChanged> SeasonOfYearChanged = delegate { };
- public static void InvokeTimeOfDayChanged(int priorInt, int newInt)
+ /// <summary>
+ /// Occurs when Game1.newDay changes. True directly before saving, and False directly after.
+ /// </summary>
+ public static event EventHandler<EventArgsNewDay> OnNewDay = delegate { };
+
+ internal static void InvokeTimeOfDayChanged(int priorInt, int newInt)
{
TimeOfDayChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
}
- public static void InvokeDayOfMonthChanged(int priorInt, int newInt)
+ internal static void InvokeDayOfMonthChanged(int priorInt, int newInt)
{
DayOfMonthChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
}
- public static void InvokeYearOfGameChanged(int priorInt, int newInt)
+ internal static void InvokeYearOfGameChanged(int priorInt, int newInt)
{
YearOfGameChanged.Invoke(null, new EventArgsIntChanged(priorInt, newInt));
}
- public static void InvokeSeasonOfYearChanged(string priorString, string newString)
+ internal static void InvokeSeasonOfYearChanged(string priorString, string newString)
{
SeasonOfYearChanged.Invoke(null, new EventArgsStringChanged(priorString, newString));
}
+
+ internal static void InvokeOnNewDay(int priorInt, int newInt, bool newDay)
+ {
+ OnNewDay.Invoke(null, new EventArgsNewDay(priorInt, newInt, newDay));
+ }
}
}
\ No newline at end of file diff --git a/StardewModdingAPI/Inheritance/SGame.cs b/StardewModdingAPI/Inheritance/SGame.cs index b6fe727b..d6263d73 100644 --- a/StardewModdingAPI/Inheritance/SGame.cs +++ b/StardewModdingAPI/Inheritance/SGame.cs @@ -7,7 +7,12 @@ using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input;
using StardewModdingAPI.Events;
using StardewValley;
+using StardewValley.BellsAndWhistles;
+using StardewValley.Locations;
using StardewValley.Menus;
+using StardewValley.Tools;
+using xTile.Dimensions;
+using Rectangle = Microsoft.Xna.Framework.Rectangle;
namespace StardewModdingAPI.Inheritance
{
@@ -39,6 +44,7 @@ namespace StardewModdingAPI.Inheritance /// Useless at this time.
/// </summary>
[Obsolete]
+ // ReSharper disable once UnusedAutoPropertyAccessor.Local
public static Dictionary<int, SObject> ModItems { get; private set; }
/// <summary>
@@ -163,6 +169,11 @@ namespace StardewModdingAPI.Inheritance public int PreviousYearOfGame { get; private set; }
/// <summary>
+ /// The previous result of Game1.newDay
+ /// </summary>
+ public bool PreviousIsNewDay { get; private set; }
+
+ /// <summary>
/// The previous 'Farmer' (Player)
/// </summary>
public Farmer PreviousFarmer { get; private set; }
@@ -187,6 +198,24 @@ namespace StardewModdingAPI.Inheritance }
/// <summary>
+ ///
+ /// </summary>
+ public int ThumbstickMotionMargin
+ {
+ get { return (int)typeof(Game1).GetBaseFieldValue<object>(Program.gamePtr, "thumbstickMotionMargin"); }
+ set { typeof(Game1).SetBaseFieldValue<object>(this, "thumbstickMotionMargin", value); }
+ }
+
+ /// <summary>
+ /// The current Colour in Game1 (Private field, uses reflection)
+ /// </summary>
+ public Color BgColour
+ {
+ get { return (Color)typeof(Game1).GetBaseFieldValue<object>(Program.gamePtr, "bgColor"); }
+ set { typeof(Game1).SetBaseFieldValue<object>(this, "bgColor", value); }
+ }
+
+ /// <summary>
/// Static accessor for an Instance of the class SGame
/// </summary>
public static SGame Instance { get; private set; }
@@ -200,14 +229,7 @@ namespace StardewModdingAPI.Inheritance /// Whether or not we're in a pseudo 'debug' mode. Mostly for displaying information like FPS.
/// </summary>
public static bool Debug { get; private set; }
-
- /// <summary>
- /// A queue of messages to log when Debug is true.
- /// If debug is false this queue will be emptied every frame.
- /// Do not add to the queue if debug is false.
- /// The queue will be drawn once every Draw update.
- /// </summary>
- public static Queue<String> DebugMessageQueue { get; private set; }
+ internal static Queue<String> DebugMessageQueue { get; private set; }
/// <summary>
/// The current player (equal to Farmer.Player)
@@ -365,6 +387,11 @@ namespace StardewModdingAPI.Inheritance }
/// <summary>
+ /// Whether or not the game's zoom level is 1.0f
+ /// </summary>
+ public bool ZoomLevelIsOne => options.zoomLevel.Equals(1.0f);
+
+ /// <summary>
/// XNA Init Method
/// </summary>
protected override void Initialize()
@@ -395,21 +422,334 @@ namespace StardewModdingAPI.Inheritance /// <param name="gameTime"></param>
protected override void Update(GameTime gameTime)
{
+ QueueDebugMessage("FPS: " + FramesPerSecond);
UpdateEventCalls();
+ if (ZoomLevelIsOne)
+ {
+ options.zoomLevel = 0.99f;
+ InvokeBasePrivateInstancedMethod("Window_ClientSizeChanged", null, null);
+ }
+
if (FramePressedKeys.Contains(Keys.F3))
{
Debug = !Debug;
}
- try
+ if (FramePressedKeys.Contains(Keys.F2))
+ {
+ //Built-in debug mode
+ debugMode = !debugMode;
+ }
+
+ if (Constants.EnableCompletelyOverridingBaseCalls)
{
- base.Update(gameTime);
+ #region Overridden Update Call
+
+ if (Program.BuildType == 0)
+ SteamHelper.update();
+ if ((paused /*|| !this.IsActive*/) && (options == null || options.pauseWhenOutOfFocus || paused))
+ return;
+ if (quit)
+ Exit();
+ currentGameTime = gameTime;
+ if (gameMode != 11)
+ {
+ if (IsMultiplayer && gameMode == 3)
+ {
+ if (multiplayerMode == 2)
+ server.receiveMessages();
+ else
+ client.receiveMessages();
+ }
+ if (IsActive)
+ InvokeBasePrivateInstancedMethod("checkForEscapeKeys");
+ //this.checkForEscapeKeys();
+ updateMusic();
+ updateRaindropPosition();
+ if (bloom != null)
+ bloom.tick(gameTime);
+ if (globalFade)
+ {
+ if (!dialogueUp)
+ {
+ if (fadeIn)
+ {
+ fadeToBlackAlpha = Math.Max(0.0f, fadeToBlackAlpha - globalFadeSpeed);
+ if (fadeToBlackAlpha <= 0.0)
+ {
+ globalFade = false;
+ if (afterFade != null)
+ {
+ afterFadeFunction afterFadeFunction = afterFade;
+ afterFade();
+ if (afterFade != null && afterFade.Equals(afterFadeFunction))
+ afterFade = null;
+ if (nonWarpFade)
+ fadeToBlack = false;
+ }
+ }
+ }
+ else
+ {
+ fadeToBlackAlpha = Math.Min(1f, fadeToBlackAlpha + globalFadeSpeed);
+ if (fadeToBlackAlpha >= 1.0)
+ {
+ globalFade = false;
+ if (afterFade != null)
+ {
+ afterFadeFunction afterFadeFunction = afterFade;
+ afterFade();
+ if (afterFade != null && afterFade.Equals(afterFadeFunction))
+ afterFade = null;
+ if (nonWarpFade)
+ fadeToBlack = false;
+ }
+ }
+ }
+ }
+ else
+ InvokeBasePrivateInstancedMethod("UpdateControlInput", gameTime);
+ //this.UpdateControlInput(gameTime);
+ }
+ else if (pauseThenDoFunctionTimer > 0)
+ {
+ freezeControls = true;
+ pauseThenDoFunctionTimer -= gameTime.ElapsedGameTime.Milliseconds;
+ if (pauseThenDoFunctionTimer <= 0)
+ {
+ freezeControls = false;
+ if (afterPause != null)
+ afterPause();
+ }
+ }
+ if (gameMode == 3 || gameMode == 2)
+ {
+ player.millisecondsPlayed += (uint)gameTime.ElapsedGameTime.Milliseconds;
+ bool flag = true;
+ if (currentMinigame != null)
+ {
+ if (pauseTime > 0.0)
+ updatePause(gameTime);
+ if (fadeToBlack)
+ {
+ updateScreenFade(gameTime);
+ if (fadeToBlackAlpha >= 1.0)
+ fadeToBlack = false;
+ }
+ else
+ {
+ if (ThumbstickMotionMargin > 0)
+ ThumbstickMotionMargin -= gameTime.ElapsedGameTime.Milliseconds;
+ if (IsActive)
+ {
+ KeyboardState state1 = Keyboard.GetState();
+ MouseState state2 = Mouse.GetState();
+ GamePadState state3 = GamePad.GetState(PlayerIndex.One);
+ foreach (Keys keys in state1.GetPressedKeys())
+ {
+ if (!oldKBState.IsKeyDown(keys))
+ currentMinigame.receiveKeyPress(keys);
+ }
+ if (options.gamepadControls)
+ {
+ if (currentMinigame == null)
+ {
+ oldMouseState = state2;
+ oldKBState = state1;
+ oldPadState = state3;
+ return;
+ }
+ foreach (Buttons b in Utility.getPressedButtons(state3, oldPadState))
+ currentMinigame.receiveKeyPress(Utility.mapGamePadButtonToKey(b));
+ if (currentMinigame == null)
+ {
+ oldMouseState = state2;
+ oldKBState = state1;
+ oldPadState = state3;
+ return;
+ }
+ if (state3.ThumbSticks.Right.Y < -0.200000002980232 && oldPadState.ThumbSticks.Right.Y >= -0.200000002980232)
+ currentMinigame.receiveKeyPress(Keys.Down);
+ if (state3.ThumbSticks.Right.Y > 0.200000002980232 && oldPadState.ThumbSticks.Right.Y <= 0.200000002980232)
+ currentMinigame.receiveKeyPress(Keys.Up);
+ if (state3.ThumbSticks.Right.X < -0.200000002980232 && oldPadState.ThumbSticks.Right.X >= -0.200000002980232)
+ currentMinigame.receiveKeyPress(Keys.Left);
+ if (state3.ThumbSticks.Right.X > 0.200000002980232 && oldPadState.ThumbSticks.Right.X <= 0.200000002980232)
+ currentMinigame.receiveKeyPress(Keys.Right);
+ if (oldPadState.ThumbSticks.Right.Y < -0.200000002980232 && state3.ThumbSticks.Right.Y >= -0.200000002980232)
+ currentMinigame.receiveKeyRelease(Keys.Down);
+ if (oldPadState.ThumbSticks.Right.Y > 0.200000002980232 && state3.ThumbSticks.Right.Y <= 0.200000002980232)
+ currentMinigame.receiveKeyRelease(Keys.Up);
+ if (oldPadState.ThumbSticks.Right.X < -0.200000002980232 && state3.ThumbSticks.Right.X >= -0.200000002980232)
+ currentMinigame.receiveKeyRelease(Keys.Left);
+ if (oldPadState.ThumbSticks.Right.X > 0.200000002980232 && state3.ThumbSticks.Right.X <= 0.200000002980232)
+ currentMinigame.receiveKeyRelease(Keys.Right);
+ if (isGamePadThumbstickInMotion())
+ {
+ setMousePosition(getMouseX() + (int)(state3.ThumbSticks.Left.X * 16.0), getMouseY() - (int)(state3.ThumbSticks.Left.Y * 16.0));
+ lastCursorMotionWasMouse = false;
+ }
+ else if (getMousePosition().X != getOldMouseX() || getMousePosition().Y != getOldMouseY())
+ lastCursorMotionWasMouse = true;
+ }
+ foreach (Keys keys in oldKBState.GetPressedKeys())
+ {
+ if (!state1.IsKeyDown(keys))
+ currentMinigame.receiveKeyRelease(keys);
+ }
+ if (options.gamepadControls)
+ {
+ if (currentMinigame == null)
+ {
+ oldMouseState = state2;
+ oldKBState = state1;
+ oldPadState = state3;
+ return;
+ }
+ if (state3.IsConnected && state3.IsButtonDown(Buttons.X) && !oldPadState.IsButtonDown(Buttons.X))
+ currentMinigame.receiveRightClick(getMouseX(), getMouseY(), true);
+ else if (state3.IsConnected && state3.IsButtonDown(Buttons.A) && !oldPadState.IsButtonDown(Buttons.A))
+ currentMinigame.receiveLeftClick(getMouseX(), getMouseY(), true);
+ else if (state3.IsConnected && !state3.IsButtonDown(Buttons.X) && oldPadState.IsButtonDown(Buttons.X))
+ currentMinigame.releaseRightClick(getMouseX(), getMouseY());
+ else if (state3.IsConnected && !state3.IsButtonDown(Buttons.A) && oldPadState.IsButtonDown(Buttons.A))
+ currentMinigame.releaseLeftClick(getMouseX(), getMouseY());
+ foreach (Buttons b in Utility.getPressedButtons(oldPadState, state3))
+ currentMinigame.receiveKeyRelease(Utility.mapGamePadButtonToKey(b));
+ if (state3.IsConnected && state3.IsButtonDown(Buttons.A) && currentMinigame != null)
+ currentMinigame.leftClickHeld(0, 0);
+ }
+ if (currentMinigame == null)
+ {
+ oldMouseState = state2;
+ oldKBState = state1;
+ oldPadState = state3;
+ return;
+ }
+ if (state2.LeftButton == ButtonState.Pressed && oldMouseState.LeftButton != ButtonState.Pressed)
+ currentMinigame.receiveLeftClick(getMouseX(), getMouseY(), true);
+ if (state2.RightButton == ButtonState.Pressed && oldMouseState.RightButton != ButtonState.Pressed)
|
