mirror of
https://github.com/pret/pokeplatinum.git
synced 2026-03-21 17:55:13 -05:00
Document Pokedex_Languages
unk_020986CC -> pokedex_language ov21_021D5600 -> pokedex_text
This commit is contained in:
parent
20d0c83f6a
commit
fe056e293c
|
|
@ -1,12 +0,0 @@
|
|||
#ifndef POKEPLATINUM_OV21_021D5600_H
|
||||
#define POKEPLATINUM_OV21_021D5600_H
|
||||
|
||||
#include "strbuf.h"
|
||||
|
||||
void ov21_021D5600(Strbuf *param0);
|
||||
int ov21_021D5608(int param0);
|
||||
Strbuf *ov21_021D561C(int param0, int param1, int param2);
|
||||
Strbuf *ov21_021D566C(int param0, int param1, int param2);
|
||||
Strbuf *ov21_021D56BC(int param0, int param1, int param2, int param3);
|
||||
|
||||
#endif // POKEPLATINUM_OV21_021D5600_H
|
||||
12
include/overlay021/pokedex_text.h
Normal file
12
include/overlay021/pokedex_text.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef POKEPLATINUM_POKEDEX_TEXT_H
|
||||
#define POKEPLATINUM_POKEDEX_TEXT_H
|
||||
|
||||
#include "strbuf.h"
|
||||
|
||||
void PokedexText_Free(Strbuf *strbuf);
|
||||
int PokedexText_ForeignLanguage(int languageIndex);
|
||||
Strbuf *PokedexText_NameNumber(int species, int language, int heapID);
|
||||
Strbuf *PokedexText_Category(int species, int language, int heapID);
|
||||
Strbuf *PokedexText_DexEntry(int species, int language, int entryOffset, int heapID);
|
||||
|
||||
#endif // POKEPLATINUM_POKEDEX_TEXT_H
|
||||
9
include/pokedex_language.h
Normal file
9
include/pokedex_language.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifndef POKEPLATINUM_POKEDEX_LANGUAGE_H
|
||||
#define POKEPLATINUM_POKEDEX_LANGUAGE_H
|
||||
|
||||
#define NUM_LANGUAGES 6
|
||||
|
||||
int PokedexLanguage_LanguageToIndex(int language);
|
||||
int PokedexLanguage_IndexToLanguage(int languageIndex);
|
||||
|
||||
#endif // POKEPLATINUM_POKEDEX_LANGUAGE_H
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
#ifndef POKEPLATINUM_UNK_020986CC_H
|
||||
#define POKEPLATINUM_UNK_020986CC_H
|
||||
|
||||
int sub_020986CC(int param0);
|
||||
int sub_020986E8(int param0);
|
||||
|
||||
#endif // POKEPLATINUM_UNK_020986CC_H
|
||||
|
|
@ -339,7 +339,7 @@ Static main
|
|||
Object main.nef.p/src_unk_02097B18.c.o
|
||||
Object main.nef.p/src_unk_02098218.c.o
|
||||
Object main.nef.p/src_unk_020985E4.c.o
|
||||
Object main.nef.p/src_unk_020986CC.c.o
|
||||
Object main.nef.p/src_pokedex_language.c.o
|
||||
Object main.nef.p/src_pokedex_heightweight.c.o
|
||||
Object main.nef.p/src_pokedex_data_index.c.o
|
||||
Object main.nef.p/src_unk_020F6824.c.o
|
||||
|
|
@ -792,7 +792,7 @@ Overlay overlay21
|
|||
Object main.nef.p/src_overlay021_ov21_021D4C0C.c.o
|
||||
Object main.nef.p/src_overlay021_ov21_021D4EE4.c.o
|
||||
Object main.nef.p/src_overlay021_pokedex_field_map.c.o
|
||||
Object main.nef.p/src_overlay021_ov21_021D5600.c.o
|
||||
Object main.nef.p/src_overlay021_pokedex_text.c.o
|
||||
Object main.nef.p/src_overlay021_pokedex_enc_data.c.o
|
||||
Object main.nef.p/src_overlay021_ov21_021D5AEC.c.o
|
||||
Object main.nef.p/src_overlay021_ov21_021D76B0.c.o
|
||||
|
|
|
|||
|
|
@ -323,7 +323,7 @@ pokeplatinum_c = files(
|
|||
'unk_02097B18.c',
|
||||
'unk_02098218.c',
|
||||
'unk_020985E4.c',
|
||||
'unk_020986CC.c',
|
||||
'pokedex_language.c',
|
||||
'pokedex_heightweight.c',
|
||||
'pokedex_data_index.c',
|
||||
'unk_020989DC.c',
|
||||
|
|
@ -603,7 +603,7 @@ pokeplatinum_c = files(
|
|||
'overlay021/ov21_021D4C0C.c',
|
||||
'overlay021/ov21_021D4EE4.c',
|
||||
'overlay021/pokedex_field_map.c',
|
||||
'overlay021/ov21_021D5600.c',
|
||||
'overlay021/pokedex_text.c',
|
||||
'overlay021/pokedex_enc_data.c',
|
||||
'overlay021/ov21_021D5AEC.c',
|
||||
'overlay021/ov21_021D76B0.c',
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
#include "overlay021/ov21_021D423C.h"
|
||||
#include "overlay021/ov21_021D4340.h"
|
||||
#include "overlay021/ov21_021D4C0C.h"
|
||||
#include "overlay021/ov21_021D5600.h"
|
||||
#include "overlay021/ov21_021D5AEC.h"
|
||||
#include "overlay021/ov21_021D76B0.h"
|
||||
#include "overlay021/ov21_021D85B0.h"
|
||||
|
|
@ -33,6 +32,7 @@
|
|||
#include "overlay021/ov21_021E737C.h"
|
||||
#include "overlay021/ov21_021E8484.h"
|
||||
#include "overlay021/pokedex_sort.h"
|
||||
#include "overlay021/pokedex_text.h"
|
||||
#include "overlay021/species_caught_status.h"
|
||||
#include "overlay021/struct_ov21_021D0D80.h"
|
||||
#include "overlay021/struct_ov21_021D13FC.h"
|
||||
|
|
@ -664,13 +664,13 @@ void ov21_021D1650(Window *param0, int param1, int param2, int param3)
|
|||
v0 = ov21_021D1CE0(100, param3);
|
||||
}
|
||||
|
||||
v1 = ov21_021D561C(param2, GAME_LANGUAGE, param3);
|
||||
v1 = PokedexText_NameNumber(param2, GAME_LANGUAGE, param3);
|
||||
|
||||
Text_AddPrinterWithParamsAndColor(param0, FONT_SUBSCREEN, v0, 22, 0, TEXT_SPEED_NO_TRANSFER, TEXT_COLOR(3, 2, 1), NULL);
|
||||
Text_AddPrinterWithParamsAndColor(param0, FONT_SUBSCREEN, v1, 49, 0, TEXT_SPEED_NO_TRANSFER, TEXT_COLOR(3, 2, 1), NULL);
|
||||
Strbuf_Free(v0);
|
||||
|
||||
ov21_021D5600(v1);
|
||||
PokedexText_Free(v1);
|
||||
}
|
||||
|
||||
Window *ov21_021D16D8(UnkStruct_ov21_021D13FC *param0, const UnkStruct_ov21_021D3320 *param1, int param2, int param3)
|
||||
|
|
|
|||
|
|
@ -1,168 +0,0 @@
|
|||
#include "overlay021/ov21_021D5600.h"
|
||||
|
||||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "constants/narc.h"
|
||||
#include "constants/species.h"
|
||||
|
||||
#include "error_handling.h"
|
||||
#include "inlines.h"
|
||||
#include "message.h"
|
||||
#include "message_util.h"
|
||||
#include "strbuf.h"
|
||||
#include "unk_020986CC.h"
|
||||
|
||||
static const u8 Unk_ov21_021E9CC4[6] = {
|
||||
0x1,
|
||||
0x2,
|
||||
0x3,
|
||||
0x4,
|
||||
0x5,
|
||||
0x0
|
||||
};
|
||||
|
||||
static inline int inline_ov21_021D5764(int param0);
|
||||
static inline BOOL inline_ov21_021D5764_1(int param0, int param1);
|
||||
static Strbuf *LoadMessage(int param0, int param1, int param2);
|
||||
static void ov21_021D5764(int param0, int param1, int *param2, int *param3, int *param4);
|
||||
|
||||
void ov21_021D5600(Strbuf *param0)
|
||||
{
|
||||
Strbuf_Free(param0);
|
||||
}
|
||||
|
||||
int ov21_021D5608(int param0)
|
||||
{
|
||||
return sub_020986E8(Unk_ov21_021E9CC4[param0 + 1]);
|
||||
}
|
||||
|
||||
Strbuf *ov21_021D561C(int param0, int param1, int param2)
|
||||
{
|
||||
int v0;
|
||||
int v1;
|
||||
int v2;
|
||||
int v3;
|
||||
|
||||
ov21_021D5764(param0, param1, &v0, &v1, &v2);
|
||||
|
||||
if (v2 == 6) {
|
||||
return MessageUtil_SpeciesName(param0, param2);
|
||||
} else {
|
||||
const int Unk_ov21_021E9CCC[] = {
|
||||
0x2CD,
|
||||
0x2C8,
|
||||
0x2C9,
|
||||
0x2CA,
|
||||
0x2CB,
|
||||
0x2CC
|
||||
};
|
||||
v3 = Unk_ov21_021E9CCC[v2];
|
||||
v2 = v0;
|
||||
}
|
||||
|
||||
return LoadMessage(v3, v2, param2);
|
||||
}
|
||||
|
||||
Strbuf *ov21_021D566C(int param0, int param1, int param2)
|
||||
{
|
||||
int v0;
|
||||
int v1;
|
||||
int v2;
|
||||
int v3;
|
||||
|
||||
ov21_021D5764(param0, param1, &v0, &v1, &v2);
|
||||
|
||||
if (v2 == 6) {
|
||||
v2 = param0;
|
||||
v3 = 711;
|
||||
} else {
|
||||
const int Unk_ov21_021E9CE4[] = {
|
||||
0x2D3,
|
||||
0x2CE,
|
||||
0x2CF,
|
||||
0x2D0,
|
||||
0x2D1,
|
||||
0x2D2
|
||||
};
|
||||
v3 = Unk_ov21_021E9CE4[v2];
|
||||
v2 = v0;
|
||||
}
|
||||
|
||||
return LoadMessage(v3, v2, param2);
|
||||
}
|
||||
|
||||
Strbuf *ov21_021D56BC(int param0, int param1, int param2, int param3)
|
||||
{
|
||||
int v0;
|
||||
int v1;
|
||||
int v2;
|
||||
int v3;
|
||||
|
||||
ov21_021D5764(param0, param1, &v0, &v1, &v2);
|
||||
|
||||
if (v2 == 6) {
|
||||
GF_ASSERT(param2 < 1);
|
||||
v2 = param0 * 1 + param2;
|
||||
v3 = 706;
|
||||
} else {
|
||||
const int Unk_ov21_021E9CFC[] = {
|
||||
0x2C1,
|
||||
0x2BC,
|
||||
0x2BD,
|
||||
0x2BE,
|
||||
0x2BF,
|
||||
0x2C0
|
||||
};
|
||||
GF_ASSERT(param2 < 1);
|
||||
v3 = Unk_ov21_021E9CFC[v2];
|
||||
v2 = v0 * 1 + param2;
|
||||
}
|
||||
|
||||
return LoadMessage(v3, v2, param3);
|
||||
}
|
||||
|
||||
static inline BOOL inline_ov21_021D5764_1(int param0, int param1)
|
||||
{
|
||||
if ((param0 > NATIONAL_DEX_COUNT) && (param1 != 6)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static Strbuf *LoadMessage(int bankID, int entryID, int heapID)
|
||||
{
|
||||
MessageLoader *messageLoader = MessageLoader_Init(1, NARC_INDEX_MSGDATA__PL_MSG, bankID, heapID);
|
||||
|
||||
if (messageLoader) {
|
||||
Strbuf *strbuf = Strbuf_Init(256, heapID);
|
||||
|
||||
if (strbuf) {
|
||||
MessageLoader_GetStrbuf(messageLoader, entryID, strbuf);
|
||||
}
|
||||
|
||||
MessageLoader_Free(messageLoader);
|
||||
return strbuf;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void ov21_021D5764(int param0, int param1, int *param2, int *param3, int *param4)
|
||||
{
|
||||
*param3 = sub_020986CC(param1);
|
||||
|
||||
GF_ASSERT(*param3 < 6);
|
||||
|
||||
*param2 = param0;
|
||||
*param4 = inline_ov21_021D5764(*param3);
|
||||
|
||||
GF_ASSERT(inline_ov21_021D5764_1(*param2, *param4));
|
||||
}
|
||||
|
||||
static inline int inline_ov21_021D5764(int param0)
|
||||
{
|
||||
GF_ASSERT(param0 < 6);
|
||||
return (param0 == 1) ? 6 : param0;
|
||||
}
|
||||
|
|
@ -9,9 +9,9 @@
|
|||
#include "overlay021/ov21_021D1F90.h"
|
||||
#include "overlay021/ov21_021D1FA4.h"
|
||||
#include "overlay021/ov21_021D4C0C.h"
|
||||
#include "overlay021/ov21_021D5600.h"
|
||||
#include "overlay021/ov21_021E29DC.h"
|
||||
#include "overlay021/pokedex_sort.h"
|
||||
#include "overlay021/pokedex_text.h"
|
||||
#include "overlay021/struct_ov21_021D0F60_decl.h"
|
||||
#include "overlay021/struct_ov21_021D13FC.h"
|
||||
#include "overlay021/struct_ov21_021D2648.h"
|
||||
|
|
@ -469,12 +469,12 @@ static void ov21_021DEC80(Window *param0, int param1, int param2, u32 param3)
|
|||
|
||||
static void ov21_021DECD4(Window *param0, int param1, int param2, int param3, u32 param4)
|
||||
{
|
||||
Strbuf *v0 = ov21_021D56BC(param2, GAME_LANGUAGE, param3, param1);
|
||||
Strbuf *v0 = PokedexText_DexEntry(param2, GAME_LANGUAGE, param3, param1);
|
||||
u32 v1 = Font_CalcMaxLineWidth(FONT_SYSTEM, v0, 0);
|
||||
u32 v2 = (v1 < 240) ? 128 - v1 / 2 : 8;
|
||||
|
||||
Text_AddPrinterWithParamsAndColor(param0, FONT_SYSTEM, v0, v2, 136, TEXT_SPEED_INSTANT, param4, NULL);
|
||||
ov21_021D5600(v0);
|
||||
PokedexText_Free(v0);
|
||||
}
|
||||
|
||||
static void ov21_021DED24(UnkStruct_ov21_021DF374 *param0, UnkStruct_ov21_021DE760 *param1, const UnkStruct_ov21_021DE6D4 *param2, int param3)
|
||||
|
|
@ -785,7 +785,7 @@ Window *ov21_021DF30C(UnkStruct_ov21_021D4C0C *param0, int param1, int param2)
|
|||
Strbuf *v1;
|
||||
|
||||
v0 = ov21_021D4D6C(param0, 18, 2);
|
||||
v1 = ov21_021D566C(param1, GAME_LANGUAGE, param2);
|
||||
v1 = PokedexText_Category(param1, GAME_LANGUAGE, param2);
|
||||
|
||||
{
|
||||
u32 v2 = Font_CalcStrbufWidth(FONT_SUBSCREEN, v1, 0);
|
||||
|
|
@ -794,7 +794,7 @@ Window *ov21_021DF30C(UnkStruct_ov21_021D4C0C *param0, int param1, int param2)
|
|||
ov21_021D4E80(param0, v0, v1, v3, 0);
|
||||
}
|
||||
|
||||
ov21_021D5600(v1);
|
||||
PokedexText_Free(v1);
|
||||
|
||||
return v0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
#include "overlay021/ov21_021D0D80.h"
|
||||
#include "overlay021/ov21_021D1FA4.h"
|
||||
#include "overlay021/ov21_021D4C0C.h"
|
||||
#include "overlay021/ov21_021D5600.h"
|
||||
#include "overlay021/ov21_021E29DC.h"
|
||||
#include "overlay021/pokedex_sort.h"
|
||||
#include "overlay021/pokedex_text.h"
|
||||
#include "overlay021/struct_ov21_021D0F60_decl.h"
|
||||
#include "overlay021/struct_ov21_021D13FC.h"
|
||||
#include "overlay021/struct_ov21_021D2648.h"
|
||||
|
|
@ -445,12 +445,12 @@ static void ov21_021E10D0(UnkStruct_ov21_021E0D7C *param0, const UnkStruct_ov21_
|
|||
|
||||
static void ov21_021E1188(UnkStruct_ov21_021E0D7C *param0, int param1, int param2, int param3, int param4)
|
||||
{
|
||||
Strbuf *v0 = ov21_021D56BC(param2, param3, param4, param1);
|
||||
Strbuf *v0 = PokedexText_DexEntry(param2, param3, param4, param1);
|
||||
u32 v1 = Font_CalcMaxLineWidth(FONT_SYSTEM, v0, 0);
|
||||
u32 v2 = (v1 < 240) ? 128 - v1 / 2 : 8;
|
||||
|
||||
Text_AddPrinterWithParamsAndColor(¶m0->unk_00->unk_04, FONT_SYSTEM, v0, v2, 136, TEXT_SPEED_INSTANT, TEXT_COLOR(2, 1, 0), NULL);
|
||||
ov21_021D5600(v0);
|
||||
PokedexText_Free(v0);
|
||||
}
|
||||
|
||||
static void ov21_021E11DC(UnkStruct_ov21_021E0D7C *param0, const UnkStruct_ov21_021E0D68 *param1, int param2)
|
||||
|
|
@ -567,7 +567,7 @@ static Window *ov21_021E1460(UnkStruct_ov21_021E0D7C *param0, int param1, int pa
|
|||
Strbuf *v1;
|
||||
|
||||
v0 = ov21_021D4D6C(param0->unk_00->unk_14C, 18, 2);
|
||||
v1 = ov21_021D566C(param1, GAME_LANGUAGE, param2);
|
||||
v1 = PokedexText_Category(param1, GAME_LANGUAGE, param2);
|
||||
|
||||
{
|
||||
u32 v2 = Font_CalcStrbufWidth(FONT_SUBSCREEN, v1, 0);
|
||||
|
|
@ -575,7 +575,7 @@ static Window *ov21_021E1460(UnkStruct_ov21_021E0D7C *param0, int param1, int pa
|
|||
ov21_021D4E80(param0->unk_00->unk_14C, v0, v1, v3, 0);
|
||||
}
|
||||
|
||||
ov21_021D5600(v1);
|
||||
PokedexText_Free(v1);
|
||||
|
||||
return v0;
|
||||
}
|
||||
|
|
@ -818,19 +818,19 @@ static int ov21_021E185C(int param0)
|
|||
|
||||
static void ov21_021E18A0(UnkStruct_ov21_021E0D7C *param0, int param1, int param2, int param3)
|
||||
{
|
||||
Strbuf *v0 = ov21_021D561C(param2, param3, param1);
|
||||
Strbuf *v0 = PokedexText_NameNumber(param2, param3, param1);
|
||||
|
||||
Text_AddPrinterWithParamsAndColor(¶m0->unk_00->unk_04, FONT_SYSTEM, v0, 120, 96, TEXT_SPEED_INSTANT, TEXT_COLOR(2, 1, 0), NULL);
|
||||
ov21_021D5600(v0);
|
||||
PokedexText_Free(v0);
|
||||
}
|
||||
|
||||
static void ov21_021E18DC(UnkStruct_ov21_021E0D7C *param0, int param1, int param2, int param3)
|
||||
{
|
||||
Strbuf *v0 = ov21_021D566C(param2, param3, param1);
|
||||
Strbuf *v0 = PokedexText_Category(param2, param3, param1);
|
||||
u32 v1;
|
||||
|
||||
v1 = 240 - Font_CalcStrbufWidth(FONT_SYSTEM, v0, 0);
|
||||
|
||||
Text_AddPrinterWithParamsAndColor(¶m0->unk_00->unk_04, FONT_SYSTEM, v0, v1, 112, TEXT_SPEED_INSTANT, TEXT_COLOR(2, 1, 0), NULL);
|
||||
ov21_021D5600(v0);
|
||||
PokedexText_Free(v0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@
|
|||
#include "overlay021/ov21_021D1FA4.h"
|
||||
#include "overlay021/ov21_021D4340.h"
|
||||
#include "overlay021/ov21_021D4C0C.h"
|
||||
#include "overlay021/ov21_021D5600.h"
|
||||
#include "overlay021/ov21_021DE668.h"
|
||||
#include "overlay021/ov21_021E0C68.h"
|
||||
#include "overlay021/ov21_021E29DC.h"
|
||||
#include "overlay021/pokedex_sort.h"
|
||||
#include "overlay021/pokedex_text.h"
|
||||
#include "overlay021/struct_ov21_021D0F60_decl.h"
|
||||
#include "overlay021/struct_ov21_021D13FC.h"
|
||||
#include "overlay021/struct_ov21_021D3320.h"
|
||||
|
|
@ -1019,7 +1019,7 @@ static void ov21_021E27C0(UnkStruct_ov21_021E1E74 *param0, UnkStruct_ov21_021E1A
|
|||
v1 = 72;
|
||||
|
||||
ov21_021E0CDC(param1->unk_10, 2);
|
||||
v2 = ov21_021D5608(param3 - 1);
|
||||
v2 = PokedexText_ForeignLanguage(param3 - 1);
|
||||
ov21_021E0CF8(param1->unk_10, v2);
|
||||
break;
|
||||
default:
|
||||
|
|
@ -1127,7 +1127,7 @@ static void ov21_021E2968(UnkStruct_ov21_021E1E74 *param0, UnkStruct_ov21_021E1A
|
|||
param0->unk_38 = 0;
|
||||
|
||||
for (v1 = 0; v1 < (6 - 1); v1++) {
|
||||
v2 = ov21_021D5608(v1);
|
||||
v2 = PokedexText_ForeignLanguage(v1);
|
||||
v0 = ov21_021D392C(param1->unk_04, v2);
|
||||
|
||||
if (v0) {
|
||||
|
|
|
|||
179
src/overlay021/pokedex_text.c
Normal file
179
src/overlay021/pokedex_text.c
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
#include "overlay021/pokedex_text.h"
|
||||
|
||||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "constants/narc.h"
|
||||
#include "constants/species.h"
|
||||
|
||||
#include "text/pl_msg.naix"
|
||||
|
||||
#include "error_handling.h"
|
||||
#include "inlines.h"
|
||||
#include "message.h"
|
||||
#include "message_util.h"
|
||||
#include "pokedex_language.h"
|
||||
#include "strbuf.h"
|
||||
|
||||
enum LangIndex {
|
||||
LI_JAPANESE,
|
||||
LI_ENGLISH,
|
||||
LI_FRENCH,
|
||||
LI_GERMAN,
|
||||
LI_ITALIAN,
|
||||
LI_SPANISH
|
||||
};
|
||||
|
||||
static const u8 messageBankLanguageOrder[NUM_LANGUAGES] = {
|
||||
LI_ENGLISH,
|
||||
LI_FRENCH,
|
||||
LI_GERMAN,
|
||||
LI_ITALIAN,
|
||||
LI_SPANISH,
|
||||
LI_JAPANESE
|
||||
};
|
||||
|
||||
static inline int LanguageIndex_Guarded(int languageIndex);
|
||||
static inline BOOL ValidLanguage(int species, int languageIndex);
|
||||
static Strbuf *LoadMessage(int bankID, int entryID, int heapID);
|
||||
static void GetLanguageIndex(int species, int language, int *dexNum, int *languageIndexUnguarded, int *languageIndex);
|
||||
|
||||
void PokedexText_Free(Strbuf *strbuf)
|
||||
{
|
||||
Strbuf_Free(strbuf);
|
||||
}
|
||||
|
||||
int PokedexText_ForeignLanguage(int languageIndex)
|
||||
{
|
||||
return PokedexLanguage_IndexToLanguage(messageBankLanguageOrder[languageIndex + 1]);
|
||||
}
|
||||
|
||||
Strbuf *PokedexText_NameNumber(int species, int language, int heapID)
|
||||
{
|
||||
int dexNum;
|
||||
int languageIndex_unguarded;
|
||||
int index;
|
||||
int bankID;
|
||||
|
||||
GetLanguageIndex(species, language, &dexNum, &languageIndex_unguarded, &index);
|
||||
|
||||
if (index == NUM_LANGUAGES) {
|
||||
return MessageUtil_SpeciesName(species, heapID);
|
||||
} else {
|
||||
const int nameNumberBanks[] = {
|
||||
message_bank_unk_0717,
|
||||
message_bank_species_name_number_1,
|
||||
message_bank_unk_0713,
|
||||
message_bank_unk_0714,
|
||||
message_bank_species_name_number_2,
|
||||
message_bank_species_name_number_3
|
||||
};
|
||||
bankID = nameNumberBanks[index];
|
||||
index = dexNum;
|
||||
}
|
||||
|
||||
return LoadMessage(bankID, index, heapID);
|
||||
}
|
||||
|
||||
Strbuf *PokedexText_Category(int species, int language, int heapID)
|
||||
{
|
||||
int dexNum;
|
||||
int languageIndex_unguarded;
|
||||
int index;
|
||||
int bankID;
|
||||
|
||||
GetLanguageIndex(species, language, &dexNum, &languageIndex_unguarded, &index);
|
||||
|
||||
if (index == NUM_LANGUAGES) {
|
||||
index = species;
|
||||
bankID = message_bank_unk_0711;
|
||||
} else {
|
||||
const int categoryBanks[] = {
|
||||
message_bank_unk_0723,
|
||||
message_bank_species_category,
|
||||
message_bank_unk_0719,
|
||||
message_bank_unk_0720,
|
||||
message_bank_unk_0721,
|
||||
message_bank_unk_0722
|
||||
};
|
||||
bankID = categoryBanks[index];
|
||||
index = dexNum;
|
||||
}
|
||||
|
||||
return LoadMessage(bankID, index, heapID);
|
||||
}
|
||||
|
||||
Strbuf *PokedexText_DexEntry(int species, int language, int entryOffset, int heapID)
|
||||
{
|
||||
int dexNum;
|
||||
int languageIndex_unguarded;
|
||||
int index;
|
||||
int bankID;
|
||||
|
||||
GetLanguageIndex(species, language, &dexNum, &languageIndex_unguarded, &index);
|
||||
|
||||
if (index == NUM_LANGUAGES) {
|
||||
GF_ASSERT(entryOffset < 1);
|
||||
index = species + entryOffset;
|
||||
bankID = message_bank_species_dex_entry;
|
||||
} else {
|
||||
const int dexEntryBanks[] = {
|
||||
message_bank_unk_0705,
|
||||
message_bank_unk_0700,
|
||||
message_bank_unk_0701,
|
||||
message_bank_unk_0702,
|
||||
message_bank_unk_0703,
|
||||
message_bank_unk_0704
|
||||
};
|
||||
GF_ASSERT(entryOffset < 1);
|
||||
bankID = dexEntryBanks[index];
|
||||
index = dexNum + entryOffset;
|
||||
}
|
||||
|
||||
return LoadMessage(bankID, index, heapID);
|
||||
}
|
||||
|
||||
static inline BOOL ValidLanguage(int species, int languageIndex)
|
||||
{
|
||||
if ((species > NATIONAL_DEX_COUNT) && (languageIndex != NUM_LANGUAGES)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Strbuf *LoadMessage(int bankID, int entryID, int heapID)
|
||||
{
|
||||
MessageLoader *messageLoader = MessageLoader_Init(MESSAGE_LOADER_NARC_HANDLE, NARC_INDEX_MSGDATA__PL_MSG, bankID, heapID);
|
||||
|
||||
if (messageLoader) {
|
||||
Strbuf *strbuf = Strbuf_Init(256, heapID);
|
||||
|
||||
if (strbuf) {
|
||||
MessageLoader_GetStrbuf(messageLoader, entryID, strbuf);
|
||||
}
|
||||
|
||||
MessageLoader_Free(messageLoader);
|
||||
return strbuf;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void GetLanguageIndex(int species, int language, int *dexNum, int *languageIndexUnguarded, int *languageIndex)
|
||||
{
|
||||
*languageIndexUnguarded = PokedexLanguage_LanguageToIndex(language);
|
||||
|
||||
GF_ASSERT(*languageIndexUnguarded < NUM_LANGUAGES);
|
||||
|
||||
*dexNum = species;
|
||||
*languageIndex = LanguageIndex_Guarded(*languageIndexUnguarded);
|
||||
|
||||
GF_ASSERT(ValidLanguage(*dexNum, *languageIndex));
|
||||
}
|
||||
|
||||
static inline int LanguageIndex_Guarded(int languageIndex)
|
||||
{
|
||||
GF_ASSERT(languageIndex < NUM_LANGUAGES);
|
||||
return (languageIndex == LI_ENGLISH) ? NUM_LANGUAGES : languageIndex;
|
||||
}
|
||||
1240
src/pokedex_data.c
Normal file
1240
src/pokedex_data.c
Normal file
File diff suppressed because it is too large
Load Diff
34
src/pokedex_language.c
Normal file
34
src/pokedex_language.c
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include "pokedex_language.h"
|
||||
|
||||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "global/pm_version.h"
|
||||
|
||||
static const u8 languageArray[NUM_LANGUAGES] = {
|
||||
JAPANESE,
|
||||
ENGLISH,
|
||||
FRENCH,
|
||||
GERMAN,
|
||||
ITALIAN,
|
||||
SPANISH
|
||||
};
|
||||
|
||||
int PokedexLanguage_LanguageToIndex(int language)
|
||||
{
|
||||
int languageIndex;
|
||||
|
||||
for (languageIndex = 0; languageIndex < NUM_LANGUAGES; languageIndex++) {
|
||||
if (language == languageArray[languageIndex]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return languageIndex;
|
||||
}
|
||||
|
||||
int PokedexLanguage_IndexToLanguage(int languageIndex)
|
||||
{
|
||||
GF_ASSERT(languageIndex < NUM_LANGUAGES);
|
||||
return languageArray[languageIndex];
|
||||
}
|
||||
|
|
@ -7,9 +7,9 @@
|
|||
|
||||
#include "heap.h"
|
||||
#include "inlines.h"
|
||||
#include "pokedex_language.h"
|
||||
#include "pokemon.h"
|
||||
#include "savedata.h"
|
||||
#include "unk_020986CC.h"
|
||||
|
||||
// These u32[16] arrays store pokedex seen/caught info as bit flags
|
||||
// Therefore 32 * 16 = 512 pokedex slots. These need to be bumped up if it's pushed past this number
|
||||
|
|
@ -622,7 +622,7 @@ static void sub_02026B88(PokedexData *param0, u16 param1, u32 param2)
|
|||
int v1;
|
||||
|
||||
v0 = param1;
|
||||
v1 = sub_020986CC(param2);
|
||||
v1 = PokedexLanguage_LanguageToIndex(param2);
|
||||
|
||||
if (v1 == 6) {
|
||||
return;
|
||||
|
|
@ -1162,7 +1162,7 @@ BOOL sub_020274D0(const PokedexData *param0, u16 species, u32 param2)
|
|||
CheckPokedexIntegrity(param0);
|
||||
|
||||
speciesInt = species;
|
||||
param2 = sub_020986CC(param2);
|
||||
param2 = PokedexLanguage_LanguageToIndex(param2);
|
||||
|
||||
return param0->recordedLanguages[speciesInt] & (1 << param2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
#include "unk_020986CC.h"
|
||||
|
||||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
static const u8 Unk_020F681C[6] = {
|
||||
0x1,
|
||||
0x2,
|
||||
0x3,
|
||||
0x5,
|
||||
0x4,
|
||||
0x7
|
||||
};
|
||||
|
||||
int sub_020986CC(int param0)
|
||||
{
|
||||
int v0;
|
||||
|
||||
for (v0 = 0; v0 < 6; v0++) {
|
||||
if (param0 == Unk_020F681C[v0]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return v0;
|
||||
}
|
||||
|
||||
int sub_020986E8(int param0)
|
||||
{
|
||||
GF_ASSERT(param0 < 6);
|
||||
return Unk_020F681C[param0];
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user