Skip to content

Commit

Permalink
Merge pull request runelite#1133 from Joshua-F/refactor/widget
Browse files Browse the repository at this point in the history
Refactor Widget defs
  • Loading branch information
Adam- authored Mar 27, 2018
2 parents e77d503 + edf3f40 commit d345498
Show file tree
Hide file tree
Showing 23 changed files with 301 additions and 273 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public interface Widget

void setContentType(int contentType);

int getConfig();
int setClickMask();

void setConfig(int config);
void setClickMask(int mask);

Widget getParent();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ private void reorderPrayers()
Prayer prayer = prayerOrder[index];
Widget prayerWidget = prayerWidgets.get(prayer.ordinal());

int widgetConfig = prayerWidget.getConfig();
int widgetConfig = prayerWidget.setClickMask();
if (config.unlockPrayerReordering())
{
// allow dragging of this widget
Expand All @@ -401,7 +401,7 @@ private void reorderPrayers()
// remove drag on flag
widgetConfig &= ~DRAG_ON;
}
prayerWidget.setConfig(widgetConfig);
prayerWidget.setClickMask(widgetConfig);

int x = index % PRAYER_COLUMN_COUNT;
int y = index / PRAYER_COLUMN_COUNT;
Expand Down
12 changes: 6 additions & 6 deletions runescape-api/src/main/java/net/runelite/rs/api/RSWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ public interface RSWidget extends Widget
@Import("parentId")
int getRSParentId();

@Import("config")
int getConfig();
@Import("clickMask")
int setClickMask();

@Import("config")
void setConfig(int config);
@Import("clickMask")
void setClickMask(int mask);

@Import("boundsIndex")
int getBoundsIndex();
Expand All @@ -71,10 +71,10 @@ public interface RSWidget extends Widget
@Import("text")
String getRSText();

@Import("name")
@Import("opBase")
String getRSName();

@Import("name")
@Import("opBase")
void setRSName(String name);

@Import("text")
Expand Down
4 changes: 2 additions & 2 deletions runescape-client/src/main/java/AbstractSoundSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,8 @@ static int method2265(int var0, Script var1, boolean var2) {
var3.rotationX = var6.xan2d;
var3.rotationZ = var6.yan2d;
var3.rotationY = var6.zan2d;
var3.field2866 = var6.offsetX2d;
var3.field2867 = var6.offsetY2d;
var3.offsetX2d = var6.offsetX2d;
var3.offsetY2d = var6.offsetY2d;
var3.modelZoom = var6.zoom2d;
if(var0 == 1205) {
var3.field2864 = 0;
Expand Down
20 changes: 10 additions & 10 deletions runescape-client/src/main/java/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -3247,7 +3247,7 @@ final void method1552() {
var33 = 0;
}

if(class154.method3149(GrandExchangeEvent.getWidgetConfig(var43))) {
if(class154.method3149(GrandExchangeEvent.getWidgetClickMask(var43))) {
var6 = field998;
var7 = field1090;
var43.itemIds[var7] = var43.itemIds[var6];
Expand Down Expand Up @@ -4867,8 +4867,8 @@ final boolean method1268(NetWriter var1) {
var65.rotationX = var73.xan2d;
var65.rotationZ = var73.yan2d;
var65.rotationY = var73.zan2d;
var65.field2866 = var73.offsetX2d;
var65.field2867 = var73.offsetY2d;
var65.offsetX2d = var73.offsetX2d;
var65.offsetY2d = var73.offsetY2d;
var65.modelZoom = var73.zoom2d;
if(var73.isStackable == 1) {
var65.field2864 = 1;
Expand Down Expand Up @@ -5809,7 +5809,7 @@ final void method1264() {
var5 = menuActionParams0[var2];
var20 = menuActionParams1[var2];
Widget var16 = GZipDecompressor.getWidget(var20);
if(class153.method3142(GrandExchangeEvent.getWidgetConfig(var16)) || class154.method3149(GrandExchangeEvent.getWidgetConfig(var16))) {
if(class153.method3142(GrandExchangeEvent.getWidgetClickMask(var16)) || class154.method3149(GrandExchangeEvent.getWidgetClickMask(var16))) {
if(MapIconReference.field574 != null && !field960 && menuOptionCount > 0 && !this.method1270()) {
class153.method3140(field957, field958);
}
Expand Down Expand Up @@ -5986,32 +5986,32 @@ final void method1432() {

int var3 = var1 - field1028;
int var4 = var2 - field944;
int var5 = draggedWidget.field2817;
if(MapLabel.field446 > draggedWidget.field2894 && (var3 > var5 || var3 < -var5 || var4 > var5 || var4 < -var5)) {
int var5 = draggedWidget.dragDeadZone;
if(MapLabel.field446 > draggedWidget.dragDeadTime && (var3 > var5 || var3 < -var5 || var4 > var5 || var4 < -var5)) {
draggingWidget = true;
}

int var6 = var1 - field1025 + field1020.scrollX;
int var7 = var2 - field1098 + field1020.scrollY;
ScriptEvent var8;
if(draggedWidget.field2906 != null && draggingWidget) {
if(draggedWidget.onDragListener != null && draggingWidget) {
var8 = new ScriptEvent();
var8.widget = draggedWidget;
var8.field782 = var6;
var8.field789 = var7;
var8.objs = draggedWidget.field2906;
var8.objs = draggedWidget.onDragListener;
class25.runScript(var8, 500000);
}

if(MouseInput.mouseCurrentButton == 0) {
if(draggingWidget) {
if(draggedWidget.field2907 != null) {
if(draggedWidget.onDragCompleteListener != null) {
var8 = new ScriptEvent();
var8.widget = draggedWidget;
var8.field782 = var6;
var8.field789 = var7;
var8.field785 = draggedOnWidget;
var8.objs = draggedWidget.field2907;
var8.objs = draggedWidget.onDragCompleteListener;
class25.runScript(var8, 500000);
}

Expand Down
8 changes: 4 additions & 4 deletions runescape-client/src/main/java/FileRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ static final void gameDraw(Widget[] var0, int var1, int var2, int var3, int var4
int var15;
int var16;
if(var10 == Client.draggedWidget) {
if(var1 != -1412584499 && !var10.field2895) {
if(var1 != -1412584499 && !var10.dragRenderBehavior) {
class2.field14 = var0;
ItemContainer.field746 = var6;
WorldComparator.field262 = var7;
Expand Down Expand Up @@ -143,7 +143,7 @@ static final void gameDraw(Widget[] var0, int var1, int var2, int var3, int var4
var13 = var16;
}

if(!var10.field2895) {
if(!var10.dragRenderBehavior) {
var14 = 128;
}
}
Expand Down Expand Up @@ -701,9 +701,9 @@ static final void gameDraw(Widget[] var0, int var1, int var2, int var3, int var4
} else {
var51.calculateBoundsCylinder();
if(var10.field2874) {
var51.method2703(0, var10.rotationZ, var10.rotationY, var10.rotationX, var10.field2866, var22 + var23 + var10.field2867, var24 + var10.field2867, var10.modelZoom);
var51.method2703(0, var10.rotationZ, var10.rotationY, var10.rotationX, var10.offsetX2d, var22 + var23 + var10.offsetY2d, var24 + var10.offsetY2d, var10.modelZoom);
} else {
var51.method2702(0, var10.rotationZ, var10.rotationY, var10.rotationX, var10.field2866, var22 + var23 + var10.field2867, var24 + var10.field2867);
var51.method2702(0, var10.rotationZ, var10.rotationY, var10.rotationX, var10.offsetX2d, var22 + var23 + var10.offsetY2d, var24 + var10.offsetY2d);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions runescape-client/src/main/java/Fonts.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ public static String method5483(CharSequence var0) {
static void method5482() {
if(Client.spellSelected) {
Widget var0 = CollisionData.getWidgetChild(Resampler.field1597, Client.field1050);
if(var0 != null && var0.field2807 != null) {
if(var0 != null && var0.onTargetLeaveListener != null) {
ScriptEvent var1 = new ScriptEvent();
var1.widget = var0;
var1.objs = var0.field2807;
var1.objs = var0.onTargetLeaveListener;
class25.runScript(var1, 500000);
}

Expand Down
4 changes: 2 additions & 2 deletions runescape-client/src/main/java/GZipDecompressor.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ static int method3475(int var0, Script var1, boolean var2) {
return 1;
} else if(var0 == 1109) {
class5.intStackSize -= 6;
var3.field2866 = class81.intStack[class5.intStackSize];
var3.field2867 = class81.intStack[class5.intStackSize + 1];
var3.offsetX2d = class81.intStack[class5.intStackSize];
var3.offsetY2d = class81.intStack[class5.intStackSize + 1];
var3.rotationX = class81.intStack[class5.intStackSize + 2];
var3.rotationZ = class81.intStack[class5.intStackSize + 3];
var3.rotationY = class81.intStack[class5.intStackSize + 4];
Expand Down
62 changes: 31 additions & 31 deletions runescape-client/src/main/java/GameObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,69 +143,69 @@ static int method3072(int var0, Script var1, boolean var2) {
}

if(var0 == 1400) {
var3.field2899 = var8;
var3.onClickListener = var8;
} else if(var0 == 1401) {
var3.field2902 = var8;
var3.onHoldListener = var8;
} else if(var0 == 1402) {
var3.field2901 = var8;
var3.onReleaseListener = var8;
} else if(var0 == 1403) {
var3.mouseEnterListener = var8;
var3.onMouseOverListener = var8;
} else if(var0 == 1404) {
var3.mouseExitListener = var8;
var3.onMouseLeaveListener = var8;
} else if(var0 == 1405) {
var3.field2906 = var8;
var3.onDragListener = var8;
} else if(var0 == 1406) {
var3.field2807 = var8;
var3.onTargetLeaveListener = var8;
} else if(var0 == 1407) {
var3.configListenerArgs = var8;
var3.configTriggers = var5;
var3.onVarTransmitListener = var8;
var3.varTransmitTriggers = var5;
} else if(var0 == 1408) {
var3.renderListener = var8;
var3.onTimerListener = var8;
} else if(var0 == 1409) {
var3.field2917 = var8;
var3.onOpListener = var8;
} else if(var0 == 1410) {
var3.field2907 = var8;
var3.onDragCompleteListener = var8;
} else if(var0 == 1411) {
var3.field2900 = var8;
var3.onClickRepeatListener = var8;
} else if(var0 == 1412) {
var3.mouseHoverListener = var8;
var3.onMouseRepeatListener = var8;
} else if(var0 == 1414) {
var3.tableListenerArgs = var8;
var3.tableModTriggers = var5;
var3.onInvTransmitListener = var8;
var3.invTransmitTriggers = var5;
} else if(var0 == 1415) {
var3.skillListenerArgs = var8;
var3.skillTriggers = var5;
var3.onStatTransmitListener = var8;
var3.statTransmitTriggers = var5;
} else if(var0 == 1416) {
var3.field2908 = var8;
var3.onTargetEnterListener = var8;
} else if(var0 == 1417) {
var3.scrollListener = var8;
var3.onScrollWheelListener = var8;
} else if(var0 == 1418) {
var3.field2919 = var8;
var3.onChatTransmitListener = var8;
} else if(var0 == 1419) {
var3.field2920 = var8;
var3.onKeyListener = var8;
} else if(var0 == 1420) {
var3.field2921 = var8;
var3.onFriendTransmitListener = var8;
} else if(var0 == 1421) {
var3.field2922 = var8;
var3.onClanTransmitListener = var8;
} else if(var0 == 1422) {
var3.field2923 = var8;
var3.onMiscTransmitListener = var8;
} else if(var0 == 1423) {
var3.field2924 = var8;
var3.onDialogAbortListener = var8;
} else if(var0 == 1424) {
var3.field2925 = var8;
var3.onSubChangeListener = var8;
} else if(var0 == 1425) {
var3.field2873 = var8;
var3.onStockTransmitListener = var8;
} else if(var0 == 1426) {
var3.field2820 = var8;
var3.onCamFinishedListener = var8;
} else {
if(var0 != 1427) {
return 2;
}

var3.field2926 = var8;
var3.onResizeListener = var8;
}

var3.mouseActionsPresent = true;
var3.hasListener = true;
return 1;
}
}
12 changes: 6 additions & 6 deletions runescape-client/src/main/java/GrandExchangeEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,16 @@ static int method88(int var0, Script var1, boolean var2) {
if(var0 == 1800) {
int[] var4 = class81.intStack;
int var5 = ++class5.intStackSize - 1;
int var7 = getWidgetConfig(var3);
int var7 = getWidgetClickMask(var3);
int var6 = var7 >> 11 & 63;
var4[var5] = var6;
return 1;
} else if(var0 != 1801) {
if(var0 == 1802) {
if(var3.name == null) {
if(var3.opBase == null) {
class81.scriptStringStack[++class316.scriptStringStackSize - 1] = "";
} else {
class81.scriptStringStack[++class316.scriptStringStackSize - 1] = var3.name;
class81.scriptStringStack[++class316.scriptStringStackSize - 1] = var3.opBase;
}

return 1;
Expand All @@ -148,9 +148,9 @@ static int method88(int var0, Script var1, boolean var2) {
signature = "(Lig;I)I",
garbageValue = "400254367"
)
@Export("getWidgetConfig")
static int getWidgetConfig(Widget var0) {
@Export("getWidgetClickMask")
static int getWidgetClickMask(Widget var0) {
IntegerNode var1 = (IntegerNode)Client.widgetFlags.get((long)var0.index + ((long)var0.id << 32));
return var1 != null?var1.value:var0.config;
return var1 != null?var1.value:var0.clickMask;
}
}
2 changes: 1 addition & 1 deletion runescape-client/src/main/java/RunException.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static synchronized byte[] method3218(int var0) {
garbageValue = "1"
)
static Widget method3217(Widget var0) {
int var1 = GrandExchangeOffer.method124(GrandExchangeEvent.getWidgetConfig(var0));
int var1 = GrandExchangeOffer.method124(GrandExchangeEvent.getWidgetClickMask(var0));
if(var1 == 0) {
return null;
} else {
Expand Down
10 changes: 5 additions & 5 deletions runescape-client/src/main/java/SoundTaskDataProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,19 @@ static int method837(int var0, Script var1, boolean var2) {
var3.dragParent = CollisionData.getWidgetChild(var4, var5);
return 1;
} else if(var0 == 1302) {
var3.field2895 = class81.intStack[--class5.intStackSize] == 1;
var3.dragRenderBehavior = class81.intStack[--class5.intStackSize] == 1;
return 1;
} else if(var0 == 1303) {
var3.field2817 = class81.intStack[--class5.intStackSize];
var3.dragDeadZone = class81.intStack[--class5.intStackSize];
return 1;
} else if(var0 == 1304) {
var3.field2894 = class81.intStack[--class5.intStackSize];
var3.dragDeadTime = class81.intStack[--class5.intStackSize];
return 1;
} else if(var0 == 1305) {
var3.name = class81.scriptStringStack[--class316.scriptStringStackSize];
var3.opBase = class81.scriptStringStack[--class316.scriptStringStackSize];
return 1;
} else if(var0 == 1306) {
var3.selectedAction = class81.scriptStringStack[--class316.scriptStringStackSize];
var3.targetVerb = class81.scriptStringStack[--class316.scriptStringStackSize];
return 1;
} else if(var0 == 1307) {
var3.actions = null;
Expand Down
Loading

0 comments on commit d345498

Please sign in to comment.