summaryrefslogtreecommitdiff
path: root/src/pokedex.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pokedex.c')
-rw-r--r--src/pokedex.c168
1 files changed, 29 insertions, 139 deletions
diff --git a/src/pokedex.c b/src/pokedex.c
index 8dfc4212c..48e3a57aa 100644
--- a/src/pokedex.c
+++ b/src/pokedex.c
@@ -1,65 +1,18 @@
#include "global.h"
+#include "pokedex.h"
+#include "asm.h"
+#include "gba/m4a_internal.h"
+#include "string_util.h"
+#include "m4a.h"
+#include "decompress.h"
#include "main.h"
#include "menu.h"
#include "palette.h"
#include "rng.h"
#include "songs.h"
#include "sound.h"
-#include "sprite.h"
#include "task.h"
-#include "text.h"
-
-struct PokedexListItem
-{
- u16 dexNum;
- u16 seen:1;
- u16 owned:1;
-};
-
-struct PokedexView
-{
- struct PokedexListItem unk0[386];
- u16 unk608;
- u8 unk60A_1:1;
- u8 unk60A_2:1;
- u8 unk60B;
- u16 unk60C;
- u16 selectedPokemon;
- u16 unk610;
- u16 dexMode; //National or Hoenn
- u16 unk614;
- u16 dexOrder;
- u16 unk618;
- u16 unk61A;
- u16 unk61C;
- u16 unk61E[4];
- u16 unk626; //sprite id of selected Pokemon
- u16 unk628;
- u16 unk62A;
- u8 unk62C;
- u8 unk62D;
- u8 unk62E;
- u8 unk62F;
- s16 unk630;
- s16 unk632;
- u16 unk634;
- u16 unk636;
- u16 unk638;
- u16 unk63A[4];
- u8 filler642[8];
- u8 unk64A;
- u8 unk64B;
- u8 unk64C_1:1;
- u8 selectedScreen;
- u8 unk64E;
- u8 unk64F;
- u8 menuIsOpen; //menuIsOpen
- u8 unk651;
- u16 menuCursorPos; //Menu cursor position
- s16 menuY; //Menu Y position (inverted because we use REG_BG0VOFS for this)
- u8 unk656[8];
- u8 unk65E[8];
-};
+#include "event_data.h"
// I'm #define-ing these just for now so I can keep using the old unkXXX member names
#define unk60E selectedPokemon
@@ -118,7 +71,7 @@ extern u8 gUnknown_08E96738[];
extern u8 gUnknown_08E9C6DC[];
extern u8 gUnknown_08E96888[];
extern u8 gUnknown_08E96994[];
-extern u8 gUnknown_083A05CC[];
+extern struct SpriteSheet gUnknown_083A05CC;
extern struct SpritePalette gUnknown_083A05DC[];
extern u8 gUnknown_0839FA7C[];
extern u8 gUnknown_0839F67C[];
@@ -156,12 +109,9 @@ extern u8 gDexText_RegisterComplete[];
extern void m4aMPlayVolumeControl(struct MusicPlayerInfo *mplayInfo, u16 trackBits, u16 volume);
extern bool8 BeginNormalPaletteFade(u32, s8, u8, u8, u16);
extern void remove_some_task(void);
-extern bool32 IsNationalPokedex(void);
-extern u16 GetNationalPokedexCount(u8);
extern u8 sub_8091E3C(void);
-extern void sub_80690C8(void);
+extern void DisableNationalPokedex(void);
extern void sub_805469C(void);
-extern void LoadCompressedObjectPic(void *);
extern u16 HoennToNationalOrder(u16);
extern u16 NationalToHoennOrder(u16);
extern u16 gPokedexOrder_Alphabetical[];
@@ -169,73 +119,17 @@ extern u16 gPokedexOrder_Weight[];
extern u16 gPokedexOrder_Height[];
extern u8 gSpeciesNames[][11];
-void ClearPokedexView(struct PokedexView *);
-void Task_PokedexShowMainScreen(u8 taskId);
-void sub_808C0B8(void);
-void MainCB(void);
-bool8 sub_808D344(u8);
-void Task_PokedexMainScreen(u8 taskId);
-void sub_808E6BC(void);
-void sub_808EDB8(struct Sprite *);
-void sub_808CA64(u8 taskId);
-void Task_PokedexMainScreenMenu(u8 taskId);
-void sub_808CB8C(u8 taskId);
-u16 sub_808E48C(u16, u16);
-void sub_808C898(u8 taskId);
-void Task_ClosePokedex(u8 taskId);
-void sub_8091060(u16);
-void sub_808CAE4(u8 taskId);
-void sub_808D198(u8 taskId);
-bool8 sub_808E208(u8, u8, u8);
-u8 sub_808E82C(void);
-void sub_808E0CC(u16, u16);
-u8 sub_808F210(struct PokedexListItem *, u8);
-u8 sub_808F284(struct PokedexListItem *, u8);
-bool8 sub_808F250(u8);
-bool8 sub_808E71C(void);
-void sub_808CCC4(u8 taskId);
-u16 GetHoennPokedexCount(u8);
-void SortPokedex(u8, u8);
-void Task_PokedexResultsScreen(u8 taskId);
-void sub_808D118(u8 taskId);
-void Task_PokedexResultsScreenMenu(u8 taskId);
-void Task_PokedexResultsScreenReturnToMainScreen(u8 taskId);
-void sub_808CEF8(u8 taskId);
-void Task_PokedexResultsScreenExitPokedex(u8 taskId);
-void sub_808D640(void);
-void sub_808E978(u8);
-bool8 sub_8090D90(u16, u8);
-void sub_808E090(u8, u8, u16);
-void sub_808DEB0(u16, u8, u8, u16);
-void sub_808DF88(u16, u8, u8, u16);
-u8 sub_808DFE4(u16, u8, u8);
-u16 sub_808E888(u16);
-u32 sub_808E8C8(u16, u16, u16);
-void sub_808EE28(struct Sprite *sprite);
-u16 sub_8091818(u8, u16, u16, u16);
-u16 sub_80918EC(u16 a, s16 b, s16 c, u16 d); //Not sure of return type
-void Task_InitPageScreenMultistep(u8 taskId);
-void Task_PageScreenProcessInput(u8 taskId);
-void Task_InitCryScreenMultistep(u8 taskId);
-void Task_InitAreaScreenMultistep(u8 taskId);
-void Task_ClosePageScreen(u8 taskId);
-void sub_808F888(u8 taskId);
-void Task_InitSizeScreenMultistep(u8 taskId);
-void Task_AreaScreenProcessInput(u8 taskId);
-void sub_808FA00(u8 taskId);
-void Task_CryScreenProcessInput(u8 taskId);
-void sub_808FFBC(u8 taskId);
-void Task_SizeScreenProcessInput(u8 taskId);
-void sub_8090040(u8);
-void sub_8090498(u8 taskId);
-void sub_80904FC(u16);
-void sub_8090540(u16);
-void sub_8090750(u8);
-void sub_8090A3C(u8);
-void sub_8091738(u16, u16, u16);
u16 NationalPokedexNumToSpecies(u16);
+
+// asm/pokedex_area_screen
+void ShowPokedexAreaScreen(u16 species, u8 *string);
+
+// asm/pokedex_cry_screen
u8 sub_8119E3C(struct CryRelatedStruct *, u8);
+void sub_8119F88(u8 a);
+void sub_811A050(u16 species);
u8 ShowPokedexCryScreen(struct CryRelatedStruct *, u8);
+void DestroyCryMeterNeedleSprite();
void sub_808C02C(void)
{
@@ -251,7 +145,7 @@ void sub_808C02C(void)
gSaveBlock2.pokedex.unownPersonality = 0;
gSaveBlock2.pokedex.spindaPersonality = 0;
gSaveBlock2.pokedex.unknown3 = 0;
- sub_80690C8();
+ DisableNationalPokedex();
for(i = 0; i <= 51; i++)
{
gSaveBlock2.pokedex.owned[i] = 0;
@@ -277,7 +171,6 @@ void sub_808C0B8(void)
void ClearPokedexView(struct PokedexView *pokedexView)
{
u16 i;
- struct UnknownStruct3 *p;
for(i = 0; i <= 385; i++)
{
@@ -387,14 +280,14 @@ void CB2_InitPokedex(void)
ClearPokedexView(gPokedexView);
CreateTask(Task_PokedexShowMainScreen, 0);
gPokedexView->dexMode = gSaveBlock2.pokedex.unknown1;
- if(!IsNationalPokedex())
+ if(!IsNationalPokedexEnabled())
gPokedexView->dexMode = DEX_MODE_HOENN;
gPokedexView->dexOrder = gSaveBlock2.pokedex.order;
gPokedexView->selectedPokemon = gUnknown_0202FFB8;
gPokedexView->unk62C = gUnknown_0202FFBA;
gPokedexView->selectedScreen = PAGE_SCREEN;
gPokedexView->unk64E = 0;
- if(!IsNationalPokedex())
+ if(!IsNationalPokedexEnabled())
{
gPokedexView->unk61A = GetHoennPokedexCount(0);
gPokedexView->unk61C = GetHoennPokedexCount(1);
@@ -639,7 +532,7 @@ void sub_808CB8C(u8 taskId)
gPokedexView->unk62C = gPokedexView->unk62A;
gPokedexView->selectedPokemon = gPokedexView->unk610;
gPokedexView->dexMode = gPokedexView->unk614;
- if(!IsNationalPokedex())
+ if(!IsNationalPokedexEnabled())
gPokedexView->dexMode = DEX_MODE_HOENN;
gPokedexView->dexOrder = gPokedexView->unk618;
gTasks[taskId].func = Task_PokedexShowMainScreen;
@@ -652,7 +545,7 @@ void Task_ClosePokedex(u8 taskId)
if(!gPaletteFade.active)
{
gSaveBlock2.pokedex.unknown1 = gPokedexView->dexMode;
- if(!IsNationalPokedex())
+ if(!IsNationalPokedexEnabled())
gSaveBlock2.pokedex.unknown1 = 0;
gSaveBlock2.pokedex.order = gPokedexView->dexOrder;
DestroyTask(taskId);
@@ -823,7 +716,7 @@ void Task_PokedexResultsScreenReturnToMainScreen(u8 taskId)
gPokedexView->unk62C = gPokedexView->unk62A;
gPokedexView->selectedPokemon = gPokedexView->unk610;
gPokedexView->dexMode = gPokedexView->unk614;
- if(!IsNationalPokedex())
+ if(!IsNationalPokedexEnabled())
gPokedexView->dexMode = DEX_MODE_HOENN;
gPokedexView->dexOrder = gPokedexView->unk618;
gTasks[taskId].func = Task_PokedexShowMainScreen;
@@ -837,7 +730,7 @@ void Task_PokedexResultsScreenExitPokedex(u8 taskId)
gPokedexView->unk62C = gPokedexView->unk62A;
gPokedexView->selectedPokemon = gPokedexView->unk610;
gPokedexView->dexMode = gPokedexView->unk614;
- if(!IsNationalPokedex())
+ if(!IsNationalPokedexEnabled())
gPokedexView->dexMode = DEX_MODE_HOENN;
gPokedexView->dexOrder = gPokedexView->unk618;
gTasks[taskId].func = Task_ClosePokedex;
@@ -878,7 +771,7 @@ bool8 sub_808D344(u8 a)
ResetSpriteData();
FreeAllSpritePalettes();
gReservedSpritePaletteCount = 8;
- LoadCompressedObjectPic(gUnknown_083A05CC);
+ LoadCompressedObjectPic(&gUnknown_083A05CC);
LoadSpritePalettes(gUnknown_083A05DC);
sub_808E978(a);
gMain.state++;
@@ -934,7 +827,7 @@ void sub_808D640(void)
{
if(gPokedexView->unk64C_1)
LoadPalette(gUnknown_0839F67C + 0x2, 1, 0xBE);
- else if(!IsNationalPokedex())
+ else if(!IsNationalPokedexEnabled())
LoadPalette(gPokedexMenu_Pal + 0x2, 1, 0xBE);
else
LoadPalette(gUnknown_0839F73C + 0x2, 1, 0xBE);
@@ -955,7 +848,7 @@ void SortPokedex(u8 dexMode, u8 sortMode)
vars[1] = 1;
break;
case DEX_MODE_NATIONAL:
- if(IsNationalPokedex())
+ if(IsNationalPokedexEnabled())
{
vars[0] = 386;
vars[1] = 0;
@@ -1839,7 +1732,6 @@ void sub_808E6BC(void)
u8 sub_808E71C(void)
{
u16 r2;
- u16 r3;
u16 r4 = gPokedexView->selectedPokemon;
if((gMain.newKeys & DPAD_UP) && r4)
@@ -2284,8 +2176,6 @@ void sub_808F168(struct Sprite *sprite)
if(gPokedexView->menuIsOpen != 0 && gPokedexView->menuY == r1)
{
- u8 data2;
-
sprite->invisible = 0;
sprite->pos2.y = gPokedexView->menuCursorPos * 16;
sprite->pos2.x = gSineTable[(u8)sprite->data2] / 64;
@@ -3252,7 +3142,7 @@ void sub_8090750(u8 taskId)
break;
case 3:
sub_8072BD8(gDexText_RegisterComplete, 2, 0, 0xD0);
- if(!IsNationalPokedex())
+ if(!IsNationalPokedexEnabled())
sub_8091154(NationalToHoennOrder(dexNum), 13, 3);
else
sub_8091154(dexNum, 13, 3);
@@ -3297,4 +3187,4 @@ void sub_8090750(u8 taskId)
break;
}
}
-*/ \ No newline at end of file
+*/