Extract KeyValuePairs

This commit is contained in:
octorock
2023-06-17 00:10:00 +02:00
parent 551cb72093
commit c317fe3f18
82 changed files with 812 additions and 760 deletions
+50 -30
View File
@@ -9,7 +9,9 @@ extern void CloneTile(u32, u32, u32);
extern u32 GetTileTypeByEntity(struct Entity_*);
extern u32 GetTileTypeByPos(s32 x, s32 y, u32 layer);
extern u32 GetTileType(u32 position, u32 layer);
extern void SetTile(u32 index, u32 position, u32 layer);
extern void SetTile(u32 metaTile, u32 metaTilePos, u32 layer);
extern void UpdateScrollVram(void);
extern u32 sub_080B1BA4(u32, u32, u32);
extern void LoadResourceAsync(const void* src, u32 dest, u32 size);
@@ -33,43 +35,61 @@ extern u32 sub_080086B4(u32, u32, const u8*);
extern u32 ResolveCollisionLayer(struct Entity_*);
extern void sub_0800417E(struct Entity_*, u32);
extern u32 sub_0800442E(struct Entity_*);
extern u32 sub_08007DD6(u32, const u16*);
extern void SoundReqClipped(struct Entity_*, u32);
extern u32 sub_0800132C(struct Entity_*, struct Entity_*);
extern u32 sub_080B1A48(u32, u32, u32);
extern u32 sub_0800445C(struct Entity_*);
extern bool32 sub_080B1B54(u32);
extern u32 CheckRectOnScreen(s32, s32, u32, u32);
extern u32 GetVvvRelativeToEntity(struct Entity_* entity, s32 xOffset, s32 yOffset);
extern u32 GetVvvAtEntity(struct Entity_* entity);
extern u32 GetVvvAtWorldCoords(u32 worldX, u32 worldY, u32 layer);
extern u32 GetVvvAtRoomCoords(u32 roomX, u32 roomY, u32 layer);
extern u32 GetVvvAtRoomTile(u32 roomTileX, u32 roomTileY, u32 layer);
extern u32 GetVvvAtMetaTilePos(u16 metaTilePos, u8 layer);
/**
* Sets vvv for a metaTilePos.
*/
extern void SetVvvAtMetaTilePos(u32 vvv, u32 metaTilePos, u32 layer);
// Get CollisionData for entity (relative to entity?)
extern u32 GetCollisionDataRelativeTo(struct Entity_* entity, s32 xOffset, s32 yOffset);
extern u32 GetCollisionDataAtEntity(struct Entity_* entity);
/**
* Returns the collision data for one metatile. (x, y in pixels relative to the world)
*/
extern u32 GetCollisionDataAtWorldCoords(u32 worldX, u32 worldY, u32 layer);
/**
* Returns the collision data for one metatile. (x, y in pixels relative to the room)
*/
extern u32 GetCollisionDataAtRoomCoords(u32 roomX, u32 roomY, u32 layer);
/**
* Returns the collision data for one metatile. (x, y in metatiles relative to the room)
*/
extern u32 GetCollisionDataAtRoomTile(u32 roomTileX, u32 roomTileY, u32 layer);
/**
* Returns the collision data for one metatile.
*/
extern u32 GetCollisionDataAtMetaTilePos(u32 metaTilePos, u32 layer);
/**
* Sets the collision data for one metatile.
*/
extern void SetCollisionData(u32 collisionData, u32 metaTilePos, u32 layer);
/**
* Returns the collision data for one metatile.
*/
extern u32 GetCollisionData(u32 metaTilePos, u32 layer);
/**
* Returns the collision data for one metatile. (x, y in metatiles relative to the room)
*/
extern u32 sub_080B1B3C(u32 x, u32 y, u32 layer);
/**
* Returns the collision data for one metatile. (x, y in pixels relative to the room)
*/
extern u32 sub_080B1B2C(u32 x, u32 y, u32 layer);
/**
* Returns the collision data for one metatile. (x, y in pixels relative to the world)
*/
extern u32 sub_080B1B18(u32 x, u32 y, u32 layer);
extern u32 sub_080B1B0C(struct Entity_* entity);
typedef struct {
u16 key;
u16 value;
} KeyValuePair ALIGNED(2);
// Get CollisionData for entity (relative to entity?)
extern u32 sub_080B1AF0(struct Entity_*, s32 xOffset, s32 yOffset);
extern u32 sub_080B1A48(u32, u32, u32);
extern u32 sub_080B1AE0(u16, u8);
extern u32 GetTileUnderEntity(struct Entity_*);
extern u32 sub_0800445C(struct Entity_*);
extern u32 sub_080B1AF0(struct Entity_*, s32, s32);
extern u32 GetRelativeCollisionTile(struct Entity_*, u32, u32);
extern bool32 sub_080B1B54(u32);
extern u32 CheckRectOnScreen(s32, s32, u32, u32);
/**
* Searches for a KeyValuePair with the key in the keyValuePairList and returns its value.
* Returns 0 if the key is not found.
*/
extern u32 FindValueForKey(u32 key, const KeyValuePair* keyValuePairList);
#endif // ASM_H
+1 -1
View File
@@ -39,6 +39,6 @@ void CalculateEntityTileCollisions(Entity*, u32, u32);
bool32 ProcessMovementInternal(Entity*, s32, s32, u32);
u32 sub_080176E4(Entity*);
extern const u8 gUnk_080B37A0[]; // unkData3 for tileType?
extern const u8 gUnk_080B37A0[]; // vvv for tileType?
#endif // COLLISION_H
-1
View File
@@ -49,7 +49,6 @@ extern void SetBGDefaults(void);
// Unidentified
extern u32 sub_080B1A0C(Entity*, s32, s32);
extern u32 sub_080B1AE0(u16, u8);
extern s32 sub_080012DC(Entity*);
extern void sub_08001318(Entity*);
extern void sub_080027EA(Entity*, u32, u32);
+9 -2
View File
@@ -19,12 +19,19 @@ typedef struct {
/*0x7004*/ u16 metatiles[0x800 * 4];
/**< Mapping from a metatile to the four tile_attrs it consists of.*/ // gMetatilesTop, gMetatilesBottom
/*0xb004*/ u8 unkData3[0x40*0x40]; /**< Some sort of special behavior for tiles? Falling into holes or jumping off walls does not work when this is all zero.*/ // gUnk_02016654, gUnk_02030EB4
/*
Temporarily call this vvv
VVV
vvv
Vvv
*/
/*0xb004*/ u8 vvv[0x40*0x40]; /**< Some sort of special behavior for tiles? Falling into holes or jumping off walls does not work when this is all zero.*/ // gUnk_02016654, gUnk_02030EB4
// TODO check with debugger what accesses this
// 0x637
// 0x2030eb4 + 0x637
// 0x20314eb
// e.g. sub_080B1AE0 accesses this
// e.g. GetVvvAtMetaTilePos accesses this
// TODO check whether this also affects sound played when walking?
/*
0x10: water
+15 -14
View File
@@ -158,8 +158,8 @@ enum PlayerItemId {
typedef enum {
SURFACE_NORMAL,
SURFACE_PIT,
SURFACE_2,
SURFACE_3,
SURFACE_2, // nulled
SURFACE_3, // nulled
SURFACE_SLOPE_GNDGND_V,
SURFACE_SLOPE_GNDGND_H,
SURFACE_6,
@@ -169,10 +169,10 @@ typedef enum {
SURFACE_A,
SURFACE_B,
SURFACE_SLOPE_GNDWATER,
SURFACE_D,
SURFACE_E,
SURFACE_F,
SURFACE_10,
SURFACE_D, // SurfaceAction_ConveyerNorth
SURFACE_E, // SurfaceAction_ConveyerSouth
SURFACE_F, // SurfaceAction_ConveyerWest
SURFACE_10, // SurfaceAction_ConveyerEast
SURFACE_SWAMP,
SURFACE_DOOR,
SURFACE_DOOR_13,
@@ -189,18 +189,19 @@ typedef enum {
SURFACE_LADDER,
SURFACE_1F, // nulled
SURFACE_20,
SURFACE_21,
SURFACE_21, // reuses SurfaceAction_16
SURFACE_22,
SURFACE_EDGE,
SURFACE_24,
SURFACE_EDGE, // reuses SurfaceAction_6
SURFACE_24, // reuses SurfaceAction_6
SURFACE_DUST,
SURFACE_26,
SURFACE_HOLE,
SURFACE_LIGHT_GRADE,
SURFACE_29,
SURFACE_LIGHT_GRADE, // reuses SurfaceAction_SlopeGndGndVertical
SURFACE_29, // reuses SurfaceAction_SlopeGndGndHorizontal
SURFACE_AUTO_LADDER,
SURFACE_CLIMB_WALL,
SURFACE_2C,
SURFACE_2D // reuses SurfaceAction_Dust
} SurfaceType;
typedef enum {
@@ -292,8 +293,8 @@ typedef struct {
/*0x0f*/ u8 hurtBlinkSpeed;
/*0x10*/ u8 field_0x10;
/*0x11*/ u8 surfacePositionSameTimer;
/*0x12*/ u8 floor_type;
/*0x13*/ u8 floor_type_last;
/*0x12*/ u8 floor_type; /**< @see SurfaceType */
/*0x13*/ u8 floor_type_last; /**< @see SurfaceType */
/*0x14*/ u8 field_0x14;
/*0x15*/ u8 field_0x15;
/*0x16*/ u16 startPosX;
@@ -483,7 +484,7 @@ u32 sub_08079B24(void);
void sub_08079708(Entity*);
void sub_08079744(Entity*);
void PlayerUpdateSwimming(Entity*);
u32 GetCollisionTileInFront(Entity*);
u32 GetVvvInFront(Entity* player);
u32 sub_080797C4(void);
void CheckPlayerVelocity(void);
void sub_0807B068(Entity*);
+3 -2
View File
@@ -34,7 +34,8 @@ typedef struct {
/*0x0A*/ s16 scroll_x;
/*0x0C*/ s16 scroll_y;
/*0x0E*/ u8 scrollSpeed; /**< Pixels per frame that the camera can scroll. */
/*0x0F*/ u8 scroll_flags; // 0x2 = ??, 0x4 = camera scrolling
/*0x0F*/ u8 scroll_flags; // 0x2 = ?? (apply collision value on bottom map no matter the layer SetTileType is called
// for), 0x4 = camera scrolling
/*0x10*/ u8 scroll_direction;
/*0x11*/ s8 oam_offset_x;
/*0x12*/ s8 oam_offset_y;
@@ -73,7 +74,7 @@ typedef struct {
/* 0x0a */ u8 unk2;
/* 0x0b */ u8 filler2;
/* 0x0c */ s16 lightLevel;
/* 0x0e */ u16 unk_0e;
/* 0x0e */ u16 unk_0e; // Number of previous values for special tiles stored in gUnk_0200B240
/* 0x10 */ u8 unk_10[4];
/* 0x14 */ u32 flags;
/* 0x18 */ u32 unk3;
+1
View File
@@ -391,4 +391,5 @@ typedef struct {
u8 paletteGroup;
u8 gfxGroup;
} PACKED StaffrollGfxEntry;
#endif // STRUCTURES_H