dsl: change flag set operator to &

This commit is contained in:
Alex Bates 2020-12-29 11:37:19 +00:00
parent 77a3238a3b
commit 9855c6202d
3 changed files with 20 additions and 12 deletions

View File

@ -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;
}

View File

@ -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]

View File

@ -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