mirror of
https://github.com/Skeli789/Dynamic-Pokemon-Expansion.git
synced 2026-04-25 07:36:55 -05:00
Fix Pokedex Issues
This commit is contained in:
parent
abd41b014b
commit
9f0da24417
1
BPRE.ld
1
BPRE.ld
|
|
@ -7,6 +7,7 @@ __umodsi3 = 0x081E4684|1;
|
|||
memcpy_ = 0x081E5E78|1;
|
||||
memset_ = 0x081E5ED8|1;
|
||||
|
||||
gPokedexScreenDataPtr = 0x203ACF0;
|
||||
gMain = 0x30030F0;
|
||||
|
||||
GetGenderFromSpeciesAndPersonality = 0x803F78C | 1;
|
||||
|
|
|
|||
|
|
@ -16,62 +16,13 @@ RegularPokedexMemoryAlloc:
|
|||
|
||||
PokedexMemoryAllocReturn:
|
||||
ldr r1, =0x81025F0 | 1
|
||||
bxr1:
|
||||
bx r1
|
||||
|
||||
.align 2
|
||||
.RegularPokedexSize: .word 0xC10
|
||||
.ExpandedPokedexSize: .word 999 * 8
|
||||
|
||||
.pool
|
||||
@0x8103530 with r1
|
||||
PrepareDexListViewsHook:
|
||||
cmp r0, #0x0
|
||||
beq PrepareDexListViewsReturn
|
||||
ldr r2, =gNumDexEntries
|
||||
ldrh r2, [r2]
|
||||
str r2, [sp]
|
||||
|
||||
PrepareDexListViewsReturn:
|
||||
ldr r2, =gRegionalDexCount
|
||||
ldrh r2, [r2]
|
||||
sub r2, #0x1
|
||||
lsl r2, #0x1
|
||||
ldr r0, =gPokedexOrder_Regional
|
||||
ldrh r2, [r0, r2] @Load final dexNum in regional dex
|
||||
ldr r0, =0x810353A | 1
|
||||
bx r0
|
||||
|
||||
@0x810356C with r0
|
||||
RegionalDexHook:
|
||||
mov r4, r8
|
||||
lsl r0, r4, #0x1 @;Index x2
|
||||
ldr r1, =gPokedexOrder_Regional
|
||||
ldrh r0, [r1, r0]
|
||||
add r4, #0x1
|
||||
mov r5, r0
|
||||
mov r1, #0
|
||||
ldr r2, =0x8103578 | 1
|
||||
bx r2
|
||||
|
||||
@0x81035B4 with r1
|
||||
StoreLastDexSeenHook:
|
||||
str r0, [r2]
|
||||
mov r10, r4
|
||||
mov r4, r3
|
||||
ldr r0, =0x081035D6 | 1
|
||||
bx r0
|
||||
|
||||
@0x081035F4 with r0
|
||||
LazyRegionalDexEndHook:
|
||||
mov r0, r8
|
||||
ldr r1, =gRegionalDexCount
|
||||
ldrh r1, [r1]
|
||||
cmp r0, r1
|
||||
bcc RegionalDexHook
|
||||
ldr r1, =0x08103906 | 1
|
||||
bxr1:
|
||||
bx r1
|
||||
|
||||
@0x8104A66 with r1
|
||||
DisplayRegionalDexNumHook:
|
||||
mov r5, r0
|
||||
|
|
@ -92,26 +43,13 @@ DisplayRegionalDexNumHook:
|
|||
|
||||
UseRegionalDexOrdering:
|
||||
mov r0, r5
|
||||
ldr r1, =SpeciesToNationalPokedexNum
|
||||
bl bxr1
|
||||
bl NatDexNumToRegionalDexNum
|
||||
bl SpeciesToRegionalDexNum
|
||||
|
||||
DisplayDexNumberReturn:
|
||||
mov r5, r0
|
||||
ldr r0, =0x8104A70 | 1
|
||||
bx r0
|
||||
|
||||
.pool
|
||||
@0x8103684 with r1
|
||||
AlphabeticalDexHook:
|
||||
add r8, r0
|
||||
ldr r0, =gNumDexEntries
|
||||
ldrh r0, [r0]
|
||||
sub r0, #0x1
|
||||
cmp r8, r0
|
||||
ldr r1, =0x810368C | 1
|
||||
bx r1
|
||||
|
||||
.pool
|
||||
@0x8105CBC with r0
|
||||
AlternateDexEntriesHook:
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 792 B After Width: | Height: | Size: 792 B |
Binary file not shown.
|
Before Width: | Height: | Size: 1010 B After Width: | Height: | Size: 971 B |
6
hooks
6
hooks
|
|
@ -17,11 +17,7 @@ HasAllMons 8088F84 0
|
|||
GenderedMonIconHook 8096E38 2
|
||||
GetIconSpecies 8096F5C 2
|
||||
PokedexMemoryAllocationHook 81025E8 0
|
||||
PrepareDexListViewsHook 8103530 1
|
||||
RegionalDexHook 810356C 0
|
||||
StoreLastDexSeenHook 81035B4 1
|
||||
LazyRegionalDexEndHook 81035F4 0
|
||||
AlphabeticalDexHook 8103684 1
|
||||
LoadPokedexViews 8103518 1
|
||||
DisplayRegionalDexNumHook 8104A66 1
|
||||
CountSpeciesInDex 8104BBC 2
|
||||
AlternateDexEntriesHook 8105CBC 0
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ struct PokedexEntry
|
|||
/*0x0C*/ u16 height; //in decimeters
|
||||
/*0x0E*/ u16 weight; //in hectograms
|
||||
/*0x10*/ const u8* description;
|
||||
/*0x14*/ u16 unused;
|
||||
/*0x16*/ u16 pokemonScale;
|
||||
/*0x18*/ u16 pokemonOffset;
|
||||
/*0x1A*/ u16 trainerScale;
|
||||
/*0x1C*/ u16 trainerOffset;
|
||||
/*0x1E*/ u16 unknown1;
|
||||
/*0x20*/ u32 unknown2;
|
||||
/*0x14*/ const u8* unusedDescription;
|
||||
/*0x18*/ u16 unused;
|
||||
/*0x1A*/ u16 pokemonScale;
|
||||
/*0x1C*/ u16 pokemonOffset;
|
||||
/*0x1E*/ u16 trainerScale;
|
||||
/*0x20*/ u16 trainerOffset;
|
||||
/*0x22*/ u16 unused2;
|
||||
}; /*size = 0x24*/
|
||||
|
||||
struct AlternateDexEntries
|
||||
|
|
@ -21,6 +21,65 @@ struct AlternateDexEntries
|
|||
const u8* description;
|
||||
};
|
||||
|
||||
struct ListMenuItem
|
||||
{
|
||||
const u8* name;
|
||||
s32 id;
|
||||
};
|
||||
|
||||
struct PokedexScreenData
|
||||
{
|
||||
u8 field_00;
|
||||
u8 field_01;
|
||||
u8 field_02;
|
||||
u8 field_03;
|
||||
u8 field_04;
|
||||
u32 field_08;
|
||||
u32 field_0C;
|
||||
u16 field_10;
|
||||
u16 field_12;
|
||||
u8 field_14;
|
||||
u8 field_15;
|
||||
u8 field_16;
|
||||
u8 field_17;
|
||||
u16 field_18[0x4];
|
||||
u8 field_20[0x4];
|
||||
u8 field_24[0x4];
|
||||
u8 field_28;
|
||||
u8 field_29;
|
||||
u8 field_2A;
|
||||
u8 field_2B;
|
||||
u8 field_2C;
|
||||
u8 field_2D;
|
||||
u8 field_2E;
|
||||
u8 field_2F;
|
||||
u32 field_30;
|
||||
u16 field_34;
|
||||
u16 field_36;
|
||||
u16 field_38;
|
||||
u16 field_3A;
|
||||
u16 field_3C;
|
||||
u16 field_3E;
|
||||
u8 field_40;
|
||||
u8 field_41;
|
||||
u8 field_42;
|
||||
struct ListMenuItem* listItem;
|
||||
u16 field_48;
|
||||
u8 field_4A[0x10];
|
||||
u16 field_5A;
|
||||
u16 * field_5C;
|
||||
u8 field_60;
|
||||
u8 field_61;
|
||||
u16 field_62;
|
||||
u8 field_64;
|
||||
u16 field_66;
|
||||
u16 field_68;
|
||||
u16 field_6A;
|
||||
u16 field_6C;
|
||||
};
|
||||
|
||||
struct PokedexScreenData* gPokedexScreenDataPtr;
|
||||
|
||||
enum
|
||||
{
|
||||
FLAG_GET_SEEN,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#define POKEMON_NAME_LENGTH 10
|
||||
|
||||
#define SPECIES_NONE 0x0
|
||||
#define SPECIES_BULBASAUR 0x1
|
||||
#define SPECIES_IVYSAUR 0x2
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ gSpeciesToNationalPokedexNum 0804323C
|
|||
gPokedexOrder_Alphabetical 08103694
|
||||
gPokedexOrder_Weight 081037CC
|
||||
gPokedexOrder_Height 08103868
|
||||
gPokedexOrder_Type 8103734
|
||||
|
||||
gMonIconTable 08000138
|
||||
gMonIconPaletteIndices 0800013C
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ const struct MonCoords gMonFrontPicCoords[NUM_SPECIES] =
|
|||
[SPECIES_BLASTOISE] =
|
||||
{
|
||||
.size = 0x87,
|
||||
.y_offset = 0x5,
|
||||
.y_offset = 0x4,
|
||||
},
|
||||
[SPECIES_CATERPIE] =
|
||||
{
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
5959
src/Pokedex_Orders.c
5959
src/Pokedex_Orders.c
File diff suppressed because it is too large
Load Diff
|
|
@ -6,10 +6,21 @@
|
|||
|
||||
//Backsprite battle start
|
||||
|
||||
extern const u8 gSpeciesNames[][POKEMON_NAME_LENGTH + 1];
|
||||
extern const u16 gSpeciesIdToCryId[];
|
||||
extern const u16 gSpeciesToNationalPokedexNum[];
|
||||
extern const u16 gRegionalDexCount;
|
||||
|
||||
extern const u16 gPokedexOrder_Regional[];
|
||||
extern const u16 gRegionalDexCount;
|
||||
extern const u16 gPokedexOrder_Alphabetical[];
|
||||
extern const u16 gPokedexOrderAlphabeticalCount;
|
||||
extern const u16 gPokedexOrder_Weight[];
|
||||
extern const u16 gPokedexOrderWeightCount;
|
||||
extern const u16 gPokedexOrder_Height[];
|
||||
extern const u16 gPokedexOrderHeightCount;
|
||||
extern const u16 gPokedexOrder_Type[];
|
||||
extern const u16 gPokedexOrderTypeCount;
|
||||
|
||||
extern const struct AlternateDexEntries gAlternateDexEntries[];
|
||||
extern const struct CompressedSpriteSheet gMonBackPicTable[];
|
||||
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
|
||||
|
|
@ -27,6 +38,7 @@ void __attribute__((long_call)) break_func();
|
|||
|
||||
//This file's functions
|
||||
u16 TryGetFemaleGenderedSpecies(u16 species, u32 personality);
|
||||
static u16 LoadNationalPokedexView(void);
|
||||
|
||||
u16 SpeciesToCryId(u16 species)
|
||||
{
|
||||
|
|
@ -288,15 +300,127 @@ bool16 HasAllMons(void)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
u16 NatDexNumToRegionalDexNum(u16 natDexNum)
|
||||
u16 SpeciesToRegionalDexNum(u16 species)
|
||||
{
|
||||
u16 i;
|
||||
|
||||
for (i = 0; i < gRegionalDexCount; ++i)
|
||||
{
|
||||
if (gPokedexOrder_Regional[i] == natDexNum)
|
||||
if (gPokedexOrder_Regional[i] == species)
|
||||
return i + 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern const u16 gPokedexOrder_Regional[];
|
||||
extern const u16 gRegionalDexCount;
|
||||
extern const u16 gPokedexOrder_Alphabetical[];
|
||||
extern const u16 gPokedexOrderAlphabeticalCount;
|
||||
extern const u16 gPokedexOrder_Weight[];
|
||||
extern const u16 gPokedexOrderWeightCount;
|
||||
extern const u16 gPokedexOrder_Height[];
|
||||
extern const u16 gPokedexOrderHeightCount;
|
||||
extern const u16 gPokedexOrder_Type[];
|
||||
extern const u16 gPokedexOrderTypeCount;
|
||||
|
||||
u16 LoadPokedexViews(u8 type)
|
||||
{
|
||||
u16 i, counter, count, lastMeaningfulIndex;
|
||||
const u16* dexList;
|
||||
bool8 showUnseenSpecies = FALSE;
|
||||
|
||||
switch (type) {
|
||||
case 0:
|
||||
dexList = gPokedexOrder_Regional;
|
||||
count = gRegionalDexCount;
|
||||
showUnseenSpecies = TRUE;
|
||||
break;
|
||||
case 1:
|
||||
dexList = gPokedexOrder_Alphabetical;
|
||||
count = gPokedexOrderAlphabeticalCount;
|
||||
break;
|
||||
case 2:
|
||||
dexList = gPokedexOrder_Type;
|
||||
count = gPokedexOrderTypeCount;
|
||||
break;
|
||||
case 3:
|
||||
dexList = gPokedexOrder_Weight;
|
||||
count = gPokedexOrderWeightCount;
|
||||
break;
|
||||
case 4:
|
||||
dexList = gPokedexOrder_Height;
|
||||
count = gPokedexOrderHeightCount;
|
||||
break;
|
||||
case 5:
|
||||
default:
|
||||
return LoadNationalPokedexView();
|
||||
}
|
||||
|
||||
for (i = 0, counter = 0, lastMeaningfulIndex = 0; i < count; ++i)
|
||||
{
|
||||
u16 species = dexList[i];
|
||||
bool8 seen = DexFlagCheck(species, FLAG_GET_SEEN, TRUE);
|
||||
bool8 caught = DexFlagCheck(species, FLAG_GET_CAUGHT, TRUE);
|
||||
|
||||
if (!seen)
|
||||
{
|
||||
if (showUnseenSpecies)
|
||||
{
|
||||
gPokedexScreenDataPtr->listItem[counter].name = (void*) 0x8415F66; //-----
|
||||
gPokedexScreenDataPtr->listItem[counter++].id = species | (0 << 16); //Unseen
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lastMeaningfulIndex = counter + 1;
|
||||
gPokedexScreenDataPtr->listItem[counter].name = gSpeciesNames[species];
|
||||
|
||||
if (caught)
|
||||
gPokedexScreenDataPtr->listItem[counter++].id = species | (3 << 16); //Caught
|
||||
else
|
||||
gPokedexScreenDataPtr->listItem[counter++].id = species | (1 << 16); //Seen
|
||||
}
|
||||
}
|
||||
|
||||
if (lastMeaningfulIndex == 0)
|
||||
{
|
||||
//Fix empty list
|
||||
lastMeaningfulIndex = 1;
|
||||
gPokedexScreenDataPtr->listItem[0].name = (void*) 0x8415F66; //-----
|
||||
gPokedexScreenDataPtr->listItem[0].id = gPokedexOrder_Regional[0] | (0 << 16); //Unseen
|
||||
}
|
||||
|
||||
return lastMeaningfulIndex;
|
||||
}
|
||||
|
||||
static u16 LoadNationalPokedexView(void)
|
||||
{
|
||||
u16 i, lastMeaningfulIndex;
|
||||
|
||||
for (i = 1, lastMeaningfulIndex = 0; i < NATIONAL_DEX_COUNT; ++i)
|
||||
{
|
||||
bool8 seen = DexFlagCheck(i, FLAG_GET_SEEN, FALSE);
|
||||
bool8 caught = DexFlagCheck(i, FLAG_GET_CAUGHT, FALSE);
|
||||
u16 species = NationalPokedexNumToSpecies(i);
|
||||
u16 listIndex = i - 1;
|
||||
|
||||
if (!seen)
|
||||
{
|
||||
gPokedexScreenDataPtr->listItem[listIndex].name = (void*) 0x8415F66; //-----
|
||||
gPokedexScreenDataPtr->listItem[listIndex].id = species | (0 << 16); //Unseen
|
||||
}
|
||||
else
|
||||
{
|
||||
lastMeaningfulIndex = i;
|
||||
gPokedexScreenDataPtr->listItem[listIndex].name = gSpeciesNames[species];
|
||||
|
||||
if (caught)
|
||||
gPokedexScreenDataPtr->listItem[listIndex].id = species | (3 << 16); //Caught
|
||||
else
|
||||
gPokedexScreenDataPtr->listItem[listIndex].id = species | (1 << 16); //Seen
|
||||
}
|
||||
}
|
||||
|
||||
return lastMeaningfulIndex;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user