From 40a44a8508fb728e2bc528586c6fba717222751f Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 17 Nov 2018 22:55:39 +0100 Subject: [PATCH] more battle pytamid --- asm/battle_pyramid.s | 1183 ------------------------------------------ src/battle_pyramid.c | 425 ++++++++++++++- src/overworld.c | 4 +- src/start_menu.c | 6 +- 4 files changed, 415 insertions(+), 1203 deletions(-) diff --git a/asm/battle_pyramid.s b/asm/battle_pyramid.s index 8d1c5b6b6..eb63d0838 100644 --- a/asm/battle_pyramid.s +++ b/asm/battle_pyramid.s @@ -8,1189 +8,6 @@ - thumb_func_start sub_81A9834 -sub_81A9834: @ 81A9834 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - movs r0, 0 - str r0, [sp] -_081A9844: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r2, [sp] - lsls r1, r2, 1 - ldr r5, =0x00000caa - adds r0, r5 - adds r0, r1 - ldrh r0, [r0] - subs r5, r0, 0x1 - movs r0, 0 - str r0, [sp, 0x4] - movs r2, 0x64 - adds r1, r5, 0 - muls r1, r2 - str r1, [sp, 0x8] - movs r0, 0x8E - lsls r0, 2 - adds r6, r1, r0 - movs r1, 0 - str r1, [sp, 0x10] -_081A986C: - ldr r2, =gSaveBlock1Ptr - ldr r0, [r2] - adds r0, r6 - movs r1, 0xB - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - ldr r3, =gPlayerParty - ldr r1, [sp, 0x10] - adds r0, r1, r3 - movs r1, 0xB - movs r2, 0 - str r3, [sp, 0x14] - bl GetMonData - ldr r3, [sp, 0x14] - cmp r4, r0 - bne _081A993C - movs r6, 0 - adds r2, r5, 0x1 - str r2, [sp, 0xC] - movs r1, 0x64 - adds r0, r5, 0 - muls r0, r1 - movs r5, 0x8E - lsls r5, 2 - adds r5, r0 - mov r9, r5 - ldr r7, [sp, 0x4] - muls r7, r1 - mov r10, r3 -_081A98AC: - movs r5, 0 - adds r0, r6, 0x1 - mov r8, r0 - b _081A98C6 - .pool -_081A98C4: - adds r5, 0x1 -_081A98C6: - cmp r5, 0x3 - bgt _081A98EE - ldr r1, =gSaveBlock1Ptr - ldr r0, [r1] - add r0, r9 - adds r1, r5, 0 - adds r1, 0xD - movs r2, 0 - bl GetMonData - adds r4, r0, 0 - adds r1, r6, 0 - adds r1, 0xD - mov r2, r10 - adds r0, r7, r2 - movs r2, 0 - bl GetMonData - cmp r4, r0 - bne _081A98C4 -_081A98EE: - cmp r5, 0x4 - bne _081A9900 - lsls r2, r6, 24 - lsrs r2, 24 - mov r5, r10 - adds r0, r7, r5 - movs r1, 0xA6 - bl SetMonMoveSlot -_081A9900: - mov r6, r8 - cmp r6, 0x3 - ble _081A98AC - ldr r1, =gSaveBlock1Ptr - ldr r0, [r1] - ldr r2, [sp, 0x8] - adds r0, r2 - movs r5, 0x8E - lsls r5, 2 - adds r0, r5 - ldr r1, =gPlayerParty - ldr r2, [sp, 0x10] - adds r1, r2, r1 - movs r2, 0x64 - bl memcpy - ldr r0, =gUnknown_0203CEF8 - ldr r5, [sp, 0x4] - adds r0, r5, r0 - mov r1, sp - ldrb r1, [r1, 0xC] - strb r1, [r0] - b _081A994C - .pool -_081A993C: - ldr r2, [sp, 0x10] - adds r2, 0x64 - str r2, [sp, 0x10] - ldr r0, [sp, 0x4] - adds r0, 0x1 - str r0, [sp, 0x4] - cmp r0, 0x2 - ble _081A986C -_081A994C: - ldr r1, [sp] - adds r1, 0x1 - str r1, [sp] - cmp r1, 0x2 - bgt _081A9958 - b _081A9844 -_081A9958: - movs r2, 0 - str r2, [sp] - ldr r4, =gSaveBlock2Ptr - ldr r3, =0x00000caa - ldr r2, =gUnknown_0203CEF8 -_081A9962: - ldr r1, [r4] - ldr r5, [sp] - lsls r0, r5, 1 - adds r1, r3 - adds r1, r0 - adds r0, r5, r2 - ldrb r0, [r0] - strh r0, [r1] - adds r5, 0x1 - str r5, [sp] - cmp r5, 0x2 - ble _081A9962 - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A9834 - - thumb_func_start sub_81A9998 -sub_81A9998: @ 81A9998 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r10, r0 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r2, 24 - lsrs r7, r2, 24 - movs r4, 0 - ldr r0, =gUnknown_03005DC0 - ldr r5, [r0, 0x8] - ldr r1, [r0] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 1 - adds r0, 0xE - adds r5, r0 - movs r3, 0 - ldr r0, =0x000003ff - mov r8, r0 - ldr r1, =0x0000028e - mov r12, r1 - ldr r0, =gEventObjects - mov r9, r0 -_081A99CC: - movs r2, 0 -_081A99CE: - lsls r0, r2, 1 - adds r0, r5 - ldrh r1, [r0] - mov r0, r8 - ands r0, r1 - cmp r0, r12 - bne _081A9A8A - adds r2, 0x7 - ldr r0, =gSelectedEventObject - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - add r0, r9 - movs r5, 0xC - ldrsh r1, [r0, r5] - subs r2, r1 - adds r1, r3, 0x7 - movs r3, 0xE - ldrsh r0, [r0, r3] - subs r3, r1, r0 - cmp r2, r6 - bge _081A9A0E - negs r0, r6 - cmp r2, r0 - ble _081A9A0E - cmp r3, r6 - bge _081A9A0E - cmp r3, r0 - ble _081A9A0E - cmp r7, 0 - bne _081A9A84 -_081A9A0E: - cmp r2, 0 - ble _081A9A34 - cmp r3, 0 - ble _081A9A34 - movs r4, 0x3 - cmp r2, r3 - blt _081A9A7C - movs r4, 0x2 - b _081A9A7C - .pool -_081A9A34: - cmp r2, 0 - bge _081A9A46 - cmp r3, 0 - bge _081A9A46 - movs r4, 0x1 - cmp r2, r3 - ble _081A9A7C - movs r4, 0 - b _081A9A7C -_081A9A46: - cmp r2, 0 - bne _081A9A54 - movs r4, 0 - cmp r3, 0 - ble _081A9A7C - movs r4, 0x3 - b _081A9A7C -_081A9A54: - cmp r3, 0 - bne _081A9A62 - movs r4, 0x1 - cmp r2, 0 - ble _081A9A7C - movs r4, 0x2 - b _081A9A7C -_081A9A62: - cmp r2, 0 - bge _081A9A72 - adds r0, r2, r3 - movs r4, 0x1 - cmp r0, 0 - ble _081A9A7C - movs r4, 0x3 - b _081A9A7C -_081A9A72: - adds r0, r2, r3 - mvns r0, r0 - asrs r4, r0, 31 - movs r0, 0x2 - ands r4, r0 -_081A9A7C: - movs r0, 0 - mov r5, r10 - str r0, [r5] - b _081A9A98 -_081A9A84: - mov r0, r10 - str r7, [r0] - b _081A9A98 -_081A9A8A: - adds r2, 0x1 - cmp r2, 0x1F - ble _081A99CE - adds r5, 0x5E - adds r3, 0x1 - cmp r3, 0x1F - ble _081A99CC -_081A9A98: - adds r0, r4, 0 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81A9998 - - thumb_func_start sub_81A9AA8 -sub_81A9AA8: @ 81A9AA8 - lsls r0, 24 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - lsrs r0, 23 - adds r1, r0 - ldr r0, =0x00000cb2 - adds r1, r0 - ldrh r0, [r1] - bx lr - .pool - thumb_func_end sub_81A9AA8 - - thumb_func_start GetBattlePyramidTrainerFlag -GetBattlePyramidTrainerFlag: @ 81A9AC4 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSaveBlock2Ptr - ldr r2, [r1] - ldr r1, =0x00000e2a - adds r2, r1 - ldr r4, =gBitTable - ldr r3, =gEventObjects - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - adds r1, r3 - ldrb r0, [r1, 0x8] - subs r0, 0x1 - lsls r0, 2 - adds r0, r4 - ldr r0, [r0] - ldrb r1, [r2] - ands r0, r1 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end GetBattlePyramidTrainerFlag - - thumb_func_start sub_81A9B04 -sub_81A9B04: @ 81A9B04 - push {lr} - ldr r0, =gTrainerBattleOpponent_A - ldrh r0, [r0] - bl sub_81A9B44 - ldr r0, =gBattleTypeFlags - ldr r0, [r0] - movs r1, 0x80 - lsls r1, 8 - ands r0, r1 - cmp r0, 0 - beq _081A9B2E - movs r0, 0x1 - bl GetChosenApproachingTrainerEventObjectId - ldr r1, =gSelectedEventObject - strb r0, [r1] - ldr r0, =gTrainerBattleOpponent_B - ldrh r0, [r0] - bl sub_81A9B44 -_081A9B2E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A9B04 - - thumb_func_start sub_81A9B44 -sub_81A9B44: @ 81A9B44 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 16 - lsrs r5, r0, 16 - movs r3, 0 - ldr r0, =gEventObjects - mov r12, r0 - ldr r6, =gSelectedEventObject - ldr r1, =gSaveBlock1Ptr - mov r10, r1 - ldr r7, =gSaveBlock2Ptr - mov r9, r7 - ldr r0, =0x00000cb4 - mov r8, r0 - ldr r4, =gBitTable -_081A9B68: - mov r1, r9 - ldr r2, [r1] - lsls r0, r3, 1 - mov r7, r8 - adds r1, r2, r7 - adds r1, r0 - ldrh r0, [r1] - cmp r0, r5 - bne _081A9B86 - ldr r1, =0x00000e2a - adds r0, r2, r1 - ldr r1, [r4] - ldrb r2, [r0] - orrs r1, r2 - strb r1, [r0] -_081A9B86: - adds r4, 0x4 - adds r3, 0x1 - cmp r3, 0x7 - ble _081A9B68 - ldrb r1, [r6] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - add r0, r12 - movs r3, 0x2 - strb r3, [r0, 0x6] - mov r7, r10 - ldr r2, [r7] - ldr r0, =gSpecialVar_LastTalked - ldrh r1, [r0] - subs r1, 0x1 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - adds r2, r0 - ldr r1, =0x00000c79 - adds r2, r1 - strb r3, [r2] - ldrb r1, [r6] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - add r0, r12 - ldrh r1, [r0, 0x10] - strh r1, [r0, 0xC] - ldrb r1, [r6] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - add r0, r12 - ldrh r1, [r0, 0x12] - strh r1, [r0, 0xE] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A9B44 - - thumb_func_start GenerateBattlePyramidWildMon -GenerateBattlePyramidWildMon: @ 81A9C04 - push {r4-r6,lr} - sub sp, 0x14 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - ldr r2, =0x00000ca9 - adds r0, r1, r2 - ldrb r0, [r0] - lsls r0, 30 - lsrs r5, r0, 30 - lsls r0, r5, 1 - ldr r2, =0x00000e1a - adds r1, r2 - adds r1, r0 - ldrh r0, [r1] - movs r1, 0x7 - bl __udivsi3 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x14 - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x13 - bls _081A9C3A - movs r0, 0x13 -_081A9C3A: - cmp r5, 0 - beq _081A9C54 - ldr r1, =gBattlePyramidOpenLevelWildMonPointers - b _081A9C56 - .pool -_081A9C54: - ldr r1, =gBattlePyramidLevel50WildMonPointers -_081A9C56: - lsls r0, 2 - adds r0, r1 - ldr r6, [r0] - ldr r4, =gEnemyParty - adds r0, r4, 0 - movs r1, 0xB - movs r2, 0 - bl GetMonData - subs r0, 0x1 - str r0, [sp, 0x10] - lsls r2, r0, 1 - adds r2, r0 - lsls r2, 2 - adds r2, r6, r2 - adds r0, r4, 0 - movs r1, 0xB - bl SetMonData - ldr r1, [sp, 0x10] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrh r1, [r0] - mov r0, sp - bl GetSpeciesName - adds r0, r4, 0 - movs r1, 0x2 - mov r2, sp - bl SetMonData - cmp r5, 0 - beq _081A9CD4 - bl SetFacilityPtrsGetLevel - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, [sp, 0x10] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r0, [r0, 0x2] - subs r5, r0 - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xB - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - subs r0, 0x5 - adds r5, r0 - b _081A9CF6 - .pool -_081A9CD4: - bl Random - ldr r2, [sp, 0x10] - lsls r1, r2, 1 - adds r1, r2 - lsls r1, 2 - adds r1, r6 - ldrb r4, [r1, 0x2] - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xB - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - subs r0, 0x5 - adds r5, r4, r0 -_081A9CF6: - ldr r4, =gEnemyParty - ldr r2, =gBaseStats - ldr r1, [sp, 0x10] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrh r1, [r0] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x13] - movs r0, 0xCA - lsls r0, 1 - adds r2, r1, 0 - muls r2, r0 - lsls r0, r5, 2 - ldr r1, =gExperienceTables - adds r0, r1 - adds r2, r0 - adds r0, r4, 0 - movs r1, 0x19 - bl SetMonData - ldr r1, [sp, 0x10] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r1, [r0, 0x3] - cmp r1, 0 - blt _081A9D4C - cmp r1, 0x1 - bgt _081A9D4C - adds r2, r0, 0x3 - b _081A9D7C - .pool -_081A9D4C: - ldr r2, =gBaseStats - ldr r1, [sp, 0x10] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrh r1, [r0] - lsls r0, r1, 3 - subs r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x17] - cmp r0, 0 - beq _081A9D90 - ldr r4, =gEnemyParty - adds r0, r4, 0 - movs r1, 0 - movs r2, 0 - bl GetMonData - movs r1, 0x1 - ands r1, r0 - str r1, [sp, 0xC] - add r2, sp, 0xC -_081A9D7C: - adds r0, r4, 0 - movs r1, 0x2E - bl SetMonData - b _081A9D9C - .pool -_081A9D90: - str r0, [sp, 0xC] - ldr r0, =gEnemyParty - add r2, sp, 0xC - movs r1, 0x2E - bl SetMonData -_081A9D9C: - movs r0, 0 - str r0, [sp, 0xC] - movs r2, 0 - lsls r4, r5, 1 -_081A9DA4: - ldr r1, [sp, 0x10] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - lsls r1, r2, 1 - adds r0, 0x4 - adds r0, r1 - ldrh r1, [r0] - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gEnemyParty - bl SetMonMoveSlot - ldr r0, [sp, 0xC] - adds r0, 0x1 - str r0, [sp, 0xC] - adds r2, r0, 0 - cmp r2, 0x3 - ble _081A9DA4 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000e1a - adds r0, r1 - adds r0, r4 - ldrh r0, [r0] - cmp r0, 0x8B - bls _081A9E0C - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x11 - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - adds r0, 0xF - str r0, [sp, 0x10] - movs r0, 0 - str r0, [sp, 0xC] -_081A9DF6: - adds r1, r0, 0 - adds r1, 0x27 - ldr r0, =gEnemyParty - add r2, sp, 0x10 - bl SetMonData - ldr r0, [sp, 0xC] - adds r0, 0x1 - str r0, [sp, 0xC] - cmp r0, 0x5 - ble _081A9DF6 -_081A9E0C: - ldr r0, =gEnemyParty - bl CalculateMonStats - add sp, 0x14 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end GenerateBattlePyramidWildMon - - thumb_func_start sub_81A9E28 -sub_81A9E28: @ 81A9E28 - push {lr} - bl sub_81AA9E4 - lsls r0, 24 - ldr r1, =gUnknown_08613650 - lsrs r0, 20 - adds r0, r1 - ldrb r0, [r0, 0x4] - pop {r1} - bx r1 - .pool - thumb_func_end sub_81A9E28 - - thumb_func_start InBattlePyramid -InBattlePyramid: @ 81A9E40 - push {lr} - ldr r0, =gMapHeader - ldrh r1, [r0, 0x12] - ldr r0, =0x00000169 - cmp r1, r0 - bne _081A9E58 - movs r0, 0x1 - b _081A9E66 - .pool -_081A9E58: - movs r0, 0xBD - lsls r0, 1 - cmp r1, r0 - beq _081A9E64 - movs r0, 0 - b _081A9E66 -_081A9E64: - movs r0, 0x2 -_081A9E66: - pop {r1} - bx r1 - thumb_func_end InBattlePyramid - - thumb_func_start sub_81A9E6C -sub_81A9E6C: @ 81A9E6C - push {lr} - movs r2, 0 - ldr r0, =gMapHeader - ldrh r1, [r0, 0x12] - ldr r0, =0x00000169 - cmp r1, r0 - beq _081A9E80 - adds r0, 0x11 - cmp r1, r0 - bne _081A9E82 -_081A9E80: - movs r2, 0x1 -_081A9E82: - adds r0, r2, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81A9E6C - - thumb_func_start sub_81A9E90 -sub_81A9E90: @ 81A9E90 - push {lr} - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - beq _081A9EB8 - bl sub_81A9834 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000ca8 - adds r0, r1 - movs r1, 0x2 - strb r1, [r0] - ldr r0, =0x0000400e - movs r1, 0 - bl VarSet - bl LoadPlayerParty -_081A9EB8: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A9E90 - - thumb_func_start sub_81A9EC8 -sub_81A9EC8: @ 81A9EC8 - push {lr} - bl InBattlePyramid - lsls r0, 24 - cmp r0, 0 - beq _081A9ED8 - bl DoSoftReset -_081A9ED8: - pop {r0} - bx r0 - thumb_func_end sub_81A9EC8 - - thumb_func_start sub_81A9EDC -sub_81A9EDC: @ 81A9EDC - push {lr} - lsls r0, 16 - lsrs r0, 16 - ldr r2, =gFacilityTrainers - movs r1, 0x34 - muls r1, r0 - ldr r0, [r2] - adds r0, r1 - adds r0, 0xC - bl FrontierSpeechToString - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A9EDC - - thumb_func_start sub_81A9EFC -sub_81A9EFC: @ 81A9EFC - push {lr} - lsls r0, 16 - lsrs r0, 16 - ldr r2, =gFacilityTrainers - movs r1, 0x34 - muls r1, r0 - ldr r0, [r2] - adds r0, r1 - adds r0, 0x18 - bl FrontierSpeechToString - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A9EFC - - thumb_func_start sub_81A9F1C -sub_81A9F1C: @ 81A9F1C - push {lr} - lsls r0, 16 - lsrs r0, 16 - ldr r2, =gFacilityTrainers - movs r1, 0x34 - muls r1, r0 - ldr r0, [r2] - adds r0, r1 - adds r0, 0x24 - bl FrontierSpeechToString - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A9F1C - - thumb_func_start GetTrainerEncounterMusicIdInBattlePyramind -GetTrainerEncounterMusicIdInBattlePyramind: @ 81A9F3C - push {r4,lr} - lsls r0, 16 - lsrs r0, 16 - movs r4, 0 - ldr r3, =gFacilityClassToTrainerClass - ldr r1, =gFacilityTrainers - ldr r2, [r1] - movs r1, 0x34 - muls r0, r1 - adds r0, r2 - ldrb r0, [r0] - adds r0, r3 - ldrb r2, [r0] - ldr r1, =gUnknown_08613B44 -_081A9F58: - ldrb r0, [r1] - cmp r0, r2 - bne _081A9F70 - ldrb r0, [r1, 0x1] - b _081A9F7A - .pool -_081A9F70: - adds r1, 0x4 - adds r4, 0x1 - cmp r4, 0x35 - bls _081A9F58 - movs r0, 0 -_081A9F7A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end GetTrainerEncounterMusicIdInBattlePyramind - - thumb_func_start sub_81A9F80 -sub_81A9F80: @ 81A9F80 - push {lr} - ldr r0, =BattleFrontier_BattlePyramidEmptySquare_EventScript_252C88 - bl ScriptContext1_SetupScript - pop {r0} - bx r0 - .pool - thumb_func_end sub_81A9F80 - - thumb_func_start sub_81A9F90 -sub_81A9F90: @ 81A9F90 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gSaveBlock2Ptr - ldr r4, [r0] - ldr r1, =0x00000ca9 - adds r0, r4, r1 - ldrb r1, [r0] - lsls r1, 30 - lsrs r1, 29 - ldr r2, =0x00000e1a - adds r0, r4, r2 - adds r0, r1 - ldrh r0, [r0] - movs r1, 0x7 - bl __udivsi3 - lsls r0, 16 - lsrs r0, 16 - ldr r1, =0x00000cb2 - adds r4, r1 - ldrh r1, [r4] - cmp r1, 0x7 - bne _081AA020 - adds r0, 0x1 - lsls r7, r0, 24 - lsls r1, 24 - mov r8, r1 -_081A9FCC: - lsrs r0, r7, 24 - mov r2, r8 - lsrs r1, r2, 24 - bl sub_8162548 - lsls r0, 16 - lsrs r3, r0, 16 - movs r2, 0 - cmp r2, r5 - bge _081AA004 - ldr r1, =gSaveBlock2Ptr - ldr r0, [r1] - ldr r4, =0x00000cb4 - adds r0, r4 - ldrh r0, [r0] - cmp r0, r3 - beq _081AA004 - adds r6, r1, 0 -_081A9FF0: - adds r2, 0x1 - cmp r2, r5 - bge _081AA004 - ldr r0, [r6] - lsls r1, r2, 1 - adds r0, r4 - adds r0, r1 - ldrh r0, [r0] - cmp r0, r3 - bne _081A9FF0 -_081AA004: - cmp r2, r5 - bne _081A9FCC - b _081AA062 - .pool -_081AA020: - lsls r1, 24 - mov r8, r1 - lsls r7, r0, 24 -_081AA026: - lsrs r0, r7, 24 - mov r2, r8 - lsrs r1, r2, 24 - bl sub_8162548 - lsls r0, 16 - lsrs r3, r0, 16 - movs r2, 0 - cmp r2, r5 - bge _081AA05E - ldr r1, =gSaveBlock2Ptr - ldr r0, [r1] - ldr r4, =0x00000cb4 - adds r0, r4 - ldrh r0, [r0] - cmp r0, r3 - beq _081AA05E - adds r6, r1, 0 -_081AA04A: - adds r2, 0x1 - cmp r2, r5 - bge _081AA05E - ldr r0, [r6] - lsls r1, r2, 1 - adds r0, r4 - adds r0, r1 - ldrh r0, [r0] - cmp r0, r3 - bne _081AA04A -_081AA05E: - cmp r2, r5 - bne _081AA026 -_081AA062: - adds r0, r3, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81A9F90 - - thumb_func_start sub_81AA078 -sub_81AA078: @ 81AA078 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - str r0, [sp, 0x4] - lsls r1, 24 - lsrs r1, 24 - str r1, [sp, 0x8] - movs r0, 0x10 - bl AllocZeroed - str r0, [sp, 0xC] - bl sub_81AA96C - mov r4, sp - adds r4, 0x1 - mov r0, sp - adds r1, r4, 0 - bl sub_81AA33C - movs r7, 0 -_081AA0A6: - ldr r1, [sp, 0xC] - adds r0, r1, r7 - ldrb r0, [r0] - ldr r2, =0x00000169 - adds r0, r2 - lsls r0, 2 - ldr r1, =gMapLayouts - adds r0, r1 - ldr r6, [r0] - ldr r2, [r6, 0xC] - mov r10, r2 - ldr r0, [sp, 0x4] - ldr r1, =gUnknown_03005DC0 - str r0, [r1, 0x8] - ldr r0, [r6] - lsls r0, 2 - adds r2, r0, 0 - adds r2, 0xF - str r2, [r1] - ldr r0, [r6, 0x4] - lsls r0, 2 - adds r0, 0xE - str r0, [r1, 0x4] - ldr r0, [sp, 0x4] - mov r9, r0 - adds r1, r7, 0 - cmp r7, 0 - bge _081AA0E0 - adds r1, r7, 0x3 -_081AA0E0: - asrs r1, 2 - ldr r4, [r6, 0x4] - adds r0, r1, 0 - muls r0, r4 - adds r0, 0x7 - muls r2, r0 - lsls r1, 2 - subs r1, r7, r1 - ldr r3, [r6] - adds r0, r1, 0 - muls r0, r3 - adds r0, 0x7 - adds r2, r0 - lsls r2, 1 - add r9, r2 - movs r1, 0 - mov r8, r1 - adds r2, r7, 0x1 - str r2, [sp, 0x10] - cmp r8, r4 - bge _081AA1B6 -_081AA10A: - movs r0, 0 - mov r12, r0 - mov r1, r8 - adds r1, 0x1 - str r1, [sp, 0x14] - cmp r12, r3 - bge _081AA1A2 - ldr r2, =gSaveBlock1Ptr - str r2, [sp, 0x18] - mov r4, r9 - mov r5, r10 -_081AA120: - ldrh r1, [r5] - ldr r0, =0x000003ff - ands r0, r1 - ldr r2, =0x0000028e - cmp r0, r2 - bne _081AA194 - mov r0, sp - ldrb r0, [r0, 0x1] - cmp r7, r0 - beq _081AA194 - mov r0, sp - ldrb r0, [r0] - cmp r7, r0 - bne _081AA164 - ldr r1, [sp, 0x8] - cmp r1, 0 - bne _081AA164 - ldr r2, [sp, 0x18] - ldr r3, [r2] - adds r2, r7, 0 - cmp r7, 0 - bge _081AA14E - adds r2, r7, 0x3 -_081AA14E: - asrs r2, 2 - lsls r1, r2, 2 - subs r1, r7, r1 - ldr r0, [r6] - muls r0, r1 - add r0, r12 - strh r0, [r3] - ldr r0, [r6, 0x4] - muls r0, r2 - add r0, r8 - strh r0, [r3, 0x2] -_081AA164: - ldrh r0, [r5] - movs r1, 0xFC - lsls r1, 8 - ands r1, r0 - ldr r2, =0x0000028d - adds r0, r2, 0 - orrs r1, r0 - strh r1, [r4] - ldr r3, [r6] - b _081AA196 - .pool -_081AA194: - strh r1, [r4] -_081AA196: - adds r4, 0x2 - adds r5, 0x2 - movs r0, 0x1 - add r12, r0 - cmp r12, r3 - blt _081AA120 -_081AA1A2: - lsls r0, r3, 3 - adds r0, 0x1E - add r9, r0 - lsls r0, r3, 1 - add r10, r0 - ldr r1, [sp, 0x14] - mov r8, r1 - ldr r0, [r6, 0x4] - cmp r8, r0 - blt _081AA10A -_081AA1B6: - ldr r7, [sp, 0x10] - cmp r7, 0xF - bgt _081AA1BE - b _081AA0A6 -_081AA1BE: - bl mapheader_run_script_with_tag_x1 - ldr r0, [sp, 0xC] - bl Free - add sp, 0x1C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_81AA078 - thumb_func_start sub_81AA1D8 sub_81AA1D8: @ 81AA1D8 push {r4-r7,lr} diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c index 248e58a9d..1ef59a438 100644 --- a/src/battle_pyramid.c +++ b/src/battle_pyramid.c @@ -14,12 +14,22 @@ #include "sound.h" #include "task.h" #include "start_menu.h" +#include "trainer_see.h" +#include "main.h" +#include "load_save.h" +#include "script.h" +#include "malloc.h" #include "constants/battle_frontier.h" #include "constants/event_objects.h" +#include "constants/event_object_movement_constants.h" +#include "constants/moves.h" +extern u8 gUnknown_0203CEF8[3]; extern void door_upload_tiles(void); -#define PICKUP_ITEMS_SET_COUNT 20 +extern const struct MapLayout *const gMapLayouts[]; + +#define TOTAL_ROUNDS 20 struct Struct_08613650 { @@ -42,18 +52,25 @@ u8 sub_81AA9E4(void); u16 sub_81A9AA8(u8); u8 sub_81A9998(s32 *, u8, u8); u8 sub_81AAA40(void); -bool8 InBattlePyramid(void); +u8 InBattlePyramid(void); void sub_81A97DC(u8 taskId); +void sub_81A9B44(u16 trainerId); +void sub_81AA96C(u8 *); +void sub_81AA33C(u8 *, u8 *); // Const rom data. extern void (* const gUnknown_08613EE0[])(void); extern const struct Struct_08613650 gUnknown_08613650[]; -extern const u16 sPickupItemsLvl50[PICKUP_ITEMS_SET_COUNT][10]; -extern const u16 sPickupItemsLvlOpen[PICKUP_ITEMS_SET_COUNT][10]; +extern const u16 sPickupItemsLvl50[TOTAL_ROUNDS][10]; +extern const u16 sPickupItemsLvlOpen[TOTAL_ROUNDS][10]; extern const u8 gUnknown_08613ABC[63][2]; extern const u8 gUnknown_08613B3A[]; extern const u16 gUnknown_08613F34[9]; extern const u16 gUnknown_08613F28[6]; +extern const u16 gUnknown_08D856C8[][16]; +extern const u8 gUnknown_08613C1C[50][2]; +extern const u8 gUnknown_08613ED8[]; +extern const u8 *const *const *const gUnknown_08613EC0[]; // code void sub_81A8E7C(void) @@ -203,10 +220,10 @@ void sub_81A9290(void) u8 id; u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; u32 floor = gSaveBlock2Ptr->frontier.curChallengeBattleNum; - u32 setId = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / 7) % PICKUP_ITEMS_SET_COUNT; + u32 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / 7) % TOTAL_ROUNDS; - if (setId >= PICKUP_ITEMS_SET_COUNT) - setId = PICKUP_ITEMS_SET_COUNT - 1; + if (round >= TOTAL_ROUNDS) + round = TOTAL_ROUNDS - 1; id = sub_81AA9E4(); r7 = (gSpecialVar_LastTalked - gUnknown_08613650[id].unk1) - 1; @@ -223,9 +240,9 @@ void sub_81A9290(void) } if (lvlMode != FRONTIER_LVL_50) - gSpecialVar_0x8000 = sPickupItemsLvlOpen[setId][gUnknown_08613ABC[i][1]]; + gSpecialVar_0x8000 = sPickupItemsLvlOpen[round][gUnknown_08613ABC[i][1]]; else - gSpecialVar_0x8000 = sPickupItemsLvl50[setId][gUnknown_08613ABC[i][1]]; + gSpecialVar_0x8000 = sPickupItemsLvl50[round][gUnknown_08613ABC[i][1]]; gSpecialVar_0x8001 = 1; } @@ -254,10 +271,6 @@ void sub_81A9414(void) gFacilityTrainers = gBattleFrontierTrainers; } -extern const u8 gUnknown_08613C1C[50][2]; -extern const u8 gUnknown_08613ED8[]; -extern const u8 *const *const *const gUnknown_08613EC0[]; - void sub_81A9424(void) { s32 i; @@ -408,8 +421,6 @@ void sub_81A97C8(void) CreateTask(sub_81A97DC, 0); } -extern const u16 gUnknown_08D856C8[][16]; - void sub_81A97DC(u8 taskId) { if (gPaletteFade.active) @@ -423,3 +434,387 @@ void sub_81A9828(void) { sub_809FDD4(); } + +void sub_81A9834(void) +{ + s32 i, j, k, l; + + for (i = 0; i < 3; i++) + { + s32 id = gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1; + for (j = 0; j < 3; j++) + { + if (GetMonData(&gSaveBlock1Ptr->playerParty[id], MON_DATA_SPECIES, NULL) == GetMonData(&gPlayerParty[j], MON_DATA_SPECIES, NULL)) + { + for (k = 0; k < 4; k++) + { + for (l = 0; l < 4; l++) + { + if (GetMonData(&gSaveBlock1Ptr->playerParty[id], MON_DATA_MOVE1 + l, NULL) == GetMonData(&gPlayerParty[j], MON_DATA_MOVE1 + k, NULL)) + break; + } + if (l == 4) + SetMonMoveSlot(&gPlayerParty[j], MOVE_SKETCH, k); + } + gSaveBlock1Ptr->playerParty[id] = gPlayerParty[j]; + gUnknown_0203CEF8[j] = id + 1; + break; + } + } + } + + for (i = 0; i < 3; i++) + gSaveBlock2Ptr->frontier.selectedPartyMons[i] = gUnknown_0203CEF8[i]; +} + +u8 sub_81A9998(s32 *arg0, u8 arg1, u8 arg2) +{ + s32 i, j; + u8 ret = 0; + u16 *map = gUnknown_03005DC0.map; + map += gUnknown_03005DC0.width * 7 + 7; + + for (i = 0; i < 32; map += 47, i++) + { + for (j = 0; j < 32; j++) + { + if ((map[j] & 0x3FF) == 0x28E) + { + j += 7 - gEventObjects[gSelectedEventObject].initialCoords.x; + i += 7 - gEventObjects[gSelectedEventObject].initialCoords.y; + if (j >= arg1 || j <= -arg1 || i >= arg1 || i <= -arg1 || arg2 == 0) + { + if (j > 0 && i > 0) + { + if (j >= i) + ret = 2; + else + ret = 3; + } + else if (j < 0 && i < 0) + { + if (j > i) + ret = 0; + else + ret = 1; + } + else if (j == 0) + { + if (i > 0) + ret = 3; + else + ret = 0; + } + else if (i == 0) + { + if (j > 0) + ret = 2; + else + ret = 1; + } + else if (j < 0) + { + if (j + i > 0) + ret = 3; + else + ret = 1; + } + else + { + ret = (~(j + i) >= 0) ? 0 : 2; + } + *arg0 = 0; + } + else + { + *arg0 = arg2; + } + return ret; + } + } + } + + return ret; +} + +u16 sub_81A9AA8(u8 arg0) +{ + return gSaveBlock2Ptr->frontier.field_CB4[arg0 - 1]; +} + +bool8 GetBattlePyramidTrainerFlag(u8 eventId) +{ + return gSaveBlock2Ptr->frontier.field_E2A & gBitTable[gEventObjects[eventId].localId - 1]; +} + +void sub_81A9B04(void) +{ + sub_81A9B44(gTrainerBattleOpponent_A); + if (gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS) + { + gSelectedEventObject = GetChosenApproachingTrainerEventObjectId(1); + sub_81A9B44(gTrainerBattleOpponent_B); + } +} + +struct PyramidWildMon +{ + u16 species; + u8 lvl; + u8 abilityBit; + u16 moves[4]; +}; + +extern const struct PyramidWildMon *const gBattlePyramidOpenLevelWildMonPointers[]; +extern const struct PyramidWildMon *const gBattlePyramidLevel50WildMonPointers[]; + +void sub_81A9B44(u16 trainerId) +{ + s32 i; + + for (i = 0; i < 8; i++) + { + if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId) + gSaveBlock2Ptr->frontier.field_E2A |= gBitTable[i]; + } + + gEventObjects[gSelectedEventObject].movementType = MOVEMENT_TYPE_WANDER_AROUND; + gSaveBlock1Ptr->eventObjectTemplates[gSpecialVar_LastTalked - 1].movementType = MOVEMENT_TYPE_WANDER_AROUND; + gEventObjects[gSelectedEventObject].initialCoords.x = gEventObjects[gSelectedEventObject].currentCoords.x; + gEventObjects[gSelectedEventObject].initialCoords.y = gEventObjects[gSelectedEventObject].currentCoords.y; +} + +void GenerateBattlePyramidWildMon(void) +{ + u8 name[POKEMON_NAME_LENGTH + 1]; + s32 i; + const struct PyramidWildMon *wildMons; + u32 id; + u32 lvl = gSaveBlock2Ptr->frontier.lvlMode; + u16 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvl] / 7) % TOTAL_ROUNDS; + + if (round >= TOTAL_ROUNDS) + round = TOTAL_ROUNDS - 1; + + if (lvl != FRONTIER_LVL_50) + wildMons = gBattlePyramidOpenLevelWildMonPointers[round]; + else + wildMons = gBattlePyramidLevel50WildMonPointers[round]; + + id = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, NULL) - 1; + SetMonData(&gEnemyParty[0], MON_DATA_SPECIES, &wildMons[id].species); + GetSpeciesName(name, wildMons[id].species); + SetMonData(&gEnemyParty[0], MON_DATA_NICKNAME, &name); + if (lvl != FRONTIER_LVL_50) + { + lvl = SetFacilityPtrsGetLevel(); + lvl -= wildMons[id].lvl; + lvl = lvl - 5 + (Random() % 11); + } + else + { + lvl = wildMons[id].lvl - 5 + ((Random() % 11)); + } + SetMonData(&gEnemyParty[0], + MON_DATA_EXP, + &gExperienceTables[gBaseStats[wildMons[id].species].growthRate][lvl]); + + switch (wildMons[id].abilityBit) + { + case 0: + case 1: + SetMonData(&gEnemyParty[0], MON_DATA_ALT_ABILITY, &wildMons[id].abilityBit); + break; + case 2: + default: + if (gBaseStats[wildMons[id].species].ability2) + { + i = GetMonData(&gEnemyParty[0], MON_DATA_PERSONALITY, NULL) % 2; + SetMonData(&gEnemyParty[0], MON_DATA_ALT_ABILITY, &i); + } + else + { + i = 0; + SetMonData(&gEnemyParty[0], MON_DATA_ALT_ABILITY, &i); + } + break; + } + + for (i = 0; i < 4; i++) + SetMonMoveSlot(&gEnemyParty[0], wildMons[id].moves[i], i); + + if (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvl] >= 140) // BUG: Reading outside the array as lvl was used for mon level instead of frontier lvl mode. + { + id = (Random() % 17) + 15; + for (i = 0; i < NUM_STATS; i++) + SetMonData(&gEnemyParty[0], MON_DATA_HP_IV + i, &id); + } + CalculateMonStats(&gEnemyParty[0]); +} + +u8 sub_81A9E28(void) +{ + u8 id = sub_81AA9E4(); + return gUnknown_08613650[id].unk4; +} + +u8 InBattlePyramid(void) +{ + if (gMapHeader.mapLayoutId == 361) + return 1; + else if (gMapHeader.mapLayoutId == 378) + return 2; + else + return FALSE; +} + +bool8 InBattlePyramid_(void) +{ + return (gMapHeader.mapLayoutId == 361 || gMapHeader.mapLayoutId == 378); +} + +void sub_81A9E90(void) +{ + if (InBattlePyramid()) + { + sub_81A9834(); + gSaveBlock2Ptr->frontier.field_CA8 = 2; + VarSet(VAR_TEMP_E, 0); + LoadPlayerParty(); + } +} + +void sub_81A9EC8(void) +{ + if (InBattlePyramid()) + DoSoftReset(); +} + +void sub_81A9EDC(u16 trainerId) +{ + FrontierSpeechToString(gFacilityTrainers[trainerId].speechBefore); +} + +void sub_81A9EFC(u16 trainerId) +{ + FrontierSpeechToString(gFacilityTrainers[trainerId].speechWin); +} + +void sub_81A9F1C(u16 trainerId) +{ + FrontierSpeechToString(gFacilityTrainers[trainerId].speechLose); +} + +struct ClassMusic +{ + u8 class; + u8 music; +}; + +extern const struct ClassMusic gUnknown_08613B44[54]; +extern const u8 BattleFrontier_BattlePyramidEmptySquare_EventScript_252C88[]; + +u8 GetTrainerEncounterMusicIdInBattlePyramind(u16 trainerId) +{ + s32 i; + + for (i = 0; i < ARRAY_COUNT(gUnknown_08613B44); i++) + { + if (gUnknown_08613B44[i].class == gFacilityClassToTrainerClass[gFacilityTrainers[trainerId].facilityClass]) + return gUnknown_08613B44[i].music; + } + return 0; +} + +void sub_81A9F80(void) +{ + ScriptContext1_SetupScript(BattleFrontier_BattlePyramidEmptySquare_EventScript_252C88); +} + +u16 sub_81A9F90(u8 count) +{ + s32 i; + u16 trainerId; + u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode; + u32 challengeNum = gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / 7; + u32 battleNum = gSaveBlock2Ptr->frontier.curChallengeBattleNum; + if (battleNum == 7) + { + do + { + trainerId = sub_8162548(challengeNum + 1, battleNum); + for (i = 0 ; i < count; i++) + { + if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId) + break; + } + } while (i != count); + } + else + { + do + { + trainerId = sub_8162548(challengeNum, battleNum); + for (i = 0 ; i < count; i++) + { + if (gSaveBlock2Ptr->frontier.field_CB4[i] == trainerId) + break; + } + } while (i != count); + } + + return trainerId; +} + +void sub_81AA078(u16 *mapArg, u8 arg1) +{ + s32 j, k; + s32 i; + u8 var0, var1; + u8 *allocated = AllocZeroed(0x10); + + sub_81AA96C(allocated); + sub_81AA33C(&var0, &var1); + for (i = 0; i < 16; i++) + { + u16 *map; + s32 heightAdd, widthAdd; + const struct MapLayout *mapLayout = gMapLayouts[allocated[i] + 0x169]; + const u16 *layoutMap = mapLayout->map; + + gUnknown_03005DC0.map = mapArg; + gUnknown_03005DC0.width = mapLayout->width * 4 + 15; + gUnknown_03005DC0.height = mapLayout->height * 4 + 14; + map = mapArg; + heightAdd = (((i / 4 * mapLayout->height) + 7) * (gUnknown_03005DC0.width)); + widthAdd = ((i % 4 * mapLayout->width) + 7); + map += heightAdd + widthAdd; + for (j = 0; j < mapLayout->height; j++) + { + for (k = 0; k < mapLayout->width; k++) + { + if ((layoutMap[k] & 0x3FF) != 0x28E) + { + map[k] = layoutMap[k]; + } + else if (i != var1) + { + if (i == var0 && arg1 == 0) + { + gSaveBlock1Ptr->pos.x = (mapLayout->width * (i % 4)) + k; + gSaveBlock1Ptr->pos.y = (mapLayout->height * (i / 4)) + j; + } + map[k] = (layoutMap[k] & 0xFC00) | 0x28D; + } + else + { + map[k] = layoutMap[k]; + } + } + map += 15 + (mapLayout->width * 4); + layoutMap += mapLayout->width; + } + } + mapheader_run_script_with_tag_x1(); + free(allocated); +} diff --git a/src/overworld.c b/src/overworld.c index 69ac9c822..4e1f8cc4f 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -113,7 +113,7 @@ extern void ShowMapNamePopup(void); extern bool32 InTrainerHill(void); extern bool32 sub_808651C(void); extern bool8 sub_80AF6A4(void); -extern bool8 sub_81A9E6C(void); +extern bool8 InBattlePyramid_(void); extern bool8 sub_80E909C(void); extern void sub_81AA1D8(void); extern void c2_change_map(void); @@ -1808,7 +1808,7 @@ static void InitCurrentFlashLevelScanlineEffect(void) { u8 flashLevel; - if (sub_81A9E6C()) + if (InBattlePyramid_()) { door_upload_tiles(); ScanlineEffect_SetParams(sFlashEffectParams); diff --git a/src/start_menu.c b/src/start_menu.c index 173d0a79f..976cbe2a6 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -460,18 +460,18 @@ static bool32 InitStartMenuStep(void) sUnknown_02037619[0]++; break; case 3: - if (GetSafariZoneFlag() != FALSE) + if (GetSafariZoneFlag()) { ShowSafariBallsWindow(); } - if (InBattlePyramid() != FALSE) + if (InBattlePyramid()) { ShowPyramidFloorWindow(); } sUnknown_02037619[0]++; break; case 4: - if (PrintStartMenuActions(&sUnknown_02037619[1], 2) == FALSE) + if (!PrintStartMenuActions(&sUnknown_02037619[1], 2)) { break; }