From bfc7ccd623d15d7260185d6a85e833685c6c891c Mon Sep 17 00:00:00 2001 From: Max Weber Date: Tue, 10 May 2022 20:35:44 -0600 Subject: [PATCH] cache: add running/crawling anim opcodes from rev 205 --- .../cache/definitions/NpcDefinition.java | 16 +++++++--- .../cache/definitions/loaders/NpcLoader.java | 30 ++++++++++++++++--- .../cache/definitions/savers/NpcSaver.java | 14 ++++----- 3 files changed, 45 insertions(+), 15 deletions(-) diff --git a/cache/src/main/java/net/runelite/cache/definitions/NpcDefinition.java b/cache/src/main/java/net/runelite/cache/definitions/NpcDefinition.java index 4c66d95fd8..3ee8d73fa5 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/NpcDefinition.java +++ b/cache/src/main/java/net/runelite/cache/definitions/NpcDefinition.java @@ -37,12 +37,20 @@ public class NpcDefinition public int[] models; public int[] chatheadModels; public int standingAnimation = -1; - public int rotateLeftAnimation = -1; - public int rotateRightAnimation = -1; + public int idleRotateLeftAnimation = -1; + public int idleRotateRightAnimation = -1; public int walkingAnimation = -1; public int rotate180Animation = -1; - public int rotate90RightAnimation = -1; - public int rotate90LeftAnimation = -1; + public int rotateLeftAnimation = -1; + public int rotateRightAnimation = -1; + public int runAnimation = -1; + public int runRotate180Animation = -1; + public int runRotateLeftAnimation = -1; + public int runRotateRightAnimation = -1; + public int crawlAnimation = -1; + public int crawlRotate180Animation = -1; + public int crawlRotateLeftAnimation = -1; + public int crawlRotateRightAnimation = -1; public short[] recolorToFind; public short[] recolorToReplace; public short[] retextureToFind; diff --git a/cache/src/main/java/net/runelite/cache/definitions/loaders/NpcLoader.java b/cache/src/main/java/net/runelite/cache/definitions/loaders/NpcLoader.java index 1804340bcb..a4fc0208c6 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/loaders/NpcLoader.java +++ b/cache/src/main/java/net/runelite/cache/definitions/loaders/NpcLoader.java @@ -85,18 +85,18 @@ public class NpcLoader } else if (opcode == 15) { - def.rotateLeftAnimation = stream.readUnsignedShort(); + def.idleRotateLeftAnimation = stream.readUnsignedShort(); } else if (opcode == 16) { - def.rotateRightAnimation = stream.readUnsignedShort(); + def.idleRotateRightAnimation = stream.readUnsignedShort(); } else if (opcode == 17) { def.walkingAnimation = stream.readUnsignedShort(); def.rotate180Animation = stream.readUnsignedShort(); - def.rotate90RightAnimation = stream.readUnsignedShort(); - def.rotate90LeftAnimation = stream.readUnsignedShort(); + def.rotateLeftAnimation = stream.readUnsignedShort(); + def.rotateRightAnimation = stream.readUnsignedShort(); } else if (opcode == 18) { @@ -224,6 +224,28 @@ public class NpcLoader { def.isPet = true; } + else if (opcode == 114) + { + def.runAnimation = stream.readUnsignedShort(); + } + else if (opcode == 115) + { + def.runAnimation = stream.readUnsignedShort(); + def.runRotate180Animation = stream.readUnsignedShort(); + def.runRotateLeftAnimation = stream.readUnsignedShort(); + def.runRotateRightAnimation = stream.readUnsignedShort(); + } + else if (opcode == 116) + { + def.crawlAnimation = stream.readUnsignedShort(); + } + else if (opcode == 117) + { + def.crawlAnimation = stream.readUnsignedShort(); + def.crawlRotate180Animation = stream.readUnsignedShort(); + def.crawlRotateLeftAnimation = stream.readUnsignedShort(); + def.crawlRotateRightAnimation = stream.readUnsignedShort(); + } else if (opcode == 118) { def.varbitId = stream.readUnsignedShort(); diff --git a/cache/src/main/java/net/runelite/cache/definitions/savers/NpcSaver.java b/cache/src/main/java/net/runelite/cache/definitions/savers/NpcSaver.java index 577681cf80..838f0285fd 100644 --- a/cache/src/main/java/net/runelite/cache/definitions/savers/NpcSaver.java +++ b/cache/src/main/java/net/runelite/cache/definitions/savers/NpcSaver.java @@ -62,23 +62,23 @@ public class NpcSaver out.writeByte(14); out.writeShort(npc.walkingAnimation); } - if (npc.rotateLeftAnimation != -1) + if (npc.idleRotateLeftAnimation != -1) { out.writeByte(15); - out.writeShort(npc.rotateLeftAnimation); + out.writeShort(npc.idleRotateLeftAnimation); } - if (npc.rotateRightAnimation != -1) + if (npc.idleRotateRightAnimation != -1) { out.writeByte(16); - out.writeShort(npc.rotateRightAnimation); + out.writeShort(npc.idleRotateRightAnimation); } - if (npc.rotate180Animation != -1 || npc.rotate90LeftAnimation != -1 || npc.rotate90RightAnimation != -1) + if (npc.rotate180Animation != -1 || npc.rotateLeftAnimation != -1 || npc.rotateRightAnimation != -1) { out.writeByte(17); out.writeShort(npc.walkingAnimation); out.writeShort(npc.rotate180Animation); - out.writeShort(npc.rotate90RightAnimation); - out.writeShort(npc.rotate90LeftAnimation); + out.writeShort(npc.rotateLeftAnimation); + out.writeShort(npc.rotateRightAnimation); } for (int i = 0; i < 5; ++i) {