diff options
author | ProjectRevoTPP <projectrevotpp@hotmail.com> | 2017-01-29 20:59:54 -0500 |
---|---|---|
committer | YamaArashi <YamaArashi@users.noreply.github.com> | 2017-01-29 17:59:54 -0800 |
commit | b6b5453431af46791fd9d211efac64464c1dff85 (patch) | |
tree | 44148fc13d5f707e426016ac33b8c34f4b6df948 /src/bike.c | |
parent | 047c35d6f1ff8888cd25d449d544ce898e0b9fec (diff) |
start decompiling mauville_old_man.c (#225)
* some labels and enumerate player speeds
* clear up speed enums
* GetPlayerSpeed
* oops
* start decompiling mauville_old_man.c
* formatting
* decompile more of mauville_old_man.c
* someone fix this please
* formatting
* make ROM build again
* formatting again
Diffstat (limited to 'src/bike.c')
-rw-r--r-- | src/bike.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/bike.c b/src/bike.c index bd4c2e411..a1a3fded9 100644 --- a/src/bike.c +++ b/src/bike.c @@ -84,6 +84,16 @@ static void (*const gUnknown_083DB5A4[])(u8) = sub_80593F4, }; +// Player speeds +enum +{ + SPEED_STANDING, + SPEED_NORMAL, + SPEED_FAST, + SPEED_FASTER, + SPEED_FASTEST, +}; + //Acro bike states enum { @@ -132,7 +142,7 @@ static u8 (*const sAcroBikeInputHandlers[])(u8 *, u16, u16) = AcroBikeHandleInputState6, }; -const u16 gUnknown_083DB600[] = {1, 2, 4}; +const u16 gMachBikeSpeeds[] = {SPEED_NORMAL, SPEED_FAST, SPEED_FASTEST}; static const u8 Unknown_3DB606[] = {4, 0}; static const struct UnknownStruct1 gUnknown_083DB608[] = @@ -243,7 +253,7 @@ static void MachBikeTransition_80E51C4(u8 direction) { gUnknown_083DB5A4[gPlayerAvatar.bikeFrameCounter](direction); gPlayerAvatar.unkB = gPlayerAvatar.bikeFrameCounter + (gPlayerAvatar.bikeFrameCounter >> 1); // same as dividing by 2, but compiler is insistent on >> 1 - if (gPlayerAvatar.bikeFrameCounter < 2) + if (gPlayerAvatar.bikeFrameCounter < 2) // do not go faster than the last element in the mach bike array gPlayerAvatar.bikeFrameCounter++; } } @@ -882,7 +892,7 @@ static u8 sub_80E5DA0(struct MapObject *mapObject, s16 x, s16 y, u8 direction, u return collision; } -bool8 sub_80E5DEC(u8 tile) +bool8 IsRunningDisallowed(u8 tile) { if (IsRunningDisallowedByMetatile(tile) != FALSE || gMapHeader.mapType == MAP_TYPE_INDOOR) return TRUE; @@ -975,8 +985,8 @@ void GetOnOffBike(u8 var) else { SetPlayerAvatarTransitionFlags(var); - sav1_set_battle_music_maybe(0x193); - sub_8053FB0(0x193); + sav1_set_battle_music_maybe(BGM_CYCLING); + sub_8053FB0(BGM_CYCLING); } } @@ -1010,20 +1020,21 @@ static void sub_80E6024(void) gPlayerAvatar.unkB = 0; } -s16 sub_80E6034(void) +s16 GetPlayerSpeed(void) { - s16 arr[3]; + // 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(arr, gUnknown_083DB600, sizeof(arr)); + memcpy(machSpeeds, gMachBikeSpeeds, sizeof(machSpeeds)); if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MACH_BIKE) - return arr[gPlayerAvatar.bikeFrameCounter]; + return machSpeeds[gPlayerAvatar.bikeFrameCounter]; else if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ACRO_BIKE) - return 3; + return SPEED_FASTER; else if (gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_DASH)) - return 2; + return SPEED_FAST; else - return 1; + return SPEED_NORMAL; } void sub_80E6084(void) |