Finish porting pokemon_jump from Emerald

This commit is contained in:
PikalaxALT
2020-02-18 16:39:44 -05:00
parent f65e07fb1f
commit 5c530e1330
19 changed files with 805 additions and 1500 deletions
-1291
View File
File diff suppressed because it is too large Load Diff
-173
View File
@@ -1,173 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
gUnknown_846D9E4:: @ gbapal
.incbin "graphics/link_games/unk_846D9E4.gbapal"
gUnknown_846DA04:: @ gbapal
.incbin "graphics/link_games/unk_846DA04.gbapal"
gUnknown_846DA24:: @ 4bpp.lz
.incbin "graphics/link_games/unk_846DA24.4bpp.lz"
gUnknown_846DB44:: @ 4bpp.lz
.incbin "graphics/link_games/unk_846DB44.4bpp.lz"
gUnknown_846DD18:: @ 4bpp.lz
.incbin "graphics/link_games/unk_846DD18.4bpp.lz"
gUnknown_846DE48:: @ 4bpp.lz
.incbin "graphics/link_games/unk_846DE48.4bpp.lz"
gUnknown_846DF44:: @ 4bpp.lz
.incbin "graphics/link_games/unk_846DF44.4bpp.lz"
gUnknown_846E0B0:: @ 846E0B0
obj_tiles gUnknown_846DA24, 0x0600, 5
obj_tiles gUnknown_846DB44, 0x0c00, 6
obj_tiles gUnknown_846DD18, 0x0600, 7
obj_tiles gUnknown_846DE48, 0x0600, 8
obj_tiles gUnknown_846DF44, 0x0200, 10
gUnknown_846E0D8:: @ 846E0D8
obj_pal gUnknown_846D9E4, 5
obj_pal gUnknown_846DA04, 6
gUnknown_846E0E8:: @ 846E0E8
spr_template 0, 0, gUnknown_846E170, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
gUnknown_846E100:: @ 846E100
.2byte 0x0060, 0x0060, 0x0060, 0x0072, 0x0078, 0x0078, 0x0078, 0x0072, 0x0060, 0x0060, 0x0046, 0x0050, 0x0060, 0x0072, 0x0078, 0x0080
.2byte 0x0078, 0x0072, 0x0060, 0x0050, 0x0032, 0x0048, 0x0060, 0x0072, 0x0080, 0x0088, 0x0080, 0x0072, 0x0060, 0x0048, 0x002a, 0x0048
.2byte 0x0060, 0x0072, 0x0080, 0x0088, 0x0080, 0x0072, 0x0060, 0x0048
gUnknown_846E150:: @ 846E150
.2byte 0x0010, 0x0028, 0x0048, 0x0068, 0x0088, 0x00a8, 0x00c8, 0x00e0
gUnknown_846E160:: @ 846E160
.4byte gUnknown_846E220
.4byte gUnknown_846E238
.4byte gUnknown_846E250
.4byte gUnknown_846E268
gUnknown_846E170::
.4byte 0xc0000000, 0x00000800
gUnknown_846E178::
.4byte 0x80008000, 0x00000800
gUnknown_846E180::
.4byte 0x80000000, 0x00000800
gUnknown_846E188::
.4byte 0x80004000, 0x00000800
gUnknown_846E190::
obj_image_anim_frame 0x0000, 1
obj_image_anim_end
gUnknown_846E198::
obj_image_anim_frame 0x0008, 1
obj_image_anim_end
gUnknown_846E1A0::
obj_image_anim_frame 0x0010, 1
obj_image_anim_end
gUnknown_846E1A8::
obj_image_anim_frame 0x0018, 1
obj_image_anim_end
gUnknown_846E1B0::
obj_image_anim_frame 0x0020, 1
obj_image_anim_end
gUnknown_846E1B8::
obj_image_anim_frame 0x0028, 1
obj_image_anim_end
gUnknown_846E1C0::
obj_image_anim_frame 0x0000, 1
obj_image_anim_end
gUnknown_846E1C8::
obj_image_anim_frame 0x0010, 1
obj_image_anim_end
gUnknown_846E1D0::
obj_image_anim_frame 0x0020, 1
obj_image_anim_end
gUnknown_846E1D8::
obj_image_anim_frame 0x0030, 1
obj_image_anim_end
gUnknown_846E1E0::
obj_image_anim_frame 0x0040, 1
obj_image_anim_end
gUnknown_846E1E8::
obj_image_anim_frame 0x0050, 1
obj_image_anim_end
gUnknown_846E1F0::
.4byte gUnknown_846E190
.4byte gUnknown_846E198
.4byte gUnknown_846E1A0
.4byte gUnknown_846E1A8
.4byte gUnknown_846E1B0
.4byte gUnknown_846E1B8
gUnknown_846E208::
.4byte gUnknown_846E1C0
.4byte gUnknown_846E1C8
.4byte gUnknown_846E1D0
.4byte gUnknown_846E1D8
.4byte gUnknown_846E1E0
.4byte gUnknown_846E1E8
gUnknown_846E220::
spr_template 5, 5, gUnknown_846E178, gUnknown_846E1F0, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
gUnknown_846E238::
spr_template 6, 5, gUnknown_846E180, gUnknown_846E208, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
gUnknown_846E250::
spr_template 7, 5, gUnknown_846E188, gUnknown_846E1F0, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
gUnknown_846E268::
spr_template 8, 5, gUnknown_846E188, gUnknown_846E1F0, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
gUnknown_846E280::
.4byte 0x40000000, 0x00000400
gUnknown_846E288::
obj_image_anim_frame 0x0000, 0
obj_image_anim_end
gUnknown_846E290::
obj_image_anim_frame 0x0000, 4
obj_image_anim_frame 0x0004, 4
obj_image_anim_frame 0x0008, 4
obj_image_anim_frame 0x000c, 4
obj_image_anim_loop 1
obj_image_anim_frame 0x0000, 4
obj_image_anim_end
gUnknown_846E2AC::
.4byte gUnknown_846E288
.4byte gUnknown_846E290
gUnknown_846E2B4:: @ 846E2B4
spr_template 10, 5, gUnknown_846E280, gUnknown_846E2AC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
gUnknown_846E2CC:: @ 846E2CC
.byte 0, 1, 1, 28, 9, 15
.2byte 0x0001
gUnknown_846E2D4:: @ 846E2D4
.4byte gUnknown_841CB78
.4byte gUnknown_841CB88
.4byte gUnknown_841CB94
+4 -4
View File
@@ -3295,16 +3295,16 @@ gText_SpacePoints2:: @ 841CB52
gText_SpaceTimes3:: @ 841CB5A
.string " time(s)$"
gUnknown_841CB63:: @ 841CB63
gText_PkmnJumpRecords:: @ 841CB63
.string "POKéMON JUMP RECORDS$"
gUnknown_841CB78::
gText_JumpsInARow::
.string "Jumps in a row:$"
gUnknown_841CB88::
gText_BestScore2::
.string "Best score:$"
gUnknown_841CB94::
gText_ExcellentsInARow::
.string "EXCELLENTS in a row:$"
gText_AwesomeWonF701F700:: @ 841CBA9

Before

Width:  |  Height:  |  Size: 284 B

After

Width:  |  Height:  |  Size: 284 B

Before

Width:  |  Height:  |  Size: 322 B

After

Width:  |  Height:  |  Size: 322 B

Before

Width:  |  Height:  |  Size: 338 B

After

Width:  |  Height:  |  Size: 338 B

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 256 B

Before

Width:  |  Height:  |  Size: 335 B

After

Width:  |  Height:  |  Size: 335 B

+1 -2
View File
@@ -148,8 +148,7 @@ struct PokemonJumpResults // possibly used in the game itself?
u16 field2;
u16 excellentsInRow;
u16 field6;
u16 field8;
u16 fieldA;
u32 field8;
u32 bestJumpScore;
};
+7
View File
@@ -0,0 +1,7 @@
#ifndef GUARD_MINIGAME_COUNTDOWN_H
#define GUARD_MINIGAME_COUNTDOWN_H
void StartMinigameCountdown(u16 tilesTag, u16 palTag, s16 x, s16 y, u8 subpriority);
bool32 IsMinigameCountdownRunning(void);
#endif //GUARD_MINIGAME_COUNTDOWN_H
+4 -25
View File
@@ -179,33 +179,12 @@ void sub_814B348(struct PokemonJump2 *, int);
void sub_814AF0C(struct PokemonJump2 *, int);
void sub_814ADCC(struct PokemonJump2 *, struct PokemonJump1_MonInfo *,s16, s16, u8);
void sub_814B240(struct PokemonJump2 *,s16, s16, u8);
void sub_814AFE8(struct PokemonJump2 *, u8 multiplayerId);
void sub_814B080(struct PokemonJump2 *, u8 multiplayerId);
int sub_814B010(struct PokemonJump2 *, int multiplayerId);
void sub_814AFE8(struct PokemonJump2 *, int multiplayerId);
void sub_814B080(struct PokemonJump2 *, int multiplayerId);
bool32 sub_814B010(struct PokemonJump2 *, int multiplayerId);
void sub_814B0A8(struct PokemonJump2 *);
void sub_814B134(struct PokemonJump2 *);
void sub_814B168(struct PokemonJump2 *, int multiplayerId);
int sub_814B190(struct PokemonJump2 *);
bool32 sub_802EC98(u8 spriteId);
bool32 sub_802EE30(u8 spriteId);
u8 sub_802EFA8(u16 tileTag, u16 palTag, s16 x, s16 y, u8 subpriority);
void Task_ShowPokemonJumpRecords(u8 taskId);
void TruncateToFirstWordOnly(u8 *str);
void sub_802CB7C(struct Sprite *sprite);
void sub_802CC40(struct Sprite *sprite);
void sub_802CD08(struct Sprite *sprite);
void sub_802CDD4(struct Sprite *sprite);
void sub_802E500(u16 windowId, int width);
void sub_802E6D0(u8 taskId);
void sub_802E83C(u8 taskId);
void sub_802E8C8(u8 taskId);
void sub_802EA50(u8 taskId);
void sub_802EAB0(u8 taskId);
void sub_802EB98(u8 taskId);
void sub_802EDCC(u8 spriteId1, u8 spriteId2, u8 spriteId3);
void sub_802EE5C(struct Sprite *sprite);
void sub_802EF50(u16 tileTag, u16 palTag);
void sub_802EFFC(u16 tileTag, u16 palTag, s16 x, s16 y, u8 subpriority, s16 *spriteId1, s16 *spriteId2);
bool32 sub_814B190(struct PokemonJump2 *);
#endif // GUARD_POKEMON_JUMP_H
+4
View File
@@ -1136,5 +1136,9 @@ extern const u8 gText_FilledStorageSpace2[];
extern const u8 gText_CantHoldMore[];
extern const u8 gText_SpacePoints2[];
extern const u8 gText_SpaceTimes3[];
extern const u8 gText_JumpsInARow[];
extern const u8 gText_BestScore2[];
extern const u8 gText_ExcellentsInARow[];
extern const u8 gText_PkmnJumpRecords[];
#endif //GUARD_STRINGS_H
+4 -2
View File
@@ -278,7 +278,8 @@ SECTIONS {
src/pokemon_jump_2.o(.text);
src/pokemon_jump_3.o(.text);
src/pokemon_jump_4.o(.text);
asm/pokemon_jump_2.o(.text);
src/pokemon_jump_5.o(.text);
src/pokemon_jump_6.o(.text);
asm/berry_crush.o(.text);
asm/berry_crush_2.o(.text);
asm/berry_crush_3.o(.text);
@@ -571,7 +572,8 @@ SECTIONS {
src/pokemon_jump.o(.rodata);
src/pokemon_jump_2.o(.rodata);
src/pokemon_jump_4.o(.rodata);
data/pokemon_jump.o(.rodata);
src/pokemon_jump_5.o(.rodata);
src/pokemon_jump_6.o(.rodata);
data/berry_crush.o(.rodata);
src/wireless_communication_status_screen.o(.rodata);
src/braille_text.o(.rodata);
+1 -1
View File
@@ -34,7 +34,7 @@ void StartMinigameCountdown(u16 tilesTag, u16 palTag, s16 x, s16 y, u8 subpriori
gTasks[taskId].tSubpriority = subpriority;
}
bool8 IsMinigameCountdownRunning(void)
bool32 IsMinigameCountdownRunning(void)
{
return FuncIsActiveTask(Task_MinigameCountdown);
}
+2 -2
View File
@@ -165,7 +165,7 @@ void sub_8149D40(int arg0)
{
int i;
for (i = 0; i < ARRAY_COUNT(gUnknown_846D8FC); i++)
for (i = 0; i < NELEMS(gUnknown_846D8FC); i++)
{
if (gUnknown_846D8FC[i].id == arg0)
sub_8149D80(gUnknown_846D8FC[i].func);
@@ -200,7 +200,7 @@ static void sub_8149DC8(void)
{
case 0:
ResetBgsAndClearDma3BusyFlags(FALSE);
InitBgsFromTemplates(0, gUnknown_846D8D4, ARRAY_COUNT(gUnknown_846D8D4));
InitBgsFromTemplates(0, gUnknown_846D8D4, NELEMS(gUnknown_846D8D4));
InitWindows(gUnknown_846D8E4);
ResetBgPositions();
ResetTempTileDataBuffers();
+637
View File
@@ -0,0 +1,637 @@
#include "global.h"
#include "gflib.h"
#include "decompress.h"
#include "minigame_countdown.h"
#include "pokemon_jump.h"
#include "data.h"
#include "trig.h"
#include "constants/songs.h"
static void sub_814AF74(struct Sprite *sprite);
static void sub_814B038(struct Sprite *sprite);
static void sub_814B100(struct Sprite *sprite);
static void sub_814B1CC(struct Sprite *sprite);
static const u16 gPkmnJumpPal1[] = INCBIN_U16("graphics/link_games/pkmnjump_pal1.gbapal");
static const u16 gPkmnJumpPal2[] = INCBIN_U16("graphics/link_games/pkmnjump_pal2.gbapal");
static const u32 gPkmnJumpRopeGfx1[] = INCBIN_U32("graphics/link_games/pkmnjump_rope1.4bpp.lz");
static const u32 gPkmnJumpRopeGfx2[] = INCBIN_U32("graphics/link_games/pkmnjump_rope2.4bpp.lz");
static const u32 gPkmnJumpRopeGfx3[] = INCBIN_U32("graphics/link_games/pkmnjump_rope3.4bpp.lz");
static const u32 gPkmnJumpRopeGfx4[] = INCBIN_U32("graphics/link_games/pkmnjump_rope4.4bpp.lz");
static const u32 gPkmnJumpStarGfx[] = INCBIN_U32("graphics/link_games/pkmnjump_star.4bpp.lz");
static const struct CompressedSpriteSheet gUnknown_846E0B0[] =
{
{gPkmnJumpRopeGfx1, 0x600, 5},
{gPkmnJumpRopeGfx2, 0x0c00, 6},
{gPkmnJumpRopeGfx3, 0x0600, 7},
{gPkmnJumpRopeGfx4, 0x0600, 8},
{gPkmnJumpStarGfx, 0x0200, 10},
};
static const struct SpritePalette gUnknown_846E0D8[] =
{
{gPkmnJumpPal1, 5},
{gPkmnJumpPal2, 6},
};
// Forward declarations.
static const struct OamData gUnknown_846E170;
static const struct SpriteTemplate gUnknown_846E220;
static const struct SpriteTemplate gUnknown_846E238;
static const struct SpriteTemplate gUnknown_846E250;
static const struct SpriteTemplate gUnknown_846E268;
static const struct SpriteTemplate gUnknown_846E0E8 =
{
.tileTag = 0,
.paletteTag = 0,
.oam = &gUnknown_846E170,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
static const s16 gUnknown_846E100[][10] =
{
{0x60, 0x60, 0x60, 0x72, 0x78, 0x78, 0x78, 0x72, 0x60, 0x60},
{0x46, 0x50, 0x60, 0x72, 0x78, 0x80, 0x78, 0x72, 0x60, 0x50},
{0x32, 0x48, 0x60, 0x72, 0x80, 0x88, 0x80, 0x72, 0x60, 0x48},
{0x2a, 0x48, 0x60, 0x72, 0x80, 0x88, 0x80, 0x72, 0x60, 0x48},
};
static const s16 gUnknown_846E150[] = {0x10, 0x28, 0x48, 0x68, 0x88, 0xa8, 0xc8, 0xe0};
static const struct SpriteTemplate *const gUnknown_846E160[] =
{
&gUnknown_846E220,
&gUnknown_846E238,
&gUnknown_846E250,
&gUnknown_846E268,
};
static const struct OamData gUnknown_846E170 =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(64x64),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(64x64),
.tileNum = 0,
.priority = 2,
.paletteNum = 0,
.affineParam = 0
};
static const struct OamData gUnknown_846E178 =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(16x32),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(16x32),
.tileNum = 0,
.priority = 2,
.paletteNum = 0,
.affineParam = 0
};
static const struct OamData gUnknown_846E180 =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(32x32),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(32x32),
.tileNum = 0,
.priority = 2,
.paletteNum = 0,
.affineParam = 0
};
static const struct OamData gUnknown_846E188 =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(32x16),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(32x16),
.tileNum = 0,
.priority = 2,
.paletteNum = 0,
.affineParam = 0
};
static const union AnimCmd sSpriteAnim_82FBEE8[] =
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_82FBEF0[] =
{
ANIMCMD_FRAME(8, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_82FBEF8[] =
{
ANIMCMD_FRAME(16, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_82FBF00[] =
{
ANIMCMD_FRAME(24, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_82FBF08[] =
{
ANIMCMD_FRAME(32, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_82FBF10[] =
{
ANIMCMD_FRAME(40, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_82FBF18[] =
{
ANIMCMD_FRAME(0, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_82FBF20[] =
{
ANIMCMD_FRAME(16, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_82FBF28[] =
{
ANIMCMD_FRAME(32, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_82FBF30[] =
{
ANIMCMD_FRAME(48, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_82FBF38[] =
{
ANIMCMD_FRAME(64, 1),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_82FBF40[] =
{
ANIMCMD_FRAME(80, 1),
ANIMCMD_END
};
static const union AnimCmd *const sSpriteAnimTable_82FBF48[] =
{
sSpriteAnim_82FBEE8,
sSpriteAnim_82FBEF0,
sSpriteAnim_82FBEF8,
sSpriteAnim_82FBF00,
sSpriteAnim_82FBF08,
sSpriteAnim_82FBF10
};
static const union AnimCmd *const sSpriteAnimTable_82FBF60[] =
{
sSpriteAnim_82FBF18,
sSpriteAnim_82FBF20,
sSpriteAnim_82FBF28,
sSpriteAnim_82FBF30,
sSpriteAnim_82FBF38,
sSpriteAnim_82FBF40
};
static const struct SpriteTemplate gUnknown_846E220 =
{
.tileTag = 5,
.paletteTag = 5,
.oam = &gUnknown_846E178,
.anims = sSpriteAnimTable_82FBF48,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
static const struct SpriteTemplate gUnknown_846E238 =
{
.tileTag = 6,
.paletteTag = 5,
.oam = &gUnknown_846E180,
.anims = sSpriteAnimTable_82FBF60,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
static const struct SpriteTemplate gUnknown_846E250 =
{
.tileTag = 7,
.paletteTag = 5,
.oam = &gUnknown_846E188,
.anims = sSpriteAnimTable_82FBF48,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
static const struct SpriteTemplate gUnknown_846E268 =
{
.tileTag = 8,
.paletteTag = 5,
.oam = &gUnknown_846E188,
.anims = sSpriteAnimTable_82FBF48,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
static const struct OamData sOamData_82FBFD8 =
{
.y = 0,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = 0,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(16x16),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(16x16),
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0
};
static const union AnimCmd sSpriteAnim_82FBFE0[] =
{
ANIMCMD_FRAME(0, 0),
ANIMCMD_END
};
static const union AnimCmd sSpriteAnim_82FBFE8[] =
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(4, 4),
ANIMCMD_FRAME(8, 4),
ANIMCMD_FRAME(12, 4),
ANIMCMD_LOOP(1),
ANIMCMD_FRAME(0, 4),
ANIMCMD_END
};
static const union AnimCmd *const sSpriteAnimTable_82FC004[] =
{
sSpriteAnim_82FBFE0,
sSpriteAnim_82FBFE8
};
static const struct SpriteTemplate gUnknown_846E2B4 =
{
.tileTag = 10,
.paletteTag = 5,
.oam = &sOamData_82FBFD8,
.anims = sSpriteAnimTable_82FC004,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
void sub_814AD6C(struct PokemonJump2 *arg0)
{
int i;
for (i = 0; i < NELEMS(gUnknown_846E0B0); i++)
LoadCompressedSpriteSheet(&gUnknown_846E0B0[i]);
for (i = 0; i < NELEMS(gUnknown_846E0D8); i++)
LoadSpritePalette(&gUnknown_846E0D8[i]);
arg0->unkE = IndexOfSpritePaletteTag(5);
arg0->unkF = IndexOfSpritePaletteTag(6);
}
static void sub_814ADB4(struct Sprite *sprite)
{
int i;
for (i = 0; i < 8; i++)
sprite->data[i] = 0;
}
void sub_814ADCC(struct PokemonJump2 *arg0, struct PokemonJump1_MonInfo *jumpMon, s16 x, s16 y, u8 multiplayerId)
{
struct SpriteTemplate spriteTemplate;
struct SpriteSheet spriteSheet;
struct CompressedSpritePalette spritePalette;
u8 *buffer;
u8 *unusedBuffer;
u8 subpriority;
u8 spriteId;
spriteTemplate = gUnknown_846E0E8;
buffer = Alloc(0x2000);
unusedBuffer = Alloc(0x800);
if (multiplayerId == sub_81499B4())
subpriority = 3;
else
subpriority = multiplayerId + 4;
if (buffer && unusedBuffer)
{
HandleLoadSpecialPokePic(
&gMonFrontPicTable[jumpMon->species],
buffer,
jumpMon->species,
jumpMon->personality);
spriteSheet.data = buffer;
spriteSheet.tag = multiplayerId;
spriteSheet.size = 0x800;
LoadSpriteSheet(&spriteSheet);
spritePalette.data = GetMonSpritePalFromSpeciesAndPersonality(jumpMon->species, jumpMon->otId, jumpMon->personality);
spritePalette.tag = multiplayerId;
LoadCompressedSpritePalette(&spritePalette);
Free(buffer);
Free(unusedBuffer);
spriteTemplate.tileTag += multiplayerId;
spriteTemplate.paletteTag += multiplayerId;
spriteId = CreateSprite(&spriteTemplate, x, y, subpriority);
if (spriteId != MAX_SPRITES)
{
arg0->unk81A8[multiplayerId] = &gSprites[spriteId];
arg0->unk81FC[multiplayerId] = subpriority;
return;
}
}
arg0->unk81A8[multiplayerId] = NULL;
}
void sub_814AF0C(struct PokemonJump2 *arg0, int multiplayerId)
{
sub_814ADB4(arg0->unk81BC[multiplayerId]);
arg0->unk81BC[multiplayerId]->data[7] = arg0->unk81A8[multiplayerId] - gSprites;
arg0->unk81BC[multiplayerId]->invisible = 0;
arg0->unk81BC[multiplayerId]->pos1.y = 96;
arg0->unk81BC[multiplayerId]->callback = sub_814AF74;
StartSpriteAnim(arg0->unk81BC[multiplayerId], 1);
}
static void sub_814AF74(struct Sprite *sprite)
{
switch (sprite->data[0])
{
case 0:
if (sprite->animEnded)
{
sprite->invisible = 1;
sprite->callback = SpriteCallbackDummy;
}
break;
case 1:
sprite->pos1.y--;
sprite->data[1]++;
if (sprite->pos1.y <= 72)
{
sprite->pos1.y = 72;
sprite->data[0]++;
}
break;
case 2:
if (++sprite->data[1] >= 48)
{
sprite->invisible = 1;
sprite->callback = SpriteCallbackDummy;
}
break;
}
}
void sub_814AFE8(struct PokemonJump2 *arg0, int multiplayerId)
{
arg0->unk81A8[multiplayerId]->callback = sub_814B038;
arg0->unk81A8[multiplayerId]->pos2.y = 0;
sub_814ADB4(arg0->unk81A8[multiplayerId]);
}
bool32 sub_814B010(struct PokemonJump2 *arg0, int multiplayerId)
{
return arg0->unk81A8[multiplayerId]->callback == sub_814B038;
}
static void sub_814B038(struct Sprite *sprite)
{
if (++sprite->data[1] > 1)
{
if (++sprite->data[2] & 1)
sprite->pos2.y = 2;
else
sprite->pos2.y = -2;
sprite->data[1] = 0;
}
if (sprite->data[2] > 12)
{
sprite->pos2.y = 0;
sprite->callback = SpriteCallbackDummy;
}
}
void sub_814B080(struct PokemonJump2 *arg0, int multiplayerId)
{
sub_814ADB4(arg0->unk81A8[multiplayerId]);
arg0->unk81A8[multiplayerId]->callback = sub_814B100;
}
void sub_814B0A8(struct PokemonJump2 *arg0)
{
int i;
u16 numPlayers = sub_81499A4();
for (i = 0; i < numPlayers; i++)
{
if (arg0->unk81A8[i]->callback == sub_814B100)
{
arg0->unk81A8[i]->invisible = 0;
arg0->unk81A8[i]->callback = SpriteCallbackDummy;
arg0->unk81A8[i]->subpriority = 10;
}
}
}
static void sub_814B100(struct Sprite *sprite)
{
if (++sprite->data[0] > 3)
{
sprite->data[0] = 0;
sprite->invisible ^= 1;
}
}
void sub_814B134(struct PokemonJump2 *arg0)
{
int i;
u16 numPlayers = sub_81499A4();
for (i = 0; i < numPlayers; i++)
arg0->unk81A8[i]->subpriority = arg0->unk81FC[i];
}
void sub_814B168(struct PokemonJump2 *arg0, int multiplayerId)
{
sub_814ADB4(arg0->unk81A8[multiplayerId]);
arg0->unk81A8[multiplayerId]->callback = sub_814B1CC;
}
bool32 sub_814B190(struct PokemonJump2 *arg0)
{
int i;
u16 numPlayers = sub_81499A4();
for (i = 0; i < numPlayers; i++)
{
if (arg0->unk81A8[i]->callback == sub_814B1CC)
return TRUE;
}
return FALSE;
}
static void sub_814B1CC(struct Sprite *sprite)
{
switch (sprite->data[0])
{
case 0:
PlaySE(SE_JITE_PYOKO);
sprite->data[1] = 0;
sprite->data[0]++;
// fall through
case 1:
sprite->data[1] += 4;
if (sprite->data[1] > 0x7F)
sprite->data[1] = 0;
sprite->pos2.y = -(gSineTable[sprite->data[1]] >> 3);
if (sprite->data[1] == 0)
{
if (++sprite->data[2] < 2)
sprite->data[0] = 0;
else
sprite->callback = SpriteCallbackDummy;
}
break;
}
}
void sub_814B240(struct PokemonJump2 *arg0, s16 x, s16 y, u8 multiplayerId)
{
u8 spriteId = CreateSprite(&gUnknown_846E2B4, x, y, 1);
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].invisible = 1;
arg0->unk81BC[multiplayerId] = &gSprites[spriteId];
}
}
void sub_814B294(struct PokemonJump2 *arg0)
{
int i;
int count;
u8 spriteId;
count = 0;
for (i = 0; i < 4; i++)
{
spriteId = CreateSprite(gUnknown_846E160[i], gUnknown_846E150[count], gUnknown_846E100[i][0], 2);
arg0->unk81D0[count] = &gSprites[spriteId];
count++;
}
for (i = 3; i >= 0; i--)
{
spriteId = CreateSprite(gUnknown_846E160[i], gUnknown_846E150[count], gUnknown_846E100[i][0], 2);
arg0->unk81D0[count] = &gSprites[spriteId];
arg0->unk81D0[count]->hFlip = 1;
count++;
}
}
void sub_814B348(struct PokemonJump2 *arg0, int arg1)
{
int i, count, palNum;
int priority;
if (arg1 > 5)
{
arg1 = 10 - arg1;
priority = 3;
palNum = arg0->unkF;
}
else
{
priority = 2;
palNum = arg0->unkE;
}
count = 0;
for (i = 0; i < 4; i++)
{
arg0->unk81D0[count]->pos1.y = gUnknown_846E100[i][arg1];
arg0->unk81D0[count]->oam.priority = priority;
arg0->unk81D0[count]->oam.paletteNum = palNum;
StartSpriteAnim(arg0->unk81D0[count], arg1);
count++;
}
for (i = 3; i >= 0; i--)
{
arg0->unk81D0[count]->pos1.y = gUnknown_846E100[i][arg1];
arg0->unk81D0[count]->oam.priority = priority;
arg0->unk81D0[count]->oam.paletteNum = palNum;
StartSpriteAnim(arg0->unk81D0[count], arg1);
count++;
}
}
void sub_814B43C(struct PokemonJump2 *arg0)
{
StartMinigameCountdown(9, 7, 120, 80, 0);
sub_814B134(arg0);
}
bool32 sub_814B460(void)
{
return IsMinigameCountdownRunning();
}
+141
View File
@@ -0,0 +1,141 @@
#include "global.h"
#include "gflib.h"
#include "menu.h"
#include "pokemon_jump.h"
#include "script.h"
#include "strings.h"
#include "task.h"
#include "text_window.h"
static void Task_ShowPokemonJumpRecords(u8 taskId);
static void TruncateToFirstWordOnly(u8 *str);
static void sub_814B5C4(u16 windowId);
static struct PokemonJumpResults *sub_814B46C(void)
{
return &gSaveBlock2Ptr->pokeJump;
}
void ResetPokeJumpResults(void)
{
struct PokemonJumpResults *pokeJump = sub_814B46C();
pokeJump->jumpsInRow = 0;
pokeJump->bestJumpScore = 0;
pokeJump->excellentsInRow = 0;
pokeJump->field6 = 0;
pokeJump->field8 = 0;
pokeJump->field2 = 0;
}
bool32 sub_814B494(u32 jumpScore, u16 jumpsInRow, u16 excellentsInRow)
{
struct PokemonJumpResults *pokeJump = sub_814B46C();
bool32 ret = FALSE;
if (pokeJump->bestJumpScore < jumpScore && jumpScore <= 99990)
pokeJump->bestJumpScore = jumpScore, ret = TRUE;
if (pokeJump->jumpsInRow < jumpsInRow && jumpsInRow <= 9999)
pokeJump->jumpsInRow = jumpsInRow, ret = TRUE;
if (pokeJump->excellentsInRow < excellentsInRow && excellentsInRow <= 9999)
pokeJump->excellentsInRow = excellentsInRow, ret = TRUE;
return ret;
}
void sub_814B4E8(void)
{
struct PokemonJumpResults *pokeJump = sub_814B46C();
if (pokeJump->field6 < 9999)
pokeJump->field6++;
}
void ShowPokemonJumpRecords(void)
{
u8 taskId = CreateTask(Task_ShowPokemonJumpRecords, 0);
Task_ShowPokemonJumpRecords(taskId);
}
static const struct WindowTemplate gUnknown_846E2CC =
{
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 1,
.width = 28,
.height = 9,
.paletteNum = 15,
.baseBlock = 0x1,
};
static const u8 *const gUnknown_846E2D4[] = {gText_JumpsInARow, gText_BestScore2, gText_ExcellentsInARow};
static void Task_ShowPokemonJumpRecords(u8 taskId)
{
s16 *data = gTasks[taskId].data;
switch (data[0])
{
case 0:
data[1] = AddWindow(&gUnknown_846E2CC);
sub_814B5C4(data[1]);
CopyWindowToVram(data[1], 3);
data[0]++;
break;
case 1:
if (!IsDma3ManagerBusyWithBgCopy())
data[0]++;
break;
case 2:
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
rbox_fill_rectangle(data[1]);
CopyWindowToVram(data[1], 1);
data[0]++;
}
break;
case 3:
if (!IsDma3ManagerBusyWithBgCopy())
{
RemoveWindow(data[1]);
DestroyTask(taskId);
EnableBothScriptContexts();
}
break;
}
}
static void sub_814B5C4(u16 windowId)
{
int i, x;
int results[3];
struct PokemonJumpResults *pokeJump = sub_814B46C();
u8 strbuf[8];
results[0] = pokeJump->jumpsInRow;
results[1] = pokeJump->bestJumpScore;
results[2] = pokeJump->excellentsInRow;
TextWindow_SetStdFrame0_WithPal(windowId, 0x21D, 0xD0);
DrawTextBorderOuter(windowId, 0x21D, 0xD);
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
AddTextPrinterParameterized5(windowId, 2, gText_PkmnJumpRecords, 0, 0, TEXT_SPEED_FF, NULL, 1, 0);
for (i = 0; i < NELEMS(gUnknown_846E2D4); i++)
{
AddTextPrinterParameterized5(windowId, 2, gUnknown_846E2D4[i], 0, 20 + (i * 14), TEXT_SPEED_FF, NULL, 1, 0);
ConvertIntToDecimalStringN(strbuf, results[i], STR_CONV_MODE_LEFT_ALIGN, 5);
TruncateToFirstWordOnly(strbuf);
x = 0xDE - GetStringWidth(2, strbuf, 0);
AddTextPrinterParameterized5(windowId, 2, strbuf, x, 20 + (i * 14), TEXT_SPEED_FF, NULL, 0, 0);
}
PutWindowTilemap(windowId);
}
static void TruncateToFirstWordOnly(u8 *str)
{
for (;*str != EOS; str++)
{
if (*str == CHAR_SPACE)
{
*str = EOS;
break;
}
}
}