From 9855c6202d7c1561b3f203d9c9bf74e021dab782 Mon Sep 17 00:00:00 2001 From: Alex Bates <16batesa@gmail.com> Date: Tue, 29 Dec 2020 11:37:19 +0000 Subject: [PATCH] dsl: change flag set operator to & --- src/battle/actor/goomba.c | 20 ++++++++++++++------ tools/compile_dsl_macros.py | 8 ++++---- tools/disasm_script.py | 4 ++-- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/battle/actor/goomba.c b/src/battle/actor/goomba.c index c355b76eb7..c426a96abe 100644 --- a/src/battle/actor/goomba.c +++ b/src/battle/actor/goomba.c @@ -108,9 +108,17 @@ s32 idleAnimations_80219714[] = { // 432100-43214C (VRAM: 80219760) s32 idleAnimations_80219760[] = { - 0x00000001, 0x00260003, 0x0000000C, 0x00260000, 0x00000006, 0x00260008, 0x00000009, 0x00260001, - 0x00000008, 0x00260000, 0x0000000B, 0x00260003, 0x00000005, 0x00260000, 0x00000004, 0x00260007, - 0x00000003, 0x00260007, 0x00000000, + Debuff_NORMAL, NPC_ANIM(goomba, normal, run), + Debuff_STONE, NPC_ANIM(goomba, normal, still), + Debuff_SLEEP, NPC_ANIM(goomba, normal, asleep), + Debuff_POISON, NPC_ANIM(goomba, normal, idle), + Debuff_STOP, NPC_ANIM(goomba, normal, still), + Debuff_STATIC, NPC_ANIM(goomba, normal, run), + Debuff_PARALYZE, NPC_ANIM(goomba, normal, still), + Debuff_DIZZY, NPC_ANIM(goomba, normal, dizzy), + Debuff_FEAR, NPC_ANIM(goomba, normal, dizzy), + + Debuff_END, }; // 43214C-432198 (VRAM: 802197AC) @@ -128,7 +136,7 @@ Script script_Idle_802197F8 = SCRIPT({ loop SI_VAR(0) { 0: GetStatusFlags(ActorID_SELF, SI_VAR(1)); - if (SI_VAR(1) ? 0x35D000) { + if (SI_VAR(1) & 0x35D000) { sleep 1; goto 0; } @@ -144,7 +152,7 @@ Script script_Idle_802197F8 = SCRIPT({ loop 20 { 1: GetStatusFlags(ActorID_SELF, SI_VAR(1)); - if (SI_VAR(1) ? 0x35D000) { + if (SI_VAR(1) & 0x35D000) { sleep 1; goto 1; } @@ -160,7 +168,7 @@ Script script_Idle_802197F8 = SCRIPT({ loop 80 { 2: GetStatusFlags(ActorID_SELF, SI_VAR(1)); - if (SI_VAR(1) ? 0x35D000) { + if (SI_VAR(1) & 0x35D000) { sleep 1; goto 2; } diff --git a/tools/compile_dsl_macros.py b/tools/compile_dsl_macros.py index b01285121a..379c27eb4f 100755 --- a/tools/compile_dsl_macros.py +++ b/tools/compile_dsl_macros.py @@ -77,8 +77,8 @@ script_parser = Lark(r""" | "<" -> cond_op_lt | ">=" -> cond_op_ge | "<=" -> cond_op_le - | "?" -> cond_op_flag - | "!?" -> cond_op_not_flag + | "&" -> cond_op_flag + | "!&" -> cond_op_not_flag match_stmt: "match" expr "{" (match_cases SEMICOLON*)? "}" match_const_stmt: "matchc" expr "{" (match_cases SEMICOLON*)? "}" @@ -354,8 +354,8 @@ class Compile(Transformer): def cond_op_gt(self, tree): return { "if": "ScriptOpcode_IF_GT", "case": "ScriptOpcode_CASE_GT" } def cond_op_le(self, tree): return { "if": "ScriptOpcode_IF_LE", "case": "ScriptOpcode_CASE_LE" } def cond_op_ge(self, tree): return { "if": "ScriptOpcode_IF_GE", "case": "ScriptOpcode_CASE_GE" } - def cond_op_flag(self, tree): return { "__op__": "!?", "if": "ScriptOpcode_IF_FLAG", "case": "ScriptOpcode_CASE_FLAG" } - def cond_op_not_flag(self, tree): return { "if": "ScriptOpcode_IF_NOT_FLAG" } + def cond_op_flag(self, tree): return { "__op__": "&", "if": "ScriptOpcode_IF_FLAG", "case": "ScriptOpcode_CASE_FLAG" } + def cond_op_not_flag(self, tree): return { "__op__": "!&", "if": "ScriptOpcode_IF_NOT_FLAG" } def match_stmt(self, tree): expr = tree.children[0] diff --git a/tools/disasm_script.py b/tools/disasm_script.py index 840c674b28..75d58efd81 100755 --- a/tools/disasm_script.py +++ b/tools/disasm_script.py @@ -482,10 +482,10 @@ class ScriptDSLDisassembler(ScriptDisassembler): self.write_line(f"if ({self.var(argv[0])} >= {self.var(argv[1])}) {{") self.indent += 1 elif opcode == 0x10: - self.write_line(f"if ({self.var(argv[0])} ? {self.var(argv[1])}) {{") + self.write_line(f"if ({self.var(argv[0])} & {self.var(argv[1])}) {{") self.indent += 1 elif opcode == 0x11: - self.write_line(f"if ({self.var(argv[0])} !? {self.var(argv[1])}) {{") + self.write_line(f"if ({self.var(argv[0])} !& {self.var(argv[1])}) {{") self.indent += 1 elif opcode == 0x12: self.indent -= 1