From b7cfa9d36537b8ae53012eb88d59f8b842fb35c4 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Fri, 8 Mar 2019 21:39:51 -0500 Subject: [PATCH 001/101] Move more contest constants into C --- data/contest.s | 138 ------------------- include/graphics.h | 8 ++ include/sprite.h | 20 +++ ld_script.txt | 1 + src/contest.c | 337 +++++++++++++++++++++++++++++++++++++++++++-- 5 files changed, 351 insertions(+), 153 deletions(-) diff --git a/data/contest.s b/data/contest.s index 48bfa1080..a0aaa62f2 100644 --- a/data/contest.s +++ b/data/contest.s @@ -6,144 +6,6 @@ .section .rodata .align 2, 0 -gUnknown_08587A6C:: @ 8587A6C - .byte 0x24, 0x4c, 0x74, 0x9c - -gUnknown_08587A70:: @ 8587A70 - .byte 0x24, 0x4c, 0x74, 0x9c - - .align 2 -gUnknown_08587A74:: @ 8587A74 - obj_tiles gTiles_8C19450, 0x0020, 0x4e20 - - .align 2 -gOamData_8587A7C:: @ 8587A7C - .2byte 0x0000 - .2byte 0x0000 - .2byte 0x0000 - - .align 2 -gSpriteAffineAnim_8587A84:: @ 8587A84 - obj_rot_scal_anim_frame 0x100, 0x100, 0, 0 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnim_8587A94:: @ 8587A94 - obj_rot_scal_anim_frame 0x100, 0x100, 0, 0 - obj_rot_scal_anim_frame 0xFFF6, 0xFFF6, -20, 20 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnim_8587AAC:: @ 8587AAC - obj_rot_scal_anim_frame 0x38, 0x38, 0, 0 - obj_rot_scal_anim_frame 0xA, 0xA, 20, 20 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnimTable_8587AC4:: @ 8587AC4 - .4byte gSpriteAffineAnim_8587A84 - .4byte gSpriteAffineAnim_8587A94 - .4byte gSpriteAffineAnim_8587AAC - - .align 2 -gSpriteTemplate_8587AD0:: @ 8587AD0 - spr_template 0x4e20, 0xabe0, gOamData_8587A7C, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_8587AC4, SpriteCallbackDummy - - .align 2 -gUnknown_08587AE8:: @ 8587AE8 - obj_tiles gContestNextTurnGfx, 0x0100, 0x4e22 - obj_tiles gContestNextTurnGfx, 0x0100, 0x4e23 - obj_tiles gContestNextTurnGfx, 0x0100, 0x4e24 - obj_tiles gContestNextTurnGfx, 0x0100, 0x4e25 - - .align 2 -gUnknown_08587B08:: @ 8587B08 - obj_pal gContestPal, 0x4e22 - - .align 2 -gOamData_8587B10:: @ 8587B10 - .2byte 0x4000 - .2byte 0x4000 - .2byte 0x0000 - - .align 2 -gSpriteTemplate_8587B18:: @ 8587B18 - spr_template 0x4e22, 0x4e22, gOamData_8587B10, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - spr_template 0x4e23, 0x4e22, gOamData_8587B10, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - spr_template 0x4e24, 0x4e22, gOamData_8587B10, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - spr_template 0x4e25, 0x4e22, gOamData_8587B10, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gSubspriteTable_8587B78:: @ 8587B78 - subsprite -28, -4, 0, 0, 32x8 - subsprite 4, -4, 0, 4, 32x8 - - .align 2 -gSubspriteTables_8587B80:: @ 8587B80 - .4byte 2, gSubspriteTable_8587B78 - - .align 2 -gUnknown_08587B88:: @ 8587B88 - obj_tiles gUnknown_08C19168, 0x0180, 0xabe1 - - .align 2 -gOamData_8587B90:: @ 8587B90 - .2byte 0x0000 - .2byte 0x4000 - .2byte 0x0000 - - .align 2 -gSpriteTemplate_8587B98:: @ 8587B98 - spr_template 0xabe1, 0xabe0, gOamData_8587B90, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_08587BB0:: @ 8587BB0 - obj_tiles gContestApplauseGfx, 0x0400, 0xabe2 - - .align 2 -gUnknown_08587BB8:: @ 8587BB8 - obj_pal gContestPal, 0xabe2 - - .align 2 -gOamData_8587BC0:: @ 8587BC0 - .2byte 0x4000 - .2byte 0xC000 - .2byte 0x0000 - - .align 2 -gSpriteTemplate_8587BC8:: @ 8587BC8 - spr_template 0xabe2, 0xabe2, gOamData_8587BC0, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gOamData_8587BE0:: @ 8587BE0 - .2byte 0x0000 - .2byte 0xC000 - .2byte 0x2C00 - - .align 2 -gSpriteTemplate_8587BE8:: @ 8587BE8 - spr_template 0x4e21, 0x4e21, gOamData_8587BE0, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_08587C00:: @ 8587C00 - obj_tiles gContestJudgeGfx, 0x0800, 0x4e21 - - .align 2 -gUnknown_08587C08:: @ 8587C08 - obj_tiles gContestJudgeSymbolsGfx, 0x0380, 0xabe0 - - .align 2 -gUnknown_08587C10:: @ 8587C10 - obj_pal gContest3Pal, 0xabe0 - - .align 2 -gSpriteTemplate_8587C18:: @ 8587C18 - spr_template 0xabe0, 0xabe0, gUnknown_0852490C, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_08587C30:: @ 8587C30 - .incbin "graphics/unknown/unknown_587C30.gbapal" - @ 8587C50 .include "data/text/contest_text_pointers.inc" diff --git a/include/graphics.h b/include/graphics.h index c651268ca..063f71ee5 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4765,6 +4765,14 @@ extern const u32 gUnknown_08C16FA8[]; extern const u32 gUnknown_08C16E90[]; extern const u32 gUnknown_08C17170[]; extern const u32 gUnknown_08C17980[]; +extern const u32 gTiles_8C19450[]; +extern const u32 gContestNextTurnGfx[]; +extern const u16 gContestPal[]; +extern const u32 gUnknown_08C19168[]; +extern const u32 gContestApplauseGfx[]; +extern const u32 gContestJudgeGfx[]; +extern const u32 gContestJudgeSymbolsGfx[]; +extern const u32 gContest3Pal[]; extern const u32 gUnknown_08D95E00[]; extern const u32 gUnknown_08D960D0[]; diff --git a/include/sprite.h b/include/sprite.h index 32bdd9c55..10c4145b0 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -151,6 +151,26 @@ enum SUBSPRITES_IGNORE_PRIORITY, // on but priority is ignored }; +#define OAM_SIZE_0 (0) +#define OAM_SIZE_1 (1 << 0) +#define OAM_SIZE_2 (1 << 1) +#define OAM_SIZE_3 (1 << 2) + +#define SPRITE_SIZE_8x8 .shape = ST_OAM_SQUARE, .size = OAM_SIZE_0 +#define SPRITE_SIZE_16x16 .shape = ST_OAM_SQUARE, .size = OAM_SIZE_1 +#define SPRITE_SIZE_32x32 .shape = ST_OAM_SQUARE, .size = OAM_SIZE_2 +#define SPRITE_SIZE_64x64 .shape = ST_OAM_SQUARE, .size = OAM_SIZE_3 + +#define SPRITE_SIZE_16x8 .shape = ST_OAM_H_RECTANGLE, .size = OAM_SIZE_0 +#define SPRITE_SIZE_32x8 .shape = ST_OAM_H_RECTANGLE, .size = OAM_SIZE_1 +#define SPRITE_SIZE_32x16 .shape = ST_OAM_H_RECTANGLE, .size = OAM_SIZE_2 +#define SPRITE_SIZE_64x32 .shape = ST_OAM_H_RECTANGLE, .size = OAM_SIZE_3 + +#define SPRITE_SIZE_8x16 .shape = ST_OAM_V_RECTANGLE, .size = OAM_SIZE_0 +#define SPRITE_SIZE_8x32 .shape = ST_OAM_V_RECTANGLE, .size = OAM_SIZE_1 +#define SPRITE_SIZE_16x32 .shape = ST_OAM_V_RECTANGLE, .size = OAM_SIZE_2 +#define SPRITE_SIZE_32x64 .shape = ST_OAM_V_RECTANGLE, .size = OAM_SIZE_3 + struct Subsprite { s8 x; // was u16 in R/S diff --git a/ld_script.txt b/ld_script.txt index e60badcc2..b87bb34f3 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -461,6 +461,7 @@ SECTIONS { src/item_menu_icons.o(.rodata); src/battle_anim_80D51AC.o(.rodata); src/item.o(.rodata); + src/contest.o(.rodata); data/contest.o(.rodata); src/shop.o(.rodata); src/fldeff_escalator.o(.rodata); diff --git a/src/contest.c b/src/contest.c index 114a1fb69..241d38e48 100644 --- a/src/contest.c +++ b/src/contest.c @@ -218,7 +218,6 @@ EWRAM_DATA u8 gUnknown_02039F5D = 0; // IWRAM common vars. u32 gContestRngValue; -extern const u16 gUnknown_08587C30[]; extern const struct BgTemplate gUnknown_08587F34[4]; extern const struct WindowTemplate gUnknown_08587F44[]; extern const u8 *const gUnknown_08587D90[]; @@ -250,25 +249,11 @@ extern const u8 gText_CDot[]; extern const u8 *const gUnknown_08587E10[]; extern const struct ContestPokemon gContestOpponents[96]; extern const u8 gUnknown_085898A4[96]; -extern const struct CompressedSpriteSheet gUnknown_08587C00; -extern const struct SpriteTemplate gSpriteTemplate_8587BE8; -extern const struct CompressedSpriteSheet gUnknown_08587C08; -extern const struct CompressedSpritePalette gUnknown_08587C10; -extern const struct SpriteTemplate gSpriteTemplate_8587C18; extern const union AffineAnimCmd *const gUnknown_082FF6C0[]; extern const union AffineAnimCmd *const gUnknown_082FF694[]; extern const u8 *const gContestEffectDescriptionPointers[]; -extern const struct SpriteSheet gUnknown_08587A74; -extern const u8 gUnknown_08587A6C[]; extern const struct SpriteTemplate gSpriteTemplate_8587AD0; -extern const struct SpritePalette gUnknown_08587B08; -extern const struct CompressedSpriteSheet gUnknown_08587AE8[]; extern const struct SpriteTemplate gSpriteTemplate_8587B18[]; -extern const u8 gUnknown_08587A70[]; -extern const struct SubspriteTable gSubspriteTables_8587B80[]; -extern const struct CompressedSpriteSheet gUnknown_08587BB0; -extern const struct SpritePalette gUnknown_08587BB8; -extern const struct SpriteTemplate gSpriteTemplate_8587BC8; extern void (*const gContestEffectFuncs[])(void); extern const s8 gContestExcitementTable[][5]; extern const struct ContestWinner gUnknown_08587FA4[]; @@ -276,6 +261,328 @@ extern const struct CompressedSpriteSheet gUnknown_08589904[]; extern const struct SpritePalette gUnknown_08589924[]; extern const struct SpriteTemplate gSpriteTemplate_858998C[]; +static const u8 gUnknown_08587A6C[] = +{ + 0x24, 0x4C, 0x74, 0x9C +}; + +static const u8 gUnknown_08587A70[] = +{ + 0x24, 0x4C, 0x74, 0x9C +}; + +static const struct SpriteSheet gUnknown_08587A74 = +{ + .data = gTiles_8C19450, + .size = 0x20, + .tag = 0x4E20 +}; + +static const struct OamData gOamData_8587A7C = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 0, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +static const union AffineAnimCmd gSpriteAffineAnim_8587A84[] = +{ + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMD_END, +}; + +static const union AffineAnimCmd gSpriteAffineAnim_8587A94[] = +{ + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(0xFFF6, 0xFFF6, -20, 20), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd gSpriteAffineAnim_8587AAC[] = +{ + AFFINEANIMCMD_FRAME(0x38, 0x38, 0, 0), + AFFINEANIMCMD_FRAME(10, 10, 20, 20), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd* const gSpriteAffineAnimTable_8587AC4[] = +{ + gSpriteAffineAnim_8587A84, + gSpriteAffineAnim_8587A94, + gSpriteAffineAnim_8587AAC +}; + +static const struct SpriteTemplate gSpriteTemplate_8587AD0 = +{ + .tileTag = 0x4E20, + .paletteTag = 0xABE0, + .oam = &gOamData_8587A7C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_8587AC4, + .callback = SpriteCallbackDummy +}; + +static const struct CompressedSpriteSheet gUnknown_08587AE8[] = +{ + { + .data = gContestNextTurnGfx, + .size = 0x100, + .tag = 0x4E22 + }, + { + .data = gContestNextTurnGfx, + .size = 0x100, + .tag = 0x4E23 + }, + { + .data = gContestNextTurnGfx, + .size = 0x100, + .tag = 0x4E24 + }, + { + .data = gContestNextTurnGfx, + .size = 0x100, + .tag = 0x4E25 + } +}; + +static const struct SpritePalette gUnknown_08587B08 = +{ + .data = gContestPal, + .tag = 0x4E22 +}; + +static const struct OamData gOamData_8587B10 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 1, + .x = 0, + .matrixNum = 0, + .size = 1, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +static const struct SpriteTemplate gSpriteTemplate_8587B18[] = +{ + { + .tileTag = 0x4E22, + .paletteTag = 0x4E22, + .oam = &gOamData_8587B10, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 0x4E23, + .paletteTag = 0x4E22, + .oam = &gOamData_8587B10, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 0x4E24, + .paletteTag = 0x4E22, + .oam = &gOamData_8587B10, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + }, + { + .tileTag = 0x4E25, + .paletteTag = 0x4E22, + .oam = &gOamData_8587B10, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy, + } +}; + +const struct Subsprite gSubspriteTable_8587B78[] = +{ + { + .x = -28, + .y = -4, + SPRITE_SIZE_32x8, + .tileOffset = 0, + .priority = 0 + }, + { + .x = 4, + .y = -4, + SPRITE_SIZE_32x8, + .tileOffset = 4, + .priority = 0 + } +}; + +const struct SubspriteTable gSubspriteTables_8587B80[] = +{ + { + .subspriteCount = 2, + .subsprites = gSubspriteTable_8587B78 + } +}; + +const struct CompressedSpriteSheet gUnknown_08587B88 = +{ + .data = gUnknown_08C19168, + .size = 0x180, + .tag = 0xABE1 +}; + +const struct OamData gOamData_8587B90 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 1, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +const struct SpriteTemplate gSpriteTemplate_8587B98 = +{ + .tileTag = 0xABE1, + .paletteTag = 0xABE0, + .oam = &gOamData_8587B90, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +const struct CompressedSpriteSheet gUnknown_08587BB0 = +{ + .data = gContestApplauseGfx, + .size = 0x400, + .tag = 0xABE2 +}; + +const struct SpritePalette gUnknown_08587BB8 = +{ + .data = gContestPal, + .tag = 0xABE2 +}; + +const struct OamData gOamData_8587BC0 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 1, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +const struct SpriteTemplate gSpriteTemplate_8587BC8 = +{ + .tileTag = 0xABE2, + .paletteTag = 0xABE2, + .oam = &gOamData_8587BC0, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +const struct OamData gOamData_8587BE0 = +{ + .y = 0, + .affineMode = 0, + .objMode = 0, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 3, + .paletteNum = 2, + .affineParam = 0 +}; + +const struct SpriteTemplate gSpriteTemplate_8587BE8 = +{ + .tileTag = 0x4E21, + .paletteTag = 0x4E21, + .oam = &gOamData_8587BE0, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +const struct CompressedSpriteSheet gUnknown_08587C00 = +{ + .data = gContestJudgeGfx, + .size = 0x800, + .tag = 0x4E21 +}; + +const struct CompressedSpriteSheet gUnknown_08587C08 = +{ + .data = gContestJudgeSymbolsGfx, + .size = 0x380, + .tag = 0xABE0 +}; + +const struct CompressedSpritePalette gUnknown_08587C10 = +{ + .data = gContest3Pal, + .tag = 0xABE0 +}; + +const struct SpriteTemplate gSpriteTemplate_8587C18 = +{ + .tileTag = 0xABE0, + .paletteTag = 0xABE0, + .oam = &gUnknown_0852490C, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +const u16 gUnknown_08587C30[] = INCBIN_U16("graphics/unknown/unknown_587C30.gbapal"); + static void TaskDummy1(u8 taskId) { } From 88c37818800e1216dc7d40cfefa0a9ab5f249671 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Fri, 8 Mar 2019 22:33:40 -0500 Subject: [PATCH 002/101] Move text pointer tables into C --- data/contest.s | 136 --------- data/text/contest_text_pointers.inc | 78 ------ src/contest.c | 6 +- src/data/contest_text_tables.h | 414 ++++++++++++++++++++++++++++ 4 files changed, 416 insertions(+), 218 deletions(-) delete mode 100644 data/text/contest_text_pointers.inc create mode 100644 src/data/contest_text_tables.h diff --git a/data/contest.s b/data/contest.s index a0aaa62f2..aba96d54f 100644 --- a/data/contest.s +++ b/data/contest.s @@ -6,142 +6,6 @@ .section .rodata .align 2, 0 -@ 8587C50 - .include "data/text/contest_text_pointers.inc" - - .align 2 -gUnknown_08587D5C:: @ 8587D5C - .4byte gText_0827D5C1 - .4byte gText_0827D5DC - .4byte gText_0827D600 - .4byte gText_0827D612 - .4byte gText_0827D612 - .4byte gText_0827D62D - .4byte gText_0827D654 - .4byte gText_0827D67E - .4byte gText_0827D69C - .4byte gText_0827D6BA - .4byte gText_0827D6E5 - .4byte gText_0827D706 - .4byte gText_0827D71D - - .align 2 -gUnknown_08587D90:: @ 8587D90 - .4byte gText_0827D743 - .4byte gText_0827D764 - .4byte gText_0827D785 - .4byte gText_0827D7A5 - .4byte gText_0827D7C8 - .4byte gText_0827D7E8 - .4byte gText_0827D831 - .4byte gText_0827D855 - .4byte gText_0827D830 - .4byte gText_0827D872 - .4byte gText_0827D88F - .4byte gText_0827D8B5 - .4byte gText_0827D8E4 - .4byte gText_0827D8FE - .4byte gText_0827D926 - .4byte gText_0827D947 - .4byte gText_0827D961 - .4byte gText_0827D986 - .4byte gText_0827D9B1 - .4byte gText_0827D9D9 - .4byte gText_0827DA03 - .4byte gText_0827DA31 - .4byte gText_0827DA5B - .4byte gText_0827DA85 - .4byte gText_0827DAB2 - .4byte gText_0827DADA - .4byte gText_0827DB03 - .4byte gText_0827D830 - .4byte gText_0827D830 - .4byte gText_0827D830 - .4byte gText_0827DB1F - .4byte gText_0827DB4E - - .align 2 -gUnknown_08587E10:: @ 8587E10 - .4byte gText_827DB75 - .4byte gText_827DBB0 - .4byte gText_827DBE0 - .4byte gText_827DC0F - .4byte gText_827DC45 - .4byte gText_827DC7C - .4byte gText_827DCB4 - .4byte gText_827DCE7 - .4byte gText_827DD12 - .4byte gText_827DD3D - .4byte gText_827DD6F - .4byte gText_827DD8E - .4byte gText_827DDC7 - .4byte gText_827DDF2 - .4byte gText_827DE14 - .4byte gText_827DE44 - .4byte gText_827DE73 - .4byte gText_827DEA5 - .4byte gText_827DED9 - .4byte gText_827DF02 - .4byte gText_827DF3A - .4byte gText_827DF63 - .4byte gText_827DF8C - .4byte gText_827DFB8 - .4byte gText_827DFE2 - .4byte gText_827E00C - .4byte gText_827E02F - .4byte gText_827E05F - .4byte gText_827E08B - .4byte gText_827E0B5 - .4byte gText_827E0DD - .4byte gText_827E107 - .4byte gText_827E143 - .4byte gText_827E17F - .4byte gText_827E1BB - .4byte gText_827E1F3 - .4byte gText_827E220 - .4byte gText_827E254 - .4byte gText_827E289 - .4byte gText_827E2C5 - .4byte gText_0827E2FE - .4byte gText_0827E32E - .4byte gText_0827E35B - .4byte gText_0827E38D - .4byte gText_0827E3C1 - .4byte gText_0827E3EB - .4byte gText_0827E416 - .4byte gText_0827E448 - .4byte gText_0827E473 - .4byte gText_0827E4A6 - .4byte gText_0827E4D5 - .4byte gText_0827E504 - .4byte gText_0827E531 - .4byte gText_0827E55A - .4byte gText_0827E5B2 - .4byte gText_0827E5D0 - .4byte gText_0827E606 - .4byte gText_0827E638 - .4byte gText_0827E658 - .4byte gText_0827E68B - .4byte gText_0827E6C4 - .4byte gText_0827E7BA - - .align 2 -gUnknown_08587F08:: @ 8587F08 - .4byte gText_0827E85F - .4byte gText_0827E868 - .4byte gText_0827E86F - .4byte gText_0827E878 - .4byte gText_0827E882 - - .align 2 -gUnknown_08587F1C:: @ 8587F1C - .4byte gText_0827E894 - .4byte gText_0827E89E - .4byte gText_0827E8AA - .4byte gText_0827E8B4 - .4byte gText_0827E8BF - .4byte gText_0827E8CA - .align 2 gUnknown_08587F34:: @ 8587F34 .4byte 0x00000580, 0x000015e9, 0x000005c2, 0x000031a3 diff --git a/data/text/contest_text_pointers.inc b/data/text/contest_text_pointers.inc deleted file mode 100644 index f9cf4b70e..000000000 --- a/data/text/contest_text_pointers.inc +++ /dev/null @@ -1,78 +0,0 @@ - .align 2 -gContestEffectDescriptionPointers:: @ 8587C50 - .4byte gContestEffect00hDescription - .4byte gContestEffect01hDescription - .4byte gContestEffect02hDescription - .4byte gContestEffect03hDescription - .4byte gContestEffect04hDescription - .4byte gContestEffect05hDescription - .4byte gContestEffect06hDescription - .4byte gContestEffect07hDescription - .4byte gContestEffect08hDescription - .4byte gContestEffect09hDescription - .4byte gContestEffect0AhDescription - .4byte gContestEffect0BhDescription - .4byte gContestEffect0ChDescription - .4byte gContestEffect0DhDescription - .4byte gContestEffect0EhDescription - .4byte gContestEffect0FhDescription - .4byte gContestEffect10hDescription - .4byte gContestEffect11hDescription - .4byte gContestEffect12hDescription - .4byte gContestEffect13hDescription - .4byte gContestEffect14hDescription - .4byte gContestEffect15hDescription - .4byte gContestEffect16hDescription - .4byte gContestEffect17hDescription - .4byte gContestEffect18hDescription - .4byte gContestEffect19hDescription - .4byte gContestEffect1AhDescription - .4byte gContestEffect1BhDescription - .4byte gContestEffect1ChDescription - .4byte gContestEffect1DhDescription - .4byte gContestEffect1EhDescription - .4byte gContestEffect1FhDescription - .4byte gContestEffect20hDescription - .4byte gContestEffect21hDescription - .4byte gContestEffect22hDescription - .4byte gContestEffect23hDescription - .4byte gContestEffect24hDescription - .4byte gContestEffect25hDescription - .4byte gContestEffect26hDescription - .4byte gContestEffect27hDescription - .4byte gContestEffect28hDescription - .4byte gContestEffect29hDescription - .4byte gContestEffect2AhDescription - .4byte gContestEffect2BhDescription - .4byte gContestEffect2ChDescription - .4byte gContestEffect2DhDescription - .4byte gContestEffect2EhDescription - .4byte gContestEffect2FhDescription - -@ 8587D10 -@ Unreferenced array of pointers to move names. -@ All of the moves except Conversion are combo starters, so this may have -@ been an early list of combo starters. - .align 2 - .4byte gUnusedContestMoveName0 - .4byte gUnusedContestMoveName0 - .4byte gUnusedContestMoveName1 - .4byte gUnusedContestMoveName2 - .4byte gUnusedContestMoveName3 - .4byte gUnusedContestMoveName4 - .4byte gUnusedContestMoveName5 - .4byte gUnusedContestMoveName6 - .4byte gUnusedContestMoveName7 - .4byte gUnusedContestMoveName8 - .4byte gUnusedContestMoveName9 - .4byte gUnusedContestMoveName10 - .4byte gUnusedContestMoveName11 - .4byte gUnusedContestMoveName12 - - .align 2 -gContestMoveTypeTextPointers:: @ 8587D48 - .4byte gContestMoveTypeCoolText - .4byte gContestMoveTypeBeautyText - .4byte gContestMoveTypeCuteText - .4byte gContestMoveTypeSmartText - .4byte gContestMoveTypeToughText diff --git a/src/contest.c b/src/contest.c index 241d38e48..afb1c94d7 100644 --- a/src/contest.c +++ b/src/contest.c @@ -220,9 +220,6 @@ u32 gContestRngValue; extern const struct BgTemplate gUnknown_08587F34[4]; extern const struct WindowTemplate gUnknown_08587F44[]; -extern const u8 *const gUnknown_08587D90[]; -extern const u8 *const gUnknown_08587F08[]; -extern const u8 *const gUnknown_08587F1C[]; extern const u8 *const gUnknown_0827E8DA[]; extern const u8 gText_0827D55A[]; extern const u8 gText_0827E793[]; @@ -251,7 +248,6 @@ extern const struct ContestPokemon gContestOpponents[96]; extern const u8 gUnknown_085898A4[96]; extern const union AffineAnimCmd *const gUnknown_082FF6C0[]; extern const union AffineAnimCmd *const gUnknown_082FF694[]; -extern const u8 *const gContestEffectDescriptionPointers[]; extern const struct SpriteTemplate gSpriteTemplate_8587AD0; extern const struct SpriteTemplate gSpriteTemplate_8587B18[]; extern void (*const gContestEffectFuncs[])(void); @@ -583,6 +579,8 @@ const struct SpriteTemplate gSpriteTemplate_8587C18 = const u16 gUnknown_08587C30[] = INCBIN_U16("graphics/unknown/unknown_587C30.gbapal"); +#include "data/contest_text_tables.h" + static void TaskDummy1(u8 taskId) { } diff --git a/src/data/contest_text_tables.h b/src/data/contest_text_tables.h new file mode 100644 index 000000000..fa32f33b5 --- /dev/null +++ b/src/data/contest_text_tables.h @@ -0,0 +1,414 @@ + +#include "global.h" + +extern const u8 gContestEffect00hDescription[]; +extern const u8 gContestEffect01hDescription[]; +extern const u8 gContestEffect02hDescription[]; +extern const u8 gContestEffect03hDescription[]; +extern const u8 gContestEffect04hDescription[]; +extern const u8 gContestEffect05hDescription[]; +extern const u8 gContestEffect06hDescription[]; +extern const u8 gContestEffect07hDescription[]; +extern const u8 gContestEffect08hDescription[]; +extern const u8 gContestEffect09hDescription[]; +extern const u8 gContestEffect0AhDescription[]; +extern const u8 gContestEffect0BhDescription[]; +extern const u8 gContestEffect0ChDescription[]; +extern const u8 gContestEffect0DhDescription[]; +extern const u8 gContestEffect0EhDescription[]; +extern const u8 gContestEffect0FhDescription[]; +extern const u8 gContestEffect10hDescription[]; +extern const u8 gContestEffect11hDescription[]; +extern const u8 gContestEffect12hDescription[]; +extern const u8 gContestEffect13hDescription[]; +extern const u8 gContestEffect14hDescription[]; +extern const u8 gContestEffect15hDescription[]; +extern const u8 gContestEffect16hDescription[]; +extern const u8 gContestEffect17hDescription[]; +extern const u8 gContestEffect18hDescription[]; +extern const u8 gContestEffect19hDescription[]; +extern const u8 gContestEffect1AhDescription[]; +extern const u8 gContestEffect1BhDescription[]; +extern const u8 gContestEffect1ChDescription[]; +extern const u8 gContestEffect1DhDescription[]; +extern const u8 gContestEffect1EhDescription[]; +extern const u8 gContestEffect1FhDescription[]; +extern const u8 gContestEffect20hDescription[]; +extern const u8 gContestEffect21hDescription[]; +extern const u8 gContestEffect22hDescription[]; +extern const u8 gContestEffect23hDescription[]; +extern const u8 gContestEffect24hDescription[]; +extern const u8 gContestEffect25hDescription[]; +extern const u8 gContestEffect26hDescription[]; +extern const u8 gContestEffect27hDescription[]; +extern const u8 gContestEffect28hDescription[]; +extern const u8 gContestEffect29hDescription[]; +extern const u8 gContestEffect2AhDescription[]; +extern const u8 gContestEffect2BhDescription[]; +extern const u8 gContestEffect2ChDescription[]; +extern const u8 gContestEffect2DhDescription[]; +extern const u8 gContestEffect2EhDescription[]; +extern const u8 gContestEffect2FhDescription[]; + +extern const u8 gUnusedContestMoveName0[]; +extern const u8 gUnusedContestMoveName1[]; +extern const u8 gUnusedContestMoveName2[]; +extern const u8 gUnusedContestMoveName3[]; +extern const u8 gUnusedContestMoveName4[]; +extern const u8 gUnusedContestMoveName5[]; +extern const u8 gUnusedContestMoveName6[]; +extern const u8 gUnusedContestMoveName7[]; +extern const u8 gUnusedContestMoveName8[]; +extern const u8 gUnusedContestMoveName9[]; +extern const u8 gUnusedContestMoveName10[]; +extern const u8 gUnusedContestMoveName11[]; +extern const u8 gUnusedContestMoveName12[]; + +extern const u8 gContestMoveTypeCoolText[]; +extern const u8 gContestMoveTypeBeautyText[]; +extern const u8 gContestMoveTypeCuteText[]; +extern const u8 gContestMoveTypeSmartText[]; +extern const u8 gContestMoveTypeToughText[]; + +extern const u8 gText_0827D5C1[]; +extern const u8 gText_0827D5DC[]; +extern const u8 gText_0827D600[]; +extern const u8 gText_0827D612[]; +extern const u8 gText_0827D612[]; +extern const u8 gText_0827D62D[]; +extern const u8 gText_0827D654[]; +extern const u8 gText_0827D67E[]; +extern const u8 gText_0827D69C[]; +extern const u8 gText_0827D6BA[]; +extern const u8 gText_0827D6E5[]; +extern const u8 gText_0827D706[]; +extern const u8 gText_0827D71D[]; + +extern const u8 gText_0827D743[]; +extern const u8 gText_0827D764[]; +extern const u8 gText_0827D785[]; +extern const u8 gText_0827D7A5[]; +extern const u8 gText_0827D7C8[]; +extern const u8 gText_0827D7E8[]; +extern const u8 gText_0827D831[]; +extern const u8 gText_0827D855[]; +extern const u8 gText_0827D830[]; +extern const u8 gText_0827D872[]; +extern const u8 gText_0827D88F[]; +extern const u8 gText_0827D8B5[]; +extern const u8 gText_0827D8E4[]; +extern const u8 gText_0827D8FE[]; +extern const u8 gText_0827D926[]; +extern const u8 gText_0827D947[]; +extern const u8 gText_0827D961[]; +extern const u8 gText_0827D986[]; +extern const u8 gText_0827D9B1[]; +extern const u8 gText_0827D9D9[]; +extern const u8 gText_0827DA03[]; +extern const u8 gText_0827DA31[]; +extern const u8 gText_0827DA5B[]; +extern const u8 gText_0827DA85[]; +extern const u8 gText_0827DAB2[]; +extern const u8 gText_0827DADA[]; +extern const u8 gText_0827DB03[]; +extern const u8 gText_0827D830[]; +extern const u8 gText_0827D830[]; +extern const u8 gText_0827D830[]; +extern const u8 gText_0827DB1F[]; +extern const u8 gText_0827DB4E[]; + +extern const u8 gText_827DB75[]; +extern const u8 gText_827DBB0[]; +extern const u8 gText_827DBE0[]; +extern const u8 gText_827DC0F[]; +extern const u8 gText_827DC45[]; +extern const u8 gText_827DC7C[]; +extern const u8 gText_827DCB4[]; +extern const u8 gText_827DCE7[]; +extern const u8 gText_827DD12[]; +extern const u8 gText_827DD3D[]; +extern const u8 gText_827DD6F[]; +extern const u8 gText_827DD8E[]; +extern const u8 gText_827DDC7[]; +extern const u8 gText_827DDF2[]; +extern const u8 gText_827DE14[]; +extern const u8 gText_827DE44[]; +extern const u8 gText_827DE73[]; +extern const u8 gText_827DEA5[]; +extern const u8 gText_827DED9[]; +extern const u8 gText_827DF02[]; +extern const u8 gText_827DF3A[]; +extern const u8 gText_827DF63[]; +extern const u8 gText_827DF8C[]; +extern const u8 gText_827DFB8[]; +extern const u8 gText_827DFE2[]; +extern const u8 gText_827E00C[]; +extern const u8 gText_827E02F[]; +extern const u8 gText_827E05F[]; +extern const u8 gText_827E08B[]; +extern const u8 gText_827E0B5[]; +extern const u8 gText_827E0DD[]; +extern const u8 gText_827E107[]; +extern const u8 gText_827E143[]; +extern const u8 gText_827E17F[]; +extern const u8 gText_827E1BB[]; +extern const u8 gText_827E1F3[]; +extern const u8 gText_827E220[]; +extern const u8 gText_827E254[]; +extern const u8 gText_827E289[]; +extern const u8 gText_827E2C5[]; +extern const u8 gText_0827E2FE[]; +extern const u8 gText_0827E32E[]; +extern const u8 gText_0827E35B[]; +extern const u8 gText_0827E38D[]; +extern const u8 gText_0827E3C1[]; +extern const u8 gText_0827E3EB[]; +extern const u8 gText_0827E416[]; +extern const u8 gText_0827E448[]; +extern const u8 gText_0827E473[]; +extern const u8 gText_0827E4A6[]; +extern const u8 gText_0827E4D5[]; +extern const u8 gText_0827E504[]; +extern const u8 gText_0827E531[]; +extern const u8 gText_0827E55A[]; +extern const u8 gText_0827E5B2[]; +extern const u8 gText_0827E5D0[]; +extern const u8 gText_0827E606[]; +extern const u8 gText_0827E638[]; +extern const u8 gText_0827E658[]; +extern const u8 gText_0827E68B[]; +extern const u8 gText_0827E6C4[]; +extern const u8 gText_0827E7BA[]; + +extern const u8 gText_0827E85F[]; +extern const u8 gText_0827E868[]; +extern const u8 gText_0827E86F[]; +extern const u8 gText_0827E878[]; +extern const u8 gText_0827E882[]; + +extern const u8 gText_0827E894[]; +extern const u8 gText_0827E89E[]; +extern const u8 gText_0827E8AA[]; +extern const u8 gText_0827E8B4[]; +extern const u8 gText_0827E8BF[]; +extern const u8 gText_0827E8CA[]; + +const u8 *const gContestEffectDescriptionPointers[] = +{ + gContestEffect00hDescription, + gContestEffect01hDescription, + gContestEffect02hDescription, + gContestEffect03hDescription, + gContestEffect04hDescription, + gContestEffect05hDescription, + gContestEffect06hDescription, + gContestEffect07hDescription, + gContestEffect08hDescription, + gContestEffect09hDescription, + gContestEffect0AhDescription, + gContestEffect0BhDescription, + gContestEffect0ChDescription, + gContestEffect0DhDescription, + gContestEffect0EhDescription, + gContestEffect0FhDescription, + gContestEffect10hDescription, + gContestEffect11hDescription, + gContestEffect12hDescription, + gContestEffect13hDescription, + gContestEffect14hDescription, + gContestEffect15hDescription, + gContestEffect16hDescription, + gContestEffect17hDescription, + gContestEffect18hDescription, + gContestEffect19hDescription, + gContestEffect1AhDescription, + gContestEffect1BhDescription, + gContestEffect1ChDescription, + gContestEffect1DhDescription, + gContestEffect1EhDescription, + gContestEffect1FhDescription, + gContestEffect20hDescription, + gContestEffect21hDescription, + gContestEffect22hDescription, + gContestEffect23hDescription, + gContestEffect24hDescription, + gContestEffect25hDescription, + gContestEffect26hDescription, + gContestEffect27hDescription, + gContestEffect28hDescription, + gContestEffect29hDescription, + gContestEffect2AhDescription, + gContestEffect2BhDescription, + gContestEffect2ChDescription, + gContestEffect2DhDescription, + gContestEffect2EhDescription, + gContestEffect2FhDescription +}; + +// Unreferenced array of pointers to move names. +// All of the moves except Conversion are combo starters, so this may have +// been an early list of combo starters. +const u8 *const gUnknown_8587D10[] = +{ + gUnusedContestMoveName0, + gUnusedContestMoveName0, + gUnusedContestMoveName1, + gUnusedContestMoveName2, + gUnusedContestMoveName3, + gUnusedContestMoveName4, + gUnusedContestMoveName5, + gUnusedContestMoveName6, + gUnusedContestMoveName7, + gUnusedContestMoveName8, + gUnusedContestMoveName9, + gUnusedContestMoveName10, + gUnusedContestMoveName11, + gUnusedContestMoveName12 +}; + +const u8 *const gContestMoveTypeTextPointers[] = +{ + gContestMoveTypeCoolText, + gContestMoveTypeBeautyText, + gContestMoveTypeCuteText, + gContestMoveTypeSmartText, + gContestMoveTypeToughText +}; + +const u8 *const gUnknown_08587D5C[] = +{ + gText_0827D5C1, + gText_0827D5DC, + gText_0827D600, + gText_0827D612, + gText_0827D612, + gText_0827D62D, + gText_0827D654, + gText_0827D67E, + gText_0827D69C, + gText_0827D6BA, + gText_0827D6E5, + gText_0827D706, + gText_0827D71D +}; + +const u8 *const gUnknown_08587D90[] = +{ + gText_0827D743, + gText_0827D764, + gText_0827D785, + gText_0827D7A5, + gText_0827D7C8, + gText_0827D7E8, + gText_0827D831, + gText_0827D855, + gText_0827D830, + gText_0827D872, + gText_0827D88F, + gText_0827D8B5, + gText_0827D8E4, + gText_0827D8FE, + gText_0827D926, + gText_0827D947, + gText_0827D961, + gText_0827D986, + gText_0827D9B1, + gText_0827D9D9, + gText_0827DA03, + gText_0827DA31, + gText_0827DA5B, + gText_0827DA85, + gText_0827DAB2, + gText_0827DADA, + gText_0827DB03, + gText_0827D830, + gText_0827D830, + gText_0827D830, + gText_0827DB1F, + gText_0827DB4E +}; + +const u8 *const gUnknown_08587E10[] = +{ + gText_827DB75, + gText_827DBB0, + gText_827DBE0, + gText_827DC0F, + gText_827DC45, + gText_827DC7C, + gText_827DCB4, + gText_827DCE7, + gText_827DD12, + gText_827DD3D, + gText_827DD6F, + gText_827DD8E, + gText_827DDC7, + gText_827DDF2, + gText_827DE14, + gText_827DE44, + gText_827DE73, + gText_827DEA5, + gText_827DED9, + gText_827DF02, + gText_827DF3A, + gText_827DF63, + gText_827DF8C, + gText_827DFB8, + gText_827DFE2, + gText_827E00C, + gText_827E02F, + gText_827E05F, + gText_827E08B, + gText_827E0B5, + gText_827E0DD, + gText_827E107, + gText_827E143, + gText_827E17F, + gText_827E1BB, + gText_827E1F3, + gText_827E220, + gText_827E254, + gText_827E289, + gText_827E2C5, + gText_0827E2FE, + gText_0827E32E, + gText_0827E35B, + gText_0827E38D, + gText_0827E3C1, + gText_0827E3EB, + gText_0827E416, + gText_0827E448, + gText_0827E473, + gText_0827E4A6, + gText_0827E4D5, + gText_0827E504, + gText_0827E531, + gText_0827E55A, + gText_0827E5B2, + gText_0827E5D0, + gText_0827E606, + gText_0827E638, + gText_0827E658, + gText_0827E68B, + gText_0827E6C4, + gText_0827E7BA +}; + +const u8 *const gUnknown_08587F08[] = +{ + gText_0827E85F, + gText_0827E868, + gText_0827E86F, + gText_0827E878, + gText_0827E882 +}; + +const u8 *const gUnknown_08587F1C[] = +{ + gText_0827E894, + gText_0827E89E, + gText_0827E8AA, + gText_0827E8B4, + gText_0827E8BF, + gText_0827E8CA +}; \ No newline at end of file From 5b4b0a245be14b7485c3e2cc40e40c78eeaa7ce0 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Sat, 9 Mar 2019 00:00:10 -0500 Subject: [PATCH 003/101] Move contest winner list to C --- data/contest.s | 70 ---------------- include/contest.h | 8 ++ src/contest.c | 149 ++++++++++++++++++++++++++++++++++- src/data/contest_opponents.h | 80 +++++++++++++++++++ 4 files changed, 234 insertions(+), 73 deletions(-) create mode 100644 src/data/contest_opponents.h diff --git a/data/contest.s b/data/contest.s index aba96d54f..851af78c5 100644 --- a/data/contest.s +++ b/data/contest.s @@ -6,76 +6,6 @@ .section .rodata .align 2, 0 - .align 2 -gUnknown_08587F34:: @ 8587F34 - .4byte 0x00000580, 0x000015e9, 0x000005c2, 0x000031a3 - - .align 2 -gUnknown_08587F44:: @ 8587F44 - window_template 0x00, 0x12, 0x00, 0x0c, 0x02, 0x0f, 0x0200 - window_template 0x00, 0x12, 0x05, 0x0c, 0x02, 0x0f, 0x0218 - window_template 0x00, 0x12, 0x0a, 0x0c, 0x02, 0x0f, 0x0230 - window_template 0x00, 0x12, 0x0f, 0x0c, 0x02, 0x0f, 0x0248 - window_template 0x00, 0x01, 0x0f, 0x11, 0x04, 0x0f, 0x0260 - window_template 0x00, 0x01, 0x1f, 0x09, 0x02, 0x0f, 0x02a4 - window_template 0x00, 0x01, 0x21, 0x09, 0x02, 0x0f, 0x02b6 - window_template 0x00, 0x01, 0x23, 0x09, 0x02, 0x0f, 0x02c8 - window_template 0x00, 0x01, 0x25, 0x09, 0x02, 0x0f, 0x02da - window_template 0x00, 0x10, 0x1f, 0x01, 0x02, 0x0f, 0x02ec - window_template 0x00, 0x0b, 0x23, 0x12, 0x04, 0x0f, 0x02ee - null_window_template - - .align 2 -gUnknown_08587FA4:: @ 8587FA4 - .4byte NULL, 0xFFFF - .2byte SPECIES_ELECTRIKE - .byte 2 - .string "ELECTER$", 11 - .string "EZRA$", 8 - .2byte 0 - .4byte NULL, 0xFFFF - .2byte SPECIES_TROPIUS - .byte 0 - .string "TROPO$", 11 - .string "ALLAN$", 8 - .2byte 2 - .4byte NULL, 0xFFFF - .2byte SPECIES_XATU - .byte 1 - .string "TUXA$", 11 - .string "JULIET$", 8 - .2byte 0 - .4byte NULL, 0xFFFF - .2byte SPECIES_PLUSLE - .byte 4 - .string "PULSE$", 11 - .string "BAILY$", 8 - .2byte 3 - .4byte NULL, 0xFFFF - .2byte SPECIES_SHUPPET - .byte 3 - .string "SHUPUP$", 11 - .string "MELANY$", 8 - .2byte 1 - .4byte NULL, 0xFFFF - .2byte SPECIES_ZANGOOSE - .byte 0 - .string "GOOZAN$", 11 - .string "HANA$", 8 - .2byte 2 - .4byte NULL, 0xFFFF - .2byte SPECIES_LOUDRED - .byte 1 - .string "LOUDED$", 11 - .string "BRYANT$", 8 - .2byte 2 - .4byte NULL, 0xFFFF - .2byte SPECIES_DELCATTY - .byte 2 - .string "KITSY$", 11 - .string "OMAR$", 8 - .2byte 3 - .align 2 gContestOpponents:: @ 85880A4 diff --git a/include/contest.h b/include/contest.h index 8146486cb..4fbec9d22 100644 --- a/include/contest.h +++ b/include/contest.h @@ -196,6 +196,14 @@ enum CONTEST_STRING_NONE = 255 }; +enum { + CONTEST_RANK_NORMAL, + CONTEST_RANK_SUPER, + CONTEST_RANK_HYPER, + CONTEST_RANK_MASTER, + CONTEST_RANK_LINK +}; + struct ContestPokemon { /*0x00*/ u16 species; diff --git a/src/contest.c b/src/contest.c index afb1c94d7..09847f6b6 100644 --- a/src/contest.c +++ b/src/contest.c @@ -218,8 +218,6 @@ EWRAM_DATA u8 gUnknown_02039F5D = 0; // IWRAM common vars. u32 gContestRngValue; -extern const struct BgTemplate gUnknown_08587F34[4]; -extern const struct WindowTemplate gUnknown_08587F44[]; extern const u8 *const gUnknown_0827E8DA[]; extern const u8 gText_0827D55A[]; extern const u8 gText_0827E793[]; @@ -252,7 +250,6 @@ extern const struct SpriteTemplate gSpriteTemplate_8587AD0; extern const struct SpriteTemplate gSpriteTemplate_8587B18[]; extern void (*const gContestEffectFuncs[])(void); extern const s8 gContestExcitementTable[][5]; -extern const struct ContestWinner gUnknown_08587FA4[]; extern const struct CompressedSpriteSheet gUnknown_08589904[]; extern const struct SpritePalette gUnknown_08589924[]; extern const struct SpriteTemplate gSpriteTemplate_858998C[]; @@ -581,6 +578,152 @@ const u16 gUnknown_08587C30[] = INCBIN_U16("graphics/unknown/unknown_587C30.gbap #include "data/contest_text_tables.h" +const struct BgTemplate gUnknown_08587F34[] = +{ + { + .bg = 0, + .charBaseIndex = 0, + .mapBaseIndex = 0x18, + .screenSize = 2, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = 1, + .charBaseIndex = 2, + .mapBaseIndex = 0x1E, + .screenSize = 2, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = 2, + .charBaseIndex = 0, + .mapBaseIndex = 0x1C, + .screenSize = 2, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = 3, + .charBaseIndex = 0, + .mapBaseIndex = 0x1A, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 0 + } +}; + +const struct WindowTemplate gUnknown_08587F44[] = +{ + { + .bg = 0, + .tilemapLeft = 18, + .tilemapTop = 0, + .width = 12, + .height = 2, + .paletteNum = 0xF, + .baseBlock = 0x200 + }, + { + .bg = 0, + .tilemapLeft = 18, + .tilemapTop = 5, + .width = 12, + .height = 2, + .paletteNum = 0xF, + .baseBlock = 0x218 + }, + { + .bg = 0, + .tilemapLeft = 18, + .tilemapTop = 10, + .width = 12, + .height = 2, + .paletteNum = 0xF, + .baseBlock = 0x230 + }, + { + .bg = 0, + .tilemapLeft = 18, + .tilemapTop = 15, + .width = 12, + .height = 2, + .paletteNum = 0xF, + .baseBlock = 0x248 + }, + { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 15, + .width = 17, + .height = 4, + .paletteNum = 0xF, + .baseBlock = 0x260 + }, + { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 0x1F, + .width = 9, + .height = 2, + .paletteNum = 0xF, + .baseBlock = 0x2A4 + }, + { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 0x21, + .width = 9, + .height = 2, + .paletteNum = 0xF, + .baseBlock = 0x2B6 + }, + { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 0x23, + .width = 9, + .height = 2, + .paletteNum = 0xF, + .baseBlock = 0x2C8 + }, + { + .bg = 0, + .tilemapLeft = 1, + .tilemapTop = 0x25, + .width = 9, + .height = 2, + .paletteNum = 0xF, + .baseBlock = 0x2DA + }, + { + .bg = 0, + .tilemapLeft = 16, + .tilemapTop = 0x1F, + .width = 1, + .height = 2, + .paletteNum = 0xF, + .baseBlock = 0x2EC + }, + { + .bg = 0, + .tilemapLeft = 11, + .tilemapTop = 0x23, + .width = 18, + .height = 4, + .paletteNum = 0xF, + .baseBlock = 0x2EE + }, + DUMMY_WIN_TEMPLATE +}; + +#include "data/contest_opponents.h" + static void TaskDummy1(u8 taskId) { } diff --git a/src/data/contest_opponents.h b/src/data/contest_opponents.h new file mode 100644 index 000000000..580d7916e --- /dev/null +++ b/src/data/contest_opponents.h @@ -0,0 +1,80 @@ + +#include "global.h" +#include "contest.h" +#include "constants/species.h" + +const struct ContestWinner gUnknown_08587FA4[] = +{ + { + .personality = 0, + .trainerId = 0xFFFF, + .species = SPECIES_ELECTRIKE, + .contestCategory = CONTEST_CATEGORY_CUTE, + .monName = _("ELECTER"), + .trainerName = _("EZRA"), + .contestRank = CONTEST_RANK_NORMAL + }, + { + .personality = 0, + .trainerId = 0xFFFF, + .species = SPECIES_TROPIUS, + .contestCategory = CONTEST_CATEGORY_COOL, + .monName = _("TROPO"), + .trainerName = _("ALLAN"), + .contestRank = CONTEST_RANK_HYPER + }, + { + .personality = 0, + .trainerId = 0xFFFF, + .species = SPECIES_XATU, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .monName = _("TUXA"), + .trainerName = _("JULIET"), + .contestRank = CONTEST_RANK_NORMAL + }, + { + .personality = 0, + .trainerId = 0xFFFF, + .species = SPECIES_PLUSLE, + .contestCategory = CONTEST_CATEGORY_TOUGH, + .monName = _("PULSE"), + .trainerName = _("BAILY"), + .contestRank = CONTEST_RANK_MASTER + }, + { + .personality = 0, + .trainerId = 0xFFFF, + .species = SPECIES_SHUPPET, + .contestCategory = CONTEST_CATEGORY_SMART, + .monName = _("SHUPUP"), + .trainerName = _("MELANY"), + .contestRank = CONTEST_RANK_SUPER + }, + { + .personality = 0, + .trainerId = 0xFFFF, + .species = SPECIES_ZANGOOSE, + .contestCategory = CONTEST_CATEGORY_COOL, + .monName = _("GOOZAN"), + .trainerName = _("HANA"), + .contestRank = CONTEST_RANK_HYPER + }, + { + .personality = 0, + .trainerId = 0xFFFF, + .species = SPECIES_LOUDRED, + .contestCategory = CONTEST_CATEGORY_BEAUTY, + .monName = _("LOUDED"), + .trainerName = _("BRYANT"), + .contestRank = CONTEST_RANK_HYPER + }, + { + .personality = 0, + .trainerId = 0xFFFF, + .species = SPECIES_DELCATTY, + .contestCategory = CONTEST_CATEGORY_CUTE, + .monName = _("KITSY"), + .trainerName = _("OMAR"), + .contestRank = CONTEST_RANK_MASTER + } +}; \ No newline at end of file From 153499ed6f08b6546349ba1ec33ea9e18840f44b Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Sat, 9 Mar 2019 01:38:38 -0500 Subject: [PATCH 004/101] Clean up contest_opponents.inc --- data/contest_opponents.inc | 973 ++++++++++++++--------------------- include/contest.h | 18 +- src/data/contest_opponents.h | 8 +- 3 files changed, 414 insertions(+), 585 deletions(-) diff --git a/data/contest_opponents.inc b/data/contest_opponents.inc index 9246bac21..81510ac18 100644 --- a/data/contest_opponents.inc +++ b/data/contest_opponents.inc @@ -1,11 +1,24 @@ + .macro aiPool rank:req, cool:req, beauty:req, cute:req, smart:req, tough:req + .byte ((\tough) << 6) | ((\smart) << 5) | ((\cute) << 4) | ((\beauty) << 3) | ((\cool) << 2) | \rank + .byte 0 @ padding + .endm + + .macro gfxId id + .byte \id + .2byte 0 @ padding + .endm + + .macro unk2C + .4byte 0, 0, 0 + .endm + @todo: cleanup .2byte SPECIES_POOCHYENA .string "POOCHY$ " .string "JIMMY$ " - .byte 7 - .2byte 0 + gfxId 7 .4byte 0xc000fff - .2byte 68 + aiPool 0, 1, 0, 0, 0, 1 .2byte 46 .2byte 44 .2byte 36 @@ -16,18 +29,16 @@ .byte 3 .byte 4 .byte 50 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_ILLUMISE .string "MUSILLE$ " .string "EDITH$ " - .byte 8 - .2byte 0 + gfxId 8 .4byte 0x82000fff - .2byte 16 + aiPool 0, 0, 0, 1, 0, 0 .2byte 156 .2byte 263 .2byte 33 @@ -38,18 +49,16 @@ .byte 1 .byte 2 .byte 60 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_DUSTOX .string "DUSTER$ " .string "EVAN$ " - .byte 11 - .2byte 0 + gfxId 11 .4byte 0x21000fff - .2byte 8 + aiPool 0, 0, 1, 0, 0, 0 .2byte 318 .2byte 236 .2byte 113 @@ -60,18 +69,16 @@ .byte 12 .byte 4 .byte 70 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SEEDOT .string "DOTS$ " .string "KELSEY$ " - .byte 16 - .2byte 0 + gfxId 16 .4byte 0x20800fff - .2byte 96 + aiPool 0, 0, 0, 0, 1, 1 .2byte 117 .2byte 235 .2byte 331 @@ -82,18 +89,16 @@ .byte 2 .byte 7 .byte 80 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_TAILLOW .string "TATAY$ " .string "MADISON$" - .byte 18 - .2byte 0 + gfxId 18 .4byte 0x80400fff - .2byte 4 + aiPool 0, 1, 0, 0, 0, 0 .2byte 17 .2byte 97 .2byte 332 @@ -104,18 +109,16 @@ .byte 5 .byte 4 .byte 90 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_NINCADA .string "NINDA$ " .string "RAYMOND$" - .byte 44 - .2byte 0 + gfxId 44 .4byte 0x10200fff - .2byte 32 + aiPool 0, 0, 0, 0, 1, 0 .2byte 141 .2byte 206 .2byte 154 @@ -126,18 +129,16 @@ .byte 7 .byte 8 .byte 100 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SHROOMISH .string "SMISH$ " .string "GRANT$ " - .byte 35 - .2byte 0 + gfxId 35 .4byte 0x20100fff - .2byte 32 + aiPool 0, 0, 0, 0, 1, 0 .2byte 78 .2byte 73 .2byte 72 @@ -148,18 +149,16 @@ .byte 2 .byte 2 .byte 50 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SPHEAL .string "SLEAL$ " .string "PAIGE$ " - .byte 26 - .2byte 0 + gfxId 26 .4byte 0x8080fff - .2byte 24 + aiPool 0, 0, 1, 1, 0, 0 .2byte 62 .2byte 55 .2byte 45 @@ -170,18 +169,16 @@ .byte 10 .byte 10 .byte 60 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SLAKOTH .string "SLOKTH$ " .string "ALEC$ " - .byte 31 - .2byte 0 + gfxId 31 .4byte 0x40040fff - .2byte 88 + aiPool 0, 0, 1, 1, 0, 1 .2byte 70 .2byte 68 .2byte 281 @@ -192,18 +189,16 @@ .byte 5 .byte 18 .byte 70 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_WHISMUR .string "WHIRIS$ " .string "SYDNEY$ " - .byte 47 - .2byte 0 + gfxId 47 .4byte 0x80020fff - .2byte 36 + aiPool 0, 1, 0, 0, 1, 0 .2byte 310 .2byte 103 .2byte 253 @@ -214,18 +209,16 @@ .byte 2 .byte 7 .byte 80 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_MAKUHITA .string "MAHITA$ " .string "MORRIS$ " - .byte 38 - .2byte 0 + gfxId 38 .4byte 0x8010fff - .2byte 68 + aiPool 0, 1, 0, 0, 0, 1 .2byte 69 .2byte 233 .2byte 33 @@ -236,18 +229,16 @@ .byte 8 .byte 1 .byte 90 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_ARON .string "RONAR$ " .string "MARIAH$ " - .byte 10 - .2byte 0 + gfxId 10 .4byte 0x8008fff - .2byte 68 + aiPool 0, 1, 0, 0, 0, 1 .2byte 232 .2byte 334 .2byte 29 @@ -258,18 +249,16 @@ .byte 10 .byte 2 .byte 100 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_CROBAT .string "BATRO$ " .string "RUSSELL$" - .byte 33 - .2byte 0 + gfxId 33 .4byte 0x90004fff - .2byte 56 + aiPool 0, 0, 1, 1, 1, 0 .2byte 114 .2byte 212 .2byte 109 @@ -280,18 +269,16 @@ .byte 2 .byte 10 .byte 50 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_GULPIN .string "GULIN$ " .string "MELANIE$" - .byte 6 - .2byte 0 + gfxId 6 .4byte 0x40002fff - .2byte 16 + aiPool 0, 0, 0, 1, 0, 0 .2byte 124 .2byte 133 .2byte 92 @@ -302,18 +289,16 @@ .byte 10 .byte 5 .byte 60 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_MANECTRIC .string "RIKELEC$ " .string "CHANCE$ " - .byte 15 - .2byte 0 + gfxId 15 .4byte 0x80001fff - .2byte 12 + aiPool 0, 1, 1, 0, 0, 0 .2byte 209 .2byte 86 .2byte 87 @@ -324,18 +309,16 @@ .byte 1 .byte 1 .byte 70 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_BULBASAUR .string "BULBY$ " .string "AGATHA$ " - .byte 20 - .2byte 0 + gfxId 20 .4byte 0xc000fff - .2byte 48 + aiPool 0, 0, 0, 1, 1, 0 .2byte 45 .2byte 73 .2byte 33 @@ -346,18 +329,16 @@ .byte 10 .byte 4 .byte 50 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_BUTTERFREE .string "FUTTERBE$ " .string "BEAU$ " - .byte 40 - .2byte 0 + gfxId 40 .4byte 0x82000fff - .2byte 40 + aiPool 0, 0, 1, 0, 1, 0 .2byte 48 .2byte 18 .2byte 318 @@ -368,18 +349,16 @@ .byte 10 .byte 4 .byte 60 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_PIDGEOTTO .string "PIDEOT$ " .string "KAY$ " - .byte 34 - .2byte 0 + gfxId 34 .4byte 0x21000fff - .2byte 12 + aiPool 0, 1, 1, 0, 0, 0 .2byte 119 .2byte 98 .2byte 332 @@ -390,18 +369,16 @@ .byte 2 .byte 3 .byte 70 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_DIGLETT .string "DIGLE$ " .string "CALE$ " - .byte 55 - .2byte 0 + gfxId 55 .4byte 0x20800fff - .2byte 96 + aiPool 0, 0, 0, 0, 1, 1 .2byte 91 .2byte 89 .2byte 90 @@ -412,18 +389,16 @@ .byte 5 .byte 10 .byte 80 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_POLIWAG .string "WAGIL$ " .string "CAITLIN$" - .byte 53 - .2byte 0 + gfxId 53 .4byte 0x80400fff - .2byte 72 + aiPool 0, 0, 1, 0, 0, 1 .2byte 56 .2byte 240 .2byte 34 @@ -434,18 +409,16 @@ .byte 3 .byte 10 .byte 90 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_TOTODILE .string "TOTDIL$ " .string "COLBY$ " - .byte 5 - .2byte 0 + gfxId 5 .4byte 0x10200fff - .2byte 12 + aiPool 0, 1, 1, 0, 0, 0 .2byte 99 .2byte 103 .2byte 57 @@ -456,18 +429,16 @@ .byte 1 .byte 5 .byte 100 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_LEDYBA .string "BALEDY$ " .string "KYLIE$ " - .byte 45 - .2byte 0 + gfxId 45 .4byte 0x20100fff - .2byte 20 + aiPool 0, 1, 0, 1, 0, 0 .2byte 226 .2byte 97 .2byte 129 @@ -478,18 +449,16 @@ .byte 6 .byte 2 .byte 90 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_DELIBIRD .string "BIRDLY$ " .string "LIAM$ " - .byte 66 - .2byte 0 + gfxId 66 .4byte 0x8080fff - .2byte 112 + aiPool 0, 0, 0, 1, 1, 1 .2byte 217 .2byte 263 .2byte 264 @@ -500,18 +469,16 @@ .byte 5 .byte 3 .byte 80 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_LARVITAR .string "TARVITAR$ " .string "MILO$ " - .byte 39 - .2byte 0 + gfxId 39 .4byte 0x40040fff - .2byte 64 + aiPool 0, 0, 0, 0, 0, 1 .2byte 37 .2byte 259 .2byte 242 @@ -522,18 +489,16 @@ .byte 8 .byte 10 .byte 70 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_ROSELIA .string "RELIA$ " .string "KARINA$ " - .byte 32 - .2byte 0 + gfxId 32 .4byte 0x24000fff - .2byte 41 + aiPool 1, 0, 1, 0, 1, 0 .2byte 80 .2byte 345 .2byte 320 @@ -544,18 +509,16 @@ .byte 10 .byte 20 .byte 100 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_DODRIO .string "DUODO$ " .string "BOBBY$ " - .byte 51 - .2byte 0 + gfxId 51 .4byte 0x82000fff - .2byte 125 + aiPool 1, 1, 1, 1, 1, 1 .2byte 64 .2byte 31 .2byte 216 @@ -566,18 +529,16 @@ .byte 85 .byte 35 .byte 110 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_TRAPINCH .string "PINCHIN$ " .string "CLAIRE$ " - .byte 8 - .2byte 0 + gfxId 8 .4byte 0x81000fff - .2byte 113 + aiPool 1, 0, 0, 1, 1, 1 .2byte 44 .2byte 28 .2byte 91 @@ -588,18 +549,16 @@ .byte 10 .byte 25 .byte 120 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_CACNEA .string "NACAC$ " .string "WILLIE$ " - .byte 11 - .2byte 0 + gfxId 11 .4byte 0x80800fff - .2byte 37 + aiPool 1, 1, 0, 0, 1, 0 .2byte 191 .2byte 43 .2byte 40 @@ -610,18 +569,16 @@ .byte 65 .byte 25 .byte 130 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SANDSLASH .string "SHRAND$ " .string "CASSIDY$" - .byte 18 - .2byte 0 + gfxId 18 .4byte 0x10400fff - .2byte 69 + aiPool 1, 1, 0, 0, 0, 1 .2byte 163 .2byte 111 .2byte 129 @@ -632,18 +589,16 @@ .byte 10 .byte 100 .byte 140 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_BALTOY .string "TOYBAL$ " .string "MORGAN$ " - .byte 44 - .2byte 0 + gfxId 44 .4byte 0x8200fff - .2byte 41 + aiPool 1, 0, 1, 0, 1, 0 .2byte 120 .2byte 317 .2byte 60 @@ -654,18 +609,16 @@ .byte 35 .byte 35 .byte 150 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_MEDICHAM .string "CHAMCHAM$ " .string "SUMMER$ " - .byte 26 - .2byte 0 + gfxId 26 .4byte 0x10100fff - .2byte 77 + aiPool 1, 1, 1, 0, 0, 1 .2byte 179 .2byte 9 .2byte 7 @@ -676,18 +629,16 @@ .byte 40 .byte 40 .byte 100 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SPINDA .string "SPININ$ " .string "MILES$ " - .byte 31 - .2byte 0 + gfxId 31 .4byte 0x80080fff - .2byte 49 + aiPool 1, 0, 0, 1, 1, 0 .2byte 298 .2byte 244 .2byte 95 @@ -698,18 +649,16 @@ .byte 10 .byte 25 .byte 110 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SWABLU .string "SWABY$ " .string "AUDREY$ " - .byte 47 - .2byte 0 + gfxId 47 .4byte 0xa0040fff - .2byte 41 + aiPool 1, 0, 1, 0, 1, 0 .2byte 119 .2byte 195 .2byte 219 @@ -720,18 +669,16 @@ .byte 30 .byte 25 .byte 120 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SPOINK .string "POINKER$ " .string "AVERY$ " - .byte 38 - .2byte 0 + gfxId 38 .4byte 0x80020fff - .2byte 49 + aiPool 1, 0, 0, 1, 1, 0 .2byte 150 .2byte 109 .2byte 173 @@ -742,18 +689,16 @@ .byte 40 .byte 30 .byte 130 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_KECLEON .string "KECON$ " .string "ARIANA$ " - .byte 10 - .2byte 0 + gfxId 10 .4byte 0x80010fff - .2byte 97 + aiPool 1, 0, 0, 0, 1, 1 .2byte 168 .2byte 103 .2byte 246 @@ -764,18 +709,16 @@ .byte 75 .byte 35 .byte 140 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_GOLDEEN .string "GOLDEN$ " .string "ASHTON$ " - .byte 33 - .2byte 0 + gfxId 33 .4byte 0x80008fff - .2byte 13 + aiPool 1, 1, 1, 0, 0, 0 .2byte 30 .2byte 31 .2byte 32 @@ -786,18 +729,16 @@ .byte 30 .byte 25 .byte 150 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_BARBOACH .string "BOBOACH$ " .string "SANDRA$ " - .byte 6 - .2byte 0 + gfxId 6 .4byte 0x80004fff - .2byte 113 + aiPool 1, 0, 0, 1, 1, 1 .2byte 300 .2byte 346 .2byte 89 @@ -808,18 +749,16 @@ .byte 25 .byte 15 .byte 100 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SKARMORY .string "CORPY$ " .string "CARSON$ " - .byte 35 - .2byte 0 + gfxId 35 .4byte 0x8002fff - .2byte 77 + aiPool 1, 1, 1, 0, 0, 1 .2byte 129 .2byte 104 .2byte 97 @@ -830,18 +769,16 @@ .byte 60 .byte 20 .byte 110 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_LOTAD .string "TADO$ " .string "KATRINA$" - .byte 16 - .2byte 0 + gfxId 16 .4byte 0x8001fff - .2byte 57 + aiPool 1, 0, 1, 1, 1, 0 .2byte 310 .2byte 45 .2byte 240 @@ -852,18 +789,16 @@ .byte 15 .byte 75 .byte 120 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SLOWBRO .string "BROWLO$ " .string "LUKE$ " - .byte 17 - .2byte 0 + gfxId 17 .4byte 0xc000fff - .2byte 49 + aiPool 1, 0, 0, 1, 1, 0 .2byte 281 .2byte 50 .2byte 45 @@ -874,18 +809,16 @@ .byte 30 .byte 20 .byte 100 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_FARFETCHD .string "FETCHIN$ " .string "RAUL$ " - .byte 66 - .2byte 0 + gfxId 66 .4byte 0x82000fff - .2byte 21 + aiPool 1, 1, 0, 1, 0, 0 .2byte 263 .2byte 210 .2byte 19 @@ -896,18 +829,16 @@ .byte 20 .byte 20 .byte 110 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SEEL .string "SEELEY$ " .string "JADA$ " - .byte 20 - .2byte 0 + gfxId 20 .4byte 0x21000fff - .2byte 25 + aiPool 1, 0, 1, 1, 0, 0 .2byte 213 .2byte 58 .2byte 219 @@ -918,18 +849,16 @@ .byte 20 .byte 20 .byte 120 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_DROWZEE .string "DROWZIN$ " .string "ZEEK$ " - .byte 37 - .2byte 0 + gfxId 37 .4byte 0x20800fff - .2byte 121 + aiPool 1, 0, 1, 1, 1, 1 .2byte 50 .2byte 248 .2byte 237 @@ -940,18 +869,16 @@ .byte 30 .byte 45 .byte 130 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_HITMONCHAN .string "HITEMON$ " .string "DIEGO$ " - .byte 21 - .2byte 0 + gfxId 21 .4byte 0x80400fff - .2byte 69 + aiPool 1, 1, 0, 0, 0, 1 .2byte 327 .2byte 197 .2byte 279 @@ -962,18 +889,16 @@ .byte 20 .byte 45 .byte 140 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_BLISSEY .string "BLISS$ " .string "ALIYAH$ " - .byte 85 - .2byte 0 + gfxId 85 .4byte 0x10200fff - .2byte 89 + aiPool 1, 0, 1, 1, 0, 1 .2byte 47 .2byte 135 .2byte 121 @@ -984,18 +909,16 @@ .byte 20 .byte 20 .byte 150 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_ELEKID .string "KIDLEK$ " .string "NATALIA$" - .byte 18 - .2byte 0 + gfxId 18 .4byte 0x20100fff - .2byte 21 + aiPool 1, 1, 0, 1, 0, 0 .2byte 351 .2byte 98 .2byte 103 @@ -1006,18 +929,16 @@ .byte 25 .byte 25 .byte 140 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SNUBBULL .string "SNUBBINS$ " .string "DEVIN$ " - .byte 48 - .2byte 0 + gfxId 48 .4byte 0x8080fff - .2byte 81 + aiPool 1, 0, 0, 1, 0, 1 .2byte 184 .2byte 269 .2byte 39 @@ -1028,18 +949,16 @@ .byte 20 .byte 20 .byte 130 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_MISDREAVUS .string "DREAVIS$ " .string "TYLOR$ " - .byte 40 - .2byte 0 + gfxId 40 .4byte 0x40040fff - .2byte 41 + aiPool 1, 0, 1, 0, 1, 0 .2byte 195 .2byte 212 .2byte 109 @@ -1050,18 +969,16 @@ .byte 45 .byte 20 .byte 120 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_LAIRON .string "LAIRN$ " .string "RONNIE$ " - .byte 55 - .2byte 0 + gfxId 55 .4byte 0x84000fff - .2byte 98 + aiPool 2, 0, 0, 0, 1, 1 .2byte 319 .2byte 232 .2byte 106 @@ -1072,18 +989,16 @@ .byte 100 .byte 90 .byte 200 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SHIFTRY .string "SHIFTY$ " .string "CLAUDIA$" - .byte 8 - .2byte 0 + gfxId 8 .4byte 0x82000fff - .2byte 14 + aiPool 2, 1, 1, 0, 0, 0 .2byte 74 .2byte 13 .2byte 153 @@ -1094,18 +1009,16 @@ .byte 35 .byte 70 .byte 210 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_NINJASK .string "NINAS$ " .string "ELIAS$ " - .byte 11 - .2byte 0 + gfxId 11 .4byte 0x81000fff - .2byte 114 + aiPool 2, 0, 0, 1, 1, 1 .2byte 103 .2byte 154 .2byte 28 @@ -1116,18 +1029,16 @@ .byte 70 .byte 70 .byte 220 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SWELLOW .string "WELOW$ " .string "JADE$ " - .byte 18 - .2byte 0 + gfxId 18 .4byte 0x80800fff - .2byte 14 + aiPool 2, 1, 1, 0, 0, 0 .2byte 97 .2byte 332 .2byte 17 @@ -1138,18 +1049,16 @@ .byte 75 .byte 40 .byte 230 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_MIGHTYENA .string "YENA$ " .string "FRANCIS$" - .byte 44 - .2byte 0 + gfxId 44 .4byte 0x80400fff - .2byte 98 + aiPool 2, 0, 0, 0, 1, 1 .2byte 269 .2byte 168 .2byte 316 @@ -1160,18 +1069,16 @@ .byte 70 .byte 70 .byte 240 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_BEAUTIFLY .string "TIFLY$ " .string "ALISHA$ " - .byte 26 - .2byte 0 + gfxId 26 .4byte 0x80200fff - .2byte 42 + aiPool 2, 0, 1, 0, 1, 0 .2byte 234 .2byte 318 .2byte 78 @@ -1182,18 +1089,16 @@ .byte 80 .byte 100 .byte 250 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SEAKING .string "KINGSEA$ " .string "SAUL$ " - .byte 31 - .2byte 0 + gfxId 31 .4byte 0x80100fff - .2byte 118 + aiPool 2, 1, 0, 1, 1, 1 .2byte 175 .2byte 48 .2byte 30 @@ -1204,18 +1109,16 @@ .byte 70 .byte 90 .byte 200 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_CASTFORM .string "CASTER$ " .string "FELICIA$" - .byte 47 - .2byte 0 + gfxId 47 .4byte 0x80080fff - .2byte 126 + aiPool 2, 1, 1, 1, 1, 1 .2byte 241 .2byte 311 .2byte 201 @@ -1226,18 +1129,16 @@ .byte 50 .byte 65 .byte 210 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_MACHOKE .string "CHOKEM$ " .string "EMILIO$ " - .byte 38 - .2byte 0 + gfxId 38 .4byte 0x80040fff - .2byte 70 + aiPool 2, 1, 0, 0, 0, 1 .2byte 69 .2byte 116 .2byte 2 @@ -1248,18 +1149,16 @@ .byte 60 .byte 50 .byte 220 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_LOMBRE .string "LOMBE$ " .string "KARLA$ " - .byte 10 - .2byte 0 + gfxId 10 .4byte 0x80020fff - .2byte 58 + aiPool 2, 0, 1, 1, 1, 0 .2byte 213 .2byte 148 .2byte 253 @@ -1270,18 +1169,16 @@ .byte 45 .byte 70 .byte 230 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SEVIPER .string "VIPES$ " .string "DARRYL$ " - .byte 33 - .2byte 0 + gfxId 33 .4byte 0x80010fff - .2byte 98 + aiPool 2, 0, 0, 0, 1, 1 .2byte 305 .2byte 137 .2byte 35 @@ -1292,18 +1189,16 @@ .byte 40 .byte 100 .byte 240 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_WAILMER .string "MERAIL$ " .string "SELENA$ " - .byte 22 - .2byte 0 + gfxId 22 .4byte 0x80008fff - .2byte 26 + aiPool 2, 0, 1, 1, 0, 0 .2byte 352 .2byte 156 .2byte 323 @@ -1314,18 +1209,16 @@ .byte 50 .byte 30 .byte 250 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_MAGIKARP .string "KARPAG$ " .string "NOEL$ " - .byte 35 - .2byte 0 + gfxId 35 .4byte 0x80004fff - .2byte 82 + aiPool 2, 0, 0, 1, 0, 1 .2byte 33 .2byte 150 .2byte 175 @@ -1336,18 +1229,16 @@ .byte 50 .byte 160 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_LUNATONE .string "LUNONE$ " .string "LACEY$ " - .byte 16 - .2byte 0 + gfxId 16 .4byte 0x80002fff - .2byte 42 + aiPool 2, 0, 1, 0, 1, 0 .2byte 153 .2byte 248 .2byte 94 @@ -1358,18 +1249,16 @@ .byte 70 .byte 50 .byte 210 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_ABSOL .string "ABSO$ " .string "CORBIN$ " - .byte 39 - .2byte 0 + gfxId 39 .4byte 0x80001fff - .2byte 14 + aiPool 2, 1, 1, 0, 0, 0 .2byte 195 .2byte 258 .2byte 63 @@ -1380,18 +1269,16 @@ .byte 35 .byte 35 .byte 220 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_EXEGGUTOR .string "EGGSOR$ " .string "GRACIE$ " - .byte 32 - .2byte 0 + gfxId 32 .4byte 0xc000fff - .2byte 98 + aiPool 2, 0, 0, 0, 1, 1 .2byte 23 .2byte 95 .2byte 121 @@ -1402,18 +1289,16 @@ .byte 100 .byte 80 .byte 200 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_CUBONE .string "CUBIN$ " .string "COLTIN$ " - .byte 65 - .2byte 0 + gfxId 65 .4byte 0x82000fff - .2byte 82 + aiPool 2, 0, 0, 1, 0, 1 .2byte 125 .2byte 155 .2byte 198 @@ -1424,18 +1309,16 @@ .byte 35 .byte 100 .byte 210 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_HITMONLEE .string "HITMON$ " .string "ELLIE$ " - .byte 22 - .2byte 0 + gfxId 22 .4byte 0x21000fff - .2byte 70 + aiPool 2, 1, 0, 0, 0, 1 .2byte 179 .2byte 279 .2byte 116 @@ -1446,18 +1329,16 @@ .byte 50 .byte 100 .byte 220 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SQUIRTLE .string "SURTLE$ " .string "MARCUS$ " - .byte 49 - .2byte 0 + gfxId 49 .4byte 0x20800fff - .2byte 82 + aiPool 2, 0, 0, 1, 0, 1 .2byte 39 .2byte 145 .2byte 264 @@ -1468,18 +1349,16 @@ .byte 40 .byte 95 .byte 230 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_KANGASKHAN .string "KHANKAN$ " .string "KIARA$ " - .byte 14 - .2byte 0 + gfxId 14 .4byte 0x80400fff - .2byte 70 + aiPool 2, 1, 0, 0, 0, 1 .2byte 5 .2byte 99 .2byte 264 @@ -1490,18 +1369,16 @@ .byte 50 .byte 100 .byte 240 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_PINECO .string "PINOC$ " .string "BRYCE$ " - .byte 36 - .2byte 0 + gfxId 36 .4byte 0x10200fff - .2byte 42 + aiPool 2, 0, 1, 0, 1, 0 .2byte 153 .2byte 191 .2byte 113 @@ -1512,18 +1389,16 @@ .byte 80 .byte 80 .byte 250 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_DUNSPARCE .string "DILTOT$ " .string "JAMIE$ " - .byte 34 - .2byte 0 + gfxId 34 .4byte 0x20100fff - .2byte 82 + aiPool 2, 0, 0, 1, 0, 1 .2byte 180 .2byte 281 .2byte 111 @@ -1534,18 +1409,16 @@ .byte 40 .byte 110 .byte 240 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_HOUNDOOM .string "DOOMOND$ " .string "JORGE$ " - .byte 48 - .2byte 0 + gfxId 48 .4byte 0x8080fff - .2byte 14 + aiPool 2, 1, 1, 0, 0, 0 .2byte 46 .2byte 53 .2byte 185 @@ -1556,18 +1429,16 @@ .byte 25 .byte 80 .byte 230 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_MILTANK .string "MILKAN$ " .string "DEVON$ " - .byte 25 - .2byte 0 + gfxId 25 .4byte 0x40040fff - .2byte 26 + aiPool 2, 0, 1, 1, 0, 0 .2byte 208 .2byte 215 .2byte 111 @@ -1578,18 +1449,16 @@ .byte 35 .byte 40 .byte 220 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_GYARADOS .string "RADOS$ " .string "JUSTINA$" - .byte 32 - .2byte 0 + gfxId 32 .4byte 0x84000fff - .2byte 79 + aiPool 3, 1, 1, 0, 0, 1 .2byte 63 .2byte 56 .2byte 240 @@ -1600,18 +1469,16 @@ .byte 40 .byte 160 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_LOUDRED .string "LOUDERD$ " .string "RALPH$ " - .byte 21 - .2byte 0 + gfxId 21 .4byte 0x82000fff - .2byte 71 + aiPool 3, 1, 0, 0, 0, 1 .2byte 304 .2byte 23 .2byte 46 @@ -1622,18 +1489,16 @@ .byte 150 .byte 160 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SKITTY .string "SITTY$ " .string "ROSA$ " - .byte 8 - .2byte 0 + gfxId 8 .4byte 0x81000fff - .2byte 59 + aiPool 3, 0, 1, 1, 1, 0 .2byte 213 .2byte 274 .2byte 185 @@ -1644,18 +1509,16 @@ .byte 185 .byte 60 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SLAKING .string "SLING$ " .string "KEATON$ " - .byte 11 - .2byte 0 + gfxId 11 .4byte 0x80800fff - .2byte 115 + aiPool 3, 0, 0, 1, 1, 1 .2byte 343 .2byte 68 .2byte 227 @@ -1666,18 +1529,16 @@ .byte 110 .byte 150 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_ALTARIA .string "TARIA$ " .string "MAYRA$ " - .byte 18 - .2byte 0 + gfxId 18 .4byte 0x80400fff - .2byte 15 + aiPool 3, 1, 1, 0, 0, 0 .2byte 349 .2byte 63 .2byte 195 @@ -1688,18 +1549,16 @@ .byte 30 .byte 90 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_KIRLIA .string "LIRKI$ " .string "LAMAR$ " - .byte 15 - .2byte 0 + gfxId 15 .4byte 0x80200fff - .2byte 39 + aiPool 3, 1, 0, 0, 1, 0 .2byte 351 .2byte 247 .2byte 285 @@ -1710,18 +1569,16 @@ .byte 230 .byte 80 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_BELLOSSOM .string "BLOSSOM$ " .string "AUBREY$ " - .byte 26 - .2byte 0 + gfxId 26 .4byte 0x80100fff - .2byte 59 + aiPool 3, 0, 1, 1, 1, 0 .2byte 80 .2byte 230 .2byte 78 @@ -1732,18 +1589,16 @@ .byte 130 .byte 40 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SABLEYE .string "EYESAB$ " .string "NIGEL$ " - .byte 31 - .2byte 0 + gfxId 31 .4byte 0x80080fff - .2byte 115 + aiPool 3, 0, 0, 1, 1, 1 .2byte 212 .2byte 185 .2byte 282 @@ -1754,18 +1609,16 @@ .byte 150 .byte 160 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_NATU .string "UTAN$ " .string "CAMILLE$" - .byte 47 - .2byte 0 + gfxId 47 .4byte 0x80040fff - .2byte 115 + aiPool 3, 0, 0, 1, 1, 1 .2byte 101 .2byte 248 .2byte 109 @@ -1776,18 +1629,16 @@ .byte 130 .byte 170 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SHARPEDO .string "PEDOS$ " .string "DEON$ " - .byte 38 - .2byte 0 + gfxId 38 .4byte 0x80020fff - .2byte 87 + aiPool 3, 1, 0, 1, 0, 1 .2byte 97 .2byte 207 .2byte 269 @@ -1798,18 +1649,16 @@ .byte 75 .byte 100 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_LUVDISC .string "LUVIS$ " .string "JANELLE$" - .byte 10 - .2byte 0 + gfxId 10 .4byte 0x80010fff - .2byte 83 + aiPool 3, 0, 0, 1, 0, 1 .2byte 186 .2byte 213 .2byte 36 @@ -1820,18 +1669,16 @@ .byte 40 .byte 190 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_HERACROSS .string "HEROSS$ " .string "HEATH$ " - .byte 33 - .2byte 0 + gfxId 33 .4byte 0x80008fff - .2byte 71 + aiPool 3, 1, 0, 0, 0, 1 .2byte 70 .2byte 203 .2byte 179 @@ -1842,18 +1689,16 @@ .byte 240 .byte 140 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_ELECTRODE .string "RODLECT$ " .string "SASHA$ " - .byte 6 - .2byte 0 + gfxId 6 .4byte 0x80004fff - .2byte 15 + aiPool 3, 1, 1, 0, 0, 0 .2byte 153 .2byte 113 .2byte 129 @@ -1864,18 +1709,16 @@ .byte 35 .byte 50 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_PICHU .string "CHUPY$ " .string "FRANKIE$" - .byte 35 - .2byte 0 + gfxId 35 .4byte 0x80002fff - .2byte 59 + aiPool 3, 0, 1, 1, 1, 0 .2byte 186 .2byte 213 .2byte 156 @@ -1886,18 +1729,16 @@ .byte 115 .byte 120 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_WOBBUFFET .string "WOBET$ " .string "HELEN$ " - .byte 16 - .2byte 0 + gfxId 16 .4byte 0x80001fff - .2byte 111 + aiPool 3, 1, 1, 0, 1, 1 .2byte 68 .2byte 243 .2byte 219 @@ -1908,18 +1749,16 @@ .byte 220 .byte 210 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_GENGAR .string "GAREN$ " .string "CAMILE$ " - .byte 40 - .2byte 0 + gfxId 40 .4byte 0xc000fff - .2byte 71 + aiPool 3, 1, 0, 0, 0, 1 .2byte 194 .2byte 109 .2byte 122 @@ -1930,18 +1769,16 @@ .byte 80 .byte 180 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_PORYGON .string "GONPOR$ " .string "MARTIN$ " - .byte 46 - .2byte 0 + gfxId 46 .4byte 0x82000fff - .2byte 127 + aiPool 3, 1, 1, 1, 1, 1 .2byte 176 .2byte 160 .2byte 216 @@ -1952,18 +1789,16 @@ .byte 130 .byte 130 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_DRAGONITE .string "DRITE$ " .string "SERGIO$ " - .byte 7 - .2byte 0 + gfxId 7 .4byte 0x21000fff - .2byte 71 + aiPool 3, 1, 0, 0, 0, 1 .2byte 200 .2byte 21 .2byte 239 @@ -1974,18 +1809,16 @@ .byte 120 .byte 150 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_MEOWTH .string "MEOWY$ " .string "KAILEY$ " - .byte 6 - .2byte 0 + gfxId 6 .4byte 0x20800fff - .2byte 51 + aiPool 3, 0, 0, 1, 1, 0 .2byte 45 .2byte 269 .2byte 6 @@ -1996,18 +1829,16 @@ .byte 170 .byte 80 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_JYNX .string "NYX$ " .string "PERLA$ " - .byte 45 - .2byte 0 + gfxId 45 .4byte 0x80400fff - .2byte 43 + aiPool 3, 0, 1, 0, 1, 0 .2byte 195 .2byte 212 .2byte 142 @@ -2018,18 +1849,16 @@ .byte 150 .byte 120 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_TOGEPI .string "GEPITO$ " .string "CLARA$ " - .byte 20 - .2byte 0 + gfxId 20 .4byte 0x10200fff - .2byte 19 + aiPool 3, 0, 0, 1, 0, 0 .2byte 45 .2byte 281 .2byte 227 @@ -2040,18 +1869,16 @@ .byte 120 .byte 80 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_ESPEON .string "SPEON$ " .string "JAKOB$ " - .byte 37 - .2byte 0 + gfxId 37 .4byte 0x20100fff - .2byte 15 + aiPool 3, 1, 1, 0, 0, 0 .2byte 129 .2byte 98 .2byte 234 @@ -2062,18 +1889,16 @@ .byte 80 .byte 150 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_SLOWKING .string "SLOWGO$ " .string "TREY$ " - .byte 49 - .2byte 0 + gfxId 49 .4byte 0x8080fff - .2byte 83 + aiPool 3, 0, 0, 1, 0, 1 .2byte 263 .2byte 174 .2byte 281 @@ -2084,18 +1909,16 @@ .byte 110 .byte 170 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff + .2byte SPECIES_URSARING .string "URSING$ " .string "LANE$ " - .byte 44 - .2byte 0 + gfxId 44 .4byte 0x40040fff - .2byte 71 + aiPool 3, 1, 0, 0, 0, 1 .2byte 37 .2byte 332 .2byte 313 @@ -2106,9 +1929,7 @@ .byte 80 .byte 190 .byte 255 - .4byte 0x0 - .4byte 0x0 - .4byte 0x0 + unk2C .4byte 0x0 .4byte 0xffff diff --git a/include/contest.h b/include/contest.h index 4fbec9d22..a803c6d4c 100644 --- a/include/contest.h +++ b/include/contest.h @@ -208,15 +208,17 @@ struct ContestPokemon { /*0x00*/ u16 species; /*0x02*/ u8 nickname[POKEMON_NAME_LENGTH + 1]; - /*0x0D*/ u8 trainerName[8]; + /*0x0D*/ u8 trainerName[PLAYER_NAME_LENGTH + 1]; /*0x15*/ u8 trainerGfxId; + // Temp note: 2 bytes of padding /*0x18*/ u32 flags; - /*0x1C*/ u8 whichRank:2; - u8 aiPool_Cool:1; - u8 aiPool_Beauty:1; - u8 aiPool_Cute:1; - u8 aiPool_Smart:1; - u8 aiPool_Tough:1; + /*0x1C*/ u8 whichRank:2; // 0x1 0x2 + u8 aiPool_Cool:1; // 0x4 + u8 aiPool_Beauty:1; // 0x8 + u8 aiPool_Cute:1; // 0x10 + u8 aiPool_Smart:1; // 0x20 + u8 aiPool_Tough:1; // 0x40 + // Temp note: 1 byte of padding /*0x1E*/ u16 moves[4]; // moves /*0x26*/ u8 cool; // cool /*0x27*/ u8 beauty; // beauty @@ -227,7 +229,7 @@ struct ContestPokemon /*0x2C*/ u8 unk2C[12]; /*0x38*/ u32 personality; // personality /*0x3C*/ u32 otId; // otId -}; // wow +}; struct Shared18000 { diff --git a/src/data/contest_opponents.h b/src/data/contest_opponents.h index 580d7916e..07d41d824 100644 --- a/src/data/contest_opponents.h +++ b/src/data/contest_opponents.h @@ -77,4 +77,10 @@ const struct ContestWinner gUnknown_08587FA4[] = .trainerName = _("OMAR"), .contestRank = CONTEST_RANK_MASTER } -}; \ No newline at end of file +}; +/* +const struct ContestPokemon gContestOpponents[] = +{ + +};*/ +extern const struct ContestPokemon gContestOpponents[96]; \ No newline at end of file From 0e8f94a83e01d224968ab8f54e4d4f35be156ec0 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Sat, 9 Mar 2019 02:49:57 -0500 Subject: [PATCH 005/101] Last bit of cleanup on contest_opponents --- data/contest_opponents.inc | 760 ++++++++++++++++++------------------- 1 file changed, 380 insertions(+), 380 deletions(-) diff --git a/data/contest_opponents.inc b/data/contest_opponents.inc index 81510ac18..e3421d81f 100644 --- a/data/contest_opponents.inc +++ b/data/contest_opponents.inc @@ -19,10 +19,10 @@ gfxId 7 .4byte 0xc000fff aiPool 0, 1, 0, 0, 0, 1 - .2byte 46 - .2byte 44 - .2byte 36 - .2byte 336 + .2byte MOVE_ROAR + .2byte MOVE_BITE + .2byte MOVE_TAKE_DOWN + .2byte MOVE_HOWL .byte 10 .byte 4 .byte 10 @@ -39,10 +39,10 @@ gfxId 8 .4byte 0x82000fff aiPool 0, 0, 0, 1, 0, 0 - .2byte 156 - .2byte 263 - .2byte 33 - .2byte 343 + .2byte MOVE_REST + .2byte MOVE_FACADE + .2byte MOVE_TACKLE + .2byte MOVE_COVET .byte 10 .byte 10 .byte 6 @@ -59,10 +59,10 @@ gfxId 11 .4byte 0x21000fff aiPool 0, 0, 1, 0, 0, 0 - .2byte 318 - .2byte 236 - .2byte 113 - .2byte 16 + .2byte MOVE_SILVER_WIND + .2byte MOVE_MOONLIGHT + .2byte MOVE_LIGHT_SCREEN + .2byte MOVE_GUST .byte 2 .byte 10 .byte 10 @@ -79,10 +79,10 @@ gfxId 16 .4byte 0x20800fff aiPool 0, 0, 0, 0, 1, 1 - .2byte 117 - .2byte 235 - .2byte 331 - .2byte 74 + .2byte MOVE_BIDE + .2byte MOVE_SYNTHESIS + .2byte MOVE_BULLET_SEED + .2byte MOVE_GROWTH .byte 3 .byte 3 .byte 5 @@ -99,10 +99,10 @@ gfxId 18 .4byte 0x80400fff aiPool 0, 1, 0, 0, 0, 0 - .2byte 17 - .2byte 97 - .2byte 332 - .2byte 45 + .2byte MOVE_WING_ATTACK + .2byte MOVE_AGILITY + .2byte MOVE_AERIAL_ACE + .2byte MOVE_GROWL .byte 1 .byte 3 .byte 3 @@ -119,10 +119,10 @@ gfxId 44 .4byte 0x10200fff aiPool 0, 0, 0, 0, 1, 0 - .2byte 141 - .2byte 206 - .2byte 154 - .2byte 170 + .2byte MOVE_LEECH_LIFE + .2byte MOVE_FALSE_SWIPE + .2byte MOVE_FURY_SWIPES + .2byte MOVE_MIND_READER .byte 5 .byte 2 .byte 10 @@ -139,10 +139,10 @@ gfxId 35 .4byte 0x20100fff aiPool 0, 0, 0, 0, 1, 0 - .2byte 78 - .2byte 73 - .2byte 72 - .2byte 213 + .2byte MOVE_STUN_SPORE + .2byte MOVE_LEECH_SEED + .2byte MOVE_MEGA_DRAIN + .2byte MOVE_ATTRACT .byte 3 .byte 3 .byte 10 @@ -159,10 +159,10 @@ gfxId 26 .4byte 0x8080fff aiPool 0, 0, 1, 1, 0, 0 - .2byte 62 - .2byte 55 - .2byte 45 - .2byte 317 + .2byte MOVE_AURORA_BEAM + .2byte MOVE_WATER_GUN + .2byte MOVE_GROWL + .2byte MOVE_ROCK_TOMB .byte 3 .byte 5 .byte 1 @@ -179,10 +179,10 @@ gfxId 31 .4byte 0x40040fff aiPool 0, 0, 1, 1, 0, 1 - .2byte 70 - .2byte 68 - .2byte 281 - .2byte 227 + .2byte MOVE_STRENGTH + .2byte MOVE_COUNTER + .2byte MOVE_YAWN + .2byte MOVE_ENCORE .byte 10 .byte 4 .byte 4 @@ -199,10 +199,10 @@ gfxId 47 .4byte 0x80020fff aiPool 0, 1, 0, 0, 1, 0 - .2byte 310 - .2byte 103 - .2byte 253 - .2byte 304 + .2byte MOVE_ASTONISH + .2byte MOVE_SCREECH + .2byte MOVE_UPROAR + .2byte MOVE_HYPER_VOICE .byte 2 .byte 2 .byte 7 @@ -219,10 +219,10 @@ gfxId 38 .4byte 0x8010fff aiPool 0, 1, 0, 0, 0, 1 - .2byte 69 - .2byte 233 - .2byte 33 - .2byte 179 + .2byte MOVE_SEISMIC_TOSS + .2byte MOVE_VITAL_THROW + .2byte MOVE_TACKLE + .2byte MOVE_REVERSAL .byte 9 .byte 1 .byte 1 @@ -239,10 +239,10 @@ gfxId 10 .4byte 0x8008fff aiPool 0, 1, 0, 0, 0, 1 - .2byte 232 - .2byte 334 - .2byte 29 - .2byte 36 + .2byte MOVE_METAL_CLAW + .2byte MOVE_IRON_DEFENSE + .2byte MOVE_HEADBUTT + .2byte MOVE_TAKE_DOWN .byte 5 .byte 10 .byte 2 @@ -259,10 +259,10 @@ gfxId 33 .4byte 0x90004fff aiPool 0, 0, 1, 1, 1, 0 - .2byte 114 - .2byte 212 - .2byte 109 - .2byte 141 + .2byte MOVE_HAZE + .2byte MOVE_MEAN_LOOK + .2byte MOVE_CONFUSE_RAY + .2byte MOVE_LEECH_LIFE .byte 4 .byte 2 .byte 2 @@ -279,10 +279,10 @@ gfxId 6 .4byte 0x40002fff aiPool 0, 0, 0, 1, 0, 0 - .2byte 124 - .2byte 133 - .2byte 92 - .2byte 281 + .2byte MOVE_SLUDGE + .2byte MOVE_AMNESIA + .2byte MOVE_TOXIC + .2byte MOVE_YAWN .byte 1 .byte 10 .byte 1 @@ -299,10 +299,10 @@ gfxId 15 .4byte 0x80001fff aiPool 0, 1, 1, 0, 0, 0 - .2byte 209 - .2byte 86 - .2byte 87 - .2byte 46 + .2byte MOVE_SPARK + .2byte MOVE_THUNDER_WAVE + .2byte MOVE_THUNDER + .2byte MOVE_ROAR .byte 20 .byte 10 .byte 1 @@ -319,10 +319,10 @@ gfxId 20 .4byte 0xc000fff aiPool 0, 0, 0, 1, 1, 0 - .2byte 45 - .2byte 73 - .2byte 33 - .2byte 230 + .2byte MOVE_GROWL + .2byte MOVE_LEECH_SEED + .2byte MOVE_TACKLE + .2byte MOVE_SWEET_SCENT .byte 5 .byte 3 .byte 10 @@ -339,10 +339,10 @@ gfxId 40 .4byte 0x82000fff aiPool 0, 0, 1, 0, 1, 0 - .2byte 48 - .2byte 18 - .2byte 318 - .2byte 219 + .2byte MOVE_SUPERSONIC + .2byte MOVE_WHIRLWIND + .2byte MOVE_SILVER_WIND + .2byte MOVE_SAFEGUARD .byte 3 .byte 10 .byte 2 @@ -359,10 +359,10 @@ gfxId 34 .4byte 0x21000fff aiPool 0, 1, 1, 0, 0, 0 - .2byte 119 - .2byte 98 - .2byte 332 - .2byte 297 + .2byte MOVE_MIRROR_MOVE + .2byte MOVE_QUICK_ATTACK + .2byte MOVE_AERIAL_ACE + .2byte MOVE_FEATHER_DANCE .byte 10 .byte 8 .byte 4 @@ -379,10 +379,10 @@ gfxId 55 .4byte 0x20800fff aiPool 0, 0, 0, 0, 1, 1 - .2byte 91 - .2byte 89 - .2byte 90 - .2byte 222 + .2byte MOVE_DIG + .2byte MOVE_EARTHQUAKE + .2byte MOVE_FISSURE + .2byte MOVE_MAGNITUDE .byte 4 .byte 2 .byte 3 @@ -399,10 +399,10 @@ gfxId 53 .4byte 0x80400fff aiPool 0, 0, 1, 0, 0, 1 - .2byte 56 - .2byte 240 - .2byte 34 - .2byte 58 + .2byte MOVE_HYDRO_PUMP + .2byte MOVE_RAIN_DANCE + .2byte MOVE_BODY_SLAM + .2byte MOVE_ICE_BEAM .byte 2 .byte 10 .byte 5 @@ -419,10 +419,10 @@ gfxId 5 .4byte 0x10200fff aiPool 0, 1, 1, 0, 0, 0 - .2byte 99 - .2byte 103 - .2byte 57 - .2byte 59 + .2byte MOVE_RAGE + .2byte MOVE_SCREECH + .2byte MOVE_SURF + .2byte MOVE_BLIZZARD .byte 6 .byte 10 .byte 2 @@ -439,10 +439,10 @@ gfxId 45 .4byte 0x20100fff aiPool 0, 1, 0, 1, 0, 0 - .2byte 226 - .2byte 97 - .2byte 129 - .2byte 213 + .2byte MOVE_BATON_PASS + .2byte MOVE_AGILITY + .2byte MOVE_SWIFT + .2byte MOVE_ATTRACT .byte 8 .byte 6 .byte 8 @@ -459,10 +459,10 @@ gfxId 66 .4byte 0x8080fff aiPool 0, 0, 0, 1, 1, 1 - .2byte 217 - .2byte 263 - .2byte 264 - .2byte 216 + .2byte MOVE_PRESENT + .2byte MOVE_FACADE + .2byte MOVE_FOCUS_PUNCH + .2byte MOVE_RETURN .byte 4 .byte 3 .byte 10 @@ -479,10 +479,10 @@ gfxId 39 .4byte 0x40040fff aiPool 0, 0, 0, 0, 0, 1 - .2byte 37 - .2byte 259 - .2byte 242 - .2byte 91 + .2byte MOVE_THRASH + .2byte MOVE_TORMENT + .2byte MOVE_CRUNCH + .2byte MOVE_DIG .byte 8 .byte 5 .byte 5 @@ -499,10 +499,10 @@ gfxId 32 .4byte 0x24000fff aiPool 1, 0, 1, 0, 1, 0 - .2byte 80 - .2byte 345 - .2byte 320 - .2byte 275 + .2byte MOVE_PETAL_DANCE + .2byte MOVE_MAGICAL_LEAF + .2byte MOVE_GRASS_WHISTLE + .2byte MOVE_INGRAIN .byte 50 .byte 15 .byte 75 @@ -519,10 +519,10 @@ gfxId 51 .4byte 0x82000fff aiPool 1, 1, 1, 1, 1, 1 - .2byte 64 - .2byte 31 - .2byte 216 - .2byte 45 + .2byte MOVE_PECK + .2byte MOVE_FURY_ATTACK + .2byte MOVE_RETURN + .2byte MOVE_GROWL .byte 15 .byte 21 .byte 15 @@ -539,10 +539,10 @@ gfxId 8 .4byte 0x81000fff aiPool 1, 0, 0, 1, 1, 1 - .2byte 44 - .2byte 28 - .2byte 91 - .2byte 185 + .2byte MOVE_BITE + .2byte MOVE_SAND_ATTACK + .2byte MOVE_DIG + .2byte MOVE_FAINT_ATTACK .byte 75 .byte 25 .byte 25 @@ -559,10 +559,10 @@ gfxId 11 .4byte 0x80800fff aiPool 1, 1, 0, 0, 1, 0 - .2byte 191 - .2byte 43 - .2byte 40 - .2byte 28 + .2byte MOVE_SPIKES + .2byte MOVE_LEER + .2byte MOVE_POISON_STING + .2byte MOVE_SAND_ATTACK .byte 10 .byte 30 .byte 25 @@ -579,10 +579,10 @@ gfxId 18 .4byte 0x10400fff aiPool 1, 1, 0, 0, 0, 1 - .2byte 163 - .2byte 111 - .2byte 129 - .2byte 154 + .2byte MOVE_SLASH + .2byte MOVE_DEFENSE_CURL + .2byte MOVE_SWIFT + .2byte MOVE_FURY_SWIPES .byte 30 .byte 90 .byte 30 @@ -599,10 +599,10 @@ gfxId 44 .4byte 0x8200fff aiPool 1, 0, 1, 0, 1, 0 - .2byte 120 - .2byte 317 - .2byte 60 - .2byte 93 + .2byte MOVE_SELF_DESTRUCT + .2byte MOVE_ROCK_TOMB + .2byte MOVE_PSYBEAM + .2byte MOVE_CONFUSION .byte 50 .byte 40 .byte 10 @@ -619,10 +619,10 @@ gfxId 26 .4byte 0x10100fff aiPool 1, 1, 1, 0, 0, 1 - .2byte 179 - .2byte 9 - .2byte 7 - .2byte 8 + .2byte MOVE_REVERSAL + .2byte MOVE_THUNDER_PUNCH + .2byte MOVE_FIRE_PUNCH + .2byte MOVE_ICE_PUNCH .byte 40 .byte 20 .byte 40 @@ -639,10 +639,10 @@ gfxId 31 .4byte 0x80080fff aiPool 1, 0, 0, 1, 1, 0 - .2byte 298 - .2byte 244 - .2byte 95 - .2byte 253 + .2byte MOVE_TEETER_DANCE + .2byte MOVE_PSYCH_UP + .2byte MOVE_HYPNOSIS + .2byte MOVE_UPROAR .byte 25 .byte 75 .byte 25 @@ -659,10 +659,10 @@ gfxId 47 .4byte 0xa0040fff aiPool 1, 0, 1, 0, 1, 0 - .2byte 119 - .2byte 195 - .2byte 219 - .2byte 54 + .2byte MOVE_MIRROR_MOVE + .2byte MOVE_PERISH_SONG + .2byte MOVE_SAFEGUARD + .2byte MOVE_MIST .byte 30 .byte 30 .byte 40 @@ -699,10 +699,10 @@ gfxId 10 .4byte 0x80010fff aiPool 1, 0, 0, 0, 1, 1 - .2byte 168 - .2byte 103 - .2byte 246 - .2byte 20 + .2byte MOVE_THIEF + .2byte MOVE_SCREECH + .2byte MOVE_ANCIENT_POWER + .2byte MOVE_BIND .byte 10 .byte 10 .byte 40 @@ -719,10 +719,10 @@ gfxId 33 .4byte 0x80008fff aiPool 1, 1, 1, 0, 0, 0 - .2byte 30 - .2byte 31 - .2byte 32 - .2byte 39 + .2byte MOVE_HORN_ATTACK + .2byte MOVE_FURY_ATTACK + .2byte MOVE_HORN_DRILL + .2byte MOVE_TAIL_WHIP .byte 70 .byte 30 .byte 5 @@ -739,10 +739,10 @@ gfxId 6 .4byte 0x80004fff aiPool 1, 0, 0, 1, 1, 1 - .2byte 300 - .2byte 346 - .2byte 89 - .2byte 248 + .2byte MOVE_MUD_SPORT + .2byte MOVE_WATER_SPORT + .2byte MOVE_EARTHQUAKE + .2byte MOVE_FUTURE_SIGHT .byte 45 .byte 45 .byte 60 @@ -759,10 +759,10 @@ gfxId 35 .4byte 0x8002fff aiPool 1, 1, 1, 0, 0, 1 - .2byte 129 - .2byte 104 - .2byte 97 - .2byte 15 + .2byte MOVE_SWIFT + .2byte MOVE_DOUBLE_TEAM + .2byte MOVE_AGILITY + .2byte MOVE_CUT .byte 40 .byte 30 .byte 25 @@ -779,10 +779,10 @@ gfxId 16 .4byte 0x8001fff aiPool 1, 0, 1, 1, 1, 0 - .2byte 310 - .2byte 45 - .2byte 240 - .2byte 352 + .2byte MOVE_ASTONISH + .2byte MOVE_GROWL + .2byte MOVE_RAIN_DANCE + .2byte MOVE_WATER_PULSE .byte 15 .byte 15 .byte 30 @@ -799,10 +799,10 @@ gfxId 17 .4byte 0xc000fff aiPool 1, 0, 0, 1, 1, 0 - .2byte 281 - .2byte 50 - .2byte 45 - .2byte 93 + .2byte MOVE_YAWN + .2byte MOVE_DISABLE + .2byte MOVE_GROWL + .2byte MOVE_CONFUSION .byte 20 .byte 40 .byte 40 @@ -819,10 +819,10 @@ gfxId 66 .4byte 0x82000fff aiPool 1, 1, 0, 1, 0, 0 - .2byte 263 - .2byte 210 - .2byte 19 - .2byte 216 + .2byte MOVE_FACADE + .2byte MOVE_FURY_CUTTER + .2byte MOVE_FLY + .2byte MOVE_RETURN .byte 40 .byte 10 .byte 40 @@ -839,10 +839,10 @@ gfxId 20 .4byte 0x21000fff aiPool 1, 0, 1, 1, 0, 0 - .2byte 213 - .2byte 58 - .2byte 219 - .2byte 45 + .2byte MOVE_ATTRACT + .2byte MOVE_ICE_BEAM + .2byte MOVE_SAFEGUARD + .2byte MOVE_GROWL .byte 10 .byte 30 .byte 40 @@ -859,10 +859,10 @@ gfxId 37 .4byte 0x20800fff aiPool 1, 0, 1, 1, 1, 1 - .2byte 50 - .2byte 248 - .2byte 237 - .2byte 216 + .2byte MOVE_DISABLE + .2byte MOVE_FUTURE_SIGHT + .2byte MOVE_HIDDEN_POWER + .2byte MOVE_RETURN .byte 10 .byte 40 .byte 50 @@ -879,10 +879,10 @@ gfxId 21 .4byte 0x80400fff aiPool 1, 1, 0, 0, 0, 1 - .2byte 327 - .2byte 197 - .2byte 279 - .2byte 5 + .2byte MOVE_SKY_UPPERCUT + .2byte MOVE_DETECT + .2byte MOVE_REVENGE + .2byte MOVE_MEGA_PUNCH .byte 45 .byte 20 .byte 10 @@ -899,10 +899,10 @@ gfxId 85 .4byte 0x10200fff aiPool 1, 0, 1, 1, 0, 1 - .2byte 47 - .2byte 135 - .2byte 121 - .2byte 38 + .2byte MOVE_SING + .2byte MOVE_SOFT_BOILED + .2byte MOVE_EGG_BOMB + .2byte MOVE_DOUBLE_EDGE .byte 20 .byte 35 .byte 40 @@ -919,10 +919,10 @@ gfxId 18 .4byte 0x20100fff aiPool 1, 1, 0, 1, 0, 0 - .2byte 351 - .2byte 98 - .2byte 103 - .2byte 213 + .2byte MOVE_SHOCK_WAVE + .2byte MOVE_QUICK_ATTACK + .2byte MOVE_SCREECH + .2byte MOVE_ATTRACT .byte 40 .byte 10 .byte 40 @@ -939,10 +939,10 @@ gfxId 48 .4byte 0x8080fff aiPool 1, 0, 0, 1, 0, 1 - .2byte 184 - .2byte 269 - .2byte 39 - .2byte 44 + .2byte MOVE_SCARY_FACE + .2byte MOVE_TAUNT + .2byte MOVE_TAIL_WHIP + .2byte MOVE_BITE .byte 20 .byte 20 .byte 20 @@ -959,10 +959,10 @@ gfxId 40 .4byte 0x40040fff aiPool 1, 0, 1, 0, 1, 0 - .2byte 195 - .2byte 212 - .2byte 109 - .2byte 220 + .2byte MOVE_PERISH_SONG + .2byte MOVE_MEAN_LOOK + .2byte MOVE_CONFUSE_RAY + .2byte MOVE_PAIN_SPLIT .byte 10 .byte 35 .byte 10 @@ -979,10 +979,10 @@ gfxId 55 .4byte 0x84000fff aiPool 2, 0, 0, 0, 1, 1 - .2byte 319 - .2byte 232 - .2byte 106 - .2byte 36 + .2byte MOVE_METAL_SOUND + .2byte MOVE_METAL_CLAW + .2byte MOVE_HARDEN + .2byte MOVE_TAKE_DOWN .byte 30 .byte 50 .byte 35 @@ -999,10 +999,10 @@ gfxId 8 .4byte 0x82000fff aiPool 2, 1, 1, 0, 0, 0 - .2byte 74 - .2byte 13 - .2byte 153 - .2byte 326 + .2byte MOVE_GROWTH + .2byte MOVE_RAZOR_WIND + .2byte MOVE_EXPLOSION + .2byte MOVE_EXTRASENSORY .byte 75 .byte 75 .byte 65 @@ -1019,10 +1019,10 @@ gfxId 11 .4byte 0x81000fff aiPool 2, 0, 0, 1, 1, 1 - .2byte 103 - .2byte 154 - .2byte 28 - .2byte 226 + .2byte MOVE_SCREECH + .2byte MOVE_FURY_SWIPES + .2byte MOVE_SAND_ATTACK + .2byte MOVE_BATON_PASS .byte 30 .byte 50 .byte 95 @@ -1039,10 +1039,10 @@ gfxId 18 .4byte 0x80800fff aiPool 2, 1, 1, 0, 0, 0 - .2byte 97 - .2byte 332 - .2byte 17 - .2byte 19 + .2byte MOVE_AGILITY + .2byte MOVE_AERIAL_ACE + .2byte MOVE_WING_ATTACK + .2byte MOVE_FLY .byte 65 .byte 85 .byte 35 @@ -1059,10 +1059,10 @@ gfxId 44 .4byte 0x80400fff aiPool 2, 0, 0, 0, 1, 1 - .2byte 269 - .2byte 168 - .2byte 316 - .2byte 36 + .2byte MOVE_TAUNT + .2byte MOVE_THIEF + .2byte MOVE_ODOR_SLEUTH + .2byte MOVE_TAKE_DOWN .byte 40 .byte 80 .byte 35 @@ -1079,10 +1079,10 @@ gfxId 26 .4byte 0x80200fff aiPool 2, 0, 1, 0, 1, 0 - .2byte 234 - .2byte 318 - .2byte 78 - .2byte 290 + .2byte MOVE_MORNING_SUN + .2byte MOVE_SILVER_WIND + .2byte MOVE_STUN_SPORE + .2byte MOVE_SECRET_POWER .byte 40 .byte 70 .byte 25 @@ -1099,10 +1099,10 @@ gfxId 31 .4byte 0x80100fff aiPool 2, 1, 0, 1, 1, 1 - .2byte 175 - .2byte 48 - .2byte 30 - .2byte 31 + .2byte MOVE_FLAIL + .2byte MOVE_SUPERSONIC + .2byte MOVE_HORN_ATTACK + .2byte MOVE_FURY_ATTACK .byte 80 .byte 60 .byte 30 @@ -1119,10 +1119,10 @@ gfxId 47 .4byte 0x80080fff aiPool 2, 1, 1, 1, 1, 1 - .2byte 241 - .2byte 311 - .2byte 201 - .2byte 216 + .2byte MOVE_SUNNY_DAY + .2byte MOVE_WEATHER_BALL + .2byte MOVE_SANDSTORM + .2byte MOVE_RETURN .byte 70 .byte 80 .byte 80 @@ -1139,10 +1139,10 @@ gfxId 38 .4byte 0x80040fff aiPool 2, 1, 0, 0, 0, 1 - .2byte 69 - .2byte 116 - .2byte 2 - .2byte 184 + .2byte MOVE_SEISMIC_TOSS + .2byte MOVE_FOCUS_ENERGY + .2byte MOVE_KARATE_CHOP + .2byte MOVE_SCARY_FACE .byte 70 .byte 85 .byte 25 @@ -1159,10 +1159,10 @@ gfxId 10 .4byte 0x80020fff aiPool 2, 0, 1, 1, 1, 0 - .2byte 213 - .2byte 148 - .2byte 253 - .2byte 45 + .2byte MOVE_ATTRACT + .2byte MOVE_FLASH + .2byte MOVE_UPROAR + .2byte MOVE_GROWL .byte 40 .byte 60 .byte 90 @@ -1179,10 +1179,10 @@ gfxId 33 .4byte 0x80010fff aiPool 2, 0, 0, 0, 1, 1 - .2byte 305 - .2byte 137 - .2byte 35 - .2byte 103 + .2byte MOVE_POISON_FANG + .2byte MOVE_GLARE + .2byte MOVE_WRAP + .2byte MOVE_SCREECH .byte 35 .byte 50 .byte 90 @@ -1199,10 +1199,10 @@ gfxId 22 .4byte 0x80008fff aiPool 2, 0, 1, 1, 0, 0 - .2byte 352 - .2byte 156 - .2byte 323 - .2byte 150 + .2byte MOVE_WATER_PULSE + .2byte MOVE_REST + .2byte MOVE_WATER_SPOUT + .2byte MOVE_SPLASH .byte 30 .byte 100 .byte 100 @@ -1219,10 +1219,10 @@ gfxId 35 .4byte 0x80004fff aiPool 2, 0, 0, 1, 0, 1 - .2byte 33 - .2byte 150 - .2byte 175 - .2byte 33 + .2byte MOVE_TACKLE + .2byte MOVE_SPLASH + .2byte MOVE_FLAIL + .2byte MOVE_TACKLE .byte 30 .byte 30 .byte 160 @@ -1239,10 +1239,10 @@ gfxId 16 .4byte 0x80002fff aiPool 2, 0, 1, 0, 1, 0 - .2byte 153 - .2byte 248 - .2byte 94 - .2byte 93 + .2byte MOVE_EXPLOSION + .2byte MOVE_FUTURE_SIGHT + .2byte MOVE_PSYCHIC + .2byte MOVE_CONFUSION .byte 50 .byte 70 .byte 60 @@ -1259,10 +1259,10 @@ gfxId 39 .4byte 0x80001fff aiPool 2, 1, 1, 0, 0, 0 - .2byte 195 - .2byte 258 - .2byte 63 - .2byte 163 + .2byte MOVE_PERISH_SONG + .2byte MOVE_HAIL + .2byte MOVE_HYPER_BEAM + .2byte MOVE_SLASH .byte 95 .byte 80 .byte 85 @@ -1279,10 +1279,10 @@ gfxId 32 .4byte 0xc000fff aiPool 2, 0, 0, 0, 1, 1 - .2byte 23 - .2byte 95 - .2byte 121 - .2byte 285 + .2byte MOVE_STOMP + .2byte MOVE_HYPNOSIS + .2byte MOVE_EGG_BOMB + .2byte MOVE_SKILL_SWAP .byte 40 .byte 50 .byte 60 @@ -1299,10 +1299,10 @@ gfxId 65 .4byte 0x82000fff aiPool 2, 0, 0, 1, 0, 1 - .2byte 125 - .2byte 155 - .2byte 198 - .2byte 45 + .2byte MOVE_BONE_CLUB + .2byte MOVE_BONEMERANG + .2byte MOVE_BONE_RUSH + .2byte MOVE_GROWL .byte 40 .byte 35 .byte 85 @@ -1319,10 +1319,10 @@ gfxId 22 .4byte 0x21000fff aiPool 2, 1, 0, 0, 0, 1 - .2byte 179 - .2byte 279 - .2byte 116 - .2byte 25 + .2byte MOVE_REVERSAL + .2byte MOVE_REVENGE + .2byte MOVE_FOCUS_ENERGY + .2byte MOVE_MEGA_KICK .byte 85 .byte 30 .byte 25 @@ -1339,10 +1339,10 @@ gfxId 49 .4byte 0x20800fff aiPool 2, 0, 0, 1, 0, 1 - .2byte 39 - .2byte 145 - .2byte 264 - .2byte 110 + .2byte MOVE_TAIL_WHIP + .2byte MOVE_BUBBLE + .2byte MOVE_FOCUS_PUNCH + .2byte MOVE_WITHDRAW .byte 30 .byte 35 .byte 100 @@ -1359,10 +1359,10 @@ gfxId 14 .4byte 0x80400fff aiPool 2, 1, 0, 0, 0, 1 - .2byte 5 - .2byte 99 - .2byte 264 - .2byte 39 + .2byte MOVE_MEGA_PUNCH + .2byte MOVE_RAGE + .2byte MOVE_FOCUS_PUNCH + .2byte MOVE_TAIL_WHIP .byte 100 .byte 50 .byte 30 @@ -1379,10 +1379,10 @@ gfxId 36 .4byte 0x10200fff aiPool 2, 0, 1, 0, 1, 0 - .2byte 153 - .2byte 191 - .2byte 113 - .2byte 202 + .2byte MOVE_EXPLOSION + .2byte MOVE_SPIKES + .2byte MOVE_LIGHT_SCREEN + .2byte MOVE_GIGA_DRAIN .byte 80 .byte 80 .byte 80 @@ -1399,10 +1399,10 @@ gfxId 34 .4byte 0x20100fff aiPool 2, 0, 0, 1, 0, 1 - .2byte 180 - .2byte 281 - .2byte 111 - .2byte 36 + .2byte MOVE_SPITE + .2byte MOVE_YAWN + .2byte MOVE_DEFENSE_CURL + .2byte MOVE_TAKE_DOWN .byte 40 .byte 35 .byte 100 @@ -1419,10 +1419,10 @@ gfxId 48 .4byte 0x8080fff aiPool 2, 1, 1, 0, 0, 0 - .2byte 46 - .2byte 53 - .2byte 185 - .2byte 241 + .2byte MOVE_ROAR + .2byte MOVE_FLAMETHROWER + .2byte MOVE_FAINT_ATTACK + .2byte MOVE_SUNNY_DAY .byte 100 .byte 100 .byte 30 @@ -1439,10 +1439,10 @@ gfxId 25 .4byte 0x40040fff aiPool 2, 0, 1, 1, 0, 0 - .2byte 208 - .2byte 215 - .2byte 111 - .2byte 59 + .2byte MOVE_MILK_DRINK + .2byte MOVE_HEAL_BELL + .2byte MOVE_DEFENSE_CURL + .2byte MOVE_BLIZZARD .byte 50 .byte 110 .byte 100 @@ -1459,10 +1459,10 @@ gfxId 32 .4byte 0x84000fff aiPool 3, 1, 1, 0, 0, 1 - .2byte 63 - .2byte 56 - .2byte 240 - .2byte 44 + .2byte MOVE_HYPER_BEAM + .2byte MOVE_HYDRO_PUMP + .2byte MOVE_RAIN_DANCE + .2byte MOVE_BITE .byte 160 .byte 200 .byte 20 @@ -1479,10 +1479,10 @@ gfxId 21 .4byte 0x82000fff aiPool 3, 1, 0, 0, 0, 1 - .2byte 304 - .2byte 23 - .2byte 46 - .2byte 336 + .2byte MOVE_HYPER_VOICE + .2byte MOVE_STOMP + .2byte MOVE_ROAR + .2byte MOVE_HOWL .byte 170 .byte 50 .byte 55 @@ -1499,10 +1499,10 @@ gfxId 8 .4byte 0x81000fff aiPool 3, 0, 1, 1, 1, 0 - .2byte 213 - .2byte 274 - .2byte 185 - .2byte 39 + .2byte MOVE_ATTRACT + .2byte MOVE_ASSIST + .2byte MOVE_FAINT_ATTACK + .2byte MOVE_TAIL_WHIP .byte 40 .byte 200 .byte 150 @@ -1519,10 +1519,10 @@ gfxId 11 .4byte 0x80800fff aiPool 3, 0, 0, 1, 1, 1 - .2byte 343 - .2byte 68 - .2byte 227 - .2byte 303 + .2byte MOVE_COVET + .2byte MOVE_COUNTER + .2byte MOVE_ENCORE + .2byte MOVE_SLACK_OFF .byte 85 .byte 85 .byte 170 @@ -1539,10 +1539,10 @@ gfxId 18 .4byte 0x80400fff aiPool 3, 1, 1, 0, 0, 0 - .2byte 349 - .2byte 63 - .2byte 195 - .2byte 219 + .2byte MOVE_DRAGON_DANCE + .2byte MOVE_HYPER_BEAM + .2byte MOVE_PERISH_SONG + .2byte MOVE_SAFEGUARD .byte 170 .byte 150 .byte 30 @@ -1559,10 +1559,10 @@ gfxId 15 .4byte 0x80200fff aiPool 3, 1, 0, 0, 1, 0 - .2byte 351 - .2byte 247 - .2byte 285 - .2byte 216 + .2byte MOVE_SHOCK_WAVE + .2byte MOVE_SHADOW_BALL + .2byte MOVE_SKILL_SWAP + .2byte MOVE_RETURN .byte 230 .byte 60 .byte 60 @@ -1579,10 +1579,10 @@ gfxId 26 .4byte 0x80100fff aiPool 3, 0, 1, 1, 1, 0 - .2byte 80 - .2byte 230 - .2byte 78 - .2byte 148 + .2byte MOVE_PETAL_DANCE + .2byte MOVE_SWEET_SCENT + .2byte MOVE_STUN_SPORE + .2byte MOVE_FLASH .byte 35 .byte 200 .byte 150 @@ -1599,10 +1599,10 @@ gfxId 31 .4byte 0x80080fff aiPool 3, 0, 0, 1, 1, 1 - .2byte 212 - .2byte 185 - .2byte 282 - .2byte 109 + .2byte MOVE_MEAN_LOOK + .2byte MOVE_FAINT_ATTACK + .2byte MOVE_KNOCK_OFF + .2byte MOVE_CONFUSE_RAY .byte 25 .byte 35 .byte 230 @@ -1619,10 +1619,10 @@ gfxId 47 .4byte 0x80040fff aiPool 3, 0, 0, 1, 1, 1 - .2byte 101 - .2byte 248 - .2byte 109 - .2byte 94 + .2byte MOVE_NIGHT_SHADE + .2byte MOVE_FUTURE_SIGHT + .2byte MOVE_CONFUSE_RAY + .2byte MOVE_PSYCHIC .byte 35 .byte 35 .byte 150 @@ -1639,10 +1639,10 @@ gfxId 38 .4byte 0x80020fff aiPool 3, 1, 0, 1, 0, 1 - .2byte 97 - .2byte 207 - .2byte 269 - .2byte 36 + .2byte MOVE_AGILITY + .2byte MOVE_SWAGGER + .2byte MOVE_TAUNT + .2byte MOVE_TAKE_DOWN .byte 140 .byte 70 .byte 140 @@ -1659,10 +1659,10 @@ gfxId 10 .4byte 0x80010fff aiPool 3, 0, 0, 1, 0, 1 - .2byte 186 - .2byte 213 - .2byte 36 - .2byte 204 + .2byte MOVE_SWEET_KISS + .2byte MOVE_ATTRACT + .2byte MOVE_TAKE_DOWN + .2byte MOVE_CHARM .byte 50 .byte 100 .byte 220 @@ -1679,10 +1679,10 @@ gfxId 33 .4byte 0x80008fff aiPool 3, 1, 0, 0, 0, 1 - .2byte 70 - .2byte 203 - .2byte 179 - .2byte 317 + .2byte MOVE_STRENGTH + .2byte MOVE_ENDURE + .2byte MOVE_REVERSAL + .2byte MOVE_ROCK_TOMB .byte 170 .byte 70 .byte 110 @@ -1699,10 +1699,10 @@ gfxId 6 .4byte 0x80004fff aiPool 3, 1, 1, 0, 0, 0 - .2byte 153 - .2byte 113 - .2byte 129 - .2byte 148 + .2byte MOVE_EXPLOSION + .2byte MOVE_LIGHT_SCREEN + .2byte MOVE_SWIFT + .2byte MOVE_FLASH .byte 200 .byte 200 .byte 30 @@ -1719,10 +1719,10 @@ gfxId 35 .4byte 0x80002fff aiPool 3, 0, 1, 1, 1, 0 - .2byte 186 - .2byte 213 - .2byte 156 - .2byte 39 + .2byte MOVE_SWEET_KISS + .2byte MOVE_ATTRACT + .2byte MOVE_REST + .2byte MOVE_TAIL_WHIP .byte 25 .byte 150 .byte 180 @@ -1739,10 +1739,10 @@ gfxId 16 .4byte 0x80001fff aiPool 3, 1, 1, 0, 1, 1 - .2byte 68 - .2byte 243 - .2byte 219 - .2byte 194 + .2byte MOVE_COUNTER + .2byte MOVE_MIRROR_COAT + .2byte MOVE_SAFEGUARD + .2byte MOVE_DESTINY_BOND .byte 60 .byte 230 .byte 50 @@ -1759,10 +1759,10 @@ gfxId 40 .4byte 0xc000fff aiPool 3, 1, 0, 0, 0, 1 - .2byte 194 - .2byte 109 - .2byte 122 - .2byte 188 + .2byte MOVE_DESTINY_BOND + .2byte MOVE_CONFUSE_RAY + .2byte MOVE_LICK + .2byte MOVE_SLUDGE_BOMB .byte 200 .byte 100 .byte 50 @@ -1779,10 +1779,10 @@ gfxId 46 .4byte 0x82000fff aiPool 3, 1, 1, 1, 1, 1 - .2byte 176 - .2byte 160 - .2byte 216 - .2byte 278 + .2byte MOVE_CONVERSION_2 + .2byte MOVE_CONVERSION + .2byte MOVE_RETURN + .2byte MOVE_RECYCLE .byte 130 .byte 130 .byte 130 @@ -1799,10 +1799,10 @@ gfxId 7 .4byte 0x21000fff aiPool 3, 1, 0, 0, 0, 1 - .2byte 200 - .2byte 21 - .2byte 239 - .2byte 89 + .2byte MOVE_OUTRAGE + .2byte MOVE_SLAM + .2byte MOVE_TWISTER + .2byte MOVE_EARTHQUAKE .byte 150 .byte 140 .byte 50 @@ -1819,10 +1819,10 @@ gfxId 6 .4byte 0x20800fff aiPool 3, 0, 0, 1, 1, 0 - .2byte 45 - .2byte 269 - .2byte 6 - .2byte 44 + .2byte MOVE_GROWL + .2byte MOVE_TAUNT + .2byte MOVE_PAY_DAY + .2byte MOVE_BITE .byte 125 .byte 110 .byte 180 @@ -1839,10 +1839,10 @@ gfxId 45 .4byte 0x80400fff aiPool 3, 0, 1, 0, 1, 0 - .2byte 195 - .2byte 212 - .2byte 142 - .2byte 313 + .2byte MOVE_PERISH_SONG + .2byte MOVE_MEAN_LOOK + .2byte MOVE_LOVELY_KISS + .2byte MOVE_FAKE_TEARS .byte 100 .byte 150 .byte 100 @@ -1859,10 +1859,10 @@ gfxId 20 .4byte 0x10200fff aiPool 3, 0, 0, 1, 0, 0 - .2byte 45 - .2byte 281 - .2byte 227 - .2byte 266 + .2byte MOVE_GROWL + .2byte MOVE_YAWN + .2byte MOVE_ENCORE + .2byte MOVE_FOLLOW_ME .byte 80 .byte 120 .byte 200 @@ -1879,10 +1879,10 @@ gfxId 37 .4byte 0x20100fff aiPool 3, 1, 1, 0, 0, 0 - .2byte 129 - .2byte 98 - .2byte 234 - .2byte 39 + .2byte MOVE_SWIFT + .2byte MOVE_QUICK_ATTACK + .2byte MOVE_MORNING_SUN + .2byte MOVE_TAIL_WHIP .byte 180 .byte 150 .byte 100 @@ -1899,10 +1899,10 @@ gfxId 49 .4byte 0x8080fff aiPool 3, 0, 0, 1, 0, 1 - .2byte 263 - .2byte 174 - .2byte 281 - .2byte 264 + .2byte MOVE_FACADE + .2byte MOVE_CURSE + .2byte MOVE_YAWN + .2byte MOVE_FOCUS_PUNCH .byte 100 .byte 80 .byte 200 @@ -1919,10 +1919,10 @@ gfxId 44 .4byte 0x40040fff aiPool 3, 1, 0, 0, 0, 1 - .2byte 37 - .2byte 332 - .2byte 313 - .2byte 43 + .2byte MOVE_THRASH + .2byte MOVE_AERIAL_ACE + .2byte MOVE_FAKE_TEARS + .2byte MOVE_LEER .byte 180 .byte 140 .byte 30 From a32e8e7405dc66c29ae04bb85bf9b07cd3cb21a9 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Sat, 9 Mar 2019 20:56:36 -0500 Subject: [PATCH 006/101] Move gContestOpponents into C 2,400 LOC by hand. --- data/contest.s | 5 - data/contest_opponents.inc | 1935 ------------ .../AbandonedShip_CaptainsOffice/map.json | 2 +- src/contest.c | 1 - src/data/contest_opponents.h | 2790 ++++++++++++++++- 5 files changed, 2787 insertions(+), 1946 deletions(-) delete mode 100644 data/contest_opponents.inc diff --git a/data/contest.s b/data/contest.s index 851af78c5..b752cf8f3 100644 --- a/data/contest.s +++ b/data/contest.s @@ -6,11 +6,6 @@ .section .rodata .align 2, 0 - - .align 2 -gContestOpponents:: @ 85880A4 - .include "data/contest_opponents.inc" - gUnknown_085898A4:: @ 85898A4 .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 diff --git a/data/contest_opponents.inc b/data/contest_opponents.inc deleted file mode 100644 index e3421d81f..000000000 --- a/data/contest_opponents.inc +++ /dev/null @@ -1,1935 +0,0 @@ - .macro aiPool rank:req, cool:req, beauty:req, cute:req, smart:req, tough:req - .byte ((\tough) << 6) | ((\smart) << 5) | ((\cute) << 4) | ((\beauty) << 3) | ((\cool) << 2) | \rank - .byte 0 @ padding - .endm - - .macro gfxId id - .byte \id - .2byte 0 @ padding - .endm - - .macro unk2C - .4byte 0, 0, 0 - .endm - -@todo: cleanup - .2byte SPECIES_POOCHYENA - .string "POOCHY$ " - .string "JIMMY$ " - gfxId 7 - .4byte 0xc000fff - aiPool 0, 1, 0, 0, 0, 1 - .2byte MOVE_ROAR - .2byte MOVE_BITE - .2byte MOVE_TAKE_DOWN - .2byte MOVE_HOWL - .byte 10 - .byte 4 - .byte 10 - .byte 3 - .byte 4 - .byte 50 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_ILLUMISE - .string "MUSILLE$ " - .string "EDITH$ " - gfxId 8 - .4byte 0x82000fff - aiPool 0, 0, 0, 1, 0, 0 - .2byte MOVE_REST - .2byte MOVE_FACADE - .2byte MOVE_TACKLE - .2byte MOVE_COVET - .byte 10 - .byte 10 - .byte 6 - .byte 1 - .byte 2 - .byte 60 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_DUSTOX - .string "DUSTER$ " - .string "EVAN$ " - gfxId 11 - .4byte 0x21000fff - aiPool 0, 0, 1, 0, 0, 0 - .2byte MOVE_SILVER_WIND - .2byte MOVE_MOONLIGHT - .2byte MOVE_LIGHT_SCREEN - .2byte MOVE_GUST - .byte 2 - .byte 10 - .byte 10 - .byte 12 - .byte 4 - .byte 70 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SEEDOT - .string "DOTS$ " - .string "KELSEY$ " - gfxId 16 - .4byte 0x20800fff - aiPool 0, 0, 0, 0, 1, 1 - .2byte MOVE_BIDE - .2byte MOVE_SYNTHESIS - .2byte MOVE_BULLET_SEED - .2byte MOVE_GROWTH - .byte 3 - .byte 3 - .byte 5 - .byte 2 - .byte 7 - .byte 80 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_TAILLOW - .string "TATAY$ " - .string "MADISON$" - gfxId 18 - .4byte 0x80400fff - aiPool 0, 1, 0, 0, 0, 0 - .2byte MOVE_WING_ATTACK - .2byte MOVE_AGILITY - .2byte MOVE_AERIAL_ACE - .2byte MOVE_GROWL - .byte 1 - .byte 3 - .byte 3 - .byte 5 - .byte 4 - .byte 90 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_NINCADA - .string "NINDA$ " - .string "RAYMOND$" - gfxId 44 - .4byte 0x10200fff - aiPool 0, 0, 0, 0, 1, 0 - .2byte MOVE_LEECH_LIFE - .2byte MOVE_FALSE_SWIPE - .2byte MOVE_FURY_SWIPES - .2byte MOVE_MIND_READER - .byte 5 - .byte 2 - .byte 10 - .byte 7 - .byte 8 - .byte 100 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SHROOMISH - .string "SMISH$ " - .string "GRANT$ " - gfxId 35 - .4byte 0x20100fff - aiPool 0, 0, 0, 0, 1, 0 - .2byte MOVE_STUN_SPORE - .2byte MOVE_LEECH_SEED - .2byte MOVE_MEGA_DRAIN - .2byte MOVE_ATTRACT - .byte 3 - .byte 3 - .byte 10 - .byte 2 - .byte 2 - .byte 50 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SPHEAL - .string "SLEAL$ " - .string "PAIGE$ " - gfxId 26 - .4byte 0x8080fff - aiPool 0, 0, 1, 1, 0, 0 - .2byte MOVE_AURORA_BEAM - .2byte MOVE_WATER_GUN - .2byte MOVE_GROWL - .2byte MOVE_ROCK_TOMB - .byte 3 - .byte 5 - .byte 1 - .byte 10 - .byte 10 - .byte 60 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SLAKOTH - .string "SLOKTH$ " - .string "ALEC$ " - gfxId 31 - .4byte 0x40040fff - aiPool 0, 0, 1, 1, 0, 1 - .2byte MOVE_STRENGTH - .2byte MOVE_COUNTER - .2byte MOVE_YAWN - .2byte MOVE_ENCORE - .byte 10 - .byte 4 - .byte 4 - .byte 5 - .byte 18 - .byte 70 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_WHISMUR - .string "WHIRIS$ " - .string "SYDNEY$ " - gfxId 47 - .4byte 0x80020fff - aiPool 0, 1, 0, 0, 1, 0 - .2byte MOVE_ASTONISH - .2byte MOVE_SCREECH - .2byte MOVE_UPROAR - .2byte MOVE_HYPER_VOICE - .byte 2 - .byte 2 - .byte 7 - .byte 2 - .byte 7 - .byte 80 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_MAKUHITA - .string "MAHITA$ " - .string "MORRIS$ " - gfxId 38 - .4byte 0x8010fff - aiPool 0, 1, 0, 0, 0, 1 - .2byte MOVE_SEISMIC_TOSS - .2byte MOVE_VITAL_THROW - .2byte MOVE_TACKLE - .2byte MOVE_REVERSAL - .byte 9 - .byte 1 - .byte 1 - .byte 8 - .byte 1 - .byte 90 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_ARON - .string "RONAR$ " - .string "MARIAH$ " - gfxId 10 - .4byte 0x8008fff - aiPool 0, 1, 0, 0, 0, 1 - .2byte MOVE_METAL_CLAW - .2byte MOVE_IRON_DEFENSE - .2byte MOVE_HEADBUTT - .2byte MOVE_TAKE_DOWN - .byte 5 - .byte 10 - .byte 2 - .byte 10 - .byte 2 - .byte 100 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_CROBAT - .string "BATRO$ " - .string "RUSSELL$" - gfxId 33 - .4byte 0x90004fff - aiPool 0, 0, 1, 1, 1, 0 - .2byte MOVE_HAZE - .2byte MOVE_MEAN_LOOK - .2byte MOVE_CONFUSE_RAY - .2byte MOVE_LEECH_LIFE - .byte 4 - .byte 2 - .byte 2 - .byte 2 - .byte 10 - .byte 50 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_GULPIN - .string "GULIN$ " - .string "MELANIE$" - gfxId 6 - .4byte 0x40002fff - aiPool 0, 0, 0, 1, 0, 0 - .2byte MOVE_SLUDGE - .2byte MOVE_AMNESIA - .2byte MOVE_TOXIC - .2byte MOVE_YAWN - .byte 1 - .byte 10 - .byte 1 - .byte 10 - .byte 5 - .byte 60 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_MANECTRIC - .string "RIKELEC$ " - .string "CHANCE$ " - gfxId 15 - .4byte 0x80001fff - aiPool 0, 1, 1, 0, 0, 0 - .2byte MOVE_SPARK - .2byte MOVE_THUNDER_WAVE - .2byte MOVE_THUNDER - .2byte MOVE_ROAR - .byte 20 - .byte 10 - .byte 1 - .byte 1 - .byte 1 - .byte 70 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_BULBASAUR - .string "BULBY$ " - .string "AGATHA$ " - gfxId 20 - .4byte 0xc000fff - aiPool 0, 0, 0, 1, 1, 0 - .2byte MOVE_GROWL - .2byte MOVE_LEECH_SEED - .2byte MOVE_TACKLE - .2byte MOVE_SWEET_SCENT - .byte 5 - .byte 3 - .byte 10 - .byte 10 - .byte 4 - .byte 50 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_BUTTERFREE - .string "FUTTERBE$ " - .string "BEAU$ " - gfxId 40 - .4byte 0x82000fff - aiPool 0, 0, 1, 0, 1, 0 - .2byte MOVE_SUPERSONIC - .2byte MOVE_WHIRLWIND - .2byte MOVE_SILVER_WIND - .2byte MOVE_SAFEGUARD - .byte 3 - .byte 10 - .byte 2 - .byte 10 - .byte 4 - .byte 60 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_PIDGEOTTO - .string "PIDEOT$ " - .string "KAY$ " - gfxId 34 - .4byte 0x21000fff - aiPool 0, 1, 1, 0, 0, 0 - .2byte MOVE_MIRROR_MOVE - .2byte MOVE_QUICK_ATTACK - .2byte MOVE_AERIAL_ACE - .2byte MOVE_FEATHER_DANCE - .byte 10 - .byte 8 - .byte 4 - .byte 2 - .byte 3 - .byte 70 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_DIGLETT - .string "DIGLE$ " - .string "CALE$ " - gfxId 55 - .4byte 0x20800fff - aiPool 0, 0, 0, 0, 1, 1 - .2byte MOVE_DIG - .2byte MOVE_EARTHQUAKE - .2byte MOVE_FISSURE - .2byte MOVE_MAGNITUDE - .byte 4 - .byte 2 - .byte 3 - .byte 5 - .byte 10 - .byte 80 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_POLIWAG - .string "WAGIL$ " - .string "CAITLIN$" - gfxId 53 - .4byte 0x80400fff - aiPool 0, 0, 1, 0, 0, 1 - .2byte MOVE_HYDRO_PUMP - .2byte MOVE_RAIN_DANCE - .2byte MOVE_BODY_SLAM - .2byte MOVE_ICE_BEAM - .byte 2 - .byte 10 - .byte 5 - .byte 3 - .byte 10 - .byte 90 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_TOTODILE - .string "TOTDIL$ " - .string "COLBY$ " - gfxId 5 - .4byte 0x10200fff - aiPool 0, 1, 1, 0, 0, 0 - .2byte MOVE_RAGE - .2byte MOVE_SCREECH - .2byte MOVE_SURF - .2byte MOVE_BLIZZARD - .byte 6 - .byte 10 - .byte 2 - .byte 1 - .byte 5 - .byte 100 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_LEDYBA - .string "BALEDY$ " - .string "KYLIE$ " - gfxId 45 - .4byte 0x20100fff - aiPool 0, 1, 0, 1, 0, 0 - .2byte MOVE_BATON_PASS - .2byte MOVE_AGILITY - .2byte MOVE_SWIFT - .2byte MOVE_ATTRACT - .byte 8 - .byte 6 - .byte 8 - .byte 6 - .byte 2 - .byte 90 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_DELIBIRD - .string "BIRDLY$ " - .string "LIAM$ " - gfxId 66 - .4byte 0x8080fff - aiPool 0, 0, 0, 1, 1, 1 - .2byte MOVE_PRESENT - .2byte MOVE_FACADE - .2byte MOVE_FOCUS_PUNCH - .2byte MOVE_RETURN - .byte 4 - .byte 3 - .byte 10 - .byte 5 - .byte 3 - .byte 80 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_LARVITAR - .string "TARVITAR$ " - .string "MILO$ " - gfxId 39 - .4byte 0x40040fff - aiPool 0, 0, 0, 0, 0, 1 - .2byte MOVE_THRASH - .2byte MOVE_TORMENT - .2byte MOVE_CRUNCH - .2byte MOVE_DIG - .byte 8 - .byte 5 - .byte 5 - .byte 8 - .byte 10 - .byte 70 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_ROSELIA - .string "RELIA$ " - .string "KARINA$ " - gfxId 32 - .4byte 0x24000fff - aiPool 1, 0, 1, 0, 1, 0 - .2byte MOVE_PETAL_DANCE - .2byte MOVE_MAGICAL_LEAF - .2byte MOVE_GRASS_WHISTLE - .2byte MOVE_INGRAIN - .byte 50 - .byte 15 - .byte 75 - .byte 10 - .byte 20 - .byte 100 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_DODRIO - .string "DUODO$ " - .string "BOBBY$ " - gfxId 51 - .4byte 0x82000fff - aiPool 1, 1, 1, 1, 1, 1 - .2byte MOVE_PECK - .2byte MOVE_FURY_ATTACK - .2byte MOVE_RETURN - .2byte MOVE_GROWL - .byte 15 - .byte 21 - .byte 15 - .byte 85 - .byte 35 - .byte 110 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_TRAPINCH - .string "PINCHIN$ " - .string "CLAIRE$ " - gfxId 8 - .4byte 0x81000fff - aiPool 1, 0, 0, 1, 1, 1 - .2byte MOVE_BITE - .2byte MOVE_SAND_ATTACK - .2byte MOVE_DIG - .2byte MOVE_FAINT_ATTACK - .byte 75 - .byte 25 - .byte 25 - .byte 10 - .byte 25 - .byte 120 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_CACNEA - .string "NACAC$ " - .string "WILLIE$ " - gfxId 11 - .4byte 0x80800fff - aiPool 1, 1, 0, 0, 1, 0 - .2byte MOVE_SPIKES - .2byte MOVE_LEER - .2byte MOVE_POISON_STING - .2byte MOVE_SAND_ATTACK - .byte 10 - .byte 30 - .byte 25 - .byte 65 - .byte 25 - .byte 130 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SANDSLASH - .string "SHRAND$ " - .string "CASSIDY$" - gfxId 18 - .4byte 0x10400fff - aiPool 1, 1, 0, 0, 0, 1 - .2byte MOVE_SLASH - .2byte MOVE_DEFENSE_CURL - .2byte MOVE_SWIFT - .2byte MOVE_FURY_SWIPES - .byte 30 - .byte 90 - .byte 30 - .byte 10 - .byte 100 - .byte 140 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_BALTOY - .string "TOYBAL$ " - .string "MORGAN$ " - gfxId 44 - .4byte 0x8200fff - aiPool 1, 0, 1, 0, 1, 0 - .2byte MOVE_SELF_DESTRUCT - .2byte MOVE_ROCK_TOMB - .2byte MOVE_PSYBEAM - .2byte MOVE_CONFUSION - .byte 50 - .byte 40 - .byte 10 - .byte 35 - .byte 35 - .byte 150 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_MEDICHAM - .string "CHAMCHAM$ " - .string "SUMMER$ " - gfxId 26 - .4byte 0x10100fff - aiPool 1, 1, 1, 0, 0, 1 - .2byte MOVE_REVERSAL - .2byte MOVE_THUNDER_PUNCH - .2byte MOVE_FIRE_PUNCH - .2byte MOVE_ICE_PUNCH - .byte 40 - .byte 20 - .byte 40 - .byte 40 - .byte 40 - .byte 100 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SPINDA - .string "SPININ$ " - .string "MILES$ " - gfxId 31 - .4byte 0x80080fff - aiPool 1, 0, 0, 1, 1, 0 - .2byte MOVE_TEETER_DANCE - .2byte MOVE_PSYCH_UP - .2byte MOVE_HYPNOSIS - .2byte MOVE_UPROAR - .byte 25 - .byte 75 - .byte 25 - .byte 10 - .byte 25 - .byte 110 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SWABLU - .string "SWABY$ " - .string "AUDREY$ " - gfxId 47 - .4byte 0xa0040fff - aiPool 1, 0, 1, 0, 1, 0 - .2byte MOVE_MIRROR_MOVE - .2byte MOVE_PERISH_SONG - .2byte MOVE_SAFEGUARD - .2byte MOVE_MIST - .byte 30 - .byte 30 - .byte 40 - .byte 30 - .byte 25 - .byte 120 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SPOINK - .string "POINKER$ " - .string "AVERY$ " - gfxId 38 - .4byte 0x80020fff - aiPool 1, 0, 0, 1, 1, 0 - .2byte 150 - .2byte 109 - .2byte 173 - .2byte 156 - .byte 40 - .byte 10 - .byte 30 - .byte 40 - .byte 30 - .byte 130 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_KECLEON - .string "KECON$ " - .string "ARIANA$ " - gfxId 10 - .4byte 0x80010fff - aiPool 1, 0, 0, 0, 1, 1 - .2byte MOVE_THIEF - .2byte MOVE_SCREECH - .2byte MOVE_ANCIENT_POWER - .2byte MOVE_BIND - .byte 10 - .byte 10 - .byte 40 - .byte 75 - .byte 35 - .byte 140 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_GOLDEEN - .string "GOLDEN$ " - .string "ASHTON$ " - gfxId 33 - .4byte 0x80008fff - aiPool 1, 1, 1, 0, 0, 0 - .2byte MOVE_HORN_ATTACK - .2byte MOVE_FURY_ATTACK - .2byte MOVE_HORN_DRILL - .2byte MOVE_TAIL_WHIP - .byte 70 - .byte 30 - .byte 5 - .byte 30 - .byte 25 - .byte 150 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_BARBOACH - .string "BOBOACH$ " - .string "SANDRA$ " - gfxId 6 - .4byte 0x80004fff - aiPool 1, 0, 0, 1, 1, 1 - .2byte MOVE_MUD_SPORT - .2byte MOVE_WATER_SPORT - .2byte MOVE_EARTHQUAKE - .2byte MOVE_FUTURE_SIGHT - .byte 45 - .byte 45 - .byte 60 - .byte 25 - .byte 15 - .byte 100 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SKARMORY - .string "CORPY$ " - .string "CARSON$ " - gfxId 35 - .4byte 0x8002fff - aiPool 1, 1, 1, 0, 0, 1 - .2byte MOVE_SWIFT - .2byte MOVE_DOUBLE_TEAM - .2byte MOVE_AGILITY - .2byte MOVE_CUT - .byte 40 - .byte 30 - .byte 25 - .byte 60 - .byte 20 - .byte 110 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_LOTAD - .string "TADO$ " - .string "KATRINA$" - gfxId 16 - .4byte 0x8001fff - aiPool 1, 0, 1, 1, 1, 0 - .2byte MOVE_ASTONISH - .2byte MOVE_GROWL - .2byte MOVE_RAIN_DANCE - .2byte MOVE_WATER_PULSE - .byte 15 - .byte 15 - .byte 30 - .byte 15 - .byte 75 - .byte 120 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SLOWBRO - .string "BROWLO$ " - .string "LUKE$ " - gfxId 17 - .4byte 0xc000fff - aiPool 1, 0, 0, 1, 1, 0 - .2byte MOVE_YAWN - .2byte MOVE_DISABLE - .2byte MOVE_GROWL - .2byte MOVE_CONFUSION - .byte 20 - .byte 40 - .byte 40 - .byte 30 - .byte 20 - .byte 100 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_FARFETCHD - .string "FETCHIN$ " - .string "RAUL$ " - gfxId 66 - .4byte 0x82000fff - aiPool 1, 1, 0, 1, 0, 0 - .2byte MOVE_FACADE - .2byte MOVE_FURY_CUTTER - .2byte MOVE_FLY - .2byte MOVE_RETURN - .byte 40 - .byte 10 - .byte 40 - .byte 20 - .byte 20 - .byte 110 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SEEL - .string "SEELEY$ " - .string "JADA$ " - gfxId 20 - .4byte 0x21000fff - aiPool 1, 0, 1, 1, 0, 0 - .2byte MOVE_ATTRACT - .2byte MOVE_ICE_BEAM - .2byte MOVE_SAFEGUARD - .2byte MOVE_GROWL - .byte 10 - .byte 30 - .byte 40 - .byte 20 - .byte 20 - .byte 120 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_DROWZEE - .string "DROWZIN$ " - .string "ZEEK$ " - gfxId 37 - .4byte 0x20800fff - aiPool 1, 0, 1, 1, 1, 1 - .2byte MOVE_DISABLE - .2byte MOVE_FUTURE_SIGHT - .2byte MOVE_HIDDEN_POWER - .2byte MOVE_RETURN - .byte 10 - .byte 40 - .byte 50 - .byte 30 - .byte 45 - .byte 130 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_HITMONCHAN - .string "HITEMON$ " - .string "DIEGO$ " - gfxId 21 - .4byte 0x80400fff - aiPool 1, 1, 0, 0, 0, 1 - .2byte MOVE_SKY_UPPERCUT - .2byte MOVE_DETECT - .2byte MOVE_REVENGE - .2byte MOVE_MEGA_PUNCH - .byte 45 - .byte 20 - .byte 10 - .byte 20 - .byte 45 - .byte 140 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_BLISSEY - .string "BLISS$ " - .string "ALIYAH$ " - gfxId 85 - .4byte 0x10200fff - aiPool 1, 0, 1, 1, 0, 1 - .2byte MOVE_SING - .2byte MOVE_SOFT_BOILED - .2byte MOVE_EGG_BOMB - .2byte MOVE_DOUBLE_EDGE - .byte 20 - .byte 35 - .byte 40 - .byte 20 - .byte 20 - .byte 150 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_ELEKID - .string "KIDLEK$ " - .string "NATALIA$" - gfxId 18 - .4byte 0x20100fff - aiPool 1, 1, 0, 1, 0, 0 - .2byte MOVE_SHOCK_WAVE - .2byte MOVE_QUICK_ATTACK - .2byte MOVE_SCREECH - .2byte MOVE_ATTRACT - .byte 40 - .byte 10 - .byte 40 - .byte 25 - .byte 25 - .byte 140 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SNUBBULL - .string "SNUBBINS$ " - .string "DEVIN$ " - gfxId 48 - .4byte 0x8080fff - aiPool 1, 0, 0, 1, 0, 1 - .2byte MOVE_SCARY_FACE - .2byte MOVE_TAUNT - .2byte MOVE_TAIL_WHIP - .2byte MOVE_BITE - .byte 20 - .byte 20 - .byte 20 - .byte 20 - .byte 20 - .byte 130 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_MISDREAVUS - .string "DREAVIS$ " - .string "TYLOR$ " - gfxId 40 - .4byte 0x40040fff - aiPool 1, 0, 1, 0, 1, 0 - .2byte MOVE_PERISH_SONG - .2byte MOVE_MEAN_LOOK - .2byte MOVE_CONFUSE_RAY - .2byte MOVE_PAIN_SPLIT - .byte 10 - .byte 35 - .byte 10 - .byte 45 - .byte 20 - .byte 120 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_LAIRON - .string "LAIRN$ " - .string "RONNIE$ " - gfxId 55 - .4byte 0x84000fff - aiPool 2, 0, 0, 0, 1, 1 - .2byte MOVE_METAL_SOUND - .2byte MOVE_METAL_CLAW - .2byte MOVE_HARDEN - .2byte MOVE_TAKE_DOWN - .byte 30 - .byte 50 - .byte 35 - .byte 100 - .byte 90 - .byte 200 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SHIFTRY - .string "SHIFTY$ " - .string "CLAUDIA$" - gfxId 8 - .4byte 0x82000fff - aiPool 2, 1, 1, 0, 0, 0 - .2byte MOVE_GROWTH - .2byte MOVE_RAZOR_WIND - .2byte MOVE_EXPLOSION - .2byte MOVE_EXTRASENSORY - .byte 75 - .byte 75 - .byte 65 - .byte 35 - .byte 70 - .byte 210 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_NINJASK - .string "NINAS$ " - .string "ELIAS$ " - gfxId 11 - .4byte 0x81000fff - aiPool 2, 0, 0, 1, 1, 1 - .2byte MOVE_SCREECH - .2byte MOVE_FURY_SWIPES - .2byte MOVE_SAND_ATTACK - .2byte MOVE_BATON_PASS - .byte 30 - .byte 50 - .byte 95 - .byte 70 - .byte 70 - .byte 220 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SWELLOW - .string "WELOW$ " - .string "JADE$ " - gfxId 18 - .4byte 0x80800fff - aiPool 2, 1, 1, 0, 0, 0 - .2byte MOVE_AGILITY - .2byte MOVE_AERIAL_ACE - .2byte MOVE_WING_ATTACK - .2byte MOVE_FLY - .byte 65 - .byte 85 - .byte 35 - .byte 75 - .byte 40 - .byte 230 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_MIGHTYENA - .string "YENA$ " - .string "FRANCIS$" - gfxId 44 - .4byte 0x80400fff - aiPool 2, 0, 0, 0, 1, 1 - .2byte MOVE_TAUNT - .2byte MOVE_THIEF - .2byte MOVE_ODOR_SLEUTH - .2byte MOVE_TAKE_DOWN - .byte 40 - .byte 80 - .byte 35 - .byte 70 - .byte 70 - .byte 240 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_BEAUTIFLY - .string "TIFLY$ " - .string "ALISHA$ " - gfxId 26 - .4byte 0x80200fff - aiPool 2, 0, 1, 0, 1, 0 - .2byte MOVE_MORNING_SUN - .2byte MOVE_SILVER_WIND - .2byte MOVE_STUN_SPORE - .2byte MOVE_SECRET_POWER - .byte 40 - .byte 70 - .byte 25 - .byte 80 - .byte 100 - .byte 250 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SEAKING - .string "KINGSEA$ " - .string "SAUL$ " - gfxId 31 - .4byte 0x80100fff - aiPool 2, 1, 0, 1, 1, 1 - .2byte MOVE_FLAIL - .2byte MOVE_SUPERSONIC - .2byte MOVE_HORN_ATTACK - .2byte MOVE_FURY_ATTACK - .byte 80 - .byte 60 - .byte 30 - .byte 70 - .byte 90 - .byte 200 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_CASTFORM - .string "CASTER$ " - .string "FELICIA$" - gfxId 47 - .4byte 0x80080fff - aiPool 2, 1, 1, 1, 1, 1 - .2byte MOVE_SUNNY_DAY - .2byte MOVE_WEATHER_BALL - .2byte MOVE_SANDSTORM - .2byte MOVE_RETURN - .byte 70 - .byte 80 - .byte 80 - .byte 50 - .byte 65 - .byte 210 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_MACHOKE - .string "CHOKEM$ " - .string "EMILIO$ " - gfxId 38 - .4byte 0x80040fff - aiPool 2, 1, 0, 0, 0, 1 - .2byte MOVE_SEISMIC_TOSS - .2byte MOVE_FOCUS_ENERGY - .2byte MOVE_KARATE_CHOP - .2byte MOVE_SCARY_FACE - .byte 70 - .byte 85 - .byte 25 - .byte 60 - .byte 50 - .byte 220 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_LOMBRE - .string "LOMBE$ " - .string "KARLA$ " - gfxId 10 - .4byte 0x80020fff - aiPool 2, 0, 1, 1, 1, 0 - .2byte MOVE_ATTRACT - .2byte MOVE_FLASH - .2byte MOVE_UPROAR - .2byte MOVE_GROWL - .byte 40 - .byte 60 - .byte 90 - .byte 45 - .byte 70 - .byte 230 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SEVIPER - .string "VIPES$ " - .string "DARRYL$ " - gfxId 33 - .4byte 0x80010fff - aiPool 2, 0, 0, 0, 1, 1 - .2byte MOVE_POISON_FANG - .2byte MOVE_GLARE - .2byte MOVE_WRAP - .2byte MOVE_SCREECH - .byte 35 - .byte 50 - .byte 90 - .byte 40 - .byte 100 - .byte 240 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_WAILMER - .string "MERAIL$ " - .string "SELENA$ " - gfxId 22 - .4byte 0x80008fff - aiPool 2, 0, 1, 1, 0, 0 - .2byte MOVE_WATER_PULSE - .2byte MOVE_REST - .2byte MOVE_WATER_SPOUT - .2byte MOVE_SPLASH - .byte 30 - .byte 100 - .byte 100 - .byte 50 - .byte 30 - .byte 250 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_MAGIKARP - .string "KARPAG$ " - .string "NOEL$ " - gfxId 35 - .4byte 0x80004fff - aiPool 2, 0, 0, 1, 0, 1 - .2byte MOVE_TACKLE - .2byte MOVE_SPLASH - .2byte MOVE_FLAIL - .2byte MOVE_TACKLE - .byte 30 - .byte 30 - .byte 160 - .byte 50 - .byte 160 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_LUNATONE - .string "LUNONE$ " - .string "LACEY$ " - gfxId 16 - .4byte 0x80002fff - aiPool 2, 0, 1, 0, 1, 0 - .2byte MOVE_EXPLOSION - .2byte MOVE_FUTURE_SIGHT - .2byte MOVE_PSYCHIC - .2byte MOVE_CONFUSION - .byte 50 - .byte 70 - .byte 60 - .byte 70 - .byte 50 - .byte 210 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_ABSOL - .string "ABSO$ " - .string "CORBIN$ " - gfxId 39 - .4byte 0x80001fff - aiPool 2, 1, 1, 0, 0, 0 - .2byte MOVE_PERISH_SONG - .2byte MOVE_HAIL - .2byte MOVE_HYPER_BEAM - .2byte MOVE_SLASH - .byte 95 - .byte 80 - .byte 85 - .byte 35 - .byte 35 - .byte 220 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_EXEGGUTOR - .string "EGGSOR$ " - .string "GRACIE$ " - gfxId 32 - .4byte 0xc000fff - aiPool 2, 0, 0, 0, 1, 1 - .2byte MOVE_STOMP - .2byte MOVE_HYPNOSIS - .2byte MOVE_EGG_BOMB - .2byte MOVE_SKILL_SWAP - .byte 40 - .byte 50 - .byte 60 - .byte 100 - .byte 80 - .byte 200 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_CUBONE - .string "CUBIN$ " - .string "COLTIN$ " - gfxId 65 - .4byte 0x82000fff - aiPool 2, 0, 0, 1, 0, 1 - .2byte MOVE_BONE_CLUB - .2byte MOVE_BONEMERANG - .2byte MOVE_BONE_RUSH - .2byte MOVE_GROWL - .byte 40 - .byte 35 - .byte 85 - .byte 35 - .byte 100 - .byte 210 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_HITMONLEE - .string "HITMON$ " - .string "ELLIE$ " - gfxId 22 - .4byte 0x21000fff - aiPool 2, 1, 0, 0, 0, 1 - .2byte MOVE_REVERSAL - .2byte MOVE_REVENGE - .2byte MOVE_FOCUS_ENERGY - .2byte MOVE_MEGA_KICK - .byte 85 - .byte 30 - .byte 25 - .byte 50 - .byte 100 - .byte 220 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SQUIRTLE - .string "SURTLE$ " - .string "MARCUS$ " - gfxId 49 - .4byte 0x20800fff - aiPool 2, 0, 0, 1, 0, 1 - .2byte MOVE_TAIL_WHIP - .2byte MOVE_BUBBLE - .2byte MOVE_FOCUS_PUNCH - .2byte MOVE_WITHDRAW - .byte 30 - .byte 35 - .byte 100 - .byte 40 - .byte 95 - .byte 230 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_KANGASKHAN - .string "KHANKAN$ " - .string "KIARA$ " - gfxId 14 - .4byte 0x80400fff - aiPool 2, 1, 0, 0, 0, 1 - .2byte MOVE_MEGA_PUNCH - .2byte MOVE_RAGE - .2byte MOVE_FOCUS_PUNCH - .2byte MOVE_TAIL_WHIP - .byte 100 - .byte 50 - .byte 30 - .byte 50 - .byte 100 - .byte 240 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_PINECO - .string "PINOC$ " - .string "BRYCE$ " - gfxId 36 - .4byte 0x10200fff - aiPool 2, 0, 1, 0, 1, 0 - .2byte MOVE_EXPLOSION - .2byte MOVE_SPIKES - .2byte MOVE_LIGHT_SCREEN - .2byte MOVE_GIGA_DRAIN - .byte 80 - .byte 80 - .byte 80 - .byte 80 - .byte 80 - .byte 250 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_DUNSPARCE - .string "DILTOT$ " - .string "JAMIE$ " - gfxId 34 - .4byte 0x20100fff - aiPool 2, 0, 0, 1, 0, 1 - .2byte MOVE_SPITE - .2byte MOVE_YAWN - .2byte MOVE_DEFENSE_CURL - .2byte MOVE_TAKE_DOWN - .byte 40 - .byte 35 - .byte 100 - .byte 40 - .byte 110 - .byte 240 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_HOUNDOOM - .string "DOOMOND$ " - .string "JORGE$ " - gfxId 48 - .4byte 0x8080fff - aiPool 2, 1, 1, 0, 0, 0 - .2byte MOVE_ROAR - .2byte MOVE_FLAMETHROWER - .2byte MOVE_FAINT_ATTACK - .2byte MOVE_SUNNY_DAY - .byte 100 - .byte 100 - .byte 30 - .byte 25 - .byte 80 - .byte 230 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_MILTANK - .string "MILKAN$ " - .string "DEVON$ " - gfxId 25 - .4byte 0x40040fff - aiPool 2, 0, 1, 1, 0, 0 - .2byte MOVE_MILK_DRINK - .2byte MOVE_HEAL_BELL - .2byte MOVE_DEFENSE_CURL - .2byte MOVE_BLIZZARD - .byte 50 - .byte 110 - .byte 100 - .byte 35 - .byte 40 - .byte 220 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_GYARADOS - .string "RADOS$ " - .string "JUSTINA$" - gfxId 32 - .4byte 0x84000fff - aiPool 3, 1, 1, 0, 0, 1 - .2byte MOVE_HYPER_BEAM - .2byte MOVE_HYDRO_PUMP - .2byte MOVE_RAIN_DANCE - .2byte MOVE_BITE - .byte 160 - .byte 200 - .byte 20 - .byte 40 - .byte 160 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_LOUDRED - .string "LOUDERD$ " - .string "RALPH$ " - gfxId 21 - .4byte 0x82000fff - aiPool 3, 1, 0, 0, 0, 1 - .2byte MOVE_HYPER_VOICE - .2byte MOVE_STOMP - .2byte MOVE_ROAR - .2byte MOVE_HOWL - .byte 170 - .byte 50 - .byte 55 - .byte 150 - .byte 160 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SKITTY - .string "SITTY$ " - .string "ROSA$ " - gfxId 8 - .4byte 0x81000fff - aiPool 3, 0, 1, 1, 1, 0 - .2byte MOVE_ATTRACT - .2byte MOVE_ASSIST - .2byte MOVE_FAINT_ATTACK - .2byte MOVE_TAIL_WHIP - .byte 40 - .byte 200 - .byte 150 - .byte 185 - .byte 60 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SLAKING - .string "SLING$ " - .string "KEATON$ " - gfxId 11 - .4byte 0x80800fff - aiPool 3, 0, 0, 1, 1, 1 - .2byte MOVE_COVET - .2byte MOVE_COUNTER - .2byte MOVE_ENCORE - .2byte MOVE_SLACK_OFF - .byte 85 - .byte 85 - .byte 170 - .byte 110 - .byte 150 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_ALTARIA - .string "TARIA$ " - .string "MAYRA$ " - gfxId 18 - .4byte 0x80400fff - aiPool 3, 1, 1, 0, 0, 0 - .2byte MOVE_DRAGON_DANCE - .2byte MOVE_HYPER_BEAM - .2byte MOVE_PERISH_SONG - .2byte MOVE_SAFEGUARD - .byte 170 - .byte 150 - .byte 30 - .byte 30 - .byte 90 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_KIRLIA - .string "LIRKI$ " - .string "LAMAR$ " - gfxId 15 - .4byte 0x80200fff - aiPool 3, 1, 0, 0, 1, 0 - .2byte MOVE_SHOCK_WAVE - .2byte MOVE_SHADOW_BALL - .2byte MOVE_SKILL_SWAP - .2byte MOVE_RETURN - .byte 230 - .byte 60 - .byte 60 - .byte 230 - .byte 80 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_BELLOSSOM - .string "BLOSSOM$ " - .string "AUBREY$ " - gfxId 26 - .4byte 0x80100fff - aiPool 3, 0, 1, 1, 1, 0 - .2byte MOVE_PETAL_DANCE - .2byte MOVE_SWEET_SCENT - .2byte MOVE_STUN_SPORE - .2byte MOVE_FLASH - .byte 35 - .byte 200 - .byte 150 - .byte 130 - .byte 40 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SABLEYE - .string "EYESAB$ " - .string "NIGEL$ " - gfxId 31 - .4byte 0x80080fff - aiPool 3, 0, 0, 1, 1, 1 - .2byte MOVE_MEAN_LOOK - .2byte MOVE_FAINT_ATTACK - .2byte MOVE_KNOCK_OFF - .2byte MOVE_CONFUSE_RAY - .byte 25 - .byte 35 - .byte 230 - .byte 150 - .byte 160 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_NATU - .string "UTAN$ " - .string "CAMILLE$" - gfxId 47 - .4byte 0x80040fff - aiPool 3, 0, 0, 1, 1, 1 - .2byte MOVE_NIGHT_SHADE - .2byte MOVE_FUTURE_SIGHT - .2byte MOVE_CONFUSE_RAY - .2byte MOVE_PSYCHIC - .byte 35 - .byte 35 - .byte 150 - .byte 130 - .byte 170 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SHARPEDO - .string "PEDOS$ " - .string "DEON$ " - gfxId 38 - .4byte 0x80020fff - aiPool 3, 1, 0, 1, 0, 1 - .2byte MOVE_AGILITY - .2byte MOVE_SWAGGER - .2byte MOVE_TAUNT - .2byte MOVE_TAKE_DOWN - .byte 140 - .byte 70 - .byte 140 - .byte 75 - .byte 100 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_LUVDISC - .string "LUVIS$ " - .string "JANELLE$" - gfxId 10 - .4byte 0x80010fff - aiPool 3, 0, 0, 1, 0, 1 - .2byte MOVE_SWEET_KISS - .2byte MOVE_ATTRACT - .2byte MOVE_TAKE_DOWN - .2byte MOVE_CHARM - .byte 50 - .byte 100 - .byte 220 - .byte 40 - .byte 190 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_HERACROSS - .string "HEROSS$ " - .string "HEATH$ " - gfxId 33 - .4byte 0x80008fff - aiPool 3, 1, 0, 0, 0, 1 - .2byte MOVE_STRENGTH - .2byte MOVE_ENDURE - .2byte MOVE_REVERSAL - .2byte MOVE_ROCK_TOMB - .byte 170 - .byte 70 - .byte 110 - .byte 240 - .byte 140 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_ELECTRODE - .string "RODLECT$ " - .string "SASHA$ " - gfxId 6 - .4byte 0x80004fff - aiPool 3, 1, 1, 0, 0, 0 - .2byte MOVE_EXPLOSION - .2byte MOVE_LIGHT_SCREEN - .2byte MOVE_SWIFT - .2byte MOVE_FLASH - .byte 200 - .byte 200 - .byte 30 - .byte 35 - .byte 50 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_PICHU - .string "CHUPY$ " - .string "FRANKIE$" - gfxId 35 - .4byte 0x80002fff - aiPool 3, 0, 1, 1, 1, 0 - .2byte MOVE_SWEET_KISS - .2byte MOVE_ATTRACT - .2byte MOVE_REST - .2byte MOVE_TAIL_WHIP - .byte 25 - .byte 150 - .byte 180 - .byte 115 - .byte 120 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_WOBBUFFET - .string "WOBET$ " - .string "HELEN$ " - gfxId 16 - .4byte 0x80001fff - aiPool 3, 1, 1, 0, 1, 1 - .2byte MOVE_COUNTER - .2byte MOVE_MIRROR_COAT - .2byte MOVE_SAFEGUARD - .2byte MOVE_DESTINY_BOND - .byte 60 - .byte 230 - .byte 50 - .byte 220 - .byte 210 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_GENGAR - .string "GAREN$ " - .string "CAMILE$ " - gfxId 40 - .4byte 0xc000fff - aiPool 3, 1, 0, 0, 0, 1 - .2byte MOVE_DESTINY_BOND - .2byte MOVE_CONFUSE_RAY - .2byte MOVE_LICK - .2byte MOVE_SLUDGE_BOMB - .byte 200 - .byte 100 - .byte 50 - .byte 80 - .byte 180 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_PORYGON - .string "GONPOR$ " - .string "MARTIN$ " - gfxId 46 - .4byte 0x82000fff - aiPool 3, 1, 1, 1, 1, 1 - .2byte MOVE_CONVERSION_2 - .2byte MOVE_CONVERSION - .2byte MOVE_RETURN - .2byte MOVE_RECYCLE - .byte 130 - .byte 130 - .byte 130 - .byte 130 - .byte 130 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_DRAGONITE - .string "DRITE$ " - .string "SERGIO$ " - gfxId 7 - .4byte 0x21000fff - aiPool 3, 1, 0, 0, 0, 1 - .2byte MOVE_OUTRAGE - .2byte MOVE_SLAM - .2byte MOVE_TWISTER - .2byte MOVE_EARTHQUAKE - .byte 150 - .byte 140 - .byte 50 - .byte 120 - .byte 150 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_MEOWTH - .string "MEOWY$ " - .string "KAILEY$ " - gfxId 6 - .4byte 0x20800fff - aiPool 3, 0, 0, 1, 1, 0 - .2byte MOVE_GROWL - .2byte MOVE_TAUNT - .2byte MOVE_PAY_DAY - .2byte MOVE_BITE - .byte 125 - .byte 110 - .byte 180 - .byte 170 - .byte 80 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_JYNX - .string "NYX$ " - .string "PERLA$ " - gfxId 45 - .4byte 0x80400fff - aiPool 3, 0, 1, 0, 1, 0 - .2byte MOVE_PERISH_SONG - .2byte MOVE_MEAN_LOOK - .2byte MOVE_LOVELY_KISS - .2byte MOVE_FAKE_TEARS - .byte 100 - .byte 150 - .byte 100 - .byte 150 - .byte 120 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_TOGEPI - .string "GEPITO$ " - .string "CLARA$ " - gfxId 20 - .4byte 0x10200fff - aiPool 3, 0, 0, 1, 0, 0 - .2byte MOVE_GROWL - .2byte MOVE_YAWN - .2byte MOVE_ENCORE - .2byte MOVE_FOLLOW_ME - .byte 80 - .byte 120 - .byte 200 - .byte 120 - .byte 80 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_ESPEON - .string "SPEON$ " - .string "JAKOB$ " - gfxId 37 - .4byte 0x20100fff - aiPool 3, 1, 1, 0, 0, 0 - .2byte MOVE_SWIFT - .2byte MOVE_QUICK_ATTACK - .2byte MOVE_MORNING_SUN - .2byte MOVE_TAIL_WHIP - .byte 180 - .byte 150 - .byte 100 - .byte 80 - .byte 150 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_SLOWKING - .string "SLOWGO$ " - .string "TREY$ " - gfxId 49 - .4byte 0x8080fff - aiPool 3, 0, 0, 1, 0, 1 - .2byte MOVE_FACADE - .2byte MOVE_CURSE - .2byte MOVE_YAWN - .2byte MOVE_FOCUS_PUNCH - .byte 100 - .byte 80 - .byte 200 - .byte 110 - .byte 170 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - - .2byte SPECIES_URSARING - .string "URSING$ " - .string "LANE$ " - gfxId 44 - .4byte 0x40040fff - aiPool 3, 1, 0, 0, 0, 1 - .2byte MOVE_THRASH - .2byte MOVE_AERIAL_ACE - .2byte MOVE_FAKE_TEARS - .2byte MOVE_LEER - .byte 180 - .byte 140 - .byte 30 - .byte 80 - .byte 190 - .byte 255 - unk2C - .4byte 0x0 - .4byte 0xffff - diff --git a/data/maps/AbandonedShip_CaptainsOffice/map.json b/data/maps/AbandonedShip_CaptainsOffice/map.json index c88afc806..3f612c320 100644 --- a/data/maps/AbandonedShip_CaptainsOffice/map.json +++ b/data/maps/AbandonedShip_CaptainsOffice/map.json @@ -25,7 +25,7 @@ "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", "script": "AbandonedShip_CaptainsOffice_EventScript_2387E2", - "flag": "0" + "flag": "0" }, { "graphics_id": "EVENT_OBJ_GFX_ITEM_BALL", diff --git a/src/contest.c b/src/contest.c index 09847f6b6..3ef8d4b06 100644 --- a/src/contest.c +++ b/src/contest.c @@ -242,7 +242,6 @@ extern const u8 gText_Contest_Fear[]; extern const u8 gText_BDot[]; extern const u8 gText_CDot[]; extern const u8 *const gUnknown_08587E10[]; -extern const struct ContestPokemon gContestOpponents[96]; extern const u8 gUnknown_085898A4[96]; extern const union AffineAnimCmd *const gUnknown_082FF6C0[]; extern const union AffineAnimCmd *const gUnknown_082FF694[]; diff --git a/src/data/contest_opponents.h b/src/data/contest_opponents.h index 07d41d824..8937e9914 100644 --- a/src/data/contest_opponents.h +++ b/src/data/contest_opponents.h @@ -78,9 +78,2791 @@ const struct ContestWinner gUnknown_08587FA4[] = .contestRank = CONTEST_RANK_MASTER } }; -/* + const struct ContestPokemon gContestOpponents[] = { - -};*/ -extern const struct ContestPokemon gContestOpponents[96]; \ No newline at end of file + { + .species = SPECIES_POOCHYENA, + .nickname = _("POOCHY"), + .trainerName = _("JIMMY"), + .trainerGfxId = 7, + .flags = 0xC000FFF, + .whichRank = 0, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_ROAR, + MOVE_BITE, + MOVE_TAKE_DOWN, + MOVE_HOWL + }, + .cool = 10, + .beauty = 4, + .cute = 10, + .smart = 3, + .tough = 4, + .sheen = 50, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_ILLUMISE, + .nickname = _("MUSILLE"), + .trainerName = _("EDITH"), + .trainerGfxId = 8, + .flags = 0x82000FFF, + .whichRank = 0, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_REST, + MOVE_FACADE, + MOVE_TACKLE, + MOVE_COVET + }, + .cool = 10, + .beauty = 10, + .cute = 6, + .smart = 1, + .tough = 2, + .sheen = 60, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_DUSTOX, + .nickname = _("DUSTER"), + .trainerName = _("EVAN"), + .trainerGfxId = 11, + .flags = 0x21000FFF, + .whichRank = 0, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_SILVER_WIND, + MOVE_MOONLIGHT, + MOVE_LIGHT_SCREEN, + MOVE_GUST + }, + .cool = 2, + .beauty = 10, + .cute = 10, + .smart = 12, + .tough = 4, + .sheen = 70, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SEEDOT, + .nickname = _("DOTS"), + .trainerName = _("KELSEY"), + .trainerGfxId = 16, + .flags = 0x20800FFF, + .whichRank = 0, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_BIDE, + MOVE_SYNTHESIS, + MOVE_BULLET_SEED, + MOVE_GROWTH + }, + .cool = 3, + .beauty = 3, + .cute = 5, + .smart = 2, + .tough = 7, + .sheen = 80, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_TAILLOW, + .nickname = _("TATAY"), + .trainerName = _("MADISON"), + .trainerGfxId = 18, + .flags = 0x80400FFF, + .whichRank = 0, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_WING_ATTACK, + MOVE_AGILITY, + MOVE_AERIAL_ACE, + MOVE_GROWL + }, + .cool = 1, + .beauty = 3, + .cute = 3, + .smart = 5, + .tough = 4, + .sheen = 90, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_NINCADA, + .nickname = _("NINDA"), + .trainerName = _("RAYMOND"), + .trainerGfxId = 44, + .flags = 0x10200FFF, + .whichRank = 0, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_LEECH_LIFE, + MOVE_FALSE_SWIPE, + MOVE_FURY_SWIPES, + MOVE_MIND_READER + }, + .cool = 5, + .beauty = 2, + .cute = 10, + .smart = 7, + .tough = 8, + .sheen = 100, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SHROOMISH, + .nickname = _("SMISH"), + .trainerName = _("GRANT"), + .trainerGfxId = 35, + .flags = 0x20100FFF, + .whichRank = 0, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_STUN_SPORE, + MOVE_LEECH_SEED, + MOVE_MEGA_DRAIN, + MOVE_ATTRACT + }, + .cool = 3, + .beauty = 3, + .cute = 10, + .smart = 2, + .tough = 2, + .sheen = 50, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SPHEAL, + .nickname = _("SLEAL"), + .trainerName = _("PAIGE"), + .trainerGfxId = 26, + .flags = 0x8080FFF, + .whichRank = 0, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_AURORA_BEAM, + MOVE_WATER_GUN, + MOVE_GROWL, + MOVE_ROCK_TOMB + }, + .cool = 3, + .beauty = 5, + .cute = 1, + .smart = 10, + .tough = 10, + .sheen = 60, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SLAKOTH, + .nickname = _("SLOKTH"), + .trainerName = _("ALEC"), + .trainerGfxId = 31, + .flags = 0x40040FFF, + .whichRank = 0, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_STRENGTH, + MOVE_COUNTER, + MOVE_YAWN, + MOVE_ENCORE + }, + .cool = 10, + .beauty = 4, + .cute = 4, + .smart = 5, + .tough = 18, + .sheen = 70, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_WHISMUR, + .nickname = _("WHIRIS"), + .trainerName = _("SYDNEY"), + .trainerGfxId = 47, + .flags = 0x80020FFF, + .whichRank = 0, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_ASTONISH, + MOVE_SCREECH, + MOVE_UPROAR, + MOVE_HYPER_VOICE + }, + .cool = 2, + .beauty = 2, + .cute = 7, + .smart = 2, + .tough = 7, + .sheen = 80, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_MAKUHITA, + .nickname = _("MAHITA"), + .trainerName = _("MORRIS"), + .trainerGfxId = 38, + .flags = 0x8010FFF, + .whichRank = 0, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_SEISMIC_TOSS, + MOVE_VITAL_THROW, + MOVE_TACKLE, + MOVE_REVERSAL + }, + .cool = 9, + .beauty = 1, + .cute = 1, + .smart = 8, + .tough = 1, + .sheen = 90, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_ARON, + .nickname = _("RONAR"), + .trainerName = _("MARIAH"), + .trainerGfxId = 10, + .flags = 0x8008FFF, + .whichRank = 0, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_METAL_CLAW, + MOVE_IRON_DEFENSE, + MOVE_HEADBUTT, + MOVE_TAKE_DOWN + }, + .cool = 5, + .beauty = 10, + .cute = 2, + .smart = 10, + .tough = 2, + .sheen = 100, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_CROBAT, + .nickname = _("BATRO"), + .trainerName = _("RUSSELL"), + .trainerGfxId = 33, + .flags = 0x90004FFF, + .whichRank = 0, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_HAZE, + MOVE_MEAN_LOOK, + MOVE_CONFUSE_RAY, + MOVE_LEECH_LIFE + }, + .cool = 4, + .beauty = 2, + .cute = 2, + .smart = 2, + .tough = 10, + .sheen = 50, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_GULPIN, + .nickname = _("GULIN"), + .trainerName = _("MELANIE"), + .trainerGfxId = 6, + .flags = 0x40002FFF, + .whichRank = 0, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_SLUDGE, + MOVE_AMNESIA, + MOVE_TOXIC, + MOVE_YAWN + }, + .cool = 1, + .beauty = 10, + .cute = 1, + .smart = 10, + .tough = 5, + .sheen = 60, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_MANECTRIC, + .nickname = _("RIKELEC"), + .trainerName = _("CHANCE"), + .trainerGfxId = 15, + .flags = 0x80001FFF, + .whichRank = 0, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_SPARK, + MOVE_THUNDER_WAVE, + MOVE_THUNDER, + MOVE_ROAR + }, + .cool = 20, + .beauty = 10, + .cute = 1, + .smart = 1, + .tough = 1, + .sheen = 70, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_BULBASAUR, + .nickname = _("BULBY"), + .trainerName = _("AGATHA"), + .trainerGfxId = 20, + .flags = 0xC000FFF, + .whichRank = 0, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_GROWL, + MOVE_LEECH_SEED, + MOVE_TACKLE, + MOVE_SWEET_SCENT + }, + .cool = 5, + .beauty = 3, + .cute = 10, + .smart = 10, + .tough = 4, + .sheen = 50, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_BUTTERFREE, + .nickname = _("FUTTERBE"), + .trainerName = _("BEAU"), + .trainerGfxId = 40, + .flags = 0x82000FFF, + .whichRank = 0, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_SUPERSONIC, + MOVE_WHIRLWIND, + MOVE_SILVER_WIND, + MOVE_SAFEGUARD + }, + .cool = 3, + .beauty = 10, + .cute = 2, + .smart = 10, + .tough = 4, + .sheen = 60, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_PIDGEOTTO, + .nickname = _("PIDEOT"), + .trainerName = _("KAY"), + .trainerGfxId = 34, + .flags = 0x21000FFF, + .whichRank = 0, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_MIRROR_MOVE, + MOVE_QUICK_ATTACK, + MOVE_AERIAL_ACE, + MOVE_FEATHER_DANCE + }, + .cool = 10, + .beauty = 8, + .cute = 4, + .smart = 2, + .tough = 3, + .sheen = 70, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_DIGLETT, + .nickname = _("DIGLE"), + .trainerName = _("CALE"), + .trainerGfxId = 55, + .flags = 0x20800FFF, + .whichRank = 0, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_DIG, + MOVE_EARTHQUAKE, + MOVE_FISSURE, + MOVE_MAGNITUDE + }, + .cool = 4, + .beauty = 2, + .cute = 3, + .smart = 5, + .tough = 10, + .sheen = 80, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_POLIWAG, + .nickname = _("WAGIL"), + .trainerName = _("CAITLIN"), + .trainerGfxId = 53, + .flags = 0x80400FFF, + .whichRank = 0, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_HYDRO_PUMP, + MOVE_RAIN_DANCE, + MOVE_BODY_SLAM, + MOVE_ICE_BEAM + }, + .cool = 2, + .beauty = 10, + .cute = 5, + .smart = 3, + .tough = 10, + .sheen = 90, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_TOTODILE, + .nickname = _("TOTDIL"), + .trainerName = _("COLBY"), + .trainerGfxId = 5, + .flags = 0x10200FFF, + .whichRank = 0, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_RAGE, + MOVE_SCREECH, + MOVE_SURF, + MOVE_BLIZZARD + }, + .cool = 6, + .beauty = 10, + .cute = 2, + .smart = 1, + .tough = 5, + .sheen = 100, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_LEDYBA, + .nickname = _("BALEDY"), + .trainerName = _("KYLIE"), + .trainerGfxId = 45, + .flags = 0x20100FFF, + .whichRank = 0, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_BATON_PASS, + MOVE_AGILITY, + MOVE_SWIFT, + MOVE_ATTRACT + }, + .cool = 8, + .beauty = 6, + .cute = 8, + .smart = 6, + .tough = 2, + .sheen = 90, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_DELIBIRD, + .nickname = _("BIRDLY"), + .trainerName = _("LIAM"), + .trainerGfxId = 66, + .flags = 0x8080FFF, + .whichRank = 0, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_PRESENT, + MOVE_FACADE, + MOVE_FOCUS_PUNCH, + MOVE_RETURN + }, + .cool = 4, + .beauty = 3, + .cute = 10, + .smart = 5, + .tough = 3, + .sheen = 80, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_LARVITAR, + .nickname = _("TARVITAR"), + .trainerName = _("MILO"), + .trainerGfxId = 39, + .flags = 0x40040FFF, + .whichRank = 0, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_THRASH, + MOVE_TORMENT, + MOVE_CRUNCH, + MOVE_DIG + }, + .cool = 8, + .beauty = 5, + .cute = 5, + .smart = 8, + .tough = 10, + .sheen = 70, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_ROSELIA, + .nickname = _("RELIA"), + .trainerName = _("KARINA"), + .trainerGfxId = 32, + .flags = 0x24000FFF, + .whichRank = 1, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_PETAL_DANCE, + MOVE_MAGICAL_LEAF, + MOVE_GRASS_WHISTLE, + MOVE_INGRAIN + }, + .cool = 50, + .beauty = 15, + .cute = 75, + .smart = 10, + .tough = 20, + .sheen = 100, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_DODRIO, + .nickname = _("DUODO"), + .trainerName = _("BOBBY"), + .trainerGfxId = 51, + .flags = 0x82000FFF, + .whichRank = 1, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_PECK, + MOVE_FURY_ATTACK, + MOVE_RETURN, + MOVE_GROWL + }, + .cool = 15, + .beauty = 21, + .cute = 15, + .smart = 85, + .tough = 35, + .sheen = 110, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_TRAPINCH, + .nickname = _("PINCHIN"), + .trainerName = _("CLAIRE"), + .trainerGfxId = 8, + .flags = 0x81000FFF, + .whichRank = 1, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_BITE, + MOVE_SAND_ATTACK, + MOVE_DIG, + MOVE_FAINT_ATTACK + }, + .cool = 75, + .beauty = 25, + .cute = 25, + .smart = 10, + .tough = 25, + .sheen = 120, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_CACNEA, + .nickname = _("NACAC"), + .trainerName = _("WILLIE"), + .trainerGfxId = 11, + .flags = 0x80800FFF, + .whichRank = 1, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_SPIKES, + MOVE_LEER, + MOVE_POISON_STING, + MOVE_SAND_ATTACK + }, + .cool = 10, + .beauty = 30, + .cute = 25, + .smart = 65, + .tough = 25, + .sheen = 130, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SANDSLASH, + .nickname = _("SHRAND"), + .trainerName = _("CASSIDY"), + .trainerGfxId = 18, + .flags = 0x10400FFF, + .whichRank = 1, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_SLASH, + MOVE_DEFENSE_CURL, + MOVE_SWIFT, + MOVE_FURY_SWIPES + }, + .cool = 30, + .beauty = 90, + .cute = 30, + .smart = 10, + .tough = 100, + .sheen = 140, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_BALTOY, + .nickname = _("TOYBAL"), + .trainerName = _("MORGAN"), + .trainerGfxId = 44, + .flags = 0x8200FFF, + .whichRank = 1, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_SELF_DESTRUCT, + MOVE_ROCK_TOMB, + MOVE_PSYBEAM, + MOVE_CONFUSION + }, + .cool = 50, + .beauty = 40, + .cute = 10, + .smart = 35, + .tough = 35, + .sheen = 150, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_MEDICHAM, + .nickname = _("CHAMCHAM"), + .trainerName = _("SUMMER"), + .trainerGfxId = 26, + .flags = 0x10100FFF, + .whichRank = 1, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_REVERSAL, + MOVE_THUNDER_PUNCH, + MOVE_FIRE_PUNCH, + MOVE_ICE_PUNCH + }, + .cool = 40, + .beauty = 20, + .cute = 40, + .smart = 40, + .tough = 40, + .sheen = 100, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SPINDA, + .nickname = _("SPININ"), + .trainerName = _("MILES"), + .trainerGfxId = 31, + .flags = 0x80080FFF, + .whichRank = 1, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_TEETER_DANCE, + MOVE_PSYCH_UP, + MOVE_HYPNOSIS, + MOVE_UPROAR + }, + .cool = 25, + .beauty = 75, + .cute = 25, + .smart = 10, + .tough = 25, + .sheen = 110, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SWABLU, + .nickname = _("SWABY"), + .trainerName = _("AUDREY"), + .trainerGfxId = 47, + .flags = 0xA0040FFF, + .whichRank = 1, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_MIRROR_MOVE, + MOVE_PERISH_SONG, + MOVE_SAFEGUARD, + MOVE_MIST + }, + .cool = 30, + .beauty = 30, + .cute = 40, + .smart = 30, + .tough = 25, + .sheen = 120, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SPOINK, + .nickname = _("POINKER"), + .trainerName = _("AVERY"), + .trainerGfxId = 38, + .flags = 0x80020FFF, + .whichRank = 1, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_SPLASH, + MOVE_CONFUSE_RAY, + MOVE_SNORE, + MOVE_REST + }, + .cool = 40, + .beauty = 10, + .cute = 30, + .smart = 40, + .tough = 30, + .sheen = 130, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_KECLEON, + .nickname = _("KECON"), + .trainerName = _("ARIANA"), + .trainerGfxId = 10, + .flags = 0x80010FFF, + .whichRank = 1, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_THIEF, + MOVE_SCREECH, + MOVE_ANCIENT_POWER, + MOVE_BIND + }, + .cool = 10, + .beauty = 10, + .cute = 40, + .smart = 75, + .tough = 35, + .sheen = 140, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_GOLDEEN, + .nickname = _("GOLDEN"), + .trainerName = _("ASHTON"), + .trainerGfxId = 33, + .flags = 0x80008FFF, + .whichRank = 1, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_HORN_ATTACK, + MOVE_FURY_ATTACK, + MOVE_HORN_DRILL, + MOVE_TAIL_WHIP + }, + .cool = 70, + .beauty = 30, + .cute = 5, + .smart = 30, + .tough = 25, + .sheen = 150, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_BARBOACH, + .nickname = _("BOBOACH"), + .trainerName = _("SANDRA"), + .trainerGfxId = 6, + .flags = 0x80004FFF, + .whichRank = 1, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_MUD_SPORT, + MOVE_WATER_SPORT, + MOVE_EARTHQUAKE, + MOVE_FUTURE_SIGHT + }, + .cool = 45, + .beauty = 45, + .cute = 60, + .smart = 25, + .tough = 15, + .sheen = 100, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SKARMORY, + .nickname = _("CORPY"), + .trainerName = _("CARSON"), + .trainerGfxId = 35, + .flags = 0x8002FFF, + .whichRank = 1, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_SWIFT, + MOVE_DOUBLE_TEAM, + MOVE_AGILITY, + MOVE_CUT + }, + .cool = 40, + .beauty = 30, + .cute = 25, + .smart = 60, + .tough = 20, + .sheen = 110, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_LOTAD, + .nickname = _("TADO"), + .trainerName = _("KATRINA"), + .trainerGfxId = 16, + .flags = 0x8001FFF, + .whichRank = 1, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_ASTONISH, + MOVE_GROWL, + MOVE_RAIN_DANCE, + MOVE_WATER_PULSE + }, + .cool = 15, + .beauty = 15, + .cute = 30, + .smart = 15, + .tough = 75, + .sheen = 120, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SLOWBRO, + .nickname = _("BROWLO"), + .trainerName = _("LUKE"), + .trainerGfxId = 17, + .flags = 0xC000FFF, + .whichRank = 1, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_YAWN, + MOVE_DISABLE, + MOVE_GROWL, + MOVE_CONFUSION + }, + .cool = 20, + .beauty = 40, + .cute = 40, + .smart = 30, + .tough = 20, + .sheen = 100, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_FARFETCHD, + .nickname = _("FETCHIN"), + .trainerName = _("RAUL"), + .trainerGfxId = 66, + .flags = 0x82000FFF, + .whichRank = 1, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_FACADE, + MOVE_FURY_CUTTER, + MOVE_FLY, + MOVE_RETURN + }, + .cool = 40, + .beauty = 10, + .cute = 40, + .smart = 20, + .tough = 20, + .sheen = 110, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SEEL, + .nickname = _("SEELEY"), + .trainerName = _("JADA"), + .trainerGfxId = 20, + .flags = 0x21000FFF, + .whichRank = 1, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_ATTRACT, + MOVE_ICE_BEAM, + MOVE_SAFEGUARD, + MOVE_GROWL + }, + .cool = 10, + .beauty = 30, + .cute = 40, + .smart = 20, + .tough = 20, + .sheen = 120, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_DROWZEE, + .nickname = _("DROWZIN"), + .trainerName = _("ZEEK"), + .trainerGfxId = 37, + .flags = 0x20800FFF, + .whichRank = 1, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_DISABLE, + MOVE_FUTURE_SIGHT, + MOVE_HIDDEN_POWER, + MOVE_RETURN + }, + .cool = 10, + .beauty = 40, + .cute = 50, + .smart = 30, + .tough = 45, + .sheen = 130, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_HITMONCHAN, + .nickname = _("HITEMON"), + .trainerName = _("DIEGO"), + .trainerGfxId = 21, + .flags = 0x80400FFF, + .whichRank = 1, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_SKY_UPPERCUT, + MOVE_DETECT, + MOVE_REVENGE, + MOVE_MEGA_PUNCH + }, + .cool = 45, + .beauty = 20, + .cute = 10, + .smart = 20, + .tough = 45, + .sheen = 140, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_BLISSEY, + .nickname = _("BLISS"), + .trainerName = _("ALIYAH"), + .trainerGfxId = 85, + .flags = 0x10200FFF, + .whichRank = 1, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_SING, + MOVE_SOFT_BOILED, + MOVE_EGG_BOMB, + MOVE_DOUBLE_EDGE + }, + .cool = 20, + .beauty = 35, + .cute = 40, + .smart = 20, + .tough = 20, + .sheen = 150, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_ELEKID, + .nickname = _("KIDLEK"), + .trainerName = _("NATALIA"), + .trainerGfxId = 18, + .flags = 0x20100FFF, + .whichRank = 1, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_SHOCK_WAVE, + MOVE_QUICK_ATTACK, + MOVE_SCREECH, + MOVE_ATTRACT + }, + .cool = 40, + .beauty = 10, + .cute = 40, + .smart = 25, + .tough = 25, + .sheen = 140, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SNUBBULL, + .nickname = _("SNUBBINS"), + .trainerName = _("DEVIN"), + .trainerGfxId = 48, + .flags = 0x8080FFF, + .whichRank = 1, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_SCARY_FACE, + MOVE_TAUNT, + MOVE_TAIL_WHIP, + MOVE_BITE + }, + .cool = 20, + .beauty = 20, + .cute = 20, + .smart = 20, + .tough = 20, + .sheen = 130, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_MISDREAVUS, + .nickname = _("DREAVIS"), + .trainerName = _("TYLOR"), + .trainerGfxId = 40, + .flags = 0x40040FFF, + .whichRank = 1, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_PERISH_SONG, + MOVE_MEAN_LOOK, + MOVE_CONFUSE_RAY, + MOVE_PAIN_SPLIT + }, + .cool = 10, + .beauty = 35, + .cute = 10, + .smart = 45, + .tough = 20, + .sheen = 120, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_LAIRON, + .nickname = _("LAIRN"), + .trainerName = _("RONNIE"), + .trainerGfxId = 55, + .flags = 0x84000FFF, + .whichRank = 2, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_METAL_SOUND, + MOVE_METAL_CLAW, + MOVE_HARDEN, + MOVE_TAKE_DOWN + }, + .cool = 30, + .beauty = 50, + .cute = 35, + .smart = 100, + .tough = 90, + .sheen = 200, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SHIFTRY, + .nickname = _("SHIFTY"), + .trainerName = _("CLAUDIA"), + .trainerGfxId = 8, + .flags = 0x82000FFF, + .whichRank = 2, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_GROWTH, + MOVE_RAZOR_WIND, + MOVE_EXPLOSION, + MOVE_EXTRASENSORY + }, + .cool = 75, + .beauty = 75, + .cute = 65, + .smart = 35, + .tough = 70, + .sheen = 210, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_NINJASK, + .nickname = _("NINAS"), + .trainerName = _("ELIAS"), + .trainerGfxId = 11, + .flags = 0x81000FFF, + .whichRank = 2, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_SCREECH, + MOVE_FURY_SWIPES, + MOVE_SAND_ATTACK, + MOVE_BATON_PASS + }, + .cool = 30, + .beauty = 50, + .cute = 95, + .smart = 70, + .tough = 70, + .sheen = 220, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SWELLOW, + .nickname = _("WELOW"), + .trainerName = _("JADE"), + .trainerGfxId = 18, + .flags = 0x80800FFF, + .whichRank = 2, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_AGILITY, + MOVE_AERIAL_ACE, + MOVE_WING_ATTACK, + MOVE_FLY + }, + .cool = 65, + .beauty = 85, + .cute = 35, + .smart = 75, + .tough = 40, + .sheen = 230, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_MIGHTYENA, + .nickname = _("YENA"), + .trainerName = _("FRANCIS"), + .trainerGfxId = 44, + .flags = 0x80400FFF, + .whichRank = 2, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_TAUNT, + MOVE_THIEF, + MOVE_ODOR_SLEUTH, + MOVE_TAKE_DOWN + }, + .cool = 40, + .beauty = 80, + .cute = 35, + .smart = 70, + .tough = 70, + .sheen = 240, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_BEAUTIFLY, + .nickname = _("TIFLY"), + .trainerName = _("ALISHA"), + .trainerGfxId = 26, + .flags = 0x80200FFF, + .whichRank = 2, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_MORNING_SUN, + MOVE_SILVER_WIND, + MOVE_STUN_SPORE, + MOVE_SECRET_POWER + }, + .cool = 40, + .beauty = 70, + .cute = 25, + .smart = 80, + .tough = 100, + .sheen = 250, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SEAKING, + .nickname = _("KINGSEA"), + .trainerName = _("SAUL"), + .trainerGfxId = 31, + .flags = 0x80100FFF, + .whichRank = 2, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_FLAIL, + MOVE_SUPERSONIC, + MOVE_HORN_ATTACK, + MOVE_FURY_ATTACK + }, + .cool = 80, + .beauty = 60, + .cute = 30, + .smart = 70, + .tough = 90, + .sheen = 200, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_CASTFORM, + .nickname = _("CASTER"), + .trainerName = _("FELICIA"), + .trainerGfxId = 47, + .flags = 0x80080FFF, + .whichRank = 2, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_SUNNY_DAY, + MOVE_WEATHER_BALL, + MOVE_SANDSTORM, + MOVE_RETURN + }, + .cool = 70, + .beauty = 80, + .cute = 80, + .smart = 50, + .tough = 65, + .sheen = 210, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_MACHOKE, + .nickname = _("CHOKEM"), + .trainerName = _("EMILIO"), + .trainerGfxId = 38, + .flags = 0x80040FFF, + .whichRank = 2, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_SEISMIC_TOSS, + MOVE_FOCUS_ENERGY, + MOVE_KARATE_CHOP, + MOVE_SCARY_FACE + }, + .cool = 70, + .beauty = 85, + .cute = 25, + .smart = 60, + .tough = 50, + .sheen = 220, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_LOMBRE, + .nickname = _("LOMBE"), + .trainerName = _("KARLA"), + .trainerGfxId = 10, + .flags = 0x80020FFF, + .whichRank = 2, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_ATTRACT, + MOVE_FLASH, + MOVE_UPROAR, + MOVE_GROWL + }, + .cool = 40, + .beauty = 60, + .cute = 90, + .smart = 45, + .tough = 70, + .sheen = 230, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SEVIPER, + .nickname = _("VIPES"), + .trainerName = _("DARRYL"), + .trainerGfxId = 33, + .flags = 0x80010FFF, + .whichRank = 2, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_POISON_FANG, + MOVE_GLARE, + MOVE_WRAP, + MOVE_SCREECH + }, + .cool = 35, + .beauty = 50, + .cute = 90, + .smart = 40, + .tough = 100, + .sheen = 240, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_WAILMER, + .nickname = _("MERAIL"), + .trainerName = _("SELENA"), + .trainerGfxId = 22, + .flags = 0x80008FFF, + .whichRank = 2, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_WATER_PULSE, + MOVE_REST, + MOVE_WATER_SPOUT, + MOVE_SPLASH + }, + .cool = 30, + .beauty = 100, + .cute = 100, + .smart = 50, + .tough = 30, + .sheen = 250, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_MAGIKARP, + .nickname = _("KARPAG"), + .trainerName = _("NOEL"), + .trainerGfxId = 35, + .flags = 0x80004FFF, + .whichRank = 2, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_TACKLE, + MOVE_SPLASH, + MOVE_FLAIL, + MOVE_TACKLE + }, + .cool = 30, + .beauty = 30, + .cute = 160, + .smart = 50, + .tough = 160, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_LUNATONE, + .nickname = _("LUNONE"), + .trainerName = _("LACEY"), + .trainerGfxId = 16, + .flags = 0x80002FFF, + .whichRank = 2, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_EXPLOSION, + MOVE_FUTURE_SIGHT, + MOVE_PSYCHIC, + MOVE_CONFUSION + }, + .cool = 50, + .beauty = 70, + .cute = 60, + .smart = 70, + .tough = 50, + .sheen = 210, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_ABSOL, + .nickname = _("ABSO"), + .trainerName = _("CORBIN"), + .trainerGfxId = 39, + .flags = 0x80001FFF, + .whichRank = 2, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_PERISH_SONG, + MOVE_HAIL, + MOVE_HYPER_BEAM, + MOVE_SLASH + }, + .cool = 95, + .beauty = 80, + .cute = 85, + .smart = 35, + .tough = 35, + .sheen = 220, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_EXEGGUTOR, + .nickname = _("EGGSOR"), + .trainerName = _("GRACIE"), + .trainerGfxId = 32, + .flags = 0xC000FFF, + .whichRank = 2, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_STOMP, + MOVE_HYPNOSIS, + MOVE_EGG_BOMB, + MOVE_SKILL_SWAP + }, + .cool = 40, + .beauty = 50, + .cute = 60, + .smart = 100, + .tough = 80, + .sheen = 200, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_CUBONE, + .nickname = _("CUBIN"), + .trainerName = _("COLTIN"), + .trainerGfxId = 65, + .flags = 0x82000FFF, + .whichRank = 2, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_BONE_CLUB, + MOVE_BONEMERANG, + MOVE_BONE_RUSH, + MOVE_GROWL + }, + .cool = 40, + .beauty = 35, + .cute = 85, + .smart = 35, + .tough = 100, + .sheen = 210, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_HITMONLEE, + .nickname = _("HITMON"), + .trainerName = _("ELLIE"), + .trainerGfxId = 22, + .flags = 0x21000FFF, + .whichRank = 2, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_REVERSAL, + MOVE_REVENGE, + MOVE_FOCUS_ENERGY, + MOVE_MEGA_KICK + }, + .cool = 85, + .beauty = 30, + .cute = 25, + .smart = 50, + .tough = 100, + .sheen = 220, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SQUIRTLE, + .nickname = _("SURTLE"), + .trainerName = _("MARCUS"), + .trainerGfxId = 49, + .flags = 0x20800FFF, + .whichRank = 2, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_TAIL_WHIP, + MOVE_BUBBLE, + MOVE_FOCUS_PUNCH, + MOVE_WITHDRAW + }, + .cool = 30, + .beauty = 35, + .cute = 100, + .smart = 40, + .tough = 95, + .sheen = 230, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_KANGASKHAN, + .nickname = _("KHANKAN"), + .trainerName = _("KIARA"), + .trainerGfxId = 14, + .flags = 0x80400FFF, + .whichRank = 2, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_MEGA_PUNCH, + MOVE_RAGE, + MOVE_FOCUS_PUNCH, + MOVE_TAIL_WHIP + }, + .cool = 100, + .beauty = 50, + .cute = 30, + .smart = 50, + .tough = 100, + .sheen = 240, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_PINECO, + .nickname = _("PINOC"), + .trainerName = _("BRYCE"), + .trainerGfxId = 36, + .flags = 0x10200FFF, + .whichRank = 2, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_EXPLOSION, + MOVE_SPIKES, + MOVE_LIGHT_SCREEN, + MOVE_GIGA_DRAIN + }, + .cool = 80, + .beauty = 80, + .cute = 80, + .smart = 80, + .tough = 80, + .sheen = 250, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_DUNSPARCE, + .nickname = _("DILTOT"), + .trainerName = _("JAMIE"), + .trainerGfxId = 34, + .flags = 0x20100FFF, + .whichRank = 2, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_SPITE, + MOVE_YAWN, + MOVE_DEFENSE_CURL, + MOVE_TAKE_DOWN + }, + .cool = 40, + .beauty = 35, + .cute = 100, + .smart = 40, + .tough = 110, + .sheen = 240, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_HOUNDOOM, + .nickname = _("DOOMOND"), + .trainerName = _("JORGE"), + .trainerGfxId = 48, + .flags = 0x8080FFF, + .whichRank = 2, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_ROAR, + MOVE_FLAMETHROWER, + MOVE_FAINT_ATTACK, + MOVE_SUNNY_DAY + }, + .cool = 100, + .beauty = 100, + .cute = 30, + .smart = 25, + .tough = 80, + .sheen = 230, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_MILTANK, + .nickname = _("MILKAN"), + .trainerName = _("DEVON"), + .trainerGfxId = 25, + .flags = 0x40040FFF, + .whichRank = 2, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_MILK_DRINK, + MOVE_HEAL_BELL, + MOVE_DEFENSE_CURL, + MOVE_BLIZZARD + }, + .cool = 50, + .beauty = 110, + .cute = 100, + .smart = 35, + .tough = 40, + .sheen = 220, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_GYARADOS, + .nickname = _("RADOS"), + .trainerName = _("JUSTINA"), + .trainerGfxId = 32, + .flags = 0x84000FFF, + .whichRank = 3, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_HYPER_BEAM, + MOVE_HYDRO_PUMP, + MOVE_RAIN_DANCE, + MOVE_BITE + }, + .cool = 160, + .beauty = 200, + .cute = 20, + .smart = 40, + .tough = 160, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_LOUDRED, + .nickname = _("LOUDERD"), + .trainerName = _("RALPH"), + .trainerGfxId = 21, + .flags = 0x82000FFF, + .whichRank = 3, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_HYPER_VOICE, + MOVE_STOMP, + MOVE_ROAR, + MOVE_HOWL + }, + .cool = 170, + .beauty = 50, + .cute = 55, + .smart = 150, + .tough = 160, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SKITTY, + .nickname = _("SITTY"), + .trainerName = _("ROSA"), + .trainerGfxId = 8, + .flags = 0x81000FFF, + .whichRank = 3, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_ATTRACT, + MOVE_ASSIST, + MOVE_FAINT_ATTACK, + MOVE_TAIL_WHIP + }, + .cool = 40, + .beauty = 200, + .cute = 150, + .smart = 185, + .tough = 60, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SLAKING, + .nickname = _("SLING"), + .trainerName = _("KEATON"), + .trainerGfxId = 11, + .flags = 0x80800FFF, + .whichRank = 3, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_COVET, + MOVE_COUNTER, + MOVE_ENCORE, + MOVE_SLACK_OFF + }, + .cool = 85, + .beauty = 85, + .cute = 170, + .smart = 110, + .tough = 150, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_ALTARIA, + .nickname = _("TARIA"), + .trainerName = _("MAYRA"), + .trainerGfxId = 18, + .flags = 0x80400FFF, + .whichRank = 3, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_DRAGON_DANCE, + MOVE_HYPER_BEAM, + MOVE_PERISH_SONG, + MOVE_SAFEGUARD + }, + .cool = 170, + .beauty = 150, + .cute = 30, + .smart = 30, + .tough = 90, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_KIRLIA, + .nickname = _("LIRKI"), + .trainerName = _("LAMAR"), + .trainerGfxId = 15, + .flags = 0x80200FFF, + .whichRank = 3, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_SHOCK_WAVE, + MOVE_SHADOW_BALL, + MOVE_SKILL_SWAP, + MOVE_RETURN + }, + .cool = 230, + .beauty = 60, + .cute = 60, + .smart = 230, + .tough = 80, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_BELLOSSOM, + .nickname = _("BLOSSOM"), + .trainerName = _("AUBREY"), + .trainerGfxId = 26, + .flags = 0x80100FFF, + .whichRank = 3, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_PETAL_DANCE, + MOVE_SWEET_SCENT, + MOVE_STUN_SPORE, + MOVE_FLASH + }, + .cool = 35, + .beauty = 200, + .cute = 150, + .smart = 130, + .tough = 40, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SABLEYE, + .nickname = _("EYESAB"), + .trainerName = _("NIGEL"), + .trainerGfxId = 31, + .flags = 0x80080FFF, + .whichRank = 3, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_MEAN_LOOK, + MOVE_FAINT_ATTACK, + MOVE_KNOCK_OFF, + MOVE_CONFUSE_RAY + }, + .cool = 25, + .beauty = 35, + .cute = 230, + .smart = 150, + .tough = 160, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_NATU, + .nickname = _("UTAN"), + .trainerName = _("CAMILLE"), + .trainerGfxId = 47, + .flags = 0x80040FFF, + .whichRank = 3, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_NIGHT_SHADE, + MOVE_FUTURE_SIGHT, + MOVE_CONFUSE_RAY, + MOVE_PSYCHIC + }, + .cool = 35, + .beauty = 35, + .cute = 150, + .smart = 130, + .tough = 170, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SHARPEDO, + .nickname = _("PEDOS"), + .trainerName = _("DEON"), + .trainerGfxId = 38, + .flags = 0x80020FFF, + .whichRank = 3, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_AGILITY, + MOVE_SWAGGER, + MOVE_TAUNT, + MOVE_TAKE_DOWN + }, + .cool = 140, + .beauty = 70, + .cute = 140, + .smart = 75, + .tough = 100, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_LUVDISC, + .nickname = _("LUVIS"), + .trainerName = _("JANELLE"), + .trainerGfxId = 10, + .flags = 0x80010FFF, + .whichRank = 3, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_SWEET_KISS, + MOVE_ATTRACT, + MOVE_TAKE_DOWN, + MOVE_CHARM + }, + .cool = 50, + .beauty = 100, + .cute = 220, + .smart = 40, + .tough = 190, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_HERACROSS, + .nickname = _("HEROSS"), + .trainerName = _("HEATH"), + .trainerGfxId = 33, + .flags = 0x80008FFF, + .whichRank = 3, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_STRENGTH, + MOVE_ENDURE, + MOVE_REVERSAL, + MOVE_ROCK_TOMB + }, + .cool = 170, + .beauty = 70, + .cute = 110, + .smart = 240, + .tough = 140, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_ELECTRODE, + .nickname = _("RODLECT"), + .trainerName = _("SASHA"), + .trainerGfxId = 6, + .flags = 0x80004FFF, + .whichRank = 3, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_EXPLOSION, + MOVE_LIGHT_SCREEN, + MOVE_SWIFT, + MOVE_FLASH + }, + .cool = 200, + .beauty = 200, + .cute = 30, + .smart = 35, + .tough = 50, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_PICHU, + .nickname = _("CHUPY"), + .trainerName = _("FRANKIE"), + .trainerGfxId = 35, + .flags = 0x80002FFF, + .whichRank = 3, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_SWEET_KISS, + MOVE_ATTRACT, + MOVE_REST, + MOVE_TAIL_WHIP + }, + .cool = 25, + .beauty = 150, + .cute = 180, + .smart = 115, + .tough = 120, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_WOBBUFFET, + .nickname = _("WOBET"), + .trainerName = _("HELEN"), + .trainerGfxId = 16, + .flags = 0x80001FFF, + .whichRank = 3, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_COUNTER, + MOVE_MIRROR_COAT, + MOVE_SAFEGUARD, + MOVE_DESTINY_BOND + }, + .cool = 60, + .beauty = 230, + .cute = 50, + .smart = 220, + .tough = 210, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_GENGAR, + .nickname = _("GAREN"), + .trainerName = _("CAMILE"), + .trainerGfxId = 40, + .flags = 0xC000FFF, + .whichRank = 3, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_DESTINY_BOND, + MOVE_CONFUSE_RAY, + MOVE_LICK, + MOVE_SLUDGE_BOMB + }, + .cool = 200, + .beauty = 100, + .cute = 50, + .smart = 80, + .tough = 180, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_PORYGON, + .nickname = _("GONPOR"), + .trainerName = _("MARTIN"), + .trainerGfxId = 46, + .flags = 0x82000FFF, + .whichRank = 3, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_CONVERSION_2, + MOVE_CONVERSION, + MOVE_RETURN, + MOVE_RECYCLE + }, + .cool = 130, + .beauty = 130, + .cute = 130, + .smart = 130, + .tough = 130, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_DRAGONITE, + .nickname = _("DRITE"), + .trainerName = _("SERGIO"), + .trainerGfxId = 7, + .flags = 0x21000FFF, + .whichRank = 3, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_OUTRAGE, + MOVE_SLAM, + MOVE_TWISTER, + MOVE_EARTHQUAKE + }, + .cool = 150, + .beauty = 140, + .cute = 50, + .smart = 120, + .tough = 150, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_MEOWTH, + .nickname = _("MEOWY"), + .trainerName = _("KAILEY"), + .trainerGfxId = 6, + .flags = 0x20800FFF, + .whichRank = 3, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_GROWL, + MOVE_TAUNT, + MOVE_PAY_DAY, + MOVE_BITE + }, + .cool = 125, + .beauty = 110, + .cute = 180, + .smart = 170, + .tough = 80, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_JYNX, + .nickname = _("NYX"), + .trainerName = _("PERLA"), + .trainerGfxId = 45, + .flags = 0x80400FFF, + .whichRank = 3, + .aiPool_Cool = FALSE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = TRUE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_PERISH_SONG, + MOVE_MEAN_LOOK, + MOVE_LOVELY_KISS, + MOVE_FAKE_TEARS + }, + .cool = 100, + .beauty = 150, + .cute = 100, + .smart = 150, + .tough = 120, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_TOGEPI, + .nickname = _("GEPITO"), + .trainerName = _("CLARA"), + .trainerGfxId = 20, + .flags = 0x10200FFF, + .whichRank = 3, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_GROWL, + MOVE_YAWN, + MOVE_ENCORE, + MOVE_FOLLOW_ME + }, + .cool = 80, + .beauty = 120, + .cute = 200, + .smart = 120, + .tough = 80, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_ESPEON, + .nickname = _("SPEON"), + .trainerName = _("JAKOB"), + .trainerGfxId = 37, + .flags = 0x20100FFF, + .whichRank = 3, + .aiPool_Cool = TRUE, + .aiPool_Beauty = TRUE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = FALSE, + .moves = + { + MOVE_SWIFT, + MOVE_QUICK_ATTACK, + MOVE_MORNING_SUN, + MOVE_TAIL_WHIP + }, + .cool = 180, + .beauty = 150, + .cute = 100, + .smart = 80, + .tough = 150, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_SLOWKING, + .nickname = _("SLOWGO"), + .trainerName = _("TREY"), + .trainerGfxId = 49, + .flags = 0x8080FFF, + .whichRank = 3, + .aiPool_Cool = FALSE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = TRUE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_FACADE, + MOVE_CURSE, + MOVE_YAWN, + MOVE_FOCUS_PUNCH + }, + .cool = 100, + .beauty = 80, + .cute = 200, + .smart = 110, + .tough = 170, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + }, + { + .species = SPECIES_URSARING, + .nickname = _("URSING"), + .trainerName = _("LANE"), + .trainerGfxId = 44, + .flags = 0x40040FFF, + .whichRank = 3, + .aiPool_Cool = TRUE, + .aiPool_Beauty = FALSE, + .aiPool_Cute = FALSE, + .aiPool_Smart = FALSE, + .aiPool_Tough = TRUE, + .moves = + { + MOVE_THRASH, + MOVE_AERIAL_ACE, + MOVE_FAKE_TEARS, + MOVE_LEER + }, + .cool = 180, + .beauty = 140, + .cute = 30, + .smart = 80, + .tough = 190, + .sheen = 255, + .unk2C = {0}, + .personality = 0, + .otId = 0xFFFF + } +}; \ No newline at end of file From 0c935a8bd500535ba67fad4f25ea50199cfc1871 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Sat, 9 Mar 2019 22:54:17 -0500 Subject: [PATCH 007/101] Move the contest opponent filter to C --- data/contest.s | 5 - include/contest.h | 6 + src/contest.c | 7 +- src/data/contest_opponents.h | 390 ++++++++++++++++++++++++++--------- 4 files changed, 303 insertions(+), 105 deletions(-) diff --git a/data/contest.s b/data/contest.s index b752cf8f3..c04c31577 100644 --- a/data/contest.s +++ b/data/contest.s @@ -6,11 +6,6 @@ .section .rodata .align 2, 0 -gUnknown_085898A4:: @ 85898A4 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 - .byte 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02 - .align 2 gUnknown_08589904:: @ 8589904 obj_tiles gBlankGfxCompressed, 0x1000, 0x80e8 diff --git a/include/contest.h b/include/contest.h index a803c6d4c..5c299bee5 100644 --- a/include/contest.h +++ b/include/contest.h @@ -204,6 +204,12 @@ enum { CONTEST_RANK_LINK }; +enum { + CONTEST_FILTER_NONE, + CONTEST_FILTER_NO_POSTGAME, + CONTEST_FILTER_ONLY_POSTGAME +}; + struct ContestPokemon { /*0x00*/ u16 species; diff --git a/src/contest.c b/src/contest.c index 3ef8d4b06..bebe344b9 100644 --- a/src/contest.c +++ b/src/contest.c @@ -242,7 +242,6 @@ extern const u8 gText_Contest_Fear[]; extern const u8 gText_BDot[]; extern const u8 gText_CDot[]; extern const u8 *const gUnknown_08587E10[]; -extern const u8 gUnknown_085898A4[96]; extern const union AffineAnimCmd *const gUnknown_082FF6C0[]; extern const union AffineAnimCmd *const gUnknown_082FF694[]; extern const struct SpriteTemplate gSpriteTemplate_8587AD0; @@ -2565,7 +2564,7 @@ void sub_80DAB8C(u8 contestType, u8 rank) r7 = TRUE; // Find all suitable opponents - r3 = gUnknown_085898A4; + r3 = gPostgameContestOpponentFilter; for (i = 0; i < ARRAY_COUNT(gContestOpponents); i++) { if (rank == gContestOpponents[i].whichRank) @@ -2625,12 +2624,12 @@ void sub_80DACBC(u8 contestType, u8 rank, bool32 isPostgame) if (isPostgame == TRUE) { - if (gUnknown_085898A4[i] == 1) + if (gPostgameContestOpponentFilter[i] == CONTEST_FILTER_NO_POSTGAME) continue; } else { - if (gUnknown_085898A4[i] == 2) + if (gPostgameContestOpponentFilter[i] == CONTEST_FILTER_ONLY_POSTGAME) continue; } if ((contestType == CONTEST_CATEGORY_COOL && gContestOpponents[i].aiPool_Cool) diff --git a/src/data/contest_opponents.h b/src/data/contest_opponents.h index 8937e9914..2ebfd1dfd 100644 --- a/src/data/contest_opponents.h +++ b/src/data/contest_opponents.h @@ -3,6 +3,103 @@ #include "contest.h" #include "constants/species.h" +#define CONTEST_OPPONENT_JIMMY 0 +#define CONTEST_OPPONENT_EDITH 1 +#define CONTEST_OPPONENT_EVAN 2 +#define CONTEST_OPPONENT_KELSEY 3 +#define CONTEST_OPPONENT_MADISON 4 +#define CONTEST_OPPONENT_RAYMOND 5 +#define CONTEST_OPPONENT_GRANT 6 +#define CONTEST_OPPONENT_PAIGE 7 +#define CONTEST_OPPONENT_ALEC 8 +#define CONTEST_OPPONENT_SYDNEY 9 +#define CONTEST_OPPONENT_MORRIS 10 +#define CONTEST_OPPONENT_MARIAH 11 +#define CONTEST_OPPONENT_RUSSELL 12 +#define CONTEST_OPPONENT_MELANIE 13 +#define CONTEST_OPPONENT_CHANCE 14 +#define CONTEST_OPPONENT_AGATHA 15 +#define CONTEST_OPPONENT_BEAU 16 +#define CONTEST_OPPONENT_KAY 17 +#define CONTEST_OPPONENT_CALE 18 +#define CONTEST_OPPONENT_CAITLIN 19 +#define CONTEST_OPPONENT_COLBY 20 +#define CONTEST_OPPONENT_KYLIE 21 +#define CONTEST_OPPONENT_LIAM 22 +#define CONTEST_OPPONENT_MILO 23 +#define CONTEST_OPPONENT_KARINA 24 +#define CONTEST_OPPONENT_BOBBY 25 +#define CONTEST_OPPONENT_CLAIRE 26 +#define CONTEST_OPPONENT_WILLIE 27 +#define CONTEST_OPPONENT_CASSIDY 28 +#define CONTEST_OPPONENT_MORGAN 29 +#define CONTEST_OPPONENT_SUMMER 30 +#define CONTEST_OPPONENT_MILES 31 +#define CONTEST_OPPONENT_AUDREY 32 +#define CONTEST_OPPONENT_AVERY 33 +#define CONTEST_OPPONENT_ARIANA 34 +#define CONTEST_OPPONENT_ASHTON 35 +#define CONTEST_OPPONENT_SANDRA 36 +#define CONTEST_OPPONENT_CARSON 37 +#define CONTEST_OPPONENT_KATRINA 38 +#define CONTEST_OPPONENT_LUKE 39 +#define CONTEST_OPPONENT_RAUL 40 +#define CONTEST_OPPONENT_JADA 41 +#define CONTEST_OPPONENT_ZEEK 42 +#define CONTEST_OPPONENT_DIEGO 43 +#define CONTEST_OPPONENT_ALIYAH 44 +#define CONTEST_OPPONENT_NATALIA 45 +#define CONTEST_OPPONENT_DEVIN 46 +#define CONTEST_OPPONENT_TYLOR 47 +#define CONTEST_OPPONENT_RONNIE 48 +#define CONTEST_OPPONENT_CLAUDIA 49 +#define CONTEST_OPPONENT_ELIAS 50 +#define CONTEST_OPPONENT_JADE 51 +#define CONTEST_OPPONENT_FRANCIS 52 +#define CONTEST_OPPONENT_ALISHA 53 +#define CONTEST_OPPONENT_SAUL 54 +#define CONTEST_OPPONENT_FELICIA 55 +#define CONTEST_OPPONENT_EMILIO 56 +#define CONTEST_OPPONENT_KARLA 57 +#define CONTEST_OPPONENT_DARRYL 58 +#define CONTEST_OPPONENT_SELENA 59 +#define CONTEST_OPPONENT_NOEL 60 +#define CONTEST_OPPONENT_LACEY 61 +#define CONTEST_OPPONENT_CORBIN 62 +#define CONTEST_OPPONENT_GRACIE 63 +#define CONTEST_OPPONENT_COLTIN 64 +#define CONTEST_OPPONENT_ELLIE 65 +#define CONTEST_OPPONENT_MARCUS 66 +#define CONTEST_OPPONENT_KIARA 67 +#define CONTEST_OPPONENT_BRYCE 68 +#define CONTEST_OPPONENT_JAMIE 69 +#define CONTEST_OPPONENT_JORGE 70 +#define CONTEST_OPPONENT_DEVON 71 +#define CONTEST_OPPONENT_JUSTINA 72 +#define CONTEST_OPPONENT_RALPH 73 +#define CONTEST_OPPONENT_ROSA 74 +#define CONTEST_OPPONENT_KEATON 75 +#define CONTEST_OPPONENT_MAYRA 76 +#define CONTEST_OPPONENT_LAMAR 77 +#define CONTEST_OPPONENT_AUBREY 78 +#define CONTEST_OPPONENT_NIGEL 79 +#define CONTEST_OPPONENT_CAMILLE 80 +#define CONTEST_OPPONENT_DEON 81 +#define CONTEST_OPPONENT_JANELLE 82 +#define CONTEST_OPPONENT_HEATH 83 +#define CONTEST_OPPONENT_SASHA 84 +#define CONTEST_OPPONENT_FRANKIE 85 +#define CONTEST_OPPONENT_HELEN 86 +#define CONTEST_OPPONENT_CAMILE 87 +#define CONTEST_OPPONENT_MARTIN 88 +#define CONTEST_OPPONENT_SERGIO 89 +#define CONTEST_OPPONENT_KAILEY 90 +#define CONTEST_OPPONENT_PERLA 91 +#define CONTEST_OPPONENT_CLARA 92 +#define CONTEST_OPPONENT_JAKOB 93 +#define CONTEST_OPPONENT_TREY 94 +#define CONTEST_OPPONENT_LANE 95 + const struct ContestWinner gUnknown_08587FA4[] = { { @@ -81,7 +178,7 @@ const struct ContestWinner gUnknown_08587FA4[] = const struct ContestPokemon gContestOpponents[] = { - { + [CONTEST_OPPONENT_JIMMY] = { .species = SPECIES_POOCHYENA, .nickname = _("POOCHY"), .trainerName = _("JIMMY"), @@ -110,7 +207,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_EDITH] = { .species = SPECIES_ILLUMISE, .nickname = _("MUSILLE"), .trainerName = _("EDITH"), @@ -139,7 +236,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_EVAN] = { .species = SPECIES_DUSTOX, .nickname = _("DUSTER"), .trainerName = _("EVAN"), @@ -168,7 +265,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_KELSEY] = { .species = SPECIES_SEEDOT, .nickname = _("DOTS"), .trainerName = _("KELSEY"), @@ -197,7 +294,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_MADISON] = { .species = SPECIES_TAILLOW, .nickname = _("TATAY"), .trainerName = _("MADISON"), @@ -226,7 +323,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_RAYMOND] = { .species = SPECIES_NINCADA, .nickname = _("NINDA"), .trainerName = _("RAYMOND"), @@ -255,7 +352,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_GRANT] = { .species = SPECIES_SHROOMISH, .nickname = _("SMISH"), .trainerName = _("GRANT"), @@ -284,7 +381,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_PAIGE] = { .species = SPECIES_SPHEAL, .nickname = _("SLEAL"), .trainerName = _("PAIGE"), @@ -313,7 +410,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_ALEC] = { .species = SPECIES_SLAKOTH, .nickname = _("SLOKTH"), .trainerName = _("ALEC"), @@ -342,7 +439,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_SYDNEY] = { .species = SPECIES_WHISMUR, .nickname = _("WHIRIS"), .trainerName = _("SYDNEY"), @@ -371,7 +468,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_MORRIS] = { .species = SPECIES_MAKUHITA, .nickname = _("MAHITA"), .trainerName = _("MORRIS"), @@ -400,7 +497,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_MARIAH] = { .species = SPECIES_ARON, .nickname = _("RONAR"), .trainerName = _("MARIAH"), @@ -429,7 +526,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_RUSSELL] = { .species = SPECIES_CROBAT, .nickname = _("BATRO"), .trainerName = _("RUSSELL"), @@ -458,7 +555,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_MELANIE] = { .species = SPECIES_GULPIN, .nickname = _("GULIN"), .trainerName = _("MELANIE"), @@ -487,7 +584,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_CHANCE] = { .species = SPECIES_MANECTRIC, .nickname = _("RIKELEC"), .trainerName = _("CHANCE"), @@ -516,7 +613,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_AGATHA] = { .species = SPECIES_BULBASAUR, .nickname = _("BULBY"), .trainerName = _("AGATHA"), @@ -545,7 +642,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_BEAU] = { .species = SPECIES_BUTTERFREE, .nickname = _("FUTTERBE"), .trainerName = _("BEAU"), @@ -574,7 +671,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_KAY] = { .species = SPECIES_PIDGEOTTO, .nickname = _("PIDEOT"), .trainerName = _("KAY"), @@ -603,7 +700,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_CALE] = { .species = SPECIES_DIGLETT, .nickname = _("DIGLE"), .trainerName = _("CALE"), @@ -632,7 +729,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_CAITLIN] = { .species = SPECIES_POLIWAG, .nickname = _("WAGIL"), .trainerName = _("CAITLIN"), @@ -661,7 +758,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_COLBY] = { .species = SPECIES_TOTODILE, .nickname = _("TOTDIL"), .trainerName = _("COLBY"), @@ -690,7 +787,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_KYLIE] = { .species = SPECIES_LEDYBA, .nickname = _("BALEDY"), .trainerName = _("KYLIE"), @@ -719,7 +816,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_LIAM] = { .species = SPECIES_DELIBIRD, .nickname = _("BIRDLY"), .trainerName = _("LIAM"), @@ -748,7 +845,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_MILO] = { .species = SPECIES_LARVITAR, .nickname = _("TARVITAR"), .trainerName = _("MILO"), @@ -777,7 +874,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_KARINA] = { .species = SPECIES_ROSELIA, .nickname = _("RELIA"), .trainerName = _("KARINA"), @@ -806,7 +903,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_BOBBY] = { .species = SPECIES_DODRIO, .nickname = _("DUODO"), .trainerName = _("BOBBY"), @@ -835,7 +932,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_CLAIRE] = { .species = SPECIES_TRAPINCH, .nickname = _("PINCHIN"), .trainerName = _("CLAIRE"), @@ -864,7 +961,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_WILLIE] = { .species = SPECIES_CACNEA, .nickname = _("NACAC"), .trainerName = _("WILLIE"), @@ -893,7 +990,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_CASSIDY] = { .species = SPECIES_SANDSLASH, .nickname = _("SHRAND"), .trainerName = _("CASSIDY"), @@ -922,7 +1019,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_MORGAN] = { .species = SPECIES_BALTOY, .nickname = _("TOYBAL"), .trainerName = _("MORGAN"), @@ -951,7 +1048,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_SUMMER] = { .species = SPECIES_MEDICHAM, .nickname = _("CHAMCHAM"), .trainerName = _("SUMMER"), @@ -980,7 +1077,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_MILES] = { .species = SPECIES_SPINDA, .nickname = _("SPININ"), .trainerName = _("MILES"), @@ -1009,7 +1106,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_AUDREY] = { .species = SPECIES_SWABLU, .nickname = _("SWABY"), .trainerName = _("AUDREY"), @@ -1038,7 +1135,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_AVERY] = { .species = SPECIES_SPOINK, .nickname = _("POINKER"), .trainerName = _("AVERY"), @@ -1067,7 +1164,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_ARIANA] = { .species = SPECIES_KECLEON, .nickname = _("KECON"), .trainerName = _("ARIANA"), @@ -1096,7 +1193,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_ASHTON] = { .species = SPECIES_GOLDEEN, .nickname = _("GOLDEN"), .trainerName = _("ASHTON"), @@ -1125,7 +1222,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_SANDRA] = { .species = SPECIES_BARBOACH, .nickname = _("BOBOACH"), .trainerName = _("SANDRA"), @@ -1154,7 +1251,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_CARSON] = { .species = SPECIES_SKARMORY, .nickname = _("CORPY"), .trainerName = _("CARSON"), @@ -1183,7 +1280,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_KATRINA] = { .species = SPECIES_LOTAD, .nickname = _("TADO"), .trainerName = _("KATRINA"), @@ -1212,7 +1309,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_LUKE] = { .species = SPECIES_SLOWBRO, .nickname = _("BROWLO"), .trainerName = _("LUKE"), @@ -1241,7 +1338,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_RAUL] = { .species = SPECIES_FARFETCHD, .nickname = _("FETCHIN"), .trainerName = _("RAUL"), @@ -1270,7 +1367,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_JADA] = { .species = SPECIES_SEEL, .nickname = _("SEELEY"), .trainerName = _("JADA"), @@ -1299,7 +1396,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_ZEEK] = { .species = SPECIES_DROWZEE, .nickname = _("DROWZIN"), .trainerName = _("ZEEK"), @@ -1328,7 +1425,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_DIEGO] = { .species = SPECIES_HITMONCHAN, .nickname = _("HITEMON"), .trainerName = _("DIEGO"), @@ -1357,7 +1454,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_ALIYAH] = { .species = SPECIES_BLISSEY, .nickname = _("BLISS"), .trainerName = _("ALIYAH"), @@ -1386,7 +1483,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_NATALIA] = { .species = SPECIES_ELEKID, .nickname = _("KIDLEK"), .trainerName = _("NATALIA"), @@ -1415,7 +1512,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_DEVIN] = { .species = SPECIES_SNUBBULL, .nickname = _("SNUBBINS"), .trainerName = _("DEVIN"), @@ -1444,7 +1541,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_TYLOR] = { .species = SPECIES_MISDREAVUS, .nickname = _("DREAVIS"), .trainerName = _("TYLOR"), @@ -1473,7 +1570,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_RONNIE] = { .species = SPECIES_LAIRON, .nickname = _("LAIRN"), .trainerName = _("RONNIE"), @@ -1502,7 +1599,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_CLAUDIA] = { .species = SPECIES_SHIFTRY, .nickname = _("SHIFTY"), .trainerName = _("CLAUDIA"), @@ -1531,7 +1628,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_ELIAS] = { .species = SPECIES_NINJASK, .nickname = _("NINAS"), .trainerName = _("ELIAS"), @@ -1560,7 +1657,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_JADE] = { .species = SPECIES_SWELLOW, .nickname = _("WELOW"), .trainerName = _("JADE"), @@ -1589,7 +1686,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_FRANCIS] = { .species = SPECIES_MIGHTYENA, .nickname = _("YENA"), .trainerName = _("FRANCIS"), @@ -1618,7 +1715,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_ALISHA] = { .species = SPECIES_BEAUTIFLY, .nickname = _("TIFLY"), .trainerName = _("ALISHA"), @@ -1647,7 +1744,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_SAUL] = { .species = SPECIES_SEAKING, .nickname = _("KINGSEA"), .trainerName = _("SAUL"), @@ -1676,7 +1773,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_FELICIA] = { .species = SPECIES_CASTFORM, .nickname = _("CASTER"), .trainerName = _("FELICIA"), @@ -1705,7 +1802,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_EMILIO] = { .species = SPECIES_MACHOKE, .nickname = _("CHOKEM"), .trainerName = _("EMILIO"), @@ -1734,7 +1831,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_KARLA] = { .species = SPECIES_LOMBRE, .nickname = _("LOMBE"), .trainerName = _("KARLA"), @@ -1763,7 +1860,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_DARRYL] = { .species = SPECIES_SEVIPER, .nickname = _("VIPES"), .trainerName = _("DARRYL"), @@ -1792,7 +1889,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_SELENA] = { .species = SPECIES_WAILMER, .nickname = _("MERAIL"), .trainerName = _("SELENA"), @@ -1821,7 +1918,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_NOEL] = { .species = SPECIES_MAGIKARP, .nickname = _("KARPAG"), .trainerName = _("NOEL"), @@ -1850,7 +1947,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_LACEY] = { .species = SPECIES_LUNATONE, .nickname = _("LUNONE"), .trainerName = _("LACEY"), @@ -1879,7 +1976,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_CORBIN] = { .species = SPECIES_ABSOL, .nickname = _("ABSO"), .trainerName = _("CORBIN"), @@ -1908,7 +2005,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_GRACIE] = { .species = SPECIES_EXEGGUTOR, .nickname = _("EGGSOR"), .trainerName = _("GRACIE"), @@ -1937,7 +2034,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_COLTIN] = { .species = SPECIES_CUBONE, .nickname = _("CUBIN"), .trainerName = _("COLTIN"), @@ -1966,7 +2063,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_ELLIE] = { .species = SPECIES_HITMONLEE, .nickname = _("HITMON"), .trainerName = _("ELLIE"), @@ -1995,7 +2092,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_MARCUS] = { .species = SPECIES_SQUIRTLE, .nickname = _("SURTLE"), .trainerName = _("MARCUS"), @@ -2024,7 +2121,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_KIARA] = { .species = SPECIES_KANGASKHAN, .nickname = _("KHANKAN"), .trainerName = _("KIARA"), @@ -2053,7 +2150,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_BRYCE] = { .species = SPECIES_PINECO, .nickname = _("PINOC"), .trainerName = _("BRYCE"), @@ -2082,7 +2179,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_JAMIE] = { .species = SPECIES_DUNSPARCE, .nickname = _("DILTOT"), .trainerName = _("JAMIE"), @@ -2111,7 +2208,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_JORGE] = { .species = SPECIES_HOUNDOOM, .nickname = _("DOOMOND"), .trainerName = _("JORGE"), @@ -2140,7 +2237,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_DEVON] = { .species = SPECIES_MILTANK, .nickname = _("MILKAN"), .trainerName = _("DEVON"), @@ -2169,7 +2266,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_JUSTINA] = { .species = SPECIES_GYARADOS, .nickname = _("RADOS"), .trainerName = _("JUSTINA"), @@ -2198,7 +2295,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_RALPH] = { .species = SPECIES_LOUDRED, .nickname = _("LOUDERD"), .trainerName = _("RALPH"), @@ -2227,7 +2324,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_ROSA] = { .species = SPECIES_SKITTY, .nickname = _("SITTY"), .trainerName = _("ROSA"), @@ -2256,7 +2353,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_KEATON] = { .species = SPECIES_SLAKING, .nickname = _("SLING"), .trainerName = _("KEATON"), @@ -2285,7 +2382,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_MAYRA] = { .species = SPECIES_ALTARIA, .nickname = _("TARIA"), .trainerName = _("MAYRA"), @@ -2314,7 +2411,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_LAMAR] = { .species = SPECIES_KIRLIA, .nickname = _("LIRKI"), .trainerName = _("LAMAR"), @@ -2343,7 +2440,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_AUBREY] = { .species = SPECIES_BELLOSSOM, .nickname = _("BLOSSOM"), .trainerName = _("AUBREY"), @@ -2372,7 +2469,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_NIGEL] = { .species = SPECIES_SABLEYE, .nickname = _("EYESAB"), .trainerName = _("NIGEL"), @@ -2401,7 +2498,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_CAMILLE] = { .species = SPECIES_NATU, .nickname = _("UTAN"), .trainerName = _("CAMILLE"), @@ -2430,7 +2527,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_DEON] = { .species = SPECIES_SHARPEDO, .nickname = _("PEDOS"), .trainerName = _("DEON"), @@ -2459,7 +2556,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_JANELLE] = { .species = SPECIES_LUVDISC, .nickname = _("LUVIS"), .trainerName = _("JANELLE"), @@ -2488,7 +2585,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_HEATH] = { .species = SPECIES_HERACROSS, .nickname = _("HEROSS"), .trainerName = _("HEATH"), @@ -2517,7 +2614,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_SASHA] = { .species = SPECIES_ELECTRODE, .nickname = _("RODLECT"), .trainerName = _("SASHA"), @@ -2546,7 +2643,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_FRANKIE] = { .species = SPECIES_PICHU, .nickname = _("CHUPY"), .trainerName = _("FRANKIE"), @@ -2575,7 +2672,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_HELEN] = { .species = SPECIES_WOBBUFFET, .nickname = _("WOBET"), .trainerName = _("HELEN"), @@ -2604,7 +2701,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_CAMILE] = { .species = SPECIES_GENGAR, .nickname = _("GAREN"), .trainerName = _("CAMILE"), @@ -2633,7 +2730,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_MARTIN] = { .species = SPECIES_PORYGON, .nickname = _("GONPOR"), .trainerName = _("MARTIN"), @@ -2662,7 +2759,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_SERGIO] = { .species = SPECIES_DRAGONITE, .nickname = _("DRITE"), .trainerName = _("SERGIO"), @@ -2691,7 +2788,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_KAILEY] = { .species = SPECIES_MEOWTH, .nickname = _("MEOWY"), .trainerName = _("KAILEY"), @@ -2720,7 +2817,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_PERLA] = { .species = SPECIES_JYNX, .nickname = _("NYX"), .trainerName = _("PERLA"), @@ -2749,7 +2846,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_CLARA] = { .species = SPECIES_TOGEPI, .nickname = _("GEPITO"), .trainerName = _("CLARA"), @@ -2778,7 +2875,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_JAKOB] = { .species = SPECIES_ESPEON, .nickname = _("SPEON"), .trainerName = _("JAKOB"), @@ -2807,7 +2904,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_TREY] = { .species = SPECIES_SLOWKING, .nickname = _("SLOWGO"), .trainerName = _("TREY"), @@ -2836,7 +2933,7 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF }, - { + [CONTEST_OPPONENT_LANE] = { .species = SPECIES_URSARING, .nickname = _("URSING"), .trainerName = _("LANE"), @@ -2865,4 +2962,105 @@ const struct ContestPokemon gContestOpponents[] = .personality = 0, .otId = 0xFFFF } +}; + + +const u8 gPostgameContestOpponentFilter[] = +{ + [CONTEST_OPPONENT_JIMMY] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_EDITH] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_EVAN] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_KELSEY] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_MADISON] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_RAYMOND] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_GRANT] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_PAIGE] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_ALEC] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_SYDNEY] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_MORRIS] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_MARIAH] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_RUSSELL] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_MELANIE] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_CHANCE] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_AGATHA] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_BEAU] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_KAY] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_CALE] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_CAITLIN] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_COLBY] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_KYLIE] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_LIAM] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_MILO] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_KARINA] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_BOBBY] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_CLAIRE] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_WILLIE] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_CASSIDY] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_MORGAN] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_SUMMER] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_MILES] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_AUDREY] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_AVERY] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_ARIANA] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_ASHTON] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_SANDRA] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_CARSON] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_KATRINA] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_LUKE] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_RAUL] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_JADA] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_ZEEK] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_DIEGO] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_ALIYAH] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_NATALIA] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_DEVIN] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_TYLOR] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_RONNIE] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_CLAUDIA] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_ELIAS] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_JADE] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_FRANCIS] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_ALISHA] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_SAUL] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_FELICIA] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_EMILIO] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_KARLA] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_DARRYL] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_SELENA] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_NOEL] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_LACEY] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_CORBIN] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_GRACIE] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_COLTIN] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_ELLIE] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_MARCUS] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_KIARA] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_BRYCE] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_JAMIE] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_JORGE] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_DEVON] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_JUSTINA] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_RALPH] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_ROSA] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_KEATON] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_MAYRA] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_LAMAR] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_AUBREY] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_NIGEL] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_CAMILLE] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_DEON] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_JANELLE] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_HEATH] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_SASHA] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_FRANKIE] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_HELEN] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_CAMILE] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_MARTIN] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_SERGIO] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_KAILEY] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_PERLA] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_CLARA] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_JAKOB] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_TREY] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_LANE] = CONTEST_FILTER_ONLY_POSTGAME }; \ No newline at end of file From 13c2f91b11a9ae773fd22b045f37b85c6e1ed984 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Sat, 9 Mar 2019 23:51:39 -0500 Subject: [PATCH 008/101] Moved last contest data into C --- data/contest.s | 58 -------------------- ld_script.txt | 1 - src/contest.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 134 insertions(+), 65 deletions(-) delete mode 100644 data/contest.s diff --git a/data/contest.s b/data/contest.s deleted file mode 100644 index c04c31577..000000000 --- a/data/contest.s +++ /dev/null @@ -1,58 +0,0 @@ -#include "constants/species.h" -#include "constants/moves.h" - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2, 0 - - .align 2 -gUnknown_08589904:: @ 8589904 - obj_tiles gBlankGfxCompressed, 0x1000, 0x80e8 - obj_tiles gBlankGfxCompressed, 0x1000, 0x80e9 - obj_tiles gBlankGfxCompressed, 0x1000, 0x80ea - obj_tiles gBlankGfxCompressed, 0x1000, 0x80eb - - .align 2 -gUnknown_08589924:: @ 8589924 Yup this is super dangerous but that's how it is here - obj_pal gHeap + 0x1A0A4, 0x80e8 - obj_pal gHeap + 0x1A0C4, 0x80e9 - obj_pal gHeap + 0x1A0E4, 0x80ea - obj_pal gHeap + 0x1A104, 0x80eb - - .align 2 -gOamData_8589944:: @ 8589944 - .2byte 0x0700 - .2byte 0xC000 - .2byte 0x0000 - - .align 2 -gSpriteAffineAnim_858994C:: @ 858994C - obj_rot_scal_anim_frame 0x100, 0x100, 0, 0 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnim_858995C:: @ 858995C - obj_rot_scal_anim_frame 0x3, 0x3, 0, 15 - obj_rot_scal_anim_frame 0xFFFD, 0xFFFD, 0, 15 - obj_rot_scal_anim_frame 0x3, 0x3, 0, 15 - obj_rot_scal_anim_frame 0xFFFD, 0xFFFD, 0, 15 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnimTable_8589984:: @ 8589984 - .4byte gSpriteAffineAnim_858994C - .4byte gSpriteAffineAnim_858995C - - .align 2 -gSpriteTemplate_858998C:: @ 858998C - spr_template 0x80e8, 0x80e8, gOamData_8589944, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_8589984, SpriteCallbackDummy - spr_template 0x80e9, 0x80e9, gOamData_8589944, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_8589984, SpriteCallbackDummy - spr_template 0x80ea, 0x80ea, gOamData_8589944, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_8589984, SpriteCallbackDummy - spr_template 0x80eb, 0x80eb, gOamData_8589944, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_8589984, SpriteCallbackDummy - - .align 2 -gContestExcitementTable:: @ 85899EC - .2byte 0x0001, 0xffff, 0x0000, 0x0001, 0xffff, 0x00ff, 0x0001, 0xffff, 0x00ff, 0x0001, 0xff00, 0x00ff, 0x0001, 0x0000 - - diff --git a/ld_script.txt b/ld_script.txt index b87bb34f3..5293c7e23 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -462,7 +462,6 @@ SECTIONS { src/battle_anim_80D51AC.o(.rodata); src/item.o(.rodata); src/contest.o(.rodata); - data/contest.o(.rodata); src/shop.o(.rodata); src/fldeff_escalator.o(.rodata); src/berry.o(.rodata); diff --git a/src/contest.c b/src/contest.c index bebe344b9..da3075e65 100644 --- a/src/contest.c +++ b/src/contest.c @@ -247,10 +247,6 @@ extern const union AffineAnimCmd *const gUnknown_082FF694[]; extern const struct SpriteTemplate gSpriteTemplate_8587AD0; extern const struct SpriteTemplate gSpriteTemplate_8587B18[]; extern void (*const gContestEffectFuncs[])(void); -extern const s8 gContestExcitementTable[][5]; -extern const struct CompressedSpriteSheet gUnknown_08589904[]; -extern const struct SpritePalette gUnknown_08589924[]; -extern const struct SpriteTemplate gSpriteTemplate_858998C[]; static const u8 gUnknown_08587A6C[] = { @@ -722,6 +718,138 @@ const struct WindowTemplate gUnknown_08587F44[] = #include "data/contest_opponents.h" +static const struct CompressedSpriteSheet sUnknown_08589904[] = +{ + { + .data = gBlankGfxCompressed, + .size = 0x1000, + .tag = 0x80E8 + }, + { + .data = gBlankGfxCompressed, + .size = 0x1000, + .tag = 0x80E9 + }, + { + .data = gBlankGfxCompressed, + .size = 0x1000, + .tag = 0x80EA + }, + { + .data = gBlankGfxCompressed, + .size = 0x1000, + .tag = 0x80EB + } +}; + +// Yup this is super dangerous but that's how it is here +static const struct SpritePalette sUnknown_08589924[] = +{ + { + .data = (u16*)(gHeap + 0x1A0A4), + .tag = 0x80E8 + }, + { + .data = (u16*)(gHeap + 0x1A0C4), + .tag = 0x80E9 + }, + { + .data = (u16*)(gHeap + 0x1A0E4), + .tag = 0x80EA + }, + { + .data = (u16*)(gHeap + 0x1A104), + .tag = 0x80EB + } +}; + +const struct OamData gOamData_8589944 = +{ + .y = 0, + .affineMode = 3, + .objMode = 1, + .mosaic = 0, + .bpp = 0, + .shape = 0, + .x = 0, + .matrixNum = 0, + .size = 3, + .tileNum = 0, + .priority = 0, + .paletteNum = 0, + .affineParam = 0 +}; + +const union AffineAnimCmd gSpriteAffineAnim_858994C[] = +{ + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMD_END +}; + +const union AffineAnimCmd gSpriteAffineAnim_858995C[] = +{ + AFFINEANIMCMD_FRAME(3, 3, 0, 15), + AFFINEANIMCMD_FRAME(-3, -3, 0, 15), + AFFINEANIMCMD_FRAME(3, 3, 0, 15), + AFFINEANIMCMD_FRAME(-3, -3, 0, 15), + AFFINEANIMCMD_END +}; + +const union AffineAnimCmd *const gSpriteAffineAnimTable_8589984[] = +{ + gSpriteAffineAnim_858994C, + gSpriteAffineAnim_858995C +}; + +const struct SpriteTemplate gSpriteTemplate_858998C[] = +{ + { + .tileTag = 0x80E8, + .paletteTag = 0x80E8, + .oam = &gOamData_8589944, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_8589984, + .callback = SpriteCallbackDummy + }, + { + .tileTag = 0x80E9, + .paletteTag = 0x80E9, + .oam = &gOamData_8589944, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_8589984, + .callback = SpriteCallbackDummy + }, + { + .tileTag = 0x80EA, + .paletteTag = 0x80EA, + .oam = &gOamData_8589944, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_8589984, + .callback = SpriteCallbackDummy + }, + { + .tileTag = 0x80EB, + .paletteTag = 0x80EB, + .oam = &gOamData_8589944, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_8589984, + .callback = SpriteCallbackDummy + } +}; + +const s8 gContestExcitementTable[][5] = +{ + { 1, 0, -1, -1, 0}, + { 0, 1, 0, -1, -1}, + {-1, 0, 1, 0, -1}, + {-1, -1, 0, 1, 0}, + { 0, -1, -1, 0, 1} +}; + static void TaskDummy1(u8 taskId) { } @@ -3763,8 +3891,8 @@ static u8 sub_80DC9EC(u8 a) u8 spriteId1, spriteId2; u8 x = gUnknown_02039F26[a] * 40 + 32; - LoadCompressedSpriteSheet(&gUnknown_08589904[a]); - LoadSpritePalette(&gUnknown_08589924[a]); + LoadCompressedSpriteSheet(&sUnknown_08589904[a]); + LoadSpritePalette(&sUnknown_08589924[a]); spriteId1 = CreateSprite(&gSpriteTemplate_858998C[a], 184, x, 29); spriteId2 = CreateSprite(&gSpriteTemplate_858998C[a], 248, x, 29); gSprites[spriteId2].oam.tileNum += 64; From 7f70b629f569ce9a4c1b90cca3a3ce86ebd3e1c2 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Tue, 12 Mar 2019 05:35:15 -0400 Subject: [PATCH 009/101] Document sAreaGlowTilemapMapping I used a script to generate the format for the array, so I can easily change its formatting if needed. --- include/constants/maps.h | 6 + src/pokedex_area_screen.c | 223 ++++++++++++++++++++++++++++---------- 2 files changed, 173 insertions(+), 56 deletions(-) diff --git a/include/constants/maps.h b/include/constants/maps.h index e1e2da992..93291f29e 100644 --- a/include/constants/maps.h +++ b/include/constants/maps.h @@ -9,4 +9,10 @@ #define MAP_GROUP(map) (MAP_##map >> 8) #define MAP_NUM(map) (MAP_##map & 0xFF) +// These groups are used by pokedex_area_screen.c to find wild +// pokemon locations. +#define MAP_AREA_OVERWORLD_MONS MAP_GROUP(PETALBURG_CITY) +#define MAP_AREA_SPECIAL_MONS_1 MAP_GROUP(METEOR_FALLS_1F_1R) +#define MAP_AREA_SPECIAL_MONS_2 MAP_GROUP(SAFARI_ZONE_NORTHWEST) + #endif // GUARD_CONSTANTS_MAPS_H diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c index eeea3c210..d43c556c8 100755 --- a/src/pokedex_area_screen.c +++ b/src/pokedex_area_screen.c @@ -23,6 +23,19 @@ #include "constants/species.h" #include "constants/vars.h" +#define AREA_SCREEN_WIDTH 32 +#define AREA_SCREEN_HEIGHT 20 + +#define GLOW_TILE_FULL 0xFFFF +#define GLOW_TILE_LEFT (1 << 0) +#define GLOW_TILE_RIGHT (1 << 1) +#define GLOW_TILE_TOP (1 << 2) +#define GLOW_TILE_BOTTOM (1 << 3) +#define GLOW_TILE_BOTTOM_RIGHT (1 << 4) +#define GLOW_TILE_TOP_RIGHT (1 << 5) +#define GLOW_TILE_BOTTOM_LEFT (1 << 6) +#define GLOW_TILE_TOP_LEFT (1 << 7) + struct PokeDexAreaScreenMapIdentity { u8 mapGroup; @@ -100,23 +113,114 @@ static const u16 sLandmarkData[][2] = { {MAPSEC_NONE} }; +// Only some parts of this array are acutally used, because corner flags that overlap +// with edge flags are cancelled out before lookup. For example, GLOW_TILE_BOTTOM_RIGHT | GLOW_TILE_RIGHT +// will never be read. +// +// The rest of the bytes seem to be old data from before the cancellation was implemented. +// Most of them line up as you would expect ([BOTTOM_RIGHT | RIGHT] has the same value as [RIGHT]). +// +// Any unreachable entries are simply listed in order, without the fancy "[FLAGS] = 0xXX" notation. static const u8 sAreaGlowTilemapMapping[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x11, 0x20, 0x02, 0x03, 0x27, 0x2d, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x12, 0x21, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x2a, 0x2e, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x13, 0x22, 0x02, 0x03, 0x27, 0x2d, 0x06, 0x07, 0x2a, 0x2e, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x14, 0x01, 0x23, 0x03, 0x26, 0x05, 0x2c, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x15, 0x20, 0x23, 0x03, 0x28, 0x2d, 0x2c, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x16, 0x21, 0x23, 0x03, 0x26, 0x05, 0x2c, 0x07, 0x2a, 0x2e, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x17, 0x22, 0x23, 0x03, 0x28, 0x2d, 0x2c, 0x07, 0x2a, 0x2e, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x18, 0x01, 0x24, 0x03, 0x04, 0x05, 0x06, 0x07, 0x29, 0x09, 0x2f, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x19, 0x20, 0x24, 0x03, 0x27, 0x2d, 0x06, 0x07, 0x29, 0x09, 0x2f, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x1a, 0x21, 0x24, 0x03, 0x04, 0x05, 0x06, 0x07, 0x2b, 0x2e, 0x2f, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x1b, 0x22, 0x24, 0x03, 0x27, 0x2d, 0x06, 0x07, 0x2b, 0x2e, 0x2f, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x1c, 0x01, 0x25, 0x03, 0x26, 0x05, 0x2c, 0x07, 0x29, 0x09, 0x2f, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x1d, 0x20, 0x25, 0x03, 0x28, 0x2d, 0x2c, 0x07, 0x29, 0x09, 0x2f, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x1e, 0x21, 0x25, 0x03, 0x26, 0x05, 0x2c, 0x07, 0x2b, 0x2e, 0x2f, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x1f, 0x22, 0x25, 0x03, 0x28, 0x2d, 0x2c, 0x07, 0x2b, 0x2e, 0x2f, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + [0] = 0x00, + [GLOW_TILE_LEFT] = 0x01, + [GLOW_TILE_RIGHT] = 0x02, + [GLOW_TILE_RIGHT | GLOW_TILE_LEFT] = 0x03, + [GLOW_TILE_TOP] = 0x04, + [GLOW_TILE_TOP | GLOW_TILE_LEFT] = 0x05, + [GLOW_TILE_TOP | GLOW_TILE_RIGHT] = 0x06, + [GLOW_TILE_TOP | GLOW_TILE_RIGHT | GLOW_TILE_LEFT] = 0x07, + [GLOW_TILE_BOTTOM] = 0x08, + [GLOW_TILE_BOTTOM | GLOW_TILE_LEFT] = 0x09, + [GLOW_TILE_BOTTOM | GLOW_TILE_RIGHT] = 0x0a, + [GLOW_TILE_BOTTOM | GLOW_TILE_RIGHT | GLOW_TILE_LEFT] = 0x0b, + [GLOW_TILE_BOTTOM | GLOW_TILE_TOP] = 0x0c, + [GLOW_TILE_BOTTOM | GLOW_TILE_TOP | GLOW_TILE_LEFT] = 0x0d, + [GLOW_TILE_BOTTOM | GLOW_TILE_TOP | GLOW_TILE_RIGHT] = 0x0e, + [GLOW_TILE_BOTTOM | GLOW_TILE_TOP | GLOW_TILE_RIGHT | GLOW_TILE_LEFT] = 0x0f, + [GLOW_TILE_BOTTOM_RIGHT] = 0x11, + [GLOW_TILE_BOTTOM_RIGHT | GLOW_TILE_LEFT] = 0x20, + 0x02, 0x03, + [GLOW_TILE_BOTTOM_RIGHT | GLOW_TILE_TOP] = 0x27, + [GLOW_TILE_BOTTOM_RIGHT | GLOW_TILE_TOP | GLOW_TILE_LEFT] = 0x2d, + 0x06, 0x07, 0x08, 0x09, 0x0a, + 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + [GLOW_TILE_TOP_RIGHT] = 0x12, + [GLOW_TILE_TOP_RIGHT | GLOW_TILE_LEFT] = 0x21, + 0x02, 0x03, 0x04, 0x05, 0x06, + 0x07, + [GLOW_TILE_TOP_RIGHT | GLOW_TILE_BOTTOM] = 0x2a, + [GLOW_TILE_TOP_RIGHT | GLOW_TILE_BOTTOM | GLOW_TILE_LEFT] = 0x2e, + 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, + 0x0f, + [GLOW_TILE_TOP_RIGHT | GLOW_TILE_BOTTOM_RIGHT] = 0x13, + [GLOW_TILE_TOP_RIGHT | GLOW_TILE_BOTTOM_RIGHT | GLOW_TILE_LEFT] = 0x22, + 0x02, 0x03, 0x27, 0x2d, 0x06, + 0x07, 0x2a, 0x2e, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f, + [GLOW_TILE_BOTTOM_LEFT] = 0x14, + 0x01, + [GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_RIGHT] = 0x23, + 0x03, + [GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_TOP] = 0x26, + 0x05, + [GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_TOP | GLOW_TILE_RIGHT] = 0x2c, + 0x07, 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f, + [GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_BOTTOM_RIGHT] = 0x15, + 0x20, 0x23, 0x03, + [GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_BOTTOM_RIGHT | GLOW_TILE_TOP] = 0x28, + 0x2d, 0x2c, 0x07, 0x08, 0x09, + 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, + 0x0f, + [GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_TOP_RIGHT] = 0x16, + 0x21, 0x23, 0x03, 0x26, 0x05, + 0x2c, 0x07, 0x2a, 0x2e, 0x0a, + 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + [GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_TOP_RIGHT | GLOW_TILE_BOTTOM_RIGHT] = 0x17, + 0x22, 0x23, 0x03, 0x28, 0x2d, + 0x2c, 0x07, 0x2a, 0x2e, 0x0a, + 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + [GLOW_TILE_TOP_LEFT] = 0x18, + 0x01, + [GLOW_TILE_TOP_LEFT | GLOW_TILE_RIGHT] = 0x24, + 0x03, 0x04, 0x05, 0x06, 0x07, + [GLOW_TILE_TOP_LEFT | GLOW_TILE_BOTTOM] = 0x29, + 0x09, + [GLOW_TILE_TOP_LEFT | GLOW_TILE_BOTTOM | GLOW_TILE_RIGHT] = 0x2f, + 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + [GLOW_TILE_TOP_LEFT | GLOW_TILE_BOTTOM_RIGHT] = 0x19, + 0x20, 0x24, 0x03, 0x27, 0x2d, + 0x06, 0x07, 0x29, 0x09, 0x2f, + 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + [GLOW_TILE_TOP_LEFT | GLOW_TILE_TOP_RIGHT] = 0x1a, + 0x21, 0x24, 0x03, 0x04, 0x05, + 0x06, 0x07, + [GLOW_TILE_TOP_LEFT | GLOW_TILE_TOP_RIGHT | GLOW_TILE_BOTTOM] = 0x2b, + 0x2e, 0x2f, 0x0b, 0x0c, 0x0d, + 0x0e, 0x0f, + [GLOW_TILE_TOP_LEFT | GLOW_TILE_TOP_RIGHT | GLOW_TILE_BOTTOM_RIGHT] = 0x1b, + 0x22, 0x24, 0x03, 0x27, 0x2d, + 0x06, 0x07, 0x2b, 0x2e, 0x2f, + 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + [GLOW_TILE_TOP_LEFT | GLOW_TILE_BOTTOM_LEFT] = 0x1c, + 0x01, + [GLOW_TILE_TOP_LEFT | GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_RIGHT] = 0x25, + 0x03, 0x26, 0x05, 0x2c, 0x07, + 0x29, 0x09, 0x2f, 0x0b, 0x0c, + 0x0d, 0x0e, 0x0f, + [GLOW_TILE_TOP_LEFT | GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_BOTTOM_RIGHT] = 0x1d, + 0x20, 0x25, 0x03, 0x28, 0x2d, + 0x2c, 0x07, 0x29, 0x09, 0x2f, + 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + [GLOW_TILE_TOP_LEFT | GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_TOP_RIGHT] = 0x1e, + 0x21, 0x25, 0x03, 0x26, 0x05, + 0x2c, 0x07, 0x2b, 0x2e, 0x2f, + 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + [GLOW_TILE_TOP_LEFT | GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_TOP_RIGHT | GLOW_TILE_BOTTOM_RIGHT] = 0x1f, + 0x22, 0x25, 0x03, 0x28, 0x2d, + 0x2c, 0x07, 0x2b, 0x2e, 0x2f, + 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, }; static const struct UnkStruct_1C4D70 sUnknown_085B4018 = { @@ -237,11 +341,11 @@ static void FindMapsWithMon(u16 species) { switch (sFeebasData[i][1]) { - case MAP_GROUP(PETALBURG_CITY): + case MAP_AREA_OVERWORLD_MONS: SetAreaHasMon(sFeebasData[i][1], sFeebasData[i][2]); break; - case MAP_GROUP(METEOR_FALLS_1F_1R): - case MAP_GROUP(SAFARI_ZONE_NORTHWEST): + case MAP_AREA_SPECIAL_MONS_1: + case MAP_AREA_SPECIAL_MONS_2: SetSpecialMapHasMon(sFeebasData[i][1], sFeebasData[i][2]); break; } @@ -250,15 +354,15 @@ static void FindMapsWithMon(u16 species) for (i = 0; gWildMonHeaders[i].mapGroup != 0xFF; i++) { - if (MapHasMon(gWildMonHeaders + i, species)) + if (MapHasMon(&gWildMonHeaders[i], species)) { switch (gWildMonHeaders[i].mapGroup) { - case MAP_GROUP(PETALBURG_CITY): + case MAP_AREA_OVERWORLD_MONS: SetAreaHasMon(gWildMonHeaders[i].mapGroup, gWildMonHeaders[i].mapNum); break; - case MAP_GROUP(METEOR_FALLS_1F_1R): - case MAP_GROUP(SAFARI_ZONE_NORTHWEST): + case MAP_AREA_SPECIAL_MONS_1: + case MAP_AREA_SPECIAL_MONS_2: SetSpecialMapHasMon(gWildMonHeaders[i].mapGroup, gWildMonHeaders[i].mapNum); break; } @@ -372,18 +476,18 @@ static void BuildAreaGlowTilemap(void) u16 i, y, x, j; u16 val; - for (i = 0; i < 0x280; i++) + for (i = 0; i < ARRAY_COUNT(sPokedexAreaScreen->areaGlowTilemap); i++) sPokedexAreaScreen->areaGlowTilemap[i] = 0; for (i = 0; i < sPokedexAreaScreen->numOverworldAreas; i++) { j = 0; - for (y = 0; y < 20; y++) + for (y = 0; y < AREA_SCREEN_HEIGHT; y++) { - for (x = 0; x < 32; x++) + for (x = 0; x < AREA_SCREEN_WIDTH; x++) { if (GetRegionMapSectionIdAt(x, y) == sPokedexAreaScreen->overworldAreasWithMons[i].regionMapSectionId) - sPokedexAreaScreen->areaGlowTilemap[j] = 0xFFFF; + sPokedexAreaScreen->areaGlowTilemap[j] = GLOW_TILE_FULL; j++; } @@ -391,51 +495,58 @@ static void BuildAreaGlowTilemap(void) } j = 0; - for (y = 0; y < 20; y++) + for (y = 0; y < AREA_SCREEN_HEIGHT; y++) { - for (x = 0; x < 32; x++) + for (x = 0; x < AREA_SCREEN_WIDTH; x++) { - if (sPokedexAreaScreen->areaGlowTilemap[j] == 0xFFFF) + if (sPokedexAreaScreen->areaGlowTilemap[j] == GLOW_TILE_FULL) { - if (x != 0 && sPokedexAreaScreen->areaGlowTilemap[j - 1] != 0xFFFF) - sPokedexAreaScreen->areaGlowTilemap[j - 1] |= 0x02; - if (x != 31 && sPokedexAreaScreen->areaGlowTilemap[j + 1] != 0xFFFF) - sPokedexAreaScreen->areaGlowTilemap[j + 1] |= 0x01; - if (y != 0 && sPokedexAreaScreen->areaGlowTilemap[j - 32] != 0xFFFF) - sPokedexAreaScreen->areaGlowTilemap[j - 32] |= 0x08; - if (y != 19 && sPokedexAreaScreen->areaGlowTilemap[j + 32] != 0xFFFF) - sPokedexAreaScreen->areaGlowTilemap[j + 32] |= 0x04; - if (x != 0 && y != 0 && sPokedexAreaScreen->areaGlowTilemap[j - 33] != 0xFFFF) - sPokedexAreaScreen->areaGlowTilemap[j - 33] |= 0x10; - if (x != 31 && y != 0 && sPokedexAreaScreen->areaGlowTilemap[j - 31] != 0xFFFF) - sPokedexAreaScreen->areaGlowTilemap[j - 31] |= 0x40; - if (x != 0 && y != 19 && sPokedexAreaScreen->areaGlowTilemap[j + 31] != 0xFFFF) - sPokedexAreaScreen->areaGlowTilemap[j + 31] |= 0x20; - if (x != 31 && y != 19 && sPokedexAreaScreen->areaGlowTilemap[j + 33] != 0xFFFF) - sPokedexAreaScreen->areaGlowTilemap[j + 33] |= 0x80; + // The "tile != GLOW_TILE_FULL" check is pointless in all of these conditionals, + // since there's no harm in OR'ing 0xFFFF with anything else. + + // Edges + if (x != 0 && sPokedexAreaScreen->areaGlowTilemap[j - 1] != GLOW_TILE_FULL) + sPokedexAreaScreen->areaGlowTilemap[j - 1] |= GLOW_TILE_RIGHT; + if (x != AREA_SCREEN_WIDTH - 1 && sPokedexAreaScreen->areaGlowTilemap[j + 1] != GLOW_TILE_FULL) + sPokedexAreaScreen->areaGlowTilemap[j + 1] |= GLOW_TILE_LEFT; + if (y != 0 && sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH] != GLOW_TILE_FULL) + sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH] |= GLOW_TILE_BOTTOM; + if (y != AREA_SCREEN_HEIGHT - 1 && sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH] != GLOW_TILE_FULL) + sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH] |= GLOW_TILE_TOP; + + // Diagonals + if (x != 0 && y != 0 && sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH - 1] != GLOW_TILE_FULL) + sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH - 1] |= GLOW_TILE_BOTTOM_RIGHT; + if (x != AREA_SCREEN_WIDTH - 1 && y != 0 && sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH + 1] != GLOW_TILE_FULL) + sPokedexAreaScreen->areaGlowTilemap[j - AREA_SCREEN_WIDTH + 1] |= GLOW_TILE_BOTTOM_LEFT; + if (x != 0 && y != AREA_SCREEN_HEIGHT - 1 && sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH - 1] != GLOW_TILE_FULL) + sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH - 1] |= GLOW_TILE_TOP_RIGHT; + if (x != AREA_SCREEN_WIDTH - 1 && y != AREA_SCREEN_HEIGHT - 1 && sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH + 1] != GLOW_TILE_FULL) + sPokedexAreaScreen->areaGlowTilemap[j + AREA_SCREEN_WIDTH + 1] |= GLOW_TILE_TOP_LEFT; } j++; } } - for (i = 0; i < 0x280; i++) + for (i = 0; i < ARRAY_COUNT(sPokedexAreaScreen->areaGlowTilemap); i++) { - if (sPokedexAreaScreen->areaGlowTilemap[i] == 0xFFFF) + if (sPokedexAreaScreen->areaGlowTilemap[i] == GLOW_TILE_FULL) { sPokedexAreaScreen->areaGlowTilemap[i] = 0x10; sPokedexAreaScreen->areaGlowTilemap[i] |= 0xA000; } else if (sPokedexAreaScreen->areaGlowTilemap[i]) { - if (sPokedexAreaScreen->areaGlowTilemap[i] & 0x02) - sPokedexAreaScreen->areaGlowTilemap[i] &= 0xFFCF; - if (sPokedexAreaScreen->areaGlowTilemap[i] & 0x01) - sPokedexAreaScreen->areaGlowTilemap[i] &= 0xFF3F; - if (sPokedexAreaScreen->areaGlowTilemap[i] & 0x08) - sPokedexAreaScreen->areaGlowTilemap[i] &= 0xFFAF; - if (sPokedexAreaScreen->areaGlowTilemap[i] & 0x04) - sPokedexAreaScreen->areaGlowTilemap[i] &= 0xFF5F; + // Get rid of overlapping flags + if (sPokedexAreaScreen->areaGlowTilemap[i] & GLOW_TILE_RIGHT) + sPokedexAreaScreen->areaGlowTilemap[i] &= ~(GLOW_TILE_BOTTOM_RIGHT | GLOW_TILE_TOP_RIGHT); + if (sPokedexAreaScreen->areaGlowTilemap[i] & GLOW_TILE_LEFT) + sPokedexAreaScreen->areaGlowTilemap[i] &= ~(GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_TOP_LEFT); + if (sPokedexAreaScreen->areaGlowTilemap[i] & GLOW_TILE_BOTTOM) + sPokedexAreaScreen->areaGlowTilemap[i] &= ~(GLOW_TILE_BOTTOM_LEFT | GLOW_TILE_BOTTOM_RIGHT); + if (sPokedexAreaScreen->areaGlowTilemap[i] & GLOW_TILE_TOP) + sPokedexAreaScreen->areaGlowTilemap[i] &= ~(GLOW_TILE_TOP_LEFT | GLOW_TILE_TOP_RIGHT); sPokedexAreaScreen->areaGlowTilemap[i] = sAreaGlowTilemapMapping[sPokedexAreaScreen->areaGlowTilemap[i]]; sPokedexAreaScreen->areaGlowTilemap[i] |= 0xA000; From 6566a49bebc877e742f8ee325dd659879afe63f3 Mon Sep 17 00:00:00 2001 From: Wyrserth Date: Sat, 23 Mar 2019 21:52:58 +0100 Subject: [PATCH 010/101] Use constants for naming screen's pages. --- include/naming_screen.h | 2 +- src/naming_screen.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/naming_screen.h b/include/naming_screen.h index b04cb19b6..611f53ef2 100644 --- a/include/naming_screen.h +++ b/include/naming_screen.h @@ -59,9 +59,9 @@ struct NamingScreenData { enum { + PAGE_OTHERS, PAGE_UPPER, PAGE_LOWER, - PAGE_OTHERS, }; enum diff --git a/src/naming_screen.c b/src/naming_screen.c index 75b7c8566..d37144122 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -449,7 +449,7 @@ static u8 sub_80E3274(void) static bool8 MainState_BeginFadeIn(void) { sub_80E4CF8(3, gUnknown_08DD4544); - gNamingScreenData->currentPage = 1; + gNamingScreenData->currentPage = PAGE_UPPER; sub_80E4CF8(2, gUnknown_08DD46E0); sub_80E4CF8(1, gUnknown_08DD4620); sub_80E4DE4(gNamingScreenData->windows[1], 0); @@ -1856,7 +1856,7 @@ static const struct NamingScreenTemplate playerNamingScreenTemplate = .maxChars = 7, .iconFunction = 1, .addGenderIcon = 0, - .initialPage = 1, + .initialPage = PAGE_UPPER, .unused = 35, .title = gText_YourName, }; @@ -1867,7 +1867,7 @@ static const struct NamingScreenTemplate pcBoxNamingTemplate = .maxChars = 8, .iconFunction = 2, .addGenderIcon = 0, - .initialPage = 1, + .initialPage = PAGE_UPPER, .unused = 19, .title = gText_BoxName, }; @@ -1878,7 +1878,7 @@ static const struct NamingScreenTemplate monNamingScreenTemplate = .maxChars = 10, .iconFunction = 3, .addGenderIcon = 1, - .initialPage = 1, + .initialPage = PAGE_UPPER, .unused = 35, .title = gText_PkmnsNickname, }; @@ -1889,7 +1889,7 @@ static const struct NamingScreenTemplate wandaWordsScreenTemplate = .maxChars = 15, .iconFunction = 4, .addGenderIcon = 0, - .initialPage = 1, + .initialPage = PAGE_UPPER, .unused = 11, .title = gText_TellHimTheWords, }; From cf0e38b11ff7d1da5fb1328037b6387c4bafbc01 Mon Sep 17 00:00:00 2001 From: AJ Fontaine <36677462+Fontbane@users.noreply.github.com> Date: Sun, 24 Mar 2019 22:33:54 -0400 Subject: [PATCH 011/101] Can't Knock Griseous Orb Off Giratina I'll do Plates Drives and Memories later --- src/battle_util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/battle_util.c b/src/battle_util.c index 901edb152..75845bf50 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5916,6 +5916,8 @@ bool32 CanBattlerGetOrLoseItem(u8 battlerId, u16 itemId) return FALSE; else if (ItemId_GetHoldEffect(itemId) == HOLD_EFFECT_MEGA_STONE && GetMegaEvolutionSpecies(species, itemId) != SPECIES_NONE) return FALSE; + else if (species == SPECIES_GIRATINA && itemId == ITEM_GRISEOUS_ORB) + return FALSE; else return TRUE; } From fc69631a10a53b889e78211031236bfca9d3d21b Mon Sep 17 00:00:00 2001 From: Fontbane Date: Mon, 25 Mar 2019 17:49:29 -0400 Subject: [PATCH 012/101] Field effects for Gen IV Abilities Also added Honey (acts like White Flute for now) and made it so the Griseous Orb can't be removed from Giratina in battle. --- data/battle_ai_scripts.s | 2 +- graphics/items/icon_palettes/honey.pal | 19 +++ graphics/items/icons/honey.png | Bin 0 -> 5898 bytes include/constants/items.h | 169 +++++++++++++------------ include/item_use.h | 1 + src/battle_script_commands.c | 14 +- src/data/graphics/items.h | 3 + src/data/item_icon_table.h | 1 + src/data/items.h | 17 +++ src/data/text/item_descriptions.h | 1 + src/item_use.c | 10 ++ src/wild_encounter.c | 6 + 12 files changed, 155 insertions(+), 88 deletions(-) create mode 100644 graphics/items/icon_palettes/honey.pal create mode 100644 graphics/items/icons/honey.png diff --git a/data/battle_ai_scripts.s b/data/battle_ai_scripts.s index 6ba2c8748..101889405 100644 --- a/data/battle_ai_scripts.s +++ b/data/battle_ai_scripts.s @@ -3628,7 +3628,7 @@ AI_HPAware_DiscouragedEffectsWhenTargetLowHP: @ 82DE2B1 .byte EFFECT_LIGHT_SCREEN .byte EFFECT_OHKO .byte EFFECT_SUPER_FANG - .byte EFFECT_SUPER_FANG + .byte EFFECT_SUPER_FANG //Why is this here twice? .byte EFFECT_MIST .byte EFFECT_FOCUS_ENERGY .byte EFFECT_CONFUSE diff --git a/graphics/items/icon_palettes/honey.pal b/graphics/items/icon_palettes/honey.pal new file mode 100644 index 000000000..c5219f932 --- /dev/null +++ b/graphics/items/icon_palettes/honey.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +48 48 48 +120 80 32 +200 112 0 +80 152 152 +232 144 0 +96 184 192 +248 184 72 +248 240 184 +216 248 248 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/items/icons/honey.png b/graphics/items/icons/honey.png new file mode 100644 index 0000000000000000000000000000000000000000..837243e77fe7fc015bca5c4b07668c5c8f3fa2ed GIT binary patch literal 5898 zcmV+l7xn0gP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+SQs_mgBf~MgK7h4}s``;h@)b+?;#V685z$zg&CY8WTdgD7+Xg#rv)iuoKJ4HU zgIg~1?%Z(xY%4yy>c&Y*(93R@NzXLCkcmOoJe%G7wb*msdd@c}+IdaOp3X9uviR*~ ze%kmqulIrWR_R)MmG@Y2T~0O4Whis{%U&eJ?kA@4#P__+OWj;AiS=YKo-h|C*sgvL z(WCvSEr0Ut*)LwfTz6~OJf8sw5$BFvjP+#TO4di4?3JC%))L1;ei~Qqd~lr%*cjck zW|JH56Uiw~=jNDf&%Q3Ydo$2NBGe+8)X+dAD}+e>baL*dmEI`2qTU(@+hN@Hr@1-_Md5HGs~>AExRbC6;@nn*BWWx%vKEBW&QLnhUE|eB(85GqTE%ppS zHjhG~zM88oChuB}>Zw_oO^BAtx25Qvf~RE5nAGq^pQXlSg*i8`d`bN*ELQt=6Y;k^!lc`Np0cZOCmao054irCRN4DUIQz zBT~F(M^b!L(m3@qp0u0yyx&<@&fSb-wmL%@;1dPFWyQ60*lP)Xu0V52FxLhoyG@iT z#{nD#{V`nZr8>}Yl6nW&aSm|F6Td4%4V2Q1YS$!kaMND)fSPV z*y$-6gwW&_TdU}>oK$Q~$5HG)0OwTs3Wf`flM6*s7fx`I*ji?8maB3$^;mPDYlcl1 zO_*AwiTWgmt@imcuDJ(}k#da8AX`7K;D{_h!G+R%am~788@0_zSlD~aQ;;3WxsW!c zQY8lRn7g~yd!k4?wH^9^Vg@2E5pc98!F7{j&dY7^X%hl!r)N(M6_C*HWuxgGoY*ro zW*sP2PKy@pyW6B5-SlXpM;$#nqI#4r*i{wDo?Q4A>g-ib$uq5H%Vt88{M5R#gRAMg z%ZcYQ_&9Ql@ox8|cJI4h0+KMnW=$1dW2P4~P5o+(CQ2wAtEom!we_{4J2Ry*Q;ncg z?n0Ew-^!H)52EPW%$zPxaE-?DvU6z$Cv_!1Qp z6l}~Ob3hae<`EE7 zt`y&`rBi9tJLCb|+B@zDI%rF%=a)<1MFJt|R~p~-Ow3CldbU-R{|SJ)g_$(S+>UM$ zY(Ny34Q8V&LrUxE;?GTt7Mpav3dH#e$x< zqYTt9IjLW=bptbluiPLFP|{)AJjVj^8zn?S`Mg%5VvxDOO;nE$dYnUmG0>U1KT^X1 z1?AQ+?3hhb*V7CH0-h)GNRLG%zp;G#LfCChbvznXl(ahN6FpOPsup zVLgtzs46^lozXUZff#LYb?{XNreM=yC^9bPOgMHXOu*)ub!qWTH)*;pt#r-b8d)yDzC8A+O6#Z*T*`WbhbOG)p#!2rJUVtxz+3C-Ydj;`v5L6uH zK0Vm&$S}}-vVNC5}Dy>|i{B-6^2Oa+({rJ8s3Jm8kP> zuJ;X*=|PPXW}0>-6a!q}OR}eK2oLoK;kjMtpoOJ7a58BaU9fS4ZPLos3Jo(Vi&DrD zI7Id#oIIHTK=@&7+rebqKI8xr1iLoGt&U{w^ctGxK-bv)z|20rGtveyJjDmJ5Gk;b z{3py5N$7Q@>9JVRcIPKhw+zfmg>I&UVx;BD8Fayz33tdm=Z>|*GB9E|ID`wZTIpbR z7oF`_2bH3UtJH=1qJC#k721!Z!a=(ih6BW?mp!7t+MCbKgWWrj3Y zmwTva1j=l~RKB?*zpYrrj{3-N3dPn8p=U42Y~33jn|D4ApZJ&yIs#h)+#X4|3E-J_ zstXC;b}v%#Z^xOB1O4j>&iGv_+rNy2c%b_V+_%ok)#Ad{o)~H4AX#@cR1THBQOQ87 zEC^LqKyt2@R&cWTnDCAa$gjg00g*r! z4C?ui5g}0T#luDJt!AuyYNkwDTScKB>S800%_7*RW{48Fym~(u3~tpJe9%6@8;}aUq*Sxz{e6Z0O%i{#Gua_ zPVT3Zd^^YcAU~YNyk5n(LH_wUym>uEuq_|ZrCUi-#}F_8^>xkG!X+C8KoHy7D*lP2 zlu~`~XOYE!Ppd!6jTXS?BYdPab*U1MEuk8K-Y8$)GF+pA!m?k}MAw51Rfp23xx+JG zTNv65yHxnFW0@&i%B*5`L2!rFXmk(-d7+SW8uT19L>b~6cE|}cimSZpyb7eeZw^N$ z_BVfceR?sGg% zq(HzI6hfj-ojRN~@VZ%`6ten~D_W;*WnN zhIoL3!yx2JH@ZlEL3yidf%n+pK;dXdvZ=M3MwFY!LIq%!Jfd15b&M98r6jE$Bfz2; z9@QJn_eH}mgu5Cbu0{ZnCsx$(WNg%LR>iz;Kz%Ykv7pKmb|3L^58v!Fe7}eHp@lUH zx$DRHQe9|mgK^~ehIzu0h2vDun%&Pa1L#p{UsW)5?o3CS4``2|yO9$nVa`EYO$`Cfd8ITd;iXR&UCWwl6N zGNR#j%q`R8U+Ky`A99x%Ylr@-7#vJ_)9^?U)LPHApdOL%ZJiacnLv}{Br{k6_}|Ig z4@ahCXY!OZ`P)Gmzc6-G1|Nr(LOQzc_%X7ZZ3FY>7{!{2X*}Grfe5XZ2y93tg-h`Y zxbQL9G>1wVT7AL~2&pUpjC>$9`P7-o$C)(${io-beW($If3KPX)Us7Wle&#O?$4)q zRz@k{B}LmF4!D2%=@(?56_{faR;!VEbI%o;U#{c#EA%hdXE*T%Krt}}NyX1)kSpv{ zyxXDNZ1dZ83CXK41pl;g7Mu1Y*liAGQ1YFH5UlTAj$pjhdIZy@lqt zko_@WhKK=l2g$XvF*yqePIE>)!@OiZT5t;wGw^p>$~iUEzv=;VN+%~;k+ps-GHU;&Zr|pdAjultxSilL~TZp47u#uKIux`8g{lIo3y?xQ!*oi4|4vrD}joL&UsHVjT0$z0WvhP4>oV%jT;FLx1wgB}+CoP(JvbKVy3xBhS#K#q8`E~EBIjiAd#JC*b0OX3hS9zk}=Xe@E} zR~?gi;LeFDO)IgUR@55Kx$(5(M|pQuguIZITUa#2O0xI8JG|VLF#?-HuUe-wy4-mo z+R|?ehkzoqjqW%Sp2`t?3}VU5>s=^LYiw_;QmT}4rtQhJrk%CQj--Kym=8N*iAZVG zqT+2JH5ok?!#9LhbNTvN&YfCW*dnbNr7w%WXNjn}TLsr{?)42}Ou;8EgfD|WukKD1UtD<7FnmEHkTcodytxEfhXTSgjV zFw2bp!Dsn-qOcLN+m+w^Abwte7-lj;K1`>OuO2;zJ`Vkw359)bEG+Oy&~$D|sCUji z2^~bA>`Tvy6zkH7Q9E^aylU#pXSwyJ`}O3wtH|f2#rmlm^0ZIZZ6b;r6G;NK;AMw3 zt!exl3;Kx?Lml}24}3WR4J(M&ldcn!7%8LzF%iH^!~r*bZI zY0!O9$^cTjL&eNiESe9bP= zVOnZ3*K>aY+D=sq5~a!uWISVUTKNEv$fbH>OZZcdKY{Qv39!%&V=Y|Z9!9t7G~{$C zS5I28r^6N=0I?h;mQp*po$C3sejm~B$eKF(RrO#%#L&SwsPm~uO8_Sv)hq&})PGP2 z(lswzjv5(t4VSn!dOis}G6|q=bgR`jLP3Yxfoi9!Mx$^WVOx;bDOUK^^WNu zTgW&=+M@EaO^XU=a%Yb7#(c*>_f3jV8_zb5z5aOU=OfMEANu)7b02!TvuUvc9hL1> zGY;blK54mnAo+UrYP7fIeC;n_8d5Tyw2}Ttqke2UThP+UdWX5968nb?I=1K0L0)~I zbt48aG3QPU@CwK+-JO~q-*t-K_LQQRYt%xA$4x^fvTaQZ&ow!Sel+T`gIUSw?z|qR zJu9#l3wfS2IIE@m^HNKfp(Gj{N*Q3w^mG%=CUUrzxqw`FSO{?6de9<^1l9naw7LQ3 z>;CsdR4<>j)_!h$qnn>aOHsAE%&%Pi&?xqnEJl2p)gvFOMy*BZ21|Qe9Ij-{oYmne z3k)$z+UaiXeFH;_heFJDFo0`Z_|k|C5y0p^vh{syEiz==O-yCvb7w!xFdsp8)tPR= z<%j!nO92hfK9g3#@kPWSWSIvl#=rpfg5K@$($_%vyk)%(pPgNOpO&u!+Z z`@nk00d&n~P-n=fq~)&|f`>R^wnbfS9LDron?}6wolERnqV3!z_$oQftvPZP^)?Dv z>rS|)N=b7H_f1}^48LsAnVRX7xuR*vLwHa}Pp6ztI?oo|xbt~iR5w~ZTw~vkG=G2S z=OfMEAA0Xa-W)xH7fBZ1pD=8gG*6$?NSo3U8oqSu)29{rfb%-`AnTqMg4^nGC!`-0 zfoARw*uS6Kq9Ev?LzsHZuidp(!s_7^D!n4xcy2!+Poe+nm!png{xtHv&Q=cHGhD_< zyXHyBeM5y_8@g+?ED0~Q*Qaogo>$?Tua!%0TWS(F+x3K))ES1>H8-5SiXK#_Lv>5) zJd~1j@003H_DoazW^o1 zEFYlAOh*6!03J|GR7C^<05C8xcu*k7Z~#!4nCOrIV7S2exJdZ$xY+pkfUD@N00001 zbW%=J06^y0W&i*H0b)x>L;#2d9Y_EG010qNS#tmYE+YT{E+YYWr9XB6000McNliru z;{zEGI3xiNS`z>O0GCNbK~xyiV_?7s7zKeq0Lqq}2?P@%JRrNg9LNJp0NEWKK%M{w z#}lG#3Ye4P2{K@c3z(CZ;sOM2X<&{@8W=c%I6_8Xo|Cd7kRuvuqyz-Yp@Be-cqkMU zf;pw3p%Ja&P)>Pyc}06Um?H|~fb=kxhJ!ez;R+yo!b5?)($G?{A4JPRW|ap*Jf{lO gR30RN>1`YU0Kcz2Y_wJln*aa+07*qoM6N<$g0YoOm;e9( literal 0 HcmV?d00001 diff --git a/include/constants/items.h b/include/constants/items.h index 176750a16..f0a6bedd1 100644 --- a/include/constants/items.h +++ b/include/constants/items.h @@ -509,98 +509,99 @@ #define ITEM_DRACO_PLATE 420 #define ITEM_DREAD_PLATE 421 #define ITEM_IRON_PLATE 422 +#define ITEM_HONEY 423 // Gen 5 Items -#define ITEM_EVIOLITE 423 -#define ITEM_FLOAT_STONE 424 -#define ITEM_BINDING_BAND 425 -#define ITEM_DOUSE_DRIVE 426 -#define ITEM_SHOCK_DRIVE 427 -#define ITEM_BURN_DRIVE 428 -#define ITEM_CHILL_DRIVE 429 -#define ITEM_FIRE_GEM 430 -#define ITEM_WATER_GEM 431 -#define ITEM_ELECTRIC_GEM 432 -#define ITEM_GRASS_GEM 433 -#define ITEM_ICE_GEM 434 -#define ITEM_FIGHTING_GEM 435 -#define ITEM_POISON_GEM 436 -#define ITEM_GROUND_GEM 437 -#define ITEM_FLYING_GEM 438 -#define ITEM_PSYCHIC_GEM 439 -#define ITEM_BUG_GEM 440 -#define ITEM_ROCK_GEM 441 -#define ITEM_GHOST_GEM 442 -#define ITEM_DRAGON_GEM 443 -#define ITEM_DARK_GEM 444 -#define ITEM_STEEL_GEM 445 -#define ITEM_NORMAL_GEM 446 -#define ITEM_FAIRY_GEM 447 +#define ITEM_EVIOLITE 424 +#define ITEM_FLOAT_STONE 425 +#define ITEM_BINDING_BAND 426 +#define ITEM_DOUSE_DRIVE 427 +#define ITEM_SHOCK_DRIVE 428 +#define ITEM_BURN_DRIVE 429 +#define ITEM_CHILL_DRIVE 430 +#define ITEM_FIRE_GEM 431 +#define ITEM_WATER_GEM 432 +#define ITEM_ELECTRIC_GEM 433 +#define ITEM_GRASS_GEM 434 +#define ITEM_ICE_GEM 435 +#define ITEM_FIGHTING_GEM 436 +#define ITEM_POISON_GEM 437 +#define ITEM_GROUND_GEM 438 +#define ITEM_FLYING_GEM 439 +#define ITEM_PSYCHIC_GEM 440 +#define ITEM_BUG_GEM 441 +#define ITEM_ROCK_GEM 442 +#define ITEM_GHOST_GEM 443 +#define ITEM_DRAGON_GEM 444 +#define ITEM_DARK_GEM 445 +#define ITEM_STEEL_GEM 446 +#define ITEM_NORMAL_GEM 447 +#define ITEM_FAIRY_GEM 448 // Gen6 Items -#define ITEM_ASSAULT_VEST 448 -#define ITEM_PIXIE_PLATE 449 -#define ITEM_SAFETY_GOGGLES 450 -#define ITEM_GENGARITE 451 -#define ITEM_GARDEVOIRITE 452 -#define ITEM_AMPHAROSITE 453 -#define ITEM_VENUSAURITE 454 -#define ITEM_CHARIZARDITE_X 455 -#define ITEM_BLASTOISINITE 456 -#define ITEM_MEWTWONITE_X 457 -#define ITEM_MEWTWONITE_Y 458 -#define ITEM_BLAZIKENITE 459 -#define ITEM_MEDICHAMITE 460 -#define ITEM_HOUNDOOMINITE 461 -#define ITEM_AGGRONITE 462 -#define ITEM_BANETTITE 463 -#define ITEM_TYRANITARITE 464 -#define ITEM_SCIZORITE 465 -#define ITEM_PINSIRITE 466 -#define ITEM_AERODACTYLITE 467 -#define ITEM_LUCARIONITE 468 -#define ITEM_ABOMASITE 469 -#define ITEM_KANGASKHANITE 470 -#define ITEM_GYARADOSITE 471 -#define ITEM_ABSOLITE 472 -#define ITEM_CHARIZARDITE_Y 473 -#define ITEM_ALAKAZITE 474 -#define ITEM_HERACRONITE 475 -#define ITEM_MAWILITE 476 -#define ITEM_MANECTITE 477 -#define ITEM_GARCHOMPITE 478 -#define ITEM_LATIASITE 479 -#define ITEM_LATIOSITE 480 -#define ITEM_SWAMPERTITE 481 -#define ITEM_SCEPTILITE 482 -#define ITEM_SABLENITE 483 -#define ITEM_ALTARIANITE 484 -#define ITEM_GALLADITE 485 -#define ITEM_AUDINITE 486 -#define ITEM_METAGROSSITE 487 -#define ITEM_SHARPEDONITE 488 -#define ITEM_SLOWBRONITE 489 -#define ITEM_STEELIXITE 490 -#define ITEM_PIDGEOTITE 491 -#define ITEM_GLALITITE 492 -#define ITEM_DIANCITE 493 -#define ITEM_CAMERUPTITE 494 -#define ITEM_LOPUNNITE 495 -#define ITEM_SALAMENCITE 496 -#define ITEM_BEEDRILLITE 497 -#define ITEM_MEGA_BRACELET 498 +#define ITEM_ASSAULT_VEST 449 +#define ITEM_PIXIE_PLATE 450 +#define ITEM_SAFETY_GOGGLES 451 +#define ITEM_GENGARITE 452 +#define ITEM_GARDEVOIRITE 453 +#define ITEM_AMPHAROSITE 454 +#define ITEM_VENUSAURITE 455 +#define ITEM_CHARIZARDITE_X 456 +#define ITEM_BLASTOISINITE 457 +#define ITEM_MEWTWONITE_X 458 +#define ITEM_MEWTWONITE_Y 459 +#define ITEM_BLAZIKENITE 460 +#define ITEM_MEDICHAMITE 461 +#define ITEM_HOUNDOOMINITE 462 +#define ITEM_AGGRONITE 463 +#define ITEM_BANETTITE 464 +#define ITEM_TYRANITARITE 465 +#define ITEM_SCIZORITE 466 +#define ITEM_PINSIRITE 467 +#define ITEM_AERODACTYLITE 468 +#define ITEM_LUCARIONITE 469 +#define ITEM_ABOMASITE 470 +#define ITEM_KANGASKHANITE 471 +#define ITEM_GYARADOSITE 472 +#define ITEM_ABSOLITE 473 +#define ITEM_CHARIZARDITE_Y 474 +#define ITEM_ALAKAZITE 475 +#define ITEM_HERACRONITE 476 +#define ITEM_MAWILITE 477 +#define ITEM_MANECTITE 478 +#define ITEM_GARCHOMPITE 479 +#define ITEM_LATIASITE 480 +#define ITEM_LATIOSITE 481 +#define ITEM_SWAMPERTITE 482 +#define ITEM_SCEPTILITE 483 +#define ITEM_SABLENITE 484 +#define ITEM_ALTARIANITE 485 +#define ITEM_GALLADITE 486 +#define ITEM_AUDINITE 487 +#define ITEM_METAGROSSITE 488 +#define ITEM_SHARPEDONITE 489 +#define ITEM_SLOWBRONITE 490 +#define ITEM_STEELIXITE 491 +#define ITEM_PIDGEOTITE 492 +#define ITEM_GLALITITE 493 +#define ITEM_DIANCITE 494 +#define ITEM_CAMERUPTITE 495 +#define ITEM_LOPUNNITE 496 +#define ITEM_SALAMENCITE 497 +#define ITEM_BEEDRILLITE 498 +#define ITEM_MEGA_BRACELET 499 // Gen7 hold effects -#define ITEM_PROTECTIVE_PADS 499 -#define ITEM_TERRAIN_EXTENDER 500 -#define ITEM_ELECTRIC_SEED 501 -#define ITEM_GRASSY_SEED 502 -#define ITEM_MISTY_SEED 503 -#define ITEM_PSYCHIC_SEED 504 -#define ITEM_ADRENALINE_ORB 505 +#define ITEM_PROTECTIVE_PADS 500 +#define ITEM_TERRAIN_EXTENDER 501 +#define ITEM_ELECTRIC_SEED 502 +#define ITEM_GRASSY_SEED 503 +#define ITEM_MISTY_SEED 504 +#define ITEM_PSYCHIC_SEED 505 +#define ITEM_ADRENALINE_ORB 506 -#define ITEMS_COUNT 506 +#define ITEMS_COUNT 507 #define ITEM_FIELD_ARROW ITEMS_COUNT #define FIRST_BERRY_INDEX ITEM_CHERI_BERRY diff --git a/include/item_use.h b/include/item_use.h index 37343f6e7..31221aa09 100644 --- a/include/item_use.h +++ b/include/item_use.h @@ -51,5 +51,6 @@ void ItemUseInBattle_EnigmaBerry(u8); void ItemUseOutOfBattle_CannotUse(u8); u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId); void sub_80FDD10(u8); +void ItemUseOutOfBattle_Honey(u8); #endif // GUARD_ITEM_USE_H diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index a5b6e46f4..b832d7e05 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10503,6 +10503,7 @@ static void atkE5_pickup(void) s32 i; u16 species, heldItem; u8 ability; + u8 level; if (InBattlePike()) { @@ -10537,6 +10538,10 @@ static void atkE5_pickup(void) { species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); + level = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL); + u8 lvlDivBy10 = (level - 1) / 10; + if (lvlDivBy10 > 9) + lvlDivBy10 = 9; if (GetMonData(&gPlayerParty[i], MON_DATA_ALT_ABILITY)) ability = gBaseStats[species].ability2; @@ -10551,9 +10556,6 @@ static void atkE5_pickup(void) { s32 j; s32 rand = Random() % 100; - u8 lvlDivBy10 = (GetMonData(&gPlayerParty[i], MON_DATA_LEVEL) - 1) / 10; - if (lvlDivBy10 > 9) - lvlDivBy10 = 9; for (j = 0; j < 9; j++) { @@ -10569,6 +10571,12 @@ static void atkE5_pickup(void) } } } + else if (ability == ABILITY_HONEY_GATHER + && species != 0 + && species != SPECIES_EGG + && heldItem == ITEM_NONE + && (Random()%100 <= lvlDivBy10*5+5)) + SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, ITEM_HONEY); } } diff --git a/src/data/graphics/items.h b/src/data/graphics/items.h index e20edbd64..733bbf317 100644 --- a/src/data/graphics/items.h +++ b/src/data/graphics/items.h @@ -877,6 +877,9 @@ const u32 gItemIconPalette_DreadPlate[] = INCBIN_U32("graphics/items/icon_palett const u32 gItemIcon_IronPlate[] = INCBIN_U32("graphics/items/icons/iron_plate.4bpp.lz"); const u32 gItemIconPalette_IronPlate[] = INCBIN_U32("graphics/items/icon_palettes/iron_plate.gbapal.lz"); +const u32 gItemIcon_IronPlate[] = INCBIN_U32("graphics/items/icons/honey.4bpp.lz"); +const u32 gItemIconPalette_IronPlate[] = INCBIN_U32("graphics/items/icon_palettes/honey.gbapal.lz"); + // Gen 5 Items const u32 gItemIcon_Eviolite[] = INCBIN_U32("graphics/items/icons/eviolite.4bpp.lz"); diff --git a/src/data/item_icon_table.h b/src/data/item_icon_table.h index 2b160ae20..e2c9d673b 100644 --- a/src/data/item_icon_table.h +++ b/src/data/item_icon_table.h @@ -449,6 +449,7 @@ const u32 *const gItemIconTable[][2] = [ITEM_DRACO_PLATE] = {gItemIcon_DracoPlate, gItemIconPalette_DracoPlate}, [ITEM_DREAD_PLATE] = {gItemIcon_DreadPlate, gItemIconPalette_DreadPlate}, [ITEM_IRON_PLATE] = {gItemIcon_IronPlate, gItemIconPalette_IronPlate}, + [ITEM_HONEY] = {gItemIcon_Honey, gItemIconPalette_Honey}, // Gen 5 Items [ITEM_EVIOLITE] = {gItemIcon_Eviolite, gItemIconPalette_Eviolite}, [ITEM_FLOAT_STONE] = {gItemIcon_FloatStone, gItemIconPalette_FloatStone}, diff --git a/src/data/items.h b/src/data/items.h index 6751b018e..ee47c7f89 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -9136,4 +9136,21 @@ const struct Item gItems[] = .battleUseFunc = NULL, .secondaryId = 0, }, + [ITEM_HONEY] = + { + .name = _("Honey"), + .itemId = ITEM_HONEY, + .price = 100, + .holdEffect = HOLD_EFFECT_NONE, + .holdEffectParam = 0, + .description = gHoneyItemDescription, + .importance = 0, + .unk19 = 0, + .pocket = POCKET_ITEMS, + .type = 4, + .fieldUseFunc = ItemUseOutOfBattle_Honey, + .battleUsage = 0, + .battleUseFunc = NULL, + .secondaryId = 0, + }, }; diff --git a/src/data/text/item_descriptions.h b/src/data/text/item_descriptions.h index 57671d1e7..48584179d 100644 --- a/src/data/text/item_descriptions.h +++ b/src/data/text/item_descriptions.h @@ -452,3 +452,4 @@ const u8 gGrassySeedItemDescription[] = _("Boosts Defense on\nGrassy Terrain,\nb const u8 gMistySeedItemDescription[] = _("Boosts Sp. Def. on\nMisty Terrain,\nbut only one time."); const u8 gPsychicSeedItemDescription[] = _("Boosts Sp. Def. on\nPsychic Terrain,\nbut only one time."); const u8 gAdrenalineOrbItemDescription[] = _("Boosts Speed if the\nuser is intimidated,\nbut only one time."); +const u8 gHoneyItemDescription[] = _("A sweet honey that\nattracts wild Pokémon\nin grass or on trees."); diff --git a/src/item_use.c b/src/item_use.c index 4d225d8b0..a20aecc64 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -1119,3 +1119,13 @@ void ItemUseOutOfBattle_CannotUse(u8 taskId) { DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].data[3]); } + +void ItemUseOutOfBattle_Honey(u8 taskId) +{ + //As a placeholder, just acts like White Flute + FlagSet(FLAG_SYS_ENC_UP_ITEM); + FlagClear(FLAG_SYS_ENC_DOWN_ITEM); + StringExpandPlaceholders(gStringVar4, gText_UsedVar2WildLured); + gTasks[taskId].data[8] = 0; + gTasks[taskId].func = sub_80FE1D0; +} diff --git a/src/wild_encounter.c b/src/wild_encounter.c index b860da13e..be97c73ac 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -487,6 +487,12 @@ static bool8 DoWildEncounterRateTest(u32 encounterRate, bool8 ignoreAbility) encounterRate *= 2; else if (ability == ABILITY_SAND_VEIL && gSaveBlock1Ptr->weather == 8) encounterRate /= 2; + else if (ability == ABILITY_SNOW_CLOAK && gSaveBlock1Ptr->weather == 4) + encounterRate /= 2; + else if (ability == ABILITY_QUICK_FEET && gSaveBlock1Ptr->weather == 8) + encounterRate /= 2; + else if (ability == ABILITY_NO_GUARD) + encounterRate = encounterRate * 150 / 100; } if (encounterRate > 2880) encounterRate = 2880; From 2cfa5ea326fbeb253bc5de00d4d2018d3982f7ec Mon Sep 17 00:00:00 2001 From: Fontbane <36677462+Fontbane@users.noreply.github.com> Date: Mon, 25 Mar 2019 19:00:46 -0400 Subject: [PATCH 013/101] Fixed Honey And updated gitignore --- .gitignore | 2 ++ include/graphics.h | 2 ++ src/battle_script_commands.c | 9 +++++++-- src/data/graphics/items.h | 4 ++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index dc782899d..4d8c4ba7b 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,5 @@ Thumbs.db build/ .DS_Store *.ddump +*.bin +*.ipch diff --git a/include/graphics.h b/include/graphics.h index ed25ae8e3..5fc33a794 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -3940,6 +3940,8 @@ extern const u32 gItemIcon_DreadPlate[]; extern const u32 gItemIconPalette_DreadPlate[]; extern const u32 gItemIcon_IronPlate[]; extern const u32 gItemIconPalette_IronPlate[]; +extern const u32 gItemIcon_Honey[]; +extern const u32 gItemIconPalette_Honey[]; // Gen 5 Items extern const u32 gItemIcon_Eviolite[]; extern const u32 gItemIconPalette_Eviolite[]; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index b832d7e05..a3d724c0a 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10504,6 +10504,7 @@ static void atkE5_pickup(void) u16 species, heldItem; u8 ability; u8 level; + u8 lvlDivBy10; if (InBattlePike()) { @@ -10539,7 +10540,7 @@ static void atkE5_pickup(void) species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); level = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL); - u8 lvlDivBy10 = (level - 1) / 10; + lvlDivBy10 = (level - 1) / 10; if (lvlDivBy10 > 9) lvlDivBy10 = 9; @@ -10576,7 +10577,11 @@ static void atkE5_pickup(void) && species != SPECIES_EGG && heldItem == ITEM_NONE && (Random()%100 <= lvlDivBy10*5+5)) - SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, ITEM_HONEY); + { + u16 honey = ITEM_HONEY; + SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &honey); + break; + } } } diff --git a/src/data/graphics/items.h b/src/data/graphics/items.h index 733bbf317..b00a5b854 100644 --- a/src/data/graphics/items.h +++ b/src/data/graphics/items.h @@ -877,8 +877,8 @@ const u32 gItemIconPalette_DreadPlate[] = INCBIN_U32("graphics/items/icon_palett const u32 gItemIcon_IronPlate[] = INCBIN_U32("graphics/items/icons/iron_plate.4bpp.lz"); const u32 gItemIconPalette_IronPlate[] = INCBIN_U32("graphics/items/icon_palettes/iron_plate.gbapal.lz"); -const u32 gItemIcon_IronPlate[] = INCBIN_U32("graphics/items/icons/honey.4bpp.lz"); -const u32 gItemIconPalette_IronPlate[] = INCBIN_U32("graphics/items/icon_palettes/honey.gbapal.lz"); +const u32 gItemIcon_Honey[] = INCBIN_U32("graphics/items/icons/honey.4bpp.lz"); +const u32 gItemIconPalette_Honey[] = INCBIN_U32("graphics/items/icon_palettes/honey.gbapal.lz"); // Gen 5 Items From ed53220be2228a723a65580567c2e34847d1c2d7 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 30 Mar 2019 13:14:00 -0400 Subject: [PATCH 014/101] Start decompiling mystery gift --- asm/{union_room.s => mystery_gift.s} | 230 ----------------------- data/{union_room.s => mystery_gift.s} | 54 ------ include/mystery_gift.h | 4 + ld_script.txt | 6 +- src/mystery_gift.c | 253 ++++++++++++++++++++++++++ 5 files changed, 261 insertions(+), 286 deletions(-) rename asm/{union_room.s => mystery_gift.s} (95%) rename data/{union_room.s => mystery_gift.s} (78%) create mode 100644 include/mystery_gift.h create mode 100644 src/mystery_gift.c diff --git a/asm/union_room.s b/asm/mystery_gift.s similarity index 95% rename from asm/union_room.s rename to asm/mystery_gift.s index ca5ad6853..63fd80389 100755 --- a/asm/union_room.s +++ b/asm/mystery_gift.s @@ -5,236 +5,6 @@ .text - thumb_func_start sub_8018424 -sub_8018424: @ 8018424 - push {lr} - bl ProcessSpriteCopyRequests - bl LoadOam - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_8018424 - - thumb_func_start sub_8018438 -sub_8018438: @ 8018438 - push {lr} - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - pop {r0} - bx r0 - thumb_func_end sub_8018438 - - thumb_func_start sub_8018450 -sub_8018450: @ 8018450 - push {r4-r7,lr} - sub sp, 0xC - adds r7, r0, 0 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r6, r0, r1 - ldrb r0, [r6] - cmp r0, 0x1 - bne _08018466 - b _08018574 -_08018466: - cmp r0, 0x1 - bgt _08018474 - cmp r0, 0 - beq _08018482 - b _08018644 - .pool -_08018474: - cmp r0, 0x2 - bne _0801847A - b _080185F8 -_0801847A: - cmp r0, 0x3 - bne _08018480 - b _08018618 -_08018480: - b _08018644 -_08018482: - movs r0, 0 - bl SetVBlankCallback - bl ResetPaletteFade - bl ResetSpriteData - bl FreeAllSpritePalettes - bl ResetTasks - bl ScanlineEffect_Stop - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082F0598 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r4, 0x80 - lsls r4, 4 - adds r0, r4, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0x3 - bl SetBgTilemapBuffer - adds r0, r4, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0x2 - bl SetBgTilemapBuffer - adds r0, r4, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0x1 - bl SetBgTilemapBuffer - adds r0, r4, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0 - bl SetBgTilemapBuffer - movs r0, 0x3 - bl bgid_upload_textbox_1 - ldr r0, =gUnknown_082F05A8 - bl InitWindows - bl DeactivateAllTextPrinters - movs r1, 0xC0 - lsls r1, 7 - movs r0, 0 - bl ClearGpuRegBits - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - b _08018610 - .pool -_08018574: - ldr r0, =gUnkTextboxBorderPal - movs r1, 0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0x2 - bl stdpal_get - movs r1, 0xD0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0xC0 - bl sub_81978B0 - movs r0, 0 - movs r1, 0xA - movs r2, 0xE0 - bl LoadUserWindowBorderGfx - movs r0, 0 - movs r1, 0x1 - movs r2, 0xF0 - bl LoadUserWindowBorderGfx_ - movs r4, 0x20 - str r4, [sp] - str r4, [sp, 0x4] - movs r5, 0x11 - str r5, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0x3 - bl sub_8018798 - lsls r0, r7, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_80186EC - b _08018610 - .pool -_080185F8: - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0 - bl CopyBgTilemapBufferToVram -_08018610: - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - b _08018644 -_08018618: - movs r0, 0 - bl ShowBg - movs r0, 0x3 - bl ShowBg - ldr r0, =0x0000021d - bl PlayBGM - ldr r0, =sub_8018424 - bl SetVBlankCallback - movs r0, 0xC5 - bl EnableInterrupts - movs r0, 0x1 - b _08018646 - .pool -_08018644: - movs r0, 0 -_08018646: - add sp, 0xC - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8018450 - thumb_func_start c2_mystery_gift c2_mystery_gift: @ 8018650 push {lr} diff --git a/data/union_room.s b/data/mystery_gift.s similarity index 78% rename from data/union_room.s rename to data/mystery_gift.s index 6934f0fd8..cfca73479 100755 --- a/data/union_room.s +++ b/data/mystery_gift.s @@ -3,60 +3,6 @@ .section .rodata - .align 2 -gUnkTextboxBorderPal:: @ 82F0548 - .incbin "graphics/interface/unk_textbox_border.gbapal" - - .align 2 -gUnkTextboxBorderGfx:: @ 82F0568 - .incbin "graphics/interface/unk_textbox_border.4bpp.lz" - - .align 2 -gUnknown_082F0598:: @ 82F0598 struct BgTemplate - .4byte 0x000000f8 - .4byte 0x000010e1 - .4byte 0x000020d2 - .4byte 0x000030c3 - - .align 2 -gUnknown_082F05A8:: @ 82F05A8 - window_template 0x00, 0x00, 0x00, 0x1e, 0x02, 0x0c, 0x0013 - window_template 0x00, 0x01, 0x0f, 0x1c, 0x04, 0x0c, 0x004f - window_template 0x00, 0x00, 0x0f, 0x1e, 0x05, 0x0d, 0x004f - null_window_template - - .align 2 -gUnknown_082F05C8:: @ 82F05C8 - window_template 0x00, 0x01, 0x0f, 0x1c, 0x04, 0x0c, 0x00e5 - - .align 2 -gUnknown_082F05D0:: @ 82F05D0 - window_template 0x00, 0x01, 0x0f, 0x14, 0x04, 0x0c, 0x00e5 - - .align 2 -gUnknown_082F05D8:: @ 82F05D8 - window_template 0x00, 0x01, 0x0f, 0x13, 0x04, 0x0c, 0x00e5 - - .align 2 -gUnknown_082F05E0:: @ 82F05E0 - window_template 0x00, 0x08, 0x06, 0x0e, 0x06, 0x0c, 0x0155 - - .align 2 -gUnknown_082F05E8:: @ 82F05E8 - window_template 0x00, 0x17, 0x0f, 0x06, 0x04, 0x0c, 0x0155 - - .align 2 -gUnknown_082F05F0:: @ 82F05F0 - window_template 0x00, 0x16, 0x0b, 0x07, 0x08, 0x0c, 0x0155 - - .align 2 -gUnknown_082F05F8:: @ 82F05F8 - window_template 0x00, 0x16, 0x0d, 0x07, 0x06, 0x0c, 0x0155 - - .align 2 -gUnknown_082F0600:: @ 82F0600 - window_template 0x00, 0x16, 0x0f, 0x07, 0x04, 0x0c, 0x0155 - .align 2 gUnknown_082F0608:: @ 82F0608 .4byte gText_WonderCards, 0x00000000 diff --git a/include/mystery_gift.h b/include/mystery_gift.h new file mode 100644 index 000000000..b83239bc7 --- /dev/null +++ b/include/mystery_gift.h @@ -0,0 +1,4 @@ +#ifndef GUARD_MYSTERY_GIFT_H +#define GUARD_MYSTERY_GIFT_H + +#endif //GUARD_MYSTERY_GIFT_H diff --git a/ld_script.txt b/ld_script.txt index f1ed87a04..b22f58398 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -55,7 +55,8 @@ SECTIONS { src/link.o(.text); src/link_rfu.o(.text); src/union_room.o(.text); - asm/union_room.o(.text); + src/mystery_gift.o(.text); + asm/mystery_gift.o(.text); src/mevent2.o(.text); src/mevent_801BAAC.o(.text); asm/mevent_server.o(.text); @@ -408,7 +409,8 @@ SECTIONS { src/link.o(.rodata); src/link_rfu.o(.rodata); src/union_room.o(.rodata); - data/union_room.o(.rodata); + src/mystery_gift.o(.rodata); + data/mystery_gift.o(.rodata); src/mevent2.o(.rodata); src/mevent_801BAAC.o(.rodata); data/mevent_server.o(.rodata); diff --git a/src/mystery_gift.c b/src/mystery_gift.c new file mode 100644 index 000000000..b6c317281 --- /dev/null +++ b/src/mystery_gift.c @@ -0,0 +1,253 @@ +#include "global.h" +#include "main.h" +#include "text.h" +#include "task.h" +#include "alloc.h" +#include "gpu_regs.h" +#include "scanline_effect.h" +#include "text_window.h" +#include "bg.h" +#include "window.h" +#include "text_window.h" +#include "menu.h" +#include "palette.h" +#include "constants/songs.h" +#include "sound.h" +#include "mystery_gift.h" + +void bgid_upload_textbox_1(u8 bgId); +void sub_8018798(u8); +void sub_80186EC(u8, u8); + +const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal"); +const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz"); + +const struct BgTemplate gUnknown_082F0598[] = { + { + .bg = 0, + .charBaseIndex = 2, + .mapBaseIndex = 15, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0x000 + }, { + .bg = 1, + .charBaseIndex = 0, + .mapBaseIndex = 14, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 0x000 + }, { + .bg = 2, + .charBaseIndex = 0, + .mapBaseIndex = 13, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0x000 + }, { + .bg = 3, + .charBaseIndex = 0, + .mapBaseIndex = 12, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 0x000 + } +}; + +const struct WindowTemplate gUnknown_082F05A8[] = { + { + .bg = 0x00, + .tilemapLeft = 0x00, + .tilemapTop = 0x00, + .width = 0x1e, + .height = 0x02, + .paletteNum = 0x0c, + .baseBlock = 0x0013 + }, { + .bg = 0x00, + .tilemapLeft = 0x01, + .tilemapTop = 0x0f, + .width = 0x1c, + .height = 0x04, + .paletteNum = 0x0c, + .baseBlock = 0x004f + }, { + .bg = 0x00, + .tilemapLeft = 0x00, + .tilemapTop = 0x0f, + .width = 0x1e, + .height = 0x05, + .paletteNum = 0x0d, + .baseBlock = 0x004f + }, { + 0xFF + } +}; + +const struct WindowTemplate gUnknown_082F05C8 = { + .bg = 0x00, + .tilemapLeft = 0x01, + .tilemapTop = 0x0f, + .width = 0x1c, + .height = 0x04, + .paletteNum = 0x0c, + .baseBlock = 0x00e5 +}; + +const struct WindowTemplate gUnknown_082F05D0 = { + .bg = 0x00, + .tilemapLeft = 0x01, + .tilemapTop = 0x0f, + .width = 0x14, + .height = 0x04, + .paletteNum = 0x0c, + .baseBlock = 0x00e5 +}; + +const struct WindowTemplate gUnknown_082F05D8 = { + .bg = 0x00, + .tilemapLeft = 0x01, + .tilemapTop = 0x0f, + .width = 0x13, + .height = 0x04, + .paletteNum = 0x0c, + .baseBlock = 0x00e5 +}; + +const struct WindowTemplate gUnknown_082F05E0 = { + .bg = 0x00, + .tilemapLeft = 0x08, + .tilemapTop = 0x06, + .width = 0x0e, + .height = 0x06, + .paletteNum = 0x0c, + .baseBlock = 0x0155 +}; + +const struct WindowTemplate gUnknown_082F05E8 = { + .bg = 0x00, + .tilemapLeft = 0x17, + .tilemapTop = 0x0f, + .width = 0x06, + .height = 0x04, + .paletteNum = 0x0c, + .baseBlock = 0x0155 +}; + +const struct WindowTemplate gUnknown_082F05F0 = { + .bg = 0x00, + .tilemapLeft = 0x16, + .tilemapTop = 0x0b, + .width = 0x07, + .height = 0x08, + .paletteNum = 0x0c, + .baseBlock = 0x0155 +}; + +const struct WindowTemplate gUnknown_082F05F8 = { + .bg = 0x00, + .tilemapLeft = 0x16, + .tilemapTop = 0x0d, + .width = 0x07, + .height = 0x06, + .paletteNum = 0x0c, + .baseBlock = 0x0155 +}; + +const struct WindowTemplate gUnknown_082F0600 = { + .bg = 0x00, + .tilemapLeft = 0x16, + .tilemapTop = 0x0f, + .width = 0x07, + .height = 0x04, + .paletteNum = 0x0c, + .baseBlock = 0x0155 +}; + +void sub_8018424(void) +{ + ProcessSpriteCopyRequests(); + LoadOam(); + TransferPlttBuffer(); +} + +void sub_8018438(void) +{ + RunTasks(); + RunTextPrinters(); + AnimateSprites(); + BuildOamBuffer(); +} + +bool32 sub_8018450(s32 arg) +{ + switch (gMain.state) + { + case 0: + SetVBlankCallback(NULL); + ResetPaletteFade(); + ResetSpriteData(); + FreeAllSpritePalettes(); + ResetTasks(); + ScanlineEffect_Stop(); + ResetBgsAndClearDma3BusyFlags(0); + + InitBgsFromTemplates(0, gUnknown_082F0598, ARRAY_COUNT(gUnknown_082F0598)); + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + ChangeBgX(2, 0, 0); + ChangeBgY(2, 0, 0); + ChangeBgX(3, 0, 0); + ChangeBgY(3, 0, 0); + + SetBgTilemapBuffer(3, Alloc(0x800)); + SetBgTilemapBuffer(2, Alloc(0x800)); + SetBgTilemapBuffer(1, Alloc(0x800)); + SetBgTilemapBuffer(0, Alloc(0x800)); + + bgid_upload_textbox_1(3); + InitWindows(gUnknown_082F05A8); + DeactivateAllTextPrinters(); + ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + gMain.state++; + break; + case 1: + LoadPalette(gUnkTextboxBorderPal, 0, 0x20); + LoadPalette(stdpal_get(2), 0xd0, 0x20); + sub_81978B0(0xC0); + LoadUserWindowBorderGfx(0, 0xA, 0xE0); + LoadUserWindowBorderGfx_(0, 0x1, 0xF0); + FillBgTilemapBufferRect(0, 0x000, 0, 0, 32, 32, 0x11); + FillBgTilemapBufferRect(1, 0x000, 0, 0, 32, 32, 0x11); + FillBgTilemapBufferRect(2, 0x000, 0, 0, 32, 32, 0x11); + sub_8018798(3); + sub_80186EC(arg, 0); + gMain.state++; + break; + case 2: + CopyBgTilemapBufferToVram(3); + CopyBgTilemapBufferToVram(2); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(0); + gMain.state++; + break; + case 3: + ShowBg(0); + ShowBg(3); + PlayBGM(MUS_RG_OKURIMONO); + SetVBlankCallback(sub_8018424); + EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_VCOUNT | INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL); + return TRUE; + } + + return FALSE; +} From 5bf7886a70d6505bf38fb71c3b0341e249b4af99 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 30 Mar 2019 14:36:52 -0400 Subject: [PATCH 015/101] through sub_8018798 --- asm/mystery_gift.s | 227 -------------------------------------- data/mystery_gift.s | 93 ---------------- include/mevent2.h | 6 + include/mystery_gift.h | 4 + include/rom_8011DC0.h | 171 ---------------------------- include/strings.h | 20 ++++ include/union_room.h | 172 ++++++++++++++++++++++++++++- src/cable_club.c | 3 +- src/ereader_helpers.c | 2 +- src/ereader_screen.c | 2 +- src/link_rfu.c | 4 +- src/mevent_801BAAC.c | 1 + src/mystery_gift.c | 245 ++++++++++++++++++++++++++++++++++++++++- src/party_menu.c | 2 +- src/start_menu.c | 1 + src/trade.c | 3 + src/union_room.c | 4 +- sym_ewram.txt | 5 +- 18 files changed, 457 insertions(+), 508 deletions(-) create mode 100644 include/mevent2.h diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index 63fd80389..08866a85d 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,233 +5,6 @@ .text - thumb_func_start c2_mystery_gift -c2_mystery_gift: @ 8018650 - push {lr} - movs r0, 0 - bl sub_8018450 - cmp r0, 0 - beq _0801866C - ldr r0, =sub_8018438 - bl SetMainCallback2 - ldr r1, =gUnknown_02022C60 - movs r0, 0 - strb r0, [r1] - bl task_add_00_mystery_gift -_0801866C: - bl RunTasks - pop {r0} - bx r0 - .pool - thumb_func_end c2_mystery_gift - - thumb_func_start sub_801867C -sub_801867C: @ 801867C - push {lr} - movs r0, 0x1 - bl sub_8018450 - cmp r0, 0 - beq _08018698 - ldr r0, =sub_8018438 - bl SetMainCallback2 - ldr r1, =gUnknown_02022C60 - movs r0, 0x1 - strb r0, [r1] - bl sub_81D5014 -_08018698: - pop {r0} - bx r0 - .pool - thumb_func_end sub_801867C - - thumb_func_start sub_80186A4 -sub_80186A4: @ 80186A4 - push {lr} - ldr r1, =gUnknown_02022C60 - movs r0, 0 - strb r0, [r1] - bl FreeAllWindowBuffers - movs r0, 0 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x1 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x2 - bl GetBgTilemapBuffer - bl Free - movs r0, 0x3 - bl GetBgTilemapBuffer - bl Free - ldr r0, =CB2_InitTitleScreen - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80186A4 - - thumb_func_start sub_80186EC -sub_80186EC: @ 80186EC - push {r4-r7,lr} - sub sp, 0x14 - adds r4, r0, 0 - adds r5, r1, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0 - bl FillWindowPixelBuffer - cmp r4, 0 - bne _0801871C - ldr r0, =gText_MysteryGift - ldr r7, =gText_PickOKCancel - cmp r5, 0 - bne _08018720 - ldr r7, =gText_PickOKExit - b _08018720 - .pool -_0801871C: - ldr r0, =gJPText_MysteryGift - ldr r7, =gJPText_DecideStop -_08018720: - movs r4, 0 - str r4, [sp] - str r4, [sp, 0x4] - ldr r6, =gUnknown_082F0720 - str r6, [sp, 0x8] - movs r5, 0x1 - negs r5, r5 - str r5, [sp, 0xC] - str r0, [sp, 0x10] - movs r0, 0 - movs r1, 0x1 - movs r2, 0x4 - movs r3, 0x1 - bl AddTextPrinterParameterized4 - movs r0, 0 - adds r1, r7, 0 - movs r2, 0xDE - bl GetStringRightAlignXOffset - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - str r4, [sp] - str r4, [sp, 0x4] - str r6, [sp, 0x8] - str r5, [sp, 0xC] - str r7, [sp, 0x10] - movs r0, 0 - movs r1, 0 - movs r3, 0x1 - bl AddTextPrinterParameterized4 - movs r0, 0 - movs r1, 0x2 - bl CopyWindowToVram - movs r0, 0 - bl PutWindowTilemap - add sp, 0x14 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80186EC - - thumb_func_start sub_8018784 -sub_8018784: @ 8018784 - push {lr} - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - movs r2, 0xF - bl sub_8098858 - pop {r0} - bx r0 - thumb_func_end sub_8018784 - - thumb_func_start sub_8018798 -sub_8018798: @ 8018798 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - adds r4, r0, 0 - movs r0, 0 - mov r9, r0 - lsls r4, 24 - lsrs r0, r4, 24 - movs r1, 0x20 - str r1, [sp] - movs r1, 0x2 - str r1, [sp, 0x4] - movs r1, 0x11 - str r1, [sp, 0x8] - movs r1, 0x3 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - mov r8, r4 - movs r4, 0x1 -_080187C8: - movs r7, 0 - mov r0, r9 - adds r0, 0x2 - movs r1, 0x1 - add r1, r9 - mov r10, r1 - lsls r5, r0, 24 - movs r6, 0 -_080187D8: - mov r1, r9 - ands r1, r4 - adds r0, r7, 0 - ands r0, r4 - cmp r1, r0 - beq _080187FC - lsrs r2, r6, 24 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - mov r1, r8 - lsrs r0, r1, 24 - movs r1, 0x1 - lsrs r3, r5, 24 - bl FillBgTilemapBufferRect - b _08018812 -_080187FC: - lsrs r2, r6, 24 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - mov r1, r8 - lsrs r0, r1, 24 - movs r1, 0x2 - lsrs r3, r5, 24 - bl FillBgTilemapBufferRect -_08018812: - movs r0, 0x80 - lsls r0, 17 - adds r6, r0 - adds r7, 0x1 - cmp r7, 0x1F - ble _080187D8 - mov r9, r10 - mov r1, r9 - cmp r1, 0x11 - ble _080187C8 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8018798 - thumb_func_start sub_8018838 sub_8018838: @ 8018838 push {lr} diff --git a/data/mystery_gift.s b/data/mystery_gift.s index cfca73479..5f86ab4d2 100755 --- a/data/mystery_gift.s +++ b/data/mystery_gift.s @@ -3,99 +3,6 @@ .section .rodata - .align 2 -gUnknown_082F0608:: @ 82F0608 - .4byte gText_WonderCards, 0x00000000 - .4byte gText_WonderNews, 0x00000001 - .4byte gText_Exit3, 0xfffffffe - - .align 2 -gUnknown_082F0620:: @ 82F0620 - .4byte gText_WirelessCommunication, 0x00000000 - .4byte gText_Friend2, 0x00000001 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F0638:: @ 82F0638 struct ListMenuTemplate - .4byte NULL - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F0650:: @ 82F0650 - .4byte gText_Receive, 0x00000000 - .4byte gText_Send, 0x00000001 - .4byte gText_Toss, 0x00000002 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F0670:: @ 82F0670 - .4byte gText_Receive, 0x00000000 - .4byte gText_Toss, 0x00000002 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F0688:: @ 82F0688 - .4byte gText_Receive, 0x00000000 - .4byte gText_Send, 0x00000001 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F06A0:: @ 82F06A0 - .4byte gText_Receive, 0x00000000 - .4byte gText_Cancel2, 0xfffffffe - - .align 2 -gUnknown_082F06B0:: @ 82F06B0 struct ListMenuTemplate - .4byte gUnknown_082F0650 - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F06C8:: @ 82F06C8 - .4byte gUnknown_082F0670 - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F06E0:: @ 82F06E0 - .4byte gUnknown_082F0688 - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 -gUnknown_082F06F8:: @ 82F06F8 - .4byte gUnknown_082F06A0 - .4byte ListMenuDefaultCursorMoveFunc - .4byte NULL - .byte 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00 - .byte 0x21, 0x31, 0x00, 0x01 - - .align 2 - .4byte gText_VarietyOfEventsImportedWireless - .4byte gText_WonderCardsInPossession - .4byte gText_ReadNewsThatArrived - .4byte gText_ReturnToTitle - - .align 2 -gUnknown_082F0720:: @ 82F0720 - .byte 0x00, 0x01, 0x02 - - .align 2 - .byte 0x00, 0x01, 0x02 - - .align 2 -gUnknown_082F0728:: @ 82F0728 - .byte 0x01, 0x02, 0x03 - .align 2 gUnknown_082F072C:: @ 82F072C .byte 0x21, 0x2c, 0x1f, 0x23, 0x25, 0x24, 0x41, 0x42 diff --git a/include/mevent2.h b/include/mevent2.h new file mode 100644 index 000000000..80b1fd51b --- /dev/null +++ b/include/mevent2.h @@ -0,0 +1,6 @@ +#ifndef GUARD_MEVENT2_H +#define GUARD_MEVENT2_H + +void sub_801B990(u32, u32); + +#endif //GUARD_MEVENT2_H diff --git a/include/mystery_gift.h b/include/mystery_gift.h index b83239bc7..b43fbe9a9 100644 --- a/include/mystery_gift.h +++ b/include/mystery_gift.h @@ -1,4 +1,8 @@ #ifndef GUARD_MYSTERY_GIFT_H #define GUARD_MYSTERY_GIFT_H +void sub_8018438(void); +void sub_80186EC(bool8 isJapanese, bool32 usePickOkCancel); +void sub_8018798(u32 bg); + #endif //GUARD_MYSTERY_GIFT_H diff --git a/include/rom_8011DC0.h b/include/rom_8011DC0.h index fa54fca66..ee7397320 100644 --- a/include/rom_8011DC0.h +++ b/include/rom_8011DC0.h @@ -1,175 +1,4 @@ #ifndef GUARD_rom_8011DC0_H #define GUARD_rom_8011DC0_H -#include "librfu.h" - -// Exported type declarations - -struct UnkStruct_Shared -{ - struct UnkLinkRfuStruct_02022B14 field_0; - u8 ALIGNED(4) playerName[PLAYER_NAME_LENGTH + 1]; -}; - -struct UnkStruct_x1C -{ - struct UnkStruct_Shared unk0; - u8 unk18:1; -}; - -struct UnkStruct_x20 -{ - struct UnkStruct_Shared unk; - u16 field_18; - u8 field_1A_0:2; - u8 field_1A_1:1; - u8 field_1B; - u8 field_1D; - u8 field_1E; - u8 field_1F; -}; - -struct UnkStruct_Main0 -{ - struct UnkStruct_x20 arr[8]; -}; - -struct UnkStruct_Main4 -{ - struct UnkStruct_x1C arr[5]; -}; - -struct UnkStruct_Main8 -{ - struct UnkStruct_x20 arr[5]; -}; - -struct UnkStruct_Leader -{ - struct UnkStruct_Main0 *field_0; - struct UnkStruct_Main4 *field_4; - struct UnkStruct_Main8 *field_8; - u8 state; - u8 textState; - u8 field_E; - u8 listWindowId; - u8 field_10; - u8 field_11; - u8 listTaskId; - u8 field_13; - u8 field_14; - u8 field_15; - u8 field_16; - u8 field_17; - u8 field_18; - u8 field_19; - u16 field_1A; -}; - -struct UnkStruct_Group -{ - struct UnkStruct_Main0 *field_0; - struct UnkStruct_Main4 *field_4; - u8 state; - u8 textState; - u8 field_A; - u8 listWindowId; - u8 field_C; - u8 field_D; - u8 listTaskId; - u8 field_F; - u8 field_10; - u8 field_11; - u8 field_12; - u8 field_13; - u8 field_14; - u8 field_15; -}; - -struct UnkStruct_8019BA8 -{ - u8 field_0; - u8 field_1; - u8 field_2; - u8 field_3; -}; - -struct UnkStruct_URoom -{ - struct UnkStruct_Main0 *field_0; - struct UnkStruct_Main4 *field_4; - struct UnkStruct_Main0 *field_8; - struct UnkStruct_Main4 *field_C; - u16 field_10; - u16 field_12; - u8 state; - u8 stateAfterPrint; - u8 textState; - u8 field_17; - u8 field_18; - u8 field_19; - u8 field_1A; - u8 field_1B; - u8 field_1C; - u8 field_1D; - u8 field_1E; - u8 field_1F; - u8 field_20; - u8 spriteIds[40]; - u8 field_49; - u8 field_4A; - u16 field_4C[6]; - u8 field_58[0x98 - 0x58]; - u16 field_98; - u16 field_9A[3]; - struct UnkStruct_8019BA8 field_A0[8]; - u8 field_C0[12][15]; - u8 field_174[48]; - u8 field_1A4[200]; -}; - -union UnkUnion_Main -{ - struct UnkStruct_Leader *leader; - struct UnkStruct_Group *group; - struct UnkStruct_URoom *uRoom; -}; - -struct TradeUnkStruct -{ - u16 field_0; - u16 type; - u32 playerPersonality; - u8 field_8; - u8 field_9; - u16 playerSpecies; - u16 playerLevel; - u16 species; - u16 level; - u16 field_12; - u32 personality; -}; - -// Exported RAM declarations - -extern u8 gUnknown_02022C2C; -extern union UnkUnion_Main gUnknown_02022C30; -extern struct UnkLinkRfuStruct_02022B14Substruct gUnknown_02022C38; - -extern u16 gUnknown_02022C3C; -extern u8 gUnknown_02022C3E; - -// Exported ROM declarations - -void sub_8018438(void); -void sub_801B990(u32, u32); -u8 sub_8013F78(void); -bool32 sub_802C908(u16); -void nullsub_89(u8 taskId); -void var_800D_set_xB(void); - -bool32 mevent_0814257C(u8 *textState, const u8 *str); -void sub_8018884(const u8 *src); -void sub_80186A4(void); - #endif //GUARD_rom_8011DC0_H diff --git a/include/strings.h b/include/strings.h index 4a65e6875..bf1252680 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2606,4 +2606,24 @@ extern const u8 gText_YayUnkF9F9[]; extern const u8 gText_ThankYou[]; extern const u8 gText_ByeBye[]; +// Mystery Gift +extern const u8 gText_MysteryGift[]; +extern const u8 gText_PickOKCancel[]; +extern const u8 gText_PickOKExit[]; +extern const u8 gJPText_MysteryGift[]; +extern const u8 gJPText_DecideStop[]; +extern const u8 gText_WonderCards[]; +extern const u8 gText_WonderNews[]; +extern const u8 gText_Exit3[]; +extern const u8 gText_WirelessCommunication[]; +extern const u8 gText_Friend2[]; +extern const u8 gText_Cancel2[]; +extern const u8 gText_Receive[]; +extern const u8 gText_Send[]; +extern const u8 gText_Toss[]; +extern const u8 gText_VarietyOfEventsImportedWireless[]; +extern const u8 gText_WonderCardsInPossession[]; +extern const u8 gText_ReadNewsThatArrived[]; +extern const u8 gText_ReturnToTitle[]; + #endif // GUARD_STRINGS_H diff --git a/include/union_room.h b/include/union_room.h index 7634e4763..84a7f1f2b 100644 --- a/include/union_room.h +++ b/include/union_room.h @@ -1,9 +1,175 @@ #ifndef GUARD_UNION_ROOM_H #define GUARD_UNION_ROOM_H +#include "librfu.h" + +// Exported type declarations + +struct UnkStruct_Shared +{ + struct UnkLinkRfuStruct_02022B14 field_0; + u8 ALIGNED(4) playerName[PLAYER_NAME_LENGTH + 1]; +}; + +struct UnkStruct_x1C +{ + struct UnkStruct_Shared unk0; + u8 unk18:1; +}; + +struct UnkStruct_x20 +{ + struct UnkStruct_Shared unk; + u16 field_18; + u8 field_1A_0:2; + u8 field_1A_1:1; + u8 field_1B; + u8 field_1D; + u8 field_1E; + u8 field_1F; +}; + +struct UnkStruct_Main0 +{ + struct UnkStruct_x20 arr[8]; +}; + +struct UnkStruct_Main4 +{ + struct UnkStruct_x1C arr[5]; +}; + +struct UnkStruct_Main8 +{ + struct UnkStruct_x20 arr[5]; +}; + +struct UnkStruct_Leader +{ + struct UnkStruct_Main0 *field_0; + struct UnkStruct_Main4 *field_4; + struct UnkStruct_Main8 *field_8; + u8 state; + u8 textState; + u8 field_E; + u8 listWindowId; + u8 field_10; + u8 field_11; + u8 listTaskId; + u8 field_13; + u8 field_14; + u8 field_15; + u8 field_16; + u8 field_17; + u8 field_18; + u8 field_19; + u16 field_1A; +}; + +struct UnkStruct_Group +{ + struct UnkStruct_Main0 *field_0; + struct UnkStruct_Main4 *field_4; + u8 state; + u8 textState; + u8 field_A; + u8 listWindowId; + u8 field_C; + u8 field_D; + u8 listTaskId; + u8 field_F; + u8 field_10; + u8 field_11; + u8 field_12; + u8 field_13; + u8 field_14; + u8 field_15; +}; + +struct UnkStruct_8019BA8 +{ + u8 field_0; + u8 field_1; + u8 field_2; + u8 field_3; +}; + +struct UnkStruct_URoom +{ + struct UnkStruct_Main0 *field_0; + struct UnkStruct_Main4 *field_4; + struct UnkStruct_Main0 *field_8; + struct UnkStruct_Main4 *field_C; + u16 field_10; + u16 field_12; + u8 state; + u8 stateAfterPrint; + u8 textState; + u8 field_17; + u8 field_18; + u8 field_19; + u8 field_1A; + u8 field_1B; + u8 field_1C; + u8 field_1D; + u8 field_1E; + u8 field_1F; + u8 field_20; + u8 spriteIds[40]; + u8 field_49; + u8 field_4A; + u16 field_4C[6]; + u8 field_58[0x98 - 0x58]; + u16 field_98; + u16 field_9A[3]; + struct UnkStruct_8019BA8 field_A0[8]; + u8 field_C0[12][15]; + u8 field_174[48]; + u8 field_1A4[200]; +}; + +union UnkUnion_Main +{ + struct UnkStruct_Leader *leader; + struct UnkStruct_Group *group; + struct UnkStruct_URoom *uRoom; +}; + +struct TradeUnkStruct +{ + u16 field_0; + u16 type; + u32 playerPersonality; + u8 field_8; + u8 field_9; + u16 playerSpecies; + u16 playerLevel; + u16 species; + u16 level; + u16 field_12; + u32 personality; +}; + +// Exported RAM declarations + +extern u8 gUnknown_02022C2C; +extern union UnkUnion_Main gUnknown_02022C30; +extern struct UnkLinkRfuStruct_02022B14Substruct gUnknown_02022C38; + +extern u16 gUnknown_02022C3C; +extern u8 gUnknown_02022C3E; + +// Exported ROM declarations + +u8 sub_8013F78(void); +bool32 sub_802C908(u16); +void nullsub_89(u8 taskId); +void var_800D_set_xB(void); + +bool32 mevent_0814257C(u8 *textState, const u8 *str); +void sub_8018884(const u8 *src); +void sub_80186A4(void); + extern bool8 gUnknown_02022C60; -void sub_8018798(u8); -void sub_80186EC(bool8, bool32); - #endif //GUARD_UNION_ROOM_H diff --git a/src/cable_club.c b/src/cable_club.c index b80e76e99..fab187b07 100644 --- a/src/cable_club.c +++ b/src/cable_club.c @@ -17,7 +17,8 @@ #include "menu.h" #include "overworld.h" #include "palette.h" -#include "rom_8011DC0.h" +#include "union_room.h" +#include "mevent2.h" #include "script.h" #include "script_pokemon_util_80F87D8.h" #include "sound.h" diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c index 6c92b676f..cdb829ac8 100755 --- a/src/ereader_helpers.c +++ b/src/ereader_helpers.c @@ -4,7 +4,7 @@ #include "ereader_helpers.h" #include "link.h" #include "main.h" -#include "rom_8011DC0.h" +#include "union_room.h" #include "save.h" #include "sprite.h" #include "task.h" diff --git a/src/ereader_screen.c b/src/ereader_screen.c index b15c1fd0c..10a23e251 100755 --- a/src/ereader_screen.c +++ b/src/ereader_screen.c @@ -4,7 +4,7 @@ #include "ereader_helpers.h" #include "link.h" #include "main.h" -#include "rom_8011DC0.h" +#include "union_room.h" #include "save.h" #include "sound.h" #include "sprite.h" diff --git a/src/link_rfu.c b/src/link_rfu.c index 945806459..43d19be03 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -11,13 +11,13 @@ #include "overworld.h" #include "random.h" #include "palette.h" -#include "rom_8011DC0.h" +#include "union_room.h" #include "string_util.h" #include "task.h" #include "text.h" #include "constants/species.h" #include "save.h" -#include "rom_8011DC0.h" +#include "mystery_gift.h" extern u16 gHeldKeyCodeToSend; diff --git a/src/mevent_801BAAC.c b/src/mevent_801BAAC.c index 857ca3fde..d69ab0495 100644 --- a/src/mevent_801BAAC.c +++ b/src/mevent_801BAAC.c @@ -13,6 +13,7 @@ #include "string_util.h" #include "link_rfu.h" #include "mevent.h" +#include "mystery_gift.h" struct UnkStruct_8467FB8 { diff --git a/src/mystery_gift.c b/src/mystery_gift.c index b6c317281..3fbe11378 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -8,16 +8,24 @@ #include "text_window.h" #include "bg.h" #include "window.h" +#include "strings.h" #include "text_window.h" #include "menu.h" #include "palette.h" #include "constants/songs.h" #include "sound.h" #include "mystery_gift.h" +#include "union_room.h" +#include "title_screen.h" +#include "ereader_screen.h" +#include "international_string_util.h" +#include "list_menu.h" void bgid_upload_textbox_1(u8 bgId); -void sub_8018798(u8); -void sub_80186EC(u8, u8); +void task_add_00_mystery_gift(void); + +EWRAM_DATA u8 gUnknown_02022C58 = 0; +EWRAM_DATA u8 gUnknown_02022C59 = 0; const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal"); const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz"); @@ -168,6 +176,158 @@ const struct WindowTemplate gUnknown_082F0600 = { .baseBlock = 0x0155 }; +const struct ListMenuItem gUnknown_082F0608[] = { + { gText_WonderCards, 0 }, + { gText_WonderNews, 1 }, + { gText_Exit3, -2 } +}; + +const struct ListMenuItem gUnknown_082F0620[] = { + { gText_WirelessCommunication, 0 }, + { gText_Friend2, 1 }, + { gText_Cancel2, -2 } +}; + +const struct ListMenuTemplate gUnknown_082F0638 = { + .items = NULL, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 3, + .maxShowed = 3, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const struct ListMenuItem gUnknown_082F0650[] = { + { gText_Receive, 0 }, + { gText_Send, 1 }, + { gText_Toss, 2 }, + { gText_Cancel2, -2 } +}; + +const struct ListMenuItem gUnknown_082F0670[] = { + { gText_Receive, 0 }, + { gText_Toss, 2 }, + { gText_Cancel2, -2 } +}; + +const struct ListMenuItem gUnknown_082F0688[] = { + { gText_Receive, 0 }, + { gText_Send, 1 }, + { gText_Cancel2, -2 } +}; + +const struct ListMenuItem gUnknown_082F06A0[] = { + { gText_Receive, 0 }, + { gText_Cancel2, -2 } +}; + +const struct ListMenuTemplate gUnknown_082F06B0 = { + .items = gUnknown_082F0650, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 4, + .maxShowed = 4, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const struct ListMenuTemplate gUnknown_082F06C8 = { + .items = gUnknown_082F0670, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 3, + .maxShowed = 3, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const struct ListMenuTemplate gUnknown_082F06E0 = { + .items = gUnknown_082F0688, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 3, + .maxShowed = 3, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const struct ListMenuTemplate gUnknown_082F06F8 = { + .items = gUnknown_082F06A0, + .moveCursorFunc = ListMenuDefaultCursorMoveFunc, + .itemPrintFunc = NULL, + .totalItems = 2, + .maxShowed = 2, + .windowId = 0, + .header_X = 0, + .item_X = 8, + .cursor_X = 0, + .upText_Y = 1, + .cursorPal = 2, + .fillValue = 1, + .cursorShadowPal = 3, + .lettersSpacing = 0, + .itemVerticalPadding = 0, + .scrollMultiple = 0, + .fontId = 1, + .cursorKind = 0 +}; + +const u8 *const Unref_082F0710[] = { + gText_VarietyOfEventsImportedWireless, + gText_WonderCardsInPossession, + gText_ReadNewsThatArrived, + gText_ReturnToTitle +}; + +ALIGNED(2) const u8 gUnknown_082F0720[] = { 0, 1, 2 }; +ALIGNED(2) const u8 gUnknown_082F0724[] = { 0, 1, 2 }; +ALIGNED(2) const u8 gUnknown_082F0728[] = { 1, 2, 3 }; + void sub_8018424(void) { ProcessSpriteCopyRequests(); @@ -251,3 +411,84 @@ bool32 sub_8018450(s32 arg) return FALSE; } + +void c2_mystery_gift(void) +{ + if (sub_8018450(0)) + { + SetMainCallback2(sub_8018438); + gUnknown_02022C60 = FALSE; + task_add_00_mystery_gift(); + } + RunTasks(); +} + +void sub_801867C(void) +{ + if (sub_8018450(1)) + { + SetMainCallback2(sub_8018438); + gUnknown_02022C60 = TRUE; + sub_81D5014(); + } +} + +void sub_80186A4(void) +{ + gUnknown_02022C60 = FALSE; + FreeAllWindowBuffers(); + Free(GetBgTilemapBuffer(0)); + Free(GetBgTilemapBuffer(1)); + Free(GetBgTilemapBuffer(2)); + Free(GetBgTilemapBuffer(3)); + SetMainCallback2(CB2_InitTitleScreen); +} + +void sub_80186EC(bool8 isJapanese, bool32 usePickOkCancel) +{ + const u8 * header; + const u8 * options; + FillWindowPixelBuffer(0, 0); + if (!isJapanese) + { + header = gText_MysteryGift; + options = !usePickOkCancel ? gText_PickOKExit : gText_PickOKCancel; + } + else + { + header = gJPText_MysteryGift; + options = gJPText_DecideStop; + } + + AddTextPrinterParameterized4(0, 1, 4, 1, 0, 0, gUnknown_082F0720, -1, header); + AddTextPrinterParameterized4(0, 0, GetStringRightAlignXOffset(0, options, 0xDE), 1, 0, 0, gUnknown_082F0720, -1, options); + CopyWindowToVram(0, 2); + PutWindowTilemap(0); +} + +void sub_8018784(u8 windowId) +{ + sub_8098858(windowId, 0x01, 0xF); +} + +void sub_8018798(u32 bg) +{ + s32 i = 0, j; + + FillBgTilemapBufferRect(bg, 0x003, 0, 0, 32, 2, 0x11); + + for (i = 0; i < 18; i++) + { + for (j = 0; j < 32; j++) + { + if ((i & 1) != (j & 1)) + { + FillBgTilemapBufferRect(bg, 1, j, i + 2, 1, 1, 0x11); + } + else + { + FillBgTilemapBufferRect(bg, 2, j, i + 2, 1, 1, 0x11); + } + } + } +} diff --git a/src/party_menu.c b/src/party_menu.c index 7db24b6ca..6233558ff 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -49,7 +49,7 @@ #include "pokemon_summary_screen.h" #include "region_map.h" #include "reshow_battle_screen.h" -#include "rom_8011DC0.h" +#include "union_room.h" #include "scanline_effect.h" #include "script.h" #include "sound.h" diff --git a/src/start_menu.c b/src/start_menu.c index 4822c12e6..f573f9bdf 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -44,6 +44,7 @@ #include "window.h" #include "constants/songs.h" #include "rom_8011DC0.h" +#include "union_room.h" // Menu actions enum diff --git a/src/trade.c b/src/trade.c index df8f493f1..34f49060f 100644 --- a/src/trade.c +++ b/src/trade.c @@ -19,6 +19,8 @@ #include "load_save.h" #include "mail.h" #include "main.h" +#include "mevent2.h" +#include "mystery_gift.h" #include "overworld.h" #include "palette.h" #include "party_menu.h" @@ -39,6 +41,7 @@ #include "text_window.h" #include "trainer_card.h" #include "trade.h" +#include "union_room.h" #include "util.h" #include "window.h" #include "constants/easy_chat.h" diff --git a/src/union_room.c b/src/union_room.c index 338063ef1..a623527ec 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -40,7 +40,7 @@ #include "strings.h" #include "mevent.h" #include "dynamic_placeholder_text_util.h" -#include "rom_8011DC0.h" +#include "union_room.h" #include "easy_chat.h" #include "event_obj_lock.h" #include "union_room_chat.h" @@ -102,8 +102,6 @@ void sub_8020C70(MainCallback callback); void sub_80149D8(void); u16 sub_8019930(void); void sub_8018784(u8 windowId); -void sub_8018884(const u8 *src); -bool32 mevent_0814257C(u8 *textState, const u8 *str); s8 sub_8018B08(u8 *textState, u8 *arg1, u8 arg2, const u8 *str); bool32 sub_8016F1C(struct UnkLinkRfuStruct_02022B14 *arg0, s16 arg1); u8 sub_8016DF0(struct UnkStruct_Main4 *arg0, struct UnkStruct_Main4 *arg1, u32 arg2); diff --git a/sym_ewram.txt b/sym_ewram.txt index 8aea7124c..f2efe6a69 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -7,10 +7,9 @@ .include "src/link.o" .include "src/link_rfu.o" .include "src/union_room.o" + .include "src/mystery_gift.o" -gUnknown_02022C58: @ 2022C58 - .space 0x8 - + .align 3 gUnknown_02022C60: @ 2022C60 .space 0x4 From 1ce07deeac8318068db8100fce65ba2e2de14223 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 30 Mar 2019 20:04:30 -0400 Subject: [PATCH 016/101] through sub_8018A50 --- asm/mystery_gift.s | 366 --------------------------------------------- src/mystery_gift.c | 147 +++++++++++++++++- 2 files changed, 145 insertions(+), 368 deletions(-) diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index 08866a85d..6f2ecd8ce 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,372 +5,6 @@ .text - thumb_func_start sub_8018838 -sub_8018838: @ 8018838 - push {lr} - sub sp, 0xC - cmp r0, 0 - beq _08018846 - cmp r0, 0x1 - beq _0801885E - b _08018876 -_08018846: - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - b _08018876 -_0801885E: - movs r0, 0x20 - str r0, [sp] - movs r0, 0x1E - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0x2 - bl FillBgTilemapBufferRect -_08018876: - movs r0, 0 - bl CopyBgTilemapBufferToVram - add sp, 0xC - pop {r0} - bx r0 - thumb_func_end sub_8018838 - - thumb_func_start sub_8018884 -sub_8018884: @ 8018884 - push {r4,lr} - sub sp, 0x14 - adds r1, r0, 0 - ldr r4, =gStringVar4 - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0x1 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r1, 0 - str r1, [sp] - str r1, [sp, 0x4] - ldr r0, =gUnknown_082F0728 - str r0, [sp, 0x8] - str r1, [sp, 0xC] - str r4, [sp, 0x10] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0 - movs r3, 0x1 - bl AddTextPrinterParameterized4 - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0xF - bl sub_8098858 - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0x1 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0x14 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8018884 - - thumb_func_start sub_80188DC -sub_80188DC: @ 80188DC - push {lr} - movs r0, 0x1 - bl rbox_fill_rectangle - movs r0, 0x1 - bl ClearWindowTilemap - movs r0, 0x1 - movs r1, 0x1 - bl CopyWindowToVram - pop {r0} - bx r0 - thumb_func_end sub_80188DC - - thumb_func_start mevent_0814257C -mevent_0814257C: @ 80188F8 - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - adds r0, r1, 0 - ldrb r2, [r4] - cmp r2, 0x1 - beq _08018920 - cmp r2, 0x1 - bgt _08018910 - cmp r2, 0 - beq _0801891A - b _08018980 -_08018910: - cmp r2, 0x2 - beq _08018954 - cmp r2, 0xFF - beq _0801897C - b _08018980 -_0801891A: - bl sub_8018884 - b _08018944 -_08018920: - movs r0, 0 - str r0, [sp] - ldr r0, =gUnknown_02022C58 - str r0, [sp, 0x4] - adds r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0xD0 - movs r2, 0x14 - movs r3, 0x1 - bl DrawDownArrow - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _08018980 -_08018944: - ldrb r0, [r4] - adds r0, 0x1 - b _0801897E - .pool -_08018954: - movs r0, 0x1 - str r0, [sp] - ldr r0, =gUnknown_02022C58 - str r0, [sp, 0x4] - adds r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0xD0 - movs r2, 0x14 - movs r3, 0x1 - bl DrawDownArrow - movs r0, 0 - strb r0, [r4] - bl sub_80188DC - movs r0, 0x1 - b _08018982 - .pool -_0801897C: - movs r0, 0x2 -_0801897E: - strb r0, [r4] -_08018980: - movs r0, 0 -_08018982: - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - thumb_func_end mevent_0814257C - - thumb_func_start sub_801898C -sub_801898C: @ 801898C - push {lr} - sub sp, 0xC - movs r0, 0 - str r0, [sp] - ldr r0, =gUnknown_02022C58 - str r0, [sp, 0x4] - adds r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0xD0 - movs r2, 0x14 - movs r3, 0x1 - bl DrawDownArrow - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_801898C - - thumb_func_start sub_80189B4 -sub_80189B4: @ 80189B4 - push {lr} - sub sp, 0xC - movs r0, 0x1 - str r0, [sp] - ldr r0, =gUnknown_02022C58 - str r0, [sp, 0x4] - adds r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0xD0 - movs r2, 0x14 - movs r3, 0x1 - bl DrawDownArrow - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_80189B4 - - thumb_func_start sub_80189DC -sub_80189DC: @ 80189DC - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - beq _080189EC - cmp r0, 0x1 - beq _08018A08 - b _08018A14 -_080189EC: - bl sub_801898C - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _08018A14 - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _08018A14 - .pool -_08018A08: - bl sub_80189B4 - movs r0, 0 - strb r0, [r4] - movs r0, 0x1 - b _08018A16 -_08018A14: - movs r0, 0 -_08018A16: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80189DC - - thumb_func_start sub_8018A1C -sub_8018A1C: @ 8018A1C - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0 - bne _08018A2C - adds r0, r1, 0 - bl sub_8018884 -_08018A2C: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x78 - bhi _08018A3E - movs r0, 0 - b _08018A48 -_08018A3E: - movs r0, 0 - strb r0, [r4] - bl sub_80188DC - movs r0, 0x1 -_08018A48: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8018A1C - - thumb_func_start sub_8018A50 -sub_8018A50: @ 8018A50 - push {r4,r5,lr} - sub sp, 0x24 - lsls r2, 24 - add r1, sp, 0x4 - ldr r0, =gUnknown_082F0638 - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - ldm r0!, {r3-r5} - stm r1!, {r3-r5} - ldr r0, =gUnknown_082F05E0 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x1C] - str r1, [sp, 0x20] - cmp r2, 0 - bne _08018A80 - ldr r0, =gUnknown_082F0608 - b _08018A82 - .pool -_08018A80: - ldr r0, =gUnknown_082F0620 -_08018A82: - str r0, [sp, 0x4] - add r0, sp, 0x4 - bl sub_81DB41C - adds r3, r0, 0 - movs r0, 0x1 - ands r0, r3 - cmp r0, 0 - beq _08018A96 - adds r3, 0x1 -_08018A96: - lsls r1, r3, 24 - ldr r0, =0x00ffffff - ldr r2, [sp, 0x1C] - ands r2, r0 - orrs r2, r1 - str r2, [sp, 0x1C] - cmp r3, 0x1D - bgt _08018ACC - movs r0, 0x1E - subs r0, r3 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - lsls r0, 24 - lsrs r0, 16 - ldr r1, =0xffff00ff - ands r1, r2 - orrs r1, r0 - str r1, [sp, 0x1C] - b _08018AD2 - .pool -_08018ACC: - ldr r0, =0xffff00ff - ands r2, r0 - str r2, [sp, 0x1C] -_08018AD2: - add r0, sp, 0x1C - movs r1, 0xE0 - str r1, [sp] - add r1, sp, 0x4 - movs r2, 0x1 - movs r3, 0xA - bl DoMysteryGiftListMenu - adds r4, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r4, r0 - beq _08018AFA - movs r0, 0x2 - bl ClearWindowTilemap - movs r0, 0x2 - movs r1, 0x1 - bl CopyWindowToVram -_08018AFA: - adds r0, r4, 0 - add sp, 0x24 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8018A50 - thumb_func_start sub_8018B08 sub_8018B08: @ 8018B08 push {r4-r6,lr} diff --git a/src/mystery_gift.c b/src/mystery_gift.c index 3fbe11378..7c686964d 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -20,12 +20,12 @@ #include "ereader_screen.h" #include "international_string_util.h" #include "list_menu.h" +#include "string_util.h" void bgid_upload_textbox_1(u8 bgId); void task_add_00_mystery_gift(void); -EWRAM_DATA u8 gUnknown_02022C58 = 0; -EWRAM_DATA u8 gUnknown_02022C59 = 0; +EWRAM_DATA u8 gUnknown_02022C58[2] = {}; const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal"); const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz"); @@ -492,3 +492,146 @@ void sub_8018798(u32 bg) } } } + +void sub_8018838(bool32 arg) +{ + switch (arg) + { + case 0: + FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0x11); + break; + case 1: + FillBgTilemapBufferRect(0, 0, 0, 2, 32, 30, 0x11); + break; + } + CopyBgTilemapBufferToVram(0); +} + +void sub_8018884(const u8 *str) +{ + StringExpandPlaceholders(gStringVar4, str); + FillWindowPixelBuffer(1, 0x11); + AddTextPrinterParameterized4(1, 1, 0, 1, 0, 0, gUnknown_082F0728, 0, gStringVar4); + sub_8098858(1, 0x001, 0xF); + PutWindowTilemap(1); + CopyWindowToVram(1, 3); +} + +void sub_80188DC(void) +{ + rbox_fill_rectangle(1); + ClearWindowTilemap(1); + CopyWindowToVram(1, 1); +} + +bool32 mevent_0814257C(u8 *textState, const u8 *str) +{ + switch (*textState) + { + case 0: + sub_8018884(str); + goto inc; + case 1: + DrawDownArrow(1, 0xD0, 0x14, 1, FALSE, &gUnknown_02022C58[0], &gUnknown_02022C58[1]); + if (({gMain.newKeys & (A_BUTTON | B_BUTTON);})) + { + inc: + (*textState)++; + } + break; + case 2: + DrawDownArrow(1, 0xD0, 0x14, 1, TRUE, &gUnknown_02022C58[0], &gUnknown_02022C58[1]); + *textState = 0; + sub_80188DC(); + return TRUE; + case 0xFF: + *textState = 2; + break; + } + return FALSE; +} + +void sub_801898C(void) +{ + DrawDownArrow(1, 0xD0, 0x14, 1, FALSE, &gUnknown_02022C58[0], &gUnknown_02022C58[1]); +} + +void sub_80189B4(void) +{ + DrawDownArrow(1, 0xD0, 0x14, 1, TRUE, &gUnknown_02022C58[0], &gUnknown_02022C58[1]); +} + +bool32 sub_80189DC(u8 * textState) +{ + switch (*textState) + { + case 0: + sub_801898C(); + if (({gMain.newKeys & (A_BUTTON | B_BUTTON);})) + { + (*textState)++; + } + break; + case 1: + sub_80189B4(); + *textState = 0; + return TRUE; + } + return FALSE; +} + +bool32 sub_8018A1C(u8 * counter, const u8 * str) +{ + if (*counter == 0) + { + sub_8018884(str); + } + if (++(*counter) > 120) + { + *counter = 0; + sub_80188DC(); + return TRUE; + } + else + { + return FALSE; + } +} + +s32 sub_8018A50(u32 unused0, u32 unused1, bool8 r2) +{ + struct ListMenuTemplate listMenuTemplate = gUnknown_082F0638; + struct WindowTemplate windowTemplate = gUnknown_082F05E0; + s32 r3; + s32 r4; + + if (r2 == FALSE) + { + listMenuTemplate.items = gUnknown_082F0608; + } + else + { + listMenuTemplate.items = gUnknown_082F0620; + } + r3 = sub_81DB41C(&listMenuTemplate); + if (r3 & 1) + { + r3++; + } + windowTemplate.width = r3; + if (r3 < 30) + { + windowTemplate.tilemapLeft = (30 - r3) / 2; + } + else + { + windowTemplate.tilemapLeft = 0; + } + r4 = DoMysteryGiftListMenu(&windowTemplate, &listMenuTemplate, 1, 0x00A, 0xE0); + if (r4 != -1) + { + ClearWindowTilemap(2); + CopyWindowToVram(2, 1); + } + return r4; +} From 0ba4d0cadcb2cf22dabc791964038457aa5b46ec Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 31 Mar 2019 10:33:27 -0400 Subject: [PATCH 017/101] sub_8018B08 --- asm/mystery_gift.s | 145 --------------------------------------------- src/mystery_gift.c | 63 +++++++++++++++++++- 2 files changed, 62 insertions(+), 146 deletions(-) diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index 6f2ecd8ce..6fec153ca 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,151 +5,6 @@ .text - thumb_func_start sub_8018B08 -sub_8018B08: @ 8018B08 - push {r4-r6,lr} - sub sp, 0x1C - adds r5, r0, 0 - adds r4, r1, 0 - adds r1, r3, 0 - lsls r2, 24 - lsrs r6, r2, 24 - ldrb r0, [r5] - cmp r0, 0x1 - beq _08018B98 - cmp r0, 0x1 - bgt _08018B26 - cmp r0, 0 - beq _08018B30 - b _08018C3E -_08018B26: - cmp r0, 0x2 - beq _08018BE4 - cmp r0, 0xFF - beq _08018C1A - b _08018C3E -_08018B30: - ldr r0, =gStringVar4 - bl StringExpandPlaceholders - cmp r6, 0 - bne _08018B48 - ldr r0, =gUnknown_082F05C8 - b _08018B4A - .pool -_08018B48: - ldr r0, =gUnknown_082F05D0 -_08018B4A: - bl AddWindow - strh r0, [r4] - ldrb r0, [r4] - movs r1, 0x11 - bl FillWindowPixelBuffer - ldrb r0, [r4] - movs r2, 0 - str r2, [sp] - str r2, [sp, 0x4] - ldr r1, =gUnknown_082F0728 - str r1, [sp, 0x8] - str r2, [sp, 0xC] - ldr r1, =gStringVar4 - str r1, [sp, 0x10] - movs r1, 0x1 - movs r3, 0x1 - bl AddTextPrinterParameterized4 - ldrb r0, [r4] - movs r1, 0x1 - movs r2, 0xF - bl sub_8098858 - ldrb r0, [r4] - movs r1, 0x2 - bl CopyWindowToVram - ldrb r0, [r4] - bl PutWindowTilemap - b _08018BD6 - .pool -_08018B98: - ldr r0, =gUnknown_082F05E8 - ldr r1, [r0, 0x4] - ldr r0, [r0] - str r0, [sp, 0x14] - str r1, [sp, 0x18] - cmp r6, 0 - bne _08018BBC - ldr r0, =0xff00ffff - ldr r1, [sp, 0x14] - ands r1, r0 - movs r0, 0x90 - lsls r0, 12 - b _08018BC6 - .pool -_08018BBC: - ldr r0, =0xff00ffff - ldr r1, [sp, 0x14] - ands r1, r0 - movs r0, 0xF0 - lsls r0, 12 -_08018BC6: - orrs r1, r0 - str r1, [sp, 0x14] - add r0, sp, 0x14 - movs r1, 0xA - movs r2, 0xE - movs r3, 0 - bl CreateYesNoMenu -_08018BD6: - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] - b _08018C3E - .pool -_08018BE4: - bl Menu_ProcessInputNoWrapClearOnChoose - lsls r0, 24 - asrs r6, r0, 24 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r0, 24 - cmp r0, 0x2 - bhi _08018C3E - movs r0, 0 - strb r0, [r5] - ldrb r0, [r4] - bl rbox_fill_rectangle - ldrb r0, [r4] - bl ClearWindowTilemap - ldrb r0, [r4] - movs r1, 0x1 - bl CopyWindowToVram - ldrb r0, [r4] - bl RemoveWindow - adds r0, r6, 0 - b _08018C42 -_08018C1A: - movs r0, 0 - strb r0, [r5] - ldrb r0, [r4] - bl rbox_fill_rectangle - ldrb r0, [r4] - bl ClearWindowTilemap - ldrb r0, [r4] - movs r1, 0x1 - bl CopyWindowToVram - ldrb r0, [r4] - bl RemoveWindow - movs r0, 0x1 - negs r0, r0 - b _08018C42 -_08018C3E: - movs r0, 0x2 - negs r0, r0 -_08018C42: - add sp, 0x1C - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8018B08 - thumb_func_start sub_8018C4C sub_8018C4C: @ 8018C4C push {r4-r6,lr} diff --git a/src/mystery_gift.c b/src/mystery_gift.c index 7c686964d..da2a3bcc0 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -598,7 +598,7 @@ bool32 sub_8018A1C(u8 * counter, const u8 * str) } } -s32 sub_8018A50(u32 unused0, u32 unused1, bool8 r2) +s32 sub_8018A50(u8 * unused0, u8 * unused1, bool8 r2) { struct ListMenuTemplate listMenuTemplate = gUnknown_082F0638; struct WindowTemplate windowTemplate = gUnknown_082F05E0; @@ -635,3 +635,64 @@ s32 sub_8018A50(u32 unused0, u32 unused1, bool8 r2) } return r4; } + +s32 sub_8018B08(u8 * textState, u16 * windowId, bool8 r6, const u8 * str) +{ + struct WindowTemplate windowTemplate; + s8 input; + + switch (*textState) + { + case 0: + StringExpandPlaceholders(gStringVar4, str); + if (r6 == 0) + { + *windowId = AddWindow(&gUnknown_082F05C8); + } + else + { + *windowId = AddWindow(&gUnknown_082F05D0); + } + FillWindowPixelBuffer(*windowId, 0x11); + AddTextPrinterParameterized4(*windowId, 1, 0, 1, 0, 0, gUnknown_082F0728, 0, gStringVar4); + sub_8098858(*windowId, 0x001, 0x0F); + CopyWindowToVram(*windowId, 2); + PutWindowTilemap(*windowId); + (*textState)++; + break; + case 1: + windowTemplate = gUnknown_082F05E8; + if (r6 == 0) + { + windowTemplate.tilemapTop = 9; + } + else + { + windowTemplate.tilemapTop = 15; + } + CreateYesNoMenu(&windowTemplate, 10, 14, 0); + (*textState)++; + break; + case 2: + input = Menu_ProcessInputNoWrapClearOnChoose(); + if (input == -1 || input == 0 || input == 1) + { + *textState = 0; + rbox_fill_rectangle(*windowId); + ClearWindowTilemap(*windowId); + CopyWindowToVram(*windowId, 1); + RemoveWindow(*windowId); + return input; + } + break; + case 0xFF: + *textState = 0; + rbox_fill_rectangle(*windowId); + ClearWindowTilemap(*windowId); + CopyWindowToVram(*windowId, 1); + RemoveWindow(*windowId); + return -1; + } + + return -2; +} From c9f16cb1a89378dce1968d30c966387b1f1210c3 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 31 Mar 2019 11:16:19 -0400 Subject: [PATCH 018/101] WIP sub_8018DAC --- asm/mystery_gift.s | 154 --------------------------------------- include/list_menu.h | 2 +- include/mevent_801BAAC.h | 9 +++ include/strings.h | 2 + src/list_menu.c | 2 +- src/mystery_gift.c | 120 ++++++++++++++++++++++++++++++ 6 files changed, 133 insertions(+), 156 deletions(-) create mode 100644 include/mevent_801BAAC.h diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index 6fec153ca..6fc9c31d5 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,160 +5,6 @@ .text - thumb_func_start sub_8018C4C -sub_8018C4C: @ 8018C4C - push {r4-r6,lr} - sub sp, 0x14 - adds r6, r0, 0 - adds r5, r1, 0 - ldrb r0, [r6] - cmp r0, 0x1 - beq _08018CE8 - cmp r0, 0x1 - bgt _08018C64 - cmp r0, 0 - beq _08018C6C - b _08018D8C -_08018C64: - cmp r0, 0xFF - bne _08018C6A - b _08018D68 -_08018C6A: - b _08018D8C -_08018C6C: - cmp r2, 0 - bne _08018C84 - ldr r0, =gStringVar4 - ldr r1, =gText_WhatToDoWithCards - bl StringExpandPlaceholders - b _08018C8C - .pool -_08018C84: - ldr r0, =gStringVar4 - ldr r1, =gText_WhatToDoWithNews - bl StringExpandPlaceholders -_08018C8C: - ldr r0, =gUnknown_082F05D8 - bl AddWindow - strh r0, [r5] - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldrb r0, [r5] - movs r2, 0 - str r2, [sp] - str r2, [sp, 0x4] - ldr r1, =gUnknown_082F0728 - str r1, [sp, 0x8] - str r2, [sp, 0xC] - ldr r1, =gStringVar4 - str r1, [sp, 0x10] - movs r1, 0x1 - movs r3, 0x1 - bl AddTextPrinterParameterized4 - ldrb r0, [r5] - movs r1, 0x1 - movs r2, 0xF - bl sub_8098858 - ldrb r0, [r5] - movs r1, 0x2 - bl CopyWindowToVram - ldrb r0, [r5] - bl PutWindowTilemap - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - b _08018D8C - .pool -_08018CE8: - cmp r3, 0 - beq _08018D10 - cmp r2, 0 - bne _08018D00 - ldr r0, =gUnknown_082F05F8 - ldr r1, =gUnknown_082F06C8 - b _08018D28 - .pool -_08018D00: - ldr r0, =gUnknown_082F0600 - ldr r1, =gUnknown_082F06F8 - b _08018D28 - .pool -_08018D10: - cmp r2, 0 - bne _08018D24 - ldr r0, =gUnknown_082F05F0 - ldr r1, =gUnknown_082F06B0 - b _08018D28 - .pool -_08018D24: - ldr r0, =gUnknown_082F05F8 - ldr r1, =gUnknown_082F06E0 -_08018D28: - movs r2, 0xE0 - str r2, [sp] - movs r2, 0x1 - movs r3, 0xA - bl DoMysteryGiftListMenu - adds r4, r0, 0 - movs r0, 0x1 - negs r0, r0 - cmp r4, r0 - beq _08018D8C - movs r0, 0 - strb r0, [r6] - ldrb r0, [r5] - bl rbox_fill_rectangle - ldrb r0, [r5] - bl ClearWindowTilemap - ldrb r0, [r5] - movs r1, 0x1 - bl CopyWindowToVram - ldrb r0, [r5] - bl RemoveWindow - adds r0, r4, 0 - b _08018D90 - .pool -_08018D68: - movs r0, 0 - strb r0, [r6] - ldrb r0, [r5] - bl rbox_fill_rectangle - ldrb r0, [r5] - bl ClearWindowTilemap - ldrb r0, [r5] - movs r1, 0x1 - bl CopyWindowToVram - ldrb r0, [r5] - bl RemoveWindow - movs r0, 0x2 - negs r0, r0 - b _08018D90 -_08018D8C: - movs r0, 0x1 - negs r0, r0 -_08018D90: - add sp, 0x14 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_8018C4C - - thumb_func_start sub_8018D98 -sub_8018D98: @ 8018D98 - push {lr} - cmp r0, 0 - beq _08018DA4 - bl sub_801B0CC - b _08018DA8 -_08018DA4: - bl sub_801B27C -_08018DA8: - pop {r1} - bx r1 - thumb_func_end sub_8018D98 - thumb_func_start sub_8018DAC sub_8018DAC: @ 8018DAC push {r4,r5,lr} diff --git a/include/list_menu.h b/include/list_menu.h index a301e5b32..0a54a069a 100644 --- a/include/list_menu.h +++ b/include/list_menu.h @@ -98,7 +98,7 @@ struct CursorStruct extern struct ScrollArrowsTemplate gTempScrollArrowTemplate; extern struct ListMenuTemplate gMultiuseListMenuTemplate; -s32 DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum); +s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum); u8 ListMenuInit(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow); u8 ListMenuInitInRect(struct ListMenuTemplate *listMenuTemplate, struct ListMenuWindowRect *arg1, u16 scrollOffset, u16 selectedRow); s32 ListMenu_ProcessInput(u8 listTaskId); diff --git a/include/mevent_801BAAC.h b/include/mevent_801BAAC.h new file mode 100644 index 000000000..db1bb0571 --- /dev/null +++ b/include/mevent_801BAAC.h @@ -0,0 +1,9 @@ +#ifndef GUARD_MEVENT_801BAAC_H +#define GUARD_MEVENT_801BAAC_H + +bool32 sub_801BAAC(struct MEventBuffer_32E0_Sub * r5, struct MEventBuffer_3430_Sub * r6); +bool32 sub_801C6C8(const struct MEventBuffer_3120_Sub * a0); +s32 sub_801BB74(void); +s32 sub_801C758(void); + +#endif //GUARD_MEVENT_801BAAC_H diff --git a/include/strings.h b/include/strings.h index 2f9a64af1..2ef8411c7 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2626,5 +2626,7 @@ extern const u8 gText_VarietyOfEventsImportedWireless[]; extern const u8 gText_WonderCardsInPossession[]; extern const u8 gText_ReadNewsThatArrived[]; extern const u8 gText_ReturnToTitle[]; +extern const u8 gText_WhatToDoWithCards[]; +extern const u8 gText_WhatToDoWithNews[]; #endif // GUARD_STRINGS_H diff --git a/src/list_menu.c b/src/list_menu.c index 57bcc5c4f..3bcd3073d 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -312,7 +312,7 @@ static void ListMenuDummyTask(u8 taskId) } -s32 DoMysteryGiftListMenu(struct WindowTemplate *windowTemplate, struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum) +s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum) { switch (sMysteryGiftLinkMenu.state) { diff --git a/src/mystery_gift.c b/src/mystery_gift.c index da2a3bcc0..9561fbbeb 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -21,6 +21,8 @@ #include "international_string_util.h" #include "list_menu.h" #include "string_util.h" +#include "mevent.h" +#include "mevent_801BAAC.h" void bgid_upload_textbox_1(u8 bgId); void task_add_00_mystery_gift(void); @@ -696,3 +698,121 @@ s32 sub_8018B08(u8 * textState, u16 * windowId, bool8 r6, const u8 * str) return -2; } + +s32 sub_8018C4C(u8 * textState, u16 * windowId, bool32 r2, bool32 r3) +{ + struct WindowTemplate windowTemplate; + s32 input; + + switch (*textState) + { + case 0: + if (r2 == 0) + { + StringExpandPlaceholders(gStringVar4, gText_WhatToDoWithCards); + } + else + { + StringExpandPlaceholders(gStringVar4, gText_WhatToDoWithNews); + } + *windowId = AddWindow(&gUnknown_082F05D8); + FillWindowPixelBuffer(*windowId, 0x11); + AddTextPrinterParameterized4(*windowId, 1, 0, 1, 0, 0, gUnknown_082F0728, 0, gStringVar4); + sub_8098858(*windowId, 0x001, 0x0F); + CopyWindowToVram(*windowId, 2); + PutWindowTilemap(*windowId); + (*textState)++; + break; + case 1: + windowTemplate = gUnknown_082F05E8; + if (r3) + { + if (r2 == 0) + { + input = DoMysteryGiftListMenu(&gUnknown_082F05F8, &gUnknown_082F06C8, 1, 0x00A, 0xE0); + } + else + { + input = DoMysteryGiftListMenu(&gUnknown_082F0600, &gUnknown_082F06F8, 1, 0x00A, 0xE0); + } + } + else + { + if (r2 == 0) + { + input = DoMysteryGiftListMenu(&gUnknown_082F05F0, &gUnknown_082F06B0, 1, 0x00A, 0xE0); + } + else + { + input = DoMysteryGiftListMenu(&gUnknown_082F05F8, &gUnknown_082F06E0, 1, 0x00A, 0xE0); + } + } + if (input != -1) + { + *textState = 0; + rbox_fill_rectangle(*windowId); + ClearWindowTilemap(*windowId); + CopyWindowToVram(*windowId, 1); + RemoveWindow(*windowId); + return input; + } + break; + case 0xFF: + *textState = 0; + rbox_fill_rectangle(*windowId); + ClearWindowTilemap(*windowId); + CopyWindowToVram(*windowId, 1); + RemoveWindow(*windowId); + return -2; + } + + return -1; +} + +s32 sub_8018D98(bool32 a0) +{ + if (a0 == 0) + { + return sub_801B27C(); + } + else + { + return sub_801B0CC(); + } +} + +/*bool32 sub_8018DAC(u8 * state, bool32 arg1) +{ + switch (*state) + { + case 0: + if (arg1 == 0) + { + sub_801BAAC(sav1_get_mevent_buffer_1(), sav1_get_mevent_buffer_2()); + } + else + { + sub_801C6C8(sub_801B00C()); + } + (*state)++; + case 1: + if (arg1 == 0) + { + if (sub_801BB74() == 0) + { + break; + } + } + else + { + if (sub_801C758() == 0) + { + break; + } + } + *state = 0; + return TRUE; + } + + return FALSE; +}*/ From ebe2dc6bbb09b55143d939640ef92f737b18eeb9 Mon Sep 17 00:00:00 2001 From: Papa Cancer Date: Sun, 31 Mar 2019 17:17:13 +0100 Subject: [PATCH 019/101] Mat Block Nothing more needs to be said --- data/battle_scripts_1.s | 7 +++++++ include/constants/battle.h | 1 + include/constants/battle_move_effects.h | 1 + src/battle_main.c | 4 ++-- src/battle_script_commands.c | 11 +++++++++++ src/data/battle_moves.h | 5 +++-- 6 files changed, 25 insertions(+), 4 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 663ae83d9..aaff6e776 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -345,6 +345,7 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectPartingShot .4byte BattleScript_EffectSpectralThief .4byte BattleScript_EffectVCreate + .4byte BattleScript_EffectMatBlock BattleScript_EffectVCreate: setmoveeffect MOVE_EFFECT_V_CREATE | MOVE_EFFECT_AFFECTS_USER @@ -3148,9 +3149,15 @@ BattleScript_DoGhostCurse:: tryfaintmon BS_ATTACKER, FALSE, NULL goto BattleScript_MoveEnd +BattleScript_EffectMatBlock:: + attackcanceler + jumpifnotfirstturn BattleScript_ButItFailedAtkStringPpReduce + goto BattleScript_ProtectLikeAtkString + BattleScript_EffectProtect:: BattleScript_EffectEndure:: attackcanceler +BattleScript_ProtectLikeAtkString: attackstring ppreduce setprotectlike diff --git a/include/constants/battle.h b/include/constants/battle.h index c42188596..d06e01f75 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -212,6 +212,7 @@ #define SIDE_STATUS_QUICK_GUARD (1 << 18) #define SIDE_STATUS_WIDE_GUARD (1 << 19) #define SIDE_STATUS_CRAFTY_SHIELD (1 << 20) +#define SIDE_STATUS_MAT_BLOCK (1 << 21) // Field affecting statuses. #define STATUS_FIELD_MAGIC_ROOM 0x1 diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 588fe9773..056518935 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -333,5 +333,6 @@ #define EFFECT_PARTING_SHOT 327 #define EFFECT_SPECTRAL_THIEF 328 #define EFFECT_V_CREATE 329 +#define EFFECT_MAT_BLOCK 330 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/src/battle_main.c b/src/battle_main.c index 28d8dc0ee..70f8c065b 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4593,8 +4593,8 @@ static void TurnValuesCleanUp(bool8 var0) gBattleMons[gActiveBattler].status2 &= ~(STATUS2_SUBSTITUTE); } - gSideStatuses[0] &= ~(SIDE_STATUS_QUICK_GUARD | SIDE_STATUS_WIDE_GUARD | SIDE_STATUS_CRAFTY_SHIELD); - gSideStatuses[1] &= ~(SIDE_STATUS_QUICK_GUARD | SIDE_STATUS_WIDE_GUARD | SIDE_STATUS_CRAFTY_SHIELD); + gSideStatuses[0] &= ~(SIDE_STATUS_QUICK_GUARD | SIDE_STATUS_WIDE_GUARD | SIDE_STATUS_CRAFTY_SHIELD | SIDE_STATUS_MAT_BLOCK); + gSideStatuses[1] &= ~(SIDE_STATUS_QUICK_GUARD | SIDE_STATUS_WIDE_GUARD | SIDE_STATUS_CRAFTY_SHIELD | SIDE_STATUS_MAT_BLOCK); gSideTimers[0].followmeTimer = 0; gSideTimers[1].followmeTimer = 0; } diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index adad0eda0..e541acfe6 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -906,6 +906,9 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move) else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_CRAFTY_SHIELD && gBattleMoves[move].power == 0) return TRUE; + else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_MAT_BLOCK + && gBattleMoves[move].power != 0) + return TRUE; else return FALSE; } @@ -2723,6 +2726,7 @@ void SetMoveEffect(bool32 primary, u32 certain) || gSideStatuses[GetBattlerSide(gBattlerTarget)] & SIDE_STATUS_WIDE_GUARD || gSideStatuses[GetBattlerSide(gBattlerTarget)] & SIDE_STATUS_QUICK_GUARD || gSideStatuses[GetBattlerSide(gBattlerTarget)] & SIDE_STATUS_CRAFTY_SHIELD + || gSideStatuses[GetBattlerSide(gBattlerTarget)] & SIDE_STATUS_MAT_BLOCK || gProtectStructs[gBattlerTarget].spikyShielded || gProtectStructs[gBattlerTarget].kingsShielded || gProtectStructs[gBattlerTarget].banefulBunkered) @@ -2731,6 +2735,7 @@ void SetMoveEffect(bool32 primary, u32 certain) gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~(SIDE_STATUS_WIDE_GUARD); gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~(SIDE_STATUS_QUICK_GUARD); gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~(SIDE_STATUS_CRAFTY_SHIELD); + gSideStatuses[GetBattlerSide(gBattlerTarget)] &= ~(SIDE_STATUS_MAT_BLOCK); gProtectStructs[gBattlerTarget].spikyShielded = 0; gProtectStructs[gBattlerTarget].kingsShielded = 0; gProtectStructs[gBattlerTarget].banefulBunkered = 0; @@ -7379,6 +7384,12 @@ static void atk77_setprotectlike(void) gDisableStructs[gBattlerAttacker].protectUses++; fail = FALSE; } + else if (gCurrentMove == MOVE_MAT_BLOCK && !(gSideStatuses[side] & SIDE_STATUS_MAT_BLOCK)) + { + gSideStatuses[side] |= SIDE_STATUS_MAT_BLOCK; + gBattleCommunication[MULTISTRING_CHOOSER] = 3; + fail = FALSE; + } } } diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 89f499c2b..70d03d782 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -7870,16 +7870,17 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_MAT_BLOCK] = { - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_MAT_BLOCK, .power = 0, .type = TYPE_FIGHTING, .accuracy = 0, .pp = 15, .secondaryEffectChance = 0, - .target = MOVE_TARGET_SELECTED, + .target = MOVE_TARGET_USER, .priority = 0, .flags = 0, .split = SPLIT_STATUS, + .argument = TRUE, // Protects the whole side. }, [MOVE_BELCH] = From 148c417c501699e8bc9095f4670fa127c5ca93be Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 31 Mar 2019 12:27:36 -0400 Subject: [PATCH 020/101] Through mevent_save_game --- asm/mystery_gift.s | 193 --------------------------------------- include/mevent_801BAAC.h | 4 + include/strings.h | 6 ++ src/mystery_gift.c | 118 ++++++++++++++++++++++-- 4 files changed, 120 insertions(+), 201 deletions(-) diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index 6fc9c31d5..f4a999bc1 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,199 +5,6 @@ .text - thumb_func_start sub_8018DAC -sub_8018DAC: @ 8018DAC - push {r4,r5,lr} - adds r5, r0, 0 - ldrb r0, [r5] - cmp r0, 0 - beq _08018DBC - cmp r0, 0x1 - beq _08018DE4 - b _08018E00 -_08018DBC: - cmp r1, 0 - bne _08018DD4 - bl sav1_get_mevent_buffer_1 - adds r4, r0, 0 - bl sav1_get_mevent_buffer_2 - adds r1, r0, 0 - adds r0, r4, 0 - bl sub_801BAAC - b _08018DDC -_08018DD4: - bl sub_801B00C - bl sub_801C6C8 -_08018DDC: - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] - b _08018E00 -_08018DE4: - cmp r1, 0 - bne _08018DF2 - bl sub_801BB74 -_08018DEC: - cmp r0, 0 - bne _08018DF8 - b _08018E00 -_08018DF2: - bl sub_801C758 - b _08018DEC -_08018DF8: - movs r0, 0 - strb r0, [r5] - movs r0, 0x1 - b _08018E02 -_08018E00: - movs r0, 0 -_08018E02: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8018DAC - - thumb_func_start sub_8018E08 -sub_8018E08: @ 8018E08 - push {lr} - cmp r0, 0 - bne _08018E14 - bl sub_801B1E8 - b _08018E18 -_08018E14: - bl sub_801B06C -_08018E18: - movs r0, 0x1 - pop {r1} - bx r1 - thumb_func_end sub_8018E08 - - thumb_func_start sub_8018E20 -sub_8018E20: @ 8018E20 - push {lr} - cmp r0, 0 - bne _08018E36 - adds r0, r1, 0 - bl sub_801BDA4 - cmp r0, 0 - beq _08018E40 - bl sub_801BB48 - b _08018E48 -_08018E36: - adds r0, r1, 0 - bl sub_801CA50 - cmp r0, 0 - bne _08018E44 -_08018E40: - movs r0, 0 - b _08018E4A -_08018E44: - bl sub_801C72C -_08018E48: - movs r0, 0x1 -_08018E4A: - pop {r1} - bx r1 - thumb_func_end sub_8018E20 - - thumb_func_start sub_8018E50 -sub_8018E50: @ 8018E50 - push {lr} - cmp r2, 0 - beq _08018E60 - ldr r3, =gText_OkayToDiscardNews - b _08018E62 - .pool -_08018E60: - ldr r3, =gText_IfThrowAwayCardEventWontHappen -_08018E62: - movs r2, 0x1 - bl sub_8018B08 - lsls r0, 24 - asrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8018E50 - - thumb_func_start mevent_message_was_thrown_away -mevent_message_was_thrown_away: @ 8018E74 - push {lr} - cmp r1, 0 - beq _08018E84 - ldr r1, =gText_WonderNewsThrownAway - b _08018E86 - .pool -_08018E84: - ldr r1, =gText_WonderCardThrownAway -_08018E86: - bl mevent_0814257C - pop {r1} - bx r1 - .pool - thumb_func_end mevent_message_was_thrown_away - - thumb_func_start mevent_save_game -mevent_save_game: @ 8018E94 - push {r4,lr} - adds r4, r0, 0 - ldrb r0, [r4] - cmp r0, 0x4 - bhi _08018F04 - lsls r0, 2 - ldr r1, =_08018EAC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08018EAC: - .4byte _08018EC0 - .4byte _08018ECC - .4byte _08018ED4 - .4byte _08018EE0 - .4byte _08018EF8 -_08018EC0: - ldr r0, =gText_DataWillBeSaved - bl sub_8018884 - b _08018EEC - .pool -_08018ECC: - movs r0, 0 - bl TrySavingData - b _08018EEC -_08018ED4: - ldr r0, =gText_SaveCompletedPressA - bl sub_8018884 - b _08018EEC - .pool -_08018EE0: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _08018F04 -_08018EEC: - ldrb r0, [r4] - adds r0, 0x1 - strb r0, [r4] - b _08018F04 - .pool -_08018EF8: - movs r0, 0 - strb r0, [r4] - bl sub_80188DC - movs r0, 0x1 - b _08018F06 -_08018F04: - movs r0, 0 -_08018F06: - pop {r4} - pop {r1} - bx r1 - thumb_func_end mevent_save_game - thumb_func_start mevent_message mevent_message: @ 8018F0C push {r4-r6,lr} diff --git a/include/mevent_801BAAC.h b/include/mevent_801BAAC.h index db1bb0571..d747b389c 100644 --- a/include/mevent_801BAAC.h +++ b/include/mevent_801BAAC.h @@ -5,5 +5,9 @@ bool32 sub_801BAAC(struct MEventBuffer_32E0_Sub * r5, struct MEventBuffer_3430_S bool32 sub_801C6C8(const struct MEventBuffer_3120_Sub * a0); s32 sub_801BB74(void); s32 sub_801C758(void); +s32 sub_801BDA4(bool32 flag); +void sub_801BB48(void); +s32 sub_801CA50(bool32 flag); +void sub_801C72C(void); #endif //GUARD_MEVENT_801BAAC_H diff --git a/include/strings.h b/include/strings.h index 2ef8411c7..36c4e36d9 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2628,5 +2628,11 @@ extern const u8 gText_ReadNewsThatArrived[]; extern const u8 gText_ReturnToTitle[]; extern const u8 gText_WhatToDoWithCards[]; extern const u8 gText_WhatToDoWithNews[]; +extern const u8 gText_IfThrowAwayCardEventWontHappen[]; +extern const u8 gText_OkayToDiscardNews[]; +extern const u8 gText_WonderNewsThrownAway[]; +extern const u8 gText_WonderCardThrownAway[]; +extern const u8 gText_DataWillBeSaved[]; +extern const u8 gText_SaveCompletedPressA[]; #endif // GUARD_STRINGS_H diff --git a/src/mystery_gift.c b/src/mystery_gift.c index 9561fbbeb..206a9e50b 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -23,6 +23,7 @@ #include "string_util.h" #include "mevent.h" #include "mevent_801BAAC.h" +#include "save.h" void bgid_upload_textbox_1(u8 bgId); void task_add_00_mystery_gift(void); @@ -781,8 +782,10 @@ s32 sub_8018D98(bool32 a0) } } -/*bool32 sub_8018DAC(u8 * state, bool32 arg1) +bool32 sub_8018DAC(u8 * state, bool32 arg1) { + s32 v0; + switch (*state) { case 0: @@ -795,24 +798,123 @@ s32 sub_8018D98(bool32 a0) sub_801C6C8(sub_801B00C()); } (*state)++; + break; case 1: if (arg1 == 0) { - if (sub_801BB74() == 0) + v0 = sub_801BB74(); + check: + if (v0 != 0) { - break; + goto done; } + break; } else { - if (sub_801C758() == 0) - { - break; - } + v0 = sub_801C758(); + goto check; } + done: *state = 0; return TRUE; } return FALSE; -}*/ +} + +bool32 sub_8018E08(bool32 arg0) +{ + if (arg0 == 0) + { + sub_801B1E8(); + } + else + { + sub_801B06C(); + } + return TRUE; +} + +bool32 sub_8018E20(bool32 arg0, bool32 arg1) +{ + if (arg0 == 0) + { + if (sub_801BDA4(arg1) != 0) + { + sub_801BB48(); + return TRUE; + } + else + { + return FALSE; + } + } + else + { + if (sub_801CA50(arg1) != 0) + { + sub_801C72C(); + return TRUE; + } + else + { + return FALSE; + } + } +} + +s8 sub_8018E50(u8 * textState, u16 * windowId, bool32 r2) +{ + if (r2 == 0) + { + return sub_8018B08(textState, windowId, TRUE, gText_IfThrowAwayCardEventWontHappen); + } + else + { + return sub_8018B08(textState, windowId, TRUE, gText_OkayToDiscardNews); + } +} + +bool32 mevent_message_was_thrown_away(u8 * textState, bool32 r1) +{ + if (r1 == 0) + { + return mevent_0814257C(textState, gText_WonderCardThrownAway); + } + else + { + return mevent_0814257C(textState, gText_WonderNewsThrownAway); + } +} + +bool32 mevent_save_game(u8 * state) +{ + switch (*state) + { + case 0: + sub_8018884(gText_DataWillBeSaved); + (*state)++; + break; + case 1: + TrySavingData(0); + (*state)++; + break; + case 2: + sub_8018884(gText_SaveCompletedPressA); + (*state)++; + break; + case 3: + if (({gMain.newKeys & (A_BUTTON | B_BUTTON);})) + { + (*state)++; + } + break; + case 4: + *state = 0; + sub_80188DC(); + return TRUE; + } + + return FALSE; +} From 8799a1c791fb063210392eddc8c6ba8f347f6202 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 31 Mar 2019 12:36:48 -0400 Subject: [PATCH 021/101] through mevent_message --- asm/mystery_gift.s | 138 --------------------------------------------- include/strings.h | 16 ++++++ src/mystery_gift.c | 70 +++++++++++++++++++++++ 3 files changed, 86 insertions(+), 138 deletions(-) diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index f4a999bc1..ab25f5dbf 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,144 +5,6 @@ .text - thumb_func_start mevent_message -mevent_message: @ 8018F0C - push {r4-r6,lr} - adds r4, r0, 0 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r2, 24 - lsrs r5, r2, 24 - movs r2, 0 - str r2, [r4] - cmp r3, 0xE - bls _08018F22 - b _08019034 -_08018F22: - lsls r0, r3, 2 - ldr r1, =_08018F30 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08018F30: - .4byte _08018F6C - .4byte _08018F78 - .4byte _08018F84 - .4byte _08018F9C - .4byte _08018FB4 - .4byte _08018FC0 - .4byte _08018FCC - .4byte _08018FD8 - .4byte _08018FE4 - .4byte _08018FF0 - .4byte _08018FFC - .4byte _08019014 - .4byte _08019020 - .4byte _0801902C - .4byte _08019030 -_08018F6C: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_NothingSentOver - b _08019034 - .pool -_08018F78: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_RecordUploadedViaWireless - b _08019034 - .pool -_08018F84: - movs r0, 0x1 - str r0, [r4] - ldr r2, =gText_WonderCardReceivedFrom - cmp r5, 0 - bne _08019034 - ldr r2, =gText_WonderCardReceived - b _08019034 - .pool -_08018F9C: - movs r0, 0x1 - str r0, [r4] - ldr r2, =gText_WonderNewsReceivedFrom - cmp r5, 0 - bne _08019034 - ldr r2, =gText_WonderNewsReceived - b _08019034 - .pool -_08018FB4: - movs r0, 0x1 - str r0, [r4] - ldr r2, =gText_NewStampReceived - b _08019034 - .pool -_08018FC0: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_AlreadyHadCard - b _08019034 - .pool -_08018FCC: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_AlreadyHadStamp - b _08019034 - .pool -_08018FD8: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_AlreadyHadNews - b _08019034 - .pool -_08018FE4: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_NoMoreRoomForStamps - b _08019034 - .pool -_08018FF0: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_CommunicationCanceled - b _08019034 - .pool -_08018FFC: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_CantAcceptNewsFromTrainer - cmp r6, 0 - bne _08019034 - ldr r2, =gText_CantAcceptCardFromTrainer - b _08019034 - .pool -_08019014: - movs r0, 0 - str r0, [r4] - ldr r2, =gText_CommunicationError - b _08019034 - .pool -_08019020: - movs r0, 0x1 - str r0, [r4] - ldr r2, =gText_NewTrainerReceived - b _08019034 - .pool -_0801902C: - movs r0, 0x1 - b _08019032 -_08019030: - movs r0, 0 -_08019032: - str r0, [r4] -_08019034: - adds r0, r2, 0 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end mevent_message - thumb_func_start mevent_08142CE8 mevent_08142CE8: @ 801903C push {r4-r6,lr} diff --git a/include/strings.h b/include/strings.h index 36c4e36d9..4a07d4efb 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2634,5 +2634,21 @@ extern const u8 gText_WonderNewsThrownAway[]; extern const u8 gText_WonderCardThrownAway[]; extern const u8 gText_DataWillBeSaved[]; extern const u8 gText_SaveCompletedPressA[]; +extern const u8 gText_NothingSentOver[]; +extern const u8 gText_RecordUploadedViaWireless[]; +extern const u8 gText_WonderCardReceivedFrom[]; +extern const u8 gText_WonderCardReceived[]; +extern const u8 gText_WonderNewsReceivedFrom[]; +extern const u8 gText_WonderNewsReceived[]; +extern const u8 gText_NewStampReceived[]; +extern const u8 gText_AlreadyHadCard[]; +extern const u8 gText_AlreadyHadStamp[]; +extern const u8 gText_AlreadyHadNews[]; +extern const u8 gText_NoMoreRoomForStamps[]; +extern const u8 gText_CommunicationCanceled[]; +extern const u8 gText_CantAcceptNewsFromTrainer[]; +extern const u8 gText_CantAcceptCardFromTrainer[]; +extern const u8 gText_CommunicationError[]; +extern const u8 gText_NewTrainerReceived[]; #endif // GUARD_STRINGS_H diff --git a/src/mystery_gift.c b/src/mystery_gift.c index 206a9e50b..c8a507355 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -918,3 +918,73 @@ bool32 mevent_save_game(u8 * state) return FALSE; } + +const u8 * mevent_message(u32 * a0, u8 a1, u8 a2, u32 a3) +{ + const u8 * msg = NULL; + *a0 = 0; + + switch (a3) + { + case 0: + *a0 = 0; + msg = gText_NothingSentOver; + break; + case 1: + *a0 = 0; + msg = gText_RecordUploadedViaWireless; + break; + case 2: + *a0 = 1; + msg = a2 == 0 ? gText_WonderCardReceived : gText_WonderCardReceivedFrom; + break; + case 3: + *a0 = 1; + msg = a2 == 0 ? gText_WonderNewsReceived : gText_WonderNewsReceivedFrom; + break; + case 4: + *a0 = 1; + msg = gText_NewStampReceived; + break; + case 5: + *a0 = 0; + msg = gText_AlreadyHadCard; + break; + case 6: + *a0 = 0; + msg = gText_AlreadyHadStamp; + break; + case 7: + *a0 = 0; + msg = gText_AlreadyHadNews; + break; + case 8: + *a0 = 0; + msg = gText_NoMoreRoomForStamps; + break; + case 9: + *a0 = 0; + msg = gText_CommunicationCanceled; + break; + case 10: + *a0 = 0; + msg = a1 == 0 ? gText_CantAcceptCardFromTrainer : gText_CantAcceptNewsFromTrainer; + break; + case 11: + *a0 = 0; + msg = gText_CommunicationError; + break; + case 12: + *a0 = 1; + msg = gText_NewTrainerReceived; + break; + case 13: + *a0 = 1; + break; + case 14: + *a0 = 0; + break; + } + + return msg; +} From 5b361db6b3e4fa6ec2f5a03c2c060c1a6afe5a3f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 31 Mar 2019 12:55:27 -0400 Subject: [PATCH 022/101] through task_add_00_mystery_gift --- asm/mystery_gift.s | 217 --------------------------------------------- include/strings.h | 11 +++ src/mystery_gift.c | 142 +++++++++++++++++++++++++++++ 3 files changed, 153 insertions(+), 217 deletions(-) diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index ab25f5dbf..bf298a4d3 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,223 +5,6 @@ .text - thumb_func_start mevent_08142CE8 -mevent_08142CE8: @ 801903C - push {r4-r6,lr} - adds r6, r0, 0 - adds r0, r1, 0 - adds r5, r2, 0 - ldrb r4, [r6] - cmp r4, 0x1 - beq _0801906E - cmp r4, 0x1 - bgt _08019054 - cmp r4, 0 - beq _0801905A - b _0801909A -_08019054: - cmp r4, 0x2 - beq _08019084 - b _0801909A -_0801905A: - cmp r0, 0 - beq _08019062 - bl sub_8018884 -_08019062: - movs r0, 0xB9 - lsls r0, 1 - bl PlayFanfare - strh r4, [r5] - b _0801907C -_0801906E: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xF0 - bls _0801909A -_0801907C: - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - b _0801909A -_08019084: - bl IsFanfareTaskInactive - lsls r0, 24 - cmp r0, 0 - beq _0801909A - movs r0, 0 - strb r0, [r6] - bl sub_80188DC - movs r0, 0x1 - b _0801909C -_0801909A: - movs r0, 0 -_0801909C: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end mevent_08142CE8 - - thumb_func_start mevent_message_stamp_card_etc_send_status -mevent_message_stamp_card_etc_send_status: @ 80190A4 - push {r4,lr} - adds r3, r0, 0 - ldr r1, =gText_CommunicationError - movs r0, 0 - str r0, [r3] - adds r4, r1, 0 - cmp r2, 0xE - bhi _08019166 - lsls r0, r2, 2 - ldr r1, =_080190C8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080190C8: - .4byte _08019104 - .4byte _0801910C - .4byte _08019114 - .4byte _0801911C - .4byte _08019128 - .4byte _08019130 - .4byte _08019138 - .4byte _08019140 - .4byte _08019148 - .4byte _08019150 - .4byte _08019164 - .4byte _08019158 - .4byte _0801915C - .4byte _0801915C - .4byte _08019164 -_08019104: - ldr r1, =gText_NothingSentOver - b _08019166 - .pool -_0801910C: - ldr r1, =gText_RecordUploadedViaWireless - b _08019166 - .pool -_08019114: - ldr r1, =gText_WonderCardSentTo - b _0801911E - .pool -_0801911C: - ldr r1, =gText_WonderNewsSentTo -_0801911E: - movs r0, 0x1 - str r0, [r3] - b _08019166 - .pool -_08019128: - ldr r1, =gText_StampSentTo - b _08019166 - .pool -_08019130: - ldr r1, =gText_OtherTrainerHasCard - b _08019166 - .pool -_08019138: - ldr r1, =gText_OtherTrainerHasStamp - b _08019166 - .pool -_08019140: - ldr r1, =gText_OtherTrainerHasNews - b _08019166 - .pool -_08019148: - ldr r1, =gText_NoMoreRoomForStamps - b _08019166 - .pool -_08019150: - ldr r1, =gText_OtherTrainerCanceled - b _08019166 - .pool -_08019158: - adds r1, r4, 0 - b _08019166 -_0801915C: - ldr r1, =gText_GiftSentTo - b _08019166 - .pool -_08019164: - ldr r1, =gText_CantSendGiftToTrainer -_08019166: - adds r0, r1, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end mevent_message_stamp_card_etc_send_status - - thumb_func_start sub_8019174 -sub_8019174: @ 8019174 - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - adds r5, r1, 0 - adds r1, r2, 0 - adds r2, r3, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, sp - bl mevent_message_stamp_card_etc_send_status - adds r1, r0, 0 - ldr r0, [sp] - cmp r0, 0 - bne _0801919A - adds r0, r4, 0 - bl mevent_0814257C - b _080191A2 -_0801919A: - adds r0, r4, 0 - adds r2, r5, 0 - bl mevent_08142CE8 -_080191A2: - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8019174 - - thumb_func_start task_add_00_mystery_gift -task_add_00_mystery_gift: @ 80191AC - push {r4,lr} - ldr r0, =task00_mystery_gift - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - ldr r0, =gTasks + 0x8 - adds r4, r0 - movs r0, 0 - strb r0, [r4, 0x8] - strb r0, [r4, 0x9] - strb r0, [r4, 0xA] - strb r0, [r4, 0xB] - strb r0, [r4, 0xC] - strb r0, [r4, 0xD] - movs r1, 0 - strh r0, [r4] - strh r0, [r4, 0x2] - strh r0, [r4, 0x4] - strh r0, [r4, 0x6] - strb r1, [r4, 0xE] - movs r0, 0x40 - bl AllocZeroed - str r0, [r4, 0x10] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end task_add_00_mystery_gift - thumb_func_start task00_mystery_gift task00_mystery_gift: @ 80191F4 push {r4,r5,lr} diff --git a/include/strings.h b/include/strings.h index 4a07d4efb..0e6b2f31c 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2650,5 +2650,16 @@ extern const u8 gText_CantAcceptNewsFromTrainer[]; extern const u8 gText_CantAcceptCardFromTrainer[]; extern const u8 gText_CommunicationError[]; extern const u8 gText_NewTrainerReceived[]; +extern const u8 gText_RecordUploadedViaWireless[]; +extern const u8 gText_WonderCardSentTo[]; +extern const u8 gText_WonderNewsSentTo[]; +extern const u8 gText_StampSentTo[]; +extern const u8 gText_OtherTrainerHasCard[]; +extern const u8 gText_OtherTrainerHasStamp[]; +extern const u8 gText_OtherTrainerHasNews[]; +extern const u8 gText_NoMoreRoomForStamps[]; +extern const u8 gText_OtherTrainerCanceled[]; +extern const u8 gText_GiftSentTo[]; +extern const u8 gText_CantSendGiftToTrainer[]; #endif // GUARD_STRINGS_H diff --git a/src/mystery_gift.c b/src/mystery_gift.c index c8a507355..30aa6f323 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -27,12 +27,34 @@ void bgid_upload_textbox_1(u8 bgId); void task_add_00_mystery_gift(void); +void task00_mystery_gift(u8 taskId); EWRAM_DATA u8 gUnknown_02022C58[2] = {}; const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal"); const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz"); +struct MysteryGiftExtraData +{ + u8 filler_00[0x40]; +}; + +struct MysteryGiftTaskData +{ + u16 unk0; + u16 unk2; + u16 unk4; + u16 unk6; + u8 unk8; + u8 unk9; + u8 unkA; + u8 unkB; + u8 unkC; + u8 unkD; + u8 unkE; + struct MysteryGiftExtraData * unk10; +}; + const struct BgTemplate gUnknown_082F0598[] = { { .bg = 0, @@ -988,3 +1010,123 @@ const u8 * mevent_message(u32 * a0, u8 a1, u8 a2, u32 a3) return msg; } + +bool32 mevent_08142CE8(u8 * state, const u8 * arg1, u16 * arg2) +{ + switch (*state) + { + case 0: + if (arg1 != NULL) + { + sub_8018884(arg1); + } + PlayFanfare(MUS_FANFA4); + *arg2 = 0; + (*state)++; + break; + case 1: + if (++(*arg2) > 0xF0) + { + (*state)++; + } + break; + case 2: + if (IsFanfareTaskInactive()) + { + *state = 0; + sub_80188DC(); + return TRUE; + } + break; + } + return FALSE; +} + +const u8 * mevent_message_stamp_card_etc_send_status(u32 * a0, u8 unused, u32 state) +{ + const u8 * result = gText_CommunicationError; + *a0 = 0; + switch (state) + { + case 0: + result = gText_NothingSentOver; + break; + case 1: + result = gText_RecordUploadedViaWireless; + break; + case 2: + result = gText_WonderCardSentTo; + *a0 = 1; + break; + case 3: + result = gText_WonderNewsSentTo; + *a0 = 1; + break; + case 4: + result = gText_StampSentTo; + break; + case 5: + result = gText_OtherTrainerHasCard; + break; + case 6: + result = gText_OtherTrainerHasStamp; + break; + case 7: + result = gText_OtherTrainerHasNews; + break; + case 8: + result = gText_NoMoreRoomForStamps; + break; + case 9: + result = gText_OtherTrainerCanceled; + break; + case 10: + result = gText_CantSendGiftToTrainer; + break; + case 11: + result = gText_CommunicationError; + break; + case 12: + result = gText_GiftSentTo; + break; + case 13: + result = gText_GiftSentTo; + break; + case 14: + result = gText_CantSendGiftToTrainer; + break; + } + return result; +} + +bool32 sub_8019174(u8 * state_p, u16 * arg1, u8 arg2, u32 state) +{ + u32 flag; + const u8 * str = mevent_message_stamp_card_etc_send_status(&flag, arg2, state); + if (flag) + { + return mevent_08142CE8(state_p, str, arg1); + } + else + { + return mevent_0814257C(state_p, str); + } +} + +void task_add_00_mystery_gift(void) +{ + u8 taskId = CreateTask(task00_mystery_gift, 0); + struct MysteryGiftTaskData * data = (void *)gTasks[taskId].data; + data->unk8 = 0; + data->unk9 = 0; + data->unkA = 0; + data->unkB = 0; + data->unkC = 0; + data->unkD = 0; + data->unk0 = 0; + data->unk2 = 0; + data->unk4 = 0; + data->unk6 = 0; + data->unkE = 0; + data->unk10 = AllocZeroed(sizeof(*data->unk10)); +} From d13563b174119121964c2da62380bce44743b93f Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sun, 31 Mar 2019 14:09:40 -0500 Subject: [PATCH 023/101] Document some faraway_island code --- common_syms/faraway_island.txt | 3 + include/faraway_island.h | 2 +- src/event_object_movement.c | 4 +- src/faraway_island.c | 131 +++++++++++++++++---------------- sym_bss.txt | 9 +-- sym_ewram.txt | 5 +- 6 files changed, 74 insertions(+), 80 deletions(-) create mode 100755 common_syms/faraway_island.txt diff --git a/common_syms/faraway_island.txt b/common_syms/faraway_island.txt new file mode 100755 index 000000000..395c9a82f --- /dev/null +++ b/common_syms/faraway_island.txt @@ -0,0 +1,3 @@ +sPlayerToMewDeltaX +sPlayerToMewDeltaY +sMewDirectionCandidates \ No newline at end of file diff --git a/include/faraway_island.h b/include/faraway_island.h index 89b4bcd08..4946bda8a 100755 --- a/include/faraway_island.h +++ b/include/faraway_island.h @@ -1,7 +1,7 @@ #ifndef GUARD_FARAWAY_ISLAND_H #define GUARD_FARAWAY_ISLAND_H -u32 sub_81D427C(void); +u32 GetMewMoveDirection(void); bool8 sub_81D4A58(struct EventObject*); void UpdateFarawayIslandStepCounter(void); bool8 EventObjectIsFarawayIslandMew(struct EventObject *); diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 30dffd8d7..6a3527bc1 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -4414,8 +4414,8 @@ bool8 CopyablePlayerMovement_GoSpeed0(struct EventObject *eventObject, struct Sp direction = playerDirection; if (EventObjectIsFarawayIslandMew(eventObject)) { - direction = sub_81D427C(); - if (direction == 0) + direction = GetMewMoveDirection(); + if (direction == DIR_NONE) { direction = playerDirection; direction = state_to_direction(gInitialMovementTypeFacingDirections[eventObject->movementType], eventObject->directionSequenceIndex, direction); diff --git a/src/faraway_island.c b/src/faraway_island.c index 1c8dff14e..6a835a02b 100755 --- a/src/faraway_island.c +++ b/src/faraway_island.c @@ -17,12 +17,13 @@ static u8 sub_81D4C9C(struct EventObject*, u8); static u8 sub_81D4C58(struct EventObject*, u8); static u8 sub_81D4CE0(struct EventObject*, u8); static u8 sub_81D4D24(u8); -static bool8 sub_81D4834(s16, s16); +static bool8 CanMewWalkToCoords(s16, s16); -extern u8 gUnknown_0203CF50; -extern s16 gUnknown_030012F8; -extern s16 gUnknown_030012FA; -extern u8 gUnknown_030012FC[4]; +static EWRAM_DATA u8 sUnknown_0203CF50 = 0; + +static s16 sPlayerToMewDeltaX; +static s16 sPlayerToMewDeltaY; +static u8 sMewDirectionCandidates[4]; extern const struct SpritePalette gFieldEffectObjectPaletteInfo1; extern const struct SpriteTemplate *const gFieldEffectObjectTemplatePointers[]; @@ -35,23 +36,23 @@ static const s16 sFarawayIslandRockCoords[4][2] = {20, 20}, }; -static u8 sub_81D4258(void) +static u8 GetMewEventObjectId(void) { u8 eventObjectId; TryGetEventObjectIdByLocalIdAndMap(1, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &eventObjectId); return eventObjectId; } -u32 sub_81D427C(void) +u32 GetMewMoveDirection(void) { u8 i; int skip; - struct EventObject *mew = &gEventObjects[sub_81D4258()]; + struct EventObject *mew = &gEventObjects[GetMewEventObjectId()]; - gUnknown_030012F8 = gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x - mew->currentCoords.x; - gUnknown_030012FA = gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y - mew->currentCoords.y; - for (i = 0; i < ARRAY_COUNT(gUnknown_030012FC); i++) - gUnknown_030012FC[i] = DIR_NONE; + sPlayerToMewDeltaX = gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x - mew->currentCoords.x; + sPlayerToMewDeltaY = gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y - mew->currentCoords.y; + for (i = 0; i < ARRAY_COUNT(sMewDirectionCandidates); i++) + sMewDirectionCandidates[i] = DIR_NONE; if (gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x == gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x && gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y == gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y) @@ -85,33 +86,33 @@ u32 sub_81D427C(void) if (!skip) { - if (gUnknown_030012F8 > 0) + if (sPlayerToMewDeltaX > 0) { if (mew->currentCoords.x + 1 == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x) { - if (sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y)) + if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y)) return DIR_EAST; } } - else if (gUnknown_030012F8 < 0) + else if (sPlayerToMewDeltaX < 0) { if (mew->currentCoords.x - 1 == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x) { - if (sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y)) + if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y)) return DIR_WEST; } } if (mew->currentCoords.x == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.x) { - if (gUnknown_030012FA > 0) + if (sPlayerToMewDeltaY > 0) { - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1)) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1)) return DIR_NORTH; } else { - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1)) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1)) return DIR_SOUTH; } } @@ -134,33 +135,33 @@ u32 sub_81D427C(void) if (!skip) { - if (gUnknown_030012FA > 0) + if (sPlayerToMewDeltaY > 0) { if (mew->currentCoords.y + 1 == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y) { - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1)) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1)) return DIR_SOUTH; } } - else if (gUnknown_030012FA < 0) + else if (sPlayerToMewDeltaY < 0) { if (mew->currentCoords.y - 1 == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y) { - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1)) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1)) return DIR_NORTH; } } if (mew->currentCoords.y == gEventObjects[gPlayerAvatar.eventObjectId].previousCoords.y) { - if (gUnknown_030012F8 > 0) + if (sPlayerToMewDeltaX > 0) { - if (sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y)) + if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y)) return DIR_WEST; } else { - if (sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y)) + if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y)) return DIR_EAST; } } @@ -208,52 +209,52 @@ u32 sub_81D427C(void) return DIR_WEST; } - if (gUnknown_030012FA == 0) + if (sPlayerToMewDeltaY == 0) { if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y > mew->currentCoords.y) { - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1)) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1)) return DIR_NORTH; } if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y < mew->currentCoords.y) { - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1)) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1)) return DIR_SOUTH; } - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1)) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1)) return DIR_NORTH; - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1)) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1)) return DIR_SOUTH; } - if (gUnknown_030012F8 == 0) + if (sPlayerToMewDeltaX == 0) { if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x > mew->currentCoords.x) { - if (sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y)) + if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y)) return DIR_WEST; } if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x < mew->currentCoords.x) { - if (sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y)) + if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y)) return DIR_EAST; } - if (sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y)) + if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y)) return DIR_EAST; - if (sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y)) + if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y)) return DIR_WEST; } return sub_81D4890(DIR_NONE); } -static bool8 sub_81D4834(s16 x, s16 y) +static bool8 CanMewWalkToCoords(s16 x, s16 y) { if (gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x == x && gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y == y) @@ -268,39 +269,39 @@ static u8 sub_81D4890(u8 ignoredDir) { u8 i; u8 count = 0; - struct EventObject *mew = &gEventObjects[sub_81D4258()]; + struct EventObject *mew = &gEventObjects[GetMewEventObjectId()]; - for (i = 0; i < ARRAY_COUNT(gUnknown_030012FC); i++) - gUnknown_030012FC[i] = DIR_NONE; + for (i = 0; i < ARRAY_COUNT(sMewDirectionCandidates); i++) + sMewDirectionCandidates[i] = DIR_NONE; - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1) == TRUE && ignoredDir != DIR_NORTH) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1) == TRUE && ignoredDir != DIR_NORTH) { - gUnknown_030012FC[count] = DIR_NORTH; + sMewDirectionCandidates[count] = DIR_NORTH; count++; } - if (sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y) == TRUE && ignoredDir != DIR_EAST) + if (CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y) == TRUE && ignoredDir != DIR_EAST) { - gUnknown_030012FC[count] = DIR_EAST; + sMewDirectionCandidates[count] = DIR_EAST; count++; } - if (sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1) == TRUE && ignoredDir != DIR_SOUTH) + if (CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1) == TRUE && ignoredDir != DIR_SOUTH) { - gUnknown_030012FC[count] = DIR_SOUTH; + sMewDirectionCandidates[count] = DIR_SOUTH; count++; } - if (sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y) == TRUE && ignoredDir != DIR_WEST) + if (CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y) == TRUE && ignoredDir != DIR_WEST) { - gUnknown_030012FC[count] = DIR_WEST; + sMewDirectionCandidates[count] = DIR_WEST; count++; } if (count > 1) - return gUnknown_030012FC[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % count]; + return sMewDirectionCandidates[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % count]; else - return gUnknown_030012FC[0]; + return sMewDirectionCandidates[0]; } void UpdateFarawayIslandStepCounter(void) @@ -355,7 +356,7 @@ void sub_81D4A90(void) s16 x; s16 y; u8 spriteId; - struct EventObject *mew = &gEventObjects[sub_81D4258()]; + struct EventObject *mew = &gEventObjects[GetMewEventObjectId()]; mew->invisible = 0; if (gSpecialVar_0x8004 == 1) @@ -378,10 +379,10 @@ void sub_81D4A90(void) x = mew->currentCoords.x; y = mew->currentCoords.y; sub_80930E0(&x, &y, 8, 8); - gUnknown_0203CF50 = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[15], x, y, gSprites[mew->spriteId].subpriority - 1); - if (gUnknown_0203CF50 != MAX_SPRITES) + sUnknown_0203CF50 = CreateSpriteAtEnd(gFieldEffectObjectTemplatePointers[15], x, y, gSprites[mew->spriteId].subpriority - 1); + if (sUnknown_0203CF50 != MAX_SPRITES) { - struct Sprite *sprite = &gSprites[gUnknown_0203CF50]; + struct Sprite *sprite = &gSprites[sUnknown_0203CF50]; sprite->coordOffsetEnabled = 1; sprite->oam.priority = 2; sprite->callback = SpriteCallbackDummy; @@ -391,15 +392,15 @@ void sub_81D4A90(void) void sub_81D4BEC(void) { - if (gUnknown_0203CF50 != MAX_SPRITES) - DestroySprite(&gSprites[gUnknown_0203CF50]); + if (sUnknown_0203CF50 != MAX_SPRITES) + DestroySprite(&gSprites[sUnknown_0203CF50]); } static bool8 sub_81D4C14(struct EventObject *mew, u8 index) { - if (gUnknown_030012FA > 0 && sub_81D4834(mew->currentCoords.x, mew->currentCoords.y - 1)) + if (sPlayerToMewDeltaY > 0 && CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y - 1)) { - gUnknown_030012FC[index] = DIR_NORTH; + sMewDirectionCandidates[index] = DIR_NORTH; return TRUE; } @@ -408,9 +409,9 @@ static bool8 sub_81D4C14(struct EventObject *mew, u8 index) static u8 sub_81D4C58(struct EventObject *mew, u8 index) { - if (gUnknown_030012F8 < 0 && sub_81D4834(mew->currentCoords.x + 1, mew->currentCoords.y)) + if (sPlayerToMewDeltaX < 0 && CanMewWalkToCoords(mew->currentCoords.x + 1, mew->currentCoords.y)) { - gUnknown_030012FC[index] = DIR_EAST; + sMewDirectionCandidates[index] = DIR_EAST; return TRUE; } @@ -419,9 +420,9 @@ static u8 sub_81D4C58(struct EventObject *mew, u8 index) static u8 sub_81D4C9C(struct EventObject *mew, u8 index) { - if (gUnknown_030012FA < 0 && sub_81D4834(mew->currentCoords.x, mew->currentCoords.y + 1)) + if (sPlayerToMewDeltaY < 0 && CanMewWalkToCoords(mew->currentCoords.x, mew->currentCoords.y + 1)) { - gUnknown_030012FC[index] = DIR_SOUTH; + sMewDirectionCandidates[index] = DIR_SOUTH; return TRUE; } @@ -430,9 +431,9 @@ static u8 sub_81D4C9C(struct EventObject *mew, u8 index) static u8 sub_81D4CE0(struct EventObject *mew, u8 index) { - if (gUnknown_030012F8 > 0 && sub_81D4834(mew->currentCoords.x - 1, mew->currentCoords.y)) + if (sPlayerToMewDeltaX > 0 && CanMewWalkToCoords(mew->currentCoords.x - 1, mew->currentCoords.y)) { - gUnknown_030012FC[index] = DIR_WEST; + sMewDirectionCandidates[index] = DIR_WEST; return TRUE; } @@ -441,5 +442,5 @@ static u8 sub_81D4CE0(struct EventObject *mew, u8 index) static u8 sub_81D4D24(u8 mod) { - return gUnknown_030012FC[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % mod]; + return sMewDirectionCandidates[VarGet(VAR_FARAWAY_ISLAND_STEP_COUNTER) % mod]; } diff --git a/sym_bss.txt b/sym_bss.txt index 1eef0130b..25ca7c625 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -88,14 +88,7 @@ gUnknown_030012F2: @ 30012F2 gUnknown_030012F4: @ 30012F4 .space 0x4 -gUnknown_030012F8: @ 30012F8 - .space 0x2 - -gUnknown_030012FA: @ 30012FA - .space 0x2 - -gUnknown_030012FC: @ 30012FC - .space 0x4 + .include "src/faraway_island.o" gUnknown_03001300: @ 3001300 .space 0x40 diff --git a/sym_ewram.txt b/sym_ewram.txt index 6878e1bd1..50235ee72 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -214,9 +214,6 @@ gUnknown_0203CF44: @ 203CF44 .space 0x4 .include "src/menu_specialized.o" - -gUnknown_0203CF50: @ 203CF50 - .space 0x4 - + .include "src/faraway_island.o" .include "src/trainer_hill.o" .include "src/rayquaza_scene.o" From 4f12f0ae287afedfd490d959e3902a98aa3dabea Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 31 Mar 2019 15:50:25 -0400 Subject: [PATCH 024/101] fakematching task00_mystery_gift --- asm/mystery_gift.s | 864 ------------------------------------ include/mevent_801BAAC.h | 3 + include/mevent_news.h | 1 + include/mevent_server.h | 8 + include/mevent_server_ish.h | 10 + include/strings.h | 11 + include/union_room.h | 3 + src/mevent_801BAAC.c | 2 +- src/mystery_gift.c | 580 +++++++++++++++++++++++- 9 files changed, 607 insertions(+), 875 deletions(-) create mode 100644 include/mevent_server.h create mode 100644 include/mevent_server_ish.h diff --git a/asm/mystery_gift.s b/asm/mystery_gift.s index bf298a4d3..db75b6f45 100755 --- a/asm/mystery_gift.s +++ b/asm/mystery_gift.s @@ -5,870 +5,6 @@ .text - thumb_func_start task00_mystery_gift -task00_mystery_gift: @ 80191F4 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - ldrb r0, [r5, 0x8] - cmp r0, 0x25 - bls _0801920E - b _08019922 -_0801920E: - lsls r0, 2 - ldr r1, =_08019220 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08019220: - .4byte _080192B8 - .4byte _080192BE - .4byte _08019300 - .4byte _08019338 - .4byte _0801935C - .4byte _080193AC - .4byte _0801940C - .4byte _08019444 - .4byte _08019454 - .4byte _080194CC - .4byte _080194F0 - .4byte _08019508 - .4byte _08019538 - .4byte _08019574 - .4byte _0801958C - .4byte _080195BC - .4byte _080198EC - .4byte _0801961A - .4byte _0801962A - .4byte _08019922 - .4byte _0801963C - .4byte _08019688 - .4byte _080196FE - .4byte _0801972E - .4byte _08019764 - .4byte _0801977E - .4byte _08019792 - .4byte _0801979E - .4byte _080197B2 - .4byte _080197C6 - .4byte _080197F8 - .4byte _0801982C - .4byte _08019870 - .4byte _08019884 - .4byte _080198A0 - .4byte _080198B8 - .4byte _080198EC - .4byte _0801990C -_080192B8: - movs r0, 0x1 - strb r0, [r5, 0x8] - b _08019922 -_080192BE: - adds r0, r5, 0 - adds r0, 0x9 - adds r1, r5, 0 - movs r2, 0 - bl sub_8018A50 - adds r1, r0, 0 - cmp r1, 0x1 - beq _080192E8 - cmp r1, 0x1 - bcc _080192DE - movs r0, 0x2 - negs r0, r0 - cmp r1, r0 - beq _080192FA - b _08019922 -_080192DE: - movs r0, 0 - strb r0, [r5, 0xC] - bl sub_801B27C - b _080192EE -_080192E8: - strb r1, [r5, 0xC] - bl sub_801B0CC -_080192EE: - cmp r0, 0x1 - bne _080192F4 - b _08019820 -_080192F4: - movs r0, 0x2 - strb r0, [r5, 0x8] - b _08019922 -_080192FA: - movs r0, 0x25 - strb r0, [r5, 0x8] - b _08019922 -_08019300: - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _08019314 - adds r0, r5, 0 - adds r0, 0x9 - ldr r1, =gText_DontHaveCardNewOneInput - b _0801931A - .pool -_08019314: - adds r0, r5, 0 - adds r0, 0x9 - ldr r1, =gText_DontHaveNewsNewOneInput -_0801931A: - bl mevent_0814257C - cmp r0, 0 - bne _08019324 - b _08019922 -_08019324: - movs r0, 0x3 - strb r0, [r5, 0x8] - movs r0, 0 - movs r1, 0x1 - bl sub_80186EC - b _08019922 - .pool -_08019338: - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _0801934C - ldr r0, =gText_WhereShouldCardBeAccessed - bl sub_8018884 - b _08019352 - .pool -_0801934C: - ldr r0, =gText_WhereShouldNewsBeAccessed - bl sub_8018884 -_08019352: - movs r0, 0x4 - strb r0, [r5, 0x8] - b _08019922 - .pool -_0801935C: - adds r0, r5, 0 - adds r0, 0x9 - adds r1, r5, 0 - movs r2, 0x1 - bl sub_8018A50 - adds r4, r0, 0 - cmp r4, 0x1 - beq _0801938A - cmp r4, 0x1 - bcc _0801937C - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _08019396 - b _08019922 -_0801937C: - bl sub_80188DC - movs r1, 0 - movs r0, 0x5 - strb r0, [r5, 0x8] - strb r1, [r5, 0xD] - b _08019922 -_0801938A: - bl sub_80188DC - movs r0, 0x5 - strb r0, [r5, 0x8] - strb r4, [r5, 0xD] - b _08019922 -_08019396: - bl sub_80188DC - ldrb r0, [r5, 0xC] - bl sub_8018D98 - cmp r0, 0 - beq _080193A6 - b _08019820 -_080193A6: - strb r0, [r5, 0x8] - movs r0, 0 - b _080198FE -_080193AC: - ldr r0, =gStringVar1 - movs r1, 0xFF - strb r1, [r0] - ldr r0, =gStringVar2 - strb r1, [r0] - ldr r0, =gStringVar3 - strb r1, [r0] - ldrb r0, [r5, 0xC] - cmp r0, 0 - beq _080193D4 - cmp r0, 0x1 - beq _080193EE - b _08019406 - .pool -_080193D4: - ldrb r0, [r5, 0xD] - cmp r0, 0x1 - bne _080193E2 - movs r0, 0x15 - bl sub_8014EFC - b _08019406 -_080193E2: - cmp r0, 0 - bne _08019406 - movs r0, 0x15 - bl sub_80152A8 - b _08019406 -_080193EE: - ldrb r0, [r5, 0xD] - cmp r0, 0x1 - bne _080193FC - movs r0, 0x16 - bl sub_8014EFC - b _08019406 -_080193FC: - cmp r0, 0 - bne _08019406 - movs r0, 0x16 - bl sub_80152A8 -_08019406: - movs r0, 0x6 - strb r0, [r5, 0x8] - b _08019922 -_0801940C: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0801942C - movs r0, 0x1 - bl sub_8018838 - movs r0, 0x7 - strb r0, [r5, 0x8] - ldrb r0, [r5, 0xC] - bl sub_801D484 - b _08019922 - .pool -_0801942C: - ldr r0, =gSpecialVar_Result - ldrh r0, [r0] - cmp r0, 0x5 - beq _08019436 - b _08019922 -_08019436: - movs r0, 0x1 - bl sub_8018838 - b _080197C0 - .pool -_08019444: - ldr r0, =gText_Communicating - bl sub_8018884 - movs r0, 0x8 - strb r0, [r5, 0x8] - b _08019922 - .pool -_08019454: - adds r0, r5, 0 - bl sub_801D4A8 - subs r0, 0x2 - cmp r0, 0x4 - bls _08019462 - b _08019922 -_08019462: - lsls r0, 2 - ldr r1, =_08019470 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08019470: - .4byte _080194AE - .4byte _080194A8 - .4byte _080194B4 - .4byte _08019492 - .4byte _08019484 -_08019484: - bl task_add_05_task_del_08FA224_when_no_RfuFunc - ldrh r0, [r5] - strb r0, [r5, 0xE] - movs r0, 0xD - strb r0, [r5, 0x8] - b _08019922 -_08019492: - ldr r4, [r5, 0x10] - bl sub_801D4F4 - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0x40 - bl memcpy - bl sub_801D4E4 - b _08019922 -_080194A8: - movs r0, 0xA - strb r0, [r5, 0x8] - b _08019922 -_080194AE: - movs r0, 0x9 - strb r0, [r5, 0x8] - b _08019922 -_080194B4: - movs r0, 0xB - strb r0, [r5, 0x8] - ldr r0, =gStringVar1 - ldr r1, =gLinkPlayers + 8 - bl StringCopy - b _08019922 - .pool -_080194CC: - adds r4, r5, 0 - adds r4, 0x9 - bl sub_801D4F4 - adds r3, r0, 0 - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0 - bl sub_8018B08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0x1 - beq _08019564 - cmp r1, 0x1 - bcs _08019552 - movs r0, 0 - b _08019566 -_080194F0: - adds r4, r5, 0 - adds r4, 0x9 - bl sub_801D4F4 - adds r1, r0, 0 - adds r0, r4, 0 - bl mevent_0814257C - cmp r0, 0 - bne _08019506 - b _08019922 -_08019506: - b _0801956A -_08019508: - adds r0, r5, 0 - adds r0, 0x9 - ldr r3, =gText_ThrowAwayWonderCard - adds r1, r5, 0 - movs r2, 0 - bl sub_8018B08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0x1 - beq _08019564 - cmp r1, 0x1 - bcs _08019552 - bl sub_801B3F8 - cmp r0, 0x1 - bne _08019534 - movs r0, 0xC - strb r0, [r5, 0x8] - b _08019922 - .pool -_08019534: - movs r0, 0 - b _08019566 -_08019538: - adds r0, r5, 0 - adds r0, 0x9 - ldr r3, =gText_HaventReceivedCardsGift - adds r1, r5, 0 - movs r2, 0 - bl sub_8018B08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0x1 - beq _08019564 - cmp r1, 0x1 - bcc _08019560 -_08019552: - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _08019564 - b _08019922 - .pool -_08019560: - movs r0, 0 - b _08019566 -_08019564: - movs r0, 0x1 -_08019566: - bl sub_801D500 -_0801956A: - bl sub_801D4E4 - movs r0, 0x7 - strb r0, [r5, 0x8] - b _08019922 -_08019574: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _0801957E - b _08019922 -_0801957E: - bl sub_800E084 - movs r0, 0xE - strb r0, [r5, 0x8] - b _08019922 - .pool -_0801958C: - adds r0, r5, 0 - adds r0, 0x9 - ldr r1, =gText_CommunicationCompleted - bl sub_8018A1C - cmp r0, 0 - bne _0801959C - b _08019922 -_0801959C: - ldrb r0, [r5, 0xD] - cmp r0, 0x1 - bne _080195AA - ldr r0, =gStringVar1 - ldr r1, =gLinkPlayers + 8 - bl StringCopy -_080195AA: - movs r0, 0xF - strb r0, [r5, 0x8] - b _08019922 - .pool -_080195BC: - ldrb r1, [r5, 0xC] - ldrb r2, [r5, 0xD] - ldrb r3, [r5, 0xE] - mov r0, sp - bl mevent_message - adds r1, r0, 0 - cmp r1, 0 - bne _080195D0 - ldr r1, [r5, 0x10] -_080195D0: - ldr r0, [sp] - cmp r0, 0 - beq _080195E2 - adds r0, r5, 0 - adds r0, 0x9 - adds r2, r5, 0 - bl mevent_08142CE8 - b _080195EA -_080195E2: - adds r0, r5, 0 - adds r0, 0x9 - bl mevent_0814257C -_080195EA: - adds r1, r0, 0 - cmp r1, 0 - bne _080195F2 - b _08019922 -_080195F2: - ldrb r0, [r5, 0xE] - cmp r0, 0x3 - bne _0801960C - ldrb r0, [r5, 0xD] - cmp r0, 0x1 - bne _08019606 - movs r0, 0x1 - bl sub_801DB68 - b _0801960C -_08019606: - movs r0, 0x2 - bl sub_801DB68 -_0801960C: - ldr r0, [sp] - cmp r0, 0 - beq _08019614 - b _080198DC -_08019614: - strb r0, [r5, 0x8] - movs r0, 0 - b _080198FE -_0801961A: - adds r0, r5, 0 - adds r0, 0x9 - bl mevent_save_game - cmp r0, 0 - bne _08019628 - b _08019922 -_08019628: - b _08019820 -_0801962A: - adds r0, r5, 0 - adds r0, 0x9 - ldrb r1, [r5, 0xC] - bl sub_8018DAC - cmp r0, 0 - bne _0801963A - b _08019922 -_0801963A: - b _080196F8 -_0801963C: - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _08019664 - ldr r2, =gMain - ldrh r1, [r2, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08019652 - movs r0, 0x15 - strb r0, [r5, 0x8] -_08019652: - ldrh r1, [r2, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - bne _0801965E - b _08019922 -_0801965E: - b _08019682 - .pool -_08019664: - ldr r0, =gMain - ldrh r0, [r0, 0x2E] - bl sub_801CCD0 - cmp r0, 0 - beq _0801967C - cmp r0, 0x1 - beq _08019682 - b _08019922 - .pool -_0801967C: - bl sub_801CC38 - b _0801975E -_08019682: - movs r0, 0x1B - strb r0, [r5, 0x8] - b _08019922 -_08019688: - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _080196A2 - bl sub_801B308 - cmp r0, 0 - beq _080196B6 - adds r0, r5, 0 - adds r0, 0x9 - ldrb r2, [r5, 0xC] - adds r1, r5, 0 - movs r3, 0 - b _080196C0 -_080196A2: - bl sub_801B128 - cmp r0, 0 - beq _080196B6 - adds r0, r5, 0 - adds r0, 0x9 - ldrb r2, [r5, 0xC] - adds r1, r5, 0 - movs r3, 0 - b _080196C0 -_080196B6: - adds r0, r5, 0 - adds r0, 0x9 - ldrb r2, [r5, 0xC] - adds r1, r5, 0 - movs r3, 0x1 -_080196C0: - bl sub_8018C4C - adds r1, r0, 0 - cmp r1, 0x1 - beq _080196E2 - cmp r1, 0x1 - bcc _080196DC - cmp r1, 0x2 - beq _080196E8 - movs r0, 0x2 - negs r0, r0 - cmp r1, r0 - beq _080196EE - b _08019922 -_080196DC: - movs r0, 0x1C - strb r0, [r5, 0x8] - b _08019922 -_080196E2: - movs r0, 0x1D - strb r0, [r5, 0x8] - b _08019922 -_080196E8: - movs r0, 0x16 - strb r0, [r5, 0x8] - b _08019922 -_080196EE: - ldrb r0, [r5, 0xC] - cmp r0, 0x1 - bne _080196F8 - bl sub_801CC80 -_080196F8: - movs r0, 0x14 - strb r0, [r5, 0x8] - b _08019922 -_080196FE: - adds r0, r5, 0 - adds r0, 0x9 - ldrb r2, [r5, 0xC] - adds r1, r5, 0 - bl sub_8018E50 - adds r1, r0, 0 - cmp r1, 0 - beq _0801971A - cmp r1, 0 - ble _08019748 - cmp r1, 0x1 - beq _0801975E - b _08019922 -_0801971A: - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _08019758 - bl sub_801B3F8 - cmp r0, 0x1 - bne _08019758 - movs r0, 0x17 - strb r0, [r5, 0x8] - b _08019922 -_0801972E: - adds r0, r5, 0 - adds r0, 0x9 - ldr r3, =gText_HaventReceivedGiftOkayToDiscard - adds r1, r5, 0 - movs r2, 0x1 - bl sub_8018B08 - lsls r0, 24 - asrs r1, r0, 24 - cmp r1, 0x1 - beq _0801975E - cmp r1, 0x1 - bcc _08019758 -_08019748: - movs r0, 0x1 - negs r0, r0 - cmp r1, r0 - beq _0801975E - b _08019922 - .pool -_08019758: - movs r0, 0x18 - strb r0, [r5, 0x8] - b _08019922 -_0801975E: - movs r0, 0x15 - strb r0, [r5, 0x8] - b _08019922 -_08019764: - ldrb r0, [r5, 0xC] - movs r1, 0x1 - bl sub_8018E20 - cmp r0, 0 - bne _08019772 - b _08019922 -_08019772: - ldrb r0, [r5, 0xC] - bl sub_8018E08 - movs r0, 0x19 - strb r0, [r5, 0x8] - b _08019922 -_0801977E: - adds r0, r5, 0 - adds r0, 0x9 - bl mevent_save_game - cmp r0, 0 - bne _0801978C - b _08019922 -_0801978C: - movs r0, 0x1A - strb r0, [r5, 0x8] - b _08019922 -_08019792: - adds r0, r5, 0 - adds r0, 0x9 - ldrb r1, [r5, 0xC] - bl mevent_message_was_thrown_away - b _080198F6 -_0801979E: - ldrb r0, [r5, 0xC] - movs r1, 0 - bl sub_8018E20 - cmp r0, 0 - bne _080197AC - b _08019922 -_080197AC: - movs r0, 0 - strb r0, [r5, 0x8] - b _08019922 -_080197B2: - ldrb r0, [r5, 0xC] - movs r1, 0x1 - bl sub_8018E20 - cmp r0, 0 - bne _080197C0 - b _08019922 -_080197C0: - movs r0, 0x3 - strb r0, [r5, 0x8] - b _08019922 -_080197C6: - ldrb r0, [r5, 0xC] - movs r1, 0x1 - bl sub_8018E20 - cmp r0, 0 - bne _080197D4 - b _08019922 -_080197D4: - ldrb r0, [r5, 0xC] - cmp r0, 0 - beq _080197E0 - cmp r0, 0x1 - beq _080197E8 - b _080197EE -_080197E0: - movs r0, 0x15 - bl sub_8014A00 - b _080197EE -_080197E8: - movs r0, 0x16 - bl sub_8014A00 -_080197EE: - movs r0, 0x1 - strb r0, [r5, 0xD] - movs r0, 0x1E - strb r0, [r5, 0x8] - b _08019922 -_080197F8: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _08019810 - movs r0, 0x1 - bl sub_8018838 - movs r0, 0x1F - strb r0, [r5, 0x8] - b _08019922 - .pool -_08019810: - ldr r0, =gSpecialVar_Result - ldrh r0, [r0] - cmp r0, 0x5 - beq _0801981A - b _08019922 -_0801981A: - movs r0, 0x1 - bl sub_8018838 -_08019820: - movs r0, 0x12 - strb r0, [r5, 0x8] - b _08019922 - .pool -_0801982C: - ldr r0, =gStringVar1 - movs r1, 0xFF - strb r1, [r0] - ldr r0, =gStringVar2 - strb r1, [r0] - ldr r0, =gStringVar3 - strb r1, [r0] - ldrb r0, [r5, 0xC] - cmp r0, 0 - bne _0801985C - ldr r0, =gText_SendingWonderCard - bl sub_8018884 - bl mevent_srv_new_wcard - b _08019866 - .pool -_0801985C: - ldr r0, =gText_SendingWonderNews - bl sub_8018884 - bl mevent_srv_init_wnews -_08019866: - movs r0, 0x20 - strb r0, [r5, 0x8] - b _08019922 - .pool -_08019870: - adds r0, r5, 0 - bl sub_801D0C4 - cmp r0, 0x3 - bne _08019922 - ldrh r0, [r5] - strb r0, [r5, 0xE] - movs r0, 0x21 - strb r0, [r5, 0x8] - b _08019922 -_08019884: - bl task_add_05_task_del_08FA224_when_no_RfuFunc - ldr r0, =gStringVar1 - ldr r1, =gLinkPlayers + 0x1C + 0x08 @ &gLinkPlayers[1].name - bl StringCopy - movs r0, 0x22 - strb r0, [r5, 0x8] - b _08019922 - .pool -_080198A0: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _08019922 - bl sub_800E084 - movs r0, 0x23 - strb r0, [r5, 0x8] - b _08019922 - .pool -_080198B8: - adds r0, r5, 0 - adds r0, 0x9 - ldrb r2, [r5, 0xD] - ldrb r3, [r5, 0xE] - adds r1, r5, 0 - bl sub_8019174 - cmp r0, 0 - beq _08019922 - ldr r0, [r5, 0xC] - ldr r1, =0x00ffff00 - ands r0, r1 - ldr r1, =0x00030100 - cmp r0, r1 - bne _080198FA - movs r0, 0x3 - bl sub_801DB68 -_080198DC: - movs r0, 0x11 - strb r0, [r5, 0x8] - b _08019922 - .pool -_080198EC: - adds r0, r5, 0 - adds r0, 0x9 - ldr r1, =gText_CommunicationError - bl mevent_0814257C -_080198F6: - cmp r0, 0 - beq _08019922 -_080198FA: - movs r0, 0 - strb r0, [r5, 0x8] -_080198FE: - movs r1, 0 - bl sub_80186EC - b _08019922 - .pool -_0801990C: - bl CloseLink - ldr r0, [r5, 0x10] - bl Free - adds r0, r4, 0 - bl DestroyTask - ldr r0, =sub_80186A4 - bl SetMainCallback2 -_08019922: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end task00_mystery_gift - thumb_func_start sub_8019930 sub_8019930: @ 8019930 ldr r0, =0x000001a9 diff --git a/include/mevent_801BAAC.h b/include/mevent_801BAAC.h index d747b389c..2259d3b6d 100644 --- a/include/mevent_801BAAC.h +++ b/include/mevent_801BAAC.h @@ -9,5 +9,8 @@ s32 sub_801BDA4(bool32 flag); void sub_801BB48(void); s32 sub_801CA50(bool32 flag); void sub_801C72C(void); +u32 sub_801CCD0(u16 input); +void sub_801CC80(void); +void sub_801CC38(void); #endif //GUARD_MEVENT_801BAAC_H diff --git a/include/mevent_news.h b/include/mevent_news.h index 698d7148c..4632edd38 100755 --- a/include/mevent_news.h +++ b/include/mevent_news.h @@ -2,5 +2,6 @@ #define GUARD_MEVENT_NEWS_H void sub_801DBC0(void); +void sub_801DB68(u32 a0); #endif //GUARD_MEVENT_NEWS_H diff --git a/include/mevent_server.h b/include/mevent_server.h new file mode 100644 index 000000000..ca3b7091b --- /dev/null +++ b/include/mevent_server.h @@ -0,0 +1,8 @@ +#ifndef GUARD_MEVENT_SERVER_H +#define GUARD_MEVENT_SERVER_H + +void mevent_srv_new_wcard(); +void mevent_srv_init_wnews(); +u32 sub_801D0C4(u16 * a0); + +#endif //GUARD_MEVENT_SERVER_H diff --git a/include/mevent_server_ish.h b/include/mevent_server_ish.h new file mode 100644 index 000000000..76f5080dc --- /dev/null +++ b/include/mevent_server_ish.h @@ -0,0 +1,10 @@ +#ifndef GUARD_MEVENT_SERVER_ISH_H +#define GUARD_MEVENT_SERVER_ISH_H + +void sub_801D484(u32 arg); +u32 sub_801D4A8(u16 * a0); +void sub_801D4E4(void); +void * sub_801D4F4(void); +void sub_801D500(u32 a0); + +#endif //GUARD_MEVENT_SERVER_ISH_H diff --git a/include/strings.h b/include/strings.h index 0e6b2f31c..1561da26d 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2661,5 +2661,16 @@ extern const u8 gText_NoMoreRoomForStamps[]; extern const u8 gText_OtherTrainerCanceled[]; extern const u8 gText_GiftSentTo[]; extern const u8 gText_CantSendGiftToTrainer[]; +extern const u8 gText_DontHaveCardNewOneInput[]; +extern const u8 gText_DontHaveNewsNewOneInput[]; +extern const u8 gText_WhereShouldCardBeAccessed[]; +extern const u8 gText_WhereShouldNewsBeAccessed[]; +extern const u8 gText_Communicating[]; +extern const u8 gText_ThrowAwayWonderCard[]; +extern const u8 gText_HaventReceivedCardsGift[]; +extern const u8 gText_CommunicationCompleted[]; +extern const u8 gText_HaventReceivedGiftOkayToDiscard[]; +extern const u8 gText_SendingWonderCard[]; +extern const u8 gText_SendingWonderNews[]; #endif // GUARD_STRINGS_H diff --git a/include/union_room.h b/include/union_room.h index 84a7f1f2b..3d60e1432 100644 --- a/include/union_room.h +++ b/include/union_room.h @@ -169,6 +169,9 @@ void var_800D_set_xB(void); bool32 mevent_0814257C(u8 *textState, const u8 *str); void sub_8018884(const u8 *src); void sub_80186A4(void); +void sub_8014EFC(u32 arg0); +void sub_80152A8(u32 arg0); +void sub_8014A00(u32 arg0); extern bool8 gUnknown_02022C60; diff --git a/src/mevent_801BAAC.c b/src/mevent_801BAAC.c index d69ab0495..b9931a682 100644 --- a/src/mevent_801BAAC.c +++ b/src/mevent_801BAAC.c @@ -724,7 +724,7 @@ void sub_801CC80(void) } } -u8 sub_801CCD0(u16 input) +u32 sub_801CCD0(u16 input) { if (gUnknown_02022C78->unk_01C2_0) { diff --git a/src/mystery_gift.c b/src/mystery_gift.c index 30aa6f323..5e000a249 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -24,6 +24,12 @@ #include "mevent.h" #include "mevent_801BAAC.h" #include "save.h" +#include "link.h" +#include "mevent_server_ish.h" +#include "event_data.h" +#include "link_rfu.h" +#include "mevent_news.h" +#include "mevent_server.h" void bgid_upload_textbox_1(u8 bgId); void task_add_00_mystery_gift(void); @@ -34,11 +40,6 @@ EWRAM_DATA u8 gUnknown_02022C58[2] = {}; const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal"); const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz"); -struct MysteryGiftExtraData -{ - u8 filler_00[0x40]; -}; - struct MysteryGiftTaskData { u16 unk0; @@ -52,7 +53,7 @@ struct MysteryGiftTaskData u8 unkC; u8 unkD; u8 unkE; - struct MysteryGiftExtraData * unk10; + u8 * unk10; }; const struct BgTemplate gUnknown_082F0598[] = { @@ -623,7 +624,7 @@ bool32 sub_8018A1C(u8 * counter, const u8 * str) } } -s32 sub_8018A50(u8 * unused0, u8 * unused1, bool8 r2) +u32 sub_8018A50(u8 * unused0, u16 * unused1, bool8 r2) { struct ListMenuTemplate listMenuTemplate = gUnknown_082F0638; struct WindowTemplate windowTemplate = gUnknown_082F05E0; @@ -661,7 +662,7 @@ s32 sub_8018A50(u8 * unused0, u8 * unused1, bool8 r2) return r4; } -s32 sub_8018B08(u8 * textState, u16 * windowId, bool8 r6, const u8 * str) +s8 sub_8018B08(u8 * textState, u16 * windowId, bool8 r6, const u8 * str) { struct WindowTemplate windowTemplate; s8 input; @@ -886,7 +887,7 @@ bool32 sub_8018E20(bool32 arg0, bool32 arg1) } } -s8 sub_8018E50(u8 * textState, u16 * windowId, bool32 r2) +s32 sub_8018E50(u8 * textState, u16 * windowId, bool32 r2) { if (r2 == 0) { @@ -1128,5 +1129,564 @@ void task_add_00_mystery_gift(void) data->unk4 = 0; data->unk6 = 0; data->unkE = 0; - data->unk10 = AllocZeroed(sizeof(*data->unk10)); + data->unk10 = AllocZeroed(0x40); +} + +void task00_mystery_gift(u8 taskId) +{ + struct MysteryGiftTaskData * data = (void *)gTasks[taskId].data; + u32 sp0; + const u8 * r1; + + switch (data->unk8) + { + case 0: + data->unk8 = 1; + break; + case 1: + switch (sub_8018A50(&data->unk9, &data->unk0, FALSE)) + { + case 0: + data->unkC = 0; + if (sub_801B27C() == TRUE) + { + data->unk8 = 18; + } + else + { + data->unk8 = 2; + } + break; + case 1: + data->unkC = 1; + if (sub_801B0CC() == TRUE) + { + data->unk8 = 18; + } + else + { + data->unk8 = 2; + } + break; + case -2u: + data->unk8 = 37; + break; + } + break; + case 2: + { + if (data->unkC == 0) + { + if (mevent_0814257C(&data->unk9, gText_DontHaveCardNewOneInput)) + { + data->unk8 = 3; + sub_80186EC(0, 1); + } + } + else + { + if (mevent_0814257C(&data->unk9, gText_DontHaveNewsNewOneInput)) + { + data->unk8 = 3; + sub_80186EC(0, 1); + } + } + break; + } + case 3: + if (data->unkC == 0) + { + sub_8018884(gText_WhereShouldCardBeAccessed); + } + else + { + sub_8018884(gText_WhereShouldNewsBeAccessed); + } + data->unk8 = 4; + break; + case 4: + switch (sub_8018A50(&data->unk9, &data->unk0, TRUE)) + { + case 0: + sub_80188DC(); + data->unk8 = 5; + data->unkD = 0; + break; + case 1: + sub_80188DC(); + data->unk8 = 5; + data->unkD = 1; + break; + case -2u: + sub_80188DC(); + if (sub_8018D98(data->unkC)) + { + data->unk8 = 18; + } + else + { + data->unk8 = 0; + sub_80186EC(0, 0); + } + break; + } + break; + case 5: + { + register u8 eos asm("r1"); + gStringVar1[0] = (eos = EOS); + gStringVar2[0] = eos; + gStringVar3[0] = eos; + } + switch (data->unkC) + { + case 0: + if (data->unkD == 1) + { + sub_8014EFC(0x15); + } + else if (data->unkD == 0) + { + sub_80152A8(0x15); + } + break; + case 1: + if (data->unkD == 1) + { + sub_8014EFC(0x16); + } + else if (data->unkD == 0) + { + sub_80152A8(0x16); + } + break; + } + data->unk8 = 6; + break; + case 6: + if (gReceivedRemoteLinkPlayers != 0) + { + sub_8018838(TRUE); + data->unk8 = 7; + sub_801D484(data->unkC); + } + else if (gSpecialVar_Result == 5) + { + sub_8018838(TRUE); + data->unk8 = 3; + } + break; + case 7: + sub_8018884(gText_Communicating); + data->unk8 = 8; + break; + case 8: + switch (sub_801D4A8(&data->unk0)) + { + case 6: + task_add_05_task_del_08FA224_when_no_RfuFunc(); + data->unkE = data->unk0; + data->unk8 = 13; + break; + case 5: + memcpy(data->unk10, sub_801D4F4(), 0x40); + sub_801D4E4(); + break; + case 3: + data->unk8 = 10; + break; + case 2: + data->unk8 = 9; + break; + case 4: + data->unk8 = 11; + StringCopy(gStringVar1, gLinkPlayers[0].name); + break; + } + break; + case 9: + switch ((u32)sub_8018B08(&data->unk9, &data->unk0, FALSE, sub_801D4F4())) + { + case 0: + sub_801D500(0); + sub_801D4E4(); + data->unk8 = 7; + break; + case 1: + sub_801D500(1); + sub_801D4E4(); + data->unk8 = 7; + break; + case -1u: + sub_801D500(1); + sub_801D4E4(); + data->unk8 = 7; + break; + } + break; + case 10: + if (mevent_0814257C(&data->unk9, sub_801D4F4())) + { + sub_801D4E4(); + data->unk8 = 7; + } + break; + case 11: + switch ((u32)sub_8018B08(&data->unk9, &data->unk0, FALSE, gText_ThrowAwayWonderCard)) + { + case 0: + if (sub_801B3F8() == TRUE) + { + data->unk8 = 12; + } + else + { + sub_801D500(0); + sub_801D4E4(); + data->unk8 = 7; + } + break; + case 1: + sub_801D500(1); + sub_801D4E4(); + data->unk8 = 7; + break; + case -1u: + sub_801D500(1); + sub_801D4E4(); + data->unk8 = 7; + break; + } + break; + case 12: + switch ((u32)sub_8018B08(&data->unk9, &data->unk0, FALSE, gText_HaventReceivedCardsGift)) + { + case 0: + sub_801D500(0); + sub_801D4E4(); + data->unk8 = 7; + break; + case 1: + sub_801D500(1); + sub_801D4E4(); + data->unk8 = 7; + break; + case -1u: + sub_801D500(1); + sub_801D4E4(); + data->unk8 = 7; + break; + } + break; + case 13: + if (gReceivedRemoteLinkPlayers == 0) + { + sub_800E084(); + data->unk8 = 14; + } + break; + case 14: + if (sub_8018A1C(&data->unk9, gText_CommunicationCompleted)) + { + if (data->unkD == 1) + { + StringCopy(gStringVar1, gLinkPlayers[0].name); + } + data->unk8 = 15; + } + break; + case 15: + { + register bool32 flag asm("r1"); + r1 = mevent_message(&sp0, data->unkC, data->unkD, data->unkE); + if (r1 == NULL) + { + r1 = data->unk10; + } + if (sp0) + { + flag = mevent_08142CE8(&data->unk9, r1, &data->unk0); + } + else + { + flag = mevent_0814257C(&data->unk9, r1); + } + if (flag) + { + if (data->unkE == 3) + { + if (data->unkD == 1) + { + sub_801DB68(1); + } + else + { + sub_801DB68(2); + } + } + if (sp0 == 0) + { + data->unk8 = 0; + sub_80186EC(0, 0); + } + else + { + data->unk8 = 17; + } + } + break; + } + case 16: + if (mevent_0814257C(&data->unk9, gText_CommunicationError)) + { + data->unk8 = 0; + sub_80186EC(0, 0); + } + break; + case 17: + if (mevent_save_game(&data->unk9)) + { + data->unk8 = 18; + } + break; + case 18: + if (sub_8018DAC(&data->unk9, data->unkC)) + { + data->unk8 = 20; + } + break; + case 20: + if (data->unkC == 0) + { + if (({gMain.newKeys & A_BUTTON;})) + { + data->unk8 = 21; + } + if (({gMain.newKeys & B_BUTTON;})) + { + data->unk8 = 27; + } + } + else + { + switch (sub_801CCD0(gMain.newKeys)) + { + case 0: + sub_801CC38(); + data->unk8 = 21; + break; + case 1: + data->unk8 = 27; + break; + } + } + break; + case 21: + { + u32 result; + if (data->unkC == 0) + { + if (sub_801B308()) + { + result = sub_8018C4C(&data->unk9, &data->unk0, data->unkC, FALSE); + } + else + { + result = sub_8018C4C(&data->unk9, &data->unk0, data->unkC, TRUE); + } + } + else + { + if (sub_801B128()) + { + result = sub_8018C4C(&data->unk9, &data->unk0, data->unkC, FALSE); + } + else + { + result = sub_8018C4C(&data->unk9, &data->unk0, data->unkC, TRUE); + } + } + switch (result) + { + case 0: + data->unk8 = 28; + break; + case 1: + data->unk8 = 29; + break; + case 2: + data->unk8 = 22; + break; + case -2u: + if (data->unkC == 1) + { + sub_801CC80(); + } + data->unk8 = 20; + break; + } + break; + } + case 22: + switch (sub_8018E50(&data->unk9, &data->unk0, data->unkC)) + { + case 0: + if (data->unkC == 0 && sub_801B3F8() == TRUE) + { + data->unk8 = 23; + } + else + { + data->unk8 = 24; + } + break; + case 1: + data->unk8 = 21; + break; + case -1: + data->unk8 = 21; + break; + } + break; + case 23: + switch ((u32)sub_8018B08(&data->unk9, &data->unk0, TRUE, gText_HaventReceivedGiftOkayToDiscard)) + { + case 0: + data->unk8 = 24; + break; + case 1: + data->unk8 = 21; + break; + case -1u: + data->unk8 = 21; + break; + } + break; + case 24: + if (sub_8018E20(data->unkC, 1)) + { + sub_8018E08(data->unkC); + data->unk8 = 25; + } + break; + case 25: + if (mevent_save_game(&data->unk9)) + { + data->unk8 = 26; + } + break; + case 26: + if (mevent_message_was_thrown_away(&data->unk9, data->unkC)) + { + data->unk8 = 0; + sub_80186EC(0, 0); + } + break; + case 27: + if (sub_8018E20(data->unkC, 0)) + { + data->unk8 = 0; + } + break; + case 28: + if (sub_8018E20(data->unkC, 1)) + { + data->unk8 = 3; + } + break; + case 29: + if (sub_8018E20(data->unkC, 1)) + { + switch (data->unkC) + { + case 0: + sub_8014A00(21); + break; + case 1: + sub_8014A00(22); + break; + } + data->unkD = 1; + data->unk8 = 30; + } + break; + case 30: + if (gReceivedRemoteLinkPlayers != 0) + { + sub_8018838(1); + data->unk8 = 31; + } + else if (gSpecialVar_Result == 5) + { + sub_8018838(1); + data->unk8 = 18; + } + break; + case 31: + { + register u8 eos asm("r1"); + gStringVar1[0] = (eos = EOS); + gStringVar2[0] = eos; + gStringVar3[0] = eos; + } + if (data->unkC == 0) + { + sub_8018884(gText_SendingWonderCard); + mevent_srv_new_wcard(); + } + else + { + sub_8018884(gText_SendingWonderNews); + mevent_srv_init_wnews(); + } + data->unk8 = 32; + break; + case 32: + if (sub_801D0C4(&data->unk0) == 3) + { + data->unkE = data->unk0; + data->unk8 = 33; + } + break; + case 33: + task_add_05_task_del_08FA224_when_no_RfuFunc(); + StringCopy(gStringVar1, gLinkPlayers[1].name); + data->unk8 = 34; + break; + case 34: + if (gReceivedRemoteLinkPlayers == 0) + { + sub_800E084(); + data->unk8 = 35; + } + break; + case 35: + if (sub_8019174(&data->unk9, &data->unk0, data->unkD, data->unkE)) + { + if (data->unkD == 1 && data->unkE == 3) + { + sub_801DB68(3); + data->unk8 = 17; + } + else + { + data->unk8 = 0; + sub_80186EC(0, 0); + } + } + break; + case 36: + if (mevent_0814257C(&data->unk9, gText_CommunicationError)) + { + data->unk8 = 0; + sub_80186EC(0, 0); + } + break; + case 37: + CloseLink(); + Free(data->unk10); + DestroyTask(taskId); + SetMainCallback2(sub_80186A4); + break; + } } From 5a0142da08a85d80bd3f562fdad9fca2227e180a Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 31 Mar 2019 15:53:38 -0400 Subject: [PATCH 025/101] infer additional file split after task00_mystery_gift --- asm/{mystery_gift.s => union_room_player_avatar.s} | 0 data/{mystery_gift.s => union_room_player_avatar.s} | 0 ld_script.txt | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename asm/{mystery_gift.s => union_room_player_avatar.s} (100%) rename data/{mystery_gift.s => union_room_player_avatar.s} (100%) diff --git a/asm/mystery_gift.s b/asm/union_room_player_avatar.s similarity index 100% rename from asm/mystery_gift.s rename to asm/union_room_player_avatar.s diff --git a/data/mystery_gift.s b/data/union_room_player_avatar.s similarity index 100% rename from data/mystery_gift.s rename to data/union_room_player_avatar.s diff --git a/ld_script.txt b/ld_script.txt index 4f4d0fac5..9bfa273f3 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -56,7 +56,7 @@ SECTIONS { src/link_rfu.o(.text); src/union_room.o(.text); src/mystery_gift.o(.text); - asm/mystery_gift.o(.text); + asm/union_room_player_avatar.o(.text); src/mevent2.o(.text); src/mevent_801BAAC.o(.text); asm/mevent_server.o(.text); @@ -411,7 +411,7 @@ SECTIONS { src/link_rfu.o(.rodata); src/union_room.o(.rodata); src/mystery_gift.o(.rodata); - data/mystery_gift.o(.rodata); + data/union_room_player_avatar.o(.rodata); src/mevent2.o(.rodata); src/mevent_801BAAC.o(.rodata); data/mevent_server.o(.rodata); From ade01833781ee8a8057f2b2945095bababb2e639 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sun, 31 Mar 2019 18:59:52 -0400 Subject: [PATCH 026/101] Document mystery_gift --- asm/dodrio_berry_picking.s | 2 +- asm/mevent_server.s | 8 +- asm/mevent_server_ish.s | 56 +-- asm/pokemon_jump.s | 12 +- asm/pokenav.s | 4 +- asm/union_room_player_avatar.s | 29 +- data/scripts/cable_club.inc | 2 +- data/specials.inc | 2 +- include/ereader_screen.h | 2 +- include/international_string_util.h | 2 +- include/link.h | 2 - include/link_rfu.h | 2 +- include/menu.h | 2 +- include/mevent.h | 18 +- include/mevent_801BAAC.h | 22 +- include/mevent_news.h | 2 +- include/mevent_server.h | 2 +- include/mevent_server_ish.h | 10 +- include/mystery_gift.h | 14 +- include/text_window.h | 4 +- include/union_room.h | 12 +- src/battle_bg.c | 2 +- src/berry_blender.c | 2 +- src/berry_crush.c | 2 +- src/contest_link_80F57C4.c | 2 +- src/easy_chat.c | 2 +- src/ereader_screen.c | 34 +- src/evolution_scene.c | 2 +- src/international_string_util.c | 2 +- src/link_rfu.c | 6 +- src/list_menu.c | 2 +- src/main_menu.c | 3 +- src/menu.c | 2 +- src/mevent2.c | 46 +- src/mevent_801BAAC.c | 380 +++++++------- src/mevent_news.c | 4 +- src/mystery_event_menu.c | 2 +- src/mystery_gift.c | 747 ++++++++++++++-------------- src/pokemon_storage_system.c | 2 +- src/script.c | 2 +- src/script_pokemon_util_80F87D8.c | 2 +- src/start_menu.c | 4 +- src/text_window.c | 4 +- src/trade.c | 10 +- src/union_room.c | 86 ++-- src/union_room_chat.c | 8 +- src/use_pokeblock.c | 6 +- sym_ewram.txt | 16 +- 48 files changed, 785 insertions(+), 804 deletions(-) diff --git a/asm/dodrio_berry_picking.s b/asm/dodrio_berry_picking.s index e52e7a347..505f305b9 100755 --- a/asm/dodrio_berry_picking.s +++ b/asm/dodrio_berry_picking.s @@ -6401,7 +6401,7 @@ sub_8027BEC: @ 8027BEC adds r0, r7, 0 adds r1, r4, 0 movs r2, 0xD - bl sub_8098858 + bl DrawTextBorderOuter adds r0, r7, 0 movs r1, 0x11 bl FillWindowPixelBuffer diff --git a/asm/mevent_server.s b/asm/mevent_server.s index c89867474..8c76e2d0d 100755 --- a/asm/mevent_server.s +++ b/asm/mevent_server.s @@ -39,8 +39,8 @@ mevent_srv_new_wcard: @ 801D0A0 .pool thumb_func_end mevent_srv_new_wcard - thumb_func_start sub_801D0C4 -sub_801D0C4: @ 801D0C4 + thumb_func_start mevent_srv_common_do_exec +mevent_srv_common_do_exec: @ 801D0C4 push {r4-r6,lr} adds r6, r0, 0 ldr r4, =gUnknown_02022C7C @@ -69,7 +69,7 @@ _0801D0F8: pop {r4-r6} pop {r1} bx r1 - thumb_func_end sub_801D0C4 + thumb_func_end mevent_srv_common_do_exec thumb_func_start mevent_srv_init_common mevent_srv_init_common: @ 801D100 @@ -493,7 +493,7 @@ _0801D422: b _0801D464 _0801D43C: ldr r4, [r5, 0x1C] - bl sub_801B00C + bl sav1_get_mevent_buffer_0 adds r1, r0, 0 movs r2, 0xDE lsls r2, 1 diff --git a/asm/mevent_server_ish.s b/asm/mevent_server_ish.s index 0d2db68c2..f61666982 100755 --- a/asm/mevent_server_ish.s +++ b/asm/mevent_server_ish.s @@ -5,11 +5,11 @@ .text - thumb_func_start sub_801D484 -sub_801D484: @ 801D484 + thumb_func_start mevent_srv_ish_do_init +mevent_srv_ish_do_init: @ 801D484 push {r4,r5,lr} adds r5, r0, 0 - ldr r4, =gUnknown_02022C80 + ldr r4, =s_mevent_srv_ish_ptr movs r0, 0x50 bl AllocZeroed str r0, [r4] @@ -22,13 +22,13 @@ sub_801D484: @ 801D484 pop {r0} bx r0 .pool - thumb_func_end sub_801D484 + thumb_func_end mevent_srv_ish_do_init - thumb_func_start sub_801D4A8 -sub_801D4A8: @ 801D4A8 + thumb_func_start mevent_srv_ish_do_exec +mevent_srv_ish_do_exec: @ 801D4A8 push {r4-r6,lr} adds r6, r0, 0 - ldr r4, =gUnknown_02022C80 + ldr r4, =s_mevent_srv_ish_ptr ldr r0, [r4] cmp r0, 0 bne _0801D4BC @@ -43,7 +43,7 @@ _0801D4BC: ldr r0, [r4] ldr r1, [r0, 0x4] strh r1, [r6] - bl sub_801D55C + bl mevent_srv_ish_free_resources ldr r0, [r4] bl Free movs r0, 0 @@ -54,36 +54,36 @@ _0801D4DC: pop {r4-r6} pop {r1} bx r1 - thumb_func_end sub_801D4A8 + thumb_func_end mevent_srv_ish_do_exec - thumb_func_start sub_801D4E4 -sub_801D4E4: @ 801D4E4 - ldr r0, =gUnknown_02022C80 + thumb_func_start mevent_srv_ish_inc_flag +mevent_srv_ish_inc_flag: @ 801D4E4 + ldr r0, =s_mevent_srv_ish_ptr ldr r1, [r0] ldr r0, [r1, 0xC] adds r0, 0x1 str r0, [r1, 0xC] bx lr .pool - thumb_func_end sub_801D4E4 + thumb_func_end mevent_srv_ish_inc_flag - thumb_func_start sub_801D4F4 -sub_801D4F4: @ 801D4F4 - ldr r0, =gUnknown_02022C80 + thumb_func_start mevent_srv_ish_get_buffer +mevent_srv_ish_get_buffer: @ 801D4F4 + ldr r0, =s_mevent_srv_ish_ptr ldr r0, [r0] ldr r0, [r0, 0x20] bx lr .pool - thumb_func_end sub_801D4F4 + thumb_func_end mevent_srv_ish_get_buffer - thumb_func_start sub_801D500 -sub_801D500: @ 801D500 - ldr r1, =gUnknown_02022C80 + thumb_func_start mevent_srv_ish_set_param +mevent_srv_ish_set_param: @ 801D500 + ldr r1, =s_mevent_srv_ish_ptr ldr r1, [r1] str r0, [r1, 0x4] bx lr .pool - thumb_func_end sub_801D500 + thumb_func_end mevent_srv_ish_set_param thumb_func_start mevent_srv_ish_init mevent_srv_ish_init: @ 801D50C @@ -123,8 +123,8 @@ mevent_srv_ish_init: @ 801D50C bx r0 thumb_func_end mevent_srv_ish_init - thumb_func_start sub_801D55C -sub_801D55C: @ 801D55C + thumb_func_start mevent_srv_ish_free_resources +mevent_srv_ish_free_resources: @ 801D55C push {r4,lr} adds r4, r0, 0 ldr r0, [r4, 0x14] @@ -138,10 +138,10 @@ sub_801D55C: @ 801D55C pop {r4} pop {r0} bx r0 - thumb_func_end sub_801D55C + thumb_func_end mevent_srv_ish_free_resources - thumb_func_start sub_801D580 -sub_801D580: @ 801D580 + thumb_func_start mevent_srv_ish_jmp_buffer +mevent_srv_ish_jmp_buffer: @ 801D580 push {r4,lr} adds r4, r0, 0 ldr r0, [r4, 0x1C] @@ -154,7 +154,7 @@ sub_801D580: @ 801D580 pop {r4} pop {r0} bx r0 - thumb_func_end sub_801D580 + thumb_func_end mevent_srv_ish_jmp_buffer thumb_func_start sub_801D59C sub_801D59C: @ 801D59C @@ -340,7 +340,7 @@ _0801D708: bne _0801D804 _0801D70E: adds r0, r4, 0 - bl sub_801D580 + bl mevent_srv_ish_jmp_buffer b _0801D804 _0801D716: ldr r0, [r4, 0x20] diff --git a/asm/pokemon_jump.s b/asm/pokemon_jump.s index 19d6622a3..e9aa9089d 100755 --- a/asm/pokemon_jump.s +++ b/asm/pokemon_jump.s @@ -5491,7 +5491,7 @@ _0802D4A4: ldrb r0, [r0, 0x12] movs r1, 0x1 movs r2, 0xE - bl sub_8098858 + bl DrawTextBorderOuter movs r0, 0x17 movs r1, 0x7 movs r2, 0 @@ -5575,7 +5575,7 @@ _0802D550: ldrb r0, [r0, 0x12] movs r1, 0x1 movs r2, 0xE - bl sub_8098858 + bl DrawTextBorderOuter movs r0, 0 bl CopyBgTilemapBufferToVram _0802D574: @@ -5693,7 +5693,7 @@ _0802D640: ldrb r0, [r0, 0x12] movs r1, 0x1 movs r2, 0xE - bl sub_8098858 + bl DrawTextBorderOuter movs r0, 0 bl CopyBgTilemapBufferToVram _0802D664: @@ -5773,7 +5773,7 @@ _0802D6E4: ldrb r0, [r0, 0x12] movs r1, 0x1 movs r2, 0xE - bl sub_8098858 + bl DrawTextBorderOuter movs r0, 0 bl CopyBgTilemapBufferToVram _0802D708: @@ -6107,7 +6107,7 @@ _0802D99A: ldrb r0, [r0, 0x12] movs r1, 0x1 movs r2, 0xE - bl sub_8098858 + bl DrawTextBorderOuter movs r0, 0 bl CopyBgTilemapBufferToVram ldr r1, [r4] @@ -7596,7 +7596,7 @@ sub_802E500: @ 802E500 adds r0, r4, 0 adds r1, r5, 0 movs r2, 0xD - bl sub_8098858 + bl DrawTextBorderOuter adds r0, r4, 0 movs r1, 0x11 bl FillWindowPixelBuffer diff --git a/asm/pokenav.s b/asm/pokenav.s index f575c9aa8..8b082c2ae 100644 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -8104,7 +8104,7 @@ sub_81CC09C: @ 81CC09C ldrb r0, [r4, 0x14] movs r1, 0x1 movs r2, 0x4 - bl sub_8098858 + bl DrawTextBorderOuter ldrb r0, [r4, 0x14] movs r1, 0x11 bl FillWindowPixelBuffer @@ -9354,7 +9354,7 @@ sub_81CCA1C: @ 81CCA1C ldrb r0, [r5, 0x8] movs r1, 0x42 movs r2, 0x4 - bl sub_8098858 + bl DrawTextBorderOuter ldr r1, =gUnknown_08622888 str r4, [sp] movs r0, 0x1 diff --git a/asm/union_room_player_avatar.s b/asm/union_room_player_avatar.s index db75b6f45..aa9fa5e85 100755 --- a/asm/union_room_player_avatar.s +++ b/asm/union_room_player_avatar.s @@ -5,31 +5,6 @@ .text - thumb_func_start sub_8019930 -sub_8019930: @ 8019930 - ldr r0, =0x000001a9 - bx lr - .pool - thumb_func_end sub_8019930 - - thumb_func_start bgid_upload_textbox_1 -bgid_upload_textbox_1: @ 8019938 - push {lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnkTextboxBorderGfx - movs r2, 0x80 - lsls r2, 1 - movs r3, 0 - str r3, [sp] - bl DecompressAndLoadBgGfxUsingHeap - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end bgid_upload_textbox_1 - thumb_func_start is_walking_or_running is_walking_or_running: @ 8019958 push {lr} @@ -1550,7 +1525,7 @@ sub_801A43C: @ 801A43C movs r2, 0x20 bl LoadPalette movs r0, 0xF0 - bl sub_81978B0 + bl Menu_LoadStdPalAt bl DynamicPlaceholderTextUtil_Reset movs r0, 0x20 str r0, [sp] @@ -2393,7 +2368,7 @@ _0801ABF4: movs r0, 0 movs r1, 0x1 movs r2, 0xD - bl sub_8098858 + bl DrawTextBorderOuter str r5, [sp] movs r0, 0 adds r1, r6, 0 diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc index 1914fee4f..e0b289899 100644 --- a/data/scripts/cable_club.inc +++ b/data/scripts/cable_club.inc @@ -22,7 +22,7 @@ OldaleTown_PokemonCenter_2F_EventScript_276AD5:: @ 8276AD5 specialvar VAR_RESULT, sub_813B514 compare VAR_RESULT, 1 goto_if_eq OldaleTown_PokemonCenter_2F_EventScript_276AFB - specialvar VAR_RESULT, sub_801B27C + specialvar VAR_RESULT, ValidateReceivedWonderCard compare VAR_RESULT, 0 goto_if_eq OldaleTown_PokemonCenter_2F_EventScript_276AFF goto OldaleTown_PokemonCenter_2F_EventScript_276AFB diff --git a/data/specials.inc b/data/specials.inc index 5a812cffa..e45d60e29 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -434,7 +434,7 @@ gSpecials:: @ 81DBA64 def_special sub_81B8958 def_special sub_8018090 def_special sub_813990C - def_special sub_801B27C + def_special ValidateReceivedWonderCard def_special HasAtLeastOneBerry def_special sub_802C920 def_special sub_802E3C4 diff --git a/include/ereader_screen.h b/include/ereader_screen.h index 0e3e51c76..1daea4be0 100755 --- a/include/ereader_screen.h +++ b/include/ereader_screen.h @@ -1,6 +1,6 @@ #ifndef GUARD_EREADER_SCREEN_H #define GUARD_EREADER_SCREEN_H -void sub_81D5014(void); +void task_add_00_ereader(void); #endif // GUARD_EREADER_SCREEN_H diff --git a/include/international_string_util.h b/include/international_string_util.h index 2d5b1c871..911cd6935 100644 --- a/include/international_string_util.h +++ b/include/international_string_util.h @@ -12,7 +12,7 @@ int GetStringCenterAlignXOffsetWithLetterSpacing(int fontId, const u8 *str, int int GetStringWidthDifference(int fontId, const u8 *str, int totalWidth, int letterSpacing); int GetMaxWidthInMenuTable(const struct MenuAction *str, int arg1); int sub_81DB3D8(const struct MenuAction *str, const u8* arg1, int arg2); -int sub_81DB41C(const struct ListMenuTemplate *listMenu); +int Intl_GetListMenuWidth(const struct ListMenuTemplate *listMenu); void CopyMonCategoryText(int dexNum, u8 *dest); u8 *sub_81DB494(u8 *str, int fontId, u8 *str2, int totalStringWidth); void PadNameString(u8 *dest, u8 padChar); diff --git a/include/link.h b/include/link.h index 719b0f067..62ae7761c 100644 --- a/include/link.h +++ b/include/link.h @@ -200,8 +200,6 @@ extern bool8 gLinkVSyncDisabled; extern u32 gLinkStatus; -void c2_mystery_gift(void); -void sub_801867C(void); bool8 IsWirelessAdapterConnected(void); void Task_DestroySelf(u8 taskId); void OpenLink(void); diff --git a/include/link_rfu.h b/include/link_rfu.h index d8f374ff9..b8ba1a927 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -260,7 +260,7 @@ u32 sub_8010714(u16 a0, const u8 *a1); void sub_8011DC0(const u8 *a0, u16 a1); bool8 sub_800EF1C(void); bool32 sub_800EF58(bool32 a0); -void sub_800E084(void); +void DestroyWirelessStatusIndicatorSprite(void); void sub_801103C(void); void sub_8011C5C(void); void sub_80106D4(void); diff --git a/include/menu.h b/include/menu.h index b4c3cb2b5..4f3c4a3cc 100644 --- a/include/menu.h +++ b/include/menu.h @@ -35,7 +35,7 @@ void SetStandardWindowBorderStyle(u8 windowId, bool8 copyToVram); void DisplayYesNoMenuDefaultYes(void); u32 GetPlayerTextSpeed(void); u8 GetPlayerTextSpeedDelay(void); -void sub_81978B0(u16 arg0); +void Menu_LoadStdPalAt(u16 arg0); void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextPrinterTemplate *, u16)); void sub_8199DF0(u32 bg, u8 a1, int a2, int a3); void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 speed, const u8 *str); diff --git a/include/mevent.h b/include/mevent.h index 7f12f3501..9c5d559bf 100755 --- a/include/mevent.h +++ b/include/mevent.h @@ -32,23 +32,23 @@ struct MEventStruct_Unk1442CC }; void sub_801AFD8(void); -struct MEventBuffer_3120_Sub *sub_801B00C(void); +struct MEventBuffer_3120_Sub *sav1_get_mevent_buffer_0(void); struct MEventBuffer_32E0_Sub *sav1_get_mevent_buffer_1(void); struct MEventBuffer_3430_Sub *sav1_get_mevent_buffer_2(void); struct MysteryEventStruct *sub_801B044(void); u16 *sub_801B058(void); -void sub_801B06C(void); +void DestroyWonderNews(void); bool32 sub_801B078(const struct MEventBuffer_3120_Sub *src); -bool32 sub_801B0CC(void); -bool32 sub_801B128(void); +bool32 ValidateReceivedWonderNews(void); +bool32 WonderNews_Test_Unk_02(void); bool32 sub_801B1A4(const u8 *src); -void sub_801B1E8(void); +void DestroyWonderCard(void); bool32 sub_801B21C(const struct MEventBuffer_32E0_Sub *data); -bool32 sub_801B27C(void); -bool32 sub_801B308(void); -u16 sub_801B39C(void); +bool32 ValidateReceivedWonderCard(void); +bool32 WonderCard_Test_Unk_08_6(void); +u16 GetWonderCardFlagID(void); void sub_801B3C0(struct MEventBuffer_32E0_Sub *buffer); -bool32 sub_801B3F8(void); +bool32 CheckReceivedGiftFromWonderCard(void); bool32 sub_801B508(const u16 *data); void sub_801B580(struct MEventStruct_Unk1442CC *data, bool32 a1); bool32 sub_801B6A0(const struct MEventStruct_Unk1442CC *data, bool32 a1); diff --git a/include/mevent_801BAAC.h b/include/mevent_801BAAC.h index 2259d3b6d..547d5237b 100644 --- a/include/mevent_801BAAC.h +++ b/include/mevent_801BAAC.h @@ -1,16 +1,16 @@ #ifndef GUARD_MEVENT_801BAAC_H #define GUARD_MEVENT_801BAAC_H -bool32 sub_801BAAC(struct MEventBuffer_32E0_Sub * r5, struct MEventBuffer_3430_Sub * r6); -bool32 sub_801C6C8(const struct MEventBuffer_3120_Sub * a0); -s32 sub_801BB74(void); -s32 sub_801C758(void); -s32 sub_801BDA4(bool32 flag); -void sub_801BB48(void); -s32 sub_801CA50(bool32 flag); -void sub_801C72C(void); -u32 sub_801CCD0(u16 input); -void sub_801CC80(void); -void sub_801CC38(void); +bool32 InitWonderCardResources(struct MEventBuffer_32E0_Sub * r5, struct MEventBuffer_3430_Sub * r6); +bool32 InitWonderNewsResources(const struct MEventBuffer_3120_Sub * a0); +s32 FadeToWonderCardMenu(void); +s32 FadeToWonderNewsMenu(void); +s32 FadeOutFromWonderCard(bool32 flag); +void DestroyWonderCardResources(void); +s32 FadeOutFromWonderNews(bool32 flag); +void DestroyWonderNewsResources(void); +u32 MENews_GetInput(u16 input); +void MENews_AddScrollIndicatorArrowPair(void); +void MENews_RemoveScrollIndicatorArrowPair(void); #endif //GUARD_MEVENT_801BAAC_H diff --git a/include/mevent_news.h b/include/mevent_news.h index 4632edd38..5fa009499 100755 --- a/include/mevent_news.h +++ b/include/mevent_news.h @@ -2,6 +2,6 @@ #define GUARD_MEVENT_NEWS_H void sub_801DBC0(void); -void sub_801DB68(u32 a0); +void GenerateRandomNews(u32 a0); #endif //GUARD_MEVENT_NEWS_H diff --git a/include/mevent_server.h b/include/mevent_server.h index ca3b7091b..d7657b270 100644 --- a/include/mevent_server.h +++ b/include/mevent_server.h @@ -3,6 +3,6 @@ void mevent_srv_new_wcard(); void mevent_srv_init_wnews(); -u32 sub_801D0C4(u16 * a0); +u32 mevent_srv_common_do_exec(u16 * a0); #endif //GUARD_MEVENT_SERVER_H diff --git a/include/mevent_server_ish.h b/include/mevent_server_ish.h index 76f5080dc..31f98ed52 100644 --- a/include/mevent_server_ish.h +++ b/include/mevent_server_ish.h @@ -1,10 +1,10 @@ #ifndef GUARD_MEVENT_SERVER_ISH_H #define GUARD_MEVENT_SERVER_ISH_H -void sub_801D484(u32 arg); -u32 sub_801D4A8(u16 * a0); -void sub_801D4E4(void); -void * sub_801D4F4(void); -void sub_801D500(u32 a0); +void mevent_srv_ish_do_init(u32 arg); +u32 mevent_srv_ish_do_exec(u16 * a0); +void mevent_srv_ish_inc_flag(void); +void * mevent_srv_ish_get_buffer(void); +void mevent_srv_ish_set_param(u32 a0); #endif //GUARD_MEVENT_SERVER_ISH_H diff --git a/include/mystery_gift.h b/include/mystery_gift.h index b43fbe9a9..243895a67 100644 --- a/include/mystery_gift.h +++ b/include/mystery_gift.h @@ -1,8 +1,16 @@ #ifndef GUARD_MYSTERY_GIFT_H #define GUARD_MYSTERY_GIFT_H -void sub_8018438(void); -void sub_80186EC(bool8 isJapanese, bool32 usePickOkCancel); -void sub_8018798(u32 bg); +extern bool8 gGiftIsFromEReader; + +u16 GetMysteryGiftBaseBlock(void); +void c2_mystery_gift_e_reader_run(void); +void PrintMysteryGiftOrEReaderTopMenu(bool8 isJapanese, bool32 usePickOkCancel); +void MG_DrawCheckerboardPattern(u32 bg); +void MainCB_FreeAllBuffersAndReturnToInitTitleScreen(void); +bool32 MG_PrintTextOnWindow1AndWaitButton(u8 *textState, const u8 *str); +void AddTextPrinterToWindow1(const u8 *src); +void c2_ereader(void); +void c2_mystery_gift(void); #endif //GUARD_MYSTERY_GIFT_H diff --git a/include/text_window.h b/include/text_window.h index 53a6df2e9..501597aa2 100644 --- a/include/text_window.h +++ b/include/text_window.h @@ -17,8 +17,8 @@ void LoadMessageBoxGfx(u8 windowId, u16 destOffset, u8 palOffset); void LoadUserWindowBorderGfx(u8 windowId, u16 destOffset, u8 palOffset); void LoadWindowGfx(u8 windowId, u8 frameId, u16 destOffset, u8 palOffset); void LoadUserWindowBorderGfx_(u8 windowId, u16 destOffset, u8 palOffset); -void sub_8098858(u8 windowId, u16 tileNum, u8 palNum); -void sub_80989E0(u8 windowId, u16 tileNum, u8 palNum); +void DrawTextBorderOuter(u8 windowId, u16 tileNum, u8 palNum); +void DrawTextBorderInner(u8 windowId, u16 tileNum, u8 palNum); void rbox_fill_rectangle(u8 windowId); const u16 *stdpal_get(u8 id); const u16 *GetOverworldTextboxPalettePtr(void); diff --git a/include/union_room.h b/include/union_room.h index 3d60e1432..ca3c87ab1 100644 --- a/include/union_room.h +++ b/include/union_room.h @@ -165,14 +165,8 @@ u8 sub_8013F78(void); bool32 sub_802C908(u16); void nullsub_89(u8 taskId); void var_800D_set_xB(void); - -bool32 mevent_0814257C(u8 *textState, const u8 *str); -void sub_8018884(const u8 *src); -void sub_80186A4(void); -void sub_8014EFC(u32 arg0); -void sub_80152A8(u32 arg0); -void sub_8014A00(u32 arg0); - -extern bool8 gUnknown_02022C60; +void MEvent_CreateTask_CardOrNewsWithFriend(u32 arg0); +void MEvent_CreateTask_CardOrNewsOverWireless(u32 arg0); +void MEvent_CreateTask_Leader(u32 arg0); #endif //GUARD_UNION_ROOM_H diff --git a/src/battle_bg.c b/src/battle_bg.c index 524f73abf..814e8dad9 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -709,7 +709,7 @@ void LoadBattleMenuWindowGfx(void) if (gBattleTypeFlags & BATTLE_TYPE_ARENA) { - sub_81978B0(0x70); + Menu_LoadStdPalAt(0x70); LoadMessageBoxGfx(0, 0x30, 0x70); gPlttBufferUnfaded[0x76] = 0; CpuCopy16(&gPlttBufferUnfaded[0x76], &gPlttBufferFaded[0x76], 2); diff --git a/src/berry_blender.c b/src/berry_blender.c index c792b9b40..26327a634 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -940,7 +940,7 @@ static void InitBerryBlenderWindows(void) FillWindowPixelBuffer(i, PIXEL_FILL(0)); FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14); - sub_81978B0(0xE0); + Menu_LoadStdPalAt(0xE0); } } diff --git a/src/berry_crush.c b/src/berry_crush.c index dc4c546b0..51dbe8203 100755 --- a/src/berry_crush.c +++ b/src/berry_crush.c @@ -582,7 +582,7 @@ int sub_802130C(void) ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); break; case 6: - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); sub_8022960(var0); sub_8034CC8(); break; diff --git a/src/contest_link_80F57C4.c b/src/contest_link_80F57C4.c index a4b88c074..59f41d72a 100644 --- a/src/contest_link_80F57C4.c +++ b/src/contest_link_80F57C4.c @@ -778,7 +778,7 @@ static void sub_80F677C(u8 taskId) if (!gReceivedRemoteLinkPlayers) { if (gIsLinkContest & 0x2) - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); sub_80F7144(); gTasks[taskId].func = sub_80F67C4; diff --git a/src/easy_chat.c b/src/easy_chat.c index 2e384de6e..1cb7b0fe8 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -3721,7 +3721,7 @@ static void sub_811D0BC(void) { FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17); LoadUserWindowBorderGfx(1, 1, 0xE0); - sub_8098858(1, 1, 14); + DrawTextBorderOuter(1, 1, 14); sub_811D104(0); PutWindowTilemap(1); CopyBgTilemapBufferToVram(0); diff --git a/src/ereader_screen.c b/src/ereader_screen.c index 10a23e251..bac29cd42 100755 --- a/src/ereader_screen.c +++ b/src/ereader_screen.c @@ -4,7 +4,7 @@ #include "ereader_helpers.h" #include "link.h" #include "main.h" -#include "union_room.h" +#include "mystery_gift.h" #include "save.h" #include "sound.h" #include "sprite.h" @@ -209,7 +209,7 @@ static u32 sub_81D4EE4(u8 *arg0, u16 *arg1) return 0; } -void sub_81D5014(void) +void task_add_00_ereader(void) { int value; struct Unk81D5014 *data; @@ -251,7 +251,7 @@ static void sub_81D5084(u8 taskId) switch (data->unk8) { case 0: - if (mevent_0814257C(&data->unk9, gUnknown_085EDFD6)) + if (MG_PrintTextOnWindow1AndWaitButton(&data->unk9, gUnknown_085EDFD6)) data->unk8 = 1; break; case 1: @@ -275,9 +275,9 @@ static void sub_81D5084(u8 taskId) } break; case 4: - if (mevent_0814257C(&data->unk9, gUnknown_085EDFF5)) + if (MG_PrintTextOnWindow1AndWaitButton(&data->unk9, gUnknown_085EDFF5)) { - sub_8018884(gUnknown_085EE014); + AddTextPrinterToWindow1(gUnknown_085EE014); sub_81D505C(&data->unk0); data->unk8 = 5; } @@ -324,11 +324,11 @@ static void sub_81D5084(u8 taskId) } break; case 7: - if (mevent_0814257C(&data->unk9, gUnknown_085EE05C)) + if (MG_PrintTextOnWindow1AndWaitButton(&data->unk9, gUnknown_085EE05C)) data->unk8 = 4; break; case 8: - sub_8018884(gUnknown_085EE097); + AddTextPrinterToWindow1(gUnknown_085EE097); // XXX: This (u32*) cast is discarding the const qualifier from gUnknown_089A3470 sub_81D4D50(&gUnknown_03006370, gMultiBootProgram_BerryGlitchFix_Start - gUnknown_089A3470, (u32*)gUnknown_089A3470); data->unk8 = 9; @@ -347,7 +347,7 @@ static void sub_81D5084(u8 taskId) else if (data->unkE == 1) { sub_81D505C(&data->unk0); - sub_8018884(gUnknown_085EE120); + AddTextPrinterToWindow1(gUnknown_085EE120); data->unk8 = 11; } else @@ -361,7 +361,7 @@ static void sub_81D5084(u8 taskId) break; case 12: sub_81D4E30(); - sub_8018884(gUnknown_085EE0DC); + AddTextPrinterToWindow1(gUnknown_085EE0DC); data->unk8 = 13; break; case 13: @@ -370,7 +370,7 @@ static void sub_81D5084(u8 taskId) case 0: break; case 2: - sub_8018884(gUnknown_085EE097); + AddTextPrinterToWindow1(gUnknown_085EE097); data->unk8 = 14; break; case 1: @@ -418,7 +418,7 @@ static void sub_81D5084(u8 taskId) case 17: if (sub_81D3AB0((struct Unk81D38FC *)&gDecompressionBuffer)) { - sub_8018884(gUnknown_085EE0FA); + AddTextPrinterToWindow1(gUnknown_085EE0FA); sub_81D505C(&data->unk0); data->unk8 = 18; } @@ -430,7 +430,7 @@ static void sub_81D5084(u8 taskId) case 18: if (sub_81D5064(&data->unk0, 120)) { - sub_8018884(gUnknown_085EE107); + AddTextPrinterToWindow1(gUnknown_085EE107); PlayFanfare(MUS_FANFA4); data->unk8 = 19; } @@ -440,25 +440,25 @@ static void sub_81D5084(u8 taskId) data->unk8 = 26; break; case 23: - if (mevent_0814257C(&data->unk9,gUnknown_085EE06B)) + if (MG_PrintTextOnWindow1AndWaitButton(&data->unk9,gUnknown_085EE06B)) data->unk8 = 26; break; case 20: - if (mevent_0814257C(&data->unk9, gUnknown_085EE0A3)) + if (MG_PrintTextOnWindow1AndWaitButton(&data->unk9, gUnknown_085EE0A3)) data->unk8 = 0; break; case 21: - if (mevent_0814257C(&data->unk9, gUnknown_085EE0BF)) + if (MG_PrintTextOnWindow1AndWaitButton(&data->unk9, gUnknown_085EE0BF)) data->unk8 = 0; break; case 22: - if (mevent_0814257C(&data->unk9, gUnknown_085EE12D)) + if (MG_PrintTextOnWindow1AndWaitButton(&data->unk9, gUnknown_085EE12D)) data->unk8 = 0; break; case 26: Free(data->unk10); DestroyTask(taskId); - SetMainCallback2(sub_80186A4); + SetMainCallback2(MainCB_FreeAllBuffersAndReturnToInitTitleScreen); break; } } diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 4bf7701be..8c4847b8d 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -1228,7 +1228,7 @@ static void Task_TradeEvolutionScene(u8 taskID) if (!gPaletteFade.active) { if (gWirelessCommType) - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); Free(GetBgTilemapBuffer(3)); Free(GetBgTilemapBuffer(1)); diff --git a/src/international_string_util.c b/src/international_string_util.c index a7c42c39e..dfeda49e3 100644 --- a/src/international_string_util.c +++ b/src/international_string_util.c @@ -62,7 +62,7 @@ int sub_81DB3D8(const struct MenuAction *str, const u8* arg1, int arg2) return convert_pixel_width_to_tile_width(var); } -int sub_81DB41C(const struct ListMenuTemplate *listMenu) +int Intl_GetListMenuWidth(const struct ListMenuTemplate *listMenu) { int i, maxWidth, finalWidth; const struct ListMenuItem *items = listMenu->items; diff --git a/src/link_rfu.c b/src/link_rfu.c index 43d19be03..a430f6e24 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -2243,7 +2243,7 @@ void CreateWirelessStatusIndicatorSprite(u8 x, u8 y) } } -void sub_800E084(void) +void DestroyWirelessStatusIndicatorSprite(void) { if (gSprites[gWirelessStatusIndicatorSpriteId].data[7] == 0x1234) { @@ -2356,7 +2356,7 @@ void sub_800E174(void) CpuCopy16(gMain.oamBuffer + 125, (struct OamData *)OAM + 125, sizeof(struct OamData)); if (sub_8011A74() == 1) { - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); } } } @@ -4209,7 +4209,7 @@ void sub_8010DB4(void) { if (gUnknown_03005000.unk_ee == 1 && gUnknown_03004140.unk_02 == 0) { - if (gMain.callback2 == sub_8018438 || gUnknown_03004140.unk_3c->unk_04) + if (gMain.callback2 == c2_mystery_gift_e_reader_run || gUnknown_03004140.unk_3c->unk_04) gWirelessCommType = 2; SetMainCallback2(CB2_LinkError); gMain.savedCallback = CB2_LinkError; diff --git a/src/list_menu.c b/src/list_menu.c index 3bcd3073d..6d51559f7 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -324,7 +324,7 @@ s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const str case 2: LoadUserWindowBorderGfx(sMysteryGiftLinkMenu.windowId, tileNum, palNum); case 1: - sub_8098858(sMysteryGiftLinkMenu.windowId, tileNum, palNum / 16); + DrawTextBorderOuter(sMysteryGiftLinkMenu.windowId, tileNum, palNum / 16); break; } gMultiuseListMenuTemplate = *listMenuTemplate; diff --git a/src/main_menu.c b/src/main_menu.c index cbd257cb1..8c9612c24 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -38,6 +38,7 @@ #include "text_window.h" #include "title_screen.h" #include "window.h" +#include "mystery_gift.h" /* * Main menu state machine @@ -1083,7 +1084,7 @@ static void Task_HandleMainMenuAPressed(u8 taskId) DestroyTask(taskId); break; case ACTION_EREADER: - SetMainCallback2(sub_801867C); + SetMainCallback2(c2_ereader); DestroyTask(taskId); break; case ACTION_INVALID: diff --git a/src/menu.c b/src/menu.c index b04572b81..958788b25 100644 --- a/src/menu.c +++ b/src/menu.c @@ -432,7 +432,7 @@ void sub_819789C(void) LoadPalette(gUnknown_0860F074, STD_WINDOW_PALETTE_NUM * 0x10, 0x14); } -void sub_81978B0(u16 offset) +void Menu_LoadStdPalAt(u16 offset) { LoadPalette(gUnknown_0860F074, offset, 0x14); } diff --git a/src/mevent2.c b/src/mevent2.c index 8a6bd9faa..4174c4055 100755 --- a/src/mevent2.c +++ b/src/mevent2.c @@ -14,7 +14,7 @@ static EWRAM_DATA bool32 gUnknown_02022C70 = FALSE; static void sub_801B180(void); -static void sub_801B14C(void); +static void s_DestroyWonderNews(void); static bool32 sub_801B114(const struct MEventBuffer_3120_Sub *data); static bool32 sub_801B2CC(const struct MEventBuffer_32E0_Sub *data); static void sub_801B330(void); @@ -29,7 +29,7 @@ void sub_801AFD8(void) sub_811F8BC(); } -struct MEventBuffer_3120_Sub *sub_801B00C(void) +struct MEventBuffer_3120_Sub *sav1_get_mevent_buffer_0(void) { return &gSaveBlock1Ptr->unk_322C.buffer_000.data; } @@ -54,9 +54,9 @@ u16 *sub_801B058(void) return gSaveBlock1Ptr->unk_322C.unk_338; } -void sub_801B06C(void) +void DestroyWonderNews(void) { - sub_801B14C(); + s_DestroyWonderNews(); } bool32 sub_801B078(const struct MEventBuffer_3120_Sub *src) @@ -64,13 +64,13 @@ bool32 sub_801B078(const struct MEventBuffer_3120_Sub *src) if (!sub_801B114(src)) return FALSE; - sub_801B14C(); + s_DestroyWonderNews(); gSaveBlock1Ptr->unk_322C.buffer_000.data = *src; gSaveBlock1Ptr->unk_322C.buffer_000.crc = CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.buffer_000.data, sizeof(struct MEventBuffer_3120_Sub)); return TRUE; } -bool32 sub_801B0CC(void) +bool32 ValidateReceivedWonderNews(void) { if (CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.buffer_000.data, sizeof(struct MEventBuffer_3120_Sub)) != gSaveBlock1Ptr->unk_322C.buffer_000.crc) return FALSE; @@ -88,7 +88,7 @@ static bool32 sub_801B114(const struct MEventBuffer_3120_Sub *data) return TRUE; } -bool32 sub_801B128(void) +bool32 WonderNews_Test_Unk_02(void) { const struct MEventBuffer_3120_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_000.data; if (data->unk_02 == 0) @@ -97,9 +97,9 @@ bool32 sub_801B128(void) return TRUE; } -static void sub_801B14C(void) +static void s_DestroyWonderNews(void) { - CpuFill32(0, sub_801B00C(), sizeof(gSaveBlock1Ptr->unk_322C.buffer_000.data)); + CpuFill32(0, sav1_get_mevent_buffer_0(), sizeof(gSaveBlock1Ptr->unk_322C.buffer_000.data)); gSaveBlock1Ptr->unk_322C.buffer_000.crc = 0; } @@ -113,7 +113,7 @@ bool32 sub_801B1A4(const u8 *src) { const u8 *r5 = (const u8 *)&gSaveBlock1Ptr->unk_322C.buffer_000.data; u32 i; - if (!sub_801B0CC()) + if (!ValidateReceivedWonderNews()) return FALSE; for (i = 0; i < sizeof(struct MEventBuffer_3120_Sub); i++) @@ -125,7 +125,7 @@ bool32 sub_801B1A4(const u8 *src) return TRUE; } -void sub_801B1E8(void) +void DestroyWonderCard(void) { sub_801B330(); sub_801B368(); @@ -143,7 +143,7 @@ bool32 sub_801B21C(const struct MEventBuffer_32E0_Sub *data) if (!sub_801B2CC(data)) return FALSE; - sub_801B1E8(); + DestroyWonderCard(); memcpy(&gSaveBlock1Ptr->unk_322C.buffer_1c0.data, data, sizeof(struct MEventBuffer_32E0_Sub)); gSaveBlock1Ptr->unk_322C.buffer_1c0.crc = CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.buffer_1c0.data, sizeof(struct MEventBuffer_32E0_Sub)); r2 = &gSaveBlock1Ptr->unk_322C.buffer_310.data; @@ -152,7 +152,7 @@ bool32 sub_801B21C(const struct MEventBuffer_32E0_Sub *data) return TRUE; } -bool32 sub_801B27C(void) +bool32 ValidateReceivedWonderCard(void) { if (gSaveBlock1Ptr->unk_322C.buffer_1c0.crc != CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.buffer_1c0.data, sizeof(struct MEventBuffer_32E0_Sub))) return FALSE; @@ -180,7 +180,7 @@ static bool32 sub_801B2CC(const struct MEventBuffer_32E0_Sub *data) return TRUE; } -bool32 sub_801B308(void) +bool32 WonderCard_Test_Unk_08_6(void) { const struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; if (data->unk_08_6 == 0) @@ -201,9 +201,9 @@ static void sub_801B368(void) gSaveBlock1Ptr->unk_322C.buffer_310.crc = 0; } -u16 sub_801B39C(void) +u16 GetWonderCardFlagID(void) { - if (sub_801B27C()) + if (ValidateReceivedWonderCard()) return gSaveBlock1Ptr->unk_322C.buffer_1c0.data.unk_00; return 0; @@ -215,7 +215,7 @@ void sub_801B3C0(struct MEventBuffer_32E0_Sub *buffer) buffer->unk_08_6 = 0; } -static bool32 sub_801B3D8(u16 a0) +static bool32 IsWonderCardFlagIDInValidRange(u16 a0) { if (a0 >= 1000 && a0 < 1020) return TRUE; @@ -247,10 +247,10 @@ static const u16 sMysteryGiftFlags[] = FLAG_UNUSED_MYSTERY_GIFT_0x14D, }; -bool32 sub_801B3F8(void) +bool32 CheckReceivedGiftFromWonderCard(void) { - u16 value = sub_801B39C(); - if (!sub_801B3D8(value)) + u16 value = GetWonderCardFlagID(); + if (!IsWonderCardFlagIDInValidRange(value)) return FALSE; if (FlagGet(sMysteryGiftFlags[value - 1000]) == TRUE) @@ -300,7 +300,7 @@ static bool32 sub_801B4A4(const u16 *data) static int sub_801B4CC(void) { struct MEventBuffer_32E0_Sub *data; - if (!sub_801B27C()) + if (!ValidateReceivedWonderCard()) return 0; data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; @@ -353,7 +353,7 @@ void sub_801B580(struct MEventStruct_Unk1442CC *data, bool32 a1) data->unk_10 = 0x0200; } - if (sub_801B27C()) + if (ValidateReceivedWonderCard()) { data->unk_14 = sav1_get_mevent_buffer_1()->unk_00; data->unk_20 = *sav1_get_mevent_buffer_2(); @@ -554,7 +554,7 @@ bool32 sub_801B94C(u16 a0) if (a0 == 0) return FALSE; - if (!sub_801B27C()) + if (!ValidateReceivedWonderCard()) return FALSE; if (gSaveBlock1Ptr->unk_322C.buffer_1c0.data.unk_00 != a0) diff --git a/src/mevent_801BAAC.c b/src/mevent_801BAAC.c index b9931a682..24a999f69 100644 --- a/src/mevent_801BAAC.c +++ b/src/mevent_801BAAC.c @@ -53,7 +53,7 @@ struct UnkStruct_203F3C8 /*045C*/ u8 buffer_045C[0x1000]; }; -EWRAM_DATA struct UnkStruct_203F3C8 * gUnknown_02022C74 = NULL; +EWRAM_DATA struct UnkStruct_203F3C8 * sWonderCardData = NULL; void sub_801BEF8(void); void sub_801C178(u8 whichWindow); @@ -150,40 +150,40 @@ const struct UnkStruct_8467FB8 gUnknown_082F1D60[8] = { {1, 0, 0, 7, gWonderCardBgGfx8, gWonderCardBgTilemap8, gWonderCardBgPal8} }; -bool32 sub_801BAAC(struct MEventBuffer_32E0_Sub * r5, struct MEventBuffer_3430_Sub * r6) +bool32 InitWonderCardResources(struct MEventBuffer_32E0_Sub * r5, struct MEventBuffer_3430_Sub * r6) { if (r5 == NULL || r6 == NULL) return FALSE; - gUnknown_02022C74 = AllocZeroed(sizeof(struct UnkStruct_203F3C8)); - if (gUnknown_02022C74 == NULL) + sWonderCardData = AllocZeroed(sizeof(struct UnkStruct_203F3C8)); + if (sWonderCardData == NULL) return FALSE; - gUnknown_02022C74->unk_0000 = *r5; - gUnknown_02022C74->unk_014C = *r6; - if (gUnknown_02022C74->unk_0000.unk_08_2 >= ARRAY_COUNT(gUnknown_082F1D60)) - gUnknown_02022C74->unk_0000.unk_08_2 = 0; - if (gUnknown_02022C74->unk_0000.unk_08_0 >= ARRAY_COUNT(gUnknown_082F0E18)) - gUnknown_02022C74->unk_0000.unk_08_0 = 0; - if (gUnknown_02022C74->unk_0000.unk_09 > ARRAY_COUNT(gUnknown_02022C74->unk_017D)) - gUnknown_02022C74->unk_0000.unk_09 = 0; - gUnknown_02022C74->unk_0170 = &gUnknown_082F1D60[gUnknown_02022C74->unk_0000.unk_08_2]; + sWonderCardData->unk_0000 = *r5; + sWonderCardData->unk_014C = *r6; + if (sWonderCardData->unk_0000.unk_08_2 >= ARRAY_COUNT(gUnknown_082F1D60)) + sWonderCardData->unk_0000.unk_08_2 = 0; + if (sWonderCardData->unk_0000.unk_08_0 >= ARRAY_COUNT(gUnknown_082F0E18)) + sWonderCardData->unk_0000.unk_08_0 = 0; + if (sWonderCardData->unk_0000.unk_09 > ARRAY_COUNT(sWonderCardData->unk_017D)) + sWonderCardData->unk_0000.unk_09 = 0; + sWonderCardData->unk_0170 = &gUnknown_082F1D60[sWonderCardData->unk_0000.unk_08_2]; return TRUE; } -void sub_801BB48(void) +void DestroyWonderCardResources(void) { - if (gUnknown_02022C74 != NULL) + if (sWonderCardData != NULL) { - *gUnknown_02022C74 = (struct UnkStruct_203F3C8){}; - Free(gUnknown_02022C74); - gUnknown_02022C74 = NULL; + *sWonderCardData = (struct UnkStruct_203F3C8){}; + Free(sWonderCardData); + sWonderCardData = NULL; } } -s32 sub_801BB74(void) +s32 FadeToWonderCardMenu(void) { - if (gUnknown_02022C74 == NULL) + if (sWonderCardData == NULL) return -1; - switch(gUnknown_02022C74->unk_0174) + switch(sWonderCardData->unk_0174) { case 0: BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); @@ -199,19 +199,19 @@ s32 sub_801BB74(void) CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); - decompress_and_copy_tile_data_to_vram(2, gUnknown_02022C74->unk_0170->tiles, 0, 0x008, 0); - gUnknown_02022C74->unk_0176[0] = AddWindow(&gUnknown_082F0E1C[0]); - gUnknown_02022C74->unk_0176[1] = AddWindow(&gUnknown_082F0E1C[1]); - gUnknown_02022C74->unk_0176[2] = AddWindow(&gUnknown_082F0E1C[2]); + decompress_and_copy_tile_data_to_vram(2, sWonderCardData->unk_0170->tiles, 0, 0x008, 0); + sWonderCardData->unk_0176[0] = AddWindow(&gUnknown_082F0E1C[0]); + sWonderCardData->unk_0176[1] = AddWindow(&gUnknown_082F0E1C[1]); + sWonderCardData->unk_0176[2] = AddWindow(&gUnknown_082F0E1C[2]); break; case 3: if (free_temp_tile_data_buffers_if_possible()) return 0; LoadPalette(stdpal_get(1), 0x20, 0x20); gPaletteFade.bufferTransferDisabled = TRUE; - LoadPalette(gUnknown_02022C74->unk_0170->pal, 0x10, 0x20); - LZ77UnCompWram(gUnknown_02022C74->unk_0170->map, gUnknown_02022C74->buffer_045C); - CopyRectToBgTilemapBufferRect(2, gUnknown_02022C74->buffer_045C, 0, 0, 30, 20, 0, 0, 30, 20, 1, 0x008, 0); + LoadPalette(sWonderCardData->unk_0170->pal, 0x10, 0x20); + LZ77UnCompWram(sWonderCardData->unk_0170->map, sWonderCardData->buffer_045C); + CopyRectToBgTilemapBufferRect(2, sWonderCardData->buffer_045C, 0, 0, 30, 20, 0, 0, 30, 20, 1, 0x008, 0); CopyBgTilemapBufferToVram(2); break; case 4: @@ -237,18 +237,18 @@ s32 sub_801BB74(void) default: if (UpdatePaletteFade()) return 0; - gUnknown_02022C74->unk_0174 = 0; + sWonderCardData->unk_0174 = 0; return 1; } - ++gUnknown_02022C74->unk_0174; + ++sWonderCardData->unk_0174; return 0; } -s32 sub_801BDA4(bool32 flag) +s32 FadeOutFromWonderCard(bool32 flag) { - if (gUnknown_02022C74 == NULL) + if (sWonderCardData == NULL) return -1; - switch (gUnknown_02022C74->unk_0174) + switch (sWonderCardData->unk_0174) { case 0: BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); @@ -268,26 +268,26 @@ s32 sub_801BDA4(bool32 flag) case 3: HideBg(1); HideBg(2); - RemoveWindow(gUnknown_02022C74->unk_0176[2]); - RemoveWindow(gUnknown_02022C74->unk_0176[1]); - RemoveWindow(gUnknown_02022C74->unk_0176[0]); + RemoveWindow(sWonderCardData->unk_0176[2]); + RemoveWindow(sWonderCardData->unk_0176[1]); + RemoveWindow(sWonderCardData->unk_0176[0]); break; case 4: sub_801C61C(); FreeMonIconPalettes(); break; case 5: - sub_80186EC(gUnknown_02022C60, flag); + PrintMysteryGiftOrEReaderTopMenu(gGiftIsFromEReader, flag); CopyBgTilemapBufferToVram(0); BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); break; default: if (UpdatePaletteFade()) return 0; - gUnknown_02022C74->unk_0174 = 0; + sWonderCardData->unk_0174 = 0; return 1; } - ++gUnknown_02022C74->unk_0174; + ++sWonderCardData->unk_0174; return 0; } @@ -297,59 +297,59 @@ void sub_801BEF8(void) u16 r6; u16 sp0[3] = {0, 0, 0}; - memcpy(gUnknown_02022C74->unk_018B, gUnknown_02022C74->unk_0000.unk_0A, 40); - gUnknown_02022C74->unk_018B[40] = EOS; - memcpy(gUnknown_02022C74->unk_01B4, gUnknown_02022C74->unk_0000.unk_32, 40); - gUnknown_02022C74->unk_01B4[40] = EOS; - if (gUnknown_02022C74->unk_0000.unk_04 > 999999) - gUnknown_02022C74->unk_0000.unk_04 = 999999; - ConvertIntToDecimalStringN(gUnknown_02022C74->unk_01DD, gUnknown_02022C74->unk_0000.unk_04, STR_CONV_MODE_LEFT_ALIGN, 6); + memcpy(sWonderCardData->unk_018B, sWonderCardData->unk_0000.unk_0A, 40); + sWonderCardData->unk_018B[40] = EOS; + memcpy(sWonderCardData->unk_01B4, sWonderCardData->unk_0000.unk_32, 40); + sWonderCardData->unk_01B4[40] = EOS; + if (sWonderCardData->unk_0000.unk_04 > 999999) + sWonderCardData->unk_0000.unk_04 = 999999; + ConvertIntToDecimalStringN(sWonderCardData->unk_01DD, sWonderCardData->unk_0000.unk_04, STR_CONV_MODE_LEFT_ALIGN, 6); for (i = 0; i < 4; i++) { - memcpy(gUnknown_02022C74->unk_01E4[i], gUnknown_02022C74->unk_0000.unk_5A[i], 40); - gUnknown_02022C74->unk_01E4[i][40] = EOS; + memcpy(sWonderCardData->unk_01E4[i], sWonderCardData->unk_0000.unk_5A[i], 40); + sWonderCardData->unk_01E4[i][40] = EOS; } - memcpy(gUnknown_02022C74->unk_0288, gUnknown_02022C74->unk_0000.unk_FA, 40); - gUnknown_02022C74->unk_0288[40] = EOS; - switch (gUnknown_02022C74->unk_0000.unk_08_0) + memcpy(sWonderCardData->unk_0288, sWonderCardData->unk_0000.unk_FA, 40); + sWonderCardData->unk_0288[40] = EOS; + switch (sWonderCardData->unk_0000.unk_08_0) { case 0: - memcpy(gUnknown_02022C74->unk_02B1, gUnknown_02022C74->unk_0000.unk_122, 40); - gUnknown_02022C74->unk_02B1[40] = EOS; + memcpy(sWonderCardData->unk_02B1, sWonderCardData->unk_0000.unk_122, 40); + sWonderCardData->unk_02B1[40] = EOS; break; case 1: - gUnknown_02022C74->unk_02B1[00] = EOS; + sWonderCardData->unk_02B1[00] = EOS; break; case 2: - gUnknown_02022C74->unk_02B1[00] = EOS; - sp0[0] = gUnknown_02022C74->unk_014C.unk_00 < 999 ? gUnknown_02022C74->unk_014C.unk_00 : 999; - sp0[1] = gUnknown_02022C74->unk_014C.unk_02 < 999 ? gUnknown_02022C74->unk_014C.unk_02 : 999; - sp0[2] = gUnknown_02022C74->unk_014C.unk_04 < 999 ? gUnknown_02022C74->unk_014C.unk_04 : 999; + sWonderCardData->unk_02B1[00] = EOS; + sp0[0] = sWonderCardData->unk_014C.unk_00 < 999 ? sWonderCardData->unk_014C.unk_00 : 999; + sp0[1] = sWonderCardData->unk_014C.unk_02 < 999 ? sWonderCardData->unk_014C.unk_02 : 999; + sp0[2] = sWonderCardData->unk_014C.unk_04 < 999 ? sWonderCardData->unk_014C.unk_04 : 999; for (i = 0; i < 8; i++) { - memset(gUnknown_02022C74->unk_02DC[i].unk_42, EOS, 4); - memset(gUnknown_02022C74->unk_02DC[i].unk_01, EOS, 41); + memset(sWonderCardData->unk_02DC[i].unk_42, EOS, 4); + memset(sWonderCardData->unk_02DC[i].unk_01, EOS, 41); } for (i = 0, r6 = 0; i < 40; i++) { - if (gUnknown_02022C74->unk_0000.unk_122[i] != 0xF7) + if (sWonderCardData->unk_0000.unk_122[i] != 0xF7) { - gUnknown_02022C74->unk_02DC[gUnknown_02022C74->unk_0175].unk_01[r6] = gUnknown_02022C74->unk_0000.unk_122[i]; + sWonderCardData->unk_02DC[sWonderCardData->unk_0175].unk_01[r6] = sWonderCardData->unk_0000.unk_122[i]; r6++; } else { - u8 r3 = gUnknown_02022C74->unk_0000.unk_122[i + 1]; + u8 r3 = sWonderCardData->unk_0000.unk_122[i + 1]; if (r3 > 2) { i += 2; } else { - ConvertIntToDecimalStringN(gUnknown_02022C74->unk_02DC[gUnknown_02022C74->unk_0175].unk_42, sp0[r3], STR_CONV_MODE_LEADING_ZEROS, 3); - gUnknown_02022C74->unk_02DC[gUnknown_02022C74->unk_0175].unk_00 = gUnknown_02022C74->unk_0000.unk_122[i + 2]; - gUnknown_02022C74->unk_0175++; - if (gUnknown_02022C74->unk_0175 > 7) + ConvertIntToDecimalStringN(sWonderCardData->unk_02DC[sWonderCardData->unk_0175].unk_42, sp0[r3], STR_CONV_MODE_LEADING_ZEROS, 3); + sWonderCardData->unk_02DC[sWonderCardData->unk_0175].unk_00 = sWonderCardData->unk_0000.unk_122[i + 2]; + sWonderCardData->unk_0175++; + if (sWonderCardData->unk_0175 > 7) break; r6 = 0; i += 2; @@ -362,7 +362,7 @@ void sub_801BEF8(void) void sub_801C178(u8 whichWindow) { s8 sp0C = 0; - s32 windowId = gUnknown_02022C74->unk_0176[whichWindow]; + s32 windowId = sWonderCardData->unk_0176[whichWindow]; PutWindowTilemap(windowId); FillWindowPixelBuffer(windowId, 0); switch (whichWindow) @@ -370,42 +370,42 @@ void sub_801C178(u8 whichWindow) case 0: { s32 x; - AddTextPrinterParameterized3(windowId, 3, 0, 1, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal1], 0, gUnknown_02022C74->unk_018B); - x = 160 - GetStringWidth(3, gUnknown_02022C74->unk_01B4, GetFontAttribute(3, 2)); + AddTextPrinterParameterized3(windowId, 3, 0, 1, gUnknown_082F0E10[sWonderCardData->unk_0170->textPal1], 0, sWonderCardData->unk_018B); + x = 160 - GetStringWidth(3, sWonderCardData->unk_01B4, GetFontAttribute(3, 2)); if (x < 0) x = 0; - AddTextPrinterParameterized3(windowId, 3, x, 17, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal1], 0, gUnknown_02022C74->unk_01B4); - if (gUnknown_02022C74->unk_0000.unk_04 != 0) + AddTextPrinterParameterized3(windowId, 3, x, 17, gUnknown_082F0E10[sWonderCardData->unk_0170->textPal1], 0, sWonderCardData->unk_01B4); + if (sWonderCardData->unk_0000.unk_04 != 0) { - AddTextPrinterParameterized3(windowId, 1, 166, 17, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal1], 0, gUnknown_02022C74->unk_01DD); + AddTextPrinterParameterized3(windowId, 1, 166, 17, gUnknown_082F0E10[sWonderCardData->unk_0170->textPal1], 0, sWonderCardData->unk_01DD); } break; } case 1: for (; sp0C < 4; sp0C++) { - AddTextPrinterParameterized3(windowId, 3, 0, 16 * sp0C + 2, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal2], 0, gUnknown_02022C74->unk_01E4[sp0C]); + AddTextPrinterParameterized3(windowId, 3, 0, 16 * sp0C + 2, gUnknown_082F0E10[sWonderCardData->unk_0170->textPal2], 0, sWonderCardData->unk_01E4[sp0C]); } break; case 2: - AddTextPrinterParameterized3(windowId, 3, 0, gUnknown_082F0E18[gUnknown_02022C74->unk_0000.unk_08_0], gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal3], 0, gUnknown_02022C74->unk_0288); - if (gUnknown_02022C74->unk_0000.unk_08_0 != 2) + AddTextPrinterParameterized3(windowId, 3, 0, gUnknown_082F0E18[sWonderCardData->unk_0000.unk_08_0], gUnknown_082F0E10[sWonderCardData->unk_0170->textPal3], 0, sWonderCardData->unk_0288); + if (sWonderCardData->unk_0000.unk_08_0 != 2) { - AddTextPrinterParameterized3(windowId, 3, 0, 16 + gUnknown_082F0E18[gUnknown_02022C74->unk_0000.unk_08_0], gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal3], 0, gUnknown_02022C74->unk_02B1); + AddTextPrinterParameterized3(windowId, 3, 0, 16 + gUnknown_082F0E18[sWonderCardData->unk_0000.unk_08_0], gUnknown_082F0E10[sWonderCardData->unk_0170->textPal3], 0, sWonderCardData->unk_02B1); } else { s32 x = 0; - s32 y = gUnknown_082F0E18[gUnknown_02022C74->unk_0000.unk_08_0] + 16; + s32 y = gUnknown_082F0E18[sWonderCardData->unk_0000.unk_08_0] + 16; s32 spacing = GetFontAttribute(3, 2); - for (; sp0C < gUnknown_02022C74->unk_0175; sp0C++) + for (; sp0C < sWonderCardData->unk_0175; sp0C++) { - AddTextPrinterParameterized3(windowId, 3, x, y, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal3], 0, gUnknown_02022C74->unk_02DC[sp0C].unk_01); - if (gUnknown_02022C74->unk_02DC[sp0C].unk_42[0] != EOS) + AddTextPrinterParameterized3(windowId, 3, x, y, gUnknown_082F0E10[sWonderCardData->unk_0170->textPal3], 0, sWonderCardData->unk_02DC[sp0C].unk_01); + if (sWonderCardData->unk_02DC[sp0C].unk_42[0] != EOS) { - x += GetStringWidth(3, gUnknown_02022C74->unk_02DC[sp0C].unk_01, spacing); - AddTextPrinterParameterized3(windowId, 3, x, y, gUnknown_082F0E10[gUnknown_02022C74->unk_0170->textPal3], 0, gUnknown_02022C74->unk_02DC[sp0C].unk_42); - x += GetStringWidth(3, gUnknown_02022C74->unk_02DC[sp0C].unk_42, spacing) + gUnknown_02022C74->unk_02DC[sp0C].unk_00; + x += GetStringWidth(3, sWonderCardData->unk_02DC[sp0C].unk_01, spacing); + AddTextPrinterParameterized3(windowId, 3, x, y, gUnknown_082F0E10[sWonderCardData->unk_0170->textPal3], 0, sWonderCardData->unk_02DC[sp0C].unk_42); + x += GetStringWidth(3, sWonderCardData->unk_02DC[sp0C].unk_42, spacing) + sWonderCardData->unk_02DC[sp0C].unk_00; } } } @@ -417,24 +417,24 @@ void sub_801C178(u8 whichWindow) void sub_801C4C0(void) { u8 r7 = 0; - gUnknown_02022C74->unk_017C = 0xFF; - if (gUnknown_02022C74->unk_014C.unk_06 != SPECIES_NONE) + sWonderCardData->unk_017C = 0xFF; + if (sWonderCardData->unk_014C.unk_06 != SPECIES_NONE) { - gUnknown_02022C74->unk_017C = sub_80D2D78(sub_80D2E84(gUnknown_02022C74->unk_014C.unk_06), SpriteCallbackDummy, 0xDC, 0x14, 0, FALSE); - gSprites[gUnknown_02022C74->unk_017C].oam.priority = 2; + sWonderCardData->unk_017C = sub_80D2D78(sub_80D2E84(sWonderCardData->unk_014C.unk_06), SpriteCallbackDummy, 0xDC, 0x14, 0, FALSE); + gSprites[sWonderCardData->unk_017C].oam.priority = 2; } - if (gUnknown_02022C74->unk_0000.unk_09 != 0 && gUnknown_02022C74->unk_0000.unk_08_0 == 1) + if (sWonderCardData->unk_0000.unk_09 != 0 && sWonderCardData->unk_0000.unk_08_0 == 1) { LoadCompressedSpriteSheetUsingHeap(&gUnknown_082F1D00); - LoadSpritePalette(&gUnknown_082F1D08[gUnknown_02022C74->unk_0170->textPal4]); - for (; r7 < gUnknown_02022C74->unk_0000.unk_09; r7++) + LoadSpritePalette(&gUnknown_082F1D08[sWonderCardData->unk_0170->textPal4]); + for (; r7 < sWonderCardData->unk_0000.unk_09; r7++) { - gUnknown_02022C74->unk_017D[r7][0] = 0xFF; - gUnknown_02022C74->unk_017D[r7][1] = 0xFF; - gUnknown_02022C74->unk_017D[r7][0] = CreateSprite(&gUnknown_082F1D48, 0xd8 - 32 * r7, 0x90, 8); - if (gUnknown_02022C74->unk_014C.unk_08[0][r7] != 0) + sWonderCardData->unk_017D[r7][0] = 0xFF; + sWonderCardData->unk_017D[r7][1] = 0xFF; + sWonderCardData->unk_017D[r7][0] = CreateSprite(&gUnknown_082F1D48, 0xd8 - 32 * r7, 0x90, 8); + if (sWonderCardData->unk_014C.unk_08[0][r7] != 0) { - gUnknown_02022C74->unk_017D[r7][1] = sub_80D2D78(sub_80D2E84(gUnknown_02022C74->unk_014C.unk_08[0][r7]), SpriteCallbackDummy, 0xd8 - 32 * r7, 0x88, 0, 0); + sWonderCardData->unk_017D[r7][1] = sub_80D2D78(sub_80D2E84(sWonderCardData->unk_014C.unk_08[0][r7]), SpriteCallbackDummy, 0xd8 - 32 * r7, 0x88, 0, 0); } } } @@ -443,19 +443,19 @@ void sub_801C4C0(void) void sub_801C61C(void) { u8 r6 = 0; - if (gUnknown_02022C74->unk_017C != 0xFF) - sub_80D2EF8(&gSprites[gUnknown_02022C74->unk_017C]); - if (gUnknown_02022C74->unk_0000.unk_09 != 0 && gUnknown_02022C74->unk_0000.unk_08_0 == 1) + if (sWonderCardData->unk_017C != 0xFF) + sub_80D2EF8(&gSprites[sWonderCardData->unk_017C]); + if (sWonderCardData->unk_0000.unk_09 != 0 && sWonderCardData->unk_0000.unk_08_0 == 1) { - for (; r6 < gUnknown_02022C74->unk_0000.unk_09; r6++) + for (; r6 < sWonderCardData->unk_0000.unk_09; r6++) { - if (gUnknown_02022C74->unk_017D[r6][0] != 0xFF) + if (sWonderCardData->unk_017D[r6][0] != 0xFF) { - DestroySprite(&gSprites[gUnknown_02022C74->unk_017D[r6][0]]); + DestroySprite(&gSprites[sWonderCardData->unk_017D[r6][0]]); } - if (gUnknown_02022C74->unk_017D[r6][1] != 0xFF) + if (sWonderCardData->unk_017D[r6][1] != 0xFF) { - sub_80D2EF8(&gSprites[gUnknown_02022C74->unk_017D[r6][1]]); + sub_80D2EF8(&gSprites[sWonderCardData->unk_017D[r6][1]]); } } FreeSpriteTilesByTag(0x8000); @@ -484,7 +484,7 @@ struct UnkStruct_203F3CC /*03a4*/ u8 buffer_03A4[0x1000]; }; -EWRAM_DATA struct UnkStruct_203F3CC * gUnknown_02022C78 = NULL; +EWRAM_DATA struct UnkStruct_203F3CC * sWonderNewsData = NULL; void sub_801CDCC(void); void sub_801CE7C(void); @@ -542,37 +542,37 @@ const struct UnkStruct_8467FB8 gUnknown_082F24C8[] = { {1, 0, 0, 0, gWonderNewsGfx8, gWonderNewsTilemap8, gWonderNewsPal8} }; -bool32 sub_801C6C8(const struct MEventBuffer_3120_Sub * a0) +bool32 InitWonderNewsResources(const struct MEventBuffer_3120_Sub * a0) { if (a0 == NULL) return FALSE; - gUnknown_02022C78 = AllocZeroed(sizeof(struct UnkStruct_203F3CC)); - if (gUnknown_02022C78 == NULL) + sWonderNewsData = AllocZeroed(sizeof(struct UnkStruct_203F3CC)); + if (sWonderNewsData == NULL) return FALSE; - gUnknown_02022C78->unk_0000 = *a0; - if (gUnknown_02022C78->unk_0000.unk_03 >= ARRAY_COUNT(gUnknown_082F24C8)) - gUnknown_02022C78->unk_0000.unk_03 = 0; - gUnknown_02022C78->unk_01BC = &gUnknown_082F24C8[gUnknown_02022C78->unk_0000.unk_03]; - gUnknown_02022C78->unk_01C1 = 0xFF; + sWonderNewsData->unk_0000 = *a0; + if (sWonderNewsData->unk_0000.unk_03 >= ARRAY_COUNT(gUnknown_082F24C8)) + sWonderNewsData->unk_0000.unk_03 = 0; + sWonderNewsData->unk_01BC = &gUnknown_082F24C8[sWonderNewsData->unk_0000.unk_03]; + sWonderNewsData->unk_01C1 = 0xFF; return TRUE; } -void sub_801C72C(void) +void DestroyWonderNewsResources(void) { - if (gUnknown_02022C78 != NULL) + if (sWonderNewsData != NULL) { - *gUnknown_02022C78 = (struct UnkStruct_203F3CC){}; - Free(gUnknown_02022C78); - gUnknown_02022C78 = NULL; + *sWonderNewsData = (struct UnkStruct_203F3CC){}; + Free(sWonderNewsData); + sWonderNewsData = NULL; } } -s32 sub_801C758(void) +s32 FadeToWonderNewsMenu(void) { - if (gUnknown_02022C78 == NULL) + if (sWonderNewsData == NULL) return -1; - switch (gUnknown_02022C78->unk_01C0_1) + switch (sWonderNewsData->unk_01C0_1) { case 0: BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); @@ -599,19 +599,19 @@ s32 sub_801C758(void) CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(2); CopyBgTilemapBufferToVram(3); - decompress_and_copy_tile_data_to_vram(3, gUnknown_02022C78->unk_01BC->tiles, 0, 8, 0); - gUnknown_02022C78->unk_01C8[0] = AddWindow(&gUnknown_082F1DE8[0]); - gUnknown_02022C78->unk_01C8[1] = AddWindow(&gUnknown_082F1DE8[1]); + decompress_and_copy_tile_data_to_vram(3, sWonderNewsData->unk_01BC->tiles, 0, 8, 0); + sWonderNewsData->unk_01C8[0] = AddWindow(&gUnknown_082F1DE8[0]); + sWonderNewsData->unk_01C8[1] = AddWindow(&gUnknown_082F1DE8[1]); break; case 3: if (free_temp_tile_data_buffers_if_possible()) return 0; LoadPalette(stdpal_get(1), 0x20, 0x20); gPaletteFade.bufferTransferDisabled = TRUE; - LoadPalette(gUnknown_02022C78->unk_01BC->pal, 0x10, 0x20); - LZ77UnCompWram(gUnknown_02022C78->unk_01BC->map, gUnknown_02022C78->buffer_03A4); - CopyRectToBgTilemapBufferRect(1, gUnknown_02022C78->buffer_03A4, 0, 0, 30, 3, 0, 0, 30, 3, 1, 8, 0); - CopyRectToBgTilemapBufferRect(3, gUnknown_02022C78->buffer_03A4, 0, 3, 30, 23, 0, 3, 30, 23, 1, 8, 0); + LoadPalette(sWonderNewsData->unk_01BC->pal, 0x10, 0x20); + LZ77UnCompWram(sWonderNewsData->unk_01BC->map, sWonderNewsData->buffer_03A4); + CopyRectToBgTilemapBufferRect(1, sWonderNewsData->buffer_03A4, 0, 0, 30, 3, 0, 0, 30, 3, 1, 8, 0); + CopyRectToBgTilemapBufferRect(3, sWonderNewsData->buffer_03A4, 0, 3, 30, 23, 0, 3, 30, 23, 1, 8, 0); CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(3); break; @@ -628,26 +628,26 @@ s32 sub_801C758(void) ShowBg(2); ShowBg(3); gPaletteFade.bufferTransferDisabled = FALSE; - gUnknown_02022C78->unk_01C1 = AddScrollIndicatorArrowPair(&gUnknown_02022C78->unk_0394, &gUnknown_02022C78->unk_01C6); + sWonderNewsData->unk_01C1 = AddScrollIndicatorArrowPair(&sWonderNewsData->unk_0394, &sWonderNewsData->unk_01C6); BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); UpdatePaletteFade(); break; default: if (UpdatePaletteFade()) return 0; - gUnknown_02022C78->unk_01C0_1 = 0; + sWonderNewsData->unk_01C0_1 = 0; return 1; } - ++gUnknown_02022C78->unk_01C0_1; + ++sWonderNewsData->unk_01C0_1; return 0; } -s32 sub_801CA50(bool32 flag) +s32 FadeOutFromWonderNews(bool32 flag) { - if (gUnknown_02022C78 == NULL) + if (sWonderNewsData == NULL) return -1; - switch (gUnknown_02022C78->unk_01C0_1) + switch (sWonderNewsData->unk_01C0_1) { case 0: BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); @@ -675,21 +675,21 @@ s32 sub_801CA50(bool32 flag) case 3: HideBg(1); HideBg(2); - RemoveWindow(gUnknown_02022C78->unk_01C8[1]); - RemoveWindow(gUnknown_02022C78->unk_01C8[0]); + RemoveWindow(sWonderNewsData->unk_01C8[1]); + RemoveWindow(sWonderNewsData->unk_01C8[0]); break; case 4: ChangeBgY(2, 0, 0); ChangeBgY(3, 0, 0); - if (gUnknown_02022C78->unk_01C1 != 0xFF) + if (sWonderNewsData->unk_01C1 != 0xFF) { - RemoveScrollIndicatorArrowPair(gUnknown_02022C78->unk_01C1); - gUnknown_02022C78->unk_01C1 = 0xFF; + RemoveScrollIndicatorArrowPair(sWonderNewsData->unk_01C1); + sWonderNewsData->unk_01C1 = 0xFF; } break; case 5: - sub_80186EC(gUnknown_02022C60, flag); - sub_8018798(3); + PrintMysteryGiftOrEReaderTopMenu(gGiftIsFromEReader, flag); + MG_DrawCheckerboardPattern(3); CopyBgTilemapBufferToVram(0); CopyBgTilemapBufferToVram(3); BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); @@ -697,36 +697,36 @@ s32 sub_801CA50(bool32 flag) default: if (UpdatePaletteFade()) return 0; - gUnknown_02022C78->unk_01C0_1 = 0; + sWonderNewsData->unk_01C0_1 = 0; return 1; } - ++gUnknown_02022C78->unk_01C0_1; + ++sWonderNewsData->unk_01C0_1; return 0; } -void sub_801CC38(void) +void MENews_RemoveScrollIndicatorArrowPair(void) { - if (!gUnknown_02022C78->unk_01C0_0 && gUnknown_02022C78->unk_01C1 != 0xFF) + if (!sWonderNewsData->unk_01C0_0 && sWonderNewsData->unk_01C1 != 0xFF) { - RemoveScrollIndicatorArrowPair(gUnknown_02022C78->unk_01C1); - gUnknown_02022C78->unk_01C1 = 0xFF; - gUnknown_02022C78->unk_01C0_0 = TRUE; + RemoveScrollIndicatorArrowPair(sWonderNewsData->unk_01C1); + sWonderNewsData->unk_01C1 = 0xFF; + sWonderNewsData->unk_01C0_0 = TRUE; } } -void sub_801CC80(void) +void MENews_AddScrollIndicatorArrowPair(void) { - if (gUnknown_02022C78->unk_01C0_0) + if (sWonderNewsData->unk_01C0_0) { - gUnknown_02022C78->unk_01C1 = AddScrollIndicatorArrowPair(&gUnknown_02022C78->unk_0394, &gUnknown_02022C78->unk_01C6); - gUnknown_02022C78->unk_01C0_0 = FALSE; + sWonderNewsData->unk_01C1 = AddScrollIndicatorArrowPair(&sWonderNewsData->unk_0394, &sWonderNewsData->unk_01C6); + sWonderNewsData->unk_01C0_0 = FALSE; } } -u32 sub_801CCD0(u16 input) +u32 MENews_GetInput(u16 input) { - if (gUnknown_02022C78->unk_01C2_0) + if (sWonderNewsData->unk_01C2_0) { sub_801CFA4(); return 0xFF; @@ -738,26 +738,26 @@ u32 sub_801CCD0(u16 input) case B_BUTTON: return 1; case DPAD_UP: - if (gUnknown_02022C78->unk_01C6 == 0) + if (sWonderNewsData->unk_01C6 == 0) return 0xFF; - if (gUnknown_02022C78->unk_01C0_0) + if (sWonderNewsData->unk_01C0_0) return 0xFF; - gUnknown_02022C78->unk_01C3_0 = FALSE; + sWonderNewsData->unk_01C3_0 = FALSE; break; case DPAD_DOWN: - if (gUnknown_02022C78->unk_01C6 == gUnknown_02022C78->unk_01C4) + if (sWonderNewsData->unk_01C6 == sWonderNewsData->unk_01C4) return 0xFF; - if (gUnknown_02022C78->unk_01C0_0) + if (sWonderNewsData->unk_01C0_0) return 0xFF; - gUnknown_02022C78->unk_01C3_0 = TRUE; + sWonderNewsData->unk_01C3_0 = TRUE; break; default: return 0xFF; } - gUnknown_02022C78->unk_01C2_0 = TRUE; - gUnknown_02022C78->unk_01C2_1 = 2; - gUnknown_02022C78->unk_01C3_1 = 0; - if (gUnknown_02022C78->unk_01C3_0 == FALSE) + sWonderNewsData->unk_01C2_0 = TRUE; + sWonderNewsData->unk_01C2_1 = 2; + sWonderNewsData->unk_01C3_1 = 0; + if (sWonderNewsData->unk_01C3_0 == FALSE) return 2; else return 3; @@ -766,44 +766,44 @@ u32 sub_801CCD0(u16 input) void sub_801CDCC(void) { u8 i = 0; - memcpy(gUnknown_02022C78->unk_01CE, gUnknown_02022C78->unk_0000.unk_04, 40); - gUnknown_02022C78->unk_01CE[40] = EOS; + memcpy(sWonderNewsData->unk_01CE, sWonderNewsData->unk_0000.unk_04, 40); + sWonderNewsData->unk_01CE[40] = EOS; for (; i < 10; ++i) { - memcpy(gUnknown_02022C78->unk_01F7[i], gUnknown_02022C78->unk_0000.unk_2C[i], 40); - gUnknown_02022C78->unk_01F7[i][40] = EOS; - if (i > 7 && gUnknown_02022C78->unk_01F7[i][0] != EOS) - ++gUnknown_02022C78->unk_01C4; + memcpy(sWonderNewsData->unk_01F7[i], sWonderNewsData->unk_0000.unk_2C[i], 40); + sWonderNewsData->unk_01F7[i][40] = EOS; + if (i > 7 && sWonderNewsData->unk_01F7[i][0] != EOS) + ++sWonderNewsData->unk_01C4; } - gUnknown_02022C78->unk_0394 = gUnknown_082F1DF8; - gUnknown_02022C78->unk_0394.fullyDownThreshold = gUnknown_02022C78->unk_01C4; + sWonderNewsData->unk_0394 = gUnknown_082F1DF8; + sWonderNewsData->unk_0394.fullyDownThreshold = sWonderNewsData->unk_01C4; } void sub_801CE7C(void) { u8 i = 0; s32 x; - PutWindowTilemap(gUnknown_02022C78->unk_01C8[0]); - PutWindowTilemap(gUnknown_02022C78->unk_01C8[1]); - FillWindowPixelBuffer(gUnknown_02022C78->unk_01C8[0], 0); - FillWindowPixelBuffer(gUnknown_02022C78->unk_01C8[1], 0); - x = (0xe0 - GetStringWidth(3, gUnknown_02022C78->unk_01CE, GetFontAttribute(3, 2))) / 2; + PutWindowTilemap(sWonderNewsData->unk_01C8[0]); + PutWindowTilemap(sWonderNewsData->unk_01C8[1]); + FillWindowPixelBuffer(sWonderNewsData->unk_01C8[0], 0); + FillWindowPixelBuffer(sWonderNewsData->unk_01C8[1], 0); + x = (0xe0 - GetStringWidth(3, sWonderNewsData->unk_01CE, GetFontAttribute(3, 2))) / 2; if (x < 0) x = 0; - AddTextPrinterParameterized3(gUnknown_02022C78->unk_01C8[0], 3, x, 6, gUnknown_082F1DE0[gUnknown_02022C78->unk_01BC->textPal1], 0, gUnknown_02022C78->unk_01CE); + AddTextPrinterParameterized3(sWonderNewsData->unk_01C8[0], 3, x, 6, gUnknown_082F1DE0[sWonderNewsData->unk_01BC->textPal1], 0, sWonderNewsData->unk_01CE); for (; i < 10; ++i) { - AddTextPrinterParameterized3(gUnknown_02022C78->unk_01C8[1], 3, 0, 16 * i + 2, gUnknown_082F1DE0[gUnknown_02022C78->unk_01BC->textPal2], 0, gUnknown_02022C78->unk_01F7[i]); + AddTextPrinterParameterized3(sWonderNewsData->unk_01C8[1], 3, 0, 16 * i + 2, gUnknown_082F1DE0[sWonderNewsData->unk_01BC->textPal2], 0, sWonderNewsData->unk_01F7[i]); } - CopyWindowToVram(gUnknown_02022C78->unk_01C8[0], 3); - CopyWindowToVram(gUnknown_02022C78->unk_01C8[1], 3); + CopyWindowToVram(sWonderNewsData->unk_01C8[0], 3); + CopyWindowToVram(sWonderNewsData->unk_01C8[1], 3); } void sub_801CFA4(void) { - u16 r4 = gUnknown_02022C78->unk_01C2_1; + u16 r4 = sWonderNewsData->unk_01C2_1; r4 <<= 8; - if (gUnknown_02022C78->unk_01C3_0) + if (sWonderNewsData->unk_01C3_0) { ChangeBgY(2, r4, 1); ChangeBgY(3, r4, 1); @@ -813,14 +813,14 @@ void sub_801CFA4(void) ChangeBgY(2, r4, 2); ChangeBgY(3, r4, 2); } - gUnknown_02022C78->unk_01C3_1 += gUnknown_02022C78->unk_01C2_1; - if (gUnknown_02022C78->unk_01C3_1 > 15) + sWonderNewsData->unk_01C3_1 += sWonderNewsData->unk_01C2_1; + if (sWonderNewsData->unk_01C3_1 > 15) { - if (gUnknown_02022C78->unk_01C3_0) - ++gUnknown_02022C78->unk_01C6; + if (sWonderNewsData->unk_01C3_0) + ++sWonderNewsData->unk_01C6; else - --gUnknown_02022C78->unk_01C6; - gUnknown_02022C78->unk_01C2_0 = FALSE; - gUnknown_02022C78->unk_01C3_1 = 0; + --sWonderNewsData->unk_01C6; + sWonderNewsData->unk_01C2_0 = FALSE; + sWonderNewsData->unk_01C3_1 = 0; } } diff --git a/src/mevent_news.c b/src/mevent_news.c index f5a061c84..192bb0fc7 100644 --- a/src/mevent_news.c +++ b/src/mevent_news.c @@ -10,7 +10,7 @@ static u32 sub_801DD44(struct MysteryEventStruct *); static void sub_801DCD8(struct MysteryEventStruct *); static void sub_801DCCC(struct MysteryEventStruct *); -void sub_801DB68(u32 a0) +void GenerateRandomNews(u32 a0) { struct MysteryEventStruct *r5 = sub_801B044(); @@ -59,7 +59,7 @@ u16 sub_801DC20(void) struct MysteryEventStruct *r4 = sub_801B044(); u16 r5; - if (!IsMysteryEventEnabled() || !sub_801B0CC()) + if (!IsMysteryEventEnabled() || !ValidateReceivedWonderNews()) return 0; r5 = sub_801DD44(r4); diff --git a/src/mystery_event_menu.c b/src/mystery_event_menu.c index ad4a2e692..850b22d5b 100644 --- a/src/mystery_event_menu.c +++ b/src/mystery_event_menu.c @@ -94,7 +94,7 @@ void CB2_InitMysteryEventMenu(void) FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14); LoadUserWindowBorderGfx(0, 1u, 0xD0u); - sub_81978B0(0xE0); + Menu_LoadStdPalAt(0xE0); SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON); SetGpuReg(REG_OFFSET_BLDCNT, 0); CreateTask(Task_DestroySelf, 0); diff --git a/src/mystery_gift.c b/src/mystery_gift.c index 5e000a249..c8b3a9060 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -35,28 +35,29 @@ void bgid_upload_textbox_1(u8 bgId); void task_add_00_mystery_gift(void); void task00_mystery_gift(u8 taskId); -EWRAM_DATA u8 gUnknown_02022C58[2] = {}; +EWRAM_DATA u8 sDownArrowCounterAndYCoordIdx[8] = {}; +EWRAM_DATA bool8 gGiftIsFromEReader = FALSE; -const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal"); -const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz"); +static const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal"); +static const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz"); struct MysteryGiftTaskData { - u16 unk0; + u16 curPromptWindowId; u16 unk2; u16 unk4; u16 unk6; - u8 unk8; - u8 unk9; + u8 state; + u8 textState; u8 unkA; u8 unkB; - u8 unkC; - u8 unkD; - u8 unkE; - u8 * unk10; + u8 IsCardOrNews; + u8 source; + u8 prevPromptWindowId; + u8 * buffer; }; -const struct BgTemplate gUnknown_082F0598[] = { +static const struct BgTemplate sBGTemplates[] = { { .bg = 0, .charBaseIndex = 2, @@ -92,7 +93,7 @@ const struct BgTemplate gUnknown_082F0598[] = { } }; -const struct WindowTemplate gUnknown_082F05A8[] = { +static const struct WindowTemplate sMainWindows[] = { { .bg = 0x00, .tilemapLeft = 0x00, @@ -122,7 +123,7 @@ const struct WindowTemplate gUnknown_082F05A8[] = { } }; -const struct WindowTemplate gUnknown_082F05C8 = { +static const struct WindowTemplate sWindowTemplate_PromptYesOrNo_Width28 = { .bg = 0x00, .tilemapLeft = 0x01, .tilemapTop = 0x0f, @@ -132,7 +133,7 @@ const struct WindowTemplate gUnknown_082F05C8 = { .baseBlock = 0x00e5 }; -const struct WindowTemplate gUnknown_082F05D0 = { +static const struct WindowTemplate sWindowTemplate_PromptYesOrNo_Width20 = { .bg = 0x00, .tilemapLeft = 0x01, .tilemapTop = 0x0f, @@ -142,7 +143,7 @@ const struct WindowTemplate gUnknown_082F05D0 = { .baseBlock = 0x00e5 }; -const struct WindowTemplate gUnknown_082F05D8 = { +static const struct WindowTemplate sMysteryGiftMenuWindowTemplate = { .bg = 0x00, .tilemapLeft = 0x01, .tilemapTop = 0x0f, @@ -152,7 +153,7 @@ const struct WindowTemplate gUnknown_082F05D8 = { .baseBlock = 0x00e5 }; -const struct WindowTemplate gUnknown_082F05E0 = { +static const struct WindowTemplate sWindowTemplate_ThreeOptions = { .bg = 0x00, .tilemapLeft = 0x08, .tilemapTop = 0x06, @@ -162,7 +163,7 @@ const struct WindowTemplate gUnknown_082F05E0 = { .baseBlock = 0x0155 }; -const struct WindowTemplate gUnknown_082F05E8 = { +static const struct WindowTemplate sWindowTemplate_YesNoBox = { .bg = 0x00, .tilemapLeft = 0x17, .tilemapTop = 0x0f, @@ -172,7 +173,7 @@ const struct WindowTemplate gUnknown_082F05E8 = { .baseBlock = 0x0155 }; -const struct WindowTemplate gUnknown_082F05F0 = { +static const struct WindowTemplate sWindowTemplate_7by8 = { .bg = 0x00, .tilemapLeft = 0x16, .tilemapTop = 0x0b, @@ -182,7 +183,7 @@ const struct WindowTemplate gUnknown_082F05F0 = { .baseBlock = 0x0155 }; -const struct WindowTemplate gUnknown_082F05F8 = { +static const struct WindowTemplate sWindowTemplate_7by6 = { .bg = 0x00, .tilemapLeft = 0x16, .tilemapTop = 0x0d, @@ -192,7 +193,7 @@ const struct WindowTemplate gUnknown_082F05F8 = { .baseBlock = 0x0155 }; -const struct WindowTemplate gUnknown_082F0600 = { +static const struct WindowTemplate sWindowTemplate_7by4 = { .bg = 0x00, .tilemapLeft = 0x16, .tilemapTop = 0x0f, @@ -202,19 +203,19 @@ const struct WindowTemplate gUnknown_082F0600 = { .baseBlock = 0x0155 }; -const struct ListMenuItem gUnknown_082F0608[] = { +static const struct ListMenuItem sListMenuItems_CardsOrNews[] = { { gText_WonderCards, 0 }, { gText_WonderNews, 1 }, { gText_Exit3, -2 } }; -const struct ListMenuItem gUnknown_082F0620[] = { +static const struct ListMenuItem sListMenuItems_WirelessOrFriend[] = { { gText_WirelessCommunication, 0 }, { gText_Friend2, 1 }, { gText_Cancel2, -2 } }; -const struct ListMenuTemplate gUnknown_082F0638 = { +static const struct ListMenuTemplate sListMenuTemplate_ThreeOptions = { .items = NULL, .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .itemPrintFunc = NULL, @@ -235,32 +236,32 @@ const struct ListMenuTemplate gUnknown_082F0638 = { .cursorKind = 0 }; -const struct ListMenuItem gUnknown_082F0650[] = { +static const struct ListMenuItem sListMenuItems_ReceiveSendToss[] = { { gText_Receive, 0 }, { gText_Send, 1 }, { gText_Toss, 2 }, { gText_Cancel2, -2 } }; -const struct ListMenuItem gUnknown_082F0670[] = { +static const struct ListMenuItem sListMenuItems_ReceiveToss[] = { { gText_Receive, 0 }, { gText_Toss, 2 }, { gText_Cancel2, -2 } }; -const struct ListMenuItem gUnknown_082F0688[] = { +static const struct ListMenuItem sListMenuItems_ReceiveSend[] = { { gText_Receive, 0 }, { gText_Send, 1 }, { gText_Cancel2, -2 } }; -const struct ListMenuItem gUnknown_082F06A0[] = { +static const struct ListMenuItem sListMenuItems_Receive[] = { { gText_Receive, 0 }, { gText_Cancel2, -2 } }; -const struct ListMenuTemplate gUnknown_082F06B0 = { - .items = gUnknown_082F0650, +static const struct ListMenuTemplate sListMenu_ReceiveSendToss = { + .items = sListMenuItems_ReceiveSendToss, .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .itemPrintFunc = NULL, .totalItems = 4, @@ -280,8 +281,8 @@ const struct ListMenuTemplate gUnknown_082F06B0 = { .cursorKind = 0 }; -const struct ListMenuTemplate gUnknown_082F06C8 = { - .items = gUnknown_082F0670, +static const struct ListMenuTemplate sListMenu_ReceiveToss = { + .items = sListMenuItems_ReceiveToss, .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .itemPrintFunc = NULL, .totalItems = 3, @@ -301,8 +302,8 @@ const struct ListMenuTemplate gUnknown_082F06C8 = { .cursorKind = 0 }; -const struct ListMenuTemplate gUnknown_082F06E0 = { - .items = gUnknown_082F0688, +static const struct ListMenuTemplate sListMenu_ReceiveSend = { + .items = sListMenuItems_ReceiveSend, .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .itemPrintFunc = NULL, .totalItems = 3, @@ -322,8 +323,8 @@ const struct ListMenuTemplate gUnknown_082F06E0 = { .cursorKind = 0 }; -const struct ListMenuTemplate gUnknown_082F06F8 = { - .items = gUnknown_082F06A0, +static const struct ListMenuTemplate sListMenu_Receive = { + .items = sListMenuItems_Receive, .moveCursorFunc = ListMenuDefaultCursorMoveFunc, .itemPrintFunc = NULL, .totalItems = 2, @@ -343,25 +344,25 @@ const struct ListMenuTemplate gUnknown_082F06F8 = { .cursorKind = 0 }; -const u8 *const Unref_082F0710[] = { +static const u8 *const Unref_082F0710[] = { gText_VarietyOfEventsImportedWireless, gText_WonderCardsInPossession, gText_ReadNewsThatArrived, gText_ReturnToTitle }; -ALIGNED(2) const u8 gUnknown_082F0720[] = { 0, 1, 2 }; -ALIGNED(2) const u8 gUnknown_082F0724[] = { 0, 1, 2 }; -ALIGNED(2) const u8 gUnknown_082F0728[] = { 1, 2, 3 }; +ALIGNED(2) const u8 sMG_Ereader_TextColor_1[] = { 0, 1, 2 }; +ALIGNED(2) const u8 sMG_Ereader_TextColor_1_Copy[] = { 0, 1, 2 }; +ALIGNED(2) const u8 sMG_Ereader_TextColor_2[] = { 1, 2, 3 }; -void sub_8018424(void) +void vblankcb_mystery_gift_e_reader_run(void) { ProcessSpriteCopyRequests(); LoadOam(); TransferPlttBuffer(); } -void sub_8018438(void) +void c2_mystery_gift_e_reader_run(void) { RunTasks(); RunTextPrinters(); @@ -369,7 +370,7 @@ void sub_8018438(void) BuildOamBuffer(); } -bool32 sub_8018450(s32 arg) +bool32 HandleMysteryGiftOrEReaderSetup(s32 mg_or_ereader) { switch (gMain.state) { @@ -382,7 +383,7 @@ bool32 sub_8018450(s32 arg) ScanlineEffect_Stop(); ResetBgsAndClearDma3BusyFlags(0); - InitBgsFromTemplates(0, gUnknown_082F0598, ARRAY_COUNT(gUnknown_082F0598)); + InitBgsFromTemplates(0, sBGTemplates, ARRAY_COUNT(sBGTemplates)); ChangeBgX(0, 0, 0); ChangeBgY(0, 0, 0); ChangeBgX(1, 0, 0); @@ -398,7 +399,7 @@ bool32 sub_8018450(s32 arg) SetBgTilemapBuffer(0, Alloc(0x800)); bgid_upload_textbox_1(3); - InitWindows(gUnknown_082F05A8); + InitWindows(sMainWindows); DeactivateAllTextPrinters(); ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON); SetGpuReg(REG_OFFSET_BLDCNT, 0); @@ -409,14 +410,14 @@ bool32 sub_8018450(s32 arg) case 1: LoadPalette(gUnkTextboxBorderPal, 0, 0x20); LoadPalette(stdpal_get(2), 0xd0, 0x20); - sub_81978B0(0xC0); + Menu_LoadStdPalAt(0xC0); LoadUserWindowBorderGfx(0, 0xA, 0xE0); LoadUserWindowBorderGfx_(0, 0x1, 0xF0); FillBgTilemapBufferRect(0, 0x000, 0, 0, 32, 32, 0x11); FillBgTilemapBufferRect(1, 0x000, 0, 0, 32, 32, 0x11); FillBgTilemapBufferRect(2, 0x000, 0, 0, 32, 32, 0x11); - sub_8018798(3); - sub_80186EC(arg, 0); + MG_DrawCheckerboardPattern(3); + PrintMysteryGiftOrEReaderTopMenu(mg_or_ereader, 0); gMain.state++; break; case 2: @@ -430,7 +431,7 @@ bool32 sub_8018450(s32 arg) ShowBg(0); ShowBg(3); PlayBGM(MUS_RG_OKURIMONO); - SetVBlankCallback(sub_8018424); + SetVBlankCallback(vblankcb_mystery_gift_e_reader_run); EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_VCOUNT | INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL); return TRUE; } @@ -440,28 +441,28 @@ bool32 sub_8018450(s32 arg) void c2_mystery_gift(void) { - if (sub_8018450(0)) + if (HandleMysteryGiftOrEReaderSetup(0)) { - SetMainCallback2(sub_8018438); - gUnknown_02022C60 = FALSE; + SetMainCallback2(c2_mystery_gift_e_reader_run); + gGiftIsFromEReader = FALSE; task_add_00_mystery_gift(); } RunTasks(); } -void sub_801867C(void) +void c2_ereader(void) { - if (sub_8018450(1)) + if (HandleMysteryGiftOrEReaderSetup(1)) { - SetMainCallback2(sub_8018438); - gUnknown_02022C60 = TRUE; - sub_81D5014(); + SetMainCallback2(c2_mystery_gift_e_reader_run); + gGiftIsFromEReader = TRUE; + task_add_00_ereader(); } } -void sub_80186A4(void) +void MainCB_FreeAllBuffersAndReturnToInitTitleScreen(void) { - gUnknown_02022C60 = FALSE; + gGiftIsFromEReader = FALSE; FreeAllWindowBuffers(); Free(GetBgTilemapBuffer(0)); Free(GetBgTilemapBuffer(1)); @@ -470,12 +471,12 @@ void sub_80186A4(void) SetMainCallback2(CB2_InitTitleScreen); } -void sub_80186EC(bool8 isJapanese, bool32 usePickOkCancel) +void PrintMysteryGiftOrEReaderTopMenu(bool8 mg_or_ereader, bool32 usePickOkCancel) { const u8 * header; const u8 * options; FillWindowPixelBuffer(0, 0); - if (!isJapanese) + if (mg_or_ereader == 0) { header = gText_MysteryGift; options = !usePickOkCancel ? gText_PickOKExit : gText_PickOKCancel; @@ -486,18 +487,18 @@ void sub_80186EC(bool8 isJapanese, bool32 usePickOkCancel) options = gJPText_DecideStop; } - AddTextPrinterParameterized4(0, 1, 4, 1, 0, 0, gUnknown_082F0720, -1, header); - AddTextPrinterParameterized4(0, 0, GetStringRightAlignXOffset(0, options, 0xDE), 1, 0, 0, gUnknown_082F0720, -1, options); + AddTextPrinterParameterized4(0, 1, 4, 1, 0, 0, sMG_Ereader_TextColor_1, -1, header); + AddTextPrinterParameterized4(0, 0, GetStringRightAlignXOffset(0, options, 0xDE), 1, 0, 0, sMG_Ereader_TextColor_1, -1, options); CopyWindowToVram(0, 2); PutWindowTilemap(0); } -void sub_8018784(u8 windowId) +void MG_DrawTextBorder(u8 windowId) { - sub_8098858(windowId, 0x01, 0xF); + DrawTextBorderOuter(windowId, 0x01, 0xF); } -void sub_8018798(u32 bg) +void MG_DrawCheckerboardPattern(u32 bg) { s32 i = 0, j; @@ -519,9 +520,9 @@ void sub_8018798(u32 bg) } } -void sub_8018838(bool32 arg) +void ClearScreenInBg0(bool32 ignoreTopTwoRows) { - switch (arg) + switch (ignoreTopTwoRows) { case 0: FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0x11); @@ -533,32 +534,32 @@ void sub_8018838(bool32 arg) CopyBgTilemapBufferToVram(0); } -void sub_8018884(const u8 *str) +void AddTextPrinterToWindow1(const u8 *str) { StringExpandPlaceholders(gStringVar4, str); FillWindowPixelBuffer(1, 0x11); - AddTextPrinterParameterized4(1, 1, 0, 1, 0, 0, gUnknown_082F0728, 0, gStringVar4); - sub_8098858(1, 0x001, 0xF); + AddTextPrinterParameterized4(1, 1, 0, 1, 0, 0, sMG_Ereader_TextColor_2, 0, gStringVar4); + DrawTextBorderOuter(1, 0x001, 0xF); PutWindowTilemap(1); CopyWindowToVram(1, 3); } -void sub_80188DC(void) +static void ClearTextWindow(void) { rbox_fill_rectangle(1); ClearWindowTilemap(1); CopyWindowToVram(1, 1); } -bool32 mevent_0814257C(u8 *textState, const u8 *str) +bool32 MG_PrintTextOnWindow1AndWaitButton(u8 *textState, const u8 *str) { switch (*textState) { case 0: - sub_8018884(str); + AddTextPrinterToWindow1(str); goto inc; case 1: - DrawDownArrow(1, 0xD0, 0x14, 1, FALSE, &gUnknown_02022C58[0], &gUnknown_02022C58[1]); + DrawDownArrow(1, 0xD0, 0x14, 1, FALSE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]); if (({gMain.newKeys & (A_BUTTON | B_BUTTON);})) { inc: @@ -566,9 +567,9 @@ bool32 mevent_0814257C(u8 *textState, const u8 *str) } break; case 2: - DrawDownArrow(1, 0xD0, 0x14, 1, TRUE, &gUnknown_02022C58[0], &gUnknown_02022C58[1]); + DrawDownArrow(1, 0xD0, 0x14, 1, TRUE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]); *textState = 0; - sub_80188DC(); + ClearTextWindow(); return TRUE; case 0xFF: *textState = 2; @@ -577,45 +578,45 @@ bool32 mevent_0814257C(u8 *textState, const u8 *str) return FALSE; } -void sub_801898C(void) +static void HideDownArrow(void) { - DrawDownArrow(1, 0xD0, 0x14, 1, FALSE, &gUnknown_02022C58[0], &gUnknown_02022C58[1]); + DrawDownArrow(1, 0xD0, 0x14, 1, FALSE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]); } -void sub_80189B4(void) +static void ShowDownArrow(void) { - DrawDownArrow(1, 0xD0, 0x14, 1, TRUE, &gUnknown_02022C58[0], &gUnknown_02022C58[1]); + DrawDownArrow(1, 0xD0, 0x14, 1, TRUE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]); } -bool32 sub_80189DC(u8 * textState) +bool32 unref_HideDownArrowAndWaitButton(u8 * textState) { switch (*textState) { case 0: - sub_801898C(); + HideDownArrow(); if (({gMain.newKeys & (A_BUTTON | B_BUTTON);})) { (*textState)++; } break; case 1: - sub_80189B4(); + ShowDownArrow(); *textState = 0; return TRUE; } return FALSE; } -bool32 sub_8018A1C(u8 * counter, const u8 * str) +static bool32 PrintStringAndWait2Seconds(u8 * counter, const u8 * str) { if (*counter == 0) { - sub_8018884(str); + AddTextPrinterToWindow1(str); } if (++(*counter) > 120) { *counter = 0; - sub_80188DC(); + ClearTextWindow(); return TRUE; } else @@ -624,45 +625,45 @@ bool32 sub_8018A1C(u8 * counter, const u8 * str) } } -u32 sub_8018A50(u8 * unused0, u16 * unused1, bool8 r2) +static u32 MysteryGift_HandleThreeOptionMenu(u8 * unused0, u16 * unused1, u8 whichMenu) { - struct ListMenuTemplate listMenuTemplate = gUnknown_082F0638; - struct WindowTemplate windowTemplate = gUnknown_082F05E0; - s32 r3; - s32 r4; + struct ListMenuTemplate listMenuTemplate = sListMenuTemplate_ThreeOptions; + struct WindowTemplate windowTemplate = sWindowTemplate_ThreeOptions; + s32 width; + s32 response; - if (r2 == FALSE) + if (whichMenu == 0) { - listMenuTemplate.items = gUnknown_082F0608; + listMenuTemplate.items = sListMenuItems_CardsOrNews; } else { - listMenuTemplate.items = gUnknown_082F0620; + listMenuTemplate.items = sListMenuItems_WirelessOrFriend; } - r3 = sub_81DB41C(&listMenuTemplate); - if (r3 & 1) + width = Intl_GetListMenuWidth(&listMenuTemplate); + if (width & 1) { - r3++; + width++; } - windowTemplate.width = r3; - if (r3 < 30) + windowTemplate.width = width; + if (width < 30) { - windowTemplate.tilemapLeft = (30 - r3) / 2; + windowTemplate.tilemapLeft = (30 - width) / 2; } else { windowTemplate.tilemapLeft = 0; } - r4 = DoMysteryGiftListMenu(&windowTemplate, &listMenuTemplate, 1, 0x00A, 0xE0); - if (r4 != -1) + response = DoMysteryGiftListMenu(&windowTemplate, &listMenuTemplate, 1, 0x00A, 0xE0); + if (response != -1) { ClearWindowTilemap(2); CopyWindowToVram(2, 1); } - return r4; + return response; } -s8 sub_8018B08(u8 * textState, u16 * windowId, bool8 r6, const u8 * str) +s8 mevent_message_print_and_prompt_yes_no(u8 * textState, u16 * windowId, bool8 yesNoBoxPlacement, const u8 * str) { struct WindowTemplate windowTemplate; s8 input; @@ -671,24 +672,24 @@ s8 sub_8018B08(u8 * textState, u16 * windowId, bool8 r6, const u8 * str) { case 0: StringExpandPlaceholders(gStringVar4, str); - if (r6 == 0) + if (yesNoBoxPlacement == 0) { - *windowId = AddWindow(&gUnknown_082F05C8); + *windowId = AddWindow(&sWindowTemplate_PromptYesOrNo_Width28); } else { - *windowId = AddWindow(&gUnknown_082F05D0); + *windowId = AddWindow(&sWindowTemplate_PromptYesOrNo_Width20); } FillWindowPixelBuffer(*windowId, 0x11); - AddTextPrinterParameterized4(*windowId, 1, 0, 1, 0, 0, gUnknown_082F0728, 0, gStringVar4); - sub_8098858(*windowId, 0x001, 0x0F); + AddTextPrinterParameterized4(*windowId, 1, 0, 1, 0, 0, sMG_Ereader_TextColor_2, 0, gStringVar4); + DrawTextBorderOuter(*windowId, 0x001, 0x0F); CopyWindowToVram(*windowId, 2); PutWindowTilemap(*windowId); (*textState)++; break; case 1: - windowTemplate = gUnknown_082F05E8; - if (r6 == 0) + windowTemplate = sWindowTemplate_YesNoBox; + if (yesNoBoxPlacement == 0) { windowTemplate.tilemapTop = 9; } @@ -723,7 +724,7 @@ s8 sub_8018B08(u8 * textState, u16 * windowId, bool8 r6, const u8 * str) return -2; } -s32 sub_8018C4C(u8 * textState, u16 * windowId, bool32 r2, bool32 r3) +static s32 HandleMysteryGiftListMenu(u8 * textState, u16 * windowId, bool32 cannotToss, bool32 cannotSend) { struct WindowTemplate windowTemplate; s32 input; @@ -731,7 +732,7 @@ s32 sub_8018C4C(u8 * textState, u16 * windowId, bool32 r2, bool32 r3) switch (*textState) { case 0: - if (r2 == 0) + if (cannotToss == 0) { StringExpandPlaceholders(gStringVar4, gText_WhatToDoWithCards); } @@ -739,36 +740,36 @@ s32 sub_8018C4C(u8 * textState, u16 * windowId, bool32 r2, bool32 r3) { StringExpandPlaceholders(gStringVar4, gText_WhatToDoWithNews); } - *windowId = AddWindow(&gUnknown_082F05D8); + *windowId = AddWindow(&sMysteryGiftMenuWindowTemplate); FillWindowPixelBuffer(*windowId, 0x11); - AddTextPrinterParameterized4(*windowId, 1, 0, 1, 0, 0, gUnknown_082F0728, 0, gStringVar4); - sub_8098858(*windowId, 0x001, 0x0F); + AddTextPrinterParameterized4(*windowId, 1, 0, 1, 0, 0, sMG_Ereader_TextColor_2, 0, gStringVar4); + DrawTextBorderOuter(*windowId, 0x001, 0x0F); CopyWindowToVram(*windowId, 2); PutWindowTilemap(*windowId); (*textState)++; break; case 1: - windowTemplate = gUnknown_082F05E8; - if (r3) + windowTemplate = sWindowTemplate_YesNoBox; + if (cannotSend) { - if (r2 == 0) + if (cannotToss == 0) { - input = DoMysteryGiftListMenu(&gUnknown_082F05F8, &gUnknown_082F06C8, 1, 0x00A, 0xE0); + input = DoMysteryGiftListMenu(&sWindowTemplate_7by6, &sListMenu_ReceiveToss, 1, 0x00A, 0xE0); } else { - input = DoMysteryGiftListMenu(&gUnknown_082F0600, &gUnknown_082F06F8, 1, 0x00A, 0xE0); + input = DoMysteryGiftListMenu(&sWindowTemplate_7by4, &sListMenu_Receive, 1, 0x00A, 0xE0); } } else { - if (r2 == 0) + if (cannotToss == 0) { - input = DoMysteryGiftListMenu(&gUnknown_082F05F0, &gUnknown_082F06B0, 1, 0x00A, 0xE0); + input = DoMysteryGiftListMenu(&sWindowTemplate_7by8, &sListMenu_ReceiveSendToss, 1, 0x00A, 0xE0); } else { - input = DoMysteryGiftListMenu(&gUnknown_082F05F8, &gUnknown_082F06E0, 1, 0x00A, 0xE0); + input = DoMysteryGiftListMenu(&sWindowTemplate_7by6, &sListMenu_ReceiveSend, 1, 0x00A, 0xE0); } } if (input != -1) @@ -793,39 +794,39 @@ s32 sub_8018C4C(u8 * textState, u16 * windowId, bool32 r2, bool32 r3) return -1; } -s32 sub_8018D98(bool32 a0) +static bool32 ValidateCardOrNews(bool32 cardOrNews) { - if (a0 == 0) + if (cardOrNews == 0) { - return sub_801B27C(); + return ValidateReceivedWonderCard(); } else { - return sub_801B0CC(); + return ValidateReceivedWonderNews(); } } -bool32 sub_8018DAC(u8 * state, bool32 arg1) +static bool32 HandleLoadWonderCardOrNews(u8 * state, bool32 cardOrNews) { s32 v0; switch (*state) { case 0: - if (arg1 == 0) + if (cardOrNews == 0) { - sub_801BAAC(sav1_get_mevent_buffer_1(), sav1_get_mevent_buffer_2()); + InitWonderCardResources(sav1_get_mevent_buffer_1(), sav1_get_mevent_buffer_2()); } else { - sub_801C6C8(sub_801B00C()); + InitWonderNewsResources(sav1_get_mevent_buffer_0()); } (*state)++; break; case 1: - if (arg1 == 0) + if (cardOrNews == 0) { - v0 = sub_801BB74(); + v0 = FadeToWonderCardMenu(); check: if (v0 != 0) { @@ -835,7 +836,7 @@ bool32 sub_8018DAC(u8 * state, bool32 arg1) } else { - v0 = sub_801C758(); + v0 = FadeToWonderNewsMenu(); goto check; } done: @@ -846,26 +847,26 @@ bool32 sub_8018DAC(u8 * state, bool32 arg1) return FALSE; } -bool32 sub_8018E08(bool32 arg0) +static bool32 DestroyNewsOrCard(bool32 cardOrNews) { - if (arg0 == 0) + if (cardOrNews == 0) { - sub_801B1E8(); + DestroyWonderCard(); } else { - sub_801B06C(); + DestroyWonderNews(); } return TRUE; } -bool32 sub_8018E20(bool32 arg0, bool32 arg1) +static bool32 TearDownCardOrNews_ReturnToTopMenu(bool32 cardOrNews, bool32 arg1) { - if (arg0 == 0) + if (cardOrNews == 0) { - if (sub_801BDA4(arg1) != 0) + if (FadeOutFromWonderCard(arg1) != 0) { - sub_801BB48(); + DestroyWonderCardResources(); return TRUE; } else @@ -875,9 +876,9 @@ bool32 sub_8018E20(bool32 arg0, bool32 arg1) } else { - if (sub_801CA50(arg1) != 0) + if (FadeOutFromWonderNews(arg1) != 0) { - sub_801C72C(); + DestroyWonderNewsResources(); return TRUE; } else @@ -887,36 +888,36 @@ bool32 sub_8018E20(bool32 arg0, bool32 arg1) } } -s32 sub_8018E50(u8 * textState, u16 * windowId, bool32 r2) +static s32 mevent_message_prompt_discard(u8 * textState, u16 * windowId, bool32 cardOrNews) { - if (r2 == 0) + if (cardOrNews == 0) { - return sub_8018B08(textState, windowId, TRUE, gText_IfThrowAwayCardEventWontHappen); + return mevent_message_print_and_prompt_yes_no(textState, windowId, TRUE, gText_IfThrowAwayCardEventWontHappen); } else { - return sub_8018B08(textState, windowId, TRUE, gText_OkayToDiscardNews); + return mevent_message_print_and_prompt_yes_no(textState, windowId, TRUE, gText_OkayToDiscardNews); } } -bool32 mevent_message_was_thrown_away(u8 * textState, bool32 r1) +static bool32 mevent_message_was_thrown_away(u8 * textState, bool32 cardOrNews) { - if (r1 == 0) + if (cardOrNews == 0) { - return mevent_0814257C(textState, gText_WonderCardThrownAway); + return MG_PrintTextOnWindow1AndWaitButton(textState, gText_WonderCardThrownAway); } else { - return mevent_0814257C(textState, gText_WonderNewsThrownAway); + return MG_PrintTextOnWindow1AndWaitButton(textState, gText_WonderNewsThrownAway); } } -bool32 mevent_save_game(u8 * state) +static bool32 mevent_save_game(u8 * state) { switch (*state) { case 0: - sub_8018884(gText_DataWillBeSaved); + AddTextPrinterToWindow1(gText_DataWillBeSaved); (*state)++; break; case 1: @@ -924,7 +925,7 @@ bool32 mevent_save_game(u8 * state) (*state)++; break; case 2: - sub_8018884(gText_SaveCompletedPressA); + AddTextPrinterToWindow1(gText_SaveCompletedPressA); (*state)++; break; case 3: @@ -935,19 +936,19 @@ bool32 mevent_save_game(u8 * state) break; case 4: *state = 0; - sub_80188DC(); + ClearTextWindow(); return TRUE; } return FALSE; } -const u8 * mevent_message(u32 * a0, u8 a1, u8 a2, u32 a3) +static const u8 * mevent_message(u32 * a0, u8 a1, u8 cardOrNews, u32 msgId) { const u8 * msg = NULL; *a0 = 0; - switch (a3) + switch (msgId) { case 0: *a0 = 0; @@ -959,11 +960,11 @@ const u8 * mevent_message(u32 * a0, u8 a1, u8 a2, u32 a3) break; case 2: *a0 = 1; - msg = a2 == 0 ? gText_WonderCardReceived : gText_WonderCardReceivedFrom; + msg = cardOrNews == 0 ? gText_WonderCardReceived : gText_WonderCardReceivedFrom; break; case 3: *a0 = 1; - msg = a2 == 0 ? gText_WonderNewsReceived : gText_WonderNewsReceivedFrom; + msg = cardOrNews == 0 ? gText_WonderNewsReceived : gText_WonderNewsReceivedFrom; break; case 4: *a0 = 1; @@ -1012,14 +1013,14 @@ const u8 * mevent_message(u32 * a0, u8 a1, u8 a2, u32 a3) return msg; } -bool32 mevent_08142CE8(u8 * state, const u8 * arg1, u16 * arg2) +static bool32 PrintMGSuccessMessage(u8 * state, const u8 * arg1, u16 * arg2) { switch (*state) { case 0: if (arg1 != NULL) { - sub_8018884(arg1); + AddTextPrinterToWindow1(arg1); } PlayFanfare(MUS_FANFA4); *arg2 = 0; @@ -1035,7 +1036,7 @@ bool32 mevent_08142CE8(u8 * state, const u8 * arg1, u16 * arg2) if (IsFanfareTaskInactive()) { *state = 0; - sub_80188DC(); + ClearTextWindow(); return TRUE; } break; @@ -1043,11 +1044,11 @@ bool32 mevent_08142CE8(u8 * state, const u8 * arg1, u16 * arg2) return FALSE; } -const u8 * mevent_message_stamp_card_etc_send_status(u32 * a0, u8 unused, u32 state) +static const u8 * mevent_message_stamp_card_etc_send_status(u32 * a0, u8 unused, u32 msgId) { const u8 * result = gText_CommunicationError; *a0 = 0; - switch (state) + switch (msgId) { case 0: result = gText_NothingSentOver; @@ -1100,17 +1101,17 @@ const u8 * mevent_message_stamp_card_etc_send_status(u32 * a0, u8 unused, u32 st return result; } -bool32 sub_8019174(u8 * state_p, u16 * arg1, u8 arg2, u32 state) +static bool32 PrintMGSendStatus(u8 * state, u16 * arg1, u8 arg2, u32 msgId) { u32 flag; - const u8 * str = mevent_message_stamp_card_etc_send_status(&flag, arg2, state); + const u8 * str = mevent_message_stamp_card_etc_send_status(&flag, arg2, msgId); if (flag) { - return mevent_08142CE8(state_p, str, arg1); + return PrintMGSuccessMessage(state, str, arg1); } else { - return mevent_0814257C(state_p, str); + return MG_PrintTextOnWindow1AndWaitButton(state, str); } } @@ -1118,18 +1119,18 @@ void task_add_00_mystery_gift(void) { u8 taskId = CreateTask(task00_mystery_gift, 0); struct MysteryGiftTaskData * data = (void *)gTasks[taskId].data; - data->unk8 = 0; - data->unk9 = 0; + data->state = 0; + data->textState = 0; data->unkA = 0; data->unkB = 0; - data->unkC = 0; - data->unkD = 0; - data->unk0 = 0; + data->IsCardOrNews = 0; + data->source = 0; + data->curPromptWindowId = 0; data->unk2 = 0; data->unk4 = 0; data->unk6 = 0; - data->unkE = 0; - data->unk10 = AllocZeroed(0x40); + data->prevPromptWindowId = 0; + data->buffer = AllocZeroed(0x40); } void task00_mystery_gift(u8 taskId) @@ -1138,95 +1139,95 @@ void task00_mystery_gift(u8 taskId) u32 sp0; const u8 * r1; - switch (data->unk8) + switch (data->state) { case 0: - data->unk8 = 1; + data->state = 1; break; case 1: - switch (sub_8018A50(&data->unk9, &data->unk0, FALSE)) + switch (MysteryGift_HandleThreeOptionMenu(&data->textState, &data->curPromptWindowId, FALSE)) { case 0: - data->unkC = 0; - if (sub_801B27C() == TRUE) + data->IsCardOrNews = 0; + if (ValidateReceivedWonderCard() == TRUE) { - data->unk8 = 18; + data->state = 18; } else { - data->unk8 = 2; + data->state = 2; } break; case 1: - data->unkC = 1; - if (sub_801B0CC() == TRUE) + data->IsCardOrNews = 1; + if (ValidateReceivedWonderNews() == TRUE) { - data->unk8 = 18; + data->state = 18; } else { - data->unk8 = 2; + data->state = 2; } break; case -2u: - data->unk8 = 37; + data->state = 37; break; } break; case 2: { - if (data->unkC == 0) + if (data->IsCardOrNews == 0) { - if (mevent_0814257C(&data->unk9, gText_DontHaveCardNewOneInput)) + if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, gText_DontHaveCardNewOneInput)) { - data->unk8 = 3; - sub_80186EC(0, 1); + data->state = 3; + PrintMysteryGiftOrEReaderTopMenu(0, 1); } } else { - if (mevent_0814257C(&data->unk9, gText_DontHaveNewsNewOneInput)) + if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, gText_DontHaveNewsNewOneInput)) { - data->unk8 = 3; - sub_80186EC(0, 1); + data->state = 3; + PrintMysteryGiftOrEReaderTopMenu(0, 1); } } break; } case 3: - if (data->unkC == 0) + if (data->IsCardOrNews == 0) { - sub_8018884(gText_WhereShouldCardBeAccessed); + AddTextPrinterToWindow1(gText_WhereShouldCardBeAccessed); } else { - sub_8018884(gText_WhereShouldNewsBeAccessed); + AddTextPrinterToWindow1(gText_WhereShouldNewsBeAccessed); } - data->unk8 = 4; + data->state = 4; break; case 4: - switch (sub_8018A50(&data->unk9, &data->unk0, TRUE)) + switch (MysteryGift_HandleThreeOptionMenu(&data->textState, &data->curPromptWindowId, TRUE)) { case 0: - sub_80188DC(); - data->unk8 = 5; - data->unkD = 0; + ClearTextWindow(); + data->state = 5; + data->source = 0; break; case 1: - sub_80188DC(); - data->unk8 = 5; - data->unkD = 1; + ClearTextWindow(); + data->state = 5; + data->source = 1; break; case -2u: - sub_80188DC(); - if (sub_8018D98(data->unkC)) + ClearTextWindow(); + if (ValidateCardOrNews(data->IsCardOrNews)) { - data->unk8 = 18; + data->state = 18; } else { - data->unk8 = 0; - sub_80186EC(0, 0); + data->state = 0; + PrintMysteryGiftOrEReaderTopMenu(0, 0); } break; } @@ -1238,245 +1239,245 @@ void task00_mystery_gift(u8 taskId) gStringVar2[0] = eos; gStringVar3[0] = eos; } - switch (data->unkC) + switch (data->IsCardOrNews) { case 0: - if (data->unkD == 1) + if (data->source == 1) { - sub_8014EFC(0x15); + MEvent_CreateTask_CardOrNewsWithFriend(0x15); } - else if (data->unkD == 0) + else if (data->source == 0) { - sub_80152A8(0x15); + MEvent_CreateTask_CardOrNewsOverWireless(0x15); } break; case 1: - if (data->unkD == 1) + if (data->source == 1) { - sub_8014EFC(0x16); + MEvent_CreateTask_CardOrNewsWithFriend(0x16); } - else if (data->unkD == 0) + else if (data->source == 0) { - sub_80152A8(0x16); + MEvent_CreateTask_CardOrNewsOverWireless(0x16); } break; } - data->unk8 = 6; + data->state = 6; break; case 6: if (gReceivedRemoteLinkPlayers != 0) { - sub_8018838(TRUE); - data->unk8 = 7; - sub_801D484(data->unkC); + ClearScreenInBg0(TRUE); + data->state = 7; + mevent_srv_ish_do_init(data->IsCardOrNews); } else if (gSpecialVar_Result == 5) { - sub_8018838(TRUE); - data->unk8 = 3; + ClearScreenInBg0(TRUE); + data->state = 3; } break; case 7: - sub_8018884(gText_Communicating); - data->unk8 = 8; + AddTextPrinterToWindow1(gText_Communicating); + data->state = 8; break; case 8: - switch (sub_801D4A8(&data->unk0)) + switch (mevent_srv_ish_do_exec(&data->curPromptWindowId)) { case 6: task_add_05_task_del_08FA224_when_no_RfuFunc(); - data->unkE = data->unk0; - data->unk8 = 13; + data->prevPromptWindowId = data->curPromptWindowId; + data->state = 13; break; case 5: - memcpy(data->unk10, sub_801D4F4(), 0x40); - sub_801D4E4(); + memcpy(data->buffer, mevent_srv_ish_get_buffer(), 0x40); + mevent_srv_ish_inc_flag(); break; case 3: - data->unk8 = 10; + data->state = 10; break; case 2: - data->unk8 = 9; + data->state = 9; break; case 4: - data->unk8 = 11; + data->state = 11; StringCopy(gStringVar1, gLinkPlayers[0].name); break; } break; case 9: - switch ((u32)sub_8018B08(&data->unk9, &data->unk0, FALSE, sub_801D4F4())) + switch ((u32)mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, mevent_srv_ish_get_buffer())) { case 0: - sub_801D500(0); - sub_801D4E4(); - data->unk8 = 7; + mevent_srv_ish_set_param(0); + mevent_srv_ish_inc_flag(); + data->state = 7; break; case 1: - sub_801D500(1); - sub_801D4E4(); - data->unk8 = 7; + mevent_srv_ish_set_param(1); + mevent_srv_ish_inc_flag(); + data->state = 7; break; case -1u: - sub_801D500(1); - sub_801D4E4(); - data->unk8 = 7; + mevent_srv_ish_set_param(1); + mevent_srv_ish_inc_flag(); + data->state = 7; break; } break; case 10: - if (mevent_0814257C(&data->unk9, sub_801D4F4())) + if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, mevent_srv_ish_get_buffer())) { - sub_801D4E4(); - data->unk8 = 7; + mevent_srv_ish_inc_flag(); + data->state = 7; } break; case 11: - switch ((u32)sub_8018B08(&data->unk9, &data->unk0, FALSE, gText_ThrowAwayWonderCard)) + switch ((u32)mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, gText_ThrowAwayWonderCard)) { case 0: - if (sub_801B3F8() == TRUE) + if (CheckReceivedGiftFromWonderCard() == TRUE) { - data->unk8 = 12; + data->state = 12; } else { - sub_801D500(0); - sub_801D4E4(); - data->unk8 = 7; + mevent_srv_ish_set_param(0); + mevent_srv_ish_inc_flag(); + data->state = 7; } break; case 1: - sub_801D500(1); - sub_801D4E4(); - data->unk8 = 7; + mevent_srv_ish_set_param(1); + mevent_srv_ish_inc_flag(); + data->state = 7; break; case -1u: - sub_801D500(1); - sub_801D4E4(); - data->unk8 = 7; + mevent_srv_ish_set_param(1); + mevent_srv_ish_inc_flag(); + data->state = 7; break; } break; case 12: - switch ((u32)sub_8018B08(&data->unk9, &data->unk0, FALSE, gText_HaventReceivedCardsGift)) + switch ((u32)mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, gText_HaventReceivedCardsGift)) { case 0: - sub_801D500(0); - sub_801D4E4(); - data->unk8 = 7; + mevent_srv_ish_set_param(0); + mevent_srv_ish_inc_flag(); + data->state = 7; break; case 1: - sub_801D500(1); - sub_801D4E4(); - data->unk8 = 7; + mevent_srv_ish_set_param(1); + mevent_srv_ish_inc_flag(); + data->state = 7; break; case -1u: - sub_801D500(1); - sub_801D4E4(); - data->unk8 = 7; + mevent_srv_ish_set_param(1); + mevent_srv_ish_inc_flag(); + data->state = 7; break; } break; case 13: if (gReceivedRemoteLinkPlayers == 0) { - sub_800E084(); - data->unk8 = 14; + DestroyWirelessStatusIndicatorSprite(); + data->state = 14; } break; case 14: - if (sub_8018A1C(&data->unk9, gText_CommunicationCompleted)) + if (PrintStringAndWait2Seconds(&data->textState, gText_CommunicationCompleted)) { - if (data->unkD == 1) + if (data->source == 1) { StringCopy(gStringVar1, gLinkPlayers[0].name); } - data->unk8 = 15; + data->state = 15; } break; case 15: { register bool32 flag asm("r1"); - r1 = mevent_message(&sp0, data->unkC, data->unkD, data->unkE); + r1 = mevent_message(&sp0, data->IsCardOrNews, data->source, data->prevPromptWindowId); if (r1 == NULL) { - r1 = data->unk10; + r1 = data->buffer; } if (sp0) { - flag = mevent_08142CE8(&data->unk9, r1, &data->unk0); + flag = PrintMGSuccessMessage(&data->textState, r1, &data->curPromptWindowId); } else { - flag = mevent_0814257C(&data->unk9, r1); + flag = MG_PrintTextOnWindow1AndWaitButton(&data->textState, r1); } if (flag) { - if (data->unkE == 3) + if (data->prevPromptWindowId == 3) { - if (data->unkD == 1) + if (data->source == 1) { - sub_801DB68(1); + GenerateRandomNews(1); } else { - sub_801DB68(2); + GenerateRandomNews(2); } } if (sp0 == 0) { - data->unk8 = 0; - sub_80186EC(0, 0); + data->state = 0; + PrintMysteryGiftOrEReaderTopMenu(0, 0); } else { - data->unk8 = 17; + data->state = 17; } } break; } case 16: - if (mevent_0814257C(&data->unk9, gText_CommunicationError)) + if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, gText_CommunicationError)) { - data->unk8 = 0; - sub_80186EC(0, 0); + data->state = 0; + PrintMysteryGiftOrEReaderTopMenu(0, 0); } break; case 17: - if (mevent_save_game(&data->unk9)) + if (mevent_save_game(&data->textState)) { - data->unk8 = 18; + data->state = 18; } break; case 18: - if (sub_8018DAC(&data->unk9, data->unkC)) + if (HandleLoadWonderCardOrNews(&data->textState, data->IsCardOrNews)) { - data->unk8 = 20; + data->state = 20; } break; case 20: - if (data->unkC == 0) + if (data->IsCardOrNews == 0) { if (({gMain.newKeys & A_BUTTON;})) { - data->unk8 = 21; + data->state = 21; } if (({gMain.newKeys & B_BUTTON;})) { - data->unk8 = 27; + data->state = 27; } } else { - switch (sub_801CCD0(gMain.newKeys)) + switch (MENews_GetInput(gMain.newKeys)) { case 0: - sub_801CC38(); - data->unk8 = 21; + MENews_RemoveScrollIndicatorArrowPair(); + data->state = 21; break; case 1: - data->unk8 = 27; + data->state = 27; break; } } @@ -1484,142 +1485,142 @@ void task00_mystery_gift(u8 taskId) case 21: { u32 result; - if (data->unkC == 0) + if (data->IsCardOrNews == 0) { - if (sub_801B308()) + if (WonderCard_Test_Unk_08_6()) { - result = sub_8018C4C(&data->unk9, &data->unk0, data->unkC, FALSE); + result = HandleMysteryGiftListMenu(&data->textState, &data->curPromptWindowId, data->IsCardOrNews, FALSE); } else { - result = sub_8018C4C(&data->unk9, &data->unk0, data->unkC, TRUE); + result = HandleMysteryGiftListMenu(&data->textState, &data->curPromptWindowId, data->IsCardOrNews, TRUE); } } else { - if (sub_801B128()) + if (WonderNews_Test_Unk_02()) { - result = sub_8018C4C(&data->unk9, &data->unk0, data->unkC, FALSE); + result = HandleMysteryGiftListMenu(&data->textState, &data->curPromptWindowId, data->IsCardOrNews, FALSE); } else { - result = sub_8018C4C(&data->unk9, &data->unk0, data->unkC, TRUE); + result = HandleMysteryGiftListMenu(&data->textState, &data->curPromptWindowId, data->IsCardOrNews, TRUE); } } switch (result) { case 0: - data->unk8 = 28; + data->state = 28; break; case 1: - data->unk8 = 29; + data->state = 29; break; case 2: - data->unk8 = 22; + data->state = 22; break; case -2u: - if (data->unkC == 1) + if (data->IsCardOrNews == 1) { - sub_801CC80(); + MENews_AddScrollIndicatorArrowPair(); } - data->unk8 = 20; + data->state = 20; break; } break; } case 22: - switch (sub_8018E50(&data->unk9, &data->unk0, data->unkC)) + switch (mevent_message_prompt_discard(&data->textState, &data->curPromptWindowId, data->IsCardOrNews)) { case 0: - if (data->unkC == 0 && sub_801B3F8() == TRUE) + if (data->IsCardOrNews == 0 && CheckReceivedGiftFromWonderCard() == TRUE) { - data->unk8 = 23; + data->state = 23; } else { - data->unk8 = 24; + data->state = 24; } break; case 1: - data->unk8 = 21; + data->state = 21; break; case -1: - data->unk8 = 21; + data->state = 21; break; } break; case 23: - switch ((u32)sub_8018B08(&data->unk9, &data->unk0, TRUE, gText_HaventReceivedGiftOkayToDiscard)) + switch ((u32)mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, TRUE, gText_HaventReceivedGiftOkayToDiscard)) { case 0: - data->unk8 = 24; + data->state = 24; break; case 1: - data->unk8 = 21; + data->state = 21; break; case -1u: - data->unk8 = 21; + data->state = 21; break; } break; case 24: - if (sub_8018E20(data->unkC, 1)) + if (TearDownCardOrNews_ReturnToTopMenu(data->IsCardOrNews, 1)) { - sub_8018E08(data->unkC); - data->unk8 = 25; + DestroyNewsOrCard(data->IsCardOrNews); + data->state = 25; } break; case 25: - if (mevent_save_game(&data->unk9)) + if (mevent_save_game(&data->textState)) { - data->unk8 = 26; + data->state = 26; } break; case 26: - if (mevent_message_was_thrown_away(&data->unk9, data->unkC)) + if (mevent_message_was_thrown_away(&data->textState, data->IsCardOrNews)) { - data->unk8 = 0; - sub_80186EC(0, 0); + data->state = 0; + PrintMysteryGiftOrEReaderTopMenu(0, 0); } break; case 27: - if (sub_8018E20(data->unkC, 0)) + if (TearDownCardOrNews_ReturnToTopMenu(data->IsCardOrNews, 0)) { - data->unk8 = 0; + data->state = 0; } break; case 28: - if (sub_8018E20(data->unkC, 1)) + if (TearDownCardOrNews_ReturnToTopMenu(data->IsCardOrNews, 1)) { - data->unk8 = 3; + data->state = 3; } break; case 29: - if (sub_8018E20(data->unkC, 1)) + if (TearDownCardOrNews_ReturnToTopMenu(data->IsCardOrNews, 1)) { - switch (data->unkC) + switch (data->IsCardOrNews) { case 0: - sub_8014A00(21); + MEvent_CreateTask_Leader(21); break; case 1: - sub_8014A00(22); + MEvent_CreateTask_Leader(22); break; } - data->unkD = 1; - data->unk8 = 30; + data->source = 1; + data->state = 30; } break; case 30: if (gReceivedRemoteLinkPlayers != 0) { - sub_8018838(1); - data->unk8 = 31; + ClearScreenInBg0(1); + data->state = 31; } else if (gSpecialVar_Result == 5) { - sub_8018838(1); - data->unk8 = 18; + ClearScreenInBg0(1); + data->state = 18; } break; case 31: @@ -1629,64 +1630,74 @@ void task00_mystery_gift(u8 taskId) gStringVar2[0] = eos; gStringVar3[0] = eos; } - if (data->unkC == 0) + if (data->IsCardOrNews == 0) { - sub_8018884(gText_SendingWonderCard); + AddTextPrinterToWindow1(gText_SendingWonderCard); mevent_srv_new_wcard(); } else { - sub_8018884(gText_SendingWonderNews); + AddTextPrinterToWindow1(gText_SendingWonderNews); mevent_srv_init_wnews(); } - data->unk8 = 32; + data->state = 32; break; case 32: - if (sub_801D0C4(&data->unk0) == 3) + if (mevent_srv_common_do_exec(&data->curPromptWindowId) == 3) { - data->unkE = data->unk0; - data->unk8 = 33; + data->prevPromptWindowId = data->curPromptWindowId; + data->state = 33; } break; case 33: task_add_05_task_del_08FA224_when_no_RfuFunc(); StringCopy(gStringVar1, gLinkPlayers[1].name); - data->unk8 = 34; + data->state = 34; break; case 34: if (gReceivedRemoteLinkPlayers == 0) { - sub_800E084(); - data->unk8 = 35; + DestroyWirelessStatusIndicatorSprite(); + data->state = 35; } break; case 35: - if (sub_8019174(&data->unk9, &data->unk0, data->unkD, data->unkE)) + if (PrintMGSendStatus(&data->textState, &data->curPromptWindowId, data->source, data->prevPromptWindowId)) { - if (data->unkD == 1 && data->unkE == 3) + if (data->source == 1 && data->prevPromptWindowId == 3) { - sub_801DB68(3); - data->unk8 = 17; + GenerateRandomNews(3); + data->state = 17; } else { - data->unk8 = 0; - sub_80186EC(0, 0); + data->state = 0; + PrintMysteryGiftOrEReaderTopMenu(0, 0); } } break; case 36: - if (mevent_0814257C(&data->unk9, gText_CommunicationError)) + if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, gText_CommunicationError)) { - data->unk8 = 0; - sub_80186EC(0, 0); + data->state = 0; + PrintMysteryGiftOrEReaderTopMenu(0, 0); } break; case 37: CloseLink(); - Free(data->unk10); + Free(data->buffer); DestroyTask(taskId); - SetMainCallback2(sub_80186A4); + SetMainCallback2(MainCB_FreeAllBuffersAndReturnToInitTitleScreen); break; } } + +u16 GetMysteryGiftBaseBlock(void) +{ + return 0x1A9; +} + +void bgid_upload_textbox_1(u8 bgId) +{ + DecompressAndLoadBgGfxUsingHeap(bgId, gUnkTextboxBorderGfx, 0x100, 0, 0); +} diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 30f5af14c..fb1be0698 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -4419,7 +4419,7 @@ static void PrintStorageActionText(u8 id) DynamicPlaceholderTextUtil_ExpandPlaceholders(sPSSData->field_2190, gPCStorageActionTexts[id].text); FillWindowPixelBuffer(1, PIXEL_FILL(1)); AddTextPrinterParameterized(1, 1, sPSSData->field_2190, 0, 1, TEXT_SPEED_FF, NULL); - sub_8098858(1, 2, 14); + DrawTextBorderOuter(1, 2, 14); PutWindowTilemap(1); CopyWindowToVram(1, 2); schedule_bg_copy_tilemap_to_vram(0); diff --git a/src/script.c b/src/script.c index 91690dd33..cb06300bf 100644 --- a/src/script.c +++ b/src/script.c @@ -405,7 +405,7 @@ bool32 sub_80991F8(void) u8 *sub_8099244(void) { struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data; - if (!sub_801B27C()) + if (!ValidateReceivedWonderCard()) return NULL; if (scriptData->magic != RAM_SCRIPT_MAGIC) return NULL; diff --git a/src/script_pokemon_util_80F87D8.c b/src/script_pokemon_util_80F87D8.c index 7d6020c7a..7e4c14531 100755 --- a/src/script_pokemon_util_80F87D8.c +++ b/src/script_pokemon_util_80F87D8.c @@ -488,7 +488,7 @@ void sub_80F910C(void) if (gIsLinkContest & 2) { if (gReceivedRemoteLinkPlayers) - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); } } diff --git a/src/start_menu.c b/src/start_menu.c index f573f9bdf..5b527e15e 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -1185,7 +1185,7 @@ static bool32 sub_80A03E4(u8 *par1) InitBgsFromTemplates(0, sUnknown_085105A8, ARRAY_COUNT(sUnknown_085105A8)); InitWindows(sUnknown_085105AC); LoadUserWindowBorderGfx_(0, 8, 224); - sub_81978B0(240); + Menu_LoadStdPalAt(240); break; case 3: ShowBg(0); @@ -1234,7 +1234,7 @@ static void sub_80A0550(u8 taskId) 2, 1, 3); - sub_8098858(0, 8, 14); + DrawTextBorderOuter(0, 8, 14); PutWindowTilemap(0); CopyWindowToVram(0, 3); BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); diff --git a/src/text_window.c b/src/text_window.c index 517f4bdb9..98fc09e87 100644 --- a/src/text_window.c +++ b/src/text_window.c @@ -113,7 +113,7 @@ void LoadUserWindowBorderGfx(u8 windowId, u16 destOffset, u8 palOffset) LoadWindowGfx(windowId, gSaveBlock2Ptr->optionsWindowFrameType, destOffset, palOffset); } -void sub_8098858(u8 windowId, u16 tileNum, u8 palNum) +void DrawTextBorderOuter(u8 windowId, u16 tileNum, u8 palNum) { u8 bgLayer = GetWindowAttribute(windowId, WINDOW_BG); u16 tilemapLeft = GetWindowAttribute(windowId, WINDOW_TILEMAP_LEFT); @@ -131,7 +131,7 @@ void sub_8098858(u8 windowId, u16 tileNum, u8 palNum) FillBgTilemapBufferRect(bgLayer, tileNum + 8, tilemapLeft + width, tilemapTop + height, 1, 1, palNum); } -void sub_80989E0(u8 windowId, u16 tileNum, u8 palNum) +void DrawTextBorderInner(u8 windowId, u16 tileNum, u8 palNum) { u8 bgLayer = GetWindowAttribute(windowId, WINDOW_BG); u16 tilemapLeft = GetWindowAttribute(windowId, WINDOW_TILEMAP_LEFT); diff --git a/src/trade.c b/src/trade.c index 34f49060f..80c74d2cd 100644 --- a/src/trade.c +++ b/src/trade.c @@ -2014,7 +2014,7 @@ static void sub_80781C8(void) FreeAllWindowBuffers(); Free(gUnknown_0203229C); gMain.callback1 = NULL; - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); SetMainCallback2(sub_807AE50); } } @@ -2543,7 +2543,7 @@ static void sub_8078DBC(void) if (gUnknown_0203229C->tradeMenuCursorPosition < 6) { - sub_8098858(1, 1, 14); + DrawTextBorderOuter(1, 1, 14); FillWindowPixelBuffer(1, PIXEL_FILL(1)); PrintMenuTable(1, 2, gUnknown_0832DEAC); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(1, 2, 0); @@ -2844,7 +2844,7 @@ static void sub_80794CC(void) Free(gUnknown_02032184); Free(gUnknown_0203229C); FreeAllWindowBuffers(); - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); SetMainCallback2(CB2_ReturnToFieldFromMultiplayer); } } @@ -3341,7 +3341,7 @@ static void sub_807A19C(u8 a0) { FillWindowPixelBuffer(0, PIXEL_FILL(1)); AddTextPrinterParameterized(0, 1, gUnknown_0832DEBC[a0], 0, 1, TEXT_SPEED_FF, NULL); - sub_8098858(0, 20, 12); + DrawTextBorderOuter(0, 20, 12); PutWindowTilemap(0); CopyWindowToVram(0, 3); } @@ -6123,7 +6123,7 @@ static void c2_080543C4(void) FreeMonSpritesGfx(); FREE_AND_SET_NULL(gUnknown_020322A0); if (gWirelessCommType) - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); SetMainCallback2(gMain.savedCallback); } RunTasks(); diff --git a/src/union_room.c b/src/union_room.c index df0137379..8aeaaf6fb 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -45,6 +45,7 @@ #include "event_obj_lock.h" #include "union_room_chat.h" #include "berry_crush.h" +#include "mystery_gift.h" EWRAM_DATA u8 gUnknown_02022C20[12] = {}; EWRAM_DATA u8 gUnknown_02022C2C = 0; @@ -100,9 +101,8 @@ void sub_801AC54(void); void sub_802A9A8(u8 monId, MainCallback callback); void sub_802493C(u8 monId, MainCallback callback); void sub_80149D8(void); -u16 sub_8019930(void); -void sub_8018784(u8 windowId); -s8 sub_8018B08(u8 *textState, u8 *arg1, u8 arg2, const u8 *str); +void MG_DrawTextBorder(u8 windowId); +s8 mevent_message_print_and_prompt_yes_no(u8 *textState, u8 *arg1, u8 arg2, const u8 *str); bool32 sub_8016F1C(struct UnkLinkRfuStruct_02022B14 *arg0, s16 arg1); u8 sub_8016DF0(struct UnkStruct_Main4 *arg0, struct UnkStruct_Main4 *arg1, u32 arg2); void sub_8019F2C(void); @@ -1555,7 +1555,7 @@ void sub_8012780(u8 taskId) break; case 21: case 23: - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); sub_800EDD4(); sub_8012F64(data); data->state++; @@ -2076,7 +2076,7 @@ void sub_80134E8(u8 taskId) data->state++; break; case 13: - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); if (PrintOnTextbox(&data->textState, gUnknown_082EDE9C[sub_8011A74()])) { gSpecialVar_Result = 6; @@ -2084,12 +2084,12 @@ void sub_80134E8(u8 taskId) } break; case 11: - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); gSpecialVar_Result = 5; data->state = 23; break; case 15: - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); if (PrintOnTextbox(&data->textState, gUnknown_082EDE9C[sub_8011A74()])) { gSpecialVar_Result = 8; @@ -2481,7 +2481,7 @@ void sub_80143E4(void *arg0, bool32 arg1) TrainerCard_GenerateCardForPlayer((struct TrainerCard *)argAsU16Ptr); if (arg1) - argAsU16Ptr[48] = sub_801B39C(); + argAsU16Ptr[48] = GetWonderCardFlagID(); else argAsU16Ptr[48] = 0; } @@ -2680,7 +2680,7 @@ void sub_8014790(u8 taskId) case 8: if (gReceivedRemoteLinkPlayers == 0) { - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); EnableBothScriptContexts(); DestroyTask(taskId); } @@ -2699,7 +2699,7 @@ void sub_80149D8(void) gTasks[taskId].data[0] = 0; } -void sub_8014A00(u32 arg0) +void MEvent_CreateTask_Leader(u32 arg0) { u8 taskId; struct UnkStruct_Leader *dataPtr; @@ -2745,10 +2745,10 @@ void sub_8014A40(u8 taskId) data->field_17 = sub_8016FC0(data->field_4, 0xFF); winTemplate = gUnknown_082F011C; - winTemplate.baseBlock = sub_8019930(); + winTemplate.baseBlock = GetMysteryGiftBaseBlock(); winTemplate.paletteNum = 0xC; data->listWindowId = AddWindow(&winTemplate); - sub_8018784(data->listWindowId); + MG_DrawTextBorder(data->listWindowId); gMultiuseListMenuTemplate = gUnknown_082F015C; gMultiuseListMenuTemplate.windowId = data->listWindowId; data->listTaskId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0); @@ -2763,7 +2763,7 @@ void sub_8014A40(u8 taskId) data->state = 3; break; case 3: - sub_8018884(gStringVar4); + AddTextPrinterToWindow1(gStringVar4); data->state = 4; break; case 4: @@ -2771,11 +2771,11 @@ void sub_8014A40(u8 taskId) if (gMain.newKeys & B_BUTTON) { data->state = 13; - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); } break; case 6: - if (mevent_0814257C(&data->textState, gUnknown_082EDF40)) + if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, gUnknown_082EDF40)) { data->field_13 = sub_8013398(data->field_0); RedrawListMenu(data->listTaskId); @@ -2786,7 +2786,7 @@ void sub_8014A40(u8 taskId) data->state = 7; break; case 7: - switch (sub_8018B08(&data->textState, &data->field_14, 0, gStringVar4)) + switch (mevent_message_print_and_prompt_yes_no(&data->textState, &data->field_14, 0, gStringVar4)) { case 0: sub_800E0E8(); @@ -2837,7 +2837,7 @@ void sub_8014A40(u8 taskId) } break; case 9: - sub_8018884(gStringVar4); + AddTextPrinterToWindow1(gStringVar4); data->state = 10; break; case 10: @@ -2860,7 +2860,7 @@ void sub_8014A40(u8 taskId) } break; case 13: - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); sub_800EDD4(); DestroyListMenuTask(data->listTaskId, 0, 0); CopyBgTilemapBufferToVram(0); @@ -2872,7 +2872,7 @@ void sub_8014A40(u8 taskId) data->state++; break; case 14: - if (mevent_0814257C(&data->textState, gText_PleaseStartOver)) + if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, gText_PleaseStartOver)) { DestroyTask(taskId); gSpecialVar_Result = 5; @@ -2907,7 +2907,7 @@ void sub_8014A40(u8 taskId) } } -void sub_8014EFC(u32 arg0) +void MEvent_CreateTask_CardOrNewsWithFriend(u32 arg0) { u8 taskId; struct UnkStruct_Group *dataPtr; @@ -2940,7 +2940,7 @@ void sub_8014F48(u8 taskId) data->state = 1; break; case 1: - sub_8018884(gUnknown_082EF7F8); + AddTextPrinterToWindow1(gUnknown_082EF7F8); data->state = 2; break; case 2: @@ -2949,7 +2949,7 @@ void sub_8014F48(u8 taskId) data->field_11 = sub_8016FC0(data->field_4, data->field_12 + 7); winTemplate1 = gUnknown_082F0174; - winTemplate1.baseBlock = sub_8019930(); + winTemplate1.baseBlock = GetMysteryGiftBaseBlock(); winTemplate1.paletteNum = 0xC; data->listWindowId = AddWindow(&winTemplate1); @@ -2957,12 +2957,12 @@ void sub_8014F48(u8 taskId) winTemplate2.paletteNum = 0xC; data->field_D = AddWindow(&winTemplate2); - sub_8018784(data->listWindowId); + MG_DrawTextBorder(data->listWindowId); gMultiuseListMenuTemplate = gUnknown_082F0204; gMultiuseListMenuTemplate.windowId = data->listWindowId; data->listTaskId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0); - sub_8018784(data->field_D); + MG_DrawTextBorder(data->field_D); FillWindowPixelBuffer(data->field_D, PIXEL_FILL(1)); PutWindowTilemap(data->field_D); sub_80125BC(data->field_D); @@ -3013,7 +3013,7 @@ void sub_8014F48(u8 taskId) } break; case 4: - sub_8018884(gUnknown_082EFC3C); + AddTextPrinterToWindow1(gUnknown_082EFC3C); sub_8018404(gStringVar1, &data->field_0->arr[data->field_F]); data->state = 5; break; @@ -3032,7 +3032,7 @@ void sub_8014F48(u8 taskId) data->state = 8; break; case 5: - sub_8018884(gUnknown_082EDDF4); + AddTextPrinterToWindow1(gUnknown_082EDDF4); sub_8011A64(0, 0); break; } @@ -3050,17 +3050,17 @@ void sub_8014F48(u8 taskId) data->state++; break; case 9: - if (mevent_0814257C(&data->textState, gUnknown_082EDF80[sub_8011A74()])) + if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, gUnknown_082EDF80[sub_8011A74()])) { - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); DestroyTask(taskId); sub_800EDD4(); gSpecialVar_Result = 5; } break; case 7: - sub_800E084(); - sub_8018884(gText_PleaseStartOver); + DestroyWirelessStatusIndicatorSprite(); + AddTextPrinterToWindow1(gText_PleaseStartOver); DestroyTask(taskId); sub_800EDD4(); gSpecialVar_Result = 5; @@ -3076,7 +3076,7 @@ void sub_8014F48(u8 taskId) } } -void sub_80152A8(u32 arg0) +void MEvent_CreateTask_CardOrNewsOverWireless(u32 arg0) { u8 taskId; struct UnkStruct_Group *dataPtr; @@ -3109,7 +3109,7 @@ void sub_80152F4(u8 taskId) data->state = 1; break; case 1: - sub_8018884(gUnknown_082EFBC8); + AddTextPrinterToWindow1(gUnknown_082EFBC8); data->state = 2; break; case 2: @@ -3120,10 +3120,10 @@ void sub_80152F4(u8 taskId) if (data->field_13 != 0) { winTemplate = gUnknown_082F0174; - winTemplate.baseBlock = sub_8019930(); + winTemplate.baseBlock = GetMysteryGiftBaseBlock(); data->listWindowId = AddWindow(&winTemplate); - sub_8018784(data->listWindowId); + MG_DrawTextBorder(data->listWindowId); gMultiuseListMenuTemplate = gUnknown_082F0204; gMultiuseListMenuTemplate.windowId = data->listWindowId; data->listTaskId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0); @@ -3178,7 +3178,7 @@ void sub_80152F4(u8 taskId) } break; case 4: - sub_8018884(gUnknown_082EFC90); + AddTextPrinterToWindow1(gUnknown_082EFC90); sub_8018404(gStringVar1, &data->field_0->arr[data->field_F]); data->state = 5; break; @@ -3197,7 +3197,7 @@ void sub_80152F4(u8 taskId) data->state = 8; break; case 5: - sub_8018884(gUnknown_082EDEC4); + AddTextPrinterToWindow1(gUnknown_082EDEC4); sub_8011A64(0, 0); break; } @@ -3218,27 +3218,27 @@ void sub_80152F4(u8 taskId) data->state++; break; case 9: - if (mevent_0814257C(&data->textState, gUnknown_082EDF04)) + if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, gUnknown_082EDF04)) { - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); DestroyTask(taskId); sub_800EDD4(); gSpecialVar_Result = 5; } break; case 7: - if (mevent_0814257C(&data->textState, gText_WirelessSearchCanceled)) + if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, gText_WirelessSearchCanceled)) { - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); DestroyTask(taskId); sub_800EDD4(); gSpecialVar_Result = 5; } break; case 11: - if (mevent_0814257C(&data->textState, gUnknown_082EFD58[data->field_12])) + if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, gUnknown_082EFD58[data->field_12])) { - sub_800E084(); + DestroyWirelessStatusIndicatorSprite(); DestroyTask(taskId); sub_800EDD4(); gSpecialVar_Result = 5; @@ -4513,7 +4513,7 @@ s32 sub_8017178(u8 *arg0, u8 *arg1, u8 *arg2, const struct WindowTemplate *winTe { case 0: winTemplateCopy = *winTemplate; - r1 = sub_81DB41C(menuTemplate); + r1 = Intl_GetListMenuWidth(menuTemplate); if (winTemplateCopy.width > r1) { winTemplateCopy.width = r1; diff --git a/src/union_room_chat.c b/src/union_room_chat.c index 85cfa6e2e..120252d36 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -2074,7 +2074,7 @@ static void sub_801FDDC(u8 left, u8 top, u8 initialCursorPos) PutWindowTilemap(gUnknown_02022C88->unk18); AddTextPrinterParameterized(gUnknown_02022C88->unk18, 1, gText_Yes, 8, 1, TEXT_SPEED_FF, NULL); AddTextPrinterParameterized(gUnknown_02022C88->unk18, 1, gText_No, 8, 17, TEXT_SPEED_FF, NULL); - sub_8098858(gUnknown_02022C88->unk18, 1, 13); + DrawTextBorderOuter(gUnknown_02022C88->unk18, 1, 13); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(gUnknown_02022C88->unk18, 2, initialCursorPos); } } @@ -2140,7 +2140,7 @@ static void sub_801FF18(int arg0, u16 arg1) PutWindowTilemap(windowId); if (gUnknown_082F2D40[arg0].unk4 == 1) { - sub_80989E0(windowId, 0xA, 2); + DrawTextBorderInner(windowId, 0xA, 2); AddTextPrinterParameterized5( windowId, 1, @@ -2154,7 +2154,7 @@ static void sub_801FF18(int arg0, u16 arg1) } else { - sub_8098858(windowId, 0xA, 2); + DrawTextBorderOuter(windowId, 0xA, 2); AddTextPrinterParameterized5( windowId, 1, @@ -2316,7 +2316,7 @@ static bool32 sub_8020368(void) static void sub_80203B0(void) { FillWindowPixelBuffer(3, PIXEL_FILL(1)); - sub_8098858(3, 1, 13); + DrawTextBorderOuter(3, 1, 13); PrintTextArray(3, 2, 8, 1, 14, 5, gUnknown_082F2DC8); sub_81983AC(3, 2, 0, 1, 14, 5, sub_801F0B0()); PutWindowTilemap(3); diff --git a/src/use_pokeblock.c b/src/use_pokeblock.c index 6df826214..4eaf60be4 100644 --- a/src/use_pokeblock.c +++ b/src/use_pokeblock.c @@ -617,7 +617,7 @@ void sub_8166D44(void) StringAppend(stringBuffer, gText_GetsAPokeBlockQuestion); StringCopy(gStringVar4, stringBuffer); FillWindowPixelBuffer(2, 17); - sub_8098858(2, 151, 14); + DrawTextBorderOuter(2, 151, 14); AddTextPrinterParameterized(2, 1, gStringVar4, 0, 1, 0, NULL); PutWindowTilemap(2); CopyWindowToVram(2, 3); @@ -645,7 +645,7 @@ s8 sub_8166DE4(void) void sub_8166E24(void) { - sub_8098858(2, 151, 14); + DrawTextBorderOuter(2, 151, 14); FillWindowPixelBuffer(2, 17); for (gUnknown_0203BC90->field_53 = 0; gUnknown_0203BC90->field_53 < 5; gUnknown_0203BC90->field_53++) @@ -693,7 +693,7 @@ bool8 sub_8166EDC(void) void sub_8166F50(void) { FillWindowPixelBuffer(2, 17); - sub_8098858(2, 151, 14); + DrawTextBorderOuter(2, 151, 14); AddTextPrinterParameterized(2, 1, gText_WontEatAnymore, 0, 1, 0, NULL); PutWindowTilemap(2); CopyWindowToVram(2, 3); diff --git a/sym_ewram.txt b/sym_ewram.txt index 0715de97a..266c4d89d 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -9,10 +9,8 @@ .include "src/union_room.o" .include "src/mystery_gift.o" - .align 3 -gUnknown_02022C60: @ 2022C60 - .space 0x4 - + @ union room player avatar + .align 2 gUnknown_02022C64: @ 2022C64 .space 0x4 @@ -23,17 +21,13 @@ gUnknown_02022C6C: @ 2022C6C .space 0x4 .include "src/mevent2.o" + .include "src/mevent_801BAAC.o" -gUnknown_02022C74: @ 2022C74 - .space 0x4 - -gUnknown_02022C78: @ 2022C78 - .space 0x4 - + @ mevent_server gUnknown_02022C7C: @ 2022C7C .space 0x4 -gUnknown_02022C80: @ 2022C80 +s_mevent_srv_ish_ptr: @ 2022C80 .space 0x4 gUnknown_02022C84: @ 2022C84 From 207a54393c533e073e54365a8069753536fefa3c Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Sun, 31 Mar 2019 20:07:24 -0400 Subject: [PATCH 027/101] Fix mistakes and use EVENT_OBJ_GFX_* macros --- .../AbandonedShip_CaptainsOffice/map.json | 4 +- include/contest.h | 2 - src/data/contest_opponents.h | 392 +++++++++--------- src/data/contest_text_tables.h | 118 +++--- 4 files changed, 257 insertions(+), 259 deletions(-) diff --git a/data/maps/AbandonedShip_CaptainsOffice/map.json b/data/maps/AbandonedShip_CaptainsOffice/map.json index 3f612c320..a78d433b6 100644 --- a/data/maps/AbandonedShip_CaptainsOffice/map.json +++ b/data/maps/AbandonedShip_CaptainsOffice/map.json @@ -25,7 +25,7 @@ "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", "script": "AbandonedShip_CaptainsOffice_EventScript_2387E2", - "flag": "0" + "flag": "0" }, { "graphics_id": "EVENT_OBJ_GFX_ITEM_BALL", @@ -59,4 +59,4 @@ ], "coord_events": [], "bg_events": [] -} \ No newline at end of file +} diff --git a/include/contest.h b/include/contest.h index 5c299bee5..a0b1a6b34 100644 --- a/include/contest.h +++ b/include/contest.h @@ -216,7 +216,6 @@ struct ContestPokemon /*0x02*/ u8 nickname[POKEMON_NAME_LENGTH + 1]; /*0x0D*/ u8 trainerName[PLAYER_NAME_LENGTH + 1]; /*0x15*/ u8 trainerGfxId; - // Temp note: 2 bytes of padding /*0x18*/ u32 flags; /*0x1C*/ u8 whichRank:2; // 0x1 0x2 u8 aiPool_Cool:1; // 0x4 @@ -224,7 +223,6 @@ struct ContestPokemon u8 aiPool_Cute:1; // 0x10 u8 aiPool_Smart:1; // 0x20 u8 aiPool_Tough:1; // 0x40 - // Temp note: 1 byte of padding /*0x1E*/ u16 moves[4]; // moves /*0x26*/ u8 cool; // cool /*0x27*/ u8 beauty; // beauty diff --git a/src/data/contest_opponents.h b/src/data/contest_opponents.h index 2ebfd1dfd..ef1fdba9f 100644 --- a/src/data/contest_opponents.h +++ b/src/data/contest_opponents.h @@ -182,9 +182,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_POOCHYENA, .nickname = _("POOCHY"), .trainerName = _("JIMMY"), - .trainerGfxId = 7, + .trainerGfxId = EVENT_OBJ_GFX_BOY_1, .flags = 0xC000FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -211,9 +211,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_ILLUMISE, .nickname = _("MUSILLE"), .trainerName = _("EDITH"), - .trainerGfxId = 8, + .trainerGfxId = EVENT_OBJ_GFX_GIRL_1, .flags = 0x82000FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -240,9 +240,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_DUSTOX, .nickname = _("DUSTER"), .trainerName = _("EVAN"), - .trainerGfxId = 11, + .trainerGfxId = EVENT_OBJ_GFX_LITTLE_BOY, .flags = 0x21000FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -269,9 +269,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SEEDOT, .nickname = _("DOTS"), .trainerName = _("KELSEY"), - .trainerGfxId = 16, + .trainerGfxId = EVENT_OBJ_GFX_WOMAN_1, .flags = 0x20800FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -298,9 +298,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_TAILLOW, .nickname = _("TATAY"), .trainerName = _("MADISON"), - .trainerGfxId = 18, + .trainerGfxId = EVENT_OBJ_GFX_POKEFAN_F, .flags = 0x80400FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -327,9 +327,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_NINCADA, .nickname = _("NINDA"), .trainerName = _("RAYMOND"), - .trainerGfxId = 44, + .trainerGfxId = EVENT_OBJ_GFX_BLACK_BELT, .flags = 0x10200FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -356,9 +356,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SHROOMISH, .nickname = _("SMISH"), .trainerName = _("GRANT"), - .trainerGfxId = 35, + .trainerGfxId = EVENT_OBJ_GFX_YOUNGSTER, .flags = 0x20100FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -385,9 +385,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SPHEAL, .nickname = _("SLEAL"), .trainerName = _("PAIGE"), - .trainerGfxId = 26, + .trainerGfxId = EVENT_OBJ_GFX_WOMAN_4, .flags = 0x8080FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = TRUE, @@ -414,9 +414,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SLAKOTH, .nickname = _("SLOKTH"), .trainerName = _("ALEC"), - .trainerGfxId = 31, + .trainerGfxId = EVENT_OBJ_GFX_CAMPER, .flags = 0x40040FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = TRUE, @@ -443,9 +443,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_WHISMUR, .nickname = _("WHIRIS"), .trainerName = _("SYDNEY"), - .trainerGfxId = 47, + .trainerGfxId = EVENT_OBJ_GFX_LASS, .flags = 0x80020FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -472,9 +472,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_MAKUHITA, .nickname = _("MAHITA"), .trainerName = _("MORRIS"), - .trainerGfxId = 38, + .trainerGfxId = EVENT_OBJ_GFX_SCHOOL_KID_M, .flags = 0x8010FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -501,9 +501,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_ARON, .nickname = _("RONAR"), .trainerName = _("MARIAH"), - .trainerGfxId = 10, + .trainerGfxId = EVENT_OBJ_GFX_GIRL_2, .flags = 0x8008FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -530,9 +530,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_CROBAT, .nickname = _("BATRO"), .trainerName = _("RUSSELL"), - .trainerGfxId = 33, + .trainerGfxId = EVENT_OBJ_GFX_MAN_3, .flags = 0x90004FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = TRUE, @@ -559,9 +559,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_GULPIN, .nickname = _("GULIN"), .trainerName = _("MELANIE"), - .trainerGfxId = 6, + .trainerGfxId = EVENT_OBJ_GFX_TWIN, .flags = 0x40002FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -588,9 +588,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_MANECTRIC, .nickname = _("RIKELEC"), .trainerName = _("CHANCE"), - .trainerGfxId = 15, + .trainerGfxId = EVENT_OBJ_GFX_RICH_BOY, .flags = 0x80001FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -617,9 +617,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_BULBASAUR, .nickname = _("BULBY"), .trainerName = _("AGATHA"), - .trainerGfxId = 20, + .trainerGfxId = EVENT_OBJ_GFX_WOMAN_2, .flags = 0xC000FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -646,9 +646,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_BUTTERFREE, .nickname = _("FUTTERBE"), .trainerName = _("BEAU"), - .trainerGfxId = 40, + .trainerGfxId = EVENT_OBJ_GFX_HEX_MANIAC, .flags = 0x82000FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -675,9 +675,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_PIDGEOTTO, .nickname = _("PIDEOT"), .trainerName = _("KAY"), - .trainerGfxId = 34, + .trainerGfxId = EVENT_OBJ_GFX_WOMAN_5, .flags = 0x21000FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -704,9 +704,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_DIGLETT, .nickname = _("DIGLE"), .trainerName = _("CALE"), - .trainerGfxId = 55, + .trainerGfxId = EVENT_OBJ_GFX_HIKER, .flags = 0x20800FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -733,9 +733,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_POLIWAG, .nickname = _("WAGIL"), .trainerName = _("CAITLIN"), - .trainerGfxId = 53, + .trainerGfxId = EVENT_OBJ_GFX_TUBER_F, .flags = 0x80400FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -762,9 +762,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_TOTODILE, .nickname = _("TOTDIL"), .trainerName = _("COLBY"), - .trainerGfxId = 5, + .trainerGfxId = EVENT_OBJ_GFX_NINJA_BOY, .flags = 0x10200FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -791,9 +791,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_LEDYBA, .nickname = _("BALEDY"), .trainerName = _("KYLIE"), - .trainerGfxId = 45, + .trainerGfxId = EVENT_OBJ_GFX_BEAUTY, .flags = 0x20100FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -820,9 +820,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_DELIBIRD, .nickname = _("BIRDLY"), .trainerName = _("LIAM"), - .trainerGfxId = 66, + .trainerGfxId = EVENT_OBJ_GFX_MAN_5, .flags = 0x8080FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -849,9 +849,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_LARVITAR, .nickname = _("TARVITAR"), .trainerName = _("MILO"), - .trainerGfxId = 39, + .trainerGfxId = EVENT_OBJ_GFX_MANIAC, .flags = 0x40040FFF, - .whichRank = 0, + .whichRank = CONTEST_RANK_NORMAL, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -878,9 +878,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_ROSELIA, .nickname = _("RELIA"), .trainerName = _("KARINA"), - .trainerGfxId = 32, + .trainerGfxId = EVENT_OBJ_GFX_PICNICKER, .flags = 0x24000FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -907,9 +907,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_DODRIO, .nickname = _("DUODO"), .trainerName = _("BOBBY"), - .trainerGfxId = 51, + .trainerGfxId = EVENT_OBJ_GFX_RUNNING_TRIATHLETE_M, .flags = 0x82000FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = TRUE, @@ -936,9 +936,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_TRAPINCH, .nickname = _("PINCHIN"), .trainerName = _("CLAIRE"), - .trainerGfxId = 8, + .trainerGfxId = EVENT_OBJ_GFX_GIRL_1, .flags = 0x81000FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -965,9 +965,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_CACNEA, .nickname = _("NACAC"), .trainerName = _("WILLIE"), - .trainerGfxId = 11, + .trainerGfxId = EVENT_OBJ_GFX_LITTLE_BOY, .flags = 0x80800FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -994,9 +994,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SANDSLASH, .nickname = _("SHRAND"), .trainerName = _("CASSIDY"), - .trainerGfxId = 18, + .trainerGfxId = EVENT_OBJ_GFX_POKEFAN_F, .flags = 0x10400FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -1023,9 +1023,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_BALTOY, .nickname = _("TOYBAL"), .trainerName = _("MORGAN"), - .trainerGfxId = 44, + .trainerGfxId = EVENT_OBJ_GFX_BLACK_BELT, .flags = 0x8200FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -1052,9 +1052,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_MEDICHAM, .nickname = _("CHAMCHAM"), .trainerName = _("SUMMER"), - .trainerGfxId = 26, + .trainerGfxId = EVENT_OBJ_GFX_WOMAN_4, .flags = 0x10100FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -1081,9 +1081,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SPINDA, .nickname = _("SPININ"), .trainerName = _("MILES"), - .trainerGfxId = 31, + .trainerGfxId = EVENT_OBJ_GFX_CAMPER, .flags = 0x80080FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -1110,9 +1110,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SWABLU, .nickname = _("SWABY"), .trainerName = _("AUDREY"), - .trainerGfxId = 47, + .trainerGfxId = EVENT_OBJ_GFX_LASS, .flags = 0xA0040FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -1139,9 +1139,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SPOINK, .nickname = _("POINKER"), .trainerName = _("AVERY"), - .trainerGfxId = 38, + .trainerGfxId = EVENT_OBJ_GFX_SCHOOL_KID_M, .flags = 0x80020FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -1168,9 +1168,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_KECLEON, .nickname = _("KECON"), .trainerName = _("ARIANA"), - .trainerGfxId = 10, + .trainerGfxId = EVENT_OBJ_GFX_GIRL_2, .flags = 0x80010FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -1197,9 +1197,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_GOLDEEN, .nickname = _("GOLDEN"), .trainerName = _("ASHTON"), - .trainerGfxId = 33, + .trainerGfxId = EVENT_OBJ_GFX_MAN_3, .flags = 0x80008FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -1226,9 +1226,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_BARBOACH, .nickname = _("BOBOACH"), .trainerName = _("SANDRA"), - .trainerGfxId = 6, + .trainerGfxId = EVENT_OBJ_GFX_TWIN, .flags = 0x80004FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -1255,9 +1255,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SKARMORY, .nickname = _("CORPY"), .trainerName = _("CARSON"), - .trainerGfxId = 35, + .trainerGfxId = EVENT_OBJ_GFX_YOUNGSTER, .flags = 0x8002FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -1284,9 +1284,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_LOTAD, .nickname = _("TADO"), .trainerName = _("KATRINA"), - .trainerGfxId = 16, + .trainerGfxId = EVENT_OBJ_GFX_WOMAN_1, .flags = 0x8001FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = TRUE, @@ -1313,9 +1313,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SLOWBRO, .nickname = _("BROWLO"), .trainerName = _("LUKE"), - .trainerGfxId = 17, + .trainerGfxId = EVENT_OBJ_GFX_FAT_MAN, .flags = 0xC000FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -1342,9 +1342,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_FARFETCHD, .nickname = _("FETCHIN"), .trainerName = _("RAUL"), - .trainerGfxId = 66, + .trainerGfxId = EVENT_OBJ_GFX_MAN_5, .flags = 0x82000FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -1371,9 +1371,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SEEL, .nickname = _("SEELEY"), .trainerName = _("JADA"), - .trainerGfxId = 20, + .trainerGfxId = EVENT_OBJ_GFX_WOMAN_2, .flags = 0x21000FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = TRUE, @@ -1400,9 +1400,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_DROWZEE, .nickname = _("DROWZIN"), .trainerName = _("ZEEK"), - .trainerGfxId = 37, + .trainerGfxId = EVENT_OBJ_GFX_PSYCHIC_M, .flags = 0x20800FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = TRUE, @@ -1429,9 +1429,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_HITMONCHAN, .nickname = _("HITEMON"), .trainerName = _("DIEGO"), - .trainerGfxId = 21, + .trainerGfxId = EVENT_OBJ_GFX_EXPERT_M, .flags = 0x80400FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -1458,9 +1458,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_BLISSEY, .nickname = _("BLISS"), .trainerName = _("ALIYAH"), - .trainerGfxId = 85, + .trainerGfxId = EVENT_OBJ_GFX_TEALA, .flags = 0x10200FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = TRUE, @@ -1487,9 +1487,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_ELEKID, .nickname = _("KIDLEK"), .trainerName = _("NATALIA"), - .trainerGfxId = 18, + .trainerGfxId = EVENT_OBJ_GFX_POKEFAN_F, .flags = 0x20100FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -1516,9 +1516,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SNUBBULL, .nickname = _("SNUBBINS"), .trainerName = _("DEVIN"), - .trainerGfxId = 48, + .trainerGfxId = EVENT_OBJ_GFX_GENTLEMAN, .flags = 0x8080FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -1545,9 +1545,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_MISDREAVUS, .nickname = _("DREAVIS"), .trainerName = _("TYLOR"), - .trainerGfxId = 40, + .trainerGfxId = EVENT_OBJ_GFX_HEX_MANIAC, .flags = 0x40040FFF, - .whichRank = 1, + .whichRank = CONTEST_RANK_SUPER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -1574,9 +1574,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_LAIRON, .nickname = _("LAIRN"), .trainerName = _("RONNIE"), - .trainerGfxId = 55, + .trainerGfxId = EVENT_OBJ_GFX_HIKER, .flags = 0x84000FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -1603,9 +1603,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SHIFTRY, .nickname = _("SHIFTY"), .trainerName = _("CLAUDIA"), - .trainerGfxId = 8, + .trainerGfxId = EVENT_OBJ_GFX_GIRL_1, .flags = 0x82000FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -1632,9 +1632,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_NINJASK, .nickname = _("NINAS"), .trainerName = _("ELIAS"), - .trainerGfxId = 11, + .trainerGfxId = EVENT_OBJ_GFX_LITTLE_BOY, .flags = 0x81000FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -1661,9 +1661,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SWELLOW, .nickname = _("WELOW"), .trainerName = _("JADE"), - .trainerGfxId = 18, + .trainerGfxId = EVENT_OBJ_GFX_POKEFAN_F, .flags = 0x80800FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -1690,9 +1690,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_MIGHTYENA, .nickname = _("YENA"), .trainerName = _("FRANCIS"), - .trainerGfxId = 44, + .trainerGfxId = EVENT_OBJ_GFX_BLACK_BELT, .flags = 0x80400FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -1719,9 +1719,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_BEAUTIFLY, .nickname = _("TIFLY"), .trainerName = _("ALISHA"), - .trainerGfxId = 26, + .trainerGfxId = EVENT_OBJ_GFX_WOMAN_4, .flags = 0x80200FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -1748,9 +1748,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SEAKING, .nickname = _("KINGSEA"), .trainerName = _("SAUL"), - .trainerGfxId = 31, + .trainerGfxId = EVENT_OBJ_GFX_CAMPER, .flags = 0x80100FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -1777,9 +1777,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_CASTFORM, .nickname = _("CASTER"), .trainerName = _("FELICIA"), - .trainerGfxId = 47, + .trainerGfxId = EVENT_OBJ_GFX_LASS, .flags = 0x80080FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = TRUE, @@ -1806,9 +1806,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_MACHOKE, .nickname = _("CHOKEM"), .trainerName = _("EMILIO"), - .trainerGfxId = 38, + .trainerGfxId = EVENT_OBJ_GFX_SCHOOL_KID_M, .flags = 0x80040FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -1835,9 +1835,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_LOMBRE, .nickname = _("LOMBE"), .trainerName = _("KARLA"), - .trainerGfxId = 10, + .trainerGfxId = EVENT_OBJ_GFX_GIRL_2, .flags = 0x80020FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = TRUE, @@ -1864,9 +1864,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SEVIPER, .nickname = _("VIPES"), .trainerName = _("DARRYL"), - .trainerGfxId = 33, + .trainerGfxId = EVENT_OBJ_GFX_MAN_3, .flags = 0x80010FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -1893,9 +1893,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_WAILMER, .nickname = _("MERAIL"), .trainerName = _("SELENA"), - .trainerGfxId = 22, + .trainerGfxId = EVENT_OBJ_GFX_EXPERT_F, .flags = 0x80008FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = TRUE, @@ -1922,9 +1922,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_MAGIKARP, .nickname = _("KARPAG"), .trainerName = _("NOEL"), - .trainerGfxId = 35, + .trainerGfxId = EVENT_OBJ_GFX_YOUNGSTER, .flags = 0x80004FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -1951,9 +1951,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_LUNATONE, .nickname = _("LUNONE"), .trainerName = _("LACEY"), - .trainerGfxId = 16, + .trainerGfxId = EVENT_OBJ_GFX_WOMAN_1, .flags = 0x80002FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -1980,9 +1980,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_ABSOL, .nickname = _("ABSO"), .trainerName = _("CORBIN"), - .trainerGfxId = 39, + .trainerGfxId = EVENT_OBJ_GFX_MANIAC, .flags = 0x80001FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -2009,9 +2009,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_EXEGGUTOR, .nickname = _("EGGSOR"), .trainerName = _("GRACIE"), - .trainerGfxId = 32, + .trainerGfxId = EVENT_OBJ_GFX_PICNICKER, .flags = 0xC000FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -2038,9 +2038,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_CUBONE, .nickname = _("CUBIN"), .trainerName = _("COLTIN"), - .trainerGfxId = 65, + .trainerGfxId = EVENT_OBJ_GFX_MAN_4, .flags = 0x82000FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -2067,9 +2067,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_HITMONLEE, .nickname = _("HITMON"), .trainerName = _("ELLIE"), - .trainerGfxId = 22, + .trainerGfxId = EVENT_OBJ_GFX_EXPERT_F, .flags = 0x21000FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -2096,9 +2096,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SQUIRTLE, .nickname = _("SURTLE"), .trainerName = _("MARCUS"), - .trainerGfxId = 49, + .trainerGfxId = EVENT_OBJ_GFX_SAILOR, .flags = 0x20800FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -2125,9 +2125,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_KANGASKHAN, .nickname = _("KHANKAN"), .trainerName = _("KIARA"), - .trainerGfxId = 14, + .trainerGfxId = EVENT_OBJ_GFX_GIRL_3, .flags = 0x80400FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -2154,9 +2154,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_PINECO, .nickname = _("PINOC"), .trainerName = _("BRYCE"), - .trainerGfxId = 36, + .trainerGfxId = EVENT_OBJ_GFX_BUG_CATCHER, .flags = 0x10200FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -2183,9 +2183,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_DUNSPARCE, .nickname = _("DILTOT"), .trainerName = _("JAMIE"), - .trainerGfxId = 34, + .trainerGfxId = EVENT_OBJ_GFX_WOMAN_5, .flags = 0x20100FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -2212,9 +2212,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_HOUNDOOM, .nickname = _("DOOMOND"), .trainerName = _("JORGE"), - .trainerGfxId = 48, + .trainerGfxId = EVENT_OBJ_GFX_GENTLEMAN, .flags = 0x8080FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -2241,9 +2241,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_MILTANK, .nickname = _("MILKAN"), .trainerName = _("DEVON"), - .trainerGfxId = 25, + .trainerGfxId = EVENT_OBJ_GFX_POKEFAN_M, .flags = 0x40040FFF, - .whichRank = 2, + .whichRank = CONTEST_RANK_HYPER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = TRUE, @@ -2270,9 +2270,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_GYARADOS, .nickname = _("RADOS"), .trainerName = _("JUSTINA"), - .trainerGfxId = 32, + .trainerGfxId = EVENT_OBJ_GFX_PICNICKER, .flags = 0x84000FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -2299,9 +2299,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_LOUDRED, .nickname = _("LOUDERD"), .trainerName = _("RALPH"), - .trainerGfxId = 21, + .trainerGfxId = EVENT_OBJ_GFX_EXPERT_M, .flags = 0x82000FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -2328,9 +2328,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SKITTY, .nickname = _("SITTY"), .trainerName = _("ROSA"), - .trainerGfxId = 8, + .trainerGfxId = EVENT_OBJ_GFX_GIRL_1, .flags = 0x81000FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = TRUE, @@ -2357,9 +2357,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SLAKING, .nickname = _("SLING"), .trainerName = _("KEATON"), - .trainerGfxId = 11, + .trainerGfxId = EVENT_OBJ_GFX_LITTLE_BOY, .flags = 0x80800FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -2386,9 +2386,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_ALTARIA, .nickname = _("TARIA"), .trainerName = _("MAYRA"), - .trainerGfxId = 18, + .trainerGfxId = EVENT_OBJ_GFX_POKEFAN_F, .flags = 0x80400FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -2415,9 +2415,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_KIRLIA, .nickname = _("LIRKI"), .trainerName = _("LAMAR"), - .trainerGfxId = 15, + .trainerGfxId = EVENT_OBJ_GFX_RICH_BOY, .flags = 0x80200FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -2444,9 +2444,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_BELLOSSOM, .nickname = _("BLOSSOM"), .trainerName = _("AUBREY"), - .trainerGfxId = 26, + .trainerGfxId = EVENT_OBJ_GFX_WOMAN_4, .flags = 0x80100FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = TRUE, @@ -2473,9 +2473,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SABLEYE, .nickname = _("EYESAB"), .trainerName = _("NIGEL"), - .trainerGfxId = 31, + .trainerGfxId = EVENT_OBJ_GFX_CAMPER, .flags = 0x80080FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -2502,9 +2502,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_NATU, .nickname = _("UTAN"), .trainerName = _("CAMILLE"), - .trainerGfxId = 47, + .trainerGfxId = EVENT_OBJ_GFX_LASS, .flags = 0x80040FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -2531,9 +2531,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SHARPEDO, .nickname = _("PEDOS"), .trainerName = _("DEON"), - .trainerGfxId = 38, + .trainerGfxId = EVENT_OBJ_GFX_SCHOOL_KID_M, .flags = 0x80020FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -2560,9 +2560,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_LUVDISC, .nickname = _("LUVIS"), .trainerName = _("JANELLE"), - .trainerGfxId = 10, + .trainerGfxId = EVENT_OBJ_GFX_GIRL_2, .flags = 0x80010FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -2589,9 +2589,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_HERACROSS, .nickname = _("HEROSS"), .trainerName = _("HEATH"), - .trainerGfxId = 33, + .trainerGfxId = EVENT_OBJ_GFX_MAN_3, .flags = 0x80008FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -2618,9 +2618,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_ELECTRODE, .nickname = _("RODLECT"), .trainerName = _("SASHA"), - .trainerGfxId = 6, + .trainerGfxId = EVENT_OBJ_GFX_TWIN, .flags = 0x80004FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -2647,9 +2647,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_PICHU, .nickname = _("CHUPY"), .trainerName = _("FRANKIE"), - .trainerGfxId = 35, + .trainerGfxId = EVENT_OBJ_GFX_YOUNGSTER, .flags = 0x80002FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = TRUE, @@ -2676,9 +2676,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_WOBBUFFET, .nickname = _("WOBET"), .trainerName = _("HELEN"), - .trainerGfxId = 16, + .trainerGfxId = EVENT_OBJ_GFX_WOMAN_1, .flags = 0x80001FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -2705,9 +2705,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_GENGAR, .nickname = _("GAREN"), .trainerName = _("CAMILE"), - .trainerGfxId = 40, + .trainerGfxId = EVENT_OBJ_GFX_HEX_MANIAC, .flags = 0xC000FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -2734,9 +2734,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_PORYGON, .nickname = _("GONPOR"), .trainerName = _("MARTIN"), - .trainerGfxId = 46, + .trainerGfxId = EVENT_OBJ_GFX_SCIENTIST_1, .flags = 0x82000FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = TRUE, @@ -2763,9 +2763,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_DRAGONITE, .nickname = _("DRITE"), .trainerName = _("SERGIO"), - .trainerGfxId = 7, + .trainerGfxId = EVENT_OBJ_GFX_BOY_1, .flags = 0x21000FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -2792,9 +2792,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_MEOWTH, .nickname = _("MEOWY"), .trainerName = _("KAILEY"), - .trainerGfxId = 6, + .trainerGfxId = EVENT_OBJ_GFX_TWIN, .flags = 0x20800FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -2821,9 +2821,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_JYNX, .nickname = _("NYX"), .trainerName = _("PERLA"), - .trainerGfxId = 45, + .trainerGfxId = EVENT_OBJ_GFX_BEAUTY, .flags = 0x80400FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = FALSE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -2850,9 +2850,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_TOGEPI, .nickname = _("GEPITO"), .trainerName = _("CLARA"), - .trainerGfxId = 20, + .trainerGfxId = EVENT_OBJ_GFX_WOMAN_2, .flags = 0x10200FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -2879,9 +2879,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_ESPEON, .nickname = _("SPEON"), .trainerName = _("JAKOB"), - .trainerGfxId = 37, + .trainerGfxId = EVENT_OBJ_GFX_PSYCHIC_M, .flags = 0x20100FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = TRUE, .aiPool_Beauty = TRUE, .aiPool_Cute = FALSE, @@ -2908,9 +2908,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_SLOWKING, .nickname = _("SLOWGO"), .trainerName = _("TREY"), - .trainerGfxId = 49, + .trainerGfxId = EVENT_OBJ_GFX_SAILOR, .flags = 0x8080FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = FALSE, .aiPool_Beauty = FALSE, .aiPool_Cute = TRUE, @@ -2937,9 +2937,9 @@ const struct ContestPokemon gContestOpponents[] = .species = SPECIES_URSARING, .nickname = _("URSING"), .trainerName = _("LANE"), - .trainerGfxId = 44, + .trainerGfxId = EVENT_OBJ_GFX_BLACK_BELT, .flags = 0x40040FFF, - .whichRank = 3, + .whichRank = CONTEST_RANK_MASTER, .aiPool_Cool = TRUE, .aiPool_Beauty = FALSE, .aiPool_Cute = FALSE, @@ -2967,7 +2967,7 @@ const struct ContestPokemon gContestOpponents[] = const u8 gPostgameContestOpponentFilter[] = { - [CONTEST_OPPONENT_JIMMY] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_JIMMY] = CONTEST_FILTER_NONE, [CONTEST_OPPONENT_EDITH] = CONTEST_FILTER_NONE, [CONTEST_OPPONENT_EVAN] = CONTEST_FILTER_NONE, [CONTEST_OPPONENT_KELSEY] = CONTEST_FILTER_NONE, @@ -2999,7 +2999,7 @@ const u8 gPostgameContestOpponentFilter[] = [CONTEST_OPPONENT_MORGAN] = CONTEST_FILTER_NONE, [CONTEST_OPPONENT_SUMMER] = CONTEST_FILTER_NONE, [CONTEST_OPPONENT_MILES] = CONTEST_FILTER_NONE, - [CONTEST_OPPONENT_AUDREY] = CONTEST_FILTER_NONE, + [CONTEST_OPPONENT_AUDREY] = CONTEST_FILTER_NONE, [CONTEST_OPPONENT_AVERY] = CONTEST_FILTER_NONE, [CONTEST_OPPONENT_ARIANA] = CONTEST_FILTER_NONE, [CONTEST_OPPONENT_ASHTON] = CONTEST_FILTER_NONE, @@ -3031,7 +3031,7 @@ const u8 gPostgameContestOpponentFilter[] = [CONTEST_OPPONENT_LACEY] = CONTEST_FILTER_NONE, [CONTEST_OPPONENT_CORBIN] = CONTEST_FILTER_NONE, [CONTEST_OPPONENT_GRACIE] = CONTEST_FILTER_ONLY_POSTGAME, - [CONTEST_OPPONENT_COLTIN] = CONTEST_FILTER_ONLY_POSTGAME, + [CONTEST_OPPONENT_COLTIN] = CONTEST_FILTER_ONLY_POSTGAME, [CONTEST_OPPONENT_ELLIE] = CONTEST_FILTER_ONLY_POSTGAME, [CONTEST_OPPONENT_MARCUS] = CONTEST_FILTER_ONLY_POSTGAME, [CONTEST_OPPONENT_KIARA] = CONTEST_FILTER_ONLY_POSTGAME, @@ -3063,4 +3063,4 @@ const u8 gPostgameContestOpponentFilter[] = [CONTEST_OPPONENT_JAKOB] = CONTEST_FILTER_ONLY_POSTGAME, [CONTEST_OPPONENT_TREY] = CONTEST_FILTER_ONLY_POSTGAME, [CONTEST_OPPONENT_LANE] = CONTEST_FILTER_ONLY_POSTGAME -}; \ No newline at end of file +}; diff --git a/src/data/contest_text_tables.h b/src/data/contest_text_tables.h index fa32f33b5..8375520d1 100644 --- a/src/data/contest_text_tables.h +++ b/src/data/contest_text_tables.h @@ -196,53 +196,53 @@ extern const u8 gText_0827E8CA[]; const u8 *const gContestEffectDescriptionPointers[] = { gContestEffect00hDescription, - gContestEffect01hDescription, + gContestEffect01hDescription, gContestEffect02hDescription, - gContestEffect03hDescription, - gContestEffect04hDescription, - gContestEffect05hDescription, - gContestEffect06hDescription, - gContestEffect07hDescription, - gContestEffect08hDescription, - gContestEffect09hDescription, - gContestEffect0AhDescription, - gContestEffect0BhDescription, - gContestEffect0ChDescription, - gContestEffect0DhDescription, - gContestEffect0EhDescription, - gContestEffect0FhDescription, - gContestEffect10hDescription, - gContestEffect11hDescription, - gContestEffect12hDescription, - gContestEffect13hDescription, - gContestEffect14hDescription, - gContestEffect15hDescription, - gContestEffect16hDescription, - gContestEffect17hDescription, - gContestEffect18hDescription, - gContestEffect19hDescription, - gContestEffect1AhDescription, - gContestEffect1BhDescription, - gContestEffect1ChDescription, - gContestEffect1DhDescription, - gContestEffect1EhDescription, - gContestEffect1FhDescription, - gContestEffect20hDescription, - gContestEffect21hDescription, - gContestEffect22hDescription, - gContestEffect23hDescription, - gContestEffect24hDescription, - gContestEffect25hDescription, - gContestEffect26hDescription, - gContestEffect27hDescription, - gContestEffect28hDescription, - gContestEffect29hDescription, - gContestEffect2AhDescription, - gContestEffect2BhDescription, - gContestEffect2ChDescription, - gContestEffect2DhDescription, - gContestEffect2EhDescription, - gContestEffect2FhDescription + gContestEffect03hDescription, + gContestEffect04hDescription, + gContestEffect05hDescription, + gContestEffect06hDescription, + gContestEffect07hDescription, + gContestEffect08hDescription, + gContestEffect09hDescription, + gContestEffect0AhDescription, + gContestEffect0BhDescription, + gContestEffect0ChDescription, + gContestEffect0DhDescription, + gContestEffect0EhDescription, + gContestEffect0FhDescription, + gContestEffect10hDescription, + gContestEffect11hDescription, + gContestEffect12hDescription, + gContestEffect13hDescription, + gContestEffect14hDescription, + gContestEffect15hDescription, + gContestEffect16hDescription, + gContestEffect17hDescription, + gContestEffect18hDescription, + gContestEffect19hDescription, + gContestEffect1AhDescription, + gContestEffect1BhDescription, + gContestEffect1ChDescription, + gContestEffect1DhDescription, + gContestEffect1EhDescription, + gContestEffect1FhDescription, + gContestEffect20hDescription, + gContestEffect21hDescription, + gContestEffect22hDescription, + gContestEffect23hDescription, + gContestEffect24hDescription, + gContestEffect25hDescription, + gContestEffect26hDescription, + gContestEffect27hDescription, + gContestEffect28hDescription, + gContestEffect29hDescription, + gContestEffect2AhDescription, + gContestEffect2BhDescription, + gContestEffect2ChDescription, + gContestEffect2DhDescription, + gContestEffect2EhDescription, + gContestEffect2FhDescription }; // Unreferenced array of pointers to move names. @@ -278,18 +278,18 @@ const u8 *const gContestMoveTypeTextPointers[] = const u8 *const gUnknown_08587D5C[] = { gText_0827D5C1, - gText_0827D5DC, - gText_0827D600, - gText_0827D612, - gText_0827D612, - gText_0827D62D, - gText_0827D654, - gText_0827D67E, - gText_0827D69C, - gText_0827D6BA, - gText_0827D6E5, - gText_0827D706, - gText_0827D71D + gText_0827D5DC, + gText_0827D600, + gText_0827D612, + gText_0827D612, + gText_0827D62D, + gText_0827D654, + gText_0827D67E, + gText_0827D69C, + gText_0827D6BA, + gText_0827D6E5, + gText_0827D706, + gText_0827D71D }; const u8 *const gUnknown_08587D90[] = @@ -411,4 +411,4 @@ const u8 *const gUnknown_08587F1C[] = gText_0827E8B4, gText_0827E8BF, gText_0827E8CA -}; \ No newline at end of file +}; From 23ac2cc94e2914a427e97467103c0160af6f1be0 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Sun, 31 Mar 2019 20:15:44 -0400 Subject: [PATCH 028/101] Prep for merge --- include/sprite.h | 20 -------------------- src/contest.c | 6 ++++-- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/include/sprite.h b/include/sprite.h index 10c4145b0..32bdd9c55 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -151,26 +151,6 @@ enum SUBSPRITES_IGNORE_PRIORITY, // on but priority is ignored }; -#define OAM_SIZE_0 (0) -#define OAM_SIZE_1 (1 << 0) -#define OAM_SIZE_2 (1 << 1) -#define OAM_SIZE_3 (1 << 2) - -#define SPRITE_SIZE_8x8 .shape = ST_OAM_SQUARE, .size = OAM_SIZE_0 -#define SPRITE_SIZE_16x16 .shape = ST_OAM_SQUARE, .size = OAM_SIZE_1 -#define SPRITE_SIZE_32x32 .shape = ST_OAM_SQUARE, .size = OAM_SIZE_2 -#define SPRITE_SIZE_64x64 .shape = ST_OAM_SQUARE, .size = OAM_SIZE_3 - -#define SPRITE_SIZE_16x8 .shape = ST_OAM_H_RECTANGLE, .size = OAM_SIZE_0 -#define SPRITE_SIZE_32x8 .shape = ST_OAM_H_RECTANGLE, .size = OAM_SIZE_1 -#define SPRITE_SIZE_32x16 .shape = ST_OAM_H_RECTANGLE, .size = OAM_SIZE_2 -#define SPRITE_SIZE_64x32 .shape = ST_OAM_H_RECTANGLE, .size = OAM_SIZE_3 - -#define SPRITE_SIZE_8x16 .shape = ST_OAM_V_RECTANGLE, .size = OAM_SIZE_0 -#define SPRITE_SIZE_8x32 .shape = ST_OAM_V_RECTANGLE, .size = OAM_SIZE_1 -#define SPRITE_SIZE_16x32 .shape = ST_OAM_V_RECTANGLE, .size = OAM_SIZE_2 -#define SPRITE_SIZE_32x64 .shape = ST_OAM_V_RECTANGLE, .size = OAM_SIZE_3 - struct Subsprite { s8 x; // was u16 in R/S diff --git a/src/contest.c b/src/contest.c index da3075e65..53d7e547d 100644 --- a/src/contest.c +++ b/src/contest.c @@ -412,14 +412,16 @@ const struct Subsprite gSubspriteTable_8587B78[] = { .x = -28, .y = -4, - SPRITE_SIZE_32x8, + .shape = ST_OAM_H_RECTANGLE, + .size = 1, .tileOffset = 0, .priority = 0 }, { .x = 4, .y = -4, - SPRITE_SIZE_32x8, + .shape = ST_OAM_H_RECTANGLE, + .size = 1, .tileOffset = 4, .priority = 0 } From b7057e8d923e78c6d29ab122b3e136ca93fdd7b4 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Sun, 31 Mar 2019 20:33:25 -0400 Subject: [PATCH 029/101] Update OAMs to use new constants --- src/contest.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/contest.c b/src/contest.c index 53d7e547d..0591668ff 100644 --- a/src/contest.c +++ b/src/contest.c @@ -272,10 +272,10 @@ static const struct OamData gOamData_8587A7C = .objMode = 0, .mosaic = 0, .bpp = 0, - .shape = 0, + .shape = SPRITE_SHAPE(8x8), .x = 0, .matrixNum = 0, - .size = 0, + .size = SPRITE_SIZE(8x8), .tileNum = 0, .priority = 0, .paletteNum = 0, @@ -357,10 +357,10 @@ static const struct OamData gOamData_8587B10 = .objMode = 0, .mosaic = 0, .bpp = 0, - .shape = 1, + .shape = SPRITE_SHAPE(32x8), .x = 0, .matrixNum = 0, - .size = 1, + .size = SPRITE_SIZE(32x8), .tileNum = 0, .priority = 0, .paletteNum = 0, @@ -449,10 +449,10 @@ const struct OamData gOamData_8587B90 = .objMode = 0, .mosaic = 0, .bpp = 0, - .shape = 0, + .shape = SPRITE_SHAPE(16x16), .x = 0, .matrixNum = 0, - .size = 1, + .size = SPRITE_SIZE(16x16), .tileNum = 0, .priority = 0, .paletteNum = 0, @@ -490,10 +490,10 @@ const struct OamData gOamData_8587BC0 = .objMode = 0, .mosaic = 0, .bpp = 0, - .shape = 1, + .shape = SPRITE_SHAPE(64x32), .x = 0, .matrixNum = 0, - .size = 3, + .size = SPRITE_SIZE(64x32), .tileNum = 0, .priority = 0, .paletteNum = 0, @@ -518,10 +518,10 @@ const struct OamData gOamData_8587BE0 = .objMode = 0, .mosaic = 0, .bpp = 0, - .shape = 0, + .shape = SPRITE_SHAPE(64x64), .x = 0, .matrixNum = 0, - .size = 3, + .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 3, .paletteNum = 2, @@ -772,10 +772,10 @@ const struct OamData gOamData_8589944 = .objMode = 1, .mosaic = 0, .bpp = 0, - .shape = 0, + .shape = SPRITE_SHAPE(64x64), .x = 0, .matrixNum = 0, - .size = 3, + .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 0, .paletteNum = 0, From 3181c64c64afa47b3adc04f325ad3798c8c324ec Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Sun, 31 Mar 2019 20:40:14 -0400 Subject: [PATCH 030/101] Change names from MAP_AREA_ to MAP_GROUP_ --- include/constants/maps.h | 6 +++--- src/pokedex_area_screen.c | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/constants/maps.h b/include/constants/maps.h index 93291f29e..b849749a9 100644 --- a/include/constants/maps.h +++ b/include/constants/maps.h @@ -11,8 +11,8 @@ // These groups are used by pokedex_area_screen.c to find wild // pokemon locations. -#define MAP_AREA_OVERWORLD_MONS MAP_GROUP(PETALBURG_CITY) -#define MAP_AREA_SPECIAL_MONS_1 MAP_GROUP(METEOR_FALLS_1F_1R) -#define MAP_AREA_SPECIAL_MONS_2 MAP_GROUP(SAFARI_ZONE_NORTHWEST) +#define MAP_GROUP_OVERWORLD_MONS MAP_GROUP(PETALBURG_CITY) +#define MAP_GROUP_SPECIAL_MONS_1 MAP_GROUP(METEOR_FALLS_1F_1R) +#define MAP_GROUP_SPECIAL_MONS_2 MAP_GROUP(SAFARI_ZONE_NORTHWEST) #endif // GUARD_CONSTANTS_MAPS_H diff --git a/src/pokedex_area_screen.c b/src/pokedex_area_screen.c index d43c556c8..7404e9d5a 100755 --- a/src/pokedex_area_screen.c +++ b/src/pokedex_area_screen.c @@ -341,11 +341,11 @@ static void FindMapsWithMon(u16 species) { switch (sFeebasData[i][1]) { - case MAP_AREA_OVERWORLD_MONS: + case MAP_GROUP_OVERWORLD_MONS: SetAreaHasMon(sFeebasData[i][1], sFeebasData[i][2]); break; - case MAP_AREA_SPECIAL_MONS_1: - case MAP_AREA_SPECIAL_MONS_2: + case MAP_GROUP_SPECIAL_MONS_1: + case MAP_GROUP_SPECIAL_MONS_2: SetSpecialMapHasMon(sFeebasData[i][1], sFeebasData[i][2]); break; } @@ -358,11 +358,11 @@ static void FindMapsWithMon(u16 species) { switch (gWildMonHeaders[i].mapGroup) { - case MAP_AREA_OVERWORLD_MONS: + case MAP_GROUP_OVERWORLD_MONS: SetAreaHasMon(gWildMonHeaders[i].mapGroup, gWildMonHeaders[i].mapNum); break; - case MAP_AREA_SPECIAL_MONS_1: - case MAP_AREA_SPECIAL_MONS_2: + case MAP_GROUP_SPECIAL_MONS_1: + case MAP_GROUP_SPECIAL_MONS_2: SetSpecialMapHasMon(gWildMonHeaders[i].mapGroup, gWildMonHeaders[i].mapNum); break; } From 099ea89b77fdde1a6b31c7ef3e1975e57a175dd9 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sun, 31 Mar 2019 21:07:29 -0500 Subject: [PATCH 031/101] Document rain weather effect --- include/field_weather.h | 14 +- src/braille_puzzles.c | 72 ++-- src/field_weather.c | 5 +- src/field_weather_effect.c | 829 +++++++++++++++++++------------------ 4 files changed, 478 insertions(+), 442 deletions(-) diff --git a/include/field_weather.h b/include/field_weather.h index 76399200d..38fba68f1 100644 --- a/include/field_weather.h +++ b/include/field_weather.h @@ -3,6 +3,8 @@ #include "sprite.h" +#define MAX_RAIN_SPRITES 24 + // Controls how the weather should be changing the screen palettes. enum { @@ -27,7 +29,7 @@ struct Weather { struct { - struct Sprite *rainSprites[24]; + struct Sprite *rainSprites[MAX_RAIN_SPRITES]; struct Sprite *snowflakeSprites[101]; struct Sprite *cloudSprites[3]; } s1; @@ -62,12 +64,12 @@ struct Weather bool8 weatherChangeComplete; u8 weatherPicSpritePalIndex; u8 altGammaSpritePalIndex; - u16 unknown_6D6; - u8 unknown_6D8; - u8 unknown_6D9; + u16 rainSpriteVisibleCounter; + u8 curRainSpriteIndex; + u8 maxRainSprites; u8 rainSpriteCount; - u8 unknown_6DB; - u8 unknown_6DC; + u8 rainSpriteVisibleDelay; + u8 isHeavyRain; u8 rainStrength; /*0x6DE*/ u8 cloudSpritesCreated; u8 filler_6DF[1]; diff --git a/src/braille_puzzles.c b/src/braille_puzzles.c index 07b941f11..659f8682e 100644 --- a/src/braille_puzzles.c +++ b/src/braille_puzzles.c @@ -25,42 +25,42 @@ EWRAM_DATA static u8 sBraillePuzzleCallbackFlag = 0; static const u8 gRegicePathCoords[][2] = { - {0x04, 0x15}, - {0x05, 0x15}, - {0x06, 0x15}, - {0x07, 0x15}, - {0x08, 0x15}, - {0x09, 0x15}, - {0x0a, 0x15}, - {0x0b, 0x15}, - {0x0c, 0x15}, - {0x0c, 0x16}, - {0x0c, 0x17}, - {0x0d, 0x17}, - {0x0d, 0x18}, - {0x0d, 0x19}, - {0x0d, 0x1a}, - {0x0d, 0x1b}, - {0x0c, 0x1b}, - {0x0c, 0x1c}, - {0x04, 0x1d}, - {0x05, 0x1d}, - {0x06, 0x1d}, - {0x07, 0x1d}, - {0x08, 0x1d}, - {0x09, 0x1d}, - {0x0a, 0x1d}, - {0x0b, 0x1d}, - {0x0c, 0x1d}, - {0x04, 0x1c}, - {0x04, 0x1b}, - {0x03, 0x1b}, - {0x03, 0x1a}, - {0x03, 0x19}, - {0x03, 0x18}, - {0x03, 0x17}, - {0x04, 0x17}, - {0x04, 0x16}, + {4, 21}, + {5, 21}, + {6, 21}, + {7, 21}, + {8, 21}, + {9, 21}, + {10, 21}, + {11, 21}, + {12, 21}, + {12, 22}, + {12, 23}, + {13, 23}, + {13, 24}, + {13, 25}, + {13, 26}, + {13, 27}, + {12, 27}, + {12, 28}, + {4, 29}, + {5, 29}, + {6, 29}, + {7, 29}, + {8, 29}, + {9, 29}, + {10, 29}, + {11, 29}, + {12, 29}, + {4, 28}, + {4, 27}, + {3, 27}, + {3, 26}, + {3, 25}, + {3, 24}, + {3, 23}, + {4, 23}, + {4, 22}, }; void SealedChamberShakingEffect(u8); diff --git a/src/field_weather.c b/src/field_weather.c index 9913e9a61..a2c40052b 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -167,7 +167,7 @@ void StartWeather(void) gWeatherPtr->altGammaSpritePalIndex = index; gWeatherPtr->weatherPicSpritePalIndex = AllocSpritePalette(0x1201); gWeatherPtr->rainSpriteCount = 0; - gWeatherPtr->unknown_6D8 = 0; + gWeatherPtr->curRainSpriteIndex = 0; gWeatherPtr->cloudSpritesCreated = 0; gWeatherPtr->snowflakeSpriteCount = 0; gWeatherPtr->ashSpritesCreated = 0; @@ -234,7 +234,8 @@ static void Task_WeatherMain(u8 taskId) { if (gWeatherPtr->currWeather != gWeatherPtr->nextWeather) { - if (!sWeatherFuncs[gWeatherPtr->currWeather].finish() && gWeatherPtr->palProcessingState != WEATHER_PAL_STATE_SCREEN_FADING_OUT) + if (!sWeatherFuncs[gWeatherPtr->currWeather].finish() + && gWeatherPtr->palProcessingState != WEATHER_PAL_STATE_SCREEN_FADING_OUT) { // Finished cleaning up previous weather. Now transition to next weather. sWeatherFuncs[gWeatherPtr->nextWeather].initVars(); diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index 6ec83f1a0..95f80d061 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -12,9 +12,6 @@ #include "trig.h" #include "gpu_regs.h" -// This file's functions. -void sub_80AC6B4(struct Sprite *); - // EWRAM EWRAM_DATA static u8 gCurrentAlternatingWeather = 0; EWRAM_DATA static u16 gUnusedWeatherRelated = 0; @@ -32,6 +29,12 @@ const u8 gWeatherAshTiles[] = INCBIN_U8("graphics/weather/ash.4bpp"); const u8 gWeatherRainTiles[] = INCBIN_U8("graphics/weather/rain.4bpp"); const u8 gWeatherSandstormTiles[] = INCBIN_U8("graphics/weather/sandstorm.4bpp"); +//------------------------------------------------------------------------------ +// Clouds +//------------------------------------------------------------------------------ + +static void sub_80AC6B4(struct Sprite *); + static const struct Coords16 gUnknown_0854FB50[] = { { 0, 66}, @@ -39,7 +42,12 @@ static const struct Coords16 gUnknown_0854FB50[] = {10, 78}, }; -static const struct SpriteSheet sCloudSpriteSheet = {gWeatherCloudTiles, sizeof(gWeatherCloudTiles), 0x1200}; +static const struct SpriteSheet sCloudSpriteSheet = +{ + .data = gWeatherCloudTiles, + .size = sizeof(gWeatherCloudTiles), + .tag = 0x1200 +}; static const struct OamData gOamData_839A9DC = { @@ -80,10 +88,6 @@ static const struct SpriteTemplate sCloudSpriteTemplate = .callback = sub_80AC6B4, }; -//------------------------------------------------------------------------------ -// Clouds -//------------------------------------------------------------------------------ - void Clouds_InitVars(void) { gWeatherPtr->gammaTargetIndex = 0; @@ -214,7 +218,7 @@ void sub_807E0A0(void) gWeatherPtr->cloudSpritesCreated = FALSE; } -void sub_80AC6B4(struct Sprite *sprite) +static void sub_80AC6B4(struct Sprite *sprite) { sprite->data[0] = (sprite->data[0] + 1) & 1; if (sprite->data[0] != 0) @@ -350,197 +354,11 @@ void task50_0807B6D4(u8 taskId) // Light Rain //------------------------------------------------------------------------------ -void LightRain_InitVars(void) -{ - gWeatherPtr->initStep = 0; - gWeatherPtr->weatherGfxLoaded = FALSE; - gWeatherPtr->unknown_6D6 = 0; - gWeatherPtr->unknown_6DB = 8; - gWeatherPtr->unknown_6DC = 0; - gWeatherPtr->unknown_6D9 = 10; - gWeatherPtr->gammaTargetIndex = 3; - gWeatherPtr->gammaStepDelay = 20; - SetRainStrengthFromSoundEffect(SE_T_KOAME); -} - -void LightRain_InitAll(void) -{ - LightRain_InitVars(); - while (gWeatherPtr->weatherGfxLoaded == FALSE) - LightRain_Main(); -} - -void LoadRainSpriteSheet(void); -u8 CreateRainSprite(void); -u8 sub_807E8E8(void); - -void LightRain_Main(void) -{ - switch (gWeatherPtr->initStep) - { - case 0: - LoadRainSpriteSheet(); - gWeatherPtr->initStep++; - break; - case 1: - if (CreateRainSprite() == 0) - gWeatherPtr->initStep++; - break; - case 2: - if (sub_807E8E8() == FALSE) - { - gWeatherPtr->weatherGfxLoaded = TRUE; - gWeatherPtr->initStep++; - } - break; - } -} - -void DestroyRainSprites(void); - -bool8 LightRain_Finish(void) -{ - switch (gWeatherPtr->finishStep) - { - case 0: - if (gWeatherPtr->nextWeather == WEATHER_RAIN_LIGHT - || gWeatherPtr->nextWeather == WEATHER_RAIN_MED - || gWeatherPtr->nextWeather == WEATHER_RAIN_HEAVY) - { - gWeatherPtr->finishStep = 0xFF; - return FALSE; - } - else - { - gWeatherPtr->unknown_6D9 = 0; - gWeatherPtr->finishStep++; - } - // fall through - case 1: - if (sub_807E8E8() == FALSE) - { - DestroyRainSprites(); - gWeatherPtr->finishStep++; - return FALSE; - } - return TRUE; - } - return FALSE; -} - -// defined below -extern const s16 gUnknown_0839AABC[][2]; -extern const u16 gUnknown_0839AAC4[][2]; - -void sub_807E4EC(struct Sprite *sprite) -{ - u32 randVal; - u16 r6; - s32 r4; - s32 r0; - - if (sprite->data[1] == 0) - sprite->data[1] = 361; - randVal = sprite->data[1] * 1103515245 + 12345; - sprite->data[1] = ((randVal & 0x7FFF0000) >> 16) % 600; - - r6 = gUnknown_0839AAC4[gWeatherPtr->unknown_6DC][0]; - - r4 = sprite->data[1] % 30; - sprite->data[2] = r4 * 8; // useless assignment - - r0 = sprite->data[1] / 30; - sprite->data[3] = r0 * 8; // useless assignment - - sprite->data[2] = r4; - sprite->data[2] <<= 7; - - sprite->data[3] = r0; - sprite->data[3] <<= 7; - - sprite->data[2] -= gUnknown_0839AABC[gWeatherPtr->unknown_6DC][0] * r6; - sprite->data[3] -= gUnknown_0839AABC[gWeatherPtr->unknown_6DC][1] * r6; - - StartSpriteAnim(sprite, 0); - sprite->data[4] = 0; - sprite->coordOffsetEnabled = FALSE; - sprite->data[0] = r6; -} - -void sub_807E5C0(struct Sprite *sprite) -{ - if (sprite->data[4] == 0) - { - sprite->data[2] += gUnknown_0839AABC[gWeatherPtr->unknown_6DC][0]; - sprite->data[3] += gUnknown_0839AABC[gWeatherPtr->unknown_6DC][1]; - sprite->pos1.x = sprite->data[2] >> 4; - sprite->pos1.y = sprite->data[3] >> 4; - - if (sprite->data[5] != 0 - && (sprite->pos1.x >= -8 && sprite->pos1.x <= 248) - && sprite->pos1.y >= -16 && sprite->pos1.y <= 176) - sprite->invisible = FALSE; - else - sprite->invisible = TRUE; - - sprite->data[0]--; - if (sprite->data[0] == 0) - { - StartSpriteAnim(sprite, gWeatherPtr->unknown_6DC + 1); - sprite->data[4] = 1; - sprite->pos1.x -= gSpriteCoordOffsetX; - sprite->pos1.y -= gSpriteCoordOffsetY; - sprite->coordOffsetEnabled = TRUE; - } - } - else if (sprite->animEnded) - { - sprite->invisible = TRUE; - sub_807E4EC(sprite); - } -} - -void sub_807E6C4(struct Sprite *sprite) -{ - if (sprite->data[0] == 0) - { - sub_807E4EC(sprite); - sprite->callback = sub_807E5C0; - } - else - { - sprite->data[0]--; - } -} - -void sub_807E6F0(struct Sprite *sprite, u16 b) -{ - u16 r8 = gUnknown_0839AAC4[gWeatherPtr->unknown_6DC][0]; - u16 r6 = b / (gUnknown_0839AAC4[gWeatherPtr->unknown_6DC][1] + r8); - u16 r4 = b % (gUnknown_0839AAC4[gWeatherPtr->unknown_6DC][1] + r8); - - while (--r6 != 0xFFFF) - sub_807E4EC(sprite); - if (r4 < r8) - { - while (--r4 != 0xFFFF) - sub_807E5C0(sprite); - sprite->data[6] = 0; - } - else - { - sprite->data[0] = r4 - r8; - sprite->invisible = TRUE; - sprite->data[6] = 1; - } -} - -extern const struct SpriteSheet sRainSpriteSheet; // defined below - -void LoadRainSpriteSheet(void) -{ - LoadSpriteSheet(&sRainSpriteSheet); -} +static void LoadRainSpriteSheet(void); +static bool8 CreateRainSprite(void); +static void UpdateRainSprite(struct Sprite *sprite); +static bool8 UpdateVisibleRainSprites(void); +static void DestroyRainSprites(void); static const struct Coords16 sRainSpriteCoords[] = { @@ -570,7 +388,7 @@ static const struct Coords16 sRainSpriteCoords[] = { 48, 96}, }; -static const struct OamData gOamData_839AA68 = +static const struct OamData sRainSpriteOamData = { .y = 0, .affineMode = 0, @@ -587,13 +405,13 @@ static const struct OamData gOamData_839AA68 = .affineParam = 0, }; -static const union AnimCmd gSpriteAnim_839AA70[] = +static const union AnimCmd sRainSpriteFallAnimCmd[] = { ANIMCMD_FRAME(0, 16), ANIMCMD_JUMP(0), }; -static const union AnimCmd gSpriteAnim_839AA78[] = +static const union AnimCmd sRainSpriteSplashAnimCmd[] = { ANIMCMD_FRAME(8, 3), ANIMCMD_FRAME(32, 2), @@ -601,7 +419,7 @@ static const union AnimCmd gSpriteAnim_839AA78[] = ANIMCMD_END, }; -static const union AnimCmd gSpriteAnim_839AA88[] = +static const union AnimCmd sRainSpriteHeavySplashAnimCmd[] = { ANIMCMD_FRAME(8, 3), ANIMCMD_FRAME(16, 3), @@ -609,37 +427,418 @@ static const union AnimCmd gSpriteAnim_839AA88[] = ANIMCMD_END, }; -static const union AnimCmd *const gSpriteAnimTable_839AA98[] = +static const union AnimCmd *const sRainSpriteAnimCmds[] = { - gSpriteAnim_839AA70, - gSpriteAnim_839AA78, - gSpriteAnim_839AA88, + sRainSpriteFallAnimCmd, + sRainSpriteSplashAnimCmd, + sRainSpriteHeavySplashAnimCmd, }; static const struct SpriteTemplate sRainSpriteTemplate = { .tileTag = 4614, .paletteTag = 4608, - .oam = &gOamData_839AA68, - .anims = gSpriteAnimTable_839AA98, + .oam = &sRainSpriteOamData, + .anims = sRainSpriteAnimCmds, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_807E5C0, + .callback = UpdateRainSprite, }; -const s16 gUnknown_0839AABC[][2] = +// Q28.4 fixed-point format values +static const s16 sRainSpriteMovement[][2] = { - {-104, 208}, - {-160, 320}, + {-0x68, 0xD0}, + {-0xA0, 0x140}, }; -const u16 gUnknown_0839AAC4[][2] = +// First byte is the number of frames a raindrop falls before it splashes. +// Second byte is the maximum number of frames a raindrop can "wait" before +// it appears and starts falling. (This is only for the initial raindrop spawn.) +static const u16 sRainSpriteFallingDurations[][2] = { {18, 7}, {12, 10}, }; -static const struct SpriteSheet sRainSpriteSheet = {gWeatherRainTiles, sizeof(gWeatherRainTiles), 0x1206}; +static const struct SpriteSheet sRainSpriteSheet = +{ + .data = gWeatherRainTiles, + .size = sizeof(gWeatherRainTiles), + .tag = 0x1206, +}; + +void LightRain_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = FALSE; + gWeatherPtr->rainSpriteVisibleCounter = 0; + gWeatherPtr->rainSpriteVisibleDelay = 8; + gWeatherPtr->isHeavyRain = 0; + gWeatherPtr->maxRainSprites = 10; + gWeatherPtr->gammaTargetIndex = 3; + gWeatherPtr->gammaStepDelay = 20; + SetRainStrengthFromSoundEffect(SE_T_KOAME); +} + +void LightRain_InitAll(void) +{ + LightRain_InitVars(); + while (!gWeatherPtr->weatherGfxLoaded) + LightRain_Main(); +} + +void LightRain_Main(void) +{ + switch (gWeatherPtr->initStep) + { + case 0: + LoadRainSpriteSheet(); + gWeatherPtr->initStep++; + break; + case 1: + if (!CreateRainSprite()) + gWeatherPtr->initStep++; + break; + case 2: + if (!UpdateVisibleRainSprites()) + { + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + } + break; + } +} + +bool8 LightRain_Finish(void) +{ + switch (gWeatherPtr->finishStep) + { + case 0: + if (gWeatherPtr->nextWeather == WEATHER_RAIN_LIGHT + || gWeatherPtr->nextWeather == WEATHER_RAIN_MED + || gWeatherPtr->nextWeather == WEATHER_RAIN_HEAVY) + { + gWeatherPtr->finishStep = 0xFF; + return FALSE; + } + else + { + gWeatherPtr->maxRainSprites = 0; + gWeatherPtr->finishStep++; + } + // fall through + case 1: + if (!UpdateVisibleRainSprites()) + { + DestroyRainSprites(); + gWeatherPtr->finishStep++; + return FALSE; + } + return TRUE; + } + return FALSE; +} + +#define tCounter data[0] +#define tRandom data[1] +#define tPosX data[2] +#define tPosY data[3] +#define tState data[4] +#define tActive data[5] +#define tWaiting data[6] + +static void StartRainSpriteFall(struct Sprite *sprite) +{ + u32 rand; + u16 numFallingFrames; + int tileX; + int tileY; + + if (sprite->tRandom == 0) + sprite->tRandom = 361; + + // Standard RNG sequence. + rand = sprite->tRandom * 1103515245 + 12345; + sprite->tRandom = ((rand & 0x7FFF0000) >> 16) % 600; + + numFallingFrames = sRainSpriteFallingDurations[gWeatherPtr->isHeavyRain][0]; + + tileX = sprite->tRandom % 30; + sprite->tPosX = tileX * 8; // Useless assignment, leftover from before fixed-point values were used + + tileY = sprite->tRandom / 30; + sprite->tPosY = tileY * 8; // Useless assignment, leftover from before fixed-point values were used + + sprite->tPosX = tileX; + sprite->tPosX <<= 7; // This is tileX * 8, using a fixed-point value with 4 decimal places + + sprite->tPosY = tileY; + sprite->tPosY <<= 7; // This is tileX * 8, using a fixed-point value with 4 decimal places + + // "Rewind" the rain sprites, from their ending position. + sprite->tPosX -= sRainSpriteMovement[gWeatherPtr->isHeavyRain][0] * numFallingFrames; + sprite->tPosY -= sRainSpriteMovement[gWeatherPtr->isHeavyRain][1] * numFallingFrames; + + StartSpriteAnim(sprite, 0); + sprite->tState = 0; + sprite->coordOffsetEnabled = FALSE; + sprite->tCounter = numFallingFrames; +} + +static void UpdateRainSprite(struct Sprite *sprite) +{ + if (sprite->tState == 0) + { + // Raindrop is in its "falling" motion. + sprite->tPosX += sRainSpriteMovement[gWeatherPtr->isHeavyRain][0]; + sprite->tPosY += sRainSpriteMovement[gWeatherPtr->isHeavyRain][1]; + sprite->pos1.x = sprite->tPosX >> 4; + sprite->pos1.y = sprite->tPosY >> 4; + + if (sprite->tActive + && (sprite->pos1.x >= -8 && sprite->pos1.x <= 248) + && sprite->pos1.y >= -16 && sprite->pos1.y <= 176) + sprite->invisible = FALSE; + else + sprite->invisible = TRUE; + + if (--sprite->tCounter == 0) + { + // Make raindrop splash on the ground + StartSpriteAnim(sprite, gWeatherPtr->isHeavyRain + 1); + sprite->tState = 1; + sprite->pos1.x -= gSpriteCoordOffsetX; + sprite->pos1.y -= gSpriteCoordOffsetY; + sprite->coordOffsetEnabled = TRUE; + } + } + else if (sprite->animEnded) + { + // The splashing animation ended. + sprite->invisible = TRUE; + StartRainSpriteFall(sprite); + } +} + +static void WaitRainSprite(struct Sprite *sprite) +{ + if (sprite->tCounter == 0) + { + StartRainSpriteFall(sprite); + sprite->callback = UpdateRainSprite; + } + else + { + sprite->tCounter--; + } +} + +static void InitRainSpriteMovement(struct Sprite *sprite, u16 val) +{ + u16 numFallingFrames = sRainSpriteFallingDurations[gWeatherPtr->isHeavyRain][0]; + u16 numAdvanceRng = val / (sRainSpriteFallingDurations[gWeatherPtr->isHeavyRain][1] + numFallingFrames); + u16 frameVal = val % (sRainSpriteFallingDurations[gWeatherPtr->isHeavyRain][1] + numFallingFrames); + + while (--numAdvanceRng != 0xFFFF) + StartRainSpriteFall(sprite); + + if (frameVal < numFallingFrames) + { + while (--frameVal != 0xFFFF) + UpdateRainSprite(sprite); + + sprite->tWaiting = 0; + } + else + { + sprite->tCounter = frameVal - numFallingFrames; + sprite->invisible = TRUE; + sprite->tWaiting = 1; + } +} + +static void LoadRainSpriteSheet(void) +{ + LoadSpriteSheet(&sRainSpriteSheet); +} + +static bool8 CreateRainSprite(void) +{ + u8 spriteIndex; + u8 spriteId; + + if (gWeatherPtr->rainSpriteCount == MAX_RAIN_SPRITES) + return FALSE; + + spriteIndex = gWeatherPtr->rainSpriteCount; + spriteId = CreateSpriteAtEnd(&sRainSpriteTemplate, + sRainSpriteCoords[spriteIndex].x, sRainSpriteCoords[spriteIndex].y, 78); + + if (spriteId != MAX_SPRITES) + { + gSprites[spriteId].tActive = 0; + gSprites[spriteId].tRandom = spriteIndex * 145; + while (gSprites[spriteId].tRandom >= 600) + gSprites[spriteId].tRandom -= 600; + + StartRainSpriteFall(&gSprites[spriteId]); + InitRainSpriteMovement(&gSprites[spriteId], spriteIndex * 9); + gSprites[spriteId].invisible = TRUE; + gWeatherPtr->sprites.s1.rainSprites[spriteIndex] = &gSprites[spriteId]; + } + else + { + gWeatherPtr->sprites.s1.rainSprites[spriteIndex] = NULL; + } + + if (++gWeatherPtr->rainSpriteCount == MAX_RAIN_SPRITES) + { + u16 i; + for (i = 0; i < MAX_RAIN_SPRITES; i++) + { + if (gWeatherPtr->sprites.s1.rainSprites[i]) + { + if (!gWeatherPtr->sprites.s1.rainSprites[i]->tWaiting) + gWeatherPtr->sprites.s1.rainSprites[i]->callback = UpdateRainSprite; + else + gWeatherPtr->sprites.s1.rainSprites[i]->callback = WaitRainSprite; + } + } + + return FALSE; + } + + return TRUE; +} + +static bool8 UpdateVisibleRainSprites(void) +{ + if (gWeatherPtr->curRainSpriteIndex == gWeatherPtr->maxRainSprites) + return FALSE; + + if (++gWeatherPtr->rainSpriteVisibleCounter > gWeatherPtr->rainSpriteVisibleDelay) + { + gWeatherPtr->rainSpriteVisibleCounter = 0; + if (gWeatherPtr->curRainSpriteIndex < gWeatherPtr->maxRainSprites) + { + gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->curRainSpriteIndex++]->tActive = 1; + } + else + { + gWeatherPtr->curRainSpriteIndex--; + gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->curRainSpriteIndex]->tActive = 0; + gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->curRainSpriteIndex]->invisible = TRUE; + } + } + return TRUE; +} + +static void DestroyRainSprites(void) +{ + u16 i; + + for (i = 0; i < gWeatherPtr->rainSpriteCount; i++) + { + if (gWeatherPtr->sprites.s1.rainSprites[i] != NULL) + DestroySprite(gWeatherPtr->sprites.s1.rainSprites[i]); + } + gWeatherPtr->rainSpriteCount = 0; + FreeSpriteTilesByTag(0x1206); +} + +#undef tCounter +#undef tRandom +#undef tPosX +#undef tPosY +#undef tState +#undef tActive +#undef tWaiting + +//------------------------------------------------------------------------------ +// Snow +//------------------------------------------------------------------------------ + +void Snow_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = FALSE; + gWeatherPtr->gammaTargetIndex = 3; + gWeatherPtr->gammaStepDelay = 20; + gWeatherPtr->unknown_6E5 = 16; + gWeatherPtr->unknown_6E0 = 0; +} + +void Snow_Main(void); +void sub_807ED48(struct Sprite *); + +void Snow_InitAll(void) +{ + Snow_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + { + u16 i; + + Snow_Main(); + for (i = 0; i < gWeatherPtr->snowflakeSpriteCount; i++) + { + sub_807ED48(gWeatherPtr->sprites.s1.snowflakeSprites[i]); + } + } +} + +u8 snowflakes_progress(void); + +void Snow_Main(void) +{ + if (gWeatherPtr->initStep == 0 && snowflakes_progress() == FALSE) + { + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + } +} + +bool8 Snow_Finish(void) +{ + switch (gWeatherPtr->finishStep) + { + case 0: + gWeatherPtr->unknown_6E5 = 0; + gWeatherPtr->unknown_6E0 = 0; + gWeatherPtr->finishStep++; + // fall through + case 1: + if (snowflakes_progress() == FALSE) + { + gWeatherPtr->finishStep++; + return FALSE; + } + return TRUE; + } + return FALSE; +} + +bool8 CreateSnowflakeSprite(void); +bool8 RemoveSnowflakeSprite(void); + +bool8 snowflakes_progress(void) +{ + if (gWeatherPtr->snowflakeSpriteCount == gWeatherPtr->unknown_6E5) + return FALSE; + + gWeatherPtr->unknown_6E0++; + if (gWeatherPtr->unknown_6E0 > 36) + { + gWeatherPtr->unknown_6E0 = 0; + if (gWeatherPtr->snowflakeSpriteCount < gWeatherPtr->unknown_6E5) + CreateSnowflakeSprite(); + else + RemoveSnowflakeSprite(); + } + return (gWeatherPtr->snowflakeSpriteCount != gWeatherPtr->unknown_6E5); +} + +void sub_807EC40(struct Sprite *); static const struct OamData gOamData_839AAD4 = { @@ -783,172 +982,6 @@ static const struct SpriteTemplate sFog1SpriteTemplate = .callback = Fog1SpriteCallback, }; -bool8 CreateRainSprite(void) -{ - u8 spriteNum; - u8 spriteId; - - if (gWeatherPtr->rainSpriteCount == 24) - return FALSE; - - spriteNum = gWeatherPtr->rainSpriteCount; - spriteId = CreateSpriteAtEnd(&sRainSpriteTemplate, - sRainSpriteCoords[spriteNum].x, sRainSpriteCoords[spriteNum].y, 78); - if (spriteId != MAX_SPRITES) - { - gSprites[spriteId].data[5] = 0; - gSprites[spriteId].data[1] = spriteNum * 145; - while (gSprites[spriteId].data[1] >= 600) - gSprites[spriteId].data[1] -= 600; - sub_807E4EC(&gSprites[spriteId]); - sub_807E6F0(&gSprites[spriteId], spriteNum * 9); - gSprites[spriteId].invisible = TRUE; - gWeatherPtr->sprites.s1.rainSprites[spriteNum] = &gSprites[spriteId]; - } - else - { - gWeatherPtr->sprites.s1.rainSprites[spriteNum] = NULL; - } - - if (++gWeatherPtr->rainSpriteCount == 24) - { - u16 i; - - for (i = 0; i < 24; i++) - { - if (gWeatherPtr->sprites.s1.rainSprites[i] != NULL) - { - if (gWeatherPtr->sprites.s1.rainSprites[i]->data[6] == 0) - gWeatherPtr->sprites.s1.rainSprites[i]->callback = sub_807E5C0; - else - gWeatherPtr->sprites.s1.rainSprites[i]->callback = sub_807E6C4; - } - } - return FALSE; - } - return TRUE; -} - -bool8 sub_807E8E8(void) -{ - if (gWeatherPtr->unknown_6D8 == gWeatherPtr->unknown_6D9) - return FALSE; - - if (++gWeatherPtr->unknown_6D6 > gWeatherPtr->unknown_6DB) - { - gWeatherPtr->unknown_6D6 = 0; - if (gWeatherPtr->unknown_6D8 < gWeatherPtr->unknown_6D9) - { - gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->unknown_6D8++]->data[5] = 1; - } - else - { - gWeatherPtr->unknown_6D8--; - gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->unknown_6D8]->data[5] = 0; - gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->unknown_6D8]->invisible = TRUE; - } - } - return TRUE; -} - -void DestroyRainSprites(void) -{ - u16 i; - - for (i = 0; i < gWeatherPtr->rainSpriteCount; i++) - { - if (gWeatherPtr->sprites.s1.rainSprites[i] != NULL) - DestroySprite(gWeatherPtr->sprites.s1.rainSprites[i]); - } - gWeatherPtr->rainSpriteCount = 0; - FreeSpriteTilesByTag(0x1206); -} - -//------------------------------------------------------------------------------ -// Snow -//------------------------------------------------------------------------------ - -void Snow_InitVars(void) -{ - gWeatherPtr->initStep = 0; - gWeatherPtr->weatherGfxLoaded = FALSE; - gWeatherPtr->gammaTargetIndex = 3; - gWeatherPtr->gammaStepDelay = 20; - gWeatherPtr->unknown_6E5 = 16; - gWeatherPtr->unknown_6E0 = 0; -} - -void Snow_Main(void); -void sub_807ED48(struct Sprite *); - -void Snow_InitAll(void) -{ - Snow_InitVars(); - while (gWeatherPtr->weatherGfxLoaded == FALSE) - { - u16 i; - - Snow_Main(); - for (i = 0; i < gWeatherPtr->snowflakeSpriteCount; i++) - { - sub_807ED48(gWeatherPtr->sprites.s1.snowflakeSprites[i]); - } - } -} - -u8 snowflakes_progress(void); - -void Snow_Main(void) -{ - if (gWeatherPtr->initStep == 0 && snowflakes_progress() == FALSE) - { - gWeatherPtr->weatherGfxLoaded = TRUE; - gWeatherPtr->initStep++; - } -} - -bool8 Snow_Finish(void) -{ - switch (gWeatherPtr->finishStep) - { - case 0: - gWeatherPtr->unknown_6E5 = 0; - gWeatherPtr->unknown_6E0 = 0; - gWeatherPtr->finishStep++; - // fall through - case 1: - if (snowflakes_progress() == FALSE) - { - gWeatherPtr->finishStep++; - return FALSE; - } - return TRUE; - } - return FALSE; -} - -bool8 CreateSnowflakeSprite(void); -bool8 RemoveSnowflakeSprite(void); - -bool8 snowflakes_progress(void) -{ - if (gWeatherPtr->snowflakeSpriteCount == gWeatherPtr->unknown_6E5) - return FALSE; - - gWeatherPtr->unknown_6E0++; - if (gWeatherPtr->unknown_6E0 > 36) - { - gWeatherPtr->unknown_6E0 = 0; - if (gWeatherPtr->snowflakeSpriteCount < gWeatherPtr->unknown_6E5) - CreateSnowflakeSprite(); - else - RemoveSnowflakeSprite(); - } - return (gWeatherPtr->snowflakeSpriteCount != gWeatherPtr->unknown_6E5); -} - -void sub_807EC40(struct Sprite *); - bool8 CreateSnowflakeSprite(void) { u8 spriteId = CreateSpriteAtEnd(&sSnowflakeSpriteTemplate, 0, 0, 78); @@ -1057,10 +1090,10 @@ void MedRain_InitVars(void) { gWeatherPtr->initStep = 0; gWeatherPtr->weatherGfxLoaded = FALSE; - gWeatherPtr->unknown_6D6 = 0; - gWeatherPtr->unknown_6DB = 4; - gWeatherPtr->unknown_6DC = 0; - gWeatherPtr->unknown_6D9 = 16; + gWeatherPtr->rainSpriteVisibleCounter = 0; + gWeatherPtr->rainSpriteVisibleDelay = 4; + gWeatherPtr->isHeavyRain = 0; + gWeatherPtr->maxRainSprites = 16; gWeatherPtr->gammaTargetIndex = 3; gWeatherPtr->gammaStepDelay = 20; gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment @@ -1085,10 +1118,10 @@ void HeavyRain_InitVars(void) { gWeatherPtr->initStep = 0; gWeatherPtr->weatherGfxLoaded = FALSE; - gWeatherPtr->unknown_6D6 = 0; - gWeatherPtr->unknown_6DB = 4; - gWeatherPtr->unknown_6DC = 1; - gWeatherPtr->unknown_6D9 = 24; + gWeatherPtr->rainSpriteVisibleCounter = 0; + gWeatherPtr->rainSpriteVisibleDelay = 4; + gWeatherPtr->isHeavyRain = 1; + gWeatherPtr->maxRainSprites = 24; gWeatherPtr->gammaTargetIndex = 3; gWeatherPtr->gammaStepDelay = 20; gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment @@ -1102,8 +1135,8 @@ void HeavyRain_InitAll(void) Rain_Main(); } -void UpdateThunderSound(void); -void SetThunderCounter(u16); +static void UpdateThunderSound(void); +static void SetThunderCounter(u16); void Rain_Main(void) { @@ -1120,7 +1153,7 @@ void Rain_Main(void) gWeatherPtr->initStep++; break; case 2: - if (sub_807E8E8()) + if (UpdateVisibleRainSprites()) break; gWeatherPtr->weatherGfxLoaded = TRUE; gWeatherPtr->initStep++; @@ -1224,12 +1257,12 @@ bool8 Rain_Finish(void) || gWeatherPtr->nextWeather == WEATHER_RAIN_MED || gWeatherPtr->nextWeather == WEATHER_RAIN_HEAVY) return FALSE; - gWeatherPtr->unknown_6D9 = 0; + gWeatherPtr->maxRainSprites = 0; gWeatherPtr->finishStep++; } break; case 2: - if (sub_807E8E8()) + if (UpdateVisibleRainSprites()) break; DestroyRainSprites(); gWeatherPtr->unknown_6ED = 0; @@ -1241,7 +1274,7 @@ bool8 Rain_Finish(void) return TRUE; } -void SetThunderCounter(u16 max) +static void SetThunderCounter(u16 max) { if (gWeatherPtr->unknown_6ED == 0) { @@ -1250,7 +1283,7 @@ void SetThunderCounter(u16 max) } } -void UpdateThunderSound(void) +static void UpdateThunderSound(void) { if (gWeatherPtr->unknown_6ED == 1) { @@ -2125,7 +2158,7 @@ bool8 Shade_Finish(void) } //------------------------------------------------------------------------------ -// Weather 14 +// Bubbles //------------------------------------------------------------------------------ const u8 gUnknown_0839AC68[] = {40, 90, 60, 90, 2, 60, 40, 30}; From 1fe52085606ccd9258eea5a037c43b30fc04d7c5 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 1 Apr 2019 12:05:58 -0400 Subject: [PATCH 032/101] through sub_801A02C --- asm/union_room_player_avatar.s | 949 +----------------- data/union_room_player_avatar.s | 35 - .../event_object_movement_constants.h | 2 + include/event_object_movement.h | 4 + include/field_player_avatar.h | 12 +- include/fieldmap.h | 1 + include/global.fieldmap.h | 27 +- include/union_room.h | 2 +- ld_script.txt | 2 + src/union_room_player_avatar.c | 462 +++++++++ 10 files changed, 494 insertions(+), 1002 deletions(-) create mode 100644 src/union_room_player_avatar.c diff --git a/asm/union_room_player_avatar.s b/asm/union_room_player_avatar.s index aa9fa5e85..95c1f8d90 100755 --- a/asm/union_room_player_avatar.s +++ b/asm/union_room_player_avatar.s @@ -5,951 +5,6 @@ .text - thumb_func_start is_walking_or_running -is_walking_or_running: @ 8019958 - push {lr} - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x3] - cmp r0, 0x2 - beq _08019966 - cmp r0, 0 - bne _08019970 -_08019966: - movs r0, 0x1 - b _08019972 - .pool -_08019970: - movs r0, 0 -_08019972: - pop {r1} - bx r1 - thumb_func_end is_walking_or_running - - thumb_func_start sub_8019978 -sub_8019978: @ 8019978 - ldr r3, =gUnknown_082F072C - movs r2, 0x7 - ands r2, r1 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 1 - adds r2, r1 - adds r2, r3 - ldrb r0, [r2] - bx lr - .pool - thumb_func_end sub_8019978 - - thumb_func_start sub_8019990 -sub_8019990: @ 8019990 - push {r4-r6,lr} - mov r6, r8 - push {r6} - ldr r4, =gUnknown_082F0740 - mov r8, r4 - lsls r0, 2 - adds r4, r0, r4 - movs r6, 0 - ldrsh r5, [r4, r6] - ldr r6, =gUnknown_082F0760 - lsls r1, 1 - adds r4, r1, r6 - ldrb r4, [r4] - lsls r4, 24 - asrs r4, 24 - adds r5, r4 - adds r5, 0x7 - str r5, [r2] - movs r2, 0x2 - add r8, r2 - add r0, r8 - movs r4, 0 - ldrsh r0, [r0, r4] - adds r6, 0x1 - adds r1, r6 - ldrb r1, [r1] - lsls r1, 24 - asrs r1, 24 - adds r0, r1 - adds r0, 0x7 - str r0, [r3] - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8019990 - - thumb_func_start sub_80199E0 -sub_80199E0: @ 80199E0 - push {r4-r7,lr} - mov r12, r3 - ldr r7, =gUnknown_082F0740 - lsls r5, r0, 2 - adds r0, r5, r7 - movs r4, 0 - ldrsh r3, [r0, r4] - ldr r6, =gUnknown_082F0760 - lsls r4, r1, 1 - adds r0, r4, r6 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - adds r3, r0 - adds r3, 0x7 - cmp r3, r2 - bne _08019A28 - adds r0, r7, 0x2 - adds r0, r5, r0 - movs r2, 0 - ldrsh r1, [r0, r2] - adds r0, r6, 0x1 - adds r0, r4, r0 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - adds r1, r0 - adds r1, 0x7 - cmp r1, r12 - bne _08019A28 - movs r0, 0x1 - b _08019A2A - .pool -_08019A28: - movs r0, 0 -_08019A2A: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80199E0 - - thumb_func_start IsUnionRoomPlayerHidden -IsUnionRoomPlayerHidden: @ 8019A30 - push {lr} - ldr r1, =0x000002bf - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bl FlagGet - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end IsUnionRoomPlayerHidden - - thumb_func_start HideUnionRoomPlayer -HideUnionRoomPlayer: @ 8019A4C - push {lr} - ldr r1, =0x000002bf - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bl FlagSet - pop {r0} - bx r0 - .pool - thumb_func_end HideUnionRoomPlayer - - thumb_func_start ShowUnionRoomPlayer -ShowUnionRoomPlayer: @ 8019A64 - push {lr} - ldr r1, =0x000002bf - adds r0, r1 - lsls r0, 16 - lsrs r0, 16 - bl FlagClear - pop {r0} - bx r0 - .pool - thumb_func_end ShowUnionRoomPlayer - - thumb_func_start SetUnionRoomPlayerGfx -SetUnionRoomPlayerGfx: @ 8019A7C - push {lr} - ldr r2, =0x00004010 - adds r0, r2 - lsls r0, 16 - lsrs r0, 16 - lsls r1, 16 - lsrs r1, 16 - bl VarSet - pop {r0} - bx r0 - .pool - thumb_func_end SetUnionRoomPlayerGfx - - thumb_func_start CreateUnionRoomPlayerEventObject -CreateUnionRoomPlayerEventObject: @ 8019A98 - push {lr} - ldr r1, =gUnknown_082F0774 - adds r0, r1 - ldrb r0, [r0] - ldr r1, =gSaveBlock1Ptr - ldr r2, [r1] - ldrb r1, [r2, 0x5] - ldrb r2, [r2, 0x4] - bl show_sprite - pop {r0} - bx r0 - .pool - thumb_func_end CreateUnionRoomPlayerEventObject - - thumb_func_start RemoveUnionRoomPlayerEventObject -RemoveUnionRoomPlayerEventObject: @ 8019AB8 - push {lr} - ldr r1, =gUnknown_082F0774 - adds r0, r1 - ldrb r0, [r0] - ldr r1, =gSaveBlock1Ptr - ldr r2, [r1] - ldrb r1, [r2, 0x5] - ldrb r2, [r2, 0x4] - bl RemoveEventObjectByLocalIdAndMap - pop {r0} - bx r0 - .pool - thumb_func_end RemoveUnionRoomPlayerEventObject - - thumb_func_start SetUnionRoomPlayerEnterExitMovement -SetUnionRoomPlayerEnterExitMovement: @ 8019AD8 - push {r4,r5,lr} - sub sp, 0x4 - adds r5, r1, 0 - ldr r1, =gUnknown_082F0774 - adds r0, r1 - ldrb r0, [r0] - ldr r1, =gSaveBlock1Ptr - ldr r2, [r1] - ldrb r1, [r2, 0x5] - ldrb r2, [r2, 0x4] - mov r3, sp - bl TryGetEventObjectIdByLocalIdAndMap - lsls r0, 24 - cmp r0, 0 - bne _08019B30 - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r4, r0, r1 - adds r0, r4, 0 - bl EventObjectIsMovementOverridden - lsls r0, 24 - cmp r0, 0 - bne _08019B30 - ldrb r1, [r5] - adds r0, r4, 0 - bl EventObjectSetHeldMovement - lsls r0, 24 - cmp r0, 0 - bne _08019B30 - movs r0, 0x1 - b _08019B32 - .pool -_08019B30: - movs r0, 0 -_08019B32: - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end SetUnionRoomPlayerEnterExitMovement - - thumb_func_start sub_8019B3C -sub_8019B3C: @ 8019B3C - push {r4,lr} - sub sp, 0x4 - ldr r1, =gUnknown_082F0774 - adds r0, r1 - ldrb r0, [r0] - ldr r1, =gSaveBlock1Ptr - ldr r2, [r1] - ldrb r1, [r2, 0x5] - ldrb r2, [r2, 0x4] - mov r3, sp - bl TryGetEventObjectIdByLocalIdAndMap - lsls r0, 24 - cmp r0, 0 - bne _08019B9C - mov r0, sp - ldrb r1, [r0] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r4, r0, r1 - adds r0, r4, 0 - bl EventObjectClearHeldMovementIfFinished - lsls r0, 24 - cmp r0, 0 - bne _08019B84 - movs r0, 0 - b _08019B9E - .pool -_08019B84: - bl ScriptContext2_IsEnabled - lsls r0, 24 - cmp r0, 0 - bne _08019B96 - adds r0, r4, 0 - bl UnfreezeEventObject - b _08019B9C -_08019B96: - adds r0, r4, 0 - bl FreezeEventObject -_08019B9C: - movs r0, 0x1 -_08019B9E: - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8019B3C - - thumb_func_start sub_8019BA8 -sub_8019BA8: @ 8019BA8 - push {lr} - ldr r2, =gUnknown_02022C68 - movs r1, 0 - str r1, [r2] - ldr r1, =gUnknown_02022C64 - str r0, [r1] - movs r1, 0 - movs r2, 0x7 -_08019BB8: - strb r1, [r0] - strb r1, [r0, 0x1] - strb r1, [r0, 0x2] - strb r1, [r0, 0x3] - adds r0, 0x4 - subs r2, 0x1 - cmp r2, 0 - bge _08019BB8 - bl sub_8019DF4 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8019BA8 - - thumb_func_start sub_8019BDC -sub_8019BDC: @ 8019BDC - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - movs r0, 0 - ldrsb r0, [r5, r0] - cmp r0, 0 - beq _08019BF0 - cmp r0, 0x1 - beq _08019C10 - b _08019C2E -_08019BF0: - ldr r1, =gUnknown_082F078C - adds r0, r4, 0 - bl SetUnionRoomPlayerEnterExitMovement - cmp r0, 0x1 - bne _08019C2E - adds r0, r4, 0 - bl HideUnionRoomPlayer - ldrb r0, [r5] - adds r0, 0x1 - strb r0, [r5] - b _08019C2E - .pool -_08019C10: - adds r0, r4, 0 - bl sub_8019B3C - cmp r0, 0 - beq _08019C2E - adds r0, r4, 0 - bl RemoveUnionRoomPlayerEventObject - adds r0, r4, 0 - bl HideUnionRoomPlayer - movs r0, 0 - strb r0, [r5] - movs r0, 0x1 - b _08019C30 -_08019C2E: - movs r0, 0 -_08019C30: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8019BDC - - thumb_func_start sub_8019C38 -sub_8019C38: @ 8019C38 - push {r4-r7,lr} - sub sp, 0x4 - adds r6, r0, 0 - adds r5, r1, 0 - adds r7, r2, 0 - movs r0, 0 - ldrsb r0, [r6, r0] - cmp r0, 0x2 - beq _08019CD4 - cmp r0, 0x2 - bgt _08019C54 - cmp r0, 0 - beq _08019C5A - b _08019CE6 -_08019C54: - cmp r0, 0x3 - beq _08019CBC - b _08019CE6 -_08019C5A: - bl is_walking_or_running - cmp r0, 0 - beq _08019CE6 - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl PlayerGetDestCoords - mov r0, sp - movs r1, 0 - ldrsh r2, [r0, r1] - movs r0, 0 - ldrsh r3, [r4, r0] - adds r0, r5, 0 - movs r1, 0 - bl sub_80199E0 - cmp r0, 0x1 - beq _08019CE6 - mov r0, sp - adds r1, r4, 0 - bl player_get_pos_including_state_based_drift - mov r0, sp - movs r1, 0 - ldrsh r2, [r0, r1] - movs r0, 0 - ldrsh r3, [r4, r0] - adds r0, r5, 0 - movs r1, 0 - bl sub_80199E0 - cmp r0, 0x1 - beq _08019CE6 - ldrb r1, [r7, 0x1] - adds r0, r5, 0 - bl SetUnionRoomPlayerGfx - adds r0, r5, 0 - bl CreateUnionRoomPlayerEventObject - adds r0, r5, 0 - bl ShowUnionRoomPlayer - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] -_08019CBC: - ldr r1, =gUnknown_082F078E - adds r0, r5, 0 - bl SetUnionRoomPlayerEnterExitMovement - cmp r0, 0x1 - bne _08019CE6 - ldrb r0, [r6] - adds r0, 0x1 - strb r0, [r6] - b _08019CE6 - .pool -_08019CD4: - adds r0, r5, 0 - bl sub_8019B3C - cmp r0, 0 - beq _08019CE6 - movs r0, 0 - strb r0, [r6] - movs r0, 0x1 - b _08019CE8 -_08019CE6: - movs r0, 0 -_08019CE8: - add sp, 0x4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8019C38 - - thumb_func_start sub_8019CF0 -sub_8019CF0: @ 8019CF0 - push {r4,lr} - ldr r3, =gUnknown_02022C64 - lsls r0, 2 - ldr r4, [r3] - adds r4, r0 - movs r0, 0x1 - strb r0, [r4, 0x3] - adds r0, r1, 0 - adds r1, r2, 0 - bl sub_8019978 - strb r0, [r4, 0x1] - ldrb r0, [r4] - cmp r0, 0 - beq _08019D18 - movs r0, 0 - b _08019D1A - .pool -_08019D18: - movs r0, 0x1 -_08019D1A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8019CF0 - - thumb_func_start AGBAssert -AGBAssert: @ 8019D20 - push {lr} - ldr r1, =gUnknown_02022C64 - lsls r0, 2 - ldr r1, [r1] - adds r1, r0 - movs r0, 0x2 - strb r0, [r1, 0x3] - ldrb r0, [r1] - cmp r0, 0x1 - beq _08019D3C - movs r0, 0 - b _08019D3E - .pool -_08019D3C: - movs r0, 0x1 -_08019D3E: - pop {r1} - bx r1 - thumb_func_end AGBAssert - - thumb_func_start sub_8019D44 -sub_8019D44: @ 8019D44 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - ldrb r1, [r4] - cmp r1, 0x1 - beq _08019DA6 - cmp r1, 0x1 - bgt _08019D5A - cmp r1, 0 - beq _08019D64 - b _08019DC6 -_08019D5A: - cmp r1, 0x2 - beq _08019D70 - cmp r1, 0x3 - beq _08019DB4 - b _08019DC6 -_08019D64: - ldrb r0, [r4, 0x3] - cmp r0, 0x1 - bne _08019DC6 - movs r0, 0x2 - strb r0, [r4] - strb r1, [r4, 0x2] -_08019D70: - adds r0, r5, 0 - movs r1, 0 - bl sub_8019F8C - adds r1, r0, 0 - cmp r1, 0 - bne _08019D96 - ldrb r0, [r4, 0x3] - cmp r0, 0x2 - bne _08019D96 - strb r1, [r4] - strb r1, [r4, 0x2] - adds r0, r5, 0 - bl RemoveUnionRoomPlayerEventObject - adds r0, r5, 0 - bl HideUnionRoomPlayer - b _08019DC6 -_08019D96: - adds r0, r4, 0x2 - adds r1, r5, 0 - adds r2, r4, 0 - bl sub_8019C38 - cmp r0, 0x1 - bne _08019DC6 - b _08019DC4 -_08019DA6: - ldrb r0, [r4, 0x3] - cmp r0, 0x2 - bne _08019DC6 - movs r1, 0 - movs r0, 0x3 - strb r0, [r4] - strb r1, [r4, 0x2] -_08019DB4: - adds r0, r4, 0x2 - adds r1, r5, 0 - adds r2, r4, 0 - bl sub_8019BDC - cmp r0, 0x1 - bne _08019DC6 - movs r0, 0 -_08019DC4: - strb r0, [r4] -_08019DC6: - movs r0, 0 - strb r0, [r4, 0x3] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8019D44 - - thumb_func_start sub_8019DD0 -sub_8019DD0: @ 8019DD0 - push {r4,r5,lr} - movs r4, 0 - ldr r5, =gUnknown_02022C64 -_08019DD6: - lsls r0, r4, 2 - ldr r1, [r5] - adds r1, r0 - adds r0, r4, 0 - bl sub_8019D44 - adds r4, 0x1 - cmp r4, 0x7 - ble _08019DD6 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8019DD0 - - thumb_func_start sub_8019DF4 -sub_8019DF4: @ 8019DF4 - push {r4,lr} - ldr r4, =sub_8019DD0 - adds r0, r4, 0 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _08019E18 - adds r0, r4, 0 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - b _08019E1A - .pool -_08019E18: - movs r0, 0x10 -_08019E1A: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8019DF4 - - thumb_func_start sub_8019E20 -sub_8019E20: @ 8019E20 - push {lr} - ldr r0, =sub_8019DD0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xF - bhi _08019E34 - bl DestroyTask -_08019E34: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8019E20 - - thumb_func_start sub_8019E3C -sub_8019E3C: @ 8019E3C - push {r4,lr} - movs r4, 0 -_08019E40: - adds r0, r4, 0 - bl IsUnionRoomPlayerHidden - cmp r0, 0 - bne _08019E56 - adds r0, r4, 0 - bl RemoveUnionRoomPlayerEventObject - adds r0, r4, 0 - bl HideUnionRoomPlayer -_08019E56: - adds r4, 0x1 - cmp r4, 0x7 - ble _08019E40 - ldr r1, =gUnknown_02022C64 - movs r0, 0 - str r0, [r1] - bl sub_8019E20 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8019E3C - - thumb_func_start sub_8019E70 -sub_8019E70: @ 8019E70 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - str r0, [sp, 0x8] - mov r9, r1 - movs r7, 0 - mov r0, r9 - lsls r0, 2 - mov r8, r0 - ldr r0, =gUnknown_082F0740 - mov r2, r8 - adds r1, r2, r0 - ldrh r1, [r1] - mov r2, sp - strh r1, [r2, 0xC] - adds r0, 0x2 - add r0, r8 - ldrh r0, [r0] - mov r10, r0 - ldr r6, =gUnknown_082F0760 -_08019E9E: - mov r5, r8 - add r5, r9 - adds r5, r7 - adds r4, r5, 0 - subs r4, 0x38 - lsls r4, 24 - lsrs r4, 24 - movs r2, 0 - ldrsb r2, [r6, r2] - mov r0, sp - ldrh r0, [r0, 0xC] - adds r2, r0, r2 - lsls r2, 16 - asrs r2, 16 - movs r3, 0x1 - ldrsb r3, [r6, r3] - add r3, r10 - lsls r3, 16 - asrs r3, 16 - movs r0, 0x3 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r0, 0x41 - adds r1, r4, 0 - bl sprite_new - ldr r1, [sp, 0x8] - adds r5, r1, r5 - strb r0, [r5] - adds r0, r4, 0 - movs r1, 0x1 - bl sub_8097C44 - adds r6, 0x2 - adds r7, 0x1 - cmp r7, 0x4 - ble _08019E9E - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8019E70 - - thumb_func_start sub_8019F04 -sub_8019F04: @ 8019F04 - push {r4-r6,lr} - adds r5, r0, 0 - movs r4, 0 - ldr r6, =gSprites -_08019F0C: - adds r0, r5, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl DestroySprite - adds r4, 0x1 - cmp r4, 0x27 - ble _08019F0C - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8019F04 - - thumb_func_start sub_8019F2C -sub_8019F2C: @ 8019F2C - push {r4-r7,lr} - sub sp, 0x8 - movs r5, 0 - add r7, sp, 0x4 -_08019F34: - movs r4, 0 - adds r6, r5, 0x1 -_08019F38: - adds r0, r5, 0 - adds r1, r4, 0 - mov r2, sp - adds r3, r7, 0 - bl sub_8019990 - ldr r0, [sp] - ldr r1, [sp, 0x4] - movs r2, 0 - bl sub_8088B94 - adds r4, 0x1 - cmp r4, 0x4 - ble _08019F38 - adds r5, r6, 0 - cmp r5, 0x7 - ble _08019F34 - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8019F2C - - thumb_func_start sub_8019F64 -sub_8019F64: @ 8019F64 - push {lr} - adds r1, r0, 0 - cmp r1, 0 - beq _08019F78 - ldr r0, =gUnknown_082F076F - adds r0, r1, r0 - ldrb r0, [r0] - b _08019F88 - .pool -_08019F78: - ldrb r1, [r2, 0xA] - movs r0, 0x7F - ands r0, r1 - cmp r0, 0x45 - beq _08019F86 - movs r0, 0x4 - b _08019F88 -_08019F86: - movs r0, 0x1 -_08019F88: - pop {r1} - bx r1 - thumb_func_end sub_8019F64 - - thumb_func_start sub_8019F8C -sub_8019F8C: @ 8019F8C - push {lr} - adds r2, r0, 0 - lsls r0, r2, 2 - adds r0, r2 - adds r0, r1 - subs r0, 0x38 - lsls r0, 24 - lsrs r0, 24 - bl sub_8097C8C - pop {r1} - bx r1 - thumb_func_end sub_8019F8C - - thumb_func_start sub_8019FA4 -sub_8019FA4: @ 8019FA4 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x8 - adds r5, r0, 0 - adds r6, r1, 0 - mov r9, r3 - lsls r2, 24 - lsrs r2, 24 - mov r8, r2 - lsls r0, r5, 2 - adds r0, r5 - adds r7, r0, r6 - adds r0, r5, 0 - bl sub_8019F8C - cmp r0, 0x1 - bne _08019FE2 - adds r4, r7, 0 - subs r4, 0x38 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - movs r1, 0 - bl sub_8097C44 - adds r0, r4, 0 - movs r1, 0x1 - bl sub_8097CC4 -_08019FE2: - adds r0, r7, 0 - subs r0, 0x38 - lsls r0, 24 - lsrs r0, 24 - mov r1, r8 - bl sub_8097BB4 - adds r0, r6, 0 - adds r1, r5, 0 - mov r2, r9 - bl sub_8019F64 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r6, 0 - adds r1, r5, 0 - bl sub_801A3B0 - add r3, sp, 0x4 - adds r0, r5, 0 - adds r1, r6, 0 - mov r2, sp - bl sub_8019990 - ldr r0, [sp] - ldr r1, [sp, 0x4] - movs r2, 0x1 - bl sub_8088B94 - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8019FA4 - - thumb_func_start sub_801A02C -sub_801A02C: @ 801A02C - push {r4,r5,lr} - sub sp, 0x8 - adds r4, r0, 0 - adds r5, r1, 0 - lsls r0, r4, 2 - adds r0, r4 - adds r0, r5 - subs r0, 0x38 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl sub_8097CC4 - add r3, sp, 0x4 - adds r0, r4, 0 - adds r1, r5, 0 - mov r2, sp - bl sub_8019990 - ldr r0, [sp] - ldr r1, [sp, 0x4] - movs r2, 0 - bl sub_8088B94 - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801A02C - thumb_func_start sub_801A064 sub_801A064: @ 801A064 push {r4-r7,lr} @@ -1137,7 +192,7 @@ _0801A1F0: b _0801A20E _0801A200: adds r0, r5, 0 - bl AGBAssert + bl sub_8019D20 adds r0, r5, 0 adds r1, r4, 0 bl sub_801A064 @@ -1151,7 +206,7 @@ _0801A20E: sub_801A214: @ 801A214 push {r4,r5,lr} adds r5, r0, 0 - bl AGBAssert + bl sub_8019D20 movs r4, 0 _0801A21E: adds r0, r5, 0 diff --git a/data/union_room_player_avatar.s b/data/union_room_player_avatar.s index 5f86ab4d2..65e8d4229 100755 --- a/data/union_room_player_avatar.s +++ b/data/union_room_player_avatar.s @@ -3,41 +3,6 @@ .section .rodata - .align 2 -gUnknown_082F072C:: @ 82F072C - .byte 0x21, 0x2c, 0x1f, 0x23, 0x25, 0x24, 0x41, 0x42 - .byte 0x00, 0x00, 0x22, 0x28, 0x20, 0x2f, 0x2f, 0x0e - .byte 0x14, 0x2d, 0x00, 0x00 - - .align 2 -gUnknown_082F0740:: @ 82F0740 - .2byte 0x0004, 0x0006, 0x000d, 0x0008 - .2byte 0x000a, 0x0006, 0x0001, 0x0008 - .2byte 0x000d, 0x0004, 0x0007, 0x0004 - .2byte 0x0001, 0x0004, 0x0007, 0x0008 - - .align 2 -gUnknown_082F0760:: @ 82F0760 - .byte 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0xff, 0x00 - .byte 0x00, 0x01 - -gUnknown_082F076A:: @ 82F076A - .byte 0x00, 0x02, 0x01, 0x04, 0x03 - -gUnknown_082F076F:: @ 82F076F - .byte 0x01, 0x03, 0x01, 0x04, 0x02 - -gUnknown_082F0774:: @ 82F0774 - .byte 0x09, 0x08, 0x07, 0x02, 0x06, 0x05, 0x04, 0x03 - .byte 0xbf, 0x02, 0xc0, 0x02, 0xc1, 0x02, 0xc2, 0x02 - .byte 0xc3, 0x02, 0xc4, 0x02, 0xc5, 0x02, 0xc6, 0x02 - -gUnknown_082F078C:: @ 82F078C - .byte 0x9c, 0xfe - -gUnknown_082F078E:: @ 82F078E - .byte 0x9d, 0xfe - .align 2 gWirelessInfoScreenPal:: @ 82F0790 .incbin "graphics/interface/wireless_info_screen.gbapal" diff --git a/include/constants/event_object_movement_constants.h b/include/constants/event_object_movement_constants.h index 2a80f9a09..b1f9b4cb5 100755 --- a/include/constants/event_object_movement_constants.h +++ b/include/constants/event_object_movement_constants.h @@ -242,4 +242,6 @@ #define MOVEMENT_ACTION_FLY_UP 0x9C #define MOVEMENT_ACTION_FLY_DOWN 0x9D +#define MOVEMENT_ACTION_STEP_END 0xFE + #endif // GUARD_CONSTANTS_EVENTOBJMV_H diff --git a/include/event_object_movement.h b/include/event_object_movement.h index 63ac09f2d..4a8e0d373 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -413,5 +413,9 @@ u8 MovementType_RunInPlace_Step0(struct EventObject *, struct Sprite *); u8 MovementType_Invisible_Step0(struct EventObject *, struct Sprite *); u8 MovementType_Invisible_Step1(struct EventObject *, struct Sprite *); u8 MovementType_Invisible_Step2(struct EventObject *, struct Sprite *); +void sub_8097C44(u8 var, bool32 var2); +bool32 sub_8097C8C(u8 var); +void sub_8097BB4(u8 var1, u8 graphicsId); +void sub_8097CC4(u8 var1, u8 var2); #endif //GUARD_FIELD_EVENT_OBJ_H diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h index ca3d41546..8d87779e6 100644 --- a/include/field_player_avatar.h +++ b/include/field_player_avatar.h @@ -1,17 +1,6 @@ #ifndef GUARD_FIELD_PLAYER_AVATAR_H #define GUARD_FIELD_PLAYER_AVATAR_H -enum { - PLAYER_AVATAR_STATE_NORMAL, - PLAYER_AVATAR_STATE_MACH_BIKE, - PLAYER_AVATAR_STATE_ACRO_BIKE, - PLAYER_AVATAR_STATE_SURFING, - PLAYER_AVATAR_STATE_UNDERWATER, - PLAYER_AVATAR_STATE_FIELD_MOVE, - PLAYER_AVATAR_STATE_FISHING, - PLAYER_AVATAR_STATE_WATERING, -}; - void player_step(u8 a, u16 b, u16 c); void ClearPlayerAvatarInfo(void); void SetPlayerAvatarExtraStateTransition(u8, u8); @@ -73,5 +62,6 @@ void sub_808D1C8(void); bool32 sub_808D1B4(void); bool32 sub_808D1E8(void); void sub_808C0A8(u8 a); +u8 player_get_pos_including_state_based_drift(s16 *x, s16 *y); #endif // GUARD_FIELD_PLAYER_AVATAR_H diff --git a/include/fieldmap.h b/include/fieldmap.h index bb5b0e290..2384ed46a 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -50,5 +50,6 @@ void SpriteCB_HallOfFameMonitor(struct Sprite *); // field_region_map.c void FieldInitRegionMap(MainCallback callback); +void sub_8088B94(int x, int y, int a2); #endif //GUARD_FIELDMAP_H diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index e35d900d8..3aa44ec9a 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -232,14 +232,25 @@ struct EventObjectGraphicsInfo /*0x20*/ const union AffineAnimCmd *const *affineAnims; }; -#define PLAYER_AVATAR_FLAG_ON_FOOT (1 << 0) -#define PLAYER_AVATAR_FLAG_MACH_BIKE (1 << 1) -#define PLAYER_AVATAR_FLAG_ACRO_BIKE (1 << 2) -#define PLAYER_AVATAR_FLAG_SURFING (1 << 3) -#define PLAYER_AVATAR_FLAG_UNDERWATER (1 << 4) -#define PLAYER_AVATAR_FLAG_5 (1 << 5) -#define PLAYER_AVATAR_FLAG_6 (1 << 6) -#define PLAYER_AVATAR_FLAG_DASH (1 << 7) +enum { + PLAYER_AVATAR_STATE_NORMAL, + PLAYER_AVATAR_STATE_MACH_BIKE, + PLAYER_AVATAR_STATE_ACRO_BIKE, + PLAYER_AVATAR_STATE_SURFING, + PLAYER_AVATAR_STATE_UNDERWATER, + PLAYER_AVATAR_STATE_FIELD_MOVE, + PLAYER_AVATAR_STATE_FISHING, + PLAYER_AVATAR_STATE_WATERING, +}; + +#define PLAYER_AVATAR_FLAG_ON_FOOT (1 << PLAYER_AVATAR_STATE_NORMAL) +#define PLAYER_AVATAR_FLAG_MACH_BIKE (1 << PLAYER_AVATAR_STATE_MACH_BIKE) +#define PLAYER_AVATAR_FLAG_ACRO_BIKE (1 << PLAYER_AVATAR_STATE_ACRO_BIKE) +#define PLAYER_AVATAR_FLAG_SURFING (1 << PLAYER_AVATAR_STATE_SURFING) +#define PLAYER_AVATAR_FLAG_UNDERWATER (1 << PLAYER_AVATAR_STATE_UNDERWATER) +#define PLAYER_AVATAR_FLAG_5 (1 << PLAYER_AVATAR_STATE_FIELD_MOVE) +#define PLAYER_AVATAR_FLAG_6 (1 << PLAYER_AVATAR_STATE_FISHING) +#define PLAYER_AVATAR_FLAG_DASH (1 << PLAYER_AVATAR_STATE_WATERING) enum { diff --git a/include/union_room.h b/include/union_room.h index ca3c87ab1..538d37716 100644 --- a/include/union_room.h +++ b/include/union_room.h @@ -90,7 +90,7 @@ struct UnkStruct_8019BA8 { u8 field_0; u8 field_1; - u8 field_2; + s8 field_2; u8 field_3; }; diff --git a/ld_script.txt b/ld_script.txt index 5230fee78..b9d20d72e 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -56,6 +56,7 @@ SECTIONS { src/link_rfu.o(.text); src/union_room.o(.text); src/mystery_gift.o(.text); + src/union_room_player_avatar.o(.text); asm/union_room_player_avatar.o(.text); src/mevent2.o(.text); src/mevent_801BAAC.o(.text); @@ -411,6 +412,7 @@ SECTIONS { src/link_rfu.o(.rodata); src/union_room.o(.rodata); src/mystery_gift.o(.rodata); + src/union_room_player_avatar.o(.rodata); data/union_room_player_avatar.o(.rodata); src/mevent2.o(.rodata); src/mevent_801BAAC.o(.rodata); diff --git a/src/union_room_player_avatar.c b/src/union_room_player_avatar.c new file mode 100644 index 000000000..298ad04c7 --- /dev/null +++ b/src/union_room_player_avatar.c @@ -0,0 +1,462 @@ +#include "global.h" +#include "constants/flags.h" +#include "constants/event_object_movement_constants.h" +#include "event_data.h" +#include "event_object_movement.h" +#include "script.h" +#include "field_player_avatar.h" +#include "fieldmap.h" +#include "union_room.h" +#include "task.h" + +EWRAM_DATA struct UnkStruct_8019BA8 * gUnknown_02022C64 = NULL; +EWRAM_DATA u32 gUnknown_02022C68 = 0; + +u8 sub_8019DF4(void); +bool32 sub_8019F8C(u32 playerIdx, u32 arg1); +void sub_801A3B0(u32 arg0, u32 arg1, u8 arg2); + +ALIGNED(4) const u8 gUnknown_082F072C[][10] = { + {0x21, 0x2c, 0x1f, 0x23, 0x25, 0x24, 0x41, 0x42}, + {0x22, 0x28, 0x20, 0x2f, 0x2f, 0x0e, 0x14, 0x2d} +}; + +const s16 gUnknown_082F0740[][2] = { + {0x4, 0x6}, + {0xd, 0x8}, + {0xa, 0x6}, + {0x1, 0x8}, + {0xd, 0x4}, + {0x7, 0x4}, + {0x1, 0x4}, + {0x7, 0x8} +}; + +const s8 gUnknown_082F0760[][2] = { + { 0, 0}, + { 1, 0}, + { 0, -1}, + {-1, 0}, + { 0, 1} +}; + +const u8 gUnknown_082F076A[] = { + 0x00, 0x02, 0x01, 0x04, 0x03 +}; + +const u8 gUnknown_082F076F[] = { + 0x01, 0x03, 0x01, 0x04, 0x02 +}; + +const u8 gUnknown_082F0774[] = { + 0x09, 0x08, 0x07, 0x02, 0x06, 0x05, 0x04, 0x03, + 0xbf, 0x02, 0xc0, 0x02, 0xc1, 0x02, 0xc2, 0x02, + 0xc3, 0x02, 0xc4, 0x02, 0xc5, 0x02, 0xc6, 0x02 +}; + +const u8 gUnknown_082F078C[2] = { + MOVEMENT_ACTION_FLY_UP, + MOVEMENT_ACTION_STEP_END +}; + +const u8 gUnknown_082F078E[2] = { + MOVEMENT_ACTION_FLY_DOWN, + MOVEMENT_ACTION_STEP_END +}; + +bool32 is_walking_or_running(void) +{ + if (gPlayerAvatar.tileTransitionState == 2 || gPlayerAvatar.tileTransitionState == 0) + { + return TRUE; + } + else + { + return FALSE; + } +} + +u8 sub_8019978(u32 a0, u32 a1) +{ + return gUnknown_082F072C[a0][a1 % 8]; +} + +void sub_8019990(u32 a0, u32 a1, s32 * a2, s32 * a3) +{ + *a2 = gUnknown_082F0740[a0][0] + gUnknown_082F0760[a1][0] + 7; + *a3 = gUnknown_082F0740[a0][1] + gUnknown_082F0760[a1][1] + 7; +} + +bool32 sub_80199E0(u32 a0, u32 a1, s32 a2, s32 a3) +{ + if (gUnknown_082F0740[a0][0] + gUnknown_082F0760[a1][0] + 7 != a2) + { + return FALSE; + } + else if (gUnknown_082F0740[a0][1] + gUnknown_082F0760[a1][1] + 7 != a3) + { + return FALSE; + } + else + { + return TRUE; + } +} + +bool32 IsUnionRoomPlayerHidden(u32 player_idx) +{ + return FlagGet(FLAG_HIDE_UNION_ROOM_PLAYER_1 + player_idx); +} + +void HideUnionRoomPlayer(u32 player_idx) +{ + FlagSet(FLAG_HIDE_UNION_ROOM_PLAYER_1 + player_idx); +} + +void ShowUnionRoomPlayer(u32 player_idx) +{ + FlagClear(FLAG_HIDE_UNION_ROOM_PLAYER_1 + player_idx); +} + +void SetUnionRoomPlayerGfx(u32 playerIdx, u32 gfxId) +{ + VarSet(VAR_OBJ_GFX_ID_0 + playerIdx, gfxId); +} + +void CreateUnionRoomPlayerEventObject(u32 playerIdx) +{ + show_sprite(gUnknown_082F0774[playerIdx], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); +} + +void RemoveUnionRoomPlayerEventObject(u32 playerIdx) +{ + RemoveEventObjectByLocalIdAndMap(gUnknown_082F0774[playerIdx], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); +} + +bool32 SetUnionRoomPlayerEnterExitMovement(u32 playerIdx, const u8 * movement) +{ + u8 objectId; + struct EventObject * object; + if (TryGetEventObjectIdByLocalIdAndMap(gUnknown_082F0774[playerIdx], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectId)) + { + return FALSE; + } + object = &gEventObjects[objectId]; + if (EventObjectIsMovementOverridden(object)) + { + return FALSE; + } + if (EventObjectSetHeldMovement(object, *movement)) + { + return FALSE; + } + return TRUE; +} + +bool32 sub_8019B3C(u32 playerIdx) +{ + u8 objectId; + struct EventObject * object; + if (TryGetEventObjectIdByLocalIdAndMap(gUnknown_082F0774[playerIdx], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectId)) + { + return TRUE; + } + object = &gEventObjects[objectId]; + if (!EventObjectClearHeldMovementIfFinished(object)) + { + return FALSE; + } + if (!ScriptContext2_IsEnabled()) + { + UnfreezeEventObject(object); + } + else + { + FreezeEventObject(object); + } + return TRUE; +} + +u8 sub_8019BA8(struct UnkStruct_8019BA8 * ptr) +{ + s32 i; + + gUnknown_02022C68 = 0; + gUnknown_02022C64 = ptr; + for (i = 0; i < 8; i++) + { + ptr[i].field_0 = 0; + ptr[i].field_1 = 0; + ptr[i].field_2 = 0; + ptr[i].field_3 = 0; + } + return sub_8019DF4(); +} + +bool32 sub_8019BDC(s8 * a0, u32 playerIdx, struct UnkStruct_8019BA8 * ptr) +{ + switch (*a0) + { + case 0: + if (SetUnionRoomPlayerEnterExitMovement(playerIdx, gUnknown_082F078C) == TRUE) + { + HideUnionRoomPlayer(playerIdx); + (*a0)++; + } + break; + case 1: + if (sub_8019B3C(playerIdx)) + { + RemoveUnionRoomPlayerEventObject(playerIdx); + HideUnionRoomPlayer(playerIdx); + *a0 = 0; + return TRUE; + } + break; + } + return FALSE; +} + +bool32 sub_8019C38(s8 * a0, u32 playerIdx, struct UnkStruct_8019BA8 * ptr) +{ + s16 x, y; + + switch (*a0) + { + case 0: + if (!is_walking_or_running()) + { + break; + } + PlayerGetDestCoords(&x, &y); + if (sub_80199E0(playerIdx, 0, x, y) == 1) + { + break; + } + player_get_pos_including_state_based_drift(&x, &y); + if (sub_80199E0(playerIdx, 0, x, y) == 1) + { + break; + } + SetUnionRoomPlayerGfx(playerIdx, ptr->field_1); + CreateUnionRoomPlayerEventObject(playerIdx); + ShowUnionRoomPlayer(playerIdx); + (*a0)++; + // fallthrough + case 3: // incorrect? + if (SetUnionRoomPlayerEnterExitMovement(playerIdx, gUnknown_082F078E) == 1) + { + (*a0)++; + } + break; + case 2: + if (sub_8019B3C(playerIdx)) + { + *a0 = 0; + return TRUE; + } + break; + } + return FALSE; +} + +bool32 sub_8019CF0(u32 playerIdx, u32 a1, u32 a2) +{ + struct UnkStruct_8019BA8 * ptr = &gUnknown_02022C64[playerIdx]; + ptr->field_3 = 1; + ptr->field_1 = sub_8019978(a1, a2); + if (ptr->field_0 == 0) + { + return TRUE; + } + else + { + return FALSE; + } +} + +bool32 sub_8019D20(u32 playerIdx) +{ + struct UnkStruct_8019BA8 * ptr = &gUnknown_02022C64[playerIdx]; + ptr->field_3 = 2; + if (ptr->field_0 == 1) + { + return TRUE; + } + else + { + return FALSE; + } +} + +void sub_8019D44(u32 playerIdx, struct UnkStruct_8019BA8 * ptr) +{ + switch (ptr->field_0) + { + case 0: + if (ptr->field_3 == 1) + { + ptr->field_0 = 2; + ptr->field_2 = 0; + } + else + { + break; + } + // fallthrough + case 2: + if (!sub_8019F8C(playerIdx, 0) && ptr->field_3 == 2) + { + ptr->field_0 = 0; + ptr->field_2 = 0; + RemoveUnionRoomPlayerEventObject(playerIdx); + HideUnionRoomPlayer(playerIdx); + } + else if (sub_8019C38(&ptr->field_2, playerIdx, ptr) == 1) + { + ptr->field_0 = 1; + } + break; + case 1: + if (ptr->field_3 == 2) + { + ptr->field_0 = 3; + ptr->field_2 = 0; + } + else + { + break; + } + // fallthrough + case 3: + if (sub_8019BDC(&ptr->field_2, playerIdx, ptr) == 1) + { + ptr->field_0 = 0; + } + break; + } + ptr->field_3 = 0; +} + +void sub_8019DD0(u8 taskId) +{ + s32 i; + for (i = 0; i < 8; i++) + { + sub_8019D44(i, &gUnknown_02022C64[i]); + } +} + +u8 sub_8019DF4(void) +{ + if (FuncIsActiveTask(sub_8019DD0) == 1) + { + return NUM_TASKS; + } + else + { + return CreateTask(sub_8019DD0, 5); + } +} + +void sub_8019E20(void) +{ + u8 taskId = FindTaskIdByFunc(sub_8019DD0); + if (taskId < NUM_TASKS) + { + DestroyTask(taskId); + } +} + +void sub_8019E3C(void) +{ + s32 i; + for (i = 0; i < 8; i++) + { + if (!IsUnionRoomPlayerHidden(i)) + { + RemoveUnionRoomPlayerEventObject(i); + HideUnionRoomPlayer(i); + } + } + gUnknown_02022C64 = NULL; + sub_8019E20(); +} + +void sub_8019E70(u8 * sp8, s32 r9) +{ + s32 r7; + + for (r7 = 0; r7 < 5; r7++) + { + s32 r5 = 5 * r9 + r7; + sp8[r5] = sprite_new(0x41, r5 - 0x38, gUnknown_082F0740[r9][0] + gUnknown_082F0760[r7][0], gUnknown_082F0740[r9][1] + gUnknown_082F0760[r7][1], 3, 1); + sub_8097C44(r5 - 0x38, TRUE); + } +} + +void sub_8019F04(u8 * r5) +{ + s32 i; + for (i = 0; i < 40; i++) + { + DestroySprite(&gSprites[r5[i]]); + } +} + +void sub_8019F2C(void) +{ + s32 i, j, x, y; + for (i = 0; i < 8; i++) + { + for (j = 0; j < 5; j++) + { + sub_8019990(i, j, &x, &y); + sub_8088B94(x, y, 0); + } + } +} + +u8 sub_8019F64(u32 r1, u32 unused, struct UnkLinkRfuStruct_02022B14 * r2) +{ + if (r1 != 0) + { + return gUnknown_082F076F[r1]; + } + else if (r2->unk_0a_0 == 0x45) + { + return 1; + } + else + { + return 4; + } +} + +u32 sub_8019F8C(u32 a0, u32 a1) +{ + return sub_8097C8C(5 * a0 + a1 - 0x38); +} + +void sub_8019FA4(u32 r5, u32 r6, u8 r8, struct UnkLinkRfuStruct_02022B14 * r9) +{ + s32 x, y; + s32 r7 = 5 * r5 + r6; + if (sub_8019F8C(r5, r6) == 1) + { + sub_8097C44(r7 - 0x38, FALSE); + sub_8097CC4(r7 - 0x38, 1); + } + sub_8097BB4(r7 - 0x38, r8); + sub_801A3B0(r6, r5, sub_8019F64(r6, r5, r9)); + sub_8019990(r5, r6, &x, &y); + sub_8088B94(x, y, 1); +} + +void sub_801A02C(u32 a0, u32 a1) +{ + s32 x, y; + sub_8097CC4(5 * a0 + a1 - 0x38, 2); + sub_8019990(a0, a1, &x, &y); + sub_8088B94(x, y, 0); +} From ce89cf6f75a94e08d02cc8c60147469c91ea99c9 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 1 Apr 2019 14:09:56 -0400 Subject: [PATCH 033/101] through sub_801A3D0 --- asm/union_room_player_avatar.s | 451 -------------------------------- include/event_object_movement.h | 1 + src/union_room_player_avatar.c | 151 ++++++++++- 3 files changed, 151 insertions(+), 452 deletions(-) diff --git a/asm/union_room_player_avatar.s b/asm/union_room_player_avatar.s index 95c1f8d90..db8c62f6d 100755 --- a/asm/union_room_player_avatar.s +++ b/asm/union_room_player_avatar.s @@ -5,457 +5,6 @@ .text - thumb_func_start sub_801A064 -sub_801A064: @ 801A064 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - adds r7, r0, 0 - mov r8, r1 - mov r6, sp - adds r6, 0x2 - mov r0, sp - adds r1, r6, 0 - bl PlayerGetDestCoords - add r4, sp, 0x4 - mov r5, sp - adds r5, 0x6 - adds r0, r4, 0 - adds r1, r5, 0 - bl player_get_pos_including_state_based_drift - lsls r0, r7, 2 - adds r0, r7 - subs r0, 0x38 - lsls r0, 24 - lsrs r0, 24 - bl sub_8097C8C - mov r10, r6 - mov r9, r4 - adds r6, r5, 0 - cmp r0, 0x1 - bne _0801A0F0 - mov r0, sp - movs r1, 0 - ldrsh r2, [r0, r1] - mov r0, r10 - movs r1, 0 - ldrsh r3, [r0, r1] - adds r0, r7, 0 - movs r1, 0 - bl sub_80199E0 - cmp r0, 0x1 - beq _0801A15C - movs r0, 0 - ldrsh r2, [r4, r0] - movs r1, 0 - ldrsh r3, [r6, r1] - adds r0, r7, 0 - movs r1, 0 - bl sub_80199E0 - cmp r0, 0x1 - beq _0801A15C - mov r2, r8 - ldrb r0, [r2, 0xB] - lsls r0, 31 - lsrs r0, 31 - ldrb r1, [r2, 0x2] - bl sub_8019978 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r7, 0 - movs r1, 0 - mov r3, r8 - bl sub_8019FA4 -_0801A0F0: - movs r5, 0x1 - mov r4, r8 - adds r4, 0x4 -_0801A0F6: - ldrb r0, [r4] - cmp r0, 0 - bne _0801A106 - adds r0, r7, 0 - adds r1, r5, 0 - bl sub_801A02C - b _0801A154 -_0801A106: - mov r0, sp - movs r1, 0 - ldrsh r2, [r0, r1] - mov r0, r10 - movs r1, 0 - ldrsh r3, [r0, r1] - adds r0, r7, 0 - adds r1, r5, 0 - bl sub_80199E0 - cmp r0, 0 - bne _0801A154 - mov r0, r9 - movs r1, 0 - ldrsh r2, [r0, r1] - movs r0, 0 - ldrsh r3, [r6, r0] - adds r0, r7, 0 - adds r1, r5, 0 - bl sub_80199E0 - cmp r0, 0 - bne _0801A154 - ldrb r2, [r4] - lsrs r0, r2, 3 - movs r1, 0x1 - ands r0, r1 - movs r1, 0x7 - ands r1, r2 - bl sub_8019978 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r7, 0 - adds r1, r5, 0 - mov r3, r8 - bl sub_8019FA4 -_0801A154: - adds r4, 0x1 - adds r5, 0x1 - cmp r5, 0x4 - ble _0801A0F6 -_0801A15C: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_801A064 - - thumb_func_start sub_801A16C -sub_801A16C: @ 801A16C - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - ldrb r0, [r4, 0xA] - lsls r0, 25 - lsrs r0, 25 - subs r0, 0x40 - cmp r0, 0x14 - bhi _0801A20E - lsls r0, 2 - ldr r1, =_0801A18C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801A18C: - .4byte _0801A1E0 - .4byte _0801A200 - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A200 - .4byte _0801A200 - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A200 - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A20E - .4byte _0801A200 - .4byte _0801A200 - .4byte _0801A200 - .4byte _0801A1E0 -_0801A1E0: - ldrb r1, [r4, 0xB] - lsls r1, 31 - lsrs r1, 31 - ldrb r2, [r4, 0x2] - adds r0, r5, 0 - bl sub_8019CF0 - movs r4, 0 -_0801A1F0: - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_801A02C - adds r4, 0x1 - cmp r4, 0x4 - bls _0801A1F0 - b _0801A20E -_0801A200: - adds r0, r5, 0 - bl sub_8019D20 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_801A064 -_0801A20E: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801A16C - - thumb_func_start sub_801A214 -sub_801A214: @ 801A214 - push {r4,r5,lr} - adds r5, r0, 0 - bl sub_8019D20 - movs r4, 0 -_0801A21E: - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_801A02C - adds r4, 0x1 - cmp r4, 0x4 - ble _0801A21E - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801A214 - - thumb_func_start sub_801A234 -sub_801A234: @ 801A234 - push {r4,r5,lr} - ldr r2, =gUnknown_02022C68 - movs r1, 0 - str r1, [r2] - movs r5, 0 - ldr r4, [r0] -_0801A240: - ldrb r0, [r4, 0x1A] - movs r1, 0x3 - ands r1, r0 - cmp r1, 0x1 - bne _0801A258 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_801A16C - b _0801A264 - .pool -_0801A258: - cmp r1, 0x2 - bne _0801A264 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_801A214 -_0801A264: - adds r4, 0x20 - adds r5, 0x1 - cmp r5, 0x7 - ble _0801A240 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801A234 - - thumb_func_start sub_801A274 -sub_801A274: @ 801A274 - ldr r1, =gUnknown_02022C68 - movs r0, 0x96 - lsls r0, 1 - str r0, [r1] - bx lr - .pool - thumb_func_end sub_801A274 - - thumb_func_start sub_801A284 -sub_801A284: @ 801A284 - push {lr} - adds r2, r0, 0 - ldr r0, =gUnknown_02022C68 - ldr r1, [r0] - adds r1, 0x1 - str r1, [r0] - movs r0, 0x96 - lsls r0, 1 - cmp r1, r0 - bls _0801A29E - adds r0, r2, 0 - bl sub_801A234 -_0801A29E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_801A284 - - thumb_func_start sub_801A2A8 -sub_801A2A8: @ 801A2A8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - adds r5, r0, 0 - str r1, [sp, 0x4] - str r2, [sp, 0x8] - bl is_walking_or_running - cmp r0, 0 - bne _0801A2F0 - b _0801A396 -_0801A2C4: - ldr r4, =gUnknown_082F076A - bl GetPlayerFacingDirection - lsls r0, 24 - lsrs r0, 24 - adds r0, r4 - ldrb r2, [r0] - adds r0, r6, 0 - ldr r1, [sp, 0xC] - bl sub_801A3B0 - ldr r0, [sp, 0x4] - strh r6, [r0] - mov r1, sp - ldrh r2, [r1, 0xC] - ldr r1, [sp, 0x8] - strh r2, [r1] - movs r0, 0x1 - b _0801A398 - .pool -_0801A2F0: - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl GetXYCoordsOneStepInFrontOfPlayer - movs r0, 0 - str r0, [sp, 0xC] - ldr r0, =gUnknown_082F0740 - adds r7, r5, 0 - movs r1, 0 - mov r10, r1 - adds r2, r0, 0x2 - str r2, [sp, 0x10] - str r0, [sp, 0x14] -_0801A30E: - movs r6, 0 - ldr r4, [sp, 0x14] - movs r0, 0 - ldrsh r4, [r4, r0] - mov r9, r4 - ldr r1, [sp, 0x10] - mov r8, r1 - ldr r5, =gUnknown_082F0760 -_0801A31E: - mov r2, r10 - adds r3, r2, r6 - mov r0, sp - movs r4, 0 - ldrsh r1, [r0, r4] - movs r0, 0 - ldrsb r0, [r5, r0] - add r0, r9 - adds r0, 0x7 - cmp r1, r0 - bne _0801A372 - mov r1, sp - movs r2, 0x2 - ldrsh r0, [r1, r2] - mov r4, r8 - movs r2, 0 - ldrsh r1, [r4, r2] - movs r2, 0x1 - ldrsb r2, [r5, r2] - adds r1, r2 - adds r1, 0x7 - cmp r0, r1 - bne _0801A372 - adds r0, r3, 0 - subs r0, 0x38 - lsls r0, 24 - lsrs r4, r0, 24 - adds r0, r4, 0 - bl sub_8097C8C - cmp r0, 0 - bne _0801A372 - adds r0, r4, 0 - bl sub_8097D9C - cmp r0, 0 - bne _0801A372 - ldrb r1, [r7, 0x1A] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - beq _0801A2C4 -_0801A372: - adds r5, 0x2 - adds r6, 0x1 - cmp r6, 0x4 - ble _0801A31E - adds r7, 0x20 - movs r4, 0x5 - add r10, r4 - ldr r0, [sp, 0x10] - adds r0, 0x4 - str r0, [sp, 0x10] - ldr r1, [sp, 0x14] - adds r1, 0x4 - str r1, [sp, 0x14] - ldr r2, [sp, 0xC] - adds r2, 0x1 - str r2, [sp, 0xC] - cmp r2, 0x7 - ble _0801A30E -_0801A396: - movs r0, 0 -_0801A398: - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801A2A8 - - thumb_func_start sub_801A3B0 -sub_801A3B0: @ 801A3B0 - push {r4,lr} - adds r4, r0, 0 - adds r3, r1, 0 - lsls r1, r2, 24 - lsrs r1, 24 - lsls r0, r3, 2 - adds r0, r3 - subs r0, 0x38 - adds r0, r4 - lsls r0, 24 - lsrs r0, 24 - bl sub_8097B78 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_801A3B0 - - thumb_func_start sub_801A3D0 -sub_801A3D0: @ 801A3D0 - push {r4,r5,lr} - adds r5, r0, 0 - adds r4, r1, 0 - lsls r3, r4, 5 - adds r3, r2 - adds r2, r3, 0 - bl sub_8019F64 - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_801A3B0 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_801A3D0 - thumb_func_start sub_801A3F4 sub_801A3F4: @ 801A3F4 push {lr} diff --git a/include/event_object_movement.h b/include/event_object_movement.h index 4a8e0d373..817dc78df 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -417,5 +417,6 @@ void sub_8097C44(u8 var, bool32 var2); bool32 sub_8097C8C(u8 var); void sub_8097BB4(u8 var1, u8 graphicsId); void sub_8097CC4(u8 var1, u8 var2); +bool32 sub_8097D9C(u8 var); #endif //GUARD_FIELD_EVENT_OBJ_H diff --git a/src/union_room_player_avatar.c b/src/union_room_player_avatar.c index 298ad04c7..e7af24b38 100644 --- a/src/union_room_player_avatar.c +++ b/src/union_room_player_avatar.c @@ -14,7 +14,7 @@ EWRAM_DATA u32 gUnknown_02022C68 = 0; u8 sub_8019DF4(void); bool32 sub_8019F8C(u32 playerIdx, u32 arg1); -void sub_801A3B0(u32 arg0, u32 arg1, u8 arg2); +void sub_801A3B0(s32 arg0, s32 arg1, u8 arg2); ALIGNED(4) const u8 gUnknown_082F072C[][10] = { {0x21, 0x2c, 0x1f, 0x23, 0x25, 0x24, 0x41, 0x42}, @@ -460,3 +460,152 @@ void sub_801A02C(u32 a0, u32 a1) sub_8019990(a0, a1, &x, &y); sub_8088B94(x, y, 0); } + +void sub_801A064(u32 r7, struct UnkLinkRfuStruct_02022B14 * r8) +{ + s16 x, y, x2, y2; + s32 i; + + PlayerGetDestCoords(&x, &y); + player_get_pos_including_state_based_drift(&x2, &y2); + if (sub_8097C8C(5 * r7 - 0x38) == 1) + { + if (sub_80199E0(r7, 0, x, y) == 1 || sub_80199E0(r7, 0, x2, y2) == 1) + { + return; + } + sub_8019FA4(r7, 0, sub_8019978(r8->playerGender, r8->unk_00.playerTrainerId[0]), r8); + } + for (i = 1; i < 5; i++) + { + if (r8->unk_04[i - 1] == 0) + { + sub_801A02C(r7, i); + } + else if (sub_80199E0(r7, i, x, y) == 0 && sub_80199E0(r7, i, x2, y2) == 0) + { + sub_8019FA4(r7, i, sub_8019978((r8->unk_04[i - 1] >> 3) & 1, r8->unk_04[i - 1] & 7), r8); + } + } +} + +void sub_801A16C(u32 r5, struct UnkLinkRfuStruct_02022B14 * r4) +{ + u32 i; + switch (r4->unk_0a_0) + { + case 0x40: + case 0x54: + sub_8019CF0(r5, r4->playerGender, r4->unk_00.playerTrainerId[0]); + for (i = 0; i < 5; i++) + { + sub_801A02C(r5, i); + } + break; + case 0x41: + case 0x44: + case 0x45: + case 0x48: + case 0x51: + case 0x52: + case 0x53: + sub_8019D20(r5); + sub_801A064(r5, r4); + break; + } +} + +void sub_801A214(u32 r5, struct UnkLinkRfuStruct_02022B14 * unused) +{ + s32 i; + sub_8019D20(r5); + for (i = 0; i < 5; i++) + { + sub_801A02C(r5, i); + } +} + +void sub_801A234(struct UnkStruct_URoom *r0) +{ + s32 i; + struct UnkStruct_x20 * r4; + gUnknown_02022C68 = 0; + for (i = 0, r4 = r0->field_0->arr; i < 8; i++) + { + if (r4[i].field_1A_0 == 1) + { + sub_801A16C(i, &r4[i].unk.field_0); + } + else if (r4[i].field_1A_0 == 2) + { + sub_801A214(i, &r4[i].unk.field_0); + } + } +} + +void sub_801A274(void) +{ + gUnknown_02022C68 = 300; +} + +void sub_801A284(struct UnkStruct_URoom *r2) +{ + if (++gUnknown_02022C68 > 300) + { + sub_801A234(r2); + } +} + +bool32 sub_801A2A8(struct UnkStruct_Main0 *arg0, s16 *arg1, s16 *arg2, u8 *arg3) +{ + s16 x, y; + s32 i, j; + struct UnkStruct_x20 * r4; + if (!is_walking_or_running()) + { + return FALSE; + } + GetXYCoordsOneStepInFrontOfPlayer(&x, &y); + for (i = 0, r4 = arg0->arr; i < 8; i++) + { + for (j = 0; j < 5; j++) + { + s32 r3 = 5 * i + j; + if (x != gUnknown_082F0740[i][0] + gUnknown_082F0760[j][0] + 7) + { + continue; + } + if (y != gUnknown_082F0740[i][1] + gUnknown_082F0760[j][1] + 7) + { + continue; + } + if (sub_8097C8C(r3 - 0x38) != 0) + { + continue; + } + if (sub_8097D9C(r3 - 0x38) != 0) + { + continue; + } + if (r4[i].field_1A_0 != 1) + { + continue; + } + sub_801A3B0(j, i, gUnknown_082F076A[GetPlayerFacingDirection()]); + *arg1 = j; + *arg2 = i; + return TRUE; + } + } + return FALSE; +} + +void sub_801A3B0(s32 arg0, s32 arg1, u8 arg2) +{ + sub_8097B78(5 * arg1 - 0x38 + arg0, arg2); +} + +void sub_801A3D0(u32 arg0, u32 arg1, struct UnkStruct_Main0 *arg2) +{ + return sub_801A3B0(arg0, arg1, sub_8019F64(arg0, arg1, &arg2->arr[arg1].unk.field_0)); +} From 9f1d1219cec0643bb6e58cb2cdba07ca6f8587ed Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 1 Apr 2019 14:20:34 -0400 Subject: [PATCH 034/101] create header and fix prototypes --- include/union_room_player_avatar.h | 14 ++++++ src/union_room.c | 9 +--- src/union_room_player_avatar.c | 80 +++++++++++++++--------------- 3 files changed, 56 insertions(+), 47 deletions(-) create mode 100644 include/union_room_player_avatar.h diff --git a/include/union_room_player_avatar.h b/include/union_room_player_avatar.h new file mode 100644 index 000000000..9870d0981 --- /dev/null +++ b/include/union_room_player_avatar.h @@ -0,0 +1,14 @@ +#ifndef GUARD_UNION_ROOM_PLAYER_AVATAR_H +#define GUARD_UNION_ROOM_PLAYER_AVATAR_H + +u8 sub_8019BA8(struct UnkStruct_8019BA8 * ptr); +void sub_8019E3C(void); +void sub_8019E70(u8 *arg0, s32 arg1); +void sub_8019F04(u8 *spriteIds); +void sub_8019F2C(void); +void sub_801A274(struct UnkStruct_URoom *arg0); +void sub_801A284(struct UnkStruct_URoom *arg0); +bool32 sub_801A2A8(struct UnkStruct_Main0 *arg0, s16 *arg1, s16 *arg2, u8 *arg3); +void sub_801A3D0(u32 arg0, u32 arg1, struct UnkStruct_Main0 *arg2); + +#endif //GUARD_UNION_ROOM_PLAYER_AVATAR_H diff --git a/src/union_room.c b/src/union_room.c index 8aeaaf6fb..ad33112e4 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -46,6 +46,7 @@ #include "union_room_chat.h" #include "berry_crush.h" #include "mystery_gift.h" +#include "union_room_player_avatar.h" EWRAM_DATA u8 gUnknown_02022C20[12] = {}; EWRAM_DATA u8 gUnknown_02022C2C = 0; @@ -106,15 +107,12 @@ s8 mevent_message_print_and_prompt_yes_no(u8 *textState, u8 *arg1, u8 arg2, cons bool32 sub_8016F1C(struct UnkLinkRfuStruct_02022B14 *arg0, s16 arg1); u8 sub_8016DF0(struct UnkStruct_Main4 *arg0, struct UnkStruct_Main4 *arg1, u32 arg2); void sub_8019F2C(void); -void sub_8019E70(u8 *arg0, s32 arg1); bool32 sub_80180A0(u32 monId, struct TradeUnkStruct *arg1); void sub_80180E8(u32 monId, struct TradeUnkStruct *arg1); -bool32 sub_801A2A8(struct UnkStruct_Main0 *arg0, s16 *arg1, s16 *arg2, u8 *arg3); void sub_80181CC(void); bool32 sub_8017940(void); u8 sub_8016B00(void); void sub_801A274(struct UnkStruct_URoom *arg0); -void sub_801A284(struct UnkStruct_URoom *arg0); bool32 sub_8017FD8(struct UnkStruct_URoom *arg0); void sub_801689C(struct UnkStruct_URoom *arg0); u8 sub_80181DC(struct UnkStruct_URoom *arg0); @@ -123,7 +121,6 @@ bool32 sub_801704C(void); s32 sub_8017CF8(s32 arg1, struct UnkStruct_Main0 *arg0); s32 sub_80179D4(struct UnkStruct_Main0 *arg0, u8 arg1, u8 arg2, u32 playerGender); void sub_801818C(bool32 arg0); -void sub_801A3D0(u32 arg0, u32 arg1, struct UnkStruct_Main0 *arg2); s32 sub_8017178(u8 *arg0, u8 *arg1, u8 *arg2, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate); s32 sub_80172A0(u8 *arg0, u8 *arg1, u8 *arg2, u8 *arg3, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate, struct UnkStruct_Main0 *arg6); s32 sub_8017CB0(struct UnkStruct_x20 * arg, s32 arg1); @@ -133,12 +130,10 @@ void sub_8018220(u8 *unused, struct UnkStruct_URoom *arg1, bool8 arg2); void sub_8017D9C(u8 *dst, s32 arg1, u32 playerGender); u32 sub_80179AC(struct UnkStruct_x20 *arg0); void sub_8017E00(u8 *dst, u8 arg1); -void sub_8019F04(u8 *spriteIds); -void sub_8019E3C(void); void sub_80173B0(void); s32 sub_8017D04(u32 type, u32 species); bool32 sub_8017020(const u8 *src); -void sub_8019BA8(void *); +u8 sub_8019BA8(struct UnkStruct_8019BA8 * ); s32 sub_8017EA0(u8 *dst, u32 gender, u16 *arg2, struct UnkStruct_URoom *arg3); void sub_801697C(u8 taskId); bool8 sub_8017630(struct UnkStruct_Shared* arg0, const struct UnkStruct_Shared* arg1); diff --git a/src/union_room_player_avatar.c b/src/union_room_player_avatar.c index e7af24b38..61be86a37 100644 --- a/src/union_room_player_avatar.c +++ b/src/union_room_player_avatar.c @@ -12,16 +12,16 @@ EWRAM_DATA struct UnkStruct_8019BA8 * gUnknown_02022C64 = NULL; EWRAM_DATA u32 gUnknown_02022C68 = 0; -u8 sub_8019DF4(void); -bool32 sub_8019F8C(u32 playerIdx, u32 arg1); -void sub_801A3B0(s32 arg0, s32 arg1, u8 arg2); +static u8 sub_8019DF4(void); +static u32 sub_8019F8C(u32 playerIdx, u32 arg1); +static void sub_801A3B0(s32 arg0, s32 arg1, u8 arg2); ALIGNED(4) const u8 gUnknown_082F072C[][10] = { {0x21, 0x2c, 0x1f, 0x23, 0x25, 0x24, 0x41, 0x42}, {0x22, 0x28, 0x20, 0x2f, 0x2f, 0x0e, 0x14, 0x2d} }; -const s16 gUnknown_082F0740[][2] = { +static const s16 gUnknown_082F0740[][2] = { {0x4, 0x6}, {0xd, 0x8}, {0xa, 0x6}, @@ -32,7 +32,7 @@ const s16 gUnknown_082F0740[][2] = { {0x7, 0x8} }; -const s8 gUnknown_082F0760[][2] = { +static const s8 gUnknown_082F0760[][2] = { { 0, 0}, { 1, 0}, { 0, -1}, @@ -40,31 +40,31 @@ const s8 gUnknown_082F0760[][2] = { { 0, 1} }; -const u8 gUnknown_082F076A[] = { +static const u8 gUnknown_082F076A[] = { 0x00, 0x02, 0x01, 0x04, 0x03 }; -const u8 gUnknown_082F076F[] = { +static const u8 gUnknown_082F076F[] = { 0x01, 0x03, 0x01, 0x04, 0x02 }; -const u8 gUnknown_082F0774[] = { +static const u8 gUnknown_082F0774[] = { 0x09, 0x08, 0x07, 0x02, 0x06, 0x05, 0x04, 0x03, 0xbf, 0x02, 0xc0, 0x02, 0xc1, 0x02, 0xc2, 0x02, 0xc3, 0x02, 0xc4, 0x02, 0xc5, 0x02, 0xc6, 0x02 }; -const u8 gUnknown_082F078C[2] = { +static const u8 gUnknown_082F078C[2] = { MOVEMENT_ACTION_FLY_UP, MOVEMENT_ACTION_STEP_END }; -const u8 gUnknown_082F078E[2] = { +static const u8 gUnknown_082F078E[2] = { MOVEMENT_ACTION_FLY_DOWN, MOVEMENT_ACTION_STEP_END }; -bool32 is_walking_or_running(void) +static bool32 is_walking_or_running(void) { if (gPlayerAvatar.tileTransitionState == 2 || gPlayerAvatar.tileTransitionState == 0) { @@ -76,18 +76,18 @@ bool32 is_walking_or_running(void) } } -u8 sub_8019978(u32 a0, u32 a1) +static u8 sub_8019978(u32 a0, u32 a1) { return gUnknown_082F072C[a0][a1 % 8]; } -void sub_8019990(u32 a0, u32 a1, s32 * a2, s32 * a3) +static void sub_8019990(u32 a0, u32 a1, s32 * a2, s32 * a3) { *a2 = gUnknown_082F0740[a0][0] + gUnknown_082F0760[a1][0] + 7; *a3 = gUnknown_082F0740[a0][1] + gUnknown_082F0760[a1][1] + 7; } -bool32 sub_80199E0(u32 a0, u32 a1, s32 a2, s32 a3) +static bool32 sub_80199E0(u32 a0, u32 a1, s32 a2, s32 a3) { if (gUnknown_082F0740[a0][0] + gUnknown_082F0760[a1][0] + 7 != a2) { @@ -103,37 +103,37 @@ bool32 sub_80199E0(u32 a0, u32 a1, s32 a2, s32 a3) } } -bool32 IsUnionRoomPlayerHidden(u32 player_idx) +static bool32 IsUnionRoomPlayerHidden(u32 player_idx) { return FlagGet(FLAG_HIDE_UNION_ROOM_PLAYER_1 + player_idx); } -void HideUnionRoomPlayer(u32 player_idx) +static void HideUnionRoomPlayer(u32 player_idx) { FlagSet(FLAG_HIDE_UNION_ROOM_PLAYER_1 + player_idx); } -void ShowUnionRoomPlayer(u32 player_idx) +static void ShowUnionRoomPlayer(u32 player_idx) { FlagClear(FLAG_HIDE_UNION_ROOM_PLAYER_1 + player_idx); } -void SetUnionRoomPlayerGfx(u32 playerIdx, u32 gfxId) +static void SetUnionRoomPlayerGfx(u32 playerIdx, u32 gfxId) { VarSet(VAR_OBJ_GFX_ID_0 + playerIdx, gfxId); } -void CreateUnionRoomPlayerEventObject(u32 playerIdx) +static void CreateUnionRoomPlayerEventObject(u32 playerIdx) { show_sprite(gUnknown_082F0774[playerIdx], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); } -void RemoveUnionRoomPlayerEventObject(u32 playerIdx) +static void RemoveUnionRoomPlayerEventObject(u32 playerIdx) { RemoveEventObjectByLocalIdAndMap(gUnknown_082F0774[playerIdx], gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup); } -bool32 SetUnionRoomPlayerEnterExitMovement(u32 playerIdx, const u8 * movement) +static bool32 SetUnionRoomPlayerEnterExitMovement(u32 playerIdx, const u8 * movement) { u8 objectId; struct EventObject * object; @@ -153,7 +153,7 @@ bool32 SetUnionRoomPlayerEnterExitMovement(u32 playerIdx, const u8 * movement) return TRUE; } -bool32 sub_8019B3C(u32 playerIdx) +static bool32 sub_8019B3C(u32 playerIdx) { u8 objectId; struct EventObject * object; @@ -193,7 +193,7 @@ u8 sub_8019BA8(struct UnkStruct_8019BA8 * ptr) return sub_8019DF4(); } -bool32 sub_8019BDC(s8 * a0, u32 playerIdx, struct UnkStruct_8019BA8 * ptr) +static bool32 sub_8019BDC(s8 * a0, u32 playerIdx, struct UnkStruct_8019BA8 * ptr) { switch (*a0) { @@ -217,7 +217,7 @@ bool32 sub_8019BDC(s8 * a0, u32 playerIdx, struct UnkStruct_8019BA8 * ptr) return FALSE; } -bool32 sub_8019C38(s8 * a0, u32 playerIdx, struct UnkStruct_8019BA8 * ptr) +static bool32 sub_8019C38(s8 * a0, u32 playerIdx, struct UnkStruct_8019BA8 * ptr) { s16 x, y; @@ -260,7 +260,7 @@ bool32 sub_8019C38(s8 * a0, u32 playerIdx, struct UnkStruct_8019BA8 * ptr) return FALSE; } -bool32 sub_8019CF0(u32 playerIdx, u32 a1, u32 a2) +static bool32 sub_8019CF0(u32 playerIdx, u32 a1, u32 a2) { struct UnkStruct_8019BA8 * ptr = &gUnknown_02022C64[playerIdx]; ptr->field_3 = 1; @@ -275,7 +275,7 @@ bool32 sub_8019CF0(u32 playerIdx, u32 a1, u32 a2) } } -bool32 sub_8019D20(u32 playerIdx) +static bool32 sub_8019D20(u32 playerIdx) { struct UnkStruct_8019BA8 * ptr = &gUnknown_02022C64[playerIdx]; ptr->field_3 = 2; @@ -289,7 +289,7 @@ bool32 sub_8019D20(u32 playerIdx) } } -void sub_8019D44(u32 playerIdx, struct UnkStruct_8019BA8 * ptr) +static void sub_8019D44(u32 playerIdx, struct UnkStruct_8019BA8 * ptr) { switch (ptr->field_0) { @@ -338,7 +338,7 @@ void sub_8019D44(u32 playerIdx, struct UnkStruct_8019BA8 * ptr) ptr->field_3 = 0; } -void sub_8019DD0(u8 taskId) +static void sub_8019DD0(u8 taskId) { s32 i; for (i = 0; i < 8; i++) @@ -347,7 +347,7 @@ void sub_8019DD0(u8 taskId) } } -u8 sub_8019DF4(void) +static u8 sub_8019DF4(void) { if (FuncIsActiveTask(sub_8019DD0) == 1) { @@ -359,7 +359,7 @@ u8 sub_8019DF4(void) } } -void sub_8019E20(void) +static void sub_8019E20(void) { u8 taskId = FindTaskIdByFunc(sub_8019DD0); if (taskId < NUM_TASKS) @@ -417,7 +417,7 @@ void sub_8019F2C(void) } } -u8 sub_8019F64(u32 r1, u32 unused, struct UnkLinkRfuStruct_02022B14 * r2) +static u8 sub_8019F64(u32 r1, u32 unused, struct UnkLinkRfuStruct_02022B14 * r2) { if (r1 != 0) { @@ -433,12 +433,12 @@ u8 sub_8019F64(u32 r1, u32 unused, struct UnkLinkRfuStruct_02022B14 * r2) } } -u32 sub_8019F8C(u32 a0, u32 a1) +static u32 sub_8019F8C(u32 a0, u32 a1) { return sub_8097C8C(5 * a0 + a1 - 0x38); } -void sub_8019FA4(u32 r5, u32 r6, u8 r8, struct UnkLinkRfuStruct_02022B14 * r9) +static void sub_8019FA4(u32 r5, u32 r6, u8 r8, struct UnkLinkRfuStruct_02022B14 * r9) { s32 x, y; s32 r7 = 5 * r5 + r6; @@ -453,7 +453,7 @@ void sub_8019FA4(u32 r5, u32 r6, u8 r8, struct UnkLinkRfuStruct_02022B14 * r9) sub_8088B94(x, y, 1); } -void sub_801A02C(u32 a0, u32 a1) +static void sub_801A02C(u32 a0, u32 a1) { s32 x, y; sub_8097CC4(5 * a0 + a1 - 0x38, 2); @@ -461,7 +461,7 @@ void sub_801A02C(u32 a0, u32 a1) sub_8088B94(x, y, 0); } -void sub_801A064(u32 r7, struct UnkLinkRfuStruct_02022B14 * r8) +static void sub_801A064(u32 r7, struct UnkLinkRfuStruct_02022B14 * r8) { s16 x, y, x2, y2; s32 i; @@ -489,7 +489,7 @@ void sub_801A064(u32 r7, struct UnkLinkRfuStruct_02022B14 * r8) } } -void sub_801A16C(u32 r5, struct UnkLinkRfuStruct_02022B14 * r4) +static void sub_801A16C(u32 r5, struct UnkLinkRfuStruct_02022B14 * r4) { u32 i; switch (r4->unk_0a_0) @@ -515,7 +515,7 @@ void sub_801A16C(u32 r5, struct UnkLinkRfuStruct_02022B14 * r4) } } -void sub_801A214(u32 r5, struct UnkLinkRfuStruct_02022B14 * unused) +static void sub_801A214(u32 r5, struct UnkLinkRfuStruct_02022B14 * unused) { s32 i; sub_8019D20(r5); @@ -525,7 +525,7 @@ void sub_801A214(u32 r5, struct UnkLinkRfuStruct_02022B14 * unused) } } -void sub_801A234(struct UnkStruct_URoom *r0) +static void sub_801A234(struct UnkStruct_URoom *r0) { s32 i; struct UnkStruct_x20 * r4; @@ -543,7 +543,7 @@ void sub_801A234(struct UnkStruct_URoom *r0) } } -void sub_801A274(void) +void sub_801A274(struct UnkStruct_URoom *unused) { gUnknown_02022C68 = 300; } @@ -600,7 +600,7 @@ bool32 sub_801A2A8(struct UnkStruct_Main0 *arg0, s16 *arg1, s16 *arg2, u8 *arg3) return FALSE; } -void sub_801A3B0(s32 arg0, s32 arg1, u8 arg2) +static void sub_801A3B0(s32 arg0, s32 arg1, u8 arg2) { sub_8097B78(5 * arg1 - 0x38 + arg0, arg2); } From 4ea8217f81d35469b93600cc9aab2574f4b06898 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 1 Apr 2019 14:25:58 -0400 Subject: [PATCH 035/101] file split --- asm/{union_room_player_avatar.s => union_room_801A3F4.s} | 0 data/{union_room_player_avatar.s => union_room_801A3F4.s} | 0 ld_script.txt | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename asm/{union_room_player_avatar.s => union_room_801A3F4.s} (100%) rename data/{union_room_player_avatar.s => union_room_801A3F4.s} (100%) diff --git a/asm/union_room_player_avatar.s b/asm/union_room_801A3F4.s similarity index 100% rename from asm/union_room_player_avatar.s rename to asm/union_room_801A3F4.s diff --git a/data/union_room_player_avatar.s b/data/union_room_801A3F4.s similarity index 100% rename from data/union_room_player_avatar.s rename to data/union_room_801A3F4.s diff --git a/ld_script.txt b/ld_script.txt index b9d20d72e..acf0358c3 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -57,7 +57,7 @@ SECTIONS { src/union_room.o(.text); src/mystery_gift.o(.text); src/union_room_player_avatar.o(.text); - asm/union_room_player_avatar.o(.text); + asm/union_room_801A3F4.o(.text); src/mevent2.o(.text); src/mevent_801BAAC.o(.text); asm/mevent_server.o(.text); @@ -413,7 +413,7 @@ SECTIONS { src/union_room.o(.rodata); src/mystery_gift.o(.rodata); src/union_room_player_avatar.o(.rodata); - data/union_room_player_avatar.o(.rodata); + data/union_room_801A3F4.o(.rodata); src/mevent2.o(.rodata); src/mevent_801BAAC.o(.rodata); data/mevent_server.o(.rodata); From 18fdb4e369e5417df16c53daee4631faf3e9d798 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 1 Apr 2019 14:29:03 -0400 Subject: [PATCH 036/101] union_room_player_avatar sym_ewram --- sym_ewram.txt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/sym_ewram.txt b/sym_ewram.txt index 266c4d89d..98ba03cfe 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -8,14 +8,7 @@ .include "src/link_rfu.o" .include "src/union_room.o" .include "src/mystery_gift.o" - - @ union room player avatar - .align 2 -gUnknown_02022C64: @ 2022C64 - .space 0x4 - -gUnknown_02022C68: @ 2022C68 - .space 0x4 + .include "src/union_room_player_avatar.o" gUnknown_02022C6C: @ 2022C6C .space 0x4 From 08f4d3e105a77531c3d817b16d0797b2be885f7f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 1 Apr 2019 14:41:37 -0400 Subject: [PATCH 037/101] Rename these objects to union_room_battle --- asm/{union_room_801A3F4.s => union_room_battle.s} | 0 data/{union_room_801A3F4.s => union_room_battle.s} | 0 ld_script.txt | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename asm/{union_room_801A3F4.s => union_room_battle.s} (100%) rename data/{union_room_801A3F4.s => union_room_battle.s} (100%) diff --git a/asm/union_room_801A3F4.s b/asm/union_room_battle.s similarity index 100% rename from asm/union_room_801A3F4.s rename to asm/union_room_battle.s diff --git a/data/union_room_801A3F4.s b/data/union_room_battle.s similarity index 100% rename from data/union_room_801A3F4.s rename to data/union_room_battle.s diff --git a/ld_script.txt b/ld_script.txt index acf0358c3..a7bd9eaad 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -57,7 +57,7 @@ SECTIONS { src/union_room.o(.text); src/mystery_gift.o(.text); src/union_room_player_avatar.o(.text); - asm/union_room_801A3F4.o(.text); + asm/union_room_battle.o(.text); src/mevent2.o(.text); src/mevent_801BAAC.o(.text); asm/mevent_server.o(.text); @@ -413,7 +413,7 @@ SECTIONS { src/union_room.o(.rodata); src/mystery_gift.o(.rodata); src/union_room_player_avatar.o(.rodata); - data/union_room_801A3F4.o(.rodata); + data/union_room_battle.o(.rodata); src/mevent2.o(.rodata); src/mevent_801BAAC.o(.rodata); data/mevent_server.o(.rodata); From 88424b0ea3488b6d8c3d1f3a1cc825bd0cd33c86 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 1 Apr 2019 21:56:25 +0200 Subject: [PATCH 038/101] Support for custom multi battle choose mons --- .../scripts.inc | 20 +++++++++++++++---- src/battle_tower.c | 3 +++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc b/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc index 0fe68cb1e..699243841 100644 --- a/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc +++ b/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc @@ -47,18 +47,30 @@ EverGrandeCity_PokemonLeague_1F_Pokemart_229624: @ 8229624 EverGrandeCity_PokemonLeague_1F_EventScript_229636:: @ 8229636 special SavePlayerParty - - trainerbattle 10, TRAINER_WALLACE, 0, NULL, EverGrandeCity_PokemonLeague_1F_Text_2296E8 + + fadescreen 1 + special ChooseHalfPartyForBattle + waitstate + @ Check here to see if the player didn't choose Cancel. + + special ReducePlayerPartyToSelectedMons + setvar VAR_0x8004, 2 + setvar VAR_0x8005, 4 + special CallFrontierUtilFunc + + trainerbattle 10, 1, 0, NULL, EverGrandeCity_PokemonLeague_1F_Text_2296E8 trainerbattle 11, TRAINER_ALEXA, 0, NULL, EverGrandeCity_PokemonLeague_1F_Text_2297EF setvar VAR_0x8004, SPECIAL_BATTLE_MULTI - setvar VAR_0x8005, 0 + setvar VAR_0x8005, 2 | 0x80 setvar VAR_0x8006, TRAINER_EDWARDO setvar VAR_0x8007, TRAINER_BACK_PIC_LEAF special DoSpecialTrainerBattle - waitstate + setvar VAR_0x8004, 6 + special CallFrontierUtilFunc + special LoadPlayerParty lockall diff --git a/src/battle_tower.c b/src/battle_tower.c index 760bd3315..26b361fe0 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -2397,6 +2397,9 @@ void DoSpecialTrainerBattle(void) BattleTransition_StartOnField(GetWildBattleTransition()); else BattleTransition_StartOnField(GetTrainerBattleTransition()); + + if (gSpecialVar_0x8005 & 0x80) // Skip mons restoring(done in the script) + gBattleScripting.specialTrainerBattleType = 0xFF; break; } } From 737c49853b5267188fe16a1a2cc7d288830aa1aa Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 1 Apr 2019 23:08:21 +0200 Subject: [PATCH 039/101] Fix Flare Blitz --- data/battle_anim_scripts.s | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 228aa12b1..e79d7c3f3 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -1259,31 +1259,29 @@ Move_FLARE_BLITZ: loadspritegfx ANIM_TAG_HANDS_AND_FEET loadspritegfx ANIM_TAG_SMALL_EMBER monbg ANIM_TARGET - delay 2 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 0, 16, RGB_BLACK - setalpha 12, 8 - monbg ANIM_DEF_PARTNER monbgprio_2A ANIM_TARGET + setalpha 12, 8 createsprite gBattleAnimSpriteTemplate_8595584, ANIM_ATTACKER, 3, 0, 0, 56, 0 playsewithpan SE_W172, SOUND_PAN_ATTACKER delay 2 + createsprite gBattleAnimSpriteTemplate_8595584, ANIM_ATTACKER, 3, 0, 0, 56, 2 + playsewithpan SE_W172, SOUND_PAN_ATTACKER + delay 2 createsprite gBattleAnimSpriteTemplate_8595584, ANIM_ATTACKER, 3, 0, 0, 56, 4 playsewithpan SE_W172, SOUND_PAN_ATTACKER delay 2 + createsprite gBattleAnimSpriteTemplate_8595584, ANIM_ATTACKER, 3, 0, 0, 56, 6 + playsewithpan SE_W172, SOUND_PAN_ATTACKER + delay 2 createsprite gBattleAnimSpriteTemplate_8595584, ANIM_ATTACKER, 3, 0, 0, 56, 8 playsewithpan SE_W172, SOUND_PAN_ATTACKER delay 2 + createsprite gBattleAnimSpriteTemplate_8595584, ANIM_ATTACKER, 3, 0, 0, 56, 10 + playsewithpan SE_W172, SOUND_PAN_ATTACKER + delay 2 createsprite gBattleAnimSpriteTemplate_8595584, ANIM_ATTACKER, 3, 0, 0, 56, 12 playsewithpan SE_W172, SOUND_PAN_ATTACKER delay 2 - createsprite gBattleAnimSpriteTemplate_8595584, ANIM_ATTACKER, 3, 0, 0, 56, 16 - playsewithpan SE_W172, SOUND_PAN_ATTACKER - delay 2 - createsprite gBattleAnimSpriteTemplate_8595584, ANIM_ATTACKER, 3, 0, 0, 56, 20 - playsewithpan SE_W172, SOUND_PAN_ATTACKER - delay 2 - createsprite gBattleAnimSpriteTemplate_8595584, ANIM_ATTACKER, 3, 0, 0, 56, 24 - playsewithpan SE_W172, SOUND_PAN_ATTACKER waitforvisualfinish createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 12, 4, 1, 4 waitforvisualfinish @@ -1325,6 +1323,7 @@ Move_FLARE_BLITZ: playsewithpan SE_W004, +63 waitforvisualfinish createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 9 + waitforvisualfinish clearmonbg ANIM_TARGET blendoff delay 2 @@ -1332,7 +1331,6 @@ Move_FLARE_BLITZ: waitbgfadein end - Move_FORCE_PALM: end @@ -1788,7 +1786,6 @@ Move_SHADOW_CLAW: end Move_THUNDER_FANG: - loadspritegfx ANIM_TAG_IMPACT loadspritegfx ANIM_TAG_LIGHTNING loadspritegfx ANIM_TAG_SHARP_TEETH From 22be08f7238ec240d09a991c524ed5992c08b743 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 1 Apr 2019 23:17:50 +0200 Subject: [PATCH 040/101] Revert Bubblebeam to hit only one target --- data/battle_anim_scripts.s | 13 ++++++------- src/data/battle_moves.h | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index e79d7c3f3..363dc1750 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -4401,7 +4401,6 @@ Move_BUBBLE_BEAM: delay 1 call Bulbblebeam1 createvisualtask AnimTask_SwayMon, 5, 0, 3, 3072, 8, ANIM_TARGET - createvisualtask AnimTask_SwayMon, 5, 0, 3, 3072, 8, ANIM_DEF_PARTNER call Bulbblebeam1 call Bulbblebeam1 waitforvisualfinish @@ -12285,22 +12284,22 @@ PoisonBubblesEffect: return WaterBubbleEffect: - createsprite gWaterBubbleSpriteTemplate, ANIM_ATTACKER, 2, 10, 10, 1 + createsprite gWaterBubbleSpriteTemplate, ANIM_ATTACKER, 2, 10, 10, 0 playsewithpan SE_W145C, SOUND_PAN_TARGET delay 6 - createsprite gWaterBubbleSpriteTemplate, ANIM_ATTACKER, 2, 20, -20, 1 + createsprite gWaterBubbleSpriteTemplate, ANIM_ATTACKER, 2, 20, -20, 0 playsewithpan SE_W145C, SOUND_PAN_TARGET delay 6 - createsprite gWaterBubbleSpriteTemplate, ANIM_ATTACKER, 2, -20, 15, 1 + createsprite gWaterBubbleSpriteTemplate, ANIM_ATTACKER, 2, -20, 15, 0 playsewithpan SE_W145C, SOUND_PAN_TARGET delay 6 - createsprite gWaterBubbleSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 1 + createsprite gWaterBubbleSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 0 playsewithpan SE_W145C, SOUND_PAN_TARGET delay 6 - createsprite gWaterBubbleSpriteTemplate, ANIM_ATTACKER, 2, -20, -20, 1 + createsprite gWaterBubbleSpriteTemplate, ANIM_ATTACKER, 2, -20, -20, 0 playsewithpan SE_W145C, SOUND_PAN_TARGET delay 6 - createsprite gWaterBubbleSpriteTemplate, ANIM_ATTACKER, 2, 16, -8, 1 + createsprite gWaterBubbleSpriteTemplate, ANIM_ATTACKER, 2, 16, -8, 0 playsewithpan SE_W145C, SOUND_PAN_TARGET return diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 63fbdc2f5..18d5bd61d 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -862,7 +862,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = .accuracy = 100, .pp = 20, .secondaryEffectChance = 10, - .target = MOVE_TARGET_BOTH, + .target = MOVE_TARGET_SELECTED, .priority = 0, .flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_SHEER_FORCE_BOOST, .split = SPLIT_SPECIAL, From 743a42fec2689455b49cb3ee1bc5abd66bdd96cf Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Mon, 1 Apr 2019 23:39:30 +0200 Subject: [PATCH 041/101] Cross Poison animation --- data/battle_anim_scripts.s | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 363dc1750..a080e6620 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -2000,6 +2000,19 @@ Move_ROCK_WRECKER: end Move_CROSS_POISON: + loadspritegfx ANIM_TAG_POISON_BUBBLE + loadspritegfx ANIM_TAG_CROSS_IMPACT + monbg ANIM_TARGET + setalpha 12, 8 + playsewithpan SE_W013, SOUND_PAN_TARGET + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_WHITE, 10, 0, 10 + createsprite gUnknown_085973D0, ANIM_ATTACKER, 3, 0, 0, 1, 20 + createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 7, 0, 9, 1 + waitforvisualfinish + call PoisonBubblesEffect + waitforvisualfinish + clearmonbg ANIM_TARGET + blendoff end Move_GUNK_SHOT: From d39b5f6d262b63f12bec5e3985e322f2090bd8a7 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Apr 2019 00:14:01 +0200 Subject: [PATCH 042/101] Fix messing with move result flags when not needed --- include/battle_util.h | 2 +- src/battle_ai_script_commands.c | 2 +- src/battle_script_commands.c | 4 ++-- src/battle_tv.c | 2 +- src/battle_util.c | 11 ++++++----- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/include/battle_util.h b/include/battle_util.h index 0f940b51b..f2671a6ad 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -81,7 +81,7 @@ bool32 IsBattlerGrounded(u8 battlerId); bool32 IsBattlerAlive(u8 battlerId); u8 GetBattleMonMoveSlot(struct BattlePokemon *battleMon, u16 move); u32 GetBattlerWeight(u8 battlerId); -s32 CalculateMoveDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, s32 fixedBasePower, bool32 isCrit, bool32 randomFactor); +s32 CalculateMoveDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, s32 fixedBasePower, bool32 isCrit, bool32 randomFactor, bool32 updateFlags); u16 CalcTypeEffectivenessMultiplier(u16 move, u8 moveType, u8 battlerAtk, u8 battlerDef, bool32 recordAbilities); u16 CalcPartyMonTypeEffectivenessMultiplier(u16 move, u16 speciesDef, u8 abilityDef); u16 GetTypeModifier(u8 atkType, u8 defType); diff --git a/src/battle_ai_script_commands.c b/src/battle_ai_script_commands.c index 5e5f16a04..a9c61fa43 100644 --- a/src/battle_ai_script_commands.c +++ b/src/battle_ai_script_commands.c @@ -794,7 +794,7 @@ s32 AI_CalcDamage(u16 move, u8 battlerAtk, u8 battlerDef) gBattleStruct->dynamicMoveType = 0; SetTypeBeforeUsingMove(move, battlerAtk); GET_MOVE_TYPE(move, moveType); - dmg = CalculateMoveDamage(move, battlerAtk, battlerDef, moveType, 0, AI_GetIfCrit(move, battlerAtk, battlerDef), FALSE); + dmg = CalculateMoveDamage(move, battlerAtk, battlerDef, moveType, 0, AI_GetIfCrit(move, battlerAtk, battlerDef), FALSE, FALSE); RestoreBattlerData(battlerAtk); RestoreBattlerData(battlerDef); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 5060c2eae..6595bb805 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1412,7 +1412,7 @@ static void atk05_damagecalc(void) u8 moveType; GET_MOVE_TYPE(gCurrentMove, moveType); - gBattleMoveDamage = CalculateMoveDamage(gCurrentMove, gBattlerAttacker, gBattlerTarget, moveType, 0, gIsCriticalHit, TRUE); + gBattleMoveDamage = CalculateMoveDamage(gCurrentMove, gBattlerAttacker, gBattlerTarget, moveType, 0, gIsCriticalHit, TRUE, TRUE); gBattlescriptCurrInstr++; } @@ -4449,7 +4449,7 @@ static void atk49_moveend(void) gHitMarker |= HITMARKER_NO_ATTACKSTRING; } - if (battlerId < gBattlersCount && gBattleMons[battlerId].hp != 0) + if (IsBattlerAlive(battlerId)) { gBattlerTarget = battlerId; gBattleScripting.atk49_state = 0; diff --git a/src/battle_tv.c b/src/battle_tv.c index 58a02d93d..7eb118dde 100644 --- a/src/battle_tv.c +++ b/src/battle_tv.c @@ -1429,7 +1429,7 @@ static void TrySetBattleSeminarShow(void) powerOverride = 0; if (ShouldCalculateDamage(gCurrentMove, &dmgByMove[i], &powerOverride)) { - gBattleMoveDamage = CalculateMoveDamage(gCurrentMove, gBattlerAttacker, gBattlerTarget, gBattleMoves[gCurrentMove].type, powerOverride, FALSE, FALSE); + gBattleMoveDamage = CalculateMoveDamage(gCurrentMove, gBattlerAttacker, gBattlerTarget, gBattleMoves[gCurrentMove].type, powerOverride, FALSE, FALSE, FALSE); dmgByMove[i] = gBattleMoveDamage; if (dmgByMove[i] == 0 && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) dmgByMove[i] = 1; diff --git a/src/battle_util.c b/src/battle_util.c index 9dd20fc61..bf6168440 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2212,7 +2212,7 @@ u8 AtkCanceller_UnableToUseMove(void) { gBattleCommunication[MULTISTRING_CHOOSER] = 1; gBattlerTarget = gBattlerAttacker; - gBattleMoveDamage = CalculateMoveDamage(MOVE_NONE, gBattlerAttacker, gBattlerAttacker, TYPE_MYSTERY, 40, FALSE, FALSE); + gBattleMoveDamage = CalculateMoveDamage(MOVE_NONE, gBattlerAttacker, gBattlerAttacker, TYPE_MYSTERY, 40, FALSE, FALSE, TRUE); gProtectStructs[gBattlerAttacker].confusionSelfDmg = 1; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; } @@ -4536,7 +4536,7 @@ u8 IsMonDisobedient(void) calc -= obedienceLevel; if (calc < obedienceLevel) { - gBattleMoveDamage = CalculateMoveDamage(MOVE_NONE, gBattlerAttacker, gBattlerAttacker, TYPE_MYSTERY, 40, FALSE, FALSE); + gBattleMoveDamage = CalculateMoveDamage(MOVE_NONE, gBattlerAttacker, gBattlerAttacker, TYPE_MYSTERY, 40, FALSE, FALSE, TRUE); gBattlerTarget = gBattlerAttacker; gBattlescriptCurrInstr = BattleScript_IgnoresAndHitsItself; gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE; @@ -5569,12 +5569,12 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move return dmg; } -s32 CalculateMoveDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, s32 fixedBasePower, bool32 isCrit, bool32 randomFactor) +s32 CalculateMoveDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, s32 fixedBasePower, bool32 isCrit, bool32 randomFactor, bool32 updateFlags) { s32 dmg; u16 finalModifier, typeEffectivenessModifier; - typeEffectivenessModifier = CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, randomFactor); + typeEffectivenessModifier = CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, updateFlags); // Don't calculate damage if the move has no effect on target. if (typeEffectivenessModifier == UQ_4_12(0)) @@ -5698,7 +5698,8 @@ u16 CalcTypeEffectivenessMultiplier(u16 move, u8 moveType, u8 battlerAtk, u8 bat modifier = CalcTypeEffectivenessMultiplierInternal(move, gBattleMoves[move].argument, battlerAtk, battlerDef, recordAbilities, modifier); } - UpdateMoveResultFlags(modifier); + if (recordAbilities) + UpdateMoveResultFlags(modifier); return modifier; } From 89f766b75bfc2a2b1228d4de52dd7a55ca1e0d7f Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Apr 2019 00:17:15 +0200 Subject: [PATCH 043/101] Remove unneded variable --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index bf6168440..d5088b9f9 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5572,7 +5572,7 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move s32 CalculateMoveDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, s32 fixedBasePower, bool32 isCrit, bool32 randomFactor, bool32 updateFlags) { s32 dmg; - u16 finalModifier, typeEffectivenessModifier; + u16 typeEffectivenessModifier; typeEffectivenessModifier = CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, updateFlags); From fe1c14db76472101383f9f06d88d6d512faf367a Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Mon, 1 Apr 2019 20:27:55 -0400 Subject: [PATCH 044/101] Fix warning for extra parens (#646) * Fix warning for extra parens * Committed too many files --- tools/gbafix/gbafix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/gbafix/gbafix.c b/tools/gbafix/gbafix.c index d5e2f62ab..81c8c04c0 100644 --- a/tools/gbafix/gbafix.c +++ b/tools/gbafix/gbafix.c @@ -160,7 +160,7 @@ int main(int argc, char *argv[]) // get filename for (arg=1; arg Date: Mon, 1 Apr 2019 20:30:41 -0400 Subject: [PATCH 045/101] Move gPlayerFacingPosition out of sym_ewram.txt (#617) * Move gPlayerFacingPosition out of sym_ewram.txt * Fix tabs in sym_ewram.txt * Remove redundant faraway island extern --- include/fldeff.h | 1 + src/fldeff_misc.c | 2 +- src/fldeff_rocksmash.c | 3 --- sym_ewram.txt | 6 +----- 4 files changed, 3 insertions(+), 9 deletions(-) diff --git a/include/fldeff.h b/include/fldeff.h index e095396a4..ff6c9823f 100644 --- a/include/fldeff.h +++ b/include/fldeff.h @@ -10,6 +10,7 @@ void FixLongGrassMetatilesWindowTop(s16 x, s16 y); void FixLongGrassMetatilesWindowBottom(s16 x, s16 y); extern const struct SpritePalette gFieldEffectObjectPaletteInfo6; +extern struct MapPosition gPlayerFacingPosition; // groundshake bool8 sub_81BE66C(void); diff --git a/src/fldeff_misc.c b/src/fldeff_misc.c index 5d1920aac..efde43b76 100644 --- a/src/fldeff_misc.c +++ b/src/fldeff_misc.c @@ -23,7 +23,7 @@ #include "constants/songs.h" #include "constants/vars.h" -extern struct MapPosition gPlayerFacingPosition; +EWRAM_DATA struct MapPosition gPlayerFacingPosition = {0}; static void sub_80F9C90(u8); static void sub_80F9DFC(u8); diff --git a/src/fldeff_rocksmash.c b/src/fldeff_rocksmash.c index 86df8e943..a9077f2ff 100644 --- a/src/fldeff_rocksmash.c +++ b/src/fldeff_rocksmash.c @@ -27,9 +27,6 @@ static void sub_813561C(u8 taskId); static void sub_81356C4(void); static void sub_8135714(void); -// extern RAM loc -extern struct MapPosition gPlayerFacingPosition; - // text bool8 CheckObjectGraphicsInFrontOfPlayer(u8 graphicsId) { diff --git a/sym_ewram.txt b/sym_ewram.txt index 98ba03cfe..8cb156837 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -135,11 +135,7 @@ gUnknown_02022D00: @ 2022D00 .include "src/decoration.o" .include "src/slot_machine.o" .include "src/battle_ai_script_commands.o" - -.align 2 -gPlayerFacingPosition: @ 203AB40 - .space 0x8 - + .include "src/fldeff_misc.o" .include "src/pokeblock.o" .include "src/field_specials.o" .include "src/battle_records.o" From 35505c7f5b421b7589d1d761dcbd41a1c40affb6 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Mon, 1 Apr 2019 20:04:23 -0500 Subject: [PATCH 046/101] Document somre more weather effects --- include/event_object_movement.h | 2 +- include/field_weather.h | 33 +- src/event_object_movement.c | 49 +- src/field_effect_helpers.c | 2 +- src/field_weather.c | 2 +- src/field_weather_effect.c | 1035 ++++++++++++++++--------------- src/overworld.c | 2 +- 7 files changed, 582 insertions(+), 543 deletions(-) diff --git a/include/event_object_movement.h b/include/event_object_movement.h index 63ac09f2d..23a3ffa49 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -89,7 +89,7 @@ u8 AddPseudoEventObject(u16, void (*)(struct Sprite *), s16 x, s16 y, u8 subprio u8 show_sprite(u8, u8, u8); u8 SpawnSpecialEventObjectParameterized(u8 graphicsId, u8 movementBehavior, u8 localId, s16 x, s16 y, u8 z); u8 SpawnSpecialEventObject(struct EventObjectTemplate *); -void sub_8093038(s16, s16, s16 *, s16 *); +void SetSpritePosToMapCoords(s16, s16, s16 *, s16 *); void CameraObjectReset1(void); void EventObjectSetGraphicsId(struct EventObject *, u8 graphicsId); void EventObjectTurn(struct EventObject *, u8); diff --git a/include/field_weather.h b/include/field_weather.h index 38fba68f1..7a4864075 100644 --- a/include/field_weather.h +++ b/include/field_weather.h @@ -3,7 +3,10 @@ #include "sprite.h" -#define MAX_RAIN_SPRITES 24 +#define MAX_RAIN_SPRITES 24 +#define NUM_CLOUD_SPRITES 3 +#define NUM_FOG_SPRITES 20 +#define NUM_ASH_SPRITES 20 // Controls how the weather should be changing the screen palettes. enum @@ -31,13 +34,13 @@ struct Weather { struct Sprite *rainSprites[MAX_RAIN_SPRITES]; struct Sprite *snowflakeSprites[101]; - struct Sprite *cloudSprites[3]; + struct Sprite *cloudSprites[NUM_CLOUD_SPRITES]; } s1; struct { u8 filler0[0xA0]; - struct Sprite *fog1Sprites[20]; - struct Sprite *ashSprites[20]; + struct Sprite *fog1Sprites[NUM_FOG_SPRITES]; + struct Sprite *ashSprites[NUM_ASH_SPRITES]; struct Sprite *fog2Sprites[20]; struct Sprite *sandstormSprites1[20]; struct Sprite *sandstormSprites2[5]; @@ -66,30 +69,30 @@ struct Weather u8 altGammaSpritePalIndex; u16 rainSpriteVisibleCounter; u8 curRainSpriteIndex; - u8 maxRainSprites; + u8 targetRainSpriteCount; u8 rainSpriteCount; u8 rainSpriteVisibleDelay; u8 isHeavyRain; u8 rainStrength; /*0x6DE*/ u8 cloudSpritesCreated; u8 filler_6DF[1]; - u16 unknown_6E0; + u16 snowflakeVisibleCounter; u16 unknown_6E2; u8 snowflakeSpriteCount; - u8 unknown_6E5; + u8 targetSnowflakeSpriteCount; u16 unknown_6E6; u16 thunderCounter; u8 unknown_6EA; u8 unknown_6EB; u8 unknown_6EC; - u8 unknown_6ED; + u8 thunderTriggered; u16 fog1ScrollPosX; - u16 unknown_6F0; - u16 unknown_6F2; + u16 fog1ScrollCounter; + u16 fog1ScrollOffset; u8 lightenedFogSpritePals[6]; u8 lightenedFogSpritePalsCount; u8 fog1SpritesCreated; - u16 unknown_6FC; + u16 baseAshSpritesX; u16 unknown_6FE; u8 ashSpritesCreated; u8 filler_701[3]; @@ -176,10 +179,10 @@ void Clouds_InitVars(void); void Clouds_Main(void); void Clouds_InitAll(void); bool8 Clouds_Finish(void); -void Weather2_InitVars(void); -void Weather2_Main(void); -void Weather2_InitAll(void); -bool8 Weather2_Finish(void); +void Sunny_InitVars(void); +void Sunny_Main(void); +void Sunny_InitAll(void); +bool8 Sunny_Finish(void); void LightRain_InitVars(void); void LightRain_Main(void); void LightRain_InitAll(void); diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 6a3527bc1..45b721f56 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -1949,7 +1949,7 @@ void EventObjectSetGraphicsId(struct EventObject *eventObject, u8 graphicsId) sprite->oam.paletteNum = paletteSlot; eventObject->inanimate = graphicsInfo->inanimate; eventObject->graphicsId = graphicsId; - sub_8093038(eventObject->currentCoords.x, eventObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y); + SetSpritePosToMapCoords(eventObject->currentCoords.x, eventObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y); sprite->centerToCornerVecX = -(graphicsInfo->width >> 1); sprite->centerToCornerVecY = -(graphicsInfo->height >> 1); sprite->pos1.x += 8; @@ -2253,7 +2253,7 @@ void sub_808EB08(struct EventObject *eventObject, s16 x, s16 y) sprite = &gSprites[eventObject->spriteId]; graphicsInfo = GetEventObjectGraphicsInfo(eventObject->graphicsId); SetEventObjectCoords(eventObject, x, y); - sub_8093038(eventObject->currentCoords.x, eventObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y); + SetSpritePosToMapCoords(eventObject->currentCoords.x, eventObject->currentCoords.y, &sprite->pos1.x, &sprite->pos1.y); sprite->centerToCornerVecX = -(graphicsInfo->width >> 1); sprite->centerToCornerVecY = -(graphicsInfo->height >> 1); sprite->pos1.x += 8; @@ -5024,44 +5024,37 @@ static void MoveCoordsInDirection(u32 dir, s16 *x, s16 *y, s16 deltaX, s16 delta *y -= dy2; } -void sub_8092FF0(s16 x, s16 y, s16 *dest_x, s16 *dest_y) +void sub_8092FF0(s16 x, s16 y, s16 *destX, s16 *destY) { - *dest_x = (x - gSaveBlock1Ptr->pos.x) << 4; - *dest_y = (y - gSaveBlock1Ptr->pos.y) << 4; - *dest_x -= gTotalCameraPixelOffsetX; - *dest_y -= gTotalCameraPixelOffsetY; + *destX = (x - gSaveBlock1Ptr->pos.x) << 4; + *destY = (y - gSaveBlock1Ptr->pos.y) << 4; + *destX -= gTotalCameraPixelOffsetX; + *destY -= gTotalCameraPixelOffsetY; } -void sub_8093038(s16 x, s16 y, s16 *dest_x, s16 *dest_y) +void SetSpritePosToMapCoords(s16 mapX, s16 mapY, s16 *destX, s16 *destY) { - s16 dx; - s16 dy; - - dx = -gTotalCameraPixelOffsetX - gFieldCamera.x; - dy = -gTotalCameraPixelOffsetY - gFieldCamera.y; + s16 dx = -gTotalCameraPixelOffsetX - gFieldCamera.x; + s16 dy = -gTotalCameraPixelOffsetY - gFieldCamera.y; if (gFieldCamera.x > 0) - { - dx += 0x10; - } + dx += 1 << 4; + if (gFieldCamera.x < 0) - { - dx -= 0x10; - } + dx -= 1 << 4; + if (gFieldCamera.y > 0) - { - dy += 0x10; - } + dy += 1 << 4; + if (gFieldCamera.y < 0) - { - dy -= 0x10; - } - *dest_x = ((x - gSaveBlock1Ptr->pos.x) << 4) + dx; - *dest_y = ((y - gSaveBlock1Ptr->pos.y) << 4) + dy; + dy -= 1 << 4; + + *destX = ((mapX - gSaveBlock1Ptr->pos.x) << 4) + dx; + *destY = ((mapY - gSaveBlock1Ptr->pos.y) << 4) + dy; } void sub_80930E0(s16 *x, s16 *y, s16 dx, s16 dy) { - sub_8093038(*x, *y, x, y); + SetSpritePosToMapCoords(*x, *y, x, y); *x += dx; *y += dy; } diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c index 3f75fbb84..c715da25d 100755 --- a/src/field_effect_helpers.c +++ b/src/field_effect_helpers.c @@ -191,7 +191,7 @@ void ShowWarpArrowSprite(u8 spriteId, u8 direction, s16 x, s16 y) sprite = &gSprites[spriteId]; if (sprite->invisible || sprite->data[0] != x || sprite->data[1] != y) { - sub_8093038(x, y, &x2, &y2); + SetSpritePosToMapCoords(x, y, &x2, &y2); sprite = &gSprites[spriteId]; sprite->pos1.x = x2 + 8; sprite->pos1.y = y2 + 8; diff --git a/src/field_weather.c b/src/field_weather.c index a2c40052b..346d30a38 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -91,7 +91,7 @@ static const struct WeatherCallbacks sWeatherFuncs[] = { {None_Init, None_Main, None_Init, None_Finish}, {Clouds_InitVars, Clouds_Main, Clouds_InitAll, Clouds_Finish}, - {Weather2_InitVars, Weather2_Main, Weather2_InitAll, Weather2_Finish}, + {Sunny_InitVars, Sunny_Main, Sunny_InitAll, Sunny_Finish}, {LightRain_InitVars, LightRain_Main, LightRain_InitAll, LightRain_Finish}, {Snow_InitVars, Snow_Main, Snow_InitAll, Snow_Finish}, {MedRain_InitVars, Rain_Main, MedRain_InitAll, Rain_Finish}, diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index 95f80d061..0544710ad 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -33,9 +33,13 @@ const u8 gWeatherSandstormTiles[] = INCBIN_U8("graphics/weather/sandstorm.4bpp") // Clouds //------------------------------------------------------------------------------ -static void sub_80AC6B4(struct Sprite *); +static void CreateCloudSprites(void); +static void DestroyCloudSprites(void); +static void UpdateCloudSprite(struct Sprite *); -static const struct Coords16 gUnknown_0854FB50[] = +// The clouds are positioned on the map's grid. +// These coordinates are for the lower half of Route 120. +static const struct Coords16 sCloudSpriteMapCoords[] = { { 0, 66}, { 5, 73}, @@ -49,11 +53,11 @@ static const struct SpriteSheet sCloudSpriteSheet = .tag = 0x1200 }; -static const struct OamData gOamData_839A9DC = +static const struct OamData sCloudSpriteOamData = { .y = 0, .affineMode = 0, - .objMode = 1, + .objMode = ST_OAM_OBJ_BLEND, .mosaic = 0, .bpp = 0, .shape = SPRITE_SHAPE(64x64), @@ -66,26 +70,26 @@ static const struct OamData gOamData_839A9DC = .affineParam = 0, }; -static const union AnimCmd gSpriteAnim_839A9E4[] = +static const union AnimCmd sCloudSpriteAnimCmd[] = { ANIMCMD_FRAME(0, 16), ANIMCMD_END, }; -static const union AnimCmd *const gSpriteAnimTable_839A9EC[] = +static const union AnimCmd *const sCloudSpriteAnimCmds[] = { - gSpriteAnim_839A9E4, + sCloudSpriteAnimCmd, }; static const struct SpriteTemplate sCloudSpriteTemplate = { - .tileTag = 4608, - .paletteTag = 4609, - .oam = &gOamData_839A9DC, - .anims = gSpriteAnimTable_839A9EC, + .tileTag = 0x1200, + .paletteTag = 0x1201, + .oam = &sCloudSpriteOamData, + .anims = sCloudSpriteAnimCmds, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_80AC6B4, + .callback = UpdateCloudSprite, }; void Clouds_InitVars(void) @@ -105,8 +109,6 @@ void Clouds_InitAll(void) Clouds_Main(); } -void CreateCloudSprites(void); - void Clouds_Main(void) { switch (gWeatherPtr->initStep) @@ -129,8 +131,6 @@ void Clouds_Main(void) } } -void sub_807E0A0(void); - bool8 Clouds_Finish(void) { switch (gWeatherPtr->finishStep) @@ -142,7 +142,7 @@ bool8 Clouds_Finish(void) case 1: if (Weather_UpdateBlend()) { - sub_807E0A0(); + DestroyCloudSprites(); gWeatherPtr->finishStep++; } return TRUE; @@ -150,49 +150,45 @@ bool8 Clouds_Finish(void) return FALSE; } -//------------------------------------------------------------------------------ -// Weather 2 -//------------------------------------------------------------------------------ - -void Weather2_InitVars(void) +void Sunny_InitVars(void) { gWeatherPtr->gammaTargetIndex = 0; gWeatherPtr->gammaStepDelay = 20; } -void Weather2_InitAll(void) +void Sunny_InitAll(void) { - Weather2_InitVars(); + Sunny_InitVars(); } -void Weather2_Main(void) +void Sunny_Main(void) { } -bool8 Weather2_Finish(void) +bool8 Sunny_Finish(void) { - return 0; + return FALSE; } -void CreateCloudSprites(void) +static void CreateCloudSprites(void) { u16 i; + u8 spriteId; + struct Sprite *sprite; if (gWeatherPtr->cloudSpritesCreated == TRUE) return; + LoadSpriteSheet(&sCloudSpriteSheet); LoadCustomWeatherSpritePalette(gUnknown_0854C290); - for (i = 0; i < 3; i++) + for (i = 0; i < NUM_CLOUD_SPRITES; i++) { - u8 spriteId = CreateSprite(&sCloudSpriteTemplate, 0, 0, 0xFF); - + spriteId = CreateSprite(&sCloudSpriteTemplate, 0, 0, 0xFF); if (spriteId != MAX_SPRITES) { - struct Sprite *sprite; - gWeatherPtr->sprites.s1.cloudSprites[i] = &gSprites[spriteId]; sprite = gWeatherPtr->sprites.s1.cloudSprites[i]; - sub_8093038(gUnknown_0854FB50[i].x + 7, gUnknown_0854FB50[i].y + 7, &sprite->pos1.x, &sprite->pos1.y); + SetSpritePosToMapCoords(sCloudSpriteMapCoords[i].x + 7, sCloudSpriteMapCoords[i].y + 7, &sprite->pos1.x, &sprite->pos1.y); sprite->coordOffsetEnabled = TRUE; } else @@ -200,28 +196,32 @@ void CreateCloudSprites(void) gWeatherPtr->sprites.s1.cloudSprites[i] = NULL; } } + gWeatherPtr->cloudSpritesCreated = TRUE; } -void sub_807E0A0(void) +static void DestroyCloudSprites(void) { u16 i; - if (gWeatherPtr->cloudSpritesCreated == FALSE) + if (!gWeatherPtr->cloudSpritesCreated) return; - for (i = 0; i < 3; i++) + + for (i = 0; i < NUM_CLOUD_SPRITES; i++) { if (gWeatherPtr->sprites.s1.cloudSprites[i] != NULL) DestroySprite(gWeatherPtr->sprites.s1.cloudSprites[i]); } + FreeSpriteTilesByTag(0x1200); gWeatherPtr->cloudSpritesCreated = FALSE; } -static void sub_80AC6B4(struct Sprite *sprite) +static void UpdateCloudSprite(struct Sprite *sprite) { + // Move 1 pixel left every 2 frames. sprite->data[0] = (sprite->data[0] + 1) & 1; - if (sprite->data[0] != 0) + if (sprite->data[0]) sprite->pos1.x--; } @@ -437,7 +437,7 @@ static const union AnimCmd *const sRainSpriteAnimCmds[] = static const struct SpriteTemplate sRainSpriteTemplate = { .tileTag = 4614, - .paletteTag = 4608, + .paletteTag = 0x1200, .oam = &sRainSpriteOamData, .anims = sRainSpriteAnimCmds, .images = NULL, @@ -475,7 +475,7 @@ void LightRain_InitVars(void) gWeatherPtr->rainSpriteVisibleCounter = 0; gWeatherPtr->rainSpriteVisibleDelay = 8; gWeatherPtr->isHeavyRain = 0; - gWeatherPtr->maxRainSprites = 10; + gWeatherPtr->targetRainSpriteCount = 10; gWeatherPtr->gammaTargetIndex = 3; gWeatherPtr->gammaStepDelay = 20; SetRainStrengthFromSoundEffect(SE_T_KOAME); @@ -524,7 +524,7 @@ bool8 LightRain_Finish(void) } else { - gWeatherPtr->maxRainSprites = 0; + gWeatherPtr->targetRainSpriteCount = 0; gWeatherPtr->finishStep++; } // fall through @@ -714,13 +714,13 @@ static bool8 CreateRainSprite(void) static bool8 UpdateVisibleRainSprites(void) { - if (gWeatherPtr->curRainSpriteIndex == gWeatherPtr->maxRainSprites) + if (gWeatherPtr->curRainSpriteIndex == gWeatherPtr->targetRainSpriteCount) return FALSE; if (++gWeatherPtr->rainSpriteVisibleCounter > gWeatherPtr->rainSpriteVisibleDelay) { gWeatherPtr->rainSpriteVisibleCounter = 0; - if (gWeatherPtr->curRainSpriteIndex < gWeatherPtr->maxRainSprites) + if (gWeatherPtr->curRainSpriteIndex < gWeatherPtr->targetRainSpriteCount) { gWeatherPtr->sprites.s1.rainSprites[gWeatherPtr->curRainSpriteIndex++]->tActive = 1; } @@ -759,39 +759,38 @@ static void DestroyRainSprites(void) // Snow //------------------------------------------------------------------------------ +static void UpdateSnowflakeSprite(struct Sprite *); +static bool8 UpdateVisibleSnowflakeSprites(void); +static bool8 CreateSnowflakeSprite(void); +static bool8 DestroySnowflakeSprite(void); +static void InitSnowflakeSpriteMovement(struct Sprite *); + void Snow_InitVars(void) { gWeatherPtr->initStep = 0; gWeatherPtr->weatherGfxLoaded = FALSE; gWeatherPtr->gammaTargetIndex = 3; gWeatherPtr->gammaStepDelay = 20; - gWeatherPtr->unknown_6E5 = 16; - gWeatherPtr->unknown_6E0 = 0; + gWeatherPtr->targetSnowflakeSpriteCount = 16; + gWeatherPtr->snowflakeVisibleCounter = 0; } -void Snow_Main(void); -void sub_807ED48(struct Sprite *); - void Snow_InitAll(void) { + u16 i; + Snow_InitVars(); while (gWeatherPtr->weatherGfxLoaded == FALSE) { - u16 i; - Snow_Main(); for (i = 0; i < gWeatherPtr->snowflakeSpriteCount; i++) - { - sub_807ED48(gWeatherPtr->sprites.s1.snowflakeSprites[i]); - } + UpdateSnowflakeSprite(gWeatherPtr->sprites.s1.snowflakeSprites[i]); } } -u8 snowflakes_progress(void); - void Snow_Main(void) { - if (gWeatherPtr->initStep == 0 && snowflakes_progress() == FALSE) + if (gWeatherPtr->initStep == 0 && !UpdateVisibleSnowflakeSprites()) { gWeatherPtr->weatherGfxLoaded = TRUE; gWeatherPtr->initStep++; @@ -803,44 +802,40 @@ bool8 Snow_Finish(void) switch (gWeatherPtr->finishStep) { case 0: - gWeatherPtr->unknown_6E5 = 0; - gWeatherPtr->unknown_6E0 = 0; + gWeatherPtr->targetSnowflakeSpriteCount = 0; + gWeatherPtr->snowflakeVisibleCounter = 0; gWeatherPtr->finishStep++; // fall through case 1: - if (snowflakes_progress() == FALSE) + if (!UpdateVisibleSnowflakeSprites()) { gWeatherPtr->finishStep++; return FALSE; } return TRUE; } + return FALSE; } -bool8 CreateSnowflakeSprite(void); -bool8 RemoveSnowflakeSprite(void); - -bool8 snowflakes_progress(void) +static bool8 UpdateVisibleSnowflakeSprites(void) { - if (gWeatherPtr->snowflakeSpriteCount == gWeatherPtr->unknown_6E5) + if (gWeatherPtr->snowflakeSpriteCount == gWeatherPtr->targetSnowflakeSpriteCount) return FALSE; - gWeatherPtr->unknown_6E0++; - if (gWeatherPtr->unknown_6E0 > 36) + if (++gWeatherPtr->snowflakeVisibleCounter > 36) { - gWeatherPtr->unknown_6E0 = 0; - if (gWeatherPtr->snowflakeSpriteCount < gWeatherPtr->unknown_6E5) + gWeatherPtr->snowflakeVisibleCounter = 0; + if (gWeatherPtr->snowflakeSpriteCount < gWeatherPtr->targetSnowflakeSpriteCount) CreateSnowflakeSprite(); else - RemoveSnowflakeSprite(); + DestroySnowflakeSprite(); } - return (gWeatherPtr->snowflakeSpriteCount != gWeatherPtr->unknown_6E5); + + return gWeatherPtr->snowflakeSpriteCount != gWeatherPtr->targetSnowflakeSpriteCount; } -void sub_807EC40(struct Sprite *); - -static const struct OamData gOamData_839AAD4 = +static const struct OamData sSnowflakeSpriteOamData = { .y = 0, .affineMode = 0, @@ -857,42 +852,391 @@ static const struct OamData gOamData_839AAD4 = .affineParam = 0, }; -static const struct SpriteFrameImage gSpriteImageTable_839AADC[] = +static const struct SpriteFrameImage sSnowflakeSpriteImages[] = { {gWeatherSnow1Tiles, sizeof(gWeatherSnow1Tiles)}, {gWeatherSnow2Tiles, sizeof(gWeatherSnow2Tiles)}, }; -static const union AnimCmd gSpriteAnim_839AAEC[] = +static const union AnimCmd sSnowflakeAnimCmd0[] = { ANIMCMD_FRAME(0, 16), ANIMCMD_END, }; -static const union AnimCmd gSpriteAnim_839AAF4[] = +static const union AnimCmd sSnowflakeAnimCmd1[] = { ANIMCMD_FRAME(1, 16), ANIMCMD_END, }; -static const union AnimCmd *const gSpriteAnimTable_839AAFC[] = +static const union AnimCmd *const sSnowflakeAnimCmds[] = { - gSpriteAnim_839AAEC, - gSpriteAnim_839AAF4, + sSnowflakeAnimCmd0, + sSnowflakeAnimCmd1, }; -void sub_807ED48(struct Sprite *); static const struct SpriteTemplate sSnowflakeSpriteTemplate = { .tileTag = 0xFFFF, - .paletteTag = 4608, - .oam = &gOamData_839AAD4, - .anims = gSpriteAnimTable_839AAFC, - .images = gSpriteImageTable_839AADC, + .paletteTag = 0x1200, + .oam = &sSnowflakeSpriteOamData, + .anims = sSnowflakeAnimCmds, + .images = sSnowflakeSpriteImages, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_807ED48, + .callback = UpdateSnowflakeSprite, }; +#define tPosY data[0] +#define tDeltaY data[1] +#define tWaveDelta data[2] +#define tWaveIndex data[3] +#define tSnowflakeId data[4] +#define tFallCounter data[5] +#define tFallDuration data[6] +#define tDeltaY2 data[7] + +static bool8 CreateSnowflakeSprite(void) +{ + u8 spriteId = CreateSpriteAtEnd(&sSnowflakeSpriteTemplate, 0, 0, 78); + if (spriteId == MAX_SPRITES) + return FALSE; + + gSprites[spriteId].tSnowflakeId = gWeatherPtr->snowflakeSpriteCount; + InitSnowflakeSpriteMovement(&gSprites[spriteId]); + gSprites[spriteId].coordOffsetEnabled = TRUE; + gWeatherPtr->sprites.s1.snowflakeSprites[gWeatherPtr->snowflakeSpriteCount++] = &gSprites[spriteId]; + return TRUE; +} + +static bool8 DestroySnowflakeSprite(void) +{ + if (gWeatherPtr->snowflakeSpriteCount) + { + DestroySprite(gWeatherPtr->sprites.s1.snowflakeSprites[--gWeatherPtr->snowflakeSpriteCount]); + return TRUE; + } + + return FALSE; +} + +static void InitSnowflakeSpriteMovement(struct Sprite *sprite) +{ + u16 rand; + u16 x = ((sprite->tSnowflakeId * 5) & 7) * 30 + (Random() % 30); + + sprite->pos1.y = -3 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); + sprite->pos1.x = x - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); + sprite->tPosY = sprite->pos1.y * 128; + sprite->pos2.x = 0; + rand = Random(); + sprite->tDeltaY = (rand & 3) * 5 + 64; + sprite->tDeltaY2 = sprite->tDeltaY; + StartSpriteAnim(sprite, (rand & 1) ? 0 : 1); + sprite->tWaveIndex = 0; + sprite->tWaveDelta = ((rand & 3) == 0) ? 2 : 1; + sprite->tFallDuration = (rand & 0x1F) + 210; + sprite->tFallCounter = 0; +} + +static void WaitSnowflakeSprite(struct Sprite *sprite) +{ + if (gWeatherPtr->unknown_6E2 > 18) + { + sprite->invisible = FALSE; + sprite->callback = UpdateSnowflakeSprite; + sprite->pos1.y = 250 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); + sprite->tPosY = sprite->pos1.y * 128; + gWeatherPtr->unknown_6E2 = 0; + } +} + +static void UpdateSnowflakeSprite(struct Sprite *sprite) +{ + s16 x; + s16 y; + + sprite->tPosY += sprite->tDeltaY; + sprite->pos1.y = sprite->tPosY >> 7; + sprite->tWaveIndex += sprite->tWaveDelta; + sprite->tWaveIndex &= 0xFF; + sprite->pos2.x = gSineTable[sprite->tWaveIndex] / 64; + + x = (sprite->pos1.x + sprite->centerToCornerVecX + gSpriteCoordOffsetX) & 0x1FF; + if (x & 0x100) + x |= -0x100; + + if (x < -3) + sprite->pos1.x = 242 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); + else if (x > 242) + sprite->pos1.x = -3 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); + + y = (sprite->pos1.y + sprite->centerToCornerVecY + gSpriteCoordOffsetY) & 0xFF; + if (y > 163 && y < 171) + { + sprite->pos1.y = 250 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); + sprite->tPosY = sprite->pos1.y * 128; + sprite->tFallCounter = 0; + sprite->tFallDuration = 220; + } + else if (y > 242 && y < 250) + { + sprite->pos1.y = 163; + sprite->tPosY = sprite->pos1.y * 128; + sprite->tFallCounter = 0; + sprite->tFallDuration = 220; + sprite->invisible = TRUE; + sprite->callback = WaitSnowflakeSprite; + } + + if (++sprite->tFallCounter == sprite->tFallDuration) + { + InitSnowflakeSpriteMovement(sprite); + sprite->pos1.y = 250; + sprite->invisible = TRUE; + sprite->callback = WaitSnowflakeSprite; + } +} + +#undef tPosY +#undef tDeltaY +#undef tWaveDelta +#undef tWaveIndex +#undef tSnowflakeId +#undef tFallCounter +#undef tFallDuration +#undef tDeltaY2 + +//------------------------------------------------------------------------------ +// Medium Rain +//------------------------------------------------------------------------------ + +void MedRain_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = FALSE; + gWeatherPtr->rainSpriteVisibleCounter = 0; + gWeatherPtr->rainSpriteVisibleDelay = 4; + gWeatherPtr->isHeavyRain = 0; + gWeatherPtr->targetRainSpriteCount = 16; + gWeatherPtr->gammaTargetIndex = 3; + gWeatherPtr->gammaStepDelay = 20; + gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment + gWeatherPtr->thunderTriggered = 0; + SetRainStrengthFromSoundEffect(SE_T_AME); +} + +void MedRain_InitAll(void) +{ + MedRain_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + Rain_Main(); +} + +//------------------------------------------------------------------------------ +// Heavy Rain +//------------------------------------------------------------------------------ + +static void UpdateThunderSound(void); +static void SetThunderCounter(u16); + +void HeavyRain_InitVars(void) +{ + gWeatherPtr->initStep = 0; + gWeatherPtr->weatherGfxLoaded = FALSE; + gWeatherPtr->rainSpriteVisibleCounter = 0; + gWeatherPtr->rainSpriteVisibleDelay = 4; + gWeatherPtr->isHeavyRain = 1; + gWeatherPtr->targetRainSpriteCount = 24; + gWeatherPtr->gammaTargetIndex = 3; + gWeatherPtr->gammaStepDelay = 20; + gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment + SetRainStrengthFromSoundEffect(SE_T_OOAME); +} + +void HeavyRain_InitAll(void) +{ + HeavyRain_InitVars(); + while (gWeatherPtr->weatherGfxLoaded == FALSE) + Rain_Main(); +} + +void Rain_Main(void) +{ + UpdateThunderSound(); + switch (gWeatherPtr->initStep) + { + case 0: + LoadRainSpriteSheet(); + gWeatherPtr->initStep++; + break; + case 1: + if (!CreateRainSprite()) + gWeatherPtr->initStep++; + break; + case 2: + if (!UpdateVisibleRainSprites()) + { + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + } + break; + case 3: + if (gWeatherPtr->palProcessingState != WEATHER_PAL_STATE_CHANGING_WEATHER) + gWeatherPtr->initStep = 6; + break; + case 4: + gWeatherPtr->unknown_6EA = 1; + gWeatherPtr->unknown_6E6 = (Random() % 360) + 360; + gWeatherPtr->initStep++; + // fall through + case 5: + if (--gWeatherPtr->unknown_6E6 == 0) + gWeatherPtr->initStep++; + break; + case 6: + gWeatherPtr->unknown_6EA = 1; + gWeatherPtr->unknown_6EB = Random() % 2; + gWeatherPtr->initStep++; + break; + case 7: + gWeatherPtr->unknown_6EC = (Random() & 1) + 1; + gWeatherPtr->initStep++; + // fall through + case 8: + sub_80ABC48(19); + if (gWeatherPtr->unknown_6EB == 0 && gWeatherPtr->unknown_6EC == 1) + SetThunderCounter(20); + + gWeatherPtr->unknown_6E6 = (Random() % 3) + 6; + gWeatherPtr->initStep++; + break; + case 9: + if (--gWeatherPtr->unknown_6E6 == 0) + { + sub_80ABC48(3); + gWeatherPtr->unknown_6EA = 1; + if (--gWeatherPtr->unknown_6EC != 0) + { + gWeatherPtr->unknown_6E6 = (Random() % 16) + 60; + gWeatherPtr->initStep = 10; + } + else if (gWeatherPtr->unknown_6EB == 0) + { + gWeatherPtr->initStep = 4; + } + else + { + gWeatherPtr->initStep = 11; + } + } + break; + case 10: + if (--gWeatherPtr->unknown_6E6 == 0) + gWeatherPtr->initStep = 8; + break; + case 11: + gWeatherPtr->unknown_6E6 = (Random() % 16) + 60; + gWeatherPtr->initStep++; + break; + case 12: + if (--gWeatherPtr->unknown_6E6 == 0) + { + SetThunderCounter(100); + sub_80ABC48(19); + gWeatherPtr->unknown_6E6 = (Random() & 0xF) + 30; + gWeatherPtr->initStep++; + } + break; + case 13: + if (--gWeatherPtr->unknown_6E6 == 0) + { + sub_80ABC7C(19, 3, 5); + gWeatherPtr->initStep++; + } + break; + case 14: + if (gWeatherPtr->palProcessingState == WEATHER_PAL_STATE_IDLE) + { + gWeatherPtr->unknown_6EA = 1; + gWeatherPtr->initStep = 4; + } + break; + } +} + +bool8 Rain_Finish(void) +{ + switch (gWeatherPtr->finishStep) + { + case 0: + gWeatherPtr->unknown_6EA = 0; + gWeatherPtr->finishStep++; + // fall through + case 1: + Rain_Main(); + if (gWeatherPtr->unknown_6EA) + { + if (gWeatherPtr->nextWeather == WEATHER_RAIN_LIGHT + || gWeatherPtr->nextWeather == WEATHER_RAIN_MED + || gWeatherPtr->nextWeather == WEATHER_RAIN_HEAVY) + return FALSE; + + gWeatherPtr->targetRainSpriteCount = 0; + gWeatherPtr->finishStep++; + } + break; + case 2: + if (!UpdateVisibleRainSprites()) + { + DestroyRainSprites(); + gWeatherPtr->thunderTriggered = 0; + gWeatherPtr->finishStep++; + return FALSE; + } + break; + default: + return FALSE; + } + return TRUE; +} + +static void SetThunderCounter(u16 max) +{ + if (gWeatherPtr->thunderTriggered == 0) + { + gWeatherPtr->thunderCounter = Random() % max; + gWeatherPtr->thunderTriggered = 1; + } +} + +static void UpdateThunderSound(void) +{ + if (gWeatherPtr->thunderTriggered == 1) + { + if (gWeatherPtr->thunderCounter == 0) + { + if (IsSEPlaying()) + return; + + if (Random() & 1) + PlaySE(SE_T_KAMI); + else + PlaySE(SE_T_KAMI2); + + gWeatherPtr->thunderTriggered = 0; + } + else + { + gWeatherPtr->thunderCounter--; + } + } +} + +//------------------------------------------------------------------------------ +// Fog 1 +//------------------------------------------------------------------------------ + // unused data static const u16 unusedData_839AB1C[] = {0, 6, 6, 12, 18, 42, 300, 300}; @@ -973,8 +1317,8 @@ static const union AffineAnimCmd *const gSpriteAffineAnimTable_839AB8C[] = static void Fog1SpriteCallback(struct Sprite *); static const struct SpriteTemplate sFog1SpriteTemplate = { - .tileTag = 4609, - .paletteTag = 4608, + .tileTag = 0x1201, + .paletteTag = 0x1200, .oam = &gOamData_839AB2C, .anims = gSpriteAnimTable_839AB64, .images = NULL, @@ -982,332 +1326,6 @@ static const struct SpriteTemplate sFog1SpriteTemplate = .callback = Fog1SpriteCallback, }; -bool8 CreateSnowflakeSprite(void) -{ - u8 spriteId = CreateSpriteAtEnd(&sSnowflakeSpriteTemplate, 0, 0, 78); - - if (spriteId == MAX_SPRITES) - return FALSE; - gSprites[spriteId].data[4] = gWeatherPtr->snowflakeSpriteCount; - sub_807EC40(&gSprites[spriteId]); - gSprites[spriteId].coordOffsetEnabled = TRUE; - gWeatherPtr->sprites.s1.snowflakeSprites[gWeatherPtr->snowflakeSpriteCount++] = &gSprites[spriteId]; - return TRUE; -} - -bool8 RemoveSnowflakeSprite(void) -{ - if (gWeatherPtr->snowflakeSpriteCount != 0) - { - DestroySprite(gWeatherPtr->sprites.s1.snowflakeSprites[--gWeatherPtr->snowflakeSpriteCount]); - return TRUE; - } - return FALSE; -} - -void sub_807EC40(struct Sprite *sprite) -{ - u16 r4 = ((sprite->data[4] * 5) & 7) * 30 + (Random() % 30); - u16 r6; - - sprite->pos1.y = -3 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); - sprite->pos1.x = r4 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); - sprite->data[0] = sprite->pos1.y * 128; - sprite->pos2.x = 0; - r6 = Random(); - sprite->data[1] = (r6 & 3) * 5 + 64; - sprite->data[7] = (r6 & 3) * 5 + 64; - StartSpriteAnim(sprite, (r6 & 1) ? 0 : 1); - sprite->data[3] = 0; - sprite->data[2] = ((r6 & 3) == 0) ? 2 : 1; - sprite->data[6] = (r6 & 0x1F) + 210; - sprite->data[5] = 0; -} - -void sub_807ECEC(struct Sprite *sprite) -{ - if (gWeatherPtr->unknown_6E2 > 18) - { - sprite->invisible = FALSE; - sprite->callback = sub_807ED48; - sprite->pos1.y = 0xFA - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); - sprite->data[0] = sprite->pos1.y * 128; - gWeatherPtr->unknown_6E2 = 0; - } -} - -void sub_807ED48(struct Sprite *sprite) -{ - s16 r3; - s16 r2; - - sprite->data[0] += sprite->data[1]; - sprite->pos1.y = sprite->data[0] >> 7; - sprite->data[3] = (sprite->data[3] + sprite->data[2]) & 0xFF; - sprite->pos2.x = gSineTable[sprite->data[3]] / 64; - - r3 = (sprite->pos1.x + sprite->centerToCornerVecX + gSpriteCoordOffsetX) & 0x1FF; - if (r3 & 0x100) - r3 |= -0x100; // hmm... what is this? - if (r3 < -3) - sprite->pos1.x = 242 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); - else if (r3 > 242) - sprite->pos1.x = -3 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); - - r2 = (sprite->pos1.y + sprite->centerToCornerVecY + gSpriteCoordOffsetY) & 0xFF; - if (r2 > 163 && r2 < 171) - { - sprite->pos1.y = 250 - (gSpriteCoordOffsetY + sprite->centerToCornerVecY); - sprite->data[0] = sprite->pos1.y * 128; - sprite->data[5] = 0; - sprite->data[6] = 220; - } - else if (r2 > 242 && r2 < 250) - { - sprite->pos1.y = 163; - sprite->data[0] = sprite->pos1.y * 128; - sprite->data[5] = 0; - sprite->data[6] = 220; - sprite->invisible = TRUE; - sprite->callback = sub_807ECEC; - } - - sprite->data[5]++; - if (sprite->data[5] == sprite->data[6]) - { - sub_807EC40(sprite); - sprite->pos1.y = 250; - sprite->invisible = TRUE; - sprite->callback = sub_807ECEC; - } -} - -//------------------------------------------------------------------------------ -// Medium Rain -//------------------------------------------------------------------------------ - -void MedRain_InitVars(void) -{ - gWeatherPtr->initStep = 0; - gWeatherPtr->weatherGfxLoaded = FALSE; - gWeatherPtr->rainSpriteVisibleCounter = 0; - gWeatherPtr->rainSpriteVisibleDelay = 4; - gWeatherPtr->isHeavyRain = 0; - gWeatherPtr->maxRainSprites = 16; - gWeatherPtr->gammaTargetIndex = 3; - gWeatherPtr->gammaStepDelay = 20; - gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment - gWeatherPtr->unknown_6ED = 0; - SetRainStrengthFromSoundEffect(SE_T_AME); -} - -void Rain_Main(void); - -void MedRain_InitAll(void) -{ - MedRain_InitVars(); - while (gWeatherPtr->weatherGfxLoaded == FALSE) - Rain_Main(); -} - -//------------------------------------------------------------------------------ -// Heavy Rain -//------------------------------------------------------------------------------ - -void HeavyRain_InitVars(void) -{ - gWeatherPtr->initStep = 0; - gWeatherPtr->weatherGfxLoaded = FALSE; - gWeatherPtr->rainSpriteVisibleCounter = 0; - gWeatherPtr->rainSpriteVisibleDelay = 4; - gWeatherPtr->isHeavyRain = 1; - gWeatherPtr->maxRainSprites = 24; - gWeatherPtr->gammaTargetIndex = 3; - gWeatherPtr->gammaStepDelay = 20; - gWeatherPtr->weatherGfxLoaded = FALSE; // duplicate assignment - SetRainStrengthFromSoundEffect(SE_T_OOAME); -} - -void HeavyRain_InitAll(void) -{ - HeavyRain_InitVars(); - while (gWeatherPtr->weatherGfxLoaded == FALSE) - Rain_Main(); -} - -static void UpdateThunderSound(void); -static void SetThunderCounter(u16); - -void Rain_Main(void) -{ - UpdateThunderSound(); - switch (gWeatherPtr->initStep) - { - case 0: - LoadRainSpriteSheet(); - gWeatherPtr->initStep++; - break; - case 1: - if (CreateRainSprite()) - break; - gWeatherPtr->initStep++; - break; - case 2: - if (UpdateVisibleRainSprites()) - break; - gWeatherPtr->weatherGfxLoaded = TRUE; - gWeatherPtr->initStep++; - break; - case 3: - if (gWeatherPtr->palProcessingState == WEATHER_PAL_STATE_CHANGING_WEATHER) - break; - gWeatherPtr->initStep = 6; - break; - case 4: - gWeatherPtr->unknown_6EA = 1; - gWeatherPtr->unknown_6E6 = (Random() % 360) + 360; - gWeatherPtr->initStep++; - // fall through - case 5: - if (--gWeatherPtr->unknown_6E6 != 0) - break; - gWeatherPtr->initStep++; - break; - case 6: - gWeatherPtr->unknown_6EA = 1; - gWeatherPtr->unknown_6EB = Random() % 2; - gWeatherPtr->initStep++; - break; - case 7: - gWeatherPtr->unknown_6EC = (Random() & 1) + 1; - gWeatherPtr->initStep++; - // fall through - case 8: - sub_80ABC48(19); - if (gWeatherPtr->unknown_6EB == 0 && gWeatherPtr->unknown_6EC == 1) - SetThunderCounter(20); - gWeatherPtr->unknown_6E6 = (Random() % 3) + 6; - gWeatherPtr->initStep++; - break; - case 9: - if (--gWeatherPtr->unknown_6E6 != 0) - break; - sub_80ABC48(3); - gWeatherPtr->unknown_6EA = 1; - if (--gWeatherPtr->unknown_6EC != 0) - { - gWeatherPtr->unknown_6E6 = (Random() % 16) + 60; - gWeatherPtr->initStep = 10; - } - else if (gWeatherPtr->unknown_6EB == 0) - { - gWeatherPtr->initStep = 4; - } - else - { - gWeatherPtr->initStep = 11; - } - break; - case 10: - if (--gWeatherPtr->unknown_6E6 != 0) - break; - gWeatherPtr->initStep = 8; - break; - case 11: - gWeatherPtr->unknown_6E6 = (Random() % 16) + 60; - gWeatherPtr->initStep++; - break; - case 12: - if (--gWeatherPtr->unknown_6E6 != 0) - break; - SetThunderCounter(100); - sub_80ABC48(19); - // Why use "% 16" everywhere else and "& 0xF" here. So dumb. - gWeatherPtr->unknown_6E6 = (Random() & 0xF) + 30; - gWeatherPtr->initStep++; - break; - case 13: - if (--gWeatherPtr->unknown_6E6 != 0) - break; - sub_80ABC7C(19, 3, 5); - gWeatherPtr->initStep++; - break; - case 14: - if (gWeatherPtr->palProcessingState != WEATHER_PAL_STATE_IDLE) - break; - gWeatherPtr->unknown_6EA = 1; - gWeatherPtr->initStep = 4; - break; - } -} - -bool8 Rain_Finish(void) -{ - switch (gWeatherPtr->finishStep) - { - case 0: - gWeatherPtr->unknown_6EA = 0; - gWeatherPtr->finishStep++; - // fall through - case 1: - Rain_Main(); - if (gWeatherPtr->unknown_6EA != 0) - { - if (gWeatherPtr->nextWeather == WEATHER_RAIN_LIGHT - || gWeatherPtr->nextWeather == WEATHER_RAIN_MED - || gWeatherPtr->nextWeather == WEATHER_RAIN_HEAVY) - return FALSE; - gWeatherPtr->maxRainSprites = 0; - gWeatherPtr->finishStep++; - } - break; - case 2: - if (UpdateVisibleRainSprites()) - break; - DestroyRainSprites(); - gWeatherPtr->unknown_6ED = 0; - gWeatherPtr->finishStep++; - return FALSE; - default: - return FALSE; - } - return TRUE; -} - -static void SetThunderCounter(u16 max) -{ - if (gWeatherPtr->unknown_6ED == 0) - { - gWeatherPtr->thunderCounter = Random() % max; - gWeatherPtr->unknown_6ED = 1; - } -} - -static void UpdateThunderSound(void) -{ - if (gWeatherPtr->unknown_6ED == 1) - { - if (gWeatherPtr->thunderCounter == 0) - { - if (IsSEPlaying()) - return; - if (Random() & 1) - PlaySE(SE_T_KAMI); - else - PlaySE(SE_T_KAMI2); - gWeatherPtr->unknown_6ED = 0; - } - else - { - gWeatherPtr->thunderCounter--; - } - } -} - -//------------------------------------------------------------------------------ -// Fog 1 -//------------------------------------------------------------------------------ - void Fog1_Main(void); static void CreateFog1Sprites(void); static void DestroyFog1Sprites(void); @@ -1320,8 +1338,8 @@ void Fog1_InitVars(void) gWeatherPtr->gammaStepDelay = 20; if (gWeatherPtr->fog1SpritesCreated == 0) { - gWeatherPtr->unknown_6F0 = 0; - gWeatherPtr->unknown_6F2 = 0; + gWeatherPtr->fog1ScrollCounter = 0; + gWeatherPtr->fog1ScrollOffset = 0; gWeatherPtr->fog1ScrollPosX = 0; Weather_SetBlendCoeffs(0, 16); } @@ -1336,11 +1354,11 @@ void Fog1_InitAll(void) void Fog1_Main(void) { - gWeatherPtr->fog1ScrollPosX = (gSpriteCoordOffsetX - gWeatherPtr->unknown_6F2) & 0xFF; - if (++gWeatherPtr->unknown_6F0 > 3) + gWeatherPtr->fog1ScrollPosX = (gSpriteCoordOffsetX - gWeatherPtr->fog1ScrollOffset) & 0xFF; + if (++gWeatherPtr->fog1ScrollCounter > 3) { - gWeatherPtr->unknown_6F0 = 0; - gWeatherPtr->unknown_6F2++; + gWeatherPtr->fog1ScrollCounter = 0; + gWeatherPtr->fog1ScrollOffset++; } switch (gWeatherPtr->initStep) { @@ -1364,12 +1382,13 @@ void Fog1_Main(void) bool8 Fog1_Finish(void) { - gWeatherPtr->fog1ScrollPosX = (gSpriteCoordOffsetX - gWeatherPtr->unknown_6F2) & 0xFF; - if (++gWeatherPtr->unknown_6F0 > 3) + gWeatherPtr->fog1ScrollPosX = (gSpriteCoordOffsetX - gWeatherPtr->fog1ScrollOffset) & 0xFF; + if (++gWeatherPtr->fog1ScrollCounter > 3) { - gWeatherPtr->unknown_6F0 = 0; - gWeatherPtr->unknown_6F2++; + gWeatherPtr->fog1ScrollCounter = 0; + gWeatherPtr->fog1ScrollOffset++; } + switch (gWeatherPtr->finishStep) { case 0: @@ -1377,9 +1396,8 @@ bool8 Fog1_Finish(void) gWeatherPtr->finishStep++; break; case 1: - if (!Weather_UpdateBlend()) - break; - gWeatherPtr->finishStep++; + if (Weather_UpdateBlend()) + gWeatherPtr->finishStep++; break; case 2: DestroyFog1Sprites(); @@ -1391,15 +1409,15 @@ bool8 Fog1_Finish(void) return TRUE; } -#define sprColumn data[0] +#define tSpriteColumn data[0] static void Fog1SpriteCallback(struct Sprite *sprite) { sprite->pos2.y = (u8)gSpriteCoordOffsetY; - sprite->pos1.x = gWeatherPtr->fog1ScrollPosX + 32 + sprite->sprColumn * 64; - if (sprite->pos1.x > 0x10F) + sprite->pos1.x = gWeatherPtr->fog1ScrollPosX + 32 + sprite->tSpriteColumn * 64; + if (sprite->pos1.x > 271) { - sprite->pos1.x = 480 + gWeatherPtr->fog1ScrollPosX - (4 - sprite->sprColumn) * 64; + sprite->pos1.x = 480 + gWeatherPtr->fog1ScrollPosX - (4 - sprite->tSpriteColumn) * 64; sprite->pos1.x &= 0x1FF; } } @@ -1407,21 +1425,24 @@ static void Fog1SpriteCallback(struct Sprite *sprite) static void CreateFog1Sprites(void) { u16 i; + u8 spriteId; + struct Sprite *sprite; if (!gWeatherPtr->fog1SpritesCreated) { - struct SpriteSheet fog1SpriteSheet = {gWeatherFog1Tiles, sizeof(gWeatherFog1Tiles), 0x1201}; - + struct SpriteSheet fog1SpriteSheet = { + .data = gWeatherFog1Tiles, + .size = sizeof(gWeatherFog1Tiles), + .tag = 0x1201, + }; LoadSpriteSheet(&fog1SpriteSheet); - for (i = 0; i < 20; i++) + for (i = 0; i < NUM_FOG_SPRITES; i++) { - u8 spriteId = CreateSpriteAtEnd(&sFog1SpriteTemplate, 0, 0, 0xFF); - + spriteId = CreateSpriteAtEnd(&sFog1SpriteTemplate, 0, 0, 0xFF); if (spriteId != MAX_SPRITES) { - struct Sprite *sprite = &gSprites[spriteId]; - - sprite->sprColumn = i % 5; + sprite = &gSprites[spriteId]; + sprite->tSpriteColumn = i % 5; sprite->pos1.x = (i % 5) * 64 + 32; sprite->pos1.y = (i / 5) * 64 + 32; gWeatherPtr->sprites.s2.fog1Sprites[i] = sprite; @@ -1431,36 +1452,38 @@ static void CreateFog1Sprites(void) gWeatherPtr->sprites.s2.fog1Sprites[i] = NULL; } } + gWeatherPtr->fog1SpritesCreated = TRUE; } } -#undef sprColumn - static void DestroyFog1Sprites(void) { u16 i; if (gWeatherPtr->fog1SpritesCreated) { - for (i = 0; i < 20; i++) + for (i = 0; i < NUM_FOG_SPRITES; i++) { if (gWeatherPtr->sprites.s2.fog1Sprites[i] != NULL) DestroySprite(gWeatherPtr->sprites.s2.fog1Sprites[i]); } + FreeSpriteTilesByTag(0x1201); gWeatherPtr->fog1SpritesCreated = 0; } } +#undef tSpriteColumn + //------------------------------------------------------------------------------ // Volcanic ash //------------------------------------------------------------------------------ -void Ash_Main(void); -void LoadAshSpriteSheet(void); -void CreateAshSprites(void); -void DestroyAshSprites(void); +static void LoadAshSpriteSheet(void); +static void CreateAshSprites(void); +static void DestroyAshSprites(void); +static void UpdateAshSprite(struct Sprite *); void Ash_InitVars(void) { @@ -1472,7 +1495,7 @@ void Ash_InitVars(void) if (!gWeatherPtr->ashSpritesCreated) { Weather_SetBlendCoeffs(0, 16); - SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(64, 63)); // Those aren't even valid coefficients! + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(64, 63)); // These aren't valid blend coefficients! } } @@ -1485,9 +1508,10 @@ void Ash_InitAll(void) void Ash_Main(void) { - gWeatherPtr->unknown_6FC = gSpriteCoordOffsetX & 0x1FF; - while (gWeatherPtr->unknown_6FC > 0xEF) - gWeatherPtr->unknown_6FC -= 0xF0; + gWeatherPtr->baseAshSpritesX = gSpriteCoordOffsetX & 0x1FF; + while (gWeatherPtr->baseAshSpritesX >= 240) + gWeatherPtr->baseAshSpritesX -= 240; + switch (gWeatherPtr->initStep) { case 0: @@ -1497,14 +1521,16 @@ void Ash_Main(void) case 1: if (!gWeatherPtr->ashSpritesCreated) CreateAshSprites(); + Weather_SetTargetBlendCoeffs(16, 0, 1); gWeatherPtr->initStep++; break; case 2: - if (!Weather_UpdateBlend()) - break; - gWeatherPtr->weatherGfxLoaded = TRUE; - gWeatherPtr->initStep++; + if (Weather_UpdateBlend()) + { + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + } break; default: Weather_UpdateBlend(); @@ -1521,10 +1547,11 @@ bool8 Ash_Finish(void) gWeatherPtr->finishStep++; break; case 1: - if (!Weather_UpdateBlend()) - break; - DestroyAshSprites(); - gWeatherPtr->finishStep++; + if (Weather_UpdateBlend()) + { + DestroyAshSprites(); + gWeatherPtr->finishStep++; + } break; case 2: SetGpuReg(REG_OFFSET_BLDALPHA, 0); @@ -1536,18 +1563,23 @@ bool8 Ash_Finish(void) return TRUE; } -static const struct SpriteSheet sAshSpriteSheet = {gWeatherAshTiles, sizeof(gWeatherAshTiles), 0x1202}; +static const struct SpriteSheet sAshSpriteSheet = +{ + .data = gWeatherAshTiles, + .size = sizeof(gWeatherAshTiles), + .tag = 0x1202, +}; -void LoadAshSpriteSheet(void) +static void LoadAshSpriteSheet(void) { LoadSpriteSheet(&sAshSpriteSheet); } -const struct OamData gOamData_839ABB8 = +static const struct OamData sAshSpriteOamData = { .y = 0, .affineMode = 0, - .objMode = 1, + .objMode = ST_OAM_OBJ_BLEND, .mosaic = 0, .bpp = 0, .shape = SPRITE_SHAPE(64x64), @@ -1560,48 +1592,52 @@ const struct OamData gOamData_839ABB8 = .affineParam = 0, }; -const union AnimCmd gSpriteAnim_839ABC0[] = +static const union AnimCmd sAshSpriteAnimCmd0[] = { ANIMCMD_FRAME(0, 60), ANIMCMD_FRAME(64, 60), ANIMCMD_JUMP(0), }; -const union AnimCmd *const gSpriteAnimTable_839ABCC[] = +static const union AnimCmd *const sAshSpriteAnimCmds[] = { - gSpriteAnim_839ABC0, + sAshSpriteAnimCmd0, }; -void sub_807FAA8(struct Sprite *); static const struct SpriteTemplate sAshSpriteTemplate = { .tileTag = 4610, - .paletteTag = 4608, - .oam = &gOamData_839ABB8, - .anims = gSpriteAnimTable_839ABCC, + .paletteTag = 0x1200, + .oam = &sAshSpriteOamData, + .anims = sAshSpriteAnimCmds, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_807FAA8, + .callback = UpdateAshSprite, }; -void CreateAshSprites(void) +#define tOffsetY data[0] +#define tCounterY data[1] +#define tSpriteColumn data[2] +#define tSpriteRow data[3] + +static void CreateAshSprites(void) { u8 i; + u8 spriteId; + struct Sprite *sprite; if (!gWeatherPtr->ashSpritesCreated) { - for (i = 0; i < 20; i++) + for (i = 0; i < NUM_ASH_SPRITES; i++) { - u8 spriteId = CreateSpriteAtEnd(&sAshSpriteTemplate, 0, 0, 0x4E); - + spriteId = CreateSpriteAtEnd(&sAshSpriteTemplate, 0, 0, 0x4E); if (spriteId != MAX_SPRITES) { - struct Sprite *sprite = &gSprites[spriteId]; - - sprite->data[1] = 0; - sprite->data[2] = (u8)(i % 5); - sprite->data[3] = (u8)(i / 5); - sprite->data[0] = sprite->data[3] * 64 + 32; + sprite = &gSprites[spriteId]; + sprite->tCounterY = 0; + sprite->tSpriteColumn = (u8)(i % 5); + sprite->tSpriteRow = (u8)(i / 5); + sprite->tOffsetY = sprite->tSpriteRow * 64 + 32; gWeatherPtr->sprites.s2.ashSprites[i] = sprite; } else @@ -1609,43 +1645,50 @@ void CreateAshSprites(void) gWeatherPtr->sprites.s2.ashSprites[i] = NULL; } } + gWeatherPtr->ashSpritesCreated = TRUE; } } -void DestroyAshSprites(void) +static void DestroyAshSprites(void) { u16 i; if (gWeatherPtr->ashSpritesCreated) { - for (i = 0; i < 20; i++) + for (i = 0; i < NUM_ASH_SPRITES; i++) { if (gWeatherPtr->sprites.s2.ashSprites[i] != NULL) DestroySprite(gWeatherPtr->sprites.s2.ashSprites[i]); } + FreeSpriteTilesByTag(0x1202); gWeatherPtr->ashSpritesCreated = FALSE; } } -void sub_807FAA8(struct Sprite *sprite) +static void UpdateAshSprite(struct Sprite *sprite) { - sprite->data[1]++; - if (sprite->data[1] > 5) + if (++sprite->tCounterY > 5) { - sprite->data[1] = 0; - sprite->data[0]++; + sprite->tCounterY = 0; + sprite->tOffsetY++; } - sprite->pos1.y = gSpriteCoordOffsetY + sprite->data[0]; - sprite->pos1.x = gWeatherPtr->unknown_6FC + 32 + sprite->data[2] * 64; + + sprite->pos1.y = gSpriteCoordOffsetY + sprite->tOffsetY; + sprite->pos1.x = gWeatherPtr->baseAshSpritesX + 32 + sprite->tSpriteColumn * 64; if (sprite->pos1.x > 271) { - sprite->pos1.x = gWeatherPtr->unknown_6FC + 0x1E0 - (4 - sprite->data[2]) * 64; + sprite->pos1.x = gWeatherPtr->baseAshSpritesX + 480 - (4 - sprite->tSpriteColumn) * 64; sprite->pos1.x &= 0x1FF; } } +#undef tOffsetY +#undef tCounterY +#undef tSpriteColumn +#undef tSpriteRow + //------------------------------------------------------------------------------ // Fog 2 //------------------------------------------------------------------------------ @@ -1656,8 +1699,8 @@ void Fog2_InitVars(void) gWeatherPtr->weatherGfxLoaded = 0; gWeatherPtr->gammaTargetIndex = 0; gWeatherPtr->gammaStepDelay = 20; - gWeatherPtr->unknown_6F0 = 0; - gWeatherPtr->unknown_6F2 = 1; + gWeatherPtr->fog1ScrollCounter = 0; + gWeatherPtr->fog1ScrollOffset = 1; if (gWeatherPtr->fog2SpritesCreated == 0) { gWeatherPtr->unknown_71C = 0; @@ -1812,7 +1855,7 @@ void Fog2SpriteCallback(struct Sprite *); const struct SpriteTemplate sFog2SpriteTemplate = { .tileTag = 4611, - .paletteTag = 4608, + .paletteTag = 0x1200, .oam = &gOamData_839ABF0, .anims = gSpriteAnimTable_839AC00, .images = NULL, @@ -2017,8 +2060,8 @@ const union AnimCmd *const gSpriteAnimTable_839AC34[] = void SandstormSpriteCallback1(struct Sprite *); const struct SpriteTemplate sSandstormSpriteTemplate = { - .tileTag = 4612, - .paletteTag = 4609, + .tileTag = 0x1204, + .paletteTag = 0x1201, .oam = &gOamData_839AC1C, .anims = gSpriteAnimTable_839AC34, .images = NULL, @@ -2250,7 +2293,7 @@ void unc_0807DAB4(struct Sprite *); const struct SpriteTemplate gSpriteTemplate_839ACBC = { .tileTag = 4613, - .paletteTag = 4608, + .paletteTag = 0x1200, .oam = &gUnknown_08524904, .anims = gSpriteAnimTable_839ACB8, .images = NULL, diff --git a/src/overworld.c b/src/overworld.c index ce1e21ab1..ae6efefd7 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -2960,7 +2960,7 @@ static void InitLinkPlayerEventObjectPos(struct EventObject *eventObj, s16 x, s1 eventObj->currentCoords.y = y; eventObj->previousCoords.x = x; eventObj->previousCoords.y = y; - sub_8093038(x, y, &eventObj->initialCoords.x, &eventObj->initialCoords.y); + SetSpritePosToMapCoords(x, y, &eventObj->initialCoords.x, &eventObj->initialCoords.y); eventObj->initialCoords.x += 8; EventObjectUpdateZCoord(eventObj); } From 562ad709151bf103a3e9ebdab9535f960f78f852 Mon Sep 17 00:00:00 2001 From: Fontbane Date: Mon, 1 Apr 2019 23:07:21 -0400 Subject: [PATCH 047/101] Removed Gen 4 Ability field effects --- src/battle_script_commands.c | 12 +----------- src/wild_encounter.c | 6 ------ 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index a3d724c0a..4563e587b 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10540,7 +10540,7 @@ static void atkE5_pickup(void) species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); level = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL); - lvlDivBy10 = (level - 1) / 10; + lvlDivBy10 = (level - 1) / 10; //Moving this here makes it easier to add in abilities like Honey Gather if (lvlDivBy10 > 9) lvlDivBy10 = 9; @@ -10572,16 +10572,6 @@ static void atkE5_pickup(void) } } } - else if (ability == ABILITY_HONEY_GATHER - && species != 0 - && species != SPECIES_EGG - && heldItem == ITEM_NONE - && (Random()%100 <= lvlDivBy10*5+5)) - { - u16 honey = ITEM_HONEY; - SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &honey); - break; - } } } diff --git a/src/wild_encounter.c b/src/wild_encounter.c index be97c73ac..b860da13e 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -487,12 +487,6 @@ static bool8 DoWildEncounterRateTest(u32 encounterRate, bool8 ignoreAbility) encounterRate *= 2; else if (ability == ABILITY_SAND_VEIL && gSaveBlock1Ptr->weather == 8) encounterRate /= 2; - else if (ability == ABILITY_SNOW_CLOAK && gSaveBlock1Ptr->weather == 4) - encounterRate /= 2; - else if (ability == ABILITY_QUICK_FEET && gSaveBlock1Ptr->weather == 8) - encounterRate /= 2; - else if (ability == ABILITY_NO_GUARD) - encounterRate = encounterRate * 150 / 100; } if (encounterRate > 2880) encounterRate = 2880; From 4be97b2dc691d5215ae402a345708b3e207ceb9f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 1 Apr 2019 18:42:57 -0400 Subject: [PATCH 048/101] through sub_801A960 --- asm/union_room_battle.s | 715 ------------------------------------ data/union_room_battle.s | 47 --- include/strings.h | 5 + include/union_room_battle.h | 6 + ld_script.txt | 2 + src/union_room.c | 2 - src/union_room_battle.c | 466 +++++++++++++++++++++++ sym_bss.txt | 1 + 8 files changed, 480 insertions(+), 764 deletions(-) create mode 100644 include/union_room_battle.h create mode 100644 src/union_room_battle.c diff --git a/asm/union_room_battle.s b/asm/union_room_battle.s index db8c62f6d..ea4e6958e 100755 --- a/asm/union_room_battle.s +++ b/asm/union_room_battle.s @@ -5,721 +5,6 @@ .text - thumb_func_start sub_801A3F4 -sub_801A3F4: @ 801A3F4 - push {lr} - bl IsDma3ManagerBusyWithBgCopy - lsls r0, 24 - cmp r0, 0 - bne _0801A414 - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade -_0801A414: - pop {r0} - bx r0 - thumb_func_end sub_801A3F4 - - thumb_func_start sub_801A418 -sub_801A418: @ 801A418 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_801A418 - - thumb_func_start sub_801A42C -sub_801A42C: @ 801A42C - push {lr} - ldr r0, =sub_801A43C - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_801A42C - - thumb_func_start sub_801A43C -sub_801A43C: @ 801A43C - push {r4,r5,lr} - sub sp, 0xC - movs r0, 0 - movs r1, 0 - bl SetGpuReg - ldr r5, =gUnknown_03000DAC - movs r0, 0x6C - bl AllocZeroed - str r0, [r5] - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082F0D34 - movs r0, 0 - movs r2, 0x2 - bl InitBgsFromTemplates - movs r4, 0x80 - lsls r4, 4 - adds r0, r4, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0x1 - bl SetBgTilemapBuffer - adds r0, r4, 0 - bl Alloc - adds r1, r0, 0 - movs r0, 0 - bl SetBgTilemapBuffer - ldr r1, =gWirelessInfoScreenGfx - movs r0, 0 - str r0, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl DecompressAndLoadBgGfxUsingHeap - ldr r1, =gWirelessInfoScreenTilemap - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - ldr r0, =gUnknown_082F0D3C - bl InitWindows - bl DeactivateAllTextPrinters - bl ResetPaletteFade - bl ResetSpriteData - bl ResetTasks - bl ScanlineEffect_Stop - bl m4aSoundVSyncOn - ldr r0, =sub_801A418 - bl SetVBlankCallback - ldr r0, =sub_801A6C0 - movs r1, 0 - bl CreateTask - ldr r1, [r5] - adds r1, 0x60 - strb r0, [r1] - bl sub_8013C40 - ldr r1, [r5] - adds r1, 0x61 - strb r0, [r1] - ldr r1, [r5] - movs r0, 0x1 - str r0, [r1, 0x1C] - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - ldr r0, =gWirelessInfoScreenPal - movs r1, 0 - movs r2, 0x20 - bl LoadPalette - movs r0, 0xF0 - bl Menu_LoadStdPalAt - bl DynamicPlaceholderTextUtil_Reset - movs r0, 0x20 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0xF - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - ldr r0, =sub_801A3F4 - bl SetMainCallback2 - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801A43C - - thumb_func_start sub_801A584 -sub_801A584: @ 801A584 - push {r4,lr} - bl FreeAllWindowBuffers - movs r4, 0 -_0801A58C: - lsls r0, r4, 24 - lsrs r0, 24 - bl GetBgTilemapBuffer - bl Free - adds r4, 0x1 - cmp r4, 0x1 - ble _0801A58C - ldr r0, =gUnknown_03000DAC - ldr r0, [r0] - bl Free - ldr r0, =CB2_ReturnToFieldContinueScriptPlayMapMusic - bl SetMainCallback2 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801A584 - - thumb_func_start sub_801A5BC -sub_801A5BC: @ 801A5BC - push {lr} - adds r2, r0, 0 - ldrh r0, [r2] - adds r0, 0x1 - strh r0, [r2] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x5 - ble _0801A5E4 - ldrh r0, [r1] - adds r0, 0x1 - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xE - bne _0801A5E0 - movs r0, 0 - strh r0, [r1] -_0801A5E0: - movs r0, 0 - strh r0, [r2] -_0801A5E4: - movs r2, 0 - ldrsh r0, [r1, r2] - adds r0, 0x2 - lsls r0, 5 - ldr r1, =gWirelessInfoScreenPal - adds r0, r1 - movs r1, 0 - movs r2, 0x10 - bl LoadPalette - pop {r0} - bx r0 - .pool - thumb_func_end sub_801A5BC - - thumb_func_start sub_801A600 -sub_801A600: @ 801A600 - push {r4,r5,lr} - sub sp, 0x8 - movs r0, 0 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x1 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x2 - movs r1, 0 - bl FillWindowPixelBuffer - ldr r5, =gUnknown_082F0D5C - ldr r4, [r5] - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0xC0 - bl GetStringCenterAlignXOffset - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x6 - str r0, [sp] - movs r0, 0x3 - str r0, [sp, 0x4] - movs r0, 0 - movs r1, 0x1 - adds r2, r4, 0 - bl sub_801A8B0 - movs r1, 0 -_0801A644: - adds r4, r1, 0x1 - lsls r0, r4, 2 - adds r0, r5 - ldr r2, [r0] - lsls r0, r1, 4 - subs r0, r1 - lsls r0, 25 - movs r1, 0x80 - lsls r1, 20 - adds r0, r1 - lsrs r0, 24 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r1, 0x1 - movs r3, 0 - bl sub_801A8B0 - adds r1, r4, 0 - cmp r4, 0x2 - ble _0801A644 - ldr r1, =gUnknown_082F0D5C - adds r0, r4, 0x1 - lsls r0, 2 - adds r0, r1 - ldr r2, [r0] - lsls r0, r4, 4 - subs r0, r4 - lsls r0, 25 - movs r1, 0x80 - lsls r1, 20 - adds r0, r1 - lsrs r0, 24 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - movs r1, 0x1 - movs r3, 0 - bl sub_801A8B0 - movs r0, 0 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0x2 - bl CopyWindowToVram - movs r0, 0x1 - bl PutWindowTilemap - movs r0, 0x1 - movs r1, 0x2 - bl CopyWindowToVram - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801A600 - - thumb_func_start sub_801A6C0 -sub_801A6C0: @ 801A6C0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r2, 0x8 - ldrsh r0, [r0, r2] - adds r2, r1, 0 - cmp r0, 0x5 - bls _0801A6E2 - b _0801A89C -_0801A6E2: - lsls r0, 2 - ldr r1, =_0801A6F4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801A6F4: - .4byte _0801A70C - .4byte _0801A728 - .4byte _0801A74C - .4byte _0801A768 - .4byte _0801A85C - .4byte _0801A884 -_0801A70C: - bl sub_801A600 - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] - b _0801A89C - .pool -_0801A728: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - movs r0, 0x1 - bl ShowBg - movs r0, 0 - bl CopyBgTilemapBufferToVram - movs r0, 0 - bl ShowBg - b _0801A86C -_0801A74C: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0801A75A - b _0801A89C -_0801A75A: - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r2 - b _0801A876 - .pool -_0801A768: - ldr r0, =gUnknown_03000DAC - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x10 - adds r2, r0, 0 - adds r2, 0x20 - adds r3, r0, 0 - adds r3, 0x61 - ldrb r3, [r3] - bl sub_801AA30 - lsls r1, r5, 2 - mov r8, r1 - cmp r0, 0 - beq _0801A7F8 - movs r0, 0x2 - movs r1, 0 - bl FillWindowPixelBuffer - movs r4, 0 - ldr r6, =gStringVar4 - movs r7, 0x80 - lsls r7, 20 -_0801A796: - ldr r0, =gUnknown_03000DAC - ldr r0, [r0] - lsls r1, r4, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r6, 0 - movs r2, 0x1 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - cmp r4, 0x3 - beq _0801A7CC - lsrs r0, r7, 24 - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r0, 0x2 - movs r1, 0x1 - adds r2, r6, 0 - movs r3, 0xC - bl sub_801A8B0 - b _0801A7DE - .pool -_0801A7CC: - movs r0, 0x62 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r1, 0x1 - adds r2, r6, 0 - movs r3, 0xC - bl sub_801A8B0 -_0801A7DE: - movs r2, 0xF0 - lsls r2, 21 - adds r7, r2 - adds r4, 0x1 - cmp r4, 0x3 - ble _0801A796 - movs r0, 0x2 - bl PutWindowTilemap - movs r0, 0x2 - movs r1, 0x3 - bl CopyWindowToVram -_0801A7F8: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0801A80C - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0801A836 -_0801A80C: - movs r0, 0x5 - bl PlaySE - ldr r2, =gTasks - ldr r0, =gUnknown_03000DAC - ldr r0, [r0] - adds r0, 0x61 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - adds r0, r2 - movs r1, 0xFF - strh r1, [r0, 0x26] - mov r0, r8 - adds r1, r0, r5 - lsls r1, 3 - adds r1, r2 - ldrh r0, [r1, 0x8] - adds r0, 0x1 - strh r0, [r1, 0x8] -_0801A836: - mov r2, r8 - adds r1, r2, r5 - lsls r1, 3 - ldr r0, =gTasks + 0x8 - adds r1, r0 - adds r0, r1, 0 - adds r0, 0xE - adds r1, 0x10 - bl sub_801A5BC - b _0801A89C - .pool -_0801A85C: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade -_0801A86C: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 -_0801A876: - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - b _0801A89C - .pool -_0801A884: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0801A89C - ldr r0, =sub_801A584 - bl SetMainCallback2 - adds r0, r5, 0 - bl DestroyTask -_0801A89C: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801A6C0 - - thumb_func_start sub_801A8B0 -sub_801A8B0: @ 801A8B0 - push {r4-r7,lr} - sub sp, 0x18 - mov r12, r2 - ldr r2, [sp, 0x2C] - ldr r4, [sp, 0x30] - lsls r0, 24 - lsrs r7, r0, 24 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r3, 24 - lsrs r5, r3, 24 - lsls r2, 24 - lsrs r3, r2, 24 - lsls r4, 24 - lsrs r0, r4, 24 - cmp r0, 0x4 - bhi _0801A93A - lsls r0, 2 - ldr r1, =_0801A8E0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801A8E0: - .4byte _0801A8F4 - .4byte _0801A902 - .4byte _0801A910 - .4byte _0801A91E - .4byte _0801A92C -_0801A8F4: - add r1, sp, 0x14 - movs r0, 0 - strb r0, [r1] - movs r0, 0x2 - strb r0, [r1, 0x1] - movs r0, 0x3 - b _0801A938 -_0801A902: - add r1, sp, 0x14 - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - strb r0, [r1, 0x1] - movs r0, 0x3 - b _0801A938 -_0801A910: - add r1, sp, 0x14 - movs r0, 0 - strb r0, [r1] - movs r0, 0x4 - strb r0, [r1, 0x1] - movs r0, 0x5 - b _0801A938 -_0801A91E: - add r1, sp, 0x14 - movs r0, 0 - strb r0, [r1] - movs r0, 0x7 - strb r0, [r1, 0x1] - movs r0, 0x6 - b _0801A938 -_0801A92C: - add r1, sp, 0x14 - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - strb r0, [r1, 0x1] - movs r0, 0x2 -_0801A938: - strb r0, [r1, 0x2] -_0801A93A: - movs r0, 0 - str r0, [sp] - str r0, [sp, 0x4] - add r0, sp, 0x14 - str r0, [sp, 0x8] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0xC] - mov r0, r12 - str r0, [sp, 0x10] - adds r0, r7, 0 - adds r1, r6, 0 - adds r2, r5, 0 - bl AddTextPrinterParameterized4 - add sp, 0x18 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_801A8B0 - - thumb_func_start sub_801A960 -sub_801A960: @ 801A960 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - mov r12, r0 - adds r7, r1, 0 - ldrb r0, [r0, 0xA] - lsls r0, 25 - lsrs r0, 25 - mov r8, r0 - movs r4, 0 - ldr r0, =gUnknown_082F0D70 - mov r9, r0 - movs r1, 0x1 - add r1, r9 - mov r10, r1 - mov r3, r12 - adds r3, 0x4 - str r3, [sp] -_0801A98A: - lsls r0, r4, 1 - adds r2, r0, r4 - mov r3, r9 - adds r1, r2, r3 - adds r5, r0, 0 - adds r6, r4, 0x1 - ldrb r1, [r1] - cmp r8, r1 - bne _0801A9EE - mov r0, r12 - ldrb r1, [r0, 0x1A] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _0801A9EE - mov r0, r9 - adds r0, 0x2 - adds r3, r2, r0 - ldrb r0, [r3] - cmp r0, 0 - bne _0801A9DC - movs r2, 0 - movs r1, 0 - ldr r3, [sp] -_0801A9BA: - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _0801A9C4 - adds r2, 0x1 -_0801A9C4: - adds r1, 0x1 - cmp r1, 0x3 - ble _0801A9BA - adds r2, 0x1 - adds r0, r5, r4 - add r0, r10 - ldrb r1, [r0] - lsls r1, 2 - adds r1, r7 - b _0801A9E8 - .pool -_0801A9DC: - mov r1, r10 - adds r0, r2, r1 - ldrb r1, [r0] - lsls r1, 2 - adds r1, r7 - ldrb r2, [r3] -_0801A9E8: - ldr r0, [r1] - adds r0, r2 - str r0, [r1] -_0801A9EE: - adds r4, r6, 0 - cmp r4, 0x1E - bls _0801A98A - mov r0, r8 - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_801A960 - thumb_func_start sub_801AA08 sub_801AA08: @ 801AA08 push {r4,lr} diff --git a/data/union_room_battle.s b/data/union_room_battle.s index 65e8d4229..65391a82e 100755 --- a/data/union_room_battle.s +++ b/data/union_room_battle.s @@ -3,53 +3,6 @@ .section .rodata - .align 2 -gWirelessInfoScreenPal:: @ 82F0790 - .incbin "graphics/interface/wireless_info_screen.gbapal" - - .align 2 -gWirelessInfoScreenGfx:: @ 82F0990 - .incbin "graphics/interface/wireless_info_screen.4bpp.lz" - - .align 2 -gWirelessInfoScreenTilemap:: @ 82F0BA0 - .incbin "graphics/interface/wireless_info_screen.bin.lz" - - .align 2 -gUnknown_082F0D34:: @ 82F0D34 - .4byte 0x000001f8 - .4byte 0x00001081 - - .align 2 -gUnknown_082F0D3C:: @ 82F0D3C - window_template 0x00, 0x03, 0x00, 0x18, 0x03, 0x0f, 0x0001 - window_template 0x00, 0x03, 0x04, 0x15, 0x0f, 0x0f, 0x0049 - window_template 0x00, 0x18, 0x04, 0x03, 0x0f, 0x0f, 0x0184 - null_window_template - - .align 2 -gUnknown_082F0D5C:: @ 82F0D5C - .4byte gText_WirelessCommStatus - .4byte gText_PeopleTrading - .4byte gText_PeopleBattling - .4byte gText_PeopleInUnionRoom - .4byte gText_PeopleCommunicating - - .align 2 -gUnknown_082F0D70:: @ 82F0D70 - .byte 0x01, 0x01, 0x02, 0x02, 0x01, 0x02, 0x03, 0x01 - .byte 0x04, 0x04, 0x00, 0x02, 0x06, 0x03, 0x02, 0x07 - .byte 0x03, 0x02, 0x09, 0x03, 0x00, 0x0a, 0x03, 0x00 - .byte 0x0b, 0x03, 0x00, 0x0c, 0xff, 0x00, 0x0d, 0x00 - .byte 0x00, 0x10, 0x03, 0x00, 0x0f, 0x03, 0x00, 0x40 - .byte 0x02, 0x01, 0x41, 0x02, 0x02, 0x44, 0x02, 0x02 - .byte 0x45, 0x02, 0x00, 0x48, 0x02, 0x02, 0x54, 0x02 - .byte 0x01, 0x53, 0x02, 0x02, 0x51, 0x02, 0x01, 0x52 - .byte 0x02, 0x01, 0x15, 0x03, 0x02, 0x16, 0x03, 0x02 - .byte 0x17, 0x03, 0x00, 0x18, 0x03, 0x00, 0x19, 0x03 - .byte 0x00, 0x1a, 0x03, 0x00, 0x1b, 0x03, 0x00, 0x1c - .byte 0x01, 0x02, 0x0e, 0x01, 0x02, 0x00, 0x00, 0x00 - .align 2 gUnknown_082F0DD0:: @ 82F0DD0 .4byte 0x000001FC diff --git a/include/strings.h b/include/strings.h index 1561da26d..99c9ce73c 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2672,5 +2672,10 @@ extern const u8 gText_CommunicationCompleted[]; extern const u8 gText_HaventReceivedGiftOkayToDiscard[]; extern const u8 gText_SendingWonderCard[]; extern const u8 gText_SendingWonderNews[]; +extern const u8 gText_WirelessCommStatus[]; +extern const u8 gText_PeopleTrading[]; +extern const u8 gText_PeopleBattling[]; +extern const u8 gText_PeopleInUnionRoom[]; +extern const u8 gText_PeopleCommunicating[]; #endif // GUARD_STRINGS_H diff --git a/include/union_room_battle.h b/include/union_room_battle.h new file mode 100644 index 000000000..1bc9d0015 --- /dev/null +++ b/include/union_room_battle.h @@ -0,0 +1,6 @@ +#ifndef GUARD_UNION_ROOM_BATTLE_H +#define GUARD_UNION_ROOM_BATTLE_H + +u8 sub_8013C40(void); + +#endif //GUARD_UNION_ROOM_BATTLE_H diff --git a/ld_script.txt b/ld_script.txt index a7bd9eaad..2b0d0dd89 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -57,6 +57,7 @@ SECTIONS { src/union_room.o(.text); src/mystery_gift.o(.text); src/union_room_player_avatar.o(.text); + src/union_room_battle.o(.text); asm/union_room_battle.o(.text); src/mevent2.o(.text); src/mevent_801BAAC.o(.text); @@ -413,6 +414,7 @@ SECTIONS { src/union_room.o(.rodata); src/mystery_gift.o(.rodata); src/union_room_player_avatar.o(.rodata); + src/union_room_battle.o(.rodata); data/union_room_battle.o(.rodata); src/mevent2.o(.rodata); src/mevent_801BAAC.o(.rodata); diff --git a/src/union_room.c b/src/union_room.c index ad33112e4..88ac65baa 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -62,8 +62,6 @@ EWRAM_DATA struct TradeUnkStruct gUnknown_02022C40 = {}; IWRAM_DATA struct UnkStruct_Leader *gUnknown_03000DA0; IWRAM_DATA struct UnkStruct_Group *gUnknown_03000DA4; IWRAM_DATA struct UnkStruct_URoom *gUnknown_03000DA8; -IWRAM_DATA void *gUnknown_03000DAC; -IWRAM_DATA bool32 gUnknown_03000DB0; // this file's functions void sub_80173E0(u8 windowId, u8 arg1, const u8 *str, u8 arg3, u8 arg4, u8 arg5); diff --git a/src/union_room_battle.c b/src/union_room_battle.c new file mode 100644 index 000000000..b571e803a --- /dev/null +++ b/src/union_room_battle.c @@ -0,0 +1,466 @@ +#include "global.h" +#include "battle.h" +#include "task.h" +#include "text.h" +#include "main.h" +#include "bg.h" +#include "palette.h" +#include "gpu_regs.h" +#include "alloc.h" +#include "menu.h" +#include "window.h" +#include "scanline_effect.h" +#include "m4a.h" +#include "dynamic_placeholder_text_util.h" +#include "overworld.h" +#include "strings.h" +#include "string_util.h" +#include "international_string_util.h" +#include "sound.h" +#include "constants/songs.h" +#include "union_room.h" +#include "union_room_battle.h" + +struct UnkStruct_3000DAC +{ + /*0x00*/ u32 unk00[4]; + /*0x10*/ u32 unk10[4]; + /*0x20*/ u32 unk20[16]; + /*0x60*/ u8 taskId; + /*0x61*/ u8 unk61; + /*0x62*/ u8 filler_62[10]; +}; + +IWRAM_DATA struct UnkStruct_3000DAC * gUnknown_03000DAC; +IWRAM_DATA bool32 gUnknown_03000DB0; + +void sub_801A43C(void); +void sub_801A6C0(u8 taskId); +static void sub_801A8B0(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 mode); +bool32 sub_801AA30(u32 * a0, u32 * a1, u32 * a2, u8 a3); + +const u16 gWirelessInfoScreenPal[] = INCBIN_U16("graphics/interface/wireless_info_screen.gbapal"); +const u32 gWirelessInfoScreenGfx[] = INCBIN_U32("graphics/interface/wireless_info_screen.4bpp.lz"); +const u32 gWirelessInfoScreenTilemap[] = INCBIN_U32("graphics/interface/wireless_info_screen.bin.lz"); + +const struct BgTemplate gUnknown_082F0D34[] = { + { + .bg = 0, + .charBaseIndex = 2, + .mapBaseIndex = 0x1F, + .priority = 0 + }, { + .bg = 1, + .charBaseIndex = 0, + .mapBaseIndex = 0x08, + .priority = 1 + } +}; + +const struct WindowTemplate gUnknown_082F0D3C[] = { + { + .bg = 0x00, + .tilemapLeft = 0x03, + .tilemapTop = 0x00, + .width = 0x18, + .height = 0x03, + .paletteNum = 0x0f, + .baseBlock = 0x0001 + }, { + .bg = 0x00, + .tilemapLeft = 0x03, + .tilemapTop = 0x04, + .width = 0x15, + .height = 0x0f, + .paletteNum = 0x0f, + .baseBlock = 0x0049 + }, { + .bg = 0x00, + .tilemapLeft = 0x18, + .tilemapTop = 0x04, + .width = 0x03, + .height = 0x0f, + .paletteNum = 0x0f, + .baseBlock = 0x0184 + }, + { 0xFF } +}; + +const u8 *const gUnknown_082F0D5C[] = { + gText_WirelessCommStatus, + gText_PeopleTrading, + gText_PeopleBattling, + gText_PeopleInUnionRoom, + gText_PeopleCommunicating +}; + +const u8 gUnknown_082F0D70[][3] = { + {0x01, 0x01, 0x02}, + {0x02, 0x01, 0x02}, + {0x03, 0x01, 0x04}, + {0x04, 0x00, 0x02}, + {0x06, 0x03, 0x02}, + {0x07, 0x03, 0x02}, + {0x09, 0x03, 0x00}, + {0x0a, 0x03, 0x00}, + {0x0b, 0x03, 0x00}, + {0x0c, 0xff, 0x00}, + {0x0d, 0x00, 0x00}, + {0x10, 0x03, 0x00}, + {0x0f, 0x03, 0x00}, + {0x40, 0x02, 0x01}, + {0x41, 0x02, 0x02}, + {0x44, 0x02, 0x02}, + {0x45, 0x02, 0x00}, + {0x48, 0x02, 0x02}, + {0x54, 0x02, 0x01}, + {0x53, 0x02, 0x02}, + {0x51, 0x02, 0x01}, + {0x52, 0x02, 0x01}, + {0x15, 0x03, 0x02}, + {0x16, 0x03, 0x02}, + {0x17, 0x03, 0x00}, + {0x18, 0x03, 0x00}, + {0x19, 0x03, 0x00}, + {0x1a, 0x03, 0x00}, + {0x1b, 0x03, 0x00}, + {0x1c, 0x01, 0x02}, + {0x0e, 0x01, 0x02} +}; + +void sub_801A3F4(void) +{ + if (!IsDma3ManagerBusyWithBgCopy()) + { + RunTasks(); + RunTextPrinters(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); + } +} + +void sub_801A418(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +void sub_801A42C(void) +{ + SetMainCallback2(sub_801A43C); +} + +void sub_801A43C(void) +{ + SetGpuReg(REG_OFFSET_DISPCNT, 0x0000); + gUnknown_03000DAC = AllocZeroed(sizeof(struct UnkStruct_3000DAC)); + SetVBlankCallback(NULL); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_082F0D34, ARRAY_COUNT(gUnknown_082F0D34)); + SetBgTilemapBuffer(1, Alloc(0x800)); + SetBgTilemapBuffer(0, Alloc(0x800)); + DecompressAndLoadBgGfxUsingHeap(1, gWirelessInfoScreenGfx, 0, 0, 0); + CopyToBgTilemapBuffer(1, gWirelessInfoScreenTilemap, 0, 0); + InitWindows(gUnknown_082F0D3C); + DeactivateAllTextPrinters(); + ResetPaletteFade(); + ResetSpriteData(); + ResetTasks(); + ScanlineEffect_Stop(); + m4aSoundVSyncOn(); + SetVBlankCallback(sub_801A418); + gUnknown_03000DAC->taskId = CreateTask(sub_801A6C0, 0); + gUnknown_03000DAC->unk61 = sub_8013C40(); + gUnknown_03000DAC->unk10[3] = 1; + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + LoadPalette(gWirelessInfoScreenPal, 0x00, 0x20); + Menu_LoadStdPalAt(0xF0); + DynamicPlaceholderTextUtil_Reset(); + FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0x0F); + CopyBgTilemapBufferToVram(1); + SetMainCallback2(sub_801A3F4); + RunTasks(); + RunTextPrinters(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +void sub_801A584(void) +{ + s32 i; + FreeAllWindowBuffers(); + for (i = 0; i < 2; i++) + { + Free(GetBgTilemapBuffer(i)); + } + Free(gUnknown_03000DAC); + SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic); +} + +void sub_801A5BC(s16 * a0, s16 * a1) +{ + if (++(*a0) > 5) + { + if (++(*a1) == 14) + { + *a1 = 0; + } + *a0 = 0; + } + LoadPalette(gWirelessInfoScreenPal + 16 * (*a1 + 2), 0, 0x10); +} + +void sub_801A600(void) +{ + s32 i; + FillWindowPixelBuffer(0, 0); + FillWindowPixelBuffer(1, 0); + FillWindowPixelBuffer(2, 0); + sub_801A8B0(0, 1, gUnknown_082F0D5C[0], GetStringCenterAlignXOffset(1, gUnknown_082F0D5C[0], 0xC0), 6, 3); + for (i = 0; i < 3; i++) + { + sub_801A8B0(1, 1, gUnknown_082F0D5C[i + 1], 0, 30 * i + 8, 1); + } + sub_801A8B0(1, 1, gUnknown_082F0D5C[i + 1], 0, 30 * i + 8, 2); + PutWindowTilemap(0); + CopyWindowToVram(0, 2); + PutWindowTilemap(1); + CopyWindowToVram(1, 2); +} + +void sub_801A6C0(u8 taskId) +{ + s32 i; + switch (gTasks[taskId].data[0]) + { + case 0: + sub_801A600(); + gTasks[taskId].data[0]++; + break; + case 1: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); + ShowBg(1); + CopyBgTilemapBufferToVram(0); + ShowBg(0); + gTasks[taskId].data[0]++; + break; + case 2: + if (!gPaletteFade.active) + { + gTasks[taskId].data[0]++; + } + break; + case 3: + if (sub_801AA30(gUnknown_03000DAC->unk00, gUnknown_03000DAC->unk10, gUnknown_03000DAC->unk20, gUnknown_03000DAC->unk61)) + { + FillWindowPixelBuffer(2, 0); + for (i = 0; i < 4; i++) + { + ConvertIntToDecimalStringN(gStringVar4, gUnknown_03000DAC->unk00[i], STR_CONV_MODE_RIGHT_ALIGN, 2); + if (i != 3) + { + sub_801A8B0(2, 1, gStringVar4, 12, 30 * i + 8, 1); + } + else + { + sub_801A8B0(2, 1, gStringVar4, 12, 98, 2); + } + } + PutWindowTilemap(2); + CopyWindowToVram(2, 3); + } + if (({gMain.newKeys & A_BUTTON;}) || ({gMain.newKeys & B_BUTTON;})) + { + PlaySE(SE_SELECT); + gTasks[gUnknown_03000DAC->unk61].data[15] = 0xFF; + gTasks[taskId].data[0]++; + } + sub_801A5BC(&gTasks[taskId].data[7], &gTasks[taskId].data[8]); + break; + case 4: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); + gTasks[taskId].data[0]++; + break; + case 5: + if (!gPaletteFade.active) + { + SetMainCallback2(sub_801A584); + DestroyTask(taskId); + } + break; + } +} + +static void sub_801A8B0(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 mode) +{ + u8 color[3]; + + switch (mode) + { + case 0: + color[0] = 0; + color[1] = 2; + color[2] = 3; + break; + case 1: + color[0] = 0; + color[1] = 1; + color[2] = 3; + break; + case 2: + color[0] = 0; + color[1] = 4; + color[2] = 5; + break; + case 3: + color[0] = 0; + color[1] = 7; + color[2] = 6; + break; + case 4: + color[0] = 0; + color[1] = 1; + color[2] = 2; + break; + } + + AddTextPrinterParameterized4(windowId, fontId, x, y, 0, 0, color, -1, str); +} + +#ifdef NONMATCHING +// register swap r2, r3 +u8 sub_801A960(struct UnkStruct_x20 * a0, u32 * a1) +{ + s32 i, j, r2; + u8 result = a0->unk.field_0.unk_0a_0; + + for (i = 0; i < (unsigned)ARRAY_COUNT(gUnknown_082F0D70); i++) + { + if (result != gUnknown_082F0D70[i][0]) + { + continue; + } + if (a0->field_1A_0 != 1) + { + continue; + } + if (gUnknown_082F0D70[i][2] == 0) + { + r2 = 0; + for (j = 0; j < 4; j++) + { + if (a0->unk.field_0.unk_04[j] != 0) + { + r2++; + } + } + r2++; + a1[gUnknown_082F0D70[i][1]] += r2; + } + else + { + a1[gUnknown_082F0D70[i][1]] += gUnknown_082F0D70[i][2]; + } + } + return result; +} +#else +NAKED +u8 sub_801A960(struct UnkStruct_x20 * a0, u32 * a1) +{ + asm_unified("\tpush {r4-r7,lr}\n" + "\tmov r7, r10\n" + "\tmov r6, r9\n" + "\tmov r5, r8\n" + "\tpush {r5-r7}\n" + "\tsub sp, 0x4\n" + "\tmov r12, r0\n" + "\tadds r7, r1, 0\n" + "\tldrb r0, [r0, 0xA]\n" + "\tlsls r0, 25\n" + "\tlsrs r0, 25\n" + "\tmov r8, r0\n" + "\tmovs r4, 0\n" + "\tldr r0, =gUnknown_082F0D70\n" + "\tmov r9, r0\n" + "\tmovs r1, 0x1\n" + "\tadd r1, r9\n" + "\tmov r10, r1\n" + "\tmov r3, r12\n" + "\tadds r3, 0x4\n" + "\tstr r3, [sp]\n" + "_0801A98A:\n" + "\tlsls r0, r4, 1\n" + "\tadds r2, r0, r4\n" + "\tmov r3, r9\n" + "\tadds r1, r2, r3\n" + "\tadds r5, r0, 0\n" + "\tadds r6, r4, 0x1\n" + "\tldrb r1, [r1]\n" + "\tcmp r8, r1\n" + "\tbne _0801A9EE\n" + "\tmov r0, r12\n" + "\tldrb r1, [r0, 0x1A]\n" + "\tmovs r0, 0x3\n" + "\tands r0, r1\n" + "\tcmp r0, 0x1\n" + "\tbne _0801A9EE\n" + "\tmov r0, r9\n" + "\tadds r0, 0x2\n" + "\tadds r3, r2, r0\n" + "\tldrb r0, [r3]\n" + "\tcmp r0, 0\n" + "\tbne _0801A9DC\n" + "\tmovs r2, 0\n" + "\tmovs r1, 0\n" + "\tldr r3, [sp]\n" + "_0801A9BA:\n" + "\tadds r0, r3, r1\n" + "\tldrb r0, [r0]\n" + "\tcmp r0, 0\n" + "\tbeq _0801A9C4\n" + "\tadds r2, 0x1\n" + "_0801A9C4:\n" + "\tadds r1, 0x1\n" + "\tcmp r1, 0x3\n" + "\tble _0801A9BA\n" + "\tadds r2, 0x1\n" + "\tadds r0, r5, r4\n" + "\tadd r0, r10\n" + "\tldrb r1, [r0]\n" + "\tlsls r1, 2\n" + "\tadds r1, r7\n" + "\tb _0801A9E8\n" + "\t.pool\n" + "_0801A9DC:\n" + "\tmov r1, r10\n" + "\tadds r0, r2, r1\n" + "\tldrb r1, [r0]\n" + "\tlsls r1, 2\n" + "\tadds r1, r7\n" + "\tldrb r2, [r3]\n" + "_0801A9E8:\n" + "\tldr r0, [r1]\n" + "\tadds r0, r2\n" + "\tstr r0, [r1]\n" + "_0801A9EE:\n" + "\tadds r4, r6, 0\n" + "\tcmp r4, 0x1E\n" + "\tbls _0801A98A\n" + "\tmov r0, r8\n" + "\tadd sp, 0x4\n" + "\tpop {r3-r5}\n" + "\tmov r8, r3\n" + "\tmov r9, r4\n" + "\tmov r10, r5\n" + "\tpop {r4-r7}\n" + "\tpop {r1}\n" + "\tbx r1"); +} +#endif //NONMATCHING diff --git a/sym_bss.txt b/sym_bss.txt index 1eef0130b..06b48c1f9 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -8,6 +8,7 @@ .include "src/link.o" .include "src/link_rfu.o" .include "src/union_room.o" + .include "src/union_room_battle.o" .include "src/rtc.o" .include "src/main_menu.o" .include "src/rom_8034C54.o" From 7571969a458fefcfa242acdd4a38dce134897977 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Mon, 1 Apr 2019 22:30:30 -0400 Subject: [PATCH 049/101] Finish union room battle --- asm/union_room_battle.s | 636 ---------------------------------- data/union_room_battle.s | 17 - include/constants/game_stat.h | 2 +- include/main.h | 2 +- include/strings.h | 3 + include/union_room_battle.h | 1 + ld_script.txt | 2 - src/mauville_old_man.c | 2 +- src/union_room.c | 2 +- src/union_room_battle.c | 359 +++++++++++++------ sym_ewram.txt | 5 +- 11 files changed, 271 insertions(+), 760 deletions(-) delete mode 100755 asm/union_room_battle.s delete mode 100755 data/union_room_battle.s diff --git a/asm/union_room_battle.s b/asm/union_room_battle.s deleted file mode 100755 index ea4e6958e..000000000 --- a/asm/union_room_battle.s +++ /dev/null @@ -1,636 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_801AA08 -sub_801AA08: @ 801AA08 - push {r4,lr} - movs r4, 0 - adds r3, r1, 0 - adds r2, r0, 0 -_0801AA10: - ldr r1, [r2] - ldr r0, [r3] - cmp r1, r0 - beq _0801AA1C - movs r0, 0x1 - b _0801AA28 -_0801AA1C: - adds r3, 0x4 - adds r2, 0x4 - adds r4, 0x1 - cmp r4, 0x3 - ble _0801AA10 - movs r0, 0 -_0801AA28: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801AA08 - - thumb_func_start sub_801AA30 -sub_801AA30: @ 801AA30 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x10 - adds r6, r0, 0 - mov r9, r1 - adds r5, r2, 0 - lsls r4, r3, 24 - lsrs r4, 24 - movs r0, 0 - mov r8, r0 - mov r0, sp - movs r1, 0 - movs r2, 0x10 - bl memset - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r7, r0, r1 - movs r4, 0 -_0801AA5E: - lsls r1, r4, 5 - ldr r0, [r7] - adds r0, r1 - mov r1, sp - bl sub_801A960 - adds r1, r0, 0 - ldr r0, [r5] - cmp r1, r0 - beq _0801AA78 - str r1, [r5] - movs r2, 0x1 - mov r8, r2 -_0801AA78: - adds r5, 0x4 - adds r4, 0x1 - cmp r4, 0xF - ble _0801AA5E - mov r0, sp - mov r1, r9 - bl sub_801AA08 - cmp r0, 0 - bne _0801AA9C - mov r3, r8 - cmp r3, 0x1 - beq _0801AAC4 - movs r0, 0 - b _0801AAC6 - .pool -_0801AA9C: - adds r1, r6, 0 - mov r0, sp - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldr r0, [r0] - str r0, [r1] - mov r1, r9 - mov r0, sp - ldm r0!, {r2-r4} - stm r1!, {r2-r4} - ldr r0, [r0] - str r0, [r1] - ldr r0, [r6] - ldr r1, [r6, 0x4] - adds r0, r1 - ldr r1, [r6, 0x8] - adds r0, r1 - ldr r1, [r6, 0xC] - adds r0, r1 - str r0, [r6, 0xC] -_0801AAC4: - movs r0, 0x1 -_0801AAC6: - add sp, 0x10 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_801AA30 - - thumb_func_start sub_801AAD4 -sub_801AAD4: @ 801AAD4 - push {r4-r7,lr} - movs r0, 0xA - bl sub_8014210 - movs r4, 0 - movs r7, 0x64 - ldr r6, =gPlayerParty - ldr r5, =gEnemyParty -_0801AAE4: - ldr r0, =gSelectedOrderFromParty - adds r0, r4, r0 - ldrb r0, [r0] - subs r0, 0x1 - adds r1, r0, 0 - muls r1, r7 - adds r1, r6 - adds r0, r5, 0 - movs r2, 0x64 - bl memcpy - adds r5, 0x64 - adds r4, 0x1 - cmp r4, 0x1 - ble _0801AAE4 - ldr r4, =gPlayerParty - movs r0, 0xFA - lsls r0, 1 - adds r5, r4, r0 -_0801AB0A: - adds r0, r4, 0 - bl ZeroMonData - adds r4, 0x64 - cmp r4, r5 - ble _0801AB0A - ldr r4, =gPlayerParty - movs r5, 0 - adds r6, r4, 0 - adds r6, 0x64 -_0801AB1E: - ldr r1, =gEnemyParty - adds r1, r5, r1 - adds r0, r4, 0 - movs r2, 0x64 - bl memcpy - adds r4, 0x64 - adds r5, 0x64 - cmp r4, r6 - ble _0801AB1E - movs r0, 0x32 - bl IncrementGameStat - bl CalculatePlayerPartyCount - ldr r0, =gTrainerBattleOpponent_A - movs r2, 0xC0 - lsls r2, 4 - adds r1, r2, 0 - strh r1, [r0] - ldr r0, =CB2_InitBattle - bl SetMainCallback2 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801AAD4 - - thumb_func_start sub_801AB68 -sub_801AB68: @ 801AB68 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - adds r5, r0, 0 - adds r7, r1, 0 - adds r6, r2, 0 - ldr r4, [sp, 0x38] - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0 - mov r9, r0 - movs r1, 0x1 - mov r10, r1 - ldr r0, =gUnknown_082F0DE4 - mov r8, r0 - ldrb r0, [r0] - lsls r1, r0, 4 - orrs r1, r0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - str r3, [sp, 0x14] - bl FillWindowPixelBuffer - mov r1, r9 - str r1, [sp] - mov r0, r10 - str r0, [sp, 0x4] - mov r1, r8 - str r1, [sp, 0x8] - lsls r4, 24 - asrs r4, 24 - str r4, [sp, 0xC] - str r7, [sp, 0x10] - adds r0, r5, 0 - movs r1, 0x1 - adds r2, r6, 0 - ldr r3, [sp, 0x14] - bl AddTextPrinterParameterized4 - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801AB68 - - thumb_func_start sub_801ABDC -sub_801ABDC: @ 801ABDC - push {r4-r6,lr} - sub sp, 0x4 - adds r4, r0, 0 - adds r6, r1, 0 - adds r5, r2, 0 - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _0801ABF4 - cmp r0, 0x1 - beq _0801AC22 - b _0801AC36 -_0801ABF4: - movs r0, 0 - movs r1, 0x1 - movs r2, 0xD - bl DrawTextBorderOuter - str r5, [sp] - movs r0, 0 - adds r1, r6, 0 - movs r2, 0 - movs r3, 0x1 - bl sub_801AB68 - movs r0, 0 - bl PutWindowTilemap - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - ldrh r0, [r4] - adds r0, 0x1 - strh r0, [r4] - b _0801AC36 -_0801AC22: - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0 - bne _0801AC36 - strh r0, [r4] - movs r0, 0x1 - b _0801AC38 -_0801AC36: - movs r0, 0 -_0801AC38: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801ABDC - - thumb_func_start sub_801AC40 -sub_801AC40: @ 801AC40 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_801AC40 - - thumb_func_start sub_801AC54 -sub_801AC54: @ 801AC54 - push {r4,lr} - sub sp, 0xC - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r1, r2 - ldrb r0, [r0] - adds r2, r1, 0 - cmp r0, 0x33 - bls _0801AC6A - b _0801AFAE -_0801AC6A: - lsls r0, 2 - ldr r1, =_0801AC7C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801AC7C: - .4byte _0801AD4C - .4byte _0801ADFC - .4byte _0801AE24 - .4byte _0801AE48 - .4byte _0801AE98 - .4byte _0801AFAE - .4byte _0801AF7C - .4byte _0801AF58 - .4byte _0801AF7C - .4byte _0801AF98 - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AFAE - .4byte _0801AF24 - .4byte _0801AF40 -_0801AD4C: - movs r0, 0 - movs r1, 0 - bl SetGpuReg - ldr r4, =gUnknown_02022C6C - movs r0, 0x4 - bl AllocZeroed - str r0, [r4] - bl ResetSpriteData - bl FreeAllSpritePalettes - bl ResetTasks - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_082F0DD0 - movs r0, 0 - movs r2, 0x1 - bl InitBgsFromTemplates - bl reset_temp_tile_data_buffers - ldr r0, =gUnknown_082F0DD4 - bl InitWindows - lsls r0, 16 - cmp r0, 0 - bne _0801AD8C - b _0801AFC2 -_0801AD8C: - bl DeactivateAllTextPrinters - movs r0, 0 - bl ClearWindowTilemap - movs r0, 0 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r0, 0x1E - str r0, [sp] - movs r0, 0x14 - str r0, [sp, 0x4] - movs r0, 0xF - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0 - movs r1, 0x1 - movs r2, 0xD0 - bl LoadUserWindowBorderGfx - movs r0, 0 - movs r1, 0x1 - movs r2, 0xD0 - bl LoadUserWindowBorderGfx_ - bl sub_819789C - ldr r0, =sub_801AC40 - bl SetVBlankCallback - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _0801AF8A - .pool -_0801ADFC: - ldr r0, =gUnknown_02022C6C - ldr r0, [r0] - ldr r1, =gText_CommStandbyAwaitingOtherPlayer - movs r2, 0 - bl sub_801ABDC - cmp r0, 0 - bne _0801AE0E - b _0801AFAE -_0801AE0E: - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _0801AF8A - .pool -_0801AE24: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - movs r0, 0 - bl ShowBg - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _0801AF8A - .pool -_0801AE48: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - beq _0801AE54 - b _0801AFAE -_0801AE54: - ldr r4, =gBlockSendBuffer - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x20 - bl memset - ldr r0, =gSelectedOrderFromParty - ldrb r1, [r0] - ldrb r0, [r0, 0x1] - cmn r1, r0 - bne _0801AE78 - movs r0, 0x52 - b _0801AE7A - .pool -_0801AE78: - movs r0, 0x51 -_0801AE7A: - strb r0, [r4] - ldr r1, =gBlockSendBuffer - movs r0, 0 - movs r2, 0x20 - bl SendBlock - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _0801AF8A - .pool -_0801AE98: - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - beq _0801AEA6 - b _0801AFAE -_0801AEA6: - ldr r1, =gBlockRecvBuffer - ldrh r0, [r1] - cmp r0, 0x51 - bne _0801AEE0 - movs r2, 0x80 - lsls r2, 1 - adds r0, r1, r2 - ldrh r0, [r0] - cmp r0, 0x51 - bne _0801AEE0 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - movs r1, 0x32 - b _0801AF16 - .pool -_0801AEE0: - bl sub_800AC34 - ldr r4, =gBlockRecvBuffer - bl GetMultiplayerId - lsls r0, 24 - lsrs r0, 16 - adds r0, r4 - ldrh r0, [r0] - cmp r0, 0x52 - bne _0801AF0C - ldr r0, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r2 - movs r1, 0x6 - b _0801AF16 - .pool -_0801AF0C: - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - movs r1, 0x8 -_0801AF16: - strb r1, [r0] - bl ResetBlockReceivedFlags - b _0801AFAE - .pool -_0801AF24: - bl UpdatePaletteFade - lsls r0, 24 - cmp r0, 0 - bne _0801AFAE - bl sub_800ADF8 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - b _0801AF8A - .pool -_0801AF40: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _0801AFAE - ldr r0, =sub_801AAD4 - bl SetMainCallback2 - b _0801AFAE - .pool -_0801AF58: - ldr r0, =gUnknown_02022C6C - ldr r0, [r0] - ldr r1, =gText_RefusedBattle - movs r2, 0x1 - bl sub_801ABDC - cmp r0, 0 - beq _0801AFAE - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 - b _0801AFAE - .pool -_0801AF7C: - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - bne _0801AFAE - movs r0, 0x87 - lsls r0, 3 - adds r1, r2, r0 -_0801AF8A: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0801AFAE - .pool -_0801AF98: - ldr r0, =gUnknown_02022C6C - ldr r0, [r0] - ldr r1, =gText_BattleWasRefused - movs r2, 0x1 - bl sub_801ABDC - cmp r0, 0 - beq _0801AFAE - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 -_0801AFAE: - bl RunTasks - bl RunTextPrinters - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade -_0801AFC2: - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801AC54 diff --git a/data/union_room_battle.s b/data/union_room_battle.s deleted file mode 100755 index 65391a82e..000000000 --- a/data/union_room_battle.s +++ /dev/null @@ -1,17 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_082F0DD0:: @ 82F0DD0 - .4byte 0x000001FC - - .align 2 -gUnknown_082F0DD4:: @ 82F0DD4 - window_template 0x00, 0x03, 0x0f, 0x18, 0x04, 0x0e, 0x0014 - null_window_template - - .align 2 -gUnknown_082F0DE4:: @ 82F0DE4 - .byte 0x01, 0x02, 0x03 diff --git a/include/constants/game_stat.h b/include/constants/game_stat.h index 7ebf3501b..e302f1345 100644 --- a/include/constants/game_stat.h +++ b/include/constants/game_stat.h @@ -51,7 +51,7 @@ #define GAME_STAT_USED_DAYCARE 47 #define GAME_STAT_RODE_CABLE_CAR 48 #define GAME_STAT_ENTERED_HOT_SPRINGS 49 -#define GAME_STAT_50 50 +#define GAME_STAT_NUM_UNION_ROOM_BATTLES 50 #define GAME_STAT_51 51 #define NUM_USED_GAME_STATS 52 diff --git a/include/main.h b/include/main.h index 6c67fbe9f..16ac31df2 100644 --- a/include/main.h +++ b/include/main.h @@ -71,6 +71,6 @@ void RestoreSerialTimer3IntrHandlers(void); void StartTimer1(void); void SeedRngAndSetTrainerId(void); u16 GetGeneratedTrainerIdLower(void); - +void sub_819789C(void); #endif // GUARD_MAIN_H diff --git a/include/strings.h b/include/strings.h index 99c9ce73c..8aa296eb1 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2677,5 +2677,8 @@ extern const u8 gText_PeopleTrading[]; extern const u8 gText_PeopleBattling[]; extern const u8 gText_PeopleInUnionRoom[]; extern const u8 gText_PeopleCommunicating[]; +extern const u8 gText_CommStandbyAwaitingOtherPlayer[]; +extern const u8 gText_RefusedBattle[]; +extern const u8 gText_BattleWasRefused[]; #endif // GUARD_STRINGS_H diff --git a/include/union_room_battle.h b/include/union_room_battle.h index 1bc9d0015..2f5086008 100644 --- a/include/union_room_battle.h +++ b/include/union_room_battle.h @@ -2,5 +2,6 @@ #define GUARD_UNION_ROOM_BATTLE_H u8 sub_8013C40(void); +void sub_8014210(u16 battleFlags); #endif //GUARD_UNION_ROOM_BATTLE_H diff --git a/ld_script.txt b/ld_script.txt index 2b0d0dd89..619abfce1 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -58,7 +58,6 @@ SECTIONS { src/mystery_gift.o(.text); src/union_room_player_avatar.o(.text); src/union_room_battle.o(.text); - asm/union_room_battle.o(.text); src/mevent2.o(.text); src/mevent_801BAAC.o(.text); asm/mevent_server.o(.text); @@ -415,7 +414,6 @@ SECTIONS { src/mystery_gift.o(.rodata); src/union_room_player_avatar.o(.rodata); src/union_room_battle.o(.rodata); - data/union_room_battle.o(.rodata); src/mevent2.o(.rodata); src/mevent_801BAAC.o(.rodata); data/mevent_server.o(.rodata); diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index ec5cb238b..ddd3f931e 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -914,7 +914,7 @@ struct Story }; static const struct Story sStorytellerStories[] = { - {GAME_STAT_50, 1, MauvilleCity_PokemonCenter_1F_Text_28E930, MauvilleCity_PokemonCenter_1F_Text_28E947, MauvilleCity_PokemonCenter_1F_Text_28E956}, + {GAME_STAT_NUM_UNION_ROOM_BATTLES, 1, MauvilleCity_PokemonCenter_1F_Text_28E930, MauvilleCity_PokemonCenter_1F_Text_28E947, MauvilleCity_PokemonCenter_1F_Text_28E956}, {GAME_STAT_STARTED_TRENDS, 1, MauvilleCity_PokemonCenter_1F_Text_28E9D7, MauvilleCity_PokemonCenter_1F_Text_28E9EF, MauvilleCity_PokemonCenter_1F_Text_28E9FE}, {GAME_STAT_PLANTED_BERRIES, 1, MauvilleCity_PokemonCenter_1F_Text_28EA7D, MauvilleCity_PokemonCenter_1F_Text_28EA98, MauvilleCity_PokemonCenter_1F_Text_28EAA8}, {GAME_STAT_TRADED_BIKES, 1, MauvilleCity_PokemonCenter_1F_Text_28EB19, MauvilleCity_PokemonCenter_1F_Text_28EB31, MauvilleCity_PokemonCenter_1F_Text_28EB3E}, diff --git a/src/union_room.c b/src/union_room.c index 88ac65baa..ea3658903 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -2332,7 +2332,7 @@ void sub_8013F90(u8 taskId) if (GetBlockReceivedStatus() == 3) { gEnemyParty[0] = *(struct Pokemon*)(gBlockRecvBuffer[GetMultiplayerId() ^ 1]); - IncrementGameStat(GAME_STAT_50); + IncrementGameStat(GAME_STAT_NUM_UNION_ROOM_BATTLES); ResetBlockReceivedFlags(); gTasks[taskId].data[0]++; } diff --git a/src/union_room_battle.c b/src/union_room_battle.c index b571e803a..9d9f9dcf3 100644 --- a/src/union_room_battle.c +++ b/src/union_room_battle.c @@ -9,6 +9,7 @@ #include "alloc.h" #include "menu.h" #include "window.h" +#include "text_window.h" #include "scanline_effect.h" #include "m4a.h" #include "dynamic_placeholder_text_util.h" @@ -18,6 +19,9 @@ #include "international_string_util.h" #include "sound.h" #include "constants/songs.h" +#include "party_menu.h" +#include "battle_setup.h" +#include "link.h" #include "union_room.h" #include "union_room_battle.h" @@ -31,13 +35,20 @@ struct UnkStruct_3000DAC /*0x62*/ u8 filler_62[10]; }; +struct UnkStruct_2022C6C +{ + s16 a0; +}; + IWRAM_DATA struct UnkStruct_3000DAC * gUnknown_03000DAC; IWRAM_DATA bool32 gUnknown_03000DB0; +EWRAM_DATA struct UnkStruct_2022C6C * gUnknown_02022C6C = NULL; + void sub_801A43C(void); void sub_801A6C0(u8 taskId); static void sub_801A8B0(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 mode); -bool32 sub_801AA30(u32 * a0, u32 * a1, u32 * a2, u8 a3); +bool32 sub_801AA30(u32 * a0, u32 * a1, u32 * a2, u8 taskId); const u16 gWirelessInfoScreenPal[] = INCBIN_U16("graphics/interface/wireless_info_screen.gbapal"); const u32 gWirelessInfoScreenGfx[] = INCBIN_U32("graphics/interface/wireless_info_screen.4bpp.lz"); @@ -128,6 +139,29 @@ const u8 gUnknown_082F0D70[][3] = { {0x0e, 0x01, 0x02} }; +const struct BgTemplate gUnknown_082F0DD0[] = { + { + .bg = 0, + .charBaseIndex = 3, + .mapBaseIndex = 31 + } +}; + +const struct WindowTemplate gUnknown_082F0DD4[] = { + { + .bg = 0, + .tilemapLeft = 3, + .tilemapTop = 15, + .width = 24, + .height = 4, + .paletteNum = 0xE, + .baseBlock = 0x014 + }, + { 0xFF } +}; + +const u8 gUnknown_082F0DE4[] = { 1, 2, 3 }; + void sub_801A3F4(void) { if (!IsDma3ManagerBusyWithBgCopy()) @@ -333,12 +367,10 @@ static void sub_801A8B0(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 m AddTextPrinterParameterized4(windowId, fontId, x, y, 0, 0, color, -1, str); } -#ifdef NONMATCHING -// register swap r2, r3 -u8 sub_801A960(struct UnkStruct_x20 * a0, u32 * a1) +u32 sub_801A960(struct UnkStruct_x20 * a0, u32 * a1) { s32 i, j, r2; - u8 result = a0->unk.field_0.unk_0a_0; + u32 result = a0->unk.field_0.unk_0a_0; for (i = 0; i < (unsigned)ARRAY_COUNT(gUnknown_082F0D70); i++) { @@ -370,97 +402,230 @@ u8 sub_801A960(struct UnkStruct_x20 * a0, u32 * a1) } return result; } -#else -NAKED -u8 sub_801A960(struct UnkStruct_x20 * a0, u32 * a1) + +bool32 sub_801AA08(u32 * a0, u32 * a1) { - asm_unified("\tpush {r4-r7,lr}\n" - "\tmov r7, r10\n" - "\tmov r6, r9\n" - "\tmov r5, r8\n" - "\tpush {r5-r7}\n" - "\tsub sp, 0x4\n" - "\tmov r12, r0\n" - "\tadds r7, r1, 0\n" - "\tldrb r0, [r0, 0xA]\n" - "\tlsls r0, 25\n" - "\tlsrs r0, 25\n" - "\tmov r8, r0\n" - "\tmovs r4, 0\n" - "\tldr r0, =gUnknown_082F0D70\n" - "\tmov r9, r0\n" - "\tmovs r1, 0x1\n" - "\tadd r1, r9\n" - "\tmov r10, r1\n" - "\tmov r3, r12\n" - "\tadds r3, 0x4\n" - "\tstr r3, [sp]\n" - "_0801A98A:\n" - "\tlsls r0, r4, 1\n" - "\tadds r2, r0, r4\n" - "\tmov r3, r9\n" - "\tadds r1, r2, r3\n" - "\tadds r5, r0, 0\n" - "\tadds r6, r4, 0x1\n" - "\tldrb r1, [r1]\n" - "\tcmp r8, r1\n" - "\tbne _0801A9EE\n" - "\tmov r0, r12\n" - "\tldrb r1, [r0, 0x1A]\n" - "\tmovs r0, 0x3\n" - "\tands r0, r1\n" - "\tcmp r0, 0x1\n" - "\tbne _0801A9EE\n" - "\tmov r0, r9\n" - "\tadds r0, 0x2\n" - "\tadds r3, r2, r0\n" - "\tldrb r0, [r3]\n" - "\tcmp r0, 0\n" - "\tbne _0801A9DC\n" - "\tmovs r2, 0\n" - "\tmovs r1, 0\n" - "\tldr r3, [sp]\n" - "_0801A9BA:\n" - "\tadds r0, r3, r1\n" - "\tldrb r0, [r0]\n" - "\tcmp r0, 0\n" - "\tbeq _0801A9C4\n" - "\tadds r2, 0x1\n" - "_0801A9C4:\n" - "\tadds r1, 0x1\n" - "\tcmp r1, 0x3\n" - "\tble _0801A9BA\n" - "\tadds r2, 0x1\n" - "\tadds r0, r5, r4\n" - "\tadd r0, r10\n" - "\tldrb r1, [r0]\n" - "\tlsls r1, 2\n" - "\tadds r1, r7\n" - "\tb _0801A9E8\n" - "\t.pool\n" - "_0801A9DC:\n" - "\tmov r1, r10\n" - "\tadds r0, r2, r1\n" - "\tldrb r1, [r0]\n" - "\tlsls r1, 2\n" - "\tadds r1, r7\n" - "\tldrb r2, [r3]\n" - "_0801A9E8:\n" - "\tldr r0, [r1]\n" - "\tadds r0, r2\n" - "\tstr r0, [r1]\n" - "_0801A9EE:\n" - "\tadds r4, r6, 0\n" - "\tcmp r4, 0x1E\n" - "\tbls _0801A98A\n" - "\tmov r0, r8\n" - "\tadd sp, 0x4\n" - "\tpop {r3-r5}\n" - "\tmov r8, r3\n" - "\tmov r9, r4\n" - "\tmov r10, r5\n" - "\tpop {r4-r7}\n" - "\tpop {r1}\n" - "\tbx r1"); + s32 i; + for (i = 0; i < 4; i++) + { + if (a0[i] != a1[i]) + { + return TRUE; + } + } + return FALSE; +} + +bool32 sub_801AA30(u32 * a0, u32 * a1, u32 * a2, u8 taskId) +{ + bool32 r8 = FALSE; + u32 sp0[4] = {0, 0, 0, 0}; + struct UnkStruct_x20 ** data = (void *)gTasks[taskId].data; + s32 i; + + for (i = 0; i < 16; i++) + { + u32 r1 = sub_801A960(&(*data)[i], sp0); + if (r1 != a2[i]) + { + a2[i] = r1; + r8 = TRUE; + } + } + if (sub_801AA08(sp0, a1) == 0) + { + if (r8 != TRUE) + { + return FALSE; + } + } + else + { + memcpy(a0, sp0, sizeof(sp0)); + memcpy(a1, sp0, sizeof(sp0)); + a0[3] = a0[0] + a0[1] + a0[2] + a0[3]; + } + return TRUE; +} + +void sub_801AAD4(void) +{ + s32 i; + sub_8014210(10); + for (i = 0; i < 2; i++) + { + gEnemyParty[i] = gPlayerParty[gSelectedOrderFromParty[i] - 1]; + } + for (i = 0; i < 6; i++) + { + ZeroMonData(&gPlayerParty[i]); + } + for (i = 0; i < 2; i++) + { + gPlayerParty[i] = gEnemyParty[i]; + } + IncrementGameStat(GAME_STAT_NUM_UNION_ROOM_BATTLES); + CalculatePlayerPartyCount(); + gTrainerBattleOpponent_A = 0xC00; + SetMainCallback2(CB2_InitBattle); +} + +void sub_801AB68(u8 windowId, const u8 * str, u8 x, u8 y, s32 speed) +{ + s32 letterSpacing = 0; + s32 lineSpacing = 1; + FillWindowPixelBuffer(windowId, (gUnknown_082F0DE4[0] << 4) | gUnknown_082F0DE4[0]); + AddTextPrinterParameterized4(windowId, 1, x, y, letterSpacing, lineSpacing, gUnknown_082F0DE4, speed, str); +} + +bool32 sub_801ABDC(s16 * state, const u8 * str, s32 speed) +{ + switch (*state) + { + case 0: + DrawTextBorderOuter(0, 0x001, 0xD); + sub_801AB68(0, str, 0, 1, speed); + PutWindowTilemap(0); + CopyWindowToVram(0, 3); + (*state)++; + break; + case 1: + if (!IsTextPrinterActive(0)) + { + *state = 0; + return TRUE; + } + break; + } + return FALSE; +} + +void sub_801AC40(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +void sub_801AC54(void) +{ + switch (gMain.state) + { + case 0: + SetGpuReg(REG_OFFSET_DISPCNT, 0x0000); + gUnknown_02022C6C = AllocZeroed(4); + ResetSpriteData(); + FreeAllSpritePalettes(); + ResetTasks(); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_082F0DD0, 1); + reset_temp_tile_data_buffers(); + if (!InitWindows(gUnknown_082F0DD4)) + { + return; + } + DeactivateAllTextPrinters(); + ClearWindowTilemap(0); + FillWindowPixelBuffer(0, 0x00); + FillWindowPixelBuffer(0, 0x11); + FillBgTilemapBufferRect(0, 0, 0, 0, 30, 20, 0xF); + LoadUserWindowBorderGfx(0, 1, 0xD0); + LoadUserWindowBorderGfx_(0, 1, 0xD0); + sub_819789C(); + SetVBlankCallback(sub_801AC40); + gMain.state++; + break; + case 1: + if (sub_801ABDC(&gUnknown_02022C6C->a0, gText_CommStandbyAwaitingOtherPlayer, 0)) + { + gMain.state++; + } + break; + case 2: + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, 0); + ShowBg(0); + gMain.state++; + break; + case 3: + if (!UpdatePaletteFade()) + { + memset(gBlockSendBuffer, 0, 0x20); + if (gSelectedOrderFromParty[0] == -gSelectedOrderFromParty[1]) + { + gBlockSendBuffer[0] = 0x52; + } + else + { + gBlockSendBuffer[0] = 0x51; + } + SendBlock(0, gBlockSendBuffer, 0x20); + gMain.state++; + } + break; + case 4: + if (GetBlockReceivedStatus() == 3) + { + if (gBlockRecvBuffer[0][0] == 0x51 && gBlockRecvBuffer[1][0] == 0x51) + { + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, 0); + gMain.state = 50; + } + else + { + sub_800AC34(); + if (gBlockRecvBuffer[GetMultiplayerId()][0] == 0x52) + { + gMain.state = 6; + } + else + { + gMain.state = 8; + } + } + ResetBlockReceivedFlags(); + } + break; + case 50: + if (!UpdatePaletteFade()) + { + sub_800ADF8(); + gMain.state++; + } + break; + case 51: + if (IsLinkTaskFinished()) + { + SetMainCallback2(sub_801AAD4); + } + break; + case 6: + if (gReceivedRemoteLinkPlayers == 0) + { + gMain.state++; + } + break; + case 7: + if (sub_801ABDC(&gUnknown_02022C6C->a0, gText_RefusedBattle, 1)) + { + SetMainCallback2(CB2_ReturnToField); + } + break; + case 8: + if (gReceivedRemoteLinkPlayers == 0) + { + gMain.state++; + } + break; + case 9: + if (sub_801ABDC(&gUnknown_02022C6C->a0, gText_BattleWasRefused, 1)) + { + SetMainCallback2(CB2_ReturnToField); + } + break; + } + RunTasks(); + RunTextPrinters(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); } -#endif //NONMATCHING diff --git a/sym_ewram.txt b/sym_ewram.txt index 8cb156837..d029ad78f 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -9,10 +9,7 @@ .include "src/union_room.o" .include "src/mystery_gift.o" .include "src/union_room_player_avatar.o" - -gUnknown_02022C6C: @ 2022C6C - .space 0x4 - + .include "src/union_room_battle.o" .include "src/mevent2.o" .include "src/mevent_801BAAC.o" From 63b04d5d6f71516ccbb4add825f12c51e576e571 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Apr 2019 07:33:19 +0200 Subject: [PATCH 050/101] Iron Head animatiion --- data/battle_anim_scripts.s | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index a080e6620..50ed6e363 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -2019,6 +2019,23 @@ Move_GUNK_SHOT: end Move_IRON_HEAD: + loadspritegfx ANIM_TAG_GUST + loadspritegfx ANIM_TAG_IMPACT + loopsewithpan SE_W231, SOUND_PAN_ATTACKER, 28, 2 + createvisualtask sub_81144F8, 5, 0, 0, 0 + waitforvisualfinish + createsprite gUnknown_08592CD8, ANIM_ATTACKER, 2, 0 + playsewithpan SE_W029, SOUND_PAN_ATTACKER + waitforvisualfinish + delay 2 + createsprite gUnknown_08592CD8, ANIM_ATTACKER, 2, 1 + waitforvisualfinish + createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_ATTACKER, 2, 0, 4, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 7, 1 + createsprite gUnknown_08592CD8, ANIM_ATTACKER, 2, 2 + createsprite gUnknown_085973E8, ANIM_TARGET, 3, 0, 0, 1, 1 + playsewithpan SE_W233B, SOUND_PAN_TARGET + waitforvisualfinish end Move_MAGNET_BOMB: From 7f07aae89b76f207b7e3029ba7b5519071dfa58b Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Apr 2019 09:22:28 +0200 Subject: [PATCH 051/101] Power-up-Punch animation --- data/battle_anim_scripts.s | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 50ed6e363..3a44b30e7 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -2022,7 +2022,7 @@ Move_IRON_HEAD: loadspritegfx ANIM_TAG_GUST loadspritegfx ANIM_TAG_IMPACT loopsewithpan SE_W231, SOUND_PAN_ATTACKER, 28, 2 - createvisualtask sub_81144F8, 5, 0, 0, 0 + createvisualtask sub_81144F8, 5, 1, 0, 0 waitforvisualfinish createsprite gUnknown_08592CD8, ANIM_ATTACKER, 2, 0 playsewithpan SE_W029, SOUND_PAN_ATTACKER @@ -2036,6 +2036,8 @@ Move_IRON_HEAD: createsprite gUnknown_085973E8, ANIM_TARGET, 3, 0, 0, 1, 1 playsewithpan SE_W233B, SOUND_PAN_TARGET waitforvisualfinish + createvisualtask sub_811489C, 5, 0, 1 + waitforvisualfinish end Move_MAGNET_BOMB: @@ -2627,6 +2629,20 @@ Move_INFESTATION: end Move_POWER_UP_PUNCH: + loadspritegfx ANIM_TAG_IMPACT + loadspritegfx ANIM_TAG_HANDS_AND_FEET + loadspritegfx ANIM_TAG_BREATH + monbg ANIM_TARGET + setalpha 12, 8 + createvisualtask AnimTask_GrowAndShrink, 2, + playsewithpan SE_W118, SOUND_PAN_ATTACKER + waitforvisualfinish + playsewithpan SE_W003, SOUND_PAN_TARGET + createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 2, 0, 0, 1, 1 + createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 + waitforvisualfinish + clearmonbg ANIM_TARGET + blendoff end Move_OBLIVION_WING: From 5c44f44ad23a335555fd0a6ae88038ead8f42e60 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Apr 2019 12:26:24 +0200 Subject: [PATCH 052/101] Organize new battle anim gfx --- graphics/battle_anims/sprites/energy_ball.png | Bin 0 -> 357 bytes .../sprites/{290.png => purple_jab.png} | Bin ...{toxicspike_color.png => toxic_spikes.png} | Bin .../sprites/{289.png => white_streak.png} | Bin include/constants/battle_anim.h | 1 + include/graphics.h | 14 +++++++----- src/battle_anim.c | 16 ++++++++------ src/graphics.c | 20 +++++++++++------- 8 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 graphics/battle_anims/sprites/energy_ball.png rename graphics/battle_anims/sprites/{290.png => purple_jab.png} (100%) mode change 100755 => 100644 rename graphics/battle_anims/sprites/{toxicspike_color.png => toxic_spikes.png} (100%) rename graphics/battle_anims/sprites/{289.png => white_streak.png} (100%) mode change 100755 => 100644 diff --git a/graphics/battle_anims/sprites/energy_ball.png b/graphics/battle_anims/sprites/energy_ball.png new file mode 100644 index 0000000000000000000000000000000000000000..b3b26d6068cb2e1330e916c14dee664a5f380178 GIT binary patch literal 357 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfvg8-ip*CkWB8L}7{x)~U@Ffd$Y z;P}t*|NnoWBrcF6sk;#<_rcS}F+^ix?nK9;!wNjEt_yzOI>$K6;GTBP?rfuFzx`yZ znv4D`hbZ;E?pw@z`0?kT9xmrko1A@Jc7KcAoLOh@)jz4>);5&W>E`Z_zFR&sm}!5E z*ujWX{F9l_mwSGX^O|Ta{7&exxWTzUON9<=H-uhr`^v!4V7;<+^Vg{-nbxSetEW4k z>pXdEb;K7xqs&Vh4l&vSj^{2j9kX{RtYiD7yF#wabZtXl*qg~V(&vtZ^QN(XP&jCF zFKdIDQsz5mfvl3lTpc1;&Ub3dEvTEn%m2!}sxQ-*wkippeYj^!fQp&tTHk4EZokai h?k@PY_zr({@cwKMOZK|ziPE5O@pScbS?83{1OQysh_3(u literal 0 HcmV?d00001 diff --git a/graphics/battle_anims/sprites/290.png b/graphics/battle_anims/sprites/purple_jab.png old mode 100755 new mode 100644 similarity index 100% rename from graphics/battle_anims/sprites/290.png rename to graphics/battle_anims/sprites/purple_jab.png diff --git a/graphics/battle_anims/sprites/toxicspike_color.png b/graphics/battle_anims/sprites/toxic_spikes.png similarity index 100% rename from graphics/battle_anims/sprites/toxicspike_color.png rename to graphics/battle_anims/sprites/toxic_spikes.png diff --git a/graphics/battle_anims/sprites/289.png b/graphics/battle_anims/sprites/white_streak.png old mode 100755 new mode 100644 similarity index 100% rename from graphics/battle_anims/sprites/289.png rename to graphics/battle_anims/sprites/white_streak.png diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index c1d6d6804..a94cdd7d3 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -299,6 +299,7 @@ #define ANIM_TAG_WHITE_STREAK (ANIM_SPRITES_START + 289) #define ANIM_TAG_PURPLE_JAB (ANIM_SPRITES_START + 290) #define ANIM_TAG_TOXIC_SPIKES (ANIM_SPRITES_START + 291) +#define ANIM_TAG_ENERGY_BALL (ANIM_SPRITES_START + 292) // battlers #define ANIM_ATTACKER 0 diff --git a/include/graphics.h b/include/graphics.h index 5d3e59f7b..1ba1f9963 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4663,8 +4663,6 @@ extern const u32 gBattleAnimBackgroundTilemap_ScaryFaceOpponent[]; extern const u32 gBattleAnimBackgroundTilemap_ScaryFaceContest[]; extern const u32 gBattleAnimSpriteSheet_284[]; extern const u32 gBattleAnimSpriteSheet_285[]; -extern const u32 gBattleAnimSpriteSheet_289[]; -extern const u32 gBattleAnimSpriteSheet_290[]; extern const u32 gBattleAnimSpritePalette_000[]; extern const u32 gBattleAnimSpritePalette_001[]; @@ -4948,9 +4946,6 @@ extern const u32 gBattleAnimSpritePalette_285[]; extern const u32 gBattleAnimSpritePalette_286[]; extern const u32 gBattleAnimSpritePalette_287[]; extern const u32 gBattleAnimSpritePalette_288[]; -extern const u32 gBattleAnimSpritePalette_289[]; -extern const u32 gBattleAnimSpritePalette_290[]; -extern const u32 gBattleAnimSpritePalette_291[]; extern const u32 gBattleAnimBackgroundImage_00[]; extern const u32 gBattleAnimBackgroundImage_02[]; @@ -5200,4 +5195,13 @@ extern const u16 gPokenavConditionCancel_Pal[]; extern const u32 gUnknown_08DE34B8[]; extern const u16 gUnknown_08DE3398[]; +// New Battle Anim Particles +extern const u32 gBattleAnimSpriteGfx_WhiteStreak[]; +extern const u32 gBattleAnimSpritePal_WhiteStreak[]; +extern const u32 gBattleAnimSpriteGfx_PurpleJab[]; +extern const u32 gBattleAnimSpritePal_PurpleJab[]; +extern const u32 gBattleAnimSpritePal_ToxicSpikes[]; +extern const u32 gBattleAnimSpriteGfx_EnergyBall[]; +extern const u32 gBattleAnimSpritePal_EnergyBall[]; + #endif //GUARD_GRAPHICS_H diff --git a/src/battle_anim.c b/src/battle_anim.c index 0fdeba8ff..7e6d189db 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -1055,9 +1055,11 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] = {gBattleAnimSpriteSheet_183, 0x0800, ANIM_TAG_SLASH_2}, {gBattleAnimSpriteSheet_056, 0x1000, ANIM_TAG_WHIP_HIT}, {gBattleAnimSpriteSheet_163, 0x0100, ANIM_TAG_BLUE_RING_2}, - {gBattleAnimSpriteSheet_289, 0x1000, ANIM_TAG_WHITE_STREAK}, - {gBattleAnimSpriteSheet_290, 0x800, ANIM_TAG_PURPLE_JAB}, - {gBattleAnimSpriteSheet_152, 0x0080, ANIM_TAG_TOXIC_SPIKES}, + // New + {gBattleAnimSpriteGfx_WhiteStreak, 0x0200, ANIM_TAG_WHITE_STREAK}, + {gBattleAnimSpriteGfx_PurpleJab, 0x0100, ANIM_TAG_PURPLE_JAB}, + {gBattleAnimSpriteSheet_152, 0x0080, ANIM_TAG_TOXIC_SPIKES}, + {gBattleAnimSpriteGfx_EnergyBall, 0x0200, ANIM_TAG_ENERGY_BALL}, }; @@ -1352,9 +1354,11 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] = {gBattleAnimSpritePalette_286, ANIM_TAG_SLASH_2}, {gBattleAnimSpritePalette_287, ANIM_TAG_WHIP_HIT}, {gBattleAnimSpritePalette_288, ANIM_TAG_BLUE_RING_2}, - {gBattleAnimSpritePalette_289, ANIM_TAG_WHITE_STREAK}, - {gBattleAnimSpritePalette_290, ANIM_TAG_PURPLE_JAB}, - {gBattleAnimSpritePalette_291, ANIM_TAG_TOXIC_SPIKES}, + // New + {gBattleAnimSpritePal_WhiteStreak, ANIM_TAG_WHITE_STREAK}, + {gBattleAnimSpritePal_PurpleJab, ANIM_TAG_PURPLE_JAB}, + {gBattleAnimSpritePal_ToxicSpikes, ANIM_TAG_TOXIC_SPIKES}, + {gBattleAnimSpritePal_EnergyBall, ANIM_TAG_ENERGY_BALL}, }; const struct BattleAnimBackground gBattleAnimBackgroundTable[] = diff --git a/src/graphics.c b/src/graphics.c index 87039592a..037304086 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -20,6 +20,18 @@ const u32 gSmokescreenImpactPalette[] = INCBIN_U32("graphics/battle_anims/sprite const u32 gBlankGfxCompressed[] = INCBIN_U32("graphics/interface/blank.4bpp.lz"); +// New Battle anims Particles +const u32 gBattleAnimSpriteGfx_WhiteStreak[] = INCBIN_U32("graphics/battle_anims/sprites/white_streak.4bpp.lz"); +const u32 gBattleAnimSpritePal_WhiteStreak[] = INCBIN_U32("graphics/battle_anims/sprites/white_streak.gbapal.lz"); + +const u32 gBattleAnimSpriteGfx_PurpleJab[] = INCBIN_U32("graphics/battle_anims/sprites/purple_jab.4bpp.lz"); +const u32 gBattleAnimSpritePal_PurpleJab[] = INCBIN_U32("graphics/battle_anims/sprites/purple_jab.gbapal.lz"); + +const u32 gBattleAnimSpritePal_ToxicSpikes[] = INCBIN_U32("graphics/battle_anims/sprites/toxic_spikes.gbapal.lz"); + +const u32 gBattleAnimSpriteGfx_EnergyBall[] = INCBIN_U32("graphics/battle_anims/sprites/energy_ball.4bpp.lz"); +const u32 gBattleAnimSpritePal_EnergyBall[] = INCBIN_U32("graphics/battle_anims/sprites/energy_ball.gbapal.lz"); + // Battle anims const u32 gBattleAnimSpriteSheet_146[] = INCBIN_U32("graphics/battle_anims/sprites/146.4bpp.lz"); const u32 gBattleAnimSpriteSheet_000[] = INCBIN_U32("graphics/battle_anims/sprites/000.4bpp.lz"); @@ -565,14 +577,6 @@ const u32 gBattleAnimSpritePalette_163[] = INCBIN_U32("graphics/battle_anims/spr const u32 gBattleAnimSpritePalette_288[] = INCBIN_U32("graphics/battle_anims/sprites/288.gbapal.lz"); -const u32 gBattleAnimSpriteSheet_289[] = INCBIN_U32("graphics/battle_anims/sprites/289.4bpp.lz"); -const u32 gBattleAnimSpritePalette_289[] = INCBIN_U32("graphics/battle_anims/sprites/289.gbapal.lz"); - -const u32 gBattleAnimSpriteSheet_290[] = INCBIN_U32("graphics/battle_anims/sprites/290.4bpp.lz"); -const u32 gBattleAnimSpritePalette_290[] = INCBIN_U32("graphics/battle_anims/sprites/290.gbapal.lz"); - -const u32 gBattleAnimSpritePalette_291[] = INCBIN_U32("graphics/battle_anims/sprites/toxicspike_color.gbapal.lz"); //reuse the spike image - const u32 gBattleAnimSpritePalette_164[] = INCBIN_U32("graphics/battle_anims/sprites/164.gbapal.lz"); const u32 gBattleAnimSpritePalette_165[] = INCBIN_U32("graphics/battle_anims/sprites/165.gbapal.lz"); From 79fec8a38d8f1e7543decc410461af6c7d981924 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Apr 2019 13:05:20 +0200 Subject: [PATCH 053/101] Energy Ball animation --- data/battle_anim_scripts.s | 15 +++++++++++++++ src/ghost.c | 39 ++++++++++++++++++++++++-------------- 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 3a44b30e7..5bbd7aee7 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -1652,6 +1652,21 @@ Move_FOCUS_BLAST: end Move_ENERGY_BALL: + loadspritegfx ANIM_TAG_ENERGY_BALL + monbg ANIM_TARGET + setalpha 12, 8 + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 8, RGB_BLACK + waitforvisualfinish + delay 15 + createsoundtask sub_8158C58, SE_W054, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 5, 5, 0, 5 + createsprite gEnergyBallSpriteTemplate, ANIM_TARGET, 2, 12, 4, 8 + waitforvisualfinish + playsewithpan SE_W028, SOUND_PAN_TARGET + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 8, 1 + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 8, 0, RGB_BLACK + waitforvisualfinish + clearmonbg ANIM_TARGET + blendoff end Move_BRAVE_BIRD: diff --git a/src/ghost.c b/src/ghost.c index 998be0caa..cd02e32db 100644 --- a/src/ghost.c +++ b/src/ghost.c @@ -98,6 +98,17 @@ const struct SpriteTemplate gUnknown_08596D58 = .callback = InitAnimShadowBall, }; +const struct SpriteTemplate gEnergyBallSpriteTemplate = +{ + .tileTag = ANIM_TAG_ENERGY_BALL, + .paletteTag = ANIM_TAG_ENERGY_BALL, + .oam = &gUnknown_08524974, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gUnknown_08596D54, + .callback = InitAnimShadowBall, +}; + const union AnimCmd gUnknown_08596D70[] = { ANIMCMD_FRAME(0, 2), @@ -261,20 +272,20 @@ static void sub_81116E8(struct Sprite *sprite) AnimTranslateLinear(sprite); sprite->pos2.x += Sin(sprite->data[5], 10); sprite->pos2.y += Cos(sprite->data[5], 15); - + r2 = sprite->data[5]; sprite->data[5] = (sprite->data[5] + 5) & 0xFF; r0 = sprite->data[5]; - + if (r2 == 0 || r2 > 196) { if (r0 > 0) PlaySE(SE_W109); } - + if (sprite->data[6] == 0) { - sprite->invisible = TRUE; + sprite->invisible = TRUE; sprite->callback = DestroyAnimSpriteAndDisableBlend; } else @@ -283,18 +294,18 @@ static void sub_81116E8(struct Sprite *sprite) static void sub_8111764(struct Sprite *sprite) { - - s16 r0; + + s16 r0; if (sprite->data[6] > 0xFF) { if (++sprite->data[6] == 0x10d) sprite->data[6] = 0; return; } - + r0 = sprite->data[7]; sprite->data[7]++; - + if ((r0 & 0xFF) == 0) { sprite->data[7] &= 0xff00; @@ -392,8 +403,8 @@ static void sub_811196C(u8 taskId) } } -// Spins a sprite towards the target, pausing in the middle. -// Used in Shadow Ball. +// Spins a sprite towards the target, pausing in the middle. +// Used in Shadow Ball. // arg 0: duration step 1 (attacker -> center) // arg 1: duration step 2 (spin center) // arg 2: duration step 3 (center -> target) @@ -466,7 +477,7 @@ static void sub_8111B9C(struct Sprite *sprite) } static void sub_8111BB4(struct Sprite *sprite) { - + s8 r5 = FALSE; bool8 r6 = FALSE; if(sprite->animEnded) @@ -508,7 +519,7 @@ static void sub_8111BB4(struct Sprite *sprite) { void sub_8111C50(u8 taskId) { struct Task *task; - + task = &gTasks[taskId]; task->data[0] = CloneBattlerSpriteWithBlend(1); if (task->data[0] < 0) @@ -886,7 +897,7 @@ static void sub_81125E0(u8 taskId) } } } - + if (task->data[10]) task->data[10]--; else if (task->data[6]) @@ -1120,7 +1131,7 @@ static void sub_8112B78(struct Sprite *sprite) sprite->pos2.x = Sin(sprite->data[0], 12); if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) sprite->pos2.x = -sprite->pos2.x; - + sprite->data[0] = (sprite->data[0] + 6) & 0xFF; sprite->data[1] += 0x100; sprite->pos2.y = -(sprite->data[1] >> 8); From ca9f7fe3563b84504d499bdb291ca10d38cbf229 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Tue, 2 Apr 2019 00:59:01 -0400 Subject: [PATCH 054/101] Fix hardcoded array sizes --- src/pokenav_match_call.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/pokenav_match_call.c b/src/pokenav_match_call.c index b775ed10e..0a21c4edc 100644 --- a/src/pokenav_match_call.c +++ b/src/pokenav_match_call.c @@ -680,7 +680,7 @@ bool32 MatchCallFlagGetByIndex(u32 idx) match_call_t matchCall; u32 i; - if (idx > 20) + if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) return FALSE; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); @@ -727,7 +727,7 @@ u8 sub_81D16DC(u32 idx) match_call_t matchCall; u32 i; - if (idx > 20) + if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) return 0; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); @@ -771,7 +771,7 @@ bool32 MatchCall_IsRematchable(u32 idx) match_call_t matchCall; u32 i; - if (idx > 20) + if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) return 0; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); @@ -810,13 +810,13 @@ bool32 sub_81D17E8(u32 idx) match_call_t matchCall; u32 i; - if (idx > 20) + if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) return FALSE; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); if (gUnknown_08625338[i](matchCall)) return TRUE; - for (i = 0; i < 4; i++) + for (i = 0; i < ARRAY_COUNT(sMatchCallCheckPageOverrides); i++) { if (sMatchCallCheckPageOverrides[i].idx == idx) return TRUE; @@ -854,7 +854,7 @@ u32 MatchCall_GetRematchTableIdx(u32 idx) match_call_t matchCall; u32 i; - if (idx > 20) + if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) return REMATCH_TABLE_ENTRIES; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); @@ -891,7 +891,7 @@ void MatchCall_GetMessage(u32 idx, u8 *dest) match_call_t matchCall; u32 i; - if (idx > 20) + if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) return; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); @@ -1093,7 +1093,7 @@ void sub_81D1A78(u32 idx, const u8 **desc, const u8 **name) match_call_t matchCall; u32 i; - if (idx > 20) + if (idx > ARRAY_COUNT(sMatchCallHeaders) - 1) return; matchCall = sMatchCallHeaders[idx]; i = MatchCallGetFunctionIndex(matchCall); @@ -1146,11 +1146,11 @@ const u8 *sub_81D1B40(u32 idx, u32 offset) { u32 i; - for (i = 0; i < 4; i++) + for (i = 0; i < ARRAY_COUNT(sMatchCallCheckPageOverrides); i++) { if (sMatchCallCheckPageOverrides[i].idx == idx) { - for (; i + 1 < 4 && sMatchCallCheckPageOverrides[i + 1].idx == idx; i++) + for (; i + 1 < ARRAY_COUNT(sMatchCallCheckPageOverrides) && sMatchCallCheckPageOverrides[i + 1].idx == idx; i++) { if (!FlagGet(sMatchCallCheckPageOverrides[i + 1].v4)) break; @@ -1244,7 +1244,7 @@ s32 sub_81D1BD0(u32 idx) { u32 i; - for (i = 0; i < 4; i++) + for (i = 0; i < ARRAY_COUNT(sMatchCallCheckPageOverrides); i++) { if (sMatchCallCheckPageOverrides[i].idx == idx) return sMatchCallCheckPageOverrides[i].v2; @@ -1256,7 +1256,7 @@ bool32 sub_81D1BF8(u32 idx) { s32 i; - for (i = 0; i < 21; i++) + for (i = 0; i < (s32)ARRAY_COUNT(sMatchCallHeaders); i++) { u32 r0 = MatchCall_GetRematchTableIdx(i); if (r0 != REMATCH_TABLE_ENTRIES && r0 == idx) From 65d8b68f9db02252ae5e4ba8ee779218eb67f135 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Tue, 2 Apr 2019 01:10:20 -0400 Subject: [PATCH 055/101] Expicitly hardcode rematch indecies Inserting an entry without updating the indecies will now cause a compiler error. This will make it easier for modders to remember to update the constants. --- src/battle_setup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/battle_setup.c b/src/battle_setup.c index 347486a0b..cb7b63ebe 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -296,7 +296,8 @@ const struct RematchTrainer gRematchTable[REMATCH_TABLE_ENTRIES] = {{TRAINER_TRENT_1, TRAINER_TRENT_2, TRAINER_TRENT_3, TRAINER_TRENT_4, TRAINER_TRENT_5}, 0x0, 0x1b}, {{TRAINER_SAWYER_1, TRAINER_SAWYER_2, TRAINER_SAWYER_3, TRAINER_SAWYER_4, TRAINER_SAWYER_5}, 0x18, 0xc}, {{TRAINER_KIRA_AND_DAN_1, TRAINER_KIRA_AND_DAN_2, TRAINER_KIRA_AND_DAN_3, TRAINER_KIRA_AND_DAN_4, TRAINER_KIRA_AND_DAN_5}, 0x18, 0x3e}, - {{TRAINER_WALLY_3, TRAINER_WALLY_4, TRAINER_WALLY_5, TRAINER_WALLY_6, TRAINER_WALLY_6}, 0x18, 0x2b}, + // Wally's entry index is hardcoded. + [REMATCH_WALLY_ENTRY] = {{TRAINER_WALLY_3, TRAINER_WALLY_4, TRAINER_WALLY_5, TRAINER_WALLY_6, TRAINER_WALLY_6}, 0x18, 0x2b}, {{TRAINER_ROXANNE_1, TRAINER_ROXANNE_2, TRAINER_ROXANNE_3, TRAINER_ROXANNE_4, TRAINER_ROXANNE_5}, 0x0, 0x3}, {{TRAINER_BRAWLY_1, TRAINER_BRAWLY_2, TRAINER_BRAWLY_3, TRAINER_BRAWLY_4, TRAINER_BRAWLY_5}, 0x0, 0xb}, {{TRAINER_WATTSON_1, TRAINER_WATTSON_2, TRAINER_WATTSON_3, TRAINER_WATTSON_4, TRAINER_WATTSON_5}, 0x0, 0x2}, @@ -305,7 +306,8 @@ const struct RematchTrainer gRematchTable[REMATCH_TABLE_ENTRIES] = {{TRAINER_WINONA_1, TRAINER_WINONA_2, TRAINER_WINONA_3, TRAINER_WINONA_4, TRAINER_WINONA_5}, 0x0, 0x4}, {{TRAINER_TATE_AND_LIZA_1, TRAINER_TATE_AND_LIZA_2, TRAINER_TATE_AND_LIZA_3, TRAINER_TATE_AND_LIZA_4, TRAINER_TATE_AND_LIZA_5}, 0x0, 0x6}, {{TRAINER_JUAN_1, TRAINER_JUAN_2, TRAINER_JUAN_3, TRAINER_JUAN_4, TRAINER_JUAN_5}, 0x0, 0x7}, - {{TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY}, 0x0, 0x8}, + + [REMATCH_ELITE_FOUR_ENTRIES] = {{TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY}, 0x0, 0x8}, {{TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE}, 0x0, 0x8}, {{TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA}, 0x0, 0x8}, {{TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE}, 0x0, 0x8}, From 6916f09cd5cdb508e270bfba40f1bd165a16762f Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Tue, 2 Apr 2019 03:22:07 -0400 Subject: [PATCH 056/101] Expand MatchCallStruct defs, use REMATCH_* enum --- include/battle_setup.h | 5 +- include/constants/flags.h | 13 +- include/gym_leader_rematch.h | 2 + src/battle_setup.c | 162 ++++++++++++------------ src/pokenav_match_call.c | 236 ++++++++++++++++++++++++++++++----- 5 files changed, 298 insertions(+), 120 deletions(-) diff --git a/include/battle_setup.h b/include/battle_setup.h index 3b327e3f7..e3faa5dcf 100644 --- a/include/battle_setup.h +++ b/include/battle_setup.h @@ -1,10 +1,11 @@ #ifndef GUARD_BATTLE_SETUP_H #define GUARD_BATTLE_SETUP_H +#include "gym_leader_rematch.h" + #define REMATCHES_COUNT 5 #define REMATCH_TABLE_ENTRIES 78 -#define REMATCH_WALLY_ENTRY 64 -#define REMATCH_ELITE_FOUR_ENTRIES 73 +#define REMATCH_ELITE_FOUR_ENTRIES REMATCH_SIDNEY struct RematchTrainer { diff --git a/include/constants/flags.h b/include/constants/flags.h index f28af3278..0450e988d 100644 --- a/include/constants/flags.h +++ b/include/constants/flags.h @@ -445,13 +445,14 @@ #define FLAG_REMATCH_NORMAN 0x1A2 #define FLAG_REMATCH_WINONA 0x1A3 #define FLAG_REMATCH_TATE_AND_LIZA 0x1A4 -#define FLAG_REMATCH_JUAN 0x1A5 -#define FLAG_REMATCH_SIDNEY 0x1A6 -#define FLAG_REMATCH_PHOEBE 0x1A7 -#define FLAG_REMATCH_GLACIA 0x1A8 -#define FLAG_REMATCH_DRAKE 0x1A9 -#define FLAG_REMATCH_WALLACE 0x1AA +// Note: FLAG_REMATCH_JUAN is handled by FLAG_ENABLE_JUAN_MATCH_CALL instead. +#define FLAG_REMATCH_SIDNEY 0x1A5 +#define FLAG_REMATCH_PHOEBE 0x1A6 +#define FLAG_REMATCH_GLACIA 0x1A7 +#define FLAG_REMATCH_DRAKE 0x1A8 +#define FLAG_REMATCH_WALLACE 0x1A9 +#define FLAG_UNUSED_0x1AA 0x1AA // Unused Flag #define FLAG_UNUSED_0x1AB 0x1AB // Unused Flag #define FLAG_DEFEATED_DEOXYS 0x1AC diff --git a/include/gym_leader_rematch.h b/include/gym_leader_rematch.h index ef0e5fef1..ed1143db5 100644 --- a/include/gym_leader_rematch.h +++ b/include/gym_leader_rematch.h @@ -75,6 +75,8 @@ enum { REMATCH_WINONA, REMATCH_TATE_AND_LIZA, REMATCH_JUAN, + + // Entries below SIDNEY are considered part of REMATCH_ELITE_FOUR_ENTRIES. REMATCH_SIDNEY, REMATCH_PHOEBE, REMATCH_GLACIA, diff --git a/src/battle_setup.c b/src/battle_setup.c index cb7b63ebe..7395c175b 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -232,86 +232,84 @@ static const struct TrainerBattleParameter sTrainerBContinueScriptBattleParams[] const struct RematchTrainer gRematchTable[REMATCH_TABLE_ENTRIES] = { - {{TRAINER_ROSE_1, TRAINER_ROSE_2, TRAINER_ROSE_3, TRAINER_ROSE_4, TRAINER_ROSE_5}, 0x0, 0x21}, - {{TRAINER_ANDRES_1, TRAINER_ANDRES_2, TRAINER_ANDRES_3, TRAINER_ANDRES_4, TRAINER_ANDRES_5}, 0x0, 0x14}, - {{TRAINER_DUSTY_1, TRAINER_DUSTY_2, TRAINER_DUSTY_3, TRAINER_DUSTY_4, TRAINER_DUSTY_5}, 0x0, 0x1a}, - {{TRAINER_LOLA_1, TRAINER_LOLA_2, TRAINER_LOLA_3, TRAINER_LOLA_4, TRAINER_LOLA_5}, 0x0, 0x18}, - {{TRAINER_RICKY_1, TRAINER_RICKY_2, TRAINER_RICKY_3, TRAINER_RICKY_4, TRAINER_RICKY_5}, 0x0, 0x18}, - {{TRAINER_LILA_AND_ROY_1, TRAINER_LILA_AND_ROY_2, TRAINER_LILA_AND_ROY_3, TRAINER_LILA_AND_ROY_4, TRAINER_LILA_AND_ROY_5}, 0x0, 0x27}, - {{TRAINER_CRISTIN_1, TRAINER_CRISTIN_2, TRAINER_CRISTIN_3, TRAINER_CRISTIN_4, TRAINER_CRISTIN_5}, 0x0, 0x24}, - {{TRAINER_BROOKE_1, TRAINER_BROOKE_2, TRAINER_BROOKE_3, TRAINER_BROOKE_4, TRAINER_BROOKE_5}, 0x0, 0x1a}, - {{TRAINER_WILTON_1, TRAINER_WILTON_2, TRAINER_WILTON_3, TRAINER_WILTON_4, TRAINER_WILTON_5}, 0x0, 0x1a}, - {{TRAINER_VALERIE_1, TRAINER_VALERIE_2, TRAINER_VALERIE_3, TRAINER_VALERIE_4, TRAINER_VALERIE_5}, 0x18, 0x14}, - {{TRAINER_CINDY_1, TRAINER_CINDY_3, TRAINER_CINDY_4, TRAINER_CINDY_5, TRAINER_CINDY_6}, 0x0, 0x13}, - {{TRAINER_THALIA_1, TRAINER_THALIA_2, TRAINER_THALIA_3, TRAINER_THALIA_4, TRAINER_THALIA_5}, 0x18, 0x38}, - {{TRAINER_JESSICA_1, TRAINER_JESSICA_2, TRAINER_JESSICA_3, TRAINER_JESSICA_4, TRAINER_JESSICA_5}, 0x0, 0x24}, - {{TRAINER_WINSTON_1, TRAINER_WINSTON_2, TRAINER_WINSTON_3, TRAINER_WINSTON_4, TRAINER_WINSTON_5}, 0x0, 0x13}, - {{TRAINER_STEVE_1, TRAINER_STEVE_2, TRAINER_STEVE_3, TRAINER_STEVE_4, TRAINER_STEVE_5}, 0x0, 0x1d}, - {{TRAINER_TONY_1, TRAINER_TONY_2, TRAINER_TONY_3, TRAINER_TONY_4, TRAINER_TONY_5}, 0x0, 0x16}, - {{TRAINER_NOB_1, TRAINER_NOB_2, TRAINER_NOB_3, TRAINER_NOB_4, TRAINER_NOB_5}, 0x0, 0x1e}, - {{TRAINER_KOJI_1, TRAINER_KOJI_2, TRAINER_KOJI_3, TRAINER_KOJI_4, TRAINER_KOJI_5}, 0x0, 0x2a}, - {{TRAINER_FERNANDO_1, TRAINER_FERNANDO_2, TRAINER_FERNANDO_3, TRAINER_FERNANDO_4, TRAINER_FERNANDO_5}, 0x0, 0x26}, - {{TRAINER_DALTON_1, TRAINER_DALTON_2, TRAINER_DALTON_3, TRAINER_DALTON_4, TRAINER_DALTON_5}, 0x0, 0x21}, - {{TRAINER_BERNIE_1, TRAINER_BERNIE_2, TRAINER_BERNIE_3, TRAINER_BERNIE_4, TRAINER_BERNIE_5}, 0x0, 0x1d}, - {{TRAINER_ETHAN_1, TRAINER_ETHAN_2, TRAINER_ETHAN_3, TRAINER_ETHAN_4, TRAINER_ETHAN_5}, 0x18, 0xd}, - {{TRAINER_JOHN_AND_JAY_1, TRAINER_JOHN_AND_JAY_2, TRAINER_JOHN_AND_JAY_3, TRAINER_JOHN_AND_JAY_4, TRAINER_JOHN_AND_JAY_5}, 0x18, 0x1}, - {{TRAINER_JEFFREY_1, TRAINER_JEFFREY_2, TRAINER_JEFFREY_3, TRAINER_JEFFREY_4, TRAINER_JEFFREY_5}, 0x0, 0x23}, - {{TRAINER_CAMERON_1, TRAINER_CAMERON_2, TRAINER_CAMERON_3, TRAINER_CAMERON_4, TRAINER_CAMERON_5}, 0x0, 0x26}, - {{TRAINER_JACKI_1, TRAINER_JACKI_2, TRAINER_JACKI_3, TRAINER_JACKI_4, TRAINER_JACKI_5}, 0x0, 0x26}, - {{TRAINER_WALTER_1, TRAINER_WALTER_2, TRAINER_WALTER_3, TRAINER_WALTER_4, TRAINER_WALTER_5}, 0x0, 0x24}, - {{TRAINER_KAREN_1, TRAINER_KAREN_2, TRAINER_KAREN_3, TRAINER_KAREN_4, TRAINER_KAREN_5}, 0x0, 0x1f}, - {{TRAINER_JERRY_1, TRAINER_JERRY_2, TRAINER_JERRY_3, TRAINER_JERRY_4, TRAINER_JERRY_5}, 0x0, 0x1f}, - {{TRAINER_ANNA_AND_MEG_1, TRAINER_ANNA_AND_MEG_2, TRAINER_ANNA_AND_MEG_3, TRAINER_ANNA_AND_MEG_4, TRAINER_ANNA_AND_MEG_5}, 0x0, 0x20}, - {{TRAINER_ISABEL_1, TRAINER_ISABEL_2, TRAINER_ISABEL_3, TRAINER_ISABEL_4, TRAINER_ISABEL_5}, 0x0, 0x19}, - {{TRAINER_MIGUEL_1, TRAINER_MIGUEL_2, TRAINER_MIGUEL_3, TRAINER_MIGUEL_4, TRAINER_MIGUEL_5}, 0x0, 0x12}, - {{TRAINER_TIMOTHY_1, TRAINER_TIMOTHY_2, TRAINER_TIMOTHY_3, TRAINER_TIMOTHY_4, TRAINER_TIMOTHY_5}, 0x0, 0x1e}, - {{TRAINER_SHELBY_1, TRAINER_SHELBY_2, TRAINER_SHELBY_3, TRAINER_SHELBY_4, TRAINER_SHELBY_5}, 0x18, 0xc}, - {{TRAINER_CALVIN_1, TRAINER_CALVIN_2, TRAINER_CALVIN_3, TRAINER_CALVIN_4, TRAINER_CALVIN_5}, 0x0, 0x11}, - {{TRAINER_ELLIOT_1, TRAINER_ELLIOT_2, TRAINER_ELLIOT_3, TRAINER_ELLIOT_4, TRAINER_ELLIOT_5}, 0x0, 0x15}, - {{TRAINER_ISAIAH_1, TRAINER_ISAIAH_2, TRAINER_ISAIAH_3, TRAINER_ISAIAH_4, TRAINER_ISAIAH_5}, 0x0, 0x2b}, - {{TRAINER_MARIA_1, TRAINER_MARIA_2, TRAINER_MARIA_3, TRAINER_MARIA_4, TRAINER_MARIA_5}, 0x0, 0x20}, - {{TRAINER_ABIGAIL_1, TRAINER_ABIGAIL_2, TRAINER_ABIGAIL_3, TRAINER_ABIGAIL_4, TRAINER_ABIGAIL_5}, 0x0, 0x19}, - {{TRAINER_DYLAN_1, TRAINER_DYLAN_2, TRAINER_DYLAN_3, TRAINER_DYLAN_4, TRAINER_DYLAN_5}, 0x0, 0x20}, - {{TRAINER_KATELYN_1, TRAINER_KATELYN_2, TRAINER_KATELYN_3, TRAINER_KATELYN_4, TRAINER_KATELYN_5}, 0x0, 0x2b}, - {{TRAINER_BENJAMIN_1, TRAINER_BENJAMIN_2, TRAINER_BENJAMIN_3, TRAINER_BENJAMIN_4, TRAINER_BENJAMIN_5}, 0x0, 0x19}, - {{TRAINER_PABLO_1, TRAINER_PABLO_2, TRAINER_PABLO_3, TRAINER_PABLO_4, TRAINER_PABLO_5}, 0x0, 0x29}, - {{TRAINER_NICOLAS_1, TRAINER_NICOLAS_2, TRAINER_NICOLAS_3, TRAINER_NICOLAS_4, TRAINER_NICOLAS_5}, 0x18, 0x1}, - {{TRAINER_ROBERT_1, TRAINER_ROBERT_2, TRAINER_ROBERT_3, TRAINER_ROBERT_4, TRAINER_ROBERT_5}, 0x0, 0x23}, - {{TRAINER_LAO_1, TRAINER_LAO_2, TRAINER_LAO_3, TRAINER_LAO_4, TRAINER_LAO_5}, 0x0, 0x1c}, - {{TRAINER_CYNDY_1, TRAINER_CYNDY_2, TRAINER_CYNDY_3, TRAINER_CYNDY_4, TRAINER_CYNDY_5}, 0x0, 0x1e}, - {{TRAINER_MADELINE_1, TRAINER_MADELINE_2, TRAINER_MADELINE_3, TRAINER_MADELINE_4, TRAINER_MADELINE_5}, 0x0, 0x1c}, - {{TRAINER_JENNY_1, TRAINER_JENNY_2, TRAINER_JENNY_3, TRAINER_JENNY_4, TRAINER_JENNY_5}, 0x0, 0x27}, - {{TRAINER_DIANA_1, TRAINER_DIANA_2, TRAINER_DIANA_3, TRAINER_DIANA_4, TRAINER_DIANA_5}, 0x18, 0xd}, - {{TRAINER_AMY_AND_LIV_1, TRAINER_AMY_AND_LIV_2, TRAINER_AMY_AND_LIV_4, TRAINER_AMY_AND_LIV_5, TRAINER_AMY_AND_LIV_6}, 0x0, 0x12}, - {{TRAINER_ERNEST_1, TRAINER_ERNEST_2, TRAINER_ERNEST_3, TRAINER_ERNEST_4, TRAINER_ERNEST_5}, 0x0, 0x28}, - {{TRAINER_CORY_1, TRAINER_CORY_2, TRAINER_CORY_3, TRAINER_CORY_4, TRAINER_CORY_5}, 0x0, 0x17}, - {{TRAINER_EDWIN_1, TRAINER_EDWIN_2, TRAINER_EDWIN_3, TRAINER_EDWIN_4, TRAINER_EDWIN_5}, 0x0, 0x19}, - {{TRAINER_LYDIA_1, TRAINER_LYDIA_2, TRAINER_LYDIA_3, TRAINER_LYDIA_4, TRAINER_LYDIA_5}, 0x0, 0x20}, - {{TRAINER_ISAAC_1, TRAINER_ISAAC_2, TRAINER_ISAAC_3, TRAINER_ISAAC_4, TRAINER_ISAAC_5}, 0x0, 0x20}, - {{TRAINER_GABRIELLE_1, TRAINER_GABRIELLE_2, TRAINER_GABRIELLE_3, TRAINER_GABRIELLE_4, TRAINER_GABRIELLE_5}, 0x18, 0x11}, - {{TRAINER_CATHERINE_1, TRAINER_CATHERINE_2, TRAINER_CATHERINE_3, TRAINER_CATHERINE_4, TRAINER_CATHERINE_5}, 0x0, 0x22}, - {{TRAINER_JACKSON_1, TRAINER_JACKSON_2, TRAINER_JACKSON_3, TRAINER_JACKSON_4, TRAINER_JACKSON_5}, 0x0, 0x22}, - {{TRAINER_HALEY_1, TRAINER_HALEY_2, TRAINER_HALEY_3, TRAINER_HALEY_4, TRAINER_HALEY_5}, 0x0, 0x13}, - {{TRAINER_JAMES_1, TRAINER_JAMES_2, TRAINER_JAMES_3, TRAINER_JAMES_4, TRAINER_JAMES_5}, 0x18, 0xb}, - {{TRAINER_TRENT_1, TRAINER_TRENT_2, TRAINER_TRENT_3, TRAINER_TRENT_4, TRAINER_TRENT_5}, 0x0, 0x1b}, - {{TRAINER_SAWYER_1, TRAINER_SAWYER_2, TRAINER_SAWYER_3, TRAINER_SAWYER_4, TRAINER_SAWYER_5}, 0x18, 0xc}, - {{TRAINER_KIRA_AND_DAN_1, TRAINER_KIRA_AND_DAN_2, TRAINER_KIRA_AND_DAN_3, TRAINER_KIRA_AND_DAN_4, TRAINER_KIRA_AND_DAN_5}, 0x18, 0x3e}, - // Wally's entry index is hardcoded. - [REMATCH_WALLY_ENTRY] = {{TRAINER_WALLY_3, TRAINER_WALLY_4, TRAINER_WALLY_5, TRAINER_WALLY_6, TRAINER_WALLY_6}, 0x18, 0x2b}, - {{TRAINER_ROXANNE_1, TRAINER_ROXANNE_2, TRAINER_ROXANNE_3, TRAINER_ROXANNE_4, TRAINER_ROXANNE_5}, 0x0, 0x3}, - {{TRAINER_BRAWLY_1, TRAINER_BRAWLY_2, TRAINER_BRAWLY_3, TRAINER_BRAWLY_4, TRAINER_BRAWLY_5}, 0x0, 0xb}, - {{TRAINER_WATTSON_1, TRAINER_WATTSON_2, TRAINER_WATTSON_3, TRAINER_WATTSON_4, TRAINER_WATTSON_5}, 0x0, 0x2}, - {{TRAINER_FLANNERY_1, TRAINER_FLANNERY_2, TRAINER_FLANNERY_3, TRAINER_FLANNERY_4, TRAINER_FLANNERY_5}, 0x0, 0xc}, - {{TRAINER_NORMAN_1, TRAINER_NORMAN_2, TRAINER_NORMAN_3, TRAINER_NORMAN_4, TRAINER_NORMAN_5}, 0x0, 0x0}, - {{TRAINER_WINONA_1, TRAINER_WINONA_2, TRAINER_WINONA_3, TRAINER_WINONA_4, TRAINER_WINONA_5}, 0x0, 0x4}, - {{TRAINER_TATE_AND_LIZA_1, TRAINER_TATE_AND_LIZA_2, TRAINER_TATE_AND_LIZA_3, TRAINER_TATE_AND_LIZA_4, TRAINER_TATE_AND_LIZA_5}, 0x0, 0x6}, - {{TRAINER_JUAN_1, TRAINER_JUAN_2, TRAINER_JUAN_3, TRAINER_JUAN_4, TRAINER_JUAN_5}, 0x0, 0x7}, - - [REMATCH_ELITE_FOUR_ENTRIES] = {{TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY}, 0x0, 0x8}, - {{TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE}, 0x0, 0x8}, - {{TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA}, 0x0, 0x8}, - {{TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE}, 0x0, 0x8}, - {{TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE}, 0x0, 0x8}, + [REMATCH_ROSE] = {{TRAINER_ROSE_1, TRAINER_ROSE_2, TRAINER_ROSE_3, TRAINER_ROSE_4, TRAINER_ROSE_5}, 0x0, 0x21}, + [REMATCH_ANDRES] = {{TRAINER_ANDRES_1, TRAINER_ANDRES_2, TRAINER_ANDRES_3, TRAINER_ANDRES_4, TRAINER_ANDRES_5}, 0x0, 0x14}, + [REMATCH_DUSTY] = {{TRAINER_DUSTY_1, TRAINER_DUSTY_2, TRAINER_DUSTY_3, TRAINER_DUSTY_4, TRAINER_DUSTY_5}, 0x0, 0x1a}, + [REMATCH_LOLA] = {{TRAINER_LOLA_1, TRAINER_LOLA_2, TRAINER_LOLA_3, TRAINER_LOLA_4, TRAINER_LOLA_5}, 0x0, 0x18}, + [REMATCH_RICKY] = {{TRAINER_RICKY_1, TRAINER_RICKY_2, TRAINER_RICKY_3, TRAINER_RICKY_4, TRAINER_RICKY_5}, 0x0, 0x18}, + [REMATCH_LILA_AND_ROY] = {{TRAINER_LILA_AND_ROY_1, TRAINER_LILA_AND_ROY_2, TRAINER_LILA_AND_ROY_3, TRAINER_LILA_AND_ROY_4, TRAINER_LILA_AND_ROY_5}, 0x0, 0x27}, + [REMATCH_CRISTIN] = {{TRAINER_CRISTIN_1, TRAINER_CRISTIN_2, TRAINER_CRISTIN_3, TRAINER_CRISTIN_4, TRAINER_CRISTIN_5}, 0x0, 0x24}, + [REMATCH_BROOKE] = {{TRAINER_BROOKE_1, TRAINER_BROOKE_2, TRAINER_BROOKE_3, TRAINER_BROOKE_4, TRAINER_BROOKE_5}, 0x0, 0x1a}, + [REMATCH_WILTON] = {{TRAINER_WILTON_1, TRAINER_WILTON_2, TRAINER_WILTON_3, TRAINER_WILTON_4, TRAINER_WILTON_5}, 0x0, 0x1a}, + [REMATCH_VALERIE] = {{TRAINER_VALERIE_1, TRAINER_VALERIE_2, TRAINER_VALERIE_3, TRAINER_VALERIE_4, TRAINER_VALERIE_5}, 0x18, 0x14}, + [REMATCH_CINDY] = {{TRAINER_CINDY_1, TRAINER_CINDY_3, TRAINER_CINDY_4, TRAINER_CINDY_5, TRAINER_CINDY_6}, 0x0, 0x13}, + [REMATCH_THALIA] = {{TRAINER_THALIA_1, TRAINER_THALIA_2, TRAINER_THALIA_3, TRAINER_THALIA_4, TRAINER_THALIA_5}, 0x18, 0x38}, + [REMATCH_JESSICA] = {{TRAINER_JESSICA_1, TRAINER_JESSICA_2, TRAINER_JESSICA_3, TRAINER_JESSICA_4, TRAINER_JESSICA_5}, 0x0, 0x24}, + [REMATCH_WINSTON] = {{TRAINER_WINSTON_1, TRAINER_WINSTON_2, TRAINER_WINSTON_3, TRAINER_WINSTON_4, TRAINER_WINSTON_5}, 0x0, 0x13}, + [REMATCH_STEVE] = {{TRAINER_STEVE_1, TRAINER_STEVE_2, TRAINER_STEVE_3, TRAINER_STEVE_4, TRAINER_STEVE_5}, 0x0, 0x1d}, + [REMATCH_TONY] = {{TRAINER_TONY_1, TRAINER_TONY_2, TRAINER_TONY_3, TRAINER_TONY_4, TRAINER_TONY_5}, 0x0, 0x16}, + [REMATCH_NOB] = {{TRAINER_NOB_1, TRAINER_NOB_2, TRAINER_NOB_3, TRAINER_NOB_4, TRAINER_NOB_5}, 0x0, 0x1e}, + [REMATCH_KOJI] = {{TRAINER_KOJI_1, TRAINER_KOJI_2, TRAINER_KOJI_3, TRAINER_KOJI_4, TRAINER_KOJI_5}, 0x0, 0x2a}, + [REMATCH_FERNANDO] = {{TRAINER_FERNANDO_1, TRAINER_FERNANDO_2, TRAINER_FERNANDO_3, TRAINER_FERNANDO_4, TRAINER_FERNANDO_5}, 0x0, 0x26}, + [REMATCH_DALTON] = {{TRAINER_DALTON_1, TRAINER_DALTON_2, TRAINER_DALTON_3, TRAINER_DALTON_4, TRAINER_DALTON_5}, 0x0, 0x21}, + [REMATCH_BERNIE] = {{TRAINER_BERNIE_1, TRAINER_BERNIE_2, TRAINER_BERNIE_3, TRAINER_BERNIE_4, TRAINER_BERNIE_5}, 0x0, 0x1d}, + [REMATCH_ETHAN] = {{TRAINER_ETHAN_1, TRAINER_ETHAN_2, TRAINER_ETHAN_3, TRAINER_ETHAN_4, TRAINER_ETHAN_5}, 0x18, 0xd}, + [REMATCH_JOHN_AND_JAY] = {{TRAINER_JOHN_AND_JAY_1, TRAINER_JOHN_AND_JAY_2, TRAINER_JOHN_AND_JAY_3, TRAINER_JOHN_AND_JAY_4, TRAINER_JOHN_AND_JAY_5}, 0x18, 0x1}, + [REMATCH_JEFFREY] = {{TRAINER_JEFFREY_1, TRAINER_JEFFREY_2, TRAINER_JEFFREY_3, TRAINER_JEFFREY_4, TRAINER_JEFFREY_5}, 0x0, 0x23}, + [REMATCH_CAMERON] = {{TRAINER_CAMERON_1, TRAINER_CAMERON_2, TRAINER_CAMERON_3, TRAINER_CAMERON_4, TRAINER_CAMERON_5}, 0x0, 0x26}, + [REMATCH_JACKI] = {{TRAINER_JACKI_1, TRAINER_JACKI_2, TRAINER_JACKI_3, TRAINER_JACKI_4, TRAINER_JACKI_5}, 0x0, 0x26}, + [REMATCH_WALTER] = {{TRAINER_WALTER_1, TRAINER_WALTER_2, TRAINER_WALTER_3, TRAINER_WALTER_4, TRAINER_WALTER_5}, 0x0, 0x24}, + [REMATCH_KAREN] = {{TRAINER_KAREN_1, TRAINER_KAREN_2, TRAINER_KAREN_3, TRAINER_KAREN_4, TRAINER_KAREN_5}, 0x0, 0x1f}, + [REMATCH_JERRY] = {{TRAINER_JERRY_1, TRAINER_JERRY_2, TRAINER_JERRY_3, TRAINER_JERRY_4, TRAINER_JERRY_5}, 0x0, 0x1f}, + [REMATCH_ANNA_AND_MEG] = {{TRAINER_ANNA_AND_MEG_1, TRAINER_ANNA_AND_MEG_2, TRAINER_ANNA_AND_MEG_3, TRAINER_ANNA_AND_MEG_4, TRAINER_ANNA_AND_MEG_5}, 0x0, 0x20}, + [REMATCH_ISABEL] = {{TRAINER_ISABEL_1, TRAINER_ISABEL_2, TRAINER_ISABEL_3, TRAINER_ISABEL_4, TRAINER_ISABEL_5}, 0x0, 0x19}, + [REMATCH_MIGUEL] = {{TRAINER_MIGUEL_1, TRAINER_MIGUEL_2, TRAINER_MIGUEL_3, TRAINER_MIGUEL_4, TRAINER_MIGUEL_5}, 0x0, 0x12}, + [REMATCH_TIMOTHY] = {{TRAINER_TIMOTHY_1, TRAINER_TIMOTHY_2, TRAINER_TIMOTHY_3, TRAINER_TIMOTHY_4, TRAINER_TIMOTHY_5}, 0x0, 0x1e}, + [REMATCH_SHELBY] = {{TRAINER_SHELBY_1, TRAINER_SHELBY_2, TRAINER_SHELBY_3, TRAINER_SHELBY_4, TRAINER_SHELBY_5}, 0x18, 0xc}, + [REMATCH_CALVIN] = {{TRAINER_CALVIN_1, TRAINER_CALVIN_2, TRAINER_CALVIN_3, TRAINER_CALVIN_4, TRAINER_CALVIN_5}, 0x0, 0x11}, + [REMATCH_ELLIOT] = {{TRAINER_ELLIOT_1, TRAINER_ELLIOT_2, TRAINER_ELLIOT_3, TRAINER_ELLIOT_4, TRAINER_ELLIOT_5}, 0x0, 0x15}, + [REMATCH_ISAIAH] = {{TRAINER_ISAIAH_1, TRAINER_ISAIAH_2, TRAINER_ISAIAH_3, TRAINER_ISAIAH_4, TRAINER_ISAIAH_5}, 0x0, 0x2b}, + [REMATCH_MARIA] = {{TRAINER_MARIA_1, TRAINER_MARIA_2, TRAINER_MARIA_3, TRAINER_MARIA_4, TRAINER_MARIA_5}, 0x0, 0x20}, + [REMATCH_ABIGAIL] = {{TRAINER_ABIGAIL_1, TRAINER_ABIGAIL_2, TRAINER_ABIGAIL_3, TRAINER_ABIGAIL_4, TRAINER_ABIGAIL_5}, 0x0, 0x19}, + [REMATCH_DYLAN] = {{TRAINER_DYLAN_1, TRAINER_DYLAN_2, TRAINER_DYLAN_3, TRAINER_DYLAN_4, TRAINER_DYLAN_5}, 0x0, 0x20}, + [REMATCH_KATELYN] = {{TRAINER_KATELYN_1, TRAINER_KATELYN_2, TRAINER_KATELYN_3, TRAINER_KATELYN_4, TRAINER_KATELYN_5}, 0x0, 0x2b}, + [REMATCH_BENJAMIN] = {{TRAINER_BENJAMIN_1, TRAINER_BENJAMIN_2, TRAINER_BENJAMIN_3, TRAINER_BENJAMIN_4, TRAINER_BENJAMIN_5}, 0x0, 0x19}, + [REMATCH_PABLO] = {{TRAINER_PABLO_1, TRAINER_PABLO_2, TRAINER_PABLO_3, TRAINER_PABLO_4, TRAINER_PABLO_5}, 0x0, 0x29}, + [REMATCH_NICOLAS] = {{TRAINER_NICOLAS_1, TRAINER_NICOLAS_2, TRAINER_NICOLAS_3, TRAINER_NICOLAS_4, TRAINER_NICOLAS_5}, 0x18, 0x1}, + [REMATCH_ROBERT] = {{TRAINER_ROBERT_1, TRAINER_ROBERT_2, TRAINER_ROBERT_3, TRAINER_ROBERT_4, TRAINER_ROBERT_5}, 0x0, 0x23}, + [REMATCH_LAO] = {{TRAINER_LAO_1, TRAINER_LAO_2, TRAINER_LAO_3, TRAINER_LAO_4, TRAINER_LAO_5}, 0x0, 0x1c}, + [REMATCH_CYNDY] = {{TRAINER_CYNDY_1, TRAINER_CYNDY_2, TRAINER_CYNDY_3, TRAINER_CYNDY_4, TRAINER_CYNDY_5}, 0x0, 0x1e}, + [REMATCH_MADELINE] = {{TRAINER_MADELINE_1, TRAINER_MADELINE_2, TRAINER_MADELINE_3, TRAINER_MADELINE_4, TRAINER_MADELINE_5}, 0x0, 0x1c}, + [REMATCH_JENNY] = {{TRAINER_JENNY_1, TRAINER_JENNY_2, TRAINER_JENNY_3, TRAINER_JENNY_4, TRAINER_JENNY_5}, 0x0, 0x27}, + [REMATCH_DIANA] = {{TRAINER_DIANA_1, TRAINER_DIANA_2, TRAINER_DIANA_3, TRAINER_DIANA_4, TRAINER_DIANA_5}, 0x18, 0xd}, + [REMATCH_AMY_AND_LIV] = {{TRAINER_AMY_AND_LIV_1, TRAINER_AMY_AND_LIV_2, TRAINER_AMY_AND_LIV_4, TRAINER_AMY_AND_LIV_5, TRAINER_AMY_AND_LIV_6}, 0x0, 0x12}, + [REMATCH_ERNEST] = {{TRAINER_ERNEST_1, TRAINER_ERNEST_2, TRAINER_ERNEST_3, TRAINER_ERNEST_4, TRAINER_ERNEST_5}, 0x0, 0x28}, + [REMATCH_CORY] = {{TRAINER_CORY_1, TRAINER_CORY_2, TRAINER_CORY_3, TRAINER_CORY_4, TRAINER_CORY_5}, 0x0, 0x17}, + [REMATCH_EDWIN] = {{TRAINER_EDWIN_1, TRAINER_EDWIN_2, TRAINER_EDWIN_3, TRAINER_EDWIN_4, TRAINER_EDWIN_5}, 0x0, 0x19}, + [REMATCH_LYDIA] = {{TRAINER_LYDIA_1, TRAINER_LYDIA_2, TRAINER_LYDIA_3, TRAINER_LYDIA_4, TRAINER_LYDIA_5}, 0x0, 0x20}, + [REMATCH_ISAAC] = {{TRAINER_ISAAC_1, TRAINER_ISAAC_2, TRAINER_ISAAC_3, TRAINER_ISAAC_4, TRAINER_ISAAC_5}, 0x0, 0x20}, + [REMATCH_GABRIELLE] = {{TRAINER_GABRIELLE_1, TRAINER_GABRIELLE_2, TRAINER_GABRIELLE_3, TRAINER_GABRIELLE_4, TRAINER_GABRIELLE_5}, 0x18, 0x11}, + [REMATCH_CATHERINE] = {{TRAINER_CATHERINE_1, TRAINER_CATHERINE_2, TRAINER_CATHERINE_3, TRAINER_CATHERINE_4, TRAINER_CATHERINE_5}, 0x0, 0x22}, + [REMATCH_JACKSON] = {{TRAINER_JACKSON_1, TRAINER_JACKSON_2, TRAINER_JACKSON_3, TRAINER_JACKSON_4, TRAINER_JACKSON_5}, 0x0, 0x22}, + [REMATCH_HALEY] = {{TRAINER_HALEY_1, TRAINER_HALEY_2, TRAINER_HALEY_3, TRAINER_HALEY_4, TRAINER_HALEY_5}, 0x0, 0x13}, + [REMATCH_JAMES] = {{TRAINER_JAMES_1, TRAINER_JAMES_2, TRAINER_JAMES_3, TRAINER_JAMES_4, TRAINER_JAMES_5}, 0x18, 0xb}, + [REMATCH_TRENT] = {{TRAINER_TRENT_1, TRAINER_TRENT_2, TRAINER_TRENT_3, TRAINER_TRENT_4, TRAINER_TRENT_5}, 0x0, 0x1b}, + [REMATCH_SAWYER] = {{TRAINER_SAWYER_1, TRAINER_SAWYER_2, TRAINER_SAWYER_3, TRAINER_SAWYER_4, TRAINER_SAWYER_5}, 0x18, 0xc}, + [REMATCH_KIRA_AND_DAN] = {{TRAINER_KIRA_AND_DAN_1, TRAINER_KIRA_AND_DAN_2, TRAINER_KIRA_AND_DAN_3, TRAINER_KIRA_AND_DAN_4, TRAINER_KIRA_AND_DAN_5}, 0x18, 0x3e}, + [REMATCH_WALLY_3] = {{TRAINER_WALLY_3, TRAINER_WALLY_4, TRAINER_WALLY_5, TRAINER_WALLY_6, TRAINER_WALLY_6}, 0x18, 0x2b}, + [REMATCH_ROXANNE] = {{TRAINER_ROXANNE_1, TRAINER_ROXANNE_2, TRAINER_ROXANNE_3, TRAINER_ROXANNE_4, TRAINER_ROXANNE_5}, 0x0, 0x3}, + [REMATCH_BRAWLY] = {{TRAINER_BRAWLY_1, TRAINER_BRAWLY_2, TRAINER_BRAWLY_3, TRAINER_BRAWLY_4, TRAINER_BRAWLY_5}, 0x0, 0xb}, + [REMATCH_WATTSON] = {{TRAINER_WATTSON_1, TRAINER_WATTSON_2, TRAINER_WATTSON_3, TRAINER_WATTSON_4, TRAINER_WATTSON_5}, 0x0, 0x2}, + [REMATCH_FLANNERY] = {{TRAINER_FLANNERY_1, TRAINER_FLANNERY_2, TRAINER_FLANNERY_3, TRAINER_FLANNERY_4, TRAINER_FLANNERY_5}, 0x0, 0xc}, + [REMATCH_NORMAN] = {{TRAINER_NORMAN_1, TRAINER_NORMAN_2, TRAINER_NORMAN_3, TRAINER_NORMAN_4, TRAINER_NORMAN_5}, 0x0, 0x0}, + [REMATCH_WINONA] = {{TRAINER_WINONA_1, TRAINER_WINONA_2, TRAINER_WINONA_3, TRAINER_WINONA_4, TRAINER_WINONA_5}, 0x0, 0x4}, + [REMATCH_TATE_AND_LIZA] = {{TRAINER_TATE_AND_LIZA_1, TRAINER_TATE_AND_LIZA_2, TRAINER_TATE_AND_LIZA_3, TRAINER_TATE_AND_LIZA_4, TRAINER_TATE_AND_LIZA_5}, 0x0, 0x6}, + [REMATCH_JUAN] = {{TRAINER_JUAN_1, TRAINER_JUAN_2, TRAINER_JUAN_3, TRAINER_JUAN_4, TRAINER_JUAN_5}, 0x0, 0x7}, + [REMATCH_SIDNEY] = {{TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY, TRAINER_SIDNEY}, 0x0, 0x8}, + [REMATCH_PHOEBE] = {{TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE, TRAINER_PHOEBE}, 0x0, 0x8}, + [REMATCH_GLACIA] = {{TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA, TRAINER_GLACIA}, 0x0, 0x8}, + [REMATCH_DRAKE] = {{TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE, TRAINER_DRAKE}, 0x0, 0x8}, + [REMATCH_WALLACE] = {{TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE, TRAINER_WALLACE}, 0x0, 0x8}, }; static const u16 sBadgeFlags[8] = @@ -1547,7 +1545,7 @@ static bool32 sub_80B1D94(s32 rematchTableId) { if (rematchTableId >= REMATCH_ELITE_FOUR_ENTRIES) return TRUE; - else if (rematchTableId == REMATCH_WALLY_ENTRY) + else if (rematchTableId == REMATCH_WALLY_3) return (FlagGet(FLAG_DEFEATED_WALLY_VICTORY_ROAD) == FALSE); else return FALSE; @@ -1575,7 +1573,7 @@ static bool32 UpdateRandomTrainerRematches(const struct RematchTrainer *table, u s32 i; bool32 ret = FALSE; - for (i = 0; i <= REMATCH_WALLY_ENTRY; i++) + for (i = 0; i <= REMATCH_WALLY_3; i++) { if (table[i].mapGroup == mapGroup && table[i].mapNum == mapNum && !sub_80B1D94(i)) { diff --git a/src/pokenav_match_call.c b/src/pokenav_match_call.c index 0a21c4edc..ce00401a9 100644 --- a/src/pokenav_match_call.c +++ b/src/pokenav_match_call.c @@ -73,22 +73,17 @@ struct MatchCallStruct4 { const match_call_text_data_t *textData; }; +// Note: Type1 and Type5 have identical struct layouts. struct MatchCallStruct5 { u8 type; u8 v1; u16 flag; - u16 v4; + u16 rematchTableIdx; const u8 *desc; const u8 *name; const match_call_text_data_t *textData; }; -#define MATCHCALLDEF(name, type_, ...) \ -static const struct MatchCallStruct##type_ name = { \ - .type = type_, \ - __VA_ARGS__ \ -}; - typedef union { const struct MatchCallStructCommon *common; const struct MatchCallStruct0 *type0; @@ -328,7 +323,15 @@ static const match_call_text_data_t sMrStoneTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sMrStoneMatchCallHeader, 0, 10, 0xffff, gMrStoneMatchCallDesc, gMrStoneMatchCallName, sMrStoneTextScripts); +static const struct MatchCallStruct0 sMrStoneMatchCallHeader = +{ + .type = 0, + .v1 = 10, + .flag = 0xFFFF, + .desc = gMrStoneMatchCallDesc, + .name = gMrStoneMatchCallName, + .textData = sMrStoneTextScripts +}; static const match_call_text_data_t sNormanTextScripts[] = { { gText_Norman_Pokenav_2B5719, FLAG_ENABLE_NORMAN_MATCH_CALL, 0xFFFF }, @@ -343,9 +346,25 @@ static const match_call_text_data_t sNormanTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sNormanMatchCallHeader, 5, 7, FLAG_ENABLE_NORMAN_MATCH_CALL, 0x45, gNormanMatchCallDesc, gNormanMatchCallName, sNormanTextScripts); +static const struct MatchCallStruct5 sNormanMatchCallHeader = +{ + .type = 5, + .v1 = 7, + .flag = FLAG_ENABLE_NORMAN_MATCH_CALL, + .rematchTableIdx = REMATCH_NORMAN, + .desc = gNormanMatchCallDesc, + .name = gNormanMatchCallName, + .textData = sNormanTextScripts +}; -MATCHCALLDEF(sProfBirchMatchCallHeader, 3, 0, FLAG_ENABLE_PROF_BIRCH_MATCH_CALL, gProfBirchMatchCallDesc, gProfBirchMatchCallName) +static const struct MatchCallStruct3 sProfBirchMatchCallHeader = +{ + .type = 3, + .v1 = 0, + .flag = FLAG_ENABLE_PROF_BIRCH_MATCH_CALL, + .desc = gProfBirchMatchCallDesc, + .name = gProfBirchMatchCallName +}; static const match_call_text_data_t sMomTextScripts[] = { { gText_Mom_Pokenav_2B227B, 0xffff, 0xffff }, @@ -354,7 +373,15 @@ static const match_call_text_data_t sMomTextScripts[] = { { NULL, 0xffff, 0xffff } }; -MATCHCALLDEF(sMomMatchCallHeader, 0, 0, FLAG_ENABLE_MOM_MATCH_CALL, gMomMatchCallDesc, gMomMatchCallName, sMomTextScripts); +static const struct MatchCallStruct0 sMomMatchCallHeader = +{ + .type = 0, + .v1 = 0, + .flag = FLAG_ENABLE_MOM_MATCH_CALL, + .desc = gMomMatchCallDesc, + .name = gMomMatchCallName, + .textData = sMomTextScripts +}; static const match_call_text_data_t sStevenTextScripts[] = { { gText_Steven_Pokenav_2B5B95, 0xffff, 0xffff }, @@ -367,7 +394,15 @@ static const match_call_text_data_t sStevenTextScripts[] = { { NULL, 0xffff, 0xffff }, }; -MATCHCALLDEF(sStevenMatchCallHeader, 0, 0xd5, FLAG_REGISTERED_STEVEN_POKENAV, gStevenMatchCallDesc, gStevenMatchCallName, sStevenTextScripts); +static const struct MatchCallStruct0 sStevenMatchCallHeader = +{ + .type = 0, + .v1 = 0xD5, + .flag = FLAG_REGISTERED_STEVEN_POKENAV, + .desc = gStevenMatchCallDesc, + .name = gStevenMatchCallName, + .textData = sStevenTextScripts +}; static const match_call_text_data_t sMayTextScripts[] = { { gText_May_Pokenav_2B3AB3, 0xFFFF, 0xFFFF }, @@ -388,7 +423,15 @@ static const match_call_text_data_t sMayTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sMayMatchCallHeader, 4, MALE, FLAG_ENABLE_RIVAL_MATCH_CALL, gMayBrendanMatchCallDesc, gExpandedPlaceholder_May, sMayTextScripts); +static const struct MatchCallStruct4 sMayMatchCallHeader = +{ + .type = 4, + .gender = MALE, + .flag = FLAG_ENABLE_RIVAL_MATCH_CALL, + .desc = gMayBrendanMatchCallDesc, + .name = gExpandedPlaceholder_May, + .textData = sMayTextScripts +}; static const match_call_text_data_t sBrendanTextScripts[] = { { gText_Brendan_Pokenav_2B43EF, 0xFFFF, 0xFFFF }, @@ -409,7 +452,15 @@ static const match_call_text_data_t sBrendanTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sBrendanMatchCallHeader, 4, FEMALE, FLAG_ENABLE_RIVAL_MATCH_CALL, gMayBrendanMatchCallDesc, gExpandedPlaceholder_Brendan, sBrendanTextScripts); +static const struct MatchCallStruct4 sBrendanMatchCallHeader = +{ + .type = 4, + .gender = FEMALE, + .flag = FLAG_ENABLE_RIVAL_MATCH_CALL, + .desc = gMayBrendanMatchCallDesc, + .name = gExpandedPlaceholder_Brendan, + .textData = sBrendanTextScripts +}; static const match_call_text_data_t sWallyTextScripts[] = { { gText_Wally_Pokenav_2B4DE2, 0xFFFF, 0xFFFF }, @@ -429,7 +480,16 @@ const struct MatchCallSubstruct2 sWallyAdditionalData[] = { { 0xFFFF, 0xD5 } }; -MATCHCALLDEF(sWallyMatchCallHeader, 2, 0, FLAG_ENABLE_WALLY_MATCH_CALL, REMATCH_WALLY_3, gWallyMatchCallDesc, sWallyTextScripts, sWallyAdditionalData); +static const struct MatchCallStruct2 sWallyMatchCallHeader = +{ + .type = 2, + .v1 = 0, + .flag = FLAG_ENABLE_WALLY_MATCH_CALL, + .rematchTableIdx = REMATCH_WALLY_3, + .desc = gWallyMatchCallDesc, + .textData = sWallyTextScripts, + .v10 = sWallyAdditionalData +}; static const match_call_text_data_t sScottTextScripts[] = { { gText_Scott_Pokenav_2B5184, 0xFFFF, 0xFFFF }, @@ -443,7 +503,15 @@ static const match_call_text_data_t sScottTextScripts[] = { }; -MATCHCALLDEF(sScottMatchCallHeader, 0, 0xD5, FLAG_ENABLE_SCOTT_MATCH_CALL, gScottMatchCallDesc, gScottMatchCallName, sScottTextScripts); +static const struct MatchCallStruct0 sScottMatchCallHeader = +{ + .type = 0, + .v1 = 0xD5, + .flag = FLAG_ENABLE_SCOTT_MATCH_CALL, + .desc = gScottMatchCallDesc, + .name = gScottMatchCallName, + .textData = sScottTextScripts +}; static const match_call_text_data_t sRoxanneTextScripts[] = { { gText_Roxanne_Pokenav_2B2456, 0xFFFE, 0xFFFF }, @@ -453,7 +521,16 @@ static const match_call_text_data_t sRoxanneTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sRoxanneMatchCallHeader, 5, 10, FLAG_ENABLE_ROXANNE_MATCH_CALL, 0x41, gRoxanneMatchCallDesc, NULL, sRoxanneTextScripts); +static const struct MatchCallStruct5 sRoxanneMatchCallHeader = +{ + .type = 5, + .v1 = 10, + .flag = FLAG_ENABLE_ROXANNE_MATCH_CALL, + .rematchTableIdx = REMATCH_ROXANNE, + .desc = gRoxanneMatchCallDesc, + .name = NULL, + .textData = sRoxanneTextScripts +}; static const match_call_text_data_t sBrawlyTextScripts[] = { { gText_Brawly_Pokenav_2B2659, 0xFFFE, 0xFFFF }, @@ -463,7 +540,16 @@ static const match_call_text_data_t sBrawlyTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sBrawlyMatchCallHeader, 5, 2, FLAG_ENABLE_BRAWLY_MATCH_CALL, 0x42, gBrawlyMatchCallDesc, NULL, sBrawlyTextScripts); +static const struct MatchCallStruct5 sBrawlyMatchCallHeader = +{ + .type = 5, + .v1 = 2, + .flag = FLAG_ENABLE_BRAWLY_MATCH_CALL, + .rematchTableIdx = REMATCH_BRAWLY, + .desc = gBrawlyMatchCallDesc, + .name = NULL, + .textData = sBrawlyTextScripts +}; static const match_call_text_data_t sWattsonTextScripts[] = { { gText_Wattson_Pokenav_2B2912, 0xFFFE, 0xFFFF }, @@ -473,7 +559,16 @@ static const match_call_text_data_t sWattsonTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sWattsonMatchCallHeader, 5, 9, FLAG_ENABLE_WATTSON_MATCH_CALL, 0x43, gWattsonMatchCallDesc, NULL, sWattsonTextScripts); +static const struct MatchCallStruct5 sWattsonMatchCallHeader = +{ + .type = 5, + .v1 = 9, + .flag = FLAG_ENABLE_WATTSON_MATCH_CALL, + .rematchTableIdx = REMATCH_WATTSON, + .desc = gWattsonMatchCallDesc, + .name = NULL, + .textData = sWattsonTextScripts +}; static const match_call_text_data_t sFlanneryTextScripts[] = { { gText_Flannery_Pokenav_2B2B4D, 0xFFFE, 0xFFFF }, @@ -483,7 +578,16 @@ static const match_call_text_data_t sFlanneryTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sFlanneryMatchCallHeader, 5, 3, FLAG_ENABLE_FLANNERY_MATCH_CALL, 0x44, gFlanneryMatchCallDesc, NULL, sFlanneryTextScripts); +static const struct MatchCallStruct5 sFlanneryMatchCallHeader = +{ + .type = 5, + .v1 = 3, + .flag = FLAG_ENABLE_FLANNERY_MATCH_CALL, + .rematchTableIdx = REMATCH_FLANNERY, + .desc = gFlanneryMatchCallDesc, + .name = NULL, + .textData = sFlanneryTextScripts +}; static const match_call_text_data_t sWinonaTextScripts[] = { { gText_Winona_Pokenav_2B2DA4, 0xFFFE, 0xFFFF }, @@ -493,7 +597,16 @@ static const match_call_text_data_t sWinonaTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sWinonaMatchCallHeader, 5, 11, FLAG_ENABLE_WINONA_MATCH_CALL, 0x46, gWinonaMatchCallDesc, NULL, sWinonaTextScripts); +static const struct MatchCallStruct5 sWinonaMatchCallHeader = +{ + .type = 5, + .v1 = 11, + .flag = FLAG_ENABLE_WINONA_MATCH_CALL, + .rematchTableIdx = REMATCH_WINONA, + .desc = gWinonaMatchCallDesc, + .name = NULL, + .textData = sWinonaTextScripts +}; static const match_call_text_data_t sTateLizaTextScripts[] = { { gText_TateLiza_Pokenav_2B2F97, 0xFFFE, 0xFFFF }, @@ -503,7 +616,16 @@ static const match_call_text_data_t sTateLizaTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sTateLizaMatchCallHeader, 5, 13, FLAG_ENABLE_TATE_AND_LIZA_MATCH_CALL, 0x47, gTateLizaMatchCallDesc, NULL, sTateLizaTextScripts); +static const struct MatchCallStruct5 sTateLizaMatchCallHeader = +{ + .type = 5, + .v1 = 13, + .flag = FLAG_ENABLE_TATE_AND_LIZA_MATCH_CALL, + .rematchTableIdx = REMATCH_TATE_AND_LIZA, + .desc = gTateLizaMatchCallDesc, + .name = NULL, + .textData = sTateLizaTextScripts +}; static const match_call_text_data_t sJuanTextScripts[] = { { gText_Juan_Pokenav_2B3249, 0xFFFE, 0xFFFF }, @@ -513,42 +635,96 @@ static const match_call_text_data_t sJuanTextScripts[] = { { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sJuanMatchCallHeader, 5, 14, FLAG_ENABLE_JUAN_MATCH_CALL, 0x48, gJuanMatchCallDesc, NULL, sJuanTextScripts); +static const struct MatchCallStruct5 sJuanMatchCallHeader = +{ + .type = 5, + .v1 = 14, + .flag = FLAG_ENABLE_JUAN_MATCH_CALL, + .rematchTableIdx = REMATCH_JUAN, + .desc = gJuanMatchCallDesc, + .name = NULL, + .textData = sJuanTextScripts +}; static const match_call_text_data_t sSidneyTextScripts[] = { { gText_Sidney_Pokenav_2B34CC, 0xFFFF, 0xFFFF }, { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sSidneyMatchCallHeader, 5, 15, FLAG_REMATCH_JUAN, 0x49, gEliteFourMatchCallDesc, NULL, sSidneyTextScripts); +static const struct MatchCallStruct5 sSidneyMatchCallHeader = +{ + .type = 5, + .v1 = 15, + .flag = FLAG_REMATCH_SIDNEY, + .rematchTableIdx = REMATCH_SIDNEY, + .desc = gEliteFourMatchCallDesc, + .name = NULL, + .textData = sSidneyTextScripts +}; static const match_call_text_data_t sPhoebeTextScripts[] = { { gText_Phoebe_Pokenav_2B3561, 0xFFFF, 0xFFFF }, { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sPhoebeMatchCallHeader, 5, 15, FLAG_REMATCH_SIDNEY, 0x4A, gEliteFourMatchCallDesc, NULL, sPhoebeTextScripts); +static const struct MatchCallStruct5 sPhoebeMatchCallHeader = +{ + .type = 5, + .v1 = 15, + .flag = FLAG_REMATCH_PHOEBE, + .rematchTableIdx = REMATCH_PHOEBE, + .desc = gEliteFourMatchCallDesc, + .name = NULL, + .textData = sPhoebeTextScripts +}; static const match_call_text_data_t sGlaciaTextScripts[] = { { gText_Glacia_Pokenav_2B35E4, 0xFFFF, 0xFFFF }, { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sGlaciaMatchCallHeader, 5, 15, FLAG_REMATCH_PHOEBE, 0x4B, gEliteFourMatchCallDesc, NULL, sGlaciaTextScripts); +static const struct MatchCallStruct5 sGlaciaMatchCallHeader = +{ + .type = 5, + .v1 = 15, + .flag = FLAG_REMATCH_GLACIA, + .rematchTableIdx = REMATCH_GLACIA, + .desc = gEliteFourMatchCallDesc, + .name = NULL, + .textData = sGlaciaTextScripts +}; static const match_call_text_data_t sDrakeTextScripts[] = { { gText_Drake_Pokenav_2B368B, 0xFFFF, 0xFFFF }, { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sDrakeMatchCallHeader, 5, 15, FLAG_REMATCH_GLACIA, 0x4C, gEliteFourMatchCallDesc, NULL, sDrakeTextScripts); +static const struct MatchCallStruct5 sDrakeMatchCallHeader = +{ + .type = 5, + .v1 = 15, + .flag = FLAG_REMATCH_DRAKE, + .rematchTableIdx = REMATCH_DRAKE, + .desc = gEliteFourMatchCallDesc, + .name = NULL, + .textData = sDrakeTextScripts +}; static const match_call_text_data_t sWallaceTextScripts[] = { { gText_Wallace_Pokenav_2B3790, 0xFFFF, 0xFFFF }, { NULL, 0xFFFF, 0xFFFF } }; -MATCHCALLDEF(sWallaceMatchCallHeader, 5, 15, FLAG_REMATCH_DRAKE, 0x4D, gChampionMatchCallDesc, NULL, sWallaceTextScripts); +static const struct MatchCallStruct5 sWallaceMatchCallHeader = +{ + .type = 5, + .v1 = 15, + .flag = FLAG_REMATCH_WALLACE, + .rematchTableIdx = REMATCH_WALLACE, + .desc = gChampionMatchCallDesc, + .name = NULL, + .textData = sWallaceTextScripts +}; static const match_call_t sMatchCallHeaders[] = { {.type0 = &sMrStoneMatchCallHeader}, @@ -906,9 +1082,9 @@ static void MatchCall_GetMessage_Type0(match_call_t matchCall, u8 *dest) static void MatchCall_GetMessage_Type1(match_call_t matchCall, u8 *dest) { if (matchCall.common->type != 5) - sub_81D1920(matchCall.type5->textData, dest); + sub_81D1920(matchCall.type1->textData, dest); else - sub_81D199C(matchCall.type1->textData, matchCall.type1->rematchTableIdx, dest); + sub_81D199C(matchCall.type5->textData, matchCall.type5->rematchTableIdx, dest); } static void MatchCall_GetMessage_Type2(match_call_t matchCall, u8 *dest) From 9f44ebc5cd2b3088469f188c355db4fe905d299a Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Tue, 2 Apr 2019 03:27:05 -0400 Subject: [PATCH 057/101] Automatically calculate REMATCH_TABLE_ENTRIES Uses the standard C way of calculating the length of an enum. --- include/battle_setup.h | 1 - include/gym_leader_rematch.h | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/battle_setup.h b/include/battle_setup.h index e3faa5dcf..984c820bb 100644 --- a/include/battle_setup.h +++ b/include/battle_setup.h @@ -4,7 +4,6 @@ #include "gym_leader_rematch.h" #define REMATCHES_COUNT 5 -#define REMATCH_TABLE_ENTRIES 78 #define REMATCH_ELITE_FOUR_ENTRIES REMATCH_SIDNEY struct RematchTrainer diff --git a/include/gym_leader_rematch.h b/include/gym_leader_rematch.h index ed1143db5..778d7a1e8 100644 --- a/include/gym_leader_rematch.h +++ b/include/gym_leader_rematch.h @@ -81,7 +81,11 @@ enum { REMATCH_PHOEBE, REMATCH_GLACIA, REMATCH_DRAKE, - REMATCH_WALLACE + REMATCH_WALLACE, + + // The total number of rematch entries. This must be the last element + // in the enum. + REMATCH_TABLE_ENTRIES }; void UpdateGymLeaderRematch(void); From 1aa95a1821cd4ebe552a39bbfed067a305071e31 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Apr 2019 08:36:22 +0200 Subject: [PATCH 058/101] Document a bit of anims --- asm/macros/battle_anim_script.inc | 14 +++---- data/battle_anim_scripts.s | 70 +++++++++++++++---------------- src/battle_anim_effects_1.c | 16 +++---- src/battle_anim_effects_2.c | 4 +- src/bug.c | 19 ++++++--- src/dark.c | 44 +++++++++++-------- 6 files changed, 91 insertions(+), 76 deletions(-) diff --git a/asm/macros/battle_anim_script.inc b/asm/macros/battle_anim_script.inc index 6ccd8d505..32d9de82c 100644 --- a/asm/macros/battle_anim_script.inc +++ b/asm/macros/battle_anim_script.inc @@ -153,19 +153,19 @@ .byte \param4 .endm - .macro loopsewithpan se:req, param1:req, param2:req, param3:req + .macro loopsewithpan se:req, pan:req, wait:req, times:req .byte 0x1c .2byte \se - .byte \param1 - .byte \param2 - .byte \param3 + .byte \pan + .byte \wait + .byte \times .endm - .macro waitplaysewithpan se:req, param1:req, param2:req + .macro waitplaysewithpan se:req, pan:req, wait:req .byte 0x1d .2byte \se - .byte \param1 - .byte \param2 + .byte \pan + .byte \wait .endm .macro setbldcnt param0:req diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index e7a7e89b6..5a19061d0 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -1515,7 +1515,7 @@ Move_VINE_WHIP: createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 4, 6 delay 6 playsewithpan SE_W010, SOUND_PAN_TARGET - createsprite gUnknown_085928E8, ANIM_TARGET, 2, 0, 0 + createsprite gVineWhipSpriteTemplate, ANIM_TARGET, 2, 0, 0 delay 6 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 6, 1 end @@ -1656,12 +1656,12 @@ Explosion1: Move_DEFENSE_CURL: loadspritegfx ANIM_TAG_ECLIPSING_ORB loopsewithpan SE_W161, SOUND_PAN_ATTACKER, 18, 3 - createvisualtask sub_811489C, 5, 0, 0 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, ANIM_ATTACKER, 0 createvisualtask sub_815B338, 5 waitforvisualfinish createsprite gUnknown_085CE338, ANIM_ATTACKER, 2, 0, 6, 0, 1 waitforvisualfinish - createvisualtask sub_811489C, 5, 0, 1 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, ANIM_ATTACKER, 1 waitforvisualfinish end @@ -2003,7 +2003,7 @@ Move_ATTRACT: createsprite gBattleAnimSpriteTemplate_85939B8, ANIM_TARGET, 3, -384, -31 waitforvisualfinish waitplaysewithpan SE_W213B, 0, 15 - createvisualtask sub_81062E8, 5 + createvisualtask AnimTask_HeartsBackground, 5 createsprite gUnknown_085939D0, ANIM_ATTACKER, 40, 16, 256, 0 createsprite gUnknown_085939D0, ANIM_ATTACKER, 40, 224, 240, 15 createsprite gUnknown_085939D0, ANIM_ATTACKER, 40, 126, 272, 30 @@ -2012,7 +2012,7 @@ Move_ATTRACT: createsprite gUnknown_085939D0, ANIM_ATTACKER, 40, 40, 256, 75 createsprite gUnknown_085939D0, ANIM_ATTACKER, 40, 112, 256, 90 createsprite gUnknown_085939D0, ANIM_ATTACKER, 40, 200, 272, 90 - delay 0x4B + delay 75 createvisualtask sub_8115A04, 2, 4, 4, 4, 0, 10, RGB(31, 25, 27) end @@ -3220,13 +3220,13 @@ EndureEffect: Move_CHARM: loadspritegfx ANIM_TAG_MAGENTA_HEART createvisualtask AnimTask_RockMonBackAndForth, 5, ANIM_ATTACKER, 2, 0 - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, 0, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, 0, 20 playsewithpan SE_W204, SOUND_PAN_ATTACKER delay 15 - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, -20, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, -20, 20 playsewithpan SE_W204, SOUND_PAN_ATTACKER delay 15 - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, 20, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, 20, 20 playsewithpan SE_W204, SOUND_PAN_ATTACKER waitforvisualfinish end @@ -4358,7 +4358,7 @@ Move_AERIAL_ACE: Move_IRON_DEFENSE: loopsewithpan SE_REAPOKE, SOUND_PAN_ATTACKER, 28, 2 - createvisualtask sub_81144F8, 5, 0, 0, 0 + createvisualtask AnimTask_MetallicShine, 5, 0, 0, 0 createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 8, 2, RGB_WHITEALPHA, 14, -1, 0 waitforvisualfinish end @@ -4393,13 +4393,13 @@ Move_COVET: loadspritegfx ANIM_TAG_MAGENTA_HEART loadspritegfx ANIM_TAG_ITEM_BAG createvisualtask AnimTask_RockMonBackAndForth, 5, ANIM_ATTACKER, 2, 0 - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, 0, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, 0, 20 playsewithpan SE_W204, SOUND_PAN_ATTACKER delay 15 - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, -20, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, -20, 20 playsewithpan SE_W204, SOUND_PAN_ATTACKER delay 15 - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, 20, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, 20, 20 playsewithpan SE_W204, SOUND_PAN_ATTACKER waitforvisualfinish createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 8, 1 @@ -4570,7 +4570,7 @@ Move_SHOCK_WAVE: Move_HARDEN: loopsewithpan SE_W231, SOUND_PAN_ATTACKER, 28, 2 - createvisualtask sub_81144F8, 5, 0, 0, 0 + createvisualtask AnimTask_MetallicShine, 5, 0, 0, 0 waitforvisualfinish end @@ -7213,7 +7213,7 @@ Move_STEEL_WING: loadspritegfx ANIM_TAG_GUST loadspritegfx ANIM_TAG_IMPACT loopsewithpan SE_W231, SOUND_PAN_ATTACKER, 28, 2 - createvisualtask sub_81144F8, 5, 0, 0, 0 + createvisualtask AnimTask_MetallicShine, 5, 0, 0, 0 waitforvisualfinish monbg ANIM_DEF_PARTNER monbgprio_28 ANIM_TARGET @@ -7239,7 +7239,7 @@ Move_STEEL_WING: Move_IRON_TAIL: loadspritegfx ANIM_TAG_IMPACT loopsewithpan SE_W231, SOUND_PAN_ATTACKER, 28, 2 - createvisualtask sub_81144F8, 5, 1, 0, 0 + createvisualtask AnimTask_MetallicShine, 5, 1, 0, 0 waitforvisualfinish monbg ANIM_TARGET setalpha 12, 8 @@ -7249,7 +7249,7 @@ Move_IRON_TAIL: createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 playsewithpan SE_W233B, SOUND_PAN_TARGET waitforvisualfinish - createvisualtask sub_811489C, 5, 0, 1 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, ANIM_ATTACKER, 1 clearmonbg ANIM_TARGET blendoff waitforvisualfinish @@ -7259,7 +7259,7 @@ Move_POISON_TAIL: loadspritegfx ANIM_TAG_IMPACT loadspritegfx ANIM_TAG_POISON_BUBBLE loopsewithpan SE_W231, SOUND_PAN_ATTACKER, 28, 2 - createvisualtask sub_81144F8, 5, 1, 1, RGB(24, 6, 23) + createvisualtask AnimTask_MetallicShine, 5, 1, 1, RGB(24, 6, 23) waitforvisualfinish monbg ANIM_TARGET setalpha 12, 8 @@ -7269,7 +7269,7 @@ Move_POISON_TAIL: createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 playsewithpan SE_W233B, SOUND_PAN_TARGET waitforvisualfinish - createvisualtask sub_811489C, 5, 0, 1 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, ANIM_ATTACKER, 1 clearmonbg ANIM_TARGET blendoff call PoisonBubblesEffect @@ -7279,7 +7279,7 @@ Move_POISON_TAIL: Move_METAL_CLAW: loadspritegfx ANIM_TAG_CLAW_SLASH loopsewithpan SE_W231, SOUND_PAN_ATTACKER, 28, 2 - createvisualtask sub_81144F8, 5, 0, 0, 0 + createvisualtask AnimTask_MetallicShine, 5, 0, 0, 0 waitforvisualfinish createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 6, 4 delay 2 @@ -7459,7 +7459,7 @@ Move_STRING_SHOT: end StringShot1: - createsprite gUnknown_085969E0, ANIM_TARGET, 2, 20, 0, 512, 20, 1 + createsprite gWebThreadSpriteTemplate, ANIM_TARGET, 2, 20, 0, 512, 20, 1 delay 1 return @@ -7488,7 +7488,7 @@ Move_SPIDER_WEB: call SpiderWeb1 waitforvisualfinish playsewithpan SE_W081B, SOUND_PAN_TARGET - createsprite gUnknown_08596A2C, ANIM_ATTACKER, 2 + createsprite gSpiderWebSpriteTemplate, ANIM_ATTACKER, 2 waitforvisualfinish clearmonbg ANIM_DEF_PARTNER delay 1 @@ -7496,7 +7496,7 @@ Move_SPIDER_WEB: end SpiderWeb1: - createsprite gUnknown_085969E0, ANIM_TARGET, 2, 20, 0, 512, 20, 0 + createsprite gWebThreadSpriteTemplate, ANIM_TARGET, 2, 20, 0, 512, 20, 0 delay 1 return @@ -7941,16 +7941,16 @@ Move_PERISH_SONG: panse_1B SE_W195, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, +2, 0 delay 80 createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 0, 16, RGB_BLACK - createvisualtask sub_811489C, 5, 4, 0 - createvisualtask sub_811489C, 5, 5, 0 - createvisualtask sub_811489C, 5, 6, 0 - createvisualtask sub_811489C, 5, 7, 0 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, 4, 0 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, 5, 0 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, 6, 0 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, 7, 0 delay 100 createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 16, 0, RGB_BLACK - createvisualtask sub_811489C, 5, 4, 1 - createvisualtask sub_811489C, 5, 5, 1 - createvisualtask sub_811489C, 5, 6, 1 - createvisualtask sub_811489C, 5, 7, 1 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, 4, 1 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, 5, 1 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, 6, 1 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, 7, 1 waitforvisualfinish end @@ -9570,7 +9570,7 @@ Move_DOOM_DESIRE: createvisualtask sub_8114960, 2 delay 1 monbg ANIM_ATK_PARTNER - createvisualtask sub_811489C, 5, 1, 0 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, ANIM_TARGET, 0 createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 4, RGB_BLACK waitforvisualfinish setalpha 8, 8 @@ -9578,7 +9578,7 @@ Move_DOOM_DESIRE: createvisualtask AnimTask_ScaleMonAndRestore, 5, -4, -4, 15, ANIM_ATTACKER, 1 waitforvisualfinish delay 20 - createvisualtask sub_811489C, 5, 1, 1 + createvisualtask AnimTask_SetGreyscaleOrOriginalPal, 5, ANIM_TARGET, 1 createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 4, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_ATK_PARTNER @@ -10237,13 +10237,13 @@ Burn1: Status_Infatuation: loadspritegfx ANIM_TAG_MAGENTA_HEART playsewithpan SE_W204, SOUND_PAN_ATTACKER - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, 0, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, 0, 20 delay 15 playsewithpan SE_W204, SOUND_PAN_ATTACKER - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, -20, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, -20, 20 delay 15 playsewithpan SE_W204, SOUND_PAN_ATTACKER - createsprite gUnknown_08593970, ANIM_ATTACKER, 3, 20, 20 + createsprite gMagentaHeartSpriteTemplate, ANIM_ATTACKER, 3, 20, 20 end Status_Sleep: diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index f14e502f3..af4bc19ec 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -1093,7 +1093,7 @@ const struct SpriteTemplate gUnknown_085928D0 = .callback = sub_8100A50, }; -const struct SpriteTemplate gUnknown_085928E8 = +const struct SpriteTemplate gVineWhipSpriteTemplate = { .tileTag = ANIM_TAG_WHIP_HIT, .paletteTag = ANIM_TAG_WHIP_HIT, @@ -2336,7 +2336,7 @@ void AnimHyperBeamOrb(struct Sprite* sprite) { u16 speed; u16 animNum = Random2(); - + StartSpriteAnim(sprite, animNum % 8); sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2); sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET); @@ -2660,7 +2660,7 @@ static void AnimTranslateLinearSingleSineWaveStep(struct Sprite* sprite) s16 a = sprite->data[0]; s16 b = sprite->data[7]; s16 r0; - + sprite->data[0] = 1; TranslateAnimHorizontalArc(sprite); r0 = sprite->data[7]; @@ -2675,7 +2675,7 @@ static void AnimTranslateLinearSingleSineWaveStep(struct Sprite* sprite) if (sprite->oam.affineParam == 30) destroy = TRUE; } - + if (sprite->pos1.x + sprite->pos2.x > 256 || sprite->pos1.x + sprite->pos2.x < -16 || sprite->pos1.y + sprite->pos2.y > 160 @@ -3748,7 +3748,7 @@ void sub_81009F8(struct Sprite* sprite) void sub_8100A50(struct Sprite* sprite) { - if (GetBattlerSide(gBattleAnimAttacker) == 0) + if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) StartSpriteAnim(sprite, 1); sprite->callback = sub_81009DC; @@ -3770,7 +3770,7 @@ void sub_8100A94(struct Sprite* sprite) } // Moves the sprite in a diagonally slashing motion across the target mon. -// Used by moves such as MOVE_CUT and MOVE_AERIAL_ACE. +// Used by moves such as MOVE_CUT and MOVE_AERIAL_ACE. // arg 0: initial x pixel offset // arg 1: initial y pixel offset // arg 2: slice direction; 0 = right-to-left, 1 = left-to-right @@ -5350,10 +5350,10 @@ static void sub_8102DE4(struct Sprite* sprite) void sub_8102EB0(struct Sprite* sprite) { - int a; + int a; if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT) { - a = gBattleAnimArgs[1]; + a = gBattleAnimArgs[1]; (u16)gBattleAnimArgs[1] = -a; } diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index 80b3258b4..e3295acb8 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -889,7 +889,7 @@ const struct SpriteTemplate gUnknown_08593958 = .callback = sub_8105DE8, }; -const struct SpriteTemplate gUnknown_08593970 = +const struct SpriteTemplate gMagentaHeartSpriteTemplate = { .tileTag = ANIM_TAG_MAGENTA_HEART, .paletteTag = ANIM_TAG_MAGENTA_HEART, @@ -3286,7 +3286,7 @@ static void sub_810627C(struct Sprite *sprite) } } -void sub_81062E8(u8 taskId) +void AnimTask_HeartsBackground(u8 taskId) { struct BattleAnimBgData animBg; diff --git a/src/bug.c b/src/bug.c index 88f93a3d5..4fa6a5bb6 100644 --- a/src/bug.c +++ b/src/bug.c @@ -6,7 +6,7 @@ void sub_8110368(struct Sprite *); void sub_8110438(struct Sprite *); -void sub_81104E4(struct Sprite *); +void AnimTranslateWebThread(struct Sprite *); void sub_81105B4(struct Sprite *); void sub_811067C(struct Sprite *); void AnimTranslateStinger(struct Sprite *); @@ -90,7 +90,7 @@ const struct SpriteTemplate gUnknown_085969C8 = .callback = sub_8110438, }; -const struct SpriteTemplate gUnknown_085969E0 = +const struct SpriteTemplate gWebThreadSpriteTemplate = { .tileTag = ANIM_TAG_WEB_THREAD, .paletteTag = ANIM_TAG_WEB_THREAD, @@ -98,7 +98,7 @@ const struct SpriteTemplate gUnknown_085969E0 = .anims = gDummySpriteAnimTable, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = sub_81104E4, + .callback = AnimTranslateWebThread, }; const struct SpriteTemplate gUnknown_085969F8 = @@ -124,7 +124,7 @@ const union AffineAnimCmd *const gUnknown_08596A28[] = gUnknown_08596A10, }; -const struct SpriteTemplate gUnknown_08596A2C = +const struct SpriteTemplate gSpiderWebSpriteTemplate = { .tileTag = ANIM_TAG_SPIDER_WEB, .paletteTag = ANIM_TAG_SPIDER_WEB, @@ -247,12 +247,19 @@ void sub_8110438(struct Sprite *sprite) StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); } -void sub_81104E4(struct Sprite *sprite) +// Creates a single web thread that travels from attacker to target. +// Used by MOVE_STRING_SHOT and MOVE_SPIDER_WEB in their first move phase. +// arg 0: x +// arg 1: y +// arg 2: controls the left-to-right movement +// arg 3: amplitude +// arg 4: if targets both opponents +void AnimTranslateWebThread(struct Sprite *sprite) { if (IsContest()) gBattleAnimArgs[2] /= 2; - InitSpritePosToAnimAttacker(sprite, 1); + InitSpritePosToAnimAttacker(sprite, TRUE); sprite->data[0] = gBattleAnimArgs[2]; sprite->data[1] = sprite->pos1.x; sprite->data[3] = sprite->pos1.y; diff --git a/src/dark.c b/src/dark.c index 80ce61800..482c09c04 100644 --- a/src/dark.c +++ b/src/dark.c @@ -803,17 +803,23 @@ void sub_81144BC(struct Sprite *sprite) StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); } -void sub_81144F8(u8 taskId) +// Makes the attacker metallic and shining. +// Used by MOVE_HARDEN and MOVE_IRON_DEFENSE. +// arg0: if true won't change battler's palette back +// arg1: if true, use custom color +// arg2: custom color +// Custom color argument is used in MOVE_POISON_TAIL to make the mon turn purplish/pinkish as if became cloaked in poison. +void AnimTask_MetallicShine(u8 taskId) { u16 species; u8 spriteId; u8 newSpriteId; u16 paletteNum; struct BattleAnimBgData animBg; - int var0 = 0; + bool32 priorityChanged = FALSE; - gBattle_WIN0H = var0; - gBattle_WIN0V = var0; + gBattle_WIN0H = 0; + gBattle_WIN0V = 0; SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR); SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR | WINOUT_WIN01_BG0 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR); SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJWIN_ON); @@ -832,7 +838,7 @@ void sub_81144F8(u8 taskId) { gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].oam.priority--; SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 1); - var0 = 1; + priorityChanged = TRUE; } } } @@ -861,7 +867,7 @@ void sub_81144F8(u8 taskId) gBattle_BG1_Y = -gSprites[spriteId].pos1.y + 32; paletteNum = 16 + gSprites[spriteId].oam.paletteNum; - if (gBattleAnimArgs[1] == 0) + if (gBattleAnimArgs[1] == 0) SetGreyscaleOrOriginalPalette(paletteNum, FALSE); else BlendPalette(paletteNum * 16, 16, 11, gBattleAnimArgs[2]); @@ -870,7 +876,7 @@ void sub_81144F8(u8 taskId) gTasks[taskId].data[1] = gBattleAnimArgs[0]; gTasks[taskId].data[2] = gBattleAnimArgs[1]; gTasks[taskId].data[3] = gBattleAnimArgs[2]; - gTasks[taskId].data[6] = var0; + gTasks[taskId].data[6] = priorityChanged; gTasks[taskId].func = sub_8114748; } @@ -879,29 +885,28 @@ static void sub_8114748(u8 taskId) struct BattleAnimBgData animBg; u16 paletteNum; u8 spriteId; - u8 taskIdCopy = taskId; - gTasks[taskIdCopy].data[10] += 4; + gTasks[taskId].data[10] += 4; gBattle_BG1_X -= 4; - if (gTasks[taskIdCopy].data[10] == 128) + if (gTasks[taskId].data[10] == 128) { - gTasks[taskIdCopy].data[10] = 0; + gTasks[taskId].data[10] = 0; gBattle_BG1_X += 128; - gTasks[taskIdCopy].data[11]++; - if (gTasks[taskIdCopy].data[11] == 2) + gTasks[taskId].data[11]++; + if (gTasks[taskId].data[11] == 2) { spriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER); paletteNum = 16 + gSprites[spriteId].oam.paletteNum; - if (gTasks[taskIdCopy].data[1] == 0) + if (gTasks[taskId].data[1] == 0) SetGreyscaleOrOriginalPalette(paletteNum, 1); - DestroySprite(&gSprites[gTasks[taskIdCopy].data[0]]); + DestroySprite(&gSprites[gTasks[taskId].data[0]]); sub_80A6B30(&animBg); sub_80A6C68(animBg.bgId); - if (gTasks[taskIdCopy].data[6] == 1) + if (gTasks[taskId].data[6] == 1) gSprites[gBattlerSpriteIds[BATTLE_PARTNER(gBattleAnimAttacker)]].oam.priority++; } - else if (gTasks[taskIdCopy].data[11] == 3) + else if (gTasks[taskId].data[11] == 3) { gBattle_WIN0H = 0; gBattle_WIN0V = 0; @@ -918,7 +923,10 @@ static void sub_8114748(u8 taskId) } } -void sub_811489C(u8 taskId) +// Changes battler's palette to either greyscale or original. +// arg0: which battler +// arg1: 0 grayscale, 1 original +void AnimTask_SetGreyscaleOrOriginalPal(u8 taskId) { u8 spriteId; u8 battler; From 201c0953ae4f6c6b65958065f009cbaee3c8f3ee Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Mon, 1 Apr 2019 18:31:10 -0400 Subject: [PATCH 059/101] Cleanup OamData entries --- src/battle_anim.c | 362 +++++++++++++++++++++++++++++++++++++ src/battle_main.c | 22 +-- src/cable_car.c | 34 +++- src/contest.c | 39 ++-- src/contest_painting.c | 5 +- src/decoration.c | 13 +- src/field_effect.c | 41 ++++- src/field_weather_effect.c | 29 ++- src/link_rfu.c | 14 +- src/naming_screen.c | 29 ++- src/pokedex_cry_screen.c | 8 +- src/pokemon_icon.c | 11 +- 12 files changed, 511 insertions(+), 96 deletions(-) mode change 100755 => 100644 src/cable_car.c mode change 100755 => 100644 src/pokedex_cry_screen.c diff --git a/src/battle_anim.c b/src/battle_anim.c index 31ff11ee8..88de3ee88 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -117,651 +117,1011 @@ EWRAM_DATA u8 gUnknown_02038440 = 0; const struct OamData gUnknown_08524904 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x8), + .x = 0, .size = SPRITE_SIZE(8x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852490C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), + .x = 0, .size = SPRITE_SIZE(16x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524914 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x32), + .x = 0, .size = SPRITE_SIZE(32x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852491C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), + .x = 0, .size = SPRITE_SIZE(64x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524924 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x8), + .x = 0, .size = SPRITE_SIZE(16x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852492C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x8), + .x = 0, .size = SPRITE_SIZE(32x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524934 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x16), + .x = 0, .size = SPRITE_SIZE(32x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852493C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x32), + .x = 0, .size = SPRITE_SIZE(64x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524944 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x16), + .x = 0, .size = SPRITE_SIZE(8x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852494C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x32), + .x = 0, .size = SPRITE_SIZE(8x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524954 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x32), + .x = 0, .size = SPRITE_SIZE(16x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852495C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x64), + .x = 0, .size = SPRITE_SIZE(32x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524964 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x8), + .x = 0, .size = SPRITE_SIZE(8x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852496C = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), + .x = 0, .size = SPRITE_SIZE(16x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524974 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x32), + .x = 0, .size = SPRITE_SIZE(32x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852497C = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), + .x = 0, .size = SPRITE_SIZE(64x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524984 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x8), + .x = 0, .size = SPRITE_SIZE(16x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852498C = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x8), + .x = 0, .size = SPRITE_SIZE(32x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524994 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x16), + .x = 0, .size = SPRITE_SIZE(32x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_0852499C = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x32), + .x = 0, .size = SPRITE_SIZE(64x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249A4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x16), + .x = 0, .size = SPRITE_SIZE(8x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249AC = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x32), + .x = 0, .size = SPRITE_SIZE(8x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249B4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x32), + .x = 0, .size = SPRITE_SIZE(16x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249BC = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x64), + .x = 0, .size = SPRITE_SIZE(32x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249C4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x8), + .x = 0, .size = SPRITE_SIZE(8x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249CC = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), + .x = 0, .size = SPRITE_SIZE(16x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249D4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x32), + .x = 0, .size = SPRITE_SIZE(32x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249DC = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), + .x = 0, .size = SPRITE_SIZE(64x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249E4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x8), + .x = 0, .size = SPRITE_SIZE(16x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249EC = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x8), + .x = 0, .size = SPRITE_SIZE(32x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249F4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x16), + .x = 0, .size = SPRITE_SIZE(32x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_085249FC = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x32), + .x = 0, .size = SPRITE_SIZE(64x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A04 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x16), + .x = 0, .size = SPRITE_SIZE(8x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A0C = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x32), + .x = 0, .size = SPRITE_SIZE(8x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A14 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x32), + .x = 0, .size = SPRITE_SIZE(16x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A1C = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x64), + .x = 0, .size = SPRITE_SIZE(32x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A24 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x8), + .x = 0, .size = SPRITE_SIZE(8x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A2C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), + .x = 0, .size = SPRITE_SIZE(16x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A34 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x32), + .x = 0, .size = SPRITE_SIZE(32x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A3C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), + .x = 0, .size = SPRITE_SIZE(64x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A44 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x8), + .x = 0, .size = SPRITE_SIZE(16x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A4C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x8), + .x = 0, .size = SPRITE_SIZE(32x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A54 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x16), + .x = 0, .size = SPRITE_SIZE(32x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A5C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x32), + .x = 0, .size = SPRITE_SIZE(64x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A64 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x16), + .x = 0, .size = SPRITE_SIZE(8x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A6C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x32), + .x = 0, .size = SPRITE_SIZE(8x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A74 = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x32), + .x = 0, .size = SPRITE_SIZE(16x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A7C = { + .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x64), + .x = 0, .size = SPRITE_SIZE(32x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A84 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x8), + .x = 0, .size = SPRITE_SIZE(8x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A8C = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), + .x = 0, .size = SPRITE_SIZE(16x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A94 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x32), + .x = 0, .size = SPRITE_SIZE(32x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524A9C = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), + .x = 0, .size = SPRITE_SIZE(64x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AA4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x8), + .x = 0, .size = SPRITE_SIZE(16x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AAC = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x8), + .x = 0, .size = SPRITE_SIZE(32x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AB4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x16), + .x = 0, .size = SPRITE_SIZE(32x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524ABC = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x32), + .x = 0, .size = SPRITE_SIZE(64x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AC4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x16), + .x = 0, .size = SPRITE_SIZE(8x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524ACC = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x32), + .x = 0, .size = SPRITE_SIZE(8x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AD4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x32), + .x = 0, .size = SPRITE_SIZE(16x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524ADC = { + .y = 0, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x64), + .x = 0, .size = SPRITE_SIZE(32x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AE4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x8), + .x = 0, .size = SPRITE_SIZE(8x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AEC = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), + .x = 0, .size = SPRITE_SIZE(16x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AF4 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x32), + .x = 0, .size = SPRITE_SIZE(32x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524AFC = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), + .x = 0, .size = SPRITE_SIZE(64x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524B04 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x8), + .x = 0, .size = SPRITE_SIZE(16x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524B0C = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x8), + .x = 0, .size = SPRITE_SIZE(32x8), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524B14 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x16), + .x = 0, .size = SPRITE_SIZE(32x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524B1C = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x32), + .x = 0, .size = SPRITE_SIZE(64x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524B24 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x16), + .x = 0, .size = SPRITE_SIZE(8x16), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524B2C = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x32), + .x = 0, .size = SPRITE_SIZE(8x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524B34 = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x32), + .x = 0, .size = SPRITE_SIZE(16x32), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct OamData gUnknown_08524B3C = { + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x64), + .x = 0, .size = SPRITE_SIZE(32x64), + .tileNum = 0, .priority = 2, + .paletteNum = 0, }; const struct CompressedSpriteSheet gBattleAnimPicTable[] = @@ -3088,3 +3448,5 @@ static void ScriptCmd_stopsound(void) m4aMPlayStop(&gMPlayInfo_SE2); sBattleAnimScriptPtr++; } + + diff --git a/src/battle_main.c b/src/battle_main.c index 19fd01e3c..92f12636d 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -293,35 +293,31 @@ static const u8 sText_ShedinjaJpnName[] = _("ヌケニン"); // Nukenin const struct OamData gOamData_831ACA8 = { .y = 0, - .affineMode = 1, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_NORMAL, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 2, .paletteNum = 0, - .affineParam = 0 + .affineParam = 0, }; const struct OamData gOamData_831ACB0 = { .y = 0, - .affineMode = 1, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_NORMAL, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 2, .paletteNum = 2, - .affineParam = 0 + .affineParam = 0, }; // Unknown and unused data. Feel free to remove. @@ -5891,3 +5887,5 @@ static void HandleAction_ActionFinished(void) gBattleScripting.multihitMoveEffect = 0; gBattleResources->battleScriptsStack->size = 0; } + + diff --git a/src/cable_car.c b/src/cable_car.c old mode 100755 new mode 100644 index ab7b5726a..4e6980c4e --- a/src/cable_car.c +++ b/src/cable_car.c @@ -151,25 +151,46 @@ const struct SpritePalette gUnknown_085CDB74[] = { { } }; -const struct OamData gOamData_85CDB84 = { +const struct OamData gOamData_85CDB84 = +{ + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), + .x = 0, .size = SPRITE_SIZE(64x64), - .priority = 2 + .tileNum = 0, + .priority = 2, + .paletteNum = 0, }; -const struct OamData gOamData_85CDB8C = { +const struct OamData gOamData_85CDB8C = +{ + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x8), + .x = 0, .size = SPRITE_SIZE(16x8), - .priority = 2 + .tileNum = 0, + .priority = 2, + .paletteNum = 0, }; -const struct OamData gOamData_85CDB94 = { +const struct OamData gOamData_85CDB94 = +{ + .y = 0, .affineMode = ST_OAM_AFFINE_DOUBLE, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), + .x = 0, .size = SPRITE_SIZE(16x16), - .priority = 2 + .tileNum = 0, + .priority = 2, + .paletteNum = 0, }; const struct SpriteTemplate gSpriteTemplate_85CDB9C[] = @@ -1007,3 +1028,4 @@ static void sub_81514C8(u8 arg0) sCableCar->unk1C = 0; } + diff --git a/src/contest.c b/src/contest.c index 0591668ff..02d7038cf 100644 --- a/src/contest.c +++ b/src/contest.c @@ -445,18 +445,15 @@ const struct CompressedSpriteSheet gUnknown_08587B88 = const struct OamData gOamData_8587B90 = { .y = 0, - .affineMode = 0, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(16x16), .tileNum = 0, .priority = 0, .paletteNum = 0, - .affineParam = 0 }; const struct SpriteTemplate gSpriteTemplate_8587B98 = @@ -486,18 +483,15 @@ const struct SpritePalette gUnknown_08587BB8 = const struct OamData gOamData_8587BC0 = { .y = 0, - .affineMode = 0, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x32), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x32), .tileNum = 0, .priority = 0, .paletteNum = 0, - .affineParam = 0 }; const struct SpriteTemplate gSpriteTemplate_8587BC8 = @@ -514,18 +508,15 @@ const struct SpriteTemplate gSpriteTemplate_8587BC8 = const struct OamData gOamData_8587BE0 = { .y = 0, - .affineMode = 0, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 3, .paletteNum = 2, - .affineParam = 0 }; const struct SpriteTemplate gSpriteTemplate_8587BE8 = @@ -768,18 +759,16 @@ static const struct SpritePalette sUnknown_08589924[] = const struct OamData gOamData_8589944 = { .y = 0, - .affineMode = 3, - .objMode = 1, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_DOUBLE, + .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 0, .paletteNum = 0, - .affineParam = 0 + .affineParam = 0, }; const union AffineAnimCmd gSpriteAffineAnim_858994C[] = @@ -5762,3 +5751,5 @@ void sub_80DFA08(struct ContestPokemon *mon, s32 language) name[PLAYER_NAME_LENGTH] = EOS; } } + + diff --git a/src/contest_painting.c b/src/contest_painting.c index 29f3c871d..87598f2bd 100644 --- a/src/contest_painting.c +++ b/src/contest_painting.c @@ -152,16 +152,14 @@ const struct OamData gUnknown_085B0830 = .y = 0, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, - .mosaic = 1, + .mosaic = TRUE, .bpp = ST_OAM_8BPP, .shape = SPRITE_SHAPE(64x64), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 0, .paletteNum = 0, - .affineParam = 0, }; const u16 gUnknown_085B0838[] = {RGB(0, 0, 0), RGB(0, 0, 0)}; @@ -705,3 +703,4 @@ static void sub_8130884(u8 arg0, u8 arg1) sub_8130688(arg0); sub_8130430(arg0, arg1); } + diff --git a/src/decoration.c b/src/decoration.c index 3c8809c6a..4baa6d4c8 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -391,10 +391,18 @@ const struct SpritePalette gUnknown_085A73E0 = { Unknown_085A7328, OVERWORLD_PLACE_DECOR_PLAYER_PAL_TAG }; -const struct OamData Unknown_085A73E8 = { +const struct OamData Unknown_085A73E8 = +{ + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), + .x = 0, .size = SPRITE_SIZE(16x16), - .priority = 1 + .tileNum = 0, + .priority = 1, + .paletteNum = 0, }; const union AnimCmd Unknown_085A73F0[] = { @@ -2740,3 +2748,4 @@ void sub_812A478(u8 taskId) StringExpandPlaceholders(gStringVar4, gText_DecorationThrownAway); DisplayItemMessageOnField(taskId, gStringVar4, sub_8127A5C); } + diff --git a/src/field_effect.c b/src/field_effect.c index 825efc380..93d7e5ef8 100644 --- a/src/field_effect.c +++ b/src/field_effect.c @@ -284,20 +284,44 @@ bool8 (*const gFieldEffectScriptFuncs[])(u8 **, u32 *) = const struct OamData gNewGameBirchOamAttributes = { + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), - .size = SPRITE_SIZE(64x64) + .x = 0, + .size = SPRITE_SIZE(64x64), + .tileNum = 0, + .priority = 0, + .paletteNum = 0, }; const struct OamData gOamData_855C218 = { + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x8), - .size = SPRITE_SIZE(8x8) + .x = 0, + .size = SPRITE_SIZE(8x8), + .tileNum = 0, + .priority = 0, + .paletteNum = 0, }; const struct OamData gOamData_855C220 = { + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), - .size = SPRITE_SIZE(16x16) + .x = 0, + .size = SPRITE_SIZE(16x16), + .tileNum = 0, + .priority = 0, + .paletteNum = 0, }; const struct SpriteFrameImage gNewGameBirchPicTable[] = @@ -347,8 +371,16 @@ const struct SpritePalette gFieldEffectObjectPaletteInfo5 = const struct OamData gOamData_855C26C = { + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x16), - .size = SPRITE_SIZE(32x16) + .x = 0, + .size = SPRITE_SIZE(32x16), + .tileNum = 0, + .priority = 0, + .paletteNum = 0, }; const struct SpriteFrameImage gSpriteImageTable_855C274[] = @@ -3759,3 +3791,4 @@ static void Fldeff_MoveDeoxysRock_Step(u8 taskId) break; } } + diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index 6ec83f1a0..1468f7ca0 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -1513,18 +1513,15 @@ void LoadAshSpriteSheet(void) const struct OamData gOamData_839ABB8 = { .y = 0, - .affineMode = 0, - .objMode = 1, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 1, .paletteNum = 15, - .affineParam = 0, }; const union AnimCmd gSpriteAnim_839ABC0[] = @@ -1750,18 +1747,15 @@ void CreateFog2Sprites(void) const struct OamData gOamData_839ABF0 = { .y = 0, - .affineMode = 0, - .objMode = 1, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 2, .paletteNum = 0, - .affineParam = 0, }; const union AnimCmd gSpriteAnim_839ABF8[] = @@ -1949,18 +1943,15 @@ void sub_80800E4(void) const struct OamData gOamData_839AC1C = { .y = 0, - .affineMode = 0, - .objMode = 1, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_BLEND, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(64x64), .tileNum = 0, .priority = 1, .paletteNum = 0, - .affineParam = 0, }; const union AnimCmd gSpriteAnim_839AC24[] = @@ -2470,3 +2461,5 @@ static void UpdateRainCounter(u8 newWeather, u8 oldWeather) && (newWeather == WEATHER_RAIN_LIGHT || newWeather == WEATHER_RAIN_MED)) IncrementGameStat(GAME_STAT_GOT_RAINED_ON); } + + diff --git a/src/link_rfu.c b/src/link_rfu.c index a430f6e24..1e4c9c7e6 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -154,9 +154,18 @@ const u8 sWireless_RSEtoASCIITable[] = { 0x20, 0x2b, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00 }; -const struct OamData sWirelessStatusIndicatorOamData = { +const struct OamData sWirelessStatusIndicatorOamData = +{ + .y = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), - .size = SPRITE_SIZE(16x16) + .x = 0, + .size = SPRITE_SIZE(16x16), + .tileNum = 0, + .priority = 0, + .paletteNum = 0, }; static const union AnimCmd sWirelessStatusIndicatorAnim0[] = { // 3 bars @@ -5182,3 +5191,4 @@ u32 GetRfuRecvQueueLength(void) { return gUnknown_03005000.unk_124.unk_8c2; } + diff --git a/src/naming_screen.c b/src/naming_screen.c index 75b7c8566..3b8ba037c 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -1906,52 +1906,43 @@ static const struct NamingScreenTemplate *const sNamingScreenTemplates[] = const struct OamData gOamData_858BFEC = { .y = 0, - .affineMode = 0, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(8x8), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(8x8), .tileNum = 0, .priority = 0, .paletteNum = 0, - .affineParam = 0, }; const struct OamData gOamData_858BFF4 = { .y = 0, - .affineMode = 0, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(16x16), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(16x16), .tileNum = 0, .priority = 0, .paletteNum = 0, - .affineParam = 0, }; const struct OamData gOamData_858BFFC = { .y = 0, - .affineMode = 0, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x16), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(32x16), .tileNum = 0, .priority = 0, .paletteNum = 0, - .affineParam = 0, }; static const struct Subsprite gUnknown_0858C004[] = @@ -2203,3 +2194,5 @@ static const struct SpritePalette gUnknown_0858C230[] = {gNamingScreenMenu_Pal + 0x40, 0x0007}, {NULL} }; + + diff --git a/src/pokedex_cry_screen.c b/src/pokedex_cry_screen.c old mode 100755 new mode 100644 index 8ca0c8d6e..487db6d58 --- a/src/pokedex_cry_screen.c +++ b/src/pokedex_cry_screen.c @@ -169,9 +169,14 @@ const struct OamData gOamData_85B8C60 = { .y = 160, .affineMode = ST_OAM_AFFINE_NORMAL, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(64x64), + .x = 0, .size = SPRITE_SIZE(64x64), - .priority = 1 + .tileNum = 0, + .priority = 1, + .paletteNum = 0, }; const struct SpriteTemplate gUnknown_085B8C68 = @@ -521,3 +526,4 @@ static void sub_8145B24(s8 a0) sCryVolumeMeter->unk1 = r2; sCryVolumeMeter->unk2 = 5; } + diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index 4ff182a0e..a5d3f8961 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -927,18 +927,15 @@ const struct SpritePalette gMonIconPaletteTable[] = const struct OamData sMonIconOamData = { .y = 0, - .affineMode = 0, - .objMode = 0, - .mosaic = 0, - .bpp = 0, + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .bpp = ST_OAM_4BPP, .shape = SPRITE_SHAPE(32x32), .x = 0, - .matrixNum = 0, .size = SPRITE_SIZE(32x32), .tileNum = 0, .priority = 1, .paletteNum = 0, - .affineParam = 0 }; // fastest to slowest @@ -1311,3 +1308,5 @@ void sub_80D32C8(struct Sprite *sprite, u8 animNum) sprite->animDelayCounter = 0; sprite->animCmdIndex = 0; } + + From 02e2b1af97dc46824faa3b3b6a28dc2483c1b41d Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Apr 2019 20:57:09 +0200 Subject: [PATCH 060/101] Use species defines in gMonIconTable --- src/pokemon_icon.c | 886 ++++++++++++++++++++++----------------------- 1 file changed, 442 insertions(+), 444 deletions(-) diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c index a5d3f8961..6a135875e 100644 --- a/src/pokemon_icon.c +++ b/src/pokemon_icon.c @@ -25,446 +25,446 @@ static u8 CreateMonIconSprite(struct MonIconSpriteTemplate *, s16, s16, u8); const u8 *const gMonIconTable[] = { - gMonIcon_Bulbasaur, - gMonIcon_Bulbasaur, - gMonIcon_Ivysaur, - gMonIcon_Venusaur, - gMonIcon_Charmander, - gMonIcon_Charmeleon, - gMonIcon_Charizard, - gMonIcon_Squirtle, - gMonIcon_Wartortle, - gMonIcon_Blastoise, - gMonIcon_Caterpie, - gMonIcon_Metapod, - gMonIcon_Butterfree, - gMonIcon_Weedle, - gMonIcon_Kakuna, - gMonIcon_Beedrill, - gMonIcon_Pidgey, - gMonIcon_Pidgeotto, - gMonIcon_Pidgeot, - gMonIcon_Rattata, - gMonIcon_Raticate, - gMonIcon_Spearow, - gMonIcon_Fearow, - gMonIcon_Ekans, - gMonIcon_Arbok, - gMonIcon_Pikachu, - gMonIcon_Raichu, - gMonIcon_Sandshrew, - gMonIcon_Sandslash, - gMonIcon_NidoranF, - gMonIcon_Nidorina, - gMonIcon_Nidoqueen, - gMonIcon_NidoranM, - gMonIcon_Nidorino, - gMonIcon_Nidoking, - gMonIcon_Clefairy, - gMonIcon_Clefable, - gMonIcon_Vulpix, - gMonIcon_Ninetales, - gMonIcon_Jigglypuff, - gMonIcon_Wigglytuff, - gMonIcon_Zubat, - gMonIcon_Golbat, - gMonIcon_Oddish, - gMonIcon_Gloom, - gMonIcon_Vileplume, - gMonIcon_Paras, - gMonIcon_Parasect, - gMonIcon_Venonat, - gMonIcon_Venomoth, - gMonIcon_Diglett, - gMonIcon_Dugtrio, - gMonIcon_Meowth, - gMonIcon_Persian, - gMonIcon_Psyduck, - gMonIcon_Golduck, - gMonIcon_Mankey, - gMonIcon_Primeape, - gMonIcon_Growlithe, - gMonIcon_Arcanine, - gMonIcon_Poliwag, - gMonIcon_Poliwhirl, - gMonIcon_Poliwrath, - gMonIcon_Abra, - gMonIcon_Kadabra, - gMonIcon_Alakazam, - gMonIcon_Machop, - gMonIcon_Machoke, - gMonIcon_Machamp, - gMonIcon_Bellsprout, - gMonIcon_Weepinbell, - gMonIcon_Victreebel, - gMonIcon_Tentacool, - gMonIcon_Tentacruel, - gMonIcon_Geodude, - gMonIcon_Graveler, - gMonIcon_Golem, - gMonIcon_Ponyta, - gMonIcon_Rapidash, - gMonIcon_Slowpoke, - gMonIcon_Slowbro, - gMonIcon_Magnemite, - gMonIcon_Magneton, - gMonIcon_Farfetchd, - gMonIcon_Doduo, - gMonIcon_Dodrio, - gMonIcon_Seel, - gMonIcon_Dewgong, - gMonIcon_Grimer, - gMonIcon_Muk, - gMonIcon_Shellder, - gMonIcon_Cloyster, - gMonIcon_Gastly, - gMonIcon_Haunter, - gMonIcon_Gengar, - gMonIcon_Onix, - gMonIcon_Drowzee, - gMonIcon_Hypno, - gMonIcon_Krabby, - gMonIcon_Kingler, - gMonIcon_Voltorb, - gMonIcon_Electrode, - gMonIcon_Exeggcute, - gMonIcon_Exeggutor, - gMonIcon_Cubone, - gMonIcon_Marowak, - gMonIcon_Hitmonlee, - gMonIcon_Hitmonchan, - gMonIcon_Lickitung, - gMonIcon_Koffing, - gMonIcon_Weezing, - gMonIcon_Rhyhorn, - gMonIcon_Rhydon, - gMonIcon_Chansey, - gMonIcon_Tangela, - gMonIcon_Kangaskhan, - gMonIcon_Horsea, - gMonIcon_Seadra, - gMonIcon_Goldeen, - gMonIcon_Seaking, - gMonIcon_Staryu, - gMonIcon_Starmie, - gMonIcon_Mrmime, - gMonIcon_Scyther, - gMonIcon_Jynx, - gMonIcon_Electabuzz, - gMonIcon_Magmar, - gMonIcon_Pinsir, - gMonIcon_Tauros, - gMonIcon_Magikarp, - gMonIcon_Gyarados, - gMonIcon_Lapras, - gMonIcon_Ditto, - gMonIcon_Eevee, - gMonIcon_Vaporeon, - gMonIcon_Jolteon, - gMonIcon_Flareon, - gMonIcon_Porygon, - gMonIcon_Omanyte, - gMonIcon_Omastar, - gMonIcon_Kabuto, - gMonIcon_Kabutops, - gMonIcon_Aerodactyl, - gMonIcon_Snorlax, - gMonIcon_Articuno, - gMonIcon_Zapdos, - gMonIcon_Moltres, - gMonIcon_Dratini, - gMonIcon_Dragonair, - gMonIcon_Dragonite, - gMonIcon_Mewtwo, - gMonIcon_Mew, - gMonIcon_Chikorita, - gMonIcon_Bayleef, - gMonIcon_Meganium, - gMonIcon_Cyndaquil, - gMonIcon_Quilava, - gMonIcon_Typhlosion, - gMonIcon_Totodile, - gMonIcon_Croconaw, - gMonIcon_Feraligatr, - gMonIcon_Sentret, - gMonIcon_Furret, - gMonIcon_Hoothoot, - gMonIcon_Noctowl, - gMonIcon_Ledyba, - gMonIcon_Ledian, - gMonIcon_Spinarak, - gMonIcon_Ariados, - gMonIcon_Crobat, - gMonIcon_Chinchou, - gMonIcon_Lanturn, - gMonIcon_Pichu, - gMonIcon_Cleffa, - gMonIcon_Igglybuff, - gMonIcon_Togepi, - gMonIcon_Togetic, - gMonIcon_Natu, - gMonIcon_Xatu, - gMonIcon_Mareep, - gMonIcon_Flaaffy, - gMonIcon_Ampharos, - gMonIcon_Bellossom, - gMonIcon_Marill, - gMonIcon_Azumarill, - gMonIcon_Sudowoodo, - gMonIcon_Politoed, - gMonIcon_Hoppip, - gMonIcon_Skiploom, - gMonIcon_Jumpluff, - gMonIcon_Aipom, - gMonIcon_Sunkern, - gMonIcon_Sunflora, - gMonIcon_Yanma, - gMonIcon_Wooper, - gMonIcon_Quagsire, - gMonIcon_Espeon, - gMonIcon_Umbreon, - gMonIcon_Murkrow, - gMonIcon_Slowking, - gMonIcon_Misdreavus, - gMonIcon_UnownA, - gMonIcon_Wobbuffet, - gMonIcon_Girafarig, - gMonIcon_Pineco, - gMonIcon_Forretress, - gMonIcon_Dunsparce, - gMonIcon_Gligar, - gMonIcon_Steelix, - gMonIcon_Snubbull, - gMonIcon_Granbull, - gMonIcon_Qwilfish, - gMonIcon_Scizor, - gMonIcon_Shuckle, - gMonIcon_Heracross, - gMonIcon_Sneasel, - gMonIcon_Teddiursa, - gMonIcon_Ursaring, - gMonIcon_Slugma, - gMonIcon_Magcargo, - gMonIcon_Swinub, - gMonIcon_Piloswine, - gMonIcon_Corsola, - gMonIcon_Remoraid, - gMonIcon_Octillery, - gMonIcon_Delibird, - gMonIcon_Mantine, - gMonIcon_Skarmory, - gMonIcon_Houndour, - gMonIcon_Houndoom, - gMonIcon_Kingdra, - gMonIcon_Phanpy, - gMonIcon_Donphan, - gMonIcon_Porygon2, - gMonIcon_Stantler, - gMonIcon_Smeargle, - gMonIcon_Tyrogue, - gMonIcon_Hitmontop, - gMonIcon_Smoochum, - gMonIcon_Elekid, - gMonIcon_Magby, - gMonIcon_Miltank, - gMonIcon_Blissey, - gMonIcon_Raikou, - gMonIcon_Entei, - gMonIcon_Suicune, - gMonIcon_Larvitar, - gMonIcon_Pupitar, - gMonIcon_Tyranitar, - gMonIcon_Lugia, - gMonIcon_HoOh, - gMonIcon_Celebi, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_QuestionMark, - gMonIcon_Treecko, - gMonIcon_Grovyle, - gMonIcon_Sceptile, - gMonIcon_Torchic, - gMonIcon_Combusken, - gMonIcon_Blaziken, - gMonIcon_Mudkip, - gMonIcon_Marshtomp, - gMonIcon_Swampert, - gMonIcon_Poochyena, - gMonIcon_Mightyena, - gMonIcon_Zigzagoon, - gMonIcon_Linoone, - gMonIcon_Wurmple, - gMonIcon_Silcoon, - gMonIcon_Beautifly, - gMonIcon_Cascoon, - gMonIcon_Dustox, - gMonIcon_Lotad, - gMonIcon_Lombre, - gMonIcon_Ludicolo, - gMonIcon_Seedot, - gMonIcon_Nuzleaf, - gMonIcon_Shiftry, - gMonIcon_Nincada, - gMonIcon_Ninjask, - gMonIcon_Shedinja, - gMonIcon_Taillow, - gMonIcon_Swellow, - gMonIcon_Shroomish, - gMonIcon_Breloom, - gMonIcon_Spinda, - gMonIcon_Wingull, - gMonIcon_Pelipper, - gMonIcon_Surskit, - gMonIcon_Masquerain, - gMonIcon_Wailmer, - gMonIcon_Wailord, - gMonIcon_Skitty, - gMonIcon_Delcatty, - gMonIcon_Kecleon, - gMonIcon_Baltoy, - gMonIcon_Claydol, - gMonIcon_Nosepass, - gMonIcon_Torkoal, - gMonIcon_Sableye, - gMonIcon_Barboach, - gMonIcon_Whiscash, - gMonIcon_Luvdisc, - gMonIcon_Corphish, - gMonIcon_Crawdaunt, - gMonIcon_Feebas, - gMonIcon_Milotic, - gMonIcon_Carvanha, - gMonIcon_Sharpedo, - gMonIcon_Trapinch, - gMonIcon_Vibrava, - gMonIcon_Flygon, - gMonIcon_Makuhita, - gMonIcon_Hariyama, - gMonIcon_Electrike, - gMonIcon_Manectric, - gMonIcon_Numel, - gMonIcon_Camerupt, - gMonIcon_Spheal, - gMonIcon_Sealeo, - gMonIcon_Walrein, - gMonIcon_Cacnea, - gMonIcon_Cacturne, - gMonIcon_Snorunt, - gMonIcon_Glalie, - gMonIcon_Lunatone, - gMonIcon_Solrock, - gMonIcon_Azurill, - gMonIcon_Spoink, - gMonIcon_Grumpig, - gMonIcon_Plusle, - gMonIcon_Minun, - gMonIcon_Mawile, - gMonIcon_Meditite, - gMonIcon_Medicham, - gMonIcon_Swablu, - gMonIcon_Altaria, - gMonIcon_Wynaut, - gMonIcon_Duskull, - gMonIcon_Dusclops, - gMonIcon_Roselia, - gMonIcon_Slakoth, - gMonIcon_Vigoroth, - gMonIcon_Slaking, - gMonIcon_Gulpin, - gMonIcon_Swalot, - gMonIcon_Tropius, - gMonIcon_Whismur, - gMonIcon_Loudred, - gMonIcon_Exploud, - gMonIcon_Clamperl, - gMonIcon_Huntail, - gMonIcon_Gorebyss, - gMonIcon_Absol, - gMonIcon_Shuppet, - gMonIcon_Banette, - gMonIcon_Seviper, - gMonIcon_Zangoose, - gMonIcon_Relicanth, - gMonIcon_Aron, - gMonIcon_Lairon, - gMonIcon_Aggron, - gMonIcon_Castform, - gMonIcon_Volbeat, - gMonIcon_Illumise, - gMonIcon_Lileep, - gMonIcon_Cradily, - gMonIcon_Anorith, - gMonIcon_Armaldo, - gMonIcon_Ralts, - gMonIcon_Kirlia, - gMonIcon_Gardevoir, - gMonIcon_Bagon, - gMonIcon_Shelgon, - gMonIcon_Salamence, - gMonIcon_Beldum, - gMonIcon_Metang, - gMonIcon_Metagross, - gMonIcon_Regirock, - gMonIcon_Regice, - gMonIcon_Registeel, - gMonIcon_Kyogre, - gMonIcon_Groudon, - gMonIcon_Rayquaza, - gMonIcon_Latias, - gMonIcon_Latios, - gMonIcon_Jirachi, - gMonIcon_Deoxys, - gMonIcon_Chimecho, - gMonIcon_Egg, - gMonIcon_UnownB, - gMonIcon_UnownC, - gMonIcon_UnownD, - gMonIcon_UnownE, - gMonIcon_UnownF, - gMonIcon_UnownG, - gMonIcon_UnownH, - gMonIcon_UnownI, - gMonIcon_UnownJ, - gMonIcon_UnownK, - gMonIcon_UnownL, - gMonIcon_UnownM, - gMonIcon_UnownN, - gMonIcon_UnownO, - gMonIcon_UnownP, - gMonIcon_UnownQ, - gMonIcon_UnownR, - gMonIcon_UnownS, - gMonIcon_UnownT, - gMonIcon_UnownU, - gMonIcon_UnownV, - gMonIcon_UnownW, - gMonIcon_UnownX, - gMonIcon_UnownY, - gMonIcon_UnownZ, - gMonIcon_UnownExclamationMark, - gMonIcon_UnownQuestionMark, + [SPECIES_NONE] = gMonIcon_Bulbasaur, + [SPECIES_BULBASAUR] = gMonIcon_Bulbasaur, + [SPECIES_IVYSAUR] = gMonIcon_Ivysaur, + [SPECIES_VENUSAUR] = gMonIcon_Venusaur, + [SPECIES_CHARMANDER] = gMonIcon_Charmander, + [SPECIES_CHARMELEON] = gMonIcon_Charmeleon, + [SPECIES_CHARIZARD] = gMonIcon_Charizard, + [SPECIES_SQUIRTLE] = gMonIcon_Squirtle, + [SPECIES_WARTORTLE] = gMonIcon_Wartortle, + [SPECIES_BLASTOISE] = gMonIcon_Blastoise, + [SPECIES_CATERPIE] = gMonIcon_Caterpie, + [SPECIES_METAPOD] = gMonIcon_Metapod, + [SPECIES_BUTTERFREE] = gMonIcon_Butterfree, + [SPECIES_WEEDLE] = gMonIcon_Weedle, + [SPECIES_KAKUNA] = gMonIcon_Kakuna, + [SPECIES_BEEDRILL] = gMonIcon_Beedrill, + [SPECIES_PIDGEY] = gMonIcon_Pidgey, + [SPECIES_PIDGEOTTO] = gMonIcon_Pidgeotto, + [SPECIES_PIDGEOT] = gMonIcon_Pidgeot, + [SPECIES_RATTATA] = gMonIcon_Rattata, + [SPECIES_RATICATE] = gMonIcon_Raticate, + [SPECIES_SPEAROW] = gMonIcon_Spearow, + [SPECIES_FEAROW] = gMonIcon_Fearow, + [SPECIES_EKANS] = gMonIcon_Ekans, + [SPECIES_ARBOK] = gMonIcon_Arbok, + [SPECIES_PIKACHU] = gMonIcon_Pikachu, + [SPECIES_RAICHU] = gMonIcon_Raichu, + [SPECIES_SANDSHREW] = gMonIcon_Sandshrew, + [SPECIES_SANDSLASH] = gMonIcon_Sandslash, + [SPECIES_NIDORAN_F] = gMonIcon_NidoranF, + [SPECIES_NIDORINA] = gMonIcon_Nidorina, + [SPECIES_NIDOQUEEN] = gMonIcon_Nidoqueen, + [SPECIES_NIDORAN_M] = gMonIcon_NidoranM, + [SPECIES_NIDORINO] = gMonIcon_Nidorino, + [SPECIES_NIDOKING] = gMonIcon_Nidoking, + [SPECIES_CLEFAIRY] = gMonIcon_Clefairy, + [SPECIES_CLEFABLE] = gMonIcon_Clefable, + [SPECIES_VULPIX] = gMonIcon_Vulpix, + [SPECIES_NINETALES] = gMonIcon_Ninetales, + [SPECIES_JIGGLYPUFF] = gMonIcon_Jigglypuff, + [SPECIES_WIGGLYTUFF] = gMonIcon_Wigglytuff, + [SPECIES_ZUBAT] = gMonIcon_Zubat, + [SPECIES_GOLBAT] = gMonIcon_Golbat, + [SPECIES_ODDISH] = gMonIcon_Oddish, + [SPECIES_GLOOM] = gMonIcon_Gloom, + [SPECIES_VILEPLUME] = gMonIcon_Vileplume, + [SPECIES_PARAS] = gMonIcon_Paras, + [SPECIES_PARASECT] = gMonIcon_Parasect, + [SPECIES_VENONAT] = gMonIcon_Venonat, + [SPECIES_VENOMOTH] = gMonIcon_Venomoth, + [SPECIES_DIGLETT] = gMonIcon_Diglett, + [SPECIES_DUGTRIO] = gMonIcon_Dugtrio, + [SPECIES_MEOWTH] = gMonIcon_Meowth, + [SPECIES_PERSIAN] = gMonIcon_Persian, + [SPECIES_PSYDUCK] = gMonIcon_Psyduck, + [SPECIES_GOLDUCK] = gMonIcon_Golduck, + [SPECIES_MANKEY] = gMonIcon_Mankey, + [SPECIES_PRIMEAPE] = gMonIcon_Primeape, + [SPECIES_GROWLITHE] = gMonIcon_Growlithe, + [SPECIES_ARCANINE] = gMonIcon_Arcanine, + [SPECIES_POLIWAG] = gMonIcon_Poliwag, + [SPECIES_POLIWHIRL] = gMonIcon_Poliwhirl, + [SPECIES_POLIWRATH] = gMonIcon_Poliwrath, + [SPECIES_ABRA] = gMonIcon_Abra, + [SPECIES_KADABRA] = gMonIcon_Kadabra, + [SPECIES_ALAKAZAM] = gMonIcon_Alakazam, + [SPECIES_MACHOP] = gMonIcon_Machop, + [SPECIES_MACHOKE] = gMonIcon_Machoke, + [SPECIES_MACHAMP] = gMonIcon_Machamp, + [SPECIES_BELLSPROUT] = gMonIcon_Bellsprout, + [SPECIES_WEEPINBELL] = gMonIcon_Weepinbell, + [SPECIES_VICTREEBEL] = gMonIcon_Victreebel, + [SPECIES_TENTACOOL] = gMonIcon_Tentacool, + [SPECIES_TENTACRUEL] = gMonIcon_Tentacruel, + [SPECIES_GEODUDE] = gMonIcon_Geodude, + [SPECIES_GRAVELER] = gMonIcon_Graveler, + [SPECIES_GOLEM] = gMonIcon_Golem, + [SPECIES_PONYTA] = gMonIcon_Ponyta, + [SPECIES_RAPIDASH] = gMonIcon_Rapidash, + [SPECIES_SLOWPOKE] = gMonIcon_Slowpoke, + [SPECIES_SLOWBRO] = gMonIcon_Slowbro, + [SPECIES_MAGNEMITE] = gMonIcon_Magnemite, + [SPECIES_MAGNETON] = gMonIcon_Magneton, + [SPECIES_FARFETCHD] = gMonIcon_Farfetchd, + [SPECIES_DODUO] = gMonIcon_Doduo, + [SPECIES_DODRIO] = gMonIcon_Dodrio, + [SPECIES_SEEL] = gMonIcon_Seel, + [SPECIES_DEWGONG] = gMonIcon_Dewgong, + [SPECIES_GRIMER] = gMonIcon_Grimer, + [SPECIES_MUK] = gMonIcon_Muk, + [SPECIES_SHELLDER] = gMonIcon_Shellder, + [SPECIES_CLOYSTER] = gMonIcon_Cloyster, + [SPECIES_GASTLY] = gMonIcon_Gastly, + [SPECIES_HAUNTER] = gMonIcon_Haunter, + [SPECIES_GENGAR] = gMonIcon_Gengar, + [SPECIES_ONIX] = gMonIcon_Onix, + [SPECIES_DROWZEE] = gMonIcon_Drowzee, + [SPECIES_HYPNO] = gMonIcon_Hypno, + [SPECIES_KRABBY] = gMonIcon_Krabby, + [SPECIES_KINGLER] = gMonIcon_Kingler, + [SPECIES_VOLTORB] = gMonIcon_Voltorb, + [SPECIES_ELECTRODE] = gMonIcon_Electrode, + [SPECIES_EXEGGCUTE] = gMonIcon_Exeggcute, + [SPECIES_EXEGGUTOR] = gMonIcon_Exeggutor, + [SPECIES_CUBONE] = gMonIcon_Cubone, + [SPECIES_MAROWAK] = gMonIcon_Marowak, + [SPECIES_HITMONLEE] = gMonIcon_Hitmonlee, + [SPECIES_HITMONCHAN] = gMonIcon_Hitmonchan, + [SPECIES_LICKITUNG] = gMonIcon_Lickitung, + [SPECIES_KOFFING] = gMonIcon_Koffing, + [SPECIES_WEEZING] = gMonIcon_Weezing, + [SPECIES_RHYHORN] = gMonIcon_Rhyhorn, + [SPECIES_RHYDON] = gMonIcon_Rhydon, + [SPECIES_CHANSEY] = gMonIcon_Chansey, + [SPECIES_TANGELA] = gMonIcon_Tangela, + [SPECIES_KANGASKHAN] = gMonIcon_Kangaskhan, + [SPECIES_HORSEA] = gMonIcon_Horsea, + [SPECIES_SEADRA] = gMonIcon_Seadra, + [SPECIES_GOLDEEN] = gMonIcon_Goldeen, + [SPECIES_SEAKING] = gMonIcon_Seaking, + [SPECIES_STARYU] = gMonIcon_Staryu, + [SPECIES_STARMIE] = gMonIcon_Starmie, + [SPECIES_MR_MIME] = gMonIcon_Mrmime, + [SPECIES_SCYTHER] = gMonIcon_Scyther, + [SPECIES_JYNX] = gMonIcon_Jynx, + [SPECIES_ELECTABUZZ] = gMonIcon_Electabuzz, + [SPECIES_MAGMAR] = gMonIcon_Magmar, + [SPECIES_PINSIR] = gMonIcon_Pinsir, + [SPECIES_TAUROS] = gMonIcon_Tauros, + [SPECIES_MAGIKARP] = gMonIcon_Magikarp, + [SPECIES_GYARADOS] = gMonIcon_Gyarados, + [SPECIES_LAPRAS] = gMonIcon_Lapras, + [SPECIES_DITTO] = gMonIcon_Ditto, + [SPECIES_EEVEE] = gMonIcon_Eevee, + [SPECIES_VAPOREON] = gMonIcon_Vaporeon, + [SPECIES_JOLTEON] = gMonIcon_Jolteon, + [SPECIES_FLAREON] = gMonIcon_Flareon, + [SPECIES_PORYGON] = gMonIcon_Porygon, + [SPECIES_OMANYTE] = gMonIcon_Omanyte, + [SPECIES_OMASTAR] = gMonIcon_Omastar, + [SPECIES_KABUTO] = gMonIcon_Kabuto, + [SPECIES_KABUTOPS] = gMonIcon_Kabutops, + [SPECIES_AERODACTYL] = gMonIcon_Aerodactyl, + [SPECIES_SNORLAX] = gMonIcon_Snorlax, + [SPECIES_ARTICUNO] = gMonIcon_Articuno, + [SPECIES_ZAPDOS] = gMonIcon_Zapdos, + [SPECIES_MOLTRES] = gMonIcon_Moltres, + [SPECIES_DRATINI] = gMonIcon_Dratini, + [SPECIES_DRAGONAIR] = gMonIcon_Dragonair, + [SPECIES_DRAGONITE] = gMonIcon_Dragonite, + [SPECIES_MEWTWO] = gMonIcon_Mewtwo, + [SPECIES_MEW] = gMonIcon_Mew, + [SPECIES_CHIKORITA] = gMonIcon_Chikorita, + [SPECIES_BAYLEEF] = gMonIcon_Bayleef, + [SPECIES_MEGANIUM] = gMonIcon_Meganium, + [SPECIES_CYNDAQUIL] = gMonIcon_Cyndaquil, + [SPECIES_QUILAVA] = gMonIcon_Quilava, + [SPECIES_TYPHLOSION] = gMonIcon_Typhlosion, + [SPECIES_TOTODILE] = gMonIcon_Totodile, + [SPECIES_CROCONAW] = gMonIcon_Croconaw, + [SPECIES_FERALIGATR] = gMonIcon_Feraligatr, + [SPECIES_SENTRET] = gMonIcon_Sentret, + [SPECIES_FURRET] = gMonIcon_Furret, + [SPECIES_HOOTHOOT] = gMonIcon_Hoothoot, + [SPECIES_NOCTOWL] = gMonIcon_Noctowl, + [SPECIES_LEDYBA] = gMonIcon_Ledyba, + [SPECIES_LEDIAN] = gMonIcon_Ledian, + [SPECIES_SPINARAK] = gMonIcon_Spinarak, + [SPECIES_ARIADOS] = gMonIcon_Ariados, + [SPECIES_CROBAT] = gMonIcon_Crobat, + [SPECIES_CHINCHOU] = gMonIcon_Chinchou, + [SPECIES_LANTURN] = gMonIcon_Lanturn, + [SPECIES_PICHU] = gMonIcon_Pichu, + [SPECIES_CLEFFA] = gMonIcon_Cleffa, + [SPECIES_IGGLYBUFF] = gMonIcon_Igglybuff, + [SPECIES_TOGEPI] = gMonIcon_Togepi, + [SPECIES_TOGETIC] = gMonIcon_Togetic, + [SPECIES_NATU] = gMonIcon_Natu, + [SPECIES_XATU] = gMonIcon_Xatu, + [SPECIES_MAREEP] = gMonIcon_Mareep, + [SPECIES_FLAAFFY] = gMonIcon_Flaaffy, + [SPECIES_AMPHAROS] = gMonIcon_Ampharos, + [SPECIES_BELLOSSOM] = gMonIcon_Bellossom, + [SPECIES_MARILL] = gMonIcon_Marill, + [SPECIES_AZUMARILL] = gMonIcon_Azumarill, + [SPECIES_SUDOWOODO] = gMonIcon_Sudowoodo, + [SPECIES_POLITOED] = gMonIcon_Politoed, + [SPECIES_HOPPIP] = gMonIcon_Hoppip, + [SPECIES_SKIPLOOM] = gMonIcon_Skiploom, + [SPECIES_JUMPLUFF] = gMonIcon_Jumpluff, + [SPECIES_AIPOM] = gMonIcon_Aipom, + [SPECIES_SUNKERN] = gMonIcon_Sunkern, + [SPECIES_SUNFLORA] = gMonIcon_Sunflora, + [SPECIES_YANMA] = gMonIcon_Yanma, + [SPECIES_WOOPER] = gMonIcon_Wooper, + [SPECIES_QUAGSIRE] = gMonIcon_Quagsire, + [SPECIES_ESPEON] = gMonIcon_Espeon, + [SPECIES_UMBREON] = gMonIcon_Umbreon, + [SPECIES_MURKROW] = gMonIcon_Murkrow, + [SPECIES_SLOWKING] = gMonIcon_Slowking, + [SPECIES_MISDREAVUS] = gMonIcon_Misdreavus, + [SPECIES_UNOWN] = gMonIcon_UnownA, + [SPECIES_WOBBUFFET] = gMonIcon_Wobbuffet, + [SPECIES_GIRAFARIG] = gMonIcon_Girafarig, + [SPECIES_PINECO] = gMonIcon_Pineco, + [SPECIES_FORRETRESS] = gMonIcon_Forretress, + [SPECIES_DUNSPARCE] = gMonIcon_Dunsparce, + [SPECIES_GLIGAR] = gMonIcon_Gligar, + [SPECIES_STEELIX] = gMonIcon_Steelix, + [SPECIES_SNUBBULL] = gMonIcon_Snubbull, + [SPECIES_GRANBULL] = gMonIcon_Granbull, + [SPECIES_QWILFISH] = gMonIcon_Qwilfish, + [SPECIES_SCIZOR] = gMonIcon_Scizor, + [SPECIES_SHUCKLE] = gMonIcon_Shuckle, + [SPECIES_HERACROSS] = gMonIcon_Heracross, + [SPECIES_SNEASEL] = gMonIcon_Sneasel, + [SPECIES_TEDDIURSA] = gMonIcon_Teddiursa, + [SPECIES_URSARING] = gMonIcon_Ursaring, + [SPECIES_SLUGMA] = gMonIcon_Slugma, + [SPECIES_MAGCARGO] = gMonIcon_Magcargo, + [SPECIES_SWINUB] = gMonIcon_Swinub, + [SPECIES_PILOSWINE] = gMonIcon_Piloswine, + [SPECIES_CORSOLA] = gMonIcon_Corsola, + [SPECIES_REMORAID] = gMonIcon_Remoraid, + [SPECIES_OCTILLERY] = gMonIcon_Octillery, + [SPECIES_DELIBIRD] = gMonIcon_Delibird, + [SPECIES_MANTINE] = gMonIcon_Mantine, + [SPECIES_SKARMORY] = gMonIcon_Skarmory, + [SPECIES_HOUNDOUR] = gMonIcon_Houndour, + [SPECIES_HOUNDOOM] = gMonIcon_Houndoom, + [SPECIES_KINGDRA] = gMonIcon_Kingdra, + [SPECIES_PHANPY] = gMonIcon_Phanpy, + [SPECIES_DONPHAN] = gMonIcon_Donphan, + [SPECIES_PORYGON2] = gMonIcon_Porygon2, + [SPECIES_STANTLER] = gMonIcon_Stantler, + [SPECIES_SMEARGLE] = gMonIcon_Smeargle, + [SPECIES_TYROGUE] = gMonIcon_Tyrogue, + [SPECIES_HITMONTOP] = gMonIcon_Hitmontop, + [SPECIES_SMOOCHUM] = gMonIcon_Smoochum, + [SPECIES_ELEKID] = gMonIcon_Elekid, + [SPECIES_MAGBY] = gMonIcon_Magby, + [SPECIES_MILTANK] = gMonIcon_Miltank, + [SPECIES_BLISSEY] = gMonIcon_Blissey, + [SPECIES_RAIKOU] = gMonIcon_Raikou, + [SPECIES_ENTEI] = gMonIcon_Entei, + [SPECIES_SUICUNE] = gMonIcon_Suicune, + [SPECIES_LARVITAR] = gMonIcon_Larvitar, + [SPECIES_PUPITAR] = gMonIcon_Pupitar, + [SPECIES_TYRANITAR] = gMonIcon_Tyranitar, + [SPECIES_LUGIA] = gMonIcon_Lugia, + [SPECIES_HO_OH] = gMonIcon_HoOh, + [SPECIES_CELEBI] = gMonIcon_Celebi, + [SPECIES_OLD_UNOWN_B] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_C] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_D] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_E] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_F] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_G] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_H] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_I] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_J] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_K] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_L] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_M] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_N] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_O] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_P] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_Q] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_R] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_S] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_T] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_U] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_V] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_W] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_X] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_Y] = gMonIcon_QuestionMark, + [SPECIES_OLD_UNOWN_Z] = gMonIcon_QuestionMark, + [SPECIES_TREECKO] = gMonIcon_Treecko, + [SPECIES_GROVYLE] = gMonIcon_Grovyle, + [SPECIES_SCEPTILE] = gMonIcon_Sceptile, + [SPECIES_TORCHIC] = gMonIcon_Torchic, + [SPECIES_COMBUSKEN] = gMonIcon_Combusken, + [SPECIES_BLAZIKEN] = gMonIcon_Blaziken, + [SPECIES_MUDKIP] = gMonIcon_Mudkip, + [SPECIES_MARSHTOMP] = gMonIcon_Marshtomp, + [SPECIES_SWAMPERT] = gMonIcon_Swampert, + [SPECIES_POOCHYENA] = gMonIcon_Poochyena, + [SPECIES_MIGHTYENA] = gMonIcon_Mightyena, + [SPECIES_ZIGZAGOON] = gMonIcon_Zigzagoon, + [SPECIES_LINOONE] = gMonIcon_Linoone, + [SPECIES_WURMPLE] = gMonIcon_Wurmple, + [SPECIES_SILCOON] = gMonIcon_Silcoon, + [SPECIES_BEAUTIFLY] = gMonIcon_Beautifly, + [SPECIES_CASCOON] = gMonIcon_Cascoon, + [SPECIES_DUSTOX] = gMonIcon_Dustox, + [SPECIES_LOTAD] = gMonIcon_Lotad, + [SPECIES_LOMBRE] = gMonIcon_Lombre, + [SPECIES_LUDICOLO] = gMonIcon_Ludicolo, + [SPECIES_SEEDOT] = gMonIcon_Seedot, + [SPECIES_NUZLEAF] = gMonIcon_Nuzleaf, + [SPECIES_SHIFTRY] = gMonIcon_Shiftry, + [SPECIES_NINCADA] = gMonIcon_Nincada, + [SPECIES_NINJASK] = gMonIcon_Ninjask, + [SPECIES_SHEDINJA] = gMonIcon_Shedinja, + [SPECIES_TAILLOW] = gMonIcon_Taillow, + [SPECIES_SWELLOW] = gMonIcon_Swellow, + [SPECIES_SHROOMISH] = gMonIcon_Shroomish, + [SPECIES_BRELOOM] = gMonIcon_Breloom, + [SPECIES_SPINDA] = gMonIcon_Spinda, + [SPECIES_WINGULL] = gMonIcon_Wingull, + [SPECIES_PELIPPER] = gMonIcon_Pelipper, + [SPECIES_SURSKIT] = gMonIcon_Surskit, + [SPECIES_MASQUERAIN] = gMonIcon_Masquerain, + [SPECIES_WAILMER] = gMonIcon_Wailmer, + [SPECIES_WAILORD] = gMonIcon_Wailord, + [SPECIES_SKITTY] = gMonIcon_Skitty, + [SPECIES_DELCATTY] = gMonIcon_Delcatty, + [SPECIES_KECLEON] = gMonIcon_Kecleon, + [SPECIES_BALTOY] = gMonIcon_Baltoy, + [SPECIES_CLAYDOL] = gMonIcon_Claydol, + [SPECIES_NOSEPASS] = gMonIcon_Nosepass, + [SPECIES_TORKOAL] = gMonIcon_Torkoal, + [SPECIES_SABLEYE] = gMonIcon_Sableye, + [SPECIES_BARBOACH] = gMonIcon_Barboach, + [SPECIES_WHISCASH] = gMonIcon_Whiscash, + [SPECIES_LUVDISC] = gMonIcon_Luvdisc, + [SPECIES_CORPHISH] = gMonIcon_Corphish, + [SPECIES_CRAWDAUNT] = gMonIcon_Crawdaunt, + [SPECIES_FEEBAS] = gMonIcon_Feebas, + [SPECIES_MILOTIC] = gMonIcon_Milotic, + [SPECIES_CARVANHA] = gMonIcon_Carvanha, + [SPECIES_SHARPEDO] = gMonIcon_Sharpedo, + [SPECIES_TRAPINCH] = gMonIcon_Trapinch, + [SPECIES_VIBRAVA] = gMonIcon_Vibrava, + [SPECIES_FLYGON] = gMonIcon_Flygon, + [SPECIES_MAKUHITA] = gMonIcon_Makuhita, + [SPECIES_HARIYAMA] = gMonIcon_Hariyama, + [SPECIES_ELECTRIKE] = gMonIcon_Electrike, + [SPECIES_MANECTRIC] = gMonIcon_Manectric, + [SPECIES_NUMEL] = gMonIcon_Numel, + [SPECIES_CAMERUPT] = gMonIcon_Camerupt, + [SPECIES_SPHEAL] = gMonIcon_Spheal, + [SPECIES_SEALEO] = gMonIcon_Sealeo, + [SPECIES_WALREIN] = gMonIcon_Walrein, + [SPECIES_CACNEA] = gMonIcon_Cacnea, + [SPECIES_CACTURNE] = gMonIcon_Cacturne, + [SPECIES_SNORUNT] = gMonIcon_Snorunt, + [SPECIES_GLALIE] = gMonIcon_Glalie, + [SPECIES_LUNATONE] = gMonIcon_Lunatone, + [SPECIES_SOLROCK] = gMonIcon_Solrock, + [SPECIES_AZURILL] = gMonIcon_Azurill, + [SPECIES_SPOINK] = gMonIcon_Spoink, + [SPECIES_GRUMPIG] = gMonIcon_Grumpig, + [SPECIES_PLUSLE] = gMonIcon_Plusle, + [SPECIES_MINUN] = gMonIcon_Minun, + [SPECIES_MAWILE] = gMonIcon_Mawile, + [SPECIES_MEDITITE] = gMonIcon_Meditite, + [SPECIES_MEDICHAM] = gMonIcon_Medicham, + [SPECIES_SWABLU] = gMonIcon_Swablu, + [SPECIES_ALTARIA] = gMonIcon_Altaria, + [SPECIES_WYNAUT] = gMonIcon_Wynaut, + [SPECIES_DUSKULL] = gMonIcon_Duskull, + [SPECIES_DUSCLOPS] = gMonIcon_Dusclops, + [SPECIES_ROSELIA] = gMonIcon_Roselia, + [SPECIES_SLAKOTH] = gMonIcon_Slakoth, + [SPECIES_VIGOROTH] = gMonIcon_Vigoroth, + [SPECIES_SLAKING] = gMonIcon_Slaking, + [SPECIES_GULPIN] = gMonIcon_Gulpin, + [SPECIES_SWALOT] = gMonIcon_Swalot, + [SPECIES_TROPIUS] = gMonIcon_Tropius, + [SPECIES_WHISMUR] = gMonIcon_Whismur, + [SPECIES_LOUDRED] = gMonIcon_Loudred, + [SPECIES_EXPLOUD] = gMonIcon_Exploud, + [SPECIES_CLAMPERL] = gMonIcon_Clamperl, + [SPECIES_HUNTAIL] = gMonIcon_Huntail, + [SPECIES_GOREBYSS] = gMonIcon_Gorebyss, + [SPECIES_ABSOL] = gMonIcon_Absol, + [SPECIES_SHUPPET] = gMonIcon_Shuppet, + [SPECIES_BANETTE] = gMonIcon_Banette, + [SPECIES_SEVIPER] = gMonIcon_Seviper, + [SPECIES_ZANGOOSE] = gMonIcon_Zangoose, + [SPECIES_RELICANTH] = gMonIcon_Relicanth, + [SPECIES_ARON] = gMonIcon_Aron, + [SPECIES_LAIRON] = gMonIcon_Lairon, + [SPECIES_AGGRON] = gMonIcon_Aggron, + [SPECIES_CASTFORM] = gMonIcon_Castform, + [SPECIES_VOLBEAT] = gMonIcon_Volbeat, + [SPECIES_ILLUMISE] = gMonIcon_Illumise, + [SPECIES_LILEEP] = gMonIcon_Lileep, + [SPECIES_CRADILY] = gMonIcon_Cradily, + [SPECIES_ANORITH] = gMonIcon_Anorith, + [SPECIES_ARMALDO] = gMonIcon_Armaldo, + [SPECIES_RALTS] = gMonIcon_Ralts, + [SPECIES_KIRLIA] = gMonIcon_Kirlia, + [SPECIES_GARDEVOIR] = gMonIcon_Gardevoir, + [SPECIES_BAGON] = gMonIcon_Bagon, + [SPECIES_SHELGON] = gMonIcon_Shelgon, + [SPECIES_SALAMENCE] = gMonIcon_Salamence, + [SPECIES_BELDUM] = gMonIcon_Beldum, + [SPECIES_METANG] = gMonIcon_Metang, + [SPECIES_METAGROSS] = gMonIcon_Metagross, + [SPECIES_REGIROCK] = gMonIcon_Regirock, + [SPECIES_REGICE] = gMonIcon_Regice, + [SPECIES_REGISTEEL] = gMonIcon_Registeel, + [SPECIES_KYOGRE] = gMonIcon_Kyogre, + [SPECIES_GROUDON] = gMonIcon_Groudon, + [SPECIES_RAYQUAZA] = gMonIcon_Rayquaza, + [SPECIES_LATIAS] = gMonIcon_Latias, + [SPECIES_LATIOS] = gMonIcon_Latios, + [SPECIES_JIRACHI] = gMonIcon_Jirachi, + [SPECIES_DEOXYS] = gMonIcon_Deoxys, + [SPECIES_CHIMECHO] = gMonIcon_Chimecho, + [SPECIES_EGG] = gMonIcon_Egg, + [SPECIES_UNOWN_B] = gMonIcon_UnownB, + [SPECIES_UNOWN_C] = gMonIcon_UnownC, + [SPECIES_UNOWN_D] = gMonIcon_UnownD, + [SPECIES_UNOWN_E] = gMonIcon_UnownE, + [SPECIES_UNOWN_F] = gMonIcon_UnownF, + [SPECIES_UNOWN_G] = gMonIcon_UnownG, + [SPECIES_UNOWN_H] = gMonIcon_UnownH, + [SPECIES_UNOWN_I] = gMonIcon_UnownI, + [SPECIES_UNOWN_J] = gMonIcon_UnownJ, + [SPECIES_UNOWN_K] = gMonIcon_UnownK, + [SPECIES_UNOWN_L] = gMonIcon_UnownL, + [SPECIES_UNOWN_M] = gMonIcon_UnownM, + [SPECIES_UNOWN_N] = gMonIcon_UnownN, + [SPECIES_UNOWN_O] = gMonIcon_UnownO, + [SPECIES_UNOWN_P] = gMonIcon_UnownP, + [SPECIES_UNOWN_Q] = gMonIcon_UnownQ, + [SPECIES_UNOWN_R] = gMonIcon_UnownR, + [SPECIES_UNOWN_S] = gMonIcon_UnownS, + [SPECIES_UNOWN_T] = gMonIcon_UnownT, + [SPECIES_UNOWN_U] = gMonIcon_UnownU, + [SPECIES_UNOWN_V] = gMonIcon_UnownV, + [SPECIES_UNOWN_W] = gMonIcon_UnownW, + [SPECIES_UNOWN_X] = gMonIcon_UnownX, + [SPECIES_UNOWN_Y] = gMonIcon_UnownY, + [SPECIES_UNOWN_Z] = gMonIcon_UnownZ, + [SPECIES_UNOWN_EMARK] = gMonIcon_UnownExclamationMark, + [SPECIES_UNOWN_QMARK] = gMonIcon_UnownQuestionMark, }; const u8 gMonIconPaletteIndices[] = @@ -1138,7 +1138,7 @@ void sub_80D2EF8(struct Sprite *sprite) void LoadMonIconPalettes(void) { u8 i; - for (i = 0; i < 6; i++) + for (i = 0; i < ARRAY_COUNT(gMonIconPaletteTable); i++) LoadSpritePalette(&gMonIconPaletteTable[i]); } @@ -1192,7 +1192,7 @@ void sub_80D3014(struct Sprite *sprite) const u8* GetMonIconTiles(u16 species, bool32 extra) { const u8* iconSprite = gMonIconTable[species]; - if(species == SPECIES_DEOXYS && extra == TRUE) + if (species == SPECIES_DEOXYS && extra == TRUE) { iconSprite = (const u8*)(0x400 + (u32)iconSprite); //WTF? } @@ -1308,5 +1308,3 @@ void sub_80D32C8(struct Sprite *sprite, u8 animNum) sprite->animDelayCounter = 0; sprite->animCmdIndex = 0; } - - From 2745cdc7d26e84d7efc5349519a494610390e130 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Apr 2019 18:02:43 +0200 Subject: [PATCH 061/101] Remove unneeded sMonAnimationDelayTable entries --- src/pokemon.c | 358 +------------------------------------------------- 1 file changed, 1 insertion(+), 357 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index 7c26b4c22..984c484a2 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -1810,419 +1810,63 @@ static const u8 sMonFrontAnimIdsTable[] = [SPECIES_CHIMECHO - 1] = 0x1d, }; -static const u8 sMonAnimationDelayTable[] = +static const u8 sMonAnimationDelayTable[NUM_SPECIES - 1] = { - [SPECIES_BULBASAUR - 1] = 0x00, - [SPECIES_IVYSAUR - 1] = 0x00, - [SPECIES_VENUSAUR - 1] = 0x00, - [SPECIES_CHARMANDER - 1] = 0x00, - [SPECIES_CHARMELEON - 1] = 0x00, - [SPECIES_CHARIZARD - 1] = 0x00, - [SPECIES_SQUIRTLE - 1] = 0x00, - [SPECIES_WARTORTLE - 1] = 0x00, [SPECIES_BLASTOISE - 1] = 0x32, - [SPECIES_CATERPIE - 1] = 0x00, - [SPECIES_METAPOD - 1] = 0x00, - [SPECIES_BUTTERFREE - 1] = 0x00, [SPECIES_WEEDLE - 1] = 0x0a, [SPECIES_KAKUNA - 1] = 0x14, [SPECIES_BEEDRILL - 1] = 0x23, - [SPECIES_PIDGEY - 1] = 0x00, [SPECIES_PIDGEOTTO - 1] = 0x19, - [SPECIES_PIDGEOT - 1] = 0x00, - [SPECIES_RATTATA - 1] = 0x00, - [SPECIES_RATICATE - 1] = 0x00, - [SPECIES_SPEAROW - 1] = 0x00, [SPECIES_FEAROW - 1] = 0x02, [SPECIES_EKANS - 1] = 0x1e, - [SPECIES_ARBOK - 1] = 0x00, - [SPECIES_PIKACHU - 1] = 0x00, - [SPECIES_RAICHU - 1] = 0x00, - [SPECIES_SANDSHREW - 1] = 0x00, - [SPECIES_SANDSLASH - 1] = 0x00, [SPECIES_NIDORAN_F - 1] = 0x1c, - [SPECIES_NIDORINA - 1] = 0x00, - [SPECIES_NIDOQUEEN - 1] = 0x00, - [SPECIES_NIDORAN_M - 1] = 0x00, - [SPECIES_NIDORINO - 1] = 0x00, [SPECIES_NIDOKING - 1] = 0x19, - [SPECIES_CLEFAIRY - 1] = 0x00, - [SPECIES_CLEFABLE - 1] = 0x00, - [SPECIES_VULPIX - 1] = 0x00, - [SPECIES_NINETALES - 1] = 0x00, - [SPECIES_JIGGLYPUFF - 1] = 0x00, - [SPECIES_WIGGLYTUFF - 1] = 0x00, - [SPECIES_ZUBAT - 1] = 0x00, - [SPECIES_GOLBAT - 1] = 0x00, - [SPECIES_ODDISH - 1] = 0x00, - [SPECIES_GLOOM - 1] = 0x00, - [SPECIES_VILEPLUME - 1] = 0x00, [SPECIES_PARAS - 1] = 0x0a, [SPECIES_PARASECT - 1] = 0x2d, [SPECIES_VENONAT - 1] = 0x14, - [SPECIES_VENOMOTH - 1] = 0x00, [SPECIES_DIGLETT - 1] = 0x19, [SPECIES_DUGTRIO - 1] = 0x23, [SPECIES_MEOWTH - 1] = 0x28, [SPECIES_PERSIAN - 1] = 0x14, - [SPECIES_PSYDUCK - 1] = 0x00, - [SPECIES_GOLDUCK - 1] = 0x00, [SPECIES_MANKEY - 1] = 0x14, - [SPECIES_PRIMEAPE - 1] = 0x00, [SPECIES_GROWLITHE - 1] = 0x1e, [SPECIES_ARCANINE - 1] = 0x28, - [SPECIES_POLIWAG - 1] = 0x00, [SPECIES_POLIWHIRL - 1] = 0x05, - [SPECIES_POLIWRATH - 1] = 0x00, - [SPECIES_ABRA - 1] = 0x00, - [SPECIES_KADABRA - 1] = 0x00, - [SPECIES_ALAKAZAM - 1] = 0x00, - [SPECIES_MACHOP - 1] = 0x00, - [SPECIES_MACHOKE - 1] = 0x00, - [SPECIES_MACHAMP - 1] = 0x00, - [SPECIES_BELLSPROUT - 1] = 0x00, [SPECIES_WEEPINBELL - 1] = 0x03, - [SPECIES_VICTREEBEL - 1] = 0x00, - [SPECIES_TENTACOOL - 1] = 0x00, - [SPECIES_TENTACRUEL - 1] = 0x00, - [SPECIES_GEODUDE - 1] = 0x00, - [SPECIES_GRAVELER - 1] = 0x00, - [SPECIES_GOLEM - 1] = 0x00, - [SPECIES_PONYTA - 1] = 0x00, - [SPECIES_RAPIDASH - 1] = 0x00, - [SPECIES_SLOWPOKE - 1] = 0x00, - [SPECIES_SLOWBRO - 1] = 0x00, - [SPECIES_MAGNEMITE - 1] = 0x00, - [SPECIES_MAGNETON - 1] = 0x00, - [SPECIES_FARFETCHD - 1] = 0x00, - [SPECIES_DODUO - 1] = 0x00, - [SPECIES_DODRIO - 1] = 0x00, - [SPECIES_SEEL - 1] = 0x00, - [SPECIES_DEWGONG - 1] = 0x00, - [SPECIES_GRIMER - 1] = 0x00, [SPECIES_MUK - 1] = 0x2d, [SPECIES_SHELLDER - 1] = 0x14, - [SPECIES_CLOYSTER - 1] = 0x00, - [SPECIES_GASTLY - 1] = 0x00, [SPECIES_HAUNTER - 1] = 0x17, - [SPECIES_GENGAR - 1] = 0x00, - [SPECIES_ONIX - 1] = 0x00, [SPECIES_DROWZEE - 1] = 0x30, [SPECIES_HYPNO - 1] = 0x28, - [SPECIES_KRABBY - 1] = 0x00, - [SPECIES_KINGLER - 1] = 0x00, - [SPECIES_VOLTORB - 1] = 0x00, - [SPECIES_ELECTRODE - 1] = 0x00, - [SPECIES_EXEGGCUTE - 1] = 0x00, - [SPECIES_EXEGGUTOR - 1] = 0x00, - [SPECIES_CUBONE - 1] = 0x00, - [SPECIES_MAROWAK - 1] = 0x00, - [SPECIES_HITMONLEE - 1] = 0x00, [SPECIES_HITMONCHAN - 1] = 0x19, - [SPECIES_LICKITUNG - 1] = 0x00, - [SPECIES_KOFFING - 1] = 0x00, - [SPECIES_WEEZING - 1] = 0x00, - [SPECIES_RHYHORN - 1] = 0x00, - [SPECIES_RHYDON - 1] = 0x00, - [SPECIES_CHANSEY - 1] = 0x00, - [SPECIES_TANGELA - 1] = 0x00, - [SPECIES_KANGASKHAN - 1] = 0x00, - [SPECIES_HORSEA - 1] = 0x00, - [SPECIES_SEADRA - 1] = 0x00, - [SPECIES_GOLDEEN - 1] = 0x00, - [SPECIES_SEAKING - 1] = 0x00, - [SPECIES_STARYU - 1] = 0x00, - [SPECIES_STARMIE - 1] = 0x00, - [SPECIES_MR_MIME - 1] = 0x00, [SPECIES_SCYTHER - 1] = 0x0a, - [SPECIES_JYNX - 1] = 0x00, - [SPECIES_ELECTABUZZ - 1] = 0x00, - [SPECIES_MAGMAR - 1] = 0x00, - [SPECIES_PINSIR - 1] = 0x00, [SPECIES_TAUROS - 1] = 0x0a, - [SPECIES_MAGIKARP - 1] = 0x00, - [SPECIES_GYARADOS - 1] = 0x00, - [SPECIES_LAPRAS - 1] = 0x00, - [SPECIES_DITTO - 1] = 0x00, - [SPECIES_EEVEE - 1] = 0x00, - [SPECIES_VAPOREON - 1] = 0x00, - [SPECIES_JOLTEON - 1] = 0x00, - [SPECIES_FLAREON - 1] = 0x00, - [SPECIES_PORYGON - 1] = 0x00, - [SPECIES_OMANYTE - 1] = 0x00, - [SPECIES_OMASTAR - 1] = 0x00, - [SPECIES_KABUTO - 1] = 0x00, - [SPECIES_KABUTOPS - 1] = 0x00, - [SPECIES_AERODACTYL - 1] = 0x00, - [SPECIES_SNORLAX - 1] = 0x00, - [SPECIES_ARTICUNO - 1] = 0x00, - [SPECIES_ZAPDOS - 1] = 0x00, - [SPECIES_MOLTRES - 1] = 0x00, - [SPECIES_DRATINI - 1] = 0x00, - [SPECIES_DRAGONAIR - 1] = 0x00, - [SPECIES_DRAGONITE - 1] = 0x00, - [SPECIES_MEWTWO - 1] = 0x00, - [SPECIES_MEW - 1] = 0x00, - [SPECIES_CHIKORITA - 1] = 0x00, - [SPECIES_BAYLEEF - 1] = 0x00, - [SPECIES_MEGANIUM - 1] = 0x00, - [SPECIES_CYNDAQUIL - 1] = 0x00, - [SPECIES_QUILAVA - 1] = 0x00, [SPECIES_TYPHLOSION - 1] = 0x14, - [SPECIES_TOTODILE - 1] = 0x00, - [SPECIES_CROCONAW - 1] = 0x00, [SPECIES_FERALIGATR - 1] = 0x05, - [SPECIES_SENTRET - 1] = 0x00, - [SPECIES_FURRET - 1] = 0x00, - [SPECIES_HOOTHOOT - 1] = 0x00, - [SPECIES_NOCTOWL - 1] = 0x00, - [SPECIES_LEDYBA - 1] = 0x00, - [SPECIES_LEDIAN - 1] = 0x00, - [SPECIES_SPINARAK - 1] = 0x00, - [SPECIES_ARIADOS - 1] = 0x00, - [SPECIES_CROBAT - 1] = 0x00, - [SPECIES_CHINCHOU - 1] = 0x00, - [SPECIES_LANTURN - 1] = 0x00, - [SPECIES_PICHU - 1] = 0x00, - [SPECIES_CLEFFA - 1] = 0x00, - [SPECIES_IGGLYBUFF - 1] = 0x00, - [SPECIES_TOGEPI - 1] = 0x00, - [SPECIES_TOGETIC - 1] = 0x00, [SPECIES_NATU - 1] = 0x1e, - [SPECIES_XATU - 1] = 0x00, [SPECIES_MAREEP - 1] = 0x32, - [SPECIES_FLAAFFY - 1] = 0x00, [SPECIES_AMPHAROS - 1] = 0x0a, - [SPECIES_BELLOSSOM - 1] = 0x00, - [SPECIES_MARILL - 1] = 0x00, - [SPECIES_AZUMARILL - 1] = 0x00, - [SPECIES_SUDOWOODO - 1] = 0x00, [SPECIES_POLITOED - 1] = 0x28, - [SPECIES_HOPPIP - 1] = 0x00, - [SPECIES_SKIPLOOM - 1] = 0x00, - [SPECIES_JUMPLUFF - 1] = 0x00, - [SPECIES_AIPOM - 1] = 0x00, - [SPECIES_SUNKERN - 1] = 0x00, - [SPECIES_SUNFLORA - 1] = 0x00, - [SPECIES_YANMA - 1] = 0x00, - [SPECIES_WOOPER - 1] = 0x00, - [SPECIES_QUAGSIRE - 1] = 0x00, - [SPECIES_ESPEON - 1] = 0x00, - [SPECIES_UMBREON - 1] = 0x00, - [SPECIES_MURKROW - 1] = 0x00, - [SPECIES_SLOWKING - 1] = 0x00, - [SPECIES_MISDREAVUS - 1] = 0x00, - [SPECIES_UNOWN - 1] = 0x00, - [SPECIES_WOBBUFFET - 1] = 0x00, - [SPECIES_GIRAFARIG - 1] = 0x00, - [SPECIES_PINECO - 1] = 0x00, - [SPECIES_FORRETRESS - 1] = 0x00, [SPECIES_DUNSPARCE - 1] = 0x0a, - [SPECIES_GLIGAR - 1] = 0x00, [SPECIES_STEELIX - 1] = 0x2d, - [SPECIES_SNUBBULL - 1] = 0x00, - [SPECIES_GRANBULL - 1] = 0x00, [SPECIES_QWILFISH - 1] = 0x27, [SPECIES_SCIZOR - 1] = 0x13, - [SPECIES_SHUCKLE - 1] = 0x00, - [SPECIES_HERACROSS - 1] = 0x00, - [SPECIES_SNEASEL - 1] = 0x00, - [SPECIES_TEDDIURSA - 1] = 0x00, - [SPECIES_URSARING - 1] = 0x00, - [SPECIES_SLUGMA - 1] = 0x00, - [SPECIES_MAGCARGO - 1] = 0x00, - [SPECIES_SWINUB - 1] = 0x00, - [SPECIES_PILOSWINE - 1] = 0x00, - [SPECIES_CORSOLA - 1] = 0x00, - [SPECIES_REMORAID - 1] = 0x00, [SPECIES_OCTILLERY - 1] = 0x14, - [SPECIES_DELIBIRD - 1] = 0x00, - [SPECIES_MANTINE - 1] = 0x00, - [SPECIES_SKARMORY - 1] = 0x00, - [SPECIES_HOUNDOUR - 1] = 0x00, - [SPECIES_HOUNDOOM - 1] = 0x00, - [SPECIES_KINGDRA - 1] = 0x00, - [SPECIES_PHANPY - 1] = 0x00, - [SPECIES_DONPHAN - 1] = 0x00, - [SPECIES_PORYGON2 - 1] = 0x00, - [SPECIES_STANTLER - 1] = 0x00, - [SPECIES_SMEARGLE - 1] = 0x00, - [SPECIES_TYROGUE - 1] = 0x00, - [SPECIES_HITMONTOP - 1] = 0x00, [SPECIES_SMOOCHUM - 1] = 0x28, - [SPECIES_ELEKID - 1] = 0x00, - [SPECIES_MAGBY - 1] = 0x00, - [SPECIES_MILTANK - 1] = 0x00, - [SPECIES_BLISSEY - 1] = 0x00, - [SPECIES_RAIKOU - 1] = 0x00, - [SPECIES_ENTEI - 1] = 0x00, - [SPECIES_SUICUNE - 1] = 0x00, - [SPECIES_LARVITAR - 1] = 0x00, - [SPECIES_PUPITAR - 1] = 0x00, [SPECIES_TYRANITAR - 1] = 0x0a, [SPECIES_LUGIA - 1] = 0x14, - [SPECIES_HO_OH - 1] = 0x00, - [SPECIES_CELEBI - 1] = 0x00, - [SPECIES_OLD_UNOWN_B - 1] = 0x00, - [SPECIES_OLD_UNOWN_C - 1] = 0x00, - [SPECIES_OLD_UNOWN_D - 1] = 0x00, - [SPECIES_OLD_UNOWN_E - 1] = 0x00, - [SPECIES_OLD_UNOWN_F - 1] = 0x00, - [SPECIES_OLD_UNOWN_G - 1] = 0x00, - [SPECIES_OLD_UNOWN_H - 1] = 0x00, - [SPECIES_OLD_UNOWN_I - 1] = 0x00, - [SPECIES_OLD_UNOWN_J - 1] = 0x00, - [SPECIES_OLD_UNOWN_K - 1] = 0x00, - [SPECIES_OLD_UNOWN_L - 1] = 0x00, - [SPECIES_OLD_UNOWN_M - 1] = 0x00, - [SPECIES_OLD_UNOWN_N - 1] = 0x00, - [SPECIES_OLD_UNOWN_O - 1] = 0x00, - [SPECIES_OLD_UNOWN_P - 1] = 0x00, - [SPECIES_OLD_UNOWN_Q - 1] = 0x00, - [SPECIES_OLD_UNOWN_R - 1] = 0x00, - [SPECIES_OLD_UNOWN_S - 1] = 0x00, - [SPECIES_OLD_UNOWN_T - 1] = 0x00, - [SPECIES_OLD_UNOWN_U - 1] = 0x00, - [SPECIES_OLD_UNOWN_V - 1] = 0x00, - [SPECIES_OLD_UNOWN_W - 1] = 0x00, - [SPECIES_OLD_UNOWN_X - 1] = 0x00, - [SPECIES_OLD_UNOWN_Y - 1] = 0x00, - [SPECIES_OLD_UNOWN_Z - 1] = 0x00, - [SPECIES_TREECKO - 1] = 0x00, - [SPECIES_GROVYLE - 1] = 0x00, - [SPECIES_SCEPTILE - 1] = 0x00, - [SPECIES_TORCHIC - 1] = 0x00, - [SPECIES_COMBUSKEN - 1] = 0x00, - [SPECIES_BLAZIKEN - 1] = 0x00, - [SPECIES_MUDKIP - 1] = 0x00, - [SPECIES_MARSHTOMP - 1] = 0x00, - [SPECIES_SWAMPERT - 1] = 0x00, - [SPECIES_POOCHYENA - 1] = 0x00, - [SPECIES_MIGHTYENA - 1] = 0x00, - [SPECIES_ZIGZAGOON - 1] = 0x00, - [SPECIES_LINOONE - 1] = 0x00, - [SPECIES_WURMPLE - 1] = 0x00, - [SPECIES_SILCOON - 1] = 0x00, - [SPECIES_BEAUTIFLY - 1] = 0x00, - [SPECIES_CASCOON - 1] = 0x00, - [SPECIES_DUSTOX - 1] = 0x00, - [SPECIES_LOTAD - 1] = 0x00, - [SPECIES_LOMBRE - 1] = 0x00, - [SPECIES_LUDICOLO - 1] = 0x00, - [SPECIES_SEEDOT - 1] = 0x00, - [SPECIES_NUZLEAF - 1] = 0x00, - [SPECIES_SHIFTRY - 1] = 0x00, - [SPECIES_NINCADA - 1] = 0x00, - [SPECIES_NINJASK - 1] = 0x00, - [SPECIES_SHEDINJA - 1] = 0x00, - [SPECIES_TAILLOW - 1] = 0x00, - [SPECIES_SWELLOW - 1] = 0x00, - [SPECIES_SHROOMISH - 1] = 0x00, - [SPECIES_BRELOOM - 1] = 0x00, - [SPECIES_SPINDA - 1] = 0x00, - [SPECIES_WINGULL - 1] = 0x00, - [SPECIES_PELIPPER - 1] = 0x00, - [SPECIES_SURSKIT - 1] = 0x00, - [SPECIES_MASQUERAIN - 1] = 0x00, - [SPECIES_WAILMER - 1] = 0x00, [SPECIES_WAILORD - 1] = 0x0a, - [SPECIES_SKITTY - 1] = 0x00, - [SPECIES_DELCATTY - 1] = 0x00, [SPECIES_KECLEON - 1] = 0x1e, - [SPECIES_BALTOY - 1] = 0x00, - [SPECIES_CLAYDOL - 1] = 0x00, - [SPECIES_NOSEPASS - 1] = 0x00, - [SPECIES_TORKOAL - 1] = 0x00, - [SPECIES_SABLEYE - 1] = 0x00, - [SPECIES_BARBOACH - 1] = 0x00, - [SPECIES_WHISCASH - 1] = 0x00, - [SPECIES_LUVDISC - 1] = 0x00, - [SPECIES_CORPHISH - 1] = 0x00, - [SPECIES_CRAWDAUNT - 1] = 0x00, - [SPECIES_FEEBAS - 1] = 0x00, [SPECIES_MILOTIC - 1] = 0x2d, - [SPECIES_CARVANHA - 1] = 0x00, - [SPECIES_SHARPEDO - 1] = 0x00, - [SPECIES_TRAPINCH - 1] = 0x00, - [SPECIES_VIBRAVA - 1] = 0x00, - [SPECIES_FLYGON - 1] = 0x00, - [SPECIES_MAKUHITA - 1] = 0x00, - [SPECIES_HARIYAMA - 1] = 0x00, - [SPECIES_ELECTRIKE - 1] = 0x00, - [SPECIES_MANECTRIC - 1] = 0x00, - [SPECIES_NUMEL - 1] = 0x00, - [SPECIES_CAMERUPT - 1] = 0x00, [SPECIES_SPHEAL - 1] = 0x0f, - [SPECIES_SEALEO - 1] = 0x00, - [SPECIES_WALREIN - 1] = 0x00, - [SPECIES_CACNEA - 1] = 0x00, - [SPECIES_CACTURNE - 1] = 0x00, [SPECIES_SNORUNT - 1] = 0x14, - [SPECIES_GLALIE - 1] = 0x00, - [SPECIES_LUNATONE - 1] = 0x00, - [SPECIES_SOLROCK - 1] = 0x00, - [SPECIES_AZURILL - 1] = 0x00, - [SPECIES_SPOINK - 1] = 0x00, [SPECIES_GRUMPIG - 1] = 0x0f, - [SPECIES_PLUSLE - 1] = 0x00, - [SPECIES_MINUN - 1] = 0x00, - [SPECIES_MAWILE - 1] = 0x00, - [SPECIES_MEDITITE - 1] = 0x00, - [SPECIES_MEDICHAM - 1] = 0x00, - [SPECIES_SWABLU - 1] = 0x00, - [SPECIES_ALTARIA - 1] = 0x00, [SPECIES_WYNAUT - 1] = 0x0f, - [SPECIES_DUSKULL - 1] = 0x00, [SPECIES_DUSCLOPS - 1] = 0x1e, - [SPECIES_ROSELIA - 1] = 0x00, - [SPECIES_SLAKOTH - 1] = 0x00, - [SPECIES_VIGOROTH - 1] = 0x00, - [SPECIES_SLAKING - 1] = 0x00, - [SPECIES_GULPIN - 1] = 0x00, - [SPECIES_SWALOT - 1] = 0x00, - [SPECIES_TROPIUS - 1] = 0x00, - [SPECIES_WHISMUR - 1] = 0x00, - [SPECIES_LOUDRED - 1] = 0x00, - [SPECIES_EXPLOUD - 1] = 0x00, - [SPECIES_CLAMPERL - 1] = 0x00, - [SPECIES_HUNTAIL - 1] = 0x00, - [SPECIES_GOREBYSS - 1] = 0x00, [SPECIES_ABSOL - 1] = 0x2d, - [SPECIES_SHUPPET - 1] = 0x00, - [SPECIES_BANETTE - 1] = 0x00, - [SPECIES_SEVIPER - 1] = 0x00, - [SPECIES_ZANGOOSE - 1] = 0x00, - [SPECIES_RELICANTH - 1] = 0x00, - [SPECIES_ARON - 1] = 0x00, - [SPECIES_LAIRON - 1] = 0x00, - [SPECIES_AGGRON - 1] = 0x00, - [SPECIES_CASTFORM - 1] = 0x00, - [SPECIES_VOLBEAT - 1] = 0x00, - [SPECIES_ILLUMISE - 1] = 0x00, - [SPECIES_LILEEP - 1] = 0x00, - [SPECIES_CRADILY - 1] = 0x00, - [SPECIES_ANORITH - 1] = 0x00, - [SPECIES_ARMALDO - 1] = 0x00, - [SPECIES_RALTS - 1] = 0x00, - [SPECIES_KIRLIA - 1] = 0x00, - [SPECIES_GARDEVOIR - 1] = 0x00, - [SPECIES_BAGON - 1] = 0x00, - [SPECIES_SHELGON - 1] = 0x00, [SPECIES_SALAMENCE - 1] = 0x46, - [SPECIES_BELDUM - 1] = 0x00, - [SPECIES_METANG - 1] = 0x00, - [SPECIES_METAGROSS - 1] = 0x00, - [SPECIES_REGIROCK - 1] = 0x00, - [SPECIES_REGICE - 1] = 0x00, - [SPECIES_REGISTEEL - 1] = 0x00, [SPECIES_KYOGRE - 1] = 0x3c, - [SPECIES_GROUDON - 1] = 0x00, [SPECIES_RAYQUAZA - 1] = 0x3c, - [SPECIES_LATIAS - 1] = 0x00, - [SPECIES_LATIOS - 1] = 0x00, - [SPECIES_JIRACHI - 1] = 0x00, - [SPECIES_DEOXYS - 1] = 0x00, - [SPECIES_CHIMECHO - 1] = 0x00, }; const u8 gPPUpGetMask[] = {0x03, 0x0c, 0x30, 0xc0}; // Masks for getting PP Up count, also PP Max values From baa187665b102b0210ecd7296aaaf0de512d3e87 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Apr 2019 13:35:52 +0200 Subject: [PATCH 062/101] Document a bit of script menu and battle anims --- data/battle_anim_scripts.s | 16 ++--- include/menu.h | 2 +- include/script_menu.h | 2 +- src/ghost.c | 106 +++++++++++++++-------------- src/mauville_old_man.c | 2 +- src/menu.c | 14 ++-- src/script_menu.c | 107 ++++++++++++++---------------- src/script_pokemon_util_80F87D8.c | 2 +- 8 files changed, 126 insertions(+), 125 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 5a19061d0..8655d9bc3 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -5347,7 +5347,7 @@ Move_ICE_BEAM: loadspritegfx ANIM_TAG_ICE_CRYSTALS createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 7, RGB_BLACK waitforvisualfinish - createsoundtask sub_8158C58, 183, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 4, 4, 0, 10 + createsoundtask sub_8158C58, SE_W062B, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 4, 4, 0, 10 createsprite gUnknown_08595B2C, ANIM_ATTACKER, 2, 20, 12, 0, 12, 20 createsprite gUnknown_08595B2C, ANIM_ATTACKER, 2, 20, -12, 0, -12, 20 delay 1 @@ -5403,7 +5403,7 @@ Move_AURORA_BEAM: call AuroraBeam1 call AuroraBeam1 setarg 7, -1 - createsoundtask sub_8158C58, 183, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 6, 0, 10 + createsoundtask sub_8158C58, SE_W062B, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 6, 0, 10 createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 2, 0, 40, 1 call AuroraBeam1 call AuroraBeam1 @@ -7123,7 +7123,7 @@ Move_PSYBEAM: loadspritegfx ANIM_TAG_GOLD_RING playsewithpan SE_W060, SOUND_PAN_ATTACKER call SetPsychicBackground - createsoundtask sub_8158C58, 200, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 4, 0, 15 + createsoundtask sub_8158C58, SE_W060B, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 3, 4, 0, 15 call Psybeam1 call Psybeam1 createvisualtask AnimTask_SwayMon, 5, 0, 6, 2048, 4, ANIM_TARGET @@ -7169,7 +7169,7 @@ Move_PSYWAVE: playsewithpan SE_W060, SOUND_PAN_ATTACKER call SetPsychicBackground createvisualtask sub_81076C8, 5, 100 - createsoundtask sub_8158C58, 203, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 2, 9, 0, 10 + createsoundtask sub_8158C58, SE_W100, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 2, 9, 0, 10 call Psywave1 call Psywave1 createvisualtask sub_8115A04, 2, 4, 1, 4, 0, 12, RGB(31, 18, 31) @@ -7346,8 +7346,8 @@ Move_SHADOW_BALL: fadetobg BG_GHOST waitbgfadein delay 15 - createsoundtask sub_8158C58, 168, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 5, 5, 0, 5 - createsprite gUnknown_08596D58, ANIM_TARGET, 2, 16, 16, 8 + createsoundtask sub_8158C58, SE_W054, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 5, 5, 0, 5 + createsprite gShadowBallSpriteTemplate, ANIM_TARGET, 2, 16, 16, 8 waitforvisualfinish playsewithpan SE_W028, SOUND_PAN_TARGET createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 8, 1 @@ -8019,7 +8019,7 @@ Move_TRI_ATTACK: delay 20 playsewithpan SE_W161, SOUND_PAN_ATTACKER delay 20 - createsoundtask sub_8158C58, 220, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 5, 6, 0, 7 + createsoundtask sub_8158C58, SE_W161, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 5, 6, 0, 7 waitforvisualfinish createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 16, RGB_BLACK delay 16 @@ -8356,7 +8356,7 @@ Move_HYPER_BEAM: createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 4, 1 waitforvisualfinish delay 30 - createsoundtask sub_8158C58, 247, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 1, 15, 0, 5 + createsoundtask sub_8158C58, SE_W063B, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 1, 15, 0, 5 createvisualtask AnimTask_ShakeMon, 2, ANIM_ATTACKER, 0, 4, 50, 1 createvisualtask sub_8115D94, 2, ANIM_TAG_ORBS, 1, 12, 31, 16, 0, 0 call HyperBeam1 diff --git a/include/menu.h b/include/menu.h index 4f3c4a3cc..2392de703 100644 --- a/include/menu.h +++ b/include/menu.h @@ -91,7 +91,7 @@ void sub_8199C30(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette); void sub_8199D3C(void *ptr, int delta, int width, int height, bool32 is8BPP); void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyToVram); void sub_8197AE8(bool8 copyToVram); -void sub_81997AC(u8 windowId, u8 a4, u8 a6, u8 a7, const struct MenuAction *strs); +void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *strs); s8 Menu_ProcessInputGridLayout(void); u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, bool8 APressMuted); s8 Menu_ProcessInputNoWrapAround_other(void); diff --git a/include/script_menu.h b/include/script_menu.h index 1f4e549fe..efb51870b 100644 --- a/include/script_menu.h +++ b/include/script_menu.h @@ -11,7 +11,7 @@ bool8 ScriptMenu_ShowPokemonPic(u16 var1, u8 var2, u8 var3); bool8 (*ScriptMenu_GetPicboxWaitFunc(void))(void); int convert_pixel_width_to_tile_width(int); u8 CreateWindowFromRect(u8, u8, u8, u8); -void sub_80E2A78(u8); +void ClearToTransparentAndRemoveWindow(u8); int display_text_and_get_width(const u8*, int); int sub_80E2D5C(int arg0, int tileWidth); bool16 ScrSpecial_CreatePCMenu(void); diff --git a/src/ghost.c b/src/ghost.c index 998be0caa..97b86aa76 100644 --- a/src/ghost.c +++ b/src/ghost.c @@ -87,7 +87,7 @@ const union AffineAnimCmd *const gUnknown_08596D54[] = gUnknown_08596D44, }; -const struct SpriteTemplate gUnknown_08596D58 = +const struct SpriteTemplate gShadowBallSpriteTemplate = { .tileTag = ANIM_TAG_SHADOW_BALL, .paletteTag = ANIM_TAG_SHADOW_BALL, @@ -261,20 +261,20 @@ static void sub_81116E8(struct Sprite *sprite) AnimTranslateLinear(sprite); sprite->pos2.x += Sin(sprite->data[5], 10); sprite->pos2.y += Cos(sprite->data[5], 15); - + r2 = sprite->data[5]; sprite->data[5] = (sprite->data[5] + 5) & 0xFF; r0 = sprite->data[5]; - + if (r2 == 0 || r2 > 196) { if (r0 > 0) PlaySE(SE_W109); } - + if (sprite->data[6] == 0) { - sprite->invisible = TRUE; + sprite->invisible = TRUE; sprite->callback = DestroyAnimSpriteAndDisableBlend; } else @@ -283,18 +283,18 @@ static void sub_81116E8(struct Sprite *sprite) static void sub_8111764(struct Sprite *sprite) { - - s16 r0; + + s16 r0; if (sprite->data[6] > 0xFF) { if (++sprite->data[6] == 0x10d) sprite->data[6] = 0; return; } - + r0 = sprite->data[7]; sprite->data[7]++; - + if ((r0 & 0xFF) == 0) { sprite->data[7] &= 0xff00; @@ -392,16 +392,16 @@ static void sub_811196C(u8 taskId) } } -// Spins a sprite towards the target, pausing in the middle. -// Used in Shadow Ball. +// Spins a sprite towards the target, pausing in the middle. +// Used in Shadow Ball. // arg 0: duration step 1 (attacker -> center) // arg 1: duration step 2 (spin center) // arg 2: duration step 3 (center -> target) static void InitAnimShadowBall(struct Sprite *sprite) { - u16 r5, r6; - r5 = sprite->pos1.x; - r6 = sprite->pos1.y; + s16 oldPosX = sprite->pos1.x; + s16 oldPosY = sprite->pos1.y; + sprite->pos1.x = GetBattlerSpriteCoord(gBattleAnimAttacker, 2); sprite->pos1.y = GetBattlerSpriteCoord(gBattleAnimAttacker, 3); sprite->data[0] = 0; @@ -410,8 +410,8 @@ static void InitAnimShadowBall(struct Sprite *sprite) sprite->data[3] = gBattleAnimArgs[2]; sprite->data[4] = sprite->pos1.x << 4; sprite->data[5] = sprite->pos1.y << 4; - sprite->data[6] = (((s16)r5 - sprite->pos1.x) << 4) / (gBattleAnimArgs[0] << 1); - sprite->data[7] = (((s16)r6 - sprite->pos1.y) << 4) / (gBattleAnimArgs[0] << 1); + sprite->data[6] = ((oldPosX - sprite->pos1.x) << 4) / (gBattleAnimArgs[0] << 1); + sprite->data[7] = ((oldPosY - sprite->pos1.y) << 4) / (gBattleAnimArgs[0] << 1); sprite->callback = AnimShadowBallStep; } @@ -465,50 +465,57 @@ static void sub_8111B9C(struct Sprite *sprite) sprite->callback = sub_8111BB4; } -static void sub_8111BB4(struct Sprite *sprite) { - - s8 r5 = FALSE; +static void sub_8111BB4(struct Sprite *sprite) +{ + bool8 r5 = FALSE; bool8 r6 = FALSE; - if(sprite->animEnded) + + if (sprite->animEnded) { - if(!(sprite->invisible)) - sprite->invisible=TRUE; - switch(sprite->data[0]) + if (!sprite->invisible) + sprite->invisible = TRUE; + + switch (sprite->data[0]) { - case 0: - if((sprite->data[1]) != 2) - break; - goto loc_08111C06; - case 1: - if((sprite->data[1]) == 4) - r5 = TRUE; - break; - default: - r6 = TRUE; + default: + r6 = TRUE; + break; + case 0: + if (sprite->data[1] == 2) + r5 = TRUE; + break; + case 1: + if (sprite->data[1] == 4) + r5 = TRUE; + break; } - if(r5) + + if (r5) { - loc_08111C06: sprite->invisible ^= 1; sprite->data[2]++; sprite->data[1] = 0; - if(sprite->data[2] == 5) + if (sprite->data[2] == 5) { sprite->data[2] = 0; sprite->data[0]++; } } - else if(r6) + else if (r6) + { DestroyAnimSprite(sprite); + } else + { sprite->data[1]++; + } } } void sub_8111C50(u8 taskId) { struct Task *task; - + task = &gTasks[taskId]; task->data[0] = CloneBattlerSpriteWithBlend(1); if (task->data[0] < 0) @@ -523,7 +530,7 @@ void sub_8111C50(u8 taskId) SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL)); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[2], task->data[3])); gSprites[task->data[0]].data[0] = 80; - if (GetBattlerSide(gBattleAnimTarget) == 0) + if (GetBattlerSide(gBattleAnimTarget) == B_SIDE_PLAYER) { gSprites[task->data[0]].data[1] = -144; gSprites[task->data[0]].data[2] = 112; @@ -573,6 +580,7 @@ static void sub_8111D78(u8 taskId) break; case 2: DestroyAnimVisualTask(taskId); + break; } } @@ -595,7 +603,7 @@ static void sub_8111E78(u8 taskId) switch (task->data[15]) { case 0: - task->data[14] = AllocSpritePalette(0x2771); + task->data[14] = AllocSpritePalette(ANIM_TAG_BENT_SPOON); if (task->data[14] == 0xFF || task->data[14] == 0xF) { DestroyAnimVisualTask(taskId); @@ -605,7 +613,7 @@ static void sub_8111E78(u8 taskId) task->data[0] = CloneBattlerSpriteWithBlend(1); if (task->data[0] < 0) { - FreeSpritePaletteByTag(0x2771); + FreeSpritePaletteByTag(ANIM_TAG_BENT_SPOON); DestroyAnimVisualTask(taskId); } else @@ -698,14 +706,14 @@ static void sub_81120DC(u8 taskId) static void sub_8112170(u8 taskId) { struct Task *task = &gTasks[taskId]; - u8 position = GetBattlerSpriteBGPriorityRank(gBattleAnimTarget); + u8 rank = GetBattlerSpriteBGPriorityRank(gBattleAnimTarget); switch (task->data[15]) { case 0: gScanlineEffect.state = 3; task->data[14] = GetAnimBattlerSpriteId(1); - if (position == 1) + if (rank == 1) ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG1_ON); else ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON); @@ -714,12 +722,12 @@ static void sub_8112170(u8 taskId) BlendPalette(task->data[4], 16, 0, RGB(13, 0, 15)); break; case 2: - gSprites[task->data[14]].invisible = 1; + gSprites[task->data[14]].invisible = TRUE; obj_delete_but_dont_free_vram(&gSprites[task->data[0]]); - FreeSpritePaletteByTag(0x2771); + FreeSpritePaletteByTag(ANIM_TAG_BENT_SPOON); SetGpuReg(REG_OFFSET_BLDCNT, 0); SetGpuReg(REG_OFFSET_BLDALPHA, 0); - if (position == 1) + if (rank == 1) SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG1_ON); else SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON); @@ -886,7 +894,7 @@ static void sub_81125E0(u8 taskId) } } } - + if (task->data[10]) task->data[10]--; else if (task->data[6]) @@ -1081,7 +1089,7 @@ static void sub_8112ACC(struct Sprite *sprite) if (sprite->data[0] == 0) { SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL)); - SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0x10, 0)); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 0)); sprite->data[0]++; sprite->data[1] = 0; sprite->data[2] = 0; @@ -1120,7 +1128,7 @@ static void sub_8112B78(struct Sprite *sprite) sprite->pos2.x = Sin(sprite->data[0], 12); if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) sprite->pos2.x = -sprite->pos2.x; - + sprite->data[0] = (sprite->data[0] + 6) & 0xFF; sprite->data[1] += 0x100; sprite->pos2.y = -(sprite->data[1] >> 8); diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index ddd3f931e..8bb9cb6e4 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -1193,7 +1193,7 @@ static void Task_StoryListMenu(u8 taskId) // Task_StoryListMenu gSpecialVar_Result = 1; sSelectedStory = selection; } - sub_80E2A78(sStorytellerWindowId); + ClearToTransparentAndRemoveWindow(sStorytellerWindowId); DestroyTask(taskId); EnableBothScriptContexts(); break; diff --git a/src/menu.c b/src/menu.c index 958788b25..80d440771 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1661,16 +1661,14 @@ void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 pa InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sYesNoWindowId, 2, initialCursorPos); } -void sub_81997AC(u8 windowId, u8 a4, u8 a6, u8 a7, const struct MenuAction *strs) +void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *strs) { - u32 i; - u32 j; - for (i = 0; i < a7; i++) + u32 i, j; + + for (i = 0; i < verticalCount; i++) { - for (j = 0; j < a6; j++) - { - AddTextPrinterParameterized(windowId, 1, strs[(i * a6) + j].text, (a4 * j) + 8, (i * 16) + 1, 0xFF, NULL); - } + for (j = 0; j < horizontalCount; j++) + AddTextPrinterParameterized(windowId, 1, strs[(i * horizontalCount) + j].text, (optionWidth * j) + 8, (i * 16) + 1, 0xFF, NULL); } CopyWindowToVram(windowId, 2); } diff --git a/src/script_menu.c b/src/script_menu.c index c7523a370..082253e35 100644 --- a/src/script_menu.c +++ b/src/script_menu.c @@ -1183,7 +1183,7 @@ static void Task_HandleMultichoiceInput(u8 taskId) { gSpecialVar_Result = selection; } - sub_80E2A78(tWindowId); + ClearToTransparentAndRemoveWindow(tWindowId); DestroyTask(taskId); EnableBothScriptContexts(); } @@ -1219,8 +1219,6 @@ bool8 IsScriptActive(void) static void Task_HandleYesNoInput(u8 taskId) { - u8 left, top; - if (gTasks[taskId].tRight < 5) { gTasks[taskId].tRight++; @@ -1229,9 +1227,9 @@ static void Task_HandleYesNoInput(u8 taskId) switch (Menu_ProcessInputNoWrapClearOnChoose()) { - case -2: + case MENU_NOTHING_CHOSEN: return; - case -1: + case MENU_B_PRESSED: case 1: PlaySE(SE_SELECT); gSpecialVar_Result = 0; @@ -1247,8 +1245,6 @@ static void Task_HandleYesNoInput(u8 taskId) bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPress, u8 columnCount) { - u8 bottom = 0; - if (FuncIsActiveTask(Task_HandleMultichoiceGridInput) == TRUE) { return FALSE; @@ -1256,10 +1252,8 @@ bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPr else { u8 taskId; - u8 unk2; - int width; - int i; - u8 newWidth; + u8 rowCount, newWidth; + int i, width; gSpecialVar_Result = 0xFF; width = 0; @@ -1272,15 +1266,15 @@ bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 ignoreBPr newWidth = convert_pixel_width_to_tile_width(width); left = sub_80E2D5C(left, columnCount * newWidth); - unk2 = gMultichoiceLists[multichoiceId].count / columnCount; + rowCount = gMultichoiceLists[multichoiceId].count / columnCount; taskId = CreateTask(Task_HandleMultichoiceGridInput, 80); gTasks[taskId].tIgnoreBPress = ignoreBPress; - gTasks[taskId].tWindowId = CreateWindowFromRect(left, top, columnCount * newWidth, unk2 * 2); + gTasks[taskId].tWindowId = CreateWindowFromRect(left, top, columnCount * newWidth, rowCount * 2); SetStandardWindowBorderStyle(gTasks[taskId].tWindowId, 0); - sub_81997AC(gTasks[taskId].tWindowId, newWidth * 8, columnCount, unk2, gMultichoiceLists[multichoiceId].list); - sub_8199944(gTasks[taskId].tWindowId, newWidth * 8, columnCount, unk2, 0); + PrintMenuGridTable(gTasks[taskId].tWindowId, newWidth * 8, columnCount, rowCount, gMultichoiceLists[multichoiceId].list); + sub_8199944(gTasks[taskId].tWindowId, newWidth * 8, columnCount, rowCount, 0); CopyWindowToVram(gTasks[taskId].tWindowId, 3); return TRUE; } @@ -1291,23 +1285,24 @@ static void Task_HandleMultichoiceGridInput(u8 taskId) s16 *data = gTasks[taskId].data; s8 selection = Menu_ProcessInputGridLayout(); - if (selection != -2) + switch (selection) { - if (selection == -1) - { - if (tIgnoreBPress) - return; - PlaySE(SE_SELECT); - gSpecialVar_Result = 0x7F; - } - else - { - gSpecialVar_Result = selection; - } - sub_80E2A78(tWindowId); - DestroyTask(taskId); - EnableBothScriptContexts(); + case MENU_NOTHING_CHOSEN: + return; + case MENU_B_PRESSED: + if (tIgnoreBPress) + return; + PlaySE(SE_SELECT); + gSpecialVar_Result = 0x7F; + break; + default: + gSpecialVar_Result = selection; + break; } + + ClearToTransparentAndRemoveWindow(tWindowId); + DestroyTask(taskId); + EnableBothScriptContexts(); } #undef tWindowId @@ -1564,7 +1559,7 @@ static void Task_PokemonPicWindow(u8 taskId) task->tState++; break; case 3: - sub_80E2A78(task->tWindowId); + ClearToTransparentAndRemoveWindow(task->tWindowId); DestroyTask(taskId); break; } @@ -1628,7 +1623,7 @@ u8 CreateWindowFromRect(u8 x, u8 y, u8 width, u8 height) return windowId; } -void sub_80E2A78(u8 windowId) +void ClearToTransparentAndRemoveWindow(u8 windowId) { ClearStdWindowAndFrameToTransparent(windowId, TRUE); RemoveWindow(windowId); @@ -1638,30 +1633,30 @@ static void sub_80E2A94(u8 multichoiceId) { switch (multichoiceId) { - case 77: - FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBAC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); - break; - case 76: - FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BB9C[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); - break; - case 78: - FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBBC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); - break; - case 79: - FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBCC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); - break; - case 75: - FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBEC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); - break; - case 74: - FillWindowPixelBuffer(0, PIXEL_FILL(1)); - AddTextPrinterParameterized2(0, 1, gUnknown_0858BBE0[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); - break; + case 77: + FillWindowPixelBuffer(0, PIXEL_FILL(1)); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBAC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + break; + case 76: + FillWindowPixelBuffer(0, PIXEL_FILL(1)); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BB9C[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + break; + case 78: + FillWindowPixelBuffer(0, PIXEL_FILL(1)); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBBC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + break; + case 79: + FillWindowPixelBuffer(0, PIXEL_FILL(1)); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBCC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + break; + case 75: + FillWindowPixelBuffer(0, PIXEL_FILL(1)); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBEC[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + break; + case 74: + FillWindowPixelBuffer(0, PIXEL_FILL(1)); + AddTextPrinterParameterized2(0, 1, gUnknown_0858BBE0[Menu_GetCursorPos()], 0, NULL, 2, 1, 3); + break; } } diff --git a/src/script_pokemon_util_80F87D8.c b/src/script_pokemon_util_80F87D8.c index 7e4c14531..ece030395 100755 --- a/src/script_pokemon_util_80F87D8.c +++ b/src/script_pokemon_util_80F87D8.c @@ -395,7 +395,7 @@ static void sub_80F8EE8(u8 taskId) task->data[0]++; break; case 4: - sub_80E2A78(gTasks[taskId].data[5]); + ClearToTransparentAndRemoveWindow(gTasks[taskId].data[5]); DestroyTask(taskId); break; } From d8c9f1b30fb92289e7aa4d44dfcf1b2120bea8d6 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 2 Apr 2019 15:06:44 +0200 Subject: [PATCH 063/101] Rows and columns --- include/menu.h | 4 ++-- src/menu.c | 60 +++++++++++++++++++++++++------------------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/include/menu.h b/include/menu.h index 2392de703..4d55fc955 100644 --- a/include/menu.h +++ b/include/menu.h @@ -69,7 +69,7 @@ u16 copy_decompressed_tile_data_to_vram(u8 bgId, const void *src, u16 size, u16 void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress); void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *a8); void sub_8198DBC(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 itemCount, u8 itemCount2, const struct MenuAction *strs, const u8 *a8); -u8 sub_8199944(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount, u8 initialCursorPos); +u8 sub_8199944(u8 windowId, u8 optionWidth, u8 columns, u8 rows, u8 initialCursorPos); u8 sub_8199134(s8, s8); u8 GetStartMenuWindowId(void); void sub_819A2BC(u8, u8); @@ -91,7 +91,7 @@ void sub_8199C30(u8 bgId, u8 left, u8 top, u8 width, u8 height, u8 palette); void sub_8199D3C(void *ptr, int delta, int width, int height, bool32 is8BPP); void sub_8198204(const u8 *string, const u8 *string2, u8 a3, u8 a4, bool8 copyToVram); void sub_8197AE8(bool8 copyToVram); -void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *strs); +void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 columns, u8 rows, const struct MenuAction *strs); s8 Menu_ProcessInputGridLayout(void); u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, bool8 APressMuted); s8 Menu_ProcessInputNoWrapAround_other(void); diff --git a/src/menu.c b/src/menu.c index 80d440771..b766b1b86 100644 --- a/src/menu.c +++ b/src/menu.c @@ -43,8 +43,8 @@ struct Menu u8 fontId; u8 optionWidth; u8 optionHeight; - u8 horizontalCount; - u8 verticalCount; + u8 columns; + u8 rows; bool8 APressMuted; }; @@ -1283,8 +1283,8 @@ u8 sub_8198F58(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 cursorHeight, sMenu.fontId = fontId; sMenu.optionWidth = a4; sMenu.optionHeight = cursorHeight; - sMenu.horizontalCount = a6; - sMenu.verticalCount = a7; + sMenu.columns = a6; + sMenu.rows = a7; pos = a9; @@ -1308,16 +1308,16 @@ void sub_8199060(u8 oldCursorPos, u8 newCursorPos) { u8 cursorWidth = GetMenuCursorDimensionByFont(sMenu.fontId, 0); u8 cursorHeight = GetMenuCursorDimensionByFont(sMenu.fontId, 1); - u8 xPos = (oldCursorPos % sMenu.horizontalCount) * sMenu.optionWidth + sMenu.left; - u8 yPos = (oldCursorPos / sMenu.horizontalCount) * sMenu.optionHeight + sMenu.top; + u8 xPos = (oldCursorPos % sMenu.columns) * sMenu.optionWidth + sMenu.left; + u8 yPos = (oldCursorPos / sMenu.columns) * sMenu.optionHeight + sMenu.top; FillWindowPixelRect(sMenu.windowId, PIXEL_FILL(1), xPos, yPos, cursorWidth, cursorHeight); - xPos = (newCursorPos % sMenu.horizontalCount) * sMenu.optionWidth + sMenu.left; - yPos = (newCursorPos / sMenu.horizontalCount) * sMenu.optionHeight + sMenu.top; + xPos = (newCursorPos % sMenu.columns) * sMenu.optionWidth + sMenu.left; + yPos = (newCursorPos / sMenu.columns) * sMenu.optionHeight + sMenu.top; AddTextPrinterParameterized(sMenu.windowId, sMenu.fontId, gText_SelectorArrow3, @@ -1333,13 +1333,13 @@ u8 sub_8199134(s8 deltaX, s8 deltaY) if (deltaX != 0) { - if ((sMenu.cursorPos % sMenu.horizontalCount) + deltaX < 0) + if ((sMenu.cursorPos % sMenu.columns) + deltaX < 0) { - sMenu.cursorPos += sMenu.horizontalCount - 1; + sMenu.cursorPos += sMenu.columns - 1; } - else if ((sMenu.cursorPos % sMenu.horizontalCount) + deltaX >= sMenu.horizontalCount) + else if ((sMenu.cursorPos % sMenu.columns) + deltaX >= sMenu.columns) { - sMenu.cursorPos = (sMenu.cursorPos / sMenu.horizontalCount) * sMenu.horizontalCount; + sMenu.cursorPos = (sMenu.cursorPos / sMenu.columns) * sMenu.columns; } else { @@ -1349,17 +1349,17 @@ u8 sub_8199134(s8 deltaX, s8 deltaY) if (deltaY != 0) { - if ((sMenu.cursorPos / sMenu.horizontalCount) + deltaY < 0) + if ((sMenu.cursorPos / sMenu.columns) + deltaY < 0) { - sMenu.cursorPos += sMenu.horizontalCount * (sMenu.verticalCount - 1); + sMenu.cursorPos += sMenu.columns * (sMenu.rows - 1); } - else if ((sMenu.cursorPos / sMenu.horizontalCount) + deltaY >= sMenu.verticalCount) + else if ((sMenu.cursorPos / sMenu.columns) + deltaY >= sMenu.rows) { - sMenu.cursorPos -= sMenu.horizontalCount * (sMenu.verticalCount - 1); + sMenu.cursorPos -= sMenu.columns * (sMenu.rows - 1); } else { - sMenu.cursorPos += (sMenu.horizontalCount * deltaY); + sMenu.cursorPos += (sMenu.columns * deltaY); } } @@ -1381,8 +1381,8 @@ u8 sub_81991F8(s8 deltaX, s8 deltaY) if (deltaX != 0) { - if (((sMenu.cursorPos % sMenu.horizontalCount) + deltaX >= 0) && - ((sMenu.cursorPos % sMenu.horizontalCount) + deltaX < sMenu.horizontalCount)) + if (((sMenu.cursorPos % sMenu.columns) + deltaX >= 0) && + ((sMenu.cursorPos % sMenu.columns) + deltaX < sMenu.columns)) { sMenu.cursorPos += deltaX; } @@ -1390,10 +1390,10 @@ u8 sub_81991F8(s8 deltaX, s8 deltaY) if (deltaY != 0) { - if (((sMenu.cursorPos / sMenu.horizontalCount) + deltaY >= 0) && - ((sMenu.cursorPos / sMenu.horizontalCount) + deltaY < sMenu.verticalCount)) + if (((sMenu.cursorPos / sMenu.columns) + deltaY >= 0) && + ((sMenu.cursorPos / sMenu.columns) + deltaY < sMenu.rows)) { - sMenu.cursorPos += (sMenu.horizontalCount * deltaY); + sMenu.cursorPos += (sMenu.columns * deltaY); } } @@ -1661,14 +1661,14 @@ void CreateYesNoMenu(const struct WindowTemplate *window, u16 baseTileNum, u8 pa InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sYesNoWindowId, 2, initialCursorPos); } -void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *strs) +void PrintMenuGridTable(u8 windowId, u8 optionWidth, u8 columns, u8 rows, const struct MenuAction *strs) { u32 i, j; - for (i = 0; i < verticalCount; i++) + for (i = 0; i < rows; i++) { - for (j = 0; j < horizontalCount; j++) - AddTextPrinterParameterized(windowId, 1, strs[(i * horizontalCount) + j].text, (optionWidth * j) + 8, (i * 16) + 1, 0xFF, NULL); + for (j = 0; j < columns; j++) + AddTextPrinterParameterized(windowId, 1, strs[(i * columns) + j].text, (optionWidth * j) + 8, (i * 16) + 1, 0xFF, NULL); } CopyWindowToVram(windowId, 2); } @@ -1704,20 +1704,20 @@ void sub_819983C(u8 windowId, u8 a4, u8 itemCount, u8 itemCount2, const struct M CopyWindowToVram(windowId, 2); } -u8 sub_8199944(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount, u8 initialCursorPos) +u8 sub_8199944(u8 windowId, u8 optionWidth, u8 columns, u8 rows, u8 initialCursorPos) { s32 pos; sMenu.left = 0; sMenu.top = 1; sMenu.minCursorPos = 0; - sMenu.maxCursorPos = (horizontalCount * verticalCount) - 1; + sMenu.maxCursorPos = (columns * rows) - 1; sMenu.windowId = windowId; sMenu.fontId = 1; sMenu.optionWidth = optionWidth; sMenu.optionHeight = 16; - sMenu.horizontalCount = horizontalCount; - sMenu.verticalCount = verticalCount; + sMenu.columns = columns; + sMenu.rows = rows; pos = initialCursorPos; From 1241700b204b9f450221299c6e837c0f522f60b2 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Tue, 2 Apr 2019 18:28:56 -0500 Subject: [PATCH 064/101] Finish documenting the other weather effects --- data/specials.inc | 2 +- graphics/weather/1.pal | 19 -- graphics/weather/2.pal | 19 -- include/field_weather.h | 59 ++-- src/cable_car.c | 19 +- src/field_weather.c | 6 +- src/field_weather_effect.c | 603 ++++++++++++++++++++----------------- 7 files changed, 366 insertions(+), 361 deletions(-) delete mode 100644 graphics/weather/1.pal delete mode 100644 graphics/weather/2.pal diff --git a/data/specials.inc b/data/specials.inc index 5a812cffa..af69b51a1 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -327,7 +327,7 @@ gSpecials:: @ 81DBA64 def_special SetUpTrainerMovement def_special DoSealedChamberShakingEffect2 def_special FoundBlackGlasses - def_special sub_80AC81C + def_special StartDroughtWeatherBlend def_special DoDiveWarp def_special DoFallWarp def_special ShowContestEntryMonPic diff --git a/graphics/weather/1.pal b/graphics/weather/1.pal deleted file mode 100644 index fe57a8c7f..000000000 --- a/graphics/weather/1.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -65 148 255 -180 222 255 -115 205 246 -131 197 255 -82 189 246 -172 238 246 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/graphics/weather/2.pal b/graphics/weather/2.pal deleted file mode 100644 index 9516c7a19..000000000 --- a/graphics/weather/2.pal +++ /dev/null @@ -1,19 +0,0 @@ -JASC-PAL -0100 -16 -0 0 0 -255 230 139 -189 131 74 -238 197 123 -213 164 98 -164 106 49 -255 246 164 -222 205 164 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 -0 0 0 diff --git a/include/field_weather.h b/include/field_weather.h index 7a4864075..3a84a8a73 100644 --- a/include/field_weather.h +++ b/include/field_weather.h @@ -3,10 +3,13 @@ #include "sprite.h" -#define MAX_RAIN_SPRITES 24 -#define NUM_CLOUD_SPRITES 3 -#define NUM_FOG_SPRITES 20 -#define NUM_ASH_SPRITES 20 +#define MAX_RAIN_SPRITES 24 +#define NUM_CLOUD_SPRITES 3 +#define NUM_FOG1_SPRITES 20 +#define NUM_ASH_SPRITES 20 +#define NUM_FOG2_SPRITES 20 +#define NUM_SANDSTORM_SPRITES 20 +#define NUM_SWIRL_SANDSTORM_SPRITES 5 // Controls how the weather should be changing the screen palettes. enum @@ -39,11 +42,11 @@ struct Weather struct { u8 filler0[0xA0]; - struct Sprite *fog1Sprites[NUM_FOG_SPRITES]; + struct Sprite *fog1Sprites[NUM_FOG1_SPRITES]; struct Sprite *ashSprites[NUM_ASH_SPRITES]; - struct Sprite *fog2Sprites[20]; - struct Sprite *sandstormSprites1[20]; - struct Sprite *sandstormSprites2[5]; + struct Sprite *fog2Sprites[NUM_FOG2_SPRITES]; + struct Sprite *sandstormSprites1[NUM_SANDSTORM_SPRITES]; + struct Sprite *sandstormSprites2[NUM_SWIRL_SANDSTORM_SPRITES]; } s2; } sprites; u8 gammaShifts[19][32]; @@ -92,32 +95,32 @@ struct Weather u8 lightenedFogSpritePals[6]; u8 lightenedFogSpritePalsCount; u8 fog1SpritesCreated; - u16 baseAshSpritesX; + u16 ashBaseSpritesX; u16 unknown_6FE; u8 ashSpritesCreated; u8 filler_701[3]; - u32 unknown_704; - u32 unknown_708; + u32 sandstormXOffset; + u32 sandstormYOffset; u8 filler_70C[2]; - u16 unknown_70E; - u16 unknown_710; - u16 unknown_712; - u16 unknown_714; - u8 sandstormSprites1Created; - u8 sandstormSprites2Created; - u16 unknown_718; - u16 unknown_71A; - u16 unknown_71C; - u16 unknown_71E; - u16 unknown_720; - u16 unknown_722; + u16 sandstormBaseSpritesX; + u16 sandstormPosY; + u16 sandstormWaveIndex; + u16 sandstormWaveCounter; + u8 sandstormSpritesCreated; + u8 sandstormSwirlSpritesCreated; + u16 fog2BaseSpritesX; + u16 fog2PosY; + u16 fog2ScrollXCounter; + u16 fog2ScrollYCounter; + u16 fog2XOffset; + u16 fog2YOffset; u8 fog2SpritesCreated; u8 filler_725[1]; - u16 unknown_726; - u16 unknown_728; - u16 unknown_72A; - u16 unknown_72C; - u8 unknown_72E; + u16 bubblesDelayCounter; + u16 bubblesDelayIndex; + u16 bubblesCoordsIndex; + u16 bubblesSpriteCount; + u8 bubblesSpritesCreated; u8 filler_72F; u16 currBlendEVA; u16 currBlendEVB; diff --git a/src/cable_car.c b/src/cable_car.c index ab7b5726a..42137e804 100755 --- a/src/cable_car.c +++ b/src/cable_car.c @@ -407,13 +407,12 @@ static void sub_81503E4(u8 taskId) case WEATHER_ASH: if (gWeatherPtr->sprites.s2.ashSprites[0] != NULL && gWeatherPtr->sprites.s2.ashSprites[0]->oam.priority != 0) { - for (; i < 20; i++) + for (; i < NUM_ASH_SPRITES; i++) { - if (gWeatherPtr->sprites.s2.ashSprites[i] != NULL) - { + if (gWeatherPtr->sprites.s2.ashSprites[i]) gWeatherPtr->sprites.s2.ashSprites[i]->oam.priority = 0; - } } + sCableCar->state = 2; } break; @@ -424,12 +423,10 @@ static void sub_81503E4(u8 taskId) } else if (sCableCar->timer >= sCableCar->unk4 + 8) { - for (; i < 20; i++) + for (; i < NUM_ASH_SPRITES; i++) { - if (gWeatherPtr->sprites.s2.ashSprites[i] != NULL) - { - gWeatherPtr->sprites.s2.ashSprites[i]->invisible ^= TRUE; - } + if (gWeatherPtr->sprites.s2.ashSprites[i]) + gWeatherPtr->sprites.s2.ashSprites[i]->invisible ^= 1; } } break; @@ -445,9 +442,7 @@ static void sub_81503E4(u8 taskId) break; case 3: if (!gPaletteFade.active) - { sCableCar->state = 0xFF; - } break; case 0xFF: SetVBlankCallback(NULL); @@ -536,7 +531,7 @@ static void sub_8150664(u8 taskId) if (sCableCar->timer < sCableCar->unk4) gSpriteCoordOffsetX = (gSpriteCoordOffsetX + 247) % 248; else - gWeatherPtr->unknown_6FC = (gWeatherPtr->unknown_6FC + 247) % 248; + gWeatherPtr->ashBaseSpritesX = (gWeatherPtr->ashBaseSpritesX + 247) % 248; } static void CableCarVblankCallback(void) diff --git a/src/field_weather.c b/src/field_weather.c index 346d30a38..814e85ef4 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -173,9 +173,9 @@ void StartWeather(void) gWeatherPtr->ashSpritesCreated = 0; gWeatherPtr->fog1SpritesCreated = 0; gWeatherPtr->fog2SpritesCreated = 0; - gWeatherPtr->sandstormSprites1Created = 0; - gWeatherPtr->sandstormSprites2Created = 0; - gWeatherPtr->unknown_72E = 0; + gWeatherPtr->sandstormSpritesCreated = 0; + gWeatherPtr->sandstormSwirlSpritesCreated = 0; + gWeatherPtr->bubblesSpritesCreated = 0; gWeatherPtr->lightenedFogSpritePalsCount = 0; Weather_SetBlendCoeffs(16, 0); gWeatherPtr->currWeather = 0; diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index 0544710ad..eac434983 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -1,4 +1,5 @@ #include "global.h" +#include "battle_anim.h" #include "event_object_movement.h" #include "field_weather.h" #include "overworld.h" @@ -17,8 +18,8 @@ EWRAM_DATA static u8 gCurrentAlternatingWeather = 0; EWRAM_DATA static u16 gUnusedWeatherRelated = 0; // CONST -const u16 gUnknown_0854C290[] = INCBIN_U16("graphics/weather/1.gbapal"); -const u16 gUnknown_0854C2B0[] = INCBIN_U16("graphics/weather/2.gbapal"); +const u16 gCloudsWeatherPalette[] = INCBIN_U16("graphics/weather/cloud.gbapal"); +const u16 gSandstormWeatherPalette[] = INCBIN_U16("graphics/weather/sandstorm.gbapal"); const u8 gWeatherFog2Tiles[] = INCBIN_U8("graphics/weather/fog2.4bpp"); const u8 gWeatherFog1Tiles[] = INCBIN_U8("graphics/weather/fog1.4bpp"); const u8 gWeatherCloudTiles[] = INCBIN_U8("graphics/weather/cloud.4bpp"); @@ -180,7 +181,7 @@ static void CreateCloudSprites(void) return; LoadSpriteSheet(&sCloudSpriteSheet); - LoadCustomWeatherSpritePalette(gUnknown_0854C290); + LoadCustomWeatherSpritePalette(gCloudsWeatherPalette); for (i = 0; i < NUM_CLOUD_SPRITES; i++) { spriteId = CreateSprite(&sCloudSpriteTemplate, 0, 0, 0xFF); @@ -229,6 +230,8 @@ static void UpdateCloudSprite(struct Sprite *sprite) // Drought //------------------------------------------------------------------------------ +static void UpdateDroughtBlend(u8); + void Drought_InitVars(void) { gWeatherPtr->initStep = 0; @@ -280,14 +283,12 @@ void Drought_Main(void) bool8 Drought_Finish(void) { - return 0; + return FALSE; } -void task50_0807B6D4(u8); - -void sub_80AC81C(void) +void StartDroughtWeatherBlend(void) { - CreateTask(task50_0807B6D4, 0x50); + CreateTask(UpdateDroughtBlend, 0x50); } #define tState data[0] @@ -295,7 +296,7 @@ void sub_80AC81C(void) #define tBlendDelay data[2] #define tWinRange data[3] -void task50_0807B6D4(u8 taskId) +static void UpdateDroughtBlend(u8 taskId) { struct Task *task = &gTasks[taskId]; @@ -1436,7 +1437,7 @@ static void CreateFog1Sprites(void) .tag = 0x1201, }; LoadSpriteSheet(&fog1SpriteSheet); - for (i = 0; i < NUM_FOG_SPRITES; i++) + for (i = 0; i < NUM_FOG1_SPRITES; i++) { spriteId = CreateSpriteAtEnd(&sFog1SpriteTemplate, 0, 0, 0xFF); if (spriteId != MAX_SPRITES) @@ -1463,7 +1464,7 @@ static void DestroyFog1Sprites(void) if (gWeatherPtr->fog1SpritesCreated) { - for (i = 0; i < NUM_FOG_SPRITES; i++) + for (i = 0; i < NUM_FOG1_SPRITES; i++) { if (gWeatherPtr->sprites.s2.fog1Sprites[i] != NULL) DestroySprite(gWeatherPtr->sprites.s2.fog1Sprites[i]); @@ -1508,9 +1509,9 @@ void Ash_InitAll(void) void Ash_Main(void) { - gWeatherPtr->baseAshSpritesX = gSpriteCoordOffsetX & 0x1FF; - while (gWeatherPtr->baseAshSpritesX >= 240) - gWeatherPtr->baseAshSpritesX -= 240; + gWeatherPtr->ashBaseSpritesX = gSpriteCoordOffsetX & 0x1FF; + while (gWeatherPtr->ashBaseSpritesX >= 240) + gWeatherPtr->ashBaseSpritesX -= 240; switch (gWeatherPtr->initStep) { @@ -1676,10 +1677,10 @@ static void UpdateAshSprite(struct Sprite *sprite) } sprite->pos1.y = gSpriteCoordOffsetY + sprite->tOffsetY; - sprite->pos1.x = gWeatherPtr->baseAshSpritesX + 32 + sprite->tSpriteColumn * 64; + sprite->pos1.x = gWeatherPtr->ashBaseSpritesX + 32 + sprite->tSpriteColumn * 64; if (sprite->pos1.x > 271) { - sprite->pos1.x = gWeatherPtr->baseAshSpritesX + 480 - (4 - sprite->tSpriteColumn) * 64; + sprite->pos1.x = gWeatherPtr->ashBaseSpritesX + 480 - (4 - sprite->tSpriteColumn) * 64; sprite->pos1.x &= 0x1FF; } } @@ -1693,6 +1694,11 @@ static void UpdateAshSprite(struct Sprite *sprite) // Fog 2 //------------------------------------------------------------------------------ +static void UpdateFog2Movement(void); +static void CreateFog2Sprites(void); +static void DestroyFog2Sprites(void); +static void UpdateFog2Sprite(struct Sprite *); + void Fog2_InitVars(void) { gWeatherPtr->initStep = 0; @@ -1701,20 +1707,18 @@ void Fog2_InitVars(void) gWeatherPtr->gammaStepDelay = 20; gWeatherPtr->fog1ScrollCounter = 0; gWeatherPtr->fog1ScrollOffset = 1; - if (gWeatherPtr->fog2SpritesCreated == 0) + if (!gWeatherPtr->fog2SpritesCreated) { - gWeatherPtr->unknown_71C = 0; - gWeatherPtr->unknown_71E = 0; - gWeatherPtr->unknown_720 = 0; - gWeatherPtr->unknown_722 = 0; - gWeatherPtr->unknown_718 = 0; - gWeatherPtr->unknown_71A = 0; + gWeatherPtr->fog2ScrollXCounter = 0; + gWeatherPtr->fog2ScrollYCounter = 0; + gWeatherPtr->fog2XOffset = 0; + gWeatherPtr->fog2YOffset = 0; + gWeatherPtr->fog2BaseSpritesX = 0; + gWeatherPtr->fog2PosY = 0; Weather_SetBlendCoeffs(0, 16); } } -void Fog2_Main(void); - void Fog2_InitAll(void) { Fog2_InitVars(); @@ -1722,12 +1726,9 @@ void Fog2_InitAll(void) Fog2_Main(); } -void sub_807FC9C(void); -void CreateFog2Sprites(void); - void Fog2_Main(void) { - sub_807FC9C(); + UpdateFog2Movement(); switch (gWeatherPtr->initStep) { case 0: @@ -1747,11 +1748,9 @@ void Fog2_Main(void) } } -void DestroyFog2Sprites(void); - bool8 Fog2_Finish(void) { - sub_807FC9C(); + UpdateFog2Movement(); switch (gWeatherPtr->finishStep) { case 0: @@ -1773,57 +1772,32 @@ bool8 Fog2_Finish(void) return TRUE; } -void sub_807FC9C(void) +static void UpdateFog2Movement(void) { - if (++gWeatherPtr->unknown_71C > 2) + if (++gWeatherPtr->fog2ScrollXCounter > 2) { - gWeatherPtr->unknown_720++; - gWeatherPtr->unknown_71C = 0; + gWeatherPtr->fog2XOffset++; + gWeatherPtr->fog2ScrollXCounter = 0; } - if (++gWeatherPtr->unknown_71E > 4) + if (++gWeatherPtr->fog2ScrollYCounter > 4) { - gWeatherPtr->unknown_722++; - gWeatherPtr->unknown_71E = 0; + gWeatherPtr->fog2YOffset++; + gWeatherPtr->fog2ScrollYCounter = 0; } - gWeatherPtr->unknown_718 = (gSpriteCoordOffsetX - gWeatherPtr->unknown_720) & 0xFF; - gWeatherPtr->unknown_71A = gSpriteCoordOffsetY + gWeatherPtr->unknown_722; + gWeatherPtr->fog2BaseSpritesX = (gSpriteCoordOffsetX - gWeatherPtr->fog2XOffset) & 0xFF; + gWeatherPtr->fog2PosY = gSpriteCoordOffsetY + gWeatherPtr->fog2YOffset; } -extern const struct SpriteTemplate sFog2SpriteTemplate; // defined below - -void CreateFog2Sprites(void) +static const struct SpriteSheet gFog2SpriteSheet = { - u16 i; + .data = gWeatherFog2Tiles, + .size = sizeof(gWeatherFog2Tiles), + .tag = 0x1203, +}; - if (!gWeatherPtr->fog2SpritesCreated) - { - struct SpriteSheet fog2SpriteSheet = {gWeatherFog2Tiles, sizeof(gWeatherFog2Tiles), 0x1203}; - - LoadSpriteSheet(&fog2SpriteSheet); - for (i = 0; i < 20; i++) - { - u8 spriteId = CreateSpriteAtEnd(&sFog2SpriteTemplate, 0, (i / 5) * 64, 0xFF); - - if (spriteId != MAX_SPRITES) - { - struct Sprite *sprite = &gSprites[spriteId]; - - sprite->data[0] = i % 5; - sprite->data[1] = i / 5; - gWeatherPtr->sprites.s2.fog2Sprites[i] = sprite; - } - else - { - gWeatherPtr->sprites.s2.fog2Sprites[i] = NULL; - } - } - gWeatherPtr->fog2SpritesCreated = TRUE; - } -} - -const struct OamData gOamData_839ABF0 = +static const struct OamData sFog2SpriteOamData = { .y = 0, .affineMode = 0, @@ -1840,103 +1814,146 @@ const struct OamData gOamData_839ABF0 = .affineParam = 0, }; -const union AnimCmd gSpriteAnim_839ABF8[] = +static const union AnimCmd sFog2SpriteAnimCmd0[] = { ANIMCMD_FRAME(0, 16), ANIMCMD_END, }; -const union AnimCmd *const gSpriteAnimTable_839AC00[] = +static const union AnimCmd *const sFog2SpriteAnimCmds[] = { - gSpriteAnim_839ABF8, + sFog2SpriteAnimCmd0, }; -void Fog2SpriteCallback(struct Sprite *); -const struct SpriteTemplate sFog2SpriteTemplate = +static const struct SpriteTemplate sFog2SpriteTemplate = { - .tileTag = 4611, + .tileTag = 0x1203, .paletteTag = 0x1200, - .oam = &gOamData_839ABF0, - .anims = gSpriteAnimTable_839AC00, + .oam = &sFog2SpriteOamData, + .anims = sFog2SpriteAnimCmds, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = Fog2SpriteCallback, + .callback = UpdateFog2Sprite, }; -void DestroyFog2Sprites(void) +#define tSpriteColumn data[0] +#define tSpriteRow data[1] + +static void CreateFog2Sprites(void) +{ + u16 i; + struct SpriteSheet fog2SpriteSheet; + u8 spriteId; + struct Sprite *sprite; + + if (!gWeatherPtr->fog2SpritesCreated) + { + fog2SpriteSheet = gFog2SpriteSheet; + LoadSpriteSheet(&fog2SpriteSheet); + for (i = 0; i < NUM_FOG2_SPRITES; i++) + { + spriteId = CreateSpriteAtEnd(&sFog2SpriteTemplate, 0, (i / 5) * 64, 0xFF); + if (spriteId != MAX_SPRITES) + { + sprite = &gSprites[spriteId]; + sprite->tSpriteColumn = i % 5; + sprite->tSpriteRow = i / 5; + gWeatherPtr->sprites.s2.fog2Sprites[i] = sprite; + } + else + { + gWeatherPtr->sprites.s2.fog2Sprites[i] = NULL; + } + } + + gWeatherPtr->fog2SpritesCreated = TRUE; + } +} + +static void DestroyFog2Sprites(void) { u16 i; if (gWeatherPtr->fog2SpritesCreated) { - for (i = 0; i < 20; i++) + for (i = 0; i < NUM_FOG2_SPRITES; i++) { - if (gWeatherPtr->sprites.s2.fog2Sprites[i] != NULL) + if (gWeatherPtr->sprites.s2.fog2Sprites[i]) DestroySprite(gWeatherPtr->sprites.s2.fog2Sprites[i]); } + FreeSpriteTilesByTag(0x1203); gWeatherPtr->fog2SpritesCreated = FALSE; } } -void Fog2SpriteCallback(struct Sprite *sprite) +static void UpdateFog2Sprite(struct Sprite *sprite) { - sprite->pos2.y = gWeatherPtr->unknown_71A; - sprite->pos1.x = gWeatherPtr->unknown_718 + 32 + sprite->data[0] * 64; + sprite->pos2.y = gWeatherPtr->fog2PosY; + sprite->pos1.x = gWeatherPtr->fog2BaseSpritesX + 32 + sprite->tSpriteColumn * 64; if (sprite->pos1.x > 271) { - sprite->pos1.x = gWeatherPtr->unknown_718 + 0x1E0 - (4 - sprite->data[0]) * 64; + sprite->pos1.x = gWeatherPtr->fog2BaseSpritesX + 480 - (4 - sprite->tSpriteColumn) * 64; sprite->pos1.x &= 0x1FF; } } +#undef tSpriteColumn +#undef tSpriteRow + //------------------------------------------------------------------------------ // Sandstorm //------------------------------------------------------------------------------ +static void UpdateSandstormWaveIndex(void); +static void UpdateSandstormMovement(void); +static void CreateSandstormSprites(void); +static void CreateSwirlSandstormSprites(void); +static void DestroySandstormSprites(void); +static void UpdateSandstormSprite(struct Sprite *); +static void WaitSandSwirlSpriteEntrance(struct Sprite *); +static void UpdateSandstormSwirlSprite(struct Sprite *); + +#define MIN_SANDSTORM_WAVE_INDEX 0x20 + void Sandstorm_InitVars(void) { gWeatherPtr->initStep = 0; gWeatherPtr->weatherGfxLoaded = 0; gWeatherPtr->gammaTargetIndex = 0; gWeatherPtr->gammaStepDelay = 20; - if (gWeatherPtr->sandstormSprites1Created == 0) + if (!gWeatherPtr->sandstormSpritesCreated) { - gWeatherPtr->unknown_704 = gWeatherPtr->unknown_708 = 0; - gWeatherPtr->unknown_712 = 8; - gWeatherPtr->unknown_714 = 0; + gWeatherPtr->sandstormXOffset = gWeatherPtr->sandstormYOffset = 0; + gWeatherPtr->sandstormWaveIndex = 8; + gWeatherPtr->sandstormWaveCounter = 0; // Dead code. How does the compiler not optimize this out? - if (gWeatherPtr->unknown_712 > 0x5F) - gWeatherPtr->unknown_712 = 0x80 - gWeatherPtr->unknown_712; + if (gWeatherPtr->sandstormWaveIndex >= 0x80 - MIN_SANDSTORM_WAVE_INDEX) + gWeatherPtr->sandstormWaveIndex = 0x80 - gWeatherPtr->sandstormWaveIndex; + Weather_SetBlendCoeffs(0, 16); } } -void Sandstorm_Main(void); - void Sandstorm_InitAll(void) { Sandstorm_InitVars(); - while (gWeatherPtr->weatherGfxLoaded == FALSE) + while (!gWeatherPtr->weatherGfxLoaded) Sandstorm_Main(); } -void sub_808002C(void); -void sub_8080064(void); -void CreateSandstormSprites_1(void); -void CreateSandstormSprites_2(void); - void Sandstorm_Main(void) { - sub_8080064(); - sub_808002C(); - if (gWeatherPtr->unknown_712 > 0x5F) - gWeatherPtr->unknown_712 = 32; + UpdateSandstormMovement(); + UpdateSandstormWaveIndex(); + if (gWeatherPtr->sandstormWaveIndex >= 0x80 - MIN_SANDSTORM_WAVE_INDEX) + gWeatherPtr->sandstormWaveIndex = MIN_SANDSTORM_WAVE_INDEX; + switch (gWeatherPtr->initStep) { case 0: - CreateSandstormSprites_1(); - CreateSandstormSprites_2(); + CreateSandstormSprites(); + CreateSwirlSandstormSprites(); gWeatherPtr->initStep++; break; case 1: @@ -1944,20 +1961,19 @@ void Sandstorm_Main(void) gWeatherPtr->initStep++; break; case 2: - if (!Weather_UpdateBlend()) - break; - gWeatherPtr->weatherGfxLoaded = TRUE; - gWeatherPtr->initStep++; + if (Weather_UpdateBlend()) + { + gWeatherPtr->weatherGfxLoaded = TRUE; + gWeatherPtr->initStep++; + } break; } } -void sub_80800E4(void); - bool8 Sandstorm_Finish(void) { - sub_8080064(); - sub_808002C(); + UpdateSandstormMovement(); + UpdateSandstormWaveIndex(); switch (gWeatherPtr->finishStep) { case 0: @@ -1965,64 +1981,66 @@ bool8 Sandstorm_Finish(void) gWeatherPtr->finishStep++; break; case 1: - if (!Weather_UpdateBlend()) - break; - gWeatherPtr->finishStep++; + if (Weather_UpdateBlend()) + gWeatherPtr->finishStep++; break; case 2: - sub_80800E4(); + DestroySandstormSprites(); gWeatherPtr->finishStep++; break; default: return FALSE; } + return TRUE; } -void sub_808002C(void) +static void UpdateSandstormWaveIndex(void) { - if (gWeatherPtr->unknown_714++ > 4) + if (gWeatherPtr->sandstormWaveCounter++ > 4) { - gWeatherPtr->unknown_712++; - gWeatherPtr->unknown_714 = 0; + gWeatherPtr->sandstormWaveIndex++; + gWeatherPtr->sandstormWaveCounter = 0; } } -void sub_8080064(void) +static void UpdateSandstormMovement(void) { - gWeatherPtr->unknown_704 -= gSineTable[gWeatherPtr->unknown_712] * 4; - gWeatherPtr->unknown_708 -= gSineTable[gWeatherPtr->unknown_712]; - gWeatherPtr->unknown_70E = (gSpriteCoordOffsetX + (gWeatherPtr->unknown_704 >> 8)) & 0xFF; - gWeatherPtr->unknown_710 = gSpriteCoordOffsetY + (gWeatherPtr->unknown_708 >> 8); + gWeatherPtr->sandstormXOffset -= gSineTable[gWeatherPtr->sandstormWaveIndex] * 4; + gWeatherPtr->sandstormYOffset -= gSineTable[gWeatherPtr->sandstormWaveIndex]; + gWeatherPtr->sandstormBaseSpritesX = (gSpriteCoordOffsetX + (gWeatherPtr->sandstormXOffset >> 8)) & 0xFF; + gWeatherPtr->sandstormPosY = gSpriteCoordOffsetY + (gWeatherPtr->sandstormYOffset >> 8); } -void sub_80800E4(void) +static void DestroySandstormSprites(void) { u16 i; - if (gWeatherPtr->sandstormSprites1Created) + if (gWeatherPtr->sandstormSpritesCreated) { - for (i = 0; i < 20; i++) + for (i = 0; i < NUM_SANDSTORM_SPRITES; i++) { - if (gWeatherPtr->sprites.s2.sandstormSprites1[i] != NULL) + if (gWeatherPtr->sprites.s2.sandstormSprites1[i]) DestroySprite(gWeatherPtr->sprites.s2.sandstormSprites1[i]); } - gWeatherPtr->sandstormSprites1Created = FALSE; + + gWeatherPtr->sandstormSpritesCreated = FALSE; FreeSpriteTilesByTag(0x1204); } - if (gWeatherPtr->sandstormSprites2Created) + if (gWeatherPtr->sandstormSwirlSpritesCreated) { - for (i = 0; i < 5; i++) + for (i = 0; i < NUM_SWIRL_SANDSTORM_SPRITES; i++) { if (gWeatherPtr->sprites.s2.sandstormSprites2[i] != NULL) DestroySprite(gWeatherPtr->sprites.s2.sandstormSprites2[i]); } - gWeatherPtr->sandstormSprites2Created = FALSE; + + gWeatherPtr->sandstormSwirlSpritesCreated = FALSE; } } -const struct OamData gOamData_839AC1C = +static const struct OamData sSandstormSpriteOamData = { .y = 0, .affineMode = 0, @@ -2039,142 +2057,162 @@ const struct OamData gOamData_839AC1C = .affineParam = 0, }; -const union AnimCmd gSpriteAnim_839AC24[] = +static const union AnimCmd sSandstormSpriteAnimCmd0[] = { ANIMCMD_FRAME(0, 3), ANIMCMD_END, }; -const union AnimCmd gSpriteAnim_839AC2C[] = +static const union AnimCmd sSandstormSpriteAnimCmd1[] = { ANIMCMD_FRAME(64, 3), ANIMCMD_END, }; -const union AnimCmd *const gSpriteAnimTable_839AC34[] = +static const union AnimCmd *const sSandstormSpriteAnimCmds[] = { - gSpriteAnim_839AC24, - gSpriteAnim_839AC2C, + sSandstormSpriteAnimCmd0, + sSandstormSpriteAnimCmd1, }; -void SandstormSpriteCallback1(struct Sprite *); -const struct SpriteTemplate sSandstormSpriteTemplate = +static const struct SpriteTemplate sSandstormSpriteTemplate = { .tileTag = 0x1204, .paletteTag = 0x1201, - .oam = &gOamData_839AC1C, - .anims = gSpriteAnimTable_839AC34, + .oam = &sSandstormSpriteOamData, + .anims = sSandstormSpriteAnimCmds, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = SandstormSpriteCallback1, + .callback = UpdateSandstormSprite, }; -static const struct SpriteSheet sSandstormSpriteSheet = {gWeatherSandstormTiles, sizeof(gWeatherSandstormTiles), 0x1204}; +static const struct SpriteSheet sSandstormSpriteSheet = +{ + .data = gWeatherSandstormTiles, + .size = sizeof(gWeatherSandstormTiles), + .tag = 0x1204, +}; -void CreateSandstormSprites_1(void) +// Regular sandstorm sprites +#define tSpriteColumn data[0] +#define tSpriteRow data[1] + +// Swirly sandstorm sprites +#define tRadius data[0] +#define tWaveIndex data[1] +#define tRadiusCounter data[2] +#define tEntranceDelay data[3] + +static void CreateSandstormSprites(void) { u16 i; + u8 spriteId; - if (!gWeatherPtr->sandstormSprites1Created) + if (!gWeatherPtr->sandstormSpritesCreated) { LoadSpriteSheet(&sSandstormSpriteSheet); - LoadCustomWeatherSpritePalette(gUnknown_0854C2B0); - for (i = 0; i < 20; i++) + LoadCustomWeatherSpritePalette(gSandstormWeatherPalette); + for (i = 0; i < NUM_SANDSTORM_SPRITES; i++) { - u8 spriteId = CreateSpriteAtEnd(&sSandstormSpriteTemplate, 0, (i / 5) * 64, 1); - + spriteId = CreateSpriteAtEnd(&sSandstormSpriteTemplate, 0, (i / 5) * 64, 1); if (spriteId != MAX_SPRITES) { gWeatherPtr->sprites.s2.sandstormSprites1[i] = &gSprites[spriteId]; - gWeatherPtr->sprites.s2.sandstormSprites1[i]->data[0] = i % 5; - gWeatherPtr->sprites.s2.sandstormSprites1[i]->data[1] = i / 5; + gWeatherPtr->sprites.s2.sandstormSprites1[i]->tSpriteColumn = i % 5; + gWeatherPtr->sprites.s2.sandstormSprites1[i]->tSpriteRow = i / 5; } else { gWeatherPtr->sprites.s2.sandstormSprites1[i] = NULL; } } - gWeatherPtr->sandstormSprites1Created = TRUE; + + gWeatherPtr->sandstormSpritesCreated = TRUE; } } -const u16 gUnknown_0839AC5C[] = {0, 120, 80, 160, 40, 0}; +static const u16 sSwirlEntranceDelays[] = {0, 120, 80, 160, 40, 0}; -void SandstormSpriteCallback2(struct Sprite *); - -void CreateSandstormSprites_2(void) +static void CreateSwirlSandstormSprites(void) { u16 i; + u8 spriteId; - if (!gWeatherPtr->sandstormSprites2Created) + if (!gWeatherPtr->sandstormSwirlSpritesCreated) { - for (i = 0; i < 5; i++) + for (i = 0; i < NUM_SWIRL_SANDSTORM_SPRITES; i++) { - u8 spriteId = CreateSpriteAtEnd(&sSandstormSpriteTemplate, i * 48 + 24, 208, 1); - + spriteId = CreateSpriteAtEnd(&sSandstormSpriteTemplate, i * 48 + 24, 208, 1); if (spriteId != MAX_SPRITES) { gWeatherPtr->sprites.s2.sandstormSprites2[i] = &gSprites[spriteId]; gWeatherPtr->sprites.s2.sandstormSprites2[i]->oam.size = 2; - gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[1] = i * 51; - gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[0] = 8; - gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[2] = 0; - gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[4] = 0x6730; - gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[3] = gUnknown_0839AC5C[i]; + gWeatherPtr->sprites.s2.sandstormSprites2[i]->tSpriteRow = i * 51; + gWeatherPtr->sprites.s2.sandstormSprites2[i]->tRadius = 8; + gWeatherPtr->sprites.s2.sandstormSprites2[i]->tRadiusCounter = 0; + gWeatherPtr->sprites.s2.sandstormSprites2[i]->data[4] = 0x6730; // unused value + gWeatherPtr->sprites.s2.sandstormSprites2[i]->tEntranceDelay = sSwirlEntranceDelays[i]; StartSpriteAnim(gWeatherPtr->sprites.s2.sandstormSprites2[i], 1); CalcCenterToCornerVec(gWeatherPtr->sprites.s2.sandstormSprites2[i], 0, 2, 0); - gWeatherPtr->sprites.s2.sandstormSprites2[i]->callback = SandstormSpriteCallback2; + gWeatherPtr->sprites.s2.sandstormSprites2[i]->callback = WaitSandSwirlSpriteEntrance; } else { gWeatherPtr->sprites.s2.sandstormSprites2[i] = NULL; } - gWeatherPtr->sandstormSprites2Created = TRUE; + + gWeatherPtr->sandstormSwirlSpritesCreated = TRUE; } } } -void SandstormSpriteCallback1(struct Sprite *sprite) +static void UpdateSandstormSprite(struct Sprite *sprite) { - sprite->pos2.y = gWeatherPtr->unknown_710; - sprite->pos1.x = gWeatherPtr->unknown_70E + 32 + sprite->data[0] * 64; + sprite->pos2.y = gWeatherPtr->sandstormPosY; + sprite->pos1.x = gWeatherPtr->sandstormBaseSpritesX + 32 + sprite->tSpriteColumn * 64; if (sprite->pos1.x > 271) { - sprite->pos1.x = gWeatherPtr->unknown_70E + 0x1E0 - (4 - sprite->data[0]) * 64; + sprite->pos1.x = gWeatherPtr->sandstormBaseSpritesX + 480 - (4 - sprite->tSpriteColumn) * 64; sprite->pos1.x &= 0x1FF; } } -void SandstormSpriteCallback3(struct Sprite *); - -void SandstormSpriteCallback2(struct Sprite *sprite) +static void WaitSandSwirlSpriteEntrance(struct Sprite *sprite) { - if (--sprite->data[3] == -1) - sprite->callback = SandstormSpriteCallback3; + if (--sprite->tEntranceDelay == -1) + sprite->callback = UpdateSandstormSwirlSprite; } -void SandstormSpriteCallback3(struct Sprite *sprite) +static void UpdateSandstormSwirlSprite(struct Sprite *sprite) { - u32 x; - u32 y; + u32 x, y; if (--sprite->pos1.y < -48) { sprite->pos1.y = 208; - sprite->data[0] = 4; + sprite->tRadius = 4; } - x = sprite->data[0] * gSineTable[sprite->data[1]]; - y = sprite->data[0] * gSineTable[sprite->data[1] + 64]; + + x = sprite->tRadius * gSineTable[sprite->tWaveIndex]; + y = sprite->tRadius * gSineTable[sprite->tWaveIndex + 0x40]; sprite->pos2.x = x >> 8; sprite->pos2.y = y >> 8; - sprite->data[1] = (sprite->data[1] + 10) & 0xFF; - if (++sprite->data[2] > 8) + sprite->tWaveIndex = (sprite->tWaveIndex + 10) & 0xFF; + if (++sprite->tRadiusCounter > 8) { - sprite->data[2] = 0; - sprite->data[0]++; + sprite->tRadiusCounter = 0; + sprite->tRadius++; } } +#undef tSpriteColumn +#undef tSpriteRow + +#undef tRadius +#undef tWaveIndex +#undef tRadiusCounter +#undef tEntranceDelay + //------------------------------------------------------------------------------ // Shade //------------------------------------------------------------------------------ @@ -2204,61 +2242,20 @@ bool8 Shade_Finish(void) // Bubbles //------------------------------------------------------------------------------ -const u8 gUnknown_0839AC68[] = {40, 90, 60, 90, 2, 60, 40, 30}; +static void CreateBubbleSprite(u16); +static void DestroyBubbleSprites(void); +static void UpdateBubbleSprite(struct Sprite *); -const struct SpriteSheet gWeatherBubbleSpriteSheet = {gWeatherBubbleTiles, sizeof(gWeatherBubbleTiles), 0x1205}; +static const u8 sBubbleStartDelays[] = {40, 90, 60, 90, 2, 60, 40, 30}; -void Bubbles_InitVars(void) +static const struct SpriteSheet sWeatherBubbleSpriteSheet = { - Fog1_InitVars(); - if (gWeatherPtr->unknown_72E == 0) - { - LoadSpriteSheet(&gWeatherBubbleSpriteSheet); - gWeatherPtr->unknown_728 = 0; - gWeatherPtr->unknown_726 = gUnknown_0839AC68[0]; - gWeatherPtr->unknown_72A = 0; - gWeatherPtr->unknown_72C = 0; - } -} + .data = gWeatherBubbleTiles, + .size = sizeof(gWeatherBubbleTiles), + .tag = 0x1205, +}; -void Bubbles_Main(void); - -void Bubbles_InitAll(void) -{ - Bubbles_InitVars(); - while (gWeatherPtr->weatherGfxLoaded == FALSE) - Bubbles_Main(); -} - -void sub_8080588(u16); - -void Bubbles_Main(void) -{ - Fog1_Main(); - if (++gWeatherPtr->unknown_726 > gUnknown_0839AC68[gWeatherPtr->unknown_728]) - { - gWeatherPtr->unknown_726 = 0; - if (++gWeatherPtr->unknown_728 > 7) - gWeatherPtr->unknown_728 = 0; - sub_8080588(gWeatherPtr->unknown_72A); - if (++gWeatherPtr->unknown_72A > 12) - gWeatherPtr->unknown_72A = 0; - } -} - -void sub_8080610(void); - -bool8 Bubbles_Finish(void) -{ - if (!Fog1_Finish()) - { - sub_8080610(); - return FALSE; - } - return TRUE; -} - -const s16 gUnknown_0839AC78[][2] = +static const s16 sBubbleStartCoords[][2] = { {120, 160}, {376, 160}, @@ -2275,91 +2272,139 @@ const s16 gUnknown_0839AC78[][2] = {256, 160}, }; -const union AnimCmd gSpriteAnim_839ACAC[] = +void Bubbles_InitVars(void) +{ + Fog1_InitVars(); + if (!gWeatherPtr->bubblesSpritesCreated) + { + LoadSpriteSheet(&sWeatherBubbleSpriteSheet); + gWeatherPtr->bubblesDelayIndex = 0; + gWeatherPtr->bubblesDelayCounter = sBubbleStartDelays[0]; + gWeatherPtr->bubblesCoordsIndex = 0; + gWeatherPtr->bubblesSpriteCount = 0; + } +} + +void Bubbles_InitAll(void) +{ + Bubbles_InitVars(); + while (!gWeatherPtr->weatherGfxLoaded) + Bubbles_Main(); +} + +void Bubbles_Main(void) +{ + Fog1_Main(); + if (++gWeatherPtr->bubblesDelayCounter > sBubbleStartDelays[gWeatherPtr->bubblesDelayIndex]) + { + gWeatherPtr->bubblesDelayCounter = 0; + if (++gWeatherPtr->bubblesDelayIndex > ARRAY_COUNT(sBubbleStartDelays) - 1) + gWeatherPtr->bubblesDelayIndex = 0; + + CreateBubbleSprite(gWeatherPtr->bubblesCoordsIndex); + if (++gWeatherPtr->bubblesCoordsIndex > ARRAY_COUNT(sBubbleStartCoords) - 1) + gWeatherPtr->bubblesCoordsIndex = 0; + } +} + +bool8 Bubbles_Finish(void) +{ + if (!Fog1_Finish()) + { + DestroyBubbleSprites(); + return FALSE; + } + + return TRUE; +} + +static const union AnimCmd sBubbleSpriteAnimCmd0[] = { ANIMCMD_FRAME(0, 16), ANIMCMD_FRAME(1, 16), ANIMCMD_END, }; -const union AnimCmd *const gSpriteAnimTable_839ACB8[] = +static const union AnimCmd *const sBubbleSpriteAnimCmds[] = { - gSpriteAnim_839ACAC, + sBubbleSpriteAnimCmd0, }; -extern const struct OamData gUnknown_08524904; - -void unc_0807DAB4(struct Sprite *); -const struct SpriteTemplate gSpriteTemplate_839ACBC = +static const struct SpriteTemplate sBubbleSpriteTemplate = { - .tileTag = 4613, + .tileTag = 0x1205, .paletteTag = 0x1200, .oam = &gUnknown_08524904, - .anims = gSpriteAnimTable_839ACB8, + .anims = sBubbleSpriteAnimCmds, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = unc_0807DAB4, + .callback = UpdateBubbleSprite, }; -void sub_8080588(u16 a) -{ - s16 x = gUnknown_0839AC78[a][0]; - s16 y = gUnknown_0839AC78[a][1] - gSpriteCoordOffsetY; - u8 spriteId = CreateSpriteAtEnd( - &gSpriteTemplate_839ACBC, - x, - y, - 0); +#define tScrollXCounter data[0] +#define tScrollXDir data[1] +#define tCounter data[2] +static void CreateBubbleSprite(u16 coordsIndex) +{ + s16 x = sBubbleStartCoords[coordsIndex][0]; + s16 y = sBubbleStartCoords[coordsIndex][1] - gSpriteCoordOffsetY; + u8 spriteId = CreateSpriteAtEnd(&sBubbleSpriteTemplate, x, y, 0); if (spriteId != MAX_SPRITES) { gSprites[spriteId].oam.priority = 1; gSprites[spriteId].coordOffsetEnabled = TRUE; - gSprites[spriteId].data[0] = 0; - gSprites[spriteId].data[1] = 0; - gSprites[spriteId].data[2] = 0; - gWeatherPtr->unknown_72C++; + gSprites[spriteId].tScrollXCounter = 0; + gSprites[spriteId].tScrollXDir = 0; + gSprites[spriteId].tCounter = 0; + gWeatherPtr->bubblesSpriteCount++; } } -void sub_8080610(void) +static void DestroyBubbleSprites(void) { u16 i; - if (gWeatherPtr->unknown_72C != 0) + if (gWeatherPtr->bubblesSpriteCount) { - for (i = 0; i < 64; i++) + for (i = 0; i < MAX_SPRITES; i++) { - if (gSprites[i].template == &gSpriteTemplate_839ACBC) + if (gSprites[i].template == &sBubbleSpriteTemplate) DestroySprite(&gSprites[i]); } + FreeSpriteTilesByTag(0x1205); - gWeatherPtr->unknown_72C = 0; + gWeatherPtr->bubblesSpriteCount = 0; } } -void unc_0807DAB4(struct Sprite *sprite) +static void UpdateBubbleSprite(struct Sprite *sprite) { - ++sprite->data[0]; - if (++sprite->data[0] > 8) // double increment + ++sprite->tScrollXCounter; + if (++sprite->tScrollXCounter > 8) // double increment { - sprite->data[0] = 0; - if (sprite->data[1] == 0) + sprite->tScrollXCounter = 0; + if (sprite->tScrollXDir == 0) { if (++sprite->pos2.x > 4) - sprite->data[1] = 1; + sprite->tScrollXDir = 1; } else { if (--sprite->pos2.x <= 0) - sprite->data[1] = 0; + sprite->tScrollXDir = 0; } } + sprite->pos1.y -= 3; - if (++sprite->data[2] > 0x77) + if (++sprite->tCounter >= 120) DestroySprite(sprite); } +#undef tScrollXCounter +#undef tScrollXDir +#undef tCounter + //------------------------------------------------------------------------------ // Unused function. From 02651f6177032baad32efdddeee54a9af624812b Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Tue, 2 Apr 2019 19:18:36 -0700 Subject: [PATCH 065/101] Attempt to decompile menu_specialized. 2 NONMATCHING --- asm/menu_specialized.s | 336 ---------------------------- include/menu_specialized.h | 6 +- include/strings.h | 2 + ld_script.txt | 1 - src/menu_specialized.c | 437 ++++++++++++++++++++++++++++++++++++- 5 files changed, 441 insertions(+), 341 deletions(-) delete mode 100644 asm/menu_specialized.s diff --git a/asm/menu_specialized.s b/asm/menu_specialized.s deleted file mode 100644 index 36db0f865..000000000 --- a/asm/menu_specialized.s +++ /dev/null @@ -1,336 +0,0 @@ - - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - - - - thumb_func_start DrawLevelUpWindowPg1 -DrawLevelUpWindowPg1: @ 81D3640 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - mov r8, r0 - adds r6, r1, 0 - adds r5, r2, 0 - adds r4, r3, 0 - ldr r3, [sp, 0x4C] - ldr r0, [sp, 0x50] - mov r9, r0 - lsls r4, 24 - lsrs r4, 24 - lsls r3, 24 - lsrs r3, 24 - mov r1, r9 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r1, r4, 4 - orrs r1, r4 - lsls r1, 24 - lsrs r1, 24 - str r3, [sp, 0x28] - bl FillWindowPixelBuffer - add r2, sp, 0xC - ldrh r0, [r5] - ldrh r1, [r6] - subs r0, r1 - strh r0, [r2] - ldrh r0, [r5, 0x2] - ldrh r1, [r6, 0x2] - subs r0, r1 - strh r0, [r2, 0x2] - ldrh r0, [r5, 0x4] - ldrh r1, [r6, 0x4] - subs r0, r1 - strh r0, [r2, 0x4] - ldrh r0, [r5, 0x8] - ldrh r1, [r6, 0x8] - subs r0, r1 - strh r0, [r2, 0x6] - ldrh r0, [r5, 0xA] - ldrh r1, [r6, 0xA] - subs r0, r1 - strh r0, [r2, 0x8] - ldrh r0, [r5, 0x6] - ldrh r1, [r6, 0x6] - subs r0, r1 - strh r0, [r2, 0xA] - add r0, sp, 0x24 - strb r4, [r0] - ldr r3, [sp, 0x28] - strb r3, [r0, 0x1] - mov r1, r9 - strb r1, [r0, 0x2] - movs r7, 0 - mov r10, r0 - movs r0, 0x1 - negs r0, r0 - mov r9, r0 - add r6, sp, 0x18 -_081D36CA: - lsls r0, r7, 4 - subs r0, r7 - lsls r0, 24 - lsrs r5, r0, 24 - mov r1, r10 - str r1, [sp] - mov r0, r9 - str r0, [sp, 0x4] - ldr r1, =gUnknown_08625B54 - lsls r0, r7, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [sp, 0x8] - mov r0, r8 - movs r1, 0x1 - movs r2, 0 - adds r3, r5, 0 - bl AddTextPrinterParameterized3 - lsls r0, r7, 1 - mov r4, sp - adds r4, r0 - adds r4, 0xC - movs r1, 0 - ldrsh r0, [r4, r1] - ldr r1, =gText_Dash - cmp r0, 0 - blt _081D3704 - ldr r1, =gText_UnkCtrlF904 -_081D3704: - adds r0, r6, 0 - bl StringCopy - mov r0, r10 - str r0, [sp] - mov r1, r9 - str r1, [sp, 0x4] - str r6, [sp, 0x8] - mov r0, r8 - movs r1, 0x1 - movs r2, 0x38 - adds r3, r5, 0 - bl AddTextPrinterParameterized3 - movs r0, 0 - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _081D372C - negs r0, r1 -_081D372C: - movs r4, 0xC - cmp r0, 0x9 - bgt _081D3734 - movs r4, 0x12 -_081D3734: - cmp r1, 0 - bge _081D373A - negs r1, r1 -_081D373A: - adds r0, r6, 0 - movs r2, 0 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - adds r2, r4, 0 - adds r2, 0x38 - mov r1, r10 - str r1, [sp] - mov r0, r9 - str r0, [sp, 0x4] - str r6, [sp, 0x8] - mov r0, r8 - movs r1, 0x1 - adds r3, r5, 0 - bl AddTextPrinterParameterized3 - adds r0, r7, 0x1 - lsls r0, 16 - lsrs r7, r0, 16 - cmp r7, 0x5 - bls _081D36CA - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end DrawLevelUpWindowPg1 - - thumb_func_start DrawLevelUpWindowPg2 -DrawLevelUpWindowPg2: @ 81D3784 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - mov r8, r0 - adds r5, r1, 0 - adds r4, r2, 0 - adds r6, r3, 0 - ldr r2, [sp, 0x4C] - lsls r4, 24 - lsrs r4, 24 - lsls r6, 24 - lsrs r6, 24 - lsls r2, 24 - lsrs r2, 24 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r1, r4, 4 - orrs r1, r4 - lsls r1, 24 - lsrs r1, 24 - str r2, [sp, 0x28] - bl FillWindowPixelBuffer - add r1, sp, 0xC - ldrh r0, [r5] - strh r0, [r1] - ldrh r0, [r5, 0x2] - strh r0, [r1, 0x2] - ldrh r0, [r5, 0x4] - strh r0, [r1, 0x4] - ldrh r0, [r5, 0x8] - strh r0, [r1, 0x6] - ldrh r0, [r5, 0xA] - strh r0, [r1, 0x8] - ldrh r0, [r5, 0x6] - strh r0, [r1, 0xA] - add r0, sp, 0x24 - strb r4, [r0] - strb r6, [r0, 0x1] - ldr r2, [sp, 0x28] - strb r2, [r0, 0x2] - movs r6, 0 - add r1, sp, 0x18 - mov r9, r1 - mov r7, r8 - mov r10, r0 - movs r2, 0x1 - negs r2, r2 - mov r8, r2 -_081D37EE: - lsls r1, r6, 1 - mov r0, sp - adds r0, r1 - adds r0, 0xC - movs r2, 0 - ldrsh r0, [r0, r2] - movs r4, 0x3 - cmp r0, 0x63 - bgt _081D3808 - movs r4, 0x1 - cmp r0, 0x9 - ble _081D3808 - movs r4, 0x2 -_081D3808: - mov r0, sp - adds r0, r1 - adds r0, 0xC - movs r2, 0 - ldrsh r1, [r0, r2] - mov r0, r9 - movs r2, 0 - adds r3, r4, 0 - bl ConvertIntToDecimalStringN - movs r0, 0x4 - subs r0, r4 - lsls r4, r0, 1 - adds r4, r0 - lsls r4, 17 - lsrs r4, 16 - lsls r5, r6, 4 - subs r5, r6 - lsls r5, 24 - lsrs r5, 24 - mov r0, r10 - str r0, [sp] - mov r1, r8 - str r1, [sp, 0x4] - ldr r1, =gUnknown_08625B54 - lsls r0, r6, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0x1 - movs r2, 0 - adds r3, r5, 0 - bl AddTextPrinterParameterized3 - adds r4, 0x38 - lsls r4, 24 - lsrs r4, 24 - mov r2, r10 - str r2, [sp] - mov r0, r8 - str r0, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - adds r0, r7, 0 - movs r1, 0x1 - adds r2, r4, 0 - adds r3, r5, 0 - bl AddTextPrinterParameterized3 - adds r0, r6, 0x1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0x5 - bls _081D37EE - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end DrawLevelUpWindowPg2 - - thumb_func_start GetMonLevelUpWindowStats -GetMonLevelUpWindowStats: @ 81D388C - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - movs r1, 0x3A @ MON_DATA_MAX_HP - bl GetMonData - strh r0, [r5] - adds r0, r4, 0 - movs r1, 0x3B @ MON_DATA_ATK - bl GetMonData - strh r0, [r5, 0x2] - adds r0, r4, 0 - movs r1, 0x3C @ MON_DATA_DEF - bl GetMonData - strh r0, [r5, 0x4] - adds r0, r4, 0 - movs r1, 0x3D @ MON_DATA_SPEED - bl GetMonData - strh r0, [r5, 0x6] - adds r0, r4, 0 - movs r1, 0x3E @ MON_DATA_SPATK - bl GetMonData - strh r0, [r5, 0x8] - adds r0, r4, 0 - movs r1, 0x3F @ MON_DATA_SPDEF - bl GetMonData - strh r0, [r5, 0xA] - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end GetMonLevelUpWindowStats - - .align 2, 0 @ Don't pad with nop. diff --git a/include/menu_specialized.h b/include/menu_specialized.h index d29ac5751..fb23e7ce6 100644 --- a/include/menu_specialized.h +++ b/include/menu_specialized.h @@ -32,8 +32,8 @@ u8 sub_81D1DC0(struct PlayerPCItemPageStruct *page); void sub_81D1E90(struct PlayerPCItemPageStruct *page); void sub_81D1EC0(void); void sub_81D1D04(u8 a0); -void DrawLevelUpWindowPg1(u16 arg0, void* statStoreLocation1, void* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); -void DrawLevelUpWindowPg2(u16 arg0, void* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); +void DrawLevelUpWindowPg1(u16 arg0, u16* statStoreLocation1, u16* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); +void DrawLevelUpWindowPg2(u16 arg0, u16* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0); void sub_81D2108(struct UnknownStruct_81D1ED4 *arg0); void sub_81D20AC(struct UnknownStruct_81D1ED4 *arg0); @@ -47,7 +47,7 @@ bool16 MoveRelearnerRunTextPrinters(void); void MoveRelearnerCreateYesNoMenu(void); u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices); void InitMoveRelearnerWindows(bool8 useContextWindow); -void GetMonLevelUpWindowStats(struct Pokemon* mon, void* statStoreLocation); +void GetMonLevelUpWindowStats(struct Pokemon* mon, u16* statStoreLocation); s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst); void sub_81D2ED4(u8 *dst, u8 *nameDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7); void sub_81D2F78(struct UnknownStruct_81D1ED4 *arg0, u8 *sheen, u16 boxId, u16 monId, u16 arg5, u16 id, u16 arg7, bool8 arg8); diff --git a/include/strings.h b/include/strings.h index 8aa296eb1..fc5724af3 100644 --- a/include/strings.h +++ b/include/strings.h @@ -471,6 +471,8 @@ extern const u8 gText_EggCantBattle[]; extern const u8 gText_PkmnAlreadySelected[]; extern const u8 gText_PkmnAlreadyInBattle[]; extern const u8 gText_PkmnCantSwitchOut[]; +extern const u8 gText_Dash[]; +extern const u8 gText_UnkCtrlF904[]; //pokedex text extern const u8 gText_CryOf[]; diff --git a/ld_script.txt b/ld_script.txt index 619abfce1..5cb7851bf 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -303,7 +303,6 @@ SECTIONS { asm/pokenav.o(.text); src/pokenav_match_call.o(.text); src/menu_specialized.o(.text); - asm/menu_specialized.o(.text); src/ereader_helpers.o(.text); src/faraway_island.o(.text); src/ereader_screen.o(.text); diff --git a/src/menu_specialized.c b/src/menu_specialized.c index f21f4e51a..c8c46fbc1 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -28,6 +28,7 @@ #include "gba/io_reg.h" extern const struct CompressedSpriteSheet gMonFrontPicTable[]; +extern const u8 *gUnknown_08625B54[]; EWRAM_DATA static u8 sUnknown_0203CF48[3] = {0}; EWRAM_DATA static struct ListMenuItem *sUnknown_0203CF4C = NULL; @@ -259,7 +260,7 @@ static void sub_81D1D44(u8 windowId, s32 itemId, u8 y) u8 buffer[30]; u16 length; - if (itemId == LIST_CANCEL) + if (itemId == LIST_CANCEL) return; StringCopy(buffer, gSaveBlock1Ptr->mail[6 + itemId].playerName); @@ -1639,3 +1640,437 @@ static void sub_81D35E8(struct Sprite *sprite) id = gSprites[id].data[5]; } } + + +#ifdef NONMATCHING +void DrawLevelUpWindowPg1(u8 arg0, u16 *statStoreLocation1, u16 *statStoreLocation2, u8 arg3, u8 arg4, u8 arg5) +{ + s32 i; + s16 array[6]; + u8 *text; + u8 *text2; + s16 *ptr; + u8 something[14]; + s32 var; + u8 var2; + s32 var3; + + + + + + FillWindowPixelBuffer(arg0, arg3 * 16 | arg3); + + + array[0] = statStoreLocation2[0] - statStoreLocation1[0]; + array[1] = statStoreLocation2[1] - statStoreLocation1[1]; + array[2] = statStoreLocation2[2] - statStoreLocation1[2]; + array[3] = statStoreLocation2[4] - statStoreLocation1[4]; + array[4] = statStoreLocation2[5] - statStoreLocation1[5]; + array[5] = statStoreLocation2[3] - statStoreLocation1[3]; + + + for(i = 0; i < 6; i++) + { + AddTextPrinterParameterized3(arg0, 1, 0, 15 * i, &arg3, TEXT_SPEED_FF, gUnknown_08625B54[i]); + ptr = &array[i]; + text = (u8 *) gText_Dash; + + if(*ptr >= 0) + { + text = (u8 *) gText_UnkCtrlF904; + } + + StringCopy(text2, text); + AddTextPrinterParameterized3(arg0, 1, 56, 15 * i, &arg3, TEXT_SPEED_FF, text2); + var3 = *ptr; + var = var3; + + if(var3 < 0) + { + var = -var3; + } + + var2 = 12; + + if(var <= 9) + { + var2 = 18; + } + + if(var3 < 0) + { + var3 = -var3; + } + + ConvertIntToDecimalStringN(text2, var3, 0, 2); + AddTextPrinterParameterized3(arg0, 1, var2 + 56, 15 * i, &arg3, TEXT_SPEED_FF, text2); + } +} +#else +NAKED +void DrawLevelUpWindowPg1(u16 arg0, u16 *statStoreLocation1, u16 *statStoreLocation2, u8 arg3, u8 arg4, u8 arg5) +{ + asm(".syntax 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, 0x2C\n\ + mov r8, r0\n\ + adds r6, r1, 0\n\ + adds r5, r2, 0\n\ + adds r4, r3, 0\n\ + ldr r3, [sp, 0x4C]\n\ + ldr r0, [sp, 0x50]\n\ + mov r9, r0\n\ + lsls r4, 24\n\ + lsrs r4, 24\n\ + lsls r3, 24\n\ + lsrs r3, 24\n\ + mov r1, r9\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + mov r9, r1\n\ + mov r0, r8\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r8, r0\n\ + lsls r1, r4, 4\n\ + orrs r1, r4\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + str r3, [sp, 0x28]\n\ + bl FillWindowPixelBuffer\n\ + add r2, sp, 0xC\n\ + ldrh r0, [r5]\n\ + ldrh r1, [r6]\n\ + subs r0, r1\n\ + strh r0, [r2]\n\ + ldrh r0, [r5, 0x2]\n\ + ldrh r1, [r6, 0x2]\n\ + subs r0, r1\n\ + strh r0, [r2, 0x2]\n\ + ldrh r0, [r5, 0x4]\n\ + ldrh r1, [r6, 0x4]\n\ + subs r0, r1\n\ + strh r0, [r2, 0x4]\n\ + ldrh r0, [r5, 0x8]\n\ + ldrh r1, [r6, 0x8]\n\ + subs r0, r1\n\ + strh r0, [r2, 0x6]\n\ + ldrh r0, [r5, 0xA]\n\ + ldrh r1, [r6, 0xA]\n\ + subs r0, r1\n\ + strh r0, [r2, 0x8]\n\ + ldrh r0, [r5, 0x6]\n\ + ldrh r1, [r6, 0x6]\n\ + subs r0, r1\n\ + strh r0, [r2, 0xA]\n\ + add r0, sp, 0x24\n\ + strb r4, [r0]\n\ + ldr r3, [sp, 0x28]\n\ + strb r3, [r0, 0x1]\n\ + mov r1, r9\n\ + strb r1, [r0, 0x2]\n\ + movs r7, 0\n\ + mov r10, r0\n\ + movs r0, 0x1\n\ + negs r0, r0\n\ + mov r9, r0\n\ + add r6, sp, 0x18\n\ +_081D36CA:\n\ + lsls r0, r7, 4\n\ + subs r0, r7\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + mov r1, r10\n\ + str r1, [sp]\n\ + mov r0, r9\n\ + str r0, [sp, 0x4]\n\ + ldr r1, =gUnknown_08625B54\n\ + lsls r0, r7, 2\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + str r0, [sp, 0x8]\n\ + mov r0, r8\n\ + movs r1, 0x1\n\ + movs r2, 0\n\ + adds r3, r5, 0\n\ + bl AddTextPrinterParameterized3\n\ + lsls r0, r7, 1\n\ + mov r4, sp\n\ + adds r4, r0\n\ + adds r4, 0xC\n\ + movs r1, 0\n\ + ldrsh r0, [r4, r1]\n\ + ldr r1, =gText_Dash\n\ + cmp r0, 0\n\ + blt _081D3704\n\ + ldr r1, =gText_UnkCtrlF904\n\ +_081D3704:\n\ + adds r0, r6, 0\n\ + bl StringCopy\n\ + mov r0, r10\n\ + str r0, [sp]\n\ + mov r1, r9\n\ + str r1, [sp, 0x4]\n\ + str r6, [sp, 0x8]\n\ + mov r0, r8\n\ + movs r1, 0x1\n\ + movs r2, 0x38\n\ + adds r3, r5, 0\n\ + bl AddTextPrinterParameterized3\n\ + movs r0, 0\n\ + ldrsh r1, [r4, r0]\n\ + adds r0, r1, 0\n\ + cmp r1, 0\n\ + bge _081D372C\n\ + negs r0, r1\n\ +_081D372C:\n\ + movs r4, 0xC\n\ + cmp r0, 0x9\n\ + bgt _081D3734\n\ + movs r4, 0x12\n\ +_081D3734:\n\ + cmp r1, 0\n\ + bge _081D373A\n\ + negs r1, r1\n\ +_081D373A:\n\ + adds r0, r6, 0\n\ + movs r2, 0\n\ + movs r3, 0x2\n\ + bl ConvertIntToDecimalStringN\n\ + adds r2, r4, 0\n\ + adds r2, 0x38\n\ + mov r1, r10\n\ + str r1, [sp]\n\ + mov r0, r9\n\ + str r0, [sp, 0x4]\n\ + str r6, [sp, 0x8]\n\ + mov r0, r8\n\ + movs r1, 0x1\n\ + adds r3, r5, 0\n\ + bl AddTextPrinterParameterized3\n\ + adds r0, r7, 0x1\n\ + lsls r0, 16\n\ + lsrs r7, r0, 16\n\ + cmp r7, 0x5\n\ + bls _081D36CA\n\ + add sp, 0x2C\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\n\ + .pool\n\ + .syntax divided"); +} +#endif // NONMATCHING + +#ifdef NONMATCHING +void DrawLevelUpWindowPg2(u16 arg0, u16* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4) +{ + s32 i; + s32 var; + s32 var2; + u8 text; + s16 array[6]; + u8 *something; + u8 some; + FillWindowPixelBuffer(arg0, arg2 * 16 | arg2); + array[0] = statStoreLocation1[0]; + array[1] = statStoreLocation1[1]; + array[2] = statStoreLocation1[2]; + array[3] = statStoreLocation1[4]; + array[4] = statStoreLocation1[5]; + array[5] = statStoreLocation1[3]; + for(i = 0; i <= 5; i++) + { + var = array[i]; + var2 = 3; + if(var <= 99) + { + var2 = 1; + if(var > 9) + { + var2 = 2; + } + } + something = ConvertIntToDecimalStringN(&text, array[i], 0, var2); + some = (((4 - *something) * 2) + *something) * 2; + AddTextPrinterParameterized3(arg0, 1, 0, 15 * i, &arg2, TEXT_SPEED_FF, gUnknown_08625B54[i]); + AddTextPrinterParameterized3(arg0, 1, some + 56, 15 * i, &arg2, TEXT_SPEED_FF, &text); + } +} +#else +NAKED +void DrawLevelUpWindowPg2(u16 arg0, u16* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4) +{ + asm(".syntax 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, 0x2C\n\ + mov r8, r0\n\ + adds r5, r1, 0\n\ + adds r4, r2, 0\n\ + adds r6, r3, 0\n\ + ldr r2, [sp, 0x4C]\n\ + lsls r4, 24\n\ + lsrs r4, 24\n\ + lsls r6, 24\n\ + lsrs r6, 24\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r8, r0\n\ + lsls r1, r4, 4\n\ + orrs r1, r4\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + str r2, [sp, 0x28]\n\ + bl FillWindowPixelBuffer\n\ + add r1, sp, 0xC\n\ + ldrh r0, [r5]\n\ + strh r0, [r1]\n\ + ldrh r0, [r5, 0x2]\n\ + strh r0, [r1, 0x2]\n\ + ldrh r0, [r5, 0x4]\n\ + strh r0, [r1, 0x4]\n\ + ldrh r0, [r5, 0x8]\n\ + strh r0, [r1, 0x6]\n\ + ldrh r0, [r5, 0xA]\n\ + strh r0, [r1, 0x8]\n\ + ldrh r0, [r5, 0x6]\n\ + strh r0, [r1, 0xA]\n\ + add r0, sp, 0x24\n\ + strb r4, [r0]\n\ + strb r6, [r0, 0x1]\n\ + ldr r2, [sp, 0x28]\n\ + strb r2, [r0, 0x2]\n\ + movs r6, 0\n\ + add r1, sp, 0x18\n\ + mov r9, r1\n\ + mov r7, r8\n\ + mov r10, r0\n\ + movs r2, 0x1\n\ + negs r2, r2\n\ + mov r8, r2\n\ +_081D37EE:\n\ + lsls r1, r6, 1\n\ + mov r0, sp\n\ + adds r0, r1\n\ + adds r0, 0xC\n\ + movs r2, 0\n\ + ldrsh r0, [r0, r2]\n\ + movs r4, 0x3\n\ + cmp r0, 0x63\n\ + bgt _081D3808\n\ + movs r4, 0x1\n\ + cmp r0, 0x9\n\ + ble _081D3808\n\ + movs r4, 0x2\n\ +_081D3808:\n\ + mov r0, sp\n\ + adds r0, r1\n\ + adds r0, 0xC\n\ + movs r2, 0\n\ + ldrsh r1, [r0, r2]\n\ + mov r0, r9\n\ + movs r2, 0\n\ + adds r3, r4, 0\n\ + bl ConvertIntToDecimalStringN\n\ + movs r0, 0x4\n\ + subs r0, r4\n\ + lsls r4, r0, 1\n\ + adds r4, r0\n\ + lsls r4, 17\n\ + lsrs r4, 16\n\ + lsls r5, r6, 4\n\ + subs r5, r6\n\ + lsls r5, 24\n\ + lsrs r5, 24\n\ + mov r0, r10\n\ + str r0, [sp]\n\ + mov r1, r8\n\ + str r1, [sp, 0x4]\n\ + ldr r1, =gUnknown_08625B54\n\ + lsls r0, r6, 2\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + str r0, [sp, 0x8]\n\ + adds r0, r7, 0\n\ + movs r1, 0x1\n\ + movs r2, 0\n\ + adds r3, r5, 0\n\ + bl AddTextPrinterParameterized3\n\ + adds r4, 0x38\n\ + lsls r4, 24\n\ + lsrs r4, 24\n\ + mov r2, r10\n\ + str r2, [sp]\n\ + mov r0, r8\n\ + str r0, [sp, 0x4]\n\ + mov r1, r9\n\ + str r1, [sp, 0x8]\n\ + adds r0, r7, 0\n\ + movs r1, 0x1\n\ + adds r2, r4, 0\n\ + adds r3, r5, 0\n\ + bl AddTextPrinterParameterized3\n\ + adds r0, r6, 0x1\n\ + lsls r0, 16\n\ + lsrs r6, r0, 16\n\ + cmp r6, 0x5\n\ + bls _081D37EE\n\ + add sp, 0x2C\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\n\ + .pool\n\ + .syntax divided"); +} +#endif // NONMATCHING + +void GetMonLevelUpWindowStats(struct Pokemon* mon, u16* statStoreLocation) +{ + statStoreLocation[0] = GetMonData(mon, MON_DATA_MAX_HP); + statStoreLocation[1] = GetMonData(mon, MON_DATA_ATK); + statStoreLocation[2] = GetMonData(mon, MON_DATA_DEF); + statStoreLocation[3] = GetMonData(mon, MON_DATA_SPEED); + statStoreLocation[4] = GetMonData(mon, MON_DATA_SPATK); + statStoreLocation[5] = GetMonData(mon, MON_DATA_SPDEF); +} + + + + + + + + + + + + + + + + + + + + + + From 438521bf21e24afc15adf871f154d5d7c361408a Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 3 Apr 2019 22:00:15 +0200 Subject: [PATCH 066/101] Get rid of redundant cast --- src/pokemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pokemon.c b/src/pokemon.c index 984c484a2..a75701cb0 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5463,7 +5463,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem) if (gEvolutionTable[species][i].param == heldItem) { heldItem = 0; - SetMonData(mon, MON_DATA_HELD_ITEM, (u8 *)&heldItem); + SetMonData(mon, MON_DATA_HELD_ITEM, &heldItem); targetSpecies = gEvolutionTable[species][i].targetSpecies; } break; From a455d98385cdeadc65ee3df992fc8d6be36495b3 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 08:43:16 -0400 Subject: [PATCH 067/101] start porting mevent_server from firered --- asm/mevent_server.s | 115 +------------------------------- asm/mevent_server_helpers.s | 6 +- asm/mevent_server_ish.s | 2 +- data/mevent_server.s | 4 +- include/mevent_server.h | 74 ++++++++++++++++++++ include/mevent_server_helpers.h | 6 ++ ld_script.txt | 2 + src/mevent_server.c | 56 ++++++++++++++++ sym_ewram.txt | 10 +-- 9 files changed, 150 insertions(+), 125 deletions(-) create mode 100644 include/mevent_server_helpers.h create mode 100644 src/mevent_server.c diff --git a/asm/mevent_server.s b/asm/mevent_server.s index 8c76e2d0d..ea4416ac7 100755 --- a/asm/mevent_server.s +++ b/asm/mevent_server.s @@ -5,115 +5,6 @@ .text - thumb_func_start mevent_srv_init_wnews -mevent_srv_init_wnews: @ 801D07C - push {r4,lr} - ldr r4, =gUnknown_02022C7C - movs r0, 0x60 - bl AllocZeroed - str r0, [r4] - ldr r1, =gUnknown_082F298C - movs r2, 0 - movs r3, 0x1 - bl mevent_srv_init_common - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end mevent_srv_init_wnews - - thumb_func_start mevent_srv_new_wcard -mevent_srv_new_wcard: @ 801D0A0 - push {r4,lr} - ldr r4, =gUnknown_02022C7C - movs r0, 0x60 - bl AllocZeroed - str r0, [r4] - ldr r1, =gUnknown_082F29EC - movs r2, 0 - movs r3, 0x1 - bl mevent_srv_init_common - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end mevent_srv_new_wcard - - thumb_func_start mevent_srv_common_do_exec -mevent_srv_common_do_exec: @ 801D0C4 - push {r4-r6,lr} - adds r6, r0, 0 - ldr r4, =gUnknown_02022C7C - ldr r0, [r4] - cmp r0, 0 - bne _0801D0D8 - movs r0, 0x3 - b _0801D0F8 - .pool -_0801D0D8: - bl mevent_dispatch_08145600 - adds r5, r0, 0 - cmp r5, 0x3 - bne _0801D0F6 - ldr r0, [r4] - ldr r1, [r0, 0x4] - strh r1, [r6] - bl mevent_srv_free_resources - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] -_0801D0F6: - adds r0, r5, 0 -_0801D0F8: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end mevent_srv_common_do_exec - - thumb_func_start mevent_srv_init_common -mevent_srv_init_common: @ 801D100 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - adds r4, r0, 0 - adds r6, r1, 0 - mov r8, r2 - mov r9, r3 - movs r5, 0 - str r5, [r4] - str r5, [r4, 0x8] - movs r0, 0xA6 - lsls r0, 1 - bl AllocZeroed - str r0, [r4, 0x18] - movs r0, 0xDE - lsls r0, 1 - bl AllocZeroed - str r0, [r4, 0x1C] - movs r0, 0x80 - lsls r0, 3 - bl AllocZeroed - str r0, [r4, 0x14] - movs r0, 0x64 - bl AllocZeroed - str r0, [r4, 0x20] - str r6, [r4, 0x10] - str r5, [r4, 0xC] - adds r4, 0x38 - adds r0, r4, 0 - mov r1, r8 - mov r2, r9 - bl sub_801D8D8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end mevent_srv_init_common - thumb_func_start mevent_srv_free_resources mevent_srv_free_resources: @ 801D158 push {r4,lr} @@ -517,8 +408,8 @@ _0801D464: bx r1 thumb_func_end sub_801D1F0 - thumb_func_start mevent_dispatch_08145600 -mevent_dispatch_08145600: @ 801D46C + thumb_func_start mevent_srv_exec_common +mevent_srv_exec_common: @ 801D46C push {lr} ldr r2, =gUnknown_082F2548 ldr r1, [r0, 0x8] @@ -529,6 +420,6 @@ mevent_dispatch_08145600: @ 801D46C pop {r1} bx r1 .pool - thumb_func_end mevent_dispatch_08145600 + thumb_func_end mevent_srv_exec_common .align 2, 0 @ don't pad with nop diff --git a/asm/mevent_server_helpers.s b/asm/mevent_server_helpers.s index f92f1e2c7..6a60649a4 100755 --- a/asm/mevent_server_helpers.s +++ b/asm/mevent_server_helpers.s @@ -23,8 +23,8 @@ sub_801D8CC: @ 801D8CC bx r1 thumb_func_end sub_801D8CC - thumb_func_start sub_801D8D8 -sub_801D8D8: @ 801D8D8 + thumb_func_start mevent_srv_sub_init +mevent_srv_sub_init: @ 801D8D8 movs r3, 0 strb r1, [r0, 0x4] strb r2, [r0, 0x5] @@ -43,7 +43,7 @@ sub_801D8D8: @ 801D8D8 str r1, [r0, 0x20] bx lr .pool - thumb_func_end sub_801D8D8 + thumb_func_end mevent_srv_sub_init thumb_func_start sub_801D904 sub_801D904: @ 801D904 diff --git a/asm/mevent_server_ish.s b/asm/mevent_server_ish.s index f61666982..765b39b7e 100755 --- a/asm/mevent_server_ish.s +++ b/asm/mevent_server_ish.s @@ -115,7 +115,7 @@ mevent_srv_ish_init: @ 801D50C adds r0, r4, 0 adds r1, r6, 0 mov r2, r8 - bl sub_801D8D8 + bl mevent_srv_sub_init pop {r3} mov r8, r3 pop {r4-r6} diff --git a/data/mevent_server.s b/data/mevent_server.s index 02fe9476e..eaab75c36 100755 --- a/data/mevent_server.s +++ b/data/mevent_server.s @@ -242,7 +242,7 @@ gUnknown_082F292C:: @ 82F292C .byte 0x00, 0x00, 0x00, 0x00 .align 2 -gUnknown_082F298C:: @ 82F298C +s_mevent_wonder_news:: @ 82F298C .byte 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00 .byte 0x20, 0x00, 0x00, 0x00 @@ -262,7 +262,7 @@ gUnknown_082F298C:: @ 82F298C .4byte gUnknown_082F2800 .align 2 -gUnknown_082F29EC:: @ 82F29EC +s_mevent_wonder_card:: @ 82F29EC .byte 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 diff --git a/include/mevent_server.h b/include/mevent_server.h index d7657b270..772aae6b1 100644 --- a/include/mevent_server.h +++ b/include/mevent_server.h @@ -1,6 +1,80 @@ #ifndef GUARD_MEVENT_SERVER_H #define GUARD_MEVENT_SERVER_H +#define ME_SEND_BUF_SIZE 0x400 + +struct mevent_srv_sub +{ + s32 seqno; + u8 sendPlayerNo; + u8 recvPlayerNo; + u16 recvIdent; + u16 recvCounter; + u16 recvCRC; + u16 recvSize; + u16 sendIdent; + u16 sendCounter; + u16 sendCRC; + u16 sendSize; + void * recvBfr; + const void * sendBfr; + u32 (*recvFunc)(struct mevent_srv_sub *); + u32 (*sendFunc)(struct mevent_srv_sub *); +}; + +struct send_recv_header +{ + u16 ident; + u16 crc; + u16 size; +}; + +struct mevent_cmd_ish +{ + u32 instr; + u32 parameter; +}; + +struct mevent_srv_ish +{ + u32 unk_00; + u32 param; + u32 mainseqno; + u32 flag; + u32 cmdidx; + void * sendBuffer; + void * recvBuffer; + struct mevent_cmd_ish * cmdBuffer; + void * buffer; + struct mevent_srv_sub manager; +}; + +struct mevent_cmd +{ + u32 instr; + bool32 flag; + void * parameter; +}; + +struct mevent_srv_common +{ + u32 unk_00; + u32 param; + u32 mainseqno; + u32 cmdidx; + const struct mevent_cmd * cmdBuffer; + void * recvBuffer; + struct MEventBuffer_32E0_Sub * mevent_32e0; + struct MEventBuffer_3120_Sub * mevent_3120; + struct MEventStruct_Unk1442CC * mevent_unk1442cc; + void * sendBuffer1; + u32 sendBuffer1Size; + void * sendBuffer2; + u32 sendBuffer2Size; + u32 sendWord; + struct mevent_srv_sub manager; +}; + void mevent_srv_new_wcard(); void mevent_srv_init_wnews(); u32 mevent_srv_common_do_exec(u16 * a0); diff --git a/include/mevent_server_helpers.h b/include/mevent_server_helpers.h new file mode 100644 index 000000000..d2b4608fb --- /dev/null +++ b/include/mevent_server_helpers.h @@ -0,0 +1,6 @@ +#ifndef GUARD_MEVENT_SERVER_HELPERS_H +#define GUARD_MEVENT_SERVER_HELPERS_H + +void mevent_srv_sub_init(struct mevent_srv_sub *, u32, u32); + +#endif //GUARD_MEVENT_SERVER_HELPERS_H diff --git a/ld_script.txt b/ld_script.txt index 619abfce1..31de8d730 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -60,6 +60,7 @@ SECTIONS { src/union_room_battle.o(.text); src/mevent2.o(.text); src/mevent_801BAAC.o(.text); + src/mevent_server.o(.text); asm/mevent_server.o(.text); asm/mevent_server_ish.o(.text); asm/mevent_server_helpers.o(.text); @@ -416,6 +417,7 @@ SECTIONS { src/union_room_battle.o(.rodata); src/mevent2.o(.rodata); src/mevent_801BAAC.o(.rodata); + src/mevent_server.o(.rodata); data/mevent_server.o(.rodata); src/union_room_chat.o(.rodata); data/union_room_chat.o(.rodata); diff --git a/src/mevent_server.c b/src/mevent_server.c new file mode 100644 index 000000000..ea5a18626 --- /dev/null +++ b/src/mevent_server.c @@ -0,0 +1,56 @@ +#include "global.h" +#include "alloc.h" +#include "mevent.h" +#include "mevent_server.h" +#include "mevent_server_helpers.h" + +EWRAM_DATA struct mevent_srv_common * s_mevent_srv_common_ptr = NULL; +EWRAM_DATA struct mevent_srv_ish * s_mevent_srv_ish_ptr = NULL; + +static void mevent_srv_init_common(struct mevent_srv_common *, const void *, u32, u32); +u32 mevent_srv_exec_common(struct mevent_srv_common *); +u32 mevent_srv_free_resources(struct mevent_srv_common *); + +extern const struct mevent_cmd s_mevent_wonder_news[]; +extern const struct mevent_cmd s_mevent_wonder_card[]; + +void mevent_srv_init_wnews(void) +{ + s_mevent_srv_common_ptr = AllocZeroed(sizeof(struct mevent_srv_common)); + mevent_srv_init_common(s_mevent_srv_common_ptr, s_mevent_wonder_news, 0, 1); +} + +void mevent_srv_new_wcard(void) +{ + s_mevent_srv_common_ptr = AllocZeroed(sizeof(struct mevent_srv_common)); + mevent_srv_init_common(s_mevent_srv_common_ptr, s_mevent_wonder_card, 0, 1); +} + +u32 mevent_srv_common_do_exec(u16 * a0) +{ + u32 result; + if (s_mevent_srv_common_ptr == NULL) + return 3; + result = mevent_srv_exec_common(s_mevent_srv_common_ptr); + if (result == 3) + { + *a0 = s_mevent_srv_common_ptr->param; + mevent_srv_free_resources(s_mevent_srv_common_ptr); + Free(s_mevent_srv_common_ptr); + s_mevent_srv_common_ptr = NULL; + } + return result; +} + +static void mevent_srv_init_common(struct mevent_srv_common * svr, const void * cmdBuffer, u32 sendPlayerNo, u32 recvPlayerNo) +{ + svr->unk_00 = 0; + svr->mainseqno = 0; + svr->mevent_32e0 = AllocZeroed(sizeof(struct MEventBuffer_32E0_Sub)); + svr->mevent_3120 = AllocZeroed(sizeof(struct MEventBuffer_3120_Sub)); + svr->recvBuffer = AllocZeroed(ME_SEND_BUF_SIZE); + svr->mevent_unk1442cc = AllocZeroed(sizeof(struct MEventStruct_Unk1442CC)); + svr->cmdBuffer = cmdBuffer; + svr->cmdidx = 0; + mevent_srv_sub_init(&svr->manager, sendPlayerNo, recvPlayerNo); +} diff --git a/sym_ewram.txt b/sym_ewram.txt index fa0306b1e..22afe8226 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -12,14 +12,10 @@ .include "src/union_room_battle.o" .include "src/mevent2.o" .include "src/mevent_801BAAC.o" + .include "src/mevent_server.o" - @ mevent_server -gUnknown_02022C7C: @ 2022C7C - .space 0x4 - -s_mevent_srv_ish_ptr: @ 2022C80 - .space 0x4 - + @ union_room_chat + .align 2 gUnknown_02022C84: @ 2022C84 .space 0x4 From dabd1f6177ee6e2f65553d3fe43efcf023e0c3fe Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 10:54:51 -0400 Subject: [PATCH 068/101] finish mevent_server.s --- asm/mevent_server.s | 425 -------------------------------- asm/mevent_server_helpers.s | 24 +- asm/mevent_server_ish.s | 12 +- data/mevent_server.s | 8 - include/mevent_server_helpers.h | 4 + ld_script.txt | 4 +- src/mevent_server.c | 235 +++++++++++++++++- src/mevent_server_helpers.c | 1 + src/mevent_server_ish.c | 7 + sym_ewram.txt | 1 + 10 files changed, 266 insertions(+), 455 deletions(-) delete mode 100755 asm/mevent_server.s create mode 100644 src/mevent_server_helpers.c create mode 100644 src/mevent_server_ish.c diff --git a/asm/mevent_server.s b/asm/mevent_server.s deleted file mode 100755 index ea4416ac7..000000000 --- a/asm/mevent_server.s +++ /dev/null @@ -1,425 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start mevent_srv_free_resources -mevent_srv_free_resources: @ 801D158 - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0x18] - bl Free - ldr r0, [r4, 0x1C] - bl Free - ldr r0, [r4, 0x14] - bl Free - ldr r0, [r4, 0x20] - bl Free - pop {r4} - pop {r0} - bx r0 - thumb_func_end mevent_srv_free_resources - - thumb_func_start mevent_srv_814501C -mevent_srv_814501C: @ 801D17C - push {lr} - adds r0, 0x38 - bl sub_801D904 - pop {r0} - bx r0 - thumb_func_end mevent_srv_814501C - - thumb_func_start sub_801D188 -sub_801D188: @ 801D188 - push {lr} - cmp r0, 0 - bne _0801D190 - adds r0, r1, 0 -_0801D190: - pop {r1} - bx r1 - thumb_func_end sub_801D188 - - thumb_func_start sub_801D194 -sub_801D194: @ 801D194 - push {lr} - cmp r1, r0 - bcs _0801D19E - movs r0, 0 - b _0801D1A8 -_0801D19E: - cmp r1, r0 - beq _0801D1A6 - movs r0, 0x2 - b _0801D1A8 -_0801D1A6: - movs r0, 0x1 -_0801D1A8: - pop {r1} - bx r1 - thumb_func_end sub_801D194 - - thumb_func_start sub_801D1AC -sub_801D1AC: @ 801D1AC - movs r1, 0x4 - str r1, [r0, 0x8] - movs r0, 0 - bx lr - thumb_func_end sub_801D1AC - - thumb_func_start sub_801D1B4 -sub_801D1B4: @ 801D1B4 - movs r0, 0x3 - bx lr - thumb_func_end sub_801D1B4 - - thumb_func_start sub_801D1B8 -sub_801D1B8: @ 801D1B8 - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x38 - bl sub_801D8C0 - cmp r0, 0 - beq _0801D1CA - movs r0, 0x4 - str r0, [r4, 0x8] -_0801D1CA: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D1B8 - - thumb_func_start sub_801D1D4 -sub_801D1D4: @ 801D1D4 - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x38 - bl sub_801D8CC - cmp r0, 0 - beq _0801D1E6 - movs r0, 0x4 - str r0, [r4, 0x8] -_0801D1E6: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D1D4 - - thumb_func_start sub_801D1F0 -sub_801D1F0: @ 801D1F0 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r0, [r5, 0xC] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - ldr r2, [r5, 0x10] - adds r3, r2, r1 - adds r0, 0x1 - str r0, [r5, 0xC] - ldr r0, [r3] - cmp r0, 0x1E - bls _0801D20C - b _0801D464 -_0801D20C: - lsls r0, 2 - ldr r1, =_0801D21C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801D21C: - .4byte _0801D298 - .4byte _0801D2A2 - .4byte _0801D2A8 - .4byte _0801D2E2 - .4byte _0801D2D8 - .4byte _0801D2BA - .4byte _0801D2C6 - .4byte _0801D2EC - .4byte _0801D300 - .4byte _0801D308 - .4byte _0801D31E - .4byte _0801D32E - .4byte _0801D33A - .4byte _0801D360 - .4byte _0801D348 - .4byte _0801D390 - .4byte _0801D378 - .4byte _0801D3DC - .4byte _0801D3A8 - .4byte _0801D3C0 - .4byte _0801D3CE - .4byte _0801D406 - .4byte _0801D3EA - .4byte _0801D3F8 - .4byte _0801D40E - .4byte _0801D418 - .4byte _0801D422 - .4byte _0801D43C - .4byte _0801D450 - .4byte _0801D458 - .4byte _0801D2CC -_0801D298: - movs r0, 0x1 - str r0, [r5, 0x8] - ldr r0, [r3, 0x4] - str r0, [r5, 0x4] - b _0801D464 -_0801D2A2: - movs r0, 0x3 - str r0, [r5, 0x8] - b _0801D464 -_0801D2A8: - adds r0, r5, 0 - adds r0, 0x38 - ldr r1, [r3, 0x4] - ldr r2, [r5, 0x14] - bl sub_801D928 - movs r0, 0x2 - str r0, [r5, 0x8] - b _0801D464 -_0801D2BA: - ldr r0, [r5, 0x20] - ldr r1, [r5, 0x14] - movs r2, 0x64 - bl memcpy - b _0801D464 -_0801D2C6: - ldr r0, [r5, 0x20] - movs r1, 0 - b _0801D2D0 -_0801D2CC: - ldr r0, [r5, 0x20] - movs r1, 0x1 -_0801D2D0: - bl sub_801B6A0 - str r0, [r5, 0x4] - b _0801D464 -_0801D2D8: - ldr r1, [r5, 0x4] - ldr r0, [r3, 0x4] - cmp r1, r0 - beq _0801D2E2 - b _0801D464 -_0801D2E2: - movs r0, 0 - str r0, [r5, 0xC] - ldr r0, [r3, 0x8] - str r0, [r5, 0x10] - b _0801D464 -_0801D2EC: - ldr r0, [r3, 0x8] - ldr r1, [r5, 0x18] - bl sub_801D188 - adds r2, r0, 0 - ldr r1, [r5, 0x20] - bl sub_801B6EC - str r0, [r5, 0x4] - b _0801D464 -_0801D300: - ldr r0, [r5, 0x14] - ldr r0, [r0] - str r0, [r5, 0x4] - b _0801D464 -_0801D308: - ldr r0, [r3, 0x8] - adds r1, r5, 0 - adds r1, 0x34 - bl sub_801D188 - adds r2, r0, 0 - ldr r1, [r5, 0x20] - bl sub_801B708 - str r0, [r5, 0x4] - b _0801D464 -_0801D31E: - ldr r0, [r5, 0x20] - ldr r1, [r3, 0x4] - bl sub_801B784 - lsls r0, 16 - lsrs r0, 16 - str r0, [r5, 0x4] - b _0801D464 -_0801D32E: - ldr r0, [r5, 0x20] - ldr r1, [r3, 0x8] - bl sub_801B748 - str r0, [r5, 0x4] - b _0801D464 -_0801D33A: - ldr r0, [r3, 0x8] - ldr r1, [r5, 0x14] - ldr r1, [r1] - bl sub_801D194 - str r0, [r5, 0x4] - b _0801D464 -_0801D348: - ldr r0, [r3, 0x8] - ldr r1, [r5, 0x1C] - bl sub_801D188 - adds r2, r0, 0 - movs r3, 0xDE - lsls r3, 1 - adds r0, r5, 0 - movs r1, 0x17 - bl mevent_srv_814501C - b _0801D464 -_0801D360: - ldr r0, [r3, 0x8] - ldr r1, [r5, 0x18] - bl sub_801D188 - adds r2, r0, 0 - movs r3, 0xA6 - lsls r3, 1 - adds r0, r5, 0 - movs r1, 0x16 - bl mevent_srv_814501C - b _0801D464 -_0801D378: - ldr r0, [r3, 0x8] - adds r1, r5, 0 - adds r1, 0x34 - bl sub_801D188 - adds r2, r0, 0 - adds r0, r5, 0 - movs r1, 0x18 - movs r3, 0x4 - bl mevent_srv_814501C - b _0801D464 -_0801D390: - ldr r2, [r3, 0x8] - cmp r2, 0 - bne _0801D39C - ldr r2, [r5, 0x24] - ldr r3, [r5, 0x28] - b _0801D39E -_0801D39C: - ldr r3, [r3, 0x4] -_0801D39E: - adds r0, r5, 0 - movs r1, 0x19 - bl mevent_srv_814501C - b _0801D464 -_0801D3A8: - ldr r2, [r3, 0x8] - cmp r2, 0 - bne _0801D3B4 - ldr r2, [r5, 0x2C] - ldr r3, [r5, 0x30] - b _0801D3B6 -_0801D3B4: - ldr r3, [r3, 0x4] -_0801D3B6: - adds r0, r5, 0 - movs r1, 0x10 - bl mevent_srv_814501C - b _0801D464 -_0801D3C0: - ldr r2, [r3, 0x8] - adds r0, r5, 0 - movs r1, 0x1A - movs r3, 0xBC - bl mevent_srv_814501C - b _0801D464 -_0801D3CE: - ldr r2, [r3, 0x8] - ldr r3, [r3, 0x4] - adds r0, r5, 0 - movs r1, 0x15 - bl mevent_srv_814501C - b _0801D464 -_0801D3DC: - ldr r2, [r3, 0x8] - ldr r3, [r3, 0x4] - adds r0, r5, 0 - movs r1, 0x1C - bl mevent_srv_814501C - b _0801D464 -_0801D3EA: - ldr r0, [r5, 0x18] - ldr r1, [r3, 0x8] - movs r2, 0xA6 - lsls r2, 1 - bl memcpy - b _0801D464 -_0801D3F8: - ldr r0, [r5, 0x1C] - ldr r1, [r3, 0x8] - movs r2, 0xDE - lsls r2, 1 - bl memcpy - b _0801D464 -_0801D406: - ldr r0, [r3, 0x8] - ldr r0, [r0] - str r0, [r5, 0x34] - b _0801D464 -_0801D40E: - ldr r0, [r3, 0x8] - str r0, [r5, 0x24] - ldr r0, [r3, 0x4] - str r0, [r5, 0x28] - b _0801D464 -_0801D418: - ldr r0, [r3, 0x8] - str r0, [r5, 0x2C] - ldr r0, [r3, 0x4] - str r0, [r5, 0x30] - b _0801D464 -_0801D422: - ldr r4, [r5, 0x18] - bl sav1_get_mevent_buffer_1 - adds r1, r0, 0 - movs r2, 0xA6 - lsls r2, 1 - adds r0, r4, 0 - bl memcpy - ldr r0, [r5, 0x18] - bl sub_801B3C0 - b _0801D464 -_0801D43C: - ldr r4, [r5, 0x1C] - bl sav1_get_mevent_buffer_0 - adds r1, r0, 0 - movs r2, 0xDE - lsls r2, 1 - adds r0, r4, 0 - bl memcpy - b _0801D464 -_0801D450: - bl sub_8099244 - str r0, [r5, 0x24] - b _0801D464 -_0801D458: - ldr r2, [r3, 0x8] - ldr r3, [r3, 0x4] - adds r0, r5, 0 - movs r1, 0x1B - bl mevent_srv_814501C -_0801D464: - movs r0, 0x1 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_801D1F0 - - thumb_func_start mevent_srv_exec_common -mevent_srv_exec_common: @ 801D46C - push {lr} - ldr r2, =gUnknown_082F2548 - ldr r1, [r0, 0x8] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl _call_via_r1 - pop {r1} - bx r1 - .pool - thumb_func_end mevent_srv_exec_common - - .align 2, 0 @ don't pad with nop diff --git a/asm/mevent_server_helpers.s b/asm/mevent_server_helpers.s index 6a60649a4..9bb70ff63 100755 --- a/asm/mevent_server_helpers.s +++ b/asm/mevent_server_helpers.s @@ -5,23 +5,23 @@ .text - thumb_func_start sub_801D8C0 -sub_801D8C0: @ 801D8C0 + thumb_func_start mevent_srv_sub_recv +mevent_srv_sub_recv: @ 801D8C0 push {lr} ldr r1, [r0, 0x20] bl _call_via_r1 pop {r1} bx r1 - thumb_func_end sub_801D8C0 + thumb_func_end mevent_srv_sub_recv - thumb_func_start sub_801D8CC -sub_801D8CC: @ 801D8CC + thumb_func_start mevent_srv_sub_send +mevent_srv_sub_send: @ 801D8CC push {lr} ldr r1, [r0, 0x24] bl _call_via_r1 pop {r1} bx r1 - thumb_func_end sub_801D8CC + thumb_func_end mevent_srv_sub_send thumb_func_start mevent_srv_sub_init mevent_srv_sub_init: @ 801D8D8 @@ -45,8 +45,8 @@ mevent_srv_sub_init: @ 801D8D8 .pool thumb_func_end mevent_srv_sub_init - thumb_func_start sub_801D904 -sub_801D904: @ 801D904 + thumb_func_start mevent_srv_sub_init_send +mevent_srv_sub_init_send: @ 801D904 push {r4,lr} adds r4, r0, 0 movs r0, 0 @@ -67,10 +67,10 @@ _0801D920: pop {r4} pop {r0} bx r0 - thumb_func_end sub_801D904 + thumb_func_end mevent_srv_sub_init_send - thumb_func_start sub_801D928 -sub_801D928: @ 801D928 + thumb_func_start mevent_srv_sub_init_recv +mevent_srv_sub_init_recv: @ 801D928 movs r3, 0 str r3, [r0] strh r1, [r0, 0x6] @@ -79,7 +79,7 @@ sub_801D928: @ 801D928 strh r3, [r0, 0xC] str r2, [r0, 0x18] bx lr - thumb_func_end sub_801D928 + thumb_func_end mevent_srv_sub_init_recv thumb_func_start sub_801D938 sub_801D938: @ 801D938 diff --git a/asm/mevent_server_ish.s b/asm/mevent_server_ish.s index 765b39b7e..fe4c9cd46 100755 --- a/asm/mevent_server_ish.s +++ b/asm/mevent_server_ish.s @@ -175,7 +175,7 @@ sub_801D59C: @ 801D59C adds r0, r4, 0 adds r1, r6, 0 movs r3, 0x4 - bl sub_801D904 + bl mevent_srv_sub_init_send add sp, 0x4 pop {r4-r6} pop {r0} @@ -215,7 +215,7 @@ sub_801D5FC: @ 801D5FC push {r4,lr} adds r4, r0, 0 adds r0, 0x24 - bl sub_801D8C0 + bl mevent_srv_sub_recv cmp r0, 0 beq _0801D612 movs r0, 0x4 @@ -234,7 +234,7 @@ sub_801D61C: @ 801D61C push {r4,lr} adds r4, r0, 0 adds r0, 0x24 - bl sub_801D8CC + bl mevent_srv_sub_send cmp r0, 0 beq _0801D632 movs r0, 0x4 @@ -303,7 +303,7 @@ _0801D6C4: adds r0, 0x24 ldr r1, [r2, 0x4] ldr r2, [r4, 0x18] - bl sub_801D928 + bl mevent_srv_sub_init_recv movs r0, 0x2 b _0801D7FE _0801D6D4: @@ -315,7 +315,7 @@ _0801D6D8: ldr r2, [r4, 0x14] movs r1, 0x14 movs r3, 0 - bl sub_801D904 + bl mevent_srv_sub_init_send movs r0, 0x3 b _0801D7FE _0801D6EA: @@ -391,7 +391,7 @@ _0801D764: ldr r2, [r4, 0x14] movs r1, 0x11 movs r3, 0x64 - bl sub_801D904 + bl mevent_srv_sub_init_send b _0801D804 _0801D77C: ldr r2, [r4, 0x4] diff --git a/data/mevent_server.s b/data/mevent_server.s index eaab75c36..bd15692fe 100755 --- a/data/mevent_server.s +++ b/data/mevent_server.s @@ -3,14 +3,6 @@ .section .rodata - .align 2 -gUnknown_082F2548:: @ 82F2548 - .4byte sub_801D1AC - .4byte sub_801D1B4 - .4byte sub_801D1B8 - .4byte sub_801D1D4 - .4byte sub_801D1F0 - .align 2 gUnknown_082F255C:: @ 82F255C .4byte sub_801D5D0 diff --git a/include/mevent_server_helpers.h b/include/mevent_server_helpers.h index d2b4608fb..f682e362d 100644 --- a/include/mevent_server_helpers.h +++ b/include/mevent_server_helpers.h @@ -2,5 +2,9 @@ #define GUARD_MEVENT_SERVER_HELPERS_H void mevent_srv_sub_init(struct mevent_srv_sub *, u32, u32); +void mevent_srv_sub_init_send(struct mevent_srv_sub * manager, u32 ident, const void * src, u32 size); +bool32 mevent_srv_sub_recv(struct mevent_srv_sub * manager); +bool32 mevent_srv_sub_send(struct mevent_srv_sub * manager); +void mevent_srv_sub_init_recv(struct mevent_srv_sub *, u32, void *); #endif //GUARD_MEVENT_SERVER_HELPERS_H diff --git a/ld_script.txt b/ld_script.txt index 31de8d730..8059dadd0 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -61,7 +61,7 @@ SECTIONS { src/mevent2.o(.text); src/mevent_801BAAC.o(.text); src/mevent_server.o(.text); - asm/mevent_server.o(.text); + src/mevent_server_ish.o(.text); asm/mevent_server_ish.o(.text); asm/mevent_server_helpers.o(.text); src/mevent_news.o(.text); @@ -418,6 +418,8 @@ SECTIONS { src/mevent2.o(.rodata); src/mevent_801BAAC.o(.rodata); src/mevent_server.o(.rodata); + src/mevent_server_ish.o(.rodata); + src/mevent_server_helpers.o(.rodata); data/mevent_server.o(.rodata); src/union_room_chat.o(.rodata); data/union_room_chat.o(.rodata); diff --git a/src/mevent_server.c b/src/mevent_server.c index ea5a18626..6a129ee28 100644 --- a/src/mevent_server.c +++ b/src/mevent_server.c @@ -1,15 +1,15 @@ #include "global.h" #include "alloc.h" +#include "script.h" #include "mevent.h" #include "mevent_server.h" #include "mevent_server_helpers.h" EWRAM_DATA struct mevent_srv_common * s_mevent_srv_common_ptr = NULL; -EWRAM_DATA struct mevent_srv_ish * s_mevent_srv_ish_ptr = NULL; static void mevent_srv_init_common(struct mevent_srv_common *, const void *, u32, u32); -u32 mevent_srv_exec_common(struct mevent_srv_common *); -u32 mevent_srv_free_resources(struct mevent_srv_common *); +static void mevent_srv_free_resources(struct mevent_srv_common *); +static u32 mevent_srv_exec_common(struct mevent_srv_common *); extern const struct mevent_cmd s_mevent_wonder_news[]; extern const struct mevent_cmd s_mevent_wonder_card[]; @@ -54,3 +54,232 @@ static void mevent_srv_init_common(struct mevent_srv_common * svr, const void * svr->cmdidx = 0; mevent_srv_sub_init(&svr->manager, sendPlayerNo, recvPlayerNo); } + +static void mevent_srv_free_resources(struct mevent_srv_common * svr) +{ + Free(svr->mevent_32e0); + Free(svr->mevent_3120); + Free(svr->recvBuffer); + Free(svr->mevent_unk1442cc); +} + +void mevent_srv_common_init_send(struct mevent_srv_common * svr, u32 ident, const void * src, u32 size) +{ + AGB_ASSERT(size <= ME_SEND_BUF_SIZE); + mevent_srv_sub_init_send(&svr->manager, ident, src, size); +} + +static void * mevent_first_if_not_null_else_second(void * a0, void * a1) +{ + if (a0 != NULL) + return a0; + else + return a1; +} + +static u32 mevent_compare_pointers(void * a0, void * a1) +{ + if (a1 < a0) + return 0; + else if (a1 == a0) + return 1; + else + return 2; +} + +static u32 common_mainseq_0(struct mevent_srv_common * svr) +{ + // start + svr->mainseqno = 4; + return 0; +} + +static u32 common_mainseq_1(struct mevent_srv_common * svr) +{ + // done + return 3; +} + +static u32 common_mainseq_2(struct mevent_srv_common * svr) +{ + // do recv + if (mevent_srv_sub_recv(&svr->manager)) + svr->mainseqno = 4; + return 1; +} + +static u32 common_mainseq_3(struct mevent_srv_common * svr) +{ + // do send + if (mevent_srv_sub_send(&svr->manager)) + svr->mainseqno = 4; + return 1; +} + +static u32 common_mainseq_4(struct mevent_srv_common * svr) +{ + // process command + const struct mevent_cmd * cmd = &svr->cmdBuffer[svr->cmdidx]; + void * ptr; + svr->cmdidx++; + + switch (cmd->instr) + { + case 0: + AGB_ASSERT(cmd->parameter == NULL); + svr->mainseqno = 1; + svr->param = cmd->flag; + break; + case 1: + svr->mainseqno = 3; + break; + case 2: + AGB_ASSERT(cmd->parameter == NULL); + mevent_srv_sub_init_recv(&svr->manager, cmd->flag, svr->recvBuffer); + svr->mainseqno = 2; + break; + case 3: + AGB_ASSERT(cmd->flag == FALSE); + svr->cmdidx = 0; + svr->cmdBuffer = cmd->parameter; + break; + case 5: + AGB_ASSERT(cmd->flag == FALSE); + AGB_ASSERT(cmd->parameter == NULL); + memcpy(svr->mevent_unk1442cc, svr->recvBuffer, sizeof(struct MEventStruct_Unk1442CC)); + break; + case 6: + AGB_ASSERT(cmd->flag == FALSE); + AGB_ASSERT(cmd->parameter == NULL); + svr->param = sub_801B6A0(svr->mevent_unk1442cc, FALSE); + break; + case 30: + AGB_ASSERT(cmd->flag == FALSE); + AGB_ASSERT(cmd->parameter == NULL); + svr->param = sub_801B6A0(svr->mevent_unk1442cc, TRUE); + break; + case 4: + if (svr->param == cmd->flag) + { + svr->cmdidx = 0; + svr->cmdBuffer = cmd->parameter; + } + break; + case 7: + AGB_ASSERT(cmd->flag == FALSE); + ptr = mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_32e0); + svr->param = sub_801B6EC(ptr, svr->mevent_unk1442cc, ptr); + break; + case 8: + AGB_ASSERT(cmd->flag == FALSE); + AGB_ASSERT(cmd->parameter == NULL); + svr->param = *(u32 *)svr->recvBuffer; + break; + case 9: + AGB_ASSERT(cmd->flag == FALSE); + ptr = mevent_first_if_not_null_else_second(cmd->parameter, &svr->sendWord); + svr->param = sub_801B708(ptr, svr->mevent_unk1442cc, ptr); + break; + case 10: + AGB_ASSERT(cmd->parameter == NULL); + svr->param = sub_801B784(svr->mevent_unk1442cc, cmd->flag); + break; + case 11: + AGB_ASSERT(cmd->flag == FALSE); + svr->param = sub_801B748(svr->mevent_unk1442cc, cmd->parameter); + break; + case 12: + AGB_ASSERT(cmd->flag == FALSE); + svr->param = mevent_compare_pointers(cmd->parameter, *(void **)svr->recvBuffer); + break; + case 14: + AGB_ASSERT(cmd->flag == FALSE); + mevent_srv_common_init_send(svr, 0x17, mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_3120), sizeof(struct MEventBuffer_3120_Sub)); + break; + case 13: + AGB_ASSERT(cmd->flag == FALSE); + mevent_srv_common_init_send(svr, 0x16, mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_32e0), sizeof(struct MEventBuffer_32E0_Sub)); + break; + case 16: + AGB_ASSERT(cmd->flag == FALSE); + mevent_srv_common_init_send(svr, 0x18, mevent_first_if_not_null_else_second(cmd->parameter, &svr->sendWord), 4); + break; + case 15: + if (cmd->parameter == NULL) + mevent_srv_common_init_send(svr, 0x19, svr->sendBuffer1, svr->sendBuffer1Size); + else + mevent_srv_common_init_send(svr, 0x19, cmd->parameter, cmd->flag); + break; + case 18: + if (cmd->parameter == NULL) + mevent_srv_common_init_send(svr, 0x10, svr->sendBuffer2, svr->sendBuffer2Size); + else + mevent_srv_common_init_send(svr, 0x10, cmd->parameter, cmd->flag); + break; + case 19: + AGB_ASSERT(cmd->flag == FALSE); + mevent_srv_common_init_send(svr, 0x1a, cmd->parameter, 188); + break; + case 20: + mevent_srv_common_init_send(svr, 0x15, cmd->parameter, cmd->flag); + break; + case 17: + mevent_srv_common_init_send(svr, 0x1c, cmd->parameter, cmd->flag); + break; + case 22: + AGB_ASSERT(cmd->flag == FALSE); + memcpy(svr->mevent_32e0, cmd->parameter, 332); + break; + case 23: + AGB_ASSERT(cmd->flag == FALSE); + memcpy(svr->mevent_3120, cmd->parameter, 444); + break; + case 21: + AGB_ASSERT(cmd->flag == FALSE); + svr->sendWord = *(u32 *)cmd->parameter; + break; + case 24: + svr->sendBuffer1 = cmd->parameter; + svr->sendBuffer1Size = cmd->flag; + break; + case 25: + svr->sendBuffer2 = cmd->parameter; + svr->sendBuffer2Size = cmd->flag; + break; + case 26: + AGB_ASSERT(cmd->flag == FALSE && cmd->parameter == NULL); + memcpy(svr->mevent_32e0, sav1_get_mevent_buffer_1(), 332); + sub_801B3C0(svr->mevent_32e0); + break; + case 27: + AGB_ASSERT(cmd->flag == FALSE && cmd->parameter == NULL); + memcpy(svr->mevent_3120, sav1_get_mevent_buffer_0(), 444); + break; + case 28: + AGB_ASSERT(cmd->flag == FALSE && cmd->parameter == NULL); + svr->sendBuffer1 = sub_8099244(); + break; + case 29: + mevent_srv_common_init_send(svr, 0x1b, cmd->parameter, cmd->flag); + break; + } + + return 1; +} + +static u32 (*const func_tbl[])(struct mevent_srv_common *) = { + common_mainseq_0, + common_mainseq_1, + common_mainseq_2, + common_mainseq_3, + common_mainseq_4 +}; + +static u32 mevent_srv_exec_common(struct mevent_srv_common * svr) +{ + u32 response; + AGB_ASSERT(svr->mainseqno < NELEMS(func_tbl)); + response = func_tbl[svr->mainseqno](svr); + AGB_ASSERT(svr->mainseqno < NELEMS(func_tbl)); + return response; +} diff --git a/src/mevent_server_helpers.c b/src/mevent_server_helpers.c new file mode 100644 index 000000000..dc4f98a6e --- /dev/null +++ b/src/mevent_server_helpers.c @@ -0,0 +1 @@ +#include "global.h" diff --git a/src/mevent_server_ish.c b/src/mevent_server_ish.c new file mode 100644 index 000000000..30793cf5c --- /dev/null +++ b/src/mevent_server_ish.c @@ -0,0 +1,7 @@ +#include "global.h" +#include "alloc.h" +#include "mevent.h" +#include "mevent_server.h" +#include "mevent_server_helpers.h" + +EWRAM_DATA struct mevent_srv_ish * s_mevent_srv_ish_ptr = NULL; diff --git a/sym_ewram.txt b/sym_ewram.txt index 22afe8226..06e3180a0 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -13,6 +13,7 @@ .include "src/mevent2.o" .include "src/mevent_801BAAC.o" .include "src/mevent_server.o" + .include "src/mevent_server_ish.o" @ union_room_chat .align 2 From 03badd9c40de5d50562376d39348fb5c85f8340b Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 11:43:29 -0400 Subject: [PATCH 069/101] mevent_server_ish --- asm/mevent_server_ish.s | 567 -------------------------------- data/mevent_server.s | 11 - include/mevent_server.h | 48 +-- include/mevent_server_helpers.h | 28 ++ include/mevent_server_ish.h | 23 ++ ld_script.txt | 1 - src/mevent_server_ish.c | 290 +++++++++++++++- 7 files changed, 340 insertions(+), 628 deletions(-) delete mode 100755 asm/mevent_server_ish.s diff --git a/asm/mevent_server_ish.s b/asm/mevent_server_ish.s deleted file mode 100755 index fe4c9cd46..000000000 --- a/asm/mevent_server_ish.s +++ /dev/null @@ -1,567 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start mevent_srv_ish_do_init -mevent_srv_ish_do_init: @ 801D484 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r4, =s_mevent_srv_ish_ptr - movs r0, 0x50 - bl AllocZeroed - str r0, [r4] - movs r1, 0x1 - movs r2, 0 - bl mevent_srv_ish_init - ldr r0, [r4] - str r5, [r0, 0x4C] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end mevent_srv_ish_do_init - - thumb_func_start mevent_srv_ish_do_exec -mevent_srv_ish_do_exec: @ 801D4A8 - push {r4-r6,lr} - adds r6, r0, 0 - ldr r4, =s_mevent_srv_ish_ptr - ldr r0, [r4] - cmp r0, 0 - bne _0801D4BC - movs r0, 0x6 - b _0801D4DC - .pool -_0801D4BC: - bl mevent_srv_ish_exec - adds r5, r0, 0 - cmp r5, 0x6 - bne _0801D4DA - ldr r0, [r4] - ldr r1, [r0, 0x4] - strh r1, [r6] - bl mevent_srv_ish_free_resources - ldr r0, [r4] - bl Free - movs r0, 0 - str r0, [r4] -_0801D4DA: - adds r0, r5, 0 -_0801D4DC: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end mevent_srv_ish_do_exec - - thumb_func_start mevent_srv_ish_inc_flag -mevent_srv_ish_inc_flag: @ 801D4E4 - ldr r0, =s_mevent_srv_ish_ptr - ldr r1, [r0] - ldr r0, [r1, 0xC] - adds r0, 0x1 - str r0, [r1, 0xC] - bx lr - .pool - thumb_func_end mevent_srv_ish_inc_flag - - thumb_func_start mevent_srv_ish_get_buffer -mevent_srv_ish_get_buffer: @ 801D4F4 - ldr r0, =s_mevent_srv_ish_ptr - ldr r0, [r0] - ldr r0, [r0, 0x20] - bx lr - .pool - thumb_func_end mevent_srv_ish_get_buffer - - thumb_func_start mevent_srv_ish_set_param -mevent_srv_ish_set_param: @ 801D500 - ldr r1, =s_mevent_srv_ish_ptr - ldr r1, [r1] - str r0, [r1, 0x4] - bx lr - .pool - thumb_func_end mevent_srv_ish_set_param - - thumb_func_start mevent_srv_ish_init -mevent_srv_ish_init: @ 801D50C - push {r4-r6,lr} - mov r6, r8 - push {r6} - adds r4, r0, 0 - adds r6, r1, 0 - mov r8, r2 - movs r0, 0 - str r0, [r4] - str r0, [r4, 0x8] - str r0, [r4, 0xC] - movs r5, 0x80 - lsls r5, 3 - adds r0, r5, 0 - bl AllocZeroed - str r0, [r4, 0x14] - adds r0, r5, 0 - bl AllocZeroed - str r0, [r4, 0x18] - adds r0, r5, 0 - bl AllocZeroed - str r0, [r4, 0x1C] - movs r0, 0x40 - bl AllocZeroed - str r0, [r4, 0x20] - adds r4, 0x24 - adds r0, r4, 0 - adds r1, r6, 0 - mov r2, r8 - bl mevent_srv_sub_init - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end mevent_srv_ish_init - - thumb_func_start mevent_srv_ish_free_resources -mevent_srv_ish_free_resources: @ 801D55C - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0x14] - bl Free - ldr r0, [r4, 0x18] - bl Free - ldr r0, [r4, 0x1C] - bl Free - ldr r0, [r4, 0x20] - bl Free - pop {r4} - pop {r0} - bx r0 - thumb_func_end mevent_srv_ish_free_resources - - thumb_func_start mevent_srv_ish_jmp_buffer -mevent_srv_ish_jmp_buffer: @ 801D580 - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0x1C] - ldr r1, [r4, 0x18] - movs r2, 0x80 - lsls r2, 3 - bl memcpy - movs r0, 0 - str r0, [r4, 0x10] - pop {r4} - pop {r0} - bx r0 - thumb_func_end mevent_srv_ish_jmp_buffer - - thumb_func_start sub_801D59C -sub_801D59C: @ 801D59C - push {r4-r6,lr} - sub sp, 0x4 - adds r4, r0, 0 - adds r6, r1, 0 - adds r5, r2, 0 - movs r0, 0 - str r0, [sp] - ldr r1, [r4, 0x14] - ldr r2, =0x05000100 - mov r0, sp - bl CpuSet - ldr r2, [r4, 0x14] - str r5, [r2] - adds r4, 0x24 - adds r0, r4, 0 - adds r1, r6, 0 - movs r3, 0x4 - bl mevent_srv_sub_init_send - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_801D59C - - thumb_func_start sub_801D5D0 -sub_801D5D0: @ 801D5D0 - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0x1C] - ldr r1, =gUnknown_082F2598 - movs r2, 0x80 - lsls r2, 3 - bl memcpy - movs r1, 0 - str r1, [r4, 0x10] - movs r0, 0x4 - str r0, [r4, 0x8] - str r1, [r4, 0xC] - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801D5D0 - - thumb_func_start sub_801D5F8 -sub_801D5F8: @ 801D5F8 - movs r0, 0x6 - bx lr - thumb_func_end sub_801D5F8 - - thumb_func_start sub_801D5FC -sub_801D5FC: @ 801D5FC - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x24 - bl mevent_srv_sub_recv - cmp r0, 0 - beq _0801D612 - movs r0, 0x4 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] -_0801D612: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D5FC - - thumb_func_start sub_801D61C -sub_801D61C: @ 801D61C - push {r4,lr} - adds r4, r0, 0 - adds r0, 0x24 - bl mevent_srv_sub_send - cmp r0, 0 - beq _0801D632 - movs r0, 0x4 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] -_0801D632: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D61C - - thumb_func_start sub_801D63C -sub_801D63C: @ 801D63C - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0x10] - lsls r2, r0, 3 - ldr r1, [r4, 0x1C] - adds r2, r1, r2 - adds r0, 0x1 - str r0, [r4, 0x10] - ldr r0, [r2] - cmp r0, 0x15 - bls _0801D654 - b _0801D804 -_0801D654: - lsls r0, 2 - ldr r1, =_0801D664 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0801D664: - .4byte _0801D804 - .4byte _0801D6BC - .4byte _0801D6C4 - .4byte _0801D6D4 - .4byte _0801D70E - .4byte _0801D716 - .4byte _0801D6FE - .4byte _0801D708 - .4byte _0801D764 - .4byte _0801D790 - .4byte _0801D788 - .4byte _0801D72C - .4byte _0801D742 - .4byte _0801D758 - .4byte _0801D77C - .4byte _0801D7B8 - .4byte _0801D7BC - .4byte _0801D7C4 - .4byte _0801D7D0 - .4byte _0801D6EA - .4byte _0801D6D8 - .4byte _0801D7F0 -_0801D6BC: - ldr r0, [r2, 0x4] - str r0, [r4, 0x4] - movs r0, 0x1 - b _0801D7FE -_0801D6C4: - adds r0, r4, 0 - adds r0, 0x24 - ldr r1, [r2, 0x4] - ldr r2, [r4, 0x18] - bl mevent_srv_sub_init_recv - movs r0, 0x2 - b _0801D7FE -_0801D6D4: - movs r0, 0x3 - b _0801D7FE -_0801D6D8: - adds r0, r4, 0 - adds r0, 0x24 - ldr r2, [r4, 0x14] - movs r1, 0x14 - movs r3, 0 - bl mevent_srv_sub_init_send - movs r0, 0x3 - b _0801D7FE -_0801D6EA: - ldrb r0, [r2, 0x4] - bl GetGameStat - adds r2, r0, 0 - adds r0, r4, 0 - movs r1, 0x12 - bl sub_801D59C - movs r0, 0x3 - b _0801D7FE -_0801D6FE: - ldr r0, [r4, 0x4] - cmp r0, 0 - beq _0801D706 - b _0801D804 -_0801D706: - b _0801D70E -_0801D708: - ldr r0, [r4, 0x4] - cmp r0, 0x1 - bne _0801D804 -_0801D70E: - adds r0, r4, 0 - bl mevent_srv_ish_jmp_buffer - b _0801D804 -_0801D716: - ldr r0, [r4, 0x20] - ldr r1, [r4, 0x18] - movs r2, 0x40 - bl memcpy - movs r0, 0x5 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] - movs r0, 0x2 - b _0801D806 -_0801D72C: - ldr r0, [r4, 0x20] - ldr r1, [r4, 0x18] - movs r2, 0x40 - bl memcpy - movs r0, 0x5 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] - movs r0, 0x3 - b _0801D806 -_0801D742: - ldr r0, [r4, 0x20] - ldr r1, [r4, 0x18] - movs r2, 0x40 - bl memcpy - movs r0, 0x5 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] - movs r0, 0x5 - b _0801D806 -_0801D758: - movs r0, 0x5 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] - movs r0, 0x4 - b _0801D806 -_0801D764: - ldr r0, [r4, 0x14] - ldr r1, [r4, 0x4C] - bl sub_801B580 - adds r0, r4, 0 - adds r0, 0x24 - ldr r2, [r4, 0x14] - movs r1, 0x11 - movs r3, 0x64 - bl mevent_srv_sub_init_send - b _0801D804 -_0801D77C: - ldr r2, [r4, 0x4] - adds r0, r4, 0 - movs r1, 0x13 - bl sub_801D59C - b _0801D804 -_0801D788: - ldr r0, [r4, 0x18] - bl sub_801B21C - b _0801D804 -_0801D790: - ldr r0, [r4, 0x18] - bl sub_801B1A4 - cmp r0, 0 - bne _0801D7AC - ldr r0, [r4, 0x18] - bl sub_801B078 - adds r0, r4, 0 - movs r1, 0x13 - movs r2, 0 - bl sub_801D59C - b _0801D804 -_0801D7AC: - adds r0, r4, 0 - movs r1, 0x13 - movs r2, 0x1 - bl sub_801D59C - b _0801D804 -_0801D7B8: - movs r0, 0x6 - b _0801D7FE -_0801D7BC: - ldr r0, [r4, 0x18] - bl sub_801B508 - b _0801D804 -_0801D7C4: - ldr r0, [r4, 0x18] - movs r1, 0xFA - lsls r1, 2 - bl sub_80992A0 - b _0801D804 -_0801D7D0: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r1, =0x00000bec - adds r0, r1 - ldr r1, [r4, 0x18] - movs r2, 0xBC - bl memcpy - bl ValidateEReaderTrainer - b _0801D804 - .pool -_0801D7F0: - ldr r0, =gDecompressionBuffer - ldr r1, [r4, 0x18] - movs r2, 0x80 - lsls r2, 3 - bl memcpy - movs r0, 0x7 -_0801D7FE: - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] -_0801D804: - movs r0, 0x1 -_0801D806: - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801D63C - - thumb_func_start sub_801D810 -sub_801D810: @ 801D810 - push {lr} - adds r1, r0, 0 - ldr r0, [r1, 0xC] - cmp r0, 0 - beq _0801D822 - movs r0, 0x4 - str r0, [r1, 0x8] - movs r0, 0 - str r0, [r1, 0xC] -_0801D822: - movs r0, 0x1 - pop {r1} - bx r1 - thumb_func_end sub_801D810 - - thumb_func_start sub_801D828 -sub_801D828: @ 801D828 - push {r4,lr} - adds r4, r0, 0 - ldr r0, [r4, 0xC] - cmp r0, 0 - beq _0801D838 - cmp r0, 0x1 - beq _0801D846 - b _0801D858 -_0801D838: - ldr r0, [r4, 0x18] - bl sub_8153870 - ldr r0, [r4, 0xC] - adds r0, 0x1 - str r0, [r4, 0xC] - b _0801D858 -_0801D846: - adds r0, r4, 0x4 - bl sub_8153884 - adds r1, r0, 0 - cmp r1, 0 - bne _0801D858 - movs r0, 0x4 - str r0, [r4, 0x8] - str r1, [r4, 0xC] -_0801D858: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D828 - - thumb_func_start sub_801D860 -sub_801D860: @ 801D860 - push {r4,lr} - adds r4, r0, 0 - ldr r3, =gDecompressionBuffer - adds r0, r4, 0x4 - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - ldr r2, =gSaveBlock1Ptr - ldr r2, [r2] - bl _call_via_r3 - cmp r0, 0x1 - bne _0801D880 - movs r0, 0x4 - str r0, [r4, 0x8] - movs r0, 0 - str r0, [r4, 0xC] -_0801D880: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_801D860 - - thumb_func_start mevent_srv_ish_exec -mevent_srv_ish_exec: @ 801D894 - push {r4,r5,lr} - sub sp, 0x20 - mov r2, sp - ldr r1, =gUnknown_082F255C - ldm r1!, {r3-r5} - stm r2!, {r3-r5} - ldm r1!, {r3-r5} - stm r2!, {r3-r5} - ldm r1!, {r3,r4} - stm r2!, {r3,r4} - ldr r1, [r0, 0x8] - lsls r1, 2 - add r1, sp - ldr r1, [r1] - bl _call_via_r1 - add sp, 0x20 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end mevent_srv_ish_exec - - .align 2, 0 @ don't pad with nop diff --git a/data/mevent_server.s b/data/mevent_server.s index bd15692fe..b6d8b4e25 100755 --- a/data/mevent_server.s +++ b/data/mevent_server.s @@ -3,17 +3,6 @@ .section .rodata - .align 2 -gUnknown_082F255C:: @ 82F255C - .4byte sub_801D5D0 - .4byte sub_801D5F8 - .4byte sub_801D5FC - .4byte sub_801D61C - .4byte sub_801D63C - .4byte sub_801D810 - .4byte sub_801D828 - .4byte sub_801D860 - .align 2 gText_CanceledReadingCard:: @ 82F257C .string "Canceled reading\nthe Card.$" diff --git a/include/mevent_server.h b/include/mevent_server.h index 772aae6b1..ed9812d8a 100644 --- a/include/mevent_server.h +++ b/include/mevent_server.h @@ -1,53 +1,7 @@ #ifndef GUARD_MEVENT_SERVER_H #define GUARD_MEVENT_SERVER_H -#define ME_SEND_BUF_SIZE 0x400 - -struct mevent_srv_sub -{ - s32 seqno; - u8 sendPlayerNo; - u8 recvPlayerNo; - u16 recvIdent; - u16 recvCounter; - u16 recvCRC; - u16 recvSize; - u16 sendIdent; - u16 sendCounter; - u16 sendCRC; - u16 sendSize; - void * recvBfr; - const void * sendBfr; - u32 (*recvFunc)(struct mevent_srv_sub *); - u32 (*sendFunc)(struct mevent_srv_sub *); -}; - -struct send_recv_header -{ - u16 ident; - u16 crc; - u16 size; -}; - -struct mevent_cmd_ish -{ - u32 instr; - u32 parameter; -}; - -struct mevent_srv_ish -{ - u32 unk_00; - u32 param; - u32 mainseqno; - u32 flag; - u32 cmdidx; - void * sendBuffer; - void * recvBuffer; - struct mevent_cmd_ish * cmdBuffer; - void * buffer; - struct mevent_srv_sub manager; -}; +#include "mevent_server_helpers.h" struct mevent_cmd { diff --git a/include/mevent_server_helpers.h b/include/mevent_server_helpers.h index f682e362d..e4e409862 100644 --- a/include/mevent_server_helpers.h +++ b/include/mevent_server_helpers.h @@ -1,6 +1,34 @@ #ifndef GUARD_MEVENT_SERVER_HELPERS_H #define GUARD_MEVENT_SERVER_HELPERS_H +#define ME_SEND_BUF_SIZE 0x400 + +struct mevent_srv_sub +{ + s32 seqno; + u8 sendPlayerNo; + u8 recvPlayerNo; + u16 recvIdent; + u16 recvCounter; + u16 recvCRC; + u16 recvSize; + u16 sendIdent; + u16 sendCounter; + u16 sendCRC; + u16 sendSize; + void * recvBfr; + const void * sendBfr; + u32 (*recvFunc)(struct mevent_srv_sub *); + u32 (*sendFunc)(struct mevent_srv_sub *); +}; + +struct send_recv_header +{ + u16 ident; + u16 crc; + u16 size; +}; + void mevent_srv_sub_init(struct mevent_srv_sub *, u32, u32); void mevent_srv_sub_init_send(struct mevent_srv_sub * manager, u32 ident, const void * src, u32 size); bool32 mevent_srv_sub_recv(struct mevent_srv_sub * manager); diff --git a/include/mevent_server_ish.h b/include/mevent_server_ish.h index 31f98ed52..35833ea12 100644 --- a/include/mevent_server_ish.h +++ b/include/mevent_server_ish.h @@ -1,6 +1,29 @@ #ifndef GUARD_MEVENT_SERVER_ISH_H #define GUARD_MEVENT_SERVER_ISH_H +#include "mevent_server_helpers.h" + +struct mevent_cmd_ish +{ + u32 instr; + u32 parameter; +}; + +struct mevent_srv_ish +{ + u32 unk_00; + u32 param; + u32 mainseqno; + u32 flag; + u32 cmdidx; + void * sendBuffer; + void * recvBuffer; + struct mevent_cmd_ish * cmdBuffer; + void * buffer; + struct mevent_srv_sub manager; + u32 unk_4C; +}; + void mevent_srv_ish_do_init(u32 arg); u32 mevent_srv_ish_do_exec(u16 * a0); void mevent_srv_ish_inc_flag(void); diff --git a/ld_script.txt b/ld_script.txt index 8059dadd0..0a7838883 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -62,7 +62,6 @@ SECTIONS { src/mevent_801BAAC.o(.text); src/mevent_server.o(.text); src/mevent_server_ish.o(.text); - asm/mevent_server_ish.o(.text); asm/mevent_server_helpers.o(.text); src/mevent_news.o(.text); src/union_room_chat.o(.text); diff --git a/src/mevent_server_ish.c b/src/mevent_server_ish.c index 30793cf5c..2b310c981 100644 --- a/src/mevent_server_ish.c +++ b/src/mevent_server_ish.c @@ -1,7 +1,293 @@ #include "global.h" #include "alloc.h" +#include "decompress.h" +#include "overworld.h" +#include "script.h" +#include "battle_tower.h" #include "mevent.h" -#include "mevent_server.h" -#include "mevent_server_helpers.h" +#include "mystery_event_script.h" +#include "mevent_server_ish.h" EWRAM_DATA struct mevent_srv_ish * s_mevent_srv_ish_ptr = NULL; + +static void mevent_srv_ish_init(struct mevent_srv_ish *, u32, u32); +static u32 mevent_srv_ish_exec(struct mevent_srv_ish *); +static void mevent_srv_ish_free_resources(struct mevent_srv_ish *); + +extern const u8 gUnknown_082F2598[]; +extern const struct mevent_cmd gUnknown_8468B6C[]; +extern const struct mevent_cmd gUnknown_8468BCC[]; + +void mevent_srv_ish_do_init(u32 arg) +{ + s_mevent_srv_ish_ptr = AllocZeroed(sizeof(struct mevent_srv_ish)); + mevent_srv_ish_init(s_mevent_srv_ish_ptr, 1, 0); + s_mevent_srv_ish_ptr->unk_4C = arg; +} + +u32 mevent_srv_ish_do_exec(u16 * a0) +{ + u32 result; + if (s_mevent_srv_ish_ptr == NULL) + return 6; + result = mevent_srv_ish_exec(s_mevent_srv_ish_ptr); + if (result == 6) + { + *a0 = s_mevent_srv_ish_ptr->param; + mevent_srv_ish_free_resources(s_mevent_srv_ish_ptr); + Free(s_mevent_srv_ish_ptr); + s_mevent_srv_ish_ptr = NULL; + } + return result; +} + +void mevent_srv_ish_inc_flag(void) +{ + s_mevent_srv_ish_ptr->flag++; +} + +void * mevent_srv_ish_get_buffer(void) +{ + return s_mevent_srv_ish_ptr->buffer; +} + +void mevent_srv_ish_set_param(u32 a0) +{ + s_mevent_srv_ish_ptr->param = a0; +} + +static void mevent_srv_ish_init(struct mevent_srv_ish * svr, u32 sendPlayerNo, u32 recvPlayerNo) +{ + svr->unk_00 = 0; + svr->mainseqno = 0; + svr->flag = 0; + svr->sendBuffer = AllocZeroed(ME_SEND_BUF_SIZE); + svr->recvBuffer = AllocZeroed(ME_SEND_BUF_SIZE); + svr->cmdBuffer = AllocZeroed(ME_SEND_BUF_SIZE); + svr->buffer = AllocZeroed(0x40); + mevent_srv_sub_init(&svr->manager, sendPlayerNo, recvPlayerNo); +} + +static void mevent_srv_ish_free_resources(struct mevent_srv_ish * svr) +{ + Free(svr->sendBuffer); + Free(svr->recvBuffer); + Free(svr->cmdBuffer); + Free(svr->buffer); +} + +static void mevent_srv_ish_jmp_buffer(struct mevent_srv_ish * svr) +{ + memcpy(svr->cmdBuffer, svr->recvBuffer, ME_SEND_BUF_SIZE); + svr->cmdidx = 0; +} + +static void mevent_srv_ish_send_word(struct mevent_srv_ish * svr, u32 ident, u32 word) +{ + CpuFill32(0, svr->sendBuffer, ME_SEND_BUF_SIZE); + *(u32 *)svr->sendBuffer = word; + mevent_srv_sub_init_send(&svr->manager, ident, svr->sendBuffer, sizeof(u32)); +} + +static u32 ish_mainseq_0(struct mevent_srv_ish * svr) +{ + // init + memcpy(svr->cmdBuffer, gUnknown_082F2598, ME_SEND_BUF_SIZE); + svr->cmdidx = 0; + svr->mainseqno = 4; + svr->flag = 0; + return 0; +} + +static u32 ish_mainseq_1(struct mevent_srv_ish * svr) +{ + // done + return 6; +} + + +static u32 ish_mainseq_2(struct mevent_srv_ish * svr) +{ + // do recv + if (mevent_srv_sub_recv(&svr->manager)) + { + svr->mainseqno = 4; + svr->flag = 0; + } + return 1; +} + +static u32 ish_mainseq_3(struct mevent_srv_ish * svr) +{ + // do send + if (mevent_srv_sub_send(&svr->manager)) + { + svr->mainseqno = 4; + svr->flag = 0; + } + return 1; +} + +static u32 ish_mainseq_4(struct mevent_srv_ish * svr) +{ + // process command + struct mevent_cmd_ish * cmd = &svr->cmdBuffer[svr->cmdidx]; + ++svr->cmdidx; + switch (cmd->instr) + { + case 0: + break; + case 1: + svr->param = cmd->parameter; + svr->mainseqno = 1; + svr->flag = 0; + break; + case 2: + mevent_srv_sub_init_recv(&svr->manager, cmd->parameter, svr->recvBuffer); + svr->mainseqno = 2; + svr->flag = 0; + break; + case 3: + svr->mainseqno = 3; + svr->flag = 0; + break; + case 20: + mevent_srv_sub_init_send(&svr->manager, 0x14, svr->sendBuffer, 0); + svr->mainseqno = 3; + svr->flag = 0; + break; + case 19: + mevent_srv_ish_send_word(svr, 0x12, GetGameStat(cmd->parameter)); + svr->mainseqno = 3; + svr->flag = 0; + break; + case 6: + if (svr->param == 0) + mevent_srv_ish_jmp_buffer(svr); + break; + case 7: + if (svr->param == 1) + mevent_srv_ish_jmp_buffer(svr); + break; + case 4: + mevent_srv_ish_jmp_buffer(svr); + break; + case 5: + memcpy(svr->buffer, svr->recvBuffer, 0x40); + svr->mainseqno = 5; + svr->flag = 0; + return 2; + case 11: + memcpy(svr->buffer, svr->recvBuffer, 0x40); + svr->mainseqno = 5; + svr->flag = 0; + return 3; + case 12: + memcpy(svr->buffer, svr->recvBuffer, 0x40); + svr->mainseqno = 5; + svr->flag = 0; + return 5; + case 13: + svr->mainseqno = 5; + svr->flag = 0; + return 4; + case 8: + sub_801B580(svr->sendBuffer, svr->unk_4C); + mevent_srv_sub_init_send(&svr->manager, 0x11, svr->sendBuffer, sizeof(struct MEventStruct_Unk1442CC)); + break; + case 14: + mevent_srv_ish_send_word(svr, 0x13, svr->param); + break; + case 10: + sub_801B21C(svr->recvBuffer); + break; + case 9: + if (!sub_801B1A4(svr->recvBuffer)) + { + sub_801B078(svr->recvBuffer); + mevent_srv_ish_send_word(svr, 0x13, 0); + } + else + mevent_srv_ish_send_word(svr, 0x13, 1); + break; + case 15: + svr->mainseqno = 6; + svr->flag = 0; + break; + case 16: + sub_801B508(svr->recvBuffer); + break; + case 17: + sub_80992A0(svr->recvBuffer, 1000); + break; + case 18: + memcpy(&gSaveBlock2Ptr->frontier.ereaderTrainer, svr->recvBuffer, 0xbc); + ValidateEReaderTrainer(); + break; + case 21: + memcpy(gDecompressionBuffer, svr->recvBuffer, ME_SEND_BUF_SIZE); + svr->mainseqno = 7; + svr->flag = 0; + break; + } + + return 1; +} + +static u32 ish_mainseq_5(struct mevent_srv_ish * svr) +{ + // wait flag + if (svr->flag) + { + svr->mainseqno = 4; + svr->flag = 0; + } + return 1; +} + +static u32 ish_mainseq_6(struct mevent_srv_ish * svr) +{ + // ??? + switch (svr->flag) + { + case 0: + sub_8153870(svr->recvBuffer); + ++svr->flag; + break; + case 1: + if (!sub_8153884(&svr->param)) + { + svr->mainseqno = 4; + svr->flag = 0; + } + break; + } + return 1; +} + +static u32 ish_mainseq_7(struct mevent_srv_ish * svr) +{ + // exec arbitrary code + u32 (*func)(u32 *, struct SaveBlock2 *, struct SaveBlock1 *) = (void *)gDecompressionBuffer; + if (func(&svr->param, gSaveBlock2Ptr, gSaveBlock1Ptr) == 1) + { + svr->mainseqno = 4; + svr->flag = 0; + } + return 1; +} + +static u32 mevent_srv_ish_exec(struct mevent_srv_ish * svr) +{ + u32 (*funcs[])(struct mevent_srv_ish *) = { + ish_mainseq_0, + ish_mainseq_1, + ish_mainseq_2, + ish_mainseq_3, + ish_mainseq_4, + ish_mainseq_5, + ish_mainseq_6, + ish_mainseq_7 + }; + return funcs[svr->mainseqno](svr); +} From 6c12d154e7a6a0bc60c988497b3daa4f8126a5b2 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 12:22:39 -0400 Subject: [PATCH 070/101] Reformat mevent server and client scripts --- asm/mevent_server_helpers.s | 373 ------------------------------------ data/mevent_server.s | 318 ++++++++++++------------------ include/util.h | 4 +- ld_script.txt | 2 +- src/mevent_server_helpers.c | 210 ++++++++++++++++++++ src/mevent_server_ish.c | 4 +- src/util.c | 4 +- 7 files changed, 335 insertions(+), 580 deletions(-) delete mode 100755 asm/mevent_server_helpers.s diff --git a/asm/mevent_server_helpers.s b/asm/mevent_server_helpers.s deleted file mode 100755 index 9bb70ff63..000000000 --- a/asm/mevent_server_helpers.s +++ /dev/null @@ -1,373 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start mevent_srv_sub_recv -mevent_srv_sub_recv: @ 801D8C0 - push {lr} - ldr r1, [r0, 0x20] - bl _call_via_r1 - pop {r1} - bx r1 - thumb_func_end mevent_srv_sub_recv - - thumb_func_start mevent_srv_sub_send -mevent_srv_sub_send: @ 801D8CC - push {lr} - ldr r1, [r0, 0x24] - bl _call_via_r1 - pop {r1} - bx r1 - thumb_func_end mevent_srv_sub_send - - thumb_func_start mevent_srv_sub_init -mevent_srv_sub_init: @ 801D8D8 - movs r3, 0 - strb r1, [r0, 0x4] - strb r2, [r0, 0x5] - str r3, [r0] - strh r3, [r0, 0x12] - strh r3, [r0, 0x14] - strh r3, [r0, 0x10] - strh r3, [r0, 0xA] - strh r3, [r0, 0xC] - strh r3, [r0, 0x8] - str r3, [r0, 0x1C] - str r3, [r0, 0x18] - ldr r1, =sub_801DA5C - str r1, [r0, 0x24] - ldr r1, =sub_801D988 - str r1, [r0, 0x20] - bx lr - .pool - thumb_func_end mevent_srv_sub_init - - thumb_func_start mevent_srv_sub_init_send -mevent_srv_sub_init_send: @ 801D904 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0 - str r0, [r4] - strh r1, [r4, 0xE] - strh r0, [r4, 0x10] - strh r0, [r4, 0x12] - cmp r3, 0 - beq _0801D91A - strh r3, [r4, 0x14] - b _0801D920 -_0801D91A: - movs r0, 0x80 - lsls r0, 3 - strh r0, [r4, 0x14] -_0801D920: - str r2, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - thumb_func_end mevent_srv_sub_init_send - - thumb_func_start mevent_srv_sub_init_recv -mevent_srv_sub_init_recv: @ 801D928 - movs r3, 0 - str r3, [r0] - strh r1, [r0, 0x6] - strh r3, [r0, 0x8] - strh r3, [r0, 0xA] - strh r3, [r0, 0xC] - str r2, [r0, 0x18] - bx lr - thumb_func_end mevent_srv_sub_init_recv - - thumb_func_start sub_801D938 -sub_801D938: @ 801D938 - push {lr} - adds r3, r0, 0 - adds r0, r1, 0 - lsls r3, 8 - ldr r1, =gBlockRecvBuffer - adds r3, r1 - adds r1, r3, 0 - bl memcpy - pop {r0} - bx r0 - .pool - thumb_func_end sub_801D938 - - thumb_func_start sub_801D954 -sub_801D954: @ 801D954 - push {r4,lr} - adds r4, r0, 0 - bl GetBlockReceivedStatus - lsls r0, 24 - lsrs r0, 24 - asrs r0, r4 - movs r1, 0x1 - ands r0, r1 - cmp r0, 0 - bne _0801D96E - movs r0, 0 - b _0801D970 -_0801D96E: - movs r0, 0x1 -_0801D970: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_801D954 - - thumb_func_start sub_801D978 -sub_801D978: @ 801D978 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl ResetBlockReceivedFlag - pop {r0} - bx r0 - thumb_func_end sub_801D978 - - thumb_func_start sub_801D988 -sub_801D988: @ 801D988 - push {r4-r6,lr} - sub sp, 0x8 - adds r5, r0, 0 - ldr r6, [r5] - cmp r6, 0x1 - beq _0801D9EC - cmp r6, 0x1 - bgt _0801D99E - cmp r6, 0 - beq _0801D9A4 - b _0801DA52 -_0801D99E: - cmp r6, 0x2 - beq _0801DA38 - b _0801DA52 -_0801D9A4: - ldrb r0, [r5, 0x5] - bl sub_801D954 - cmp r0, 0 - beq _0801DA52 - ldrb r0, [r5, 0x5] - mov r4, sp - mov r1, sp - movs r2, 0x8 - bl sub_801D938 - ldrh r1, [r4, 0x4] - strh r1, [r5, 0xC] - ldrh r0, [r4, 0x2] - strh r0, [r5, 0xA] - lsls r1, 16 - movs r0, 0x80 - lsls r0, 19 - cmp r1, r0 - bls _0801D9D2 -_0801D9CC: - bl sub_8010198 - b _0801DA52 -_0801D9D2: - mov r1, sp - ldrh r0, [r5, 0x6] - ldrh r1, [r1] - cmp r0, r1 - bne _0801D9CC - strh r6, [r5, 0x8] - ldrb r0, [r5, 0x5] - bl sub_801D978 - ldr r0, [r5] - adds r0, 0x1 - str r0, [r5] - b _0801DA52 -_0801D9EC: - ldrb r0, [r5, 0x5] - bl sub_801D954 - cmp r0, 0 - beq _0801DA52 - ldrh r0, [r5, 0x8] - lsls r1, r0, 6 - subs r1, r0 - lsls r3, r1, 2 - ldrh r0, [r5, 0xC] - subs r2, r0, r3 - cmp r2, 0xFC - bhi _0801DA1E - ldrb r0, [r5, 0x5] - ldr r1, [r5, 0x18] - adds r1, r3 - bl sub_801D938 - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - ldr r0, [r5] - adds r0, 0x1 - str r0, [r5] - b _0801DA30 -_0801DA1E: - ldrb r0, [r5, 0x5] - ldr r1, [r5, 0x18] - adds r1, r3 - movs r2, 0xFC - bl sub_801D938 - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] -_0801DA30: - ldrb r0, [r5, 0x5] - bl sub_801D978 - b _0801DA52 -_0801DA38: - ldr r0, [r5, 0x18] - ldrh r1, [r5, 0xC] - bl CalcCRC16WithTable - lsls r0, 16 - lsrs r0, 16 - ldrh r1, [r5, 0xA] - cmp r0, r1 - bne _0801D9CC - movs r0, 0 - str r0, [r5] - movs r0, 0x1 - b _0801DA54 -_0801DA52: - movs r0, 0 -_0801DA54: - add sp, 0x8 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_801D988 - - thumb_func_start sub_801DA5C -sub_801DA5C: @ 801DA5C - push {r4,r5,lr} - sub sp, 0x8 - adds r4, r0, 0 - ldr r5, [r4] - cmp r5, 0x1 - beq _0801DAC8 - cmp r5, 0x1 - bgt _0801DA72 - cmp r5, 0 - beq _0801DA7C - b _0801DB5E -_0801DA72: - cmp r5, 0x2 - beq _0801DB1C - cmp r5, 0x3 - beq _0801DB46 - b _0801DB5E -_0801DA7C: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _0801DB5E - ldrh r1, [r4, 0xE] - ldr r2, =0xffff0000 - ldr r0, [sp] - ands r0, r2 - orrs r0, r1 - str r0, [sp] - ldrh r1, [r4, 0x14] - ldr r0, [sp, 0x4] - ands r0, r2 - orrs r0, r1 - str r0, [sp, 0x4] - ldr r0, [r4, 0x1C] - bl CalcCRC16WithTable - lsls r0, 16 - ldr r2, =0x0000ffff - ldr r1, [sp] - ands r1, r2 - orrs r1, r0 - str r1, [sp] - lsrs r1, 16 - strh r1, [r4, 0x12] - strh r5, [r4, 0x10] - movs r0, 0 - mov r1, sp - movs r2, 0x8 - bl SendBlock - b _0801DB3E - .pool -_0801DAC8: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _0801DB5E - ldrb r0, [r4, 0x4] - bl sub_801D954 - cmp r0, 0 - beq _0801DB5E - ldrb r0, [r4, 0x4] - bl sub_801D978 - ldrh r1, [r4, 0x10] - lsls r0, r1, 6 - subs r0, r1 - lsls r3, r0, 2 - ldrh r0, [r4, 0x14] - subs r0, r3 - cmp r0, 0xFC - bhi _0801DB08 - ldr r1, [r4, 0x1C] - adds r1, r3 - lsls r2, r0, 16 - lsrs r2, 16 - movs r0, 0 - bl SendBlock - ldrh r0, [r4, 0x10] - adds r0, 0x1 - strh r0, [r4, 0x10] - b _0801DB3E -_0801DB08: - ldr r1, [r4, 0x1C] - adds r1, r3 - movs r0, 0 - movs r2, 0xFC - bl SendBlock - ldrh r0, [r4, 0x10] - adds r0, 0x1 - strh r0, [r4, 0x10] - b _0801DB5E -_0801DB1C: - bl IsLinkTaskFinished - lsls r0, 24 - cmp r0, 0 - beq _0801DB5E - ldr r0, [r4, 0x1C] - ldrh r1, [r4, 0x14] - bl CalcCRC16WithTable - lsls r0, 16 - lsrs r0, 16 - ldrh r1, [r4, 0x12] - cmp r0, r1 - beq _0801DB3E - bl sub_8010198 - b _0801DB5E -_0801DB3E: - ldr r0, [r4] - adds r0, 0x1 - str r0, [r4] - b _0801DB5E -_0801DB46: - ldrb r0, [r4, 0x4] - bl sub_801D954 - cmp r0, 0 - beq _0801DB5E - ldrb r0, [r4, 0x4] - bl sub_801D978 - movs r0, 0 - str r0, [r4] - movs r0, 0x1 - b _0801DB60 -_0801DB5E: - movs r0, 0 -_0801DB60: - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_801DA5C - - .align 2, 0 @ don't pad with nop diff --git a/data/mevent_server.s b/data/mevent_server.s index b6d8b4e25..47e474e61 100755 --- a/data/mevent_server.s +++ b/data/mevent_server.s @@ -9,265 +9,185 @@ gText_CanceledReadingCard:: @ 82F257C .align 2 gUnknown_082F2598:: @ 82F2598 - .byte 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .4byte 2, 16 + .4byte 4, 0 .align 2 gUnknown_082F25A8:: @ 82F25A8 - .byte 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .4byte 8, 0 + .4byte 3, 0 + .4byte 2, 16 + .4byte 4, 0 .align 2 gUnknown_082F25C8:: @ 82F25C8 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00 + .4byte 20, 0 + .4byte 1, 10 .align 2 gUnknown_082F25D8:: @ 82F25D8 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00 + .4byte 20, 0 + .4byte 1, 11 .align 2 gUnknown_082F25E8:: @ 82F25E8 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .4byte 20, 0 + .4byte 1, 0 .align 2 gUnknown_082F25F8:: @ 82F25F8 - .byte 0x02, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00 - .byte 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00 - .byte 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 + .4byte 2, 22 + .4byte 10, 0 + .4byte 2, 25 + .4byte 17, 0 + .4byte 20, 0 + .4byte 1, 2 .align 2 gUnknown_082F2628:: @ 82F2628 - .byte 0x02, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00 - .byte 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .4byte 2, 23 + .4byte 9, 0 + .4byte 3, 0 + .4byte 2, 16 + .4byte 4, 0 .align 2 gUnknown_082F2650:: @ 82F2650 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00 + .4byte 20, 0 + .4byte 1, 7 .align 2 gUnknown_082F2660:: @ 82F2660 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 + .4byte 20, 0 + .4byte 1, 3 .align 2 gUnknown_082F2670:: @ 82F2670 - .byte 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .4byte 13, 0 + .4byte 14, 0 + .4byte 3, 0 + .4byte 2, 16 + .4byte 4, 0 .align 2 gUnknown_082F2698:: @ 82F2698 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00 + .4byte 20, 0 + .4byte 1, 9 .align 2 gUnknown_082F26A8:: @ 82F26A8 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00 + .4byte 20, 0 + .4byte 1, 5 .align 2 gUnknown_082F26B8:: @ 82F26B8 - .byte 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00 - .byte 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00 - .byte 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00 + .4byte 2, 21 + .4byte 12, 0 + .4byte 20, 0 + .4byte 1, 14 + .4byte 2, 21 + .4byte 12, 0 + .4byte 20, 0 + .4byte 1, 13 .align 2 gUnknown_082F26F8:: @ 82F26F8 - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25C8 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25D8 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2698 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .4byte 18, 0x10, gUnknown_082F25C8 + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x0a, NULL + .4byte 18, 0x10, gUnknown_082F25D8 + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x0b, NULL + .4byte 18, 0x10, gUnknown_082F2698 + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x09, NULL .align 2 gUnknown_082F2788:: @ 82F2788 - .byte 0x12, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F26B8 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00 - - .4byte gText_CanceledReadingCard - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .4byte 18, 0x20, gUnknown_082F26B8 + .4byte 1, 0x00, NULL + .4byte 20, 0x1b, gText_CanceledReadingCard + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x09, NULL .align 2 gUnknown_082F27D0:: @ 82F27D0 - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2650 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .4byte 18, 0x10, gUnknown_082F2650 + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x07, NULL .align 2 gUnknown_082F2800:: @ 82F2800 - .byte 0x12, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2628 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F27D0 - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2660 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 + .4byte 18, 0x28, gUnknown_082F2628 + .4byte 1, 0x00, NULL + .4byte 14, 0x00, NULL + .4byte 1, 0x00, NULL + .4byte 2, 0x13, NULL + .4byte 8, 0x00, NULL + .4byte 4, 0x01, gUnknown_082F27D0 + .4byte 18, 0x10, gUnknown_082F2660 + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x03, NULL .align 2 gUnknown_082F2884:: @ 82F2884 - .byte 0x12, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25F8 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 + .4byte 18, 0x30, gUnknown_082F25F8 + .4byte 1, 0x00, NULL + .4byte 13, 0x00, NULL + .4byte 1, 0x00, NULL + .4byte 15, 0x00, NULL + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x02, NULL .align 2 gUnknown_082F28E4:: @ 82F28E4 - .byte 0x12, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2670 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2884 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2788 + .4byte 18, 0x28, gUnknown_082F2670 + .4byte 1, 0x00, NULL + .4byte 2, 0x13, NULL + .4byte 8, 0x00, NULL + .4byte 4, 0x00, gUnknown_082F2884 + .4byte 3, 0x00, gUnknown_082F2788 .align 2 gUnknown_082F292C:: @ 82F292C - .byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F26A8 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00 - .byte 0x10, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25E8 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 + .4byte 18, 0x10, gUnknown_082F26A8 + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x05, NULL + .4byte 18, 0x10, gUnknown_082F25E8 + .4byte 1, 0x00, NULL + .4byte 2, 0x14, NULL + .4byte 0, 0x00, NULL .align 2 s_mevent_wonder_news:: @ 82F298C - .byte 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00 - .byte 0x20, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25A8 - .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 - .byte 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F26F8 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2800 + .4byte 27, 0x00, NULL + .4byte 18, 0x20, gUnknown_082F25A8 + .4byte 1, 0x00, NULL + .4byte 2, 0x11, NULL + .4byte 5, 0x00, NULL + .4byte 30, 0x00, NULL + .4byte 4, 0x00, gUnknown_082F26F8 + .4byte 3, 0x00, gUnknown_082F2800 .align 2 s_mevent_wonder_card:: @ 82F29EC - .byte 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x12, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F25A8 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F26F8 - .byte 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F28E4 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F2884 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gUnknown_082F292C + .4byte 26, 0x00, NULL + .4byte 28, 0x00, NULL + .4byte 18, 0x20, gUnknown_082F25A8 + .4byte 1, 0x00, NULL + .4byte 2, 0x11, NULL + .4byte 5, 0x00, NULL + .4byte 6, 0x00, NULL + .4byte 4, 0x00, gUnknown_082F26F8 + .4byte 7, 0x00, NULL + .4byte 4, 0x02, gUnknown_082F28E4 + .4byte 4, 0x00, gUnknown_082F2884 + .4byte 3, 0x00, gUnknown_082F292C diff --git a/include/util.h b/include/util.h index 56c89359a..77062de96 100644 --- a/include/util.h +++ b/include/util.h @@ -10,8 +10,8 @@ u8 CreateInvisibleSpriteWithCallback(void (*)(struct Sprite *)); void StoreWordInTwoHalfwords(u16 *, u32); void LoadWordFromTwoHalfwords(u16 *, u32 *); int CountTrailingZeroBits(u32 value); -u16 CalcCRC16(u8 *data, s32 length); -u16 CalcCRC16WithTable(u8 *data, u32 length); +u16 CalcCRC16(const u8 *data, s32 length); +u16 CalcCRC16WithTable(const u8 *data, u32 length); u32 CalcByteArraySum(const u8* data, u32 length); void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor); void DoBgAffineSet(struct BgAffineDstData *dest, u32 texX, u32 texY, s16 scrX, s16 scrY, s16 sx, s16 sy, u16 alpha); diff --git a/ld_script.txt b/ld_script.txt index 0a7838883..65f171171 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -62,7 +62,7 @@ SECTIONS { src/mevent_801BAAC.o(.text); src/mevent_server.o(.text); src/mevent_server_ish.o(.text); - asm/mevent_server_helpers.o(.text); + src/mevent_server_helpers.o(.text); src/mevent_news.o(.text); src/union_room_chat.o(.text); src/berry_crush.o(.text); diff --git a/src/mevent_server_helpers.c b/src/mevent_server_helpers.c index dc4f98a6e..af14b514c 100644 --- a/src/mevent_server_helpers.c +++ b/src/mevent_server_helpers.c @@ -1 +1,211 @@ #include "global.h" +#include "alloc.h" +#include "decompress.h" +#include "util.h" +#include "link.h" +#include "link_rfu.h" +#include "overworld.h" +#include "script.h" +#include "battle_tower.h" +#include "mystery_event_script.h" +#include "mevent.h" +#include "mevent_server_helpers.h" + +static u32 mevent_receive_func(struct mevent_srv_sub *); +static u32 mevent_send_func(struct mevent_srv_sub *); + +u32 mevent_srv_sub_recv(struct mevent_srv_sub * svr) +{ + return svr->recvFunc(svr); +} + +u32 mevent_srv_sub_send(struct mevent_srv_sub * svr) +{ + return svr->sendFunc(svr); +} + +void mevent_srv_sub_init(struct mevent_srv_sub * svr, u32 sendPlayerNo, u32 recvPlayerNo) +{ + svr->sendPlayerNo = sendPlayerNo; + svr->recvPlayerNo = recvPlayerNo; + svr->seqno = 0; + svr->sendCRC = 0; + svr->sendSize = 0; + svr->sendCounter = 0; + svr->recvCRC = 0; + svr->recvSize = 0; + svr->recvCounter = 0; + svr->sendBfr = NULL; + svr->recvBfr = NULL; + svr->sendFunc = mevent_send_func; + svr->recvFunc = mevent_receive_func; +} + +void mevent_srv_sub_init_send(struct mevent_srv_sub * svr, u32 ident, const void * src, u32 size) +{ + svr->seqno = 0; + svr->sendIdent = ident; + svr->sendCounter = 0; + svr->sendCRC = 0; + if (size != 0) + svr->sendSize = size; + else + svr->sendSize = ME_SEND_BUF_SIZE; + svr->sendBfr = src; +} + +void mevent_srv_sub_init_recv(struct mevent_srv_sub * svr, u32 ident, void * dest) +{ + svr->seqno = 0; + svr->recvIdent = ident; + svr->recvCounter = 0; + svr->recvCRC = 0; + svr->recvSize = 0; + svr->recvBfr = dest; +} + +static void mevent_recv_block(u32 recv_idx, void * dest, size_t size) +{ + memcpy(dest, gBlockRecvBuffer[recv_idx], size); +} + +static bool32 mevent_has_received(u32 recv_idx) +{ + if ((GetBlockReceivedStatus() >> recv_idx) & 1) + return TRUE; + else + return FALSE; +} + +static void mevent_reset_recv(u32 recv_idx) +{ + ResetBlockReceivedFlag(recv_idx); +} + +static bool32 mevent_receive_func(struct mevent_srv_sub * svr) +{ + struct send_recv_header header; + + switch (svr->seqno) + { + case 0: + if (mevent_has_received(svr->recvPlayerNo)) + { + mevent_recv_block(svr->recvPlayerNo, &header, sizeof(header)); + svr->recvSize = header.size; + svr->recvCRC = header.crc; + if (svr->recvSize > ME_SEND_BUF_SIZE) + { + sub_8010198(); + return FALSE; + } + else if (svr->recvIdent != header.ident) + { + sub_8010198(); + return FALSE; + } + else + { + svr->recvCounter = 0; + mevent_reset_recv(svr->recvPlayerNo); + ++svr->seqno; + } + } + break; + case 1: + if (mevent_has_received(svr->recvPlayerNo)) + { + size_t blocksiz = svr->recvCounter * 252; + if (svr->recvSize - blocksiz <= 252) + { + mevent_recv_block(svr->recvPlayerNo, svr->recvBfr + blocksiz, svr->recvSize - blocksiz); + ++svr->recvCounter; + ++svr->seqno; + } + else + { + mevent_recv_block(svr->recvPlayerNo, svr->recvBfr + blocksiz, 252); + ++svr->recvCounter; + } + mevent_reset_recv(svr->recvPlayerNo); + } + break; + case 2: + if (CalcCRC16WithTable(svr->recvBfr, svr->recvSize) != svr->recvCRC) + { + sub_8010198(); + return FALSE; + } + else + { + svr->seqno = 0; + return TRUE; + } + break; + + } + + return FALSE; +} + +static bool32 mevent_send_func(struct mevent_srv_sub * svr) +{ + struct send_recv_header header; + + switch (svr->seqno) + { + case 0: + if (IsLinkTaskFinished()) + { + header.ident = svr->sendIdent; + header.size = svr->sendSize; + header.crc = CalcCRC16WithTable(svr->sendBfr, svr->sendSize); + svr->sendCRC = header.crc; + svr->sendCounter = 0; + SendBlock(0, &header, sizeof(header)); + ++svr->seqno; + } + break; + case 1: + if (IsLinkTaskFinished()) + { + if (mevent_has_received(svr->sendPlayerNo)) + { + size_t blocksiz; + mevent_reset_recv(svr->sendPlayerNo); + blocksiz = 252 * svr->sendCounter; + if (svr->sendSize - blocksiz <= 252) + { + SendBlock(0, svr->sendBfr + blocksiz, svr->sendSize - blocksiz); + ++svr->sendCounter; + ++svr->seqno; + } + else + { + SendBlock(0, svr->sendBfr + blocksiz, 252); + ++svr->sendCounter; + } + } + } + break; + case 2: + if (IsLinkTaskFinished()) + { + if (CalcCRC16WithTable(svr->sendBfr, svr->sendSize) != svr->sendCRC) + sub_8010198(); + else + ++svr->seqno; + } + break; + case 3: + if (mevent_has_received(svr->sendPlayerNo)) + { + mevent_reset_recv(svr->sendPlayerNo); + svr->seqno = 0; + return TRUE; + } + break; + } + + return FALSE; +} diff --git a/src/mevent_server_ish.c b/src/mevent_server_ish.c index 2b310c981..0303bfd9b 100644 --- a/src/mevent_server_ish.c +++ b/src/mevent_server_ish.c @@ -14,9 +14,7 @@ static void mevent_srv_ish_init(struct mevent_srv_ish *, u32, u32); static u32 mevent_srv_ish_exec(struct mevent_srv_ish *); static void mevent_srv_ish_free_resources(struct mevent_srv_ish *); -extern const u8 gUnknown_082F2598[]; -extern const struct mevent_cmd gUnknown_8468B6C[]; -extern const struct mevent_cmd gUnknown_8468BCC[]; +extern const struct mevent_cmd_ish gUnknown_082F2598[]; void mevent_srv_ish_do_init(u32 arg) { diff --git a/src/util.c b/src/util.c index 47112774a..8aa54857a 100644 --- a/src/util.c +++ b/src/util.c @@ -218,7 +218,7 @@ int CountTrailingZeroBits(u32 value) return 0; } -u16 CalcCRC16(u8 *data, s32 length) +u16 CalcCRC16(const u8 *data, s32 length) { u16 i, j; u16 crc = 0x1121; @@ -237,7 +237,7 @@ u16 CalcCRC16(u8 *data, s32 length) return ~crc; } -u16 CalcCRC16WithTable(u8 *data, u32 length) +u16 CalcCRC16WithTable(const u8 *data, u32 length) { u16 i; u16 crc = 0x1121; From 28646ea64ea628596dc1cd9496febf6f46cc9e41 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 13:26:06 -0400 Subject: [PATCH 071/101] Decompile mevent server scripts --- data/mevent_server.s | 193 ---------------------------------------- include/mevent.h | 4 +- include/mevent_server.h | 6 +- ld_script.txt | 3 +- src/mevent2.c | 4 +- src/mevent_scripts.c | 191 +++++++++++++++++++++++++++++++++++++++ src/mevent_server.c | 16 +++- 7 files changed, 212 insertions(+), 205 deletions(-) delete mode 100755 data/mevent_server.s create mode 100644 src/mevent_scripts.c diff --git a/data/mevent_server.s b/data/mevent_server.s deleted file mode 100755 index 47e474e61..000000000 --- a/data/mevent_server.s +++ /dev/null @@ -1,193 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gText_CanceledReadingCard:: @ 82F257C - .string "Canceled reading\nthe Card.$" - - .align 2 -gUnknown_082F2598:: @ 82F2598 - .4byte 2, 16 - .4byte 4, 0 - - .align 2 -gUnknown_082F25A8:: @ 82F25A8 - .4byte 8, 0 - .4byte 3, 0 - .4byte 2, 16 - .4byte 4, 0 - - .align 2 -gUnknown_082F25C8:: @ 82F25C8 - .4byte 20, 0 - .4byte 1, 10 - - .align 2 -gUnknown_082F25D8:: @ 82F25D8 - .4byte 20, 0 - .4byte 1, 11 - - .align 2 -gUnknown_082F25E8:: @ 82F25E8 - .4byte 20, 0 - .4byte 1, 0 - - .align 2 -gUnknown_082F25F8:: @ 82F25F8 - .4byte 2, 22 - .4byte 10, 0 - .4byte 2, 25 - .4byte 17, 0 - .4byte 20, 0 - .4byte 1, 2 - - .align 2 -gUnknown_082F2628:: @ 82F2628 - .4byte 2, 23 - .4byte 9, 0 - .4byte 3, 0 - .4byte 2, 16 - .4byte 4, 0 - - .align 2 -gUnknown_082F2650:: @ 82F2650 - .4byte 20, 0 - .4byte 1, 7 - - .align 2 -gUnknown_082F2660:: @ 82F2660 - .4byte 20, 0 - .4byte 1, 3 - - .align 2 -gUnknown_082F2670:: @ 82F2670 - .4byte 13, 0 - .4byte 14, 0 - .4byte 3, 0 - .4byte 2, 16 - .4byte 4, 0 - - .align 2 -gUnknown_082F2698:: @ 82F2698 - .4byte 20, 0 - .4byte 1, 9 - - .align 2 -gUnknown_082F26A8:: @ 82F26A8 - .4byte 20, 0 - .4byte 1, 5 - - .align 2 -gUnknown_082F26B8:: @ 82F26B8 - .4byte 2, 21 - .4byte 12, 0 - .4byte 20, 0 - .4byte 1, 14 - .4byte 2, 21 - .4byte 12, 0 - .4byte 20, 0 - .4byte 1, 13 - - .align 2 -gUnknown_082F26F8:: @ 82F26F8 - .4byte 18, 0x10, gUnknown_082F25C8 - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x0a, NULL - .4byte 18, 0x10, gUnknown_082F25D8 - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x0b, NULL - .4byte 18, 0x10, gUnknown_082F2698 - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x09, NULL - - .align 2 -gUnknown_082F2788:: @ 82F2788 - .4byte 18, 0x20, gUnknown_082F26B8 - .4byte 1, 0x00, NULL - .4byte 20, 0x1b, gText_CanceledReadingCard - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x09, NULL - - .align 2 -gUnknown_082F27D0:: @ 82F27D0 - .4byte 18, 0x10, gUnknown_082F2650 - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x07, NULL - - .align 2 -gUnknown_082F2800:: @ 82F2800 - .4byte 18, 0x28, gUnknown_082F2628 - .4byte 1, 0x00, NULL - .4byte 14, 0x00, NULL - .4byte 1, 0x00, NULL - .4byte 2, 0x13, NULL - .4byte 8, 0x00, NULL - .4byte 4, 0x01, gUnknown_082F27D0 - .4byte 18, 0x10, gUnknown_082F2660 - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x03, NULL - - .align 2 -gUnknown_082F2884:: @ 82F2884 - .4byte 18, 0x30, gUnknown_082F25F8 - .4byte 1, 0x00, NULL - .4byte 13, 0x00, NULL - .4byte 1, 0x00, NULL - .4byte 15, 0x00, NULL - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x02, NULL - - .align 2 -gUnknown_082F28E4:: @ 82F28E4 - .4byte 18, 0x28, gUnknown_082F2670 - .4byte 1, 0x00, NULL - .4byte 2, 0x13, NULL - .4byte 8, 0x00, NULL - .4byte 4, 0x00, gUnknown_082F2884 - .4byte 3, 0x00, gUnknown_082F2788 - - .align 2 -gUnknown_082F292C:: @ 82F292C - .4byte 18, 0x10, gUnknown_082F26A8 - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x05, NULL - .4byte 18, 0x10, gUnknown_082F25E8 - .4byte 1, 0x00, NULL - .4byte 2, 0x14, NULL - .4byte 0, 0x00, NULL - - .align 2 -s_mevent_wonder_news:: @ 82F298C - .4byte 27, 0x00, NULL - .4byte 18, 0x20, gUnknown_082F25A8 - .4byte 1, 0x00, NULL - .4byte 2, 0x11, NULL - .4byte 5, 0x00, NULL - .4byte 30, 0x00, NULL - .4byte 4, 0x00, gUnknown_082F26F8 - .4byte 3, 0x00, gUnknown_082F2800 - - .align 2 -s_mevent_wonder_card:: @ 82F29EC - .4byte 26, 0x00, NULL - .4byte 28, 0x00, NULL - .4byte 18, 0x20, gUnknown_082F25A8 - .4byte 1, 0x00, NULL - .4byte 2, 0x11, NULL - .4byte 5, 0x00, NULL - .4byte 6, 0x00, NULL - .4byte 4, 0x00, gUnknown_082F26F8 - .4byte 7, 0x00, NULL - .4byte 4, 0x02, gUnknown_082F28E4 - .4byte 4, 0x00, gUnknown_082F2884 - .4byte 3, 0x00, gUnknown_082F292C diff --git a/include/mevent.h b/include/mevent.h index 9c5d559bf..68c19abfc 100755 --- a/include/mevent.h +++ b/include/mevent.h @@ -52,8 +52,8 @@ bool32 CheckReceivedGiftFromWonderCard(void); bool32 sub_801B508(const u16 *data); void sub_801B580(struct MEventStruct_Unk1442CC *data, bool32 a1); bool32 sub_801B6A0(const struct MEventStruct_Unk1442CC *data, bool32 a1); -u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *unused); -u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *unused); +u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const void *unused); +u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const void *unused); bool32 sub_801B748(const struct MEventStruct_Unk1442CC *a0, const u16 *a1); u16 sub_801B784(const struct MEventStruct_Unk1442CC *a0, u32 command); u16 mevent_081445C0(u32 command); diff --git a/include/mevent_server.h b/include/mevent_server.h index ed9812d8a..019f3c685 100644 --- a/include/mevent_server.h +++ b/include/mevent_server.h @@ -7,7 +7,7 @@ struct mevent_cmd { u32 instr; bool32 flag; - void * parameter; + const void * parameter; }; struct mevent_srv_common @@ -21,9 +21,9 @@ struct mevent_srv_common struct MEventBuffer_32E0_Sub * mevent_32e0; struct MEventBuffer_3120_Sub * mevent_3120; struct MEventStruct_Unk1442CC * mevent_unk1442cc; - void * sendBuffer1; + const void * sendBuffer1; u32 sendBuffer1Size; - void * sendBuffer2; + const void * sendBuffer2; u32 sendBuffer2Size; u32 sendWord; struct mevent_srv_sub manager; diff --git a/ld_script.txt b/ld_script.txt index 65f171171..c5ffc06fe 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -418,8 +418,7 @@ SECTIONS { src/mevent_801BAAC.o(.rodata); src/mevent_server.o(.rodata); src/mevent_server_ish.o(.rodata); - src/mevent_server_helpers.o(.rodata); - data/mevent_server.o(.rodata); + src/mevent_scripts.o(.rodata); src/union_room_chat.o(.rodata); data/union_room_chat.o(.rodata); data/berry_crush.o(.rodata); diff --git a/src/mevent2.c b/src/mevent2.c index 4174c4055..8585224ef 100755 --- a/src/mevent2.c +++ b/src/mevent2.c @@ -399,7 +399,7 @@ bool32 sub_801B6A0(const struct MEventStruct_Unk1442CC *data, bool32 a1) return TRUE; } -u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *unused) +u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const void *unused) { if (a1->unk_14 == 0) return 0; @@ -410,7 +410,7 @@ u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *un return 2; } -u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *unused) +u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const void *unused) { int r4 = a1->unk_44 - sub_801B438(&a1->unk_20, a1->unk_44); if (r4 == 0) diff --git a/src/mevent_scripts.c b/src/mevent_scripts.c new file mode 100644 index 000000000..4a1a26535 --- /dev/null +++ b/src/mevent_scripts.c @@ -0,0 +1,191 @@ +#include "global.h" +#include "mevent_server_ish.h" +#include "mevent_server.h" + +const u8 gText_CanceledReadingCard[] = _("Canceled reading\nthe Card."); + + +const struct mevent_cmd_ish gUnknown_082F2598[] = { + { 2, 16}, + { 4, 0} +}; + +const struct mevent_cmd_ish gUnknown_082F25A8[] = { + { 8, 0}, + { 3, 0}, + { 2, 16}, + { 4, 0} +}; + +const struct mevent_cmd_ish gUnknown_082F25C8[] = { + {20, 0}, + { 1, 10} +}; + +const struct mevent_cmd_ish gUnknown_082F25D8[] = { + {20, 0}, + { 1, 11} +}; + +const struct mevent_cmd_ish gUnknown_082F25E8[] = { + {20, 0}, + { 1, 0} +}; + +const struct mevent_cmd_ish gUnknown_082F25F8[] = { + { 2, 22}, + {10, 0}, + { 2, 25}, + {17, 0}, + {20, 0}, + { 1, 2} +}; + +const struct mevent_cmd_ish gUnknown_082F2628[] = { + { 2, 23}, + { 9, 0}, + { 3, 0}, + { 2, 16}, + { 4, 0} +}; + +const struct mevent_cmd_ish gUnknown_082F2650[] = { + {20, 0}, + { 1, 7} +}; + +const struct mevent_cmd_ish gUnknown_082F2660[] = { + {20, 0}, + { 1, 3} +}; + +const struct mevent_cmd_ish gUnknown_082F2670[] = { + {13, 0}, + {14, 0}, + { 3, 0}, + { 2, 16}, + { 4, 0} +}; + +const struct mevent_cmd_ish gUnknown_082F2698[] = { + {20, 0}, + { 1, 9} +}; + +const struct mevent_cmd_ish gUnknown_082F26A8[] = { + {20, 0}, + { 1, 5} +}; + +const struct mevent_cmd_ish gUnknown_082F26B8[] = { + { 2, 21}, + {12, 0}, + {20, 0}, + { 1, 14}, + { 2, 21}, + {12, 0}, + {20, 0}, + { 1, 13} +}; + +const struct mevent_cmd gUnknown_082F26F8[] = { + {18, 0x10, gUnknown_082F25C8}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x0a, NULL}, + {18, 0x10, gUnknown_082F25D8}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x0b, NULL}, + {18, 0x10, gUnknown_082F2698}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x09, NULL} +}; + +const struct mevent_cmd gUnknown_082F2788[] = { + {18, 0x20, gUnknown_082F26B8}, + { 1, 0x00, NULL}, + {20, 0x1b, gText_CanceledReadingCard}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x09, NULL} +}; + +const struct mevent_cmd gUnknown_082F27D0[] = { + {18, 0x10, gUnknown_082F2650}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x07, NULL} +}; + +const struct mevent_cmd gUnknown_082F2800[] = { + {18, 0x28, gUnknown_082F2628}, + { 1, 0x00, NULL}, + {14, 0x00, NULL}, + { 1, 0x00, NULL}, + { 2, 0x13, NULL}, + { 8, 0x00, NULL}, + { 4, 0x01, gUnknown_082F27D0}, + {18, 0x10, gUnknown_082F2660}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x03, NULL} +}; + +const struct mevent_cmd gUnknown_082F2884[] = { + {18, 0x30, gUnknown_082F25F8}, + { 1, 0x00, NULL}, + {13, 0x00, NULL}, + { 1, 0x00, NULL}, + {15, 0x00, NULL}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x02, NULL} +}; + +const struct mevent_cmd gUnknown_082F28E4[] = { + {18, 0x28, gUnknown_082F2670}, + { 1, 0x00, NULL}, + { 2, 0x13, NULL}, + { 8, 0x00, NULL}, + { 4, 0x00, gUnknown_082F2884}, + { 3, 0x00, gUnknown_082F2788} +}; + +const struct mevent_cmd gUnknown_082F292C[] = { + {18, 0x10, gUnknown_082F26A8}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x05, NULL}, + {18, 0x10, gUnknown_082F25E8}, + { 1, 0x00, NULL}, + { 2, 0x14, NULL}, + { 0, 0x00, NULL} +}; + +const struct mevent_cmd s_mevent_wonder_news[] = { + {27, 0x00, NULL}, + {18, 0x20, gUnknown_082F25A8}, + { 1, 0x00, NULL}, + { 2, 0x11, NULL}, + { 5, 0x00, NULL}, + {30, 0x00, NULL}, + { 4, 0x00, gUnknown_082F26F8}, + { 3, 0x00, gUnknown_082F2800} +}; + +const struct mevent_cmd s_mevent_wonder_card[] = { + {26, 0x00, NULL}, + {28, 0x00, NULL}, + {18, 0x20, gUnknown_082F25A8}, + {1, 0x00, NULL}, + {2, 0x11, NULL}, + {5, 0x00, NULL}, + {6, 0x00, NULL}, + {4, 0x00, gUnknown_082F26F8}, + {7, 0x00, NULL}, + {4, 0x02, gUnknown_082F28E4}, + {4, 0x00, gUnknown_082F2884}, + {3, 0x00, gUnknown_082F292C}, +}; diff --git a/src/mevent_server.c b/src/mevent_server.c index 6a129ee28..fe13943ff 100644 --- a/src/mevent_server.c +++ b/src/mevent_server.c @@ -69,7 +69,7 @@ void mevent_srv_common_init_send(struct mevent_srv_common * svr, u32 ident, cons mevent_srv_sub_init_send(&svr->manager, ident, src, size); } -static void * mevent_first_if_not_null_else_second(void * a0, void * a1) +static const void * mevent_first_if_not_null_else_second(const void * a0, const void * a1) { if (a0 != NULL) return a0; @@ -77,7 +77,7 @@ static void * mevent_first_if_not_null_else_second(void * a0, void * a1) return a1; } -static u32 mevent_compare_pointers(void * a0, void * a1) +static u32 mevent_compare_pointers(const void * a0, const void * a1) { if (a1 < a0) return 0; @@ -120,45 +120,53 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr) { // process command const struct mevent_cmd * cmd = &svr->cmdBuffer[svr->cmdidx]; - void * ptr; + const void * ptr; svr->cmdidx++; switch (cmd->instr) { case 0: + // end AGB_ASSERT(cmd->parameter == NULL); svr->mainseqno = 1; svr->param = cmd->flag; break; case 1: + // wait_send svr->mainseqno = 3; break; case 2: + // receive AGB_ASSERT(cmd->parameter == NULL); mevent_srv_sub_init_recv(&svr->manager, cmd->flag, svr->recvBuffer); svr->mainseqno = 2; break; case 3: + // jump AGB_ASSERT(cmd->flag == FALSE); svr->cmdidx = 0; svr->cmdBuffer = cmd->parameter; break; case 5: + // get_1442CC AGB_ASSERT(cmd->flag == FALSE); AGB_ASSERT(cmd->parameter == NULL); memcpy(svr->mevent_unk1442cc, svr->recvBuffer, sizeof(struct MEventStruct_Unk1442CC)); break; case 6: + // check_header__pass_false AGB_ASSERT(cmd->flag == FALSE); AGB_ASSERT(cmd->parameter == NULL); svr->param = sub_801B6A0(svr->mevent_unk1442cc, FALSE); break; case 30: + // check_header__pass_true AGB_ASSERT(cmd->flag == FALSE); AGB_ASSERT(cmd->parameter == NULL); svr->param = sub_801B6A0(svr->mevent_unk1442cc, TRUE); break; case 4: + // jump_if_eq if (svr->param == cmd->flag) { svr->cmdidx = 0; @@ -166,11 +174,13 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr) } break; case 7: + // check_crc AGB_ASSERT(cmd->flag == FALSE); ptr = mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_32e0); svr->param = sub_801B6EC(ptr, svr->mevent_unk1442cc, ptr); break; case 8: + // read_word AGB_ASSERT(cmd->flag == FALSE); AGB_ASSERT(cmd->parameter == NULL); svr->param = *(u32 *)svr->recvBuffer; From b17c85ff7c975359b6d075453fb1ad668262f87f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 13:35:38 -0400 Subject: [PATCH 072/101] Use named fields for command structs --- src/mevent_scripts.c | 238 +++++++++++++++++++++---------------------- 1 file changed, 119 insertions(+), 119 deletions(-) diff --git a/src/mevent_scripts.c b/src/mevent_scripts.c index 4a1a26535..29b37119e 100644 --- a/src/mevent_scripts.c +++ b/src/mevent_scripts.c @@ -6,186 +6,186 @@ const u8 gText_CanceledReadingCard[] = _("Canceled reading\nthe Card."); const struct mevent_cmd_ish gUnknown_082F2598[] = { - { 2, 16}, - { 4, 0} + {.instr = 2, .parameter = 16}, + {.instr = 4, .parameter = 0} }; const struct mevent_cmd_ish gUnknown_082F25A8[] = { - { 8, 0}, - { 3, 0}, - { 2, 16}, - { 4, 0} + {.instr = 8, .parameter = 0}, + {.instr = 3, .parameter = 0}, + {.instr = 2, .parameter = 16}, + {.instr = 4, .parameter = 0} }; const struct mevent_cmd_ish gUnknown_082F25C8[] = { - {20, 0}, - { 1, 10} + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 10} }; const struct mevent_cmd_ish gUnknown_082F25D8[] = { - {20, 0}, - { 1, 11} + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 11} }; const struct mevent_cmd_ish gUnknown_082F25E8[] = { - {20, 0}, - { 1, 0} + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 0} }; const struct mevent_cmd_ish gUnknown_082F25F8[] = { - { 2, 22}, - {10, 0}, - { 2, 25}, - {17, 0}, - {20, 0}, - { 1, 2} + {.instr = 2, .parameter = 22}, + {.instr = 10, .parameter = 0}, + {.instr = 2, .parameter = 25}, + {.instr = 17, .parameter = 0}, + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 2} }; const struct mevent_cmd_ish gUnknown_082F2628[] = { - { 2, 23}, - { 9, 0}, - { 3, 0}, - { 2, 16}, - { 4, 0} + {.instr = 2, .parameter = 23}, + {.instr = 9, .parameter = 0}, + {.instr = 3, .parameter = 0}, + {.instr = 2, .parameter = 16}, + {.instr = 4, .parameter = 0} }; const struct mevent_cmd_ish gUnknown_082F2650[] = { - {20, 0}, - { 1, 7} + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 7} }; const struct mevent_cmd_ish gUnknown_082F2660[] = { - {20, 0}, - { 1, 3} + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 3} }; const struct mevent_cmd_ish gUnknown_082F2670[] = { - {13, 0}, - {14, 0}, - { 3, 0}, - { 2, 16}, - { 4, 0} + {.instr = 13, .parameter = 0}, + {.instr = 14, .parameter = 0}, + {.instr = 3, .parameter = 0}, + {.instr = 2, .parameter = 16}, + {.instr = 4, .parameter = 0} }; const struct mevent_cmd_ish gUnknown_082F2698[] = { - {20, 0}, - { 1, 9} + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 9} }; const struct mevent_cmd_ish gUnknown_082F26A8[] = { - {20, 0}, - { 1, 5} + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 5} }; const struct mevent_cmd_ish gUnknown_082F26B8[] = { - { 2, 21}, - {12, 0}, - {20, 0}, - { 1, 14}, - { 2, 21}, - {12, 0}, - {20, 0}, - { 1, 13} + {.instr = 2, .parameter = 21}, + {.instr = 12, .parameter = 0}, + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 14}, + {.instr = 2, .parameter = 21}, + {.instr = 12, .parameter = 0}, + {.instr = 20, .parameter = 0}, + {.instr = 1, .parameter = 13} }; const struct mevent_cmd gUnknown_082F26F8[] = { - {18, 0x10, gUnknown_082F25C8}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x0a, NULL}, - {18, 0x10, gUnknown_082F25D8}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x0b, NULL}, - {18, 0x10, gUnknown_082F2698}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x09, NULL} + {.instr = 18, .flag = 0x10, .parameter = gUnknown_082F25C8}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x0a, .parameter = NULL}, + {.instr = 18, .flag = 0x10, .parameter = gUnknown_082F25D8}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x0b, .parameter = NULL}, + {.instr = 18, .flag = 0x10, .parameter = gUnknown_082F2698}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x09, .parameter = NULL} }; const struct mevent_cmd gUnknown_082F2788[] = { - {18, 0x20, gUnknown_082F26B8}, - { 1, 0x00, NULL}, - {20, 0x1b, gText_CanceledReadingCard}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x09, NULL} + {.instr = 18, .flag = 0x20, .parameter = gUnknown_082F26B8}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 20, .flag = 0x1b, .parameter = gText_CanceledReadingCard}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x09, .parameter = NULL} }; const struct mevent_cmd gUnknown_082F27D0[] = { - {18, 0x10, gUnknown_082F2650}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x07, NULL} + {.instr = 18, .flag = 0x10, .parameter = gUnknown_082F2650}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x07, .parameter = NULL} }; const struct mevent_cmd gUnknown_082F2800[] = { - {18, 0x28, gUnknown_082F2628}, - { 1, 0x00, NULL}, - {14, 0x00, NULL}, - { 1, 0x00, NULL}, - { 2, 0x13, NULL}, - { 8, 0x00, NULL}, - { 4, 0x01, gUnknown_082F27D0}, - {18, 0x10, gUnknown_082F2660}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x03, NULL} + {.instr = 18, .flag = 0x28, .parameter = gUnknown_082F2628}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 14, .flag = 0x00, .parameter = NULL}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x13, .parameter = NULL}, + {.instr = 8, .flag = 0x00, .parameter = NULL}, + {.instr = 4, .flag = 0x01, .parameter = gUnknown_082F27D0}, + {.instr = 18, .flag = 0x10, .parameter = gUnknown_082F2660}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x03, .parameter = NULL} }; const struct mevent_cmd gUnknown_082F2884[] = { - {18, 0x30, gUnknown_082F25F8}, - { 1, 0x00, NULL}, - {13, 0x00, NULL}, - { 1, 0x00, NULL}, - {15, 0x00, NULL}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x02, NULL} + {.instr = 18, .flag = 0x30, .parameter = gUnknown_082F25F8}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 13, .flag = 0x00, .parameter = NULL}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 15, .flag = 0x00, .parameter = NULL}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x02, .parameter = NULL} }; const struct mevent_cmd gUnknown_082F28E4[] = { - {18, 0x28, gUnknown_082F2670}, - { 1, 0x00, NULL}, - { 2, 0x13, NULL}, - { 8, 0x00, NULL}, - { 4, 0x00, gUnknown_082F2884}, - { 3, 0x00, gUnknown_082F2788} + {.instr = 18, .flag = 0x28, .parameter = gUnknown_082F2670}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x13, .parameter = NULL}, + {.instr = 8, .flag = 0x00, .parameter = NULL}, + {.instr = 4, .flag = 0x00, .parameter = gUnknown_082F2884}, + {.instr = 3, .flag = 0x00, .parameter = gUnknown_082F2788} }; const struct mevent_cmd gUnknown_082F292C[] = { - {18, 0x10, gUnknown_082F26A8}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x05, NULL}, - {18, 0x10, gUnknown_082F25E8}, - { 1, 0x00, NULL}, - { 2, 0x14, NULL}, - { 0, 0x00, NULL} + {.instr = 18, .flag = 0x10, .parameter = gUnknown_082F26A8}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x05, .parameter = NULL}, + {.instr = 18, .flag = 0x10, .parameter = gUnknown_082F25E8}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x14, .parameter = NULL}, + {.instr = 0, .flag = 0x00, .parameter = NULL} }; const struct mevent_cmd s_mevent_wonder_news[] = { - {27, 0x00, NULL}, - {18, 0x20, gUnknown_082F25A8}, - { 1, 0x00, NULL}, - { 2, 0x11, NULL}, - { 5, 0x00, NULL}, - {30, 0x00, NULL}, - { 4, 0x00, gUnknown_082F26F8}, - { 3, 0x00, gUnknown_082F2800} + {.instr = 27, .flag = 0x00, .parameter = NULL}, + {.instr = 18, .flag = 0x20, .parameter = gUnknown_082F25A8}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x11, .parameter = NULL}, + {.instr = 5, .flag = 0x00, .parameter = NULL}, + {.instr = 30, .flag = 0x00, .parameter = NULL}, + {.instr = 4, .flag = 0x00, .parameter = gUnknown_082F26F8}, + {.instr = 3, .flag = 0x00, .parameter = gUnknown_082F2800} }; const struct mevent_cmd s_mevent_wonder_card[] = { - {26, 0x00, NULL}, - {28, 0x00, NULL}, - {18, 0x20, gUnknown_082F25A8}, - {1, 0x00, NULL}, - {2, 0x11, NULL}, - {5, 0x00, NULL}, - {6, 0x00, NULL}, - {4, 0x00, gUnknown_082F26F8}, - {7, 0x00, NULL}, - {4, 0x02, gUnknown_082F28E4}, - {4, 0x00, gUnknown_082F2884}, - {3, 0x00, gUnknown_082F292C}, + {.instr = 26, .flag = 0x00, .parameter = NULL}, + {.instr = 28, .flag = 0x00, .parameter = NULL}, + {.instr = 18, .flag = 0x20, .parameter = gUnknown_082F25A8}, + {.instr = 1, .flag = 0x00, .parameter = NULL}, + {.instr = 2, .flag = 0x11, .parameter = NULL}, + {.instr = 5, .flag = 0x00, .parameter = NULL}, + {.instr = 6, .flag = 0x00, .parameter = NULL}, + {.instr = 4, .flag = 0x00, .parameter = gUnknown_082F26F8}, + {.instr = 7, .flag = 0x00, .parameter = NULL}, + {.instr = 4, .flag = 0x02, .parameter = gUnknown_082F28E4}, + {.instr = 4, .flag = 0x00, .parameter = gUnknown_082F2884}, + {.instr = 3, .flag = 0x00, .parameter = gUnknown_082F292C} }; From d220f876fc9e7281075419ce6bbb5bf9e8dbef8f Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 13:57:03 -0400 Subject: [PATCH 073/101] Some symbol documentation --- include/global.h | 16 +++---- include/mevent.h | 14 +++---- include/mevent_801BAAC.h | 4 +- include/mevent_server.h | 4 +- include/script.h | 6 +-- src/mevent2.c | 90 ++++++++++++++++++++-------------------- src/mevent_801BAAC.c | 8 ++-- src/mevent_server.c | 30 +++++++------- src/mevent_server_ish.c | 2 +- src/mystery_gift.c | 4 +- src/scrcmd.c | 2 +- src/script.c | 6 +-- 12 files changed, 93 insertions(+), 93 deletions(-) diff --git a/include/global.h b/include/global.h index 0506c036e..7b570d72e 100644 --- a/include/global.h +++ b/include/global.h @@ -816,7 +816,7 @@ struct MysteryEventStruct u8 unk_1; }; - struct MEventBuffer_3120_Sub + struct WonderNews { u16 unk_00; u8 unk_02; @@ -825,13 +825,13 @@ struct MysteryEventStruct u8 unk_2C[10][40]; }; - struct MEventBuffer_3120 + struct WonderNewsSaveStruct { u32 crc; - struct MEventBuffer_3120_Sub data; + struct WonderNews data; }; - struct MEventBuffer_32E0_Sub + struct WonderCard { u16 unk_00; u16 unk_02; @@ -847,10 +847,10 @@ struct MysteryEventStruct u8 unk_122[40]; }; - struct MEventBuffer_32E0 + struct WonderCardSaveStruct { u32 crc; - struct MEventBuffer_32E0_Sub data; + struct WonderCard data; }; struct MEventBuffer_3430_Sub @@ -870,8 +870,8 @@ struct MysteryEventStruct struct MEventBuffers { - /*0x000 0x322C*/ struct MEventBuffer_3120 buffer_000; - /*0x1c0 0x33EC*/ struct MEventBuffer_32E0 buffer_1c0; + /*0x000 0x322C*/ struct WonderNewsSaveStruct wonderNews; + /*0x1c0 0x33EC*/ struct WonderCardSaveStruct wonderCard; /*0x310 0x353C*/ struct MEventBuffer_3430 buffer_310; /*0x338 0x3564*/ u16 unk_338[4]; /*0x340 0x356C*/ struct MysteryEventStruct unk_340; diff --git a/include/mevent.h b/include/mevent.h index 68c19abfc..a34ca355c 100755 --- a/include/mevent.h +++ b/include/mevent.h @@ -32,30 +32,30 @@ struct MEventStruct_Unk1442CC }; void sub_801AFD8(void); -struct MEventBuffer_3120_Sub *sav1_get_mevent_buffer_0(void); -struct MEventBuffer_32E0_Sub *sav1_get_mevent_buffer_1(void); +struct WonderNews *GetSavedWonderNews(void); +struct WonderCard *GetSavedWonderCard(void); struct MEventBuffer_3430_Sub *sav1_get_mevent_buffer_2(void); struct MysteryEventStruct *sub_801B044(void); u16 *sub_801B058(void); void DestroyWonderNews(void); -bool32 sub_801B078(const struct MEventBuffer_3120_Sub *src); +bool32 sub_801B078(const struct WonderNews *src); bool32 ValidateReceivedWonderNews(void); bool32 WonderNews_Test_Unk_02(void); bool32 sub_801B1A4(const u8 *src); void DestroyWonderCard(void); -bool32 sub_801B21C(const struct MEventBuffer_32E0_Sub *data); +bool32 sub_801B21C(const struct WonderCard *data); bool32 ValidateReceivedWonderCard(void); bool32 WonderCard_Test_Unk_08_6(void); u16 GetWonderCardFlagID(void); -void sub_801B3C0(struct MEventBuffer_32E0_Sub *buffer); +void WonderCard_ResetInternalReceivedFlag(struct WonderCard *buffer); bool32 CheckReceivedGiftFromWonderCard(void); bool32 sub_801B508(const u16 *data); void sub_801B580(struct MEventStruct_Unk1442CC *data, bool32 a1); bool32 sub_801B6A0(const struct MEventStruct_Unk1442CC *data, bool32 a1); u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const void *unused); u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const void *unused); -bool32 sub_801B748(const struct MEventStruct_Unk1442CC *a0, const u16 *a1); -u16 sub_801B784(const struct MEventStruct_Unk1442CC *a0, u32 command); +bool32 MEventStruct_Unk1442CC_CompareField_unk_16(const struct MEventStruct_Unk1442CC *a0, const u16 *a1); +u16 MEventStruct_Unk1442CC_GetValueNFrom_unk_20(const struct MEventStruct_Unk1442CC *a0, u32 command); u16 mevent_081445C0(u32 command); void sub_801B940(void); bool32 sub_801B94C(u16 a0); diff --git a/include/mevent_801BAAC.h b/include/mevent_801BAAC.h index 547d5237b..d76bc92c2 100644 --- a/include/mevent_801BAAC.h +++ b/include/mevent_801BAAC.h @@ -1,8 +1,8 @@ #ifndef GUARD_MEVENT_801BAAC_H #define GUARD_MEVENT_801BAAC_H -bool32 InitWonderCardResources(struct MEventBuffer_32E0_Sub * r5, struct MEventBuffer_3430_Sub * r6); -bool32 InitWonderNewsResources(const struct MEventBuffer_3120_Sub * a0); +bool32 InitWonderCardResources(struct WonderCard * r5, struct MEventBuffer_3430_Sub * r6); +bool32 InitWonderNewsResources(const struct WonderNews * a0); s32 FadeToWonderCardMenu(void); s32 FadeToWonderNewsMenu(void); s32 FadeOutFromWonderCard(bool32 flag); diff --git a/include/mevent_server.h b/include/mevent_server.h index 019f3c685..e74337cf6 100644 --- a/include/mevent_server.h +++ b/include/mevent_server.h @@ -18,8 +18,8 @@ struct mevent_srv_common u32 cmdidx; const struct mevent_cmd * cmdBuffer; void * recvBuffer; - struct MEventBuffer_32E0_Sub * mevent_32e0; - struct MEventBuffer_3120_Sub * mevent_3120; + struct WonderCard * wonder_card; + struct WonderNews * wonder_news; struct MEventStruct_Unk1442CC * mevent_unk1442cc; const void * sendBuffer1; u32 sendBuffer1Size; diff --git a/include/script.h b/include/script.h index 34f4635bb..cfe493479 100644 --- a/include/script.h +++ b/include/script.h @@ -57,9 +57,9 @@ u32 CalculateRamScriptChecksum(void); void ClearRamScript(void); bool8 InitRamScript(const u8 *script, u16 scriptSize, u8 mapGroup, u8 mapNum, u8 objectId); const u8 *GetRamScript(u8 objectId, const u8 *script); -bool32 sub_80991F8(void); -u8 *sub_8099244(void); -void sub_80992A0(u8 *script, u16 scriptSize); +bool32 ValidateSavedRamScript(void); +u8 *GetSavedRamScriptIfValid(void); +void InitRamScript_NoEventObject(u8 *script, u16 scriptSize); // srccmd.h void sub_809BE48(u16 npcId); diff --git a/src/mevent2.c b/src/mevent2.c index 8585224ef..f36e5d06b 100755 --- a/src/mevent2.c +++ b/src/mevent2.c @@ -15,8 +15,8 @@ static EWRAM_DATA bool32 gUnknown_02022C70 = FALSE; static void sub_801B180(void); static void s_DestroyWonderNews(void); -static bool32 sub_801B114(const struct MEventBuffer_3120_Sub *data); -static bool32 sub_801B2CC(const struct MEventBuffer_32E0_Sub *data); +static bool32 sub_801B114(const struct WonderNews *data); +static bool32 sub_801B2CC(const struct WonderCard *data); static void sub_801B330(void); static void sub_801B368(void); static void sub_801B9F8(void); @@ -29,14 +29,14 @@ void sub_801AFD8(void) sub_811F8BC(); } -struct MEventBuffer_3120_Sub *sav1_get_mevent_buffer_0(void) +struct WonderNews *GetSavedWonderNews(void) { - return &gSaveBlock1Ptr->unk_322C.buffer_000.data; + return &gSaveBlock1Ptr->unk_322C.wonderNews.data; } -struct MEventBuffer_32E0_Sub *sav1_get_mevent_buffer_1(void) +struct WonderCard *GetSavedWonderCard(void) { - return &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + return &gSaveBlock1Ptr->unk_322C.wonderCard.data; } struct MEventBuffer_3430_Sub *sav1_get_mevent_buffer_2(void) @@ -59,28 +59,28 @@ void DestroyWonderNews(void) s_DestroyWonderNews(); } -bool32 sub_801B078(const struct MEventBuffer_3120_Sub *src) +bool32 sub_801B078(const struct WonderNews *src) { if (!sub_801B114(src)) return FALSE; s_DestroyWonderNews(); - gSaveBlock1Ptr->unk_322C.buffer_000.data = *src; - gSaveBlock1Ptr->unk_322C.buffer_000.crc = CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.buffer_000.data, sizeof(struct MEventBuffer_3120_Sub)); + gSaveBlock1Ptr->unk_322C.wonderNews.data = *src; + gSaveBlock1Ptr->unk_322C.wonderNews.crc = CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.wonderNews.data, sizeof(struct WonderNews)); return TRUE; } bool32 ValidateReceivedWonderNews(void) { - if (CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.buffer_000.data, sizeof(struct MEventBuffer_3120_Sub)) != gSaveBlock1Ptr->unk_322C.buffer_000.crc) + if (CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.wonderNews.data, sizeof(struct WonderNews)) != gSaveBlock1Ptr->unk_322C.wonderNews.crc) return FALSE; - if (!sub_801B114(&gSaveBlock1Ptr->unk_322C.buffer_000.data)) + if (!sub_801B114(&gSaveBlock1Ptr->unk_322C.wonderNews.data)) return FALSE; return TRUE; } -static bool32 sub_801B114(const struct MEventBuffer_3120_Sub *data) +static bool32 sub_801B114(const struct WonderNews *data) { if (data->unk_00 == 0) return FALSE; @@ -90,7 +90,7 @@ static bool32 sub_801B114(const struct MEventBuffer_3120_Sub *data) bool32 WonderNews_Test_Unk_02(void) { - const struct MEventBuffer_3120_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_000.data; + const struct WonderNews *data = &gSaveBlock1Ptr->unk_322C.wonderNews.data; if (data->unk_02 == 0) return FALSE; @@ -99,8 +99,8 @@ bool32 WonderNews_Test_Unk_02(void) static void s_DestroyWonderNews(void) { - CpuFill32(0, sav1_get_mevent_buffer_0(), sizeof(gSaveBlock1Ptr->unk_322C.buffer_000.data)); - gSaveBlock1Ptr->unk_322C.buffer_000.crc = 0; + CpuFill32(0, GetSavedWonderNews(), sizeof(gSaveBlock1Ptr->unk_322C.wonderNews.data)); + gSaveBlock1Ptr->unk_322C.wonderNews.crc = 0; } static void sub_801B180(void) @@ -111,12 +111,12 @@ static void sub_801B180(void) bool32 sub_801B1A4(const u8 *src) { - const u8 *r5 = (const u8 *)&gSaveBlock1Ptr->unk_322C.buffer_000.data; + const u8 *r5 = (const u8 *)&gSaveBlock1Ptr->unk_322C.wonderNews.data; u32 i; if (!ValidateReceivedWonderNews()) return FALSE; - for (i = 0; i < sizeof(struct MEventBuffer_3120_Sub); i++) + for (i = 0; i < sizeof(struct WonderNews); i++) { if (r5[i] != src[i]) return FALSE; @@ -136,35 +136,35 @@ void DestroyWonderCard(void) ClearEReaderTrainer(&gSaveBlock2Ptr->frontier.ereaderTrainer); } -bool32 sub_801B21C(const struct MEventBuffer_32E0_Sub *data) +bool32 sub_801B21C(const struct WonderCard *data) { struct MEventBuffer_3430_Sub *r2; - struct MEventBuffer_32E0_Sub *r1; + struct WonderCard *r1; if (!sub_801B2CC(data)) return FALSE; DestroyWonderCard(); - memcpy(&gSaveBlock1Ptr->unk_322C.buffer_1c0.data, data, sizeof(struct MEventBuffer_32E0_Sub)); - gSaveBlock1Ptr->unk_322C.buffer_1c0.crc = CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.buffer_1c0.data, sizeof(struct MEventBuffer_32E0_Sub)); + memcpy(&gSaveBlock1Ptr->unk_322C.wonderCard.data, data, sizeof(struct WonderCard)); + gSaveBlock1Ptr->unk_322C.wonderCard.crc = CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.wonderCard.data, sizeof(struct WonderCard)); r2 = &gSaveBlock1Ptr->unk_322C.buffer_310.data; - r1 = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + r1 = &gSaveBlock1Ptr->unk_322C.wonderCard.data; r2->unk_06 = r1->unk_02; return TRUE; } bool32 ValidateReceivedWonderCard(void) { - if (gSaveBlock1Ptr->unk_322C.buffer_1c0.crc != CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.buffer_1c0.data, sizeof(struct MEventBuffer_32E0_Sub))) + if (gSaveBlock1Ptr->unk_322C.wonderCard.crc != CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_322C.wonderCard.data, sizeof(struct WonderCard))) return FALSE; - if (!sub_801B2CC(&gSaveBlock1Ptr->unk_322C.buffer_1c0.data)) + if (!sub_801B2CC(&gSaveBlock1Ptr->unk_322C.wonderCard.data)) return FALSE; - if (!sub_80991F8()) + if (!ValidateSavedRamScript()) return FALSE; return TRUE; } -static bool32 sub_801B2CC(const struct MEventBuffer_32E0_Sub *data) +static bool32 sub_801B2CC(const struct WonderCard *data) { if (data->unk_00 == 0) return FALSE; @@ -182,7 +182,7 @@ static bool32 sub_801B2CC(const struct MEventBuffer_32E0_Sub *data) bool32 WonderCard_Test_Unk_08_6(void) { - const struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + const struct WonderCard *data = &gSaveBlock1Ptr->unk_322C.wonderCard.data; if (data->unk_08_6 == 0) return FALSE; @@ -191,8 +191,8 @@ bool32 WonderCard_Test_Unk_08_6(void) static void sub_801B330(void) { - CpuFill32(0, &gSaveBlock1Ptr->unk_322C.buffer_1c0.data, sizeof(struct MEventBuffer_32E0_Sub)); - gSaveBlock1Ptr->unk_322C.buffer_1c0.crc = 0; + CpuFill32(0, &gSaveBlock1Ptr->unk_322C.wonderCard.data, sizeof(struct WonderCard)); + gSaveBlock1Ptr->unk_322C.wonderCard.crc = 0; } static void sub_801B368(void) @@ -204,12 +204,12 @@ static void sub_801B368(void) u16 GetWonderCardFlagID(void) { if (ValidateReceivedWonderCard()) - return gSaveBlock1Ptr->unk_322C.buffer_1c0.data.unk_00; + return gSaveBlock1Ptr->unk_322C.wonderCard.data.unk_00; return 0; } -void sub_801B3C0(struct MEventBuffer_32E0_Sub *buffer) +void WonderCard_ResetInternalReceivedFlag(struct WonderCard *buffer) { if (buffer->unk_08_6 == 1) buffer->unk_08_6 = 0; @@ -299,11 +299,11 @@ static bool32 sub_801B4A4(const u16 *data) static int sub_801B4CC(void) { - struct MEventBuffer_32E0_Sub *data; + struct WonderCard *data; if (!ValidateReceivedWonderCard()) return 0; - data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + data = &gSaveBlock1Ptr->unk_322C.wonderCard.data; if (data->unk_08_0 != 1) return 0; @@ -312,7 +312,7 @@ static int sub_801B4CC(void) bool32 sub_801B508(const u16 *data) { - struct MEventBuffer_32E0_Sub *buffer = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + struct WonderCard *buffer = &gSaveBlock1Ptr->unk_322C.wonderCard.data; int size = buffer->unk_09; int i; if (!sub_801B4A4(data)) @@ -355,9 +355,9 @@ void sub_801B580(struct MEventStruct_Unk1442CC *data, bool32 a1) if (ValidateReceivedWonderCard()) { - data->unk_14 = sav1_get_mevent_buffer_1()->unk_00; + data->unk_14 = GetSavedWonderCard()->unk_00; data->unk_20 = *sav1_get_mevent_buffer_2(); - data->unk_44 = sav1_get_mevent_buffer_1()->unk_09; + data->unk_44 = GetSavedWonderCard()->unk_09; } else { @@ -422,7 +422,7 @@ u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const vo return 2; } -bool32 sub_801B748(const struct MEventStruct_Unk1442CC *a0, const u16 *a1) +bool32 MEventStruct_Unk1442CC_CompareField_unk_16(const struct MEventStruct_Unk1442CC *a0, const u16 *a1) { int i; for (i = 0; i < 4; i++) @@ -439,7 +439,7 @@ static int sub_801B770(const struct MEventStruct_Unk1442CC *a0) return sub_801B438(&a0->unk_20, a0->unk_44); } -u16 sub_801B784(const struct MEventStruct_Unk1442CC *a0, u32 command) +u16 MEventStruct_Unk1442CC_GetValueNFrom_unk_20(const struct MEventStruct_Unk1442CC *a0, u32 command) { switch (command) { @@ -461,7 +461,7 @@ u16 sub_801B784(const struct MEventStruct_Unk1442CC *a0, u32 command) static void sub_801B7D8(u32 command) { - struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + struct WonderCard *data = &gSaveBlock1Ptr->unk_322C.wonderCard.data; if (data->unk_08_0 == 2) { u16 *dest = NULL; @@ -495,7 +495,7 @@ u16 mevent_081445C0(u32 command) { case 0: { - struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + struct WonderCard *data = &gSaveBlock1Ptr->unk_322C.wonderCard.data; if (data->unk_08_0 == 2) { struct MEventBuffer_3430_Sub *buffer = &gSaveBlock1Ptr->unk_322C.buffer_310.data; @@ -505,7 +505,7 @@ u16 mevent_081445C0(u32 command) } case 1: { - struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + struct WonderCard *data = &gSaveBlock1Ptr->unk_322C.wonderCard.data; if (data->unk_08_0 == 2) { struct MEventBuffer_3430_Sub *buffer = &gSaveBlock1Ptr->unk_322C.buffer_310.data; @@ -515,7 +515,7 @@ u16 mevent_081445C0(u32 command) } case 2: { - struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + struct WonderCard *data = &gSaveBlock1Ptr->unk_322C.wonderCard.data; if (data->unk_08_0 == 2) { struct MEventBuffer_3430_Sub *buffer = &gSaveBlock1Ptr->unk_322C.buffer_310.data; @@ -525,14 +525,14 @@ u16 mevent_081445C0(u32 command) } case 3: { - struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + struct WonderCard *data = &gSaveBlock1Ptr->unk_322C.wonderCard.data; if (data->unk_08_0 == 1) return sub_801B4CC(); break; } case 4: { - struct MEventBuffer_32E0_Sub *data = &gSaveBlock1Ptr->unk_322C.buffer_1c0.data; + struct WonderCard *data = &gSaveBlock1Ptr->unk_322C.wonderCard.data; if (data->unk_08_0 == 1) return data->unk_09; break; @@ -557,7 +557,7 @@ bool32 sub_801B94C(u16 a0) if (!ValidateReceivedWonderCard()) return FALSE; - if (gSaveBlock1Ptr->unk_322C.buffer_1c0.data.unk_00 != a0) + if (gSaveBlock1Ptr->unk_322C.wonderCard.data.unk_00 != a0) return FALSE; gUnknown_02022C70 = TRUE; diff --git a/src/mevent_801BAAC.c b/src/mevent_801BAAC.c index 24a999f69..62240af98 100644 --- a/src/mevent_801BAAC.c +++ b/src/mevent_801BAAC.c @@ -35,7 +35,7 @@ struct UnkStruct_203F3C8_02DC struct UnkStruct_203F3C8 { - /*0000*/ struct MEventBuffer_32E0_Sub unk_0000; + /*0000*/ struct WonderCard unk_0000; /*014c*/ struct MEventBuffer_3430_Sub unk_014C; /*0170*/ const struct UnkStruct_8467FB8 * unk_0170; /*0174*/ u8 unk_0174; @@ -150,7 +150,7 @@ const struct UnkStruct_8467FB8 gUnknown_082F1D60[8] = { {1, 0, 0, 7, gWonderCardBgGfx8, gWonderCardBgTilemap8, gWonderCardBgPal8} }; -bool32 InitWonderCardResources(struct MEventBuffer_32E0_Sub * r5, struct MEventBuffer_3430_Sub * r6) +bool32 InitWonderCardResources(struct WonderCard * r5, struct MEventBuffer_3430_Sub * r6) { if (r5 == NULL || r6 == NULL) return FALSE; @@ -465,7 +465,7 @@ void sub_801C61C(void) struct UnkStruct_203F3CC { - /*0000*/ struct MEventBuffer_3120_Sub unk_0000; + /*0000*/ struct WonderNews unk_0000; /*01bc*/ const struct UnkStruct_8467FB8 * unk_01BC; /*01c0*/ u8 unk_01C0_0:1; u8 unk_01C0_1:7; @@ -542,7 +542,7 @@ const struct UnkStruct_8467FB8 gUnknown_082F24C8[] = { {1, 0, 0, 0, gWonderNewsGfx8, gWonderNewsTilemap8, gWonderNewsPal8} }; -bool32 InitWonderNewsResources(const struct MEventBuffer_3120_Sub * a0) +bool32 InitWonderNewsResources(const struct WonderNews * a0) { if (a0 == NULL) return FALSE; diff --git a/src/mevent_server.c b/src/mevent_server.c index fe13943ff..06b10dd95 100644 --- a/src/mevent_server.c +++ b/src/mevent_server.c @@ -46,8 +46,8 @@ static void mevent_srv_init_common(struct mevent_srv_common * svr, const void * { svr->unk_00 = 0; svr->mainseqno = 0; - svr->mevent_32e0 = AllocZeroed(sizeof(struct MEventBuffer_32E0_Sub)); - svr->mevent_3120 = AllocZeroed(sizeof(struct MEventBuffer_3120_Sub)); + svr->wonder_card = AllocZeroed(sizeof(struct WonderCard)); + svr->wonder_news = AllocZeroed(sizeof(struct WonderNews)); svr->recvBuffer = AllocZeroed(ME_SEND_BUF_SIZE); svr->mevent_unk1442cc = AllocZeroed(sizeof(struct MEventStruct_Unk1442CC)); svr->cmdBuffer = cmdBuffer; @@ -57,8 +57,8 @@ static void mevent_srv_init_common(struct mevent_srv_common * svr, const void * static void mevent_srv_free_resources(struct mevent_srv_common * svr) { - Free(svr->mevent_32e0); - Free(svr->mevent_3120); + Free(svr->wonder_card); + Free(svr->wonder_news); Free(svr->recvBuffer); Free(svr->mevent_unk1442cc); } @@ -176,7 +176,7 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr) case 7: // check_crc AGB_ASSERT(cmd->flag == FALSE); - ptr = mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_32e0); + ptr = mevent_first_if_not_null_else_second(cmd->parameter, svr->wonder_card); svr->param = sub_801B6EC(ptr, svr->mevent_unk1442cc, ptr); break; case 8: @@ -192,11 +192,11 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr) break; case 10: AGB_ASSERT(cmd->parameter == NULL); - svr->param = sub_801B784(svr->mevent_unk1442cc, cmd->flag); + svr->param = MEventStruct_Unk1442CC_GetValueNFrom_unk_20(svr->mevent_unk1442cc, cmd->flag); break; case 11: AGB_ASSERT(cmd->flag == FALSE); - svr->param = sub_801B748(svr->mevent_unk1442cc, cmd->parameter); + svr->param = MEventStruct_Unk1442CC_CompareField_unk_16(svr->mevent_unk1442cc, cmd->parameter); break; case 12: AGB_ASSERT(cmd->flag == FALSE); @@ -204,11 +204,11 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr) break; case 14: AGB_ASSERT(cmd->flag == FALSE); - mevent_srv_common_init_send(svr, 0x17, mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_3120), sizeof(struct MEventBuffer_3120_Sub)); + mevent_srv_common_init_send(svr, 0x17, mevent_first_if_not_null_else_second(cmd->parameter, svr->wonder_news), sizeof(struct WonderNews)); break; case 13: AGB_ASSERT(cmd->flag == FALSE); - mevent_srv_common_init_send(svr, 0x16, mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_32e0), sizeof(struct MEventBuffer_32E0_Sub)); + mevent_srv_common_init_send(svr, 0x16, mevent_first_if_not_null_else_second(cmd->parameter, svr->wonder_card), sizeof(struct WonderCard)); break; case 16: AGB_ASSERT(cmd->flag == FALSE); @@ -238,11 +238,11 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr) break; case 22: AGB_ASSERT(cmd->flag == FALSE); - memcpy(svr->mevent_32e0, cmd->parameter, 332); + memcpy(svr->wonder_card, cmd->parameter, 332); break; case 23: AGB_ASSERT(cmd->flag == FALSE); - memcpy(svr->mevent_3120, cmd->parameter, 444); + memcpy(svr->wonder_news, cmd->parameter, 444); break; case 21: AGB_ASSERT(cmd->flag == FALSE); @@ -258,16 +258,16 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr) break; case 26: AGB_ASSERT(cmd->flag == FALSE && cmd->parameter == NULL); - memcpy(svr->mevent_32e0, sav1_get_mevent_buffer_1(), 332); - sub_801B3C0(svr->mevent_32e0); + memcpy(svr->wonder_card, GetSavedWonderCard(), 332); + WonderCard_ResetInternalReceivedFlag(svr->wonder_card); break; case 27: AGB_ASSERT(cmd->flag == FALSE && cmd->parameter == NULL); - memcpy(svr->mevent_3120, sav1_get_mevent_buffer_0(), 444); + memcpy(svr->wonder_news, GetSavedWonderNews(), 444); break; case 28: AGB_ASSERT(cmd->flag == FALSE && cmd->parameter == NULL); - svr->sendBuffer1 = sub_8099244(); + svr->sendBuffer1 = GetSavedRamScriptIfValid(); break; case 29: mevent_srv_common_init_send(svr, 0x1b, cmd->parameter, cmd->flag); diff --git a/src/mevent_server_ish.c b/src/mevent_server_ish.c index 0303bfd9b..48f72eaad 100644 --- a/src/mevent_server_ish.c +++ b/src/mevent_server_ish.c @@ -216,7 +216,7 @@ static u32 ish_mainseq_4(struct mevent_srv_ish * svr) sub_801B508(svr->recvBuffer); break; case 17: - sub_80992A0(svr->recvBuffer, 1000); + InitRamScript_NoEventObject(svr->recvBuffer, 1000); break; case 18: memcpy(&gSaveBlock2Ptr->frontier.ereaderTrainer, svr->recvBuffer, 0xbc); diff --git a/src/mystery_gift.c b/src/mystery_gift.c index c8b3a9060..c935e9b25 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -815,11 +815,11 @@ static bool32 HandleLoadWonderCardOrNews(u8 * state, bool32 cardOrNews) case 0: if (cardOrNews == 0) { - InitWonderCardResources(sav1_get_mevent_buffer_1(), sav1_get_mevent_buffer_2()); + InitWonderCardResources(GetSavedWonderCard(), sav1_get_mevent_buffer_2()); } else { - InitWonderNewsResources(sav1_get_mevent_buffer_0()); + InitWonderNewsResources(GetSavedWonderNews()); } (*state)++; break; diff --git a/src/scrcmd.c b/src/scrcmd.c index 314504600..0b1006cef 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -2217,7 +2217,7 @@ bool8 ScrCmd_checkmonobedience(struct ScriptContext *ctx) bool8 ScrCmd_cmdCF(struct ScriptContext *ctx) { - const u8* v1 = sub_8099244(); + const u8* v1 = GetSavedRamScriptIfValid(); if (v1) { diff --git a/src/script.c b/src/script.c index cb06300bf..27476dba3 100644 --- a/src/script.c +++ b/src/script.c @@ -386,7 +386,7 @@ const u8 *GetRamScript(u8 objectId, const u8 *script) } } -bool32 sub_80991F8(void) +bool32 ValidateSavedRamScript(void) { struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data; if (scriptData->magic != RAM_SCRIPT_MAGIC) @@ -402,7 +402,7 @@ bool32 sub_80991F8(void) return TRUE; } -u8 *sub_8099244(void) +u8 *GetSavedRamScriptIfValid(void) { struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data; if (!ValidateReceivedWonderCard()) @@ -426,7 +426,7 @@ u8 *sub_8099244(void) } } -void sub_80992A0(u8 *script, u16 scriptSize) +void InitRamScript_NoEventObject(u8 *script, u16 scriptSize) { if (scriptSize > sizeof(gSaveBlock1Ptr->ramScript.data.script)) scriptSize = sizeof(gSaveBlock1Ptr->ramScript.data.script); From d0384ee95e124f16e33cdfbf1d18d02ef97145b4 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 14:02:13 -0400 Subject: [PATCH 074/101] mevent_server_ish --> mevent_client --- .../{mevent_server_ish.h => mevent_client.h} | 16 ++-- ld_script.txt | 4 +- src/{mevent_server_ish.c => mevent_client.c} | 90 +++++++++---------- src/mevent_scripts.c | 28 +++--- src/mystery_gift.c | 52 +++++------ sym_ewram.txt | 2 +- 6 files changed, 96 insertions(+), 96 deletions(-) rename include/{mevent_server_ish.h => mevent_client.h} (58%) rename src/{mevent_server_ish.c => mevent_client.c} (66%) diff --git a/include/mevent_server_ish.h b/include/mevent_client.h similarity index 58% rename from include/mevent_server_ish.h rename to include/mevent_client.h index 35833ea12..58893794e 100644 --- a/include/mevent_server_ish.h +++ b/include/mevent_client.h @@ -3,13 +3,13 @@ #include "mevent_server_helpers.h" -struct mevent_cmd_ish +struct mevent_client_cmd { u32 instr; u32 parameter; }; -struct mevent_srv_ish +struct mevent_client { u32 unk_00; u32 param; @@ -18,16 +18,16 @@ struct mevent_srv_ish u32 cmdidx; void * sendBuffer; void * recvBuffer; - struct mevent_cmd_ish * cmdBuffer; + struct mevent_client_cmd * cmdBuffer; void * buffer; struct mevent_srv_sub manager; u32 unk_4C; }; -void mevent_srv_ish_do_init(u32 arg); -u32 mevent_srv_ish_do_exec(u16 * a0); -void mevent_srv_ish_inc_flag(void); -void * mevent_srv_ish_get_buffer(void); -void mevent_srv_ish_set_param(u32 a0); +void mevent_client_do_init(u32 arg); +u32 mevent_client_do_exec(u16 * a0); +void mevent_client_inc_flag(void); +void * mevent_client_get_buffer(void); +void mevent_client_set_param(u32 a0); #endif //GUARD_MEVENT_SERVER_ISH_H diff --git a/ld_script.txt b/ld_script.txt index c5ffc06fe..af70cafb7 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -61,7 +61,7 @@ SECTIONS { src/mevent2.o(.text); src/mevent_801BAAC.o(.text); src/mevent_server.o(.text); - src/mevent_server_ish.o(.text); + src/mevent_client.o(.text); src/mevent_server_helpers.o(.text); src/mevent_news.o(.text); src/union_room_chat.o(.text); @@ -417,7 +417,7 @@ SECTIONS { src/mevent2.o(.rodata); src/mevent_801BAAC.o(.rodata); src/mevent_server.o(.rodata); - src/mevent_server_ish.o(.rodata); + src/mevent_client.o(.rodata); src/mevent_scripts.o(.rodata); src/union_room_chat.o(.rodata); data/union_room_chat.o(.rodata); diff --git a/src/mevent_server_ish.c b/src/mevent_client.c similarity index 66% rename from src/mevent_server_ish.c rename to src/mevent_client.c index 48f72eaad..cdf976a41 100644 --- a/src/mevent_server_ish.c +++ b/src/mevent_client.c @@ -6,55 +6,55 @@ #include "battle_tower.h" #include "mevent.h" #include "mystery_event_script.h" -#include "mevent_server_ish.h" +#include "mevent_client.h" -EWRAM_DATA struct mevent_srv_ish * s_mevent_srv_ish_ptr = NULL; +EWRAM_DATA struct mevent_client * s_mevent_client_ptr = NULL; -static void mevent_srv_ish_init(struct mevent_srv_ish *, u32, u32); -static u32 mevent_srv_ish_exec(struct mevent_srv_ish *); -static void mevent_srv_ish_free_resources(struct mevent_srv_ish *); +static void mevent_client_init(struct mevent_client *, u32, u32); +static u32 mevent_client_exec(struct mevent_client *); +static void mevent_client_free_resources(struct mevent_client *); -extern const struct mevent_cmd_ish gUnknown_082F2598[]; +extern const struct mevent_client_cmd gUnknown_082F2598[]; -void mevent_srv_ish_do_init(u32 arg) +void mevent_client_do_init(u32 arg) { - s_mevent_srv_ish_ptr = AllocZeroed(sizeof(struct mevent_srv_ish)); - mevent_srv_ish_init(s_mevent_srv_ish_ptr, 1, 0); - s_mevent_srv_ish_ptr->unk_4C = arg; + s_mevent_client_ptr = AllocZeroed(sizeof(struct mevent_client)); + mevent_client_init(s_mevent_client_ptr, 1, 0); + s_mevent_client_ptr->unk_4C = arg; } -u32 mevent_srv_ish_do_exec(u16 * a0) +u32 mevent_client_do_exec(u16 * a0) { u32 result; - if (s_mevent_srv_ish_ptr == NULL) + if (s_mevent_client_ptr == NULL) return 6; - result = mevent_srv_ish_exec(s_mevent_srv_ish_ptr); + result = mevent_client_exec(s_mevent_client_ptr); if (result == 6) { - *a0 = s_mevent_srv_ish_ptr->param; - mevent_srv_ish_free_resources(s_mevent_srv_ish_ptr); - Free(s_mevent_srv_ish_ptr); - s_mevent_srv_ish_ptr = NULL; + *a0 = s_mevent_client_ptr->param; + mevent_client_free_resources(s_mevent_client_ptr); + Free(s_mevent_client_ptr); + s_mevent_client_ptr = NULL; } return result; } -void mevent_srv_ish_inc_flag(void) +void mevent_client_inc_flag(void) { - s_mevent_srv_ish_ptr->flag++; + s_mevent_client_ptr->flag++; } -void * mevent_srv_ish_get_buffer(void) +void * mevent_client_get_buffer(void) { - return s_mevent_srv_ish_ptr->buffer; + return s_mevent_client_ptr->buffer; } -void mevent_srv_ish_set_param(u32 a0) +void mevent_client_set_param(u32 a0) { - s_mevent_srv_ish_ptr->param = a0; + s_mevent_client_ptr->param = a0; } -static void mevent_srv_ish_init(struct mevent_srv_ish * svr, u32 sendPlayerNo, u32 recvPlayerNo) +static void mevent_client_init(struct mevent_client * svr, u32 sendPlayerNo, u32 recvPlayerNo) { svr->unk_00 = 0; svr->mainseqno = 0; @@ -66,7 +66,7 @@ static void mevent_srv_ish_init(struct mevent_srv_ish * svr, u32 sendPlayerNo, u mevent_srv_sub_init(&svr->manager, sendPlayerNo, recvPlayerNo); } -static void mevent_srv_ish_free_resources(struct mevent_srv_ish * svr) +static void mevent_client_free_resources(struct mevent_client * svr) { Free(svr->sendBuffer); Free(svr->recvBuffer); @@ -74,20 +74,20 @@ static void mevent_srv_ish_free_resources(struct mevent_srv_ish * svr) Free(svr->buffer); } -static void mevent_srv_ish_jmp_buffer(struct mevent_srv_ish * svr) +static void mevent_client_jmp_buffer(struct mevent_client * svr) { memcpy(svr->cmdBuffer, svr->recvBuffer, ME_SEND_BUF_SIZE); svr->cmdidx = 0; } -static void mevent_srv_ish_send_word(struct mevent_srv_ish * svr, u32 ident, u32 word) +static void mevent_client_send_word(struct mevent_client * svr, u32 ident, u32 word) { CpuFill32(0, svr->sendBuffer, ME_SEND_BUF_SIZE); *(u32 *)svr->sendBuffer = word; mevent_srv_sub_init_send(&svr->manager, ident, svr->sendBuffer, sizeof(u32)); } -static u32 ish_mainseq_0(struct mevent_srv_ish * svr) +static u32 ish_mainseq_0(struct mevent_client * svr) { // init memcpy(svr->cmdBuffer, gUnknown_082F2598, ME_SEND_BUF_SIZE); @@ -97,14 +97,14 @@ static u32 ish_mainseq_0(struct mevent_srv_ish * svr) return 0; } -static u32 ish_mainseq_1(struct mevent_srv_ish * svr) +static u32 ish_mainseq_1(struct mevent_client * svr) { // done return 6; } -static u32 ish_mainseq_2(struct mevent_srv_ish * svr) +static u32 ish_mainseq_2(struct mevent_client * svr) { // do recv if (mevent_srv_sub_recv(&svr->manager)) @@ -115,7 +115,7 @@ static u32 ish_mainseq_2(struct mevent_srv_ish * svr) return 1; } -static u32 ish_mainseq_3(struct mevent_srv_ish * svr) +static u32 ish_mainseq_3(struct mevent_client * svr) { // do send if (mevent_srv_sub_send(&svr->manager)) @@ -126,10 +126,10 @@ static u32 ish_mainseq_3(struct mevent_srv_ish * svr) return 1; } -static u32 ish_mainseq_4(struct mevent_srv_ish * svr) +static u32 ish_mainseq_4(struct mevent_client * svr) { // process command - struct mevent_cmd_ish * cmd = &svr->cmdBuffer[svr->cmdidx]; + struct mevent_client_cmd * cmd = &svr->cmdBuffer[svr->cmdidx]; ++svr->cmdidx; switch (cmd->instr) { @@ -155,20 +155,20 @@ static u32 ish_mainseq_4(struct mevent_srv_ish * svr) svr->flag = 0; break; case 19: - mevent_srv_ish_send_word(svr, 0x12, GetGameStat(cmd->parameter)); + mevent_client_send_word(svr, 0x12, GetGameStat(cmd->parameter)); svr->mainseqno = 3; svr->flag = 0; break; case 6: if (svr->param == 0) - mevent_srv_ish_jmp_buffer(svr); + mevent_client_jmp_buffer(svr); break; case 7: if (svr->param == 1) - mevent_srv_ish_jmp_buffer(svr); + mevent_client_jmp_buffer(svr); break; case 4: - mevent_srv_ish_jmp_buffer(svr); + mevent_client_jmp_buffer(svr); break; case 5: memcpy(svr->buffer, svr->recvBuffer, 0x40); @@ -194,7 +194,7 @@ static u32 ish_mainseq_4(struct mevent_srv_ish * svr) mevent_srv_sub_init_send(&svr->manager, 0x11, svr->sendBuffer, sizeof(struct MEventStruct_Unk1442CC)); break; case 14: - mevent_srv_ish_send_word(svr, 0x13, svr->param); + mevent_client_send_word(svr, 0x13, svr->param); break; case 10: sub_801B21C(svr->recvBuffer); @@ -203,10 +203,10 @@ static u32 ish_mainseq_4(struct mevent_srv_ish * svr) if (!sub_801B1A4(svr->recvBuffer)) { sub_801B078(svr->recvBuffer); - mevent_srv_ish_send_word(svr, 0x13, 0); + mevent_client_send_word(svr, 0x13, 0); } else - mevent_srv_ish_send_word(svr, 0x13, 1); + mevent_client_send_word(svr, 0x13, 1); break; case 15: svr->mainseqno = 6; @@ -232,7 +232,7 @@ static u32 ish_mainseq_4(struct mevent_srv_ish * svr) return 1; } -static u32 ish_mainseq_5(struct mevent_srv_ish * svr) +static u32 ish_mainseq_5(struct mevent_client * svr) { // wait flag if (svr->flag) @@ -243,7 +243,7 @@ static u32 ish_mainseq_5(struct mevent_srv_ish * svr) return 1; } -static u32 ish_mainseq_6(struct mevent_srv_ish * svr) +static u32 ish_mainseq_6(struct mevent_client * svr) { // ??? switch (svr->flag) @@ -263,7 +263,7 @@ static u32 ish_mainseq_6(struct mevent_srv_ish * svr) return 1; } -static u32 ish_mainseq_7(struct mevent_srv_ish * svr) +static u32 ish_mainseq_7(struct mevent_client * svr) { // exec arbitrary code u32 (*func)(u32 *, struct SaveBlock2 *, struct SaveBlock1 *) = (void *)gDecompressionBuffer; @@ -275,9 +275,9 @@ static u32 ish_mainseq_7(struct mevent_srv_ish * svr) return 1; } -static u32 mevent_srv_ish_exec(struct mevent_srv_ish * svr) +static u32 mevent_client_exec(struct mevent_client * svr) { - u32 (*funcs[])(struct mevent_srv_ish *) = { + u32 (*funcs[])(struct mevent_client *) = { ish_mainseq_0, ish_mainseq_1, ish_mainseq_2, diff --git a/src/mevent_scripts.c b/src/mevent_scripts.c index 29b37119e..41a5ddd51 100644 --- a/src/mevent_scripts.c +++ b/src/mevent_scripts.c @@ -1,38 +1,38 @@ #include "global.h" -#include "mevent_server_ish.h" +#include "mevent_client.h" #include "mevent_server.h" const u8 gText_CanceledReadingCard[] = _("Canceled reading\nthe Card."); -const struct mevent_cmd_ish gUnknown_082F2598[] = { +const struct mevent_client_cmd gUnknown_082F2598[] = { {.instr = 2, .parameter = 16}, {.instr = 4, .parameter = 0} }; -const struct mevent_cmd_ish gUnknown_082F25A8[] = { +const struct mevent_client_cmd gUnknown_082F25A8[] = { {.instr = 8, .parameter = 0}, {.instr = 3, .parameter = 0}, {.instr = 2, .parameter = 16}, {.instr = 4, .parameter = 0} }; -const struct mevent_cmd_ish gUnknown_082F25C8[] = { +const struct mevent_client_cmd gUnknown_082F25C8[] = { {.instr = 20, .parameter = 0}, {.instr = 1, .parameter = 10} }; -const struct mevent_cmd_ish gUnknown_082F25D8[] = { +const struct mevent_client_cmd gUnknown_082F25D8[] = { {.instr = 20, .parameter = 0}, {.instr = 1, .parameter = 11} }; -const struct mevent_cmd_ish gUnknown_082F25E8[] = { +const struct mevent_client_cmd gUnknown_082F25E8[] = { {.instr = 20, .parameter = 0}, {.instr = 1, .parameter = 0} }; -const struct mevent_cmd_ish gUnknown_082F25F8[] = { +const struct mevent_client_cmd gUnknown_082F25F8[] = { {.instr = 2, .parameter = 22}, {.instr = 10, .parameter = 0}, {.instr = 2, .parameter = 25}, @@ -41,7 +41,7 @@ const struct mevent_cmd_ish gUnknown_082F25F8[] = { {.instr = 1, .parameter = 2} }; -const struct mevent_cmd_ish gUnknown_082F2628[] = { +const struct mevent_client_cmd gUnknown_082F2628[] = { {.instr = 2, .parameter = 23}, {.instr = 9, .parameter = 0}, {.instr = 3, .parameter = 0}, @@ -49,17 +49,17 @@ const struct mevent_cmd_ish gUnknown_082F2628[] = { {.instr = 4, .parameter = 0} }; -const struct mevent_cmd_ish gUnknown_082F2650[] = { +const struct mevent_client_cmd gUnknown_082F2650[] = { {.instr = 20, .parameter = 0}, {.instr = 1, .parameter = 7} }; -const struct mevent_cmd_ish gUnknown_082F2660[] = { +const struct mevent_client_cmd gUnknown_082F2660[] = { {.instr = 20, .parameter = 0}, {.instr = 1, .parameter = 3} }; -const struct mevent_cmd_ish gUnknown_082F2670[] = { +const struct mevent_client_cmd gUnknown_082F2670[] = { {.instr = 13, .parameter = 0}, {.instr = 14, .parameter = 0}, {.instr = 3, .parameter = 0}, @@ -67,17 +67,17 @@ const struct mevent_cmd_ish gUnknown_082F2670[] = { {.instr = 4, .parameter = 0} }; -const struct mevent_cmd_ish gUnknown_082F2698[] = { +const struct mevent_client_cmd gUnknown_082F2698[] = { {.instr = 20, .parameter = 0}, {.instr = 1, .parameter = 9} }; -const struct mevent_cmd_ish gUnknown_082F26A8[] = { +const struct mevent_client_cmd gUnknown_082F26A8[] = { {.instr = 20, .parameter = 0}, {.instr = 1, .parameter = 5} }; -const struct mevent_cmd_ish gUnknown_082F26B8[] = { +const struct mevent_client_cmd gUnknown_082F26B8[] = { {.instr = 2, .parameter = 21}, {.instr = 12, .parameter = 0}, {.instr = 20, .parameter = 0}, diff --git a/src/mystery_gift.c b/src/mystery_gift.c index c935e9b25..ab3df9020 100644 --- a/src/mystery_gift.c +++ b/src/mystery_gift.c @@ -25,7 +25,7 @@ #include "mevent_801BAAC.h" #include "save.h" #include "link.h" -#include "mevent_server_ish.h" +#include "mevent_client.h" #include "event_data.h" #include "link_rfu.h" #include "mevent_news.h" @@ -1269,7 +1269,7 @@ void task00_mystery_gift(u8 taskId) { ClearScreenInBg0(TRUE); data->state = 7; - mevent_srv_ish_do_init(data->IsCardOrNews); + mevent_client_do_init(data->IsCardOrNews); } else if (gSpecialVar_Result == 5) { @@ -1282,7 +1282,7 @@ void task00_mystery_gift(u8 taskId) data->state = 8; break; case 8: - switch (mevent_srv_ish_do_exec(&data->curPromptWindowId)) + switch (mevent_client_do_exec(&data->curPromptWindowId)) { case 6: task_add_05_task_del_08FA224_when_no_RfuFunc(); @@ -1290,8 +1290,8 @@ void task00_mystery_gift(u8 taskId) data->state = 13; break; case 5: - memcpy(data->buffer, mevent_srv_ish_get_buffer(), 0x40); - mevent_srv_ish_inc_flag(); + memcpy(data->buffer, mevent_client_get_buffer(), 0x40); + mevent_client_inc_flag(); break; case 3: data->state = 10; @@ -1306,29 +1306,29 @@ void task00_mystery_gift(u8 taskId) } break; case 9: - switch ((u32)mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, mevent_srv_ish_get_buffer())) + switch ((u32)mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, mevent_client_get_buffer())) { case 0: - mevent_srv_ish_set_param(0); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(0); + mevent_client_inc_flag(); data->state = 7; break; case 1: - mevent_srv_ish_set_param(1); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(1); + mevent_client_inc_flag(); data->state = 7; break; case -1u: - mevent_srv_ish_set_param(1); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(1); + mevent_client_inc_flag(); data->state = 7; break; } break; case 10: - if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, mevent_srv_ish_get_buffer())) + if (MG_PrintTextOnWindow1AndWaitButton(&data->textState, mevent_client_get_buffer())) { - mevent_srv_ish_inc_flag(); + mevent_client_inc_flag(); data->state = 7; } break; @@ -1342,19 +1342,19 @@ void task00_mystery_gift(u8 taskId) } else { - mevent_srv_ish_set_param(0); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(0); + mevent_client_inc_flag(); data->state = 7; } break; case 1: - mevent_srv_ish_set_param(1); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(1); + mevent_client_inc_flag(); data->state = 7; break; case -1u: - mevent_srv_ish_set_param(1); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(1); + mevent_client_inc_flag(); data->state = 7; break; } @@ -1363,18 +1363,18 @@ void task00_mystery_gift(u8 taskId) switch ((u32)mevent_message_print_and_prompt_yes_no(&data->textState, &data->curPromptWindowId, FALSE, gText_HaventReceivedCardsGift)) { case 0: - mevent_srv_ish_set_param(0); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(0); + mevent_client_inc_flag(); data->state = 7; break; case 1: - mevent_srv_ish_set_param(1); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(1); + mevent_client_inc_flag(); data->state = 7; break; case -1u: - mevent_srv_ish_set_param(1); - mevent_srv_ish_inc_flag(); + mevent_client_set_param(1); + mevent_client_inc_flag(); data->state = 7; break; } diff --git a/sym_ewram.txt b/sym_ewram.txt index 06e3180a0..25cf13069 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -13,7 +13,7 @@ .include "src/mevent2.o" .include "src/mevent_801BAAC.o" .include "src/mevent_server.o" - .include "src/mevent_server_ish.o" + .include "src/mevent_client.o" @ union_room_chat .align 2 From 33ee31b2e099a3e2cefa2542f710d51087e09a83 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 2 Apr 2019 14:48:27 -0400 Subject: [PATCH 075/101] remove last remaining trace of "ish" --- src/mevent_client.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/mevent_client.c b/src/mevent_client.c index cdf976a41..ec8908af2 100644 --- a/src/mevent_client.c +++ b/src/mevent_client.c @@ -87,7 +87,7 @@ static void mevent_client_send_word(struct mevent_client * svr, u32 ident, u32 w mevent_srv_sub_init_send(&svr->manager, ident, svr->sendBuffer, sizeof(u32)); } -static u32 ish_mainseq_0(struct mevent_client * svr) +static u32 mainseq_0(struct mevent_client * svr) { // init memcpy(svr->cmdBuffer, gUnknown_082F2598, ME_SEND_BUF_SIZE); @@ -97,14 +97,14 @@ static u32 ish_mainseq_0(struct mevent_client * svr) return 0; } -static u32 ish_mainseq_1(struct mevent_client * svr) +static u32 mainseq_1(struct mevent_client * svr) { // done return 6; } -static u32 ish_mainseq_2(struct mevent_client * svr) +static u32 mainseq_2(struct mevent_client * svr) { // do recv if (mevent_srv_sub_recv(&svr->manager)) @@ -115,7 +115,7 @@ static u32 ish_mainseq_2(struct mevent_client * svr) return 1; } -static u32 ish_mainseq_3(struct mevent_client * svr) +static u32 mainseq_3(struct mevent_client * svr) { // do send if (mevent_srv_sub_send(&svr->manager)) @@ -126,7 +126,7 @@ static u32 ish_mainseq_3(struct mevent_client * svr) return 1; } -static u32 ish_mainseq_4(struct mevent_client * svr) +static u32 mainseq_4(struct mevent_client * svr) { // process command struct mevent_client_cmd * cmd = &svr->cmdBuffer[svr->cmdidx]; @@ -232,7 +232,7 @@ static u32 ish_mainseq_4(struct mevent_client * svr) return 1; } -static u32 ish_mainseq_5(struct mevent_client * svr) +static u32 mainseq_5(struct mevent_client * svr) { // wait flag if (svr->flag) @@ -243,7 +243,7 @@ static u32 ish_mainseq_5(struct mevent_client * svr) return 1; } -static u32 ish_mainseq_6(struct mevent_client * svr) +static u32 mainseq_6(struct mevent_client * svr) { // ??? switch (svr->flag) @@ -263,7 +263,7 @@ static u32 ish_mainseq_6(struct mevent_client * svr) return 1; } -static u32 ish_mainseq_7(struct mevent_client * svr) +static u32 mainseq_7(struct mevent_client * svr) { // exec arbitrary code u32 (*func)(u32 *, struct SaveBlock2 *, struct SaveBlock1 *) = (void *)gDecompressionBuffer; @@ -278,14 +278,14 @@ static u32 ish_mainseq_7(struct mevent_client * svr) static u32 mevent_client_exec(struct mevent_client * svr) { u32 (*funcs[])(struct mevent_client *) = { - ish_mainseq_0, - ish_mainseq_1, - ish_mainseq_2, - ish_mainseq_3, - ish_mainseq_4, - ish_mainseq_5, - ish_mainseq_6, - ish_mainseq_7 + mainseq_0, + mainseq_1, + mainseq_2, + mainseq_3, + mainseq_4, + mainseq_5, + mainseq_6, + mainseq_7 }; return funcs[svr->mainseqno](svr); } From 4fadbaf16153c0160f6ad38dc0053e7ff6db7472 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 3 Apr 2019 09:55:17 -0400 Subject: [PATCH 076/101] Minor fixes gotoram --> returnram cmdCF/execram --> gotoram fix indentation in sym_ewram.txt fix mevent_client.h guard name --- asm/macros/event.inc | 4 ++-- data/mystery_event_msg.s | 2 +- data/script_cmd_table.inc | 4 ++-- data/scripts/cable_club.inc | 2 +- include/link_rfu.h | 2 +- include/mevent_client.h | 6 +++--- src/link_rfu.c | 2 +- src/mevent_server_helpers.c | 8 ++++---- src/overworld.c | 2 +- src/scrcmd.c | 4 ++-- sym_ewram.txt | 14 +++++++------- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/asm/macros/event.inc b/asm/macros/event.inc index 8b3466fe7..e00bdb600 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -77,7 +77,7 @@ .endm @ Executes a script stored in a default RAM location. - .macro gotoram + .macro returnram .byte 0x0c .endm @@ -1440,7 +1440,7 @@ .endm @ Depending on factors I haven't managed to understand yet, this command may cause script execution to jump to the offset specified by the pointer at 0x020375C0. - .macro execram + .macro gotoram .byte 0xcf .endm diff --git a/data/mystery_event_msg.s b/data/mystery_event_msg.s index 24a075181..dd1f8e681 100644 --- a/data/mystery_event_msg.s +++ b/data/mystery_event_msg.s @@ -36,7 +36,7 @@ MysteryEventScript_SurfPichu:: @ 8674D3D setvaddress MysteryEventScript_SurfPichu checkflag FLAG_MYSTERY_EVENT_DONE vgoto_if 0, SurfPichu_GiveIfPossible - gotoram + returnram SurfPichu_GiveIfPossible: @ 8674D4C specialvar VAR_EVENT_PICHU_SLOT, CalculatePlayerPartyCount diff --git a/data/script_cmd_table.inc b/data/script_cmd_table.inc index 39864b2a8..e9a14437a 100644 --- a/data/script_cmd_table.inc +++ b/data/script_cmd_table.inc @@ -12,7 +12,7 @@ gScriptCmdTable:: @ 81DB67C .4byte ScrCmd_callstd .4byte ScrCmd_gotostd_if .4byte ScrCmd_callstd_if - .4byte ScrCmd_gotoram + .4byte ScrCmd_returnram .4byte ScrCmd_killscript .4byte ScrCmd_setmysteryeventstatus .4byte ScrCmd_loadword @@ -207,7 +207,7 @@ gScriptCmdTable:: @ 81DB67C .4byte ScrCmd_nop1 .4byte ScrCmd_setmonobedient .4byte ScrCmd_checkmonobedience - .4byte ScrCmd_cmdCF + .4byte ScrCmd_gotoram .4byte ScrCmd_nop1 .4byte ScrCmd_warpD1 .4byte ScrCmd_setmonmetlocation diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc index e0b289899..c755493dc 100644 --- a/data/scripts/cable_club.inc +++ b/data/scripts/cable_club.inc @@ -60,7 +60,7 @@ VerdanturfTown_PokemonCenter_2F_EventScript_276B03:: @ 8276B03 end OldaleTown_PokemonCenter_2F_EventScript_276B19:: @ 8276B19 - execram + gotoram OldaleTown_PokemonCenter_2F_EventScript_276B1A:: @ 8276B1A msgbox gUnknown_08273178, MSGBOX_NPC diff --git a/include/link_rfu.h b/include/link_rfu.h index b8ba1a927..edfd0ed20 100644 --- a/include/link_rfu.h +++ b/include/link_rfu.h @@ -284,7 +284,7 @@ bool8 sub_800DE7C(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx); bool8 sub_800DF34(struct UnkLinkRfuStruct_02022B14 *buff1, u8 *buff2, u8 idx); s32 sub_800E87C(u8 idx); void sub_8011BA4(void); -void sub_8010198(void); +void LinkRfu_FatalError(void); bool32 sub_8011A9C(void); void sub_80104B0(void); void sub_8011A50(void); diff --git a/include/mevent_client.h b/include/mevent_client.h index 58893794e..c32d14d7a 100644 --- a/include/mevent_client.h +++ b/include/mevent_client.h @@ -1,5 +1,5 @@ -#ifndef GUARD_MEVENT_SERVER_ISH_H -#define GUARD_MEVENT_SERVER_ISH_H +#ifndef GUARD_MEVENT_CLIENT_H +#define GUARD_MEVENT_CLIENT_H #include "mevent_server_helpers.h" @@ -30,4 +30,4 @@ void mevent_client_inc_flag(void); void * mevent_client_get_buffer(void); void mevent_client_set_param(u32 a0); -#endif //GUARD_MEVENT_SERVER_ISH_H +#endif //GUARD_MEVENT_CLIENT_H diff --git a/src/link_rfu.c b/src/link_rfu.c index 1e4c9c7e6..7c55df783 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -3674,7 +3674,7 @@ void sub_8010168(void) gUnknown_03005000.unk_00 = sub_8010148; } -void sub_8010198(void) +void LinkRfu_FatalError(void) { sub_800D630(); gUnknown_03005000.unk_ce4 = 1; diff --git a/src/mevent_server_helpers.c b/src/mevent_server_helpers.c index af14b514c..9d47ba745 100644 --- a/src/mevent_server_helpers.c +++ b/src/mevent_server_helpers.c @@ -96,12 +96,12 @@ static bool32 mevent_receive_func(struct mevent_srv_sub * svr) svr->recvCRC = header.crc; if (svr->recvSize > ME_SEND_BUF_SIZE) { - sub_8010198(); + LinkRfu_FatalError(); return FALSE; } else if (svr->recvIdent != header.ident) { - sub_8010198(); + LinkRfu_FatalError(); return FALSE; } else @@ -133,7 +133,7 @@ static bool32 mevent_receive_func(struct mevent_srv_sub * svr) case 2: if (CalcCRC16WithTable(svr->recvBfr, svr->recvSize) != svr->recvCRC) { - sub_8010198(); + LinkRfu_FatalError(); return FALSE; } else @@ -192,7 +192,7 @@ static bool32 mevent_send_func(struct mevent_srv_sub * svr) if (IsLinkTaskFinished()) { if (CalcCRC16WithTable(svr->sendBfr, svr->sendSize) != svr->sendCRC) - sub_8010198(); + LinkRfu_FatalError(); else ++svr->seqno; } diff --git a/src/overworld.c b/src/overworld.c index ae6efefd7..9ed147c0a 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -2287,7 +2287,7 @@ static void SetKeyInterceptCallback(u16 (*func)(u32)) static void CheckRfuKeepAliveTimer(void) { if (gWirelessCommType != 0 && ++sRfuKeepAliveTimer > 60) - sub_8010198(); + LinkRfu_FatalError(); } static void ResetAllTradingStates(void) diff --git a/src/scrcmd.c b/src/scrcmd.c index 0b1006cef..125a57c01 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -281,7 +281,7 @@ bool8 ScrCmd_callstd_if(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_gotoram(struct ScriptContext *ctx) +bool8 ScrCmd_returnram(struct ScriptContext *ctx) { ScriptJump(ctx, gUnknown_020375C0); return FALSE; @@ -2215,7 +2215,7 @@ bool8 ScrCmd_checkmonobedience(struct ScriptContext *ctx) return FALSE; } -bool8 ScrCmd_cmdCF(struct ScriptContext *ctx) +bool8 ScrCmd_gotoram(struct ScriptContext *ctx) { const u8* v1 = GetSavedRamScriptIfValid(); diff --git a/sym_ewram.txt b/sym_ewram.txt index 25cf13069..ff27b4cfb 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -7,16 +7,16 @@ .include "src/link.o" .include "src/link_rfu.o" .include "src/union_room.o" - .include "src/mystery_gift.o" - .include "src/union_room_player_avatar.o" - .include "src/union_room_battle.o" + .include "src/mystery_gift.o" + .include "src/union_room_player_avatar.o" + .include "src/union_room_battle.o" .include "src/mevent2.o" .include "src/mevent_801BAAC.o" - .include "src/mevent_server.o" - .include "src/mevent_client.o" + .include "src/mevent_server.o" + .include "src/mevent_client.o" - @ union_room_chat - .align 2 + @ union_room_chat + .align 2 gUnknown_02022C84: @ 2022C84 .space 0x4 From 48d27c035ae194419317884f64ddf4beec001e7c Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Wed, 3 Apr 2019 15:15:08 -0700 Subject: [PATCH 077/101] Remove pokemon_3.h --- include/pokemon_3.h | 10 ---------- src/main_menu.c | 2 +- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 include/pokemon_3.h diff --git a/include/pokemon_3.h b/include/pokemon_3.h deleted file mode 100644 index 263839b19..000000000 --- a/include/pokemon_3.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef GUARD_POKEMON_3_H -#define GUARD_POKEMON_3_H - -u16 sub_806EFF0(u16); -const u8* GetTrainerClassNameFromId(u16 trainerId); -const u8* GetTrainerNameFromId(u16 trainerId); -void PlayMapChosenOrBattleBGM(u16 song); -u8 GetTrainerEncounterMusicId(u16 trainerOpponentId); - -#endif // GUARD_POKEMON_3_H diff --git a/src/main_menu.c b/src/main_menu.c index 8c9612c24..504c1bd33 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -23,7 +23,7 @@ #include "palette.h" #include "pokeball.h" #include "pokedex.h" -#include "pokemon_3.h" +#include "pokemon.h" #include "random.h" #include "rtc.h" #include "save.h" From 91a94a0ca1f2df00a776c85b40d76c193977d13a Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Wed, 3 Apr 2019 21:13:26 -0700 Subject: [PATCH 078/101] Try to get closer to matching. --- include/menu_specialized.h | 6 +- src/battle_script_commands.c | 8 +- src/menu_specialized.c | 160 ++++++++++++++++++++--------------- 3 files changed, 100 insertions(+), 74 deletions(-) diff --git a/include/menu_specialized.h b/include/menu_specialized.h index fb23e7ce6..405d78830 100644 --- a/include/menu_specialized.h +++ b/include/menu_specialized.h @@ -32,8 +32,8 @@ u8 sub_81D1DC0(struct PlayerPCItemPageStruct *page); void sub_81D1E90(struct PlayerPCItemPageStruct *page); void sub_81D1EC0(void); void sub_81D1D04(u8 a0); -void DrawLevelUpWindowPg1(u16 arg0, u16* statStoreLocation1, u16* statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); -void DrawLevelUpWindowPg2(u16 arg0, u16* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); +void DrawLevelUpWindowPg1(u16 arg0, u16 *statStoreLocation1, u16 *statStoreLocation2, u8 arg3, u8 arg4, u8 arg5); +void DrawLevelUpWindowPg2(u16 arg0, u16 *statStoreLocation1, u8 arg2, u8 arg3, u8 arg4); void sub_81D1ED4(struct UnknownStruct_81D1ED4 *a0); void sub_81D2108(struct UnknownStruct_81D1ED4 *arg0); void sub_81D20AC(struct UnknownStruct_81D1ED4 *arg0); @@ -47,7 +47,7 @@ bool16 MoveRelearnerRunTextPrinters(void); void MoveRelearnerCreateYesNoMenu(void); u8 LoadMoveRelearnerMovesList(const struct ListMenuItem *items, u16 numChoices); void InitMoveRelearnerWindows(bool8 useContextWindow); -void GetMonLevelUpWindowStats(struct Pokemon* mon, u16* statStoreLocation); +void GetMonLevelUpWindowStats(struct Pokemon *mon, u16 *statStoreLocation); s32 GetBoxOrPartyMonData(u16 boxId, u16 monId, s32 request, u8 *dst); void sub_81D2ED4(u8 *dst, u8 *nameDst, u16 boxId, u16 monId, u16 arg5, u16 arg6, bool8 arg7); void sub_81D2F78(struct UnknownStruct_81D1ED4 *arg0, u8 *sheen, u16 boxId, u16 monId, u16 arg5, u16 id, u16 arg7, bool8 arg8); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 0a0c34ad2..d1d8d87ac 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6295,16 +6295,16 @@ static void sub_804F100(void) { struct StatsArray currentStats; - GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], ¤tStats); - DrawLevelUpWindowPg1(0xD, gBattleResources->statsBeforeLvlUp, ¤tStats, 0xE, 0xD, 0xF); + GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], (u16*) ¤tStats); + DrawLevelUpWindowPg1(0xD, (u16*) gBattleResources->statsBeforeLvlUp,(u16*) ¤tStats, 0xE, 0xD, 0xF); } static void sub_804F144(void) { struct StatsArray currentStats; - GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], ¤tStats); - DrawLevelUpWindowPg2(0xD, ¤tStats, 0xE, 0xD, 0xF); + GetMonLevelUpWindowStats(&gPlayerParty[gBattleStruct->expGetterMonId], (u16*) ¤tStats); + DrawLevelUpWindowPg2(0xD, (u16*) ¤tStats, 0xE, 0xD, 0xF); } static void sub_804F17C(void) diff --git a/src/menu_specialized.c b/src/menu_specialized.c index c8c46fbc1..58ed6e982 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -1643,47 +1643,51 @@ static void sub_81D35E8(struct Sprite *sprite) #ifdef NONMATCHING -void DrawLevelUpWindowPg1(u8 arg0, u16 *statStoreLocation1, u16 *statStoreLocation2, u8 arg3, u8 arg4, u8 arg5) +void DrawLevelUpWindowPg1(u16 arg0, u16 *statStoreLocation1, u16 *statStoreLocation2, u8 arg3, u8 arg4, u8 arg5) { - s32 i; + u16 i; s16 array[6]; u8 *text; - u8 *text2; - s16 *ptr; - u8 something[14]; + u8 text2; + s16 *statVal; s32 var; - u8 var2; + u8 padding; s32 var3; + u8 color[11]; + FillWindowPixelBuffer(arg0, PIXEL_FILL(arg3)); + + array[0] = statStoreLocation2[STAT_HP] - statStoreLocation1[STAT_HP]; + array[1] = statStoreLocation2[STAT_ATK] - statStoreLocation1[STAT_ATK]; + array[2] = statStoreLocation2[STAT_DEF] - statStoreLocation1[STAT_DEF]; + array[3] = statStoreLocation2[STAT_SPATK] - statStoreLocation1[STAT_SPATK]; + array[4] = statStoreLocation2[STAT_SPDEF] - statStoreLocation1[STAT_SPDEF]; + array[5] = statStoreLocation2[STAT_SPEED] - statStoreLocation1[STAT_SPEED]; + + color[0] = arg3; + color[1] = arg4; + color[2] = arg5; - - - - FillWindowPixelBuffer(arg0, arg3 * 16 | arg3); - - - array[0] = statStoreLocation2[0] - statStoreLocation1[0]; - array[1] = statStoreLocation2[1] - statStoreLocation1[1]; - array[2] = statStoreLocation2[2] - statStoreLocation1[2]; - array[3] = statStoreLocation2[4] - statStoreLocation1[4]; - array[4] = statStoreLocation2[5] - statStoreLocation1[5]; - array[5] = statStoreLocation2[3] - statStoreLocation1[3]; - - - for(i = 0; i < 6; i++) + for(i = 0; i <= 5; i++) { - AddTextPrinterParameterized3(arg0, 1, 0, 15 * i, &arg3, TEXT_SPEED_FF, gUnknown_08625B54[i]); - ptr = &array[i]; - text = (u8 *) gText_Dash; - - if(*ptr >= 0) - { - text = (u8 *) gText_UnkCtrlF904; - } - - StringCopy(text2, text); - AddTextPrinterParameterized3(arg0, 1, 56, 15 * i, &arg3, TEXT_SPEED_FF, text2); - var3 = *ptr; + AddTextPrinterParameterized3(arg0, + 1, + 0, + 15 * i, + color, + TEXT_SPEED_FF, + gUnknown_08625B54[i]); + statVal = &array[i]; + text = array[i] >= 0 ? (u8 *) gText_UnkCtrlF904 : (u8 *) gText_Dash;//Plus sign for stat gain, dash for none maybe + StringCopy(&text2, text); + AddTextPrinterParameterized3(arg0, + 1, + 56, + 15 * i, + color, + TEXT_SPEED_FF, + &text2); + var3 = *statVal; var = var3; if(var3 < 0) @@ -1691,11 +1695,11 @@ void DrawLevelUpWindowPg1(u8 arg0, u16 *statStoreLocation1, u16 *statStoreLocati var = -var3; } - var2 = 12; + padding = 12; //amount of padding if(var <= 9) { - var2 = 18; + padding = 18; //more padding for single digit numbers } if(var3 < 0) @@ -1703,8 +1707,14 @@ void DrawLevelUpWindowPg1(u8 arg0, u16 *statStoreLocation1, u16 *statStoreLocati var3 = -var3; } - ConvertIntToDecimalStringN(text2, var3, 0, 2); - AddTextPrinterParameterized3(arg0, 1, var2 + 56, 15 * i, &arg3, TEXT_SPEED_FF, text2); + ConvertIntToDecimalStringN(&text2, var3, STR_CONV_MODE_LEFT_ALIGN, 2); + AddTextPrinterParameterized3(arg0, + 1, + padding + 56, + 15 * i, + color, + TEXT_SPEED_FF, + &text2); } } #else @@ -1872,43 +1882,59 @@ _081D373A:\n\ #endif // NONMATCHING #ifdef NONMATCHING -void DrawLevelUpWindowPg2(u16 arg0, u16* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4) +void DrawLevelUpWindowPg2(u16 arg0, u16 *statStoreLocation1, u8 arg2, u8 arg3, u8 arg4) { s32 i; - s32 var; - s32 var2; + s16 *var; + s32 numDigits; u8 text; s16 array[6]; - u8 *something; - u8 some; - FillWindowPixelBuffer(arg0, arg2 * 16 | arg2); - array[0] = statStoreLocation1[0]; - array[1] = statStoreLocation1[1]; - array[2] = statStoreLocation1[2]; - array[3] = statStoreLocation1[4]; - array[4] = statStoreLocation1[5]; - array[5] = statStoreLocation1[3]; + u8 color[11]; + + FillWindowPixelBuffer(arg0, PIXEL_FILL(arg2)); + + array[0] = statStoreLocation1[STAT_HP]; + array[1] = statStoreLocation1[STAT_ATK]; + array[2] = statStoreLocation1[STAT_DEF]; + array[3] = statStoreLocation1[STAT_SPATK]; + array[4] = statStoreLocation1[STAT_SPDEF]; + array[5] = statStoreLocation1[STAT_SPEED]; + + color[0] = arg2; + color[1] = arg3; + color[2] = arg4; + for(i = 0; i <= 5; i++) { - var = array[i]; - var2 = 3; - if(var <= 99) + numDigits = 3; //3 digit stat + if(array[i] <= 99) { - var2 = 1; - if(var > 9) + numDigits = 1; //1 digit stat + if(array[i] > 9) { - var2 = 2; + numDigits = 2; //2 digit stat } } - something = ConvertIntToDecimalStringN(&text, array[i], 0, var2); - some = (((4 - *something) * 2) + *something) * 2; - AddTextPrinterParameterized3(arg0, 1, 0, 15 * i, &arg2, TEXT_SPEED_FF, gUnknown_08625B54[i]); - AddTextPrinterParameterized3(arg0, 1, some + 56, 15 * i, &arg2, TEXT_SPEED_FF, &text); + ConvertIntToDecimalStringN(&text, array[i], STR_CONV_MODE_LEFT_ALIGN, numDigits); + AddTextPrinterParameterized3(arg0, + 1, + 0, + 15 * i, + color, + TEXT_SPEED_FF, + gUnknown_08625B54[i]); + AddTextPrinterParameterized3(arg0, + 1, + 6 * (4 - numDigits) + 56, + 15 * i, + color, + TEXT_SPEED_FF, + &text); } } #else NAKED -void DrawLevelUpWindowPg2(u16 arg0, u16* statStoreLocation1, u8 arg2, u8 arg3, u8 arg4) +void DrawLevelUpWindowPg2(u16 arg0, u16 *statStoreLocation1, u8 arg2, u8 arg3, u8 arg4) { asm(".syntax unified\n\ push {r4-r7,lr}\n\ @@ -2043,14 +2069,14 @@ _081D3808:\n\ } #endif // NONMATCHING -void GetMonLevelUpWindowStats(struct Pokemon* mon, u16* statStoreLocation) +void GetMonLevelUpWindowStats(struct Pokemon *mon, u16 *statStoreLocation) { - statStoreLocation[0] = GetMonData(mon, MON_DATA_MAX_HP); - statStoreLocation[1] = GetMonData(mon, MON_DATA_ATK); - statStoreLocation[2] = GetMonData(mon, MON_DATA_DEF); - statStoreLocation[3] = GetMonData(mon, MON_DATA_SPEED); - statStoreLocation[4] = GetMonData(mon, MON_DATA_SPATK); - statStoreLocation[5] = GetMonData(mon, MON_DATA_SPDEF); + statStoreLocation[STAT_HP] = GetMonData(mon, MON_DATA_MAX_HP); + statStoreLocation[STAT_ATK] = GetMonData(mon, MON_DATA_ATK); + statStoreLocation[STAT_DEF] = GetMonData(mon, MON_DATA_DEF); + statStoreLocation[STAT_SPEED] = GetMonData(mon, MON_DATA_SPEED); + statStoreLocation[STAT_SPATK] = GetMonData(mon, MON_DATA_SPATK); + statStoreLocation[STAT_SPDEF] = GetMonData(mon, MON_DATA_SPDEF); } From 64da3d051ecf8617c081f64a49f62c7e79354585 Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Wed, 3 Apr 2019 21:15:45 -0700 Subject: [PATCH 079/101] Fix formatting. --- src/menu_specialized.c | 108 ++++++++++++++++------------------------- 1 file changed, 43 insertions(+), 65 deletions(-) diff --git a/src/menu_specialized.c b/src/menu_specialized.c index 58ed6e982..cbdef3d39 100644 --- a/src/menu_specialized.c +++ b/src/menu_specialized.c @@ -1653,10 +1653,10 @@ void DrawLevelUpWindowPg1(u16 arg0, u16 *statStoreLocation1, u16 *statStoreLocat s32 var; u8 padding; s32 var3; - u8 color[11]; + u8 color[11]; FillWindowPixelBuffer(arg0, PIXEL_FILL(arg3)); - + array[0] = statStoreLocation2[STAT_HP] - statStoreLocation1[STAT_HP]; array[1] = statStoreLocation2[STAT_ATK] - statStoreLocation1[STAT_ATK]; array[2] = statStoreLocation2[STAT_DEF] - statStoreLocation1[STAT_DEF]; @@ -1665,28 +1665,28 @@ void DrawLevelUpWindowPg1(u16 arg0, u16 *statStoreLocation1, u16 *statStoreLocat array[5] = statStoreLocation2[STAT_SPEED] - statStoreLocation1[STAT_SPEED]; color[0] = arg3; - color[1] = arg4; - color[2] = arg5; + color[1] = arg4; + color[2] = arg5; for(i = 0; i <= 5; i++) { AddTextPrinterParameterized3(arg0, - 1, - 0, - 15 * i, - color, - TEXT_SPEED_FF, - gUnknown_08625B54[i]); + 1, + 0, + 15 * i, + color, + TEXT_SPEED_FF, + gUnknown_08625B54[i]); statVal = &array[i]; text = array[i] >= 0 ? (u8 *) gText_UnkCtrlF904 : (u8 *) gText_Dash;//Plus sign for stat gain, dash for none maybe StringCopy(&text2, text); AddTextPrinterParameterized3(arg0, - 1, - 56, - 15 * i, - color, - TEXT_SPEED_FF, - &text2); + 1, + 56, + 15 * i, + color, + TEXT_SPEED_FF, + &text2); var3 = *statVal; var = var3; @@ -1709,12 +1709,12 @@ void DrawLevelUpWindowPg1(u16 arg0, u16 *statStoreLocation1, u16 *statStoreLocat ConvertIntToDecimalStringN(&text2, var3, STR_CONV_MODE_LEFT_ALIGN, 2); AddTextPrinterParameterized3(arg0, - 1, - padding + 56, - 15 * i, - color, - TEXT_SPEED_FF, - &text2); + 1, + padding + 56, + 15 * i, + color, + TEXT_SPEED_FF, + &text2); } } #else @@ -1889,21 +1889,21 @@ void DrawLevelUpWindowPg2(u16 arg0, u16 *statStoreLocation1, u8 arg2, u8 arg3, u s32 numDigits; u8 text; s16 array[6]; - u8 color[11]; - + u8 color[11]; + FillWindowPixelBuffer(arg0, PIXEL_FILL(arg2)); - + array[0] = statStoreLocation1[STAT_HP]; array[1] = statStoreLocation1[STAT_ATK]; array[2] = statStoreLocation1[STAT_DEF]; array[3] = statStoreLocation1[STAT_SPATK]; array[4] = statStoreLocation1[STAT_SPDEF]; array[5] = statStoreLocation1[STAT_SPEED]; - - color[0] = arg2; - color[1] = arg3; - color[2] = arg4; - + + color[0] = arg2; + color[1] = arg3; + color[2] = arg4; + for(i = 0; i <= 5; i++) { numDigits = 3; //3 digit stat @@ -1917,19 +1917,19 @@ void DrawLevelUpWindowPg2(u16 arg0, u16 *statStoreLocation1, u8 arg2, u8 arg3, u } ConvertIntToDecimalStringN(&text, array[i], STR_CONV_MODE_LEFT_ALIGN, numDigits); AddTextPrinterParameterized3(arg0, - 1, - 0, - 15 * i, - color, - TEXT_SPEED_FF, - gUnknown_08625B54[i]); + 1, + 0, + 15 * i, + color, + TEXT_SPEED_FF, + gUnknown_08625B54[i]); AddTextPrinterParameterized3(arg0, - 1, - 6 * (4 - numDigits) + 56, - 15 * i, - color, - TEXT_SPEED_FF, - &text); + 1, + 6 * (4 - numDigits) + 56, + 15 * i, + color, + TEXT_SPEED_FF, + &text); } } #else @@ -2071,32 +2071,10 @@ _081D3808:\n\ void GetMonLevelUpWindowStats(struct Pokemon *mon, u16 *statStoreLocation) { - statStoreLocation[STAT_HP] = GetMonData(mon, MON_DATA_MAX_HP); + statStoreLocation[STAT_HP] = GetMonData(mon, MON_DATA_MAX_HP); statStoreLocation[STAT_ATK] = GetMonData(mon, MON_DATA_ATK); statStoreLocation[STAT_DEF] = GetMonData(mon, MON_DATA_DEF); statStoreLocation[STAT_SPEED] = GetMonData(mon, MON_DATA_SPEED); statStoreLocation[STAT_SPATK] = GetMonData(mon, MON_DATA_SPATK); statStoreLocation[STAT_SPDEF] = GetMonData(mon, MON_DATA_SPDEF); } - - - - - - - - - - - - - - - - - - - - - - From a47abb3949f8d1050379f51005368a5093c15113 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Wed, 3 Apr 2019 21:46:59 -0400 Subject: [PATCH 080/101] union_room_chat data, 1 --- data/union_room_chat.s | 169 ----------------------------- include/global.h | 13 +-- include/graphics.h | 1 + include/strings.h | 16 +++ src/union_room_chat.c | 240 ++++++++++++++++++++++++++++++++++++----- 5 files changed, 238 insertions(+), 201 deletions(-) diff --git a/data/union_room_chat.s b/data/union_room_chat.s index 143678cd4..4f6b976b5 100755 --- a/data/union_room_chat.s +++ b/data/union_room_chat.s @@ -3,175 +3,6 @@ .section .rodata - .align 2 -gUnknown_082F2AA8:: @ 82F2AA8 - .byte 0x00, 0x16, 0x17, 0x68, 0x19, 0x1a, 0x1b, 0x1c - .byte 0x1d, 0x1e, 0x00, 0x20, 0x21, 0x22, 0x23, 0x24 - .byte 0x25, 0x26, 0x27, 0x28, 0x29, 0x15, 0x01, 0x02 - .byte 0x00, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x00 - .byte 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12 - .byte 0x13, 0x14, 0x2a, 0x2b, 0x2c, 0x2d, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x35, 0x36, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x53, 0x54, 0x55, 0x56, 0x00 - .byte 0x00, 0x00, 0x6f, 0x5b, 0x5c, 0x5d, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5a - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x84, 0x85, 0x86, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7 - .byte 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf - .byte 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7 - .byte 0xb8, 0xb9, 0xba, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9 - .byte 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1 - .byte 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9 - .byte 0xea, 0xeb, 0xec, 0xed, 0xee, 0xbb, 0xbc, 0xbd - .byte 0xbe, 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5 - .byte 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd - .byte 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xef - .byte 0xf0, 0xf4, 0xf5, 0xf6, 0xf1, 0xf2, 0xf3, 0x00 - .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .align 2 -gUnknown_082F2BA8:: @ 82F2BA8 - .4byte gUnknown_0862B9F9, gUnknown_0862B9FF, gUnknown_0862BA05, gUnknown_0862BA0B, gUnknown_0862BA11, gUnknown_0862BA17, gUnknown_0862BA1D, gUnknown_0862BA23, gUnknown_0862BA29, gUnknown_0862BA2F - .4byte gUnknown_0862BA35, gUnknown_0862BA3B, gUnknown_0862BA41, gUnknown_0862BA47, gUnknown_0862BA4D, gUnknown_0862BA53, gUnknown_0862BA59, gUnknown_0862BA5F, gUnknown_0862BA65, gUnknown_0862BA6B - .4byte gUnknown_0862BA79, gUnknown_0862BA84, gUnknown_0862BA8F, gUnknown_0862BA9A, gUnknown_0862BAA3, gUnknown_0862BAAE, gUnknown_0862BAB9, gUnknown_0862BAC4, gUnknown_0862BACF, gUnknown_0862BADA - - .align 2 -gUnknown_082F2C20:: @ 82F2C20 - .incbin "graphics/interface/unk_palette1.gbapal" - - .align 2 -gUnknown_082F2C40:: @ 82F2C40 - .incbin "graphics/interface/unk_palette2.gbapal" - - .align 2 -gUnknown_082F2C60:: @ 82F2C60 struct BgTemplate - .4byte 0x00000070, 0x000011fd, 0x0000217a, 0x000070f7 - - .align 2 -gUnknown_082F2C70:: @ 82F2C70 - window_template 0x03, 0x08, 0x01, 0x15, 0x13, 0x0f, 0x0001 - window_template 0x01, 0x09, 0x12, 0x0f, 0x02, 0x0c, 0x007a - window_template 0x01, 0x00, 0x02, 0x06, 0x0f, 0x07, 0x0020 - window_template 0x00, 0x01, 0x02, 0x07, 0x09, 0x0e, 0x0013 - null_window_template - - .align 2 -gUnknown_082F2C98:: @ 82F2C98 - .4byte 0x00000000, sub_801F658 - .4byte 0x00000003, sub_801F6F8 - .4byte 0x00000004, sub_801F730 - .4byte 0x00000005, sub_801F768 - .4byte 0x00000001, sub_801F7D4 - .4byte 0x00000006, sub_801F7E0 - .4byte 0x00000007, sub_801F82C - .4byte 0x00000008, sub_801F870 - .4byte 0x00000009, sub_801F8DC - .4byte 0x0000000a, sub_801F984 - .4byte 0x0000000b, sub_801FA2C - .4byte 0x0000000c, sub_801FA68 - .4byte 0x00000002, sub_801FB44 - .4byte 0x0000000d, sub_801FB70 - .4byte 0x00000012, sub_801FBB4 - .4byte 0x00000013, sub_801FBF8 - .4byte 0x0000000e, sub_801FC4C - .4byte 0x0000000f, sub_801FC9C - .4byte 0x00000010, sub_801FCEC - .4byte 0x00000011, sub_801FD30 - .4byte 0x00000014, sub_801FD88 - - .align 2 -gUnknown_082F2D40:: @ 82F2D40 - .4byte gText_QuitChatting - .byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gText_RegisterTextWhere - .byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gText_RegisterTextHere - .byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gText_InputText - .byte 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gText_ExitingChat - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 - - .4byte gText_LeaderLeftEndingChat - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00 - - .4byte gText_RegisteredTextChanged - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 - - .4byte gText_AlreadySavedFile_Unused - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 - - .4byte gText_SavingDontTurnOff_Unused - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 - - .4byte gText_PlayerSavedGame_Unused - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00 - - .4byte gText_IfLeaderLeavesChatEnds - .byte 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00 - - .align 2 -gText_Ellipsis:: @ 82F2DC4 - .string "…$" - - .align 2 -gUnknown_082F2DC8:: @ 82F2DC8 - .4byte gText_Upper, 0x00000000 - .4byte gText_Lower, 0x00000000 - .4byte gText_Symbols, 0x00000000 - .4byte gText_Register2, 0x00000000 - .4byte gText_Exit2, 0x00000000 - - .align 2 -gUnknown_082F2DF0:: @ 82F2DF0 - .incbin "graphics/interface/unk_palette3.gbapal" - - .align 2 -gUnknown_082F2E10:: @ 82F2E10 - .incbin "graphics/interface/unk_cursor.4bpp.lz" - - .align 2 -gUnknown_082F3094:: @ 82F3094 - .incbin "graphics/interface/unk_dash.4bpp.lz" - - .align 2 -gUnknown_082F30B4:: @ 82F30B4 - .incbin "graphics/interface/unk_cursor_arrow.4bpp.lz" - - .align 2 -gUnknown_082F30E0:: @ 82F30E0 - .incbin "graphics/interface/unk_rbutton.4bpp.lz" - - .align 2 -gUnknown_082F3134:: @ 82F3134 - .4byte gUnknown_082F2E10 - .2byte 0x1000, 0x0000 - - .4byte gUnknown_082F30B4 - .2byte 0x0040, 0x0001 - - .4byte gUnknown_082F3094 - .2byte 0x0040, 0x0002 - - .4byte gUnknown_082F30E0 - .2byte 0x0080, 0x0003 - - .4byte gUnknown_08DD4CF8 - .2byte 0x0400, 0x0004 - .align 2 gUnknown_082F315C:: @ 82F315C struct SpritePalette .4byte gUnknown_082F2DF0 diff --git a/include/global.h b/include/global.h index 7b570d72e..864a7fa55 100644 --- a/include/global.h +++ b/include/global.h @@ -18,12 +18,13 @@ #if defined (__APPLE__) || defined (__CYGWIN__) || defined (_MSC_VER) #define _(x) x #define __(x) x -#define INCBIN_U8 {0} -#define INCBIN_U16 {0} -#define INCBIN_U32 {0} -#define INCBIN_S8 {0} -#define INCBIN_S16 {0} -#define INCBIN_S32 {0} +// CLion is an idiot +#define INCBIN_U8(x) {0} +#define INCBIN_U16(x) {0} +#define INCBIN_U32(x) {0} +#define INCBIN_S8(x) {0} +#define INCBIN_S16(x) {0} +#define INCBIN_S32(x) {0} #endif // IDE support #define ARRAY_COUNT(array) (size_t)(sizeof(array) / sizeof((array)[0])) diff --git a/include/graphics.h b/include/graphics.h index 2584e713e..30ca2af82 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4921,6 +4921,7 @@ extern const u16 gUnknown_08DD4BB0[]; extern const u16 gUnknown_08DD4BD0[]; extern const u32 gUnknown_08DD4BF0[]; extern const u32 gUnknown_08DD4C4C[]; +extern const u32 gUnknown_08DD4CF8[]; extern const u16 gLinkMiscMenu_Pal[]; extern const u32 gLinkMiscMenu_Gfx[]; extern const u32 gLinkMiscMenu_Tilemap[]; diff --git a/include/strings.h b/include/strings.h index fc5724af3..cb54afb13 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2682,5 +2682,21 @@ extern const u8 gText_PeopleCommunicating[]; extern const u8 gText_CommStandbyAwaitingOtherPlayer[]; extern const u8 gText_RefusedBattle[]; extern const u8 gText_BattleWasRefused[]; +extern const u8 gText_QuitChatting[]; +extern const u8 gText_RegisterTextWhere[]; +extern const u8 gText_RegisterTextHere[]; +extern const u8 gText_InputText[]; +extern const u8 gText_ExitingChat[]; +extern const u8 gText_LeaderLeftEndingChat[]; +extern const u8 gText_RegisteredTextChanged[]; +extern const u8 gText_AlreadySavedFile_Unused[]; +extern const u8 gText_SavingDontTurnOff_Unused[]; +extern const u8 gText_PlayerSavedGame_Unused[]; +extern const u8 gText_IfLeaderLeavesChatEnds[]; +extern const u8 gText_Upper[]; +extern const u8 gText_Lower[]; +extern const u8 gText_Symbols[]; +extern const u8 gText_Register2[]; +extern const u8 gText_Exit2[]; #endif // GUARD_STRINGS_H diff --git a/src/union_room_chat.c b/src/union_room_chat.c index 120252d36..1528cdd5f 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -190,22 +190,33 @@ static void sub_80209E0(void); static bool32 sub_8020A1C(void); static void sub_80207C0(s16); static void sub_8020818(s16); +static bool32 sub_801F658(u8 *state); +static bool32 sub_801F6F8(u8 *state); +static bool32 sub_801F730(u8 *state); +static bool32 sub_801F768(u8 *state); +static bool32 sub_801F7D4(u8 *state); +static bool32 sub_801F7E0(u8 *state); +static bool32 sub_801F82C(u8 *state); +static bool32 sub_801F870(u8 *state); +static bool32 sub_801F8DC(u8 *state); +static bool32 sub_801F984(u8 *state); +static bool32 sub_801FA2C(u8 *state); +static bool32 sub_801FA68(u8 *state); +static bool32 sub_801FB44(u8 *state); +static bool32 sub_801FB70(u8 *state); +static bool32 sub_801FBB4(u8 *state); +static bool32 sub_801FBF8(u8 *state); +static bool32 sub_801FC4C(u8 *state); +static bool32 sub_801FC9C(u8 *state); +static bool32 sub_801FCEC(u8 *state); +static bool32 sub_801FD30(u8 *state); +static bool32 sub_801FD88(u8 *state); extern struct UnionRoomChat *gUnknown_02022C84; extern struct UnionRoomChat2 *gUnknown_02022C88; extern struct UnionRoomChat3 *gUnknown_02022C8C; - -extern const u8 *const gUnknown_082F2BA8[][10]; -extern const u8 gUnknown_082F2AA8[]; -extern const struct BgTemplate gUnknown_082F2C60[4]; -extern const struct WindowTemplate gUnknown_082F2C70[]; -extern const struct Unk82F2C98 gUnknown_082F2C98[]; -extern const struct Unk82F2D40 gUnknown_082F2D40[]; -extern const u8 gText_Ellipsis[]; -extern const struct MenuAction gUnknown_082F2DC8[]; extern const u16 gUnknown_082F2C20[]; extern const u16 gUnknown_082F2C40[]; -extern const struct CompressedSpriteSheet gUnknown_082F3134[]; extern const struct SpritePalette gUnknown_082F315C; extern const struct SpriteTemplate gUnknown_082F319C; extern const u16 gUnknown_082F2DF0[]; @@ -214,6 +225,199 @@ extern const struct SpriteTemplate gUnknown_082F31D4; extern const struct SpriteTemplate gUnknown_082F322C; extern const struct SpriteTemplate gUnknown_082F3244; +void (*const gUnknown_082F2A7C[])(void) = + { + sub_801DFAC, + sub_801E030, + sub_801E120, + sub_801E240, + sub_801E764, + sub_801E838, + sub_801E460, + sub_801E5C4, + sub_801E668, + sub_801E978, + }; + +static const u8 sUnknown_082F2AA4[] = {9, 9, 9, 9}; + +static const u8 gUnknown_082F2AA8[] = { + CHAR_SPACE, 0x16, 0x17, 0x68, 0x19, 0x1A, 0x1B, 0x1C, + 0x1D, 0x1E, CHAR_SPACE, 0x20, 0x21, 0x22, 0x23, 0x24, + 0x25, 0x26, 0x27, 0x28, 0x29, 0x15, 0x01, 0x02, + CHAR_SPACE, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, CHAR_SPACE, + 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, + 0x13, 0x14, 0x2A, 0x2B, 0x2C, 0x2D, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, 0x35, 0x36, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, 0x53, 0x54, 0x55, 0x56, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, 0x6F, 0x5B, 0x5C, 0x5D, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + 0x03, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, 0x5A, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, 0x84, 0x85, 0x86, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, + 0xA0, CHAR_0, CHAR_1, CHAR_2, CHAR_3, CHAR_4, CHAR_5, CHAR_6, + CHAR_7, CHAR_8, CHAR_9, CHAR_EXCL_MARK, CHAR_QUESTION_MARK, CHAR_PERIOD, CHAR_HYPHEN, 0xAF, + CHAR_ELLIPSIS, CHAR_DBL_QUOT_LEFT, CHAR_DBL_QUOT_RIGHT, CHAR_SGL_QUOT_LEFT, CHAR_SGL_QUOT_RIGHT, CHAR_MALE, CHAR_FEMALE, CHAR_CURRENCY, + CHAR_COMMA, CHAR_MULT_SIGN, CHAR_SLASH, CHAR_a, CHAR_b, CHAR_c, CHAR_d, CHAR_e, + CHAR_f, CHAR_g, CHAR_h, CHAR_i, CHAR_j, CHAR_k, CHAR_l, CHAR_m, + CHAR_n, CHAR_o, CHAR_p, CHAR_q, CHAR_r, CHAR_s, CHAR_t, CHAR_u, + CHAR_v, CHAR_w, CHAR_x, CHAR_y, CHAR_z, CHAR_A, CHAR_B, CHAR_C, + CHAR_D, CHAR_E, CHAR_F, CHAR_G, CHAR_H, CHAR_I, CHAR_J, CHAR_K, + CHAR_L, CHAR_M, CHAR_N, CHAR_O, CHAR_P, CHAR_Q, CHAR_R, CHAR_S, + CHAR_T, CHAR_U, CHAR_V, CHAR_W, CHAR_X, CHAR_Y, CHAR_Z, 0xEF, + CHAR_COLON, 0xF4, 0xF5, 0xF6, 0xF1, 0xF2, 0xF3, CHAR_SPACE, + CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE +}; + +const u8 *const gUnknown_082F2BA8[][10] = { + {gUnknown_0862B9F9, gUnknown_0862B9FF, gUnknown_0862BA05, gUnknown_0862BA0B, gUnknown_0862BA11, gUnknown_0862BA17, gUnknown_0862BA1D, gUnknown_0862BA23, gUnknown_0862BA29, gUnknown_0862BA2F}, + {gUnknown_0862BA35, gUnknown_0862BA3B, gUnknown_0862BA41, gUnknown_0862BA47, gUnknown_0862BA4D, gUnknown_0862BA53, gUnknown_0862BA59, gUnknown_0862BA5F, gUnknown_0862BA65, gUnknown_0862BA6B}, + {gUnknown_0862BA79, gUnknown_0862BA84, gUnknown_0862BA8F, gUnknown_0862BA9A, gUnknown_0862BAA3, gUnknown_0862BAAE, gUnknown_0862BAB9, gUnknown_0862BAC4, gUnknown_0862BACF, gUnknown_0862BADA} +}; + +const u16 gUnknown_082F2C20[] = INCBIN_U16("graphics/interface/unk_palette1.gbapal"); +const u16 gUnknown_082F2C40[] = INCBIN_U16("graphics/interface/unk_palette2.gbapal"); + +const struct BgTemplate gUnknown_082F2C60[] = { + { + .bg = 0, + .charBaseIndex = 0, + .mapBaseIndex = 7, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, { + .bg = 1, + .charBaseIndex = 3, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, { + .bg = 2, + .charBaseIndex = 2, + .mapBaseIndex = 23, + .screenSize = 0, + .paletteMode = 0, + .priority = 2, + .baseTile = 0 + }, { + .bg = 3, + .charBaseIndex = 1, + .mapBaseIndex = 15, + .screenSize = 0, + .paletteMode = 0, + .priority = 3, + .baseTile = 1 + } +}; + +const struct WindowTemplate gUnknown_082F2C70[] = { + { + .bg = 0x03, + .tilemapLeft = 0x08, + .tilemapTop = 0x01, + .width = 0x15, + .height = 0x13, + .paletteNum = 0x0f, + .baseBlock = 0x0001, + }, { + .bg = 0x01, + .tilemapLeft = 0x09, + .tilemapTop = 0x12, + .width = 0x0f, + .height = 0x02, + .paletteNum = 0x0c, + .baseBlock = 0x007a, + }, { + .bg = 0x01, + .tilemapLeft = 0x00, + .tilemapTop = 0x02, + .width = 0x06, + .height = 0x0f, + .paletteNum = 0x07, + .baseBlock = 0x0020, + }, { + .bg = 0x00, + .tilemapLeft = 0x01, + .tilemapTop = 0x02, + .width = 0x07, + .height = 0x09, + .paletteNum = 0x0e, + .baseBlock = 0x0013, + }, { 0xFF } +}; + +const struct Unk82F2C98 gUnknown_082F2C98[] = { + {0x00000000, sub_801F658}, + {0x00000003, sub_801F6F8}, + {0x00000004, sub_801F730}, + {0x00000005, sub_801F768}, + {0x00000001, sub_801F7D4}, + {0x00000006, sub_801F7E0}, + {0x00000007, sub_801F82C}, + {0x00000008, sub_801F870}, + {0x00000009, sub_801F8DC}, + {0x0000000a, sub_801F984}, + {0x0000000b, sub_801FA2C}, + {0x0000000c, sub_801FA68}, + {0x00000002, sub_801FB44}, + {0x0000000d, sub_801FB70}, + {0x00000012, sub_801FBB4}, + {0x00000013, sub_801FBF8}, + {0x0000000e, sub_801FC4C}, + {0x0000000f, sub_801FC9C}, + {0x00000010, sub_801FCEC}, + {0x00000011, sub_801FD30}, + {0x00000014, sub_801FD88} +}; + +const struct Unk82F2D40 gUnknown_082F2D40[] = { + {gText_QuitChatting, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}, + {gText_RegisterTextWhere, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}, + {gText_RegisterTextHere, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}, + {gText_InputText, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}, + {gText_ExitingChat, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}, + {gText_LeaderLeftEndingChat, 0x02, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00}, + {gText_RegisteredTextChanged, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01}, + {gText_AlreadySavedFile_Unused, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01}, + {gText_SavingDontTurnOff_Unused, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01}, + {gText_PlayerSavedGame_Unused, 0x02, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01}, + {gText_IfLeaderLeavesChatEnds, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01} +}; + +const u8 gText_Ellipsis[] = _("…"); + +const struct MenuAction gUnknown_082F2DC8[] = { + {gText_Upper, NULL}, + {gText_Lower, NULL}, + {gText_Symbols, NULL}, + {gText_Register2, NULL}, + {gText_Exit2, NULL}, +}; + +const u16 gUnknown_082F2DF0[] = INCBIN_U16("graphics/interface/unk_palette3.gbapal"); +const u32 gUnknown_082F2E10[] = INCBIN_U32("graphics/interface/unk_cursor.4bpp.lz"); +const u32 gUnknown_082F3094[] = INCBIN_U32("graphics/interface/unk_dash.4bpp.lz"); +const u32 gUnknown_082F30B4[] = INCBIN_U32("graphics/interface/unk_cursor_arrow.4bpp.lz"); +const u32 gUnknown_082F30E0[] = INCBIN_U32("graphics/interface/unk_rbutton.4bpp.lz"); + +const struct CompressedSpriteSheet gUnknown_082F3134[] = { + {gUnknown_082F2E10, 0x1000, 0x0000}, + {gUnknown_082F30B4, 0x0040, 0x0001}, + {gUnknown_082F3094, 0x0040, 0x0002}, + {gUnknown_082F30E0, 0x0080, 0x0003}, + {gUnknown_08DD4CF8, 0x0400, 0x0004} +}; void sub_801DD98(void) { @@ -305,20 +509,6 @@ static void sub_801DF38(void) UpdatePaletteFade(); } -void (*const gUnknown_082F2A7C[])(void) = -{ - sub_801DFAC, - sub_801E030, - sub_801E120, - sub_801E240, - sub_801E764, - sub_801E838, - sub_801E460, - sub_801E5C4, - sub_801E668, - sub_801E978, -}; - static void sub_801DF54(u8 taskId) { switch (gUnknown_02022C84->unk17) @@ -939,8 +1129,6 @@ static void sub_801EBD4(u16 arg0) gUnknown_02022C84->unk6 = 0; } -static const u8 sUnknown_082F2AA4[] = {9, 9, 9, 9}; - static bool32 sub_801EBE4(void) { if (!(gMain.newAndRepeatedKeys & DPAD_UP)) From 53efbe2832f5e7a6973c3c5a6a6d7240ea5ecbdd Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 4 Apr 2019 08:49:01 -0400 Subject: [PATCH 081/101] Finish decomp of union_room_chat --- data/union_room_chat.s | 90 --------------------------- include/global.h | 13 ++-- ld_script.txt | 1 - src/union_room_chat.c | 138 ++++++++++++++++++++++++++++++++++++++++- 4 files changed, 142 insertions(+), 100 deletions(-) delete mode 100755 data/union_room_chat.s diff --git a/data/union_room_chat.s b/data/union_room_chat.s deleted file mode 100755 index 4f6b976b5..000000000 --- a/data/union_room_chat.s +++ /dev/null @@ -1,90 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 2 -gUnknown_082F315C:: @ 82F315C struct SpritePalette - .4byte gUnknown_082F2DF0 - .2byte 0x0000 - - .align 2 -gUnknown_082F3164:: @ 82F3164 - .2byte 0x4000, 0xc000, 0x0400, 0x0000 - - .align 2 -gUnknown_082F316C:: @ 82F316C - .2byte 0x0000, 0x001e, 0xffff, 0x0000 - - .align 2 -gUnknown_082F3174:: @ 82F3174 - .2byte 0x0020, 0x001e, 0xffff, 0x0000 - - .align 2 -gUnknown_082F317C:: @ 82F317C - .2byte 0x0040, 0x001e, 0xffff, 0x0000 - - .align 2 -gUnknown_082F3184:: @ 82F3184 - .2byte 0x0060, 0x001e, 0xffff, 0x0000 - -gUnknown_082F318C:: @ 82F318C - .4byte gUnknown_082F316C - .4byte gUnknown_082F3174 - .4byte gUnknown_082F317C - .4byte gUnknown_082F3184 - - .align 2 -gUnknown_082F319C:: @ 82F319C - spr_template 0x0000, 0x0000, gUnknown_082F3164, gUnknown_082F318C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082F31B4:: @ 82F31B4 - .byte 0x00, 0x80, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082F31BC:: @ 82F31BC - spr_template 0x0002, 0x0000, gUnknown_082F31B4, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8020ABC - - .align 2 -gUnknown_082F31D4:: @ 82F31D4 - spr_template 0x0001, 0x0000, gUnknown_082F31B4, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_8020AF4 - - .align 2 -gUnknown_082F31EC:: @ 82F31EC - .byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082F31F4:: @ 82F31F4 - .byte 0x00, 0x40, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00 - - .align 2 -gUnknown_082F31FC:: @ 82F31FC - .2byte 0x0000, 0x0002, 0xffff, 0x0000 - - .align 2 -gUnknown_082F3204:: @ 82F3204 - .2byte 0x0008, 0x0002, 0xffff, 0x0000 - - .align 2 -gUnknown_082F320C:: @ 82F320C - .2byte 0x0010, 0x0002, 0xffff, 0x0000 - - .align 2 -gUnknown_082F3214:: @ 82F3214 - .2byte 0x0018, 0x0002, 0xffff, 0x0000 - - .align 2 -gUnknown_082F321C:: @ 82F321C - .4byte gUnknown_082F31FC - .4byte gUnknown_082F3204 - .4byte gUnknown_082F320C - .4byte gUnknown_082F3214 - - .align 2 -gUnknown_082F322C:: @ 82F322C - spr_template 0x0003, 0x0000, gUnknown_082F31EC, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_082F3244:: @ 82F3244 - spr_template 0x0004, 0x0000, gUnknown_082F31F4, gUnknown_082F321C, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy diff --git a/include/global.h b/include/global.h index 864a7fa55..7b570d72e 100644 --- a/include/global.h +++ b/include/global.h @@ -18,13 +18,12 @@ #if defined (__APPLE__) || defined (__CYGWIN__) || defined (_MSC_VER) #define _(x) x #define __(x) x -// CLion is an idiot -#define INCBIN_U8(x) {0} -#define INCBIN_U16(x) {0} -#define INCBIN_U32(x) {0} -#define INCBIN_S8(x) {0} -#define INCBIN_S16(x) {0} -#define INCBIN_S32(x) {0} +#define INCBIN_U8 {0} +#define INCBIN_U16 {0} +#define INCBIN_U32 {0} +#define INCBIN_S8 {0} +#define INCBIN_S16 {0} +#define INCBIN_S32 {0} #endif // IDE support #define ARRAY_COUNT(array) (size_t)(sizeof(array) / sizeof((array)[0])) diff --git a/ld_script.txt b/ld_script.txt index a7f9948b8..f38378a90 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -419,7 +419,6 @@ SECTIONS { src/mevent_client.o(.rodata); src/mevent_scripts.o(.rodata); src/union_room_chat.o(.rodata); - data/union_room_chat.o(.rodata); data/berry_crush.o(.rodata); data/berry_powder.o(.rodata); data/dodrio_berry_picking.o(.rodata); diff --git a/src/union_room_chat.c b/src/union_room_chat.c index 1528cdd5f..ffe30d863 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -211,6 +211,8 @@ static bool32 sub_801FC9C(u8 *state); static bool32 sub_801FCEC(u8 *state); static bool32 sub_801FD30(u8 *state); static bool32 sub_801FD88(u8 *state); +static void sub_8020ABC(struct Sprite *sprite); +static void sub_8020AF4(struct Sprite *sprite); extern struct UnionRoomChat *gUnknown_02022C84; extern struct UnionRoomChat2 *gUnknown_02022C88; @@ -419,6 +421,138 @@ const struct CompressedSpriteSheet gUnknown_082F3134[] = { {gUnknown_08DD4CF8, 0x0400, 0x0004} }; +const struct SpritePalette gUnknown_082F315C = { + gUnknown_082F2DF0, 0x0000 +}; + +const struct OamData gUnknown_082F3164 = { + .shape = ST_OAM_H_RECTANGLE, + .size = 3, + .priority = 1 +}; + +const union AnimCmd gUnknown_082F316C[] = { + ANIMCMD_FRAME(0x00, 30), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_082F3174[] = { + ANIMCMD_FRAME(0x20, 30), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_082F317C[] = { + ANIMCMD_FRAME(0x40, 30), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_082F3184[] = { + ANIMCMD_FRAME(0x60, 30), + ANIMCMD_END +}; + +const union AnimCmd *const gUnknown_082F318C[] = { + gUnknown_082F316C, + gUnknown_082F3174, + gUnknown_082F317C, + gUnknown_082F3184 +}; + +const struct SpriteTemplate gUnknown_082F319C = { + .tileTag = 0x0000, + .paletteTag = 0x0000, + .oam = &gUnknown_082F3164, + .anims = gUnknown_082F318C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +const struct OamData gUnknown_082F31B4 = { + .shape = ST_OAM_V_RECTANGLE, + .size = 0, + .priority = 2 +}; + +const struct SpriteTemplate gUnknown_082F31BC = { + .tileTag = 0x0002, + .paletteTag = 0x0000, + .oam = &gUnknown_082F31B4, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8020ABC +}; + +const struct SpriteTemplate gUnknown_082F31D4 = { + .tileTag = 0x0001, + .paletteTag = 0x0000, + .oam = &gUnknown_082F31B4, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8020AF4 +}; + +const struct OamData gUnknown_082F31EC = { + .shape = ST_OAM_SQUARE, + .size = 1, + .priority = 2 +}; + +const struct OamData gUnknown_082F31F4 = { + .shape = ST_OAM_H_RECTANGLE, + .size = 2, + .priority = 2 +}; + +const union AnimCmd gUnknown_082F31FC[] = { + ANIMCMD_FRAME(0x00, 2), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_082F3204[] = { + ANIMCMD_FRAME(0x08, 2), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_082F320C[] = { + ANIMCMD_FRAME(0x10, 2), + ANIMCMD_END +}; + +const union AnimCmd gUnknown_082F3214[] = { + ANIMCMD_FRAME(0x18, 2), + ANIMCMD_END +}; + +const union AnimCmd *const gUnknown_082F321C[] = { + gUnknown_082F31FC, + gUnknown_082F3204, + gUnknown_082F320C, + gUnknown_082F3214 +}; + +const struct SpriteTemplate gUnknown_082F322C = { + .tileTag = 0x0003, + .paletteTag = 0x0000, + .oam = &gUnknown_082F31EC, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +const struct SpriteTemplate gUnknown_082F3244 = { + .tileTag = 0x0004, + .paletteTag = 0x0000, + .oam = &gUnknown_082F31F4, + .anims = gUnknown_082F321C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + void sub_801DD98(void) { gUnknown_02022C84 = Alloc(sizeof(*gUnknown_02022C84)); @@ -2754,7 +2888,7 @@ static void sub_8020A68(void) gUnknown_02022C8C->unk4 = &gSprites[spriteId]; } -void sub_8020ABC(struct Sprite *sprite) +static void sub_8020ABC(struct Sprite *sprite) { int var0 = sub_801F198(); if (var0 == 15) @@ -2768,7 +2902,7 @@ void sub_8020ABC(struct Sprite *sprite) } } -void sub_8020AF4(struct Sprite *sprite) +static void sub_8020AF4(struct Sprite *sprite) { if (++sprite->data[0] > 4) { From cb04af05dc473f15eb97ae181dcba624efa2b8d1 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 4 Apr 2019 09:23:13 -0400 Subject: [PATCH 082/101] Resolve unnecessarily externed symbols --- src/union_room_chat.c | 15 +++------------ sym_ewram.txt | 12 ++---------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/union_room_chat.c b/src/union_room_chat.c index ffe30d863..84a0406be 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -214,18 +214,9 @@ static bool32 sub_801FD88(u8 *state); static void sub_8020ABC(struct Sprite *sprite); static void sub_8020AF4(struct Sprite *sprite); -extern struct UnionRoomChat *gUnknown_02022C84; -extern struct UnionRoomChat2 *gUnknown_02022C88; -extern struct UnionRoomChat3 *gUnknown_02022C8C; -extern const u16 gUnknown_082F2C20[]; -extern const u16 gUnknown_082F2C40[]; -extern const struct SpritePalette gUnknown_082F315C; -extern const struct SpriteTemplate gUnknown_082F319C; -extern const u16 gUnknown_082F2DF0[]; -extern const struct SpriteTemplate gUnknown_082F31BC; -extern const struct SpriteTemplate gUnknown_082F31D4; -extern const struct SpriteTemplate gUnknown_082F322C; -extern const struct SpriteTemplate gUnknown_082F3244; +EWRAM_DATA struct UnionRoomChat *gUnknown_02022C84 = NULL; +EWRAM_DATA struct UnionRoomChat2 *gUnknown_02022C88 = NULL; +EWRAM_DATA struct UnionRoomChat3 *gUnknown_02022C8C = NULL; void (*const gUnknown_082F2A7C[])(void) = { diff --git a/sym_ewram.txt b/sym_ewram.txt index ff27b4cfb..141d42875 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -14,18 +14,10 @@ .include "src/mevent_801BAAC.o" .include "src/mevent_server.o" .include "src/mevent_client.o" + .include "src/union_room_chat.o" - @ union_room_chat + @ berry_crush .align 2 -gUnknown_02022C84: @ 2022C84 - .space 0x4 - -gUnknown_02022C88: @ 2022C88 - .space 0x4 - -gUnknown_02022C8C: @ 2022C8C - .space 0x4 - gUnknown_02022C90: @ 2022C90 .space 0x4 From 09874870ef552b6026f7ddfadb3f2dd6456888b8 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 4 Apr 2019 09:43:28 -0400 Subject: [PATCH 083/101] Mark file boundaries on remaining syms declared in sym_ewram.txt --- sym_ewram.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sym_ewram.txt b/sym_ewram.txt index 141d42875..bc3f1e8d7 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -24,6 +24,7 @@ gUnknown_02022C90: @ 2022C90 .include "src/berry_powder.o" .align 2 + @ dodrio_berry_picking gUnknown_02022C98: @ 2022C98 .space 0x4 @@ -45,6 +46,7 @@ gUnknown_02022CF4: @ 2022CF4 gUnknown_02022CF8: @ 2022CF8 .space 0x4 + @ pokemon_jump gUnknown_02022CFC: @ 2022CFC .space 0x4 @@ -172,6 +174,7 @@ gUnknown_02022D00: @ 2022D00 .include "src/unk_pokedex_area_screen_helper.o" .include "src/battle_pyramid_bag.o" + @ pokenav gUnknown_0203CF3C: @ 203CF3C .space 0x4 From b3a4509b9a884fa5ac9619e425de498f961fe9e6 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 4 Apr 2019 09:54:43 -0400 Subject: [PATCH 084/101] Move m4a BSS syms to m4a_1.s --- asm/m4a_1.s | 25 +++++++++++++++++++++++++ sym_bss.txt | 19 +++---------------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/asm/m4a_1.s b/asm/m4a_1.s index 361f66c1a..cab4ed174 100644 --- a/asm/m4a_1.s +++ b/asm/m4a_1.s @@ -1907,3 +1907,28 @@ _081DDD90: thumb_func_end ply_mod .align 2, 0 @ Don't pad with nop. + + .bss +gUnknown_03001300: + .space 0x40 + .size gUnknown_03001300, .-gUnknown_03001300 + + .global gMPlayTrack_BGM +gMPlayTrack_BGM: + .space 0x320 + .size gMPlayTrack_BGM, .-gMPlayTrack_BGM + + .global gMPlayTrack_SE1 +gMPlayTrack_SE1: + .space 0xF0 + .size gMPlayTrack_SE1, .-gMPlayTrack_SE1 + + .global gMPlayTrack_SE2 +gMPlayTrack_SE2: + .space 0x2D0 + .size gMPlayTrack_SE2, .-gMPlayTrack_SE2 + + .global gMPlayTrack_SE3 +gMPlayTrack_SE3: + .space 0x50 + .size gMPlayTrack_SE3, .-gMPlayTrack_SE3 diff --git a/sym_bss.txt b/sym_bss.txt index 58b1312dc..7cce13449 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -47,6 +47,7 @@ .include "src/mirage_tower.o" .include "src/berry_fix_program.o" + @ pokenav gUnknown_030012BC: @ 30012BC .space 0x4 @@ -56,6 +57,7 @@ gUnknown_030012C0: @ 30012C0 gUnknown_030012C4: @ 30012C4 .space 0x4 + @ ereader_helpers gUnknown_030012C8: @ 30012C8 .space 0x18 @@ -90,22 +92,7 @@ gUnknown_030012F4: @ 30012F4 .space 0x4 .include "src/faraway_island.o" - -gUnknown_03001300: @ 3001300 - .space 0x40 - -gMPlayTrack_BGM: @ 3001340 - .space 0x320 - -gMPlayTrack_SE1: @ 3001660 - .space 0xF0 - -gMPlayTrack_SE2: @ 3001750 - .space 0x2D0 - -gMPlayTrack_SE3: @ 3001A20 - .space 0x50 - + .include "asm/m4a_1.o" .include "src/agb_flash.o" .include "src/siirtc.o" .include "*libgcc.a:dp-bit.o" From c46f271f676812b7292560f36f890010c71ef5d1 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 4 Apr 2019 11:55:18 -0400 Subject: [PATCH 085/101] Documentation of ereader_helpers, 1 --- data/ereader_helpers.s | 87 +++++++++++++++++++++------------------ include/ereader_helpers.h | 38 +++++++++++++++-- include/save.h | 5 ++- src/ereader_helpers.c | 69 +++++++++++++++---------------- src/ereader_screen.c | 4 +- src/recorded_battle.c | 4 +- src/save.c | 10 ++--- src/trainer_hill.c | 2 +- sym_bss.txt | 35 +--------------- 9 files changed, 128 insertions(+), 126 deletions(-) diff --git a/data/ereader_helpers.s b/data/ereader_helpers.s index 0ddddbc08..246fe749b 100644 --- a/data/ereader_helpers.s +++ b/data/ereader_helpers.s @@ -5,44 +5,49 @@ gUnknown_08625B6C:: @ 8625B6C @ apparently e-reader trainer data? idk -.byte 0x6f, 0x57, 0x54, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x14, 0x0c, 0x0e, 0x23, 0x10, 0x47, 0x0a, 0x1f, 0x06, 0x24, 0x0e, 0x48, 0x0a, 0x0f, 0x06 -.byte 0x22, 0x27, 0x2c, 0x16, 0x07, 0x06, 0x01, 0x0c, 0x47, 0x0a, 0x06, 0x06, 0x24, 0x0e, 0x00, 0x1e, 0x19, 0x12, 0x05, 0x0c, 0x25, 0x16, 0x25, 0x10, 0x0d, 0x1c, 0x2a, 0x1c, 0x06, 0x0a, 0x06, 0x0c -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -.byte 0xff, 0xff, 0xff, 0x00, 0x70, 0x01, 0xdb, 0x00, 0xbc, 0x00, 0xf7, 0x00, 0xdc, 0x00, 0x19, 0x01, 0x00, 0x00, 0x37, 0xff, 0x64, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a -.byte 0x80, 0x00, 0x00, 0x00, 0x6f, 0x79, 0x69, 0xae, 0x71, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x26, 0x01, 0xb3, 0x00, 0x3e, 0x01, 0xbc, 0x00, 0xf7, 0x00, 0xca, 0x00, 0x00, 0x00, 0x00, 0xff -.byte 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x95, 0x58, 0x59, 0x52, 0x79, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7d, 0x01, 0xb7, 0x00 -.byte 0xf6, 0x00, 0x39, 0x00, 0x59, 0x00, 0x85, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x9b, 0xff, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x2f, 0x00, 0x00, 0x00, 0x8d, 0xae, 0x77, 0x7e -.byte 0x5d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6a, 0x79, 0x6b, 0x64, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x1b, 0x01, 0x00, 0x00, 0x00, 0x54, 0x27, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a -.byte 0x20, 0x06, 0x00, 0x0c, 0x13, 0x24, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a, 0x05, 0x12, 0x00, 0x0c, 0x6b, 0x26, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a, 0x0e, 0x12, 0x00, 0x0c, 0x2c, 0x24, 0x2b, 0x0e -.byte 0xff, 0xff, 0x3b, 0x0a, 0x17, 0x12, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x59, 0x01, 0xb7, 0x00, 0xca, 0x00, 0xb9, 0x00, 0x09, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x37, 0x00, 0x64, 0x00, 0xff, 0x64 -.byte 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x8c, 0x00, 0x00, 0x00, 0x69, 0x58, 0x60, 0x5d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x31, 0x01, 0xb3, 0x00, 0x07, 0x01, 0x4c, 0x01 -.byte 0x62, 0x00, 0x68, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x80, 0x00, 0x00, 0x00, 0x55, 0x55, 0x5d, 0x96, 0x72, 0xff, 0xff, 0xff -.byte 0xff, 0xff, 0xff, 0xff, 0x44, 0x01, 0x86, 0x00, 0x39, 0x00, 0x59, 0x00, 0x85, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a -.byte 0x00, 0x00, 0x00, 0x00, 0x65, 0x6f, 0x8e, 0x7e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x72, 0x52, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, 0x00, 0x00 -.byte 0x4a, 0x04, 0x0e, 0x02, 0x35, 0x16, 0x10, 0x10, 0xda, 0x26, 0x3e, 0x10, 0x4a, 0x04, 0x0e, 0x02, 0x47, 0x0a, 0xd9, 0x26, 0x21, 0x16, 0x3e, 0x10, 0x14, 0x1e, 0x07, 0x1e, 0x30, 0x06, 0x23, 0x16 -.byte 0x24, 0x0e, 0x06, 0x0c, 0x18, 0x14, 0x2f, 0x14, 0x1a, 0x08, 0x27, 0x1c, 0x00, 0x0c, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff -.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x3c, 0x01, 0x8d, 0x00, 0x2f, 0x00, 0x22, 0x00, 0xf7, 0x00, 0xe7, 0x00 -.byte 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x03, 0x00, 0x00, 0x00, 0x54, 0x68, 0x5a, 0x7b, 0x7b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -.byte 0x6b, 0x01, 0xc8, 0x00, 0xca, 0x00, 0x40, 0x01, 0x5c, 0x00, 0x49, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a, 0x06, 0x00, 0x00, 0x00 -.byte 0x7b, 0x8f, 0x78, 0x51, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x24, 0x01, 0xb3, 0x00, 0x3e, 0x01, 0x4c, 0x01, 0xd5, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x64, 0xc8, 0x00, 0x00, 0xc8, 0x00 -.byte 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x51, 0x8a, 0x6a, 0x7e, 0x64, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x9c, 0x54, 0xae, 0x79, 0xff, 0xff, 0xff, 0xff -.byte 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0a, 0x02, 0x06, 0x20, 0x06, 0x0a, 0x0a, 0x23, 0x10, 0x00, 0x0c, 0x28, 0x0c, 0x14, 0x18, 0x32, 0x14, 0x02, 0x16, 0x05, 0x10, 0xff, 0xff -.byte 0x0c, 0x1e, 0x0a, 0x0a, 0x34, 0x12, 0x11, 0x1e, 0x1a, 0x08, 0x05, 0x0c, 0x1e, 0x0a, 0x02, 0x06, 0x20, 0x06, 0x22, 0x0a, 0x15, 0x10, 0x01, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -.byte 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x63, 0x01, 0xb3, 0x00 -.byte 0xf2, 0x00, 0x35, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0xff, 0x9b, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x58, 0x61, 0xae, 0x64 -.byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4b, 0x01, 0xc6, 0x00, 0x39, 0x00, 0xf2, 0x00, 0x26, 0x00, 0x59, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10 -.byte 0xa5, 0x94, 0x52, 0x0a, 0x96, 0x00, 0x00, 0x00, 0x5b, 0x72, 0x6a, 0x91, 0xae, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7a, 0x01, 0x8d, 0x00, 0x5e, 0x00, 0xf7, 0x00, 0x55, 0x00, 0x05, 0x01 -.byte 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x96, 0x00, 0x00, 0x00, 0x8d, 0x85, 0x9e, 0xa0, 0x60, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + .byte 0x6f, 0x57, 0x54, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x0c, 0x01, 0x00, 0x00, 0x00, 0x2e, 0x14, 0x0c, 0x0e, 0x23, 0x10, 0x47, 0x0a, 0x1f, 0x06, 0x24, 0x0e, 0x48, 0x0a, 0x0f, 0x06 + .byte 0x22, 0x27, 0x2c, 0x16, 0x07, 0x06, 0x01, 0x0c, 0x47, 0x0a, 0x06, 0x06, 0x24, 0x0e, 0x00, 0x1e, 0x19, 0x12, 0x05, 0x0c, 0x25, 0x16, 0x25, 0x10, 0x0d, 0x1c, 0x2a, 0x1c, 0x06, 0x0a, 0x06, 0x0c + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + .byte 0xff, 0xff, 0xff, 0x00, 0x70, 0x01, 0xdb, 0x00, 0xbc, 0x00, 0xf7, 0x00, 0xdc, 0x00, 0x19, 0x01, 0x00, 0x00, 0x37, 0xff, 0x64, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a + .byte 0x80, 0x00, 0x00, 0x00, 0x6f, 0x79, 0x69, 0xae, 0x71, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x26, 0x01, 0xb3, 0x00, 0x3e, 0x01, 0xbc, 0x00, 0xf7, 0x00, 0xca, 0x00, 0x00, 0x00, 0x00, 0xff + .byte 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x95, 0x58, 0x59, 0x52, 0x79, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7d, 0x01, 0xb7, 0x00 + .byte 0xf6, 0x00, 0x39, 0x00, 0x59, 0x00, 0x85, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x9b, 0xff, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x2f, 0x00, 0x00, 0x00, 0x8d, 0xae, 0x77, 0x7e + .byte 0x5d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + + + .byte 0x6a, 0x79, 0x6b, 0x64, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x1b, 0x01, 0x00, 0x00, 0x00, 0x54, 0x27, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a, 0x20, 0x06, 0x00, 0x0c, 0x13, 0x24, 0x2b, 0x0e + .byte 0xff, 0xff, 0x3b, 0x0a, 0x05, 0x12, 0x00, 0x0c, 0x6b, 0x26, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a, 0x0e, 0x12, 0x00, 0x0c, 0x2c, 0x24, 0x2b, 0x0e, 0xff, 0xff, 0x3b, 0x0a, 0x17, 0x12, 0x00, 0x0c + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + .byte 0xff, 0xff, 0xff, 0x00, 0x59, 0x01, 0xb7, 0x00, 0xca, 0x00, 0xb9, 0x00, 0x09, 0x00, 0x4a, 0x00, 0x00, 0x00, 0x37, 0x00, 0x64, 0x00, 0xff, 0x64, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a + .byte 0x8c, 0x00, 0x00, 0x00, 0x69, 0x58, 0x60, 0x5d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x31, 0x01, 0xb3, 0x00, 0x07, 0x01, 0x4c, 0x01, 0x62, 0x00, 0x68, 0x00, 0x00, 0x00, 0xff, 0xff + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x80, 0x00, 0x00, 0x00, 0x55, 0x55, 0x5d, 0x96, 0x72, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x44, 0x01, 0x86, 0x00 + .byte 0x39, 0x00, 0x59, 0x00, 0x85, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x65, 0x6f, 0x8e, 0x7e + .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + .byte 0x72, 0x52, 0x5a, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, 0x00, 0x00, 0x4a, 0x04, 0x0e, 0x02, 0x35, 0x16, 0x10, 0x10, 0xda, 0x26, 0x3e, 0x10, 0x4a, 0x04, 0x0e, 0x02 + .byte 0x47, 0x0a, 0xd9, 0x26, 0x21, 0x16, 0x3e, 0x10, 0x14, 0x1e, 0x07, 0x1e, 0x30, 0x06, 0x23, 0x16, 0x24, 0x0e, 0x06, 0x0c, 0x18, 0x14, 0x2f, 0x14, 0x1a, 0x08, 0x27, 0x1c, 0x00, 0x0c, 0xff, 0xff + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + .byte 0xff, 0xff, 0xff, 0x00, 0x3c, 0x01, 0x8d, 0x00, 0x2f, 0x00, 0x22, 0x00, 0xf7, 0x00, 0xe7, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a + .byte 0x03, 0x00, 0x00, 0x00, 0x54, 0x68, 0x5a, 0x7b, 0x7b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6b, 0x01, 0xc8, 0x00, 0xca, 0x00, 0x40, 0x01, 0x5c, 0x00, 0x49, 0x00, 0x00, 0x00, 0xff, 0x00 + .byte 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a, 0x06, 0x00, 0x00, 0x00, 0x7b, 0x8f, 0x78, 0x51, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x24, 0x01, 0xb3, 0x00 + .byte 0x3e, 0x01, 0x4c, 0x01, 0xd5, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x64, 0xc8, 0x00, 0x00, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x06, 0x00, 0x00, 0x00, 0x51, 0x8a, 0x6a, 0x7e + .byte 0x64, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + .byte 0x9c, 0x54, 0xae, 0x79, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x46, 0x0a, 0x02, 0x06, 0x20, 0x06, 0x0a, 0x0a, 0x23, 0x10, 0x00, 0x0c, 0x28, 0x0c, 0x14, 0x18 + .byte 0x32, 0x14, 0x02, 0x16, 0x05, 0x10, 0xff, 0xff, 0x0c, 0x1e, 0x0a, 0x0a, 0x34, 0x12, 0x11, 0x1e, 0x1a, 0x08, 0x05, 0x0c, 0x1e, 0x0a, 0x02, 0x06, 0x20, 0x06, 0x22, 0x0a, 0x15, 0x10, 0x01, 0x0c + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff + .byte 0xff, 0xff, 0xff, 0x00, 0x63, 0x01, 0xb3, 0x00, 0xf2, 0x00, 0x35, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0xff, 0x9b, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x8a + .byte 0x00, 0x00, 0x00, 0x00, 0x58, 0x61, 0xae, 0x64, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x4b, 0x01, 0xc6, 0x00, 0x39, 0x00, 0xf2, 0x00, 0x26, 0x00, 0x59, 0x00, 0x00, 0x00, 0xff, 0x00 + .byte 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x96, 0x00, 0x00, 0x00, 0x5b, 0x72, 0x6a, 0x91, 0xae, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7a, 0x01, 0x8d, 0x00 + .byte 0x5e, 0x00, 0xf7, 0x00, 0x55, 0x00, 0x05, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0xa5, 0x94, 0x52, 0x0a, 0x96, 0x00, 0x00, 0x00, 0x8d, 0x85, 0x9e, 0xa0 + .byte 0x60, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff diff --git a/include/ereader_helpers.h b/include/ereader_helpers.h index 54b36ef0f..95079ff50 100755 --- a/include/ereader_helpers.h +++ b/include/ereader_helpers.h @@ -3,13 +3,43 @@ struct Unk81D38FC { - u8 unk0[0x270]; + u8 unk0[12]; + u8 unkC[0x148]; + u8 unk154[0x11C]; int checksum; }; -bool8 sub_81D3920(u8 *buffer); -bool32 sub_81D3AB0(struct Unk81D38FC *arg0); -bool32 sub_81D3B34(void); +struct EReaderTrainerHillSet +{ + u8 unk_0; + u8 unk_1; + u8 unk_2; + u8 unk_3; + int checksum; + struct Unk81D38FC unk_8[6]; + u8 unk_ec0[40]; +}; + +struct Unk81D3998Sub +{ + u8 unk_000[4]; + u8 unk_004[0x148]; + u8 unk_14C[0x148]; + u8 unk_294[0x124]; +}; + +struct Unk81D3998 +{ + u8 unk_000; + u8 unk_001; + u8 unk_002; + int checksum; + struct Unk81D3998Sub unk_008[4]; +}; + +bool8 EReader_IsReceivedDataValid(struct EReaderTrainerHillSet *buffer); +bool32 TryWriteTrainerHill(struct Unk81D38FC *arg0); +bool32 ReadTrainerHillAndValidate(void); int sub_81D3D70(u8, u32, u32*, u32*); void sub_81D3F9C(void); void sub_81D3FAC(void); diff --git a/include/save.h b/include/save.h index 88e5f2280..5e2cf7267 100644 --- a/include/save.h +++ b/include/save.h @@ -33,6 +33,7 @@ struct SaveSectionOffsets #define NUM_SECTORS_PER_SLOT 16 #define UNKNOWN_CHECK_VALUE 0x8012025 +#define SPECIAL_SECTION_SENTINEL 0xB39D // SetDamagedSectorBits states enum @@ -88,8 +89,8 @@ bool8 CheckSaveFile(void); u8 Save_LoadGameData(u8 a1); u16 sub_815355C(void); u8 sub_81534D0(u8); -u32 TryCopySpecialSaveSection(u8 sector, u8* dst); -u32 sub_8153634(u8 sector, u8* src); +u32 TryReadSpecialSaveSection(u8 sector, u8* dst); +u32 TryWriteSpecialSaveSection(u8 sector, u8* src); void sub_8153688(u8 taskId); // save_failed_screen.c diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c index cdb829ac8..48c41301e 100755 --- a/src/ereader_helpers.c +++ b/src/ereader_helpers.c @@ -26,17 +26,17 @@ static void sub_81D414C(void); static void sub_81D3F1C(u32, u32*, u32*); static void sub_81D3F68(void); -extern struct Unknown030012C8 gUnknown_030012C8; -extern u16 gUnknown_030012E0; -extern u16 gUnknown_030012E2; -extern u16 gUnknown_030012E4; -extern u16 gUnknown_030012E6; -extern u32 gUnknown_030012E8; -extern u16 gUnknown_030012EC; -extern u16 gUnknown_030012EE; -extern u16 gUnknown_030012F0; -extern u16 gUnknown_030012F2; -extern u16 gUnknown_030012F4; +IWRAM_DATA struct Unknown030012C8 gUnknown_030012C8; +IWRAM_DATA u16 gUnknown_030012E0; +IWRAM_DATA u16 gUnknown_030012E2; +IWRAM_DATA u16 gUnknown_030012E4; +IWRAM_DATA u16 gUnknown_030012E6; +IWRAM_DATA u32 gUnknown_030012E8; +IWRAM_DATA u16 gUnknown_030012EC; +IWRAM_DATA u16 gUnknown_030012EE; +IWRAM_DATA u16 gUnknown_030012F0; +IWRAM_DATA u16 gUnknown_030012F2; +IWRAM_DATA u16 gUnknown_030012F4; extern const u8 gUnknown_08625B6C[]; @@ -45,7 +45,7 @@ static u8 sub_81D38D4(void) return (gSaveBlock1Ptr->trainerHill.unused + 1) % 256; } -static bool32 sub_81D38FC(struct Unk81D38FC *arg0) +static bool32 Struct_Unk81D38FC_ValidateChecksum(struct Unk81D38FC *arg0) { int checksum = CalcByteArraySum(arg0->unk0, 0x270); if (checksum != arg0->checksum) @@ -54,43 +54,42 @@ static bool32 sub_81D38FC(struct Unk81D38FC *arg0) return TRUE; } -bool8 sub_81D3920(u8 *buffer) +bool8 EReader_IsReceivedDataValid(struct EReaderTrainerHillSet *buffer) { u32 i; u32 checksum; - int var0 = buffer[0]; + int var0 = buffer->unk_0; if (var0 < 1 || var0 > 8) return FALSE; for (i = 0; i < var0; i++) { - struct Unk81D38FC *var1 = (struct Unk81D38FC *)(&buffer[i * (sizeof(struct Unk81D38FC)) + 8]); - if (!sub_81D38FC(var1)) + if (!Struct_Unk81D38FC_ValidateChecksum(&buffer->unk_8[i])) return FALSE; } - checksum = CalcByteArraySum(buffer + 8, var0 * 0x274); - if (checksum != ((int *)buffer)[1]) + checksum = CalcByteArraySum((u8 *)buffer->unk_8, var0 * sizeof(struct Unk81D38FC)); + if (checksum != buffer->checksum) return FALSE; return TRUE; } -static bool32 sub_81D396C(u8 *buffer) +static bool32 TrainerHill_VerifyChecksum(struct EReaderTrainerHillSet *buffer) { u32 checksum; - int var0 = buffer[0]; + int var0 = buffer->unk_0; if (var0 < 1 || var0 > 8) return FALSE; - checksum = CalcByteArraySum(buffer + 8, 0xEE0); - if (checksum != ((int *)buffer)[1]) + checksum = CalcByteArraySum((u8 *)buffer->unk_8, sizeof(struct EReaderTrainerHillSet) - offsetof(struct EReaderTrainerHillSet, unk_8)); + if (checksum != buffer->checksum) return FALSE; return TRUE; } -static bool32 sub_81D3998(struct Unk81D38FC *arg0, u8 *buffer2) +static bool32 TryWriteTrainerHill_r(struct Unk81D38FC *arg0, u8 *buffer2) { int i; const u8 *ereaderVals; @@ -131,44 +130,44 @@ static bool32 sub_81D3998(struct Unk81D38FC *arg0, u8 *buffer2) } ((int *)buffer2)[1] = CalcByteArraySum(buffer2 + 8, 0xEE0); - if (sub_8153634(SECTOR_ID_TRAINER_HILL, buffer2) != 1) + if (TryWriteSpecialSaveSection(SECTOR_ID_TRAINER_HILL, (u8 *)buffer2) != 1) return FALSE; return TRUE; } -bool32 sub_81D3AB0(struct Unk81D38FC *arg0) +bool32 TryWriteTrainerHill(struct Unk81D38FC *arg0) { u8 *var0 = AllocZeroed(0x1000); - bool32 result = sub_81D3998(arg0, var0); + bool32 result = TryWriteTrainerHill_r(arg0, var0); Free(var0); return result; } -static bool32 sub_81D3AD8(u8 *arg0, u8 *arg1) +static bool32 TryReadTrainerHill_r(struct EReaderTrainerHillSet *arg0, u8 *arg1) { - if (TryCopySpecialSaveSection(SECTOR_ID_TRAINER_HILL, arg1) != 1) + if (TryReadSpecialSaveSection(SECTOR_ID_TRAINER_HILL, arg1) != 1) return FALSE; - memcpy(arg0, arg1, 0xEE8); - if (!sub_81D396C(arg0)) + memcpy(arg0, arg1, sizeof(struct EReaderTrainerHillSet)); + if (!TrainerHill_VerifyChecksum(arg0)) return FALSE; return TRUE; } -static bool32 sub_81D3B0C(u8 *arg0) +static bool32 TryReadTrainerHill(struct EReaderTrainerHillSet *arg0) { u8 *var0 = AllocZeroed(0x1000); - bool32 result = sub_81D3AD8(arg0, var0); + bool32 result = TryReadTrainerHill_r(arg0, var0); Free(var0); return result; } -bool32 sub_81D3B34(void) +bool32 ReadTrainerHillAndValidate(void) { - u8 *var0 = AllocZeroed(0x1000); - bool32 result = sub_81D3B0C(var0); + struct EReaderTrainerHillSet *var0 = AllocZeroed(0x1000); + bool32 result = TryReadTrainerHill(var0); Free(var0); return result; } diff --git a/src/ereader_screen.c b/src/ereader_screen.c index bac29cd42..8dc2a539b 100755 --- a/src/ereader_screen.c +++ b/src/ereader_screen.c @@ -402,7 +402,7 @@ static void sub_81D5084(u8 taskId) } break; case 15: - data->unkE = sub_81D3920(gDecompressionBuffer); + data->unkE = EReader_IsReceivedDataValid((struct EReaderTrainerHillSet *)gDecompressionBuffer); sub_800ABF4(data->unkE); data->unk8 = 16; break; @@ -416,7 +416,7 @@ static void sub_81D5084(u8 taskId) } break; case 17: - if (sub_81D3AB0((struct Unk81D38FC *)&gDecompressionBuffer)) + if (TryWriteTrainerHill((struct Unk81D38FC *)&gDecompressionBuffer)) { AddTextPrinterToWindow1(gUnknown_085EE0FA); sub_81D505C(&data->unk0); diff --git a/src/recorded_battle.c b/src/recorded_battle.c index acd4c2ce6..9f2be36af 100644 --- a/src/recorded_battle.c +++ b/src/recorded_battle.c @@ -322,7 +322,7 @@ static bool32 RecordedBattleToSave(struct RecordedBattleSave *battleSave, struct saveSection->checksum = CalcByteArraySum((void*)(saveSection), sizeof(*saveSection) - 4); - if (sub_8153634(31, (void*)(saveSection)) != 1) + if (TryWriteSpecialSaveSection(SECTOR_ID_RECORDED_BATTLE, (void*)(saveSection)) != 1) return FALSE; else return TRUE; @@ -491,7 +491,7 @@ bool32 MoveRecordedBattleToSaveData(void) static bool32 TryCopyRecordedBattleSaveData(struct RecordedBattleSave *dst, struct SaveSection *saveBuffer) { - if (TryCopySpecialSaveSection(SECTOR_ID_RECORDED_BATTLE, (void*)(saveBuffer)) != 1) + if (TryReadSpecialSaveSection(SECTOR_ID_RECORDED_BATTLE, (void*)(saveBuffer)) != 1) return FALSE; memcpy(dst, saveBuffer, sizeof(struct RecordedBattleSave)); diff --git a/src/save.c b/src/save.c index 361a88e1e..45a75b5dc 100644 --- a/src/save.c +++ b/src/save.c @@ -849,7 +849,7 @@ u16 sub_815355C(void) return 0; } -u32 TryCopySpecialSaveSection(u8 sector, u8* dst) +u32 TryReadSpecialSaveSection(u8 sector, u8* dst) { s32 i; s32 size; @@ -858,7 +858,7 @@ u32 TryCopySpecialSaveSection(u8 sector, u8* dst) if (sector != SECTOR_ID_TRAINER_HILL && sector != SECTOR_ID_RECORDED_BATTLE) return 0xFF; ReadFlash(sector, 0, (u8 *)&gSaveDataBuffer, sizeof(struct SaveSection)); - if (*(u32*)(&gSaveDataBuffer.data[0]) != 0xB39D) + if (*(u32*)(&gSaveDataBuffer.data[0]) != SPECIAL_SECTION_SENTINEL) return 0xFF; // copies whole save section except u32 counter i = 0; @@ -869,18 +869,18 @@ u32 TryCopySpecialSaveSection(u8 sector, u8* dst) return 1; } -u32 sub_8153634(u8 sector, u8* src) +u32 TryWriteSpecialSaveSection(u8 sector, u8* src) { s32 i; s32 size; u8* savData; void* savDataBuffer; - if (sector != 30 && sector != 31) + if (sector != SECTOR_ID_TRAINER_HILL && sector != SECTOR_ID_RECORDED_BATTLE) return 0xFF; savDataBuffer = &gSaveDataBuffer; - *(u32*)(savDataBuffer) = 0xB39D; + *(u32*)(savDataBuffer) = SPECIAL_SECTION_SENTINEL; // copies whole save section except u32 counter i = 0; diff --git a/src/trainer_hill.c b/src/trainer_hill.c index eafd1eb3d..650a748cb 100644 --- a/src/trainer_hill.c +++ b/src/trainer_hill.c @@ -428,7 +428,7 @@ void CopyTrainerHillTrainerText(u8 which, u16 trainerId) static void TrainerHillStartChallenge(void) { nullsub_2(); - if (!sub_81D3B34()) + if (!ReadTrainerHillAndValidate()) gSaveBlock1Ptr->trainerHill.field_3D6E_0f = 1; else gSaveBlock1Ptr->trainerHill.field_3D6E_0f = 0; diff --git a/sym_bss.txt b/sym_bss.txt index 7cce13449..4d21151ef 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -57,40 +57,7 @@ gUnknown_030012C0: @ 30012C0 gUnknown_030012C4: @ 30012C4 .space 0x4 - @ ereader_helpers -gUnknown_030012C8: @ 30012C8 - .space 0x18 - -gUnknown_030012E0: @ 30012E0 - .space 0x2 - -gUnknown_030012E2: @ 30012E2 - .space 0x2 - -gUnknown_030012E4: @ 30012E4 - .space 0x2 - -gUnknown_030012E6: @ 30012E6 - .space 0x2 - -gUnknown_030012E8: @ 30012E8 - .space 0x4 - -gUnknown_030012EC: @ 30012EC - .space 0x2 - -gUnknown_030012EE: @ 30012EE - .space 0x2 - -gUnknown_030012F0: @ 30012F0 - .space 0x2 - -gUnknown_030012F2: @ 30012F2 - .space 0x2 - -gUnknown_030012F4: @ 30012F4 - .space 0x4 - + .include "src/ereader_helpers.o" .include "src/faraway_island.o" .include "asm/m4a_1.o" .include "src/agb_flash.o" From 8db03ba6fab0d335d6141f1a9289122c1477a7b6 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 4 Apr 2019 13:44:43 -0400 Subject: [PATCH 086/101] Documentation of ereader helpers, 2 --- include/ereader_helpers.h | 9 ++++---- src/ereader_helpers.c | 45 ++++++++++++++++----------------------- src/ereader_screen.c | 2 +- 3 files changed, 24 insertions(+), 32 deletions(-) diff --git a/include/ereader_helpers.h b/include/ereader_helpers.h index 95079ff50..bcbb68d4f 100755 --- a/include/ereader_helpers.h +++ b/include/ereader_helpers.h @@ -3,9 +3,10 @@ struct Unk81D38FC { - u8 unk0[12]; - u8 unkC[0x148]; - u8 unk154[0x11C]; + u8 unk0; + u8 filler_1[3]; + u8 unk4[0x148]; + u8 unk14C[0x124]; int checksum; }; @@ -38,7 +39,7 @@ struct Unk81D3998 }; bool8 EReader_IsReceivedDataValid(struct EReaderTrainerHillSet *buffer); -bool32 TryWriteTrainerHill(struct Unk81D38FC *arg0); +bool32 TryWriteTrainerHill(struct EReaderTrainerHillSet *arg0); bool32 ReadTrainerHillAndValidate(void); int sub_81D3D70(u8, u32, u32*, u32*); void sub_81D3F9C(void); diff --git a/src/ereader_helpers.c b/src/ereader_helpers.c index 48c41301e..cd64afe0e 100755 --- a/src/ereader_helpers.c +++ b/src/ereader_helpers.c @@ -38,7 +38,7 @@ IWRAM_DATA u16 gUnknown_030012F0; IWRAM_DATA u16 gUnknown_030012F2; IWRAM_DATA u16 gUnknown_030012F4; -extern const u8 gUnknown_08625B6C[]; +extern const u8 gUnknown_08625B6C[][0x148]; static u8 sub_81D38D4(void) { @@ -47,7 +47,7 @@ static u8 sub_81D38D4(void) static bool32 Struct_Unk81D38FC_ValidateChecksum(struct Unk81D38FC *arg0) { - int checksum = CalcByteArraySum(arg0->unk0, 0x270); + int checksum = CalcByteArraySum((u8 *)arg0, 0x270); if (checksum != arg0->checksum) return FALSE; @@ -89,56 +89,47 @@ static bool32 TrainerHill_VerifyChecksum(struct EReaderTrainerHillSet *buffer) return TRUE; } -static bool32 TryWriteTrainerHill_r(struct Unk81D38FC *arg0, u8 *buffer2) +static bool32 TryWriteTrainerHill_r(struct EReaderTrainerHillSet *arg0, struct Unk81D3998 *buffer2) { int i; - const u8 *ereaderVals; memset(buffer2, 0, 0x1000); - buffer2[0] = arg0->unk0[0]; - buffer2[1] = sub_81D38D4(); - buffer2[2] = (arg0->unk0[0] + 1) / 2; + buffer2->unk_000 = arg0->unk_0; + buffer2->unk_001 = sub_81D38D4(); + buffer2->unk_002 = (arg0->unk_0 + 1) / 2; - for (i = 0; i < arg0->unk0[0]; i++) + for (i = 0; i < arg0->unk_0; i++) { if (!(i & 1)) { - u8 *var0 = &buffer2[(i / 2) * 0x3B8]; - u8 *var1 = arg0[i].unk0; - var0[8] = var1[8]; - memcpy(&var0[0x29C], &var1[0x154], 0x124); - var0 += 0xC; - var1 += 0xC; - memcpy(var0, var1, 0x148); + buffer2->unk_008[i / 2].unk_000[0] = arg0->unk_8[i].unk0; + memcpy(buffer2->unk_008[i / 2].unk_294, arg0->unk_8[i].unk14C, 0x124); + memcpy(buffer2->unk_008[i / 2].unk_004, arg0->unk_8[i].unk4, 0x148); } else { - u8 *var0 = &buffer2[(i / 2) * 0x3B8]; - u8 *var1 = arg0[i].unk0; - var0[9] = var1[8]; - memcpy(&var0[0x154], &var1[0xC], 0x148); + buffer2->unk_008[i / 2].unk_000[1] = arg0->unk_8[i].unk0; + memcpy(buffer2->unk_008[i / 2].unk_14C, arg0->unk_8[i].unk4, 0x148); } } if (i & 1) { - u8 *var0 = &buffer2[(i / 2) * 0x3B8]; - var0 += 0x154; - - ereaderVals = gUnknown_08625B6C; - memcpy(var0, &ereaderVals[(i / 2) * 0x148], 0x148); + u8 * dest = buffer2->unk_008[i / 2].unk_14C; + const u8 (* src)[0x148] = gUnknown_08625B6C; + memcpy(dest, src[i / 2], 0x148); } - ((int *)buffer2)[1] = CalcByteArraySum(buffer2 + 8, 0xEE0); + buffer2->checksum = CalcByteArraySum((u8 *)buffer2->unk_008, sizeof(struct Unk81D3998) - offsetof(struct Unk81D3998, unk_008)); if (TryWriteSpecialSaveSection(SECTOR_ID_TRAINER_HILL, (u8 *)buffer2) != 1) return FALSE; return TRUE; } -bool32 TryWriteTrainerHill(struct Unk81D38FC *arg0) +bool32 TryWriteTrainerHill(struct EReaderTrainerHillSet *arg0) { - u8 *var0 = AllocZeroed(0x1000); + struct Unk81D3998 *var0 = AllocZeroed(0x1000); bool32 result = TryWriteTrainerHill_r(arg0, var0); Free(var0); return result; diff --git a/src/ereader_screen.c b/src/ereader_screen.c index 8dc2a539b..f74efa32b 100755 --- a/src/ereader_screen.c +++ b/src/ereader_screen.c @@ -416,7 +416,7 @@ static void sub_81D5084(u8 taskId) } break; case 17: - if (TryWriteTrainerHill((struct Unk81D38FC *)&gDecompressionBuffer)) + if (TryWriteTrainerHill((struct EReaderTrainerHillSet *)&gDecompressionBuffer)) { AddTextPrinterToWindow1(gUnknown_085EE0FA); sub_81D505C(&data->unk0); From 016021ac049961a3ad2b2419f358801138edd757 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 4 Apr 2019 14:55:24 -0400 Subject: [PATCH 087/101] Move gUnknown_02022C90 from sym_ewram.txt --- src/berry_crush.c | 2 +- sym_ewram.txt | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/berry_crush.c b/src/berry_crush.c index 51dbe8203..307bd49a7 100755 --- a/src/berry_crush.c +++ b/src/berry_crush.c @@ -139,7 +139,7 @@ void sub_8022960(struct BerryCrushGame *); void sub_8022524(struct BerryCrushGame_138 *, u16); void sub_8022B28(struct Sprite *); -extern struct BerryCrushGame *gUnknown_02022C90; +static EWRAM_DATA struct BerryCrushGame *gUnknown_02022C90 = NULL; extern const struct BgTemplate gUnknown_082F32C8[4]; extern const u8 gBerryCrushGrinderTopTilemap[]; diff --git a/sym_ewram.txt b/sym_ewram.txt index bc3f1e8d7..40171a167 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -15,12 +15,7 @@ .include "src/mevent_server.o" .include "src/mevent_client.o" .include "src/union_room_chat.o" - - @ berry_crush - .align 2 -gUnknown_02022C90: @ 2022C90 - .space 0x4 - + .include "src/berry_crush.o" .include "src/berry_powder.o" .align 2 From 704f025a00e32a910b6fd70a54511844e755663f Mon Sep 17 00:00:00 2001 From: AJ Fontaine <36677462+Fontbane@users.noreply.github.com> Date: Wed, 3 Apr 2019 10:36:50 -0400 Subject: [PATCH 088/101] Fix a typo in as(s)istattackselect --- src/battle_script_commands.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index d1d8d87ac..2e78e1ca0 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -296,7 +296,7 @@ static void atkDA_tryswapabilities(void); static void atkDB_tryimprison(void); static void atkDC_trysetgrudge(void); static void atkDD_weightdamagecalculation(void); -static void atkDE_asistattackselect(void); +static void atkDE_assistattackselect(void); static void atkDF_trysetmagiccoat(void); static void atkE0_trysetsnatch(void); static void atkE1_trygetintimidatetarget(void); @@ -548,7 +548,7 @@ void (* const gBattleScriptingCommandsTable[])(void) = atkDB_tryimprison, atkDC_trysetgrudge, atkDD_weightdamagecalculation, - atkDE_asistattackselect, + atkDE_assistattackselect, atkDF_trysetmagiccoat, atkE0_trysetsnatch, atkE1_trygetintimidatetarget, @@ -9660,7 +9660,7 @@ static void atkDD_weightdamagecalculation(void) gBattlescriptCurrInstr++; } -static void atkDE_asistattackselect(void) +static void atkDE_assistattackselect(void) { s32 chooseableMovesNo = 0; struct Pokemon* party; From 90e32f4ec57f6597dc02b11dcae54b14e9d4ceaa Mon Sep 17 00:00:00 2001 From: Fontbane Date: Wed, 3 Apr 2019 14:13:11 -0400 Subject: [PATCH 089/101] Document landmark setting and item balls --- asm/macros/battle_script.inc | 2 +- data/battle_scripts_1.s | 2 +- .../AbandonedShip_CaptainsOffice/map.json | 2 +- data/maps/AbandonedShip_Deck/scripts.inc | 4 +- .../AbandonedShip_HiddenFloorRooms/map.json | 8 +- data/maps/AbandonedShip_Room_B1F/map.json | 2 +- data/maps/AbandonedShip_Rooms2_1F/map.json | 2 +- data/maps/AbandonedShip_Rooms2_B1F/map.json | 2 +- data/maps/AbandonedShip_Rooms_1F/map.json | 2 +- data/maps/AbandonedShip_Rooms_B1F/map.json | 2 +- data/maps/AlteringCave/scripts.inc | 4 +- data/maps/AquaHideout_B1F/map.json | 6 +- data/maps/AquaHideout_B2F/map.json | 2 +- data/maps/ArtisanCave_1F/map.json | 2 +- data/maps/ArtisanCave_B1F/map.json | 2 +- data/maps/ArtisanCave_B1F/scripts.inc | 4 +- .../BattleFrontier_ReceptionGate/scripts.inc | 4 +- data/maps/DesertUnderpass/scripts.inc | 4 +- data/maps/FieryPath/map.json | 4 +- data/maps/GraniteCave_1F/map.json | 2 +- data/maps/GraniteCave_B1F/map.json | 2 +- data/maps/GraniteCave_B2F/map.json | 4 +- data/maps/JaggedPass/map.json | 2 +- data/maps/LilycoveCity/map.json | 2 +- data/maps/MagmaHideout_1F/map.json | 2 +- data/maps/MagmaHideout_2F_2R/map.json | 4 +- data/maps/MagmaHideout_3F_1R/map.json | 2 +- data/maps/MagmaHideout_3F_2R/map.json | 2 +- data/maps/MagmaHideout_3F_3R/map.json | 2 +- data/maps/MagmaHideout_4F/map.json | 2 +- data/maps/MauvilleCity/map.json | 2 +- data/maps/MeteorFalls_1F_1R/map.json | 8 +- data/maps/MeteorFalls_B1F_2R/map.json | 2 +- data/maps/MossdeepCity/map.json | 2 +- data/maps/MtPyre_2F/map.json | 2 +- data/maps/MtPyre_3F/map.json | 2 +- data/maps/MtPyre_4F/map.json | 2 +- data/maps/MtPyre_5F/map.json | 2 +- data/maps/MtPyre_6F/map.json | 2 +- data/maps/MtPyre_Exterior/map.json | 4 +- data/maps/NewMauville_Entrance/scripts.inc | 4 +- data/maps/NewMauville_Inside/map.json | 10 +- data/maps/PetalburgCity/map.json | 4 +- data/maps/PetalburgWoods/map.json | 8 +- data/maps/Route102/map.json | 2 +- data/maps/Route103/map.json | 4 +- data/maps/Route104/map.json | 8 +- data/maps/Route105/map.json | 2 +- data/maps/Route106/map.json | 2 +- data/maps/Route108/map.json | 2 +- data/maps/Route109/map.json | 4 +- data/maps/Route109_SeashoreHouse/scripts.inc | 4 +- data/maps/Route110/map.json | 6 +- data/maps/Route110_TrickHousePuzzle1/map.json | 2 +- data/maps/Route110_TrickHousePuzzle2/map.json | 4 +- data/maps/Route110_TrickHousePuzzle3/map.json | 4 +- data/maps/Route110_TrickHousePuzzle4/map.json | 2 +- data/maps/Route110_TrickHousePuzzle6/map.json | 2 +- data/maps/Route110_TrickHousePuzzle7/map.json | 2 +- data/maps/Route110_TrickHousePuzzle8/map.json | 2 +- data/maps/Route111/map.json | 8 +- .../Route111_OldLadysRestStop/scripts.inc | 4 +- data/maps/Route112/map.json | 2 +- data/maps/Route113/map.json | 6 +- data/maps/Route114/map.json | 6 +- .../Route114_FossilManiacsHouse/scripts.inc | 4 +- data/maps/Route114_LanettesHouse/scripts.inc | 4 +- data/maps/Route115/map.json | 12 +- data/maps/Route116/map.json | 10 +- .../Route116_TunnelersRestHouse/scripts.inc | 4 +- data/maps/Route117/map.json | 4 +- data/maps/Route117_PokemonDayCare/scripts.inc | 4 +- data/maps/Route118/map.json | 2 +- data/maps/Route119/map.json | 18 +- data/maps/Route120/map.json | 10 +- data/maps/Route121/map.json | 6 +- data/maps/Route123/map.json | 10 +- .../Route123_BerryMastersHouse/scripts.inc | 4 +- data/maps/Route124/map.json | 6 +- .../scripts.inc | 4 +- data/maps/Route125/map.json | 2 +- data/maps/Route126/map.json | 2 +- data/maps/Route127/map.json | 6 +- data/maps/Route132/map.json | 4 +- data/maps/Route133/map.json | 6 +- data/maps/Route134/map.json | 4 +- data/maps/RustboroCity/map.json | 2 +- data/maps/RusturfTunnel/map.json | 4 +- data/maps/SafariZone_North/map.json | 2 +- data/maps/SafariZone_Northeast/map.json | 2 +- data/maps/SafariZone_Northwest/map.json | 2 +- data/maps/SafariZone_Southeast/map.json | 2 +- data/maps/SafariZone_Southwest/map.json | 2 +- data/maps/ScorchedSlab/map.json | 2 +- data/maps/ScorchedSlab/scripts.inc | 4 +- data/maps/SeafloorCavern_Room9/map.json | 2 +- data/maps/SealedChamber_OuterRoom/scripts.inc | 4 +- .../ShoalCave_LowTideEntranceRoom/map.json | 2 +- data/maps/ShoalCave_LowTideIceRoom/map.json | 4 +- data/maps/ShoalCave_LowTideInnerRoom/map.json | 2 +- .../maps/ShoalCave_LowTideStairsRoom/map.json | 2 +- data/maps/SkyPillar_Entrance/scripts.inc | 4 +- data/maps/SouthernIsland_Exterior/scripts.inc | 4 +- data/maps/VictoryRoad_1F/map.json | 4 +- data/maps/VictoryRoad_B1F/map.json | 4 +- data/maps/VictoryRoad_B2F/map.json | 2 +- data/scripts/item_ball_scripts.inc | 332 +++++++++--------- 107 files changed, 366 insertions(+), 366 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 7a1af4c17..997af51cc 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1124,7 +1124,7 @@ .byte 0xdd .endm - .macro asistattackselect param0:req + .macro assistattackselect param0:req .byte 0xde .4byte \param0 .endm diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index a3ba7eb08..244a3ac05 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -2384,7 +2384,7 @@ BattleScript_EffectWish:: BattleScript_EffectAssist:: attackcanceler attackstring - asistattackselect BattleScript_ButItFailedPpReduce + assistattackselect BattleScript_ButItFailedPpReduce attackanimation waitanimation setbyte sB_ANIM_TURN, 0x0 diff --git a/data/maps/AbandonedShip_CaptainsOffice/map.json b/data/maps/AbandonedShip_CaptainsOffice/map.json index a78d433b6..b876ad849 100644 --- a/data/maps/AbandonedShip_CaptainsOffice/map.json +++ b/data/maps/AbandonedShip_CaptainsOffice/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_CaptainsOffice_EventScript_29126E", + "script": "AbandonedShip_CaptainsOffice_EventScript_ItemStorageKey", "flag": "FLAG_ITEM_ABANDONED_SHIP_CAPTAINS_OFFICE_STORAGE_KEY" } ], diff --git a/data/maps/AbandonedShip_Deck/scripts.inc b/data/maps/AbandonedShip_Deck/scripts.inc index 041c54593..f256fe521 100644 --- a/data/maps/AbandonedShip_Deck/scripts.inc +++ b/data/maps/AbandonedShip_Deck/scripts.inc @@ -1,8 +1,8 @@ AbandonedShip_Deck_MapScripts:: @ 823799A - map_script MAP_SCRIPT_ON_TRANSITION, AbandonedShip_Deck_MapScript1_2379A0 + map_script MAP_SCRIPT_ON_TRANSITION, AbandonedShip_Deck_MapScript1_SetLandmark .byte 0 -AbandonedShip_Deck_MapScript1_2379A0: @ 82379A0 +AbandonedShip_Deck_MapScript1_SetLandmark: @ 82379A0 setflag FLAG_LANDMARK_ABANDONED_SHIP end diff --git a/data/maps/AbandonedShip_HiddenFloorRooms/map.json b/data/maps/AbandonedShip_HiddenFloorRooms/map.json index f71ad8eb3..fdfb8a187 100644 --- a/data/maps/AbandonedShip_HiddenFloorRooms/map.json +++ b/data/maps/AbandonedShip_HiddenFloorRooms/map.json @@ -24,7 +24,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_HiddenFloorRooms_EventScript_29127B", + "script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemLuxuryBall", "flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_6_LUXURY_BALL" }, { @@ -37,7 +37,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_HiddenFloorRooms_EventScript_291288", + "script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemScanner", "flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_4_SCANNER" }, { @@ -50,7 +50,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_HiddenFloorRooms_EventScript_2912A2", + "script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemTM18", "flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM_18" }, { @@ -63,7 +63,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_HiddenFloorRooms_EventScript_291295", + "script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemWaterStone", "flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_3_WATER_STONE" } ], diff --git a/data/maps/AbandonedShip_Room_B1F/map.json b/data/maps/AbandonedShip_Room_B1F/map.json index 60dd5e1b3..b8e2a71da 100644 --- a/data/maps/AbandonedShip_Room_B1F/map.json +++ b/data/maps/AbandonedShip_Room_B1F/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_Room_B1F_EventScript_291254", + "script": "AbandonedShip_Room_B1F_EventScript_ItemTM13", "flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM_13" } ], diff --git a/data/maps/AbandonedShip_Rooms2_1F/map.json b/data/maps/AbandonedShip_Rooms2_1F/map.json index 49a4c2da0..35b029f7f 100644 --- a/data/maps/AbandonedShip_Rooms2_1F/map.json +++ b/data/maps/AbandonedShip_Rooms2_1F/map.json @@ -50,7 +50,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_Rooms2_1F_EventScript_291261", + "script": "AbandonedShip_Rooms2_1F_EventScript_ItemRevive", "flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_2_1F_REVIVE" }, { diff --git a/data/maps/AbandonedShip_Rooms2_B1F/map.json b/data/maps/AbandonedShip_Rooms2_B1F/map.json index 3f56bf6cd..621b80bb1 100644 --- a/data/maps/AbandonedShip_Rooms2_B1F/map.json +++ b/data/maps/AbandonedShip_Rooms2_B1F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_Rooms2_B1F_EventScript_291247", + "script": "AbandonedShip_Rooms2_B1F_EventScript_ItemDiveBall", "flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_2_B1F_DIVE_BALL" } ], diff --git a/data/maps/AbandonedShip_Rooms_1F/map.json b/data/maps/AbandonedShip_Rooms_1F/map.json index e97c74fcf..af25a3994 100644 --- a/data/maps/AbandonedShip_Rooms_1F/map.json +++ b/data/maps/AbandonedShip_Rooms_1F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_Rooms_1F_EventScript_29122D", + "script": "AbandonedShip_Rooms_1F_EventScript_ItemHarborMail", "flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_1F_HARBOR_MAIL" }, { diff --git a/data/maps/AbandonedShip_Rooms_B1F/map.json b/data/maps/AbandonedShip_Rooms_B1F/map.json index 65b5fb9cf..2e836f3a1 100644 --- a/data/maps/AbandonedShip_Rooms_B1F/map.json +++ b/data/maps/AbandonedShip_Rooms_B1F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AbandonedShip_Rooms_B1F_EventScript_29123A", + "script": "AbandonedShip_Rooms_B1F_EventScript_ItemEscapeRope", "flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_ESCAPE_ROPE" } ], diff --git a/data/maps/AlteringCave/scripts.inc b/data/maps/AlteringCave/scripts.inc index 185466c80..19fd1fb0b 100644 --- a/data/maps/AlteringCave/scripts.inc +++ b/data/maps/AlteringCave/scripts.inc @@ -1,8 +1,8 @@ AlteringCave_MapScripts:: @ 823B177 - map_script MAP_SCRIPT_ON_TRANSITION, AlteringCave_MapScript1_23B17D + map_script MAP_SCRIPT_ON_TRANSITION, AlteringCave_MapScript1_SetLandmark .byte 0 -AlteringCave_MapScript1_23B17D: @ 823B17D +AlteringCave_MapScript1_SetLandmark: @ 823B17D setflag FLAG_LANDMARK_ALTERING_CAVE end diff --git a/data/maps/AquaHideout_B1F/map.json b/data/maps/AquaHideout_B1F/map.json index 5b6beee11..8cdc901ec 100644 --- a/data/maps/AquaHideout_B1F/map.json +++ b/data/maps/AquaHideout_B1F/map.json @@ -50,7 +50,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AquaHideout_B1F_EventScript_291372", + "script": "AquaHideout_B1F_EventScript_ItemMaxElixir", "flag": "FLAG_ITEM_AQUA_HIDEOUT_B1F_MAX_ELIXIR" }, { @@ -76,7 +76,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AquaHideout_B1F_EventScript_291358", + "script": "AquaHideout_B1F_EventScript_ItemMasterBall", "flag": "FLAG_ITEM_AQUA_HIDEOUT_B1F_MASTER_BALL" }, { @@ -102,7 +102,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AquaHideout_B1F_EventScript_291365", + "script": "AquaHideout_B1F_EventScript_ItemNugget", "flag": "FLAG_ITEM_AQUA_HIDEOUT_B1F_NUGGET" }, { diff --git a/data/maps/AquaHideout_B2F/map.json b/data/maps/AquaHideout_B2F/map.json index 64c6eddff..b286872af 100644 --- a/data/maps/AquaHideout_B2F/map.json +++ b/data/maps/AquaHideout_B2F/map.json @@ -50,7 +50,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "AquaHideout_B2F_EventScript_29137F", + "script": "AquaHideout_B2F_EventScript_ItemNestBall", "flag": "FLAG_ITEM_AQUA_HIDEOUT_B2F_NEST_BALL" }, { diff --git a/data/maps/ArtisanCave_1F/map.json b/data/maps/ArtisanCave_1F/map.json index 2092ca7ea..dc7792d8a 100644 --- a/data/maps/ArtisanCave_1F/map.json +++ b/data/maps/ArtisanCave_1F/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "ArtisanCave_1F_EventScript_2914D1", + "script": "ArtisanCave_1F_EventScript_ItemCarbos", "flag": "FLAG_ITEM_ARTISAN_CAVE_1F_CARBOS" } ], diff --git a/data/maps/ArtisanCave_B1F/map.json b/data/maps/ArtisanCave_B1F/map.json index 32174cd44..2fec826cd 100644 --- a/data/maps/ArtisanCave_B1F/map.json +++ b/data/maps/ArtisanCave_B1F/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "ArtisanCave_B1F_EventScript_2914C4", + "script": "ArtisanCave_B1F_EventScript_ItemHPUp", "flag": "FLAG_ITEM_ARTISAN_CAVE_B1F_HP_UP" } ], diff --git a/data/maps/ArtisanCave_B1F/scripts.inc b/data/maps/ArtisanCave_B1F/scripts.inc index 433991bea..a64fe4ab9 100644 --- a/data/maps/ArtisanCave_B1F/scripts.inc +++ b/data/maps/ArtisanCave_B1F/scripts.inc @@ -1,8 +1,8 @@ ArtisanCave_B1F_MapScripts:: @ 823AFAD - map_script MAP_SCRIPT_ON_TRANSITION, ArtisanCave_B1F_MapScript1_23AFB3 + map_script MAP_SCRIPT_ON_TRANSITION, ArtisanCave_B1F_MapScript1_SetLandmark .byte 0 -ArtisanCave_B1F_MapScript1_23AFB3: @ 823AFB3 +ArtisanCave_B1F_MapScript1_SetLandmark: @ 823AFB3 setflag FLAG_LANDMARK_ARTISAN_CAVE end diff --git a/data/maps/BattleFrontier_ReceptionGate/scripts.inc b/data/maps/BattleFrontier_ReceptionGate/scripts.inc index 8ce438d75..369c30aca 100644 --- a/data/maps/BattleFrontier_ReceptionGate/scripts.inc +++ b/data/maps/BattleFrontier_ReceptionGate/scripts.inc @@ -1,9 +1,9 @@ BattleFrontier_ReceptionGate_MapScripts:: @ 82661DA map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_ReceptionGate_MapScript2_2661E9 - map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_ReceptionGate_MapScript1_2661E5 + map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_ReceptionGate_MapScript1_SetLandmark .byte 0 -BattleFrontier_ReceptionGate_MapScript1_2661E5: @ 82661E5 +BattleFrontier_ReceptionGate_MapScript1_SetLandmark: @ 82661E5 setflag FLAG_LANDMARK_BATTLE_FRONTIER end diff --git a/data/maps/DesertUnderpass/scripts.inc b/data/maps/DesertUnderpass/scripts.inc index 9c5e83180..1b8324d8a 100644 --- a/data/maps/DesertUnderpass/scripts.inc +++ b/data/maps/DesertUnderpass/scripts.inc @@ -1,8 +1,8 @@ DesertUnderpass_MapScripts:: @ 823AF37 - map_script MAP_SCRIPT_ON_TRANSITION, DesertUnderpass_MapScript1_23AF3D + map_script MAP_SCRIPT_ON_TRANSITION, DesertUnderpass_MapScript1_SetLandmark .byte 0 -DesertUnderpass_MapScript1_23AF3D: @ 823AF3D +DesertUnderpass_MapScript1_SetLandmark: @ 823AF3D setflag FLAG_LANDMARK_DESERT_UNDERPASS end diff --git a/data/maps/FieryPath/map.json b/data/maps/FieryPath/map.json index 61324a8ff..9bb09fe5a 100644 --- a/data/maps/FieryPath/map.json +++ b/data/maps/FieryPath/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "FieryPath_EventScript_29119E", + "script": "FieryPath_EventScript_ItemTM06", "flag": "FLAG_ITEM_FIERY_PATH_TM06" }, { @@ -115,7 +115,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "FieryPath_EventScript_291191", + "script": "FieryPath_EventScript_ItemFireStone", "flag": "FLAG_ITEM_FIERY_PATH_FIRE_STONE" } ], diff --git a/data/maps/GraniteCave_1F/map.json b/data/maps/GraniteCave_1F/map.json index 67f2e8000..2413a023d 100644 --- a/data/maps/GraniteCave_1F/map.json +++ b/data/maps/GraniteCave_1F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "GraniteCave_1F_EventScript_291150", + "script": "GraniteCave_1F_EventScript_ItemEscapeRope", "flag": "FLAG_ITEM_GRANITE_CAVE_1F_ESCAPE_ROPE" } ], diff --git a/data/maps/GraniteCave_B1F/map.json b/data/maps/GraniteCave_B1F/map.json index b33e751e5..5a4548164 100644 --- a/data/maps/GraniteCave_B1F/map.json +++ b/data/maps/GraniteCave_B1F/map.json @@ -24,7 +24,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "GraniteCave_B1F_EventScript_29115D", + "script": "GraniteCave_B1F_EventScript_ItemPokeBall", "flag": "FLAG_ITEM_GRANITE_CAVE_B1F_POKE_BALL" } ], diff --git a/data/maps/GraniteCave_B2F/map.json b/data/maps/GraniteCave_B2F/map.json index 48de00180..73a13d6d2 100644 --- a/data/maps/GraniteCave_B2F/map.json +++ b/data/maps/GraniteCave_B2F/map.json @@ -24,7 +24,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "GraniteCave_B2F_EventScript_29116A", + "script": "GraniteCave_B2F_EventScript_ItemRepel", "flag": "FLAG_ITEM_GRANITE_CAVE_B2F_REPEL" }, { @@ -37,7 +37,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "GraniteCave_B2F_EventScript_291177", + "script": "GraniteCave_B2F_EventScript_ItemRareCandy", "flag": "FLAG_ITEM_GRANITE_CAVE_B2F_RARE_CANDY" }, { diff --git a/data/maps/JaggedPass/map.json b/data/maps/JaggedPass/map.json index 3ec89fce6..e695c826c 100644 --- a/data/maps/JaggedPass/map.json +++ b/data/maps/JaggedPass/map.json @@ -50,7 +50,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "JaggedPass_EventScript_291184", + "script": "JaggedPass_EventScript_ItemBurnHeal", "flag": "FLAG_ITEM_JAGGED_PASS_BURN_HEAL" }, { diff --git a/data/maps/LilycoveCity/map.json b/data/maps/LilycoveCity/map.json index ea771c3b5..26f0ad36d 100644 --- a/data/maps/LilycoveCity/map.json +++ b/data/maps/LilycoveCity/map.json @@ -165,7 +165,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "LilycoveCity_EventScript_2910E8", + "script": "LilycoveCity_EventScript_ItemMaxRepel", "flag": "FLAG_ITEM_LILYCOVE_CITY_MAX_REPEL" }, { diff --git a/data/maps/MagmaHideout_1F/map.json b/data/maps/MagmaHideout_1F/map.json index 8eb3e23b5..2bbcf77a0 100644 --- a/data/maps/MagmaHideout_1F/map.json +++ b/data/maps/MagmaHideout_1F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MagmaHideout_1F_EventScript_2914DE", + "script": "MagmaHideout_1F_EventScript_ItemRareCandy", "flag": "FLAG_ITEM_MAGMA_HIDEOUT_1F_RARE_CANDY" }, { diff --git a/data/maps/MagmaHideout_2F_2R/map.json b/data/maps/MagmaHideout_2F_2R/map.json index ef7086bbf..b52d34212 100644 --- a/data/maps/MagmaHideout_2F_2R/map.json +++ b/data/maps/MagmaHideout_2F_2R/map.json @@ -50,7 +50,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MagmaHideout_2F_2R_EventScript_2914EB", + "script": "MagmaHideout_2F_2R_EventScript_MaxElixir", "flag": "FLAG_ITEM_MAGMA_HIDEOUT_2F_2R_MAX_ELIXIR" }, { @@ -89,7 +89,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MagmaHideout_2F_2R_EventScript_2914F8", + "script": "MagmaHideout_2F_2R_EventScript_ItemFullRestore", "flag": "FLAG_ITEM_MAGMA_HIDEOUT_2F_2R_FULL_RESTORE" } ], diff --git a/data/maps/MagmaHideout_3F_1R/map.json b/data/maps/MagmaHideout_3F_1R/map.json index 67202e748..e3c1bac70 100644 --- a/data/maps/MagmaHideout_3F_1R/map.json +++ b/data/maps/MagmaHideout_3F_1R/map.json @@ -50,7 +50,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MagmaHideout_3F_1R_EventScript_291505", + "script": "MagmaHideout_3F_1R_EventScript_ItemNugget", "flag": "FLAG_ITEM_MAGMA_HIDEOUT_3F_1R_NUGGET" } ], diff --git a/data/maps/MagmaHideout_3F_2R/map.json b/data/maps/MagmaHideout_3F_2R/map.json index bc67b15e5..e4b267858 100644 --- a/data/maps/MagmaHideout_3F_2R/map.json +++ b/data/maps/MagmaHideout_3F_2R/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MagmaHideout_3F_2R_EventScript_291512", + "script": "MagmaHideout_3F_2R_EventScript_ItemPPMax", "flag": "FLAG_ITEM_MAGMA_HIDEOUT_3F_2R_PP_MAX" } ], diff --git a/data/maps/MagmaHideout_3F_3R/map.json b/data/maps/MagmaHideout_3F_3R/map.json index 00fc5a46c..6ec900c31 100644 --- a/data/maps/MagmaHideout_3F_3R/map.json +++ b/data/maps/MagmaHideout_3F_3R/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MagmaHideout_3F_3R_EventScript_29152C", + "script": "MagmaHideout_3F_3R_EventScript_ItemEscapeRope", "flag": "FLAG_ITEM_MAGMA_HIDEOUT_3F_3R_ECAPE_ROPE" } ], diff --git a/data/maps/MagmaHideout_4F/map.json b/data/maps/MagmaHideout_4F/map.json index b627ae1ed..5eebc41d8 100644 --- a/data/maps/MagmaHideout_4F/map.json +++ b/data/maps/MagmaHideout_4F/map.json @@ -115,7 +115,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MagmaHideout_4F_EventScript_29151F", + "script": "MagmaHideout_4F_EventScript_MaxRevive", "flag": "FLAG_ITEM_MAGMA_HIDEOUT_4F_MAX_REVIVE" } ], diff --git a/data/maps/MauvilleCity/map.json b/data/maps/MauvilleCity/map.json index e44bc78dd..4163f4d9d 100644 --- a/data/maps/MauvilleCity/map.json +++ b/data/maps/MauvilleCity/map.json @@ -149,7 +149,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MauvilleCity_EventScript_2910CE", + "script": "MauvilleCity_EventScript_ItemXSpeed", "flag": "FLAG_ITEM_MAUVILLE_CITY_X_SPEED" }, { diff --git a/data/maps/MeteorFalls_1F_1R/map.json b/data/maps/MeteorFalls_1F_1R/map.json index 586de013f..200c03e86 100644 --- a/data/maps/MeteorFalls_1F_1R/map.json +++ b/data/maps/MeteorFalls_1F_1R/map.json @@ -24,7 +24,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MeteorFalls_1F_1R_EventScript_2911AB", + "script": "MeteorFalls_1F_1R_EventScript_ItemTM23", "flag": "FLAG_ITEM_METEOR_FALLS_1F_1R_TM_23" }, { @@ -37,7 +37,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MeteorFalls_1F_1R_EventScript_2911C5", + "script": "MeteorFalls_1F_1R_EventScript_ItemMoonStone", "flag": "FLAG_ITEM_METEOR_FALLS_1F_1R_MOON_STONE" }, { @@ -50,7 +50,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MeteorFalls_1F_1R_EventScript_2911B8", + "script": "MeteorFalls_1F_1R_EventScript_ItemFullHeal", "flag": "FLAG_ITEM_METEOR_FALLS_1F_1R_FULL_HEAL" }, { @@ -63,7 +63,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MeteorFalls_1F_1R_EventScript_2911D2", + "script": "MeteorFalls_1F_1R_EventScript_ItemPPUP", "flag": "FLAG_ITEM_METEOR_FALLS_1F_1R_PP_UP" }, { diff --git a/data/maps/MeteorFalls_B1F_2R/map.json b/data/maps/MeteorFalls_B1F_2R/map.json index 7c45bfdd0..8fd3eb4a2 100644 --- a/data/maps/MeteorFalls_B1F_2R/map.json +++ b/data/maps/MeteorFalls_B1F_2R/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MeteorFalls_B1F_2R_EventScript_2911DF", + "script": "MeteorFalls_B1F_2R_EventScript_ItemTM02", "flag": "FLAG_ITEM_METEOR_FALLS_B1F_2R_TM_02" } ], diff --git a/data/maps/MossdeepCity/map.json b/data/maps/MossdeepCity/map.json index 99d7ae01c..533183a35 100644 --- a/data/maps/MossdeepCity/map.json +++ b/data/maps/MossdeepCity/map.json @@ -105,7 +105,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MossdeepCity_EventScript_2910F5", + "script": "MossdeepCity_EventScript_ItemNetBall", "flag": "FLAG_ITEM_MOSSDEEP_CITY_NET_BALL" }, { diff --git a/data/maps/MtPyre_2F/map.json b/data/maps/MtPyre_2F/map.json index 7a5c4d639..64657cb0d 100644 --- a/data/maps/MtPyre_2F/map.json +++ b/data/maps/MtPyre_2F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MtPyre_2F_EventScript_2912FD", + "script": "MtPyre_2F_EventScript_ItemUltraBall", "flag": "FLAG_ITEM_MT_PYRE_2F_ULTRA_BALL" }, { diff --git a/data/maps/MtPyre_3F/map.json b/data/maps/MtPyre_3F/map.json index b8684cff9..3e06adf8c 100644 --- a/data/maps/MtPyre_3F/map.json +++ b/data/maps/MtPyre_3F/map.json @@ -50,7 +50,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MtPyre_3F_EventScript_29130A", + "script": "MtPyre_3F_EventScript_ItemSuperRepel", "flag": "FLAG_ITEM_MT_PYRE_3F_SUPER_REPEL" }, { diff --git a/data/maps/MtPyre_4F/map.json b/data/maps/MtPyre_4F/map.json index 59d4dd110..782a6221e 100644 --- a/data/maps/MtPyre_4F/map.json +++ b/data/maps/MtPyre_4F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MtPyre_4F_EventScript_291317", + "script": "MtPyre_4F_EventScript_ItemSeaIncense", "flag": "FLAG_ITEM_MT_PYRE_4F_SEA_INCENSE" } ], diff --git a/data/maps/MtPyre_5F/map.json b/data/maps/MtPyre_5F/map.json index 1c035bd4d..edd3544ca 100644 --- a/data/maps/MtPyre_5F/map.json +++ b/data/maps/MtPyre_5F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MtPyre_5F_EventScript_291324", + "script": "MtPyre_5F_EventScript_ItemLaxIncense", "flag": "FLAG_ITEM_MT_PYRE_5F_LAX_INCENSE" } ], diff --git a/data/maps/MtPyre_6F/map.json b/data/maps/MtPyre_6F/map.json index 8f7c4f30f..3c889a7e0 100644 --- a/data/maps/MtPyre_6F/map.json +++ b/data/maps/MtPyre_6F/map.json @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MtPyre_6F_EventScript_291331", + "script": "MtPyre_6F_EventScript_ItemTM30", "flag": "FLAG_ITEM_MT_PYRE_6F_TM_30" }, { diff --git a/data/maps/MtPyre_Exterior/map.json b/data/maps/MtPyre_Exterior/map.json index 2a8a5eaff..c7653bbd1 100644 --- a/data/maps/MtPyre_Exterior/map.json +++ b/data/maps/MtPyre_Exterior/map.json @@ -24,7 +24,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MtPyre_Exterior_EventScript_29133E", + "script": "MtPyre_Exterior_EventScript_ItemMaxPotion", "flag": "FLAG_ITEM_MT_PYRE_EXTERIOR_MAX_POTION" }, { @@ -37,7 +37,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "MtPyre_Exterior_EventScript_29134B", + "script": "MtPyre_Exterior_EventScript_ItemTM48", "flag": "FLAG_ITEM_MT_PYRE_EXTERIOR_TM_48" } ], diff --git a/data/maps/NewMauville_Entrance/scripts.inc b/data/maps/NewMauville_Entrance/scripts.inc index c3ed930a5..1df4c53e4 100644 --- a/data/maps/NewMauville_Entrance/scripts.inc +++ b/data/maps/NewMauville_Entrance/scripts.inc @@ -1,6 +1,6 @@ NewMauville_Entrance_MapScripts:: @ 82372AD map_script MAP_SCRIPT_ON_LOAD, NewMauville_Entrance_MapScript1_2372B8 - map_script MAP_SCRIPT_ON_TRANSITION, NewMauville_Entrance_MapScript1_2372FB + map_script MAP_SCRIPT_ON_TRANSITION, NewMauville_Entrance_MapScript1_SetLandmark .byte 0 NewMauville_Entrance_MapScript1_2372B8: @ 82372B8 @@ -17,7 +17,7 @@ NewMauville_Entrance_EventScript_2372C4:: @ 82372C4 setmetatile 5, 1, 798, 1 return -NewMauville_Entrance_MapScript1_2372FB: @ 82372FB +NewMauville_Entrance_MapScript1_SetLandmark: @ 82372FB setflag FLAG_LANDMARK_NEW_MAUVILLE end diff --git a/data/maps/NewMauville_Inside/map.json b/data/maps/NewMauville_Inside/map.json index b13d6059d..e58588a47 100644 --- a/data/maps/NewMauville_Inside/map.json +++ b/data/maps/NewMauville_Inside/map.json @@ -24,7 +24,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "NewMauville_Inside_EventScript_2911EC", + "script": "NewMauville_Inside_EventScript_ItemUltraRope", "flag": "FLAG_ITEM_NEW_MAUVILLE_ULTRA_BALL" }, { @@ -37,7 +37,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "NewMauville_Inside_EventScript_2911F9", + "script": "NewMauville_Inside_EventScript_ItemEscapeRope", "flag": "FLAG_ITEM_NEW_MAUVILLE_ESCAPE_ROPE" }, { @@ -50,7 +50,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "NewMauville_Inside_EventScript_291206", + "script": "NewMauville_Inside_EventScript_ItemThunderStone", "flag": "FLAG_ITEM_NEW_MAUVILLE_THUNDER_STONE" }, { @@ -63,7 +63,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "NewMauville_Inside_EventScript_291213", + "script": "NewMauville_Inside_EventScript_ItemFullHeal", "flag": "FLAG_ITEM_NEW_MAUVILLE_FULL_HEAL" }, { @@ -76,7 +76,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "NewMauville_Inside_EventScript_291220", + "script": "NewMauville_Inside_EventScript_ItemParalyzeHeal", "flag": "FLAG_ITEM_NEW_MAUVILLE_PARALYZE_HEAL" }, { diff --git a/data/maps/PetalburgCity/map.json b/data/maps/PetalburgCity/map.json index 6a9a6b33d..00e89bfa0 100644 --- a/data/maps/PetalburgCity/map.json +++ b/data/maps/PetalburgCity/map.json @@ -100,7 +100,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "PetalburgCity_EventScript_2910B4", + "script": "PetalburgCity_EventScript_ItemMaxRevive", "flag": "FLAG_ITEM_PETALBURG_CITY_MAX_REVIVE" }, { @@ -113,7 +113,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "PetalburgCity_EventScript_2910C1", + "script": "PetalburgCity_EventScript_ItemEther", "flag": "FLAG_ITEM_PETALBURG_CITY_ETHER" }, { diff --git a/data/maps/PetalburgWoods/map.json b/data/maps/PetalburgWoods/map.json index 4bca7bb5e..6d1bc22a5 100644 --- a/data/maps/PetalburgWoods/map.json +++ b/data/maps/PetalburgWoods/map.json @@ -76,7 +76,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "PetalburgWoods_EventScript_29110F", + "script": "PetalburgWoods_EventScript_ItemGreatBall", "flag": "FLAG_ITEM_PETALBURG_WOODS_GREAT_BALL" }, { @@ -89,7 +89,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "PetalburgWoods_EventScript_291102", + "script": "PetalburgWoods_EventScript_ItemXAttack", "flag": "FLAG_ITEM_PETALBURG_WOODS_X_ATTACK" }, { @@ -102,7 +102,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "PetalburgWoods_EventScript_29111C", + "script": "PetalburgWoods_EventScript_ItemEther", "flag": "FLAG_ITEM_PETALBURG_WOODS_ETHER" }, { @@ -167,7 +167,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "PetalburgWoods_EventScript_291129", + "script": "PetalburgWoods_EventScript_ItemParalyzeHeal", "flag": "FLAG_ITEM_PETALBURD_WOODS_PARALYZE_HEAL" }, { diff --git a/data/maps/Route102/map.json b/data/maps/Route102/map.json index 7a6c6d963..323c4142b 100644 --- a/data/maps/Route102/map.json +++ b/data/maps/Route102/map.json @@ -100,7 +100,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route102_EventScript_290CD8", + "script": "Route102_EventScript_ItemPotion", "flag": "FLAG_ITEM_ROUTE_102_POTION" }, { diff --git a/data/maps/Route103/map.json b/data/maps/Route103/map.json index 6516e99dc..91004d1ab 100644 --- a/data/maps/Route103/map.json +++ b/data/maps/Route103/map.json @@ -191,7 +191,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route103_EventScript_290CE5", + "script": "Route103_EventScript_ItemGuardSpec", "flag": "FLAG_ITEM_ROUTE_103_GUARD_SPEC" }, { @@ -282,7 +282,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route103_EventScript_290CF2", + "script": "Route103_EventScript_ItemPPUp", "flag": "FLAG_ITEM_ROUTE_103_PP_UP" } ], diff --git a/data/maps/Route104/map.json b/data/maps/Route104/map.json index e14a73c29..7bfe6e164 100644 --- a/data/maps/Route104/map.json +++ b/data/maps/Route104/map.json @@ -300,7 +300,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route104_EventScript_290CFF", + "script": "Route104_EventScript_ItemPPUp", "flag": "FLAG_ITEM_ROUTE_104_PP_UP" }, { @@ -378,7 +378,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route104_EventScript_290D0C", + "script": "Route104_EventScript_ItemPokeBall", "flag": "FLAG_ITEM_ROUTE_104_POKE_BALL" }, { @@ -404,7 +404,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route104_EventScript_290D19", + "script": "Route104_EventScript_ItemXAccuracy", "flag": "FLAG_ITEM_ROUTE_104_X_ACCURACY" }, { @@ -430,7 +430,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route104_EventScript_290D26", + "script": "Route104_EventScript_ItemPotion", "flag": "FLAG_ITEM_ROUTE_104_POTION" }, { diff --git a/data/maps/Route105/map.json b/data/maps/Route105/map.json index b42965229..4d447d4f8 100644 --- a/data/maps/Route105/map.json +++ b/data/maps/Route105/map.json @@ -92,7 +92,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route105_EventScript_290D33", + "script": "Route105_EventScript_ItemIron", "flag": "FLAG_ITEM_ROUTE_105_IRON" }, { diff --git a/data/maps/Route106/map.json b/data/maps/Route106/map.json index 93e98078b..70558d26e 100644 --- a/data/maps/Route106/map.json +++ b/data/maps/Route106/map.json @@ -87,7 +87,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route106_EventScript_290D40", + "script": "Route106_EventScript_ItemProtein", "flag": "FLAG_ITEM_ROUTE_106_PROTEIN" } ], diff --git a/data/maps/Route108/map.json b/data/maps/Route108/map.json index bb22c01e3..b8b188637 100644 --- a/data/maps/Route108/map.json +++ b/data/maps/Route108/map.json @@ -113,7 +113,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route108_EventScript_290D4D", + "script": "Route108_EventScript_ItemStarPiece", "flag": "FLAG_ITEM_ROUTE_108_STAR_PIECE" } ], diff --git a/data/maps/Route109/map.json b/data/maps/Route109/map.json index 9bb4d21de..361467266 100644 --- a/data/maps/Route109/map.json +++ b/data/maps/Route109/map.json @@ -152,7 +152,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route109_EventScript_290D5A", + "script": "Route109_EventScript_ItemPPUp", "flag": "FLAG_ITEM_ROUTE_109_PP_UP" }, { @@ -321,7 +321,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route109_EventScript_290D67", + "script": "Route109_EventScript_ItemPotion", "flag": "FLAG_ITEM_ROUTE_109_POTION" }, { diff --git a/data/maps/Route109_SeashoreHouse/scripts.inc b/data/maps/Route109_SeashoreHouse/scripts.inc index ed27e32ff..d33113136 100644 --- a/data/maps/Route109_SeashoreHouse/scripts.inc +++ b/data/maps/Route109_SeashoreHouse/scripts.inc @@ -1,8 +1,8 @@ Route109_SeashoreHouse_MapScripts:: @ 82693F4 - map_script MAP_SCRIPT_ON_TRANSITION, Route109_SeashoreHouse_MapScript1_2693FA + map_script MAP_SCRIPT_ON_TRANSITION, Route109_SeashoreHouse_MapScript1_SetLandmark .byte 0 -Route109_SeashoreHouse_MapScript1_2693FA: @ 82693FA +Route109_SeashoreHouse_MapScript1_SetLandmark: @ 82693FA setflag FLAG_LANDMARK_SEASHORE_HOUSE end diff --git a/data/maps/Route110/map.json b/data/maps/Route110/map.json index a9ac7796a..8cbc93af6 100644 --- a/data/maps/Route110/map.json +++ b/data/maps/Route110/map.json @@ -274,7 +274,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_EventScript_290D81", + "script": "Route110_EventScript_ItemDireHit", "flag": "FLAG_ITEM_ROUTE_110_DIRE_HIT" }, { @@ -287,7 +287,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_EventScript_290D74", + "script": "Route110_EventScript_ItemRareCandy", "flag": "FLAG_ITEM_ROUTE_109_RARE_CANDY" }, { @@ -482,7 +482,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_EventScript_290D8E", + "script": "Route110_EventScript_ItemElixir", "flag": "FLAG_ITEM_ROUTE_110_ELIXIR" }, { diff --git a/data/maps/Route110_TrickHousePuzzle1/map.json b/data/maps/Route110_TrickHousePuzzle1/map.json index 849e74b62..c6609d103 100644 --- a/data/maps/Route110_TrickHousePuzzle1/map.json +++ b/data/maps/Route110_TrickHousePuzzle1/map.json @@ -180,7 +180,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle1_EventScript_29140E", + "script": "Route110_TrickHousePuzzle1_EventScript_ItemOrangeMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_1_ORANGE_MAIL" }, { diff --git a/data/maps/Route110_TrickHousePuzzle2/map.json b/data/maps/Route110_TrickHousePuzzle2/map.json index 9903231e7..3a9ed637d 100644 --- a/data/maps/Route110_TrickHousePuzzle2/map.json +++ b/data/maps/Route110_TrickHousePuzzle2/map.json @@ -63,7 +63,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle2_EventScript_291428", + "script": "Route110_TrickHousePuzzle2_EventScript_ItemWaveMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_2_WAVE_MAIL" }, { @@ -76,7 +76,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle2_EventScript_29141B", + "script": "Route110_TrickHousePuzzle2_EventScript_ItemHarborMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_2_HARBOR_MAIL" } ], diff --git a/data/maps/Route110_TrickHousePuzzle3/map.json b/data/maps/Route110_TrickHousePuzzle3/map.json index 22807b80b..e69580793 100644 --- a/data/maps/Route110_TrickHousePuzzle3/map.json +++ b/data/maps/Route110_TrickHousePuzzle3/map.json @@ -63,7 +63,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle3_EventScript_291442", + "script": "Route110_TrickHousePuzzle3_EventScript_ItemWoodMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_3_WOOD_MAIL" }, { @@ -76,7 +76,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle3_EventScript_291435", + "script": "Route110_TrickHousePuzzle3_EventScript_ItemShadowMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_3_SHADOW_MAIL" }, { diff --git a/data/maps/Route110_TrickHousePuzzle4/map.json b/data/maps/Route110_TrickHousePuzzle4/map.json index 542a67aec..47238a559 100644 --- a/data/maps/Route110_TrickHousePuzzle4/map.json +++ b/data/maps/Route110_TrickHousePuzzle4/map.json @@ -63,7 +63,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle4_EventScript_29144F", + "script": "Route110_TrickHousePuzzle4_EventScript_ItemMechMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_4_MECH_MAIL" }, { diff --git a/data/maps/Route110_TrickHousePuzzle6/map.json b/data/maps/Route110_TrickHousePuzzle6/map.json index 144916353..aef182fbb 100644 --- a/data/maps/Route110_TrickHousePuzzle6/map.json +++ b/data/maps/Route110_TrickHousePuzzle6/map.json @@ -63,7 +63,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle6_EventScript_29145C", + "script": "Route110_TrickHousePuzzle6_EventScript_ItemGlitterMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_6_GLITTER_MAIL" } ], diff --git a/data/maps/Route110_TrickHousePuzzle7/map.json b/data/maps/Route110_TrickHousePuzzle7/map.json index 0263e0848..09fdafbe2 100644 --- a/data/maps/Route110_TrickHousePuzzle7/map.json +++ b/data/maps/Route110_TrickHousePuzzle7/map.json @@ -63,7 +63,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle7_EventScript_291469", + "script": "Route110_TrickHousePuzzle7_EventScript_ItemTropicMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_7_TROPIC_MAIL" }, { diff --git a/data/maps/Route110_TrickHousePuzzle8/map.json b/data/maps/Route110_TrickHousePuzzle8/map.json index f73e60337..b7a06abce 100644 --- a/data/maps/Route110_TrickHousePuzzle8/map.json +++ b/data/maps/Route110_TrickHousePuzzle8/map.json @@ -63,7 +63,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route110_TrickHousePuzzle8_EventScript_291476", + "script": "Route110_TrickHousePuzzle8_EventScript_ItemBeadMail", "flag": "FLAG_ITEM_TRICK_HOUSE_PUZZLE_8_BEAD_MAIL" } ], diff --git a/data/maps/Route111/map.json b/data/maps/Route111/map.json index ef981272a..d3428f8c6 100644 --- a/data/maps/Route111/map.json +++ b/data/maps/Route111/map.json @@ -261,7 +261,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route111_EventScript_290D9B", + "script": "Route111_EventScript_ItemTM37", "flag": "FLAG_ITEM_ROUTE_111_TM_37" }, { @@ -352,7 +352,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route111_EventScript_290DA8", + "script": "Route111_EventScript_ItemStardust", "flag": "FLAG_ITEM_ROUTE_111_STARDUST" }, { @@ -365,7 +365,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route111_EventScript_290DB5", + "script": "Route111_EventScript_ItemHPUp", "flag": "FLAG_ITEM_ROUTE_111_HP_UP" }, { @@ -573,7 +573,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route111_EventScript_290DC2", + "script": "Route111_EventScript_ItemElixir", "flag": "FLAG_ITEM_ROUTE_111_ELIXIR" }, { diff --git a/data/maps/Route111_OldLadysRestStop/scripts.inc b/data/maps/Route111_OldLadysRestStop/scripts.inc index 9427e8692..9495c4539 100644 --- a/data/maps/Route111_OldLadysRestStop/scripts.inc +++ b/data/maps/Route111_OldLadysRestStop/scripts.inc @@ -1,8 +1,8 @@ Route111_OldLadysRestStop_MapScripts:: @ 822A916 - map_script MAP_SCRIPT_ON_TRANSITION, Route111_OldLadysRestStop_MapScript1_22A91C + map_script MAP_SCRIPT_ON_TRANSITION, Route111_OldLadysRestStop_MapScript1_SetLandmark .byte 0 -Route111_OldLadysRestStop_MapScript1_22A91C: @ 822A91C +Route111_OldLadysRestStop_MapScript1_SetLandmark: @ 822A91C setflag FLAG_LANDMARK_OLD_LADY_REST_SHOP end diff --git a/data/maps/Route112/map.json b/data/maps/Route112/map.json index 8839cc114..b963c6c48 100644 --- a/data/maps/Route112/map.json +++ b/data/maps/Route112/map.json @@ -183,7 +183,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route112_EventScript_290DCF", + "script": "Route112_EventScript_ItemNugget", "flag": "FLAG_ITEM_ROUTE_112_NUGGET" }, { diff --git a/data/maps/Route113/map.json b/data/maps/Route113/map.json index 1ae33fda7..bcff99de4 100644 --- a/data/maps/Route113/map.json +++ b/data/maps/Route113/map.json @@ -105,7 +105,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route113_EventScript_290DDC", + "script": "Route113_EventScript_ItemMaxEther", "flag": "FLAG_ITEM_ROUTE_113_MAX_ETHER" }, { @@ -118,7 +118,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route113_EventScript_290DE9", + "script": "Route113_EventScript_ItemSuperRepel", "flag": "FLAG_ITEM_ROUTE_113_SUPER_REPEL" }, { @@ -183,7 +183,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route113_EventScript_290DF6", + "script": "Route113_EventScript_ItemHyperPotion", "flag": "FLAG_ITEM_ROUTE_113_HYPER_POTION" }, { diff --git a/data/maps/Route114/map.json b/data/maps/Route114/map.json index 9d1002910..08f2996d2 100644 --- a/data/maps/Route114/map.json +++ b/data/maps/Route114/map.json @@ -139,7 +139,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route114_EventScript_290E03", + "script": "Route114_EventScript_ItemRareCandy", "flag": "FLAG_ITEM_ROUTE_114_RARE_CANDY" }, { @@ -152,7 +152,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route114_EventScript_290E10", + "script": "Route114_EventScript_ItemProtein", "flag": "FLAG_ITEM_ROUTE_114_PROTEIN" }, { @@ -360,7 +360,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route114_EventScript_290E1D", + "script": "Route114_EventScript_ItemEnergyPowder", "flag": "FLAG_ITEM_ROUTE_114_ENERGY_POWDER" }, { diff --git a/data/maps/Route114_FossilManiacsHouse/scripts.inc b/data/maps/Route114_FossilManiacsHouse/scripts.inc index c6b63d8da..d41bc0dee 100644 --- a/data/maps/Route114_FossilManiacsHouse/scripts.inc +++ b/data/maps/Route114_FossilManiacsHouse/scripts.inc @@ -1,8 +1,8 @@ Route114_FossilManiacsHouse_MapScripts:: @ 822AD30 - map_script MAP_SCRIPT_ON_TRANSITION, Route114_FossilManiacsHouse_MapScript1_22AD36 + map_script MAP_SCRIPT_ON_TRANSITION, Route114_FossilManiacsHouse_MapScript1_SetLandmark .byte 0 -Route114_FossilManiacsHouse_MapScript1_22AD36: @ 822AD36 +Route114_FossilManiacsHouse_MapScript1_SetLandmark: @ 822AD36 setflag FLAG_LANDMARK_FOSSIL_MANIACS_HOUSE end diff --git a/data/maps/Route114_LanettesHouse/scripts.inc b/data/maps/Route114_LanettesHouse/scripts.inc index 1cf7ffb47..5ea42a42a 100644 --- a/data/maps/Route114_LanettesHouse/scripts.inc +++ b/data/maps/Route114_LanettesHouse/scripts.inc @@ -1,8 +1,8 @@ Route114_LanettesHouse_MapScripts:: @ 822B2C8 - map_script MAP_SCRIPT_ON_TRANSITION, Route114_LanettesHouse_MapScript1_22B2CE + map_script MAP_SCRIPT_ON_TRANSITION, Route114_LanettesHouse_MapScript1_SetLandmark .byte 0 -Route114_LanettesHouse_MapScript1_22B2CE: @ 822B2CE +Route114_LanettesHouse_MapScript1_SetLandmark: @ 822B2CE setflag FLAG_LANDMARK_LANETTES_HOUSE end diff --git a/data/maps/Route115/map.json b/data/maps/Route115/map.json index 1c7603b58..484699ec6 100644 --- a/data/maps/Route115/map.json +++ b/data/maps/Route115/map.json @@ -152,7 +152,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route115_EventScript_290E2A", + "script": "Route115_EventScript_ItemSuperPotion", "flag": "FLAG_ITEM_ROUTE_115_SUPER_POTION" }, { @@ -165,7 +165,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route115_EventScript_290E37", + "script": "Route115_EventScript_ItemTM01", "flag": "FLAG_ITEM_ROUTE_115_TM_01" }, { @@ -178,7 +178,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route115_EventScript_290E44", + "script": "Route115_EventScript_ItemIron", "flag": "FLAG_ITEM_ROUTE_115_IRON" }, { @@ -230,7 +230,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route115_EventScript_290E51", + "script": "Route115_EventScript_ItemGreatBall", "flag": "FLAG_ITEM_ROUTE_115_GREAT_BALL" }, { @@ -308,7 +308,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route115_EventScript_290E6B", + "script": "Route115_EventScript_ItemPPUp", "flag": "FLAG_ITEM_ROUTE_115_PP_UP" }, { @@ -321,7 +321,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route115_EventScript_290E5E", + "script": "Route115_EventScript_ItemHealPowder", "flag": "FLAG_ITEM_ROUTE_115_HEAL_POWDER" } ], diff --git a/data/maps/Route116/map.json b/data/maps/Route116/map.json index 27eb381d0..0745af08c 100644 --- a/data/maps/Route116/map.json +++ b/data/maps/Route116/map.json @@ -113,7 +113,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route116_EventScript_290E85", + "script": "Route116_EventScript_ItemEther", "flag": "FLAG_ITEM_ROUTE_116_ETHER" }, { @@ -126,7 +126,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route116_EventScript_290E92", + "script": "Route116_EventScript_ItemRepel", "flag": "FLAG_ITEM_ROUTE_116_REPEL" }, { @@ -217,7 +217,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route116_EventScript_290E9F", + "script": "Route116_EventScript_ItemHPUp", "flag": "FLAG_ITEM_ROUTE_116_HP_UP" }, { @@ -282,7 +282,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route116_EventScript_290E78", + "script": "Route116_EventScript_ItemXSpecial", "flag": "FLAG_ITEM_ROUTE_116_X_SPECIAL" }, { @@ -347,7 +347,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route116_EventScript_290EAC", + "script": "Route116_EventScript_ItemPotion", "flag": "FLAG_ITEM_ROUTE_116_POTION" }, { diff --git a/data/maps/Route116_TunnelersRestHouse/scripts.inc b/data/maps/Route116_TunnelersRestHouse/scripts.inc index bdd22aadd..f9ebcc76a 100644 --- a/data/maps/Route116_TunnelersRestHouse/scripts.inc +++ b/data/maps/Route116_TunnelersRestHouse/scripts.inc @@ -1,8 +1,8 @@ Route116_TunnelersRestHouse_MapScripts:: @ 822B850 - map_script MAP_SCRIPT_ON_TRANSITION, Route116_TunnelersRestHouse_MapScript1_22B856 + map_script MAP_SCRIPT_ON_TRANSITION, Route116_TunnelersRestHouse_MapScript1_SetLandmark .byte 0 -Route116_TunnelersRestHouse_MapScript1_22B856: @ 822B856 +Route116_TunnelersRestHouse_MapScript1_SetLandmark: @ 822B856 setflag FLAG_LANDMARK_TUNNELERS_REST_HOUSE end diff --git a/data/maps/Route117/map.json b/data/maps/Route117/map.json index c4cb4d5e5..efaad2802 100644 --- a/data/maps/Route117/map.json +++ b/data/maps/Route117/map.json @@ -204,7 +204,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route117_EventScript_290EB9", + "script": "Route117_EventScript_ItemGreatBall", "flag": "FLAG_ITEM_ROUTE_117_GREAT_BALL" }, { @@ -230,7 +230,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route117_EventScript_290EC6", + "script": "Route117_EventScript_ItemRevive", "flag": "FLAG_ITEM_ROUTE_117_REVIVE" }, { diff --git a/data/maps/Route117_PokemonDayCare/scripts.inc b/data/maps/Route117_PokemonDayCare/scripts.inc index ea9894ffc..b9ddfaa5a 100644 --- a/data/maps/Route117_PokemonDayCare/scripts.inc +++ b/data/maps/Route117_PokemonDayCare/scripts.inc @@ -1,8 +1,8 @@ Route117_PokemonDayCare_MapScripts:: @ 822BBB1 - map_script MAP_SCRIPT_ON_TRANSITION, Route117_PokemonDayCare_MapScript1_22BBB7 + map_script MAP_SCRIPT_ON_TRANSITION, Route117_PokemonDayCare_MapScript1_SetLandmark .byte 0 -Route117_PokemonDayCare_MapScript1_22BBB7: @ 822BBB7 +Route117_PokemonDayCare_MapScript1_SetLandmark: @ 822BBB7 setflag FLAG_LANDMARK_POKEMON_DAYCARE end diff --git a/data/maps/Route118/map.json b/data/maps/Route118/map.json index 7fc1e45c7..0a3fee210 100644 --- a/data/maps/Route118/map.json +++ b/data/maps/Route118/map.json @@ -287,7 +287,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route118_EventScript_290ED3", + "script": "Route118_EventScript_ItemHyperPotion", "flag": "FLAG_ITEM_ROUTE_118_HYPER_POTION" }, { diff --git a/data/maps/Route119/map.json b/data/maps/Route119/map.json index 2146d5ec7..c84ff9db1 100644 --- a/data/maps/Route119/map.json +++ b/data/maps/Route119/map.json @@ -243,7 +243,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_290EE0", + "script": "Route119_EventScript_ItemSuperRepel", "flag": "FLAG_ITEM_ROUTE_119_SUPER_REPEL" }, { @@ -256,7 +256,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_290EED", + "script": "Route119_EventScript_ItemZinc", "flag": "FLAG_ITEM_ROUTE_119_ZINC" }, { @@ -269,7 +269,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_290EFA", + "script": "Route119_EventScript_ItemElixir", "flag": "FLAG_ITEM_ROUTE_119_ELIXIR_1" }, { @@ -282,7 +282,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_290F07", + "script": "Route119_EventScript_ItemLeafStone", "flag": "FLAG_ITEM_ROUTE_119_LEAF_STONE" }, { @@ -295,7 +295,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_290F14", + "script": "Route119_EventScript_ItemRareCandy", "flag": "FLAG_ITEM_ROUTE_119_RARE_CANDY" }, { @@ -308,7 +308,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_290F21", + "script": "Route119_EventScript_ItemHyperPotion", "flag": "FLAG_ITEM_ROUTE_119_HYPER_POTION_1" }, { @@ -438,7 +438,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_290F2E", + "script": "Route119_EventScript_ItemHyperPotion2", "flag": "FLAG_ITEM_ROUTE_119_HYPER_POTION_2" }, { @@ -555,7 +555,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_291399", + "script": "Route119_EventScript_ItemNugget", "flag": "FLAG_ITEM_ROUTE_119_NUGGET" }, { @@ -568,7 +568,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route119_EventScript_290F3B", + "script": "Route119_EventScript_ItemElixir2", "flag": "FLAG_ITEM_ROUTE_119_ELIXIR_2" }, { diff --git a/data/maps/Route120/map.json b/data/maps/Route120/map.json index 63585f86f..1bdbd0bca 100644 --- a/data/maps/Route120/map.json +++ b/data/maps/Route120/map.json @@ -230,7 +230,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route120_EventScript_290F48", + "script": "Route120_EventScript_ItemNugget", "flag": "FLAG_ITEM_ROUTE_120_NUGGET" }, { @@ -308,7 +308,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route120_EventScript_290F55", + "script": "Route120_EventScript_ItemFullHeal", "flag": "FLAG_ITEM_ROUTE_120_FULL_HEAL" }, { @@ -386,7 +386,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route120_EventScript_290F6F", + "script": "Route120_EventScript_ItemNestBall", "flag": "FLAG_ITEM_ROUTE_120_NEST_BALL" }, { @@ -399,7 +399,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route120_EventScript_290F62", + "script": "Route120_EventScript_ItemHyperPotion", "flag": "FLAG_ITEM_ROUTE_120_HYPER_POTION" }, { @@ -594,7 +594,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route120_EventScript_290F7C", + "script": "Route120_EventScript_ItemRevive", "flag": "FLAG_ITEM_ROUTE_120_REVIVE" } ], diff --git a/data/maps/Route121/map.json b/data/maps/Route121/map.json index 4339b149d..f1152b465 100644 --- a/data/maps/Route121/map.json +++ b/data/maps/Route121/map.json @@ -300,7 +300,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route121_EventScript_290F89", + "script": "Route121_EventScript_ItemCarbos", "flag": "FLAG_ITEM_ROUTE_121_CARBOS" }, { @@ -391,7 +391,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route121_EventScript_290F96", + "script": "Route121_EventScript_ItemRevive", "flag": "FLAG_ITEM_ROUTE_121_REVIVE" }, { @@ -404,7 +404,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route121_EventScript_290FA3", + "script": "Route121_EventScript_ItemZinc", "flag": "FLAG_ITEM_ROUTE_121_ZINC" } ], diff --git a/data/maps/Route123/map.json b/data/maps/Route123/map.json index 6562fa7a9..1e562420d 100644 --- a/data/maps/Route123/map.json +++ b/data/maps/Route123/map.json @@ -295,7 +295,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route123_EventScript_290FB0", + "script": "Route123_EventScript_ItemCalcium", "flag": "FLAG_ITEM_ROUTE_123_CALCIUM" }, { @@ -438,7 +438,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route123_EventScript_290FBD", + "script": "Route123_EventScript_ItemUltraBall", "flag": "FLAG_ITEM_ROUTE_123_ULTRA_BALL" }, { @@ -451,7 +451,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route123_EventScript_290FCA", + "script": "Route123_EventScript_ItemElixir", "flag": "FLAG_ITEM_ROUTE_123_ELIXIR" }, { @@ -542,7 +542,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route123_EventScript_290FD7", + "script": "Route123_EventScript_ItemPPUp", "flag": "FLAG_ITEM_ROUTE_123_PP_UP" }, { @@ -581,7 +581,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route123_EventScript_290FE4", + "script": "Route123_EventScript_ItemRevivalHerb", "flag": "FLAG_ITEM_ROUTE_123_REVIVAL_HERB" } ], diff --git a/data/maps/Route123_BerryMastersHouse/scripts.inc b/data/maps/Route123_BerryMastersHouse/scripts.inc index 31158782d..0f0326119 100644 --- a/data/maps/Route123_BerryMastersHouse/scripts.inc +++ b/data/maps/Route123_BerryMastersHouse/scripts.inc @@ -1,8 +1,8 @@ Route123_BerryMastersHouse_MapScripts:: @ 826F83B - map_script MAP_SCRIPT_ON_TRANSITION, Route123_BerryMastersHouse_MapScript1_26F841 + map_script MAP_SCRIPT_ON_TRANSITION, Route123_BerryMastersHouse_MapScript1_SetLandmark .byte 0 -Route123_BerryMastersHouse_MapScript1_26F841: @ 826F841 +Route123_BerryMastersHouse_MapScript1_SetLandmark: @ 826F841 setflag FLAG_LANDMARK_BERRY_MASTERS_HOUSE end diff --git a/data/maps/Route124/map.json b/data/maps/Route124/map.json index c1a22a2d0..913208954 100644 --- a/data/maps/Route124/map.json +++ b/data/maps/Route124/map.json @@ -115,7 +115,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route124_EventScript_290FF1", + "script": "Route124_EventScript_ItemRedShard", "flag": "FLAG_ITEM_ROUTE_124_RED_SHARD" }, { @@ -128,7 +128,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route124_EventScript_290FFE", + "script": "Route124_EventScript_ItemBlueShard", "flag": "FLAG_ITEM_ROUTE_124_BLUE_SHARD" }, { @@ -141,7 +141,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route124_EventScript_29100B", + "script": "Route124_EventScript_ItemYellowShard", "flag": "FLAG_ITEM_ROUTE_124_YELLOW_SHARD" }, { diff --git a/data/maps/Route124_DivingTreasureHuntersHouse/scripts.inc b/data/maps/Route124_DivingTreasureHuntersHouse/scripts.inc index 250a5ba51..a1b7527a1 100644 --- a/data/maps/Route124_DivingTreasureHuntersHouse/scripts.inc +++ b/data/maps/Route124_DivingTreasureHuntersHouse/scripts.inc @@ -1,8 +1,8 @@ Route124_DivingTreasureHuntersHouse_MapScripts:: @ 8270A28 - map_script MAP_SCRIPT_ON_TRANSITION, Route124_DivingTreasureHuntersHouse_MapScript1_270A2E + map_script MAP_SCRIPT_ON_TRANSITION, Route124_DivingTreasureHuntersHouse_MapScript1_SetLandmark .byte 0 -Route124_DivingTreasureHuntersHouse_MapScript1_270A2E: @ 8270A2E +Route124_DivingTreasureHuntersHouse_MapScript1_SetLandmark: @ 8270A2E setflag FLAG_LANDMARK_HUNTERS_HOUSE end diff --git a/data/maps/Route125/map.json b/data/maps/Route125/map.json index 0ce520fdd..27615a521 100644 --- a/data/maps/Route125/map.json +++ b/data/maps/Route125/map.json @@ -157,7 +157,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route125_EventScript_291018", + "script": "Route125_EventScript_ItemBigPearl", "flag": "FLAG_ITEM_ROUTE_125_BIG_PEARL" } ], diff --git a/data/maps/Route126/map.json b/data/maps/Route126/map.json index ea63eb80d..b8359bd84 100644 --- a/data/maps/Route126/map.json +++ b/data/maps/Route126/map.json @@ -92,7 +92,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route126_EventScript_291025", + "script": "Route126_EventScript_ItemGreenShard", "flag": "FLAG_ITEM_ROUTE_126_GREEN_SHARD" }, { diff --git a/data/maps/Route127/map.json b/data/maps/Route127/map.json index e4a68c3e1..08d39d971 100644 --- a/data/maps/Route127/map.json +++ b/data/maps/Route127/map.json @@ -71,7 +71,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route127_EventScript_291032", + "script": "Route127_EventScript_ItemZinc", "flag": "FLAG_ITEM_ROUTE_127_ZINC" }, { @@ -84,7 +84,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route127_EventScript_29103F", + "script": "Route127_EventScript_ItemCarbos", "flag": "FLAG_ITEM_ROUTE_127_CARBOS" }, { @@ -175,7 +175,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route127_EventScript_29104C", + "script": "Route127_EventScript_ItemRareCandy", "flag": "FLAG_ITEM_ROUTE_127_RARE_CANDY" } ], diff --git a/data/maps/Route132/map.json b/data/maps/Route132/map.json index 15c0de83d..8a7597826 100644 --- a/data/maps/Route132/map.json +++ b/data/maps/Route132/map.json @@ -61,7 +61,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route132_EventScript_291059", + "script": "Route132_EventScript_ItemRareCandy", "flag": "FLAG_ITEM_ROUTE_132_RARE_CANDY" }, { @@ -152,7 +152,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route132_EventScript_291066", + "script": "Route132_EventScript_ItemProtein", "flag": "FLAG_ITEM_ROUTE_132_PROTEIN" } ], diff --git a/data/maps/Route133/map.json b/data/maps/Route133/map.json index eed30d7ee..8622515f0 100644 --- a/data/maps/Route133/map.json +++ b/data/maps/Route133/map.json @@ -74,7 +74,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route133_EventScript_291073", + "script": "Route133_EventScript_ItemBigPearl", "flag": "FLAG_ITEM_ROUTE_133_BIG_PEARL" }, { @@ -87,7 +87,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route133_EventScript_291080", + "script": "Route133_EventScript_ItemStarPiece", "flag": "FLAG_ITEM_ROUTE_133_STAR_PIECE" }, { @@ -152,7 +152,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route133_EventScript_29108D", + "script": "Route133_EventScript_ItemMaxRevive", "flag": "FLAG_ITEM_ROUTE_133_MAX_REVIVE" } ], diff --git a/data/maps/Route134/map.json b/data/maps/Route134/map.json index 8b3a9518e..e45920576 100644 --- a/data/maps/Route134/map.json +++ b/data/maps/Route134/map.json @@ -152,7 +152,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route134_EventScript_29109A", + "script": "Route134_EventScript_ItemCarbos", "flag": "FLAG_ITEM_ROUTE_134_CARBOS" }, { @@ -165,7 +165,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Route134_EventScript_2910A7", + "script": "Route134_EventScript_ItemStarPiece", "flag": "FLAG_ITEM_ROUTE_134_STAR_PIECE" } ], diff --git a/data/maps/RustboroCity/map.json b/data/maps/RustboroCity/map.json index 04c68baa3..94e22985b 100644 --- a/data/maps/RustboroCity/map.json +++ b/data/maps/RustboroCity/map.json @@ -183,7 +183,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "RustboroCity_EventScript_2910DB", + "script": "RustboroCity_EventScript_ItemXDefend", "flag": "FLAG_ITEM_RUSTBORO_CITY_X_DEFEND" }, { diff --git a/data/maps/RusturfTunnel/map.json b/data/maps/RusturfTunnel/map.json index b873c76c8..9fc378729 100644 --- a/data/maps/RusturfTunnel/map.json +++ b/data/maps/RusturfTunnel/map.json @@ -50,7 +50,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "RusturfTunnel_EventScript_291136", + "script": "RusturfTunnel_EventScript_ItemPokeBall", "flag": "FLAG_ITEM_RUSTURF_TUNNEL_POKE_BALL" }, { @@ -63,7 +63,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "RusturfTunnel_EventScript_291143", + "script": "RusturfTunnel_EventScript_ItemMaxEther", "flag": "FLAG_ITEM_RUSTURF_TUNNEL_MAX_ETHER" }, { diff --git a/data/maps/SafariZone_North/map.json b/data/maps/SafariZone_North/map.json index 7c637f0ef..967e55f3e 100644 --- a/data/maps/SafariZone_North/map.json +++ b/data/maps/SafariZone_North/map.json @@ -144,7 +144,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "SafariZone_North_EventScript_2912C9", + "script": "SafariZone_North_EventScript_ItemCalcium", "flag": "FLAG_ITEM_SAFARI_ZONE_NORTH_CALCIUM" } ], diff --git a/data/maps/SafariZone_Northeast/map.json b/data/maps/SafariZone_Northeast/map.json index 8e3337f53..94c2c268f 100644 --- a/data/maps/SafariZone_Northeast/map.json +++ b/data/maps/SafariZone_Northeast/map.json @@ -139,7 +139,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "SafariZone_Northeast_EventScript_2912E3", + "script": "SafariZone_Northeast_EventScript_ItemNugget", "flag": "FLAG_ITEM_SAFARI_ZONE_NORTH_EAST_NUGGET" } ], diff --git a/data/maps/SafariZone_Northwest/map.json b/data/maps/SafariZone_Northwest/map.json index 2d3a1fa49..6ead6d714 100644 --- a/data/maps/SafariZone_Northwest/map.json +++ b/data/maps/SafariZone_Northwest/map.json @@ -48,7 +48,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "SafariZone_Northwest_EventScript_2912BC", + "script": "SafariZone_Northwest_EventScript_ItemTM22", "flag": "FLAG_ITEM_SAFARI_ZONE_NORTH_WEST_TM_22" } ], diff --git a/data/maps/SafariZone_Southeast/map.json b/data/maps/SafariZone_Southeast/map.json index 3ace62488..cb293b149 100644 --- a/data/maps/SafariZone_Southeast/map.json +++ b/data/maps/SafariZone_Southeast/map.json @@ -74,7 +74,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "SafariZone_Southeast_EventScript_2912F0", + "script": "SafariZone_Southeast_EventScript_ItemBigPearl", "flag": "FLAG_ITEM_SAFARI_ZONE_SOUTH_EAST_BIG_PEARL" }, { diff --git a/data/maps/SafariZone_Southwest/map.json b/data/maps/SafariZone_Southwest/map.json index 5e383a694..3784db801 100644 --- a/data/maps/SafariZone_Southwest/map.json +++ b/data/maps/SafariZone_Southwest/map.json @@ -48,7 +48,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "SafariZone_Southwest_EventScript_2912D6", + "script": "SafariZone_Southwest_EventScript_ItemMaxRevive", "flag": "FLAG_ITEM_SAFARI_ZONE_SOUTH_WEST_MAX_REVIVE" } ], diff --git a/data/maps/ScorchedSlab/map.json b/data/maps/ScorchedSlab/map.json index 304ebd676..5abcf9adf 100644 --- a/data/maps/ScorchedSlab/map.json +++ b/data/maps/ScorchedSlab/map.json @@ -24,7 +24,7 @@ "movement_range_y": 0, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "ScorchedSlab_EventScript_2912AF", + "script": "ScorchedSlab_EventScript_ItemTM11", "flag": "FLAG_ITEM_SCORCHED_SLAB_TM_11" } ], diff --git a/data/maps/ScorchedSlab/scripts.inc b/data/maps/ScorchedSlab/scripts.inc index 62a546780..3d6aa1cfe 100644 --- a/data/maps/ScorchedSlab/scripts.inc +++ b/data/maps/ScorchedSlab/scripts.inc @@ -1,8 +1,8 @@ ScorchedSlab_MapScripts:: @ 8239291 - map_script MAP_SCRIPT_ON_TRANSITION, ScorchedSlab_MapScript1_239297 + map_script MAP_SCRIPT_ON_TRANSITION, ScorchedSlab_MapScript1_SetLandmark .byte 0 -ScorchedSlab_MapScript1_239297: @ 8239297 +ScorchedSlab_MapScript1_SetLandmark: @ 8239297 setflag FLAG_LANDMARK_SCORCHED_SLAB end diff --git a/data/maps/SeafloorCavern_Room9/map.json b/data/maps/SeafloorCavern_Room9/map.json index f4f7fd336..77dcdc169 100644 --- a/data/maps/SeafloorCavern_Room9/map.json +++ b/data/maps/SeafloorCavern_Room9/map.json @@ -89,7 +89,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "SeafloorCavern_Room9_EventScript_291401", + "script": "SeafloorCavern_Room9_EventScript_ItemTM26", "flag": "FLAG_ITEM_SEAFLOOR_CAVERN_ROOM_9_TM_26" }, { diff --git a/data/maps/SealedChamber_OuterRoom/scripts.inc b/data/maps/SealedChamber_OuterRoom/scripts.inc index 71e6426fe..f0337548e 100644 --- a/data/maps/SealedChamber_OuterRoom/scripts.inc +++ b/data/maps/SealedChamber_OuterRoom/scripts.inc @@ -1,6 +1,6 @@ SealedChamber_OuterRoom_MapScripts:: @ 8239106 map_script MAP_SCRIPT_ON_RESUME, SealedChamber_OuterRoom_MapScript1_239116 - map_script MAP_SCRIPT_ON_TRANSITION, SealedChamber_OuterRoom_MapScript1_239127 + map_script MAP_SCRIPT_ON_TRANSITION, SealedChamber_OuterRoom_MapScript1_SetLandmark map_script MAP_SCRIPT_ON_LOAD, SealedChamber_OuterRoom_MapScript1_23912B .byte 0 @@ -9,7 +9,7 @@ SealedChamber_OuterRoom_MapScript1_239116: @ 8239116 setescapewarp MAP_UNDERWATER_SEALED_CHAMBER, 255, 12, 44 end -SealedChamber_OuterRoom_MapScript1_239127: @ 8239127 +SealedChamber_OuterRoom_MapScript1_SetLandmark: @ 8239127 setflag FLAG_LANDMARK_SEALED_CHAMBER end diff --git a/data/maps/ShoalCave_LowTideEntranceRoom/map.json b/data/maps/ShoalCave_LowTideEntranceRoom/map.json index 1ebb9f555..4b5d23110 100644 --- a/data/maps/ShoalCave_LowTideEntranceRoom/map.json +++ b/data/maps/ShoalCave_LowTideEntranceRoom/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "ShoalCave_LowTideEntranceRoom_EventScript_2913C0", + "script": "ShoalCave_LowTideEntranceRoom_EventScript_ItemBigPearl", "flag": "FLAG_ITEM_SHOAL_CAVE_ENTRANCE_BIG_PEARL" }, { diff --git a/data/maps/ShoalCave_LowTideIceRoom/map.json b/data/maps/ShoalCave_LowTideIceRoom/map.json index dffef7da9..d2f69b51f 100644 --- a/data/maps/ShoalCave_LowTideIceRoom/map.json +++ b/data/maps/ShoalCave_LowTideIceRoom/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "ShoalCave_LowTideIceRoom_EventScript_2913E7", + "script": "ShoalCave_LowTideIceRoom_EventScript_ItemTM07", "flag": "FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_TM_07" }, { @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "ShoalCave_LowTideIceRoom_EventScript_2913F4", + "script": "ShoalCave_LowTideIceRoom_EventScript_ItemNeverMeltIce", "flag": "FLAG_ITEM_SHOAL_CAVE_ICE_ROOM_NEVER_MELT_ICE" } ], diff --git a/data/maps/ShoalCave_LowTideInnerRoom/map.json b/data/maps/ShoalCave_LowTideInnerRoom/map.json index 04e4ec67f..f9eec06c4 100644 --- a/data/maps/ShoalCave_LowTideInnerRoom/map.json +++ b/data/maps/ShoalCave_LowTideInnerRoom/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "ShoalCave_LowTideInnerRoom_EventScript_2913CD", + "script": "ShoalCave_LowTideInnerRoom_EventScript_ItemRareCandy", "flag": "FLAG_ITEM_SHOAL_CAVE_INNER_ROOM_RARE_CANDY" } ], diff --git a/data/maps/ShoalCave_LowTideStairsRoom/map.json b/data/maps/ShoalCave_LowTideStairsRoom/map.json index 239effc74..4da33c163 100644 --- a/data/maps/ShoalCave_LowTideStairsRoom/map.json +++ b/data/maps/ShoalCave_LowTideStairsRoom/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "ShoalCave_LowTideStairsRoom_EventScript_2913DA", + "script": "ShoalCave_LowTideStairsRoom_EventScript_ItemIceHeal", "flag": "FLAG_ITEM_SHOAL_CAVE_STAIRS_ROOM_ICE_HEAL" } ], diff --git a/data/maps/SkyPillar_Entrance/scripts.inc b/data/maps/SkyPillar_Entrance/scripts.inc index 40d57a485..7b5434eff 100644 --- a/data/maps/SkyPillar_Entrance/scripts.inc +++ b/data/maps/SkyPillar_Entrance/scripts.inc @@ -1,8 +1,8 @@ SkyPillar_Entrance_MapScripts:: @ 823929E - map_script MAP_SCRIPT_ON_TRANSITION, SkyPillar_Entrance_MapScript1_2392A4 + map_script MAP_SCRIPT_ON_TRANSITION, SkyPillar_Entrance_MapScript1_SetLandmark .byte 0 -SkyPillar_Entrance_MapScript1_2392A4: @ 82392A4 +SkyPillar_Entrance_MapScript1_SetLandmark: @ 82392A4 setflag FLAG_LANDMARK_SKY_PILLAR end diff --git a/data/maps/SouthernIsland_Exterior/scripts.inc b/data/maps/SouthernIsland_Exterior/scripts.inc index 618ce864a..84406d111 100644 --- a/data/maps/SouthernIsland_Exterior/scripts.inc +++ b/data/maps/SouthernIsland_Exterior/scripts.inc @@ -1,8 +1,8 @@ SouthernIsland_Exterior_MapScripts:: @ 82429C8 - map_script MAP_SCRIPT_ON_TRANSITION, SouthernIsland_Exterior_MapScript1_2429CE + map_script MAP_SCRIPT_ON_TRANSITION, SouthernIsland_Exterior_MapScript1_SetLandmark .byte 0 -SouthernIsland_Exterior_MapScript1_2429CE: @ 82429CE +SouthernIsland_Exterior_MapScript1_SetLandmark: @ 82429CE setflag FLAG_LANDMARK_SOUTHERN_ISLAND end diff --git a/data/maps/VictoryRoad_1F/map.json b/data/maps/VictoryRoad_1F/map.json index 05eb2b795..8685f3341 100644 --- a/data/maps/VictoryRoad_1F/map.json +++ b/data/maps/VictoryRoad_1F/map.json @@ -76,7 +76,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "VictoryRoad_1F_EventScript_291483", + "script": "VictoryRoad_1F_EventScript_ItemMaxElixir", "flag": "FLAG_ITEM_VICTORY_ROAD_1F_MAX_ELIXIR" }, { @@ -89,7 +89,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "VictoryRoad_1F_EventScript_291490", + "script": "VictoryRoad_1F_EventScript_ItemPPUp", "flag": "FLAG_ITEM_VICTORY_ROAD_1F_PP_UP" }, { diff --git a/data/maps/VictoryRoad_B1F/map.json b/data/maps/VictoryRoad_B1F/map.json index 2fde10090..74bd3dbf8 100644 --- a/data/maps/VictoryRoad_B1F/map.json +++ b/data/maps/VictoryRoad_B1F/map.json @@ -245,7 +245,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "VictoryRoad_B1F_EventScript_29149D", + "script": "VictoryRoad_B1F_EventScript_ItemTM29", "flag": "FLAG_ITEM_VICTORY_ROAD_B1F_TM_29" }, { @@ -258,7 +258,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "VictoryRoad_B1F_EventScript_2914AA", + "script": "VictoryRoad_B1F_EventScript_ItemFullRestore", "flag": "FLAG_ITEM_VICTORY_ROAD_B1F_FULL_RESTORE" }, { diff --git a/data/maps/VictoryRoad_B2F/map.json b/data/maps/VictoryRoad_B2F/map.json index fd9195ed4..de10ef891 100644 --- a/data/maps/VictoryRoad_B2F/map.json +++ b/data/maps/VictoryRoad_B2F/map.json @@ -76,7 +76,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "VictoryRoad_B2F_EventScript_2914B7", + "script": "VictoryRoad_B2F_EventScript_ItemFullHeal", "flag": "FLAG_ITEM_VICTORY_ROAD_B2F_FULL_HEAL" }, { diff --git a/data/scripts/item_ball_scripts.inc b/data/scripts/item_ball_scripts.inc index 2b0083175..045fbb5a7 100644 --- a/data/scripts/item_ball_scripts.inc +++ b/data/scripts/item_ball_scripts.inc @@ -1,659 +1,659 @@ -Route102_EventScript_290CD8:: @ 8290CD8 +Route102_EventScript_ItemPotion:: @ 8290CD8 giveitem_std ITEM_POTION, 1, 1 end -Route103_EventScript_290CE5:: @ 8290CE5 +Route103_EventScript_ItemGuardSpec:: @ 8290CE5 giveitem_std ITEM_GUARD_SPEC, 1, 1 end -Route103_EventScript_290CF2:: @ 8290CF2 +Route103_EventScript_ItemPPUp:: @ 8290CF2 giveitem_std ITEM_PP_UP, 1, 1 end -Route104_EventScript_290CFF:: @ 8290CFF +Route104_EventScript_ItemPPUp:: @ 8290CFF giveitem_std ITEM_PP_UP, 1, 1 end -Route104_EventScript_290D0C:: @ 8290D0C +Route104_EventScript_ItemPokeBall:: @ 8290D0C giveitem_std ITEM_POKE_BALL, 1, 1 end -Route104_EventScript_290D19:: @ 8290D19 +Route104_EventScript_ItemXAccuracy:: @ 8290D19 giveitem_std ITEM_X_ACCURACY, 1, 1 end -Route104_EventScript_290D26:: @ 8290D26 +Route104_EventScript_ItemPotion:: @ 8290D26 giveitem_std ITEM_POTION, 1, 1 end -Route105_EventScript_290D33:: @ 8290D33 +Route105_EventScript_ItemIron:: @ 8290D33 giveitem_std ITEM_IRON, 1, 1 end -Route106_EventScript_290D40:: @ 8290D40 +Route106_EventScript_ItemProtein:: @ 8290D40 giveitem_std ITEM_PROTEIN, 1, 1 end -Route108_EventScript_290D4D:: @ 8290D4D +Route108_EventScript_ItemStarPiece:: @ 8290D4D giveitem_std ITEM_STAR_PIECE, 1, 1 end -Route109_EventScript_290D5A:: @ 8290D5A +Route109_EventScript_ItemPPUp:: @ 8290D5A giveitem_std ITEM_PP_UP, 1, 1 end -Route109_EventScript_290D67:: @ 8290D67 +Route109_EventScript_ItemPotion:: @ 8290D67 giveitem_std ITEM_POTION, 1, 1 end -Route110_EventScript_290D74:: @ 8290D74 +Route110_EventScript_ItemRareCandy:: @ 8290D74 giveitem_std ITEM_RARE_CANDY, 1, 1 end -Route110_EventScript_290D81:: @ 8290D81 +Route110_EventScript_ItemDireHit:: @ 8290D81 giveitem_std ITEM_DIRE_HIT, 1, 1 end -Route110_EventScript_290D8E:: @ 8290D8E +Route110_EventScript_ItemElixir:: @ 8290D8E giveitem_std ITEM_ELIXIR, 1, 1 end -Route111_EventScript_290D9B:: @ 8290D9B +Route111_EventScript_ItemTM37:: @ 8290D9B giveitem_std ITEM_TM37, 1, 1 end -Route111_EventScript_290DA8:: @ 8290DA8 +Route111_EventScript_ItemStardust:: @ 8290DA8 giveitem_std ITEM_STARDUST, 1, 1 end -Route111_EventScript_290DB5:: @ 8290DB5 +Route111_EventScript_ItemHPUp:: @ 8290DB5 giveitem_std ITEM_HP_UP, 1, 1 end -Route111_EventScript_290DC2:: @ 8290DC2 +Route111_EventScript_ItemElixir:: @ 8290DC2 giveitem_std ITEM_ELIXIR, 1, 1 end -Route112_EventScript_290DCF:: @ 8290DCF +Route112_EventScript_ItemNugget:: @ 8290DCF giveitem_std ITEM_NUGGET, 1, 1 end -Route113_EventScript_290DDC:: @ 8290DDC +Route113_EventScript_ItemMaxEther:: @ 8290DDC giveitem_std ITEM_MAX_ETHER, 1, 1 end -Route113_EventScript_290DE9:: @ 8290DE9 +Route113_EventScript_ItemSuperRepel:: @ 8290DE9 giveitem_std ITEM_SUPER_REPEL, 1, 1 end -Route113_EventScript_290DF6:: @ 8290DF6 +Route113_EventScript_ItemHyperPotion:: @ 8290DF6 giveitem_std ITEM_HYPER_POTION, 1, 1 end -Route114_EventScript_290E03:: @ 8290E03 +Route114_EventScript_ItemRareCandy:: @ 8290E03 giveitem_std ITEM_RARE_CANDY, 1, 1 end -Route114_EventScript_290E10:: @ 8290E10 +Route114_EventScript_ItemProtein:: @ 8290E10 giveitem_std ITEM_PROTEIN, 1, 1 end -Route114_EventScript_290E1D:: @ 8290E1D +Route114_EventScript_ItemEnergyPowder:: @ 8290E1D giveitem_std ITEM_ENERGY_POWDER, 1, 1 end -Route115_EventScript_290E2A:: @ 8290E2A +Route115_EventScript_ItemSuperPotion:: @ 8290E2A giveitem_std ITEM_SUPER_POTION, 1, 1 end -Route115_EventScript_290E37:: @ 8290E37 +Route115_EventScript_ItemTM01:: @ 8290E37 giveitem_std ITEM_TM01, 1, 1 end -Route115_EventScript_290E44:: @ 8290E44 +Route115_EventScript_ItemIron:: @ 8290E44 giveitem_std ITEM_IRON, 1, 1 end -Route115_EventScript_290E51:: @ 8290E51 +Route115_EventScript_ItemGreatBall:: @ 8290E51 giveitem_std ITEM_GREAT_BALL, 1, 1 end -Route115_EventScript_290E5E:: @ 8290E5E +Route115_EventScript_ItemHealPowder:: @ 8290E5E giveitem_std ITEM_HEAL_POWDER, 1, 1 end -Route115_EventScript_290E6B:: @ 8290E6B +Route115_EventScript_ItemPPUp:: @ 8290E6B giveitem_std ITEM_PP_UP, 1, 1 end -Route116_EventScript_290E78:: @ 8290E78 +Route116_EventScript_ItemXSpecial:: @ 8290E78 giveitem_std ITEM_X_SPECIAL, 1, 1 end -Route116_EventScript_290E85:: @ 8290E85 +Route116_EventScript_ItemEther:: @ 8290E85 giveitem_std ITEM_ETHER, 1, 1 end -Route116_EventScript_290E92:: @ 8290E92 +Route116_EventScript_ItemRepel:: @ 8290E92 giveitem_std ITEM_REPEL, 1, 1 end -Route116_EventScript_290E9F:: @ 8290E9F +Route116_EventScript_ItemHPUp:: @ 8290E9F giveitem_std ITEM_HP_UP, 1, 1 end -Route116_EventScript_290EAC:: @ 8290EAC +Route116_EventScript_ItemPotion:: @ 8290EAC giveitem_std ITEM_POTION, 1, 1 end -Route117_EventScript_290EB9:: @ 8290EB9 +Route117_EventScript_ItemGreatBall:: @ 8290EB9 giveitem_std ITEM_GREAT_BALL, 1, 1 end -Route117_EventScript_290EC6:: @ 8290EC6 +Route117_EventScript_ItemRevive:: @ 8290EC6 giveitem_std ITEM_REVIVE, 1, 1 end -Route118_EventScript_290ED3:: @ 8290ED3 +Route118_EventScript_ItemHyperPotion:: @ 8290ED3 giveitem_std ITEM_HYPER_POTION, 1, 1 end -Route119_EventScript_290EE0:: @ 8290EE0 +Route119_EventScript_ItemSuperRepel:: @ 8290EE0 giveitem_std ITEM_SUPER_REPEL, 1, 1 end -Route119_EventScript_290EED:: @ 8290EED +Route119_EventScript_ItemZinc:: @ 8290EED giveitem_std ITEM_ZINC, 1, 1 end -Route119_EventScript_290EFA:: @ 8290EFA +Route119_EventScript_ItemElixir:: @ 8290EFA giveitem_std ITEM_ELIXIR, 1, 1 end -Route119_EventScript_290F07:: @ 8290F07 +Route119_EventScript_ItemLeafStone:: @ 8290F07 giveitem_std ITEM_LEAF_STONE, 1, 1 end -Route119_EventScript_290F14:: @ 8290F14 +Route119_EventScript_ItemRareCandy:: @ 8290F14 giveitem_std ITEM_RARE_CANDY, 1, 1 end -Route119_EventScript_290F21:: @ 8290F21 +Route119_EventScript_ItemHyperPotion:: @ 8290F21 giveitem_std ITEM_HYPER_POTION, 1, 1 end -Route119_EventScript_290F2E:: @ 8290F2E +Route119_EventScript_ItemHyperPotion2:: @ 8290F2E giveitem_std ITEM_HYPER_POTION, 1, 1 end -Route119_EventScript_290F3B:: @ 8290F3B +Route119_EventScript_ItemElixir2:: @ 8290F3B giveitem_std ITEM_ELIXIR, 1, 1 end -Route120_EventScript_290F48:: @ 8290F48 +Route120_EventScript_ItemNugget:: @ 8290F48 giveitem_std ITEM_NUGGET, 1, 1 end -Route120_EventScript_290F55:: @ 8290F55 +Route120_EventScript_ItemFullHeal:: @ 8290F55 giveitem_std ITEM_FULL_HEAL, 1, 1 end -Route120_EventScript_290F62:: @ 8290F62 +Route120_EventScript_ItemHyperPotion:: @ 8290F62 giveitem_std ITEM_HYPER_POTION, 1, 1 end -Route120_EventScript_290F6F:: @ 8290F6F +Route120_EventScript_ItemNestBall:: @ 8290F6F giveitem_std ITEM_NEST_BALL, 1, 1 end -Route120_EventScript_290F7C:: @ 8290F7C +Route120_EventScript_ItemRevive:: @ 8290F7C giveitem_std ITEM_REVIVE, 1, 1 end -Route121_EventScript_290F89:: @ 8290F89 +Route121_EventScript_ItemCarbos:: @ 8290F89 giveitem_std ITEM_CARBOS, 1, 1 end -Route121_EventScript_290F96:: @ 8290F96 +Route121_EventScript_ItemRevive:: @ 8290F96 giveitem_std ITEM_REVIVE, 1, 1 end -Route121_EventScript_290FA3:: @ 8290FA3 +Route121_EventScript_ItemZinc:: @ 8290FA3 giveitem_std ITEM_ZINC, 1, 1 end -Route123_EventScript_290FB0:: @ 8290FB0 +Route123_EventScript_ItemCalcium:: @ 8290FB0 giveitem_std ITEM_CALCIUM, 1, 1 end -Route123_EventScript_290FBD:: @ 8290FBD +Route123_EventScript_ItemUltraBall:: @ 8290FBD giveitem_std ITEM_ULTRA_BALL, 1, 1 end -Route123_EventScript_290FCA:: @ 8290FCA +Route123_EventScript_ItemElixir:: @ 8290FCA giveitem_std ITEM_ELIXIR, 1, 1 end -Route123_EventScript_290FD7:: @ 8290FD7 +Route123_EventScript_ItemPPUp:: @ 8290FD7 giveitem_std ITEM_PP_UP, 1, 1 end -Route123_EventScript_290FE4:: @ 8290FE4 +Route123_EventScript_ItemRevivalHerb:: @ 8290FE4 giveitem_std ITEM_REVIVAL_HERB, 1, 1 end -Route124_EventScript_290FF1:: @ 8290FF1 +Route124_EventScript_ItemRedShard:: @ 8290FF1 giveitem_std ITEM_RED_SHARD, 1, 1 end -Route124_EventScript_290FFE:: @ 8290FFE +Route124_EventScript_ItemBlueShard:: @ 8290FFE giveitem_std ITEM_BLUE_SHARD, 1, 1 end -Route124_EventScript_29100B:: @ 829100B +Route124_EventScript_ItemYellowShard:: @ 829100B giveitem_std ITEM_YELLOW_SHARD, 1, 1 end -Route125_EventScript_291018:: @ 8291018 +Route125_EventScript_ItemBigPearl:: @ 8291018 giveitem_std ITEM_BIG_PEARL, 1, 1 end -Route126_EventScript_291025:: @ 8291025 +Route126_EventScript_ItemGreenShard:: @ 8291025 giveitem_std ITEM_GREEN_SHARD, 1, 1 end -Route127_EventScript_291032:: @ 8291032 +Route127_EventScript_ItemZinc:: @ 8291032 giveitem_std ITEM_ZINC, 1, 1 end -Route127_EventScript_29103F:: @ 829103F +Route127_EventScript_ItemCarbos:: @ 829103F giveitem_std ITEM_CARBOS, 1, 1 end -Route127_EventScript_29104C:: @ 829104C +Route127_EventScript_ItemRareCandy:: @ 829104C giveitem_std ITEM_RARE_CANDY, 1, 1 end -Route132_EventScript_291059:: @ 8291059 +Route132_EventScript_ItemRareCandy:: @ 8291059 giveitem_std ITEM_RARE_CANDY, 1, 1 end -Route132_EventScript_291066:: @ 8291066 +Route132_EventScript_ItemProtein:: @ 8291066 giveitem_std ITEM_PROTEIN, 1, 1 end -Route133_EventScript_291073:: @ 8291073 +Route133_EventScript_ItemBigPearl:: @ 8291073 giveitem_std ITEM_BIG_PEARL, 1, 1 end -Route133_EventScript_291080:: @ 8291080 +Route133_EventScript_ItemStarPiece:: @ 8291080 giveitem_std ITEM_STAR_PIECE, 1, 1 end -Route133_EventScript_29108D:: @ 829108D +Route133_EventScript_ItemMaxRevive:: @ 829108D giveitem_std ITEM_MAX_REVIVE, 1, 1 end -Route134_EventScript_29109A:: @ 829109A +Route134_EventScript_ItemCarbos:: @ 829109A giveitem_std ITEM_CARBOS, 1, 1 end -Route134_EventScript_2910A7:: @ 82910A7 +Route134_EventScript_ItemStarPiece:: @ 82910A7 giveitem_std ITEM_STAR_PIECE, 1, 1 end -PetalburgCity_EventScript_2910B4:: @ 82910B4 +PetalburgCity_EventScript_ItemMaxRevive:: @ 82910B4 giveitem_std ITEM_MAX_REVIVE, 1, 1 end -PetalburgCity_EventScript_2910C1:: @ 82910C1 +PetalburgCity_EventScript_ItemEther:: @ 82910C1 giveitem_std ITEM_ETHER, 1, 1 end -MauvilleCity_EventScript_2910CE:: @ 82910CE +MauvilleCity_EventScript_ItemXSpeed:: @ 82910CE giveitem_std ITEM_X_SPEED, 1, 1 end -RustboroCity_EventScript_2910DB:: @ 82910DB +RustboroCity_EventScript_ItemXDefend:: @ 82910DB giveitem_std ITEM_X_DEFEND, 1, 1 end -LilycoveCity_EventScript_2910E8:: @ 82910E8 +LilycoveCity_EventScript_ItemMaxRepel:: @ 82910E8 giveitem_std ITEM_MAX_REPEL, 1, 1 end -MossdeepCity_EventScript_2910F5:: @ 82910F5 +MossdeepCity_EventScript_ItemNetBall:: @ 82910F5 giveitem_std ITEM_NET_BALL, 1, 1 end -PetalburgWoods_EventScript_291102:: @ 8291102 +PetalburgWoods_EventScript_ItemXAttack:: @ 8291102 giveitem_std ITEM_X_ATTACK, 1, 1 end -PetalburgWoods_EventScript_29110F:: @ 829110F +PetalburgWoods_EventScript_ItemGreatBall:: @ 829110F giveitem_std ITEM_GREAT_BALL, 1, 1 end -PetalburgWoods_EventScript_29111C:: @ 829111C +PetalburgWoods_EventScript_ItemEther:: @ 829111C giveitem_std ITEM_ETHER, 1, 1 end -PetalburgWoods_EventScript_291129:: @ 8291129 +PetalburgWoods_EventScript_ItemParalyzeHeal:: @ 8291129 giveitem_std ITEM_PARALYZE_HEAL, 1, 1 end -RusturfTunnel_EventScript_291136:: @ 8291136 +RusturfTunnel_EventScript_ItemPokeBall:: @ 8291136 giveitem_std ITEM_POKE_BALL, 1, 1 end -RusturfTunnel_EventScript_291143:: @ 8291143 +RusturfTunnel_EventScript_ItemMaxEther:: @ 8291143 giveitem_std ITEM_MAX_ETHER, 1, 1 end -GraniteCave_1F_EventScript_291150:: @ 8291150 +GraniteCave_1F_EventScript_ItemEscapeRope:: @ 8291150 giveitem_std ITEM_ESCAPE_ROPE, 1, 1 end -GraniteCave_B1F_EventScript_29115D:: @ 829115D +GraniteCave_B1F_EventScript_ItemPokeBall:: @ 829115D giveitem_std ITEM_POKE_BALL, 1, 1 end -GraniteCave_B2F_EventScript_29116A:: @ 829116A +GraniteCave_B2F_EventScript_ItemRepel:: @ 829116A giveitem_std ITEM_REPEL, 1, 1 end -GraniteCave_B2F_EventScript_291177:: @ 8291177 +GraniteCave_B2F_EventScript_ItemRareCandy:: @ 8291177 giveitem_std ITEM_RARE_CANDY, 1, 1 end -JaggedPass_EventScript_291184:: @ 8291184 +JaggedPass_EventScript_ItemBurnHeal:: @ 8291184 giveitem_std ITEM_BURN_HEAL, 1, 1 end -FieryPath_EventScript_291191:: @ 8291191 +FieryPath_EventScript_ItemFireStone:: @ 8291191 giveitem_std ITEM_FIRE_STONE, 1, 1 end -FieryPath_EventScript_29119E:: @ 829119E +FieryPath_EventScript_ItemTM06:: @ 829119E giveitem_std ITEM_TM06, 1, 1 end -MeteorFalls_1F_1R_EventScript_2911AB:: @ 82911AB +MeteorFalls_1F_1R_EventScript_ItemTM23:: @ 82911AB giveitem_std ITEM_TM23, 1, 1 end -MeteorFalls_1F_1R_EventScript_2911B8:: @ 82911B8 +MeteorFalls_1F_1R_EventScript_ItemFullHeal:: @ 82911B8 giveitem_std ITEM_FULL_HEAL, 1, 1 end -MeteorFalls_1F_1R_EventScript_2911C5:: @ 82911C5 +MeteorFalls_1F_1R_EventScript_ItemMoonStone:: @ 82911C5 giveitem_std ITEM_MOON_STONE, 1, 1 end -MeteorFalls_1F_1R_EventScript_2911D2:: @ 82911D2 +MeteorFalls_1F_1R_EventScript_ItemPPUP:: @ 82911D2 giveitem_std ITEM_PP_UP, 1, 1 end -MeteorFalls_B1F_2R_EventScript_2911DF:: @ 82911DF +MeteorFalls_B1F_2R_EventScript_ItemTM02:: @ 82911DF giveitem_std ITEM_TM02, 1, 1 end -NewMauville_Inside_EventScript_2911EC:: @ 82911EC +NewMauville_Inside_EventScript_ItemUltraRope:: @ 82911EC giveitem_std ITEM_ULTRA_BALL, 1, 1 end -NewMauville_Inside_EventScript_2911F9:: @ 82911F9 +NewMauville_Inside_EventScript_ItemEscapeRope:: @ 82911F9 giveitem_std ITEM_ESCAPE_ROPE, 1, 1 end -NewMauville_Inside_EventScript_291206:: @ 8291206 +NewMauville_Inside_EventScript_ItemThunderStone:: @ 8291206 giveitem_std ITEM_THUNDER_STONE, 1, 1 end -NewMauville_Inside_EventScript_291213:: @ 8291213 +NewMauville_Inside_EventScript_ItemFullHeal:: @ 8291213 giveitem_std ITEM_FULL_HEAL, 1, 1 end -NewMauville_Inside_EventScript_291220:: @ 8291220 +NewMauville_Inside_EventScript_ItemParalyzeHeal:: @ 8291220 giveitem_std ITEM_PARALYZE_HEAL, 1, 1 end -AbandonedShip_Rooms_1F_EventScript_29122D:: @ 829122D +AbandonedShip_Rooms_1F_EventScript_ItemHarborMail:: @ 829122D giveitem_std ITEM_HARBOR_MAIL, 1, 1 end -AbandonedShip_Rooms_B1F_EventScript_29123A:: @ 829123A +AbandonedShip_Rooms_B1F_EventScript_ItemEscapeRope:: @ 829123A giveitem_std ITEM_ESCAPE_ROPE, 1, 1 end -AbandonedShip_Rooms2_B1F_EventScript_291247:: @ 8291247 +AbandonedShip_Rooms2_B1F_EventScript_ItemDiveBall:: @ 8291247 giveitem_std ITEM_DIVE_BALL, 1, 1 end -AbandonedShip_Room_B1F_EventScript_291254:: @ 8291254 +AbandonedShip_Room_B1F_EventScript_ItemTM13:: @ 8291254 giveitem_std ITEM_TM13, 1, 1 end -AbandonedShip_Rooms2_1F_EventScript_291261:: @ 8291261 +AbandonedShip_Rooms2_1F_EventScript_ItemRevive:: @ 8291261 giveitem_std ITEM_REVIVE, 1, 1 end -AbandonedShip_CaptainsOffice_EventScript_29126E:: @ 829126E +AbandonedShip_CaptainsOffice_EventScript_ItemStorageKey:: @ 829126E giveitem_std ITEM_STORAGE_KEY, 1, 1 end -AbandonedShip_HiddenFloorRooms_EventScript_29127B:: @ 829127B +AbandonedShip_HiddenFloorRooms_EventScript_ItemLuxuryBall:: @ 829127B giveitem_std ITEM_LUXURY_BALL, 1, 1 end -AbandonedShip_HiddenFloorRooms_EventScript_291288:: @ 8291288 +AbandonedShip_HiddenFloorRooms_EventScript_ItemScanner:: @ 8291288 giveitem_std ITEM_SCANNER, 1, 1 end -AbandonedShip_HiddenFloorRooms_EventScript_291295:: @ 8291295 +AbandonedShip_HiddenFloorRooms_EventScript_ItemWaterStone:: @ 8291295 giveitem_std ITEM_WATER_STONE, 1, 1 end -AbandonedShip_HiddenFloorRooms_EventScript_2912A2:: @ 82912A2 +AbandonedShip_HiddenFloorRooms_EventScript_ItemTM18:: @ 82912A2 giveitem_std ITEM_TM18, 1, 1 end -ScorchedSlab_EventScript_2912AF:: @ 82912AF +ScorchedSlab_EventScript_ItemTM11:: @ 82912AF giveitem_std ITEM_TM11, 1, 1 end -SafariZone_Northwest_EventScript_2912BC:: @ 82912BC +SafariZone_Northwest_EventScript_ItemTM22:: @ 82912BC giveitem_std ITEM_TM22, 1, 1 end -SafariZone_North_EventScript_2912C9:: @ 82912C9 +SafariZone_North_EventScript_ItemCalcium:: @ 82912C9 giveitem_std ITEM_CALCIUM, 1, 1 end -SafariZone_Southwest_EventScript_2912D6:: @ 82912D6 +SafariZone_Southwest_EventScript_ItemMaxRevive:: @ 82912D6 giveitem_std ITEM_MAX_REVIVE, 1, 1 end -SafariZone_Northeast_EventScript_2912E3:: @ 82912E3 +SafariZone_Northeast_EventScript_ItemNugget:: @ 82912E3 giveitem_std ITEM_NUGGET, 1, 1 end -SafariZone_Southeast_EventScript_2912F0:: @ 82912F0 +SafariZone_Southeast_EventScript_ItemBigPearl:: @ 82912F0 giveitem_std ITEM_BIG_PEARL, 1, 1 end -MtPyre_2F_EventScript_2912FD:: @ 82912FD +MtPyre_2F_EventScript_ItemUltraBall:: @ 82912FD giveitem_std ITEM_ULTRA_BALL, 1, 1 end -MtPyre_3F_EventScript_29130A:: @ 829130A +MtPyre_3F_EventScript_ItemSuperRepel:: @ 829130A giveitem_std ITEM_SUPER_REPEL, 1, 1 end -MtPyre_4F_EventScript_291317:: @ 8291317 +MtPyre_4F_EventScript_ItemSeaIncense:: @ 8291317 giveitem_std ITEM_SEA_INCENSE, 1, 1 end -MtPyre_5F_EventScript_291324:: @ 8291324 +MtPyre_5F_EventScript_ItemLaxIncense:: @ 8291324 giveitem_std ITEM_LAX_INCENSE, 1, 1 end -MtPyre_6F_EventScript_291331:: @ 8291331 +MtPyre_6F_EventScript_ItemTM30:: @ 8291331 giveitem_std ITEM_TM30, 1, 1 end -MtPyre_Exterior_EventScript_29133E:: @ 829133E +MtPyre_Exterior_EventScript_ItemMaxPotion:: @ 829133E giveitem_std ITEM_MAX_POTION, 1, 1 end -MtPyre_Exterior_EventScript_29134B:: @ 829134B +MtPyre_Exterior_EventScript_ItemTM48:: @ 829134B giveitem_std ITEM_TM48, 1, 1 end -AquaHideout_B1F_EventScript_291358:: @ 8291358 +AquaHideout_B1F_EventScript_ItemMasterBall:: @ 8291358 giveitem_std ITEM_MASTER_BALL, 1, 1 end -AquaHideout_B1F_EventScript_291365:: @ 8291365 +AquaHideout_B1F_EventScript_ItemNugget:: @ 8291365 giveitem_std ITEM_NUGGET, 1, 1 end -AquaHideout_B1F_EventScript_291372:: @ 8291372 +AquaHideout_B1F_EventScript_ItemMaxElixir:: @ 8291372 giveitem_std ITEM_MAX_ELIXIR, 1, 1 end -AquaHideout_B2F_EventScript_29137F:: @ 829137F +AquaHideout_B2F_EventScript_ItemNestBall:: @ 829137F giveitem_std ITEM_NEST_BALL, 1, 1 end -AquaHideout_B2F_EventScript_29138C:: @ 829138C - giveitem_std ITEM_MASTER_BALL, 1, 1 +AquaHideout_B2F_EventScript_ItemMasterBall:: @ 829138C + giveitem_std ITEM_MASTER_BALL, 1, 1 // Unused end -Route119_EventScript_291399:: @ 8291399 +Route119_EventScript_ItemNugget:: @ 8291399 giveitem_std ITEM_NUGGET, 1, 1 end -Route119_EventScript_2913A6:: @ 82913A6 +Route119_EventScript_ItemMaxElixir:: @ 82913A6 giveitem_std ITEM_MAX_ELIXIR, 1, 1 end -Route119_EventScript_2913B3:: @ 82913B3 +Route119_EventScript_ItemNestBall:: @ 82913B3 giveitem_std ITEM_NEST_BALL, 1, 1 end -ShoalCave_LowTideEntranceRoom_EventScript_2913C0:: @ 82913C0 +ShoalCave_LowTideEntranceRoom_EventScript_ItemBigPearl:: @ 82913C0 giveitem_std ITEM_BIG_PEARL, 1, 1 end -ShoalCave_LowTideInnerRoom_EventScript_2913CD:: @ 82913CD +ShoalCave_LowTideInnerRoom_EventScript_ItemRareCandy:: @ 82913CD giveitem_std ITEM_RARE_CANDY, 1, 1 end -ShoalCave_LowTideStairsRoom_EventScript_2913DA:: @ 82913DA +ShoalCave_LowTideStairsRoom_EventScript_ItemIceHeal:: @ 82913DA giveitem_std ITEM_ICE_HEAL, 1, 1 end -ShoalCave_LowTideIceRoom_EventScript_2913E7:: @ 82913E7 +ShoalCave_LowTideIceRoom_EventScript_ItemTM07:: @ 82913E7 giveitem_std ITEM_TM07, 1, 1 end -ShoalCave_LowTideIceRoom_EventScript_2913F4:: @ 82913F4 +ShoalCave_LowTideIceRoom_EventScript_ItemNeverMeltIce:: @ 82913F4 giveitem_std ITEM_NEVER_MELT_ICE, 1, 1 end -SeafloorCavern_Room9_EventScript_291401:: @ 8291401 +SeafloorCavern_Room9_EventScript_ItemTM26:: @ 8291401 giveitem_std ITEM_TM26, 1, 1 end -Route110_TrickHousePuzzle1_EventScript_29140E:: @ 829140E +Route110_TrickHousePuzzle1_EventScript_ItemOrangeMail:: @ 829140E giveitem_std ITEM_ORANGE_MAIL, 1, 1 end -Route110_TrickHousePuzzle2_EventScript_29141B:: @ 829141B +Route110_TrickHousePuzzle2_EventScript_ItemHarborMail:: @ 829141B giveitem_std ITEM_HARBOR_MAIL, 1, 1 end -Route110_TrickHousePuzzle2_EventScript_291428:: @ 8291428 +Route110_TrickHousePuzzle2_EventScript_ItemWaveMail:: @ 8291428 giveitem_std ITEM_WAVE_MAIL, 1, 1 end -Route110_TrickHousePuzzle3_EventScript_291435:: @ 8291435 +Route110_TrickHousePuzzle3_EventScript_ItemShadowMail:: @ 8291435 giveitem_std ITEM_SHADOW_MAIL, 1, 1 end -Route110_TrickHousePuzzle3_EventScript_291442:: @ 8291442 +Route110_TrickHousePuzzle3_EventScript_ItemWoodMail:: @ 8291442 giveitem_std ITEM_WOOD_MAIL, 1, 1 end -Route110_TrickHousePuzzle4_EventScript_29144F:: @ 829144F +Route110_TrickHousePuzzle4_EventScript_ItemMechMail:: @ 829144F giveitem_std ITEM_MECH_MAIL, 1, 1 end -Route110_TrickHousePuzzle6_EventScript_29145C:: @ 829145C +Route110_TrickHousePuzzle6_EventScript_ItemGlitterMail:: @ 829145C giveitem_std ITEM_GLITTER_MAIL, 1, 1 end -Route110_TrickHousePuzzle7_EventScript_291469:: @ 8291469 +Route110_TrickHousePuzzle7_EventScript_ItemTropicMail:: @ 8291469 giveitem_std ITEM_TROPIC_MAIL, 1, 1 end -Route110_TrickHousePuzzle8_EventScript_291476:: @ 8291476 +Route110_TrickHousePuzzle8_EventScript_ItemBeadMail:: @ 8291476 giveitem_std ITEM_BEAD_MAIL, 1, 1 end -VictoryRoad_1F_EventScript_291483:: @ 8291483 +VictoryRoad_1F_EventScript_ItemMaxElixir:: @ 8291483 giveitem_std ITEM_MAX_ELIXIR, 1, 1 end -VictoryRoad_1F_EventScript_291490:: @ 8291490 +VictoryRoad_1F_EventScript_ItemPPUp:: @ 8291490 giveitem_std ITEM_PP_UP, 1, 1 end -VictoryRoad_B1F_EventScript_29149D:: @ 829149D +VictoryRoad_B1F_EventScript_ItemTM29:: @ 829149D giveitem_std ITEM_TM29, 1, 1 end -VictoryRoad_B1F_EventScript_2914AA:: @ 82914AA +VictoryRoad_B1F_EventScript_ItemFullRestore:: @ 82914AA giveitem_std ITEM_FULL_RESTORE, 1, 1 end -VictoryRoad_B2F_EventScript_2914B7:: @ 82914B7 +VictoryRoad_B2F_EventScript_ItemFullHeal:: @ 82914B7 giveitem_std ITEM_FULL_HEAL, 1, 1 end -ArtisanCave_B1F_EventScript_2914C4:: @ 82914C4 +ArtisanCave_B1F_EventScript_ItemHPUp:: @ 82914C4 giveitem_std ITEM_HP_UP, 1, 1 end -ArtisanCave_1F_EventScript_2914D1:: @ 82914D1 +ArtisanCave_1F_EventScript_ItemCarbos:: @ 82914D1 giveitem_std ITEM_CARBOS, 1, 1 end -MagmaHideout_1F_EventScript_2914DE:: @ 82914DE +MagmaHideout_1F_EventScript_ItemRareCandy:: @ 82914DE giveitem_std ITEM_RARE_CANDY, 1, 1 end -MagmaHideout_2F_2R_EventScript_2914EB:: @ 82914EB +MagmaHideout_2F_2R_EventScript_MaxElixir:: @ 82914EB giveitem_std ITEM_MAX_ELIXIR, 1, 1 end -MagmaHideout_2F_2R_EventScript_2914F8:: @ 82914F8 +MagmaHideout_2F_2R_EventScript_ItemFullRestore:: @ 82914F8 giveitem_std ITEM_FULL_RESTORE, 1, 1 end -MagmaHideout_3F_1R_EventScript_291505:: @ 8291505 +MagmaHideout_3F_1R_EventScript_ItemNugget:: @ 8291505 giveitem_std ITEM_NUGGET, 1, 1 end -MagmaHideout_3F_2R_EventScript_291512:: @ 8291512 +MagmaHideout_3F_2R_EventScript_ItemPPMax:: @ 8291512 giveitem_std ITEM_PP_MAX, 1, 1 end -MagmaHideout_4F_EventScript_29151F:: @ 829151F +MagmaHideout_4F_EventScript_MaxRevive:: @ 829151F giveitem_std ITEM_MAX_REVIVE, 1, 1 end -MagmaHideout_3F_3R_EventScript_29152C:: @ 829152C +MagmaHideout_3F_3R_EventScript_ItemEscapeRope:: @ 829152C giveitem_std ITEM_ESCAPE_ROPE, 1, 1 end From 8b88ef3e01ea2e574b8326fd46dfc1fc5af575e0 Mon Sep 17 00:00:00 2001 From: Fontbane Date: Wed, 3 Apr 2019 18:04:04 -0400 Subject: [PATCH 090/101] Document berry tree events --- data/scripts/berry_tree.inc | 164 ++++++++++++++++++------------------ 1 file changed, 82 insertions(+), 82 deletions(-) diff --git a/data/scripts/berry_tree.inc b/data/scripts/berry_tree.inc index 685949006..027633a82 100644 --- a/data/scripts/berry_tree.inc +++ b/data/scripts/berry_tree.inc @@ -2,142 +2,142 @@ BerryTreeScript:: @ 82742F9 special EventObjectInteractionGetBerryTreeData switch VAR_0x8004 case 255, Route102_EventScript_27434F - case 0, Route102_EventScript_274359 - case 1, Route102_EventScript_2743B1 - case 2, Route102_EventScript_2743C1 - case 3, Route102_EventScript_2743D1 - case 4, Route102_EventScript_2743E1 - case 5, Route102_EventScript_274421 + case 0, Route102_EventScript_CheckSoil + case 1, Route102_EventScript_CheckBerryStage1 + case 2, Route102_EventScript_CheckBerryStage2 + case 3, Route102_EventScript_CheckBerryStage3 + case 4, Route102_EventScript_CheckBerryStage4 + case 5, Route102_EventScript_CheckBerryFullyGrown end Route102_EventScript_27434F:: @ 827434F lockall - message Route102_Text_274744 + message Route102_Text_ExclamationPoint waitmessage waitbuttonpress releaseall end -Route102_EventScript_274359:: @ 8274359 +Route102_EventScript_CheckSoil:: @ 8274359 lock faceplayer specialvar VAR_RESULT, PlayerHasBerries compare VAR_RESULT, 1 - goto_if_eq Route102_EventScript_274374 - message Route102_Text_2744F0 + goto_if_eq Route102_EventScript_WantToPlant + message Route102_Text_ItsSoftLoamySoil waitmessage waitbuttonpress release end -Route102_EventScript_274374:: @ 8274374 - msgbox Route102_Text_274507, MSGBOX_YESNO +Route102_EventScript_WantToPlant:: @ 8274374 + msgbox Route102_Text_WantToPlant, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route102_EventScript_274393 + goto_if_eq Route102_EventScript_ChooseBerryToPlant compare VAR_RESULT, 0 - goto_if_eq Route102_EventScript_2743AF + goto_if_eq Route102_EventScript_CancelPlanting end -Route102_EventScript_274393:: @ 8274393 +Route102_EventScript_ChooseBerryToPlant:: @ 8274393 fadescreen 1 closemessage special Bag_ChooseBerry waitstate compare VAR_ITEM_ID, 0 - goto_if_eq Route102_EventScript_2743AF + goto_if_eq Route102_EventScript_CancelPlanting takeitem VAR_ITEM_ID, 1 - call Route102_EventScript_2744DD + call Route102_EventScript_PlantBerry -Route102_EventScript_2743AF:: @ 82743AF +Route102_EventScript_CancelPlanting:: @ 82743AF release end -Route102_EventScript_2743B1:: @ 82743B1 +Route102_EventScript_CheckBerryStage1:: @ 82743B1 lockall special EventObjectInteractionGetBerryCountString - message Route102_Text_274560 + message Route102_Text_BerryGrowthStage1 waitmessage waitbuttonpress - goto Route102_EventScript_27448D + goto Route102_EventScript_WantToWater -Route102_EventScript_2743C1:: @ 82743C1 +Route102_EventScript_CheckBerryStage2:: @ 82743C1 lockall special EventObjectInteractionGetBerryName - message Route102_Text_274579 + message Route102_Text_BerryGrowthStage2 waitmessage waitbuttonpress - goto Route102_EventScript_27448D + goto Route102_EventScript_WantToWater -Route102_EventScript_2743D1:: @ 82743D1 +Route102_EventScript_CheckBerryStage3:: @ 82743D1 lockall special EventObjectInteractionGetBerryName - message Route102_Text_27458A + message Route102_Text_BerryGrowthStage3 waitmessage waitbuttonpress - goto Route102_EventScript_27448D + goto Route102_EventScript_WantToWater -Route102_EventScript_2743E1:: @ 82743E1 - call Route102_EventScript_2743F6 +Route102_EventScript_CheckBerryStage4:: @ 82743E1 + call Route102_EventScript_GetCareAdverb lockall special EventObjectInteractionGetBerryName - message Route102_Text_2745AB + message Route102_Text_BerryGrowthStage4 waitmessage waitbuttonpress - goto Route102_EventScript_27448D + goto Route102_EventScript_WantToWater -Route102_EventScript_2743F6:: @ 82743F6 +Route102_EventScript_GetCareAdverb:: @ 82743F6 compare VAR_0x8005, 0 - goto_if_eq Route102_EventScript_27441A + goto_if_eq Route102_EventScript_SetAdverbPoor compare VAR_0x8005, 4 - goto_if_eq Route102_EventScript_274413 - bufferstring 1, Route102_Text_2745E5 + goto_if_eq Route102_EventScript_SetAdverbGreat + bufferstring 1, Route102_Text_CareAdverbGood return -Route102_EventScript_274413:: @ 8274413 - bufferstring 1, Route102_Text_2745CD +Route102_EventScript_SetAdverbGreat:: @ 8274413 + bufferstring 1, Route102_Text_CareAdverbGreat return -Route102_EventScript_27441A:: @ 827441A - bufferstring 1, Route102_Text_2745DE +Route102_EventScript_SetAdverbPoor:: @ 827441A + bufferstring 1, Route102_Text_CareAdverbPoor return -Route102_EventScript_274421:: @ 8274421 +Route102_EventScript_CheckBerryFullyGrown:: @ 8274421 buffernumberstring 1, VAR_0x8006 lock faceplayer special EventObjectInteractionGetBerryCountString - msgbox Route102_Text_2745EE, MSGBOX_YESNO + msgbox Route102_Text_WantToPick, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route102_EventScript_274448 + goto_if_eq Route102_EventScript_PickBerry compare VAR_RESULT, 0 - goto_if_eq Route102_EventScript_274479 + goto_if_eq Route102_EventScript_CancelPickingBerry -Route102_EventScript_274448:: @ 8274448 +Route102_EventScript_PickBerry:: @ 8274448 special EventObjectInteractionPickBerryTree compare VAR_0x8004, 0 - goto_if_eq Route102_EventScript_274470 + goto_if_eq Route102_EventScript_BerryPocketFull special sub_80EED34 special EventObjectInteractionRemoveBerryTree - message Route102_Text_27461B + message Route102_Text_PickedTheBerry playfanfare MUS_ME_KINOMI waitmessage waitfanfare waitbuttonpress - message Route102_Text_274630 + message Route102_Text_PutAwayBerry waitmessage waitbuttonpress release end -Route102_EventScript_274470:: @ 8274470 - message Route102_Text_27468F +Route102_EventScript_BerryPocketFull:: @ 8274470 + message Route102_Text_BerryPocketFull waitmessage waitbuttonpress release end -Route102_EventScript_274479:: @ 8274479 - message Route102_Text_2746CB +Route102_EventScript_CancelPickingBerry:: @ 8274479 + message Route102_Text_BerryLeftUnpicked waitmessage waitbuttonpress release @@ -146,22 +146,22 @@ Route102_EventScript_274479:: @ 8274479 Route102_EventScript_274482:: @ 8274482 lockall special EventObjectInteractionGetBerryTreeData - call Route102_EventScript_2744DD + call Route102_EventScript_PlantBerry releaseall end -Route102_EventScript_27448D:: @ 827448D +Route102_EventScript_WantToWater:: @ 827448D checkitem ITEM_WAILMER_PAIL, 1 compare VAR_RESULT, 0 - goto_if_eq Route102_EventScript_2744BE + goto_if_eq Route102_EventScript_DontWater special EventObjectInteractionGetBerryName - msgbox Route102_Text_2746E4, MSGBOX_YESNO + msgbox Route102_Text_WantToWater, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route102_EventScript_2744C4 + goto_if_eq Route102_EventScript_WaterBerry compare VAR_RESULT, 0 - goto_if_eq Route102_EventScript_2744BE + goto_if_eq Route102_EventScript_DontWater -Route102_EventScript_2744BE:: @ 82744BE +Route102_EventScript_DontWater:: @ 82744BE releaseall end @@ -169,93 +169,93 @@ Route102_EventScript_2744C0:: @ 82744C0 special EventObjectInteractionGetBerryTreeData lockall -Route102_EventScript_2744C4:: @ 82744C4 +Route102_EventScript_WaterBerry:: @ 82744C4 special EventObjectInteractionGetBerryName - message Route102_Text_274710 + message Route102_Text_WateredTheBerry waitmessage special EventObjectInteractionWaterBerryTree special DoWateringBerryTreeAnim waitstate - message Route102_Text_274723 + message Route102_Text_PlantIsDelighted waitmessage waitbuttonpress releaseall end -Route102_EventScript_2744DD:: @ 82744DD +Route102_EventScript_PlantBerry:: @ 82744DD special EventObjectInteractionPlantBerryTree incrementgamestat 3 special sub_80EED10 special EventObjectInteractionGetBerryCountString - message Route102_Text_274535 + message Route102_Text_PlantedOneBerry waitmessage waitbuttonpress return -Route102_Text_2744F0: @ 82744F0 +Route102_Text_ItsSoftLoamySoil: @ 82744F0 .string "It's soft, loamy soil.$" -Route102_Text_274507: @ 8274507 +Route102_Text_WantToPlant: @ 8274507 .string "It's soft, loamy soil.\n" .string "Want to plant a BERRY?$" -Route102_Text_274535: @ 8274535 +Route102_Text_PlantedOneBerry: @ 8274535 .string "{PLAYER} planted one {STR_VAR_1} in\n" .string "the soft, loamy soil.$" -Route102_Text_274560: @ 8274560 +Route102_Text_BerryGrowthStage1: @ 8274560 .string "One {STR_VAR_1} was planted here.$" -Route102_Text_274579: @ 8274579 +Route102_Text_BerryGrowthStage2: @ 8274579 .string "{STR_VAR_1} has sprouted.$" -Route102_Text_27458A: @ 827458A +Route102_Text_BerryGrowthStage3: @ 827458A .string "This {STR_VAR_1} plant is growing taller.$" -Route102_Text_2745AB: @ 82745AB +Route102_Text_BerryGrowthStage4: @ 82745AB .string "These {STR_VAR_1} flowers are blooming\n" .string "{STR_VAR_2}.$" -Route102_Text_2745CD: @ 82745CD +Route102_Text_CareAdverbGreat: @ 82745CD .string "very beautifully$" -Route102_Text_2745DE: @ 82745DE +Route102_Text_CareAdverbPoor: @ 82745DE .string "cutely$" -Route102_Text_2745E5: @ 82745E5 +Route102_Text_CareAdverbGood: @ 82745E5 .string "prettily$" -Route102_Text_2745EE: @ 82745EE +Route102_Text_WantToPick: @ 82745EE .string "You found {STR_VAR_2} {STR_VAR_1}!\p" .string "Do you want to pick the\n" .string "{STR_VAR_1}?$" -Route102_Text_27461B: @ 827461B +Route102_Text_PickedTheBerry: @ 827461B .string "{PLAYER} picked the {STR_VAR_2} {STR_VAR_1}.$" -Route102_Text_274630: @ 8274630 +Route102_Text_PutAwayBerry: @ 8274630 .string "{PLAYER} put away the {STR_VAR_1}\n" .string "in the BAG's BERRIES POCKET.\p" .string "The soil returned to its soft and\n" .string "loamy state.$" -Route102_Text_27468F: @ 827468F +Route102_Text_BerryPocketFull: @ 827468F .string "The BAG's BERRIES POCKET is full.\p" .string "The {STR_VAR_1} couldn't be taken.$" -Route102_Text_2746CB: @ 82746CB +Route102_Text_BerryLeftUnpicked: @ 82746CB .string "{PLAYER} left the {STR_VAR_1}\n" .string "unpicked.$" -Route102_Text_2746E4: @ 82746E4 +Route102_Text_WantToWater: @ 82746E4 .string "Want to water the {STR_VAR_1} with the\n" .string "WAILMER PAIL?$" -Route102_Text_274710: @ 8274710 +Route102_Text_WateredTheBerry: @ 8274710 .string "{PLAYER} watered the {STR_VAR_1}.$" -Route102_Text_274723: @ 8274723 +Route102_Text_PlantIsDelighted: @ 8274723 .string "The plant seems to be delighted.$" -Route102_Text_274744: @ 8274744 +Route102_Text_ExclamationPoint: @ 8274744 .string "!$" From 9e74409bb2032e25d431dda116462759e5b51fe0 Mon Sep 17 00:00:00 2001 From: Fontbane Date: Thu, 4 Apr 2019 19:28:37 -0400 Subject: [PATCH 091/101] Fix labels, label more scripts --- data/maps/AbandonedShip_Deck/scripts.inc | 4 +- data/maps/AlteringCave/scripts.inc | 4 +- data/maps/AncientTomb/scripts.inc | 4 +- data/maps/ArtisanCave_B1F/scripts.inc | 4 +- .../BattleFrontier_ReceptionGate/scripts.inc | 4 +- data/maps/DesertRuins/scripts.inc | 4 +- data/maps/DesertUnderpass/scripts.inc | 4 +- .../scripts.inc | 4 +- data/maps/FieryPath/scripts.inc | 4 +- data/maps/IslandCave/scripts.inc | 4 +- data/maps/MirageTower_1F/scripts.inc | 4 +- data/maps/NewMauville_Entrance/scripts.inc | 4 +- data/maps/Route104_MrBrineysHouse/scripts.inc | 4 +- .../scripts.inc | 4 +- data/maps/Route109_SeashoreHouse/scripts.inc | 4 +- .../Route110_TrickHouseEntrance/scripts.inc | 4 +- .../Route111_OldLadysRestStop/scripts.inc | 4 +- data/maps/Route113_GlassWorkshop/scripts.inc | 4 +- .../Route114_FossilManiacsHouse/scripts.inc | 4 +- data/maps/Route114_LanettesHouse/scripts.inc | 4 +- .../Route116_TunnelersRestHouse/scripts.inc | 4 +- data/maps/Route117_PokemonDayCare/scripts.inc | 4 +- .../Route123_BerryMastersHouse/scripts.inc | 4 +- .../scripts.inc | 4 +- data/maps/ScorchedSlab/scripts.inc | 4 +- data/maps/SealedChamber_OuterRoom/scripts.inc | 4 +- data/maps/SkyPillar_Entrance/scripts.inc | 4 +- data/maps/SouthernIsland_Exterior/scripts.inc | 4 +- data/maps/TrainerHill_Entrance/scripts.inc | 4 +- data/maps/Underwater_SeafloorCavern/map.json | 8 +- .../Underwater_SeafloorCavern/scripts.inc | 10 +- data/scripts/berry_tree.inc | 172 +++++++++--------- include/bard_music.h | 2 +- src/data/bard_music/pokemon.h | 2 +- src/easy_chat.c | 2 +- src/item_use.c | 8 +- 36 files changed, 160 insertions(+), 160 deletions(-) diff --git a/data/maps/AbandonedShip_Deck/scripts.inc b/data/maps/AbandonedShip_Deck/scripts.inc index f256fe521..b0ecc2a4d 100644 --- a/data/maps/AbandonedShip_Deck/scripts.inc +++ b/data/maps/AbandonedShip_Deck/scripts.inc @@ -1,8 +1,8 @@ AbandonedShip_Deck_MapScripts:: @ 823799A - map_script MAP_SCRIPT_ON_TRANSITION, AbandonedShip_Deck_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, AbandonedShip_Deck_OnTransition .byte 0 -AbandonedShip_Deck_MapScript1_SetLandmark: @ 82379A0 +AbandonedShip_Deck_OnTransition: @ 82379A0 setflag FLAG_LANDMARK_ABANDONED_SHIP end diff --git a/data/maps/AlteringCave/scripts.inc b/data/maps/AlteringCave/scripts.inc index 19fd1fb0b..601f49217 100644 --- a/data/maps/AlteringCave/scripts.inc +++ b/data/maps/AlteringCave/scripts.inc @@ -1,8 +1,8 @@ AlteringCave_MapScripts:: @ 823B177 - map_script MAP_SCRIPT_ON_TRANSITION, AlteringCave_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, AlteringCave_OnTransition .byte 0 -AlteringCave_MapScript1_SetLandmark: @ 823B17D +AlteringCave_OnTransition: @ 823B17D setflag FLAG_LANDMARK_ALTERING_CAVE end diff --git a/data/maps/AncientTomb/scripts.inc b/data/maps/AncientTomb/scripts.inc index 8d1c029c3..ad8e683bb 100644 --- a/data/maps/AncientTomb/scripts.inc +++ b/data/maps/AncientTomb/scripts.inc @@ -1,7 +1,7 @@ AncientTomb_MapScripts:: @ 8238FB3 map_script MAP_SCRIPT_ON_RESUME, AncientTomb_MapScript1_238FC3 map_script MAP_SCRIPT_ON_LOAD, AncientTomb_MapScript1_238FF2 - map_script MAP_SCRIPT_ON_TRANSITION, AncientTomb_MapScript1_238FE1 + map_script MAP_SCRIPT_ON_TRANSITION, AncientTomb_OnTransition .byte 0 AncientTomb_MapScript1_238FC3: @ 8238FC3 @@ -15,7 +15,7 @@ AncientTomb_EventScript_238FCD:: @ 8238FCD removeobject VAR_LAST_TALKED return -AncientTomb_MapScript1_238FE1: @ 8238FE1 +AncientTomb_OnTransition: @ 8238FE1 setflag FLAG_LANDMARK_ANCIENT_TOMB call_if_unset FLAG_DEFEATED_REGISTEEL, AncientTomb_EventScript_238FEE end diff --git a/data/maps/ArtisanCave_B1F/scripts.inc b/data/maps/ArtisanCave_B1F/scripts.inc index a64fe4ab9..4dd850e88 100644 --- a/data/maps/ArtisanCave_B1F/scripts.inc +++ b/data/maps/ArtisanCave_B1F/scripts.inc @@ -1,8 +1,8 @@ ArtisanCave_B1F_MapScripts:: @ 823AFAD - map_script MAP_SCRIPT_ON_TRANSITION, ArtisanCave_B1F_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, ArtisanCave_B1F_OnTransition .byte 0 -ArtisanCave_B1F_MapScript1_SetLandmark: @ 823AFB3 +ArtisanCave_B1F_OnTransition: @ 823AFB3 setflag FLAG_LANDMARK_ARTISAN_CAVE end diff --git a/data/maps/BattleFrontier_ReceptionGate/scripts.inc b/data/maps/BattleFrontier_ReceptionGate/scripts.inc index 369c30aca..5f0952cb0 100644 --- a/data/maps/BattleFrontier_ReceptionGate/scripts.inc +++ b/data/maps/BattleFrontier_ReceptionGate/scripts.inc @@ -1,9 +1,9 @@ BattleFrontier_ReceptionGate_MapScripts:: @ 82661DA map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_ReceptionGate_MapScript2_2661E9 - map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_ReceptionGate_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_ReceptionGate_OnTransition .byte 0 -BattleFrontier_ReceptionGate_MapScript1_SetLandmark: @ 82661E5 +BattleFrontier_ReceptionGate_OnTransition: @ 82661E5 setflag FLAG_LANDMARK_BATTLE_FRONTIER end diff --git a/data/maps/DesertRuins/scripts.inc b/data/maps/DesertRuins/scripts.inc index 75fcf061c..e796b1668 100644 --- a/data/maps/DesertRuins/scripts.inc +++ b/data/maps/DesertRuins/scripts.inc @@ -1,7 +1,7 @@ DesertRuins_MapScripts:: @ 822D95B map_script MAP_SCRIPT_ON_RESUME, DesertRuins_MapScript1_22D96B map_script MAP_SCRIPT_ON_LOAD, DesertRuins_MapScript1_22D989 - map_script MAP_SCRIPT_ON_TRANSITION, DesertRuins_MapScript1_22D9CA + map_script MAP_SCRIPT_ON_TRANSITION, DesertRuins_OnTransition .byte 0 DesertRuins_MapScript1_22D96B: @ 822D96B @@ -28,7 +28,7 @@ DesertRuins_EventScript_22D993:: @ 822D993 setmetatile 9, 20, 565, 1 return -DesertRuins_MapScript1_22D9CA: @ 822D9CA +DesertRuins_OnTransition: @ 822D9CA setflag FLAG_LANDMARK_DESERT_RUINS call_if_unset FLAG_DEFEATED_REGIROCK, DesertRuins_EventScript_22D9D7 end diff --git a/data/maps/DesertUnderpass/scripts.inc b/data/maps/DesertUnderpass/scripts.inc index 1b8324d8a..8e89075e5 100644 --- a/data/maps/DesertUnderpass/scripts.inc +++ b/data/maps/DesertUnderpass/scripts.inc @@ -1,8 +1,8 @@ DesertUnderpass_MapScripts:: @ 823AF37 - map_script MAP_SCRIPT_ON_TRANSITION, DesertUnderpass_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, DesertUnderpass_OnTransition .byte 0 -DesertUnderpass_MapScript1_SetLandmark: @ 823AF3D +DesertUnderpass_OnTransition: @ 823AF3D setflag FLAG_LANDMARK_DESERT_UNDERPASS end diff --git a/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc b/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc index 95345af5c..959153d8a 100644 --- a/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc +++ b/data/maps/EverGrandeCity_PokemonLeague_1F/scripts.inc @@ -1,9 +1,9 @@ EverGrandeCity_PokemonLeague_1F_MapScripts:: @ 82295D2 - map_script MAP_SCRIPT_ON_TRANSITION, EverGrandeCity_PokemonLeague_1F_MapScript1_2295DD + map_script MAP_SCRIPT_ON_TRANSITION, EverGrandeCity_PokemonLeague_1F_OnTransition map_script MAP_SCRIPT_ON_RESUME, EverGrandeCity_PokemonLeague_1F_MapScript1_277C30 .byte 0 -EverGrandeCity_PokemonLeague_1F_MapScript1_2295DD: @ 82295DD +EverGrandeCity_PokemonLeague_1F_OnTransition: @ 82295DD setrespawn HEAL_LOCATION_EVER_GRANDE_CITY_2 setflag FLAG_LANDMARK_POKEMON_LEAGUE call_if_unset FLAG_ENTERED_ELITE_FOUR, EverGrandeCity_PokemonLeague_1F_EventScript_2295ED diff --git a/data/maps/FieryPath/scripts.inc b/data/maps/FieryPath/scripts.inc index ddba0dc0b..0aa5769a0 100644 --- a/data/maps/FieryPath/scripts.inc +++ b/data/maps/FieryPath/scripts.inc @@ -1,8 +1,8 @@ FieryPath_MapScripts:: @ 8230F24 - map_script MAP_SCRIPT_ON_TRANSITION, FieryPath_MapScript1_230F2A + map_script MAP_SCRIPT_ON_TRANSITION, FieryPath_OnTransition .byte 0 -FieryPath_MapScript1_230F2A: @ 8230F2A +FieryPath_OnTransition: @ 8230F2A call_if_unset FLAG_LANDMARK_FIERY_PATH, FieryPath_EventScript_230F37 setflag FLAG_LANDMARK_FIERY_PATH end diff --git a/data/maps/IslandCave/scripts.inc b/data/maps/IslandCave/scripts.inc index cb400e817..4f5339b1a 100644 --- a/data/maps/IslandCave/scripts.inc +++ b/data/maps/IslandCave/scripts.inc @@ -1,7 +1,7 @@ IslandCave_MapScripts:: @ 8238E2A map_script MAP_SCRIPT_ON_RESUME, IslandCave_MapScript1_238E3A map_script MAP_SCRIPT_ON_LOAD, IslandCave_MapScript1_238E58 - map_script MAP_SCRIPT_ON_TRANSITION, IslandCave_MapScript1_238E99 + map_script MAP_SCRIPT_ON_TRANSITION, IslandCave_OnTransition .byte 0 IslandCave_MapScript1_238E3A: @ 8238E3A @@ -28,7 +28,7 @@ IslandCave_EventScript_238E62:: @ 8238E62 setmetatile 9, 20, 565, 1 return -IslandCave_MapScript1_238E99: @ 8238E99 +IslandCave_OnTransition: @ 8238E99 setflag FLAG_LANDMARK_ISLAND_CAVE call IslandCave_EventScript_238F45 call_if_unset FLAG_DEFEATED_REGICE, IslandCave_EventScript_238EAB diff --git a/data/maps/MirageTower_1F/scripts.inc b/data/maps/MirageTower_1F/scripts.inc index 9f6c35a84..74ec749fa 100644 --- a/data/maps/MirageTower_1F/scripts.inc +++ b/data/maps/MirageTower_1F/scripts.inc @@ -1,8 +1,8 @@ MirageTower_1F_MapScripts:: @ 823AD01 - map_script MAP_SCRIPT_ON_TRANSITION, MirageTower_1F_MapScript1_23AD07 + map_script MAP_SCRIPT_ON_TRANSITION, MirageTower_1F_OnTransition .byte 0 -MirageTower_1F_MapScript1_23AD07: @ 823AD07 +MirageTower_1F_OnTransition: @ 823AD07 setflag FLAG_ENTERED_MIRAGE_TOWER setflag FLAG_FORCE_MIRAGE_TOWER_VISIBLE setflag FLAG_LANDMARK_MIRAGE_TOWER diff --git a/data/maps/NewMauville_Entrance/scripts.inc b/data/maps/NewMauville_Entrance/scripts.inc index 1df4c53e4..7adb2d7ce 100644 --- a/data/maps/NewMauville_Entrance/scripts.inc +++ b/data/maps/NewMauville_Entrance/scripts.inc @@ -1,6 +1,6 @@ NewMauville_Entrance_MapScripts:: @ 82372AD map_script MAP_SCRIPT_ON_LOAD, NewMauville_Entrance_MapScript1_2372B8 - map_script MAP_SCRIPT_ON_TRANSITION, NewMauville_Entrance_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, NewMauville_Entrance_OnTransition .byte 0 NewMauville_Entrance_MapScript1_2372B8: @ 82372B8 @@ -17,7 +17,7 @@ NewMauville_Entrance_EventScript_2372C4:: @ 82372C4 setmetatile 5, 1, 798, 1 return -NewMauville_Entrance_MapScript1_SetLandmark: @ 82372FB +NewMauville_Entrance_OnTransition: @ 82372FB setflag FLAG_LANDMARK_NEW_MAUVILLE end diff --git a/data/maps/Route104_MrBrineysHouse/scripts.inc b/data/maps/Route104_MrBrineysHouse/scripts.inc index 8a4af48cd..52fd4b96d 100644 --- a/data/maps/Route104_MrBrineysHouse/scripts.inc +++ b/data/maps/Route104_MrBrineysHouse/scripts.inc @@ -1,8 +1,8 @@ Route104_MrBrineysHouse_MapScripts:: @ 8229D2E - map_script MAP_SCRIPT_ON_TRANSITION, Route104_MrBrineysHouse_MapScript1_229D34 + map_script MAP_SCRIPT_ON_TRANSITION, Route104_MrBrineysHouse_OnTransition .byte 0 -Route104_MrBrineysHouse_MapScript1_229D34: @ 8229D34 +Route104_MrBrineysHouse_OnTransition: @ 8229D34 setflag FLAG_LANDMARK_MR_BRINEY_HOUSE compare VAR_BRINEY_HOUSE_STATE, 1 call_if_eq Route104_MrBrineysHouse_EventScript_229D50 diff --git a/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc b/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc index 26dfe7f8a..2a8a8b88e 100644 --- a/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc +++ b/data/maps/Route104_PrettyPetalFlowerShop/scripts.inc @@ -1,8 +1,8 @@ Route104_PrettyPetalFlowerShop_MapScripts:: @ 822A34C - map_script MAP_SCRIPT_ON_TRANSITION, Route104_PrettyPetalFlowerShop_MapScript1_22A352 + map_script MAP_SCRIPT_ON_TRANSITION, Route104_PrettyPetalFlowerShop_OnTransition .byte 0 -Route104_PrettyPetalFlowerShop_MapScript1_22A352: @ 822A352 +Route104_PrettyPetalFlowerShop_OnTransition: @ 822A352 setflag FLAG_LANDMARK_FLOWER_SHOP goto_if_unset FLAG_MET_PRETTY_PETAL_SHOP_OWNER, Route104_PrettyPetalFlowerShop_EventScript_22A36B goto_if_unset FLAG_BADGE03_GET, Route104_PrettyPetalFlowerShop_EventScript_22A36B diff --git a/data/maps/Route109_SeashoreHouse/scripts.inc b/data/maps/Route109_SeashoreHouse/scripts.inc index d33113136..e52ab08f9 100644 --- a/data/maps/Route109_SeashoreHouse/scripts.inc +++ b/data/maps/Route109_SeashoreHouse/scripts.inc @@ -1,8 +1,8 @@ Route109_SeashoreHouse_MapScripts:: @ 82693F4 - map_script MAP_SCRIPT_ON_TRANSITION, Route109_SeashoreHouse_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, Route109_SeashoreHouse_OnTransition .byte 0 -Route109_SeashoreHouse_MapScript1_SetLandmark: @ 82693FA +Route109_SeashoreHouse_OnTransition: @ 82693FA setflag FLAG_LANDMARK_SEASHORE_HOUSE end diff --git a/data/maps/Route110_TrickHouseEntrance/scripts.inc b/data/maps/Route110_TrickHouseEntrance/scripts.inc index e1439d8d4..46610937e 100644 --- a/data/maps/Route110_TrickHouseEntrance/scripts.inc +++ b/data/maps/Route110_TrickHouseEntrance/scripts.inc @@ -1,10 +1,10 @@ Route110_TrickHouseEntrance_MapScripts:: @ 8269A50 - map_script MAP_SCRIPT_ON_TRANSITION, Route110_TrickHouseEntrance_MapScript1_269A60 + map_script MAP_SCRIPT_ON_TRANSITION, Route110_TrickHouseEntrance_OnTransition map_script MAP_SCRIPT_ON_FRAME_TABLE, Route110_TrickHouseEntrance_MapScript2_269CEE map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, Route110_TrickHouseEntrance_MapScript2_269BD3 .byte 0 -Route110_TrickHouseEntrance_MapScript1_269A60: @ 8269A60 +Route110_TrickHouseEntrance_OnTransition: @ 8269A60 setflag FLAG_LANDMARK_TRICK_HOUSE compare VAR_TRICK_HOUSE_STATE, 1 goto_if_eq Route110_TrickHouseEntrance_EventScript_269AF3 diff --git a/data/maps/Route111_OldLadysRestStop/scripts.inc b/data/maps/Route111_OldLadysRestStop/scripts.inc index 9495c4539..017043eae 100644 --- a/data/maps/Route111_OldLadysRestStop/scripts.inc +++ b/data/maps/Route111_OldLadysRestStop/scripts.inc @@ -1,8 +1,8 @@ Route111_OldLadysRestStop_MapScripts:: @ 822A916 - map_script MAP_SCRIPT_ON_TRANSITION, Route111_OldLadysRestStop_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, Route111_OldLadysRestStop_OnTransition .byte 0 -Route111_OldLadysRestStop_MapScript1_SetLandmark: @ 822A91C +Route111_OldLadysRestStop_OnTransition: @ 822A91C setflag FLAG_LANDMARK_OLD_LADY_REST_SHOP end diff --git a/data/maps/Route113_GlassWorkshop/scripts.inc b/data/maps/Route113_GlassWorkshop/scripts.inc index 46134a3d5..b685389d9 100644 --- a/data/maps/Route113_GlassWorkshop/scripts.inc +++ b/data/maps/Route113_GlassWorkshop/scripts.inc @@ -1,8 +1,8 @@ Route113_GlassWorkshop_MapScripts:: @ 826ED03 - map_script MAP_SCRIPT_ON_TRANSITION, Route113_GlassWorkshop_MapScript1_26ED09 + map_script MAP_SCRIPT_ON_TRANSITION, Route113_GlassWorkshop_OnTransition .byte 0 -Route113_GlassWorkshop_MapScript1_26ED09: @ 826ED09 +Route113_GlassWorkshop_OnTransition: @ 826ED09 setflag FLAG_LANDMARK_GLASS_WORKSHOP compare VAR_GLASS_WORKSHOP_STATE, 1 call_if_eq Route113_GlassWorkshop_EventScript_26ED18 diff --git a/data/maps/Route114_FossilManiacsHouse/scripts.inc b/data/maps/Route114_FossilManiacsHouse/scripts.inc index d41bc0dee..83fade3e6 100644 --- a/data/maps/Route114_FossilManiacsHouse/scripts.inc +++ b/data/maps/Route114_FossilManiacsHouse/scripts.inc @@ -1,8 +1,8 @@ Route114_FossilManiacsHouse_MapScripts:: @ 822AD30 - map_script MAP_SCRIPT_ON_TRANSITION, Route114_FossilManiacsHouse_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, Route114_FossilManiacsHouse_OnTransition .byte 0 -Route114_FossilManiacsHouse_MapScript1_SetLandmark: @ 822AD36 +Route114_FossilManiacsHouse_OnTransition: @ 822AD36 setflag FLAG_LANDMARK_FOSSIL_MANIACS_HOUSE end diff --git a/data/maps/Route114_LanettesHouse/scripts.inc b/data/maps/Route114_LanettesHouse/scripts.inc index 5ea42a42a..e24f6ce65 100644 --- a/data/maps/Route114_LanettesHouse/scripts.inc +++ b/data/maps/Route114_LanettesHouse/scripts.inc @@ -1,8 +1,8 @@ Route114_LanettesHouse_MapScripts:: @ 822B2C8 - map_script MAP_SCRIPT_ON_TRANSITION, Route114_LanettesHouse_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, Route114_LanettesHouse_OnTransition .byte 0 -Route114_LanettesHouse_MapScript1_SetLandmark: @ 822B2CE +Route114_LanettesHouse_OnTransition: @ 822B2CE setflag FLAG_LANDMARK_LANETTES_HOUSE end diff --git a/data/maps/Route116_TunnelersRestHouse/scripts.inc b/data/maps/Route116_TunnelersRestHouse/scripts.inc index f9ebcc76a..e4e943e61 100644 --- a/data/maps/Route116_TunnelersRestHouse/scripts.inc +++ b/data/maps/Route116_TunnelersRestHouse/scripts.inc @@ -1,8 +1,8 @@ Route116_TunnelersRestHouse_MapScripts:: @ 822B850 - map_script MAP_SCRIPT_ON_TRANSITION, Route116_TunnelersRestHouse_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, Route116_TunnelersRestHouse_OnTransition .byte 0 -Route116_TunnelersRestHouse_MapScript1_SetLandmark: @ 822B856 +Route116_TunnelersRestHouse_OnTransition: @ 822B856 setflag FLAG_LANDMARK_TUNNELERS_REST_HOUSE end diff --git a/data/maps/Route117_PokemonDayCare/scripts.inc b/data/maps/Route117_PokemonDayCare/scripts.inc index b9ddfaa5a..898935b26 100644 --- a/data/maps/Route117_PokemonDayCare/scripts.inc +++ b/data/maps/Route117_PokemonDayCare/scripts.inc @@ -1,8 +1,8 @@ Route117_PokemonDayCare_MapScripts:: @ 822BBB1 - map_script MAP_SCRIPT_ON_TRANSITION, Route117_PokemonDayCare_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, Route117_PokemonDayCare_OnTransition .byte 0 -Route117_PokemonDayCare_MapScript1_SetLandmark: @ 822BBB7 +Route117_PokemonDayCare_OnTransition: @ 822BBB7 setflag FLAG_LANDMARK_POKEMON_DAYCARE end diff --git a/data/maps/Route123_BerryMastersHouse/scripts.inc b/data/maps/Route123_BerryMastersHouse/scripts.inc index 0f0326119..939cfed80 100644 --- a/data/maps/Route123_BerryMastersHouse/scripts.inc +++ b/data/maps/Route123_BerryMastersHouse/scripts.inc @@ -1,8 +1,8 @@ Route123_BerryMastersHouse_MapScripts:: @ 826F83B - map_script MAP_SCRIPT_ON_TRANSITION, Route123_BerryMastersHouse_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, Route123_BerryMastersHouse_OnTransition .byte 0 -Route123_BerryMastersHouse_MapScript1_SetLandmark: @ 826F841 +Route123_BerryMastersHouse_OnTransition: @ 826F841 setflag FLAG_LANDMARK_BERRY_MASTERS_HOUSE end diff --git a/data/maps/Route124_DivingTreasureHuntersHouse/scripts.inc b/data/maps/Route124_DivingTreasureHuntersHouse/scripts.inc index a1b7527a1..e1fb3d6f8 100644 --- a/data/maps/Route124_DivingTreasureHuntersHouse/scripts.inc +++ b/data/maps/Route124_DivingTreasureHuntersHouse/scripts.inc @@ -1,8 +1,8 @@ Route124_DivingTreasureHuntersHouse_MapScripts:: @ 8270A28 - map_script MAP_SCRIPT_ON_TRANSITION, Route124_DivingTreasureHuntersHouse_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, Route124_DivingTreasureHuntersHouse_OnTransition .byte 0 -Route124_DivingTreasureHuntersHouse_MapScript1_SetLandmark: @ 8270A2E +Route124_DivingTreasureHuntersHouse_OnTransition: @ 8270A2E setflag FLAG_LANDMARK_HUNTERS_HOUSE end diff --git a/data/maps/ScorchedSlab/scripts.inc b/data/maps/ScorchedSlab/scripts.inc index 3d6aa1cfe..34ad01330 100644 --- a/data/maps/ScorchedSlab/scripts.inc +++ b/data/maps/ScorchedSlab/scripts.inc @@ -1,8 +1,8 @@ ScorchedSlab_MapScripts:: @ 8239291 - map_script MAP_SCRIPT_ON_TRANSITION, ScorchedSlab_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, ScorchedSlab_OnTransition .byte 0 -ScorchedSlab_MapScript1_SetLandmark: @ 8239297 +ScorchedSlab_OnTransition: @ 8239297 setflag FLAG_LANDMARK_SCORCHED_SLAB end diff --git a/data/maps/SealedChamber_OuterRoom/scripts.inc b/data/maps/SealedChamber_OuterRoom/scripts.inc index f0337548e..30228fda0 100644 --- a/data/maps/SealedChamber_OuterRoom/scripts.inc +++ b/data/maps/SealedChamber_OuterRoom/scripts.inc @@ -1,6 +1,6 @@ SealedChamber_OuterRoom_MapScripts:: @ 8239106 map_script MAP_SCRIPT_ON_RESUME, SealedChamber_OuterRoom_MapScript1_239116 - map_script MAP_SCRIPT_ON_TRANSITION, SealedChamber_OuterRoom_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, SealedChamber_OuterRoom_OnTransition map_script MAP_SCRIPT_ON_LOAD, SealedChamber_OuterRoom_MapScript1_23912B .byte 0 @@ -9,7 +9,7 @@ SealedChamber_OuterRoom_MapScript1_239116: @ 8239116 setescapewarp MAP_UNDERWATER_SEALED_CHAMBER, 255, 12, 44 end -SealedChamber_OuterRoom_MapScript1_SetLandmark: @ 8239127 +SealedChamber_OuterRoom_OnTransition: @ 8239127 setflag FLAG_LANDMARK_SEALED_CHAMBER end diff --git a/data/maps/SkyPillar_Entrance/scripts.inc b/data/maps/SkyPillar_Entrance/scripts.inc index 7b5434eff..bc213d376 100644 --- a/data/maps/SkyPillar_Entrance/scripts.inc +++ b/data/maps/SkyPillar_Entrance/scripts.inc @@ -1,8 +1,8 @@ SkyPillar_Entrance_MapScripts:: @ 823929E - map_script MAP_SCRIPT_ON_TRANSITION, SkyPillar_Entrance_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, SkyPillar_Entrance_OnTransition .byte 0 -SkyPillar_Entrance_MapScript1_SetLandmark: @ 82392A4 +SkyPillar_Entrance_OnTransition: @ 82392A4 setflag FLAG_LANDMARK_SKY_PILLAR end diff --git a/data/maps/SouthernIsland_Exterior/scripts.inc b/data/maps/SouthernIsland_Exterior/scripts.inc index 84406d111..e3ecfa3db 100644 --- a/data/maps/SouthernIsland_Exterior/scripts.inc +++ b/data/maps/SouthernIsland_Exterior/scripts.inc @@ -1,8 +1,8 @@ SouthernIsland_Exterior_MapScripts:: @ 82429C8 - map_script MAP_SCRIPT_ON_TRANSITION, SouthernIsland_Exterior_MapScript1_SetLandmark + map_script MAP_SCRIPT_ON_TRANSITION, SouthernIsland_Exterior_OnTransition .byte 0 -SouthernIsland_Exterior_MapScript1_SetLandmark: @ 82429CE +SouthernIsland_Exterior_OnTransition: @ 82429CE setflag FLAG_LANDMARK_SOUTHERN_ISLAND end diff --git a/data/maps/TrainerHill_Entrance/scripts.inc b/data/maps/TrainerHill_Entrance/scripts.inc index 63e067a9a..60dc2149a 100644 --- a/data/maps/TrainerHill_Entrance/scripts.inc +++ b/data/maps/TrainerHill_Entrance/scripts.inc @@ -1,12 +1,12 @@ TrainerHill_Entrance_MapScripts:: @ 82680AC map_script MAP_SCRIPT_ON_RESUME, TrainerHill_Entrance_MapScript1_2680D0 map_script MAP_SCRIPT_ON_RETURN_TO_FIELD, TrainerHill_Entrance_MapScript1_26811B - map_script MAP_SCRIPT_ON_TRANSITION, TrainerHill_Entrance_MapScript1_2680C6 + map_script MAP_SCRIPT_ON_TRANSITION, TrainerHill_Entrance_OnTransition map_script MAP_SCRIPT_ON_LOAD, TrainerHill_Entrance_MapScript1_268128 map_script MAP_SCRIPT_ON_FRAME_TABLE, TrainerHill_Entrance_MapScript2_26813E .byte 0 -TrainerHill_Entrance_MapScript1_2680C6: @ 82680C6 +TrainerHill_Entrance_OnTransition: @ 82680C6 setflag FLAG_LANDMARK_TRAINER_HILL getplayerxy VAR_TEMP_D, VAR_RESULT end diff --git a/data/maps/Underwater_SeafloorCavern/map.json b/data/maps/Underwater_SeafloorCavern/map.json index 8e7d2c554..eedec4500 100644 --- a/data/maps/Underwater_SeafloorCavern/map.json +++ b/data/maps/Underwater_SeafloorCavern/map.json @@ -24,7 +24,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Underwater_SeafloorCavern_EventScript_2343DC", + "script": "Underwater_SeafloorCavern_EventScript_CheckStolenSub", "flag": "FLAG_HIDE_UNDERWATER_SEA_FLOOR_CAVERN_STOLEN_SUBMARINE" }, { @@ -37,7 +37,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Underwater_SeafloorCavern_EventScript_2343DC", + "script": "Underwater_SeafloorCavern_EventScript_CheckStolenSub", "flag": "FLAG_HIDE_UNDERWATER_SEA_FLOOR_CAVERN_STOLEN_SUBMARINE" }, { @@ -50,7 +50,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Underwater_SeafloorCavern_EventScript_2343DC", + "script": "Underwater_SeafloorCavern_EventScript_CheckStolenSub", "flag": "FLAG_HIDE_UNDERWATER_SEA_FLOOR_CAVERN_STOLEN_SUBMARINE" }, { @@ -63,7 +63,7 @@ "movement_range_y": 1, "trainer_type": "0", "trainer_sight_or_berry_tree_id": "0", - "script": "Underwater_SeafloorCavern_EventScript_2343DC", + "script": "Underwater_SeafloorCavern_EventScript_CheckStolenSub", "flag": "FLAG_HIDE_UNDERWATER_SEA_FLOOR_CAVERN_STOLEN_SUBMARINE" } ], diff --git a/data/maps/Underwater_SeafloorCavern/scripts.inc b/data/maps/Underwater_SeafloorCavern/scripts.inc index 9dc5b406a..3e7c1e22c 100644 --- a/data/maps/Underwater_SeafloorCavern/scripts.inc +++ b/data/maps/Underwater_SeafloorCavern/scripts.inc @@ -1,10 +1,10 @@ Underwater_SeafloorCavern_MapScripts:: @ 823433B map_script MAP_SCRIPT_ON_RESUME, Underwater_SeafloorCavern_MapScript1_2343D3 - map_script MAP_SCRIPT_ON_TRANSITION, Underwater_SeafloorCavern_MapScript1_23434B + map_script MAP_SCRIPT_ON_TRANSITION, Underwater_SeafloorCavern_OnTransition map_script MAP_SCRIPT_ON_LOAD, Underwater_SeafloorCavern_MapScript1_23435C .byte 0 -Underwater_SeafloorCavern_MapScript1_23434B: @ 823434B +Underwater_SeafloorCavern_OnTransition: @ 823434B setflag FLAG_LANDMARK_SEAFLOOR_CAVERN goto_if_set FLAG_KYOGRE_ESCAPED_SEAFLOOR_CAVERN, Underwater_SeafloorCavern_EventScript_234358 end @@ -36,11 +36,11 @@ Underwater_SeafloorCavern_MapScript1_2343D3: @ 82343D3 setdivewarp MAP_SEAFLOOR_CAVERN_ENTRANCE, 255, 10, 17 end -Underwater_SeafloorCavern_EventScript_2343DC:: @ 82343DC - msgbox Underwater_SeafloorCavern_Text_2343E5, MSGBOX_SIGN +Underwater_SeafloorCavern_EventScript_CheckStolenSub:: @ 82343DC + msgbox Underwater_SeafloorCavern_Text_SubExplorer1, MSGBOX_SIGN end -Underwater_SeafloorCavern_Text_2343E5: @ 82343E5 +Underwater_SeafloorCavern_Text_SubExplorer1: @ 82343E5 .string "“SUBMARINE EXPLORER 1” is painted\n" .string "on the hull.\p" .string "This is the submarine TEAM AQUA\n" diff --git a/data/scripts/berry_tree.inc b/data/scripts/berry_tree.inc index 027633a82..2dc016a52 100644 --- a/data/scripts/berry_tree.inc +++ b/data/scripts/berry_tree.inc @@ -1,261 +1,261 @@ BerryTreeScript:: @ 82742F9 special EventObjectInteractionGetBerryTreeData switch VAR_0x8004 - case 255, Route102_EventScript_27434F - case 0, Route102_EventScript_CheckSoil - case 1, Route102_EventScript_CheckBerryStage1 - case 2, Route102_EventScript_CheckBerryStage2 - case 3, Route102_EventScript_CheckBerryStage3 - case 4, Route102_EventScript_CheckBerryStage4 - case 5, Route102_EventScript_CheckBerryFullyGrown + case 255, BerryTree_EventScript_27434F + case 0, BerryTree_EventScript_CheckSoil + case 1, BerryTree_EventScript_CheckBerryStage1 + case 2, BerryTree_EventScript_CheckBerryStage2 + case 3, BerryTree_EventScript_CheckBerryStage3 + case 4, BerryTree_EventScript_CheckBerryStage4 + case 5, BerryTree_EventScript_CheckBerryFullyGrown end -Route102_EventScript_27434F:: @ 827434F +BerryTree_EventScript_27434F:: @ 827434F lockall - message Route102_Text_ExclamationPoint + message BerryTree_Text_ExclamationPoint waitmessage waitbuttonpress releaseall end -Route102_EventScript_CheckSoil:: @ 8274359 +BerryTree_EventScript_CheckSoil:: @ 8274359 lock faceplayer specialvar VAR_RESULT, PlayerHasBerries compare VAR_RESULT, 1 - goto_if_eq Route102_EventScript_WantToPlant - message Route102_Text_ItsSoftLoamySoil + goto_if_eq BerryTree_EventScript_WantToPlant + message BerryTree_Text_ItsSoftLoamySoil waitmessage waitbuttonpress release end -Route102_EventScript_WantToPlant:: @ 8274374 - msgbox Route102_Text_WantToPlant, MSGBOX_YESNO +BerryTree_EventScript_WantToPlant:: @ 8274374 + msgbox BerryTree_Text_WantToPlant, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route102_EventScript_ChooseBerryToPlant + goto_if_eq BerryTree_EventScript_ChooseBerryToPlant compare VAR_RESULT, 0 - goto_if_eq Route102_EventScript_CancelPlanting + goto_if_eq BerryTree_EventScript_CancelPlanting end -Route102_EventScript_ChooseBerryToPlant:: @ 8274393 +BerryTree_EventScript_ChooseBerryToPlant:: @ 8274393 fadescreen 1 closemessage special Bag_ChooseBerry waitstate compare VAR_ITEM_ID, 0 - goto_if_eq Route102_EventScript_CancelPlanting + goto_if_eq BerryTree_EventScript_CancelPlanting takeitem VAR_ITEM_ID, 1 - call Route102_EventScript_PlantBerry + call BerryTree_EventScript_PlantBerry -Route102_EventScript_CancelPlanting:: @ 82743AF +BerryTree_EventScript_CancelPlanting:: @ 82743AF release end -Route102_EventScript_CheckBerryStage1:: @ 82743B1 +BerryTree_EventScript_CheckBerryStage1:: @ 82743B1 lockall special EventObjectInteractionGetBerryCountString - message Route102_Text_BerryGrowthStage1 + message BerryTree_Text_BerryGrowthStage1 waitmessage waitbuttonpress - goto Route102_EventScript_WantToWater + goto BerryTree_EventScript_WantToWater -Route102_EventScript_CheckBerryStage2:: @ 82743C1 +BerryTree_EventScript_CheckBerryStage2:: @ 82743C1 lockall special EventObjectInteractionGetBerryName - message Route102_Text_BerryGrowthStage2 + message BerryTree_Text_BerryGrowthStage2 waitmessage waitbuttonpress - goto Route102_EventScript_WantToWater + goto BerryTree_EventScript_WantToWater -Route102_EventScript_CheckBerryStage3:: @ 82743D1 +BerryTree_EventScript_CheckBerryStage3:: @ 82743D1 lockall special EventObjectInteractionGetBerryName - message Route102_Text_BerryGrowthStage3 + message BerryTree_Text_BerryGrowthStage3 waitmessage waitbuttonpress - goto Route102_EventScript_WantToWater + goto BerryTree_EventScript_WantToWater -Route102_EventScript_CheckBerryStage4:: @ 82743E1 - call Route102_EventScript_GetCareAdverb +BerryTree_EventScript_CheckBerryStage4:: @ 82743E1 + call BerryTree_EventScript_GetCareAdverb lockall special EventObjectInteractionGetBerryName - message Route102_Text_BerryGrowthStage4 + message BerryTree_Text_BerryGrowthStage4 waitmessage waitbuttonpress - goto Route102_EventScript_WantToWater + goto BerryTree_EventScript_WantToWater -Route102_EventScript_GetCareAdverb:: @ 82743F6 +BerryTree_EventScript_GetCareAdverb:: @ 82743F6 compare VAR_0x8005, 0 - goto_if_eq Route102_EventScript_SetAdverbPoor + goto_if_eq BerryTree_EventScript_SetAdverbPoor compare VAR_0x8005, 4 - goto_if_eq Route102_EventScript_SetAdverbGreat - bufferstring 1, Route102_Text_CareAdverbGood + goto_if_eq BerryTree_EventScript_SetAdverbGreat + bufferstring 1, BerryTree_Text_CareAdverbGood return -Route102_EventScript_SetAdverbGreat:: @ 8274413 - bufferstring 1, Route102_Text_CareAdverbGreat +BerryTree_EventScript_SetAdverbGreat:: @ 8274413 + bufferstring 1, BerryTree_Text_CareAdverbGreat return -Route102_EventScript_SetAdverbPoor:: @ 827441A - bufferstring 1, Route102_Text_CareAdverbPoor +BerryTree_EventScript_SetAdverbPoor:: @ 827441A + bufferstring 1, BerryTree_Text_CareAdverbPoor return -Route102_EventScript_CheckBerryFullyGrown:: @ 8274421 +BerryTree_EventScript_CheckBerryFullyGrown:: @ 8274421 buffernumberstring 1, VAR_0x8006 lock faceplayer special EventObjectInteractionGetBerryCountString - msgbox Route102_Text_WantToPick, MSGBOX_YESNO + msgbox BerryTree_Text_WantToPick, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route102_EventScript_PickBerry + goto_if_eq BerryTree_EventScript_PickBerry compare VAR_RESULT, 0 - goto_if_eq Route102_EventScript_CancelPickingBerry + goto_if_eq BerryTree_EventScript_CancelPickingBerry -Route102_EventScript_PickBerry:: @ 8274448 +BerryTree_EventScript_PickBerry:: @ 8274448 special EventObjectInteractionPickBerryTree compare VAR_0x8004, 0 - goto_if_eq Route102_EventScript_BerryPocketFull + goto_if_eq BerryTree_EventScript_BerryPocketFull special sub_80EED34 special EventObjectInteractionRemoveBerryTree - message Route102_Text_PickedTheBerry + message BerryTree_Text_PickedTheBerry playfanfare MUS_ME_KINOMI waitmessage waitfanfare waitbuttonpress - message Route102_Text_PutAwayBerry + message BerryTree_Text_PutAwayBerry waitmessage waitbuttonpress release end -Route102_EventScript_BerryPocketFull:: @ 8274470 - message Route102_Text_BerryPocketFull +BerryTree_EventScript_BerryPocketFull:: @ 8274470 + message BerryTree_Text_BerryPocketFull waitmessage waitbuttonpress release end -Route102_EventScript_CancelPickingBerry:: @ 8274479 - message Route102_Text_BerryLeftUnpicked +BerryTree_EventScript_CancelPickingBerry:: @ 8274479 + message BerryTree_Text_BerryLeftUnpicked waitmessage waitbuttonpress release end -Route102_EventScript_274482:: @ 8274482 +BerryTree_EventScript_274482:: @ 8274482 lockall special EventObjectInteractionGetBerryTreeData - call Route102_EventScript_PlantBerry + call BerryTree_EventScript_PlantBerry releaseall end -Route102_EventScript_WantToWater:: @ 827448D +BerryTree_EventScript_WantToWater:: @ 827448D checkitem ITEM_WAILMER_PAIL, 1 compare VAR_RESULT, 0 - goto_if_eq Route102_EventScript_DontWater + goto_if_eq BerryTree_EventScript_DontWater special EventObjectInteractionGetBerryName - msgbox Route102_Text_WantToWater, MSGBOX_YESNO + msgbox BerryTree_Text_WantToWater, MSGBOX_YESNO compare VAR_RESULT, 1 - goto_if_eq Route102_EventScript_WaterBerry + goto_if_eq BerryTree_EventScript_WaterBerry compare VAR_RESULT, 0 - goto_if_eq Route102_EventScript_DontWater + goto_if_eq BerryTree_EventScript_DontWater -Route102_EventScript_DontWater:: @ 82744BE +BerryTree_EventScript_DontWater:: @ 82744BE releaseall end -Route102_EventScript_2744C0:: @ 82744C0 +BerryTree_EventScript_2744C0:: @ 82744C0 special EventObjectInteractionGetBerryTreeData lockall -Route102_EventScript_WaterBerry:: @ 82744C4 +BerryTree_EventScript_WaterBerry:: @ 82744C4 special EventObjectInteractionGetBerryName - message Route102_Text_WateredTheBerry + message BerryTree_Text_WateredTheBerry waitmessage special EventObjectInteractionWaterBerryTree special DoWateringBerryTreeAnim waitstate - message Route102_Text_PlantIsDelighted + message BerryTree_Text_PlantIsDelighted waitmessage waitbuttonpress releaseall end -Route102_EventScript_PlantBerry:: @ 82744DD +BerryTree_EventScript_PlantBerry:: @ 82744DD special EventObjectInteractionPlantBerryTree incrementgamestat 3 special sub_80EED10 special EventObjectInteractionGetBerryCountString - message Route102_Text_PlantedOneBerry + message BerryTree_Text_PlantedOneBerry waitmessage waitbuttonpress return -Route102_Text_ItsSoftLoamySoil: @ 82744F0 +BerryTree_Text_ItsSoftLoamySoil: @ 82744F0 .string "It's soft, loamy soil.$" -Route102_Text_WantToPlant: @ 8274507 +BerryTree_Text_WantToPlant: @ 8274507 .string "It's soft, loamy soil.\n" .string "Want to plant a BERRY?$" -Route102_Text_PlantedOneBerry: @ 8274535 +BerryTree_Text_PlantedOneBerry: @ 8274535 .string "{PLAYER} planted one {STR_VAR_1} in\n" .string "the soft, loamy soil.$" -Route102_Text_BerryGrowthStage1: @ 8274560 +BerryTree_Text_BerryGrowthStage1: @ 8274560 .string "One {STR_VAR_1} was planted here.$" -Route102_Text_BerryGrowthStage2: @ 8274579 +BerryTree_Text_BerryGrowthStage2: @ 8274579 .string "{STR_VAR_1} has sprouted.$" -Route102_Text_BerryGrowthStage3: @ 827458A +BerryTree_Text_BerryGrowthStage3: @ 827458A .string "This {STR_VAR_1} plant is growing taller.$" -Route102_Text_BerryGrowthStage4: @ 82745AB +BerryTree_Text_BerryGrowthStage4: @ 82745AB .string "These {STR_VAR_1} flowers are blooming\n" .string "{STR_VAR_2}.$" -Route102_Text_CareAdverbGreat: @ 82745CD +BerryTree_Text_CareAdverbGreat: @ 82745CD .string "very beautifully$" -Route102_Text_CareAdverbPoor: @ 82745DE +BerryTree_Text_CareAdverbPoor: @ 82745DE .string "cutely$" -Route102_Text_CareAdverbGood: @ 82745E5 +BerryTree_Text_CareAdverbGood: @ 82745E5 .string "prettily$" -Route102_Text_WantToPick: @ 82745EE +BerryTree_Text_WantToPick: @ 82745EE .string "You found {STR_VAR_2} {STR_VAR_1}!\p" .string "Do you want to pick the\n" .string "{STR_VAR_1}?$" -Route102_Text_PickedTheBerry: @ 827461B +BerryTree_Text_PickedTheBerry: @ 827461B .string "{PLAYER} picked the {STR_VAR_2} {STR_VAR_1}.$" -Route102_Text_PutAwayBerry: @ 8274630 +BerryTree_Text_PutAwayBerry: @ 8274630 .string "{PLAYER} put away the {STR_VAR_1}\n" .string "in the BAG's BERRIES POCKET.\p" .string "The soil returned to its soft and\n" .string "loamy state.$" -Route102_Text_BerryPocketFull: @ 827468F +BerryTree_Text_BerryPocketFull: @ 827468F .string "The BAG's BERRIES POCKET is full.\p" .string "The {STR_VAR_1} couldn't be taken.$" -Route102_Text_BerryLeftUnpicked: @ 82746CB +BerryTree_Text_BerryLeftUnpicked: @ 82746CB .string "{PLAYER} left the {STR_VAR_1}\n" .string "unpicked.$" -Route102_Text_WantToWater: @ 82746E4 +BerryTree_Text_WantToWater: @ 82746E4 .string "Want to water the {STR_VAR_1} with the\n" .string "WAILMER PAIL?$" -Route102_Text_WateredTheBerry: @ 8274710 +BerryTree_Text_WateredTheBerry: @ 8274710 .string "{PLAYER} watered the {STR_VAR_1}.$" -Route102_Text_PlantIsDelighted: @ 8274723 +BerryTree_Text_PlantIsDelighted: @ 8274723 .string "The plant seems to be delighted.$" -Route102_Text_ExclamationPoint: @ 8274744 +BerryTree_Text_ExclamationPoint: @ 8274744 .string "!$" diff --git a/include/bard_music.h b/include/bard_music.h index 488205405..882606b27 100644 --- a/include/bard_music.h +++ b/include/bard_music.h @@ -38,7 +38,7 @@ struct BardSong // Exported ROM declarations -extern const u16 gUnknown_085F5490; +extern const u16 gNumSpeciesNames; extern const u16 gUnknown_085FA1D4; const struct BardSound *GetWordSounds(u16 word); void GetWordPhonemes(struct BardSong *song, u16 word); diff --git a/src/data/bard_music/pokemon.h b/src/data/bard_music/pokemon.h index 693005360..112a5870b 100644 --- a/src/data/bard_music/pokemon.h +++ b/src/data/bard_music/pokemon.h @@ -2,7 +2,7 @@ #define GUARD_DATA_BARD_MUSIC_POKEMON_H #include "constants/species.h" -const u16 gUnknown_085F5490 = NUM_SPECIES; +const u16 gNumSpeciesNames = NUM_SPECIES; const struct BardSound gBardSounds_Pokemon[][6] = { { diff --git a/src/easy_chat.c b/src/easy_chat.c index 1cb7b0fe8..4388592f7 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -4882,7 +4882,7 @@ bool8 ECWord_CheckIfOutsideOfValidRange(u16 easyChatWord) { case EC_GROUP_POKEMON: case EC_GROUP_POKEMON_2: - numWordsInGroup = gUnknown_085F5490; + numWordsInGroup = gNumSpeciesNames; break; case EC_GROUP_MOVE_1: case EC_GROUP_MOVE_2: diff --git a/src/item_use.c b/src/item_use.c index 7947964ca..159ece398 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -42,8 +42,8 @@ #include "constants/vars.h" #include "event_obj_lock.h" -extern u8 Route102_EventScript_274482[]; -extern u8 Route102_EventScript_2744C0[]; +extern u8 BerryTree_EventScript_274482[]; +extern u8 BerryTree_EventScript_2744C0[]; extern u8 BattleFrontier_OutsideEast_EventScript_242CFC[]; void SetUpItemUseCallback(u8 taskId); @@ -669,7 +669,7 @@ void sub_80FDD74(u8 taskId) { RemoveBagItem(gSpecialVar_ItemId, 1); ScriptContext2_Enable(); - ScriptContext1_SetupScript(Route102_EventScript_274482); + ScriptContext1_SetupScript(BerryTree_EventScript_274482); DestroyTask(taskId); } @@ -694,7 +694,7 @@ void ItemUseOutOfBattle_WailmerPail(u8 taskId) void sub_80FDE08(u8 taskId) { ScriptContext2_Enable(); - ScriptContext1_SetupScript(Route102_EventScript_2744C0); + ScriptContext1_SetupScript(BerryTree_EventScript_2744C0); DestroyTask(taskId); } From 978781d6567b191c23ced48379a3a25cef4c8013 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 5 Apr 2019 13:38:13 +0200 Subject: [PATCH 092/101] Improve Tailwind animation --- data/battle_anim_scripts.s | 171 ++++++++++++++++--------------------- 1 file changed, 75 insertions(+), 96 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index af584a672..c19bf9cad 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -752,7 +752,7 @@ Move_MIRACLE_EYE: createvisualtask sub_8115A04, 2, 1, 1, 2, 0, 10, RGB_BLACK call MindReaderEffect waitforvisualfinish - call UnsetPsychicBackground + call UnsetPsychicBg clearmonbg ANIM_DEF_PARTNER end @@ -901,23 +901,36 @@ Move_PLUCK: Move_TAILWIND: loadspritegfx ANIM_TAG_FLYING_DIRT - playsewithpan SE_W201, 0 - createvisualtask AnimTask_LoadSandstormBackground, 5, FALSE - createvisualtask AnimTask_BlendBackground, 6, 6, RGB_WHITE - delay 16 + playsewithpan SE_W016, SOUND_PAN_ATTACKER + call SetHighSpeedBg + monbg ANIM_ATK_PARTNER + setalpha 12, 8 + createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 24, 6, 4, 4 + createvisualtask sub_81169C0, 2, 0, 4, 7, 10 + playsewithpan SE_W104, SOUND_PAN_ATTACKER createsprite gBattleAnimSpriteTemplate_8596BA0, ANIM_ATTACKER, 40, 10, 2304, 96, 0 - delay 10 + delay 12 + playsewithpan SE_W104, SOUND_PAN_ATTACKER createsprite gBattleAnimSpriteTemplate_8596BA0, ANIM_ATTACKER, 40, 90, 2048, 96, 0 - delay 10 + delay 12 + playsewithpan SE_W104, SOUND_PAN_ATTACKER createsprite gBattleAnimSpriteTemplate_8596BA0, ANIM_ATTACKER, 40, 50, 2560, 96, 0 - delay 10 + delay 12 + playsewithpan SE_W104, SOUND_PAN_ATTACKER createsprite gBattleAnimSpriteTemplate_8596BA0, ANIM_ATTACKER, 40, 20, 2304, 96, 0 - delay 10 + delay 12 + playsewithpan SE_W104, SOUND_PAN_ATTACKER createsprite gBattleAnimSpriteTemplate_8596BA0, ANIM_ATTACKER, 40, 70, 1984, 96, 0 - delay 10 + delay 12 createsprite gBattleAnimSpriteTemplate_8596BA0, ANIM_ATTACKER, 40, 0, 2816, 96, 0 delay 10 createsprite gBattleAnimSpriteTemplate_8596BA0, ANIM_ATTACKER, 40, 60, 2560, 96, 0 + waitforvisualfinish + stopsound + call UnsetHighSpeedBg + clearmonbg ANIM_ATK_PARTNER + blendoff + delay 1 end Move_ACUPRESSURE: @@ -968,8 +981,7 @@ Move_U_TURN: Move_CLOSE_COMBAT: loadspritegfx ANIM_TAG_IMPACT loadspritegfx ANIM_TAG_HANDS_AND_FEET - fadetobg BG_HIGHSPEED_OPPONENT - delay 20 + call SetHighSpeedBg createsprite gUnknown_08595EB0, ANIM_TARGET, 3, 1, 10, 0 createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 4, 0, 7, 1 playsewithpan SE_W004, +63 @@ -994,10 +1006,7 @@ Move_CLOSE_COMBAT: createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 4, 0, 7, 1 playsewithpan SE_W025B, +63 delay 10 - restorebg - waitbgfadeout - setarg 7, -1 - waitbgfadein + call UnsetHighSpeedBg clearmonbg ANIM_TARGET blendoff delay 1 @@ -1340,11 +1349,7 @@ Move_AURA_SPHERE: monbg ANIM_ATK_PARTNER monbgprio_28 ANIM_ATTACKER setalpha 12, 8 - createvisualtask AnimTask_GetAttackerSide, 2 - fadetobg BG_HIGHSPEED_OPPONENT - waitbgfadeout - createvisualtask sub_8117660, 5, -2304, 0, 1, -1 - waitbgfadein + call SetHighSpeedBg playsewithpan SE_W327, 0 delay 60 createsprite gAuraSphereBlast, ANIM_TARGET, 3, 0 @@ -1353,10 +1358,7 @@ Move_AURA_SPHERE: createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 8, 0, 16, 1 playsewithpan SE_W025B, SOUND_PAN_TARGET waitforvisualfinish - restorebg - waitbgfadeout - setarg 7, -1 - waitbgfadein + call UnsetHighSpeedBg clearmonbg ANIM_ATK_PARTNER blendoff delay 1 @@ -1628,24 +1630,17 @@ Move_FOCUS_BLAST: loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT loadspritegfx ANIM_TAG_METEOR loadspritegfx ANIM_TAG_FLAT_ROCK - monbg ANIM_ATK_PARTNER - monbgprio_28 ANIM_ATTACKER + monbg ANIM_TARGET + monbgprio_28 ANIM_TARGET setalpha 12, 8 - createvisualtask AnimTask_GetAttackerSide, 2 - fadetobg BG_HIGHSPEED_OPPONENT - waitbgfadeout - createvisualtask sub_8117660, 5, -2304, 0, 1, -1 - waitbgfadein + call SetHighSpeedBg createsprite gUnknown_08595FEC, ANIM_TARGET, 2, 0 playsewithpan SE_W025, SOUND_PAN_ATTACKER waitforvisualfinish createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 8, 0, 16, 1 playsewithpan SE_W025B, SOUND_PAN_TARGET waitforvisualfinish - restorebg - waitbgfadeout - setarg 7, -1 - waitbgfadein + call UnsetHighSpeedBg clearmonbg ANIM_TARGET blendoff delay 1 @@ -4970,7 +4965,7 @@ Move_MEDITATE: delay 16 playsewithpan SE_W036, SOUND_PAN_ATTACKER waitforvisualfinish - call UnsetPsychicBackground + call UnsetPsychicBg end Move_AGILITY: @@ -5037,7 +5032,7 @@ Move_TELEPORT: createvisualtask sub_810F83C, 2 playsewithpan SE_W100, SOUND_PAN_ATTACKER delay 15 - call UnsetPsychicBackground + call UnsetPsychicBg waitforvisualfinish end @@ -5130,7 +5125,7 @@ Move_AMNESIA: delay 54 loopsewithpan SE_W118, SOUND_PAN_ATTACKER, 16, 3 waitforvisualfinish - call UnsetPsychicBackground + call UnsetPsychicBg end Move_KINESIS: @@ -5149,7 +5144,7 @@ Move_KINESIS: delay 70 playsewithpan SE_W207B, SOUND_PAN_ATTACKER waitforvisualfinish - call UnsetPsychicBackground + call UnsetPsychicBg end Move_GLARE: @@ -5387,18 +5382,32 @@ Move_SPITE: waitbgfadein clearmonbg ANIM_TARGET end + +SetHighSpeedBg: + createvisualtask AnimTask_GetAttackerSide, 2 + jumprettrue SetHighSpeedBgPlayer + fadetobg BG_HIGHSPEED_OPPONENT + goto SetHighSpeedBgFade +SetHighSpeedBgPlayer: + fadetobg BG_HIGHSPEED_PLAYER +SetHighSpeedBgFade: + waitbgfadeout + createvisualtask sub_8117660, 5, -2304, 0, 1, -1 + waitbgfadein + return + +UnsetHighSpeedBg: + restorebg + waitbgfadeout + setarg 7, -1 + waitbgfadein + return Move_MACH_PUNCH: loadspritegfx ANIM_TAG_IMPACT loadspritegfx ANIM_TAG_HANDS_AND_FEET monbg ANIM_ATK_PARTNER - createvisualtask AnimTask_GetAttackerSide, 2 - jumprettrue MachPunchAgainstPlayer - fadetobg BG_HIGHSPEED_OPPONENT -MachPunchContinue: - waitbgfadeout - createvisualtask sub_8117660, 5, -2304, 0, 1, -1 - waitbgfadein + call SetHighSpeedBg delay 0 setalpha 9, 8 createvisualtask sub_80A8BC4, 2, 28968, 10 @@ -5411,14 +5420,8 @@ MachPunchContinue: waitforvisualfinish clearmonbg ANIM_ATK_PARTNER blendoff - restorebg - waitbgfadeout - setarg 7, -1 - waitbgfadein + call UnsetHighSpeedBg end -MachPunchAgainstPlayer: - fadetobg BG_HIGHSPEED_PLAYER - goto MachPunchContinue Move_FORESIGHT: loadspritegfx ANIM_TAG_MAGNIFYING_GLASS @@ -5652,13 +5655,7 @@ Move_MOONLIGHT: Move_EXTREME_SPEED: loadspritegfx ANIM_TAG_SPEED_DUST loadspritegfx ANIM_TAG_IMPACT - createvisualtask AnimTask_GetAttackerSide, 2 - jumprettrue ExtremeSpeedAgainstPlayer - fadetobg BG_HIGHSPEED_OPPONENT -ExtremeSpeedContinue: - waitbgfadeout - createvisualtask sub_8117660, 5, -2304, 0, 1, -1 - waitbgfadein + call SetHighSpeedBg createvisualtask sub_810577C, 2 loopsewithpan SE_W013B, SOUND_PAN_ATTACKER, 8, 3 waitforvisualfinish @@ -5683,19 +5680,13 @@ ExtremeSpeedContinue: createvisualtask sub_810599C, 2 loopsewithpan SE_W104, SOUND_PAN_ATTACKER, 8, 4 waitforvisualfinish - restorebg - waitbgfadeout - setarg 7, -1 - waitbgfadein + call UnsetHighSpeedBg clearmonbg ANIM_TARGET blendoff delay 1 setarg 7, 0x1000 delay 1 end -ExtremeSpeedAgainstPlayer: - fadetobg BG_HIGHSPEED_PLAYER - goto ExtremeSpeedContinue Move_UPROAR: loadspritegfx ANIM_TAG_JAGGED_MUSIC_NOTE @@ -6096,7 +6087,7 @@ Move_SKILL_SWAP: createvisualtask sub_810FBF0, 3, 0 createvisualtask AnimTask_BlendMonInAndOut, 5, ANIM_ATTACKER, RGB_WHITE, 12, 3, 1 waitforvisualfinish - call UnsetPsychicBackground + call UnsetPsychicBg end Move_IMPRISON: @@ -6113,7 +6104,7 @@ Move_IMPRISON: createvisualtask sub_81152DC, 5, 4, 1, 10 playsewithpan SE_W063, SOUND_PAN_ATTACKER clearmonbg ANIM_DEF_PARTNER - call UnsetPsychicBackground + call UnsetPsychicBg end Move_GRUDGE: @@ -6208,7 +6199,7 @@ Move_LUSTER_PURGE: waitforvisualfinish clearmonbg ANIM_ATTACKER blendoff - call UnsetPsychicBackground + call UnsetPsychicBg end Move_MIST_BALL: @@ -6603,7 +6594,7 @@ Move_EXTRASENSORY: waitforvisualfinish blendoff clearmonbg ANIM_DEF_PARTNER - call UnsetPsychicBackground + call UnsetPsychicBg end Move_AERIAL_ACE: @@ -6986,7 +6977,7 @@ Move_CONFUSION: clearmonbg ANIM_DEF_PARTNER blendoff delay 1 - call UnsetPsychicBackground + call UnsetPsychicBg end Move_PSYCHIC: @@ -7003,7 +6994,7 @@ Move_PSYCHIC: clearmonbg ANIM_DEF_PARTNER blendoff delay 1 - call UnsetPsychicBackground + call UnsetPsychicBg end Move_FUTURE_SIGHT: @@ -7011,7 +7002,7 @@ Move_FUTURE_SIGHT: FutureSightContinue: waitforvisualfinish delay 1 - call UnsetPsychicBackground + call UnsetPsychicBg end FutureSight: monbg ANIM_ATK_PARTNER @@ -7785,13 +7776,7 @@ SolarBeamUnleash1: Move_BLIZZARD: loadspritegfx ANIM_TAG_ICE_CRYSTALS monbg ANIM_DEF_PARTNER - createvisualtask AnimTask_GetAttackerSide, 2 - jumprettrue BlizzardAgainstPlayer - fadetobg BG_HIGHSPEED_OPPONENT -BlizzardContinue: - waitbgfadeout - createvisualtask sub_8117660, 5, -2304, 0, 1, -1 - waitbgfadein + call SetHighSpeedBg waitforvisualfinish panse_1B SE_W059, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, +2, 0 call Blizzard1 @@ -7801,10 +7786,7 @@ BlizzardContinue: call FreezeEffect2 waitforvisualfinish delay 20 - restorebg - waitbgfadeout - setarg 7, -1 - waitbgfadein + call UnsetHighSpeedBg clearmonbg ANIM_DEF_PARTNER end Blizzard1: @@ -7830,9 +7812,6 @@ Blizzard1: createsprite gUnknown_08595BB0, ANIM_ATTACKER, 40, 0, 20, 0, 20, 80, 0, 0, 1 delay 3 return -BlizzardAgainstPlayer: - fadetobg BG_HIGHSPEED_PLAYER - goto BlizzardContinue Move_POWDER_SNOW: loadspritegfx ANIM_TAG_ICE_CRYSTALS @@ -9288,7 +9267,7 @@ Move_DREAM_EATER: clearmonbg ANIM_DEF_PARTNER blendoff delay 1 - call UnsetPsychicBackground + call UnsetPsychicBg end DreamEaterEffect: playsewithpan SE_W207, SOUND_PAN_TARGET @@ -9406,7 +9385,7 @@ Move_PSYBEAM: call Psybeam1 waitforvisualfinish delay 1 - call UnsetPsychicBackground + call UnsetPsychicBg end Psybeam1: createsprite gUnknown_0859663C, ANIM_TARGET, 2, 16, 0, 0, 0, 13, 0 @@ -9422,7 +9401,7 @@ Move_HYPNOSIS: createvisualtask sub_8115A04, 2, 4, 2, 2, 0, 12, RGB(31, 18, 31) waitforvisualfinish delay 1 - call UnsetPsychicBackground + call UnsetPsychicBg end Hypnosis1: playsewithpan SE_W048, SOUND_PAN_ATTACKER @@ -9446,7 +9425,7 @@ Move_PSYWAVE: call Psywave1 waitforvisualfinish delay 1 - call UnsetPsychicBackground + call UnsetPsychicBg end Psywave1: createsprite gUnknown_08595170, ANIM_TARGET, 3, 10, 10, 0, 16 @@ -11809,7 +11788,7 @@ Move_PSYCHO_BOOST: waitforvisualfinish clearmonbg ANIM_ATK_PARTNER blendoff - call UnsetPsychicBackground + call UnsetPsychicBg end Move_KNOCK_OFF: @@ -12425,7 +12404,7 @@ SetPsychicBackground: waitbgfadein return -UnsetPsychicBackground: +UnsetPsychicBg: restorebg waitbgfadeout setarg 7, -1 @@ -12850,7 +12829,7 @@ General_FutureSightHit: blendoff waitforvisualfinish delay 1 - call UnsetPsychicBackground + call UnsetPsychicBg end General_DoomDesireHit: From c9cabe8d59dd1d1200f0e6531342625ee911da22 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 5 Apr 2019 14:04:38 +0200 Subject: [PATCH 093/101] Bug Buzz animation --- data/battle_anim_scripts.s | 72 +++++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 20 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index c19bf9cad..79fea6d6c 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -1591,6 +1591,30 @@ Move_XSCISSOR: end Move_BUG_BUZZ: + loadspritegfx ANIM_TAG_JAGGED_MUSIC_NOTE + loadspritegfx ANIM_TAG_THIN_RING + monbg ANIM_DEF_PARTNER + call SetBugBg + createvisualtask sub_8106D90, 2, 0 + createsprite gBattleAnimSpriteTemplate_8593898, ANIM_ATTACKER, 3, 0, 0, 0, 0, 31, 8 + playsewithpan SE_W253, SOUND_PAN_ATTACKER + createsprite gBattleAnimSpriteTemplate_8593BB8, ANIM_ATTACKER, 2, 0, 29, -12, 0 + createsprite gBattleAnimSpriteTemplate_8593BB8, ANIM_ATTACKER, 2, 0, -12, -29, 1 + delay 16 + createvisualtask sub_8106D90, 2, 0 + createsprite gBattleAnimSpriteTemplate_8593898, ANIM_ATTACKER, 3, 0, 0, 0, 0, 31, 8 + playsewithpan SE_W253, SOUND_PAN_ATTACKER + createsprite gBattleAnimSpriteTemplate_8593BB8, ANIM_ATTACKER, 2, 0, 12, -29, 1 + createsprite gBattleAnimSpriteTemplate_8593BB8, ANIM_ATTACKER, 2, 0, -29, -12, 0 + delay 16 + createvisualtask sub_8106D90, 2, 0 + createsprite gBattleAnimSpriteTemplate_8593898, ANIM_ATTACKER, 3, 0, 0, 0, 0, 31, 8 + playsewithpan SE_W253, SOUND_PAN_ATTACKER + createsprite gBattleAnimSpriteTemplate_8593BB8, ANIM_ATTACKER, 2, 0, 24, -24, 1 + createsprite gBattleAnimSpriteTemplate_8593BB8, ANIM_ATTACKER, 2, 0, -24, -24, 0 + waitforvisualfinish + clearmonbg ANIM_DEF_PARTNER + call UnsetBugBg end Move_DRAGON_PULSE: @@ -11394,6 +11418,32 @@ Move_ROCK_TOMB: createvisualtask sub_81162A4, 2, 2, 0, 10, 1 waitforvisualfinish end + +SetBugBg: + createvisualtask sub_8116664, 10, 1, 0, 0, 4, RGB_BLACK + createvisualtask AnimTask_GetAttackerSide, 2 + jumprettrue SetBugBgPlayer + fadetobg BG_BUG_OPPONENT + waitbgfadeout + createvisualtask sub_8117660, 5, 1536, 0, 0, -1 + goto SetBugBgFade +SetBugBgPlayer: + fadetobg BG_BUG_PLAYER + waitbgfadeout + createvisualtask sub_8117660, 5, -1536, 0, 0, -1 +SetBugBgFade: + delay 0 + createvisualtask sub_8116620, 10, 1, 0, 4, 4, RGB_BLACK + waitbgfadein + return + +UnsetBugBg: + restorebg + waitbgfadeout + createvisualtask sub_8116664, 10, 1, 0, 4, 0, RGB_BLACK + setarg 7, -1 + waitbgfadein + return Move_SILVER_WIND: loadspritegfx ANIM_TAG_SPARKLE_6 @@ -11403,16 +11453,7 @@ Move_SILVER_WIND: monbg ANIM_DEF_PARTNER monbgprio_29 delay 0 - createvisualtask sub_8116664, 10, 1, 0, 0, 4, RGB_BLACK - createvisualtask AnimTask_GetTargetSide, 2 - jumprettrue SilverWindOnPlayer - fadetobg BG_BUG_OPPONENT - waitbgfadeout - createvisualtask sub_8117660, 5, 1536, 0, 0, -1 -SilverWindContinue: - delay 0 - createvisualtask sub_8116620, 10, 1, 0, 4, 4, RGB_BLACK - waitbgfadein + call SetBugBg createsprite gUnknown_08592830, ANIM_TARGET, 66, -32, 16, 0, 6, 2, 3, 1 createsprite gUnknown_08592830, ANIM_TARGET, 66, -8, 18, 64, 3, 2, 2, 1 createsprite gUnknown_08592830, ANIM_ATTACKER, 120, -24, 18, 90, 5, 1, 2, 1 @@ -11440,17 +11481,8 @@ SilverWindContinue: playsewithpan SE_W016B, SOUND_PAN_TARGET clearmonbg ANIM_DEF_PARTNER delay 0 - restorebg - waitbgfadeout - createvisualtask sub_8116664, 10, 1, 0, 4, 0, RGB_BLACK - setarg 7, -1 - waitbgfadein + call UnsetBugBg end -SilverWindOnPlayer: - fadetobg BG_BUG_PLAYER - waitbgfadeout - createvisualtask sub_8117660, 5, -1536, 0, 0, -1 - goto SilverWindContinue Move_SNATCH: playsewithpan SE_W036, SOUND_PAN_ATTACKER From 05487c88202530f681b99f097a82c5976480465c Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Fri, 5 Apr 2019 14:21:33 +0200 Subject: [PATCH 094/101] animation for power whip, it sucks i know --- data/battle_anim_scripts.s | 48 ++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 79fea6d6c..d363ac1df 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -2028,6 +2028,17 @@ Move_LEAF_STORM: end Move_POWER_WHIP: + loadspritegfx ANIM_TAG_WHIP_HIT + playsewithpan SE_W026, SOUND_PAN_ATTACKER + createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 4, 10 + delay 6 + playsewithpan SE_W010, SOUND_PAN_TARGET + createsprite gVineWhipSpriteTemplate, ANIM_TARGET, 2, 0, 0 + delay 6 + call SetImpactBackground + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 8, 1 + restorebg + waitbgfadein end Move_ROCK_WRECKER: @@ -3221,6 +3232,25 @@ Ember1: delay 4 return +SetImpactBackground: + delay 2 + createvisualtask AnimTask_IsContest, 2 + jumprettrue SetImpactContestsBG + createvisualtask AnimTask_IsTargetPlayerSide, 2 + jumpretfalse SetImpactOpponentBG + jumprettrue SetImpactPlayerBG +SetImpactBackgroundRet: + return +SetImpactOpponentBG: + changebg BG_IMPACT_OPPONENT + goto SetImpactBackgroundRet +SetImpactPlayerBG: + changebg BG_IMPACT_PLAYER + goto SetImpactBackgroundRet +SetImpactContestsBG: + changebg BG_IMPACT_CONTESTS + goto SetImpactBackgroundRet + Move_MEGA_PUNCH: loadspritegfx ANIM_TAG_IMPACT loadspritegfx ANIM_TAG_HANDS_AND_FEET @@ -3245,24 +3275,6 @@ Move_MEGA_PUNCH: restorebg waitbgfadein end -SetImpactBackground: - delay 2 - createvisualtask AnimTask_IsContest, 2 - jumprettrue SetImpactContestsBG - createvisualtask AnimTask_IsTargetPlayerSide, 2 - jumpretfalse SetImpactOpponentBG - jumprettrue SetImpactPlayerBG -SetImpactBackgroundRet: - return -SetImpactOpponentBG: - changebg BG_IMPACT_OPPONENT - goto SetImpactBackgroundRet -SetImpactPlayerBG: - changebg BG_IMPACT_PLAYER - goto SetImpactBackgroundRet -SetImpactContestsBG: - changebg BG_IMPACT_CONTESTS - goto SetImpactBackgroundRet Move_MEGA_KICK: loadspritegfx ANIM_TAG_IMPACT From 7bc3cdf527ae2982bfcd99819595e0d753c5cd74 Mon Sep 17 00:00:00 2001 From: Fontbane Date: Fri, 5 Apr 2019 10:16:41 -0400 Subject: [PATCH 095/101] Delete level variable --- src/battle_script_commands.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 4563e587b..9b1a3617f 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10503,7 +10503,6 @@ static void atkE5_pickup(void) s32 i; u16 species, heldItem; u8 ability; - u8 level; u8 lvlDivBy10; if (InBattlePike()) @@ -10539,8 +10538,7 @@ static void atkE5_pickup(void) { species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2); heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM); - level = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL); - lvlDivBy10 = (level - 1) / 10; //Moving this here makes it easier to add in abilities like Honey Gather + lvlDivBy10 = (GetMonData(&gPlayerParty[i], MON_DATA_LEVEL)-1) / 10; //Moving this here makes it easier to add in abilities like Honey Gather if (lvlDivBy10 > 9) lvlDivBy10 = 9; From e8dd8f93d13986c0d77eb57438186eebabaad90a Mon Sep 17 00:00:00 2001 From: Fontbane Date: Fri, 5 Apr 2019 10:33:19 -0400 Subject: [PATCH 096/101] Remove Honey functionality --- data/battle_ai_scripts.s | 1 - include/item_use.h | 1 - src/data/items.h | 2 +- src/item_use.c | 9 --------- 4 files changed, 1 insertion(+), 12 deletions(-) diff --git a/data/battle_ai_scripts.s b/data/battle_ai_scripts.s index 101889405..1f072b734 100644 --- a/data/battle_ai_scripts.s +++ b/data/battle_ai_scripts.s @@ -3628,7 +3628,6 @@ AI_HPAware_DiscouragedEffectsWhenTargetLowHP: @ 82DE2B1 .byte EFFECT_LIGHT_SCREEN .byte EFFECT_OHKO .byte EFFECT_SUPER_FANG - .byte EFFECT_SUPER_FANG //Why is this here twice? .byte EFFECT_MIST .byte EFFECT_FOCUS_ENERGY .byte EFFECT_CONFUSE diff --git a/include/item_use.h b/include/item_use.h index 31221aa09..37343f6e7 100644 --- a/include/item_use.h +++ b/include/item_use.h @@ -51,6 +51,5 @@ void ItemUseInBattle_EnigmaBerry(u8); void ItemUseOutOfBattle_CannotUse(u8); u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId); void sub_80FDD10(u8); -void ItemUseOutOfBattle_Honey(u8); #endif // GUARD_ITEM_USE_H diff --git a/src/data/items.h b/src/data/items.h index ee47c7f89..9ee44dcdc 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -9148,7 +9148,7 @@ const struct Item gItems[] = .unk19 = 0, .pocket = POCKET_ITEMS, .type = 4, - .fieldUseFunc = ItemUseOutOfBattle_Honey, + .fieldUseFunc = ItemUseOutOfBattle_CannotUse, .battleUsage = 0, .battleUseFunc = NULL, .secondaryId = 0, diff --git a/src/item_use.c b/src/item_use.c index a20aecc64..5cfd9b435 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -1120,12 +1120,3 @@ void ItemUseOutOfBattle_CannotUse(u8 taskId) DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].data[3]); } -void ItemUseOutOfBattle_Honey(u8 taskId) -{ - //As a placeholder, just acts like White Flute - FlagSet(FLAG_SYS_ENC_UP_ITEM); - FlagClear(FLAG_SYS_ENC_DOWN_ITEM); - StringExpandPlaceholders(gStringVar4, gText_UsedVar2WildLured); - gTasks[taskId].data[8] = 0; - gTasks[taskId].func = sub_80FE1D0; -} From 9ee2e1c99acd910c60096723c4a3b9b5be3934fe Mon Sep 17 00:00:00 2001 From: Fontbane Date: Fri, 5 Apr 2019 12:03:09 -0400 Subject: [PATCH 097/101] Fix honey tab --- src/data/items.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/items.h b/src/data/items.h index 9ee44dcdc..5738f7fba 100644 --- a/src/data/items.h +++ b/src/data/items.h @@ -9136,7 +9136,7 @@ const struct Item gItems[] = .battleUseFunc = NULL, .secondaryId = 0, }, - [ITEM_HONEY] = + [ITEM_HONEY] = { .name = _("Honey"), .itemId = ITEM_HONEY, From 4c8bc9d526ed14a3f122463c4e43d3d9f13a8672 Mon Sep 17 00:00:00 2001 From: Papa Cancer Date: Wed, 3 Apr 2019 20:33:37 +0100 Subject: [PATCH 098/101] Three pointless moves MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Celebrate, Hold Hands and Happy Hour. Yay(!) Update: turns out Pay Day works differently to how I thought, so I added a new move effect for Happy Hour doubling prize money. Made all three effects subset of EFFECT_SPLASH, now called EFFECT_DUMB, as per Egg's instructions ( ͡° ͜ʖ ͡°) --- data/battle_scripts_1.s | 23 ++++++++++++++++++++--- include/constants/battle.h | 1 + include/constants/battle_move_effects.h | 2 +- include/constants/battle_string_ids.h | 1 + src/battle_message.c | 2 ++ src/battle_script_commands.c | 12 ++++++++++++ src/battle_util.c | 2 +- src/data/battle_moves.h | 10 +++++----- 8 files changed, 43 insertions(+), 10 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 764ff256c..3da8995d4 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -100,7 +100,7 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectMimic .4byte BattleScript_EffectMetronome .4byte BattleScript_EffectLeechSeed - .4byte BattleScript_EffectSplash + .4byte BattleScript_EffectDoNothing .4byte BattleScript_EffectDisable .4byte BattleScript_EffectLevelDamage .4byte BattleScript_EffectPsywave @@ -345,7 +345,7 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectPartingShot .4byte BattleScript_EffectSpectralThief .4byte BattleScript_EffectVCreate - + BattleScript_EffectVCreate: setmoveeffect MOVE_EFFECT_V_CREATE | MOVE_EFFECT_AFFECTS_USER goto BattleScript_EffectHit @@ -2835,16 +2835,33 @@ BattleScript_DoLeechSeed:: waitmessage 0x40 goto BattleScript_MoveEnd -BattleScript_EffectSplash:: +BattleScript_EffectDoNothing:: attackcanceler attackstring ppreduce + jumpifmove MOVE_HOLD_HANDS, BattleScript_EffectHoldHands attackanimation waitanimation + jumpifmove MOVE_CELEBRATE, BattleScript_EffectCelebrate + jumpifmove MOVE_HAPPY_HOUR, BattleScript_EffectHappyHour incrementgamestat GAME_STAT_USED_SPLASH printstring STRINGID_BUTNOTHINGHAPPENED waitmessage 0x40 goto BattleScript_MoveEnd +BattleScript_EffectHoldHands: + jumpifsideaffecting BS_TARGET, SIDE_STATUS_CRAFTY_SHIELD, BattleScript_ButItFailed + jumpifnotbattletype BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_DOUBLE, BattleScript_ButItFailed + attackanimation + waitanimation + goto BattleScript_MoveEnd +BattleScript_EffectCelebrate: + printstring STRINGID_CELEBRATEMESSAGE + waitmessage 0x40 + goto BattleScript_MoveEnd +BattleScript_EffectHappyHour: + setmoveeffect MOVE_EFFECT_HAPPY_HOUR + seteffectprimary + goto BattleScript_MoveEnd BattleScript_EffectDisable:: attackcanceler diff --git a/include/constants/battle.h b/include/constants/battle.h index c42188596..3b513ba06 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -326,6 +326,7 @@ #define MOVE_EFFECT_FEINT 0x3E #define MOVE_EFFECT_SPECTRAL_THIEF 0x3F #define MOVE_EFFECT_V_CREATE 0x40 +#define MOVE_EFFECT_HAPPY_HOUR 0x41 #define MOVE_EFFECT_AFFECTS_USER 0x4000 #define MOVE_EFFECT_CERTAIN 0x8000 diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index bd52d065e..62b2a7ff8 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -86,7 +86,7 @@ #define EFFECT_MIMIC 82 #define EFFECT_METRONOME 83 #define EFFECT_LEECH_SEED 84 -#define EFFECT_SPLASH 85 +#define EFFECT_DO_NOTHING 85 #define EFFECT_DISABLE 86 #define EFFECT_LEVEL_DAMAGE 87 #define EFFECT_PSYWAVE 88 diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 684f2b111..5114102f7 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -527,6 +527,7 @@ #define STRINGID_FLOWERVEILPROTECTED 523 #define STRINGID_SWEETVEILPROTECTED 524 #define STRINGID_AROMAVEILPROTECTED 525 +#define STRINGID_CELEBRATEMESSAGE 526 #define BATTLESTRINGS_COUNT 529 diff --git a/src/battle_message.c b/src/battle_message.c index a344eebff..77a2829aa 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -653,9 +653,11 @@ static const u8 sText_SafetyGooglesProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is static const u8 sText_FlowerVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} surrounded itself\nwith a veil of petals!"); static const u8 sText_SweetVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} surrounded itself\nwith a veil of sweetness!"); static const u8 sText_AromaVeilProtected[] = _("{B_DEF_NAME_WITH_PREFIX} is protected\nby an aromatic veil!"); +static const u8 sText_CelebrateMessage[] = _("Congratulations, {B_PLAYER_NAME}!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_CELEBRATEMESSAGE - 12] = sText_CelebrateMessage, [STRINGID_AROMAVEILPROTECTED - 12] = sText_AromaVeilProtected, [STRINGID_SWEETVEILPROTECTED - 12] = sText_SweetVeilProtected, [STRINGID_FLOWERVEILPROTECTED - 12] = sText_FlowerVeilProtected, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 6595bb805..3e71638fc 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2006,6 +2006,11 @@ void SetMoveEffect(bool32 primary, u32 certain) affectsUser = MOVE_EFFECT_AFFECTS_USER; gBattleScripting.battler = gBattlerTarget; // theoretically the attacker } + + // Just in case this flag is still set + if (gBattleScripting.moveEffect & MOVE_EFFECT_CERTAIN) + gBattleScripting.moveEffect &= ~(MOVE_EFFECT_CERTAIN); + else { gEffectBattler = gBattlerTarget; @@ -2364,6 +2369,13 @@ void SetMoveEffect(bool32 primary, u32 certain) BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect]; break; + case MOVE_EFFECT_HAPPY_HOUR: + if (GET_BATTLER_SIDE(gBattlerAttacker) == B_SIDE_PLAYER) + { + gBattleStruct->moneyMultiplier *= 2; + } + gBattlescriptCurrInstr++; + break; case MOVE_EFFECT_TRI_ATTACK: if (gBattleMons[gEffectBattler].status1) { diff --git a/src/battle_util.c b/src/battle_util.c index d5088b9f9..0d57cb342 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3700,7 +3700,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) { case HOLD_EFFECT_DOUBLE_PRIZE: if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) - gBattleStruct->moneyMultiplier = 2; + gBattleStruct->moneyMultiplier *= 2; break; case HOLD_EFFECT_RESTORE_STATS: for (i = 0; i < NUM_BATTLE_STATS; i++) diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 18d5bd61d..3d6c81990 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -2103,7 +2103,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_SPLASH] = { - .effect = EFFECT_SPLASH, + .effect = EFFECT_DO_NOTHING, .power = 0, .type = TYPE_NORMAL, .accuracy = 0, @@ -8463,7 +8463,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_HAPPY_HOUR] = { - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_DO_NOTHING, .power = 0, .type = TYPE_NORMAL, .accuracy = 0, @@ -8505,7 +8505,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_CELEBRATE] = { - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_DO_NOTHING, .power = 0, .type = TYPE_NORMAL, .accuracy = 0, @@ -8519,13 +8519,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_HOLD_HANDS] = { - .effect = EFFECT_PLACEHOLDER, // Needs a custom move effect + .effect = EFFECT_DO_NOTHING, .power = 0, .type = TYPE_NORMAL, .accuracy = 0, .pp = 40, .secondaryEffectChance = 0, - .target = MOVE_TARGET_USER, + .target = MOVE_TARGET_ALLY, .priority = 0, .flags = 0, .split = SPLIT_STATUS, From 2743b069dafc33725a6d886c37978b7532bcd41a Mon Sep 17 00:00:00 2001 From: Fontbane Date: Fri, 5 Apr 2019 14:16:39 -0400 Subject: [PATCH 099/101] Decap Ability Names Also fixed names that are too long --- src/data/text/abilities.h | 498 +++++++++++++++++++------------------- 1 file changed, 249 insertions(+), 249 deletions(-) diff --git a/src/data/text/abilities.h b/src/data/text/abilities.h index 91424c2c7..d3b5ce6ed 100644 --- a/src/data/text/abilities.h +++ b/src/data/text/abilities.h @@ -1,7 +1,7 @@ static const u8 sNoneDescription[] = _("No special ability."); static const u8 sStenchDescription[] = _("Helps repel wild POKéMON."); static const u8 sDrizzleDescription[] = _("Summons rain in battle."); -static const u8 sSpeedBoostDescription[] = _("Gradually boosts SPEED."); +static const u8 sSpeedBoostDescription[] = _("Gradually boosts Speed."); static const u8 sBattleArmorDescription[] = _("Blocks critical hits."); static const u8 sSturdyDescription[] = _("Negates 1-hit KO attacks."); static const u8 sDampDescription[] = _("Prevents self-destruction."); @@ -20,27 +20,27 @@ static const u8 sFlashFireDescription[] = _("Powers up if hit by fire."); static const u8 sShieldDustDescription[] = _("Prevents added effects."); static const u8 sOwnTempoDescription[] = _("Prevents confusion."); static const u8 sSuctionCupsDescription[] = _("Firmly anchors the body."); -static const u8 sIntimidateDescription[] = _("Lowers the foe's ATTACK."); +static const u8 sIntimidateDescription[] = _("Lowers the foe's Attack."); static const u8 sShadowTagDescription[] = _("Prevents the foe's escape."); static const u8 sRoughSkinDescription[] = _("Hurts to touch."); static const u8 sWonderGuardDescription[] = _("“Super effective” hits."); -static const u8 sLevitateDescription[] = _("Not hit by GROUND attacks."); +static const u8 sLevitateDescription[] = _("Not hit by Ground attacks."); static const u8 sEffectSporeDescription[] = _("Leaves spores on contact."); static const u8 sSynchronizeDescription[] = _("Passes on status problems."); static const u8 sClearBodyDescription[] = _("Prevents ability reduction."); static const u8 sNaturalCureDescription[] = _("Heals upon switching out."); static const u8 sLightningRodDescription[] = _("Draws electrical moves."); static const u8 sSereneGraceDescription[] = _("Promotes added effects."); -static const u8 sSwiftSwimDescription[] = _("Raises SPEED in rain."); -static const u8 sChlorophyllDescription[] = _("Raises SPEED in sunshine."); +static const u8 sSwiftSwimDescription[] = _("Raises Speed in rain."); +static const u8 sChlorophyllDescription[] = _("Raises Speed in sunshine."); static const u8 sIlluminateDescription[] = _("Encounter rate increases."); static const u8 sTraceDescription[] = _("Copies special ability."); -static const u8 sHugePowerDescription[] = _("Raises ATTACK."); +static const u8 sHugePowerDescription[] = _("Raises Attack."); static const u8 sPoisonPointDescription[] = _("Poisons foe on contact."); static const u8 sInnerFocusDescription[] = _("Prevents flinching."); static const u8 sMagmaArmorDescription[] = _("Prevents freezing."); static const u8 sWaterVeilDescription[] = _("Prevents burns."); -static const u8 sMagnetPullDescription[] = _("Traps STEEL-type POKéMON."); +static const u8 sMagnetPullDescription[] = _("Traps Steel-type POKéMON."); static const u8 sSoundproofDescription[] = _("Avoids sound-based moves."); static const u8 sRainDishDescription[] = _("Slight HP recovery in rain."); static const u8 sSandStreamDescription[] = _("Summons a sandstorm."); @@ -50,29 +50,29 @@ static const u8 sEarlyBirdDescription[] = _("Awakens quickly from sleep."); static const u8 sFlameBodyDescription[] = _("Burns the foe on contact."); static const u8 sRunAwayDescription[] = _("Makes escaping easier."); static const u8 sKeenEyeDescription[] = _("Prevents loss of accuracy."); -static const u8 sHyperCutterDescription[] = _("Prevents ATTACK reduction."); +static const u8 sHyperCutterDescription[] = _("Prevents Attack reduction."); static const u8 sPickupDescription[] = _("May pick up items."); static const u8 sTruantDescription[] = _("Moves only every two turns."); static const u8 sHustleDescription[] = _("Trades accuracy for power."); static const u8 sCuteCharmDescription[] = _("Infatuates on contact."); -static const u8 sPlusDescription[] = _("Powers up with MINUS."); -static const u8 sMinusDescription[] = _("Powers up with PLUS."); +static const u8 sPlusDescription[] = _("Powers up with Minus."); +static const u8 sMinusDescription[] = _("Powers up with Plus."); static const u8 sForecastDescription[] = _("Changes with the weather."); static const u8 sStickyHoldDescription[] = _("Prevents item theft."); static const u8 sShedSkinDescription[] = _("Heals the body by shedding."); -static const u8 sGutsDescription[] = _("Ups ATTACK if suffering."); -static const u8 sMarvelScaleDescription[] = _("Ups DEFENSE if suffering."); +static const u8 sGutsDescription[] = _("Ups Attack if suffering."); +static const u8 sMarvelScaleDescription[] = _("Ups Defense if suffering."); static const u8 sLiquidOozeDescription[] = _("Draining causes injury."); -static const u8 sOvergrowDescription[] = _("Ups GRASS moves in a pinch."); -static const u8 sBlazeDescription[] = _("Ups FIRE moves in a pinch."); -static const u8 sTorrentDescription[] = _("Ups WATER moves in a pinch."); -static const u8 sSwarmDescription[] = _("Ups BUG moves in a pinch."); +static const u8 sOvergrowDescription[] = _("Ups Grass moves in a pinch."); +static const u8 sBlazeDescription[] = _("Ups Fire moves in a pinch."); +static const u8 sTorrentDescription[] = _("Ups Water moves in a pinch."); +static const u8 sSwarmDescription[] = _("Ups Bug moves in a pinch."); static const u8 sRockHeadDescription[] = _("Prevents recoil damage."); static const u8 sDroughtDescription[] = _("Summons sunlight in battle."); static const u8 sArenaTrapDescription[] = _("Prevents fleeing."); static const u8 sVitalSpiritDescription[] = _("Prevents sleep."); static const u8 sWhiteSmokeDescription[] = _("Prevents ability reduction."); -static const u8 sPurePowerDescription[] = _("Raises ATTACK."); +static const u8 sPurePowerDescription[] = _("Raises Attack."); static const u8 sShellArmorDescription[] = _("Blocks critical hits."); static const u8 sCacophonyDescription[] = _("Avoids sound-based moves."); static const u8 sAirLockDescription[] = _("Negates weather effects."); @@ -224,239 +224,239 @@ static const u8 sFullMetalBodyDescription[] = _("Prevents stat reduction."); const u8 gAbilityNames[ABILITIES_COUNT_GEN7][ABILITY_NAME_LENGTH + 1] = { [ABILITY_NONE] = _("-------"), - [ABILITY_STENCH] = _("STENCH"), - [ABILITY_DRIZZLE] = _("DRIZZLE"), - [ABILITY_SPEED_BOOST] = _("SPEED BOOST"), - [ABILITY_BATTLE_ARMOR] = _("BATTLE ARMOR"), - [ABILITY_STURDY] = _("STURDY"), - [ABILITY_DAMP] = _("DAMP"), - [ABILITY_LIMBER] = _("LIMBER"), - [ABILITY_SAND_VEIL] = _("SAND VEIL"), - [ABILITY_STATIC] = _("STATIC"), - [ABILITY_VOLT_ABSORB] = _("VOLT ABSORB"), - [ABILITY_WATER_ABSORB] = _("WATER ABSORB"), - [ABILITY_OBLIVIOUS] = _("OBLIVIOUS"), - [ABILITY_CLOUD_NINE] = _("CLOUD NINE"), - [ABILITY_COMPOUND_EYES] = _("COMPOUNDEYES"), - [ABILITY_INSOMNIA] = _("INSOMNIA"), - [ABILITY_COLOR_CHANGE] = _("COLOR CHANGE"), - [ABILITY_IMMUNITY] = _("IMMUNITY"), - [ABILITY_FLASH_FIRE] = _("FLASH FIRE"), - [ABILITY_SHIELD_DUST] = _("SHIELD DUST"), - [ABILITY_OWN_TEMPO] = _("OWN TEMPO"), - [ABILITY_SUCTION_CUPS] = _("SUCTION CUPS"), - [ABILITY_INTIMIDATE] = _("INTIMIDATE"), - [ABILITY_SHADOW_TAG] = _("SHADOW TAG"), - [ABILITY_ROUGH_SKIN] = _("ROUGH SKIN"), - [ABILITY_WONDER_GUARD] = _("WONDER GUARD"), - [ABILITY_LEVITATE] = _("LEVITATE"), - [ABILITY_EFFECT_SPORE] = _("EFFECT SPORE"), - [ABILITY_SYNCHRONIZE] = _("SYNCHRONIZE"), - [ABILITY_CLEAR_BODY] = _("CLEAR BODY"), - [ABILITY_NATURAL_CURE] = _("NATURAL CURE"), - [ABILITY_LIGHTNING_ROD] = _("LIGHTNINGROD"), - [ABILITY_SERENE_GRACE] = _("SERENE GRACE"), - [ABILITY_SWIFT_SWIM] = _("SWIFT SWIM"), - [ABILITY_CHLOROPHYLL] = _("CHLOROPHYLL"), - [ABILITY_ILLUMINATE] = _("ILLUMINATE"), - [ABILITY_TRACE] = _("TRACE"), - [ABILITY_HUGE_POWER] = _("HUGE POWER"), - [ABILITY_POISON_POINT] = _("POISON POINT"), - [ABILITY_INNER_FOCUS] = _("INNER FOCUS"), - [ABILITY_MAGMA_ARMOR] = _("MAGMA ARMOR"), - [ABILITY_WATER_VEIL] = _("WATER VEIL"), - [ABILITY_MAGNET_PULL] = _("MAGNET PULL"), - [ABILITY_SOUNDPROOF] = _("SOUNDPROOF"), - [ABILITY_RAIN_DISH] = _("RAIN DISH"), - [ABILITY_SAND_STREAM] = _("SAND STREAM"), + [ABILITY_STENCH] = _("Stench"), + [ABILITY_DRIZZLE] = _("Drizzle"), + [ABILITY_SPEED_BOOST] = _("Speed Boost"), + [ABILITY_BATTLE_ARMOR] = _("Battle Armor"), + [ABILITY_STURDY] = _("Sturdy"), + [ABILITY_DAMP] = _("Damp"), + [ABILITY_LIMBER] = _("Limber"), + [ABILITY_SAND_VEIL] = _("Sand Veil"), + [ABILITY_STATIC] = _("Static"), + [ABILITY_VOLT_ABSORB] = _("Volt Absorb"), + [ABILITY_WATER_ABSORB] = _("Water Absorb"), + [ABILITY_OBLIVIOUS] = _("Oblivious"), + [ABILITY_CLOUD_NINE] = _("Cloud Nine"), + [ABILITY_COMPOUND_EYES] = _("CompoundEyes"), + [ABILITY_INSOMNIA] = _("Insomnia"), + [ABILITY_COLOR_CHANGE] = _("Color Change"), + [ABILITY_IMMUNITY] = _("Immunity"), + [ABILITY_FLASH_FIRE] = _("Flash Fire"), + [ABILITY_SHIELD_DUST] = _("Shield Dust"), + [ABILITY_OWN_TEMPO] = _("Own Tempo"), + [ABILITY_SUCTION_CUPS] = _("Suction Cups"), + [ABILITY_INTIMIDATE] = _("Intimidate"), + [ABILITY_SHADOW_TAG] = _("Shadow Tag"), + [ABILITY_ROUGH_SKIN] = _("Rough Skin"), + [ABILITY_WONDER_GUARD] = _("Wonder Guard"), + [ABILITY_LEVITATE] = _("Levitate"), + [ABILITY_EFFECT_SPORE] = _("Effect Spore"), + [ABILITY_SYNCHRONIZE] = _("Synchronize"), + [ABILITY_CLEAR_BODY] = _("Clear Body"), + [ABILITY_NATURAL_CURE] = _("Natural Cure"), + [ABILITY_LIGHTNING_ROD] = _("Lightningrod"), + [ABILITY_SERENE_GRACE] = _("Serene Grace"), + [ABILITY_SWIFT_SWIM] = _("Swift Swim"), + [ABILITY_CHLOROPHYLL] = _("Chlorophyll"), + [ABILITY_ILLUMINATE] = _("Illuminate"), + [ABILITY_TRACE] = _("Trace"), + [ABILITY_HUGE_POWER] = _("Huge Power"), + [ABILITY_POISON_POINT] = _("Poison Point"), + [ABILITY_INNER_FOCUS] = _("Inner Focus"), + [ABILITY_MAGMA_ARMOR] = _("Magma Armor"), + [ABILITY_WATER_VEIL] = _("Water Veil"), + [ABILITY_MAGNET_PULL] = _("Magnet Pull"), + [ABILITY_SOUNDPROOF] = _("Soundproof"), + [ABILITY_RAIN_DISH] = _("Rain Dish"), + [ABILITY_SAND_STREAM] = _("Sand Stream"), [ABILITY_PRESSURE] = _("PRESSURE"), - [ABILITY_THICK_FAT] = _("THICK FAT"), - [ABILITY_EARLY_BIRD] = _("EARLY BIRD"), - [ABILITY_FLAME_BODY] = _("FLAME BODY"), - [ABILITY_RUN_AWAY] = _("RUN AWAY"), - [ABILITY_KEEN_EYE] = _("KEEN EYE"), - [ABILITY_HYPER_CUTTER] = _("HYPER CUTTER"), - [ABILITY_PICKUP] = _("PICKUP"), - [ABILITY_TRUANT] = _("TRUANT"), - [ABILITY_HUSTLE] = _("HUSTLE"), - [ABILITY_CUTE_CHARM] = _("CUTE CHARM"), - [ABILITY_PLUS] = _("PLUS"), - [ABILITY_MINUS] = _("MINUS"), - [ABILITY_FORECAST] = _("FORECAST"), - [ABILITY_STICKY_HOLD] = _("STICKY HOLD"), - [ABILITY_SHED_SKIN] = _("SHED SKIN"), - [ABILITY_GUTS] = _("GUTS"), - [ABILITY_MARVEL_SCALE] = _("MARVEL SCALE"), - [ABILITY_LIQUID_OOZE] = _("LIQUID OOZE"), - [ABILITY_OVERGROW] = _("OVERGROW"), - [ABILITY_BLAZE] = _("BLAZE"), - [ABILITY_TORRENT] = _("TORRENT"), - [ABILITY_SWARM] = _("SWARM"), - [ABILITY_ROCK_HEAD] = _("ROCK HEAD"), - [ABILITY_DROUGHT] = _("DROUGHT"), - [ABILITY_ARENA_TRAP] = _("ARENA TRAP"), - [ABILITY_VITAL_SPIRIT] = _("VITAL SPIRIT"), - [ABILITY_WHITE_SMOKE] = _("WHITE SMOKE"), - [ABILITY_PURE_POWER] = _("PURE POWER"), - [ABILITY_SHELL_ARMOR] = _("SHELL ARMOR"), - [ABILITY_CACOPHONY] = _("CACOPHONY"), - [ABILITY_AIR_LOCK] = _("AIR LOCK"), - [ABILITY_TANGLED_FEET] = _("TANGLED FEET"), - [ABILITY_MOTOR_DRIVE] = _("MOTOR DRIVE"), - [ABILITY_RIVALRY] = _("RIVALRY"), - [ABILITY_STEADFAST] = _("STEADFAST"), - [ABILITY_SNOW_CLOAK] = _("SNOW CLOAK"), - [ABILITY_GLUTTONY] = _("GLUTTONY"), - [ABILITY_ANGER_POINT] = _("ANGER POINT"), - [ABILITY_UNBURDEN] = _("UNBURDEN"), - [ABILITY_HEATPROOF] = _("HEATPROOF"), - [ABILITY_SIMPLE] = _("SIMPLE"), - [ABILITY_DRY_SKIN] = _("DRY SKIN"), - [ABILITY_DOWNLOAD] = _("DOWNLOAD"), - [ABILITY_IRON_FIST] = _("IRON FIST"), - [ABILITY_POISON_HEAL] = _("POISON HEAL"), - [ABILITY_ADAPTABILITY] = _("ADAPTABILITY"), - [ABILITY_SKILL_LINK] = _("SKILL LINK"), - [ABILITY_HYDRATION] = _("HYDRATION"), - [ABILITY_SOLAR_POWER] = _("SOLAR POWER"), - [ABILITY_QUICK_FEET] = _("QUICK FEET"), - [ABILITY_NORMALIZE] = _("NORMALIZE"), - [ABILITY_SNIPER] = _("SNIPER"), - [ABILITY_MAGIC_GUARD] = _("MAGIC GUARD"), - [ABILITY_NO_GUARD] = _("NO GUARD"), - [ABILITY_STALL] = _("STALL"), - [ABILITY_TECHNICIAN] = _("TECHNICIAN"), - [ABILITY_LEAF_GUARD] = _("LEAF GUARD"), - [ABILITY_KLUTZ] = _("KLUTZ"), - [ABILITY_MOLD_BREAKER] = _("MOLD BREAKER"), - [ABILITY_SUPER_LUCK] = _("SUPER LUCK"), - [ABILITY_AFTERMATH] = _("AFTERMATH"), - [ABILITY_ANTICIPATION] = _("ANTICIPATION"), - [ABILITY_FOREWARN] = _("FOREWARN"), - [ABILITY_UNAWARE] = _("UNAWARE"), - [ABILITY_TINTED_LENS] = _("TINTED LENS"), - [ABILITY_FILTER] = _("FILTER"), - [ABILITY_SLOW_START] = _("SLOW START"), - [ABILITY_SCRAPPY] = _("SCRAPPY"), - [ABILITY_STORM_DRAIN] = _("STORM DRAIN"), - [ABILITY_ICE_BODY] = _("ICE BODY"), - [ABILITY_SOLID_ROCK] = _("SOLID ROCK"), - [ABILITY_SNOW_WARNING] = _("SNOW WARNING"), - [ABILITY_HONEY_GATHER] = _("HONEY GATHER"), - [ABILITY_FRISK] = _("FRISK"), - [ABILITY_RECKLESS] = _("RECKLESS"), - [ABILITY_MULTITYPE] = _("MULTITYPE"), - [ABILITY_FLOWER_GIFT] = _("FLOWER GIFT"), - [ABILITY_BAD_DREAMS] = _("BAD DREAMS"), - [ABILITY_PICKPOCKET] = _("PICKPOCKET"), - [ABILITY_SHEER_FORCE] = _("SHEER FORCE"), - [ABILITY_CONTRARY] = _("CONTRARY"), - [ABILITY_UNNERVE] = _("UNNERVE"), - [ABILITY_DEFIANT] = _("DEFIANT"), - [ABILITY_DEFEATIST] = _("DEFEATIST"), - [ABILITY_CURSED_BODY] = _("CURSED BODY"), - [ABILITY_HEALER] = _("HEALER"), - [ABILITY_FRIEND_GUARD] = _("FRIEND GUARD"), - [ABILITY_WEAK_ARMOR] = _("WEAK ARMOR"), - [ABILITY_HEAVY_METAL] = _("HEAVY METAL"), - [ABILITY_LIGHT_METAL] = _("LIGHT METAL"), - [ABILITY_MULTISCALE] = _("MULTISCALE"), - [ABILITY_TOXIC_BOOST] = _("TOXIC BOOST"), - [ABILITY_FLARE_BOOST] = _("FLARE BOOST"), - [ABILITY_HARVEST] = _("HARVEST"), - [ABILITY_TELEPATHY] = _("TELEPATHY"), - [ABILITY_MOODY] = _("MOODY"), - [ABILITY_OVERCOAT] = _("OVERCOAT"), - [ABILITY_POISON_TOUCH] = _("POISON TOUCH"), - [ABILITY_REGENERATOR] = _("REGENERATOR"), - [ABILITY_BIG_PECKS] = _("BIG PECKS"), - [ABILITY_SAND_RUSH] = _("SAND RUSH"), - [ABILITY_WONDER_SKIN] = _("WONDER SKIN"), - [ABILITY_ANALYTIC] = _("ANALYTIC"), - [ABILITY_ILLUSION] = _("ILLUSION"), - [ABILITY_IMPOSTER] = _("IMPOSTER"), - [ABILITY_INFILTRATOR] = _("INFILTRATOR"), - [ABILITY_MUMMY] = _("MUMMY"), - [ABILITY_MOXIE] = _("MOXIE"), - [ABILITY_JUSTIFIED] = _("JUSTIFIED"), - [ABILITY_RATTLED] = _("RATTLED"), - [ABILITY_MAGIC_BOUNCE] = _("MAGIC BOUNCE"), - [ABILITY_SAP_SIPPER] = _("SAP SIPPER"), - [ABILITY_PRANKSTER] = _("PRANKSTER"), - [ABILITY_SAND_FORCE] = _("SAND FORCE"), - [ABILITY_IRON_BARBS] = _("IRON BARBS"), - [ABILITY_ZEN_MODE] = _("ZEN MODE"), - [ABILITY_VICTORY_STAR] = _("VICTORY STAR"), - [ABILITY_TURBOBLAZE] = _("TURBOBLAZE"), - [ABILITY_TERAVOLT] = _("TERAVOLT"), - [ABILITY_AROMA_VEIL] = _("AROMA VEIL"), - [ABILITY_FLOWER_VEIL] = _("FLOWER VEIL"), - [ABILITY_CHEEK_POUCH] = _("CHEEK POUCH"), - [ABILITY_PROTEAN] = _("PROTEAN"), - [ABILITY_FUR_COAT] = _("FUR COAT"), - [ABILITY_MAGICIAN] = _("MAGICIAN"), - [ABILITY_BULLETPROOF] = _("BULLETPROOF"), - [ABILITY_COMPETITIVE] = _("COMPETITIVE"), - [ABILITY_STRONG_JAW] = _("STRONG JAW"), - [ABILITY_REFRIGERATE] = _("REFRIGERATE"), - [ABILITY_SWEET_VEIL] = _("SWEET VEIL"), - [ABILITY_STANCE_CHANGE] = _("STANCE CHANG"), - [ABILITY_GALE_WINGS] = _("GALE WINGS"), - [ABILITY_MEGA_LAUNCHER] = _("MEGA LAUNCHE"), - [ABILITY_GRASS_PELT] = _("GRASS PELT"), - [ABILITY_SYMBIOSIS] = _("SYMBIOSIS"), - [ABILITY_TOUGH_CLAWS] = _("TOUGH CLAWS"), - [ABILITY_PIXILATE] = _("PIXILATE"), - [ABILITY_GOOEY] = _("GOOEY"), - [ABILITY_AERILATE] = _("AERILATE"), - [ABILITY_PARENTAL_BOND] = _("PARENTAL BON"), - [ABILITY_DARK_AURA] = _("DARK AURA"), - [ABILITY_FAIRY_AURA] = _("FAIRY AURA"), - [ABILITY_AURA_BREAK] = _("AURA BREAK"), - [ABILITY_PRIMORDIAL_SEA] = _("PRIMORDIAL S"), - [ABILITY_DESOLATE_LAND] = _("DESOLATE LAN"), - [ABILITY_DELTA_STREAM] = _("DELTA STREAM"), - [ABILITY_STAMINA] = _("STAMINA"), - [ABILITY_WIMP_OUT] = _("WIMP OUT"), - [ABILITY_EMERGENCY_EXIT] = _("EMERGENCY EX"), - [ABILITY_WATER_COMPACTION] = _("WATER COMPAC"), - [ABILITY_MERCILESS] = _("MERCILESS"), - [ABILITY_SHIELDS_DOWN] = _("SHIELDS DOWN"), - [ABILITY_STAKEOUT] = _("STAKEOUT"), - [ABILITY_WATER_BUBBLE] = _("WATER BUBBLE"), - [ABILITY_STEELWORKER] = _("STEELWORKER"), - [ABILITY_BERSERK] = _("BERSERK"), - [ABILITY_SLUSH_RUSH] = _("SLUSH RUSH"), - [ABILITY_LONG_REACH] = _("LONG REACH"), - [ABILITY_LIQUID_VOICE] = _("LIQUID VOICE"), - [ABILITY_TRIAGE] = _("TRIAGE"), - [ABILITY_GALVANIZE] = _("GALVANIZE"), - [ABILITY_SURGE_SURFER] = _("SURGE SURFER"), - [ABILITY_SCHOOLING] = _("SCHOOLING"), - [ABILITY_DISGUISE] = _("DISGUISE"), - [ABILITY_BATTLE_BOND] = _("BATTLE BOND"), - [ABILITY_POWER_CONSTRUCT] = _("POWER CONSTR"), - [ABILITY_CORROSION] = _("CORROSION"), - [ABILITY_COMATOSE] = _("COMATOSE"), - [ABILITY_QUEENLY_MAJESTY] = _("QUEENLY MAJE"), - [ABILITY_INNARDS_OUT] = _("INNARDS OUT"), - [ABILITY_DANCER] = _("DANCER"), - [ABILITY_BATTERY] = _("BATTERY"), - [ABILITY_FLUFFY] = _("FLUFFY"), - [ABILITY_DAZZLING] = _("DAZZLING"), - [ABILITY_SOUL_HEART] = _("SOUL HEART"), - [ABILITY_TANGLING_HAIR] = _("TANGLING HAI"), - [ABILITY_RECEIVER] = _("RECEIVER"), - [ABILITY_POWER_OF_ALCHEMY] = _("POWER OF ALC"), - [ABILITY_BEAST_BOOST] = _("BEAST BOOST"), - [ABILITY_RKS_SYSTEM] = _("RKS SYSTEM"), - [ABILITY_ELECTRIC_SURGE] = _("ELECTRIC SUR"), - [ABILITY_PSYCHIC_SURGE] = _("PSYCHIC SUR"), - [ABILITY_MISTY_SURGE] = _("MISTY SURGE"), - [ABILITY_GRASSY_SURGE] = _("GRASSY SURGE"), - [ABILITY_FULL_METAL_BODY] = _("FULL METAL B"), - [ABILITY_SHADOW_SHIELD] = _("SHADOW SHIEL"), - [ABILITY_PRISM_ARMOR] = _("PRISM ARMOR"), + [ABILITY_THICK_FAT] = _("Thick Fat"), + [ABILITY_EARLY_BIRD] = _("Early Bird"), + [ABILITY_FLAME_BODY] = _("Flame Body"), + [ABILITY_RUN_AWAY] = _("Run Away"), + [ABILITY_KEEN_EYE] = _("Keen Eye"), + [ABILITY_HYPER_CUTTER] = _("Hyper Cutter"), + [ABILITY_PICKUP] = _("Pickup"), + [ABILITY_TRUANT] = _("Truant"), + [ABILITY_HUSTLE] = _("Hustle"), + [ABILITY_CUTE_CHARM] = _("Cute Charm"), + [ABILITY_PLUS] = _("Plus"), + [ABILITY_MINUS] = _("Minus"), + [ABILITY_FORECAST] = _("Forecast"), + [ABILITY_STICKY_HOLD] = _("Sticky Hold"), + [ABILITY_SHED_SKIN] = _("Shed Skin"), + [ABILITY_GUTS] = _("Guts"), + [ABILITY_MARVEL_SCALE] = _("Marvel Scale"), + [ABILITY_LIQUID_OOZE] = _("Liquid Ooze"), + [ABILITY_OVERGROW] = _("Overgrow"), + [ABILITY_BLAZE] = _("Blaze"), + [ABILITY_TORRENT] = _("Torrent"), + [ABILITY_SWARM] = _("Swarm"), + [ABILITY_ROCK_HEAD] = _("Rock Head"), + [ABILITY_DROUGHT] = _("Drought"), + [ABILITY_ARENA_TRAP] = _("Arena Trap"), + [ABILITY_VITAL_SPIRIT] = _("Vital Spirit"), + [ABILITY_WHITE_SMOKE] = _("White Smoke"), + [ABILITY_PURE_POWER] = _("Pure Power"), + [ABILITY_SHELL_ARMOR] = _("Shell Armor"), + [ABILITY_CACOPHONY] = _("Cacophony"), + [ABILITY_AIR_LOCK] = _("Air Lock"), + [ABILITY_TANGLED_FEET] = _("Tangled Feet"), + [ABILITY_MOTOR_DRIVE] = _("Motor Drive"), + [ABILITY_RIVALRY] = _("Rivalry"), + [ABILITY_STEADFAST] = _("Steadfast"), + [ABILITY_SNOW_CLOAK] = _("Snow Cloak"), + [ABILITY_GLUTTONY] = _("Gluttony"), + [ABILITY_ANGER_POINT] = _("Anger Point"), + [ABILITY_UNBURDEN] = _("Unburden"), + [ABILITY_HEATPROOF] = _("Heatproof"), + [ABILITY_SIMPLE] = _("Simple"), + [ABILITY_DRY_SKIN] = _("Dry Skin"), + [ABILITY_DOWNLOAD] = _("Download"), + [ABILITY_IRON_FIST] = _("Iron Fist"), + [ABILITY_POISON_HEAL] = _("Poison Heal"), + [ABILITY_ADAPTABILITY] = _("Adaptability"), + [ABILITY_SKILL_LINK] = _("Skill Link"), + [ABILITY_HYDRATION] = _("Hydration"), + [ABILITY_SOLAR_POWER] = _("Solar Power"), + [ABILITY_QUICK_FEET] = _("Quick Feet"), + [ABILITY_NORMALIZE] = _("Normalize"), + [ABILITY_SNIPER] = _("Sniper"), + [ABILITY_MAGIC_GUARD] = _("Magic Guard"), + [ABILITY_NO_GUARD] = _("No Guard"), + [ABILITY_STALL] = _("Stall"), + [ABILITY_TECHNICIAN] = _("Technician"), + [ABILITY_LEAF_GUARD] = _("Leaf Guard"), + [ABILITY_KLUTZ] = _("Klutz"), + [ABILITY_MOLD_BREAKER] = _("Mold Breaker"), + [ABILITY_SUPER_LUCK] = _("Super Luck"), + [ABILITY_AFTERMATH] = _("Aftermath"), + [ABILITY_ANTICIPATION] = _("Anticipation"), + [ABILITY_FOREWARN] = _("Forewarn"), + [ABILITY_UNAWARE] = _("Unaware"), + [ABILITY_TINTED_LENS] = _("Tinted Lens"), + [ABILITY_FILTER] = _("Filter"), + [ABILITY_SLOW_START] = _("Slow Start"), + [ABILITY_SCRAPPY] = _("Scrappy"), + [ABILITY_STORM_DRAIN] = _("Storm Drain"), + [ABILITY_ICE_BODY] = _("Ice Body"), + [ABILITY_SOLID_ROCK] = _("Solid Rock"), + [ABILITY_SNOW_WARNING] = _("Snow Warning"), + [ABILITY_HONEY_GATHER] = _("Honey Gather"), + [ABILITY_FRISK] = _("Frisk"), + [ABILITY_RECKLESS] = _("Reckless"), + [ABILITY_MULTITYPE] = _("Multitype"), + [ABILITY_FLOWER_GIFT] = _("Flower Gift"), + [ABILITY_BAD_DREAMS] = _("Bad Dreams"), + [ABILITY_PICKPOCKET] = _("Pickpocket"), + [ABILITY_SHEER_FORCE] = _("Sheer Force"), + [ABILITY_CONTRARY] = _("Contrary"), + [ABILITY_UNNERVE] = _("Unnerve"), + [ABILITY_DEFIANT] = _("Defiant"), + [ABILITY_DEFEATIST] = _("Defeatist"), + [ABILITY_CURSED_BODY] = _("Cursed Body"), + [ABILITY_HEALER] = _("Healer"), + [ABILITY_FRIEND_GUARD] = _("Friend Guard"), + [ABILITY_WEAK_ARMOR] = _("Weak Armor"), + [ABILITY_HEAVY_METAL] = _("Heavy Metal"), + [ABILITY_LIGHT_METAL] = _("Light Metal"), + [ABILITY_MULTISCALE] = _("Multiscale"), + [ABILITY_TOXIC_BOOST] = _("Toxic Boost"), + [ABILITY_FLARE_BOOST] = _("Flare Boost"), + [ABILITY_HARVEST] = _("Harvest"), + [ABILITY_TELEPATHY] = _("Telepathy"), + [ABILITY_MOODY] = _("Moody"), + [ABILITY_OVERCOAT] = _("Overcoat"), + [ABILITY_POISON_TOUCH] = _("Poison Touch"), + [ABILITY_REGENERATOR] = _("Regenerator"), + [ABILITY_BIG_PECKS] = _("Big Pecks"), + [ABILITY_SAND_RUSH] = _("Sand Rush"), + [ABILITY_WONDER_SKIN] = _("Wonder Skin"), + [ABILITY_ANALYTIC] = _("Analytic"), + [ABILITY_ILLUSION] = _("Illusion"), + [ABILITY_IMPOSTER] = _("Imposter"), + [ABILITY_INFILTRATOR] = _("Infiltrator"), + [ABILITY_MUMMY] = _("Mummy"), + [ABILITY_MOXIE] = _("Moxie"), + [ABILITY_JUSTIFIED] = _("Justified"), + [ABILITY_RATTLED] = _("Rattled"), + [ABILITY_MAGIC_BOUNCE] = _("Magic Bounce"), + [ABILITY_SAP_SIPPER] = _("Sap Sipper"), + [ABILITY_PRANKSTER] = _("Prankster"), + [ABILITY_SAND_FORCE] = _("Sand Force"), + [ABILITY_IRON_BARBS] = _("Iron Barbs"), + [ABILITY_ZEN_MODE] = _("Zen Mode"), + [ABILITY_VICTORY_STAR] = _("Victory Star"), + [ABILITY_TURBOBLAZE] = _("Turboblaze"), + [ABILITY_TERAVOLT] = _("Teravolt"), + [ABILITY_AROMA_VEIL] = _("Aroma Veil"), + [ABILITY_FLOWER_VEIL] = _("Flower Veil"), + [ABILITY_CHEEK_POUCH] = _("Cheek Pouch"), + [ABILITY_PROTEAN] = _("Protean"), + [ABILITY_FUR_COAT] = _("Fur Coat"), + [ABILITY_MAGICIAN] = _("Magician"), + [ABILITY_BULLETPROOF] = _("Bulletproof"), + [ABILITY_COMPETITIVE] = _("Competitive"), + [ABILITY_STRONG_JAW] = _("Strong Jaw"), + [ABILITY_REFRIGERATE] = _("Refrigerate"), + [ABILITY_SWEET_VEIL] = _("Sweet Veil"), + [ABILITY_STANCE_CHANGE] = _("StanceChange"), + [ABILITY_GALE_WINGS] = _("Gale Wings"), + [ABILITY_MEGA_LAUNCHER] = _("MegaLauncher"), + [ABILITY_GRASS_PELT] = _("Grass Pelt"), + [ABILITY_SYMBIOSIS] = _("Symbiosis"), + [ABILITY_TOUGH_CLAWS] = _("Tough Claws"), + [ABILITY_PIXILATE] = _("Pixilate"), + [ABILITY_GOOEY] = _("Gooey"), + [ABILITY_AERILATE] = _("Aerilate"), + [ABILITY_PARENTAL_BOND] = _("ParentalBond"), + [ABILITY_DARK_AURA] = _("Dark Aura"), + [ABILITY_FAIRY_AURA] = _("Fairy Aura"), + [ABILITY_AURA_BREAK] = _("Aura Break"), + [ABILITY_PRIMORDIAL_SEA] = _("Primordial S"), + [ABILITY_DESOLATE_LAND] = _("DesolateLand"), + [ABILITY_DELTA_STREAM] = _("Delta Stream"), + [ABILITY_STAMINA] = _("Stamina"), + [ABILITY_WIMP_OUT] = _("Wimp Out"), + [ABILITY_EMERGENCY_EXIT] = _("Emergency Ex"), + [ABILITY_WATER_COMPACTION] = _("Water Compac"), + [ABILITY_MERCILESS] = _("Merciless"), + [ABILITY_SHIELDS_DOWN] = _("Shields Down"), + [ABILITY_STAKEOUT] = _("Stakeout"), + [ABILITY_WATER_BUBBLE] = _("Water Bubble"), + [ABILITY_STEELWORKER] = _("Steelworker"), + [ABILITY_BERSERK] = _("Berserk"), + [ABILITY_SLUSH_RUSH] = _("Slush Rush"), + [ABILITY_LONG_REACH] = _("Long Reach"), + [ABILITY_LIQUID_VOICE] = _("Liquid Voice"), + [ABILITY_TRIAGE] = _("Triage"), + [ABILITY_GALVANIZE] = _("Galvanize"), + [ABILITY_SURGE_SURFER] = _("Surge Surfer"), + [ABILITY_SCHOOLING] = _("Schooling"), + [ABILITY_DISGUISE] = _("Disguise"), + [ABILITY_BATTLE_BOND] = _("Battle Bond"), + [ABILITY_POWER_CONSTRUCT] = _("Power Constr"), + [ABILITY_CORROSION] = _("Corrosion"), + [ABILITY_COMATOSE] = _("Comatose"), + [ABILITY_QUEENLY_MAJESTY] = _("Queenly Majesty"), + [ABILITY_INNARDS_OUT] = _("Innards Out"), + [ABILITY_DANCER] = _("Dancer"), + [ABILITY_BATTERY] = _("Battery"), + [ABILITY_FLUFFY] = _("Fluffy"), + [ABILITY_DAZZLING] = _("Dazzling"), + [ABILITY_SOUL_HEART] = _("Soul-Heart"), + [ABILITY_TANGLING_HAIR] = _("TanglingHair"), + [ABILITY_RECEIVER] = _("Receiver"), + [ABILITY_POWER_OF_ALCHEMY] = _("Power Of Alc"), + [ABILITY_BEAST_BOOST] = _("Beast Boost"), + [ABILITY_RKS_SYSTEM] = _("RKS System"), + [ABILITY_ELECTRIC_SURGE] = _("Elec Surge"), + [ABILITY_PSYCHIC_SURGE] = _("Psy Surge"), + [ABILITY_MISTY_SURGE] = _("Misty Surge"), + [ABILITY_GRASSY_SURGE] = _("Grassy Surge"), + [ABILITY_FULL_METAL_BODY] = _("FullMetalBod"), + [ABILITY_SHADOW_SHIELD] = _("ShadowShield"), + [ABILITY_PRISM_ARMOR] = _("Prism Armor"), }; const u8 *const gAbilityDescriptionPointers[ABILITIES_COUNT_GEN7] = From af2f5031784b7f07434841cac189f20375281242 Mon Sep 17 00:00:00 2001 From: Fontbane Date: Fri, 5 Apr 2019 17:24:36 -0400 Subject: [PATCH 100/101] Fix gitignore --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4d8c4ba7b..dc782899d 100644 --- a/.gitignore +++ b/.gitignore @@ -27,5 +27,3 @@ Thumbs.db build/ .DS_Store *.ddump -*.bin -*.ipch From a83255d1031c82978ad3b76a7602639c6c078126 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 6 Apr 2019 00:03:03 +0200 Subject: [PATCH 101/101] fix after prs --- data/battle_ai_scripts.s | 3 ++- src/battle_script_commands.c | 7 ++----- src/data/text/abilities.h | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/data/battle_ai_scripts.s b/data/battle_ai_scripts.s index 1f072b734..b389d5771 100644 --- a/data/battle_ai_scripts.s +++ b/data/battle_ai_scripts.s @@ -249,6 +249,7 @@ AI_CheckBadMove_CheckEffect: @ 82DC045 if_effect EFFECT_SHELL_SMASH, AI_CBM_ShellSmash if_effect EFFECT_LAST_RESORT, AI_CBM_LastResort if_effect EFFECT_BELCH, AI_CBM_Belch + if_effect EFFECT_DO_NOTHING, Score_Minus8 end AI_CBM_Belch: @@ -2078,7 +2079,7 @@ AI_CV_Encore_EncouragedMovesToEncore: .byte EFFECT_POISON .byte EFFECT_PARALYZE .byte EFFECT_LEECH_SEED - .byte EFFECT_SPLASH + .byte EFFECT_DO_NOTHING .byte EFFECT_ATTACK_UP_2 .byte EFFECT_ENCORE .byte EFFECT_CONVERSION_2 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index bef6e29a3..ec7eb717a 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2006,16 +2006,13 @@ void SetMoveEffect(bool32 primary, u32 certain) affectsUser = MOVE_EFFECT_AFFECTS_USER; gBattleScripting.battler = gBattlerTarget; // theoretically the attacker } - - // Just in case this flag is still set - if (gBattleScripting.moveEffect & MOVE_EFFECT_CERTAIN) - gBattleScripting.moveEffect &= ~(MOVE_EFFECT_CERTAIN); - else { gEffectBattler = gBattlerTarget; gBattleScripting.battler = gBattlerAttacker; } + // Just in case this flag is still set + gBattleScripting.moveEffect &= ~(MOVE_EFFECT_CERTAIN); if (GetBattlerAbility(gEffectBattler) == ABILITY_SHIELD_DUST && !(gHitMarker & HITMARKER_IGNORE_SAFEGUARD) && !primary && gBattleScripting.moveEffect <= 9) diff --git a/src/data/text/abilities.h b/src/data/text/abilities.h index d3b5ce6ed..dc8b000f1 100644 --- a/src/data/text/abilities.h +++ b/src/data/text/abilities.h @@ -438,7 +438,7 @@ const u8 gAbilityNames[ABILITIES_COUNT_GEN7][ABILITY_NAME_LENGTH + 1] = [ABILITY_POWER_CONSTRUCT] = _("Power Constr"), [ABILITY_CORROSION] = _("Corrosion"), [ABILITY_COMATOSE] = _("Comatose"), - [ABILITY_QUEENLY_MAJESTY] = _("Queenly Majesty"), + [ABILITY_QUEENLY_MAJESTY] = _("QueenMajesty"), [ABILITY_INNARDS_OUT] = _("Innards Out"), [ABILITY_DANCER] = _("Dancer"), [ABILITY_BATTERY] = _("Battery"),