Start decompiling oak speech overlay

This commit is contained in:
PikalaxALT 2024-08-31 15:52:01 -04:00
parent 50e05bee76
commit d391e3f829
No known key found for this signature in database
GPG Key ID: 7774E96AA69E5B61
27 changed files with 233 additions and 357 deletions

View File

@ -104,7 +104,7 @@
.public _s32_div_f
.public _u32_div_f
.public gGameLanguage
.public _02102610
.public sOverlayTemplate_NamingScreen
.public gSystem
.public ov07_02232F58
.public ov07_02232F60

View File

@ -292,7 +292,7 @@
.public _fsub
.public _s32_div_f
.public _u32_div_f
.public _02102610
.public sOverlayTemplate_NamingScreen
.public gOverlayTemplate_PokemonSummary
.public gSystem
.public PCBox_Init

View File

@ -192,7 +192,7 @@
.public _ull_mod
.public _s32_div_f
.public _u32_div_f
.public _02102610
.public sOverlayTemplate_NamingScreen
.public _02102620
.public gSystem
.public ov42_02227060

View File

@ -137,7 +137,7 @@
.public MI_CpuFill8
.public memset
.public gGameVersion
.public _02102610
.public sOverlayTemplate_NamingScreen
.public gSystem
.public ov36_App_InitGameState_AfterOakSpeech
.public OakSpeech_Init

View File

@ -180,7 +180,7 @@
.public _s32_div_f
.public _u32_div_f
.public gOverlayTemplate_Battle
.public _02102610
.public sOverlayTemplate_NamingScreen
.public gSystem
.public ov00_021E6EBC
.public _0223DC20

View File

@ -144,6 +144,6 @@
.public _s32_div_f
.public gOverlayTemplate_Battle
.public gNatureStatMods
.public _02102610
.public sOverlayTemplate_NamingScreen
.public gSystem
.public OS_IRQTable

View File

@ -21,7 +21,7 @@
.public MonSetTrainerMemo
.public CallTask_HatchEggInParty
.public sub_02093134
.public _02102610
.public sOverlayTemplate_NamingScreen
.public ov95_021E6D70
.public ov95_021E6E88
.public ov95_021E6F0C

View File

@ -5,4 +5,4 @@
.public sub_020912AC
.public sub_020912D0
.public _u32_div_f
.public _02102610
.public sOverlayTemplate_NamingScreen

View File

@ -37,7 +37,7 @@
.public sub_02091598
.public sub_020915A0
.public sub_020915A4
.public _02102610
.public sOverlayTemplate_NamingScreen
.public gApplication_OakSpeech
.public OakSpeech_Init
.public OakSpeech_Main

View File

@ -1187,7 +1187,7 @@ _02246DB0:
mov r2, #0
bl GetMonData
str r0, [r5, #0x10]
ldr r0, _0224706C ; =_02102610
ldr r0, _0224706C ; =sOverlayTemplate_NamingScreen
add r1, r5, #0
mov r2, #5
bl OverlayManager_New
@ -1484,7 +1484,7 @@ _0224702E:
_02247060: .word 0x0000FFFF
_02247064: .word 0x0000219C
_02247068: .word 0x00000496
_0224706C: .word _02102610
_0224706C: .word sOverlayTemplate_NamingScreen
_02247070: .word 0x00000498
_02247074:
add r0, r5, #0

View File

@ -6717,7 +6717,7 @@ ov14_021E8B3C: ; 0x021E8B3C
ldr r0, [r4, #4]
ldr r2, [r2, #0x18]
bl PCStorage_GetBoxName
ldr r0, _021E8B7C ; =_02102610
ldr r0, _021E8B7C ; =sOverlayTemplate_NamingScreen
ldr r1, [r4, #0x18]
mov r2, #9
bl OverlayManager_New
@ -6726,7 +6726,7 @@ ov14_021E8B3C: ; 0x021E8B3C
add sp, #8
pop {r4, pc}
.balign 4, 0
_021E8B7C: .word _02102610
_021E8B7C: .word sOverlayTemplate_NamingScreen
thumb_func_end ov14_021E8B3C
thumb_func_start ov14_021E8B80

View File

@ -5792,7 +5792,7 @@ _0222CBE2:
str r0, [r4, #8]
add r0, r7, #0
bl ov43_0222A1DC
ldr r0, _0222CD2C ; =_02102610
ldr r0, _0222CD2C ; =sOverlayTemplate_NamingScreen
ldr r1, [r4, #4]
add r2, r6, #0
bl OverlayManager_New
@ -5865,7 +5865,7 @@ _0222CCAC:
str r0, [r4, #4]
add r0, r7, #0
bl ov43_0222A1DC
ldr r0, _0222CD2C ; =_02102610
ldr r0, _0222CD2C ; =sOverlayTemplate_NamingScreen
ldr r1, [r4, #4]
add r2, r6, #0
bl OverlayManager_New
@ -5918,7 +5918,7 @@ _0222CD26:
add sp, #0x18
pop {r3, r4, r5, r6, r7, pc}
.balign 4, 0
_0222CD2C: .word _02102610
_0222CD2C: .word sOverlayTemplate_NamingScreen
_0222CD30: .word _02102620
thumb_func_end ov43_0222CBB4

View File

@ -7,324 +7,6 @@
.text
thumb_func_start OakSpeech_Init
OakSpeech_Init: ; 0x021E5900
push {r3, r4, r5, lr}
sub sp, #8
mov r2, #1
add r5, r0, #0
mov r0, #3
mov r1, #0x50
lsl r2, r2, #0x12
bl CreateHeap
mov r1, #6
add r0, r5, #0
lsl r1, r1, #6
mov r2, #0x50
bl OverlayManager_CreateAndGetData
mov r2, #6
mov r1, #0
lsl r2, r2, #6
add r4, r0, #0
bl memset
mov r0, #0x50
str r0, [r4]
add r0, r5, #0
bl OverlayManager_GetArgs
ldr r0, [r0, #8]
str r0, [r4, #4]
bl Save_PlayerData_GetOptionsAddr
mov r1, #0
str r0, [r4, #8]
str r1, [r4, #0xc]
str r1, [r4, #0x10]
str r1, [r4, #0x14]
ldr r0, [r4, #8]
add r2, r1, #0
str r0, [sp]
mov r0, #0x50
mov r3, #7
str r1, [sp, #4]
bl NamingScreen_CreateArgs
mov r1, #0x12
lsl r1, r1, #4
str r0, [r4, r1]
ldr r0, [r4, #8]
mov r2, #0
str r0, [sp]
mov r0, #0x50
mov r1, #3
mov r3, #7
str r2, [sp, #4]
bl NamingScreen_CreateArgs
mov r2, #0x49
lsl r2, r2, #2
add r1, r2, #0
str r0, [r4, r2]
mov r0, #0
add r1, #0x58
str r0, [r4, r1]
add r2, #0x18
str r0, [r4, r2]
bl sub_02002B8C
ldr r1, [r4]
mov r0, #4
bl FontID_Alloc
mov r0, #1
add sp, #8
pop {r3, r4, r5, pc}
.balign 4, 0
thumb_func_end OakSpeech_Init
thumb_func_start OakSpeech_Main
OakSpeech_Main: ; 0x021E5994
push {r3, r4, r5, r6, lr}
sub sp, #0xc
add r5, r1, #0
bl OverlayManager_GetData
ldr r1, [r5]
add r4, r0, #0
mov r6, #0
cmp r1, #5
bls _021E59AA
b _021E5B22
_021E59AA:
add r1, r1, r1
add r1, pc
ldrh r1, [r1, #6]
lsl r1, r1, #0x10
asr r1, r1, #0x10
add pc, r1
_021E59B6: ; jump table
.short _021E59C2 - _021E59B6 - 2 ; case 0
.short _021E5A56 - _021E59B6 - 2 ; case 1
.short _021E5AA4 - _021E59B6 - 2 ; case 2
.short _021E5AD4 - _021E59B6 - 2 ; case 3
.short _021E5B06 - _021E59B6 - 2 ; case 4
.short _021E5B20 - _021E59B6 - 2 ; case 5
_021E59C2:
add r0, r6, #0
add r1, r6, #0
bl sub_0200FBF4
mov r0, #1
add r1, r6, #0
bl sub_0200FBF4
add r0, r6, #0
add r1, r0, #0
bl Main_SetVBlankIntrCB
add r0, r6, #0
add r1, r0, #0
bl Main_SetHBlankIntrCB
bl GfGfx_DisableEngineAPlanes
bl GfGfx_DisableEngineBPlanes
mov r2, #1
lsl r2, r2, #0x1a
ldr r1, [r2]
ldr r0, _021E5B3C ; =0xFFFFE0FF
and r1, r0
str r1, [r2]
ldr r2, _021E5B40 ; =0x04001000
ldr r1, [r2]
and r0, r1
str r0, [r2]
mov r0, #4
mov r1, #8
bl SetKeyRepeatTimers
add r0, r4, #0
bl ov53_021E5BDC
add r0, r4, #0
bl ov53_021E5E6C
ldr r0, [r4, #0x18]
mov r1, #4
bl BgClearTilemapBufferAndCommit
add r0, r4, #0
bl ov53_021E7F24
add r0, r4, #0
bl ov53_021E8014
mov r0, #0xe
str r0, [sp]
ldr r0, [r4]
add r1, r4, #0
str r0, [sp, #4]
add r1, #0xe8
ldr r0, [r4, #0x18]
ldr r1, [r1]
mov r2, #6
mov r3, #4
bl ov53_021E80F4
mov r1, #0x5e
lsl r1, r1, #2
str r0, [r4, r1]
ldr r0, _021E5B44 ; =ov53_021E5BCC
add r1, r4, #0
bl Main_SetVBlankIntrCB
bl GfGfx_BothDispOn
mov r0, #1
str r0, [r5]
b _021E5B22
_021E5A56:
bl ov53_021E7ECC
add r0, r4, #0
bl ov53_021E6F9C
cmp r0, #1
bne _021E5A80
mov r0, #6
str r0, [sp]
mov r0, #1
str r0, [sp, #4]
ldr r0, [r4]
str r0, [sp, #8]
add r0, r6, #0
add r1, r0, #0
add r2, r0, #0
add r3, r0, #0
bl BeginNormalPaletteFade
mov r0, #2
str r0, [r5]
_021E5A80:
ldr r0, [r4, #0x14]
cmp r0, #0
beq _021E5B22
mov r0, #6
str r0, [sp]
mov r0, #1
str r0, [sp, #4]
ldr r0, [r4]
str r0, [sp, #8]
mov r0, #0
add r1, r0, #0
add r2, r0, #0
add r3, r0, #0
bl BeginNormalPaletteFade
mov r0, #3
str r0, [r5]
b _021E5B22
_021E5AA4:
bl IsPaletteFadeFinished
cmp r0, #1
bne _021E5B22
mov r0, #0x5e
lsl r0, r0, #2
ldr r0, [r4, r0]
bl ov53_021E814C
add r0, r4, #0
bl ov53_021E7FEC
add r0, r4, #0
bl ov53_021E5EB8
add r0, r4, #0
bl ov53_021E5DE0
add r0, r6, #0
add r1, r0, #0
bl Main_SetVBlankIntrCB
mov r6, #1
b _021E5B22
_021E5AD4:
bl IsPaletteFadeFinished
cmp r0, #1
bne _021E5B22
mov r0, #0x5e
lsl r0, r0, #2
ldr r0, [r4, r0]
bl ov53_021E814C
add r0, r4, #0
bl ov53_021E7FEC
add r0, r4, #0
bl ov53_021E5EB8
add r0, r4, #0
bl ov53_021E5DE0
add r0, r6, #0
add r1, r0, #0
bl Main_SetVBlankIntrCB
mov r0, #4
str r0, [r5]
b _021E5B22
_021E5B06:
ldr r0, [r4, #0x14]
bl OverlayManager_Run
cmp r0, #1
bne _021E5B22
ldr r0, [r4, #0x14]
bl OverlayManager_Delete
add r0, r6, #0
str r0, [r4, #0x14]
mov r0, #5
str r0, [r5]
b _021E5B22
_021E5B20:
str r6, [r5]
_021E5B22:
ldr r0, [r4, #0x14]
cmp r0, #0
bne _021E5B34
add r4, #0xd4
ldr r0, [r4]
cmp r0, #0
beq _021E5B34
bl sub_0200D020
_021E5B34:
add r0, r6, #0
add sp, #0xc
pop {r3, r4, r5, r6, pc}
nop
_021E5B3C: .word 0xFFFFE0FF
_021E5B40: .word 0x04001000
_021E5B44: .word ov53_021E5BCC
thumb_func_end OakSpeech_Main
thumb_func_start OakSpeech_Exit
OakSpeech_Exit: ; 0x021E5B48
push {r4, r5, r6, lr}
add r6, r0, #0
bl OverlayManager_GetData
add r4, r0, #0
mov r0, #4
ldr r5, [r4]
bl FontID_Release
ldr r0, [r4, #4]
bl Save_PlayerData_GetProfileAddr
mov r1, #0x12
lsl r1, r1, #4
ldr r1, [r4, r1]
ldr r1, [r1, #0x18]
bl PlayerName_StringToFlat
ldr r0, [r4, #4]
bl Save_PlayerData_GetProfileAddr
mov r1, #0x12
lsl r1, r1, #4
ldr r1, [r4, r1]
ldr r1, [r1, #4]
bl PlayerProfile_SetTrainerGender
ldr r0, [r4, #4]
bl Save_Misc_Get
mov r1, #0x49
lsl r1, r1, #2
ldr r1, [r4, r1]
ldr r1, [r1, #0x18]
bl Save_Misc_RivalName_Set
mov r0, #0x12
lsl r0, r0, #4
ldr r0, [r4, r0]
bl sub_0208311C
mov r0, #0x49
lsl r0, r0, #2
ldr r0, [r4, r0]
bl sub_0208311C
add r0, r6, #0
bl OverlayManager_FreeData
add r0, r5, #0
bl DestroyHeap
ldr r0, _021E5BC4 ; =FS_OVERLAY_ID(OVY_36)
ldr r1, _021E5BC8 ; =ov36_App_InitGameState_AfterOakSpeech
bl RegisterMainOverlay
mov r0, #0
bl sub_02002B8C
mov r0, #1
pop {r4, r5, r6, pc}
nop
_021E5BC4: .word FS_OVERLAY_ID(OVY_36)
_021E5BC8: .word ov36_App_InitGameState_AfterOakSpeech
thumb_func_end OakSpeech_Exit
thumb_func_start ov53_021E5BCC
ov53_021E5BCC: ; 0x021E5BCC
push {r3, lr}
@ -622,7 +304,7 @@ ov53_021E5E6C: ; 0x021E5E6C
ldr r3, [r4]
mov r0, #1
mov r1, #0x1b
mov r2, #219
mov r2, #219 // NARC_msg_msg_0219_bin
bl NewMsgDataFromNarc
mov r1, #1
lsl r1, r1, #8
@ -4129,7 +3811,7 @@ _021E7A76:
ldr r0, [r4, r0]
sub r1, #0x14
str r2, [r0, #4]
ldr r0, _021E7C84 ; =_02102610
ldr r0, _021E7C84 ; =sOverlayTemplate_NamingScreen
ldr r1, [r4, r1]
ldr r2, [r4]
bl OverlayManager_New
@ -4362,7 +4044,7 @@ _021E7C6C:
b _021E7C90
.balign 4, 0
_021E7C80: .word 0x00000163
_021E7C84: .word _02102610
_021E7C84: .word sOverlayTemplate_NamingScreen
_021E7C88:
mov r1, #6
add r2, r5, #0

View File

@ -1829,7 +1829,7 @@ FrtCmd_052: ; 0x0222CB54
bl NamingScreen_CreateArgs
add r2, r0, #0
ldr r0, _0222CB8C ; =ov80_0222CB94
ldr r1, _0222CB90 ; =_02102610
ldr r1, _0222CB90 ; =sOverlayTemplate_NamingScreen
str r0, [sp]
ldr r0, [r4]
mov r3, #0
@ -1840,7 +1840,7 @@ FrtCmd_052: ; 0x0222CB54
pop {r4, pc}
.balign 4, 0
_0222CB8C: .word ov80_0222CB94
_0222CB90: .word _02102610
_0222CB90: .word sOverlayTemplate_NamingScreen
thumb_func_end FrtCmd_052
thumb_func_start ov80_0222CB94

View File

@ -5479,8 +5479,8 @@ _02102422:
; File boundary
.balign 4, 0
.public _02102610
_02102610:
.public sOverlayTemplate_NamingScreen
sOverlayTemplate_NamingScreen:
.word sub_02082908, sub_02082B20, sub_02082EE8, 0xFFFFFFFF
.data

View File

@ -8,7 +8,7 @@
.include "unk_020910D8.inc"
.include "global.inc"
.public _02102610
.public sOverlayTemplate_NamingScreen
.text
@ -136,7 +136,7 @@ _0209119A:
bl GetMonData
ldr r1, [r4, #8]
str r0, [r1, #8]
ldr r1, _0209123C ; =_02102610
ldr r1, _0209123C ; =sOverlayTemplate_NamingScreen
ldr r2, [r4, #8]
add r0, r5, #0
bl CallApplicationAsTask
@ -178,7 +178,7 @@ _02091232:
pop {r3, r4, r5, r6, r7, pc}
.balign 4, 0
_02091238: .word _02106048
_0209123C: .word _02102610
_0209123C: .word sOverlayTemplate_NamingScreen
thumb_func_end Task_HatchEggInParty
thumb_func_start CallTask_HatchEggInParty

View File

@ -7,7 +7,7 @@
.include "unk_020912AC.inc"
.include "global.inc"
.public _02102610
.public sOverlayTemplate_NamingScreen
.text

View File

@ -7,7 +7,7 @@
.include "unk_02091564.inc"
.include "global.inc"
.public _02102610
.public sOverlayTemplate_NamingScreen
.text

View File

@ -28,6 +28,8 @@ typedef enum HeapID {
HEAP_ID_EVOLUTION = 71,
HEAP_ID_CREDITS = 73,
HEAP_ID_INTRO_MOVIE = 74,
HEAP_ID_OV36 = 75,
HEAP_ID_OAKS_SPEECH = 80,
HEAP_ID_CERTIFICATES = 82,
HEAP_ID_89 = 89,
HEAP_ID_ALPH_PUZZLE = 97,

View File

@ -53,7 +53,10 @@ typedef enum NameScreenType {
NAME_SCREEN_POKEMON,
NAME_SCREEN_BOX,
NAME_SCREEN_RIVAL,
NAME_SCREEN_GROUP = 5,
NAME_SCREEN_UNK4,
NAME_SCREEN_GROUP,
NAME_SCREEN_UNK6,
NAME_SCREEN_UNK7,
} NameScreenType;
typedef enum PocketType {

15
include/oaks_speech.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef GUARD_POKEHEARTGOLD_OAKS_SPEECH_H
#define GUARD_POKEHEARTGOLD_OAKS_SPEECH_H
#include "bg_window.h"
#include "options.h"
#include "overlay_manager.h"
#include "save.h"
#include "unk_0200CF18.h"
#include "unk_02082908.h"
BOOL OakSpeech_Init(OVY_MANAGER *ovyMan, int *pState);
BOOL OakSpeech_Main(OVY_MANAGER *ovyMan, int *pState);
BOOL OakSpeech_Exit(OVY_MANAGER *ovyMan, int *pState);
#endif // GUARD_POKEHEARTGOLD_OAKS_SPEECH_H

8
include/overlay_36.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef GUARD_POKEHEARTGOLD_OVERLAY_36_H
#define GUARD_POKEHEARTGOLD_OVERLAY_36_H
#include "overlay_manager.h"
extern const OVY_MGR_TEMPLATE ov36_App_InitGameState_AfterOakSpeech;
#endif // GUARD_POKEHEARTGOLD_OVERLAY_36_H

View File

@ -5,11 +5,11 @@
#include "overlay_manager.h"
#include "pm_string.h"
extern const OVY_MGR_TEMPLATE _02102610;
extern const OVY_MGR_TEMPLATE sOverlayTemplate_NamingScreen;
typedef struct NamingScreenArgs {
int unk0;
u8 unk4[0x4];
int unk4;
int form;
u8 unkC[0x4];
int gender;

View File

@ -801,6 +801,7 @@ Overlay trainer_card_signature
Overlay OVY_53
{
After main
Object src/oaks_speech.o
Object asm/overlay_53.o
}
Overlay options_app

View File

@ -1036,7 +1036,7 @@ static BOOL Task_NamingScreen(TaskManager *taskman) {
data->state++;
break;
case 1:
CallApplicationAsTask(taskman, &_02102610, data->args);
CallApplicationAsTask(taskman, &sOverlayTemplate_NamingScreen, data->args);
data->state++;
break;
case 2:
@ -1075,15 +1075,15 @@ static void SetName(TaskManager *taskman) {
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskman);
NamingScreenData *data = TaskManager_GetEnvironment(taskman);
switch (data->args->unk0) {
case 0:
case NAME_SCREEN_PLAYER:
PlayerProfile *profile = Save_PlayerData_GetProfileAddr(fieldSystem->saveData);
Save_Profile_PlayerName_Set(profile, data->args->unk1C);
break;
case 3:
case NAME_SCREEN_RIVAL:
SAVE_MISC_DATA *miscData = Save_Misc_Get(fieldSystem->saveData);
Save_Misc_RivalName_Set(miscData, data->args->unk18);
break;
case 1:
case NAME_SCREEN_POKEMON:
Pokemon *mon;
if (data->partyIdx == 0xff) {
BugContest *contest = FieldSystem_BugContest_Get(fieldSystem);
@ -1093,12 +1093,12 @@ static void SetName(TaskManager *taskman) {
}
SetMonData(mon, MON_DATA_NICKNAME_FLAT_COMPARE, data->args->unk1C);
break;
case 5:
case NAME_SCREEN_GROUP:
SAV_FRIEND_GRP *friendGroup = Save_FriendGroup_Get(fieldSystem->saveData);
sub_0202C7F8(friendGroup, 0, 0, data->args->unk18);
break;
case 2:
case 4:
case NAME_SCREEN_BOX:
case NAME_SCREEN_UNK4:
default:
break;
}

163
src/oaks_speech.c Normal file
View File

@ -0,0 +1,163 @@
#include "oaks_speech.h"
#include "global.h"
#include "font.h"
#include "launch_application.h"
#include "main.h"
#include "overlay_36.h"
#include "overlay_manager.h"
#include "player_data.h"
#include "render_text.h"
#include "unk_0200FA24.h"
#include "unk_02082908.h"
FS_EXTERN_OVERLAY(OVY_36);
typedef struct OaksSpeechData_Sub178 {
} OaksSpeechData_Sub178;
typedef struct OaksSpeechData {
HeapID heapId; // 0x000
SaveData *saveData; // 0x004
Options *options; // 0x008
int unk_00C;
int unk_010;
OVY_MANAGER *unk_014;
BgConfig *bgConfig; // 0x018
u8 filler_01C[0xB8];
SpriteGfxHandler *unk_0D4;
int unk_0D8;
u8 filler_0DC[0xC];
int unk_0E8;
u8 filler_0EC[0x34];
NamingScreenArgs *namingScreenArgs_Player; // 0x120
NamingScreenArgs *namingScreenArgs_Rival; // 0x124
u8 filler_128[0x14];
int unk_13C;
u8 filler_140[0x38];
OaksSpeechData_Sub178 *unk_178;
int unk_17C;
} OaksSpeechData; // size: 0x180
void ov53_021E5BDC(OaksSpeechData *data);
void ov53_021E5DE0(OaksSpeechData *data);
void ov53_021E5EB8(OaksSpeechData *data);
void ov53_021E5E6C(OaksSpeechData *data);
void ov53_021E5BCC(void *cbArg);
BOOL ov53_021E6F9C(OaksSpeechData *data);
void ov53_021E7ECC(OaksSpeechData *data);
void ov53_021E7F24(OaksSpeechData *data);
void ov53_021E7FEC(OaksSpeechData *data);
void ov53_021E8014(OaksSpeechData *data);
void *ov53_021E80F4(BgConfig *bgConfig, int a1, int a2, int a3, int a4, HeapID heapId);
void ov53_021E814C(OaksSpeechData_Sub178 *a0);
BOOL OakSpeech_Init(OVY_MANAGER *ovyMan, int *pState) {
CreateHeap(HEAP_ID_3, HEAP_ID_OAKS_SPEECH, 0x40000);
OaksSpeechData *data = OverlayManager_CreateAndGetData(ovyMan, sizeof(OaksSpeechData), HEAP_ID_OAKS_SPEECH);
memset(data, 0, sizeof(OaksSpeechData));
data->heapId = HEAP_ID_OAKS_SPEECH;
UnkStruct_02111868_sub *mainOvyArgs = OverlayManager_GetArgs(ovyMan);
data->saveData = mainOvyArgs->saveData;
data->options = Save_PlayerData_GetOptionsAddr(data->saveData);
data->unk_00C = 0;
data->unk_010 = 0;
data->unk_014 = NULL;
data->namingScreenArgs_Player = NamingScreen_CreateArgs(HEAP_ID_OAKS_SPEECH, NAME_SCREEN_PLAYER, 0, PLAYER_NAME_LENGTH, data->options, NULL);
data->namingScreenArgs_Rival = NamingScreen_CreateArgs(HEAP_ID_OAKS_SPEECH, NAME_SCREEN_RIVAL, 0, PLAYER_NAME_LENGTH, data->options, NULL);
data->unk_17C = 0;
data->unk_13C = 0;
sub_02002B8C(FALSE);
FontID_Alloc(4, data->heapId);
return TRUE;
}
BOOL OakSpeech_Main(OVY_MANAGER *ovyMan, int *pState) {
OaksSpeechData *data = OverlayManager_GetData(ovyMan);
BOOL ret = FALSE;
switch (*pState) {
case 0:
sub_0200FBF4(PM_LCD_TOP, RGB_BLACK);
sub_0200FBF4(PM_LCD_BOTTOM, RGB_BLACK);
Main_SetVBlankIntrCB(NULL, NULL);
Main_SetHBlankIntrCB(NULL, NULL);
GfGfx_DisableEngineAPlanes();
GfGfx_DisableEngineBPlanes();
GX_SetVisiblePlane(0);
GXS_SetVisiblePlane(0);
SetKeyRepeatTimers(4, 8);
ov53_021E5BDC(data);
ov53_021E5E6C(data);
BgClearTilemapBufferAndCommit(data->bgConfig, GF_BG_LYR_SUB_0);
ov53_021E7F24(data);
ov53_021E8014(data);
data->unk_178 = ov53_021E80F4(data->bgConfig, data->unk_0E8, 6, 4, 14, data->heapId);
Main_SetVBlankIntrCB(ov53_021E5BCC, data);
GfGfx_BothDispOn();
*pState = 1;
break;
case 1:
ov53_021E7ECC(data);
if (ov53_021E6F9C(data) == TRUE) {
BeginNormalPaletteFade(0, 0, 0, RGB_BLACK, 6, 1, data->heapId);
*pState = 2;
}
if (data->unk_014) {
BeginNormalPaletteFade(0, 0, 0, RGB_BLACK, 6, 1, data->heapId);
*pState = 3;
}
break;
case 2:
if (IsPaletteFadeFinished() == TRUE) {
ov53_021E814C(data->unk_178);
ov53_021E7FEC(data);
ov53_021E5EB8(data);
ov53_021E5DE0(data);
Main_SetVBlankIntrCB(NULL, NULL);
ret = TRUE;
}
break;
case 3:
if (IsPaletteFadeFinished() == TRUE) {
ov53_021E814C(data->unk_178);
ov53_021E7FEC(data);
ov53_021E5EB8(data);
ov53_021E5DE0(data);
Main_SetVBlankIntrCB(NULL, NULL);
*pState = 4;
}
break;
case 4:
if (OverlayManager_Run(data->unk_014) == TRUE) {
OverlayManager_Delete(data->unk_014);
data->unk_014 = NULL;
*pState = 5;
}
break;
case 5:
*pState = 0;
break;
}
if (data->unk_014 == NULL && data->unk_0D4 != NULL) {
sub_0200D020(data->unk_0D4);
}
return ret;
}
BOOL OakSpeech_Exit(OVY_MANAGER *ovyMan, int *pState) {
OaksSpeechData *data = OverlayManager_GetData(ovyMan);
HeapID heapId = data->heapId;
FontID_Release(4);
PlayerName_StringToFlat(Save_PlayerData_GetProfileAddr(data->saveData), data->namingScreenArgs_Player->unk18);
PlayerProfile_SetTrainerGender(Save_PlayerData_GetProfileAddr(data->saveData), data->namingScreenArgs_Player->unk4);
Save_Misc_RivalName_Set(Save_Misc_Get(data->saveData), data->namingScreenArgs_Rival->unk18);
sub_0208311C(data->namingScreenArgs_Player);
sub_0208311C(data->namingScreenArgs_Rival);
OverlayManager_FreeData(ovyMan);
DestroyHeap(heapId);
RegisterMainOverlay(FS_OVERLAY_ID(OVY_36), &ov36_App_InitGameState_AfterOakSpeech);
sub_02002B8C(FALSE);
return TRUE;
}

View File

@ -1,3 +1,5 @@
#include "overlay_36.h"
#include "global.h"
#include "constants/easy_chat.h"
@ -32,7 +34,7 @@
#include "unk_0205B3DC.h"
#include "unk_02066EDC.h"
#define HEAPID_OV36 ((HeapID)75)
#define HEAPID_OV36 (HEAP_ID_OV36)
extern const OVY_MGR_TEMPLATE gApplication_OakSpeech;