mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Remaining labels in trainer_card
This commit is contained in:
parent
2be0c52c17
commit
0f869fb266
@ -80,7 +80,7 @@ struct TrainerCardData
|
|||||||
u8 cardTiles[0x2300];
|
u8 cardTiles[0x2300];
|
||||||
u16 cardTilemapBuffer[0x1000];
|
u16 cardTilemapBuffer[0x1000];
|
||||||
u16 bgTilemapBuffer[0x1000];
|
u16 bgTilemapBuffer[0x1000];
|
||||||
u16 var_7CA8;
|
u16 cardTop;
|
||||||
u8 language;
|
u8 language;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ static void SetPlayerCardData(struct TrainerCard*, u8);
|
|||||||
static void TrainerCard_GenerateCardForLinkPlayer(struct TrainerCard*);
|
static void TrainerCard_GenerateCardForLinkPlayer(struct TrainerCard*);
|
||||||
static u8 VersionToCardType(u8);
|
static u8 VersionToCardType(u8);
|
||||||
static void SetDataFromTrainerCard(void);
|
static void SetDataFromTrainerCard(void);
|
||||||
static void HandleGpuRegs(void);
|
static void InitGpuRegs(void);
|
||||||
static void ResetGpuRegs(void);
|
static void ResetGpuRegs(void);
|
||||||
static void InitBgsAndWindows(void);
|
static void InitBgsAndWindows(void);
|
||||||
static void SetTrainerCardCb2(void);
|
static void SetTrainerCardCb2(void);
|
||||||
@ -158,31 +158,30 @@ static bool8 Task_DrawFlippedCardSide(struct Task* task);
|
|||||||
static bool8 Task_SetCardFlipped(struct Task* task);
|
static bool8 Task_SetCardFlipped(struct Task* task);
|
||||||
static bool8 Task_AnimateCardFlipUp(struct Task* task);
|
static bool8 Task_AnimateCardFlipUp(struct Task* task);
|
||||||
static bool8 Task_EndCardFlip(struct Task* task);
|
static bool8 Task_EndCardFlip(struct Task* task);
|
||||||
static void sub_80C32EC(u16);
|
static void UpdateCardFlipRegs(u16);
|
||||||
static void LoadMonIconGfx(void);
|
static void LoadMonIconGfx(void);
|
||||||
|
|
||||||
// const rom data
|
static const u32 sTrainerCardStickers_Gfx[] = INCBIN_U32("graphics/trainer_card/stickers_fr.4bpp.lz");
|
||||||
static const u32 sTrainerCardStickers_Gfx[] = INCBIN_U32("graphics/trainer_card/stickers_fr.4bpp.lz");
|
static const u16 sUnused_Pal[] = INCBIN_U16("graphics/trainer_card/unused.gbapal");
|
||||||
static const u16 sUnused_0856F18C[] = INCBIN_U16("graphics/trainer_card/unknown_56F18C.gbapal");
|
static const u16 sHoennTrainerCard1Star_Pal[] = INCBIN_U16("graphics/trainer_card/one_star.gbapal");
|
||||||
static const u16 sHoennTrainerCard1Star_Pal[] = INCBIN_U16("graphics/trainer_card/one_star.gbapal");
|
static const u16 sKantoTrainerCard1Star_Pal[] = INCBIN_U16("graphics/trainer_card/one_star_fr.gbapal");
|
||||||
static const u16 sKantoTrainerCard1Star_Pal[] = INCBIN_U16("graphics/trainer_card/one_star_fr.gbapal");
|
static const u16 sHoennTrainerCard2Star_Pal[] = INCBIN_U16("graphics/trainer_card/two_stars.gbapal");
|
||||||
static const u16 sHoennTrainerCard2Star_Pal[] = INCBIN_U16("graphics/trainer_card/two_stars.gbapal");
|
static const u16 sKantoTrainerCard2Star_Pal[] = INCBIN_U16("graphics/trainer_card/two_stars_fr.gbapal");
|
||||||
static const u16 sKantoTrainerCard2Star_Pal[] = INCBIN_U16("graphics/trainer_card/two_stars_fr.gbapal");
|
static const u16 sHoennTrainerCard3Star_Pal[] = INCBIN_U16("graphics/trainer_card/three_stars.gbapal");
|
||||||
static const u16 sHoennTrainerCard3Star_Pal[] = INCBIN_U16("graphics/trainer_card/three_stars.gbapal");
|
static const u16 sKantoTrainerCard3Star_Pal[] = INCBIN_U16("graphics/trainer_card/three_stars_fr.gbapal");
|
||||||
static const u16 sKantoTrainerCard3Star_Pal[] = INCBIN_U16("graphics/trainer_card/three_stars_fr.gbapal");
|
static const u16 sHoennTrainerCard4Star_Pal[] = INCBIN_U16("graphics/trainer_card/four_stars.gbapal");
|
||||||
static const u16 sHoennTrainerCard4Star_Pal[] = INCBIN_U16("graphics/trainer_card/four_stars.gbapal");
|
static const u16 sKantoTrainerCard4Star_Pal[] = INCBIN_U16("graphics/trainer_card/four_stars_fr.gbapal");
|
||||||
static const u16 sKantoTrainerCard4Star_Pal[] = INCBIN_U16("graphics/trainer_card/four_stars_fr.gbapal");
|
|
||||||
static const u16 sHoennTrainerCardFemaleBg_Pal[] = INCBIN_U16("graphics/trainer_card/female_bg.gbapal");
|
static const u16 sHoennTrainerCardFemaleBg_Pal[] = INCBIN_U16("graphics/trainer_card/female_bg.gbapal");
|
||||||
static const u16 sKantoTrainerCardFemaleBg_Pal[] = INCBIN_U16("graphics/trainer_card/female_bg_fr.gbapal");
|
static const u16 sKantoTrainerCardFemaleBg_Pal[] = INCBIN_U16("graphics/trainer_card/female_bg_fr.gbapal");
|
||||||
static const u16 sHoennTrainerCardBadges_Pal[] = INCBIN_U16("graphics/trainer_card/badges.gbapal");
|
static const u16 sHoennTrainerCardBadges_Pal[] = INCBIN_U16("graphics/trainer_card/badges.gbapal");
|
||||||
static const u16 sKantoTrainerCardBadges_Pal[] = INCBIN_U16("graphics/trainer_card/badges_fr.gbapal");
|
static const u16 sKantoTrainerCardBadges_Pal[] = INCBIN_U16("graphics/trainer_card/badges_fr.gbapal");
|
||||||
static const u16 sTrainerCardGold_Pal[] = INCBIN_U16("graphics/trainer_card/gold.gbapal");
|
static const u16 sTrainerCardGold_Pal[] = INCBIN_U16("graphics/trainer_card/gold.gbapal");
|
||||||
static const u16 sTrainerCardSticker1_Pal[] = INCBIN_U16("graphics/trainer_card/stickers_fr1.gbapal");
|
static const u16 sTrainerCardSticker1_Pal[] = INCBIN_U16("graphics/trainer_card/stickers_fr1.gbapal");
|
||||||
static const u16 sTrainerCardSticker2_Pal[] = INCBIN_U16("graphics/trainer_card/stickers_fr2.gbapal");
|
static const u16 sTrainerCardSticker2_Pal[] = INCBIN_U16("graphics/trainer_card/stickers_fr2.gbapal");
|
||||||
static const u16 sTrainerCardSticker3_Pal[] = INCBIN_U16("graphics/trainer_card/stickers_fr3.gbapal");
|
static const u16 sTrainerCardSticker3_Pal[] = INCBIN_U16("graphics/trainer_card/stickers_fr3.gbapal");
|
||||||
static const u16 sTrainerCardSticker4_Pal[] = INCBIN_U16("graphics/trainer_card/stickers_fr4.gbapal");
|
static const u16 sTrainerCardSticker4_Pal[] = INCBIN_U16("graphics/trainer_card/stickers_fr4.gbapal");
|
||||||
static const u32 sHoennTrainerCardBadges_Gfx[] = INCBIN_U32("graphics/trainer_card/badges.4bpp.lz");
|
static const u32 sHoennTrainerCardBadges_Gfx[] = INCBIN_U32("graphics/trainer_card/badges.4bpp.lz");
|
||||||
static const u32 sKantoTrainerCardBadges_Gfx[] = INCBIN_U32("graphics/trainer_card/badges_fr.4bpp.lz");
|
static const u32 sKantoTrainerCardBadges_Gfx[] = INCBIN_U32("graphics/trainer_card/badges_fr.4bpp.lz");
|
||||||
|
|
||||||
static const struct BgTemplate sTrainerCardBgTemplates[4] =
|
static const struct BgTemplate sTrainerCardBgTemplates[4] =
|
||||||
{
|
{
|
||||||
@ -321,7 +320,6 @@ static bool8 (*const sTrainerCardFlipTasks[])(struct Task *) =
|
|||||||
Task_EndCardFlip,
|
Task_EndCardFlip,
|
||||||
};
|
};
|
||||||
|
|
||||||
// code
|
|
||||||
static void VblankCb_TrainerCard(void)
|
static void VblankCb_TrainerCard(void)
|
||||||
{
|
{
|
||||||
LoadOam();
|
LoadOam();
|
||||||
@ -620,7 +618,7 @@ static void CB2_InitTrainerCard(void)
|
|||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
HandleGpuRegs();
|
InitGpuRegs();
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
@ -841,7 +839,7 @@ static void SetDataFromTrainerCard(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HandleGpuRegs(void)
|
static void InitGpuRegs(void)
|
||||||
{
|
{
|
||||||
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
|
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
|
||||||
ShowBg(0);
|
ShowBg(0);
|
||||||
@ -852,24 +850,23 @@ static void HandleGpuRegs(void)
|
|||||||
SetGpuReg(REG_OFFSET_BLDY, 0);
|
SetGpuReg(REG_OFFSET_BLDY, 0);
|
||||||
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR);
|
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR);
|
||||||
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ);
|
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ);
|
||||||
SetGpuReg(REG_OFFSET_WIN0V, 160);
|
SetGpuReg(REG_OFFSET_WIN0V, DISPLAY_HEIGHT);
|
||||||
SetGpuReg(REG_OFFSET_WIN0H, 240);
|
SetGpuReg(REG_OFFSET_WIN0H, DISPLAY_WIDTH);
|
||||||
if (gReceivedRemoteLinkPlayers)
|
if (gReceivedRemoteLinkPlayers)
|
||||||
EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_HBLANK | INTR_FLAG_VCOUNT | INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL);
|
EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_HBLANK | INTR_FLAG_VCOUNT | INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL);
|
||||||
else
|
else
|
||||||
EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_HBLANK);
|
EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_HBLANK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Part of animating card flip
|
static void UpdateCardFlipRegs(u16 cardTop)
|
||||||
static void sub_80C32EC(u16 arg0)
|
|
||||||
{
|
{
|
||||||
s8 quotient = (arg0 + 40) / 10;
|
s8 blendY = (cardTop + 40) / 10;
|
||||||
|
|
||||||
if (quotient <= 4)
|
if (blendY <= 4)
|
||||||
quotient = 0;
|
blendY = 0;
|
||||||
sData->flipBlendY = quotient;
|
sData->flipBlendY = blendY;
|
||||||
SetGpuReg(REG_OFFSET_BLDY, sData->flipBlendY);
|
SetGpuReg(REG_OFFSET_BLDY, sData->flipBlendY);
|
||||||
SetGpuReg(REG_OFFSET_WIN0V, (sData->var_7CA8 * 256) | (160 - sData->var_7CA8));
|
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(sData->cardTop, DISPLAY_HEIGHT - sData->cardTop));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ResetGpuRegs(void)
|
static void ResetGpuRegs(void)
|
||||||
@ -1578,6 +1575,7 @@ u8 GetTrainerCardStars(u8 cardId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define tFlipState data[0]
|
#define tFlipState data[0]
|
||||||
|
#define tCardTop data[1]
|
||||||
|
|
||||||
static void FlipTrainerCard(void)
|
static void FlipTrainerCard(void)
|
||||||
{
|
{
|
||||||
@ -1608,41 +1606,43 @@ static bool8 Task_BeginCardFlip(struct Task* task)
|
|||||||
HideBg(3);
|
HideBg(3);
|
||||||
ScanlineEffect_Stop();
|
ScanlineEffect_Stop();
|
||||||
ScanlineEffect_Clear();
|
ScanlineEffect_Clear();
|
||||||
for (i = 0; i < 160; i++)
|
for (i = 0; i < DISPLAY_HEIGHT; i++)
|
||||||
gScanlineEffectRegBuffers[1][i] = 0;
|
gScanlineEffectRegBuffers[1][i] = 0;
|
||||||
task->tFlipState++;
|
task->tFlipState++;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note: Cannot be DISPLAY_HEIGHT / 2, or cardHeight will be 0
|
||||||
|
#define CARD_FLIP_Y ((DISPLAY_HEIGHT / 2) - 3)
|
||||||
|
|
||||||
static bool8 Task_AnimateCardFlipDown(struct Task* task)
|
static bool8 Task_AnimateCardFlipDown(struct Task* task)
|
||||||
{
|
{
|
||||||
u32 r4, r5, r10, r7, r6, var_24, r9, var;
|
u32 cardHeight, r5, r10, cardTop, r6, var_24, cardBottom, var;
|
||||||
s16 i;
|
s16 i;
|
||||||
|
|
||||||
sData->allowDMACopy = FALSE;
|
sData->allowDMACopy = FALSE;
|
||||||
if (task->data[1] >= 77)
|
if (task->tCardTop >= CARD_FLIP_Y)
|
||||||
task->data[1] = 77;
|
task->tCardTop = CARD_FLIP_Y;
|
||||||
else
|
else
|
||||||
task->data[1] += 7;
|
task->tCardTop += 7;
|
||||||
|
|
||||||
sData->var_7CA8 = task->data[1];
|
sData->cardTop = task->tCardTop;
|
||||||
sub_80C32EC(task->data[1]);
|
UpdateCardFlipRegs(task->tCardTop);
|
||||||
|
|
||||||
// ???
|
cardTop = task->tCardTop;
|
||||||
r7 = task->data[1];
|
cardBottom = DISPLAY_HEIGHT - cardTop;
|
||||||
r9 = 160 - r7;
|
cardHeight = cardBottom - cardTop;
|
||||||
r4 = r9 - r7;
|
r6 = -cardTop << 16;
|
||||||
r6 = -r7 << 16;
|
r5 = (DISPLAY_HEIGHT << 16) / cardHeight;
|
||||||
r5 = 0xA00000 / r4;
|
r5 -= 1 << 16;
|
||||||
r5 += 0xFFFF0000;
|
|
||||||
var_24 = r6;
|
var_24 = r6;
|
||||||
var_24 += r5 * r4;
|
var_24 += r5 * cardHeight;
|
||||||
r10 = r5 / r4;
|
r10 = r5 / cardHeight;
|
||||||
r5 *= 2;
|
r5 *= 2;
|
||||||
|
|
||||||
for (i = 0; i < r7; i++)
|
for (i = 0; i < cardTop; i++)
|
||||||
gScanlineEffectRegBuffers[0][i] = -i;
|
gScanlineEffectRegBuffers[0][i] = -i;
|
||||||
for (; i < (s16)(r9); i++)
|
for (; i < (s16)cardBottom; i++)
|
||||||
{
|
{
|
||||||
var = r6 >> 16;
|
var = r6 >> 16;
|
||||||
r6 += r5;
|
r6 += r5;
|
||||||
@ -1650,11 +1650,11 @@ static bool8 Task_AnimateCardFlipDown(struct Task* task)
|
|||||||
gScanlineEffectRegBuffers[0][i] = var;
|
gScanlineEffectRegBuffers[0][i] = var;
|
||||||
}
|
}
|
||||||
var = var_24 >> 16;
|
var = var_24 >> 16;
|
||||||
for (; i < 160; i++)
|
for (; i < DISPLAY_HEIGHT; i++)
|
||||||
gScanlineEffectRegBuffers[0][i] = var;
|
gScanlineEffectRegBuffers[0][i] = var;
|
||||||
|
|
||||||
sData->allowDMACopy = TRUE;
|
sData->allowDMACopy = TRUE;
|
||||||
if (task->data[1] >= 77)
|
if (task->tCardTop >= CARD_FLIP_Y)
|
||||||
task->tFlipState++;
|
task->tFlipState++;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1736,33 +1736,32 @@ static bool8 Task_SetCardFlipped(struct Task* task)
|
|||||||
|
|
||||||
static bool8 Task_AnimateCardFlipUp(struct Task* task)
|
static bool8 Task_AnimateCardFlipUp(struct Task* task)
|
||||||
{
|
{
|
||||||
u32 r4, r5, r10, r7, r6, var_24, r9, var;
|
u32 cardHeight, r5, r10, cardTop, r6, var_24, cardBottom, var;
|
||||||
s16 i;
|
s16 i;
|
||||||
|
|
||||||
sData->allowDMACopy = FALSE;
|
sData->allowDMACopy = FALSE;
|
||||||
if (task->data[1] <= 5)
|
if (task->tCardTop <= 5)
|
||||||
task->data[1] = 0;
|
task->tCardTop = 0;
|
||||||
else
|
else
|
||||||
task->data[1] -= 5;
|
task->tCardTop -= 5;
|
||||||
|
|
||||||
sData->var_7CA8 = task->data[1];
|
sData->cardTop = task->tCardTop;
|
||||||
sub_80C32EC(task->data[1]);
|
UpdateCardFlipRegs(task->tCardTop);
|
||||||
|
|
||||||
// ???
|
cardTop = task->tCardTop;
|
||||||
r7 = task->data[1];
|
cardBottom = DISPLAY_HEIGHT - cardTop;
|
||||||
r9 = 160 - r7;
|
cardHeight = cardBottom - cardTop;
|
||||||
r4 = r9 - r7;
|
r6 = -cardTop << 16;
|
||||||
r6 = -r7 << 16;
|
r5 = (DISPLAY_HEIGHT << 16) / cardHeight;
|
||||||
r5 = 0xA00000 / r4;
|
r5 -= 1 << 16;
|
||||||
r5 += 0xFFFF0000;
|
|
||||||
var_24 = r6;
|
var_24 = r6;
|
||||||
var_24 += r5 * r4;
|
var_24 += r5 * cardHeight;
|
||||||
r10 = r5 / r4;
|
r10 = r5 / cardHeight;
|
||||||
r5 /= 2;
|
r5 /= 2;
|
||||||
|
|
||||||
for (i = 0; i < r7; i++)
|
for (i = 0; i < cardTop; i++)
|
||||||
gScanlineEffectRegBuffers[0][i] = -i;
|
gScanlineEffectRegBuffers[0][i] = -i;
|
||||||
for (; i < (s16)(r9); i++)
|
for (; i < (s16)cardBottom; i++)
|
||||||
{
|
{
|
||||||
var = r6 >> 16;
|
var = r6 >> 16;
|
||||||
r6 += r5;
|
r6 += r5;
|
||||||
@ -1770,11 +1769,11 @@ static bool8 Task_AnimateCardFlipUp(struct Task* task)
|
|||||||
gScanlineEffectRegBuffers[0][i] = var;
|
gScanlineEffectRegBuffers[0][i] = var;
|
||||||
}
|
}
|
||||||
var = var_24 >> 16;
|
var = var_24 >> 16;
|
||||||
for (; i < 160; i++)
|
for (; i < DISPLAY_HEIGHT; i++)
|
||||||
gScanlineEffectRegBuffers[0][i] = var;
|
gScanlineEffectRegBuffers[0][i] = var;
|
||||||
|
|
||||||
sData->allowDMACopy = TRUE;
|
sData->allowDMACopy = TRUE;
|
||||||
if (task->data[1] <= 0)
|
if (task->tCardTop <= 0)
|
||||||
task->tFlipState++;
|
task->tFlipState++;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user