summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDizzyEggg <jajkodizzy@wp.pl>2017-12-24 11:15:00 +0100
committerDizzyEggg <jajkodizzy@wp.pl>2017-12-24 11:15:00 +0100
commit43f23b8a78a0111c88d671942a012d8d4b28596c (patch)
tree743beb78116eb7f6558e8a6c906873e584cbf8b2 /include
parent3a3772c74ff76a258ffa4b6515fa07d5c96a2979 (diff)
parentf209cbd7a0519b49fcf3f1b7a3fca27d6dcaacd8 (diff)
Merge branch 'master' into dump_pointers
Diffstat (limited to 'include')
-rw-r--r--include/bike.h78
-rw-r--r--include/field_player_avatar.h21
-rw-r--r--include/global.fieldmap.h45
3 files changed, 130 insertions, 14 deletions
diff --git a/include/bike.h b/include/bike.h
new file mode 100644
index 000000000..e625ad438
--- /dev/null
+++ b/include/bike.h
@@ -0,0 +1,78 @@
+#ifndef GUARD_BIKE_H
+#define GUARD_BIKE_H
+
+// the struct below is used for checking button combinations of the last input so that the acro can potentially perform a side/turn jump.
+// its possible that at some point Game Freak intended for the acro bike to have more complex tricks: but only the acro jump combinations can be seen in the final ROM.
+struct BikeHistoryInputInfo
+{
+ u32 dirHistoryMatch; // the direction you need to press
+ u32 abStartSelectHistoryMatch; // the button you need to press
+ u32 dirHistoryMask; // mask applied so that way only the recent nybble (the recent input) is checked
+ u32 abStartSelectHistoryMask; // mask applied so that way only the recent nybble (the recent input) is checked
+ const u8 *dirTimerHistoryList; // list of timers to check for direction before the button+dir combination can be verified.
+ const u8 *abStartSelectHistoryList; // list of timers to check for buttons before the button+dir combination can be verified.
+ u32 direction; // direction to jump
+};
+
+// Player speeds
+enum
+{
+ SPEED_STANDING,
+ SPEED_NORMAL,
+ SPEED_FAST,
+ SPEED_FASTER,
+ SPEED_FASTEST,
+};
+
+// mach bike transitions enum
+enum
+{
+ MACH_TRANS_FACE_DIRECTION,
+ MACH_TRANS_TURN_DIRECTION,
+ MACH_TRANS_KEEP_MOVING,
+ MACH_TRANS_START_MOVING
+};
+
+// Acro bike states
+enum
+{
+ ACRO_STATE_NORMAL,
+ ACRO_STATE_TURNING,
+ ACRO_STATE_WHEELIE_STANDING,
+ ACRO_STATE_BUNNY_HOP,
+ ACRO_STATE_WHEELIE_MOVING,
+ ACRO_STATE_SIDE_JUMP,
+ ACRO_STATE_TURN_JUMP,
+};
+
+// Acro bike transitions
+enum
+{
+ ACRO_TRANS_FACE_DIRECTION,
+ ACRO_TRANS_TURN_DIRECTION,
+ ACRO_TRANS_MOVING,
+ ACRO_TRANS_NORMAL_TO_WHEELIE,
+ ACRO_TRANS_WHEELIE_TO_NORMAL,
+ ACRO_TRANS_WHEELIE_IDLE,
+ ACRO_TRANS_WHEELIE_HOPPING_STANDING,
+ ACRO_TRANS_WHEELIE_HOPPING_MOVING,
+ ACRO_TRANS_SIDE_JUMP,
+ ACRO_TRANS_TURN_JUMP,
+ ACRO_TRANS_WHEELIE_MOVING,
+ ACRO_TRANS_WHEELIE_RISING_MOVING,
+ ACRO_TRANS_WHEELIE_LOWERING_MOVING,
+};
+
+void MovePlayerOnBike(u8 direction, u16 newKeys, u16 heldKeys);
+void Bike_TryAcroBikeHistoryUpdate(u16 newKeys, u16 heldKeys);
+bool8 RS_IsRunningDisallowed(u8 tile);
+bool8 IsBikingDisallowedByPlayer(void);
+bool8 player_should_look_direction_be_enforced_upon_movement(void);
+void GetOnOffBike(u8 transitionFlags);
+void BikeClearState(int newDirHistory, int newAbStartHistory);
+void Bike_UpdateBikeCounterSpeed(u8 counter);
+s16 GetPlayerSpeed(void);
+void Bike_HandleBumpySlopeJump(void);
+bool32 IsRunningDisallowed(u8 metatile);
+
+#endif // GUARD_BIKE_H
diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h
index a3c40bc42..cc4c65448 100644
--- a/include/field_player_avatar.h
+++ b/include/field_player_avatar.h
@@ -9,6 +9,27 @@ void PlayerGetDestCoords(s16 *, s16 *);
u8 player_get_direction_lower_nybble(void);
u8 player_get_direction_upper_nybble(void);
u8 player_get_x22(void);
+void PlayerGoSpeed1(u8);
+void PlayerGoSpeed2(u8);
+void PlayerGoSpeed3(u8);
+void PlayerGoSpeed4(u8);
+void PlayerOnBikeCollide(u8);
+void PlayerFaceDirection(u8 a);
+void PlayerTurnInPlace(u8 a);
+void PlayerJumpLedge(u8 a);
+void PlayerIdleWheelie(u8 a);
+void PlayerStartWheelie(u8 a);
+void PlayerEndWheelie(u8 a);
+void PlayerStandingHoppingWheelie(u8 a);
+void PlayerMovingHoppingWheelie(u8 a);
+void PlayerLedgeHoppingWheelie(u8 a);
+void PlayerAcroTurnJump(u8 a);
+void PlayerSetAnimId(u8 a, u8 b);
+bool8 IsPlayerCollidingWithFarawayIslandMew(u8 direction);
+void PlayerOnBikeCollideWithFarawayIslandMew(u8 direction);
+u8 CheckForFieldObjectCollision(struct MapObject *a, s16 b, s16 c, u8 d, u8 e);
+u8 PlayerGetZCoord(void);
+void SetPlayerAvatarTransitionFlags(u16 a);
void sub_808BCE8(void);
void sub_808D074(u8);
diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h
index 3e9f13523..b12febefd 100644
--- a/include/global.fieldmap.h
+++ b/include/global.fieldmap.h
@@ -299,25 +299,42 @@ enum
COLLISION_LEDGE_JUMP = 6
};
-struct PlayerAvatar /* 0x202E858 */
+// player running states
+enum
+{
+ NOT_MOVING,
+ TURN_DIRECTION, // not the same as turning! turns your avatar without moving. also known as a turn frame in some circles
+ MOVING,
+};
+
+// player tile transition states
+enum
+{
+ T_NOT_MOVING,
+ T_TILE_TRANSITION,
+ T_TILE_CENTER, // player is on a frame in which they are centered on a tile during which the player either stops or keeps their momentum and keeps going, changing direction if necessary.
+};
+
+struct PlayerAvatar
{
/*0x00*/ u8 flags;
- /*0x01*/ u8 bike;
- /*0x02*/ u8 running2;
- /*0x03*/ u8 running1;
+ /*0x01*/ u8 unk1; // used to be named bike, but its definitely not that. seems to be some transition flags
+ /*0x02*/ u8 runningState; // this is a static running state. 00 is not moving, 01 is turn direction, 02 is moving.
+ /*0x03*/ u8 tileTransitionState; // this is a transition running state: 00 is not moving, 01 is transition between tiles, 02 means you are on the frame in which you have centered on a tile but are about to keep moving, even if changing directions. 2 is also used for a ledge hop, since you are transitioning.
/*0x04*/ u8 spriteId;
/*0x05*/ u8 mapObjectId;
- /*0x06*/ u8 unk6;
+ /*0x06*/ bool8 preventStep;
/*0x07*/ u8 gender;
- u8 acroBikeState;
- u8 unk9;
- u8 bikeFrameCounter;
- u8 unkB;
- u32 unkC;
- u32 unk10;
- u8 unk14[8];
- u8 unk1C[8];
- // TODO: rest of struct
+ /*0x08*/ u8 acroBikeState; // 00 is normal, 01 is turning, 02 is standing wheelie, 03 is hopping wheelie
+ /*0x09*/ u8 newDirBackup; // during bike movement, the new direction as opposed to player's direction is backed up here.
+ /*0x0A*/ u8 bikeFrameCounter; // on the mach bike, when this value is 1, the bike is moving but not accelerating yet for 1 tile. on the acro bike, this acts as a timer for acro bike.
+ /*0x0B*/ u8 bikeSpeed;
+ // acro bike only
+ /*0x0C*/ u32 directionHistory; // up/down/left/right history is stored in each nybble, but using the field directions and not the io inputs.
+ /*0x10*/ u32 abStartSelectHistory; // same as above but for A + B + start + select only
+ // these two are timer history arrays which [0] is the active timer for acro bike. every element is backed up to the next element upon update.
+ /*0x14*/ u8 dirTimerHistory[8];
+ /*0x1C*/ u8 abStartSelectTimerHistory[8];
};
struct Camera