Finish decompile ghost

This commit is contained in:
KDSKardabox 2018-12-09 18:38:15 +05:30
parent 8712757d24
commit 4233ae50c3
3 changed files with 165 additions and 2589 deletions

File diff suppressed because it is too large Load Diff

View File

@ -168,7 +168,6 @@ SECTIONS {
src/bug.o(.text);
src/rock.o(.text);
src/ghost.o(.text);
asm/ghost.o(.text);
src/dragon.o(.text);
asm/dark.o(.text);
src/ground.o(.text);

View File

@ -1,10 +1,14 @@
#include "global.h"
#include "battle.h"
#include "battle_anim.h"
#include "gpu_regs.h"
#include "palette.h"
#include "constants/rgb.h"
#include "scanline_effect.h"
#include "constants/songs.h"
#include "sound.h"
#include "trig.h"
#include "util.h"
static void sub_811160C(struct Sprite *);
static void sub_8111674(struct Sprite *);
@ -18,11 +22,25 @@ static void InitAnimShadowBall(struct Sprite *);
static void AnimShadowBallStep(struct Sprite *);
static void sub_8111B9C(struct Sprite *);
static void sub_8111BB4(struct Sprite *);
extern void sub_8112264(struct Sprite *);
extern void sub_81129F0(struct Sprite *);
extern void sub_8112B78(struct Sprite *);
extern void sub_8112E9C(struct Sprite *);
extern void sub_8112F60(struct Sprite *);
static void sub_8111D78(u8 taskId);
static void sub_8111E78(u8 taskId);
static void sub_81120DC(u8 taskId);
static void sub_8112170(u8 taskId);
static void sub_8112264(struct Sprite *);
static void sub_8112384(struct Sprite *);
static void sub_81125E0(u8 taskId);
static void sub_811280C(u8 taskId);
static void sub_8112994(u8 taskId);
static void sub_81129F0(struct Sprite *);
static void sub_8112A4C(struct Sprite *);
static void sub_8112ACC(struct Sprite *);
static void sub_8112B44(struct Sprite *);
static void sub_8112B78(struct Sprite *);
static void sub_8112C4C(struct Sprite *);
static void sub_8112D10(u8 taskId);
static void sub_8112E9C(struct Sprite *);
static void sub_8112F60(struct Sprite *);
static void sub_8112FB8(struct Sprite *);
const union AffineAnimCmd gUnknown_08596CF8[] =
{
@ -208,7 +226,7 @@ static void sub_811160C(struct Sprite *sprite)
sub_80A6FD4(sprite);
sprite->callback = sub_8111674;
sprite->data[6] = 16;
SetGpuReg(REG_OFFSET_BLDCNT, 0x3F40);
SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL));
SetGpuReg(REG_OFFSET_BLDALPHA, sprite->data[6]);
}
@ -321,8 +339,8 @@ static void sub_8111814(struct Sprite *sprite)
void sub_811188C(u8 taskId)
{
u8 spriteId;
SetGpuReg(REG_OFFSET_BLDCNT, 0x3F40);
SetGpuReg(REG_OFFSET_BLDALPHA, 0x1000);
SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL));
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 0x10));
spriteId = GetAnimBattlerSpriteId(0);
sub_80A7270(spriteId, 1);
obj_id_set_rotscale(spriteId, 128, 128, 0);
@ -342,7 +360,7 @@ static void sub_8111914(u8 taskId)
gTasks[taskId].data[10] = 0;
gTasks[taskId].data[2] += 1;
gTasks[taskId].data[3] -= 1;
SetGpuReg(REG_OFFSET_BLDALPHA, gTasks[taskId].data[3] << 8 | gTasks[taskId].data[2]);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[2], gTasks[taskId].data[3]));
if (gTasks[taskId].data[2] != 9)
return;
@ -487,9 +505,7 @@ static void sub_8111BB4(struct Sprite *sprite) {
}
}
/*
void sub_80DE1B0(u8 taskId)
void sub_8111C50(u8 taskId)
{
struct Task *task;
@ -504,10 +520,10 @@ void sub_80DE1B0(u8 taskId)
task->data[2] = 15;
task->data[3] = 2;
task->data[4] = 0;
REG_BLDCNT = 0x3F40;
REG_BLDALPHA = (task->data[3] << 8) | task->data[2];
SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL));
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[2], task->data[3]));
gSprites[task->data[0]].data[0] = 80;
if (GetBattlerSide(gAnimBankTarget) == 0)
if (GetBattlerSide(gBattleAnimTarget) == 0)
{
gSprites[task->data[0]].data[1] = -144;
gSprites[task->data[0]].data[2] = 112;
@ -519,12 +535,12 @@ void sub_80DE1B0(u8 taskId)
}
gSprites[task->data[0]].data[3] = 0;
gSprites[task->data[0]].data[4] = 0;
StoreSpriteCallbackInData(&gSprites[task->data[0]], SpriteCallbackDummy);
gSprites[task->data[0]].callback = sub_8078394;
task->func = sub_80DE2DC;
StoreSpriteCallbackInData6(&gSprites[task->data[0]], SpriteCallbackDummy);
gSprites[task->data[0]].callback = sub_80A656C;
task->func = sub_8111D78;
}
static void sub_80DE2DC(u8 taskId)
static void sub_8111D78(u8 taskId)
{
struct Task *task;
@ -540,7 +556,7 @@ static void sub_80DE2DC(u8 taskId)
if (task->data[5] == 3)
if (task->data[3] <= 15)
task->data[3] += 1;
REG_BLDALPHA = (task->data[3] << 8) | task->data[2];
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[2], task->data[3]));
if (task->data[3] != 16 || task->data[2] != 0)
break;
if (task->data[1] <= 80)
@ -551,8 +567,8 @@ static void sub_80DE2DC(u8 taskId)
case 1:
if (++task->data[6] <= 1)
break;
REG_BLDCNT = 0;
REG_BLDALPHA = 0;
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
task->data[4] += 1;
break;
case 2:
@ -560,27 +576,27 @@ static void sub_80DE2DC(u8 taskId)
}
}
void sub_80DE3AC(u8 taskId)
void sub_8111E50(u8 taskId)
{
struct Task *task;
task = &gTasks[taskId];
task->data[15] = 0;
task->func = sub_80DE3D4;
task->func = sub_8111E78;
task->func(taskId);
}
static void sub_80DE3D4(u8 taskId)
static void sub_8111E78(u8 taskId)
{
s16 startLine;
struct Task *task = &gTasks[taskId];
u8 position = GetBattlerPosition_permutated(gAnimBankTarget);
u8 position = sub_80A8364(gBattleAnimTarget);
switch (task->data[15])
{
case 0:
task->data[14] = AllocSpritePalette(0x2771);
if (task->data[14] == 0xFF)
if (task->data[14] == 0xFF || task->data[14] == 0xF)
{
DestroyAnimVisualTask(taskId);
}
@ -594,19 +610,25 @@ static void sub_80DE3D4(u8 taskId)
}
else
{
s16 mask2;
gSprites[task->data[0]].oam.paletteNum = task->data[14];
gSprites[task->data[0]].oam.objMode = ST_OAM_OBJ_NORMAL;
gSprites[task->data[0]].oam.priority = 3;
gSprites[task->data[0]].invisible = (gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].invisible);
task->data[1] = 0;
task->data[2] = 0;
task->data[3] = 16;
task->data[13] = GetAnimBattlerSpriteId(1);
task->data[4] = (gSprites[task->data[13]].oam.paletteNum + 16) * 16;
if (position == 1)
REG_DISPCNT &= 0xFDFF;
else
REG_DISPCNT &= 0xFBFF;
if (position == 1) {
u16 mask = DISPCNT_BG1_ON;
mask2 = mask;
}
else {
u16 mask = DISPCNT_BG2_ON;
mask2 = mask;
}
ClearGpuRegBits(REG_OFFSET_DISPCNT, mask2);
task->data[15]++;
}
}
@ -631,20 +653,20 @@ static void sub_80DE3D4(u8 taskId)
break;
case 3:
if (position == 1)
REG_BLDCNT = 0x3F42;
SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL | BLDCNT_TGT1_BG1));
else
REG_BLDCNT = 0x3F44;
SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL | BLDCNT_TGT1_BG2));
REG_BLDALPHA = 0x1000;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 0x10));
task->data[15]++;
break;
case 4:
if (position == 1)
REG_DISPCNT |= DISPCNT_BG1_ON;
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG1_ON);
else
REG_DISPCNT |= DISPCNT_BG2_ON;
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON);
task->func = sub_80DE61C;
task->func = sub_81120DC;
task->data[15]++;
break;
default:
@ -653,7 +675,7 @@ static void sub_80DE3D4(u8 taskId)
}
}
static void sub_80DE61C(u8 taskId)
static void sub_81120DC(u8 taskId)
{
struct Task *task = &gTasks[taskId];
task->data[1]++;
@ -664,19 +686,19 @@ static void sub_80DE61C(u8 taskId)
if (task->data[5] == 1)
task->data[3] = 16 - (gSineTable[task->data[1]] / 18);
REG_BLDALPHA = (task->data[3] << 8) | task->data[2];
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[2], task->data[3]));
if (task->data[1] == 128)
{
task->data[15] = 0;
task->func = sub_80DE6B0;
task->func = sub_8112170;
task->func(taskId);
}
}
static void sub_80DE6B0(u8 taskId)
static void sub_8112170(u8 taskId)
{
struct Task *task = &gTasks[taskId];
u8 position = GetBattlerPosition_permutated(gAnimBankTarget);
u8 position = sub_80A8364(gBattleAnimTarget);
switch (task->data[15])
{
@ -684,9 +706,9 @@ static void sub_80DE6B0(u8 taskId)
gScanlineEffect.state = 3;
task->data[14] = GetAnimBattlerSpriteId(1);
if (position == 1)
REG_DISPCNT &= 0xFDFF;
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG1_ON);
else
REG_DISPCNT &= 0xFBFF;
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON);
break;
case 1:
BlendPalette(task->data[4], 16, 0, RGB(13, 0, 15));
@ -695,12 +717,12 @@ static void sub_80DE6B0(u8 taskId)
gSprites[task->data[14]].invisible = 1;
obj_delete_but_dont_free_vram(&gSprites[task->data[0]]);
FreeSpritePaletteByTag(0x2771);
REG_BLDCNT = 0;
REG_BLDALPHA = 0;
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
if (position == 1)
REG_DISPCNT |= DISPCNT_BG1_ON;
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG1_ON);
else
REG_DISPCNT |= DISPCNT_BG2_ON;
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_BG2_ON);
DestroyAnimVisualTask(taskId);
break;
@ -709,7 +731,7 @@ static void sub_80DE6B0(u8 taskId)
task->data[15]++;
}
static void sub_80DE7B8(struct Sprite *sprite)
static void sub_8112264(struct Sprite *sprite)
{
s16 battler1X, battler1Y;
s16 battler2X, battler2Y;
@ -717,17 +739,17 @@ static void sub_80DE7B8(struct Sprite *sprite)
if (gBattleAnimArgs[0] == 0)
{
battler1X = GetBattlerSpriteCoord(gAnimBankAttacker, 0);
battler1Y = GetBattlerSpriteCoord(gAnimBankAttacker, 1) + 28;
battler2X = GetBattlerSpriteCoord(gAnimBankTarget, 0);
battler2Y = GetBattlerSpriteCoord(gAnimBankTarget, 1) + 28;
battler1X = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
battler1Y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + 28;
battler2X = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
battler2Y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + 28;
}
else
{
battler1X = GetBattlerSpriteCoord(gAnimBankTarget, 0);
battler1Y = GetBattlerSpriteCoord(gAnimBankTarget, 1) + 28;
battler2X = GetBattlerSpriteCoord(gAnimBankAttacker, 0);
battler2Y = GetBattlerSpriteCoord(gAnimBankAttacker, 1) + 28;
battler1X = GetBattlerSpriteCoord(gBattleAnimTarget, 0);
battler1Y = GetBattlerSpriteCoord(gBattleAnimTarget, 1) + 28;
battler2X = GetBattlerSpriteCoord(gBattleAnimAttacker, 0);
battler2Y = GetBattlerSpriteCoord(gBattleAnimAttacker, 1) + 28;
}
yDiff = battler2Y - battler1Y;
@ -742,11 +764,11 @@ static void sub_80DE7B8(struct Sprite *sprite)
sprite->oam.priority = 2;
sprite->pos1.x = battler1X;
sprite->pos1.y = battler1Y;
sprite->callback = sub_80DE8D8;
sprite->callback = sub_8112384;
sprite->invisible = 1;
}
static void sub_80DE8D8(struct Sprite *sprite)
static void sub_8112384(struct Sprite *sprite)
{
if (sprite->data[4])
{
@ -759,7 +781,7 @@ static void sub_80DE8D8(struct Sprite *sprite)
}
}
void sub_80DE918(u8 taskId)
void sub_81123C4(u8 taskId)
{
struct Task *task;
s16 battler;
@ -768,8 +790,8 @@ void sub_80DE918(u8 taskId)
s16 x, y;
task = &gTasks[taskId];
REG_BLDCNT = 0x3F40;
REG_BLDALPHA = 0x1000;
SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL));
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 0x10));
task->data[5] = 0;
task->data[6] = 0;
task->data[7] = 0;
@ -777,21 +799,21 @@ void sub_80DE918(u8 taskId)
task->data[9] = 16;
task->data[10] = gBattleAnimArgs[0];
baseX = GetBattlerSpriteCoord(gAnimBankAttacker, 2);
baseY = sub_807A100(gAnimBankAttacker, 3);
baseX = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
baseY = sub_80A861C(gBattleAnimAttacker, 3);
if (!IsContest())
{
for (battler = 0; battler < 4; battler++)
{
if (battler != gAnimBankAttacker
&& battler != (gAnimBankAttacker ^ 2)
&& IsAnimBankSpriteVisible(battler))
if (battler != gBattleAnimAttacker
&& battler != (gBattleAnimAttacker ^ 2)
&& IsBattlerSpriteVisible(battler))
{
spriteId = CreateSprite(&gSpriteTemplate_83DAF08, baseX, baseY, 55);
spriteId = CreateSprite(&gUnknown_08596DB8, baseX, baseY, 55);
if (spriteId != MAX_SPRITES)
{
x = GetBattlerSpriteCoord(battler, 2);
y = sub_807A100(battler, 3);
y = sub_80A861C(battler, 3);
gSprites[spriteId].data[0] = baseX << 4;
gSprites[spriteId].data[1] = baseY << 4;
gSprites[spriteId].data[2] = ((x - baseX) << 4) / gBattleAnimArgs[1];
@ -799,7 +821,7 @@ void sub_80DE918(u8 taskId)
gSprites[spriteId].data[4] = gBattleAnimArgs[1];
gSprites[spriteId].data[5] = x;
gSprites[spriteId].data[6] = y;
gSprites[spriteId].callback = sub_80DE8D8;
gSprites[spriteId].callback = sub_8112384;
task->data[task->data[12] + 13] = spriteId;
task->data[12]++;
@ -809,7 +831,7 @@ void sub_80DE918(u8 taskId)
}
else
{
spriteId = CreateSprite(&gSpriteTemplate_83DAF08, baseX, baseY, 55);
spriteId = CreateSprite(&gUnknown_08596DB8, baseX, baseY, 55);
if (spriteId != MAX_SPRITES)
{
x = 48;
@ -821,17 +843,17 @@ void sub_80DE918(u8 taskId)
gSprites[spriteId].data[4] = gBattleAnimArgs[1];
gSprites[spriteId].data[5] = x;
gSprites[spriteId].data[6] = y;
gSprites[spriteId].callback = sub_80DE8D8;
gSprites[spriteId].callback = sub_8112384;
task->data[13] = spriteId;
task->data[12] = 1;
}
}
task->func = sub_80DEB38;
task->func = sub_81125E0;
}
static void sub_80DEB38(u8 taskId)
static void sub_81125E0(u8 taskId)
{
u16 i;
struct Task *task = &gTasks[taskId];
@ -856,7 +878,7 @@ static void sub_80DEB38(u8 taskId)
task->data[9]--;
}
REG_BLDALPHA = (task->data[9] << 8) | task->data[8];
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[8], task->data[9]));
if (task->data[7] >= 24)
{
task->data[7] = 0;
@ -886,7 +908,7 @@ static void sub_80DEB38(u8 taskId)
task->data[9]++;
}
REG_BLDALPHA = (task->data[9] << 8) | task->data[8];
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[8], task->data[9]));
if (task->data[8] == 0 && task->data[9] == 16)
{
for (i = 0; i < task->data[12]; i++)
@ -901,26 +923,28 @@ static void sub_80DEB38(u8 taskId)
task->data[0]++;
break;
case 3:
REG_BLDCNT = 0;
REG_BLDALPHA = 0;
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
DestroyAnimVisualTask(taskId);
break;
}
}
void sub_80DECB0(u8 taskId)
void sub_8112758(u8 taskId)
{
s16 startX, startY;
s16 leftDistance, topDistance, bottomDistance, rightDistance;
gBattle_WIN0H = 0;
gBattle_WIN0V = 0;
REG_WININ = 0x3F3F;
REG_WINOUT = 0x3F1F;
REG_BLDCNT = 0xC8;
REG_BLDY = 0x10;
SetGpuReg(REG_OFFSET_WININ, ((WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR) |
(WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR)));
SetGpuReg(REG_OFFSET_WINOUT, ((WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ) |
(WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR)));
SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_TGT1_BG3 | BLDCNT_EFFECT_DARKEN));
SetGpuReg(REG_OFFSET_BLDY, 0x10);
if (GetBattlerSide(gAnimBankAttacker) != B_SIDE_PLAYER || IsContest())
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER || IsContest())
startX = 40;
else
startX = 200;
@ -939,10 +963,10 @@ void sub_80DECB0(u8 taskId)
gTasks[taskId].data[4] = bottomDistance;
gTasks[taskId].data[5] = startX;
gTasks[taskId].data[6] = startY;
gTasks[taskId].func = sub_80DED60;
gTasks[taskId].func = sub_811280C;
}
static void sub_80DED60(u8 taskId)
static void sub_811280C(u8 taskId)
{
s16 step;
s16 leftDistance, rightDistance, topDistance, bottomDistance;
@ -972,36 +996,38 @@ static void sub_80DED60(u8 taskId)
right = 240;
top = 0;
bottom = 112;
selectedPalettes = sub_80791A8(1, 0, 0, 0, 0, 0, 0);
selectedPalettes = sub_80A75AC(1, 0, 0, 0, 0, 0, 0);
BeginNormalPaletteFade(selectedPalettes, 0, 16, 16, RGB(0, 0, 0));
gTasks[taskId].func = sub_80DEEE8;
gTasks[taskId].func = sub_8112994;
}
gBattle_WIN0H = (left << 8) | right;
gBattle_WIN0V = (top << 8) | bottom;
}
static void sub_80DEEE8(u8 taskId)
static void sub_8112994(u8 taskId)
{
if (!gPaletteFade.active)
{
gBattle_WIN0H = 0;
gBattle_WIN0V = 0;
REG_WININ = 0x3F3F;
REG_WINOUT = 0x3F3F;
REG_BLDCNT = 0;
REG_BLDY = 0;
SetGpuReg(REG_OFFSET_WININ, ((WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR) |
(WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR)));
SetGpuReg(REG_OFFSET_WINOUT, ((WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR) |
(WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR)));
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
DestroyAnimVisualTask(taskId);
}
}
static void sub_80DEF3C(struct Sprite *sprite)
static void sub_81129F0(struct Sprite *sprite)
{
s16 xDelta;
s16 xDelta2;
InitAnimSpritePos(sprite, 1);
if (GetBattlerSide(gAnimBankAttacker) == B_SIDE_PLAYER)
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER)
{
xDelta = 24;
xDelta2 = -2;
@ -1016,10 +1042,10 @@ static void sub_80DEF3C(struct Sprite *sprite)
sprite->pos1.x += xDelta;
sprite->data[1] = xDelta2;
sprite->data[0] = 60;
sprite->callback = sub_80DEF98;
sprite->callback = sub_8112A4C;
}
static void sub_80DEF98(struct Sprite *sprite)
static void sub_8112A4C(struct Sprite *sprite)
{
u16 var0;
@ -1040,7 +1066,7 @@ static void sub_80DEF98(struct Sprite *sprite)
{
sprite->data[0] = 30;
sprite->callback = WaitAnimForDuration;
StoreSpriteCallbackInData(sprite, sub_80DF018);
StoreSpriteCallbackInData6(sprite, sub_8112ACC);
}
else
{
@ -1050,12 +1076,12 @@ static void sub_80DEF98(struct Sprite *sprite)
}
}
static void sub_80DF018(struct Sprite *sprite)
static void sub_8112ACC(struct Sprite *sprite)
{
if (sprite->data[0] == 0)
{
REG_BLDCNT = 0x3F40;
REG_BLDALPHA = 0x0010;
SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL));
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0x10, 0));
sprite->data[0]++;
sprite->data[1] = 0;
sprite->data[2] = 0;
@ -1068,31 +1094,31 @@ static void sub_80DF018(struct Sprite *sprite)
{
sprite->data[1] = 0;
sprite->data[2]++;
REG_BLDALPHA = (16 - sprite->data[2]) | (sprite->data[2] << 8);
SetGpuReg(REG_OFFSET_BLDALPHA, (16 - sprite->data[2]) | (sprite->data[2] << 8));
if (sprite->data[2] == 16)
{
sprite->invisible = 1;
sprite->callback = sub_80DF090;
sprite->callback = sub_8112B44;
}
}
}
static void sub_80DF090(struct Sprite *sprite)
static void sub_8112B44(struct Sprite *sprite)
{
REG_BLDCNT = 0;
REG_BLDALPHA = 0;
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
gBattle_WIN0H = 0;
gBattle_WIN0V = 0;
DestroyAnimSprite(sprite);
}
static void sub_80DF0B8(struct Sprite *sprite)
static void sub_8112B78(struct Sprite *sprite)
{
u16 coeffB;
u16 coeffA;
sprite->pos2.x = Sin(sprite->data[0], 12);
if (GetBattlerSide(gAnimBankAttacker) != B_SIDE_PLAYER)
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
sprite->pos2.x = -sprite->pos2.x;
sprite->data[0] = (sprite->data[0] + 6) & 0xFF;
@ -1103,8 +1129,8 @@ static void sub_80DF0B8(struct Sprite *sprite)
if (sprite->data[7] == 1)
{
sprite->data[6] = 0x050B;
REG_BLDCNT = 0x3F40;
REG_BLDALPHA = sprite->data[6];
SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL));
SetGpuReg(REG_OFFSET_BLDALPHA, sprite->data[6]);
}
else if (sprite->data[7] > 30)
{
@ -1117,44 +1143,44 @@ static void sub_80DF0B8(struct Sprite *sprite)
if (--(s16)coeffA < 0)
coeffA = 0;
REG_BLDALPHA = (coeffB << 8) | coeffA;
sprite->data[6] = (coeffB << 8) | coeffA;
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(coeffA, coeffB));
sprite->data[6] = BLDALPHA_BLEND(coeffA, coeffB);
if (coeffB == 16 && coeffA == 0)
{
sprite->invisible = 1;
sprite->callback = sub_80DF18C;
sprite->callback = sub_8112C4C;
}
}
}
static void sub_80DF18C(struct Sprite *sprite)
static void sub_8112C4C(struct Sprite *sprite)
{
REG_BLDCNT = 0;
REG_BLDALPHA = 0;
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
DestroyAnimSprite(sprite);
}
void sub_80DF1A4(u8 taskId)
void sub_8112C6C(u8 taskId)
{
struct Task *task = &gTasks[taskId];
task->data[0] = 0;
task->data[1] = 16;
task->data[9] = GetBattlerSpriteCoord(gAnimBankAttacker, 2);
task->data[10] = sub_8077FC0(gAnimBankAttacker);
task->data[11] = (sub_807A100(gAnimBankAttacker, 1) / 2) + 8;
task->data[9] = GetBattlerSpriteCoord(gBattleAnimAttacker, 2);
task->data[10] = GetBattlerYCoordWithElevation(gBattleAnimAttacker);
task->data[11] = (sub_80A861C(gBattleAnimAttacker, 1) / 2) + 8;
task->data[7] = 0;
task->data[5] = sub_8079ED4(gAnimBankAttacker);
task->data[6] = GetBattlerSubpriority(gAnimBankAttacker) - 2;
task->data[5] = sub_80A8328(gBattleAnimAttacker);
task->data[6] = sub_80A82E4(gBattleAnimAttacker) - 2;
task->data[3] = 0;
task->data[4] = 16;
REG_BLDCNT = 0x3F40;
REG_BLDALPHA = 0x1000;
SetGpuReg(REG_OFFSET_BLDCNT, (BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL));
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 0x10));
task->data[8] = 0;
task->func = sub_80DF24C;
task->func = sub_8112D10;
}
static void sub_80DF24C(u8 taskId)
static void sub_8112D10(u8 taskId)
{
u16 i;
u8 spriteId;
@ -1165,11 +1191,11 @@ static void sub_80DF24C(u8 taskId)
case 0:
for (i = 0; i < 6; i++)
{
spriteId = CreateSprite(&gSpriteTemplate_83DAF80, task->data[9], task->data[10], task->data[6]);
spriteId = CreateSprite(&gUnknown_08596E30, task->data[9], task->data[10], task->data[6]);
if (spriteId != MAX_SPRITES)
{
gSprites[spriteId].data[0] = taskId;
gSprites[spriteId].data[1] = GetBattlerSide(gAnimBankAttacker) == B_SIDE_PLAYER;
gSprites[spriteId].data[1] = GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER;
gSprites[spriteId].data[2] = (i * 42) & 0xFF;
gSprites[spriteId].data[3] = task->data[11];
@ -1198,7 +1224,7 @@ static void sub_80DF24C(u8 taskId)
task->data[0]++;
}
REG_BLDALPHA = (task->data[4] << 8) | task->data[3];
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[3], task->data[4]));
break;
case 2:
if (++task->data[1] > 30)
@ -1225,21 +1251,21 @@ static void sub_80DF24C(u8 taskId)
task->data[0]++;
}
REG_BLDALPHA = (task->data[4] << 8) | task->data[3];
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(task->data[3], task->data[4]));
break;
case 4:
if (task->data[7] == 0)
task->data[0]++;
break;
case 5:
REG_BLDCNT = 0;
REG_BLDALPHA = 0;
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
DestroyAnimVisualTask(taskId);
break;
}
}
static void sub_80DF3D8(struct Sprite *sprite)
static void sub_8112E9C(struct Sprite *sprite)
{
u16 index;
@ -1267,20 +1293,20 @@ static void sub_80DF3D8(struct Sprite *sprite)
}
}
static void sub_80DF49C(struct Sprite *sprite)
static void sub_8112F60(struct Sprite *sprite)
{
sprite->invisible = 1;
sprite->data[5] = gBankSpriteIds[gAnimBankAttacker];
sprite->data[5] = gBattlerSpriteIds[gBattleAnimAttacker];
sprite->data[0] = 128;
sprite->data[1] = 10;
sprite->data[2] = gBattleAnimArgs[0];
sprite->data[3] = gBattleAnimArgs[1];
sprite->callback = sub_80DF4F4;
sprite->callback = sub_8112FB8;
gSprites[sprite->data[5]].pos1.y += 8;
}
static void sub_80DF4F4(struct Sprite *sprite)
static void sub_8112FB8(struct Sprite *sprite)
{
if (sprite->data[3])
{
@ -1298,5 +1324,4 @@ static void sub_80DF4F4(struct Sprite *sprite)
gSprites[sprite->data[5]].pos1.y -= 8;
sprite->callback = move_anim_8074EE0;
}
}*/
}