Continue documenting generic arguments

This commit is contained in:
GriffinR 2022-06-01 12:41:57 -04:00
parent a8437493c1
commit 34438e6bc4
71 changed files with 1246 additions and 1076 deletions

View File

@ -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

View File

@ -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);

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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);
@ -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);
@ -209,7 +209,7 @@ 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);
@ -227,7 +227,7 @@ 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 UnpackSelectedBattlePalettes(s16);

View File

@ -71,7 +71,7 @@ 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 unused);

View File

@ -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

View File

@ -340,11 +340,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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -57,8 +57,8 @@ void DisplayYesNoMenuDefaultYes(void);
u32 GetPlayerTextSpeed(void);
u8 GetPlayerTextSpeedDelay(void);
void Menu_LoadStdPalAt(u16 offset);
void AddTextPrinterWithCallbackForMessage(bool8 a1, void (*callback)(struct TextPrinterTemplate *, u16));
void BgDmaFill(u32 bg, u8 a1, int a2, int a3);
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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -412,7 +412,7 @@ 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);

View File

@ -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

View File

@ -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);

View File

@ -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 *);
@ -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 << 8;
time = x2 / xSpeedFactor;
if (time == 0)
time = 1;
*c = f / g;
*d = (b << 8) / g;
*velocX = x2 / time;
*velocY = (y << 8) / 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;
}

View File

@ -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);
}

View File

@ -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)
{
sprite->data[1] = 0;
if ((++sprite->data[2] & 1) != 0)
// Bounce up and down on landing spot
if (++sprite->sBounceTimer > 1)
{
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])

View File

@ -1365,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;
}

View File

@ -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())

View File

@ -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);
}
}

View File

@ -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;

View File

@ -73,12 +73,16 @@ struct TourneyTreeLineSection
#define tMode data[2]
#define tPrevTaskId data[3]
#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 SelectOpponentMonsUsingPersonality(u16, bool8);
static int SelectOpponentMonsUsingOtId(u16, bool8);
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);
@ -2589,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];
@ -2625,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);
}
}
}
@ -2638,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];
@ -2654,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);
}
}
}
@ -2732,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;
@ -2748,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)
@ -2764,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;
@ -2805,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;
@ -2829,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:
@ -5987,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;
@ -6010,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;

View File

@ -817,8 +817,8 @@ static void Debug_DrawNumber(s16 number, u16 *dest, bool8 unk)
static void Debug_DrawNumberPair(s16 number1, s16 number2, u16 *dest)
{
dest[4] = 0x1E;
Debug_DrawNumber(number2, dest, 0);
Debug_DrawNumber(number1, dest + 5, 1);
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,29 +2441,29 @@ 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 *dest)
{
u8 sp8[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++)
src[i] = (barInfo->unkC_0 << 12) | (barInfo->unk10 + sp8[i]);
src[i] = (barInfo->unkC_0 << 12) | (barInfo->unk10 + pixels[i]);
CpuCopy16(src, dest, sizeof(src));
}
@ -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)

View File

@ -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!");

View File

@ -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;

View File

@ -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)
{
}

View File

@ -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)

View File

@ -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)

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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,8 +42,7 @@ enum
EXIT_PORTHOLE,
};
//. rodata
static const s8 gTruckCamera_HorizontalTable[] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 2, 2, 2, 2, -1, -1, -1, 0};
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 (gTruckCamera_HorizontalTable[data[1]] == 2)
if (sTruckCamera_HorizontalTable[tMoveStep] == 2)
gTasks[taskId].func = Task_Truck3;
cameraXpan = gTruckCamera_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 = gTruckCamera_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);
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;
}
}

View File

@ -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)
{

View File

@ -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)

View File

@ -14,11 +14,9 @@
#include "trig.h"
#include "gpu_regs.h"
// EWRAM
EWRAM_DATA static u8 gCurrentAbnormalWeather = 0;
EWRAM_DATA static u16 gUnusedWeatherRelated = 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)
{
gCurrentAbnormalWeather = a0;
gUnusedWeatherRelated = a1;
gCurrentAbnormalWeather = weather;
gUnusedWeatherRelated = 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]);
gCurrentAbnormalWeather = data[1];
data[15] = 600;
data[0]++;
SetNextWeather(tWeatherA);
gCurrentAbnormalWeather = tWeatherA;
tDelay = 600;
tState++;
}
break;
case 1:
if (data[15]-- <= 0)
if (tDelay-- <= 0)
{
SetNextWeather(data[2]);
gCurrentAbnormalWeather = data[2];
data[15] = 600;
data[0] = 0;
SetNextWeather(tWeatherB);
gCurrentAbnormalWeather = 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 (gCurrentAbnormalWeather == WEATHER_DOWNPOUR)
{
data[1] = WEATHER_DROUGHT;
data[2] = WEATHER_DOWNPOUR;
// Currently Downpour, next will be Drought
tWeatherA = WEATHER_DROUGHT;
tWeatherB = WEATHER_DOWNPOUR;
}
else if (gCurrentAbnormalWeather == 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
gCurrentAbnormalWeather = 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);

View File

@ -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:

View File

@ -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

View File

@ -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);

View File

@ -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)

View File

@ -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;
}

View File

@ -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)

View File

@ -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();

View File

@ -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;

View File

@ -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];
}
}
}

View File

@ -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;

View File

@ -1005,32 +1005,45 @@ static u8 AnimateBallOpenParticlesForPokeball(u8 x, u8 y, u8 kindOfStars, u8 sub
return AnimateBallOpenParticles(x, y, kindOfStars, subpriority, BALL_POKE);
}
static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 battlerId, u32 selectedPalettes)
static u8 LaunchBallFadeMonTaskForPokeball(bool8 unFadeLater, u8 spritePalNum, u32 selectedPalettes)
{
return LaunchBallFadeMonTask(unFadeLater, battlerId, selectedPalettes, 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,12 +1052,12 @@ 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 subpriority;
u8 spriteId = sprite->data[0];
u8 battlerId = sprite->data[2];
u32 selectedPalettes = (u16)sprite->data[3] | ((u16)sprite->data[4] << 16);
u8 spriteId = sprite->sMonSpriteId;
u8 monPalNum = sprite->sMonPalNum;
u32 selectedPalettes = (u16)sprite->sFadePalsLo | ((u16)sprite->sFadePalsHi << 16);
if (sprite->subpriority != 0)
subpriority = sprite->subpriority - 1;
@ -1053,78 +1066,89 @@ static void SpriteCB_PokeballReleaseMon(struct Sprite *sprite)
StartSpriteAnim(sprite, 1);
AnimateBallOpenParticlesForPokeball(sprite->x, sprite->y - 5, sprite->oam.priority, subpriority);
sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, battlerId, selectedPalettes);
// sDelay re-used to store task id but never read
sprite->sDelay = LaunchBallFadeMonTaskForPokeball(1, monPalNum, selectedPalettes);
sprite->callback = SpriteCB_ReleasedMonFlyOut;
gSprites[spriteId].invisible = FALSE;
StartSpriteAffineAnim(&gSprites[spriteId], BATTLER_AFFINE_EMERGE);
AnimateSprite(&gSprites[spriteId]);
gSprites[spriteId].data[1] = 0x1000;
sprite->data[7] = 0;
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,12 +1156,12 @@ 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 subpriority;
u8 monSpriteId = sprite->data[0];
u8 battlerId = sprite->data[2];
u32 selectedPalettes = (u16)sprite->data[3] | ((u16)sprite->data[4] << 16);
u8 monSpriteId = sprite->sMonSpriteId;
u8 monPalNum = sprite->sMonPalNum;
u32 selectedPalettes = (u16)sprite->sFadePalsLo | ((u16)sprite->sFadePalsHi << 16);
if (sprite->subpriority != 0)
subpriority = sprite->subpriority - 1;
@ -1146,7 +1170,8 @@ static void SpriteCB_TradePokeball(struct Sprite *sprite)
StartSpriteAnim(sprite, 1);
AnimateBallOpenParticlesForPokeball(sprite->x, sprite->y - 5, sprite->oam.priority, subpriority);
sprite->data[1] = LaunchBallFadeMonTaskForPokeball(1, battlerId, selectedPalettes);
// 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);

View File

@ -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();

View File

@ -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);
}

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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] =

View File

@ -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

View File

@ -3865,21 +3865,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
@ -4116,32 +4110,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);

View File

@ -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++;

View File

@ -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;
}
}