mirror of
https://github.com/pret/pokeemerald.git
synced 2026-08-26 12:41:20 -05:00
Move StartMonScrollingBgMask to battle_anim_utility_func.c
So we don't need to do any extern shenanigans.
This commit is contained in:
@@ -68,10 +68,8 @@ void RelocateBattleBgPal(u16 paletteNum, u16 *dest, u32 offset, bool8 largeScree
|
||||
void ResetBattleAnimBg(bool8 toBG2);
|
||||
|
||||
// battle_intro.c
|
||||
void SetAnimBgAttribute(u8 bgId, u8 attributeId, u8 value);
|
||||
void DrawBattlerOnBg(int bgId, u8 x, u8 y, u8 battlerPosition, u8 paletteId, u8 *tiles, u16 *tilemap, u16 tilesOffset);
|
||||
void HandleIntroSlide(u8 environment);
|
||||
int GetAnimBgAttribute(u8 bgId, u8 attributeId);
|
||||
|
||||
// battle_anim_mons.c
|
||||
void TranslateSpriteInEllipse(struct Sprite *sprite);
|
||||
@@ -226,6 +224,8 @@ u8 LaunchBallFadeMonTask(bool8 unfadeLater, u8 spritePalNum, u32 selectedPalette
|
||||
// battle_anim_utility_funcs.c
|
||||
void InitStatsChangeAnimation(u8 taskId);
|
||||
void StartMonScrollingBgMask(u8 taskId, int UNUSED unused, u16 scrollSpeed, u8 battler, bool8 includePartner, u8 numFadeSteps, u8 fadeStepDelay, u8 duration, const u32 *gfx, const u32 *tilemap, const u32 *palette);
|
||||
void SetAnimBgAttribute(u8 bgId, u8 attributeId, u8 value);
|
||||
int GetAnimBgAttribute(u8 bgId, u8 attributeId);
|
||||
|
||||
// battle_anim_effects_1.c
|
||||
void SetSpriteNextToMonHead(u8 battler, struct Sprite *sprite);
|
||||
|
||||
@@ -40,10 +40,8 @@ static void AnimTask_WaitAndRestoreVisibility(u8);
|
||||
|
||||
static const u16 sCurseLinesPalette[] = { RGB_WHITE };
|
||||
|
||||
// These belong in battle_intro.c, but putting them there causes 2 bytes of alignment padding
|
||||
// between the two .rodata segments. Perhaps battle_intro.c actually belongs in this file, too.
|
||||
const u8 gBattleAnimBgCntSet[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFSET_BG2CNT, REG_OFFSET_BG3CNT};
|
||||
const u8 gBattleAnimBgCntGet[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFSET_BG2CNT, REG_OFFSET_BG3CNT};
|
||||
static const u8 sBattleAnimBgCntSet[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFSET_BG2CNT, REG_OFFSET_BG3CNT};
|
||||
static const u8 sBattleAnimBgCntGet[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFSET_BG2CNT, REG_OFFSET_BG3CNT};
|
||||
|
||||
void AnimTask_BlendBattleAnimPal(u8 taskId)
|
||||
{
|
||||
@@ -1099,3 +1097,67 @@ static void AnimTask_WaitAndRestoreVisibility(u8 taskId)
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
void SetAnimBgAttribute(u8 bgId, u8 attributeId, u8 value)
|
||||
{
|
||||
static EWRAM_DATA u16 sBgCnt = 0;
|
||||
if (bgId < 4)
|
||||
{
|
||||
sBgCnt = GetGpuReg(sBattleAnimBgCntSet[bgId]);
|
||||
switch (attributeId)
|
||||
{
|
||||
case BG_ANIM_SCREEN_SIZE:
|
||||
((struct BgCnt *)&sBgCnt)->screenSize = value;
|
||||
break;
|
||||
case BG_ANIM_AREA_OVERFLOW_MODE:
|
||||
((struct BgCnt *)&sBgCnt)->areaOverflowMode = value;
|
||||
break;
|
||||
case BG_ANIM_MOSAIC:
|
||||
((struct BgCnt *)&sBgCnt)->mosaic = value;
|
||||
break;
|
||||
case BG_ANIM_CHAR_BASE_BLOCK:
|
||||
((struct BgCnt *)&sBgCnt)->charBaseBlock = value;
|
||||
break;
|
||||
case BG_ANIM_PRIORITY:
|
||||
((struct BgCnt *)&sBgCnt)->priority = value;
|
||||
break;
|
||||
case BG_ANIM_PALETTES_MODE:
|
||||
((struct BgCnt *)&sBgCnt)->palettes = value;
|
||||
break;
|
||||
case BG_ANIM_SCREEN_BASE_BLOCK:
|
||||
((struct BgCnt *)&sBgCnt)->screenBaseBlock = value;
|
||||
break;
|
||||
}
|
||||
|
||||
SetGpuReg(sBattleAnimBgCntSet[bgId], sBgCnt);
|
||||
}
|
||||
}
|
||||
|
||||
int GetAnimBgAttribute(u8 bgId, u8 attributeId)
|
||||
{
|
||||
u16 bgCnt;
|
||||
|
||||
if (bgId < 4)
|
||||
{
|
||||
bgCnt = GetGpuReg(sBattleAnimBgCntGet[bgId]);
|
||||
switch (attributeId)
|
||||
{
|
||||
case BG_ANIM_SCREEN_SIZE:
|
||||
return ((struct BgCnt *)&bgCnt)->screenSize;
|
||||
case BG_ANIM_AREA_OVERFLOW_MODE:
|
||||
return ((struct BgCnt *)&bgCnt)->areaOverflowMode;
|
||||
case BG_ANIM_MOSAIC:
|
||||
return ((struct BgCnt *)&bgCnt)->mosaic;
|
||||
case BG_ANIM_CHAR_BASE_BLOCK:
|
||||
return ((struct BgCnt *)&bgCnt)->charBaseBlock;
|
||||
case BG_ANIM_PRIORITY:
|
||||
return ((struct BgCnt *)&bgCnt)->priority;
|
||||
case BG_ANIM_PALETTES_MODE:
|
||||
return ((struct BgCnt *)&bgCnt)->palettes;
|
||||
case BG_ANIM_SCREEN_BASE_BLOCK:
|
||||
return ((struct BgCnt *)&bgCnt)->screenBaseBlock;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -11,11 +11,6 @@
|
||||
#include "trig.h"
|
||||
#include "constants/trainers.h"
|
||||
|
||||
static EWRAM_DATA u16 sBgCnt = 0;
|
||||
|
||||
extern const u8 gBattleAnimBgCntSet[];
|
||||
extern const u8 gBattleAnimBgCntGet[];
|
||||
|
||||
static void BattleIntroSlide1(u8);
|
||||
static void BattleIntroSlide2(u8);
|
||||
static void BattleIntroSlide3(u8);
|
||||
@@ -36,69 +31,6 @@ static const TaskFunc sBattleIntroSlideFuncs[] =
|
||||
[BATTLE_ENVIRONMENT_PLAIN] = BattleIntroSlide3,
|
||||
};
|
||||
|
||||
void SetAnimBgAttribute(u8 bgId, u8 attributeId, u8 value)
|
||||
{
|
||||
if (bgId < 4)
|
||||
{
|
||||
sBgCnt = GetGpuReg(gBattleAnimBgCntSet[bgId]);
|
||||
switch (attributeId)
|
||||
{
|
||||
case BG_ANIM_SCREEN_SIZE:
|
||||
((struct BgCnt *)&sBgCnt)->screenSize = value;
|
||||
break;
|
||||
case BG_ANIM_AREA_OVERFLOW_MODE:
|
||||
((struct BgCnt *)&sBgCnt)->areaOverflowMode = value;
|
||||
break;
|
||||
case BG_ANIM_MOSAIC:
|
||||
((struct BgCnt *)&sBgCnt)->mosaic = value;
|
||||
break;
|
||||
case BG_ANIM_CHAR_BASE_BLOCK:
|
||||
((struct BgCnt *)&sBgCnt)->charBaseBlock = value;
|
||||
break;
|
||||
case BG_ANIM_PRIORITY:
|
||||
((struct BgCnt *)&sBgCnt)->priority = value;
|
||||
break;
|
||||
case BG_ANIM_PALETTES_MODE:
|
||||
((struct BgCnt *)&sBgCnt)->palettes = value;
|
||||
break;
|
||||
case BG_ANIM_SCREEN_BASE_BLOCK:
|
||||
((struct BgCnt *)&sBgCnt)->screenBaseBlock = value;
|
||||
break;
|
||||
}
|
||||
|
||||
SetGpuReg(gBattleAnimBgCntSet[bgId], sBgCnt);
|
||||
}
|
||||
}
|
||||
|
||||
int GetAnimBgAttribute(u8 bgId, u8 attributeId)
|
||||
{
|
||||
u16 bgCnt;
|
||||
|
||||
if (bgId < 4)
|
||||
{
|
||||
bgCnt = GetGpuReg(gBattleAnimBgCntGet[bgId]);
|
||||
switch (attributeId)
|
||||
{
|
||||
case BG_ANIM_SCREEN_SIZE:
|
||||
return ((struct BgCnt *)&bgCnt)->screenSize;
|
||||
case BG_ANIM_AREA_OVERFLOW_MODE:
|
||||
return ((struct BgCnt *)&bgCnt)->areaOverflowMode;
|
||||
case BG_ANIM_MOSAIC:
|
||||
return ((struct BgCnt *)&bgCnt)->mosaic;
|
||||
case BG_ANIM_CHAR_BASE_BLOCK:
|
||||
return ((struct BgCnt *)&bgCnt)->charBaseBlock;
|
||||
case BG_ANIM_PRIORITY:
|
||||
return ((struct BgCnt *)&bgCnt)->priority;
|
||||
case BG_ANIM_PALETTES_MODE:
|
||||
return ((struct BgCnt *)&bgCnt)->palettes;
|
||||
case BG_ANIM_SCREEN_BASE_BLOCK:
|
||||
return ((struct BgCnt *)&bgCnt)->screenBaseBlock;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define tState data[0]
|
||||
#define tEnvironment data[1]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user