359 {
360 int num = 0;
362 Main.snowDust = 0;
365 for (
int i = 0;
i < 6000;
i++)
366 {
367 Dust dust = Main.dust[
i];
368 if (i < Main.maxDustToDraw)
369 {
370 if (!dust.active)
371 {
372 continue;
373 }
375 if (dust.scale > 10f)
376 {
377 dust.active = false;
378 }
380 {
381 if (Main.rand.Next(2) == 0)
382 {
383 dust.firstFrame = false;
384 dust.type = 16;
385 dust.scale = Main.rand.NextFloat() * 1.6f + 0.3f;
387 dust.frame.X = 10 * dust.type;
388 dust.frame.Y = 10 * Main.rand.Next(3);
389 dust.shader = null;
390 dust.customData = null;
391 int num2 = dust.type / 100;
392 dust.frame.X -= 1000 * num2;
393 dust.frame.Y += 30 * num2;
394 dust.noGravity = true;
395 }
396 else
397 {
398 dust.active = false;
399 }
400 }
401 int num3 = dust.type;
402 if ((uint)(num3 - 299) <= 2u || num3 == 305)
403 {
404 dust.scale *= 0.96f;
405 dust.velocity.Y -= 0.01f;
406 }
407 if (dust.type == 35)
408 {
410 }
411 dust.position += dust.velocity;
412 if (dust.type == 258)
413 {
414 dust.noGravity = true;
415 dust.scale += 0.015f;
416 }
417 if (dust.type == 309)
418 {
419 float r = (float)(int)dust.color.R / 255f * dust.scale;
420 float g = (float)(int)dust.color.G / 255f * dust.scale;
421 float b = (float)(int)dust.color.B / 255f * dust.scale;
422 Lighting.AddLight(dust.position, r, g, b);
423 dust.scale *= 0.97f;
424 }
425 if (((dust.type >= 86 && dust.type <= 92) || dust.type == 286) && !dust.noLight && !dust.noLightEmittence)
426 {
427 float num4 = dust.scale * 0.6f;
428 if (num4 > 1f)
429 {
430 num4 = 1f;
431 }
432 int num5 = dust.type - 85;
433 float num6 = num4;
434 float num7 = num4;
435 float num8 = num4;
436 switch (num5)
437 {
438 case 3:
439 num6 *= 0f;
440 num7 *= 0.1f;
441 num8 *= 1.3f;
442 break;
443 case 5:
444 num6 *= 1f;
445 num7 *= 0.1f;
446 num8 *= 0.1f;
447 break;
448 case 4:
449 num6 *= 0f;
450 num7 *= 1f;
451 num8 *= 0.1f;
452 break;
453 case 1:
454 num6 *= 0.9f;
455 num7 *= 0f;
456 num8 *= 0.9f;
457 break;
458 case 6:
459 num6 *= 1.3f;
460 num7 *= 1.3f;
461 num8 *= 1.3f;
462 break;
463 case 2:
464 num6 *= 0.9f;
465 num7 *= 0.9f;
466 num8 *= 0f;
467 break;
468 }
469 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num4 * num6, num4 * num7, num4 * num8);
470 }
471 if ((dust.type >= 86 && dust.type <= 92) || dust.type == 286)
472 {
473 if (dust.customData != null && dust.customData is Player)
474 {
476 dust.position += player.position - player.oldPosition;
477 }
478 else if (dust.customData != null && dust.customData is Projectile)
479 {
480 Projectile projectile = (Projectile)dust.customData;
481 if (projectile.active)
482 {
483 dust.position += projectile.position - projectile.oldPosition;
484 }
485 }
486 }
487 if (dust.type == 262 && !dust.noLight)
488 {
490 Lighting.AddLight(dust.position, rgb);
491 }
492 if (dust.type == 240 && dust.customData != null && dust.customData is Projectile)
493 {
494 Projectile projectile2 = (Projectile)dust.customData;
495 if (projectile2.active)
496 {
497 dust.position += projectile2.position - projectile2.oldPosition;
498 }
499 }
500 if ((dust.type == 259 || dust.type == 6 || dust.type == 158 || dust.type == 135) && dust.customData != null && dust.customData is int)
501 {
502 if ((int)dust.customData == 0)
503 {
504 if (Collision.SolidCollision(dust.position -
Vector2.
One * 5f, 10, 10) && dust.fadeIn == 0f)
505 {
506 dust.scale *= 0.9f;
507 dust.velocity *= 0.25f;
508 }
509 }
510 else if ((int)dust.customData == 1)
511 {
512 dust.scale *= 0.98f;
513 dust.velocity.Y *= 0.98f;
514 if (Collision.SolidCollision(dust.position -
Vector2.
One * 5f, 10, 10) && dust.fadeIn == 0f)
515 {
516 dust.scale *= 0.9f;
517 dust.velocity *= 0.25f;
518 }
519 }
520 }
521 if (dust.type == 263 || dust.type == 264)
522 {
523 if (!dust.noLight)
524 {
525 Vector3 rgb2 = dust.color.ToVector3() * dust.scale * 0.4f;
526 Lighting.AddLight(dust.position, rgb2);
527 }
528 if (dust.customData != null && dust.customData is Player)
529 {
531 dust.position += player2.position - player2.oldPosition;
532 dust.customData = null;
533 }
534 else if (dust.customData != null && dust.customData is Projectile)
535 {
536 Projectile projectile3 = (Projectile)dust.customData;
537 dust.position += projectile3.position - projectile3.oldPosition;
538 }
539 }
540 if (dust.type == 230)
541 {
542 float num9 = dust.scale * 0.6f;
543 float num10 = num9;
544 float num11 = num9;
545 float num12 = num9;
546 num10 *= 0.5f;
547 num11 *= 0.9f;
548 num12 *= 1f;
549 dust.scale += 0.02f;
550 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num9 * num10, num9 * num11, num9 * num12);
551 if (dust.customData != null && dust.customData is Player)
552 {
554 Vector2 vector = dust.position - center;
555 float num13 = vector.
Length();
556 vector /= num13;
557 dust.scale =
Math.
Min(dust.scale, num13 / 24f - 1f);
558 dust.velocity -= vector * (100f /
Math.
Max(50f, num13));
559 }
560 }
561 if (dust.type == 154 || dust.type == 218)
562 {
563 dust.rotation += dust.velocity.X * 0.3f;
564 dust.scale -= 0.03f;
565 }
566 if (dust.type == 172)
567 {
568 float num14 = dust.scale * 0.5f;
569 if (num14 > 1f)
570 {
571 num14 = 1f;
572 }
573 float num15 = num14;
574 float num16 = num14;
575 float num17 = num14;
576 num15 *= 0f;
577 num16 *= 0.25f;
578 num17 *= 1f;
579 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num14 * num15, num14 * num16, num14 * num17);
580 }
581 if (dust.type == 182)
582 {
583 dust.rotation += 1f;
584 if (!dust.noLight)
585 {
586 float num18 = dust.scale * 0.25f;
587 if (num18 > 1f)
588 {
589 num18 = 1f;
590 }
591 float num19 = num18;
592 float num20 = num18;
593 float num21 = num18;
594 num19 *= 1f;
595 num20 *= 0.2f;
596 num21 *= 0.1f;
597 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num18 * num19, num18 * num20, num18 * num21);
598 }
599 if (dust.customData != null && dust.customData is Player)
600 {
602 dust.position += player3.position - player3.oldPosition;
603 dust.customData = null;
604 }
605 }
606 if (dust.type == 261)
607 {
608 if (!dust.noLight && !dust.noLightEmittence)
609 {
610 float num22 = dust.scale * 0.3f;
611 if (num22 > 1f)
612 {
613 num22 = 1f;
614 }
615 Lighting.AddLight(dust.position,
new Vector3(0.4f, 0.6f, 0.7f) * num22);
616 }
617 if (dust.noGravity)
618 {
619 dust.velocity *= 0.93f;
620 if (dust.fadeIn == 0f)
621 {
622 dust.scale += 0.0025f;
623 }
624 }
625 dust.velocity *=
new Vector2(0.97f, 0.99f);
626 dust.scale -= 0.0025f;
627 if (dust.customData != null && dust.customData is Player)
628 {
630 dust.position += player4.position - player4.oldPosition;
631 }
632 }
633 if (dust.type == 254)
634 {
635 float num23 = dust.scale * 0.35f;
636 if (num23 > 1f)
637 {
638 num23 = 1f;
639 }
640 float num24 = num23;
641 float num25 = num23;
642 float num26 = num23;
643 num24 *= 0.9f;
644 num25 *= 0.1f;
645 num26 *= 0.75f;
646 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num23 * num24, num23 * num25, num23 * num26);
647 }
648 if (dust.type == 255)
649 {
650 float num27 = dust.scale * 0.25f;
651 if (num27 > 1f)
652 {
653 num27 = 1f;
654 }
655 float num28 = num27;
656 float num29 = num27;
657 float num30 = num27;
658 num28 *= 0.9f;
659 num29 *= 0.1f;
660 num30 *= 0.75f;
661 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num27 * num28, num27 * num29, num27 * num30);
662 }
663 if (dust.type == 211 && dust.noLight && Collision.SolidCollision(dust.position, 4, 4))
664 {
665 dust.active = false;
666 }
667 if (dust.type == 284 && Collision.SolidCollision(dust.position -
Vector2.
One * 4f, 8, 8) && dust.fadeIn == 0f)
668 {
669 dust.velocity *= 0.25f;
670 }
671 if (dust.type == 213 || dust.type == 260)
672 {
673 dust.rotation = 0f;
674 float num31 = dust.scale / 2.5f * 0.2f;
676 switch (dust.type)
677 {
678 case 213:
679 vector2 =
new Vector3(255f, 217f, 48f);
680 break;
681 case 260:
682 vector2 =
new Vector3(255f, 48f, 48f);
683 break;
684 }
685 vector2 /= 255f;
686 if (num31 > 1f)
687 {
688 num31 = 1f;
689 }
690 vector2 *= num31;
691 Lighting.AddLight((
int)(dust.position.X / 16f), (
int)(dust.position.Y / 16f), vector2.
X, vector2.
Y, vector2.
Z);
692 }
693 if (dust.type == 157)
694 {
695 float num32 = dust.scale * 0.2f;
696 float num33 = num32;
697 float num34 = num32;
698 float num35 = num32;
699 num33 *= 0.25f;
700 num34 *= 1f;
701 num35 *= 0.5f;
702 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num32 * num33, num32 * num34, num32 * num35);
703 }
704 if (dust.type == 206)
705 {
706 dust.scale -= 0.1f;
707 float num36 = dust.scale * 0.4f;
708 float num37 = num36;
709 float num38 = num36;
710 float num39 = num36;
711 num37 *= 0.1f;
712 num38 *= 0.6f;
713 num39 *= 1f;
714 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num36 * num37, num36 * num38, num36 * num39);
715 }
716 if (dust.type == 163)
717 {
718 float num40 = dust.scale * 0.25f;
719 float num41 = num40;
720 float num42 = num40;
721 float num43 = num40;
722 num41 *= 0.25f;
723 num42 *= 1f;
724 num43 *= 0.05f;
725 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num40 * num41, num40 * num42, num40 * num43);
726 }
727 if (dust.type == 205)
728 {
729 float num44 = dust.scale * 0.25f;
730 float num45 = num44;
731 float num46 = num44;
732 float num47 = num44;
733 num45 *= 1f;
734 num46 *= 0.05f;
735 num47 *= 1f;
736 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num44 * num45, num44 * num46, num44 * num47);
737 }
738 if (dust.type == 170)
739 {
740 float num48 = dust.scale * 0.5f;
741 float num49 = num48;
742 float num50 = num48;
743 float num51 = num48;
744 num49 *= 1f;
745 num50 *= 1f;
746 num51 *= 0.05f;
747 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num48 * num49, num48 * num50, num48 * num51);
748 }
749 if (dust.type == 156)
750 {
751 float num52 = dust.scale * 0.6f;
752 _ = dust.type;
753 float num53 = num52;
754 float num54 = num52;
755 num53 *= 0.9f;
756 num54 *= 1f;
757 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 12, num52);
758 }
759 if (dust.type == 234)
760 {
761 float lightAmount = dust.scale * 0.6f;
762 _ = dust.type;
763 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 13, lightAmount);
764 }
765 if (dust.type == 175)
766 {
767 dust.scale -= 0.05f;
768 }
769 if (dust.type == 174)
770 {
771 dust.scale -= 0.01f;
772 float num55 = dust.scale * 1f;
773 if (num55 > 0.6f)
774 {
775 num55 = 0.6f;
776 }
777 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num55, num55 * 0.4f, 0f);
778 }
779 if (dust.type == 235)
780 {
781 Vector2 vector3 =
new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101));
783 vector3 *= 15f;
784 dust.scale -= 0.01f;
785 }
786 else if (dust.type == 228 || dust.type == 279 || dust.type == 229 || dust.type == 6 || dust.type == 242 || dust.type == 135 || dust.type == 127 || dust.type == 187 || dust.type == 75 || dust.type == 169 || dust.type == 29 || (dust.type >= 59 && dust.type <= 65) || dust.type == 158 || dust.type == 293 || dust.type == 294 || dust.type == 295 || dust.type == 296 || dust.type == 297 || dust.type == 298 || dust.type == 302 || dust.type == 307 || dust.type == 310)
787 {
788 if (!dust.noGravity)
789 {
790 dust.velocity.Y += 0.05f;
791 }
792 if (dust.type == 229 || dust.type == 228 || dust.type == 279)
793 {
794 if (dust.customData != null && dust.customData is NPC)
795 {
796 NPC nPC = (
NPC)dust.customData;
797 dust.position += nPC.position - nPC.oldPos[1];
798 }
799 else if (dust.customData != null && dust.customData is Player)
800 {
802 dust.position += player5.position - player5.oldPosition;
803 }
804 else if (dust.customData !=
null && dust.customData is
Vector2)
805 {
808 {
809 vector4.Normalize();
810 }
811 dust.velocity = (dust.velocity * 4f + vector4 * dust.velocity.Length()) / 5f;
812 }
813 }
814 if (!dust.noLight && !dust.noLightEmittence)
815 {
816 float num56 = dust.scale * 1.4f;
817 if (dust.type == 29)
818 {
819 if (num56 > 1f)
820 {
821 num56 = 1f;
822 }
823 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num56 * 0.1f, num56 * 0.4f, num56);
824 }
825 else if (dust.type == 75)
826 {
827 if (num56 > 1f)
828 {
829 num56 = 1f;
830 }
831 if (dust.customData is float)
832 {
833 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 8, num56 * (float)dust.customData);
834 }
835 else
836 {
837 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 8, num56);
838 }
839 }
840 else if (dust.type == 169)
841 {
842 if (num56 > 1f)
843 {
844 num56 = 1f;
845 }
846 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 11, num56);
847 }
848 else if (dust.type == 135)
849 {
850 if (num56 > 1f)
851 {
852 num56 = 1f;
853 }
854 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 9, num56);
855 }
856 else if (dust.type == 158)
857 {
858 if (num56 > 1f)
859 {
860 num56 = 1f;
861 }
862 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 10, num56);
863 }
864 else if (dust.type == 228)
865 {
866 if (num56 > 1f)
867 {
868 num56 = 1f;
869 }
870 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num56 * 0.7f, num56 * 0.65f, num56 * 0.3f);
871 }
872 else if (dust.type == 229)
873 {
874 if (num56 > 1f)
875 {
876 num56 = 1f;
877 }
878 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num56 * 0.3f, num56 * 0.65f, num56 * 0.7f);
879 }
880 else if (dust.type == 242)
881 {
882 if (num56 > 1f)
883 {
884 num56 = 1f;
885 }
886 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 15, num56);
887 }
888 else if (dust.type == 293)
889 {
890 if (num56 > 1f)
891 {
892 num56 = 1f;
893 }
894 num56 *= 0.95f;
895 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 16, num56);
896 }
897 else if (dust.type == 294)
898 {
899 if (num56 > 1f)
900 {
901 num56 = 1f;
902 }
903 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 17, num56);
904 }
905 else if (dust.type >= 59 && dust.type <= 65)
906 {
907 if (num56 > 0.8f)
908 {
909 num56 = 0.8f;
910 }
911 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 1 + dust.type - 59, num56);
912 }
913 else if (dust.type == 127)
914 {
915 num56 *= 1.3f;
916 if (num56 > 1f)
917 {
918 num56 = 1f;
919 }
920 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num56, num56 * 0.45f, num56 * 0.2f);
921 }
922 else if (dust.type == 187)
923 {
924 num56 *= 1.3f;
925 if (num56 > 1f)
926 {
927 num56 = 1f;
928 }
929 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num56 * 0.2f, num56 * 0.45f, num56);
930 }
931 else if (dust.type == 295)
932 {
933 if (num56 > 1f)
934 {
935 num56 = 1f;
936 }
937 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 18, num56);
938 }
939 else if (dust.type == 296)
940 {
941 if (num56 > 1f)
942 {
943 num56 = 1f;
944 }
945 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 19, num56);
946 }
947 else if (dust.type == 297)
948 {
949 if (num56 > 1f)
950 {
951 num56 = 1f;
952 }
953 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 20, num56);
954 }
955 else if (dust.type == 298)
956 {
957 if (num56 > 1f)
958 {
959 num56 = 1f;
960 }
961 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 21, num56);
962 }
963 else if (dust.type == 307)
964 {
965 if (num56 > 1f)
966 {
967 num56 = 1f;
968 }
969 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 22, num56);
970 }
971 else if (dust.type == 310)
972 {
973 if (num56 > 1f)
974 {
975 num56 = 1f;
976 }
977 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 23, num56);
978 }
979 else
980 {
981 if (num56 > 0.6f)
982 {
983 num56 = 0.6f;
984 }
985 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num56, num56 * 0.65f, num56 * 0.4f);
986 }
987 }
988 }
989 else if (dust.type == 306)
990 {
991 if (!dust.noGravity)
992 {
993 dust.velocity.Y += 0.05f;
994 }
995 dust.scale -= 0.04f;
996 if (Collision.SolidCollision(dust.position -
Vector2.
One * 5f, 10, 10) && dust.fadeIn == 0f)
997 {
998 dust.scale *= 0.9f;
999 dust.velocity *= 0.25f;
1000 }
1001 }
1002 else if (dust.type == 269)
1003 {
1004 if (!dust.noLight)
1005 {
1006 float num57 = dust.scale * 1.4f;
1007 if (num57 > 1f)
1008 {
1009 num57 = 1f;
1010 }
1012 }
1013 if (dust.customData !=
null && dust.customData is
Vector2)
1014 {
1016 dust.velocity.X += 1f * (float)
Math.
Sign(vector5.X) * dust.scale;
1017 }
1018 }
1019 else if (dust.type == 159)
1020 {
1021 float num58 = dust.scale * 1.3f;
1022 if (num58 > 1f)
1023 {
1024 num58 = 1f;
1025 }
1026 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num58, num58, num58 * 0.1f);
1027 if (dust.noGravity)
1028 {
1029 if (dust.scale < 0.7f)
1030 {
1031 dust.velocity *= 1.075f;
1032 }
1033 else if (Main.rand.Next(2) == 0)
1034 {
1035 dust.velocity *= -0.95f;
1036 }
1037 else
1038 {
1039 dust.velocity *= 1.05f;
1040 }
1041 dust.scale -= 0.03f;
1042 }
1043 else
1044 {
1045 dust.scale += 0.005f;
1046 dust.velocity *= 0.9f;
1047 dust.velocity.X += (float)Main.rand.Next(-10, 11) * 0.02f;
1048 dust.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.02f;
1049 if (Main.rand.Next(5) == 0)
1050 {
1051 int num59 =
NewDust(dust.position, 4, 4, dust.type);
1052 Main.dust[num59].noGravity = true;
1053 Main.dust[num59].scale = dust.scale * 2.5f;
1054 }
1055 }
1056 }
1057 else if (dust.type == 164)
1058 {
1059 float num60 = dust.scale;
1060 if (num60 > 1f)
1061 {
1062 num60 = 1f;
1063 }
1064 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num60, num60 * 0.1f, num60 * 0.8f);
1065 if (dust.noGravity)
1066 {
1067 if (dust.scale < 0.7f)
1068 {
1069 dust.velocity *= 1.075f;
1070 }
1071 else if (Main.rand.Next(2) == 0)
1072 {
1073 dust.velocity *= -0.95f;
1074 }
1075 else
1076 {
1077 dust.velocity *= 1.05f;
1078 }
1079 dust.scale -= 0.03f;
1080 }
1081 else
1082 {
1083 dust.scale -= 0.005f;
1084 dust.velocity *= 0.9f;
1085 dust.velocity.X += (float)Main.rand.Next(-10, 11) * 0.02f;
1086 dust.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.02f;
1087 if (Main.rand.Next(5) == 0)
1088 {
1089 int num61 =
NewDust(dust.position, 4, 4, dust.type);
1090 Main.dust[num61].noGravity = true;
1091 Main.dust[num61].scale = dust.scale * 2.5f;
1092 }
1093 }
1094 }
1095 else if (dust.type == 173)
1096 {
1097 float num62 = dust.scale;
1098 if (num62 > 1f)
1099 {
1100 num62 = 1f;
1101 }
1102 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num62 * 0.4f, num62 * 0.1f, num62);
1103 if (dust.noGravity)
1104 {
1105 dust.velocity *= 0.8f;
1106 dust.velocity.X += (float)Main.rand.Next(-20, 21) * 0.01f;
1107 dust.velocity.Y += (float)Main.rand.Next(-20, 21) * 0.01f;
1108 dust.scale -= 0.01f;
1109 }
1110 else
1111 {
1112 dust.scale -= 0.015f;
1113 dust.velocity *= 0.8f;
1114 dust.velocity.X += (float)Main.rand.Next(-10, 11) * 0.005f;
1115 dust.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.005f;
1116 if (Main.rand.Next(10) == 10)
1117 {
1118 int num63 =
NewDust(dust.position, 4, 4, dust.type);
1119 Main.dust[num63].noGravity = true;
1120 Main.dust[num63].scale = dust.scale;
1121 }
1122 }
1123 }
1124 else if (dust.type == 304)
1125 {
1126 dust.velocity.Y = (float)
Math.
Sin(dust.rotation) / 5f;
1127 dust.rotation += 0.015f;
1128 if (dust.scale < 1.15f)
1129 {
1130 dust.alpha =
Math.
Max(0, dust.alpha - 20);
1131 dust.scale += 0.0015f;
1132 }
1133 else
1134 {
1135 dust.alpha += 6;
1136 if (dust.alpha >= 255)
1137 {
1138 dust.active = false;
1139 }
1140 }
1141 if (dust.customData != null && dust.customData is Player)
1142 {
1144 float num64 = Utils.Remap(dust.scale, 1f, 1.05f, 1f, 0f);
1145 if (num64 > 0f)
1146 {
1147 dust.position += player6.velocity * num64;
1148 }
1149 float num65 = player6.Center.X - dust.position.X;
1151 {
1152 float value = num65 * 0.01f;
1154 }
1155 }
1156 }
1157 else if (dust.type == 184)
1158 {
1159 if (!dust.noGravity)
1160 {
1161 dust.velocity *= 0f;
1162 dust.scale -= 0.01f;
1163 }
1164 }
1165 else if (dust.type == 160 || dust.type == 162)
1166 {
1167 float num66 = dust.scale * 1.3f;
1168 if (num66 > 1f)
1169 {
1170 num66 = 1f;
1171 }
1172 if (dust.type == 162)
1173 {
1174 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num66, num66 * 0.7f, num66 * 0.1f);
1175 }
1176 else
1177 {
1178 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num66 * 0.1f, num66, num66);
1179 }
1180 if (dust.noGravity)
1181 {
1182 dust.velocity *= 0.8f;
1183 dust.velocity.X += (float)Main.rand.Next(-20, 21) * 0.04f;
1184 dust.velocity.Y += (float)Main.rand.Next(-20, 21) * 0.04f;
1185 dust.scale -= 0.1f;
1186 }
1187 else
1188 {
1189 dust.scale -= 0.1f;
1190 dust.velocity.X += (float)Main.rand.Next(-10, 11) * 0.02f;
1191 dust.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.02f;
1192 if ((double)dust.scale > 0.3 && Main.rand.Next(50) == 0)
1193 {
1194 int num67 =
NewDust(
new Vector2(dust.position.X - 4f, dust.position.Y - 4f), 1, 1, dust.type);
1195 Main.dust[num67].noGravity = true;
1196 Main.dust[num67].scale = dust.scale * 1.5f;
1197 }
1198 }
1199 }
1200 else if (dust.type == 168)
1201 {
1202 float num68 = dust.scale * 0.8f;
1203 if ((double)num68 > 0.55)
1204 {
1205 num68 = 0.55f;
1206 }
1207 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num68, 0f, num68 * 0.8f);
1208 dust.scale += 0.03f;
1209 dust.velocity.X += (float)Main.rand.Next(-10, 11) * 0.02f;
1210 dust.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.02f;
1211 dust.velocity *= 0.99f;
1212 }
1213 else if (dust.type >= 139 && dust.type < 143)
1214 {
1215 dust.velocity.X *= 0.98f;
1216 dust.velocity.Y *= 0.98f;
1217 if (dust.velocity.Y < 1f)
1218 {
1219 dust.velocity.Y += 0.05f;
1220 }
1221 dust.scale += 0.009f;
1222 dust.rotation -= dust.velocity.X * 0.4f;
1223 if (dust.velocity.X > 0f)
1224 {
1225 dust.rotation += 0.005f;
1226 }
1227 else
1228 {
1229 dust.rotation -= 0.005f;
1230 }
1231 }
1232 else if (dust.type == 14 || dust.type == 16 || dust.type == 31 || dust.type == 46 || dust.type == 124 || dust.type == 186 || dust.type == 188 || dust.type == 303)
1233 {
1234 dust.velocity.Y *= 0.98f;
1235 dust.velocity.X *= 0.98f;
1236 if (dust.type == 31)
1237 {
1238 if (dust.customData != null && dust.customData is float)
1239 {
1240 float num69 = (float)dust.customData;
1241 dust.velocity.Y += num69;
1242 }
1243 if (dust.customData != null && dust.customData is NPC)
1244 {
1245 NPC nPC2 = (
NPC)dust.customData;
1246 dust.position += nPC2.position - nPC2.oldPosition;
1247 if (dust.noGravity)
1248 {
1249 dust.velocity *= 1.02f;
1250 }
1251 dust.alpha -= 70;
1252 if (dust.alpha < 0)
1253 {
1254 dust.alpha = 0;
1255 }
1256 dust.scale *= 0.97f;
1257 if (dust.scale <= 0.01f)
1258 {
1259 dust.scale = 0.0001f;
1260 dust.alpha = 255;
1261 }
1262 }
1263 else if (dust.noGravity)
1264 {
1265 dust.velocity *= 1.02f;
1266 dust.scale += 0.02f;
1267 dust.alpha += 4;
1268 if (dust.alpha > 255)
1269 {
1270 dust.scale = 0.0001f;
1271 dust.alpha = 255;
1272 }
1273 }
1274 }
1275 if (dust.type == 303 && dust.noGravity)
1276 {
1277 dust.velocity *= 1.02f;
1278 dust.scale += 0.03f;
1279 if (dust.alpha < 90)
1280 {
1281 dust.alpha = 90;
1282 }
1283 dust.alpha += 4;
1284 if (dust.alpha > 255)
1285 {
1286 dust.scale = 0.0001f;
1287 dust.alpha = 255;
1288 }
1289 }
1290 }
1291 else if (dust.type == 32)
1292 {
1293 dust.scale -= 0.01f;
1294 dust.velocity.X *= 0.96f;
1295 if (!dust.noGravity)
1296 {
1297 dust.velocity.Y += 0.1f;
1298 }
1299 }
1300 else if (dust.type >= 244 && dust.type <= 247)
1301 {
1302 dust.rotation += 0.1f * dust.scale;
1303 Color color = Lighting.GetColor((
int)(dust.position.X / 16f), (
int)(dust.position.Y / 16f));
1305 float num71 = ((float)(int)num70 / 270f + 1f) / 2f;
1306 float num72 = ((float)(int)num70 / 270f + 1f) / 2f;
1307 float num73 = ((float)(int)num70 / 270f + 1f) / 2f;
1308 num71 *= dust.scale * 0.9f;
1309 num72 *= dust.scale * 0.9f;
1310 num73 *= dust.scale * 0.9f;
1311 if (dust.alpha < 255)
1312 {
1313 dust.scale += 0.09f;
1314 if (dust.scale >= 1f)
1315 {
1316 dust.scale = 1f;
1317 dust.alpha = 255;
1318 }
1319 }
1320 else
1321 {
1322 if ((double)dust.scale < 0.8)
1323 {
1324 dust.scale -= 0.01f;
1325 }
1326 if ((double)dust.scale < 0.5)
1327 {
1328 dust.scale -= 0.01f;
1329 }
1330 }
1331 float num74 = 1f;
1332 if (dust.type == 244)
1333 {
1334 num71 *= 0.8862745f;
1335 num72 *= 0.4627451f;
1336 num73 *= 0.29803923f;
1337 num74 = 0.9f;
1338 }
1339 else if (dust.type == 245)
1340 {
1341 num71 *= 0.5137255f;
1342 num72 *= 0.6745098f;
1343 num73 *= 0.6784314f;
1344 num74 = 1f;
1345 }
1346 else if (dust.type == 246)
1347 {
1348 num71 *= 0.8f;
1349 num72 *= 0.70980394f;
1350 num73 *= 24f / 85f;
1351 num74 = 1.1f;
1352 }
1353 else if (dust.type == 247)
1354 {
1355 num71 *= 0.6f;
1356 num72 *= 0.6745098f;
1357 num73 *= 37f / 51f;
1358 num74 = 1.2f;
1359 }
1360 num71 *= num74;
1361 num72 *= num74;
1362 num73 *= num74;
1363 if (!dust.noLightEmittence)
1364 {
1365 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num71, num72, num73);
1366 }
1367 }
1368 else if (dust.type == 43)
1369 {
1370 dust.rotation += 0.1f * dust.scale;
1371 Color color2 = Lighting.GetColor((
int)(dust.position.X / 16f), (
int)(dust.position.Y / 16f));
1372 float num75 = (float)(int)color2.R / 270f;
1373 float num76 = (float)(int)color2.G / 270f;
1374 float num77 = (float)(int)color2.B / 270f;
1375 float num78 = (float)(int)dust.color.R / 255f;
1376 float num79 = (float)(int)dust.color.G / 255f;
1377 float num80 = (float)(int)dust.color.B / 255f;
1378 num75 *= dust.scale * 1.07f * num78;
1379 num76 *= dust.scale * 1.07f * num79;
1380 num77 *= dust.scale * 1.07f * num80;
1381 if (dust.alpha < 255)
1382 {
1383 dust.scale += 0.09f;
1384 if (dust.scale >= 1f)
1385 {
1386 dust.scale = 1f;
1387 dust.alpha = 255;
1388 }
1389 }
1390 else
1391 {
1392 if ((double)dust.scale < 0.8)
1393 {
1394 dust.scale -= 0.01f;
1395 }
1396 if ((double)dust.scale < 0.5)
1397 {
1398 dust.scale -= 0.01f;
1399 }
1400 }
1401 if ((double)num75 < 0.05 && (double)num76 < 0.05 && (double)num77 < 0.05)
1402 {
1403 dust.active = false;
1404 }
1405 else if (!dust.noLightEmittence)
1406 {
1407 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num75, num76, num77);
1408 }
1409 if (dust.customData != null && dust.customData is Player)
1410 {
1412 dust.position += player7.position - player7.oldPosition;
1413 }
1414 }
1415 else if (dust.type == 15 || dust.type == 57 || dust.type == 58 || dust.type == 274 || dust.type == 292)
1416 {
1417 dust.velocity.Y *= 0.98f;
1418 dust.velocity.X *= 0.98f;
1419 if (!dust.noLightEmittence)
1420 {
1421 float num81 = dust.scale;
1422 if (dust.type != 15)
1423 {
1424 num81 = dust.scale * 0.8f;
1425 }
1426 if (dust.noLight)
1427 {
1428 dust.velocity *= 0.95f;
1429 }
1430 if (num81 > 1f)
1431 {
1432 num81 = 1f;
1433 }
1434 if (dust.type == 15)
1435 {
1436 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num81 * 0.45f, num81 * 0.55f, num81);
1437 }
1438 else if (dust.type == 57)
1439 {
1440 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num81 * 0.95f, num81 * 0.95f, num81 * 0.45f);
1441 }
1442 else if (dust.type == 58)
1443 {
1444 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num81, num81 * 0.55f, num81 * 0.75f);
1445 }
1446 }
1447 }
1448 else if (dust.type == 204)
1449 {
1450 if (dust.fadeIn > dust.scale)
1451 {
1452 dust.scale += 0.02f;
1453 }
1454 else
1455 {
1456 dust.scale -= 0.02f;
1457 }
1458 dust.velocity *= 0.95f;
1459 }
1460 else if (dust.type == 110)
1461 {
1462 float num82 = dust.scale * 0.1f;
1463 if (num82 > 1f)
1464 {
1465 num82 = 1f;
1466 }
1467 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num82 * 0.2f, num82, num82 * 0.5f);
1468 }
1469 else if (dust.type == 111)
1470 {
1471 float num83 = dust.scale * 0.125f;
1472 if (num83 > 1f)
1473 {
1474 num83 = 1f;
1475 }
1476 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num83 * 0.2f, num83 * 0.7f, num83);
1477 }
1478 else if (dust.type == 112)
1479 {
1480 float num84 = dust.scale * 0.1f;
1481 if (num84 > 1f)
1482 {
1483 num84 = 1f;
1484 }
1485 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num84 * 0.8f, num84 * 0.2f, num84 * 0.8f);
1486 }
1487 else if (dust.type == 113)
1488 {
1489 float num85 = dust.scale * 0.1f;
1490 if (num85 > 1f)
1491 {
1492 num85 = 1f;
1493 }
1494 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num85 * 0.2f, num85 * 0.3f, num85 * 1.3f);
1495 }
1496 else if (dust.type == 114)
1497 {
1498 float num86 = dust.scale * 0.1f;
1499 if (num86 > 1f)
1500 {
1501 num86 = 1f;
1502 }
1503 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num86 * 1.2f, num86 * 0.5f, num86 * 0.4f);
1504 }
1505 else if (dust.type == 311)
1506 {
1507 float num87 = dust.scale * 0.1f;
1508 if (num87 > 1f)
1509 {
1510 num87 = 1f;
1511 }
1512 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 16, num87);
1513 }
1514 else if (dust.type == 312)
1515 {
1516 float num88 = dust.scale * 0.1f;
1517 if (num88 > 1f)
1518 {
1519 num88 = 1f;
1520 }
1521 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 9, num88);
1522 }
1523 else if (dust.type == 313)
1524 {
1525 float num89 = dust.scale * 0.25f;
1526 if (num89 > 1f)
1527 {
1528 num89 = 1f;
1529 }
1530 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num89 * 1f, num89 * 0.8f, num89 * 0.6f);
1531 }
1532 else if (dust.type == 66)
1533 {
1534 if (dust.velocity.X < 0f)
1535 {
1536 dust.rotation -= 1f;
1537 }
1538 else
1539 {
1540 dust.rotation += 1f;
1541 }
1542 dust.velocity.Y *= 0.98f;
1543 dust.velocity.X *= 0.98f;
1544 dust.scale += 0.02f;
1545 float num90 = dust.scale;
1546 if (dust.type != 15)
1547 {
1548 num90 = dust.scale * 0.8f;
1549 }
1550 if (num90 > 1f)
1551 {
1552 num90 = 1f;
1553 }
1554 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num90 * ((float)(int)dust.color.R / 255f), num90 * ((float)(int)dust.color.G / 255f), num90 * ((float)(int)dust.color.B / 255f));
1555 }
1556 else if (dust.type == 267)
1557 {
1558 if (dust.velocity.X < 0f)
1559 {
1560 dust.rotation -= 1f;
1561 }
1562 else
1563 {
1564 dust.rotation += 1f;
1565 }
1566 dust.velocity.Y *= 0.98f;
1567 dust.velocity.X *= 0.98f;
1568 dust.scale += 0.02f;
1569 float num91 = dust.scale * 0.8f;
1570 if (num91 > 1f)
1571 {
1572 num91 = 1f;
1573 }
1574 if (dust.noLight)
1575 {
1576 dust.noLight = false;
1577 }
1578 if (!dust.noLight && !dust.noLightEmittence)
1579 {
1580 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num91 * ((float)(int)dust.color.R / 255f), num91 * ((float)(int)dust.color.G / 255f), num91 * ((float)(int)dust.color.B / 255f));
1581 }
1582 }
1583 else if (dust.type == 20 || dust.type == 21 || dust.type == 231)
1584 {
1585 dust.scale += 0.005f;
1586 dust.velocity.Y *= 0.94f;
1587 dust.velocity.X *= 0.94f;
1588 float num92 = dust.scale * 0.8f;
1589 if (num92 > 1f)
1590 {
1591 num92 = 1f;
1592 }
1593 if (dust.type == 21 && !dust.noLightEmittence)
1594 {
1595 num92 = dust.scale * 0.4f;
1596 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num92 * 0.8f, num92 * 0.3f, num92);
1597 }
1598 else if (dust.type == 231)
1599 {
1600 num92 = dust.scale * 0.4f;
1601 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num92, num92 * 0.5f, num92 * 0.3f);
1602 }
1603 else
1604 {
1605 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num92 * 0.3f, num92 * 0.6f, num92);
1606 }
1607 }
1608 else if (dust.type == 27 || dust.type == 45)
1609 {
1610 if (dust.type == 27 && dust.fadeIn >= 100f)
1611 {
1612 if ((double)dust.scale >= 1.5)
1613 {
1614 dust.scale -= 0.01f;
1615 }
1616 else
1617 {
1618 dust.scale -= 0.05f;
1619 }
1620 if ((double)dust.scale <= 0.5)
1621 {
1622 dust.scale -= 0.05f;
1623 }
1624 if ((double)dust.scale <= 0.25)
1625 {
1626 dust.scale -= 0.05f;
1627 }
1628 }
1629 dust.velocity *= 0.94f;
1630 dust.scale += 0.002f;
1631 float num93 = dust.scale;
1632 if (dust.noLight)
1633 {
1634 num93 *= 0.1f;
1635 dust.scale -= 0.06f;
1636 if (dust.scale < 1f)
1637 {
1638 dust.scale -= 0.06f;
1639 }
1640 if (Main.player[Main.myPlayer].wet)
1641 {
1642 dust.position += Main.player[Main.myPlayer].velocity * 0.5f;
1643 }
1644 else
1645 {
1646 dust.position += Main.player[Main.myPlayer].velocity;
1647 }
1648 }
1649 if (num93 > 1f)
1650 {
1651 num93 = 1f;
1652 }
1653 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num93 * 0.6f, num93 * 0.2f, num93);
1654 }
1655 else if (dust.type == 55 || dust.type == 56 || dust.type == 73 || dust.type == 74)
1656 {
1657 dust.velocity *= 0.98f;
1658 if (!dust.noLightEmittence)
1659 {
1660 float num94 = dust.scale * 0.8f;
1661 if (dust.type == 55)
1662 {
1663 if (num94 > 1f)
1664 {
1665 num94 = 1f;
1666 }
1667 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num94, num94, num94 * 0.6f);
1668 }
1669 else if (dust.type == 73)
1670 {
1671 if (num94 > 1f)
1672 {
1673 num94 = 1f;
1674 }
1675 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num94, num94 * 0.35f, num94 * 0.5f);
1676 }
1677 else if (dust.type == 74)
1678 {
1679 if (num94 > 1f)
1680 {
1681 num94 = 1f;
1682 }
1683 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num94 * 0.35f, num94, num94 * 0.5f);
1684 }
1685 else
1686 {
1687 num94 = dust.scale * 1.2f;
1688 if (num94 > 1f)
1689 {
1690 num94 = 1f;
1691 }
1692 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num94 * 0.35f, num94 * 0.5f, num94);
1693 }
1694 }
1695 }
1696 else if (dust.type == 71 || dust.type == 72)
1697 {
1698 dust.velocity *= 0.98f;
1699 float num95 = dust.scale;
1700 if (num95 > 1f)
1701 {
1702 num95 = 1f;
1703 }
1704 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num95 * 0.2f, 0f, num95 * 0.1f);
1705 }
1706 else if (dust.type == 76)
1707 {
1708 Main.snowDust++;
1709 dust.scale += 0.009f;
1710 float y = Main.player[Main.myPlayer].velocity.Y;
1711 if (y > 0f && dust.fadeIn == 0f && dust.velocity.Y < y)
1712 {
1714 }
1715 if (!dust.noLight && y > 0f)
1716 {
1717 dust.position.Y += Main.player[Main.myPlayer].velocity.Y * 0.2f;
1718 }
1719 if (Collision.SolidCollision(dust.position -
Vector2.
One * 5f, 10, 10) && dust.fadeIn == 0f)
1720 {
1721 dust.scale *= 0.9f;
1722 dust.velocity *= 0.25f;
1723 }
1724 }
1725 else if (dust.type == 270)
1726 {
1727 dust.velocity *= 1.0050251f;
1728 dust.scale += 0.01f;
1729 dust.rotation = 0f;
1730 if (Collision.SolidCollision(dust.position -
Vector2.
One * 5f, 10, 10) && dust.fadeIn == 0f)
1731 {
1732 dust.scale *= 0.95f;
1733 dust.velocity *= 0.25f;
1734 }
1735 else
1736 {
1737 dust.velocity.Y = (float)
Math.
Sin(dust.position.X * 0.0043982295f) * 2f;
1738 dust.velocity.Y -= 3f;
1739 dust.velocity.Y /= 20f;
1740 }
1741 }
1742 else if (dust.type == 271)
1743 {
1744 dust.velocity *= 1.0050251f;
1745 dust.scale += 0.003f;
1746 dust.rotation = 0f;
1747 dust.velocity.Y -= 4f;
1748 dust.velocity.Y /= 6f;
1749 }
1750 else if (dust.type == 268)
1751 {
1753 dust.velocity *= 1.0050251f;
1754 dust.scale += 0.01f;
1755 if (!flag)
1756 {
1757 dust.scale -= 0.05f;
1758 }
1759 dust.rotation = 0f;
1760 float y2 = Main.player[Main.myPlayer].velocity.Y;
1761 if (y2 > 0f && dust.fadeIn == 0f && dust.velocity.Y < y2)
1762 {
1764 }
1765 if (!dust.noLight && y2 > 0f)
1766 {
1767 dust.position.Y += y2 * 0.2f;
1768 }
1769 if (Collision.SolidCollision(dust.position -
Vector2.
One * 5f, 10, 10) && dust.fadeIn == 0f)
1770 {
1771 dust.scale *= 0.9f;
1772 dust.velocity *= 0.25f;
1773 }
1774 else
1775 {
1776 dust.velocity.Y = (float)
Math.
Sin(dust.position.X * 0.0043982295f) * 2f;
1777 dust.velocity.Y += 3f;
1778 }
1779 }
1780 else if (!dust.noGravity && dust.type != 41 && dust.type != 44 && dust.type != 309)
1781 {
1782 if (dust.type == 107)
1783 {
1784 dust.velocity *= 0.9f;
1785 }
1786 else
1787 {
1788 dust.velocity.Y += 0.1f;
1789 }
1790 }
1791 if (dust.type == 5 || (dust.type == 273 && dust.noGravity))
1792 {
1793 dust.scale -= 0.04f;
1794 }
1795 if (dust.type == 308 || dust.type == 33 || dust.type == 52 || dust.type == 266 || dust.type == 98 || dust.type == 99 || dust.type == 100 || dust.type == 101 || dust.type == 102 || dust.type == 103 || dust.type == 104 || dust.type == 105 || dust.type == 123 || dust.type == 288)
1796 {
1797 if (dust.velocity.X == 0f)
1798 {
1799 if (Collision.SolidCollision(dust.position, 2, 2))
1800 {
1801 dust.scale = 0f;
1802 }
1803 dust.rotation += 0.5f;
1804 dust.scale -= 0.01f;
1805 }
1806 if (Collision.WetCollision(
new Vector2(dust.position.X, dust.position.Y), 4, 4))
1807 {
1808 dust.alpha += 20;
1809 dust.scale -= 0.1f;
1810 }
1811 dust.alpha += 2;
1812 dust.scale -= 0.005f;
1813 if (dust.alpha > 255)
1814 {
1815 dust.scale = 0f;
1816 }
1817 if (dust.velocity.Y > 4f)
1818 {
1819 dust.velocity.Y = 4f;
1820 }
1821 if (dust.noGravity)
1822 {
1823 if (dust.velocity.X < 0f)
1824 {
1825 dust.rotation -= 0.2f;
1826 }
1827 else
1828 {
1829 dust.rotation += 0.2f;
1830 }
1831 dust.scale += 0.03f;
1832 dust.velocity.X *= 1.05f;
1833 dust.velocity.Y += 0.15f;
1834 }
1835 }
1836 if (dust.type == 35 && dust.noGravity)
1837 {
1838 dust.scale += 0.03f;
1839 if (dust.scale < 1f)
1840 {
1841 dust.velocity.Y += 0.075f;
1842 }
1843 dust.velocity.X *= 1.08f;
1844 if (dust.velocity.X > 0f)
1845 {
1846 dust.rotation += 0.01f;
1847 }
1848 else
1849 {
1850 dust.rotation -= 0.01f;
1851 }
1852 float num96 = dust.scale * 0.6f;
1853 if (num96 > 1f)
1854 {
1855 num96 = 1f;
1856 }
1857 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f + 1f), num96, num96 * 0.3f, num96 * 0.1f);
1858 }
1859 else if (dust.type == 152 && dust.noGravity)
1860 {
1861 dust.scale += 0.03f;
1862 if (dust.scale < 1f)
1863 {
1864 dust.velocity.Y += 0.075f;
1865 }
1866 dust.velocity.X *= 1.08f;
1867 if (dust.velocity.X > 0f)
1868 {
1869 dust.rotation += 0.01f;
1870 }
1871 else
1872 {
1873 dust.rotation -= 0.01f;
1874 }
1875 }
1876 else if (dust.type == 67 || dust.type == 92)
1877 {
1878 float num97 = dust.scale;
1879 if (num97 > 1f)
1880 {
1881 num97 = 1f;
1882 }
1883 if (dust.noLight)
1884 {
1885 num97 *= 0.1f;
1886 }
1887 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), 0f, num97 * 0.8f, num97);
1888 }
1889 else if (dust.type == 185)
1890 {
1891 float num98 = dust.scale;
1892 if (num98 > 1f)
1893 {
1894 num98 = 1f;
1895 }
1896 if (dust.noLight)
1897 {
1898 num98 *= 0.1f;
1899 }
1900 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num98 * 0.1f, num98 * 0.7f, num98);
1901 }
1902 else if (dust.type == 107)
1903 {
1904 float num99 = dust.scale * 0.5f;
1905 if (num99 > 1f)
1906 {
1907 num99 = 1f;
1908 }
1909 if (!dust.noLightEmittence)
1910 {
1911 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num99 * 0.1f, num99, num99 * 0.4f);
1912 }
1913 }
1914 else if (dust.type == 34 || dust.type == 35 || dust.type == 152)
1915 {
1916 if (!Collision.WetCollision(
new Vector2(dust.position.X, dust.position.Y - 8f), 4, 4))
1917 {
1918 dust.scale = 0f;
1919 }
1920 else
1921 {
1922 dust.alpha += Main.rand.Next(2);
1923 if (dust.alpha > 255)
1924 {
1925 dust.scale = 0f;
1926 }
1927 dust.velocity.Y = -0.5f;
1928 if (dust.type == 34)
1929 {
1930 dust.scale += 0.005f;
1931 }
1932 else
1933 {
1934 dust.alpha++;
1935 dust.scale -= 0.01f;
1936 dust.velocity.Y = -0.2f;
1937 }
1938 dust.velocity.X += (float)Main.rand.Next(-10, 10) * 0.002f;
1939 if ((double)dust.velocity.X < -0.25)
1940 {
1941 dust.velocity.X = -0.25f;
1942 }
1943 if ((double)dust.velocity.X > 0.25)
1944 {
1945 dust.velocity.X = 0.25f;
1946 }
1947 }
1948 if (dust.type == 35)
1949 {
1950 float num100 = dust.scale * 0.3f + 0.4f;
1951 if (num100 > 1f)
1952 {
1953 num100 = 1f;
1954 }
1955 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num100, num100 * 0.5f, num100 * 0.3f);
1956 }
1957 }
1958 if (dust.type == 68)
1959 {
1960 float num101 = dust.scale * 0.3f;
1961 if (num101 > 1f)
1962 {
1963 num101 = 1f;
1964 }
1965 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num101 * 0.1f, num101 * 0.2f, num101);
1966 }
1967 if (dust.type == 70)
1968 {
1969 float num102 = dust.scale * 0.3f;
1970 if (num102 > 1f)
1971 {
1972 num102 = 1f;
1973 }
1974 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num102 * 0.5f, 0f, num102);
1975 }
1976 if (dust.type == 41)
1977 {
1978 dust.velocity.X += (float)Main.rand.Next(-10, 11) * 0.01f;
1979 dust.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.01f;
1980 if ((double)dust.velocity.X > 0.75)
1981 {
1982 dust.velocity.X = 0.75f;
1983 }
1984 if ((double)dust.velocity.X < -0.75)
1985 {
1986 dust.velocity.X = -0.75f;
1987 }
1988 if ((double)dust.velocity.Y > 0.75)
1989 {
1990 dust.velocity.Y = 0.75f;
1991 }
1992 if ((double)dust.velocity.Y < -0.75)
1993 {
1994 dust.velocity.Y = -0.75f;
1995 }
1996 dust.scale += 0.007f;
1997 float num103 = dust.scale * 0.7f;
1998 if (num103 > 1f)
1999 {
2000 num103 = 1f;
2001 }
2002 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num103 * 0.4f, num103 * 0.9f, num103);
2003 }
2004 else if (dust.type == 44)
2005 {
2006 dust.velocity.X += (float)Main.rand.Next(-10, 11) * 0.003f;
2007 dust.velocity.Y += (float)Main.rand.Next(-10, 11) * 0.003f;
2008 if ((double)dust.velocity.X > 0.35)
2009 {
2010 dust.velocity.X = 0.35f;
2011 }
2012 if ((double)dust.velocity.X < -0.35)
2013 {
2014 dust.velocity.X = -0.35f;
2015 }
2016 if ((double)dust.velocity.Y > 0.35)
2017 {
2018 dust.velocity.Y = 0.35f;
2019 }
2020 if ((double)dust.velocity.Y < -0.35)
2021 {
2022 dust.velocity.Y = -0.35f;
2023 }
2024 dust.scale += 0.0085f;
2025 float num104 = dust.scale * 0.7f;
2026 if (num104 > 1f)
2027 {
2028 num104 = 1f;
2029 }
2030 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num104 * 0.7f, num104, num104 * 0.8f);
2031 }
2032 else if (dust.type != 304)
2033 {
2034 dust.velocity.X *= 0.99f;
2035 }
2036 if (dust.type == 322 && !dust.noGravity)
2037 {
2038 dust.scale *= 0.98f;
2039 }
2040 if (dust.type != 79 && dust.type != 268 && dust.type != 304)
2041 {
2042 dust.rotation += dust.velocity.X * 0.5f;
2043 }
2044 if (dust.fadeIn > 0f && dust.fadeIn < 100f)
2045 {
2046 if (dust.type == 235)
2047 {
2048 dust.scale += 0.007f;
2049 int num105 = (int)dust.fadeIn - 1;
2050 if (num105 >= 0 && num105 <= 255)
2051 {
2052 Vector2 vector6 = dust.position - Main.player[num105].Center;
2053 float num106 = vector6.
Length();
2054 num106 = 100f - num106;
2055 if (num106 > 0f)
2056 {
2057 dust.scale -= num106 * 0.0015f;
2058 }
2060 float num107 = (1f - dust.scale) * 20f;
2061 vector6 *= 0f - num107;
2062 dust.velocity = (dust.velocity * 4f + vector6) / 5f;
2063 }
2064 }
2065 else if (dust.type == 46)
2066 {
2067 dust.scale += 0.1f;
2068 }
2069 else if (dust.type == 213 || dust.type == 260)
2070 {
2071 dust.scale += 0.1f;
2072 }
2073 else
2074 {
2075 dust.scale += 0.03f;
2076 }
2077 if (dust.scale > dust.fadeIn)
2078 {
2079 dust.fadeIn = 0f;
2080 }
2081 }
2082 else if (dust.type != 304)
2083 {
2084 if (dust.type == 213 || dust.type == 260)
2085 {
2086 dust.scale -= 0.2f;
2087 }
2088 else
2089 {
2090 dust.scale -= 0.01f;
2091 }
2092 }
2093 if (dust.type >= 130 && dust.type <= 134)
2094 {
2095 float num108 = dust.scale;
2096 if (num108 > 1f)
2097 {
2098 num108 = 1f;
2099 }
2100 if (dust.type == 130)
2101 {
2102 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num108 * 1f, num108 * 0.5f, num108 * 0.4f);
2103 }
2104 if (dust.type == 131)
2105 {
2106 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num108 * 0.4f, num108 * 1f, num108 * 0.6f);
2107 }
2108 if (dust.type == 132)
2109 {
2110 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num108 * 0.3f, num108 * 0.5f, num108 * 1f);
2111 }
2112 if (dust.type == 133)
2113 {
2114 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num108 * 0.9f, num108 * 0.9f, num108 * 0.3f);
2115 }
2116 if (dust.noGravity)
2117 {
2118 dust.velocity *= 0.93f;
2119 if (dust.fadeIn == 0f)
2120 {
2121 dust.scale += 0.0025f;
2122 }
2123 }
2124 else if (dust.type == 131)
2125 {
2126 dust.velocity *= 0.98f;
2127 dust.velocity.Y -= 0.1f;
2128 dust.scale += 0.0025f;
2129 }
2130 else
2131 {
2132 dust.velocity *= 0.95f;
2133 dust.scale -= 0.0025f;
2134 }
2135 }
2136 else if (dust.type == 278)
2137 {
2138 float num109 = dust.scale;
2139 if (num109 > 1f)
2140 {
2141 num109 = 1f;
2142 }
2143 if (!dust.noLight && !dust.noLightEmittence)
2144 {
2145 Lighting.AddLight(dust.position, dust.color.ToVector3() * num109);
2146 }
2147 if (dust.noGravity)
2148 {
2149 dust.velocity *= 0.93f;
2150 if (dust.fadeIn == 0f)
2151 {
2152 dust.scale += 0.0025f;
2153 }
2154 }
2155 else
2156 {
2157 dust.velocity *= 0.95f;
2158 dust.scale -= 0.0025f;
2159 }
2160 if (
WorldGen.SolidTile(Framing.GetTileSafely(dust.position)) && dust.fadeIn == 0f && !dust.noGravity)
2161 {
2162 dust.scale *= 0.9f;
2163 dust.velocity *= 0.25f;
2164 }
2165 }
2166 else if (dust.type >= 219 && dust.type <= 223)
2167 {
2168 float num110 = dust.scale;
2169 if (num110 > 1f)
2170 {
2171 num110 = 1f;
2172 }
2173 if (!dust.noLight)
2174 {
2175 if (dust.type == 219)
2176 {
2177 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num110 * 1f, num110 * 0.5f, num110 * 0.4f);
2178 }
2179 if (dust.type == 220)
2180 {
2181 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num110 * 0.4f, num110 * 1f, num110 * 0.6f);
2182 }
2183 if (dust.type == 221)
2184 {
2185 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num110 * 0.3f, num110 * 0.5f, num110 * 1f);
2186 }
2187 if (dust.type == 222)
2188 {
2189 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num110 * 0.9f, num110 * 0.9f, num110 * 0.3f);
2190 }
2191 }
2192 if (dust.noGravity)
2193 {
2194 dust.velocity *= 0.93f;
2195 if (dust.fadeIn == 0f)
2196 {
2197 dust.scale += 0.0025f;
2198 }
2199 }
2200 dust.velocity *=
new Vector2(0.97f, 0.99f);
2201 dust.scale -= 0.0025f;
2202 if (dust.customData != null && dust.customData is Player)
2203 {
2205 dust.position += player8.position - player8.oldPosition;
2206 }
2207 }
2208 else if (dust.type == 226)
2209 {
2210 float num111 = dust.scale;
2211 if (num111 > 1f)
2212 {
2213 num111 = 1f;
2214 }
2215 if (!dust.noLight)
2216 {
2217 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num111 * 0.2f, num111 * 0.7f, num111 * 1f);
2218 }
2219 if (dust.noGravity)
2220 {
2221 dust.velocity *= 0.93f;
2222 if (dust.fadeIn == 0f)
2223 {
2224 dust.scale += 0.0025f;
2225 }
2226 }
2227 dust.velocity *=
new Vector2(0.97f, 0.99f);
2228 if (dust.customData != null && dust.customData is Player)
2229 {
2231 dust.position += player9.position - player9.oldPosition;
2232 }
2233 dust.scale -= 0.01f;
2234 }
2235 else if (dust.type == 272)
2236 {
2237 float num112 = dust.scale;
2238 if (num112 > 1f)
2239 {
2240 num112 = 1f;
2241 }
2242 if (!dust.noLight)
2243 {
2244 Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num112 * 0.5f, num112 * 0.2f, num112 * 0.8f);
2245 }
2246 if (dust.noGravity)
2247 {
2248 dust.velocity *= 0.93f;
2249 if (dust.fadeIn == 0f)
2250 {
2251 dust.scale += 0.0025f;
2252 }
2253 }
2254 dust.velocity *=
new Vector2(0.97f, 0.99f);
2255 if (dust.customData != null && dust.customData is Player)
2256 {
2258 dust.position += player10.position - player10.oldPosition;
2259 }
2260 if (dust.customData != null && dust.customData is NPC)
2261 {
2262 NPC nPC3 = (
NPC)dust.customData;
2263 dust.position += nPC3.position - nPC3.oldPosition;
2264 }
2265 dust.scale -= 0.01f;
2266 }
2267 else if (dust.type != 304 && dust.noGravity)
2268 {
2269 dust.velocity *= 0.92f;
2270 if (dust.fadeIn == 0f)
2271 {
2272 dust.scale -= 0.04f;
2273 }
2274 }
2275 if (dust.position.Y > Main.screenPosition.Y + (float)Main.screenHeight)
2276 {
2277 dust.active = false;
2278 }
2279 float num113 = 0.1f;
2280 if ((
double)
dCount == 0.5)
2281 {
2282 dust.scale -= 0.001f;
2283 }
2284 if ((
double)
dCount == 0.6)
2285 {
2286 dust.scale -= 0.0025f;
2287 }
2288 if ((
double)
dCount == 0.7)
2289 {
2290 dust.scale -= 0.005f;
2291 }
2292 if ((
double)
dCount == 0.8)
2293 {
2294 dust.scale -= 0.01f;
2295 }
2296 if ((
double)
dCount == 0.9)
2297 {
2298 dust.scale -= 0.02f;
2299 }
2300 if ((
double)
dCount == 0.5)
2301 {
2302 num113 = 0.11f;
2303 }
2304 if ((
double)
dCount == 0.6)
2305 {
2306 num113 = 0.13f;
2307 }
2308 if ((
double)
dCount == 0.7)
2309 {
2310 num113 = 0.16f;
2311 }
2312 if ((
double)
dCount == 0.8)
2313 {
2314 num113 = 0.22f;
2315 }
2316 if ((
double)
dCount == 0.9)
2317 {
2318 num113 = 0.25f;
2319 }
2320 if (dust.scale < num113)
2321 {
2322 dust.active = false;
2323 }
2324 }
2325 else
2326 {
2327 dust.active = false;
2328 }
2329 }
2330 int num114 = num;
2331 if ((double)num114 > (double)Main.maxDustToDraw * 0.9)
2332 {
2334 }
2335 else if ((double)num114 > (double)Main.maxDustToDraw * 0.8)
2336 {
2338 }
2339 else if ((double)num114 > (double)Main.maxDustToDraw * 0.7)
2340 {
2342 }
2343 else if ((double)num114 > (double)Main.maxDustToDraw * 0.6)
2344 {
2346 }
2347 else if ((double)num114 > (double)Main.maxDustToDraw * 0.5)
2348 {
2350 }
2351 else
2352 {
2354 }
2355 }
static float Lerp(float value1, float value2, float amount)
static byte Min(byte val1, byte val2)
static double Abs(double value)
static double Sin(double a)
static int Sign(decimal value)
static byte Max(byte val1, byte val2)
static int SandStormCount
static int NewDust(Vector2 Position, int Width, int Height, int Type, float SpeedX=0f, float SpeedY=0f, int Alpha=0, Color newColor=default(Color), float Scale=1f)
static bool DangerousDust(int id)
static bool ShouldSandstormDustPersist()