Document two fields in PlayerState

This commit is contained in:
Tal Hayon 2022-07-22 10:22:03 +03:00
parent 0123ca26bd
commit dbe2cd55b2
3 changed files with 15 additions and 14 deletions

View File

@ -154,7 +154,7 @@ enum PlayerItemId {
PL_ITEM_CELL_OVERWRITE_SET2,
};
enum SurfaceType {
typedef enum {
SURFACE_NORMAL,
SURFACE_PIT,
SURFACE_2,
@ -200,7 +200,7 @@ enum SurfaceType {
SURFACE_AUTO_LADDER,
SURFACE_CLIMB_WALL,
SURFACE_2C,
};
} SurfaceType;
typedef enum {
SKILL_NONE = 0,
@ -255,7 +255,8 @@ typedef struct {
/*0x1d*/ u8 gustJarSpeed;
/*0x1e*/ u8 dash_state;
/*0x1f*/ u8 field_0x1f[3];
/*0x22*/ u16 field_0x22[2];
/*0x22*/ u16 tilePosition;
/*0x24*/ u16 tileType;
/*0x26*/ u8 swim_state;
/*0x27*/ u8 field_0x27[5];
/*0x2c*/ Entity* item;
@ -376,7 +377,7 @@ void sub_08077728(u32);
void PutAwayItems(void);
void sub_08079E58(s32 speed, u32 direction);
void RespawnPlayer(void);
u32 GetSurfaceCalcType(Entity*, s32, s32);
SurfaceType GetSurfaceCalcType(Entity*, s32, s32);
void UpdatePlayerMovement(void);
void EnablePlayerDraw(Entity*);
void sub_080797EC(void);

View File

@ -3705,7 +3705,7 @@ void SurfaceAction_20(Entity* this) {
if (e != NULL) {
e->timer = 1;
UpdateSpriteForCollisionLayer(e);
CloneTile(57, gPlayerState.field_0x22[0], this->collisionLayer);
CloneTile(57, gPlayerState.tilePosition, this->collisionLayer);
}
}
SurfaceAction_Water(this);

View File

@ -56,7 +56,7 @@ void* sub_08077C54(ItemBehavior*);
u32 sub_08079FD4(Entity*, u32);
void LoadRoomGfx(void);
u32 sub_0807A094(u32);
u32 GetSurfaceCalcType(Entity*, s32, s32);
SurfaceType GetSurfaceCalcType(Entity*, s32, s32);
void sub_0807AAF8(Entity*, u32);
extern struct_0811BE48 gUnk_0811BE48[];
@ -243,7 +243,7 @@ bool32 sub_080777A0(void) {
return FALSE;
default:
if ((((gUnk_0200AF00.unk_2c == 0xc) && (gPlayerState.field_0x1c == 0)) &&
(gPlayerState.floor_type != 0x11)) &&
(gPlayerState.floor_type != SURFACE_SWAMP)) &&
((((gPlayerState.field_0x90 & 0xf00) != 0 &&
((gPlayerState.flags & (PL_BURNING | PL_ROLLING)) == 0)) &&
((gPlayerState.jump_status == 0 && (gPlayerState.field_0x3[1] == 0)))))) {
@ -1192,8 +1192,8 @@ void ClearPlayerState(void) {
gPlayerState.field_0x1f[0] = 0;
gPlayerState.field_0x1f[1] = 0;
gPlayerState.field_0x1f[2] = 0;
gPlayerState.field_0x22[0] = 0;
gPlayerState.field_0x22[1] = 0;
gPlayerState.tilePosition = 0;
gPlayerState.tileType = 0;
gPlayerState.swim_state = 0;
gPlayerState.item = NULL;
gPlayerState.speed_modifier = 0;
@ -1863,15 +1863,15 @@ void UpdateFloorType(void) {
gUnk_0811C120[gPlayerState.floor_type](&gPlayerEntity);
}
u32 GetSurfaceCalcType(Entity* param_1, s32 x, s32 y) {
SurfaceType GetSurfaceCalcType(Entity* param_1, s32 x, s32 y) {
u32 position = TILE(param_1->x.HALF.HI + (u32)x, param_1->y.HALF.HI + y);
u32 tileType = GetTileTypeByPos(param_1->x.HALF.HI + x, param_1->y.HALF.HI + y, gPlayerEntity.collisionLayer);
if (tileType != gPlayerState.field_0x22[1]) {
if (tileType != gPlayerState.tileType) {
gPlayerState.field_0x37 = 0;
}
if ((tileType != gPlayerState.field_0x22[1]) || (position != gPlayerState.field_0x22[0])) {
gPlayerState.field_0x22[0] = position;
gPlayerState.field_0x22[1] = tileType;
if ((tileType != gPlayerState.tileType) || (position != gPlayerState.tilePosition)) {
gPlayerState.tilePosition = position;
gPlayerState.tileType = tileType;
gPlayerState.field_0x11 = 0;
}