diff --git a/src/quest_editor/QuestRunner.ts b/src/quest_editor/QuestRunner.ts index 7930373e..6d55d39a 100644 --- a/src/quest_editor/QuestRunner.ts +++ b/src/quest_editor/QuestRunner.ts @@ -276,11 +276,7 @@ export class QuestRunner { } return { - bb_map_designate: ( - area_id: number, - map_number: number, - area_variant_id: number, - ): void => { + map_designate: (area_id: number, area_variant_id: number): void => { this._game_state.area_variants.set( area_id, this.area_store.get_variant(this._game_state.episode, area_id, area_variant_id), diff --git a/src/quest_editor/scripting/vm/VirtualMachine.ts b/src/quest_editor/scripting/vm/VirtualMachine.ts index 3a543619..25ca6ed0 100644 --- a/src/quest_editor/scripting/vm/VirtualMachine.ts +++ b/src/quest_editor/scripting/vm/VirtualMachine.ts @@ -51,6 +51,8 @@ import { OP_LETI, OP_LETW, OP_LIST, + OP_MAP_DESIGNATE, + OP_MAP_DESIGNATE_EX, OP_MOD, OP_MODI, OP_MUL, @@ -477,7 +479,7 @@ export class VirtualMachine { let advance = true; const arg_vals = inst.args.map(arg => arg.value); - const [arg0, arg1, arg2, arg3] = arg_vals; + const [arg0, arg1, arg2] = arg_vals; // previous instruction must've been `list`. // list may not exist after the instruction @@ -814,6 +816,18 @@ export class VirtualMachine { case OP_THREAD_STG.code: this.start_thread(arg0); break; + case OP_MAP_DESIGNATE.code: + this.io.map_designate( + this.get_register_signed(arg0), + this.get_register_signed(arg0 + 2), + ); + break; + case OP_MAP_DESIGNATE_EX.code: + this.io.map_designate( + this.get_register_signed(arg0), + this.get_register_signed(arg0 + 3), + ); + break; case OP_GET_RANDOM.code: { const low = this.get_register_signed(arg0); @@ -860,7 +874,7 @@ export class VirtualMachine { break; case OP_BB_MAP_DESIGNATE.code: - this.io.bb_map_designate(arg0, arg1, arg2, arg3); + this.io.map_designate(arg0, arg2); break; default: if (!this.unsupported_opcodes_logged.has(inst.opcode.code)) { diff --git a/src/quest_editor/scripting/vm/io.ts b/src/quest_editor/scripting/vm/io.ts index d7bd039d..5faa4493 100644 --- a/src/quest_editor/scripting/vm/io.ts +++ b/src/quest_editor/scripting/vm/io.ts @@ -16,12 +16,7 @@ export interface VirtualMachineInput { * The virtual machine calls these methods when it outputs something. */ export interface VirtualMachineOutput { - bb_map_designate( - area_id: number, - map_number: number, - area_variant_id: number, - unknown: number, - ): void; + map_designate(area_id: number, area_variant_id: number): void; set_floor_handler(area_id: number, label: number): void; window_msg(msg: string): void; message(msg: string): void; @@ -53,7 +48,7 @@ export interface VirtualMachineIO VirtualMachineMetaIO {} export class DefaultVirtualMachineIO implements VirtualMachineIO { - bb_map_designate(area_id: number, area_variant_id: number): void { + map_designate(area_id: number, area_variant_id: number): void { logger.warn(`bb_map_designate(${area_id}, ${area_variant_id})`); }