diff --git a/graphics/rhh_copyright/credits.pal b/graphics/rhh_copyright/credits.pal new file mode 100644 index 000000000..cdff46971 --- /dev/null +++ b/graphics/rhh_copyright/credits.pal @@ -0,0 +1,259 @@ +JASC-PAL +0100 +256 +198 231 214 +255 255 255 +222 222 222 +222 222 214 +198 198 198 +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 +255 255 255 +247 247 247 +231 231 231 +222 222 222 +222 222 214 +214 214 214 +198 198 198 +181 181 181 +165 165 165 +148 148 148 +132 132 132 +115 115 115 +99 99 99 +82 82 82 +66 66 66 +49 49 49 +33 33 33 +16 16 16 +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 +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 +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 +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 +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 +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 +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 +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 +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 +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 +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 +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 +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 +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 +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 +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 +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 +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 +0 0 0 +0 0 0 +0 0 0 +0 0 0 +0 0 0 diff --git a/graphics/rhh_copyright/powered_by.bin b/graphics/rhh_copyright/powered_by.bin new file mode 100644 index 000000000..13187db91 Binary files /dev/null and b/graphics/rhh_copyright/powered_by.bin differ diff --git a/graphics/rhh_copyright/powered_by.png b/graphics/rhh_copyright/powered_by.png new file mode 100644 index 000000000..b422f6e56 Binary files /dev/null and b/graphics/rhh_copyright/powered_by.png differ diff --git a/graphics/rhh_copyright/rhh_credits.bin b/graphics/rhh_copyright/rhh_credits.bin new file mode 100644 index 000000000..629a2e954 Binary files /dev/null and b/graphics/rhh_copyright/rhh_credits.bin differ diff --git a/graphics/rhh_copyright/rhh_credits.png b/graphics/rhh_copyright/rhh_credits.png new file mode 100644 index 000000000..177022a9d Binary files /dev/null and b/graphics/rhh_copyright/rhh_credits.png differ diff --git a/graphics/rhh_copyright/sprites/dizzy_egg.png b/graphics/rhh_copyright/sprites/dizzy_egg.png new file mode 100644 index 000000000..cd03ffc15 Binary files /dev/null and b/graphics/rhh_copyright/sprites/dizzy_egg.png differ diff --git a/graphics/rhh_copyright/sprites/porygon.png b/graphics/rhh_copyright/sprites/porygon.png new file mode 100644 index 000000000..020198df6 Binary files /dev/null and b/graphics/rhh_copyright/sprites/porygon.png differ diff --git a/graphics/rhh_copyright/sprites/shiny.pal b/graphics/rhh_copyright/sprites/shiny.pal new file mode 100644 index 000000000..1950f6e0b --- /dev/null +++ b/graphics/rhh_copyright/sprites/shiny.pal @@ -0,0 +1,19 @@ +JASC-PAL +0100 +16 +199 225 209 +248 248 248 +197 197 197 +139 213 238 +89 189 230 +7 172 213 +7 131 164 +7 89 114 +246 213 246 +238 172 238 +255 97 207 +197 56 165 +123 40 88 +0 0 0 +0 0 0 +0 0 0 diff --git a/include/config.h b/include/config.h index 3a2461717..b785d5878 100644 --- a/include/config.h +++ b/include/config.h @@ -73,4 +73,7 @@ #define GEN_9 6 #define GEN_LATEST GEN_8 +// General settings +#define RHH_COPYRIGHT_INTRO TRUE // If TRUE, a custom RHH intro will play instead of the vanilla copyright screen. + #endif // GUARD_CONFIG_H diff --git a/include/rhh_copyright.h b/include/rhh_copyright.h new file mode 100644 index 000000000..5dc9576e4 --- /dev/null +++ b/include/rhh_copyright.h @@ -0,0 +1,13 @@ +#ifndef GUARD_RHH_COPYRIGHT_H +#define GUARD_RHH_COPYRIGHT_H + +#if RHH_COPYRIGHT_INTRO == TRUE +void RhhIntro_InitCopyrightBgs(); +void RhhIntro_LoadCopyrightBgGraphics(); +void RhhIntro_ShowRhhCredits(); +void RhhIntro_LoadCopyrightSpriteGraphics(); +void RhhIntro_CreateCopyRightSprites(); +void RhhIntro_DestroyRhhCreditSprites(); +#endif + +#endif /* GUARD_RHH_COPYRIGHT_H */ diff --git a/ld_script.txt b/ld_script.txt index 4c3085f59..e3f9703b4 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -343,6 +343,7 @@ SECTIONS { src/battle_transition_frontier.o(.text); src/international_string_util.o(.text); src/pokemon_debug.o(.text); + src/rhh_copyright.o(.text); } =0 script_data : @@ -709,6 +710,7 @@ SECTIONS { src/m4a_tables.o(.rodata); data/sound_data.o(.rodata); src/pokemon_debug.o(.rodata); + src/rhh_copyright.o(.rodata); } =0 song_data : diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index a57bd2995..e0d47630a 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -2917,7 +2917,7 @@ static void PlayerHandleChoosePokemon(void) *(&gBattleStruct->battlerPreventingSwitchout) = gBattleResources->bufferA[gActiveBattler][1] >> 4; *(&gBattleStruct->prevSelectedPartySlot) = gBattleResources->bufferA[gActiveBattler][2]; *(&gBattleStruct->abilityPreventingSwitchout) = (gBattleResources->bufferA[gActiveBattler][3] & 0xFF) | (gBattleResources->bufferA[gActiveBattler][7] << 8); - BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK); gBattlerControllerFuncs[gActiveBattler] = OpenPartyMenuToChooseMon; gBattlerInMenuId = gActiveBattler; } diff --git a/src/intro.c b/src/intro.c index fd9c12467..e75d4e1bb 100644 --- a/src/intro.c +++ b/src/intro.c @@ -23,6 +23,7 @@ #include "sound.h" #include "util.h" #include "title_screen.h" +#include "rhh_copyright.h" #include "constants/rgb.h" #include "constants/battle_anim.h" @@ -1024,6 +1025,18 @@ static const struct SpritePalette sSpritePalette_RayquazaOrb[] = {}, }; +#if RHH_COPYRIGHT_INTRO == TRUE +static void VBlankCB_PretIntro() +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); + ScanlineEffect_InitHBlankDmaTransfer(); + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); +} +#endif static void VBlankCB_Intro(void) { @@ -1080,11 +1093,14 @@ static u8 SetUpCopyrightScreen(void) CpuFill32(0, (void *)OAM, OAM_SIZE); CpuFill16(0, (void *)(PLTT + 2), PLTT_SIZE - 2); ResetPaletteFade(); +#if RHH_COPYRIGHT_INTRO == FALSE LoadCopyrightGraphics(0, 0x3800, BG_PLTT_ID(0)); +#endif ScanlineEffect_Stop(); ResetTasks(); ResetSpriteData(); FreeAllSpritePalettes(); +#if RHH_COPYRIGHT_INTRO == FALSE BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_WHITEALPHA); SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) @@ -1094,14 +1110,59 @@ static u8 SetUpCopyrightScreen(void) EnableInterrupts(INTR_FLAG_VBLANK); SetVBlankCallback(VBlankCB_Intro); REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON; +#else + SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) + | BGCNT_CHARBASE(0) + | BGCNT_SCREENBASE(7) + | BGCNT_16COLOR + | BGCNT_TXT256x256); + EnableInterrupts(INTR_FLAG_VBLANK); + REG_DISPCNT = DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON; + + gMain.state++; + break; + case 1: + RhhIntro_InitCopyrightBgs(); + BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_WHITEALPHA); + SetVBlankCallback(VBlankCB_PretIntro); +#endif SetSerialCallback(SerialCB_CopyrightScreen); GameCubeMultiBoot_Init(&gMultibootProgramStruct); default: +#if RHH_COPYRIGHT_INTRO == TRUE + RunTasks(); + UpdatePaletteFade(); + gMain.state++; + GameCubeMultiBoot_Main(&gMultibootProgramStruct); + break; + case 30: + RhhIntro_LoadCopyrightBgGraphics(); + BeginNormalPaletteFade(0x00000001, 0, 0x10, 0, RGB_BLACK); + UpdatePaletteFade(); + GameCubeMultiBoot_Main(&gMultibootProgramStruct); + gMain.state++; + break; + case 31: + RhhIntro_LoadCopyrightSpriteGraphics(); + RhhIntro_CreateCopyRightSprites(); + UpdatePaletteFade(); + GameCubeMultiBoot_Main(&gMultibootProgramStruct); + gMain.state++; + break; + case 45: + RhhIntro_ShowRhhCredits(); + UpdatePaletteFade(); + GameCubeMultiBoot_Main(&gMultibootProgramStruct); + gMain.state++; + break; + case 253: +#else UpdatePaletteFade(); gMain.state++; GameCubeMultiBoot_Main(&gMultibootProgramStruct); break; case 140: +#endif GameCubeMultiBoot_Main(&gMultibootProgramStruct); if (gMultibootProgramStruct.gcmb_field_2 != 1) { @@ -1109,9 +1170,20 @@ static u8 SetUpCopyrightScreen(void) gMain.state++; } break; +#if RHH_COPYRIGHT_INTRO == TRUE + case 254: + if (UpdatePaletteFade()) + break; + RhhIntro_DestroyRhhCreditSprites(); + gMain.state++; + break; + + case 255: +#else case 141: if (UpdatePaletteFade()) break; +#endif CreateTask(Task_Scene1_Load, 0); SetMainCallback2(MainCB2_Intro); if (gMultibootProgramStruct.gcmb_field_2 != 0) diff --git a/src/rhh_copyright.c b/src/rhh_copyright.c new file mode 100644 index 000000000..c16cb0eda --- /dev/null +++ b/src/rhh_copyright.c @@ -0,0 +1,345 @@ +#include "global.h" +#include "bg.h" +#include "clear_save_data_menu.h" +#include "decompress.h" +#include "palette.h" +#include "sound.h" +#include "sprite.h" +#include "task.h" +#include "gpu_regs.h" +#include "trig.h" +#include "rhh_copyright.h" +#include "constants/rgb.h" +#include "constants/songs.h" + +#if RHH_COPYRIGHT_INTRO == TRUE + +static const u32 sBgTiles_PoweredBy[] = INCBIN_U32("graphics/rhh_copyright/powered_by.4bpp.lz"); +static const u32 sBgTiles_RhhCredits[] = INCBIN_U32("graphics/rhh_copyright/rhh_credits.8bpp.lz"); +static const u32 sBgMap_PoweredBy[] = INCBIN_U32("graphics/rhh_copyright/powered_by.bin.lz"); +static const u32 sBgMap_RhhCredits[] = INCBIN_U32("graphics/rhh_copyright/rhh_credits.bin.lz"); +static const u32 sBgPal_Credits[] = INCBIN_U32("graphics/rhh_copyright/credits.gbapal.lz"); +static const u32 sSpriteTiles_DizzyEgg[] = INCBIN_U32("graphics/rhh_copyright/sprites/dizzy_egg.4bpp.lz"); +static const u32 sSpriteTiles_Porygon[] = INCBIN_U32("graphics/rhh_copyright/sprites/porygon.4bpp.lz"); +static const u16 sSpritePal_DizzyEgg[] = INCBIN_U16("graphics/rhh_copyright/sprites/dizzy_egg.gbapal"); +static const u16 sSpritePal_Porygon[] = INCBIN_U16("graphics/rhh_copyright/sprites/porygon.gbapal"); +static const u16 sSpritePal_PorygonShiny[] = INCBIN_U16("graphics/rhh_copyright/sprites/shiny.gbapal"); + + +#define TAG_DIZZY 20000 +#define TAG_PORYGON 20001 + +#define PAL_TAG_DIZZY 20000 +#define PAL_TAG_PORYGON 20001 + +#define DIZZY_POS_X 300 +#define DIZZY_POS_Y 138 +#define DIZZY_COLLISION_POS_X 172 +#define PORY_POS_X -32 +#define PORY_POS_Y 115 +#define PORYGON_COLLISION_POS_X 140 +#define PORYGON_WAIT_TIME 99 + +#define DIZZY_ANIM_SPEED 4 +#define DIZZY_STARS_SPEED 12 + +static void SpriteCallbacK_DizzyWalking(struct Sprite* sprite); +static void SpriteCallback_PorygonFlying(struct Sprite* sprite); + +static const union AnimCmd sAnimCmd_DizzyWalking[] = { + ANIMCMD_FRAME(32, DIZZY_ANIM_SPEED), + ANIMCMD_FRAME(16, DIZZY_ANIM_SPEED), + ANIMCMD_FRAME(0, DIZZY_ANIM_SPEED), + ANIMCMD_FRAME(16, DIZZY_ANIM_SPEED), + ANIMCMD_FRAME(32, DIZZY_ANIM_SPEED), + ANIMCMD_FRAME(48, DIZZY_ANIM_SPEED), + ANIMCMD_FRAME(64, DIZZY_ANIM_SPEED), + ANIMCMD_FRAME(48, DIZZY_ANIM_SPEED), + ANIMCMD_JUMP(0), +}; + +static const union AnimCmd sAnimCmd_DizzyisDizzy[] = { + ANIMCMD_FRAME(80, DIZZY_STARS_SPEED), + ANIMCMD_FRAME(96, DIZZY_STARS_SPEED), + ANIMCMD_FRAME(112, DIZZY_STARS_SPEED), + ANIMCMD_FRAME(96, DIZZY_STARS_SPEED), + ANIMCMD_JUMP(0), +}; + +enum {ANIM_DIZZY_WALKING, ANIM_DIZZY_DIZZY}; + +static const union AnimCmd *const sAnimCmdTable_DizzyEgg[] = { + [ANIM_DIZZY_WALKING] = sAnimCmd_DizzyWalking, + [ANIM_DIZZY_DIZZY] = sAnimCmd_DizzyisDizzy, +}; + +static const union AnimCmd sAnimCmd_PorygonIdle[] = { + ANIMCMD_FRAME(0, 0), + ANIMCMD_END, +}; + +static const union AnimCmd sAnimCmd_PorygonHitted[] = { + ANIMCMD_FRAME(64, 0), + ANIMCMD_END, +}; + +static const union AnimCmd sAnimCmd_PorygonGoUp[] = { + ANIMCMD_FRAME(64, 20), + ANIMCMD_FRAME(128, 10), + ANIMCMD_END, +}; + +enum {ANIM_PORY_IDLE, ANIM_PORY_HIT, ANIM_PORY_GO_UP}; + +static const union AnimCmd *const sAnimCmdTable_Porygon[] = { + [ANIM_PORY_IDLE] = sAnimCmd_PorygonIdle, + [ANIM_PORY_HIT] = sAnimCmd_PorygonHitted, + [ANIM_PORY_GO_UP] = sAnimCmd_PorygonGoUp, +}; + +static const union AffineAnimCmd sAffineAnimCmd_PorygonScale[] = { + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMD_END, +}; + +static const union AffineAnimCmd *const sAffineAnimCmdTable_Porygon[] = { + sAffineAnimCmd_PorygonScale, +}; + +static const struct CompressedSpriteSheet sSpriteSheet_DizzyEgg = { + .data = sSpriteTiles_DizzyEgg, + .size = 0x1000, + .tag = TAG_DIZZY, +}; + +static const struct CompressedSpriteSheet sSpriteSheet_Porygon = { + .data = sSpriteTiles_Porygon, + .size = 0x2800, + .tag = PAL_TAG_PORYGON, +}; + +static const struct SpritePalette sSpritePalette_DizzyEgg = { + .data = sSpritePal_DizzyEgg, + .tag = PAL_TAG_DIZZY, +}; + +static const struct SpritePalette sSpritePalette_Porygon = { + .data = sSpritePal_Porygon, + .tag = PAL_TAG_PORYGON, +}; + +static const struct OamData sOamData_DizzyEgg = { + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = 0, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(32x32), + .size = SPRITE_SIZE(32x32), + .priority = 0, +}; + +static const struct OamData sOamData_Porygon = { + .affineMode = ST_OAM_AFFINE_NORMAL, + .objMode = ST_OAM_OBJ_NORMAL, + .mosaic = 0, + .bpp = ST_OAM_4BPP, + .shape = SPRITE_SHAPE(64x64), + .size = SPRITE_SIZE(64x64), + .priority = 0, +}; + +static const struct SpriteTemplate sSpriteTemplate_DizzyEgg = { + .tileTag = TAG_DIZZY, + .paletteTag = PAL_TAG_DIZZY, + .oam = &sOamData_DizzyEgg, + .anims = sAnimCmdTable_DizzyEgg, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbacK_DizzyWalking, +}; + +static const struct SpriteTemplate sSpriteTemplate_Porygon = { + .tileTag = TAG_PORYGON, + .paletteTag = PAL_TAG_PORYGON, + .oam = &sOamData_Porygon, + .anims = sAnimCmdTable_Porygon, + .images = NULL, + .affineAnims = sAffineAnimCmdTable_Porygon, + .callback = SpriteCallback_PorygonFlying, +}; + +enum {BG_0, BG_1, BG_2, BG_3}; + +static const struct BgTemplate sBgTemplates_RhhCopyrightScreen[] = { + [BG_0] = { + .bg = BG_0, + .charBaseIndex = 3, + .mapBaseIndex = 24, + .screenSize = 2, + .paletteMode = 0, + .priority = 0, + .baseTile = 0, + }, + [BG_1] = { + .bg = BG_1, + .charBaseIndex = 3, + .mapBaseIndex = 24, + .screenSize = 2, + .paletteMode = 0, + .priority = 0, + .baseTile = 0, + }, + [BG_2] = { + .bg = BG_2, + .charBaseIndex = 1, + .mapBaseIndex = 20, + .screenSize = 2, + .paletteMode = 1, + .priority = 0, + .baseTile = 0, + }, + [BG_3] = { + .bg = BG_3, + .charBaseIndex = 0, + .mapBaseIndex = 22, + .screenSize = 2, + .paletteMode = 0, + .priority = 0, + .baseTile = 0, + }, +}; + +static EWRAM_DATA u8 sDizzyId = 0; +static EWRAM_DATA u8 sPoryId = 0; + +static void Task_ShowRhhCredits(u8 taskId); + +void RhhIntro_InitCopyrightBgs() +{ + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, sBgTemplates_RhhCopyrightScreen, ARRAY_COUNT(sBgTemplates_RhhCopyrightScreen)); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_EFFECT_DARKEN); + SetGpuReg(REG_OFFSET_BLDY, 0x1F); + HideBg(0); + HideBg(1); + HideBg(2); + ShowBg(3); +} + +void RhhIntro_LoadCopyrightBgGraphics() +{ + LZ77UnCompVram(sBgTiles_PoweredBy, (void*) BG_CHAR_ADDR(sBgTemplates_RhhCopyrightScreen[BG_3].charBaseIndex)); + LZ77UnCompVram(sBgMap_PoweredBy, (u16*) BG_SCREEN_ADDR(sBgTemplates_RhhCopyrightScreen[BG_3].mapBaseIndex)); + LZ77UnCompVram(sBgTiles_RhhCredits, (void*) BG_CHAR_ADDR(sBgTemplates_RhhCopyrightScreen[BG_2].charBaseIndex)); + LZ77UnCompVram(sBgMap_RhhCredits, (u16*) BG_SCREEN_ADDR(sBgTemplates_RhhCopyrightScreen[BG_2].mapBaseIndex)); + LoadCompressedPalette(sBgPal_Credits, 0x00, 0x60); +} + +void RhhIntro_LoadCopyrightSpriteGraphics() +{ + LoadCompressedSpriteSheet(&sSpriteSheet_DizzyEgg); + LoadCompressedSpriteSheet(&sSpriteSheet_Porygon); + LoadSpritePalette(&sSpritePalette_DizzyEgg); + LoadSpritePalette(&sSpritePalette_Porygon); +} + +void RhhIntro_CreateCopyRightSprites() +{ + sDizzyId = CreateSprite(&sSpriteTemplate_DizzyEgg, 0, DIZZY_POS_Y, 0); + gSprites[sDizzyId].x2 = DIZZY_POS_X; + + sPoryId = CreateSprite(&sSpriteTemplate_Porygon, 0, PORY_POS_Y, 0); + gSprites[sPoryId].x2 = PORY_POS_X; +} + +void RhhIntro_ShowRhhCredits() +{ + ShowBg(2); + CreateTask(Task_ShowRhhCredits, 0); +} + +static void Task_ShowRhhCredits(u8 taskId) +{ + if (GetGpuReg(REG_OFFSET_BLDY) != 0) + { + SetGpuReg(REG_OFFSET_BLDY, GetGpuReg(REG_OFFSET_BLDY) - 1); + } + else + { + SetGpuReg(REG_OFFSET_BLDCNT, 0); + DestroyTask(taskId); + } +} + +#define sTimer data[0] +static void SpriteCallbacK_DizzyWalking(struct Sprite* sprite) +{ + sprite->x2--; + + if (sprite->x2 <= DIZZY_COLLISION_POS_X) + { + StartSpriteAnim(sprite, ANIM_DIZZY_DIZZY); + sprite->callback = SpriteCallbackDummy; + } + + if (sprite->sTimer % 16 == 0 && sprite->sTimer / 16 > 2) + PlaySE(SE_BIKE_HOP); + + sprite->sTimer++; +} + + +static void SpriteCallback_PorygonHit(struct Sprite* sprite) +{ + sprite->x2-=2; + sprite ->y2 = Sin2(180 + sprite->sTimer * 4) / 128; + + if (sprite->sTimer >= 48) + { + StartSpriteAnim(sprite, ANIM_PORY_GO_UP); + sprite->callback = SpriteCallbackDummy; + } + + if (sprite->sTimer % 8 == 0) + { + if (sprite->sTimer % 16 == 0) + LoadPalette(sSpritePal_PorygonShiny, 0x10 * (16 + sprite->oam.paletteNum), 0x20); + else + LoadPalette(sSpritePal_Porygon, 0x10 * (16 + sprite->oam.paletteNum), 0x20); + } + + sprite->sTimer++; +} + +static void SpriteCallback_PorygonFlying(struct Sprite* sprite) +{ + if (sprite->sTimer >= PORYGON_WAIT_TIME) + { + sprite->x2 += 6; + + if (sprite->sTimer % 32 >= 16) + sprite->y2--; + else + sprite->y2++; + + if (sprite->x2 >= PORYGON_COLLISION_POS_X) + { + StartSpriteAnim(sprite, ANIM_PORY_HIT); + sprite->callback = SpriteCallback_PorygonHit; + sprite->sTimer = 0; + PlaySE(SE_M_DOUBLE_SLAP); + PlayCryInternal(SPECIES_PORYGON, 0, 120, 10, 0); + } + } + sprite->sTimer++; +} +#undef sTimer + +void RhhIntro_DestroyRhhCreditSprites() +{ + DestroySpriteAndFreeResources(&gSprites[sDizzyId]); + DestroySpriteAndFreeResources(&gSprites[sPoryId]); +} + +#endif //RHH_COPYRIGHT_INTRO diff --git a/sym_ewram.txt b/sym_ewram.txt index 914501a08..4611fa241 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -149,3 +149,4 @@ .include "src/trainer_hill.o" .include "src/rayquaza_scene.o" .include "src/debug.o" + .include "src/rhh_copyright.o"