forked from tModLoader/tModLoader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPorting Notes for 1.4.txt
114 lines (105 loc) · 4.13 KB
/
Porting Notes for 1.4.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
//From ItemSlot, move to Main.shopSellbackHelper
@@ -449,9 +450,13 @@
}
break;
case 3:
- Main.mouseItem.netDefaults(inv[slot].netID);
+ if (!PlayerHooks.CanBuyItem(player, Main.npc[player.talkNPC], inv, inv[slot]))
+ break;
+
+ Main.mouseItem = inv[slot].Clone();
+ Main.mouseItem.stack = 1;
if (inv[slot].buyOnce)
- Main.mouseItem.Prefix(inv[slot].prefix);
+ Main.mouseItem.value *= 5; // preserve item value for items sold to the shop
else
Main.mouseItem.Prefix(-1);
Main.mouseItem.position = player.Center - new Vector2(Main.mouseItem.width, Main.mouseItem.headSlot) / 2f;
//Netplay
@@ -456,16 +696,21 @@
}
int num3 = 0;
+ if (NetMessage.buffer.Any(b => b.checkBytes) || Clients.Any(c => c.PendingTermination)) {
+ InvokeOnMainThread(() => {
+ for (int k = 0; k < 256; k++) {
+ if (NetMessage.buffer[k].checkBytes)
+ NetMessage.CheckBytes(k);
+
+ if (Clients[k].PendingTermination) {
+ Clients[k].Reset();
+ NetMessage.SyncDisconnectedPlayer(k);
+ }
+ }
+ });
+ }
+
for (int k = 0; k < 256; k++) {
- if (NetMessage.buffer[k].checkBytes)
- NetMessage.CheckBytes(k);
-
- if (Clients[k].PendingTermination) {
- Clients[k].Reset();
- NetMessage.SyncDisconnectedPlayer(k);
- continue;
- }
-
if (Clients[k].IsConnected()) {
if (!Clients[k].IsActive)
Clients[k].State = 0;
//Player.ApplyAnnimation was moved
private void ApplyAnimation(Item sItem) {
if (sItem.melee) {
- itemAnimation = (int)((float)sItem.useAnimation * meleeSpeed);
- itemAnimationMax = (int)((float)sItem.useAnimation * meleeSpeed);
+ itemAnimation = PlayerHooks.TotalMeleeTime(sItem.useAnimation * meleeSpeed, this, sItem);
+ itemAnimationMax = itemAnimation;
}
else if (sItem.createTile >= 0) {
- itemAnimation = (int)((float)sItem.useAnimation * tileSpeed);
- itemAnimationMax = (int)((float)sItem.useAnimation * tileSpeed);
+ itemAnimation = PlayerHooks.TotalMeleeTime(sItem.useAnimation * tileSpeed, this, sItem);
+ itemAnimationMax = itemAnimation;
}
else if (sItem.createWall >= 0) {
- itemAnimation = (int)((float)sItem.useAnimation * wallSpeed);
- itemAnimationMax = (int)((float)sItem.useAnimation * wallSpeed);
+ itemAnimation = PlayerHooks.TotalMeleeTime(sItem.useAnimation * wallSpeed, this, sItem);
+ itemAnimationMax = itemAnimation;
}
else {
- itemAnimation = sItem.useAnimation;
- itemAnimationMax = sItem.useAnimation;
- reuseDelay = sItem.reuseDelay;
+ itemAnimation = PlayerHooks.TotalMeleeTime(sItem.useAnimation, this, sItem);
+ itemAnimationMax = itemAnimation;
+ reuseDelay = (int)(sItem.reuseDelay / PlayerHooks.TotalUseTimeMultiplier(this, sItem));
}
}
//"Enable Developer Mode" button
@@ -38128,6 +38945,27 @@
Vector2 origin2 = fontMouseText.MeasureString(text5);
origin2.X *= 0.5f;
origin2.Y *= 0.5f;
+ if (menuMode == 0 && !ModCompile.DeveloperMode) {
+ origin2.Y *= 2;
+ var text = "Enable Developer Mode";
+ // measure and draw text from bottom right
+ var textSize = fontMouseText.MeasureString(text);
+ var pos = new Vector2(screenWidth - 10f + num106, screenHeight - 2f + num107);
+ var d_color = color12;
+ if (num105 == 4) // final draw
+ {
+ var rect = new Microsoft.Xna.Framework.Rectangle((int)(pos.X - textSize.X), (int)(pos.Y - textSize.Y), (int)textSize.X, (int)textSize.Y);
+ bool mouseover = rect.Contains(mouseX, mouseY);
+ d_color = mouseover ? highVersionColor : new Microsoft.Xna.Framework.Color(120, 120, 120, 76);
+ if (mouseover && mouseLeftRelease && mouseLeft) {
+ PlaySound(SoundID.MenuOpen);
+ menuMode = Interface.developerModeHelpID;
+ }
+ }
+
+ spriteBatch.DrawString(fontMouseText, text, pos, d_color, 0f, textSize, 1f, SpriteEffects.None, 0f);
+ }
+
spriteBatch.DrawString(fontMouseText, text5, new Vector2((float)screenWidth - origin2.X + (float)num106 - 10f, (float)screenHeight - origin2.Y + (float)num107 - 2f), color12, 0f, origin2, 1f, SpriteEffects.None, 0f);
}