Merge remote-tracking branch 'pret/master' into RHH_pretMerge20220826

# Conflicts:
#	include/battle_interface.h
#	src/battle_anim_effects_1.c
#	src/battle_script_commands.c
#	src/field_specials.c
This commit is contained in:
Eduardo Quezada 2022-08-26 22:23:37 -04:00
commit 7c86bd5d08
28 changed files with 172 additions and 182 deletions

View File

@ -14698,14 +14698,14 @@ Move_DOUBLE_EDGE:
createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 4, -10, 0, ANIM_TARGET, 0
createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 1, -32, 0, 0, 3
waitforvisualfinish
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 0, 0
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 1, 0
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, ANIM_ATTACKER, 0
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, ANIM_TARGET, 0
createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_ATTACKER, 4, 0, 12, 1
createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 4, 0, 12, 1
createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 16, 0, RGB_WHITE
waitforvisualfinish
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 0, 1
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 1, 1
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, ANIM_ATTACKER, 1
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, ANIM_TARGET, 1
waitforvisualfinish
createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 5
delay 3
@ -16342,7 +16342,7 @@ Move_HORN_ATTACK:
Move_FURY_ATTACK:
loadspritegfx ANIM_TAG_IMPACT
loadspritegfx ANIM_TAG_HORN_HIT
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 256, 0, 2
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 4, 256, ANIM_ATTACKER, 2
choosetwoturnanim FuryAttackRight, FuryAttackLeft
FuryAttackContinue:
createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 6, 1
@ -16491,7 +16491,7 @@ Move_LOW_KICK:
createsprite gSlidingKickSpriteTemplate, ANIM_TARGET, 2, -24, 28, 40, 8, 160, 0
delay 4
createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 2, -8, 8, ANIM_TARGET, 2
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 6, 384, 1, 2
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 6, 384, ANIM_TARGET, 2
playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET
waitforvisualfinish
createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 1, 4
@ -16736,7 +16736,7 @@ SkullBashSetUpHeadDown:
createsprite gSlideMonToOffsetAndBackSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, -24, 0, 0, 10, 0
playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER
waitforvisualfinish
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 16, 96, 0, 2
createvisualtask AnimTask_RotateMonSpriteToSide, 2, 16, 96, ANIM_ATTACKER, 2
waitforvisualfinish
createsprite gSlideMonToOffsetAndBackSpriteTemplate, ANIM_ATTACKER, 2, ANIM_ATTACKER, 24, 0, 0, 10, 1
waitforvisualfinish
@ -17855,7 +17855,7 @@ Move_MIST_BALL:
createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_BG, 1, 1, RGB(23, 16, 31), 16, RGB_WHITE, 16
delay 0
playsewithpan SE_M_HAZE, 0
createvisualtask AnimTask_LoadMistTiles, 5
createvisualtask AnimTask_MistBallFog, 5
createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 3, 0, 16, RGB_WHITE
delay 8
createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 4, 0, 70, 0
@ -22455,14 +22455,14 @@ Move_ARM_THRUST:
loadspritegfx ANIM_TAG_IMPACT
splitbgprio ANIM_TARGET
setalpha 12, 8
createvisualtask AnimTask_RotateMonSpriteToSide, 5, 8, 5, 0, 0
createvisualtask AnimTask_RotateMonSpriteToSide, 5, 8, 5, ANIM_ATTACKER, 0
delay 6
createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 4, 3
delay 4
playsewithpan SE_M_SWAGGER, SOUND_PAN_TARGET
createsprite gArmThrustHandSpriteTemplate, ANIM_TARGET, 2, 10, -8, 14, 3
waitforvisualfinish
createvisualtask AnimTask_RotateMonSpriteToSide, 5, 8, 5, 0, 1
createvisualtask AnimTask_RotateMonSpriteToSide, 5, 8, 5, ANIM_ATTACKER, 1
playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET
choosetwoturnanim ArmThrustRight, ArmThrustLeft
ArmThrustContinue:

View File

@ -158,7 +158,7 @@
"y": 9,
"elevation": 0,
"player_facing_dir": "BG_EVENT_PLAYER_FACING_ANY",
"script": "OldaleTown_EventScript_CitySign"
"script": "OldaleTown_EventScript_TownSign"
},
{
"type": "sign",

View File

@ -29,8 +29,8 @@ OldaleTown_EventScript_MoveMartEmployee::
setobjectmovementtype LOCALID_MART_EMPLOYEE, MOVEMENT_TYPE_FACE_DOWN
return
OldaleTown_EventScript_CitySign::
msgbox OldaleTown_Text_CitySign, MSGBOX_SIGN
OldaleTown_EventScript_TownSign::
msgbox OldaleTown_Text_TownSign, MSGBOX_SIGN
end
OldaleTown_EventScript_Girl::
@ -395,7 +395,7 @@ OldaleTown_Text_BrendanLetsGoBack:
.string "LAB now.\l"
.string "{PLAYER}, you should hustle back, too.$"
OldaleTown_Text_CitySign:
OldaleTown_Text_TownSign:
.string "OLDALE TOWN\n"
.string "“Where things start off scarce.”$"

View File

@ -11,9 +11,9 @@ PacifidlogTown_House2_EventScript_FanClubYoungerBrother::
call_if_unset FLAG_MET_FANCLUB_YOUNGER_BROTHER, PacifidlogTown_House2_EventScript_FirstMonAssessment
setflag FLAG_MET_FANCLUB_YOUNGER_BROTHER
specialvar VAR_RESULT, GetLeadMonFriendshipScore
goto_if_ge VAR_RESULT, 4, PacifidlogTown_House2_EventScript_GiveReturn
goto_if_ge VAR_RESULT, FRIENDSHIP_150_TO_199, PacifidlogTown_House2_EventScript_GiveReturn
specialvar VAR_RESULT, GetLeadMonFriendshipScore
goto_if_ge VAR_RESULT, 2, PacifidlogTown_House2_EventScript_PutInEffort
goto_if_ge VAR_RESULT, FRIENDSHIP_50_TO_99, PacifidlogTown_House2_EventScript_PutInEffort
goto PacifidlogTown_House2_EventScript_GiveFrustration
end

View File

@ -192,7 +192,7 @@ SlateportCity_PokemonFanClub_EventScript_SootheBellWoman::
goto_if_set FLAG_RECEIVED_SOOTHE_BELL, SlateportCity_PokemonFanClub_EventScript_ReceivedSootheBell
msgbox SlateportCity_PokemonFanClub_Text_ShowMePokemonThatLoveYou, MSGBOX_DEFAULT
specialvar VAR_RESULT, GetLeadMonFriendshipScore
goto_if_ge VAR_RESULT, 4, SlateportCity_PokemonFanClub_EventScript_GiveSootheBell
goto_if_ge VAR_RESULT, FRIENDSHIP_150_TO_199, SlateportCity_PokemonFanClub_EventScript_GiveSootheBell
release
end

View File

@ -7,13 +7,13 @@ VerdanturfTown_FriendshipRatersHouse_EventScript_FriendshipRater::
msgbox VerdanturfTown_FriendshipRatersHouse_Text_SeeHowMuchPokemonLikesYou, MSGBOX_DEFAULT
specialvar VAR_RESULT, GetLeadMonFriendshipScore
switch VAR_RESULT
case 0, VerdanturfTown_FriendshipRatersHouse_EventScript_DetestsYou
case 1, VerdanturfTown_FriendshipRatersHouse_EventScript_VeryWary
case 2, VerdanturfTown_FriendshipRatersHouse_EventScript_NotUsedToYou
case 3, VerdanturfTown_FriendshipRatersHouse_EventScript_GettingUsedToYou
case 4, VerdanturfTown_FriendshipRatersHouse_EventScript_LikesYouQuiteALot
case 5, VerdanturfTown_FriendshipRatersHouse_EventScript_VeryHappy
case 6, VerdanturfTown_FriendshipRatersHouse_EventScript_AdoresYou
case FRIENDSHIP_NONE, VerdanturfTown_FriendshipRatersHouse_EventScript_DetestsYou
case FRIENDSHIP_1_TO_49, VerdanturfTown_FriendshipRatersHouse_EventScript_VeryWary
case FRIENDSHIP_50_TO_99, VerdanturfTown_FriendshipRatersHouse_EventScript_NotUsedToYou
case FRIENDSHIP_100_TO_149, VerdanturfTown_FriendshipRatersHouse_EventScript_GettingUsedToYou
case FRIENDSHIP_150_TO_199, VerdanturfTown_FriendshipRatersHouse_EventScript_LikesYouQuiteALot
case FRIENDSHIP_200_TO_254, VerdanturfTown_FriendshipRatersHouse_EventScript_VeryHappy
case FRIENDSHIP_MAX, VerdanturfTown_FriendshipRatersHouse_EventScript_AdoresYou
release
end

View File

@ -124,7 +124,7 @@ void PrepareBattlerSpriteForRotScale(u8 spriteId, u8 objMode);
void SetBattlerSpriteYOffsetFromRotation(u8 spriteId);
u32 GetBattlePalettesMask(bool8 battleBackground, bool8 attacker, bool8 target, bool8 attackerPartner, bool8 targetPartner, bool8 anim1, bool8 anim2);
u32 GetBattleMonSpritePalettesMask(u8 playerLeft, u8 playerRight, u8 opponentLeft, u8 opponentRight);
u8 AnimDummyReturnArg(u8 battler);
u8 GetSpritePalIdxByBattler(u8 battler);
s16 CloneBattlerSpriteWithBlend(u8);
void DestroySpriteWithActiveSheet(struct Sprite *);
u8 CreateInvisibleSpriteCopy(int, u8, int);

View File

@ -35,22 +35,25 @@ enum
#define TAG_HEALTHBAR_PLAYER2_TILE 0xD706
#define TAG_HEALTHBAR_OPPONENT2_TILE 0xD707
#define TAG_HEALTHBOX_PALS_1 0xD709
#define TAG_HEALTHBOX_PALS_2 0xD70A
#define TAG_HEALTHBOX_SAFARI_TILE 0xD70B
#define TAG_STATUS_SUMMARY_BAR_TILE 0xD70C
#define TAG_STATUS_SUMMARY_BAR_PAL 0xD710
#define TAG_STATUS_SUMMARY_BALLS_PAL 0xD712
#define TAG_STATUS_SUMMARY_BALLS_TILE 0xD714
#define TAG_HEALTHBAR_PAL TAG_HEALTHBAR_PLAYER1_TILE
#define TAG_HEALTHBOX_PAL TAG_HEALTHBOX_PLAYER1_TILE
#define TAG_MEGA_TRIGGER_TILE 0xD777
#define TAG_MEGA_INDICATOR_TILE 0xD778
#define TAG_ALPHA_INDICATOR_TILE 0xD779
#define TAG_OMEGA_INDICATOR_TILE 0xD77A
#define TAG_ZMOVE_TRIGGER_TILE 0xD77B
#define TAG_HEALTHBOX_PAL 0xD6FF
#define TAG_HEALTHBAR_PAL 0xD704
#define TAG_STATUS_SUMMARY_BAR_PAL 0xD710
#define TAG_STATUS_SUMMARY_BALLS_PAL 0xD712
#define TAG_MEGA_TRIGGER_PAL 0xD777
#define TAG_MEGA_INDICATOR_PAL 0xD778
#define TAG_ALPHA_INDICATOR_PAL 0xD779

View File

@ -71,7 +71,7 @@ static void AnimProtect_Step(struct Sprite *);
static void AnimMilkBottle(struct Sprite *);
static void AnimMilkBottle_Step1(struct Sprite *);
static void AnimMilkBottle_Step2(struct Sprite *, int, int);
static void AnimSparkingStars(struct Sprite *);
static void AnimSparklingStars(struct Sprite *);
static void AnimBubbleBurst(struct Sprite *);
static void AnimBubbleBurst_Step(struct Sprite *);
static void AnimSleepLetterZ(struct Sprite *);
@ -1696,7 +1696,7 @@ const struct SpriteTemplate gSparklingStarsSpriteTemplate =
.anims = gGrantingStarsAnimTable,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimSparkingStars,
.callback = AnimSparklingStars,
};
static const union AnimCmd sAnim_BubbleBurst[] =
@ -4290,14 +4290,14 @@ static void AnimItemSteal_Step3(struct Sprite *sprite)
sprite->y2 = Sin(sprite->data[0] + 0x80, 30 - sprite->data[1] * 8);
if (sprite->y2 == 0)
PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(63));
PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
if (moveAlongLinearPath(sprite))
{
sprite->y2 = 0;
sprite->data[0] = 0;
sprite->callback = AnimItemSteal_Step2;
PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(-64));
PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
}
}
@ -5243,7 +5243,7 @@ void AnimGrantingStars(struct Sprite *sprite)
sprite->callback = TranslateSpriteLinearFixedPoint;
}
static void AnimSparkingStars(struct Sprite *sprite)
static void AnimSparklingStars(struct Sprite *sprite)
{
u8 battler;
if (!gBattleAnimArgs[2])
@ -5370,7 +5370,7 @@ static void AnimLockOnTarget_Step1(struct Sprite *sprite)
sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, AnimLockOnTarget_Step2);
sprite->data[5] += 0x100;
PlaySE12WithPanning(SE_M_LOCK_ON, BattleAnimAdjustPanning(63));
PlaySE12WithPanning(SE_M_LOCK_ON, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
break;
}
@ -5456,7 +5456,7 @@ static void AnimLockOnTarget_Step4(struct Sprite *sprite)
sprite->data[2]++;
pal = sprite->oam.paletteNum;
LoadPalette(&gPlttBufferUnfaded[0x108 + pal * 16], pal * 16 | 0x101, 4);
PlaySE12WithPanning(SE_M_LEER, BattleAnimAdjustPanning(63));
PlaySE12WithPanning(SE_M_LEER, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
}
else if (sprite->data[1] == 0)
{
@ -5918,7 +5918,7 @@ static void AnimSharpenSphere(struct Sprite *sprite)
sprite->data[2] = 0;
sprite->data[3] = 0;
sprite->data[4] = 0;
sprite->data[5] = BattleAnimAdjustPanning(-64);
sprite->data[5] = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER);
sprite->callback = AnimSharpenSphere_Step;
}

View File

@ -1678,7 +1678,7 @@ static void AirCutterProjectileStep1(u8 taskId)
gTasks[taskId].data[gTasks[taskId].data[1] + 13] = spriteId;
gTasks[taskId].data[0] = gTasks[taskId].data[3];
gTasks[taskId].data[1]++;
PlaySE12WithPanning(SE_M_BLIZZARD2, BattleAnimAdjustPanning(-63));
PlaySE12WithPanning(SE_M_BLIZZARD2, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER + 1));
if (gTasks[taskId].data[1] > 2)
gTasks[taskId].func = AirCutterProjectileStep2;
}
@ -1875,7 +1875,7 @@ static void AnimBulletSeed_Step1(struct Sprite *sprite)
int i;
u16 rand;
s16 *ptr;
PlaySE12WithPanning(SE_M_HORN_ATTACK, BattleAnimAdjustPanning(63));
PlaySE12WithPanning(SE_M_HORN_ATTACK, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
sprite->x += sprite->x2;
sprite->y += sprite->y2;
sprite->y2 = 0;
@ -2521,7 +2521,7 @@ static void AnimPencil(struct Sprite *sprite)
sprite->data[3] = 16;
sprite->data[4] = 0;
sprite->data[5] = GetBattlerSpriteCoordAttr(gBattleAnimTarget, BATTLER_COORD_ATTR_HEIGHT) + 2;
sprite->data[6] = BattleAnimAdjustPanning(63);
sprite->data[6] = BattleAnimAdjustPanning(SOUND_PAN_TARGET);
sprite->callback = AnimPencil_Step;
}
@ -3079,9 +3079,7 @@ void AnimTask_FreeMusicNotesPals(u8 taskId)
static void SetMusicNotePalette(struct Sprite *sprite, u8 a, u8 b)
{
u8 tile;
tile = (b & 1);
tile = ((-tile | tile) >> 31) & 32;
u8 tile = (b & 1) ? 32 : 0;
sprite->oam.tileNum += tile + (a << 2);
sprite->oam.paletteNum = IndexOfSpritePaletteTag(sMusicNotePaletteTagsTable[b >> 1]);
}
@ -3828,8 +3826,7 @@ static void AnimPerishSongMusicNote_Step2(struct Sprite *sprite)
if (sprite->data[4] > 3)
{
int var1 = sprite->data[2];
sprite->invisible = var1 - (((s32)(var1 + ((u32)var1 >> 31)) >> 1) << 1);
sprite->invisible = sprite->data[2] % 2;
DestroyAnimSprite(sprite);
}

View File

@ -1739,7 +1739,7 @@ static void AnimClappingHand_Step(struct Sprite *sprite)
sprite->data[2]++;
if (sprite->data[3] == 0)
{
PlaySE1WithPanning(SE_M_ENCORE, BattleAnimAdjustPanning(-64));
PlaySE1WithPanning(SE_M_ENCORE, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
}
}
}
@ -2023,7 +2023,7 @@ static void TormentAttacker_Step(u8 taskId)
y = task->data[3] + task->data[5];
spriteId = CreateSprite(&gThoughtBubbleSpriteTemplate, x, y, 6 - task->data[1]);
PlaySE12WithPanning(SE_M_METRONOME, BattleAnimAdjustPanning(-64));
PlaySE12WithPanning(SE_M_METRONOME, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
if (spriteId != MAX_SPRITES)
{
@ -2200,7 +2200,7 @@ static void AnimWishStar(struct Sprite *sprite)
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
sprite->x = -16;
else
sprite->x = 256;
sprite->x = DISPLAY_WIDTH + 16;
sprite->y = 0;
sprite->callback = AnimWishStar_Step;
@ -2229,7 +2229,7 @@ static void AnimWishStar_Step(struct Sprite *sprite)
}
newX = sprite->x + sprite->x2 + 32;
if (newX > 304)
if (newX > DISPLAY_WIDTH + 64)
DestroyAnimSprite(sprite);
}
@ -2504,7 +2504,7 @@ void AnimTask_MorningSunLightBeam(u8 taskId)
gTasks[taskId].data[11] = gBattle_BG1_Y;
gTasks[taskId].data[0]++;
PlaySE12WithPanning(SE_M_MORNING_SUN, BattleAnimAdjustPanning(-64));
PlaySE12WithPanning(SE_M_MORNING_SUN, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
break;
case 1:
if (gTasks[taskId].data[4]++ > 0)
@ -2539,7 +2539,7 @@ void AnimTask_MorningSunLightBeam(u8 taskId)
{
gTasks[taskId].data[3] = 0;
gTasks[taskId].data[0] = 1;
PlaySE12WithPanning(SE_M_MORNING_SUN, BattleAnimAdjustPanning(-64));
PlaySE12WithPanning(SE_M_MORNING_SUN, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
}
break;
case 4:
@ -3276,7 +3276,7 @@ static void AnimReversalOrb_Step(struct Sprite *sprite)
// Copies the target mon's sprite, and makes a white silhouette that shrinks away.
void AnimTask_RolePlaySilhouette(u8 taskId)
{
u8 isBackPic;
bool8 isBackPic;
u32 personality;
u32 otId;
u16 species;
@ -3299,7 +3299,7 @@ void AnimTask_RolePlaySilhouette(u8 taskId)
{
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
{
isBackPic = 0;
isBackPic = FALSE;
personality = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_PERSONALITY);
otId = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_OT_ID);
if (gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].transformSpecies == SPECIES_NONE)
@ -3319,7 +3319,7 @@ void AnimTask_RolePlaySilhouette(u8 taskId)
}
else
{
isBackPic = 1;
isBackPic = TRUE;
personality = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_PERSONALITY);
otId = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gBattleAnimTarget]], MON_DATA_OT_ID);
if (gBattleSpritesDataPtr->battlerData[gBattleAnimTarget].transformSpecies == SPECIES_NONE)
@ -4949,7 +4949,7 @@ static void AnimTask_MonToSubstituteDoll(u8 taskId)
if (gSprites[spriteId].y2 == 0)
{
PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(-64));
PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
gTasks[taskId].data[10] -= 0x800;
gTasks[taskId].data[0]++;
}
@ -4971,7 +4971,7 @@ static void AnimTask_MonToSubstituteDoll(u8 taskId)
if (gSprites[spriteId].y2 == 0)
{
PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(-64));
PlaySE12WithPanning(SE_M_BUBBLE2, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
DestroyAnimVisualTask(taskId);
}
break;
@ -5008,7 +5008,7 @@ static void AnimBlockX_Step(struct Sprite *sprite)
sprite->y2 += 10;
if (sprite->y2 >= 0)
{
PlaySE12WithPanning(SE_M_SKETCH, BattleAnimAdjustPanning(63));
PlaySE12WithPanning(SE_M_SKETCH, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
sprite->y2 = 0;
sprite->data[0]++;
}
@ -5018,7 +5018,7 @@ static void AnimBlockX_Step(struct Sprite *sprite)
sprite->y2 = -(gSineTable[sprite->data[1]] >> 3);
if (sprite->data[1] > 0x7F)
{
PlaySE12WithPanning(SE_M_SKETCH, BattleAnimAdjustPanning(63));
PlaySE12WithPanning(SE_M_SKETCH, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
sprite->data[1] = 0;
sprite->y2 = 0;
sprite->data[0]++;
@ -5037,7 +5037,7 @@ static void AnimBlockX_Step(struct Sprite *sprite)
case 3:
if (++sprite->data[1] > 8)
{
PlaySE12WithPanning(SE_M_LEER, BattleAnimAdjustPanning(63));
PlaySE12WithPanning(SE_M_LEER, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
sprite->data[1] = 0;
sprite->data[0]++;
}
@ -5201,7 +5201,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
gTasks[taskId].data[1] &= 0xFF;
x = gSprites[spriteId].x + gSprites[spriteId].x2;
if ((u16)(x + 32) > 304)
if (x < -32 || x > DISPLAY_WIDTH + 32)
{
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[0]++;
@ -5284,7 +5284,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
}
}
if ((u16)(x + 32) > 304)
if (x < -32 || x > DISPLAY_WIDTH + 32)
{
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[0]++;
@ -5331,7 +5331,7 @@ static void AnimUnusedItemBagSteal(struct Sprite *sprite)
case 0:
if (gBattleAnimArgs[7] == -1)
{
PlaySE12WithPanning(SE_M_VITAL_THROW, BattleAnimAdjustPanning(63));
PlaySE12WithPanning(SE_M_VITAL_THROW, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
sprite->y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y) + 16;
sprite->data[0] = -32;
sprite->data[7]++;

View File

@ -676,7 +676,7 @@ void AnimZapCannonSpark(struct Sprite *sprite)
sprite->data[7] = gBattleAnimArgs[4];
sprite->oam.tileNum += gBattleAnimArgs[6] * 4;
sprite->callback = AnimZapCannonSpark_Step;
AnimZapCannonSpark_Step(sprite);
sprite->callback(sprite);
}
static void AnimZapCannonSpark_Step(struct Sprite *sprite)
@ -1262,7 +1262,7 @@ void AnimTask_ShockWaveProgressingBolt(u8 taskId)
task->data[4] = 7;
task->data[5] = -1;
task->data[11] = 12;
task->data[12] = BattleAnimAdjustPanning(task->data[11] - 76);
task->data[12] = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER);
task->data[13] = BattleAnimAdjustPanning(SOUND_PAN_TARGET);
task->data[14] = task->data[12];
task->data[15] = (task->data[13] - task->data[12]) / 3;

View File

@ -572,7 +572,7 @@ static void AnimFistOrFootRandomPos(struct Sprite *sprite)
sprite->data[0] = gBattleAnimArgs[1];
sprite->data[7] = CreateSprite(&gBasicHitSplatSpriteTemplate, sprite->x, sprite->y, sprite->subpriority + 1);
if (sprite->data[7] != 64)
if (sprite->data[7] != MAX_SPRITES)
{
StartSpriteAffineAnim(&gSprites[sprite->data[7]], 0);
gSprites[sprite->data[7]].callback = SpriteCallbackDummy;
@ -585,7 +585,7 @@ static void AnimFistOrFootRandomPos_Step(struct Sprite *sprite)
{
if (sprite->data[0] == 0)
{
if (sprite->data[7] != 64)
if (sprite->data[7] != MAX_SPRITES)
{
FreeOamMatrix(gSprites[sprite->data[7]].oam.matrixNum);
DestroySprite(&gSprites[sprite->data[7]]);

View File

@ -1309,8 +1309,8 @@ void AnimTask_MoveHeatWaveTargets(u8 taskId)
{
struct Task *task = &gTasks[taskId];
task->data[12] = !GetBattlerSide(gBattleAnimAttacker) ? 1 : -1;
task->data[13] = IsBattlerSpriteVisible(gBattleAnimTarget ^ 2) + 1;
task->data[12] = GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER ? 1 : -1;
task->data[13] = IsBattlerSpriteVisible(gBattleAnimTarget ^ BIT_FLANK) + 1;
task->data[14] = GetAnimBattlerSpriteId(ANIM_TARGET);
task->data[15] = GetAnimBattlerSpriteId(ANIM_DEF_PARTNER);

View File

@ -524,8 +524,8 @@ void AnimFlyBallAttack_Step(struct Sprite *sprite)
}
if (sprite->x + sprite->x2 < -32
|| sprite->x + sprite->x2 > DISPLAY_WIDTH + 32
|| sprite->y + sprite->y2 > DISPLAY_HEIGHT)
|| sprite->x + sprite->x2 > DISPLAY_WIDTH + 32
|| sprite->y + sprite->y2 > DISPLAY_HEIGHT)
{
gSprites[GetAnimBattlerSpriteId(ANIM_ATTACKER)].invisible = sprite->data[5];
DestroyAnimSprite(sprite);
@ -1211,8 +1211,8 @@ void AnimSkyAttackBird_Step(struct Sprite *sprite)
sprite->x = sprite->data[4] >> 4;
sprite->y = sprite->data[5] >> 4;
if (sprite->x > 285 || sprite->x < -45
|| sprite->y > 157 || sprite->y < -45)
if (sprite->x > DISPLAY_WIDTH + 45 || sprite->x < -45
|| sprite->y > 157 || sprite->y < -45)
DestroySpriteAndMatrix(sprite);
}

View File

@ -41,7 +41,7 @@ static void AnimThrowIceBall(struct Sprite *);
static void InitIceBallParticle(struct Sprite *);
static void AnimIceBallParticle(struct Sprite *);
static void AnimTask_HazeScrollingFog_Step(u8);
static void AnimTask_LoadMistTiles_Step(u8);
static void AnimTask_MistBallFog_Step(u8);
static void AnimTask_Hail2(u8);
static bool8 GenerateHailParticle(u8 hailStructId, u8 affineAnimNum, u8 taskId, u8 c);
static void AvalancheAnim_Step(struct Sprite *sprite);
@ -351,7 +351,7 @@ const struct SpriteTemplate gMistBallSpriteTemplate =
.callback = AnimThrowMistBall,
};
static const u8 wMistBlendAmounts[] =
static const u8 sMistBlendAmounts[] =
{
0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5,
};
@ -779,7 +779,8 @@ static void AnimSwirlingSnowball(struct Sprite *sprite)
sprite->data[0] = 1;
AnimFastTranslateLinear(sprite);
if ((u32)(sprite->x + sprite->x2 + 16) > DISPLAY_WIDTH + 32
if (sprite->x + sprite->x2 > DISPLAY_WIDTH + 16
|| sprite->x + sprite->x2 < -16
|| sprite->y + sprite->y2 > DISPLAY_HEIGHT
|| sprite->y + sprite->y2 < -16)
break;
@ -845,7 +846,8 @@ static void AnimSwirlingSnowball_End(struct Sprite *sprite)
sprite->data[0] = 1;
AnimFastTranslateLinear(sprite);
if ((u32)(sprite->x + sprite->x2 + 16) > DISPLAY_WIDTH + 32
if (sprite->x + sprite->x2 > 256
|| sprite->x + sprite->x2 < -16
|| sprite->y + sprite->y2 > 256
|| sprite->y + sprite->y2 < -16)
DestroyAnimSprite(sprite);
@ -899,7 +901,8 @@ void AnimMoveParticleBeyondTarget(struct Sprite *sprite)
{
sprite->data[0] = 1;
AnimFastTranslateLinear(sprite);
if ((u32)(sprite->x + sprite->x2 + 16) > DISPLAY_WIDTH + 32
if (sprite->x + sprite->x2 > DISPLAY_WIDTH + 16
|| sprite->x + sprite->x2 < -16
|| sprite->y + sprite->y2 > DISPLAY_HEIGHT
|| sprite->y + sprite->y2 < -16)
break;
@ -929,7 +932,8 @@ static void AnimWiggleParticleTowardsTarget(struct Sprite *sprite)
sprite->data[7] = (sprite->data[7] + sprite->data[6]) & 0xFF;
if (sprite->data[0] == 1)
{
if ((u32)(sprite->x + sprite->x2 + 16) > DISPLAY_WIDTH + 32
if (sprite->x + sprite->x2 > DISPLAY_WIDTH + 16
|| sprite->x + sprite->x2 < -16
|| sprite->y + sprite->y2 > DISPLAY_HEIGHT
|| sprite->y + sprite->y2 < -16)
DestroyAnimSprite(sprite);
@ -1169,7 +1173,7 @@ void AnimThrowMistBall(struct Sprite *sprite)
}
// Displays misty background in Mist Ball.
void AnimTask_LoadMistTiles(u8 taskId)
void AnimTask_MistBallFog(u8 taskId)
{
struct BattleAnimBgData animBg;
@ -1192,10 +1196,10 @@ void AnimTask_LoadMistTiles(u8 taskId)
LoadPalette(&gFogPalette, animBg.paletteId * 16, 32);
gTasks[taskId].data[15] = -1;
gTasks[taskId].func = AnimTask_LoadMistTiles_Step;
gTasks[taskId].func = AnimTask_MistBallFog_Step;
}
static void AnimTask_LoadMistTiles_Step(u8 taskId)
static void AnimTask_MistBallFog_Step(u8 taskId)
{
struct BattleAnimBgData animBg;
@ -1206,7 +1210,7 @@ static void AnimTask_LoadMistTiles_Step(u8 taskId)
{
case 0:
gTasks[taskId].data[9] += 1;
gTasks[taskId].data[11] = wMistBlendAmounts[gTasks[taskId].data[9]];
gTasks[taskId].data[11] = sMistBlendAmounts[gTasks[taskId].data[9]];
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[11], 17 - gTasks[taskId].data[11]));
if (gTasks[taskId].data[11] == 5)
{
@ -1493,14 +1497,14 @@ static bool8 GenerateHailParticle(u8 hailStructId, u8 affineAnimNum, u8 taskId,
}
else
{
battlerX = (sHailCoordData[hailStructId].x);
battlerY = (sHailCoordData[hailStructId].y);
battlerX = sHailCoordData[hailStructId].x;
battlerY = sHailCoordData[hailStructId].y;
}
}
else
{
battlerX = (sHailCoordData[hailStructId].x);
battlerY = (sHailCoordData[hailStructId].y);
battlerX = sHailCoordData[hailStructId].x;
battlerY = sHailCoordData[hailStructId].y;
}
spriteX = battlerX - ((battlerY + 8) / 2);
id = CreateSprite(&gHailParticleSpriteTemplate, spriteX, -8, 18);

View File

@ -5,7 +5,6 @@
#include "task.h"
#include "trig.h"
// This file's functions.
static void AnimTask_ShakeMon_Step(u8 taskId);
static void AnimTask_ShakeMon2_Step(u8 taskId);
static void AnimTask_ShakeMonInPlace_Step(u8 taskId);
@ -109,7 +108,7 @@ void AnimTask_ShakeMon(u8 taskId)
gTasks[taskId].data[4] = gBattleAnimArgs[1];
gTasks[taskId].data[5] = gBattleAnimArgs[2];
gTasks[taskId].func = AnimTask_ShakeMon_Step;
AnimTask_ShakeMon_Step(taskId);
gTasks[taskId].func(taskId);
}
static void AnimTask_ShakeMon_Step(u8 taskId)
@ -157,17 +156,14 @@ static void AnimTask_ShakeMon_Step(u8 taskId)
void AnimTask_ShakeMon2(u8 taskId)
{
u8 spriteId;
bool8 destroy = FALSE;
bool8 abort = FALSE;
u8 battlerId;
if (gBattleAnimArgs[0] < MAX_BATTLERS_COUNT)
{
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
if (spriteId == SPRITE_NONE)
{
DestroyAnimVisualTask(taskId);
return;
}
abort = TRUE;
}
else if (gBattleAnimArgs[0] != 8)
{
@ -189,7 +185,7 @@ void AnimTask_ShakeMon2(u8 taskId)
}
if (IsBattlerSpriteVisible(battlerId) == FALSE)
destroy = TRUE;
abort = TRUE;
spriteId = gBattlerSpriteIds[battlerId];
}
@ -198,7 +194,7 @@ void AnimTask_ShakeMon2(u8 taskId)
spriteId = gBattlerSpriteIds[gBattleAnimAttacker];
}
if (destroy)
if (abort)
{
DestroyAnimVisualTask(taskId);
return;
@ -340,10 +336,8 @@ void AnimTask_ShakeAndSinkMon(u8 taskId)
static void AnimTask_ShakeAndSinkMon_Step(u8 taskId)
{
s16 x;
u8 spriteId;
spriteId = gTasks[taskId].data[0];
x = gTasks[taskId].data[1];
u8 spriteId = gTasks[taskId].data[0];
s16 x = gTasks[taskId].data[1];
if (gTasks[taskId].data[2] == gTasks[taskId].data[8]++)
{
gTasks[taskId].data[8] = 0;
@ -373,11 +367,8 @@ static void AnimTask_ShakeAndSinkMon_Step(u8 taskId)
void AnimTask_TranslateMonElliptical(u8 taskId)
{
u8 i;
u8 spriteId;
u8 wavePeriod;
wavePeriod = 1;
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
u8 wavePeriod = 1;
u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
if (gBattleAnimArgs[4] > 5)
gBattleAnimArgs[4] = 5;
@ -750,7 +741,7 @@ static void AnimTask_SlideOffScreen_Step(u8 taskId)
{
u8 spriteId = gTasks[taskId].data[0];
gSprites[spriteId].x2 += gTasks[taskId].data[1];
if (gSprites[spriteId].x2 + gSprites[spriteId].x + 0x20 > 0x130u)
if (gSprites[spriteId].x2 + gSprites[spriteId].x < -32 || gSprites[spriteId].x2 + gSprites[spriteId].x > DISPLAY_WIDTH + 32)
{
DestroyAnimVisualTask(taskId);
return;
@ -844,8 +835,7 @@ static void AnimTask_SwayMonStep(u8 taskId)
// arg 4: sprite object mode
void AnimTask_ScaleMonAndRestore(u8 taskId)
{
u8 spriteId;
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[3]);
u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[3]);
PrepareBattlerSpriteForRotScale(spriteId, gBattleAnimArgs[4]);
gTasks[taskId].data[0] = gBattleAnimArgs[0];
gTasks[taskId].data[1] = gBattleAnimArgs[1];
@ -906,7 +896,7 @@ void AnimTask_RotateMonSpriteToSide(u8 taskId)
}
else
{
if (gBattleAnimArgs[2] == 0)
if (gBattleAnimArgs[2] == ANIM_ATTACKER)
{
gTasks[taskId].data[7] = !GetBattlerSide(gBattleAnimAttacker);
}
@ -929,8 +919,7 @@ void AnimTask_RotateMonSpriteToSide(u8 taskId)
// Rotates mon to side and back to original position. For Peck and when a held item activates
void AnimTask_RotateMonToSideAndRestore(u8 taskId)
{
u8 spriteId;
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[2]);
u8 spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[2]);
PrepareBattlerSpriteForRotScale(spriteId, ST_OAM_OBJ_NORMAL);
gTasks[taskId].data[1] = 0;
gTasks[taskId].data[2] = gBattleAnimArgs[0];

View File

@ -90,7 +90,7 @@ static const u8 sCastformBackSpriteYCoords[NUM_CASTFORM_FORMS] =
#define TAG_MOVE_EFFECT_MON_1 55125
#define TAG_MOVE_EFFECT_MON_2 55126
static const struct SpriteTemplate sSpriteTemplate_MoveEffectMons[] =
static const struct SpriteTemplate sSpriteTemplates_MoveEffectMons[] =
{
{
.tileTag = TAG_MOVE_EFFECT_MON_1,
@ -112,7 +112,7 @@ static const struct SpriteTemplate sSpriteTemplate_MoveEffectMons[] =
}
};
static const struct SpriteSheet sSpriteSheet_MoveEffectMons[] =
static const struct SpriteSheet sSpriteSheets_MoveEffectMons[] =
{
{ gMiscBlank_Gfx, MON_PIC_SIZE, TAG_MOVE_EFFECT_MON_1, },
{ gMiscBlank_Gfx, MON_PIC_SIZE, TAG_MOVE_EFFECT_MON_2, },
@ -439,7 +439,7 @@ void SetCallbackToStoredInData6(struct Sprite *sprite)
#define sAmplitudeX sAmplitude
#define sAmplitudeY data[4]
// TranslateSpriteInWavePattern
// TranslateSpriteInLissajousCurve
#define sCirclePosX sCirclePos
#define sCircleSpeedX sCircleSpeed
#define sCirclePosY data[4]
@ -486,7 +486,7 @@ void TranslateSpriteInGrowingCircle(struct Sprite *sprite)
// Unused
// Exact shape depends on arguments. Can move in a figure-8-like pattern, or circular, etc.
static void TranslateSpriteInWavePattern(struct Sprite *sprite)
static void TranslateSpriteInLissajousCurve(struct Sprite *sprite)
{
if (sprite->sDuration)
{
@ -1549,13 +1549,13 @@ u32 GetBattleMonSpritePalettesMask(u8 playerLeft, u8 playerRight, u8 opponentLef
return selectedPalettes;
}
// Presumably something commented here, just returns arg
u8 AnimDummyReturnArg(u8 battler)
u8 GetSpritePalIdxByBattler(u8 battler)
{
return battler;
}
static u8 GetBattlerAtPosition_(u8 position)
// Unused
static u8 GetSpritePalIdxByPosition(u8 position)
{
return GetBattlerAtPosition(position);
}
@ -1597,20 +1597,20 @@ void AnimSpriteOnMonPos(struct Sprite *sprite)
// arg 5: lower 8 bits = location on attacking mon, upper 8 bits = location on target mon pick to target
void TranslateAnimSpriteToTargetMonLocation(struct Sprite *sprite)
{
bool8 v1;
bool8 respectMonPicOffsets;
u8 coordType;
if (!(gBattleAnimArgs[5] & 0xff00))
v1 = TRUE;
respectMonPicOffsets = TRUE;
else
v1 = FALSE;
respectMonPicOffsets = FALSE;
if (!(gBattleAnimArgs[5] & 0xff))
coordType = BATTLER_COORD_Y_PIC_OFFSET;
else
coordType = BATTLER_COORD_Y;
InitSpritePosToAnimAttacker(sprite, v1);
InitSpritePosToAnimAttacker(sprite, respectMonPicOffsets);
if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
@ -2142,8 +2142,8 @@ u8 GetBattlerSpriteBGPriorityRank(u8 battlerId)
u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId)
{
u8 spriteId;
u16 sheet = LoadSpriteSheet(&sSpriteSheet_MoveEffectMons[id]);
u16 palette = AllocSpritePalette(sSpriteTemplate_MoveEffectMons[id].paletteTag);
u16 sheet = LoadSpriteSheet(&sSpriteSheets_MoveEffectMons[id]);
u16 palette = AllocSpritePalette(sSpriteTemplates_MoveEffectMons[id].paletteTag);
if (gMonSpritesGfxPtr != NULL && gMonSpritesGfxPtr->buffer == NULL)
gMonSpritesGfxPtr->buffer = AllocZeroed(0x2000);
@ -2168,9 +2168,9 @@ u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16
FREE_AND_SET_NULL(gMonSpritesGfxPtr->buffer);
if (!isBackpic)
spriteId = CreateSprite(&sSpriteTemplate_MoveEffectMons[id], x, y + gMonFrontPicCoords[species].y_offset, subpriority);
spriteId = CreateSprite(&sSpriteTemplates_MoveEffectMons[id], x, y + gMonFrontPicCoords[species].y_offset, subpriority);
else
spriteId = CreateSprite(&sSpriteTemplate_MoveEffectMons[id], x, y + gMonBackPicCoords[species].y_offset, subpriority);
spriteId = CreateSprite(&sSpriteTemplates_MoveEffectMons[id], x, y + gMonBackPicCoords[species].y_offset, subpriority);
if (IsContest())
{

View File

@ -935,7 +935,7 @@ static void AnimTask_ImprisonOrbs_Step(u8 taskId)
{
for (i = 8; i < 13; i++)
{
if (task->data[i] != 64)
if (task->data[i] != MAX_SPRITES)
DestroySprite(&gSprites[task->data[i]]);
}
@ -1114,12 +1114,10 @@ void AnimTask_ExtrasensoryDistortion(u8 taskId)
scanlineParams.dmaDest = &REG_BG2HOFS;
}
i = task->data[14];
while (i <= task->data[14] + 64)
for (i = task->data[14]; i <= task->data[14] + 64; i++)
{
gScanlineEffectRegBuffers[0][i] = task->data[10];
gScanlineEffectRegBuffers[1][i] = task->data[10];
i++;
}
scanlineParams.dmaControl = SCANLINE_EFFECT_DMACNT_16BIT;
@ -1254,7 +1252,7 @@ void AnimPsychoBoost(struct Sprite *sprite)
case 1:
if (sprite->affineAnimEnded)
{
PlaySE12WithPanning(SE_M_TELEPORT, BattleAnimAdjustPanning(-64));
PlaySE12WithPanning(SE_M_TELEPORT, BattleAnimAdjustPanning(SOUND_PAN_ATTACKER));
ChangeSpriteAffineAnim(sprite, 1);
sprite->data[0]++;
}

View File

@ -692,8 +692,8 @@ void AnimTask_Rollout(u8 taskId)
task->data[6] = 0;
task->data[7] = 0;
pan1 = BattleAnimAdjustPanning(-64);
pan2 = BattleAnimAdjustPanning(63);
pan1 = BattleAnimAdjustPanning(SOUND_PAN_ATTACKER);
pan2 = BattleAnimAdjustPanning(SOUND_PAN_TARGET);
task->data[13] = pan1;
task->data[14] = (pan2 - pan1) / task->data[8];

View File

@ -104,7 +104,7 @@ void SoundTask_LoopSEAdjustPanning(u8 taskId)
gTasks[taskId].data[12] = r9;
gTasks[taskId].func = SoundTask_LoopSEAdjustPanning_Step;
SoundTask_LoopSEAdjustPanning_Step(taskId);
gTasks[taskId].func(taskId);
}
static void SoundTask_LoopSEAdjustPanning_Step(u8 taskId)
@ -389,7 +389,7 @@ void SoundTask_AdjustPanningVar(u8 taskId)
gTasks[taskId].data[11] = sourcePan;
gTasks[taskId].func = SoundTask_AdjustPanningVar_Step;
SoundTask_AdjustPanningVar_Step(taskId);
gTasks[taskId].func(taskId);
}
static void SoundTask_AdjustPanningVar_Step(u8 taskId)

View File

@ -768,8 +768,8 @@ static void LoadHealthboxPalsForLevelUp(u8 *paletteId1, u8 *paletteId2, u8 battl
healthBoxSpriteId = gHealthboxSpriteIds[battler];
spriteId1 = gSprites[healthBoxSpriteId].oam.affineParam;
spriteId2 = gSprites[healthBoxSpriteId].data[5];
*paletteId1 = AllocSpritePalette(0xD709);
*paletteId2 = AllocSpritePalette(0xD70A);
*paletteId1 = AllocSpritePalette(TAG_HEALTHBOX_PALS_1);
*paletteId2 = AllocSpritePalette(TAG_HEALTHBOX_PALS_2);
offset1 = (gSprites[healthBoxSpriteId].oam.paletteNum * 16) + 0x100;
offset2 = (gSprites[spriteId2].oam.paletteNum * 16) + 0x100;
@ -798,10 +798,10 @@ static void FreeHealthboxPalsForLevelUp(u8 battler)
spriteId1 = gSprites[healthBoxSpriteId].oam.affineParam;
spriteId2 = gSprites[healthBoxSpriteId].data[5];
FreeSpritePaletteByTag(0xD709);
FreeSpritePaletteByTag(0xD70A);
paletteId1 = IndexOfSpritePaletteTag(0xD6FF);
paletteId2 = IndexOfSpritePaletteTag(0xD704);
FreeSpritePaletteByTag(TAG_HEALTHBOX_PALS_1);
FreeSpritePaletteByTag(TAG_HEALTHBOX_PALS_2);
paletteId1 = IndexOfSpritePaletteTag(TAG_HEALTHBOX_PAL);
paletteId2 = IndexOfSpritePaletteTag(TAG_HEALTHBAR_PAL);
gSprites[healthBoxSpriteId].oam.paletteNum = paletteId1;
gSprites[spriteId1].oam.paletteNum = paletteId1;
gSprites[spriteId2].oam.paletteNum = paletteId2;
@ -829,7 +829,7 @@ static void AnimTask_FlashHealthboxOnLevelUp_Step(u8 taskId)
if (gTasks[taskId].data[0]++ >= gTasks[taskId].data[11])
{
gTasks[taskId].data[0] = 0;
paletteNum = IndexOfSpritePaletteTag(0xD709);
paletteNum = IndexOfSpritePaletteTag(TAG_HEALTHBOX_PALS_1);
colorOffset = gTasks[taskId].data[10] == 0 ? 6 : 2;
switch (gTasks[taskId].data[1])
{

View File

@ -97,7 +97,7 @@ void AnimTask_BlendBattleAnimPalExclude(u8 taskId)
for (battler = 0; battler < MAX_BATTLERS_COUNT; battler++)
{
if (battler != animBattlers[0] && battler != animBattlers[1] && IsBattlerSpriteVisible(battler))
selectedPalettes |= 0x10000 << AnimDummyReturnArg(battler);
selectedPalettes |= 0x10000 << GetSpritePalIdxByBattler(battler);
}
StartBlendAnimSpriteColor(taskId, selectedPalettes);
@ -536,9 +536,9 @@ static void StatsChangeAnimation_Step2(u8 taskId)
gTasks[taskId].func = StatsChangeAnimation_Step3;
if (sAnimStatsChangeData->data[0] == 0)
PlaySE12WithPanning(SE_M_STAT_INCREASE, BattleAnimAdjustPanning2(-64));
PlaySE12WithPanning(SE_M_STAT_INCREASE, BattleAnimAdjustPanning2(SOUND_PAN_ATTACKER));
else
PlaySE12WithPanning(SE_M_STAT_DECREASE, BattleAnimAdjustPanning2(-64));
PlaySE12WithPanning(SE_M_STAT_DECREASE, BattleAnimAdjustPanning2(SOUND_PAN_ATTACKER));
}
static void StatsChangeAnimation_Step3(u8 taskId)

View File

@ -8135,7 +8135,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
basePower = 10 * (gBattleMons[battlerAtk].friendship) / 25;
break;
case EFFECT_FRUSTRATION:
basePower = 10 * (255 - gBattleMons[battlerAtk].friendship) / 25;
basePower = 10 * (MAX_FRIENDSHIP - gBattleMons[battlerAtk].friendship) / 25;
break;
case EFFECT_FURY_CUTTER:
for (i = 1; i < gDisableStructs[battlerAtk].furyCutterCounter; i++)

View File

@ -67,40 +67,40 @@ static void Task_TryFieldPoisonWhiteOut(u8 taskId)
s16 *data = gTasks[taskId].data;
switch (tState)
{
case 0:
for (; tPartyIdx < PARTY_SIZE; tPartyIdx++)
case 0:
for (; tPartyIdx < PARTY_SIZE; tPartyIdx++)
{
if (MonFaintedFromPoison(tPartyIdx))
{
if (MonFaintedFromPoison(tPartyIdx))
{
FaintFromFieldPoison(tPartyIdx);
ShowFieldMessage(gText_PkmnFainted_FldPsn);
tState++;
return;
}
}
tState = 2; // Finished checking party
break;
case 1:
// Wait for "{mon} fainted" message, then return to party loop
if (IsFieldMessageBoxHidden())
tState--;
break;
case 2:
if (AllMonsFainted())
{
// Battle facilities have their own white out script to handle the challenge loss
if (InBattlePyramid() | InBattlePike() || InTrainerHillChallenge())
gSpecialVar_Result = FLDPSN_FRONTIER_WHITEOUT;
else
gSpecialVar_Result = FLDPSN_WHITEOUT;
FaintFromFieldPoison(tPartyIdx);
ShowFieldMessage(gText_PkmnFainted_FldPsn);
tState++;
return;
}
}
tState = 2; // Finished checking party
break;
case 1:
// Wait for "{mon} fainted" message, then return to party loop
if (IsFieldMessageBoxHidden())
tState--;
break;
case 2:
if (AllMonsFainted())
{
// Battle facilities have their own white out script to handle the challenge loss
if (InBattlePyramid() | InBattlePike() || InTrainerHillChallenge())
gSpecialVar_Result = FLDPSN_FRONTIER_WHITEOUT;
else
{
gSpecialVar_Result = FLDPSN_NO_WHITEOUT;
}
ScriptContext_Enable();
DestroyTask(taskId);
break;
gSpecialVar_Result = FLDPSN_WHITEOUT;
}
else
{
gSpecialVar_Result = FLDPSN_NO_WHITEOUT;
}
ScriptContext_Enable();
DestroyTask(taskId);
break;
}
}

View File

@ -869,7 +869,7 @@ static void PetalburgGymSetDoorMetatiles(u8 roomNumber, u16 metatileId)
for (i = 0; i < nDoors; i++)
{
MapGridSetMetatileIdAt(doorCoordsX[i] + MAP_OFFSET, doorCoordsY[i] + MAP_OFFSET, metatileId | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(doorCoordsX[i] + MAP_OFFSET, doorCoordsY[i] + MAP_OFFSET + 1, (metatileId + 8) | MAPGRID_COLLISION_MASK);
MapGridSetMetatileIdAt(doorCoordsX[i] + MAP_OFFSET, doorCoordsY[i] + MAP_OFFSET + 1, (metatileId + METATILE_ROW_WIDTH) | MAPGRID_COLLISION_MASK);
}
DrawWholeMapView();
}

View File

@ -2525,8 +2525,7 @@ static u16 KeyInterCB_Idle(u32 key)
return LINK_KEY_CODE_EMPTY;
}
// Ignore the player's inputs as long as there is an event script
// in ScriptContext2.
// Ignore the player's inputs as long as there is an event script being executed.
static u16 KeyInterCB_DeferToEventScript(u32 key)
{
u16 retVal;

View File

@ -7793,7 +7793,7 @@ const u8 *GetTrainerPartnerName(void)
}
#define READ_PTR_FROM_TASK(taskId, dataId) \
(void *)( \
(void *)( \
((u16)(gTasks[taskId].data[dataId]) | \
((u16)(gTasks[taskId].data[dataId + 1]) << 16)))