Add sound effects for chivalry, piety, potionmaking, and pouchmaking.

This commit is contained in:
Avi Weinstock 2021-10-14 16:51:23 -04:00
parent e7515d404b
commit a91fc0e7ca
8 changed files with 52 additions and 5 deletions

View file

@ -204,6 +204,7 @@ public final class CS2Script extends Linkable {
Object[] aobj = script.arguments;
int j = ((Integer) aobj[0]).intValue();
AssembledMethod currentMethod = ItemDefinition.getMethodByID(j);
// System.out.printf("Method id: %d\n", j);
if (null == currentMethod)
return;
ItemDefinition.scriptHeapCounter = 0;
@ -270,7 +271,7 @@ public final class CS2Script extends Linkable {
if (maxIterations < j2)
throw new RuntimeException("Script exceeded max iterations");
int opcode = instructions[++programCounter];
//System.out.println("Instruction: " + programCounter + ". opcode is: " + opcode);
// System.out.println("Instruction: " + programCounter + ". opcode is: " + opcode);
if (opcode < 100) {
if (opcode == CS2AsmOpcodes.PUSH_INT.getOp()) {
ItemDefinition.intsStack[iStackCounter++] = instructionOperands[programCounter];
@ -333,6 +334,7 @@ public final class CS2Script extends Linkable {
if (opcode == 25) {
int j3 = instructionOperands[programCounter];
ItemDefinition.intsStack[iStackCounter++] = NPCDefinition.method1484(j3);
// System.out.printf("varp lookup: %s %s\n", j3, ItemDefinition.intsStack[iStackCounter-1]);
continue;
}
if (opcode == 27) {
@ -964,6 +966,7 @@ public final class CS2Script extends Linkable {
if (opcode == 3306) { //Another Skill update listener (spams 10? Possible TOTAL hp)
int j9 = ItemDefinition.intsStack[--iStackCounter];
ItemDefinition.intsStack[iStackCounter++] = Class3_Sub20.anIntArray2480[j9];
//System.out.printf("3306 -> %s: %s\n", j9, ItemDefinition.intsStack[iStackCounter - 1]);
continue;
}
if (3307 == opcode) { //Hover tooltip for Skill Interface, total xp for selected skill

View file

@ -28,13 +28,33 @@ public class DumpingTools {
//DumpToRuneStarCompatible("binaryScripts"); // Requires making the folder first. Probably the most useful one.
}
public static String FriendlyOpcodeName(int i, int opcode, int arg) {
switch(opcode) {
case 0: return String.format("push_int %d (%08x)", arg, arg);
case 6: return String.format("jmp +%d (%04d)", arg, i + 1 + arg);
case 7: return String.format("bne +%d (%04d)", arg, i + 1 + arg);
case 8: return String.format("be +%d (%04d)", arg, i + 1 + arg);
case 9: return String.format("bgt +%d (%04d)", arg, i + 1 + arg);
case 10: return String.format("blt +%d (%04d)", arg, i + 1 + arg);
case 21: return String.format("ret %d", arg);
case 25: return String.format("fetch_varbit %d", arg);
case 33: return String.format("push_arg %d", arg);
case 3305: return String.format("getcurrentlevel %d", arg);
case 3306: return String.format("getstaticlevel %d", arg);
case 3200: return String.format("playsfx %d", arg);
default: return String.format("unknown (%d: %d)", opcode, arg);
}
}
public static void DumpOpcodesToTextFile(String outputFile, int methodID) {
try {
AssembledMethod a = ItemDefinition.getMethodByID(methodID);
FileWriter myWriter = new FileWriter(outputFile);
myWriter.write("Opcodes for Method" + methodID + ":\n");
for (int opcode : a.assemblyInstructions) {
myWriter.write(opcode + "\n");
for (int i = 0; i < a.assemblyInstructions.length; i++) {
int opcode = a.assemblyInstructions[i];
int arg = a.instructionOperands[i];
myWriter.write(String.format("%04d: %s\n", i, FriendlyOpcodeName(i, opcode, arg)));
}
myWriter.close();
} catch (IOException e) {