Terraria ModLoader  0.10.1.5
A framework for 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 ()
 

Public Attributes

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

Static Public Attributes

static int WaterStyleCount => nextWaterStyle
 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

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

Definition at line 53 of file WaterStyleLoader.cs.

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

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

+ Here is the call graph for this function:

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

Definition at line 109 of file WaterStyleLoader.cs.

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

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  }

+ Here is the call graph for this function:

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.
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  }
const int vanillaWaterCount
The maximum amount of liquids in vanilla.
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.

References Terraria.ModLoader.ModWaterStyle.LightColorMultiplier().

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.

+ Here is the call graph for this function:

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

Definition at line 62 of file WaterStyleLoader.cs.

References Terraria.ModLoader.ModWaterStyle.Type.

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  }
const int vanillaWaterCount
The maximum amount of liquids in vanilla.

Member Data Documentation

int Terraria.ModLoader.WaterStyleLoader.nextWaterStyle = vanillaWaterCount
staticprivate

Definition at line 18 of file WaterStyleLoader.cs.

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

The maximum amount of liquids in vanilla.

Definition at line 17 of file WaterStyleLoader.cs.

int Terraria.ModLoader.WaterStyleLoader.WaterStyleCount => nextWaterStyle
static

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

Definition at line 24 of file WaterStyleLoader.cs.