summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDiegoisawesome <Diegoisawesome@users.noreply.github.com>2018-12-23 10:45:19 -0600
committerGitHub <noreply@github.com>2018-12-23 10:45:19 -0600
commite874267edb6617759e239da0fb5cb884867aec6d (patch)
treec196c373809a9d60077a890c6ac77ff0515bcf75 /src
parentf1ee374e93d0727074e2c760924b5a89b78aa2b9 (diff)
parentefa820469afcd92b0fdd6b7fff589143ea63c45c (diff)
Merge pull request #469 from DizzyEggg/data
Move some data to C
Diffstat (limited to 'src')
-rw-r--r--src/battle_bg.c3
-rw-r--r--src/battle_main.c90
-rwxr-xr-xsrc/field_effect_helpers.c18
-rw-r--r--src/gpu_regs.c30
-rw-r--r--src/pokemon.c30
-rw-r--r--src/rom_8034C54.c3
-rw-r--r--src/unk_transition.c12
7 files changed, 135 insertions, 51 deletions
diff --git a/src/battle_bg.c b/src/battle_bg.c
index 7ba59e6be..a6919be1d 100644
--- a/src/battle_bg.c
+++ b/src/battle_bg.c
@@ -11,6 +11,7 @@
#include "link.h"
#include "main.h"
#include "menu.h"
+#include "overworld.h"
#include "palette.h"
#include "sound.h"
#include "sprite.h"
@@ -31,8 +32,6 @@ struct BattleBackground
const void *palette;
};
-extern u8 GetCurrentMapBattleScene(void);
-
// .rodata
static const u16 sUnrefArray[] = {0x0300, 0x0000}; //OamData?
diff --git a/src/battle_main.c b/src/battle_main.c
index 42f204508..a17ccd4eb 100644
--- a/src/battle_main.c
+++ b/src/battle_main.c
@@ -68,12 +68,10 @@ extern const u8 *const gBattlescriptsForBallThrow[];
extern const u8 *const gBattlescriptsForRunningByItem[];
extern const u8 *const gBattlescriptsForUsingItem[];
extern const u8 *const gBattlescriptsForSafariActions[];
-extern const struct ScanlineEffectParams gBattleIntroSlideScanlineEffectParams;
// strings
extern const u8 gText_LinkStandby3[];
extern const u8 gText_BattleRecordCouldntBeSaved[];
-extern const u8 gText_ShedinjaJapaneseName[];
extern const u8 gText_Poison[];
extern const u8 gText_Sleep[];
extern const u8 gText_Paralysis[];
@@ -104,9 +102,9 @@ static void sub_8038F34(void);
static void sub_80392A8(void);
static void sub_803937C(void);
static void sub_803939C(void);
-static void sub_803980C(struct Sprite *sprite);
-static void sub_8039838(struct Sprite *sprite);
-static void sub_8039894(struct Sprite *sprite);
+static void SpriteCb_MoveWildMonToRight(struct Sprite *sprite);
+static void SpriteCb_WildMonShowHealthbox(struct Sprite *sprite);
+static void SpriteCb_WildMonAnimate(struct Sprite *sprite);
static void sub_80398D0(struct Sprite *sprite);
static void SpriteCB_AnimFaintOpponent(struct Sprite *sprite);
static void sub_8039AF4(struct Sprite *sprite);
@@ -283,6 +281,70 @@ u8 gNumberOfMovesToChoose;
u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT];
// rom const data
+static const struct ScanlineEffectParams sIntroScanlineParams16Bit =
+{
+ (void *)REG_ADDR_BG3HOFS, SCANLINE_EFFECT_DMACNT_16BIT, 1
+};
+
+// unused
+static const struct ScanlineEffectParams sIntroScanlineParams32Bit =
+{
+ (void *)REG_ADDR_BG3HOFS, SCANLINE_EFFECT_DMACNT_32BIT, 1
+};
+
+const struct SpriteTemplate gUnknown_0831AC88 =
+{
+ .tileTag = 0,
+ .paletteTag = 0,
+ .oam = &gDummyOamData,
+ .anims = gDummySpriteAnimTable,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_8038528,
+};
+
+static const u8 sText_ShedinjaJpnName[] = _("ヌケニン"); // Nukenin
+
+const struct OamData gOamData_831ACA8 =
+{
+ .y = 0,
+ .affineMode = 1,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 0,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 3,
+ .tileNum = 0,
+ .priority = 2,
+ .paletteNum = 0,
+ .affineParam = 0
+};
+
+const struct OamData gOamData_831ACB0 =
+{
+ .y = 0,
+ .affineMode = 1,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 0,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 3,
+ .tileNum = 0,
+ .priority = 2,
+ .paletteNum = 2,
+ .affineParam = 0
+};
+
+// Unknown and unused data. Feel free to remove.
+static const u16 gUnknown_0831ACB8[] = {0, 5, 0xfffe, 0};
+static const u16 *const gUnknown_0831ACC0 = gUnknown_0831ACB8;
+static const u16 gUnknown_0831ACC4[] = {0xfff0, 0, 0x0400, 0, 0, 0, 0x3c00, 0, 0x7ffe, 1, 0, 0};
+static const u16 *const gUnknown_0831ACDC = gUnknown_0831ACC4;
+
static const s8 gUnknown_0831ACE0[] ={-32, -16, -16, -32, -32, 0, 0, 0};
// format: attacking type, defending type, damage multiplier
@@ -620,7 +682,7 @@ static void CB2_InitBattleInternal(void)
gScanlineEffectRegBuffers[1][i] = 0xFF10;
}
- ScanlineEffect_SetParams(gBattleIntroSlideScanlineEffectParams);
+ ScanlineEffect_SetParams(sIntroScanlineParams16Bit);
}
ResetPaletteFade();
@@ -2592,7 +2654,7 @@ static void TryCorrectShedinjaLanguage(struct Pokemon *mon)
&& GetMonData(mon, MON_DATA_LANGUAGE) != language)
{
GetMonData(mon, MON_DATA_NICKNAME, nickname);
- if (StringCompareWithoutExtCtrlCodes(nickname, gText_ShedinjaJapaneseName) == 0)
+ if (StringCompareWithoutExtCtrlCodes(nickname, sText_ShedinjaJpnName) == 0)
SetMonData(mon, MON_DATA_LANGUAGE, &language);
}
}
@@ -2605,38 +2667,38 @@ u32 sub_80397C4(u32 setId, u32 tableId)
#define sBattler data[0]
#define sSpeciesId data[2]
-void oac_poke_opponent(struct Sprite *sprite)
+void SpriteCb_WildMon(struct Sprite *sprite)
{
- sprite->callback = sub_803980C;
+ sprite->callback = SpriteCb_MoveWildMonToRight;
StartSpriteAnimIfDifferent(sprite, 0);
BeginNormalPaletteFade(0x20000, 0, 10, 10, RGB(8, 8, 8));
}
-static void sub_803980C(struct Sprite *sprite)
+static void SpriteCb_MoveWildMonToRight(struct Sprite *sprite)
{
if ((gIntroSlideFlags & 1) == 0)
{
sprite->pos2.x += 2;
if (sprite->pos2.x == 0)
{
- sprite->callback = sub_8039838;
+ sprite->callback = SpriteCb_WildMonShowHealthbox;
}
}
}
-static void sub_8039838(struct Sprite *sprite)
+static void SpriteCb_WildMonShowHealthbox(struct Sprite *sprite)
{
if (sprite->animEnded)
{
sub_8076918(sprite->sBattler);
SetHealthboxSpriteVisible(gHealthboxSpriteIds[sprite->sBattler]);
- sprite->callback = sub_8039894;
+ sprite->callback = SpriteCb_WildMonAnimate;
StartSpriteAnimIfDifferent(sprite, 0);
BeginNormalPaletteFade(0x20000, 0, 10, 0, RGB(8, 8, 8));
}
}
-static void sub_8039894(struct Sprite *sprite)
+static void SpriteCb_WildMonAnimate(struct Sprite *sprite)
{
if (!gPaletteFade.active)
{
diff --git a/src/field_effect_helpers.c b/src/field_effect_helpers.c
index 3046eccd5..53fd87e61 100755
--- a/src/field_effect_helpers.c
+++ b/src/field_effect_helpers.c
@@ -1228,13 +1228,11 @@ u32 ShowTreeDisguiseFieldEffect(void)
return ShowDisguiseFieldEffect(FLDEFF_TREE_DISGUISE, 24, 4);
}
-
u32 ShowMountainDisguiseFieldEffect(void)
{
return ShowDisguiseFieldEffect(FLDEFF_MOUNTAIN_DISGUISE, 25, 3);
}
-
u32 ShowSandDisguiseFieldEffect(void)
{
return ShowDisguiseFieldEffect(FLDEFF_SAND_DISGUISE, 28, 2);
@@ -1579,3 +1577,19 @@ static void sub_81561FC(struct Sprite *sprite, u8 z, u8 offset)
}
}
}
+
+// Unused data. Feel free to remove.
+static const u8 gUnknown_085CDC6E[] =
+{
+ 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x01, 0x02, 0x02,
+ 0x01, 0x02, 0x02, 0x01, 0x02, 0x02, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x02,
+ 0x01, 0x01, 0x02, 0x01, 0x01, 0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x01,
+ 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x01, 0x01, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF,
+ 0x00, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
+ 0xFF, 0xFF, 0xFF, 0xFE, 0x00, 0x00
+};
diff --git a/src/gpu_regs.c b/src/gpu_regs.c
index 2d48b304a..e5ff4fe8f 100644
--- a/src/gpu_regs.c
+++ b/src/gpu_regs.c
@@ -72,16 +72,20 @@ void SetGpuReg(u8 regOffset, u16 value)
GPU_REG_BUF(regOffset) = value;
vcount = REG_VCOUNT & 0xFF;
- if ((vcount >= 161 && vcount <= 225)
- || (REG_DISPCNT & DISPCNT_FORCED_BLANK)) {
+ if ((vcount >= 161 && vcount <= 225) || (REG_DISPCNT & DISPCNT_FORCED_BLANK))
+ {
CopyBufferedValueToGpuReg(regOffset);
- } else {
+ }
+ else
+ {
s32 i;
sGpuRegBufferLocked = TRUE;
- for (i = 0; i < GPU_REG_BUF_SIZE && sGpuRegWaitingList[i] != EMPTY_SLOT; i++) {
- if (sGpuRegWaitingList[i] == regOffset) {
+ for (i = 0; i < GPU_REG_BUF_SIZE && sGpuRegWaitingList[i] != EMPTY_SLOT; i++)
+ {
+ if (sGpuRegWaitingList[i] == regOffset)
+ {
sGpuRegBufferLocked = FALSE;
return;
}
@@ -99,15 +103,20 @@ void SetGpuReg_ForcedBlank(u8 regOffset, u16 value)
{
GPU_REG_BUF(regOffset) = value;
- if (REG_DISPCNT & DISPCNT_FORCED_BLANK) {
+ if (REG_DISPCNT & DISPCNT_FORCED_BLANK)
+ {
CopyBufferedValueToGpuReg(regOffset);
- } else {
+ }
+ else
+ {
s32 i;
sGpuRegBufferLocked = TRUE;
- for (i = 0; i < GPU_REG_BUF_SIZE && sGpuRegWaitingList[i] != EMPTY_SLOT; i++) {
- if (sGpuRegWaitingList[i] == regOffset) {
+ for (i = 0; i < GPU_REG_BUF_SIZE && sGpuRegWaitingList[i] != EMPTY_SLOT; i++)
+ {
+ if (sGpuRegWaitingList[i] == regOffset)
+ {
sGpuRegBufferLocked = FALSE;
return;
}
@@ -144,7 +153,8 @@ void ClearGpuRegBits(u8 regOffset, u16 mask)
static void SyncRegIE(void)
{
- if (sShouldSyncRegIE) {
+ if (sShouldSyncRegIE)
+ {
u16 temp = REG_IME;
REG_IME = 0;
REG_IE = sRegIE;
diff --git a/src/pokemon.c b/src/pokemon.c
index 6700ef553..319dbdecb 100644
--- a/src/pokemon.c
+++ b/src/pokemon.c
@@ -45,8 +45,6 @@ struct SpeciesItem
u16 item;
};
-extern const struct OamData gUnknown_0831ACB0;
-extern const struct OamData gUnknown_0831ACA8;
extern const struct SpriteFrameImage gUnknown_082FF3A8[];
extern const struct SpriteFrameImage gUnknown_082FF3C8[];
extern const struct SpriteFrameImage gUnknown_082FF3E8[];
@@ -2298,7 +2296,7 @@ const struct SpriteTemplate gUnknown_08329D98[MAX_BATTLERS_COUNT] =
{ // B_POSITION_PLAYER_LEFT
.tileTag = 0xFFFF,
.paletteTag = 0,
- .oam = &gUnknown_0831ACB0,
+ .oam = &gOamData_831ACB0,
.anims = NULL,
.images = gUnknown_082FF3A8,
.affineAnims = gUnknown_082FF618,
@@ -2307,16 +2305,16 @@ const struct SpriteTemplate gUnknown_08329D98[MAX_BATTLERS_COUNT] =
{ // B_POSITION_OPPONENT_LEFT
.tileTag = 0xFFFF,
.paletteTag = 0,
- .oam = &gUnknown_0831ACA8,
+ .oam = &gOamData_831ACA8,
.anims = NULL,
.images = gUnknown_082FF3C8,
.affineAnims = gUnknown_082FF694,
- .callback = oac_poke_opponent,
+ .callback = SpriteCb_WildMon,
},
{ // B_POSITION_PLAYER_RIGHT
.tileTag = 0xFFFF,
.paletteTag = 0,
- .oam = &gUnknown_0831ACB0,
+ .oam = &gOamData_831ACB0,
.anims = NULL,
.images = gUnknown_082FF3E8,
.affineAnims = gUnknown_082FF618,
@@ -2325,11 +2323,11 @@ const struct SpriteTemplate gUnknown_08329D98[MAX_BATTLERS_COUNT] =
{ // B_POSITION_OPPONENT_RIGHT
.tileTag = 0xFFFF,
.paletteTag = 0,
- .oam = &gUnknown_0831ACA8,
+ .oam = &gOamData_831ACA8,
.anims = NULL,
.images = gUnknown_082FF408,
.affineAnims = gUnknown_082FF694,
- .callback = oac_poke_opponent
+ .callback = SpriteCb_WildMon
},
};
@@ -2338,7 +2336,7 @@ static const struct SpriteTemplate gUnknown_08329DF8[] =
{
.tileTag = 0xFFFF,
.paletteTag = 0,
- .oam = &gUnknown_0831ACB0,
+ .oam = &gOamData_831ACB0,
.anims = NULL,
.images = gUnknown_082FF428,
.affineAnims = gUnknown_082FF618,
@@ -2347,7 +2345,7 @@ static const struct SpriteTemplate gUnknown_08329DF8[] =
{
.tileTag = 0xFFFF,
.paletteTag = 0,
- .oam = &gUnknown_0831ACB0,
+ .oam = &gOamData_831ACB0,
.anims = NULL,
.images = gUnknown_082FF448,
.affineAnims = gUnknown_082FF618,
@@ -2356,7 +2354,7 @@ static const struct SpriteTemplate gUnknown_08329DF8[] =
{
.tileTag = 0xFFFF,
.paletteTag = 0,
- .oam = &gUnknown_0831ACB0,
+ .oam = &gOamData_831ACB0,
.anims = NULL,
.images = gUnknown_082FF468,
.affineAnims = gUnknown_082FF618,
@@ -2365,7 +2363,7 @@ static const struct SpriteTemplate gUnknown_08329DF8[] =
{
.tileTag = 0xFFFF,
.paletteTag = 0,
- .oam = &gUnknown_0831ACB0,
+ .oam = &gOamData_831ACB0,
.anims = NULL,
.images = gUnknown_082FF490,
.affineAnims = gUnknown_082FF618,
@@ -2374,7 +2372,7 @@ static const struct SpriteTemplate gUnknown_08329DF8[] =
{
.tileTag = 0xFFFF,
.paletteTag = 0,
- .oam = &gUnknown_0831ACB0,
+ .oam = &gOamData_831ACB0,
.anims = NULL,
.images = gUnknown_082FF4B8,
.affineAnims = gUnknown_082FF618,
@@ -2383,7 +2381,7 @@ static const struct SpriteTemplate gUnknown_08329DF8[] =
{
.tileTag = 0xFFFF,
.paletteTag = 0,
- .oam = &gUnknown_0831ACB0,
+ .oam = &gOamData_831ACB0,
.anims = NULL,
.images = gUnknown_082FF4D8,
.affineAnims = gUnknown_082FF618,
@@ -2392,7 +2390,7 @@ static const struct SpriteTemplate gUnknown_08329DF8[] =
{
.tileTag = 0xFFFF,
.paletteTag = 0,
- .oam = &gUnknown_0831ACB0,
+ .oam = &gOamData_831ACB0,
.anims = NULL,
.images = gUnknown_082FF4F8,
.affineAnims = gUnknown_082FF618,
@@ -2401,7 +2399,7 @@ static const struct SpriteTemplate gUnknown_08329DF8[] =
{
.tileTag = 0xFFFF,
.paletteTag = 0,
- .oam = &gUnknown_0831ACB0,
+ .oam = &gOamData_831ACB0,
.anims = NULL,
.images = gUnknown_082FF518,
.affineAnims = gUnknown_082FF618,
diff --git a/src/rom_8034C54.c b/src/rom_8034C54.c
index ba431778f..cc875bd3f 100644
--- a/src/rom_8034C54.c
+++ b/src/rom_8034C54.c
@@ -3,6 +3,7 @@
#include "alloc.h"
#include "decompress.h"
#include "main.h"
+#include "battle_main.h"
struct UnkStruct2
{
@@ -31,8 +32,6 @@ struct UnkStruct1
struct UnkStruct2 *array;
};
-extern const struct SpriteTemplate gUnknown_0831AC88;
-
// this file's functions
static u8 sub_8035518(u8 arg0);;
static void sub_8034EFC(struct UnkStruct2 *arg0);
diff --git a/src/unk_transition.c b/src/unk_transition.c
index 220570851..7346e06ab 100644
--- a/src/unk_transition.c
+++ b/src/unk_transition.c
@@ -35,11 +35,13 @@ static bool8 sub_81DB290(struct Task *task);
static bool8 sub_81DB328(struct Task *task);
// const rom data
-// TODO: move those from .s file to .c
-extern const u32 gUnknown_0862AD54[];
-extern const u32 gUnknown_0862AF30[];
-extern const u32 gUnknown_0862B0DC[];
-extern const u16 gUnknown_0862B53C[];
+static const u32 gUnknown_0862AD54[] = INCBIN_U32("graphics/battle_transitions/frontier_transition.4bpp.lz");
+static const u32 gUnknown_0862AF30[] = INCBIN_U32("graphics/battle_transitions/frontier_transition.bin");
+static const u32 gUnknown_0862B0DC[] = INCBIN_U32("graphics/battle_transitions/frontier_transition_circles.4bpp.lz");
+static const u16 gUnknown_0862B53C[] = INCBIN_U16("graphics/battle_transitions/frontier_transition.gbapal");
+
+// Unused Empty data. Feel free to delete.
+static const u8 sFiller[0x1C0] = {0};
static const struct OamData sOamData_862B71C =
{