From f670e0e7fa0f3ce5c91e3b32b8f6f163c6a10db4 Mon Sep 17 00:00:00 2001 From: Zelllll <56516451+Zelllll@users.noreply.github.com> Date: Thu, 14 Jan 2021 18:49:15 -0600 Subject: [PATCH] code_7345A0 OK --- src/code_1060_len_310.c | 10 +++++++++- src/code_7345A0.c | 26 ++++++++++++++++++++++++-- tools/splat.yaml | 2 +- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/code_1060_len_310.c b/src/code_1060_len_310.c index 57f3c89846..8567eccd80 100644 --- a/src/code_1060_len_310.c +++ b/src/code_1060_len_310.c @@ -1,6 +1,14 @@ #include "common.h" -INCLUDE_ASM(s32, "code_1060_len_310", func_80025C60); +#define ASCII_TO_U32(a, b, c, d) ((u32)((a << 24) | (b << 16) | (c << 8) | (d << 0))) + +void func_80025C60(void) { + OSPiHandle** handle = &carthandle; + + osEPiWriteIo(*handle, 0xB3FF0014, 0); + osEPiWriteIo(*handle, 0xB3FF0004, 0); + osEPiWriteIo(*handle, 0xB3FF0000, ASCII_TO_U32('I', 'S', '6', '4')); +} INCLUDE_ASM(s32, "code_1060_len_310", func_80025CC0); diff --git a/src/code_7345A0.c b/src/code_7345A0.c index 6d2b8d9a87..6b01ed9be3 100644 --- a/src/code_7345A0.c +++ b/src/code_7345A0.c @@ -1,5 +1,27 @@ #include "common.h" -INCLUDE_ASM(s32, "code_7345A0", func_802A1000_7345A0); +ApiStatus func_802A1000_7345A0(ScriptInstance *script, s32 isInitialCall) { + script->varTable[0] = BATTLE_STATUS->unk_83; + script->varTable[1] = 15; -INCLUDE_ASM(s32, "code_7345A0", func_802A1050_7345F0); + if (is_ability_active(Ability_BERSERKER)) { + script->varTable[0] = 0; + script->varTable[1] = 40; + } + + return ApiStatus_DONE2; +} + +ApiStatus func_802A1050_7345F0(ScriptInstance *script, s32 isInitialCall) { + script->varTable[0] = 0; + + if (is_ability_active(Ability_RIGHT_ON)) { + script->varTable[0] = 1; + } + + if(gBattleStatus.flags1 & 0x1000) { + script->varTable[0] = 1; + } + + return ApiStatus_DONE2; +} diff --git a/tools/splat.yaml b/tools/splat.yaml index b79732682a..af5f7d74ff 100644 --- a/tools/splat.yaml +++ b/tools/splat.yaml @@ -2285,7 +2285,7 @@ segments: overlay: True files: - [0x7345A0, c] - - [0x734640, bin] + - [0x734650, bin] - type: code start: 0x737890 vram: 0x802A1000