summaryrefslogtreecommitdiff
path: root/src/hof_pc.c
blob: e772f04e842d966f757567a9794b0bb8e1d8afcc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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);
}