Skip to content

Commit ef0d819

Browse files
author
Henning Berge
committed
Merge remote-tracking branch 'origin/master'
2 parents e90a773 + d83cdd7 commit ef0d819

File tree

8 files changed

+54
-26
lines changed

8 files changed

+54
-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
@@ -731,9 +731,9 @@ public static void runClientScripts(Object[] listeners, int arg1, int arg2, Game
731731
if(scriptOpcode < 3100) {
732732
if(scriptOpcode == 3000) {
733733
int i_42_ = scriptIntValues[--intValueIndex];
734-
if(MovedStatics.anInt1819 == -1) {
734+
if(MovedStatics.lastContinueTextWidgetId == -1) {
735735
PacketBuffer.method517(0, i_42_);
736-
MovedStatics.anInt1819 = i_42_;
736+
MovedStatics.lastContinueTextWidgetId = i_42_;
737737
}
738738
} else if(scriptOpcode == 3001 || scriptOpcode == 3003) {
739739
intValueIndex -= 2;
@@ -742,9 +742,9 @@ public static void runClientScripts(Object[] listeners, int arg1, int arg2, Game
742742
Class33.method406(0, i_44_, i_43_, -128);
743743
} else if(scriptOpcode == 3002) {
744744
GameInterface gameInterface = !bool ? Class22_Sub2.aGameInterface_1887 : MovedStatics.aGameInterface_2116;
745-
if(MovedStatics.anInt1819 == -1) {
745+
if(MovedStatics.lastContinueTextWidgetId == -1) {
746746
PacketBuffer.method517(gameInterface.id & 0x7fff, gameInterface.parentId);
747-
MovedStatics.anInt1819 = gameInterface.id;
747+
MovedStatics.lastContinueTextWidgetId = gameInterface.id;
748748
}
749749
} else {
750750
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: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
import java.awt.*;
3535
import java.lang.reflect.Method;
36+
import java.util.ArrayList;
37+
import java.util.List;
3638

3739
public class GameInterface extends CachedNode {
3840
public static GameInterface[][] cachedInterfaces;
@@ -534,6 +536,16 @@ else if(opcode == 1)
534536
return objects;
535537
}
536538

539+
public static boolean isActionWhitelisted(int action) {
540+
List<Integer> whitelistedActionsDuringAnimation = new ArrayList();
541+
542+
// TODO add more actions that should work during a cutscene
543+
whitelistedActionsDuringAnimation.add(54); // Click here to continue
544+
whitelistedActionsDuringAnimation.add(1005); // Cancel
545+
546+
return whitelistedActionsDuringAnimation.contains(action);
547+
}
548+
537549
public static void processMenuActions(int arg0, int arg1) {
538550
if(arg1 >= 0) {
539551
int i = InteractiveObject.firstMenuOperand[arg1];
@@ -542,6 +554,11 @@ public static void processMenuActions(int arg0, int arg1) {
542554
if(action >= 2000) {
543555
action -= 2000;
544556
}
557+
558+
if (Player.cutsceneActive && !GameInterface.isActionWhitelisted(action)) {
559+
return;
560+
}
561+
545562
int i_12_ = Class33.selectedMenuActions[arg1];
546563
if(ChatBox.inputType != 0 && action != 1005) {
547564
ChatBox.inputType = 0;
@@ -1157,7 +1174,7 @@ public static void processMenuActions(int arg0, int arg1) {
11571174
int i_22_ = class1.indexOf(Native.white);
11581175
if(i_22_ != -1) {
11591176
if(gameScreenInterfaceId == -1) {
1160-
PacketBuffer.method516();
1177+
PacketBuffer.closeAllWidgets();
11611178
if(MovedStatics.anInt854 != -1) {
11621179
Native.reportedName = class1.substring(i_22_ + 5).trim();
11631180
HuffmanEncoding.reportAbuseInterfaceID = gameScreenInterfaceId = MovedStatics.anInt854;
@@ -1183,11 +1200,11 @@ public static void processMenuActions(int arg0, int arg1) {
11831200
SceneCluster.packetBuffer.putShortLE(SpotAnimDefinition.baseX + i);
11841201
}
11851202
if(action == 9) {
1186-
PacketBuffer.method516();
1203+
PacketBuffer.closeAllWidgets();
11871204
}
1188-
if(action == 54 && MovedStatics.anInt1819 == -1) {
1205+
if(action == 54 && MovedStatics.lastContinueTextWidgetId == -1) { // Click to continue
11891206
PacketBuffer.method517(0, i_10_);
1190-
MovedStatics.anInt1819 = i_10_;
1207+
MovedStatics.lastContinueTextWidgetId = i_10_;
11911208
}
11921209
if(action == 43) {
11931210
SceneCluster.packetBuffer.putPacket(98);
@@ -1496,7 +1513,7 @@ public static boolean method166(byte arg0, GameInterface arg1) {
14961513
if(i == 620)
14971514
MovedStatics.reportMutePlayer = !MovedStatics.reportMutePlayer;
14981515
if(i >= 601 && i <= 613) {
1499-
PacketBuffer.method516();
1516+
PacketBuffer.closeAllWidgets();
15001517
if(Native.reportedName.length() > 0) {
15011518
SceneCluster.packetBuffer.putPacket(202);
15021519
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)