Sync/battle interface (#126)
|
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 308 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 320 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 319 B |
|
Before Width: | Height: | Size: 462 B After Width: | Height: | Size: 394 B |
|
|
@ -33,28 +33,29 @@ enum
|
|||
HP_BAR_FULL,
|
||||
};
|
||||
|
||||
#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_HEALTHBOX_PLAYER1_TILE 0xD6FF
|
||||
#define TAG_HEALTHBOX_PLAYER2_TILE 0xD700
|
||||
#define TAG_HEALTHBOX_OPPONENT1_TILE 0xD701
|
||||
#define TAG_HEALTHBOX_OPPONENT2_TILE 0xD702
|
||||
|
||||
#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_HEALTHBAR_PLAYER1_TILE 0xD704
|
||||
#define TAG_HEALTHBAR_OPPONENT1_TILE 0xD705
|
||||
#define TAG_HEALTHBAR_PLAYER2_TILE 0xD706
|
||||
#define TAG_HEALTHBAR_OPPONENT2_TILE 0xD707
|
||||
|
||||
#define TAG_HEALTHBOX_PALS_1 55049
|
||||
#define TAG_HEALTHBOX_PALS_2 55050
|
||||
#define TAG_HEALTHBOX_SAFARI_TILE 55051
|
||||
#define TAG_STATUS_SUMMARY_BAR_TILE 55052
|
||||
#define TAG_HEALTHBOX_PALS_1 0xD709
|
||||
#define TAG_HEALTHBOX_PALS_2 0xD70A
|
||||
#define TAG_HEALTHBOX_SAFARI_TILE 0xD70B
|
||||
#define TAG_STATUS_SUMMARY_BAR_TILE 0xD70C
|
||||
|
||||
#define TAG_STATUS_SUMMARY_BAR_PAL 55056
|
||||
#define TAG_STATUS_SUMMARY_BALLS_PAL 55058
|
||||
#define TAG_STATUS_SUMMARY_BALLS_TILE 55060
|
||||
#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
|
||||
#define TAG_SHADOW_PAL TAG_HEALTHBOX_PLAYER1_TILE
|
||||
#define TAG_STATUS_SUMMARY_BALLS_TILE 0xD714
|
||||
|
||||
#define TAG_HEALTHBAR_PAL TAG_HEALTHBAR_PLAYER1_TILE
|
||||
#define TAG_HEALTHBOX_PAL TAG_HEALTHBOX_PLAYER1_TILE
|
||||
#define TAG_SHADOW_PAL TAG_HEALTHBOX_PLAYER1_TILE
|
||||
|
||||
#define TAG_SHADOW_TILE 0xD759
|
||||
|
||||
|
|
@ -107,39 +108,37 @@ enum
|
|||
HEALTHBOX_SAFARI_BALLS_TEXT
|
||||
};
|
||||
|
||||
enum BattleCoordTypes GetBattlerCoordsIndex(u32 battler);
|
||||
u8 CreateBattlerHealthboxSprites(u8 battler);
|
||||
enum BattleCoordTypes GetBattlerCoordsIndex(enum BattlerId battler);
|
||||
u8 CreateBattlerHealthboxSprites(enum BattlerId battler);
|
||||
u8 CreateSafariPlayerHealthboxSprites(void);
|
||||
void SetBattleBarStruct(u8 battler, u8 healthboxSpriteId, s32 maxVal, s32 oldVal, s32 receivedValue);
|
||||
void SetBattleBarStruct(enum BattlerId battler, u8 healthboxSpriteId, s32 maxVal, s32 oldVal, s32 receivedValue);
|
||||
void SetHealthboxSpriteInvisible(u8 healthboxSpriteId);
|
||||
void SetHealthboxSpriteVisible(u8 healthboxSpriteId);
|
||||
void DummyBattleInterfaceFunc(u8 healthboxSpriteId, bool8 isDoubleBattleBattlerOnly);
|
||||
void UpdateOamPriorityInAllHealthboxes(u8 priority, bool32 hideHpBoxes);
|
||||
void InitBattlerHealthboxCoords(u8 battler);
|
||||
void GetBattlerHealthboxCoords(u8 battler, s16 *x, s16 *y);
|
||||
void InitBattlerHealthboxCoords(enum BattlerId battler);
|
||||
void GetBattlerHealthboxCoords(enum BattlerId battler, s16 *x, s16 *y);
|
||||
void UpdateHpTextInHealthbox(u32 healthboxSpriteId, u32 maxOrCurrent, s16 currHp, s16 maxHp);
|
||||
void SwapHpBarsWithHpText(void);
|
||||
u8 CreatePartyStatusSummarySprites(enum BattlerId battler, struct HpAndStatus *partyInfo, bool8 skipPlayer, bool8 isBattleStart);
|
||||
void Task_HidePartyStatusSummary(u8 taskId);
|
||||
void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elementId);
|
||||
s32 MoveBattleBar(u8 battler, u8 healthboxSpriteId, u8 whichBar, u8 unused);
|
||||
s32 MoveBattleBar(enum BattlerId battler, u8 healthboxSpriteId, u8 whichBar, u8 unused);
|
||||
u8 GetScaledHPFraction(s16 hp, s16 maxhp, u8 scale);
|
||||
u8 GetHPBarLevel(s16 hp, s16 maxhp);
|
||||
void CreateAbilityPopUp(u8 battlerId, enum Ability ability, bool32 isDoubleBattle);
|
||||
void DestroyAbilityPopUp(u8 battlerId);
|
||||
void CreateAbilityPopUp(enum BattlerId battlerId, enum Ability ability, bool32 isDoubleBattle);
|
||||
void DestroyAbilityPopUp(enum BattlerId battlerId);
|
||||
bool32 CanThrowLastUsedBall(void);
|
||||
void TryHideLastUsedBall(void);
|
||||
void TryRestoreLastUsedBall(void);
|
||||
void TryAddLastUsedBallItemSprites(void);
|
||||
void SwapBallToDisplay(bool32 sameBall);
|
||||
void ArrowsChangeColorLastBallCycle(bool32 showArrows);
|
||||
void UpdateAbilityPopup(u8 battlerId);
|
||||
void UpdateAbilityPopup(enum BattlerId battlerId);
|
||||
void CategoryIcons_LoadSpritesGfx(void);
|
||||
void TryToAddMoveInfoWindow(void);
|
||||
void TryToHideMoveInfoWindow(void);
|
||||
|
||||
// frlg
|
||||
void UpdateNickInHealthbox(u8 spriteId, struct Pokemon *mon);
|
||||
void TryAddPokeballIconToHealthbox(u8 spriteId, u8);
|
||||
void TryAddPokeballIconToHealthbox(u8 healthboxSpriteId, bool8 noStatus);
|
||||
void UpdateNickInHealthbox(u8 healthboxSpriteId, struct Pokemon *mon);
|
||||
|
||||
#endif // GUARD_BATTLE_INTERFACE_H
|
||||
|
|
|
|||
|
|
@ -293,6 +293,9 @@ extern const u8 gText_BattleYesNoChoice[];
|
|||
|
||||
extern const u8 gText_SafariBalls[];
|
||||
extern const u8 gText_HighlightRed_Left[];
|
||||
extern const u8 gText_HealthboxGender_Male[];
|
||||
extern const u8 gText_HealthboxGender_Female[];
|
||||
extern const u8 gText_HealthboxGender_None[];
|
||||
|
||||
extern const u8 gText_Win[];
|
||||
extern const u8 gText_Loss[];
|
||||
|
|
|
|||
|
|
@ -5170,10 +5170,10 @@ extern const u32 gHoennTrainerCard_Gfx[];
|
|||
extern const u32 gBattleTextboxTiles[];
|
||||
extern const u16 gBattleTextboxPalette[];
|
||||
extern const u32 gBattleTextboxTilemap[];
|
||||
extern const u32 gBattleInterface_PartySummaryBar_Gfx[];
|
||||
extern const u32 gBattleInterface_BallStatusBarGfx[];
|
||||
extern const u8 gHealthboxElementsGfxTable[][32];
|
||||
extern const u16 gBattleInterface_Healthbox_Pal[];
|
||||
extern const u16 gBattleInterface_Healthbar_Pal[];
|
||||
extern const u16 gBattleInterface_BallStatusBarPal[];
|
||||
extern const u16 gBattleInterface_BallDisplayPal[];
|
||||
extern const u16 gCategoryIcons_Pal[];
|
||||
extern const u32 gCategoryIcons_Gfx[];
|
||||
|
||||
|
|
|
|||
|
|
@ -196,6 +196,10 @@ extern const u8 gKeypadIconTiles[];
|
|||
void DeactivateAllTextPrinters(void);
|
||||
void DeactivateSingleTextPrinter(u32 id, enum TextPrinterType type);
|
||||
u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16));
|
||||
u16 AddSpriteTextPrinterParametrerized(u8 spriteId, u8 fontId, const u8 *str, u8 x, u8 y, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16));
|
||||
void AddSpriteTextPrinterParameterized3(u8 spriteId, u8 fontId, u8 left, u8 top, const u8 *color, s8 speed, const u8 *str);
|
||||
void AddSpriteTextPrinterParameterized4(u8 spriteId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineSpacing, const u8 *color, s8 speed, const u8 *str);
|
||||
void AddSpriteTextPrinterParameterized6(u8 spriteId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineSpacing, const union TextColor color, s8 speed, const u8 *str);
|
||||
bool32 AddTextPrinter(struct TextPrinterTemplate *textSubPrinter, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16));
|
||||
void RunTextPrinters(void);
|
||||
bool32 IsTextPrinterActiveOnWindow(u32 windowId);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "sprite.h"
|
||||
|
||||
#define HP_EMPTY 0
|
||||
|
||||
extern const u8 gMiscBlank_Gfx[]; // unused in Emerald
|
||||
|
||||
u8 CreateInvisibleSpriteWithCallback(void (*)(struct Sprite *));
|
||||
|
|
@ -17,5 +19,6 @@ u32 CalcByteArraySum(const u8 *data, u32 length);
|
|||
void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u32 blendColor);
|
||||
void BlendPalettesAt(u16 * palbuff, u16 blend_pal, u32 coefficient, s32 size);
|
||||
void DoBgAffineSet(struct BgAffineDstData * dest, u32 texX, u32 texY, s16 srcX, s16 srcY, s16 sx, s16 sy, u16 alpha);
|
||||
s32 SubtractClamped(s32 lowestVal, s32 highestVal, s32 currentVal, s32 delta);
|
||||
|
||||
#endif // GUARD_UTIL_H
|
||||
|
|
|
|||
|
|
@ -115,11 +115,11 @@ static const struct CompressedSpriteSheet sSpriteSheets_HealthBar[MAX_BATTLERS_C
|
|||
const struct SpritePalette sSpritePalettes_HealthBoxHealthBar[2] =
|
||||
{
|
||||
{
|
||||
.data = gBattleInterface_Healthbox_Pal,
|
||||
.data = gBattleInterface_BallStatusBarPal,
|
||||
.tag = TAG_HEALTHBOX_PAL,
|
||||
},
|
||||
{
|
||||
.data = gBattleInterface_Healthbar_Pal,
|
||||
.data = gBattleInterface_BallDisplayPal,
|
||||
.tag = TAG_HEALTHBAR_PAL,
|
||||
},
|
||||
};
|
||||
|
|
@ -787,7 +787,6 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state)
|
|||
{
|
||||
LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[0]);
|
||||
LoadSpritePalette(&sSpritePalettes_HealthBoxHealthBar[1]);
|
||||
LoadIndicatorSpritesGfx();
|
||||
CategoryIcons_LoadSpritesGfx();
|
||||
}
|
||||
else if (!IsDoubleBattle())
|
||||
|
|
|
|||
|
|
@ -371,10 +371,10 @@ void UpdateIndicatorLevelData(u32 healthboxId, u32 level)
|
|||
|
||||
static const s8 sIndicatorPositions[][2] =
|
||||
{
|
||||
[B_POSITION_PLAYER_LEFT] = {49, -9},
|
||||
[B_POSITION_OPPONENT_LEFT] = {40, -9},
|
||||
[B_POSITION_PLAYER_RIGHT] = {48, -9},
|
||||
[B_POSITION_OPPONENT_RIGHT] = {40, -9},
|
||||
[B_POSITION_PLAYER_LEFT] = {48, -9},
|
||||
[B_POSITION_OPPONENT_LEFT] = {39, -9},
|
||||
[B_POSITION_PLAYER_RIGHT] = {47, -9},
|
||||
[B_POSITION_OPPONENT_RIGHT] = {39, -9},
|
||||
};
|
||||
|
||||
void CreateIndicatorSprite(enum BattlerId battler)
|
||||
|
|
|
|||
|
|
@ -189,7 +189,10 @@ const u8 gText_BattleSwitchWhich2[] = _("{PALETTE 5}{COLOR_HIGHLIGHT_SHADOW DYNA
|
|||
const u8 gText_BattleSwitchWhich3[] = _("{UP_ARROW}");
|
||||
const u8 gText_BattleSwitchWhich4[] = _("{ESCAPE 4}");
|
||||
const u8 gText_BattleSwitchWhich5[] = _("-");
|
||||
const u8 gText_SafariBalls[] = _("{HIGHLIGHT DARK_GRAY}SAFARI BALLS");
|
||||
const u8 gText_SafariBalls[] = _("SAFARI BALLS");
|
||||
const u8 gText_HealthboxGender_Male[] = _("{COLOR DYNAMIC_COLOR2}♂");
|
||||
const u8 gText_HealthboxGender_Female[] = _("{COLOR DYNAMIC_COLOR1}♀");
|
||||
const u8 gText_HealthboxGender_None[] = _("{COLOR DYNAMIC_COLOR2}");
|
||||
const u8 gText_SafariBallLeft[] = _("{HIGHLIGHT DARK_GRAY}Left: $" "{HIGHLIGHT DARK_GRAY}");
|
||||
const u8 gText_Sleep[] = _("sleep");
|
||||
const u8 gText_Poison[] = _("poison");
|
||||
|
|
|
|||
|
|
@ -65,8 +65,6 @@ static const struct SpriteTemplate sSpriteTemplate_GimmickTrigger =
|
|||
.paletteTag = TAG_GIMMICK_TRIGGER_PAL,
|
||||
.oam = &sOamData_GimmickTrigger,
|
||||
.anims = sSpriteAnimTable_GimmickTrigger,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = SpriteCb_GimmickTrigger,
|
||||
};
|
||||
|
||||
|
|
@ -153,9 +151,6 @@ static const struct SpriteTemplate sSpriteTemplate_BattlerIndicators[] =
|
|||
.tileTag = BATTLER_INDICATOR_TAG, // updated dynamically
|
||||
.paletteTag = TAG_TERA_INDICATOR_PAL, // updated dynamically
|
||||
.oam = &sOamData_GimmickIndicator,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = SpriteCb_GimmickIndicator,
|
||||
},
|
||||
[1] =
|
||||
|
|
@ -163,9 +158,6 @@ static const struct SpriteTemplate sSpriteTemplate_BattlerIndicators[] =
|
|||
.tileTag = BATTLER_INDICATOR_TAG + 1, // updated dynamically
|
||||
.paletteTag = TAG_TERA_INDICATOR_PAL, // updated dynamically
|
||||
.oam = &sOamData_GimmickIndicator,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = SpriteCb_GimmickIndicator,
|
||||
},
|
||||
[2] =
|
||||
|
|
@ -173,9 +165,6 @@ static const struct SpriteTemplate sSpriteTemplate_BattlerIndicators[] =
|
|||
.tileTag = BATTLER_INDICATOR_TAG + 2, // updated dynamically
|
||||
.paletteTag = TAG_TERA_INDICATOR_PAL, // updated dynamically
|
||||
.oam = &sOamData_GimmickIndicator,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = SpriteCb_GimmickIndicator,
|
||||
},
|
||||
[3] =
|
||||
|
|
@ -183,9 +172,6 @@ static const struct SpriteTemplate sSpriteTemplate_BattlerIndicators[] =
|
|||
.tileTag = BATTLER_INDICATOR_TAG + 3, // updated dynamically
|
||||
.paletteTag = TAG_TERA_INDICATOR_PAL, // updated dynamically
|
||||
.oam = &sOamData_GimmickIndicator,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = SpriteCb_GimmickIndicator,
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -417,8 +417,8 @@ const u32 gUnusedGfx_BasicFrame[] = INCBIN_U32("graphics/unused/basic_frame.4bpp
|
|||
const u16 gUnusedPal_BasicFrame[] = INCBIN_U16("graphics/unused/basic_frame.gbapal");
|
||||
const u32 gUnusedTilemap_BasicFrame[] = INCBIN_U32("graphics/unused/basic_frame.bin.smolTM");
|
||||
|
||||
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 u16 gBattleInterface_BallStatusBarPal[] = INCBIN_U16("graphics/battle_interface/healthbox.gbapal");
|
||||
const u16 gBattleInterface_BallDisplayPal[] = INCBIN_U16("graphics/battle_interface/healthbar.gbapal");
|
||||
const u8 gHealthboxElementsGfxTable[][32] = INCBIN_U8("graphics/battle_interface/hpbar.4bpp",
|
||||
"graphics/battle_interface/expbar.4bpp",
|
||||
"graphics/battle_interface/status.4bpp",
|
||||
|
|
@ -1093,7 +1093,7 @@ const u16 gBattleAnimBackgroundImageMuddyWater_Pal[] = INCBIN_U16("graphics/batt
|
|||
const u32 gEnemyMonShadow_Gfx[] = INCBIN_U32("graphics/battle_interface/enemy_mon_shadow.4bpp.smol");
|
||||
const u32 gEnemyMonShadowsSized_Gfx[] = INCBIN_U32("graphics/battle_interface/enemy_mon_shadows_sized.4bpp.smol");
|
||||
|
||||
const u32 gBattleInterface_PartySummaryBar_Gfx[] = INCBIN_U32("graphics/battle_interface/party_summary_bar.4bpp.smol");
|
||||
const u32 gBattleInterface_BallStatusBarGfx[] = INCBIN_U32("graphics/battle_interface/party_summary_bar.4bpp.smol");
|
||||
|
||||
const u32 gBattleAnimBgImage_Ghost[] = INCBIN_U32("graphics/battle_anims/backgrounds/ghost.4bpp.smol");
|
||||
const u16 gBattleAnimBgPalette_Ghost[] = INCBIN_U16("graphics/battle_anims/backgrounds/ghost.gbapal");
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ static void CB2_ReshowBattleScreenAfterMenu(void)
|
|||
case 6:
|
||||
if (BattleLoadAllHealthBoxesGfx(gBattleScripting.reshowHelperState))
|
||||
{
|
||||
LoadIndicatorSpritesGfx();
|
||||
gBattleScripting.reshowHelperState = 0;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -511,8 +511,10 @@ bool32 AddTextPrinter(struct TextPrinterTemplate *printerTemplate, u8 speed, voi
|
|||
sTempTextPrinter.textSpeed = speed;
|
||||
|
||||
if (printerTemplate->type == SPRITE_TEXT_PRINTER)
|
||||
printerTemplate->firstSprite = printerTemplate->spriteId;
|
||||
|
||||
{
|
||||
sTempTextPrinter.printerTemplate.firstSprite = printerTemplate->spriteId;
|
||||
sTempTextPrinter.printerTemplate.firstSpriteInRow = printerTemplate->spriteId;
|
||||
}
|
||||
|
||||
GenerateFontHalfRowLookupTable(printerTemplate->color);
|
||||
if (speed != TEXT_SKIP_DRAW && speed != 0)
|
||||
|
|
|
|||
12
src/util.c
|
|
@ -281,3 +281,15 @@ void BlendPalettesAt(u16 * palbuff, u16 blend_pal, u32 coefficient, s32 size)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 SubtractClamped(s32 lowestVal, s32 highestVal, s32 currentVal, s32 delta)
|
||||
{
|
||||
s32 newValue = currentVal - delta;
|
||||
if (newValue > highestVal)
|
||||
newValue = highestVal;
|
||||
else if (newValue < lowestVal)
|
||||
newValue = lowestVal;
|
||||
|
||||
return newValue;
|
||||
}
|
||||
|
||||
|
|
|
|||