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

◆ RandomizeBackgroundBasedOnPlayer()

static void Terraria.WorldGen.RandomizeBackgroundBasedOnPlayer ( UnifiedRandom random,
Player player )
inlinestatic

Definition at line 4162 of file WorldGen.cs.

4163 {
4164 if (player.ZoneGlowshroom)
4165 {
4166 int num = mushroomBG;
4167 while (num == mushroomBG)
4168 {
4169 setBG(8, random.Next(4));
4170 }
4171 }
4172 else if (player.ZoneUnderworldHeight)
4173 {
4174 int num = underworldBG;
4175 while (num == underworldBG)
4176 {
4177 setBG(9, random.Next(3));
4178 }
4179 }
4180 else if (player.ZoneDesert)
4181 {
4182 int num = desertBG;
4183 while (num == desertBG)
4184 {
4185 setBG(6, random.Next(5));
4186 }
4187 }
4188 else if (player.ZoneHallow)
4189 {
4190 int num = hallowBG;
4191 while (num == hallowBG)
4192 {
4193 setBG(4, random.Next(5));
4194 }
4195 }
4196 else if (player.ZoneCorrupt)
4197 {
4198 int num = corruptBG;
4199 while (num == corruptBG)
4200 {
4201 setBG(1, random.Next(5));
4202 }
4203 }
4204 else if (player.ZoneCrimson)
4205 {
4206 int num = crimsonBG;
4207 while (num == crimsonBG)
4208 {
4209 setBG(5, random.Next(6));
4210 }
4211 }
4212 else if (player.ZoneJungle)
4213 {
4214 int num = jungleBG;
4215 while (num == jungleBG)
4216 {
4217 setBG(2, random.Next(6));
4218 }
4219 }
4220 else if (player.ZoneSnow)
4221 {
4222 int num = snowBG;
4223 while (num == snowBG)
4224 {
4225 snowBG = random.Next(8);
4226 if (snowBG == 2 && random.Next(2) == 0)
4227 {
4228 if (random.Next(2) == 0)
4229 {
4230 snowBG = 21;
4231 }
4232 else
4233 {
4234 snowBG = 22;
4235 }
4236 }
4237 if (snowBG == 3 && random.Next(2) == 0)
4238 {
4239 if (random.Next(2) == 0)
4240 {
4241 snowBG = 31;
4242 }
4243 else
4244 {
4245 snowBG = 32;
4246 }
4247 }
4248 if (snowBG == 4 && random.Next(2) == 0)
4249 {
4250 if (random.Next(2) == 0)
4251 {
4252 snowBG = 41;
4253 }
4254 else
4255 {
4256 snowBG = 42;
4257 }
4258 }
4259 setBG(3, snowBG);
4260 }
4261 }
4262 else if (player.ZoneBeach)
4263 {
4264 int num = oceanBG;
4265 while (num == oceanBG)
4266 {
4267 setBG(7, random.Next(6));
4268 }
4269 }
4270 else
4271 {
4272 int num2 = (int)(player.Center.X / 16f);
4273 if (num2 < Main.treeX[0])
4274 {
4275 int num = treeBG1;
4277 {
4279 }
4280 setBG(0, treeBG1);
4281 }
4282 else if (num2 < Main.treeX[1])
4283 {
4284 int num = treeBG2;
4286 {
4288 }
4289 setBG(10, treeBG2);
4290 }
4291 else if (num2 < Main.treeX[2])
4292 {
4293 int num = treeBG3;
4295 {
4297 }
4298 setBG(11, treeBG3);
4299 }
4300 else
4301 {
4302 int num = treeBG4;
4304 {
4306 }
4307 setBG(12, treeBG4);
4308 }
4309 }
4310 BackgroundsCache.UpdateCache();
4311 }
static int hallowBG
Definition WorldGen.cs:914
static int mushroomBG
Definition WorldGen.cs:922
static int jungleBG
Definition WorldGen.cs:910
static int treeBG2
Definition WorldGen.cs:902
static int treeBG3
Definition WorldGen.cs:904
static int treeBG4
Definition WorldGen.cs:906
static bool IsBackgroundConsideredTheSame(int oldBG, int newBG)
Definition WorldGen.cs:4404
static void setBG(int bg, int style)
Definition WorldGen.cs:3660
static int underworldBG
Definition WorldGen.cs:924
static int corruptBG
Definition WorldGen.cs:908
static int RollRandomForestBGStyle(UnifiedRandom random)
Definition WorldGen.cs:4378
static int desertBG
Definition WorldGen.cs:918
static int crimsonBG
Definition WorldGen.cs:916
static int treeBG1
Definition WorldGen.cs:900
static int snowBG
Definition WorldGen.cs:912
static int oceanBG
Definition WorldGen.cs:920
static BackgroundChangeFlashInfo BackgroundsCache
Definition WorldGen.cs:1180

References Terraria.WorldGen.BackgroundsCache, Terraria.Entity.Center, Terraria.WorldGen.corruptBG, Terraria.WorldGen.crimsonBG, Terraria.WorldGen.desertBG, Terraria.WorldGen.hallowBG, Terraria.WorldGen.IsBackgroundConsideredTheSame(), Terraria.WorldGen.jungleBG, Terraria.WorldGen.mushroomBG, Terraria.Utilities.UnifiedRandom.Next(), Terraria.WorldGen.oceanBG, Terraria.WorldGen.RollRandomForestBGStyle(), Terraria.WorldGen.setBG(), Terraria.WorldGen.snowBG, Terraria.WorldGen.treeBG1, Terraria.WorldGen.treeBG2, Terraria.WorldGen.treeBG3, Terraria.WorldGen.treeBG4, Terraria.Main.treeX, Terraria.WorldGen.underworldBG, Microsoft.Xna.Framework.Vector2.X, Terraria.Player.ZoneBeach, Terraria.Player.ZoneCorrupt, Terraria.Player.ZoneCrimson, Terraria.Player.ZoneDesert, Terraria.Player.ZoneGlowshroom, Terraria.Player.ZoneHallow, Terraria.Player.ZoneJungle, Terraria.Player.ZoneSnow, and Terraria.Player.ZoneUnderworldHeight.

Referenced by Terraria.Projectile.Kill().