forked from abandoned-cocoon/firered
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpsystem.c
154 lines (138 loc) · 3.33 KB
/
helpsystem.c
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#include "helpsystem.h"
struct help_top_item {
char *label;
u32 number;
};
// CONTEXT NUMBERS
//
// see 08078FD6
// 0x1: on titlescreen
// see 0812EC0E
// 0x2: in tutorial
// see 0806F67C
// 0xC: saving the game
// see 0812B35C
// 0xE: at home in pallet town
// 0xF: in oaks lab
// 0x10: in pokecenter
// 0x11: in pokemart
// 0x12: in gym
// 0x13: elsewhere with maplight 0x8 or 0x9
// 0x14: places without maplight 0x8 or 0x9
// 0x15: cave or forest (see 0812B2C4)
// 0x16: walkrun.bitfield & 0x8
// see 0800FD9C
// 0x17: in normal wild battle
// 0x18: in trainer battle
// 0x19: in double trainer battle
// 0x1A: in safari battle
u16 help_system_context; // 0203B0EC
u16 help_system_context_backup; // 03005EA0
u8 help_system_enabled; // 03005ECC
// 0845B080
char *help_top_item_labels[6] = {
"What should I do in this situation?",
"How do I do this?",
"What does this term mean?",
"About this game",
"Type Matchup List",
"EXIT"
};
// CONTEXT 0xE (example)
// 0845B6BF
u8 help_0E_0[] = {
2, // What should I be doing?
3, // I can't get out of a room.
4, // I can't find the person I want.
0xFF
};
// 0845B6C3
u8 help_0E_3[] = {
1, // The HELP System
2, // The game
3, // Wireless Adapter
7, // What are Pokemon
0xFF
};
// 0845C4B0
u8 help_top_item_permutation[6] = {
3, 0, 1, 2, 4, 5
};
// 0845C4B6
u8 help_top_item_visibility[36][6] = {
{0, 0, 0, 0, 0, 1}, // 0x00
{0, 0, 0, 1, 0, 1}, // 0x01
{0, 0, 0, 1, 0, 1}, // 0x02
{0, 1, 0, 1, 0, 1}, // 0x03
{0, 1, 0, 0, 0, 1}, // 0x04
{0, 1, 1, 0, 0, 1}, // 0x05
{0, 1, 1, 0, 0, 1}, // 0x06
{0, 0, 1, 0, 0, 1}, // 0x07
{0, 0, 1, 0, 0, 1}, // 0x08
{0, 1, 1, 0, 0, 1}, // 0x09
{0, 1, 1, 0, 0, 1}, // 0x10
{0, 1, 0, 0, 0, 1}, // 0x11
{0, 1, 1, 0, 0, 1}, // 0x12
{0, 1, 1, 0, 0, 1}, // 0x13
{1, 0, 0, 1, 0, 1}, // 0x14
{1, 1, 1, 0, 0, 1}, // 0x15
{1, 1, 1, 1, 0, 1}, // 0x16
{1, 1, 1, 0, 0, 1}, // 0x17
{1, 1, 1, 0, 1, 1}, // 0x18
{1, 1, 1, 0, 0, 1}, // 0x19
{1, 1, 1, 0, 0, 1}, // 0x20
{1, 1, 1, 0, 0, 1}, // 0x21
{1, 1, 1, 0, 0, 1}, // 0x22
{1, 1, 1, 0, 1, 1}, // 0x23
{1, 1, 1, 0, 1, 1}, // 0x24
{1, 1, 1, 0, 1, 1}, // 0x25
{1, 1, 1, 0, 1, 1}, // 0x26
{0, 1, 0, 0, 0, 1}, // 0x27
{0, 1, 0, 0, 0, 1}, // 0x28
{0, 1, 0, 0, 0, 1}, // 0x29
{0, 1, 0, 0, 0, 1}, // 0x30
{0, 1, 0, 0, 0, 1}, // 0x31
{0, 1, 0, 0, 0, 1}, // 0x32
{0, 1, 0, 0, 0, 1}, // 0x33
{0, 1, 0, 0, 0, 1}, // 0x34
{0, 0, 0, 0, 0, 0}, // 0x35
};
// 0812B220
void help_context_by_var_8004__sp17D() {
help_system_context = var_8004;
}
// 0812B234
void help_system_context_backup__sp17E() {
help_system_context_backup = help_system_context;
}
// 0812B248
void help_system_context_restore__sp17F() {
help_system_context = help_system_context_backup;
}
// 0812B478
void help_system_disable__sp198() {
help_system_enabled = true;
}
// 0812B484
void help_system_enable_unless_flashback__sp199() {
if (prev_quest_mode >= 2 && prev_quest_mode < 4)
return;
help_system_enabled = true;
}
// 0812B520
void sub_812B520(u16 *arg, struct help_top_item *items) {
u32 count = 0;
u8 *vis = help_top_item_visibility[help_system_context];
for (int i=0; i<6; i++) {
u8 j = help_top_item_permutation[i];
if (vis[j] == 1) {
items[count].label = help_top_item_labels[j];
items[count].number = j;
count++;
}
}
items[count-1].number = -2; // EXIT
arg[2] = count;
arg[3] = count;
arg[4] = 0;
}