Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ DrawSurfaceBG_Desert()

void Terraria.Main.DrawSurfaceBG_Desert ( double backgroundTopMagicNumber,
float bgGlobalScaleMultiplier,
int pushBGTopHack,
int[] bgTexIndexes )
inlineprivate

Definition at line 57777 of file Main.cs.

57778 {
57779 if (bgTexIndexes[0] > 0)
57780 {
57781 bgScale = 1.25f;
57782 bgParallax = 0.37;
57783 bgTopY = (int)(backgroundTopMagicNumber * 1800.0 + 1750.0) + (int)scAdj + pushBGTopHack;
57787 float num = (float)backgroundWidth[bgTexIndexes[0]] * bgScale;
57788 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57789 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, num) - (double)(num / 2f));
57790 if (gameMenu)
57791 {
57792 bgTopY = 320 + pushBGTopHack;
57793 }
57794 bgLoops = screenWidth / (int)num + 2;
57795 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57796 {
57797 for (int i = 0; i < bgLoops; i++)
57798 {
57800 }
57801 }
57802 }
57803 if (bgTexIndexes[1] > 0)
57804 {
57805 bgScale = 1.34f;
57806 bgParallax = 0.49;
57807 bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2150.0) + (int)scAdj + pushBGTopHack;
57811 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[1]] * bgScale);
57812 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57813 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57814 if (gameMenu)
57815 {
57816 bgTopY = 480 + pushBGTopHack;
57817 bgStartX -= 120;
57818 }
57820 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57821 {
57822 for (int j = 0; j < bgLoops; j++)
57823 {
57825 }
57826 }
57827 }
57828 if (bgTexIndexes[2] <= 0)
57829 {
57830 return;
57831 }
57832 bgScale = 1.34f;
57833 bgParallax = 0.49;
57834 bgTopY = (int)(backgroundTopMagicNumber * 2100.0 + 2150.0) + (int)scAdj + pushBGTopHack;
57838 bgWidthScaled = (int)((float)backgroundWidth[bgTexIndexes[2]] * bgScale);
57839 SkyManager.Instance.DrawToDepth(spriteBatch, 1f / (float)bgParallax);
57840 bgStartX = (int)(0.0 - Math.IEEERemainder((double)screenPosition.X * bgParallax, bgWidthScaled) - (double)(bgWidthScaled / 2));
57841 if (gameMenu)
57842 {
57843 bgTopY = 480 + pushBGTopHack;
57844 bgStartX -= 120;
57845 }
57847 if ((double)screenPosition.Y < worldSurface * 16.0 + 16.0)
57848 {
57849 for (int k = 0; k < bgLoops; k++)
57850 {
57852 }
57853 }
57854 }
static double IEEERemainder(double x, double y)
Definition Math.cs:679
static Asset< Texture2D >[] Background
float scAdj
Definition Main.cs:2585
double bgParallax
Definition Main.cs:956
static int bgWidthScaled
Definition Main.cs:2575
void LoadBackground(int i)
Definition Main.cs:55998
static SpriteBatch spriteBatch
Definition Main.cs:974
static double worldSurface
Definition Main.cs:1272
int bgTopY
Definition Main.cs:966
static int[] backgroundWidth
Definition Main.cs:1665
void SetBackgroundOffsets(int backgroundID, double backgroundTopMagicNumber, int pushBGTopHack)
Definition Main.cs:57314
int bgLoops
Definition Main.cs:960
int bgStartX
Definition Main.cs:958
static Microsoft.Xna.Framework.Color ColorOfSurfaceBackgroundsModified
Definition Main.cs:2581
static int[] backgroundHeight
Definition Main.cs:1667
static float bgScale
Definition Main.cs:2573
static int screenWidth
Definition Main.cs:1719
static bool gameMenu
Definition Main.cs:1926

References Terraria.GameContent.TextureAssets.Background, Terraria.Main.backgroundHeight, Terraria.Main.backgroundWidth, Terraria.Main.bgLoops, Terraria.Main.bgParallax, Terraria.Main.bgScale, Terraria.Main.bgStartX, Terraria.Main.bgTopY, Terraria.Main.bgWidthScaled, Terraria.Main.ColorOfSurfaceBackgroundsModified, Terraria.Main.gameMenu, System.Text.RegularExpressions.i, System.Math.IEEERemainder(), Terraria.Graphics.Effects.SkyManager.Instance, Terraria.Main.LoadBackground(), Terraria.Main.scAdj, Terraria.Main.screenWidth, Terraria.Main.SetBackgroundOffsets(), Terraria.Main.spriteBatch, and Terraria.Main.worldSurface.

Referenced by Terraria.Main.DrawSurfaceBG().