summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarco Willems (M17.1) <progreon@gmail.com>2018-01-08 18:40:57 +0100
committerMarco Willems (M17.1) <progreon@gmail.com>2018-01-08 18:40:57 +0100
commit4bdab579016705c6dc914e3d2af2d608eb256a9b (patch)
treef5e088e174e72f5b9acd473c05fe23bc18b1b48e /src
parent7f3eb30bcb9da4a3a651f1aca7a8fd6b7980491a (diff)
Decompiled sub_812B18C
Diffstat (limited to 'src')
-rw-r--r--src/battle/anim/sfx.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/battle/anim/sfx.c b/src/battle/anim/sfx.c
index 484548d4d..cb61a566f 100644
--- a/src/battle/anim/sfx.c
+++ b/src/battle/anim/sfx.c
@@ -1,9 +1,15 @@
#include "global.h"
#include "battle_anim.h"
+#include "contest.h"
+#include "ewram.h"
+#include "rom_8077ABC.h"
#include "sound.h"
#include "task.h"
extern s16 gBattleAnimArgs[];
+extern u8 gAnimBankAttacker;
+extern u8 gAnimBankTarget;
+extern u16 gBattlePartyID[];
void sub_812AF98(u8 taskId);
void sub_812B004(u8 taskId);
@@ -122,3 +128,57 @@ void sub_812B108(u8 taskId)
TASK.data[11] = sub_8077104(TASK.data[11]);
}
}
+
+// #define shared19348 (*(struct UnknownContestStruct8 *)(gSharedMem + 0x19348))
+// #define EWRAM_19348 (*(u16 *)(gSharedMem + 0x19348))
+
+void sub_812B18C(u8 taskId)
+{
+ u16 species = 0;
+ s8 pan = BattleAnimAdjustPanning(-64);
+
+ if (IsContest())
+ {
+ if (!gBattleAnimArgs[0])
+ species = shared19348.unk0;
+ else
+ DestroyAnimVisualTask(taskId);
+ }
+ else
+ {
+ u8 bank;
+ if (gBattleAnimArgs[0] == 0)
+ bank = gAnimBankAttacker;
+ else if (gBattleAnimArgs[0] == 1)
+ bank = gAnimBankTarget;
+ else if (gBattleAnimArgs[0] == 2)
+ bank = gAnimBankAttacker ^ 0x2;
+ else
+ bank = gAnimBankTarget ^ 0x2;
+
+ if (gBattleAnimArgs[0] == 1 || gBattleAnimArgs[0] == 3)
+ {
+ if (!IsAnimBankSpriteVisible(bank))
+ {
+ DestroyAnimVisualTask(taskId);
+ return;
+ }
+ }
+
+ if (GetBankSide(bank))
+ species = GetMonData(&gEnemyParty[gBattlePartyID[bank]], 0xB);
+ else
+ species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], 0xB);
+ }
+
+ if (species != 0)
+ {
+ s16 mode = gBattleAnimArgs[1];
+ if (mode == 0xFF)
+ PlayCry1(species, pan);
+ else
+ PlayCry3(species, pan, mode);
+ }
+
+ DestroyAnimVisualTask(taskId);
+} \ No newline at end of file