move more pokeblock data to C and label

This commit is contained in:
DizzyEggg 2017-12-10 16:38:27 +01:00
parent fb30acbc30
commit 37ae6a7758
23 changed files with 527 additions and 90 deletions

View File

@ -887,7 +887,67 @@ gMenuPokeblock_Pal:: @ 8D9B470
.incbin "baserom.gba", 0xd9b470, 0x358
gMenuPokeblockDevice_Gfx:: @ 8D9B7C8
.incbin "baserom.gba", 0xd9b7c8, 0x27c
.incbin "baserom.gba", 0xd9b7c8, 0x148
.align 2
gPokeblock_Gfx::
.incbin "graphics/pokeblock/pokeblock.4bpp.lz"
.align 2
gPokeblockRed_Pal::
.incbin "graphics/pokeblock/red.gbapal.lz"
.align 2
gPokeblockBlue_Pal::
.incbin "graphics/pokeblock/blue.gbapal.lz"
.align 2
gPokeblockPink_Pal::
.incbin "graphics/pokeblock/pink.gbapal.lz"
.align 2
gPokeblockGreen_Pal::
.incbin "graphics/pokeblock/green.gbapal.lz"
.align 2
gPokeblockYellow_Pal::
.incbin "graphics/pokeblock/yellow.gbapal.lz"
.align 2
gPokeblockPurple_Pal::
.incbin "graphics/pokeblock/purple.gbapal.lz"
.align 2
gPokeblockIndigo_Pal::
.incbin "graphics/pokeblock/indigo.gbapal.lz"
.align 2
gPokeblockBrown_Pal::
.incbin "graphics/pokeblock/brown.gbapal.lz"
.align 2
gPokeblockLiteBlue_Pal::
.incbin "graphics/pokeblock/liteblue.gbapal.lz"
.align 2
gPokeblockOlive_Pal::
.incbin "graphics/pokeblock/olive.gbapal.lz"
.align 2
gPokeblockGray_Pal::
.incbin "graphics/pokeblock/gray.gbapal.lz"
.align 2
gPokeblockBlack_Pal::
.incbin "graphics/pokeblock/black.gbapal.lz"
.align 2
gPokeblockWhite_Pal::
.incbin "graphics/pokeblock/white.gbapal.lz"
.align 2
gPokeblockGold_Pal::
.incbin "graphics/pokeblock/gold.gbapal.lz"
gUnknown_08D9BA44:: @ 8D9BA44
.incbin "baserom.gba", 0xd9ba44, 0x100

View File

@ -1,27 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
sPokeblocksPals:: @ 85F0568
.incbin "baserom.gba", 0x5f0568, 0x48
sSpriteAffineAnimTable_85F05B0:: @ 85F05B0
.incbin "baserom.gba", 0x5f05b0, 0xb4
sSpriteAffineAnimTable_85F0664:: @ 85F0664
.incbin "baserom.gba", 0x5f0664, 0x4
sSpriteAffineAnimTable_85F0668:: @ 85F0668
.incbin "baserom.gba", 0x5f0668, 0x4
sSpriteAffineAnimTable_85F066C:: @ 85F066C
.incbin "baserom.gba", 0x5f066c, 0x34
gPokeblock_SpriteSheet:: @ 85F06A0
.incbin "baserom.gba", 0x5f06a0, 0x8
sThrownPokeblockSpriteTemplate:: @ 85F06A8
.incbin "baserom.gba", 0x5f06a8, 0x18

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
213 131 74
41 41 41
98 98 98
148 148 148
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
0 0 0
0 0 0

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
106 106 189
148 148 255
180 180 255
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
0 0 0
0 0 0

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
106 0 0
172 65 65
197 123 123
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
0 0 0
0 0 0

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
222 197 49
246 230 164
255 238 197
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
0 0 0
0 0 0

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
148 148 148
189 189 189
205 205 205
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
0 0 0
0 0 0

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
0 106 0
49 164 49
90 230 90
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
0 0 0
0 0 0

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
139 205 74
0 0 106
65 65 172
123 123 255
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
0 0 0
0 0 0

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
106 139 189
148 213 255
180 238 255
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
0 0 0
0 0 0

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
115 180 106
148 246 98
205 255 139
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
0 0 0
0 0 0

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
205 90 172
255 156 197
255 197 213
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
0 0 0
0 0 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
164 0 164
197 41 197
255 131 255
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
0 0 0
0 0 0

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
205 65 24
255 123 90
255 180 148
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
0 0 0
0 0 0

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
222 222 222
238 238 238
255 255 255
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
0 0 0
0 0 0

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
180 180 49
246 230 49
255 255 148
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
0 0 0
0 0 0

View File

@ -1,10 +1,7 @@
//
// Created by scott on 10/21/2017.
//
#ifndef GUARD_GRAPHICS_H
#define GUARD_GRAPHICS_H
// interface pokeballs
extern const u8 gInterfaceGfx_PokeBall[];
extern const u8 gInterfacePal_PokeBall[];
extern const u8 gInterfaceGfx_GreatBall[];
@ -31,6 +28,23 @@ extern const u8 gInterfaceGfx_PremierBall[];
extern const u8 gInterfacePal_PremierBall[];
extern const u8 gOpenPokeballGfx[];
// pokeblock
extern const u8 gPokeblockRed_Pal[];
extern const u8 gPokeblockBlue_Pal[];
extern const u8 gPokeblockPink_Pal[];
extern const u8 gPokeblockGreen_Pal[];
extern const u8 gPokeblockYellow_Pal[];
extern const u8 gPokeblockPurple_Pal[];
extern const u8 gPokeblockIndigo_Pal[];
extern const u8 gPokeblockBrown_Pal[];
extern const u8 gPokeblockLiteBlue_Pal[];
extern const u8 gPokeblockOlive_Pal[];
extern const u8 gPokeblockGray_Pal[];
extern const u8 gPokeblockBlack_Pal[];
extern const u8 gPokeblockWhite_Pal[];
extern const u8 gPokeblockGold_Pal[];
extern const u8 gPokeblock_Gfx[];
extern const u8 gItemIcon_QuestionMark[];
extern const u8 gItemIconPalette_QuestionMark[];
extern const u8 gUnknown_08DB7AA0[];

View File

@ -25,6 +25,9 @@ enum
};
// use pokeblock
extern u8 gPokeblockMonId;
extern s16 gPokeblockGain;
void ChooseMonToGivePokeblock(struct Pokeblock *pokeblock, void (*callback)(void));
// pokeblock feed

View File

@ -451,7 +451,6 @@ SECTIONS {
src/save_failed_screen.o(.rodata);
data/braille_puzzles.o(.rodata);
src/pokeblock_feed.o(.rodata);
data/pokeblock_feed.o(.rodata);
src/clear_save_data_screen.o(.rodata);
data/intro_credits_graphics.o(.rodata);
src/evolution_graphics.o(.rodata);

View File

@ -21,6 +21,7 @@
#include "m4a.h"
#include "sound.h"
#include "trig.h"
#include "graphics.h"
#include "battle.h" // to get rid of once gMonSpritesGfxPtr is put elsewhere
struct PokeblockFeedStruct
@ -45,12 +46,10 @@ struct PokeblockFeedStruct
u8 pokeblockSpriteId;
s16 field_1060[15];
s16 loadGfxState;
u8 somefield[2];
u8 unused;
};
extern u8 gPokeblockMonId;
extern u16 gSpecialVar_ItemId;
extern s16 gPokeblockGain;
extern struct MusicPlayerInfo gMPlay_BGM;
extern struct SpriteTemplate gUnknown_0202499C;
@ -58,16 +57,9 @@ extern const u8 gBattleTerrainPalette_Frontier[];
extern const u8 gBattleTerrainTiles_Building[];
extern const u8 gUnknown_08D9BA44[];
extern const struct CompressedSpriteSheet gPokeblockCase_SpriteSheet;
extern const struct CompressedSpriteSheet gPokeblock_SpriteSheet;
extern const struct CompressedSpritePalette gPokeblockCase_SpritePal;
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
extern const u16 gUnknown_0860F074[];
extern const u8 *sPokeblocksPals[];
extern const union AffineAnimCmd * const sSpriteAffineAnimTable_85F05B0[];
extern const union AffineAnimCmd * const sSpriteAffineAnimTable_85F0664[];
extern const union AffineAnimCmd * const sSpriteAffineAnimTable_85F0668[];
extern const union AffineAnimCmd * const sSpriteAffineAnimTable_85F066C[];
extern const struct SpriteTemplate sThrownPokeblockSpriteTemplate;
extern bool8 sub_81221EC(void);
extern void sub_806A068(u16, u8);
@ -95,6 +87,7 @@ static bool8 LoadMonAndSceneGfx(struct Pokemon *mon);
static u8 CreatePokeblockSprite(void);
static u8 CreatePokeblockCaseSpriteForFeeding(void);
static u8 CreateMonSprite(struct Pokemon *mon);
static void SpriteCB_ThrownPokeblock(struct Sprite* sprite);
// ram variables
EWRAM_DATA static struct PokeblockFeedStruct *sPokeblockFeed = NULL;
@ -399,6 +392,136 @@ static const struct WindowTemplate sWindowTemplates[] =
DUMMY_WIN_TEMPLATE
};
static const u8* const sPokeblocksPals[] =
{
gPokeblockRed_Pal,
gPokeblockBlue_Pal,
gPokeblockPink_Pal,
gPokeblockGreen_Pal,
gPokeblockYellow_Pal,
gPokeblockPurple_Pal,
gPokeblockIndigo_Pal,
gPokeblockBrown_Pal,
gPokeblockLiteBlue_Pal,
gPokeblockOlive_Pal,
gPokeblockGray_Pal,
gPokeblockBlack_Pal,
gPokeblockWhite_Pal,
gPokeblockGold_Pal
};
static const union AffineAnimCmd sSpriteAffineAnim_84120DC[] =
{
AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0),
AFFINEANIMCMD_END
};
static const union AffineAnimCmd *const sSpriteAffineAnimTable_MonNoFlip[] =
{
sSpriteAffineAnim_84120DC
};
static const union AffineAnimCmd sSpriteAffineAnim_84120F0[] =
{
AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0),
AFFINEANIMCMD_FRAME(0x0, 0x0, -8, 1),
AFFINEANIMCMD_FRAME(0x0, 0x0, -8, 1),
AFFINEANIMCMD_FRAME(0x0, 0x0, -8, 1),
AFFINEANIMCMD_FRAME(0x0, 0x0, -8, 1),
AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 8),
AFFINEANIMCMD_FRAME(0x0, 0x0, 16, 1),
AFFINEANIMCMD_FRAME(0x0, 0x0, 16, 1),
AFFINEANIMCMD_FRAME(0x0, 0x0, 16, 1),
AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0),
AFFINEANIMCMD_END
};
static const union AffineAnimCmd sSpriteAffineAnim_8412148[] =
{
AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0),
AFFINEANIMCMD_FRAME(0x0, 0x0, 8, 1),
AFFINEANIMCMD_FRAME(0x0, 0x0, 8, 1),
AFFINEANIMCMD_FRAME(0x0, 0x0, 8, 1),
AFFINEANIMCMD_FRAME(0x0, 0x0, 8, 1),
AFFINEANIMCMD_FRAME(0x0, 0x0, 0, 8),
AFFINEANIMCMD_FRAME(0x0, 0x0, -16, 1),
AFFINEANIMCMD_FRAME(0x0, 0x0, -16, 1),
AFFINEANIMCMD_FRAME(0x0, 0x0, -16, 1),
AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0),
AFFINEANIMCMD_END
};
static const union AffineAnimCmd *const sSpriteAffineAnimTable_85F0664[] =
{
sSpriteAffineAnim_84120DC
};
static const union AffineAnimCmd *const sSpriteAffineAnimTable_85F0668[] =
{
sSpriteAffineAnim_84120F0
};
static const union AffineAnimCmd *const sSpriteAffineAnimTable_85F066C[] =
{
sSpriteAffineAnim_8412148
};
static const struct OamData sThrownPokeblockOamData =
{
.y = 0,
.affineMode = 3,
.objMode = 0,
.mosaic = 0,
.bpp = 0,
.shape = 0,
.x = 0,
.matrixNum = 0,
.size = 0,
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd sThrownPokeblockSpriteAnim[] =
{
ANIMCMD_FRAME(0, 0),
ANIMCMD_END
};
static const union AnimCmd *const sThrownPokeblockAnimTable[] =
{
sThrownPokeblockSpriteAnim,
};
static const union AffineAnimCmd sSpriteAffineAnim_84121C0[] =
{
AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0),
AFFINEANIMCMD_FRAME(-8, -8, 0, 1),
AFFINEANIMCMD_JUMP(1)
};
static const union AffineAnimCmd *const sThrownPokeblockAffineAnimTable[] =
{
sSpriteAffineAnim_84121C0
};
static const struct CompressedSpriteSheet sPokeblock_SpriteSheet =
{
gPokeblock_Gfx, 0x20, TAG_POKEBLOCK_GFX
};
static const struct SpriteTemplate sThrownPokeblockSpriteTemplate =
{
.tileTag = TAG_POKEBLOCK_GFX,
.paletteTag = TAG_POKEBLOCK_GFX,
.oam = &sThrownPokeblockOamData,
.anims = sThrownPokeblockAnimTable,
.images = NULL,
.affineAnims = sThrownPokeblockAffineAnimTable,
.callback = SpriteCB_ThrownPokeblock
};
// code
static void CB2_PokeblockFeed(void)
{
@ -554,7 +677,7 @@ static bool8 LoadMonAndSceneGfx(struct Pokemon *mon)
sPokeblockFeed->loadGfxState++;
break;
case 4:
LoadCompressedObjectPic(&gPokeblock_SpriteSheet);
LoadCompressedObjectPic(&sPokeblock_SpriteSheet);
sPokeblockFeed->loadGfxState++;
break;
case 5:
@ -601,6 +724,8 @@ static void SetPokeblockSpritePal(u8 pokeblockCaseId)
sPokeblockSpritePal.tag = TAG_POKEBLOCK_GFX;
}
// defines for task data fields
#define tFrames data[0]
#define tData1 data[1]
@ -697,6 +822,12 @@ static void Task_PaletteFadeToReturn(u8 taskId)
#undef tFrames
#undef tData1
// defines for mon sprite data fields
#define tDelta data[0]
#define tDeltaMod data[1]
#define tSpecies data[2]
static u8 CreateMonSprite(struct Pokemon* mon)
{
u16 species = GetMonData(mon, MON_DATA_SPECIES2);
@ -705,13 +836,13 @@ static u8 CreateMonSprite(struct Pokemon* mon)
sPokeblockFeed->species = species;
sPokeblockFeed->monSpriteId_ = spriteId;
sPokeblockFeed->nature = GetNature(mon);
gSprites[spriteId].data[2] = species;
gSprites[spriteId].tSpecies = species;
gSprites[spriteId].callback = SpriteCallbackDummy;
sPokeblockFeed->noMonFlip = TRUE;
if (!IsPokeSpriteNotFlipped(species))
{
gSprites[spriteId].affineAnims = sSpriteAffineAnimTable_85F05B0;
gSprites[spriteId].affineAnims = sSpriteAffineAnimTable_MonNoFlip;
gSprites[spriteId].oam.affineMode = 3;
CalcCenterToCornerVec(&gSprites[spriteId], gSprites[spriteId].oam.shape, gSprites[spriteId].oam.size, gSprites[spriteId].oam.affineMode);
sPokeblockFeed->noMonFlip = FALSE;
@ -724,23 +855,27 @@ static void PrepareMonToMoveToPokeblock(u8 spriteId)
{
gSprites[spriteId].pos1.x = 48;
gSprites[spriteId].pos1.y = 80;
gSprites[spriteId].data[0] = -8;
gSprites[spriteId].data[1] = 1;
gSprites[spriteId].tDelta = -8;
gSprites[spriteId].tDeltaMod = 1;
gSprites[spriteId].callback = sub_817A468;
}
static void sub_817A468(struct Sprite* sprite)
{
sprite->pos1.x += 4;
sprite->pos1.y += sprite->data[0];
sprite->data[0] += sprite->data[1];
sprite->pos1.y += sprite->tDelta;
sprite->tDelta += sprite->tDeltaMod;
if (sprite->data[0] == 0)
PlayCry1(sprite->data[2], 0);
if (sprite->data[0] == 9)
if (sprite->tDelta == 0)
PlayCry1(sprite->tSpecies, 0);
if (sprite->tDelta == 9)
sprite->callback = SpriteCallbackDummy;
}
#undef tDelta
#undef tDeltaMod
#undef tSpecies
static u8 CreatePokeblockCaseSpriteForFeeding(void)
{
u8 spriteId = CreatePokeblockCaseSprite(188, 100, 2);
@ -764,23 +899,30 @@ static void DoPokeblockCaseThrowEffect(u8 spriteId, bool8 a1)
InitSpriteAffineAnim(&gSprites[spriteId]);
}
// defines for the pokeblock sprite data fields
#define tDelta data[0]
#define tDeltaMod data[1]
static u8 CreatePokeblockSprite(void)
{
u8 spriteId = CreateSprite(&sThrownPokeblockSpriteTemplate, 174, 84, 1);
gSprites[spriteId].data[0] = -12;
gSprites[spriteId].data[1] = 1;
gSprites[spriteId].tDelta = -12;
gSprites[spriteId].tDeltaMod = 1;
return spriteId;
}
static void SpriteCB_ThrownPokeblock(struct Sprite* sprite)
{
sprite->pos1.x -= 4;
sprite->pos1.y += sprite->data[0];
sprite->data[0] += sprite->data[1];
if (sprite->data[0] == 10)
sprite->pos1.y += sprite->tDelta;
sprite->tDelta += sprite->tDeltaMod;
if (sprite->tDelta == 10)
DestroySprite(sprite);
}
#undef tDelta
#undef tDeltaMod
static void sub_817A5CC(void)
{
u8 animId, i;

View File

@ -37,12 +37,6 @@ struct UsePokeblockStruct
struct UsePokeblockSubStruct info;
};
extern struct UsePokeblockStruct *gUnknown_0203BCAC;
extern struct UsePokeblockSubStruct *gUnknown_0203BC90;
extern struct Pokeblock *gUnknown_0203BC98;
extern void (*gUnknown_0203BC94)(void);
extern u8 gPokeblockMonId;
extern u16 gKeyRepeatStartDelay;
// this file's functions
@ -64,6 +58,17 @@ void sub_8167BA0(u16 arg0, u8 copyToVramMode);
extern const struct BgTemplate gUnknown_085DFCCC[4];
extern const struct WindowTemplate gUnknown_085DFCDC[];
// ram variables
EWRAM_DATA struct UsePokeblockSubStruct *gUnknown_0203BC90 = NULL;
EWRAM_DATA void (*gUnknown_0203BC94)(void) = NULL;
EWRAM_DATA struct Pokeblock *gUnknown_0203BC98 = NULL;
EWRAM_DATA u8 gPokeblockMonId = 0;
EWRAM_DATA s16 gPokeblockGain = 0;
EWRAM_DATA void *gUnknown_0203BCA0 = NULL;
EWRAM_DATA void *gUnknown_0203BCA4 = NULL;
EWRAM_DATA void *gUnknown_0203BCA8 = NULL;
EWRAM_DATA struct UsePokeblockStruct *gUnknown_0203BCAC = NULL;
void ChooseMonToGivePokeblock(struct Pokeblock *pokeblock, void (*callback)(void))
{
gUnknown_0203BCAC = AllocZeroed(0x806C);

View File

@ -1306,32 +1306,7 @@ gUnknown_0203BC88: @ 203BC88
gUnknown_0203BC8C: @ 203BC8C
.space 0x4
gUnknown_0203BC90: @ 203BC90
.space 0x4
gUnknown_0203BC94: @ 203BC94
.space 0x4
gUnknown_0203BC98: @ 203BC98
.space 0x4
gPokeblockMonId: @ 203BC9C
.space 0x2
gPokeblockGain: @ 203BC9E
.space 0x2
gUnknown_0203BCA0: @ 203BCA0
.space 0x4
gUnknown_0203BCA4: @ 203BCA4
.space 0x4
gUnknown_0203BCA8: @ 203BCA8
.space 0x4
gUnknown_0203BCAC: @ 203BCAC
.space 0x4
.include "src/use_pokeblock.o"
gUnknown_0203BCB0: @ 203BCB0
.space 0x4