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

◆ DoColors()

void Terraria.Graphics.Light.LegacyLighting.DoColors ( )
inlineprivate

Definition at line 844 of file LegacyLighting.cs.

845 {
846 //IL_09bf: Unknown result type (might be due to invalid IL or missing references)
847 //IL_09c6: Expected O, but got Unknown
848 //IL_09cf: Unknown result type (might be due to invalid IL or missing references)
849 //IL_09d6: Expected O, but got Unknown
850 //IL_09df: Unknown result type (might be due to invalid IL or missing references)
851 //IL_09e6: Expected O, but got Unknown
852 //IL_09ef: Unknown result type (might be due to invalid IL or missing references)
853 //IL_09f6: Expected O, but got Unknown
854 //IL_09ff: Unknown result type (might be due to invalid IL or missing references)
855 //IL_0a06: Expected O, but got Unknown
857 {
858 _blueWave += (float)_blueDir * 0.0001f;
859 if (_blueWave > 1f)
860 {
861 _blueWave = 1f;
862 _blueDir = -1;
863 }
864 else if (_blueWave < 0.97f)
865 {
866 _blueWave = 0.97f;
867 _blueDir = 1;
868 }
869 if (_rgb)
870 {
871 _negLight = 0.91f;
872 _negLight2 = 0.56f;
874 _honeyLightR = 0.75f * _negLight * _blueWave;
876 switch (Main.waterStyle)
877 {
878 case 0:
879 case 1:
880 case 7:
881 case 8:
882 _wetLightG = 0.96f * _negLight * _blueWave;
883 _wetLightR = 0.88f * _negLight * _blueWave;
884 _wetLightB = 1.015f * _negLight * _blueWave;
885 break;
886 case 2:
887 _wetLightG = 0.85f * _negLight * _blueWave;
888 _wetLightR = 0.94f * _negLight * _blueWave;
889 _wetLightB = 1.01f * _negLight * _blueWave;
890 break;
891 case 3:
892 _wetLightG = 0.95f * _negLight * _blueWave;
893 _wetLightR = 0.84f * _negLight * _blueWave;
894 _wetLightB = 1.015f * _negLight * _blueWave;
895 break;
896 case 4:
897 _wetLightG = 0.86f * _negLight * _blueWave;
898 _wetLightR = 0.9f * _negLight * _blueWave;
899 _wetLightB = 1.01f * _negLight * _blueWave;
900 break;
901 case 5:
902 _wetLightG = 0.99f * _negLight * _blueWave;
903 _wetLightR = 0.84f * _negLight * _blueWave;
904 _wetLightB = 1.01f * _negLight * _blueWave;
905 break;
906 case 6:
907 _wetLightR = 0.83f * _negLight * _blueWave;
908 _wetLightG = 0.93f * _negLight * _blueWave;
909 _wetLightB = 0.98f * _negLight * _blueWave;
910 break;
911 case 9:
912 _wetLightG = 0.88f * _negLight * _blueWave;
914 _wetLightB = 0.84f * _negLight * _blueWave;
915 break;
916 case 10:
918 _wetLightR = 0.83f * _negLight * _blueWave;
920 break;
921 case 12:
922 _wetLightG = 0.98f * _negLight * _blueWave;
923 _wetLightR = 0.95f * _negLight * _blueWave;
924 _wetLightB = 0.85f * _negLight * _blueWave;
925 break;
926 default:
927 _wetLightG = 0f;
928 _wetLightR = 0f;
929 _wetLightB = 0f;
930 break;
931 }
932 }
933 else
934 {
935 _negLight = 0.9f;
936 _negLight2 = 0.54f;
937 _wetLightR = 0.95f * _negLight * _blueWave;
938 }
939 if (Main.player[Main.myPlayer].nightVision)
940 {
941 _negLight *= 1.03f;
942 _negLight2 *= 1.03f;
943 }
944 if (Main.player[Main.myPlayer].blind)
945 {
946 _negLight *= 0.95f;
947 _negLight2 *= 0.95f;
948 }
949 if (Main.player[Main.myPlayer].blackout)
950 {
951 _negLight *= 0.85f;
952 _negLight2 *= 0.85f;
953 }
954 if (Main.player[Main.myPlayer].headcovered)
955 {
956 _negLight *= 0.85f;
957 _negLight2 *= 0.85f;
958 }
959 }
960 else
961 {
962 _negLight = 0.04f;
963 _negLight2 = 0.16f;
964 if (Main.player[Main.myPlayer].nightVision)
965 {
966 _negLight -= 0.013f;
967 _negLight2 -= 0.04f;
968 }
969 if (Main.player[Main.myPlayer].blind)
970 {
971 _negLight += 0.03f;
972 _negLight2 += 0.06f;
973 }
974 if (Main.player[Main.myPlayer].blackout)
975 {
976 _negLight += 0.09f;
977 _negLight2 += 0.18f;
978 }
979 if (Main.player[Main.myPlayer].headcovered)
980 {
981 _negLight += 0.09f;
982 _negLight2 += 0.18f;
983 }
984 _wetLightR = _negLight * 1.2f;
985 _wetLightG = _negLight * 1.1f;
986 }
987 int num;
988 int num2;
989 switch (Main.renderCount)
990 {
991 case 0:
992 num = 0;
993 num2 = 1;
994 break;
995 case 1:
996 num = 1;
997 num2 = 3;
998 break;
999 case 2:
1000 num = 3;
1001 num2 = 4;
1002 break;
1003 default:
1004 num = 0;
1005 num2 = 0;
1006 break;
1007 }
1009 int left = _expandedArea.Left;
1010 int top = _expandedArea.Top;
1011 for (int i = num; i < num2; i++)
1012 {
1013 stopwatch.Restart();
1014 int num3 = 0;
1015 int num4 = 0;
1016 switch (i)
1017 {
1018 case 0:
1019 _swipe.InnerLoop1Start = _minBoundArea.Top - top;
1020 _swipe.InnerLoop2Start = _minBoundArea.Bottom - top;
1021 _swipe.InnerLoop1End = _requestedArea.Bottom + RenderPhases - top;
1022 _swipe.InnerLoop2End = _requestedArea.Top - RenderPhases - top;
1023 num3 = _minBoundArea.Left - left;
1024 num4 = _minBoundArea.Right - left;
1025 _swipe.JaggedArray = _states;
1026 break;
1027 case 1:
1028 _swipe.InnerLoop1Start = _expandedArea.Left - left;
1029 _swipe.InnerLoop2Start = _expandedArea.Right - left;
1030 _swipe.InnerLoop1End = _requestedArea.Right + RenderPhases - left;
1031 _swipe.InnerLoop2End = _requestedArea.Left - RenderPhases - left;
1032 num3 = _expandedArea.Top - top;
1033 num4 = _expandedArea.Bottom - top;
1034 _swipe.JaggedArray = _axisFlipStates;
1035 break;
1036 case 2:
1037 _swipe.InnerLoop1Start = _offScreenTiles2ExpandedArea.Top - top;
1038 _swipe.InnerLoop2Start = _offScreenTiles2ExpandedArea.Bottom - top;
1039 _swipe.InnerLoop1End = _requestedArea.Bottom + RenderPhases - top;
1040 _swipe.InnerLoop2End = _requestedArea.Top - RenderPhases - top;
1041 num3 = _offScreenTiles2ExpandedArea.Left - left;
1042 num4 = _offScreenTiles2ExpandedArea.Right - left;
1043 _swipe.JaggedArray = _states;
1044 break;
1045 case 3:
1046 _swipe.InnerLoop1Start = _offScreenTiles2ExpandedArea.Left - left;
1047 _swipe.InnerLoop2Start = _offScreenTiles2ExpandedArea.Right - left;
1048 _swipe.InnerLoop1End = _requestedArea.Right + RenderPhases - left;
1049 _swipe.InnerLoop2End = _requestedArea.Left - RenderPhases - left;
1050 num3 = _offScreenTiles2ExpandedArea.Top - top;
1051 num4 = _offScreenTiles2ExpandedArea.Bottom - top;
1052 _swipe.JaggedArray = _axisFlipStates;
1053 break;
1054 }
1056 {
1057 _swipe.InnerLoop1Start = _swipe.InnerLoop1End;
1058 }
1060 {
1061 _swipe.InnerLoop2Start = _swipe.InnerLoop2End;
1062 }
1063 if (num3 > num4)
1064 {
1065 num3 = num4;
1066 }
1068 {
1069 0 => (object)new ParallelForAction(doColors_Mode0_Swipe),
1070 1 => (object)new ParallelForAction(doColors_Mode1_Swipe),
1071 2 => (object)new ParallelForAction(doColors_Mode2_Swipe),
1072 3 => (object)new ParallelForAction(doColors_Mode3_Swipe),
1073 _ => (object)new ParallelForAction(doColors_Mode0_Swipe),
1074 }), (object)_swipe);
1075 _swipeRandom.NextSeed();
1076 TimeLogger.LightingTime(i + 1, stopwatch.Elapsed.TotalMilliseconds);
1077 }
1078 }
static void For(int fromInclusive, int toExclusive, ParallelForAction callback, object context=null)
void doColors_Mode1_Swipe(int outerLoopStart, int outerLoopEnd, object context)
void doColors_Mode3_Swipe(int outerLoopStart, int outerLoopEnd, object context)
void doColors_Mode0_Swipe(int outerLoopStart, int outerLoopEnd, object context)
void doColors_Mode2_Swipe(int outerLoopStart, int outerLoopEnd, object context)
delegate void ParallelForAction(int fromInclusive, int toExclusive, object context)

References Terraria.Graphics.Light.LegacyLighting._axisFlipStates, Terraria.Graphics.Light.LegacyLighting._blueDir, Terraria.Graphics.Light.LegacyLighting._blueWave, Terraria.Graphics.Light.LegacyLighting._expandedArea, Terraria.Graphics.Light.LegacyLighting._honeyLightB, Terraria.Graphics.Light.LegacyLighting._honeyLightG, Terraria.Graphics.Light.LegacyLighting._honeyLightR, Terraria.Graphics.Light.LegacyLighting._negLight, Terraria.Graphics.Light.LegacyLighting._negLight2, Terraria.Graphics.Light.LegacyLighting._rgb, Terraria.Graphics.Light.LegacyLighting._states, Terraria.Graphics.Light.LegacyLighting._swipe, Terraria.Graphics.Light.LegacyLighting._swipeRandom, Terraria.Graphics.Light.LegacyLighting._wetLightB, Terraria.Graphics.Light.LegacyLighting._wetLightG, Terraria.Graphics.Light.LegacyLighting._wetLightR, Terraria.Graphics.Light.LegacyLighting.doColors_Mode0_Swipe(), Terraria.Graphics.Light.LegacyLighting.doColors_Mode1_Swipe(), Terraria.Graphics.Light.LegacyLighting.doColors_Mode2_Swipe(), Terraria.Graphics.Light.LegacyLighting.doColors_Mode3_Swipe(), ReLogic.Threading.FastParallel.For(), Terraria.Graphics.Light.LegacyLighting.LightingSwipeData.InnerLoop1End, Terraria.Graphics.Light.LegacyLighting.LightingSwipeData.InnerLoop1Start, Terraria.Graphics.Light.LegacyLighting.LightingSwipeData.InnerLoop2End, Terraria.Graphics.Light.LegacyLighting.LightingSwipeData.InnerLoop2Start, Terraria.Graphics.Light.LegacyLighting.IsColorOrWhiteMode, Terraria.Graphics.Light.LegacyLighting.RectArea.Left, Terraria.TimeLogger.LightingTime(), Terraria.Main.myPlayer, ReLogic.Threading.ParallelForAction(), Terraria.Main.player, Terraria.Main.renderCount, Terraria.Graphics.Light.LegacyLighting.RenderPhases, Terraria.Graphics.Light.LegacyLighting.RectArea.Top, and Terraria.Main.waterStyle.

Referenced by Terraria.Graphics.Light.LegacyLighting.PreRenderPhase(), and Terraria.Graphics.Light.LegacyLighting.ProcessArea().