Merge pull request #582 from cbt6/battle-interface

Document src/battle_interface.c
This commit is contained in:
GriffinR
2022-11-14 11:24:44 -05:00
committed by GitHub
39 changed files with 844 additions and 792 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 B

+19
View File
@@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
57 57 57
255 255 255
213 205 189
131 131 139
74 65 90
82 106 90
255 213 82
255 180 65
222 106 90
115 255 172
90 213 131
255 230 57
205 172 8
255 90 57
172 65 74
+19
View File
@@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
65 65 65
255 255 222
222 213 180
197 189 115
123 148 131
82 106 98
32 57 0
57 82 65
255 230 0
255 156 148
65 205 255
0 0 255
0 255 0
255 0 0
106 148 255
Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 B

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 277 B

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 369 B

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 B

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 B

Before

Width:  |  Height:  |  Size: 505 B

After

Width:  |  Height:  |  Size: 505 B

+1 -1
View File
@@ -158,7 +158,7 @@ $(BATINTGFXDIR)/unused_window2bar.4bpp: %.4bpp: %.png
$(BATINTGFXDIR)/level_up_banner.4bpp: %.4bpp: %.png
$(GFX) $< $@ -num_tiles 36
$(BATINTGFXDIR)/window.gbapal: $(BATINTGFXDIR)/window1.gbapal $(BATINTGFXDIR)/window2.gbapal
$(BATINTGFXDIR)/textbox.gbapal: $(BATINTGFXDIR)/textbox1.gbapal $(BATINTGFXDIR)/textbox2.gbapal
cat $^ > $@
$(UNUSEDGFXDIR)/old_contest.4bpp: $(UNUSEDGFXDIR)/old_contest_frame_1.4bpp \
+1 -1
View File
@@ -581,7 +581,7 @@ struct BattleBarInfo
u8 healthboxSpriteId;
s32 maxValue;
s32 oldValue;
s32 receivedValue;
s32 receivedValue; // if positive/negative, fills the bar to the left/right respectively
s32 currValue;
};
+21 -15
View File
@@ -25,25 +25,31 @@ enum
HP_BAR_FULL,
};
#define TAG_HEALTHBOX_PLAYER1_TILE 0xD6FF
#define TAG_HEALTHBOX_PLAYER2_TILE 0xD700
#define TAG_HEALTHBOX_OPPONENT1_TILE 0xD701
#define TAG_HEALTHBOX_OPPONENT2_TILE 0xD702
#define TAG_HEALTHBOX_PLAYER1_TILE 55039
#define TAG_HEALTHBOX_PLAYER2_TILE 55040
#define TAG_HEALTHBOX_OPPONENT1_TILE 55041
#define TAG_HEALTHBOX_OPPONENT2_TILE 55042
#define TAG_HEALTHBAR_PLAYER1_TILE 0xD704
#define TAG_HEALTHBAR_OPPONENT1_TILE 0xD705
#define TAG_HEALTHBAR_PLAYER2_TILE 0xD706
#define TAG_HEALTHBAR_OPPONENT2_TILE 0xD707
#define TAG_HEALTHBAR_PLAYER1_TILE 55044
#define TAG_HEALTHBAR_OPPONENT1_TILE 55045
#define TAG_HEALTHBAR_PLAYER2_TILE 55046
#define TAG_HEALTHBAR_OPPONENT2_TILE 55047
#define TAG_HEALTHBOX_SAFARI_TILE 0xD70B
#define TAG_HEALTHBOX_PALS_1 55049
#define TAG_HEALTHBOX_PALS_2 55050
#define TAG_HEALTHBOX_SAFARI_TILE 55051
#define TAG_PARTY_SUMMARY_BAR_PLAYER_TILE 55052
#define TAG_PARTY_SUMMARY_BAR_OPPONENT_TILE 55053
#define TAG_STATUS_SUMMARY_BAR_TILE 0xD70C
#define TAG_STATUS_SUMMARY_BALLS_TILE 0xD714
#define TAG_PARTY_SUMMARY_BAR_PLAYER_PAL 55056
#define TAG_PARTY_SUMMARY_BAR_OPPONENT_PAL 55057
#define TAG_PARTY_SUMMARY_BALL_PLAYER_PAL 55058
#define TAG_PARTY_SUMMARY_BALL_OPPONENT_PAL 55059
#define TAG_PARTY_SUMMARY_BALL_PLAYER_TILE 55060
#define TAG_PARTY_SUMMARY_BALL_OPPONENT_TILE 55061
#define TAG_HEALTHBOX_PAL 0xD6FF
#define TAG_HEALTHBAR_PAL 0xD704
#define TAG_STATUS_SUMMARY_BAR_PAL 0xD710
#define TAG_STATUS_SUMMARY_BALLS_PAL 0xD712
#define TAG_HEALTHBOX_PAL TAG_HEALTHBOX_PLAYER1_TILE
#define TAG_HEALTHBAR_PAL TAG_HEALTHBAR_PLAYER1_TILE
enum
{
+7 -10
View File
@@ -2878,9 +2878,6 @@ extern const u8 gUnknown_8E99118[];
extern const u16 gStandardMenuPalette[];
// egg_hatch
extern const u32 gBattleTextboxTiles[];
extern const u32 gBattleTextboxTilemap[];
extern const u32 gBattleTextboxPalette[];
extern const u32 gTradeGba2_Pal[];
extern const u32 gTradeGba_Gfx[];
@@ -4322,8 +4319,6 @@ extern const u32 gHealthboxDoublesPlayerGfx[];
extern const u32 gHealthboxDoublesOpponentGfx[];
extern const u32 gHealthboxSafariGfx[];
extern const u32 gBlankGfxCompressed[];
extern const u16 gBattleInterface_BallStatusBarPal[];
extern const u16 gBattleInterface_BallDisplayPal[];
extern const u32 gInterfaceGfx_HPNumbers[];
extern const u32 gGhostFrontPic[];
extern const u32 gGhostPalette[];
@@ -4861,11 +4856,13 @@ extern const u16 gHoennTrainerCard_Pal[];
extern const u32 gHoennTrainerCard_Gfx[];
// battle_interface
extern const u32 gFile_graphics_battle_interface_ball_status_bar_sheet[];
extern const u8 gHealthboxElementsGfxTable[][32];
extern const u16 gBattleInterface_BallStatusBarPal[];
extern const u16 gBattleInterface_BallDisplayPal[];
extern const u16 gBattleInterface_SummaryBallDisplayGfx[];
extern const u32 gBattleInterface_Textbox_Gfx[];
extern const u32 gBattleInterface_Textbox_Pal[];
extern const u32 gBattleInterface_Textbox_Tilemap[];
extern const u32 gBattleInterface_PartySummaryBar_Gfx[];
extern const u8 gBattleInterface_Gfx[][32];
extern const u16 gBattleInterface_Healthbox_Pal[];
extern const u16 gBattleInterface_Healthbar_Pal[];
// item_menu
extern const u32 gUnknown_8E830CC[];
-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)