Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
TileLightScanner.cs
Go to the documentation of this file.
1using System;
6using Terraria.ID;
8
10
11public class TileLightScanner
12{
14
15 private bool _drawInvisibleWalls;
16
18 {
19 //IL_0044: Unknown result type (might be due to invalid IL or missing references)
20 //IL_004f: Expected O, but got Unknown
21 _drawInvisibleWalls = options.DrawInvisibleWalls;
22 FastParallel.For(area.Left, area.Right, (ParallelForAction)delegate(int start, int end, object context)
23 {
24 for (int i = start; i < end; i++)
25 {
26 for (int j = area.Top; j <= area.Bottom; j++)
27 {
29 {
30 outputMap.SetMaskAt(i - area.X, j - area.Y, LightMaskMode.None);
31 outputMap[i - area.X, j - area.Y] = Vector3.Zero;
32 }
33 else
34 {
35 LightMaskMode tileMask = GetTileMask(Main.tile[i, j]);
36 outputMap.SetMaskAt(i - area.X, j - area.Y, tileMask);
37 GetTileLight(i, j, out var outputColor);
38 outputMap[i - area.X, j - area.Y] = outputColor;
39 }
40 }
41 }
42 }, (object)null);
43 }
44
45 private bool IsTileNullOrTouchingNull(int x, int y)
46 {
47 if (WorldGen.InWorld(x, y, 1))
48 {
49 if (Main.tile[x, y] != null && Main.tile[x + 1, y] != null && Main.tile[x - 1, y] != null && Main.tile[x, y - 1] != null)
50 {
51 return Main.tile[x, y + 1] == null;
52 }
53 return true;
54 }
55 return true;
56 }
57
58 public void Update()
59 {
61 }
62
63 public LightMaskMode GetMaskMode(int x, int y)
64 {
65 return GetTileMask(Main.tile[x, y]);
66 }
67
69 {
70 if (LightIsBlocked(tile) && tile.type != 131 && !tile.inActive() && tile.slope() == 0)
71 {
72 return LightMaskMode.Solid;
73 }
74 if (!tile.lava() && tile.liquid > 128)
75 {
76 if (!tile.honey())
77 {
78 return LightMaskMode.Water;
79 }
80 return LightMaskMode.Honey;
81 }
82 return LightMaskMode.None;
83 }
84
85 public void GetTileLight(int x, int y, out Vector3 outputColor)
86 {
87 outputColor = Vector3.Zero;
88 Tile tile = Main.tile[x, y];
89 FastRandom localRandom = _random.WithModifier(x, y);
90 if (y <= (int)Main.worldSurface)
91 {
92 ApplySurfaceLight(tile, x, y, ref outputColor);
93 }
94 else if (y > Main.UnderworldLayer)
95 {
96 ApplyHellLight(tile, x, y, ref outputColor);
97 }
98 ApplyWallLight(tile, x, y, ref localRandom, ref outputColor);
99 if (tile.active())
100 {
101 ApplyTileLight(tile, x, y, ref localRandom, ref outputColor);
102 }
103 ApplyLiquidLight(tile, ref outputColor);
104 }
105
106 private void ApplyLiquidLight(Tile tile, ref Vector3 lightColor)
107 {
108 if (tile.liquid <= 0)
109 {
110 return;
111 }
112 if (tile.lava())
113 {
114 float num = 0.55f;
115 num += (float)(270 - Main.mouseTextColor) / 900f;
116 if (lightColor.X < num)
117 {
118 lightColor.X = num;
119 }
120 if (lightColor.Y < num)
121 {
122 lightColor.Y = num * 0.6f;
123 }
124 if (lightColor.Z < num)
125 {
126 lightColor.Z = num * 0.2f;
127 }
128 }
129 else if (tile.shimmer())
130 {
131 float num2 = 0.7f;
132 float num3 = 0.7f;
133 num2 += (float)(270 - Main.mouseTextColor) / 900f;
134 num3 += (float)(270 - Main.mouseTextColor) / 125f;
135 if (lightColor.X < num2)
136 {
137 lightColor.X = num2 * 0.6f;
138 }
139 if (lightColor.Y < num3)
140 {
141 lightColor.Y = num3 * 0.25f;
142 }
143 if (lightColor.Z < num2)
144 {
145 lightColor.Z = num2 * 0.9f;
146 }
147 }
148 }
149
150 private bool LightIsBlocked(Tile tile)
151 {
152 if (tile.active() && Main.tileBlockLight[tile.type])
153 {
154 if (tile.invisibleBlock())
155 {
156 return _drawInvisibleWalls;
157 }
158 return true;
159 }
160 return false;
161 }
162
163 private void ApplyWallLight(Tile tile, int x, int y, ref FastRandom localRandom, ref Vector3 lightColor)
164 {
165 float num = 0f;
166 float num2 = 0f;
167 float num3 = 0f;
168 switch (tile.wall)
169 {
170 case 182:
171 if (!LightIsBlocked(tile))
172 {
173 num = 0.24f;
174 num2 = 0.12f;
175 num3 = 0.089999996f;
176 }
177 break;
178 case 33:
179 if (!LightIsBlocked(tile))
180 {
181 num = 0.089999996f;
182 num2 = 0.052500002f;
183 num3 = 0.24f;
184 }
185 break;
186 case 174:
187 if (!LightIsBlocked(tile))
188 {
189 num = 0.2975f;
190 }
191 break;
192 case 175:
193 if (!LightIsBlocked(tile))
194 {
195 num = 0.075f;
196 num2 = 0.15f;
197 num3 = 0.4f;
198 }
199 break;
200 case 176:
201 if (!LightIsBlocked(tile))
202 {
203 num = 0.1f;
204 num2 = 0.1f;
205 num3 = 0.1f;
206 }
207 break;
208 case 137:
209 if (!LightIsBlocked(tile))
210 {
211 float num4 = 0.4f;
212 num4 += (float)(270 - Main.mouseTextColor) / 1500f;
213 num4 += (float)localRandom.Next(0, 50) * 0.0005f;
214 num = 1f * num4;
215 num2 = 0.5f * num4;
216 num3 = 0.1f * num4;
217 }
218 break;
219 case 44:
220 if (!LightIsBlocked(tile))
221 {
222 num = (float)Main.DiscoR / 255f * 0.15f;
223 num2 = (float)Main.DiscoG / 255f * 0.15f;
224 num3 = (float)Main.DiscoB / 255f * 0.15f;
225 }
226 break;
227 case 154:
228 num = 0.6f;
229 num3 = 0.6f;
230 break;
231 case 166:
232 num = 0.6f;
233 num2 = 0.6f;
234 break;
235 case 165:
236 num3 = 0.6f;
237 break;
238 case 156:
239 num2 = 0.6f;
240 break;
241 case 164:
242 num = 0.6f;
243 break;
244 case 155:
245 num = 0.6f;
246 num2 = 0.6f;
247 num3 = 0.6f;
248 break;
249 case 153:
250 num = 0.6f;
251 num2 = 0.3f;
252 break;
253 case 341:
254 if (!LightIsBlocked(tile))
255 {
256 num = 0.25f;
257 num2 = 0.1f;
258 num3 = 0f;
259 }
260 break;
261 case 343:
262 if (!LightIsBlocked(tile))
263 {
264 num = 0f;
265 num2 = 0.25f;
266 num3 = 0f;
267 }
268 break;
269 case 344:
270 if (!LightIsBlocked(tile))
271 {
272 num = 0f;
273 num2 = 0.16f;
274 num3 = 0.34f;
275 }
276 break;
277 case 342:
278 if (!LightIsBlocked(tile))
279 {
280 num = 0.3f;
281 num2 = 0f;
282 num3 = 0.17f;
283 }
284 break;
285 case 345:
286 if (!LightIsBlocked(tile))
287 {
288 num = 0.3f;
289 num2 = 0f;
290 num3 = 0.35f;
291 }
292 break;
293 case 346:
294 if (!LightIsBlocked(tile))
295 {
296 num = (float)Main.DiscoR / 255f * 0.25f;
297 num2 = (float)Main.DiscoG / 255f * 0.25f;
298 num3 = (float)Main.DiscoB / 255f * 0.25f;
299 }
300 break;
301 }
302 if (lightColor.X < num)
303 {
304 lightColor.X = num;
305 }
306 if (lightColor.Y < num2)
307 {
308 lightColor.Y = num2;
309 }
310 if (lightColor.Z < num3)
311 {
312 lightColor.Z = num3;
313 }
314 }
315
316 private void ApplyTileLight(Tile tile, int x, int y, ref FastRandom localRandom, ref Vector3 lightColor)
317 {
318 float R = 0f;
319 float G = 0f;
320 float B = 0f;
321 if (Main.tileLighted[tile.type])
322 {
323 switch (tile.type)
324 {
325 case 658:
326 if (!tile.invisibleBlock())
327 {
328 TorchID.TorchColor(23, out R, out G, out B);
329 switch (tile.frameY / 54)
330 {
331 default:
332 R *= 0.2f;
333 G *= 0.2f;
334 B *= 0.2f;
335 break;
336 case 1:
337 R *= 0.3f;
338 G *= 0.3f;
339 B *= 0.3f;
340 break;
341 case 2:
342 R *= 0.1f;
343 G *= 0.1f;
344 B *= 0.1f;
345 break;
346 }
347 }
348 break;
349 case 356:
350 if (Main.sundialCooldown == 0)
351 {
352 R = 0.45f;
353 G = 0.25f;
354 B = 0f;
355 }
356 break;
357 case 663:
358 if (Main.moondialCooldown == 0)
359 {
360 R = 0f;
361 G = 0.25f;
362 B = 0.45f;
363 }
364 break;
365 case 656:
366 R = 0.2f;
367 G = 0.55f;
368 B = 0.5f;
369 break;
370 case 20:
371 {
372 int num22 = tile.frameX / 18;
373 if (num22 >= 30 && num22 <= 32)
374 {
375 R = 0.325f;
376 G = 0.15f;
377 B = 0.05f;
378 }
379 break;
380 }
381 case 634:
382 R = 0.65f;
383 G = 0.3f;
384 B = 0.1f;
385 break;
386 case 633:
387 case 637:
388 case 638:
389 R = 0.325f;
390 G = 0.15f;
391 B = 0.05f;
392 break;
393 case 463:
394 R = 0.2f;
395 G = 0.4f;
396 B = 0.8f;
397 break;
398 case 491:
399 R = 0.5f;
400 G = 0.4f;
401 B = 0.7f;
402 break;
403 case 209:
404 if (tile.frameX == 234 || tile.frameX == 252)
405 {
406 Vector3 vector6 = PortalHelper.GetPortalColor(Main.myPlayer, 0).ToVector3() * 0.65f;
407 R = vector6.X;
408 G = vector6.Y;
409 B = vector6.Z;
410 }
411 else if (tile.frameX == 306 || tile.frameX == 324)
412 {
413 Vector3 vector7 = PortalHelper.GetPortalColor(Main.myPlayer, 1).ToVector3() * 0.65f;
414 R = vector7.X;
415 G = vector7.Y;
416 B = vector7.Z;
417 }
418 break;
419 case 415:
420 R = 0.7f;
421 G = 0.5f;
422 B = 0.1f;
423 break;
424 case 500:
425 R = 0.525f;
426 G = 0.375f;
427 B = 0.075f;
428 break;
429 case 416:
430 R = 0f;
431 G = 0.6f;
432 B = 0.7f;
433 break;
434 case 501:
435 R = 0f;
436 G = 0.45f;
437 B = 0.525f;
438 break;
439 case 417:
440 R = 0.6f;
441 G = 0.2f;
442 B = 0.6f;
443 break;
444 case 502:
445 R = 0.45f;
446 G = 0.15f;
447 B = 0.45f;
448 break;
449 case 418:
450 R = 0.6f;
451 G = 0.6f;
452 B = 0.9f;
453 break;
454 case 503:
455 R = 0.45f;
456 G = 0.45f;
457 B = 0.675f;
458 break;
459 case 390:
460 R = 0.4f;
461 G = 0.2f;
462 B = 0.1f;
463 break;
464 case 597:
465 switch (tile.frameX / 54)
466 {
467 case 0:
468 R = 0.05f;
469 G = 0.8f;
470 B = 0.3f;
471 break;
472 case 1:
473 R = 0.7f;
474 G = 0.8f;
475 B = 0.05f;
476 break;
477 case 2:
478 R = 0.7f;
479 G = 0.5f;
480 B = 0.9f;
481 break;
482 case 3:
483 R = 0.6f;
484 G = 0.6f;
485 B = 0.8f;
486 break;
487 case 4:
488 R = 0.4f;
489 G = 0.4f;
490 B = 1.15f;
491 break;
492 case 5:
493 R = 0.85f;
494 G = 0.45f;
495 B = 0.1f;
496 break;
497 case 6:
498 R = 0.8f;
499 G = 0.8f;
500 B = 1f;
501 break;
502 case 7:
503 R = 0.5f;
504 G = 0.8f;
505 B = 1.2f;
506 break;
507 }
508 R *= 0.75f;
509 G *= 0.75f;
510 B *= 0.75f;
511 break;
512 case 564:
513 if (tile.frameX < 36)
514 {
515 R = 0.05f;
516 G = 0.3f;
517 B = 0.55f;
518 }
519 break;
520 case 568:
521 R = 1f;
522 G = 0.61f;
523 B = 0.65f;
524 break;
525 case 569:
526 R = 0.12f;
527 G = 1f;
528 B = 0.66f;
529 break;
530 case 570:
531 R = 0.57f;
532 G = 0.57f;
533 B = 1f;
534 break;
535 case 580:
536 R = 0.7f;
537 G = 0.3f;
538 B = 0.2f;
539 break;
540 case 391:
541 R = 0.3f;
542 G = 0.1f;
543 B = 0.25f;
544 break;
545 case 381:
546 case 517:
547 case 687:
548 R = 0.25f;
549 G = 0.1f;
550 B = 0f;
551 break;
552 case 534:
553 case 535:
554 case 689:
555 R = 0f;
556 G = 0.25f;
557 B = 0f;
558 break;
559 case 536:
560 case 537:
561 case 690:
562 R = 0f;
563 G = 0.16f;
564 B = 0.34f;
565 break;
566 case 539:
567 case 540:
568 case 688:
569 R = 0.3f;
570 G = 0f;
571 B = 0.17f;
572 break;
573 case 625:
574 case 626:
575 case 691:
576 R = 0.3f;
577 G = 0f;
578 B = 0.35f;
579 break;
580 case 627:
581 case 628:
582 case 692:
583 R = (float)Main.DiscoR / 255f * 0.25f;
584 G = (float)Main.DiscoG / 255f * 0.25f;
585 B = (float)Main.DiscoB / 255f * 0.25f;
586 break;
587 case 184:
588 if (tile.frameX == 110)
589 {
590 R = 0.25f;
591 G = 0.1f;
592 B = 0f;
593 }
594 if (tile.frameX == 132)
595 {
596 R = 0f;
597 G = 0.25f;
598 B = 0f;
599 }
600 if (tile.frameX == 154)
601 {
602 R = 0f;
603 G = 0.16f;
604 B = 0.34f;
605 }
606 if (tile.frameX == 176)
607 {
608 R = 0.3f;
609 G = 0f;
610 B = 0.17f;
611 }
612 if (tile.frameX == 198)
613 {
614 R = 0.3f;
615 G = 0f;
616 B = 0.35f;
617 }
618 if (tile.frameX == 220)
619 {
620 R = (float)Main.DiscoR / 255f * 0.25f;
621 G = (float)Main.DiscoG / 255f * 0.25f;
622 B = (float)Main.DiscoB / 255f * 0.25f;
623 }
624 break;
625 case 370:
626 R = 0.32f;
627 G = 0.16f;
628 B = 0.12f;
629 break;
630 case 659:
631 case 667:
632 {
633 Vector4 shimmerBaseColor = LiquidRenderer.GetShimmerBaseColor(x, y);
634 R = shimmerBaseColor.X;
635 G = shimmerBaseColor.Y;
636 B = shimmerBaseColor.Z;
637 break;
638 }
639 case 27:
640 if (tile.frameY < 36)
641 {
642 R = 0.3f;
643 G = 0.27f;
644 }
645 break;
646 case 336:
647 R = 0.85f;
648 G = 0.5f;
649 B = 0.3f;
650 break;
651 case 340:
652 R = 0.45f;
653 G = 1f;
654 B = 0.45f;
655 break;
656 case 341:
657 R = 0.4f * Main.demonTorch + 0.6f * (1f - Main.demonTorch);
658 G = 0.35f;
659 B = 1f * Main.demonTorch + 0.6f * (1f - Main.demonTorch);
660 break;
661 case 342:
662 R = 0.5f;
663 G = 0.5f;
664 B = 1.1f;
665 break;
666 case 343:
667 R = 0.85f;
668 G = 0.85f;
669 B = 0.3f;
670 break;
671 case 344:
672 R = 0.6f;
673 G = 1.026f;
674 B = 0.96000004f;
675 break;
676 case 327:
677 {
678 float num18 = 0.5f;
679 num18 += (float)(270 - Main.mouseTextColor) / 1500f;
680 num18 += (float)localRandom.Next(0, 50) * 0.0005f;
681 R = 1f * num18;
682 G = 0.5f * num18;
683 B = 0.1f * num18;
684 break;
685 }
686 case 316:
687 case 317:
688 case 318:
689 {
690 int num12 = x - tile.frameX / 18;
691 int num13 = y - tile.frameY / 18;
692 int num14 = num12 / 2 * (num13 / 3);
693 num14 %= Main.cageFrames;
694 bool flag4 = Main.jellyfishCageMode[tile.type - 316, num14] == 2;
695 if (tile.type == 316)
696 {
697 if (flag4)
698 {
699 R = 0.2f;
700 G = 0.3f;
701 B = 0.8f;
702 }
703 else
704 {
705 R = 0.1f;
706 G = 0.2f;
707 B = 0.5f;
708 }
709 }
710 if (tile.type == 317)
711 {
712 if (flag4)
713 {
714 R = 0.2f;
715 G = 0.7f;
716 B = 0.3f;
717 }
718 else
719 {
720 R = 0.05f;
721 G = 0.45f;
722 B = 0.1f;
723 }
724 }
725 if (tile.type == 318)
726 {
727 if (flag4)
728 {
729 R = 0.7f;
730 G = 0.2f;
731 B = 0.5f;
732 }
733 else
734 {
735 R = 0.4f;
736 G = 0.1f;
737 B = 0.25f;
738 }
739 }
740 break;
741 }
742 case 429:
743 {
744 int num6 = tile.frameX / 18;
745 bool flag = num6 % 2 >= 1;
746 bool flag2 = num6 % 4 >= 2;
747 bool flag3 = num6 % 8 >= 4;
748 bool num7 = num6 % 16 >= 8;
749 if (flag)
750 {
751 R += 0.5f;
752 }
753 if (flag2)
754 {
755 G += 0.5f;
756 }
757 if (flag3)
758 {
759 B += 0.5f;
760 }
761 if (num7)
762 {
763 R += 0.2f;
764 G += 0.2f;
765 }
766 break;
767 }
768 case 286:
769 case 619:
770 R = 0.1f;
771 G = 0.2f;
772 B = 0.7f;
773 break;
774 case 620:
775 {
776 Color color = new Color(230, 230, 230, 0).MultiplyRGBA(Main.hslToRgb(Main.GlobalTimeWrappedHourly * 0.5f % 1f, 1f, 0.5f));
777 color *= 0.4f;
778 R = (float)(int)color.R / 255f;
779 G = (float)(int)color.G / 255f;
780 B = (float)(int)color.B / 255f;
781 break;
782 }
783 case 582:
784 case 598:
785 R = 0.7f;
786 G = 0.2f;
787 B = 0.1f;
788 break;
789 case 270:
790 R = 0.73f;
791 G = 1f;
792 B = 0.41f;
793 break;
794 case 271:
795 R = 0.45f;
796 G = 0.95f;
797 B = 1f;
798 break;
799 case 581:
800 R = 1f;
801 G = 0.75f;
802 B = 0.5f;
803 break;
804 case 660:
805 TorchID.TorchColor(23, out R, out G, out B);
806 break;
807 case 572:
808 switch (tile.frameY / 36)
809 {
810 case 0:
811 R = 0.9f;
812 G = 0.5f;
813 B = 0.7f;
814 break;
815 case 1:
816 R = 0.7f;
817 G = 0.55f;
818 B = 0.96f;
819 break;
820 case 2:
821 R = 0.45f;
822 G = 0.96f;
823 B = 0.95f;
824 break;
825 case 3:
826 R = 0.5f;
827 G = 0.96f;
828 B = 0.62f;
829 break;
830 case 4:
831 R = 0.47f;
832 G = 0.69f;
833 B = 0.95f;
834 break;
835 case 5:
836 R = 0.92f;
837 G = 0.57f;
838 B = 0.51f;
839 break;
840 }
841 break;
842 case 262:
843 R = 0.75f;
844 B = 0.75f;
845 break;
846 case 263:
847 R = 0.75f;
848 G = 0.75f;
849 break;
850 case 264:
851 B = 0.75f;
852 break;
853 case 265:
854 G = 0.75f;
855 break;
856 case 266:
857 R = 0.75f;
858 break;
859 case 267:
860 R = 0.75f;
861 G = 0.75f;
862 B = 0.75f;
863 break;
864 case 268:
865 R = 0.75f;
866 G = 0.375f;
867 break;
868 case 237:
869 R = 0.1f;
870 G = 0.1f;
871 break;
872 case 238:
873 if ((double)lightColor.X < 0.5)
874 {
875 lightColor.X = 0.5f;
876 }
877 if ((double)lightColor.Z < 0.5)
878 {
879 lightColor.Z = 0.5f;
880 }
881 break;
882 case 235:
883 if ((double)lightColor.X < 0.6)
884 {
885 lightColor.X = 0.6f;
886 }
887 if ((double)lightColor.Y < 0.6)
888 {
889 lightColor.Y = 0.6f;
890 }
891 break;
892 case 405:
893 if (tile.frameX < 54)
894 {
895 float num21 = (float)localRandom.Next(28, 42) * 0.005f;
896 num21 += (float)(270 - Main.mouseTextColor) / 700f;
897 switch (tile.frameX / 54)
898 {
899 case 1:
900 R = 0.7f;
901 G = 1f;
902 B = 0.5f;
903 break;
904 case 2:
905 R = 0.5f * Main.demonTorch + 1f * (1f - Main.demonTorch);
906 G = 0.3f;
907 B = 1f * Main.demonTorch + 0.5f * (1f - Main.demonTorch);
908 break;
909 case 3:
910 R = 0.45f;
911 G = 0.75f;
912 B = 1f;
913 break;
914 case 4:
915 R = 1.15f;
916 G = 1.15f;
917 B = 0.5f;
918 break;
919 case 5:
920 R = (float)Main.DiscoR / 255f;
921 G = (float)Main.DiscoG / 255f;
922 B = (float)Main.DiscoB / 255f;
923 break;
924 default:
925 R = 0.9f;
926 G = 0.3f;
927 B = 0.1f;
928 break;
929 }
930 R += num21;
931 G += num21;
932 B += num21;
933 }
934 break;
935 case 215:
936 if (tile.frameY < 36)
937 {
938 float num20 = (float)localRandom.Next(28, 42) * 0.005f;
939 num20 += (float)(270 - Main.mouseTextColor) / 700f;
940 switch (tile.frameX / 54)
941 {
942 case 1:
943 R = 0.7f;
944 G = 1f;
945 B = 0.5f;
946 break;
947 case 2:
948 R = 0.5f * Main.demonTorch + 1f * (1f - Main.demonTorch);
949 G = 0.3f;
950 B = 1f * Main.demonTorch + 0.5f * (1f - Main.demonTorch);
951 break;
952 case 3:
953 R = 0.45f;
954 G = 0.75f;
955 B = 1f;
956 break;
957 case 4:
958 R = 1.15f;
959 G = 1.15f;
960 B = 0.5f;
961 break;
962 case 5:
963 R = (float)Main.DiscoR / 255f;
964 G = (float)Main.DiscoG / 255f;
965 B = (float)Main.DiscoB / 255f;
966 break;
967 case 6:
968 R = 0.75f;
969 G = 1.2824999f;
970 B = 1.2f;
971 break;
972 case 7:
973 R = 0.95f;
974 G = 0.65f;
975 B = 1.3f;
976 break;
977 case 8:
978 R = 1.4f;
979 G = 0.85f;
980 B = 0.55f;
981 break;
982 case 9:
983 R = 0.25f;
984 G = 1.3f;
985 B = 0.8f;
986 break;
987 case 10:
988 R = 0.95f;
989 G = 0.4f;
990 B = 1.4f;
991 break;
992 case 11:
993 R = 1.4f;
994 G = 0.7f;
995 B = 0.5f;
996 break;
997 case 12:
998 R = 1.25f;
999 G = 0.6f;
1000 B = 1.2f;
1001 break;
1002 case 13:
1003 R = 0.75f;
1004 G = 1.45f;
1005 B = 0.9f;
1006 break;
1007 case 14:
1008 R = 0.25f;
1009 G = 0.65f;
1010 B = 1f;
1011 break;
1012 case 15:
1013 TorchID.TorchColor(23, out R, out G, out B);
1014 break;
1015 default:
1016 R = 0.9f;
1017 G = 0.3f;
1018 B = 0.1f;
1019 break;
1020 }
1021 R += num20;
1022 G += num20;
1023 B += num20;
1024 }
1025 break;
1026 case 92:
1027 if (tile.frameY <= 18 && tile.frameX == 0)
1028 {
1029 R = 1f;
1030 G = 1f;
1031 B = 1f;
1032 }
1033 break;
1034 case 592:
1035 if (tile.frameY > 0)
1036 {
1037 float num19 = (float)localRandom.Next(28, 42) * 0.005f;
1038 num19 += (float)(270 - Main.mouseTextColor) / 700f;
1039 R = 1.35f;
1040 G = 0.45f;
1041 B = 0.15f;
1042 R += num19;
1043 G += num19;
1044 B += num19;
1045 }
1046 break;
1047 case 593:
1048 if (tile.frameX < 18)
1049 {
1050 R = 0.8f;
1051 G = 0.3f;
1052 B = 0.1f;
1053 }
1054 break;
1055 case 594:
1056 if (tile.frameX < 36)
1057 {
1058 R = 0.8f;
1059 G = 0.3f;
1060 B = 0.1f;
1061 }
1062 break;
1063 case 548:
1064 if (tile.frameX / 54 >= 7)
1065 {
1066 R = 0.7f;
1067 G = 0.3f;
1068 B = 0.2f;
1069 }
1070 break;
1071 case 613:
1072 case 614:
1073 R = 0.7f;
1074 G = 0.3f;
1075 B = 0.2f;
1076 break;
1077 case 93:
1078 if (tile.frameX == 0)
1079 {
1080 switch (tile.frameY / 54)
1081 {
1082 case 1:
1083 R = 0.95f;
1084 G = 0.95f;
1085 B = 0.5f;
1086 break;
1087 case 2:
1088 R = 0.85f;
1089 G = 0.6f;
1090 B = 1f;
1091 break;
1092 case 3:
1093 R = 0.75f;
1094 G = 1f;
1095 B = 0.6f;
1096 break;
1097 case 4:
1098 case 5:
1099 R = 0.75f;
1100 G = 0.85f;
1101 B = 1f;
1102 break;
1103 case 6:
1104 R = 1f;
1105 G = 0.95f;
1106 B = 0.65f;
1107 break;
1108 case 7:
1109 R = 1f;
1110 G = 0.97f;
1111 B = 0.85f;
1112 break;
1113 case 9:
1114 R = 1f;
1115 G = 1f;
1116 B = 0.7f;
1117 break;
1118 case 10:
1119 R = 1f;
1120 G = 0.95f;
1121 B = 0.65f;
1122 break;
1123 case 12:
1124 R = 1f;
1125 G = 0.95f;
1126 B = 0.65f;
1127 break;
1128 case 13:
1129 R = 1f;
1130 G = 1f;
1131 B = 0.6f;
1132 break;
1133 case 14:
1134 R = 1f;
1135 G = 0.95f;
1136 B = 0.65f;
1137 break;
1138 case 18:
1139 R = 1f;
1140 G = 0.95f;
1141 B = 0.65f;
1142 break;
1143 case 19:
1144 R = 0.37f;
1145 G = 0.8f;
1146 B = 1f;
1147 break;
1148 case 20:
1149 R = 0f;
1150 G = 0.9f;
1151 B = 1f;
1152 break;
1153 case 21:
1154 R = 0.25f;
1155 G = 0.7f;
1156 B = 1f;
1157 break;
1158 case 23:
1159 R = 0.5f * Main.demonTorch + 1f * (1f - Main.demonTorch);
1160 G = 0.3f;
1161 B = 1f * Main.demonTorch + 0.5f * (1f - Main.demonTorch);
1162 break;
1163 case 24:
1164 R = 0.35f;
1165 G = 0.5f;
1166 B = 0.3f;
1167 break;
1168 case 25:
1169 R = 0.34f;
1170 G = 0.4f;
1171 B = 0.31f;
1172 break;
1173 case 26:
1174 R = 0.25f;
1175 G = 0.32f;
1176 B = 0.5f;
1177 break;
1178 case 29:
1179 R = 0.9f;
1180 G = 0.75f;
1181 B = 1f;
1182 break;
1183 case 30:
1184 R = 1f;
1185 G = 0.95f;
1186 B = 0.65f;
1187 break;
1188 case 31:
1189 {
1190 Vector3 vector5 = Main.hslToRgb(Main.demonTorch * 0.12f + 0.69f, 1f, 0.75f).ToVector3() * 1.2f;
1191 R = vector5.X;
1192 G = vector5.Y;
1193 B = vector5.Z;
1194 break;
1195 }
1196 case 32:
1197 R = 1f;
1198 G = 0.97f;
1199 B = 0.85f;
1200 break;
1201 case 33:
1202 R = 0.55f;
1203 G = 0.45f;
1204 B = 0.95f;
1205 break;
1206 case 34:
1207 R = 1f;
1208 G = 0.6f;
1209 B = 0.1f;
1210 break;
1211 case 35:
1212 R = 0.3f;
1213 G = 0.75f;
1214 B = 0.55f;
1215 break;
1216 case 36:
1217 R = 0.9f;
1218 G = 0.55f;
1219 B = 0.7f;
1220 break;
1221 case 37:
1222 R = 0.55f;
1223 G = 0.85f;
1224 B = 1f;
1225 break;
1226 case 38:
1227 R = 1f;
1228 G = 0.95f;
1229 B = 0.65f;
1230 break;
1231 case 39:
1232 R = 1f;
1233 G = 0.95f;
1234 B = 0.65f;
1235 break;
1236 case 40:
1237 R = 0.4f;
1238 G = 0.8f;
1239 B = 0.9f;
1240 break;
1241 case 41:
1242 R = 1f;
1243 G = 1f;
1244 B = 1f;
1245 break;
1246 case 42:
1247 R = 0.95f;
1248 G = 0.5f;
1249 B = 0.4f;
1250 break;
1251 default:
1252 R = 1f;
1253 G = 0.97f;
1254 B = 0.85f;
1255 break;
1256 }
1257 }
1258 break;
1259 case 96:
1260 if (tile.frameX >= 36)
1261 {
1262 R = 0.5f;
1263 G = 0.35f;
1264 B = 0.1f;
1265 }
1266 break;
1267 case 98:
1268 if (tile.frameY == 0)
1269 {
1270 R = 1f;
1271 G = 0.97f;
1272 B = 0.85f;
1273 }
1274 break;
1275 case 4:
1276 if (tile.frameX < 66)
1277 {
1278 TorchID.TorchColor(tile.frameY / 22, out R, out G, out B);
1279 }
1280 break;
1281 case 372:
1282 if (tile.frameX == 0)
1283 {
1284 R = 0.9f;
1285 G = 0.1f;
1286 B = 0.75f;
1287 }
1288 break;
1289 case 646:
1290 if (tile.frameX == 0)
1291 {
1292 R = 0.2f;
1293 G = 0.3f;
1294 B = 0.32f;
1295 }
1296 break;
1297 case 33:
1298 if (tile.frameX == 0)
1299 {
1300 switch (tile.frameY / 22)
1301 {
1302 case 0:
1303 R = 1f;
1304 G = 0.95f;
1305 B = 0.65f;
1306 break;
1307 case 1:
1308 R = 0.55f;
1309 G = 0.85f;
1310 B = 0.35f;
1311 break;
1312 case 2:
1313 R = 0.65f;
1314 G = 0.95f;
1315 B = 0.5f;
1316 break;
1317 case 3:
1318 R = 0.2f;
1319 G = 0.75f;
1320 B = 1f;
1321 break;
1322 case 5:
1323 R = 0.85f;
1324 G = 0.6f;
1325 B = 1f;
1326 break;
1327 case 7:
1328 case 8:
1329 R = 0.75f;
1330 G = 0.85f;
1331 B = 1f;
1332 break;
1333 case 9:
1334 R = 1f;
1335 G = 0.95f;
1336 B = 0.65f;
1337 break;
1338 case 10:
1339 R = 1f;
1340 G = 0.97f;
1341 B = 0.85f;
1342 break;
1343 case 14:
1344 R = 1f;
1345 G = 1f;
1346 B = 0.6f;
1347 break;
1348 case 15:
1349 R = 1f;
1350 G = 0.95f;
1351 B = 0.65f;
1352 break;
1353 case 18:
1354 R = 1f;
1355 G = 0.95f;
1356 B = 0.65f;
1357 break;
1358 case 19:
1359 R = 0.37f;
1360 G = 0.8f;
1361 B = 1f;
1362 break;
1363 case 20:
1364 R = 0f;
1365 G = 0.9f;
1366 B = 1f;
1367 break;
1368 case 21:
1369 R = 0.25f;
1370 G = 0.7f;
1371 B = 1f;
1372 break;
1373 case 23:
1374 R = 1f;
1375 G = 0.95f;
1376 B = 0.65f;
1377 break;
1378 case 24:
1379 R = 1f;
1380 G = 0.95f;
1381 B = 0.65f;
1382 break;
1383 case 25:
1384 R = 0.5f * Main.demonTorch + 1f * (1f - Main.demonTorch);
1385 G = 0.3f;
1386 B = 1f * Main.demonTorch + 0.5f * (1f - Main.demonTorch);
1387 break;
1388 case 28:
1389 R = 0.9f;
1390 G = 0.75f;
1391 B = 1f;
1392 break;
1393 case 29:
1394 R = 1f;
1395 G = 0.95f;
1396 B = 0.65f;
1397 break;
1398 case 30:
1399 {
1400 Vector3 vector4 = Main.hslToRgb(Main.demonTorch * 0.12f + 0.69f, 1f, 0.75f).ToVector3() * 1.2f;
1401 R = vector4.X;
1402 G = vector4.Y;
1403 B = vector4.Z;
1404 break;
1405 }
1406 case 31:
1407 R = 1f;
1408 G = 0.97f;
1409 B = 0.85f;
1410 break;
1411 case 32:
1412 R = 0.55f;
1413 G = 0.45f;
1414 B = 0.95f;
1415 break;
1416 case 33:
1417 R = 1f;
1418 G = 0.6f;
1419 B = 0.1f;
1420 break;
1421 case 34:
1422 R = 0.3f;
1423 G = 0.75f;
1424 B = 0.55f;
1425 break;
1426 case 35:
1427 R = 0.9f;
1428 G = 0.55f;
1429 B = 0.7f;
1430 break;
1431 case 36:
1432 R = 0.55f;
1433 G = 0.85f;
1434 B = 1f;
1435 break;
1436 case 37:
1437 R = 1f;
1438 G = 0.95f;
1439 B = 0.65f;
1440 break;
1441 case 38:
1442 R = 1f;
1443 G = 0.95f;
1444 B = 0.65f;
1445 break;
1446 case 39:
1447 R = 0.4f;
1448 G = 0.8f;
1449 B = 0.9f;
1450 break;
1451 case 40:
1452 R = 1f;
1453 G = 1f;
1454 B = 1f;
1455 break;
1456 case 41:
1457 R = 0.95f;
1458 G = 0.5f;
1459 B = 0.4f;
1460 break;
1461 default:
1462 R = 1f;
1463 G = 0.95f;
1464 B = 0.65f;
1465 break;
1466 }
1467 }
1468 break;
1469 case 174:
1470 if (tile.frameX == 0)
1471 {
1472 R = 1f;
1473 G = 0.95f;
1474 B = 0.65f;
1475 }
1476 break;
1477 case 100:
1478 case 173:
1479 if (tile.frameX < 36)
1480 {
1481 switch (tile.frameY / 36)
1482 {
1483 case 1:
1484 R = 0.95f;
1485 G = 0.95f;
1486 B = 0.5f;
1487 break;
1488 case 2:
1489 R = 0.85f;
1490 G = 0.6f;
1491 B = 1f;
1492 break;
1493 case 3:
1494 R = 1f;
1495 G = 0.6f;
1496 B = 0.6f;
1497 break;
1498 case 5:
1499 R = 1f;
1500 G = 0.95f;
1501 B = 0.65f;
1502 break;
1503 case 6:
1504 case 7:
1505 R = 1f;
1506 G = 0.95f;
1507 B = 0.65f;
1508 break;
1509 case 8:
1510 R = 1f;
1511 G = 0.97f;
1512 B = 0.85f;
1513 break;
1514 case 9:
1515 R = 0.75f;
1516 G = 0.85f;
1517 B = 1f;
1518 break;
1519 case 11:
1520 R = 1f;
1521 G = 1f;
1522 B = 0.7f;
1523 break;
1524 case 12:
1525 R = 1f;
1526 G = 0.95f;
1527 B = 0.65f;
1528 break;
1529 case 13:
1530 R = 1f;
1531 G = 1f;
1532 B = 0.6f;
1533 break;
1534 case 14:
1535 R = 1f;
1536 G = 0.95f;
1537 B = 0.65f;
1538 break;
1539 case 18:
1540 R = 1f;
1541 G = 0.95f;
1542 B = 0.65f;
1543 break;
1544 case 19:
1545 R = 0.37f;
1546 G = 0.8f;
1547 B = 1f;
1548 break;
1549 case 20:
1550 R = 0f;
1551 G = 0.9f;
1552 B = 1f;
1553 break;
1554 case 21:
1555 R = 0.25f;
1556 G = 0.7f;
1557 B = 1f;
1558 break;
1559 case 25:
1560 R = 0.5f * Main.demonTorch + 1f * (1f - Main.demonTorch);
1561 G = 0.3f;
1562 B = 1f * Main.demonTorch + 0.5f * (1f - Main.demonTorch);
1563 break;
1564 case 22:
1565 R = 0.35f;
1566 G = 0.5f;
1567 B = 0.3f;
1568 break;
1569 case 23:
1570 R = 0.34f;
1571 G = 0.4f;
1572 B = 0.31f;
1573 break;
1574 case 24:
1575 R = 0.25f;
1576 G = 0.32f;
1577 B = 0.5f;
1578 break;
1579 case 29:
1580 R = 0.9f;
1581 G = 0.75f;
1582 B = 1f;
1583 break;
1584 case 30:
1585 R = 1f;
1586 G = 0.95f;
1587 B = 0.65f;
1588 break;
1589 case 31:
1590 {
1591 Vector3 vector3 = Main.hslToRgb(Main.demonTorch * 0.12f + 0.69f, 1f, 0.75f).ToVector3() * 1.2f;
1592 R = vector3.X;
1593 G = vector3.Y;
1594 B = vector3.Z;
1595 break;
1596 }
1597 case 32:
1598 R = 1f;
1599 G = 0.97f;
1600 B = 0.85f;
1601 break;
1602 case 33:
1603 R = 0.55f;
1604 G = 0.45f;
1605 B = 0.95f;
1606 break;
1607 case 34:
1608 R = 1f;
1609 G = 0.6f;
1610 B = 0.1f;
1611 break;
1612 case 35:
1613 R = 0.3f;
1614 G = 0.75f;
1615 B = 0.55f;
1616 break;
1617 case 36:
1618 R = 0.9f;
1619 G = 0.55f;
1620 B = 0.7f;
1621 break;
1622 case 37:
1623 R = 0.55f;
1624 G = 0.85f;
1625 B = 1f;
1626 break;
1627 case 38:
1628 R = 1f;
1629 G = 0.95f;
1630 B = 0.65f;
1631 break;
1632 case 39:
1633 R = 1f;
1634 G = 0.95f;
1635 B = 0.65f;
1636 break;
1637 case 40:
1638 R = 0.4f;
1639 G = 0.8f;
1640 B = 0.9f;
1641 break;
1642 case 41:
1643 R = 1f;
1644 G = 1f;
1645 B = 1f;
1646 break;
1647 case 42:
1648 R = 0.95f;
1649 G = 0.5f;
1650 B = 0.4f;
1651 break;
1652 default:
1653 R = 1f;
1654 G = 0.95f;
1655 B = 0.65f;
1656 break;
1657 }
1658 }
1659 break;
1660 case 34:
1661 if (tile.frameX % 108 < 54)
1662 {
1663 int num17 = tile.frameY / 54;
1664 switch (num17 + 37 * (tile.frameX / 108))
1665 {
1666 case 7:
1667 R = 0.95f;
1668 G = 0.95f;
1669 B = 0.5f;
1670 break;
1671 case 8:
1672 R = 0.85f;
1673 G = 0.6f;
1674 B = 1f;
1675 break;
1676 case 9:
1677 R = 1f;
1678 G = 0.6f;
1679 B = 0.6f;
1680 break;
1681 case 12:
1682 R = 1f;
1683 G = 0.95f;
1684 B = 0.65f;
1685 break;
1686 case 13:
1687 R = 1f;
1688 G = 0.97f;
1689 B = 0.85f;
1690 break;
1691 case 11:
1692 case 17:
1693 R = 0.75f;
1694 G = 0.85f;
1695 B = 1f;
1696 break;
1697 case 15:
1698 R = 1f;
1699 G = 1f;
1700 B = 0.7f;
1701 break;
1702 case 16:
1703 R = 1f;
1704 G = 0.95f;
1705 B = 0.65f;
1706 break;
1707 case 18:
1708 R = 1f;
1709 G = 1f;
1710 B = 0.6f;
1711 break;
1712 case 19:
1713 R = 1f;
1714 G = 0.95f;
1715 B = 0.65f;
1716 break;
1717 case 23:
1718 R = 1f;
1719 G = 0.95f;
1720 B = 0.65f;
1721 break;
1722 case 24:
1723 R = 0.37f;
1724 G = 0.8f;
1725 B = 1f;
1726 break;
1727 case 25:
1728 R = 0f;
1729 G = 0.9f;
1730 B = 1f;
1731 break;
1732 case 26:
1733 R = 0.25f;
1734 G = 0.7f;
1735 B = 1f;
1736 break;
1737 case 27:
1738 R = 0.55f;
1739 G = 0.85f;
1740 B = 0.35f;
1741 break;
1742 case 28:
1743 R = 0.65f;
1744 G = 0.95f;
1745 B = 0.5f;
1746 break;
1747 case 29:
1748 R = 0.2f;
1749 G = 0.75f;
1750 B = 1f;
1751 break;
1752 case 30:
1753 R = 1f;
1754 G = 0.95f;
1755 B = 0.65f;
1756 break;
1757 case 32:
1758 R = 0.5f * Main.demonTorch + 1f * (1f - Main.demonTorch);
1759 G = 0.3f;
1760 B = 1f * Main.demonTorch + 0.5f * (1f - Main.demonTorch);
1761 break;
1762 case 35:
1763 R = 0.9f;
1764 G = 0.75f;
1765 B = 1f;
1766 break;
1767 case 36:
1768 R = 1f;
1769 G = 0.95f;
1770 B = 0.65f;
1771 break;
1772 case 37:
1773 {
1774 Vector3 vector2 = Main.hslToRgb(Main.demonTorch * 0.12f + 0.69f, 1f, 0.75f).ToVector3() * 1.2f;
1775 R = vector2.X;
1776 G = vector2.Y;
1777 B = vector2.Z;
1778 break;
1779 }
1780 case 38:
1781 R = 1f;
1782 G = 0.97f;
1783 B = 0.85f;
1784 break;
1785 case 39:
1786 R = 0.55f;
1787 G = 0.45f;
1788 B = 0.95f;
1789 break;
1790 case 40:
1791 R = 1f;
1792 G = 0.6f;
1793 B = 0.1f;
1794 break;
1795 case 41:
1796 R = 0.3f;
1797 G = 0.75f;
1798 B = 0.55f;
1799 break;
1800 case 42:
1801 R = 0.9f;
1802 G = 0.55f;
1803 B = 0.7f;
1804 break;
1805 case 43:
1806 R = 0.55f;
1807 G = 0.85f;
1808 B = 1f;
1809 break;
1810 case 44:
1811 R = 1f;
1812 G = 0.95f;
1813 B = 0.65f;
1814 break;
1815 case 45:
1816 R = 1f;
1817 G = 0.95f;
1818 B = 0.65f;
1819 break;
1820 case 46:
1821 R = 0.4f;
1822 G = 0.8f;
1823 B = 0.9f;
1824 break;
1825 case 47:
1826 R = 1f;
1827 G = 1f;
1828 B = 1f;
1829 break;
1830 case 48:
1831 R = 0.95f;
1832 G = 0.5f;
1833 B = 0.4f;
1834 break;
1835 default:
1836 R = 1f;
1837 G = 0.95f;
1838 B = 0.8f;
1839 break;
1840 }
1841 }
1842 break;
1843 case 35:
1844 if (tile.frameX < 36)
1845 {
1846 R = 0.75f;
1847 G = 0.6f;
1848 B = 0.3f;
1849 }
1850 break;
1851 case 95:
1852 if (tile.frameX < 36)
1853 {
1854 R = 1f;
1855 G = 0.95f;
1856 B = 0.8f;
1857 }
1858 break;
1859 case 17:
1860 case 133:
1861 case 302:
1862 R = 0.83f;
1863 G = 0.6f;
1864 B = 0.5f;
1865 break;
1866 case 77:
1867 R = 0.75f;
1868 G = 0.45f;
1869 B = 0.25f;
1870 break;
1871 case 37:
1872 R = 0.56f;
1873 G = 0.43f;
1874 B = 0.15f;
1875 break;
1876 case 22:
1877 case 140:
1878 R = 0.12f;
1879 G = 0.07f;
1880 B = 0.32f;
1881 break;
1882 case 171:
1883 if (tile.frameX < 10)
1884 {
1885 x -= tile.frameX;
1886 y -= tile.frameY;
1887 }
1888 switch ((Main.tile[x, y].frameY & 0x3C00) >> 10)
1889 {
1890 case 1:
1891 R = 0.1f;
1892 G = 0.1f;
1893 B = 0.1f;
1894 break;
1895 case 2:
1896 R = 0.2f;
1897 break;
1898 case 3:
1899 G = 0.2f;
1900 break;
1901 case 4:
1902 B = 0.2f;
1903 break;
1904 case 5:
1905 R = 0.125f;
1906 G = 0.125f;
1907 break;
1908 case 6:
1909 R = 0.2f;
1910 G = 0.1f;
1911 break;
1912 case 7:
1913 R = 0.125f;
1914 G = 0.125f;
1915 break;
1916 case 8:
1917 R = 0.08f;
1918 G = 0.175f;
1919 break;
1920 case 9:
1921 G = 0.125f;
1922 B = 0.125f;
1923 break;
1924 case 10:
1925 R = 0.125f;
1926 B = 0.125f;
1927 break;
1928 case 11:
1929 R = 0.1f;
1930 G = 0.1f;
1931 B = 0.2f;
1932 break;
1933 default:
1934 R = (G = (B = 0f));
1935 break;
1936 }
1937 R *= 0.5f;
1938 G *= 0.5f;
1939 B *= 0.5f;
1940 break;
1941 case 204:
1942 case 347:
1943 R = 0.35f;
1944 break;
1945 case 42:
1946 if (tile.frameX == 0)
1947 {
1948 switch (tile.frameY / 36)
1949 {
1950 case 0:
1951 R = 0.7f;
1952 G = 0.65f;
1953 B = 0.55f;
1954 break;
1955 case 1:
1956 R = 0.9f;
1957 G = 0.75f;
1958 B = 0.6f;
1959 break;
1960 case 2:
1961 R = 0.8f;
1962 G = 0.6f;
1963 B = 0.6f;
1964 break;
1965 case 3:
1966 R = 0.65f;
1967 G = 0.5f;
1968 B = 0.2f;
1969 break;
1970 case 4:
1971 R = 0.5f;
1972 G = 0.7f;
1973 B = 0.4f;
1974 break;
1975 case 5:
1976 R = 0.9f;
1977 G = 0.4f;
1978 B = 0.2f;
1979 break;
1980 case 6:
1981 R = 0.7f;
1982 G = 0.75f;
1983 B = 0.3f;
1984 break;
1985 case 7:
1986 {
1987 float num16 = Main.demonTorch * 0.2f;
1988 R = 0.9f - num16;
1989 G = 0.9f - num16;
1990 B = 0.7f + num16;
1991 break;
1992 }
1993 case 8:
1994 R = 0.75f;
1995 G = 0.6f;
1996 B = 0.3f;
1997 break;
1998 case 9:
1999 R = 1f;
2000 G = 0.3f;
2001 B = 0.5f;
2002 B += Main.demonTorch * 0.2f;
2003 R -= Main.demonTorch * 0.1f;
2004 G -= Main.demonTorch * 0.2f;
2005 break;
2006 case 11:
2007 R = 0.85f;
2008 G = 0.6f;
2009 B = 1f;
2010 break;
2011 case 14:
2012 R = 1f;
2013 G = 0.95f;
2014 B = 0.65f;
2015 break;
2016 case 15:
2017 case 16:
2018 R = 1f;
2019 G = 0.95f;
2020 B = 0.65f;
2021 break;
2022 case 17:
2023 R = 1f;
2024 G = 0.97f;
2025 B = 0.85f;
2026 break;
2027 case 18:
2028 R = 0.75f;
2029 G = 0.85f;
2030 B = 1f;
2031 break;
2032 case 21:
2033 R = 1f;
2034 G = 0.95f;
2035 B = 0.65f;
2036 break;
2037 case 22:
2038 R = 1f;
2039 G = 1f;
2040 B = 0.6f;
2041 break;
2042 case 23:
2043 R = 1f;
2044 G = 0.95f;
2045 B = 0.65f;
2046 break;
2047 case 27:
2048 R = 1f;
2049 G = 0.95f;
2050 B = 0.65f;
2051 break;
2052 case 28:
2053 R = 0.37f;
2054 G = 0.8f;
2055 B = 1f;
2056 break;
2057 case 29:
2058 R = 0f;
2059 G = 0.9f;
2060 B = 1f;
2061 break;
2062 case 30:
2063 R = 0.25f;
2064 G = 0.7f;
2065 B = 1f;
2066 break;
2067 case 32:
2068 R = 0.5f * Main.demonTorch + 1f * (1f - Main.demonTorch);
2069 G = 0.3f;
2070 B = 1f * Main.demonTorch + 0.5f * (1f - Main.demonTorch);
2071 break;
2072 case 35:
2073 R = 0.7f;
2074 G = 0.6f;
2075 B = 0.9f;
2076 break;
2077 case 36:
2078 R = 1f;
2079 G = 0.95f;
2080 B = 0.65f;
2081 break;
2082 case 37:
2083 {
2084 Vector3 vector = Main.hslToRgb(Main.demonTorch * 0.12f + 0.69f, 1f, 0.75f).ToVector3() * 1.2f;
2085 R = vector.X;
2086 G = vector.Y;
2087 B = vector.Z;
2088 break;
2089 }
2090 case 38:
2091 R = 1f;
2092 G = 0.97f;
2093 B = 0.85f;
2094 break;
2095 case 39:
2096 R = 0.55f;
2097 G = 0.45f;
2098 B = 0.95f;
2099 break;
2100 case 40:
2101 R = 1f;
2102 G = 0.6f;
2103 B = 0.1f;
2104 break;
2105 case 41:
2106 R = 0.3f;
2107 G = 0.75f;
2108 B = 0.55f;
2109 break;
2110 case 42:
2111 R = 0.9f;
2112 G = 0.55f;
2113 B = 0.7f;
2114 break;
2115 case 43:
2116 R = 0.55f;
2117 G = 0.85f;
2118 B = 1f;
2119 break;
2120 case 44:
2121 R = 1f;
2122 G = 0.95f;
2123 B = 0.65f;
2124 break;
2125 case 45:
2126 R = 1f;
2127 G = 0.95f;
2128 B = 0.65f;
2129 break;
2130 case 46:
2131 R = 0.4f;
2132 G = 0.8f;
2133 B = 0.9f;
2134 break;
2135 case 47:
2136 R = 1f;
2137 G = 1f;
2138 B = 1f;
2139 break;
2140 case 48:
2141 R = 0.95f;
2142 G = 0.5f;
2143 B = 0.4f;
2144 break;
2145 default:
2146 R = 1f;
2147 G = 1f;
2148 B = 1f;
2149 break;
2150 }
2151 }
2152 break;
2153 case 49:
2154 if (tile.frameX == 0)
2155 {
2156 R = 0f;
2157 G = 0.35f;
2158 B = 0.8f;
2159 }
2160 break;
2161 case 519:
2162 if (tile.frameY == 90)
2163 {
2164 if (tile.color() == 0)
2165 {
2166 float num15 = (float)localRandom.Next(28, 42) * 0.005f;
2167 num15 += (float)(270 - Main.mouseTextColor) / 1000f;
2168 R = 0.1f;
2169 G = 0.2f + num15 / 2f;
2170 B = 0.7f + num15;
2171 }
2172 else
2173 {
2174 Color color3 = WorldGen.paintColor(tile.color());
2175 R = (float)(int)color3.R / 255f;
2176 G = (float)(int)color3.G / 255f;
2177 B = (float)(int)color3.B / 255f;
2178 }
2179 }
2180 break;
2181 case 70:
2182 case 71:
2183 case 72:
2184 case 190:
2185 case 348:
2186 case 349:
2187 case 528:
2188 case 578:
2189 if (tile.type != 349 || tile.frameX >= 36)
2190 {
2191 float num11 = (float)localRandom.Next(28, 42) * 0.005f;
2192 num11 += (float)(270 - Main.mouseTextColor) / 1000f;
2193 if (tile.color() == 0)
2194 {
2195 R = 0f;
2196 G = 0.2f + num11 / 2f;
2197 B = 1f;
2198 }
2199 else
2200 {
2201 Color color2 = WorldGen.paintColor(tile.color());
2202 R = (float)(int)color2.R / 255f;
2203 G = (float)(int)color2.G / 255f;
2204 B = (float)(int)color2.B / 255f;
2205 }
2206 }
2207 break;
2208 case 350:
2209 {
2210 double num10 = Main.timeForVisualEffects * 0.08;
2211 B = (G = (R = (float)((0.0 - Math.Cos(((int)(num10 / 6.283) % 3 == 1) ? num10 : 0.0)) * 0.1 + 0.1)));
2212 break;
2213 }
2214 case 61:
2215 if (tile.frameX == 144)
2216 {
2217 float num8 = 1f + (float)(270 - Main.mouseTextColor) / 400f;
2218 float num9 = 0.8f - (float)(270 - Main.mouseTextColor) / 400f;
2219 R = 0.42f * num9;
2220 G = 0.81f * num8;
2221 B = 0.52f * num9;
2222 }
2223 break;
2224 case 26:
2225 case 31:
2226 if ((tile.type == 31 && tile.frameX >= 36) || (tile.type == 26 && tile.frameX >= 54))
2227 {
2228 float num4 = (float)localRandom.Next(-5, 6) * 0.0025f;
2229 R = 0.5f + num4 * 2f;
2230 G = 0.2f + num4;
2231 B = 0.1f;
2232 }
2233 else
2234 {
2235 float num5 = (float)localRandom.Next(-5, 6) * 0.0025f;
2236 R = 0.31f + num5;
2237 G = 0.1f;
2238 B = 0.44f + num5 * 2f;
2239 }
2240 break;
2241 case 84:
2242 {
2243 int num2 = tile.frameX / 18;
2244 float num3 = 0f;
2245 switch (num2)
2246 {
2247 case 2:
2248 num3 = (float)(270 - Main.mouseTextColor) / 800f;
2249 if (num3 > 1f)
2250 {
2251 num3 = 1f;
2252 }
2253 else if (num3 < 0f)
2254 {
2255 num3 = 0f;
2256 }
2257 R = num3 * 0.7f;
2258 G = num3;
2259 B = num3 * 0.1f;
2260 break;
2261 case 5:
2262 num3 = 0.9f;
2263 R = num3;
2264 G = num3 * 0.8f;
2265 B = num3 * 0.2f;
2266 break;
2267 case 6:
2268 num3 = 0.08f;
2269 G = num3 * 0.8f;
2270 B = num3;
2271 break;
2272 }
2273 break;
2274 }
2275 case 83:
2276 if (tile.frameX == 18 && !Main.dayTime)
2277 {
2278 R = 0.1f;
2279 G = 0.4f;
2280 B = 0.6f;
2281 }
2282 if (tile.frameX == 90 && !Main.raining && Main.time > 40500.0)
2283 {
2284 R = 0.9f;
2285 G = 0.72f;
2286 B = 0.18f;
2287 }
2288 break;
2289 case 126:
2290 if (tile.frameX < 36)
2291 {
2292 R = (float)Main.DiscoR / 255f;
2293 G = (float)Main.DiscoG / 255f;
2294 B = (float)Main.DiscoB / 255f;
2295 }
2296 break;
2297 case 125:
2298 {
2299 float num = (float)localRandom.Next(28, 42) * 0.01f;
2300 num += (float)(270 - Main.mouseTextColor) / 800f;
2301 G = (lightColor.Y = 0.3f * num);
2302 B = (lightColor.Z = 0.6f * num);
2303 break;
2304 }
2305 case 129:
2306 switch (tile.frameX / 18 % 3)
2307 {
2308 case 0:
2309 R = 0f;
2310 G = 0.05f;
2311 B = 0.25f;
2312 break;
2313 case 1:
2314 R = 0.2f;
2315 G = 0f;
2316 B = 0.15f;
2317 break;
2318 case 2:
2319 R = 0.1f;
2320 G = 0f;
2321 B = 0.2f;
2322 break;
2323 }
2324 break;
2325 case 149:
2326 if (tile.frameX <= 36)
2327 {
2328 switch (tile.frameX / 18)
2329 {
2330 case 0:
2331 R = 0.1f;
2332 G = 0.2f;
2333 B = 0.5f;
2334 break;
2335 case 1:
2336 R = 0.5f;
2337 G = 0.1f;
2338 B = 0.1f;
2339 break;
2340 case 2:
2341 R = 0.2f;
2342 G = 0.5f;
2343 B = 0.1f;
2344 break;
2345 }
2346 R *= (float)localRandom.Next(970, 1031) * 0.001f;
2347 G *= (float)localRandom.Next(970, 1031) * 0.001f;
2348 B *= (float)localRandom.Next(970, 1031) * 0.001f;
2349 }
2350 break;
2351 case 160:
2352 R = (float)Main.DiscoR / 255f * 0.25f;
2353 G = (float)Main.DiscoG / 255f * 0.25f;
2354 B = (float)Main.DiscoB / 255f * 0.25f;
2355 break;
2356 case 354:
2357 R = 0.65f;
2358 G = 0.35f;
2359 B = 0.15f;
2360 break;
2361 }
2362 }
2363 if (lightColor.X < R)
2364 {
2365 lightColor.X = R;
2366 }
2367 if (lightColor.Y < G)
2368 {
2369 lightColor.Y = G;
2370 }
2371 if (lightColor.Z < B)
2372 {
2373 lightColor.Z = B;
2374 }
2375 }
2376
2377 private void ApplySurfaceLight(Tile tile, int x, int y, ref Vector3 lightColor)
2378 {
2379 float num = 0f;
2380 float num2 = 0f;
2381 float num3 = 0f;
2382 float num4 = (float)(int)Main.tileColor.R / 255f;
2383 float num5 = (float)(int)Main.tileColor.G / 255f;
2384 float num6 = (float)(int)Main.tileColor.B / 255f;
2385 float num7 = (num4 + num5 + num6) / 3f;
2386 if (tile.active() && TileID.Sets.AllowLightInWater[tile.type])
2387 {
2388 if (lightColor.X < num7 && (Main.wallLight[tile.wall] || tile.wall == 73 || tile.wall == 227 || (tile.invisibleWall() && !_drawInvisibleWalls)))
2389 {
2390 num = num4;
2391 num2 = num5;
2392 num3 = num6;
2393 }
2394 }
2395 else if ((!tile.active() || !Main.tileNoSunLight[tile.type] || ((tile.slope() != 0 || tile.halfBrick() || (tile.invisibleBlock() && !_drawInvisibleWalls)) && Main.tile[x, y - 1].liquid == 0 && Main.tile[x, y + 1].liquid == 0 && Main.tile[x - 1, y].liquid == 0 && Main.tile[x + 1, y].liquid == 0)) && lightColor.X < num7 && (Main.wallLight[tile.wall] || tile.wall == 73 || tile.wall == 227 || (tile.invisibleWall() && !_drawInvisibleWalls)))
2396 {
2397 if (tile.liquid < 200)
2398 {
2399 if (!tile.halfBrick() || Main.tile[x, y - 1].liquid < 200)
2400 {
2401 num = num4;
2402 num2 = num5;
2403 num3 = num6;
2404 }
2405 }
2406 else if (Main.liquidAlpha[13] > 0f)
2407 {
2408 if (Main.rand == null)
2409 {
2410 Main.rand = new UnifiedRandom();
2411 }
2412 num3 = num6 * 0.175f * (1f + Main.rand.NextFloat() * 0.13f) * Main.liquidAlpha[13];
2413 }
2414 }
2415 if ((!tile.active() || tile.halfBrick() || !Main.tileNoSunLight[tile.type]) && ((tile.wall >= 88 && tile.wall <= 93) || tile.wall == 241) && tile.liquid < byte.MaxValue)
2416 {
2417 num = num4;
2418 num2 = num5;
2419 num3 = num6;
2420 int num8 = tile.wall - 88;
2421 if (tile.wall == 241)
2422 {
2423 num8 = 6;
2424 }
2425 switch (num8)
2426 {
2427 case 0:
2428 num *= 0.9f;
2429 num2 *= 0.15f;
2430 num3 *= 0.9f;
2431 break;
2432 case 1:
2433 num *= 0.9f;
2434 num2 *= 0.9f;
2435 num3 *= 0.15f;
2436 break;
2437 case 2:
2438 num *= 0.15f;
2439 num2 *= 0.15f;
2440 num3 *= 0.9f;
2441 break;
2442 case 3:
2443 num *= 0.15f;
2444 num2 *= 0.9f;
2445 num3 *= 0.15f;
2446 break;
2447 case 4:
2448 num *= 0.9f;
2449 num2 *= 0.15f;
2450 num3 *= 0.15f;
2451 break;
2452 case 5:
2453 {
2454 float num9 = 0.2f;
2455 float num10 = 0.7f - num9;
2456 num *= num10 + (float)Main.DiscoR / 255f * num9;
2457 num2 *= num10 + (float)Main.DiscoG / 255f * num9;
2458 num3 *= num10 + (float)Main.DiscoB / 255f * num9;
2459 break;
2460 }
2461 case 6:
2462 num *= 0.9f;
2463 num2 *= 0.5f;
2464 num3 *= 0f;
2465 break;
2466 }
2467 }
2468 float num11 = 1f - Main.shimmerDarken;
2469 num *= num11;
2470 num2 *= num11;
2471 num3 *= num11;
2472 if (lightColor.X < num)
2473 {
2474 lightColor.X = num;
2475 }
2476 if (lightColor.Y < num2)
2477 {
2478 lightColor.Y = num2;
2479 }
2480 if (lightColor.Z < num3)
2481 {
2482 lightColor.Z = num3;
2483 }
2484 }
2485
2486 private void ApplyHellLight(Tile tile, int x, int y, ref Vector3 lightColor)
2487 {
2488 float num = 0f;
2489 float num2 = 0f;
2490 float num3 = 0f;
2491 float num4 = 0.55f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f) * 0.08f;
2492 if ((!tile.active() || !Main.tileNoSunLight[tile.type] || ((tile.slope() != 0 || tile.halfBrick()) && Main.tile[x, y - 1].liquid == 0 && Main.tile[x, y + 1].liquid == 0 && Main.tile[x - 1, y].liquid == 0 && Main.tile[x + 1, y].liquid == 0)) && lightColor.X < num4 && (Main.wallLight[tile.wall] || tile.wall == 73 || tile.wall == 227 || (tile.invisibleWall() && !_drawInvisibleWalls)) && tile.liquid < 200 && (!tile.halfBrick() || Main.tile[x, y - 1].liquid < 200))
2493 {
2494 num = num4;
2495 num2 = num4 * 0.6f;
2496 num3 = num4 * 0.2f;
2497 }
2498 if ((!tile.active() || tile.halfBrick() || !Main.tileNoSunLight[tile.type]) && tile.wall >= 88 && tile.wall <= 93 && tile.liquid < byte.MaxValue)
2499 {
2500 num = num4;
2501 num2 = num4 * 0.6f;
2502 num3 = num4 * 0.2f;
2503 switch (tile.wall)
2504 {
2505 case 88:
2506 num *= 0.9f;
2507 num2 *= 0.15f;
2508 num3 *= 0.9f;
2509 break;
2510 case 89:
2511 num *= 0.9f;
2512 num2 *= 0.9f;
2513 num3 *= 0.15f;
2514 break;
2515 case 90:
2516 num *= 0.15f;
2517 num2 *= 0.15f;
2518 num3 *= 0.9f;
2519 break;
2520 case 91:
2521 num *= 0.15f;
2522 num2 *= 0.9f;
2523 num3 *= 0.15f;
2524 break;
2525 case 92:
2526 num *= 0.9f;
2527 num2 *= 0.15f;
2528 num3 *= 0.15f;
2529 break;
2530 case 93:
2531 {
2532 float num5 = 0.2f;
2533 float num6 = 0.7f - num5;
2534 num *= num6 + (float)Main.DiscoR / 255f * num5;
2535 num2 *= num6 + (float)Main.DiscoG / 255f * num5;
2536 num3 *= num6 + (float)Main.DiscoB / 255f * num5;
2537 break;
2538 }
2539 }
2540 }
2541 if (lightColor.X < num)
2542 {
2543 lightColor.X = num;
2544 }
2545 if (lightColor.Y < num2)
2546 {
2547 lightColor.Y = num2;
2548 }
2549 if (lightColor.Z < num3)
2550 {
2551 lightColor.Z = num3;
2552 }
2553 }
2554}
static void For(int fromInclusive, int toExclusive, ParallelForAction callback, object context=null)
static double Cos(double d)
static double Sin(double a)
static Vector4 GetShimmerBaseColor(float worldPositionX, float worldPositionY)
static Color GetPortalColor(int colorIndex)
void SetMaskAt(int x, int y, LightMaskMode mode)
Definition LightMap.cs:78
void ApplyWallLight(Tile tile, int x, int y, ref FastRandom localRandom, ref Vector3 lightColor)
void ApplyHellLight(Tile tile, int x, int y, ref Vector3 lightColor)
void ApplyTileLight(Tile tile, int x, int y, ref FastRandom localRandom, ref Vector3 lightColor)
LightMaskMode GetMaskMode(int x, int y)
void ExportTo(Rectangle area, LightMap outputMap, TileLightScannerOptions options)
void ApplyLiquidLight(Tile tile, ref Vector3 lightColor)
void ApplySurfaceLight(Tile tile, int x, int y, ref Vector3 lightColor)
void GetTileLight(int x, int y, out Vector3 outputColor)
static bool[] AllowLightInWater
Definition TileID.cs:261
static void TorchColor(int torchID, out float R, out float G, out float B)
Definition TorchID.cs:164
static bool[] tileBlockLight
Definition Main.cs:1461
static bool raining
Definition Main.cs:1310
static bool[] tileNoSunLight
Definition Main.cs:1463
static double time
Definition Main.cs:1284
static byte[,] jellyfishCageMode
Definition Main.cs:1605
static float shimmerDarken
Definition Main.cs:1010
static double worldSurface
Definition Main.cs:1272
static float[] liquidAlpha
Definition Main.cs:1206
static int myPlayer
Definition Main.cs:1801
static int DiscoR
Definition Main.cs:1062
static float demonTorch
Definition Main.cs:1330
static bool[] tileLighted
Definition Main.cs:1429
static bool dayTime
Definition Main.cs:1282
static byte mouseTextColor
Definition Main.cs:1751
static int DiscoG
Definition Main.cs:1066
static Tile[,] tile
Definition Main.cs:1675
static int moondialCooldown
Definition Main.cs:2287
static int DiscoB
Definition Main.cs:1064
static UnifiedRandom rand
Definition Main.cs:1387
static int cageFrames
Definition Main.cs:1509
static bool[] wallLight
Definition Main.cs:1445
static int sundialCooldown
Definition Main.cs:2283
static int UnderworldLayer
Definition Main.cs:2825
static Microsoft.Xna.Framework.Color hslToRgb(Vector3 hslVector)
Definition Main.cs:44913
static float GlobalTimeWrappedHourly
Definition Main.cs:405
byte color()
Definition Tile.cs:555
bool invisibleWall()
Definition Tile.cs:521
byte liquid
Definition Tile.cs:12
bool inActive()
Definition Tile.cs:582
short frameY
Definition Tile.cs:24
ushort type
Definition Tile.cs:8
short frameX
Definition Tile.cs:22
bool invisibleBlock()
Definition Tile.cs:504
bool active()
Definition Tile.cs:565
byte slope()
Definition Tile.cs:684
bool honey()
Definition Tile.cs:379
bool lava()
Definition Tile.cs:362
bool shimmer()
Definition Tile.cs:396
ushort wall
Definition Tile.cs:10
bool halfBrick()
Definition Tile.cs:650
static bool InWorld(int x, int y, int fluff=0)
Definition WorldGen.cs:5816
static Color paintColor(int color)
delegate void ParallelForAction(int fromInclusive, int toExclusive, object context)
static FastRandom CreateWithRandomSeed()
Definition FastRandom.cs:37
FastRandom WithModifier(ulong modifier)
Definition FastRandom.cs:27