Match deduct_current_move_fp (#521)

* Match deduct_current_move_fp

* Delete deduct_current_move_fp.s

* Fix costFP type

* Match reset_actor_turn_info

* Delete reset_actor_turn_info.s

* Cleanup

* Address Ethan's comment
This commit is contained in:
JoshDuMan 2021-11-07 04:20:08 -05:00 committed by GitHub
parent 95ea4223d5
commit 97523d8af1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 78 deletions

View File

@ -812,7 +812,7 @@ typedef struct StaticMove {
/* 0x08 */ s32 worldDescID;
/* 0x0C */ s32 menuDescID;
/* 0x10 */ s8 battleSubmenu;
/* 0x11 */ u8 costFP;
/* 0x11 */ s8 costFP;
/* 0x12 */ s8 costBP;
/* 0x13 */ u8 actionCommandID;
} StaticMove; // size = 0x14

View File

@ -1157,9 +1157,49 @@ s32 count_power_plus(s32 arg0) {
return pp;
}
INCLUDE_ASM(s32, "190B20", deduct_current_move_fp);
void deduct_current_move_fp(void) {
BattleStatus* battleStatus = &gBattleStatus;
PlayerData* playerData = &gPlayerData;
Actor* actor = battleStatus->playerActor;
s32 fpCost = gMoveTable[battleStatus->selectedMoveID].costFP;
INCLUDE_ASM(s32, "190B20", reset_actor_turn_info);
if (fpCost != 0) {
fpCost -= player_team_is_ability_active(actor, ABILITY_FLOWER_SAVER);
fpCost -= player_team_is_ability_active(actor, ABILITY_FLOWER_FANATIC) * 2;
if (fpCost < 1) {
fpCost = 1;
}
}
playerData->curFP -= fpCost;
}
void reset_actor_turn_info(void) {
BattleStatus* battleStatus = &gBattleStatus;
Actor* actor;
s32 i;
for (i = 0; i < ARRAY_COUNT(battleStatus->enemyActors); i++) {
actor = battleStatus->enemyActors[i];
if (actor != NULL) {
actor->hpChangeCounter = 0;
actor->damageCounter = 0;
actor->unk_204[0] = 0;
}
}
actor = battleStatus->playerActor;
actor->hpChangeCounter = 0;
actor->damageCounter = 0;
actor->unk_204[0] = 0;
actor = battleStatus->partnerActor;
if (actor != NULL) {
actor->hpChangeCounter = 0;
actor->damageCounter = 0;
actor->unk_204[0] = 0;
}
}
INCLUDE_ASM(s32, "190B20", func_80263CC4);

View File

@ -1,43 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel deduct_current_move_fp
/* 1924A8 80263BC8 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 1924AC 80263BCC 3C04800E */ lui $a0, %hi(gBattleStatus)
/* 1924B0 80263BD0 2484C070 */ addiu $a0, $a0, %lo(gBattleStatus)
/* 1924B4 80263BD4 AFBF001C */ sw $ra, 0x1c($sp)
/* 1924B8 80263BD8 AFB20018 */ sw $s2, 0x18($sp)
/* 1924BC 80263BDC AFB10014 */ sw $s1, 0x14($sp)
/* 1924C0 80263BE0 AFB00010 */ sw $s0, 0x10($sp)
/* 1924C4 80263BE4 8483017C */ lh $v1, 0x17c($a0)
/* 1924C8 80263BE8 3C128011 */ lui $s2, %hi(gPlayerData)
/* 1924CC 80263BEC 2652F290 */ addiu $s2, $s2, %lo(gPlayerData)
/* 1924D0 80263BF0 00031080 */ sll $v0, $v1, 2
/* 1924D4 80263BF4 00431021 */ addu $v0, $v0, $v1
/* 1924D8 80263BF8 00021080 */ sll $v0, $v0, 2
/* 1924DC 80263BFC 3C108009 */ lui $s0, %hi(D_8008F071)
/* 1924E0 80263C00 02028021 */ addu $s0, $s0, $v0
/* 1924E4 80263C04 8210F071 */ lb $s0, %lo(D_8008F071)($s0)
/* 1924E8 80263C08 8C9100D8 */ lw $s1, 0xd8($a0)
/* 1924EC 80263C0C 1200000B */ beqz $s0, .L80263C3C
/* 1924F0 80263C10 0220202D */ daddu $a0, $s1, $zero
/* 1924F4 80263C14 0C099CAB */ jal player_team_is_ability_active
/* 1924F8 80263C18 24050018 */ addiu $a1, $zero, 0x18
/* 1924FC 80263C1C 02028023 */ subu $s0, $s0, $v0
/* 192500 80263C20 0220202D */ daddu $a0, $s1, $zero
/* 192504 80263C24 0C099CAB */ jal player_team_is_ability_active
/* 192508 80263C28 24050026 */ addiu $a1, $zero, 0x26
/* 19250C 80263C2C 00021040 */ sll $v0, $v0, 1
/* 192510 80263C30 02028023 */ subu $s0, $s0, $v0
/* 192514 80263C34 5A000001 */ blezl $s0, .L80263C3C
/* 192518 80263C38 24100001 */ addiu $s0, $zero, 1
.L80263C3C:
/* 19251C 80263C3C 92420005 */ lbu $v0, 5($s2)
/* 192520 80263C40 00501023 */ subu $v0, $v0, $s0
/* 192524 80263C44 A2420005 */ sb $v0, 5($s2)
/* 192528 80263C48 8FBF001C */ lw $ra, 0x1c($sp)
/* 19252C 80263C4C 8FB20018 */ lw $s2, 0x18($sp)
/* 192530 80263C50 8FB10014 */ lw $s1, 0x14($sp)
/* 192534 80263C54 8FB00010 */ lw $s0, 0x10($sp)
/* 192538 80263C58 03E00008 */ jr $ra
/* 19253C 80263C5C 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -1,32 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel reset_actor_turn_info
/* 192540 80263C60 0000202D */ daddu $a0, $zero, $zero
/* 192544 80263C64 3C05800E */ lui $a1, %hi(gBattleStatus)
/* 192548 80263C68 24A5C070 */ addiu $a1, $a1, %lo(gBattleStatus)
/* 19254C 80263C6C 00A0182D */ daddu $v1, $a1, $zero
.L80263C70:
/* 192550 80263C70 8C6200E0 */ lw $v0, 0xe0($v1)
/* 192554 80263C74 10400004 */ beqz $v0, .L80263C88
/* 192558 80263C78 24840001 */ addiu $a0, $a0, 1
/* 19255C 80263C7C A44001FA */ sh $zero, 0x1fa($v0)
/* 192560 80263C80 A44001FC */ sh $zero, 0x1fc($v0)
/* 192564 80263C84 A0400204 */ sb $zero, 0x204($v0)
.L80263C88:
/* 192568 80263C88 28820018 */ slti $v0, $a0, 0x18
/* 19256C 80263C8C 1440FFF8 */ bnez $v0, .L80263C70
/* 192570 80263C90 24630004 */ addiu $v1, $v1, 4
/* 192574 80263C94 8CA200D8 */ lw $v0, 0xd8($a1)
/* 192578 80263C98 A44001FA */ sh $zero, 0x1fa($v0)
/* 19257C 80263C9C A44001FC */ sh $zero, 0x1fc($v0)
/* 192580 80263CA0 A0400204 */ sb $zero, 0x204($v0)
/* 192584 80263CA4 8CA200DC */ lw $v0, 0xdc($a1)
/* 192588 80263CA8 10400004 */ beqz $v0, .L80263CBC
/* 19258C 80263CAC 00000000 */ nop
/* 192590 80263CB0 A44001FA */ sh $zero, 0x1fa($v0)
/* 192594 80263CB4 A44001FC */ sh $zero, 0x1fc($v0)
/* 192598 80263CB8 A0400204 */ sb $zero, 0x204($v0)
.L80263CBC:
/* 19259C 80263CBC 03E00008 */ jr $ra
/* 1925A0 80263CC0 00000000 */ nop