Match WaitForState, SetBattleVar, and func_8026E260 (#473)

* Match WaitForState

* Delete WaitForState.s

* Update unk_95 field.

* Match func_8026E260

* Delete func_8026E260.s

* Match SetBattleVar

* Delete SetBattleVar.s
This commit is contained in:
JoshDuMan 2021-10-16 05:59:17 -04:00 committed by GitHub
parent 072a585908
commit 85ba892809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 98 deletions

View File

@ -700,7 +700,7 @@ typedef struct BattleStatus {
/* 0x092 */ s8 unk_92;
/* 0x093 */ char unk_93;
/* 0x094 */ s8 unk_94;
/* 0x095 */ char unk_95;
/* 0x095 */ s8 unk_95;
/* 0x096 */ s8 hammerCharge;
/* 0x097 */ s8 jumpCharge;
/* 0x098 */ char unk_98;

View File

@ -2057,11 +2057,42 @@ ApiStatus SetBattleState(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "197F40", WaitForState);
ApiStatus WaitForState(Evt* script, s32 isInitialCall) {
BattleStatus* battleStatus = &gBattleStatus;
s32* ptrReadPos = script->ptrReadPos;
s32 temp_v0;
if (isInitialCall) {
temp_v0 = evt_get_variable(script, *ptrReadPos);
if (!temp_v0) {
battleStatus->unk_95 = 0;
return ApiStatus_DONE2;
}
battleStatus->unk_95 = temp_v0;
}
temp_v0 = battleStatus->unk_95;
if (temp_v0) {
return (gBattleState == temp_v0) * 2;
}
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "197F40", CancelEnemyTurn);
INCLUDE_ASM(s32, "197F40", func_8026E260);
ApiStatus func_8026E260(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 actorID = evt_get_variable(script, *args++);
evt_get_variable(script, *args++);
if (actorID == ACTOR_SELF) {
actorID = script->owner1.actorID;
}
get_actor(actorID);
return ApiStatus_DONE2;
}
ApiStatus PlayerCreateTargetList(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
@ -2167,7 +2198,14 @@ ApiStatus func_8026F60C(Evt* script, s32 isInitialCall) {
return ApiStatus_DONE2;
}
INCLUDE_ASM(s32, "197F40", SetBattleVar);
ApiStatus SetBattleVar(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;
s32 varIdx = evt_get_variable(script, *args++);
gBattleStatus.varTable[varIdx] = evt_get_variable(script, *args++);
return ApiStatus_DONE2;
}
ApiStatus GetBattleVar(Evt* script, s32 isInitialCall) {
Bytecode* args = script->ptrReadPos;

View File

@ -1,27 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel SetBattleVar
/* 19DF18 8026F638 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 19DF1C 8026F63C AFB10014 */ sw $s1, 0x14($sp)
/* 19DF20 8026F640 0080882D */ daddu $s1, $a0, $zero
/* 19DF24 8026F644 AFBF0018 */ sw $ra, 0x18($sp)
/* 19DF28 8026F648 AFB00010 */ sw $s0, 0x10($sp)
/* 19DF2C 8026F64C 8E30000C */ lw $s0, 0xc($s1)
/* 19DF30 8026F650 8E050000 */ lw $a1, ($s0)
/* 19DF34 8026F654 0C0B1EAF */ jal evt_get_variable
/* 19DF38 8026F658 26100004 */ addiu $s0, $s0, 4
/* 19DF3C 8026F65C 0220202D */ daddu $a0, $s1, $zero
/* 19DF40 8026F660 8E050000 */ lw $a1, ($s0)
/* 19DF44 8026F664 0C0B1EAF */ jal evt_get_variable
/* 19DF48 8026F668 0040802D */ daddu $s0, $v0, $zero
/* 19DF4C 8026F66C 00108080 */ sll $s0, $s0, 2
/* 19DF50 8026F670 3C01800E */ lui $at, %hi(gBattleStatus+0x8)
/* 19DF54 8026F674 00300821 */ addu $at, $at, $s0
/* 19DF58 8026F678 AC22C078 */ sw $v0, %lo(gBattleStatus+0x8)($at)
/* 19DF5C 8026F67C 8FBF0018 */ lw $ra, 0x18($sp)
/* 19DF60 8026F680 8FB10014 */ lw $s1, 0x14($sp)
/* 19DF64 8026F684 8FB00010 */ lw $s0, 0x10($sp)
/* 19DF68 8026F688 24020002 */ addiu $v0, $zero, 2
/* 19DF6C 8026F68C 03E00008 */ jr $ra
/* 19DF70 8026F690 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,35 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel WaitForState
/* 19CA78 8026E198 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 19CA7C 8026E19C AFB00010 */ sw $s0, 0x10($sp)
/* 19CA80 8026E1A0 3C10800E */ lui $s0, %hi(gBattleStatus)
/* 19CA84 8026E1A4 2610C070 */ addiu $s0, $s0, %lo(gBattleStatus)
/* 19CA88 8026E1A8 AFBF0014 */ sw $ra, 0x14($sp)
/* 19CA8C 8026E1AC 10A00008 */ beqz $a1, .L8026E1D0
/* 19CA90 8026E1B0 8C82000C */ lw $v0, 0xc($a0)
/* 19CA94 8026E1B4 0C0B1EAF */ jal evt_get_variable
/* 19CA98 8026E1B8 8C450000 */ lw $a1, ($v0)
/* 19CA9C 8026E1BC 0040182D */ daddu $v1, $v0, $zero
/* 19CAA0 8026E1C0 54600003 */ bnel $v1, $zero, .L8026E1D0
/* 19CAA4 8026E1C4 A2030095 */ sb $v1, 0x95($s0)
/* 19CAA8 8026E1C8 0809B87D */ j .L8026E1F4
/* 19CAAC 8026E1CC A2000095 */ sb $zero, 0x95($s0)
.L8026E1D0:
/* 19CAB0 8026E1D0 82030095 */ lb $v1, 0x95($s0)
/* 19CAB4 8026E1D4 50600008 */ beql $v1, $zero, .L8026E1F8
/* 19CAB8 8026E1D8 24020002 */ addiu $v0, $zero, 2
/* 19CABC 8026E1DC 3C02800E */ lui $v0, %hi(gBattleState)
/* 19CAC0 8026E1E0 8C42C068 */ lw $v0, %lo(gBattleState)($v0)
/* 19CAC4 8026E1E4 00431026 */ xor $v0, $v0, $v1
/* 19CAC8 8026E1E8 2C420001 */ sltiu $v0, $v0, 1
/* 19CACC 8026E1EC 0809B87E */ j .L8026E1F8
/* 19CAD0 8026E1F0 00021040 */ sll $v0, $v0, 1
.L8026E1F4:
/* 19CAD4 8026E1F4 24020002 */ addiu $v0, $zero, 2
.L8026E1F8:
/* 19CAD8 8026E1F8 8FBF0014 */ lw $ra, 0x14($sp)
/* 19CADC 8026E1FC 8FB00010 */ lw $s0, 0x10($sp)
/* 19CAE0 8026E200 03E00008 */ jr $ra
/* 19CAE4 8026E204 27BD0018 */ addiu $sp, $sp, 0x18

View File

@ -1,32 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_8026E260
/* 19CB40 8026E260 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 19CB44 8026E264 AFB20018 */ sw $s2, 0x18($sp)
/* 19CB48 8026E268 0080902D */ daddu $s2, $a0, $zero
/* 19CB4C 8026E26C AFBF001C */ sw $ra, 0x1c($sp)
/* 19CB50 8026E270 AFB10014 */ sw $s1, 0x14($sp)
/* 19CB54 8026E274 AFB00010 */ sw $s0, 0x10($sp)
/* 19CB58 8026E278 8E50000C */ lw $s0, 0xc($s2)
/* 19CB5C 8026E27C 8E050000 */ lw $a1, ($s0)
/* 19CB60 8026E280 0C0B1EAF */ jal evt_get_variable
/* 19CB64 8026E284 26100004 */ addiu $s0, $s0, 4
/* 19CB68 8026E288 0040882D */ daddu $s1, $v0, $zero
/* 19CB6C 8026E28C 8E050000 */ lw $a1, ($s0)
/* 19CB70 8026E290 0C0B1EAF */ jal evt_get_variable
/* 19CB74 8026E294 0240202D */ daddu $a0, $s2, $zero
/* 19CB78 8026E298 2402FF81 */ addiu $v0, $zero, -0x7f
/* 19CB7C 8026E29C 16220002 */ bne $s1, $v0, .L8026E2A8
/* 19CB80 8026E2A0 00000000 */ nop
/* 19CB84 8026E2A4 8E510148 */ lw $s1, 0x148($s2)
.L8026E2A8:
/* 19CB88 8026E2A8 0C09A75B */ jal get_actor
/* 19CB8C 8026E2AC 0220202D */ daddu $a0, $s1, $zero
/* 19CB90 8026E2B0 8FBF001C */ lw $ra, 0x1c($sp)
/* 19CB94 8026E2B4 8FB20018 */ lw $s2, 0x18($sp)
/* 19CB98 8026E2B8 8FB10014 */ lw $s1, 0x14($sp)
/* 19CB9C 8026E2BC 8FB00010 */ lw $s0, 0x10($sp)
/* 19CBA0 8026E2C0 24020002 */ addiu $v0, $zero, 2
/* 19CBA4 8026E2C4 03E00008 */ jr $ra
/* 19CBA8 8026E2C8 27BD0020 */ addiu $sp, $sp, 0x20