summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2018-11-12 18:43:42 -0600
committerGitHub <noreply@github.com>2018-11-12 18:43:42 -0600
commit0ad332124e5bf57d0a43122616a77cd8c9318250 (patch)
treed495eca0bedff3a4466afdcf45efbf66f237077a
parentcbc414c44115550c811d6629c23c2e749d9d7fe3 (diff)
parent17be584c67f203f15f0e3a61dd3e5e611dd79382 (diff)
Merge pull request #706 from Slawter666/synchronise
[WIP] Synchronise with pokeemerald part 2
-rw-r--r--include/contest.h1
-rw-r--r--include/field_player_avatar.h56
-rw-r--r--include/pokemon.h1
-rw-r--r--src/field_player_avatar.c363
-rw-r--r--src/fldeff_berrytree.c1
-rw-r--r--src/pokemon_summary_screen.c315
-rw-r--r--src/wallclock.c893
7 files changed, 875 insertions, 755 deletions
diff --git a/include/contest.h b/include/contest.h
index 969ae51dd..ef8069367 100644
--- a/include/contest.h
+++ b/include/contest.h
@@ -8,6 +8,7 @@ enum
CONTEST_CATEGORY_CUTE,
CONTEST_CATEGORY_SMART,
CONTEST_CATEGORY_TOUGH,
+ CONTEST_CATEGORIES_COUNT,
};
enum
diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h
index 2ac149088..0c2deb8be 100644
--- a/include/field_player_avatar.h
+++ b/include/field_player_avatar.h
@@ -1,8 +1,6 @@
#ifndef GUARD_FIELD_PLAYER_AVATAR_H
#define GUARD_FIELD_PLAYER_AVATAR_H
-#include "task.h"
-
enum {
PLAYER_AVATAR_STATE_NORMAL,
PLAYER_AVATAR_STATE_MACH_BIKE,
@@ -16,35 +14,8 @@ enum {
// MovementType_None2
void player_step(u8 a, u16 b, u16 c);
-u8 ForcedMovement_None(void);
-u8 ForcedMovement_Slip(void);
-u8 ForcedMovement_WalkSouth(void);
-u8 ForcedMovement_WalkNorth(void);
-u8 ForcedMovement_WalkWest(void);
-u8 ForcedMovement_WalkEast(void);
-u8 ForcedMovement_RideCurrentSouth(void);
-u8 ForcedMovement_RideCurrentNorth(void);
-u8 ForcedMovement_RideCurrentWest(void);
-u8 ForcedMovement_RideCurrentEast(void);
-u8 ForcedMovement_SlideSouth(void);
-u8 ForcedMovement_SlideNorth(void);
-u8 ForcedMovement_SlideWest(void);
-u8 ForcedMovement_SlideEast(void);
-u8 ForcedMovement_SecretBaseJumpMat(void);
-u8 ForcedMovement_SecretBaseSpinMat(void);
-u8 ForcedMovement_MuddySlope(void);
-void PlayerNotOnBikeNotMoving(u8 direction, u16 heldKeys);
-void PlayerNotOnBikeTurningInPlace(u8 direction, u16 heldKeys);
-void sub_8058D0C(u8 direction, u16 heldKeys);
u8 CheckForEventObjectCollision(struct EventObject *a, s16 b, s16 c, u8 d, u8 e);
void SetPlayerAvatarTransitionFlags(u16 a);
-void nullsub_49(struct EventObject *a);
-void PlayerAvatarTransition_Normal(struct EventObject *a);
-void PlayerAvatarTransition_MachBike(struct EventObject *a);
-void PlayerAvatarTransition_AcroBike(struct EventObject *a);
-void PlayerAvatarTransition_Surfing(struct EventObject *a);
-void PlayerAvatarTransition_Underwater(struct EventObject *a);
-void sub_80591F4(struct EventObject *a);
void sub_8059204(void);
u8 PlayerGetCopyableMovement(void);
void PlayerSetAnimId(u8 a, u8 b);
@@ -52,7 +23,6 @@ void PlayerGoSpeed1(u8 a);
void PlayerGoSpeed2(u8 a);
void PlayerRideWaterCurrent(u8 a);
void PlayerGoSpeed4(u8 a);
-void sub_805940C(u8 a);
void PlayerOnBikeCollide(u8);
void PlayerFaceDirection(u8 a);
void PlayerTurnInPlace(u8 a);
@@ -92,34 +62,8 @@ void SetPlayerAvatarExtraStateTransition(u8 a, u8 b);
void InitPlayerAvatar(s16 a, s16 b, u8 c, u8 d);
void sub_8059B88(u8);
void sub_8059BF4(void);
-// sub_8059C3C
void sub_8059C94(u8);
void sub_8059D08(u8);
-u8 sub_8059E84(struct Task *task, struct EventObject *b, struct EventObject *c);
-u8 sub_8059EA4(struct Task *task, struct EventObject *b, struct EventObject *c);
-u8 sub_8059F40(struct Task *task, struct EventObject *b, struct EventObject *c);
-u8 PlayerAvatar_DoSecretBaseMatJump(struct Task *task, struct EventObject *eventObject);
-u8 PlayerAvatar_SecretBaseMatSpinStep0(struct Task *task, struct EventObject *eventObject);
-u8 PlayerAvatar_SecretBaseMatSpinStep1(struct Task *task, struct EventObject *eventObject);
-u8 PlayerAvatar_SecretBaseMatSpinStep2(struct Task *task, struct EventObject *eventObject);
-u8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct EventObject *eventObject);
-void sub_805A20C(u8 a);
void StartFishing(u8 a);
-u8 Fishing1(struct Task *task);
-u8 Fishing2(struct Task *task);
-u8 Fishing3(struct Task *task);
-u8 Fishing4(struct Task *task);
-u8 Fishing5(struct Task *task);
-u8 Fishing6(struct Task *task);
-u8 Fishing7(struct Task *task);
-u8 Fishing8(struct Task *task);
-u8 Fishing9(struct Task *task);
-u8 Fishing10(struct Task *task);
-u8 Fishing11(struct Task *task);
-u8 Fishing12(struct Task *task);
-u8 Fishing13(struct Task *task);
-u8 Fishing14(struct Task *task);
-u8 Fishing15(struct Task *task);
-u8 Fishing16(struct Task *task);
#endif
diff --git a/include/pokemon.h b/include/pokemon.h
index 67ce267ab..67816b8f0 100644
--- a/include/pokemon.h
+++ b/include/pokemon.h
@@ -117,6 +117,7 @@
#define TYPE_ICE 0x0f
#define TYPE_DRAGON 0x10
#define TYPE_DARK 0x11
+#define NUMBER_OF_MON_TYPES 0x12
#define FRIENDSHIP_EVENT_GROW_LEVEL 0x0
#define FRIENDSHIP_EVENT_VITAMIN 0x1 // unused
diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c
index 5ce6a6339..d3b6ba7ed 100644
--- a/src/field_player_avatar.c
+++ b/src/field_player_avatar.c
@@ -1,57 +1,121 @@
#include "global.h"
-#include "field_player_avatar.h"
#include "bike.h"
#include "event_data.h"
+#include "event_object_movement.h"
#include "field_effect.h"
#include "field_effect_helpers.h"
-#include "event_object_movement.h"
+#include "field_player_avatar.h"
#include "fieldmap.h"
#include "main.h"
#include "menu.h"
#include "metatile_behavior.h"
#include "new_game.h"
+#include "overworld.h"
#include "party_menu.h"
#include "random.h"
-#include "overworld.h"
#include "rotating_gate.h"
#include "script.h"
-#include "constants/songs.h"
#include "sound.h"
#include "strings2.h"
#include "task.h"
#include "tv.h"
#include "wild_encounter.h"
-#include "constants/field_effects.h"
#include "constants/event_object_movement_constants.h"
#include "constants/event_objects.h"
+#include "constants/field_effects.h"
+#include "constants/moves.h"
+#include "constants/songs.h"
+#include "constants/species.h"
EWRAM_DATA struct PlayerAvatar gPlayerAvatar = {0};
-//Functions
+// Static declarations
+
static bool8 sub_8058854(struct EventObject *, u8);
static void npc_clear_strange_bits(struct EventObject *a);
static void MovePlayerAvatarUsingKeypadInput(u8 a, u16 b, u16 c);
static void PlayerAllowForcedMovementIfMovingSameDirection(void);
static bool8 TryDoMetatileBehaviorForcedMovement(void);
static u8 GetForcedMovementByMetatileBehavior(void);
+static bool8 ForcedMovement_None(void);
+static bool8 ForcedMovement_Slip(void);
+static bool8 ForcedMovement_WalkSouth(void);
+static bool8 ForcedMovement_WalkNorth(void);
+static bool8 ForcedMovement_WalkWest(void);
+static bool8 ForcedMovement_WalkEast(void);
+static bool8 ForcedMovement_RideCurrentSouth(void);
+static bool8 ForcedMovement_RideCurrentNorth(void);
+static bool8 ForcedMovement_RideCurrentWest(void);
+static bool8 ForcedMovement_RideCurrentEast(void);
+static bool8 ForcedMovement_SlideSouth(void);
+static bool8 ForcedMovement_SlideNorth(void);
+static bool8 ForcedMovement_SlideWest(void);
+static bool8 ForcedMovement_SlideEast(void);
+static bool8 ForcedMovement_SecretBaseJumpMat(void);
+static bool8 ForcedMovement_SecretBaseSpinMat(void);
+static bool8 ForcedMovement_MuddySlope(void);
static void MovePlayerNotOnBike(u8 a, u16 b);
static u8 CheckMovementInputNotOnBike(u8 a);
+static void PlayerNotOnBikeNotMoving(u8 direction, u16 heldKeys);
+static void PlayerNotOnBikeTurningInPlace(u8 direction, u16 heldKeys);
+static void sub_8058D0C(u8 direction, u16 heldKeys);
static u8 CheckForPlayerAvatarCollision(u8 a);
-static u8 sub_8058EF0(s16 a, s16 b, u8 c);
+static bool8 sub_8058EF0(s16 x, s16 y, u8 direction);
static bool8 ShouldJumpLedge(s16 a, s16 b, u8 c);
static u8 sub_8058F6C(s16 a, s16 b, u8 c);
-static void check_acro_bike_metatile(int unused1, int unused2, u8 c, u8 *d);
+static void check_acro_bike_metatile(s16 unused1, s16 unused2, u8 c, u8 *d);
static void DoPlayerAvatarTransition(void);
+static void nullsub_49(struct EventObject *a);
+static void PlayerAvatarTransition_Normal(struct EventObject *a);
+static void PlayerAvatarTransition_MachBike(struct EventObject *a);
+static void PlayerAvatarTransition_AcroBike(struct EventObject *a);
+static void PlayerAvatarTransition_Surfing(struct EventObject *a);
+static void PlayerAvatarTransition_Underwater(struct EventObject *a);
+static void PlayerAvatarTransition_ReturnToField(struct EventObject *eventObj);
static bool8 player_is_anim_in_certain_ranges(void);
static bool8 sub_80592A4(void);
static bool8 PlayerIsAnimActive(void);
static bool8 PlayerCheckIfAnimFinishedOrInactive(void);
+static void PlayerRun(u8 a);
static void PlayerNotOnBikeCollide(u8 a);
static void PlayCollisionSoundIfNotFacingWarp(u8 a);
static void sub_8059D60(struct EventObject *a);
static void StartStrengthAnim(u8 a, u8 b);
+static void Task_BumpBoulder(u8 taskId);
+static bool8 sub_8059E84(struct Task *task, struct EventObject *b, struct EventObject *c);
+static bool8 do_boulder_dust(struct Task *task, struct EventObject *b, struct EventObject *c);
+static bool8 sub_8059F40(struct Task *task, struct EventObject *b, struct EventObject *c);
static void DoPlayerMatJump(void);
+static void DoPlayerAvatarSecretBaseMatJump(u8 taskId);
+static u8 PlayerAvatar_DoSecretBaseMatJump(struct Task *task, struct EventObject *eventObject);
static void DoPlayerMatSpin(void);
+static void PlayerAvatar_DoSecretBaseMatSpin(u8 taskId);
+static bool8 PlayerAvatar_SecretBaseMatSpinStep0(struct Task *task, struct EventObject *eventObject);
+static bool8 PlayerAvatar_SecretBaseMatSpinStep1(struct Task *task, struct EventObject *eventObject);
+static bool8 PlayerAvatar_SecretBaseMatSpinStep2(struct Task *task, struct EventObject *eventObject);
+static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct EventObject *eventObject);
+static void sub_805A20C(u8 a);
+static void taskFF_0805D1D4(u8 taskId);
+static void sub_805A2D0(u8 taskId);
+static void Task_Fishing(u8 taskId);
+static bool8 Fishing1(struct Task *task);
+static bool8 Fishing2(struct Task *task);
+static bool8 Fishing3(struct Task *task);
+static bool8 Fishing4(struct Task *task);
+static bool8 Fishing5(struct Task *task);
+static bool8 Fishing6(struct Task *task);
+static bool8 Fishing7(struct Task *task);
+static bool8 Fishing8(struct Task *task);
+static bool8 Fishing9(struct Task *task);
+static bool8 Fishing10(struct Task *task);
+static bool8 Fishing11(struct Task *task);
+static bool8 Fishing12(struct Task *task);
+static bool8 Fishing13(struct Task *task);
+static bool8 Fishing14(struct Task *task);
+static bool8 Fishing15(struct Task *task);
+static bool8 Fishing16(struct Task *task);
+static void AlignFishingAnimationFrames(void);
+
u8 debug_sub_805F2B0(u8);
u8 debug_sub_805F2DC(u8);
@@ -120,7 +184,7 @@ static void (*const gUnknown_0830FC14[])(struct EventObject *) =
PlayerAvatarTransition_AcroBike,
PlayerAvatarTransition_Surfing,
PlayerAvatarTransition_Underwater,
- sub_80591F4,
+ PlayerAvatarTransition_ReturnToField,
nullsub_49,
nullsub_49,
};
@@ -182,7 +246,7 @@ static bool8 (*const sArrowWarpMetatileBehaviorChecks2[])(u8) = //Duplicate of
static u8 (*const gUnknown_0830FC88[])(struct Task *, struct EventObject *, struct EventObject *) =
{
sub_8059E84,
- sub_8059EA4,
+ do_boulder_dust,
sub_8059F40,
};
static u8 (*const sPlayerAvatarSecretBaseMatJump[])(struct Task *, struct EventObject *) =
@@ -288,7 +352,7 @@ static u8 GetForcedMovementByMetatileBehavior(void)
return 0;
}
-bool8 ForcedMovement_None(void)
+static bool8 ForcedMovement_None(void)
{
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_6)
{
@@ -340,47 +404,47 @@ static u8 DoForcedMovementInCurrentDirection(void (*a)(u8))
return DoForcedMovement(playerEventObj->movementDirection, a);
}
-bool8 ForcedMovement_Slip(void)
+static bool8 ForcedMovement_Slip(void)
{
return DoForcedMovementInCurrentDirection(PlayerGoSpeed2);
}
-bool8 ForcedMovement_WalkSouth(void)
+static bool8 ForcedMovement_WalkSouth(void)
{
return DoForcedMovement(DIR_SOUTH, PlayerGoSpeed1);
}
-bool8 ForcedMovement_WalkNorth(void)
+static bool8 ForcedMovement_WalkNorth(void)
{
return DoForcedMovement(DIR_NORTH, PlayerGoSpeed1);
}
-bool8 ForcedMovement_WalkWest(void)
+static bool8 ForcedMovement_WalkWest(void)
{
return DoForcedMovement(DIR_WEST, PlayerGoSpeed1);
}
-bool8 ForcedMovement_WalkEast(void)
+static bool8 ForcedMovement_WalkEast(void)
{
return DoForcedMovement(DIR_EAST, PlayerGoSpeed1);
}
-bool8 ForcedMovement_RideCurrentSouth(void)
+static bool8 ForcedMovement_RideCurrentSouth(void)
{
return DoForcedMovement(DIR_SOUTH, PlayerRideWaterCurrent);
}
-bool8 ForcedMovement_RideCurrentNorth(void)
+static bool8 ForcedMovement_RideCurrentNorth(void)
{
return DoForcedMovement(DIR_NORTH, PlayerRideWaterCurrent);
}
-bool8 ForcedMovement_RideCurrentWest(void)
+static bool8 ForcedMovement_RideCurrentWest(void)
{
return DoForcedMovement(DIR_WEST, PlayerRideWaterCurrent);
}
-bool8 ForcedMovement_RideCurrentEast(void)
+static bool8 ForcedMovement_RideCurrentEast(void)
{
return DoForcedMovement(DIR_EAST, PlayerRideWaterCurrent);
}
@@ -394,39 +458,39 @@ static u8 ForcedMovement_Slide(u8 direction, void (*b)(u8))
return DoForcedMovement(direction, b);
}
-bool8 ForcedMovement_SlideSouth(void)
+static bool8 ForcedMovement_SlideSouth(void)
{
return ForcedMovement_Slide(DIR_SOUTH, PlayerGoSpeed2);
}
-bool8 ForcedMovement_SlideNorth(void)
+static bool8 ForcedMovement_SlideNorth(void)
{
return ForcedMovement_Slide(DIR_NORTH, PlayerGoSpeed2);
}
-bool8 ForcedMovement_SlideWest(void)
+static bool8 ForcedMovement_SlideWest(void)
{
return ForcedMovement_Slide(DIR_WEST, PlayerGoSpeed2);
}
-bool8 ForcedMovement_SlideEast(void)
+static bool8 ForcedMovement_SlideEast(void)
{
return ForcedMovement_Slide(DIR_EAST, PlayerGoSpeed2);
}
-bool8 ForcedMovement_SecretBaseJumpMat(void)
+static bool8 ForcedMovement_SecretBaseJumpMat(void)
{
DoPlayerMatJump();
return TRUE;
}
-bool8 ForcedMovement_SecretBaseSpinMat(void)
+static bool8 ForcedMovement_SecretBaseSpinMat(void)
{
DoPlayerMatSpin();
return TRUE;
}
-bool8 ForcedMovement_MuddySlope(void)
+static bool8 ForcedMovement_MuddySlope(void)
{
struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
@@ -470,17 +534,17 @@ static u8 CheckMovementInputNotOnBike(u8 direction)
}
}
-void PlayerNotOnBikeNotMoving(u8 direction, u16 heldKeys)
+static void PlayerNotOnBikeNotMoving(u8 direction, u16 heldKeys)
{
PlayerFaceDirection(GetPlayerFacingDirection());
}
-void PlayerNotOnBikeTurningInPlace(u8 direction, u16 heldKeys)
+static void PlayerNotOnBikeTurningInPlace(u8 direction, u16 heldKeys)
{
PlayerTurnInPlace(direction);
}
-void sub_8058D0C(u8 direction, u16 heldKeys)
+static void sub_8058D0C(u8 direction, u16 heldKeys)
{
u8 r1 = CheckForPlayerAvatarCollision(direction);
@@ -503,7 +567,7 @@ void sub_8058D0C(u8 direction, u16 heldKeys)
if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_UNDERWATER) && (heldKeys & B_BUTTON) && FlagGet(FLAG_SYS_B_DASH)
&& IsRunningDisallowed(gEventObjects[gPlayerAvatar.eventObjectId].currentMetatileBehavior) == 0)
{
- sub_805940C(direction);
+ PlayerRun(direction);
gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_DASH;
}
else
@@ -548,55 +612,52 @@ u8 CheckForEventObjectCollision(struct EventObject *a, s16 x, s16 y, u8 directio
return collision;
}
-static u8 sub_8058EF0(s16 a, s16 b, u8 c)
+static bool8 sub_8058EF0(s16 x, s16 y, u8 direction)
{
if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING)
- && MapGridGetZCoordAt(a, b) == 3
- && GetEventObjectIdByXYZ(a, b, 3) == 16)
+ && MapGridGetZCoordAt(x, y) == 3
+ && GetEventObjectIdByXYZ(x, y, 3) == 16)
{
- sub_805A20C(c);
- return 1;
+ sub_805A20C(direction);
+ return TRUE;
}
else
{
- return 0;
+ return FALSE;
}
}
-static bool8 ShouldJumpLedge(s16 a, s16 b, u8 c)
+static bool8 ShouldJumpLedge(s16 x, s16 y, u8 z)
{
- if (GetLedgeJumpDirection(a, b, c) != 0)
- return 1;
+ if (GetLedgeJumpDirection(x, y, z) != 0)
+ return TRUE;
else
- return 0;
+ return FALSE;
}
-static u8 sub_8058F6C(s16 a, s16 b, u8 c)
+static u8 sub_8058F6C(s16 x, s16 y, u8 direction)
{
if (FlagGet(FLAG_SYS_USE_STRENGTH))
{
- u8 eventObjectId = GetEventObjectIdByXY(a, b);
+ u8 eventObjectId = GetEventObjectIdByXY(x, y);
- if (eventObjectId != 16)
+ if (eventObjectId != 16 && gEventObjects[eventObjectId].graphicsId == EVENT_OBJ_GFX_PUSHABLE_BOULDER)
{
- if (gEventObjects[eventObjectId].graphicsId == 0x57)
+ x = gEventObjects[eventObjectId].currentCoords.x;
+ y = gEventObjects[eventObjectId].currentCoords.y;
+ MoveCoords(direction, &x, &y);
+ if (GetCollisionAtCoords(&gEventObjects[eventObjectId], x, y, direction) == 0
+ && MetatileBehavior_IsNonAnimDoor(MapGridGetMetatileBehaviorAt(x, y)) == 0)
{
- a = gEventObjects[eventObjectId].currentCoords.x;
- b = gEventObjects[eventObjectId].currentCoords.y;
- MoveCoords(c, &a, &b);
- if (GetCollisionAtCoords(&gEventObjects[eventObjectId], a, b, c) == 0
- && MetatileBehavior_IsNonAnimDoor(MapGridGetMetatileBehaviorAt(a, b)) == 0)
- {
- StartStrengthAnim(eventObjectId, c);
- return 1;
- }
+ StartStrengthAnim(eventObjectId, direction);
+ return 1;
}
}
}
return 0;
}
-static void check_acro_bike_metatile(int unused1, int unused2, u8 c, u8 *d)
+static void check_acro_bike_metatile(s16 unused1, s16 unused2, u8 c, u8 *d)
{
u8 i;
@@ -642,18 +703,18 @@ static void DoPlayerAvatarTransition(void)
}
}
-void nullsub_49(struct EventObject *eventObj)
+static void nullsub_49(struct EventObject *eventObj)
{
}
-void PlayerAvatarTransition_Normal(struct EventObject *eventObj)
+static void PlayerAvatarTransition_Normal(struct EventObject *eventObj)
{
EventObjectSetGraphicsId(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_NORMAL));
EventObjectTurn(eventObj, eventObj->movementDirection);
SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_ON_FOOT);
}
-void PlayerAvatarTransition_MachBike(struct EventObject *eventObj)
+static void PlayerAvatarTransition_MachBike(struct EventObject *eventObj)
{
EventObjectSetGraphicsId(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_MACH_BIKE));
EventObjectTurn(eventObj, eventObj->movementDirection);
@@ -661,7 +722,7 @@ void PlayerAvatarTransition_MachBike(struct EventObject *eventObj)
BikeClearState(0, 0);
}
-void PlayerAvatarTransition_AcroBike(struct EventObject *eventObj)
+static void PlayerAvatarTransition_AcroBike(struct EventObject *eventObj)
{
EventObjectSetGraphicsId(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_ACRO_BIKE));
EventObjectTurn(eventObj, eventObj->movementDirection);
@@ -670,9 +731,9 @@ void PlayerAvatarTransition_AcroBike(struct EventObject *eventObj)
Bike_HandleBumpySlopeJump();
}
-void PlayerAvatarTransition_Surfing(struct EventObject *eventObj)
+static void PlayerAvatarTransition_Surfing(struct EventObject *eventObj)
{
- u8 unk;
+ u8 spriteId;
EventObjectSetGraphicsId(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING));
EventObjectTurn(eventObj, eventObj->movementDirection);
@@ -680,12 +741,12 @@ void PlayerAvatarTransition_Surfing(struct EventObject *eventObj)
gFieldEffectArguments[0] = eventObj->currentCoords.x;
gFieldEffectArguments[1] = eventObj->currentCoords.y;
gFieldEffectArguments[2] = gPlayerAvatar.eventObjectId;
- unk = FieldEffectStart(FLDEFF_SURF_BLOB);
- eventObj->fieldEffectSpriteId = unk;
- sub_8127ED0(unk, 1);
+ spriteId = FieldEffectStart(FLDEFF_SURF_BLOB);
+ eventObj->fieldEffectSpriteId = spriteId;
+ sub_8127ED0(spriteId, 1);
}
-void PlayerAvatarTransition_Underwater(struct EventObject *eventObj)
+static void PlayerAvatarTransition_Underwater(struct EventObject *eventObj)
{
EventObjectSetGraphicsId(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_UNDERWATER));
EventObjectTurn(eventObj, eventObj->movementDirection);
@@ -693,7 +754,7 @@ void PlayerAvatarTransition_Underwater(struct EventObject *eventObj)
eventObj->fieldEffectSpriteId = sub_8128124(eventObj->spriteId);
}
-void sub_80591F4(struct EventObject *eventObj)
+static void PlayerAvatarTransition_ReturnToField(struct EventObject *eventObj)
{
gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_5;
}
@@ -718,13 +779,13 @@ void sub_8059204(void)
static bool8 player_is_anim_in_certain_ranges(void)
{
- u8 unk = gEventObjects[gPlayerAvatar.eventObjectId].movementActionId;
+ u8 movementActionId = gEventObjects[gPlayerAvatar.eventObjectId].movementActionId;
- if (unk < 4
- || (unk >= 16 && unk < 0x15)
- || (unk >= 25 && unk < 41)
- || (unk >= 98 && unk < 110)
- || (unk >= 122 && unk < 126))
+ if (movementActionId < 4
+ || (movementActionId >= 16 && movementActionId < 0x15)
+ || (movementActionId >= 25 && movementActionId < 41)
+ || (movementActionId >= 98 && movementActionId < 110)
+ || (movementActionId >= 122 && movementActionId < 126))
return TRUE;
else
return FALSE;
@@ -795,7 +856,7 @@ void PlayerGoSpeed4(u8 a)
PlayerSetAnimId(GetWalkFastestMovementAction(a), 2);
}
-void sub_805940C(u8 a)
+static void PlayerRun(u8 a)
{
PlayerSetAnimId(GetPlayerRunMovementAction(a), 2);
}
@@ -1003,7 +1064,7 @@ u8 GetPlayerAvatarGraphicsIdByStateId(u8 state)
return GetPlayerAvatarGraphicsIdByStateIdAndGender(state, gPlayerAvatar.gender);
}
-u8 unref_GetRivalAvatarGenderByGraphcsId(u8 gfxId)
+u8 unref_GetRivalAvatarGenderByGraphicsId(u8 gfxId)
{
switch (gfxId)
{
@@ -1047,9 +1108,9 @@ bool8 PartyHasMonWithSurf(void)
{
for (i = 0; i < 6; i++)
{
- if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == 0)
+ if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE)
break;
- if (pokemon_has_move(&gPlayerParty[i], 0x39))
+ if (pokemon_has_move(&gPlayerParty[i], MOVE_SURF))
return TRUE;
}
}
@@ -1167,7 +1228,7 @@ void sub_8059BF4(void)
StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], 0);
}
-void sub_8059C3C(u8 direction)
+static void sub_8059C3C(u8 direction)
{
EventObjectSetGraphicsId(&gEventObjects[gPlayerAvatar.eventObjectId], GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_FISHING));
StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingDirectionAnimNum(direction));
@@ -1209,18 +1270,16 @@ static void sub_8059D60(struct EventObject *eventObject)
/* Strength */
-static void sub_8059E2C(u8 taskId);
-
static void StartStrengthAnim(u8 a, u8 b)
{
- u8 taskId = CreateTask(sub_8059E2C, 0xFF);
+ u8 taskId = CreateTask(Task_BumpBoulder, 0xFF);
gTasks[taskId].data[1] = a;
gTasks[taskId].data[2] = b;
- sub_8059E2C(taskId);
+ Task_BumpBoulder(taskId);
}
-static void sub_8059E2C(u8 taskId)
+static void Task_BumpBoulder(u8 taskId)
{
while (gUnknown_0830FC88[gTasks[taskId].data[0]](&gTasks[taskId],
&gEventObjects[gPlayerAvatar.eventObjectId],
@@ -1228,15 +1287,15 @@ static void sub_8059E2C(u8 taskId)
;
}
-u8 sub_8059E84(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject)
+static bool8 sub_8059E84(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject)
{
ScriptContext2_Enable();
gPlayerAvatar.preventStep = TRUE;
task->data[0]++;
- return 0;
+ return FALSE;
}
-u8 sub_8059EA4(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject)
+static bool8 do_boulder_dust(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject)
{
if (!EventObjectIsMovementOverridden(playerObject)
&& !EventObjectIsMovementOverridden(strengthObject))
@@ -1253,10 +1312,10 @@ u8 sub_8059EA4(struct Task *task, struct EventObject *playerObject, struct Event
PlaySE(SE_W070);
task->data[0]++;
}
- return 0;
+ return FALSE;
}
-u8 sub_8059F40(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject)
+static bool8 sub_8059F40(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject)
{
if (EventObjectCheckHeldMovementStatus(playerObject)
&& EventObjectCheckHeldMovementStatus(strengthObject))
@@ -1265,15 +1324,13 @@ u8 sub_8059F40(struct Task *task, struct EventObject *playerObject, struct Event
EventObjectClearHeldMovementIfFinished(strengthObject);
gPlayerAvatar.preventStep = FALSE;
ScriptContext2_Disable();
- DestroyTask(FindTaskIdByFunc(sub_8059E2C));
+ DestroyTask(FindTaskIdByFunc(Task_BumpBoulder));
}
- return 0;
+ return FALSE;
}
/* Some field effect */
-static void DoPlayerAvatarSecretBaseMatJump(u8 taskId);
-
static void DoPlayerMatJump(void)
{
DoPlayerAvatarSecretBaseMatJump(CreateTask(DoPlayerAvatarSecretBaseMatJump, 0xFF));
@@ -1286,7 +1343,7 @@ static void DoPlayerAvatarSecretBaseMatJump(u8 taskId)
}
// because data[0] is used to call this, it can be inferred that there may have been multiple mat jump functions at one point, so the name for these groups of functions is appropriate in assuming the sole use of mat jump.
-u8 PlayerAvatar_DoSecretBaseMatJump(struct Task *task, struct EventObject *eventObject)
+static u8 PlayerAvatar_DoSecretBaseMatJump(struct Task *task, struct EventObject *eventObject)
{
gPlayerAvatar.preventStep = TRUE;
if (EventObjectClearHeldMovementIfFinished(eventObject))
@@ -1301,13 +1358,11 @@ u8 PlayerAvatar_DoSecretBaseMatJump(struct Task *task, struct EventObject *event
DestroyTask(FindTaskIdByFunc(DoPlayerAvatarSecretBaseMatJump));
}
}
- return 0;
+ return FALSE;
}
/* Some field effect */
-static void PlayerAvatar_DoSecretBaseMatSpin(u8 taskId);
-
static void DoPlayerMatSpin(void)
{
u8 taskId = CreateTask(PlayerAvatar_DoSecretBaseMatSpin, 0xFF);
@@ -1321,17 +1376,17 @@ static void PlayerAvatar_DoSecretBaseMatSpin(u8 taskId)
;
}
-u8 PlayerAvatar_SecretBaseMatSpinStep0(struct Task *task, struct EventObject *eventObject)
+static bool8 PlayerAvatar_SecretBaseMatSpinStep0(struct Task *task, struct EventObject *eventObject)
{
task->data[0]++;
task->data[1] = eventObject->movementDirection;
gPlayerAvatar.preventStep = TRUE;
ScriptContext2_Enable();
PlaySE(SE_TK_WARPIN);
- return 1;
+ return TRUE;
}
-u8 PlayerAvatar_SecretBaseMatSpinStep1(struct Task *task, struct EventObject *eventObject)
+static bool8 PlayerAvatar_SecretBaseMatSpinStep1(struct Task *task, struct EventObject *eventObject)
{
u8 directions[] = {DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH};
@@ -1346,10 +1401,10 @@ u8 PlayerAvatar_SecretBaseMatSpinStep1(struct Task *task, struct EventObject *ev
if (task->data[2] > 3 && direction == GetOppositeDirection(task->data[1]))
task->data[0]++;
}
- return 0;
+ return FALSE;
}
-u8 PlayerAvatar_SecretBaseMatSpinStep2(struct Task *task, struct EventObject *eventObject)
+static bool8 PlayerAvatar_SecretBaseMatSpinStep2(struct Task *task, struct EventObject *eventObject)
{
const u8 actions[] = {
MOVEMENT_ACTION_DELAY_1,
@@ -1364,10 +1419,10 @@ u8 PlayerAvatar_SecretBaseMatSpinStep2(struct Task *task, struct EventObject *ev
EventObjectSetHeldMovement(eventObject, actions[task->data[2]]);
task->data[0] = 1;
}
- return 0;
+ return FALSE;
}
-u8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct EventObject *eventObject)
+static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct EventObject *eventObject)
{
if (EventObjectClearHeldMovementIfFinished(eventObject))
{
@@ -1376,15 +1431,12 @@ u8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct EventObject *ev
gPlayerAvatar.preventStep = FALSE;
DestroyTask(FindTaskIdByFunc(PlayerAvatar_DoSecretBaseMatSpin));
}
- return 0;
+ return FALSE;
}
/* Some Field effect */
-static void taskFF_0805D1D4(u8 taskId);
-static void sub_805A2D0(u8 taskId);
-
-void sub_805A20C(u8 a)
+static void sub_805A20C(u8 a)
{
u8 taskId;
@@ -1430,7 +1482,7 @@ static void sub_805A2D0(u8 taskId)
/* Fishing */
-static u8 (*const sFishingStateFuncs[])(struct Task *) =
+static bool8 (*const sFishingStateFuncs[])(struct Task *) =
{
Fishing1,
Fishing2,
@@ -1450,9 +1502,6 @@ static u8 (*const sFishingStateFuncs[])(struct Task *) =
Fishing16,
};
-static void Task_Fishing(u8 taskId);
-static void sub_805A954(void);
-
#define tStep data[0]
#define tFrameCounter data[1]
#define tNumDots data[2]
@@ -1483,15 +1532,15 @@ static void Task_Fishing(u8 taskId)
;
}
-u8 Fishing1(struct Task *task)
+static bool8 Fishing1(struct Task *task)
{
ScriptContext2_Enable();
gPlayerAvatar.preventStep = TRUE;
task->tStep++;
- return 0;
+ return FALSE;
}
-u8 Fishing2(struct Task *task)
+static bool8 Fishing2(struct Task *task)
{
struct EventObject *playerEventObj;
const s16 arr1[] = {1, 1, 1};
@@ -1505,21 +1554,21 @@ u8 Fishing2(struct Task *task)
playerEventObj->enableAnim = 1;
sub_8059C3C(playerEventObj->facingDirection);
task->tStep++;
- return 0;
+ return FALSE;
}
-u8 Fishing3(struct Task *task)
+static bool8 Fishing3(struct Task *task)
{
- sub_805A954();
+ AlignFishingAnimationFrames();
// Wait one second before starting dot game
task->tFrameCounter++;
if (task->tFrameCounter >= 60)
task->tStep++;
- return 0;
+ return FALSE;
}
-u8 Fishing4(struct Task *task)
+static bool8 Fishing4(struct Task *task)
{
u32 randVal;
@@ -1534,15 +1583,15 @@ u8 Fishing4(struct Task *task)
task->tDotsRequired = randVal + 4;
if (task->tDotsRequired >= 10)
task->tDotsRequired = 10;
- return 1;
+ return TRUE;
}
// Play a round of the dot game
-u8 Fishing5(struct Task *task)
+static bool8 Fishing5(struct Task *task)
{
const u8 dot[] = _("·");
- sub_805A954();
+ AlignFishingAnimationFrames();
task->tFrameCounter++;
if (gMain.newKeys & A_BUTTON)
{
@@ -1569,48 +1618,48 @@ u8 Fishing5(struct Task *task)
task->tNumDots++;
}
}
- return 0;
+ return FALSE;
}
}
// Determine if fish bites
-u8 Fishing6(struct Task *task)
+static bool8 Fishing6(struct Task *task)
{
- sub_805A954();
+ AlignFishingAnimationFrames();
task->tStep++;
if (!DoesCurrentMapHaveFishingMons() || (Random() & 1))
task->tStep = FISHING_NO_BITE;
else
StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingBiteDirectionAnimNum(GetPlayerFacingDirection()));
- return 1;
+ return TRUE;
}
// Oh! A Bite!
-u8 Fishing7(struct Task *task)
+static bool8 Fishing7(struct Task *task)
{
- sub_805A954();
+ AlignFishingAnimationFrames();
Menu_PrintText(gOtherText_OhABite, 4, 17);
task->tStep++;
task->tFrameCounter = 0;
- return 0;
+ return FALSE;
}
// We have a bite. Now, wait for the player to press A, or the timer to expire.
-u8 Fishing8(struct Task *task)
+static bool8 Fishing8(struct Task *task)
{
const s16 reelTimeouts[3] = {36, 33, 30};
- sub_805A954();
+ AlignFishingAnimationFrames();
task->tFrameCounter++;
if (task->tFrameCounter >= reelTimeouts[task->tFishingRod])
task->tStep = FISHING_GOT_AWAY;
else if (gMain.newKeys & A_BUTTON)
task->tStep++;
- return 0;
+ return FALSE;
}
// Determine if we're going to play the dot game again
-u8 Fishing9(struct Task *task)
+static bool8 Fishing9(struct Task *task)
{
const s16 arr[][2] =
{
@@ -1619,7 +1668,7 @@ u8 Fishing9(struct Task *task)
{70, 30}
};
- sub_805A954();
+ AlignFishingAnimationFrames();
task->tStep++;
if (task->tRoundsPlayed < task->tMinRoundsRequired)
{
@@ -1633,23 +1682,23 @@ u8 Fishing9(struct Task *task)
if (arr[task->tFishingRod][task->tRoundsPlayed] > probability)
task->tStep = FISHING_START_ROUND;
}
- return 0;
+ return FALSE;
}
-u8 Fishing10(struct Task *task)
+static bool8 Fishing10(struct Task *task)
{
- sub_805A954();
+ AlignFishingAnimationFrames();
MenuPrintMessageDefaultCoords(gOtherText_PokeOnHook);
Menu_DisplayDialogueFrame();
task->tStep++;
task->tFrameCounter = 0;
- return 0;
+ return FALSE;
}
-u8 Fishing11(struct Task *task)
+static bool8 Fishing11(struct Task *task)
{
if (task->tFrameCounter == 0)
- sub_805A954();
+ AlignFishingAnimationFrames();
if (task->tFrameCounter == 0)
{
@@ -1665,7 +1714,7 @@ u8 Fishing11(struct Task *task)
gSprites[gPlayerAvatar.spriteId].pos2.y = 0;
Menu_EraseScreen();
task->tFrameCounter++;
- return 0;
+ return FALSE;
}
}
@@ -1677,41 +1726,41 @@ u8 Fishing11(struct Task *task)
sub_80BE97C(1);
DestroyTask(FindTaskIdByFunc(Task_Fishing));
}
- return 0;
+ return FALSE;
}
// Not even a nibble
-u8 Fishing12(struct Task *task)
+static bool8 Fishing12(struct Task *task)
{
- sub_805A954();
+ AlignFishingAnimationFrames();
StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingNoCatchDirectionAnimNum(GetPlayerFacingDirection()));
MenuPrintMessageDefaultCoords(gOtherText_NotEvenANibble);
task->tStep = FISHING_SHOW_RESULT;
- return 1;
+ return TRUE;
}
// It got away
-u8 Fishing13(struct Task *task)
+static bool8 Fishing13(struct Task *task)
{
- sub_805A954();
+ AlignFishingAnimationFrames();
StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingNoCatchDirectionAnimNum(GetPlayerFacingDirection()));
MenuPrintMessageDefaultCoords(gOtherText_ItGotAway);
task->tStep++;
- return 1;
+ return TRUE;
}
// Display the message
-u8 Fishing14(struct Task *task)
+static bool8 Fishing14(struct Task *task)
{
- sub_805A954();
+ AlignFishingAnimationFrames();
Menu_DisplayDialogueFrame();
task->tStep++;
- return 0;
+ return FALSE;
}
-u8 Fishing15(struct Task *task)
+static bool8 Fishing15(struct Task *task)
{
- sub_805A954();
+ AlignFishingAnimationFrames();
if (gSprites[gPlayerAvatar.spriteId].animEnded)
{
struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
@@ -1724,10 +1773,10 @@ u8 Fishing15(struct Task *task)
gSprites[gPlayerAvatar.spriteId].pos2.y = 0;
task->tStep++;
}
- return 0;
+ return FALSE;
}
-u8 Fishing16(struct Task *task)
+static bool8 Fishing16(struct Task *task)
{
if (Menu_UpdateWindowText())
{
@@ -1738,14 +1787,14 @@ u8 Fishing16(struct Task *task)
sub_80BE97C(0);
DestroyTask(FindTaskIdByFunc(Task_Fishing));
}
- return 0;
+ return FALSE;
}
#undef tStep
#undef tFrameCounter
#undef tFishingRod
-static void sub_805A954(void)
+static void AlignFishingAnimationFrames(void)
{
struct Sprite *playerSprite = &gSprites[gPlayerAvatar.spriteId];
u8 animCmdIndex;
diff --git a/src/fldeff_berrytree.c b/src/fldeff_berrytree.c
index 8ff418ee6..a319c959b 100644
--- a/src/fldeff_berrytree.c
+++ b/src/fldeff_berrytree.c
@@ -2,6 +2,7 @@
#include "event_object_movement.h"
#include "field_player_avatar.h"
#include "script.h"
+#include "task.h"
static void Task_WateringBerryTreeAnim_0(u8);
static void Task_WateringBerryTreeAnim_1(u8);
diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c
index 13cadd6ec..217e8ccdf 100644
--- a/src/pokemon_summary_screen.c
+++ b/src/pokemon_summary_screen.c
@@ -1,11 +1,9 @@
#include "global.h"
-#include "constants/items.h"
-#include "constants/songs.h"
-#include "constants/species.h"
#include "battle.h"
#include "battle_anim_813F0F4.h"
#include "contest.h"
#include "data2.h"
+#include "daycare.h"
#include "decompress.h"
#include "event_data.h"
#include "ewram.h"
@@ -23,6 +21,7 @@
#include "pokemon.h"
#include "pokemon_summary_screen.h"
#include "region_map.h"
+#include "scanline_effect.h"
#include "sound.h"
#include "sprite.h"
#include "string_util.h"
@@ -30,8 +29,9 @@
#include "strings2.h"
#include "task.h"
#include "tv.h"
-#include "scanline_effect.h"
-#include "daycare.h"
+#include "constants/items.h"
+#include "constants/songs.h"
+#include "constants/species.h"
static void SummaryScreen_PrintPokemonInfoLabels(void);
static void SummaryScreen_PrintPokemonSkillsLabels(void);
@@ -181,7 +181,10 @@ static const union AffineAnimCmd *const sUnsuedSpriteAffineAnimTable[] = {
sUnusedSpriteAffineAnim,
};
-static const struct OamData sOamData_83C109C = {
+#define TAG_MOVE_TYPES 30002
+
+static const struct OamData sOamData_MoveTypes =
+{
.y = 0,
.affineMode = 0,
.objMode = 0,
@@ -196,71 +199,169 @@ static const struct OamData sOamData_83C109C = {
.paletteNum = 0,
.affineParam = 0,
};
+static const union AnimCmd sSpriteAnim_TypeNormal[] = {
+ ANIMCMD_FRAME(TYPE_NORMAL * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypeFighting[] = {
+ ANIMCMD_FRAME(TYPE_FIGHTING * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypeFlying[] = {
+ ANIMCMD_FRAME(TYPE_FLYING * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypePoison[] = {
+ ANIMCMD_FRAME(TYPE_POISON * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypeGround[] = {
+ ANIMCMD_FRAME(TYPE_GROUND * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypeRock[] = {
+ ANIMCMD_FRAME(TYPE_ROCK * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypeBug[] = {
+ ANIMCMD_FRAME(TYPE_BUG * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypeGhost[] = {
+ ANIMCMD_FRAME(TYPE_GHOST * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypeSteel[] = {
+ ANIMCMD_FRAME(TYPE_STEEL * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypeMystery[] = {
+ ANIMCMD_FRAME(TYPE_MYSTERY * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypeFire[] = {
+ ANIMCMD_FRAME(TYPE_FIRE * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypeWater[] = {
+ ANIMCMD_FRAME(TYPE_WATER * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypeGrass[] = {
+ ANIMCMD_FRAME(TYPE_GRASS * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypeElectric[] = {
+ ANIMCMD_FRAME(TYPE_ELECTRIC * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypePsychic[] = {
+ ANIMCMD_FRAME(TYPE_PSYCHIC * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypeIce[] = {
+ ANIMCMD_FRAME(TYPE_ICE * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypeDragon[] = {
+ ANIMCMD_FRAME(TYPE_DRAGON * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_TypeDark[] = {
+ ANIMCMD_FRAME(TYPE_DARK * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_CategoryCool[] = {
+ ANIMCMD_FRAME((CONTEST_CATEGORY_COOL + NUMBER_OF_MON_TYPES) * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_CategoryBeauty[] = {
+ ANIMCMD_FRAME((CONTEST_CATEGORY_BEAUTY + NUMBER_OF_MON_TYPES) * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_CategoryCute[] = {
+ ANIMCMD_FRAME((CONTEST_CATEGORY_CUTE + NUMBER_OF_MON_TYPES) * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_CategorySmart[] = {
+ ANIMCMD_FRAME((CONTEST_CATEGORY_SMART + NUMBER_OF_MON_TYPES) * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_CategoryTough[] = {
+ ANIMCMD_FRAME((CONTEST_CATEGORY_TOUGH + NUMBER_OF_MON_TYPES) * 8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
-static const union AnimCmd sSpriteAnim_83C10A4[] = { ANIMCMD_FRAME(0, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C10AC[] = { ANIMCMD_FRAME(8, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C10B4[] = { ANIMCMD_FRAME(16, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C10BC[] = { ANIMCMD_FRAME(24, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C10C4[] = { ANIMCMD_FRAME(32, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C10CC[] = { ANIMCMD_FRAME(40, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C10D4[] = { ANIMCMD_FRAME(48, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C10DC[] = { ANIMCMD_FRAME(56, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C10E4[] = { ANIMCMD_FRAME(64, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C10EC[] = { ANIMCMD_FRAME(72, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C10F4[] = { ANIMCMD_FRAME(80, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C10FC[] = { ANIMCMD_FRAME(88, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C1104[] = { ANIMCMD_FRAME(96, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C110C[] = { ANIMCMD_FRAME(104, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C1114[] = { ANIMCMD_FRAME(112, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C111C[] = { ANIMCMD_FRAME(120, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C1124[] = { ANIMCMD_FRAME(128, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C112C[] = { ANIMCMD_FRAME(136, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C1134[] = { ANIMCMD_FRAME(144, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C113C[] = { ANIMCMD_FRAME(152, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C1144[] = { ANIMCMD_FRAME(160, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C114C[] = { ANIMCMD_FRAME(168, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C1154[] = { ANIMCMD_FRAME(176, 0), ANIMCMD_END, };
-
-static const union AnimCmd *const sSpriteAnimTable_83C115C[] = {
- sSpriteAnim_83C10A4,
- sSpriteAnim_83C10AC,
- sSpriteAnim_83C10B4,
- sSpriteAnim_83C10BC,
- sSpriteAnim_83C10C4,
- sSpriteAnim_83C10CC,
- sSpriteAnim_83C10D4,
- sSpriteAnim_83C10DC,
- sSpriteAnim_83C10E4,
- sSpriteAnim_83C10EC,
- sSpriteAnim_83C10F4,
- sSpriteAnim_83C10FC,
- sSpriteAnim_83C1104,
- sSpriteAnim_83C110C,
- sSpriteAnim_83C1114,
- sSpriteAnim_83C111C,
- sSpriteAnim_83C1124,
- sSpriteAnim_83C112C,
- sSpriteAnim_83C1134,
- sSpriteAnim_83C113C,
- sSpriteAnim_83C1144,
- sSpriteAnim_83C114C,
- sSpriteAnim_83C1154,
+static const union AnimCmd *const sSpriteAnimTable_MoveTypes[NUMBER_OF_MON_TYPES + CONTEST_CATEGORIES_COUNT] = {
+ sSpriteAnim_TypeNormal,
+ sSpriteAnim_TypeFighting,
+ sSpriteAnim_TypeFlying,
+ sSpriteAnim_TypePoison,
+ sSpriteAnim_TypeGround,
+ sSpriteAnim_TypeRock,
+ sSpriteAnim_TypeBug,
+ sSpriteAnim_TypeGhost,
+ sSpriteAnim_TypeSteel,
+ sSpriteAnim_TypeMystery,
+ sSpriteAnim_TypeFire,
+ sSpriteAnim_TypeWater,
+ sSpriteAnim_TypeGrass,
+ sSpriteAnim_TypeElectric,
+ sSpriteAnim_TypePsychic,
+ sSpriteAnim_TypeIce,
+ sSpriteAnim_TypeDragon,
+ sSpriteAnim_TypeDark,
+ sSpriteAnim_CategoryCool,
+ sSpriteAnim_CategoryBeauty,
+ sSpriteAnim_CategoryCute,
+ sSpriteAnim_CategorySmart,
+ sSpriteAnim_CategoryTough,
};
-static const struct CompressedSpriteSheet sUnknown_083C11B8 = { gMoveTypes_Gfx, 0x1700, 30002 };
+static const struct CompressedSpriteSheet sSpriteSheet_MoveTypes =
+{
+ .data = gMoveTypes_Gfx,
+ .size = (NUMBER_OF_MON_TYPES + CONTEST_CATEGORIES_COUNT) * 0x100,
+ .tag = TAG_MOVE_TYPES
+};
-static const struct SpriteTemplate sSpriteTemplate_83C11C0 = {
- .tileTag = 30002,
- .paletteTag = 30002,
- .oam = &sOamData_83C109C,
- .anims = sSpriteAnimTable_83C115C,
+static const struct SpriteTemplate sSpriteTemplate_MoveTypes =
+{
+ .tileTag = TAG_MOVE_TYPES,
+ .paletteTag = TAG_MOVE_TYPES,
+ .oam = &sOamData_MoveTypes,
+ .anims = sSpriteAnimTable_MoveTypes,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
-static const u8 sUnknown_PaletteNums[] = { 0xD, 0xD, 0xE, 0xE, 0xD, 0xD, 0xF, 0xE, 0xD, 0xF, 0xD, 0xE, 0xF, 0xD, 0xE, 0xE, 0xF, 0xD, 0xD, 0xE, 0xE, 0xF, 0xD };
-
+static const u8 sMoveTypeToOamPaletteNum[NUMBER_OF_MON_TYPES + CONTEST_CATEGORIES_COUNT] =
+{
+ [TYPE_NORMAL] = 13,
+ [TYPE_FIGHTING] = 13,
+ [TYPE_FLYING] = 14,
+ [TYPE_POISON] = 14,
+ [TYPE_GROUND] = 13,
+ [TYPE_ROCK] = 13,
+ [TYPE_BUG] = 15,
+ [TYPE_GHOST] = 14,
+ [TYPE_STEEL] = 13,
+ [TYPE_MYSTERY] = 15,
+ [TYPE_FIRE] = 13,
+ [TYPE_WATER] = 14,
+ [TYPE_GRASS] = 15,
+ [TYPE_ELECTRIC] = 13,
+ [TYPE_PSYCHIC] = 14,
+ [TYPE_ICE] = 14,
+ [TYPE_DRAGON] = 15,
+ [TYPE_DARK] = 13,
+ [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_COOL] = 13,
+ [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_BEAUTY] = 14,
+ [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_CUTE] = 14,
+ [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_SMART] = 15,
+ [NUMBER_OF_MON_TYPES + CONTEST_CATEGORY_TOUGH] = 13,
+};
static const struct OamData sOamData_83C11F0 = {
.y = 0,
.affineMode = 0,
@@ -314,7 +415,8 @@ static const struct SpriteTemplate sSpriteTemplate_83C1280 = {
.callback = SpriteCallbackDummy,
};
-static const struct OamData sOamData_83C1298 = {
+static const struct OamData sOamData_StatusCondition =
+{
.y = 0,
.affineMode = 0,
.objMode = 0,
@@ -330,32 +432,65 @@ static const struct OamData sOamData_83C1298 = {
.affineParam = 0,
};
-static const union AnimCmd sSpriteAnim_83C12A0[] = { ANIMCMD_FRAME(0, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C12A8[] = { ANIMCMD_FRAME(4, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C12B0[] = { ANIMCMD_FRAME(8, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C12B8[] = { ANIMCMD_FRAME(12, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C12C0[] = { ANIMCMD_FRAME(16, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C12C8[] = { ANIMCMD_FRAME(20, 0), ANIMCMD_END, };
-static const union AnimCmd sSpriteAnim_83C12D0[] = { ANIMCMD_FRAME(24, 0), ANIMCMD_END, };
-
-static const union AnimCmd *const sSpriteAnimTable_83C12D8[] = {
- sSpriteAnim_83C12A0,
- sSpriteAnim_83C12A8,
- sSpriteAnim_83C12B0,
- sSpriteAnim_83C12B8,
- sSpriteAnim_83C12C0,
- sSpriteAnim_83C12C8,
- sSpriteAnim_83C12D0,
+static const union AnimCmd sSpriteAnim_StatusPoison[] = {
+ ANIMCMD_FRAME(0, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_StatusParalyzed[] = {
+ ANIMCMD_FRAME(4, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_StatusSleep[] = {
+ ANIMCMD_FRAME(8, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_StatusFrozen[] = {
+ ANIMCMD_FRAME(12, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_StatusBurn[] = {
+ ANIMCMD_FRAME(16, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_StatusPokerus[] = {
+ ANIMCMD_FRAME(20, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+static const union AnimCmd sSpriteAnim_StatusFaint[] = {
+ ANIMCMD_FRAME(24, 0, FALSE, FALSE),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const sSpriteAnimTable_StatusCondition[] =
+{
+ sSpriteAnim_StatusPoison,
+ sSpriteAnim_StatusParalyzed,
+ sSpriteAnim_StatusSleep,
+ sSpriteAnim_StatusFrozen,
+ sSpriteAnim_StatusBurn,
+ sSpriteAnim_StatusPokerus,
+ sSpriteAnim_StatusFaint,
};
-static const struct CompressedSpriteSheet sUnknown_083C12F4 = { gStatusGfx_Icons, 0x380, 30001 };
-static const struct CompressedSpritePalette sUnknown_083C12FC = { gStatusPal_Icons, 30001 };
+static const struct CompressedSpriteSheet sUnknown_083C12F4 =
+{
+ .data = gStatusGfx_Icons,
+ .size = 0x380,
+ .tag = 30001
+};
-static const struct SpriteTemplate sSpriteTemplate_83C1304 = {
+static const struct CompressedSpritePalette sUnknown_083C12FC =
+{
+ .data = gStatusPal_Icons,
+ .tag = 30001
+};
+
+static const struct SpriteTemplate sSpriteTemplate_StatusCondition =
+{
.tileTag = 30001,
.paletteTag = 30001,
- .oam = &sOamData_83C1298,
- .anims = sSpriteAnimTable_83C12D8,
+ .oam = &sOamData_StatusCondition,
+ .anims = sSpriteAnimTable_StatusCondition,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
@@ -735,7 +870,7 @@ static bool8 LoadPokemonSummaryScreenGraphics(void)
LoadCompressedPalette(gStatusScreen_Pal, 0, 160);
break;
case 7:
- LoadCompressedObjectPic(&sUnknown_083C11B8);
+ LoadCompressedObjectPic(&sSpriteSheet_MoveTypes);
break;
case 8:
LoadCompressedObjectPic(&sUnknown_083C1270);
@@ -4530,7 +4665,7 @@ static void sub_80A1950(void)
for (i = 0; i < 5; i++)
{
if (ewram1A000[i] == 0xFF)
- ewram1A000[i] = CreateSprite(&sSpriteTemplate_83C11C0, 0, 0, 2);
+ ewram1A000[i] = CreateSprite(&sSpriteTemplate_MoveTypes, 0, 0, 2);
sub_80A1918(i, 1);
}
@@ -4540,7 +4675,7 @@ static void SummaryScreen_DrawTypeIcon(u8 animNum, u8 x, u8 y, u8 d)
{
StartSpriteAnim(&gSprites[ewram1A000[d]], animNum);
- gSprites[ewram1A000[d]].oam.paletteNum = sUnknown_PaletteNums[animNum];
+ gSprites[ewram1A000[d]].oam.paletteNum = sMoveTypeToOamPaletteNum[animNum];
gSprites[ewram1A000[d]].pos1.x = x + 16;
gSprites[ewram1A000[d]].pos1.y = y + 8;
@@ -4685,7 +4820,7 @@ void sub_80A1D18(void)
statusAndPkrs2 = statusAndPkrs - 1;
if (ewram1A000[29] == 0xFF)
- ewram1A000[29] = CreateSprite(&sSpriteTemplate_83C1304, 64, 152, 0);
+ ewram1A000[29] = CreateSprite(&sSpriteTemplate_StatusCondition, 64, 152, 0);
}
else
{
@@ -4717,7 +4852,7 @@ void sub_80A1D18(void)
ldrb r0, [r4]\n\
cmp r0, 0xFF\n\
bne _080A1D60\n\
- ldr r0, _080A1D54 @ =sSpriteTemplate_83C1304\n\
+ ldr r0, _080A1D54 @ =sSpriteTemplate_StatusCondition\n\
movs r1, 0x40\n\
movs r2, 0x98\n\
movs r3, 0\n\
@@ -4726,7 +4861,7 @@ void sub_80A1D18(void)
b _080A1D60\n\
.align 2, 0\n\
_080A1D50: .4byte gSharedMem + 0x1A01D\n\
-_080A1D54: .4byte sSpriteTemplate_83C1304\n\
+_080A1D54: .4byte sSpriteTemplate_StatusCondition\n\
_080A1D58:\n\
movs r0, 0x1D\n\
bl sub_80A18E4\n\
diff --git a/src/wallclock.c b/src/wallclock.c
index bdef8e0f4..41142e5e2 100644
--- a/src/wallclock.c
+++ b/src/wallclock.c
@@ -1,16 +1,16 @@
#include "global.h"
-#include "wallclock.h"
#include "decompress.h"
#include "main.h"
#include "menu.h"
#include "palette.h"
#include "rtc.h"
-#include "constants/songs.h"
+#include "scanline_effect.h"
#include "sound.h"
#include "strings2.h"
#include "task.h"
#include "trig.h"
-#include "scanline_effect.h"
+#include "wallclock.h"
+#include "constants/songs.h"
extern u16 gSpecialVar_0x8004;
extern u8 gMiscClock_Gfx[];
@@ -19,6 +19,44 @@ extern u8 gUnknown_08E954B0[];
extern u16 gMiscClockMale_Pal[];
extern u16 gMiscClockFemale_Pal[];
+static void WallClockMainCallback(void);
+static void WallClockInit(void);
+static void Task_SetClock1(u8 taskId);
+static void Task_SetClock2(u8 taskId);
+static void Task_SetClock3(u8 taskId);
+static void Task_SetClock4(u8 taskId);
+static void Task_SetClock5(u8 taskId);
+static void Task_SetClock6(u8 taskId);
+static void Task_ViewClock1(u8 taskId);
+static void Task_ViewClock2(u8 taskId);
+static void Task_ViewClock3(u8 taskId);
+static void Task_ViewClock4(u8 taskId);
+static u8 CalcMinHandDelta(u16 speed);
+static u16 CalcNewMinHandAngle(u16 angle, u8 direction, u8 speed);
+static u8 AdvanceClock(u8 taskId, u8 direction);
+static void UpdateClockPeriod(u8 taskId, u8 direction);
+static void InitClockWithRtc(u8 taskId);
+static void SpriteCB_MinuteHand(struct Sprite *sprite);
+static void SpriteCB_HourHand(struct Sprite *sprite);
+static void SpriteCB_AMIndicator(struct Sprite *sprite);
+static void SpriteCB_PMIndicator(struct Sprite *sprite);
+
+#define TAG_GFX_WALL_CLOCK_HAND 0x1000
+#define TAG_PAL_WALL_CLOCK_HAND 0x1000
+
+enum
+{
+ PERIOD_AM,
+ PERIOD_PM,
+};
+
+enum
+{
+ MVMT_NONE,
+ MVMT_BACKWARD,
+ MVMT_FORWARD,
+};
+
//--------------------------------------------------
// Graphics Data
//--------------------------------------------------
@@ -69,27 +107,27 @@ static const union AnimCmd *const gSpriteAnimTable_83F7AD4[] =
{
gSpriteAnim_83F7AC8,
};
-static void sub_810B05C(struct Sprite *sprite);
+
static const struct SpriteTemplate gSpriteTemplate_83F7AD8 =
{
- .tileTag = 0x1000,
- .paletteTag = 0x1000,
+ .tileTag = TAG_GFX_WALL_CLOCK_HAND,
+ .paletteTag = TAG_PAL_WALL_CLOCK_HAND,
.oam = &gOamData_83F7AB8,
.anims = gSpriteAnimTable_83F7AD0,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_810B05C,
+ .callback = SpriteCB_MinuteHand,
};
-static void sub_810B0F4(struct Sprite *sprite);
+
static const struct SpriteTemplate gSpriteTemplate_83F7AF0 =
{
- .tileTag = 0x1000,
- .paletteTag = 0x1000,
+ .tileTag = TAG_GFX_WALL_CLOCK_HAND,
+ .paletteTag = TAG_PAL_WALL_CLOCK_HAND,
.oam = &gOamData_83F7AB8,
.anims = gSpriteAnimTable_83F7AD4,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_810B0F4,
+ .callback = SpriteCB_HourHand,
};
static const struct OamData gOamData_83F7B08 =
{
@@ -125,61 +163,394 @@ static const union AnimCmd *const gSpriteAnimTable_83F7B24[] =
{
gSpriteAnim_83F7B18,
};
-static void sub_810B18C(struct Sprite *sprite);
+
static const struct SpriteTemplate gSpriteTemplate_83F7B28 =
{
- .tileTag = 0x1000,
- .paletteTag = 0x1000,
+ .tileTag = TAG_GFX_WALL_CLOCK_HAND,
+ .paletteTag = TAG_PAL_WALL_CLOCK_HAND,
.oam = &gOamData_83F7B08,
.anims = gSpriteAnimTable_83F7B20,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_810B18C,
+ .callback = SpriteCB_AMIndicator,
};
-static void sub_810B230(struct Sprite *sprite);
+
static const struct SpriteTemplate gSpriteTemplate_83F7B40 =
{
- .tileTag = 0x1000,
- .paletteTag = 0x1000,
+ .tileTag = TAG_GFX_WALL_CLOCK_HAND,
+ .paletteTag = TAG_PAL_WALL_CLOCK_HAND,
.oam = &gOamData_83F7B08,
.anims = gSpriteAnimTable_83F7B24,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
- .callback = sub_810B230,
+ .callback = SpriteCB_PMIndicator,
};
-static void WallClockVblankCallback(void);
-static void LoadWallClockGraphics(void);
-static void WallClockMainCallback(void);
-static void WallClockInit(void);
-static void Task_SetClock1(u8 taskId);
-static void Task_SetClock2(u8 taskId);
-static void Task_SetClock3(u8 taskId);
-static void Task_SetClock4(u8 taskId);
-static void Task_SetClock5(u8 taskId);
-static void Task_SetClock6(u8 taskId);
-static void Task_ViewClock1(u8 taskId);
-static void Task_ViewClock2(u8 taskId);
-static void Task_ViewClock3(u8 taskId);
-static void Task_ViewClock4(u8 taskId);
-static u8 CalcMinHandDelta(u16 speed);
-static u16 CalcNewMinHandAngle(u16 angle, u8 direction, u8 speed);
-static u8 AdvanceClock(u8 taskId, u8 direction);
-static void UpdateClockPeriod(u8 taskId, u8 direction);
-static void InitClockWithRtc(u8 taskId);
-
-enum
+static const s8 sClockHandCoords[][2] =
{
- PERIOD_AM,
- PERIOD_PM,
+ { 0, -24},
+ { 1, -25},
+ { 1, -25},
+ { 2, -25},
+ { 2, -25},
+ { 2, -25},
+ { 3, -24},
+ { 3, -25},
+ { 4, -25},
+ { 4, -25},
+ { 4, -25},
+ { 5, -25},
+ { 5, -25},
+ { 6, -24},
+ { 6, -24},
+ { 6, -24},
+ { 7, -24},
+ { 7, -24},
+ { 7, -24},
+ { 8, -24},
+ { 8, -24},
+ { 9, -24},
+ { 9, -24},
+ { 10, -23},
+ { 10, -23},
+ { 11, -22},
+ { 11, -22},
+ { 11, -22},
+ { 12, -22},
+ { 12, -21},
+ { 13, -21},
+ { 13, -21},
+ { 13, -21},
+ { 14, -21},
+ { 14, -21},
+ { 14, -20},
+ { 14, -20},
+ { 15, -20},
+ { 15, -19},
+ { 16, -19},
+ { 16, -19},
+ { 16, -19},
+ { 16, -18},
+ { 16, -18},
+ { 17, -18},
+ { 17, -17},
+ { 17, -17},
+ { 18, -17},
+ { 18, -17},
+ { 18, -16},
+ { 18, -16},
+ { 19, -16},
+ { 19, -15},
+ { 19, -15},
+ { 20, -15},
+ { 20, -14},
+ { 20, -14},
+ { 20, -13},
+ { 20, -13},
+ { 21, -13},
+ { 21, -13},
+ { 21, -12},
+ { 22, -12},
+ { 22, -12},
+ { 22, -11},
+ { 22, -11},
+ { 22, -10},
+ { 23, -10},
+ { 23, -9},
+ { 23, -9},
+ { 23, -9},
+ { 23, -9},
+ { 23, -8},
+ { 23, -8},
+ { 23, -7},
+ { 23, -7},
+ { 23, -6},
+ { 24, -6},
+ { 24, -6},
+ { 25, -5},
+ { 25, -5},
+ { 24, -4},
+ { 25, -4},
+ { 24, -3},
+ { 25, -3},
+ { 25, -3},
+ { 25, -2},
+ { 25, -2},
+ { 24, -1},
+ { 25, -1},
+ { 24, 0},
+ { 24, 0},
+ { 24, 0},
+ { 24, 1},
+ { 24, 1},
+ { 25, 2},
+ { 24, 2},
+ { 25, 2},
+ { 24, 3},
+ { 24, 3},
+ { 25, 4},
+ { 24, 4},
+ { 24, 5},
+ { 24, 5},
+ { 24, 5},
+ { 24, 6},
+ { 23, 6},
+ { 23, 6},
+ { 23, 7},
+ { 23, 8},
+ { 23, 8},
+ { 23, 8},
+ { 23, 9},
+ { 23, 9},
+ { 23, 10},
+ { 22, 10},
+ { 22, 10},
+ { 22, 11},
+ { 22, 11},
+ { 22, 11},
+ { 22, 12},
+ { 21, 12},
+ { 21, 12},
+ { 21, 13},
+ { 20, 13},
+ { 20, 13},
+ { 19, 13},
+ { 19, 13},
+ { 19, 14},
+ { 19, 14},
+ { 19, 15},
+ { 19, 15},
+ { 18, 15},
+ { 18, 16},
+ { 17, 16},
+ { 17, 16},
+ { 17, 17},
+ { 17, 17},
+ { 16, 17},
+ { 16, 18},
+ { 16, 18},
+ { 15, 18},
+ { 14, 18},
+ { 15, 19},
+ { 14, 19},
+ { 14, 19},
+ { 13, 19},
+ { 13, 20},
+ { 13, 20},
+ { 13, 20},
+ { 12, 20},
+ { 12, 20},
+ { 12, 21},
+ { 11, 21},
+ { 11, 21},
+ { 11, 21},
+ { 10, 21},
+ { 10, 22},
+ { 10, 22},
+ { 9, 22},
+ { 9, 22},
+ { 8, 22},
+ { 7, 22},
+ { 7, 23},
+ { 7, 23},
+ { 6, 23},
+ { 6, 23},
+ { 5, 23},
+ { 5, 23},
+ { 5, 24},
+ { 4, 24},
+ { 4, 24},
+ { 4, 24},
+ { 3, 24},
+ { 2, 24},
+ { 2, 24},
+ { 1, 24},
+ { 1, 24},
+ { 0, 24},
+ { 0, 24},
+ { -1, 23},
+ { 0, 24},
+ { 0, 24},
+ { -1, 24},
+ { -1, 24},
+ { -2, 24},
+ { -2, 24},
+ { -3, 24},
+ { -3, 24},
+ { -4, 24},
+ { -4, 24},
+ { -5, 24},
+ { -5, 23},
+ { -5, 23},
+ { -6, 23},
+ { -6, 23},
+ { -7, 23},
+ { -7, 23},
+ { -7, 23},
+ { -8, 23},
+ { -8, 22},
+ { -9, 22},
+ { -9, 22},
+ {-10, 22},
+ {-10, 22},
+ {-10, 21},
+ {-11, 21},
+ {-11, 21},
+ {-11, 21},
+ {-11, 20},
+ {-12, 20},
+ {-12, 20},
+ {-13, 20},
+ {-13, 20},
+ {-13, 19},
+ {-14, 19},
+ {-14, 19},
+ {-14, 19},
+ {-14, 18},
+ {-15, 18},
+ {-15, 18},
+ {-15, 17},
+ {-16, 17},
+ {-16, 17},
+ {-17, 17},
+ {-17, 16},
+ {-17, 16},
+ {-18, 16},
+ {-17, 15},
+ {-18, 15},
+ {-18, 15},
+ {-19, 15},
+ {-19, 14},
+ {-19, 14},
+ {-19, 13},
+ {-19, 13},
+ {-20, 13},
+ {-20, 12},
+ {-20, 12},
+ {-21, 12},
+ {-21, 12},
+ {-21, 11},
+ {-21, 11},
+ {-21, 10},
+ {-21, 10},
+ {-21, 9},
+ {-22, 9},
+ {-22, 9},
+ {-22, 8},
+ {-22, 8},
+ {-22, 7},
+ {-23, 7},
+ {-23, 7},
+ {-23, 6},
+ {-23, 6},
+ {-23, 5},
+ {-24, 5},
+ {-23, 4},
+ {-23, 4},
+ {-24, 4},
+ {-24, 4},
+ {-24, 3},
+ {-24, 3},
+ {-24, 2},
+ {-24, 2},
+ {-24, 1},
+ {-24, 1},
+ {-24, 1},
+ {-24, 0},
+ {-25, 0},
+ {-24, -1},
+ {-25, -1},
+ {-24, -1},
+ {-24, -2},
+ {-24, -2},
+ {-24, -3},
+ {-24, -3},
+ {-24, -4},
+ {-24, -4},
+ {-24, -4},
+ {-24, -5},
+ {-24, -5},
+ {-24, -6},
+ {-24, -6},
+ {-23, -6},
+ {-23, -7},
+ {-23, -7},
+ {-23, -8},
+ {-23, -8},
+ {-23, -9},
+ {-23, -9},
+ {-22, -9},
+ {-22, -9},
+ {-22, -10},
+ {-22, -10},
+ {-21, -10},
+ {-21, -11},
+ {-22, -11},
+ {-22, -12},
+ {-21, -12},
+ {-21, -13},
+ {-21, -13},
+ {-20, -13},
+ {-21, -14},
+ {-20, -14},
+ {-20, -14},
+ {-19, -14},
+ {-19, -15},
+ {-19, -15},
+ {-18, -16},
+ {-18, -16},
+ {-18, -16},
+ {-18, -17},
+ {-18, -17},
+ {-17, -17},
+ {-17, -18},
+ {-17, -18},
+ {-16, -18},
+ {-16, -18},
+ {-16, -19},
+ {-16, -19},
+ {-15, -19},
+ {-15, -19},
+ {-15, -20},
+ {-14, -20},
+ {-14, -20},
+ {-14, -21},
+ {-13, -21},
+ {-13, -21},
+ {-13, -21},
+ {-12, -21},
+ {-12, -22},
+ {-11, -22},
+ {-11, -22},
+ {-11, -22},
+ {-10, -22},
+ {-10, -22},
+ { -9, -22},
+ { -9, -23},
+ { -9, -23},
+ { -8, -23},
+ { -8, -23},
+ { -7, -23},
+ { -7, -23},
+ { -7, -24},
+ { -6, -24},
+ { -6, -24},
+ { -5, -24},
+ { -5, -24},
+ { -4, -24},
+ { -4, -24},
+ { -4, -24},
+ { -4, -25},
+ { -3, -25},
+ { -2, -25},
+ { -2, -24},
+ { -2, -24},
+ { -1, -25},
+ { -1, -25},
+ { 0, -25},
};
-enum
-{
- MVMT_NONE,
- MVMT_BACKWARD,
- MVMT_FORWARD,
-};
+// text
static void WallClockVblankCallback(void)
{
@@ -487,7 +858,7 @@ static u16 CalcNewMinHandAngle(u16 angle, u8 direction, u8 speed)
{
case MVMT_BACKWARD:
if (angle)
- angle = angle - delta;
+ angle -= delta;
else
angle = 360 - delta;
break;
@@ -581,384 +952,16 @@ static void InitClockWithRtc(u8 taskId)
gTasks[taskId].tPeriod = PERIOD_PM;
}
-static const s8 gClockHandCoords[][2] =
+static void SpriteCB_MinuteHand(struct Sprite *sprite)
{
- { 0, -24},
- { 1, -25},
- { 1, -25},
- { 2, -25},
- { 2, -25},
- { 2, -25},
- { 3, -24},
- { 3, -25},
- { 4, -25},
- { 4, -25},
- { 4, -25},
- { 5, -25},
- { 5, -25},
- { 6, -24},
- { 6, -24},
- { 6, -24},
- { 7, -24},
- { 7, -24},
- { 7, -24},
- { 8, -24},
- { 8, -24},
- { 9, -24},
- { 9, -24},
- { 10, -23},
- { 10, -23},
- { 11, -22},
- { 11, -22},
- { 11, -22},
- { 12, -22},
- { 12, -21},
- { 13, -21},
- { 13, -21},
- { 13, -21},
- { 14, -21},
- { 14, -21},
- { 14, -20},
- { 14, -20},
- { 15, -20},
- { 15, -19},
- { 16, -19},
- { 16, -19},
- { 16, -19},
- { 16, -18},
- { 16, -18},
- { 17, -18},
- { 17, -17},
- { 17, -17},
- { 18, -17},
- { 18, -17},
- { 18, -16},
- { 18, -16},
- { 19, -16},
- { 19, -15},
- { 19, -15},
- { 20, -15},
- { 20, -14},
- { 20, -14},
- { 20, -13},
- { 20, -13},
- { 21, -13},
- { 21, -13},
- { 21, -12},
- { 22, -12},
- { 22, -12},
- { 22, -11},
- { 22, -11},
- { 22, -10},
- { 23, -10},
- { 23, -9},
- { 23, -9},
- { 23, -9},
- { 23, -9},
- { 23, -8},
- { 23, -8},
- { 23, -7},
- { 23, -7},
- { 23, -6},
- { 24, -6},
- { 24, -6},
- { 25, -5},
- { 25, -5},
- { 24, -4},
- { 25, -4},
- { 24, -3},
- { 25, -3},
- { 25, -3},
- { 25, -2},
- { 25, -2},
- { 24, -1},
- { 25, -1},
- { 24, 0},
- { 24, 0},
- { 24, 0},
- { 24, 1},
- { 24, 1},
- { 25, 2},
- { 24, 2},
- { 25, 2},
- { 24, 3},
- { 24, 3},
- { 25, 4},
- { 24, 4},
- { 24, 5},
- { 24, 5},
- { 24, 5},
- { 24, 6},
- { 23, 6},
- { 23, 6},
- { 23, 7},
- { 23, 8},
- { 23, 8},
- { 23, 8},
- { 23, 9},
- { 23, 9},
- { 23, 10},
- { 22, 10},
- { 22, 10},
- { 22, 11},
- { 22, 11},
- { 22, 11},
- { 22, 12},
- { 21, 12},
- { 21, 12},
- { 21, 13},
- { 20, 13},
- { 20, 13},
- { 19, 13},
- { 19, 13},
- { 19, 14},
- { 19, 14},
- { 19, 15},
- { 19, 15},
- { 18, 15},
- { 18, 16},
- { 17, 16},
- { 17, 16},
- { 17, 17},
- { 17, 17},
- { 16, 17},
- { 16, 18},
- { 16, 18},
- { 15, 18},
- { 14, 18},
- { 15, 19},
- { 14, 19},
- { 14, 19},
- { 13, 19},
- { 13, 20},
- { 13, 20},
- { 13, 20},
- { 12, 20},
- { 12, 20},
- { 12, 21},
- { 11, 21},
- { 11, 21},
- { 11, 21},
- { 10, 21},
- { 10, 22},
- { 10, 22},
- { 9, 22},
- { 9, 22},
- { 8, 22},
- { 7, 22},
- { 7, 23},
- { 7, 23},
- { 6, 23},
- { 6, 23},
- { 5, 23},
- { 5, 23},
- { 5, 24},
- { 4, 24},
- { 4, 24},
- { 4, 24},
- { 3, 24},
- { 2, 24},
- { 2, 24},
- { 1, 24},
- { 1, 24},
- { 0, 24},
- { 0, 24},
- { -1, 23},
- { 0, 24},
- { 0, 24},
- { -1, 24},
- { -1, 24},
- { -2, 24},
- { -2, 24},
- { -3, 24},
- { -3, 24},
- { -4, 24},
- { -4, 24},
- { -5, 24},
- { -5, 23},
- { -5, 23},
- { -6, 23},
- { -6, 23},
- { -7, 23},
- { -7, 23},
- { -7, 23},
- { -8, 23},
- { -8, 22},
- { -9, 22},
- { -9, 22},
- {-10, 22},
- {-10, 22},
- {-10, 21},
- {-11, 21},
- {-11, 21},
- {-11, 21},
- {-11, 20},
- {-12, 20},
- {-12, 20},
- {-13, 20},
- {-13, 20},
- {-13, 19},
- {-14, 19},
- {-14, 19},
- {-14, 19},
- {-14, 18},
- {-15, 18},
- {-15, 18},
- {-15, 17},
- {-16, 17},
- {-16, 17},
- {-17, 17},
- {-17, 16},
- {-17, 16},
- {-18, 16},
- {-17, 15},
- {-18, 15},
- {-18, 15},
- {-19, 15},
- {-19, 14},
- {-19, 14},
- {-19, 13},
- {-19, 13},
- {-20, 13},
- {-20, 12},
- {-20, 12},
- {-21, 12},
- {-21, 12},
- {-21, 11},
- {-21, 11},
- {-21, 10},
- {-21, 10},
- {-21, 9},
- {-22, 9},
- {-22, 9},
- {-22, 8},
- {-22, 8},
- {-22, 7},
- {-23, 7},
- {-23, 7},
- {-23, 6},
- {-23, 6},
- {-23, 5},
- {-24, 5},
- {-23, 4},
- {-23, 4},
- {-24, 4},
- {-24, 4},
- {-24, 3},
- {-24, 3},
- {-24, 2},
- {-24, 2},
- {-24, 1},
- {-24, 1},
- {-24, 1},
- {-24, 0},
- {-25, 0},
- {-24, -1},
- {-25, -1},
- {-24, -1},
- {-24, -2},
- {-24, -2},
- {-24, -3},
- {-24, -3},
- {-24, -4},
- {-24, -4},
- {-24, -4},
- {-24, -5},
- {-24, -5},
- {-24, -6},
- {-24, -6},
- {-23, -6},
- {-23, -7},
- {-23, -7},
- {-23, -8},
- {-23, -8},
- {-23, -9},
- {-23, -9},
- {-22, -9},
- {-22, -9},
- {-22, -10},
- {-22, -10},
- {-21, -10},
- {-21, -11},
- {-22, -11},
- {-22, -12},
- {-21, -12},
- {-21, -13},
- {-21, -13},
- {-20, -13},
- {-21, -14},
- {-20, -14},
- {-20, -14},
- {-19, -14},
- {-19, -15},
- {-19, -15},
- {-18, -16},
- {-18, -16},
- {-18, -16},
- {-18, -17},
- {-18, -17},
- {-17, -17},
- {-17, -18},
- {-17, -18},
- {-16, -18},
- {-16, -18},
- {-16, -19},
- {-16, -19},
- {-15, -19},
- {-15, -19},
- {-15, -20},
- {-14, -20},
- {-14, -20},
- {-14, -21},
- {-13, -21},
- {-13, -21},
- {-13, -21},
- {-12, -21},
- {-12, -22},
- {-11, -22},
- {-11, -22},
- {-11, -22},
- {-10, -22},
- {-10, -22},
- { -9, -22},
- { -9, -23},
- { -9, -23},
- { -8, -23},
- { -8, -23},
- { -7, -23},
- { -7, -23},
- { -7, -24},
- { -6, -24},
- { -6, -24},
- { -5, -24},
- { -5, -24},
- { -4, -24},
- { -4, -24},
- { -4, -24},
- { -4, -25},
- { -3, -25},
- { -2, -25},
- { -2, -24},
- { -2, -24},
- { -1, -25},
- { -1, -25},
- { 0, -25},
-};
+ u16 angle = gTasks[sprite->data[0]].tMinuteHandAngle;
+ s16 sin = Sin2(angle) / 16;
+ s16 cos = Cos2(angle) / 16;
+ u16 x, y;
-static void sub_810B05C(struct Sprite *sprite)
-{
- u16 angle;
- s16 sin;
- s16 cos;
- u16 x;
- u16 y;
-
- angle = gTasks[sprite->data[0]].tMinuteHandAngle;
- sin = Sin2(angle) / 16;
- cos = Cos2(angle) / 16;
SetOamMatrix(0, cos, sin, -sin, cos);
- x = gClockHandCoords[angle][0];
- y = gClockHandCoords[angle][1];
+ x = sClockHandCoords[angle][0];
+ y = sClockHandCoords[angle][1];
//Manual sign extension
if (x > 0x80)
@@ -970,20 +973,16 @@ static void sub_810B05C(struct Sprite *sprite)
sprite->pos2.y = y;
}
-static void sub_810B0F4(struct Sprite *sprite)
+static void SpriteCB_HourHand(struct Sprite *sprite)
{
- u16 angle;
- s16 sin;
- s16 cos;
- u16 x;
- u16 y;
-
- angle = gTasks[sprite->data[0]].tHourHandAngle;
- sin = Sin2(angle) / 16;
- cos = Cos2(angle) / 16;
+ u16 angle = gTasks[sprite->data[0]].tHourHandAngle;
+ s16 sin = Sin2(angle) / 16;
+ s16 cos = Cos2(angle) / 16;
+ u16 x, y;
+
SetOamMatrix(1, cos, sin, -sin, cos);
- x = gClockHandCoords[angle][0];
- y = gClockHandCoords[angle][1];
+ x = sClockHandCoords[angle][0];
+ y = sClockHandCoords[angle][1];
//Manual sign extension
if (x > 0x80)
@@ -995,11 +994,8 @@ static void sub_810B0F4(struct Sprite *sprite)
sprite->pos2.y = y;
}
-static void sub_810B18C(struct Sprite *sprite)
+static void SpriteCB_AMIndicator(struct Sprite *sprite)
{
- s16 sin;
- s16 cos;
-
if (gTasks[sprite->data[0]].tPeriod != PERIOD_AM)
{
if (sprite->data[1] >= 60 && sprite->data[1] < 90)
@@ -1014,17 +1010,12 @@ static void sub_810B18C(struct Sprite *sprite)
if (sprite->data[1] > 75)
sprite->data[1]--;
}
- cos = Cos2((u16)sprite->data[1]);
- sprite->pos2.x = cos * 30 / 4096;
- sin = Sin2((u16)sprite->data[1]);
- sprite->pos2.y = sin * 30 / 4096;
+ sprite->pos2.x = Cos2(sprite->data[1]) * 30 / 4096;
+ sprite->pos2.y = Sin2(sprite->data[1]) * 30 / 4096;
}
-static void sub_810B230(struct Sprite *sprite)
+static void SpriteCB_PMIndicator(struct Sprite *sprite)
{
- s16 sin;
- s16 cos;
-
if (gTasks[sprite->data[0]].tPeriod != PERIOD_AM)
{
if (sprite->data[1] >= 105 && sprite->data[1] < 135)
@@ -1039,8 +1030,6 @@ static void sub_810B230(struct Sprite *sprite)
if (sprite->data[1] > 120)
sprite->data[1]--;
}
- cos = Cos2((u16)sprite->data[1]);
- sprite->pos2.x = cos * 30 / 4096;
- sin = Sin2((u16)sprite->data[1]);
- sprite->pos2.y = sin * 30 / 4096;
+ sprite->pos2.x = Cos2(sprite->data[1]) * 30 / 4096;
+ sprite->pos2.y = Sin2(sprite->data[1]) * 30 / 4096;
}