Identified task and sprite fields related to battle weather animations

Named task and sprite fields related to the animations for Hail, Rain Dance, and Sandstorm.
This commit is contained in:
DavidJCobb
2025-04-28 05:39:52 -04:00
parent 66c07f9c33
commit 35b33a46e9
3 changed files with 172 additions and 89 deletions
+21 -7
View File
@@ -473,27 +473,37 @@ const struct SpriteTemplate gWeatherBallWaterDownSpriteTemplate =
.callback = AnimWeatherBallDown,
};
#define tRaindropSpawnTimer data[0]
#define tRaindropUnused data[1]
#define tRaindropSpawnInterval data[2]
#define tRaindropSpawnDuration data[3] // number of frames over which we spawn raindrops
void AnimTask_CreateRaindrops(u8 taskId)
{
u8 x, y;
if (gTasks[taskId].data[0] == 0)
if (gTasks[taskId].tRaindropSpawnTimer == 0)
{
gTasks[taskId].data[1] = gBattleAnimArgs[0];
gTasks[taskId].data[2] = gBattleAnimArgs[1];
gTasks[taskId].data[3] = gBattleAnimArgs[2];
gTasks[taskId].tRaindropUnused = gBattleAnimArgs[0];
gTasks[taskId].tRaindropSpawnInterval = gBattleAnimArgs[1];
gTasks[taskId].tRaindropSpawnDuration = gBattleAnimArgs[2];
}
gTasks[taskId].data[0]++;
if (gTasks[taskId].data[0] % gTasks[taskId].data[2] == 1)
gTasks[taskId].tRaindropSpawnTimer++;
if (gTasks[taskId].tRaindropSpawnTimer % gTasks[taskId].tRaindropSpawnInterval == 1)
{
x = Random2() % DISPLAY_WIDTH;
y = Random2() % (DISPLAY_HEIGHT / 2);
CreateSprite(&gRainDropSpriteTemplate, x, y, 4);
}
if (gTasks[taskId].data[0] == gTasks[taskId].data[3])
if (gTasks[taskId].tRaindropSpawnTimer == gTasks[taskId].tRaindropSpawnDuration)
DestroyAnimVisualTask(taskId);
}
#undef tRaindropSpawnTimer
#undef tRaindropUnused
#undef tRaindropSpawnInterval
#undef tRaindropSpawnDuration
static void AnimRainDrop(struct Sprite *sprite)
{
sprite->callback = AnimRainDrop_Step;
@@ -503,6 +513,10 @@ static void AnimRainDrop_Step(struct Sprite *sprite)
{
if (++sprite->data[0] <= 13)
{
//
// Make the raindrop fall, but only until it reaches the
// impact/splash frames of its animation.
//
sprite->x2++;
sprite->y2 += 4;
}