diff --git a/src/components/ScriptCodeInstruction.js b/src/components/ScriptCodeInstruction.js
index 9c8e104..875b1c5 100644
--- a/src/components/ScriptCodeInstruction.js
+++ b/src/components/ScriptCodeInstruction.js
@@ -7,6 +7,59 @@ const prettifyArguments = (operation) => {
let args = operation.slice(2);
switch (opCode) {
+ // resourceRoutines
+ case 0x0c:
+ case 0x8c:
+ if (args[0].endsWith('Costume')) {
+ // Note: The link goes to costume set 0. The actual costume set used can't be determined statically.
+ args = [
+
+ {args[0]}({args[1]})
+ ,
+ ];
+ } else if (args[0].endsWith('Room')) {
+ args = [
+
+ {args[0]}({args[1]})
+ ,
+ ];
+ } else if (args[0].endsWith('Script')) {
+ args = [
+
+ {args[0]}({args[1]})
+ ,
+ ];
+ }
+ break;
+ // actorOps
+ case 0x13:
+ case 0x53:
+ case 0x93:
+ case 0xd3:
+ if (args[1] === 'Color') {
+ args = [args[0], `${args[1]}(${args[3]}, ${args[2]})`];
+ } else if (args[1] === 'Name') {
+ args = [args[0], `${args[1]}("${args[2]}")`];
+ } else if (args[1] === 'Costume') {
+ // Note: The link goes to costume set 0. The actual costume set used can't be determined statically.
+ args = [
+ args[0],
+
+ {args[1]}({args[2]})
+ ,
+ ];
+ } else {
+ args = [args[0], `${args[1]}(${args[2]})`];
+ }
+ break;
case 0x18: // goTo
args = [
{
args[3],
];
break;
+ // loadRoom
case 0x72:
args = [
{
case 0x0c:
case 0x8c: {
const resTypes = [
- 0, // Invalid
- 0, // Invalid
+ null, // Invalid
+ null, // Invalid
'Costume',
'Room',
- '0', // Invalid
+ null, // Invalid
'Script',
'Sound',
];
@@ -169,7 +169,7 @@ const parseScriptCode = (parser, startAddress, parentOffset = 0) => {
}
const type = resTypes[subOp >> 4];
- if (type === 0) {
+ if (!type) {
console.error(`Resource Routines: Invalid type ${type}`);
}
@@ -242,21 +242,27 @@ const parseScriptCode = (parser, startAddress, parentOffset = 0) => {
const subOp = parser.getUint8();
switch (subOp) {
case 0x01:
- scriptRow.push(`Sound(${subOpArg})`);
+ scriptRow.push(`Sound`);
+ scriptRow.push(subOpArg);
break;
case 0x02:
const value = parser.getUint8();
- scriptRow.push(`Color(${value}, ${subOpArg})`);
+ scriptRow.push(`Color`);
+ scriptRow.push(subOpArg);
+ scriptRow.push(value);
break;
case 0x03:
const name = parser.getString();
- scriptRow.push(`Name("${name}")`);
+ scriptRow.push(`Name`);
+ scriptRow.push(name);
break;
case 0x04:
- scriptRow.push(`Costume(${subOpArg})`);
+ scriptRow.push(`Costume`);
+ scriptRow.push(subOpArg);
break;
case 0x05:
- scriptRow.push(`TalkColor(${subOpArg})`);
+ scriptRow.push(`TalkColor`);
+ scriptRow.push(subOpArg);
break;
default:
scriptRow.push(`// Unknown subop: 0x${hex(subOp, 2)}`);