diff options
| author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-04 00:10:10 -0400 |
|---|---|---|
| committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-04 00:10:10 -0400 |
| commit | 69bb8178d216d2d75d771114643d6749abdc7aea (patch) | |
| tree | 07161a3e38efb1733fbc47bcb98d24cac6fbebe7 /src/StardewModdingAPI | |
| parent | c01ffd233120cad625b74d4cec69a52cb9c1ce0b (diff) | |
| download | SMAPI-69bb8178d216d2d75d771114643d6749abdc7aea.tar.gz SMAPI-69bb8178d216d2d75d771114643d6749abdc7aea.tar.bz2 SMAPI-69bb8178d216d2d75d771114643d6749abdc7aea.zip | |
normalise inconsistent line endings
Diffstat (limited to 'src/StardewModdingAPI')
| -rw-r--r-- | src/StardewModdingAPI/Inheritance/ItemStackChange.cs | 20 | ||||
| -rw-r--r-- | src/StardewModdingAPI/Inheritance/SGame.cs | 2678 | ||||
| -rw-r--r-- | src/StardewModdingAPI/Program.cs | 740 | ||||
| -rw-r--r-- | src/StardewModdingAPI/StardewModdingAPI.csproj | 512 | ||||
| -rw-r--r-- | src/StardewModdingAPI/packages.config | 10 |
5 files changed, 1980 insertions, 1980 deletions
diff --git a/src/StardewModdingAPI/Inheritance/ItemStackChange.cs b/src/StardewModdingAPI/Inheritance/ItemStackChange.cs index 78775094..8abe3a76 100644 --- a/src/StardewModdingAPI/Inheritance/ItemStackChange.cs +++ b/src/StardewModdingAPI/Inheritance/ItemStackChange.cs @@ -1,11 +1,11 @@ -using StardewValley;
-
-namespace StardewModdingAPI.Inheritance
-{
- public class ItemStackChange
- {
- public Item Item { get; set; }
- public int StackChange { get; set; }
- public ChangeType ChangeType { get; set; }
- }
+using StardewValley; + +namespace StardewModdingAPI.Inheritance +{ + public class ItemStackChange + { + public Item Item { get; set; } + public int StackChange { get; set; } + public ChangeType ChangeType { get; set; } + } }
\ No newline at end of file diff --git a/src/StardewModdingAPI/Inheritance/SGame.cs b/src/StardewModdingAPI/Inheritance/SGame.cs index 26421136..808f0812 100644 --- a/src/StardewModdingAPI/Inheritance/SGame.cs +++ b/src/StardewModdingAPI/Inheritance/SGame.cs @@ -1,1340 +1,1340 @@ -using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using Microsoft.Xna.Framework;
-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
-{
- /// <summary>
- /// The 'SGame' class.
- /// This summary, and many others, only exists because XML doc tags.
- /// </summary>
- public class SGame : Game1
- {
- private bool FireLoadedGameEvent;
-
- /// <summary>
- /// Gets a jagged array of all buttons pressed on the gamepad the prior frame.
- /// </summary>
- public Buttons[][] PreviouslyPressedButtons;
-
- internal SGame()
- {
- Instance = this;
- FirstUpdate = true;
- }
-
- /// <summary>
- /// The current KeyboardState
- /// </summary>
- public KeyboardState KStateNow { get; private set; }
- /// <summary>
- /// The prior KeyboardState
- /// </summary>
- public KeyboardState KStatePrior { get; private set; }
-
- /// <summary>
- /// The current MouseState
- /// </summary>
- public MouseState MStateNow { get; private set; }
-
- /// <summary>
- /// The prior MouseState
- /// </summary>
- public MouseState MStatePrior { get; private set; }
-
- /// <summary>The current mouse position on the screen adjusted for the zoom level.</summary>
- public Point MPositionNow { get; private set; }
-
- /// <summary>The previous mouse position on the screen adjusted for the zoom level.</summary>
- public Point MPositionPrior { get; private set; }
-
- /// <summary>
- /// All keys pressed on the current frame
- /// </summary>
- public Keys[] CurrentlyPressedKeys => KStateNow.GetPressedKeys();
-
- /// <summary>
- /// All keys pressed on the prior frame
- /// </summary>
- public Keys[] PreviouslyPressedKeys => KStatePrior.GetPressedKeys();
-
- /// <summary>
- /// All keys pressed on this frame except for the ones pressed on the prior frame
- /// </summary>
- public Keys[] FramePressedKeys => CurrentlyPressedKeys.Except(PreviouslyPressedKeys).ToArray();
-
- /// <summary>
- /// All keys pressed on the prior frame except for the ones pressed on the current frame
- /// </summary>
- public Keys[] FrameReleasedKeys => PreviouslyPressedKeys.Except(CurrentlyPressedKeys).ToArray();
-
- /// <summary>
- /// Whether or not a save was tagged as 'Loaded' the prior frame.
- /// </summary>
- public bool PreviouslyLoadedGame { get; private set; }
-
- /// <summary>
- /// The list of GameLocations on the prior frame
- /// </summary>
- public int PreviousGameLocations { get; private set; }
-
- /// <summary>
- /// The list of GameObjects on the prior frame
- /// </summary>
- public int PreviousLocationObjects { get; private set; }
-
- /// <summary>
- /// The list of Items in the player's inventory on the prior frame
- /// </summary>
- public Dictionary<Item, int> PreviousItems { get; private set; }
-
- /// <summary>
- /// The player's Combat level on the prior frame
- /// </summary>
- public int PreviousCombatLevel { get; private set; }
- /// <summary>
- /// The player's Farming level on the prior frame
- /// </summary>
- public int PreviousFarmingLevel { get; private set; }
- /// <summary>
- /// The player's Fishing level on the prior frame
- /// </summary>
- public int PreviousFishingLevel { get; private set; }
- /// <summary>
- /// The player's Foraging level on the prior frame
- /// </summary>
- public int PreviousForagingLevel { get; private set; }
- /// <summary>
- /// The player's Mining level on the prior frame
- /// </summary>
- public int PreviousMiningLevel { get; private set; }
- /// <summary>
- /// The player's Luck level on the prior frame
- /// </summary>
- public int PreviousLuckLevel { get; private set; }
-
- //Kill me now comments are so boring
-
- /// <summary>
- /// The player's previous game location
- /// </summary>
- public GameLocation PreviousGameLocation { get; private set; }
-
- /// <summary>
- /// The previous ActiveGameMenu in Game1
- /// </summary>
- public IClickableMenu PreviousActiveMenu { get; private set; }
-
- /// <summary>
- /// Indicates if the MenuClosed event was fired to prevent it from re-firing.
- /// </summary>
- internal bool WasMenuClosedInvoked = false;
-
- /// <summary>
- /// The previous mine level
- /// </summary>
- public int PreviousMineLevel { get; private set; }
-
- /// <summary>
- /// The previous TimeOfDay (Int32 between 600 and 2400?)
- /// </summary>
- public int PreviousTimeOfDay { get; private set; }
-
- /// <summary>
- /// The previous DayOfMonth (Int32 between 1 and 28?)
- /// </summary>
- public int PreviousDayOfMonth { get; private set; }
-
- /// <summary>
- /// The previous Season (String as follows: "winter", "spring", "summer", "fall")
- /// </summary>
- public string PreviousSeasonOfYear { get; private set; }
-
- /// <summary>
- /// The previous Year
- /// </summary>
- 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; }
-
- /// <summary>
- /// The current index of the update tick. Recycles every 60th tick to 0. (Int32 between 0 and 59)
- /// </summary>
- public int CurrentUpdateTick { get; private set; }
-
- /// <summary>
- /// Whether or not this update frame is the very first of the entire game
- /// </summary>
- public bool FirstUpdate { get; private set; }
-
- /// <summary>
- /// The current RenderTarget in Game1 (Private field, uses reflection)
- /// </summary>
- public RenderTarget2D Screen
- {
- get { return typeof (Game1).GetBaseFieldValue<RenderTarget2D>(Program.gamePtr, "screen"); }
- set { typeof (Game1).SetBaseFieldValue<RenderTarget2D>(this, "screen", 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; }
-
- /// <summary>
- /// The game's FPS. Re-determined every Draw update.
- /// </summary>
- public static float FramesPerSecond { get; private set; }
-
- /// <summary>
- /// Whether or not we're in a pseudo 'debug' mode. Mostly for displaying information like FPS.
- /// </summary>
- public static bool Debug { get; private set; }
- internal static Queue<String> DebugMessageQueue { get; private set; }
-
- /// <summary>
- /// The current player (equal to Farmer.Player)
- /// </summary>
- [Obsolete("Use Farmer.Player instead")]
- public Farmer CurrentFarmer => player;
-
- /// <summary>
- /// Gets ALL static fields that belong to 'Game1'
- /// </summary>
- public static FieldInfo[] GetStaticFields => typeof (Game1).GetFields();
-
- /// <summary>
- /// Whether or not a button was just pressed on the controller
- /// </summary>
- /// <param name="button"></param>
- /// <param name="buttonState"></param>
- /// <param name="stateIndex"></param>
- /// <returns></returns>
- private bool WasButtonJustPressed(Buttons button, ButtonState buttonState, PlayerIndex stateIndex)
- {
- return buttonState == ButtonState.Pressed && !PreviouslyPressedButtons[(int) stateIndex].Contains(button);
- }
-
- /// <summary>
- /// Whether or not a button was just released on the controller
- /// </summary>
- /// <param name="button"></param>
- /// <param name="buttonState"></param>
- /// <param name="stateIndex"></param>
- /// <returns></returns>
- private bool WasButtonJustReleased(Buttons button, ButtonState buttonState, PlayerIndex stateIndex)
- {
- return buttonState == ButtonState.Released && PreviouslyPressedButtons[(int) stateIndex].Contains(button);
- }
-
- /// <summary>
- /// Whether or not an analog button was just pressed on the controller
- /// </summary>
- /// <param name="button"></param>
- /// <param name="value"></param>
- /// <param name="stateIndex"></param>
- /// <returns></returns>
- private bool WasButtonJustPressed(Buttons button, float value, PlayerIndex stateIndex)
- {
- return WasButtonJustPressed(button, value > 0.2f ? ButtonState.Pressed : ButtonState.Released, stateIndex);
- }
-
- /// <summary>
- /// Whether or not an analog button was just released on the controller
- /// </summary>
- /// <param name="button"></param>
- /// <param name="value"></param>
- /// <param name="stateIndex"></param>
- /// <returns></returns>
- private bool WasButtonJustReleased(Buttons button, float value, PlayerIndex stateIndex)
- {
- return WasButtonJustReleased(button, value > 0.2f ? ButtonState.Pressed : ButtonState.Released, stateIndex);
- }
-
- /// <summary>
- /// Gets an array of all Buttons pressed on a joystick
- /// </summary>
- /// <param name="index"></param>
- /// <returns></returns>
- public Buttons[] GetButtonsDown(PlayerIndex index)
- {
- var state = GamePad.GetState(index);
- var buttons = new List<Buttons>();
- if (state.IsConnected)
- {
- if (state.Buttons.A == ButtonState.Pressed) buttons.Add(Buttons.A);
- if (state.Buttons.B == ButtonState.Pressed) buttons.Add(Buttons.B);
- if (state.Buttons.Back == ButtonState.Pressed) buttons.Add(Buttons.Back);
- if (state.Buttons.BigButton == ButtonState.Pressed) buttons.Add(Buttons.BigButton);
- if (state.Buttons.LeftShoulder == ButtonState.Pressed) buttons.Add(Buttons.LeftShoulder);
- if (state.Buttons.LeftStick == ButtonState.Pressed) buttons.Add(Buttons.LeftStick);
- if (state.Buttons.RightShoulder == ButtonState.Pressed) buttons.Add(Buttons.RightShoulder);
- if (state.Buttons.RightStick == ButtonState.Pressed) buttons.Add(Buttons.RightStick);
- if (state.Buttons.Start == ButtonState.Pressed) buttons.Add(Buttons.Start);
- if (state.Buttons.X == ButtonState.Pressed) buttons.Add(Buttons.X);
- if (state.Buttons.Y == ButtonState.Pressed) buttons.Add(Buttons.Y);
- if (state.DPad.Up == ButtonState.Pressed) buttons.Add(Buttons.DPadUp);
- if (state.DPad.Down == ButtonState.Pressed) buttons.Add(Buttons.DPadDown);
- if (state.DPad.Left == ButtonState.Pressed) buttons.Add(Buttons.DPadLeft);
- if (state.DPad.Right == ButtonState.Pressed) buttons.Add(Buttons.DPadRight);
- if (state.Triggers.Left > 0.2f) buttons.Add(Buttons.LeftTrigger);
- if (state.Triggers.Right > 0.2f) buttons.Add(Buttons.RightTrigger);
- }
- return buttons.ToArray();
- }
-
- /// <summary>
- /// Gets all buttons that were pressed on the current frame of a joystick
- /// </summary>
- /// <param name="index"></param>
- /// <returns></returns>
- public Buttons[] GetFramePressedButtons(PlayerIndex index)
- {
- var state = GamePad.GetState(index);
- var buttons = new List<Buttons>();
- if (state.IsConnected)
- {
- if (WasButtonJustPressed(Buttons.A, state.Buttons.A, index)) buttons.Add(Buttons.A);
- if (WasButtonJustPressed(Buttons.B, state.Buttons.B, index)) buttons.Add(Buttons.B);
- if (WasButtonJustPressed(Buttons.Back, state.Buttons.Back, index)) buttons.Add(Buttons.Back);
- if (WasButtonJustPressed(Buttons.BigButton, state.Buttons.BigButton, index)) buttons.Add(Buttons.BigButton);
- if (WasButtonJustPressed(Buttons.LeftShoulder, state.Buttons.LeftShoulder, index)) buttons.Add(Buttons.LeftShoulder);
- if (WasButtonJustPressed(Buttons.LeftStick, state.Buttons.LeftStick, index)) buttons.Add(Buttons.LeftStick);
- if (WasButtonJustPressed(Buttons.RightShoulder, state.Buttons.RightShoulder, index)) buttons.Add(Buttons.RightShoulder);
- if (WasButtonJustPressed(Buttons.RightStick, state.Buttons.RightStick, index)) buttons.Add(Buttons.RightStick);
- if (WasButtonJustPressed(Buttons.Start, state.Buttons.Start, index)) buttons.Add(Buttons.Start);
- if (WasButtonJustPressed(Buttons.X, state.Buttons.X, index)) buttons.Add(Buttons.X);
- if (WasButtonJustPressed(Buttons.Y, state.Buttons.Y, index)) buttons.Add(Buttons.Y);
- if (WasButtonJustPressed(Buttons.DPadUp, state.DPad.Up, index)) buttons.Add(Buttons.DPadUp);
- if (WasButtonJustPressed(Buttons.DPadDown, state.DPad.Down, index)) buttons.Add(Buttons.DPadDown);
- if (WasButtonJustPressed(Buttons.DPadLeft, state.DPad.Left, index)) buttons.Add(Buttons.DPadLeft);
- if (WasButtonJustPressed(Buttons.DPadRight, state.DPad.Right, index)) buttons.Add(Buttons.DPadRight);
- if (WasButtonJustPressed(Buttons.LeftTrigger, state.Triggers.Left, index)) buttons.Add(Buttons.LeftTrigger);
- if (WasButtonJustPressed(Buttons.RightTrigger, state.Triggers.Right, index)) buttons.Add(Buttons.RightTrigger);
- }
- return buttons.ToArray();
- }
-
- /// <summary>
- /// Gets all buttons that were released on the current frame of a joystick
- /// </summary>
- /// <param name="index"></param>
- /// <returns></returns>
- public Buttons[] GetFrameReleasedButtons(PlayerIndex index)
- {
- var state = GamePad.GetState(index);
- var buttons = new List<Buttons>();
- if (state.IsConnected)
- {
- if (WasButtonJustReleased(Buttons.A, state.Buttons.A, index)) buttons.Add(Buttons.A);
- if (WasButtonJustReleased(Buttons.B, state.Buttons.B, index)) buttons.Add(Buttons.B);
- if (WasButtonJustReleased(Buttons.Back, state.Buttons.Back, index)) buttons.Add(Buttons.Back);
- if (WasButtonJustReleased(Buttons.BigButton, state.Buttons.BigButton, index)) buttons.Add(Buttons.BigButton);
- if (WasButtonJustReleased(Buttons.LeftShoulder, state.Buttons.LeftShoulder, index)) buttons.Add(Buttons.LeftShoulder);
- if (WasButtonJustReleased(Buttons.LeftStick, state.Buttons.LeftStick, index)) buttons.Add(Buttons.LeftStick);
- if (WasButtonJustReleased(Buttons.RightShoulder, state.Buttons.RightShoulder, index)) buttons.Add(Buttons.RightShoulder);
- if (WasButtonJustReleased(Buttons.RightStick, state.Buttons.RightStick, index)) buttons.Add(Buttons.RightStick);
- if (WasButtonJustReleased(Buttons.Start, state.Buttons.Start, index)) buttons.Add(Buttons.Start);
- if (WasButtonJustReleased(Buttons.X, state.Buttons.X, index)) buttons.Add(Buttons.X);
- if (WasButtonJustReleased(Buttons.Y, state.Buttons.Y, index)) buttons.Add(Buttons.Y);
- if (WasButtonJustReleased(Buttons.DPadUp, state.DPad.Up, index)) buttons.Add(Buttons.DPadUp);
- if (WasButtonJustReleased(Buttons.DPadDown, state.DPad.Down, index)) buttons.Add(Buttons.DPadDown);
- if (WasButtonJustReleased(Buttons.DPadLeft, state.DPad.Left, index)) buttons.Add(Buttons.DPadLeft);
- if (WasButtonJustReleased(Buttons.DPadRight, state.DPad.Right, index)) buttons.Add(Buttons.DPadRight);
- if (WasButtonJustReleased(Buttons.LeftTrigger, state.Triggers.Left, index)) buttons.Add(Buttons.LeftTrigger);
- if (WasButtonJustReleased(Buttons.RightTrigger, state.Triggers.Right, index)) buttons.Add(Buttons.RightTrigger);
- }
- return buttons.ToArray();
- }
-
- /// <summary>
- ///
- /// </summary>
- public static MethodInfo DrawFarmBuildings = typeof (Game1).GetMethod("drawFarmBuildings", BindingFlags.NonPublic | BindingFlags.Instance);
-
- /// <summary>
- ///
- /// </summary>
- public static MethodInfo DrawHUD = typeof (Game1).GetMethod("drawHUD", BindingFlags.NonPublic | BindingFlags.Instance);
-
- /// <summary>
- ///
- /// </summary>
- public static MethodInfo DrawDialogueBox = typeof (Game1).GetMethod("drawDialogueBox", BindingFlags.NonPublic | BindingFlags.Instance);
-
- public static MethodInfo CheckForEscapeKeys = typeof (Game1).GetMethod("checkForEscapeKeys", BindingFlags.NonPublic | BindingFlags.Instance);
-
- public static MethodInfo UpdateControlInput = typeof(Game1).GetMethod("UpdateControlInput", BindingFlags.NonPublic | BindingFlags.Instance);
-
- public static MethodInfo UpdateCharacters = typeof(Game1).GetMethod("UpdateCharacters", BindingFlags.NonPublic | BindingFlags.Instance);
-
- public static MethodInfo UpdateLocations = typeof(Game1).GetMethod("UpdateLocations", BindingFlags.NonPublic | BindingFlags.Instance);
-
- public static MethodInfo getViewportCenter = typeof(Game1).GetMethod("getViewportCenter", BindingFlags.NonPublic | BindingFlags.Instance);
-
- public static MethodInfo UpdateTitleScreen = typeof(Game1).GetMethod("UpdateTitleScreen", BindingFlags.NonPublic | BindingFlags.Instance);
-
- public delegate void BaseBaseDraw();
-
- /// <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()
- {
- Log.AsyncY("XNA Initialize");
- //ModItems = new Dictionary<int, SObject>();
- DebugMessageQueue = new Queue<string>();
- PreviouslyPressedButtons = new Buttons[4][];
- for (var i = 0; i < 4; ++i) PreviouslyPressedButtons[i] = new Buttons[0];
-
- base.Initialize();
- GameEvents.InvokeInitialize();
- }
-
- /// <summary>
- /// XNA LC Method
- /// </summary>
- protected override void LoadContent()
- {
- Log.AsyncY("XNA LoadContent");
- base.LoadContent();
- GameEvents.InvokeLoadContent();
- }
-
- /// <summary>
- /// XNA Update Method
- /// </summary>
- /// <param name="gameTime"></param>
- protected override void Update(GameTime gameTime)
- {
- QueueDebugMessage("FPS: " + FramesPerSecond);
- UpdateEventCalls();
-
- if (FramePressedKeys.Contains(Keys.F3))
- {
- Debug = !Debug;
- }
-
- try
- {
- base.Update(gameTime);
- }
- catch (Exception ex)
- {
- Log.AsyncR("An error occured in the base update loop: " + ex);
- Console.ReadKey();
- }
-
- GameEvents.InvokeUpdateTick();
- if (FirstUpdate)
- {
- GameEvents.InvokeFirstUpdateTick();
- FirstUpdate = false;
- }
-
- if (CurrentUpdateTick % 2 == 0)
- GameEvents.InvokeSecondUpdateTick();
-
- if (CurrentUpdateTick % 4 == 0)
- GameEvents.InvokeFourthUpdateTick();
-
- if (CurrentUpdateTick % 8 == 0)
- GameEvents.InvokeEighthUpdateTick();
-
- if (CurrentUpdateTick % 15 == 0)
- GameEvents.InvokeQuarterSecondTick();
-
- if (CurrentUpdateTick % 30 == 0)
- GameEvents.InvokeHalfSecondTick();
-
- if (CurrentUpdateTick % 60 == 0)
- GameEvents.InvokeOneSecondTick();
-
- CurrentUpdateTick += 1;
- if (CurrentUpdateTick >= 60)
- CurrentUpdateTick = 0;
-
- if (KStatePrior != KStateNow)
- KStatePrior = KStateNow;
-
- for (var i = PlayerIndex.One; i <= PlayerIndex.Four; i++)
- {
- PreviouslyPressedButtons[(int) i] = GetButtonsDown(i);
- }
- }
-
- /// <summary>
- /// XNA Draw Method
- /// </summary>
- /// <param name="gameTime"></param>
- protected override void Draw(GameTime gameTime)
- {
- FramesPerSecond = 1 / (float) gameTime.ElapsedGameTime.TotalSeconds;
-
- if (Constants.EnableCompletelyOverridingBaseCalls)
- {
- #region Overridden Draw
-
- try
- {
- if (!ZoomLevelIsOne)
- {
- GraphicsDevice.SetRenderTarget(Screen);
- }
-
- GraphicsDevice.Clear(BgColour);
- if (options.showMenuBackground && activeClickableMenu != null && activeClickableMenu.showWithoutTransparencyIfOptionIsSet())
- {
- spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
- activeClickableMenu.drawBackground(spriteBatch);
- GraphicsEvents.InvokeOnPreRenderGuiEvent(null, EventArgs.Empty);
- activeClickableMenu.draw(spriteBatch);
- GraphicsEvents.InvokeOnPostRenderGuiEvent(null, EventArgs.Empty);
- spriteBatch.End();
- if (!ZoomLevelIsOne)
- {
- GraphicsDevice.SetRenderTarget(null);
- GraphicsDevice.Clear(BgColour);
- spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
- spriteBatch.Draw(Screen, Vector2.Zero, Screen.Bounds, Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
- spriteBatch.End();
- }
- return;
- }
- if (gameMode == 11)
- {
- spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
- spriteBatch.DrawString(smoothFont, "Stardew Valley has crashed...", new Vector2(16f, 16f), Color.HotPink);
- spriteBatch.DrawString(smoothFont, "Please send the error report or a screenshot of this message to @ConcernedApe. (http://stardewvalley.net/contact/)", new Vector2(16f, 32f), new Color(0, 255, 0));
- spriteBatch.DrawString(smoothFont, parseText(errorMessage, smoothFont, graphics.GraphicsDevice.Viewport.Width), new Vector2(16f, 48f), Color.White);
- spriteBatch.End();
- return;
- }
- if (currentMinigame != null)
- {
- currentMinigame.draw(spriteBatch);
- if (globalFade && !menuUp && (!nameSelectUp || messagePause))
- {
- spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
- spriteBatch.Draw(fadeToBlackRect, graphics.GraphicsDevice.Viewport.Bounds, Color.Black * ((gameMode == 0) ? (1f - fadeToBlackAlpha) : fadeToBlackAlpha));
- spriteBatch.End();
- }
- if (!ZoomLevelIsOne)
- {
- GraphicsDevice.SetRenderTarget(null);
- GraphicsDevice.Clear(BgColour);
- spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
- spriteBatch.Draw(Screen, Vector2.Zero, Screen.Bounds, Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
- spriteBatch.End();
- }
- return;
- }
- if (showingEndOfNightStuff)
- {
- spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
- activeClickableMenu?.draw(spriteBatch);
- spriteBatch.End();
- if (!ZoomLevelIsOne)
- {
- GraphicsDevice.SetRenderTarget(null);
- GraphicsDevice.Clear(BgColour);
- spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
- spriteBatch.Draw(Screen, Vector2.Zero, Screen.Bounds, Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
- spriteBatch.End();
- }
- return;
- }
- if (gameMode == 6)
- {
- spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
- string text = "";
- int num = 0;
- while (num < gameTime.TotalGameTime.TotalMilliseconds % 999.0 / 333.0)
- {
- text += ".";
- num++;
- }
- SpriteText.drawString(spriteBatch, "Loading" + text, 64, graphics.GraphicsDevice.Viewport.Height - 64, 999, -1, 999, 1f, 1f, false, 0, "Loading...");
- spriteBatch.End();
- if (!ZoomLevelIsOne)
- {
- GraphicsDevice.SetRenderTarget(null);
- GraphicsDevice.Clear(BgColour);
- spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
- spriteBatch.Draw(Screen, Vector2.Zero, Screen.Bounds, Color.White, 0f, Vector2.Zero, options.zoomLevel, SpriteEffects.None, 1f);
- spriteBatch.End();
- }
- return;
- }
- if (gameMode == 0)
- {
- spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
- }
- else
- {
- if (drawLighting)
- {
- GraphicsDevice.SetRenderTarget(lightmap);
- GraphicsDevice.Clear(Color.White * 0f);
- spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, null, null);
- spriteBatch.Draw(staminaRect, lightmap.Bounds, currentLocation.name.Equals("UndergroundMine") ? mine.getLightingColor(gameTime) : ((!ambientLight.Equals(Color.White) && (!isRaining || !currentLocation.isOutdoors)) ? ambientLight : outdoorLight));
- for (int i = 0; i < currentLightSources.Count; i++)
- {
- if (Utility.isOnScreen(currentLightSources.ElementAt(i).position, (int) (currentLightSources.ElementAt(i).radius * tileSize * 4f)))
- {
- spriteBatch.Draw(currentLightSources.ElementAt(i).lightTexture, GlobalToLocal(viewport, currentLightSources.ElementAt(i).position) / options.lightingQuality, currentLightSources.ElementAt(i).lightTexture.Bounds, currentLightSources.ElementAt(i).color, 0f, new Vector2(currentLightSources.ElementAt(i).lightTexture.Bounds.Center.X, currentLightSources.ElementAt(i).lightTexture.Bounds.Center.Y), currentLightSources.ElementAt(i).radius / options.lightingQuality, SpriteEffects.None, 0.9f);
- }
- }
- spriteBatch.End();
- GraphicsDevice.SetRenderTarget(ZoomLevelIsOne ? null : Screen);
- }
- if (bloomDay)
- {
- bloom?.BeginDraw();
- }
- GraphicsDevice.Clear(BgColour);
- spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
- GraphicsEvents.InvokeOnPreRenderEvent(null, EventArgs.Empty);
- background?.draw(spriteBatch);
- mapDisplayDevice.BeginScene(spriteBatch);
- currentLocation.Map.GetLayer("Back").Draw(mapDisplayDevice, viewport, Location.Origin, false, pixelZoom);
- currentLocation.drawWater(spriteBatch);
- if (CurrentEvent == null)
- {
- using (List<NPC>.Enumerator enumerator = currentLocation.characters.GetEnumerator())
- {
- while (enumerator.MoveNext())
- {
- NPC current = enumerator.Current;
- if (current != null && !current.swimming && !current.hideShadow && !current.IsMonster && !currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(current.getTileLocation()))
- {
- spriteBatch.Draw(shadowTexture, GlobalToLocal(viewport, current.position + new Vector2(current.sprite.spriteWidth * pixelZoom / 2f, current.GetBoundingBox().Height + (current.IsMonster ? 0 : (pixelZoom * 3)))), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), (pixelZoom + current.yJumpOffset / 40f) * current.scale, SpriteEffects.None, Math.Max(0f, current.getStandingY() / 10000f) - 1E-06f);
- }
- }
- goto IL_B30;
- }
- }
- foreach (NPC current2 in CurrentEvent.actors)
- {
- if (!current2.swimming && !current2.hideShadow && !currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(current2.getTileLocation()))
- {
- spriteBatch.Draw(shadowTexture, GlobalToLocal(viewport, current2.position + new Vector2(current2.sprite.spriteWidth * pixelZoom / 2f, current2.GetBoundingBox().Height + (current2.IsMonster ? 0 : (pixelZoom * 3)))), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), (pixelZoom + current2.yJumpOffset / 40f) * current2.scale, SpriteEffects.None, Math.Max(0f, current2.getStandingY() / 10000f) - 1E-06f);
- }
- }
- IL_B30:
- if (!player.swimming && !player.isRidingHorse() && !currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(player.getTileLocation()))
- {
- spriteBatch.Draw(shadowTexture, GlobalToLocal(player.position + new Vector2(32f, 24f)), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), 4f - (((player.running || player.usingTool) && player.FarmerSprite.indexInCurrentAnimation > 1) ? (Math.Abs(FarmerRenderer.featureYOffsetPerFrame[player.FarmerSprite.CurrentFrame]) * 0.5f) : 0f), SpriteEffects.None, 0f);
- }
- currentLocation.Map.GetLayer("Buildings").Draw(mapDisplayDevice, viewport, Location.Origin, false, pixelZoom);
- mapDisplayDevice.EndScene();
- spriteBatch.End();
- spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
- if (CurrentEvent == null)
- {
- using (List<NPC>.Enumerator enumerator3 = currentLocation.characters.GetEnumerator())
- {
- while (enumerator3.MoveNext())
- {
- NPC current3 = enumerator3.Current;
- if (current3 != null && !current3.swimming && !current3.hideShadow && currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(current3.getTileLocation()))
- {
- spriteBatch.Draw(shadowTexture, GlobalToLocal(viewport, current3.position + new Vector2(current3.sprite.spriteWidth * pixelZoom / 2f, current3.GetBoundingBox().Height + (current3.IsMonster ? 0 : (pixelZoom * 3)))), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), (pixelZoom + current3.yJumpOffset / 40f) * current3.scale, SpriteEffects.None, Math.Max(0f, current3.getStandingY() / 10000f) - 1E-06f);
- }
- }
- goto IL_F5F;
- }
- }
- foreach (NPC current4 in CurrentEvent.actors)
- {
- if (!current4.swimming && !current4.hideShadow && currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(current4.getTileLocation()))
- {
- spriteBatch.Draw(shadowTexture, GlobalToLocal(viewport, current4.position + new Vector2(current4.sprite.spriteWidth * pixelZoom / 2f, current4.GetBoundingBox().Height + (current4.IsMonster ? 0 : (pixelZoom * 3)))), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), (pixelZoom + current4.yJumpOffset / 40f) * current4.scale, SpriteEffects.None, Math.Max(0f, current4.getStandingY() / 10000f) - 1E-06f);
- }
- }
- IL_F5F:
- if (!player.swimming && !player.isRidingHorse() && currentLocation.shouldShadowBeDrawnAboveBuildingsLayer(player.getTileLocation()))
- {
- spriteBatch.Draw(shadowTexture, GlobalToLocal(player.position + new Vector2(32f, 24f)), shadowTexture.Bounds, Color.White, 0f, new Vector2(shadowTexture.Bounds.Center.X, shadowTexture.Bounds.Center.Y), 4f - (((player.running || player.usingTool) && player.FarmerSprite.indexInCurrentAnimation > 1) ? (Math.Abs(FarmerRenderer.featureYOffsetPerFrame[player.FarmerSprite.CurrentFrame]) * 0.5f) : 0f), SpriteEffects.None, Math.Max(0.0001f, player.getStandingY() / 10000f + 0.00011f) - 0.0001f);
- |
