Constants: IfType#MODEL_TYPE_*
Renamed: LocType#options Renamed: NPCType#getHeadModel Renamed: ObjType#getInterfaceModel Renamed: PlayerEntity#getHeadModel Constants: Game#*OP_ACTION Added: Game#addMenuOption Refactored: All menu options now call Game#addMenuOption drastically reducing code size.
This commit is contained in:
1 parent
eabcae3563
commit
7e04d13ff1
7 files changed
+605
-808
No files matched your search
+171
-395
@@ -41,6 +41,11 @@ public class Game extends GameShell {
|
||||
public static boolean showOccluders;
|
||||
public static int loopCycle;
|
||||
public static boolean flagged;
|
||||
public static final int[] INV_OP_ACTION = {632,78,867,431,53};
|
||||
public static final int[] OBJ_OP_ACTION = {652,567,234,244,214};
|
||||
public static final int[] OBJ_IOP_ACTION = {74,454,539,493, 847};
|
||||
public static final int[] LOC_OP_ACTION = {502,900,113,872,1062};
|
||||
public static final int[] NPC_OP_ACTION = {20,412,225,965,478};
|
||||
|
||||
static {
|
||||
levelExperience = new int[99];
|
||||
@@ -2130,10 +2135,7 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
if (!override) {
|
||||
menuOption[menuSize] = child.option;
|
||||
menuAction[menuSize] = 315;
|
||||
menuParamB[menuSize] = child.id;
|
||||
menuSize++;
|
||||
addMenuOption(child.option, 315, 0, child.id, 0);
|
||||
}
|
||||
} else if (child.optionType == IfType.OPTION_TYPE_SPELL) {
|
||||
if (spellSelected == 0) {
|
||||
@@ -2141,176 +2143,107 @@ public class Game extends GameShell {
|
||||
if (prefix.contains(" ")) {
|
||||
prefix = prefix.substring(0, prefix.indexOf(" "));
|
||||
}
|
||||
menuOption[menuSize] = prefix + " @gre@" + child.spellName;
|
||||
menuAction[menuSize] = 626;
|
||||
menuParamB[menuSize] = child.id;
|
||||
menuSize++;
|
||||
addMenuOption(prefix + " @gre@" + child.spellName, 626, 0, child.id, 0);
|
||||
}
|
||||
} else if (child.optionType == IfType.OPTION_TYPE_CLOSE) {
|
||||
menuOption[menuSize] = "Close";
|
||||
menuAction[menuSize] = 200;
|
||||
menuParamB[menuSize] = child.id;
|
||||
menuSize++;
|
||||
addMenuOption("Close", 200, 0, child.id, 0);
|
||||
} else if (child.optionType == IfType.OPTION_TYPE_TOGGLE) {
|
||||
menuOption[menuSize] = child.option;
|
||||
menuAction[menuSize] = 169;
|
||||
menuParamB[menuSize] = child.id;
|
||||
menuSize++;
|
||||
addMenuOption(child.option, 169, 0, child.id, 0);
|
||||
} else if (child.optionType == IfType.OPTION_TYPE_SELECT) {
|
||||
menuOption[menuSize] = child.option;
|
||||
menuAction[menuSize] = 646;
|
||||
menuParamB[menuSize] = child.id;
|
||||
menuSize++;
|
||||
addMenuOption(child.option, 646, 0, child.id, 0);
|
||||
} else if (child.optionType == IfType.OPTION_TYPE_CONTINUE) {
|
||||
if (!pressedContinueOption) {
|
||||
menuOption[menuSize] = child.option;
|
||||
menuAction[menuSize] = 679;
|
||||
menuParamB[menuSize] = child.id;
|
||||
menuSize++;
|
||||
addMenuOption(child.option, 679, 0, child.id, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleInterfaceInventoryInput(int interfaceX, int interfaceY, IfType child) {
|
||||
int mouseY = super.mouseY;
|
||||
int mouseX = super.mouseX;
|
||||
|
||||
|
||||
private void handleInterfaceInventoryInput(int x, int y, IfType iface) {
|
||||
int slot = 0;
|
||||
for (int row = 0; row < child.height; row++) {
|
||||
for (int column = 0; column < child.width; column++) {
|
||||
int x = interfaceX + (column * (32 + child.inventoryMarginX));
|
||||
int y = interfaceY + (row * (32 + child.inventoryMarginY));
|
||||
|
||||
for (int row = 0; row < iface.height; row++) {
|
||||
for (int col = 0; col < iface.width; col++) {
|
||||
int slotX = x + (col * (32 + iface.inventoryMarginX));
|
||||
int slotY = y + (row * (32 + iface.inventoryMarginY));
|
||||
|
||||
if (slot < 20) {
|
||||
x += child.inventorySlotOffsetX[slot];
|
||||
y += child.inventorySlotOffsetY[slot];
|
||||
slotX += iface.inventorySlotOffsetX[slot];
|
||||
slotY += iface.inventorySlotOffsetY[slot];
|
||||
}
|
||||
|
||||
if ((mouseX >= x) && (mouseY >= y) && (mouseX < (x + 32)) && (mouseY < (y + 32))) {
|
||||
hoveredSlot = slot;
|
||||
hoveredSlotParentID = child.id;
|
||||
if ((super.mouseX < slotX) || (super.mouseY < slotY) || (super.mouseX >= (slotX + 32)) || (super.mouseY >= (slotY + 32))) {
|
||||
slot++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (child.inventorySlotObjID[slot] > 0) {
|
||||
ObjType obj = ObjType.get(child.inventorySlotObjID[slot] - 1);
|
||||
hoveredSlot = slot;
|
||||
hoveredSlotParentID = iface.id;
|
||||
|
||||
if ((objSelected == 1) && child.inventoryInteractable) {
|
||||
if ((child.id != selectedObjInterfaceID) || (slot != selectedObjSlot)) {
|
||||
menuOption[menuSize] = "Use " + selectedObjName + " with @lre@" + obj.name;
|
||||
menuAction[menuSize] = 870;
|
||||
menuParamC[menuSize] = obj.id;
|
||||
menuParamA[menuSize] = slot;
|
||||
menuParamB[menuSize] = child.id;
|
||||
menuSize++;
|
||||
}
|
||||
} else if ((spellSelected == 1) && child.inventoryInteractable) {
|
||||
if ((activeSpellFlags & 0x10) == 0x10) {
|
||||
menuOption[menuSize] = spellCaption + " @lre@" + obj.name;
|
||||
menuAction[menuSize] = 543;
|
||||
menuParamC[menuSize] = obj.id;
|
||||
menuParamA[menuSize] = slot;
|
||||
menuParamB[menuSize] = child.id;
|
||||
menuSize++;
|
||||
}
|
||||
} else {
|
||||
if (child.inventoryInteractable) {
|
||||
for (int option = 4; option >= 3; option--) {
|
||||
if ((obj.inventoryOptions != null) && (obj.inventoryOptions[option] != null)) {
|
||||
menuOption[menuSize] = obj.inventoryOptions[option] + " @lre@" + obj.name;
|
||||
if (option == 3) {
|
||||
menuAction[menuSize] = 493;
|
||||
}
|
||||
if (option == 4) {
|
||||
menuAction[menuSize] = 847;
|
||||
}
|
||||
menuParamC[menuSize] = obj.id;
|
||||
menuParamA[menuSize] = slot;
|
||||
menuParamB[menuSize] = child.id;
|
||||
menuSize++;
|
||||
} else if (option == 4) {
|
||||
menuOption[menuSize] = "Drop @lre@" + obj.name;
|
||||
menuAction[menuSize] = 847;
|
||||
menuParamC[menuSize] = obj.id;
|
||||
menuParamA[menuSize] = slot;
|
||||
menuParamB[menuSize] = child.id;
|
||||
menuSize++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (iface.inventorySlotObjID[slot] <= 0) {
|
||||
slot++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (child.inventoryUsable) {
|
||||
menuOption[menuSize] = "Use @lre@" + obj.name;
|
||||
menuAction[menuSize] = 447;
|
||||
menuParamC[menuSize] = obj.id;
|
||||
menuParamA[menuSize] = slot;
|
||||
menuParamB[menuSize] = child.id;
|
||||
menuSize++;
|
||||
}
|
||||
ObjType obj = ObjType.get(iface.inventorySlotObjID[slot] - 1);
|
||||
|
||||
if (child.inventoryInteractable && (obj.inventoryOptions != null)) {
|
||||
for (int option = 2; option >= 0; option--) {
|
||||
if (obj.inventoryOptions[option] != null) {
|
||||
menuOption[menuSize] = obj.inventoryOptions[option] + " @lre@" + obj.name;
|
||||
if (option == 0) {
|
||||
menuAction[menuSize] = 74;
|
||||
}
|
||||
if (option == 1) {
|
||||
menuAction[menuSize] = 454;
|
||||
}
|
||||
if (option == 2) {
|
||||
menuAction[menuSize] = 539;
|
||||
}
|
||||
menuParamC[menuSize] = obj.id;
|
||||
menuParamA[menuSize] = slot;
|
||||
menuParamB[menuSize] = child.id;
|
||||
menuSize++;
|
||||
}
|
||||
}
|
||||
if ((objSelected == 1) && iface.inventoryInteractable) {
|
||||
if ((iface.id != selectedObjInterfaceID) || (slot != selectedObjSlot)) {
|
||||
addMenuOption("Use " + selectedObjName + " with @lre@" + obj.name, 870, slot, iface.id, obj.id);
|
||||
}
|
||||
} else if ((spellSelected == 1) && iface.inventoryInteractable) {
|
||||
if ((activeSpellFlags & 0x10) == 0x10) {
|
||||
addMenuOption(spellCaption + " @lre@" + obj.name, 543, slot, iface.id, obj.id);
|
||||
}
|
||||
} else {
|
||||
if (iface.inventoryInteractable) {
|
||||
for (int op = 4; op >= 3; op--) {
|
||||
if ((obj.inventoryOptions != null) && (obj.inventoryOptions[op] != null)) {
|
||||
addMenuOption(obj.inventoryOptions[op] + " @lre@" + obj.name, OBJ_IOP_ACTION[op], slot, iface.id, obj.id);
|
||||
} else if (op == 4) {
|
||||
addMenuOption("Drop @lre@" + obj.name, 847, slot, iface.id, obj.id);
|
||||
}
|
||||
if (child.inventoryOptions != null) {
|
||||
for (int option = 4; option >= 0; option--) {
|
||||
if (child.inventoryOptions[option] != null) {
|
||||
menuOption[menuSize] = child.inventoryOptions[option] + " @lre@" + obj.name;
|
||||
if (option == 0) {
|
||||
menuAction[menuSize] = 632;
|
||||
}
|
||||
if (option == 1) {
|
||||
menuAction[menuSize] = 78;
|
||||
}
|
||||
if (option == 2) {
|
||||
menuAction[menuSize] = 867;
|
||||
}
|
||||
if (option == 3) {
|
||||
menuAction[menuSize] = 431;
|
||||
}
|
||||
if (option == 4) {
|
||||
menuAction[menuSize] = 53;
|
||||
}
|
||||
menuParamC[menuSize] = obj.id;
|
||||
menuParamA[menuSize] = slot;
|
||||
menuParamB[menuSize] = child.id;
|
||||
menuSize++;
|
||||
}
|
||||
}
|
||||
}
|
||||
menuOption[menuSize] = "Examine @lre@" + obj.name;
|
||||
menuAction[menuSize] = 1125;
|
||||
menuParamC[menuSize] = obj.id;
|
||||
menuParamA[menuSize] = slot;
|
||||
menuParamB[menuSize] = child.id;
|
||||
menuSize++;
|
||||
}
|
||||
}
|
||||
|
||||
if (iface.inventoryUsable) {
|
||||
addMenuOption("Use @lre@" + obj.name, 447, slot, iface.id, obj.id);
|
||||
}
|
||||
|
||||
if (iface.inventoryInteractable && (obj.inventoryOptions != null)) {
|
||||
for (int op = 2; op >= 0; op--) {
|
||||
if (obj.inventoryOptions[op] != null) {
|
||||
addMenuOption(obj.inventoryOptions[op] + " @lre@" + obj.name, OBJ_IOP_ACTION[op], slot, iface.id, obj.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (iface.inventoryOptions != null) {
|
||||
for (int op = 4; op >= 0; op--) {
|
||||
if (iface.inventoryOptions[op] != null) {
|
||||
addMenuOption(iface.inventoryOptions[op] + " @lre@" + obj.name, INV_OP_ACTION[op], slot, iface.id, obj.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addMenuOption("Examine @lre@" + obj.name, 1125, slot, iface.id, obj.id);
|
||||
}
|
||||
slot++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addMenuOption(String option, int action) {
|
||||
addMenuOption(option, action, 0, 0, 0);
|
||||
}
|
||||
|
||||
public void addMenuOption(String option, int action, int a, int b, int c) {
|
||||
menuOption[menuSize] = option;
|
||||
menuAction[menuSize] = action;
|
||||
menuParamC[menuSize] = c;
|
||||
menuParamA[menuSize] = a;
|
||||
menuParamB[menuSize] = b;
|
||||
menuParamC[menuSize] = c;
|
||||
menuSize++;
|
||||
}
|
||||
|
||||
@@ -5814,11 +5747,7 @@ public class Game extends GameShell {
|
||||
|
||||
public void handleViewportOptions() {
|
||||
if ((objSelected == 0) && (spellSelected == 0)) {
|
||||
menuOption[menuSize] = "Walk here";
|
||||
menuAction[menuSize] = 516;
|
||||
menuParamA[menuSize] = super.mouseX;
|
||||
menuParamB[menuSize] = super.mouseY;
|
||||
menuSize++;
|
||||
addMenuOption("Walk here", 516, super.mouseX, super.mouseY, 0);
|
||||
}
|
||||
|
||||
int lastBitset = -1;
|
||||
@@ -5863,54 +5792,20 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
if (objSelected == 1) {
|
||||
menuOption[menuSize] = "Use " + selectedObjName + " with @cya@" + loc.name;
|
||||
menuAction[menuSize] = 62;
|
||||
menuParamC[menuSize] = bitset;
|
||||
menuParamA[menuSize] = x;
|
||||
menuParamB[menuSize] = z;
|
||||
menuSize++;
|
||||
addMenuOption("Use " + selectedObjName + " with @cya@" + loc.name, 62, x, z, bitset);
|
||||
} else if (spellSelected == 1) {
|
||||
if ((activeSpellFlags & 4) == 4) {
|
||||
menuOption[menuSize] = spellCaption + " @cya@" + loc.name;
|
||||
menuAction[menuSize] = 956;
|
||||
menuParamC[menuSize] = bitset;
|
||||
menuParamA[menuSize] = x;
|
||||
menuParamB[menuSize] = z;
|
||||
menuSize++;
|
||||
addMenuOption(spellCaption + " @cya@" + loc.name, 956, x, z, bitset);
|
||||
}
|
||||
} else {
|
||||
if (loc.actions != null) {
|
||||
for (int i2 = 4; i2 >= 0; i2--) {
|
||||
if (loc.actions[i2] != null) {
|
||||
menuOption[menuSize] = loc.actions[i2] + " @cya@" + loc.name;
|
||||
if (i2 == 0) {
|
||||
menuAction[menuSize] = 502;
|
||||
}
|
||||
if (i2 == 1) {
|
||||
menuAction[menuSize] = 900;
|
||||
}
|
||||
if (i2 == 2) {
|
||||
menuAction[menuSize] = 113;
|
||||
}
|
||||
if (i2 == 3) {
|
||||
menuAction[menuSize] = 872;
|
||||
}
|
||||
if (i2 == 4) {
|
||||
menuAction[menuSize] = 1062;
|
||||
}
|
||||
menuParamC[menuSize] = bitset;
|
||||
menuParamA[menuSize] = x;
|
||||
menuParamB[menuSize] = z;
|
||||
menuSize++;
|
||||
if (loc.options != null) {
|
||||
for (int op = 4; op >= 0; op--) {
|
||||
if (loc.options[op] != null) {
|
||||
addMenuOption(loc.options[op] + " @cya@" + loc.name, LOC_OP_ACTION[op], x,z,bitset);
|
||||
}
|
||||
}
|
||||
}
|
||||
menuOption[menuSize] = "Examine @cya@" + loc.name;
|
||||
menuAction[menuSize] = 1226;
|
||||
menuParamC[menuSize] = loc.index << 14;
|
||||
menuParamA[menuSize] = x;
|
||||
menuParamB[menuSize] = z;
|
||||
menuSize++;
|
||||
addMenuOption("Examine @cya@" + loc.name, 1226, x, z, loc.index << 14);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5968,58 +5863,21 @@ public class Game extends GameShell {
|
||||
ObjType type = ObjType.get(obj.id);
|
||||
|
||||
if (objSelected == 1) {
|
||||
menuOption[menuSize] = "Use " + selectedObjName + " with @lre@" + type.name;
|
||||
menuAction[menuSize] = 511;
|
||||
menuParamC[menuSize] = obj.id;
|
||||
menuParamA[menuSize] = x;
|
||||
menuParamB[menuSize] = z;
|
||||
menuSize++;
|
||||
addMenuOption("Use " + selectedObjName + " with @lre@" + type.name, 511, x, z, obj.id);
|
||||
} else if (spellSelected == 1) {
|
||||
if ((activeSpellFlags & 1) == 1) {
|
||||
menuOption[menuSize] = spellCaption + " @lre@" + type.name;
|
||||
menuAction[menuSize] = 94;
|
||||
menuParamC[menuSize] = obj.id;
|
||||
menuParamA[menuSize] = x;
|
||||
menuParamB[menuSize] = z;
|
||||
menuSize++;
|
||||
addMenuOption(spellCaption + " @lre@" + type.name, 94, x, z, obj.id);
|
||||
}
|
||||
} else {
|
||||
for (int option = 4; option >= 0; option--) {
|
||||
if ((type.options != null) && (type.options[option] != null)) {
|
||||
menuOption[menuSize] = type.options[option] + " @lre@" + type.name;
|
||||
|
||||
if (option == 0) {
|
||||
menuAction[menuSize] = 652;
|
||||
} else if (option == 1) {
|
||||
menuAction[menuSize] = 567;
|
||||
} else if (option == 2) {
|
||||
menuAction[menuSize] = 234;
|
||||
} else if (option == 3) {
|
||||
menuAction[menuSize] = 244;
|
||||
} else if (option == 4) {
|
||||
menuAction[menuSize] = 213;
|
||||
}
|
||||
|
||||
menuParamC[menuSize] = obj.id;
|
||||
menuParamA[menuSize] = x;
|
||||
menuParamB[menuSize] = z;
|
||||
menuSize++;
|
||||
} else if (option == 2) {
|
||||
menuOption[menuSize] = "Take @lre@" + type.name;
|
||||
menuAction[menuSize] = 234;
|
||||
menuParamC[menuSize] = obj.id;
|
||||
menuParamA[menuSize] = x;
|
||||
menuParamB[menuSize] = z;
|
||||
menuSize++;
|
||||
for (int op = 4; op >= 0; op--) {
|
||||
if ((type.options != null) && (type.options[op] != null)) {
|
||||
addMenuOption(type.options[op] + " @lre@" + type.name, OBJ_OP_ACTION[op], x,z,obj.id);
|
||||
} else if (op == 2) {
|
||||
addMenuOption("Take @lre@" + type.name, 234, x, z, obj.id);
|
||||
}
|
||||
}
|
||||
|
||||
menuOption[menuSize] = "Examine @lre@" + type.name;
|
||||
menuAction[menuSize] = 1448;
|
||||
menuParamC[menuSize] = obj.id;
|
||||
menuParamA[menuSize] = x;
|
||||
menuParamB[menuSize] = z;
|
||||
menuSize++;
|
||||
addMenuOption("Examine @lre@" + type.name, 1448, x, z, obj.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6356,16 +6214,10 @@ public class Game extends GameShell {
|
||||
if (((type == 1) || (type == 2)) && ((type == 1) || (publicChatSetting == 0) || ((publicChatSetting == 1) && isFriend(s)))) {
|
||||
if ((mouseY > (y - 14)) && (mouseY <= y) && !s.equals(localPlayer.name)) {
|
||||
if (rights >= 1) {
|
||||
menuOption[menuSize] = "Report abuse @whi@" + s;
|
||||
menuAction[menuSize] = 606;
|
||||
menuSize++;
|
||||
addMenuOption("Report abuse @whi@" + s, 606);
|
||||
}
|
||||
menuOption[menuSize] = "Add ignore @whi@" + s;
|
||||
menuAction[menuSize] = 42;
|
||||
menuSize++;
|
||||
menuOption[menuSize] = "Add friend @whi@" + s;
|
||||
menuAction[menuSize] = 337;
|
||||
menuSize++;
|
||||
addMenuOption("Add ignore @whi@" + s, 42);
|
||||
addMenuOption("Add friend @whi@" + s, 337);
|
||||
}
|
||||
line++;
|
||||
}
|
||||
@@ -6373,35 +6225,28 @@ public class Game extends GameShell {
|
||||
if (((type == 3) || (type == 7)) && (splitPrivateChat == 0) && ((type == 7) || (privateChatSetting == 0) || ((privateChatSetting == 1) && isFriend(s)))) {
|
||||
if ((mouseY > (y - 14)) && (mouseY <= y)) {
|
||||
if (rights >= 1) {
|
||||
menuOption[menuSize] = "Report abuse @whi@" + s;
|
||||
menuAction[menuSize] = 606;
|
||||
menuSize++;
|
||||
addMenuOption("Report abuse @whi@" + s, 606);
|
||||
}
|
||||
menuOption[menuSize] = "Add ignore @whi@" + s;
|
||||
menuAction[menuSize] = 42;
|
||||
menuSize++;
|
||||
menuOption[menuSize] = "Add friend @whi@" + s;
|
||||
menuAction[menuSize] = 337;
|
||||
menuSize++;
|
||||
addMenuOption("Add ignore @whi@" + s, 42);
|
||||
addMenuOption("Add friend @whi@" + s, 337);
|
||||
}
|
||||
line++;
|
||||
}
|
||||
|
||||
if ((type == 4) && ((tradeChatSetting == 0) || ((tradeChatSetting == 1) && isFriend(s)))) {
|
||||
if ((mouseY > (y - 14)) && (mouseY <= y)) {
|
||||
menuOption[menuSize] = "Accept trade @whi@" + s;
|
||||
menuAction[menuSize] = 484;
|
||||
menuSize++;
|
||||
addMenuOption("Accept trade @whi@" + s, 484);
|
||||
}
|
||||
line++;
|
||||
}
|
||||
|
||||
if (((type == 5) || (type == 6)) && (splitPrivateChat == 0) && (privateChatSetting < 2)) {
|
||||
line++;
|
||||
}
|
||||
|
||||
if ((type == 8) && ((tradeChatSetting == 0) || ((tradeChatSetting == 1) && isFriend(s)))) {
|
||||
if ((mouseY > (y - 14)) && (mouseY <= y)) {
|
||||
menuOption[menuSize] = "Accept challenge @whi@" + s;
|
||||
menuAction[menuSize] = 6;
|
||||
menuSize++;
|
||||
addMenuOption("Accept challenge @whi@" + s, 6);
|
||||
}
|
||||
line++;
|
||||
}
|
||||
@@ -6573,9 +6418,10 @@ public class Game extends GameShell {
|
||||
model.applyTransform(SeqType.instances[localPlayer.seqStandID].transformIDs[0]);
|
||||
model.calculateNormals(64, 850, -30, -50, -30, true);
|
||||
|
||||
iface.modelCategory = 5;
|
||||
iface.modelType = IfType.MODEL_TYPE_PLAYER_DESIGN;
|
||||
iface.modelID = 0;
|
||||
IfType.cacheModel(0, 5, model);
|
||||
|
||||
IfType.cacheModel(0, IfType.MODEL_TYPE_PLAYER_DESIGN, model);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -7741,87 +7587,36 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
if (objSelected == 1) {
|
||||
menuOption[menuSize] = "Use " + selectedObjName + " with @yel@" + text;
|
||||
menuAction[menuSize] = 582;
|
||||
menuParamC[menuSize] = npcID;
|
||||
menuParamA[menuSize] = tileX;
|
||||
menuParamB[menuSize] = tileZ;
|
||||
menuSize++;
|
||||
addMenuOption("Use " + selectedObjName + " with @yel@" + text, 582, tileX, tileZ, npcID);
|
||||
return;
|
||||
}
|
||||
|
||||
if (spellSelected == 1) {
|
||||
if ((activeSpellFlags & 2) == 2) {
|
||||
menuOption[menuSize] = spellCaption + " @yel@" + text;
|
||||
menuAction[menuSize] = 413;
|
||||
menuParamC[menuSize] = npcID;
|
||||
menuParamA[menuSize] = tileX;
|
||||
menuParamB[menuSize] = tileZ;
|
||||
menuSize++;
|
||||
addMenuOption(spellCaption + " @yel@" + text, 413, tileX, tileZ, npcID);
|
||||
}
|
||||
} else {
|
||||
if (type.options != null) {
|
||||
for (int option = 4; option >= 0; option--) {
|
||||
if ((type.options[option] != null) && !type.options[option].equalsIgnoreCase("attack")) {
|
||||
menuOption[menuSize] = type.options[option] + " @yel@" + text;
|
||||
|
||||
if (option == 0) {
|
||||
menuAction[menuSize] = 20;
|
||||
} else if (option == 1) {
|
||||
menuAction[menuSize] = 412;
|
||||
} else if (option == 2) {
|
||||
menuAction[menuSize] = 225;
|
||||
} else if (option == 3) {
|
||||
menuAction[menuSize] = 965;
|
||||
} else if (option == 4) {
|
||||
menuAction[menuSize] = 478;
|
||||
}
|
||||
|
||||
menuParamC[menuSize] = npcID;
|
||||
menuParamA[menuSize] = tileX;
|
||||
menuParamB[menuSize] = tileZ;
|
||||
menuSize++;
|
||||
addMenuOption(type.options[option] + " @yel@" + text, NPC_OP_ACTION[option],tileX,tileZ,npcID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (type.options != null) {
|
||||
for (int option = 4; option >= 0; option--) {
|
||||
if ((type.options[option] != null) && type.options[option].equalsIgnoreCase("attack")) {
|
||||
int offset = 0;
|
||||
|
||||
if (type.level > localPlayer.combatLevel) {
|
||||
offset = 2000;
|
||||
}
|
||||
menuOption[menuSize] = type.options[option] + " @yel@" + text;
|
||||
|
||||
if (option == 0) {
|
||||
menuAction[menuSize] = 20 + offset;
|
||||
}
|
||||
if (option == 1) {
|
||||
menuAction[menuSize] = 412 + offset;
|
||||
}
|
||||
if (option == 2) {
|
||||
menuAction[menuSize] = 225 + offset;
|
||||
}
|
||||
if (option == 3) {
|
||||
menuAction[menuSize] = 965 + offset;
|
||||
}
|
||||
if (option == 4) {
|
||||
menuAction[menuSize] = 478 + offset;
|
||||
}
|
||||
menuParamC[menuSize] = npcID;
|
||||
menuParamA[menuSize] = tileX;
|
||||
menuParamB[menuSize] = tileZ;
|
||||
menuSize++;
|
||||
addMenuOption(type.options[option] + " @yel@" + text, NPC_OP_ACTION[option] + offset, tileX, tileZ, npcID);
|
||||
}
|
||||
}
|
||||
}
|
||||
menuOption[menuSize] = "Examine @yel@" + text;
|
||||
menuAction[menuSize] = 1025;
|
||||
menuParamC[menuSize] = npcID;
|
||||
menuParamA[menuSize] = tileX;
|
||||
menuParamB[menuSize] = tileZ;
|
||||
menuSize++;
|
||||
|
||||
addMenuOption("Examine @yel@" + text, 1025, tileX, tileZ, npcID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7843,68 +7638,56 @@ public class Game extends GameShell {
|
||||
}
|
||||
|
||||
if (objSelected == 1) {
|
||||
menuOption[menuSize] = "Use " + selectedObjName + " with @whi@" + caption;
|
||||
menuAction[menuSize] = 491;
|
||||
menuParamC[menuSize] = playerID;
|
||||
menuParamA[menuSize] = tileX;
|
||||
menuParamB[menuSize] = tileZ;
|
||||
menuSize++;
|
||||
addMenuOption("Use " + selectedObjName + " with @whi@" + caption, 491, tileX, tileZ, playerID);
|
||||
} else if (spellSelected == 1) {
|
||||
if ((activeSpellFlags & 8) == 8) {
|
||||
menuOption[menuSize] = spellCaption + " @whi@" + caption;
|
||||
menuAction[menuSize] = 365;
|
||||
menuParamC[menuSize] = playerID;
|
||||
menuParamA[menuSize] = tileX;
|
||||
menuParamB[menuSize] = tileZ;
|
||||
menuSize++;
|
||||
addMenuOption(spellCaption + " @whi@" + caption, 365, tileX, tileZ, playerID);
|
||||
}
|
||||
} else {
|
||||
for (int option = 4; option >= 0; option--) {
|
||||
if (playerOptions[option] != null) {
|
||||
menuOption[menuSize] = playerOptions[option] + " @whi@" + caption;
|
||||
if (playerOptions[option] == null) {
|
||||
continue;
|
||||
}
|
||||
int offset = 0;
|
||||
|
||||
int offset = 0;
|
||||
|
||||
if (playerOptions[option].equalsIgnoreCase("attack")) {
|
||||
if (player.combatLevel > localPlayer.combatLevel) {
|
||||
offset = 2000;
|
||||
}
|
||||
if ((localPlayer.team != 0) && (player.team != 0)) {
|
||||
if (localPlayer.team == player.team) {
|
||||
offset = 2000;
|
||||
} else {
|
||||
offset = 0;
|
||||
}
|
||||
}
|
||||
} else if (playerOptionPushDown[option]) {
|
||||
if (playerOptions[option].equalsIgnoreCase("attack")) {
|
||||
if (player.combatLevel > localPlayer.combatLevel) {
|
||||
offset = 2000;
|
||||
}
|
||||
|
||||
if (option == 0) {
|
||||
menuAction[menuSize] = 561 + offset;
|
||||
if ((localPlayer.team != 0) && (player.team != 0)) {
|
||||
if (localPlayer.team == player.team) {
|
||||
offset = 2000;
|
||||
} else {
|
||||
offset = 0;
|
||||
}
|
||||
}
|
||||
if (option == 1) {
|
||||
menuAction[menuSize] = 779 + offset;
|
||||
}
|
||||
if (option == 2) {
|
||||
menuAction[menuSize] = 27 + offset;
|
||||
}
|
||||
if (option == 3) {
|
||||
menuAction[menuSize] = 577 + offset;
|
||||
}
|
||||
if (option == 4) {
|
||||
menuAction[menuSize] = 729 + offset;
|
||||
}
|
||||
menuParamC[menuSize] = playerID;
|
||||
menuParamA[menuSize] = tileX;
|
||||
menuParamB[menuSize] = tileZ;
|
||||
menuSize++;
|
||||
} else if (playerOptionPushDown[option]) {
|
||||
offset = 2000;
|
||||
}
|
||||
|
||||
int action = 0;
|
||||
|
||||
if (option == 0) {
|
||||
action = 561;
|
||||
} else if (option == 1) {
|
||||
action = 779;
|
||||
} else if (option == 2) {
|
||||
action = 27;
|
||||
} else if (option == 3) {
|
||||
action = 577;
|
||||
} else if (option == 4) {
|
||||
action = 729;
|
||||
}
|
||||
|
||||
action += offset;
|
||||
|
||||
addMenuOption(playerOptions[option] + " @whi@" + caption, action, tileX, tileZ, playerID);
|
||||
}
|
||||
}
|
||||
for (int i1 = 0; i1 < menuSize; i1++) {
|
||||
if (menuAction[i1] == 516) {
|
||||
menuOption[i1] = "Walk here @whi@" + caption;
|
||||
for (int i = 0; i < menuSize; i++) {
|
||||
if (menuAction[i] == 516) {
|
||||
menuOption[i] = "Walk here @whi@" + caption;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -8596,12 +8379,15 @@ public class Game extends GameShell {
|
||||
if (actionArea == 3) {
|
||||
redrawChatback = true;
|
||||
}
|
||||
|
||||
if (objDragArea == 3) {
|
||||
redrawChatback = true;
|
||||
}
|
||||
|
||||
if (modalMessage != null) {
|
||||
redrawChatback = true;
|
||||
}
|
||||
|
||||
if (menuVisible && (mouseArea == 2)) {
|
||||
redrawChatback = true;
|
||||
}
|
||||
@@ -8791,18 +8577,12 @@ public class Game extends GameShell {
|
||||
} else {
|
||||
type--;
|
||||
}
|
||||
menuOption[menuSize] = "Remove @whi@" + friendName[type];
|
||||
menuAction[menuSize] = 792;
|
||||
menuSize++;
|
||||
menuOption[menuSize] = "Message @whi@" + friendName[type];
|
||||
menuAction[menuSize] = 639;
|
||||
menuSize++;
|
||||
addMenuOption("Remove @whi@" + friendName[type], 792);
|
||||
addMenuOption("Message @whi@" + friendName[type], 639);
|
||||
return true;
|
||||
}
|
||||
if ((type >= 401) && (type <= 500)) {
|
||||
menuOption[menuSize] = "Remove @whi@" + iface.text;
|
||||
menuAction[menuSize] = 322;
|
||||
menuSize++;
|
||||
addMenuOption("Remove @whi@" + iface.text, 322);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -9149,7 +8929,7 @@ public class Game extends GameShell {
|
||||
model = iface.getModel(-1, -1, active);
|
||||
} else {
|
||||
SeqType type = SeqType.instances[seqID];
|
||||
model = iface.getModel(type.auxiliaryTransformIDs[iface.seqFrame], type.transformIDs[iface.seqFrame], active);
|
||||
model = iface.getModel(type.transformIDs[iface.seqFrame], type.auxiliaryTransformIDs[iface.seqFrame], active);
|
||||
}
|
||||
|
||||
if (model != null) {
|
||||
@@ -10261,16 +10041,10 @@ public class Game extends GameShell {
|
||||
|
||||
if (super.mouseX < (4 + w)) {
|
||||
if (rights >= 1) {
|
||||
menuOption[menuSize] = "Report abuse @whi@" + sender;
|
||||
menuAction[menuSize] = 2606;
|
||||
menuSize++;
|
||||
addMenuOption("Report abuse @whi@" + sender, 2606);
|
||||
}
|
||||
menuOption[menuSize] = "Add ignore @whi@" + sender;
|
||||
menuAction[menuSize] = 2042;
|
||||
menuSize++;
|
||||
menuOption[menuSize] = "Add friend @whi@" + sender;
|
||||
menuAction[menuSize] = 2337;
|
||||
menuSize++;
|
||||
addMenuOption("Add ignore @whi@" + sender, 2042);
|
||||
addMenuOption("Add friend @whi@" + sender, 2337);
|
||||
}
|
||||
}
|
||||
if (++count >= 5) {
|
||||
@@ -11683,7 +11457,7 @@ public class Game extends GameShell {
|
||||
private void readIfSetPlayerHead() {
|
||||
int interfaceID = in.read16ULEA();
|
||||
IfType iface = IfType.instances[interfaceID];
|
||||
iface.modelCategory = 3;
|
||||
iface.modelType = IfType.MODEL_TYPE_PLAYER;
|
||||
|
||||
if (localPlayer.transmogrify == null) {
|
||||
iface.modelID = (localPlayer.colors[0] << 25) + (localPlayer.colors[4] << 20) + (localPlayer.appearances[0] << 15) + (localPlayer.appearances[8] << 10) + (localPlayer.appearances[11] << 5) + localPlayer.appearances[1];
|
||||
@@ -12074,7 +11848,7 @@ public class Game extends GameShell {
|
||||
private void readIfSetNPCHead() {
|
||||
int npcID = in.read16ULEA();
|
||||
int interfaceID = in.read16ULEA();
|
||||
IfType.instances[interfaceID].modelCategory = 2;
|
||||
IfType.instances[interfaceID].modelType = IfType.MODEL_TYPE_NPC;
|
||||
IfType.instances[interfaceID].modelID = npcID;
|
||||
}
|
||||
|
||||
@@ -12397,15 +12171,17 @@ public class Game extends GameShell {
|
||||
int interfaceID = in.read16ULE();
|
||||
int zoom = in.read16U();
|
||||
int objID = in.read16U();
|
||||
if (objID == 65535) {
|
||||
IfType.instances[interfaceID].modelCategory = 0;
|
||||
} else {
|
||||
|
||||
if (objID != 65535) {
|
||||
ObjType type = ObjType.get(objID);
|
||||
IfType.instances[interfaceID].modelCategory = 4;
|
||||
IfType.instances[interfaceID].modelID = objID;
|
||||
IfType.instances[interfaceID].modelPitch = type.iconPitch;
|
||||
IfType.instances[interfaceID].modelYaw = type.iconYaw;
|
||||
IfType.instances[interfaceID].modelZoom = (type.iconZoom * 100) / zoom;
|
||||
IfType iface = IfType.instances[interfaceID];
|
||||
iface.modelType = IfType.MODEL_TYPE_OBJ;
|
||||
iface.modelID = objID;
|
||||
iface.modelPitch = type.iconPitch;
|
||||
iface.modelYaw = type.iconYaw;
|
||||
iface.modelZoom = (type.iconZoom * 100) / zoom;
|
||||
} else {
|
||||
IfType.instances[interfaceID].modelType = IfType.MODEL_TYPE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12465,7 +12241,7 @@ public class Game extends GameShell {
|
||||
private void readIfSetModel() {
|
||||
int interfaceID = in.read16ULEA();
|
||||
int modelID = in.read16U();
|
||||
IfType.instances[interfaceID].modelCategory = 1;
|
||||
IfType.instances[interfaceID].modelType = IfType.MODEL_TYPE_NORMAL;
|
||||
IfType.instances[interfaceID].modelID = modelID;
|
||||
}
|
||||
|
||||
|
||||
+40
-35
@@ -19,7 +19,7 @@ public class IdkType {
|
||||
if (instances[j] == null) {
|
||||
instances[j] = new IdkType();
|
||||
}
|
||||
instances[j].method536(buffer);
|
||||
instances[j].read(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,30 +33,31 @@ public class IdkType {
|
||||
public IdkType() {
|
||||
}
|
||||
|
||||
public void method536(Buffer buffer) {
|
||||
public void read(Buffer in) {
|
||||
do {
|
||||
int i = buffer.read8U();
|
||||
if (i == 0) {
|
||||
int opcode = in.read8U();
|
||||
if (opcode == 0) {
|
||||
return;
|
||||
}
|
||||
if (i == 1) {
|
||||
type = buffer.read8U();
|
||||
} else if (i == 2) {
|
||||
int j = buffer.read8U();
|
||||
|
||||
if (opcode == 1) {
|
||||
type = in.read8U();
|
||||
} else if (opcode == 2) {
|
||||
int j = in.read8U();
|
||||
modelIDs = new int[j];
|
||||
for (int k = 0; k < j; k++) {
|
||||
modelIDs[k] = buffer.read16U();
|
||||
modelIDs[k] = in.read16U();
|
||||
}
|
||||
} else if (i == 3) {
|
||||
} else if (opcode == 3) {
|
||||
selectable = true;
|
||||
} else if ((i >= 40) && (i < 50)) {
|
||||
colorSrc[i - 40] = buffer.read16U();
|
||||
} else if ((i >= 50) && (i < 60)) {
|
||||
colorDst[i - 50] = buffer.read16U();
|
||||
} else if ((i >= 60) && (i < 70)) {
|
||||
headModelIDs[i - 60] = buffer.read16U();
|
||||
} else if ((opcode >= 40) && (opcode < 50)) {
|
||||
colorSrc[opcode - 40] = in.read16U();
|
||||
} else if ((opcode >= 50) && (opcode < 60)) {
|
||||
colorDst[opcode - 50] = in.read16U();
|
||||
} else if ((opcode >= 60) && (opcode < 70)) {
|
||||
headModelIDs[opcode - 60] = in.read16U();
|
||||
} else {
|
||||
System.out.println("Error unrecognised config code: " + i);
|
||||
System.out.println("Error unrecognised config code: " + opcode);
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
@@ -78,22 +79,26 @@ public class IdkType {
|
||||
if (modelIDs == null) {
|
||||
return null;
|
||||
}
|
||||
Model[] aclass30_sub2_sub4_sub6 = new Model[modelIDs.length];
|
||||
Model[] models = new Model[modelIDs.length];
|
||||
for (int i = 0; i < modelIDs.length; i++) {
|
||||
aclass30_sub2_sub4_sub6[i] = Model.tryGet(modelIDs[i]);
|
||||
models[i] = Model.tryGet(modelIDs[i]);
|
||||
}
|
||||
|
||||
Model model;
|
||||
if (aclass30_sub2_sub4_sub6.length == 1) {
|
||||
model = aclass30_sub2_sub4_sub6[0];
|
||||
|
||||
if (models.length == 1) {
|
||||
model = models[0];
|
||||
} else {
|
||||
model = new Model(aclass30_sub2_sub4_sub6.length, aclass30_sub2_sub4_sub6);
|
||||
model = new Model(models.length, models);
|
||||
}
|
||||
for (int j = 0; j < 6; j++) {
|
||||
if (colorSrc[j] == 0) {
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (colorSrc[i] == 0) {
|
||||
break;
|
||||
}
|
||||
model.recolor(colorSrc[j], colorDst[j]);
|
||||
model.recolor(colorSrc[i], colorDst[i]);
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -107,20 +112,20 @@ public class IdkType {
|
||||
return loaded;
|
||||
}
|
||||
|
||||
public Model method540() {
|
||||
Model[] aclass30_sub2_sub4_sub6 = new Model[5];
|
||||
int j = 0;
|
||||
for (int k = 0; k < 5; k++) {
|
||||
if (headModelIDs[k] != -1) {
|
||||
aclass30_sub2_sub4_sub6[j++] = Model.tryGet(headModelIDs[k]);
|
||||
public Model getHeadModel() {
|
||||
Model[] models = new Model[5];
|
||||
int i = 0;
|
||||
for (int j = 0; j < 5; j++) {
|
||||
if (headModelIDs[j] != -1) {
|
||||
models[i++] = Model.tryGet(headModelIDs[j]);
|
||||
}
|
||||
}
|
||||
Model model = new Model(j, aclass30_sub2_sub4_sub6);
|
||||
for (int l = 0; l < 6; l++) {
|
||||
if (colorSrc[l] == 0) {
|
||||
Model model = new Model(i, models);
|
||||
for (int k = 0; k < 6; k++) {
|
||||
if (colorSrc[k] == 0) {
|
||||
break;
|
||||
}
|
||||
model.recolor(colorSrc[l], colorDst[l]);
|
||||
model.recolor(colorSrc[k], colorDst[k]);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
+369
-363
@@ -8,421 +8,427 @@ import java.io.IOException;
|
||||
|
||||
public class IfType {
|
||||
|
||||
public static final LRUMap<Long, Model> modelCache = new LRUMap<>(30);
|
||||
public static LRUMap<Long, Image24> imageCache;
|
||||
public static IfType[] instances;
|
||||
public static final LRUMap<Long, Model> modelCache = new LRUMap<>(30);
|
||||
public static LRUMap<Long, Image24> imageCache;
|
||||
public static IfType[] instances;
|
||||
|
||||
public static final int TYPE_PARENT = 0;
|
||||
public static final int TYPE_UNUSED = 1;
|
||||
public static final int TYPE_INVENTORY = 2;
|
||||
public static final int TYPE_RECT = 3;
|
||||
public static final int TYPE_TEXT = 4;
|
||||
public static final int TYPE_IMAGE = 5;
|
||||
public static final int TYPE_MODEL = 6;
|
||||
public static final int TYPE_INVENTORY_TEXT = 7;
|
||||
public static final int TYPE_PARENT = 0;
|
||||
public static final int TYPE_UNUSED = 1;
|
||||
public static final int TYPE_INVENTORY = 2;
|
||||
public static final int TYPE_RECT = 3;
|
||||
public static final int TYPE_TEXT = 4;
|
||||
public static final int TYPE_IMAGE = 5;
|
||||
public static final int TYPE_MODEL = 6;
|
||||
public static final int TYPE_INVENTORY_TEXT = 7;
|
||||
public static final int OPTION_TYPE_STANDARD = 1;
|
||||
public static final int OPTION_TYPE_SPELL = 2;
|
||||
public static final int OPTION_TYPE_CLOSE = 3;
|
||||
public static final int OPTION_TYPE_TOGGLE = 4;
|
||||
public static final int OPTION_TYPE_SELECT = 5;
|
||||
public static final int OPTION_TYPE_CONTINUE = 6;
|
||||
public static final int MODEL_TYPE_NONE = 0;
|
||||
public static final int MODEL_TYPE_NORMAL = 1;
|
||||
public static final int MODEL_TYPE_NPC = 2;
|
||||
public static final int MODEL_TYPE_PLAYER = 3;
|
||||
public static final int MODEL_TYPE_OBJ = 4;
|
||||
public static final int MODEL_TYPE_PLAYER_DESIGN = 5;
|
||||
|
||||
public static final int OPTION_TYPE_STANDARD = 1;
|
||||
public static final int OPTION_TYPE_SPELL = 2;
|
||||
public static final int OPTION_TYPE_CLOSE = 3;
|
||||
public static final int OPTION_TYPE_TOGGLE = 4;
|
||||
public static final int OPTION_TYPE_SELECT = 5;
|
||||
public static final int OPTION_TYPE_CONTINUE = 6;
|
||||
public static void unpack(FileArchive config, BitmapFont[] fonts, FileArchive media) throws IOException {
|
||||
imageCache = new LRUMap<>(500);
|
||||
Buffer in = new Buffer(config.read("data"));
|
||||
|
||||
public static void unpack(FileArchive config, BitmapFont[] fonts, FileArchive media) throws IOException {
|
||||
imageCache = new LRUMap<>(500);
|
||||
Buffer in = new Buffer(config.read("data"));
|
||||
int parentID = -1;
|
||||
int count = in.read16U();
|
||||
|
||||
int parentID = -1;
|
||||
int count = in.read16U();
|
||||
instances = new IfType[count];
|
||||
|
||||
instances = new IfType[count];
|
||||
while (in.position < in.data.length) {
|
||||
int id = in.read16U();
|
||||
|
||||
while (in.position < in.data.length) {
|
||||
int id = in.read16U();
|
||||
if (id == 65535) {
|
||||
parentID = in.read16U();
|
||||
id = in.read16U();
|
||||
}
|
||||
|
||||
if (id == 65535) {
|
||||
parentID = in.read16U();
|
||||
id = in.read16U();
|
||||
}
|
||||
IfType iface = instances[id] = new IfType();
|
||||
iface.id = id;
|
||||
iface.parentID = parentID;
|
||||
iface.type = in.read8U();
|
||||
iface.optionType = in.read8U();
|
||||
iface.contentType = in.read16U();
|
||||
iface.width = in.read16U();
|
||||
iface.height = in.read16U();
|
||||
iface.transparency = (byte) in.read8U();
|
||||
iface.delegateHover = in.read8U();
|
||||
|
||||
IfType iface = instances[id] = new IfType();
|
||||
iface.id = id;
|
||||
iface.parentID = parentID;
|
||||
iface.type = in.read8U();
|
||||
iface.optionType = in.read8U();
|
||||
iface.contentType = in.read16U();
|
||||
iface.width = in.read16U();
|
||||
iface.height = in.read16U();
|
||||
iface.transparency = (byte) in.read8U();
|
||||
iface.delegateHover = in.read8U();
|
||||
if (iface.delegateHover != 0) {
|
||||
iface.delegateHover = ((iface.delegateHover - 1) << 8) + in.read8U();
|
||||
} else {
|
||||
iface.delegateHover = -1;
|
||||
}
|
||||
|
||||
if (iface.delegateHover != 0) {
|
||||
iface.delegateHover = ((iface.delegateHover - 1) << 8) + in.read8U();
|
||||
} else {
|
||||
iface.delegateHover = -1;
|
||||
}
|
||||
int comparatorCount = in.read8U();
|
||||
if (comparatorCount > 0) {
|
||||
iface.scriptComparator = new int[comparatorCount];
|
||||
iface.scriptOperand = new int[comparatorCount];
|
||||
for (int i = 0; i < comparatorCount; i++) {
|
||||
iface.scriptComparator[i] = in.read8U();
|
||||
iface.scriptOperand[i] = in.read16U();
|
||||
}
|
||||
}
|
||||
|
||||
int comparatorCount = in.read8U();
|
||||
if (comparatorCount > 0) {
|
||||
iface.scriptComparator = new int[comparatorCount];
|
||||
iface.scriptOperand = new int[comparatorCount];
|
||||
for (int i = 0; i < comparatorCount; i++) {
|
||||
iface.scriptComparator[i] = in.read8U();
|
||||
iface.scriptOperand[i] = in.read16U();
|
||||
}
|
||||
}
|
||||
int scriptCount = in.read8U();
|
||||
if (scriptCount > 0) {
|
||||
iface.scripts = new int[scriptCount][];
|
||||
for (int scriptID = 0; scriptID < scriptCount; scriptID++) {
|
||||
int length = in.read16U();
|
||||
iface.scripts[scriptID] = new int[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
iface.scripts[scriptID][i] = in.read16U();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int scriptCount = in.read8U();
|
||||
if (scriptCount > 0) {
|
||||
iface.scripts = new int[scriptCount][];
|
||||
for (int scriptID = 0; scriptID < scriptCount; scriptID++) {
|
||||
int length = in.read16U();
|
||||
iface.scripts[scriptID] = new int[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
iface.scripts[scriptID][i] = in.read16U();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (iface.type == TYPE_PARENT) {
|
||||
iface.scrollableHeight = in.read16U();
|
||||
iface.hide = in.read8U() == 1;
|
||||
int childCount = in.read16U();
|
||||
iface.childID = new int[childCount];
|
||||
iface.childX = new int[childCount];
|
||||
iface.childY = new int[childCount];
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
iface.childID[i] = in.read16U();
|
||||
iface.childX[i] = in.read16();
|
||||
iface.childY[i] = in.read16();
|
||||
}
|
||||
}
|
||||
|
||||
if (iface.type == TYPE_PARENT) {
|
||||
iface.scrollableHeight = in.read16U();
|
||||
iface.hide = in.read8U() == 1;
|
||||
int childCount = in.read16U();
|
||||
iface.childID = new int[childCount];
|
||||
iface.childX = new int[childCount];
|
||||
iface.childY = new int[childCount];
|
||||
for (int i = 0; i < childCount; i++) {
|
||||
iface.childID[i] = in.read16U();
|
||||
iface.childX[i] = in.read16();
|
||||
iface.childY[i] = in.read16();
|
||||
}
|
||||
}
|
||||
if (iface.type == TYPE_UNUSED) {
|
||||
in.read16U();
|
||||
in.read8U();
|
||||
}
|
||||
|
||||
if (iface.type == TYPE_UNUSED) {
|
||||
iface.unusedInt = in.read16U();
|
||||
iface.unusedBool = in.read8U() == 1;
|
||||
}
|
||||
if (iface.type == TYPE_INVENTORY) {
|
||||
iface.inventorySlotObjID = new int[iface.width * iface.height];
|
||||
iface.inventorySlotObjCount = new int[iface.width * iface.height];
|
||||
iface.inventoryDraggable = in.read8U() == 1;
|
||||
iface.inventoryInteractable = in.read8U() == 1;
|
||||
iface.inventoryUsable = in.read8U() == 1;
|
||||
iface.inventoryMoveReplaces = in.read8U() == 1;
|
||||
iface.inventoryMarginX = in.read8U();
|
||||
iface.inventoryMarginY = in.read8U();
|
||||
iface.inventorySlotOffsetX = new int[20];
|
||||
iface.inventorySlotOffsetY = new int[20];
|
||||
iface.inventorySlotImage = new Image24[20];
|
||||
|
||||
if (iface.type == TYPE_INVENTORY) {
|
||||
iface.inventorySlotObjID = new int[iface.width * iface.height];
|
||||
iface.inventorySlotObjCount = new int[iface.width * iface.height];
|
||||
iface.inventoryDraggable = in.read8U() == 1;
|
||||
iface.inventoryInteractable = in.read8U() == 1;
|
||||
iface.inventoryUsable = in.read8U() == 1;
|
||||
iface.inventoryMoveReplaces = in.read8U() == 1;
|
||||
iface.inventoryMarginX = in.read8U();
|
||||
iface.inventoryMarginY = in.read8U();
|
||||
iface.inventorySlotOffsetX = new int[20];
|
||||
iface.inventorySlotOffsetY = new int[20];
|
||||
iface.inventorySlotImage = new Image24[20];
|
||||
for (int slot = 0; slot < 20; slot++) {
|
||||
if (in.read8U() == 1) {
|
||||
iface.inventorySlotOffsetX[slot] = in.read16();
|
||||
iface.inventorySlotOffsetY[slot] = in.read16();
|
||||
String imageName = in.readString();
|
||||
|
||||
for (int slot = 0; slot < 20; slot++) {
|
||||
if (in.read8U() == 1) {
|
||||
iface.inventorySlotOffsetX[slot] = in.read16();
|
||||
iface.inventorySlotOffsetY[slot] = in.read16();
|
||||
String imageName = in.readString();
|
||||
if ((media != null) && (imageName.length() > 0)) {
|
||||
int imageID = imageName.lastIndexOf(",");
|
||||
iface.inventorySlotImage[slot] = getImage(Integer.parseInt(imageName.substring(imageID + 1)), media, imageName.substring(0, imageID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((media != null) && (imageName.length() > 0)) {
|
||||
int imageID = imageName.lastIndexOf(",");
|
||||
iface.inventorySlotImage[slot] = getImage(Integer.parseInt(imageName.substring(imageID + 1)), media, imageName.substring(0, imageID));
|
||||
}
|
||||
}
|
||||
}
|
||||
iface.inventoryOptions = new String[5];
|
||||
|
||||
iface.inventoryOptions = new String[5];
|
||||
for (int i = 0; i < 5; i++) {
|
||||
iface.inventoryOptions[i] = in.readString();
|
||||
if (iface.inventoryOptions[i].length() == 0) {
|
||||
iface.inventoryOptions[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
iface.inventoryOptions[i] = in.readString();
|
||||
if (iface.inventoryOptions[i].length() == 0) {
|
||||
iface.inventoryOptions[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (iface.type == TYPE_RECT) {
|
||||
iface.fill = in.read8U() == 1;
|
||||
}
|
||||
|
||||
if (iface.type == TYPE_RECT) {
|
||||
iface.fill = in.read8U() == 1;
|
||||
}
|
||||
if ((iface.type == TYPE_TEXT) || (iface.type == TYPE_UNUSED)) {
|
||||
iface.center = in.read8U() == 1;
|
||||
int fontID = in.read8U();
|
||||
if (fonts != null) {
|
||||
iface.font = fonts[fontID];
|
||||
}
|
||||
iface.shadow = in.read8U() == 1;
|
||||
}
|
||||
|
||||
if ((iface.type == TYPE_TEXT) || (iface.type == TYPE_UNUSED)) {
|
||||
iface.center = in.read8U() == 1;
|
||||
int fontID = in.read8U();
|
||||
if (fonts != null) {
|
||||
iface.font = fonts[fontID];
|
||||
}
|
||||
iface.shadow = in.read8U() == 1;
|
||||
}
|
||||
if (iface.type == TYPE_TEXT) {
|
||||
iface.text = in.readString();
|
||||
iface.activeText = in.readString();
|
||||
}
|
||||
|
||||
if (iface.type == TYPE_TEXT) {
|
||||
iface.text = in.readString();
|
||||
iface.activeText = in.readString();
|
||||
}
|
||||
if ((iface.type == TYPE_UNUSED) || (iface.type == TYPE_RECT) || (iface.type == TYPE_TEXT)) {
|
||||
iface.color = in.read32();
|
||||
}
|
||||
|
||||
if ((iface.type == TYPE_UNUSED) || (iface.type == TYPE_RECT) || (iface.type == TYPE_TEXT)) {
|
||||
iface.color = in.read32();
|
||||
}
|
||||
if ((iface.type == TYPE_RECT) || (iface.type == TYPE_TEXT)) {
|
||||
iface.activeColor = in.read32();
|
||||
iface.hoverColor = in.read32();
|
||||
iface.activeHoverColor = in.read32();
|
||||
}
|
||||
|
||||
if ((iface.type == TYPE_RECT) || (iface.type == TYPE_TEXT)) {
|
||||
iface.activeColor = in.read32();
|
||||
iface.hoverColor = in.read32();
|
||||
iface.activeHoverColor = in.read32();
|
||||
}
|
||||
if (iface.type == TYPE_IMAGE) {
|
||||
String s = in.readString();
|
||||
if ((media != null) && (s.length() > 0)) {
|
||||
int comma = s.lastIndexOf(",");
|
||||
iface.image = getImage(Integer.parseInt(s.substring(comma + 1)), media, s.substring(0, comma));
|
||||
}
|
||||
s = in.readString();
|
||||
if ((media != null) && (s.length() > 0)) {
|
||||
int comma = s.lastIndexOf(",");
|
||||
iface.activeImage = getImage(Integer.parseInt(s.substring(comma + 1)), media, s.substring(0, comma));
|
||||
}
|
||||
}
|
||||
|
||||
if (iface.type == TYPE_IMAGE) {
|
||||
String s = in.readString();
|
||||
if ((media != null) && (s.length() > 0)) {
|
||||
int comma = s.lastIndexOf(",");
|
||||
iface.image = getImage(Integer.parseInt(s.substring(comma + 1)), media, s.substring(0, comma));
|
||||
}
|
||||
s = in.readString();
|
||||
if ((media != null) && (s.length() > 0)) {
|
||||
int comma = s.lastIndexOf(",");
|
||||
iface.activeImage = getImage(Integer.parseInt(s.substring(comma + 1)), media, s.substring(0, comma));
|
||||
}
|
||||
}
|
||||
if (iface.type == TYPE_MODEL) {
|
||||
int tmp = in.read8U();
|
||||
if (tmp != 0) {
|
||||
iface.modelType = MODEL_TYPE_NORMAL;
|
||||
iface.modelID = ((tmp - 1) << 8) + in.read8U();
|
||||
}
|
||||
|
||||
if (iface.type == TYPE_MODEL) {
|
||||
int tmp = in.read8U();
|
||||
if (tmp != 0) {
|
||||
iface.modelCategory = 1;
|
||||
iface.modelID = ((tmp - 1) << 8) + in.read8U();
|
||||
}
|
||||
tmp = in.read8U();
|
||||
if (tmp != 0) {
|
||||
iface.activeModelType = MODEL_TYPE_NORMAL;
|
||||
iface.activeModelID = ((tmp - 1) << 8) + in.read8U();
|
||||
}
|
||||
|
||||
tmp = in.read8U();
|
||||
if (tmp != 0) {
|
||||
iface.activeModelCategory = 1;
|
||||
iface.activeModelID = ((tmp - 1) << 8) + in.read8U();
|
||||
}
|
||||
tmp = in.read8U();
|
||||
if (tmp != 0) {
|
||||
iface.seqID = ((tmp - 1) << 8) + in.read8U();
|
||||
} else {
|
||||
iface.seqID = -1;
|
||||
}
|
||||
|
||||
tmp = in.read8U();
|
||||
if (tmp != 0) {
|
||||
iface.seqID = ((tmp - 1) << 8) + in.read8U();
|
||||
} else {
|
||||
iface.seqID = -1;
|
||||
}
|
||||
tmp = in.read8U();
|
||||
if (tmp != 0) {
|
||||
iface.activeSeqID = ((tmp - 1) << 8) + in.read8U();
|
||||
} else {
|
||||
iface.activeSeqID = -1;
|
||||
}
|
||||
|
||||
tmp = in.read8U();
|
||||
if (tmp != 0) {
|
||||
iface.activeSeqID = ((tmp - 1) << 8) + in.read8U();
|
||||
} else {
|
||||
iface.activeSeqID = -1;
|
||||
}
|
||||
iface.modelZoom = in.read16U();
|
||||
iface.modelPitch = in.read16U();
|
||||
iface.modelYaw = in.read16U();
|
||||
}
|
||||
|
||||
iface.modelZoom = in.read16U();
|
||||
iface.modelPitch = in.read16U();
|
||||
iface.modelYaw = in.read16U();
|
||||
}
|
||||
if (iface.type == TYPE_INVENTORY_TEXT) {
|
||||
iface.inventorySlotObjID = new int[iface.width * iface.height];
|
||||
iface.inventorySlotObjCount = new int[iface.width * iface.height];
|
||||
iface.center = in.read8U() == 1;
|
||||
int fontID = in.read8U();
|
||||
if (fonts != null) {
|
||||
iface.font = fonts[fontID];
|
||||
}
|
||||
iface.shadow = in.read8U() == 1;
|
||||
iface.color = in.read32();
|
||||
iface.inventoryMarginX = in.read16();
|
||||
iface.inventoryMarginY = in.read16();
|
||||
iface.inventoryInteractable = in.read8U() == 1;
|
||||
iface.inventoryOptions = new String[5];
|
||||
for (int option = 0; option < 5; option++) {
|
||||
iface.inventoryOptions[option] = in.readString();
|
||||
if (iface.inventoryOptions[option].length() == 0) {
|
||||
iface.inventoryOptions[option] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (iface.type == TYPE_INVENTORY_TEXT) {
|
||||
iface.inventorySlotObjID = new int[iface.width * iface.height];
|
||||
iface.inventorySlotObjCount = new int[iface.width * iface.height];
|
||||
iface.center = in.read8U() == 1;
|
||||
int fontID = in.read8U();
|
||||
if (fonts != null) {
|
||||
iface.font = fonts[fontID];
|
||||
}
|
||||
iface.shadow = in.read8U() == 1;
|
||||
iface.color = in.read32();
|
||||
iface.inventoryMarginX = in.read16();
|
||||
iface.inventoryMarginY = in.read16();
|
||||
iface.inventoryInteractable = in.read8U() == 1;
|
||||
iface.inventoryOptions = new String[5];
|
||||
for (int option = 0; option < 5; option++) {
|
||||
iface.inventoryOptions[option] = in.readString();
|
||||
if (iface.inventoryOptions[option].length() == 0) {
|
||||
iface.inventoryOptions[option] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (iface.type == 8) {
|
||||
iface.spellAction = in.readString();
|
||||
}
|
||||
|
||||
if (iface.type == 8) {
|
||||
iface.spellAction = in.readString();
|
||||
}
|
||||
if ((iface.optionType == OPTION_TYPE_SPELL) || (iface.type == TYPE_INVENTORY)) {
|
||||
iface.spellAction = in.readString();
|
||||
iface.spellName = in.readString();
|
||||
iface.spellFlags = in.read16U();
|
||||
}
|
||||
|
||||
if ((iface.optionType == OPTION_TYPE_SPELL) || (iface.type == TYPE_INVENTORY)) {
|
||||
iface.spellAction = in.readString();
|
||||
iface.spellName = in.readString();
|
||||
iface.spellFlags = in.read16U();
|
||||
}
|
||||
if (iface.optionType == OPTION_TYPE_STANDARD || iface.optionType == OPTION_TYPE_TOGGLE || iface.optionType == OPTION_TYPE_SELECT || iface.optionType == OPTION_TYPE_CONTINUE) {
|
||||
iface.option = in.readString();
|
||||
|
||||
if (iface.optionType == OPTION_TYPE_STANDARD || iface.optionType == OPTION_TYPE_TOGGLE || iface.optionType == OPTION_TYPE_SELECT || iface.optionType == OPTION_TYPE_CONTINUE) {
|
||||
iface.option = in.readString();
|
||||
if (iface.option.length() == 0) {
|
||||
if (iface.optionType == OPTION_TYPE_STANDARD) {
|
||||
iface.option = "Ok";
|
||||
} else if (iface.optionType == OPTION_TYPE_TOGGLE) {
|
||||
iface.option = "Select";
|
||||
} else if (iface.optionType == OPTION_TYPE_SELECT) {
|
||||
iface.option = "Select";
|
||||
} else if (iface.optionType == OPTION_TYPE_CONTINUE) {
|
||||
iface.option = "Continue";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
imageCache = null;
|
||||
}
|
||||
|
||||
if (iface.option.length() == 0) {
|
||||
if (iface.optionType == OPTION_TYPE_STANDARD) {
|
||||
iface.option = "Ok";
|
||||
} else if (iface.optionType == OPTION_TYPE_TOGGLE) {
|
||||
iface.option = "Select";
|
||||
} else if (iface.optionType == OPTION_TYPE_SELECT) {
|
||||
iface.option = "Select";
|
||||
} else if (iface.optionType == OPTION_TYPE_CONTINUE) {
|
||||
iface.option = "Continue";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
imageCache = null;
|
||||
}
|
||||
public static Image24 getImage(int id, FileArchive media, String name) {
|
||||
long uid = (StringUtil.hashCode(name) << 8) + (long) id;
|
||||
Image24 image = imageCache.get(uid);
|
||||
|
||||
public static Image24 getImage(int id, FileArchive media, String name) {
|
||||
long uid = (StringUtil.hashCode(name) << 8) + (long) id;
|
||||
Image24 image = imageCache.get(uid);
|
||||
if (image != null) {
|
||||
return image;
|
||||
}
|
||||
|
||||
if (image != null) {
|
||||
return image;
|
||||
}
|
||||
try {
|
||||
image = new Image24(media, name, id);
|
||||
imageCache.put(uid, image);
|
||||
} catch (Exception _ex) {
|
||||
return null;
|
||||
}
|
||||
return image;
|
||||
}
|
||||
|
||||
try {
|
||||
image = new Image24(media, name, id);
|
||||
imageCache.put(uid, image);
|
||||
} catch (Exception _ex) {
|
||||
return null;
|
||||
}
|
||||
return image;
|
||||
}
|
||||
public static void cacheModel(int id, int type, Model model) {
|
||||
modelCache.clear();
|
||||
|
||||
public static void cacheModel(int id, int type, Model model) {
|
||||
modelCache.clear();
|
||||
if ((model != null) && (type != 4)) {
|
||||
modelCache.put(((long) type << 16) + id, model);
|
||||
}
|
||||
}
|
||||
if ((model != null) && (type != MODEL_TYPE_OBJ)) {
|
||||
modelCache.put(((long) type << 16) + id, model);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean inventoryInteractable;
|
||||
public int activeColor;
|
||||
public int activeHoverColor;
|
||||
public Image24 activeImage;
|
||||
public int activeModelCategory;
|
||||
public int activeModelID;
|
||||
public int activeSeqID;
|
||||
public String activeText;
|
||||
public boolean center;
|
||||
public int[] childID;
|
||||
public int[] childX;
|
||||
public int[] childY;
|
||||
public int color;
|
||||
public int contentType;
|
||||
public int delegateHover;
|
||||
public boolean fill;
|
||||
public BitmapFont font;
|
||||
public int height;
|
||||
/**
|
||||
* Hides this component. Only works for parent components by default.
|
||||
* @see Game#drawParentInterface(IfType, int, int, int)
|
||||
*/
|
||||
public boolean hide;
|
||||
public int hoverColor;
|
||||
public int id;
|
||||
public Image24 image;
|
||||
public boolean inventoryDraggable;
|
||||
public int inventoryMarginX;
|
||||
public int inventoryMarginY;
|
||||
public boolean inventoryMoveReplaces;
|
||||
public String[] inventoryOptions;
|
||||
public int[] inventorySlotObjCount;
|
||||
public Image24[] inventorySlotImage;
|
||||
public int[] inventorySlotObjID;
|
||||
public int[] inventorySlotOffsetX;
|
||||
public int[] inventorySlotOffsetY;
|
||||
public boolean inventoryUsable;
|
||||
public int modelPitch;
|
||||
public int modelCategory;
|
||||
public int modelID;
|
||||
public int modelYaw;
|
||||
public int modelZoom;
|
||||
public String option;
|
||||
public int optionType;
|
||||
public int parentID;
|
||||
public int[] scriptComparator;
|
||||
public int[] scriptOperand;
|
||||
public int[][] scripts;
|
||||
public int scrollableHeight;
|
||||
public int scrollPosition;
|
||||
public int seqCycle;
|
||||
public int seqFrame;
|
||||
public int seqID;
|
||||
public boolean shadow;
|
||||
public String spellAction;
|
||||
public int spellFlags;
|
||||
public String spellName;
|
||||
public String text;
|
||||
public byte transparency;
|
||||
public int type;
|
||||
public boolean unusedBool;
|
||||
public int unusedInt;
|
||||
public int width;
|
||||
public int x;
|
||||
public int y;
|
||||
public boolean inventoryInteractable;
|
||||
public int activeColor;
|
||||
public int activeHoverColor;
|
||||
public Image24 activeImage;
|
||||
public int activeModelType;
|
||||
public int activeModelID;
|
||||
public int activeSeqID;
|
||||
public String activeText;
|
||||
public boolean center;
|
||||
public int[] childID;
|
||||
public int[] childX;
|
||||
public int[] childY;
|
||||
public int color;
|
||||
public int contentType;
|
||||
public int delegateHover;
|
||||
public boolean fill;
|
||||
public BitmapFont font;
|
||||
public int height;
|
||||
/**
|
||||
* Hides this component. Only works for parent components by default.
|
||||
*
|
||||
* @see Game#drawParentInterface(IfType, int, int, int)
|
||||
*/
|
||||
public boolean hide;
|
||||
public int hoverColor;
|
||||
public int id;
|
||||
public Image24 image;
|
||||
public boolean inventoryDraggable;
|
||||
public int inventoryMarginX;
|
||||
public int inventoryMarginY;
|
||||
public boolean inventoryMoveReplaces;
|
||||
public String[] inventoryOptions;
|
||||
public int[] inventorySlotObjCount;
|
||||
public Image24[] inventorySlotImage;
|
||||
public int[] inventorySlotObjID;
|
||||
public int[] inventorySlotOffsetX;
|
||||
public int[] inventorySlotOffsetY;
|
||||
public boolean inventoryUsable;
|
||||
public int modelPitch;
|
||||
public int modelType;
|
||||
public int modelID;
|
||||
public int modelYaw;
|
||||
public int modelZoom;
|
||||
public String option;
|
||||
public int optionType;
|
||||
public int parentID;
|
||||
public int[] scriptComparator;
|
||||
public int[] scriptOperand;
|
||||
public int[][] scripts;
|
||||
public int scrollableHeight;
|
||||
public int scrollPosition;
|
||||
public int seqCycle;
|
||||
public int seqFrame;
|
||||
public int seqID;
|
||||
public boolean shadow;
|
||||
public String spellAction;
|
||||
public int spellFlags;
|
||||
public String spellName;
|
||||
public String text;
|
||||
public byte transparency;
|
||||
public int type;
|
||||
public int width;
|
||||
public int x;
|
||||
public int y;
|
||||
|
||||
|
||||
public IfType() {
|
||||
}
|
||||
public IfType() {
|
||||
}
|
||||
|
||||
public void inventorySwap(int src, int dst) {
|
||||
int tmp = inventorySlotObjID[src];
|
||||
inventorySlotObjID[src] = inventorySlotObjID[dst];
|
||||
inventorySlotObjID[dst] = tmp;
|
||||
public void inventorySwap(int src, int dst) {
|
||||
int tmp = inventorySlotObjID[src];
|
||||
inventorySlotObjID[src] = inventorySlotObjID[dst];
|
||||
inventorySlotObjID[dst] = tmp;
|
||||
|
||||
tmp = inventorySlotObjCount[src];
|
||||
inventorySlotObjCount[src] = inventorySlotObjCount[dst];
|
||||
inventorySlotObjCount[dst] = tmp;
|
||||
}
|
||||
tmp = inventorySlotObjCount[src];
|
||||
inventorySlotObjCount[src] = inventorySlotObjCount[dst];
|
||||
inventorySlotObjCount[dst] = tmp;
|
||||
}
|
||||
|
||||
public Model getModel(int category, int id) {
|
||||
Model model = modelCache.get(((long) category << 16) + id);
|
||||
if (model != null) {
|
||||
return model;
|
||||
}
|
||||
if (category == 1) {
|
||||
model = Model.tryGet(id);
|
||||
}
|
||||
if (category == 2) {
|
||||
model = NPCType.get(id).getUnlitHeadModel();
|
||||
}
|
||||
if (category == 3) {
|
||||
model = Game.localPlayer.getUnlitHeadModel();
|
||||
}
|
||||
if (category == 4) {
|
||||
model = ObjType.get(id).getUnlitModel(50);
|
||||
}
|
||||
if (model != null) {
|
||||
modelCache.put((long) ((category << 16) + id), model);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
public Model getModel(int category, int id) {
|
||||
Model model = modelCache.get(((long) category << 16) + id);
|
||||
|
||||
public Model getModel(int secondaryTransformID, int primaryTransformID, boolean active) {
|
||||
Model model;
|
||||
if (model != null) {
|
||||
return model;
|
||||
}
|
||||
|
||||
if (active) {
|
||||
model = getModel(activeModelCategory, activeModelID);
|
||||
} else {
|
||||
model = getModel(modelCategory, modelID);
|
||||
}
|
||||
if (category == MODEL_TYPE_NORMAL) {
|
||||
model = Model.tryGet(id);
|
||||
} else if (category == MODEL_TYPE_NPC) {
|
||||
model = NPCType.get(id).getHeadModel();
|
||||
} else if (category == MODEL_TYPE_PLAYER) {
|
||||
model = Game.localPlayer.getHeadModel();
|
||||
} else if (category == MODEL_TYPE_OBJ) {
|
||||
model = ObjType.get(id).getInterfaceModel(50);
|
||||
}
|
||||
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
if (model != null) {
|
||||
modelCache.put((long) ((category << 16) + id), model);
|
||||
}
|
||||
|
||||
if ((primaryTransformID == -1) && (secondaryTransformID == -1) && (model.faceColor == null)) {
|
||||
return model;
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
Model animatedModel = new Model(true, SeqTransform.isNull(primaryTransformID) & SeqTransform.isNull(secondaryTransformID), false, model);
|
||||
public Model getModel(int primaryTransformID, int secondaryTransformID, boolean active) {
|
||||
Model model;
|
||||
|
||||
if ((primaryTransformID != -1) || (secondaryTransformID != -1)) {
|
||||
animatedModel.createLabelReferences();
|
||||
}
|
||||
if (active) {
|
||||
model = getModel(activeModelType, activeModelID);
|
||||
} else {
|
||||
model = getModel(modelType, modelID);
|
||||
}
|
||||
|
||||
if (primaryTransformID != -1) {
|
||||
animatedModel.applyTransform(primaryTransformID);
|
||||
}
|
||||
if (model == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (secondaryTransformID != -1) {
|
||||
animatedModel.applyTransform(secondaryTransformID);
|
||||
}
|
||||
if ((primaryTransformID == -1) && (secondaryTransformID == -1) && (model.faceColor == null)) {
|
||||
return model;
|
||||
}
|
||||
|
||||
animatedModel.calculateNormals(64, 768, -50, -10, -50, true);
|
||||
return animatedModel;
|
||||
}
|
||||
model = new Model(true, SeqTransform.isNull(primaryTransformID) & SeqTransform.isNull(secondaryTransformID), false, model);
|
||||
|
||||
if ((primaryTransformID != -1) || (secondaryTransformID != -1)) {
|
||||
model.createLabelReferences();
|
||||
}
|
||||
|
||||
if (primaryTransformID != -1) {
|
||||
model.applyTransform(primaryTransformID);
|
||||
}
|
||||
|
||||
if (secondaryTransformID != -1) {
|
||||
model.applyTransform(secondaryTransformID);
|
||||
}
|
||||
|
||||
model.calculateNormals(64, 768, -50, -10, -50, true);
|
||||
return model;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -133,7 +133,7 @@ public class LocType {
|
||||
public int seqID;
|
||||
public int translateZ;
|
||||
public int[] srcColor;
|
||||
public String[] actions;
|
||||
public String[] options;
|
||||
|
||||
public LocType() {
|
||||
}
|
||||
@@ -157,7 +157,7 @@ public class LocType {
|
||||
decorOffset = 16;
|
||||
lightAmbient = 0;
|
||||
lightAttenuation = 0;
|
||||
actions = null;
|
||||
options = null;
|
||||
mapfunctionIcon = -1;
|
||||
mapsceneIcon = -1;
|
||||
invert = false;
|
||||
@@ -475,12 +475,12 @@ public class LocType {
|
||||
} else if (j == 39) {
|
||||
lightAttenuation = buffer.read();
|
||||
} else if ((j >= 30) && (j < 39)) {
|
||||
if (actions == null) {
|
||||
actions = new String[5];
|
||||
if (options == null) {
|
||||
options = new String[5];
|
||||
}
|
||||
actions[j - 30] = buffer.readString();
|
||||
if (actions[j - 30].equalsIgnoreCase("hidden")) {
|
||||
actions[j - 30] = null;
|
||||
options[j - 30] = buffer.readString();
|
||||
if (options[j - 30].equalsIgnoreCase("hidden")) {
|
||||
options[j - 30] = null;
|
||||
}
|
||||
} else if (j == 40) {
|
||||
int i1 = buffer.read8U();
|
||||
@@ -543,7 +543,7 @@ public class LocType {
|
||||
} while (true);
|
||||
if (i == -1) {
|
||||
interactable = (modelIDs != null) && ((modelKinds == null) || (modelKinds[0] == 10));
|
||||
if (actions != null) {
|
||||
if (options != null) {
|
||||
interactable = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,13 +93,13 @@ public class NPCType {
|
||||
public NPCType() {
|
||||
}
|
||||
|
||||
public Model getUnlitHeadModel() {
|
||||
public Model getHeadModel() {
|
||||
if (overrides != null) {
|
||||
NPCType type = getOverrideType();
|
||||
if (type == null) {
|
||||
return null;
|
||||
} else {
|
||||
return type.getUnlitHeadModel();
|
||||
return type.getHeadModel();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -459,6 +459,11 @@ public class ObjType {
|
||||
stackable = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a fully built ground model of this {@link ObjType}.
|
||||
* @param count the stack count.
|
||||
* @return the model or <code>null</code> if unavailable.
|
||||
*/
|
||||
public Model getModel(int count) {
|
||||
if ((stackID != null) && (count > 1)) {
|
||||
int id = -1;
|
||||
@@ -502,7 +507,12 @@ public class ObjType {
|
||||
return model;
|
||||
}
|
||||
|
||||
public Model getUnlitModel(int count) {
|
||||
/**
|
||||
* Retrieves the ground model of this {@link ObjType} without caching, rescaling, calculating normals, applying lighting, or making pickable. As opposed to {@link #getModel(int)}.
|
||||
* @param count the stack count.
|
||||
* @return the model or <code>null</code> if unavailable.
|
||||
*/
|
||||
public Model getInterfaceModel(int count) {
|
||||
if ((stackID != null) && (count > 1)) {
|
||||
int id = -1;
|
||||
|
||||
@@ -513,7 +523,7 @@ public class ObjType {
|
||||
}
|
||||
|
||||
if (id != -1) {
|
||||
return get(id).getUnlitModel(1);
|
||||
return get(id).getInterfaceModel(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -358,13 +358,13 @@ public class PlayerEntity extends PathingEntity {
|
||||
return visible;
|
||||
}
|
||||
|
||||
public Model getUnlitHeadModel() {
|
||||
public Model getHeadModel() {
|
||||
if (!visible) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (transmogrify != null) {
|
||||
return transmogrify.getUnlitHeadModel();
|
||||
return transmogrify.getHeadModel();
|
||||
}
|
||||
|
||||
boolean invalid = false;
|
||||
@@ -391,7 +391,7 @@ public class PlayerEntity extends PathingEntity {
|
||||
int value = appearances[part];
|
||||
|
||||
if ((value >= 256) && (value < 512)) {
|
||||
Model model = IdkType.instances[value - 256].method540();
|
||||
Model model = IdkType.instances[value - 256].getHeadModel();
|
||||
if (model != null) {
|
||||
models[modelCount++] = model;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user