Rename vvv to actTile

This commit is contained in:
octorock 2024-01-06 16:14:12 +01:00
parent aced0bef69
commit 06dc158598
98 changed files with 3920 additions and 3910 deletions

View File

@ -5,16 +5,16 @@
.set TOP_COLLISIONDATA, gMapTop+0x2004
.set TOP_TILEDATAORIGINAL, gMapTop+0x3004
.set TOP_TILETYPES, gMapTop+0x5004
.set TOP_UNKDATA2, gMapTop+0x6004
.set TOP_TILEINDICES, gMapTop+0x6004
.set TOP_TILES, gMapTop+0x7004
.set TOP_UNKDATA3, gMapTop+0xb004
.set TOP_ACTTILES, gMapTop+0xb004
.set BOTTOM_TILEDATA, gMapBottom+0x4
.set BOTTOM_COLLISIONDATA, gMapBottom+0x2004
.set BOTTOM_TILEDATAORIGINAL, gMapBottom+0x3004
.set BOTTOM_TILETYPES, gMapBottom+0x5004
.set BOTTOM_UNKDATA2, gMapBottom+0x6004
.set BOTTOM_TILEINDICES, gMapBottom+0x6004
.set BOTTOM_TILES, gMapBottom+0x7004
.set BOTTOM_UNKDATA3, gMapBottom+0xb004
.set BOTTOM_ACTTILES, gMapBottom+0xb004
.macro room_header map_x, map_y, pixel_width, pixel_height, tileset_id
.2byte (\map_x) << 4

View File

@ -185,7 +185,7 @@ _08004516:
thumb_func_start sub_0800451C
sub_0800451C: @ 0x0800451C
push {r0, lr}
bl GetVvvAtEntity
bl GetActTileAtEntity
adds r1, r0, #0
pop {r0, r3}
mov lr, r3

View File

@ -5,7 +5,7 @@
.text
// TODO cannot add this at the end of mapVvvToSurfaceType.c due to alignment?
// TODO cannot add this at the end of mapActTileToSurfaceType.c due to alignment?
.2byte 0
// TODO unused? might also be code?

View File

@ -78,36 +78,35 @@ arm_sub_080B1A04:
ldr r2, _080B1C14 @ =gUnk_08000258
b _080B1A64
arm_func_start arm_sub_080B1A0C
arm_sub_080B1A0C: @ 0x080B1A0C
arm_func_start arm_GetTileTypeRelativeToEntity
arm_GetTileTypeRelativeToEntity: @ 0x080B1A0C
ldrh r3, [r0, #0x2e]
add r3, r3, r1
ldrh r1, [r0, #0x32]
add r1, r1, r2
ldrb r2, [r0, #0x38]
mov r0, r3
b arm_GetTileTypeByPos
arm_GetTileTypeByEntity: // GetCell
b arm_GetTileTypeAtWorldCoords
arm_GetTileTypeAtEntity: // GetCell
ldrb r2, [r0, #0x38]
ldrh r1, [r0, #0x32]
ldrh r0, [r0, #0x2e]
arm_GetTileTypeByPos:
arm_GetTileTypeAtWorldCoords:
ldr ip, _080B1C18 @ =gRoomControls
ldrh r3, [ip, #6]
sub r0, r0, r3
ldrh r3, [ip, #8]
sub r1, r1, r3
arm_sub_080B1A48:
arm_GetTileTypeAtRoomCoords:
lsl r0, r0, #0x16
lsr r0, r0, #0x1a
lsl r1, r1, #0x16
lsr r1, r1, #0x1a
arm_sub_080B1A58:
arm_GetTileTypeAtRoomTile:
add r0, r0, r1, lsl #6
mov r1, r2
arm_func_start arm_GetTileType
arm_GetTileType: @ 0x080B1A60
arm_func_start arm_GetTileTypeAtTilePos
arm_GetTileTypeAtTilePos: @ 0x080B1A60
ldr r2, _080B1C1C @ =gMapDataPtrs
_080B1A64:
add r2, r2, r1, lsl #3
@ -122,36 +121,36 @@ _080B1A64:
bx lr
// entity plus offset to world pixel coordinates and layer
arm_func_start arm_GetVvvRelativeToEntity
arm_GetVvvRelativeToEntity: @ 0x080B1A8C
arm_func_start arm_GetActTileRelativeToEntity
arm_GetActTileRelativeToEntity: @ 0x080B1A8C
ldrh r3, [r0, #0x2e]
add r3, r3, r1
ldrh r1, [r0, #0x32]
add r1, r1, r2
ldrb r2, [r0, #0x38]
mov r0, r3
b arm_GetVvvAtWorldCoords
b arm_GetActTileAtWorldCoords
// entity to world pixel coordinates and layer
arm_GetVvvAtEntity: // GetCellAct
arm_GetActTileAtEntity: // GetCellAct
ldrb r2, [r0, #0x38]
ldrh r1, [r0, #0x32]
ldrh r0, [r0, #0x2e]
arm_GetVvvAtWorldCoords: @ world pixel coordinates to room pixel coordinates
arm_GetActTileAtWorldCoords: @ world pixel coordinates to room pixel coordinates
ldr ip, _080B1C20 @ =gRoomControls
ldrh r3, [ip, #6]
sub r0, r0, r3
ldrh r3, [ip, #8]
sub r1, r1, r3
arm_GetVvvAtRoomCoords: @ room pixel coordinates to room tile coordinates
arm_GetActTileAtRoomCoords: @ room pixel coordinates to room tile coordinates
lsl r0, r0, #0x16
lsr r0, r0, #0x1a
lsl r1, r1, #0x16
lsr r1, r1, #0x1a
arm_GetVvvAtRoomTile:
arm_GetActTileAtRoomTile:
add r0, r0, r1, lsl #6
mov r1, r2 @ move layer to r1
arm_GetVvvAtTilePos:
ldr r2, _080B1C24 @ =gVvvPtrs
arm_GetActTileAtTilePos:
ldr r2, _080B1C24 @ =gActTilePtrs
ldr r2, [r2, r1, lsl #2]
ldrb r0, [r2, r0]
bx lr
@ -161,7 +160,6 @@ arm_GetCollisionDataRelativeTo: @ 0x080B1AF0
@ r0 = entity*
@ r1 = x
@ r2 = y
ldrh r3, [r0, #0x2e] @ ent.x + x
add r3, r3, r1
ldrh r1, [r0, #0x32] @ ent.y + y
@ -185,7 +183,7 @@ arm_GetCollisionDataAtRoomCoords:
lsl r1, r1, #0x16
lsr r1, r1, #0x1a @ /= 16
arm_GetCollisionDataAtRoomTile:
add r0, r0, r1, lsl #6 @ convert coords to tile index
add r0, r0, r1, lsl #6 @ convert coords to tile pos
mov r1, r2
arm_GetCollisionDataAtTilePos:
ldr r2, _080B1C2C @ =gCollisionDataPtrs
@ -193,11 +191,11 @@ arm_GetCollisionDataAtTilePos:
ldrb r0, [r1, r0] @ load collision tile at my location
bx lr
arm_func_start arm_GetVvvForTileType
arm_GetVvvForTileType: @ 0x080B1B54
arm_func_start arm_GetActTileForTileType
arm_GetActTileForTileType: @ 0x080B1B54
lsls r0, r0, #0x12
ldrlo r1, _080B1C30 @ =gMapTileTypeToVvv
ldrhs r1, _080B1C34 @ =gMapSpecialTileToVvv
ldrlo r1, _080B1C30 @ =gMapTileTypeToActTile
ldrhs r1, _080B1C34 @ =gMapSpecialTileToActTile
ldrb r0, [r1, r0, lsr #18]
bx lr
@ -214,7 +212,7 @@ arm_sub_080B1B68: @ 0x080B1B68
arm_func_start arm_sub_080B1B84
arm_sub_080B1B84: @ 0x080B1B84
mov ip, lr
bl arm_GetTileType
bl arm_GetTileTypeAtTilePos
lsls r0, r0, #0x12
ldrlo r1, _080B1C3C @ =gUnk_08000360
ldrhs r1, _080B1C40 @ =gUnk_080B7A3E
@ -226,7 +224,7 @@ arm_sub_080B1B84: @ 0x080B1B84
arm_sub_080B1BA4: @ 0x080B1BA4
mov ip, lr
mov r3, r2
bl arm_GetTileType
bl arm_GetTileTypeAtTilePos
lsls r0, r0, #0x12
ldrlo r1, _080B1C44 @ =gUnk_08000360
ldrhs r1, _080B1C48 @ =gUnk_080B7A3E
@ -249,7 +247,7 @@ sub_080B1BCC: @ 0x080B1BCC
and r1, r1, #0x3f0
and r2, r2, #0x3f0
add r1, r1, r2, lsl #6
ldr r2, _080B1C50 @ =gVvvPtrs
ldr r2, _080B1C50 @ =gActTilePtrs
ldrb r3, [r0, #0x38]
ldr r2, [r2, r3, lsl #2]
ldrb r0, [r2, r1, lsr #4]
@ -260,18 +258,18 @@ _080B1C14: .4byte gUnk_08000258
_080B1C18: .4byte gRoomControls
_080B1C1C: .4byte gMapDataPtrs
_080B1C20: .4byte gRoomControls
_080B1C24: .4byte gVvvPtrs
_080B1C24: .4byte gActTilePtrs
_080B1C28: .4byte gRoomControls
_080B1C2C: .4byte gCollisionDataPtrs
_080B1C30: .4byte gMapTileTypeToVvv
_080B1C34: .4byte gMapSpecialTileToVvv
_080B1C30: .4byte gMapTileTypeToActTile
_080B1C34: .4byte gMapSpecialTileToActTile
_080B1C38: .4byte gTileTypesPtrs
_080B1C3C: .4byte gUnk_08000360
_080B1C40: .4byte gUnk_080B7A3E
_080B1C44: .4byte gUnk_08000360
_080B1C48: .4byte gUnk_080B7A3E
_080B1C4C: .4byte gRoomControls
_080B1C50: .4byte gVvvPtrs
_080B1C50: .4byte gActTilePtrs
arm_func_start UpdateCollision
UpdateCollision: @ 0x080B1C54

View File

@ -326,7 +326,7 @@ DoTileInteraction: @ 0x08008796
adds r1, r7, #0
movs r2, #0x38
ldrb r2, [r4, r2] // collision layer
bl GetTileTypeByPos
bl GetTileTypeAtWorldCoords
ldr r1, _080088D8 @ =gUnk_080046A4
bl FindEntryForKey
beq _080087CE_return0
@ -758,12 +758,12 @@ CheckNEastTile: @ 0x08008B02
push {r0, r1, lr}
movs r1, #0
movs r2, #0
bl GetVvvRelativeToEntity
bl GetActTileRelativeToEntity
// check if north east collision?
ldr r1, =0x4000
tst r0, r1
bne _08008B1E
ldr r1, =gMapVvvToSurfaceType
ldr r1, =gMapActTileToSurfaceType
bl FindEntryForKey
movs r2, #1
cmp r3, #1

View File

@ -78,11 +78,11 @@ ResolveCollisionLayer::
ldrh r0, [r4, #0x2e]
ldrh r1, [r4, #0x32]
movs r2, #2
bl GetTileTypeByPos
bl GetTileTypeAtWorldCoords
movs r3, #1
cmp r0, #0
beq _08016A62
bl GetVvvForTileType
bl GetActTileForTileType
movs r3, #2
add r1, pc, #0x40
_08016A54:
@ -103,7 +103,7 @@ _08016A64:
CheckOnLayerTransition::
push {r4, r5, lr}
adds r4, r0, #0
bl GetVvvAtEntity // tile under me
bl GetActTileAtEntity // tile under me
adr r1, gTransitionTiles-4
loop:
adds r1, #4 // p += 4

View File

@ -69,9 +69,9 @@ SetTile: @ r0 = tile index, r1, = tile position, r2 = layer
blo tile_wrong_type @ jump if tileIndex < 0x4000
push {r1, r2}
subs r4, r0, r6 @ r4 = tileIndex - 0x4000
ldr r3, _08000210 @ =gMapSpecialTileToVvv
ldrb r0, [r3, r4] @ r0 = gMapSpecialTileToVvv[tileIndex - 0x4000]
bl SetVvvAtTilePos
ldr r3, _08000210 @ =gMapSpecialTileToActTile
ldrb r0, [r3, r4] @ r0 = gMapSpecialTileToActTile[tileIndex - 0x4000]
bl SetActTileAtTilePos
ldr r3, _08000214 @ =gMapSpecialTileToCollisionData
ldrb r0, [r3, r4] @ r0 = gMapSpecialTileToCollisionData[tileIndex - 0x4000]
lsrs r2, r2, #2 @ r2 = layer
@ -89,9 +89,9 @@ tile_wrong_type:
lsls r0, r0, #1 @ r0 = tileIndex * 2
ldrh r4, [r4, r0] @ r4 (tileType) = gMapBottom.tileTypes[tileIndex]
push {r1, r2}
ldr r3, _08000218 @ =gMapTileTypeToVvv
ldrb r0, [r3, r4] @ r0 = gMapTileTypeToVvv[tileType]
bl SetVvvAtTilePos
ldr r3, _08000218 @ =gMapTileTypeToActTile
ldrb r0, [r3, r4] @ r0 = gMapTileTypeToActTile[tileType]
bl SetActTileAtTilePos
ldr r3, _0800021C @ =gMapTileTypeToCollisionData
ldrb r0, [r3, r4] @ r0 = gMapTileTypeToCollisionData[tileType]
lsrs r2, r2, #2 @ r2 = layer
@ -105,13 +105,13 @@ _080001C4: .4byte gMapBottom+0x6004
_080001C8: .4byte gMapTop+0x6004
_080001CC: .4byte gMapBottom+0x6004
@ r0: @see gMapSpecialTileToVvv r1: tilePos, r2: layer
thumb_func_start SetVvvAtTilePos
SetVvvAtTilePos: @ 0x080001D0
@ r0: @see gMapSpecialTileToActTile r1: tilePos, r2: layer
thumb_func_start SetActTileAtTilePos
SetActTileAtTilePos: @ 0x080001D0
lsls r2, r2, #2
ldr r3, _08000220 @ =gVvvPtrs
ldr r3, [r3, r2] @ r3 = gMapBottom.vvv
strb r0, [r3, r1] @ gMapBottom.vvv[tilePos] = r0
ldr r3, _08000220 @ =gActTilePtrs
ldr r3, [r3, r2] @ r3 = gMapBottom.actTiles
strb r0, [r3, r1] @ gMapBottom.actTiles[tilePos] = r0
bx lr
non_word_aligned_thumb_func_start GetTileIndex
@ -133,11 +133,11 @@ _08000200: .4byte gBG2Buffer+0x40
_08000204: .4byte gCollisionDataPtrs
_08000208: .4byte gMapDataPtrs
_0800020C: .4byte 0x00004000
_08000210: .4byte gMapSpecialTileToVvv
_08000210: .4byte gMapSpecialTileToActTile
_08000214: .4byte gMapSpecialTileToCollisionData
_08000218: .4byte gMapTileTypeToVvv
_08000218: .4byte gMapTileTypeToActTile
_0800021C: .4byte gMapTileTypeToCollisionData
_08000220: .4byte gVvvPtrs
_08000220: .4byte gActTilePtrs
_08000224: .4byte gMapDataPtrs
gMapDataPtrs::
@ -164,11 +164,11 @@ gUnk_08000258:: @ mapDataOriginal and tileTypes
.4byte TOP_TILETYPES
.4byte BOTTOM_TILEDATAORIGINAL @ layer 3
.4byte BOTTOM_TILETYPES
gVvvPtrs:: @ vvv for layers
.4byte BOTTOM_UNKDATA3 @ layer 0
.4byte BOTTOM_UNKDATA3 @ layer 1
.4byte TOP_UNKDATA3 @ layer 2
.4byte BOTTOM_UNKDATA3 @ layer 3
gActTilePtrs:: @ actTile for layers
.4byte BOTTOM_ACTTILES @ layer 0
.4byte BOTTOM_ACTTILES @ layer 1
.4byte TOP_ACTTILES @ layer 2
.4byte BOTTOM_ACTTILES @ layer 3
@ call 0x80B19CC
@ ========
@ -214,17 +214,17 @@ sub_080B1A04: @ 0x08000298
@ r0: entity*
@ r1: s32
@ r2: s32
thumb_func_start sub_080B1A0C
sub_080B1A0C: @ 0x0800029C
ldr r3, _08000308 @ =ram_sub_080B1A0C
thumb_func_start GetTileTypeRelativeToEntity
GetTileTypeRelativeToEntity: @ 0x0800029C
ldr r3, _08000308 @ =ram_GetTileTypeRelativeToEntity
bx r3
@ call 0x080B1A28
@ r0: entity
@ return: u32 (tileType)
thumb_func_start GetTileTypeByEntity
GetTileTypeByEntity: @ 0x080002A0
ldr r3, _0800030C @ =ram_GetTileTypeByEntity
thumb_func_start GetTileTypeAtEntity
GetTileTypeAtEntity: @ 0x080002A0
ldr r3, _0800030C @ =ram_GetTileTypeAtEntity
bx r3
@ call 0x080B1A34
@ -232,35 +232,35 @@ GetTileTypeByEntity: @ 0x080002A0
@ r1: s32 (yPos)
@ r2: u32 (layer)
@ return: u32 (tileType)
thumb_func_start GetTileTypeByPos
GetTileTypeByPos: @ 0x080002A4
ldr r3, _08000310 @ =ram_GetTileTypeByPos
thumb_func_start GetTileTypeAtWorldCoords
GetTileTypeAtWorldCoords: @ 0x080002A4
ldr r3, _08000310 @ =ram_GetTileTypeAtWorldCoords
bx r3
@ call 0x080B1A48
@ r0: s32 (xPos)
@ r1: s32 (yPos)
@ r2: u32 (layer)
thumb_func_start sub_080B1A48
sub_080B1A48: @ 0x080002A8
ldr r3, _08000314 @ =ram_sub_080B1A48
thumb_func_start GetTileTypeAtRoomCoords
GetTileTypeAtRoomCoords: @ 0x080002A8
ldr r3, _08000314 @ =ram_GetTileTypeAtRoomCoords
bx r3
@ call 0x080B1A58
@ r0: s32 (xPos)
@ r1: s32 (yPos)
@ r2: u32 (layer)
thumb_func_start sub_080B1A58
sub_080B1A58: @ 0x080002AC
ldr r3, _08000318 @ =ram_sub_080B1A58
thumb_func_start GetTileTypeAtRoomTile
GetTileTypeAtRoomTile: @ 0x080002AC
ldr r3, _08000318 @ =ram_GetTileTypeAtRoomTile
bx r3
@ call 0x080B1A60
@ r0: u32 (tileIndex)
@ r1: u32 (layer)
@ return: u32 (tileType)
thumb_func_start GetTileType
GetTileType: @ 0x080002B0
thumb_func_start GetTileTypeAtTilePos
GetTileTypeAtTilePos: @ 0x080002B0
ldr r3, _0800031C @ =ram_GetTileType
bx r3
@ -268,9 +268,9 @@ GetTileType: @ 0x080002B0
@ r0: Entity*
@ r1: u32
@ r2: u32
thumb_func_start GetVvvRelativeToEntity
GetVvvRelativeToEntity: @ 0x080002B4
ldr r3, _08000320 @ =ram_GetVvvRelativeToEntity
thumb_func_start GetActTileRelativeToEntity
GetActTileRelativeToEntity: @ 0x080002B4
ldr r3, _08000320 @ =ram_GetActTileRelativeToEntity
bx r3
@ call 0x080B1AA8
@ -280,18 +280,18 @@ GetVvvRelativeToEntity: @ 0x080002B4
@ return:
@ ========
@ Called every frame a pot is thrown, every frame the screen is sliding in a transition, and once when entering stairs.
thumb_func_start GetVvvAtEntity
GetVvvAtEntity: @ 0x080002B8
ldr r3, _08000324 @ =ram_GetVvvAtEntity
thumb_func_start GetActTileAtEntity
GetActTileAtEntity: @ 0x080002B8
ldr r3, _08000324 @ =ram_GetActTileAtEntity
bx r3
@ call 0x080B1AB4
@ r0: s32 (xPos)
@ r1: s32 (yPos)
@ r2: u32 (layer)
thumb_func_start GetVvvAtWorldCoords
GetVvvAtWorldCoords: @ 0x080002BC
ldr r3, _08000328 @ =ram_GetVvvAtWorldCoords
thumb_func_start GetActTileAtWorldCoords
GetActTileAtWorldCoords: @ 0x080002BC
ldr r3, _08000328 @ =ram_GetActTileAtWorldCoords
bx r3
@ call 0x080B1AC8
@ -299,9 +299,9 @@ GetVvvAtWorldCoords: @ 0x080002BC
@ r1: u32
@ r2: u32
@ return: ???
thumb_func_start GetVvvAtRoomCoords
GetVvvAtRoomCoords: @ 0x080002C0
ldr r3, _0800032C @ =ram_GetVvvAtRoomCoords
thumb_func_start GetActTileAtRoomCoords
GetActTileAtRoomCoords: @ 0x080002C0
ldr r3, _0800032C @ =ram_GetActTileAtRoomCoords
bx r3
@ call 0x080B1AD8
@ -310,17 +310,17 @@ GetVvvAtRoomCoords: @ 0x080002C0
@ r2: s32 (yOffset)
@ ========
@ Unused? Doesn't seem to be called by anything in Ghidra.
thumb_func_start GetVvvAtRoomTile
GetVvvAtRoomTile: @ 0x080002C4
ldr r3, _08000330 @ =ram_GetVvvAtRoomTile
thumb_func_start GetActTileAtRoomTile
GetActTileAtRoomTile: @ 0x080002C4
ldr r3, _08000330 @ =ram_GetActTileAtRoomTile
bx r3
@ call 0x080B1AE0
@ r0: u32 (tileIndex)
@ r1: u32 (layer)
thumb_func_start GetVvvAtTilePos
GetVvvAtTilePos: @ 0x080002C8
ldr r3, _08000334 @ =ram_GetVvvAtTilePos
thumb_func_start GetActTileAtTilePos
GetActTileAtTilePos: @ 0x080002C8
ldr r3, _08000334 @ =ram_GetActTileAtTilePos
bx r3
@ call 0x080B1AF0
@ -372,9 +372,9 @@ GetCollisionDataAtTilePos: @ 0x080002E0
@ call 0x080B1B54
@ r0: u32 (tileIndex)
thumb_func_start GetVvvForTileType
GetVvvForTileType: @ 0x080002E4
ldr r3, _08000350 @ =ram_GetVvvForTileType
thumb_func_start GetActTileForTileType
GetActTileForTileType: @ 0x080002E4
ldr r3, _08000350 @ =ram_GetActTileForTileType
bx r3
@ call 0x080B1B68
@ -407,25 +407,25 @@ _080002F8: .4byte ram_sub_080B19D8
_080002FC: .4byte ram_sub_080B19EC
_08000300: .4byte ram_sub_080B19FC
_08000304: .4byte ram_sub_080B1A04
_08000308: .4byte ram_sub_080B1A0C
_0800030C: .4byte ram_GetTileTypeByEntity
_08000310: .4byte ram_GetTileTypeByPos
_08000314: .4byte ram_sub_080B1A48
_08000318: .4byte ram_sub_080B1A58
_08000308: .4byte ram_GetTileTypeRelativeToEntity
_0800030C: .4byte ram_GetTileTypeAtEntity
_08000310: .4byte ram_GetTileTypeAtWorldCoords
_08000314: .4byte ram_GetTileTypeAtRoomCoords
_08000318: .4byte ram_GetTileTypeAtRoomTile
_0800031C: .4byte ram_GetTileType
_08000320: .4byte ram_GetVvvRelativeToEntity
_08000324: .4byte ram_GetVvvAtEntity
_08000328: .4byte ram_GetVvvAtWorldCoords
_0800032C: .4byte ram_GetVvvAtRoomCoords
_08000330: .4byte ram_GetVvvAtRoomTile
_08000334: .4byte ram_GetVvvAtTilePos
_08000320: .4byte ram_GetActTileRelativeToEntity
_08000324: .4byte ram_GetActTileAtEntity
_08000328: .4byte ram_GetActTileAtWorldCoords
_0800032C: .4byte ram_GetActTileAtRoomCoords
_08000330: .4byte ram_GetActTileAtRoomTile
_08000334: .4byte ram_GetActTileAtTilePos
_08000338: .4byte ram_GetCollisionDataRelativeTo
_0800033C: .4byte ram_GetCollisionDataAtEntity
_08000340: .4byte ram_GetCollisionDataAtWorldCoords
_08000344: .4byte ram_GetCollisionDataAtRoomCoords
_08000348: .4byte ram_GetCollisionDataAtRoomTile
_0800034C: .4byte ram_GetCollisionDataAtTilePos
_08000350: .4byte ram_GetVvvForTileType
_08000350: .4byte ram_GetActTileForTileType
_08000354: .4byte ram_sub_080B1B68
_08000358: .4byte ram_sub_080B1B84
_0800035C: .4byte ram_sub_080B1BA4

View File

@ -6,9 +6,8 @@
extern u32 Random(void);
extern u32 GetRandomByWeight(const u8*);
extern void CloneTile(u32, u32, u32);
extern u32 GetTileTypeByEntity(struct Entity_*);
extern u32 GetTileTypeByPos(s32 x, s32 y, u32 layer);
extern u32 GetTileType(u32 tilePos, u32 layer);
extern void SetTile(u32 tileIndex, u32 tilePos, u32 layer);
@ -48,22 +47,28 @@ extern u32 sub_0800442E(struct Entity_*);
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 GetVvvForTileType(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 GetVvvAtTilePos(u16 tilePos, u8 layer);
extern u32 GetTileTypeRelativeToEntity(struct Entity_* entity, s32 xOffset, s32 yOffset);
extern u32 GetTileTypeAtEntity(struct Entity_* entity);
extern u32 GetTileTypeAtWorldCoords(s32 worldX, s32 worldY, u32 layer);
extern u32 GetTileTypeAtRoomCoords(u32 roomX, u32 roomY, u32 layer);
extern u32 GetTileTypeAtTilePos(u32 tilePos, u32 layer);
extern u32 GetActTileRelativeToEntity(struct Entity_* entity, s32 xOffset, s32 yOffset);
extern u32 GetActTileAtEntity(struct Entity_* entity);
extern u32 GetActTileAtWorldCoords(u32 worldX, u32 worldY, u32 layer);
extern u32 GetActTileAtRoomCoords(u32 roomX, u32 roomY, u32 layer);
extern u32 GetActTileAtRoomTile(u32 roomTileX, u32 roomTileY, u32 layer);
extern u32 GetActTileAtTilePos(u16 tilePos, u8 layer);
/**
* Sets vvv for a tilePos.
* Sets actTile for a tilePos.
*/
extern void SetVvvAtTilePos(u32 vvv, u32 tilePos, u32 layer);
extern void SetActTileAtTilePos(u32 actTile, u32 tilePos, u32 layer);
// Get CollisionData for entity (relative to entity?)
extern u32 GetCollisionDataRelativeTo(struct Entity_* entity, s32 xOffset, s32 yOffset);
@ -91,6 +96,9 @@ extern u32 GetCollisionDataAtTilePos(u32 tilePos, u32 layer);
*/
extern void SetCollisionData(u32 collisionData, u32 tilePos, u32 layer);
extern u32 GetActTileForTileType(u32 tileType);
typedef struct {
u16 key;
u16 value;

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 gMapTileTypeToVvv[]; // vvv for tileType?
extern const u8 gMapTileTypeToActTile[]; // actTile for tileType?
#endif // COLLISION_H

View File

@ -47,7 +47,6 @@ extern void ClearBgAnimations(void);
extern void SetBGDefaults(void);
// Unidentified
extern u32 sub_080B1A0C(Entity*, s32, s32);
extern s32 sub_080012DC(Entity*);
extern void sub_08001318(Entity*);
extern void LinearMoveDirectionOLD(Entity*, u32, u32);

View File

@ -31,12 +31,12 @@ enum DiggingCaveEntranceType {
};
typedef struct {
u16 sourceTilePosition; /**< Tile position for the entrance in the source room. */
u16 sourceTilePos; /**< Tile position for the entrance in the source room. */
u8 sourceRoom; /**< @see RoomID */
u8 type; /**< @see DiggingCaveEntranceType */
u8 targetArea; /**< @see AreaID */
u8 targetRoom; /**< @see RoomID */
u16 targetTilePosition; /**< Tile position for the entrance in the target room. */
u16 targetTilePos; /**< Tile position for the entrance in the target room. */
} DiggingCaveEntrance;
typedef struct {

View File

@ -1,17 +1,21 @@
#ifndef MAP_H
#define MAP_H
#include "global.h"
#include "screen.h"
/**
* @page TileMap TileMap
* @brief
* @brief The map consists of tiles to create the world.
*
* 16x16 tiles
* 8x8 subTiles
*
*
* tileIndex index into the tile set
* 0 to 0x800, special tiles at 0x4000 to 0x4096
* tilePos index into the current map
* tileType
* collisionData
*
*/
/**
@ -20,38 +24,40 @@
*/
typedef struct {
/*0x0000*/ BgSettings* bgSettings;
/**
* tileIndex for each tile on the current layer.
*/
/*0x0004*/ u16 mapData[0x40 * 0x40];
/**< 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
/**
* Collision data for each tile on the current layer.
* @see CollisionData
*/
/*0x2004*/ u8 collisionData[0x40 * 0x40];
/**
* Copy of the map data.
* @see mapData
*/
/*0x3004*/ u16 mapDataOriginal[0x40 * 0x40];
/**
* Maps from the tileIndex to the tileType.
* @see TileType
*/
/*0x5004*/ u16 tileTypes[0x800];
/**< Maps from the TileIndex to the TileType. */ // gTileTypesTop, gTileTypesBottom
/*0x6004*/ u16 unkData2[0x800];
/**< 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
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. GetVvvAtTilePos accesses this
// TODO check whether this also affects sound played when walking?
/*
0x10: water
0x12: ice
0x57: cloning pad
*/
/**
* Maps from a tileType to a tileIndex. Inverse of @see tileTypes.
* @see TileType
*/
/*0x6004*/ u16 tileIndices[0x800];
/**
* Maps from a tile index to the four sub tiles (with attributes) it consists of.
* @see https://www.coranac.com/tonc/text/regbg.htm#sec-map
*/
/*0x7004*/ u16 subTiles[0x800 * 4];
/**
* Some sort of special behavior for tiles? Falling into holes or jumping off walls does not work when this is all zero.
* @see ActTile
*/
/*0xb004*/ u8 actTiles[0x40*0x40];
} MapLayer;
extern MapLayer gMapTop;

View File

@ -696,7 +696,7 @@ u32 sub_08079B24(void);
void sub_08079708(Entity*);
void sub_08079744(Entity*);
void PlayerUpdateSwimming(Entity*);
u32 GetVvvInFront(Entity* player);
u32 GetActTileInFront(Entity* player);
u32 sub_080797C4(void);
void CheckPlayerVelocity(void);
void sub_0807B068(Entity*);

View File

@ -1,9 +1,9 @@
#ifndef ROOM_H
#define ROOM_H
#include "global.h"
#include "entity.h"
#include "droptables.h"
#include "map.h"
enum RoomTransition {
TRANSITION_DEFAULT,
@ -56,7 +56,7 @@ typedef struct {
/*0x28*/ union SplitWord bg3OffsetX;
/*0x2C*/ union SplitWord bg3OffsetY;
/*0x30*/ Entity* camera_target;
/*0x34*/ u32 unk_34;
/*0x34*/ u32 tileset; // TODO Should be MapDataDefinition*, but then SetupTileSet does not match.
} RoomControls;
extern RoomControls gRoomControls;

File diff suppressed because it is too large Load Diff

View File

@ -159,25 +159,25 @@ SECTIONS {
. = 0x00005760; ram_sub_080B19EC = .;
. = 0x00005770; ram_sub_080B19FC = .;
. = 0x00005778; ram_sub_080B1A04 = .;
. = 0x00005780; ram_sub_080B1A0C = .;
. = 0x0000579C; ram_GetTileTypeByEntity = .;
. = 0x000057A8; ram_GetTileTypeByPos = .;
. = 0x000057BC; ram_sub_080B1A48 = .;
. = 0x000057CC; ram_sub_080B1A58 = .;
. = 0x00005780; ram_GetTileTypeRelativeToEntity = .;
. = 0x0000579C; ram_GetTileTypeAtEntity = .;
. = 0x000057A8; ram_GetTileTypeAtWorldCoords = .;
. = 0x000057BC; ram_GetTileTypeAtRoomCoords = .;
. = 0x000057CC; ram_GetTileTypeAtRoomTile = .;
. = 0x000057D4; ram_GetTileType = .;
. = 0x00005800; ram_GetVvvRelativeToEntity = .;
. = 0x0000581C; ram_GetVvvAtEntity = .;
. = 0x00005828; ram_GetVvvAtWorldCoords = .;
. = 0x0000583C; ram_GetVvvAtRoomCoords = .;
. = 0x0000584C; ram_GetVvvAtRoomTile = .;
. = 0x00005854; ram_GetVvvAtTilePos = .;
. = 0x00005800; ram_GetActTileRelativeToEntity = .;
. = 0x0000581C; ram_GetActTileAtEntity = .;
. = 0x00005828; ram_GetActTileAtWorldCoords = .;
. = 0x0000583C; ram_GetActTileAtRoomCoords = .;
. = 0x0000584C; ram_GetActTileAtRoomTile = .;
. = 0x00005854; ram_GetActTileAtTilePos = .;
. = 0x00005864; ram_GetCollisionDataRelativeTo = .;
. = 0x00005880; ram_GetCollisionDataAtEntity = .;
. = 0x0000588C; ram_GetCollisionDataAtWorldCoords = .;
. = 0x000058A0; ram_GetCollisionDataAtRoomCoords = .;
. = 0x000058B0; ram_GetCollisionDataAtRoomTile = .;
. = 0x000058B8; ram_GetCollisionDataAtTilePos = .;
. = 0x000058C8; ram_GetVvvForTileType = .;
. = 0x000058C8; ram_GetActTileForTileType = .;
. = 0x000058DC; ram_sub_080B1B68 = .;
. = 0x000058F8; ram_sub_080B1B84 = .;
. = 0x00005918; ram_sub_080B1BA4 = .;
@ -244,7 +244,7 @@ SECTIONS {
asm/src/code_080043E8.o(.text);
src/data/data_080046A4.o(.rodata);
data/gfx/link_animations.o(.rodata);
src/data/mapVvvToSurfaceType.o(.rodata);
src/data/mapActTileToSurfaceType.o(.rodata);
asm/src/code_08007CAC.o(.text);
data/data_08007DF4.o(.rodata);
asm/src/player.o(.text);

View File

@ -20,7 +20,7 @@
extern void sub_0807C898(void);
extern void sub_0805BB74(s32);
extern void LoadRoomGfx(void);
extern void sub_0807BFD0(void);
extern void SetupTileSet(void);
extern void sub_0807C4F8(void);
extern void gMapData;
@ -220,9 +220,9 @@ u32 UpdatePlayerCollision(void) {
mapLayer = GetLayerByIndex(gPlayerEntity.base.collisionLayer);
ptr1 = &gUnk_080B4468[gPlayerEntity.base.animationState & 6];
position = COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr1[0], -ptr1[1]);
tileType = GetTileType(position, gPlayerEntity.base.collisionLayer);
tileType = GetTileTypeAtTilePos(position, gPlayerEntity.base.collisionLayer);
if (tileType < 0x4000) {
direction = GetVvvForTileType(tileType);
direction = GetActTileForTileType(tileType);
} else {
direction = tileType;
}
@ -246,7 +246,7 @@ u32 UpdatePlayerCollision(void) {
gPlayerEntity.base.y.HALF.LO = 0;
gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState);
return 1;
case VVV_40:
case ACT_TILE_40:
if ((gPlayerState.flags & PL_MINISH) != 0) {
return 0;
}
@ -295,7 +295,7 @@ u32 UpdatePlayerCollision(void) {
gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState);
gPlayerEntity.base.type = 1;
return 1;
case VVV_112:
case ACT_TILE_112:
if ((gPlayerState.field_0x35 & 0x80) == 0) {
if ((gPlayerEntity.base.frame & 1) != 0) {
if (sub_0801A9F0(gPlayerState.field_0x35 << 2, tileType, position) != 0) {
@ -304,8 +304,8 @@ u32 UpdatePlayerCollision(void) {
}
}
return 0;
case VVV_58:
case VVV_91:
case ACT_TILE_58:
case ACT_TILE_91:
case SPECIAL_TILE_81:
if (gPlayerState.flags & PL_MINISH) {
return 0;
@ -320,7 +320,7 @@ u32 UpdatePlayerCollision(void) {
gPlayerState.mobility = 1;
sub_080A7CFC(position, gPlayerEntity.base.collisionLayer);
return 1;
case VVV_26:
case ACT_TILE_26:
if ((animationState1 & 0xff) != 0) {
return 0;
}
@ -334,7 +334,7 @@ u32 UpdatePlayerCollision(void) {
gPlayerState.mobility = 1;
OpenSmallChest(position, gPlayerEntity.base.collisionLayer);
return 2;
case VVV_113:
case ACT_TILE_113:
if (HasDungeonSmallKey() == 0) {
return 0;
}
@ -345,7 +345,7 @@ u32 UpdatePlayerCollision(void) {
gPlayerState.mobility = 1;
sub_0804B388(position, gPlayerEntity.base.collisionLayer);
return 2;
case VVV_61:
case ACT_TILE_61:
case SPECIAL_TILE_64 ... SPECIAL_TILE_72:
if ((gPlayerState.flags & PL_DRUGGED) != 0) {
return 0;
@ -433,7 +433,7 @@ u32 UpdatePlayerCollision(void) {
gPlayerEntity.base.y.HALF.LO = 0;
gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState);
return 1;
case VVV_114:
case ACT_TILE_114:
if ((gPlayerState.field_0x35 & 0x80) != 0) {
return 0;
}
@ -585,7 +585,7 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
SetTile(SPECIAL_TILE_116, position, gPlayerEntity.base.collisionLayer);
SetVvvAtTilePos(VVV_13, position, gPlayerEntity.base.collisionLayer);
SetActTileAtTilePos(ACT_TILE_13, position, gPlayerEntity.base.collisionLayer);
return 1;
default:
return 0;
@ -602,7 +602,7 @@ bool32 sub_0801A2B0(MapLayer* mapLayer, u32 position, u32 collisionType) {
if ((((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) == 0) &&
((gPlayerEntity.base.frame & 1) != 0)) {
position = (u16)(position - (-uVar1)); // necessary for match
temp4 = GetVvvForTileType(GetTileType(position, gPlayerEntity.base.collisionLayer));
temp4 = GetActTileForTileType(GetTileTypeAtTilePos(position, gPlayerEntity.base.collisionLayer));
switch (temp4) {
case 0x52:
break;
@ -643,7 +643,7 @@ bool32 sub_0801A370(MapLayer* mapLayer, u32 position) {
topLayer = GetLayerByIndex(LAYER_TOP);
offset = gUnk_080B4488[gPlayerEntity.base.animationState >> 1];
pos = position + offset;
tileType = GetTileType(pos, gPlayerEntity.base.collisionLayer);
tileType = GetTileTypeAtTilePos(pos, gPlayerEntity.base.collisionLayer);
switch (tileType) {
case SPECIAL_TILE_43:
pos += offset;
@ -654,7 +654,7 @@ bool32 sub_0801A370(MapLayer* mapLayer, u32 position) {
if (topLayer->collisionData[pos - 0x80] == 0x46) {
return FALSE;
}
switch ((u16)GetVvvForTileType(GetTileType(pos, gPlayerEntity.base.collisionLayer))) {
switch ((u16)GetActTileForTileType(GetTileTypeAtTilePos(pos, gPlayerEntity.base.collisionLayer))) {
case 0x52:
return FALSE;
case 0x26:
@ -690,8 +690,8 @@ bool32 sub_0801A458(MapLayer* mapLayer, u32 position, u32 collisionType) {
s32 offset = gUnk_080B4488[gPlayerEntity.base.animationState >> 1];
if (sub_0801A4F8()) {
pos = position + offset;
tileType = GetTileType(pos, gPlayerEntity.base.collisionLayer);
switch (GetVvvForTileType(tileType)) {
tileType = GetTileTypeAtTilePos(pos, gPlayerEntity.base.collisionLayer);
switch (GetActTileForTileType(tileType)) {
case 0x52:
case 0x26:
case 0x27:
@ -777,7 +777,7 @@ u32 sub_0801A570(Entity* this, u32 param_2) {
return position;
}
index1 = GetTileType(position, this->collisionLayer);
index1 = GetTileTypeAtTilePos(position, this->collisionLayer);
if ((index1 - 0x369) > 1) {
position = 0xffff;
} else {
@ -811,7 +811,7 @@ u32 sub_0801A570(Entity* this, u32 param_2) {
return position;
}
index1 = GetTileType(position, this->collisionLayer);
index1 = GetTileTypeAtTilePos(position, this->collisionLayer);
if (!(index1 == 0x369) && !(index1 == 0x36d))
position = 0xffff;
else {
@ -845,7 +845,7 @@ u32 sub_0801A570(Entity* this, u32 param_2) {
return position;
}
index1 = GetTileType(position, this->collisionLayer);
index1 = GetTileTypeAtTilePos(position, this->collisionLayer);
if (!(index1 == 0x369) && !(index1 == 0x36b))
position = 0xffff;
else {
@ -879,7 +879,7 @@ u32 sub_0801A570(Entity* this, u32 param_2) {
return position;
}
index1 = GetTileType(position, this->collisionLayer);
index1 = GetTileTypeAtTilePos(position, this->collisionLayer);
if (!(index1 == 0x369) && !(index1 == 0x36c))
position = 0xffff;
else {
@ -935,9 +935,9 @@ bool32 sub_0801A980(void) {
GetLayerByIndex(gPlayerEntity.base.collisionLayer); // TODO result unused?
ptr = &gUnk_080B44A8[gPlayerEntity.base.animationState & 6];
tileType =
GetTileType(COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr[0], -ptr[1]), gPlayerEntity.base.collisionLayer);
GetTileTypeAtTilePos(COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr[0], -ptr[1]), gPlayerEntity.base.collisionLayer);
if (tileType < 0x4000) {
GetVvvForTileType(tileType);
GetActTileForTileType(tileType);
}
return FALSE;
}
@ -1007,7 +1007,7 @@ bool32 sub_0801AA58(Entity* this, u32 param_2, u32 param_3) {
}
void RenderMapLayerToSubTileMap(u16* subTileMap, MapLayer* mapLayer) {
u16* tiles;
u16* subTiles;
u16* mapData;
u16* mapDataOriginal;
u16 tileY;
@ -1035,11 +1035,11 @@ void RenderMapLayerToSubTileMap(u16* subTileMap, MapLayer* mapLayer) {
} else {
tileSetIndex = GetTileSetIndexForSpecialTile(tilePosAndLayer, mapDataOriginal[0]);
}
tiles = mapLayer->tiles + tileSetIndex;
subTileMap[0] = tiles[0];
subTileMap[1] = tiles[1];
subTileMap[0x80 + 0] = tiles[2];
subTileMap[0x80 + 1] = tiles[3];
subTiles = mapLayer->subTiles + tileSetIndex;
subTileMap[0] = subTiles[0];
subTileMap[1] = subTiles[1];
subTileMap[0x80 + 0] = subTiles[2];
subTileMap[0x80 + 1] = subTiles[3];
subTileMap += 2;
if (mapData[1] < 0x4000) {
@ -1047,11 +1047,11 @@ void RenderMapLayerToSubTileMap(u16* subTileMap, MapLayer* mapLayer) {
} else {
tileSetIndex = GetTileSetIndexForSpecialTile(tilePosAndLayer + 1, mapDataOriginal[1]);
}
tiles = mapLayer->tiles + tileSetIndex;
subTileMap[0] = tiles[0];
subTileMap[1] = tiles[1];
subTileMap[0x80 + 0] = tiles[2];
subTileMap[0x80 + 1] = tiles[3];
subTiles = mapLayer->subTiles + tileSetIndex;
subTileMap[0] = subTiles[0];
subTileMap[1] = subTiles[1];
subTileMap[0x80 + 0] = subTiles[2];
subTileMap[0x80 + 1] = subTiles[3];
subTileMap += 2;
if (mapData[2] < 0x4000) {
@ -1059,11 +1059,11 @@ void RenderMapLayerToSubTileMap(u16* subTileMap, MapLayer* mapLayer) {
} else {
tileSetIndex = GetTileSetIndexForSpecialTile(tilePosAndLayer + 2, mapDataOriginal[2]);
}
tiles = mapLayer->tiles + tileSetIndex;
subTileMap[0] = tiles[0];
subTileMap[1] = tiles[1];
subTileMap[0x80 + 0] = tiles[2];
subTileMap[0x80 + 1] = tiles[3];
subTiles = mapLayer->subTiles + tileSetIndex;
subTileMap[0] = subTiles[0];
subTileMap[1] = subTiles[1];
subTileMap[0x80 + 0] = subTiles[2];
subTileMap[0x80 + 1] = subTiles[3];
subTileMap += 2;
if (mapData[3] < 0x4000) {
@ -1071,11 +1071,11 @@ void RenderMapLayerToSubTileMap(u16* subTileMap, MapLayer* mapLayer) {
} else {
tileSetIndex = GetTileSetIndexForSpecialTile(tilePosAndLayer + 3, mapDataOriginal[3]);
}
tiles = mapLayer->tiles + tileSetIndex;
subTileMap[0] = tiles[0];
subTileMap[1] = tiles[1];
subTileMap[0x80 + 0] = tiles[2];
subTileMap[0x80 + 1] = tiles[3];
subTiles = mapLayer->subTiles + tileSetIndex;
subTileMap[0] = subTiles[0];
subTileMap[1] = subTiles[1];
subTileMap[0x80 + 0] = subTiles[2];
subTileMap[0x80 + 1] = subTiles[3];
subTileMap += 2;
mapData += 4;
@ -1116,7 +1116,7 @@ void sub_0801AC98(void) {
for (indexY = 0; indexY < height; indexY++) {
for (indexX = 0; indexX < width; indexX++, position++) {
for (ptr = gUnk_080B44C0; ptr->tileType != 0xffff; ptr++) {
if (ptr->tileType == GetTileType(position, 1)) {
if (ptr->tileType == GetTileTypeAtTilePos(position, 1)) {
if (gUnk_080B44B8[ptr->unk_a] != 0) {
sub_0801AD6C(ptr, position);
break;
@ -1125,7 +1125,7 @@ void sub_0801AC98(void) {
}
for (ptr = gUnk_080B44C2; ptr->tileType != 0xffff; ptr++) {
if (ptr->tileType == GetTileType(position, 2)) {
if (ptr->tileType == GetTileTypeAtTilePos(position, 2)) {
if (gUnk_080B44B8[ptr->unk_a] != 0) {
sub_0801AD6C(ptr, position);
break;
@ -1187,8 +1187,8 @@ u32 sub_0801AE34(void) {
void sub_0801AE44(bool32 loadGfx) {
void (*func)(void);
gRoomControls.unk_34 = 0;
sub_0807BFD0();
gRoomControls.tileset = (u32)NULL;
SetupTileSet();
if (loadGfx != 0) {
LoadRoomGfx();
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,75 @@
#include "asm.h"
#include "player.h"
#include "tiles.h"
const KeyValuePair gMapActTileToSurfaceType[] = {
{ ACT_TILE_13, SURFACE_PIT },
{ ACT_TILE_38, SURFACE_SLOPE_GNDGND_V },
{ ACT_TILE_39, SURFACE_SLOPE_GNDGND_H },
{ ACT_TILE_82, SURFACE_26 },
{ ACT_TILE_99, SURFACE_24 },
{ ACT_TILE_116, SURFACE_EDGE },
{ ACT_TILE_8, SURFACE_7 },
{ ACT_TILE_31, SURFACE_MINISH_DOOR_FRONT },
{ ACT_TILE_32, SURFACE_MINISH_DOOR_BACK },
{ ACT_TILE_33, SURFACE_A },
{ ACT_TILE_34, SURFACE_B },
{ ACT_TILE_24, SURFACE_16 },
{ ACT_TILE_18, SURFACE_ICE },
{ ACT_TILE_15, SURFACE_SHALLOW_WATER },
{ ACT_TILE_14, SURFACE_SLOPE_GNDWATER },
{ ACT_TILE_16, SURFACE_WATER },
{ ACT_TILE_27, SURFACE_BUTTON },
{ ACT_TILE_29, SURFACE_BUTTON },
{ ACT_TILE_97, SURFACE_1B },
{ ACT_TILE_90, SURFACE_1C },
{ ACT_TILE_17, SURFACE_14 },
{ ACT_TILE_98, SURFACE_21 },
{ ACT_TILE_101, SURFACE_6 },
{ ACT_TILE_102, SURFACE_6 },
{ ACT_TILE_103, SURFACE_6 },
{ ACT_TILE_104, SURFACE_6 },
{ ACT_TILE_105, SURFACE_6 },
{ ACT_TILE_106, SURFACE_6 },
{ ACT_TILE_108, SURFACE_6 },
{ ACT_TILE_109, SURFACE_6 },
{ ACT_TILE_110, SURFACE_6 },
{ ACT_TILE_111, SURFACE_6 },
{ ACT_TILE_107, SURFACE_6 },
{ ACT_TILE_48, SURFACE_22 },
{ ACT_TILE_49, SURFACE_22 },
{ ACT_TILE_50, SURFACE_22 },
{ ACT_TILE_51, SURFACE_22 },
{ ACT_TILE_22, SURFACE_DUST },
{ ACT_TILE_25, SURFACE_HOLE },
{ ACT_TILE_240, SURFACE_HOLE },
{ ACT_TILE_87, SURFACE_CLONE_TILE },
{ ACT_TILE_83, SURFACE_LADDER },
{ ACT_TILE_241, SURFACE_LADDER },
{ ACT_TILE_63, SURFACE_AUTO_LADDER },
{ ACT_TILE_80, SURFACE_CLIMB_WALL },
{ ACT_TILE_81, SURFACE_2C },
{ ACT_TILE_52, SURFACE_LIGHT_GRADE },
{ ACT_TILE_53, SURFACE_29 },
{ ACT_TILE_42, SURFACE_E },
{ ACT_TILE_43, SURFACE_D },
{ ACT_TILE_44, SURFACE_10 },
{ ACT_TILE_45, SURFACE_F },
{ ACT_TILE_64, SURFACE_E },
{ ACT_TILE_65, SURFACE_D },
{ ACT_TILE_66, SURFACE_10 },
{ ACT_TILE_67, SURFACE_F },
{ ACT_TILE_72, SURFACE_10 },
{ ACT_TILE_74, SURFACE_E },
{ ACT_TILE_69, SURFACE_E },
{ ACT_TILE_71, SURFACE_E },
{ ACT_TILE_70, SURFACE_D },
{ ACT_TILE_73, SURFACE_D },
{ ACT_TILE_68, SURFACE_D },
{ ACT_TILE_75, SURFACE_D },
{ ACT_TILE_19, SURFACE_SWAMP },
{ ACT_TILE_41, SURFACE_DOOR },
{ ACT_TILE_23, SURFACE_2D },
{ ACT_TILE_40, SURFACE_DOOR_13 },
};
// const u16 gMapActTileToSurfaceTypeEnd = 0;

View File

@ -1,75 +0,0 @@
#include "asm.h"
#include "player.h"
#include "tiles.h"
const KeyValuePair gMapVvvToSurfaceType[] = {
{ VVV_13, SURFACE_PIT },
{ VVV_38, SURFACE_SLOPE_GNDGND_V },
{ VVV_39, SURFACE_SLOPE_GNDGND_H },
{ VVV_82, SURFACE_26 },
{ VVV_99, SURFACE_24 },
{ VVV_116, SURFACE_EDGE },
{ VVV_8, SURFACE_7 },
{ VVV_31, SURFACE_MINISH_DOOR_FRONT },
{ VVV_32, SURFACE_MINISH_DOOR_BACK },
{ VVV_33, SURFACE_A },
{ VVV_34, SURFACE_B },
{ VVV_24, SURFACE_16 },
{ VVV_18, SURFACE_ICE },
{ VVV_15, SURFACE_SHALLOW_WATER },
{ VVV_14, SURFACE_SLOPE_GNDWATER },
{ VVV_16, SURFACE_WATER },
{ VVV_27, SURFACE_BUTTON },
{ VVV_29, SURFACE_BUTTON },
{ VVV_97, SURFACE_1B },
{ VVV_90, SURFACE_1C },
{ VVV_17, SURFACE_14 },
{ VVV_98, SURFACE_21 },
{ VVV_101, SURFACE_6 },
{ VVV_102, SURFACE_6 },
{ VVV_103, SURFACE_6 },
{ VVV_104, SURFACE_6 },
{ VVV_105, SURFACE_6 },
{ VVV_106, SURFACE_6 },
{ VVV_108, SURFACE_6 },
{ VVV_109, SURFACE_6 },
{ VVV_110, SURFACE_6 },
{ VVV_111, SURFACE_6 },
{ VVV_107, SURFACE_6 },
{ VVV_48, SURFACE_22 },
{ VVV_49, SURFACE_22 },
{ VVV_50, SURFACE_22 },
{ VVV_51, SURFACE_22 },
{ VVV_22, SURFACE_DUST },
{ VVV_25, SURFACE_HOLE },
{ VVV_240, SURFACE_HOLE },
{ VVV_87, SURFACE_CLONE_TILE },
{ VVV_83, SURFACE_LADDER },
{ VVV_241, SURFACE_LADDER },
{ VVV_63, SURFACE_AUTO_LADDER },
{ VVV_80, SURFACE_CLIMB_WALL },
{ VVV_81, SURFACE_2C },
{ VVV_52, SURFACE_LIGHT_GRADE },
{ VVV_53, SURFACE_29 },
{ VVV_42, SURFACE_E },
{ VVV_43, SURFACE_D },
{ VVV_44, SURFACE_10 },
{ VVV_45, SURFACE_F },
{ VVV_64, SURFACE_E },
{ VVV_65, SURFACE_D },
{ VVV_66, SURFACE_10 },
{ VVV_67, SURFACE_F },
{ VVV_72, SURFACE_10 },
{ VVV_74, SURFACE_E },
{ VVV_69, SURFACE_E },
{ VVV_71, SURFACE_E },
{ VVV_70, SURFACE_D },
{ VVV_73, SURFACE_D },
{ VVV_68, SURFACE_D },
{ VVV_75, SURFACE_D },
{ VVV_19, SURFACE_SWAMP },
{ VVV_41, SURFACE_DOOR },
{ VVV_23, SURFACE_2D },
{ VVV_40, SURFACE_DOOR_13 },
};
// const u16 gMapVvvToSurfaceTypeEnd = 0;

View File

@ -427,7 +427,7 @@ bool32 sub_0803086C(ArmosEntity* this) {
tilePos = ((((((super)->x.HALF.HI) - gRoomControls.origin_x) >> 4) & (r2 = 0x3f)) |
(((((super)->y.HALF.HI) - gRoomControls.origin_y) >> 4) & r2) << 6);
if (GetTileType(tilePos, super->collisionLayer) == SPECIAL_TILE_73) {
if (GetTileTypeAtTilePos(tilePos, super->collisionLayer) == SPECIAL_TILE_73) {
if (CheckPlayerInRegion(centerX, centerY, 2, 0xc) != 0) {
if (CheckPlayerInRegion(centerX, centerY - 4, 2, 4) != 0) {
gPlayerEntity.base.spritePriority.b0 = 3;

View File

@ -685,7 +685,7 @@ void sub_0802B204(BombPeahatEntity* this) {
bool32 sub_0802B234(BombPeahatEntity* this) {
bool32 ret = FALSE;
if (GetTileTypeByEntity(super) - 0x1c4 > 1)
if (GetTileTypeAtEntity(super) - 0x1c4 > 1)
ret = TRUE;
return ret;
}

View File

@ -716,7 +716,7 @@ void sub_0801FB68(ChuchuEntity* this) {
}
bool32 CheckWaterTile(ChuchuEntity* this) {
if (GetVvvAtEntity(super) == VVV_16) {
if (GetActTileAtEntity(super) == ACT_TILE_16) {
return TRUE;
} else {
return FALSE;

View File

@ -400,9 +400,9 @@ void sub_08031024(EyegoreEntity* this) {
}
} else {
tmp2 = this->unk_7b >> 1;
uVar5 = GetTileTypeByPos(super->x.HALF.HI + gUnk_080CE2C0[tmp2],
uVar5 = GetTileTypeAtWorldCoords(super->x.HALF.HI + gUnk_080CE2C0[tmp2],
super->y.HALF.HI + gUnk_080CE2C0[tmp2 + 1], super->collisionLayer);
uVar8 = GetTileTypeByPos(super->x.HALF.HI + gUnk_080CE2C0[tmp2 + 2],
uVar8 = GetTileTypeAtWorldCoords(super->x.HALF.HI + gUnk_080CE2C0[tmp2 + 2],
super->y.HALF.HI + gUnk_080CE2C0[tmp2 + 3], super->collisionLayer);
if (!(((gMapTileTypeToCollisionData[uVar5] == 0) &&
(gMapTileTypeToCollisionData[uVar8] == 0)) ||

View File

@ -185,7 +185,7 @@ void FlyingPot_Init(FlyingPotEntity* this) {
void FlyingPot_Action1(FlyingPotEntity* this) {
sub_08037418(this);
if (GetTileTypeByEntity(super) != SPECIAL_TILE_0) {
if (GetTileTypeAtEntity(super) != SPECIAL_TILE_0) {
SetTile(this->tileIndex, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
sub_08037408(this);
}

View File

@ -130,7 +130,7 @@ void sub_08039DD8(FlyingSkullEntity* this) {
sub_0803A100(this);
if (super->type == 0) {
if (GetTileTypeByEntity(super) == SPECIAL_TILE_115) {
if (GetTileTypeAtEntity(super) == SPECIAL_TILE_115) {
SetTile(this->tileIndex, COORD_TO_TILE(super), super->collisionLayer);
sub_0803A0E0(this);
}

View File

@ -248,25 +248,25 @@ void sub_080464C0(GyorgFemaleEntity* this) {
#define sub_08046518_offset 0x658
void sub_08046518(void) {
u16* ptr = gMapTop.tileTypes;
u16* sl = &gMapTop.mapData[sub_08046518_offset];
u16* stack1 = &gMapTop.mapDataOriginal[sub_08046518_offset];
u8* stack2 = &gMapTop.vvv[sub_08046518_offset];
u8* r6 = &gMapTop.collisionData[sub_08046518_offset];
u16* tileTypes = gMapTop.tileTypes;
u16* mapData = &gMapTop.mapData[sub_08046518_offset];
u16* mapDataOriginal = &gMapTop.mapDataOriginal[sub_08046518_offset];
u8* actTiles = &gMapTop.actTiles[sub_08046518_offset];
u8* collisionData = &gMapTop.collisionData[sub_08046518_offset];
u32 i;
for (i = 0x10; i != 0; i--) {
u32 j;
for (j = 0x10; j != 0; j--) {
u16 new_var;
stack1[j] = sl[j];
new_var = ptr[sl[j]];
stack2[j] = gMapTileTypeToVvv[new_var];
r6[j] = gMapTileTypeToCollisionData[new_var];
u16 tileType;
mapDataOriginal[j] = mapData[j];
tileType = tileTypes[mapData[j]];
actTiles[j] = gMapTileTypeToActTile[tileType];
collisionData[j] = gMapTileTypeToCollisionData[tileType];
}
sl += 0x40;
stack1 += 0x40;
stack2 += 0x40;
r6 += 0x40;
mapData += 0x40;
mapDataOriginal += 0x40;
actTiles += 0x40;
collisionData += 0x40;
}
}

View File

@ -126,15 +126,15 @@ void Leever_DigDown(LeeverEntity* this) {
}
bool32 sub_0801FDE4(Entity* entity, s32 x, s32 y) {
u32 vvv;
u32 actTile;
const u16* puVar4;
if (GetCollisionDataAtWorldCoords(x, y, gUnk_020000B0->collisionLayer) != 0) {
return FALSE;
} else {
vvv = GetVvvAtWorldCoords(x, y, gUnk_020000B0->collisionLayer);
actTile = GetActTileAtWorldCoords(x, y, gUnk_020000B0->collisionLayer);
for (puVar4 = gUnk_080CA4CA; *puVar4 != (u16)-1;) {
if (*puVar4++ == vvv) {
if (*puVar4++ == actTile) {
entity->x.HALF.HI = (x & 0xfff0) + 8;
entity->y.HALF.HI = (y & 0xfff0) + 8;
entity->collisionLayer = gUnk_020000B0->collisionLayer;
@ -211,10 +211,10 @@ const s8 gLeeverDrift[] = {
};
const u16 gUnk_080CA4CA[] = {
VVV_10,
VVV_9,
VVV_12,
VVV_11,
ACT_TILE_10,
ACT_TILE_9,
ACT_TILE_12,
ACT_TILE_11,
0xFFFF,
};
// clang-format on

View File

@ -186,7 +186,7 @@ void sub_08023288(MoldwormEntity* this) {
for (i = 0; i < 0x10; i++) {
u32 x = gPlayerEntity.base.x.HALF.HI + gUnk_080CBC70[idx + 0];
u32 y = gPlayerEntity.base.y.HALF.HI + gUnk_080CBC70[idx + 1];
if (sub_08023A38(GetTileTypeByPos(x, y, gPlayerEntity.base.collisionLayer))) {
if (sub_08023A38(GetTileTypeAtWorldCoords(x, y, gPlayerEntity.base.collisionLayer))) {
sub_08023990(this, x, y);
return;
}
@ -221,7 +221,7 @@ void sub_08023398(MoldwormEntity* this) {
}
if (--this->unk_78.HWORD == 0) {
if (sub_08023A38(GetTileTypeByEntity(super))) {
if (sub_08023A38(GetTileTypeAtEntity(super))) {
super->action = 5;
this->unk_7f = 0;
COLLISION_OFF(super);
@ -517,8 +517,8 @@ bool32 sub_08023A38(u32 tileType) {
if (tileType == TILE_TYPE_26 || tileType == TILE_TYPE_41) {
return TRUE;
} else {
tileType = gMapTileTypeToVvv[tileType];
if (tileType == VVV_9 || tileType == VVV_11 || tileType == VVV_10 || tileType == VVV_12) {
tileType = gMapTileTypeToActTile[tileType];
if (tileType == ACT_TILE_9 || tileType == ACT_TILE_11 || tileType == ACT_TILE_10 || tileType == ACT_TILE_12) {
return TRUE;
} else {
return FALSE;

View File

@ -428,26 +428,26 @@ bool32 sub_0802571C(PuffstoolEntity* this) {
}
bool32 sub_080257EC(PuffstoolEntity* this, u32 x, u32 y) {
u16 tileType = sub_080B1A48(x - 0x00, y - 0x00, super->collisionLayer);
if (tileType != 0x312 && gMapTileTypeToVvv[tileType] != VVV_22 &&
u16 tileType = GetTileTypeAtRoomCoords(x - 0x00, y - 0x00, super->collisionLayer);
if (tileType != 0x312 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
gMapTileTypeToCollisionData[tileType] == 0) {
return TRUE;
}
tileType = sub_080B1A48(x - 0x10, y - 0x00, super->collisionLayer);
if (tileType != 0x312 && gMapTileTypeToVvv[tileType] != VVV_22 &&
tileType = GetTileTypeAtRoomCoords(x - 0x10, y - 0x00, super->collisionLayer);
if (tileType != 0x312 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
gMapTileTypeToCollisionData[tileType] == 0) {
return TRUE;
}
tileType = sub_080B1A48(x - 0x00, y - 0x10, super->collisionLayer);
if (tileType != 0x312 && gMapTileTypeToVvv[tileType] != VVV_22 &&
tileType = GetTileTypeAtRoomCoords(x - 0x00, y - 0x10, super->collisionLayer);
if (tileType != 0x312 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
gMapTileTypeToCollisionData[tileType] == 0) {
return TRUE;
}
tileType = sub_080B1A48(x - 0x10, y - 0x10, super->collisionLayer);
if (tileType != 0x312 && gMapTileTypeToVvv[tileType] != VVV_22 &&
tileType = GetTileTypeAtRoomCoords(x - 0x10, y - 0x10, super->collisionLayer);
if (tileType != 0x312 && gMapTileTypeToActTile[tileType] != ACT_TILE_22 &&
gMapTileTypeToCollisionData[tileType] == 0) {
return TRUE;
}
@ -532,7 +532,7 @@ bool32 sub_08025AB8(u32 tilePos, u32 layer) {
if (GetCollisionDataAtTilePos(tilePos, layer))
return FALSE;
if (GetVvvAtTilePos(tilePos, layer) == VVV_10) {
if (GetActTileAtTilePos(tilePos, layer) == ACT_TILE_10) {
sub_0807B7D8(0x61, tilePos, layer);
return TRUE;
}

View File

@ -267,7 +267,7 @@ void sub_08020A7C(RollobiteEntity* this) {
bool32 Rollobite_TryToHoleUp(RollobiteEntity* this) {
if (Rollobite_IsRolledUp(this) && super->z.HALF.HI == 0) {
u32 tilePos = COORD_TO_TILE(super);
u32 tileType = GetTileType(tilePos, super->collisionLayer);
u32 tileType = GetTileTypeAtTilePos(tilePos, super->collisionLayer);
if ((tileType * 0x10000 - 0x710000U) >> 0x10 < 2) {
super->action = 6;
COLLISION_OFF(super);

View File

@ -209,7 +209,7 @@ void sub_08031600(RopeEntity* this) {
u32 sub_0803163C(RopeEntity* this) {
u32 h;
if (GetVvvAtEntity(super) == VVV_19) {
if (GetActTileAtEntity(super) == ACT_TILE_19) {
h = this->unk_7a / 2;
} else {
h = this->unk_7a;

View File

@ -322,7 +322,7 @@ void sub_08033D78(SpinyBeetleEntity* this) {
s32 tilePos;
u32 type;
tilePos = COORD_TO_TILE_OFFSET(super, -ptr[0], -ptr[1]);
type = GetTileType(tilePos, super->collisionLayer);
type = GetTileTypeAtTilePos(tilePos, super->collisionLayer);
switch (type) {
case 0x1c4:

View File

@ -456,7 +456,7 @@ u32 sub_08039B28(StalfosEntity* this) {
}
ptr2 = &gUnk_080CF930[super->animationState * 2];
pos = COORD_TO_TILE_OFFSET(super, -ptr2[0], -ptr2[1]);
tileType = GetTileType(pos, (u32)super->collisionLayer);
tileType = GetTileTypeAtTilePos(pos, (u32)super->collisionLayer);
ptr = gUnk_080CF938;
do {

View File

@ -164,7 +164,7 @@ void sub_0802F300(TektiteEntity* this) {
return;
} else if (super->collisions != COL_NONE) {
sub_0800417E(super, super->collisions);
} else if ((GetVvvAtEntity(super) & 0xf0) == 0x50) { // VVV_240 and VVV_241?
} else if ((GetActTileAtEntity(super) & 0xf0) == 0x50) { // ACT_TILE_240 and ACT_TILE_241?
super->direction = (super->direction + 0x10) & (0x3 | DirectionNorthWest);
}

View File

@ -137,7 +137,7 @@ void sub_08038048(TektiteGoldenEntity* this) {
return;
} else if (super->collisions != COL_NONE) {
sub_0800417E(super, super->collisions);
} else if ((GetVvvAtEntity(super) & 0xf0) == 0x50) { // VVV_240 and VVV_241?
} else if ((GetActTileAtEntity(super) & 0xf0) == 0x50) { // ACT_TILE_240 and ACT_TILE_241?
super->direction = (super->direction + 0x10) & (0x3 | DirectionNorthWest);
}

View File

@ -76,7 +76,7 @@ void sub_0803CF38(TorchTrapEntity* this) {
}
void sub_0803CF94(TorchTrapEntity* this) {
if (GetTileType(this->tilePos, super->collisionLayer) == TILE_TYPE_118) {
if (GetTileTypeAtTilePos(this->tilePos, super->collisionLayer) == TILE_TYPE_118) {
this->unk_80 = 0;
TorchTrap_Reset(this);
} else if (this->unk_7c && sub_0803CFD8(this)) {

View File

@ -49,7 +49,7 @@ const u8 gEntityListLUT[] = {
void sub_0805E248(void) {
s32 tilePos;
tilePos = gDiggingCaveEntranceTransition.entrance->targetTilePosition;
tilePos = gDiggingCaveEntranceTransition.entrance->targetTilePos;
if (gRoomControls.area == AREA_VEIL_FALLS || gRoomControls.area == AREA_VEIL_FALLS_DIG_CAVE) {
SetTileType(TILE_TYPE_636, tilePos + TILE_POS(-1, -1), LAYER_BOTTOM);
SetTileType(TILE_TYPE_643, tilePos + TILE_POS(-1, -1), LAYER_TOP);

View File

@ -12,7 +12,7 @@ void ItemGustJar(ItemBehavior* this, u32 index) {
}
void sub_08076DF4(ItemBehavior* this, u32 index) {
if (GetVvvInFront(&gPlayerEntity.base) != VVV_41 && gPlayerState.floor_type != SURFACE_DOOR &&
if (GetActTileInFront(&gPlayerEntity.base) != ACT_TILE_41 && gPlayerState.floor_type != SURFACE_DOOR &&
gPlayerState.floor_type != SURFACE_DOOR_13 && gPlayerState.jump_status == 0) {
sub_08077D38(this, index);
this->timer = 0;

View File

@ -188,7 +188,7 @@ s32 sub_080774A0(void) {
return 0;
if (collisionData < 0xf)
return 0;
if (GetVvvAtTilePos(tilePos, gPlayerEntity.base.collisionLayer) != VVV_86) {
if (GetActTileAtTilePos(tilePos, gPlayerEntity.base.collisionLayer) != ACT_TILE_86) {
return 1;
} else {
return 0x56;

View File

@ -46,7 +46,7 @@ void BombableWallManager_Init(BombableWallManager* this) {
}
void BombableWallManager_Action1(BombableWallManager* this) {
if (GetVvvAtTilePos(this->tilePos, this->layer) != VVV_46) {
if (GetActTileAtTilePos(this->tilePos, this->layer) != ACT_TILE_46) {
super->action = 2;
super->timer = 90;
BombableWallManager_DestroyWall(this);
@ -62,7 +62,7 @@ void BombableWallManager_Action2(BombableWallManager* this) {
}
u32 BombableWallManager_GetBombableType(u32 tilePos, u32 layer) {
u32 tileType = GetTileType(tilePos, layer);
u32 tileType = GetTileTypeAtTilePos(tilePos, layer);
switch (tileType) {
case TILE_TYPE_236:

View File

@ -29,7 +29,7 @@ void DestructibleTileObserveManager_Main(DestructibleTileObserveManager* this) {
void sub_0805CFF0(DestructibleTileObserveManager_unk* param_1) {
if (!CheckLocalFlag(param_1->flag)) {
u32 tileType = GetTileType(param_1->tilePos, param_1->tileLayer);
u32 tileType = GetTileTypeAtTilePos(param_1->tilePos, param_1->tileLayer);
if (param_1->tileType == tileType) {
SetLocalFlag(param_1->flag);
}

View File

@ -54,9 +54,9 @@ void DiggingCaveEntranceManager_Init(DiggingCaveEntranceManager* this) {
tileIndex = SPECIAL_TILE_128;
for (entrance = GetDiggingCaveEntranceForRoom(entrance, room); entrance != 0;
entrance = GetDiggingCaveEntranceForRoom(entrance, room)) {
SetTile(tileIndex, entrance->sourceTilePosition + TILE_POS(-1, 1), LAYER_BOTTOM);
SetTile(tileIndex, entrance->sourceTilePosition + TILE_POS(0, 1), LAYER_BOTTOM);
SetTile(tileIndex, entrance->sourceTilePosition + TILE_POS(1, 1), LAYER_BOTTOM);
SetTile(tileIndex, entrance->sourceTilePos + TILE_POS(-1, 1), LAYER_BOTTOM);
SetTile(tileIndex, entrance->sourceTilePos + TILE_POS(0, 1), LAYER_BOTTOM);
SetTile(tileIndex, entrance->sourceTilePos + TILE_POS(1, 1), LAYER_BOTTOM);
entrance++;
}
}
@ -80,8 +80,8 @@ bool32 DiggingCaveEntranceManager_CheckEnterEntrance(DiggingCaveEntranceManager*
if (gDiggingCaveEntranceTransition.isDiggingCave) {
offsetX = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x;
offsetY = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y;
offsetX2 = (entr->sourceTilePosition & TILE_POS_X_COMPONENT) * 16 + 8;
offsetY2 = ((entr->sourceTilePosition & TILE_POS_Y_COMPONENT) >> 6) * 16 + 0x18;
offsetX2 = (entr->sourceTilePos & TILE_POS_X_COMPONENT) * 16 + 8;
offsetY2 = ((entr->sourceTilePos & TILE_POS_Y_COMPONENT) >> 6) * 16 + 0x18;
tmp = offsetX - offsetX2;
if (tmp + 0x18 > 0x30 || offsetY - offsetY2 + 8 > 0x10U)
return FALSE;
@ -90,9 +90,9 @@ bool32 DiggingCaveEntranceManager_CheckEnterEntrance(DiggingCaveEntranceManager*
DiggingCaveEntranceManager_EnterEntrance(this, entr);
return TRUE;
} else {
if (COORD_TO_TILE(&gPlayerEntity.base) != entr->sourceTilePosition)
if (COORD_TO_TILE(&gPlayerEntity.base) != entr->sourceTilePos)
return FALSE;
offsetY2 = gRoomControls.origin_y + ((entr->sourceTilePosition >> 6) << 4) + 6;
offsetY2 = gRoomControls.origin_y + ((entr->sourceTilePos >> 6) << 4) + 6;
if (gPlayerEntity.base.y.HALF.HI >= offsetY2)
return FALSE;
DiggingCaveEntranceManager_EnterEntrance(this, entr);
@ -111,9 +111,9 @@ void DiggingCaveEntranceManager_EnterEntrance(DiggingCaveEntranceManager* this,
gRoomControls.room = entr->targetRoom;
gDiggingCaveEntranceTransition.entrance = entr;
gDiggingCaveEntranceTransition.offsetX = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x -
((entr->sourceTilePosition & TILE_POS_X_COMPONENT) * 16);
((entr->sourceTilePos & TILE_POS_X_COMPONENT) * 16);
gDiggingCaveEntranceTransition.offsetY = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y -
((entr->sourceTilePosition & TILE_POS_Y_COMPONENT) >> 2);
((entr->sourceTilePos & TILE_POS_Y_COMPONENT) >> 2);
#ifndef EU
isDiggingCave = gDiggingCaveEntranceTransition.isDiggingCave;
@ -130,7 +130,7 @@ void DiggingCaveEntranceManager_EnterEntrance(DiggingCaveEntranceManager* this,
}
const DiggingCaveEntrance* GetDiggingCaveEntranceForRoom(const DiggingCaveEntrance* entr, int room) {
for (; entr->sourceTilePosition != 0xffff; entr++) {
for (; entr->sourceTilePos != 0xffff; entr++) {
if (entr->sourceRoom == room)
return entr;
}

View File

@ -15,18 +15,18 @@
void FlameManager_Main(FlameManager* this) {
if (super->action == 0) {
this->tilePos = TILE(this->tilePos, this->field_0x3a);
if (GetTileType(this->tilePos, LAYER_TOP) == TILE_TYPE_117) {
if (GetTileTypeAtTilePos(this->tilePos, LAYER_TOP) == TILE_TYPE_117) {
super->action = 1;
SetTile(SPECIAL_TILE_106, this->tilePos, LAYER_BOTTOM);
} else {
DeleteThisEntity();
}
}
if (GetTileType(this->tilePos, LAYER_BOTTOM) == SPECIAL_TILE_107) {
if (GetTileTypeAtTilePos(this->tilePos, LAYER_BOTTOM) == SPECIAL_TILE_107) {
sub_0807B7D8(TILE_TYPE_118, this->tilePos, LAYER_TOP);
DeleteThisEntity();
}
if (GetTileType(this->tilePos, LAYER_TOP) == TILE_TYPE_118) {
if (GetTileTypeAtTilePos(this->tilePos, LAYER_TOP) == TILE_TYPE_118) {
SetTile(SPECIAL_TILE_107, this->tilePos, LAYER_BOTTOM);
DeleteThisEntity();
}

View File

@ -79,7 +79,7 @@ void LightLevelSetManager_Type2(LightLevelSetManager* this) {
((s16)this->field_0x38 >> 4 & 0x3fU) | ((s32)((this->field_0x3a << 0x10) >> 0x14 & 0x3fU) << 6);
super->action = 1;
} else {
if (GetTileType(this->field_0x20, super->type2) == TILE_TYPE_118) {
if (GetTileTypeAtTilePos(this->field_0x20, super->type2) == TILE_TYPE_118) {
SetFlag(this->field_0x3e);
ChangeLightLevel(super->timer);
DeleteThisEntity();
@ -103,7 +103,7 @@ void LightLevelSetManager_Type3(LightLevelSetManager* this) {
break;
case 1:
if (GetTileType(this->field_0x20, super->type2) != TILE_TYPE_118) {
if (GetTileTypeAtTilePos(this->field_0x20, super->type2) != TILE_TYPE_118) {
return;
}
SetFlag(this->field_0x3e);

View File

@ -32,7 +32,7 @@ void sub_0805CBD0(Manager29* this) {
super->action = 1;
this->unk_38 = (this->unk_38 >> 4 & 0x3fU) | (((this->unk_3a << 0x10) >> 0x14 & 0x3fU) << 6);
this->unk_3a = (this->unk_3c >> 4 & 0x3f) | (((this->unk_36 + this->unk_37 * 0x100) >> 4 & 0x3fU) << 6);
this->unk_3c = GetTileType(this->unk_38, this->layer);
this->unk_3c = GetTileTypeAtTilePos(this->unk_38, this->layer);
mapLayer = GetLayerByIndex(this->layer);
this->unk_28 = (u16*)mapLayer->tileTypes;
this->unk_2c = &mapLayer->mapData[(s16)this->unk_3a];

View File

@ -42,7 +42,7 @@ void MinishPortalManager_Main(MinishPortalManager* this) {
gArea.portal_mode = 3;
}
}
if (GetVvvAtRoomCoords(this->unk_38, this->unk_3a, super->timer) == VVV_61) {
if (GetActTileAtRoomCoords(this->unk_38, this->unk_3a, super->timer) == ACT_TILE_61) {
CreateMagicSparkles(this->unk_38 + gRoomControls.origin_x, this->unk_3a + gRoomControls.origin_y,
super->timer);
if (super->subtimer == 0) {

View File

@ -121,7 +121,7 @@ void MiscManager_Type0(MiscManager* this) {
void sub_08058F44(u32 x, u32 y, u32 flag) {
if (CheckRoomFlag(flag))
return;
if (sub_080B1A48(x, y, LAYER_BOTTOM) != TILE_TYPE_97)
if (GetTileTypeAtRoomCoords(x, y, LAYER_BOTTOM) != TILE_TYPE_97)
return;
SetTileType(TILE_TYPE_38, ((x >> 4) & 0x3F) | (((y >> 4) & 0x3F) << 6), LAYER_BOTTOM);
sub_08058F84(x, y);

View File

@ -31,7 +31,7 @@ void TilePuzzleManager_Main(TilePuzzleManager* this) {
this->player_current_tile = COORD_TO_TILE((&gPlayerEntity.base));
if (this->player_current_tile != this->player_previous_tile) {
this->player_previous_tile = this->player_current_tile;
switch (GetTileType(this->player_current_tile, super->type2)) {
switch (GetTileTypeAtTilePos(this->player_current_tile, super->type2)) {
case TILE_TYPE_791:
// stepped on a red tile again
super->action = FAILED;

View File

@ -2162,7 +2162,7 @@ bool32 ProcessMovement3(Entity* this) {
}
bool32 sub_080AF0C8(Entity* this) {
u32 tileType = GetTileTypeByEntity(this);
u32 tileType = GetTileTypeAtEntity(this);
switch (tileType) {
case 0x87:
if (((this->direction + 7) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth |

View File

@ -530,11 +530,11 @@ u32 CalcJumpDirection(Entity* this) {
};
static const u8 sTable[] = {
// vvv, animationState
VVV_43, DirectionSouth, VVV_42, DirectionNorth, VVV_45, DirectionEast, VVV_44, DirectionWest, 0x0,
// actTile, animationState
ACT_TILE_43, DirectionSouth, ACT_TILE_42, DirectionNorth, ACT_TILE_45, DirectionEast, ACT_TILE_44, DirectionWest, 0x0,
};
u32 vvv;
u32 actTile;
u32 x;
s32 x_offset;
s32 y_offset;
@ -544,11 +544,11 @@ u32 CalcJumpDirection(Entity* this) {
ptr = (s8*)sOffsets;
x_offset = ptr[x];
y_offset = ptr[x + 1];
vvv = GetVvvRelativeToEntity(this, x_offset, y_offset);
actTile = GetActTileRelativeToEntity(this, x_offset, y_offset);
ptr2 = sTable;
do {
if (*ptr2 != vvv || this->animationState != (ptr2[1] >> 2)) {
if (*ptr2 != actTile || this->animationState != (ptr2[1] >> 2)) {
continue;
}

View File

@ -811,8 +811,8 @@ void sub_0806B0E0(Entity* this, ScriptExecutionContext* context) {
int idx = 0;
// Checks if the dust is gone at these four tiles.
if (GetVvvAtRoomCoords(56, 184, 1) == VVV_87 && GetVvvAtRoomCoords(72, 184, 1) == VVV_87 &&
GetVvvAtRoomCoords(56, 200, 1) == VVV_87 && GetVvvAtRoomCoords(72, 200, 1) == VVV_87) {
if (GetActTileAtRoomCoords(56, 184, 1) == ACT_TILE_87 && GetActTileAtRoomCoords(72, 184, 1) == ACT_TILE_87 &&
GetActTileAtRoomCoords(56, 200, 1) == ACT_TILE_87 && GetActTileAtRoomCoords(72, 200, 1) == ACT_TILE_87) {
idx = 1;
}

View File

@ -333,18 +333,18 @@ void Beanstalk_Action1Type9(BeanstalkEntity* this) {
if (super->subAction == 0) {
super->subAction = 1;
super->y.HALF.HI += 0x28;
this->unk_72 = sub_080B1A0C(super, 0, -24);
this->unk_72 = GetTileTypeRelativeToEntity(super, 0, -24);
}
super->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY;
super->spriteRendering.b3 = gPlayerEntity.base.spriteRendering.b3;
if (gPlayerState.floor_type == SURFACE_LADDER) {
super->spritePriority.b0 = 0;
if (sub_080B1A0C(super, 0, -24) != SPECIAL_TILE_20) {
if (GetTileTypeRelativeToEntity(super, 0, -24) != SPECIAL_TILE_20) {
SetTile(SPECIAL_TILE_20, COORD_TO_TILE_OFFSET(super, 0, 24), LAYER_BOTTOM);
}
} else {
super->spritePriority.b0 = 5;
if (this->unk_72 != sub_080B1A0C(super, 0, -24)) {
if (this->unk_72 != GetTileTypeRelativeToEntity(super, 0, -24)) {
SetTile(this->unk_72, COORD_TO_TILE_OFFSET(super, 0, 24), LAYER_BOTTOM);
}
}

View File

@ -127,7 +127,7 @@ void sub_08099880(BigIceBlockEntity* this) {
void sub_08099910(BigIceBlockEntity* this) {
u32 uVar2;
s32 vvv;
s32 actTile;
u32 tileIndex;
u32 tilePos;
@ -144,109 +144,109 @@ void sub_08099910(BigIceBlockEntity* this) {
SetTile(SPECIAL_TILE_34, tilePos, super->collisionLayer);
break;
case 1:
vvv = GetVvvAtTilePos(tilePos - 0x41, super->collisionLayer);
actTile = GetActTileAtTilePos(tilePos - 0x41, super->collisionLayer);
tileIndex = SPECIAL_TILE_36;
if (vvv == VVV_18) {
if (actTile == ACT_TILE_18) {
tileIndex = SPECIAL_TILE_121;
}
SetTile(tileIndex, tilePos - 0x41, super->collisionLayer);
SetTile(SPECIAL_TILE_34, tilePos - 0x40, super->collisionLayer);
vvv = GetVvvAtTilePos(tilePos - 0x3f, super->collisionLayer);
actTile = GetActTileAtTilePos(tilePos - 0x3f, super->collisionLayer);
tileIndex = SPECIAL_TILE_37;
if (vvv == VVV_18) {
if (actTile == ACT_TILE_18) {
tileIndex = SPECIAL_TILE_123;
}
SetTile(tileIndex, tilePos - 0x3f, super->collisionLayer);
vvv = GetVvvAtTilePos(tilePos - 1, super->collisionLayer);
actTile = GetActTileAtTilePos(tilePos - 1, super->collisionLayer);
tileIndex = SPECIAL_TILE_36;
if (vvv == VVV_18) {
if (actTile == ACT_TILE_18) {
tileIndex = SPECIAL_TILE_121;
}
SetTile(tileIndex, tilePos - 1, super->collisionLayer);
SetTile(SPECIAL_TILE_34, tilePos, super->collisionLayer);
vvv = GetVvvAtTilePos(tilePos + 1, super->collisionLayer);
actTile = GetActTileAtTilePos(tilePos + 1, super->collisionLayer);
tileIndex = SPECIAL_TILE_37;
if (vvv == VVV_18) {
if (actTile == ACT_TILE_18) {
tileIndex = SPECIAL_TILE_123;
}
SetTile(tileIndex, tilePos + 1, super->collisionLayer);
return;
break;
case 2:
vvv = GetVvvAtTilePos(tilePos - 0x41, super->collisionLayer);
actTile = GetActTileAtTilePos(tilePos - 0x41, super->collisionLayer);
tileIndex = SPECIAL_TILE_35;
if (vvv == VVV_18) {
if (actTile == ACT_TILE_18) {
tileIndex = SPECIAL_TILE_119;
}
SetTile(tileIndex, tilePos - 0x41, super->collisionLayer);
vvv = GetVvvAtTilePos(tilePos - 0x40, super->collisionLayer);
actTile = GetActTileAtTilePos(tilePos - 0x40, super->collisionLayer);
tileIndex = SPECIAL_TILE_35;
if (vvv == VVV_18) {
if (actTile == ACT_TILE_18) {
tileIndex = SPECIAL_TILE_119;
}
SetTile(tileIndex, tilePos - 0x40, super->collisionLayer);
SetTile(SPECIAL_TILE_34, tilePos - 1, super->collisionLayer);
SetTile(SPECIAL_TILE_34, tilePos, super->collisionLayer);
vvv = GetVvvAtTilePos(tilePos + 0x3f, super->collisionLayer);
actTile = GetActTileAtTilePos(tilePos + 0x3f, super->collisionLayer);
tileIndex = SPECIAL_TILE_38;
if (vvv == VVV_18) {
if (actTile == ACT_TILE_18) {
tileIndex = SPECIAL_TILE_124;
}
SetTile(tileIndex, tilePos + 0x3f, super->collisionLayer);
vvv = GetVvvAtTilePos(tilePos + 0x40, super->collisionLayer);
actTile = GetActTileAtTilePos(tilePos + 0x40, super->collisionLayer);
tileIndex = SPECIAL_TILE_38;
if (vvv == VVV_18) {
if (actTile == ACT_TILE_18) {
tileIndex = SPECIAL_TILE_124;
}
SetTile(tileIndex, tilePos + 0x40, super->collisionLayer);
break;
case 3:
vvv = GetVvvAtTilePos(tilePos - 0x41, super->collisionLayer);
actTile = GetActTileAtTilePos(tilePos - 0x41, super->collisionLayer);
tileIndex = SPECIAL_TILE_39;
if (vvv == VVV_18) {
if (actTile == ACT_TILE_18) {
tileIndex = SPECIAL_TILE_117;
}
SetTile(tileIndex, tilePos - 0x41, super->collisionLayer);
vvv = GetVvvAtTilePos(tilePos - 0x40, super->collisionLayer);
actTile = GetActTileAtTilePos(tilePos - 0x40, super->collisionLayer);
tileIndex = SPECIAL_TILE_35;
if (vvv == VVV_18) {
if (actTile == ACT_TILE_18) {
tileIndex = SPECIAL_TILE_119;
}
SetTile(tileIndex, tilePos - 0x40, super->collisionLayer);
vvv = GetVvvAtTilePos(tilePos - 0x3f, super->collisionLayer);
actTile = GetActTileAtTilePos(tilePos - 0x3f, super->collisionLayer);
tileIndex = SPECIAL_TILE_40;
if (vvv == VVV_18) {
if (actTile == ACT_TILE_18) {
tileIndex = SPECIAL_TILE_118;
}
SetTile(tileIndex, tilePos - 0x3f, super->collisionLayer);
vvv = GetVvvAtTilePos(tilePos - 1, super->collisionLayer);
actTile = GetActTileAtTilePos(tilePos - 1, super->collisionLayer);
tileIndex = SPECIAL_TILE_36;
if (vvv == VVV_18) {
if (actTile == ACT_TILE_18) {
tileIndex = SPECIAL_TILE_121;
}
SetTile(tileIndex, tilePos - 1, super->collisionLayer);
SetTile(SPECIAL_TILE_34, tilePos, super->collisionLayer);
vvv = GetVvvAtTilePos(tilePos + 1, super->collisionLayer);
actTile = GetActTileAtTilePos(tilePos + 1, super->collisionLayer);
tileIndex = SPECIAL_TILE_37;
if (vvv == VVV_18) {
if (actTile == ACT_TILE_18) {
tileIndex = SPECIAL_TILE_123;
}
SetTile(tileIndex, tilePos + 1, super->collisionLayer);
vvv = GetVvvAtTilePos(tilePos + 0x3f, super->collisionLayer);
actTile = GetActTileAtTilePos(tilePos + 0x3f, super->collisionLayer);
tileIndex = SPECIAL_TILE_41;
if (vvv == VVV_18) {
if (actTile == ACT_TILE_18) {
tileIndex = SPECIAL_TILE_120;
}
SetTile(tileIndex, tilePos + 0x3f, super->collisionLayer);
vvv = GetVvvAtTilePos(tilePos + 0x40, super->collisionLayer);
actTile = GetActTileAtTilePos(tilePos + 0x40, super->collisionLayer);
tileIndex = SPECIAL_TILE_38;
if (vvv == VVV_18) {
if (actTile == ACT_TILE_18) {
tileIndex = SPECIAL_TILE_124;
}
SetTile(tileIndex, tilePos + 0x40, super->collisionLayer);
vvv = GetVvvAtTilePos(tilePos + 0x41, super->collisionLayer);
actTile = GetActTileAtTilePos(tilePos + 0x41, super->collisionLayer);
tileIndex = SPECIAL_TILE_42;
if (vvv == VVV_18) {
if (actTile == ACT_TILE_18) {
tileIndex = SPECIAL_TILE_122;
}
SetTile(tileIndex, tilePos + 0x41, super->collisionLayer);

View File

@ -11,8 +11,8 @@
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unk_68[8];
/*0x70*/ u16 tilePositionUpper;
/*0x72*/ u16 tilePositionLower;
/*0x70*/ u16 tilePosUpper;
/*0x72*/ u16 tilePosLower;
/*0x74*/ u16 tileIndexUpper;
/*0x76*/ u16 tileIndexLower;
/*0x78*/ u8 unk_78[12];
@ -48,8 +48,8 @@ void BigPushableLever_Init(BigPushableLeverEntity* this) {
void BigPushableLever_Idle(BigPushableLeverEntity* this) {
if (BigPushableLever_ShouldStartPushing(this)) {
super->action = PUSHING;
SetTile(this->tileIndexUpper, this->tilePositionUpper, super->collisionLayer);
SetTile(this->tileIndexLower, this->tilePositionLower, super->collisionLayer);
SetTile(this->tileIndexUpper, this->tilePosUpper, super->collisionLayer);
SetTile(this->tileIndexLower, this->tilePosLower, super->collisionLayer);
EnqueueSFX(SFX_132);
RequestPriorityDuration(super, 30);
if (PlayerCanBeMoved()) {
@ -84,32 +84,32 @@ void BigPushableLever_SetIdle(BigPushableLeverEntity* this) {
void BigPushableLever_SetTiles(BigPushableLeverEntity* this) {
if (!CheckFlags(this->pushedFlag)) {
super->type2 = 0;
this->tilePositionUpper = COORD_TO_TILE_OFFSET(super, 0, 0x10);
this->tilePositionLower = this->tilePositionUpper - 0x40;
this->tileIndexUpper = GetTileIndex(this->tilePositionUpper, super->collisionLayer);
this->tileIndexLower = GetTileIndex(this->tilePositionLower, super->collisionLayer);
SetTile(SPECIAL_TILE_87, this->tilePositionUpper, super->collisionLayer);
SetTile(SPECIAL_TILE_88, this->tilePositionLower, super->collisionLayer);
this->tilePosUpper = COORD_TO_TILE_OFFSET(super, 0, 0x10);
this->tilePosLower = this->tilePosUpper - 0x40;
this->tileIndexUpper = GetTileIndex(this->tilePosUpper, super->collisionLayer);
this->tileIndexLower = GetTileIndex(this->tilePosLower, super->collisionLayer);
SetTile(SPECIAL_TILE_87, this->tilePosUpper, super->collisionLayer);
SetTile(SPECIAL_TILE_88, this->tilePosLower, super->collisionLayer);
InitializeAnimation(super, 1);
} else {
super->type2 = 1;
this->tilePositionUpper = COORD_TO_TILE_OFFSET(super, 0x10, 0);
this->tilePositionLower = this->tilePositionUpper - 1;
this->tileIndexUpper = GetTileIndex(this->tilePositionUpper, super->collisionLayer);
this->tileIndexLower = GetTileIndex(this->tilePositionLower, super->collisionLayer);
SetTile(SPECIAL_TILE_85, this->tilePositionUpper, super->collisionLayer);
SetTile(SPECIAL_TILE_86, this->tilePositionLower, super->collisionLayer);
this->tilePosUpper = COORD_TO_TILE_OFFSET(super, 0x10, 0);
this->tilePosLower = this->tilePosUpper - 1;
this->tileIndexUpper = GetTileIndex(this->tilePosUpper, super->collisionLayer);
this->tileIndexLower = GetTileIndex(this->tilePosLower, super->collisionLayer);
SetTile(SPECIAL_TILE_85, this->tilePosUpper, super->collisionLayer);
SetTile(SPECIAL_TILE_86, this->tilePosLower, super->collisionLayer);
InitializeAnimation(super, 0);
}
}
bool32 BigPushableLever_ShouldStartPushing(BigPushableLeverEntity* this) {
if (GetTileIndex(this->tilePositionLower, super->collisionLayer) == SPECIAL_TILE_89) {
if (GetTileIndex(this->tilePosLower, super->collisionLayer) == SPECIAL_TILE_89) {
if (--this->timer == 0) {
return TRUE;
}
BigPushableLever_CalculateSpriteOffsets(this);
SetTile(gUnk_081236E8[super->type2], this->tilePositionLower, super->collisionLayer);
SetTile(gUnk_081236E8[super->type2], this->tilePosLower, super->collisionLayer);
} else {
this->timer = 60;
super->spriteOffsetX = 0;

View File

@ -45,7 +45,7 @@ void BlockPushed_Init(BlockPushedEntity* this) {
super->x.HALF.HI += tmp;
super->y.HALF.HI += tmp;
super->hitbox = (Hitbox*)gUnk_0811F64C[super->type];
this->unk_68 = GetTileType(tilePos, super->collisionLayer);
this->unk_68 = GetTileTypeAtTilePos(tilePos, super->collisionLayer);
switch (super->type) {
case 0:
sub_080832D8(tilePos, this);

View File

@ -44,7 +44,7 @@ void Button_Init(ButtonEntity* this) {
}
this->tilePos = (((super->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3F) |
((((super->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3F) << 6);
this->unk_72 = GetTileType(this->tilePos, super->collisionLayer);
this->unk_72 = GetTileTypeAtTilePos(this->tilePos, super->collisionLayer);
if (super->type == 0 && CheckFlags(this->unk_86)) {
super->action = 5;
SetTileType(TILE_TYPE_122, this->tilePos, super->collisionLayer);
@ -60,7 +60,7 @@ void Button_Init(ButtonEntity* this) {
void Button_Action1(ButtonEntity* this) {
if (sub_08081E3C(this)) {
super->action = 2;
this->unk_72 = GetTileType(this->tilePos, super->collisionLayer);
this->unk_72 = GetTileTypeAtTilePos(this->tilePos, super->collisionLayer);
}
}
@ -132,12 +132,12 @@ bool32 sub_08081CB0(ButtonEntity* this) {
u16 tileType;
if (sub_08081D74(this)) {
this->unk_70 = -1;
if (GetTileType(this->tilePos, super->collisionLayer) == SPECIAL_TILE_53) {
if (GetTileTypeAtTilePos(this->tilePos, super->collisionLayer) == SPECIAL_TILE_53) {
sub_0807B7D8(0x78, this->tilePos, super->collisionLayer);
}
return TRUE;
} else {
tileType = GetTileType(this->tilePos, super->collisionLayer);
tileType = GetTileTypeAtTilePos(this->tilePos, super->collisionLayer);
if (tileType != 0x77 && tileType != 0x79 && tileType != SPECIAL_TILE_53) {
this->unk_70 = GetTileIndex(this->tilePos, super->collisionLayer);
return TRUE;
@ -204,7 +204,7 @@ u32 sub_08081E3C(ButtonEntity* this) {
};
const u16* tmp1;
s32 tmp2;
tmp2 = GetTileType(this->tilePos, super->collisionLayer);
tmp2 = GetTileTypeAtTilePos(this->tilePos, super->collisionLayer);
tmp1 = gUnk_0811EE50;
do {
if (*tmp1 == tmp2)
@ -223,21 +223,21 @@ void sub_08081E6C(ButtonEntity* this) {
u32 tileType;
MapLayer* mapLayer;
u16* tmp2;
u16* tmp;
u16* subTiles;
u16* tmp3;
u32 tilePos = this->tilePos;
u32 layer = super->collisionLayer;
u32 specialTile = GetTileType(tilePos, layer);
u32 specialTile = GetTileTypeAtTilePos(tilePos, layer);
if (specialTile < 0x4000)
return;
mapLayer = GetLayerByIndex(layer);
tileType = (super->type == 0 ? TILE_TYPE_122 : TILE_TYPE_120);
tmp = mapLayer->tiles;
tmp = tmp + (mapLayer->unkData2[tileType] << 2);
subTiles = mapLayer->subTiles;
subTiles = subTiles + (mapLayer->tileIndices[tileType] << 2);
tmp2 = (layer == 2 ? gMapDataTopSpecial : gMapDataBottomSpecial);
tmp2 += (((0x3f & tilePos) << 1) + ((0xfc0 & tilePos) << 2));
if (sub_08081F00((u32*)tmp2, (u32*)tmp))
if (sub_08081F00((u32*)tmp2, (u32*)subTiles))
return;
SetTileType(tileType, tilePos, layer);
SetTile(specialTile, tilePos, layer);

View File

@ -232,7 +232,7 @@ void ChestSpawner_Type0Init(ChestSpawnerEntity* this) {
super->action++;
this->tilePos = COORD_TO_TILE(super);
super->hitbox = (Hitbox*)&gUnk_0811F8A8;
if (GetTileTypeByEntity(super) == TILE_TYPE_116) {
if (GetTileTypeAtEntity(super) == TILE_TYPE_116) {
DeleteThisEntity();
}
if (CheckFlags(this->unk_86)) {
@ -271,7 +271,7 @@ void ChestSpawner_Type0Action2(ChestSpawnerEntity* this) {
void ChestSpawner_Type0Action3(ChestSpawnerEntity* this) {
if ((super->type == 1) || (super->type == 7)) {
if (GetTileTypeByEntity(super) == TILE_TYPE_116) {
if (GetTileTypeAtEntity(super) == TILE_TYPE_116) {
DeleteEntity(super);
} else {
if (!CheckFlags(this->unk_86)) {

View File

@ -168,13 +168,13 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) {
tmp = gPlayerEntity.base.animationState & 6;
this->unk_70 = ((super->x.HALF.HI + (s8)gUnk_08123184[tmp]) & -0x10) | 8;
this->unk_72 = ((super->y.HALF.HI + (s8)gUnk_08123184[(tmp) + 1]) & -0x10) | 8;
if (GetVvvAtWorldCoords(this->unk_70, this->unk_72, super->collisionLayer) == VVV_25) {
if (GetActTileAtWorldCoords(this->unk_70, this->unk_72, super->collisionLayer) == ACT_TILE_25) {
gHUD.rActionPlayerState = R_ACTION_THROW;
} else {
gHUD.rActionPlayerState = R_ACTION_NONE;
}
PositionRelative(&gPlayerEntity.base, super, 0, 0x10000);
if (GetVvvAtEntity(super) == VVV_25) {
if (GetActTileAtEntity(super) == ACT_TILE_25) {
RestorePrevTileEntity(0xdc, super->collisionLayer);
sub_08096A78(this);
}
@ -233,7 +233,7 @@ void CrenelBeanSprout_Action3(CrenelBeanSproutEntity* this) {
void CrenelBeanSprout_Action4(CrenelBeanSproutEntity* this) {
static const u16 gUnk_0812319C[] = { SPECIAL_TILE_60, SPECIAL_TILE_51 };
if (gUnk_0812319C[super->type >> 1] == GetTileTypeByEntity(super)) {
if (gUnk_0812319C[super->type >> 1] == GetTileTypeAtEntity(super)) {
GetNextFrame(super);
gPlayerState.keepFacing |= 0x80;
gPlayerState.field_0xa |= 0x80;

View File

@ -332,7 +332,7 @@ void CutsceneMiscObject_Type5(CutsceneMiscObjectEntity* this) {
super->zVelocity = 0;
SetEntityPriority(super, PRIO_PLAYER_EVENT);
InitializeAnimation(super, 0);
if (GetVvvAtEntity(super) == VVV_13) {
if (GetActTileAtEntity(super) == ACT_TILE_13) {
super->action = 3;
}
break;

View File

@ -73,7 +73,7 @@ void DoubleBookshelf_Init(DoubleBookshelfEntity* this) {
}
void DoubleBookshelf_Action1(DoubleBookshelfEntity* this) {
GetTileType(this->unk_82, super->collisionLayer);
GetTileTypeAtTilePos(this->unk_82, super->collisionLayer);
sub_0809B234(this);
}

View File

@ -50,7 +50,7 @@ void Fireplace_Action1(FireplaceEntity* this) {
}
void sub_0809B7C0(FireplaceEntity* this) {
u32 tileType = GetTileTypeByEntity(super);
u32 tileType = GetTileTypeAtEntity(super);
if (tileType != SPECIAL_TILE_97 && tileType != SPECIAL_TILE_98) {
sub_0809B7DC(this);
}

View File

@ -261,7 +261,7 @@ static void FurnitureInit(FurnitureEntity* this) {
for (i = 0; i < cnt; ++i, ++tilePos) {
SetTile(SPECIAL_TILE_38, tilePos, LAYER_TOP);
SetTile(SPECIAL_TILE_38, tilePos, LAYER_BOTTOM);
SetVvvAtTilePos(VVV_0, tilePos + TILE_POS(0, 1), 1);
SetActTileAtTilePos(ACT_TILE_0, tilePos + TILE_POS(0, 1), 1);
}
break;
}
@ -287,7 +287,7 @@ static void FurnitureInit(FurnitureEntity* this) {
super->collisionLayer = 1;
super->spriteOrientation.flipY = 2;
SetTile(SPECIAL_TILE_116, this->tilePos - 64, super->collisionLayer);
SetVvvAtTilePos(VVV_63, this->tilePos - 64, super->collisionLayer);
SetActTileAtTilePos(ACT_TILE_63, this->tilePos - 64, super->collisionLayer);
SetTile(SPECIAL_TILE_23, this->tilePos, super->collisionLayer);
SetTile(SPECIAL_TILE_23, this->tilePos + 64, super->collisionLayer);
break;
@ -339,7 +339,7 @@ static void FurnitureUpdate(FurnitureEntity* this) {
case 0x80:
if (gPlayerEntity.base.y.HALF.HI < super->y.HALF.HI + 8) {
if (gPlayerState.floor_type != SURFACE_LADDER &&
GetTileTypeByEntity(super) == SPECIAL_TILE_23) {
GetTileTypeAtEntity(super) == SPECIAL_TILE_23) {
SetTile(SPECIAL_TILE_38, this->tilePos, super->collisionLayer);
SetTile(SPECIAL_TILE_61, this->tilePos + TILE_POS(0, -1), super->collisionLayer);
SetTile(SPECIAL_TILE_61, this->tilePos + TILE_POS(0, -2), super->collisionLayer);
@ -349,7 +349,7 @@ static void FurnitureUpdate(FurnitureEntity* this) {
gPlayerEntity.base.collisionLayer = 1;
UpdateSpriteForCollisionLayer(&gPlayerEntity.base);
}
if (GetTileTypeByEntity(super) != SPECIAL_TILE_23) {
if (GetTileTypeAtEntity(super) != SPECIAL_TILE_23) {
SetTile(SPECIAL_TILE_23, this->tilePos, super->collisionLayer);
SetTile(SPECIAL_TILE_23, this->tilePos + TILE_POS(0, -1), super->collisionLayer);
SetTile(SPECIAL_TILE_20, this->tilePos + TILE_POS(0, -2), super->collisionLayer);

View File

@ -83,5 +83,5 @@ void sub_0808E55C(GiantBookLadderEntity* this) {
}
u32 sub_0808E670(GiantBookLadderEntity* this) {
return GetTileType(this->unk74 - 0x101, LAYER_BOTTOM);
return GetTileTypeAtTilePos(this->unk74 - 0x101, LAYER_BOTTOM);
}

View File

@ -55,7 +55,7 @@ void HiddenLadderDown_Init(HiddenLadderDownEntity* this) {
}
void HiddenLadderDown_Action1(HiddenLadderDownEntity* this) {
if (GetTileType(this->unk_70, super->collisionLayer) == 0x1a6) {
if (GetTileTypeAtTilePos(this->unk_70, super->collisionLayer) == 0x1a6) {
super->action = 2;
super->spriteSettings.draw = TRUE;
SetFlag(this->unk_86);

View File

@ -218,7 +218,7 @@ void sub_08081188(ItemOnGroundEntity* this) {
void sub_080811AC(ItemOnGroundEntity* this) {
super->action = 2;
super->spriteSettings.draw = 0;
this->unk_6e = GetTileTypeByEntity(super);
this->unk_6e = GetTileTypeAtEntity(super);
}
void sub_080811C8(ItemOnGroundEntity* this) {
@ -285,7 +285,7 @@ void sub_080812A0(ItemOnGroundEntity* this) {
void sub_080812A8(ItemOnGroundEntity* this) {
if (GetCollisionDataAtEntity(super) != COLLISION_DATA_15 &&
this->unk_6e != GetTileTypeByEntity(super)) {
this->unk_6e != GetTileTypeAtEntity(super)) {
super->direction = 0;
super->speed = 0;
super->spriteSettings.draw = 1;

View File

@ -67,12 +67,12 @@ void LadderUp(Entity* this) {
if (this->type2 == 0) {
if (gPlayerEntity.base.y.HALF.HI < this->y.HALF.HI) {
if (gPlayerState.floor_type != SURFACE_LADDER &&
(GetTileTypeByEntity(this) == SPECIAL_TILE_23)) {
(GetTileTypeAtEntity(this) == SPECIAL_TILE_23)) {
SetTile(SPECIAL_TILE_35, COORD_TO_TILE(this), this->collisionLayer);
RestorePrevTileEntity(COORD_TO_TILE_OFFSET(this, 0, 16), this->collisionLayer);
}
} else {
if (GetTileTypeByEntity(this) != SPECIAL_TILE_23) {
if (GetTileTypeAtEntity(this) != SPECIAL_TILE_23) {
SetTile(SPECIAL_TILE_23, COORD_TO_TILE(this), this->collisionLayer);
if (this->type == 0) {
SetTile(SPECIAL_TILE_23, COORD_TO_TILE_OFFSET(this, 0, 16), this->collisionLayer);

View File

@ -331,10 +331,10 @@ void LilypadLarge_Action2(LilypadLargeEntity* this) {
void sub_08085A44(LilypadLargeEntity* this) {
super->speed = 0x200;
if (GetVvvRelativeToEntity(super, 0x10, 0x18) != VVV_17) {
if (GetActTileRelativeToEntity(super, 0x10, 0x18) != ACT_TILE_17) {
super->direction = 0x18;
} else {
if (GetVvvRelativeToEntity(super, -0x10, 0x18) != VVV_17) {
if (GetActTileRelativeToEntity(super, -0x10, 0x18) != ACT_TILE_17) {
super->direction = 8;
} else {
super->direction = 0x10;
@ -355,7 +355,7 @@ void sub_08085A98(LilypadLargeEntity* this) {
this->unk_78.WORD -= 0x20000;
SetAffineInfo(super, this->unk_78.HALF_U.HI, this->unk_78.HALF_U.HI, this->unk_7c.HALF_U.HI);
}
if (GetVvvRelativeToEntity(super, 0, 0x18) != VVV_17) {
if (GetActTileRelativeToEntity(super, 0, 0x18) != ACT_TILE_17) {
super->subAction = 2;
if (gArea.locationIndex == 27) { // AREA_TEMPLE_OF_DROPLETS
super->y.HALF.HI += 0xd0;
@ -388,7 +388,7 @@ void sub_08085B40(LilypadLargeEntity* this) {
}
} else {
ResetCollisionLayer(super);
if (GetVvvAtEntity(super) == VVV_13) {
if (GetActTileAtEntity(super) == ACT_TILE_13) {
ResetCollisionLayer(&gPlayerEntity.base);
LilypadLarge_Action4(this);
super->direction = GetFacingDirection(&gPlayerEntity.base, super);
@ -410,7 +410,7 @@ void sub_08085B40(LilypadLargeEntity* this) {
super->timer |= 0x80;
this->unk_70 = 0;
this->unk_6c = 0;
if (GetVvvAtEntity(super) == VVV_13) {
if (GetActTileAtEntity(super) == ACT_TILE_13) {
super->action = 4;
}
}
@ -458,7 +458,7 @@ void LilypadLarge_Action5(LilypadLargeEntity* this) {
void sub_08085D28(LilypadLargeEntity* this) {
if (((gPlayerState.framestate != PL_STATE_TALKEZLO) && ((gPlayerState.flags & PL_FLAGS2) != 0)) &&
(GetVvvRelativeToEntity(super, 0, 0x18) == VVV_17)) {
(GetActTileRelativeToEntity(super, 0, 0x18) == ACT_TILE_17)) {
super->action = 2;
super->subAction = 0;
PausePlayer();

View File

@ -15,7 +15,7 @@ typedef struct {
/*0x68*/ u8 unk_68;
} LinkEmptyingBottleEntity;
extern u32 sub_080B1A0C(Entity*, s32, s32);
extern u32 GetTileTypeRelativeToEntity(Entity*, s32, s32);
void LinkEmptyingBottle_Init(LinkEmptyingBottleEntity*);
void LinkEmptyingBottle_Action1(LinkEmptyingBottleEntity*);
@ -118,7 +118,7 @@ void sub_08094980(LinkEmptyingBottleEntity* this, u32 searchTileIndex, u32 repla
while (index < 10) {
xOffset = gUnk_08122A28[index];
yOffset = gUnk_08122A28[index + 1];
if (searchTileIndex == sub_080B1A0C(super, xOffset, yOffset)) {
if (searchTileIndex == GetTileTypeRelativeToEntity(super, xOffset, yOffset)) {
SetTile(replaceTileIndex, TILE(super->x.HALF.HI + xOffset, super->y.HALF.HI + yOffset),
super->collisionLayer);
}

View File

@ -131,7 +131,7 @@ void Minecart_Action2(MinecartEntity* this) {
void Minecart_Action3(MinecartEntity* this) {
static const s8 offsetCoords[] = { 0, -7, 7, 0, 0, 7, -7, 0 };
u32 vvv;
u32 actTile;
gRoomControls.scrollSpeed = 7;
if ((gPlayerState.flags & PL_IN_MINECART) == 0) {
@ -163,14 +163,14 @@ void Minecart_Action3(MinecartEntity* this) {
super->subtimer = 60;
}
vvv = GetVvvRelativeToEntity(super, offsetCoords[super->animationState * 2],
actTile = GetActTileRelativeToEntity(super, offsetCoords[super->animationState * 2],
offsetCoords[super->animationState * 2 + 1]);
if (FindValueForKey(vvv, gUnk_081223D8[super->animationState]) == 0) {
if (FindValueForKey(actTile, gUnk_081223D8[super->animationState]) == 0) {
super->direction = DirectionTurnAround(super->direction);
super->animationState = AnimationStateFlip90(super->animationState);
} else {
switch (vvv) {
case VVV_100:
switch (actTile) {
case ACT_TILE_100:
super->flags &= ~ENT_PERSIST;
super->hitType = 1;
super->collisionFlags = 0x47;
@ -190,15 +190,15 @@ void Minecart_Action3(MinecartEntity* this) {
SoundReq(SFX_PLY_VO4);
SoundReq(SFX_139);
return;
case VVV_103:
case VVV_104:
case VVV_105:
case VVV_106:
case VVV_108:
case VVV_109:
case VVV_110:
case VVV_111:
if (vvv == GetVvvAtEntity(super)) {
case ACT_TILE_103:
case ACT_TILE_104:
case ACT_TILE_105:
case ACT_TILE_106:
case ACT_TILE_108:
case ACT_TILE_109:
case ACT_TILE_110:
case ACT_TILE_111:
if (actTile == GetActTileAtEntity(super)) {
Minecart_Action4(this);
gPlayerEntity.base.animationState = super->animationState << 1;
return;
@ -220,8 +220,8 @@ void Minecart_Action3(MinecartEntity* this) {
void Minecart_Action4(MinecartEntity* this) {
SnapToTile(super);
CopyPosition(super, &gPlayerEntity.base);
switch (GetVvvAtEntity(super)) {
case VVV_103:
switch (GetActTileAtEntity(super)) {
case ACT_TILE_103:
if (super->direction == DirectionWest) {
super->direction = DirectionNorth;
super->animationState = 0;
@ -230,7 +230,7 @@ void Minecart_Action4(MinecartEntity* this) {
super->animationState = 1;
}
break;
case VVV_104:
case ACT_TILE_104:
if (super->direction == DirectionEast) {
super->direction = DirectionSouth;
super->animationState = 2;
@ -239,7 +239,7 @@ void Minecart_Action4(MinecartEntity* this) {
super->animationState = 3;
}
break;
case VVV_105:
case ACT_TILE_105:
if (super->direction == DirectionEast) {
super->direction = DirectionNorth;
super->animationState = 0;
@ -248,7 +248,7 @@ void Minecart_Action4(MinecartEntity* this) {
super->animationState = 3;
}
break;
case VVV_106:
case ACT_TILE_106:
if (super->direction == DirectionWest) {
super->direction = DirectionSouth;
super->animationState = 2;
@ -343,18 +343,18 @@ const KeyValuePair* const gUnk_081223D8[] = {
gUnk_08122436,
};
const KeyValuePair gUnk_081223E8[] = {
{ VVV_242, 1 }, { VVV_101, 1 }, { VVV_104, 1 }, { VVV_106, 1 }, { VVV_100, 1 }, { VVV_41, 1 },
{ ACT_TILE_242, 1 }, { ACT_TILE_101, 1 }, { ACT_TILE_104, 1 }, { ACT_TILE_106, 1 }, { ACT_TILE_100, 1 }, { ACT_TILE_41, 1 },
};
const u16 gUnk_081223E8End = 0;
const KeyValuePair gUnk_08122402[] = {
{ VVV_243, 1 }, { VVV_102, 1 }, { VVV_104, 1 }, { VVV_105, 1 }, { VVV_100, 1 }, { VVV_41, 1 },
{ ACT_TILE_243, 1 }, { ACT_TILE_102, 1 }, { ACT_TILE_104, 1 }, { ACT_TILE_105, 1 }, { ACT_TILE_100, 1 }, { ACT_TILE_41, 1 },
};
const u16 gUnk_08122402End = 0;
const KeyValuePair gUnk_0812241C[] = {
{ VVV_242, 1 }, { VVV_101, 1 }, { VVV_103, 1 }, { VVV_105, 1 }, { VVV_100, 1 }, { VVV_41, 1 },
{ ACT_TILE_242, 1 }, { ACT_TILE_101, 1 }, { ACT_TILE_103, 1 }, { ACT_TILE_105, 1 }, { ACT_TILE_100, 1 }, { ACT_TILE_41, 1 },
};
const u16 gUnk_0812241CEnd = 0;
const KeyValuePair gUnk_08122436[] = {
{ VVV_243, 1 }, { VVV_102, 1 }, { VVV_106, 1 }, { VVV_103, 1 }, { VVV_100, 1 }, { VVV_41, 1 },
{ ACT_TILE_243, 1 }, { ACT_TILE_102, 1 }, { ACT_TILE_106, 1 }, { ACT_TILE_103, 1 }, { ACT_TILE_100, 1 }, { ACT_TILE_41, 1 },
};
const u16 gUnk_08122436End = 0;

View File

@ -108,9 +108,9 @@ void ObjectBlockingStairs_Action1(ObjectBlockingStairsEntity* this) {
}
if (this->unk7b & 0x40) {
tileType = (u32)GetTileType(this->tilePos - 1, super->collisionLayer);
tileType = (u32)GetTileTypeAtTilePos(this->tilePos - 1, super->collisionLayer);
} else {
tileType = (u32)GetTileType(this->tilePos + 1, super->collisionLayer);
tileType = (u32)GetTileTypeAtTilePos(this->tilePos + 1, super->collisionLayer);
}
switch (tileType) {

View File

@ -148,7 +148,7 @@ void ObjectOnPillar_Action4(ObjectOnPillarEntity* this) {
bool32 sub_08097008(ObjectOnPillarEntity* this) {
Entity* effect;
u32 tileType = GetTileType(this->tilePos, super->collisionLayer);
u32 tileType = GetTileTypeAtTilePos(this->tilePos, super->collisionLayer);
if (tileType != SPECIAL_TILE_54) {
switch (sub_08097074(tileType)) {
case 1:
@ -191,7 +191,7 @@ void sub_08097098(ObjectOnPillarEntity* this) {
this->unk_76 = 0x20;
EnqueueSFX(SFX_10F);
SetTile(this->tileIndex, this->tilePos, super->collisionLayer);
tileType = GetTileType(gUnk_080B4488[super->direction >> 3] + this->tilePos, super->collisionLayer);
tileType = GetTileTypeAtTilePos(gUnk_080B4488[super->direction >> 3] + this->tilePos, super->collisionLayer);
if ((tileType == 0x79) || tileType == 0x77) {
super->spriteOffsetY = 2;
}
@ -206,7 +206,7 @@ void sub_080970F4(ObjectOnPillarEntity* this) {
bool32 sub_08097144(ObjectOnPillarEntity* this) {
LinearMoveUpdate(super);
sub_0800445C(super);
if (GetVvvAtEntity(super) == VVV_25) {
if (GetActTileAtEntity(super) == ACT_TILE_25) {
super->spriteOffsetY = 2;
}
if ((--this->unk_76 == 0) && sub_08097194(this) == FALSE) {
@ -222,7 +222,7 @@ bool32 sub_08097194(ObjectOnPillarEntity* this) {
if (sub_0800442E(super)) {
return TRUE;
} else {
u32 tileType = GetTileTypeByEntity(super);
u32 tileType = GetTileTypeAtEntity(super);
if (tileType == TILE_TYPE_113 || tileType == TILE_TYPE_114 || tileType == SPECIAL_TILE_32) {
SetFlag(this->flag);
EnqueueSFX(SFX_10B);

View File

@ -110,7 +110,7 @@ void PlayerClone_Action2(PlayerCloneEntity* this) {
if (gPlayerEntity.base.iframes >= 1) {
gPlayerState.chargeState.action = 1;
} else {
GetVvvAtEntity(super); // TODO why is the return value not used? // leftover from debugging?
GetActTileAtEntity(super); // TODO why is the return value not used? // leftover from debugging?
sub_08084B1C(this);
super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI + this->unk78;
super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI + this->unk7a;
@ -191,8 +191,8 @@ void sub_08084CAC(PlayerCloneEntity* this) {
if (((PlayerCloneEntity*)gPlayerClones[super->type])->unk70 == 0) {
ptr = &gUnk_080B4468[super->animationState & 6];
if (GetVvvForTileType(
GetTileType(COORD_TO_TILE_OFFSET(super, -ptr[0], -ptr[1]), super->collisionLayer)) == VVV_114) {
if (GetActTileForTileType(
GetTileTypeAtTilePos(COORD_TO_TILE_OFFSET(super, -ptr[0], -ptr[1]), super->collisionLayer)) == ACT_TILE_114) {
((PlayerCloneEntity*)gPlayerClones[0])->unk6c |= (1 << super->type);
} else {
((PlayerCloneEntity*)gPlayerClones[0])->unk6c &= ~(1 << super->type);

View File

@ -107,7 +107,7 @@ void Pot_Action1(PotEntity* this) {
Pot_Action5(this);
break;
default:
tileType = GetTileTypeByEntity(super);
tileType = GetTileTypeAtEntity(super);
if (tileType != 0x4000) {
switch (tileType) {
case SPECIAL_TILE_4:
@ -129,7 +129,7 @@ void Pot_Action1(PotEntity* this) {
DeleteThisEntity();
break;
default:
if (GetVvvAtEntity(super) == VVV_13) {
if (GetActTileAtEntity(super) == ACT_TILE_13) {
CreateFx(super, FX_FALL_DOWN, 0);
} else if (tileType == SPECIAL_TILE_5) {
gPlayerState.lastSwordMove = SWORD_MOVE_BREAK_POT;
@ -224,7 +224,7 @@ void Pot_Action4(PotEntity* this) {
}
this->unk_70 = GetTileIndex(COORD_TO_TILE(super), super->collisionLayer);
tileType = GetTileTypeByEntity(super);
tileType = GetTileTypeAtEntity(super);
switch (tileType) {
case 0x71:
case 0x72:

View File

@ -492,7 +492,7 @@ void sub_0809028C(PushableFurnitureEntity* this, u32 param_2) {
if ((this->unk_83 & 0x20) != 0) {
sub_08090480(0, uVar2 + 1);
} else {
switch (GetTileType(uVar2, 2)) {
switch (GetTileTypeAtTilePos(uVar2, 2)) {
case 0x301:
this->unk_83 |= 8;
break;
@ -506,7 +506,7 @@ void sub_0809028C(PushableFurnitureEntity* this, u32 param_2) {
sub_08090480(0, uVar2);
}
if ((this->unk_83 & 0x10) != 0) {
switch (GetTileType(pos - 1, 1)) {
switch (GetTileTypeAtTilePos(pos - 1, 1)) {
case 0x300:
break;
default:
@ -516,7 +516,7 @@ void sub_0809028C(PushableFurnitureEntity* this, u32 param_2) {
}
return;
}
switch (GetTileType(pos - 1, 2)) {
switch (GetTileTypeAtTilePos(pos - 1, 2)) {
case 0x300:
this->unk_83 |= 4;
break;
@ -533,7 +533,7 @@ void sub_0809028C(PushableFurnitureEntity* this, u32 param_2) {
if ((this->unk_83 & 0x10) != 0) {
sub_08090480(0, pos - 1);
} else {
switch (GetTileType(pos, 2)) {
switch (GetTileTypeAtTilePos(pos, 2)) {
case 0x302:
this->unk_83 |= 4;
break;
@ -547,7 +547,7 @@ void sub_0809028C(PushableFurnitureEntity* this, u32 param_2) {
sub_08090480(0, uVar2);
}
if ((this->unk_83 & 0x20) != 0) {
switch (GetTileType(uVar2 + 1, 1)) {
switch (GetTileTypeAtTilePos(uVar2 + 1, 1)) {
case 0x300:
break;
default:
@ -557,7 +557,7 @@ void sub_0809028C(PushableFurnitureEntity* this, u32 param_2) {
}
return;
}
switch (GetTileType(uVar2 + 1, 2)) {
switch (GetTileTypeAtTilePos(uVar2 + 1, 2)) {
case 0x300:
this->unk_83 |= 8;
break;
@ -579,12 +579,12 @@ void sub_08090480(u32 param_1, u32 tilePos) {
void sub_08090498(PushableFurnitureEntity* this) {
u32 tmp = this->unk_70 - 0x80;
RestorePrevTileEntity(tmp, 1);
if (((this->unk_83 & 1) != 0) && (GetTileType(tmp, 2) == 0x306)) {
if (((this->unk_83 & 1) != 0) && (GetTileTypeAtTilePos(tmp, 2) == 0x306)) {
SetCollisionData(0x62, tmp, 1);
}
tmp = this->unk_72 - 0x80;
RestorePrevTileEntity(tmp, 1);
if (((this->unk_83 & 2) != 0) && (GetTileType(tmp, 2) == 0x308)) {
if (((this->unk_83 & 2) != 0) && (GetTileTypeAtTilePos(tmp, 2) == 0x308)) {
SetCollisionData(99, tmp, 1);
}
}

View File

@ -149,7 +149,7 @@ bool32 sub_0809785C(PushableGraveEntity* this) {
if (super->type != 0) {
if (super->type2 != 0) {
if ((CheckFlags(this->pushedFlag) != 0) ||
GetTileType(this->unk_68, super->collisionLayer) == SPECIAL_TILE_63) {
GetTileTypeAtTilePos(this->unk_68, super->collisionLayer) == SPECIAL_TILE_63) {
super->action = 3;
super->timer = 64;
super->subtimer = 0;

View File

@ -41,7 +41,7 @@ void PushableRock_Action1(PushableRockEntity* this) {
u32 tileType;
u32 tmp;
tileType = GetTileType(this->tilePos, super->collisionLayer);
tileType = GetTileTypeAtTilePos(this->tilePos, super->collisionLayer);
switch (tileType) {
case SPECIAL_TILE_28:
case SPECIAL_TILE_29:
@ -87,12 +87,12 @@ void PushableRock_Action3(PushableRockEntity* this) {
}
void sub_0808A644(PushableRockEntity* this) {
u32 vvv;
u32 actTile;
this->tilePos = COORD_TO_TILE(super);
this->tileIndex = GetTileIndex(this->tilePos, super->collisionLayer);
this->collisionData = GetCollisionDataAtTilePos(this->tilePos, super->collisionLayer);
vvv = GetVvvAtTilePos(this->tilePos, super->collisionLayer);
if ((vvv == VVV_25) || (vvv == VVV_240)) {
actTile = GetActTileAtTilePos(this->tilePos, super->collisionLayer);
if ((actTile == ACT_TILE_25) || (actTile == ACT_TILE_240)) {
SetTile(SPECIAL_TILE_21, this->tilePos, super->collisionLayer);
super->action = 3;
if (!CheckFlags(this->pushedFlag)) {

View File

@ -62,7 +62,7 @@ void PushableStatue_Action1(PushableStatueEntity* this) {
Entity* obj;
if (sub_0800442E(super) == 0) {
tileType = GetTileType(this->unk_84, super->collisionLayer);
tileType = GetTileTypeAtTilePos(this->unk_84, super->collisionLayer);
if (tileType != SPECIAL_TILE_11) {
switch (sub_0808968C(tileType)) {
case 1:
@ -110,7 +110,7 @@ void PushableStatue_SubAction0(PushableStatueEntity* this) {
ptr = &gUnk_08120CB4[index];
PositionRelative(super, &gPlayerEntity.base, Q_16_16(ptr[0]), Q_16_16(ptr[1]));
}
tileType = GetTileType(this->unk_84, super->collisionLayer);
tileType = GetTileTypeAtTilePos(this->unk_84, super->collisionLayer);
if (tileType != SPECIAL_TILE_11) {
switch (sub_0808968C(tileType)) {
case 1:
@ -166,7 +166,7 @@ void sub_08089454(PushableStatueEntity* this) {
this->unk_84 = COORD_TO_TILE(super);
this->unk_80 = GetTileIndex(this->unk_84, super->collisionLayer);
SetTile(SPECIAL_TILE_11, this->unk_84, super->collisionLayer);
if (super->collisionLayer == 2 && GetTileType(this->unk_84, 1) == 0x310) {
if (super->collisionLayer == 2 && GetTileTypeAtTilePos(this->unk_84, 1) == 0x310) {
SetTile(SPECIAL_TILE_11, this->unk_84, LAYER_BOTTOM);
}
}
@ -197,10 +197,10 @@ void sub_08089538(PushableStatueEntity* this) {
this->unk_86 = 0x20;
EnqueueSFX(SFX_10F);
SetTile(this->unk_80, this->unk_84, super->collisionLayer);
if ((super->collisionLayer == 2) && (GetTileType(this->unk_84, LAYER_BOTTOM) == SPECIAL_TILE_11)) {
if ((super->collisionLayer == 2) && (GetTileTypeAtTilePos(this->unk_84, LAYER_BOTTOM) == SPECIAL_TILE_11)) {
CloneTile(TILE_TYPE_784, this->unk_84, 1);
}
tileType = GetTileType(this->unk_84 + gUnk_080B4488[super->direction >> 3], super->collisionLayer);
tileType = GetTileTypeAtTilePos(this->unk_84 + gUnk_080B4488[super->direction >> 3], super->collisionLayer);
if ((tileType == TILE_TYPE_121) || (tileType == TILE_TYPE_119)) {
super->spriteOffsetY = -2;
}
@ -258,14 +258,14 @@ bool32 sub_080896B0(void) {
const s16* ptr;
u32 tmp1;
u32 tmp2;
u32 vvv;
u32 actTile;
if (((gPlayerState.heldObject & 0x1f) == 0x12) && ((gPlayerEntity.base.frame & 1) != 0)) {
ptr = &gUnk_080B4468[gPlayerEntity.base.animationState & 6];
uVar1 = gUnk_080B4488[gPlayerEntity.base.animationState >> 1];
uVar4 = COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr[0], -ptr[1]) - uVar1;
vvv = GetVvvAtTilePos(uVar4, gPlayerEntity.base.collisionLayer);
if ((vvv - 0x26 > 1) && (vvv != VVV_41)) {
actTile = GetActTileAtTilePos(uVar4, gPlayerEntity.base.collisionLayer);
if ((actTile - 0x26 > 1) && (actTile != ACT_TILE_41)) {
mapLayer = GetLayerByIndex(gPlayerEntity.base.collisionLayer);
iVar2 = (uVar4 * 0x10000) >> 0x10;
tmp1 = mapLayer->collisionData[iVar2];

View File

@ -31,7 +31,7 @@ void RotatingTrapdoor_Init(Entity* this) {
this->action = 1;
x = 0;
y = 0;
switch (GetTileTypeByEntity(this)) {
switch (GetTileTypeAtEntity(this)) {
case 0x343:
x = 0x10;
case 0x344:

View File

@ -85,7 +85,7 @@ void SmallIceBlock_Action1(SmallIceBlockEntity* this) {
}
} else {
if (!sub_0800442E(super)) {
tileType = GetTileType(this->tilePos, super->collisionLayer);
tileType = GetTileTypeAtTilePos(this->tilePos, super->collisionLayer);
if (tileType != SPECIAL_TILE_90) {
switch (sub_08099618(tileType)) {
case 1:
@ -186,10 +186,10 @@ void sub_080994B8(SmallIceBlockEntity* this) {
EnqueueSFX(SFX_ICE_BLOCK_SLIDE);
SetTile(this->unk_6c, this->tilePos, super->collisionLayer);
if ((super->collisionLayer == 2) && (GetTileType(this->tilePos, 1) == SPECIAL_TILE_90)) {
if ((super->collisionLayer == 2) && (GetTileTypeAtTilePos(this->tilePos, 1) == SPECIAL_TILE_90)) {
CloneTile(TILE_TYPE_784, this->tilePos, 1);
}
tileType = GetTileType(this->tilePos + gUnk_080B4488[super->direction >> 3], super->collisionLayer);
tileType = GetTileTypeAtTilePos(this->tilePos + gUnk_080B4488[super->direction >> 3], super->collisionLayer);
if (tileType == 0x79 || tileType == 0x77) {
super->spriteOffsetY = -2;
}

View File

@ -71,8 +71,8 @@ void sub_080878CC(Entity* this) {
for (itX = -0x10; itX < 0x11; itX += 0x10) {
for (itY = -0x10; itY < 0x11; itY += 0x10) {
tilePos = TILE((u32)x + itX, (u32)y + itY);
if (GetVvvAtTilePos(tilePos, (u8)layer) == VVV_46) {
switch (GetTileType(tilePos, layer)) {
if (GetActTileAtTilePos(tilePos, (u8)layer) == ACT_TILE_46) {
switch (GetTileTypeAtTilePos(tilePos, layer)) {
case 0x368:
case 0x367:
DoTileInteraction(this, 3, x + itX, y + itY);

View File

@ -60,7 +60,7 @@ void TreeHidingPortal_Action1(TreeHidingPortalEntity* this) {
}
}
}
if (sub_0809E9A0() == VVV_84) {
if (sub_0809E9A0() == ACT_TILE_84) {
super->action = 2;
super->timer = 15;
SetPlayerControl(1);
@ -110,15 +110,15 @@ static void sub_0809E96C(TreeHidingPortalEntity* this) {
}
static u32 sub_0809E9A0(void) {
u32 vvv;
u32 actTile;
const s16* ptr;
if (gPlayerEntity.base.action != PLAYER_BOUNCE) {
vvv = VVV_0;
actTile = ACT_TILE_0;
} else {
ptr = &gUnk_080B4468[gPlayerEntity.base.animationState & 6];
vvv = GetVvvAtTilePos(COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr[0], -ptr[1]), 1);
actTile = GetActTileAtTilePos(COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr[0], -ptr[1]), 1);
}
return vvv;
return actTile;
}

View File

@ -38,7 +38,7 @@ void Well_Init(WellEntity* this) {
}
void Well_Action1(WellEntity* this) {
u32 tileIndex = GetTileType(this->unk_80, LAYER_BOTTOM);
u32 tileIndex = GetTileTypeAtTilePos(this->unk_80, LAYER_BOTTOM);
if (tileIndex != SPECIAL_TILE_125) {
PausePlayer();
gPlayerEntity.base.x.WORD = super->x.WORD;

View File

@ -233,8 +233,8 @@ bool32 sub_0806F854(Entity* ent, s32 x, s32 y) {
bool32 sub_0806F8DC(Entity* ent) {
if (ent->collisionLayer & 2)
return FALSE;
if (!GetTileTypeByPos(ent->x.HALF.HI, ent->y.HALF.HI - 4, 2)) {
GetTileTypeByPos(ent->x.HALF.HI, ent->y.HALF.HI - 4, ent->collisionLayer);
if (!GetTileTypeAtWorldCoords(ent->x.HALF.HI, ent->y.HALF.HI - 4, 2)) {
GetTileTypeAtWorldCoords(ent->x.HALF.HI, ent->y.HALF.HI - 4, ent->collisionLayer);
ent->spriteRendering.b3 = 1;
ent->spriteOrientation.flipY = 1;
return FALSE;

View File

@ -1976,7 +1976,7 @@ static void PlayerRoomTransition(PlayerEntity* this) {
static void sub_080724DC(PlayerEntity* this) {
super->knockbackDuration = 0;
DeleteClones();
if (GetVvvAtEntity(super) != VVV_41) {
if (GetActTileAtEntity(super) != ACT_TILE_41) {
if ((gPlayerState.remainingDiveTime == 0) && (gPlayerState.swim_state != 0)) {
PlayerUpdateSwimming(super);
}
@ -2002,7 +2002,7 @@ static void sub_080724DC(PlayerEntity* this) {
static void sub_0807258C(PlayerEntity* this) {
if (gRoomControls.reload_flags == 0) {
if (GetVvvInFront(super) == VVV_41) {
if (GetActTileInFront(super) == ACT_TILE_41) {
UpdatePlayerMovement();
if (sub_080797C4() != 0) {
gPlayerState.startPosX = gPlayerEntity.base.x.HALF.HI;
@ -2367,7 +2367,7 @@ static void sub_08072D54(PlayerEntity* this) {
LinearMoveUpdate(super);
super->timer--;
} else {
uVar2 = GetTileType(sub_0806F730(super), super->collisionLayer);
uVar2 = GetTileTypeAtTilePos(sub_0806F730(super), super->collisionLayer);
switch (super->subtimer) {
case 0:
if (FindValueForKey(uVar2, sTileTable[gPlayerEntity.base.animationState >> 1])) {
@ -2627,7 +2627,7 @@ static void PlayerUseStairs(PlayerEntity* this) {
static void sub_080732D0(PlayerEntity* this) {
UpdateAnimationSingleFrame(super);
if (GetVvvAtEntity(super) != VVV_40) {
if (GetActTileAtEntity(super) != ACT_TILE_40) {
super->direction = DirectionNorth;
LinearMoveUpdate(super);
} else {
@ -4114,7 +4114,7 @@ void sub_0807529C(PlayerEntity* this) {
void sub_080752AC(PlayerEntity* this, ScriptExecutionContext* ctx) {
LinearMoveUpdate(super);
if (!ctx->unk_18) {
if (GetVvvAtEntity(super) != VVV_41) {
if (GetActTileAtEntity(super) != ACT_TILE_41) {
ctx->unk_18 = 1;
ctx->unk_19 = 6;
}

View File

@ -280,7 +280,7 @@ void PlayerItemBottle_UseEmptyBottle(Entity* this) {
if (this->spriteSettings.flipX != 0) {
iVar2 = -iVar2;
}
if (GetVvvRelativeToEntity(this, iVar2, (s8)ptr2[1]) == VVV_16) {
if (GetActTileRelativeToEntity(this, iVar2, (s8)ptr2[1]) == ACT_TILE_16) {
this->type2 = ITEM_BOTTLE_WATER;
}
}

View File

@ -17,8 +17,8 @@ typedef struct {
/*0x6c*/ u16 tileType;
} PlayerItemCellOverwriteSetEntity;
// vvv for specialTile
const u8 gMapSpecialTileToVvv[] = {
// actTile for specialTile
const u8 gMapSpecialTileToActTile[] = {
0, // SPECIAL_TILE_0
0, // SPECIAL_TILE_1
0, // SPECIAL_TILE_2
@ -39,19 +39,19 @@ const u8 gMapSpecialTileToVvv[] = {
0, // SPECIAL_TILE_17
0, // SPECIAL_TILE_18
0, // SPECIAL_TILE_19
VVV_241, // SPECIAL_TILE_20
ACT_TILE_241, // SPECIAL_TILE_20
0, // SPECIAL_TILE_21
0, // SPECIAL_TILE_22
VVV_83, // SPECIAL_TILE_23
VVV_242, // SPECIAL_TILE_24
VVV_243, // SPECIAL_TILE_25
ACT_TILE_83, // SPECIAL_TILE_23
ACT_TILE_242, // SPECIAL_TILE_24
ACT_TILE_243, // SPECIAL_TILE_25
0, // SPECIAL_TILE_26
0, // SPECIAL_TILE_27
0, // SPECIAL_TILE_28
0, // SPECIAL_TILE_29
0, // SPECIAL_TILE_30
0, // SPECIAL_TILE_31
VVV_240, // SPECIAL_TILE_32
ACT_TILE_240, // SPECIAL_TILE_32
0, // SPECIAL_TILE_33
0, // SPECIAL_TILE_34
0, // SPECIAL_TILE_35
@ -83,15 +83,15 @@ const u8 gMapSpecialTileToVvv[] = {
0, // SPECIAL_TILE_61
0, // SPECIAL_TILE_62
0, // SPECIAL_TILE_63
VVV_61, // SPECIAL_TILE_64
VVV_61, // SPECIAL_TILE_65
VVV_61, // SPECIAL_TILE_66
VVV_61, // SPECIAL_TILE_67
VVV_61, // SPECIAL_TILE_68
VVV_61, // SPECIAL_TILE_69
VVV_61, // SPECIAL_TILE_70
VVV_61, // SPECIAL_TILE_71
VVV_61, // SPECIAL_TILE_72
ACT_TILE_61, // SPECIAL_TILE_64
ACT_TILE_61, // SPECIAL_TILE_65
ACT_TILE_61, // SPECIAL_TILE_66
ACT_TILE_61, // SPECIAL_TILE_67
ACT_TILE_61, // SPECIAL_TILE_68
ACT_TILE_61, // SPECIAL_TILE_69
ACT_TILE_61, // SPECIAL_TILE_70
ACT_TILE_61, // SPECIAL_TILE_71
ACT_TILE_61, // SPECIAL_TILE_72
0, // SPECIAL_TILE_73
0, // SPECIAL_TILE_74
0, // SPECIAL_TILE_75
@ -100,7 +100,7 @@ const u8 gMapSpecialTileToVvv[] = {
0, // SPECIAL_TILE_78
0, // SPECIAL_TILE_79
0, // SPECIAL_TILE_80
VVV_58, // SPECIAL_TILE_81
ACT_TILE_58, // SPECIAL_TILE_81
0, // SPECIAL_TILE_82
0, // SPECIAL_TILE_83
0, // SPECIAL_TILE_84
@ -124,7 +124,7 @@ const u8 gMapSpecialTileToVvv[] = {
0, // SPECIAL_TILE_102
0, // SPECIAL_TILE_103
0, // SPECIAL_TILE_104
VVV_40, // SPECIAL_TILE_105
ACT_TILE_40, // SPECIAL_TILE_105
0, // SPECIAL_TILE_106
0, // SPECIAL_TILE_107
0, // SPECIAL_TILE_108
@ -136,35 +136,35 @@ const u8 gMapSpecialTileToVvv[] = {
0, // SPECIAL_TILE_114
0, // SPECIAL_TILE_115
0, // SPECIAL_TILE_116
VVV_18, // SPECIAL_TILE_117
VVV_18, // SPECIAL_TILE_118
VVV_18, // SPECIAL_TILE_119
VVV_18, // SPECIAL_TILE_120
VVV_18, // SPECIAL_TILE_121
VVV_18, // SPECIAL_TILE_122
VVV_18, // SPECIAL_TILE_123
VVV_18, // SPECIAL_TILE_124
ACT_TILE_18, // SPECIAL_TILE_117
ACT_TILE_18, // SPECIAL_TILE_118
ACT_TILE_18, // SPECIAL_TILE_119
ACT_TILE_18, // SPECIAL_TILE_120
ACT_TILE_18, // SPECIAL_TILE_121
ACT_TILE_18, // SPECIAL_TILE_122
ACT_TILE_18, // SPECIAL_TILE_123
ACT_TILE_18, // SPECIAL_TILE_124
0, // SPECIAL_TILE_125
VVV_116, // SPECIAL_TILE_126
VVV_116, // SPECIAL_TILE_127
VVV_41, // SPECIAL_TILE_128
ACT_TILE_116, // SPECIAL_TILE_126
ACT_TILE_116, // SPECIAL_TILE_127
ACT_TILE_41, // SPECIAL_TILE_128
0, // SPECIAL_TILE_129
VVV_35, // SPECIAL_TILE_130
VVV_41, // SPECIAL_TILE_131
VVV_41, // SPECIAL_TILE_132
VVV_41, // SPECIAL_TILE_133
VVV_41, // SPECIAL_TILE_134
VVV_41, // SPECIAL_TILE_135
VVV_41, // SPECIAL_TILE_136
VVV_16, // SPECIAL_TILE_137
VVV_16, // SPECIAL_TILE_138
VVV_16, // SPECIAL_TILE_139
VVV_16, // SPECIAL_TILE_140
VVV_41, // SPECIAL_TILE_141
VVV_80, // SPECIAL_TILE_142
VVV_81, // SPECIAL_TILE_143
ACT_TILE_35, // SPECIAL_TILE_130
ACT_TILE_41, // SPECIAL_TILE_131
ACT_TILE_41, // SPECIAL_TILE_132
ACT_TILE_41, // SPECIAL_TILE_133
ACT_TILE_41, // SPECIAL_TILE_134
ACT_TILE_41, // SPECIAL_TILE_135
ACT_TILE_41, // SPECIAL_TILE_136
ACT_TILE_16, // SPECIAL_TILE_137
ACT_TILE_16, // SPECIAL_TILE_138
ACT_TILE_16, // SPECIAL_TILE_139
ACT_TILE_16, // SPECIAL_TILE_140
ACT_TILE_41, // SPECIAL_TILE_141
ACT_TILE_80, // SPECIAL_TILE_142
ACT_TILE_81, // SPECIAL_TILE_143
0, // SPECIAL_TILE_144
VVV_15, // SPECIAL_TILE_145
ACT_TILE_15, // SPECIAL_TILE_145
0, // SPECIAL_TILE_146
0, // SPECIAL_TILE_147
0, // SPECIAL_TILE_148
@ -342,7 +342,7 @@ void PlayerItemCellOverwriteSet(PlayerItemCellOverwriteSetEntity* this) {
Entity* player = &gPlayerEntity.base;
if (super->action == 0) {
this->tileType = GetTileType(TILE(player->x.HALF.HI + offsetByDirection[player->animationState & 0xe],
this->tileType = GetTileTypeAtTilePos(TILE(player->x.HALF.HI + offsetByDirection[player->animationState & 0xe],
player->y.HALF.HI + offsetByDirection[(player->animationState & 0xe) + 1]),
super->collisionLayer);
super->action++;
@ -351,7 +351,7 @@ void PlayerItemCellOverwriteSet(PlayerItemCellOverwriteSetEntity* this) {
tmp = gInput.heldKeys & R_BUTTON;
if ((gInput.heldKeys & A_BUTTON) != 0) {
if ((gInput.newKeys & R_BUTTON) != 0) {
this->tileType = GetTileType(TILE(player->x.HALF.HI + offsetByDirection[player->animationState & 0xe],
this->tileType = GetTileTypeAtTilePos(TILE(player->x.HALF.HI + offsetByDirection[player->animationState & 0xe],
player->y.HALF.HI + offsetByDirection[(player->animationState & 0xe) + 1]),
super->collisionLayer);
}

View File

@ -172,10 +172,10 @@ void PlayerItemGustBig_Action2(PlayerItemGustBigEntity* this) {
if (super->type2 == 0) {
sub_0800451C(super);
}
if (FindValueForKey(sub_080B1A0C(super, x, y), gUnk_080B3DF4)) {
if (FindValueForKey(GetTileTypeRelativeToEntity(super, x, y), gUnk_080B3DF4)) {
return;
}
if (GetVvvRelativeToEntity(super, x, y) == VVV_116) {
if (GetActTileRelativeToEntity(super, x, y) == ACT_TILE_116) {
return;
}
if (sub_080040D8(super, (u8*)gUnk_08003E44, super->x.HALF.HI + x, super->y.HALF.HI + y) == 0) {

View File

@ -122,8 +122,8 @@ void PlayerItemHeldObject_SubAction2(PlayerItemHeldObjectEntity* this) {
super->direction = super->knockbackDirection;
super->knockbackDuration = 0;
}
if (GetVvvRelativeToEntity(super, gUnk_081320C4[super->direction >> 2],
gUnk_081320C4[(super->direction >> 2) + 1]) == VVV_116) {
if (GetActTileRelativeToEntity(super, gUnk_081320C4[super->direction >> 2],
gUnk_081320C4[(super->direction >> 2) + 1]) == ACT_TILE_116) {
LinearMoveUpdate(super);
} else {
data = GetCollisionDataAtEntity(super);
@ -136,27 +136,27 @@ void PlayerItemHeldObject_SubAction2(PlayerItemHeldObjectEntity* this) {
(child->base).x = super->x;
(child->base).y = super->y;
(child->base).z = super->z;
data = GetVvvAtEntity(super);
data = GetActTileAtEntity(super);
switch (data) {
case VVV_13:
case VVV_16:
case VVV_17:
case VVV_19:
case VVV_90:
case ACT_TILE_13:
case ACT_TILE_16:
case ACT_TILE_17:
case ACT_TILE_19:
case ACT_TILE_90:
if (child == this) {
switch (data) {
case VVV_13:
case ACT_TILE_13:
CreateFx(super, FX_FALL_DOWN, 0);
break;
case VVV_90:
case ACT_TILE_90:
CreateFx(super, FX_LAVA_SPLASH, 0);
break;
case VVV_16:
case VVV_17:
case ACT_TILE_16:
case ACT_TILE_17:
CreateFx(super, FX_WATER_SPLASH, 0);
break;
case VVV_19:
case ACT_TILE_19:
CreateFx(super, FX_GREEN_SPLASH, 0);
break;
}

View File

@ -128,7 +128,7 @@ void PlayerItemPacciCaneProjectile_Action1(PlayerItemPacciCaneProjectileEntity*
}
if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.base.collisionLayer, 0x80) == 0) {
if (sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI) == 0) {
if (GetVvvAtEntity(super) == VVV_25) {
if (GetActTileAtEntity(super) == ACT_TILE_25) {
super->action = 4;
COLLISION_OFF(super);
super->x.HALF.HI = (super->x.HALF.HI & 0xfff0) | 8;

View File

@ -374,7 +374,7 @@ void sub_080A7A84(PlayerItemSwordEntity* this) {
(gPlayerState.sword_state != 0)) &&
((gPlayerState.sword_state & 0xc0) == 0)) {
entity = super;
if (GetVvvRelativeToEntity(entity, xOffset, yOffset) == VVV_46) {
if (GetActTileRelativeToEntity(entity, xOffset, yOffset) == ACT_TILE_46) {
SoundReqClipped(&gPlayerEntity.base, SFX_ITEM_GLOVES_KNOCKBACK);
} else {
SoundReqClipped(&gPlayerEntity.base, SFX_METAL_CLINK);

View File

@ -69,7 +69,7 @@ extern u8 gUpdateVisibleTiles;
bool32 sub_0807BF88(u32, u32, RoomResInfo*);
void sub_0807BFD0(void);
void SetupTileSet(void);
void ForceSetPlayerState(u32 framestate);
InteractableObject* sub_080784E4(void);
@ -77,7 +77,7 @@ InteractableObject* sub_080784E4(void);
u32 sub_08079778(void);
u32 GetPlayerTilePos(void);
extern const KeyValuePair gMapVvvToSurfaceType[];
extern const KeyValuePair gMapActTileToSurfaceType[];
u32 sub_0807BEEC(u32 param_1, u32 param_2, u32 param_3);
@ -105,7 +105,7 @@ extern const u16* sub_0806FC50(u32 param_1, u32 param_2);
bool32 sub_08079F48(u32 param_1, u32 param_2);
extern void FillVvvForLayer(MapLayer* mapLayer);
extern void FillActTileForLayer(MapLayer* mapLayer);
extern u16 gUnk_080B77C0[];
@ -836,7 +836,7 @@ const KeyValuePair gUnk_0811C254[] = { { 43, 1 }, { 38, 1 } };
const u16 gUnk_0811C254End = 0;
const KeyValuePair gUnk_0811C25E[] = { { 44, 1 }, { 39, 1 } };
const u16 gUnk_0811C25EEnd = 0;
const KeyValuePair gUnk_0811C268[] = { { VVV_16, 1 }, { VVV_90, 1 }, { VVV_17, 1 }, { VVV_19, 1 } };
const KeyValuePair gUnk_0811C268[] = { { ACT_TILE_16, 1 }, { ACT_TILE_90, 1 }, { ACT_TILE_17, 1 }, { ACT_TILE_19, 1 } };
const u16 gUnk_0811C268EEnd = 0;
void sub_0807B114(PlayerEntity*);
@ -897,7 +897,7 @@ void sub_08077F84(void) {
Entity* obj;
if ((gPlayerEntity.base.collisionLayer & 2) == 0) {
u32 tileType = GetTileTypeByPos(gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI - 12, LAYER_TOP);
u32 tileType = GetTileTypeAtWorldCoords(gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI - 12, LAYER_TOP);
if (tileType == TILE_TYPE_835 || tileType == TILE_TYPE_836 || tileType == TILE_TYPE_837 || tileType == TILE_TYPE_838) {
sub_0807AA80(&gPlayerEntity.base);
gPlayerState.jump_status |= 8;
@ -1476,7 +1476,7 @@ u32 sub_080789A8(void) {
}
ptr = &gUnk_08007DF4[gPlayerEntity.base.animationState & 6];
gCarriedEntity.unk_4 = uVar2 = sub_080B1A0C(&gPlayerEntity.base, (s8)ptr[0], (s8)ptr[1]);
gCarriedEntity.unk_4 = uVar2 = GetTileTypeRelativeToEntity(&gPlayerEntity.base, (s8)ptr[0], (s8)ptr[1]);
if (!sub_0806FC24(uVar2, 6))
return 0;
@ -2022,10 +2022,10 @@ bool32 sub_08079550(void) {
tilePos2 = COORD_TO_TILE_OFFSET(&gPlayerEntity.base, (gPlayerEntity.base.hitbox)->unk2[2], -ptr[1]);
}
uVar3 = GetVvvAtTilePos(tilePos1, gPlayerEntity.base.collisionLayer);
uVar3 = GetActTileAtTilePos(tilePos1, gPlayerEntity.base.collisionLayer);
uVar3 = FindValueForKey(uVar3, gUnk_0811C1E8[gPlayerEntity.base.animationState >> 1]);
if (uVar3 != 0) {
uVar3 = GetVvvAtTilePos(tilePos2, gPlayerEntity.base.collisionLayer);
uVar3 = GetActTileAtTilePos(tilePos2, gPlayerEntity.base.collisionLayer);
uVar3 = FindValueForKey(uVar3, gUnk_0811C1E8[gPlayerEntity.base.animationState >> 1]);
if (uVar3 != 0) {
gPlayerState.pushedObject |= 0x80;
@ -2354,13 +2354,13 @@ bool32 sub_08079C30(Entity* player) {
return TRUE;
}
if (gPlayerState.floor_type != FindValueForKey(GetVvvRelativeToEntity(player, 0, -1), gMapVvvToSurfaceType))
if (gPlayerState.floor_type != FindValueForKey(GetActTileRelativeToEntity(player, 0, -1), gMapActTileToSurfaceType))
return FALSE;
if (gPlayerState.floor_type != FindValueForKey(GetVvvRelativeToEntity(player, 2, 0), gMapVvvToSurfaceType))
if (gPlayerState.floor_type != FindValueForKey(GetActTileRelativeToEntity(player, 2, 0), gMapActTileToSurfaceType))
return FALSE;
if (gPlayerState.floor_type == FindValueForKey(GetVvvRelativeToEntity(player, -2, 0), gMapVvvToSurfaceType)) {
if (gPlayerState.floor_type == FindValueForKey(GetActTileRelativeToEntity(player, -2, 0), gMapActTileToSurfaceType)) {
return TRUE;
}
}
@ -2372,7 +2372,7 @@ bool32 sub_08079D48(void) {
return TRUE;
} else {
if (!PlayerCheckNEastTile()) {
if (!FindValueForKey((u16)GetVvvAtEntity(&gPlayerEntity.base), gUnk_0811C268)) {
if (!FindValueForKey((u16)GetActTileAtEntity(&gPlayerEntity.base), gUnk_0811C268)) {
return TRUE;
}
}
@ -2593,7 +2593,7 @@ void UpdateFloorType(void) {
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.base.collisionLayer);
u32 tileType = GetTileTypeAtWorldCoords(param_1->x.HALF.HI + x, param_1->y.HALF.HI + y, gPlayerEntity.base.collisionLayer);
if (tileType != gPlayerState.tileType) {
gPlayerState.surfaceTimer = 0;
}
@ -2610,8 +2610,8 @@ SurfaceType GetSurfaceCalcType(Entity* param_1, s32 x, s32 y) {
gPlayerState.surfaceTimer++;
}
gPlayerState.floor_type_last = gPlayerState.floor_type;
tileType = GetVvvRelativeToEntity(param_1, x, y); // tileType is a vvv here
return FindValueForKey(tileType, gMapVvvToSurfaceType);
tileType = GetActTileRelativeToEntity(param_1, x, y); // tileType is a actTile here
return FindValueForKey(tileType, gMapActTileToSurfaceType);
}
void EnablePlayerDraw(Entity* this) {
@ -2655,7 +2655,7 @@ u32 sub_0807A2F8(u32 param_1) {
iVar4 = 0;
uVar2 = sub_08004202(&gPlayerEntity.base, auStack36, uVar2);
if (GetCollisionDataAtTilePos(uVar2 >> 1, LAYER_BOTTOM)) {
if (!FindValueForKey((u16)GetVvvAtTilePos((u16)(uVar2 >> 1), gPlayerEntity.base.collisionLayer),
if (!FindValueForKey((u16)GetActTileAtTilePos((u16)(uVar2 >> 1), gPlayerEntity.base.collisionLayer),
gUnk_0811C1D8[gPlayerEntity.base.animationState >> 1])) {
break;
}
@ -2665,7 +2665,7 @@ u32 sub_0807A2F8(u32 param_1) {
uVar1 = sub_08004202(&gPlayerEntity.base, auStack36, uVar1);
if (GetCollisionDataAtTilePos(uVar1 >> 1, LAYER_BOTTOM)) {
if (!FindValueForKey((u16)GetVvvAtTilePos((uVar1 >> 1), gPlayerEntity.base.collisionLayer),
if (!FindValueForKey((u16)GetActTileAtTilePos((uVar1 >> 1), gPlayerEntity.base.collisionLayer),
gUnk_0811C1D8[gPlayerEntity.base.animationState >> 1])) {
break;
}
@ -2855,7 +2855,7 @@ void sub_0807A750(u32 param_1, u32 param_2, const u8* param_3, u32 param_4) {
}
}
u32 GetVvvInFront(Entity* this) {
u32 GetActTileInFront(Entity* this) {
s32 x;
s32 y;
switch (this->direction) {
@ -2880,7 +2880,7 @@ u32 GetVvvInFront(Entity* this) {
x = 0;
break;
}
return GetVvvRelativeToEntity(this, x, y);
return GetActTileRelativeToEntity(this, x, y);
}
void nullsub_505(void) {
@ -2951,7 +2951,7 @@ void sub_0807AAF8(Entity* this, u32 tilePos) {
void sub_0807AB44(Entity* this, s32 xOffset, s32 yOffset) {
Entity* object;
const u16* ptr =
sub_0806FC50(GetTileType(COORD_TO_TILE_OFFSET(this, -xOffset, -yOffset), this->collisionLayer), 0xb);
sub_0806FC50(GetTileTypeAtTilePos(COORD_TO_TILE_OFFSET(this, -xOffset, -yOffset), this->collisionLayer), 0xb);
if (ptr != NULL) {
if (ptr[3] == 0x76) {
object = CreateObject(FLAME, 1, 0);
@ -3287,20 +3287,20 @@ void SetTileType(u32 tileType, u32 tilePos, u32 layer) {
u8 collisionData;
u16 tileIndex;
MapLayer* mapLayer;
u16* src;
u16* subTiles;
u16* dest;
if (tileType < 0x800) {
UnregisterInteractTile(tilePos, layer);
mapLayer = GetLayerByIndex(layer);
tileIndex = mapLayer->unkData2[tileType];
tileIndex = mapLayer->tileIndices[tileType];
mapLayer->mapData[tilePos] = tileIndex;
collisionData = gMapTileTypeToCollisionData[tileType];
mapLayer->collisionData[tilePos] = collisionData;
if ((gRoomControls.scroll_flags & 2) != 0) {
gMapBottom.collisionData[tilePos] = collisionData;
}
mapLayer->vvv[tilePos] = gMapTileTypeToVvv[tileType];
mapLayer->actTiles[tilePos] = gMapTileTypeToActTile[tileType];
if ((gRoomControls.scroll_flags & 1) == 0) {
u32 offset = (tilePos & 0x3f) * 2 + (tilePos & 0xfc0) * 4;
if (layer != 2) {
@ -3308,12 +3308,12 @@ void SetTileType(u32 tileType, u32 tilePos, u32 layer) {
} else {
dest = gMapDataTopSpecial + offset;
}
src = mapLayer->tiles + tileIndex * 4;
subTiles = mapLayer->subTiles + tileIndex * 4;
// Copy over the tilemap entries (tile_attrs) to the special map data but in a different order.
dest[0] = src[0];
dest[1] = src[1];
dest[0x80] = src[2];
dest[0x81] = src[3];
dest[0] = subTiles[0];
dest[1] = subTiles[1];
dest[0x80] = subTiles[2];
dest[0x81] = subTiles[3];
if (gRoomControls.reload_flags != 1) {
gUpdateVisibleTiles = 1;
}
@ -3326,17 +3326,17 @@ void SetTileType(u32 tileType, u32 tilePos, u32 layer) {
}
bool32 sub_0807B434(u32 tilePos, u32 layer) {
switch (GetTileType(tilePos, layer)) {
switch (GetTileTypeAtTilePos(tilePos, layer)) {
case TILE_TYPE_54:
case TILE_TYPE_55:
return FALSE;
default:
return GetVvvAtTilePos(tilePos, layer) != VVV_13;
return GetActTileAtTilePos(tilePos, layer) != ACT_TILE_13;
}
}
bool32 sub_0807B464(u32 tilePos, u32 layer) {
return GetVvvAtTilePos(tilePos, layer) == VVV_86;
return GetActTileAtTilePos(tilePos, layer) == ACT_TILE_86;
}
void sub_0807B480(u32 tilePos, u32 param_2) {
@ -3353,11 +3353,11 @@ void sub_0807B480(u32 tilePos, u32 param_2) {
tmp1 |= sub_0807B464(tilePos - 1, LAYER_TOP) << 3;
tmp1 |= sub_0807B464(tilePos + 0x41, LAYER_BOTTOM) << 1;
tmp1 |= sub_0807B464(tilePos + 0x3f, LAYER_BOTTOM) << 3;
if (GetTileType(tilePos + 0x40, LAYER_TOP) != 0) {
if (GetTileTypeAtTilePos(tilePos + 0x40, LAYER_TOP) != 0) {
tmp1 |= sub_0807B464(tilePos + 0x80, LAYER_BOTTOM) << 2;
}
tmp2 = gUnk_0811C2CC[tmp1];
tileType = GetTileType(tilePos, LAYER_TOP);
tileType = GetTileTypeAtTilePos(tilePos, LAYER_TOP);
ptr = gUnk_0811C2EC;
tmp3 = 0;
for (; *ptr != 0; ptr = ptr + 3) {
@ -3398,10 +3398,10 @@ u32 sub_0807B600(u32 tilePos) {
u32 tilePos2;
tilePos2 = tilePos - 0x40;
if (GetVvvAtTilePos(tilePos, LAYER_BOTTOM) != VVV_86) {
if (GetActTileAtTilePos(tilePos, LAYER_BOTTOM) != ACT_TILE_86) {
return FALSE;
} else {
tileType = GetTileType(tilePos, LAYER_BOTTOM);
tileType = GetTileTypeAtTilePos(tilePos, LAYER_BOTTOM);
if (tileType == TILE_TYPE_618) {
sub_0807B820(tilePos);
} else if (tileType == TILE_TYPE_615) {
@ -3415,7 +3415,7 @@ u32 sub_0807B600(u32 tilePos) {
} else if (tileType == TILE_TYPE_647) {
sub_0807B930(tilePos + 0x40);
} else {
if (GetTileType(tilePos, LAYER_TOP) != 0) {
if (GetTileTypeAtTilePos(tilePos, LAYER_TOP) != 0) {
SetTileType(TILE_TYPE_754, tilePos, LAYER_BOTTOM);
if (GetCollisionDataAtTilePos(tilePos2, LAYER_BOTTOM) == COLLISION_DATA_3) {
SetTileType(TILE_TYPE_756, tilePos2, LAYER_BOTTOM);
@ -3428,7 +3428,7 @@ u32 sub_0807B600(u32 tilePos) {
}
if (sub_0807B464(tilePos2, LAYER_TOP)) {
SetTileType(0, tilePos2, LAYER_TOP);
if (GetTileType(tilePos2, LAYER_BOTTOM) == TILE_TYPE_754) {
if (GetTileTypeAtTilePos(tilePos2, LAYER_BOTTOM) == TILE_TYPE_754) {
SetTileType(TILE_TYPE_756, tilePos2, LAYER_BOTTOM);
}
sub_0807B55C(tilePos + 1, 1, (u16*)&gUnk_0811C2AC);
@ -3446,7 +3446,7 @@ u32 sub_0807B600(u32 tilePos) {
void sub_0807B778(u32 tilePos, u32 layer) {
u32 tmp;
if (GetVvvAtTilePos(tilePos, layer) == VVV_13) {
if (GetActTileAtTilePos(tilePos, layer) == ACT_TILE_13) {
tmp = sub_0807B434(tilePos + TILE_POS(0, -1), layer);
tmp |= sub_0807B434(tilePos + TILE_POS(1, 0), layer) << 1;
tmp |= sub_0807B434(tilePos + TILE_POS(0, 1), layer) << 2;
@ -3504,30 +3504,30 @@ void sub_0807B930(u32 tilePos) {
SetTileType(TILE_TYPE_658, tilePos + TILE_POS(1, 0), LAYER_BOTTOM);
}
void SetTileByIndex(u32 tileIndex, u32 position, u32 layer) {
void SetTileByIndex(u32 tileIndex, u32 tilePos, u32 layer) {
MapLayer* mapLayer;
u16* src;
u16* subTiles;
u16* dest;
u16 tileType;
UnregisterInteractTile(position, layer);
UnregisterInteractTile(tilePos, layer);
mapLayer = GetLayerByIndex(layer);
mapLayer->mapData[position] = tileIndex;
mapLayer->mapData[tilePos] = tileIndex;
tileType = mapLayer->tileTypes[tileIndex];
mapLayer->collisionData[position] = gMapTileTypeToCollisionData[tileType];
mapLayer->vvv[position] = gMapTileTypeToVvv[tileType];
mapLayer->collisionData[tilePos] = gMapTileTypeToCollisionData[tileType];
mapLayer->actTiles[tilePos] = gMapTileTypeToActTile[tileType];
if ((gRoomControls.scroll_flags & 1) == 0) {
u32 offset = (position & 0x3f) * 2 + (position & 0xfc0) * 4;
u32 offset = (tilePos & 0x3f) * 2 + (tilePos & 0xfc0) * 4;
if (layer != 2) {
dest = gMapDataBottomSpecial + offset;
} else {
dest = gMapDataTopSpecial + offset;
}
src = mapLayer->tiles + tileIndex * 4;
*dest = *src;
dest[1] = src[1];
dest[0x80] = src[2];
dest[0x81] = src[3];
subTiles = mapLayer->subTiles + tileIndex * 4;
*dest = *subTiles;
dest[1] = subTiles[1];
dest[0x80] = subTiles[2];
dest[0x81] = subTiles[3];
if (gRoomControls.reload_flags != 1) {
gUpdateVisibleTiles = 1;
}
@ -3539,14 +3539,14 @@ void RestorePrevTileEntity(u32 tilePos, u32 layer) {
u32 tileType;
MapLayer* mapLayer;
u16* dest;
u16* src;
u16* subTiles;
UnregisterInteractTile(tilePos, layer);
mapLayer = GetLayerByIndex(layer);
mapLayer->mapData[tilePos] = tileIndex = mapLayer->mapDataOriginal[tilePos];
tileType = mapLayer->tileTypes[tileIndex];
mapLayer->collisionData[tilePos] = gMapTileTypeToCollisionData[tileType];
mapLayer->vvv[tilePos] = gMapTileTypeToVvv[tileType];
mapLayer->actTiles[tilePos] = gMapTileTypeToActTile[tileType];
if ((gRoomControls.scroll_flags & 1) == 0) {
u32 offset = (tilePos & 0x3f) * 2 + (tilePos & 0xfc0) * 4;
if (layer != 2) {
@ -3554,11 +3554,11 @@ void RestorePrevTileEntity(u32 tilePos, u32 layer) {
} else {
dest = gMapDataTopSpecial + offset;
}
src = &mapLayer->tiles[tileIndex * 4];
dest[0] = src[0];
dest[1] = src[1];
dest[0x80] = src[2];
dest[0x81] = src[3];
subTiles = &mapLayer->subTiles[tileIndex * 4];
dest[0] = subTiles[0];
dest[1] = subTiles[1];
dest[0x80] = subTiles[2];
dest[0x81] = subTiles[3];
if (gRoomControls.reload_flags != 1) {
gUpdateVisibleTiles = 1;
}
@ -3813,12 +3813,11 @@ void sub_0807BFA8(void) {
gRoomControls.height = (gArea.pCurrentRoomInfo)->pixel_height;
}
void sub_0807BFD0(void) {
void SetupTileSet(void) {
s32 index;
u16* puVar2;
u16* puVar3;
u16* ptr;
typeof(gMapTop)* newptr;
u16* tileTypes;
u16* tileIndices;
u16* paletteBuffer;
ClearBgAnimations();
sub_0807BFA8();
@ -3827,37 +3826,37 @@ void sub_0807BFD0(void) {
MemFill16(0xffff, gMapTop.tileTypes, 0x1000);
gMapTop.tileTypes[0] = 0;
if ((void*)gRoomControls.unk_34 != (gArea.pCurrentRoomInfo)->tileset) {
gRoomControls.unk_34 = (u32)(gArea.pCurrentRoomInfo)->tileset;
if ((void*)gRoomControls.tileset != (gArea.pCurrentRoomInfo)->tileset) {
gRoomControls.tileset = (u32)(gArea.pCurrentRoomInfo)->tileset;
LoadMapData((gArea.pCurrentRoomInfo)->tileset);
}
LoadMapData((gArea.pCurrentRoomInfo)->tiles);
ptr = gPaletteBuffer;
MemCopy(&ptr[0x30], &ptr[0x150], 0x20);
paletteBuffer = gPaletteBuffer;
MemCopy(&paletteBuffer[0x30], &paletteBuffer[0x150], 0x20);
gUsedPalettes |= 0x200000;
if ((gArea.pCurrentRoomInfo)->bg_anim != NULL) {
LoadBgAnimations((gArea.pCurrentRoomInfo)->bg_anim);
}
puVar2 = gMapBottom.tileTypes;
puVar3 = gMapBottom.unkData2;
MemFill16(0xffff, puVar3, 0x1000);
tileTypes = gMapBottom.tileTypes;
tileIndices = gMapBottom.tileIndices;
MemFill16(0xffff, tileIndices, 0x1000);
for (index = 0; index < 0x800; index++, puVar2++) {
if ((*puVar2 < 0x800) && (puVar3[*puVar2] == 0xffff)) {
puVar3[*puVar2] = index;
for (index = 0; index < 0x800; index++, tileTypes++) {
if ((*tileTypes < 0x800) && (tileIndices[*tileTypes] == 0xffff)) {
tileIndices[*tileTypes] = index;
}
}
puVar2 = gMapTop.tileTypes;
puVar3 = gMapTop.unkData2;
MemFill16(0xffff, puVar3, 0x1000);
tileTypes = gMapTop.tileTypes;
tileIndices = gMapTop.tileIndices;
MemFill16(0xffff, tileIndices, 0x1000);
for (index = 0; index < 0x800; index++, puVar2++) {
if ((*puVar2 < 0x800) && (puVar3[*puVar2] == 0xffff)) {
puVar3[*puVar2] = index;
for (index = 0; index < 0x800; index++, tileTypes++) {
if ((*tileTypes < 0x800) && (tileIndices[*tileTypes] == 0xffff)) {
tileIndices[*tileTypes] = index;
}
}
}
@ -3889,18 +3888,18 @@ void LoadRoomGfx(void) {
MemCopy(gMapBottom.mapData, gMapBottom.mapDataOriginal, sizeof(gMapBottom.mapData));
MemCopy(gMapTop.mapData, gMapTop.mapDataOriginal, sizeof(gMapBottom.mapData));
} else if (gRoomTransition.field2d == 2) {
MemCopy(gMapBottom.mapData, gMapBottom.vvv, 0x1000);
MemCopy(gMapBottom.mapData, gMapBottom.actTiles, 0x1000);
MemCopy(gMapBottom.mapDataOriginal, gMapBottom.mapData, 0x1000);
MemCopy(gMapBottom.vvv, gMapBottom.mapDataOriginal, 0x1000);
MemCopy(gMapBottom.mapData + 0x800, gMapBottom.vvv, 0x1000);
MemCopy(gMapBottom.actTiles, gMapBottom.mapDataOriginal, 0x1000);
MemCopy(gMapBottom.mapData + 0x800, gMapBottom.actTiles, 0x1000);
MemCopy(gMapBottom.mapDataOriginal + 0x800, gMapBottom.mapData + 0x800, 0x1000);
MemCopy(gMapBottom.vvv, gMapBottom.mapDataOriginal + 0x800, 0x1000);
MemCopy(gMapTop.mapData, gMapTop.vvv, 0x1000);
MemCopy(gMapBottom.actTiles, gMapBottom.mapDataOriginal + 0x800, 0x1000);
MemCopy(gMapTop.mapData, gMapTop.actTiles, 0x1000);
MemCopy(gMapTop.mapDataOriginal, gMapTop.mapData, 0x1000);
MemCopy(gMapTop.vvv, gMapTop.mapDataOriginal, 0x1000);
MemCopy(gMapTop.mapData + 0x800, gMapTop.vvv, 0x1000);
MemCopy(gMapTop.actTiles, gMapTop.mapDataOriginal, 0x1000);
MemCopy(gMapTop.mapData + 0x800, gMapTop.actTiles, 0x1000);
MemCopy(gMapTop.mapDataOriginal + 0x800, gMapTop.mapData + 0x800, 0x1000);
MemCopy(gMapTop.vvv, gMapTop.mapDataOriginal + 0x800, 0x1000);
MemCopy(gMapTop.actTiles, gMapTop.mapDataOriginal + 0x800, 0x1000);
}
if (!clearBottomMap) {
sub_0807BBE4();
@ -3910,8 +3909,8 @@ void LoadRoomGfx(void) {
sub_0807C460();
}
CreateCollisionDataBorderAroundRoom();
FillVvvForLayer(&gMapBottom);
FillVvvForLayer(&gMapTop);
FillActTileForLayer(&gMapBottom);
FillActTileForLayer(&gMapTop);
if (!clearBottomMap) {
// Render the complete bottom and top tilemaps into the tilemaps.
RenderMapLayerToSubTileMap(gMapDataBottomSpecial, &gMapBottom);
@ -4153,7 +4152,7 @@ void InitializeCamera() {
u32 tmp1;
u32 tmp2;
sub_0807BFD0();
SetupTileSet();
LoadRoomGfx();
roomControls = &gRoomControls;
target = gRoomControls.camera_target;
@ -4213,12 +4212,12 @@ void sub_0807C810(void) {
DiggingCaveEntranceTransition* ptr;
Entity* player;
RoomControls* ctrls;
sub_0807BFD0();
SetupTileSet();
ptr = &gDiggingCaveEntranceTransition;
player = &gPlayerEntity.base;
ctrls = &gRoomControls;
player->x.HALF.HI = ((ptr->entrance)->targetTilePosition & 0x3f) * 0x10 + ctrls->origin_x + ptr->offsetX;
player->y.HALF.HI = (((ptr->entrance)->targetTilePosition & 0xfc0) >> 2) + ctrls->origin_y + ptr->offsetY;
player->x.HALF.HI = ((ptr->entrance)->targetTilePos & 0x3f) * 0x10 + ctrls->origin_x + ptr->offsetX;
player->y.HALF.HI = (((ptr->entrance)->targetTilePos & 0xfc0) >> 2) + ctrls->origin_y + ptr->offsetY;
sub_080809D4();
gUpdateVisibleTiles = 0;
}
@ -4291,11 +4290,11 @@ void LoadCompressedMapData(void* dest, u32 offset) {
}
}
void sub_0807C998(u32* a1) {
LoadCompressedMapData(&gMapBottom.tiles, a1[0]);
LoadCompressedMapData(&gMapBottom.tileTypes, a1[1]);
LoadCompressedMapData(&gMapTop.tiles, a1[2]);
LoadCompressedMapData(&gMapTop.tileTypes, a1[3]);
void sub_0807C998(u32* dest) {
LoadCompressedMapData(&gMapBottom.subTiles, dest[0]);
LoadCompressedMapData(&gMapBottom.tileTypes, dest[1]);
LoadCompressedMapData(&gMapTop.subTiles, dest[2]);
LoadCompressedMapData(&gMapTop.tileTypes, dest[3]);
}
void sub_0807C9D8(u32* a1) {

View File

@ -151,7 +151,7 @@ void sub_080A90D8(GleerokProjectileEntity* this) {
if (this->unk_74 != TILE(super->x.HALF.HI, super->y.HALF.HI)) {
this->unk_74 = TILE(super->x.HALF.HI, super->y.HALF.HI);
tmp = GetTileTypeByEntity(super);
tmp = GetTileTypeAtEntity(super);
if ((tmp == 0x13) || (tmp == 0x34)) {
sub_0807B7D8(0x34c, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
}

View File

@ -118,7 +118,7 @@ void MandiblesProjectile_Action2(MandiblesProjectileEntity* this) {
EnqueueSFX(SFX_15D);
}
this->unk_78 = TILE(super->x.HALF.HI, super->y.HALF.HI);
if (GetTileType(this->unk_78, super->collisionLayer) == SPECIAL_TILE_0) {
if (GetTileTypeAtTilePos(this->unk_78, super->collisionLayer) == SPECIAL_TILE_0) {
SetTile(SPECIAL_TILE_5, this->unk_78, super->collisionLayer);
}
}

View File

@ -74,7 +74,7 @@ void sub_080AA494(RemovableDustEntity* this) {
u32 index;
index = 0;
tileType = GetTileTypeByEntity(super);
tileType = GetTileTypeAtEntity(super);
iterator = gUnk_08129FD0;
while (*iterator != 0) {
if (*(iterator++) == tileType) {
@ -100,7 +100,7 @@ void sub_080AA534(Entity* this) {
void sub_080AA544(RemovableDustEntity* this) {
u8* pbVar1;
s32 vvv;
s32 actTile;
u32 uVar3;
s32 iVar4;
const u16* puVar5;
@ -113,8 +113,8 @@ void sub_080AA544(RemovableDustEntity* this) {
uVar3 = 0;
iVar4 = 0;
do {
vvv = GetVvvAtTilePos((tilePos - tmp[uVar3]) & 0xffff, super->collisionLayer);
if (vvv == VVV_62) {
actTile = GetActTileAtTilePos((tilePos - tmp[uVar3]) & 0xffff, super->collisionLayer);
if (actTile == ACT_TILE_62) {
iVar4++;
}
uVar3++;

View File

@ -119,7 +119,7 @@ void sub_080AB4A4(V1FireProjectileEntity* this) {
tilePos = TILE(super->x.HALF.HI, super->y.HALF.HI);
if (oldTilePos != tilePos) {
this->tilePos = tilePos;
switch (GetTileTypeByEntity(super)) {
switch (GetTileTypeAtEntity(super)) {
case 0x13:
case 0x34:
sub_0807B7D8(0x34c, this->tilePos, super->collisionLayer);

View File

@ -105,7 +105,7 @@ void sub_080ABCC4(V2ProjectileEntity* this) {
super->subtimer = 0;
super->direction = Random() & 0x1f;
this->tilePos = TILE(super->x.HALF.HI, super->y.HALF.HI);
this->tileType = GetTileType(this->tilePos, LAYER_TOP);
this->tileType = GetTileTypeAtTilePos(this->tilePos, LAYER_TOP);
super->spritePriority.b0 = 2;
InitializeAnimation(super, 0);
SoundReq(SFX_14B);
@ -127,7 +127,7 @@ void sub_080ABD70(V2ProjectileEntity* this) {
super->frame &= 0xef;
super->speed = 0;
this->tilePos = TILE(super->x.HALF.HI, super->y.HALF.HI);
this->tileType = GetTileType(this->tilePos, LAYER_TOP);
this->tileType = GetTileTypeAtTilePos(this->tilePos, LAYER_TOP);
tmp = this->tileType;
if (tmp != 0x13) {
if (tmp == 0x315) {

View File

@ -30,7 +30,7 @@ extern u16 gUnk_0200B640;
extern MapDataDefinition** gCaveBorderMapData[];
extern u16 gUnk_02022830[0xc00];
extern u16 gUnk_020246B0[0xc00];
extern u8 gMapSpecialTileToVvv[];
extern u8 gMapSpecialTileToActTile[];
void Scroll0(RoomControls*);
void Scroll1(RoomControls*);
@ -54,7 +54,7 @@ u32 sub_080803D0();
u32 sub_08080278();
void sub_08080C80(MapDataDefinition*);
void sub_08080368();
void FillVvvForLayer(MapLayer* mapLayer);
void FillActTileForLayer(MapLayer* mapLayer);
bool32 sub_08080794(const Transition* transition, u32 param_2, u32 param_3, u32 param_4);
bool32 sub_08080808(const Transition* transition, u32 param_2, u32 param_3, u32 param_4);
void sub_080808D8(s32);
@ -355,8 +355,8 @@ void Scroll5Sub3(RoomControls* controls) {
sub_08080368();
gUnk_02034480.unk_00 = gUnk_0200B640;
MemCopy(gUnk_02022830, gUnk_020246B0, 0x1800);
FillVvvForLayer(&gMapBottom);
FillVvvForLayer(&gMapTop);
FillActTileForLayer(&gMapBottom);
FillActTileForLayer(&gMapTop);
sub_0807BBE4();
CreateCollisionDataBorderAroundRoom();
sub_0805E248();
@ -843,7 +843,7 @@ void sub_080809D4(void) {
}
void UpdateDoorTransition() {
u32 vvv;
u32 actTile;
u32 x;
u32 y;
RoomControls* controls = &gRoomControls;
@ -864,35 +864,35 @@ void UpdateDoorTransition() {
case 0x1d:
y = controls->camera_target->y.HALF.HI - controls->origin_y;
x = controls->camera_target->x.HALF.HI - controls->origin_x;
vvv = GetVvvAtTilePos(
actTile = GetActTileAtTilePos(
(((controls->camera_target->x.HALF.HI - controls->origin_x) >> 4) & 0x3F) |
((((controls->camera_target->y.HALF.HI - controls->origin_y) >> 4) & 0x3F) << 6),
controls->camera_target->collisionLayer);
gRoomTransition.stairs_idx = sub_080B1A48(x, y, controls->camera_target->collisionLayer);
switch (vvv) {
case VVV_63:
case VVV_241:
case VVV_40:
case VVV_41:
gRoomTransition.stairs_idx = GetTileTypeAtRoomCoords(x, y, controls->camera_target->collisionLayer);
switch (actTile) {
case ACT_TILE_63:
case ACT_TILE_241:
case ACT_TILE_40:
case ACT_TILE_41:
sub_080806BC(x, y, 0xff, 10);
break;
}
}
}
// fill the vvv for the whole layer
void FillVvvForLayer(MapLayer* mapLayer) {
// fill the actTile for the whole layer
void FillActTileForLayer(MapLayer* mapLayer) {
u32 tilePos;
u16* tileTypes = mapLayer->tileTypes;
const u8* ptr = gMapTileTypeToVvv;
u8* ptr3 = mapLayer->vvv;
const u8* ptr = gMapTileTypeToActTile;
u8* actTiles = mapLayer->actTiles;
u16* mapData = mapLayer->mapData;
for (tilePos = 0; tilePos < 0x40 * 0x40; tilePos++) {
u16 tileIndex = mapData[tilePos];
if (tileIndex < 0x4000) {
mapLayer->vvv[tilePos] = ptr[tileTypes[tileIndex]];
mapLayer->actTiles[tilePos] = ptr[tileTypes[tileIndex]];
} else {
mapLayer->vvv[tilePos] = gMapSpecialTileToVvv[tileIndex - 0x4000];
mapLayer->actTiles[tilePos] = gMapSpecialTileToActTile[tileIndex - 0x4000];
}
}
}