forked from tModLoader/tModLoader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
patching_todo.txt
409 lines (334 loc) · 18.4 KB
/
patching_todo.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
//Rartrin:
//Player
//Make sure "22" replaced with "MaxBuffs" in 'for' and CountBuffs() == and !=.
//Ensure all blockLists are cleared everywhere that they need to be.
//Need reimplementing:
//TileLoader
//Multiply item.axe by 1.2f before adding into the damage.
//WorldGen
//Add TileLoader.IsClosedDoor into WorldGen.IsLockedDoor check.
//Needs checking:
//WaterStyleLoader.WaterStyleCount
//Main
//Add IsAValidEquipmentSlotForIteration to VanillaUpdateAccessory check.
//Mirsario:
//WorldGen:
//Test drops.
//Test modded grasses' behavior.
//TileDrawing:
//Reimplement cactus drawing. Search for modCactus in Main.cs 1.3.5.3 tML diffs.
//Reimplement tree drawing. Search for modTree in Main.cs 1.3.5.3 tML diffs.
//Item:
//In Item.GetDrawHitbox, return the following size if it's not null.
itemAnimations[item[i].type]?.GetFrame(itemTexture[item[i].type])
//LegacySoundPlayer
//Re-add clamps for volume and pitch, 0.0..1.0 and -1.0..1.0 respectively?
//Put this in somewhere:
if (waveBank == null) //Supress extra exceptions from the audio engine failing to load
return null;
//LegacyPlayerRenderer:
//Reimplement ItemLoader.DrawHair hook.
//Reimplement these calls from Main.DrawPlayer:
ItemLoader.DrawHands(drawPlayer, ref flag, ref flag2);
ItemLoader.DrawHair(drawPlayer, ref flag4, ref flag5);
ItemLoader.DrawArmorColor(EquipType.Head, drawPlayer.head, drawPlayer, shadow, ref color11, ref num12, ref newColor);
ItemLoader.DrawArmorColor(EquipType.Body, drawPlayer.body, drawPlayer, shadow, ref color12, ref num13, ref newColor2);
ItemLoader.ArmorArmGlowMask(drawPlayer.body, drawPlayer, shadow, ref num14, ref newColor3);
ItemLoader.DrawArmorColor(EquipType.Legs, drawPlayer.legs, drawPlayer, shadow, ref color14, ref num15, ref newColor4);
ItemLoader.DrawHands(drawPlayer, ref flag, ref flag2);
ProjectileLoader.DrawHeldProjInFrontOfHeldItemAndArms(projectile[drawPlayer.heldProj], ref flag3); //(multiple of these)
ItemLoader.DrawBody(drawPlayer) // ('if' check)
// {
+ Vector2 holdoutOrigin = Vector2.Zero;
+ ItemLoader.HoldoutOrigin(drawPlayer, ref holdoutOrigin);
- value = new DrawData(itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((int)(value2.X - screenPosition.X + origin5.X + (float)num103), (int)(value2.Y - screenPosition.Y + (float)num104)), new Microsoft.Xna.Framework.Rectangle(0, 0, itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height), drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(currentColor), num102, origin5, drawPlayer.inventory[drawPlayer.selectedItem].scale, spriteEffects2, 0);
+ value = new DrawData(itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((int)(value2.X - screenPosition.X + origin5.X + (float)num103), (int)(value2.Y - screenPosition.Y + (float)num104)), new Microsoft.Xna.Framework.Rectangle(0, 0, itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height), drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(currentColor), num102, origin5 + holdoutOrigin, drawPlayer.inventory[drawPlayer.selectedItem].scale, spriteEffects2, 0);
// }
//Main:
//Add this to the end of Initialize():
#if SERVER
this.OpenSettings();
#endif
//Put this somewhere it fits. Was in Main.LoadTextures():
UICommon.LoadTextures();
//Define and pass modMusic and modPriority to UpdateAudio_DecideOnTOWMusic and UpdateAudio_DecideOnNewMusic methods...
int modMusic = -1;
MusicPriority modPriority = MusicPriority.None;
//...And put this after the calls.
ModHooks.UpdateMusic(ref modMusic, ref modPriority);
//Redo all the checks like that in both UpdateAudio_DecideOnTOWMusic and UpdateAudio_DecideOnNewMusic:
if (modPriority >= MusicPriority.Event) {
newMusic = modMusic;
}
//Put this somewhere high in DoUpdateInWorld:
if (netMode == 1 && Netplay.syncingWorld) // skip updating entities while world is loading in multiplayer #340
goto skipEntityUpdates;
//In DrawWaters, replace '13' in for check with
WaterStyleLoader.WaterStyleCount'
//Add this to the middle of DrawBG() after definition of the used variable.
SurfaceBgStyleLoader.ChooseStyle(ref preferredBGStyleForPlayer);
//Add this to the end of DrawSurfaceBG_BackMountainsStep2:
SurfaceBgStyleLoader.DrawMiddleTexture();
//Add this near the end of DrawSurfaceBG(), after SkyManager.Instance.DrawToDepth(spriteBatch, 1f); call:
FinishDrawCloseBackground:
SurfaceBgStyleLoader.DrawCloseBackground(num21);
//...Then make sure that all returns/continues before it are replaced with gotos to that statement.
//Find where the logo is rendered, and lower the position a bit.
//If still needed - replace Utils.WordwrapString call in Main.TextDisplayCache.PrepareCache with Utils.WordwrapStringSmart.
//Use old diffs in Main.GUIChatDrawInner
//Reimplement the entire ModifyTooltips hook call with all the tooltipNames filling, based on diffs of 1.3.5.3. See MouseText_DrawItemTooltip.
//Reimplement PreDrawExtras and PostDraw:
//In DrawProj, jump over drawing of all extras with a goto:
if (!ProjectileLoader.PreDrawExtras(projectile, spriteBatch)) {
goto DrawExtrasEnd;
}
ProjectileLoader.PostDraw(projectile, spriteBatch, color25);
//Projectile drawing hooks need more thought because of early returns
//Reimplement broken patches:
// {
if (nPC.aiStyle == 7)
DrawNPCExtras(n3, beforeDraw: false, num65, num64, color9, vector10, spriteEffects);
+NPCLoader.PostDraw(npc[iNPCIndex], spriteBatch, color9);
// }
// {
@@ -6674,41 +5292,48 @@
}
if (autoJoin) {
+ ModLoader.ModLoader.OnSuccessfulLoad += () => {
- LoadPlayers();
+ LoadPlayers();
- menuMode = 1;
+ menuMode = 1;
- menuMultiplayer = true;
+ menuMultiplayer = true;
+ };
}
fpsTimer.Start();
}
protected override void LoadContent() {
+ HiDefGraphicsIssues.OnLoadContent();
Configuration.Load();
+ ModLoader.ModLoader.MigrateSettings();
Configuration.Get("UseExperimentalFeatures", ref UseExperimentalFeatures);
if (UseExperimentalFeatures)
TexturePackSupport.Enabled = true;
Configuration.Get("Support4K", ref Support4K);
bool flag = Support4K && base.GraphicsDevice.Adapter.IsProfileSupported(GraphicsProfile.HiDef);
- if (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width <= 1920 && GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height <= 1200)
- flag = false;
-
+ // (resolution check removed) tModLoader will attempt to use HiDef even if the computer resolution doesn't need it to support newer shaders.
if (Support4K && flag)
- SetGraphicsProfile(GraphicsProfile.HiDef);
+ if (SetGraphicsProfile(GraphicsProfile.HiDef))
+ return; // changing the graphics profile triggers a device recreation and XNA will call `LoadContent` again
- TexturePackSupport.FindTexturePack();
+ TexturePackSupport.FindTexturePacks();
TextureManager.Initialize();
mapSectionTexture = new RenderTarget2D(base.GraphicsDevice, 200, 150);
- ShaderContentManager = new ContentManager(base.Content.ServiceProvider, base.Content.RootDirectory);
+ ShaderContentManager = new TMLContentManager(base.Content.ServiceProvider, base.Content.RootDirectory, AlternateContentManager);
PixelShaderRef.Value = ShaderContentManager.Load<Effect>("PixelShader");
TileShaderRef.Value = ShaderContentManager.Load<Effect>("TileShader");
ScreenShaderRef.Value = ShaderContentManager.Load<Effect>("ScreenShader");
// }
// {
@@ -16295,7 +16647,9 @@
}
try {
+ Texture2D modTopTextures;
if (type4 == 5 && frameY >= 198 && frameX >= 22) {
+ //frame
int num316 = 0;
switch (frameX) {
case 22: {
// }
// {
@@ -16309,11 +16663,22 @@
}
int num320 = 0;
+ //frame width
int num321 = 80;
+ //frame height
int num322 = 80;
+ //x offset left
int num323 = 32;
+ //y offset
int num324 = 0;
+ modTopTextures = null;
for (int num325 = num301; num325 < num301 + 100; num325++) {
+ modTopTextures = TileLoader.GetTreeTopTextures(tile[num300, num325].type,
+ num300, num325, ref num316, ref num321, ref num322, ref num323, ref num324);
+
+ if (modTopTextures != null)
+ break;
+
if (Main.tile[num300, num325].type == 2) {
num320 = GetTreeStyle(num300);
break;
// }
// {
@@ -16152,6 +16503,7 @@
int num298 = 0;
spriteBatch.Draw(texture2D2, new Vector2((float)(j * 16 - (int)screenPosition.X) - ((float)num9 - 16f) / 2f + (float)num297, i * 16 - (int)screenPosition.Y + num12 + num298) + value, empty, color6, 0f, default(Vector2), 1f, effects, 0f);
}
+ TileLoader.PostDraw(j, i, type, spriteBatch);
}
}
// }
// {
@@ -16380,10 +16745,12 @@
Lighting.AddLight(num300, num301, 0.1f, 0.2f + num326 / 2f, 0.7f + num326);
}
- if (tile6.color() > 0)
+ if (modTopTextures == null && tile6.color() > 0)
checkTreeAlt[num320, tile6.color()] = true;
+ if (modTopTextures != null)
+ spriteBatch.Draw(modTopTextures, new Vector2(num300 * 16 - (int)screenPosition.X - num323, num301 * 16 - (int)screenPosition.Y - num322 + 16 + num324) + value, new Microsoft.Xna.Framework.Rectangle(num316 * (num321 + 2), 0, num321, num322), Lighting.GetColor(num300, num301), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
- if (tile6.color() > 0 && treeAltTextureDrawn[num320, tile6.color()])
+ else if (tile6.color() > 0 && treeAltTextureDrawn[num320, tile6.color()])
spriteBatch.Draw(treeTopAltTexture[num320, tile6.color()], new Vector2(num300 * 16 - (int)screenPosition.X - num323, num301 * 16 - (int)screenPosition.Y - num322 + 16 + num324) + value, new Microsoft.Xna.Framework.Rectangle(num316 * (num321 + 2), 0, num321, num322), Lighting.GetColor(num300, num301), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
else
spriteBatch.Draw(treeTopTexture[num320], new Vector2(num300 * 16 - (int)screenPosition.X - num323, num301 * 16 - (int)screenPosition.Y - num322 + 16 + num324) + value, new Microsoft.Xna.Framework.Rectangle(num316 * (num321 + 2), 0, num321, num322), Lighting.GetColor(num300, num301), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
// }
// {
@@ -16401,7 +16768,13 @@
}
int num327 = 0;
+ Texture2D modBranchTextures = null;
for (int num328 = num301; num328 < num301 + 100; num328++) {
+ modBranchTextures = TileLoader.GetTreeBranchTextures(tile[num300 + 1, num328].type, num300, num328, 1, ref num316);
+
+ if (modBranchTextures != null)
+ break;
+
if (Main.tile[num300 + 1, num328].type == 2) {
num327 = GetTreeStyle(num300 + 1);
break;
// }
// {
@@ -16455,10 +16828,12 @@
Lighting.AddLight(num300, num301, 0.1f, 0.2f + num329 / 2f, 0.7f + num329);
}
- if (tile6.color() > 0)
+ if (modBranchTextures == null && tile6.color() > 0)
checkTreeAlt[num327, tile6.color()] = true;
+ if (modBranchTextures != null)
+ spriteBatch.Draw(modBranchTextures, new Vector2(num300 * 16 - (int)screenPosition.X - 24, num301 * 16 - (int)screenPosition.Y - 12) + value, new Microsoft.Xna.Framework.Rectangle(0, num316 * 42, 40, 40), Lighting.GetColor(num300, num301), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
- if (tile6.color() > 0 && treeAltTextureDrawn[num327, tile6.color()])
+ else if (tile6.color() > 0 && treeAltTextureDrawn[num327, tile6.color()])
spriteBatch.Draw(treeBranchAltTexture[num327, tile6.color()], new Vector2(num300 * 16 - (int)screenPosition.X - 24, num301 * 16 - (int)screenPosition.Y - 12) + value, new Microsoft.Xna.Framework.Rectangle(0, num316 * 42, 40, 40), Lighting.GetColor(num300, num301), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
else
spriteBatch.Draw(treeBranchTexture[num327], new Vector2(num300 * 16 - (int)screenPosition.X - 24, num301 * 16 - (int)screenPosition.Y - 12) + value, new Microsoft.Xna.Framework.Rectangle(0, num316 * 42, 40, 40), Lighting.GetColor(num300, num301), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
// }
// {
@@ -16476,7 +16851,13 @@
}
int num317 = 0;
+ Texture2D modBranchTextures = null;
for (int num318 = num301; num318 < num301 + 100; num318++) {
+ modBranchTextures = TileLoader.GetTreeBranchTextures(tile[num300 - 1, num318].type, num300, num318, -1, ref num316);
+
+ if (modBranchTextures != null)
+ break;
+
if (Main.tile[num300 - 1, num318].type == 2) {
num317 = GetTreeStyle(num300 - 1);
break;
// }
// {
@@ -16530,10 +16911,12 @@
Lighting.AddLight(num300, num301, 0.1f, 0.2f + num319 / 2f, 0.7f + num319);
}
- if (tile6.color() > 0)
+ if (modBranchTextures == null && tile6.color() > 0)
checkTreeAlt[num317, tile6.color()] = true;
+ if (modBranchTextures != null)
+ spriteBatch.Draw(modBranchTextures, new Vector2(num300 * 16 - (int)screenPosition.X, num301 * 16 - (int)screenPosition.Y - 12) + value, new Microsoft.Xna.Framework.Rectangle(42, num316 * 42, 40, 40), Lighting.GetColor(num300, num301), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
- if (tile6.color() > 0 && treeAltTextureDrawn[num317, tile6.color()])
+ else if (tile6.color() > 0 && treeAltTextureDrawn[num317, tile6.color()])
spriteBatch.Draw(treeBranchAltTexture[num317, tile6.color()], new Vector2(num300 * 16 - (int)screenPosition.X, num301 * 16 - (int)screenPosition.Y - 12) + value, new Microsoft.Xna.Framework.Rectangle(42, num316 * 42, 40, 40), Lighting.GetColor(num300, num301), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
else
spriteBatch.Draw(treeBranchTexture[num317], new Vector2(num300 * 16 - (int)screenPosition.X, num301 * 16 - (int)screenPosition.Y - 12) + value, new Microsoft.Xna.Framework.Rectangle(42, num316 * 42, 40, 40), Lighting.GetColor(num300, num301), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
// }
// {
@@ -16544,7 +16927,7 @@
}
if (type4 != 323 || frameX < 88 || frameX > 132)
- continue;
+ goto SpecialDraw;
int num330 = 0;
switch (frameX) {
// }
// {
@@ -16562,7 +16945,12 @@
int num334 = 80;
int num335 = 32;
int num336 = 0;
+ modTopTextures = null;
for (int num337 = num301; num337 < num301 + 100; num337++) {
+ modTopTextures = TileLoader.GetPalmTreeTopTextures(tile[num300, num337].type);
+ if (modTopTextures != null)
+ break;
+
if (Main.tile[num300, num337].type == 53) {
num332 = 0;
break;
// }
// {
@@ -16586,16 +16974,22 @@
int frameY3 = Main.tile[num300, num301].frameY;
int y3 = num332 * 82;
- if (tile6.color() > 0)
+ if (modTopTextures == null && tile6.color() > 0)
checkTreeAlt[num331, tile6.color()] = true;
+ if (modTopTextures != null)
+ spriteBatch.Draw(modTopTextures, new Vector2(num300 * 16 - (int)screenPosition.X - num335 + frameY3, num301 * 16 - (int)screenPosition.Y - num334 + 16 + num336) + value, new Microsoft.Xna.Framework.Rectangle(num330 * (num333 + 2), y3, num333, num334), Lighting.GetColor(num300, num301), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
- if (tile6.color() > 0 && treeAltTextureDrawn[num331, tile6.color()])
+ else if (tile6.color() > 0 && treeAltTextureDrawn[num331, tile6.color()])
spriteBatch.Draw(treeTopAltTexture[num331, tile6.color()], new Vector2(num300 * 16 - (int)screenPosition.X - num335 + frameY3, num301 * 16 - (int)screenPosition.Y - num334 + 16 + num336) + value, new Microsoft.Xna.Framework.Rectangle(num330 * (num333 + 2), y3, num333, num334), Lighting.GetColor(num300, num301), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
else
spriteBatch.Draw(treeTopTexture[num331], new Vector2(num300 * 16 - (int)screenPosition.X - num335 + frameY3, num301 * 16 - (int)screenPosition.Y - num334 + 16 + num336) + value, new Microsoft.Xna.Framework.Rectangle(num330 * (num333 + 2), y3, num333, num334), Lighting.GetColor(num300, num301), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
}
catch {
}
+
+ SpecialDraw:
+
+ TileLoader.SpecialDraw(type4, num300, num301, spriteBatch);
}
if (TileObject.objectPreview.Active && player[myPlayer].showItemIcon && placementPreview && !CaptureManager.Instance.Active) {
// }
// {
@@ -12580,18 +12880,30 @@
else if (array2[l]) {
black = (array3[l] ? new Microsoft.Xna.Framework.Color((byte)(190f * num18), (byte)(120f * num18), (byte)(120f * num18), a) : new Microsoft.Xna.Framework.Color((byte)(120f * num18), (byte)(190f * num18), (byte)(120f * num18), a));
}
- else if (l == currentLine - 1) {
+ else if (drawableLines[l].mod.Equals("Terraria") && drawableLines[l].Name.Equals("Price")) {
black = color;
}
- ChatManager.DrawColorCodedStringWithShadow(spriteBatch, fontMouseText, array[l], new Vector2(X, Y + num25), black, 0f, Vector2.Zero, Vector2.One);
+ drawableLines[l].color = black;
+ drawColor = black;
+ if (overrideColor[l].HasValue) {
+ drawColor = overrideColor[l].Value * num18;
+ drawableLines[l].overrideColor = drawColor;
+ }
+
+ if (ItemLoader.PreDrawTooltipLine(HoverItem, drawableLines[l], ref yOffset) && globalCanDraw)
+ ChatManager.DrawColorCodedStringWithShadow(spriteBatch, drawableLines[l].font, drawableLines[l].text, new Vector2((float)drawableLines[l].X, (float)drawableLines[l].Y), drawColor, drawableLines[l].rotation, drawableLines[l].origin, drawableLines[l].baseScale, drawableLines[l].maxWidth, drawableLines[l].spread);
+
+ ItemLoader.PostDrawTooltipLine(HoverItem, drawableLines[l]);
}
- num25 += (int)(fontMouseText.MeasureString(array[l]).Y + (float)num24);
+ Y += (int)(fontMouseText.MeasureString(array[l]).Y + yOffset);
}
+
+ ItemLoader.PostDrawTooltip(HoverItem, drawableLines.AsReadOnly());
}
- private void MouseText_DrawBuffString(ref int X, ref int Y) {
+ private void MouseText_DrawBuffString(ref int X, ref int Y, int buffNameHeight) {
Microsoft.Xna.Framework.Point p = new Microsoft.Xna.Framework.Point(X, Y);
int num = 220;
int num2 = -1;