Merge branch 'master' of https://github.com/pret/pokeemerald into decompile_party_menu

This commit is contained in:
golem galvanize 2018-12-17 02:40:30 -05:00
commit 076d07f6fe
51 changed files with 8874 additions and 19283 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3590,7 +3590,7 @@ _08079138:
cmp r0, 0
bne _08079158
adds r0, r4, 0
bl sub_806E3F8
bl IsSpeciesInHoennDex
cmp r0, 0
bne _08079164
_08079158:
@ -6160,7 +6160,7 @@ _0807A62E:
_0807A64C:
lsls r0, r1, 16
lsrs r0, 16
bl sub_806E3F8
bl IsSpeciesInHoennDex
cmp r0, 0
bne _0807A65C
movs r0, 0x2
@ -6200,7 +6200,7 @@ _0807A65C:
_0807A6A0:
lsls r0, r1, 16
lsrs r0, 16
bl sub_806E3F8
bl IsSpeciesInHoennDex
cmp r0, 0
beq _0807A6D2
_0807A6AC:
@ -6471,7 +6471,7 @@ _0807A87C:
b _0807A8C0
_0807A88E:
adds r0, r7, 0
bl sub_806E3F8
bl IsSpeciesInHoennDex
cmp r0, 0
bne _0807A89C
_0807A898:
@ -6479,7 +6479,7 @@ _0807A898:
b _0807A8C0
_0807A89C:
mov r0, r8
bl sub_806E3F8
bl IsSpeciesInHoennDex
cmp r0, 0
bne _0807A8AA
movs r0, 0x5
@ -6489,7 +6489,7 @@ _0807A8AA:
cmp r0, 0
bne _0807A8BE
adds r0, r7, 0
bl sub_806E3F8
bl IsSpeciesInHoennDex
cmp r0, 0
bne _0807A8BE
movs r0, 0x7
@ -6533,7 +6533,7 @@ sub_807A8D0: @ 807A8D0
b _0807A910
_0807A900:
adds r0, r6, 0
bl sub_806E3F8
bl IsSpeciesInHoennDex
cmp r0, 0
bne _0807A90E
_0807A90A:
@ -6645,7 +6645,7 @@ _0807A9B4:
mov r1, sp
adds r4, r1, r0
ldrh r0, [r4]
bl sub_806E3F8
bl IsSpeciesInHoennDex
cmp r0, 0
bne _0807A9E0
movs r0, 0x2

View File

@ -0,0 +1,3 @@
gUnknown_030062DC
gUnknown_030062E0
gUnknown_030062E4

View File

@ -1,157 +0,0 @@
#include "constants/battle_anim.h"
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnknown_085E5088:: @ 85E5088
.byte 0x0a, 0x02, 0xfd, 0x00, 0x0f, 0x00, 0xfc, 0x00
.byte 0xf6, 0x02, 0xfc, 0x00
.align 2
gUnknown_085E5094:: @ 85E5094
obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6ec
obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6ed
obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6ee
obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6ef
obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6f0
obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6f1
obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6f2
obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6f3
obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6f4
obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6f5
obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6f6
obj_tiles gBattleAnimSpriteSheet_Particles, 0x0100, 0xd6f7
.align 2
gUnknown_085E50F4:: @ 85E50F4
obj_pal gBattleAnimSpritePalette_136, 0xd6ec
obj_pal gBattleAnimSpritePalette_136, 0xd6ed
obj_pal gBattleAnimSpritePalette_136, 0xd6ee
obj_pal gBattleAnimSpritePalette_136, 0xd6ef
obj_pal gBattleAnimSpritePalette_136, 0xd6f0
obj_pal gBattleAnimSpritePalette_136, 0xd6f1
obj_pal gBattleAnimSpritePalette_136, 0xd6f2
obj_pal gBattleAnimSpritePalette_136, 0xd6f3
obj_pal gBattleAnimSpritePalette_136, 0xd6f4
obj_pal gBattleAnimSpritePalette_136, 0xd6f5
obj_pal gBattleAnimSpritePalette_136, 0xd6f6
obj_pal gBattleAnimSpritePalette_136, 0xd6f7
.align 2
gUnknown_085E5154:: @ 85E5154
.2byte 0x0000, 0x0001, 0x0001, 0x0001
.2byte 0x0002, 0x0001, 0x0000, 0x0041
.2byte 0x0002, 0x0001, 0x0001, 0x0001
.2byte 0xfffe, 0x0000
.align 2
gUnknown_085E5170:: @ 85E5170
.2byte 0x0003, 0x0001, 0xffff, 0x0000
.align 2
gUnknown_085E5178:: @ 85E5178
.2byte 0x0004, 0x0001, 0xffff, 0x0000
.align 2
gUnknown_085E5180:: @ 85E5180
.2byte 0x0005, 0x0001, 0xffff, 0x0000
.align 2
gUnknown_085E5188:: @ 85E5188
.2byte 0x0006, 0x0004, 0x0007, 0x0004
.2byte 0xfffe, 0x0000
.align 2
gUnknown_085E5194:: @ 85E5194
.2byte 0x0007, 0x0004, 0xffff, 0x0000
.align 2
gUnknown_085E519C:: @ 85E519C
.4byte gUnknown_085E5154
.4byte gUnknown_085E5170
.4byte gUnknown_085E5178
.4byte gUnknown_085E5180
.4byte gUnknown_085E5188
.4byte gUnknown_085E5194
.align 2
gUnknown_085E51B4:: @ 85E51B4
.byte 0x00, 0x00, 0x00, 0x05, 0x01, 0x02, 0x02, 0x03
.byte 0x05, 0x05, 0x04, 0x04
.align 2
gUnknown_085E51C0:: @ 85E51C0
.4byte sub_8171E50
.4byte sub_81723D4
.4byte sub_81721CC
.4byte sub_81722CC
.4byte sub_81726BC
.4byte sub_81721CC
.4byte sub_81720C8
.4byte sub_81722CC
.4byte sub_8172560
.4byte sub_8171FC4
.4byte sub_81723D4
.4byte sub_81727E8
.align 2
gUnknown_085E51F0:: @ 85E51F0
spr_template 0xd6ec, 0xd6ec, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
spr_template 0xd6ed, 0xd6ed, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
spr_template 0xd6ee, 0xd6ee, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
spr_template 0xd6ef, 0xd6ef, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
gUnknown_085E5250:: @ 85E5250
spr_template 0xd6f0, 0xd6f0, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
spr_template 0xd6f1, 0xd6f1, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
spr_template 0xd6f2, 0xd6f2, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
spr_template 0xd6f3, 0xd6f3, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
spr_template 0xd6f4, 0xd6f4, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
spr_template 0xd6f5, 0xd6f5, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
spr_template 0xd6f6, 0xd6f6, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
spr_template 0xd6f7, 0xd6f7, gUnknown_08524904, gUnknown_085E519C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
gUnknown_085E5310:: @ 85E5310
.2byte 0x7adf, 0x7af0, 0x53d7, 0x3fff, 0x7297, 0x67f5, 0x7b2c, 0x2b7e
.2byte 0x431f, 0x7bdd, 0x2a3f, 0x293f, 0x0000, 0x0201, 0x0403, 0x0101
.2byte 0x0100, 0x0503, 0x0506, 0x0004
.align 2
gBattleAnimSpriteTemplate_85E5338:: @ 85E5338
spr_template ANIM_TAG_UNUSED_RED_BRICK, ANIM_TAG_UNUSED_RED_BRICK, gUnknown_0852490C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_817330C
.align 2
gUnknown_085E5350:: @ 8535350
.2byte 0x0040, 0x0001, 0xffff, 0x0000
.align 2
gUnknown_085E5358:: @ 8535358
.4byte gUnknown_085E5350
.align 2
spr_template ANIM_TAG_ROCKS, ANIM_TAG_ROCKS, gUnknown_08524914, gUnknown_085E5358, NULL, gDummySpriteAffineAnimTable, sub_817330C

View File

@ -1,106 +0,0 @@
@ the third big chunk of data
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnknown_085A989C:: @ 85A989C
.incbin "graphics/picture_frame/bg.gbapal"
.align 2
gUnknown_085A9A9C:: @ 85A9A9C
.incbin "graphics/picture_frame/frame0.4bpp.rl"
.align 2
gUnknown_085AAB20:: @ 85AAB20
.incbin "graphics/picture_frame/frame1.4bpp.rl"
.align 2
gUnknown_085AB750:: @ 85AB750
.incbin "graphics/picture_frame/frame2.4bpp.rl"
.align 2
gUnknown_085AC288:: @ 85AC288
.incbin "graphics/picture_frame/frame3.4bpp.rl"
.align 2
gUnknown_085AD240:: @ 85AD240
.incbin "graphics/picture_frame/frame4.4bpp.rl"
.align 2
gUnknown_085AE370:: @ 85AE370
.incbin "graphics/picture_frame/frame5.4bpp.rl"
.align 2
gUnknown_085AE974:: @ 85AE974
.incbin "graphics/picture_frame/frame0_map.bin.rl"
.align 2
gUnknown_085AEE80:: @ 85AEE80
.incbin "graphics/picture_frame/frame1_map.bin.rl"
.align 2
gUnknown_085AF38C:: @ 85AF38C
.incbin "graphics/picture_frame/frame2_map.bin.rl"
.align 2
gUnknown_085AF898:: @ 85AF898
.incbin "graphics/picture_frame/frame3_map.bin.rl"
.align 2
gUnknown_085AFDA4:: @ 85AFDA4
.incbin "graphics/picture_frame/frame4_map.bin.rl"
.align 2
gUnknown_085B02B0:: @ 85B02B0
.incbin "graphics/picture_frame/frame5_map.bin.rl"
.align 2
gUnknown_085B07C0:: @ 85B07C0
.4byte gContestCoolness
.4byte gContestBeauty
.4byte gContestCuteness
.4byte gContestSmartness
.4byte gContestToughness
.align 2
gContestRankTextPointers:: @ 85B07D4
.4byte gContestRankNormal
.4byte gContestRankSuper
.4byte gContestRankHyper
.4byte gContestRankMaster
.4byte gContestLink
.align 2
gUnknown_085B07E8:: @ 85B07E8
.4byte 0x000010a5
.align 2
gUnknown_085B07EC:: @ 85B07EC
window_template 0x01, 0x02, 0x0e, 0x1a, 0x04, 0x0f, 0x0001
.align 2
gContestPaintingDescriptionPointers:: @ 85B07F4
.4byte gContestPaintingCool1
.4byte gContestPaintingCool2
.4byte gContestPaintingCool3
.4byte gContestPaintingBeauty1
.4byte gContestPaintingBeauty2
.4byte gContestPaintingBeauty3
.4byte gContestPaintingCute1
.4byte gContestPaintingCute2
.4byte gContestPaintingCute3
.4byte gContestPaintingSmart1
.4byte gContestPaintingSmart2
.4byte gContestPaintingSmart3
.4byte gContestPaintingTough1
.4byte gContestPaintingTough2
.4byte gContestPaintingTough3
gUnknown_085B0830:: @ 85B0830
.4byte 0xc0003000, 0x00000000
gUnknown_085B0838:: @ 85B0838
.2byte 0x0000, 0x0000

View File

@ -4651,35 +4651,35 @@ gOtherText_DontYouAgree:: @ 8294301
.string "\n"
.string "Don't you agree?$"
gUnknown_08294313:: @ 8294313
gMauvilleManText_ISoWantToGoOnAVacation:: @ 8294313
.string "I so want to go on a vacation.\n"
.string "Would you happen to know a nice place?$"
gUnknown_08294359:: @ 8294359
gMauvilleManText_IBoughtCrayonsWith120Colors:: @ 8294359
.string "I bought crayons with 120 colors!\n"
.string "Don't you think that's nice?$"
gUnknown_08294398:: @ 8294398
gMauvilleManText_WouldntItBeNiceIfWeCouldFloat:: @ 8294398
.string "Wouldn't it be nice if we could float\n"
.string "away on a cloud of bubbles?$"
gUnknown_082943DA:: @ 82943DA
gMauvilleManText_WhenYouWriteOnASandyBeach:: @ 82943DA
.string "When you write on a sandy beach,\n"
.string "they wash away. It makes me sad.$"
gUnknown_0829441C:: @ 829441C
gMauvilleManText_WhatsTheBottomOfTheSeaLike:: @ 829441C
.string "What's the bottom of the sea like?\n"
.string "Just once I would so love to go!$"
gUnknown_08294460:: @ 8294460
gMauvilleManText_WhenYouSeeTheSettingSunDoesIt:: @ 8294460
.string "When you see the setting sun, does it\n"
.string "make you want to go home?$"
gUnknown_082944A0:: @ 82944A0
gMauvilleManText_LyingBackInTheGreenGrass:: @ 82944A0
.string "Lying back in the green grass\n"
.string "Oh, it's so, so nice!$"
gUnknown_082944D5:: @ 82944D5
gMauvilleManText_SecretBasesAreSoWonderful:: @ 82944D5
.string "SECRET BASES are so wonderful!\n"
.string "Can't you feel the excitement?$"

View File

@ -599,8 +599,7 @@ struct BattleAnimationInfo
u8 field_9_x80:1;
u8 field_A;
u8 field_B;
u8 field_C;
u8 field_D;
s16 field_C;
u8 field_E;
u8 field_F;
};

View File

@ -131,6 +131,13 @@ void sub_80A805C(struct Task *task, u8 a2, s16 a3, s16 a4, s16 a5, s16 a6, u16 a
u8 sub_80A80C8(struct Task *task);
void sub_80A8EE4(struct Sprite *);
void sub_80A67F4(struct Sprite *);
void sub_80A6D48(u32 bgId, const void *src);
void sub_80A7160(struct Sprite *sprite);
bool8 sub_80A70E8(struct Sprite *sprite);
void sub_80A70C0(struct Sprite *sprite);
void TranslateMonBGUntil(struct Sprite *sprite);
void TranslateSpriteOverDuration(struct Sprite *sprite);
void sub_80A77C8(struct Sprite *sprite);
enum
{
@ -168,8 +175,8 @@ void LaunchStatusAnimation(u8 battlerId, u8 statusAnimId);
// battle_anim_8170478.s
u8 ItemIdToBallId(u16 itemId);
u8 LaunchBallStarsTask(u8 x, u8 y, u8 kindOfStars, u8 arg3, u8 ballId);
u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 arg2, u8 ballId);
u8 AnimateBallOpenParticles(u8 x, u8 y, u8 priority, u8 subpriority, u8 ballId);
u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 selectedPalettes, u8 ballId);
// battle_anim_utility_funcs.s
void sub_8116EB4(u8);
@ -223,4 +230,7 @@ extern const struct OamData gUnknown_0852493C;
extern const struct OamData gUnknown_08524A5C;
extern const struct OamData gUnknown_08524A74;
extern const struct CompressedSpriteSheet gBattleAnimPicTable[];
extern const struct CompressedSpritePalette gBattleAnimPaletteTable[];
#endif // GUARD_BATTLE_ANIM_H

View File

@ -1,6 +1,8 @@
#ifndef GUARD_BATTLE_INTERFACE_H
#define GUARD_BATTLE_INTERFACE_H
#include "battle_controllers.h"
enum
{
HP_CURRENT,

View File

@ -9,7 +9,7 @@ struct RSBattleTowerRecord
/*0x04*/ u8 name[PLAYER_NAME_LENGTH + 1];
/*0x0C*/ u8 trainerId[4];
/*0x10*/ u16 greeting[6];
/*0x1C*/ struct UnknownPokemonStruct party[3];
/*0x1C*/ struct BattleTowerPokemon party[3];
/*0xA0*/ u32 checksum;
};

View File

@ -231,6 +231,7 @@ extern u8 gContestPlayerMonIndex;
extern s16 gUnknown_02039F08[4];
extern s16 gContestMonConditions[4];
extern u8 gIsLinkContest;
extern struct ContestWinner gUnknown_02039F3C;
struct Shared18000
{

View File

@ -1,7 +1,16 @@
#ifndef GUARD_CONTESTPAINTING_H
#define GUARD_CONTESTPAINTING_H
void sub_812FDA8(u32);
void sub_812FDEC(void);
enum
{
CONTESTRESULT_COOL = 9,
CONTESTRESULT_BEAUTY = 13,
CONTESTRESULT_CUTE = 2,
CONTESTRESULT_SMART = 36,
CONTESTRESULT_TOUGH = 6,
};
void sub_812FDA8(int);
void CB2_ContestPainting(void);
#endif

View File

@ -0,0 +1,28 @@
#ifndef GUARD_CONTEST_PAINTING_EFFECTS_H
#define GUARD_CONTEST_PAINTING_EFFECTS_H
struct Unk030061A0
{
u8 var_0;
u8 pad1[3];
u16 (*var_4)[][32];
u16 *var_8;
u8 pad0C[4];
u32 var_10;
u16 var_14;
u16 var_16;
u8 var_18;
u8 var_19;
u8 var_1A;
u8 var_1B;
u8 var_1C;
u8 var_1D;
u8 var_1E;
u8 var_1F;
};
void sub_8124F2C(struct Unk030061A0 *);
void sub_81261A4(struct Unk030061A0 *);
void sub_8126058(struct Unk030061A0 *);
#endif

View File

@ -405,14 +405,14 @@ extern const u8 gText_SoDesirable[];
extern const u8 gText_SoExciting[];
extern const u8 gText_SoAmusing[];
extern const u8 gText_SoMagical[];
extern const u8 gUnknown_08294313[];
extern const u8 gUnknown_08294359[];
extern const u8 gUnknown_08294398[];
extern const u8 gUnknown_082943DA[];
extern const u8 gUnknown_0829441C[];
extern const u8 gUnknown_08294460[];
extern const u8 gUnknown_082944A0[];
extern const u8 gUnknown_082944D5[];
extern const u8 gMauvilleManText_ISoWantToGoOnAVacation[];
extern const u8 gMauvilleManText_IBoughtCrayonsWith120Colors[];
extern const u8 gMauvilleManText_WouldntItBeNiceIfWeCouldFloat[];
extern const u8 gMauvilleManText_WhenYouWriteOnASandyBeach[];
extern const u8 gMauvilleManText_WhatsTheBottomOfTheSeaLike[];
extern const u8 gMauvilleManText_WhenYouSeeTheSettingSunDoesIt[];
extern const u8 gMauvilleManText_LyingBackInTheGreenGrass[];
extern const u8 gMauvilleManText_SecretBasesAreSoWonderful[];
extern const u8 MauvilleCity_PokemonCenter_1F_Text_28E930[];

View File

@ -61,6 +61,12 @@
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) >= (b) ? (a) : (b))
// Extracts the upper 16 bits of a 32-bit number
#define HIHALF(n) (((n) & 0xFFFF0000) >> 16)
// Extracts the lower 16 bits of a 32-bit number
#define LOHALF(n) ((n) & 0xFFFF)
// There are many quirks in the source code which have overarching behavioral differences from
// a number of other files. For example, diploma.c seems to declare rodata before each use while
// other files declare out of order and must be at the beginning. There are also a number of
@ -230,7 +236,7 @@ struct Time
struct Pokedex
{
/*0x00*/ u8 order;
/*0x01*/ u8 unknown1;
/*0x01*/ u8 mode;
/*0x02*/ u8 nationalMagic; // must equal 0xDA in order to have National mode
/*0x03*/ u8 unknown2;
/*0x04*/ u32 unownPersonality; // set when you first see Unown
@ -301,7 +307,7 @@ struct Apprentice
u32 checksum;
};
struct UnknownPokemonStruct
struct BattleTowerPokemon
{
u16 species;
u16 heldItem;
@ -338,7 +344,7 @@ struct EmeraldBattleTowerRecord
/*0x10*/ u16 greeting[6];
/*0x1C*/ u16 speechWon[6];
/*0x28*/ u16 speechLost[6];
/*0x34*/ struct UnknownPokemonStruct party[4];
/*0x34*/ struct BattleTowerPokemon party[4];
/*0xE4*/ u8 language;
/*0xE8*/ u32 checksum;
};
@ -353,7 +359,7 @@ struct BattleTowerEReaderTrainer
/*0x10*/ u16 greeting[6];
/*0x1C*/ u16 farewellPlayerLost[6];
/*0x28*/ u16 farewellPlayerWon[6];
/*0x34*/ struct UnknownPokemonStruct party[3];
/*0x34*/ struct BattleTowerPokemon party[3];
/*0xB8*/ u32 checksum;
};

View File

@ -4238,6 +4238,7 @@ extern const u32 gBattleAnimSpriteSheet_132[];
extern const u32 gBattleAnimSpriteSheet_133[];
extern const u32 gBattleAnimSpriteSheet_134[];
extern const u32 gBattleAnimSpriteSheet_135[];
extern const u32 gBattleAnimSpriteSheet_Particles[];
extern const u32 gBattleAnimSpriteSheet_136[];
extern const u32 gBattleAnimSpriteSheet_137[];
extern const u32 gBattleAnimSpriteSheet_138[];
@ -4753,4 +4754,9 @@ extern const u32 gCableCarDoor_Gfx[];
extern const u32 gCableCarCord_Gfx[];
extern const u16 gCableCar_Pal[];
// Battle Anim
extern const u32 gUnknown_08C2DDA4[];
extern const u32 gUnknown_08C2EA50[];
extern const u32 gUnknown_08C2EA9C[];
#endif //GUARD_GRAPHICS_H

View File

@ -32,10 +32,10 @@ extern struct BagStruct gUnknown_0203CE58;
struct UnkBagStruct
{
void (*unk0)(void);
u8 unk4[0x800];
u8 unk804[12];
u8 unk810[7];
void (*mainCallback2)(void);
u8 tilemapBuffer[0x800];
u8 spriteId[12];
u8 windowPointers[7];
u8 unk817;
u8 unk818;
u8 unk819;
@ -43,7 +43,7 @@ struct UnkBagStruct
u8 unk81B:4;
u8 unk81B_1:2;
u8 unk81B_3:1;
u8 unk81B_2:1;
u8 hideCloseBagText:1;
u8 filler3[2];
u8 unk81E;
u8 unk81F;
@ -52,11 +52,11 @@ struct UnkBagStruct
u8 unk825;
u8 filler[2];
u8 unk828;
u8 unk829[POCKETS_COUNT];
u8 unk82E[6];
u8 numItemStacks[POCKETS_COUNT];
u8 numShownItems[6];
s16 unk834;
u8 filler4[0xE];
u8 unk844[32][32];
u8 pocketNameBuffer[32][32];
u8 filler2[4];
};
@ -71,9 +71,10 @@ void sub_81AAC14(void);
void sub_81AAC50(void);
void sub_81AAC70(void);
void sub_81AAC28(void);
void SetInitialScrollAndCursorPositions(u8 pocketId);
void bag_menu_mail_related(void);
void CB2_BagMenuFromStartMenu(void);
u8 sub_81ABB2C(u8 pocketId);
u8 GetItemListPosition(u8 pocketId);
bool8 UseRegisteredKeyItemOnField(void);
void CB2_GoToSellMenu(void);
void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)());

View File

@ -4,6 +4,15 @@
extern u8 gUnknown_030060B0;
extern void (*gUnknown_030060B4)(void);
#define HOENN_DEX_COUNT 202
#define NATIONAL_DEX_COUNT 386
enum
{
DEX_MODE_HOENN,
DEX_MODE_NATIONAL
};
enum
{
FLAG_GET_SEEN,
@ -31,6 +40,6 @@ u16 GetNationalPokedexCount(u8);
u16 GetHoennPokedexCount(u8);
u8 CreateDexDisplayMonDataTask(u16 dexNum, u32 trainerId, u32 personality);
s8 GetSetPokedexFlag(u16 nationalNum, u8 caseId);
u16 sub_80C0E9C(u16, s16, s16, u16);
u16 CreateMonSpriteFromNationalDexNumber(u16, s16, s16, u16);
#endif // GUARD_POKEDEX_H

View File

@ -460,11 +460,11 @@ void CreateMaleMon(struct Pokemon *mon, u16 species, u8 level);
void CreateMonWithIVsPersonality(struct Pokemon *mon, u16 species, u8 level, u32 ivs, u32 personality);
void CreateMonWithIVsOTID(struct Pokemon *mon, u16 species, u8 level, u8 *ivs, u32 otId);
void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 evSpread);
void sub_806819C(struct Pokemon *mon, struct UnknownPokemonStruct *src);
void sub_8068338(struct Pokemon *mon, struct UnknownPokemonStruct *src, bool8 lvl50);
void sub_806819C(struct Pokemon *mon, struct BattleTowerPokemon *src);
void sub_8068338(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50);
void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 monId);
void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level, u8 nature, u8 fixedIV, u8 evSpread, u32 otId);
void sub_80686FC(struct Pokemon *mon, struct UnknownPokemonStruct *dest);
void sub_80686FC(struct Pokemon *mon, struct BattleTowerPokemon *dest);
void CreateObedientMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId);
bool8 sub_80688F8(u8 caseId, u8 battlerId);
void SetDeoxysStats(void);
@ -566,7 +566,7 @@ u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves);
u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves);
u8 GetNumberOfRelearnableMoves(struct Pokemon *mon);
u16 SpeciesToPokedexNum(u16 species);
bool32 sub_806E3F8(u16 species);
bool32 IsSpeciesInHoennDex(u16 species);
void ClearBattleMonForms(void);
u16 GetBattleBGM(void);
void PlayBattleBGM(void);

View File

@ -1289,6 +1289,7 @@ extern const u8 gText_SpaceAndSpace[];
extern const u8 gText_CommaSpace[];
extern const u8 gText_NewLine[];
extern const u8 gText_ScrollTextUp[];
extern const u8 gText_Space[];
extern const u8 gText_Space2[];
extern const u8 gText_Are[];
extern const u8 gText_Are2[];

View File

@ -157,7 +157,7 @@ SECTIONS {
src/safari_zone.o(.text);
asm/contest_link_80FC4F4.o(.text);
src/item_use.o(.text);
asm/battle_anim_effects_1.o(.text);
src/battle_anim_effects_1.o(.text);
asm/battle_anim_effects_2.o(.text);
asm/water.o(.text);
src/fire.o(.text);
@ -186,11 +186,10 @@ SECTIONS {
src/dewford_trend.o(.text);
src/heal_location.o(.text);
src/region_map.o(.text);
asm/cute_sketch.o(.text);
asm/contest_painting_effects.o(.text);
src/decoration.o(.text);
src/slot_machine.o(.text);
src/contest_painting.o(.text);
asm/contest_painting.o(.text);
src/battle_ai_script_commands.o(.text);
src/trader.o(.text);
src/starter_choose.o(.text);
@ -238,7 +237,7 @@ SECTIONS {
src/intro.o(.text);
src/reset_save_heap.o(.text);
src/field_region_map.o(.text);
asm/battle_anim_8170478.o(.text);
src/battle_anim_8170478.o(.text);
src/hall_of_fame.o(.text);
src/credits.o(.text);
src/lottery_corner.o(.text);
@ -485,7 +484,7 @@ SECTIONS {
src/field_special_scene.o(.rodata);
src/rotating_gate.o(.rodata);
src/item_use.o(.rodata);
src/effects_1.o(.rodata);
src/battle_anim_effects_1.o(.rodata);
src/effects_2.o(.rodata);
src/water.o(.rodata);
src/fire.o(.rodata);
@ -512,11 +511,11 @@ SECTIONS {
src/menu_helpers.o(.rodata);
src/heal_location.o(.rodata);
src/region_map.o(.rodata);
data/cute_sketch.o(.rodata);
data/contest_painting_effects.o(.rodata);
src/decoration.o(.rodata);
src/slot_machine.o(.rodata);
data/slot_machine.o(.rodata);
data/contest_painting.o(.rodata);
src/contest_painting.o(.rodata);
src/battle_ai_script_commands.o(.rodata);
src/trader.o(.rodata);
src/starter_choose.o(.rodata);
@ -550,7 +549,7 @@ SECTIONS {
src/player_pc.o(.rodata);
src/intro.o(.rodata);
src/field_region_map.o(.rodata);
data/battle_anim_8170478.o(.rodata);
src/battle_anim_8170478.o(.rodata);
src/hall_of_fame.o(.rodata);
src/credits.o(.rodata);
src/lottery_corner.o(.rodata);

View File

@ -26,8 +26,6 @@ extern struct MusicPlayerInfo gMPlayInfo_SE2;
extern const u16 gMovesWithQuietBGM[];
extern const u8 *const gBattleAnims_Moves[];
extern const struct CompressedSpriteSheet gBattleAnimPicTable[];
extern const struct CompressedSpritePalette gBattleAnimPaletteTable[];
extern const struct BattleAnimBackground gBattleAnimBackgroundTable[];
// this file's functions

View File

@ -35,7 +35,6 @@ extern const union AffineAnimCmd *gUnknown_082FF6C0[];
// This file's functions.
void sub_80A64EC(struct Sprite *sprite);
void sub_80A653C(struct Sprite *sprite);
void sub_80A6FB4(struct Sprite *sprite);
void sub_80A7144(struct Sprite *sprite);
void sub_80A791C(struct Sprite *sprite);
@ -539,7 +538,7 @@ void WaitAnimForDuration(struct Sprite *sprite)
void sub_80A64D0(struct Sprite *sprite)
{
sub_80A64EC(sprite);
sprite->callback = sub_80A653C;
sprite->callback = TranslateSpriteOverDuration;
sprite->callback(sprite);
}
@ -557,7 +556,7 @@ void sub_80A64EC(struct Sprite *sprite)
sprite->data[1] = old;
}
void sub_80A653C(struct Sprite *sprite)
void TranslateSpriteOverDuration(struct Sprite *sprite)
{
if (sprite->data[0] > 0)
{
@ -613,7 +612,7 @@ void sub_80A65EC(struct Sprite *sprite)
sprite->callback = sub_80A64D0;
}
void sub_80A6630(struct Sprite *sprite)
void TranslateMonBGUntil(struct Sprite *sprite)
{
if (sprite->data[0] > 0)
{
@ -627,7 +626,7 @@ void sub_80A6630(struct Sprite *sprite)
}
}
// Same as sub_80A6630, but it operates on sub-pixel values
// Same as TranslateMonBGUntil, but it operates on sub-pixel values
// to handle slower translations.
void sub_80A6680(struct Sprite *sprite)
{

View File

@ -441,14 +441,14 @@ static void DoHorizontalLunge(struct Sprite *sprite)
sprite->data[3] = gBattlerSpriteIds[gBattleAnimAttacker];
sprite->data[4] = gBattleAnimArgs[0];
StoreSpriteCallbackInData6(sprite, ReverseHorizontalLungeDirection);
sprite->callback = sub_80A6630;
sprite->callback = TranslateMonBGUntil;
}
static void ReverseHorizontalLungeDirection(struct Sprite *sprite)
{
sprite->data[0] = sprite->data[4];
sprite->data[1] = -sprite->data[1];
sprite->callback = sub_80A6630;
sprite->callback = TranslateMonBGUntil;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
@ -468,14 +468,14 @@ static void DoVerticalDip(struct Sprite *sprite)
sprite->data[3] = spriteId;
sprite->data[4] = gBattleAnimArgs[0];
StoreSpriteCallbackInData6(sprite, ReverseVerticalDipDirection);
sprite->callback = sub_80A6630;
sprite->callback = TranslateMonBGUntil;
}
static void ReverseVerticalDipDirection(struct Sprite *sprite)
{
sprite->data[0] = sprite->data[4];
sprite->data[2] = -sprite->data[2];
sprite->callback = sub_80A6630;
sprite->callback = TranslateMonBGUntil;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}

2267
src/battle_anim_8170478.c Executable file

File diff suppressed because it is too large Load Diff

5520
src/battle_anim_effects_1.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -250,12 +250,7 @@ static void BattleIntroSlide2(u8 taskId)
if (gTasks[taskId].data[1] == 4)
{
u16 *bg1Y = &gBattle_BG1_Y;
int cos = Cos2(gTasks[taskId].data[6]);
if (cos < 0)
cos += 0x1FF;
*bg1Y = (cos >> 9) - 8;
gBattle_BG1_Y = Cos2(gTasks[taskId].data[6]) / 512 - 8;
if (gTasks[taskId].data[6] < 180)
gTasks[taskId].data[6] += 4;
else

View File

@ -3245,7 +3245,7 @@ static void FillPartnerParty(u16 trainerId)
for (i = 0; i < 2; i++)
{
struct EmeraldBattleTowerRecord *record = &gSaveBlock2Ptr->frontier.towerRecords[trainerId];
struct UnknownPokemonStruct monData = record->party[gSaveBlock2Ptr->frontier.field_CB4[18 + i]];
struct BattleTowerPokemon monData = record->party[gSaveBlock2Ptr->frontier.field_CB4[18 + i]];
StringCopy(trainerName, record->name);
if (record->language == LANGUAGE_JAPANESE)
{

View File

@ -66,20 +66,20 @@ const u8 *GetPokedexRatingText(u16 count)
return gBirchDexRatingText_LessThan200;
if (count == 200)
{
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1)
|| GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // Jirachi or Deoxys is not counted towards the dex completion. If either of these flags are enabled, it means the actual count is less than 200.
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), FLAG_GET_CAUGHT)
|| GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), FLAG_GET_CAUGHT)) // Jirachi or Deoxys is not counted towards the dex completion. If either of these flags are enabled, it means the actual count is less than 200.
return gBirchDexRatingText_LessThan200;
return gBirchDexRatingText_DexCompleted;
}
if (count == 201)
if (count == HOENN_DEX_COUNT - 1)
{
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1)
&& GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // If both of these flags are enabled, it means the actual count is less than 200.
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), FLAG_GET_CAUGHT)
&& GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), FLAG_GET_CAUGHT)) // If both of these flags are enabled, it means the actual count is less than 200.
return gBirchDexRatingText_LessThan200;
return gBirchDexRatingText_DexCompleted;
}
if (count == 202)
return gBirchDexRatingText_DexCompleted; // Hoenn dex is considered complete, even though the hoenn dex count is 210.
if (count == HOENN_DEX_COUNT)
return gBirchDexRatingText_DexCompleted;
return gBirchDexRatingText_LessThan10;
}

View File

@ -1,8 +1,709 @@
#include "global.h"
#include "alloc.h"
#include "battle.h"
#include "bg.h"
#include "contest.h"
#include "contest_painting.h"
#include "contest_painting_effects.h"
#include "battle_gfx_sfx_util.h"
#include "decompress.h"
#include "gpu_regs.h"
#include "international_string_util.h"
#include "main.h"
#include "lilycove_lady.h"
#include "palette.h"
#include "random.h"
#include "scanline_effect.h"
#include "string_util.h"
#include "strings.h"
#include "text.h"
#include "window.h"
#include "constants/rgb.h"
extern u8 gUnknown_02039F5C;
extern u8 gUnknown_02039F5D;
extern u16 (*gUnknown_03006190)[][32];
extern struct ContestWinner *gUnknown_030061C0;
extern u16 *gContestPaintingMonPalette;
extern struct Unk030061A0 gUnknown_030061A0;
// IWRAM bss
IWRAM_DATA u8 gUnknown_030011F0;
IWRAM_DATA u16 gUnknown_030011F2;
IWRAM_DATA u16 gUnknown_030011F4;
IWRAM_DATA u8 gUnknown_030011F6;
IWRAM_DATA u8 gUnknown_030011F7;
IWRAM_DATA u8 gContestPaintingState;
IWRAM_DATA u16 gContestPaintingMosaicVal;
IWRAM_DATA u16 gContestPaintingFadeCounter;
IWRAM_DATA bool8 gUnknown_030011F6;
IWRAM_DATA u8 gContestPaintingWindowId;
static void ShowContestPainting(void);
static void HoldContestPainting(void);
static void InitContestPaintingWindow(void);
static void InitContestPaintingBg(void);
static void InitContestPaintingVars(bool8);
static void sub_8130884(u8, u8);
static void PrintContestPaintingCaption(u8, u8);
static void VBlankCB_ContestPainting(void);
static void sub_8130380(u8 *spritePixels, u16 *palette, u16 (*destColorBuffer)[64][64]);
extern const u8 gUnknown_0827EA0C[];
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
extern const struct CompressedSpriteSheet gMonBackPicTable[];
extern const u8 gContestCoolness[];
extern const u8 gContestBeauty[];
extern const u8 gContestCuteness[];
extern const u8 gContestSmartness[];
extern const u8 gContestToughness[];
extern const u8 gContestRankNormal[];
extern const u8 gContestRankSuper[];
extern const u8 gContestRankHyper[];
extern const u8 gContestRankMaster[];
extern const u8 gContestLink[];
extern const u8 gContestPaintingCool1[];
extern const u8 gContestPaintingCool2[];
extern const u8 gContestPaintingCool3[];
extern const u8 gContestPaintingBeauty1[];
extern const u8 gContestPaintingBeauty2[];
extern const u8 gContestPaintingBeauty3[];
extern const u8 gContestPaintingCute1[];
extern const u8 gContestPaintingCute2[];
extern const u8 gContestPaintingCute3[];
extern const u8 gContestPaintingSmart1[];
extern const u8 gContestPaintingSmart2[];
extern const u8 gContestPaintingSmart3[];
extern const u8 gContestPaintingTough1[];
extern const u8 gContestPaintingTough2[];
extern const u8 gContestPaintingTough3[];
const u16 gPictureFramePalettes[] = INCBIN_U16("graphics/picture_frame/bg.gbapal");
const u8 gPictureFrameTiles_0[] = INCBIN_U8("graphics/picture_frame/frame0.4bpp.rl");
const u8 gPictureFrameTiles_1[] = INCBIN_U8("graphics/picture_frame/frame1.4bpp.rl");
const u8 gPictureFrameTiles_2[] = INCBIN_U8("graphics/picture_frame/frame2.4bpp.rl");
const u8 gPictureFrameTiles_3[] = INCBIN_U8("graphics/picture_frame/frame3.4bpp.rl");
const u8 gPictureFrameTiles_4[] = INCBIN_U8("graphics/picture_frame/frame4.4bpp.rl");
const u8 gPictureFrameTiles_5[] = INCBIN_U8("graphics/picture_frame/frame5.4bpp.rl");
const u8 gPictureFrameTilemap_0[] = INCBIN_U8("graphics/picture_frame/frame0_map.bin.rl");
const u8 gPictureFrameTilemap_1[] = INCBIN_U8("graphics/picture_frame/frame1_map.bin.rl");
const u8 gPictureFrameTilemap_2[] = INCBIN_U8("graphics/picture_frame/frame2_map.bin.rl");
const u8 gPictureFrameTilemap_3[] = INCBIN_U8("graphics/picture_frame/frame3_map.bin.rl");
const u8 gPictureFrameTilemap_4[] = INCBIN_U8("graphics/picture_frame/frame4_map.bin.rl");
const u8 gPictureFrameTilemap_5[] = INCBIN_U8("graphics/picture_frame/frame5_map.bin.rl");
const u8 *const gUnknown_085B07C0[] =
{
gContestCoolness,
gContestBeauty,
gContestCuteness,
gContestSmartness,
gContestToughness,
};
const u8 *const gContestRankTextPointers[] =
{
gContestRankNormal,
gContestRankSuper,
gContestRankHyper,
gContestRankMaster,
gContestLink,
};
const struct BgTemplate gUnknown_085B07E8[] =
{
{
.bg = 1,
.charBaseIndex = 1,
.mapBaseIndex = 10,
.screenSize = 0,
.paletteMode = 0,
.priority = 1,
.baseTile = 0,
},
};
const struct WindowTemplate gUnknown_085B07EC =
{
.bg = 1,
.tilemapLeft = 2,
.tilemapTop = 14,
.width = 26,
.height = 4,
.paletteNum = 15,
.baseBlock = 1,
};
const u8 *const gContestPaintingDescriptionPointers[] =
{
gContestPaintingCool1,
gContestPaintingCool2,
gContestPaintingCool3,
gContestPaintingBeauty1,
gContestPaintingBeauty2,
gContestPaintingBeauty3,
gContestPaintingCute1,
gContestPaintingCute2,
gContestPaintingCute3,
gContestPaintingSmart1,
gContestPaintingSmart2,
gContestPaintingSmart3,
gContestPaintingTough1,
gContestPaintingTough2,
gContestPaintingTough3,
};
const struct OamData gUnknown_085B0830 =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = 1,
.bpp = ST_OAM_8BPP,
.shape = ST_OAM_SQUARE,
.x = 0,
.matrixNum = 0,
.size = 3,
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
const u16 gUnknown_085B0838[] = {RGB(0, 0, 0), RGB(0, 0, 0)};
void sub_812FDA8(int contestWinner)
{
// probably fakematching
u8 *ptr1 = &gUnknown_02039F5D;
u8 *ptr2 = &gUnknown_02039F5C;
gUnknown_02039F3C = gSaveBlock1Ptr->contestWinners[contestWinner - 1];
*ptr1 = contestWinner - 1;
*ptr2 = 0;
}
void CB2_ContestPainting(void)
{
ShowContestPainting();
}
static void CB2_HoldContestPainting(void)
{
HoldContestPainting();
RunTextPrinters();
UpdatePaletteFade();
}
static void CB2_QuitContestPainting(void)
{
SetMainCallback2(gMain.savedCallback);
FREE_AND_SET_NULL(gContestPaintingMonPalette);
FREE_AND_SET_NULL(gUnknown_03006190);
RemoveWindow(gContestPaintingWindowId);
Free(GetBgTilemapBuffer(1));
FreeMonSpritesGfx();
}
static void ShowContestPainting(void)
{
switch (gMain.state)
{
case 0:
ScanlineEffect_Stop();
SetVBlankCallback(NULL);
AllocateMonSpritesGfx();
gUnknown_030061C0 = &gUnknown_02039F3C;
InitContestPaintingVars(1);
InitContestPaintingBg();
gMain.state++;
break;
case 1:
ResetPaletteFade();
DmaFillLarge32(3, 0, (void *)BG_VRAM, 0x18000, 0x1000);
ResetSpriteData();
gMain.state++;
break;
case 2:
SeedRng(gMain.vblankCounter1);
InitKeys();
InitContestPaintingWindow();
gMain.state++;
break;
case 3:
sub_8130884(gUnknown_02039F5D, gUnknown_02039F5C);
gMain.state++;
break;
case 4:
PrintContestPaintingCaption(gUnknown_02039F5D, gUnknown_02039F5C);
LoadPalette(gUnknown_085B0838, 0, 1 * 2);
DmaClear32(3, PLTT, PLTT_SIZE);
BeginFastPaletteFade(2);
SetVBlankCallback(VBlankCB_ContestPainting);
gContestPaintingState = 0;
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_ON);
SetMainCallback2(CB2_HoldContestPainting);
break;
}
}
static void HoldContestPainting(void)
{
switch (gContestPaintingState)
{
case 0:
if (!gPaletteFade.active)
gContestPaintingState = 1;
if (gUnknown_030011F6 && gContestPaintingFadeCounter)
gContestPaintingFadeCounter--;
break;
case 1:
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))
{
u8 two = 2; //needed to make the asm match
gContestPaintingState = two;
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));
}
if (gUnknown_030011F6)
gContestPaintingFadeCounter = 0;
break;
case 2:
if (!gPaletteFade.active)
SetMainCallback2(CB2_QuitContestPainting);
if (gUnknown_030011F6 && gContestPaintingFadeCounter < 30)
gContestPaintingFadeCounter++;
break;
}
}
static void InitContestPaintingWindow(void)
{
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gUnknown_085B07E8, ARRAY_COUNT(gUnknown_085B07E8));
ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0);
SetBgTilemapBuffer(1, AllocZeroed(BG_SCREEN_SIZE));
gContestPaintingWindowId = AddWindow(&gUnknown_085B07EC);
DeactivateAllTextPrinters();
FillWindowPixelBuffer(gContestPaintingWindowId, 0);
PutWindowTilemap(gContestPaintingWindowId);
CopyWindowToVram(gContestPaintingWindowId, 3);
ShowBg(1);
}
static void PrintContestPaintingCaption(u8 contestType, u8 arg1)
{
int x;
u8 category;
if (arg1 == TRUE)
return;
category = gUnknown_030061C0->contestCategory;
if (contestType < 8)
{
sub_818E868(gStringVar1, category);
StringAppend(gStringVar1, gText_Space);
StringAppend(gStringVar1, gContestRankTextPointers[gUnknown_030061C0->contestRank]);
StringCopy(gStringVar2, gUnknown_030061C0->trainerName);
sub_81DB5AC(gStringVar2);
StringCopy(gStringVar3, gUnknown_030061C0->monName);
StringExpandPlaceholders(gStringVar4, gUnknown_0827EA0C);
}
else
{
StringCopy(gStringVar1, gUnknown_030061C0->monName);
StringExpandPlaceholders(gStringVar4, gContestPaintingDescriptionPointers[category]);
}
x = GetStringCenterAlignXOffset(1, gStringVar4, 208);
AddTextPrinterParameterized(gContestPaintingWindowId, 1, gStringVar4, x, 1, 0, 0);
CopyBgTilemapBufferToVram(1);
}
static void InitContestPaintingBg(void)
{
SetGpuReg(REG_OFFSET_DISPCNT, 0);
REG_IE |= INTR_FLAG_VBLANK;
SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(2) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(12) | BGCNT_MOSAIC | BGCNT_16COLOR | BGCNT_TXT256x256);
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1) | BGCNT_CHARBASE(1) | BGCNT_SCREENBASE(10) | BGCNT_MOSAIC | BGCNT_16COLOR | BGCNT_TXT256x256);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
}
static void InitContestPaintingVars(bool8 arg0)
{
if (arg0 == FALSE)
{
gUnknown_030011F6 = FALSE;
gContestPaintingMosaicVal = 0;
gContestPaintingFadeCounter = 0;
}
else
{
gUnknown_030011F6 = TRUE;
gContestPaintingMosaicVal = 15;
gContestPaintingFadeCounter = 30;
}
}
static void UpdateContestPaintingMosaicEffect(void)
{
if (!gUnknown_030011F6)
{
SetGpuReg(REG_OFFSET_MOSAIC, 0);
}
else
{
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1) | BGCNT_CHARBASE(1) | BGCNT_SCREENBASE(10) | BGCNT_MOSAIC | BGCNT_16COLOR | BGCNT_TXT256x256);
gContestPaintingMosaicVal = gContestPaintingFadeCounter / 2;
SetGpuReg(REG_OFFSET_MOSAIC, (gContestPaintingMosaicVal << 12) | (gContestPaintingMosaicVal << 8) | (gContestPaintingMosaicVal << 4) | (gContestPaintingMosaicVal << 0));
}
}
static void VBlankCB_ContestPainting(void)
{
UpdateContestPaintingMosaicEffect();
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
void sub_81302E8(u16 species, u8 arg1)
{
const void *pal = GetFrontSpritePalFromSpeciesAndPersonality(species, gUnknown_030061C0->trainerId, gUnknown_030061C0->personality);
LZDecompressVram(pal, gContestPaintingMonPalette);
if (!arg1)
{
HandleLoadSpecialPokePic_DontHandleDeoxys(
&gMonFrontPicTable[species],
gMonSpritesGfxPtr->sprites[1],
species,
gUnknown_030061C0->personality);
sub_8130380(gMonSpritesGfxPtr->sprites[1], gContestPaintingMonPalette, (void *)gUnknown_03006190);
}
else
{
HandleLoadSpecialPokePic_DontHandleDeoxys(
&gMonBackPicTable[species],
gMonSpritesGfxPtr->sprites[0],
species,
gUnknown_030061C0->personality);
sub_8130380(gMonSpritesGfxPtr->sprites[0], gContestPaintingMonPalette, (void *)gUnknown_03006190);
}
}
#ifdef NONMATCHING
// functionally equivalent.
static void sub_8130380(u8 *spritePixels, u16 *palette, u16 (*destColorBuffer)[64][64])
{
u16 tileY, tileX, pixelY, pixelX;
u8 colorIndex;
for (tileY = 0; tileY < 8; tileY++)
{
for (tileX = 0; tileX < 8; tileX++)
{
for (pixelY = 0; pixelY < 8; pixelY++)
{
for (pixelX = 0; pixelX < 8; pixelX++)
{
int offset = 32 * (8 * tileY + tileX) + (pixelY * 4 + pixelX / 2);
colorIndex = spritePixels[offset];
if (pixelX & 1)
colorIndex >>= 4;
else
colorIndex &= 0xF;
if (colorIndex == 0) // transparent pixel
(*destColorBuffer)[8 * tileY + pixelY][tileX * 8 + pixelX] = 0x8000;
else
(*destColorBuffer)[8 * tileY + pixelY][tileX * 8 + pixelX] = palette[colorIndex];
}
}
}
}
}
#else
NAKED
static void sub_8130380(u8 *spritePixels, u16 *palette, u16 (*destColorBuffer)[64][64])
{
asm_unified("\n\
push {r4-r7,lr}\n\
mov r7, r10\n\
mov r6, r9\n\
mov r5, r8\n\
push {r5-r7}\n\
sub sp, 0xC\n\
mov r10, r0\n\
mov r9, r1\n\
str r2, [sp]\n\
movs r0, 0\n\
_08130394:\n\
movs r3, 0\n\
adds r1, r0, 0x1\n\
str r1, [sp, 0x4]\n\
lsls r0, 3\n\
str r0, [sp, 0x8]\n\
_0813039E:\n\
movs r1, 0\n\
adds r2, r3, 0x1\n\
mov r8, r2\n\
ldr r7, [sp, 0x8]\n\
adds r0, r7, r3\n\
lsls r0, 5\n\
mov r12, r0\n\
lsls r4, r3, 3\n\
_081303AE:\n\
movs r3, 0\n\
lsls r0, r1, 2\n\
adds r6, r1, 0x1\n\
mov r2, r12\n\
adds r5, r2, r0\n\
ldr r7, [sp, 0x8]\n\
adds r0, r7, r1\n\
lsls r0, 7\n\
ldr r1, [sp]\n\
adds r2, r0, r1\n\
_081303C2:\n\
lsrs r0, r3, 1\n\
adds r0, r5, r0\n\
add r0, r10\n\
ldrb r1, [r0]\n\
movs r0, 0x1\n\
ands r0, r3\n\
cmp r0, 0\n\
beq _081303D6\n\
lsrs r1, 4\n\
b _081303DA\n\
_081303D6:\n\
movs r0, 0xF\n\
ands r1, r0\n\
_081303DA:\n\
cmp r1, 0\n\
bne _081303EC\n\
adds r0, r4, r3\n\
lsls r0, 1\n\
adds r0, r2\n\
movs r7, 0x80\n\
lsls r7, 8\n\
adds r1, r7, 0\n\
b _081303F8\n\
_081303EC:\n\
adds r0, r4, r3\n\
lsls r0, 1\n\
adds r0, r2\n\
lsls r1, 1\n\
add r1, r9\n\
ldrh r1, [r1]\n\
_081303F8:\n\
strh r1, [r0]\n\
adds r0, r3, 0x1\n\
lsls r0, 16\n\
lsrs r3, r0, 16\n\
cmp r3, 0x7\n\
bls _081303C2\n\
lsls r0, r6, 16\n\
lsrs r1, r0, 16\n\
cmp r1, 0x7\n\
bls _081303AE\n\
mov r1, r8\n\
lsls r0, r1, 16\n\
lsrs r3, r0, 16\n\
cmp r3, 0x7\n\
bls _0813039E\n\
ldr r2, [sp, 0x4]\n\
lsls r0, r2, 16\n\
lsrs r0, 16\n\
cmp r0, 0x7\n\
bls _08130394\n\
add sp, 0xC\n\
pop {r3-r5}\n\
mov r8, r3\n\
mov r9, r4\n\
mov r10, r5\n\
pop {r4-r7}\n\
pop {r0}\n\
bx r0");
}
#endif
static void sub_8130430(u8 arg0, u8 arg1)
{
u8 x, y;
LoadPalette(gPictureFramePalettes, 0, 0x100);
if (arg1 == 1)
{
switch (gUnknown_030061C0->contestCategory / 3)
{
case CONTEST_CATEGORY_COOL:
RLUnCompVram(gPictureFrameTiles_0, (void *)VRAM);
RLUnCompWram(gPictureFrameTilemap_0, gUnknown_03006190);
break;
case CONTEST_CATEGORY_BEAUTY:
RLUnCompVram(gPictureFrameTiles_1, (void *)VRAM);
RLUnCompWram(gPictureFrameTilemap_1, gUnknown_03006190);
break;
case CONTEST_CATEGORY_CUTE:
RLUnCompVram(gPictureFrameTiles_2, (void *)VRAM);
RLUnCompWram(gPictureFrameTilemap_2, gUnknown_03006190);
break;
case CONTEST_CATEGORY_SMART:
RLUnCompVram(gPictureFrameTiles_3, (void *)VRAM);
RLUnCompWram(gPictureFrameTilemap_3, gUnknown_03006190);
break;
case CONTEST_CATEGORY_TOUGH:
RLUnCompVram(gPictureFrameTiles_4, (void *)VRAM);
RLUnCompWram(gPictureFrameTilemap_4, gUnknown_03006190);
break;
}
#define VRAM_PICTURE_DATA(x, y) (((u16 *)(VRAM + 0x6000))[(y) * 32 + (x)])
// Set the background
for (y = 0; y < 20; y++)
{
for (x = 0; x < 32; x++)
VRAM_PICTURE_DATA(x, y) = 0x1015;
}
// Copy the image frame
for (y = 0; y < 10; y++)
{
for (x = 0; x < 18; x++)
VRAM_PICTURE_DATA(x + 6, y + 2) = (*gUnknown_03006190)[y + 2][x + 6];
}
// Re-set the entire top row to the first top frame part
for (x = 0; x < 16; x++)
VRAM_PICTURE_DATA(x + 7, 2) = (*gUnknown_03006190)[2][7];
#undef VRAM_PICTURE_DATA
}
else if (arg0 < 8)
{
RLUnCompVram(gPictureFrameTiles_5, (void *)VRAM);
RLUnCompVram(gPictureFrameTilemap_5, (void *)(VRAM + 0x6000));
}
else
{
switch (gUnknown_030061C0->contestCategory / 3)
{
case CONTEST_CATEGORY_COOL:
RLUnCompVram(gPictureFrameTiles_0, (void *)VRAM);
RLUnCompVram(gPictureFrameTilemap_0, (void *)(VRAM + 0x6000));
break;
case CONTEST_CATEGORY_BEAUTY:
RLUnCompVram(gPictureFrameTiles_1, (void *)VRAM);
RLUnCompVram(gPictureFrameTilemap_1, (void *)(VRAM + 0x6000));
break;
case CONTEST_CATEGORY_CUTE:
RLUnCompVram(gPictureFrameTiles_2, (void *)VRAM);
RLUnCompVram(gPictureFrameTilemap_2, (void *)(VRAM + 0x6000));
break;
case CONTEST_CATEGORY_SMART:
RLUnCompVram(gPictureFrameTiles_3, (void *)VRAM);
RLUnCompVram(gPictureFrameTilemap_3, (void *)(VRAM + 0x6000));
break;
case CONTEST_CATEGORY_TOUGH:
RLUnCompVram(gPictureFrameTiles_4, (void *)VRAM);
RLUnCompVram(gPictureFrameTilemap_4, (void *)(VRAM + 0x6000));
break;
}
}
}
static void sub_8130688(u8 arg0)
{
//Some hacks just to get the asm to match
#ifndef NONMATCHING
asm(""::"r"(arg0));
#endif
gMain.oamBuffer[0] = gUnknown_085B0830;
gMain.oamBuffer[0].tileNum = 0;
#ifndef NONMATCHING
if (arg0) arg0 = gMain.oamBuffer[0].tileNum;
#endif
gMain.oamBuffer[0].x = 88;
gMain.oamBuffer[0].y = 24;
}
static u8 sub_81306CC(u8 arg0)
{
u8 contestCategory;
if (arg0 < 8)
contestCategory = gUnknown_030061C0->contestCategory;
else
contestCategory = gUnknown_030061C0->contestCategory / 3;
switch (contestCategory)
{
case CONTEST_CATEGORY_COOL:
return CONTESTRESULT_COOL;
case CONTEST_CATEGORY_BEAUTY:
return CONTESTRESULT_BEAUTY;
case CONTEST_CATEGORY_CUTE:
return CONTESTRESULT_CUTE;
case CONTEST_CATEGORY_SMART:
return CONTESTRESULT_SMART;
case CONTEST_CATEGORY_TOUGH:
return CONTESTRESULT_TOUGH;
}
return contestCategory;
}
static void sub_8130738(void)
{
gContestPaintingMonPalette = AllocZeroed(0x200);
gUnknown_03006190 = AllocZeroed(0x2000);
}
static void sub_8130760(u8 contestResult)
{
gUnknown_030061A0.var_4 = gUnknown_03006190;
gUnknown_030061A0.var_8 = gContestPaintingMonPalette;
gUnknown_030061A0.var_18 = 0;
gUnknown_030061A0.var_1F = gUnknown_030061C0->personality % 256;
gUnknown_030061A0.var_19 = 0;
gUnknown_030061A0.var_1A = 0;
gUnknown_030061A0.var_1B = 64;
gUnknown_030061A0.var_1C = 64;
gUnknown_030061A0.var_1D = 64;
gUnknown_030061A0.var_1E = 64;
switch (contestResult)
{
case CONTESTRESULT_SMART:
case CONTESTRESULT_TOUGH:
gUnknown_030061A0.var_14 = 3;
break;
case CONTESTRESULT_COOL:
case CONTESTRESULT_BEAUTY:
case CONTESTRESULT_CUTE:
default:
gUnknown_030061A0.var_14 = 1;
break;
}
gUnknown_030061A0.var_16 = 2;
gUnknown_030061A0.var_0 = contestResult;
gUnknown_030061A0.var_10 = 0x6010000;
sub_8124F2C(&gUnknown_030061A0);
sub_81261A4(&gUnknown_030061A0);
sub_8126058(&gUnknown_030061A0);
LoadPalette(gContestPaintingMonPalette, 0x100, 0x200);
}
static void sub_8130884(u8 arg0, u8 arg1)
{
sub_8130738();
sub_81302E8(gUnknown_030061C0->species, 0);
sub_8130760(sub_81306CC(arg0));
sub_8130688(arg0);
sub_8130430(arg0, arg1);
}

View File

@ -135,7 +135,7 @@ struct Unk201C000
u16 unk90;
u16 unk92;
u16 unk94;
u16 unk96[386];
u16 unk96[NATIONAL_DEX_COUNT];
u16 unk39A;
u16 unk39C[7];
};
@ -2254,12 +2254,12 @@ static void sub_8177050(struct Sprite *sprite)
}
}
static u8 sub_8177224(u16 species, s16 x, s16 y, u16 position)
static u8 sub_8177224(u16 nationalDexNum, s16 x, s16 y, u16 position)
{
u8 spriteId;
u8 spriteId2;
spriteId = sub_80C0E9C(species, x, y, position);
spriteId = CreateMonSpriteFromNationalDexNumber(nationalDexNum, x, y, position);
gSprites[spriteId].oam.priority = 1;
gSprites[spriteId].data[1] = position + 1;
gSprites[spriteId].invisible = TRUE;
@ -2297,16 +2297,16 @@ static void sub_8177388(void)
u16 dexNum;
u16 j;
for (dexNum = 1, j = 0; dexNum < 386; dexNum++)
for (dexNum = 1, j = 0; dexNum < NATIONAL_DEX_COUNT; dexNum++)
{
if (GetSetPokedexFlag(dexNum, 1))
if (GetSetPokedexFlag(dexNum, FLAG_GET_CAUGHT))
{
gUnknown_0203BCE8->unk96[j] = dexNum;
j++;
}
}
for (dexNum = j; dexNum < 386; dexNum++)
for (dexNum = j; dexNum < NATIONAL_DEX_COUNT; dexNum++)
gUnknown_0203BCE8->unk96[dexNum] = 0;
gUnknown_0203BCE8->unk39A = j;

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
#include "global.h"
#include "event_data.h"
#include "pokedex.h"
#define TEMP_FLAGS_SIZE 0x4
#define TEMP_UPPER_FLAGS_SIZE 0x8
@ -67,7 +68,7 @@ void EnableNationalPokedex(void)
gSaveBlock2Ptr->pokedex.nationalMagic = 0xDA;
*nationalDexVar = 0x302;
FlagSet(FLAG_SYS_NATIONAL_DEX);
gSaveBlock2Ptr->pokedex.unknown1 = 1;
gSaveBlock2Ptr->pokedex.mode = DEX_MODE_NATIONAL;
gSaveBlock2Ptr->pokedex.order = 0;
sub_80BB358();
}

View File

@ -726,7 +726,7 @@ static void AnimFireCross(struct Sprite *sprite)
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
sprite->callback = sub_80A653C; //TranslateSpriteOverDuration
sprite->callback = TranslateSpriteOverDuration;
}
static void sub_81093A4(struct Sprite *sprite)

View File

@ -543,7 +543,7 @@ bool8 RemoveBagItem(u16 itemId, u16 count)
VarSet(VAR_0x40ED, itemId);
}
var = sub_81ABB2C(pocket);
var = GetItemListPosition(pocket);
if (itemPocket->capacity > var
&& itemPocket->itemSlots[var].itemId == itemId)
{

View File

@ -57,7 +57,7 @@ bool8 load_bag_menu_graphics(void);
void setup_bag_menu_textboxes(void);
void allocate_bag_item_list_buffers(void);
void load_bag_item_list_buffers(u8);
void bag_menu_print_pocket_names(u8*, u8*);
void bag_menu_print_pocket_names(const u8*, const u8*);
void bag_menu_copy_pocket_name_to_window(u32);
void bag_menu_draw_pocket_indicator_square(u8, u8);
void bag_menu_add_pocket_scroll_arrow_indicators_maybe(void);
@ -69,7 +69,6 @@ void Task_BagMenu(u8);
void get_name(s8*, u16);
u16 ItemIdToBattleMoveId(u16);
u16 BagGetItemIdByPocketPosition(u8, u16);
void AddBagItemIconSprite(u16, u8);
void bag_menu_print_description_box_text(int);
void bag_menu_print_cursor(u8, u8);
void bag_menu_print(u8, u8, const u8*, u8, u8, u8, u8, u8, u8);
@ -121,7 +120,7 @@ void bag_menu_leave_maybe_3(void);
void bag_menu_leave_maybe_2(void);
void bag_menu_leave_maybe(void);
void sub_81ABA6C(void);
void sub_81ABAC4(void);
static void SetPocketListPositions(void);
void sub_81ABAE0(void);
u8 sub_81AB1F0(u8);
void sub_81AC23C(u8);
@ -151,7 +150,7 @@ void sub_81AD6FC(u8 taskId);
// .rodata
const struct BgTemplate gUnknown_08613F90[3] =
static const struct BgTemplate sBgTemplates_ItemMenu[3] =
{
{
.bg = 0,
@ -182,7 +181,7 @@ const struct BgTemplate gUnknown_08613F90[3] =
},
};
const struct ListMenuTemplate gUnknown_08613F9C =
static const struct ListMenuTemplate sItemListMenu =
{
.items = NULL,
.moveCursorFunc = bag_menu_change_item_callback,
@ -258,7 +257,8 @@ const struct ScrollArrowsTemplate gUnknown_08614094 = {SCROLL_ARROW_LEFT, 0x1C,
const u8 gUnknown_086140A4[] = INCBIN_U8("graphics/interface/select_button.4bpp");
const u8 gUnknown_08614164[][3] = {
static const u8 sFontColorTable[][3] = {
// bgColor, textColor, shadowColor
{0, 1, 3},
{0, 1, 4},
{0, 3, 6},
@ -268,7 +268,7 @@ const u8 gUnknown_08614164[][3] = {
const struct WindowTemplate gUnknown_08614174[] =
{
{
{ // Item names
.bg = 0,
.tilemapLeft = 14,
.tilemapTop = 2,
@ -277,7 +277,7 @@ const struct WindowTemplate gUnknown_08614174[] =
.paletteNum = 1,
.baseBlock = 0x27,
},
{
{ // Description
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 13,
@ -286,7 +286,7 @@ const struct WindowTemplate gUnknown_08614174[] =
.paletteNum = 1,
.baseBlock = 0x117,
},
{
{ // Pocket name
.bg = 0,
.tilemapLeft = 4,
.tilemapTop = 1,
@ -295,7 +295,7 @@ const struct WindowTemplate gUnknown_08614174[] =
.paletteNum = 1,
.baseBlock = 0x1A1,
},
{
{ // TM/HM info icons
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 13,
@ -304,7 +304,7 @@ const struct WindowTemplate gUnknown_08614174[] =
.paletteNum = 12,
.baseBlock = 0x16B,
},
{
{// TM/HM info
.bg = 0,
.tilemapLeft = 7,
.tilemapTop = 13,
@ -313,7 +313,7 @@ const struct WindowTemplate gUnknown_08614174[] =
.paletteNum = 12,
.baseBlock = 0x189,
},
{
{ // Field message box
.bg = 1,
.tilemapLeft = 2,
.tilemapTop = 15,
@ -440,16 +440,14 @@ struct TempWallyStruct {
EWRAM_DATA struct UnkBagStruct *gUnknown_0203CE54 = 0;
EWRAM_DATA struct BagStruct gUnknown_0203CE58 = {0};
EWRAM_DATA struct ListBuffer1 *gUnknown_0203CE74 = 0;
EWRAM_DATA struct ListBuffer2 *gUnknown_0203CE78 = 0;
static EWRAM_DATA struct ListBuffer1 *sListBuffer1 = 0;
static EWRAM_DATA struct ListBuffer2 *sListBuffer2 = 0;
EWRAM_DATA u16 gSpecialVar_ItemId = 0;
EWRAM_DATA struct TempWallyStruct *gUnknown_0203CE80 = 0;
static EWRAM_DATA struct TempWallyStruct *gUnknown_0203CE80 = 0;
extern u8 *gPocketNamesStringsTable[];
extern struct ListMenuTemplate gUnknown_08613F9C;
extern u8 *const gPocketNamesStringsTable[];
extern const u8 gMoveNames[][0xD];
extern u8* gReturnToXStringsTable[];
extern u32 gUnknown_0203CE5E[];
extern const u8 EventScript_2736B3[];
extern const u16 gUnknown_0860F074[];
@ -531,12 +529,12 @@ void GoToBagMenu(u8 bagMenuType, u8 pocketId, void ( *postExitMenuMainCallback2)
temp = gUnknown_0203CE58.location - (POCKETS_COUNT - 1);
if (temp <= 1)
gUnknown_0203CE54->unk81B = 1;
gUnknown_0203CE54->unk0 = 0;
gUnknown_0203CE54->mainCallback2 = 0;
gUnknown_0203CE54->unk81A = 0xFF;
gUnknown_0203CE54->unk81E = -1;
gUnknown_0203CE54->unk81F = -1;
memset(gUnknown_0203CE54->unk804, 0xFF, sizeof(gUnknown_0203CE54->unk804));
memset(gUnknown_0203CE54->unk810, 0xFF, 10);
memset(gUnknown_0203CE54->spriteId, 0xFF, sizeof(gUnknown_0203CE54->spriteId));
memset(gUnknown_0203CE54->windowPointers, 0xFF, 10);
SetMainCallback2(CB2_Bag);
}
}
@ -615,7 +613,7 @@ bool8 setup_bag_menu(void)
break;
case 10:
sub_81ABA6C();
sub_81ABAC4();
SetPocketListPositions();
sub_81ABAE0();
gMain.state++;
break;
@ -677,10 +675,10 @@ bool8 setup_bag_menu(void)
void bag_menu_init_bgs(void)
{
ResetVramOamAndBgCntRegs();
memset(gUnknown_0203CE54->unk4, 0, 0x800);
memset(gUnknown_0203CE54->tilemapBuffer, 0, 0x800);
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gUnknown_08613F90, 3);
SetBgTilemapBuffer(2, gUnknown_0203CE54->unk4);
InitBgsFromTemplates(0, sBgTemplates_ItemMenu, 3);
SetBgTilemapBuffer(2, gUnknown_0203CE54->tilemapBuffer);
ResetAllBgsCoordinates();
schedule_bg_copy_tilemap_to_vram(2);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
@ -702,7 +700,7 @@ bool8 load_bag_menu_graphics(void)
case 1:
if (free_temp_tile_data_buffers_if_possible() != TRUE)
{
LZDecompressWram(gUnknown_08D9A88C, gUnknown_0203CE54->unk4);
LZDecompressWram(gUnknown_08D9A88C, gUnknown_0203CE54->tilemapBuffer);
gUnknown_0203CE54->unk834++;
}
break;
@ -744,8 +742,8 @@ u8 sub_81AB1F0(u8 a)
void allocate_bag_item_list_buffers(void)
{
gUnknown_0203CE74 = Alloc(sizeof(struct ListBuffer1));
gUnknown_0203CE78 = Alloc(sizeof(struct ListBuffer2));
sListBuffer1 = Alloc(sizeof(struct ListBuffer1));
sListBuffer2 = Alloc(sizeof(struct ListBuffer2));
}
void load_bag_item_list_buffers(u8 pocketId)
@ -754,34 +752,34 @@ void load_bag_item_list_buffers(u8 pocketId)
struct BagPocket *pocket = &gBagPockets[pocketId];
struct ListMenuItem *subBuffer;
if (!gUnknown_0203CE54->unk81B_2)
if (!gUnknown_0203CE54->hideCloseBagText)
{
for (i = 0; i < gUnknown_0203CE54->unk829[pocketId] - 1; i++)
for (i = 0; i < gUnknown_0203CE54->numItemStacks[pocketId] - 1; i++)
{
get_name(gUnknown_0203CE78->name[i], pocket->itemSlots[i].itemId);
subBuffer = gUnknown_0203CE74->subBuffers;
subBuffer[i].name = gUnknown_0203CE78->name[i];
get_name(sListBuffer2->name[i], pocket->itemSlots[i].itemId);
subBuffer = sListBuffer1->subBuffers;
subBuffer[i].name = sListBuffer2->name[i];
subBuffer[i].id = i;
}
StringCopy(gUnknown_0203CE78->name[i], gText_CloseBag);
subBuffer = gUnknown_0203CE74->subBuffers;
subBuffer[i].name = gUnknown_0203CE78->name[i];
StringCopy(sListBuffer2->name[i], gText_CloseBag);
subBuffer = sListBuffer1->subBuffers;
subBuffer[i].name = sListBuffer2->name[i];
subBuffer[i].id = -2;
}
else
{
for (i = 0; i < gUnknown_0203CE54->unk829[pocketId]; i++)
for (i = 0; i < gUnknown_0203CE54->numItemStacks[pocketId]; i++)
{
get_name(gUnknown_0203CE78->name[i], pocket->itemSlots[i].itemId);
subBuffer = gUnknown_0203CE74->subBuffers;
subBuffer[i].name = gUnknown_0203CE78->name[i];
get_name(sListBuffer2->name[i], pocket->itemSlots[i].itemId);
subBuffer = sListBuffer1->subBuffers;
subBuffer[i].name = sListBuffer2->name[i];
subBuffer[i].id = i;
}
}
gMultiuseListMenuTemplate = gUnknown_08613F9C;
gMultiuseListMenuTemplate.totalItems = gUnknown_0203CE54->unk829[pocketId];
gMultiuseListMenuTemplate.items = gUnknown_0203CE74->subBuffers;
gMultiuseListMenuTemplate.maxShowed = gUnknown_0203CE54->unk82E[pocketId];
gMultiuseListMenuTemplate = sItemListMenu;
gMultiuseListMenuTemplate.totalItems = gUnknown_0203CE54->numItemStacks[pocketId];
gMultiuseListMenuTemplate.items = sListBuffer1->subBuffers;
gMultiuseListMenuTemplate.maxShowed = gUnknown_0203CE54->numShownItems[pocketId];
}
void get_name(s8 *dest, u16 itemId)
@ -907,7 +905,7 @@ void bag_menu_print_cursor(u8 a, u8 b)
void bag_menu_add_pocket_scroll_arrow_indicators_maybe(void)
{
if (gUnknown_0203CE54->unk81E == 0xFF)
gUnknown_0203CE54->unk81E = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 0xAC, 12, 0x94, gUnknown_0203CE54->unk829[gUnknown_0203CE58.pocket] - gUnknown_0203CE54->unk82E[gUnknown_0203CE58.pocket], 0x6E, 0x6E, &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket]);
gUnknown_0203CE54->unk81E = AddScrollIndicatorArrowPairParameterized(SCROLL_ARROW_UP, 0xAC, 12, 0x94, gUnknown_0203CE54->numItemStacks[gUnknown_0203CE58.pocket] - gUnknown_0203CE54->numShownItems[gUnknown_0203CE58.pocket], 0x6E, 0x6E, &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket]);
}
void sub_81AB824(void)
@ -937,8 +935,8 @@ void sub_81AB89C(void)
void free_bag_item_list_buffers(void)
{
Free(gUnknown_0203CE78);
Free(gUnknown_0203CE74);
Free(sListBuffer2);
Free(sListBuffer1);
FreeAllWindowBuffers();
Free(gUnknown_0203CE54);
}
@ -955,8 +953,8 @@ void task_close_bag_menu_2(u8 taskId)
if (!gPaletteFade.active)
{
DestroyListMenuTask(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
if (gUnknown_0203CE54->unk0 != 0)
SetMainCallback2(gUnknown_0203CE54->unk0);
if (gUnknown_0203CE54->mainCallback2 != 0)
SetMainCallback2(gUnknown_0203CE54->mainCallback2);
else
SetMainCallback2(gUnknown_0203CE58.bagCallback);
sub_81AB824();
@ -981,15 +979,17 @@ void sub_81AB9A8(u8 pocketId)
CompactItemsInBagPocket(pocket);
break;
}
gUnknown_0203CE54->unk829[pocketId] = 0;
gUnknown_0203CE54->numItemStacks[pocketId] = 0;
for (i = 0; i < pocket->capacity && pocket->itemSlots[i].itemId; i++)
gUnknown_0203CE54->unk829[pocketId]++;
if (!gUnknown_0203CE54->unk81B_2)
gUnknown_0203CE54->unk829[pocketId]++;
if (gUnknown_0203CE54->unk829[pocketId] > 8)
gUnknown_0203CE54->unk82E[pocketId] = 8;
gUnknown_0203CE54->numItemStacks[pocketId]++;
if (!gUnknown_0203CE54->hideCloseBagText)
gUnknown_0203CE54->numItemStacks[pocketId]++;
if (gUnknown_0203CE54->numItemStacks[pocketId] > 8)
gUnknown_0203CE54->numShownItems[pocketId] = 8;
else
gUnknown_0203CE54->unk82E[pocketId] = gUnknown_0203CE54->unk829[pocketId];
gUnknown_0203CE54->numShownItems[pocketId] = gUnknown_0203CE54->numItemStacks[pocketId];
}
void sub_81ABA6C(void)
@ -999,26 +999,26 @@ void sub_81ABA6C(void)
sub_81AB9A8(i);
}
void sub_81ABA88(u8 a)
void SetInitialScrollAndCursorPositions(u8 pocketId)
{
sub_812225C(&gUnknown_0203CE58.scrollPosition[a], &gUnknown_0203CE58.cursorPosition[a], gUnknown_0203CE54->unk82E[a], gUnknown_0203CE54->unk829[a]);
sub_812225C(&gUnknown_0203CE58.scrollPosition[pocketId], &gUnknown_0203CE58.cursorPosition[pocketId], gUnknown_0203CE54->numShownItems[pocketId], gUnknown_0203CE54->numItemStacks[pocketId]);
}
void sub_81ABAC4(void)
static void SetPocketListPositions(void)
{
u8 i;
for (i = 0; i < POCKETS_COUNT; i++)
sub_81ABA88(i);
SetInitialScrollAndCursorPositions(i);
}
void sub_81ABAE0(void)
{
u8 i;
for (i = 0; i < POCKETS_COUNT; i++)
sub_8122298(&gUnknown_0203CE58.scrollPosition[i], &gUnknown_0203CE58.cursorPosition[i], gUnknown_0203CE54->unk82E[i], gUnknown_0203CE54->unk829[i], 8);
sub_8122298(&gUnknown_0203CE58.scrollPosition[i], &gUnknown_0203CE58.cursorPosition[i], gUnknown_0203CE54->numShownItems[i], gUnknown_0203CE54->numItemStacks[i], 8);
}
u8 sub_81ABB2C(u8 pocketId)
u8 GetItemListPosition(u8 pocketId)
{
return gUnknown_0203CE58.scrollPosition[pocketId] + gUnknown_0203CE58.cursorPosition[pocketId];
}
@ -1041,7 +1041,7 @@ void bag_menu_inits_lists_menu(u8 taskId)
bag_menu_RemoveBagItem_message_window(4);
DestroyListMenuTask(data[0], scrollPos, cursorPos);
sub_81AB9A8(gUnknown_0203CE58.pocket);
sub_81ABA88(gUnknown_0203CE58.pocket);
SetInitialScrollAndCursorPositions(gUnknown_0203CE58.pocket);
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
schedule_bg_copy_tilemap_to_vram(0);
@ -1092,7 +1092,7 @@ void Task_BagMenu(u8 taskId)
if (sub_81AC2C0() == 1)
{
ListMenuGetScrollAndRow(data[0], scrollPos, cursorPos);
if ((*scrollPos + *cursorPos) != gUnknown_0203CE54->unk829[gUnknown_0203CE58.pocket] - 1)
if ((*scrollPos + *cursorPos) != gUnknown_0203CE54->numItemStacks[gUnknown_0203CE58.pocket] - 1)
{
PlaySE(SE_SELECT);
bag_menu_swap_items(taskId);
@ -1102,13 +1102,13 @@ void Task_BagMenu(u8 taskId)
}
else
{
int r4 = ListMenuHandleInputGetItemId(data[0]);
int listPosition = ListMenuHandleInputGetItemId(data[0]);
ListMenuGetScrollAndRow(data[0], scrollPos, cursorPos);
switch (r4)
switch (listPosition)
{
case -1:
case LIST_NOTHING_CHOSEN:
break;
case -2:
case LIST_B_PRESSED:
if (gUnknown_0203CE58.location == 5)
{
PlaySE(SE_HAZURE);
@ -1118,13 +1118,13 @@ void Task_BagMenu(u8 taskId)
gSpecialVar_ItemId = select;
gTasks[taskId].func = unknown_ItemMenu_Confirm;
break;
default:
default: // A_BUTTON
PlaySE(SE_SELECT);
sub_81AB824();
bag_menu_print_cursor_(data[0], 2);
data[1] = r4;
data[2] = BagGetQuantityByPocketPosition(gUnknown_0203CE58.pocket + 1, r4);
gSpecialVar_ItemId = BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, r4);
data[1] = listPosition;
data[2] = BagGetQuantityByPocketPosition(gUnknown_0203CE58.pocket + 1, listPosition);
gSpecialVar_ItemId = BagGetItemIdByPocketPosition(gUnknown_0203CE58.pocket + 1, listPosition);
gUnknown_08614054[gUnknown_0203CE58.location](taskId);
break;
}
@ -1186,7 +1186,7 @@ void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3)
ClearWindowTilemap(1);
DestroyListMenuTask(data[0], &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket], &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket]);
schedule_bg_copy_tilemap_to_vram(0);
gSprites[gUnknown_0203CE54->unk804[2 + (gUnknown_0203CE54->unk81B_1 ^ 1)]].invisible = TRUE;
gSprites[gUnknown_0203CE54->spriteId[2 + (gUnknown_0203CE54->unk81B_1 ^ 1)]].invisible = TRUE;
sub_81AB824();
}
pocketId = gUnknown_0203CE58.pocket;
@ -1744,7 +1744,7 @@ void Task_ActuallyToss(u8 taskId)
RemoveBagItem(gSpecialVar_ItemId, data[8]);
DestroyListMenuTask(data[0], scrollPos, cursorPos);
sub_81AB9A8(gUnknown_0203CE58.pocket);
sub_81ABA88(gUnknown_0203CE58.pocket);
SetInitialScrollAndCursorPositions(gUnknown_0203CE58.pocket);
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
schedule_bg_copy_tilemap_to_vram(0);
@ -1782,7 +1782,7 @@ void ItemMenu_Give(u8 taskId)
bag_menu_print_there_is_no_pokemon(taskId);
else
{
gUnknown_0203CE54->unk0 = sub_81B7F60;
gUnknown_0203CE54->mainCallback2 = sub_81B7F60;
unknown_ItemMenu_Confirm(taskId);
}
}
@ -1815,7 +1815,7 @@ void sub_81AD350(u8 taskId)
void ItemMenu_CheckTag(u8 taskId)
{
gUnknown_0203CE54->unk0 = DoBerryTagScreen;
gUnknown_0203CE54->mainCallback2 = DoBerryTagScreen;
unknown_ItemMenu_Confirm(taskId);
}
@ -2012,7 +2012,7 @@ void sub_81AD8C8(u8 taskId)
AddMoney(&gSaveBlock1Ptr->money, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8]);
DestroyListMenuTask(data[0], scrollPos, cursorPos);
sub_81AB9A8(gUnknown_0203CE58.pocket);
sub_81ABA88(gUnknown_0203CE58.pocket);
SetInitialScrollAndCursorPositions(gUnknown_0203CE58.pocket);
load_bag_item_list_buffers(gUnknown_0203CE58.pocket);
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
bag_menu_print_cursor_(data[0], 2);
@ -2235,7 +2235,7 @@ void bag_menu_leave_maybe(void)
SetMainCallback2(CB2_ReturnToField);
}
void bag_menu_print_pocket_names(u8 *pocketName1, u8 *pocketName2)
void bag_menu_print_pocket_names(const u8 *pocketName1, const u8 *pocketName2)
{
struct WindowTemplate window = {0, 0, 0, 0, 0, 0, 0};
u16 windowId;
@ -2252,7 +2252,7 @@ void bag_menu_print_pocket_names(u8 *pocketName1, u8 *pocketName2)
offset = GetStringCenterAlignXOffset(1, pocketName2, 0x40);
bag_menu_print(windowId, 1, pocketName2, offset + 0x40, 1, 0, 0, -1, 1);
}
CpuCopy32((u8*)GetWindowAttribute(windowId, WINDOW_TILE_DATA), gUnknown_0203CE54->unk844, 0x400);
CpuCopy32((u8*)GetWindowAttribute(windowId, WINDOW_TILE_DATA), gUnknown_0203CE54->pocketNameBuffer, 0x400);
RemoveWindow(windowId);
}
@ -2263,7 +2263,7 @@ void bag_menu_copy_pocket_name_to_window(u32 a)
int b;
if (a > 8)
a = 8;
r4 = &gUnknown_0203CE54->unk844;
r4 = &gUnknown_0203CE54->pocketNameBuffer;
windowAttribute = (u8*)GetWindowAttribute(2, WINDOW_TILE_DATA);
CpuCopy32(r4[0][a], windowAttribute, 0x100);
b = a + 16;
@ -2292,17 +2292,17 @@ void setup_bag_menu_textboxes(void)
void bag_menu_print(u8 windowId, u8 fontId, const u8 *str, u8 left, u8 top, u8 letterSpacing, u8 lineSpacing, u8 speed, u8 h)
{
AddTextPrinterParameterized4(windowId, fontId, left, top, letterSpacing, lineSpacing, gUnknown_08614164[h], speed, str);
AddTextPrinterParameterized4(windowId, fontId, left, top, letterSpacing, lineSpacing, sFontColorTable[h], speed, str);
}
u8 sub_81AE124(u8 a)
{
return gUnknown_0203CE54->unk810[a];
return gUnknown_0203CE54->windowPointers[a];
}
u8 bag_menu_add_window(u8 a)
{
u8 *ptr = &gUnknown_0203CE54->unk810[a];
u8 *ptr = &gUnknown_0203CE54->windowPointers[a];
if (*ptr == 0xFF)
{
*ptr = AddWindow(&gUnknown_086141AC[a]);
@ -2314,7 +2314,7 @@ u8 bag_menu_add_window(u8 a)
void bag_menu_remove_window(u8 a)
{
u8 *ptr = &gUnknown_0203CE54->unk810[a];
u8 *ptr = &gUnknown_0203CE54->windowPointers[a];
if (*ptr != 0xFF)
{
sub_8198070(*ptr, 0);
@ -2327,7 +2327,7 @@ void bag_menu_remove_window(u8 a)
u8 AddItemMessageWindow(u8 a)
{
u8 *ptr = &gUnknown_0203CE54->unk810[a];
u8 *ptr = &gUnknown_0203CE54->windowPointers[a];
if (*ptr == 0xFF)
*ptr = AddWindow(&gUnknown_086141AC[a]);
return *ptr;
@ -2335,7 +2335,7 @@ u8 AddItemMessageWindow(u8 a)
void bag_menu_RemoveBagItem_message_window(u8 a)
{
u8 *ptr = &gUnknown_0203CE54->unk810[a];
u8 *ptr = &gUnknown_0203CE54->windowPointers[a];
if (*ptr != 0xFF)
{
sub_8197DF8(*ptr, 0);

View File

@ -1,14 +1,14 @@
#include "global.h"
#include "sprite.h"
#include "berry.h"
#include "decompress.h"
#include "graphics.h"
#include "item.h"
#include "item_menu.h"
#include "item_icon.h"
#include "item_menu_icons.h"
#include "window.h"
#include "menu_helpers.h"
#include "berry.h"
#include "graphics.h"
#include "item.h"
#include "sprite.h"
#include "window.h"
#include "constants/items.h"
struct CompressedTilesPal
@ -199,7 +199,7 @@ static const struct SpritePalette gUnknown_0857FBA8 =
gUnknown_0857F564, 101
};
static const struct SpriteTemplate gUnknown_0857FBB0 =
static const struct SpriteTemplate gSpriteTemplate_RotatingBall =
{
.tileTag = 101,
.paletteTag = 101,
@ -409,7 +409,7 @@ static const struct SpriteTemplate gUnknown_0857FE10 =
// code
void RemoveBagSprite(u8 id)
{
u8 *spriteId = &gUnknown_0203CE54->unk804[id];
u8 *spriteId = &gUnknown_0203CE54->spriteId[id];
if (*spriteId != 0xFF)
{
FreeSpriteTilesByTag(id + 100);
@ -422,14 +422,14 @@ void RemoveBagSprite(u8 id)
void AddBagVisualSprite(u8 bagPocketId)
{
u8 *spriteId = &gUnknown_0203CE54->unk804[0];
u8 *spriteId = &gUnknown_0203CE54->spriteId[0];
*spriteId = CreateSprite(&gUnknown_0857FB4C, 68, 66, 0);
SetBagVisualPocketId(bagPocketId, FALSE);
}
void SetBagVisualPocketId(u8 bagPocketId, bool8 isSwitchingPockets)
{
struct Sprite *sprite = &gSprites[gUnknown_0203CE54->unk804[0]];
struct Sprite *sprite = &gSprites[gUnknown_0203CE54->spriteId[0]];
if (isSwitchingPockets)
{
sprite->pos2.y = -5;
@ -458,7 +458,7 @@ static void SpriteCB_BagVisualSwitchingPockets(struct Sprite *sprite)
void ShakeBagVisual(void)
{
struct Sprite *sprite = &gSprites[gUnknown_0203CE54->unk804[0]];
struct Sprite *sprite = &gSprites[gUnknown_0203CE54->spriteId[0]];
if (sprite->affineAnimEnded)
{
StartSpriteAffineAnim(sprite, 1);
@ -477,10 +477,10 @@ static void SpriteCB_ShakeBagVisual(struct Sprite *sprite)
void AddSwitchPocketRotatingBallSprite(s16 rotationDirection)
{
u8 *spriteId = &gUnknown_0203CE54->unk804[1];
u8 *spriteId = &gUnknown_0203CE54->spriteId[1];
LoadSpriteSheet(&gUnknown_0857FBA0);
LoadSpritePalette(&gUnknown_0857FBA8);
*spriteId = CreateSprite(&gUnknown_0857FBB0, 16, 16, 0);
*spriteId = CreateSprite(&gSpriteTemplate_RotatingBall, 16, 16, 0);
gSprites[*spriteId].data[0] = rotationDirection;
}
@ -515,7 +515,7 @@ static void SpriteCB_SwitchPocketRotatingBallContinue(struct Sprite *sprite)
void AddBagItemIconSprite(u16 itemId, u8 id)
{
u8 *spriteId = &gUnknown_0203CE54->unk804[id + 2];
u8 *spriteId = &gUnknown_0203CE54->spriteId[id + 2];
if (*spriteId == 0xFF)
{
u8 iconSpriteId;
@ -539,17 +539,17 @@ void RemoveBagItemIconSprite(u8 id)
void sub_80D4FAC(void)
{
sub_8122344(&gUnknown_0203CE54->unk804[4], 8);
sub_8122344(&gUnknown_0203CE54->spriteId[4], 8);
}
void sub_80D4FC8(u8 arg0)
{
sub_81223FC(&gUnknown_0203CE54->unk804[4], 8, arg0);
sub_81223FC(&gUnknown_0203CE54->spriteId[4], 8, arg0);
}
void sub_80D4FEC(u8 arg0)
{
sub_8122448(&gUnknown_0203CE54->unk804[4], 136, 120, (arg0 + 1) * 16);
sub_8122448(&gUnknown_0203CE54->spriteId[4], 136, 120, (arg0 + 1) * 16);
}
static void sub_80D5018(void *mem0, void *mem1)

View File

@ -57,7 +57,6 @@ extern void bag_menu_yes_no(u8, u8, const struct YesNoFuncTable*);
extern void sub_81C5924(void);
extern void sub_81C59BC(void);
extern void sub_81AB9A8(u8);
extern void sub_81ABA88(u8);
extern void StartEscapeRopeFieldEffect(void);
extern u8* sub_806CF78(u16);
extern void sub_81B89F0(void);
@ -128,7 +127,7 @@ void SetUpItemUseCallback(u8 taskId)
type = ItemId_GetType(gSpecialVar_ItemId) - 1;
if (!InBattlePyramid())
{
gUnknown_0203CE54->unk0 = gUnknown_085920D8[type];
gUnknown_0203CE54->mainCallback2 = gUnknown_085920D8[type];
unknown_ItemMenu_Confirm(taskId);
}
else
@ -212,7 +211,7 @@ void sub_80FD254(void)
void ItemUseOutOfBattle_Mail(u8 taskId)
{
gUnknown_0203CE54->unk0 = sub_80FD254;
gUnknown_0203CE54->mainCallback2 = sub_80FD254;
unknown_ItemMenu_Confirm(taskId);
}
@ -608,7 +607,7 @@ void ItemUseOutOfBattle_PokeblockCase(u8 taskId)
}
else if (gTasks[taskId].data[3] != TRUE)
{
gUnknown_0203CE54->unk0 = sub_80FDBEC;
gUnknown_0203CE54->mainCallback2 = sub_80FDBEC;
unknown_ItemMenu_Confirm(taskId);
}
else
@ -670,7 +669,7 @@ void sub_80FDD10(u8 taskId)
{
gUnknown_0203A0F4 = sub_80FDD74;
gFieldCallback = MapPostLoadHook_UseItem;
gUnknown_0203CE54->unk0 = CB2_ReturnToField;
gUnknown_0203CE54->mainCallback2 = CB2_ReturnToField;
unknown_ItemMenu_Confirm(taskId);
}
else
@ -812,7 +811,7 @@ void sub_80FE058(void)
if (!InBattlePyramid())
{
sub_81AB9A8(ItemId_GetPocket(gSpecialVar_ItemId));
sub_81ABA88(ItemId_GetPocket(gSpecialVar_ItemId));
SetInitialScrollAndCursorPositions(ItemId_GetPocket(gSpecialVar_ItemId));
}
else
{
@ -993,7 +992,7 @@ void sub_80FE54C(u8 taskId)
{
if (!InBattlePyramid())
{
gUnknown_0203CE54->unk0 = sub_81B89F0;
gUnknown_0203CE54->mainCallback2 = sub_81B89F0;
unknown_ItemMenu_Confirm(taskId);
}
else

View File

@ -62,14 +62,14 @@ static const u8 * const sGiddyAdjectives[] = {
};
static const u8 * const sGiddyQuestions[] = {
gUnknown_08294313,
gUnknown_08294359,
gUnknown_08294398,
gUnknown_082943DA,
gUnknown_0829441C,
gUnknown_08294460,
gUnknown_082944A0,
gUnknown_082944D5
gMauvilleManText_ISoWantToGoOnAVacation,
gMauvilleManText_IBoughtCrayonsWith120Colors,
gMauvilleManText_WouldntItBeNiceIfWeCouldFloat,
gMauvilleManText_WhenYouWriteOnASandyBeach,
gMauvilleManText_WhatsTheBottomOfTheSeaLike,
gMauvilleManText_WhenYouSeeTheSettingSunDoesIt,
gMauvilleManText_LyingBackInTheGreenGrass,
gMauvilleManText_SecretBasesAreSoWonderful
};
static void SetupBard(void)

View File

@ -426,7 +426,7 @@ static void SpriteCB_TestBallThrow(struct Sprite *sprite)
sprite->pos2.y = 0;
sprite->data[5] = 0;
ballId = ItemIdToBallId(GetBattlerPokeballItemId(opponentBattler));
LaunchBallStarsTask(sprite->pos1.x, sprite->pos1.y - 5, 1, 0x1C, ballId);
AnimateBallOpenParticles(sprite->pos1.x, sprite->pos1.y - 5, 1, 0x1C, ballId);
sprite->data[0] = LaunchBallFadeMonTask(FALSE, opponentBattler, 14, ballId);
sprite->sBattler = opponentBattler;
sprite->data[7] = noOfShakes;
@ -737,7 +737,7 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite)
StartSpriteAnim(sprite, 1);
ballId = ItemIdToBallId(GetBattlerPokeballItemId(battlerId));
LaunchBallStarsTask(sprite->pos1.x, sprite->pos1.y - 5, 1, 0x1C, ballId);
AnimateBallOpenParticles(sprite->pos1.x, sprite->pos1.y - 5, 1, 0x1C, ballId);
sprite->data[0] = LaunchBallFadeMonTask(1, sprite->sBattler, 14, ballId);
sprite->callback = HandleBallAnimEnd;
@ -985,9 +985,9 @@ static void SpriteCB_OpponentMonSendOut(struct Sprite *sprite)
#undef sBattler
static u8 LaunchBallStarsTaskForPokeball(u8 x, u8 y, u8 kindOfStars, u8 d)
static u8 AnimateBallOpenParticlesForPokeball(u8 x, u8 y, u8 kindOfStars, u8 d)
{
return LaunchBallStarsTask(x, y, kindOfStars, d, BALL_POKE);
return AnimateBallOpenParticles(x, y, kindOfStars, d, BALL_POKE);
}
static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 battlerId, u32 arg2)
@ -1036,7 +1036,7 @@ static void sub_8076524(struct Sprite *sprite)
r5 = 0;
StartSpriteAnim(sprite, 1);
LaunchBallStarsTaskForPokeball(sprite->pos1.x, sprite->pos1.y - 5, sprite->oam.priority, r5);
AnimateBallOpenParticlesForPokeball(sprite->pos1.x, sprite->pos1.y - 5, sprite->oam.priority, r5);
sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, battlerId, r4);
sprite->callback = sub_80765E0;
gSprites[r7].invisible = FALSE;
@ -1129,7 +1129,7 @@ static void sub_80767D4(struct Sprite *sprite)
r6 = 0;
StartSpriteAnim(sprite, 1);
LaunchBallStarsTaskForPokeball(sprite->pos1.x, sprite->pos1.y - 5, sprite->oam.priority, r6);
AnimateBallOpenParticlesForPokeball(sprite->pos1.x, sprite->pos1.y - 5, sprite->oam.priority, r6);
sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, r8, r5);
sprite->callback = sub_807687C;
StartSpriteAffineAnim(&gSprites[r7], 2);

View File

@ -75,9 +75,6 @@ struct UnknownStruct4
u8 unk9;
};
#define HOENN_DEX_COUNT 202
#define NATIONAL_DEX_COUNT 386
extern struct MusicPlayerInfo gMPlayInfo_BGM;
struct PokedexListItem
@ -130,12 +127,6 @@ struct PokedexView
u8 unk65C[8];
};
enum
{
DEX_MODE_HOENN,
DEX_MODE_NATIONAL
};
enum
{
AREA_SCREEN,
@ -176,7 +167,7 @@ u16 sub_80BD69C(u16, u16);
void sub_80BD8D0(void);
bool8 sub_80BD930(void);
u8 sub_80BDA40(void);
u16 sub_80BDA8C(u16);
u16 GetPokemonSpriteToDisplay(u16);
u32 sub_80BDACC(u16, s16, s16);
static void CreateInterfaceSprites(u8);
void sub_80BE470(struct Sprite *sprite);
@ -1237,7 +1228,7 @@ void ResetPokedex(void)
gUnknown_02039B50 = 0;
gUnknown_02039B52 = 64;
gUnknown_030060B0 = 0;
gSaveBlock2Ptr->pokedex.unknown1 = 0;
gSaveBlock2Ptr->pokedex.mode = DEX_MODE_HOENN;
gSaveBlock2Ptr->pokedex.order = 0;
gSaveBlock2Ptr->pokedex.nationalMagic = 0;
gSaveBlock2Ptr->pokedex.unknown2 = 0;
@ -1289,7 +1280,7 @@ static void ResetPokedexView(struct PokedexView *pokedexView)
pokedexView->unk618 = 0;
pokedexView->seenCount = 0;
pokedexView->ownCount = 0;
for (i = 0; i <= 3; i++)
for (i = 0; i < 4; i++)
pokedexView->unk61E[i] |= 0xFFFF;
pokedexView->unk628 = 0;
pokedexView->unk62A = 0;
@ -1348,7 +1339,7 @@ void CB2_Pokedex(void)
sPokedexView = AllocZeroed(sizeof(struct PokedexView));
ResetPokedexView(sPokedexView);
CreateTask(sub_80BB78C, 0);
sPokedexView->dexMode = gSaveBlock2Ptr->pokedex.unknown1;
sPokedexView->dexMode = gSaveBlock2Ptr->pokedex.mode;
if (!IsNationalPokedexEnabled())
sPokedexView->dexMode = DEX_MODE_HOENN;
sPokedexView->dexOrder = gSaveBlock2Ptr->pokedex.order;
@ -1571,9 +1562,9 @@ void sub_80BBDE8(u8 taskId)
{
if (!gPaletteFade.active)
{
gSaveBlock2Ptr->pokedex.unknown1 = sPokedexView->dexMode;
gSaveBlock2Ptr->pokedex.mode = sPokedexView->dexMode;
if (!IsNationalPokedexEnabled())
gSaveBlock2Ptr->pokedex.unknown1 = DEX_MODE_HOENN;
gSaveBlock2Ptr->pokedex.mode = DEX_MODE_HOENN;
gSaveBlock2Ptr->pokedex.order = sPokedexView->dexOrder;
sub_80BDA40();
sub_80BC890();
@ -1898,6 +1889,9 @@ void sub_80BC890(void)
void sub_80BC8D4(u8 dexMode, u8 sortMode)
{
u16 vars[3]; //I have no idea why three regular variables are stored in an array, but whatever.
#define temp_dexCount vars[0]
#define temp_isHoennDex vars[1]
#define temp_dexNum vars[2]
s16 i;
sPokedexView->pokemonListCount = 0;
@ -1906,19 +1900,19 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
{
default:
case DEX_MODE_HOENN:
vars[0] = HOENN_DEX_COUNT;
vars[1] = 1;
temp_dexCount = HOENN_DEX_COUNT;
temp_isHoennDex = TRUE;
break;
case DEX_MODE_NATIONAL:
if (IsNationalPokedexEnabled())
{
vars[0] = NATIONAL_DEX_COUNT;
vars[1] = 0;
temp_dexCount = NATIONAL_DEX_COUNT;
temp_isHoennDex = FALSE;
}
else
{
vars[0] = HOENN_DEX_COUNT;
vars[1] = 1;
temp_dexCount = HOENN_DEX_COUNT;
temp_isHoennDex = TRUE;
}
break;
}
@ -1926,14 +1920,14 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
switch (sortMode)
{
case 0:
if (vars[1])
if (temp_isHoennDex)
{
for (i = 0; i < vars[0]; i++)
for (i = 0; i < temp_dexCount; i++)
{
vars[2] = HoennToNationalOrder(i + 1);
sPokedexView->pokedexList[i].dexNum = vars[2];
sPokedexView->pokedexList[i].seen = GetSetPokedexFlag(vars[2], 0);
sPokedexView->pokedexList[i].owned = GetSetPokedexFlag(vars[2], 1);
temp_dexNum = HoennToNationalOrder(i + 1);
sPokedexView->pokedexList[i].dexNum = temp_dexNum;
sPokedexView->pokedexList[i].seen = GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN);
sPokedexView->pokedexList[i].owned = GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT);
if (sPokedexView->pokedexList[i].seen)
sPokedexView->pokemonListCount = i + 1;
}
@ -1944,17 +1938,17 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
s16 r5;
r10 = r5 = i = 0;
for (i = 0; i < vars[0]; i++)
for (i = 0; i < temp_dexCount; i++)
{
vars[2] = i + 1;
if (GetSetPokedexFlag(vars[2], 0))
temp_dexNum = i + 1;
if (GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN))
r10 = 1;
if (r10)
{
asm(""); //Needed to match for some reason
sPokedexView->pokedexList[r5].dexNum = vars[2];
sPokedexView->pokedexList[r5].seen = GetSetPokedexFlag(vars[2], 0);
sPokedexView->pokedexList[r5].owned = GetSetPokedexFlag(vars[2], 1);
sPokedexView->pokedexList[r5].dexNum = temp_dexNum;
sPokedexView->pokedexList[r5].seen = GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN);
sPokedexView->pokedexList[r5].owned = GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT);
if (sPokedexView->pokedexList[r5].seen)
sPokedexView->pokemonListCount = r5 + 1;
r5++;
@ -1965,13 +1959,13 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
case 1:
for (i = 0; i < POKEMON_SLOTS_NUMBER - 1; i++)
{
vars[2] = gPokedexOrder_Alphabetical[i];
temp_dexNum = gPokedexOrder_Alphabetical[i];
if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 0))
if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN))
{
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = vars[2];
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = 1;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = GetSetPokedexFlag(vars[2], 1);
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT);
sPokedexView->pokemonListCount++;
}
}
@ -1979,13 +1973,13 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
case 2:
for (i = NATIONAL_DEX_COUNT - 1; i >= 0; i--)
{
vars[2] = gPokedexOrder_Weight[i];
temp_dexNum = gPokedexOrder_Weight[i];
if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 1))
if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT))
{
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = vars[2];
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = 1;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = 1;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = TRUE;
sPokedexView->pokemonListCount++;
}
}
@ -1993,13 +1987,13 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
case 3:
for (i = 0; i < NATIONAL_DEX_COUNT; i++)
{
vars[2] = gPokedexOrder_Weight[i];
temp_dexNum = gPokedexOrder_Weight[i];
if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 1))
if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT))
{
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = vars[2];
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = 1;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = 1;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = TRUE;
sPokedexView->pokemonListCount++;
}
}
@ -2007,13 +2001,13 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
case 4:
for (i = NATIONAL_DEX_COUNT - 1; i >= 0; i--)
{
vars[2] = gPokedexOrder_Height[i];
temp_dexNum = gPokedexOrder_Height[i];
if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 1))
if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT))
{
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = vars[2];
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = 1;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = 1;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = TRUE;
sPokedexView->pokemonListCount++;
}
}
@ -2021,13 +2015,13 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
case 5:
for (i = 0; i < NATIONAL_DEX_COUNT; i++)
{
vars[2] = gPokedexOrder_Height[i];
temp_dexNum = gPokedexOrder_Height[i];
if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 1))
if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT))
{
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = vars[2];
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = 1;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = 1;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE;
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = TRUE;
sPokedexView->pokemonListCount++;
}
}
@ -2037,8 +2031,8 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
for (i = sPokedexView->pokemonListCount; i < NATIONAL_DEX_COUNT; i++)
{
sPokedexView->pokedexList[i].dexNum |= 0xFFFF;
sPokedexView->pokedexList[i].seen = 0;
sPokedexView->pokedexList[i].owned = 0;
sPokedexView->pokedexList[i].seen = FALSE;
sPokedexView->pokedexList[i].owned = FALSE;
}
}
@ -2192,7 +2186,7 @@ static void CreateInitialPokemonSprites(u16 selectedMon, u16 b)
sPokedexView->unk61E[i] = 0xFFFF;
sPokedexView->selectedMonSpriteId = 0xFFFF;
unk = sub_80BDA8C(selectedMon - 1);
unk = GetPokemonSpriteToDisplay(selectedMon - 1);
if (unk != 0xFFFF)
{
spriteId = sub_80BDACC(unk, 0x60, 0x50);
@ -2200,7 +2194,7 @@ static void CreateInitialPokemonSprites(u16 selectedMon, u16 b)
gSprites[spriteId].data[5] = -32;
}
unk = sub_80BDA8C(selectedMon);
unk = GetPokemonSpriteToDisplay(selectedMon);
if (unk != 0xFFFF)
{
spriteId = sub_80BDACC(unk, 0x60, 0x50);
@ -2208,7 +2202,7 @@ static void CreateInitialPokemonSprites(u16 selectedMon, u16 b)
gSprites[spriteId].data[5] = 0;
}
unk = sub_80BDA8C(selectedMon + 1);
unk = GetPokemonSpriteToDisplay(selectedMon + 1);
if (unk != 0xFFFF)
{
spriteId = sub_80BDACC(unk, 0x60, 0x50);
@ -2274,7 +2268,7 @@ static void CreateNewPokemonSprite(u8 direction, u16 selectedMon)
switch (direction)
{
case 1: // up
unk = sub_80BDA8C(selectedMon - 1);
unk = GetPokemonSpriteToDisplay(selectedMon - 1);
if (unk != 0xFFFF)
{
spriteId = sub_80BDACC(unk, 0x60, 0x50);
@ -2287,7 +2281,7 @@ static void CreateNewPokemonSprite(u8 direction, u16 selectedMon)
sPokedexView->unk630 = 15;
break;
case 2: // down
unk = sub_80BDA8C(selectedMon + 1);
unk = GetPokemonSpriteToDisplay(selectedMon + 1);
if (unk != 0xFFFF)
{
spriteId = sub_80BDACC(unk, 0x60, 0x50);
@ -2449,12 +2443,12 @@ u8 sub_80BDA40(void)
return FALSE;
}
u16 sub_80BDA8C(u16 a1)
u16 GetPokemonSpriteToDisplay(u16 species)
{
if (a1 >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[a1].dexNum == 0xFFFF)
if (species >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[species].dexNum == 0xFFFF)
return 0xFFFF;
else if (sPokedexView->pokedexList[a1].seen)
return sPokedexView->pokedexList[a1].dexNum;
else if (sPokedexView->pokedexList[species].seen)
return sPokedexView->pokedexList[species].dexNum;
else
return 0;
}
@ -2467,7 +2461,7 @@ u32 sub_80BDACC(u16 num, s16 x, s16 y)
{
if (sPokedexView->unk61E[i] == 0xFFFF)
{
u8 spriteId = sub_80C0E9C(num, x, y, i);
u8 spriteId = CreateMonSpriteFromNationalDexNumber(num, x, y, i);
gSprites[spriteId].oam.affineMode = 1;
gSprites[spriteId].oam.priority = 3;
@ -2963,7 +2957,7 @@ void sub_80BEA24(u8 taskId)
case 5:
if (gTasks[taskId].data[1] == 0)
{
gTasks[taskId].data[4] = (u16)sub_80C0E9C(sPokedexListItem->dexNum, 0x30, 0x38, 0);
gTasks[taskId].data[4] = (u16)CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, 48, 56, 0);
gSprites[gTasks[taskId].data[4]].oam.priority = 0;
}
gMain.state++;
@ -3251,7 +3245,7 @@ void sub_80BF250(u8 taskId)
gMain.state++;
break;
case 5:
gTasks[taskId].data[4] = sub_80C0E9C(sPokedexListItem->dexNum, 48, 56, 0);
gTasks[taskId].data[4] = CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, 48, 56, 0);
gSprites[gTasks[taskId].data[4]].oam.priority = 0;
gDexCryScreenState = 0;
gMain.state++;
@ -3459,7 +3453,7 @@ void sub_80BF82C(u8 taskId)
gMain.state++;
break;
case 6:
spriteId = sub_80C0E9C(sPokedexListItem->dexNum, 88, 56, 1);
spriteId = CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, 88, 56, 1);
gSprites[spriteId].oam.affineMode = 1;
gSprites[spriteId].oam.matrixNum = 2;
gSprites[spriteId].oam.priority = 0;
@ -3790,7 +3784,7 @@ void sub_80BFE38(u8 taskId)
gTasks[taskId].data[0]++;
break;
case 4:
spriteId = sub_80C0E9C(dexNum, 0x30, 0x38, 0);
spriteId = CreateMonSpriteFromNationalDexNumber(dexNum, 48, 56, 0);
gSprites[spriteId].oam.priority = 0;
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK);
SetVBlankCallback(gUnknown_030060B4);
@ -4348,7 +4342,7 @@ u16 GetHoennPokedexCount(u8 caseID)
u16 count = 0;
u16 i;
for (i = 0; i < 202; i++)
for (i = 0; i < HOENN_DEX_COUNT; i++)
{
switch (caseID)
{
@ -4417,17 +4411,17 @@ u16 sub_80C0944(void)
for (i = 0; i < 150; i++)
{
if (GetSetPokedexFlag(i + 1, 1) == 0)
if (!GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT))
return 0;
}
for (i = 151; i < 248; i++)
{
if (GetSetPokedexFlag(i + 1, 1) == 0)
if (!GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT))
return 0;
}
for (i = 251; i < 384; i++)
{
if (GetSetPokedexFlag(i + 1, 1) == 0)
if (!GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT))
return 0;
}
return 1;
@ -4643,10 +4637,10 @@ u32 sub_80C0E68(u16 a)
}
}
u16 sub_80C0E9C(u16 num, s16 x, s16 y, u16 paletteSlot)
u16 CreateMonSpriteFromNationalDexNumber(u16 nationalNum, s16 x, s16 y, u16 paletteSlot)
{
num = NationalPokedexNumToSpecies(num);
return CreateMonPicSprite_HandleDeoxys(num, 8, sub_80C0E68(num), TRUE, x, y, paletteSlot, 0xFFFF);
nationalNum = NationalPokedexNumToSpecies(nationalNum);
return CreateMonPicSprite_HandleDeoxys(nationalNum, 8, sub_80C0E68(nationalNum), TRUE, x, y, paletteSlot, 0xFFFF);
}
u16 sub_80C0EF8(u16 species, s16 x, s16 y, s8 paletteSlot)
@ -4980,10 +4974,10 @@ void sub_80C170C(u8 taskId)
sPokedexView->unk62A = 0x40;
gUnknown_02039B50 = 0;
sPokedexView->unk610 = 0;
gSaveBlock2Ptr->pokedex.unknown1 = sub_80C2318(taskId, 5);
gSaveBlock2Ptr->pokedex.mode = sub_80C2318(taskId, 5);
if (!IsNationalPokedexEnabled())
gSaveBlock2Ptr->pokedex.unknown1 = 0;
sPokedexView->unk614 = gSaveBlock2Ptr->pokedex.unknown1;
gSaveBlock2Ptr->pokedex.mode = DEX_MODE_HOENN;
sPokedexView->unk614 = gSaveBlock2Ptr->pokedex.mode;
gSaveBlock2Ptr->pokedex.order = sub_80C2318(taskId, 4);
sPokedexView->unk618 = gSaveBlock2Ptr->pokedex.order;
PlaySE(SE_PC_OFF);

View File

@ -45,12 +45,6 @@ struct SpeciesItem
u16 item;
};
// Extracts the upper 16 bits of a 32-bit number
#define HIHALF(n) (((n) & 0xFFFF0000) >> 16)
// Extracts the lower 16 bits of a 32-bit number
#define LOHALF(n) ((n) & 0xFFFF)
extern const struct OamData gUnknown_0831ACB0;
extern const struct OamData gUnknown_0831ACA8;
extern const struct SpriteFrameImage gUnknown_082FF3A8[];
@ -2755,7 +2749,7 @@ void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedI
CalculateMonStats(mon);
}
void sub_806819C(struct Pokemon *mon, struct UnknownPokemonStruct *src)
void sub_806819C(struct Pokemon *mon, struct BattleTowerPokemon *src)
{
s32 i;
u8 nickname[30];
@ -2809,7 +2803,7 @@ void sub_806819C(struct Pokemon *mon, struct UnknownPokemonStruct *src)
CalculateMonStats(mon);
}
void sub_8068338(struct Pokemon *mon, struct UnknownPokemonStruct *src, bool8 lvl50)
void sub_8068338(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50)
{
s32 i;
u8 nickname[30];
@ -2937,7 +2931,7 @@ void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level,
CalculateMonStats(mon);
}
void sub_80686FC(struct Pokemon *mon, struct UnknownPokemonStruct *dest)
void sub_80686FC(struct Pokemon *mon, struct BattleTowerPokemon *dest)
{
s32 i;
u16 heldItem;
@ -5864,10 +5858,10 @@ u16 HoennPokedexNumToSpecies(u16 hoennNum)
species = 0;
while (species < 411 && gSpeciesToHoennPokedexNum[species] != hoennNum)
while (species < (NUM_SPECIES - 1) && gSpeciesToHoennPokedexNum[species] != hoennNum)
species++;
if (species == 411)
if (species == NUM_SPECIES - 1)
return 0;
return species + 1;
@ -5882,10 +5876,10 @@ u16 NationalPokedexNumToSpecies(u16 nationalNum)
species = 0;
while (species < 411 && gSpeciesToNationalPokedexNum[species] != nationalNum)
while (species < (NUM_SPECIES - 1) && gSpeciesToNationalPokedexNum[species] != nationalNum)
species++;
if (species == 411)
if (species == NUM_SPECIES - 1)
return 0;
return species + 1;
@ -5900,10 +5894,10 @@ u16 NationalToHoennOrder(u16 nationalNum)
hoennNum = 0;
while (hoennNum < 411 && gHoennToNationalOrder[hoennNum] != nationalNum)
while (hoennNum < (NUM_SPECIES - 1) && gHoennToNationalOrder[hoennNum] != nationalNum)
hoennNum++;
if (hoennNum == 411)
if (hoennNum == NUM_SPECIES - 1)
return 0;
return hoennNum + 1;
@ -6584,15 +6578,15 @@ u16 SpeciesToPokedexNum(u16 species)
else
{
species = SpeciesToHoennPokedexNum(species);
if (species <= 202)
if (species <= HOENN_DEX_COUNT)
return species;
return 0xFFFF;
}
}
bool32 sub_806E3F8(u16 species)
bool32 IsSpeciesInHoennDex(u16 species)
{
if (SpeciesToHoennPokedexNum(species) > 202)
if (SpeciesToHoennPokedexNum(species) > HOENN_DEX_COUNT)
return FALSE;
else
return TRUE;
@ -6707,12 +6701,6 @@ const u32 *GetMonFrontSpritePal(struct Pokemon *mon)
return GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality);
}
// Extracts the upper 16 bits of a 32-bit number
#define HIHALF(n) (((n) & 0xFFFF0000) >> 16)
// Extracts the lower 16 bits of a 32-bit number
#define LOHALF(n) ((n) & 0xFFFF)
const u32 *GetFrontSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 personality)
{
u32 shinyValue;

View File

@ -647,7 +647,7 @@ static void ReceiveOldManData(OldMan *oldMan, size_t recordSize, u8 which)
static void ReceiveBattleTowerData(void *battleTowerRecord, size_t recordSize, u8 which)
{
struct EmeraldBattleTowerRecord *dest;
struct UnknownPokemonStruct *btPokemon;
struct BattleTowerPokemon *btPokemon;
u32 mixIndices[4];
s32 i;
@ -1866,7 +1866,7 @@ static void SanitizeEmeraldBattleTowerRecord(struct EmeraldBattleTowerRecord *ds
for (i = 0; i < 4; i++)
{
struct UnknownPokemonStruct *towerMon = &dst->party[i];
struct BattleTowerPokemon *towerMon = &dst->party[i];
if (towerMon->species != 0)
StripExtCtrlCodes(towerMon->nickname);
}

View File

@ -220,7 +220,7 @@ static void ShowContestWinnerCleanup(void)
void ShowContestWinner(void)
{
SetMainCallback2(sub_812FDEC);
SetMainCallback2(CB2_ContestPainting);
gMain.savedCallback = ShowContestWinnerCleanup;
}
@ -563,8 +563,8 @@ u8 ScriptGiveMon(u16 species, u8 level, u16 item, u32 unused1, u32 unused2, u8 u
{
case 0:
case 1:
GetSetPokedexFlag(nationalDexNum, 2);
GetSetPokedexFlag(nationalDexNum, 3);
GetSetPokedexFlag(nationalDexNum, FLAG_SET_SEEN);
GetSetPokedexFlag(nationalDexNum, FLAG_SET_CAUGHT);
break;
}
return sentToPc;

View File

@ -3229,7 +3229,7 @@ u16 TV_GetSomeOtherSpeciesAlreadySeenByPlayer(u16 passedSpecies)
species = (Random() % (NUM_SPECIES - 1)) + 1;
initSpecies = species;
while (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), 0) != 1 || species == passedSpecies)
while (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_SEEN) != TRUE || species == passedSpecies)
{
if (species == 1)
{
@ -4376,7 +4376,7 @@ void SetTvShowInactive(u8 showIdx)
static void sub_80F0B24(u16 species, u8 showIdx)
{
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), 0) == 0)
if (!GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_SEEN))
{
gSaveBlock1Ptr->tvShows[showIdx].common.active = FALSE;
}

View File

@ -63,7 +63,7 @@ gUnknown_030061A0: @ 30061A0
gUnknown_030061C0: @ 30061C0
.space 0x4
gUnknown_030061C4: @ 30061C4
gContestPaintingMonPalette: @ 30061C4
.space 0xC
.include "field_specials.o"
@ -77,16 +77,7 @@ gDexCryScreenState: @ 30061EC
.include "save.o"
.include "battle_tower.o"
.include "intro.o"
gUnknown_030062DC: @ 30062DC
.space 0x4
gUnknown_030062E0: @ 30062E0
.space 0x4
gUnknown_030062E4: @ 30062E4
.space 0x4
.include "battle_anim_8170478.o"
.include "battle_factory_screen.o"
.include "apprentice.o"

View File

@ -285,8 +285,7 @@ gUnknown_0203A034: @ 203A034
gUnknown_0203A0F4: @ 203A0F4
.space 0x4
gUnknown_0203A0F8: @ 203A0F8
.space 0x8
.include "src/battle_anim_effects_1.o"
gUnknown_0203A100: @ 203A100
.space 0x10