diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index 1cfc5230c..eff53de84 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -763,7 +763,7 @@ Move_TAKE_DOWN: setalpha 12, 8 createvisualtask AnimTask_WindUpLunge, 5, ANIM_ATTACKER, -24, 8, 23, 10, 40, 10 delay 35 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_BLACK, 10, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB_BLACK, 10, RGB_BLACK, 0 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 4, -10, 0, ANIM_TARGET, 0 playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET delay 1 @@ -783,14 +783,14 @@ Move_TAKE_DOWN: Move_DOUBLE_EDGE: loadspritegfx ANIM_TAG_IMPACT playsewithpan SE_M_SWIFT, SOUND_PAN_ATTACKER - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 4, 2, RGB_WHITE, 10, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_ATTACKER, 4, 2, RGB_WHITE, 10, RGB_BLACK, 0 waitforvisualfinish delay 10 playsewithpan SE_M_SWAGGER, SOUND_PAN_ATTACKER waitplaysewithpan SE_M_SWAGGER, SOUND_PAN_ATTACKER, 8 createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 18, 6, 2, 4 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 16, 16, RGB_WHITE + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 0, 16, 16, RGB_WHITE createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 0, 20, 0, 0, 4 delay 3 waitforvisualfinish @@ -802,7 +802,7 @@ Move_DOUBLE_EDGE: createvisualtask AnimTask_RotateMonSpriteToSide, 2, 8, -256, 1, 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, 1, 2, 16, 0, RGB_WHITE + 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 @@ -860,7 +860,7 @@ Move_FIRE_BLAST: call FireBlastRing call FireBlastRing delay 24 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 3, 0, 8, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 3, 0, 8, RGB_BLACK waitforvisualfinish delay 19 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 20, 1 @@ -882,7 +882,7 @@ Move_FIRE_BLAST: delay 3 call FireBlastCross waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 2, 8, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 2, 8, 0, RGB_BLACK waitforvisualfinish end FireBlastRing: @@ -941,17 +941,17 @@ Move_MEGA_PUNCH: loadspritegfx ANIM_TAG_HANDS_AND_FEET monbg ANIM_TARGET delay 2 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 0, 0, 16, RGB_BLACK setalpha 12, 8 playsewithpan SE_M_MEGA_KICK, SOUND_PAN_TARGET createsprite gMegaPunchKickSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 0, 50 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 7, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 7, RGB_WHITE delay 50 call SetImpactBackground createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 0 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 22, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 0, RGB_WHITE - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_BLACK, 8, RGB_BLACK, 0 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 0, RGB_WHITE + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB_BLACK, 8, RGB_BLACK, 0 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET waitforvisualfinish clearmonbg ANIM_TARGET @@ -984,18 +984,18 @@ Move_MEGA_KICK: loadspritegfx ANIM_TAG_HANDS_AND_FEET monbg ANIM_TARGET delay 2 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 0, 0, 16, RGB_BLACK setalpha 12, 8 playsewithpan SE_M_MEGA_KICK, SOUND_PAN_TARGET createsprite gMegaPunchKickSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 1, 50 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 7, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 7, RGB_WHITE delay 50 playsewithpan SE_M_MEGA_KICK2, SOUND_PAN_TARGET call SetImpactBackground createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 0 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 22, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 0, RGB_WHITE - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_BLACK, 8, RGB_BLACK, 0 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 0, RGB_WHITE + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB_BLACK, 8, RGB_BLACK, 0 waitforvisualfinish clearmonbg ANIM_TARGET blendoff @@ -1054,21 +1054,21 @@ SonicBoomHit: Move_THUNDER_SHOCK: loadspritegfx ANIM_TAG_SPARK loadspritegfx ANIM_TAG_SPARK_2 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 0, 6, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 0, 6, RGB_BLACK waitforvisualfinish delay 10 createvisualtask AnimTask_ElectricBolt, 5, 0, -44, 0 playsewithpan SE_M_THUNDERBOLT, SOUND_PAN_TARGET delay 9 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 0, 0, 13, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 0, 0, 13, RGB_BLACK waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 0, 13, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 0, 13, 0, RGB_BLACK waitforvisualfinish delay 20 call ElectricityEffect waitforvisualfinish delay 20 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 6, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 6, 0, RGB_BLACK waitforvisualfinish end @@ -1076,7 +1076,7 @@ Move_THUNDERBOLT: loadspritegfx ANIM_TAG_SPARK loadspritegfx ANIM_TAG_SHOCK_3 loadspritegfx ANIM_TAG_SPARK_2 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 0, 6, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 0, 6, RGB_BLACK waitforvisualfinish delay 10 createvisualtask AnimTask_ElectricBolt, 5, 24, -52, 0 @@ -1088,9 +1088,9 @@ Move_THUNDERBOLT: createvisualtask AnimTask_ElectricBolt, 5, 0, -60, 1 playsewithpan SE_M_THUNDERBOLT, SOUND_PAN_TARGET delay 9 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 0, 0, 13, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 0, 0, 13, RGB_BLACK waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 0, 13, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 0, 13, 0, RGB_BLACK waitforvisualfinish delay 20 createsprite gThunderboltOrbSpriteTemplate, ANIM_TARGET, 3, 44, 0, 0, 3 @@ -1104,20 +1104,20 @@ Move_THUNDERBOLT: createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_TARGET, 4, 0, 0, 16, 44, 224, 40, 2, -32765 playsewithpan SE_M_HYPER_BEAM, SOUND_PAN_TARGET delay 0 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 2, 2, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 2, 2, RGB_BLACK delay 6 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 6, 6, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 6, 6, RGB_BLACK delay 6 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 2, 2, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 2, 2, RGB_BLACK delay 6 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 6, 6, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 6, 6, RGB_BLACK waitforvisualfinish delay 20 waitplaysewithpan SE_M_THUNDERBOLT2, SOUND_PAN_TARGET, 19 call ElectricityEffect waitforvisualfinish delay 20 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 6, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 6, 0, RGB_BLACK waitforvisualfinish end @@ -1125,7 +1125,7 @@ Move_THUNDER_WAVE: loadspritegfx ANIM_TAG_SPARK loadspritegfx ANIM_TAG_SPARK_2 loadspritegfx ANIM_TAG_SPARK_H - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 0, 6, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 0, 6, RGB_BLACK waitforvisualfinish delay 10 createvisualtask AnimTask_ElectricBolt, 5, 0, -48, 0 @@ -1138,7 +1138,7 @@ Move_THUNDER_WAVE: delay 4 createsprite gThunderWaveSpriteTemplate, ANIM_TARGET, 2, -16, 16 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 6, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 6, 0, RGB_BLACK waitforvisualfinish end @@ -1247,10 +1247,10 @@ Move_REVERSAL: loadspritegfx ANIM_TAG_HANDS_AND_FEET loadspritegfx ANIM_TAG_IMPACT playsewithpan SE_M_DETECT, SOUND_PAN_ATTACKER - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 3, RGB_WHITE, 8, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 3, RGB_WHITE, 8, RGB_BLACK, 0 waitforvisualfinish delay 30 - createvisualtask AnimTask_BlendColorCycle, 2, 31, 3, 2, 0, 10, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 2, 0, 10, RGB_WHITE delay 10 playsewithpan SE_M_REVERSAL, SOUND_PAN_ATTACKER createsprite gReversalOrbSpriteTemplate, ANIM_ATTACKER, 2, 26, 0 @@ -1264,7 +1264,7 @@ Move_REVERSAL: createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 6, 4 delay 8 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_WHITE, 8, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB_WHITE, 8, RGB_BLACK, 0 createsprite gFistFootSpriteTemplate, ANIM_TARGET, 4, 0, 0, 10, 1, 0 createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0, 0, ANIM_TARGET, 1 createvisualtask AnimTask_ShakeTargetBasedOnMovePowerOrDmg, 5, FALSE, 1, 8, 1, 0 @@ -1348,7 +1348,7 @@ Move_PSYCH_UP: delay 4 playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER createvisualtask AnimTask_ScaleMonAndRestore, 5, -5, -5, 10, ANIM_ATTACKER, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 9, 2, 2, 10, 0, RGB_YELLOW + createvisualtask AnimTask_BlendBattleAnimPal, 9, F_PAL_ATTACKER, 2, 10, 0, RGB_YELLOW delay 30 clearmonbg ANIM_ATK_PARTNER blendoff @@ -1446,18 +1446,18 @@ FuryCutterRight: createsprite gCuttingSliceSpriteTemplate, ANIM_ATTACKER, 2, 40, -32, 1 goto FuryCutterContinue FuryCutterMedium: - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB(9, 8, 10), 4, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB(9, 8, 10), 4, RGB_BLACK, 0 goto FuryCutterContinue2 FuryCutterStrong: - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 3, RGB(9, 8, 10), 4, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 3, RGB(9, 8, 10), 4, RGB_BLACK, 0 goto FuryCutterContinue2 FuryCutterStrongest: - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 3, RGB(9, 8, 10), 4, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 3, RGB(9, 8, 10), 4, RGB_BLACK, 0 goto FuryCutterContinue2 Move_SELF_DESTRUCT: loadspritegfx ANIM_TAG_EXPLOSION - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 0, 9, RGB_RED + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 0, 9, RGB_RED createvisualtask AnimTask_ShakeMon2, 5, 4, 6, 0, 38, 1 createvisualtask AnimTask_ShakeMon2, 5, 5, 6, 0, 38, 1 createvisualtask AnimTask_ShakeMon2, 5, 6, 6, 0, 38, 1 @@ -1466,7 +1466,7 @@ Move_SELF_DESTRUCT: call SelfDestructExplode call SelfDestructExplode waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 9, 0, RGB_RED + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 9, 0, RGB_RED end SelfDestructExplode: playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_ATTACKER @@ -1623,7 +1623,7 @@ RisingWaterHitEffect: Move_EXPLOSION: loadspritegfx ANIM_TAG_EXPLOSION - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 8, 9, RGB(26, 8, 8), 8, RGB_BLACK, 8 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 8, 9, RGB(26, 8, 8), 8, RGB_BLACK, 8 createvisualtask AnimTask_ShakeMon2, 5, 4, 8, 0, 40, 1 createvisualtask AnimTask_ShakeMon2, 5, 5, 8, 0, 40, 1 createvisualtask AnimTask_ShakeMon2, 5, 6, 8, 0, 40, 1 @@ -1632,9 +1632,9 @@ Move_EXPLOSION: call Explosion1 call Explosion1 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 1, 16, 16, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 1, 16, 16, RGB_WHITE delay 50 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 3, 16, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 3, 16, 0, RGB_WHITE end Explosion1: playsewithpan SE_M_EXPLOSION, SOUND_PAN_ATTACKER @@ -1678,16 +1678,16 @@ Move_PROTECT: Move_DETECT: loadspritegfx ANIM_TAG_SPARKLE_4 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 9, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 9, RGB_BLACK waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 0, 9, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 0, 9, RGB_WHITE delay 18 playsewithpan SE_M_DETECT, SOUND_PAN_ATTACKER createsprite gSpinningSparkleSpriteTemplate, ANIM_ATTACKER, 13, 20, -20 waitforvisualfinish delay 10 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 9, 0, RGB_BLACK - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 2, 9, 0, RGB_WHITE + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 9, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 2, 9, 0, RGB_WHITE waitforvisualfinish end @@ -1709,7 +1709,7 @@ Frustration_Continue: Frustration_Strongest: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER createvisualtask AnimTask_ShakeMon2, 5, ANIM_ATTACKER, 1, 0, 15, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 3, 0, 9, 31 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 3, 0, 9, RGB_RED waitforvisualfinish delay 20 playsewithpan SE_M_SWAGGER2, SOUND_PAN_ATTACKER @@ -1740,12 +1740,12 @@ Frustration_Strongest: createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 3, 18, -18, ANIM_TARGET, 0 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 3, 9, 0, 31 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 3, 9, 0, RGB_RED goto Frustration_Continue Frustration_Strong: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER createvisualtask AnimTask_ShakeMon2, 5, ANIM_ATTACKER, 1, 0, 15, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 3, 0, 9, 31 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 3, 0, 9, RGB_RED waitforvisualfinish delay 20 playsewithpan SE_M_SWAGGER2, SOUND_PAN_ATTACKER @@ -1766,7 +1766,7 @@ Frustration_Strong: createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 3, -12, -6, ANIM_TARGET, 1 createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 4, 0, 6, 1 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 3, 9, 0, 31 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 3, 9, 0, RGB_RED goto Frustration_Continue Frustration_Medium: playsewithpan SE_M_SWAGGER2, SOUND_PAN_ATTACKER @@ -1808,7 +1808,7 @@ Move_SAFEGUARD: createsprite gGuardRingSpriteTemplate, ANIM_ATTACKER, 2 waitforvisualfinish playsewithpan SE_SHINY, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 2, 10, 0, 2, 0, 10, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATK_SIDE, 0, 2, 0, 10, RGB_WHITE waitforvisualfinish clearmonbg ANIM_ATK_PARTNER blendoff @@ -1864,13 +1864,13 @@ Move_GUILLOTINE: playsewithpan SE_M_VICEGRIP, SOUND_PAN_TARGET createsprite gGuillotineSpriteTemplate, ANIM_ATTACKER, 2, 0 createsprite gGuillotineSpriteTemplate, ANIM_ATTACKER, 2, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 16, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 16, RGB_BLACK delay 9 createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 2, 0, 23, 1 delay 46 createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 4, 0, 8, 1 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, ANIM_TARGET, 0 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_BLACK, 8, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB_BLACK, 8, RGB_BLACK, 0 playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET waitforvisualfinish clearmonbg ANIM_DEF_PARTNER @@ -1900,7 +1900,7 @@ Move_PAY_DAY: Move_OUTRAGE: loadspritegfx ANIM_TAG_SMALL_EMBER loopsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER, 8, 3 - createvisualtask AnimTask_BlendColorCycle, 2, 7, 2, 5, 3, 8, RGB(14, 13, 0) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_ATTACKER | F_PAL_TARGET, 2, 5, 3, 8, RGB(14, 13, 0) createvisualtask AnimTask_TranslateMonEllipticalRespectSide, 2, ANIM_ATTACKER, 12, 6, 5, 4 delay 0 createsprite gOutrageFlameSpriteTemplate, ANIM_TARGET, 2, 0, 0, 30, 1280, 0, 3 @@ -1946,25 +1946,25 @@ Move_SPARK: loadspritegfx ANIM_TAG_IMPACT loadspritegfx ANIM_TAG_SPARK_2 delay 0 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 5, 5, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_ATTACKER, -31, 1, 5, 5, RGB(31, 31, 22) playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 32, 24, 190, 12, ANIM_ATTACKER, 1, 0 delay 0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 80, 24, 22, 12, ANIM_ATTACKER, 1, 0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 156, 24, 121, 13, ANIM_ATTACKER, 1, 1 delay 0 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 0, 0, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_ATTACKER, -31, 1, 0, 0, RGB(31, 31, 22) delay 10 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 5, 5, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_ATTACKER, -31, 1, 5, 5, RGB(31, 31, 22) playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 100, 24, 60, 10, ANIM_ATTACKER, 1, 0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 170, 24, 42, 11, ANIM_ATTACKER, 1, 1 delay 0 createsprite gSparkElectricitySpriteTemplate, ANIM_ATTACKER, 0, 238, 24, 165, 10, ANIM_ATTACKER, 1, 1 delay 0 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 0, 0, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_ATTACKER, -31, 1, 0, 0, RGB(31, 31, 22) delay 20 - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 7, 7, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_ATTACKER, -31, 1, 7, 7, RGB(31, 31, 22) playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 4, 0, 0, 32, 12, 0, 20, 0, 0 createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 4, 0, 0, 32, 12, 64, 20, 1, 0 @@ -1976,14 +1976,14 @@ Move_SPARK: createsprite gSparkElectricityFlashingSpriteTemplate, ANIM_ATTACKER, 4, 0, 0, 16, 12, 224, 20, 2, 0 delay 4 waitforvisualfinish - createvisualtask AnimTask_BlendColorCycle, 2, 3, -31, 1, 0, 0, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_ATTACKER, -31, 1, 0, 0, RGB(31, 31, 22) createsprite gHorizontalLungeSpriteTemplate, ANIM_ATTACKER, 2, 4, 4 delay 4 playsewithpan SE_M_HYPER_BEAM, SOUND_PAN_TARGET createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 2, 0, 0, ANIM_TARGET, 2 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 6, 1 waitforvisualfinish - createvisualtask AnimTask_BlendColorCycle, 2, 4, -31, 2, 0, 6, RGB(31, 31, 22) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, -31, 2, 0, 6, RGB(31, 31, 22) call ElectricityEffect waitforvisualfinish end @@ -2014,7 +2014,7 @@ Move_ATTRACT: createsprite gRedHeartRisingSpriteTemplate, ANIM_ATTACKER, 40, 112, 256, 90 createsprite gRedHeartRisingSpriteTemplate, ANIM_ATTACKER, 40, 200, 272, 90 delay 75 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 4, 4, 0, 10, RGB(31, 25, 27) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 4, 4, 0, 10, RGB(31, 25, 27) end Move_GROWTH: @@ -2024,7 +2024,7 @@ Move_GROWTH: waitforvisualfinish end GrowthEffect: - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 2, 0, 8, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 8, RGB_WHITE playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER createvisualtask AnimTask_ScaleMonAndRestore, 5, -3, -3, 16, ANIM_ATTACKER, 0 return @@ -2084,12 +2084,12 @@ Move_MEAN_LOOK: loadspritegfx ANIM_TAG_EYE monbg ANIM_DEF_PARTNER playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 16, RGB_BLACK loopsewithpan SE_M_CONFUSE_RAY, SOUND_PAN_TARGET, 15, 4 waitplaysewithpan SE_M_LEER, SOUND_PAN_TARGET, 85 createsprite gMeanLookEyeSpriteTemplate, ANIM_ATTACKER, 2 delay 120 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 16, 0, RGB_BLACK delay 30 clearmonbg ANIM_DEF_PARTNER waitforvisualfinish @@ -2229,7 +2229,7 @@ Move_ICY_WIND: loadspritegfx ANIM_TAG_ICE_CRYSTALS loadspritegfx ANIM_TAG_ICE_SPIKES monbg ANIM_DEF_PARTNER - createvisualtask AnimTask_BlendBattleAnimPal, 10, 11, 4, 0, 4, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_ATK_SIDE, 4, 0, 4, RGB_BLACK fadetobg BG_ICE waitbgfadeout playsewithpan SE_M_ICY_WIND, 0 @@ -2246,7 +2246,7 @@ Move_ICY_WIND: clearmonbg ANIM_DEF_PARTNER restorebg waitbgfadeout - createvisualtask AnimTask_BlendBattleAnimPal, 10, 11, 4, 4, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_ATK_SIDE, 4, 4, 0, RGB_BLACK waitbgfadein end IcyWindSwirlingSnowballs: @@ -2601,9 +2601,9 @@ Move_EARTHQUAKE: createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 10, 50 playsewithpan SE_M_EARTHQUAKE, 0 delay 10 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 delay 16 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 end Move_FISSURE: @@ -2614,11 +2614,11 @@ Move_FISSURE: delay 8 call FissureDirtPlumeFar delay 15 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 delay 15 call FissureDirtPlumeClose delay 15 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 delay 15 call FissureDirtPlumeFar delay 50 @@ -2846,7 +2846,7 @@ SkullBashAttack: playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER waitforvisualfinish playse SE_BANG - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_ATTACKER, 2, 0, 40, 1 createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, 10, 0, 40, 1 createsprite gFlashingHitSplatSpriteTemplate, ANIM_TARGET, 4, 0, 0, ANIM_TARGET, 0 @@ -2892,7 +2892,7 @@ Move_GLARE: createvisualtask AnimTask_GlareEyeDots, 5, 0 playsewithpan SE_M_PSYBEAM2, SOUND_PAN_ATTACKER waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 5, 1, 0, 0, 16, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 5, F_PAL_BG, 0, 0, 16, RGB_BLACK waitforvisualfinish createsprite gEyeSparkleSpriteTemplate, ANIM_ATTACKER, 0, -16, -8 createsprite gEyeSparkleSpriteTemplate, ANIM_ATTACKER, 0, 16, -8 @@ -2901,7 +2901,7 @@ Move_GLARE: delay 2 createvisualtask AnimTask_ShakeTargetInPattern, 3, 20, 1, FALSE waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 5, 1, 0, 16, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 5, F_PAL_BG, 0, 16, 0, RGB_BLACK end Move_BARRAGE: @@ -2926,17 +2926,17 @@ SkyAttackSetUp: jumpretfalse SkyAttackSetUpAgainstOpponent goto SkyAttackSetUpAgainstPartner SkyAttackSetUpAgainstOpponent: - createvisualtask AnimTask_BlendBattleAnimPal, 10, 27, 1, 0, 12, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_ATK_SIDE | F_PAL_DEF_PARTNER, 1, 0, 12, RGB_BLACK waitforvisualfinish delay 12 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 8, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 8, 0, RGB_BLACK createvisualtask AnimTask_HorizontalShake, 5, ANIM_ATTACKER, 2, 16 loopsewithpan SE_M_STAT_INCREASE, SOUND_PAN_ATTACKER, 4, 8 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 0, 15, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 0, 15, RGB_WHITE delay 20 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 15, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 15, 0, RGB_WHITE waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 25, 1, 8, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_ATK_PARTNER | F_PAL_DEF_PARTNER, 1, 8, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -2945,13 +2945,13 @@ SkyAttackSetUpAgainstPartner: createvisualtask AnimTask_BlendBattleAnimPalExclude, 10, ANIM_TARGET, 1, 0, 12, RGB_BLACK waitforvisualfinish delay 12 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 8, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 8, 0, RGB_BLACK createvisualtask AnimTask_HorizontalShake, 5, ANIM_ATTACKER, 2, 16 playsewithpan SE_M_STAT_INCREASE, SOUND_PAN_ATTACKER delay 8 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 0, 15, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 0, 15, RGB_WHITE delay 20 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 1, 15, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 1, 15, 0, RGB_WHITE waitforvisualfinish createvisualtask AnimTask_BlendBattleAnimPalExclude, 10, 4, 1, 8, 0, RGB_BLACK waitforvisualfinish @@ -2963,7 +2963,7 @@ SkyAttackUnleash: loadspritegfx ANIM_TAG_BIRD call SetSkyBg monbg ANIM_ATTACKER - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 0, 0, 16, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 0, 0, 16, RGB_WHITE delay 4 createvisualtask AnimTask_AttackerFadeToInvisible, 5, 0 waitforvisualfinish @@ -2975,7 +2975,7 @@ SkyAttackUnleash: delay 20 createvisualtask AnimTask_AttackerFadeFromInvisible, 5, 1 delay 2 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 0, 15, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 0, 15, 0, RGB_WHITE waitforvisualfinish clearmonbg ANIM_ATTACKER call UnsetSkyBg @@ -3025,7 +3025,7 @@ Move_SUPER_FANG: createsprite gSuperFangSpriteTemplate, ANIM_TARGET, 2 playsewithpan SE_M_BITE, SOUND_PAN_TARGET delay 8 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB(31, 2, 2), 14, RGB_WHITE, 14 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB(31, 2, 2), 14, RGB_WHITE, 14 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 7, 12, 1 waitforvisualfinish blendoff @@ -3113,7 +3113,7 @@ Move_SPITE: playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER waitbgfadein monbg ANIM_DEF_PARTNER - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 6, 0, 8, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 6, 0, 8, RGB_WHITE createvisualtask AnimTask_SpiteTargetShadow, 2 loopsewithpan SE_M_PSYBEAM, SOUND_PAN_TARGET, 20, 3 waitforvisualfinish @@ -3198,7 +3198,7 @@ Move_ENDURE: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call EndureEffect delay 8 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 2, 0, 11, RGB_RED + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_RED createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call EndureEffect delay 8 @@ -3332,9 +3332,9 @@ MagnitudeIntense: createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 0, 50 loopsewithpan SE_M_STRENGTH, SOUND_PAN_TARGET, 8, 10 delay 10 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 delay 16 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_BLACK, 14, RGB_WHITE, 14 goto MagnitudeEnd Move_RAPID_SPIN: @@ -3361,7 +3361,7 @@ Move_MOONLIGHT: loadspritegfx ANIM_TAG_GREEN_SPARKLE loadspritegfx ANIM_TAG_BLUE_STAR setalpha 0, 16 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 16, RGB_BLACK waitforvisualfinish createsprite gMoonSpriteTemplate, ANIM_ATTACKER, 2, 120, 56 createvisualtask AnimTask_AlphaFadeIn, 3, 0, 16, 16, 0, 1 @@ -3484,12 +3484,12 @@ Move_HEAT_WAVE: Move_HAIL: loadspritegfx ANIM_TAG_HAIL loadspritegfx ANIM_TAG_ICE_CRYSTALS - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 3, 0, 6, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 3, 0, 6, RGB_BLACK waitforvisualfinish createvisualtask AnimTask_Hail, 5 loopsewithpan SE_M_HAIL, 0, 8, 10 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 3, 6, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 3, 6, 0, RGB_BLACK end Move_TORMENT: @@ -3567,7 +3567,7 @@ Move_CHARGE: loadspritegfx ANIM_TAG_ELECTRICITY monbg ANIM_ATTACKER setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 4, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 4, RGB_BLACK waitforvisualfinish createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 60, 2, 12 playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER @@ -3591,7 +3591,7 @@ Move_CHARGE: createsprite gElectricPuffSpriteTemplate, ANIM_ATTACKER, 2, 0, -16, -16 playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 4, 4, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 4, 4, 0, RGB_BLACK clearmonbg ANIM_ATTACKER blendoff end @@ -3721,13 +3721,13 @@ BrickBreakNormal: playsewithpan SE_M_VITAL_THROW, SOUND_PAN_TARGET delay 20 createvisualtask AnimTask_WindUpLunge, 2, ANIM_ATTACKER, -24, 0, 24, 10, 24, 3 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 6, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 6, RGB_BLACK delay 37 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, ANIM_TARGET, 1 createsprite gFistFootSpriteTemplate, ANIM_ATTACKER, 4, 0, 0, 10, 1, 0 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 6, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 6, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_TARGET end @@ -3747,7 +3747,7 @@ BrickBreakShatteredWall: playsewithpan SE_M_VITAL_THROW, SOUND_PAN_TARGET delay 20 createvisualtask AnimTask_WindUpLunge, 2, ANIM_ATTACKER, -24, 0, 24, 10, 24, 3 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 6, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 6, RGB_BLACK delay 37 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, ANIM_TARGET, 1 createsprite gFistFootSpriteTemplate, ANIM_ATTACKER, 4, 0, 0, 10, 1, 0 @@ -3759,7 +3759,7 @@ BrickBreakShatteredWall: createsprite gBrickBreakWallShardSpriteTemplate, ANIM_ATTACKER, 2, ANIM_TARGET, 3, 8, 12 playsewithpan SE_M_BRICK_BREAK, SOUND_PAN_TARGET waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 6, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 6, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_TARGET end @@ -3798,7 +3798,7 @@ Move_ENDEAVOR: Move_ERUPTION: loadspritegfx ANIM_TAG_WARM_ROCK - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 2, 0, 4, RGB_RED + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 2, 0, 4, RGB_RED waitforvisualfinish createvisualtask AnimTask_EruptionLaunchRocks, 2 waitplaysewithpan SE_M_EXPLOSION, SOUND_PAN_ATTACKER, 60 @@ -3818,7 +3818,7 @@ Move_ERUPTION: createvisualtask AnimTask_HorizontalShake, 5, MAX_BATTLERS_COUNT, 8, 60 loopsewithpan SE_M_ROCK_THROW, SOUND_PAN_TARGET, 16, 12 delay 80 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 40, 31, 4, 4, 0, RGB_RED + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 40, F_PAL_BG | F_PAL_BATTLERS, 4, 4, 0, RGB_RED end Move_SKILL_SWAP: @@ -3873,13 +3873,13 @@ Move_CAMOUFLAGE: monbg ANIM_ATK_PARTNER splitbgprio ANIM_ATTACKER setalpha 16, 0 - createvisualtask AnimTask_SetCamouflageBlend, 5, 2, 3, 0, 14 + createvisualtask AnimTask_SetCamouflageBlend, 5, F_PAL_ATTACKER, 3, 0, 14 delay 16 createvisualtask AnimTask_AttackerFadeToInvisible, 2, 4 playsewithpan SE_M_FAINT_ATTACK, SOUND_PAN_ATTACKER waitforvisualfinish delay 8 - createvisualtask AnimTask_SetCamouflageBlend, 5, 2, 0, 0, 0 + createvisualtask AnimTask_SetCamouflageBlend, 5, F_PAL_ATTACKER, 0, 0, 0 waitforvisualfinish createvisualtask AnimTask_AttackerFadeFromInvisible, 2, 1 waitforvisualfinish @@ -3891,13 +3891,13 @@ Move_TAIL_GLOW: loadspritegfx ANIM_TAG_CIRCLE_OF_LIGHT monbg ANIM_ATTACKER setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 4, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 4, RGB_BLACK waitforvisualfinish createsprite gTailGlowOrbSpriteTemplate, ANIM_ATTACKER, 66, ANIM_ATTACKER delay 18 loopsewithpan SE_M_MORNING_SUN, SOUND_PAN_ATTACKER, 16, 6 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 4, 4, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 4, 4, 0, RGB_BLACK clearmonbg ANIM_ATTACKER blendoff delay 1 @@ -3955,15 +3955,15 @@ Move_MIST_BALL: waitforvisualfinish playsewithpan SE_M_SAND_ATTACK, SOUND_PAN_TARGET createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 10, 0 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 1, 1, 1, RGB(23, 16, 31), 16, RGB_WHITE, 16 + 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_BlendBattleAnimPal, 10, 4, 3, 0, 16, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 3, 0, 16, RGB_WHITE delay 8 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 4, 0, 70, 0 delay 70 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 16, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 16, 0, RGB_WHITE end Move_FEATHER_DANCE: @@ -4133,7 +4133,7 @@ Move_AROMATHERAPY: loadspritegfx ANIM_TAG_FLOWER loadspritegfx ANIM_TAG_THIN_RING loadspritegfx ANIM_TAG_SPARKLE_2 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 1, 0, 0, 7, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_BG, 0, 0, 7, RGB(13, 31, 12) delay 1 monbg ANIM_ATTACKER delay 1 @@ -4151,7 +4151,7 @@ Move_AROMATHERAPY: waitforvisualfinish clearmonbg ANIM_ATTACKER delay 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 1, 0, 7, 0, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_BG, 0, 7, 0, RGB(13, 31, 12) delay 1 playsewithpan SE_M_STAT_INCREASE, SOUND_PAN_ATTACKER createvisualtask AnimTask_StatusClearedEffect, 2, 1 @@ -4162,7 +4162,7 @@ Move_AROMATHERAPY: createsprite gSparklingStarsSpriteTemplate, ANIM_ATTACKER, 16, 12, -5, 0, 0, 32, 60, 1 waitforvisualfinish playsewithpan SE_SHINY, SOUND_PAN_ATTACKER - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 43, 3, 10, 0, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_BG | F_PAL_ATK_SIDE | F_PAL_ANIM_1, 3, 10, 0, RGB(13, 31, 12) createsprite gBlendThinRingExpandingSpriteTemplate, ANIM_ATTACKER, 16, 0, 0, 0, 1 waitforvisualfinish end @@ -4223,13 +4223,13 @@ Move_ODOR_SLEUTH: waitforvisualfinish clearmonbg ANIM_TARGET delay 1 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 1, RGB_WHITEALPHA, 16, RGB_WHITEALPHA, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 1, RGB_WHITEALPHA, 16, RGB_WHITEALPHA, 0 playsewithpan SE_M_LEER, SOUND_PAN_ATTACKER end Move_GRASS_WHISTLE: loadspritegfx ANIM_TAG_MUSIC_NOTES - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 4, RGB(18, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 4, RGB(18, 31, 12) waitforvisualfinish createvisualtask AnimTask_MusicNotesRainbowBlend, 2 waitforvisualfinish @@ -4260,19 +4260,19 @@ Move_GRASS_WHISTLE: delay 4 waitforvisualfinish createvisualtask AnimTask_MusicNotesClearRainbowBlend, 2 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 4, 4, 0, RGB(18, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 4, 4, 0, RGB(18, 31, 12) waitforvisualfinish end Move_TICKLE: loadspritegfx ANIM_TAG_EYE_SPARKLE - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 0, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_ATTACKER, 0, 0, 16, RGB_BLACK waitforvisualfinish createsprite gEyeSparkleSpriteTemplate, ANIM_ATTACKER, 0, -16, -8 createsprite gEyeSparkleSpriteTemplate, ANIM_ATTACKER, 0, 16, -8 playsewithpan SE_M_DETECT, SOUND_PAN_ATTACKER waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 0, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_ATTACKER, 0, 16, 0, RGB_BLACK waitforvisualfinish delay 20 createvisualtask AnimTask_SwayMon, 3, 0, 6, 1280, 3, ANIM_ATTACKER @@ -4351,7 +4351,7 @@ Move_AERIAL_ACE: playsewithpan SE_M_RAZOR_WIND2, SOUND_PAN_ATTACKER delay 5 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 10, 1 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_BLACK, 10, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB_BLACK, 10, RGB_BLACK, 0 playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET waitforvisualfinish clearmonbg ANIM_TARGET @@ -4361,7 +4361,7 @@ Move_AERIAL_ACE: Move_IRON_DEFENSE: loopsewithpan SE_SHINY, SOUND_PAN_ATTACKER, 28, 2 createvisualtask AnimTask_MetallicShine, 5, 0, 0, 0 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 8, 2, RGB_WHITEALPHA, 14, RGB_WHITEALPHA, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 8, 2, RGB_WHITEALPHA, 14, RGB_WHITEALPHA, 0 waitforvisualfinish end @@ -4414,7 +4414,7 @@ Move_VOLT_TACKLE: loadspritegfx ANIM_TAG_ELECTRICITY monbg ANIM_ATTACKER setalpha 12, 8 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 0, 8, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 0, 8, RGB_BLACK waitforvisualfinish createsprite gVoltTackleOrbSlideSpriteTemplate, ANIM_ATTACKER, 1 playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER @@ -4451,7 +4451,7 @@ Move_VOLT_TACKLE: delay 2 createsprite gElectricPuffSpriteTemplate, ANIM_ATTACKER, 2, 0, -16, -16 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 8, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 8, 0, RGB_BLACK waitforvisualfinish end @@ -4547,7 +4547,7 @@ Move_SHOCK_WAVE: loadspritegfx ANIM_TAG_LIGHTNING monbg ANIM_ATTACKER setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 4, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 4, RGB_BLACK waitforvisualfinish createvisualtask AnimTask_ElectricChargingParticles, 2, ANIM_ATTACKER, 20, 0, 2 playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER @@ -4561,10 +4561,10 @@ Move_SHOCK_WAVE: playsewithpan SE_M_TRI_ATTACK2, SOUND_PAN_TARGET waitforvisualfinish createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 6, 18, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 5, 1, 3, 16, 0, RGB_WHITE - createvisualtask AnimTask_BlendBattleAnimPal, 5, 4, 0, 16, 16, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 5, F_PAL_BG, 3, 16, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 5, F_PAL_TARGET, 0, 16, 16, RGB_BLACK delay 4 - createvisualtask AnimTask_BlendBattleAnimPal, 5, 4, 0, 0, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 5, F_PAL_TARGET, 0, 0, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_ATTACKER blendoff @@ -4629,7 +4629,7 @@ Move_MIND_READER: createsprite gWhiteHaloSpriteTemplate, ANIM_ATTACKER, 5 delay 40 playsewithpan SE_M_LEER, SOUND_PAN_TARGET - createvisualtask AnimTask_BlendColorCycle, 2, 1, 1, 2, 0, 10, RGB_BLACK + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG, 1, 2, 0, 10, RGB_BLACK call MindReaderEyeSpikeEffect waitforvisualfinish clearmonbg ANIM_DEF_PARTNER @@ -4665,8 +4665,8 @@ Move_ICE_PUNCH: loadspritegfx ANIM_TAG_ICE_CRYSTALS loadspritegfx ANIM_TAG_IMPACT loadspritegfx ANIM_TAG_HANDS_AND_FEET - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 7, RGB_BLACK - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 9, RGB(12, 26, 31) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 7, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 9, RGB(12, 26, 31) delay 20 playsewithpan SE_M_STRING_SHOT, SOUND_PAN_TARGET createsprite gIceCrystalSpiralInwardSmall, ANIM_ATTACKER, 2, 0 @@ -4688,9 +4688,9 @@ Move_ICE_PUNCH: delay 15 call IceCrystalEffectShort delay 5 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 9, 0, RGB(12, 26, 31) + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 9, 0, RGB(12, 26, 31) waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 7, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 0, 7, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -4712,7 +4712,7 @@ Move_CONFUSION: call SetPsychicBackground setalpha 8, 8 createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 10, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 2, 0, 8, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 8, RGB_WHITE waitforvisualfinish playsewithpan SE_M_SUPERSONIC, SOUND_PAN_TARGET createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 3, 0, 15, 1 @@ -4729,7 +4729,7 @@ Move_PSYCHIC: call SetPsychicBackground setalpha 8, 8 createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 10, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 2, 0, 8, RGB(31, 23, 0) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 8, RGB(31, 23, 0) waitforvisualfinish loopsewithpan SE_M_SUPERSONIC, SOUND_PAN_TARGET, 10, 3 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 5, 0, 15, 1 @@ -4754,7 +4754,7 @@ FutureSight: call SetPsychicBackground setalpha 8, 8 playsewithpan SE_M_SUPERSONIC, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 2, 0, 8, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 8, RGB_WHITE createvisualtask AnimTask_ScaleMonAndRestore, 5, -4, -4, 15, ANIM_ATTACKER, 1 waitforvisualfinish clearmonbg ANIM_ATK_PARTNER @@ -4767,7 +4767,7 @@ Move_THUNDER: waitbgfadeout createvisualtask AnimTask_StartSlidingBg, 5, -256, 0, 1, -1 waitbgfadein - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 16, RGB_BLACK delay 16 createvisualtask AnimTask_InvertScreenColor, 2, 257, 257, 257 playsewithpan SE_M_THUNDER_WAVE, SOUND_PAN_TARGET @@ -4811,7 +4811,7 @@ Move_THUNDER: delay 2 createvisualtask AnimTask_InvertScreenColor, 2, 257, 257, 257 delay 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_TARGET, 2, 1, 2, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_TARGET, 2, F_PAL_BG, 2, 16, 0, RGB_BLACK waitforvisualfinish restorebg waitbgfadeout @@ -4825,7 +4825,7 @@ Move_THUNDER_PUNCH: loadspritegfx ANIM_TAG_LIGHTNING monbg ANIM_TARGET setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 16, RGB_BLACK waitforvisualfinish playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET createsprite gFistFootSpriteTemplate, ANIM_TARGET, 4, 0, 0, 8, 1, 0 @@ -4845,7 +4845,7 @@ Move_THUNDER_PUNCH: createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 3, 15, 1 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, ANIM_TARGET, 2 delay 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 16, 0, RGB_BLACK delay 20 waitforvisualfinish clearmonbg ANIM_TARGET @@ -4931,7 +4931,7 @@ Move_DRAGON_BREATH: delay 2 createsprite gDragonBreathFireSpriteTemplate, ANIM_TARGET, 2, 0, 0, 0, 0, 20 delay 2 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 1, 0, 9, RGB_RED + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 1, 0, 9, RGB_RED createsprite gDragonBreathFireSpriteTemplate, ANIM_TARGET, 2, 0, 0, 0, 0, 20 delay 2 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 21, 1 @@ -4951,7 +4951,7 @@ Move_DRAGON_BREATH: delay 2 createsprite gDragonBreathFireSpriteTemplate, ANIM_TARGET, 2, 0, 0, 0, 0, 20 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 1, 9, 0, RGB_RED + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 1, 9, 0, RGB_RED waitforvisualfinish clearmonbg ANIM_DEF_PARTNER end @@ -5031,17 +5031,17 @@ Move_LIGHT_SCREEN: end SpecialScreenSparkle: - createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 23, 0, ANIM_ATTACKER, 1 + createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 23, 0, ANIM_ATTACKER, TRUE delay 6 - createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 31, -8, ANIM_ATTACKER, 1 + createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 31, -8, ANIM_ATTACKER, TRUE delay 5 - createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 30, 20, ANIM_ATTACKER, 1 + createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 30, 20, ANIM_ATTACKER, TRUE delay 7 - createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 10, -15, ANIM_ATTACKER, 1 + createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 10, -15, ANIM_ATTACKER, TRUE delay 6 - createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 20, 10, ANIM_ATTACKER, 1 + createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 20, 10, ANIM_ATTACKER, TRUE delay 6 - createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 10, 18, ANIM_ATTACKER, 1 + createsprite gSpecialScreenSparkleSpriteTemplate, ANIM_ATTACKER, 2, 10, 18, ANIM_ATTACKER, TRUE return Move_MIRROR_COAT: @@ -5064,11 +5064,11 @@ Move_REFLECT: waitplaysewithpan SE_M_REFLECT, SOUND_PAN_ATTACKER, 15 createsprite gReflectWallSpriteTemplate, ANIM_ATTACKER, 1, 40, 0, ANIM_TAG_BLUE_LIGHT_WALL delay 20 - createsprite gReflectSparkleSpriteTemplate, ANIM_ATTACKER, 2, 30, 0, ANIM_ATTACKER, 1 + createsprite gReflectSparkleSpriteTemplate, ANIM_ATTACKER, 2, 30, 0, ANIM_ATTACKER, TRUE delay 7 - createsprite gReflectSparkleSpriteTemplate, ANIM_ATTACKER, 2, 19, -12, ANIM_ATTACKER, 1 + createsprite gReflectSparkleSpriteTemplate, ANIM_ATTACKER, 2, 19, -12, ANIM_ATTACKER, TRUE delay 7 - createsprite gReflectSparkleSpriteTemplate, ANIM_ATTACKER, 2, 10, 20, ANIM_ATTACKER, 1 + createsprite gReflectSparkleSpriteTemplate, ANIM_ATTACKER, 2, 10, 20, ANIM_ATTACKER, TRUE waitforvisualfinish delay 1 blendoff @@ -5135,7 +5135,7 @@ Move_SMOG: call SmogCloud delay 120 loopsewithpan SE_M_TOXIC, SOUND_PAN_TARGET, 18, 2 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(26, 0, 26) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB(26, 0, 26) delay 10 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 15, 1 waitforvisualfinish @@ -5269,14 +5269,14 @@ Move_DRAGON_RAGE: Move_RAIN_DANCE: loadspritegfx ANIM_TAG_RAIN_DROPS playsewithpan SE_M_RAIN_DANCE, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x781, 2, 0, 4, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_BATTLERS_2, 2, 0, 4, RGB_BLACK waitforvisualfinish createvisualtask AnimTask_CreateRaindrops, 2, 0, 3, 120 createvisualtask AnimTask_CreateRaindrops, 2, 0, 3, 120 delay 120 delay 30 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x781, 2, 4, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_BATTLERS_2, 2, 4, 0, RGB_BLACK waitforvisualfinish end @@ -5347,7 +5347,7 @@ Move_ICE_BEAM: splitbgprio ANIM_TARGET setalpha 12, 8 loadspritegfx ANIM_TAG_ICE_CRYSTALS - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 7, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 7, RGB_BLACK waitforvisualfinish createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_BUBBLE_BEAM2, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 4, 4, 0, 10 createsprite gIceBeamOuterCrystalSpriteTemplate, ANIM_ATTACKER, 2, 20, 12, 0, 12, 20 @@ -5356,7 +5356,7 @@ Move_ICE_BEAM: call IceBeamCreateCrystals call IceBeamCreateCrystals call IceBeamCreateCrystals - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 4, -31, 0, 7, RGB(0, 20, 31) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_TARGET, -31, 0, 7, RGB(0, 20, 31) createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 25, 1 call IceBeamCreateCrystals call IceBeamCreateCrystals @@ -5372,9 +5372,9 @@ Move_ICE_BEAM: waitforvisualfinish delay 20 call IceCrystalEffectShort - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 4, 5, 7, 0, RGB(0, 20, 31) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_TARGET, 5, 7, 0, RGB(0, 20, 31) waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 7, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 0, 7, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_TARGET blendoff @@ -5437,7 +5437,7 @@ SolarBeamEnd: SolarBeamSetUp: monbg ANIM_ATK_PARTNER setalpha 12, 8 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 1, 4, 0, 11, RGB(31, 31, 11) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 1, 4, 0, 11, RGB(31, 31, 11) playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER call SolarBeamAbsorbEffect waitforvisualfinish @@ -5482,7 +5482,7 @@ SolarBeamUnleash: delay 4 createsprite gSolarBeamBigOrbSpriteTemplate, ANIM_TARGET, 3, 15, 0, 20, 1 delay 4 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 1, 0, 10, RGB(25, 31, 0) + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 1, 0, 10, RGB(25, 31, 0) createsprite gSolarBeamBigOrbSpriteTemplate, ANIM_TARGET, 3, 15, 0, 20, 2 delay 4 createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 2, 0, 65, 1 @@ -5497,7 +5497,7 @@ SolarBeamUnleash: call SolarBeamUnleash1 call SolarBeamUnleash1 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 1, 10, 0, RGB(25, 31, 0) + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 1, 10, 0, RGB(25, 31, 0) call UnsetSolarBeamBg goto SolarBeamEnd SolarBeamUnleash1: @@ -5572,7 +5572,7 @@ BlizzardAgainstPlayer: Move_POWDER_SNOW: loadspritegfx ANIM_TAG_ICE_CRYSTALS monbg ANIM_DEF_PARTNER - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 1, 0, 3, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 1, 0, 3, RGB_BLACK waitforvisualfinish panse SE_M_GUST, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, +2, 0 call PowderSnowSnowballs @@ -5584,7 +5584,7 @@ Move_POWDER_SNOW: waitforvisualfinish clearmonbg ANIM_DEF_PARTNER delay 20 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 1, 3, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 1, 3, 0, RGB_BLACK end PowderSnowSnowballs: createsprite gPowderSnowSnowballSpriteTemplate, ANIM_ATTACKER, 40, 0, 0, 0, 0, 56, 4, 4, 1 @@ -5665,7 +5665,7 @@ Move_SIGNAL_BEAM: call SignalBeamOrbs call SignalBeamOrbs createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 3, 0, 25, 1 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 4, 8, 5, RGB_RED, 8, RGB(1, 30, 0), 8 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_TARGET, 8, 5, RGB_RED, 8, RGB(1, 30, 0), 8 call SignalBeamOrbs call SignalBeamOrbs call SignalBeamOrbs @@ -5698,7 +5698,7 @@ Move_ABSORB: monbg ANIM_DEF_PARTNER splitbgprio_foes ANIM_TARGET setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 4, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 4, RGB(13, 31, 12) waitforvisualfinish playsewithpan SE_M_ABSORB, SOUND_PAN_TARGET createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 2 @@ -5711,7 +5711,7 @@ Move_ABSORB: delay 15 call HealingEffect waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 4, 0, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 4, 0, RGB(13, 31, 12) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -5751,7 +5751,7 @@ Move_MEGA_DRAIN: monbg ANIM_DEF_PARTNER splitbgprio_foes ANIM_TARGET setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 8, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 8, RGB(13, 31, 12) waitforvisualfinish playsewithpan SE_M_ABSORB, SOUND_PAN_TARGET createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 1 @@ -5764,7 +5764,7 @@ Move_MEGA_DRAIN: delay 15 call HealingEffect waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 8, 0, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 8, 0, RGB(13, 31, 12) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -5812,7 +5812,7 @@ Move_GIGA_DRAIN: monbg ANIM_DEF_PARTNER splitbgprio_foes ANIM_TARGET setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 12, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 12, RGB(13, 31, 12) waitforvisualfinish playsewithpan SE_M_ABSORB, SOUND_PAN_TARGET createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 0 @@ -5825,7 +5825,7 @@ Move_GIGA_DRAIN: delay 15 call HealingEffect waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 12, 0, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 12, 0, RGB(13, 31, 12) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -5891,14 +5891,14 @@ Move_LEECH_LIFE: delay 2 createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 5, 5, 1 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 7, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 7, RGB_BLACK waitforvisualfinish call AbsorbEffect waitforvisualfinish delay 15 call HealingEffect waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 7, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 7, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -5906,7 +5906,7 @@ Move_LEECH_LIFE: Move_SYNTHESIS: loadspritegfx ANIM_TAG_SPARKLE_2 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 2, 0, 16, RGB(27, 31, 18) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 16, RGB(27, 31, 18) playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER call GrantingStarsEffect waitforvisualfinish @@ -5948,7 +5948,7 @@ Move_SLUDGE: createsprite gSludgeProjectileSpriteTemplate, ANIM_TARGET, 2, 20, 0, 40, 0 waitforvisualfinish createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 3, 0, 5, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 1, 2, 0, 12, RGB(30, 0, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 1, 2, 0, 12, RGB(30, 0, 31) call PoisonBubblesEffect waitforvisualfinish end @@ -5966,7 +5966,7 @@ Move_SLUDGE_BOMB: call SludgeBombProjectile call SludgeBombProjectile createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 3, 0, 15, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 1, 2, 0, 12, RGB(30, 0, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 1, 2, 0, 12, RGB(30, 0, 31) createsprite gSludgeBombHitParticleSpriteTemplate, ANIM_TARGET, 2, 42, 27, 20 createsprite gSludgeBombHitParticleSpriteTemplate, ANIM_TARGET, 2, -27, 44, 20 createsprite gSludgeBombHitParticleSpriteTemplate, ANIM_TARGET, 2, 39, -28, 20 @@ -6010,7 +6010,7 @@ Move_ACID: delay 15 createvisualtask AnimTask_ShakeMon2, 5, ANIM_TARGET, 2, 0, 10, 1 createvisualtask AnimTask_ShakeMon2, 5, ANIM_DEF_PARTNER, 2, 0, 10, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 20, 2, 2, 0, 12, RGB(30, 0, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_DEF_SIDE, 2, 2, 0, 12, RGB(30, 0, 31) createsprite gAcidPoisonDropletSpriteTemplate, ANIM_TARGET, 2, 0, -22, 0, 15, 55 playsewithpan SE_M_BUBBLE, SOUND_PAN_TARGET delay 10 @@ -6060,7 +6060,7 @@ Move_BONE_CLUB: delay 12 createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, ANIM_TARGET, 1 createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 5, 5, 1 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 7, 5, 1, RGB_BLACK, 10, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_ATTACKER | F_PAL_TARGET, 5, 1, RGB_BLACK, 10, RGB_BLACK, 0 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET waitforvisualfinish clearmonbg ANIM_DEF_PARTNER @@ -6124,7 +6124,7 @@ MegahornContinue: createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 1, -16, 4, 1, 4 waitforvisualfinish createvisualtask AnimTask_ShakeMonInPlace, 2, ANIM_TARGET, -4, 1, 12, 1 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 7, 5, 1, RGB_WHITE, 10, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_ATTACKER | F_PAL_TARGET, 5, 1, RGB_WHITE, 10, RGB_BLACK, 0 delay 10 createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 11 delay 3 @@ -6266,7 +6266,7 @@ Move_CRABHAMMER: createsprite gWaterHitSplatSpriteTemplate, ANIM_ATTACKER, 4, 0, 0, ANIM_TARGET, 0 playsewithpan SE_M_VITAL_THROW2, SOUND_PAN_TARGET delay 1 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB(13, 21, 31), 10, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB(13, 21, 31), 10, RGB_BLACK, 0 createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 1, -24, 0, 0, 4 waitforvisualfinish delay 8 @@ -6362,14 +6362,14 @@ Move_WHIRLPOOL: splitbgprio ANIM_TARGET setalpha 12, 8 delay 0 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 4, 2, 0, 7, RGB(0, 13, 23) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_TARGET, 2, 0, 7, RGB(0, 13, 23) playsewithpan SE_M_WHIRLPOOL, SOUND_PAN_TARGET createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 50, 1 call WhirlpoolEffect call WhirlpoolEffect call WhirlpoolEffect delay 12 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 4, 2, 7, 0, RGB(0, 13, 23) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_TARGET, 2, 7, 0, RGB(0, 13, 23) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER end @@ -6469,7 +6469,7 @@ Move_CROSS_CHOP: createsprite gCrossChopHandSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 1 delay 40 playsewithpan SE_M_RAZOR_WIND, SOUND_PAN_TARGET - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_WHITE, 10, RGB_BLACK, 10 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB_WHITE, 10, RGB_BLACK, 10 createsprite gCrossImpactSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 1, 20 createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 7, 0, 9, 1 waitforvisualfinish @@ -6721,7 +6721,7 @@ Move_SUNNY_DAY: loadspritegfx ANIM_TAG_SUNLIGHT monbg ANIM_ATK_PARTNER setalpha 13, 3 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x781, 1, 0, 6, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_BATTLERS_2, 1, 0, 6, RGB_WHITE waitforvisualfinish panse_adjustnone SE_M_PETAL_DANCE, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, +1, 0 call SunnyDayLightRay @@ -6729,7 +6729,7 @@ Move_SUNNY_DAY: call SunnyDayLightRay call SunnyDayLightRay waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x781, 1, 6, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_BATTLERS_2, 1, 6, 0, RGB_WHITE waitforvisualfinish clearmonbg ANIM_ATK_PARTNER blendoff @@ -6929,7 +6929,7 @@ Move_MIST: call MistCloud call MistCloud delay 32 - createvisualtask AnimTask_BlendColorCycle, 2, 10, 8, 2, 0, 14, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATK_SIDE, 8, 2, 0, 14, RGB_WHITE waitforvisualfinish clearmonbg ANIM_ATK_PARTNER blendoff @@ -6945,9 +6945,9 @@ Move_HAZE: playsewithpan SE_M_HAZE, 0 createvisualtask AnimTask_HazeScrollingFog, 5 delay 30 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x780, 2, 0, 16, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BATTLERS_2, 2, 0, 16, RGB_BLACK delay 90 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x780, 1, 16, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BATTLERS_2, 1, 16, 0, RGB_BLACK end Move_FIRE_PUNCH: @@ -6956,7 +6956,7 @@ Move_FIRE_PUNCH: loadspritegfx ANIM_TAG_IMPACT monbg ANIM_DEF_PARTNER setalpha 12, 8 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 9, RGB_RED + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 9, RGB_RED createsprite gFireSpiralInwardSpriteTemplate, ANIM_TARGET, 1, 0 createsprite gFireSpiralInwardSpriteTemplate, ANIM_TARGET, 1, 64 createsprite gFireSpiralInwardSpriteTemplate, ANIM_TARGET, 1, 128 @@ -6970,7 +6970,7 @@ Move_FIRE_PUNCH: delay 4 playsewithpan SE_M_FIRE_PUNCH, SOUND_PAN_TARGET waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 0, 9, 0, RGB_RED + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 0, 9, 0, RGB_RED waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -7099,7 +7099,7 @@ Move_POISON_GAS: createsprite gPoisonGasCloudSpriteTemplate, ANIM_TARGET, 0, 64, 0, 0, -32, -6, 4192, 1072, 0 delay 40 loopsewithpan SE_M_MIST, SOUND_PAN_TARGET, 28, 6 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 6, 2, 0, 12, RGB(26, 0, 26) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 6, 2, 0, 12, RGB(26, 0, 26) waitforvisualfinish blendoff clearmonbg ANIM_DEF_PARTNER @@ -7133,7 +7133,7 @@ Move_PSYBEAM: call PsybeamRings call PsybeamRings createvisualtask AnimTask_SwayMon, 5, 0, 6, 2048, 4, ANIM_TARGET - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(31, 18, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB(31, 18, 31) call PsybeamRings call PsybeamRings call PsybeamRings @@ -7158,7 +7158,7 @@ Move_HYPNOSIS: call HypnosisRings call HypnosisRings call HypnosisRings - createvisualtask AnimTask_BlendColorCycle, 2, 4, 2, 2, 0, 12, RGB(31, 18, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 2, 2, 0, 12, RGB(31, 18, 31) waitforvisualfinish delay 1 call UnsetPsychicBackground @@ -7178,7 +7178,7 @@ Move_PSYWAVE: createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_TELEPORT, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 2, 9, 0, 10 call PsywaveRings call PsywaveRings - createvisualtask AnimTask_BlendColorCycle, 2, 4, 1, 4, 0, 12, RGB(31, 18, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 1, 4, 0, 12, RGB(31, 18, 31) call PsywaveRings call PsywaveRings call PsywaveRings @@ -7314,7 +7314,7 @@ Move_NIGHT_SHADE: createvisualtask AnimTask_NightShadeClone, 5, 85 delay 70 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 12, 1 - createvisualtask AnimTask_BlendColorCycle, 2, 4, 0, 2, 0, 13, RGB_BLACK + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 0, 2, 0, 13, RGB_BLACK waitforvisualfinish clearmonbg ANIM_ATTACKER delay 1 @@ -7376,7 +7376,7 @@ Move_FOCUS_ENERGY: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call EndureEffect delay 8 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 2, 0, 11, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_WHITE createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call EndureEffect delay 8 @@ -7389,7 +7389,7 @@ Move_BIDE: end BideSetUp: loopsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER, 9, 2 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 2, 0, 11, RGB_RED + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_RED createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 waitforvisualfinish end @@ -7399,7 +7399,7 @@ BideUnleash: monbg ANIM_DEF_PARTNER setalpha 12, 8 loopsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER, 9, 2 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 2, 0, 11, RGB_RED + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 2, 0, 11, RGB_RED createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 waitforvisualfinish createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 0, 24, 0, 0, 4 @@ -7418,7 +7418,7 @@ BideUnleash: delay 5 createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 2, 0, 0, 7 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 2, 11, 0, RGB_RED + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 2, 11, 0, RGB_RED waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -7429,7 +7429,7 @@ Move_STRING_SHOT: loadspritegfx ANIM_TAG_WEB_THREAD monbg ANIM_DEF_PARTNER delay 0 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, 1, 2, 0, 9, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, F_PAL_BG, 2, 0, 9, RGB_BLACK waitforvisualfinish loopsewithpan SE_M_STRING_SHOT, SOUND_PAN_ATTACKER, 9, 6 call StringShotThread @@ -7461,7 +7461,7 @@ Move_STRING_SHOT: clearmonbg ANIM_DEF_PARTNER delay 1 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, 1, 2, 9, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, F_PAL_BG, 2, 9, 0, RGB_BLACK end StringShotThread: @@ -7474,7 +7474,7 @@ Move_SPIDER_WEB: loadspritegfx ANIM_TAG_WEB_THREAD monbg ANIM_DEF_PARTNER delay 0 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, 1, 2, 0, 9, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, F_PAL_BG, 2, 0, 9, RGB_BLACK waitforvisualfinish splitbgprio ANIM_TARGET loopsewithpan SE_M_STRING_SHOT, SOUND_PAN_ATTACKER, 9, 6 @@ -7498,7 +7498,7 @@ Move_SPIDER_WEB: waitforvisualfinish clearmonbg ANIM_DEF_PARTNER delay 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, 1, 2, 9, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 5, F_PAL_BG, 2, 9, 0, RGB_BLACK end SpiderWebThread: @@ -7566,7 +7566,7 @@ Move_RECOVER: monbg ANIM_ATK_PARTNER setalpha 12, 8 loopsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER, 13, 3 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 6, 0, 11, RGB(31, 31, 11) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 6, 0, 11, RGB(31, 31, 11) call RecoverAbsorbEffect call RecoverAbsorbEffect call RecoverAbsorbEffect @@ -7608,7 +7608,7 @@ Move_MIMIC: setarg 7, 0xFFFF waitforvisualfinish playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 2, 0, 11, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 2, 0, 11, RGB_WHITE waitforvisualfinish clearmonbg_static ANIM_DEF_PARTNER blendoff @@ -7655,7 +7655,7 @@ CurseGhost: createsprite gCurseGhostSpriteTemplate, ANIM_TARGET, 2 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 14, 1 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 16, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_DEF_PARTNER end @@ -7673,7 +7673,7 @@ CurseStats: CurseStats1: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER createvisualtask AnimTask_DrawFallingWhiteLinesOnAttacker, 5 - createvisualtask AnimTask_BlendColorCycle, 5, 2, 4, 2, 0, 10, RGB_RED + createvisualtask AnimTask_BlendColorCycle, 5, F_PAL_ATTACKER, 4, 2, 0, 10, RGB_RED return Move_SOFT_BOILED: @@ -7688,7 +7688,7 @@ Move_SOFT_BOILED: delay 120 delay 7 playsewithpan SE_M_HORN_ATTACK, SOUND_PAN_ATTACKER - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 10, 0, RGB(12, 24, 30) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 10, 0, RGB(12, 24, 30) createsprite gThinRingExpandingSpriteTemplate, ANIM_ATTACKER, 3, 31, 16, 0, 1 delay 8 createsprite gThinRingExpandingSpriteTemplate, ANIM_ATTACKER, 3, 31, 16, 0, 1 @@ -7703,7 +7703,7 @@ Move_HEAL_BELL: loadspritegfx ANIM_TAG_BELL loadspritegfx ANIM_TAG_MUSIC_NOTES_2 loadspritegfx ANIM_TAG_THIN_RING - createvisualtask AnimTask_BlendBattleAnimPal, 10, 10, 0, 0, 10, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATK_SIDE, 0, 0, 10, RGB_WHITE waitforvisualfinish createvisualtask AnimTask_LoadMusicNotesPals, 5 createsprite gBellSpriteTemplate, ANIM_ATTACKER, 2, 0, -24, 0, 1 @@ -7741,12 +7741,12 @@ Move_HEAL_BELL: loadspritegfx ANIM_TAG_THIN_RING playsewithpan SE_SHINY, SOUND_PAN_ATTACKER createvisualtask AnimTask_BlendBattleAnimPalExclude, 10, 4, 3, 10, 0, RGB(12, 24, 30) - createvisualtask AnimTask_BlendBattleAnimPal, 10, 10, 3, 10, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATK_SIDE, 3, 10, 0, RGB_WHITE createsprite gBlendThinRingExpandingSpriteTemplate, ANIM_ATTACKER, 16, 0, 0, 0, 1 end HealBellRing: createvisualtask AnimTask_BlendBattleAnimPalExclude, 10, 4, 3, 8, 0, RGB(12, 24, 30) - createvisualtask AnimTask_BlendBattleAnimPal, 10, 10, 3, 2, 10, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATK_SIDE, 3, 2, 10, RGB_WHITE createsprite gThinRingExpandingSpriteTemplate, ANIM_ATTACKER, 40, 0, -24, 0, 1 playsewithpan SE_M_HEAL_BELL, SOUND_PAN_ATTACKER return @@ -7759,12 +7759,12 @@ Move_FAKE_OUT: createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 5, 1 createvisualtask AnimTask_StretchTargetUp, 3 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 16, 0, RGB_WHITE + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 16, 0, RGB_WHITE end Move_SCARY_FACE: loadspritegfx ANIM_TAG_EYE_SPARKLE - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 27, 3, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_ATK_SIDE | F_PAL_DEF_PARTNER, 3, 0, 16, RGB_BLACK playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER waitforvisualfinish delay 10 @@ -7776,7 +7776,7 @@ Move_SCARY_FACE: waitforvisualfinish createvisualtask AnimTask_ShakeTargetInPattern, 3, 20, 1, FALSE playsewithpan SE_M_STRING_SHOT2, SOUND_PAN_TARGET - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 27, 3, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_ATK_SIDE | F_PAL_DEF_PARTNER, 3, 16, 0, RGB_BLACK waitforvisualfinish end @@ -7920,7 +7920,7 @@ PresentHeal: Move_BATON_PASS: loadspritegfx ANIM_TAG_POKEBALL playsewithpan SE_M_BATON_PASS, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 2, 31, 1, 2, 0, 11, RGB(31, 22, 30) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG | F_PAL_BATTLERS, 1, 2, 0, 11, RGB(31, 22, 30) createsprite gBatonPassPokeballSpriteTemplate, ANIM_ATTACKER, 2 end @@ -7946,13 +7946,13 @@ Move_PERISH_SONG: delay 20 panse SE_M_PERISH_SONG, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, +2, 0 delay 80 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 0, 16, RGB_BLACK createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, 4, 0 createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, 5, 0 createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, 6, 0 createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, 7, 0 delay 100 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 16, 0, RGB_BLACK createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, 4, 1 createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, 5, 1 createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, 6, 1 @@ -8027,7 +8027,7 @@ Move_TRI_ATTACK: delay 20 createsoundtask SoundTask_LoopSEAdjustPanning, SE_M_TRI_ATTACK, SOUND_PAN_ATTACKER, SOUND_PAN_TARGET, 5, 6, 0, 7 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 16, RGB_BLACK delay 16 loadspritegfx ANIM_TAG_FIRE createsprite gLargeFlameScatterSpriteTemplate, ANIM_TARGET, 2, 0, 0, 30, 30, -1, 0 @@ -8063,7 +8063,7 @@ Move_TRI_ATTACK: waitforvisualfinish loadspritegfx ANIM_TAG_ICE_CRYSTALS call IceCrystalEffectShort - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 16, 0, RGB_BLACK waitforvisualfinish end @@ -8149,7 +8149,7 @@ Move_TRICK: Move_WISH: loadspritegfx ANIM_TAG_GOLD_STARS loadspritegfx ANIM_TAG_SPARKLE_2 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 0, 10, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 0, 10, RGB_BLACK waitforvisualfinish panse_adjustall SE_M_REFLECT, SOUND_PAN_TARGET, SOUND_PAN_ATTACKER, -3, 0 createsprite gWishStarSpriteTemplate, ANIM_ATTACKER, 40 @@ -8158,19 +8158,19 @@ Move_WISH: loopsewithpan SE_M_HEAL_BELL, SOUND_PAN_ATTACKER, 16, 3 call GrantingStarsEffect waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 10, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 10, 0, RGB_BLACK waitforvisualfinish end Move_STOCKPILE: loadspritegfx ANIM_TAG_GRAY_ORB playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendColorCycle, 2, 2, 8, 1, 0, 12, RGB_WHITE + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 8, 1, 0, 12, RGB_WHITE createvisualtask AnimTask_StockpileDeformMon, 5 call StockpileAbsorb call StockpileAbsorb waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 0, 12, 0, RGB_WHITE + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_ATTACKER, 0, 12, 0, RGB_WHITE end StockpileAbsorb: createsprite gStockpileAbsorptionOrbSpriteTemplate, ANIM_ATTACKER, 2, 55, 55, 13 @@ -8288,7 +8288,7 @@ Move_MORNING_SUN: loadspritegfx ANIM_TAG_BLUE_STAR createvisualtask AnimTask_MorningSunLightBeam, 5 delay 8 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x781, 8, 0, 12, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_BATTLERS_2, 8, 0, 12, RGB_WHITE delay 14 call MorningSunStar call MorningSunStar @@ -8305,7 +8305,7 @@ Move_MORNING_SUN: call MorningSunStar call MorningSunStar call MorningSunStar - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x781, 3, 12, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_BATTLERS_2, 3, 12, 0, RGB_WHITE waitforvisualfinish waitsound call HealingEffect @@ -8324,7 +8324,7 @@ Move_SWEET_SCENT: call SweetScentEffect createsprite gSweetScentPetalSpriteTemplate, ANIM_ATTACKER, 2, 55, 0 setpan SOUND_PAN_TARGET - createvisualtask AnimTask_BlendColorCycle, 2, 20, 1, 5, 5, 13, RGB(31, 21, 21) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_DEF_SIDE, 1, 5, 5, 13, RGB(31, 21, 21) call SweetScentEffect waitforvisualfinish end @@ -8355,7 +8355,7 @@ SweetScentEffect: Move_HYPER_BEAM: loadspritegfx ANIM_TAG_ORBS - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 4, 0, 16, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 4, 0, 16, RGB_BLACK waitforvisualfinish delay 10 playsewithpan SE_M_HYPER_BEAM, SOUND_PAN_ATTACKER @@ -8371,7 +8371,7 @@ Move_HYPER_BEAM: call HyperBeamOrbs call HyperBeamOrbs createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 50, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 11, RGB(25, 25, 25) + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 11, RGB(25, 25, 25) call HyperBeamOrbs call HyperBeamOrbs call HyperBeamOrbs @@ -8393,9 +8393,9 @@ Move_HYPER_BEAM: call HyperBeamOrbs call HyperBeamOrbs call HyperBeamOrbs - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 11, 0, RGB(25, 25, 25) + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 11, 0, RGB(25, 25, 25) waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 4, 16, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 4, 16, 0, RGB_BLACK end HyperBeamOrbs: createsprite gHyperBeamOrbSpriteTemplate, ANIM_TARGET, 2 @@ -8450,17 +8450,17 @@ CreateFlatterConfetti: Move_ROLE_PLAY: monbg ANIM_ATK_PARTNER - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 16, RGB_WHITE - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 0, 10, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 16, RGB_WHITE + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 0, 10, RGB_BLACK waitforvisualfinish playsewithpan SE_M_TRI_ATTACK, SOUND_PAN_ATTACKER waitplaysewithpan SE_M_DETECT, SOUND_PAN_ATTACKER, 30 createvisualtask AnimTask_RolePlaySilhouette, 2 waitforvisualfinish clearmonbg ANIM_ATK_PARTNER - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 16, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 16, 0, RGB_WHITE delay 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 2, 10, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 2, 10, 0, RGB_BLACK end Move_REFRESH: @@ -8473,7 +8473,7 @@ Move_REFRESH: call GrantingStarsEffect waitforvisualfinish playsewithpan SE_SHINY, SOUND_PAN_ATTACKER - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 10, 0, RGB(12, 24, 30) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 10, 0, RGB(12, 24, 30) createsprite gThinRingExpandingSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 0, 0 end @@ -8485,13 +8485,13 @@ Move_BLAZE_KICK: setalpha 12, 8 playsewithpan SE_M_FLAME_WHEEL, SOUND_PAN_TARGET createsprite gSpinningHandOrFootSpriteTemplate, ANIM_TARGET, 3, 0, 0, 1, 30 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 7, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 7, RGB_WHITE delay 30 playsewithpan SE_M_FIRE_PUNCH, SOUND_PAN_TARGET createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 2, 0, 0, ANIM_TARGET, 0 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 3, 0, 14, 1 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 4, 2, 0, 0, RGB_WHITE - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 1, RGB_BLACK, 8, RGB_BLACK, 0 + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_TARGET, 2, 0, 0, RGB_WHITE + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 1, RGB_BLACK, 8, RGB_BLACK, 0 call FireSpreadEffect waitforvisualfinish clearmonbg ANIM_TARGET @@ -8510,7 +8510,7 @@ Move_HYPER_VOICE: end HyperVoiceEffect: - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 3, 8, 0, RGB_YELLOW + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 3, 8, 0, RGB_YELLOW createvisualtask AnimTask_ScaleMonAndRestore, 5, -5, -5, 5, ANIM_ATTACKER, 0 createsprite gHyperVoiceRingSpriteTemplate, ANIM_ATTACKER, 0, 45, 0, 0, 0, 0, 0, 1 createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 1, 0, 6, 1 @@ -8521,14 +8521,14 @@ HyperVoiceEffect: Move_SAND_TOMB: loadspritegfx ANIM_TAG_MUD_SAND - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 4, 2, 0, 7, RGB(19, 17, 0) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_TARGET, 2, 0, 7, RGB(19, 17, 0) createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 43, 1 playsewithpan SE_M_SAND_TOMB, SOUND_PAN_TARGET call SandTombSwirlingDirt call SandTombSwirlingDirt call SandTombSwirlingDirt delay 22 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 4, 2, 7, 0, RGB(19, 17, 0) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_TARGET, 2, 7, 0, RGB(19, 17, 0) waitforvisualfinish end @@ -8627,7 +8627,7 @@ Move_DRAGON_CLAW: loadspritegfx ANIM_TAG_SMALL_EMBER loadspritegfx ANIM_TAG_CLAW_SLASH playsewithpan SE_M_SACRED_FIRE2, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 4, 0, 8, RGB(31, 19, 0) + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 4, 0, 8, RGB(31, 19, 0) createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 0, 2, 15, 1 call DragonClawFireSpiral call DragonClawFireSpiral @@ -8664,7 +8664,7 @@ Move_DRAGON_CLAW: createsprite gFireSpinSpriteTemplate, ANIM_ATTACKER, 2, 0, 28, 512, 25, 16, 46, ANIM_ATTACKER delay 2 createsprite gFireSpinSpriteTemplate, ANIM_ATTACKER, 2, 0, 33, 464, 30, 15, -50, ANIM_ATTACKER - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 4, 8, 0, RGB(31, 19, 0) + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 4, 8, 0, RGB(31, 19, 0) waitforvisualfinish end DragonClawFireSpiral: @@ -8747,7 +8747,7 @@ Move_REVENGE: playsewithpan SE_M_TAKE_DOWN, SOUND_PAN_ATTACKER createsprite gRevengeSmallScratchSpriteTemplate, ANIM_ATTACKER, 2, 10, -10 waitforvisualfinish - createvisualtask AnimTask_BlendColorCycle, 2, 2, 0, 4, 2, 8, RGB_RED + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 0, 4, 2, 8, RGB_RED waitforvisualfinish unloadspritegfx ANIM_TAG_PURPLE_SCRATCH loadspritegfx ANIM_TAG_PURPLE_SWIPE @@ -8777,7 +8777,7 @@ Move_POISON_FANG: delay 10 createvisualtask AnimTask_ShakeMon, 3, ANIM_TARGET, 3, 0, 10, 1 waitforvisualfinish - createvisualtask AnimTask_BlendColorCycle, 2, 4, 0, 4, 0, 12, RGB(26, 0, 26) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_TARGET, 0, 4, 0, 12, RGB(26, 0, 26) call PoisonBubblesEffect waitforvisualfinish end @@ -8793,7 +8793,7 @@ Move_FRENZY_PLANT: monbg ANIM_TARGET splitbgprio ANIM_TARGET setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 1, 2, 0, 5, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_BG, 2, 0, 5, RGB_BLACK waitforvisualfinish createsprite gFrenzyPlantRootSpriteTemplate, ANIM_ATTACKER, 2, 10, 8, 2, 0, 0, 100 playsewithpan SE_M_SCRATCH, SOUND_PAN_ATTACKER @@ -8841,7 +8841,7 @@ Move_FRENZY_PLANT: createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, 0, 10, ANIM_TARGET, 1 playsewithpan SE_M_DOUBLE_SLAP, SOUND_PAN_TARGET waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 1, 2, 5, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_BG, 2, 5, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_TARGET blendoff @@ -8983,7 +8983,7 @@ ReturnStrong: createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 6, 0, 8, 1 goto ReturnContinue ReturnStrongest: - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 0, 6, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 0, 0, 6, RGB_BLACK waitforvisualfinish createsprite gVerticalDipSpriteTemplate, ANIM_ATTACKER, 2, 16, 1, ANIM_ATTACKER createvisualtask SoundTask_PlaySE2WithPanning, 5, SE_M_TAIL_WHIP, SOUND_PAN_ATTACKER @@ -9040,7 +9040,7 @@ ReturnStrongest: createsprite gBasicHitSplatSpriteTemplate, ANIM_ATTACKER, 2, -5, 3, ANIM_TARGET, 0 createvisualtask SoundTask_PlaySE1WithPanning, 5, SE_M_MEGA_KICK2, SOUND_PAN_TARGET waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 6, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 0, 6, 0, RGB_BLACK goto ReturnContinue ReturnStrongestHit: createsprite gVerticalDipSpriteTemplate, ANIM_ATTACKER, 2, 4, 3, ANIM_ATTACKER @@ -9170,7 +9170,7 @@ Move_SILVER_WIND: createvisualtask AnimTask_StartSlidingBg, 5, 1536, 0, 0, -1 SilverWindContinue: delay 0 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 1, 0, 4, 4, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG, 0, 4, 4, RGB_BLACK waitbgfadein createsprite gSilverWindBigSparkSpriteTemplate, ANIM_TARGET, 66, -32, 16, 0, 6, 2, 3, 1 createsprite gSilverWindBigSparkSpriteTemplate, ANIM_TARGET, 66, -8, 18, 64, 3, 2, 2, 1 @@ -9284,7 +9284,7 @@ Move_OVERHEAT: loadspritegfx ANIM_TAG_IMPACT monbg ANIM_DEF_PARTNER setalpha 12, 18 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 5, RGB(28, 0, 0) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 5, RGB(28, 0, 0) waitforvisualfinish createvisualtask AnimTask_AllocBackupPalBuffer, 5 waitforvisualfinish @@ -9295,7 +9295,7 @@ Move_OVERHEAT: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER createvisualtask AnimTask_CopyPalUnfadedToBackup, 5, 1, 0 delay 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 1, 0, 13, RGB(28, 0, 0) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_ATTACKER, 1, 0, 13, RGB(28, 0, 0) createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 2, 0, 15, 1 waitforvisualfinish playsewithpan SE_M_FLAME_WHEEL2, SOUND_PAN_ATTACKER @@ -9341,12 +9341,12 @@ Move_OVERHEAT: playsewithpan SE_M_FIRE_PUNCH, SOUND_PAN_TARGET createvisualtask AnimTask_CopyPalFadedToUnfaded, 5, 1 delay 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, -1, 0, 13, RGB(18, 18, 18) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_ATTACKER, -1, 0, 13, RGB(18, 18, 18) createvisualtask AnimTask_ShakeMon, 5, ANIM_ATTACKER, 3, 0, 15, 1 waitforvisualfinish createvisualtask AnimTask_CopyPalUnfadedFromBackup, 5, 0, 1 delay 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 5, 0, RGB(28, 0, 0) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 5, 0, RGB(28, 0, 0) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -9354,7 +9354,7 @@ Move_OVERHEAT: delay 15 createvisualtask AnimTask_CopyPalUnfadedFromBackup, 5, 1, 0 delay 1 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 0, 13, 0, RGB(18, 18, 18) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_ATTACKER, 0, 13, 0, RGB(18, 18, 18) waitforvisualfinish createvisualtask AnimTask_FreeBackupPalBuffer, 5 waitforvisualfinish @@ -9498,7 +9498,7 @@ Move_WATER_PULSE: monbg ANIM_TARGET splitbgprio ANIM_TARGET playsewithpan SE_M_BUBBLE3, SOUND_PAN_ATTACKER - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 0, 0, 7, RGB(0, 25, 28) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 0, 0, 7, RGB(0, 25, 28) delay 10 createsprite gWaterPulseBubbleSpriteTemplate, ANIM_ATTACKER, 66, 100, 100, 8, 1, 20, 40, 0 createsprite gWaterPulseBubbleSpriteTemplate, ANIM_ATTACKER, 66, 20, 100, 16, 2, 10, 35, 1 @@ -9518,7 +9518,7 @@ Move_WATER_PULSE: delay 13 createvisualtask AnimTask_ShakeMon, 2, ANIM_TARGET, 0, 8, 18, 1 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 7, 0, RGB(0, 25, 28) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 7, 0, RGB(0, 25, 28) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER end @@ -9531,7 +9531,7 @@ Move_PSYCHO_BOOST: createvisualtask AnimTask_FadeScreenToWhite, 5 waitbgfadein delay 6 - createvisualtask AnimTask_BlendColorCycle, 2, 1, 2, 8, 0, 10, RGB_BLACK + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_BG, 2, 8, 0, 10, RGB_BLACK delay 0 splitbgprio ANIM_ATTACKER setalpha 8, 8 @@ -9558,7 +9558,7 @@ Move_KNOCK_OFF: playsewithpan SE_M_VITAL_THROW, SOUND_PAN_TARGET createsprite gKnockOffStrikeSpriteTemplate, ANIM_TARGET, 2, -16, -16 delay 8 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 5, 1, RGB_WHITE, 10, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 5, 1, RGB_WHITE, 10, RGB_BLACK, 0 createsprite gBasicHitSplatSpriteTemplate, ANIM_TARGET, 3, 0, 0, ANIM_TARGET, 2 playsewithpan SE_M_COMET_PUNCH, SOUND_PAN_TARGET createsprite gSlideMonToOffsetSpriteTemplate, ANIM_ATTACKER, 2, 1, -12, 10, 0, 3 @@ -9576,7 +9576,7 @@ Move_DOOM_DESIRE: delay 1 monbg ANIM_ATK_PARTNER createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, ANIM_TARGET, FALSE - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 4, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 4, RGB_BLACK waitforvisualfinish setalpha 8, 8 playsewithpan SE_M_PSYBEAM, SOUND_PAN_ATTACKER @@ -9584,7 +9584,7 @@ Move_DOOM_DESIRE: waitforvisualfinish delay 20 createvisualtask AnimTask_SetGrayscaleOrOriginalPal, 5, ANIM_TARGET, TRUE - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 4, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 4, 0, RGB_BLACK waitforvisualfinish clearmonbg ANIM_ATK_PARTNER blendoff @@ -9836,7 +9836,7 @@ Move_WEATHER_BALL: waitforvisualfinish delay 15 playsewithpan SE_M_DETECT, 0 - createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 31, 5, 1, RGB_WHITE, 10, RGB_BLACK, 0 + createsprite gComplexPaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG | F_PAL_BATTLERS, 5, 1, RGB_WHITE, 10, RGB_BLACK, 0 waitforvisualfinish createvisualtask AnimTask_GetWeather, 2 delay 1 @@ -10218,7 +10218,7 @@ UnsetSolarBeamBg: Status_Poison: loopsewithpan SE_M_TOXIC, SOUND_PAN_TARGET, 13, 6 createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 18, 2 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 2, 0, 12, RGB(30, 0, 31) + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 12, RGB(30, 0, 31) end Status_Confusion: @@ -10320,13 +10320,13 @@ General_StatsChange: General_SubstituteFade: monbg ANIM_ATTACKER createvisualtask AnimTask_SubstituteFadeToInvisible, 5 - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 0, 0, 16, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 0, 0, 16, RGB_WHITE waitforvisualfinish delay 1 clearmonbg ANIM_ATTACKER delay 2 blendoff - createvisualtask AnimTask_BlendBattleAnimPal, 10, 2, 0, 0, 0, RGB_WHITE + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_ATTACKER, 0, 0, 0, RGB_WHITE createvisualtask AnimTask_SwapMonSpriteToFromSubstitute, 2, TRUE end @@ -10389,13 +10389,13 @@ Status_Whirlpool: splitbgprio ANIM_TARGET setalpha 12, 8 delay 0 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 4, 2, 0, 7, RGB(0, 13, 23) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_TARGET, 2, 0, 7, RGB(0, 13, 23) playsewithpan SE_M_WHIRLPOOL, SOUND_PAN_TARGET createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 30, 1 call WhirlpoolEffect call WhirlpoolEffect delay 12 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 4, 2, 7, 0, RGB(0, 13, 23) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_TARGET, 2, 7, 0, RGB(0, 13, 23) waitforvisualfinish stopsound clearmonbg ANIM_DEF_PARTNER @@ -10420,13 +10420,13 @@ Status_Clamp: Status_SandTomb: loadspritegfx ANIM_TAG_MUD_SAND - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 4, 2, 0, 7, RGB(19, 17, 0) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_TARGET, 2, 0, 7, RGB(19, 17, 0) createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 2, 30, 1 playsewithpan SE_M_SAND_TOMB, SOUND_PAN_TARGET call SandTombSwirlingDirt call SandTombSwirlingDirt delay 22 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 4, 2, 7, 0, RGB(19, 17, 0) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_TARGET, 2, 7, 0, RGB(19, 17, 0) waitforvisualfinish stopsound end @@ -10448,7 +10448,7 @@ General_HeldItemEffect: call GrantingStarsEffect waitforvisualfinish playsewithpan SE_SHINY, SOUND_PAN_ATTACKER - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 2, 3, 7, 0, RGB(17, 31, 25) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_ATTACKER, 3, 7, 0, RGB(17, 31, 25) createsprite gThinRingExpandingSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 0, 0 waitforvisualfinish end @@ -10492,11 +10492,11 @@ General_SmokeballEscape: end General_FocusBand: - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 2, 7, 0, 9, RGB_RED + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_ATTACKER, 7, 0, 9, RGB_RED playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER createvisualtask AnimTask_SlideMonForFocusBand, 5, 30, 128, 0, 1, 2, 0, 1 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 2, 4, 9, 0, RGB_RED + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, F_PAL_ATTACKER, 4, 9, 0, RGB_RED waitforvisualfinish delay 6 createsprite gSlideMonToOriginalPosSpriteTemplate, ANIM_ATTACKER, 0, 0, 0, 15 @@ -10505,13 +10505,13 @@ General_FocusBand: General_Rain: loadspritegfx ANIM_TAG_RAIN_DROPS playsewithpan SE_M_RAIN_DANCE, SOUND_PAN_ATTACKER - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x781, 2, 0, 4, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_BATTLERS_2, 2, 0, 4, RGB_BLACK waitforvisualfinish createvisualtask AnimTask_CreateRaindrops, 2, 0, 3, 60 createvisualtask AnimTask_CreateRaindrops, 2, 0, 3, 60 delay 50 waitforvisualfinish - createvisualtask AnimTask_BlendBattleAnimPal, 10, 0x781, 2, 4, 0, RGB_BLACK + createvisualtask AnimTask_BlendBattleAnimPal, 10, F_PAL_BG | F_PAL_BATTLERS_2, 2, 4, 0, RGB_BLACK waitforvisualfinish end @@ -10595,7 +10595,7 @@ General_FutureSightHit: General_DoomDesireHit: createvisualtask AnimTask_SetAnimTargetToBattlerTarget, 2 loadspritegfx ANIM_TAG_EXPLOSION - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 0, 16, RGB_WHITE + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 0, 16, RGB_WHITE waitforvisualfinish delay 10 createvisualtask AnimTask_DoomDesireLightBeam, 5 @@ -10622,7 +10622,7 @@ General_DoomDesireHit: playsewithpan SE_M_SELF_DESTRUCT, SOUND_PAN_TARGET createsprite gExplosionSpriteTemplate, ANIM_ATTACKER, 3, 16, 16, 1, 1 waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 16, 0, RGB_WHITE + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 16, 0, RGB_WHITE waitforvisualfinish end @@ -10631,7 +10631,7 @@ General_FocusPunchSetUp: playsewithpan SE_M_DRAGON_RAGE, SOUND_PAN_ATTACKER call EndureEffect delay 8 - createvisualtask AnimTask_BlendColorCycle, 2, 2, 2, 2, 0, 11, RGB_RED + createvisualtask AnimTask_BlendColorCycle, 2, F_PAL_ATTACKER, 2, 2, 0, 11, RGB_RED createvisualtask AnimTask_ShakeMon2, 2, ANIM_ATTACKER, 1, 0, 32, 1 call EndureEffect delay 8 @@ -10644,7 +10644,7 @@ General_IngrainHeal: loadspritegfx ANIM_TAG_BLUE_STAR monbg ANIM_DEF_PARTNER setalpha 12, 8 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 0, 4, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 0, 4, RGB(13, 31, 12) waitforvisualfinish delay 3 call AbsorbEffect @@ -10652,7 +10652,7 @@ General_IngrainHeal: delay 15 call HealingEffect waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 1, 4, 0, RGB(13, 31, 12) + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 1, 4, 0, RGB(13, 31, 12) waitforvisualfinish clearmonbg ANIM_DEF_PARTNER blendoff @@ -10660,7 +10660,7 @@ General_IngrainHeal: General_WishHeal: loadspritegfx ANIM_TAG_SPARKLE_2 - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 0, 10, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 0, 10, RGB_BLACK waitforvisualfinish playsewithpan SE_M_MEGA_KICK, SOUND_PAN_ATTACKER call GrantingStarsEffect @@ -10669,7 +10669,7 @@ General_WishHeal: loadspritegfx ANIM_TAG_BLUE_STAR call HealingEffect waitforvisualfinish - createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, 1, 3, 10, 0, RGB_BLACK + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 2, F_PAL_BG, 3, 10, 0, RGB_BLACK end SnatchMoveTrySwapFromSubstitute: diff --git a/gflib/bg.h b/gflib/bg.h index d8b5a5404..02ff07369 100644 --- a/gflib/bg.h +++ b/gflib/bg.h @@ -76,7 +76,7 @@ s32 ChangeBgY(u8 bg, s32 value, u8 op); s32 ChangeBgY_ScreenOff(u8 bg, s32 value, u8 op); s32 GetBgY(u8 bg); void SetBgAffine(u8 bg, s32 srcCenterX, s32 srcCenterY, s16 dispCenterX, s16 dispCenterY, s16 scaleX, s16 scaleY, u16 rotationAngle); -u8 Unused_AdjustBgMosaic(u8 a1, u8 a2); +u8 Unused_AdjustBgMosaic(u8 val, u8 mode); void SetBgTilemapBuffer(u8 bg, void *tilemap); void UnsetBgTilemapBuffer(u8 bg); void* GetBgTilemapBuffer(u8 bg); diff --git a/gflib/sprite.c b/gflib/sprite.c index f05fe76f2..e5bf89063 100644 --- a/gflib/sprite.c +++ b/gflib/sprite.c @@ -94,7 +94,7 @@ static void ApplyAffineAnimFrame(u8 matrixNum, struct AffineAnimFrameCmd *frameC static u8 IndexOfSpriteTileTag(u16 tag); static void AllocSpriteTileRange(u16 tag, u16 start, u16 count); static void DoLoadSpritePalette(const u16 *src, u16 paletteOffset); -static void UpdateSpriteMatrixAnchorPos(struct Sprite* sprite, s32 a1, s32 a2); +static void UpdateSpriteMatrixAnchorPos(struct Sprite*, s32, s32); typedef void (*AnimFunc)(struct Sprite *); typedef void (*AnimCmdFunc)(struct Sprite *); @@ -632,14 +632,11 @@ void DestroySprite(struct Sprite *sprite) } } -void ResetOamRange(u8 a, u8 b) +void ResetOamRange(u8 start, u8 end) { u8 i; - - for (i = a; i < b; i++) - { + for (i = start; i < end; i++) gMain.oamBuffer[i] = *(struct OamData *)&gDummyOamData; - } } void LoadOam(void) diff --git a/gflib/sprite.h b/gflib/sprite.h index e53737981..f7ef16532 100644 --- a/gflib/sprite.h +++ b/gflib/sprite.h @@ -270,7 +270,7 @@ u8 CreateSpriteAtEnd(const struct SpriteTemplate *template, s16 x, s16 y, u8 sub u8 CreateInvisibleSprite(void (*callback)(struct Sprite *)); u8 CreateSpriteAndAnimate(const struct SpriteTemplate *template, s16 x, s16 y, u8 subpriority); void DestroySprite(struct Sprite *sprite); -void ResetOamRange(u8 a, u8 b); +void ResetOamRange(u8 start, u8 end); void LoadOam(void); void SetOamMatrix(u8 matrixNum, u16 a, u16 b, u16 c, u16 d); void CalcCenterToCornerVec(struct Sprite *sprite, u8 shape, u8 size, u8 affineMode); diff --git a/gflib/text.c b/gflib/text.c index 557c11704..c400c0582 100644 --- a/gflib/text.c +++ b/gflib/text.c @@ -326,14 +326,14 @@ void RunTextPrinters(void) { if (sTextPrinters[i].active) { - u16 temp = RenderFont(&sTextPrinters[i]); - switch (temp) + u16 renderCmd = RenderFont(&sTextPrinters[i]); + switch (renderCmd) { case RENDER_PRINT: CopyWindowToVram(sTextPrinters[i].printerTemplate.windowId, COPYWIN_GFX); case RENDER_UPDATE: - if (sTextPrinters[i].callback != 0) - sTextPrinters[i].callback(&sTextPrinters[i].printerTemplate, temp); + if (sTextPrinters[i].callback != NULL) + sTextPrinters[i].callback(&sTextPrinters[i].printerTemplate, renderCmd); break; case RENDER_FINISH: sTextPrinters[i].active = FALSE; diff --git a/include/battle_anim.h b/include/battle_anim.h index d8b2cd4db..c98766ea8 100644 --- a/include/battle_anim.h +++ b/include/battle_anim.h @@ -62,7 +62,7 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible) bool8 IsContest(void); s8 BattleAnimAdjustPanning(s8 pan); s8 BattleAnimAdjustPanning2(s8 pan); -s16 KeepPanInRange(s16 a, int oldPan); +s16 KeepPanInRange(s16 panArg, int oldPan); s16 CalculatePanIncrement(s16 sourcePan, s16 targetPan, s16 incrementPan); void RelocateBattleBgPal(u16 paletteNum, u16 *dest, u32 offset, bool8 largeScreen); void ResetBattleAnimBg(bool8); @@ -91,14 +91,14 @@ bool8 AnimTranslateLinear(struct Sprite *sprite); void TranslateAnimSpriteToTargetMonLocation(struct Sprite *sprite); u8 GetBattlerSpriteCoord2(u8 battlerId, u8 attributeId); void InitAnimLinearTranslationWithSpeed(struct Sprite *sprite); -u16 ArcTan2Neg(s16 a, s16 b); -void TrySetSpriteRotScale(struct Sprite *sprite, bool8 a2, s16 xScale, s16 yScale, u16 rotation); +u16 ArcTan2Neg(s16 x, s16 y); +void TrySetSpriteRotScale(struct Sprite *sprite, bool8 recalcCenterVector, s16 xScale, s16 yScale, u16 rotation); void RunStoredCallbackWhenAffineAnimEnds(struct Sprite *sprite); void TranslateSpriteLinearAndFlicker(struct Sprite *sprite); void SetSpriteCoordsToAnimAttackerCoords(struct Sprite *sprite); void RunStoredCallbackWhenAnimEnds(struct Sprite *sprite); -void SetAnimSpriteInitialXOffset(struct Sprite *sprite, s16 a2); -s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 a2); +void SetAnimSpriteInitialXOffset(struct Sprite *sprite, s16 xOffset); +s16 GetBattlerSpriteCoordAttr(u8 battlerId, u8 attr); u8 GetBattlerYCoordWithElevation(u8 battlerId); void WaitAnimForDuration(struct Sprite *sprite); void AnimTravelDiagonally(struct Sprite *sprite); @@ -109,7 +109,7 @@ void *LoadPointerFromVars(s16 bottom, s16 top); void StorePointerInVars(s16 *bottom, s16 *top, const void *ptr); void InitPrioritiesForVisibleBattlers(void); void GetBattleAnimBg1Data(struct BattleAnimBgData*); -void GetBattleAnimBgData(struct BattleAnimBgData*, u32 arg1); +void GetBattleAnimBgData(struct BattleAnimBgData*, u32 bgId); u8 GetBattlerSpriteSubpriority(u8 battlerId); bool8 TranslateAnimHorizontalArc(struct Sprite *sprite); void TranslateSpriteLinearByIdFixedPoint(struct Sprite *sprite); @@ -118,7 +118,7 @@ void SetSpriteRotScale(u8 spriteId, s16 xScale, s16 yScale, u16 rotation); void InitSpriteDataForLinearTranslation(struct Sprite *sprite); void PrepareBattlerSpriteForRotScale(u8 spriteId, u8 objMode); void SetBattlerSpriteYOffsetFromRotation(u8 spriteId); -u32 GetBattleBgPalettesMask(u8 battleBackground, u8 attacker, u8 target, u8 attackerPartner, u8 targetPartner, u8 a6, u8 a7); +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); s16 CloneBattlerSpriteWithBlend(u8); @@ -129,7 +129,7 @@ void AnimLoadCompressedBgGfx(u32, const u32*, u32); void UpdateAnimBg3ScreenSize(bool8); void TranslateSpriteInGrowingCircle(struct Sprite *); void SetBattlerSpriteYOffsetFromYScale(u8 spriteId); -void PrepareEruptAnimTaskData(struct Task *task, u8 a2, s16 a3, s16 a4, s16 a5, s16 a6, u16 a7); +void PrepareEruptAnimTaskData(struct Task *task, u8 spriteId, s16 xScaleStart, s16 yScaleStart, s16 xScaleEnd, s16 yScaleEnd, u16 duration); u8 UpdateEruptAnimTask(struct Task *task); void DestroyAnimSpriteAndDisableBlend(struct Sprite *); void AnimLoadCompressedBgTilemap(u32 bgId, const void *src); @@ -146,7 +146,7 @@ void PrepareAffineAnimInTaskData(struct Task *task, u8 spriteId, const union Aff bool8 RunAffineAnimFromTaskData(struct Task *task); void AnimThrowProjectile(struct Sprite *sprite); void GetBgDataForTransform(struct BattleAnimBgData *dest, u8 battlerId); -u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 a3, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, bool32 ignoreDeoxysForm); +u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16 x, s16 y, u8 subpriority, u32 personality, u32 trainerId, u32 battlerId, bool32 ignoreDeoxysForm); void ResetSpriteRotScale_PreserveAffine(struct Sprite *sprite); void TradeMenuBouncePartySprites(struct Sprite *sprite); void DestroyAnimVisualTaskAndDisableBlend(u8 taskId); @@ -181,7 +181,7 @@ enum u8 GetBattlerSpriteCoord(u8 battlerId, u8 attributeId); bool8 IsBattlerSpritePresent(u8 battlerId); -void ClearBattleAnimBg(u32 arg0); +void ClearBattleAnimBg(u32 bgId); u8 GetAnimBattlerSpriteId(u8 wantedBattler); bool8 IsDoubleBattle(void); u8 GetBattleBgPaletteNum(void); @@ -209,11 +209,11 @@ void AnimTask_HorizontalShake(u8 taskId); void TryShinyAnimation(u8 battler, struct Pokemon *mon); u8 ItemIdToBallId(u16 itemId); u8 AnimateBallOpenParticles(u8 x, u8 y, u8 priority, u8 subpriority, u8 ballId); -u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 battlerId, u32 selectedPalettes, u8 ballId); +u8 LaunchBallFadeMonTask(bool8 unFadeLater, u8 spritePalNum, u32 selectedPalettes, u8 ballId); // battle_anim_utility_funcs.c void InitStatsChangeAnimation(u8); -void StartMonScrollingBgMask(u8 taskId, int unused, u16 arg2, u8 battler1, u8 arg4, u8 arg5, u8 arg6, u8 arg7, const u32 *arg8, const u32 *arg9, const u32 *palette); +void StartMonScrollingBgMask(u8 taskId, int unused, u16 scrollSpeed, u8 battler, bool8 includePartner, u8 numFadeSteps, u8 fadeStepDelay, u8 duration, const u32 *gfx, const u32 *tilemap, const u32 *palette); // battle_anim_effects_1.c void SetSpriteNextToMonHead(u8 battler, struct Sprite* sprite); @@ -227,9 +227,9 @@ void AnimWaterPulseRing(struct Sprite *sprite); void DestroyAnimSpriteAfterTimer(struct Sprite *sprite); // battle_anim_smokescreen.c -u8 SmokescreenImpact(s16 x, s16 y, u8 a3); +u8 SmokescreenImpact(s16 x, s16 y, bool8 persist); -u32 UnpackSelectedBattleBgPalettes(s16); +u32 UnpackSelectedBattlePalettes(s16); u8 GetBattlerSpriteFinal_Y(u8, u16, u8); diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 9d9fba1b4..5b6ba30bd 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -222,7 +222,7 @@ void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringId); void BtlController_EmitChooseAction(u8 bufferId, u8 action, u16 itemId); void BtlController_EmitYesNoBox(u8 bufferId); void BtlController_EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData); -void BtlController_EmitChooseItem(u8 bufferId, u8* arg1); +void BtlController_EmitChooseItem(u8 bufferId, u8* battlePartyOrder); void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 slotId, u8 abilityId, u8* data); void BtlController_EmitCmd23(u8 bufferId); // unused void BtlController_EmitHealthBarUpdate(u8 bufferId, u16 hpValue); @@ -233,11 +233,11 @@ void BtlController_EmitStatusXor(u8 bufferId, u8 b); // unused void BtlController_EmitDataTransfer(u8 bufferId, u16 size, void *data); void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data); // unused void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *data); // unused -void BtlController_EmitCmd32(u8 bufferId, u16 size, void *c); // unused -void BtlController_EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2); -void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 b, u8 *c); -void BtlController_EmitOneReturnValue(u8 bufferId, u16 arg1); -void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 b); +void BtlController_EmitCmd32(u8 bufferId, u16 size, void *data); // unused +void BtlController_EmitTwoReturnValues(u8 bufferId, u8 ret8, u16 ret16); +void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 partyId, u8 *battlePartyOrder); +void BtlController_EmitOneReturnValue(u8 bufferId, u16 ret); +void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 ret); void BtlController_EmitClearUnkVar(u8 bufferId); // unused void BtlController_EmitSetUnkVar(u8 bufferId, u8 b); // unused void BtlController_EmitClearUnkFlag(u8 bufferId); // unused @@ -254,7 +254,7 @@ void BtlController_EmitHidePartyStatusSummary(u8 bufferId); void BtlController_EmitEndBounceEffect(u8 bufferId); void BtlController_EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible); void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument); -void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 record); +void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 mode, bool32 record); void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId); void BtlController_EmitEndLinkBattle(u8 bufferId, u8 battleOutcome); diff --git a/include/battle_gfx_sfx_util.h b/include/battle_gfx_sfx_util.h index 383facd69..2a848e3d9 100644 --- a/include/battle_gfx_sfx_util.h +++ b/include/battle_gfx_sfx_util.h @@ -19,7 +19,7 @@ void DecompressTrainerBackPic(u16 backPicId, u8 battlerId); void BattleGfxSfxDummy3(u8 gender); void FreeTrainerFrontPicPalette(u16 frontPicId); bool8 BattleLoadAllHealthBoxesGfx(u8 state); -void LoadBattleBarGfx(u8 arg0); +void LoadBattleBarGfx(u8 unused); bool8 BattleInitAllSprites(u8 *state1, u8 *battlerId); void ClearSpritesHealthboxAnimData(void); void CopyAllBattleSpritesInvisibilities(void); diff --git a/include/battle_interface.h b/include/battle_interface.h index 3145939d0..c4816e8da 100644 --- a/include/battle_interface.h +++ b/include/battle_interface.h @@ -71,10 +71,10 @@ void UpdateOamPriorityInAllHealthboxes(u8 priority); void InitBattlerHealthboxCoords(u8 battler); void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent); void SwapHpBarsWithHpText(void); -u8 CreatePartyStatusSummarySprites(u8 battler, struct HpAndStatus *partyInfo, u8 arg2, bool8 isBattleStart); +u8 CreatePartyStatusSummarySprites(u8 battler, struct HpAndStatus *partyInfo, bool8 skipPlayer, bool8 isBattleStart); void Task_HidePartyStatusSummary(u8 taskId); void UpdateHealthboxAttribute(u8 healthboxSpriteId, struct Pokemon *mon, u8 elementId); -s32 MoveBattleBar(u8 battler, u8 healthboxSpriteId, u8 whichBar, u8 arg3); +s32 MoveBattleBar(u8 battler, u8 healthboxSpriteId, u8 whichBar, u8 unused); u8 GetScaledHPFraction(s16 hp, s16 maxhp, u8 scale); u8 GetHPBarLevel(s16 hp, s16 maxhp); diff --git a/include/battle_setup.h b/include/battle_setup.h index 8f78bba3c..ee2837927 100644 --- a/include/battle_setup.h +++ b/include/battle_setup.h @@ -28,7 +28,7 @@ void BattleSetup_StartLegendaryBattle(void); void StartGroudonKyogreBattle(void); void StartRegiBattle(void); u8 BattleSetup_GetTerrainId(void); -u8 GetSpecialBattleTransition(s32 arg0); +u8 GetSpecialBattleTransition(s32 id); void ChooseStarter(void); void ResetTrainerOpponentIds(void); void SetMapVarsToTrainer(void); diff --git a/include/battle_util.h b/include/battle_util.h index 914e44c04..d15d4583e 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -66,7 +66,7 @@ void PressurePPLoseOnUsingPerishSong(u8 attacker); void PressurePPLoseOnUsingImprison(u8 attacker); void MarkAllBattlersForControllerExec(void); // unused void MarkBattlerForControllerExec(u8 battlerId); -void MarkBattlerReceivedLinkData(u8 arg0); +void MarkBattlerReceivedLinkData(u8 battlerId); void CancelMultiTurnMoves(u8 battlerId); bool8 WasUnableToUseMove(u8 battlerId); void PrepareStringBattle(u16 stringId, u8 battlerId); diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index 2ff9318be..00ad083eb 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -413,4 +413,21 @@ #define ANIM_WEATHER_SANDSTORM 3 #define ANIM_WEATHER_HAIL 4 +// Flags given to various functions to indicate which palettes to consider. +// Handled by UnpackSelectedBattlePalettes +#define F_PAL_BG (1 << 0) +#define F_PAL_ATTACKER (1 << 1) +#define F_PAL_TARGET (1 << 2) +#define F_PAL_ATK_PARTNER (1 << 3) +#define F_PAL_DEF_PARTNER (1 << 4) +#define F_PAL_ANIM_1 (1 << 5) // Palette set for GetBattleAnimBg1Data/GetBgDataForTransform. Only used (ineffectually?) by Aromatherapy. +#define F_PAL_ANIM_2 (1 << 6) // Palette set for GetBattleAnimBgData/GetBgDataForTransform. Unused. +#define F_PAL_ATK_SIDE (F_PAL_ATTACKER | F_PAL_ATK_PARTNER) +#define F_PAL_DEF_SIDE (F_PAL_TARGET | F_PAL_DEF_PARTNER) +#define F_PAL_BATTLERS (F_PAL_ATK_SIDE | F_PAL_DEF_SIDE) +// The below are only used by AnimTask_BlendBattleAnimPal to get battler sprite palettes by position rather than by role. +// It's redundant with F_PAL_BATTLERS, because they're only ever used together to refer to all the battlers at once. +#define F_PAL_BATTLERS_2 (1 << 7 | 1 << 8 | 1 << 9 | 1 << 10) + + #endif // GUARD_CONSTANTS_BATTLE_ANIM_H diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index d5d0698b9..ae18b61ef 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -599,4 +599,6 @@ #define B_MSG_REF_DRAW 7 #define B_MSG_REF_COMMENCE_BATTLE 8 +#define NUM_TRAPPING_MOVES 6 + #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H diff --git a/include/contest.h b/include/contest.h index 1168ebfe7..d0630a801 100644 --- a/include/contest.h +++ b/include/contest.h @@ -339,11 +339,11 @@ void SetLinkAIContestants(u8 contestType, u8 rank, bool32 isPostgame); u8 GetContestEntryEligibility(struct Pokemon *pkmn); void CalculateRound1Points(u8 contestCategory); bool8 IsSpeciesNotUnown(u16 species); -bool8 Contest_IsMonsTurnDisabled(u8 a); +bool8 Contest_IsMonsTurnDisabled(u8 contestant); void SaveLinkContestResults(void); -void SortContestants(bool8 a); -void SetContestantEffectStringID(u8 a, u8 b); -void SetContestantEffectStringID2(u8 a, u8 b); +void SortContestants(bool8 useRanking); +void SetContestantEffectStringID(u8 contestant, u8 effectStringId); +void SetContestantEffectStringID2(u8 contestant, u8 effectStringId); void SetStartledString(u8 contestant, u8 jam); void MakeContestantNervous(u8 p); s8 Contest_GetMoveExcitement(u16 move); diff --git a/include/decompress.h b/include/decompress.h index 02412defb..14906211c 100644 --- a/include/decompress.h +++ b/include/decompress.h @@ -13,7 +13,7 @@ void LoadCompressedSpriteSheetOverrideBuffer(const struct CompressedSpriteSheet bool8 LoadCompressedSpriteSheetUsingHeap(const struct CompressedSpriteSheet* src); void LoadCompressedSpritePalette(const struct CompressedSpritePalette *src); -void LoadCompressedSpritePaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer); +void LoadCompressedSpritePaletteOverrideBuffer(const struct CompressedSpritePalette *src, void *buffer); bool8 LoadCompressedSpritePaletteUsingHeap(const struct CompressedSpritePalette *src); void DecompressPicFromTable(const struct CompressedSpriteSheet *src, void* buffer, s32 species); diff --git a/include/digit_obj_util.h b/include/digit_obj_util.h index aca97e2c7..4442fb0ec 100644 --- a/include/digit_obj_util.h +++ b/include/digit_obj_util.h @@ -18,9 +18,9 @@ struct DigitObjUtilTemplate bool32 DigitObjUtil_Init(u32 count); void DigitObjUtil_Free(void); bool32 DigitObjUtil_CreatePrinter(u32 id, s32 num, const struct DigitObjUtilTemplate *template); -void DigitObjUtil_PrintNumOn(u32 id, s32 arg1); +void DigitObjUtil_PrintNumOn(u32 id, s32 num); void DigitObjUtil_DeletePrinter(u32 id); -void DigitObjUtil_HideOrShow(u32 id, bool32 arg1); +void DigitObjUtil_HideOrShow(u32 id, bool32 hide); u8 GetTilesPerImage(u32 shape, u32 size); #endif // GUARD_DIGIT_OBJ_UTIL_H diff --git a/include/evolution_graphics.h b/include/evolution_graphics.h index 61051c69a..eab5c6eb7 100644 --- a/include/evolution_graphics.h +++ b/include/evolution_graphics.h @@ -3,7 +3,7 @@ void LoadEvoSparkleSpriteAndPal(void); -u8 EvolutionSparkles_SpiralUpward(u16 arg0); +u8 EvolutionSparkles_SpiralUpward(u16 palNum); u8 EvolutionSparkles_ArcDown(void); u8 EvolutionSparkles_CircleInward(void); u8 EvolutionSparkles_SprayAndFlash(u16 species); diff --git a/include/field_camera.h b/include/field_camera.h index b245fca84..6e8af1a53 100644 --- a/include/field_camera.h +++ b/include/field_camera.h @@ -17,14 +17,14 @@ extern u16 gTotalCameraPixelOffsetY; void DrawWholeMapView(void); void CurrentMapDrawMetatileAt(int x, int y); -void GetCameraOffsetWithPan(s16 *a0, s16 *a1); +void GetCameraOffsetWithPan(s16 *x, s16 *y); void DrawDoorMetatileAt(int x, int y, u16 *arr); void ResetFieldCamera(void); void ResetCameraUpdateInfo(void); -u32 InitCameraUpdateCallback(u8 a); +u32 InitCameraUpdateCallback(u8 trackedSpriteId); void CameraUpdate(void); -void SetCameraPanningCallback(void (*a)(void)); -void SetCameraPanning(s16 a, s16 b); +void SetCameraPanningCallback(void (*callback)(void)); +void SetCameraPanning(s16 horizontal, s16 vertical); void InstallCameraPanAheadCallback(void); void UpdateCameraPanning(void); void FieldUpdateBgTilemapScroll(void); diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h index d382de08c..2bf2df269 100644 --- a/include/field_player_avatar.h +++ b/include/field_player_avatar.h @@ -11,29 +11,29 @@ void PlayerGetDestCoords(s16 *, s16 *); u8 GetPlayerFacingDirection(void); u8 GetPlayerMovementDirection(void); u8 PlayerGetCopyableMovement(void); -void PlayerWalkNormal(u8); -void PlayerWalkFast(u8); -void PlayerRideWaterCurrent(u8); -void PlayerWalkFaster(u8); -void PlayerOnBikeCollide(u8); -void PlayerFaceDirection(u8 a); -void PlayerTurnInPlace(u8 a); -void PlayerJumpLedge(u8 a); -void PlayerIdleWheelie(u8 a); -void PlayerStartWheelie(u8 a); -void PlayerEndWheelie(u8 a); -void PlayerStandingHoppingWheelie(u8 a); -void PlayerMovingHoppingWheelie(u8 a); -void PlayerLedgeHoppingWheelie(u8 a); -void PlayerAcroTurnJump(u8 a); -void PlayerSetAnimId(u8 a, u8 b); +void PlayerWalkNormal(u8 direction); +void PlayerWalkFast(u8 direction); +void PlayerRideWaterCurrent(u8 direction); +void PlayerWalkFaster(u8 direction); +void PlayerOnBikeCollide(u8 direction); +void PlayerFaceDirection(u8 direction); +void PlayerTurnInPlace(u8 direction); +void PlayerJumpLedge(u8 direction); +void PlayerIdleWheelie(u8 direction); +void PlayerStartWheelie(u8 direction); +void PlayerEndWheelie(u8 direction); +void PlayerStandingHoppingWheelie(u8 direction); +void PlayerMovingHoppingWheelie(u8 direction); +void PlayerLedgeHoppingWheelie(u8 direction); +void PlayerAcroTurnJump(u8 direction); +void PlayerSetAnimId(u8 movementActionId, u8 copyableMovement); bool8 IsPlayerCollidingWithFarawayIslandMew(u8 direction); void PlayerOnBikeCollideWithFarawayIslandMew(u8 direction); -u8 CheckForObjectEventCollision(struct ObjectEvent *a, s16 b, s16 c, u8 d, u8 e); +u8 CheckForObjectEventCollision(struct ObjectEvent *objectEvent, s16 x, s16 y, u8 direction, u8 metatileBehavior); u8 PlayerGetElevation(void); -void SetPlayerAvatarTransitionFlags(u16 a); +void SetPlayerAvatarTransitionFlags(u16 transitionFlags); void CancelPlayerForcedMovement(void); -void InitPlayerAvatar(s16 a, s16 b, u8 c, u8 d); +void InitPlayerAvatar(s16 x, s16 y, u8 direction, u8 gender); void PlayerFreeze(void); void StopPlayerAvatar(void); void SetSpinStartFacingDir(u8); @@ -41,8 +41,8 @@ void GetXYCoordsOneStepInFrontOfPlayer(s16 *xPtr, s16 *yPtr); u8 GetRivalAvatarGraphicsIdByStateIdAndGender(u8, u8); void SetPlayerAvatarFieldMove(void); u8 GetPlayerAvatarGraphicsIdByCurrentState(void); -void SetPlayerAvatarStateMask(u8 a); -u8 GetPlayerAvatarGraphicsIdByStateId(u8 a); +void SetPlayerAvatarStateMask(u8 flags); +u8 GetPlayerAvatarGraphicsIdByStateId(u8 state); u8 GetJumpSpecialMovementAction(u32); bool8 PartyHasMonWithSurf(void); bool8 IsPlayerFacingSurfableFishableWater(void); diff --git a/include/field_special_scene.h b/include/field_special_scene.h index 3f701f41b..111723c83 100644 --- a/include/field_special_scene.h +++ b/include/field_special_scene.h @@ -1,14 +1,8 @@ #ifndef GUARD_FIELD_SPECIAL_SCENE_H #define GUARD_FIELD_SPECIAL_SCENE_H -s16 GetTruckCameraBobbingY(int a1); -s16 GetTruckBoxMovement(int a1); -void Task_Truck1(u8 taskId); -void Task_Truck2(u8 taskId); -void Task_Truck3(u8 taskId); -void Task_HandleTruckSequence(u8 taskId); void ExecuteTruckSequence(void); -void EndTruckSequence(u8); +void EndTruckSequence(u8 taskId); void FieldCB_ShowPortholeView(void); #endif // GUARD_FIELD_SPECIAL_SCENE_H diff --git a/include/fldeff.h b/include/fldeff.h index 597ce6f47..0ad0e3d60 100644 --- a/include/fldeff.h +++ b/include/fldeff.h @@ -25,8 +25,8 @@ void ChooseMonForSoftboiled(u8 taskId); // flash bool8 SetUpFieldMove_Flash(void); void CB2_DoChangeMap(void); -bool8 GetMapPairFadeToType(u8 a1, u8 a2); -bool8 GetMapPairFadeFromType(u8 a1, u8 a2); +bool8 GetMapPairFadeToType(u8 _fromType, u8 _toType); +bool8 GetMapPairFadeFromType(u8 _fromType, u8 _toType); // strength bool8 SetUpFieldMove_Strength(void); diff --git a/include/fldeff_misc.h b/include/fldeff_misc.h index 4acca7944..61078466d 100644 --- a/include/fldeff_misc.h +++ b/include/fldeff_misc.h @@ -1,8 +1,8 @@ #ifndef GUARD_FLDEFF_MISC_H #define GUARD_FLDEFF_MISC_H -void ComputerScreenOpenEffect(u16 a0, u16 a1, u8 a2); -void ComputerScreenCloseEffect(u16 a0, u16 a1, u8 a2); +void ComputerScreenOpenEffect(u16 increment, u16 unused, u8 priority); +void ComputerScreenCloseEffect(u16 increment, u16 unused, u8 priority); bool8 IsComputerScreenOpenEffectActive(void); bool8 IsComputerScreenCloseEffectActive(void); bool8 SetUpFieldMove_SecretPower(void); @@ -22,7 +22,7 @@ void PlaySecretBaseMusicNoteMatSound(s16 metatileId); void DoSecretBaseGlitterMatSparkle(void); bool8 FldEff_SandPillar(void); void InteractWithShieldOrTVDecoration(void); -bool8 IsLargeBreakableDecoration(u16 arg0, u8 arg1); +bool8 IsLargeBreakableDecoration(u16 metatileId, bool8 checkBase); void FldEffPoison_Start(void); bool32 FldEffPoison_IsActive(void); void DoWateringBerryTreeAnim(void); diff --git a/include/gba/m4a_internal.h b/include/gba/m4a_internal.h index a057c2da6..40a25ba05 100644 --- a/include/gba/m4a_internal.h +++ b/include/gba/m4a_internal.h @@ -423,7 +423,7 @@ void Clear64byte(void *addr); void SoundInit(struct SoundInfo *soundInfo); void MPlayExtender(struct CgbChannel *cgbChans); void m4aSoundMode(u32 mode); -void MPlayOpen(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *track, u8 a3); +void MPlayOpen(struct MusicPlayerInfo *mplayInfo, struct MusicPlayerTrack *tracks, u8 trackCount); void CgbSound(void); void CgbOscOff(u8); void CgbModVol(struct CgbChannel *chan); diff --git a/include/intro_credits_graphics.h b/include/intro_credits_graphics.h index bed30ffe8..c6f4a73c5 100644 --- a/include/intro_credits_graphics.h +++ b/include/intro_credits_graphics.h @@ -33,11 +33,11 @@ extern const struct CompressedSpriteSheet gSpriteSheet_CreditsRivalBrendan[]; extern const struct CompressedSpriteSheet gSpriteSheet_CreditsRivalMay[]; extern const struct SpritePalette gSpritePalettes_Credits[]; -void LoadIntroPart2Graphics(u8 scene); -void SetIntroPart2BgCnt(u8 a); +void LoadIntroPart2Graphics(u8 scenery); +void SetIntroPart2BgCnt(u8 scenery); void LoadCreditsSceneGraphics(u8); void SetCreditsSceneBgCnt(u8); -u8 CreateBicycleBgAnimationTask(u8 a, u16 b, u16 c, u16 d); +u8 CreateBicycleBgAnimationTask(u8 mode, u16 bg1Speed, u16 bg2Speed, u16 bg3Speed); void CycleSceneryPalette(u8); u8 CreateIntroBrendanSprite(s16 x, s16 y); u8 CreateIntroMaySprite(s16 x, s16 y); diff --git a/include/link.h b/include/link.h index 96a76e120..120c25784 100644 --- a/include/link.h +++ b/include/link.h @@ -300,7 +300,7 @@ void LocalLinkPlayerToBlock(void); void LinkPlayerFromBlock(u32 who); bool32 Link_AnyPartnersPlayingFRLG_JP(void); void ResetLinkPlayerCount(void); -void SaveLinkPlayers(u8 a0); +void SaveLinkPlayers(u8 playerCount); void SetWirelessCommType0(void); bool32 IsLinkRecvQueueAtOverworldMax(void); diff --git a/include/list_menu.h b/include/list_menu.h index 1c18f3dff..e70a92bab 100644 --- a/include/list_menu.h +++ b/include/list_menu.h @@ -98,9 +98,9 @@ struct CursorStruct extern struct ScrollArrowsTemplate gTempScrollArrowTemplate; extern struct ListMenuTemplate gMultiuseListMenuTemplate; -s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum); +s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 drawMode, u16 tileNum, u16 palNum); u8 ListMenuInit(struct ListMenuTemplate *listMenuTemplate, u16 scrollOffset, u16 selectedRow); -u8 ListMenuInitInRect(struct ListMenuTemplate *listMenuTemplate, struct ListMenuWindowRect *arg1, u16 scrollOffset, u16 selectedRow); +u8 ListMenuInitInRect(struct ListMenuTemplate *listMenuTemplate, struct ListMenuWindowRect *rect, u16 scrollOffset, u16 selectedRow); s32 ListMenu_ProcessInput(u8 listTaskId); void DestroyListMenuTask(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow); void RedrawListMenu(u8 listTaskId); @@ -111,10 +111,10 @@ void ListMenuGetCurrentItemArrayId(u8 listTaskId, u16 *arrayId); void ListMenuGetScrollAndRow(u8 listTaskId, u16 *scrollOffset, u16 *selectedRow); u16 ListMenuGetYCoordForPrintingArrowCursor(u8 listTaskId); void ListMenuOverrideSetColors(u8 cursorPal, u8 fillValue, u8 cursorShadowPal); -void ListMenuDefaultCursorMoveFunc(s32 arg0, u8 arg1, struct ListMenu *list); +void ListMenuDefaultCursorMoveFunc(s32 itemIndex, u8 onInit, struct ListMenu *list); s32 ListMenuGetUnkIndicatorsStructFields(u8 taskId, u8 field); void ListMenuSetUnkIndicatorsStructField(u8 taskId, u8 field, s32 value); -u8 AddScrollIndicatorArrowPair(const struct ScrollArrowsTemplate *arrowInfo, u16 *arg1); +u8 AddScrollIndicatorArrowPair(const struct ScrollArrowsTemplate *arrowInfo, u16 *scrollOffset); u8 AddScrollIndicatorArrowPairParameterized(u32 arrowType, s32 commonPos, s32 firstPos, s32 secondPos, s32 fullyDownThreshold, s32 tileTag, s32 palTag, u16 *currItemPtr); void RemoveScrollIndicatorArrowPair(u8 taskId); void Task_ScrollIndicatorArrowPairOnMainMenu(u8 taskId); diff --git a/include/main_menu.h b/include/main_menu.h index 1944f4ecc..5f92719d5 100644 --- a/include/main_menu.h +++ b/include/main_menu.h @@ -2,6 +2,6 @@ #define GUARD_MAIN_MENU_H void CB2_InitMainMenu(void); -void CreateYesNoMenuParameterized(u8 a, u8 b, u16 c, u16 d, u8 e, u8 f); +void CreateYesNoMenuParameterized(u8 x, u8 y, u16 baseTileNum, u16 baseBlock, u8 yesNoPalNum, u8 winPalNum); #endif // GUARD_MAIN_MENU_H diff --git a/include/mauville_old_man.h b/include/mauville_old_man.h index b22294f1b..9e5986ee8 100644 --- a/include/mauville_old_man.h +++ b/include/mauville_old_man.h @@ -7,8 +7,8 @@ void SetMauvilleOldMan(void); u8 GetCurrentMauvilleOldMan(void); void SetMauvilleOldManObjEventGfx(void); void SanitizeMauvilleOldManForRuby(OldMan *dest); -void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 r1, u32 r6); -void SanitizeReceivedEmeraldOldMan(union OldMan * oldMan, u32 unused, u32 a2); +void SanitizeReceivedRubyOldMan(union OldMan * oldMan, u32 version, u32 language); +void SanitizeReceivedEmeraldOldMan(union OldMan * oldMan, u32 version, u32 language); void ResetMauvilleOldManFlag(void); #endif // GUARD_MAUVILLE_OLD_MAN_H diff --git a/include/menu.h b/include/menu.h index bf3f56aea..c38e87cbd 100644 --- a/include/menu.h +++ b/include/menu.h @@ -56,9 +56,9 @@ void SetStandardWindowBorderStyle(u8 windowId, bool8 copyToVram); void DisplayYesNoMenuDefaultYes(void); u32 GetPlayerTextSpeed(void); u8 GetPlayerTextSpeedDelay(void); -void Menu_LoadStdPalAt(u16 arg0); -void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextPrinterTemplate *, u16)); -void BgDmaFill(u32 bg, u8 a1, int a2, int a3); +void Menu_LoadStdPalAt(u16 offset); +void AddTextPrinterWithCallbackForMessage(bool8 canSpeedUp, void (*callback)(struct TextPrinterTemplate *, u16)); +void BgDmaFill(u32 bg, u8 value, int offset, int size); void AddTextPrinterParameterized3(u8 windowId, u8 fontId, u8 left, u8 top, const u8 *color, s8 speed, const u8 *str); void ClearStdWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram); void SetWindowTemplateFields(struct WindowTemplate* template, u8 priority, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 palNum, u16 baseBlock); @@ -69,7 +69,7 @@ u8 InitMenuInUpperLeftCornerNormal(u8 windowId, u8 numItems, u8 initialCursorPos u8 Menu_GetCursorPos(void); s8 Menu_ProcessInput(void); s8 Menu_ProcessInputNoWrap(void); -void BlitMenuInfoIcon(u8 winId, u8 a2, u16 x, u16 y); +void BlitMenuInfoIcon(u8 windowId, u8 iconId, u16 x, u16 y); void ResetTempTileDataBuffers(void); void *DecompressAndCopyTileDataToVram(u8 bgId, const void *src, u32 size, u16 offset, u8 mode); bool8 FreeTempTileDataBuffersIfPossible(void); @@ -81,14 +81,14 @@ s8 ProcessMenuInput_other(void); void DoScheduledBgTilemapCopiesToVram(void); void ClearScheduledBgCopiesToVram(void); void AddTextPrinterParameterized4(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterSpacing, u8 lineSpacing, const u8 *color, s8 speed, const u8 *str); -void DrawDialogFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 a2, u8 a3); +void DrawDialogFrameWithCustomTileAndPalette(u8 windowId, bool8 copyToVram, u16 tileNum, u8 paletteNum); void PrintMenuActionTextsInUpperLeftCorner(u8 windowId, u8 optionsNo, const struct MenuAction *actions, const u8 *actionIds); void ClearDialogWindowAndFrameToTransparent(u8 windowId, bool8 copyToVram); void *malloc_and_decompress(const void *src, u32 *sizeOut); u16 copy_decompressed_tile_data_to_vram(u8 bgId, const void *src, u16 size, u16 offset, u8 mode); void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress); -void PrintMenuActionTexts(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *a8); -void PrintMenuActionGrid(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 itemCount, u8 itemCount2, const struct MenuAction *strs, const u8 *a8); +void PrintMenuActionTexts(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *menuActions, const u8 *actionIds); +void PrintMenuActionGrid(u8 windowId, u8 fontId, u8 left, u8 top, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *menuActions, const u8 *actionIds); u8 InitMenuActionGrid(u8 windowId, u8 optionWidth, u8 columns, u8 rows, u8 initialCursorPos); u8 ChangeMenuGridCursorPosition(s8 deltaX, s8 deltaY); u8 GetStartMenuWindowId(void); diff --git a/include/menu_helpers.h b/include/menu_helpers.h index 0e063e5c1..f9a418a93 100644 --- a/include/menu_helpers.h +++ b/include/menu_helpers.h @@ -18,11 +18,11 @@ struct YesNoFuncTable void ResetVramOamAndBgCntRegs(void); void ResetAllBgsCoordinates(void); void SetVBlankHBlankCallbacksToNull(void); -void DisplayMessageAndContinueTask(u8 taskId, u8 windowId, u16 arg2, u8 arg3, u8 fontId, u8 textSpeed, const u8 *string, void *taskFunc); +void DisplayMessageAndContinueTask(u8 taskId, u8 windowId, u16 tileNum, u8 paletteNum, u8 fontId, u8 textSpeed, const u8 *string, void *taskFunc); bool16 RunTextPrintersRetIsActive(u8 textPrinterId); void DoYesNoFuncWithChoice(u8 taskId, const struct YesNoFuncTable *data); -void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 arg2, u8 arg3, u8 arg4, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo); -bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1); +void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 unused1, u8 unused2, u8 unused3, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo); +bool8 AdjustQuantityAccordingToDPadInput(s16 *quantity, u16 max); u8 GetLRKeysPressed(void); u8 GetLRKeysPressedAndHeld(void); bool8 IsHoldingItemAllowed(u16 itemId); diff --git a/include/menu_specialized.h b/include/menu_specialized.h index d1e30d4d6..10a211046 100644 --- a/include/menu_specialized.h +++ b/include/menu_specialized.h @@ -95,7 +95,7 @@ void ConditionGraph_Draw(struct ConditionGraph *graph); bool8 ConditionGraph_TryUpdate(struct ConditionGraph *graph); void ConditionGraph_Update(struct ConditionGraph *graph); void ConditionGraph_CalcPositions(u8 *conditions, struct UCoords16 *positions); -void ConditionGraph_SetNewPositions(struct ConditionGraph *graph, struct UCoords16 *arg1, struct UCoords16 *arg2); +void ConditionGraph_SetNewPositions(struct ConditionGraph *graph, struct UCoords16 *old, struct UCoords16 *new); // Condition menu bool8 ConditionMenu_UpdateMonEnter(struct ConditionGraph *graph, s16 *x); diff --git a/include/overworld.h b/include/overworld.h index b8794ea70..adaa6aad0 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -77,7 +77,7 @@ void SetWarpDestinationToMapWarp(s8 mapGroup, s8 mapNum, s8 warpId); void SetDynamicWarp(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId); void SetDynamicWarpWithCoords(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); void SetWarpDestinationToDynamicWarp(u8 unused); -void SetWarpDestinationToHealLocation(u8 a1); +void SetWarpDestinationToHealLocation(u8 healLocationId); void SetWarpDestinationToLastHealLocation(void); void SetLastHealLocationWarp(u8 healLocationId); void UpdateEscapeWarp(s16 x, s16 y); @@ -86,7 +86,7 @@ void SetWarpDestinationToEscapeWarp(void); void SetFixedDiveWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); void SetFixedHoleWarp(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y); void SetWarpDestinationToFixedHoleWarp(s16 x, s16 y); -void SetContinueGameWarpToHealLocation(u8 a1); +void SetContinueGameWarpToHealLocation(u8 healLocationId); void SetContinueGameWarpToDynamicWarp(int unused); const struct MapConnection *GetMapConnection(u8 dir); bool8 SetDiveWarpEmerge(u16 x, u16 y); @@ -130,7 +130,7 @@ void CB1_Overworld(void); void CB2_OverworldBasic(void); void CB2_Overworld(void); void SetMainCallback1(void (*cb)(void)); -void SetUnusedCallback(void *a0); +void SetUnusedCallback(void *func); void CB2_NewGame(void); void CB2_WhiteOut(void); void CB2_LoadMap(void); diff --git a/include/pokeball.h b/include/pokeball.h index 297788db1..1149791b8 100644 --- a/include/pokeball.h +++ b/include/pokeball.h @@ -34,8 +34,8 @@ extern const struct SpriteTemplate gBallSpriteTemplates[]; #define POKEBALL_OPPONENT_SENDOUT 0xFE u8 DoPokeballSendOutAnimation(s16 pan, u8 kindOfThrow); -void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 battler, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 g, u32 h, u16 species); -u8 CreateTradePokeballSprite(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 g, u32 h); +void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 monPalNum, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 delay, u32 fadePalettes, u16 species); +u8 CreateTradePokeballSprite(u8 monSpriteId, u8 monPalNum, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 delay, u32 fadePalettes); void StartHealthboxSlideIn(u8 battler); void DoHitAnimHealthboxEffect(u8 battler); void LoadBallGfx(u8 ballId); diff --git a/include/pokemon.h b/include/pokemon.h index 94a31bbe7..d173387fb 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -337,7 +337,7 @@ u8 GetBoxMonGender(struct BoxPokemon *boxMon); u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality); void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition); void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosition); -void SetMultiuseSpriteTemplateToTrainerFront(u16 arg0, u8 battlerPosition); +void SetMultiuseSpriteTemplateToTrainerFront(u16 trainerPicId, u8 battlerPosition); // These are full type signatures for GetMonData() and GetBoxMonData(), // but they are not used since some code erroneously omits the third arg. @@ -381,11 +381,11 @@ u16 SpeciesToNationalPokedexNum(u16 species); u16 SpeciesToHoennPokedexNum(u16 species); u16 HoennToNationalOrder(u16 hoennNum); u16 SpeciesToCryId(u16 species); -void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, u8 a4); +void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, bool8 isFrontPic); void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies); u8 GetPlayerFlankId(void); u16 GetLinkTrainerFlankId(u8 id); -s32 GetBattlerMultiplayerId(u16 a1); +s32 GetBattlerMultiplayerId(u16 id); u8 GetTrainerEncounterMusicId(u16 trainerOpponentId); u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex); void AdjustFriendship(struct Pokemon *mon, u8 event); @@ -426,8 +426,8 @@ void SetWildMonHeldItem(void); bool8 IsMonShiny(struct Pokemon *mon); bool8 IsShinyOtIdPersonality(u32 otId, u32 personality); const u8 *GetTrainerPartnerName(void); -void BattleAnimateFrontSprite(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3); -void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3); +void BattleAnimateFrontSprite(struct Sprite* sprite, u16 species, bool8 noCry, u8 panMode); +void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 panModeAnimFlag); void PokemonSummaryDoMonAnimation(struct Sprite* sprite, u16 species, bool8 oneFrame); void StopPokemonAnimationDelayTask(void); void BattleAnimateBackSprite(struct Sprite* sprite, u16 species); diff --git a/include/pokemon_storage_system.h b/include/pokemon_storage_system.h index b7fca2331..eb25c0ff2 100644 --- a/include/pokemon_storage_system.h +++ b/include/pokemon_storage_system.h @@ -26,7 +26,7 @@ struct PokemonStorage extern struct PokemonStorage *gPokemonStoragePtr; -void DrawTextWindowAndBufferTiles(const u8 *string, void *dst, u8 arg2, u8 arg3, s32 bytesToBuffer); +void DrawTextWindowAndBufferTiles(const u8 *string, void *dst, u8 zero1, u8 zero2, s32 bytesToBuffer); u8 CountMonsInBox(u8 boxId); s16 GetFirstFreeBoxSpot(u8 boxId); u8 CountPartyAliveNonEggMonsExcept(u8 slotToIgnore); @@ -52,7 +52,7 @@ void ZeroBoxMonAt(u8 boxId, u8 boxPosition); void BoxMonAtToMon(u8 boxId, u8 boxPosition, struct Pokemon *dst); struct BoxPokemon *GetBoxedMonPtr(u8 boxId, u8 boxPosition); u8 *GetBoxNamePtr(u8 boxId); -s16 AdvanceStorageMonIndex(struct BoxPokemon *boxMons, u8 currIndex, u8 maxIndex, u8 arg3); +s16 AdvanceStorageMonIndex(struct BoxPokemon *boxMons, u8 currIndex, u8 maxIndex, u8 mode); bool8 CheckFreePokemonStorageSpace(void); bool32 CheckBoxMonSanityAt(u32 boxId, u32 boxPosition); u32 CountStorageNonEggMons(void); diff --git a/include/pokenav.h b/include/pokenav.h index d3edb1422..593c68489 100644 --- a/include/pokenav.h +++ b/include/pokenav.h @@ -356,10 +356,10 @@ void MatchCall_GetNameAndDesc(u32 idx, const u8 **desc, const u8 **name); // pokenav_main_menu.c bool32 InitPokenavMainMenu(void); void CopyPaletteIntoBufferUnfaded(const u16 *palette, u32 bufferOffset, u32 size); -void RunMainMenuLoopedTask(u32 a0); +void RunMainMenuLoopedTask(u32 state); u32 IsActiveMenuLoopTaskActive(void); -void LoadLeftHeaderGfxForIndex(u32 arg0); -void ShowLeftHeaderGfx(u32 menugfxId, bool32 arg1, bool32 isOnRightSide); +void LoadLeftHeaderGfxForIndex(u32 menuGfxId); +void ShowLeftHeaderGfx(u32 menugfxId, bool32 isMain, bool32 isOnRightSide); void PokenavFadeScreen(s32 fadeType); bool32 AreLeftHeaderSpritesMoving(void); void InitBgTemplates(const struct BgTemplate *templates, int count); @@ -373,7 +373,7 @@ void PokenavCopyPalette(const u16 *a0, const u16 *a1, int a2, int a3, int a4, u1 void FadeToBlackExceptPrimary(void); struct Sprite *GetSpinningPokenavSprite(void); void HideSpinningPokenavSprite(void); -void UpdateRegionMapRightHeaderTiles(u32 arg0); +void UpdateRegionMapRightHeaderTiles(u32 menuGfxId); void HideMainOrSubMenuLeftHeader(u32 id, bool32 onRightSide); void SlideMenuHeaderUp(void); void PokenavFillPalette(u32 palIndex, u16 fillValue); @@ -412,13 +412,13 @@ int GetNumberRegistered(void); struct PokenavMatchCallEntry *GetMatchCallList(void); u16 GetMatchCallMapSec(int); bool32 ShouldDrawRematchPokeballIcon(int index); -void ClearRematchPokeballIcon(u16 windowId, u32 a1); +void ClearRematchPokeballIcon(u16 windowId, u32 tileOffset); int GetMatchCallTrainerPic(int index); const u8 *GetMatchCallFlavorText(int index, int textType); const u8 *GetMatchCallMessageText(int index, bool8 *newRematchRequest); u16 GetMatchCallOptionCursorPos(void); -u16 GetMatchCallOptionId(int arg0); -void BufferMatchCallNameAndDesc(struct PokenavMatchCallEntry * arg0, u8 *str); +u16 GetMatchCallOptionId(int optionId); +void BufferMatchCallNameAndDesc(struct PokenavMatchCallEntry *matchCallEntry, u8 *str); u8 GetMatchTableMapSectionId(int rematchIndex); int GetIndexDeltaOfNextCheckPageDown(int index); int GetIndexDeltaOfNextCheckPageUp(int index); diff --git a/include/scanline_effect.h b/include/scanline_effect.h index 5bd8b5546..ae534d969 100644 --- a/include/scanline_effect.h +++ b/include/scanline_effect.h @@ -43,6 +43,6 @@ void ScanlineEffect_Stop(void); void ScanlineEffect_Clear(void); void ScanlineEffect_SetParams(struct ScanlineEffectParams); void ScanlineEffect_InitHBlankDmaTransfer(void); -u8 ScanlineEffect_InitWave(u8 startLine, u8 endLine, u8 frequency, u8 amplitude, u8 delayInterval, u8 regOffset, bool8 a7); +u8 ScanlineEffect_InitWave(u8 startLine, u8 endLine, u8 frequency, u8 amplitude, u8 delayInterval, u8 regOffset, bool8 applyBattleBgOffsets); #endif // GUARD_SCANLINE_EFFECT_H diff --git a/include/trade.h b/include/trade.h index a0cb320a8..27b5ee8bd 100644 --- a/include/trade.h +++ b/include/trade.h @@ -12,8 +12,8 @@ extern const struct WindowTemplate gTradeEvolutionSceneYesNoWindowTemplate; s32 GetGameProgressForLinkTrade(void); void CB2_StartCreateTradeMenu(void); void CB2_LinkTrade(void); -int CanRegisterMonForTradingBoard(struct RfuGameCompatibilityData a0, u16, u16, u8); -int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData a0, struct RfuGameCompatibilityData a1, u16 a2, u16 a3, u8 a4, u16 a5, u8 a6); +int CanRegisterMonForTradingBoard(struct RfuGameCompatibilityData player, u16 species2, u16 species, bool8 isEventLegal); +int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct RfuGameCompatibilityData partner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, bool8 isEventLegal); int CanSpinTradeMon(struct Pokemon*, u16); void InitTradeSequenceBgGpuRegs(void); void LinkTradeDrawWindow(void); diff --git a/include/trainer_card.h b/include/trainer_card.h index f5e73da83..f14335ae8 100644 --- a/include/trainer_card.h +++ b/include/trainer_card.h @@ -69,7 +69,7 @@ u32 CountPlayerTrainerStars(void); u8 GetTrainerCardStars(u8 cardId); void CopyTrainerCardData(struct TrainerCard *dst, struct TrainerCard *src, u8 gameVersion); void ShowPlayerTrainerCard(void (*callback)(void)); -void ShowTrainerCardInLink(u8 arg0, void (*callback)(void)); +void ShowTrainerCardInLink(u8 cardId, void (*callback)(void)); void TrainerCard_GenerateCardForLinkPlayer(struct TrainerCard *); #endif // GUARD_TRAINER_CARD_H diff --git a/src/bard_music.c b/src/bard_music.c index bdc5ac808..dd986371d 100644 --- a/src/bard_music.c +++ b/src/bard_music.c @@ -7,9 +7,9 @@ #include "data/bard_music/default_sound.h" #include "data/bard_music/length_table.h" -static s16 CalcWordPitch(int arg0, int songPos) +static s16 CalcWordPitch(int pitchIdx, int songPos) { - return sBardSoundPitchTables[arg0][songPos]; + return sBardSoundPitchTables[pitchIdx][songPos]; } const struct BardSound *GetWordSounds(u16 word) diff --git a/src/battle_anim_effects_1.c b/src/battle_anim_effects_1.c index d460b9236..c590572b9 100644 --- a/src/battle_anim_effects_1.c +++ b/src/battle_anim_effects_1.c @@ -128,7 +128,7 @@ static void AnimHornHit_Step(struct Sprite *); static void AnimSuperFang(struct Sprite *); static void AnimWavyMusicNotes(struct Sprite *); static void AnimWavyMusicNotes_Step(struct Sprite *); -static void AnimWavyMusicNotesGetNextPos(s16, s16, s16 *, s16 *, s8); +static void AnimWavyMusicNotes_CalcVelocity(s16, s16, s16 *, s16 *, s8); static void AnimFlyingMusicNotes(struct Sprite *); static void AnimFlyingMusicNotes_Step(struct Sprite *); static void AnimBellyDrumHand(struct Sprite *); @@ -4343,7 +4343,7 @@ static void AnimLockOnTarget_Step4(struct Sprite* sprite) sprite->data[1] = 0; } - BlendPalettes(GetBattleBgPalettesMask(1, 1, 1, 1, 1, 0, 0), sprite->data[1], RGB(31, 31, 31)); + BlendPalettes(GetBattlePalettesMask(TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE), sprite->data[1], RGB(31, 31, 31)); if (sprite->data[1] == 16) { int pal; @@ -4998,7 +4998,7 @@ static void AnimMoonlightSparkle_Step(struct Sprite* sprite) void AnimTask_MoonlightEndFade(u8 taskId) { - int a = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0) & 0xFFFF; + int a = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) & 0xFFFF; int b; int c; int d; @@ -5279,79 +5279,87 @@ void AnimTask_MusicNotesClearRainbowBlend(u8 taskId) DestroyAnimVisualTask(taskId); } +#define sMoveTimer data[0] +#define sBlendTableIdx data[1] +#define sBlendTimer data[2] +#define sBlendCycleTime data[3] +#define sX data[4] +#define sY data[5] +#define sVelocX data[6] +#define sVelocY data[7] + static void AnimWavyMusicNotes(struct Sprite* sprite) { u8 index; - u8 a; - u8 b; + u8 x, y; SetSpriteCoordsToAnimAttackerCoords(sprite); StartSpriteAnim(sprite, gBattleAnimArgs[0]); if ((index = IndexOfSpritePaletteTag(gParticlesColorBlendTable[gBattleAnimArgs[1]][0])) != 0xFF) sprite->oam.paletteNum = index; - sprite->data[1] = gBattleAnimArgs[1]; - sprite->data[2] = 0; - sprite->data[3] = gBattleAnimArgs[2]; + sprite->sBlendTableIdx = gBattleAnimArgs[1]; + sprite->sBlendTimer = 0; + sprite->sBlendCycleTime = gBattleAnimArgs[2]; if (IsContest()) { - a = 48; - b = 40; + x = 48; + y = 40; } else { - a = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); - b = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); + x = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); + y = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); } - sprite->data[4] = sprite->x << 4; - sprite->data[5] = sprite->y << 4; - AnimWavyMusicNotesGetNextPos(a - sprite->x, b - sprite->y, &sprite->data[6], &sprite->data[7], 40); + sprite->sX = sprite->x << 4; + sprite->sY = sprite->y << 4; + AnimWavyMusicNotes_CalcVelocity(x - sprite->x, y - sprite->y, &sprite->sVelocX, &sprite->sVelocY, 40); sprite->callback = AnimWavyMusicNotes_Step; } -static void AnimWavyMusicNotesGetNextPos(s16 a, s16 b, s16* c, s16* d, s8 e) +static void AnimWavyMusicNotes_CalcVelocity(s16 x, s16 y, s16* velocX, s16* velocY, s8 xSpeedFactor) { - int f; - int g; - if (a < 0) - e = -e; + int x2; + int time; + if (x < 0) + xSpeedFactor = -xSpeedFactor; - f = a << 8; - g = f / e; - if (g == 0) - g = 1; + x2 = x * 256; + time = x2 / xSpeedFactor; + if (time == 0) + time = 1; - *c = f / g; - *d = (b << 8) / g; + *velocX = x2 / time; + *velocY = (y * 256) / time; } static void AnimWavyMusicNotes_Step(struct Sprite* sprite) { - s16 y, yDelta; + s16 y, trigIdx; u8 index; - sprite->data[0]++; - yDelta = sprite->data[0] * 5 - ((sprite->data[0] * 5 / 256) << 8); - sprite->data[4] += sprite->data[6]; - sprite->data[5] += sprite->data[7]; - sprite->x = sprite->data[4] >> 4; - sprite->y = sprite->data[5] >> 4; - sprite->y2 = Sin(yDelta, 15); + sprite->sMoveTimer++; + trigIdx = sprite->sMoveTimer * 5 - ((sprite->sMoveTimer * 5 / 256) << 8); + sprite->sX += sprite->sVelocX; + sprite->sY += sprite->sVelocY; + sprite->x = sprite->sX >> 4; + sprite->y = sprite->sY >> 4; + sprite->y2 = Sin(trigIdx, 15); y = sprite->y; - if (sprite->x < -16 || sprite->x > 256 || y < -16 || y > 128) + if (sprite->x < -16 || sprite->x > DISPLAY_WIDTH + 16 || y < -16 || y > DISPLAY_HEIGHT - 32) { DestroySpriteAndMatrix(sprite); } else { - if (sprite->data[3] && ++sprite->data[2] > sprite->data[3]) + if (sprite->sBlendCycleTime && ++sprite->sBlendTimer > sprite->sBlendCycleTime) { - sprite->data[2] = 0; - if (++sprite->data[1] > 3) - sprite->data[1] = 0; + sprite->sBlendTimer = 0; + if (++sprite->sBlendTableIdx > (int)ARRAY_COUNT(gParticlesColorBlendTable) - 1) + sprite->sBlendTableIdx = 0; - index = IndexOfSpritePaletteTag(gParticlesColorBlendTable[sprite->data[1]][0]); + index = IndexOfSpritePaletteTag(gParticlesColorBlendTable[sprite->sBlendTableIdx][0]); if (index != 0xFF) sprite->oam.paletteNum = index; } @@ -5467,7 +5475,7 @@ void SetSpriteNextToMonHead(u8 battler, struct Sprite* sprite) static void AnimThoughtBubble(struct Sprite* sprite) { - u8 a; + u8 animNum; u8 battler; if (gBattleAnimArgs[0] == 0) battler = gBattleAnimAttacker; @@ -5475,10 +5483,10 @@ static void AnimThoughtBubble(struct Sprite* sprite) battler = gBattleAnimTarget; SetSpriteNextToMonHead(battler, sprite); - a = (GetBattlerSide(battler) == B_SIDE_PLAYER) ? 0 : 1; + animNum = (GetBattlerSide(battler) == B_SIDE_PLAYER) ? 0 : 1; sprite->data[0] = gBattleAnimArgs[1]; - sprite->data[1] = a + 2; - StartSpriteAnim(sprite, a); + sprite->data[1] = animNum + 2; + StartSpriteAnim(sprite, animNum); StoreSpriteCallbackInData6(sprite, AnimThoughtBubble_Step); sprite->callback = RunStoredCallbackWhenAnimEnds; } diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index 101b255df..9764d5522 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -3116,7 +3116,7 @@ static void AnimTask_FakeOut_Step2(u8 taskId) { gTasks[taskId].data[11] = 0x88; SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG3 | BLDCNT_EFFECT_LIGHTEN); - BlendPalettes(GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0), 16, RGB(31, 31, 31)); + BlendPalettes(GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE), 16, RGB(31, 31, 31)); } else if (gTasks[taskId].data[10] > 4) { diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index f73393de4..3b4f6729f 100755 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -1213,7 +1213,7 @@ void AnimTask_SmokescreenImpact(u8 taskId) SmokescreenImpact( GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + 8, GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + 8, - 0); + FALSE); DestroyAnimVisualTask(taskId); } @@ -3717,6 +3717,26 @@ void AnimTask_SlideMonForFocusBand(u8 taskId) gTasks[taskId].func = AnimTask_SlideMonForFocusBand_Step1; } +#define IDX_ACTIVE_SPRITES 2 // Used by the sprite callback to modify the number of active sprites + +// Task data for AnimTask_SquishAndSweatDroplets +#define tState data[0] +#define tTimer data[1] +#define tActiveSprites data[IDX_ACTIVE_SPRITES] +#define tNumSquishes data[3] +#define tBaseX data[4] +#define tBaseY data[5] +#define tSubpriority data[6] +// data[7]-data[15] used by PrepareAffineAnimInTaskData +#define tBattlerSpriteId data[15] + +// Sprite data for AnimFacadeSweatDrop +#define sTimer data[0] +#define sVelocX data[1] +#define sVelocY data[2] +#define sTaskId data[3] +#define sActiveSpritesIdx data[4] + // Squishes the mon vertically and emits sweat droplets a few times. // arg 0: battler // arg 1: num squishes @@ -3728,20 +3748,20 @@ void AnimTask_SquishAndSweatDroplets(u8 taskId) if (!gBattleAnimArgs[1]) DestroyAnimVisualTask(taskId); - task->data[0] = 0; - task->data[1] = 0; - task->data[2] = 0; - task->data[3] = gBattleAnimArgs[1]; + task->tState = 0; + task->tTimer = 0; + task->tActiveSprites = 0; + task->tNumSquishes = gBattleAnimArgs[1]; if (gBattleAnimArgs[0] == ANIM_ATTACKER) battler = gBattleAnimAttacker; else battler = gBattleAnimTarget; - task->data[4] = GetBattlerSpriteCoord(battler, BATTLER_COORD_X); - task->data[5] = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y); - task->data[6] = GetBattlerSpriteSubpriority(battler); - task->data[15] = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); - PrepareAffineAnimInTaskData(task, task->data[15], gFacadeSquishAffineAnimCmds); + task->tBaseX = GetBattlerSpriteCoord(battler, BATTLER_COORD_X); + task->tBaseY = GetBattlerSpriteCoord(battler, BATTLER_COORD_Y); + task->tSubpriority = GetBattlerSpriteSubpriority(battler); + task->tBattlerSpriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]); + PrepareAffineAnimInTaskData(task, task->tBattlerSpriteId, gFacadeSquishAffineAnimCmds); task->func = AnimTask_SquishAndSweatDroplets_Step; } @@ -3749,37 +3769,40 @@ static void AnimTask_SquishAndSweatDroplets_Step(u8 taskId) { struct Task *task = &gTasks[taskId]; - switch (task->data[0]) + switch (task->tState) { case 0: - task->data[1]++; - if (task->data[1] == 6) + task->tTimer++; + if (task->tTimer == 6) CreateSweatDroplets(taskId, TRUE); - if (task->data[1] == 18) + if (task->tTimer == 18) CreateSweatDroplets(taskId, FALSE); if (!RunAffineAnimFromTaskData(task)) { - if (--task->data[3] == 0) + if (--task->tNumSquishes == 0) { - task->data[0]++; + // Animation is finished + task->tState++; } else { - task->data[1] = 0; - PrepareAffineAnimInTaskData(task, task->data[15], gFacadeSquishAffineAnimCmds); + // Animation continues, more droplet sprites to create + task->tTimer = 0; + PrepareAffineAnimInTaskData(task, task->tBattlerSpriteId, gFacadeSquishAffineAnimCmds); } } break; case 1: - if (task->data[2] == 0) + // Wait for sprites to be destroyed before ending task + if (task->tActiveSprites == 0) DestroyAnimVisualTask(taskId); break; } } -static void CreateSweatDroplets(u8 taskId, bool8 arg1) +static void CreateSweatDroplets(u8 taskId, bool8 lowerDroplets) { u8 i; s8 xOffset, yOffset; @@ -3788,7 +3811,7 @@ static void CreateSweatDroplets(u8 taskId, bool8 arg1) s16 yCoords[2]; task = &gTasks[taskId]; - if (!arg1) + if (!lowerDroplets) { xOffset = 18; yOffset = -20; @@ -3799,39 +3822,54 @@ static void CreateSweatDroplets(u8 taskId, bool8 arg1) yOffset = 20; } - xCoords[0] = task->data[4] - xOffset; - xCoords[1] = task->data[4] - xOffset - 4; - xCoords[2] = task->data[4] + xOffset; - xCoords[3] = task->data[4] + xOffset + 4; - yCoords[0] = task->data[5] + yOffset; - yCoords[1] = task->data[5] + yOffset + 6; + xCoords[0] = task->tBaseX - xOffset; + xCoords[1] = task->tBaseX - xOffset - 4; + xCoords[2] = task->tBaseX + xOffset; + xCoords[3] = task->tBaseX + xOffset + 4; + yCoords[0] = task->tBaseY + yOffset; + yCoords[1] = task->tBaseY + yOffset + 6; for (i = 0; i < 4; i++) { - u8 spriteId = CreateSprite(&gFacadeSweatDropSpriteTemplate, xCoords[i], yCoords[i & 1], task->data[6] - 5); + u8 spriteId = CreateSprite(&gFacadeSweatDropSpriteTemplate, xCoords[i], yCoords[i & 1], task->tSubpriority - 5); if (spriteId != MAX_SPRITES) { - gSprites[spriteId].data[0] = 0; - gSprites[spriteId].data[1] = i < 2 ? -2 : 2; - gSprites[spriteId].data[2] = -1; - gSprites[spriteId].data[3] = taskId; - gSprites[spriteId].data[4] = 2; - task->data[2]++; + gSprites[spriteId].sTimer = 0; + gSprites[spriteId].sVelocX = i < 2 ? -2 : 2; // First two travel left, remaining travel right + gSprites[spriteId].sVelocY = -1; + gSprites[spriteId].sTaskId = taskId; + gSprites[spriteId].sActiveSpritesIdx = IDX_ACTIVE_SPRITES; + task->tActiveSprites++; } } } static void AnimFacadeSweatDrop(struct Sprite *sprite) { - sprite->x += sprite->data[1]; - sprite->y += sprite->data[2]; - if (++sprite->data[0] > 6) + sprite->x += sprite->sVelocX; + sprite->y += sprite->sVelocY; + if (++sprite->sTimer > 6) { - gTasks[sprite->data[3]].data[sprite->data[4]]--; + gTasks[sprite->sTaskId].data[sprite->sActiveSpritesIdx]--; DestroySprite(sprite); } } +#undef IDX_ACTIVE_SPRITES +#undef tState +#undef tTimer +#undef tActiveSprites +#undef tNumSquishes +#undef tBaseX +#undef tBaseY +#undef tSubpriority +#undef tBattlerSpriteId +#undef sTimer +#undef sVelocX +#undef sVelocY +#undef sTaskId +#undef sActiveSpritesIdx + // Blends the mon sprite's color with a rotating set of colors. // arg 0: battler // arg 1: duration @@ -3927,6 +3965,26 @@ static void AnimRoarNoiseLine_Step(struct Sprite *sprite) DestroyAnimSprite(sprite); } +#define IDX_ACTIVE_SPRITES 10 // Used by the sprite callback to modify the number of active sprites + +// Task data for AnimTask_GlareEyeDots +#define tState data[0] +#define tTimer data[1] +#define tPairNum data[2] +#define tPairMax data[5] +#define tDotOffset data[6] +#define tIsContest data[7] +#define tActiveSprites data[IDX_ACTIVE_SPRITES] +#define tStartX data[11] +#define tStartY data[12] +#define tEndX data[13] +#define tEndY data[14] + +// Sprite data for AnimGlareEyeDot +#define sTimer data[0] +#define sTaskId data[1] +#define sActiveSpritesIdx data[2] + // Makes a series of dots in a trail from the attacker to the target. // arg 0: unused void AnimTask_GlareEyeDots(u8 taskId) @@ -3935,25 +3993,25 @@ void AnimTask_GlareEyeDots(u8 taskId) if (IsContest()) { - task->data[5] = 8; - task->data[6] = 3; - task->data[7] = 1; + task->tPairMax = 8; + task->tDotOffset = 3; + task->tIsContest = TRUE; } else { - task->data[5] = 12; - task->data[6] = 3; - task->data[7] = 0; + task->tPairMax = 12; + task->tDotOffset = 3; + task->tIsContest = FALSE; } if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) - task->data[11] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4; + task->tStartX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) + GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4; else - task->data[11] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) - GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4; + task->tStartX = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2) - GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4; - task->data[12] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) - GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4; - task->data[13] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); - task->data[14] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); + task->tStartY = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET) - GetBattlerSpriteCoordAttr(gBattleAnimAttacker, BATTLER_COORD_ATTR_HEIGHT) / 4; + task->tEndX = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2); + task->tEndY = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET); task->func = AnimTask_GlareEyeDots_Step; } @@ -3963,103 +4021,122 @@ static void AnimTask_GlareEyeDots_Step(u8 taskId) s16 x, y; struct Task *task = &gTasks[taskId]; - switch (task->data[0]) + switch (task->tState) { case 0: - if (++task->data[1] > 3) + // Wait to create next pair of dots + if (++task->tTimer > 3) { - task->data[1] = 0; + task->tTimer = 0; GetGlareEyeDotCoords( - task->data[11], - task->data[12], - task->data[13], - task->data[14], - task->data[5], - task->data[2], + task->tStartX, + task->tStartY, + task->tEndX, + task->tEndY, + task->tPairMax, + task->tPairNum, &x, &y); + // Create dot pair for (i = 0; i < 2; i++) { u8 spriteId = CreateSprite(&gGlareEyeDotSpriteTemplate, x, y, 35); if (spriteId != MAX_SPRITES) { - if (task->data[7] == 0) + if (!task->tIsContest) { if (i == 0) - gSprites[spriteId].x2 = gSprites[spriteId].y2 = -task->data[6]; + gSprites[spriteId].x2 = gSprites[spriteId].y2 = -task->tDotOffset; else - gSprites[spriteId].x2 = gSprites[spriteId].y2 = task->data[6]; + gSprites[spriteId].x2 = gSprites[spriteId].y2 = task->tDotOffset; } else { if (i == 0) { - gSprites[spriteId].x2 = -task->data[6]; - gSprites[spriteId].y2 = task->data[6]; + gSprites[spriteId].x2 = -task->tDotOffset; + gSprites[spriteId].y2 = task->tDotOffset; } else { - gSprites[spriteId].x2 = task->data[6]; - gSprites[spriteId].y2 = -task->data[6]; + gSprites[spriteId].x2 = task->tDotOffset; + gSprites[spriteId].y2 = -task->tDotOffset; } } - gSprites[spriteId].data[0] = 0; - gSprites[spriteId].data[1] = taskId; - gSprites[spriteId].data[2] = 10; - task->data[10]++; + gSprites[spriteId].sTimer = 0; + gSprites[spriteId].sTaskId = taskId; + gSprites[spriteId].sActiveSpritesIdx = IDX_ACTIVE_SPRITES; + task->tActiveSprites++; } } - if (task->data[2] == task->data[5]) - task->data[0]++; + if (task->tPairNum == task->tPairMax) + task->tState++; - task->data[2]++; + task->tPairNum++; } break; case 1: - if (task->data[10] == 0) + // Wait for sprites to be destroyed before ending task + if (task->tActiveSprites == 0) DestroyAnimVisualTask(taskId); break; } } -static void GetGlareEyeDotCoords(s16 arg0, s16 arg1, s16 arg2, s16 arg3, u8 arg4, u8 arg5, s16 *x, s16 *y) +static void GetGlareEyeDotCoords(s16 startX, s16 startY, s16 endX, s16 endY, u8 pairMax, u8 pairNum, s16 *x, s16 *y) { int x2; int y2; - if (arg5 == 0) + if (pairNum == 0) { - *x = arg0; - *y = arg1; + *x = startX; + *y = startY; return; } - if (arg5 >= arg4) + if (pairNum >= pairMax) { - *x = arg2; - *y = arg3; + *x = endX; + *y = endY; return; } - arg4--; - x2 = (arg0 << 8) + arg5 * (((arg2 - arg0) << 8) / arg4); - y2 = (arg1 << 8) + arg5 * (((arg3 - arg1) << 8) / arg4); + pairMax--; + x2 = (startX << 8) + pairNum * (((endX - startX) << 8) / pairMax); + y2 = (startY << 8) + pairNum * (((endY - startY) << 8) / pairMax); *x = x2 >> 8; *y = y2 >> 8; } static void AnimGlareEyeDot(struct Sprite *sprite) { - if (++sprite->data[0] > 36) + if (++sprite->sTimer > 36) { - gTasks[sprite->data[1]].data[sprite->data[2]]--; + gTasks[sprite->sTaskId].data[sprite->sActiveSpritesIdx]--; DestroySprite(sprite); } } +#undef IDX_ACTIVE_SPRITES +#undef tState +#undef tTimer +#undef tPairNum +#undef tPairMax +#undef tDotOffset +#undef tIsContest +#undef tActiveSprites +#undef tStartX +#undef tStartY +#undef tEndX +#undef tEndY +#undef sTimer +#undef sTaskId +#undef sActiveSpritesIdx + // Moves a pawprint in a straight line. // arg 0: initial x position // arg 1: initial y position diff --git a/src/battle_anim_fire.c b/src/battle_anim_fire.c index 8ecb60713..b523a3771 100644 --- a/src/battle_anim_fire.c +++ b/src/battle_anim_fire.c @@ -26,18 +26,18 @@ static void AnimFireCross(struct Sprite *); static void AnimFireSpiralOutward(struct Sprite *); static void AnimFireSpiralOutward_Step1(struct Sprite *); static void AnimFireSpiralOutward_Step2(struct Sprite *); -static void AnimTask_EruptionLaunchRocks_Step(u8 taskId); -static void CreateEruptionLaunchRocks(u8 spriteId, u8 taskId, u8 a3); +static void AnimTask_EruptionLaunchRocks_Step(u8); +static void CreateEruptionLaunchRocks(u8, u8, u8); static void AnimEruptionLaunchRock(struct Sprite *); -static u16 GetEruptionLaunchRockInitialYPos(u8 spriteId); -static void InitEruptionLaunchRockCoordData(struct Sprite *sprite, s16 x, s16 y); +static u16 GetEruptionLaunchRockInitialYPos(u8); +static void InitEruptionLaunchRockCoordData(struct Sprite *, s16, s16); static void UpdateEruptionLaunchRockPos(struct Sprite *); static void AnimEruptionFallingRock(struct Sprite *); static void AnimEruptionFallingRock_Step(struct Sprite *); static void AnimWillOWispOrb(struct Sprite *); static void AnimWillOWispOrb_Step(struct Sprite *); static void AnimWillOWispFire(struct Sprite *); -static void AnimTask_MoveHeatWaveTargets_Step(u8 taskId); +static void AnimTask_MoveHeatWaveTargets_Step(u8); static const union AnimCmd sAnim_FireSpiralSpread_0[] = { @@ -355,7 +355,7 @@ const struct SpriteTemplate gEruptionLaunchRockSpriteTemplate = .callback = AnimEruptionLaunchRock, }; -static const s16 sEruptionLaunchRockCoords[][2] = +static const s16 sEruptionLaunchRockSpeeds[][2] = { {-2, -5}, {-1, -1}, @@ -770,22 +770,43 @@ static void AnimFireSpiralOutward_Step2(struct Sprite *sprite) DestroyAnimSprite(sprite); } +#define IDX_ACTIVE_SPRITES 6 // Used by the sprite callback to modify the number of active sprites + +#define tState data[0] +#define tTimer1 data[1] +#define tTimer2 data[2] +#define tTimer3 data[3] +#define tAttackerY data[4] +#define tAttackerSide data[5] +#define tActiveSprites data[IDX_ACTIVE_SPRITES] +// data[8]-data[15] used by PrepareEruptAnimTaskData / UpdateEruptAnimTask +#define tAttackerSpriteId data[15] + +#define sSpeedDelay data[0] +#define sLaunchStage data[1] +#define sX data[2] +#define sY data[3] +#define sSpeedX data[4] +#define sSpeedY data[5] +#define sTaskId data[6] +#define sActiveSpritesIdx data[7] + // Animates first stage of Eruption where the attacker squishes and launches rocks away from themself void AnimTask_EruptionLaunchRocks(u8 taskId) { struct Task *task = &gTasks[taskId]; - task->data[15] = GetAnimBattlerSpriteId(ANIM_ATTACKER); + task->tAttackerSpriteId = GetAnimBattlerSpriteId(ANIM_ATTACKER); - task->data[0] = 0; - task->data[1] = 0; - task->data[2] = 0; - task->data[3] = 0; - task->data[4] = gSprites[task->data[15]].y; - task->data[5] = GetBattlerSide(gBattleAnimAttacker); - task->data[6] = 0; + task->tState = 0; + task->tTimer1 = 0; + task->tTimer2 = 0; + task->tTimer3 = 0; + task->tAttackerY = gSprites[task->tAttackerSpriteId].y; + task->tAttackerSide = GetBattlerSide(gBattleAnimAttacker); + task->tActiveSprites = 0; - PrepareBattlerSpriteForRotScale(task->data[15], ST_OAM_OBJ_NORMAL); + PrepareBattlerSpriteForRotScale(task->tAttackerSpriteId, ST_OAM_OBJ_NORMAL); task->func = AnimTask_EruptionLaunchRocks_Step; } @@ -794,102 +815,102 @@ static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) { struct Task *task = &gTasks[taskId]; - switch (task->data[0]) + switch (task->tState) { case 0: - PrepareEruptAnimTaskData(task, task->data[15], 0x100, 0x100, 0xE0, 0x200, 32); - task->data[0]++; + PrepareEruptAnimTaskData(task, task->tAttackerSpriteId, 0x100, 0x100, 0xE0, 0x200, 32); + task->tState++; case 1: - if (++task->data[1] > 1) + if (++task->tTimer1 > 1) { - task->data[1] = 0; + task->tTimer1 = 0; - if (++task->data[2] & 0x1) - gSprites[task->data[15]].x2 = 3; + if (++task->tTimer2 & 1) + gSprites[task->tAttackerSpriteId].x2 = 3; else - gSprites[task->data[15]].x2 = -3; + gSprites[task->tAttackerSpriteId].x2 = -3; } - if (task->data[5] != B_SIDE_PLAYER) + if (task->tAttackerSide != B_SIDE_PLAYER) { - if (++task->data[3] > 4) + if (++task->tTimer3 > 4) { - task->data[3] = 0; - gSprites[task->data[15]].y++; + task->tTimer3 = 0; + gSprites[task->tAttackerSpriteId].y++; } } if(!UpdateEruptAnimTask(task)) { - SetBattlerSpriteYOffsetFromYScale(task->data[15]); - gSprites[task->data[15]].x2 = 0; + SetBattlerSpriteYOffsetFromYScale(task->tAttackerSpriteId); + gSprites[task->tAttackerSpriteId].x2 = 0; - task->data[1] = 0; - task->data[2] = 0; - task->data[3] = 0; - task->data[0]++; + task->tTimer1 = 0; + task->tTimer2 = 0; + task->tTimer3 = 0; + task->tState++; } break; case 2: - if (++task->data[1] > 4) + if (++task->tTimer1 > 4) { - if (task->data[5] != B_SIDE_PLAYER) - PrepareEruptAnimTaskData(task, task->data[15], 0xE0, 0x200, 0x180, 0xF0, 6); + if (task->tAttackerSide != B_SIDE_PLAYER) + PrepareEruptAnimTaskData(task, task->tAttackerSpriteId, 0xE0, 0x200, 0x180, 0xF0, 6); else - PrepareEruptAnimTaskData(task, task->data[15], 0xE0, 0x200, 0x180, 0xC0, 6); + PrepareEruptAnimTaskData(task, task->tAttackerSpriteId, 0xE0, 0x200, 0x180, 0xC0, 6); - task->data[1] = 0; - task->data[0]++; + task->tTimer1 = 0; + task->tState++; } break; case 3: if (!UpdateEruptAnimTask(task)) { - CreateEruptionLaunchRocks(task->data[15], taskId, 6); - task->data[0]++; + CreateEruptionLaunchRocks(task->tAttackerSpriteId, taskId, IDX_ACTIVE_SPRITES); + task->tState++; } break; case 4: - if (++task->data[1] > 1) + if (++task->tTimer1 > 1) { - task->data[1] = 0; + task->tTimer1 = 0; - if (++task->data[2] & 1) - gSprites[task->data[15]].y2 += 3; + if (++task->tTimer2 & 1) + gSprites[task->tAttackerSpriteId].y2 += 3; else - gSprites[task->data[15]].y2 -= 3; + gSprites[task->tAttackerSpriteId].y2 -= 3; } - if (++task->data[3] > 0x18) + if (++task->tTimer3 > 24) { - if (task->data[5] != B_SIDE_PLAYER) - PrepareEruptAnimTaskData(task, task->data[15], 0x180, 0xF0, 0x100, 0x100, 8); + if (task->tAttackerSide != B_SIDE_PLAYER) + PrepareEruptAnimTaskData(task, task->tAttackerSpriteId, 0x180, 0xF0, 0x100, 0x100, 8); else - PrepareEruptAnimTaskData(task, task->data[15], 0x180, 0xC0, 0x100, 0x100, 8); + PrepareEruptAnimTaskData(task, task->tAttackerSpriteId, 0x180, 0xC0, 0x100, 0x100, 8); - if (task->data[2] & 1) - gSprites[task->data[15]].y2 -= 3; + if (task->tTimer2 & 1) + gSprites[task->tAttackerSpriteId].y2 -= 3; - task->data[1] = 0; - task->data[2] = 0; - task->data[3] = 0; - task->data[0]++; + task->tTimer1 = 0; + task->tTimer2 = 0; + task->tTimer3 = 0; + task->tState++; } break; case 5: - if (task->data[5] != B_SIDE_PLAYER) - gSprites[task->data[15]].y--; + if (task->tAttackerSide != B_SIDE_PLAYER) + gSprites[task->tAttackerSpriteId].y--; if (!UpdateEruptAnimTask(task)) { - gSprites[task->data[15]].y = task->data[4]; - ResetSpriteRotScale(task->data[15]); - task->data[2] = 0; - task->data[0]++; + gSprites[task->tAttackerSpriteId].y = task->tAttackerY; + ResetSpriteRotScale(task->tAttackerSpriteId); + task->tTimer2 = 0; + task->tState++; } break; case 6: - if (!task->data[6]) + if (task->tActiveSprites == 0) DestroyAnimVisualTask(taskId); break; default: @@ -897,7 +918,7 @@ static void AnimTask_EruptionLaunchRocks_Step(u8 taskId) } } -static void CreateEruptionLaunchRocks(u8 spriteId, u8 taskId, u8 a3) +static void CreateEruptionLaunchRocks(u8 spriteId, u8 taskId, u8 activeSpritesIdx) { u16 i, j; s8 sign; @@ -907,12 +928,12 @@ static void CreateEruptionLaunchRocks(u8 spriteId, u8 taskId, u8 a3) if(!GetBattlerSide(gBattleAnimAttacker)) { - x -= 0xC; + x -= 12; sign = 1; } else { - x += 0x10; + x += 16; sign = -1; } @@ -920,18 +941,18 @@ static void CreateEruptionLaunchRocks(u8 spriteId, u8 taskId, u8 a3) { u8 spriteId = CreateSprite(&gEruptionLaunchRockSpriteTemplate, x, y, 2); - if (spriteId != 0x40) + if (spriteId != MAX_SPRITES) { gSprites[spriteId].oam.tileNum += j * 4 + 0x40; if (++j >= 5) j = 0; - InitEruptionLaunchRockCoordData(&gSprites[spriteId], sEruptionLaunchRockCoords[i][0] * sign, sEruptionLaunchRockCoords[i][1]); - gSprites[spriteId].data[6] = taskId; - gSprites[spriteId].data[7] = a3; + InitEruptionLaunchRockCoordData(&gSprites[spriteId], sEruptionLaunchRockSpeeds[i][0] * sign, sEruptionLaunchRockSpeeds[i][1]); + gSprites[spriteId].sTaskId = taskId; + gSprites[spriteId].sActiveSpritesIdx = activeSpritesIdx; - gTasks[taskId].data[a3]++; + gTasks[taskId].data[activeSpritesIdx]++; } } } @@ -942,7 +963,7 @@ static void AnimEruptionLaunchRock(struct Sprite *sprite) if (sprite->invisible) { - gTasks[sprite->data[6]].data[sprite->data[7]]--; + gTasks[sprite->sTaskId].data[sprite->sActiveSpritesIdx]--; DestroySprite(sprite); } } @@ -959,46 +980,71 @@ static u16 GetEruptionLaunchRockInitialYPos(u8 spriteId) return y; } -static void InitEruptionLaunchRockCoordData(struct Sprite *sprite, s16 x, s16 y) +static void InitEruptionLaunchRockCoordData(struct Sprite *sprite, s16 speedX, s16 speedY) { - sprite->data[0] = 0; - sprite->data[1] = 0; - sprite->data[2] = (u16)sprite->x * 8; - sprite->data[3] = (u16)sprite->y * 8; - sprite->data[4] = x * 8; - sprite->data[5] = y * 8; + sprite->sSpeedDelay = 0; + sprite->sLaunchStage = 0; + sprite->sX = (u16)sprite->x * 8; + sprite->sY = (u16)sprite->y * 8; + sprite->sSpeedX = speedX * 8; + sprite->sSpeedY = speedY * 8; } static void UpdateEruptionLaunchRockPos(struct Sprite *sprite) { - int var1; - if (++sprite->data[0] > 2) + int extraLaunchSpeed; + if (++sprite->sSpeedDelay > 2) { - sprite->data[0] = 0; - ++sprite->data[1]; - var1 = (u16)sprite->data[1] * (u16)sprite->data[1]; - sprite->data[3] += var1; + sprite->sSpeedDelay = 0; + ++sprite->sLaunchStage; + extraLaunchSpeed = (u16)sprite->sLaunchStage * (u16)sprite->sLaunchStage; + sprite->sY += extraLaunchSpeed; } - sprite->data[2] += sprite->data[4]; - sprite->x = sprite->data[2] >> 3; - sprite->data[3] += sprite->data[5]; - sprite->y = sprite->data[3] >> 3; + sprite->sX += sprite->sSpeedX; + sprite->x = sprite->sX >> 3; + sprite->sY += sprite->sSpeedY; + sprite->y = sprite->sY >> 3; - if (sprite->x < -8 || sprite->x > 0xf8 || sprite->y < -8 || sprite->y > 120) + if (sprite->x < -8 || sprite->x > DISPLAY_WIDTH + 8 || sprite->y < -8 || sprite->y > 120) sprite->invisible = TRUE; } +#undef IDX_ACTIVE_SPRITES +#undef tState +#undef tTimer1 +#undef tTimer2 +#undef tTimer3 +#undef tAttackerY +#undef tAttackerSide +#undef tActiveSprites +#undef tAttackerSpriteId +#undef sSpeedDelay +#undef sLaunchStage +#undef sX +#undef sY +#undef sSpeedX +#undef sSpeedY +#undef sTaskId +#undef sActiveSpritesIdx + +#define sState data[0] +#define sBounceTimer data[1] +#define sBounceDir data[2] +#define sEndTimer data[3] +#define sFallDelay data[6] +#define sTargetY data[7] + static void AnimEruptionFallingRock(struct Sprite *sprite) { sprite->x = gBattleAnimArgs[0]; sprite->y = gBattleAnimArgs[1]; - sprite->data[0] = 0; - sprite->data[1] = 0; - sprite->data[2] = 0; - sprite->data[6] = gBattleAnimArgs[2]; - sprite->data[7] = gBattleAnimArgs[3]; + sprite->sState = 0; + sprite->sBounceTimer = 0; + sprite->sBounceDir = 0; + sprite->sFallDelay = gBattleAnimArgs[2]; + sprite->sTargetY = gBattleAnimArgs[3]; sprite->oam.tileNum += gBattleAnimArgs[4] * 16; sprite->callback = AnimEruptionFallingRock_Step; @@ -1006,47 +1052,51 @@ static void AnimEruptionFallingRock(struct Sprite *sprite) static void AnimEruptionFallingRock_Step(struct Sprite *sprite) { - switch (sprite->data[0]) + switch (sprite->sState) { case 0: - if (sprite->data[6] != 0) + // Wait to begin falling + if (sprite->sFallDelay != 0) { - sprite->data[6]--; + sprite->sFallDelay--; return; } - sprite->data[0]++; + sprite->sState++; // fall through case 1: + // Rock is falling sprite->y += 8; - if (sprite->y >= sprite->data[7]) + if (sprite->y >= sprite->sTargetY) { - sprite->y = sprite->data[7]; - sprite->data[0]++; + sprite->y = sprite->sTargetY; + sprite->sState++; } break; case 2: - if (++sprite->data[1] > 1) + // Bounce up and down on landing spot + if (++sprite->sBounceTimer > 1) { - sprite->data[1] = 0; - if ((++sprite->data[2] & 1) != 0) - { + sprite->sBounceTimer = 0; + if ((++sprite->sBounceDir & 1) != 0) sprite->y2 = -3; - } else - { sprite->y2 = 3; - } } - if (++sprite->data[3] > 16) - { + if (++sprite->sEndTimer > 16) DestroyAnimSprite(sprite); - } break; } } +#undef sState +#undef sBounceTimer +#undef sBounceDir +#undef sEndTimer +#undef sFallDelay +#undef sTargetY + static void AnimWillOWispOrb(struct Sprite *sprite) { switch (sprite->data[0]) diff --git a/src/battle_anim_ghost.c b/src/battle_anim_ghost.c index c004ae1da..a59e54900 100644 --- a/src/battle_anim_ghost.c +++ b/src/battle_anim_ghost.c @@ -1004,7 +1004,7 @@ static void AnimTask_CurseStretchingBlackBg_Step1(u8 taskId) right = DISPLAY_WIDTH; top = 0; bottom = 112; - selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE); BeginNormalPaletteFade(selectedPalettes, 0, 16, 16, RGB(0, 0, 0)); gTasks[taskId].func = AnimTask_CurseStretchingBlackBg_Step2; } diff --git a/src/battle_anim_mons.c b/src/battle_anim_mons.c index a03196ee1..2fbe858d7 100644 --- a/src/battle_anim_mons.c +++ b/src/battle_anim_mons.c @@ -908,13 +908,17 @@ bool8 IsDoubleBattle(void) return IS_DOUBLE_BATTLE(); } +#define BG_ANIM_PAL_1 8 +#define BG_ANIM_PAL_2 9 +#define BG_ANIM_PAL_CONTEST 14 + void GetBattleAnimBg1Data(struct BattleAnimBgData *out) { if (IsContest()) { out->bgTiles = gBattleAnimBgTileBuffer; out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer; - out->paletteId = 14; + out->paletteId = BG_ANIM_PAL_CONTEST; out->bgId = 1; out->tilesOffset = 0; out->unused = 0; @@ -923,7 +927,7 @@ void GetBattleAnimBg1Data(struct BattleAnimBgData *out) { out->bgTiles = gBattleAnimBgTileBuffer; out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer; - out->paletteId = 8; + out->paletteId = BG_ANIM_PAL_1; out->bgId = 1; out->tilesOffset = 0x200; out->unused = 0; @@ -936,7 +940,7 @@ void GetBattleAnimBgData(struct BattleAnimBgData *out, u32 bgId) { out->bgTiles = gBattleAnimBgTileBuffer; out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer; - out->paletteId = 14; + out->paletteId = BG_ANIM_PAL_CONTEST; out->bgId = 1; out->tilesOffset = 0; out->unused = 0; @@ -949,7 +953,7 @@ void GetBattleAnimBgData(struct BattleAnimBgData *out, u32 bgId) { out->bgTiles = gBattleAnimBgTileBuffer; out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer; - out->paletteId = 9; + out->paletteId = BG_ANIM_PAL_2; out->bgId = 2; out->tilesOffset = 0x300; out->unused = 0; @@ -962,21 +966,21 @@ void GetBgDataForTransform(struct BattleAnimBgData *out, u8 battlerId) out->bgTilemap = (u16 *)gBattleAnimBgTilemapBuffer; if (IsContest()) { - out->paletteId = 14; + out->paletteId = BG_ANIM_PAL_CONTEST; out->bgId = 1; out->tilesOffset = 0; out->unused = 0; } else if (GetBattlerSpriteBGPriorityRank(gBattleAnimAttacker) == 1) { - out->paletteId = 8; + out->paletteId = BG_ANIM_PAL_1; out->bgId = 1; out->tilesOffset = 0x200; out->unused = 0; } else { - out->paletteId = 9; + out->paletteId = BG_ANIM_PAL_2; out->bgId = 2; out->tilesOffset = 0x300; out->unused = 0; @@ -1361,14 +1365,14 @@ void ResetSpriteRotScale_PreserveAffine(struct Sprite *sprite) CalcCenterToCornerVec(sprite, sprite->oam.shape, sprite->oam.size, sprite->oam.affineMode); } -static u16 ArcTan2_(s16 a, s16 b) +static u16 ArcTan2_(s16 x, s16 y) { - return ArcTan2(a, b); + return ArcTan2(x, y); } -u16 ArcTan2Neg(s16 a, s16 b) +u16 ArcTan2Neg(s16 x, s16 y) { - u16 var = ArcTan2_(a, b); + u16 var = ArcTan2_(x, y); return -var; } @@ -1401,7 +1405,7 @@ void SetGrayscaleOrOriginalPalette(u16 paletteNum, bool8 restoreOriginalColor) } } -u32 GetBattleBgPalettesMask(u8 battleBackground, u8 attacker, u8 target, u8 attackerPartner, u8 targetPartner, u8 a6, u8 a7) +u32 GetBattlePalettesMask(bool8 battleBackground, bool8 attacker, bool8 target, bool8 attackerPartner, bool8 targetPartner, bool8 anim1, bool8 anim2) { u32 selectedPalettes = 0; u32 shift; @@ -1409,7 +1413,7 @@ u32 GetBattleBgPalettesMask(u8 battleBackground, u8 attacker, u8 target, u8 atta if (battleBackground) { if (!IsContest()) - selectedPalettes = 0xe; + selectedPalettes = 0xe; // Palettes 1, 2, and 3 else selectedPalettes = 1 << GetBattleBgPaletteNum(); } @@ -1439,17 +1443,17 @@ u32 GetBattleBgPalettesMask(u8 battleBackground, u8 attacker, u8 target, u8 atta selectedPalettes |= 1 << shift; } } - if (a6) + if (anim1) { if (!IsContest()) - selectedPalettes |= 0x100; + selectedPalettes |= 1 << BG_ANIM_PAL_1; else - selectedPalettes |= 0x4000; + selectedPalettes |= 1 << BG_ANIM_PAL_CONTEST; } - if (a7) + if (anim2) { if (!IsContest()) - selectedPalettes |= 0x200; + selectedPalettes |= 1 << BG_ANIM_PAL_2; } return selectedPalettes; } diff --git a/src/battle_anim_normal.c b/src/battle_anim_normal.c index ebf9a588f..a92428f83 100644 --- a/src/battle_anim_normal.c +++ b/src/battle_anim_normal.c @@ -304,7 +304,7 @@ static void AnimConfusionDuck_Step(struct Sprite *sprite) // arg 4: blend color static void AnimSimplePaletteBlend(struct Sprite *sprite) { - u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gBattleAnimArgs[0]); + u32 selectedPalettes = UnpackSelectedBattlePalettes(gBattleAnimArgs[0]); BeginNormalPaletteFade(selectedPalettes, gBattleAnimArgs[1], gBattleAnimArgs[2], gBattleAnimArgs[3], gBattleAnimArgs[4]); sprite->invisible = TRUE; sprite->callback = AnimSimplePaletteBlend_Step; @@ -312,23 +312,23 @@ static void AnimSimplePaletteBlend(struct Sprite *sprite) // Unpacks a bitfield and returns a bitmask of its selected palettes. // Bits 0-6 of the selector parameter result in the following palettes being selected: -// 0: battle background palettes (BG palettes 1, 2, and 3) -// 1: gBattleAnimAttacker OBJ palette -// 2: gBattleAnimTarget OBJ palette -// 3: gBattleAnimAttacker partner OBJ palette -// 4: gBattleAnimTarget partner OBJ palette -// 5: BG palette 4 -// 6: BG palette 5 -u32 UnpackSelectedBattleBgPalettes(s16 selector) +// 0: F_PAL_BG, battle background palettes (BG palettes 1, 2, and 3) +// 1: F_PAL_ATTACKER, gBattleAnimAttacker OBJ palette +// 2: F_PAL_TARGET, gBattleAnimTarget OBJ palette +// 3: F_PAL_ATK_PARTNER, gBattleAnimAttacker partner OBJ palette +// 4: F_PAL_DEF_PARTNER, gBattleAnimTarget partner OBJ palette +// 5: F_PAL_ANIM_1, BG palette 8 (or 14, if in Contest) +// 6: F_PAL_ANIM_2, BG palette 9 +u32 UnpackSelectedBattlePalettes(s16 selector) { - u8 battleBackground = selector & 1; - u8 attacker = (selector >> 1) & 1; - u8 target = (selector >> 2) & 1; - u8 attackerPartner = (selector >> 3) & 1; - u8 targetPartner = (selector >> 4) & 1; - u8 arg5 = (selector >> 5) & 1; - u8 arg6 = (selector >> 6) & 1; - return GetBattleBgPalettesMask(battleBackground, attacker, target, attackerPartner, targetPartner, arg5, arg6); + bool8 battleBackground = selector & 1; + bool8 attacker = (selector >> 1) & 1; + bool8 target = (selector >> 2) & 1; + bool8 attackerPartner = (selector >> 3) & 1; + bool8 targetPartner = (selector >> 4) & 1; + bool8 anim1 = (selector >> 5) & 1; + bool8 anim2 = (selector >> 6) & 1; + return GetBattlePalettesMask(battleBackground, attacker, target, attackerPartner, targetPartner, anim1, anim2); } static void AnimSimplePaletteBlend_Step(struct Sprite *sprite) @@ -350,7 +350,7 @@ static void AnimComplexPaletteBlend(struct Sprite *sprite) sprite->data[6] = gBattleAnimArgs[6]; sprite->data[7] = gBattleAnimArgs[0]; - selectedPalettes = UnpackSelectedBattleBgPalettes(sprite->data[7]); + selectedPalettes = UnpackSelectedBattlePalettes(sprite->data[7]); BlendPalettes(selectedPalettes, gBattleAnimArgs[4], gBattleAnimArgs[3]); sprite->invisible = TRUE; sprite->callback = AnimComplexPaletteBlend_Step1; @@ -375,7 +375,7 @@ static void AnimComplexPaletteBlend_Step1(struct Sprite *sprite) return; } - selectedPalettes = UnpackSelectedBattleBgPalettes(sprite->data[7]); + selectedPalettes = UnpackSelectedBattlePalettes(sprite->data[7]); if (sprite->data[1] & 0x100) BlendPalettes(selectedPalettes, sprite->data[4], sprite->data[3]); else @@ -392,7 +392,7 @@ static void AnimComplexPaletteBlend_Step2(struct Sprite *sprite) if (!gPaletteFade.active) { - selectedPalettes = UnpackSelectedBattleBgPalettes(sprite->data[7]); + selectedPalettes = UnpackSelectedBattlePalettes(sprite->data[7]); BlendPalettes(selectedPalettes, 0, 0); DestroyAnimSprite(sprite); } @@ -442,7 +442,7 @@ void AnimTask_BlendColorCycle(u8 taskId) static void BlendColorCycle(u8 taskId, u8 startBlendAmount, u8 targetBlendAmount) { - u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gTasks[taskId].tPalSelector); + u32 selectedPalettes = UnpackSelectedBattlePalettes(gTasks[taskId].tPalSelector); BeginNormalPaletteFade( selectedPalettes, gTasks[taskId].tDelay, @@ -721,7 +721,7 @@ void AnimTask_InvertScreenColor(u8 taskId) u8 targetBattler = gBattleAnimTarget; if (gBattleAnimArgs[0] & 0x100) - selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE); if (gBattleAnimArgs[1] & 0x100) selectedPalettes |= (0x10000 << attackerBattler); diff --git a/src/battle_anim_psychic.c b/src/battle_anim_psychic.c index a7faa7658..aebf76cc0 100644 --- a/src/battle_anim_psychic.c +++ b/src/battle_anim_psychic.c @@ -583,9 +583,9 @@ static void AnimWallSparkle(struct Sprite *sprite) { if (sprite->data[0] == 0) { - int arg3 = gBattleAnimArgs[3]; + bool32 ignoreOffsets = gBattleAnimArgs[3]; bool8 respectMonPicOffsets = FALSE; - if (arg3 == 0) + if (!ignoreOffsets) respectMonPicOffsets = TRUE; if (!IsContest() && IsDoubleBattle()) diff --git a/src/battle_anim_smokescreen.c b/src/battle_anim_smokescreen.c index 0819796d2..c7be8d41c 100644 --- a/src/battle_anim_smokescreen.c +++ b/src/battle_anim_smokescreen.c @@ -7,8 +7,13 @@ #include "util.h" #include "constants/battle_palace.h" -static void SmokescreenImpact_Callback(struct Sprite *); -static void SpriteCB_DestroySprite(struct Sprite *sprite); +#define TAG_SMOKESCREEN 55019 + +#define PALTAG_SHADOW 55039 +#define GFXTAG_SHADOW 55129 + +static void SpriteCB_SmokescreenImpactMain(struct Sprite *); +static void SpriteCB_SmokescreenImpact(struct Sprite *); // The below data for smokescreen starts and ends with some data that belongs to battle_gfx_sfx_util.c @@ -43,12 +48,12 @@ const u8 gBattlePalaceNatureToMoveTarget[NUM_NATURES] = static const struct CompressedSpriteSheet sSmokescreenImpactSpriteSheet = { - .data = gSmokescreenImpactTiles, .size = 0x180, .tag = 55019 + .data = gSmokescreenImpactTiles, .size = 0x180, .tag = TAG_SMOKESCREEN }; static const struct CompressedSpritePalette sSmokescreenImpactSpritePalette = { - .data = gSmokescreenImpactPalette, .tag = 55019 + .data = gSmokescreenImpactPalette, .tag = TAG_SMOKESCREEN }; static const struct OamData sOamData_SmokescreenImpact = @@ -110,18 +115,18 @@ static const union AnimCmd *const sAnims_SmokescreenImpact[] = static const struct SpriteTemplate sSmokescreenImpactSpriteTemplate = { - .tileTag = 55019, - .paletteTag = 55019, + .tileTag = TAG_SMOKESCREEN, + .paletteTag = TAG_SMOKESCREEN, .oam = &sOamData_SmokescreenImpact, .anims = sAnims_SmokescreenImpact, .images = NULL, .affineAnims = gDummySpriteAffineAnimTable, - .callback = SpriteCB_DestroySprite + .callback = SpriteCB_SmokescreenImpact }; const struct CompressedSpriteSheet gSpriteSheet_EnemyShadow = { - .data = gEnemyMonShadow_Gfx, .size = 0x80, .tag = 55129 + .data = gEnemyMonShadow_Gfx, .size = 0x80, .tag = GFXTAG_SHADOW }; static const struct OamData sOamData_EnemyShadow = @@ -143,8 +148,8 @@ static const struct OamData sOamData_EnemyShadow = const struct SpriteTemplate gSpriteTemplate_EnemyShadow = { - .tileTag = 55129, - .paletteTag = 55039, + .tileTag = GFXTAG_SHADOW, + .paletteTag = PALTAG_SHADOW, .oam = &sOamData_EnemyShadow, .anims = gDummySpriteAnimTable, .images = NULL, @@ -152,7 +157,12 @@ const struct SpriteTemplate gSpriteTemplate_EnemyShadow = .callback = SpriteCB_SetInvisible }; -u8 SmokescreenImpact(s16 x, s16 y, u8 a3) +#define sActiveSprites data[0] +#define sPersist data[1] + +#define sMainSpriteId data[0] + +u8 SmokescreenImpact(s16 x, s16 y, bool8 persist) { u8 mainSpriteId; u8 spriteId1, spriteId2, spriteId3, spriteId4; @@ -164,54 +174,58 @@ u8 SmokescreenImpact(s16 x, s16 y, u8 a3) LoadCompressedSpritePaletteUsingHeap(&sSmokescreenImpactSpritePalette); } - mainSpriteId = CreateInvisibleSpriteWithCallback(SmokescreenImpact_Callback); + mainSpriteId = CreateInvisibleSpriteWithCallback(SpriteCB_SmokescreenImpactMain); mainSprite = &gSprites[mainSpriteId]; - mainSprite->data[1] = a3; + mainSprite->sPersist = persist; + // Top left sprite spriteId1 = CreateSprite(&sSmokescreenImpactSpriteTemplate, x - 16, y - 16, 2); - gSprites[spriteId1].data[0] = mainSpriteId; - mainSprite->data[0]++; + gSprites[spriteId1].sMainSpriteId = mainSpriteId; + mainSprite->sActiveSprites++; AnimateSprite(&gSprites[spriteId1]); + // Top right sprite spriteId2 = CreateSprite(&sSmokescreenImpactSpriteTemplate, x, y - 16, 2); - gSprites[spriteId2].data[0] = mainSpriteId; - mainSprite->data[0]++; + gSprites[spriteId2].sMainSpriteId = mainSpriteId; + mainSprite->sActiveSprites++; StartSpriteAnim(&gSprites[spriteId2], 1); AnimateSprite(&gSprites[spriteId2]); + // Bottom left sprite spriteId3 = CreateSprite(&sSmokescreenImpactSpriteTemplate, x - 16, y, 2); - gSprites[spriteId3].data[0] = mainSpriteId; - mainSprite->data[0]++; + gSprites[spriteId3].sMainSpriteId = mainSpriteId; + mainSprite->sActiveSprites++; StartSpriteAnim(&gSprites[spriteId3], 2); AnimateSprite(&gSprites[spriteId3]); + // Bottom right sprite spriteId4 = CreateSprite(&sSmokescreenImpactSpriteTemplate, x, y, 2); - gSprites[spriteId4].data[0] = mainSpriteId; - mainSprite->data[0]++; + gSprites[spriteId4].sMainSpriteId = mainSpriteId; + mainSprite->sActiveSprites++; StartSpriteAnim(&gSprites[spriteId4], 3); AnimateSprite(&gSprites[spriteId4]); return mainSpriteId; } -static void SmokescreenImpact_Callback(struct Sprite *sprite) +static void SpriteCB_SmokescreenImpactMain(struct Sprite *sprite) { - if (!sprite->data[0]) + if (sprite->sActiveSprites == 0) { FreeSpriteTilesByTag(sSmokescreenImpactSpriteSheet.tag); FreeSpritePaletteByTag(sSmokescreenImpactSpritePalette.tag); - if (!sprite->data[1]) + if (!sprite->sPersist) DestroySprite(sprite); else sprite->callback = SpriteCallbackDummy; } } -static void SpriteCB_DestroySprite(struct Sprite *sprite) +static void SpriteCB_SmokescreenImpact(struct Sprite *sprite) { if (sprite->animEnded) { - gSprites[sprite->data[0]].data[0]--; + gSprites[sprite->sMainSpriteId].sActiveSprites--; DestroySprite(sprite); } } diff --git a/src/battle_anim_throw.c b/src/battle_anim_throw.c index bf95a319c..2f095a043 100755 --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -690,7 +690,7 @@ void AnimTask_SwitchOutBallEffect(u8 taskId) priority = gSprites[spriteId].oam.priority; subpriority = gSprites[spriteId].subpriority; gTasks[taskId].data[10] = AnimateBallOpenParticles(x, y + 32, priority, subpriority, ballId); - selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE); gTasks[taskId].data[11] = LaunchBallFadeMonTask(FALSE, gBattleAnimAttacker, selectedPalettes, ballId); gTasks[taskId].data[0]++; break; @@ -2018,24 +2018,24 @@ static void DestroyBallOpenAnimationParticle(struct Sprite *sprite) #define tPaletteHi data[11] #define tBallId data[15] -u8 LaunchBallFadeMonTask(bool8 unfadeLater, u8 battler, u32 selectedPalettes, u8 ballId) +u8 LaunchBallFadeMonTask(bool8 unfadeLater, u8 spritePalNum, u32 selectedPalettes, u8 ballId) { u8 taskId; taskId = CreateTask(Task_FadeMon_ToBallColor, 5); gTasks[taskId].tBallId = ballId; - gTasks[taskId].tPalOffset = battler; + gTasks[taskId].tPalOffset = spritePalNum; gTasks[taskId].tPaletteLo = selectedPalettes; gTasks[taskId].tPaletteHi = selectedPalettes >> 16; if (!unfadeLater) { - BlendPalette(battler * 16 + 0x100, 16, 0, gBallOpenFadeColors[ballId]); + BlendPalette(spritePalNum * 16 + 0x100, 16, 0, gBallOpenFadeColors[ballId]); gTasks[taskId].tdCoeff = 1; } else { - BlendPalette(battler * 16 + 0x100, 16, 16, gBallOpenFadeColors[ballId]); + BlendPalette(spritePalNum * 16 + 0x100, 16, 16, gBallOpenFadeColors[ballId]); gTasks[taskId].tCoeff = 16; gTasks[taskId].tdCoeff = -1; gTasks[taskId].func = Task_FadeMon_ToNormal; diff --git a/src/battle_anim_utility_funcs.c b/src/battle_anim_utility_funcs.c index aae8d6b5d..b5455a19c 100644 --- a/src/battle_anim_utility_funcs.c +++ b/src/battle_anim_utility_funcs.c @@ -47,7 +47,7 @@ const u8 gBattleAnimBgCntGet[] = {REG_OFFSET_BG0CNT, REG_OFFSET_BG1CNT, REG_OFFS void AnimTask_BlendBattleAnimPal(u8 taskId) { - u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gBattleAnimArgs[0]); + u32 selectedPalettes = UnpackSelectedBattlePalettes(gBattleAnimArgs[0]); selectedPalettes |= GetBattleMonSpritePalettesMask((gBattleAnimArgs[0] >> 7) & 1, (gBattleAnimArgs[0] >> 8) & 1, (gBattleAnimArgs[0] >> 9) & 1, @@ -62,7 +62,7 @@ void AnimTask_BlendBattleAnimPalExclude(u8 taskId) u8 animBattlers[2]; animBattlers[1] = 0xFF; - selectedPalettes = UnpackSelectedBattleBgPalettes(1); + selectedPalettes = UnpackSelectedBattlePalettes(F_PAL_BG); switch (gBattleAnimArgs[0]) { case 2: @@ -105,7 +105,7 @@ void AnimTask_BlendBattleAnimPalExclude(u8 taskId) void AnimTask_SetCamouflageBlend(u8 taskId) { - u32 selectedPalettes = UnpackSelectedBattleBgPalettes(gBattleAnimArgs[0]); + u32 selectedPalettes = UnpackSelectedBattlePalettes(gBattleAnimArgs[0]); switch (gBattleTerrain) { case BATTLE_TERRAIN_GRASS: @@ -606,7 +606,7 @@ void AnimTask_Flash(u8 taskId) SetPalettesToColor(selectedPalettes, RGB_BLACK); gTasks[taskId].data[14] = selectedPalettes >> 16; - selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0) & 0xFFFF; + selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) & 0xFFFF; SetPalettesToColor(selectedPalettes, RGB_WHITEALPHA); gTasks[taskId].data[15] = selectedPalettes; @@ -922,7 +922,7 @@ void AnimTask_CopyPalUnfadedToBackup(u8 taskId) if (gBattleAnimArgs[0] == 0) { - selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE); while ((selectedPalettes & 1) == 0) { selectedPalettes >>= 1; @@ -949,7 +949,7 @@ void AnimTask_CopyPalUnfadedFromBackup(u8 taskId) if (gBattleAnimArgs[0] == 0) { - selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE); while ((selectedPalettes & 1) == 0) { selectedPalettes >>= 1; @@ -976,7 +976,7 @@ void AnimTask_CopyPalFadedToUnfaded(u8 taskId) if (gBattleAnimArgs[0] == 0) { - selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); + selectedPalettes = GetBattlePalettesMask(TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE); while ((selectedPalettes & 1) == 0) { selectedPalettes >>= 1; diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 5b69030df..954192f0a 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -96,8 +96,8 @@ static void PlayerCmdEnd(void); static void PlayerBufferRunCommand(void); static void HandleInputChooseTarget(void); static void HandleInputChooseMove(void); -static void MoveSelectionCreateCursorAt(u8 cursorPos, u8 arg1); -static void MoveSelectionDestroyCursorAt(u8 cursorPos); +static void MoveSelectionCreateCursorAt(u8, u8); +static void MoveSelectionDestroyCursorAt(u8); static void MoveSelectionDisplayPpNumber(void); static void MoveSelectionDisplayPpString(void); static void MoveSelectionDisplayMoveType(void); @@ -106,18 +106,18 @@ static void HandleMoveSwitching(void); static void SwitchIn_HandleSoundAndEnd(void); static void WaitForMonSelection(void); static void CompleteWhenChoseItem(void); -static void Task_LaunchLvlUpAnim(u8 taskId); -static void Task_PrepareToGiveExpWithExpBar(u8 taskId); -static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId); -static void Task_GiveExpWithExpBar(u8 taskId); -static void Task_UpdateLvlInHealthbox(u8 taskId); +static void Task_LaunchLvlUpAnim(u8); +static void Task_PrepareToGiveExpWithExpBar(u8); +static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8); +static void Task_GiveExpWithExpBar(u8); +static void Task_UpdateLvlInHealthbox(u8); static void PrintLinkStandbyMsg(void); -static u32 CopyPlayerMonData(u8 monId, u8 *dst); -static void SetPlayerMonData(u8 monId); -static void StartSendOutAnim(u8 battlerId, bool8 dontClearSubstituteBit); +static u32 CopyPlayerMonData(u8, u8 *); +static void SetPlayerMonData(u8); +static void StartSendOutAnim(u8, bool8); static void DoSwitchOutAnimation(void); static void PlayerDoMoveAnimation(void); -static void Task_StartSendOutAnim(u8 taskId); +static void Task_StartSendOutAnim(u8); static void EndDrawPartyStatusSummary(void); static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = @@ -1507,11 +1507,11 @@ static void MoveSelectionDisplayMoveType(void) BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MOVE_TYPE); } -static void MoveSelectionCreateCursorAt(u8 cursorPosition, u8 arg1) +static void MoveSelectionCreateCursorAt(u8 cursorPosition, u8 baseTileNum) { u16 src[2]; - src[0] = arg1 + 1; - src[1] = arg1 + 2; + src[0] = baseTileNum + 1; + src[1] = baseTileNum + 2; CopyToBgTilemapBufferRect_ChangePalette(0, src, 9 * (cursorPosition & 1) + 1, 55 + (cursorPosition & 2), 1, 2, 0x11); CopyBgTilemapBufferToVram(0); @@ -1527,7 +1527,7 @@ static void MoveSelectionDestroyCursorAt(u8 cursorPosition) CopyBgTilemapBufferToVram(0); } -void ActionSelectionCreateCursorAt(u8 cursorPosition, u8 arg1) +void ActionSelectionCreateCursorAt(u8 cursorPosition, u8 baseTileNum) { u16 src[2]; src[0] = 1; diff --git a/src/battle_controllers.c b/src/battle_controllers.c index 7d2717e2c..369f735f2 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -1168,13 +1168,13 @@ void BtlController_EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpN PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(*movePpData) + 4); } -void BtlController_EmitChooseItem(u8 bufferId, u8 *arg1) +void BtlController_EmitChooseItem(u8 bufferId, u8 *battlePartyOrder) { s32 i; sBattleBuffersTransferData[0] = CONTROLLER_OPENBAG; - for (i = 0; i < 3; i++) - sBattleBuffersTransferData[1 + i] = arg1[i]; + for (i = 0; i < PARTY_SIZE / 2; i++) + sBattleBuffersTransferData[1 + i] = battlePartyOrder[i]; PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } @@ -1309,12 +1309,12 @@ void BtlController_EmitCmd32(u8 bufferId, u16 size, void *data) PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, size + 3); } -void BtlController_EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2) +void BtlController_EmitTwoReturnValues(u8 bufferId, u8 ret8, u16 ret16) { sBattleBuffersTransferData[0] = CONTROLLER_TWORETURNVALUES; - sBattleBuffersTransferData[1] = arg1; - sBattleBuffersTransferData[2] = arg2; - sBattleBuffersTransferData[3] = (arg2 & 0xFF00) >> 8; + sBattleBuffersTransferData[1] = ret8; + sBattleBuffersTransferData[2] = ret16; + sBattleBuffersTransferData[3] = (ret16 & 0xFF00) >> 8; PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } @@ -1329,20 +1329,20 @@ void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 partyId, u8 *battleP PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 5); } -void BtlController_EmitOneReturnValue(u8 bufferId, u16 arg1) +void BtlController_EmitOneReturnValue(u8 bufferId, u16 ret) { sBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE; - sBattleBuffersTransferData[1] = arg1; - sBattleBuffersTransferData[2] = (arg1 & 0xFF00) >> 8; + sBattleBuffersTransferData[1] = ret; + sBattleBuffersTransferData[2] = (ret & 0xFF00) >> 8; sBattleBuffersTransferData[3] = 0; PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } -void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 b) +void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 ret) { sBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE_DUPLICATE; - sBattleBuffersTransferData[1] = b; - sBattleBuffersTransferData[2] = (b & 0xFF00) >> 8; + sBattleBuffersTransferData[1] = ret; + sBattleBuffersTransferData[2] = (ret & 0xFF00) >> 8; sBattleBuffersTransferData[3] = 0; PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4); } diff --git a/src/battle_dome.c b/src/battle_dome.c index aadd85afd..2f86e707d 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -73,40 +73,43 @@ struct TourneyTreeLineSection #define tMode data[2] #define tPrevTaskId data[3] -// This file's functions. -static u8 GetDomeTrainerMonIvs(u16 trainerId); -static void SwapDomeTrainers(int id1, int id2, u16 *statsArray); -static void CalcDomeMonStats(u16 species, int level, int ivs, u8 evBits, u8 nature, int *stats); -static void CreateDomeOpponentMons(u16 tournamentTrainerId); -static int SelectOpponentMonsUsingPersonality(u16 tournamentTrainerId, bool8 arg1); -static int SelectOpponentMonsUsingOtId(u16 tournamentTrainerId, bool8 arg1); -static int GetTypeEffectivenessPoints(int move, int species, int arg2); -static int SelectOpponentMonsFromParty(int *arr, bool8 arg1); -static void Task_ShowTourneyInfoCard(u8 taskId); -static void Task_HandleInfoCardInput(u8 taskId); -static u8 Task_GetInfoCardInput(u8 taskId); +#define EFFECTIVENESS_MODE_GOOD 0 +#define EFFECTIVENESS_MODE_BAD 1 +#define EFFECTIVENESS_MODE_AI_VS_AI 2 + +static u8 GetDomeTrainerMonIvs(u16); +static void SwapDomeTrainers(int, int, u16 *); +static void CalcDomeMonStats(u16, int, int, u8, u8, int *); +static void CreateDomeOpponentMons(u16); +static int SelectOpponentMons_Good(u16, bool8); +static int SelectOpponentMons_Bad(u16, bool8); +static int GetTypeEffectivenessPoints(int, int, int); +static int SelectOpponentMonsFromParty(int *, bool8); +static void Task_ShowTourneyInfoCard(u8); +static void Task_HandleInfoCardInput(u8); +static u8 Task_GetInfoCardInput(u8); static void SetFacilityTrainerAndMonPtrs(void); -static int TrainerIdToTournamentId(u16 trainerId); +static int TrainerIdToTournamentId(u16); static u16 TrainerIdOfPlayerOpponent(void); -static void Task_ShowTourneyTree(u8 taskId); -static void Task_HandleStaticTourneyTreeInput(u8 taskId); +static void Task_ShowTourneyTree(u8); +static void Task_HandleStaticTourneyTreeInput(u8); static void CB2_TourneyTree(void); static void VblankCb_TourneyInfoCard(void); -static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo); -static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId); +static void DisplayMatchInfoOnCard(u8, u8); +static void DisplayTrainerInfoOnCard(u8, u8); static int BufferDomeWinString(u8, u8*); static u8 GetDomeBrainTrainerPicId(void); static u8 GetDomeBrainTrainerClass(void); -static void CopyDomeBrainTrainerName(u8 *str); -static void CopyDomeTrainerName(u8 *str, u16 trainerId); +static void CopyDomeBrainTrainerName(u8 *); +static void CopyDomeTrainerName(u8 *, u16); static void HblankCb_TourneyTree(void); static void VblankCb_TourneyTree(void); -static u8 UpdateTourneyTreeCursor(u8 taskId); -static void DecideRoundWinners(u8 roundId); -static u8 GetOpposingNPCTournamentIdByRound(u8 tournamentId, u8); +static u8 UpdateTourneyTreeCursor(u8); +static void DecideRoundWinners(u8); +static u8 GetOpposingNPCTournamentIdByRound(u8, u8); static void DrawTourneyAdvancementLine(u8, u8); -static void SpriteCb_HorizontalScrollArrow(struct Sprite *sprite); -static void SpriteCb_VerticalScrollArrow(struct Sprite *sprite); +static void SpriteCb_HorizontalScrollArrow(struct Sprite *); +static void SpriteCb_VerticalScrollArrow(struct Sprite *); static void InitDomeChallenge(void); static void GetDomeData(void); static void SetDomeData(void); @@ -130,7 +133,6 @@ static void BufferLastDomeWinnerName(void); static void InitRandomTourneyTreeResults(void); static void InitDomeTrainers(void); -// EWRAM variables. EWRAM_DATA u32 gPlayerPartyLostHP = 0; // never read static EWRAM_DATA u32 sPlayerPartyMaxHP = 0; // never read static EWRAM_DATA struct TourneyTreeInfoCard *sInfoCard = {0}; @@ -2080,7 +2082,6 @@ static const u8 sTourneyTreeLineSectionArrayCounts[DOME_TOURNAMENT_TRAINERS_COUN {ARRAY_COUNT(sLineSectionTrainer16Round1), ARRAY_COUNT(sLineSectionTrainer16Round2), ARRAY_COUNT(sLineSectionTrainer16Semifinal), ARRAY_COUNT(sLineSectionTrainer16Final)}, }; -// code void CallBattleDomeFunction(void) { sBattleDomeFunctions[gSpecialVar_0x8004](); @@ -2592,28 +2593,33 @@ static void CreateDomeOpponentMons(u16 tournamentTrainerId) } } +// Returns a bitmask representing which 2 of the trainer's 3 pokemon to select. +// The choice is calculated solely depending on the type effectiveness of their +// movesets against the player's pokemon. +// There is a 50% chance of either a "good" or "bad" selection mode being used. +// In the good mode movesets are preferred which are more effective against the +// player, and in the bad mode the opposite is true. If all 3 pokemon tie, the +// other mode will be tried. If they tie again, the pokemon selection is random. int GetDomeTrainerSelectedMons(u16 tournamentTrainerId) { int selectedMonBits; if (Random() & 1) { - selectedMonBits = SelectOpponentMonsUsingPersonality(tournamentTrainerId, FALSE); + selectedMonBits = SelectOpponentMons_Good(tournamentTrainerId, FALSE); if (selectedMonBits == 0) - selectedMonBits = SelectOpponentMonsUsingOtId(tournamentTrainerId, TRUE); + selectedMonBits = SelectOpponentMons_Bad(tournamentTrainerId, TRUE); } else { - selectedMonBits = SelectOpponentMonsUsingOtId(tournamentTrainerId, FALSE); + selectedMonBits = SelectOpponentMons_Bad(tournamentTrainerId, FALSE); if (selectedMonBits == 0) - selectedMonBits = SelectOpponentMonsUsingPersonality(tournamentTrainerId, TRUE); + selectedMonBits = SelectOpponentMons_Good(tournamentTrainerId, TRUE); } return selectedMonBits; } -// Could probably use a better name once GetTypeEffectivenessPoints is clarified -// Personality seems to be used to select a different weighting system for type effectiveness points -static int SelectOpponentMonsUsingPersonality(u16 tournamentTrainerId, bool8 allowRandom) +static int SelectOpponentMons_Good(u16 tournamentTrainerId, bool8 allowRandom) { int i, moveId, playerMonId; int partyMovePoints[FRONTIER_PARTY_SIZE]; @@ -2628,12 +2634,12 @@ static int SelectOpponentMonsUsingPersonality(u16 tournamentTrainerId, bool8 all if (DOME_TRAINERS[tournamentTrainerId].trainerId == TRAINER_FRONTIER_BRAIN) { partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveId), - GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), MON_DATA_PERSONALITY); + GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_GOOD); } else { partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveId], - GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), MON_DATA_PERSONALITY); + GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_GOOD); } } } @@ -2641,8 +2647,8 @@ static int SelectOpponentMonsUsingPersonality(u16 tournamentTrainerId, bool8 all return SelectOpponentMonsFromParty(partyMovePoints, allowRandom); } -// See above function, identical but uses MON_DATA_OT_ID -static int SelectOpponentMonsUsingOtId(u16 tournamentTrainerId, bool8 allowRandom) +// Identical to function above, but uses EFFECTIVENESS_MODE_BAD +static int SelectOpponentMons_Bad(u16 tournamentTrainerId, bool8 allowRandom) { int i, moveId, playerMonId; int partyMovePoints[FRONTIER_PARTY_SIZE]; @@ -2657,12 +2663,12 @@ static int SelectOpponentMonsUsingOtId(u16 tournamentTrainerId, bool8 allowRando if (DOME_TRAINERS[tournamentTrainerId].trainerId == TRAINER_FRONTIER_BRAIN) { partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveId), - GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), MON_DATA_OT_ID); + GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_BAD); } else { partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveId], - GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), MON_DATA_OT_ID); + GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_BAD); } } } @@ -2735,7 +2741,7 @@ static int SelectOpponentMonsFromParty(int *partyMovePoints, bool8 allowRandom) #define TYPE_x2 40 #define TYPE_x4 80 -static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2) +static int GetTypeEffectivenessPoints(int move, int targetSpecies, int mode) { int defType1, defType2, defAbility, moveType; int i = 0; @@ -2751,11 +2757,20 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2) if (defAbility == ABILITY_LEVITATE && moveType == TYPE_GROUND) { - if (arg2 == 1) + // They likely meant to return here, as 8 is the number of points normally used in this mode for moves with no effect. + // Because there's no return the value instead gets interpreted by the switch, and the number of points becomes 0. + if (mode == EFFECTIVENESS_MODE_BAD) + { typePower = 8; + #ifdef BUGFIX + return; + #endif + } } else { + // Calculate a "type power" value to determine the benefit of using this type move against the target. + // This value will then be used to get the number of points to assign to the move. while (TYPE_EFFECT_ATK_TYPE(i) != TYPE_ENDTABLE) { if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT) @@ -2767,33 +2782,30 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2) { // BUG: the value of TYPE_x2 does not exist in gTypeEffectiveness, so if defAbility is ABILITY_WONDER_GUARD, the conditional always fails #ifndef BUGFIX - if (TYPE_EFFECT_DEF_TYPE(i) == defType1) - if ((defAbility == ABILITY_WONDER_GUARD && TYPE_EFFECT_MULTIPLIER(i) == TYPE_x2) || defAbility != ABILITY_WONDER_GUARD) - typePower = (typePower * TYPE_EFFECT_MULTIPLIER(i)) / 10; - if (TYPE_EFFECT_DEF_TYPE(i) == defType2 && defType1 != defType2) - if ((defAbility == ABILITY_WONDER_GUARD && TYPE_EFFECT_MULTIPLIER(i) == TYPE_x2) || defAbility != ABILITY_WONDER_GUARD) - typePower = (typePower * TYPE_EFFECT_MULTIPLIER(i)) / 10; + #define WONDER_GUARD_EFFECTIVENESS TYPE_x2 #else + #define WONDER_GUARD_EFFECTIVENESS TYPE_MUL_SUPER_EFFECTIVE + #endif if (TYPE_EFFECT_DEF_TYPE(i) == defType1) - if ((defAbility == ABILITY_WONDER_GUARD && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE) || defAbility != ABILITY_WONDER_GUARD) + if ((defAbility == ABILITY_WONDER_GUARD && TYPE_EFFECT_MULTIPLIER(i) == WONDER_GUARD_EFFECTIVENESS) || defAbility != ABILITY_WONDER_GUARD) typePower = (typePower * TYPE_EFFECT_MULTIPLIER(i)) / 10; if (TYPE_EFFECT_DEF_TYPE(i) == defType2 && defType1 != defType2) - if ((defAbility == ABILITY_WONDER_GUARD && TYPE_EFFECT_MULTIPLIER(i) == TYPE_MUL_SUPER_EFFECTIVE) || defAbility != ABILITY_WONDER_GUARD) + if ((defAbility == ABILITY_WONDER_GUARD && TYPE_EFFECT_MULTIPLIER(i) == WONDER_GUARD_EFFECTIVENESS) || defAbility != ABILITY_WONDER_GUARD) typePower = (typePower * TYPE_EFFECT_MULTIPLIER(i)) / 10; - #endif } i += 3; } } - switch (arg2) + switch (mode) { - case 0: + case EFFECTIVENESS_MODE_GOOD: + // Weights moves that more effective. switch (typePower) { - case TYPE_x0_50: - case TYPE_x0_25: case TYPE_x0: + case TYPE_x0_25: + case TYPE_x0_50: default: typePower = 0; break; @@ -2808,22 +2820,24 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2) break; } break; - case 1: + case EFFECTIVENESS_MODE_BAD: + // Weights moves that are less effective. + // Odd that there's no limit on this being used, even the Frontier Brain could end up using this. switch (typePower) { - default: - case TYPE_x1: - typePower = 0; + case TYPE_x0: + typePower = 8; break; case TYPE_x0_25: typePower = 4; break; - case TYPE_x0: - typePower = 8; - break; case TYPE_x0_50: typePower = 2; break; + default: + case TYPE_x1: + typePower = 0; + break; case TYPE_x2: typePower = -2; break; @@ -2832,7 +2846,9 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int arg2) break; } break; - case 2: + case EFFECTIVENESS_MODE_AI_VS_AI: + // Used as part of calculating the winner in a battle between two AIs. + // Weights moves that are more effective much more strongly in both directions. switch (typePower) { case TYPE_x0: @@ -5990,7 +6006,7 @@ static void DecideRoundWinners(u8 roundId) for (monId2 = 0; monId2 < FRONTIER_PARTY_SIZE; monId2++) { points1 += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentId1][monId1]].moves[moveSlot], - gFacilityTrainerMons[DOME_MONS[tournamentId2][monId2]].species, 2); + gFacilityTrainerMons[DOME_MONS[tournamentId2][monId2]].species, EFFECTIVENESS_MODE_AI_VS_AI); } } species = gFacilityTrainerMons[DOME_MONS[tournamentId1][monId1]].species; @@ -6013,7 +6029,7 @@ static void DecideRoundWinners(u8 roundId) for (monId2 = 0; monId2 < FRONTIER_PARTY_SIZE; monId2++) { points2 += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentId2][monId1]].moves[moveSlot], - gFacilityTrainerMons[DOME_MONS[tournamentId1][monId2]].species, 2); + gFacilityTrainerMons[DOME_MONS[tournamentId1][monId2]].species, EFFECTIVENESS_MODE_AI_VS_AI); } } species = gFacilityTrainerMons[DOME_MONS[tournamentId2][monId1]].species; diff --git a/src/battle_gfx_sfx_util.c b/src/battle_gfx_sfx_util.c index ff391b24e..d547dec0f 100644 --- a/src/battle_gfx_sfx_util.c +++ b/src/battle_gfx_sfx_util.c @@ -353,12 +353,12 @@ void SpriteCB_WaitForBattlerBallReleaseAnim(struct Sprite *sprite) } } -static void UnusedDoBattleSpriteAffineAnim(struct Sprite *sprite, bool8 arg1) +static void UnusedDoBattleSpriteAffineAnim(struct Sprite *sprite, bool8 pointless) { sprite->animPaused = TRUE; sprite->callback = SpriteCallbackDummy; - if (!arg1) + if (!pointless) StartSpriteAffineAnim(sprite, 1); else StartSpriteAffineAnim(sprite, 1); @@ -783,7 +783,7 @@ bool8 BattleLoadAllHealthBoxesGfx(u8 state) return retVal; } -void LoadBattleBarGfx(u8 arg0) +void LoadBattleBarGfx(u8 unused) { LZDecompressWram(gBattleInterfaceGfx_BattleBar, gMonSpritesGfxPtr->barFontGfx); } diff --git a/src/battle_interface.c b/src/battle_interface.c index 12d367526..dbcab4a9c 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -158,36 +158,36 @@ enum HEALTHBOX_GFX_FRAME_END_BAR, }; -static const u8 *GetHealthboxElementGfxPtr(u8 elementId); -static u8* AddTextPrinterAndCreateWindowOnHealthbox(const u8 *str, u32 x, u32 y, u32 bgColor, u32 *windowId); +static const u8 *GetHealthboxElementGfxPtr(u8); +static u8* AddTextPrinterAndCreateWindowOnHealthbox(const u8 *, u32, u32, u32, u32 *); static void RemoveWindowOnHealthbox(u32 windowId); -static void UpdateHpTextInHealthboxInDoubles(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent); -static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId); +static void UpdateHpTextInHealthboxInDoubles(u8, s16, u8); +static void UpdateStatusIconInHealthbox(u8); -static void TextIntoHealthboxObject(void *dest, u8 *windowTileData, s32 windowWidth); -static void SafariTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 windowWidth); -static void HpTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 windowWidth); -static void FillHealthboxObject(void *dest, u32 arg1, u32 arg2); +static void TextIntoHealthboxObject(void *, u8 *, s32); +static void SafariTextIntoHealthboxObject(void *, u8 *, u32); +static void HpTextIntoHealthboxObject(void *, u8 *, u32); +static void FillHealthboxObject(void *, u32, u32); -static void Task_HidePartyStatusSummary_BattleStart_1(u8 taskId); -static void Task_HidePartyStatusSummary_BattleStart_2(u8 taskId); -static void Task_HidePartyStatusSummary_DuringBattle(u8 taskId); +static void Task_HidePartyStatusSummary_BattleStart_1(u8); +static void Task_HidePartyStatusSummary_BattleStart_2(u8); +static void Task_HidePartyStatusSummary_DuringBattle(u8); -static void SpriteCB_HealthBoxOther(struct Sprite *sprite); -static void SpriteCB_HealthBar(struct Sprite *sprite); -static void SpriteCB_StatusSummaryBar_Enter(struct Sprite *sprite); -static void SpriteCB_StatusSummaryBar_Exit(struct Sprite *sprite); -static void SpriteCB_StatusSummaryBalls_Enter(struct Sprite *sprite); -static void SpriteCB_StatusSummaryBalls_Exit(struct Sprite *sprite); -static void SpriteCB_StatusSummaryBalls_OnSwitchout(struct Sprite *sprite); +static void SpriteCB_HealthBoxOther(struct Sprite *); +static void SpriteCB_HealthBar(struct Sprite *); +static void SpriteCB_StatusSummaryBar_Enter(struct Sprite *); +static void SpriteCB_StatusSummaryBar_Exit(struct Sprite *); +static void SpriteCB_StatusSummaryBalls_Enter(struct Sprite *); +static void SpriteCB_StatusSummaryBalls_Exit(struct Sprite *); +static void SpriteCB_StatusSummaryBalls_OnSwitchout(struct Sprite *); -static u8 GetStatusIconForBattlerId(u8 statusElementId, u8 battlerId); -static s32 CalcNewBarValue(s32 maxValue, s32 currValue, s32 receivedValue, s32 *arg3, u8 arg4, u16 arg5); -static u8 GetScaledExpFraction(s32 currValue, s32 receivedValue, s32 maxValue, u8 scale); -static void MoveBattleBarGraphically(u8 battlerId, u8 whichBar); -static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32 *currValue, u8 *arg4, u8 scale); -static void Debug_TestHealthBar_Helper(struct TestingBar *barInfo, s32 *arg1, u16 *arg2); +static u8 GetStatusIconForBattlerId(u8, u8); +static s32 CalcNewBarValue(s32, s32, s32, s32 *, u8, u16); +static u8 GetScaledExpFraction(s32, s32, s32, u8); +static void MoveBattleBarGraphically(u8, u8); +static u8 CalcBarFilledPixels(s32, s32, s32, s32 *, u8 *, u8); +static void Debug_TestHealthBar_Helper(struct TestingBar *, s32 *, u16 *); static const struct OamData sOamData_64x32 = { @@ -814,11 +814,11 @@ static void Debug_DrawNumber(s16 number, u16 *dest, bool8 unk) } // Unused -static void Debug_DrawNumberPair(s16 number1, s16 number2, u16 *arg2) +static void Debug_DrawNumberPair(s16 number1, s16 number2, u16 *dest) { - arg2[4] = 0x1E; - Debug_DrawNumber(number2, arg2, FALSE); - Debug_DrawNumber(number1, arg2 + 5, TRUE); + dest[4] = 0x1E; + Debug_DrawNumber(number2, dest, FALSE); + Debug_DrawNumber(number1, dest + 5, TRUE); } // Because the healthbox is too large to fit into one sprite, it is divided into two sprites. @@ -1420,7 +1420,7 @@ void SwapHpBarsWithHpText(void) #define tIsBattleStart data[10] #define tBlend data[15] -u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, u8 arg2, bool8 isBattleStart) +u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, bool8 skipPlayer, bool8 isBattleStart) { bool8 isOpponent; s16 bar_X, bar_Y, bar_pos2_X, bar_data0; @@ -1429,7 +1429,7 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, u8 ballIconSpritesIds[PARTY_SIZE]; u8 taskId; - if (!arg2 || GetBattlerPosition(battlerId) != B_POSITION_OPPONENT_RIGHT) + if (!skipPlayer || GetBattlerPosition(battlerId) != B_POSITION_OPPONENT_RIGHT) { if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) { @@ -1442,7 +1442,7 @@ u8 CreatePartyStatusSummarySprites(u8 battlerId, struct HpAndStatus *partyInfo, { isOpponent = TRUE; - if (!arg2 || !IsDoubleBattle()) + if (!skipPlayer || !IsDoubleBattle()) bar_X = 104, bar_Y = 40; else bar_X = 104, bar_Y = 16; @@ -2383,7 +2383,7 @@ static s32 CalcNewBarValue(s32 maxValue, s32 oldValue, s32 receivedValue, s32 *c return ret; } -static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32 *currValue, u8 *arg4, u8 scale) +static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32 *currValue, u8 *pixelsArray, u8 scale) { u8 pixels, filledPixels, totalPixels; u8 i; @@ -2397,7 +2397,7 @@ static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32 totalPixels = scale * 8; for (i = 0; i < scale; i++) - arg4[i] = 0; + pixelsArray[i] = 0; if (maxValue < totalPixels) pixels = (*currValue * totalPixels / maxValue) >> 8; @@ -2408,7 +2408,7 @@ static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32 if (filledPixels == 0 && newValue > 0) { - arg4[0] = 1; + pixelsArray[0] = 1; filledPixels = 1; } else @@ -2417,11 +2417,11 @@ static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32 { if (pixels >= 8) { - arg4[i] = 8; + pixelsArray[i] = 8; } else { - arg4[i] = pixels; + pixelsArray[i] = pixels; break; } pixels -= 8; @@ -2433,7 +2433,7 @@ static u8 CalcBarFilledPixels(s32 maxValue, s32 oldValue, s32 receivedValue, s32 // Unused // These two functions seem as if they were made for testing the health bar. -static s16 Debug_TestHealthBar(struct TestingBar *barInfo, s32 *currValue, u16 *arg2, s32 arg3) +static s16 Debug_TestHealthBar(struct TestingBar *barInfo, s32 *currValue, u16 *dest, s32 unused) { s16 ret, var; @@ -2441,31 +2441,31 @@ static s16 Debug_TestHealthBar(struct TestingBar *barInfo, s32 *currValue, u16 * barInfo->oldValue, barInfo->receivedValue, currValue, B_HEALTHBAR_PIXELS / 8, 1); - Debug_TestHealthBar_Helper(barInfo, currValue, arg2); + Debug_TestHealthBar_Helper(barInfo, currValue, dest); if (barInfo->maxValue < B_HEALTHBAR_PIXELS) var = *currValue >> 8; else var = *currValue; - DummiedOutFunction(barInfo->maxValue, var, arg3); + DummiedOutFunction(barInfo->maxValue, var, unused); return ret; } -static void Debug_TestHealthBar_Helper(struct TestingBar *barInfo, s32 *currValue, u16 *arg2) +static void Debug_TestHealthBar_Helper(struct TestingBar *barInfo, s32 *currValue, u16 *dest) { - u8 sp8[6]; - u16 sp10[6]; + u8 pixels[6]; + u16 src[6]; u8 i; CalcBarFilledPixels(barInfo->maxValue, barInfo->oldValue, - barInfo->receivedValue, currValue, sp8, B_HEALTHBAR_PIXELS / 8); + barInfo->receivedValue, currValue, pixels, B_HEALTHBAR_PIXELS / 8); for (i = 0; i < 6; i++) - sp10[i] = (barInfo->unkC_0 << 12) | (barInfo->unk10 + sp8[i]); + src[i] = (barInfo->unkC_0 << 12) | (barInfo->unk10 + pixels[i]); - CpuCopy16(sp10, arg2, sizeof(sp10)); + CpuCopy16(src, dest, sizeof(src)); } static u8 GetScaledExpFraction(s32 oldValue, s32 receivedValue, s32 maxValue, u8 scale) @@ -2546,9 +2546,9 @@ static void RemoveWindowOnHealthbox(u32 windowId) RemoveWindow(windowId); } -static void FillHealthboxObject(void *dest, u32 arg1, u32 arg2) +static void FillHealthboxObject(void *dest, u32 valMult, u32 numTiles) { - CpuFill32(0x11111111 * arg1, dest, arg2 * TILE_SIZE_4BPP); + CpuFill32(0x11111111 * valMult, dest, numTiles * TILE_SIZE_4BPP); } static void HpTextIntoHealthboxObject(void *dest, u8 *windowTileData, u32 windowWidth) diff --git a/src/battle_message.c b/src/battle_message.c index 9d1b88ba7..2776c952b 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -1035,7 +1035,7 @@ const u16 gFirstTurnOfTwoStringIds[] = }; // Index copied from move's index in gTrappingMoves -const u16 gWrappedStringIds[] = +const u16 gWrappedStringIds[NUM_TRAPPING_MOVES] = { STRINGID_PKMNSQUEEZEDBYBIND, // MOVE_BIND STRINGID_PKMNWRAPPEDBY, // MOVE_WRAP @@ -1253,7 +1253,7 @@ const u16 gCaughtMonStringIds[] = [B_MSG_LANETTES_BOX_FULL] = STRINGID_PKMNBOXLANETTESPCFULL, }; -const u16 gTrappingMoves[] = +const u16 gTrappingMoves[NUM_TRAPPING_MOVES + 1] = { MOVE_BIND, MOVE_WRAP, @@ -1261,7 +1261,7 @@ const u16 gTrappingMoves[] = MOVE_CLAMP, MOVE_WHIRLPOOL, MOVE_SAND_TOMB, - 0xFFFF + 0xFFFF // Never read }; const u8 gText_PkmnIsEvolving[] = _("What?\n{STR_VAR_1} is evolving!"); diff --git a/src/battle_pyramid.c b/src/battle_pyramid.c index 9039f60f2..b0bcdfd5e 100644 --- a/src/battle_pyramid.c +++ b/src/battle_pyramid.c @@ -83,18 +83,18 @@ static void ClearPyramidPartyHeldItems(void); static void SetPyramidFloorPalette(void); static void BattlePyramidStartMenu(void); static void RestorePyramidPlayerParty(void); -static void InitPyramidBagItems(u8 lvlMode); +static void InitPyramidBagItems(u8); static u8 GetPyramidFloorTemplateId(void); static u8 GetPostBattleDirectionHintTextIndex(int *, u8, u8); -static void Task_SetPyramidFloorPalette(u8 taskId); -static void MarkPyramidTrainerAsBattled(u16 trainerId); -static void GetPyramidFloorLayoutOffsets(u8 *layoutOffsets); +static void Task_SetPyramidFloorPalette(u8); +static void MarkPyramidTrainerAsBattled(u16); +static void GetPyramidFloorLayoutOffsets(u8 *); static void GetPyramidEntranceAndExitSquareIds(u8 *, u8 *); static void SetPyramidObjectPositionsUniformly(u8); static bool8 SetPyramidObjectPositionsInAndNearSquare(u8, u8); static bool8 SetPyramidObjectPositionsNearSquare(u8, u8); -static bool8 TrySetPyramidObjectEventPositionInSquare(u8 arg0, u8 *floorLayoutOffsets, u8 squareId, u8 objectEventId); -static bool8 TrySetPyramidObjectEventPositionAtCoords(bool8 objType, u8 x, u8 y, u8 *floorLayoutOffsets, u8 squareId, u8 objectEventId); +static bool8 TrySetPyramidObjectEventPositionInSquare(u8, u8 *, u8, u8); +static bool8 TrySetPyramidObjectEventPositionAtCoords(bool8, u8, u8, u8 *, u8, u8); // Const rom data. #define ABILITY_RANDOM 2 // For wild mons data. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 3c8bbfdee..4f31f0f01 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2596,7 +2596,7 @@ void SetMoveEffect(bool8 primary, u8 certain) for (gBattleCommunication[MULTISTRING_CHOOSER] = 0; ; gBattleCommunication[MULTISTRING_CHOOSER]++) { - if (gBattleCommunication[MULTISTRING_CHOOSER] > 4) + if (gBattleCommunication[MULTISTRING_CHOOSER] >= NUM_TRAPPING_MOVES - 1) break; if (gTrappingMoves[gBattleCommunication[MULTISTRING_CHOOSER]] == gCurrentMove) break; diff --git a/src/berry_blender.c b/src/berry_blender.c index 9b74c7bab..bdf7858ce 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -2238,7 +2238,7 @@ static void CB2_PlayBlender(void) UpdatePaletteFade(); } -static void Blender_DummiedOutFunc(s16 a0, s16 a1) +static void Blender_DummiedOutFunc(s16 bgX, s16 bgY) { } diff --git a/src/contest.c b/src/contest.c index 091d7fb63..da57d9e28 100644 --- a/src/contest.c +++ b/src/contest.c @@ -93,7 +93,7 @@ static void Task_ContestReturnToField(u8); static void FieldCB_ContestReturnToField(void); static bool8 IsPlayerLinkLeader(void); static void PrintContestantTrainerName(u8); -static void PrintContestantTrainerNameWithColor(u8 a0, u8 a1); +static void PrintContestantTrainerNameWithColor(u8, u8); static void PrintContestantMonName(u8); static void PrintContestantMonNameWithColor(u8, u8); static u8 CreateJudgeSprite(void); @@ -3186,14 +3186,14 @@ static u16 GetMoveEffectSymbolTileOffset(u16 move, u8 contestant) return offset; } -static void PrintContestMoveDescription(u16 a) +static void PrintContestMoveDescription(u16 move) { u8 category; u16 categoryTile; u8 numHearts; // The contest category icon is implemented as a 5x2 group of tiles. - category = gContestMoves[a].contestCategory; + category = gContestMoves[move].contestCategory; if (category == CONTEST_CATEGORY_COOL) categoryTile = 0x4040; else if (category == CONTEST_CATEGORY_BEAUTY) @@ -3209,27 +3209,27 @@ static void PrintContestMoveDescription(u16 a) ContestBG_FillBoxWithIncrementingTile(0, categoryTile + 0x10, 0x0b, 0x20, 0x05, 0x01, 0x11, 0x01); // Appeal hearts - if (gContestEffects[gContestMoves[a].effect].appeal == 0xFF) + if (gContestEffects[gContestMoves[move].effect].appeal == 0xFF) numHearts = 0; else - numHearts = gContestEffects[gContestMoves[a].effect].appeal / 10; + numHearts = gContestEffects[gContestMoves[move].effect].appeal / 10; if (numHearts > MAX_CONTEST_MOVE_HEARTS) numHearts = MAX_CONTEST_MOVE_HEARTS; ContestBG_FillBoxWithTile(0, TILE_EMPTY_APPEAL_HEART, 0x15, 0x1f, MAX_CONTEST_MOVE_HEARTS, 0x01, 0x11); ContestBG_FillBoxWithTile(0, TILE_FILLED_APPEAL_HEART, 0x15, 0x1f, numHearts, 0x01, 0x11); // Jam hearts - if (gContestEffects[gContestMoves[a].effect].jam == 0xFF) + if (gContestEffects[gContestMoves[move].effect].jam == 0xFF) numHearts = 0; else - numHearts = gContestEffects[gContestMoves[a].effect].jam / 10; + numHearts = gContestEffects[gContestMoves[move].effect].jam / 10; if (numHearts > MAX_CONTEST_MOVE_HEARTS) numHearts = MAX_CONTEST_MOVE_HEARTS; ContestBG_FillBoxWithTile(0, TILE_EMPTY_JAM_HEART, 0x15, 0x20, MAX_CONTEST_MOVE_HEARTS, 0x01, 0x11); ContestBG_FillBoxWithTile(0, TILE_FILLED_JAM_HEART, 0x15, 0x20, numHearts, 0x01, 0x11); FillWindowPixelBuffer(WIN_MOVE_DESCRIPTION, PIXEL_FILL(0)); - Contest_PrintTextToBg0WindowStd(WIN_MOVE_DESCRIPTION, gContestEffectDescriptionPointers[gContestMoves[a].effect]); + Contest_PrintTextToBg0WindowStd(WIN_MOVE_DESCRIPTION, gContestEffectDescriptionPointers[gContestMoves[move].effect]); Contest_PrintTextToBg0WindowStd(WIN_SLASH, gText_Slash); } @@ -4537,14 +4537,14 @@ static void CalculateAppealMoveImpact(u8 contestant) eContestantStatus[contestant].contestantAnimTarget = i; } -void SetContestantEffectStringID(u8 a, u8 b) +void SetContestantEffectStringID(u8 contestant, u8 effectStringId) { - eContestantStatus[a].effectStringId = b; + eContestantStatus[contestant].effectStringId = effectStringId; } -void SetContestantEffectStringID2(u8 a, u8 b) +void SetContestantEffectStringID2(u8 contestant, u8 effectStringId) { - eContestantStatus[a].effectStringId2 = b; + eContestantStatus[contestant].effectStringId2 = effectStringId; } void SetStartledString(u8 contestant, u8 jam) diff --git a/src/credits.c b/src/credits.c index 43c8d6628..33362fb38 100644 --- a/src/credits.c +++ b/src/credits.c @@ -1285,18 +1285,18 @@ static void ResetCreditsTasks(u8 taskId) gIntroCredits_MovingSceneryState = INTROCRED_SCENERY_DESTROY; } -static void LoadTheEndScreen(u16 arg0, u16 arg1, u16 palOffset) +static void LoadTheEndScreen(u16 tileOffsetLoad, u16 tileOffsetWrite, u16 palOffset) { u16 baseTile; u16 i; - LZ77UnCompVram(sCreditsCopyrightEnd_Gfx, (void *)(VRAM + arg0)); + LZ77UnCompVram(sCreditsCopyrightEnd_Gfx, (void *)(VRAM + tileOffsetLoad)); LoadPalette(gIntroCopyright_Pal, palOffset, sizeof(gIntroCopyright_Pal)); baseTile = (palOffset / 16) << 12; for (i = 0; i < 32 * 32; i++) - ((u16 *) (VRAM + arg1))[i] = baseTile + 1; + ((u16 *) (VRAM + tileOffsetWrite))[i] = baseTile + 1; } static u16 GetLetterMapTile(u8 baseTiles) diff --git a/src/decompress.c b/src/decompress.c index b74d4e814..92c840a63 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -51,13 +51,13 @@ void LoadCompressedSpritePalette(const struct CompressedSpritePalette *src) LoadSpritePalette(&dest); } -void LoadCompressedSpritePaletteOverrideBuffer(const struct CompressedSpritePalette *a, void *buffer) +void LoadCompressedSpritePaletteOverrideBuffer(const struct CompressedSpritePalette *src, void *buffer) { struct SpritePalette dest; - LZ77UnCompWram(a->data, buffer); + LZ77UnCompWram(src->data, buffer); dest.data = buffer; - dest.tag = a->tag; + dest.tag = src->tag; LoadSpritePalette(&dest); } diff --git a/src/dodrio_berry_picking.c b/src/dodrio_berry_picking.c index 80cdd8126..b87fe3092 100644 --- a/src/dodrio_berry_picking.c +++ b/src/dodrio_berry_picking.c @@ -2879,10 +2879,10 @@ static u8 TryGivePrize(void) return PRIZE_RECEIVED; } -static u32 IncrementWithLimit(u32 a, u32 max) +static u32 IncrementWithLimit(u32 num, u32 max) { - if (a < max) - return a + 1; + if (num < max) + return num + 1; else return max; } diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 091293551..90e713e63 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -164,7 +164,7 @@ static void CreateLevitateMovementTask(struct ObjectEvent *); static void DestroyLevitateMovementTask(u8); static bool8 NpcTakeStep(struct Sprite *); static bool8 IsElevationMismatchAt(u8, s16, s16); -static bool8 AreElevationsCompatible(u8 a, u8 b); +static bool8 AreElevationsCompatible(u8, u8); static const struct SpriteFrameImage sPicTable_PechaBerryTree[]; @@ -7837,7 +7837,7 @@ void GroundEffect_FlowingWater(struct ObjectEvent *objEvent, struct Sprite *spri StartFieldEffectForObjectEvent(FLDEFF_FEET_IN_FLOWING_WATER, objEvent); } -static void (*const sGroundEffectTracksFuncs[])(struct ObjectEvent *objEvent, struct Sprite *sprite, u8 a) = { +static void (*const sGroundEffectTracksFuncs[])(struct ObjectEvent *objEvent, struct Sprite *sprite, bool8 isDeepSand) = { [TRACKS_NONE] = DoTracksGroundEffect_None, [TRACKS_FOOT] = DoTracksGroundEffect_Footprints, [TRACKS_BIKE_TIRE] = DoTracksGroundEffect_BikeTireTracks, @@ -7846,20 +7846,20 @@ static void (*const sGroundEffectTracksFuncs[])(struct ObjectEvent *objEvent, st void GroundEffect_SandTracks(struct ObjectEvent *objEvent, struct Sprite *sprite) { const struct ObjectEventGraphicsInfo *info = GetObjectEventGraphicsInfo(objEvent->graphicsId); - sGroundEffectTracksFuncs[info->tracks](objEvent, sprite, 0); + sGroundEffectTracksFuncs[info->tracks](objEvent, sprite, FALSE); } void GroundEffect_DeepSandTracks(struct ObjectEvent *objEvent, struct Sprite *sprite) { const struct ObjectEventGraphicsInfo *info = GetObjectEventGraphicsInfo(objEvent->graphicsId); - sGroundEffectTracksFuncs[info->tracks](objEvent, sprite, 1); + sGroundEffectTracksFuncs[info->tracks](objEvent, sprite, TRUE); } -static void DoTracksGroundEffect_None(struct ObjectEvent *objEvent, struct Sprite *sprite, u8 a) +static void DoTracksGroundEffect_None(struct ObjectEvent *objEvent, struct Sprite *sprite, bool8 isDeepSand) { } -static void DoTracksGroundEffect_Footprints(struct ObjectEvent *objEvent, struct Sprite *sprite, u8 a) +static void DoTracksGroundEffect_Footprints(struct ObjectEvent *objEvent, struct Sprite *sprite, bool8 isDeepSand) { // First half-word is a Field Effect script id. (gFieldEffectScriptPointers) u16 sandFootprints_FieldEffectData[2] = { @@ -7872,10 +7872,10 @@ static void DoTracksGroundEffect_Footprints(struct ObjectEvent *objEvent, struct gFieldEffectArguments[2] = 149; gFieldEffectArguments[3] = 2; gFieldEffectArguments[4] = objEvent->facingDirection; - FieldEffectStart(sandFootprints_FieldEffectData[a]); + FieldEffectStart(sandFootprints_FieldEffectData[isDeepSand]); } -static void DoTracksGroundEffect_BikeTireTracks(struct ObjectEvent *objEvent, struct Sprite *sprite, u8 a) +static void DoTracksGroundEffect_BikeTireTracks(struct ObjectEvent *objEvent, struct Sprite *sprite, bool8 isDeepSand) { // Specifies which bike track shape to show next. // For example, when the bike turns from up to right, it will show diff --git a/src/evolution_graphics.c b/src/evolution_graphics.c index 5d17cca84..a6b558195 100644 --- a/src/evolution_graphics.c +++ b/src/evolution_graphics.c @@ -92,11 +92,22 @@ static const struct SpriteTemplate sEvoSparkleSpriteTemplate = .callback = SpriteCB_Sparkle_Dummy }; -static const s16 sEvoSparkleMatrices[] = +static const u16 sEvoSparkleMatrices[] = { - 0x3C0, 0x380, 0x340, 0x300, 0x2C0, 0x280, 0x240, 0x200, 0x1C0, - 0x180, 0x140, 0x100, -4, 0x10, -3, 0x30, -2, 0x50, - -1, 0x70, 0x1, 0x70, 0x2, 0x50, 0x3, 0x30, 0x4, 0x10 + 0x3C0, 0x380, 0x340, 0x300, 0x2C0, 0x280, + 0x240, 0x200, 0x1C0, 0x180, 0x140, 0x100 +}; + +static const s16 sUnused[] = +{ + -4, 0x10, + -3, 0x30, + -2, 0x50, + -1, 0x70, + 1, 0x70, + 2, 0x50, + 3, 0x30, + 4, 0x10 }; static void SpriteCB_Sparkle_Dummy(struct Sprite *sprite) @@ -107,30 +118,33 @@ static void SpriteCB_Sparkle_Dummy(struct Sprite *sprite) static void SetEvoSparklesMatrices(void) { u16 i; - for (i = 0; i < 12; i++) - { + for (i = 0; i < ARRAY_COUNT(sEvoSparkleMatrices); i++) SetOamMatrix(20 + i, sEvoSparkleMatrices[i], 0, 0, sEvoSparkleMatrices[i]); - } } +#define sSpeed data[3] +#define sAmplitude data[5] +#define sTrigIdx data[6] +#define sTimer data[7] + static void SpriteCB_Sparkle_SpiralUpward(struct Sprite* sprite) { if (sprite->y > 8) { u8 matrixNum; - sprite->y = 88 - (sprite->data[7] * sprite->data[7]) / 80; - sprite->y2 = Sin((u8)(sprite->data[6]), sprite->data[5]) / 4; - sprite->x2 = Cos((u8)(sprite->data[6]), sprite->data[5]); - sprite->data[6] += 4; - if (sprite->data[7] & 1) - sprite->data[5]--; - sprite->data[7]++; + sprite->y = 88 - (sprite->sTimer * sprite->sTimer) / 80; + sprite->y2 = Sin((u8)sprite->sTrigIdx, sprite->sAmplitude) / 4; + sprite->x2 = Cos((u8)sprite->sTrigIdx, sprite->sAmplitude); + sprite->sTrigIdx += 4; + if (sprite->sTimer & 1) + sprite->sAmplitude--; + sprite->sTimer++; if (sprite->y2 > 0) sprite->subpriority = 1; else sprite->subpriority = 20; - matrixNum = sprite->data[5] / 4 + 20; + matrixNum = sprite->sAmplitude / 4 + 20; if (matrixNum > 31) matrixNum = 31; sprite->oam.matrixNum = matrixNum; @@ -139,17 +153,17 @@ static void SpriteCB_Sparkle_SpiralUpward(struct Sprite* sprite) DestroySprite(sprite); } -static void CreateSparkle_SpiralUpward(u8 arg0) +static void CreateSparkle_SpiralUpward(u8 trigIdx) { - u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 88, 0); - if (spriteID != MAX_SPRITES) + u8 spriteId = CreateSprite(&sEvoSparkleSpriteTemplate, DISPLAY_WIDTH / 2, 88, 0); + if (spriteId != MAX_SPRITES) { - gSprites[spriteID].data[5] = 48; - gSprites[spriteID].data[6] = arg0; - gSprites[spriteID].data[7] = 0; - gSprites[spriteID].oam.affineMode = ST_OAM_AFFINE_NORMAL; - gSprites[spriteID].oam.matrixNum = 31; - gSprites[spriteID].callback = SpriteCB_Sparkle_SpiralUpward; + gSprites[spriteId].sAmplitude = 48; + gSprites[spriteId].sTrigIdx = trigIdx; + gSprites[spriteId].sTimer = 0; + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.matrixNum = 31; + gSprites[spriteId].callback = SpriteCB_Sparkle_SpiralUpward; } } @@ -157,85 +171,85 @@ static void SpriteCB_Sparkle_ArcDown(struct Sprite* sprite) { if (sprite->y < 88) { - sprite->y = 8 + (sprite->data[7] * sprite->data[7]) / 5; - sprite->y2 = Sin((u8)(sprite->data[6]), sprite->data[5]) / 4; - sprite->x2 = Cos((u8)(sprite->data[6]), sprite->data[5]); - sprite->data[5] = 8 + Sin((u8)(sprite->data[7] * 4), 40); - sprite->data[7]++; + sprite->y = 8 + (sprite->sTimer * sprite->sTimer) / 5; + sprite->y2 = Sin((u8)sprite->sTrigIdx, sprite->sAmplitude) / 4; + sprite->x2 = Cos((u8)sprite->sTrigIdx, sprite->sAmplitude); + sprite->sAmplitude = 8 + Sin((u8)(sprite->sTimer * 4), 40); + sprite->sTimer++; } else DestroySprite(sprite); } -static void CreateSparkle_ArcDown(u8 arg0) +static void CreateSparkle_ArcDown(u8 trigIdx) { - u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 8, 0); - if (spriteID != MAX_SPRITES) + u8 spriteId = CreateSprite(&sEvoSparkleSpriteTemplate, DISPLAY_WIDTH / 2, 8, 0); + if (spriteId != MAX_SPRITES) { - gSprites[spriteID].data[5] = 8; - gSprites[spriteID].data[6] = arg0; - gSprites[spriteID].data[7] = 0; - gSprites[spriteID].oam.affineMode = ST_OAM_AFFINE_NORMAL; - gSprites[spriteID].oam.matrixNum = 25; - gSprites[spriteID].subpriority = 1; - gSprites[spriteID].callback = SpriteCB_Sparkle_ArcDown; + gSprites[spriteId].sAmplitude = 8; + gSprites[spriteId].sTrigIdx = trigIdx; + gSprites[spriteId].sTimer = 0; + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.matrixNum = 25; + gSprites[spriteId].subpriority = 1; + gSprites[spriteId].callback = SpriteCB_Sparkle_ArcDown; } } static void SpriteCB_Sparkle_CircleInward(struct Sprite* sprite) { - if (sprite->data[5] > 8) + if (sprite->sAmplitude > 8) { - sprite->y2 = Sin((u8)(sprite->data[6]), sprite->data[5]); - sprite->x2 = Cos((u8)(sprite->data[6]), sprite->data[5]); - sprite->data[5] -= sprite->data[3]; - sprite->data[6] += 4; + sprite->y2 = Sin((u8)sprite->sTrigIdx, sprite->sAmplitude); + sprite->x2 = Cos((u8)sprite->sTrigIdx, sprite->sAmplitude); + sprite->sAmplitude -= sprite->sSpeed; + sprite->sTrigIdx += 4; } else DestroySprite(sprite); } -static void CreateSparkle_CircleInward(u8 arg0, u8 arg1) +static void CreateSparkle_CircleInward(u8 trigIdx, u8 speed) { - u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 56, 0); - if (spriteID != MAX_SPRITES) + u8 spriteId = CreateSprite(&sEvoSparkleSpriteTemplate, DISPLAY_WIDTH / 2, 56, 0); + if (spriteId != MAX_SPRITES) { - gSprites[spriteID].data[3] = arg1; - gSprites[spriteID].data[5] = 120; - gSprites[spriteID].data[6] = arg0; - gSprites[spriteID].data[7] = 0; - gSprites[spriteID].oam.affineMode = ST_OAM_AFFINE_NORMAL; - gSprites[spriteID].oam.matrixNum = 31; - gSprites[spriteID].subpriority = 1; - gSprites[spriteID].callback = SpriteCB_Sparkle_CircleInward; + gSprites[spriteId].sSpeed = speed; + gSprites[spriteId].sAmplitude = 120; + gSprites[spriteId].sTrigIdx = trigIdx; + gSprites[spriteId].sTimer = 0; + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.matrixNum = 31; + gSprites[spriteId].subpriority = 1; + gSprites[spriteId].callback = SpriteCB_Sparkle_CircleInward; } } static void SpriteCB_Sparkle_Spray(struct Sprite* sprite) { - if (!(sprite->data[7] & 3)) + if (!(sprite->sTimer & 3)) sprite->y++; - if (sprite->data[6] < 128) + if (sprite->sTrigIdx < 128) { u8 matrixNum; - sprite->y2 = -Sin((u8)(sprite->data[6]), sprite->data[5]); - sprite->x = 120 + (sprite->data[3] * sprite->data[7]) / 3; - sprite->data[6]++; - matrixNum = 31 - (sprite->data[6] * 12 / 128); - if (sprite->data[6] > 64) + sprite->y2 = -Sin((u8)sprite->sTrigIdx, sprite->sAmplitude); + sprite->x = (DISPLAY_WIDTH / 2) + (sprite->sSpeed * sprite->sTimer) / 3; + sprite->sTrigIdx++; + matrixNum = 31 - (sprite->sTrigIdx * 12 / 128); + if (sprite->sTrigIdx > 64) sprite->subpriority = 1; else { sprite->invisible = FALSE; sprite->subpriority = 20; - if (sprite->data[6] > 112 && sprite->data[6] & 1) + if (sprite->sTrigIdx > 112 && sprite->sTrigIdx & 1) sprite->invisible = TRUE; } if (matrixNum < 20) matrixNum = 20; sprite->oam.matrixNum = matrixNum; - sprite->data[7]++; + sprite->sTimer++; } else DestroySprite(sprite); @@ -243,16 +257,16 @@ static void SpriteCB_Sparkle_Spray(struct Sprite* sprite) static void CreateSparkle_Spray(u8 id) { - u8 spriteID = CreateSprite(&sEvoSparkleSpriteTemplate, 120, 56, 0); - if (spriteID != MAX_SPRITES) + u8 spriteId = CreateSprite(&sEvoSparkleSpriteTemplate, DISPLAY_WIDTH / 2, 56, 0); + if (spriteId != MAX_SPRITES) { - gSprites[spriteID].data[3] = 3 - (Random() % 7); - gSprites[spriteID].data[5] = 48 + (Random() & 0x3F); - gSprites[spriteID].data[7] = 0; - gSprites[spriteID].oam.affineMode = ST_OAM_AFFINE_NORMAL; - gSprites[spriteID].oam.matrixNum = 31; - gSprites[spriteID].subpriority = 20; - gSprites[spriteID].callback = SpriteCB_Sparkle_Spray; + gSprites[spriteId].sSpeed = 3 - (Random() % 7); + gSprites[spriteId].sAmplitude = 48 + (Random() & 0x3F); + gSprites[spriteId].sTimer = 0; + gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; + gSprites[spriteId].oam.matrixNum = 31; + gSprites[spriteId].subpriority = 20; + gSprites[spriteId].callback = SpriteCB_Sparkle_Spray; } } @@ -289,7 +303,7 @@ static void Task_Sparkles_SpiralUpward(u8 taskId) { u8 i; for (i = 0; i < 4; i++) - CreateSparkle_SpiralUpward((0x78 & gTasks[taskId].tTimer) * 2 + i * 64); + CreateSparkle_SpiralUpward((gTasks[taskId].tTimer & 120) * 2 + i * 64); } gTasks[taskId].tTimer++; } diff --git a/src/field_camera.c b/src/field_camera.c index ae7b2bbb1..95c7ed952 100644 --- a/src/field_camera.c +++ b/src/field_camera.c @@ -437,10 +437,10 @@ void SetCameraPanningCallback(void (*callback)(void)) sFieldCameraPanningCallback = callback; } -void SetCameraPanning(s16 a, s16 b) +void SetCameraPanning(s16 horizontal, s16 vertical) { - sHorizontalCameraPan = a; - sVerticalCameraPan = b + 32; + sHorizontalCameraPan = horizontal; + sVerticalCameraPan = vertical + 32; } void InstallCameraPanAheadCallback(void) diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 964a62187..b374e132d 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -79,13 +79,13 @@ static bool8 TryPushBoulder(s16, s16, u8); static void CheckAcroBikeCollision(s16, s16, u8, u8 *); static void DoPlayerAvatarTransition(void); -static void PlayerAvatarTransition_Dummy(struct ObjectEvent *a); -static void PlayerAvatarTransition_Normal(struct ObjectEvent *a); -static void PlayerAvatarTransition_MachBike(struct ObjectEvent *a); -static void PlayerAvatarTransition_AcroBike(struct ObjectEvent *a); -static void PlayerAvatarTransition_Surfing(struct ObjectEvent *a); -static void PlayerAvatarTransition_Underwater(struct ObjectEvent *a); -static void PlayerAvatarTransition_ReturnToField(struct ObjectEvent *a); +static void PlayerAvatarTransition_Dummy(struct ObjectEvent *); +static void PlayerAvatarTransition_Normal(struct ObjectEvent *); +static void PlayerAvatarTransition_MachBike(struct ObjectEvent *); +static void PlayerAvatarTransition_AcroBike(struct ObjectEvent *); +static void PlayerAvatarTransition_Surfing(struct ObjectEvent *); +static void PlayerAvatarTransition_Underwater(struct ObjectEvent *); +static void PlayerAvatarTransition_ReturnToField(struct ObjectEvent *); static bool8 PlayerAnimIsMultiFrameStationary(void); static bool8 PlayerAnimIsMultiFrameStationaryAndStateNotTurning(void); @@ -96,51 +96,51 @@ static void PlayerRun(u8); static void PlayerNotOnBikeCollide(u8); static void PlayerNotOnBikeCollideWithFarawayIslandMew(u8); -static void PlayCollisionSoundIfNotFacingWarp(u8 a); +static void PlayCollisionSoundIfNotFacingWarp(u8); static void HideShowWarpArrow(struct ObjectEvent *); static void StartStrengthAnim(u8, u8); -static void Task_PushBoulder(u8 taskId); -static bool8 PushBoulder_Start(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject); -static bool8 PushBoulder_Move(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject); -static bool8 PushBoulder_End(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject); +static void Task_PushBoulder(u8); +static bool8 PushBoulder_Start(struct Task *, struct ObjectEvent *, struct ObjectEvent *); +static bool8 PushBoulder_Move(struct Task *, struct ObjectEvent *, struct ObjectEvent *); +static bool8 PushBoulder_End(struct Task *, struct ObjectEvent *, struct ObjectEvent *); static void DoPlayerMatJump(void); -static void DoPlayerAvatarSecretBaseMatJump(u8 taskId); -static u8 PlayerAvatar_DoSecretBaseMatJump(struct Task *task, struct ObjectEvent *objectEvent); +static void DoPlayerAvatarSecretBaseMatJump(u8); +static u8 PlayerAvatar_DoSecretBaseMatJump(struct Task *, struct ObjectEvent *); static void DoPlayerMatSpin(void); -static void PlayerAvatar_DoSecretBaseMatSpin(u8 taskId); -static bool8 PlayerAvatar_SecretBaseMatSpinStep0(struct Task *task, struct ObjectEvent *objectEvent); -static bool8 PlayerAvatar_SecretBaseMatSpinStep1(struct Task *task, struct ObjectEvent *objectEvent); -static bool8 PlayerAvatar_SecretBaseMatSpinStep2(struct Task *task, struct ObjectEvent *objectEvent); -static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct ObjectEvent *objectEvent); +static void PlayerAvatar_DoSecretBaseMatSpin(u8); +static bool8 PlayerAvatar_SecretBaseMatSpinStep0(struct Task *, struct ObjectEvent *); +static bool8 PlayerAvatar_SecretBaseMatSpinStep1(struct Task *, struct ObjectEvent *); +static bool8 PlayerAvatar_SecretBaseMatSpinStep2(struct Task *, struct ObjectEvent *); +static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *, struct ObjectEvent *); static void CreateStopSurfingTask(u8); -static void Task_StopSurfingInit(u8 taskId); -static void Task_WaitStopSurfing(u8 taskId); +static void Task_StopSurfingInit(u8); +static void Task_WaitStopSurfing(u8); -static void Task_Fishing(u8 taskId); -static u8 Fishing_Init(struct Task *task); -static u8 Fishing_GetRodOut(struct Task *task); -static u8 Fishing_WaitBeforeDots(struct Task *task); -static u8 Fishing_InitDots(struct Task *task); -static u8 Fishing_ShowDots(struct Task *task); -static u8 Fishing_CheckForBite(struct Task *task); -static u8 Fishing_GotBite(struct Task *task); -static u8 Fishing_WaitForA(struct Task *task); -static u8 Fishing_CheckMoreDots(struct Task *task); -static u8 Fishing_MonOnHook(struct Task *task); -static u8 Fishing_StartEncounter(struct Task *task); -static u8 Fishing_NotEvenNibble(struct Task *task); -static u8 Fishing_GotAway(struct Task *task); -static u8 Fishing_NoMon(struct Task *task); -static u8 Fishing_PutRodAway(struct Task *task); -static u8 Fishing_EndNoMon(struct Task *task); +static void Task_Fishing(u8); +static u8 Fishing_Init(struct Task *); +static u8 Fishing_GetRodOut(struct Task *); +static u8 Fishing_WaitBeforeDots(struct Task *); +static u8 Fishing_InitDots(struct Task *); +static u8 Fishing_ShowDots(struct Task *); +static u8 Fishing_CheckForBite(struct Task *); +static u8 Fishing_GotBite(struct Task *); +static u8 Fishing_WaitForA(struct Task *); +static u8 Fishing_CheckMoreDots(struct Task *); +static u8 Fishing_MonOnHook(struct Task *); +static u8 Fishing_StartEncounter(struct Task *); +static u8 Fishing_NotEvenNibble(struct Task *); +static u8 Fishing_GotAway(struct Task *); +static u8 Fishing_NoMon(struct Task *); +static u8 Fishing_PutRodAway(struct Task *); +static u8 Fishing_EndNoMon(struct Task *); static void AlignFishingAnimationFrames(void); -static u8 TrySpinPlayerForWarp(struct ObjectEvent *object, s16 *a1); +static u8 TrySpinPlayerForWarp(struct ObjectEvent *, s16 *); static bool8 (*const sForcedMovementTestFuncs[NUM_FORCED_MOVEMENTS])(u8) = { @@ -1445,68 +1445,68 @@ static void HideShowWarpArrow(struct ObjectEvent *objectEvent) /* Strength */ -static void StartStrengthAnim(u8 a, u8 b) +#define tState data[0] +#define tBoulderObjId data[1] +#define tDirection data[2] + +static void StartStrengthAnim(u8 objectEventId, u8 direction) { u8 taskId = CreateTask(Task_PushBoulder, 0xFF); - gTasks[taskId].data[1] = a; - gTasks[taskId].data[2] = b; + gTasks[taskId].tBoulderObjId = objectEventId; + gTasks[taskId].tDirection = direction; Task_PushBoulder(taskId); } static void Task_PushBoulder(u8 taskId) { - while (sPushBoulderFuncs[gTasks[taskId].data[0]](&gTasks[taskId], + while (sPushBoulderFuncs[gTasks[taskId].tState](&gTasks[taskId], &gObjectEvents[gPlayerAvatar.objectEventId], - &gObjectEvents[gTasks[taskId].data[1]])) + &gObjectEvents[gTasks[taskId].tBoulderObjId])) ; } -static bool8 PushBoulder_Start(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject) +static bool8 PushBoulder_Start(struct Task *task, struct ObjectEvent *player, struct ObjectEvent *boulder) { ScriptContext2_Enable(); gPlayerAvatar.preventStep = TRUE; - task->data[0]++; + task->tState++; return FALSE; } -static bool8 PushBoulder_Move(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject) +static bool8 PushBoulder_Move(struct Task *task, struct ObjectEvent *player, struct ObjectEvent *boulder) { - if (ObjectEventIsHeldMovementActive(playerObject)) - { - ObjectEventClearHeldMovementIfFinished(playerObject); - } + if (ObjectEventIsHeldMovementActive(player)) + ObjectEventClearHeldMovementIfFinished(player); - if (ObjectEventIsHeldMovementActive(strengthObject)) - { - ObjectEventClearHeldMovementIfFinished(strengthObject); - } + if (ObjectEventIsHeldMovementActive(boulder)) + ObjectEventClearHeldMovementIfFinished(boulder); - if (!ObjectEventIsMovementOverridden(playerObject) - && !ObjectEventIsMovementOverridden(strengthObject)) + if (!ObjectEventIsMovementOverridden(player) + && !ObjectEventIsMovementOverridden(boulder)) { - ObjectEventClearHeldMovementIfFinished(playerObject); - ObjectEventClearHeldMovementIfFinished(strengthObject); - ObjectEventSetHeldMovement(playerObject, GetWalkInPlaceNormalMovementAction((u8)task->data[2])); - ObjectEventSetHeldMovement(strengthObject, GetWalkSlowMovementAction((u8)task->data[2])); - gFieldEffectArguments[0] = strengthObject->currentCoords.x; - gFieldEffectArguments[1] = strengthObject->currentCoords.y; - gFieldEffectArguments[2] = strengthObject->previousElevation; - gFieldEffectArguments[3] = gSprites[strengthObject->spriteId].oam.priority; + ObjectEventClearHeldMovementIfFinished(player); + ObjectEventClearHeldMovementIfFinished(boulder); + ObjectEventSetHeldMovement(player, GetWalkInPlaceNormalMovementAction((u8)task->tDirection)); + ObjectEventSetHeldMovement(boulder, GetWalkSlowMovementAction((u8)task->tDirection)); + gFieldEffectArguments[0] = boulder->currentCoords.x; + gFieldEffectArguments[1] = boulder->currentCoords.y; + gFieldEffectArguments[2] = boulder->previousElevation; + gFieldEffectArguments[3] = gSprites[boulder->spriteId].oam.priority; FieldEffectStart(FLDEFF_DUST); PlaySE(SE_M_STRENGTH); - task->data[0]++; + task->tState++; } return FALSE; } -static bool8 PushBoulder_End(struct Task *task, struct ObjectEvent *playerObject, struct ObjectEvent *strengthObject) +static bool8 PushBoulder_End(struct Task *task, struct ObjectEvent *player, struct ObjectEvent *boulder) { - if (ObjectEventCheckHeldMovementStatus(playerObject) - && ObjectEventCheckHeldMovementStatus(strengthObject)) + if (ObjectEventCheckHeldMovementStatus(player) + && ObjectEventCheckHeldMovementStatus(boulder)) { - ObjectEventClearHeldMovementIfFinished(playerObject); - ObjectEventClearHeldMovementIfFinished(strengthObject); + ObjectEventClearHeldMovementIfFinished(player); + ObjectEventClearHeldMovementIfFinished(boulder); gPlayerAvatar.preventStep = FALSE; ScriptContext2_Disable(); DestroyTask(FindTaskIdByFunc(Task_PushBoulder)); @@ -1514,6 +1514,10 @@ static bool8 PushBoulder_End(struct Task *task, struct ObjectEvent *playerObject return FALSE; } +#undef tState +#undef tBoulderObjId +#undef tDirection + /* Some field effect */ static void DoPlayerMatJump(void) diff --git a/src/field_special_scene.c b/src/field_special_scene.c index da7e4ed7d..749346728 100644 --- a/src/field_special_scene.c +++ b/src/field_special_scene.c @@ -19,7 +19,19 @@ #include "constants/songs.h" #include "constants/metatile_labels.h" -#define SECONDS(value) ((signed) (60.0 * value + 0.5)) +// Most of the boxes in the moving truck are map tiles, with the +// exception of three boxes that are map events that jostle around +// while the truck is driving. In addition, their sprite's placement +// is slightly offset to make them look less perfectly stacked. +// Box 1 (LOCALID_TRUCK_BOX_TOP) +#define BOX1_X_OFFSET 3 +#define BOX1_Y_OFFSET 3 +// Box 2 (LOCALID_TRUCK_BOX_BOTTOM_L) +#define BOX2_X_OFFSET 0 +#define BOX2_Y_OFFSET -3 +// Box 3 (LOCALID_TRUCK_BOX_BOTTOM_R) +#define BOX3_X_OFFSET -3 +#define BOX3_Y_OFFSET 0 // porthole states enum @@ -30,7 +42,6 @@ enum EXIT_PORTHOLE, }; -//. rodata static const s8 sTruckCamera_HorizontalTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, -1, -1, -1, 0}; static const u8 sSSTidalSailEastMovementScript[] = @@ -45,175 +56,194 @@ static const u8 sSSTidalSailWestMovementScript[] = MOVEMENT_ACTION_STEP_END }; -// .text static void Task_Truck3(u8); -s16 GetTruckCameraBobbingY(int a1) +static s16 GetTruckCameraBobbingY(int time) { - if (!(a1 % 120)) + if (!(time % 120)) return -1; - else if ((a1 % 10) <= 4) + else if ((time % 10) <= 4) return 1; return 0; } -s16 GetTruckBoxMovement(int a1) // for the box movement? +// Determines the frequency that the truck boxes bounce at. +// The return value of this function is multiplied and added +// to the boxes resting y offset, the result of which is that +// when it returns 0 they remain vertically still and when it +// returns -1 they jump upward. +// Box 1 has 30 added to the time so it jumps earlier, and +// box 2 has the return value multiplied by less, so it doesn't +// jump as high. +static s16 GetTruckBoxYMovement(int time) { - if (!((a1 + 120) % 180)) + if (!((time + 120) % 180)) return -1; return 0; } -void Task_Truck1(u8 taskId) +#define tTimer data[0] + +static void Task_Truck1(u8 taskId) { s16 *data = gTasks[taskId].data; s16 cameraXpan = 0, cameraYpan = 0; - s16 box1, box2, box3; + s16 yBox1, yBox2, yBox3; - box1 = GetTruckBoxMovement(data[0] + 30) * 4; - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3 - cameraXpan, box1 + 3); - box2 = GetTruckBoxMovement(data[0]) * 2; - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -cameraXpan, box2 - 3); - box3 = GetTruckBoxMovement(data[0]) * 4; - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3 - cameraXpan, box3); + yBox1 = GetTruckBoxYMovement(tTimer + 30) * 4; + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX1_X_OFFSET - cameraXpan, BOX1_Y_OFFSET + yBox1); + yBox2 = GetTruckBoxYMovement(tTimer) * 2; + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX2_X_OFFSET - cameraXpan, BOX2_Y_OFFSET + yBox2); + yBox3 = GetTruckBoxYMovement(tTimer) * 4; + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX3_X_OFFSET - cameraXpan, BOX3_Y_OFFSET + yBox3); - if (++data[0] == SECONDS(500)) // this will never run - data[0] = 0; // reset the timer if it gets stuck. + // Arbitrary timer limit that won't be reached + if (++tTimer == 30000) + tTimer = 0; - cameraYpan = GetTruckCameraBobbingY(data[0]); + cameraYpan = GetTruckCameraBobbingY(tTimer); SetCameraPanning(cameraXpan, cameraYpan); } -void Task_Truck2(u8 taskId) +#undef tTimer + +#define tTimerHorizontal data[0] +#define tMoveStep data[1] +#define tTimerVertical data[2] + +static void Task_Truck2(u8 taskId) { s16 *data = gTasks[taskId].data; - s16 cameraYpan; - s16 cameraXpan; - s16 box1; - s16 box2; - s16 box3; + s16 cameraYpan, cameraXpan; + s16 yBox1, yBox2, yBox3; - data[0]++; - data[2]++; + tTimerHorizontal++; + tTimerVertical++; - if (data[0] > 5) + if (tTimerHorizontal > 5) { - data[0] = 0; - data[1]++; + tTimerHorizontal = 0; + tMoveStep++; } - if ((u16)data[1] == 19) + if ((u16)tMoveStep == ARRAY_COUNT(sTruckCamera_HorizontalTable)) { + // Never reached, the task function is changed below before finishing the table DestroyTask(taskId); } else { - if (sTruckCamera_HorizontalTable[data[1]] == 2) + if (sTruckCamera_HorizontalTable[tMoveStep] == 2) gTasks[taskId].func = Task_Truck3; - cameraXpan = sTruckCamera_HorizontalTable[data[1]]; - cameraYpan = GetTruckCameraBobbingY(data[2]); + cameraXpan = sTruckCamera_HorizontalTable[tMoveStep]; + cameraYpan = GetTruckCameraBobbingY(tTimerVertical); SetCameraPanning(cameraXpan, cameraYpan); - box1 = GetTruckBoxMovement(data[2] + 30) * 4; - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3 - cameraXpan, box1 + 3); - box2 = GetTruckBoxMovement(data[2]) * 2; - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -cameraXpan, box2 - 3); - box3 = GetTruckBoxMovement(data[2]) * 4; - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3 - cameraXpan, box3); + yBox1 = GetTruckBoxYMovement(tTimerVertical + 30) * 4; + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX1_X_OFFSET - cameraXpan, BOX1_Y_OFFSET + yBox1); + yBox2 = GetTruckBoxYMovement(tTimerVertical) * 2; + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX2_X_OFFSET - cameraXpan, BOX2_Y_OFFSET + yBox2); + yBox3 = GetTruckBoxYMovement(tTimerVertical) * 4; + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX3_X_OFFSET - cameraXpan, BOX3_Y_OFFSET + yBox3); } } static void Task_Truck3(u8 taskId) { s16 *data = gTasks[taskId].data; - s16 cameraXpan; - s16 cameraYpan; + s16 cameraXpan, cameraYpan; - data[0]++; + tTimerHorizontal++; - if (data[0] > 5) + if (tTimerHorizontal > 5) { - data[0] = 0; - data[1]++; + tTimerHorizontal = 0; + tMoveStep++; } - if ((u16)data[1] == 19) + if ((u16)tMoveStep == ARRAY_COUNT(sTruckCamera_HorizontalTable)) { DestroyTask(taskId); } else { - cameraXpan = sTruckCamera_HorizontalTable[data[1]]; + cameraXpan = sTruckCamera_HorizontalTable[tMoveStep]; cameraYpan = 0; - SetCameraPanning(cameraXpan, 0); - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3 - cameraXpan, cameraYpan + 3); - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -cameraXpan, cameraYpan - 3); - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3 - cameraXpan, cameraYpan); + SetCameraPanning(cameraXpan, cameraYpan); + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX1_X_OFFSET - cameraXpan, BOX1_Y_OFFSET + cameraYpan); + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX2_X_OFFSET - cameraXpan, BOX2_Y_OFFSET + cameraYpan); + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX3_X_OFFSET - cameraXpan, BOX3_Y_OFFSET + cameraYpan); } } -void Task_HandleTruckSequence(u8 taskId) +#undef tTimerHorizontal +#undef tMoveStep +#undef tTimerVertical + +#define tState data[0] +#define tTimer data[1] +#define tTaskId1 data[2] +#define tTaskId2 data[3] + +static void Task_HandleTruckSequence(u8 taskId) { s16 *data = gTasks[taskId].data; - switch (data[0]) + switch (tState) { - /* - Each case has a timer which is handled with data[1], incrementing - until it reaches the if function's condition, which sets the next task up. - */ case 0: - data[1]++; - if (data[1] == SECONDS(1.5)) + tTimer++; + if (tTimer == 90) { SetCameraPanningCallback(NULL); - data[1] = 0; // reset the timer. - data[2] = CreateTask(Task_Truck1, 0xA); - data[0] = 1; // run the next case. + tTimer = 0; + tTaskId1 = CreateTask(Task_Truck1, 0xA); + tState = 1; PlaySE(SE_TRUCK_MOVE); } break; case 1: - data[1]++; - if (data[1] == SECONDS(2.5)) + tTimer++; + if (tTimer == 150) { FadeInFromBlack(); - data[1] = 0; - data[0] = 2; + tTimer = 0; + tState = 2; } break; case 2: - data[1]++; - if (!gPaletteFade.active && data[1] > SECONDS(5)) + tTimer++; + if (!gPaletteFade.active && tTimer > 300) { - data[1] = 0; - DestroyTask(data[2]); - data[3] = CreateTask(Task_Truck2, 0xA); - data[0] = 3; + tTimer = 0; + DestroyTask(tTaskId1); + tTaskId2 = CreateTask(Task_Truck2, 0xA); + tState = 3; PlaySE(SE_TRUCK_STOP); } break; case 3: - if (!gTasks[data[3]].isActive) // is Truck2 no longer active (is Truck3 active?) + if (!gTasks[tTaskId2].isActive) { + // Task_Truck2 / Task_Truck3 has finished InstallCameraPanAheadCallback(); - data[1] = 0; - data[0] = 4; + tTimer = 0; + tState = 4; } break; case 4: - data[1]++; - if (data[1] == 90) + tTimer++; + if (tTimer == 90) { PlaySE(SE_TRUCK_UNLOAD); - data[1] = 0; - data[0] = 5; + tTimer = 0; + tState = 5; } break; case 5: - data[1]++; - if (data[1] == 120) + tTimer++; + if (tTimer == 120) { MapGridSetMetatileIdAt(4 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_InsideOfTruck_ExitLight_Top); MapGridSetMetatileIdAt(4 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_InsideOfTruck_ExitLight_Mid); @@ -242,9 +272,9 @@ void EndTruckSequence(u8 taskId) { if (!FuncIsActiveTask(Task_HandleTruckSequence)) { - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 3, 3); - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, 0, -3); - SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, -3, 0); + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_TOP, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX1_X_OFFSET, BOX1_Y_OFFSET); + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_L, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX2_X_OFFSET, BOX2_Y_OFFSET); + SetObjectEventSpritePosByLocalIdAndMap(LOCALID_TRUCK_BOX_BOTTOM_R, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, BOX3_X_OFFSET, BOX3_Y_OFFSET); } } @@ -259,7 +289,7 @@ bool8 TrySetPortholeWarpDestination(void) } else { - SetWarpDestination(mapGroup, mapNum, -1, x, y); + SetWarpDestination(mapGroup, mapNum, WARP_ID_NONE, x, y); return TRUE; } } diff --git a/src/field_specials.c b/src/field_specials.c index a4cdafafc..4ed2a2e03 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -90,44 +90,44 @@ void SetPlayerGotFirstFans(void); u16 GetNumFansOfPlayerInTrainerFanClub(void); static void RecordCyclingRoadResults(u32, u8); -static void LoadLinkPartnerObjectEventSpritePalette(u8 graphicsId, u8 localEventId, u8 paletteNum); -static void Task_PetalburgGymSlideOpenRoomDoors(u8 taskId); -static void PetalburgGymSetDoorMetatiles(u8 roomNumber, u16 metatileId); +static void LoadLinkPartnerObjectEventSpritePalette(u8, u8, u8); +static void Task_PetalburgGymSlideOpenRoomDoors(u8); +static void PetalburgGymSetDoorMetatiles(u8, u16); static void Task_PCTurnOnEffect(u8); static void PCTurnOnEffect_0(struct Task *); static void PCTurnOnEffect_1(s16, s8, s8); static void PCTurnOffEffect(void); static void Task_LotteryCornerComputerEffect(u8); static void LotteryCornerComputerEffect(struct Task *); -static void Task_ShakeCamera(u8 taskId); -static void StopCameraShake(u8 taskId); -static void Task_MoveElevator(u8 taskId); -static void MoveElevatorWindowLights(u16 floorDelta, bool8 descending); -static void Task_MoveElevatorWindowLights(u8 taskId); -static void Task_ShowScrollableMultichoice(u8 taskId); -static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection); -static void ShowBattleFrontierTutorWindow(u8 menu, u16 selection); +static void Task_ShakeCamera(u8); +static void StopCameraShake(u8); +static void Task_MoveElevator(u8); +static void MoveElevatorWindowLights(u16, bool8); +static void Task_MoveElevatorWindowLights(u8); +static void Task_ShowScrollableMultichoice(u8); +static void FillFrontierExchangeCornerWindowAndItemIcon(u16, u16); +static void ShowBattleFrontierTutorWindow(u8, u16); static void InitScrollableMultichoice(void); -static void ScrollableMultichoice_ProcessInput(u8 taskId); -static void ScrollableMultichoice_UpdateScrollArrows(u8 taskId); -static void ScrollableMultichoice_MoveCursor(s32 itemIndex, bool8 onInit, struct ListMenu *list); -static void HideFrontierExchangeCornerItemIcon(u16 menu, u16 unused); -static void ShowBattleFrontierTutorMoveDescription(u8 menu, u16 selection); -static void CloseScrollableMultichoice(u8 taskId); -static void ScrollableMultichoice_RemoveScrollArrows(u8 taskId); -static void Task_ScrollableMultichoice_WaitReturnToList(u8 taskId); -static void Task_ScrollableMultichoice_ReturnToList(u8 taskId); -static void ShowFrontierExchangeCornerItemIcon(u16 item); -static void Task_DeoxysRockInteraction(u8 taskId); -static void ChangeDeoxysRockLevel(u8 a0); -static void WaitForDeoxysRockMovement(u8 taskId); -static void Task_LinkRetireStatusWithBattleTowerPartner(u8 taskId); -static void Task_LoopWingFlapSE(u8 taskId); -static void Task_CloseBattlePikeCurtain(u8 taskId); +static void ScrollableMultichoice_ProcessInput(u8); +static void ScrollableMultichoice_UpdateScrollArrows(u8); +static void ScrollableMultichoice_MoveCursor(s32, bool8, struct ListMenu *); +static void HideFrontierExchangeCornerItemIcon(u16, u16); +static void ShowBattleFrontierTutorMoveDescription(u8, u16); +static void CloseScrollableMultichoice(u8); +static void ScrollableMultichoice_RemoveScrollArrows(u8); +static void Task_ScrollableMultichoice_WaitReturnToList(u8); +static void Task_ScrollableMultichoice_ReturnToList(u8); +static void ShowFrontierExchangeCornerItemIcon(u16); +static void Task_DeoxysRockInteraction(u8); +static void ChangeDeoxysRockLevel(u8); +static void WaitForDeoxysRockMovement(u8); +static void Task_LinkRetireStatusWithBattleTowerPartner(u8); +static void Task_LoopWingFlapSE(u8); +static void Task_CloseBattlePikeCurtain(u8); static u8 DidPlayerGetFirstFans(void); static void SetInitialFansOfPlayer(void); static u16 PlayerGainRandomTrainerFan(void); -static void BufferFanClubTrainerName_(struct LinkBattleRecords *linkRecords, u8 a, u8 b); +static void BufferFanClubTrainerName_(struct LinkBattleRecords *, u8, u8); void Special_ShowDiploma(void) { diff --git a/src/field_weather.c b/src/field_weather.c index 0f203bd24..f7a7f8129 100644 --- a/src/field_weather.c +++ b/src/field_weather.c @@ -863,10 +863,10 @@ void LoadCustomWeatherSpritePalette(const u16 *palette) UpdateSpritePaletteWithWeather(gWeatherPtr->weatherPicSpritePalIndex); } -static void LoadDroughtWeatherPalette(u8 *gammaIndexPtr, u8 *a1) +static void LoadDroughtWeatherPalette(u8 *palsIndex, u8 *palsOffset) { - *gammaIndexPtr = 0x20; - *a1 = 0x20; + *palsIndex = 0x20; + *palsOffset = 0x20; } void ResetDroughtWeatherPaletteLoading(void) diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index 94c41a613..8349de559 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -14,11 +14,9 @@ #include "trig.h" #include "gpu_regs.h" -// EWRAM EWRAM_DATA static u8 sCurrentAbnormalWeather = 0; EWRAM_DATA static u16 sUnusedWeatherRelated = 0; -// CONST const u16 gCloudsWeatherPalette[] = INCBIN_U16("graphics/weather/cloud.gbapal"); const u16 gSandstormWeatherPalette[] = INCBIN_U16("graphics/weather/sandstorm.gbapal"); const u8 gWeatherFogDiagonalTiles[] = INCBIN_U8("graphics/weather/fog_diagonal.4bpp"); @@ -2427,34 +2425,39 @@ static void UpdateBubbleSprite(struct Sprite *sprite) //------------------------------------------------------------------------------ // Unused function. -static void UnusedSetCurrentAbnormalWeather(u32 a0, u32 a1) +static void UnusedSetCurrentAbnormalWeather(u32 weather, u32 unknown) { - sCurrentAbnormalWeather = a0; - sUnusedWeatherRelated = a1; + sCurrentAbnormalWeather = weather; + sUnusedWeatherRelated = unknown; } +#define tState data[0] +#define tWeatherA data[1] +#define tWeatherB data[2] +#define tDelay data[15] + static void Task_DoAbnormalWeather(u8 taskId) { s16 *data = gTasks[taskId].data; - switch (data[0]) + switch (tState) { case 0: - if (data[15]-- <= 0) + if (tDelay-- <= 0) { - SetNextWeather(data[1]); - sCurrentAbnormalWeather = data[1]; - data[15] = 600; - data[0]++; + SetNextWeather(tWeatherA); + sCurrentAbnormalWeather = tWeatherA; + tDelay = 600; + tState++; } break; case 1: - if (data[15]-- <= 0) + if (tDelay-- <= 0) { - SetNextWeather(data[2]); - sCurrentAbnormalWeather = data[2]; - data[15] = 600; - data[0] = 0; + SetNextWeather(tWeatherB); + sCurrentAbnormalWeather = tWeatherB; + tDelay = 600; + tState = 0; } break; } @@ -2465,25 +2468,33 @@ static void CreateAbnormalWeatherTask(void) u8 taskId = CreateTask(Task_DoAbnormalWeather, 0); s16 *data = gTasks[taskId].data; - data[15] = 600; + tDelay = 600; if (sCurrentAbnormalWeather == WEATHER_DOWNPOUR) { - data[1] = WEATHER_DROUGHT; - data[2] = WEATHER_DOWNPOUR; + // Currently Downpour, next will be Drought + tWeatherA = WEATHER_DROUGHT; + tWeatherB = WEATHER_DOWNPOUR; } else if (sCurrentAbnormalWeather == WEATHER_DROUGHT) { - data[1] = WEATHER_DOWNPOUR; - data[2] = WEATHER_DROUGHT; + // Currently Drought, next will be Downpour + tWeatherA = WEATHER_DOWNPOUR; + tWeatherB = WEATHER_DROUGHT; } else { + // Default to starting with Downpour sCurrentAbnormalWeather = WEATHER_DOWNPOUR; - data[1] = WEATHER_DROUGHT; - data[2] = WEATHER_DOWNPOUR; + tWeatherA = WEATHER_DROUGHT; + tWeatherB = WEATHER_DOWNPOUR; } } +#undef tState +#undef tWeatherA +#undef tWeatherB +#undef tDelay + static u8 TranslateWeatherNum(u8); static void UpdateRainCounter(u8, u8); diff --git a/src/intro_credits_graphics.c b/src/intro_credits_graphics.c index e7039e02b..0942e82f1 100644 --- a/src/intro_credits_graphics.c +++ b/src/intro_credits_graphics.c @@ -757,10 +757,9 @@ void LoadIntroPart2Graphics(u8 scenery) gReservedSpritePaletteCount = 8; } -// Note: This is only called with a=1. +// Note: This is only called with scenery=1. void SetIntroPart2BgCnt(u8 scenery) { - // Only called with scenery = 1 switch (scenery) { default: diff --git a/src/item_use.c b/src/item_use.c index c03ede61b..af8f2504f 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -42,33 +42,33 @@ #include "constants/items.h" #include "constants/songs.h" -static void SetUpItemUseCallback(u8 taskId); +static void SetUpItemUseCallback(u8); static void FieldCB_UseItemOnField(void); -static void Task_CallItemUseOnFieldCallback(u8 taskId); -static void Task_UseItemfinder(u8 taskId); -static void Task_CloseItemfinderMessage(u8 taskId); -static void Task_HiddenItemNearby(u8 taskId); -static void Task_StandingOnHiddenItem(u8 taskId); +static void Task_CallItemUseOnFieldCallback(u8); +static void Task_UseItemfinder(u8); +static void Task_CloseItemfinderMessage(u8); +static void Task_HiddenItemNearby(u8); +static void Task_StandingOnHiddenItem(u8); static bool8 ItemfinderCheckForHiddenItems(const struct MapEvents *, u8); -static u8 GetDirectionToHiddenItem(s16 distanceX, s16 distanceY); -static void PlayerFaceHiddenItem(u8 a); -static void CheckForHiddenItemsInMapConnection(u8 taskId); -static void Task_OpenRegisteredPokeblockCase(u8 taskId); -static void ItemUseOnFieldCB_Bike(u8 taskId); +static u8 GetDirectionToHiddenItem(s16, s16); +static void PlayerFaceHiddenItem(u8); +static void CheckForHiddenItemsInMapConnection(u8); +static void Task_OpenRegisteredPokeblockCase(u8); +static void ItemUseOnFieldCB_Bike(u8); static void ItemUseOnFieldCB_Rod(u8); static void ItemUseOnFieldCB_Itemfinder(u8); -static void ItemUseOnFieldCB_Berry(u8 taskId); -static void ItemUseOnFieldCB_WailmerPailBerry(u8 taskId); -static void ItemUseOnFieldCB_WailmerPailSudowoodo(u8 taskId); +static void ItemUseOnFieldCB_Berry(u8); +static void ItemUseOnFieldCB_WailmerPailBerry(u8); +static void ItemUseOnFieldCB_WailmerPailSudowoodo(u8); static bool8 TryToWaterSudowoodo(void); -static void BootUpSoundTMHM(u8 taskId); -static void Task_ShowTMHMContainedMessage(u8 taskId); -static void UseTMHMYesNo(u8 taskId); -static void UseTMHM(u8 taskId); -static void Task_StartUseRepel(u8 taskId); -static void Task_UseRepel(u8 taskId); -static void Task_CloseCantUseKeyItemMessage(u8 taskId); -static void SetDistanceOfClosestHiddenItem(u8 taskId, s16 x, s16 y); +static void BootUpSoundTMHM(u8); +static void Task_ShowTMHMContainedMessage(u8); +static void UseTMHMYesNo(u8); +static void UseTMHM(u8); +static void Task_StartUseRepel(u8); +static void Task_UseRepel(u8); +static void Task_CloseCantUseKeyItemMessage(u8); +static void SetDistanceOfClosestHiddenItem(u8, s16, s16); static void CB2_OpenPokeblockFromBag(void); // EWRAM variables diff --git a/src/link.c b/src/link.c index aa9a0d73d..e88cde55a 100644 --- a/src/link.c +++ b/src/link.c @@ -120,18 +120,18 @@ static EWRAM_DATA void *sLinkErrorBgTilemapBuffer = NULL; static void InitLocalLinkPlayer(void); static void VBlankCB_LinkError(void); static void CB2_LinkTest(void); -static void ProcessRecvCmds(u8 unused); +static void ProcessRecvCmds(u8); static void LinkCB_SendHeldKeys(void); static void ResetBlockSend(void); -static bool32 InitBlockSend(const void *src, size_t size); +static bool32 InitBlockSend(const void *, size_t); static void LinkCB_BlockSendBegin(void); static void LinkCB_BlockSend(void); static void LinkCB_BlockSendEnd(void); -static void SetBlockReceivedFlag(u8 who); -static u16 LinkTestCalcBlockChecksum(const u16 *src, u16 size); -static void LinkTest_PrintHex(u32 pos, u8 a0, u8 a1, u8 a2); +static void SetBlockReceivedFlag(u8); +static u16 LinkTestCalcBlockChecksum(const u16 *, u16); +static void LinkTest_PrintHex(u32, u8, u8, u8); static void LinkCB_RequestPlayerDataExchange(void); -static void Task_PrintTestData(u8 taskId); +static void Task_PrintTestData(u8); static void LinkCB_ReadyCloseLink(void); static void LinkCB_WaitCloseLink(void); diff --git a/src/list_menu.c b/src/list_menu.c index ccb183891..8ba13a6cf 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -312,14 +312,14 @@ static void ListMenuDummyTask(u8 taskId) } -s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 arg2, u16 tileNum, u16 palNum) +s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 drawMode, u16 tileNum, u16 palNum) { switch (sMysteryGiftLinkMenu.state) { case 0: default: sMysteryGiftLinkMenu.windowId = AddWindow(windowTemplate); - switch (arg2) + switch (drawMode) { case 2: LoadUserWindowBorderGfx(sMysteryGiftLinkMenu.windowId, tileNum, palNum); @@ -346,13 +346,13 @@ s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const str } if (sMysteryGiftLinkMenu.state == 2) { - if (arg2 == 0) + if (drawMode == 0) { ClearWindowTilemap(sMysteryGiftLinkMenu.windowId); } else { - switch (arg2) + switch (drawMode) { case 0: // can never be reached, because of the if statement above ClearStdWindowAndFrame(sMysteryGiftLinkMenu.windowId, FALSE); diff --git a/src/main_menu.c b/src/main_menu.c index 7a5dd9ebd..a69f73d17 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -198,7 +198,7 @@ static void NewGameBirchSpeech_ShowDialogueWindow(u8, u8); static void NewGameBirchSpeech_ClearWindow(u8); static void Task_NewGameBirchSpeech_ThisIsAPokemon(u8); static void Task_NewGameBirchSpeech_MainSpeech(u8); -static void NewGameBirchSpeech_WaitForThisIsPokemonText(struct TextPrinterTemplate *printer, u16 a); +static void NewGameBirchSpeech_WaitForThisIsPokemonText(struct TextPrinterTemplate *, u16); static void Task_NewGameBirchSpeech_AndYouAre(u8); static void Task_NewGameBirchSpeechSub_WaitForLotad(u8); static void Task_NewGameBirchSpeech_StartBirchLotadPlatformFade(u8); @@ -1371,7 +1371,7 @@ static void Task_NewGameBirchSpeechSub_InitPokeBall(u8 taskId) gSprites[spriteId].invisible = FALSE; gSprites[spriteId].data[0] = 0; - CreatePokeballSpriteToReleaseMon(spriteId, gSprites[spriteId].oam.paletteNum, 112, 58, 0, 0, 32, 0x0000FFFF, SPECIES_LOTAD); + CreatePokeballSpriteToReleaseMon(spriteId, gSprites[spriteId].oam.paletteNum, 112, 58, 0, 0, 32, PALETTES_BG, SPECIES_LOTAD); gTasks[taskId].func = Task_NewGameBirchSpeechSub_WaitForLotad; gTasks[sBirchSpeechMainTaskId].tTimer = 0; } @@ -2221,9 +2221,9 @@ static void ClearMainMenuWindowTilemap(const struct WindowTemplate *template) CopyBgTilemapBufferToVram(template->bg); } -static void NewGameBirchSpeech_ClearGenderWindowTilemap(u8 a, u8 b, u8 c, u8 d, u8 e, u8 unused) +static void NewGameBirchSpeech_ClearGenderWindowTilemap(u8 bg, u8 x, u8 y, u8 width, u8 height, u8 unused) { - FillBgTilemapBufferRect(a, 0, b + 0xFF, c + 0xFF, d + 2, e + 2, 2); + FillBgTilemapBufferRect(bg, 0, x + 255, y + 255, width + 2, height + 2, 2); } static void NewGameBirchSpeech_ClearGenderWindow(u8 windowId, bool8 copyToVram) @@ -2247,7 +2247,7 @@ static void NewGameBirchSpeech_ClearWindow(u8 windowId) CopyWindowToVram(windowId, COPYWIN_GFX); } -static void NewGameBirchSpeech_WaitForThisIsPokemonText(struct TextPrinterTemplate *printer, u16 a) +static void NewGameBirchSpeech_WaitForThisIsPokemonText(struct TextPrinterTemplate *printer, u16 renderCmd) { // Wait for Birch's "This is a Pokémon" text to reach the pause // Then start the PokéBall release (if it hasn't been started already) @@ -2273,21 +2273,22 @@ static void NewGameBirchSpeech_ShowDialogueWindow(u8 windowId, u8 copyToVram) CopyWindowToVram(windowId, 3); } -static void NewGameBirchSpeech_CreateDialogueWindowBorder(u8 a, u8 b, u8 c, u8 d, u8 e, u8 f) +static void NewGameBirchSpeech_CreateDialogueWindowBorder(u8 bg, u8 x, u8 y, u8 width, u8 height, u8 palNum) { - FillBgTilemapBufferRect(a, 0xFD, b-2, c-1, 1, 1, f); - FillBgTilemapBufferRect(a, 0xFF, b-1, c-1, 1, 1, f); - FillBgTilemapBufferRect(a, 0x100, b, c-1, d, 1, f); - FillBgTilemapBufferRect(a, 0x101, b+d-1, c-1, 1, 1, f); - FillBgTilemapBufferRect(a, 0x102, b+d, c-1, 1, 1, f); - FillBgTilemapBufferRect(a, 0x103, b-2, c, 1, 5, f); - FillBgTilemapBufferRect(a, 0x105, b-1, c, d+1, 5, f); - FillBgTilemapBufferRect(a, 0x106, b+d, c, 1, 5, f); - FillBgTilemapBufferRect(a, BG_TILE_V_FLIP(0xFD), b-2, c+e, 1, 1, f); - FillBgTilemapBufferRect(a, BG_TILE_V_FLIP(0xFF), b-1, c+e, 1, 1, f); - FillBgTilemapBufferRect(a, BG_TILE_V_FLIP(0x100), b, c+e, d-1, 1, f); - FillBgTilemapBufferRect(a, BG_TILE_V_FLIP(0x101), b+d-1, c+e, 1, 1, f); - FillBgTilemapBufferRect(a, BG_TILE_V_FLIP(0x102), b+d, c+e, 1, 1, f); + FillBgTilemapBufferRect(bg, 0xFD, x-2, y-1, 1, 1, palNum); + FillBgTilemapBufferRect(bg, 0xFF, x-1, y-1, 1, 1, palNum); + FillBgTilemapBufferRect(bg, 0x100, x, y-1, width, 1, palNum); + FillBgTilemapBufferRect(bg, 0x101, x+width-1, y-1, 1, 1, palNum); + FillBgTilemapBufferRect(bg, 0x102, x+width, y-1, 1, 1, palNum); + FillBgTilemapBufferRect(bg, 0x103, x-2, y, 1, 5, palNum); + FillBgTilemapBufferRect(bg, 0x105, x-1, y, width+1, 5, palNum); + FillBgTilemapBufferRect(bg, 0x106, x+width, y, 1, 5, palNum); + + FillBgTilemapBufferRect(bg, BG_TILE_V_FLIP(0xFD), x-2, y+height, 1, 1, palNum); + FillBgTilemapBufferRect(bg, BG_TILE_V_FLIP(0xFF), x-1, y+height, 1, 1, palNum); + FillBgTilemapBufferRect(bg, BG_TILE_V_FLIP(0x100), x, y+height, width-1, 1, palNum); + FillBgTilemapBufferRect(bg, BG_TILE_V_FLIP(0x101), x+width-1, y+height, 1, 1, palNum); + FillBgTilemapBufferRect(bg, BG_TILE_V_FLIP(0x102), x+width, y+height, 1, 1, palNum); } static void Task_NewGameBirchSpeech_ReturnFromNamingScreenShowTextbox(u8 taskId) diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 8dbe8b485..2b6c71c8a 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -438,7 +438,7 @@ static void EnableTextPrinters(void) gDisableTextPrinters = FALSE; } -static void DisableTextPrinters(struct TextPrinterTemplate * printer, u16 a1) +static void DisableTextPrinters(struct TextPrinterTemplate * printer, u16 renderCmd) { gDisableTextPrinters = TRUE; } diff --git a/src/menu.c b/src/menu.c index 49baddded..c4540942b 100644 --- a/src/menu.c +++ b/src/menu.c @@ -542,9 +542,9 @@ void RemoveMapNamePopUpWindow(void) } } -void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextPrinterTemplate *, u16)) +void AddTextPrinterWithCallbackForMessage(bool8 canSpeedUp, void (*callback)(struct TextPrinterTemplate *, u16)) { - gTextFlags.canABSpeedUpPrint = a1; + gTextFlags.canABSpeedUpPrint = canSpeedUp; AddTextPrinterParameterized2(0, FONT_NORMAL, gStringVar4, GetPlayerTextSpeedDelay(), callback, 2, 1, 3); } @@ -1245,9 +1245,9 @@ static void PrintMenuActionGridText(u8 windowId, u8 fontId, u8 left, u8 top, u8 } // Unused -static void PrintMenuActionGridTextAtTop(u8 windowId, u8 fontId, u8 a2, u8 a3, u8 a4, u8 a5, const struct MenuAction *menuActions) +static void PrintMenuActionGridTextAtTop(u8 windowId, u8 fontId, u8 width, u8 height, u8 columns, u8 rows, const struct MenuAction *menuActions) { - PrintMenuActionGridText(windowId, fontId, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_WIDTH), 0, a2, a3, a4, a5, menuActions); + PrintMenuActionGridText(windowId, fontId, GetFontAttribute(fontId, FONTATTR_MAX_LETTER_WIDTH), 0, width, height, columns, rows, menuActions); } void PrintMenuActionGrid(u8 windowId, u8 fontId, u8 left, u8 top, u8 optionWidth, u8 horizontalCount, u8 verticalCount, const struct MenuAction *menuActions, const u8 *actionIds) diff --git a/src/menu_helpers.c b/src/menu_helpers.c index e9f3e571f..7decd695c 100644 --- a/src/menu_helpers.c +++ b/src/menu_helpers.c @@ -153,7 +153,7 @@ void DoYesNoFuncWithChoice(u8 taskId, const struct YesNoFuncTable *data) gTasks[taskId].func = Task_CallYesOrNoCallback; } -void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 arg2, u8 arg3, u8 arg4, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo) +void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 unused1, u8 unused2, u8 unused3, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo) { CreateYesNoMenu(template, tileStart, palette, 0); sYesNo = *yesNo; @@ -176,17 +176,18 @@ static void Task_CallYesOrNoCallback(u8 taskId) } } -bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1) +// Returns TRUE if the quantity was changed, FALSE if it remained the same +bool8 AdjustQuantityAccordingToDPadInput(s16 *quantity, u16 max) { - s16 valBefore = (*arg0); + s16 valBefore = *quantity; - if ((JOY_REPEAT(DPAD_ANY)) == DPAD_UP) + if (JOY_REPEAT(DPAD_ANY) == DPAD_UP) { - (*arg0)++; - if ((*arg0) > arg1) - (*arg0) = 1; + (*quantity)++; + if (*quantity > max) + *quantity = 1; - if ((*arg0) == valBefore) + if (*quantity == valBefore) { return FALSE; } @@ -196,13 +197,13 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1) return TRUE; } } - else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_DOWN) + else if (JOY_REPEAT(DPAD_ANY) == DPAD_DOWN) { - (*arg0)--; - if ((*arg0) <= 0) - (*arg0) = arg1; + (*quantity)--; + if (*quantity <= 0) + *quantity = max; - if ((*arg0) == valBefore) + if (*quantity == valBefore) { return FALSE; } @@ -212,13 +213,13 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1) return TRUE; } } - else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_RIGHT) + else if (JOY_REPEAT(DPAD_ANY) == DPAD_RIGHT) { - (*arg0) += 10; - if ((*arg0) > arg1) - (*arg0) = arg1; + *quantity += 10; + if (*quantity > max) + *quantity = max; - if ((*arg0) == valBefore) + if (*quantity == valBefore) { return FALSE; } @@ -228,13 +229,13 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1) return TRUE; } } - else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_LEFT) + else if (JOY_REPEAT(DPAD_ANY) == DPAD_LEFT) { - (*arg0) -= 10; - if ((*arg0) <= 0) - (*arg0) = 1; + *quantity -= 10; + if (*quantity <= 0) + *quantity = 1; - if ((*arg0) == valBefore) + if (*quantity == valBefore) { return FALSE; } diff --git a/src/mystery_event_script.c b/src/mystery_event_script.c index 5f08c6294..e0f789bcb 100644 --- a/src/mystery_event_script.c +++ b/src/mystery_event_script.c @@ -19,8 +19,8 @@ extern ScrCmdFunc gMysteryEventScriptCmdTable[]; extern ScrCmdFunc gMysteryEventScriptCmdTableEnd[]; -#define LANGUAGE_MASK 0x1 -#define VERSION_MASK 0x200 +// 0x1 in FireRed, 0x2 in LeafGreen, 0x80 in Ruby, 0x100 in Sapphire +#define VERSION_MASK (1 << 9) #define mScriptBase data[0] #define mOffset data[1] @@ -29,18 +29,21 @@ extern ScrCmdFunc gMysteryEventScriptCmdTableEnd[]; EWRAM_DATA static struct ScriptContext sMysteryEventScriptContext = {0}; -static bool32 CheckCompatibility(u16 a1, u32 a2, u16 a3, u32 a4) +static bool32 CheckCompatibility(u16 unk0, u32 unk1, u16 unk2, u32 version) { - if (!(a1 & LANGUAGE_MASK)) + // 0x1 in English FRLG, 0x2 in English RS, 0x4 in German RS + if (!(unk0 & 0x1)) return FALSE; - if (!(a2 & LANGUAGE_MASK)) + // Same as above + if (!(unk1 & 0x1)) return FALSE; - if (!(a3 & 0x4)) + // 0x1 in FRLG, 0x4 in RS + if (!(unk2 & 0x4)) return FALSE; - if (!(a4 & VERSION_MASK)) + if (!(version & VERSION_MASK)) return FALSE; return TRUE; @@ -174,18 +177,18 @@ bool8 MEScrCmd_end(struct ScriptContext *ctx) bool8 MEScrCmd_checkcompat(struct ScriptContext *ctx) { - u16 v1; - u32 v2; - u16 v3; - u32 v4; + u16 unk0; + u32 unk1; + u16 unk2; + u32 version; ctx->mOffset = ScriptReadWord(ctx); - v1 = ScriptReadHalfword(ctx); - v2 = ScriptReadWord(ctx); - v3 = ScriptReadHalfword(ctx); - v4 = ScriptReadWord(ctx); + unk0 = ScriptReadHalfword(ctx); + unk1 = ScriptReadWord(ctx); + unk2 = ScriptReadHalfword(ctx); + version = ScriptReadWord(ctx); - if (CheckCompatibility(v1, v2, v3, v4) == TRUE) + if (CheckCompatibility(unk0, unk1, unk2, version) == TRUE) ctx->mValid = TRUE; else SetIncompatible(); diff --git a/src/mystery_gift_client.c b/src/mystery_gift_client.c index eeebec5d6..12e9356d5 100644 --- a/src/mystery_gift_client.c +++ b/src/mystery_gift_client.c @@ -229,7 +229,7 @@ static u32 Client_Run(struct MysteryGiftClient * client) MysteryGift_TrySaveStamp(client->recvBuffer); break; case CLI_SAVE_RAM_SCRIPT: - InitRamScript_NoObjectEvent(client->recvBuffer, 1000); + InitRamScript_NoObjectEvent(client->recvBuffer, sizeof(struct RamScriptData)); break; case CLI_RECV_EREADER_TRAINER: memcpy(&gSaveBlock2Ptr->frontier.ereaderTrainer, client->recvBuffer, sizeof(gSaveBlock2Ptr->frontier.ereaderTrainer)); diff --git a/src/overworld.c b/src/overworld.c index 36f52223f..a2b6a6433 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -2477,9 +2477,9 @@ static u16 KeyInterCB_ReadButtons(u32 key) return LINK_KEY_CODE_EMPTY; } -static u16 GetDirectionForDpadKey(u16 a1) +static u16 GetDirectionForDpadKey(u16 key) { - switch (a1) + switch (key) { case LINK_KEY_CODE_DPAD_RIGHT: return FACING_RIGHT; @@ -2598,7 +2598,7 @@ static u16 KeyInterCB_Ready(u32 keyOrPlayerId) } } -static u16 KeyInterCB_SetReady(u32 a1) +static u16 KeyInterCB_SetReady(u32 key) { SetKeyInterceptCallback(KeyInterCB_Ready); return LINK_KEY_CODE_READY; diff --git a/src/palette.c b/src/palette.c index 174c04e14..577257eff 100644 --- a/src/palette.c +++ b/src/palette.c @@ -237,63 +237,63 @@ static void PaletteStruct_Run(u8 a1, u32 *unkFlags) } } -static void PaletteStruct_Copy(struct PaletteStruct *a1, u32 *unkFlags) +static void PaletteStruct_Copy(struct PaletteStruct *palStruct, u32 *unkFlags) { s32 srcIndex; s32 srcCount; u8 i = 0; - u16 srcOffset = a1->srcIndex * a1->template->size; + u16 srcOffset = palStruct->srcIndex * palStruct->template->size; - if (!a1->template->pst_field_8_0) + if (!palStruct->template->pst_field_8_0) { - while (i < a1->template->size) + while (i < palStruct->template->size) { - gPlttBufferUnfaded[a1->destOffset] = a1->template->src[srcOffset]; - gPlttBufferFaded[a1->destOffset] = a1->template->src[srcOffset]; + gPlttBufferUnfaded[palStruct->destOffset] = palStruct->template->src[srcOffset]; + gPlttBufferFaded[palStruct->destOffset] = palStruct->template->src[srcOffset]; i++; - a1->destOffset++; + palStruct->destOffset++; srcOffset++; } } else { - while (i < a1->template->size) + while (i < palStruct->template->size) { - gPlttBufferFaded[a1->destOffset] = a1->template->src[srcOffset]; + gPlttBufferFaded[palStruct->destOffset] = palStruct->template->src[srcOffset]; i++; - a1->destOffset++; + palStruct->destOffset++; srcOffset++; } } - a1->destOffset = a1->baseDestOffset; - a1->countdown1 = a1->template->time1; - a1->srcIndex++; + palStruct->destOffset = palStruct->baseDestOffset; + palStruct->countdown1 = palStruct->template->time1; + palStruct->srcIndex++; - srcIndex = a1->srcIndex; - srcCount = a1->template->srcCount; + srcIndex = palStruct->srcIndex; + srcCount = palStruct->template->srcCount; if (srcIndex >= srcCount) { - if (a1->countdown2) - a1->countdown2--; - a1->srcIndex = 0; + if (palStruct->countdown2) + palStruct->countdown2--; + palStruct->srcIndex = 0; } - *unkFlags |= 1 << (a1->baseDestOffset >> 4); + *unkFlags |= 1 << (palStruct->baseDestOffset >> 4); } -static void PaletteStruct_Blend(struct PaletteStruct *a1, u32 *unkFlags) +static void PaletteStruct_Blend(struct PaletteStruct *palStruct, u32 *unkFlags) { - if (gPaletteFade.active && ((1 << (a1->baseDestOffset >> 4)) & gPaletteFade_selectedPalettes)) + if (gPaletteFade.active && ((1 << (palStruct->baseDestOffset >> 4)) & gPaletteFade_selectedPalettes)) { - if (!a1->template->pst_field_8_0) + if (!palStruct->template->pst_field_8_0) { if (gPaletteFade.delayCounter != gPaletteFade_delay) { BlendPalette( - a1->baseDestOffset, - a1->template->size, + palStruct->baseDestOffset, + palStruct->template->size, gPaletteFade.y, gPaletteFade.blendColor); } @@ -302,13 +302,13 @@ static void PaletteStruct_Blend(struct PaletteStruct *a1, u32 *unkFlags) { if (!gPaletteFade.delayCounter) { - if (a1->countdown1 != a1->template->time1) + if (palStruct->countdown1 != palStruct->template->time1) { - u32 srcOffset = a1->srcIndex * a1->template->size; + u32 srcOffset = palStruct->srcIndex * palStruct->template->size; u8 i; - for (i = 0; i < a1->template->size; i++) - gPlttBufferFaded[a1->baseDestOffset + i] = a1->template->src[srcOffset + i]; + for (i = 0; i < palStruct->template->size; i++) + gPlttBufferFaded[palStruct->baseDestOffset + i] = palStruct->template->src[srcOffset + i]; } } } diff --git a/src/player_pc.c b/src/player_pc.c index a5ce89da4..0ca78dea8 100644 --- a/src/player_pc.c +++ b/src/player_pc.c @@ -97,84 +97,84 @@ struct ItemStorageMenu u8 swapLineSpriteIds[SWAP_LINE_LENGTH]; }; -static void InitPlayerPCMenu(u8 taskId); -static void PlayerPCProcessMenuInput(u8 taskId); -static void InitItemStorageMenu(u8 taskId, u8 var); +static void InitPlayerPCMenu(u8); +static void PlayerPCProcessMenuInput(u8); +static void InitItemStorageMenu(u8, u8); static u8 GetMailboxMailCount(void); static void Mailbox_CompactMailList(void); -static void Mailbox_DrawMailboxMenu(u8 taskId); -static void Mailbox_ProcessInput(u8 taskId); -static void Mailbox_PrintWhatToDoWithPlayerMailText(u8 taskId); +static void Mailbox_DrawMailboxMenu(u8); +static void Mailbox_ProcessInput(u8); +static void Mailbox_PrintWhatToDoWithPlayerMailText(u8); static void Mailbox_ReturnToPlayerPC(u8); -static void Mailbox_PrintMailOptions(u8 taskId); -static void Mailbox_MailOptionsProcessInput(u8 taskId); +static void Mailbox_PrintMailOptions(u8); +static void Mailbox_MailOptionsProcessInput(u8); -static void PlayerPC_ItemStorage(u8 taskId); -static void PlayerPC_Mailbox(u8 taskId); -static void PlayerPC_Decoration(u8 var); -static void PlayerPC_TurnOff(u8 taskId); +static void PlayerPC_ItemStorage(u8); +static void PlayerPC_Mailbox(u8); +static void PlayerPC_Decoration(u8); +static void PlayerPC_TurnOff(u8); -static void Mailbox_DoMailMoveToBag(u8 taskId); -static void Mailbox_DoMailRead(u8 taskId); -static void Mailbox_MoveToBag(u8 taskId); -static void Mailbox_Give(u8 taskId); -static void Mailbox_Cancel(u8 taskId); +static void Mailbox_DoMailMoveToBag(u8); +static void Mailbox_DoMailRead(u8); +static void Mailbox_MoveToBag(u8); +static void Mailbox_Give(u8); +static void Mailbox_Cancel(u8); -static void Mailbox_CancelMoveToBag(u8 taskId); -static void Mailbox_HandleConfirmMoveToBag(u8 taskId); -static void Mailbox_AskConfirmMoveToBag(u8 taskId); -static void Mailbox_DoGiveMailPokeMenu(u8 taskId); -static void Mailbox_NoPokemonForMail(u8 taskId); +static void Mailbox_CancelMoveToBag(u8); +static void Mailbox_HandleConfirmMoveToBag(u8); +static void Mailbox_AskConfirmMoveToBag(u8); +static void Mailbox_DoGiveMailPokeMenu(u8); +static void Mailbox_NoPokemonForMail(u8); -static void Mailbox_FadeAndReadMail(u8 taskId); +static void Mailbox_FadeAndReadMail(u8); static void Mailbox_ReturnToFieldFromReadMail(void); static void Mailbox_ReshowAfterMail(void); -static void Mailbox_HandleReturnToProcessInput(u8 taskId); +static void Mailbox_HandleReturnToProcessInput(u8); static void Mailbox_UpdateMailListAfterDeposit(void); -static void ItemStorage_Withdraw(u8 taskId); -static void ItemStorage_Deposit(u8 taskId); -static void ItemStorage_Toss(u8 taskId); -static void ItemStorage_Exit(u8 taskId); -static void ItemStorage_TossItemYes(u8 taskId); -static void ItemStorage_TossItemNo(u8 taskId); +static void ItemStorage_Withdraw(u8); +static void ItemStorage_Deposit(u8); +static void ItemStorage_Toss(u8); +static void ItemStorage_Exit(u8); +static void ItemStorage_TossItemYes(u8); +static void ItemStorage_TossItemNo(u8); static void ItemStorageMenuPrint(const u8 *); -static void ItemStorageMenuProcessInput(u8 taskId); +static void ItemStorageMenuProcessInput(u8); static void SetPlayerPCListCount(u8); -static void ItemStorage_HandleReturnToProcessInput(u8 taskId); +static void ItemStorage_HandleReturnToProcessInput(u8); -static void ItemStorage_Enter(u8 taskId, bool8 toss); -static void ItemStorage_CreateListMenu(u8 taskId); -static void ItemStorage_ProcessInput(u8 taskId); -static void Task_ItemStorage_Deposit(u8 taskId); +static void ItemStorage_Enter(u8, bool8); +static void ItemStorage_CreateListMenu(u8); +static void ItemStorage_ProcessInput(u8); +static void Task_ItemStorage_Deposit(u8); static void ItemStorage_ReshowAfterBagMenu(void); -static void ItemStorage_DoItemWithdraw(u8 taskId); -static void ItemStorage_DoItemToss(u8 taskid); -static void ItemStorage_HandleQuantityRolling(u8 taskid); -static void ItemStorage_ExitItemList(u8 taskId); -static void ItemStorage_StartItemSwap(u8 taskId); -static void ItemStorage_DoItemAction(u8 taskId); -static void ItemStorage_FinishItemSwap(u8 taskId, bool8 a); -static void ItemStorage_HandleRemoveItem(u8 taskId); -static void ItemStorage_HandleErrorMessageInput(u8 taskId); -static void ItemStorage_ReturnToListInput(u8 taskId); +static void ItemStorage_DoItemWithdraw(u8); +static void ItemStorage_DoItemToss(u8); +static void ItemStorage_HandleQuantityRolling(u8); +static void ItemStorage_ExitItemList(u8); +static void ItemStorage_StartItemSwap(u8); +static void ItemStorage_DoItemAction(u8); +static void ItemStorage_FinishItemSwap(u8, bool8); +static void ItemStorage_HandleRemoveItem(u8); +static void ItemStorage_HandleErrorMessageInput(u8); +static void ItemStorage_ReturnToListInput(u8); static const u8* ItemStorage_GetMessage(u16); -static void CopyItemName_PlayerPC(u8 *string, u16 itemId); +static void CopyItemName_PlayerPC(u8 *, u16); static void ItemStorage_Init(void); -static void ItemStorage_DrawSwapArrow(u8 y, u8, u8 speed); +static void ItemStorage_DrawSwapArrow(u8, u8, u8); static void ItemStorage_RemoveWindow(u8); static void ItemStorage_UpdateSwapLinePos(u8); -static void ItemStorage_ProcessItemSwapInput(u8 taskId); +static void ItemStorage_ProcessItemSwapInput(u8); static void ItemStorage_EraseItemIcon(void); -static void ItemStorage_DrawItemIcon(u16 itemId); -static void ItemStorage_PrintDescription(s32 id); -static void ItemStorage_EraseMainMenu(u8 taskId); -static void ItemStorage_MoveCursor(s32 id, bool8 b, struct ListMenu * thisMenu); -static void ItemStorage_PrintMenuItem(u8 windowId, u32 id, u8 yOffset); +static void ItemStorage_DrawItemIcon(u16); +static void ItemStorage_PrintDescription(s32); +static void ItemStorage_EraseMainMenu(u8); +static void ItemStorage_MoveCursor(s32, bool8, struct ListMenu *); +static void ItemStorage_PrintMenuItem(u8, u32, u8); static EWRAM_DATA const u8 *sTopMenuOptionOrder = NULL; static EWRAM_DATA u8 sTopMenuNumOptions = 0; diff --git a/src/pokeball.c b/src/pokeball.c index a9ccd42d6..f203633a5 100644 --- a/src/pokeball.c +++ b/src/pokeball.c @@ -438,7 +438,7 @@ static void SpriteCB_BallThrow(struct Sprite *sprite) sprite->y2 = 0; sprite->data[5] = 0; ballId = ItemIdToBallId(GetBattlerPokeballItemId(opponentBattler)); - AnimateBallOpenParticles(sprite->x, sprite->y - 5, 1, 0x1C, ballId); + AnimateBallOpenParticles(sprite->x, sprite->y - 5, 1, 28, ballId); sprite->data[0] = LaunchBallFadeMonTask(FALSE, opponentBattler, 14, ballId); sprite->sBattler = opponentBattler; sprite->data[7] = noOfShakes; @@ -752,7 +752,7 @@ static void SpriteCB_ReleaseMonFromBall(struct Sprite *sprite) StartSpriteAnim(sprite, 1); ballId = ItemIdToBallId(GetBattlerPokeballItemId(battlerId)); - AnimateBallOpenParticles(sprite->x, sprite->y - 5, 1, 0x1C, ballId); + AnimateBallOpenParticles(sprite->x, sprite->y - 5, 1, 28, ballId); sprite->data[0] = LaunchBallFadeMonTask(TRUE, sprite->sBattler, 14, ballId); sprite->callback = HandleBallAnimEnd; @@ -1000,37 +1000,50 @@ static void SpriteCB_OpponentMonSendOut(struct Sprite *sprite) #undef sBattler -static u8 AnimateBallOpenParticlesForPokeball(u8 x, u8 y, u8 kindOfStars, u8 d) +static u8 AnimateBallOpenParticlesForPokeball(u8 x, u8 y, u8 kindOfStars, u8 subpriority) { - return AnimateBallOpenParticles(x, y, kindOfStars, d, BALL_POKE); + return AnimateBallOpenParticles(x, y, kindOfStars, subpriority, BALL_POKE); } -static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 battlerId, u32 arg2) +static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 spritePalNum, u32 selectedPalettes) { - return LaunchBallFadeMonTask(unFadeLater, battlerId, arg2, BALL_POKE); + return LaunchBallFadeMonTask(unFadeLater, spritePalNum, selectedPalettes, BALL_POKE); } +// Sprite data for the pokemon +#define sSpecies data[7] + +// Sprite data for the pokeball +#define sMonSpriteId data[0] +#define sDelay data[1] +#define sMonPalNum data[2] +#define sFadePalsLo data[3] +#define sFadePalsHi data[4] +#define sFinalMonX data[5] +#define sFinalMonY data[6] +#define sTrigIdx data[7] + // Pokeball in Birch intro, and when receiving via trade -void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 battlerId, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 g, u32 h, u16 species) +void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 monPalNum, u8 x, u8 y, u8 oamPriority, u8 subpriortiy, u8 delay, u32 fadePalettes, u16 species) { u8 spriteId; - LoadCompressedSpriteSheetUsingHeap(&gBallSpriteSheets[0]); - LoadCompressedSpritePaletteUsingHeap(&gBallSpritePalettes[0]); - spriteId = CreateSprite(&gBallSpriteTemplates[0], x, y, subpriortiy); + LoadCompressedSpriteSheetUsingHeap(&gBallSpriteSheets[BALL_POKE]); + LoadCompressedSpritePaletteUsingHeap(&gBallSpritePalettes[BALL_POKE]); + spriteId = CreateSprite(&gBallSpriteTemplates[BALL_POKE], x, y, subpriortiy); - gSprites[spriteId].data[0] = monSpriteId; - gSprites[spriteId].data[5] = gSprites[monSpriteId].x; - gSprites[spriteId].data[6] = gSprites[monSpriteId].y; + gSprites[spriteId].sMonSpriteId = monSpriteId; + gSprites[spriteId].sFinalMonX = gSprites[monSpriteId].x; + gSprites[spriteId].sFinalMonY = gSprites[monSpriteId].y; gSprites[monSpriteId].x = x; gSprites[monSpriteId].y = y; - gSprites[monSpriteId].data[7] = species; + gSprites[monSpriteId].sSpecies = species; - gSprites[spriteId].data[1] = g; - gSprites[spriteId].data[2] = battlerId; - gSprites[spriteId].data[3] = h; - gSprites[spriteId].data[4] = h >> 0x10; + gSprites[spriteId].sDelay = delay; + gSprites[spriteId].sMonPalNum = monPalNum; + gSprites[spriteId].sFadePalsLo = fadePalettes; + gSprites[spriteId].sFadePalsHi = fadePalettes >> 16; gSprites[spriteId].oam.priority = oamPriority; gSprites[spriteId].callback = SpriteCB_PokeballReleaseMon; @@ -1039,92 +1052,103 @@ void CreatePokeballSpriteToReleaseMon(u8 monSpriteId, u8 battlerId, u8 x, u8 y, static void SpriteCB_PokeballReleaseMon(struct Sprite *sprite) { - if (sprite->data[1] == 0) + if (sprite->sDelay == 0) { - u8 r5; - u8 r7 = sprite->data[0]; - u8 battlerId = sprite->data[2]; - u32 r4 = (u16)sprite->data[3] | ((u16)sprite->data[4] << 16); + u8 subpriority; + u8 spriteId = sprite->sMonSpriteId; + u8 monPalNum = sprite->sMonPalNum; + u32 selectedPalettes = (u16)sprite->sFadePalsLo | ((u16)sprite->sFadePalsHi << 16); if (sprite->subpriority != 0) - r5 = sprite->subpriority - 1; + subpriority = sprite->subpriority - 1; else - r5 = 0; + subpriority = 0; StartSpriteAnim(sprite, 1); - AnimateBallOpenParticlesForPokeball(sprite->x, sprite->y - 5, sprite->oam.priority, r5); - sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, battlerId, r4); + AnimateBallOpenParticlesForPokeball(sprite->x, sprite->y - 5, sprite->oam.priority, subpriority); + // sDelay re-used to store task id but never read + sprite->sDelay = LaunchBallFadeMonTaskForPokeball(1, monPalNum, selectedPalettes); sprite->callback = SpriteCB_ReleasedMonFlyOut; - gSprites[r7].invisible = FALSE; - StartSpriteAffineAnim(&gSprites[r7], BATTLER_AFFINE_EMERGE); - AnimateSprite(&gSprites[r7]); - gSprites[r7].data[1] = 0x1000; - sprite->data[7] = 0; + gSprites[spriteId].invisible = FALSE; + StartSpriteAffineAnim(&gSprites[spriteId], BATTLER_AFFINE_EMERGE); + AnimateSprite(&gSprites[spriteId]); + gSprites[spriteId].data[1] = 0x1000; + sprite->sTrigIdx = 0; } else { - sprite->data[1]--; + sprite->sDelay--; } } static void SpriteCB_ReleasedMonFlyOut(struct Sprite *sprite) { - bool8 r12 = FALSE; - bool8 r6 = FALSE; - u8 monSpriteId = sprite->data[0]; - u16 var1; - u16 var2; + bool8 emergeAnimFinished = FALSE; + bool8 atFinalPosition = FALSE; + u8 monSpriteId = sprite->sMonSpriteId; + u16 x, y; if (sprite->animEnded) sprite->invisible = TRUE; + if (gSprites[monSpriteId].affineAnimEnded) { StartSpriteAffineAnim(&gSprites[monSpriteId], BATTLER_AFFINE_NORMAL); - r12 = TRUE; + emergeAnimFinished = TRUE; } - var1 = (sprite->data[5] - sprite->x) * sprite->data[7] / 128 + sprite->x; - var2 = (sprite->data[6] - sprite->y) * sprite->data[7] / 128 + sprite->y; - gSprites[monSpriteId].x = var1; - gSprites[monSpriteId].y = var2; - if (sprite->data[7] < 128) - { - s16 sine = -(gSineTable[(u8)sprite->data[7]] / 8); - sprite->data[7] += 4; + x = (sprite->sFinalMonX - sprite->x) * sprite->sTrigIdx / 128 + sprite->x; + y = (sprite->sFinalMonY - sprite->y) * sprite->sTrigIdx / 128 + sprite->y; + gSprites[monSpriteId].x = x; + gSprites[monSpriteId].y = y; + + if (sprite->sTrigIdx < 128) + { + s16 sine = -(gSineTable[(u8)sprite->sTrigIdx] / 8); + + sprite->sTrigIdx += 4; gSprites[monSpriteId].x2 = sine; gSprites[monSpriteId].y2 = sine; } else { - gSprites[monSpriteId].x = sprite->data[5]; - gSprites[monSpriteId].y = sprite->data[6]; + gSprites[monSpriteId].x = sprite->sFinalMonX; + gSprites[monSpriteId].y = sprite->sFinalMonY; gSprites[monSpriteId].x2 = 0; gSprites[monSpriteId].y2 = 0; - r6 = TRUE; + atFinalPosition = TRUE; } - if (sprite->animEnded && r12 && r6) + if (sprite->animEnded && emergeAnimFinished && atFinalPosition) { - if (gSprites[monSpriteId].data[7] == SPECIES_EGG) - DoMonFrontSpriteAnimation(&gSprites[monSpriteId], gSprites[monSpriteId].data[7], TRUE, 0); + if (gSprites[monSpriteId].sSpecies == SPECIES_EGG) + DoMonFrontSpriteAnimation(&gSprites[monSpriteId], gSprites[monSpriteId].sSpecies, TRUE, 0); else - DoMonFrontSpriteAnimation(&gSprites[monSpriteId], gSprites[monSpriteId].data[7], FALSE, 0); + DoMonFrontSpriteAnimation(&gSprites[monSpriteId], gSprites[monSpriteId].sSpecies, FALSE, 0); DestroySpriteAndFreeResources(sprite); } } -u8 CreateTradePokeballSprite(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 g, u32 h) +#undef sSpecies +#undef sFinalMonX +#undef sFinalMonY +#undef sTrigIdx + + +#define sTimer data[5] + +u8 CreateTradePokeballSprite(u8 monSpriteId, u8 monPalNum, u8 x, u8 y, u8 oamPriority, u8 subPriority, u8 delay, u32 fadePalettes) { u8 spriteId; - LoadCompressedSpriteSheetUsingHeap(&gBallSpriteSheets[0]); - LoadCompressedSpritePaletteUsingHeap(&gBallSpritePalettes[0]); - spriteId = CreateSprite(&gBallSpriteTemplates[0], x, y, subPriority); - gSprites[spriteId].data[0] = a; - gSprites[spriteId].data[1] = g; - gSprites[spriteId].data[2] = b; - gSprites[spriteId].data[3] = h; - gSprites[spriteId].data[4] = h >> 16; + LoadCompressedSpriteSheetUsingHeap(&gBallSpriteSheets[BALL_POKE]); + LoadCompressedSpritePaletteUsingHeap(&gBallSpritePalettes[BALL_POKE]); + spriteId = CreateSprite(&gBallSpriteTemplates[BALL_POKE], x, y, subPriority); + gSprites[spriteId].sMonSpriteId = monSpriteId; + gSprites[spriteId].sDelay = delay; + gSprites[spriteId].sMonPalNum = monPalNum; + gSprites[spriteId].sFadePalsLo = fadePalettes; + gSprites[spriteId].sFadePalsHi = fadePalettes >> 16; gSprites[spriteId].oam.priority = oamPriority; gSprites[spriteId].callback = SpriteCB_TradePokeball; return spriteId; @@ -1132,21 +1156,22 @@ u8 CreateTradePokeballSprite(u8 a, u8 b, u8 x, u8 y, u8 oamPriority, u8 subPrior static void SpriteCB_TradePokeball(struct Sprite *sprite) { - if (sprite->data[1] == 0) + if (sprite->sDelay == 0) { - u8 r6; - u8 monSpriteId = sprite->data[0]; - u8 r8 = sprite->data[2]; - u32 r5 = (u16)sprite->data[3] | ((u16)sprite->data[4] << 16); + u8 subpriority; + u8 monSpriteId = sprite->sMonSpriteId; + u8 monPalNum = sprite->sMonPalNum; + u32 selectedPalettes = (u16)sprite->sFadePalsLo | ((u16)sprite->sFadePalsHi << 16); if (sprite->subpriority != 0) - r6 = sprite->subpriority - 1; + subpriority = sprite->subpriority - 1; else - r6 = 0; + subpriority = 0; StartSpriteAnim(sprite, 1); - AnimateBallOpenParticlesForPokeball(sprite->x, sprite->y - 5, sprite->oam.priority, r6); - sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, r8, r5); + AnimateBallOpenParticlesForPokeball(sprite->x, sprite->y - 5, sprite->oam.priority, subpriority); + // sDelay re-used to store task id but never read + sprite->sDelay = LaunchBallFadeMonTaskForPokeball(1, monPalNum, selectedPalettes); sprite->callback = SpriteCB_TradePokeballSendOff; #ifdef BUGFIX // FIX: If this is used on a sprite that has previously had an affine animation, it will not @@ -1159,7 +1184,7 @@ static void SpriteCB_TradePokeball(struct Sprite *sprite) } else { - sprite->data[1]--; + sprite->sDelay--; } } @@ -1167,15 +1192,16 @@ static void SpriteCB_TradePokeballSendOff(struct Sprite *sprite) { u8 monSpriteId; - sprite->data[5]++; - if (sprite->data[5] == 11) + sprite->sTimer++; + if (sprite->sTimer == 11) PlaySE(SE_BALL_TRADE); - monSpriteId = sprite->data[0]; + + monSpriteId = sprite->sMonSpriteId; if (gSprites[monSpriteId].affineAnimEnded) { StartSpriteAnim(sprite, 2); gSprites[monSpriteId].invisible = TRUE; - sprite->data[5] = 0; + sprite->sTimer = 0; sprite->callback = SpriteCB_TradePokeballEnd; } else @@ -1191,6 +1217,13 @@ static void SpriteCB_TradePokeballEnd(struct Sprite *sprite) sprite->callback = SpriteCallbackDummy; } +#undef sMonSpriteId +#undef sDelay +#undef sMonPalNum +#undef sFadePalsLo +#undef sFadePalsHi +#undef sTimer + static void Unref_DestroySpriteAndFreeResources(struct Sprite *sprite) { DestroySpriteAndFreeResources(sprite); diff --git a/src/pokedex.c b/src/pokedex.c index 5730593e1..9592aee9c 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -4428,37 +4428,37 @@ bool16 HasAllMons(void) return TRUE; } -static void ResetOtherVideoRegisters(u16 a) +static void ResetOtherVideoRegisters(u16 regBits) { - if (!(a & DISPCNT_BG0_ON)) + if (!(regBits & DISPCNT_BG0_ON)) { ClearGpuRegBits(0, DISPCNT_BG0_ON); SetGpuReg(REG_OFFSET_BG0CNT, 0); SetGpuReg(REG_OFFSET_BG0HOFS, 0); SetGpuReg(REG_OFFSET_BG0VOFS, 0); } - if (!(a & DISPCNT_BG1_ON)) + if (!(regBits & DISPCNT_BG1_ON)) { ClearGpuRegBits(0, DISPCNT_BG1_ON); SetGpuReg(REG_OFFSET_BG1CNT, 0); SetGpuReg(REG_OFFSET_BG1HOFS, 0); SetGpuReg(REG_OFFSET_BG1VOFS, 0); } - if (!(a & DISPCNT_BG2_ON)) + if (!(regBits & DISPCNT_BG2_ON)) { ClearGpuRegBits(0, DISPCNT_BG2_ON); SetGpuReg(REG_OFFSET_BG2CNT, 0); SetGpuReg(REG_OFFSET_BG2HOFS, 0); SetGpuReg(REG_OFFSET_BG2VOFS, 0); } - if (!(a & DISPCNT_BG3_ON)) + if (!(regBits & DISPCNT_BG3_ON)) { ClearGpuRegBits(0, DISPCNT_BG3_ON); SetGpuReg(REG_OFFSET_BG3CNT, 0); SetGpuReg(REG_OFFSET_BG3HOFS, 0); SetGpuReg(REG_OFFSET_BG3VOFS, 0); } - if (!(a & DISPCNT_OBJ_ON)) + if (!(regBits & DISPCNT_OBJ_ON)) { ClearGpuRegBits(0, DISPCNT_OBJ_ON); ResetSpriteData(); diff --git a/src/pokedex_area_region_map.c b/src/pokedex_area_region_map.c index 4926c019d..ff32f8eef 100644 --- a/src/pokedex_area_region_map.c +++ b/src/pokedex_area_region_map.c @@ -63,7 +63,7 @@ void FreePokedexAreaMapBgNum(void) TRY_FREE_AND_SET_NULL(sPokedexAreaMapBgNum); } -void PokedexAreaMapChangeBgY(u32 a0) +void PokedexAreaMapChangeBgY(u32 move) { - ChangeBgY(*sPokedexAreaMapBgNum, a0 * 0x100, BG_COORD_SET); + ChangeBgY(*sPokedexAreaMapBgNum, move * 0x100, BG_COORD_SET); } diff --git a/src/pokemon.c b/src/pokemon.c index 7cdad72e9..62b535804 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5379,10 +5379,10 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit) return offset; } -static void BufferStatRoseMessage(s32 arg0) +static void BufferStatRoseMessage(s32 statIdx) { gBattlerTarget = gBattlerInMenuId; - StringCopy(gBattleTextBuff1, gStatNamesTable[sStatsToRaise[arg0]]); + StringCopy(gBattleTextBuff1, gStatNamesTable[sStatsToRaise[statIdx]]); StringCopy(gBattleTextBuff2, gText_StatRose); BattleStringExpandPlaceholdersToDisplayedString(gText_DefendersStatRose); } @@ -5798,13 +5798,13 @@ u16 GetLinkTrainerFlankId(u8 linkPlayerId) return flankId; } -s32 GetBattlerMultiplayerId(u16 a1) +s32 GetBattlerMultiplayerId(u16 id) { - s32 id; - for (id = 0; id < MAX_LINK_PLAYERS; id++) - if (gLinkPlayers[id].id == a1) + s32 multiplayerId; + for (multiplayerId = 0; multiplayerId < MAX_LINK_PLAYERS; multiplayerId++) + if (gLinkPlayers[multiplayerId].id == id) break; - return id; + return multiplayerId; } u8 GetTrainerEncounterMusicId(u16 trainerOpponentId) diff --git a/src/pokemon_jump.c b/src/pokemon_jump.c index f6aa82391..32333ee67 100755 --- a/src/pokemon_jump.c +++ b/src/pokemon_jump.c @@ -2205,7 +2205,7 @@ static bool32 AreLinkQueuesEmpty(void) return !gRfu.recvQueue.count && !gRfu.sendQueue.count; } -static int GetNumPlayersForBonus(u8 *arg0) +static int GetNumPlayersForBonus(u8 *atJumpPeak) { int i = 0; int flags = 0; @@ -2213,7 +2213,7 @@ static int GetNumPlayersForBonus(u8 *arg0) for (; i < MAX_RFU_PLAYERS; i++) { - if (arg0[i]) + if (atJumpPeak[i]) { flags |= 1 << i; count++; @@ -3612,7 +3612,6 @@ static u32 AddMessageWindow(u32 left, u32 top, u32 width, u32 height) static void CreatePokeJumpYesNoMenu(u16 left, u16 top, u8 cursorPos) { struct WindowTemplate window; - u8 a = cursorPos; window.bg = BG_INTERFACE; window.tilemapLeft = left; @@ -3622,7 +3621,7 @@ static void CreatePokeJumpYesNoMenu(u16 left, u16 top, u8 cursorPos) window.paletteNum = 2; window.baseBlock = 0x2B; - CreateYesNoMenu(&window, 1, 0xD, a); + CreateYesNoMenu(&window, 1, 0xD, cursorPos); } // "Points" for jump score and "times" for number of jumps in a row diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index a0eca498e..008fae3c9 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -8475,11 +8475,11 @@ static void MultiMove_ClearIconFromBg(u8 x, u8 y) } } -static void MultiMove_InitMove(u16 x, u16 y, u16 arg2) +static void MultiMove_InitMove(u16 x, u16 y, u16 moveSteps) { sMultiMove->bgX = x; sMultiMove->bgY = y; - sMultiMove->bgMoveSteps = arg2; + sMultiMove->bgMoveSteps = moveSteps; } static u8 MultiMove_UpdateMove(void) diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index b2bcce6cb..c25d58ae6 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -195,62 +195,62 @@ static bool8 LoadGraphics(void); static void CB2_InitSummaryScreen(void); static void InitBGs(void); static bool8 DecompressGraphics(void); -static void CopyMonToSummaryStruct(struct Pokemon* a); -static bool8 ExtractMonDataToSummaryStruct(struct Pokemon* a); +static void CopyMonToSummaryStruct(struct Pokemon*); +static bool8 ExtractMonDataToSummaryStruct(struct Pokemon*); static void SetDefaultTilemaps(void); -static void CloseSummaryScreen(u8 taskId); -static void Task_HandleInput(u8 taskId); -static void ChangeSummaryPokemon(u8 taskId, s8 a); -static void Task_ChangeSummaryMon(u8 taskId); -static s8 AdvanceMonIndex(s8 delta); -static s8 AdvanceMultiBattleMonIndex(s8 delta); -static bool8 IsValidToViewInMulti(struct Pokemon* mon); -static void ChangePage(u8 taskId, s8 a); -static void PssScrollRight(u8 taskId); -static void PssScrollRightEnd(u8 taskId); -static void PssScrollLeft(u8 taskId); -static void PssScrollLeftEnd(u8 taskId); +static void CloseSummaryScreen(u8); +static void Task_HandleInput(u8); +static void ChangeSummaryPokemon(u8, s8); +static void Task_ChangeSummaryMon(u8); +static s8 AdvanceMonIndex(s8); +static s8 AdvanceMultiBattleMonIndex(s8); +static bool8 IsValidToViewInMulti(struct Pokemon*); +static void ChangePage(u8, s8); +static void PssScrollRight(u8); +static void PssScrollRightEnd(u8); +static void PssScrollLeft(u8); +static void PssScrollLeftEnd(u8); static void TryDrawExperienceProgressBar(void); -static void SwitchToMoveSelection(u8 taskId); -static void Task_HandleInput_MoveSelect(u8 taskId); +static void SwitchToMoveSelection(u8); +static void Task_HandleInput_MoveSelect(u8); static bool8 HasMoreThanOneMove(void); -static void ChangeSelectedMove(s16 *taskData, s8 direction, u8 *moveIndexPtr); -static void CloseMoveSelectMode(u8 taskId); -static void SwitchToMovePositionSwitchMode(u8 a); -static void Task_HandleInput_MovePositionSwitch(u8 taskId); -static void ExitMovePositionSwitchMode(u8 taskId, bool8 swapMoves); -static void SwapMonMoves(struct Pokemon *mon, u8 moveIndex1, u8 moveIndex2); -static void SwapBoxMonMoves(struct BoxPokemon *mon, u8 moveIndex1, u8 moveIndex2); -static void Task_SetHandleReplaceMoveInput(u8 taskId); -static void Task_HandleReplaceMoveInput(u8 taskId); +static void ChangeSelectedMove(s16 *, s8, u8 *); +static void CloseMoveSelectMode(u8); +static void SwitchToMovePositionSwitchMode(u8); +static void Task_HandleInput_MovePositionSwitch(u8); +static void ExitMovePositionSwitchMode(u8, bool8); +static void SwapMonMoves(struct Pokemon *, u8, u8); +static void SwapBoxMonMoves(struct BoxPokemon *, u8, u8); +static void Task_SetHandleReplaceMoveInput(u8); +static void Task_HandleReplaceMoveInput(u8); static bool8 CanReplaceMove(void); -static void ShowCantForgetHMsWindow(u8 taskId); -static void Task_HandleInputCantForgetHMsMoves(u8 taskId); +static void ShowCantForgetHMsWindow(u8); +static void Task_HandleInputCantForgetHMsMoves(u8); static void DrawPagination(void); -static void HandlePowerAccTilemap(u16 a, s16 b); -static void Task_ShowPowerAccWindow(u8 taskId); -static void HandleAppealJamTilemap(u16 a, s16 b, u16 c); -static void Task_ShowAppealJamWindow(u8 taskId); -static void HandleStatusTilemap(u16 a, s16 b); -static void Task_ShowStatusWindow(u8 taskId); -static void TilemapFiveMovesDisplay(u16 *dst, u16 palette, bool8 remove); -static void DrawPokerusCuredSymbol(struct Pokemon* mon); -static void DrawExperienceProgressBar(struct Pokemon* mon); -static void DrawContestMoveHearts(u16 move); +static void HandlePowerAccTilemap(u16, s16); +static void Task_ShowPowerAccWindow(u8); +static void HandleAppealJamTilemap(u16, s16, u16); +static void Task_ShowAppealJamWindow(u8); +static void HandleStatusTilemap(u16, s16); +static void Task_ShowStatusWindow(u8); +static void TilemapFiveMovesDisplay(u16 *, u16, bool8); +static void DrawPokerusCuredSymbol(struct Pokemon*); +static void DrawExperienceProgressBar(struct Pokemon*); +static void DrawContestMoveHearts(u16); static void LimitEggSummaryPageDisplay(void); static void ResetWindows(void); static void PrintMonInfo(void); static void PrintNotEggInfo(void); static void PrintEggInfo(void); -static void PrintGenderSymbol(struct Pokemon *mon, u16 a); +static void PrintGenderSymbol(struct Pokemon *, u16); static void PrintPageNamesAndStats(void); -static void PutPageWindowTilemaps(u8 a); -static void ClearPageWindowTilemaps(u8 a); -static void RemoveWindowByIndex(u8 a); -static void PrintPageSpecificText(u8 a); -static void CreateTextPrinterTask(u8 a); +static void PutPageWindowTilemaps(u8); +static void ClearPageWindowTilemaps(u8); +static void RemoveWindowByIndex(u8); +static void PrintPageSpecificText(u8); +static void CreateTextPrinterTask(u8); static void PrintInfoPageText(void); -static void Task_PrintInfoPage(u8 taskId); +static void Task_PrintInfoPage(u8); static void PrintMonOTName(void); static void PrintMonOTID(void); static void PrintMonAbilityName(void); @@ -258,7 +258,7 @@ static void PrintMonAbilityDescription(void); static void BufferMonTrainerMemo(void); static void PrintMonTrainerMemo(void); static void BufferNatureString(void); -static void GetMetLevelString(u8 *a); +static void GetMetLevelString(u8 *); static bool8 DoesMonOTMatchOwner(void); static bool8 DidMonComeFromGBAGames(void); static bool8 IsInGamePartnerMon(void); @@ -266,7 +266,7 @@ static void PrintEggOTName(void); static void PrintEggOTID(void); static void PrintEggState(void); static void PrintEggMemo(void); -static void Task_PrintSkillsPage(u8 taskId); +static void Task_PrintSkillsPage(u8); static void PrintHeldItemName(void); static void PrintSkillsPageText(void); static void PrintRibbonCount(void); @@ -276,18 +276,18 @@ static void BufferRightColumnStats(void); static void PrintRightColumnStats(void); static void PrintExpPointsNextLevel(void); static void PrintBattleMoves(void); -static void Task_PrintBattleMoves(u8 taskId); -static void PrintMoveNameAndPP(u8 a); +static void Task_PrintBattleMoves(u8); +static void PrintMoveNameAndPP(u8); static void PrintContestMoves(void); -static void Task_PrintContestMoves(u8 taskId); -static void PrintContestMoveDescription(u8 a); -static void PrintMoveDetails(u16 a); +static void Task_PrintContestMoves(u8); +static void PrintContestMoveDescription(u8); +static void PrintMoveDetails(u16); static void PrintNewMoveDetailsOrCancelText(void); static void AddAndFillMoveNamesWindow(void); -static void SwapMovesNamesPP(u8 moveIndex1, u8 moveIndex2); +static void SwapMovesNamesPP(u8, u8); static void PrintHMMovesCantBeForgotten(void); static void ResetSpriteIds(void); -static void SetSpriteInvisibility(u8 spriteArrayId, bool8 invisible); +static void SetSpriteInvisibility(u8, bool8); static void HidePageSpecificSprites(void); static void SetTypeIcons(void); static void CreateMoveTypeIcons(void); @@ -295,20 +295,20 @@ static void SetMonTypeIcons(void); static void SetMoveTypeIcons(void); static void SetContestMoveTypeIcons(void); static void SetNewMoveTypeIcon(void); -static void SwapMovesTypeSprites(u8 moveIndex1, u8 moveIndex2); -static u8 LoadMonGfxAndSprite(struct Pokemon *a, s16 *b); -static u8 CreateMonSprite(struct Pokemon *unused); +static void SwapMovesTypeSprites(u8, u8); +static u8 LoadMonGfxAndSprite(struct Pokemon *, s16 *); +static u8 CreateMonSprite(struct Pokemon *); static void SpriteCB_Pokemon(struct Sprite *); static void StopPokemonAnimations(void); -static void CreateMonMarkingsSprite(struct Pokemon *mon); -static void RemoveAndCreateMonMarkingsSprite(struct Pokemon *mon); -static void CreateCaughtBallSprite(struct Pokemon *mon); +static void CreateMonMarkingsSprite(struct Pokemon *); +static void RemoveAndCreateMonMarkingsSprite(struct Pokemon *); +static void CreateCaughtBallSprite(struct Pokemon *); static void CreateSetStatusSprite(void); -static void CreateMoveSelectorSprites(u8 idArrayStart); -static void SpriteCb_MoveSelector(struct Sprite *sprite); -static void DestroyMoveSelectorSprites(u8 firstArrayId); -static void SetMainMoveSelectorColor(u8 whichColor); -static void KeepMoveSelectorVisible(u8 firstSpriteId); +static void CreateMoveSelectorSprites(u8); +static void SpriteCb_MoveSelector(struct Sprite *); +static void DestroyMoveSelectorSprites(u8); +static void SetMainMoveSelectorColor(u8); +static void KeepMoveSelectorVisible(u8); static void SummaryScreen_DestroyAnimDelayTask(void); // const rom data diff --git a/src/pokenav.c b/src/pokenav.c index 04e87f38c..03f48ee36 100644 --- a/src/pokenav.c +++ b/src/pokenav.c @@ -37,16 +37,16 @@ struct PokenavCallbacks static u32 GetCurrentMenuCB(void); static u32 IsActiveMenuLoopTaskActive_(void); -static bool32 SetActivePokenavMenu(u32 menuId); +static bool32 SetActivePokenavMenu(u32); static bool32 AnyMonHasRibbon(void); -static void InitPokenavResources(struct PokenavResources *a0); +static void InitPokenavResources(struct PokenavResources *); static void InitKeys_(void); static void FreePokenavResources(void); static void VBlankCB_Pokenav(void); static void CB2_Pokenav(void); -static void Task_RunLoopedTask_LinkMode(u8 a0); -static void Task_RunLoopedTask(u8 taskId); -static void Task_Pokenav(u8 taskId); +static void Task_RunLoopedTask_LinkMode(u8); +static void Task_RunLoopedTask(u8); +static void Task_Pokenav(u8); static void CB2_InitPokenavForTutorial(void); const struct PokenavCallbacks PokenavMenuCallbacks[15] = diff --git a/src/pokenav_conditions.c b/src/pokenav_conditions.c index 94ed4e8d8..e0645bac0 100644 --- a/src/pokenav_conditions.c +++ b/src/pokenav_conditions.c @@ -332,7 +332,7 @@ u8 *CopyStringLeftAlignedToConditionData(u8 *dst, const u8 *src, s16 n) return dst; } -static u8 *CopyConditionMonNameGender(u8 *str, u16 listId, bool8 arg3) +static u8 *CopyConditionMonNameGender(u8 *str, u16 listId, bool8 skipPadding) { u16 boxId, monId, gender, species, level, lvlDigits; struct BoxPokemon *boxMon; @@ -412,7 +412,7 @@ static u8 *CopyConditionMonNameGender(u8 *str, u16 listId, bool8 arg3) str_ = ConvertIntToDecimalStringN(str_, level, STR_CONV_MODE_LEFT_ALIGN, 3); lvlDigits = str_ - txtPtr; *(str_++) = CHAR_SPACE; - if (!arg3) + if (!skipPadding) { lvlDigits = 3 - lvlDigits; while (lvlDigits-- != 0) diff --git a/src/pokenav_list.c b/src/pokenav_list.c index bdba1d2c0..350a78504 100644 --- a/src/pokenav_list.c +++ b/src/pokenav_list.c @@ -40,7 +40,7 @@ struct PokenavListWindowState { struct PokenavListSub { struct PokenavListMenuWindow listWindow; - u32 unk10; + u32 printStart; u32 printIndex; u32 itemSize; void * listPtr; @@ -59,7 +59,7 @@ struct PokenavListSub struct PokenavList { - struct PokenavListSub list; + struct PokenavListSub sub; u8 tilemapBuffer[BG_SCREEN_SIZE]; struct PokenavListWindowState windowState; s32 eraseIndex; @@ -100,12 +100,12 @@ static EWRAM_DATA u32 sMoveWindowDownIndex = 0; // Read, but pointlessly bool32 CreatePokenavList(const struct BgTemplate *bgTemplate, struct PokenavListTemplate *listTemplate, s32 tileOffset) { - struct PokenavList *structPtr = AllocSubstruct(POKENAV_SUBSTRUCT_LIST, sizeof(struct PokenavList)); - if (structPtr == NULL) + struct PokenavList *list = AllocSubstruct(POKENAV_SUBSTRUCT_LIST, sizeof(struct PokenavList)); + if (list == NULL) return FALSE; - InitPokenavListWindowState(&structPtr->windowState, listTemplate); - if (!CopyPokenavListMenuTemplate(&structPtr->list, bgTemplate, listTemplate, tileOffset)) + InitPokenavListWindowState(&list->windowState, listTemplate); + if (!CopyPokenavListMenuTemplate(&list->sub, bgTemplate, listTemplate, tileOffset)) return FALSE; CreateLoopedTask(LoopedTask_CreatePokenavList, 6); @@ -119,31 +119,31 @@ bool32 IsCreatePokenavListTaskActive(void) void DestroyPokenavList(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - DestroyListArrows(&structPtr->list); - RemoveWindow(structPtr->list.listWindow.windowId); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + DestroyListArrows(&list->sub); + RemoveWindow(list->sub.listWindow.windowId); FreePokenavSubstruct(POKENAV_SUBSTRUCT_LIST); } static u32 LoopedTask_CreatePokenavList(s32 state) { - struct PokenavList *structPtr; + struct PokenavList *list; if (IsDma3ManagerBusyWithBgCopy()) return LT_PAUSE; - structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); switch (state) { case 0: - InitPokenavListBg(structPtr); + InitPokenavListBg(list); return LT_INC_AND_PAUSE; case 1: - InitPokenavListWindow(&structPtr->list.listWindow); + InitPokenavListWindow(&list->sub.listWindow); return LT_INC_AND_PAUSE; case 2: - InitListItems(&structPtr->windowState, &structPtr->list); + InitListItems(&list->windowState, &list->sub); return LT_INC_AND_PAUSE; case 3: if (IsPrintListItemsTaskActive()) @@ -156,24 +156,24 @@ static u32 LoopedTask_CreatePokenavList(s32 state) return LT_INC_AND_CONTINUE; } case 4: - CreateListArrowSprites(&structPtr->windowState, &structPtr->list); + CreateListArrowSprites(&list->windowState, &list->sub); return LT_FINISH; default: return LT_FINISH; } } -static void InitPokenavListBg(struct PokenavList *a0) +static void InitPokenavListBg(struct PokenavList *list) { - u16 tileNum = (a0->list.listWindow.fillValue << 12) | a0->list.listWindow.tileOffset; - BgDmaFill(a0->list.listWindow.bg, PIXEL_FILL(1), a0->list.listWindow.tileOffset, 1); - BgDmaFill(a0->list.listWindow.bg, PIXEL_FILL(4), a0->list.listWindow.tileOffset + 1, 1); - SetBgTilemapBuffer(a0->list.listWindow.bg, a0->tilemapBuffer); - FillBgTilemapBufferRect_Palette0(a0->list.listWindow.bg, tileNum, 0, 0, 32, 32); - ChangeBgY(a0->list.listWindow.bg, 0, BG_COORD_SET); - ChangeBgX(a0->list.listWindow.bg, 0, BG_COORD_SET); - ChangeBgY(a0->list.listWindow.bg, a0->list.listWindow.y << 11, BG_COORD_SUB); - CopyBgTilemapBufferToVram(a0->list.listWindow.bg); + u16 tileNum = (list->sub.listWindow.fillValue << 12) | list->sub.listWindow.tileOffset; + BgDmaFill(list->sub.listWindow.bg, PIXEL_FILL(1), list->sub.listWindow.tileOffset, 1); + BgDmaFill(list->sub.listWindow.bg, PIXEL_FILL(4), list->sub.listWindow.tileOffset + 1, 1); + SetBgTilemapBuffer(list->sub.listWindow.bg, list->tilemapBuffer); + FillBgTilemapBufferRect_Palette0(list->sub.listWindow.bg, tileNum, 0, 0, 32, 32); + ChangeBgY(list->sub.listWindow.bg, 0, BG_COORD_SET); + ChangeBgX(list->sub.listWindow.bg, 0, BG_COORD_SET); + ChangeBgY(list->sub.listWindow.bg, list->sub.listWindow.y << 11, BG_COORD_SUB); + CopyBgTilemapBufferToVram(list->sub.listWindow.bg); } static void InitPokenavListWindow(struct PokenavListMenuWindow *listWindow) @@ -183,16 +183,16 @@ static void InitPokenavListWindow(struct PokenavListMenuWindow *listWindow) CopyWindowToVram(listWindow->windowId, COPYWIN_MAP); } -static void InitListItems(struct PokenavListWindowState *windowState, struct PokenavListSub *a1) +static void InitListItems(struct PokenavListWindowState *windowState, struct PokenavListSub *subPtr) { s32 numToPrint = windowState->listLength - windowState->windowTopIndex; if (numToPrint > windowState->entriesOnscreen) numToPrint = windowState->entriesOnscreen; - PrintListItems(windowState->listPtr, windowState->windowTopIndex, numToPrint, windowState->listItemSize, 0, a1); + PrintListItems(windowState->listPtr, windowState->windowTopIndex, numToPrint, windowState->listItemSize, 0, subPtr); } -static void PrintListItems(void * listPtr, u32 topIndex, u32 numItems, u32 itemSize, u32 a4, struct PokenavListSub *list) +static void PrintListItems(void * listPtr, u32 topIndex, u32 numItems, u32 itemSize, u32 printStart, struct PokenavListSub *list) { if (numItems == 0) return; @@ -202,7 +202,7 @@ static void PrintListItems(void * listPtr, u32 topIndex, u32 numItems, u32 itemS list->listWindow.numPrinted = 0; list->listWindow.numToPrint = numItems; list->printIndex = topIndex; - list->unk10 = a4; + list->printStart = printStart; CreateLoopedTask(LoopedTask_PrintListItems, 5); } @@ -214,31 +214,31 @@ static bool32 IsPrintListItemsTaskActive(void) static u32 LoopedTask_PrintListItems(s32 state) { u32 row; - struct PokenavListSub *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavListSub *listSub = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); switch (state) { case 0: - row = (structPtr->listWindow.unkA + structPtr->listWindow.numPrinted + structPtr->unk10) & 0xF; - structPtr->bufferItemFunc(structPtr->listPtr, structPtr->itemTextBuffer); - if (structPtr->iconDrawFunc != NULL) - structPtr->iconDrawFunc(structPtr->listWindow.windowId, structPtr->printIndex, row); + row = (listSub->listWindow.unkA + listSub->listWindow.numPrinted + listSub->printStart) & 0xF; + listSub->bufferItemFunc(listSub->listPtr, listSub->itemTextBuffer); + if (listSub->iconDrawFunc != NULL) + listSub->iconDrawFunc(listSub->listWindow.windowId, listSub->printIndex, row); - AddTextPrinterParameterized(structPtr->listWindow.windowId, structPtr->listWindow.fontId, structPtr->itemTextBuffer, 8, (row << 4) + 1, TEXT_SKIP_DRAW, NULL); - if (++structPtr->listWindow.numPrinted >= structPtr->listWindow.numToPrint) + AddTextPrinterParameterized(listSub->listWindow.windowId, listSub->listWindow.fontId, listSub->itemTextBuffer, 8, (row << 4) + 1, TEXT_SKIP_DRAW, NULL); + if (++listSub->listWindow.numPrinted >= listSub->listWindow.numToPrint) { // Finished printing items. If icons were being drawn, draw the // window tilemap and graphics. Otherwise just do the graphics - if (structPtr->iconDrawFunc != NULL) - CopyWindowToVram(structPtr->listWindow.windowId, COPYWIN_FULL); + if (listSub->iconDrawFunc != NULL) + CopyWindowToVram(listSub->listWindow.windowId, COPYWIN_FULL); else - CopyWindowToVram(structPtr->listWindow.windowId, COPYWIN_GFX); + CopyWindowToVram(listSub->listWindow.windowId, COPYWIN_GFX); return LT_INC_AND_PAUSE; } else { - structPtr->listPtr += structPtr->itemSize; - structPtr->printIndex++; + listSub->listPtr += listSub->itemSize; + listSub->printIndex++; return LT_CONTINUE; } case 1: @@ -251,42 +251,42 @@ static u32 LoopedTask_PrintListItems(s32 state) static bool32 ShouldShowUpArrow(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - return (structPtr->windowState.windowTopIndex != 0); + return (list->windowState.windowTopIndex != 0); } static bool32 ShouldShowDownArrow(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - struct PokenavListWindowState *subPtr = &structPtr->windowState; + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavListWindowState *windowState = &list->windowState; - return (subPtr->windowTopIndex + subPtr->entriesOnscreen < subPtr->listLength); + return (windowState->windowTopIndex + windowState->entriesOnscreen < windowState->listLength); } static void MoveListWindow(s32 delta, bool32 printItems) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - struct PokenavListWindowState *subPtr = &structPtr->windowState; + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavListWindowState *windowState = &list->windowState; if (delta < 0) { - if (subPtr->windowTopIndex + delta < 0) - delta = -1 * subPtr->windowTopIndex; + if (windowState->windowTopIndex + delta < 0) + delta = -1 * windowState->windowTopIndex; if (printItems) - PrintListItems(subPtr->listPtr, subPtr->windowTopIndex + delta, delta * -1, subPtr->listItemSize, delta, &structPtr->list); + PrintListItems(windowState->listPtr, windowState->windowTopIndex + delta, delta * -1, windowState->listItemSize, delta, &list->sub); } else if (printItems) { - s32 index = sMoveWindowDownIndex = subPtr->windowTopIndex + subPtr->entriesOnscreen; - if (index + delta >= subPtr->listLength) - delta = subPtr->listLength - index; + s32 index = sMoveWindowDownIndex = windowState->windowTopIndex + windowState->entriesOnscreen; + if (index + delta >= windowState->listLength) + delta = windowState->listLength - index; - PrintListItems(subPtr->listPtr, index, delta, subPtr->listItemSize, subPtr->entriesOnscreen, &structPtr->list); + PrintListItems(windowState->listPtr, index, delta, windowState->listItemSize, windowState->entriesOnscreen, &list->sub); } - CreateMoveListWindowTask(delta, &structPtr->list); - subPtr->windowTopIndex += delta; + CreateMoveListWindowTask(delta, &list->sub); + windowState->windowTopIndex += delta; } static void CreateMoveListWindowTask(s32 delta, struct PokenavListSub *list) @@ -305,8 +305,8 @@ static u32 LoopedTask_MoveListWindow(s32 state) { s32 oldY, newY; bool32 finished; - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - struct PokenavListSub *subPtr = &structPtr->list; + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavListSub *subPtr = &list->sub; switch (state) { @@ -342,23 +342,23 @@ static u32 LoopedTask_MoveListWindow(s32 state) bool32 PokenavList_IsMoveWindowTaskActive(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - return IsLoopedTaskActive(structPtr->list.loopedTaskId); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + return IsLoopedTaskActive(list->sub.loopedTaskId); } static struct PokenavListWindowState *GetPokenavListWindowState(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - return &structPtr->windowState; + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + return &list->windowState; } int PokenavList_MoveCursorUp(void) { - struct PokenavListWindowState *structPtr = GetPokenavListWindowState(); + struct PokenavListWindowState *windowState = GetPokenavListWindowState(); - if (structPtr->selectedIndexOffset != 0) + if (windowState->selectedIndexOffset != 0) { - structPtr->selectedIndexOffset--; + windowState->selectedIndexOffset--; return 1; } if (ShouldShowUpArrow()) @@ -371,13 +371,13 @@ int PokenavList_MoveCursorUp(void) int PokenavList_MoveCursorDown(void) { - struct PokenavListWindowState *structPtr = GetPokenavListWindowState(); + struct PokenavListWindowState *windowState = GetPokenavListWindowState(); - if (structPtr->windowTopIndex + structPtr->selectedIndexOffset >= structPtr->listLength - 1) + if (windowState->windowTopIndex + windowState->selectedIndexOffset >= windowState->listLength - 1) return 0; - if (structPtr->selectedIndexOffset < structPtr->entriesOnscreen - 1) + if (windowState->selectedIndexOffset < windowState->entriesOnscreen - 1) { - structPtr->selectedIndexOffset++; + windowState->selectedIndexOffset++; return 1; } if (ShouldShowDownArrow()) @@ -391,20 +391,20 @@ int PokenavList_MoveCursorDown(void) int PokenavList_PageUp(void) { s32 scroll; - struct PokenavListWindowState *structPtr = GetPokenavListWindowState(); + struct PokenavListWindowState *windowState = GetPokenavListWindowState(); if (ShouldShowUpArrow()) { - if (structPtr->windowTopIndex >= structPtr->entriesOnscreen) - scroll = structPtr->entriesOnscreen; + if (windowState->windowTopIndex >= windowState->entriesOnscreen) + scroll = windowState->entriesOnscreen; else - scroll = structPtr->windowTopIndex; + scroll = windowState->windowTopIndex; MoveListWindow(scroll * -1, TRUE); return 2; } - else if (structPtr->selectedIndexOffset != 0) + else if (windowState->selectedIndexOffset != 0) { - structPtr->selectedIndexOffset = 0; + windowState->selectedIndexOffset = 0; return 1; } return 0; @@ -412,112 +412,112 @@ int PokenavList_PageUp(void) int PokenavList_PageDown(void) { - struct PokenavListWindowState *structPtr = GetPokenavListWindowState(); + struct PokenavListWindowState *windowState = GetPokenavListWindowState(); if (ShouldShowDownArrow()) { - s32 windowBottomIndex = structPtr->windowTopIndex + structPtr->entriesOnscreen; - s32 scroll = structPtr->entriesOffscreen - structPtr->windowTopIndex; + s32 windowBottomIndex = windowState->windowTopIndex + windowState->entriesOnscreen; + s32 scroll = windowState->entriesOffscreen - windowState->windowTopIndex; - if (windowBottomIndex <= structPtr->entriesOffscreen) - scroll = structPtr->entriesOnscreen; + if (windowBottomIndex <= windowState->entriesOffscreen) + scroll = windowState->entriesOnscreen; MoveListWindow(scroll, TRUE); return 2; } else { s32 cursor, lastVisibleIndex; - if (structPtr->listLength >= structPtr->entriesOnscreen) + if (windowState->listLength >= windowState->entriesOnscreen) { - cursor = structPtr->selectedIndexOffset; - lastVisibleIndex = structPtr->entriesOnscreen; + cursor = windowState->selectedIndexOffset; + lastVisibleIndex = windowState->entriesOnscreen; } else { - cursor = structPtr->selectedIndexOffset; - lastVisibleIndex = structPtr->listLength; + cursor = windowState->selectedIndexOffset; + lastVisibleIndex = windowState->listLength; } lastVisibleIndex -= 1; if (cursor >= lastVisibleIndex) return 0; - structPtr->selectedIndexOffset = lastVisibleIndex; + windowState->selectedIndexOffset = lastVisibleIndex; return 1; } } u32 PokenavList_GetSelectedIndex(void) { - struct PokenavListWindowState *structPtr = GetPokenavListWindowState(); + struct PokenavListWindowState *windowState = GetPokenavListWindowState(); - return structPtr->windowTopIndex + structPtr->selectedIndexOffset; + return windowState->windowTopIndex + windowState->selectedIndexOffset; } u32 PokenavList_GetTopIndex(void) { - struct PokenavListWindowState *structPtr = GetPokenavListWindowState(); + struct PokenavListWindowState *windowState = GetPokenavListWindowState(); - return structPtr->windowTopIndex; + return windowState->windowTopIndex; } void PokenavList_EraseListForCheckPage(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - structPtr->eraseIndex = 0; - structPtr->loopedTaskId = CreateLoopedTask(LoopedTask_EraseListForCheckPage, 6); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + list->eraseIndex = 0; + list->loopedTaskId = CreateLoopedTask(LoopedTask_EraseListForCheckPage, 6); } void PrintCheckPageInfo(s16 delta) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - structPtr->windowState.windowTopIndex += delta; - structPtr->eraseIndex = 0; - structPtr->loopedTaskId = CreateLoopedTask(LoopedTask_PrintCheckPageInfo, 6); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + list->windowState.windowTopIndex += delta; + list->eraseIndex = 0; + list->loopedTaskId = CreateLoopedTask(LoopedTask_PrintCheckPageInfo, 6); } void PokenavList_ReshowListFromCheckPage(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - structPtr->eraseIndex = 0; - structPtr->loopedTaskId = CreateLoopedTask(LoopedTask_ReshowListFromCheckPage, 6); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + list->eraseIndex = 0; + list->loopedTaskId = CreateLoopedTask(LoopedTask_ReshowListFromCheckPage, 6); } bool32 PokenavList_IsTaskActive(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - return IsLoopedTaskActive(structPtr->loopedTaskId); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + return IsLoopedTaskActive(list->loopedTaskId); } void PokenavList_DrawCurrentItemIcon(void) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - struct PokenavListWindowState *subPtr = &structPtr->windowState; - structPtr->list.iconDrawFunc(structPtr->list.listWindow.windowId, subPtr->windowTopIndex + subPtr->selectedIndexOffset, (structPtr->list.listWindow.unkA + subPtr->selectedIndexOffset) & 0xF); - CopyWindowToVram(structPtr->list.listWindow.windowId, COPYWIN_MAP); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavListWindowState *windowState = &list->windowState; + list->sub.iconDrawFunc(list->sub.listWindow.windowId, windowState->windowTopIndex + windowState->selectedIndexOffset, (list->sub.listWindow.unkA + windowState->selectedIndexOffset) & 0xF); + CopyWindowToVram(list->sub.listWindow.windowId, COPYWIN_MAP); } static u32 LoopedTask_EraseListForCheckPage(s32 state) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); switch (state) { case 0: - ToggleListArrows(&structPtr->list, 1); + ToggleListArrows(&list->sub, 1); // fall-through case 1: - if (structPtr->eraseIndex != structPtr->windowState.selectedIndexOffset) - EraseListEntry(&structPtr->list.listWindow, structPtr->eraseIndex, 1); + if (list->eraseIndex != list->windowState.selectedIndexOffset) + EraseListEntry(&list->sub.listWindow, list->eraseIndex, 1); - structPtr->eraseIndex++; + list->eraseIndex++; return LT_INC_AND_PAUSE; case 2: if (!IsDma3ManagerBusyWithBgCopy()) { - if (structPtr->eraseIndex != structPtr->windowState.entriesOnscreen) + if (list->eraseIndex != list->windowState.entriesOnscreen) return LT_SET_STATE(1); - if (structPtr->windowState.selectedIndexOffset != 0) - EraseListEntry(&structPtr->list.listWindow, structPtr->eraseIndex, structPtr->windowState.selectedIndexOffset); + if (list->windowState.selectedIndexOffset != 0) + EraseListEntry(&list->sub.listWindow, list->eraseIndex, list->windowState.selectedIndexOffset); return LT_INC_AND_PAUSE; } @@ -525,9 +525,9 @@ static u32 LoopedTask_EraseListForCheckPage(s32 state) case 3: if (!IsDma3ManagerBusyWithBgCopy()) { - if (structPtr->windowState.selectedIndexOffset != 0) + if (list->windowState.selectedIndexOffset != 0) { - MoveListWindow(structPtr->windowState.selectedIndexOffset, FALSE); + MoveListWindow(list->windowState.selectedIndexOffset, FALSE); return LT_INC_AND_PAUSE; } return LT_FINISH; @@ -537,7 +537,7 @@ static u32 LoopedTask_EraseListForCheckPage(s32 state) if (PokenavList_IsMoveWindowTaskActive()) return LT_PAUSE; - structPtr->windowState.selectedIndexOffset = 0; + list->windowState.selectedIndexOffset = 0; return LT_FINISH; } return LT_FINISH; @@ -545,35 +545,35 @@ static u32 LoopedTask_EraseListForCheckPage(s32 state) static u32 LoopedTask_PrintCheckPageInfo(s32 state) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); if (IsDma3ManagerBusyWithBgCopy()) return LT_PAUSE; switch (state) { case 0: - PrintCheckPageTrainerName(&structPtr->windowState, &structPtr->list); + PrintCheckPageTrainerName(&list->windowState, &list->sub); break; case 1: - PrintMatchCallFieldNames(&structPtr->list, 0); + PrintMatchCallFieldNames(&list->sub, 0); break; case 2: - PrintMatchCallFlavorText(&structPtr->windowState, &structPtr->list, CHECK_PAGE_STRATEGY); + PrintMatchCallFlavorText(&list->windowState, &list->sub, CHECK_PAGE_STRATEGY); break; case 3: - PrintMatchCallFieldNames(&structPtr->list, 1); + PrintMatchCallFieldNames(&list->sub, 1); break; case 4: - PrintMatchCallFlavorText(&structPtr->windowState, &structPtr->list, CHECK_PAGE_POKEMON); + PrintMatchCallFlavorText(&list->windowState, &list->sub, CHECK_PAGE_POKEMON); break; case 5: - PrintMatchCallFieldNames(&structPtr->list, 2); + PrintMatchCallFieldNames(&list->sub, 2); break; case 6: - PrintMatchCallFlavorText(&structPtr->windowState, &structPtr->list, CHECK_PAGE_INTRO_1); + PrintMatchCallFlavorText(&list->windowState, &list->sub, CHECK_PAGE_INTRO_1); break; case 7: - PrintMatchCallFlavorText(&structPtr->windowState, &structPtr->list, CHECK_PAGE_INTRO_2); + PrintMatchCallFlavorText(&list->windowState, &list->sub, CHECK_PAGE_INTRO_2); break; default: return LT_FINISH; @@ -583,30 +583,30 @@ static u32 LoopedTask_PrintCheckPageInfo(s32 state) static u32 LoopedTask_ReshowListFromCheckPage(s32 state) { - struct PokenavList *structPtr; + struct PokenavList *list; struct PokenavListWindowState *windowState; - struct PokenavListSub *subPtr0; + struct PokenavListSub *subPtr; s32 r5, *ptr; if (IsDma3ManagerBusyWithBgCopy()) return LT_PAUSE; - structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - windowState = &structPtr->windowState; - subPtr0 = &structPtr->list; + list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + windowState = &list->windowState; + subPtr = &list->sub; switch (state) { case 0: // Rewrite the name of the trainer whose check page was just being viewed. // This is done to erase the red background it had. - PrintMatchCallListTrainerName(windowState, subPtr0); + PrintMatchCallListTrainerName(windowState, subPtr); return LT_INC_AND_PAUSE; case 1: - ptr = &structPtr->eraseIndex; - if (++(*ptr) < structPtr->windowState.entriesOnscreen) + ptr = &list->eraseIndex; + if (++(*ptr) < list->windowState.entriesOnscreen) { - EraseListEntry(&subPtr0->listWindow, *ptr, 1); + EraseListEntry(&subPtr->listWindow, *ptr, 1); return LT_PAUSE; } @@ -617,7 +617,7 @@ static u32 LoopedTask_ReshowListFromCheckPage(s32 state) { s32 r4 = windowState->windowTopIndex; r5 = -r4; - EraseListEntry(&subPtr0->listWindow, r5, r4); + EraseListEntry(&subPtr->listWindow, r5, r4); windowState->selectedIndexOffset = r4; *ptr = r5; return LT_INC_AND_PAUSE; @@ -629,7 +629,7 @@ static u32 LoopedTask_ReshowListFromCheckPage(s32 state) { s32 r4 = windowState->windowTopIndex + windowState->entriesOnscreen - windowState->listLength; r5 = -r4; - EraseListEntry(&subPtr0->listWindow, r5, r4); + EraseListEntry(&subPtr->listWindow, r5, r4); windowState->selectedIndexOffset = r4; *ptr = r5; return LT_INC_AND_PAUSE; @@ -637,55 +637,55 @@ static u32 LoopedTask_ReshowListFromCheckPage(s32 state) } return LT_SET_STATE(4); case 2: - MoveListWindow(structPtr->eraseIndex, FALSE); + MoveListWindow(list->eraseIndex, FALSE); return LT_INC_AND_PAUSE; case 3: if (!PokenavList_IsMoveWindowTaskActive()) { - structPtr->eraseIndex = 0; + list->eraseIndex = 0; return LT_INC_AND_CONTINUE; } return LT_PAUSE; case 4: - PrintListItems(windowState->listPtr, windowState->windowTopIndex + structPtr->eraseIndex, 1, windowState->listItemSize, structPtr->eraseIndex, &structPtr->list); + PrintListItems(windowState->listPtr, windowState->windowTopIndex + list->eraseIndex, 1, windowState->listItemSize, list->eraseIndex, &list->sub); return LT_INC_AND_PAUSE; case 5: if (IsPrintListItemsTaskActive()) return LT_PAUSE; - if (++structPtr->eraseIndex >= windowState->listLength || structPtr->eraseIndex >= windowState->entriesOnscreen) + if (++list->eraseIndex >= windowState->listLength || list->eraseIndex >= windowState->entriesOnscreen) return LT_INC_AND_CONTINUE; return LT_SET_STATE(4); case 6: - ToggleListArrows(subPtr0, 0); + ToggleListArrows(subPtr, 0); return LT_FINISH; } return LT_FINISH; } -static void EraseListEntry(struct PokenavListMenuWindow *listWindow, s32 a1, s32 a2) +static void EraseListEntry(struct PokenavListMenuWindow *listWindow, s32 offset, s32 entries) { u8 *tileData = (u8*)GetWindowAttribute(listWindow->windowId, WINDOW_TILE_DATA); u32 width = listWindow->width * 64; - a1 = (listWindow->unkA + a1) & 0xF; - if (a1 + a2 <= 16) + offset = (listWindow->unkA + offset) & 0xF; + if (offset + entries <= 16) { - CpuFastFill8(PIXEL_FILL(1), tileData + a1 * width, a2 * width); + CpuFastFill8(PIXEL_FILL(1), tileData + offset * width, entries * width); CopyWindowToVram(listWindow->windowId, COPYWIN_GFX); } else { - u32 v3 = 16 - a1; - u32 v4 = a2 - v3; + u32 v3 = 16 - offset; + u32 v4 = entries - v3; - CpuFastFill8(PIXEL_FILL(1), tileData + a1 * width, v3 * width); + CpuFastFill8(PIXEL_FILL(1), tileData + offset * width, v3 * width); CpuFastFill8(PIXEL_FILL(1), tileData, v4 * width); CopyWindowToVram(listWindow->windowId, COPYWIN_GFX); } - for (a2--; a2 != -1; a1 = (a1 + 1) & 0xF, a2--) - ClearRematchPokeballIcon(listWindow->windowId, a1); + for (entries--; entries != -1; offset = (offset + 1) & 0xF, entries--) + ClearRematchPokeballIcon(listWindow->windowId, offset); CopyWindowToVram(listWindow->windowId, COPYWIN_MAP); } @@ -744,7 +744,7 @@ static void PrintMatchCallFieldNames(struct PokenavListSub *list, u32 fieldId) CopyWindowRectToVram(list->listWindow.windowId, COPYWIN_GFX, 0, top << 1, list->listWindow.width, 2); } -static void PrintMatchCallFlavorText(struct PokenavListWindowState *a0, struct PokenavListSub *list, u32 checkPageEntry) +static void PrintMatchCallFlavorText(struct PokenavListWindowState *windowState, struct PokenavListSub *list, u32 checkPageEntry) { // lines 1, 3, and 5 are the field names printed by PrintMatchCallFieldNames static const u8 lineOffsets[CHECK_PAGE_ENTRY_COUNT] = { @@ -755,7 +755,7 @@ static void PrintMatchCallFlavorText(struct PokenavListWindowState *a0, struct P }; u32 r6 = (list->listWindow.unkA + lineOffsets[checkPageEntry]) & 0xF; - const u8 *str = GetMatchCallFlavorText(a0->windowTopIndex, checkPageEntry); + const u8 *str = GetMatchCallFlavorText(windowState->windowTopIndex, checkPageEntry); if (str != NULL) { @@ -894,8 +894,8 @@ static void ToggleListArrows(struct PokenavListSub *list, bool32 invisible) static void SpriteCB_RightArrow(struct Sprite *sprite) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - sprite->y2 = structPtr->windowState.selectedIndexOffset << 4; + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + sprite->y2 = list->windowState.selectedIndexOffset << 4; } #define sTimer data[0] @@ -940,9 +940,9 @@ static void SpriteCB_UpArrow(struct Sprite *sprite) void PokenavList_ToggleVerticalArrows(bool32 invisible) { - struct PokenavList *structPtr = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); - structPtr->list.upArrow->sInvisible = invisible; - structPtr->list.downArrow->sInvisible = invisible; + struct PokenavList *list = GetSubstructPtr(POKENAV_SUBSTRUCT_LIST); + list->sub.upArrow->sInvisible = invisible; + list->sub.downArrow->sInvisible = invisible; } #undef sTimer diff --git a/src/rotating_tile_puzzle.c b/src/rotating_tile_puzzle.c index b8912aa3d..4581f6e5b 100644 --- a/src/rotating_tile_puzzle.c +++ b/src/rotating_tile_puzzle.c @@ -81,14 +81,11 @@ static const u8 sMovement_FaceUp[] = MOVEMENT_ACTION_STEP_END }; -// This file's functions. -static void SaveRotatingTileObject(u8 eventTemplateId, u8 arg1); -static void TurnUnsavedRotatingTileObject(u8 eventTemplateId, u8 arg1); +static void SaveRotatingTileObject(u8, u8); +static void TurnUnsavedRotatingTileObject(u8, u8); -// EWRAM vars EWRAM_DATA static struct RotatingTilePuzzle *sRotatingTilePuzzle = NULL; -// code void InitRotatingTilePuzzle(bool8 isTrickHouse) { if (sRotatingTilePuzzle == NULL) diff --git a/src/slot_machine.c b/src/slot_machine.c index 4796a5684..cb6a380d6 100644 --- a/src/slot_machine.c +++ b/src/slot_machine.c @@ -3861,21 +3861,15 @@ static void ReelTime_EndFailure(struct Task *task) static void LoadReelTimeWindowTilemap(s16 a0, s16 a1) { s16 i; - for (i = 4; i < 15; i++) - { LoadBgTilemap(1, &sReelTimeWindow_Tilemap[a1 + (i - 4) * 20], 2, 32 * i + a0); - } } static void ClearReelTimeWindowTilemap(s16 a0) { u8 i; - for (i = 4; i < 15; i++) - { LoadBgTilemap(1, sEmptyTilemap, 2, 32 * i + a0); - } } #undef tState @@ -4112,32 +4106,44 @@ static void CreateCreditPayoutNumberSprites(void) CreateCoinNumberSprite(x, 23, TRUE, i); } -static void CreateCoinNumberSprite(s16 x, s16 y, bool8 isPayout, s16 a3) +#define sIsPayout data[0] +#define sDigitMin data[1] +#define sDigitMax data[2] +#define sCurNum data[3] // Only used to determine whether the sprite has already been updated to show the correct digit + +static void CreateCoinNumberSprite(s16 x, s16 y, bool8 isPayout, s16 digitMult) { struct Sprite *sprite = &gSprites[CreateSprite(&sSpriteTemplate_CoinNumber, x, y, 13)]; sprite->oam.priority = 2; - sprite->data[0] = isPayout; - sprite->data[1] = a3; - sprite->data[2] = a3 * 10; - sprite->data[3] = -1; + sprite->sIsPayout = isPayout; + sprite->sDigitMin = digitMult; + sprite->sDigitMax = digitMult * 10; + sprite->sCurNum = -1; } static void SpriteCB_CoinNumber(struct Sprite *sprite) { u16 tag = sSlotMachine->coins; - if (sprite->data[0]) + if (sprite->sIsPayout) tag = sSlotMachine->payout; - if (sprite->data[3] != tag) + if (sprite->sCurNum != tag) { - sprite->data[3] = tag; - tag %= (u16)sprite->data[2]; - tag /= (u16)sprite->data[1]; - tag += 7; + // Convert total to current digit + sprite->sCurNum = tag; + tag %= (u16)sprite->sDigitMax; + tag /= (u16)sprite->sDigitMin; + + tag += GFXTAG_NUM_0; sprite->sheetTileStart = GetSpriteTileStartByTag(tag); SetSpriteSheetFrameTileNum(sprite); } } +#undef sIsPayout +#undef sDigitMin +#undef sDigitMax +#undef sCurNum + static void CreateReelBackgroundSprite(void) { u8 spriteId = CreateSprite(&sSpriteTemplate_ReelBackground, 88, 72, 15); diff --git a/src/trade.c b/src/trade.c index f95b479fe..df3cb4d33 100644 --- a/src/trade.c +++ b/src/trade.c @@ -2435,7 +2435,7 @@ static bool32 IsDeoxysOrMewUntradable(u16 species, bool8 isEventLegal) return FALSE; } -int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct RfuGameCompatibilityData partner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, u8 isEventLegal) +int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct RfuGameCompatibilityData partner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, bool8 isEventLegal) { bool8 playerHasNationalDex = player.hasNationalDex; bool8 playerIsChampion = player.isChampion; @@ -2496,7 +2496,7 @@ int GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData player, struct Rf return UR_TRADE_MSG_NONE; } -int CanRegisterMonForTradingBoard(struct RfuGameCompatibilityData player, u16 species2, u16 species, u8 isEventLegal) +int CanRegisterMonForTradingBoard(struct RfuGameCompatibilityData player, u16 species2, u16 species, bool8 isEventLegal) { bool8 hasNationalDex = player.hasNationalDex; @@ -3744,7 +3744,7 @@ static bool8 AnimateTradeSequenceCable(void) gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]].x2 = 0; gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]].y2 = 0; StartSpriteAnim(&gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]], 0); - CreatePokeballSpriteToReleaseMon(sTradeData->monSpriteIds[TRADE_PARTNER], gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]].oam.paletteNum, 120, 84, 2, 1, 20, 0xFFFFF, sTradeData->monSpecies[TRADE_PARTNER]); + CreatePokeballSpriteToReleaseMon(sTradeData->monSpriteIds[TRADE_PARTNER], gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]].oam.paletteNum, 120, 84, 2, 1, 20, PALETTES_BG | (0xF << 16), sTradeData->monSpecies[TRADE_PARTNER]); FreeSpriteOamMatrix(&gSprites[sTradeData->bouncingPokeballSpriteId]); DestroySprite(&gSprites[sTradeData->bouncingPokeballSpriteId]); sTradeData->state++; @@ -4244,7 +4244,7 @@ static bool8 AnimateTradeSequenceWireless(void) gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]].x2 = 0; gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]].y2 = 0; StartSpriteAnim(&gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]], 0); - CreatePokeballSpriteToReleaseMon(sTradeData->monSpriteIds[TRADE_PARTNER], gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]].oam.paletteNum, 120, 84, 2, 1, 20, 0xFFFFF, sTradeData->monSpecies[TRADE_PARTNER]); + CreatePokeballSpriteToReleaseMon(sTradeData->monSpriteIds[TRADE_PARTNER], gSprites[sTradeData->monSpriteIds[TRADE_PARTNER]].oam.paletteNum, 120, 84, 2, 1, 20, PALETTES_BG | (0xF << 16), sTradeData->monSpecies[TRADE_PARTNER]); FreeSpriteOamMatrix(&gSprites[sTradeData->bouncingPokeballSpriteId]); DestroySprite(&gSprites[sTradeData->bouncingPokeballSpriteId]); sTradeData->state++; diff --git a/src/tv.c b/src/tv.c index 5cca91ff7..3364cc32d 100644 --- a/src/tv.c +++ b/src/tv.c @@ -1449,7 +1449,7 @@ static void InterviewAfter_BravoTrainerPokemonProfile(void) } } -void BravoTrainerPokemonProfile_BeforeInterview1(u16 a0) +void BravoTrainerPokemonProfile_BeforeInterview1(u16 move) { TVShow *show = &gSaveBlock1Ptr->tvShows[LAST_TVSHOW_IDX]; InterviewBefore_BravoTrainerPkmnProfile(); @@ -1457,7 +1457,7 @@ void BravoTrainerPokemonProfile_BeforeInterview1(u16 a0) if (sCurTVShowSlot != -1) { DeleteTVShowInArrayByIdx(gSaveBlock1Ptr->tvShows, LAST_TVSHOW_IDX); - show->bravoTrainer.move = a0; + show->bravoTrainer.move = move; show->bravoTrainer.kind = TVSHOW_BRAVO_TRAINER_POKEMON_PROFILE; } }