Merge branch 'master' of github.com:pret/pokeemerald

This commit is contained in:
Diegoisawesome
2018-10-13 12:44:23 -05:00
148 changed files with 11359 additions and 21337 deletions
+12 -15
View File
@@ -16,9 +16,6 @@
#include "palette.h"
#include "main.h"
// sprites start at 10000 and thus must be subtracted of 10000 to account for the true index.
#define GET_TRUE_SPRITE_INDEX(i) ((i - 10000))
#define ANIM_SPRITE_INDEX_COUNT 8
extern u16 gBattle_WIN0H;
@@ -33,8 +30,8 @@ extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern struct MusicPlayerInfo gMPlayInfo_SE1;
extern struct MusicPlayerInfo gMPlayInfo_SE2;
extern const u16 gUnknown_082C8D64[];
extern const u8 * const gBattleAnims_Moves[];
extern const u16 gMovesWithQuietBGM[];
extern const u8 *const gBattleAnims_Moves[];
extern const struct CompressedSpriteSheet gBattleAnimPicTable[];
extern const struct CompressedSpritePalette gBattleAnimPaletteTable[];
extern const struct BattleAnimBackground gBattleAnimBackgroundTable[];
@@ -110,7 +107,7 @@ EWRAM_DATA bool8 gAnimScriptActive = FALSE;
EWRAM_DATA u8 gAnimVisualTaskCount = 0;
EWRAM_DATA u8 gAnimSoundTaskCount = 0;
EWRAM_DATA struct DisableStruct *gAnimDisableStructPtr = NULL;
EWRAM_DATA u32 gAnimMoveDmg = 0;
EWRAM_DATA s32 gAnimMoveDmg = 0;
EWRAM_DATA u16 gAnimMovePower = 0;
EWRAM_DATA static u16 sAnimSpriteIndexArray[ANIM_SPRITE_INDEX_COUNT] = {0};
EWRAM_DATA u8 gAnimFriendship = 0;
@@ -237,7 +234,7 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo
else
{
for (i = 0; i < 4; i++)
gAnimBattlerSpecies[i] = gContestResources->field_18->field_0;
gAnimBattlerSpecies[i] = gContestResources->field_18->unk0;
}
if (!isMoveAnim)
@@ -260,9 +257,9 @@ void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMo
if (isMoveAnim)
{
for (i = 0; gUnknown_082C8D64[i] != 0xFFFF; i++)
for (i = 0; gMovesWithQuietBGM[i] != 0xFFFF; i++)
{
if (tableId == gUnknown_082C8D64[i])
if (tableId == gMovesWithQuietBGM[i])
{
m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFFFF, 128);
break;
@@ -684,7 +681,7 @@ void sub_80A438C(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible)
}
sub_80A6B30(&unknownStruct);
CpuFill16(0, unknownStruct.unk0, 0x1000);
CpuFill16(0, unknownStruct.bgTiles, 0x1000);
CpuFill16(0xFF, unknownStruct.unk4, 0x800);
SetAnimBgAttribute(1, BG_ANIM_PRIORITY, 2);
@@ -694,7 +691,7 @@ void sub_80A438C(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible)
battlerSpriteId = gBattlerSpriteIds[battlerId];
gBattle_BG1_X = -(gSprites[battlerSpriteId].pos1.x + gSprites[battlerSpriteId].pos2.x) + 0x20;
if (IsContest() && IsSpeciesNotUnown(gContestResources->field_18->field_0))
if (IsContest() && IsSpeciesNotUnown(gContestResources->field_18->unk0))
gBattle_BG1_X--;
gBattle_BG1_Y = -(gSprites[battlerSpriteId].pos1.y + gSprites[battlerSpriteId].pos2.y) + 0x20;
@@ -712,7 +709,7 @@ void sub_80A438C(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible)
else
battlerPosition = GetBattlerPosition(battlerId);
sub_8118FBC(1, 0, 0, battlerPosition, unknownStruct.unk8, unknownStruct.unk0, unknownStruct.unk4, unknownStruct.unkA);
sub_8118FBC(1, 0, 0, battlerPosition, unknownStruct.unk8, unknownStruct.bgTiles, unknownStruct.unk4, unknownStruct.tilesOffset);
if (IsContest())
sub_80A46A0();
@@ -722,7 +719,7 @@ void sub_80A438C(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible)
RequestDma3Fill(0, (void*)(VRAM + 0x6000), 0x2000, 1);
RequestDma3Fill(0, (void*)(VRAM + 0xF000), 0x1000, 1);
sub_80A6B90(&unknownStruct, 2);
CpuFill16(0, unknownStruct.unk0 + 0x1000, 0x1000);
CpuFill16(0, unknownStruct.bgTiles + 0x1000, 0x1000);
CpuFill16(0, unknownStruct.unk4 + 0x400, 0x800);
SetAnimBgAttribute(2, BG_ANIM_PRIORITY, 2);
SetAnimBgAttribute(2, BG_ANIM_SCREEN_SIZE, 1);
@@ -742,7 +739,7 @@ void sub_80A438C(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible)
LoadPalette(&gPlttBufferUnfaded[0x100 + battlerId * 16], 0x90, 0x20);
CpuCopy32(&gPlttBufferUnfaded[0x100 + battlerId * 16], (void*)(BG_PLTT + 0x120), 0x20);
sub_8118FBC(2, 0, 0, GetBattlerPosition(battlerId), unknownStruct.unk8, unknownStruct.unk0 + 0x1000, unknownStruct.unk4 + 0x400, unknownStruct.unkA);
sub_8118FBC(2, 0, 0, GetBattlerPosition(battlerId), unknownStruct.unk8, unknownStruct.bgTiles + 0x1000, unknownStruct.unk4 + 0x400, unknownStruct.tilesOffset);
}
}
@@ -752,7 +749,7 @@ static void sub_80A46A0(void)
struct UnknownAnimStruct2 unknownStruct;
u16 *ptr;
if (IsSpeciesNotUnown(gContestResources->field_18->field_0))
if (IsSpeciesNotUnown(gContestResources->field_18->unk0))
{
sub_80A6B30(&unknownStruct);
ptr = unknownStruct.unk4;
File diff suppressed because it is too large Load Diff
+360
View File
@@ -0,0 +1,360 @@
#include "global.h"
#include "battle.h"
#include "battle_anim.h"
#include "constants/battle_anim.h"
#include "constants/rgb.h"
#include "blend_palette.h"
#include "decompress.h"
#include "palette.h"
#include "sprite.h"
#include "task.h"
#include "trig.h"
#include "gpu_regs.h"
extern const struct CompressedSpriteSheet gBattleAnimPicTable[];
extern const struct CompressedSpritePalette gBattleAnimPaletteTable[];
extern const u8 *const gBattleAnims_StatusConditions[];
extern const struct OamData gUnknown_08524904;
extern const struct OamData gUnknown_08524A3C;
extern void sub_8116EB4(u8 taskId);
// This file's functions.
static void sub_80A9DB4(u8 taskId);
static void sub_80A9FD0(u8 taskId);
static void sub_80AA020(u8 taskId);
static void sub_80AA0D0(u8 taskId);
static void sub_80AA124(u8 taskId);
static void Task_DoStatusAnimation(u8 taskId);
static void sub_80A9E44(struct Sprite *sprite);
static void sub_80A9E78(struct Sprite *sprite);
// const rom data
static const struct Subsprite gUnknown_0853EF30[] =
{
{.x = -16, .y = -16, .shape = ST_OAM_SQUARE, .size = 3, .tileOffset = 0, .priority = 2},
{.x = -16, .y = 48, .shape = ST_OAM_H_RECTANGLE, .size = 3, .tileOffset = 64, .priority = 2},
{.x = 48, .y = -16, .shape = ST_OAM_V_RECTANGLE, .size = 3, .tileOffset = 96, .priority = 2},
{.x = 48, .y = 48, .shape = ST_OAM_SQUARE, .size = 2, .tileOffset = 128, .priority = 2},
};
static const struct SubspriteTable gUnknown_0853EF40[] =
{
{ARRAY_COUNT(gUnknown_0853EF30), gUnknown_0853EF30},
};
static const struct SpriteTemplate gUnknown_0853EF48 =
{
.tileTag = ANIM_TAG_ICE_CUBE,
.paletteTag = ANIM_TAG_ICE_CUBE,
.oam = &gUnknown_08524A3C,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
static const struct SpriteTemplate gUnknown_0853EF60 =
{
.tileTag = ANIM_TAG_136,
.paletteTag = ANIM_TAG_136,
.oam = &gUnknown_08524904,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80A9E44,
};
// code
u8 sub_80A9C70(u8 battlerId, bool8 b)
{
u8 battlerSpriteId = gBattlerSpriteIds[battlerId];
u8 taskId = CreateTask(sub_80A9DB4, 10);
u8 spriteId2;
u8 i;
LoadCompressedObjectPicUsingHeap(&gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_136)]);
LoadCompressedObjectPaletteUsingHeap(&gBattleAnimPaletteTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_136)]);
gTasks[taskId].data[0] = battlerId;
if (b)
{
gTasks[taskId].data[1] = RGB_RED;
for (i = 0; i < 10; i++)
{
spriteId2 = CreateSprite(&gUnknown_0853EF60, gSprites[battlerSpriteId].pos1.x, gSprites[battlerSpriteId].pos1.y + 32, 0);
gSprites[spriteId2].data[0] = i * 51;
gSprites[spriteId2].data[1] = -256;
gSprites[spriteId2].invisible = TRUE;
if (i > 4)
gSprites[spriteId2].data[6] = 21;
}
}
else
{
gTasks[taskId].data[1] = RGB_BLUE;
for (i = 0; i < 10; i++)
{
spriteId2 = CreateSprite(&gUnknown_0853EF60, gSprites[battlerSpriteId].pos1.x, gSprites[battlerSpriteId].pos1.y - 32, 0);
gSprites[spriteId2].data[0] = i * 51;
gSprites[spriteId2].data[1] = 256;
gSprites[spriteId2].invisible = TRUE;
if (i > 4)
gSprites[spriteId2].data[6] = 21;
}
}
gSprites[spriteId2].data[7] = 1;
return taskId;
}
static void sub_80A9DB4(u8 taskId)
{
if (gTasks[taskId].data[2] == 2)
{
gTasks[taskId].data[2] = 0;
BlendPalette(0x100 + gTasks[taskId].data[0] * 16, 16, gTasks[taskId].data[4], gTasks[taskId].data[1]);
if (gTasks[taskId].data[5] == 0)
{
gTasks[taskId].data[4]++;
if (gTasks[taskId].data[4] > 8)
gTasks[taskId].data[5] ^= 1;
}
else
{
u16 var = gTasks[taskId].data[4];
gTasks[taskId].data[4]--;
if (gTasks[taskId].data[4] < 0)
{
gTasks[taskId].data[4] = var;
gTasks[taskId].data[5] ^= 1;
gTasks[taskId].data[3]++;
if (gTasks[taskId].data[3] == 2)
DestroyTask(taskId);
}
}
}
else
{
gTasks[taskId].data[2]++;
}
}
static void sub_80A9E44(struct Sprite *sprite)
{
if (sprite->data[6] == 0)
{
sprite->invisible = FALSE;
sprite->callback = sub_80A9E78;
sub_80A9E78(sprite);
}
else
{
sprite->data[6]--;
}
}
static void sub_80A9E78(struct Sprite *sprite)
{
sprite->pos2.x = Cos(sprite->data[0], 32);
sprite->pos2.y = Sin(sprite->data[0], 8);
if (sprite->data[0] < 128)
sprite->subpriority = 29;
else
sprite->subpriority = 31;
sprite->data[0] = (sprite->data[0] + 8) & 0xFF;
sprite->data[5] += sprite->data[1];
sprite->pos2.y += sprite->data[5] >> 8;
sprite->data[2]++;
if (sprite->data[2] == 52)
{
if (sprite->data[7])
DestroySpriteAndFreeResources(sprite);
else
DestroySprite(sprite);
}
}
void sub_80A9EF4(u8 taskId)
{
s16 x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) - 32;
s16 y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_3) - 36;
u8 spriteId;
if (IsContest())
x -= 6;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
spriteId = CreateSprite(&gUnknown_0853EF48, x, y, 4);
if (GetSpriteTileStartByTag(ANIM_TAG_ICE_CUBE) == 0xFFFF)
gSprites[spriteId].invisible = TRUE;
SetSubspriteTables(&gSprites[spriteId], gUnknown_0853EF40);
gTasks[taskId].data[15] = spriteId;
gTasks[taskId].func = sub_80A9FD0;
}
static void sub_80A9FD0(u8 taskId)
{
gTasks[taskId].data[1]++;
if (gTasks[taskId].data[1] == 10)
{
gTasks[taskId].func = sub_80AA020;
gTasks[taskId].data[1] = 0;
}
else
{
u8 var = gTasks[taskId].data[1];
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(var, 16 - var));
}
}
static void sub_80AA020(u8 taskId)
{
u8 palIndex = IndexOfSpritePaletteTag(ANIM_TAG_ICE_CUBE);
if (gTasks[taskId].data[1]++ > 13)
{
gTasks[taskId].data[2]++;
if (gTasks[taskId].data[2] == 3)
{
u16 temp;
temp = gPlttBufferFaded[0x100 + palIndex * 16 + 13];
gPlttBufferFaded[0x100 + palIndex * 16 + 13] = gPlttBufferFaded[0x100 + palIndex * 16 + 14];
gPlttBufferFaded[0x100 + palIndex * 16 + 14] = gPlttBufferFaded[0x100 + palIndex * 16 + 15];
gPlttBufferFaded[0x100 + palIndex * 16 + 15] = temp;
gTasks[taskId].data[2] = 0;
gTasks[taskId].data[3]++;
if (gTasks[taskId].data[3] == 3)
{
gTasks[taskId].data[3] = 0;
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[4]++;
if (gTasks[taskId].data[4] == 2)
{
gTasks[taskId].data[1] = 9;
gTasks[taskId].func = sub_80AA0D0;
}
}
}
}
}
static void sub_80AA0D0(u8 taskId)
{
gTasks[taskId].data[1]--;
if (gTasks[taskId].data[1] == -1)
{
gTasks[taskId].func = sub_80AA124;
gTasks[taskId].data[1] = 0;
}
else
{
u8 var = gTasks[taskId].data[1];
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(var, 16 - var));
}
}
static void sub_80AA124(u8 taskId)
{
gTasks[taskId].data[1]++;
if (gTasks[taskId].data[1] == 37)
{
u8 spriteId = gTasks[taskId].data[15];
FreeSpriteOamMatrix(&gSprites[spriteId]);
DestroySprite(&gSprites[spriteId]);
}
else if (gTasks[taskId].data[1] == 39)
{
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
DestroyAnimVisualTask(taskId);
}
}
#define CASE(by, stat) case (STAT_ANIM_##by + stat - 1)
void AnimTask_StatsChange(u8 taskId)
{
bool16 goesDown = FALSE;
s16 animStatId = 0;
bool16 sharply = FALSE;
switch (gBattleSpritesDataPtr->animationData->animArg)
{
CASE(PLUS1, STAT_ATK): goesDown = FALSE; animStatId = 0; break;
CASE(PLUS1, STAT_DEF): goesDown = FALSE; animStatId = 1; break;
CASE(PLUS1, STAT_SPEED): goesDown = FALSE; animStatId = 3; break;
CASE(PLUS1, STAT_SPATK): goesDown = FALSE; animStatId = 5; break;
CASE(PLUS1, STAT_SPDEF): goesDown = FALSE; animStatId = 6; break;
CASE(PLUS1, STAT_ACC): goesDown = FALSE; animStatId = 2; break;
CASE(PLUS1, STAT_EVASION): goesDown = FALSE; animStatId = 4; break;
CASE(MINUS1, STAT_ATK): goesDown = TRUE; animStatId = 0; break;
CASE(MINUS1, STAT_DEF): goesDown = TRUE; animStatId = 1; break;
CASE(MINUS1, STAT_SPEED): goesDown = TRUE; animStatId = 3; break;
CASE(MINUS1, STAT_SPATK): goesDown = TRUE; animStatId = 5; break;
CASE(MINUS1, STAT_SPDEF): goesDown = TRUE; animStatId = 6; break;
CASE(MINUS1, STAT_ACC): goesDown = TRUE; animStatId = 2; break;
CASE(MINUS1, STAT_EVASION): goesDown = TRUE; animStatId = 4; break;
CASE(PLUS2, STAT_ATK): goesDown = FALSE; animStatId = 0; sharply = TRUE; break;
CASE(PLUS2, STAT_DEF): goesDown = FALSE; animStatId = 1; sharply = TRUE; break;
CASE(PLUS2, STAT_SPEED): goesDown = FALSE; animStatId = 3; sharply = TRUE; break;
CASE(PLUS2, STAT_SPATK): goesDown = FALSE; animStatId = 5; sharply = TRUE; break;
CASE(PLUS2, STAT_SPDEF): goesDown = FALSE; animStatId = 6; sharply = TRUE; break;
CASE(PLUS2, STAT_ACC): goesDown = FALSE; animStatId = 2; sharply = TRUE; break;
CASE(PLUS2, STAT_EVASION): goesDown = FALSE; animStatId = 4; sharply = TRUE; break;
CASE(MINUS2, STAT_ATK): goesDown = TRUE; animStatId = 0; sharply = TRUE; break;
CASE(MINUS2, STAT_DEF): goesDown = TRUE; animStatId = 1; sharply = TRUE; break;
CASE(MINUS2, STAT_SPEED): goesDown = TRUE; animStatId = 3; sharply = TRUE; break;
CASE(MINUS2, STAT_SPATK): goesDown = TRUE; animStatId = 5; sharply = TRUE; break;
CASE(MINUS2, STAT_SPDEF): goesDown = TRUE; animStatId = 6; sharply = TRUE; break;
CASE(MINUS2, STAT_ACC): goesDown = TRUE; animStatId = 2; sharply = TRUE; break;
CASE(MINUS2, STAT_EVASION): goesDown = TRUE; animStatId = 4; sharply = TRUE; break;
case STAT_ANIM_MULTIPLE_PLUS1: goesDown = FALSE; animStatId = 0xFF; sharply = FALSE; break;
case STAT_ANIM_MULTIPLE_PLUS2: goesDown = FALSE; animStatId = 0xFF; sharply = TRUE; break;
case STAT_ANIM_MULTIPLE_MINUS1: goesDown = TRUE; animStatId = 0xFF; sharply = FALSE; break;
case STAT_ANIM_MULTIPLE_MINUS2: goesDown = TRUE; animStatId = 0xFF; sharply = TRUE; break;
default:
DestroyAnimVisualTask(taskId);
return;
}
gBattleAnimArgs[0] = goesDown;
gBattleAnimArgs[1] = animStatId;
gBattleAnimArgs[2] = 0;
gBattleAnimArgs[3] = 0;
gBattleAnimArgs[4] = sharply;
gTasks[taskId].func = sub_8116EB4;
sub_8116EB4(taskId);
}
#undef CASE
void LaunchStatusAnimation(u8 battlerId, u8 statusAnimId)
{
u8 taskId;
gBattleAnimAttacker = battlerId;
gBattleAnimTarget = battlerId;
LaunchBattleAnimation(gBattleAnims_StatusConditions, statusAnimId, 0);
taskId = CreateTask(Task_DoStatusAnimation, 10);
gTasks[taskId].data[0] = battlerId;
}
static void Task_DoStatusAnimation(u8 taskId)
{
gAnimScriptCallback();
if (!gAnimScriptActive)
{
gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].data[0]].statusAnimActive = FALSE;
DestroyTask(taskId);
}
}
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -131,7 +131,7 @@ void sub_8158D8C(u8 taskId)
if (IsContest())
{
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
species = gContestResources->field_18->field_0;
species = gContestResources->field_18->unk0;
else
DestroyAnimVisualTask(taskId); // UB: function should return upon destroying task.
}
@@ -177,7 +177,7 @@ void sub_8158E9C(u8 taskId)
if (IsContest())
{
if (gBattleAnimArgs[0] == ANIM_ATTACKER)
species = gContestResources->field_18->field_0;
species = gContestResources->field_18->unk0;
else
DestroyAnimVisualTask(taskId); // UB: function should return upon destroying task.
}
@@ -281,7 +281,7 @@ void sub_81590B8(u8 taskId)
pan = BattleAnimAdjustPanning(PAN_SIDE_PLAYER);
if (IsContest())
species = gContestResources->field_18->field_0;
species = gContestResources->field_18->unk0;
else
species = gAnimBattlerSpecies[gBattleAnimAttacker];
+6 -6
View File
@@ -29,7 +29,7 @@ extern struct MusicPlayerInfo gMPlayInfo_SE2;
extern struct MusicPlayerInfo gMPlayInfo_BGM;
extern const u8 gUnknown_0831C604[];
extern const u8 * const gBattleAnims_VariousTable[];
extern const u8 * const gBattleAnims_General[];
extern const u8 * const gBattleAnims_Special[];
extern const struct CompressedSpriteSheet gMonFrontPicTable[];
extern const struct CompressedSpriteSheet gMonBackPicTable[];
@@ -437,7 +437,7 @@ bool8 TryHandleLaunchBattleTableAnimation(u8 activeBattler, u8 atkBattler, u8 de
gBattleAnimAttacker = atkBattler;
gBattleAnimTarget = defBattler;
gBattleSpritesDataPtr->animationData->animArg = argument;
LaunchBattleAnimation(gBattleAnims_VariousTable, tableId, FALSE);
LaunchBattleAnimation(gBattleAnims_General, tableId, FALSE);
taskId = CreateTask(Task_ClearBitWhenBattleTableAnimDone, 10);
gTasks[taskId].tBattlerId = activeBattler;
gBattleSpritesDataPtr->healthBoxesData[gTasks[taskId].tBattlerId].animFromTableActive = 1;
@@ -899,14 +899,14 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform
if (IsContest())
{
position = 0;
targetSpecies = gContestResources->field_18->field_2;
personalityValue = gContestResources->field_18->field_8;
otId = gContestResources->field_18->field_C;
targetSpecies = gContestResources->field_18->unk2;
personalityValue = gContestResources->field_18->unk8;
otId = gContestResources->field_18->unkC;
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[targetSpecies],
gMonSpritesGfxPtr->sprites[0],
targetSpecies,
gContestResources->field_18->field_10);
gContestResources->field_18->unk10);
}
else
{
+13 -12
View File
@@ -3,6 +3,7 @@
#include "constants/battle_move_effects.h"
#include "constants/battle_script_commands.h"
#include "battle_message.h"
#include "battle_anim.h"
#include "battle_ai_script_commands.h"
#include "battle_scripts.h"
#include "constants/moves.h"
@@ -4381,16 +4382,16 @@ static void atk47_setgraphicalstatchangevalues(void)
switch (GET_STAT_BUFF_VALUE2(gBattleScripting.statChanger))
{
case SET_STAT_BUFF_VALUE(1): // +1
value = 0xF;
value = STAT_ANIM_PLUS1;
break;
case SET_STAT_BUFF_VALUE(2): // +2
value = 0x27;
value = STAT_ANIM_PLUS2;
break;
case SET_STAT_BUFF_VALUE(1) | STAT_BUFF_NEGATIVE: // -1
value = 0x16;
value = STAT_ANIM_MINUS1;
break;
case SET_STAT_BUFF_VALUE(2) | STAT_BUFF_NEGATIVE: // -2
value = 0x2E;
value = STAT_ANIM_MINUS2;
break;
}
gBattleScripting.animArg1 = GET_STAT_BUFF_ID(gBattleScripting.statChanger) + value - 1;
@@ -4412,9 +4413,9 @@ static void atk48_playstatchangeanimation(void)
{
s16 startingStatAnimId;
if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO)
startingStatAnimId = 0x2D;
startingStatAnimId = STAT_ANIM_MINUS2 - 1;
else
startingStatAnimId = 0x15;
startingStatAnimId = STAT_ANIM_MINUS1 - 1;
while (statsToCheck != 0)
{
@@ -4447,18 +4448,18 @@ static void atk48_playstatchangeanimation(void)
if (changeableStatsCount > 1) // more than one stat, so the color is gray
{
if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO)
statAnimId = 0x3A;
statAnimId = STAT_ANIM_MULTIPLE_MINUS2;
else
statAnimId = 0x39;
statAnimId = STAT_ANIM_MULTIPLE_MINUS1;
}
}
else // goes up
{
s16 startingStatAnimId;
if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO)
startingStatAnimId = 0x26;
startingStatAnimId = STAT_ANIM_PLUS2 - 1;
else
startingStatAnimId = 0xE;
startingStatAnimId = STAT_ANIM_PLUS1 - 1;
while (statsToCheck != 0)
{
@@ -4473,9 +4474,9 @@ static void atk48_playstatchangeanimation(void)
if (changeableStatsCount > 1) // more than one stat, so the color is gray
{
if (gBattlescriptCurrInstr[3] & ATK48_STAT_BY_TWO)
statAnimId = 0x38;
statAnimId = STAT_ANIM_MULTIPLE_PLUS2;
else
statAnimId = 0x37;
statAnimId = STAT_ANIM_MULTIPLE_PLUS1;
}
}
+1 -1
View File
@@ -2535,7 +2535,7 @@ u8 sub_80DB174(u16 species, u32 otId, u32 personality, u32 index)
LoadCompressedPalette(GetFrontSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x120, 0x20);
SetMultiuseSpriteTemplateToPokemon(species, 0);
spriteId = CreateSprite(&gMultiuseSpriteTemplate, 0x70, sub_80A600C(2, species, 0), 30);
spriteId = CreateSprite(&gMultiuseSpriteTemplate, 0x70, GetBattlerSpriteFinal_Y(2, species, FALSE), 30);
gSprites[spriteId].oam.paletteNum = 2;
gSprites[spriteId].oam.priority = 2;
gSprites[spriteId].subpriority = sub_80A82E4(2);
@@ -1,4 +1,4 @@
const struct MonCoords gUnknown_083021D8[] =
const struct MonCoords gMonBackPicCoords[] =
{
{0x88, 0x00}, // SPECIES_NONE
{0x64, 0x10}, // SPECIES_BULBASAUR
+49 -52
View File
@@ -25,6 +25,7 @@
#include "blend_palette.h"
#include "title_screen.h"
#include "constants/rgb.h"
#include "constants/battle_anim.h"
extern const struct CompressedSpriteSheet gBattleAnimPicTable[];
extern const struct CompressedSpritePalette gBattleAnimPaletteTable[];
@@ -118,7 +119,7 @@ static const struct SpriteTemplate gUnknown_085E4AB8 =
};
static const u8 gUnknown_085E4AD0[][2] =
{
{0x7C, 0x28},
{0x7C, 0x28},
{0x66, 0x1E},
{0x4D, 0x1E},
{0x36, 0x0F},
@@ -664,25 +665,25 @@ static const s16 gUnknown_085E4E94[][2] =
{5, 20},
{3, 28},
};
static const union AffineAnimCmd gUnknown_085E4ED8[] =
static const union AffineAnimCmd gUnknown_085E4ED8[] =
{
AFFINEANIMCMD_FRAME(128, 128, 0, 0),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd gUnknown_085E4EE8[] =
static const union AffineAnimCmd gUnknown_085E4EE8[] =
{
AFFINEANIMCMD_FRAME(128, 128, 0, 0),
AFFINEANIMCMD_FRAME(16, 16, 0, 16),
AFFINEANIMCMD_FRAME(-16, -16, 0, 8),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd gUnknown_085E4F08[] =
static const union AffineAnimCmd gUnknown_085E4F08[] =
{
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
AFFINEANIMCMD_FRAME(8, 8, 0, 48),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd gUnknown_085E4F20[] =
static const union AffineAnimCmd gUnknown_085E4F20[] =
{
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
AFFINEANIMCMD_FRAME(2, 2, 0, 48),
@@ -695,7 +696,7 @@ static const union AffineAnimCmd *const gUnknown_085E4F38[] =
gUnknown_085E4F08,
gUnknown_085E4F20,
};
static const u16 gUnknown_085E4F48[] =
static const u16 gUnknown_085E4F48[] =
{
0x100, 0xC0, 0x80, 0x40, 0x00, 0x40, 0x80, 0xC0, 0x100
};
@@ -1086,10 +1087,10 @@ static void Task_IntroWaterDrops(u8 taskId)
if (gIntroFrameCounter == 256)
CreateTask(Task_IntroWaterDrops_2, 0);
if (gIntroFrameCounter == 368)
CreateWaterDrop(48, 0, 0x400, 5, 0x70, TRUE);
if (gIntroFrameCounter == 384)
CreateWaterDrop(200, 60, 0x400, 9, 0x80, TRUE);
@@ -1113,7 +1114,7 @@ static void Task_IntroWaterDrops_3(u8 taskId)
s16 *data = gTasks[taskId].data;
if (++data[2] & 1)
data[3]++;
switch (data[0])
{
case 0:
@@ -1127,7 +1128,7 @@ static void Task_IntroWaterDrops_3(u8 taskId)
data[0] = 0;
break;
}
if (data[3] > 0x3C)
DestroyTask(taskId);
}
@@ -1206,25 +1207,25 @@ static void Task_IntroStartBikeRide(u8 taskId)
LoadCompressedObjectPic(gIntro2BrendanSpriteSheet);
else
LoadCompressedObjectPic(gIntro2MaySpriteSheet);
LoadCompressedObjectPic(gIntro2BicycleSpriteSheet);
LoadCompressedObjectPic(gIntro2FlygonSpriteSheet);
for (spriteId = 0; spriteId < 3; spriteId++)
{
LoadCompressedObjectPic(&gUnknown_085E4AE8[spriteId]);
}
LoadSpritePalettes(gUnknown_085F530C);
LoadSpritePalettes(gUnknown_085E4B08);
CreateSprite(&gUnknown_085E4BDC, 0x110, 0x80, 0);
CreateSprite(&gUnknown_085E4BA4, 0x120, 0x6E, 1);
if (gUnknown_0203BCC8 == 0)
spriteId = intro_create_brendan_sprite(0x110, 100);
else
spriteId = intro_create_may_sprite(0x110, 100);
gSprites[spriteId].callback = sub_816F9D4;
gSprites[spriteId].anims = gUnknown_085E4DC4;
gTasks[taskId].data[1] = spriteId;
@@ -1243,7 +1244,7 @@ static void Task_IntroHandleBikeAndFlygonMovement(u8 taskId)
{
s16 a;
u16 sine;
if (gIntroFrameCounter == 1856)
{
gUnknown_0203BD28 = 2;
@@ -1427,7 +1428,7 @@ static void sub_816D9C0(struct Sprite *sprite)
case 4:
if (sprite->animEnded)
sprite->pos1.x += 4;
if (sprite->pos1.x > 336)
{
StartSpriteAnim(sprite, 1);
@@ -1506,7 +1507,7 @@ static void Task_IntroLoadPart3Graphics(u8 taskId)
static void Task_IntroSpinAndZoomPokeball(u8 taskId)
{
gTasks[taskId].data[0] += 0x400;
if (gTasks[taskId].data[1] <= 0x6BF)
{
gTasks[taskId].data[1] += gTasks[taskId].data[2];
@@ -1516,9 +1517,9 @@ static void Task_IntroSpinAndZoomPokeball(u8 taskId)
{
gTasks[taskId].func = Task_IntroWaitToSetupPart3LegendsFight;
}
sub_816F2A8(0x78, 0x50, 0x10000 / gTasks[taskId].data[1], gTasks[taskId].data[0]);
if (gIntroFrameCounter == 28)
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_WHITEALPHA);
}
@@ -1531,8 +1532,6 @@ static void Task_IntroWaitToSetupPart3LegendsFight(u8 taskId)
static void Task_IntroLoadPart1Graphics3(u8 taskId)
{
u16 i;
if (!gPaletteFade.active)
{
intro_reset_and_hide_bgs();
@@ -1543,8 +1542,8 @@ static void Task_IntroLoadPart1Graphics3(u8 taskId)
LZDecompressVram(gIntro3GroudonTilemap, (void *)(VRAM + 0xC000));
LZDecompressVram(gIntro3LegendBgGfx, (void *)(VRAM + 0x4000));
LZDecompressVram(gIntro3GroudonBgTilemap, (void *)(VRAM + 0xE000));
LoadCompressedObjectPicUsingHeap(&gBattleAnimPicTable[0x3A]);
LoadCompressedObjectPaletteUsingHeap(&gBattleAnimPaletteTable[0x3A]);
LoadCompressedObjectPicUsingHeap(&gBattleAnimPicTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_058)]);
LoadCompressedObjectPaletteUsingHeap(&gBattleAnimPaletteTable[GET_TRUE_SPRITE_INDEX(ANIM_TAG_058)]);
CpuCopy16(gIntro3BgPal, gPlttBufferUnfaded, sizeof(gIntro3BgPal));
gTasks[taskId].func = Task_IntroLoadPart1Graphics4;
}
@@ -1584,12 +1583,10 @@ static void Task_IntroLoadPart1Graphics4(u8 taskId)
static void Task_IntroLoadPart1Graphics5(u8 taskId)
{
u16 foo = gTasks[taskId].data[0];
if (gTasks[taskId].data[0] != 32)
{
gTasks[taskId].data[0] += 4;
SetGpuReg(REG_OFFSET_WIN0V, (gTasks[taskId].data[0] * 256) - (foo -= 0x9C));
SetGpuReg(REG_OFFSET_WIN0V, (gTasks[taskId].data[0] * 256) - (gTasks[taskId].data[0] - 160));
}
else
{
@@ -1613,7 +1610,7 @@ static void Task_IntroLoadPart1Graphics7(u8 taskId)
static void Task_IntroLoadPart1Graphics8(u8 taskId)
{
s16 *data = gTasks[taskId].data;
data[5]++;
if ((u16)(data[0] - 1) < 7 && data[5] % 2 == 0)
data[4] ^= 3;
@@ -1720,7 +1717,7 @@ static void sub_816E190(u8 a0)
{
int i;
u8 spriteId;
for (i = 0; i < 6; i++)
{
spriteId = CreateSprite(gUnknown_08596C10, gUnknown_085E4C64[i][0], 0xA0, i);
@@ -1737,7 +1734,7 @@ static void sub_816E1F8(struct Sprite *sprite)
sprite->data[3]++;
if (sprite->data[3] % 2 == 0)
sprite->pos2.y ^= 3;
switch(sprite->data[0])
{
case 0:
@@ -1752,7 +1749,7 @@ static void sub_816E1F8(struct Sprite *sprite)
sprite->pos1.x -= 2;
else
sprite->pos1.x += 2;
if (sprite->pos1.y < 0x50)
sprite->pos1.y -= 2;
else
@@ -1783,9 +1780,9 @@ static void Task_IntroLoadPart1Graphics9(u8 taskId)
static void Task_IntroFadeIn0(u8 taskId)
{
s16 *data = gTasks[taskId].data;
sub_816F2A8(data[1], data[2], data[3], 0);
switch (data[0])
{
case 0:
@@ -1928,7 +1925,7 @@ static void sub_816E6D4(u8 a0)
{
int i;
u8 spriteId;
for (i = 0; i < 6; i++)
{
spriteId = CreateSprite(&gUnknown_085E4D14, gUnknown_085E4CA8[i][0], gUnknown_085E4CA8[i][1], i);
@@ -1943,7 +1940,7 @@ static void sub_816E74C(void)
{
int i;
u8 spriteId;
for (i = 0; i < 6; i++)
{
spriteId = CreateSprite(&gUnknown_085E4D14, gUnknown_085E4CA8[i + 6][0], gUnknown_085E4CA8[i + 6][1], i);
@@ -1980,7 +1977,7 @@ static void sub_816E7B4(struct Sprite *sprite)
sprite->pos1.x -= 3;
else
sprite->pos1.x += 3;
if (sprite->pos1.y < 80)
sprite->pos1.y -= 3;
else
@@ -2053,10 +2050,10 @@ static void Task_IntroFadeIn3(u8 taskId)
static void Task_IntroFadeIn4(u8 taskId)
{
s16 *data = gTasks[taskId].data;
SetGpuReg(REG_OFFSET_BG0HOFS, (data[6] >> 8));
SetGpuReg(REG_OFFSET_BG1HOFS, -(data[6] >> 8));
switch (data[0])
{
case 0:
@@ -2070,7 +2067,7 @@ static void Task_IntroFadeIn4(u8 taskId)
case 1:
if (data[6] == 0x2800)
BeginNormalPaletteFade(0x0000FFFE, 3, 0, 16, RGB(9, 10, 10));
if (data[6] != 0)
data[6] -= 0x80;
else if (!gPaletteFade.active)
@@ -2103,7 +2100,7 @@ static void Task_IntroFadeIn6(u8 taskId)
{
s16 *data = gTasks[taskId].data;
u8 spriteId;
switch (data[0])
{
case 0:
@@ -2141,7 +2138,7 @@ static void sub_816EC6C(struct Sprite *sprite)
{
if (sprite->animEnded)
sprite->invisible = TRUE;
switch(sprite->data[0])
{
case 0:
@@ -2171,7 +2168,7 @@ static void sub_816EC6C(struct Sprite *sprite)
static void Task_IntroFadeIn7(u8 taskId)
{
u8 newTaskId;
LoadCompressedObjectPic(gUnknown_085E5048);
LoadSpritePalettes(gUnknown_085E5058);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0
@@ -2194,12 +2191,12 @@ static void Task_IntroFadeIn7(u8 taskId)
static void Task_IntroFadeIn8(u8 taskId)
{
s16 *data = gTasks[taskId].data;
if (data[7] % 2 == 0)
data[6] ^= 2;
data[7]++;
switch(data[0])
{
case 0:
@@ -2248,9 +2245,9 @@ static void sub_816EEA8(u8 taskId)
{
u8 spriteId;
s16 *data = gTasks[taskId].data;
data[2]++;
switch(data[0])
{
case 0:
@@ -2377,7 +2374,7 @@ static void Task_IntroWaterDrops_1(u8 taskId)
if (gTasks[taskId].data[1] != 0)
{
u8 tmp;
gTasks[taskId].data[1]--;
tmp = gTasks[taskId].data[1] / 2;
SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0853FF70[tmp]);
@@ -2420,7 +2417,7 @@ static void Task_IntroWaterDrops_2(u8 taskId)
if (gTasks[taskId].data[1] < 62)
{
u8 tmp;
gTasks[taskId].data[1]++;
tmp = gTasks[taskId].data[1] / 2;
SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0853FF70[tmp]);
@@ -2903,7 +2900,7 @@ static u8 sub_816FDB8(s16 a0, s16 a1, s16 a2)
{
u16 i;
u8 spriteId;
for (i = 0; i < 9; i++)
{
spriteId = CreateSprite(&gUnknown_085E4F5C, gUnknown_085E4E94[i][1] + a0, a1 - 4, 0);
@@ -2926,7 +2923,7 @@ static u8 sub_816FDB8(s16 a0, s16 a1, s16 a2)
static void sub_816FEDC(struct Sprite *sprite)
{
sprite->data[7]++;
if (sprite->data[0] != 0)
{
s16 sin1;
@@ -2944,7 +2941,7 @@ static void sub_816FEDC(struct Sprite *sprite)
SetOamMatrix(1, a, b, c, d);
}
switch (sprite->data[0])
{
case 0:
+12 -12
View File
@@ -19,10 +19,10 @@ struct CompressedTilesPal
const u8 *pal;
};
extern void sub_80D5860(struct Sprite *sprite);
extern void sub_80D58F8(struct Sprite *sprite);
extern void sub_80D5968(struct Sprite *sprite);
extern void sub_80D5A94(struct Sprite *sprite);
extern void DoHorizontalLunge(struct Sprite *sprite);
extern void DoVerticalDip(struct Sprite *sprite);
extern void SlideMonToOriginalPos(struct Sprite *sprite);
extern void SlideMonToOffset(struct Sprite *sprite);
extern void sub_80D5B48(struct Sprite *sprite);
// this file's functions
@@ -414,7 +414,7 @@ static const struct SpriteTemplate gUnknown_0857FE10 =
.callback = SpriteCallbackDummy,
};
const struct SpriteTemplate gUnknown_0857FE28 =
const struct SpriteTemplate gHorizontalLungeSpriteTemplate =
{
.tileTag = 0,
.paletteTag = 0,
@@ -422,10 +422,10 @@ const struct SpriteTemplate gUnknown_0857FE28 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80D5860,
.callback = DoHorizontalLunge,
};
const struct SpriteTemplate gUnknown_0857FE40 =
const struct SpriteTemplate gVerticalDipSpriteTemplate =
{
.tileTag = 0,
.paletteTag = 0,
@@ -433,10 +433,10 @@ const struct SpriteTemplate gUnknown_0857FE40 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80D58F8,
.callback = DoVerticalDip,
};
const struct SpriteTemplate gUnknown_0857FE58 =
const struct SpriteTemplate gSlideMonToOriginalPosSpriteTemplate =
{
.tileTag = 0,
.paletteTag = 0,
@@ -444,10 +444,10 @@ const struct SpriteTemplate gUnknown_0857FE58 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80D5968,
.callback = SlideMonToOriginalPos,
};
const struct SpriteTemplate gUnknown_0857FE70 =
const struct SpriteTemplate gSlideMonToOffsetSpriteTemplate =
{
.tileTag = 0,
.paletteTag = 0,
@@ -455,7 +455,7 @@ const struct SpriteTemplate gUnknown_0857FE70 =
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = sub_80D5A94,
.callback = SlideMonToOffset,
};
const struct SpriteTemplate gUnknown_0857FE88 =
+1 -1
View File
@@ -33,7 +33,7 @@ static void VCountIntr(void);
static void SerialIntr(void);
static void IntrDummy(void);
const u8 gGameVersion = VERSION_EMERALD;
const u8 gGameVersion = GAME_VERSION;
const u8 gGameLanguage = GAME_LANGUAGE; // English
+7 -7
View File
@@ -378,8 +378,8 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
gSprites[ballSpriteId].callback = SpriteCB_PlayerMonSendOut_1;
break;
case POKEBALL_OPPONENT_SENDOUT:
gSprites[ballSpriteId].pos1.x = GetBattlerSpriteCoord(battlerId, BANK_X_POS);
gSprites[ballSpriteId].pos1.y = GetBattlerSpriteCoord(battlerId, BANK_Y_POS) + 24;
gSprites[ballSpriteId].pos1.x = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_X);
gSprites[ballSpriteId].pos1.y = GetBattlerSpriteCoord(battlerId, BATTLER_COORD_Y) + 24;
gBattlerTarget = battlerId;
gSprites[ballSpriteId].data[0] = 0;
gSprites[ballSpriteId].callback = SpriteCB_OpponentMonSendOut;
@@ -399,8 +399,8 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
// this will perform an unused ball throw animation
gSprites[ballSpriteId].data[0] = 0x22;
gSprites[ballSpriteId].data[2] = GetBattlerSpriteCoord(gBattlerTarget, BANK_X_POS);
gSprites[ballSpriteId].data[4] = GetBattlerSpriteCoord(gBattlerTarget, BANK_Y_POS) - 16;
gSprites[ballSpriteId].data[2] = GetBattlerSpriteCoord(gBattlerTarget, BATTLER_COORD_X);
gSprites[ballSpriteId].data[4] = GetBattlerSpriteCoord(gBattlerTarget, BATTLER_COORD_Y) - 16;
gSprites[ballSpriteId].data[5] = -40;
sub_80A68D4(&gSprites[ballSpriteId]);
gSprites[ballSpriteId].oam.affineParam = taskId;
@@ -411,7 +411,7 @@ static void Task_DoPokeballSendOutAnim(u8 taskId)
static void SpriteCB_TestBallThrow(struct Sprite *sprite)
{
if (AnimateBallThrow(sprite))
if (TranslateAnimArc(sprite))
{
u16 ballId;
u8 taskId = sprite->oam.affineParam;
@@ -922,7 +922,7 @@ static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite)
StartSpriteAffineAnim(sprite, 4);
}
r4 = sprite->data[0];
sub_80A6F3C(sprite);
TranslateAnimLinear(sprite);
sprite->data[7] += sprite->sBattler / 3;
sprite->pos2.y += Sin(HIBYTE(sprite->data[7]), sprite->data[5]);
sprite->oam.affineParam += 0x100;
@@ -940,7 +940,7 @@ static void SpriteCB_PlayerMonSendOut_2(struct Sprite *sprite)
}
else
{
if (AnimateBallThrow(sprite))
if (TranslateAnimArc(sprite))
{
sprite->pos1.x += sprite->pos2.x;
sprite->pos1.y += sprite->pos2.y;