Rename metaTiles

Now the 16x16 tiles are just called tiles and the 8x8 tiles are called subTiles.
This commit is contained in:
octorock
2024-01-06 14:59:48 +01:00
parent c3b771a209
commit aced0bef69
195 changed files with 9739 additions and 9736 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ typedef struct {
u16 map_y;
MapDataDefinition* tileset;
MapDataDefinition* map;
MapDataDefinition* metatiles;
MapDataDefinition* tiles;
void* bg_anim;
const Transition* exits;
void** properties;
+15 -15
View File
@@ -6,11 +6,11 @@
extern u32 Random(void);
extern u32 GetRandomByWeight(const u8*);
extern void CloneTile(u32, u32, u32);
extern u32 GetMetaTileTypeByEntity(struct Entity_*);
extern u32 GetMetaTileTypeByPos(s32 x, s32 y, u32 layer);
extern u32 GetMetaTileType(u32 metaTilePos, u32 layer);
extern u32 GetTileTypeByEntity(struct Entity_*);
extern u32 GetTileTypeByPos(s32 x, s32 y, u32 layer);
extern u32 GetTileType(u32 tilePos, u32 layer);
extern void SetMetaTile(u32 metaTile, u32 metaTilePos, u32 layer);
extern void SetTile(u32 tileIndex, u32 tilePos, u32 layer);
extern void UpdateScrollVram(void);
extern u32 sub_080B1BA4(u32, u32, u32);
@@ -50,7 +50,7 @@ extern u32 sub_0800132C(struct Entity_*, struct Entity_*);
extern u32 sub_080B1A48(u32, u32, u32);
extern u32 sub_0800445C(struct Entity_*);
extern bool32 GetVvvForMetaTileType(u32);
extern bool32 GetVvvForTileType(u32);
extern u32 CheckRectOnScreen(s32, s32, u32, u32);
extern u32 GetVvvRelativeToEntity(struct Entity_* entity, s32 xOffset, s32 yOffset);
@@ -58,38 +58,38 @@ 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);
extern u32 GetVvvAtTilePos(u16 tilePos, u8 layer);
/**
* Sets vvv for a metaTilePos.
* Sets vvv for a tilePos.
*/
extern void SetVvvAtMetaTilePos(u32 vvv, u32 metaTilePos, u32 layer);
extern void SetVvvAtTilePos(u32 vvv, u32 tilePos, 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)
* Returns the collision data for one tile. (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)
* Returns the collision data for one tile. (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)
* Returns the collision data for one tile. (x, y in tiles relative to the room)
*/
extern u32 GetCollisionDataAtRoomTile(u32 roomTileX, u32 roomTileY, u32 layer);
/**
* Returns the collision data for one metatile.
* Returns the collision data for one tile.
*/
extern u32 GetCollisionDataAtMetaTilePos(u32 metaTilePos, u32 layer);
extern u32 GetCollisionDataAtTilePos(u32 tilePos, u32 layer);
/**
* Sets the collision data for one metatile.
* Sets the collision data for one tile.
*/
extern void SetCollisionData(u32 collisionData, u32 metaTilePos, u32 layer);
extern void SetCollisionData(u32 collisionData, u32 tilePos, u32 layer);
typedef struct {
u16 key;
+6 -6
View File
@@ -9,10 +9,10 @@ tiles 0x4000 and above create an entry here
*/
#define MAX_SPECIAL_TILES 0x100
typedef struct {
u16 metaTilePosAndLayer; // (layer << 12) | position
u16 metaTileIndex;
u16 tilePosAndLayer; // (layer << 12) | position
u16 tileIndex;
} SpecialTileEntry;
extern SpecialTileEntry gMetaTilesForSpecialTiles[MAX_SPECIAL_TILES];
extern SpecialTileEntry gTilesForSpecialTiles[MAX_SPECIAL_TILES];
typedef struct {
u16 collision;
@@ -22,10 +22,10 @@ typedef struct {
void LoadMapData(MapDataDefinition* dataDefinition);
/**
* Renders a metaTleMap with 16x16 meta tiles into a tilemap with 8x8 tiles.
* Renders a tileMap with 16x16 tiles into a subTileMap with 8x8 tiles.
*
* Takes into account the special meta tiles >= 0x4000 using GetMetaTileSetIndexForSpecialTile.
* Takes into account the special tile indicess >= 0x4000 using GetTileSetIndexForSpecialTile.
*/
void RenderMapLayerToTileMap(u16* tileMap, MapLayer* mapLayer);
void RenderMapLayerToSubTileMap(u16* tileMap, MapLayer* mapLayer);
#endif // BEANSTALKSUBTASK_H
+1 -1
View File
@@ -65,6 +65,6 @@ void CalculateEntityTileCollisions(Entity* this, u32 direction, u32 collisionTyp
bool32 ProcessMovementInternal(Entity*, s32, s32, u32);
u32 sub_080176E4(Entity*);
extern const u8 gMapMetaTileTypeToVvv[]; // vvv for tileType?
extern const u8 gMapTileTypeToVvv[]; // vvv for tileType?
#endif // COLLISION_H
+1 -1
View File
@@ -17,7 +17,7 @@ typedef struct {
/*0x81*/ u8 timer1;
/*0x82*/ u8 timer2;
/*0x83*/ u8 unk_83;
/*0x84*/ u16 tilePosition;
/*0x84*/ u16 tilePos;
/*0x86*/ u16 tileIndex;
} WizzrobeEntity;
+1 -1
View File
@@ -558,7 +558,7 @@ extern u8 gManagerCount;
/** @name Tile Macros */ /// @{
#define TILE(x, y) (((((x)-gRoomControls.origin_x) >> 4) & 0x3F) | ((((y)-gRoomControls.origin_y) >> 4) & 0x3F) << 6)
// Calculate metatilePosition from x and y coordinates where x and y are already relative to the current room.
// Calculate tilePos from x and y coordinates where x and y are already relative to the current room.
#define TILE_LOCAL(x, y) ((((x) >> 4) & 0x3F) | (((y) >> 4) & 0x3F) << 6)
#define TILE_POS(x, y) (x + (y << 6))
#define TILE_POS_X_COMPONENT 0x3f
+17 -17
View File
@@ -5,27 +5,27 @@
// clang-format off
bool32 CheckFlags(u32);
bool32 CheckGlobalFlag(u32);
bool32 CheckGlobalFlags(u32, u32);
bool32 CheckFlags(u32 flags);
bool32 CheckGlobalFlag(u32 flag);
bool32 CheckGlobalFlags(u32 flag, u32 count);
extern bool32 CheckLocalFlag(u32 flag);
extern bool32 CheckLocalFlagByBank(u32 bank, u32 flag);
bool32 CheckLocalFlags(u32, u32);
bool32 CheckLocalFlagsByBank(u32, u32, u32);
bool32 CheckRoomFlag(u32);
bool32 CheckRoomFlags(u32, u32);
bool32 CheckLocalFlags(u32 flag, u32 count);
bool32 CheckLocalFlagsByBank(u32 offset, u32 flag, u32 count);
bool32 CheckRoomFlag(u32 flag);
bool32 CheckRoomFlags(u32 flag, u32 count);
void ClearFlag(u32);
void ClearGlobalFlag(u32);
void ClearLocalFlag(u32);
void ClearLocalFlagByBank(u32, u32);
void ClearRoomFlag(u32);
void ClearFlag(u32 flag);
void ClearGlobalFlag(u32 flag);
void ClearLocalFlag(u32 flag);
void ClearLocalFlagByBank(u32 offset, u32 flag);
void ClearRoomFlag(u32 flag);
void SetFlag(u32);
void SetGlobalFlag(u32);
void SetLocalFlag(u32);
void SetLocalFlagByBank(u32, u32);
void SetRoomFlag(u32);
void SetFlag(u32 flag);
void SetGlobalFlag(u32 flag);
void SetLocalFlag(u32 flag);
void SetLocalFlagByBank(u32 offset, u32 flag);
void SetRoomFlag(u32 flag);
extern u32 ReadBit(void*, u32);
extern u32 CheckBits(void*, u32, u32);
+1 -1
View File
@@ -24,7 +24,7 @@ extern u32 CreateRandomItemDrop(Entity*, u32);
extern void DrawDirect(u32 spriteIndex, u32 frameIndex);
extern void DrawEntities(void);
extern void FlushSprites(void);
extern u32 GetMetaTileIndex(u32 metaTilePos, u32 layer);
extern u32 GetTileIndex(u32 tilePos, u32 layer);
extern u32 GiveItem(u32, u32);
extern bool32 LoadFixedGFX(Entity*, u32);
extern void LoadResources(void);
+2 -2
View File
@@ -529,11 +529,11 @@
// BGCNT
#define BGCNT_PRIORITY(n) (n) // Values 0 - 3. Lower priority BGs will be drawn on top of higher priority BGs.
#define BGCNT_CHARBASE(n) ((n) << 2) // Values 0 - 3. Base block for tile pixel data.
#define BGCNT_CHARBASE(n) ((n) << 2) // Values 0 - 3. Base block for sub tile pixel data.
#define BGCNT_MOSAIC 0x0040
#define BGCNT_16COLOR 0x0000 // 4 bits per pixel
#define BGCNT_256COLOR 0x0080 // 8 bits per pixel
#define BGCNT_SCREENBASE(n) ((n) << 8) // Values 0 - 31. Base block for tile map.
#define BGCNT_SCREENBASE(n) ((n) << 8) // Values 0 - 31. Base block for sub tile map.
#define BGCNT_WRAP 0x2000 // Only affects affine BGs. Text BGs wrap by default.
#define BGCNT_TXT256x256 0x0000 // Internal screen size size of text mode BG in pixels.
#define BGCNT_TXT512x256 0x4000
+1 -1
View File
@@ -11,7 +11,7 @@ typedef struct {
u8 field_0x37;
s16 x;
u16 y;
u16 metaTilePos;
u16 tilePos;
u16 flag;
} BombableWallManager;
+1 -1
View File
@@ -6,7 +6,7 @@
typedef struct {
struct Manager base;
u8 field_0x20[0x18];
s16 metaTilePos; // x
s16 tilePos; // x
s16 field_0x3a; // y
} FlameManager;
+1 -1
View File
@@ -8,7 +8,7 @@ typedef struct {
u8 field_0x20[0x16];
u8 layer;
u8 field_0x37;
s16 metaTilePos;
s16 tilePos;
u16 field_0x3a;
u8 field_0x3c;
u8 field_0x3d;
+1 -1
View File
@@ -25,7 +25,7 @@ typedef struct {
u8 field_0x35;
u8 field_0x36;
u8 field_0x37;
u16 tilePosition;
u16 tilePos;
u16 field_0x3a;
u8 field_0x3c;
u8 field_0x3d;
+13 -9
View File
@@ -8,26 +8,30 @@
* @page TileMap TileMap
* @brief
*
* 16x16 tiles
* 8x8 subTiles
*
*
*/
/**
* @brief Layer of the MetaTileMap.
* @brief Layer of the TileMap.
* @ingroup TileMap
*/
typedef struct {
/*0x0000*/ BgSettings* bgSettings;
/*0x0004*/ u16 mapData[0x40 * 0x40];
/**< MetaTileIndex for each tile on the current layer. */ // tilemap data? <-- gMapDataTop / gMapDataBottom
/**< TileIndex for each tile on the current layer. */ // tilemap data? <-- gMapDataTop / gMapDataBottom
/*0x2004*/ u8 collisionData[0x40 * 0x40]; // more tilemap data? <-- gUnk_0200D654 / gUnk_02027EB4
/*0x3004*/ u16 mapDataOriginal[0x40 * 0x40]; // more tilemap data? <-- gUnk_0200E654 / gUnk_02028EB4
// Tileset
/*0x5004*/ u16 metatileTypes[0x800];
/**< Maps from the MetaTileIndex to the MetaTileType. */ // gMetatileTypesTop, gMetatileTypesBottom
/*0x5004*/ u16 tileTypes[0x800];
/**< Maps from the TileIndex to the TileType. */ // gTileTypesTop, gTileTypesBottom
/*0x6004*/ u16 unkData2[0x800];
/**< Maps from a MetaTileType to a MetaTileIndex. */ // gUnk_02011654,gUnk_0202BEB4 // TODO metatile index for
// the metatile type??
/*0x7004*/ u16 metatiles[0x800 * 4];
/**< Mapping from a metatile to the four tile_attrs it consists of.*/ // gMetatilesTop, gMetatilesBottom
/**< Maps from a TileType to a TileIndex. */ // gUnk_02011654,gUnk_0202BEB4 // TODO tile index for
// the tile type??
/*0x7004*/ u16 tiles[0x800 * 4];
/**< Mapping from a tile to the four tile_attrs it consists of.*/ // gTilesTop, gTilesBottom
/*
Temporarily call this vvv
@@ -41,7 +45,7 @@ typedef struct {
// 0x637
// 0x2030eb4 + 0x637
// 0x20314eb
// e.g. GetVvvAtMetaTilePos accesses this
// e.g. GetVvvAtTilePos accesses this
// TODO check whether this also affects sound played when walking?
/*
0x10: water
+4 -4
View File
@@ -516,7 +516,7 @@ typedef struct {
/*0x1e*/ u8 dash_state;
/*0x1f*/ u8 field_0x1f[2];
/*0x21*/ u8 bow_state;
/*0x22*/ u16 tilePosition;
/*0x22*/ u16 tilePos;
/*0x24*/ u16 tileType;
/*0x26*/ u8 swim_state; /**< Is the player swimming? 0x80 for diving */
/*0x27*/ u8 field_0x27[5];
@@ -718,13 +718,13 @@ void sub_08078D60(void);
void PlayerSetNormalAndCollide(void);
bool32 PlayerTryDropObject(ItemBehavior* arg0, u32 unk);
void InitItemGetSequence(u32, u32, u32);
void sub_0807B7D8(u32 metaTileType, u32 metaTilePos, u32 layer);
void sub_0807B7D8(u32 tileType, u32 tilePos, u32 layer);
void SetInteractableObjectCollision(Entity*, u32, u32, const void*);
void sub_08079D84(void);
u32 sub_0807953C(void);
void sub_0807BB68(const s16*, u32, u32);
void SetMetaTileByIndex(u32 tileIndex, u32 metaTilePos, u32 layer);
void RestorePrevTileEntity(u32 metaTilePos, u32 layer);
void SetTileByIndex(u32 tileIndex, u32 tilePos, u32 layer);
void RestorePrevTileEntity(u32 tilePos, u32 layer);
void UpdateItemAnim(ItemBehavior*);
void PlayerCancelHoldItem(ItemBehavior*, u32);
void RegisterCarryEntity(Entity*);
+4 -4
View File
@@ -34,7 +34,7 @@ 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 = ?? (apply collision value on bottom map no matter the layer SetMetaTileType is
/*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;
@@ -73,7 +73,7 @@ typedef struct {
/* 0x09 */ u8 fight_bgm;
/* 0x0a */ u8 needHealthDrop;
/* 0x0c */ s16 lightLevel;
/* 0x0e */ u16 tileEntityCount; // Number of previous values for special tiles stored in gMetaTilesForSpecialTiles
/* 0x0e */ u16 tileEntityCount; // Number of previous values for special tiles stored in gTilesForSpecialTiles
/* 0x10 */ u8 graphicsGroups[4];
/* 0x14 */ u8 flags[52];
/* 0x48 */ Droptable currentAreaDroptable;
@@ -151,7 +151,7 @@ typedef struct {
/* 0x06 */ u16 field_0x6;
/* 0x08 */ bool8 transitioningOut;
/* 0x09 */ u8 type; // transition when changing areas
/* 0x0a */ u16 stairs_idx; // seems to be a tile type @see MetaTileType, set in UpdateDoorTransition()
/* 0x0a */ u16 stairs_idx; // seems to be a tile type @see TileType, set in UpdateDoorTransition()
/* 0x0c */ PlayerRoomStatus player_status;
/* 0x2c */ u8 entity_update_type; // differentiates entity priority on kinstone menu?
/* 0x2d */ u8 field2d;
@@ -234,7 +234,7 @@ typedef enum {
extern void** gCurrentRoomProperties;
void SetMetaTileType(u32 metaTileType, u32 metaTilePos, u32 layer);
void SetTileType(u32 tileType, u32 tilePos, u32 layer);
void InitScreenShake(u32 time, u32 magnitude);
void CallRoomProp5And7(void);
+2 -2
View File
@@ -16,7 +16,7 @@ typedef struct {
u16 xOffset;
u16 yOffset;
u16 updated;
void* tilemap;
void* subTileMap;
} BgSettings;
typedef struct {
@@ -24,7 +24,7 @@ typedef struct {
s16 xOffset;
s16 yOffset;
u16 updated;
void* tilemap;
void* subTileMap;
} BgAffSettings;
typedef struct {
+2 -2
View File
@@ -352,8 +352,8 @@ typedef struct {
extern struct_02018EB0 gUnk_02018EB0;
typedef struct {
s16 tile;
s16 position;
s16 tileIndex;
s16 tilePosOffset;
} TileData;
typedef struct {
+1565 -1565
View File
File diff suppressed because it is too large Load Diff