SetSelfEnemyFlagBits

This commit is contained in:
Ethan Roseman 2020-09-27 19:57:02 -04:00
parent 164c6e76d3
commit c541824930
2 changed files with 12 additions and 30 deletions

View File

@ -1,29 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel SetSelfEnemyFlagBits
/* 20924 80045524 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 20928 80045528 AFBF0018 */ sw $ra, 0x18($sp)
/* 2092C 8004552C AFB10014 */ sw $s1, 0x14($sp)
/* 20930 80045530 AFB00010 */ sw $s0, 0x10($sp)
/* 20934 80045534 8C82000C */ lw $v0, 0xc($a0)
/* 20938 80045538 8C900148 */ lw $s0, 0x148($a0)
/* 2093C 8004553C 8C450004 */ lw $a1, 4($v0)
/* 20940 80045540 0C0B1EAF */ jal get_variable
/* 20944 80045544 8C510000 */ lw $s1, ($v0)
/* 20948 80045548 10400004 */ beqz $v0, .L8004555C
/* 2094C 8004554C 00111827 */ nor $v1, $zero, $s1
/* 20950 80045550 8E020000 */ lw $v0, ($s0)
/* 20954 80045554 08011559 */ j .L80045564
/* 20958 80045558 00511025 */ or $v0, $v0, $s1
.L8004555C:
/* 2095C 8004555C 8E020000 */ lw $v0, ($s0)
/* 20960 80045560 00431024 */ and $v0, $v0, $v1
.L80045564:
/* 20964 80045564 AE020000 */ sw $v0, ($s0)
/* 20968 80045568 8FBF0018 */ lw $ra, 0x18($sp)
/* 2096C 8004556C 8FB10014 */ lw $s1, 0x14($sp)
/* 20970 80045570 8FB00010 */ lw $s0, 0x10($sp)
/* 20974 80045574 24020002 */ addiu $v0, $zero, 2
/* 20978 80045578 03E00008 */ jr $ra
/* 2097C 8004557C 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -112,7 +112,18 @@ ApiStatus SetSelfEnemyFlags(ScriptInstance* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "code_1f580_len_1940", SetSelfEnemyFlagBits, ScriptInstance* script, s32 isInitialCall);
ApiStatus SetSelfEnemyFlagBits(ScriptInstance* script, s32 isInitialCall) {
Bytecode* thisPos = script->ptrReadPos;
Enemy* owner = script->ownerActorID;
s32 bits = thisPos[0];
if (get_variable(script, thisPos[1])) {
owner->flags |= bits;
} else {
owner->flags &= ~bits;
}
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "code_1f580_len_1940", func_80045580);