Skip to content

Commit d83cdd7

Browse files
authored
Merge pull request #56 from hallowatcher/permanent-widgets
Fix permanent dialogue widget animations and interactions
2 parents 21d17f9 + 8960595 commit d83cdd7

File tree

8 files changed

+37
-26
lines changed

8 files changed

+37
-26
lines changed

src/main/java/com/jagex/runescape/Class48.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public static void handleInterfaceActions(int areaId, int mouseX, int mouseY, in
162162
if(gameInterface.actionType == 5 && i_2_ <= mouseX && i_1_ <= mouseY && mouseX < i_2_ + gameInterface.originalWidth && i_1_ + gameInterface.originalHeight > mouseY) {
163163
OverlayDefinition.addActionRow(gameInterface.tooltip, 0, 0, gameInterface.id, 57, "");
164164
}
165-
if(gameInterface.actionType == 6 && MovedStatics.anInt1819 == -1 && i_2_ <= mouseX && i_1_ <= mouseY && mouseX < i_2_ + gameInterface.originalWidth && mouseY < gameInterface.originalHeight + i_1_) {
165+
if(gameInterface.actionType == 6 && MovedStatics.lastContinueTextWidgetId == -1 && i_2_ <= mouseX && i_1_ <= mouseY && mouseX < i_2_ + gameInterface.originalWidth && mouseY < gameInterface.originalHeight + i_1_) {
166166
OverlayDefinition.addActionRow(gameInterface.tooltip, 0, 0, gameInterface.id, 54, "");
167167
}
168168
if(gameInterface.type == GameInterfaceType.INVENTORY) {

src/main/java/com/jagex/runescape/ClientScriptRunner.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -734,9 +734,9 @@ public static void runClientScripts(Object[] listeners, int arg1, int arg2, Game
734734
if(scriptOpcode < 3100) {
735735
if(scriptOpcode == 3000) {
736736
int i_42_ = scriptIntValues[--intValueIndex];
737-
if(MovedStatics.anInt1819 == -1) {
737+
if(MovedStatics.lastContinueTextWidgetId == -1) {
738738
PacketBuffer.method517(0, i_42_);
739-
MovedStatics.anInt1819 = i_42_;
739+
MovedStatics.lastContinueTextWidgetId = i_42_;
740740
}
741741
} else if(scriptOpcode == 3001 || scriptOpcode == 3003) {
742742
intValueIndex -= 2;
@@ -745,9 +745,9 @@ public static void runClientScripts(Object[] listeners, int arg1, int arg2, Game
745745
Class33.method406(0, i_44_, i_43_, -128);
746746
} else if(scriptOpcode == 3002) {
747747
GameInterface gameInterface = !bool ? Class22_Sub2.aGameInterface_1887 : MovedStatics.aGameInterface_2116;
748-
if(MovedStatics.anInt1819 == -1) {
748+
if(MovedStatics.lastContinueTextWidgetId == -1) {
749749
PacketBuffer.method517(gameInterface.id & 0x7fff, gameInterface.parentId);
750-
MovedStatics.anInt1819 = gameInterface.id;
750+
MovedStatics.lastContinueTextWidgetId = gameInterface.id;
751751
}
752752
} else {
753753
if(scriptOpcode != 3003) {

src/main/java/com/jagex/runescape/Main.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ public static boolean drawInterface(int areaId, int minX, int minY, int maxX, in
276276
if (itemDefinition.stackable == 1 || gameInterface.itemAmount != 1)
277277
text = text + Native.aClass1_674 + LinkedList.method903(gameInterface.itemAmount, (byte) -109);
278278
}
279-
if (gameInterface.actionType == 6 && MovedStatics.anInt1819 == gameInterface.id) {
279+
if (gameInterface.actionType == 6 && MovedStatics.lastContinueTextWidgetId == gameInterface.id) {
280280
textColor = gameInterface.textColor;
281281
text = English.pleaseWait;
282282
}
@@ -758,7 +758,7 @@ public static void method44() {
758758
MovedStatics.menuOpen = false;
759759
GroundItemTile.walkableWidgetId = -1;
760760
Native.clickToContinueString = null;
761-
MovedStatics.anInt1819 = -1;
761+
MovedStatics.lastContinueTextWidgetId = -1;
762762
Class51.anInt1205 = -1;
763763
MovedStatics.anInt2118 = 0;
764764
Player.currentTabId = 3;
@@ -988,6 +988,12 @@ public static void drawGameScreen() {
988988
ChatBox.redrawChatbox = true;
989989
}
990990
}
991+
if(ChatBox.dialogueId != -1) {
992+
boolean bool = Renderable.handleSequences(ChatBox.dialogueId);
993+
if(bool) {
994+
ChatBox.redrawChatbox = true;
995+
}
996+
}
991997
if(Class40_Sub5_Sub17_Sub1.atInventoryInterfaceType == 3) {
992998
ChatBox.redrawChatbox = true;
993999
}
@@ -1039,7 +1045,11 @@ public static void drawGameScreen() {
10391045
}
10401046

10411047
if(GameInterface.chatboxInterfaceId != -1) {
1042-
boolean bool = Renderable.handleSequences(GameInterface.chatboxInterfaceId);
1048+
Renderable.handleSequences(GameInterface.chatboxInterfaceId);
1049+
}
1050+
1051+
if(ChatBox.dialogueId != -1) {
1052+
Renderable.handleSequences(ChatBox.dialogueId);
10431053
}
10441054
method353((byte) -114);
10451055
ChatBox.renderChatbox();

src/main/java/com/jagex/runescape/MovedStatics.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public class MovedStatics {
103103
public static boolean aBoolean260 = false;
104104
public static int[][][] anIntArrayArrayArray262;
105105
public static int anInt1806;
106-
public static int anInt1819 = -1;
106+
public static int lastContinueTextWidgetId = -1;
107107
public static Class64 gameConnection;
108108
public static int[][][] tile_height = new int[4][105][105];
109109
public static IndexedImage aClass40_Sub5_Sub14_Sub2_2105;

src/main/java/com/jagex/runescape/cache/media/gameInterface/GameInterface.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,7 @@ public static void processMenuActions(int arg0, int arg1) {
11741174
int i_22_ = class1.indexOf(Native.white);
11751175
if(i_22_ != -1) {
11761176
if(gameScreenInterfaceId == -1) {
1177-
PacketBuffer.method516();
1177+
PacketBuffer.closeAllWidgets();
11781178
if(MovedStatics.anInt854 != -1) {
11791179
Native.reportedName = class1.substring(i_22_ + 5).trim();
11801180
HuffmanEncoding.reportAbuseInterfaceID = gameScreenInterfaceId = MovedStatics.anInt854;
@@ -1200,11 +1200,11 @@ public static void processMenuActions(int arg0, int arg1) {
12001200
SceneCluster.packetBuffer.putShortLE(SpotAnimDefinition.baseX + i);
12011201
}
12021202
if(action == 9) {
1203-
PacketBuffer.method516();
1203+
PacketBuffer.closeAllWidgets();
12041204
}
1205-
if(action == 54 && MovedStatics.anInt1819 == -1) {
1205+
if(action == 54 && MovedStatics.lastContinueTextWidgetId == -1) { // Click to continue
12061206
PacketBuffer.method517(0, i_10_);
1207-
MovedStatics.anInt1819 = i_10_;
1207+
MovedStatics.lastContinueTextWidgetId = i_10_;
12081208
}
12091209
if(action == 43) {
12101210
SceneCluster.packetBuffer.putPacket(98);
@@ -1513,7 +1513,7 @@ public static boolean method166(byte arg0, GameInterface arg1) {
15131513
if(i == 620)
15141514
MovedStatics.reportMutePlayer = !MovedStatics.reportMutePlayer;
15151515
if(i >= 601 && i <= 613) {
1516-
PacketBuffer.method516();
1516+
PacketBuffer.closeAllWidgets();
15171517
if(Native.reportedName.length() > 0) {
15181518
SceneCluster.packetBuffer.putPacket(202);
15191519
SceneCluster.packetBuffer.putLongBE(TextUtils.nameToLong(Native.reportedName));

src/main/java/com/jagex/runescape/frame/ScreenController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ public static void handleChatButtonsClick() {
438438
}
439439
if (x >= 406 && x <= 506 && y >= 0 && y <= 32) {
440440
if (GameInterface.gameScreenInterfaceId == -1) {
441-
PacketBuffer.method516();
441+
PacketBuffer.closeAllWidgets();
442442
if (MovedStatics.anInt854 != -1) {
443443
MovedStatics.reportMutePlayer = false;
444444
HuffmanEncoding.reportAbuseInterfaceID = GameInterface.gameScreenInterfaceId = MovedStatics.anInt854;

src/main/java/com/jagex/runescape/net/IncomingPackets.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ public static boolean parseIncomingPackets(boolean arg0) {
464464
GameInterface.resetInterface(GameInterface.tabAreaInterfaceId);
465465
GameInterface.tabAreaInterfaceId = i_49_;
466466
}
467-
MovedStatics.anInt1819 = -1;
467+
MovedStatics.lastContinueTextWidgetId = -1;
468468
if(ChatBox.inputType != 0) {
469469
ChatBox.redrawChatbox = true;
470470
ChatBox.inputType = 0;
@@ -532,7 +532,7 @@ public static boolean parseIncomingPackets(boolean arg0) {
532532
GameInterface.resetInterface(GameInterface.gameScreenInterfaceId);
533533
GameInterface.gameScreenInterfaceId = i_55_;
534534
}
535-
MovedStatics.anInt1819 = -1;
535+
MovedStatics.lastContinueTextWidgetId = -1;
536536
if(ChatBox.inputType != 0) {
537537
ChatBox.redrawChatbox = true;
538538
ChatBox.inputType = 0;
@@ -563,14 +563,15 @@ public static boolean parseIncomingPackets(boolean arg0) {
563563
incomingPacket = -1;
564564
return true;
565565
}
566-
if(incomingPacket == 185) { // open chatbox interface (multi)
566+
if(incomingPacket == 185) { // open permanent dialogue interface
567567
int chatboxInterfaceId = incomingPacketBuffer.getShortBE();
568568
if(ChatBox.dialogueId != chatboxInterfaceId) {
569569
GameInterface.resetInterface(ChatBox.dialogueId);
570570
ChatBox.dialogueId = chatboxInterfaceId;
571571
}
572572
incomingPacket = -1;
573573
ChatBox.redrawChatbox = true;
574+
MovedStatics.lastContinueTextWidgetId = -1;
574575
return true;
575576
}
576577
if(incomingPacket == SHOW_FULLSCREEN_INTERFACE) {
@@ -602,7 +603,7 @@ public static boolean parseIncomingPackets(boolean arg0) {
602603
GameInterface.resetInterface(GameInterface.fullscreenSiblingInterfaceId);
603604
GameInterface.fullscreenSiblingInterfaceId = siblingInterfaceId;
604605
}
605-
MovedStatics.anInt1819 = -1;
606+
MovedStatics.lastContinueTextWidgetId = -1;
606607
ChatBox.inputType = 0;
607608
incomingPacket = -1;
608609
return true;
@@ -633,7 +634,7 @@ public static boolean parseIncomingPackets(boolean arg0) {
633634
GameInterface.gameScreenInterfaceId = -1;
634635
}
635636
incomingPacket = -1;
636-
MovedStatics.anInt1819 = -1;
637+
MovedStatics.lastContinueTextWidgetId = -1;
637638
if(ChatBox.inputType != 0) {
638639
ChatBox.redrawChatbox = true;
639640
ChatBox.inputType = 0;
@@ -669,7 +670,7 @@ public static boolean parseIncomingPackets(boolean arg0) {
669670

670671
ChatBox.redrawChatbox = true;
671672
incomingPacket = -1;
672-
MovedStatics.anInt1819 = -1;
673+
MovedStatics.lastContinueTextWidgetId = -1;
673674
return true;
674675
}
675676
if(incomingPacket == PLAY_SONG) {
@@ -793,7 +794,7 @@ public static boolean parseIncomingPackets(boolean arg0) {
793794
ChatBox.redrawChatbox = true;
794795
ChatBox.inputType = 0;
795796
}
796-
MovedStatics.anInt1819 = -1;
797+
MovedStatics.lastContinueTextWidgetId = -1;
797798
incomingPacket = -1;
798799
GameInterface.redrawTabArea = true;
799800
return true;

src/main/java/com/jagex/runescape/net/PacketBuffer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ public static void method513(int arg0, CacheArchive arg1, CacheIndex arg2, byte
4545
}
4646

4747

48-
public static void method516() {
48+
public static void closeAllWidgets() {
4949
SceneCluster.packetBuffer.putPacket(176);
5050
if(GameInterface.tabAreaInterfaceId != -1) {
5151
GameInterface.resetInterface(GameInterface.tabAreaInterfaceId);
52-
MovedStatics.anInt1819 = -1;
52+
MovedStatics.lastContinueTextWidgetId = -1;
5353
GameInterface.drawTabIcons = true;
5454
GameInterface.redrawTabArea = true;
5555
GameInterface.tabAreaInterfaceId = -1;
5656
}
5757
if(GameInterface.chatboxInterfaceId != -1) {
5858
GameInterface.resetInterface(GameInterface.chatboxInterfaceId);
59-
MovedStatics.anInt1819 = -1;
59+
MovedStatics.lastContinueTextWidgetId = -1;
6060
ChatBox.redrawChatbox = true;
6161
GameInterface.chatboxInterfaceId = -1;
6262
}
@@ -72,7 +72,7 @@ public static void method516() {
7272
if(GameInterface.gameScreenInterfaceId != -1) {
7373
GameInterface.resetInterface(GameInterface.gameScreenInterfaceId);
7474
GameInterface.gameScreenInterfaceId = -1;
75-
MovedStatics.anInt1819 = -1;
75+
MovedStatics.lastContinueTextWidgetId = -1;
7676
}
7777
}
7878

0 commit comments

Comments
 (0)