Decompile data/use_pokeblock.s

This commit is contained in:
ultima-soul 2019-07-30 17:21:17 -07:00
parent 370e9afb37
commit 9a152f8fe6
5 changed files with 259 additions and 134 deletions

View File

@ -1,113 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 4
gUnknown_085DFA60:: @ 85DFA60
.incbin "graphics/interface/85DFA60.bin"
gUnknown_085DFA80:: @ 85DFA80
.incbin "graphics/interface/85DFA80.4bpp"
gUnknown_085DFB60:: @ 85DFB60
.incbin "graphics/interface/85DFB60.bin"
gUnknown_085DFC0C:: @ 85DFC0C
.incbin "graphics/interface/85DFC0C.bin"
gUnknown_085DFCB0:: @ 85DFCB0
.4byte 22, 47, 33, 24, 23
gUnknown_085DFCC4:: @ 85DFCC4
.byte 0, 4, 3, 2, 1
gUnknown_085DFCC9:: @ 85DFCC9
.byte 0, 8, 1
gUnknown_085DFCCC:: @ 85DFCCC
.4byte 0x1F8
.4byte 0x31E1
.4byte 0x4021DF
.4byte 0x1172
gUnknown_085DFCDC:: @ 85DFCDC
window_template 0, 0xD, 1, 0xD, 4, 0xF, 1
window_template 0, 0, 0xE, 0xB, 2, 0xF, 0x35
window_template 0, 1, 0x11, 0x1C, 2, 0xF, 0x4B
null_window_template
sUsePokeblockYesNoWinTemplate:: @ 85DFCFC
window_template 0, 0x18, 0xB, 5, 4, 0xF, 0x83
sContestStatNames:: @ 85DFD04
.4byte gText_Coolness
.4byte gText_Toughness
.4byte gText_Smartness
.4byte gText_Cuteness
.4byte gText_Beauty3
gSpriteSheet_ConditionUpDown:: @ 85DFD18
obj_tiles gUsePokeblockUpDown_Gfx, 0x200, 0
gSpritePalette_ConditionUpDown:: @ 85DFD20
obj_pal gUsePokeblockUpDown_Pal, 0
gUnknown_085DFD28:: @ 85DFD28
.2byte 0x9c, 0x24
.2byte 0x75, 0x3b
.2byte 0x75, 0x76
.2byte 0xc5, 0x76
.2byte 0xc5, 0x3b
gUnknown_085DFD3C:: @ 85DFD3C
.2byte 0x4000
.2byte 0x8000
.2byte 0x400
.2byte 0
gUnknown_085DFD44:: @ 85DFD44
obj_image_anim_frame 0, 5
obj_image_anim_end
gUnknown_085DFD4C:: @ 85DFD4C
obj_image_anim_frame 8, 5
obj_image_anim_end
gUnknown_085DFD54:: @ 85DFD54
.4byte gUnknown_085DFD44
.4byte gUnknown_085DFD4C
gSpriteTemplate_085DFD5C:: @ 85DFD5C
spr_template 0, 0, gUnknown_085DFD3C, gUnknown_085DFD54, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
gUnknown_085DFD74:: @ 85DFD74
.2byte 0x4000
.2byte 0xC000
.2byte 0x400
.2byte 0
gUnknown_085DFD7C:: @ 85DFD7C
obj_image_anim_frame 0, 5
obj_image_anim_end
gUnknown_085DFD84:: @ 85DFD84
obj_image_anim_frame 32, 5
obj_image_anim_end
gUnknown_085DFD8C:: @ 85DFD8C
obj_image_anim_frame 64, 5
obj_image_anim_end
gUnknown_085DFD94:: @ 85DFD94
.4byte gUnknown_085DFD7C
.4byte gUnknown_085DFD84
.4byte gUnknown_085DFD8C
gUnknown_085DFDA0:: @ 85DFDA0
spr_template 1, 1, gUnknown_085DFD74, gUnknown_085DFD94, NULL, gDummySpriteAffineAnimTable, sub_8168374
gUnknown_085DFDB8:: @ 85DFDB8
.4byte gUsePokeblockCondition_Pal
.4byte 1

View File

@ -4939,6 +4939,9 @@ extern const u32 gLinkMiscMenu_Tilemap[];
// Use Pokeblock
extern const u8 gPokenavConditionCancel_Gfx[];
extern const u16 gPokenavConditionCancel_Pal[];
extern const u8 gUsePokeblockUpDown_Gfx[];
extern const u16 gUsePokeblockUpDown_Pal[];
extern const u16 gUsePokeblockCondition_Pal[];
// Berry Crush
extern const u32 gUnknown_08DE34B8[];

View File

@ -2744,4 +2744,11 @@ extern const u8 gUnknown_085EC017[];
extern const u8 gUnknown_085EC01C[];
extern const u8 gUnknown_085EC022[];
// use_pokeblock
extern const u8 gText_Coolness[];
extern const u8 gText_Toughness[];
extern const u8 gText_Smartness[];
extern const u8 gText_Cuteness[];
extern const u8 gText_Beauty3[];
#endif // GUARD_STRINGS_H

View File

@ -600,7 +600,6 @@ SECTIONS {
src/roamer.o(.rodata);
src/battle_tower.o(.rodata);
src/use_pokeblock.o(.rodata);
data/use_pokeblock.o(.rodata);
src/battle_controller_wally.o(.rodata);
src/player_pc.o(.rodata);
src/intro.o(.rodata);

View File

@ -85,6 +85,10 @@ struct UsePokeblockStruct
/*0x7FD0*/ struct UsePokeblockSubStruct info;
};
#define TAG_TILE_CONDITION_UP_DOWN 0
#define TAG_PAL_CONDITION_UP_DOWN 0
#define TAG_PAL_POKEBLOCK_CONDITION 1
extern void sub_81D21DC(u8);
// this file's functions
@ -130,26 +134,12 @@ static u8 sub_8168048(void);
void sub_8168180(struct Sprite *sprite);
void sub_81681B4(struct Sprite *sprite);
void sub_8168168(struct Sprite *sprite);
void sub_8168374(struct Sprite *sprite);
extern const struct BgTemplate gUnknown_085DFCCC[4];
extern const struct WindowTemplate gUnknown_085DFCDC[];
extern const struct WindowTemplate sUsePokeblockYesNoWinTemplate[];
extern const u8* sContestStatNames[];
extern const u32 gUnknown_085DFCB0[];
extern const u8 gUnknown_085DFCC4[];
extern const struct SpriteSheet gSpriteSheet_ConditionUpDown;
extern const struct SpritePalette gSpritePalette_ConditionUpDown;
extern const struct SpriteTemplate gSpriteTemplate_085DFD5C;
extern const s16 gUnknown_085DFD28[][2];
extern const u32 gUnknown_085DFB60[];
extern const u32 gUnknown_085DFA80[];
extern const u32 gUnknown_085DFA60[];
extern const u32 gUnknown_085DFC0C[];
extern const u16 gUnknown_086231E8[];
extern const u16 gUnknown_08623208[];
extern const u8 gUnknown_085DFCC9[];
extern const struct SpritePalette gUnknown_085DFDB8;
extern const struct SpriteTemplate gUnknown_085DFDA0;
extern const struct SpritePalette gSpritePalette_085DFDB8;
extern const struct SpriteTemplate gSpriteTemplate_085DFDA0;
// ram variables
EWRAM_DATA struct UsePokeblockSubStruct *gUnknown_0203BC90 = NULL;
@ -165,6 +155,245 @@ EWRAM_DATA struct UsePokeblockStruct *gUnknown_0203BCAC = NULL;
// const rom data
// todo: make it static once the file is decompiled
const u32 gUnknown_085DFA60[] = INCBIN_U32("graphics/interface/85DFA60.bin");
const u32 gUnknown_085DFA80[] = INCBIN_U32("graphics/interface/85DFA80.4bpp");
const u32 gUnknown_085DFB60[] = INCBIN_U32("graphics/interface/85DFB60.bin");
const u32 gUnknown_085DFC0C[] = INCBIN_U32("graphics/interface/85DFC0C.bin");
const u32 gUnknown_085DFCB0[] =
{
MON_DATA_COOL,
MON_DATA_TOUGH,
MON_DATA_SMART,
MON_DATA_CUTE,
MON_DATA_BEAUTY
};
const u8 gUnknown_085DFCC4[] =
{
0, // Spicy/Cool
4, // Dry/Beauty
3, // Sweet/Cute
2, // Bitter/Smart
1 // Sour/Tough
};
const u8 gUnknown_085DFCC9[] =
{
0,
8,
1
};
const struct BgTemplate gUnknown_085DFCCC[4] =
{
{
.bg = 0,
.charBaseIndex = 2,
.mapBaseIndex = 0x1F,
.screenSize = 0,
.paletteMode = 0,
.priority = 0,
.baseTile = 0
},
{
.bg = 1,
.charBaseIndex = 0,
.mapBaseIndex = 0x1E,
.screenSize = 0,
.paletteMode = 0,
.priority = 3,
.baseTile = 0
},
{
.bg = 3,
.charBaseIndex = 3,
.mapBaseIndex = 0x1D,
.screenSize = 0,
.paletteMode = 0,
.priority = 2,
.baseTile = 0x100
},
{
.bg = 2,
.charBaseIndex = 0,
.mapBaseIndex = 0x17,
.screenSize = 0,
.paletteMode = 0,
.priority = 1,
.baseTile = 0
}
};
const struct WindowTemplate gUnknown_085DFCDC[] =
{
{
.bg = 0,
.tilemapLeft = 0xD,
.tilemapTop = 1,
.width = 0xD,
.height = 4,
.paletteNum = 0xF,
.baseBlock = 1
},
{
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 0xE,
.width = 0xB,
.height = 2,
.paletteNum = 0xF,
.baseBlock = 0x35
},
{
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 0x11,
.width = 0x1C,
.height = 2,
.paletteNum = 0xF,
.baseBlock = 0x4B
},
DUMMY_WIN_TEMPLATE
};
const struct WindowTemplate sUsePokeblockYesNoWinTemplate =
{
.bg = 0,
.tilemapLeft = 0x18,
.tilemapTop = 0xB,
.width = 5,
.height = 4,
.paletteNum = 0xF,
.baseBlock = 0x83
};
const u8 *const sContestStatNames[] =
{
gText_Coolness,
gText_Toughness,
gText_Smartness,
gText_Cuteness,
gText_Beauty3
};
const struct SpriteSheet gSpriteSheet_ConditionUpDown =
{
gUsePokeblockUpDown_Gfx, 0x200, TAG_TILE_CONDITION_UP_DOWN
};
const struct SpritePalette gSpritePalette_ConditionUpDown =
{
gUsePokeblockUpDown_Pal, TAG_PAL_CONDITION_UP_DOWN
};
const s16 gUnknown_085DFD28[][2] =
{
{0x9C, 0x24},
{0x75, 0x3B},
{0x75, 0x76},
{0xC5, 0x76},
{0xC5, 0x3B}
};
const struct OamData gOamData_085DFD3C =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.bpp = 0,
.shape = SPRITE_SHAPE(32x16),
.x = 0,
.size = SPRITE_SIZE(32x16),
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
};
const union AnimCmd gSpriteAnim_085DFD44[] =
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_END
};
const union AnimCmd gSpriteAnim_085DFD4C[] =
{
ANIMCMD_FRAME(8, 5),
ANIMCMD_END
};
const union AnimCmd *const gSpriteAnimTable_085DFD54[] =
{
gSpriteAnim_085DFD44,
gSpriteAnim_085DFD4C
};
const struct SpriteTemplate gSpriteTemplate_085DFD5C =
{
.tileTag = 0,
.paletteTag = 0,
.oam = &gOamData_085DFD3C,
.anims = gSpriteAnimTable_085DFD54,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
const struct OamData gOamData_085DFD74 =
{
.y = 0,
.affineMode = 0,
.objMode = 0,
.bpp = 0,
.shape = SPRITE_SHAPE(64x32),
.x = 0,
.size = SPRITE_SIZE(64x32),
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
};
const union AnimCmd gSpriteAnim_085DFD7C[] =
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_END
};
const union AnimCmd gSpriteAnim_085DFD84[] =
{
ANIMCMD_FRAME(32, 5),
ANIMCMD_END
};
const union AnimCmd gSpriteAnim_085DFD8C[] =
{
ANIMCMD_FRAME(64, 5),
ANIMCMD_END
};
const union AnimCmd *const gSpriteAnimTable_085DFD94[] =
{
gSpriteAnim_085DFD7C,
gSpriteAnim_085DFD84,
gSpriteAnim_085DFD8C
};
const struct SpriteTemplate gSpriteTemplate_085DFDA0 =
{
.tileTag = 1,
.paletteTag = 1,
.oam = &gOamData_085DFD74,
.anims = gSpriteAnimTable_085DFD94,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_8168374,
};
const struct SpritePalette gSpritePalette_085DFDB8 =
{
gUsePokeblockCondition_Pal, TAG_PAL_POKEBLOCK_CONDITION
};
// code
void ChooseMonToGivePokeblock(struct Pokeblock *pokeblock, void (*callback)(void))
{
@ -618,7 +847,7 @@ void sub_8166D44(void)
AddTextPrinterParameterized(2, 1, gStringVar4, 0, 1, 0, NULL);
PutWindowTilemap(2);
CopyWindowToVram(2, 3);
CreateYesNoMenu(sUsePokeblockYesNoWinTemplate, 151, 14, 0);
CreateYesNoMenu(&sUsePokeblockYesNoWinTemplate, 151, 14, 0);
}
s8 sub_8166DE4(void)
@ -1373,7 +1602,7 @@ static void sub_8168248(void)
struct CompressedSpriteSheet spriteSheet;
struct SpritePalette spritePalette;
spritePalette = gUnknown_085DFDB8;
spritePalette = gSpritePalette_085DFDB8;
spriteSheet.data = gUsePokeblockCondition_Gfx;
spriteSheet.size = 0x800;
spriteSheet.tag = 1;
@ -1388,7 +1617,7 @@ static void sub_8168294(void)
int yStart = 17;
int var = 8;
struct Sprite **sprites = gUnknown_0203BCAC->field_7B44;
const struct SpriteTemplate *template = &gUnknown_085DFDA0;
const struct SpriteTemplate *template = &gSpriteTemplate_085DFDA0;
for (i = 0, xDiff = 64, xStart = -96; i < 2; i++)
{