Merge pull request #182 from DizzyEggg/decompile_hof_pc

decompile hof pc
This commit is contained in:
Diegoisawesome 2018-01-21 15:10:26 -06:00 committed by GitHub
commit 2ba141eac4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 83 deletions

View File

@ -1,73 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start AccessHallOfFamePC
AccessHallOfFamePC: @ 8137C28
push {lr}
ldr r0, =CB2_DoHallOfFamePC
bl SetMainCallback2
bl ScriptContext2_Enable
pop {r0}
bx r0
.pool
thumb_func_end AccessHallOfFamePC
thumb_func_start ReturnFromHallOfFamePC
ReturnFromHallOfFamePC: @ 8137C3C
push {lr}
ldr r0, =c2_exit_to_overworld_2_switch
bl SetMainCallback2
ldr r1, =gFieldCallback
ldr r0, =ReshowPCMenuAfterHallOfFamePC
str r0, [r1]
pop {r0}
bx r0
.pool
thumb_func_end ReturnFromHallOfFamePC
thumb_func_start ReshowPCMenuAfterHallOfFamePC
ReshowPCMenuAfterHallOfFamePC: @ 8137C5C
push {lr}
sub sp, 0x4
bl ScriptContext2_Enable
bl Overworld_PlaySpecialMapMusic
bl sp109_CreatePCMenu
bl sub_80E2514
movs r0, 0x1
negs r0, r0
movs r1, 0
str r1, [sp]
movs r2, 0x10
movs r3, 0
bl BeginNormalPaletteFade
ldr r0, =Task_WaitForPaletteFade
movs r1, 0xA
bl CreateTask
add sp, 0x4
pop {r0}
bx r0
.pool
thumb_func_end ReshowPCMenuAfterHallOfFamePC
thumb_func_start Task_WaitForPaletteFade
Task_WaitForPaletteFade: @ 8137C94
push {lr}
lsls r0, 24
lsrs r2, r0, 24
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _08137CAC
adds r0, r2, 0
bl DestroyTask
_08137CAC:
pop {r0}
bx r0
.pool
thumb_func_end Task_WaitForPaletteFade

View File

@ -676,9 +676,9 @@ _080E2360:
.pool
thumb_func_end sub_80E2308
thumb_func_start sp109_CreatePCMenu
@ bool sp109_CreatePCMenu()
sp109_CreatePCMenu: @ 80E236C
thumb_func_start ScrSpecial_CreatePCMenu
@ bool ScrSpecial_CreatePCMenu()
ScrSpecial_CreatePCMenu: @ 80E236C
push {lr}
ldr r0, =sub_80E2058
bl FuncIsActiveTask
@ -698,7 +698,7 @@ _080E2394:
_080E2396:
pop {r1}
bx r1
thumb_func_end sp109_CreatePCMenu
thumb_func_end ScrSpecial_CreatePCMenu
thumb_func_start CreatePCMenu
CreatePCMenu: @ 80E239C
@ -858,8 +858,8 @@ _080E24C6:
.pool
thumb_func_end CreatePCMenu
thumb_func_start sub_80E2514
sub_80E2514: @ 80E2514
thumb_func_start ScriptMenu_DisplayPCStartupPrompt
ScriptMenu_DisplayPCStartupPrompt: @ 80E2514
push {lr}
sub sp, 0x10
movs r0, 0
@ -882,7 +882,7 @@ sub_80E2514: @ 80E2514
pop {r0}
bx r0
.pool
thumb_func_end sub_80E2514
thumb_func_end ScriptMenu_DisplayPCStartupPrompt
thumb_func_start sub_80E2548
sub_80E2548: @ 80E2548

View File

@ -1771,7 +1771,7 @@ EventScript_271D92:: @ 8271D92
EventScript_271DAC:: @ 8271DAC
message gUnknown_0827266F
waitmessage
special sp109_CreatePCMenu
special ScrSpecial_CreatePCMenu
waitstate
goto EventScript_271DBC
end

View File

@ -273,7 +273,7 @@ gSpecials:: @ 81DBA64
def_special ShowBerryBlenderRecordWindow
def_special ResetTrickHouseEndRoomFlag
def_special SetTrickHouseEndRoomFlag
def_special sp109_CreatePCMenu
def_special ScrSpecial_CreatePCMenu
def_special AccessHallOfFamePC
def_special Special_ShowDiploma
def_special CheckLeadMonCool

View File

@ -187,7 +187,7 @@ SECTIONS {
asm/post_battle_event_funcs.o(.text);
asm/time_events.o(.text);
asm/birch_pc.o(.text);
asm/hof_pc.o(.text);
src/hof_pc.o(.text);
asm/field_specials.o(.text);
asm/battle_records.o(.text);
asm/pokedex_area_screen.o(.text);

46
src/hof_pc.c Normal file
View File

@ -0,0 +1,46 @@
#include "global.h"
#include "hall_of_fame.h"
#include "main.h"
#include "palette.h"
#include "overworld.h"
#include "script.h"
#include "script_menu.h"
#include "task.h"
extern void (*gFieldCallback)(void);
extern void (*gUnknown_0300485C)(void);
extern void Overworld_PlaySpecialMapMusic(void);
extern bool16 ScrSpecial_CreatePCMenu(void);
extern void ScriptMenu_DisplayPCStartupPrompt(void);
static void ReshowPCMenuAfterHallOfFamePC(void);
static void Task_WaitForPaletteFade(u8);
void AccessHallOfFamePC(void)
{
SetMainCallback2(CB2_DoHallOfFamePC);
ScriptContext2_Enable();
}
void ReturnFromHallOfFamePC(void)
{
SetMainCallback2(c2_exit_to_overworld_2_switch);
gFieldCallback = ReshowPCMenuAfterHallOfFamePC;
}
static void ReshowPCMenuAfterHallOfFamePC(void)
{
ScriptContext2_Enable();
Overworld_PlaySpecialMapMusic();
ScrSpecial_CreatePCMenu();
ScriptMenu_DisplayPCStartupPrompt();
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, 0);
CreateTask(Task_WaitForPaletteFade, 10);
}
static void Task_WaitForPaletteFade(u8 taskId)
{
if (!gPaletteFade.active)
DestroyTask(taskId);
}