tModLoader v0.11.8.9
A mod to make and play Terraria mods
Terraria.ModLoader.WaterStyleLoader Class Reference

This serves as the central class from which WaterStyle functions are supported and carried out. More...

+ Collaboration diagram for Terraria.ModLoader.WaterStyleLoader:

Static Public Member Functions

static void ChooseWaterStyle (ref int style)
 
static void DrawWaterfall (WaterfallManager waterfallManager, SpriteBatch spriteBatch)
 
static void DrawWatersToScreen (bool bg)
 
static ModWaterStyle GetWaterStyle (int style)
 Returns the ModWaterStyle with the given ID. More...
 
static void LightColorMultiplier (int style, ref float r, ref float g, ref float b)
 
static void UpdateLiquidAlphas ()
 

Static Public Attributes

const int vanillaWaterCount = Main.maxLiquidTypes
 The maximum amount of liquids in vanilla. More...
 

Properties

static int WaterStyleCount [get]
 The number of water styles that exist in the game, both vanilla and modded. More...
 

Static Private Attributes

static int nextWaterStyle = vanillaWaterCount
 

Detailed Description

This serves as the central class from which WaterStyle functions are supported and carried out.

Definition at line 12 of file WaterStyleLoader.cs.

Member Function Documentation

◆ ChooseWaterStyle()

static void Terraria.ModLoader.WaterStyleLoader.ChooseWaterStyle ( ref int  style)
static

Definition at line 53 of file WaterStyleLoader.cs.

53 {
54 foreach (ModWaterStyle waterStyle in waterStyles) {
55 if (waterStyle.ChooseWaterStyle()) {
56 style = waterStyle.Type;
57 }
58 }
59 WorldHooks.ChooseWaterStyle(ref style);
60 }

References Terraria.ModLoader.ModWaterStyle.ChooseWaterStyle(), Terraria.ModLoader.WorldHooks.ChooseWaterStyle(), and Terraria.ModLoader.ModWaterStyle.Type.

+ Here is the call graph for this function:

◆ DrawWaterfall()

static void Terraria.ModLoader.WaterStyleLoader.DrawWaterfall ( WaterfallManager  waterfallManager,
SpriteBatch  spriteBatch 
)
static

Definition at line 109 of file WaterStyleLoader.cs.

109 {
110 foreach (ModWaterStyle waterStyle in waterStyles) {
111 if (Main.liquidAlpha[waterStyle.Type] > 0f) {
112 waterfallManager.DrawWaterfall(spriteBatch, waterStyle.ChooseWaterfallStyle(),
113 Main.liquidAlpha[waterStyle.Type]);
114 }
115 }
116 }

References Terraria.ModLoader.ModWaterStyle.ChooseWaterfallStyle(), and Terraria.ModLoader.ModWaterStyle.Type.

+ Here is the call graph for this function:

◆ DrawWatersToScreen()

static void Terraria.ModLoader.WaterStyleLoader.DrawWatersToScreen ( bool  bg)
static

Definition at line 91 of file WaterStyleLoader.cs.

91 {
92 for (int k = vanillaWaterCount; k < nextWaterStyle; k++) {
93 if (Main.liquidAlpha[k] > 0f) {
94 if (bg) {
95 if (Main.waterStyle < k) {
96 Main.instance.DrawWater(bg, k, Main.liquidAlpha[k]);
97 }
98 else {
99 Main.instance.DrawWater(bg, k, 1f);
100 }
101 }
102 else {
103 Main.instance.DrawWater(bg, k, Main.liquidAlpha[k]);
104 }
105 }
106 }
107 }
const int vanillaWaterCount
The maximum amount of liquids in vanilla.

References Terraria.ModLoader.WaterStyleLoader.nextWaterStyle, and Terraria.ModLoader.WaterStyleLoader.vanillaWaterCount.

◆ GetWaterStyle()

static ModWaterStyle Terraria.ModLoader.WaterStyleLoader.GetWaterStyle ( int  style)
static

Returns the ModWaterStyle with the given ID.

Definition at line 35 of file WaterStyleLoader.cs.

35 {
36 if (style < vanillaWaterCount || style >= nextWaterStyle) {
37 return null;
38 }
39 return waterStyles[style - vanillaWaterCount];
40 }

References Terraria.ModLoader.WaterStyleLoader.nextWaterStyle, and Terraria.ModLoader.WaterStyleLoader.vanillaWaterCount.

Referenced by Terraria.ModLoader.WaterStyleLoader.LightColorMultiplier().

+ Here is the caller graph for this function:

◆ LightColorMultiplier()

static void Terraria.ModLoader.WaterStyleLoader.LightColorMultiplier ( int  style,
ref float  r,
ref float  g,
ref float  b 
)
static

Definition at line 118 of file WaterStyleLoader.cs.

118 {
119 ModWaterStyle waterStyle = GetWaterStyle(style);
120 if (waterStyle != null) {
121 waterStyle.LightColorMultiplier(ref r, ref g, ref b);
122 r *= Lighting.negLight * Lighting.blueWave;
123 g *= Lighting.negLight * Lighting.blueWave;
124 b *= Lighting.negLight * Lighting.blueWave;
125 }
126 }
static ModWaterStyle GetWaterStyle(int style)
Returns the ModWaterStyle with the given ID.

References Terraria.ModLoader.WaterStyleLoader.GetWaterStyle(), and Terraria.ModLoader.ModWaterStyle.LightColorMultiplier().

+ Here is the call graph for this function:

◆ UpdateLiquidAlphas()

static void Terraria.ModLoader.WaterStyleLoader.UpdateLiquidAlphas ( )
static

Definition at line 62 of file WaterStyleLoader.cs.

62 {
63 if (Main.waterStyle >= vanillaWaterCount) {
64 for (int k = 0; k < vanillaWaterCount; k++) {
65 if (k == 1 || k == 11) {
66 continue;
67 }
68 Main.liquidAlpha[k] -= 0.2f;
69 if (Main.liquidAlpha[k] < 0f) {
70 Main.liquidAlpha[k] = 0f;
71 }
72 }
73 }
74 foreach (ModWaterStyle waterStyle in waterStyles) {
75 int type = waterStyle.Type;
76 if (Main.waterStyle == type) {
77 Main.liquidAlpha[type] += 0.2f;
78 if (Main.liquidAlpha[type] > 1f) {
79 Main.liquidAlpha[type] = 1f;
80 }
81 }
82 else {
83 Main.liquidAlpha[type] -= 0.2f;
84 if (Main.liquidAlpha[type] < 0f) {
85 Main.liquidAlpha[type] = 0f;
86 }
87 }
88 }
89 }

References Terraria.ModLoader.ModWaterStyle.Type, and Terraria.ModLoader.WaterStyleLoader.vanillaWaterCount.

Member Data Documentation

◆ nextWaterStyle

int Terraria.ModLoader.WaterStyleLoader.nextWaterStyle = vanillaWaterCount
staticprivate

◆ vanillaWaterCount

const int Terraria.ModLoader.WaterStyleLoader.vanillaWaterCount = Main.maxLiquidTypes
static

Property Documentation

◆ WaterStyleCount

int Terraria.ModLoader.WaterStyleLoader.WaterStyleCount
staticget

The number of water styles that exist in the game, both vanilla and modded.

Definition at line 24 of file WaterStyleLoader.cs.