move data to c

This commit is contained in:
DizzyEggg
2018-12-23 14:52:47 +01:00
parent 6d57a9dfc8
commit efa820469a
10 changed files with 105 additions and 227 deletions

View File

@@ -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?

View File

@@ -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,63 @@ 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};
@@ -627,7 +682,7 @@ static void CB2_InitBattleInternal(void)
gScanlineEffectRegBuffers[1][i] = 0xFF10;
}
ScanlineEffect_SetParams(gBattleIntroSlideScanlineEffectParams);
ScanlineEffect_SetParams(sIntroScanlineParams16Bit);
}
ResetPaletteFade();
@@ -2599,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);
}
}
@@ -2612,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)
{

View File

@@ -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
};

View File

@@ -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,

View File

@@ -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);