terraria-cpp2il-methodrecon v1.4.4.9
Terraria mobile dump, with reconstructed method body. Dump with CallAnalysis: https://infinitynichto.github.io/terraria-cpp2il
Loading...
Searching...
No Matches
WaterShaderData.cs
Go to the documentation of this file.
1using System;
8
10{
11 // Token: 0x02000826 RID: 2086
13 {
14 // Token: 0x14000054 RID: 84
15 // (add) Token: 0x060042C0 RID: 17088 RVA: 0x0024C3F8 File Offset: 0x0024A5F8
16 // (remove) Token: 0x060042C1 RID: 17089 RVA: 0x0024C420 File Offset: 0x0024A620
18 {
20 add
21 {
23 if (@delegate != null && @delegate == null)
24 {
25 return;
26 }
27 }
29 remove
30 {
32 if (@delegate != null && @delegate == null)
33 {
34 return;
35 }
36 }
37 }
38
39 // Token: 0x060042C2 RID: 17090 RVA: 0x0024C448 File Offset: 0x0024A648
41 {
42 int num = 1;
43 this._useViscosityFilter = num != 0;
44 if (num == 0)
45 {
46 }
47 if (!true)
48 {
49 }
50 long num2 = 16843009L;
53 int num3 = 1;
55 base..ctor(passName);
56 if (num3 == 0)
57 {
58 }
59 }
60
61 // Token: 0x060042C3 RID: 17091 RVA: 0x0024C498 File Offset: 0x0024A698
62 public override void Update(GameTime gameTime)
63 {
64 if ("Only TraceListeners can be added to a TraceListenerCollection." == null)
65 {
66 }
68 }
69
70 // Token: 0x060042C4 RID: 17092 RVA: 0x0024C5A4 File Offset: 0x0024A7A4
71 private void StepLiquids()
72 {
73 int num = 1;
74 this._isWaveBufferDirty = num != 0;
75 if (num == 0)
76 {
77 }
78 Vector2 screenPosition = Main.screenPosition;
82 if (clearNextFrame2)
83 {
84 }
85 this.DrawWaves();
89 if (!clearNextFrame2)
90 {
91 }
92 if (!clearNextFrame2)
93 {
94 }
95 if (!clearNextFrame2)
96 {
97 }
98 float x = this._lastDistortionDrawOffset.X;
99 float y = this._lastDistortionDrawOffset.Y;
101 Texture2D gameDistortionTargetSwap = instance3.GameDistortionTargetSwap;
102 IntPtr cachedPtr = instance3.m_CachedPtr;
103 if (!true)
104 {
105 }
106 int width = gameDistortionTargetSwap.Width;
107 int height = gameDistortionTargetSwap.Height;
109 }
110
111 // Token: 0x060042C5 RID: 17093 RVA: 0x0024C678 File Offset: 0x0024A878
112 private void DrawWaves()
113 {
114 int num = 1;
115 if (num == 0)
116 {
117 }
118 Vector2 screenPosition = Main.screenPosition;
119 if (num == 0)
120 {
121 }
122 int num2 = 1;
123 if (num2 == 0)
124 {
125 }
126 float x = this._lastDistortionDrawOffset.X;
127 float y = this._lastDistortionDrawOffset.Y;
128 int value = num2.m_value;
129 int screenWidth = Main.screenWidth;
130 int screenHeight = Main.screenHeight;
131 if (!true)
132 {
133 }
134 float num6;
135 if (this._useNPCWaves)
136 {
137 Vector2 vector;
138 float num3 = vector.LengthSquared();
140 float num4 = vector2.Length();
141 vector2.Normalize();
142 vector2.Normalize();
144 if (useViscosityFilter || useViscosityFilter || useViscosityFilter)
145 {
146 }
148 {
150 {
151 }
152 }
153 float num5 = MathHelper.Clamp(num6, num6, num4);
154 }
155 if (this._usePlayerWaves)
156 {
158 if (useViscosityFilter2 || useViscosityFilter2 || useViscosityFilter2)
159 {
160 }
162 {
164 {
165 }
166 }
167 float num7 = MathHelper.Clamp(num6, num6, num6);
168 }
169 if (this._useProjectileWaves)
170 {
171 return;
172 }
173 if (this._useRippleWaves)
174 {
178 if (this._rippleShapeTexture == null)
179 {
180 }
183 }
184 if (this._useCustomWaves && this.OnWaveDraw != null)
185 {
187 }
188 }
189
190 // Token: 0x060042C6 RID: 17094 RVA: 0x0024C870 File Offset: 0x0024AA70
192 {
194 if (this._usingRenderTargets)
195 {
197 bool usePlayerWaves;
198 if (!this._useProjectileWaves && !this._useRippleWaves && !this._useCustomWaves)
199 {
200 usePlayerWaves = this._usePlayerWaves;
201 if (!usePlayerWaves)
202 {
203 if (this._isWaveBufferDirty || this._clearNextFrame)
204 {
206 return;
207 }
208 return;
209 }
210 }
211 int queuedSteps = this._queuedSteps;
212 if (!usePlayerWaves)
213 {
214 }
215 int num = 1;
216 int num2 = Math.Min(queuedSteps, num);
217 this.StepLiquids();
218 return;
219 }
220 }
221
222 // Token: 0x060042C7 RID: 17095 RVA: 0x0024C8F4 File Offset: 0x0024AAF4
223 public override void Apply()
224 {
226 if (usingRenderTargets)
227 {
229 {
230 }
232 float progress = this._progress;
233 if (!usingRenderTargets)
234 {
235 }
236 int screenWidth = Main.screenWidth;
237 int screenHeight = Main.screenHeight;
239 {
240 }
241 if (true)
242 {
243 return;
244 }
245 if (!true)
246 {
247 }
249 if (gameDistortionTarget != null)
250 {
251 Vector2 screenPosition = Main.screenPosition;
254 float x = this._lastDistortionDrawOffset.X;
255 float y = this._lastDistortionDrawOffset.Y;
256 int width = gameDistortionTarget.Width;
257 int height = gameDistortionTarget.Height;
258 }
259 base.Apply();
260 }
261 }
262
263 // Token: 0x060042C8 RID: 17096 RVA: 0x0024C9D0 File Offset: 0x0024ABD0
265 {
266 if (!true)
267 {
268 }
269 GraphicsDevice graphicsDevice;
270 int backBufferWidth = graphicsDevice.<PresentationParameters>k__BackingField.backBufferWidth;
273 int backBufferHeight = <PresentationParameters>k__BackingField.backBufferHeight;
275 if (this._usingRenderTargets)
276 {
277 return;
278 }
279 this._lastScreenWidth = backBufferWidth;
280 this._useProjectileWaves = backBufferHeight != 0;
283 }
284
285 // Token: 0x060042C9 RID: 17097 RVA: 0x0024CA2C File Offset: 0x0024AC2C
286 private void InitRenderTargets(int width, int height)
287 {
288 this._lastScreenWidth = width;
289 this._useProjectileWaves = height != 0;
292 }
293
294 // Token: 0x060042CA RID: 17098 RVA: 0x0024CA58 File Offset: 0x0024AC58
295 private void ReleaseRenderTargets()
296 {
297 }
298
299 // Token: 0x060042CB RID: 17099 RVA: 0x0024CA68 File Offset: 0x0024AC68
300 public void QueueRipple(Vector2 position, float strength = 1f, RippleShape shape = RippleShape.Square, float rotation = 0f)
301 {
302 if (!true)
303 {
304 }
305 float num = Math.Min(strength, rotation);
306 if (!true)
307 {
308 }
309 float num2 = Math.Max(num, rotation);
310 }
311
312 // Token: 0x060042CC RID: 17100 RVA: 0x0024CA94 File Offset: 0x0024AC94
313 public void QueueRipple(Vector2 position, float strength, Vector2 size, RippleShape shape = RippleShape.Square, float rotation = 0f)
314 {
315 if (!true)
316 {
317 }
318 float num = Math.Min(strength, rotation);
319 if (!true)
320 {
321 }
322 }
323
324 // Token: 0x060042CD RID: 17101 RVA: 0x0024CAB4 File Offset: 0x0024ACB4
325 public void QueueRipple(Vector2 position, Color waveData, Vector2 size, RippleShape shape = RippleShape.Square, float rotation = 0f)
326 {
327 if (this._useRippleWaves)
328 {
329 float rotation2 = this._rippleQueue.Rotation;
331 return;
332 }
333 }
334
335 // Token: 0x040080FB RID: 33019
336 public const float DISTORTION_BUFFER_SCALE = 0.25f;
337
338 // Token: 0x040080FC RID: 33020
339 private const float WAVE_FRAMERATE = 0.016666668f;
340
341 // Token: 0x040080FD RID: 33021
342 private const int MAX_RIPPLES_QUEUED = 200;
343
344 // Token: 0x040080FE RID: 33022
347
348 // Token: 0x040080FF RID: 33023
350
351 // Token: 0x04008100 RID: 33024
353
354 // Token: 0x04008101 RID: 33025
356
357 // Token: 0x04008102 RID: 33026
358 private float _progress;
359
360 // Token: 0x04008103 RID: 33027
362
363 // Token: 0x04008104 RID: 33028
364 private int _rippleQueueCount;
365
366 // Token: 0x04008105 RID: 33029
367 private int _lastScreenWidth;
368
369 // Token: 0x04008106 RID: 33030
370 private int _lastScreenHeight;
371
372 // Token: 0x04008107 RID: 33031
374
375 // Token: 0x04008108 RID: 33032
376 private bool _useNPCWaves;
377
378 // Token: 0x04008109 RID: 33033
379 private bool _usePlayerWaves;
380
381 // Token: 0x0400810A RID: 33034
382 private bool _useRippleWaves;
383
384 // Token: 0x0400810B RID: 33035
385 private bool _useCustomWaves;
386
387 // Token: 0x0400810C RID: 33036
388 private bool _clearNextFrame;
389
390 // Token: 0x0400810D RID: 33037
392
393 // Token: 0x0400810E RID: 33038
395
396 // Token: 0x0400810F RID: 33039
398
399 // Token: 0x04008110 RID: 33040
400 private bool _isWaveBufferDirty;
401
402 // Token: 0x04008111 RID: 33041
403 private int _queuedSteps;
404
405 // Token: 0x04008112 RID: 33042
406 private const int MAX_QUEUED_STEPS = 1;
407
408 // Token: 0x02000827 RID: 2087
409 private struct Ripple
410 {
411 // Token: 0x170007C4 RID: 1988
412 // (get) Token: 0x060042CE RID: 17102 RVA: 0x0024CAE0 File Offset: 0x0024ACE0
414 {
415 get
416 {
417 /*
418An exception occurred when decompiling this method (060042CE)
419
420ICSharpCode.Decompiler.DecompilerException: Error decompiling Microsoft.Xna.Framework.Rectangle Terraria.GameContent.Shaders.WaterShaderData/Ripple::get_SourceRectangle()
421
422 ---> System.Exception: Basic block has to end with unconditional control flow.
423{
424 IL_0000:
425 brtrue(IL_0000, ldc.i4:bool(1))
426}
427
428 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
429 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
430 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
431 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
432 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
433 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
434 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
435 --- End of inner exception stack trace ---
436 at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
437 at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1683
438*/;
439 }
440 }
441
442 // Token: 0x060042CF RID: 17103 RVA: 0x0024CAF0 File Offset: 0x0024ACF0
443 public Ripple(Vector2 position, Color waveData, Vector2 size, RippleShape shape, float rotation)
444 {
445 this.WaveData = position;
447 }
448
449 // Token: 0x060042D0 RID: 17104 RVA: 0x0024CB0C File Offset: 0x0024AD0C
450 // Note: this type is marked as 'beforefieldinit'.
451 static Ripple()
452 {
453 }
454
455 // Token: 0x04008113 RID: 33043
457
458 // Token: 0x04008114 RID: 33044
460
461 // Token: 0x04008115 RID: 33045
463
464 // Token: 0x04008116 RID: 33046
466
467 // Token: 0x04008117 RID: 33047
469
470 // Token: 0x04008118 RID: 33048
471 public readonly float Rotation;
472 }
473 }
474}
class f__AnonymousType0<< Count > j__TPar
Microsoft.Xna.Framework.Graphics.Texture2D GameDistortionTarget
static DistortionRenderTargetManager Instance
static float Clamp(float value, float min, float max)
Definition MathHelper.cs:22
static Delegate Combine(Delegate a, Delegate b)
Definition Delegate.cs:255
static Delegate Remove(Delegate source, Delegate value)
Definition Delegate.cs:278
static byte Min(byte val1, byte val2)
Definition Math.cs:152
static byte Max(byte val1, byte val2)
Definition Math.cs:111
override void Update(GameTime gameTime)
void QueueRipple(Vector2 position, float strength, Vector2 size, RippleShape shape=RippleShape.Square, float rotation=0f)
void QueueRipple(Vector2 position, Color waveData, Vector2 size, RippleShape shape=RippleShape.Square, float rotation=0f)
void InitRenderTargets(int width, int height)
void QueueRipple(Vector2 position, float strength=1f, RippleShape shape=RippleShape.Square, float rotation=0f)
static int WaveQuality
Definition Main.cs:461
static Microsoft.Xna.Framework.Vector2 screenPosition
Definition Main.cs:1973
static bool IsGraphicsDeviceAvailable
Definition Main.cs:16881
static int screenHeight
Definition Main.cs:2015
static int screenWidth
Definition Main.cs:2001
static WaterRenderTargetManager Instance
Microsoft.Xna.Framework.Graphics.Texture2D GameRenderTarget
Ripple(Vector2 position, Color waveData, Vector2 size, RippleShape shape, float rotation)