Document src/battle_interface.c

This commit is contained in:
cbt6
2022-11-14 23:50:20 +08:00
parent 5b2479b7d7
commit c257ba1e6b
39 changed files with 844 additions and 792 deletions
-9
View File
@@ -17,7 +17,6 @@
#include "constants/moves.h"
#include "constants/songs.h"
// Defines
#define TAG_PARTICLES_POKEBALL 55020
#define TAG_PARTICLES_GREATBALL 55021
#define TAG_PARTICLES_SAFARIBALL 55022
@@ -31,15 +30,10 @@
#define TAG_PARTICLES_LUXURYBALL 55030
#define TAG_PARTICLES_PREMIERBALL 55031
#define TAG_HEALTHBOX_PALS_1 55049
#define TAG_HEALTHBOX_PALS_2 55050
// RAM
u32 gMonShrinkDuration;
u16 gMonShrinkDelta;
u16 gMonShrinkDistance;
// Function Declarations
static void AnimTask_UnusedLevelUpHealthBox_Step(u8);
static void AnimTask_FlashHealthboxOnLevelUp_Step(u8);
static void AnimTask_ThrowBall_WaitAnimObjComplete(u8);
@@ -94,7 +88,6 @@ static void TimerBallOpenParticleAnimation(u8);
static void PremierBallOpenParticleAnimation(u8);
static void SpriteCB_SafariBaitOrRock_Init(struct Sprite *);
// Data
struct CaptureStar
{
s8 xOffset;
@@ -408,8 +401,6 @@ const struct SpriteTemplate gSafariRockTemplate =
.callback = SpriteCB_SafariBaitOrRock_Init,
};
// Functions
// Unused
void AnimTask_LevelUpHealthBox(u8 taskId)
{
+6 -6
View File
@@ -713,10 +713,10 @@ void DrawMainBattleBackground(void)
void LoadBattleTextboxAndBackground(void)
{
LZDecompressVram(gBattleTextboxTiles, (void *)BG_CHAR_ADDR(0));
CopyToBgTilemapBuffer(0, gBattleTextboxTilemap, 0, 0x000);
LZDecompressVram(gBattleInterface_Textbox_Gfx, (void *)BG_CHAR_ADDR(0));
CopyToBgTilemapBuffer(0, gBattleInterface_Textbox_Tilemap, 0, 0x000);
CopyBgTilemapBufferToVram(0);
LoadCompressedPalette(gBattleTextboxPalette, 0x00, 0x40);
LoadCompressedPalette(gBattleInterface_Textbox_Pal, 0x00, 0x40);
LoadBattleMenuWindowGfx();
DrawMainBattleBackground();
}
@@ -1076,14 +1076,14 @@ bool8 LoadChosenBattleElement(u8 caseId)
switch (caseId)
{
case 0:
LZDecompressVram(gBattleTextboxTiles, (void *)BG_CHAR_ADDR(0));
LZDecompressVram(gBattleInterface_Textbox_Gfx, (void *)BG_CHAR_ADDR(0));
break;
case 1:
CopyToBgTilemapBuffer(0, gBattleTextboxTilemap, 0, 0x000);
CopyToBgTilemapBuffer(0, gBattleInterface_Textbox_Tilemap, 0, 0x000);
CopyBgTilemapBufferToVram(0);
break;
case 2:
LoadCompressedPalette(gBattleTextboxPalette, 0x00, 0x40);
LoadCompressedPalette(gBattleInterface_Textbox_Pal, 0x00, 0x40);
break;
case 3:
battleScene = GetBattleTerrainOverride();
+2 -2
View File
@@ -98,11 +98,11 @@ static const struct CompressedSpriteSheet sSpriteSheets_HealthBar[MAX_BATTLERS_C
static const struct SpritePalette sSpritePalettes_HealthBoxHealthBar[2] =
{
{
.data = gBattleInterface_BallStatusBarPal,
.data = gBattleInterface_Healthbox_Pal,
.tag = TAG_HEALTHBOX_PAL,
},
{
.data = gBattleInterface_BallDisplayPal,
.data = gBattleInterface_Healthbar_Pal,
.tag = TAG_HEALTHBAR_PAL,
},
};
+751 -708
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1773,7 +1773,7 @@ void CB2_InitEndLinkBattle(void)
gBattle_BG3_X = 0;
gBattle_BG3_Y = 0;
InitBattleBgsVideo();
LoadCompressedPalette(gBattleTextboxPalette, 0, 64);
LoadCompressedPalette(gBattleInterface_Textbox_Pal, 0, 64);
LoadBattleMenuWindowGfx();
ResetSpriteData();
ResetTasks();
+3 -3
View File
@@ -1816,9 +1816,9 @@ static void CB2_EggHatch_0(void)
gMain.state++;
break;
case 2:
DecompressAndLoadBgGfxUsingHeap(0, gBattleTextboxTiles, 0, 0, 0);
CopyToBgTilemapBuffer(0, gBattleTextboxTilemap, 0, 0);
LoadCompressedPalette(gBattleTextboxPalette, 0, 0x20);
DecompressAndLoadBgGfxUsingHeap(0, gBattleInterface_Textbox_Gfx, 0, 0, 0);
CopyToBgTilemapBuffer(0, gBattleInterface_Textbox_Tilemap, 0, 0);
LoadCompressedPalette(gBattleInterface_Textbox_Pal, 0, 0x20);
gMain.state++;
break;
case 3:
+7 -30
View File
@@ -1,8 +1,8 @@
#include "global.h"
const u32 gBattleTextboxTiles[] = INCBIN_U32("graphics/battle_interface/window.4bpp.lz");
const u32 gBattleTextboxPalette[] = INCBIN_U32("graphics/battle_interface/window.gbapal.lz");
const u32 gBattleTextboxTilemap[] = INCBIN_U32("graphics/interface/menu_map.bin.lz");
const u32 gBattleInterface_Textbox_Gfx[] = INCBIN_U32("graphics/battle_interface/textbox.4bpp.lz");
const u32 gBattleInterface_Textbox_Pal[] = INCBIN_U32("graphics/battle_interface/textbox.gbapal.lz");
const u32 gBattleInterface_Textbox_Tilemap[] = INCBIN_U32("graphics/battle_interface/textbox.bin.lz");
const u32 gMonFrontPic_CircledQuestionMark[] = INCBIN_U32("graphics/pokemon/question_mark/circled/front.4bpp.lz");
const u32 gMonBackPic_CircledQuestionMark[] = INCBIN_U32("graphics/pokemon/question_mark/circled/back.4bpp.lz");
@@ -348,33 +348,10 @@ const u32 gUnusedGfx_BasicFrame[] = INCBIN_U32("graphics/unused/basic_frame.4bpp
const u32 gUnusedPal_BasicFrame[] = INCBIN_U32("graphics/unused/basic_frame.gbapal.lz");
const u32 gUnusedTilemap_BasicFrame[] = INCBIN_U32("graphics/unused/basic_frame.bin.lz");
// Battle Interface
const u16 gBattleInterface_Healthbox_Pal[] = INCBIN_U16("graphics/battle_interface/healthbox.gbapal");
const u16 gBattleInterface_Healthbar_Pal[] = INCBIN_U16("graphics/battle_interface/healthbar.gbapal");
const u8 gBattleInterface_Gfx[] = INCBIN_U8("graphics/battle_interface/healthbox_elements.4bpp");
const u16 gBattleInterface_BallStatusBarPal[] = INCBIN_U16("graphics/battle_interface/ball_status_bar.gbapal");
const u16 gBattleInterface_BallDisplayPal[] = INCBIN_U16("graphics/battle_interface/ball_display.gbapal");
//Originally an array?
const u8 gHealthboxElementsGfxTable[] = INCBIN_U8("graphics/battle_interface/hp_bar.4bpp");
const u8 gHealthboxElementsGfxTable_ExpBar[] = INCBIN_U8("graphics/battle_interface/exp_bar.4bpp");
const u8 gHealthboxElementsGfxTable_StatusPsn[] = INCBIN_U8("graphics/battle_interface/status_psn.4bpp");
const u8 gHealthboxElementsGfxTable_StatusPar[] = INCBIN_U8("graphics/battle_interface/status_par.4bpp");
const u8 gHealthboxElementsGfxTable_StatusSlp[] = INCBIN_U8("graphics/battle_interface/status_slp.4bpp");
const u8 gHealthboxElementsGfxTable_StatusFrz[] = INCBIN_U8("graphics/battle_interface/status_frz.4bpp");
const u8 gHealthboxElementsGfxTable_StatusBrn[] = INCBIN_U8("graphics/battle_interface/status_brn.4bpp");
const u8 gHealthboxElementsGfxTable_Misc[] = INCBIN_U8("graphics/battle_interface/misc.4bpp");
const u8 gHealthboxElementsGfxTable_HpBarAnim[] = INCBIN_U8("graphics/battle_interface/hp_bar_anim.4bpp");
const u8 gHealthboxElementsGfxTable_MiscFrameEnd[] = INCBIN_U8("graphics/battle_interface/misc_frame_end.4bpp");
const u8 gBattleInterface_SummaryBallDisplayGfx[] = INCBIN_U8("graphics/battle_interface/ball_display.4bpp");
//Originally an array?
const u8 gBattleInterface_UnusedSummaryBallDisplayGfx[] = INCBIN_U8("graphics/battle_interface/ball_display_unused_extra.4bpp");
const u8 gBattleInterfaceGfx_Status2[] = INCBIN_U8("graphics/battle_interface/status2.4bpp"); // these three duplicate sets of graphics are for the opponent pokemon
const u8 gBattleInterfaceGfx_Status3[] = INCBIN_U8("graphics/battle_interface/status3.4bpp"); // and are also for use in double battles. they use dynamic palettes so
const u8 gBattleInterfaceGfx_Status4[] = INCBIN_U8("graphics/battle_interface/status4.4bpp"); // coloring them is an extreme headache and wont be done for now
const u8 gUnknown_8D12A44[] = INCBIN_U8("graphics/unknown/unknown_D12A44.4bpp");
const u8 gUnknown_8D12A64[] = INCBIN_U8("graphics/unknown/unknown_D12A64.4bpp");
const u32 gBattleInterfaceGfx_UnusedWindow3[] = INCBIN_U32("graphics/battle_interface/unused_window3.4bpp.lz");
const u32 gBattleInterfaceGfx_UnusedWindow4[] = INCBIN_U32("graphics/battle_interface/unused_window4.4bpp.lz");
@@ -1023,7 +1000,7 @@ const u32 gBattleAnimBgPalette_MuddyWater[] = INCBIN_U32("graphics/battle_anims/
const u32 gEnemyMonShadow_Gfx[] = INCBIN_U32("graphics/battle_interface/enemy_mon_shadow.4bpp.lz");
const u32 gFile_graphics_battle_interface_ball_status_bar_sheet[] = INCBIN_U32("graphics/battle_interface/ball_status_bar.4bpp.lz");
const u32 gBattleInterface_PartySummaryBar_Gfx[] = INCBIN_U32("graphics/battle_interface/party_summary_bar.4bpp.lz");
const u8 gMonIcon_Egg[] = INCBIN_U8("graphics/pokemon/egg/icon.4bpp");
+6 -6
View File
@@ -937,16 +937,16 @@ static void TradeAnimInit_LoadGfx(void)
SetBgTilemapBuffer(3, Alloc(BG_SCREEN_SIZE));
DeactivateAllTextPrinters();
// Doing the graphics load...
DecompressAndLoadBgGfxUsingHeap(0, gBattleTextboxTiles, 0, 0, 0);
LZDecompressWram(gBattleTextboxTilemap, gDecompressionBuffer);
DecompressAndLoadBgGfxUsingHeap(0, gBattleInterface_Textbox_Gfx, 0, 0, 0);
LZDecompressWram(gBattleInterface_Textbox_Tilemap, gDecompressionBuffer);
CopyToBgTilemapBuffer(0, gDecompressionBuffer, BG_SCREEN_SIZE, 0);
LoadCompressedPalette(gBattleTextboxPalette, 0x000, 0x20);
LoadCompressedPalette(gBattleInterface_Textbox_Pal, 0x000, 0x20);
InitWindows(sTradeMessageWindowTemplates);
// ... and doing the same load again
DecompressAndLoadBgGfxUsingHeap(0, gBattleTextboxTiles, 0, 0, 0);
LZDecompressWram(gBattleTextboxTilemap, gDecompressionBuffer);
DecompressAndLoadBgGfxUsingHeap(0, gBattleInterface_Textbox_Gfx, 0, 0, 0);
LZDecompressWram(gBattleInterface_Textbox_Tilemap, gDecompressionBuffer);
CopyToBgTilemapBuffer(0, gDecompressionBuffer, BG_SCREEN_SIZE, 0);
LoadCompressedPalette(gBattleTextboxPalette, 0x000, 0x20);
LoadCompressedPalette(gBattleInterface_Textbox_Pal, 0x000, 0x20);
}
static void CB2_InitTradeAnim_InGameTrade(void)