mirror of
https://github.com/pret/pmd-red.git
synced 2026-09-27 05:55:27 -04:00
finish matching exclusive_pokemon
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include "item.h"
|
||||
#include "pokemon.h"
|
||||
#include "position_util.h"
|
||||
#include "exclusive_pokemon.h"
|
||||
|
||||
extern u32 gUnknown_202EDC8;
|
||||
extern u8 gUnknown_202E038[0x50];
|
||||
@@ -380,7 +381,6 @@ extern void DisplayDungeonDialogue(u32 *r0);
|
||||
extern void SpriteShockEffect(struct Entity *);
|
||||
extern u32 sub_80861F8(u32, struct Entity *, u32);
|
||||
|
||||
extern void sub_8097FA8(u32);
|
||||
|
||||
extern void JirachiWish();
|
||||
extern void JirachiSpinEffect(struct Entity *);
|
||||
@@ -393,14 +393,12 @@ extern u8 sub_80860A8(u32);
|
||||
extern void sub_8049ED4();
|
||||
extern void sub_8092578(u8 *buffer, u8 index, u8 r2);
|
||||
extern void sub_8052D44(s16 *, struct Entity *, struct Entity *);
|
||||
extern void sub_8097FD0(u32);
|
||||
extern void SetMessageArgument(u8 *, struct Entity *, u32);
|
||||
extern struct Entity *GetLeader();
|
||||
extern void sub_80421C0(struct Entity *, u32);
|
||||
extern void sub_8046D20();
|
||||
extern void sub_808B1CC(u8);
|
||||
extern void sub_80464C8(struct Entity *, u32 *, struct Item *);
|
||||
extern void sub_8098044(u32);
|
||||
extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32);
|
||||
extern void sub_803E46C(u32);
|
||||
extern void sub_80866C4(u32 *);
|
||||
@@ -418,7 +416,6 @@ extern void sub_80426C8(u32, u32);
|
||||
extern void sub_807EAA0(u32, u32);
|
||||
|
||||
extern void CreateJirachiWishWarpTile(void);
|
||||
extern u8 sub_8098100(u32);
|
||||
extern void sub_8086794();
|
||||
|
||||
void EnteiScreenFlash(void);
|
||||
|
||||
+2
-5
@@ -1,6 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "dungeon_global_data.h"
|
||||
#include "dungeon_music.h"
|
||||
#include "exclusive_pokemon.h"
|
||||
|
||||
extern void SkarmoryPreFightDialogue();
|
||||
extern void SkarmoryReFightDialogue();
|
||||
@@ -62,7 +63,6 @@ extern void SmeargleRescueDialogue();
|
||||
extern void sub_808CD9C();
|
||||
extern void sub_8085764();
|
||||
extern void sub_80857B8();
|
||||
extern void sub_8097FF8();
|
||||
|
||||
extern void sub_8086BDC(u32,u8);
|
||||
extern void sub_8086F54(u32,u8);
|
||||
@@ -143,10 +143,7 @@ extern void sub_808C9C4(void);
|
||||
extern void sub_808CB5C(void);
|
||||
extern void sub_808CBB0(void);
|
||||
extern void sub_808CD44(void);
|
||||
extern void sub_8097FF8(void);
|
||||
|
||||
extern u8 sub_8098100(u8);
|
||||
extern void sub_8097FA8(void);
|
||||
extern void sub_807E5E4(u32);
|
||||
|
||||
void sub_8084854(u8 *param_1)
|
||||
@@ -168,7 +165,7 @@ void sub_8084854(u8 *param_1)
|
||||
{
|
||||
gDungeon->unk3A0D = param_1[1];
|
||||
if (param_1[2] != 0x40) {
|
||||
sub_8097FA8();
|
||||
sub_8097FA8(param_1[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -9,16 +9,15 @@
|
||||
#include "pokemon.h"
|
||||
#include "dungeon_util_1.h"
|
||||
#include "dungeon_util.h"
|
||||
#include "exclusive_pokemon.h"
|
||||
|
||||
extern void SetDefaultIQSkills(u8 *param_1, u8 param_2);
|
||||
extern void sub_8097FF8(void);
|
||||
extern u8 sub_8044B28(void);
|
||||
extern u8 HasRecruitedMon(u32);
|
||||
extern u8 gUnknown_202E038[];
|
||||
extern void sub_8085374();
|
||||
extern void sub_80855E4(void *);
|
||||
extern void sub_8068FE0(struct Entity *, u32, u32);
|
||||
extern void sub_8097FA8(u32);
|
||||
extern void DisplayDungeonDialogue(u8 *);
|
||||
extern void sub_806CDD4(struct Entity *, u32, u32);
|
||||
extern void sub_80869E4(struct Entity *, u32, u32, u32);
|
||||
|
||||
+2
-3
@@ -4,6 +4,7 @@
|
||||
#include "wonder_mail.h"
|
||||
#include "code_80958E8.h"
|
||||
#include "dungeon.h"
|
||||
#include "exclusive_pokemon.h"
|
||||
|
||||
struct MissionText
|
||||
{
|
||||
@@ -19,10 +20,8 @@ extern const char gMeetNinetalesText[];
|
||||
extern const char gAvoidCaptureText[];
|
||||
extern const u8 gUnknown_8109CC0[];
|
||||
extern const u8 gDummyScenarioText[];
|
||||
extern u8 sub_80A270C();
|
||||
extern u8 sub_80A270C(s16);
|
||||
|
||||
extern void sub_8097FA8(u32);
|
||||
extern void sub_8097FF8(void);
|
||||
extern u8 sub_80A2728(s16);
|
||||
extern bool8 sub_8001D08(u32, u32 ,s32);
|
||||
extern u32 sub_8001784(u32, u32, u16);
|
||||
|
||||
+266
-1
@@ -29,7 +29,6 @@ const u8 filler_ex1[8] =
|
||||
EWRAM_DATA_2 struct ExclusivePokemonData *gUnknown_203B498 = {0};
|
||||
EWRAM_DATA struct ExclusivePokemonData gExclusivePokemonInfo = {0};
|
||||
|
||||
|
||||
void LoadExclusivePokemon(void)
|
||||
{
|
||||
gUnknown_203B498 = &gExclusivePokemonInfo;
|
||||
@@ -49,3 +48,269 @@ void InitializeExclusivePokemon(void)
|
||||
gUnknown_203B498->Exclusives[counter] = gExclusivePokemon[counter].in_rrt;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8097FA8(u8 param_1)
|
||||
{
|
||||
gUnknown_203B498->unk48[param_1 >> 5] |= 1 << ((param_1 & 0x1f));
|
||||
}
|
||||
|
||||
void sub_8097FD0(u8 param_1)
|
||||
{
|
||||
gUnknown_203B498->unk3C[param_1 >> 5] |= 1 << ((param_1 & 0x1f));
|
||||
}
|
||||
|
||||
void sub_8097FF8(void)
|
||||
{
|
||||
s32 iVar1;
|
||||
s32 index;
|
||||
struct ExclusivePokemonData *ptr;
|
||||
|
||||
for(index = 0; index < 0x40; index++)
|
||||
{
|
||||
ptr = gUnknown_203B498;
|
||||
if (index < 0) {
|
||||
iVar1 = index + 0x1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
iVar1 = index;
|
||||
}
|
||||
if ((ptr->unk48[iVar1 >> 5] & (1 << (index - ((iVar1 >> 5) * 0x20)))) != 0) {
|
||||
ptr->unk3C[iVar1 >> 5] |= (1 << (index - ((iVar1 >> 5) * 0x20)));
|
||||
}
|
||||
}
|
||||
sub_8098080();
|
||||
}
|
||||
|
||||
void sub_8098044(u8 param_1)
|
||||
{
|
||||
gUnknown_203B498->unk3C[param_1 >> 5] &= ~(1 << (((param_1 & 0x1f))));
|
||||
gUnknown_203B498->unk48[param_1 >> 5] &= ~(1 << (((param_1 & 0x1f))));
|
||||
}
|
||||
|
||||
void sub_8098080(void)
|
||||
{
|
||||
s32 index;
|
||||
|
||||
for(index = 0; index < 0x3; index++)
|
||||
{
|
||||
gUnknown_203B498->unk48[index] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_80980A4(void)
|
||||
{
|
||||
u32 temp = gUnknown_203B498->unk0;
|
||||
gUnknown_203B498->unk0 = 1;
|
||||
return temp;
|
||||
}
|
||||
|
||||
void sub_80980B4(s16 pokeID)
|
||||
{
|
||||
s32 index;
|
||||
s32 pokeID_s32;
|
||||
s32 pokeID_s32_1;
|
||||
struct ExclusivePokemonData *ptr;
|
||||
|
||||
pokeID_s32 = pokeID;
|
||||
pokeID_s32_1 = pokeID_s32;
|
||||
if (pokeID_s32 != MONSTER_DECOY)
|
||||
{
|
||||
if(pokeID_s32 != MONSTER_STATUE)
|
||||
{
|
||||
if(pokeID_s32 != MONSTER_RAYQUAZA_CUTSCENE) {
|
||||
ptr = gUnknown_203B498;
|
||||
index = pokeID_s32;
|
||||
if (pokeID_s32 < 0) {
|
||||
index = pokeID_s32 + 0x1f;
|
||||
}
|
||||
ptr->unk4[index >> 5] |= 1 << (s16)((pokeID_s32_1 - (index >> 5) * 0x20));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool8 sub_8098100(u8 param_1)
|
||||
{
|
||||
u32 index = param_1;
|
||||
|
||||
if (index > 0x3f) {
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (gUnknown_203B498->unk3C[param_1 >> 0x5] & (1 << (index & 0x1f))) ? TRUE : FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
bool8 sub_8098134(s16 pokeID)
|
||||
{
|
||||
s32 index;
|
||||
s32 pokeID_s32;
|
||||
s32 pokeID_s32_1;
|
||||
struct ExclusivePokemonData *ptr;
|
||||
|
||||
pokeID_s32 = pokeID;
|
||||
pokeID_s32_1 = pokeID_s32;
|
||||
ptr = gUnknown_203B498;
|
||||
if (pokeID < 0) {
|
||||
index = pokeID_s32 + 0x1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = pokeID_s32;
|
||||
}
|
||||
return ((ptr->unk4[(index >> 5)] & (1 << (s16)(pokeID_s32_1 - ((index >> 5) * 0x20)))) != 0) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
void sub_8098170(s32 param_1)
|
||||
{
|
||||
s32 index;
|
||||
struct ExclusivePokemonData *ptr;
|
||||
|
||||
ptr = gUnknown_203B498;
|
||||
if (param_1 < 0) {
|
||||
index = param_1 + 0x1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = param_1;
|
||||
}
|
||||
ptr->unk54[(index >> 5)] |= 1 << (param_1 - ((index >> 5) * 0x20));
|
||||
}
|
||||
|
||||
bool32 sub_80981A0(s32 param_1)
|
||||
{
|
||||
s32 index;
|
||||
bool32 flag;
|
||||
struct ExclusivePokemonData *ptr;
|
||||
|
||||
if (param_1 > 0x1e) {
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
ptr = gUnknown_203B498;
|
||||
if (param_1 < 0) {
|
||||
index = param_1 + 0x1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = param_1;
|
||||
}
|
||||
flag = ptr->unk54[(index >> 5)] & 1 << (param_1 - ((index >> 5) * 0x20));
|
||||
if (flag != 0) {
|
||||
flag = TRUE;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
||||
bool8 IsExclusivePokemonUnlocked(s16 pokeID)
|
||||
{
|
||||
s32 index;
|
||||
s32 pokeID_s32;
|
||||
|
||||
pokeID_s32 = pokeID;
|
||||
|
||||
for(index = 0; index < NUM_EXCLUSIVE_POKEMON; index++)
|
||||
{
|
||||
if(gExclusivePokemon[index].poke_id == pokeID_s32)
|
||||
return gUnknown_203B498->Exclusives[index];
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void UnlockExclusivePokemon(s16 pokeID)
|
||||
{
|
||||
s32 index;
|
||||
s32 pokeID_s32;
|
||||
|
||||
pokeID_s32 = pokeID;
|
||||
|
||||
for(index = 0; index < NUM_EXCLUSIVE_POKEMON; index++)
|
||||
{
|
||||
if(gExclusivePokemon[index].poke_id == pokeID_s32)
|
||||
gUnknown_203B498->Exclusives[index] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void WriteExclusivePokemon(struct unkStruct_8094924 *r0)
|
||||
{
|
||||
s32 index;
|
||||
u8 *puVar2;
|
||||
|
||||
u8 stack_0;
|
||||
u8 stack_1;
|
||||
u8 stack_2;
|
||||
u8 neg_1;
|
||||
u8 zero;
|
||||
|
||||
neg_1 = -1;
|
||||
zero = 0;
|
||||
|
||||
|
||||
SaveIntegerBits(r0, gUnknown_203B498, 1);
|
||||
for(index = 0; index < 424; index++)
|
||||
{
|
||||
stack_0 = sub_8098134(index);
|
||||
SaveIntegerBits(r0, &stack_0, 1);
|
||||
}
|
||||
for(index = 0; index < 64; index++)
|
||||
{
|
||||
stack_1 = sub_8098100(index);
|
||||
SaveIntegerBits(r0, &stack_1, 1);
|
||||
}
|
||||
for(index = 0; index < 31; index++)
|
||||
{
|
||||
stack_2 = sub_80981A0(index);
|
||||
SaveIntegerBits(r0, &stack_2, 1);
|
||||
}
|
||||
for(index = 0; index < NUM_EXCLUSIVE_POKEMON; index++)
|
||||
{
|
||||
if(gUnknown_203B498->Exclusives[index])
|
||||
puVar2 = &neg_1;
|
||||
else
|
||||
puVar2 = &zero;
|
||||
SaveIntegerBits(r0, puVar2, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadExclusivePokemon(struct unkStruct_8094924 *r0)
|
||||
{
|
||||
s32 index;
|
||||
u8 stack_0;
|
||||
u8 stack_1;
|
||||
u8 stack_2;
|
||||
u8 stack_3;
|
||||
|
||||
memset(gUnknown_203B498, 0, sizeof(struct ExclusivePokemonData));
|
||||
RestoreIntegerBits(r0, gUnknown_203B498, 1);
|
||||
for(index = 0; index < 424; index++)
|
||||
{
|
||||
RestoreIntegerBits(r0, &stack_0, 1);
|
||||
if(stack_0)
|
||||
sub_80980B4(index);
|
||||
}
|
||||
for(index = 0; index < 64; index++)
|
||||
{
|
||||
RestoreIntegerBits(r0, &stack_1, 1);
|
||||
if(stack_1)
|
||||
sub_8097FA8(index);
|
||||
}
|
||||
for(index = 0; index < 31; index++)
|
||||
{
|
||||
RestoreIntegerBits(r0, &stack_2, 1);
|
||||
if(stack_2)
|
||||
sub_8098170(index);
|
||||
}
|
||||
for(index = 0; index < NUM_EXCLUSIVE_POKEMON; index++)
|
||||
{
|
||||
RestoreIntegerBits(r0, &stack_3, 1);
|
||||
|
||||
do; while(0); // do/while needed for matching - jiang
|
||||
|
||||
gUnknown_203B498->Exclusives[index] = 1 & stack_3;
|
||||
}
|
||||
sub_8097FF8();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
#include "global.h"
|
||||
#include "exclusive_pokemon.h"
|
||||
|
||||
extern struct ExclusivePokemonData *gUnknown_203B498;
|
||||
extern struct ExclusivePokemon gExclusivePokemon[NUM_EXCLUSIVE_POKEMON];
|
||||
|
||||
void sub_80980B4(s16);
|
||||
void sub_8097FA8(u8);
|
||||
void sub_8098170(s32);
|
||||
void sub_8097FF8(void);
|
||||
|
||||
u8 sub_8098100(u8);
|
||||
u8 sub_8098134(s16);
|
||||
u8 sub_80981A0(s32);
|
||||
|
||||
bool8 IsExclusivePokemonUnlocked(s16 pokeID)
|
||||
{
|
||||
s32 index;
|
||||
s32 pokeID_s32;
|
||||
|
||||
pokeID_s32 = pokeID;
|
||||
|
||||
for(index = 0; index < NUM_EXCLUSIVE_POKEMON; index++)
|
||||
{
|
||||
if(gExclusivePokemon[index].poke_id == pokeID_s32)
|
||||
return gUnknown_203B498->Exclusives[index];
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void UnlockExclusivePokemon(s16 pokeID)
|
||||
{
|
||||
s32 index;
|
||||
s32 pokeID_s32;
|
||||
|
||||
pokeID_s32 = pokeID;
|
||||
|
||||
for(index = 0; index < NUM_EXCLUSIVE_POKEMON; index++)
|
||||
{
|
||||
if(gExclusivePokemon[index].poke_id == pokeID_s32)
|
||||
gUnknown_203B498->Exclusives[index] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void WriteExclusivePokemon(struct unkStruct_8094924 *r0)
|
||||
{
|
||||
s32 index;
|
||||
u8 *puVar2;
|
||||
|
||||
u8 stack_0;
|
||||
u8 stack_1;
|
||||
u8 stack_2;
|
||||
u8 neg_1;
|
||||
u8 zero;
|
||||
|
||||
neg_1 = -1;
|
||||
zero = 0;
|
||||
|
||||
|
||||
SaveIntegerBits(r0, gUnknown_203B498, 1);
|
||||
for(index = 0; index < 424; index++)
|
||||
{
|
||||
stack_0 = sub_8098134(index);
|
||||
SaveIntegerBits(r0, &stack_0, 1);
|
||||
}
|
||||
for(index = 0; index < 64; index++)
|
||||
{
|
||||
stack_1 = sub_8098100(index);
|
||||
SaveIntegerBits(r0, &stack_1, 1);
|
||||
}
|
||||
for(index = 0; index < 31; index++)
|
||||
{
|
||||
stack_2 = sub_80981A0(index);
|
||||
SaveIntegerBits(r0, &stack_2, 1);
|
||||
}
|
||||
for(index = 0; index < NUM_EXCLUSIVE_POKEMON; index++)
|
||||
{
|
||||
if(gUnknown_203B498->Exclusives[index])
|
||||
puVar2 = &neg_1;
|
||||
else
|
||||
puVar2 = &zero;
|
||||
SaveIntegerBits(r0, puVar2, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void ReadExclusivePokemon(struct unkStruct_8094924 *r0)
|
||||
{
|
||||
s32 index;
|
||||
u8 stack_0;
|
||||
u8 stack_1;
|
||||
u8 stack_2;
|
||||
u8 stack_3;
|
||||
|
||||
memset(gUnknown_203B498, 0, sizeof(struct ExclusivePokemonData));
|
||||
RestoreIntegerBits(r0, gUnknown_203B498, 1);
|
||||
for(index = 0; index < 424; index++)
|
||||
{
|
||||
RestoreIntegerBits(r0, &stack_0, 1);
|
||||
if(stack_0)
|
||||
sub_80980B4(index);
|
||||
}
|
||||
for(index = 0; index < 64; index++)
|
||||
{
|
||||
RestoreIntegerBits(r0, &stack_1, 1);
|
||||
if(stack_1)
|
||||
sub_8097FA8(index);
|
||||
}
|
||||
for(index = 0; index < 31; index++)
|
||||
{
|
||||
RestoreIntegerBits(r0, &stack_2, 1);
|
||||
if(stack_2)
|
||||
sub_8098170(index);
|
||||
}
|
||||
for(index = 0; index < NUM_EXCLUSIVE_POKEMON; index++)
|
||||
{
|
||||
RestoreIntegerBits(r0, &stack_3, 1);
|
||||
|
||||
do; while(0); // do/while needed for matching - jiang
|
||||
|
||||
gUnknown_203B498->Exclusives[index] = 1 & stack_3;
|
||||
}
|
||||
sub_8097FF8();
|
||||
}
|
||||
Reference in New Issue
Block a user