summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDiegoisawesome <diego@domoreaweso.me>2017-12-28 03:00:15 -0600
committerDiegoisawesome <diego@domoreaweso.me>2017-12-28 03:00:15 -0600
commit1496ea3a24f188cad26ac40f5bfcc3e571f3311a (patch)
treea0b00c058bd7234b9140b4636b08016278f1b049 /src
parent2d04eb22abd3f60902ee1f9bc87bd510518709e3 (diff)
parent87958f2f87b9f7f6e5548d9cb2ac53c3339b78d5 (diff)
Merge branch 'master' of github.com:pret/pokeemerald
Diffstat (limited to 'src')
-rw-r--r--src/bike.c1078
-rw-r--r--src/evolution_scene.c6
-rwxr-xr-xsrc/field_map_obj.c4
-rw-r--r--src/pokedex.c542
-rw-r--r--src/pokemon_icon.c1014
-rw-r--r--src/pokemon_storage_system.c67
-rw-r--r--src/rayquaza_scene.c1164
-rw-r--r--src/start_menu.c102
8 files changed, 3952 insertions, 25 deletions
diff --git a/src/bike.c b/src/bike.c
new file mode 100644
index 000000000..64af7c711
--- /dev/null
+++ b/src/bike.c
@@ -0,0 +1,1078 @@
+#include "global.h"
+#include "bike.h"
+#include "field_map_obj.h"
+#include "field_player_avatar.h"
+#include "fieldmap.h"
+#include "constants/flags.h"
+#include "global.fieldmap.h"
+#include "metatile_behavior.h"
+#include "overworld.h"
+#include "constants/songs.h"
+#include "sound.h"
+
+extern bool8 gBikeCyclingChallenge;
+extern u8 gBikeCollisions;
+extern bool8 gUnknown_02037348;
+
+extern u8 sub_8093514(u8 direction);
+extern u8 sub_808B980(u8 direction);
+extern u8 sub_808B9BC(u8 direction);
+extern u8 sub_808B9A4(u8 direction);
+extern u8 sub_808C1B4(u8 direction);
+extern u8 npc_use_some_d2s(u8 direction);
+extern void Overworld_ClearSavedMusic(void);
+extern void Overworld_PlaySpecialMapMusic(void);
+
+// this file's functions
+static void MovePlayerOnMachBike(u8, u16, u16);
+static u8 GetMachBikeTransition(u8 *);
+static void MachBikeTransition_FaceDirection(u8);
+static void MachBikeTransition_TurnDirection(u8);
+static void MachBikeTransition_TrySpeedUp(u8);
+static void MachBikeTransition_TrySlowDown(u8);
+static void MovePlayerOnAcroBike(u8, u16, u16);
+static u8 CheckMovementInputAcroBike(u8 *, u16, u16);
+static u8 AcroBikeHandleInputNormal(u8 *, u16, u16);
+static u8 AcroBikeHandleInputTurning(u8 *, u16, u16);
+static u8 AcroBikeHandleInputWheelieStanding(u8 *, u16, u16);
+static u8 AcroBikeHandleInputBunnyHop(u8 *, u16, u16);
+static u8 AcroBikeHandleInputWheelieMoving(u8 *, u16, u16);
+static u8 AcroBikeHandleInputSidewaysJump(u8 *, u16, u16);
+static u8 AcroBikeHandleInputTurnJump(u8 *, u16, u16);
+static void AcroBikeTransition_FaceDirection(u8);
+static void AcroBikeTransition_TurnDirection(u8);
+static void AcroBikeTransition_Moving(u8);
+static void AcroBikeTransition_NormalToWheelie(u8);
+static void AcroBikeTransition_WheelieToNormal(u8);
+static void AcroBikeTransition_WheelieIdle(u8);
+static void AcroBikeTransition_WheelieHoppingStanding(u8);
+static void AcroBikeTransition_WheelieHoppingMoving(u8);
+static void AcroBikeTransition_SideJump(u8);
+static void AcroBikeTransition_TurnJump(u8);
+static void AcroBikeTransition_WheelieMoving(u8);
+static void AcroBikeTransition_WheelieRisingMoving(u8);
+static void AcroBikeTransition_WheelieLoweringMoving(u8);
+static void AcroBike_TryHistoryUpdate(u16, u16);
+static u8 AcroBike_GetJumpDirection(void);
+static void Bike_UpdateDirTimerHistory(u8);
+static void Bike_UpdateABStartSelectHistory(u8);
+static u8 Bike_DPadToDirection(u16);
+static u8 get_some_collision(u8);
+static u8 Bike_CheckCollisionTryAdvanceCollisionCount(struct MapObject *, s16, s16, u8, u8);
+static bool8 IsRunningDisallowedByMetatile(u8);
+static void Bike_TryAdvanceCyclingRoadCollisions();
+static u8 CanBikeFaceDirOnMetatile(u8, u8);
+static bool8 WillPlayerCollideWithCollision(u8, u8);
+static void Bike_SetBikeStill(void);
+
+// const rom data
+
+/*
+ A bike transition is a type of callback for the bike that actually
+ modifies the bicycle's direction or momentum or otherwise movement.
+ Alternatively, a bike may also have input handlers which process the
+ bike transition to call: the acro bike has input handlers while the mach
+ bike does not. This is because the Acro needs to know the button inputs
+ for its complex tricks and actions.
+*/
+
+static void (*const sMachBikeTransitions[])(u8) =
+{
+ MachBikeTransition_FaceDirection, // Face vs Turn: Face has no anim while Turn does. Turn checks for collision because if you turn right as opposed to face right, if there is a wall there, turn will make a bonk sound effect while face will not.
+ MachBikeTransition_TurnDirection,
+ MachBikeTransition_TrySpeedUp,
+ MachBikeTransition_TrySlowDown,
+};
+
+// bikeFrameCounter is input which is represented by sMachBikeSpeeds in order: 0 is normal speed (1 speed), 1 is fast speed (2 speed), 2 is fastest speed (4 speed)
+static void (*const sMachBikeSpeedCallbacks[])(u8) =
+{
+ PlayerGoSpeed1, // normal speed (1 speed)
+ PlayerGoSpeed2, // fast speed (2 speed)
+ PlayerGoSpeed4, // fastest speed (4 speed)
+};
+
+static void (*const sAcroBikeTransitions[])(u8) =
+{
+ AcroBikeTransition_FaceDirection,
+ AcroBikeTransition_TurnDirection,
+ AcroBikeTransition_Moving,
+ AcroBikeTransition_NormalToWheelie,
+ AcroBikeTransition_WheelieToNormal,
+ AcroBikeTransition_WheelieIdle,
+ AcroBikeTransition_WheelieHoppingStanding,
+ AcroBikeTransition_WheelieHoppingMoving,
+ AcroBikeTransition_SideJump,
+ AcroBikeTransition_TurnJump,
+ AcroBikeTransition_WheelieMoving,
+ AcroBikeTransition_WheelieRisingMoving,
+ AcroBikeTransition_WheelieLoweringMoving,
+};
+
+static u8 (*const sAcroBikeInputHandlers[])(u8 *, u16, u16) =
+{
+ AcroBikeHandleInputNormal,
+ AcroBikeHandleInputTurning,
+ AcroBikeHandleInputWheelieStanding,
+ AcroBikeHandleInputBunnyHop,
+ AcroBikeHandleInputWheelieMoving,
+ AcroBikeHandleInputSidewaysJump,
+ AcroBikeHandleInputTurnJump,
+};
+
+// used with bikeFrameCounter from mach bike
+static const u16 sMachBikeSpeeds[] = {SPEED_NORMAL, SPEED_FAST, SPEED_FASTEST};
+
+// this is a list of timers to compare against later, terminated with 0. the only timer being compared against is 4 frames in this list.
+static const u8 sAcroBikeJumpTimerList[] = {4, 0};
+
+// this is a list of history inputs to do in order to do the check to retrieve a jump direction for acro bike. it seems to be an extensible list, so its possible that Game Freak may have intended for the Acro Bike to have more complex tricks at some point. The final list only has the acro jump.
+static const struct BikeHistoryInputInfo sAcroBikeTricksList[] =
+{
+ // the 0xF is a mask performed with each byte of the array in order to perform the check on only the last entry of the history list, otherwise the check wouldn't work as there can be 0xF0 as opposed to 0x0F.
+ {DIR_SOUTH, B_BUTTON, 0xF, 0xF, sAcroBikeJumpTimerList, sAcroBikeJumpTimerList, DIR_SOUTH},
+ {DIR_NORTH, B_BUTTON, 0xF, 0xF, sAcroBikeJumpTimerList, sAcroBikeJumpTimerList, DIR_NORTH},
+ {DIR_WEST, B_BUTTON, 0xF, 0xF, sAcroBikeJumpTimerList, sAcroBikeJumpTimerList, DIR_WEST},
+ {DIR_EAST, B_BUTTON, 0xF, 0xF, sAcroBikeJumpTimerList, sAcroBikeJumpTimerList, DIR_EAST},
+};
+
+// code
+void MovePlayerOnBike(u8 direction, u16 newKeys, u16 heldKeys)
+{
+ if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MACH_BIKE)
+ MovePlayerOnMachBike(direction, newKeys, heldKeys);
+ else
+ MovePlayerOnAcroBike(direction, newKeys, heldKeys);
+}
+
+static void MovePlayerOnMachBike(u8 direction, u16 newKeys, u16 heldKeys)
+{
+ sMachBikeTransitions[GetMachBikeTransition(&direction)](direction);
+}
+
+// dirTraveling is a variable that is 0 when the player is standing still.
+static u8 GetMachBikeTransition(u8 *dirTraveling)
+{
+ // if the dir updated before this function, get the relevent new direction to check later.
+ u8 direction = player_get_direction_upper_nybble();
+
+ // is the player standing still?
+ if (*dirTraveling == 0)
+ {
+ *dirTraveling = direction; // update the direction, since below we either faced a direction or we started moving.
+ if (gPlayerAvatar.bikeSpeed == SPEED_STANDING)
+ {
+ gPlayerAvatar.runningState = NOT_MOVING;
+ return MACH_TRANS_FACE_DIRECTION;
+ }
+ gPlayerAvatar.runningState = MOVING;
+ return MACH_TRANS_START_MOVING;
+ }
+
+ // we need to check if the last traveled direction changed from the new direction as well as ensuring that we dont update the state while the player is moving: see the else check.
+ if (*dirTraveling != direction && gPlayerAvatar.runningState != MOVING)
+ {
+ if (gPlayerAvatar.bikeSpeed != SPEED_STANDING)
+ {
+ *dirTraveling = direction; // implement the new direction
+ gPlayerAvatar.runningState = MOVING;
+ return MACH_TRANS_START_MOVING;
+ }
+ // if you didnt start moving but your dir was different, do a turn direction instead.
+ gPlayerAvatar.runningState = TURN_DIRECTION;
+ return MACH_TRANS_TURN_DIRECTION;
+ }
+ else // the player is either going in the current direction and hasnt changed or their state is currently moving.
+ {
+ gPlayerAvatar.runningState = MOVING;
+ return MACH_TRANS_KEEP_MOVING;
+ }
+}
+
+// the difference between face direction and turn direction is that one changes direction while the other does the animation of turning as well as changing direction.
+static void MachBikeTransition_FaceDirection(u8 direction)
+{
+ PlayerFaceDirection(direction);
+ Bike_SetBikeStill();
+}
+
+static void MachBikeTransition_TurnDirection(u8 direction)
+{
+ struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E))
+ {
+ PlayerTurnInPlace(direction);
+ Bike_SetBikeStill();
+ }
+ else
+ {
+ MachBikeTransition_FaceDirection(playerMapObj->mapobj_unk_18);
+ }
+}
+
+static void MachBikeTransition_TrySpeedUp(u8 direction)
+{
+ struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+ u8 collision;
+
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == FALSE)
+ {
+ // we cannot go forward, so either slow down or, if we are stopped, idle face direction.
+ if (gPlayerAvatar.bikeSpeed)
+ MachBikeTransition_TrySlowDown(playerMapObj->placeholder18);
+ else
+ MachBikeTransition_FaceDirection(playerMapObj->placeholder18);
+ }
+ else
+ {
+ collision = get_some_collision(direction);
+ if (collision > 0 && collision < 12)
+ {
+ // we hit a solid object, but check to see if its a ledge and then jump.
+ if (collision == COLLISION_LEDGE_JUMP)
+ {
+ PlayerJumpLedge(direction);
+ }
+ else
+ {
+ // we hit a solid object that is not a ledge, so perform the collision.
+ Bike_SetBikeStill();
+ if (collision == 4 && IsPlayerCollidingWithFarawayIslandMew(direction))
+ PlayerOnBikeCollideWithFarawayIslandMew(direction);
+ else if (collision < 5 || collision > 8)
+ PlayerOnBikeCollide(direction);
+ }
+ }
+ else
+ {
+ // we did not hit anything that can slow us down, so perform the advancement callback depending on the bikeFrameCounter and try to increase the mach bike's speed.
+ sMachBikeSpeedCallbacks[gPlayerAvatar.bikeFrameCounter](direction);
+ gPlayerAvatar.bikeSpeed = gPlayerAvatar.bikeFrameCounter + (gPlayerAvatar.bikeFrameCounter >> 1); // same as dividing by 2, but compiler is insistent on >> 1
+ if (gPlayerAvatar.bikeFrameCounter < 2) // do not go faster than the last element in the mach bike array
+ gPlayerAvatar.bikeFrameCounter++;
+ }
+ }
+}
+
+static void MachBikeTransition_TrySlowDown(u8 direction)
+{
+ u8 collision;
+
+ if (gPlayerAvatar.bikeSpeed != SPEED_STANDING)
+ gPlayerAvatar.bikeFrameCounter = --gPlayerAvatar.bikeSpeed;
+
+ collision = get_some_collision(direction);
+
+ if (collision > 0 && collision < 12)
+ {
+ if (collision == COLLISION_LEDGE_JUMP)
+ {
+ PlayerJumpLedge(direction);
+ }
+ else
+ {
+ Bike_SetBikeStill();
+ if (collision == 4 && IsPlayerCollidingWithFarawayIslandMew(direction))
+ PlayerOnBikeCollideWithFarawayIslandMew(direction);
+ else if (collision < 5 || collision > 8)
+ PlayerOnBikeCollide(direction);
+ }
+ }
+ else
+ {
+ sMachBikeSpeedCallbacks[gPlayerAvatar.bikeFrameCounter](direction);
+ }
+}
+
+// the acro bike requires the input handler to be executed before the transition can.
+static void MovePlayerOnAcroBike(u8 newDirection, u16 newKeys, u16 heldKeys)
+{
+ sAcroBikeTransitions[CheckMovementInputAcroBike(&newDirection, newKeys, heldKeys)](newDirection);
+}
+
+static u8 CheckMovementInputAcroBike(u8 *newDirection, u16 newKeys, u16 heldKeys)
+{
+ return sAcroBikeInputHandlers[gPlayerAvatar.acroBikeState](newDirection, newKeys, heldKeys);
+}
+
+static u8 AcroBikeHandleInputNormal(u8 *newDirection, u16 newKeys, u16 heldKeys)
+{
+ u8 direction = player_get_direction_upper_nybble();
+
+ gPlayerAvatar.bikeFrameCounter = 0;
+ if (*newDirection == DIR_NONE)
+ {
+ if (newKeys & B_BUTTON)
+ {
+ //We're standing still with the B button held.
+ //Do a wheelie.
+ *newDirection = direction;
+ gPlayerAvatar.runningState = NOT_MOVING;
+ gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_STANDING;
+ return ACRO_TRANS_NORMAL_TO_WHEELIE;
+ }
+ else
+ {
+ *newDirection = direction;
+ gPlayerAvatar.runningState = NOT_MOVING;
+ return ACRO_TRANS_FACE_DIRECTION;
+ }
+ }
+ if (*newDirection == direction && (heldKeys & B_BUTTON) && gPlayerAvatar.bikeSpeed == SPEED_STANDING)
+ {
+ gPlayerAvatar.bikeSpeed++;
+ gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_MOVING;
+ return ACRO_TRANS_WHEELIE_RISING_MOVING;
+ }
+ if (*newDirection != direction && gPlayerAvatar.runningState != MOVING)
+ {
+ gPlayerAvatar.acroBikeState = ACRO_STATE_TURNING;
+ gPlayerAvatar.newDirBackup = *newDirection;
+ gPlayerAvatar.runningState = NOT_MOVING;
+ return CheckMovementInputAcroBike(newDirection, newKeys, heldKeys);
+ }
+ gPlayerAvatar.runningState = MOVING;
+ return ACRO_TRANS_MOVING;
+}
+
+static u8 AcroBikeHandleInputTurning(u8 *newDirection, u16 newKeys, u16 heldKeys)
+{
+ u8 direction;
+
+ *newDirection = gPlayerAvatar.newDirBackup;
+ gPlayerAvatar.bikeFrameCounter++;
+
+ // Wait 6 frames before actually changing direction
+ if (gPlayerAvatar.bikeFrameCounter > 6) // ... because it takes 6 frames to advance 1 tile.
+ {
+ gPlayerAvatar.runningState = TURN_DIRECTION;
+ gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
+ Bike_SetBikeStill();
+ return ACRO_TRANS_TURN_DIRECTION;
+ }
+ direction = player_get_direction_upper_nybble();
+ if (*newDirection == AcroBike_GetJumpDirection())
+ {
+ Bike_SetBikeStill(); // Bike_SetBikeStill sets speed to standing, but the next line immediately overrides it. could have just reset acroBikeState to 0 here instead of wasting a jump.
+ gPlayerAvatar.bikeSpeed = SPEED_NORMAL;
+ if (*newDirection == GetOppositeDirection(direction))
+ {
+ // do a turn jump.
+ // no need to update runningState, didnt move.
+ gPlayerAvatar.acroBikeState = ACRO_STATE_TURN_JUMP;
+ return ACRO_TRANS_TURN_JUMP;
+ }
+ else
+ {
+ // do a sideways jump.
+ gPlayerAvatar.runningState = MOVING; // we need to move, set state to moving.
+ gPlayerAvatar.acroBikeState = ACRO_STATE_SIDE_JUMP;
+ return ACRO_TRANS_SIDE_JUMP;
+ }
+ }
+ *newDirection = direction;
+ return ACRO_TRANS_FACE_DIRECTION;
+}
+
+static u8 AcroBikeHandleInputWheelieStanding(u8 *newDirection, u16 newKeys, u16 heldKeys)
+{
+ u8 direction;
+ struct MapObject *playerMapObj;
+
+ direction = player_get_direction_upper_nybble();
+ playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+ gPlayerAvatar.runningState = NOT_MOVING;
+
+ if (heldKeys & B_BUTTON)
+ gPlayerAvatar.bikeFrameCounter++;
+ else
+ {
+ // B button was released.
+ gPlayerAvatar.bikeFrameCounter = 0;
+ if (!MetatileBehavior_IsBumpySlope(playerMapObj->mapobj_unk_1E))
+ {
+ // Go back to normal on flat ground
+ *newDirection = direction;
+ gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
+ Bike_SetBikeStill();
+ return ACRO_TRANS_WHEELIE_TO_NORMAL;
+ }
+ }
+ if (gPlayerAvatar.bikeFrameCounter >= 40)
+ {
+ *newDirection = direction;
+ gPlayerAvatar.acroBikeState = ACRO_STATE_BUNNY_HOP;
+ Bike_SetBikeStill();
+ return ACRO_TRANS_WHEELIE_HOPPING_STANDING;
+ }
+ if (*newDirection == direction)
+ {
+ gPlayerAvatar.runningState = MOVING;
+ gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_MOVING;
+ Bike_SetBikeStill();
+ return ACRO_TRANS_WHEELIE_MOVING;
+ }
+ if (*newDirection == 0)
+ {
+ *newDirection = direction;
+ return ACRO_TRANS_WHEELIE_IDLE;
+ }
+ gPlayerAvatar.runningState = TURN_DIRECTION;
+ return ACRO_TRANS_WHEELIE_IDLE;
+}
+
+static u8 AcroBikeHandleInputBunnyHop(u8 *newDirection, u16 newKeys, u16 heldKeys)
+{
+ u8 direction;
+ struct MapObject *playerMapObj;
+
+ direction = player_get_direction_upper_nybble();
+ playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+ if (!(heldKeys & B_BUTTON))
+ {
+ // B button was released
+ Bike_SetBikeStill();
+ if (MetatileBehavior_IsBumpySlope(playerMapObj->mapobj_unk_1E))
+ {
+ // even though B was released, dont undo the wheelie on the bumpy slope.
+ gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_STANDING;
+ return CheckMovementInputAcroBike(newDirection, newKeys, heldKeys);
+ }
+ else
+ {
+ // .. otherwise, go back to normal on flat ground
+ *newDirection = direction;
+ gPlayerAvatar.runningState = NOT_MOVING;
+ gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
+ return ACRO_TRANS_WHEELIE_TO_NORMAL;
+ }
+ }
+
+ // B Button is still held
+
+ if (*newDirection == DIR_NONE)
+ {
+ // we did not move, so keep hopping in place without moving.
+ *newDirection = direction;
+ gPlayerAvatar.runningState = NOT_MOVING;
+ return ACRO_TRANS_WHEELIE_HOPPING_STANDING;
+ }
+ if (*newDirection != direction && gPlayerAvatar.runningState != MOVING)
+ {
+ // we changed direction, so turn but do not move hop.
+ gPlayerAvatar.runningState = TURN_DIRECTION;
+ return ACRO_TRANS_WHEELIE_HOPPING_STANDING;
+ }
+ // otherwise, we started moving while hopping
+ gPlayerAvatar.runningState = MOVING;
+ return ACRO_TRANS_WHEELIE_HOPPING_MOVING;
+}
+
+static u8 AcroBikeHandleInputWheelieMoving(u8 *newDirection, u16 newKeys, u16 heldKeys)
+{
+ u8 direction;
+ struct MapObject *playerMapObj;
+
+ direction = player_get_direction_lower_nybble();
+ playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+ if (!(heldKeys & B_BUTTON))
+ {
+ // we were moving on a wheelie, but we let go while moving. reset bike still status
+ Bike_SetBikeStill();
+ if (!MetatileBehavior_IsBumpySlope(playerMapObj->mapobj_unk_1E))
+ {
+ // we let go of B and arent on a bumpy slope, set state to normal because now we need to handle this
+ gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
+ if (*newDirection == DIR_NONE)
+ {
+ // we stopped moving but are turning, still try to lower the wheelie in place.
+ *newDirection = direction;
+ gPlayerAvatar.runningState = NOT_MOVING;
+ return ACRO_TRANS_WHEELIE_TO_NORMAL;
+ }
+ if (*newDirection != direction && gPlayerAvatar.runningState != MOVING)
+ {
+ // we did not turn while lowering wheelie, so do so without turning.
+ gPlayerAvatar.runningState = NOT_MOVING;
+ return ACRO_TRANS_WHEELIE_TO_NORMAL;
+ }
+ // if we are moving while lowering wheelie, put the acro into a lowering state while moving.
+ gPlayerAvatar.runningState = MOVING;
+ return ACRO_TRANS_WHEELIE_LOWERING_MOVING;
+ }
+ // please do not undo the wheelie on a bumpy slope
+ gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_STANDING;
+ return CheckMovementInputAcroBike(newDirection, newKeys, heldKeys);
+ }
+ // we are still holding B.
+ if (*newDirection == DIR_NONE)
+ {
+ // idle the wheelie in place because we're holding B without moving.
+ *newDirection = direction;
+ gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_STANDING;
+ gPlayerAvatar.runningState = NOT_MOVING;
+ Bike_SetBikeStill();
+ return ACRO_TRANS_WHEELIE_IDLE;
+ }
+ if (direction != *newDirection && gPlayerAvatar.runningState != MOVING)
+ {
+ gPlayerAvatar.runningState = NOT_MOVING;
+ return ACRO_TRANS_WHEELIE_IDLE;
+ }
+ gPlayerAvatar.runningState = MOVING;
+ return ACRO_TRANS_WHEELIE_MOVING;
+}
+
+static u8 AcroBikeHandleInputSidewaysJump(u8 *ptr, u16 newKeys, u16 heldKeys)
+{
+ struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+
+ playerMapObj->mapobj_bit_9 = 0;
+ FieldObjectSetDirection(playerMapObj, playerMapObj->mapobj_unk_18);
+ gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
+ return CheckMovementInputAcroBike(ptr, newKeys, heldKeys);
+}
+
+static u8 AcroBikeHandleInputTurnJump(u8 *ptr, u16 newKeys, u16 heldKeys)
+{
+ gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
+ return CheckMovementInputAcroBike(ptr, newKeys, heldKeys);
+}
+
+static void AcroBikeTransition_FaceDirection(u8 direction)
+{
+ PlayerFaceDirection(direction);
+}
+
+static void AcroBikeTransition_TurnDirection(u8 direction)
+{
+ struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ direction = playerMapObj->placeholder18;
+ PlayerFaceDirection(direction);
+}
+
+static void AcroBikeTransition_Moving(u8 direction)
+{
+ u8 collision;
+ struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ {
+ AcroBikeTransition_FaceDirection(playerMapObj->placeholder18);
+ return;
+ }
+ collision = get_some_collision(direction);
+ if (collision > 0 && collision < 12)
+ {
+ if (collision == COLLISION_LEDGE_JUMP)
+ PlayerJumpLedge(direction);
+ else if (collision == 4 && IsPlayerCollidingWithFarawayIslandMew(direction))
+ PlayerOnBikeCollideWithFarawayIslandMew(direction);
+ else if (collision < 5 || collision > 8)
+ PlayerOnBikeCollide(direction);
+ }
+ else
+ {
+ PlayerGoSpeed3(direction);
+ }
+}
+
+static void AcroBikeTransition_NormalToWheelie(u8 direction)
+{
+ struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ direction = playerMapObj->placeholder18;
+ PlayerStartWheelie(direction);
+}
+
+static void AcroBikeTransition_WheelieToNormal(u8 direction)
+{
+ struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ direction = playerMapObj->placeholder18;
+ PlayerEndWheelie(direction);
+}
+
+static void AcroBikeTransition_WheelieIdle(u8 direction)
+{
+ struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ direction = playerMapObj->placeholder18;
+ PlayerIdleWheelie(direction);
+}
+
+static void AcroBikeTransition_WheelieHoppingStanding(u8 direction)
+{
+ struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ direction = playerMapObj->placeholder18;
+ PlayerStandingHoppingWheelie(direction);
+}
+
+static void AcroBikeTransition_WheelieHoppingMoving(u8 direction)
+{
+ u8 collision;
+ struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ {
+ AcroBikeTransition_WheelieHoppingStanding(playerMapObj->placeholder18);
+ return;
+ }
+ collision = get_some_collision(direction);
+ // TODO: Try to get rid of this goto
+ if (collision == 0 || collision == 9)
+ {
+ goto derp;
+ }
+ else if (collision == 6)
+ {
+ PlayerLedgeHoppingWheelie(direction);
+ }
+ else if (collision < 5 || collision > 8)
+ {
+ if (collision <= 11)
+ {
+ AcroBikeTransition_WheelieHoppingStanding(direction);
+ }
+ else
+ {
+ derp:
+ PlayerMovingHoppingWheelie(direction);
+ }
+ }
+}
+
+static void AcroBikeTransition_SideJump(u8 direction)
+{
+ u8 collision;
+ struct MapObject *playerMapObj;
+
+ collision = get_some_collision(direction);
+ if (collision != 0)
+ {
+ if (collision == 7)
+ return;
+ if (collision < 10)
+ {
+ AcroBikeTransition_TurnDirection(direction);
+ return;
+ }
+ if (WillPlayerCollideWithCollision(collision, direction) == FALSE)
+ {
+ AcroBikeTransition_TurnDirection(direction);
+ return;
+ }
+ }
+ playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+ PlaySE(SE_JITE_PYOKO);
+ playerMapObj->mapobj_bit_9 = 1;
+ PlayerSetAnimId(sub_8093514(direction), 2);
+}
+
+static void AcroBikeTransition_TurnJump(u8 direction)
+{
+ PlayerAcroTurnJump(direction);
+}
+
+static void AcroBikeTransition_WheelieMoving(u8 direction)
+{
+ u8 collision;
+ struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ {
+ PlayerIdleWheelie(playerMapObj->placeholder18);
+ return;
+ }
+ collision = get_some_collision(direction);
+ if (collision > 0 && collision < 12)
+ {
+ if (collision == 6)
+ {
+ PlayerLedgeHoppingWheelie(direction);
+ }
+ else if (collision == 9)
+ {
+ PlayerIdleWheelie(direction);
+ }
+ else if (collision <= 4)
+ {
+ if (MetatileBehavior_IsBumpySlope(playerMapObj->mapobj_unk_1E))
+ PlayerIdleWheelie(direction);
+ else
+ sub_808B980(direction); //hit wall?
+ }
+ return;
+ }
+ sub_808B9BC(direction);
+ gPlayerAvatar.runningState = MOVING;
+}
+
+static void AcroBikeTransition_WheelieRisingMoving(u8 direction)
+{
+ u8 collision;
+ struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ {
+ PlayerStartWheelie(playerMapObj->placeholder18);
+ return;
+ }
+ collision = get_some_collision(direction);
+ if (collision > 0 && collision < 12)
+ {
+ if (collision == 6)
+ {
+ PlayerLedgeHoppingWheelie(direction);
+ }
+ else if (collision == 9)
+ {
+ PlayerIdleWheelie(direction);
+ }
+ else if (collision <= 4)
+ {
+ if (MetatileBehavior_IsBumpySlope(playerMapObj->mapobj_unk_1E))
+ PlayerIdleWheelie(direction);
+ else
+ sub_808B980(direction); //hit wall?
+ }
+ return;
+ }
+ sub_808B9A4(direction);
+ gPlayerAvatar.runningState = MOVING;
+}
+
+static void AcroBikeTransition_WheelieLoweringMoving(u8 direction)
+{
+ u8 collision;
+ struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ {
+ PlayerEndWheelie(playerMapObj->placeholder18);
+ return;
+ }
+ collision = get_some_collision(direction);
+ if (collision > 0 && collision < 12)
+ {
+ if (collision == 6)
+ PlayerJumpLedge(direction);
+ else if (collision < 5 || collision > 8)
+ PlayerEndWheelie(direction);
+ return;
+ }
+ npc_use_some_d2s(direction);
+}
+
+void Bike_TryAcroBikeHistoryUpdate(u16 newKeys, u16 heldKeys)
+{
+ if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ACRO_BIKE)
+ AcroBike_TryHistoryUpdate(newKeys, heldKeys);
+}
+
+static void AcroBike_TryHistoryUpdate(u16 newKeys, u16 heldKeys) // newKeys is unused
+{
+ u8 direction = Bike_DPadToDirection(heldKeys);
+
+ if (direction == (gPlayerAvatar.directionHistory & 0xF))
+ {
+ // increment the timer for direction history since last input.
+ if (gPlayerAvatar.dirTimerHistory[0] < 0xFF)
+ gPlayerAvatar.dirTimerHistory[0]++;
+ }
+ else
+ {
+ Bike_UpdateDirTimerHistory(direction);
+ gPlayerAvatar.bikeSpeed = SPEED_STANDING;
+ }
+
+ direction = heldKeys & (A_BUTTON | B_BUTTON | SELECT_BUTTON | START_BUTTON); // directions is reused for some reason.
+ if (direction == (gPlayerAvatar.abStartSelectHistory & 0xF))
+ {
+ if (gPlayerAvatar.abStartSelectTimerHistory[0] < 0xFF)
+ gPlayerAvatar.abStartSelectTimerHistory[0]++;
+ }
+ else
+ {
+ Bike_UpdateABStartSelectHistory(direction);
+ gPlayerAvatar.bikeSpeed = SPEED_STANDING;
+ }
+}
+
+static bool8 HasPlayerInputTakenLongerThanList(const u8 *dirTimerList, const u8 *abStartSelectTimerList)
+{
+ u8 i;
+
+ for (i = 0; dirTimerList[i] != 0; i++)
+ {
+ if (gPlayerAvatar.dirTimerHistory[i] > dirTimerList[i])
+ return FALSE;
+ }
+ for (i = 0; abStartSelectTimerList[i] != 0; i++)
+ {
+ if (gPlayerAvatar.abStartSelectTimerHistory[i] > abStartSelectTimerList[i])
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static u8 AcroBike_GetJumpDirection(void)
+{
+ u32 i;
+
+ for (i = 0; i < ARRAY_COUNT(sAcroBikeTricksList); i++)
+ {
+ const struct BikeHistoryInputInfo *historyInputInfo = &sAcroBikeTricksList[i];
+ u32 dirHistory = gPlayerAvatar.directionHistory;
+ u32 abStartSelectHistory = gPlayerAvatar.abStartSelectHistory;
+
+ dirHistory &= historyInputInfo->dirHistoryMask;
+ abStartSelectHistory &= historyInputInfo->abStartSelectHistoryMask;
+ if (dirHistory == historyInputInfo->dirHistoryMatch && abStartSelectHistory == historyInputInfo->abStartSelectHistoryMatch && HasPlayerInputTakenLongerThanList(historyInputInfo->dirTimerHistoryList, historyInputInfo->abStartSelectHistoryList))
+ return historyInputInfo->direction;
+ }
+ return 0;
+}
+
+static void Bike_UpdateDirTimerHistory(u8 dir)
+{
+ u8 i;
+
+ gPlayerAvatar.directionHistory = (gPlayerAvatar.directionHistory << 4) | (dir & 0xF);
+
+ for (i = 7; i != 0; i--)
+ gPlayerAvatar.dirTimerHistory[i] = gPlayerAvatar.dirTimerHistory[i - 1];
+ gPlayerAvatar.dirTimerHistory[0] = 1;
+}
+
+static void Bike_UpdateABStartSelectHistory(u8 input)
+{
+ u8 i;
+
+ gPlayerAvatar.abStartSelectHistory = (gPlayerAvatar.abStartSelectHistory << 4) | (input & 0xF);
+
+ for (i = 7; i != 0; i--)
+ gPlayerAvatar.abStartSelectTimerHistory[i] = gPlayerAvatar.abStartSelectTimerHistory[i - 1];
+ gPlayerAvatar.abStartSelectTimerHistory[0] = 1;
+}
+
+static u8 Bike_DPadToDirection(u16 heldKeys)
+{
+ if (heldKeys & DPAD_UP)
+ return DIR_NORTH;
+ if (heldKeys & DPAD_DOWN)
+ return DIR_SOUTH;
+ if (heldKeys & DPAD_LEFT)
+ return DIR_WEST;
+ if (heldKeys & DPAD_RIGHT)
+ return DIR_EAST;
+ return DIR_NONE;
+}
+
+static u8 get_some_collision(u8 direction)
+{
+ s16 x;
+ s16 y;
+ u8 metatitleBehavior;
+ struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
+
+ x = playerMapObj->coords2.x;
+ y = playerMapObj->coords2.y;
+ MoveCoords(direction, &x, &y);
+ metatitleBehavior = MapGridGetMetatileBehaviorAt(x, y);
+ return Bike_CheckCollisionTryAdvanceCollisionCount(playerMapObj, x, y, direction, metatitleBehavior);
+}
+
+static u8 Bike_CheckCollisionTryAdvanceCollisionCount(struct MapObject *mapObject, s16 x, s16 y, u8 direction, u8 metatitleBehavior)
+{
+ u8 collision = CheckForFieldObjectCollision(mapObject, x, y, direction, metatitleBehavior);
+
+ if (collision > 4)
+ return collision;
+
+ if (collision == 0 && IsRunningDisallowedByMetatile(metatitleBehavior))
+ collision = 2;
+
+ if (collision)
+ Bike_TryAdvanceCyclingRoadCollisions();
+
+ return collision;
+}
+
+bool8 RS_IsRunningDisallowed(u8 tile)
+{
+ if (IsRunningDisallowedByMetatile(tile) != FALSE || gMapHeader.mapType == MAP_TYPE_INDOOR)
+ return TRUE;
+ else
+ return FALSE;
+}
+
+static bool8 IsRunningDisallowedByMetatile(u8 tile)
+{
+ if (MetatileBehavior_IsRunningDisallowed(tile))
+ return TRUE;
+ if (MetatileBehavior_IsFortreeBridge(tile) && (PlayerGetZCoord() & 1) == 0)
+ return TRUE;
+ return FALSE;
+}
+
+static void Bike_TryAdvanceCyclingRoadCollisions(void)
+{
+ if (gBikeCyclingChallenge != FALSE && gBikeCollisions < 100)
+ gBikeCollisions++;
+}
+
+static bool8 CanBikeFaceDirOnMetatile(u8 direction, u8 tile)
+{
+ if (direction == DIR_EAST || direction == DIR_WEST)
+ {
+ // Bike cannot face east or west on a vertical rail
+ if (MetatileBehavior_IsIsolatedVerticalRail(tile)
+ || MetatileBehavior_IsVerticalRail(tile))
+ return FALSE;
+ }
+ else
+ {
+ // Bike cannot face north or south on a horizontal rail
+ if (MetatileBehavior_IsIsolatedHorizontalRail(tile)
+ || MetatileBehavior_IsHorizontalRail(tile))
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static bool8 WillPlayerCollideWithCollision(u8 newTileCollision, u8 direction)
+{
+ if (direction == DIR_NORTH || direction == DIR_SOUTH)
+ {
+ if (newTileCollision == 10 || newTileCollision == 12)
+ return FALSE;
+ }
+ else if (newTileCollision == 11 || newTileCollision == 13)
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+bool8 IsBikingDisallowedByPlayer(void)
+{
+ s16 x, y;
+ u8 tileBehavior;
+
+ if (!(gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_4)))
+ {
+ PlayerGetDestCoords(&x, &y);
+ tileBehavior = MapGridGetMetatileBehaviorAt(x, y);
+ if (!IsRunningDisallowedByMetatile(tileBehavior))
+ return FALSE;
+ }
+ return TRUE;
+}
+
+bool8 player_should_look_direction_be_enforced_upon_movement(void)
+{
+ if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE) != FALSE && MetatileBehavior_IsBumpySlope(gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1E) != FALSE)
+ return FALSE;
+ else
+ return TRUE;
+}
+
+void GetOnOffBike(u8 transitionFlags)
+{
+ gUnknown_02037348 = FALSE;
+
+ if (gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE))
+ {
+ SetPlayerAvatarTransitionFlags(PLAYER_AVATAR_FLAG_ON_FOOT);
+ Overworld_ClearSavedMusic();
+ Overworld_PlaySpecialMapMusic();
+ }
+ else
+ {
+ SetPlayerAvatarTransitionFlags(transitionFlags);
+ Overworld_SetSavedMusic(MUS_CYCLING);
+ Overworld_ChangeMusicTo(MUS_CYCLING);
+ }
+}
+
+void BikeClearState(int newDirHistory, int newAbStartHistory)
+{
+ u8 i;
+
+ gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
+ gPlayerAvatar.newDirBackup = DIR_NONE;
+ gPlayerAvatar.bikeFrameCounter = 0;
+ gPlayerAvatar.bikeSpeed = SPEED_STANDING;
+ gPlayerAvatar.directionHistory = newDirHistory;
+ gPlayerAvatar.abStartSelectHistory = newAbStartHistory;
+
+ for (i = 0; i < 8; i++)
+ gPlayerAvatar.dirTimerHistory[i] = 0;
+
+ for (i = 0; i < 8; i++)
+ gPlayerAvatar.abStartSelectTimerHistory[i] = 0;
+}
+
+void Bike_UpdateBikeCounterSpeed(u8 counter)
+{
+ gPlayerAvatar.bikeFrameCounter = counter;
+ gPlayerAvatar.bikeSpeed = gPlayerAvatar.bikeFrameCounter + (gPlayerAvatar.bikeFrameCounter >> 1); // lazy way of multiplying by 1.5.
+}
+
+static void Bike_SetBikeStill(void)
+{
+ gPlayerAvatar.bikeFrameCounter = 0;
+ gPlayerAvatar.bikeSpeed = SPEED_STANDING;
+}
+
+s16 GetPlayerSpeed(void)
+{
+ // because the player pressed a direction, it won't ever return a speed of 0 since this function returns the player's current speed.
+ s16 machSpeeds[3];
+
+ memcpy(machSpeeds, sMachBikeSpeeds, sizeof(machSpeeds));
+
+ if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MACH_BIKE)
+ return machSpeeds[gPlayerAvatar.bikeFrameCounter];
+ else if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ACRO_BIKE)
+ return SPEED_FASTER;
+ else if (gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_DASH))
+ return SPEED_FAST;
+ else
+ return SPEED_NORMAL;
+}
+
+void Bike_HandleBumpySlopeJump(void)
+{
+ s16 x, y;
+ u8 tileBehavior;
+
+ if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ACRO_BIKE)
+ {
+ PlayerGetDestCoords(&x, &y);
+ tileBehavior = MapGridGetMetatileBehaviorAt(x, y);
+ if (MetatileBehavior_IsBumpySlope(tileBehavior))
+ {
+ gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_STANDING;
+ sub_808C1B4(player_get_direction_upper_nybble());
+ }
+ }
+}
+
+bool32 IsRunningDisallowed(u8 metatile)
+{
+ if (!(gMapHeader.flags & 4) || IsRunningDisallowedByMetatile(metatile) == TRUE)
+ return TRUE;
+ else
+ return FALSE;
+}
diff --git a/src/evolution_scene.c b/src/evolution_scene.c
index 580e88ad7..4b59147ff 100644
--- a/src/evolution_scene.c
+++ b/src/evolution_scene.c
@@ -78,7 +78,7 @@ extern void sub_806A068(u16, u8);
extern void sub_807F19C(void);
extern void sub_807B140(void);
extern void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies);
-extern void sub_8085784(void);
+extern void Overworld_PlaySpecialMapMusic(void);
extern void sub_81BFA38(struct Pokemon *party, u8 monId, u8 partyCount, void *CB2_ptr, u16 move);
extern u8 sub_81C1B94(void);
extern void sub_807F1A8(u8 arg0, const u8 *arg1, u8 arg2);
@@ -764,7 +764,7 @@ static void Task_EvolutionScene(u8 taskID)
if (!(gTasks[taskID].tBits & TASK_BIT_LEARN_MOVE))
{
StopMapMusic();
- sub_8085784();
+ Overworld_PlaySpecialMapMusic();
}
gTasks[taskID].tBits |= TASK_BIT_LEARN_MOVE;
@@ -793,7 +793,7 @@ static void Task_EvolutionScene(u8 taskID)
if (!(gTasks[taskID].tBits & TASK_BIT_LEARN_MOVE))
{
StopMapMusic();
- sub_8085784();
+ Overworld_PlaySpecialMapMusic();
}
if (!gTasks[taskID].tEvoWasStopped)
CreateShedinja(gTasks[taskID].tPreEvoSpecies, mon);
diff --git a/src/field_map_obj.c b/src/field_map_obj.c
index fc23a6e37..df80494b3 100755
--- a/src/field_map_obj.c
+++ b/src/field_map_obj.c
@@ -3231,7 +3231,7 @@ bool8 mss_npc_reset_oampriv3_1_unk2_unk3(struct MapObject *mapObject, struct Spr
bool8 sub_8091EC0(struct MapObject *mapObject, struct Sprite *sprite)
{
- if (gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1C == 0xFF || gPlayerAvatar.running1 == 2)
+ if (gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1C == 0xFF || gPlayerAvatar.tileTransitionState == 2)
{
return FALSE;
}
@@ -3410,7 +3410,7 @@ field_object_step(CopyPlayer2, gUnknown_0850DA90)
bool8 mss_08062EA4(struct MapObject *mapObject, struct Sprite *sprite)
{
- if (gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1C == 0xFF || gPlayerAvatar.running1 == 2)
+ if (gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1C == 0xFF || gPlayerAvatar.tileTransitionState == 2)
{
return FALSE;
}
diff --git a/src/pokedex.c b/src/pokedex.c
new file mode 100644
index 000000000..964f41716
--- /dev/null
+++ b/src/pokedex.c
@@ -0,0 +1,542 @@
+#include "global.h"
+#include "gba/m4a_internal.h"
+#include "pokedex.h"
+#include "sprite.h"
+#include "graphics.h"
+#include "decompress.h"
+#include "bg.h"
+#include "window.h"
+
+// this file's functions
+void sub_80BE604(struct Sprite *sprite);
+void sub_80BE658(struct Sprite *sprite);
+void sub_80BE758(struct Sprite *sprite);
+void sub_80BE780(struct Sprite *sprite);
+void sub_80BE44C(struct Sprite *sprite);
+void sub_80BE834(struct Sprite *sprite);
+
+// const rom data
+#include "data/pokedex_orders.h"
+
+static const struct OamData sOamData_855CFE4 =
+{
+ .y = 160,
+ .affineMode = 0,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 0,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 0,
+ .tileNum = 0,
+ .priority = 1,
+ .paletteNum = 0,
+ .affineParam = 0
+};
+
+static const struct OamData sOamData_855CFEC =
+{
+ .y = 160,
+ .affineMode = 0,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 1,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 0,
+ .tileNum = 0,
+ .priority = 0,
+ .paletteNum = 0,
+ .affineParam = 0
+};
+
+static const struct OamData sOamData_855CFF4 =
+{
+ .y = 160,
+ .affineMode = 0,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 1,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 2,
+ .tileNum = 0,
+ .priority = 0,
+ .paletteNum = 0,
+ .affineParam = 0
+};
+
+static const struct OamData sOamData_855CFFC =
+{
+ .y = 160,
+ .affineMode = 0,
+ .objMode = 2,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 0,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 2,
+ .tileNum = 0,
+ .priority = 1,
+ .paletteNum = 0,
+ .affineParam = 0
+};
+
+static const struct OamData sOamData_855D004 =
+{
+ .y = 160,
+ .affineMode = 0,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 1,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 3,
+ .tileNum = 0,
+ .priority = 0,
+ .paletteNum = 0,
+ .affineParam = 0
+};
+
+static const struct OamData sOamData_855D00C =
+{
+ .y = 160,
+ .affineMode = 0,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 2,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 0,
+ .tileNum = 0,
+ .priority = 0,
+ .paletteNum = 0,
+ .affineParam = 0
+};
+
+static const union AnimCmd sSpriteAnim_855D014[] =
+{
+ ANIMCMD_FRAME(3, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D01C[] =
+{
+ ANIMCMD_FRAME(1, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D024[] =
+{
+ ANIMCMD_FRAME(16, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D02C[] =
+{
+ ANIMCMD_FRAME(48, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D034[] =
+{
+ ANIMCMD_FRAME(40, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D03C[] =
+{
+ ANIMCMD_FRAME(32, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D044[] =
+{
+ ANIMCMD_FRAME(56, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D04C[] =
+{
+ ANIMCMD_FRAME(64, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D054[] =
+{
+ ANIMCMD_FRAME(96, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D05C[] =
+{
+ ANIMCMD_FRAME(160, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D064[] =
+{
+ ANIMCMD_FRAME(168, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D06C[] =
+{
+ ANIMCMD_FRAME(128, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D074[] =
+{
+ ANIMCMD_FRAME(130, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D07C[] =
+{
+ ANIMCMD_FRAME(132, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D084[] =
+{
+ ANIMCMD_FRAME(134, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D08C[] =
+{
+ ANIMCMD_FRAME(136, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D094[] =
+{
+ ANIMCMD_FRAME(138, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D09C[] =
+{
+ ANIMCMD_FRAME(140, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D0A4[] =
+{
+ ANIMCMD_FRAME(142, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D0AC[] =
+{
+ ANIMCMD_FRAME(144, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D0B4[] =
+{
+ ANIMCMD_FRAME(146, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D0BC[] =
+{
+ ANIMCMD_FRAME(176, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D0C4[] =
+{
+ ANIMCMD_FRAME(178, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D0CC[] =
+{
+ ANIMCMD_FRAME(180, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D0D4[] =
+{
+ ANIMCMD_FRAME(182, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D0DC[] =
+{
+ ANIMCMD_FRAME(184, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D0E4[] =
+{
+ ANIMCMD_FRAME(186, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D0EC[] =
+{
+ ANIMCMD_FRAME(188, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D0F4[] =
+{
+ ANIMCMD_FRAME(190, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D0FC[] =
+{
+ ANIMCMD_FRAME(192, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D104[] =
+{
+ ANIMCMD_FRAME(194, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_855D10C[] =
+{
+ ANIMCMD_FRAME(4, 30),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const sSpriteAnimTable_855D114[] =
+{
+ sSpriteAnim_855D014
+};
+
+static const union AnimCmd *const sSpriteAnimTable_855D118[] =
+{
+ sSpriteAnim_855D01C
+};
+
+static const union AnimCmd *const sSpriteAnimTable_855D11C[] =
+{
+ sSpriteAnim_855D024
+};
+
+static const union AnimCmd *const sSpriteAnimTable_855D120[] =
+{
+ sSpriteAnim_855D02C,
+ sSpriteAnim_855D034,
+ sSpriteAnim_855D03C,
+ sSpriteAnim_855D044
+};
+
+static const union AnimCmd *const sSpriteAnimTable_855D130[] =
+{
+ sSpriteAnim_855D04C,
+ sSpriteAnim_855D054
+};
+
+static const union AnimCmd *const sSpriteAnimTable_855D138[] =
+{
+ sSpriteAnim_855D05C,
+ sSpriteAnim_855D064
+};
+
+static const union AnimCmd *const sSpriteAnimTable_855D140[] =
+{
+ sSpriteAnim_855D06C,
+ sSpriteAnim_855D074,
+ sSpriteAnim_855D07C,
+ sSpriteAnim_855D084,
+ sSpriteAnim_855D08C,
+ sSpriteAnim_855D094,
+ sSpriteAnim_855D09C,
+ sSpriteAnim_855D0A4,
+ sSpriteAnim_855D0AC,
+ sSpriteAnim_855D0B4
+};
+
+static const union AnimCmd *const sSpriteAnimTable_855D168[] =
+{
+ sSpriteAnim_855D0BC,
+ sSpriteAnim_855D0C4,
+ sSpriteAnim_855D0CC,
+ sSpriteAnim_855D0D4,
+ sSpriteAnim_855D0DC,
+ sSpriteAnim_855D0E4,
+ sSpriteAnim_855D0EC,
+ sSpriteAnim_855D0F4,
+ sSpriteAnim_855D0FC,
+ sSpriteAnim_855D104
+};
+
+static const union AnimCmd *const sSpriteAnimTable_855D190[] =
+{
+ sSpriteAnim_855D10C
+};
+
+const struct SpriteTemplate gUnknown_0855D194 =
+{
+ .tileTag = 4096,
+ .paletteTag = 4096,
+ .oam = &sOamData_855CFE4,
+ .anims = sSpriteAnimTable_855D114,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_80BE604,
+};
+
+const struct SpriteTemplate gUnknown_0855D1AC =
+{
+ .tileTag = 4096,
+ .paletteTag = 4096,
+ .oam = &sOamData_855CFEC,
+ .anims = sSpriteAnimTable_855D118,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_80BE658,
+};
+
+const struct SpriteTemplate gUnknown_0855D1C4 =
+{
+ .tileTag = 4096,
+ .paletteTag = 4096,
+ .oam = &sOamData_855CFF4,
+ .anims = sSpriteAnimTable_855D120,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_80BE758,
+};
+
+const struct SpriteTemplate gUnknown_0855D1DC =
+{
+ .tileTag = 4096,
+ .paletteTag = 4096,
+ .oam = &sOamData_855CFFC,
+ .anims = sSpriteAnimTable_855D11C,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_80BE780,
+};
+
+const struct SpriteTemplate gUnknown_0855D1F4 =
+{
+ .tileTag = 4096,
+ .paletteTag = 4096,
+ .oam = &sOamData_855D004,
+ .anims = sSpriteAnimTable_855D130,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_80BE44C,
+};
+
+const struct SpriteTemplate gUnknown_0855D20C =
+{
+ .tileTag = 4096,
+ .paletteTag = 4096,
+ .oam = &sOamData_855CFF4,
+ .anims = sSpriteAnimTable_855D138,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_80BE44C,
+};
+
+const struct SpriteTemplate gUnknown_0855D224 =
+{
+ .tileTag = 4096,
+ .paletteTag = 4096,
+ .oam = &sOamData_855D00C,
+ .anims = sSpriteAnimTable_855D140,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_80BE44C,
+};
+
+const struct SpriteTemplate gUnknown_0855D23C =
+{
+ .tileTag = 4096,
+ .paletteTag = 4096,
+ .oam = &sOamData_855D00C,
+ .anims = sSpriteAnimTable_855D168,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_80BE44C,
+};
+
+const struct SpriteTemplate gUnknown_0855D254 =
+{
+ .tileTag = 4096,
+ .paletteTag = 4096,
+ .oam = &sOamData_855D00C,
+ .anims = sSpriteAnimTable_855D190,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_80BE834,
+};
+
+const struct CompressedSpriteSheet gSpriteSheets_0855D26C[] =
+{
+ {gUnknown_08DC234C, 0x2000, 4096},
+ {0}
+};
+
+const struct CompressedSpritePalette gSpritePalettes_0855D26C[] =
+{
+ {gUnknown_08DC16F4, 4096},
+ {0}
+};
+
+const u8 gUnknown_0855D28C[] = {0x4, 0x8, 0x10, 0x20, 0x20};
+const u8 gUnknown_0855D291[] = {0x8, 0x4, 0x2, 0x1, 0x1};
+
+const struct BgTemplate gBgTemplates_0855D298[] =
+{
+ {
+ .bg = 0,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 12,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 0,
+ .baseTile = 0
+ },
+ {
+ .bg = 1,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 13,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 1,
+ .baseTile = 0
+ },
+ {
+ .bg = 2,
+ .charBaseIndex = 2,
+ .mapBaseIndex = 14,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 2,
+ .baseTile = 0
+ },
+ {
+ .bg = 3,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 15,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 3,
+ .baseTile = 0
+ }
+};
+
+const struct WindowTemplate sWindowTemplates_0855D2A8[] =
+{
+ {2, 0, 0, 0x20, 0x20, 0, 1},
+ DUMMY_WIN_TEMPLATE
+};
+
diff --git a/src/pokemon_icon.c b/src/pokemon_icon.c
new file mode 100644
index 000000000..4d1cc51c5
--- /dev/null
+++ b/src/pokemon_icon.c
@@ -0,0 +1,1014 @@
+#include "global.h"
+#include "sprite.h"
+#include "graphics.h"
+
+#define POKE_ICON_BASE_PAL_TAG 56000
+
+const u8 * const gMonIconTable[] =
+{
+ gMonIcon_Bulbasaur,
+ gMonIcon_Bulbasaur,
+ gMonIcon_Ivysaur,
+ gMonIcon_Venusaur,
+ gMonIcon_Charmander,
+ gMonIcon_Charmeleon,
+ gMonIcon_Charizard,
+ gMonIcon_Squirtle,
+ gMonIcon_Wartortle,
+ gMonIcon_Blastoise,
+ gMonIcon_Caterpie,
+ gMonIcon_Metapod,
+ gMonIcon_Butterfree,
+ gMonIcon_Weedle,
+ gMonIcon_Kakuna,
+ gMonIcon_Beedrill,
+ gMonIcon_Pidgey,
+ gMonIcon_Pidgeotto,
+ gMonIcon_Pidgeot,
+ gMonIcon_Rattata,
+ gMonIcon_Raticate,
+ gMonIcon_Spearow,
+ gMonIcon_Fearow,
+ gMonIcon_Ekans,
+ gMonIcon_Arbok,
+ gMonIcon_Pikachu,
+ gMonIcon_Raichu,
+ gMonIcon_Sandshrew,
+ gMonIcon_Sandslash,
+ gMonIcon_NidoranF,
+ gMonIcon_Nidorina,
+ gMonIcon_Nidoqueen,
+ gMonIcon_NidoranM,
+ gMonIcon_Nidorino,
+ gMonIcon_Nidoking,
+ gMonIcon_Clefairy,
+ gMonIcon_Clefable,
+ gMonIcon_Vulpix,
+ gMonIcon_Ninetales,
+ gMonIcon_Jigglypuff,
+ gMonIcon_Wigglytuff,
+ gMonIcon_Zubat,
+ gMonIcon_Golbat,
+ gMonIcon_Oddish,
+ gMonIcon_Gloom,
+ gMonIcon_Vileplume,
+ gMonIcon_Paras,
+ gMonIcon_Parasect,
+ gMonIcon_Venonat,
+ gMonIcon_Venomoth,
+ gMonIcon_Diglett,
+ gMonIcon_Dugtrio,
+ gMonIcon_Meowth,
+ gMonIcon_Persian,
+ gMonIcon_Psyduck,
+ gMonIcon_Golduck,
+ gMonIcon_Mankey,
+ gMonIcon_Primeape,
+ gMonIcon_Growlithe,
+ gMonIcon_Arcanine,
+ gMonIcon_Poliwag,
+ gMonIcon_Poliwhirl,
+ gMonIcon_Poliwrath,
+ gMonIcon_Abra,
+ gMonIcon_Kadabra,
+ gMonIcon_Alakazam,
+ gMonIcon_Machop,
+ gMonIcon_Machoke,
+ gMonIcon_Machamp,
+ gMonIcon_Bellsprout,
+ gMonIcon_Weepinbell,
+ gMonIcon_Victreebel,
+ gMonIcon_Tentacool,
+ gMonIcon_Tentacruel,
+ gMonIcon_Geodude,
+ gMonIcon_Graveler,
+ gMonIcon_Golem,
+ gMonIcon_Ponyta,
+ gMonIcon_Rapidash,
+ gMonIcon_Slowpoke,
+ gMonIcon_Slowbro,
+ gMonIcon_Magnemite,
+ gMonIcon_Magneton,
+ gMonIcon_Farfetchd,
+ gMonIcon_Doduo,
+ gMonIcon_Dodrio,
+ gMonIcon_Seel,
+ gMonIcon_Dewgong,
+ gMonIcon_Grimer,
+ gMonIcon_Muk,
+ gMonIcon_Shellder,
+ gMonIcon_Cloyster,
+ gMonIcon_Gastly,
+ gMonIcon_Haunter,
+ gMonIcon_Gengar,
+ gMonIcon_Onix,
+ gMonIcon_Drowzee,
+ gMonIcon_Hypno,
+ gMonIcon_Krabby,
+ gMonIcon_Kingler,
+ gMonIcon_Voltorb,
+ gMonIcon_Electrode,
+ gMonIcon_Exeggcute,
+ gMonIcon_Exeggutor,
+ gMonIcon_Cubone,
+ gMonIcon_Marowak,
+ gMonIcon_Hitmonlee,
+ gMonIcon_Hitmonchan,
+ gMonIcon_Lickitung,
+ gMonIcon_Koffing,
+ gMonIcon_Weezing,
+ gMonIcon_Rhyhorn,
+ gMonIcon_Rhydon,
+ gMonIcon_Chansey,
+ gMonIcon_Tangela,
+ gMonIcon_Kangaskhan,
+ gMonIcon_Horsea,
+ gMonIcon_Seadra,
+ gMonIcon_Goldeen,
+ gMonIcon_Seaking,
+ gMonIcon_Staryu,
+ gMonIcon_Starmie,
+ gMonIcon_Mrmime,
+ gMonIcon_Scyther,
+ gMonIcon_Jynx,
+ gMonIcon_Electabuzz,
+ gMonIcon_Magmar,
+ gMonIcon_Pinsir,
+ gMonIcon_Tauros,
+ gMonIcon_Magikarp,
+ gMonIcon_Gyarados,
+ gMonIcon_Lapras,
+ gMonIcon_Ditto,
+ gMonIcon_Eevee,
+ gMonIcon_Vaporeon,
+ gMonIcon_Jolteon,
+ gMonIcon_Flareon,
+ gMonIcon_Porygon,
+ gMonIcon_Omanyte,
+ gMonIcon_Omastar,
+ gMonIcon_Kabuto,
+ gMonIcon_Kabutops,
+ gMonIcon_Aerodactyl,
+ gMonIcon_Snorlax,
+ gMonIcon_Articuno,
+ gMonIcon_Zapdos,
+ gMonIcon_Moltres,
+ gMonIcon_Dratini,
+ gMonIcon_Dragonair,
+ gMonIcon_Dragonite,
+ gMonIcon_Mewtwo,
+ gMonIcon_Mew,
+ gMonIcon_Chikorita,
+ gMonIcon_Bayleef,
+ gMonIcon_Meganium,
+ gMonIcon_Cyndaquil,
+ gMonIcon_Quilava,
+ gMonIcon_Typhlosion,
+ gMonIcon_Totodile,
+ gMonIcon_Croconaw,
+ gMonIcon_Feraligatr,
+ gMonIcon_Sentret,
+ gMonIcon_Furret,
+ gMonIcon_Hoothoot,
+ gMonIcon_Noctowl,
+ gMonIcon_Ledyba,
+ gMonIcon_Ledian,
+ gMonIcon_Spinarak,
+ gMonIcon_Ariados,
+ gMonIcon_Crobat,
+ gMonIcon_Chinchou,
+ gMonIcon_Lanturn,
+ gMonIcon_Pichu,
+ gMonIcon_Cleffa,
+ gMonIcon_Igglybuff,
+ gMonIcon_Togepi,
+ gMonIcon_Togetic,
+ gMonIcon_Natu,
+ gMonIcon_Xatu,
+ gMonIcon_Mareep,
+ gMonIcon_Flaaffy,
+ gMonIcon_Ampharos,
+ gMonIcon_Bellossom,
+ gMonIcon_Marill,
+ gMonIcon_Azumarill,
+ gMonIcon_Sudowoodo,
+ gMonIcon_Politoed,
+ gMonIcon_Hoppip,
+ gMonIcon_Skiploom,
+ gMonIcon_Jumpluff,
+ gMonIcon_Aipom,
+ gMonIcon_Sunkern,
+ gMonIcon_Sunflora,
+ gMonIcon_Yanma,
+ gMonIcon_Wooper,
+ gMonIcon_Quagsire,
+ gMonIcon_Espeon,
+ gMonIcon_Umbreon,
+ gMonIcon_Murkrow,
+ gMonIcon_Slowking,
+ gMonIcon_Misdreavus,
+ gMonIcon_UnownA,
+ gMonIcon_Wobbuffet,
+ gMonIcon_Girafarig,
+ gMonIcon_Pineco,
+ gMonIcon_Forretress,
+ gMonIcon_Dunsparce,
+ gMonIcon_Gligar,
+ gMonIcon_Steelix,
+ gMonIcon_Snubbull,
+ gMonIcon_Granbull,
+ gMonIcon_Qwilfish,
+ gMonIcon_Scizor,
+ gMonIcon_Shuckle,
+ gMonIcon_Heracross,
+ gMonIcon_Sneasel,
+ gMonIcon_Teddiursa,
+ gMonIcon_Ursaring,
+ gMonIcon_Slugma,
+ gMonIcon_Magcargo,
+ gMonIcon_Swinub,
+ gMonIcon_Piloswine,
+ gMonIcon_Corsola,
+ gMonIcon_Remoraid,
+ gMonIcon_Octillery,
+ gMonIcon_Delibird,
+ gMonIcon_Mantine,
+ gMonIcon_Skarmory,
+ gMonIcon_Houndour,
+ gMonIcon_Houndoom,
+ gMonIcon_Kingdra,
+ gMonIcon_Phanpy,
+ gMonIcon_Donphan,
+ gMonIcon_Porygon2,
+ gMonIcon_Stantler,
+ gMonIcon_Smeargle,
+ gMonIcon_Tyrogue,
+ gMonIcon_Hitmontop,
+ gMonIcon_Smoochum,
+ gMonIcon_Elekid,
+ gMonIcon_Magby,
+ gMonIcon_Miltank,
+ gMonIcon_Blissey,
+ gMonIcon_Raikou,
+ gMonIcon_Entei,
+ gMonIcon_Suicune,
+ gMonIcon_Larvitar,
+ gMonIcon_Pupitar,
+ gMonIcon_Tyranitar,
+ gMonIcon_Lugia,
+ gMonIcon_HoOh,
+ gMonIcon_Celebi,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_QuestionMark,
+ gMonIcon_Treecko,
+ gMonIcon_Grovyle,
+ gMonIcon_Sceptile,
+ gMonIcon_Torchic,
+ gMonIcon_Combusken,
+ gMonIcon_Blaziken,
+ gMonIcon_Mudkip,
+ gMonIcon_Marshtomp,
+ gMonIcon_Swampert,
+ gMonIcon_Poochyena,
+ gMonIcon_Mightyena,
+ gMonIcon_Zigzagoon,
+ gMonIcon_Linoone,
+ gMonIcon_Wurmple,
+ gMonIcon_Silcoon,
+ gMonIcon_Beautifly,
+ gMonIcon_Cascoon,
+ gMonIcon_Dustox,
+ gMonIcon_Lotad,
+ gMonIcon_Lombre,
+ gMonIcon_Ludicolo,
+ gMonIcon_Seedot,
+ gMonIcon_Nuzleaf,
+ gMonIcon_Shiftry,
+ gMonIcon_Nincada,
+ gMonIcon_Ninjask,
+ gMonIcon_Shedinja,
+ gMonIcon_Taillow,
+ gMonIcon_Swellow,
+ gMonIcon_Shroomish,
+ gMonIcon_Breloom,
+ gMonIcon_Spinda,
+ gMonIcon_Wingull,
+ gMonIcon_Pelipper,
+ gMonIcon_Surskit,
+ gMonIcon_Masquerain,
+ gMonIcon_Wailmer,
+ gMonIcon_Wailord,
+ gMonIcon_Skitty,
+ gMonIcon_Delcatty,
+ gMonIcon_Kecleon,
+ gMonIcon_Baltoy,
+ gMonIcon_Claydol,
+ gMonIcon_Nosepass,
+ gMonIcon_Torkoal,
+ gMonIcon_Sableye,
+ gMonIcon_Barboach,
+ gMonIcon_Whiscash,
+ gMonIcon_Luvdisc,
+ gMonIcon_Corphish,
+ gMonIcon_Crawdaunt,
+ gMonIcon_Feebas,
+ gMonIcon_Milotic,
+ gMonIcon_Carvanha,
+ gMonIcon_Sharpedo,
+ gMonIcon_Trapinch,
+ gMonIcon_Vibrava,
+ gMonIcon_Flygon,
+ gMonIcon_Makuhita,
+ gMonIcon_Hariyama,
+ gMonIcon_Electrike,
+ gMonIcon_Manectric,
+ gMonIcon_Numel,
+ gMonIcon_Camerupt,
+ gMonIcon_Spheal,
+ gMonIcon_Sealeo,
+ gMonIcon_Walrein,
+ gMonIcon_Cacnea,
+ gMonIcon_Cacturne,
+ gMonIcon_Snorunt,
+ gMonIcon_Glalie,
+ gMonIcon_Lunatone,
+ gMonIcon_Solrock,
+ gMonIcon_Azurill,
+ gMonIcon_Spoink,
+ gMonIcon_Grumpig,
+ gMonIcon_Plusle,
+ gMonIcon_Minun,
+ gMonIcon_Mawile,
+ gMonIcon_Meditite,
+ gMonIcon_Medicham,
+ gMonIcon_Swablu,
+ gMonIcon_Altaria,
+ gMonIcon_Wynaut,
+ gMonIcon_Duskull,
+ gMonIcon_Dusclops,
+ gMonIcon_Roselia,
+ gMonIcon_Slakoth,
+ gMonIcon_Vigoroth,
+ gMonIcon_Slaking,
+ gMonIcon_Gulpin,
+ gMonIcon_Swalot,
+ gMonIcon_Tropius,
+ gMonIcon_Whismur,
+ gMonIcon_Loudred,
+ gMonIcon_Exploud,
+ gMonIcon_Clamperl,
+ gMonIcon_Huntail,
+ gMonIcon_Gorebyss,
+ gMonIcon_Absol,
+ gMonIcon_Shuppet,
+ gMonIcon_Banette,
+ gMonIcon_Seviper,
+ gMonIcon_Zangoose,
+ gMonIcon_Relicanth,
+ gMonIcon_Aron,
+ gMonIcon_Lairon,
+ gMonIcon_Aggron,
+ gMonIcon_Castform,
+ gMonIcon_Volbeat,
+ gMonIcon_Illumise,
+ gMonIcon_Lileep,
+ gMonIcon_Cradily,
+ gMonIcon_Anorith,
+ gMonIcon_Armaldo,
+ gMonIcon_Ralts,
+ gMonIcon_Kirlia,
+ gMonIcon_Gardevoir,
+ gMonIcon_Bagon,
+ gMonIcon_Shelgon,
+ gMonIcon_Salamence,
+ gMonIcon_Beldum,
+ gMonIcon_Metang,
+ gMonIcon_Metagross,
+ gMonIcon_Regirock,
+ gMonIcon_Regice,
+ gMonIcon_Registeel,
+ gMonIcon_Kyogre,
+ gMonIcon_Groudon,
+ gMonIcon_Rayquaza,
+ gMonIcon_Latias,
+ gMonIcon_Latios,
+ gMonIcon_Jirachi,
+ gMonIcon_Deoxys,
+ gMonIcon_Chimecho,
+ gMonIcon_Egg,
+ gMonIcon_UnownB,
+ gMonIcon_UnownC,
+ gMonIcon_UnownD,
+ gMonIcon_UnownE,
+ gMonIcon_UnownF,
+ gMonIcon_UnownG,
+ gMonIcon_UnownH,
+ gMonIcon_UnownI,
+ gMonIcon_UnownJ,
+ gMonIcon_UnownK,
+ gMonIcon_UnownL,
+ gMonIcon_UnownM,
+ gMonIcon_UnownN,
+ gMonIcon_UnownO,
+ gMonIcon_UnownP,
+ gMonIcon_UnownQ,
+ gMonIcon_UnownR,
+ gMonIcon_UnownS,
+ gMonIcon_UnownT,
+ gMonIcon_UnownU,
+ gMonIcon_UnownV,
+ gMonIcon_UnownW,
+ gMonIcon_UnownX,
+ gMonIcon_UnownY,
+ gMonIcon_UnownZ,
+ gMonIcon_UnownExclamationMark,
+ gMonIcon_UnownQuestionMark,
+};
+
+const u8 gMonIconPaletteIndices[] =
+{
+ 0, // ??????????
+ 1, // Bulbasaur
+ 1, // Ivysaur
+ 1, // Venusaur
+ 0, // Charmander
+ 0, // Charmeleon
+ 0, // Charizard
+ 0, // Squirtle
+ 2, // Wartortle
+ 2, // Blastoise
+ 1, // Caterpie
+ 1, // Metapod
+ 0, // Butterfree
+ 1, // Weedle
+ 2, // Kakuna
+ 2, // Beedrill
+ 0, // Pidgey
+ 0, // Pidgeotto
+ 0, // Pidgeot
+ 2, // Rattata
+ 1, // Raticate
+ 0, // Spearow
+ 0, // Fearow
+ 2, // Ekans
+ 2, // Arbok
+ 2, // Pikachu
+ 0, // Raichu
+ 2, // Sandshrew
+ 2, // Sandslash
+ 2, // Nidoran♀
+ 2, // Nidorina
+ 2, // Nidoqueen
+ 2, // Nidoran♂
+ 2, // Nidorino
+ 2, // Nidoking
+ 0, // Clefairy
+ 0, // Clefable
+ 2, // Vulpix
+ 1, // Ninetales
+ 0, // Jigglypuff
+ 0, // Wigglytuff
+ 2, // Zubat
+ 2, // Golbat
+ 1, // Oddish
+ 0, // Gloom
+ 0, // Vileplume
+ 0, // Paras
+ 0, // Parasect
+ 0, // Venonat
+ 2, // Venomoth
+ 2, // Diglett
+ 2, // Dugtrio
+ 1, // Meowth
+ 1, // Persian
+ 1, // Psyduck
+ 2, // Golduck
+ 1, // Mankey
+ 2, // Primeape
+ 0, // Growlithe
+ 0, // Arcanine
+ 0, // Poliwag
+ 0, // Poliwhirl
+ 0, // Poliwrath
+ 2, // Abra
+ 2, // Kadabra
+ 2, // Alakazam
+ 0, // Machop
+ 2, // Machoke
+ 0, // Machamp
+ 1, // Bellsprout
+ 1, // Weepinbell
+ 1, // Victreebel
+ 2, // Tentacool
+ 2, // Tentacruel
+ 1, // Geodude
+ 1, // Graveler
+ 1, // Golem
+ 0, // Ponyta
+ 0, // Rapidash
+ 0, // Slowpoke
+ 0, // Slowbro
+ 0, // Magnemite
+ 0, // Magneton
+ 1, // Farfetch'd
+ 2, // Doduo
+ 2, // Dodrio
+ 2, // Seel
+ 2, // Dewgong
+ 2, // Grimer
+ 2, // Muk
+ 2, // Shellder
+ 2, // Cloyster
+ 2, // Gastly
+ 2, // Haunter
+ 2, // Gengar
+ 2, // Onix
+ 2, // Drowzee
+ 1, // Hypno
+ 2, // Krabby
+ 2, // Kingler
+ 0, // Voltorb
+ 0, // Electrode
+ 0, // Exeggcute
+ 1, // Exeggutor
+ 1, // Cubone
+ 1, // Marowak
+ 2, // Hitmonlee
+ 2, // Hitmonchan
+ 1, // Lickitung
+ 2, // Koffing
+ 2, // Weezing
+ 1, // Rhyhorn
+ 1, // Rhydon
+ 0, // Chansey
+ 0, // Tangela
+ 1, // Kangaskhan
+ 0, // Horsea
+ 0, // Seadra
+ 0, // Goldeen
+ 0, // Seaking
+ 2, // Staryu
+ 2, // Starmie
+ 0, // Mr. mime
+ 1, // Scyther
+ 2, // Jynx
+ 1, // Electabuzz
+ 0, // Magmar
+ 2, // Pinsir
+ 2, // Tauros
+ 0, // Magikarp
+ 0, // Gyarados
+ 2, // Lapras
+ 2, // Ditto
+ 2, // Eevee
+ 0, // Vaporeon
+ 0, // Jolteon
+ 0, // Flareon
+ 0, // Porygon
+ 0, // Omanyte
+ 0, // Omastar
+ 2, // Kabuto
+ 2, // Kabutops
+ 0, // Aerodactyl
+ 1, // Snorlax
+ 0, // Articuno
+ 0, // Zapdos
+ 0, // Moltres
+ 0, // Dratini
+ 0, // Dragonair
+ 2, // Dragonite
+ 2, // Mewtwo
+ 0, // Mew
+ 1, // Chikorita
+ 1, // Bayleef
+ 1, // Meganium
+ 1, // Cyndaquil
+ 1, // Quilava
+ 1, // Typhlosion
+ 2, // Totodile
+ 2, // Croconaw
+ 2, // Feraligatr
+ 2, // Sentret
+ 2, // Furret
+ 2, // Hoothoot
+ 2, // Noctowl
+ 0, // Ledyba
+ 0, // Ledian
+ 1, // Spinarak
+ 0, // Ariados
+ 2, // Crobat
+ 2, // Chinchou
+ 0, // Lanturn
+ 0, // Pichu
+ 0, // Cleffa
+ 1, // Igglybuff
+ 2, // Togepi
+ 2, // Togetic
+ 0, // Natu
+ 0, // Xatu
+ 2, // Mareep
+ 0, // Flaaffy
+ 0, // Ampharos
+ 1, // Bellossom
+ 2, // Marill
+ 2, // Azumarill
+ 1, // Sudowoodo
+ 1, // Politoed
+ 1, // Hoppip
+ 1, // Skiploom
+ 2, // Jumpluff
+ 2, // Aipom
+ 1, // Sunkern
+ 1, // Sunflora
+ 1, // Yanma
+ 0, // Wooper
+ 0, // Quagsire
+ 2, // Espeon
+ 2, // Umbreon
+ 2, // Murkrow
+ 0, // Slowking
+ 0, // Misdreavus
+ 0, // Unown A
+ 0, // Wobbuffet
+ 1, // Girafarig
+ 0, // Pineco
+ 2, // Forretress
+ 2, // Dunsparce
+ 2, // Gligar
+ 0, // Steelix
+ 0, // Snubbull
+ 2, // Granbull
+ 0, // Qwilfish
+ 0, // Scizor
+ 1, // Shuckle
+ 2, // Heracross
+ 0, // Sneasel
+ 0, // Teddiursa
+ 2, // Ursaring
+ 0, // Slugma
+ 0, // Magcargo
+ 2, // Swinub
+ 2, // Piloswine
+ 0, // Corsola
+ 0, // Remoraid
+ 0, // Octillery
+ 0, // Delibird
+ 2, // Mantine
+ 0, // Skarmory
+ 0, // Houndour
+ 0, // Houndoom
+ 0, // Kingdra
+ 0, // Phanpy
+ 0, // Donphan
+ 0, // Porygon2
+ 2, // Stantler
+ 1, // Smeargle
+ 2, // Tyrogue
+ 2, // Hitmontop
+ 1, // Smoochum
+ 1, // Elekid
+ 1, // Magby
+ 1, // Miltank
+ 1, // Blissey
+ 0, // Raikou
+ 2, // Entei
+ 0, // Suicune
+ 1, // Larvitar
+ 0, // Pupitar
+ 1, // Tyranitar
+ 0, // Lugia
+ 1, // Ho-Oh
+ 1, // Celebi
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 0, // ?
+ 1, // Treecko
+ 0, // Grovyle
+ 1, // Sceptile
+ 0, // Torchic
+ 0, // Combusken
+ 0, // Blaziken
+ 0, // Mudkip
+ 0, // Marshtomp
+ 0, // Swampert
+ 2, // Poochyena
+ 2, // Mightyena
+ 2, // Zigzagoon
+ 2, // Linoone
+ 0, // Wurmple
+ 2, // Silcoon
+ 0, // Beautifly
+ 2, // Cascoon
+ 1, // Dustox
+ 1, // Lotad
+ 1, // Lombre
+ 1, // Ludicolo
+ 1, // Seedot
+ 1, // Nuzleaf
+ 0, // Shiftry
+ 1, // Nincada
+ 1, // Ninjask
+ 1, // Shedinja
+ 2, // Taillow
+ 2, // Swellow
+ 1, // Shroomish
+ 1, // Breloom
+ 1, // Spinda
+ 0, // Wingull
+ 0, // Pelipper
+ 2, // Surskit
+ 0, // Masquerain
+ 2, // Wailmer
+ 0, // Wailord
+ 0, // Skitty
+ 2, // Delcatty
+ 1, // Kecleon
+ 1, // Baltoy
+ 0, // Claydol
+ 0, // Nosepass
+ 1, // Torkoal
+ 2, // Sableye
+ 0, // Barboach
+ 0, // Whiscash
+ 0, // Luvdisc
+ 0, // Corphish
+ 0, // Crawdaunt
+ 2, // Feebas
+ 0, // Milotic
+ 0, // Carvanha
+ 0, // Sharpedo
+ 1, // Trapinch
+ 1, // Vibrava
+ 1, // Flygon
+ 2, // Makuhita
+ 1, // Hariyama
+ 1, // Electrike
+ 0, // Manectric
+ 1, // Numel
+ 0, // Camerupt
+ 2, // Spheal
+ 2, // Sealeo
+ 0, // Walrein
+ 1, // Cacnea
+ 1, // Cacturne
+ 2, // Snorunt
+ 0, // Glalie
+ 1, // Lunatone
+ 0, // Solrock
+ 2, // Azurill
+ 0, // Spoink
+ 2, // Grumpig
+ 0, // Plusle
+ 0, // Minun
+ 2, // Mawile
+ 0, // Meditite
+ 0, // Medicham
+ 0, // Swablu
+ 0, // Altaria
+ 0, // Wynaut
+ 0, // Duskull
+ 0, // Dusclops
+ 0, // Roselia
+ 2, // Slakoth
+ 2, // Vigoroth
+ 1, // Slaking
+ 1, // Gulpin
+ 2, // Swalot
+ 1, // Tropius
+ 0, // Whismur
+ 2, // Loudred
+ 2, // Exploud
+ 0, // Clamperl
+ 0, // Huntail
+ 0, // Gorebyss
+ 0, // Absol
+ 0, // Shuppet
+ 0, // Banette
+ 2, // Seviper
+ 0, // Zangoose
+ 1, // Relicanth
+ 2, // Aron
+ 2, // Lairon
+ 2, // Aggron
+ 0, // Castform
+ 0, // Volbeat
+ 2, // Illumise
+ 2, // Lileep
+ 0, // Cradily
+ 0, // Anorith
+ 0, // Armaldo
+ 1, // Ralts
+ 1, // Kirlia
+ 1, // Gardevoir
+ 2, // Bagon
+ 2, // Shelgon
+ 0, // Salamence
+ 0, // Beldum
+ 0, // Metang
+ 0, // Metagross
+ 2, // Regirock
+ 2, // Regice
+ 2, // Registeel
+ 2, // Kyogre
+ 0, // Groudon
+ 1, // Rayquaza
+ 0, // Latias
+ 2, // Latios
+ 0, // Jirachi
+ 0, // Deoxys
+ 0, // Chimecho
+ 1, // Egg
+ 0, // Unown B
+ 0, // Unown C
+ 0, // Unown D
+ 0, // Unown E
+ 0, // Unown F
+ 0, // Unown G
+ 0, // Unown H
+ 0, // Unown I
+ 0, // Unown J
+ 0, // Unown K
+ 0, // Unown L
+ 0, // Unown M
+ 0, // Unown N
+ 0, // Unown O
+ 0, // Unown P
+ 0, // Unown Q
+ 0, // Unown R
+ 0, // Unown S
+ 0, // Unown T
+ 0, // Unown U
+ 0, // Unown V
+ 0, // Unown W
+ 0, // Unown X
+ 0, // Unown Y
+ 0, // Unown Z
+ 0, // Unown Exclamation Mark
+ 0, // Unown Question Mark
+};
+
+const struct SpritePalette gMonIconPaletteTable[] =
+{
+ { gMonIconPalettes[0], POKE_ICON_BASE_PAL_TAG + 0 },
+ { gMonIconPalettes[1], POKE_ICON_BASE_PAL_TAG + 1 },
+ { gMonIconPalettes[2], POKE_ICON_BASE_PAL_TAG + 2 },
+
+// There are only 3 actual palettes. The following are unused
+// and don't point to valid data.
+ { gMonIconPalettes[3], POKE_ICON_BASE_PAL_TAG + 3 },
+ { gMonIconPalettes[4], POKE_ICON_BASE_PAL_TAG + 4 },
+ { gMonIconPalettes[5], POKE_ICON_BASE_PAL_TAG + 5 },
+};
+
+const struct OamData sMonIconOamData =
+{
+ .y = 0,
+ .affineMode = 0,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 0,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 2,
+ .tileNum = 0,
+ .priority = 1,
+ .paletteNum = 0,
+ .affineParam = 0
+};
+
+// fastest to slowest
+
+static const union AnimCmd sAnim_0[] =
+{
+ ANIMCMD_FRAME(0, 6),
+ ANIMCMD_FRAME(1, 6),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd sAnim_1[] =
+{
+ ANIMCMD_FRAME(0, 8),
+ ANIMCMD_FRAME(1, 8),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd sAnim_2[] =
+{
+ ANIMCMD_FRAME(0, 14),
+ ANIMCMD_FRAME(1, 14),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd sAnim_3[] =
+{
+ ANIMCMD_FRAME(0, 22),
+ ANIMCMD_FRAME(1, 22),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd sAnim_4[] =
+{
+ ANIMCMD_FRAME(0, 29),
+ ANIMCMD_FRAME(0, 29), // frame 0 is repeated
+ ANIMCMD_JUMP(0),
+};
+
+const union AnimCmd *const sMonIconAnims[] =
+{
+ sAnim_0,
+ sAnim_1,
+ sAnim_2,
+ sAnim_3,
+ sAnim_4,
+};
+
+static const union AffineAnimCmd sAffineAnim_0[] =
+{
+ AFFINEANIMCMD_FRAME(0, 0, 0, 10),
+ AFFINEANIMCMD_END,
+};
+
+static const union AffineAnimCmd sAffineAnim_1[] =
+{
+ AFFINEANIMCMD_FRAME(-2, -2, 0, 122),
+ AFFINEANIMCMD_END,
+};
+
+const union AffineAnimCmd *const sMonIconAffineAnims[] =
+{
+ sAffineAnim_0,
+ sAffineAnim_1,
+};
+
+const u16 sSpriteImageSizes[3][4] =
+{
+ // square
+ {
+ 0x20, // 1×1
+ 0x80, // 2×2
+ 0x200, // 4×4
+ 0x800, // 8×8
+ },
+
+ // horizontal rectangle
+ {
+ 0x40, // 2×1
+ 0x80, // 4×1
+ 0x100, // 4×2
+ 0x400, // 8×4
+ },
+
+ // vertical rectangle
+ {
+ 0x40, // 1×2
+ 0x80, // 1×4
+ 0x100, // 2×4
+ 0x400, // 4×8
+ },
+};
diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c
index bdf4427c7..bb196dd27 100644
--- a/src/pokemon_storage_system.c
+++ b/src/pokemon_storage_system.c
@@ -5,9 +5,76 @@
#include "event_data.h"
#include "string_util.h"
#include "text.h"
+#include "strings.h"
+#include "window.h"
IWRAM_DATA u8 gUnknown_03000F78[0x188];
+struct OptionAndDescription
+{
+ const u8 *optionTxt;
+ const u8 *descriptionTxt;
+};
+
+// const rom data
+const struct OptionAndDescription gUnknown_085716C0[] =
+{
+ {gText_WithdrawPokemon, gText_WithdrawMonDescription},
+ {gText_DepositPokemon, gText_DepositMonDescription},
+ {gText_MovePokemon, gText_MoveMonDescription},
+ {gText_MoveItems, gText_MoveItemsDescription},
+ {gText_SeeYa, gText_SeeYaDescription}
+};
+
+const struct WindowTemplate gUnknown_085716E8 = {0, 1, 1, 0x11, 0xA, 0xF, 1};
+
+static const union AnimCmd sSpriteAnim_85716F0[] =
+{
+ ANIMCMD_FRAME(0, 5),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_85716F8[] =
+{
+ ANIMCMD_FRAME(4, 5),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_8571700[] =
+{
+ ANIMCMD_FRAME(6, 5),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_8571708[] =
+{
+ ANIMCMD_FRAME(10, 5),
+ ANIMCMD_END
+};
+
+const union AnimCmd *const sSpriteAnimTable_8571710[] =
+{
+ sSpriteAnim_85716F0,
+ sSpriteAnim_85716F8,
+ sSpriteAnim_8571700,
+ sSpriteAnim_8571708
+};
+
+static const union AffineAnimCmd sSpriteAffineAnim_8571720[] =
+{
+ AFFINEANIMCMD_FRAME(0xE0, 0xE0, 0, 0),
+ AFFINEANIMCMD_END
+};
+
+static const union AffineAnimCmd *const sSpriteAffineAnimTable_8571730[] =
+{
+ sSpriteAffineAnim_8571720
+};
+
+const struct TextColor gUnknown_08571734[] = {4, 0xF, 0xE};
+const u8 gUnknown_08571737[] = _("/30");
+
+// code
u8 CountMonsInBox(u8 boxId)
{
u16 i, count;
diff --git a/src/rayquaza_scene.c b/src/rayquaza_scene.c
new file mode 100644
index 000000000..577294f0c
--- /dev/null
+++ b/src/rayquaza_scene.c
@@ -0,0 +1,1164 @@
+#include "global.h"
+#include "sprite.h"
+#include "task.h"
+#include "graphics.h"
+#include "bg.h"
+
+struct UnkRayquazaStruct
+{
+ u32 field_0;
+ u32 field_4;
+ u32 field_8;
+};
+
+// this file's functions
+void sub_81D7134(u8 taskId);
+void sub_81D7F4C(u8 taskId);
+void sub_81D84EC(u8 taskId);
+void sub_81D8980(u8 taskId);
+void sub_81D8DB4(u8 taskId);
+void sub_81D6800(u8 taskId);
+
+void sub_81D8260(struct Sprite *sprite);
+void sub_81D961C(struct Sprite *sprite);
+
+// const rom data
+const TaskFunc gUnknown_0862A6A0[] =
+{
+ sub_81D7134,
+ sub_81D7134,
+ sub_81D7F4C,
+ sub_81D84EC,
+ sub_81D8980,
+ sub_81D8DB4,
+ sub_81D6800
+};
+
+static const struct OamData sOamData_862A6BC =
+{
+ .y = 0,
+ .affineMode = 0,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 0,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 3,
+ .tileNum = 0,
+ .priority = 2,
+ .paletteNum = 0,
+ .affineParam = 0
+};
+
+static const struct OamData sOamData_862A6C4 =
+{
+ .y = 0,
+ .affineMode = 0,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 0,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 2,
+ .tileNum = 0,
+ .priority = 2,
+ .paletteNum = 0,
+ .affineParam = 0
+};
+
+static const struct OamData sOamData_862A6CC =
+{
+ .y = 0,
+ .affineMode = 0,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 1,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 3,
+ .tileNum = 0,
+ .priority = 2,
+ .paletteNum = 0,
+ .affineParam = 0
+};
+
+static const struct OamData sOamData_862A6D4 =
+{
+ .y = 0,
+ .affineMode = 0,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 1,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 2,
+ .tileNum = 0,
+ .priority = 2,
+ .paletteNum = 0,
+ .affineParam = 0
+};
+
+static const struct OamData sOamData_862A6DC =
+{
+ .y = 0,
+ .affineMode = 0,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 1,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 0,
+ .tileNum = 0,
+ .priority = 2,
+ .paletteNum = 0,
+ .affineParam = 0
+};
+
+static const struct OamData sOamData_862A6E4 =
+{
+ .y = 0,
+ .affineMode = 0,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 2,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 2,
+ .tileNum = 0,
+ .priority = 2,
+ .paletteNum = 0,
+ .affineParam = 0
+};
+
+static const struct OamData sOamData_862A6EC =
+{
+ .y = 0,
+ .affineMode = 0,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 0,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 1,
+ .tileNum = 0,
+ .priority = 2,
+ .paletteNum = 0,
+ .affineParam = 0
+};
+
+static const struct OamData sOamData_862A6F4 =
+{
+ .y = 0,
+ .affineMode = 0,
+ .objMode = 0,
+ .mosaic = 0,
+ .bpp = 0,
+ .shape = 1,
+ .x = 0,
+ .matrixNum = 0,
+ .size = 1,
+ .tileNum = 0,
+ .priority = 2,
+ .paletteNum = 0,
+ .affineParam = 0
+};
+
+static const union AnimCmd sSpriteAnim_862A6FC[] =
+{
+ ANIMCMD_FRAME(0, 30),
+ ANIMCMD_FRAME(64, 30),
+ ANIMCMD_FRAME(128, 30),
+ ANIMCMD_FRAME(64, 30),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd sSpriteAnim_862A710[] =
+{
+ ANIMCMD_FRAME(192, 30),
+ ANIMCMD_FRAME(256, 30),
+ ANIMCMD_FRAME(320, 30),
+ ANIMCMD_FRAME(256, 30),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862A724[] =
+{
+ sSpriteAnim_862A6FC,
+ sSpriteAnim_862A710
+};
+
+const struct SpriteTemplate gUnknown_0862A72C =
+{
+ .tileTag = 30505,
+ .paletteTag = 30505,
+ .oam = &sOamData_862A6BC,
+ .anims = sSpriteAnimTable_862A724,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+static const union AnimCmd sSpriteAnim_862A744[] =
+{
+ ANIMCMD_FRAME(0, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862A74C[] =
+{
+ sSpriteAnim_862A744
+};
+
+const struct SpriteTemplate gUnknown_0862A750 =
+{
+ .tileTag = 30506,
+ .paletteTag = 30505,
+ .oam = &sOamData_862A6C4,
+ .anims = sSpriteAnimTable_862A74C,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+static const union AnimCmd sSpriteAnim_862A768[] =
+{
+ ANIMCMD_FRAME(0, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862A770[] =
+{
+ sSpriteAnim_862A768
+};
+
+const struct SpriteTemplate gUnknown_0862A774 =
+{
+ .tileTag = 30507,
+ .paletteTag = 30505,
+ .oam = &sOamData_862A6CC,
+ .anims = sSpriteAnimTable_862A770,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+static const union AnimCmd sSpriteAnim_862A78C[] =
+{
+ ANIMCMD_FRAME(0, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862A794[] =
+{
+ ANIMCMD_FRAME(8, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862A79C[] =
+{
+ ANIMCMD_FRAME(16, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862A7A4[] =
+{
+ ANIMCMD_FRAME(24, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862A7AC[] =
+{
+ ANIMCMD_FRAME(32, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862A7B4[] =
+{
+ ANIMCMD_FRAME(40, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862A7BC[] =
+{
+ ANIMCMD_FRAME(48, 36),
+ ANIMCMD_FRAME(64, 36),
+ ANIMCMD_FRAME(80, 36),
+ ANIMCMD_FRAME(64, 36),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd sSpriteAnim_862A7D0[] =
+{
+ ANIMCMD_FRAME(56, 36),
+ ANIMCMD_FRAME(72, 36),
+ ANIMCMD_FRAME(88, 36),
+ ANIMCMD_FRAME(72, 36),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd sSpriteAnim_862A7E4[] =
+{
+ ANIMCMD_FRAME(96, 36),
+ ANIMCMD_FRAME(104, 36),
+ ANIMCMD_FRAME(112, 36),
+ ANIMCMD_FRAME(104, 36),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862A7F8[] =
+{
+ sSpriteAnim_862A78C,
+ sSpriteAnim_862A794,
+ sSpriteAnim_862A79C,
+ sSpriteAnim_862A7A4,
+ sSpriteAnim_862A7AC,
+ sSpriteAnim_862A7B4,
+ sSpriteAnim_862A7BC,
+ sSpriteAnim_862A7D0,
+ sSpriteAnim_862A7E4
+};
+
+const struct SpriteTemplate gUnknown_0862A81C =
+{
+ .tileTag = 30508,
+ .paletteTag = 30508,
+ .oam = &sOamData_862A6D4,
+ .anims = sSpriteAnimTable_862A7F8,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+static const union AnimCmd sSpriteAnim_862A834[] =
+{
+ ANIMCMD_FRAME(0, 36),
+ ANIMCMD_FRAME(2, 36),
+ ANIMCMD_FRAME(4, 36),
+ ANIMCMD_FRAME(2, 36),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862A848[] =
+{
+ sSpriteAnim_862A834
+};
+
+const struct SpriteTemplate gUnknown_0862A84C =
+{
+ .tileTag = 30509,
+ .paletteTag = 30508,
+ .oam = &sOamData_862A6DC,
+ .anims = sSpriteAnimTable_862A848,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+const struct SpriteTemplate gUnknown_0862A864 =
+{
+ .tileTag = 30510,
+ .paletteTag = 30508,
+ .oam = &sOamData_862A6C4,
+ .anims = sSpriteAnimTable_862A74C,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+const struct UnkRayquazaStruct gUnknown_0862A87C = {0x4000014, 0xA2600001, 1};
+
+const struct BgTemplate gUnknown_0862A888[] =
+{
+ {
+ .bg = 0,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 31,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 0,
+ .baseTile = 0
+ },
+ {
+ .bg = 1,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 30,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 2,
+ .baseTile = 0
+ },
+ {
+ .bg = 2,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 29,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 1,
+ .baseTile = 0
+ },
+};
+
+static const union AnimCmd sSpriteAnim_862A894[] =
+{
+ ANIMCMD_FRAME(0, 20),
+ ANIMCMD_FRAME(64, 20),
+ ANIMCMD_FRAME(128, 20),
+ ANIMCMD_FRAME(64, 20),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd sSpriteAnim_862A8A8[] =
+{
+ ANIMCMD_FRAME(192, 20),
+ ANIMCMD_FRAME(256, 20),
+ ANIMCMD_FRAME(320, 20),
+ ANIMCMD_FRAME(256, 20),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862A8BC[] =
+{
+ sSpriteAnim_862A894,
+ sSpriteAnim_862A8A8
+};
+
+const struct CompressedSpriteSheet gUnknown_0862A8C4 =
+{
+ gUnknown_08DA1E78, 0x3000, 30505
+};
+
+const struct CompressedSpritePalette gUnknown_0862A8CC =
+{
+ gUnknown_08DA3370, 30505
+};
+
+const struct SpriteTemplate gUnknown_0862A8D4 =
+{
+ .tileTag = 30505,
+ .paletteTag = 30505,
+ .oam = &sOamData_862A6BC,
+ .anims = sSpriteAnimTable_862A8BC,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+static const union AnimCmd sSpriteAnim_862A8EC[] =
+{
+ ANIMCMD_FRAME(0, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862A8F4[] =
+{
+ sSpriteAnim_862A8EC
+};
+
+const struct CompressedSpriteSheet gUnknown_0862A8F8 =
+{
+ gUnknown_08DA2A5C, 0x200, 30506
+};
+
+const struct SpriteTemplate gUnknown_0862A900 =
+{
+ .tileTag = 30506,
+ .paletteTag = 30505,
+ .oam = &sOamData_862A6C4,
+ .anims = sSpriteAnimTable_862A8F4,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+static const union AnimCmd sSpriteAnim_862A918[] =
+{
+ ANIMCMD_FRAME(0, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862A920[] =
+{
+ sSpriteAnim_862A918
+};
+
+const struct CompressedSpriteSheet gUnknown_0862A924 =
+{
+ gUnknown_08DA2B28, 0x400, 30507
+};
+
+const struct SpriteTemplate gUnknown_0862A92C =
+{
+ .tileTag = 30507,
+ .paletteTag = 30505,
+ .oam = &sOamData_862A6CC,
+ .anims = sSpriteAnimTable_862A920,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+static const union AnimCmd sSpriteAnim_862A944[] =
+{
+ ANIMCMD_FRAME(0, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862A94C[] =
+{
+ ANIMCMD_FRAME(8, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862A954[] =
+{
+ ANIMCMD_FRAME(16, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862A95C[] =
+{
+ ANIMCMD_FRAME(24, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862A964[] =
+{
+ ANIMCMD_FRAME(32, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862A96C[] =
+{
+ ANIMCMD_FRAME(40, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862A974[] =
+{
+ ANIMCMD_FRAME(48, 24),
+ ANIMCMD_FRAME(64, 24),
+ ANIMCMD_FRAME(80, 24),
+ ANIMCMD_FRAME(64, 24),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd sSpriteAnim_862A988[] =
+{
+ ANIMCMD_FRAME(56, 24),
+ ANIMCMD_FRAME(72, 24),
+ ANIMCMD_FRAME(88, 24),
+ ANIMCMD_FRAME(72, 24),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd sSpriteAnim_862A99C[] =
+{
+ ANIMCMD_FRAME(96, 24),
+ ANIMCMD_FRAME(104, 24),
+ ANIMCMD_FRAME(112, 24),
+ ANIMCMD_FRAME(104, 24),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862A9B0[] =
+{
+ sSpriteAnim_862A944,
+ sSpriteAnim_862A94C,
+ sSpriteAnim_862A954,
+ sSpriteAnim_862A95C,
+ sSpriteAnim_862A964,
+ sSpriteAnim_862A96C,
+ sSpriteAnim_862A974,
+ sSpriteAnim_862A988,
+ sSpriteAnim_862A99C
+};
+
+const struct CompressedSpriteSheet gUnknown_0862A9D4 =
+{
+ gUnknown_08DA2D1C, 0xF00, 30508
+};
+
+const struct CompressedSpritePalette gUnknown_0862A9DC =
+{
+ gUnknown_08DA3398, 30508
+};
+
+const struct SpriteTemplate gUnknown_0862A9E4 =
+{
+ .tileTag = 30508,
+ .paletteTag = 30508,
+ .oam = &sOamData_862A6D4,
+ .anims = sSpriteAnimTable_862A9B0,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+static const union AnimCmd sSpriteAnim_862A9FC[] =
+{
+ ANIMCMD_FRAME(0, 24),
+ ANIMCMD_FRAME(2, 24),
+ ANIMCMD_FRAME(4, 24),
+ ANIMCMD_FRAME(2, 24),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862AA10[] =
+{
+ sSpriteAnim_862A9FC
+};
+
+const struct CompressedSpriteSheet gUnknown_0862AA14 =
+{
+ gUnknown_08DA3250, 0xC0, 30509
+};
+
+const struct SpriteTemplate gUnknown_0862AA1C =
+{
+ .tileTag = 30509,
+ .paletteTag = 30508,
+ .oam = &sOamData_862A6DC,
+ .anims = sSpriteAnimTable_862AA10,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+const struct CompressedSpriteSheet gUnknown_0862AA34 =
+{
+ gUnknown_08DA32A4, 0x200, 30510
+};
+
+const struct SpriteTemplate gUnknown_0862AA3C =
+{
+ .tileTag = 30510,
+ .paletteTag = 30508,
+ .oam = &sOamData_862A6C4,
+ .anims = sSpriteAnimTable_862A8F4,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+const struct BgTemplate gUnknown_0862AA54[] =
+{
+ {
+ .bg = 0,
+ .charBaseIndex = 2,
+ .mapBaseIndex = 31,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 0,
+ .baseTile = 0
+ },
+ {
+ .bg = 1,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 30,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 2,
+ .baseTile = 0
+ },
+ {
+ .bg = 2,
+ .charBaseIndex = 1,
+ .mapBaseIndex = 29,
+ .screenSize = 1,
+ .paletteMode = 0,
+ .priority = 1,
+ .baseTile = 0
+ }
+};
+
+static const union AnimCmd sSpriteAnim_862AA60[] =
+{
+ ANIMCMD_FRAME(0, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862AA68[] =
+{
+ sSpriteAnim_862AA60
+};
+
+static const union AffineAnimCmd sSpriteAffineAnim_862AA6C[] =
+{
+ AFFINEANIMCMD_FRAME(-64, -64, 0, 1),
+ AFFINEANIMCMD_FRAME(32, 32, 0, 14),
+ AFFINEANIMCMD_FRAME(256, 256, 0, 0),
+ AFFINEANIMCMD_JUMP(0)
+};
+
+static const union AffineAnimCmd *const sSpriteAffineAnimTable_862AA8C[] =
+{
+ sSpriteAffineAnim_862AA6C
+};
+
+const struct CompressedSpriteSheet gUnknown_0862AA90 =
+{
+ gUnknown_08DA3BC0, 0x100, 30555
+};
+
+const struct CompressedSpritePalette gUnknown_0862AA98 =
+{
+ gUnknown_08DA3C7C, 30555
+};
+
+const struct SpriteTemplate gUnknown_0862AAA0 =
+{
+ .tileTag = 30555,
+ .paletteTag = 30555,
+ .oam = &sOamData_862A6D4,
+ .anims = sSpriteAnimTable_862AA68,
+ .images = NULL,
+ .affineAnims = sSpriteAffineAnimTable_862AA8C,
+ .callback = sub_81D8260,
+};
+
+const s8 gUnknown_0862AAB8[][2] =
+{
+ {-1, 5},
+ {-3, -4},
+ {5, -3},
+ {-7, 2},
+ {-9, -1},
+ {1, -5},
+ {3, 4},
+ {-5, 3},
+ {7, -2},
+ {9, 1}
+};
+
+const struct BgTemplate gUnknown_0862AACC[] =
+{
+ {
+ .bg = 0,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 31,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 0,
+ .baseTile = 0
+ },
+ {
+ .bg = 1,
+ .charBaseIndex = 1,
+ .mapBaseIndex = 30,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 1,
+ .baseTile = 0
+ },
+ {
+ .bg = 2,
+ .charBaseIndex = 2,
+ .mapBaseIndex = 29,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 2,
+ .baseTile = 0
+ },
+ {
+ .bg = 3,
+ .charBaseIndex = 1,
+ .mapBaseIndex = 28,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 3,
+ .baseTile = 0
+ }
+};
+
+static const union AnimCmd sSpriteAnim_862AADC[] =
+{
+ ANIMCMD_FRAME(0, 32),
+ ANIMCMD_FRAME(64, 32),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862AAE8[] =
+{
+ sSpriteAnim_862AADC
+};
+
+static const union AnimCmd sSpriteAnim_862AAEC[] =
+{
+ ANIMCMD_FRAME(0, 32),
+ ANIMCMD_FRAME(8, 32),
+ ANIMCMD_JUMP(0),
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862AAF8[] =
+{
+ sSpriteAnim_862AAEC
+};
+
+const struct CompressedSpriteSheet gUnknown_0862AAFC =
+{
+ gUnknown_08DA6440, 0x1000, 30556
+};
+
+const struct CompressedSpriteSheet gUnknown_0862AB04 =
+{
+ gUnknown_08DA68AC, 0x200, 30557
+};
+
+const struct CompressedSpritePalette gUnknown_0862AB0C =
+{
+ gUnknown_08DA4DA8, 30556
+};
+
+const struct SpriteTemplate gUnknown_0862AB14 =
+{
+ .tileTag = 30556,
+ .paletteTag = 30556,
+ .oam = &sOamData_862A6BC,
+ .anims = sSpriteAnimTable_862AAE8,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+const struct SpriteTemplate gUnknown_0862AB2C =
+{
+ .tileTag = 30557,
+ .paletteTag = 30556,
+ .oam = &sOamData_862A6E4,
+ .anims = sSpriteAnimTable_862AAF8,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+const struct BgTemplate gUnknown_0862AB44[] =
+{
+ {
+ .bg = 0,
+ .charBaseIndex = 2,
+ .mapBaseIndex = 31,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 0,
+ .baseTile = 0
+ },
+ {
+ .bg = 1,
+ .charBaseIndex = 1,
+ .mapBaseIndex = 30,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 1,
+ .baseTile = 0
+ },
+ {
+ .bg = 2,
+ .charBaseIndex = 2,
+ .mapBaseIndex = 29,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 2,
+ .baseTile = 0
+ },
+ {
+ .bg = 3,
+ .charBaseIndex = 3,
+ .mapBaseIndex = 28,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 3,
+ .baseTile = 0
+ }
+};
+
+static const union AnimCmd sSpriteAnim_862AB54[] =
+{
+ ANIMCMD_FRAME(0, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862AB5C[] =
+{
+ ANIMCMD_FRAME(0, 48),
+ ANIMCMD_FRAME(64, 32),
+ ANIMCMD_FRAME(0, 48),
+ ANIMCMD_FRAME(128, 32),
+ ANIMCMD_JUMP(0)
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862AB70[] =
+{
+ sSpriteAnim_862AB54,
+ sSpriteAnim_862AB5C
+};
+
+static const union AnimCmd sSpriteAnim_862AB78[] =
+{
+ ANIMCMD_FRAME(0, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862AB80[] =
+{
+ sSpriteAnim_862AB78,
+};
+
+static const union AnimCmd sSpriteAnim_862AB84[] =
+{
+ ANIMCMD_FRAME(0, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862AB8C[] =
+{
+ ANIMCMD_FRAME(16, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862AB94[] =
+{
+ ANIMCMD_FRAME(32, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862AB9C[] =
+{
+ sSpriteAnim_862AB84,
+ sSpriteAnim_862AB8C,
+ sSpriteAnim_862AB94
+};
+
+static const union AnimCmd sSpriteAnim_862ABA8[] =
+{
+ ANIMCMD_FRAME(0, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862ABB0[] =
+{
+ ANIMCMD_FRAME(64, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862ABB8[] =
+{
+ ANIMCMD_FRAME(128, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862ABC0[] =
+{
+ ANIMCMD_FRAME(192, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862ABC8[] =
+{
+ sSpriteAnim_862ABA8,
+ sSpriteAnim_862ABB0,
+ sSpriteAnim_862ABB8,
+ sSpriteAnim_862ABC0
+};
+
+static const union AnimCmd sSpriteAnim_862ABD8[] =
+{
+ ANIMCMD_FRAME(0, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862ABE0[] =
+{
+ ANIMCMD_FRAME(16, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862ABE8[] =
+{
+ ANIMCMD_FRAME(32, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd sSpriteAnim_862ABF0[] =
+{
+ ANIMCMD_FRAME(48, 1),
+ ANIMCMD_END
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862ABF8[] =
+{
+ sSpriteAnim_862ABD8,
+ sSpriteAnim_862ABE0,
+ sSpriteAnim_862ABE8,
+ sSpriteAnim_862ABF0
+};
+
+static const union AnimCmd sSpriteAnim_862AC08[] =
+{
+ ANIMCMD_FRAME(0, 8),
+ ANIMCMD_FRAME(4, 8),
+ ANIMCMD_FRAME(8, 8),
+ ANIMCMD_FRAME(12, 8),
+ ANIMCMD_FRAME(16, 8),
+ ANIMCMD_FRAME(20, 8),
+ ANIMCMD_JUMP(0)
+};
+
+static const union AnimCmd *const sSpriteAnimTable_862AC24[] =
+{
+ sSpriteAnim_862AC08
+};
+
+const struct CompressedSpriteSheet gUnknown_0862AC28 =
+{
+ gUnknown_08DA8ED8, 0x1800, 30565
+};
+
+const struct CompressedSpriteSheet gUnknown_0862AC30 =
+{
+ gUnknown_08DA9670, 0x80, 30566
+};
+
+const struct CompressedSpriteSheet gUnknown_0862AC38 =
+{
+ gUnknown_08DA96B4, 0x600, 30568
+};
+
+const struct CompressedSpriteSheet gUnknown_0862AC40 =
+{
+ gUnknown_08DA98FC, 0x2000, 30569
+};
+
+const struct CompressedSpriteSheet gUnknown_0862AC48 =
+{
+ gUnknown_08DAA5A4, 0x800, 30570
+};
+
+const struct CompressedSpriteSheet gUnknown_0862AC50 =
+{
+ gUnknown_08DAA794, 0x300, 30571
+};
+
+const struct CompressedSpritePalette gUnknown_0862AC58 =
+{
+ gUnknown_08DAA82C, 30565
+};
+
+const struct CompressedSpritePalette gUnknown_0862AC60 =
+{
+ gUnknown_08DAA854, 30568
+};
+
+const struct CompressedSpritePalette gUnknown_0862AC68 =
+{
+ gUnknown_08DAA87C, 30569
+};
+
+const struct CompressedSpritePalette gUnknown_0862AC70 =
+{
+ gUnknown_08DAA8A4, 30571
+};
+
+const struct SpriteTemplate gUnknown_0862AC78 =
+{
+ .tileTag = 30565,
+ .paletteTag = 30565,
+ .oam = &sOamData_862A6BC,
+ .anims = sSpriteAnimTable_862AB70,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+const struct SpriteTemplate gUnknown_0862AC90 =
+{
+ .tileTag = 30566,
+ .paletteTag = 30565,
+ .oam = &sOamData_862A6EC,
+ .anims = sSpriteAnimTable_862AB80,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+const struct SpriteTemplate gUnknown_0862ACA8 =
+{
+ .tileTag = 30568,
+ .paletteTag = 30568,
+ .oam = &sOamData_862A6C4,
+ .anims = sSpriteAnimTable_862AB9C,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+const struct SpriteTemplate gUnknown_0862ACC0 =
+{
+ .tileTag = 30569,
+ .paletteTag = 30569,
+ .oam = &sOamData_862A6BC,
+ .anims = sSpriteAnimTable_862ABC8,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = sub_81D961C,
+};
+
+const struct SpriteTemplate gUnknown_0862ACD8 =
+{
+ .tileTag = 30570,
+ .paletteTag = 30569,
+ .oam = &sOamData_862A6C4,
+ .anims = sSpriteAnimTable_862ABF8,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+const struct SpriteTemplate gUnknown_0862ACF0 =
+{
+ .tileTag = 30571,
+ .paletteTag = 30571,
+ .oam = &sOamData_862A6F4,
+ .anims = sSpriteAnimTable_862AC24,
+ .images = NULL,
+ .affineAnims = gDummySpriteAffineAnimTable,
+ .callback = SpriteCallbackDummy,
+};
+
+const struct BgTemplate gUnknown_0862AD08[] =
+{
+ {
+ .bg = 0,
+ .charBaseIndex = 1,
+ .mapBaseIndex = 31,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 1,
+ .baseTile = 0
+ },
+ {
+ .bg = 1,
+ .charBaseIndex = 1,
+ .mapBaseIndex = 30,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 2,
+ .baseTile = 0
+ },
+ {
+ .bg = 2,
+ .charBaseIndex = 0,
+ .mapBaseIndex = 29,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 0,
+ .baseTile = 0
+ }
+};
+
diff --git a/src/start_menu.c b/src/start_menu.c
index f45fd8626..a820cd992 100644
--- a/src/start_menu.c
+++ b/src/start_menu.c
@@ -6,6 +6,8 @@
#include "window.h"
#include "string_util.h"
#include "text.h"
+#include "strings.h"
+#include "bg.h"
// Menu actions
enum
@@ -25,15 +27,6 @@ enum
MENU_ACTION_PYRAMID_BAG
};
-static void BuildStartMenuActions_LinkMode(void);
-static void BuildStartMenuActions_UnionRoom(void);
-static void BuildStartMenuActions_SafariZone(void);
-static void BuildStartMenuActions_BattlePike(void);
-static void BuildStartMenuActions_BattlePyramid(void);
-static void BuildStartMenuActions_MultiBattleRoom(void);
-static void BuildStartMenuActions_Normal(void);
-u8 StartMenu_PlayerName(void);
-
extern bool32 is_c1_link_related_active(void);
extern bool32 InUnionRoom(void);
extern bool8 InBattlePike(void);
@@ -42,12 +35,91 @@ extern bool8 InMultiBattleRoom(void);
extern void sub_81973FC(u8 windowId, u8 a1);
extern void sub_8198070(u8 windowId, u8 a1);
+// this file's functions
+static void BuildStartMenuActions_LinkMode(void);
+static void BuildStartMenuActions_UnionRoom(void);
+static void BuildStartMenuActions_SafariZone(void);
+static void BuildStartMenuActions_BattlePike(void);
+static void BuildStartMenuActions_BattlePyramid(void);
+static void BuildStartMenuActions_MultiBattleRoom(void);
+static void BuildStartMenuActions_Normal(void);
+bool8 StartMenu_Pokedex(void);
+bool8 StartMenu_Pokemon(void);
+bool8 StartMenu_Bag(void);
+bool8 StartMenu_PokeNav(void);
+bool8 StartMenu_PlayerName(void);
+bool8 StartMenu_Save(void);
+bool8 StartMenu_Option(void);
+bool8 StartMenu_Exit(void);
+bool8 StartMenu_SafariZoneRetire(void);
+bool8 StartMenu_LinkModePlayerName(void);
+bool8 StartMenu_BattlePyramidRetire(void);
+bool8 StartMenu_BattlePyramidBag(void);
+
+// EWRAM vars
EWRAM_DATA u8 sSafariBallsWindowId = 0;
EWRAM_DATA u8 sBattlePyramidFloorWindowId = 0;
EWRAM_DATA u8 sStartMenuCursorPos = 0;
EWRAM_DATA u8 sNumStartMenuActions = 0;
EWRAM_DATA u8 sCurrentStartMenuActions[9] = {0};
+// const rom data
+static const struct WindowTemplate gSafariBallsWindowTemplate = {0, 1, 1, 9, 4, 0xF, 8};
+
+static const u8* const sPyramindFloorNames[] =
+{
+ gText_Floor1,
+ gText_Floor2,
+ gText_Floor3,
+ gText_Floor4,
+ gText_Floor5,
+ gText_Floor6,
+ gText_Floor7,
+ gText_Peak
+};
+
+static const struct WindowTemplate gPyramidFloorWindowTemplate_2 = {0, 1, 1, 0xA, 4, 0xF, 8};
+static const struct WindowTemplate gPyramidFloorWindowTemplate_1 = {0, 1, 1, 0xC, 4, 0xF, 8};
+
+const struct MenuAction sStartMenuItems[] =
+{
+ {gText_MenuPokedex, {.u8_void = StartMenu_Pokedex}},
+ {gText_MenuPokemon, {.u8_void = StartMenu_Pokemon}},
+ {gText_MenuBag, {.u8_void = StartMenu_Bag}},
+ {gText_MenuPokenav, {.u8_void = StartMenu_PokeNav}},
+ {gText_MenuPlayer, {.u8_void = StartMenu_PlayerName}},
+ {gText_MenuSave, {.u8_void = StartMenu_Save}},
+ {gText_MenuOption, {.u8_void = StartMenu_Option}},
+ {gText_MenuExit, {.u8_void = StartMenu_Exit}},
+ {gText_MenuRetire, {.u8_void = StartMenu_SafariZoneRetire}},
+ {gText_MenuPlayer, {.u8_void = StartMenu_LinkModePlayerName}},
+ {gText_MenuRest, {.u8_void = StartMenu_Save}},
+ {gText_MenuRetire, {.u8_void = StartMenu_BattlePyramidRetire}},
+ {gText_MenuBag, {.u8_void = StartMenu_BattlePyramidBag}}
+};
+
+const struct BgTemplate gUnknown_085105A8[] =
+{
+ {
+ .bg = 0,
+ .charBaseIndex = 2,
+ .mapBaseIndex = 31,
+ .screenSize = 0,
+ .paletteMode = 0,
+ .priority = 0,
+ .baseTile = 0
+ }
+};
+
+const struct WindowTemplate gUnknown_085105AC[] =
+{
+ {0, 2, 0xF, 0x1A, 4, 0xF, 0x194},
+ DUMMY_WIN_TEMPLATE
+};
+
+const struct WindowTemplate gUnknown_085105BC = {0, 1, 1, 0xE, 0xA, 0xF, 8};
+
+// code
void BuildStartMenuActions(void)
{
sNumStartMenuActions = 0;
@@ -148,11 +220,6 @@ static void BuildStartMenuActions_MultiBattleRoom(void)
AddStartMenuAction(MENU_ACTION_EXIT);
}
-extern const struct WindowTemplate gSafariBallsWindowTemplate;
-extern const struct WindowTemplate gPyramidFloorWindowTemplate_1;
-extern const struct WindowTemplate gPyramidFloorWindowTemplate_2;
-extern const u8 gText_SafariBallStock[];
-
void DisplaySafariBallsWindow(void)
{
sSafariBallsWindowId = AddWindow(&gSafariBallsWindowTemplate);
@@ -164,9 +231,6 @@ void DisplaySafariBallsWindow(void)
CopyWindowToVram(sSafariBallsWindowId, 2);
}
-extern const u8* const gUnknown_08510510[];
-extern const u8 gText_BattlePyramidFloor[];
-
void DisplayPyramidFloorWindow(void)
{
// TODO: fix location
@@ -176,7 +240,7 @@ void DisplayPyramidFloorWindow(void)
sBattlePyramidFloorWindowId = AddWindow(&gPyramidFloorWindowTemplate_2);
PutWindowTilemap(sBattlePyramidFloorWindowId);
sub_81973FC(sBattlePyramidFloorWindowId, 0);
- StringCopy(gStringVar1, gUnknown_08510510[gSaveBlock2Ptr->field_CAA[4]]);
+ StringCopy(gStringVar1, sPyramindFloorNames[gSaveBlock2Ptr->field_CAA[4]]);
StringExpandPlaceholders(gStringVar4, gText_BattlePyramidFloor);
PrintTextOnWindow(sBattlePyramidFloorWindowId, 1, gStringVar4, 0, 1, 0xFF, NULL);
CopyWindowToVram(sBattlePyramidFloorWindowId, 2);
@@ -197,8 +261,6 @@ void RemoveExtraStartMenuWindows(void)
}
}
-extern const struct MenuAction sStartMenuItems[];
-
/*
// Prints n menu items starting at *index
static bool32 PrintStartMenuItemsMultistep(s16 *index, u32 n)