diff options
-rw-r--r-- | include/flags.h | 2 | ||||
-rw-r--r-- | include/global.fieldmap.h | 16 | ||||
-rw-r--r-- | src/field_player_avatar.c | 23 |
3 files changed, 22 insertions, 19 deletions
diff --git a/include/flags.h b/include/flags.h index e2b14b16b..a6b672d15 100644 --- a/include/flags.h +++ b/include/flags.h @@ -34,6 +34,8 @@ #define SYS_ENC_UP_ITEM 0x84D #define SYS_ENC_DOWN_ITEM 0x84E +#define SYS_B_DASH 0x860 // got Running Shoes + // SPECIAL FLAGS (unknown purpose) #define SPECIAL_FLAG_1 0x4001 diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 20f28b02f..68a4f9322 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -262,14 +262,14 @@ struct MapObjectGraphicsInfo union AffineAnimCmd **affineAnims; }; -#define PLAYER_AVATAR_FLAG_0 (1 << 0) -#define PLAYER_AVATAR_FLAG_1 (1 << 1) -#define PLAYER_AVATAR_FLAG_2 (1 << 2) -#define PLAYER_AVATAR_FLAG_3 (1 << 3) -#define PLAYER_AVATAR_FLAG_4 (1 << 4) -#define PLAYER_AVATAR_FLAG_5 (1 << 5) -#define PLAYER_AVATAR_FLAG_6 (1 << 6) -#define PLAYER_AVATAR_FLAG_7 (1 << 7) +#define PLAYER_AVATAR_FLAG_ON_FOOT (1 << 0) +#define PLAYER_AVATAR_FLAG_MACH_BIKE (1 << 1) +#define PLAYER_AVATAR_FLAG_ACRO_BIKE (1 << 2) +#define PLAYER_AVATAR_FLAG_SURFING (1 << 3) +#define PLAYER_AVATAR_FLAG_4 (1 << 4) +#define PLAYER_AVATAR_FLAG_5 (1 << 5) +#define PLAYER_AVATAR_FLAG_6 (1 << 6) +#define PLAYER_AVATAR_FLAG_DASH (1 << 7) struct PlayerAvatar { diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index a6b53b7a6..f63305b47 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -134,12 +134,13 @@ static void npc_clear_strange_bits(struct MapObject *a) a->mapobj_bit_12 = 0; a->mapobj_bit_10 = 0; a->mapobj_bit_9 = 0; - gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_7; + gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_DASH; } static void MovePlayerAvatarUsingKeypadInput(u8 a, u16 b, u16 c) { - if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_1) || (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_2)) + if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MACH_BIKE) + || (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ACRO_BIKE)) MovePlayerOnBike(a, b, c); else MovePlayerNotOnBike(a, c); @@ -375,16 +376,16 @@ void sub_8058D0C(u8 a, u16 b) PlayerNotOnBikeCollide(a); return; case 0: - if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_3) + if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) { sub_80593C4(a); return; } - if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_4) && (b & 2) && FlagGet(0x860) + if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_4) && (b & 2) && FlagGet(SYS_B_DASH) && sub_80E5DEC(gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1E) == 0) { sub_805940C(a); - gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_7; + gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_DASH; } else { @@ -430,7 +431,7 @@ u8 CheckForFieldObjectCollision(struct MapObject *a, s16 b, s16 c, u8 d, u8 e) static u8 sub_8058EF0(s16 a, s16 b, u8 c) { - if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_3) + if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) && MapGridGetZCoordAt(a, b) == 3 && GetFieldObjectIdByXYZ(a, b, 3) == 16) { @@ -1259,8 +1260,8 @@ void sub_805A20C(u8 a) ScriptContext2_Enable(); sav1_reset_battle_music_maybe(); sub_8053F84(); - gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_3; - gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_0; + gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_SURFING; + gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_ON_FOOT; gPlayerAvatar.unk6 = 1; taskId = CreateTask(taskFF_0805D1D4, 0xFF); gTasks[taskId].data[0] = a; @@ -1483,7 +1484,7 @@ u8 Fishing11(struct Task *task) sub_805B980(playerMapObj, task->data[14]); FieldObjectTurn(playerMapObj, playerMapObj->placeholder18); - if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_3) + if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) sub_8127F28(gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1A, 0, 0); gSprites[gPlayerAvatar.spriteId].pos2.x = 0; gSprites[gPlayerAvatar.spriteId].pos2.y = 0; @@ -1541,7 +1542,7 @@ u8 Fishing15(struct Task *task) sub_805B980(playerMapObj, task->data[14]); FieldObjectTurn(playerMapObj, playerMapObj->placeholder18); - if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_3) + if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) sub_8127F28(gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1A, 0, 0); gSprites[gPlayerAvatar.spriteId].pos2.x = 0; gSprites[gPlayerAvatar.spriteId].pos2.y = 0; @@ -1595,6 +1596,6 @@ static void sub_805A954(void) playerSprite->pos2.y = -8; if (animType == 10 || animType == 11) playerSprite->pos2.y = 8; - if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_3) + if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) sub_8127F28(gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1A, 1, playerSprite->pos2.y); } |