1 using Microsoft.Xna.Framework.Graphics;
3 using System.Collections.Generic;
17 public const int vanillaWaterCount = Main.maxLiquidTypes;
18 private static int nextWaterStyle = vanillaWaterCount;
19 internal static readonly IList<ModWaterStyle> waterStyles =
new List<ModWaterStyle>();
24 public static int WaterStyleCount => nextWaterStyle;
26 internal static int ReserveStyle() {
27 int reserve = nextWaterStyle;
36 if (style < vanillaWaterCount || style >= nextWaterStyle) {
39 return waterStyles[style - vanillaWaterCount];
42 internal static void ResizeArrays() {
43 Array.Resize(ref LiquidRenderer.Instance._liquidTextures, nextWaterStyle);
44 Array.Resize(ref Main.liquidAlpha, nextWaterStyle);
45 Array.Resize(ref Main.liquidTexture, nextWaterStyle);
48 internal static void Unload() {
49 nextWaterStyle = vanillaWaterCount;
56 style = waterStyle.
Type;
63 if (Main.waterStyle >= vanillaWaterCount) {
64 for (
int k = 0; k < vanillaWaterCount; k++) {
65 if (k == 1 || k == 11) {
68 Main.liquidAlpha[k] -= 0.2f;
69 if (Main.liquidAlpha[k] < 0f) {
70 Main.liquidAlpha[k] = 0f;
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;
83 Main.liquidAlpha[type] -= 0.2f;
84 if (Main.liquidAlpha[type] < 0f) {
85 Main.liquidAlpha[type] = 0f;
92 for (
int k = vanillaWaterCount; k < nextWaterStyle; k++) {
93 if (Main.liquidAlpha[k] > 0f) {
95 if (Main.waterStyle < k) {
96 Main.instance.DrawWater(bg, k, Main.liquidAlpha[k]);
99 Main.instance.DrawWater(bg, k, 1f);
103 Main.instance.DrawWater(bg, k, Main.liquidAlpha[k]);
109 public static void DrawWaterfall(WaterfallManager waterfallManager, SpriteBatch spriteBatch) {
111 if (Main.liquidAlpha[waterStyle.
Type] > 0f) {
113 Main.liquidAlpha[waterStyle.
Type]);
120 if (waterStyle != null) {
122 r *= Lighting.negLight * Lighting.blueWave;
123 g *= Lighting.negLight * Lighting.blueWave;
124 b *= Lighting.negLight * Lighting.blueWave;
131 public const int vanillaWaterfallCount = WaterfallManager.maxTypes;
132 private static int nextWaterfallStyle = vanillaWaterfallCount;
133 internal static readonly IList<ModWaterfallStyle> waterfallStyles =
new List<ModWaterfallStyle>();
135 internal static int ReserveStyle() {
136 int reserve = nextWaterfallStyle;
137 nextWaterfallStyle++;
145 if (style < vanillaWaterfallCount || style >= nextWaterfallStyle) {
148 return waterfallStyles[style - vanillaWaterfallCount];
151 internal static void ResizeArrays() {
152 Array.Resize(ref Main.instance.waterfallManager.waterfallTexture, nextWaterfallStyle);
155 internal static void Unload() {
156 nextWaterfallStyle = vanillaWaterfallCount;
157 waterfallStyles.Clear();
static ModWaterfallStyle GetWaterfallStyle(int style)
Returns the ModWaterfallStyle with the given ID.
static void LightColorMultiplier(int style, ref float r, ref float g, ref float b)
static void DrawWatersToScreen(bool bg)
This is where all ModWorld hooks are gathered and called.
Represents a style of water that gets drawn, based on factors such as the background. This is used to determine the color of the water, as well as other things as determined by the hooks below.
virtual void LightColorMultiplier(ref float r, ref float g, ref float b)
Allows you to modify the light levels of the tiles behind the water. The light color components will ...
static void ChooseWaterStyle(ref int style)
abstract int ChooseWaterfallStyle()
The ID of the waterfall style the game should use when this water style is in use.
Represents a style of waterfalls that gets drawn. This is mostly used to determine the color of the w...
static void UpdateLiquidAlphas()
This serves as the central class from which WaterStyle functions are supported and carried out...
static void DrawWaterfall(WaterfallManager waterfallManager, SpriteBatch spriteBatch)
virtual bool ChooseWaterStyle()
Whether the conditions have been met for this water style to be used. Typically Main.bgStyle is checked to determine whether a water style should be used. Returns false by default.
static void ChooseWaterStyle(ref int style)
static ModWaterStyle GetWaterStyle(int style)
Returns the ModWaterStyle with the given ID.
int Type
The ID of the water style.