Extract KeyValuePairs

This commit is contained in:
octorock
2023-06-17 00:10:00 +02:00
parent 551cb72093
commit c317fe3f18
82 changed files with 812 additions and 760 deletions
@@ -18,7 +18,7 @@ _080789C0:
cmp r0, #0
bne _08078A56
ldr r0, _08078A60 @ =gPlayerEntity
bl sub_080B1B0C
bl GetCollisionDataAtEntity
adds r4, r0, #0
cmp r4, #0xf
bls _080789E6
@@ -100,7 +100,7 @@ _0807A3AA:
lsrs r4, r7, #1
adds r0, r4, #0
movs r1, #1
bl GetCollisionData
bl GetCollisionDataAtMetaTilePos
cmp r0, #0
beq _0807A3FC
lsls r0, r4, #0x10
@@ -108,7 +108,7 @@ _0807A3AA:
mov r1, sl
adds r1, #0x38
ldrb r1, [r1]
bl sub_080B1AE0
bl GetVvvAtMetaTilePos
lsls r0, r0, #0x10
lsrs r0, r0, #0x10
mov r2, sl
@@ -118,7 +118,7 @@ _0807A3AA:
ldr r2, _0807A3F8 @ =gUnk_0811C1D8
adds r1, r1, r2
ldr r1, [r1]
bl sub_08007DD6
bl FindValueForKey
cmp r0, #0
beq _0807A468
b _0807A400
@@ -138,7 +138,7 @@ _0807A400:
lsrs r4, r6, #1
adds r0, r4, #0
movs r1, #1
bl GetCollisionData
bl GetCollisionDataAtMetaTilePos
cmp r0, #0
beq _0807A44C
lsls r0, r4, #0x10
@@ -146,7 +146,7 @@ _0807A400:
adds r1, r5, #0
adds r1, #0x38
ldrb r1, [r1]
bl sub_080B1AE0
bl GetVvvAtMetaTilePos
lsls r0, r0, #0x10
lsrs r0, r0, #0x10
ldrb r1, [r5, #0x14]
@@ -155,7 +155,7 @@ _0807A400:
ldr r2, _0807A448 @ =gUnk_0811C1D8
adds r1, r1, r2
ldr r1, [r1]
bl sub_08007DD6
bl FindValueForKey
cmp r0, #0
beq _0807A468
b _0807A450
@@ -195,7 +195,7 @@ _0807A46E:
adds r7, r0, #0
lsrs r0, r7, #1
movs r1, #2
bl GetCollisionData
bl GetCollisionDataAtMetaTilePos
cmp r0, #0
bne _0807A4F2
adds r0, r4, #0
@@ -206,7 +206,7 @@ _0807A46E:
lsrs r0, r6, #1
movs r1, #2
_0807A4A0:
bl GetCollisionData
bl GetCollisionDataAtMetaTilePos
cmp r0, #0
beq _0807A4EC
b _0807A4F2
@@ -224,7 +224,7 @@ _0807A4B0:
_0807A4C2:
lsrs r0, r7, #1
movs r1, #1
bl GetCollisionData
bl GetCollisionDataAtMetaTilePos
cmp r0, #0
bne _0807A4F2
mov r1, sb
+1 -42
View File
@@ -170,7 +170,7 @@ _08004516:
thumb_func_start sub_0800451C
sub_0800451C: @ 0x0800451C
push {r0, lr}
bl GetTileUnderEntity
bl GetVvvAtEntity
adds r1, r0, #0
pop {r0, r3}
mov lr, r3
@@ -367,44 +367,3 @@ _08004694: .4byte ram_CalcCollisionDirection
_08004698: .4byte gUnk_080C93E0
_0800469C: .4byte 0x00000106
_080046A0: .4byte 0x00000280
gUnk_080046A4:: @ 080046A4
.incbin "code_080043E8/gUnk_080046A4.bin"
gUnk_080047F6:: @ 080047F6
.incbin "code_080043E8/gUnk_080047F6.bin"
@ TODO PlayerMacros
gUnk_080049D6:: @ 080049D6
.incbin "code_080043E8/gUnk_080049D6.bin"
gUnk_080049F6:: @ 080049F6
.incbin "code_080043E8/gUnk_080049F6.bin"
gUnk_080049FE:: @ gUnk_080049FE
.incbin "code_080043E8/gUnk_080049FE.bin"
gUnk_08004A0C:: @ 08004A0C
.incbin "code_080043E8/gUnk_08004A0C.bin"
gUnk_08004A16:: @ 08004A16
.incbin "code_080043E8/gUnk_08004A16.bin"
gUnk_08004A24:: @ 08004A24
.incbin "code_080043E8/gUnk_08004A24.bin"
gUnk_08004A32:: @ 08004A32
.incbin "code_080043E8/gUnk_08004A32.bin"
gUnk_08004A48:: @ 08004A48
.incbin "code_080043E8/gUnk_08004A48.bin"
gUnk_08004A72:: @ 08004A72
.incbin "code_080043E8/gUnk_08004A72.bin"
gUnk_08004A8C:: @ 08004A8C
.incbin "code_080043E8/gUnk_08004A8C.bin"
gUnk_08004AA6:: @ 08004AA6
.incbin "code_080043E8/gUnk_08004AA6.bin"
+25 -32
View File
@@ -5,48 +5,41 @@
.text
gUnk_08007CAC:: @ 08007CAC
.incbin "code_080043E8/gUnk_08007CAC.bin"
.ifdef DEMO_JP
@ TODO only one byte differs
.incbin "code_080043E8/gUnk_08007CAC_1_DEMO_JP.bin"
.else
.ifdef DEMO_USA
@ TODO only one byte differs
.incbin "code_080043E8/gUnk_08007CAC_2_DEMO_USA.bin"
.else
.ifdef JP
@ TODO only one byte differs
.incbin "code_080043E8/gUnk_08007CAC_3_JP.bin"
.else
.ifdef EU
@ TODO only two bytes differ
.incbin "code_080043E8/gUnk_08007CAC_4_EU.bin"
.else
.incbin "code_080043E8/gUnk_08007CAC_5_USA.bin"
.endif
.endif
.endif
.endif
@ TODO cannot add this at the end of mapVvvToSurfaceType.c due to alignment?
.2byte 0
non_word_aligned_thumb_func_start sub_08007DD6
sub_08007DD6: @ 0x08007DD6
@ TODO unused?
gUnk_08007DBE:: @ 08007DBE
.byte 0x42, 0x7b, 0x01, 0x32, 0x42, 0x73, 0x70, 0x47, 0x02, 0x73, 0x00, 0x23, 0x43, 0x73, 0x0b, 0x73
@ seems unused?
non_word_aligned_thumb_func_start sub_08007DCE
sub_08007DCE:
push {lr}
bl DoPlayerAction
pop {pc}
@ Find the key in the map of u16 to u16
@ r0: value, r1: array of u16*
non_word_aligned_thumb_func_start FindValueForKey
FindValueForKey: @ 0x08007DD6
push {lr}
bl sub_08007DE0
adds r0, r3, #0
adds r0, r3, #0 @ move the found value into r0
pop {pc}
thumb_func_start sub_08007DE0
sub_08007DE0: @ 0x08007DE0
subs r1, #4
_08007DE2:
adds r1, #4
ldrh r3, [r1]
adds r1, #4 @ add +4 to r1 at the end of loop
ldrh r3, [r1] @ r3: key
cmp r3, #0
beq _08007DF2
beq _08007DF2 @ key == 0 -> end of map
cmp r0, r3
bne _08007DE2
ldrh r3, [r1, #2]
movs r2, #1
bne _08007DE2 @ r3 == r0 -> found
ldrh r3, [r1, #2] @ r3: value
movs r2, #1 @ r2 = 1
_08007DF2:
bx lr
+21 -21
View File
@@ -121,67 +121,67 @@ _080B1A64:
ldrh r0, [r1, r0]
bx lr
arm_func_start arm_GetRelativeCollisionTile
arm_GetRelativeCollisionTile: @ 0x080B1A8C
arm_func_start arm_GetVvvRelativeToEntity
arm_GetVvvRelativeToEntity: @ 0x080B1A8C @ entity plus offset to world pixel coordinates and layer
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_sub_080B1AB4
arm_GetTileUnderEntity:
b arm_GetVvvAtWorldCoords
arm_GetVvvAtEntity: @ entity to world pixel coordinates and layer
ldrb r2, [r0, #0x38]
ldrh r1, [r0, #0x32]
ldrh r0, [r0, #0x2e]
arm_sub_080B1AB4:
arm_GetVvvAtWorldCoords: @ 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_sub_080B1AC8:
arm_GetVvvAtRoomCoords: @ room pixel coordinates to room tile coordinates
lsl r0, r0, #0x16
lsr r0, r0, #0x1a
lsl r1, r1, #0x16
lsr r1, r1, #0x1a
arm_sub_080B1AD8:
arm_GetVvvAtRoomTile:
add r0, r0, r1, lsl #6
mov r1, r2
arm_sub_080B1AE0:
ldr r2, _080B1C24 @ =gUnk_08000278
mov r1, r2 @ move layer to r1
arm_GetVvvAtMetaTilePos:
ldr r2, _080B1C24 @ =gVvvPtrs
ldr r2, [r2, r1, lsl #2]
ldrb r0, [r2, r0]
bx lr
arm_func_start arm_sub_080B1AF0
arm_sub_080B1AF0: @ 0x080B1AF0
arm_func_start arm_GetCollisionDataRelativeTo
arm_GetCollisionDataRelativeTo: @ 0x080B1AF0
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_sub_080B1B18
arm_sub_080B1B0C:
b arm_GetCollisionDataAtWorldCoords
arm_GetCollisionDataAtEntity:
ldrb r2, [r0, #0x38]
ldrh r1, [r0, #0x32]
ldrh r0, [r0, #0x2e]
arm_sub_080B1B18:
arm_GetCollisionDataAtWorldCoords:
ldr ip, _080B1C28 @ =gRoomControls
ldrh r3, [ip, #6]
sub r0, r0, r3
ldrh r3, [ip, #8]
sub r1, r1, r3
arm_sub_080B1B2C:
arm_GetCollisionDataAtRoomCoords:
lsl r0, r0, #0x16
lsr r0, r0, #0x1a
lsl r1, r1, #0x16
lsr r1, r1, #0x1a
arm_sub_080B1B3C:
arm_GetCollisionDataAtRoomTile:
add r0, r0, r1, lsl #6
mov r1, r2
arm_GetCollisionData:
arm_GetCollisionDataAtMetaTilePos:
ldr r2, _080B1C2C @ =gCollisionDataPtrs
ldr r1, [r2, r1, lsl #2]
ldrb r0, [r1, r0]
@@ -243,7 +243,7 @@ sub_080B1BCC: @ 0x080B1BCC
and r1, r1, #0x3f0
and r2, r2, #0x3f0
add r1, r1, r2, lsl #6
ldr r2, _080B1C50 @ =gUnk_08000278
ldr r2, _080B1C50 @ =gVvvPtrs
ldrb r3, [r0, #0x38]
ldr r2, [r2, r3, lsl #2]
ldrb r0, [r2, r1, lsr #4]
@@ -254,7 +254,7 @@ _080B1C14: .4byte gUnk_08000258
_080B1C18: .4byte gRoomControls
_080B1C1C: .4byte gMapDataPtrs
_080B1C20: .4byte gRoomControls
_080B1C24: .4byte gUnk_08000278
_080B1C24: .4byte gVvvPtrs
_080B1C28: .4byte gRoomControls
_080B1C2C: .4byte gCollisionDataPtrs
_080B1C30: .4byte gUnk_080B37A0
@@ -265,7 +265,7 @@ _080B1C40: .4byte gUnk_080B7A3E
_080B1C44: .4byte gUnk_08000360
_080B1C48: .4byte gUnk_080B7A3E
_080B1C4C: .4byte gRoomControls
_080B1C50: .4byte gUnk_08000278
_080B1C50: .4byte gVvvPtrs
arm_func_start UpdateCollision
UpdateCollision: @ 0x080B1C54
+2 -2
View File
@@ -758,12 +758,12 @@ CheckNEastTile: @ 0x08008B02
push {r0, r1, lr}
movs r1, #0
movs r2, #0
bl GetRelativeCollisionTile
bl GetVvvRelativeToEntity
// check if north east collision?
ldr r1, =0x4000
tst r0, r1
bne _08008B1E
ldr r1, =gUnk_08007CAC
ldr r1, =gMapVvvToSurfaceType
bl sub_08007DE0
movs r2, #1
cmp r3, #1
+1 -1
View File
@@ -106,7 +106,7 @@ _08016A64:
sub_08016A6C: @ 0x08016A6C
push {r4, r5, lr}
adds r4, r0, #0
bl GetTileUnderEntity
bl GetVvvAtEntity
add r1, pc, #0x38
_08016A76:
adds r1, #4
+77 -76
View File
@@ -57,43 +57,43 @@ CloneTile: @ 0x08000152
non_word_aligned_thumb_func_start SetTile
SetTile: @ r0 = tile type, r1, = tile position, r2 = layer
push {r4-r7, lr}
lsls r3, r2, #3
lsls r3, r2, #3 @ 1: 8, 2: 16
ldr r4, _08000208 @ =gMapDataPtrs
ldr r5, [r4, r3]
ldr r5, [r4, r3] @ layer 1: gMapBottom.mapData, 2: gMapTop.mapData
lsls r6, r1, #1
ldrh r7, [r5, r6]
strh r0, [r5, r6]
ldrh r7, [r5, r6] @ r7 (oldMetaTile) = gMapBottom.mapData[metaTilePos]
strh r0, [r5, r6] @ gMapBottom.mapData[metaTilePos] = metaTile
ldr r6, _0800020C @ =0x00004000
cmp r0, r6
blo _0800019A
blo _0800019A @ jump if metaTile < 0x4000
push {r1, r2}
subs r4, r0, r6
subs r4, r0, r6 @ r4 = metaTile - 0x4000
ldr r3, _08000210 @ =gUnk_080B7910
ldrb r0, [r3, r4]
bl sub_080001D0
ldrb r0, [r3, r4] @ r0 = gUnk_080B7910[metaTile - 0x4000]
bl SetVvvAtMetaTilePos
ldr r3, _08000214 @ =gUnk_080B79A7
ldrb r0, [r3, r4]
lsrs r2, r2, #2
ldrb r0, [r3, r4] @ r0 = gUnk_080B79A7[metaTile - 0x4000]
lsrs r2, r2, #2 @ r2 = layer
bl SetCollisionData
pop {r0, r1} @ tilepos, layer
push {r0, r1}
bl DeleteLoadedTileEntity
adds r0, r7, #0
bl DeleteLoadedTileEntity @ DeleteLoadedTileEntity(metaTilePos, layer)
adds r0, r7, #0 @ r0 = oldMetaTile
pop {r1, r2}
bl sub_0801AF48
pop {r4, r5, r6, r7, pc}
bl sub_0801AF48 @ sub_0801AF48(oldMetaTile, metaTilePos, layer)
pop {r4, r5, r6, r7, pc} @ pop pc results in returning to the calling function
_0800019A:
adds r3, #4
adds r3, #4 @ r3 = layer * 8 + 4
ldr r4, [r4, r3]
lsls r0, r0, #1
ldrh r4, [r4, r0]
lsls r0, r0, #1 @ r0 = metaTile * 2
ldrh r4, [r4, r0] @ r4 (metaTileType) = gMapBottom.metatileTypes[metaTile]
push {r1, r2}
ldr r3, _08000218 @ =gUnk_080B37A0
ldrb r0, [r3, r4]
bl sub_080001D0
ldrb r0, [r3, r4] @ r0 = gUnk_080B37A0[metaTileType]
bl SetVvvAtMetaTilePos
ldr r3, _0800021C @ =gUnk_080B3E80
ldrb r0, [r3, r4]
lsrs r2, r2, #2
ldrb r0, [r3, r4] @ r0 = gUnk_080B3E80[metaTileType]
lsrs r2, r2, #2 @ r2 = layer
bl SetCollisionData
pop {r0, r1}
bl DeleteLoadedTileEntity
@@ -104,12 +104,13 @@ _080001C4: .4byte gMapBottom+0x6004
_080001C8: .4byte gMapTop+0x6004
_080001CC: .4byte gMapBottom+0x6004
thumb_func_start sub_080001D0
sub_080001D0: @ 0x080001D0
@ r0: @see gUnk_080B7910 r1: metaTilePos, r2: layer
thumb_func_start SetVvvAtMetaTilePos
SetVvvAtMetaTilePos: @ 0x080001D0
lsls r2, r2, #2
ldr r3, _08000220 @ =gUnk_08000278
ldr r3, [r3, r2]
strb r0, [r3, r1]
ldr r3, _08000220 @ =gVvvPtrs
ldr r3, [r3, r2] @ r3 = gMapBottom.vvv
strb r0, [r3, r1] @ gMapBottom.vvv[metaTilePos] = r0
bx lr
non_word_aligned_thumb_func_start GetTileIndex
@@ -135,7 +136,7 @@ _08000210: .4byte gUnk_080B7910
_08000214: .4byte gUnk_080B79A7
_08000218: .4byte gUnk_080B37A0
_0800021C: .4byte gUnk_080B3E80
_08000220: .4byte gUnk_08000278
_08000220: .4byte gVvvPtrs
_08000224: .4byte gMapDataPtrs
gMapDataPtrs::
@@ -162,7 +163,7 @@ gUnk_08000258:: @ mapDataClone and metatileTypes
.4byte gMapTop+0x5004
.4byte gMapBottom+0x3004 @ layer 3
.4byte gMapBottom+0x5004
gUnk_08000278:: @ unkData3 for layers
gVvvPtrs:: @ vvv for layers
.4byte gMapBottom+0xb004 @ layer 0
.4byte gMapBottom+0xb004 @ layer 1
.4byte gMapTop+0xb004 @ layer 2
@@ -266,9 +267,9 @@ GetTileType: @ 0x080002B0
@ r0: Entity*
@ r1: u32
@ r2: u32
thumb_func_start GetRelativeCollisionTile
GetRelativeCollisionTile: @ 0x080002B4
ldr r3, _08000320 @ =ram_GetRelativeCollisionTile
thumb_func_start GetVvvRelativeToEntity
GetVvvRelativeToEntity: @ 0x080002B4
ldr r3, _08000320 @ =ram_GetVvvRelativeToEntity
bx r3
@ call 0x080B1AA8
@@ -278,18 +279,18 @@ GetRelativeCollisionTile: @ 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 GetTileUnderEntity
GetTileUnderEntity: @ 0x080002B8
ldr r3, _08000324 @ =ram_GetTileUnderEntity
thumb_func_start GetVvvAtEntity
GetVvvAtEntity: @ 0x080002B8
ldr r3, _08000324 @ =ram_GetVvvAtEntity
bx r3
@ call 0x080B1AB4
@ r0: s32 (xPos)
@ r1: s32 (yPos)
@ r2: u32 (layer)
thumb_func_start sub_080B1AB4
sub_080B1AB4: @ 0x080002BC
ldr r3, _08000328 @ =ram_sub_080B1AB4
thumb_func_start GetVvvAtWorldCoords
GetVvvAtWorldCoords: @ 0x080002BC
ldr r3, _08000328 @ =ram_GetVvvAtWorldCoords
bx r3
@ call 0x080B1AC8
@@ -297,9 +298,9 @@ sub_080B1AB4: @ 0x080002BC
@ r1: u32
@ r2: u32
@ return: ???
thumb_func_start sub_080B1AC8
sub_080B1AC8: @ 0x080002C0
ldr r3, _0800032C @ =ram_sub_080B1AC8
thumb_func_start GetVvvAtRoomCoords
GetVvvAtRoomCoords: @ 0x080002C0
ldr r3, _0800032C @ =ram_GetVvvAtRoomCoords
bx r3
@ call 0x080B1AD8
@@ -308,66 +309,66 @@ sub_080B1AC8: @ 0x080002C0
@ r2: s32 (yOffset)
@ ========
@ Unused? Doesn't seem to be called by anything in Ghidra.
thumb_func_start sub_080B1AD8
sub_080B1AD8: @ 0x080002C4
ldr r3, _08000330 @ =ram_sub_080B1AD8
thumb_func_start GetVvvAtRoomTile
GetVvvAtRoomTile: @ 0x080002C4
ldr r3, _08000330 @ =ram_GetVvvAtRoomTile
bx r3
@ call 0x080B1AE0
@ r0: u32 (tileIndex)
@ r1: u32 (layer)
thumb_func_start sub_080B1AE0
sub_080B1AE0: @ 0x080002C8
ldr r3, _08000334 @ =ram_sub_080B1AE0
thumb_func_start GetVvvAtMetaTilePos
GetVvvAtMetaTilePos: @ 0x080002C8
ldr r3, _08000334 @ =ram_GetVvvAtMetaTilePos
bx r3
@ call 0x080B1AF0
@ r0: Entity*
@ r1: ???
@ r2: ???
thumb_func_start sub_080B1AF0
sub_080B1AF0: @ 0x080002CC
ldr r3, _08000338 @ =ram_sub_080B1AF0
thumb_func_start GetCollisionDataRelativeTo
GetCollisionDataRelativeTo: @ 0x080002CC
ldr r3, _08000338 @ =ram_GetCollisionDataRelativeTo
bx r3
@ call 0x080B1B0C
@ r0: Entity*
thumb_func_start sub_080B1B0C
sub_080B1B0C: @ 0x080002D0
ldr r3, _0800033C @ =ram_sub_080B1B0C
thumb_func_start GetCollisionDataAtEntity
GetCollisionDataAtEntity: @ 0x080002D0
ldr r3, _0800033C @ =ram_GetCollisionDataAtEntity
bx r3
@ call 0x080B1B18
@ r0: s32 (xPos)
@ r1: s32 (yPos)
@ r2: u32 (layer)
thumb_func_start sub_080B1B18
sub_080B1B18: @ 0x080002D4
ldr r3, _08000340 @ =ram_sub_080B1B18
thumb_func_start GetCollisionDataAtWorldCoords
GetCollisionDataAtWorldCoords: @ 0x080002D4
ldr r3, _08000340 @ =ram_GetCollisionDataAtWorldCoords
bx r3
@ call 0x080B1B2C
@ ========
@ Unused? Doesn't seem to be called by anything in Ghidra.
thumb_func_start sub_080B1B2C
sub_080B1B2C: @ 0x080002D8
ldr r3, _08000344 @ =ram_sub_080B1B2C
thumb_func_start GetCollisionDataAtRoomCoords
GetCollisionDataAtRoomCoords: @ 0x080002D8
ldr r3, _08000344 @ =ram_GetCollisionDataAtRoomCoords
bx r3
@ call 0x080B1B3C
@ ========
@ Unused? Doesn't seem to be called by anything in Ghidra.
thumb_func_start sub_080B1B3C
sub_080B1B3C: @ 0x080002DC
ldr r3, _08000348 @ =ram_sub_080B1B3C
thumb_func_start GetCollisionDataAtRoomTile
GetCollisionDataAtRoomTile: @ 0x080002DC
ldr r3, _08000348 @ =ram_GetCollisionDataAtRoomTile
bx r3
@ call 0x080B1B44
@ ========
@ Unused? Doesn't seem to be called by anything in Ghidra.
thumb_func_start GetCollisionData
GetCollisionData: @ 0x080002E0
ldr r3, _0800034C @ =ram_GetCollisionData
thumb_func_start GetCollisionDataAtMetaTilePos
GetCollisionDataAtMetaTilePos: @ 0x080002E0
ldr r3, _0800034C @ =ram_GetCollisionDataAtMetaTilePos
bx r3
@ call 0x080B1B54
@@ -413,18 +414,18 @@ _08000310: .4byte ram_GetTileTypeByPos
_08000314: .4byte ram_sub_080B1A48
_08000318: .4byte ram_sub_080B1A58
_0800031C: .4byte ram_GetTileType
_08000320: .4byte ram_GetRelativeCollisionTile
_08000324: .4byte ram_GetTileUnderEntity
_08000328: .4byte ram_sub_080B1AB4
_0800032C: .4byte ram_sub_080B1AC8
_08000330: .4byte ram_sub_080B1AD8
_08000334: .4byte ram_sub_080B1AE0
_08000338: .4byte ram_sub_080B1AF0
_0800033C: .4byte ram_sub_080B1B0C
_08000340: .4byte ram_sub_080B1B18
_08000344: .4byte ram_sub_080B1B2C
_08000348: .4byte ram_sub_080B1B3C
_0800034C: .4byte ram_GetCollisionData
_08000320: .4byte ram_GetVvvRelativeToEntity
_08000324: .4byte ram_GetVvvAtEntity
_08000328: .4byte ram_GetVvvAtWorldCoords
_0800032C: .4byte ram_GetVvvAtRoomCoords
_08000330: .4byte ram_GetVvvAtRoomTile
_08000334: .4byte ram_GetVvvAtMetaTilePos
_08000338: .4byte ram_GetCollisionDataRelativeTo
_0800033C: .4byte ram_GetCollisionDataAtEntity
_08000340: .4byte ram_GetCollisionDataAtWorldCoords
_08000344: .4byte ram_GetCollisionDataAtRoomCoords
_08000348: .4byte ram_GetCollisionDataAtRoomTile
_0800034C: .4byte ram_GetCollisionDataAtMetaTilePos
_08000350: .4byte ram_sub_080B1B54
_08000354: .4byte ram_sub_080B1B68
_08000358: .4byte ram_sub_080B1B84
-98
View File
@@ -975,16 +975,6 @@
"start": 15940,
"size": 384
},
{
"path": "code_080043E8/gUnk_080046A4.bin",
"start": 18084,
"size": 338
},
{
"path": "code_080043E8/gUnk_080047F6.bin",
"start": 18422,
"size": 480
},
{
"path": "code_080043E8/gUnk_080049D6.bin",
"start": 18902,
@@ -3158,59 +3148,6 @@
"size": 59,
"type": "animation"
},
{
"path": "code_080043E8/gUnk_08007CAC.bin",
"start": 31916,
"size": 91
},
{
"path": "code_080043E8/gUnk_08007CAC_1_DEMO_JP.bin",
"variants": [
"DEMO_JP"
],
"starts": {
"DEMO_JP": 32079
},
"size": 207
},
{
"path": "code_080043E8/gUnk_08007CAC_2_DEMO_USA.bin",
"variants": [
"DEMO_USA"
],
"starts": {
"DEMO_USA": 32007
},
"size": 207
},
{
"path": "code_080043E8/gUnk_08007CAC_3_JP.bin",
"variants": [
"JP"
],
"starts": {
"JP": 32007
},
"size": 207
},
{
"path": "code_080043E8/gUnk_08007CAC_4_EU.bin",
"variants": [
"EU"
],
"starts": {
"EU": 32159
},
"size": 207
},
{
"path": "code_080043E8/gUnk_08007CAC_5_USA.bin",
"variants": [
"USA"
],
"start": 32007,
"size": 207
},
{
"path": "data_08007DF4/gUnk_08007DF4.bin",
"start": 32244,
@@ -3559,21 +3496,6 @@
"start": 738498,
"size": 14
},
{
"path": "data_080B7910/gUnk_080B7910.bin",
"start": 751888,
"size": 151
},
{
"path": "data_080B7910/gUnk_080B79A7.bin",
"start": 752039,
"size": 151
},
{
"path": "data_080B7910/gUnk_080B7A3E.bin",
"start": 752190,
"size": 302
},
{
"path": "data_080B7B74/gCollisionMtx.bin",
"start": 752500,
@@ -20724,26 +20646,6 @@
"size": 4,
"type": "animation"
},
{
"path": "minecart/gUnk_081223E8.bin",
"start": 1188840,
"size": 26
},
{
"path": "minecart/gUnk_08122402.bin",
"start": 1188866,
"size": 26
},
{
"path": "minecart/gUnk_0812241C.bin",
"start": 1188892,
"size": 26
},
{
"path": "minecart/gUnk_08122436.bin",
"start": 1188918,
"size": 26
},
{
"path": "animations/gSpriteAnimations_Minecart_0.bin",
"start": 1188944,
-17
View File
@@ -4,23 +4,6 @@
.section .rodata
.align 2
gUnk_081223D8:: @ 081223D8
.4byte gUnk_081223E8
.4byte gUnk_08122402
.4byte gUnk_0812241C
.4byte gUnk_08122436
gUnk_081223E8:: @ 081223E8
.incbin "minecart/gUnk_081223E8.bin"
gUnk_08122402:: @ 08122402
.incbin "minecart/gUnk_08122402.bin"
gUnk_0812241C:: @ 0812241C
.incbin "minecart/gUnk_0812241C.bin"
gUnk_08122436:: @ 08122436
.incbin "minecart/gUnk_08122436.bin"
gSpriteAnimations_Minecart_0:: @ 08122450
.include "animations/gSpriteAnimations_Minecart_0.s"
@@ -1,21 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
@.align 2
@ before: playerItemBottle
@ after: playerItemCellOverwriteSet
@ scroll.c, intr.s, veener.s
gUnk_080B7910:: @ 080B7910
.incbin "data_080B7910/gUnk_080B7910.bin"
@ veener.s, playerUtils.c
gUnk_080B79A7:: @ 080B79A7
.incbin "data_080B7910/gUnk_080B79A7.bin"
@ intr.s
gUnk_080B7A3E:: @ 080B7A3E
.incbin "data_080B7910/gUnk_080B7A3E.bin"
+41
View File
@@ -0,0 +1,41 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
@ .align 2
@ TODO PlayerMacros
gUnk_080049D6:: @ 080049D6
.incbin "code_080043E8/gUnk_080049D6.bin"
gUnk_080049F6:: @ 080049F6
.incbin "code_080043E8/gUnk_080049F6.bin"
gUnk_080049FE:: @ gUnk_080049FE
.incbin "code_080043E8/gUnk_080049FE.bin"
gUnk_08004A0C:: @ 08004A0C
.incbin "code_080043E8/gUnk_08004A0C.bin"
gUnk_08004A16:: @ 08004A16
.incbin "code_080043E8/gUnk_08004A16.bin"
gUnk_08004A24:: @ 08004A24
.incbin "code_080043E8/gUnk_08004A24.bin"
gUnk_08004A32:: @ 08004A32
.incbin "code_080043E8/gUnk_08004A32.bin"
gUnk_08004A48:: @ 08004A48
.incbin "code_080043E8/gUnk_08004A48.bin"
gUnk_08004A72:: @ 08004A72
.incbin "code_080043E8/gUnk_08004A72.bin"
gUnk_08004A8C:: @ 08004A8C
.incbin "code_080043E8/gUnk_08004A8C.bin"
gUnk_08004AA6:: @ 08004AA6
.incbin "code_080043E8/gUnk_08004AA6.bin"
+50 -30
View File
@@ -9,7 +9,9 @@ extern void CloneTile(u32, u32, u32);
extern u32 GetTileTypeByEntity(struct Entity_*);
extern u32 GetTileTypeByPos(s32 x, s32 y, u32 layer);
extern u32 GetTileType(u32 position, u32 layer);
extern void SetTile(u32 index, u32 position, u32 layer);
extern void SetTile(u32 metaTile, u32 metaTilePos, u32 layer);
extern void UpdateScrollVram(void);
extern u32 sub_080B1BA4(u32, u32, u32);
extern void LoadResourceAsync(const void* src, u32 dest, u32 size);
@@ -33,43 +35,61 @@ extern u32 sub_080086B4(u32, u32, const u8*);
extern u32 ResolveCollisionLayer(struct Entity_*);
extern void sub_0800417E(struct Entity_*, u32);
extern u32 sub_0800442E(struct Entity_*);
extern u32 sub_08007DD6(u32, const u16*);
extern void SoundReqClipped(struct Entity_*, u32);
extern u32 sub_0800132C(struct Entity_*, struct Entity_*);
extern u32 sub_080B1A48(u32, u32, u32);
extern u32 sub_0800445C(struct Entity_*);
extern bool32 sub_080B1B54(u32);
extern u32 CheckRectOnScreen(s32, s32, u32, u32);
extern u32 GetVvvRelativeToEntity(struct Entity_* entity, s32 xOffset, s32 yOffset);
extern u32 GetVvvAtEntity(struct Entity_* entity);
extern u32 GetVvvAtWorldCoords(u32 worldX, u32 worldY, u32 layer);
extern u32 GetVvvAtRoomCoords(u32 roomX, u32 roomY, u32 layer);
extern u32 GetVvvAtRoomTile(u32 roomTileX, u32 roomTileY, u32 layer);
extern u32 GetVvvAtMetaTilePos(u16 metaTilePos, u8 layer);
/**
* Sets vvv for a metaTilePos.
*/
extern void SetVvvAtMetaTilePos(u32 vvv, u32 metaTilePos, u32 layer);
// Get CollisionData for entity (relative to entity?)
extern u32 GetCollisionDataRelativeTo(struct Entity_* entity, s32 xOffset, s32 yOffset);
extern u32 GetCollisionDataAtEntity(struct Entity_* entity);
/**
* Returns the collision data for one metatile. (x, y in pixels relative to the world)
*/
extern u32 GetCollisionDataAtWorldCoords(u32 worldX, u32 worldY, u32 layer);
/**
* Returns the collision data for one metatile. (x, y in pixels relative to the room)
*/
extern u32 GetCollisionDataAtRoomCoords(u32 roomX, u32 roomY, u32 layer);
/**
* Returns the collision data for one metatile. (x, y in metatiles relative to the room)
*/
extern u32 GetCollisionDataAtRoomTile(u32 roomTileX, u32 roomTileY, u32 layer);
/**
* Returns the collision data for one metatile.
*/
extern u32 GetCollisionDataAtMetaTilePos(u32 metaTilePos, u32 layer);
/**
* Sets the collision data for one metatile.
*/
extern void SetCollisionData(u32 collisionData, u32 metaTilePos, u32 layer);
/**
* Returns the collision data for one metatile.
*/
extern u32 GetCollisionData(u32 metaTilePos, u32 layer);
/**
* Returns the collision data for one metatile. (x, y in metatiles relative to the room)
*/
extern u32 sub_080B1B3C(u32 x, u32 y, u32 layer);
/**
* Returns the collision data for one metatile. (x, y in pixels relative to the room)
*/
extern u32 sub_080B1B2C(u32 x, u32 y, u32 layer);
/**
* Returns the collision data for one metatile. (x, y in pixels relative to the world)
*/
extern u32 sub_080B1B18(u32 x, u32 y, u32 layer);
extern u32 sub_080B1B0C(struct Entity_* entity);
typedef struct {
u16 key;
u16 value;
} KeyValuePair ALIGNED(2);
// Get CollisionData for entity (relative to entity?)
extern u32 sub_080B1AF0(struct Entity_*, s32 xOffset, s32 yOffset);
extern u32 sub_080B1A48(u32, u32, u32);
extern u32 sub_080B1AE0(u16, u8);
extern u32 GetTileUnderEntity(struct Entity_*);
extern u32 sub_0800445C(struct Entity_*);
extern u32 sub_080B1AF0(struct Entity_*, s32, s32);
extern u32 GetRelativeCollisionTile(struct Entity_*, u32, u32);
extern bool32 sub_080B1B54(u32);
extern u32 CheckRectOnScreen(s32, s32, u32, u32);
/**
* Searches for a KeyValuePair with the key in the keyValuePairList and returns its value.
* Returns 0 if the key is not found.
*/
extern u32 FindValueForKey(u32 key, const KeyValuePair* keyValuePairList);
#endif // ASM_H
+1 -1
View File
@@ -39,6 +39,6 @@ void CalculateEntityTileCollisions(Entity*, u32, u32);
bool32 ProcessMovementInternal(Entity*, s32, s32, u32);
u32 sub_080176E4(Entity*);
extern const u8 gUnk_080B37A0[]; // unkData3 for tileType?
extern const u8 gUnk_080B37A0[]; // vvv for tileType?
#endif // COLLISION_H
-1
View File
@@ -49,7 +49,6 @@ extern void SetBGDefaults(void);
// Unidentified
extern u32 sub_080B1A0C(Entity*, s32, s32);
extern u32 sub_080B1AE0(u16, u8);
extern s32 sub_080012DC(Entity*);
extern void sub_08001318(Entity*);
extern void sub_080027EA(Entity*, u32, u32);
+9 -2
View File
@@ -19,12 +19,19 @@ typedef struct {
/*0x7004*/ u16 metatiles[0x800 * 4];
/**< Mapping from a metatile to the four tile_attrs it consists of.*/ // gMetatilesTop, gMetatilesBottom
/*0xb004*/ u8 unkData3[0x40*0x40]; /**< Some sort of special behavior for tiles? Falling into holes or jumping off walls does not work when this is all zero.*/ // gUnk_02016654, gUnk_02030EB4
/*
Temporarily call this vvv
VVV
vvv
Vvv
*/
/*0xb004*/ u8 vvv[0x40*0x40]; /**< Some sort of special behavior for tiles? Falling into holes or jumping off walls does not work when this is all zero.*/ // gUnk_02016654, gUnk_02030EB4
// TODO check with debugger what accesses this
// 0x637
// 0x2030eb4 + 0x637
// 0x20314eb
// e.g. sub_080B1AE0 accesses this
// e.g. GetVvvAtMetaTilePos accesses this
// TODO check whether this also affects sound played when walking?
/*
0x10: water
+15 -14
View File
@@ -158,8 +158,8 @@ enum PlayerItemId {
typedef enum {
SURFACE_NORMAL,
SURFACE_PIT,
SURFACE_2,
SURFACE_3,
SURFACE_2, // nulled
SURFACE_3, // nulled
SURFACE_SLOPE_GNDGND_V,
SURFACE_SLOPE_GNDGND_H,
SURFACE_6,
@@ -169,10 +169,10 @@ typedef enum {
SURFACE_A,
SURFACE_B,
SURFACE_SLOPE_GNDWATER,
SURFACE_D,
SURFACE_E,
SURFACE_F,
SURFACE_10,
SURFACE_D, // SurfaceAction_ConveyerNorth
SURFACE_E, // SurfaceAction_ConveyerSouth
SURFACE_F, // SurfaceAction_ConveyerWest
SURFACE_10, // SurfaceAction_ConveyerEast
SURFACE_SWAMP,
SURFACE_DOOR,
SURFACE_DOOR_13,
@@ -189,18 +189,19 @@ typedef enum {
SURFACE_LADDER,
SURFACE_1F, // nulled
SURFACE_20,
SURFACE_21,
SURFACE_21, // reuses SurfaceAction_16
SURFACE_22,
SURFACE_EDGE,
SURFACE_24,
SURFACE_EDGE, // reuses SurfaceAction_6
SURFACE_24, // reuses SurfaceAction_6
SURFACE_DUST,
SURFACE_26,
SURFACE_HOLE,
SURFACE_LIGHT_GRADE,
SURFACE_29,
SURFACE_LIGHT_GRADE, // reuses SurfaceAction_SlopeGndGndVertical
SURFACE_29, // reuses SurfaceAction_SlopeGndGndHorizontal
SURFACE_AUTO_LADDER,
SURFACE_CLIMB_WALL,
SURFACE_2C,
SURFACE_2D // reuses SurfaceAction_Dust
} SurfaceType;
typedef enum {
@@ -292,8 +293,8 @@ typedef struct {
/*0x0f*/ u8 hurtBlinkSpeed;
/*0x10*/ u8 field_0x10;
/*0x11*/ u8 surfacePositionSameTimer;
/*0x12*/ u8 floor_type;
/*0x13*/ u8 floor_type_last;
/*0x12*/ u8 floor_type; /**< @see SurfaceType */
/*0x13*/ u8 floor_type_last; /**< @see SurfaceType */
/*0x14*/ u8 field_0x14;
/*0x15*/ u8 field_0x15;
/*0x16*/ u16 startPosX;
@@ -483,7 +484,7 @@ u32 sub_08079B24(void);
void sub_08079708(Entity*);
void sub_08079744(Entity*);
void PlayerUpdateSwimming(Entity*);
u32 GetCollisionTileInFront(Entity*);
u32 GetVvvInFront(Entity* player);
u32 sub_080797C4(void);
void CheckPlayerVelocity(void);
void sub_0807B068(Entity*);
+3 -2
View File
@@ -34,7 +34,8 @@ typedef struct {
/*0x0A*/ s16 scroll_x;
/*0x0C*/ s16 scroll_y;
/*0x0E*/ u8 scrollSpeed; /**< Pixels per frame that the camera can scroll. */
/*0x0F*/ u8 scroll_flags; // 0x2 = ??, 0x4 = camera scrolling
/*0x0F*/ u8 scroll_flags; // 0x2 = ?? (apply collision value on bottom map no matter the layer SetTileType is called
// for), 0x4 = camera scrolling
/*0x10*/ u8 scroll_direction;
/*0x11*/ s8 oam_offset_x;
/*0x12*/ s8 oam_offset_y;
@@ -73,7 +74,7 @@ typedef struct {
/* 0x0a */ u8 unk2;
/* 0x0b */ u8 filler2;
/* 0x0c */ s16 lightLevel;
/* 0x0e */ u16 unk_0e;
/* 0x0e */ u16 unk_0e; // Number of previous values for special tiles stored in gUnk_0200B240
/* 0x10 */ u8 unk_10[4];
/* 0x14 */ u32 flags;
/* 0x18 */ u32 unk3;
+1
View File
@@ -391,4 +391,5 @@ typedef struct {
u8 paletteGroup;
u8 gfxGroup;
} PACKED StaffrollGfxEntry;
#endif // STRUCTURES_H
+15 -13
View File
@@ -165,18 +165,18 @@ SECTIONS {
. = 0x000057BC; ram_sub_080B1A48 = .;
. = 0x000057CC; ram_sub_080B1A58 = .;
. = 0x000057D4; ram_GetTileType = .;
. = 0x00005800; ram_GetRelativeCollisionTile = .;
. = 0x0000581C; ram_GetTileUnderEntity = .;
. = 0x00005828; ram_sub_080B1AB4 = .;
. = 0x0000583C; ram_sub_080B1AC8 = .;
. = 0x0000584C; ram_sub_080B1AD8 = .;
. = 0x00005854; ram_sub_080B1AE0 = .;
. = 0x00005864; ram_sub_080B1AF0 = .;
. = 0x00005880; ram_sub_080B1B0C = .;
. = 0x0000588C; ram_sub_080B1B18 = .;
. = 0x000058A0; ram_sub_080B1B2C = .;
. = 0x000058B0; ram_sub_080B1B3C = .;
. = 0x000058B8; ram_GetCollisionData = .;
. = 0x00005800; ram_GetVvvRelativeToEntity = .;
. = 0x0000581C; ram_GetVvvAtEntity = .;
. = 0x00005828; ram_GetVvvAtWorldCoords = .;
. = 0x0000583C; ram_GetVvvAtRoomCoords = .;
. = 0x0000584C; ram_GetVvvAtRoomTile = .;
. = 0x00005854; ram_GetVvvAtMetaTilePos = .;
. = 0x00005864; ram_GetCollisionDataRelativeTo = .;
. = 0x00005880; ram_GetCollisionDataAtEntity = .;
. = 0x0000588C; ram_GetCollisionDataAtWorldCoords = .;
. = 0x000058A0; ram_GetCollisionDataAtRoomCoords = .;
. = 0x000058B0; ram_GetCollisionDataAtRoomTile = .;
. = 0x000058B8; ram_GetCollisionDataAtMetaTilePos = .;
. = 0x000058C8; ram_sub_080B1B54 = .;
. = 0x000058DC; ram_sub_080B1B68 = .;
. = 0x000058F8; ram_sub_080B1B84 = .;
@@ -242,7 +242,10 @@ SECTIONS {
data/gfx/sprite_ptrs.o(.rodata);
asm/src/code_08003FC4.o(.text);
asm/src/code_080043E8.o(.text);
src/data/data_080046A4.o(.rodata);
data/data_080046A4.o(.rodata);
data/gfx/link_animations.o(.rodata);
src/data/mapVvvToSurfaceType.o(.rodata);
asm/src/code_08007CAC.o(.text);
data/data_08007DF4.o(.rodata);
asm/src/player.o(.text);
@@ -887,7 +890,6 @@ SECTIONS {
src/playerItem/playerItemBoomerang.o(.rodata);
src/playerItem/playerItemDashSword.o(.rodata);
src/playerItem/playerItemBottle.o(.rodata);
data/const/playerItem/playerItemCellOverwriteSet.o(.rodata);
src/playerItem/playerItemCellOverwriteSet.o(.rodata);
data/const/collisionMatrix.o(.rodata);
data/const/ui.o(.rodata);
+4 -5
View File
@@ -74,7 +74,6 @@ u32 sub_0801A570(Entity*, u32);
bool32 sub_0801A458(LayerStruct* layer, u32 position, u32 collisionType);
bool32 sub_0801A370(LayerStruct* layer, u32 position);
u32 sub_0801A8D0(Entity* this, u32 param_2);
extern void sub_080001D0(u32, u32, u32);
void sub_0801967C(void) {
gUnk_080B4458[gMenu.overlayType]();
@@ -202,8 +201,8 @@ u32 UpdatePlayerCollision(void) {
index = sub_0807BDB8(&gPlayerEntity, direction >> 2);
if (index != 0xff && (gRoomControls.scroll_flags & 4) == 0) {
ptr1 = &gUnk_080B4490[index * 2];
if (GetCollisionData(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr1[0], -ptr1[1]),
gPlayerEntity.collisionLayer) == 0xff) {
if (GetCollisionDataAtMetaTilePos(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr1[0], -ptr1[1]),
gPlayerEntity.collisionLayer) == 0xff) {
if ((((gPlayerState.flags & (PL_FLAGS10000 | PL_FLAGS2)) != 0) ||
((gPlayerState.sword_state & 0x10) != 0)) ||
((sub_080806BC(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x,
@@ -260,7 +259,7 @@ u32 UpdatePlayerCollision(void) {
if ((gPlayerEntity.direction & 0x80) != 0) {
return 0;
}
if (GetCollisionData(position, gPlayerEntity.collisionLayer) != 0xf) {
if (GetCollisionDataAtMetaTilePos(position, gPlayerEntity.collisionLayer) != 0xf) {
return 0;
}
if (sub_08079778() == 0) {
@@ -581,7 +580,7 @@ u32 UpdatePlayerCollision(void) {
return 0;
}
SetTile(0x4074, position, gPlayerEntity.collisionLayer);
sub_080001D0(0xd, position, gPlayerEntity.collisionLayer);
SetVvvAtMetaTilePos(0xd, position, gPlayerEntity.collisionLayer);
return 1;
default:
return 0;
+1 -1
View File
@@ -788,7 +788,7 @@ CollisionResult CollisionDefault(Entity* org, Entity* tgt, u32 direction, ColSet
return RESULT_COLLISION;
}
// unkData3 for tileType?
// vvv for tileType?
#ifdef EU
const u8 gUnk_080B37A0[] = {
+34
View File
@@ -0,0 +1,34 @@
#include "asm.h"
const KeyValuePair gUnk_080046A4[] = {
{ 63, 1 }, { 80, 2 }, { 69, 8 }, { 70, 9 }, { 71, 10 }, { 72, 11 }, { 73, 12 }, { 74, 13 },
{ 75, 14 }, { 76, 15 }, { 77, 16 }, { 65, 1 }, { 82, 2 }, { 68, 17 }, { 79, 18 }, { 372, 19 },
{ 117, 23 }, { 67, 3 }, { 66, 4 }, { 64, 5 }, { 81, 6 }, { 85, 20 }, { 92, 21 }, { 87, 20 },
{ 94, 21 }, { 86, 28 }, { 93, 29 }, { 88, 30 }, { 89, 31 }, { 90, 32 }, { 91, 22 }, { 9, 36 },
{ 12, 37 }, { 13, 36 }, { 15, 38 }, { 14, 39 }, { 16, 36 }, { 17, 36 }, { 18, 36 }, { 20, 37 },
{ 21, 36 }, { 23, 38 }, { 22, 39 }, { 24, 36 }, { 25, 36 }, { 10, 40 }, { 39, 40 }, { 28, 36 },
{ 42, 36 }, { 29, 36 }, { 43, 36 }, { 97, 44 }, { 101, 45 }, { 353, 47 }, { 355, 48 }, { 16384, 25 },
{ 16480, 26 }, { 374, 49 }, { 843, 33 }, { 844, 34 }, { 375, 50 }, { 871, 51 }, { 872, 52 }, { 16490, 24 },
{ 105, 41 }, { 106, 42 }, { 111, 43 }, { 109, 53 }, { 110, 54 }, { 78, 7 }, { 389, 36 }, { 390, 36 },
{ 391, 36 }, { 392, 36 }, { 393, 36 }, { 394, 36 }, { 398, 36 }, { 399, 36 }, { 403, 36 }, { 404, 36 },
{ 405, 36 }, { 406, 36 }, { 407, 36 }, { 408, 36 },
};
const u16 gUnk_080046A4End = 0;
const u16 gUnk_080047F6[] = {
0, 255, 65280, 0, 65247, 783, 0, 28, 65247, 783, 0, 42, 65247, 783, 0, 121,
65247, 783, 0, 119, 65247, 783, 0, 53, 65247, 783, 0, 53, 64735, 783, 0, 39,
65247, 783, 0, 418, 65247, 783, 0, 419, 65247, 783, 0, 420, 65247, 783, 0, 421,
65247, 783, 0, 422, 65247, 783, 0, 423, 65247, 783, 0, 424, 65247, 783, 0, 425,
65247, 783, 0, 426, 65247, 783, 0, 360, 65247, 783, 0, 40, 39563, 15119, 65280, 31,
59074, 1039, 256, 29, 59074, 1039, 256, 43, 59074, 1039, 256, 789, 34816, 298, 65280, 118,
34816, 298, 65280, 16491, 33666, 255, 65280, 16389, 33666, 255, 65280, 16499, 33439, 4879, 65280, 53,
59074, 1039, 256, 53, 59074, 1039, 256, 53, 59074, 1039, 256, 119, 59074, 1039, 256, 121,
59074, 1039, 256, 360, 49323, 5647, 1024, 38, 49323, 5647, 1024, 52, 32768, 255, 65280, 804,
40960, 255, 65280, 26, 40960, 255, 65280, 53, 40960, 255, 65280, 119, 40960, 255, 65280, 121,
40960, 255, 65280, 27, 49192, 801, 768, 38, 49192, 801, 768, 789, 49192, 801, 768, 29,
49192, 33, 768, 38, 49192, 33, 768, 121, 32832, 783, 0, 113, 43019, 5903, 65280, 29,
43019, 5903, 65280, 53, 33859, 11535, 512, 30, 32776, 1039, 65280, 29, 32776, 1039, 65280, 38,
32776, 1039, 65280, 52, 32779, 21263, 65280, 19, 32779, 21263, 65280, 789, 0, 30, 2, 18,
64, 8, 0, 1, 128, 10, 0, 1, 128, 8, 384, 10, 128, 30, 1, 49152
};
+74
View File
@@ -0,0 +1,74 @@
#include "asm.h"
#include "player.h"
const KeyValuePair gMapVvvToSurfaceType[] = {
{ 13, SURFACE_PIT },
{ 38, SURFACE_SLOPE_GNDGND_V },
{ 39, SURFACE_SLOPE_GNDGND_H },
{ 82, SURFACE_26 },
{ 99, SURFACE_24 },
{ 116, SURFACE_EDGE },
{ 8, SURFACE_7 },
{ 31, SURFACE_MINISH_DOOR_FRONT },
{ 32, SURFACE_MINISH_DOOR_BACK },
{ 33, SURFACE_A },
{ 34, SURFACE_B },
{ 24, SURFACE_16 },
{ 18, SURFACE_ICE },
{ 15, SURFACE_SHALLOW_WATER },
{ 14, SURFACE_SLOPE_GNDWATER },
{ 16, SURFACE_WATER },
{ 27, SURFACE_BUTTON },
{ 29, SURFACE_BUTTON },
{ 97, SURFACE_1B },
{ 90, SURFACE_1C },
{ 17, SURFACE_14 },
{ 98, SURFACE_21 },
{ 101, SURFACE_6 },
{ 102, SURFACE_6 },
{ 103, SURFACE_6 },
{ 104, SURFACE_6 },
{ 105, SURFACE_6 },
{ 106, SURFACE_6 },
{ 108, SURFACE_6 },
{ 109, SURFACE_6 },
{ 110, SURFACE_6 },
{ 111, SURFACE_6 },
{ 107, SURFACE_6 },
{ 48, SURFACE_22 },
{ 49, SURFACE_22 },
{ 50, SURFACE_22 },
{ 51, SURFACE_22 },
{ 22, SURFACE_DUST },
{ 25, SURFACE_HOLE },
{ 240, SURFACE_HOLE },
{ 87, SURFACE_CLONE_TILE },
{ 83, SURFACE_LADDER },
{ 241, SURFACE_LADDER },
{ 63, SURFACE_AUTO_LADDER },
{ 80, SURFACE_CLIMB_WALL },
{ 81, SURFACE_2C },
{ 52, SURFACE_LIGHT_GRADE },
{ 53, SURFACE_29 },
{ 42, SURFACE_E },
{ 43, SURFACE_D },
{ 44, SURFACE_10 },
{ 45, SURFACE_F },
{ 64, SURFACE_E },
{ 65, SURFACE_D },
{ 66, SURFACE_10 },
{ 67, SURFACE_F },
{ 72, SURFACE_10 },
{ 74, SURFACE_E },
{ 69, SURFACE_E },
{ 71, SURFACE_E },
{ 70, SURFACE_D },
{ 73, SURFACE_D },
{ 68, SURFACE_D },
{ 75, SURFACE_D },
{ 19, SURFACE_SWAMP },
{ 41, SURFACE_DOOR },
{ 23, SURFACE_2D },
{ 40, SURFACE_DOOR_13 },
};
// const u16 gMapVvvToSurfaceTypeEnd = 0;
+1 -1
View File
@@ -175,7 +175,7 @@ void AcroBandit_Type0Action1(Entity* this) {
rand = Random();
x = this->field_0x74.HWORD + ((s32)rand % 5) * 0x10 - 0x20;
y = this->field_0x76.HWORD + ((s32)(rand >> 4) % 5) * 0x10 - 0x20;
if (sub_080B1B18(x, y, this->collisionLayer) == 0) {
if (GetCollisionDataAtWorldCoords(x, y, this->collisionLayer) == 0) {
this->action = 2;
this->spriteSettings.draw = 1;
this->x.HALF.HI = x;
+1 -1
View File
@@ -200,7 +200,7 @@ void sub_0802AAC0(Entity* this) {
this->child = NULL;
#ifdef EU
} else if (ent->timer == 0) {
if (GetCollisionData(COORD_TO_TILE(this), 1) == 0) {
if (GetCollisionDataAtMetaTilePos(COORD_TO_TILE(this), 1) == 0) {
if (EntityInRectRadius(this, &gPlayerEntity, 0x10, 0x10) && ent->subtimer <= 0x50) {
this->field_0x80.HALF.HI = 0;
}
+4 -4
View File
@@ -703,11 +703,11 @@ void sub_0801FB68(Entity* this) {
this->zVelocity = 0;
}
u32 sub_0801FBD0(Entity* this) {
if (GetTileUnderEntity(this) == 0x10) {
return 1;
bool32 sub_0801FBD0(Entity* this) {
if (GetVvvAtEntity(this) == 0x10) {
return TRUE;
} else {
return 0;
return FALSE;
}
}
+2 -2
View File
@@ -245,13 +245,13 @@ void sub_080387F0(CloudPiranhaEntity* this) {
const s8* ptr;
if ((super->action != 4) && (this->unk_82 == 0)) {
iVar4 = GetCollisionData(COORD_TO_TILE(super), super->collisionLayer);
iVar4 = GetCollisionDataAtMetaTilePos(COORD_TO_TILE(super), super->collisionLayer);
if ((iVar4 == 0xf) || (iVar4 == 0x2a)) {
this->unk_82 = 0x20;
}
ptr = &gUnk_080CF520[super->direction >> 1];
bVar1 = super->direction;
iVar4 = sub_080B1AF0(super, ptr[0], ptr[1]);
iVar4 = GetCollisionDataRelativeTo(super, ptr[0], ptr[1]);
if ((iVar4 == 0xf) || (iVar4 == 0x2a)) {
super->direction = (super->direction + 0x10) & 0x1f;
} else {
+1 -1
View File
@@ -246,7 +246,7 @@ void sub_08046518(void) {
u16* ptr = gMapTop.metatileTypes;
u16* sl = &gMapTop.mapData[sub_08046518_offset];
u16* stack1 = &gMapTop.mapDataClone[sub_08046518_offset];
u8* stack2 = &gMapTop.unkData3[sub_08046518_offset];
u8* stack2 = &gMapTop.vvv[sub_08046518_offset];
u8* r6 = &gMapTop.collisionData[sub_08046518_offset];
u32 i;
for (i = 0x10; i != 0; i--) {
+9 -11
View File
@@ -4,12 +4,10 @@
*
* @brief Leever enemy
*/
#include "asm.h"
#include "enemy.h"
#include "physics.h"
extern u32 sub_080B1AB4(s32, s32, u32);
extern Entity* gUnk_020000B0;
bool32 Leever_PlayerInRange(Entity*, s32);
@@ -119,23 +117,23 @@ void Leever_DigDown(Entity* this) {
}
}
u32 sub_0801FDE4(Entity* ent, s32 x, s32 y) {
u32 uVar3;
bool32 sub_0801FDE4(Entity* ent, s32 x, s32 y) {
u32 vvv;
const u16* puVar4;
if (sub_080B1B18(x, y, gUnk_020000B0->collisionLayer) != 0) {
return 0;
if (GetCollisionDataAtWorldCoords(x, y, gUnk_020000B0->collisionLayer) != 0) {
return FALSE;
} else {
uVar3 = sub_080B1AB4(x, y, gUnk_020000B0->collisionLayer);
vvv = GetVvvAtWorldCoords(x, y, gUnk_020000B0->collisionLayer);
for (puVar4 = gUnk_080CA4CA; *puVar4 != (u16)-1;) {
if (*puVar4++ == uVar3) {
if (*puVar4++ == vvv) {
ent->x.HALF.HI = (x & 0xfff0) + 8;
ent->y.HALF.HI = (y & 0xfff0) + 8;
ent->collisionLayer = gUnk_020000B0->collisionLayer;
return 1;
return TRUE;
}
}
return 0;
return FALSE;
}
}
+1 -1
View File
@@ -340,7 +340,7 @@ void sub_08029E0C(Entity* this) {
tile = COORD_TO_TILE(this);
for (i = 0; i < 3; i++) {
dir = ptr[iVar3];
if (GetCollisionData(gUnk_080B4488[dir >> 3] + tile, this->collisionLayer) == 0) {
if (GetCollisionDataAtMetaTilePos(gUnk_080B4488[dir >> 3] + tile, this->collisionLayer) == 0) {
local_24 = dir;
if (this->direction - this->field_0x74.HALF.LO != dir - this->direction)
break;
+1 -1
View File
@@ -336,7 +336,7 @@ void sub_080244E8(Entity* this) {
switch (this->field_0x80.HALF.LO) {
case 0:
if (--this->timer == 0) {
if (GetCollisionData(COORD_TO_TILE(this), 1) == 0) {
if (GetCollisionDataAtMetaTilePos(COORD_TO_TILE(this), 1) == 0) {
this->field_0x80.HALF.LO++;
this->field_0x82.HALF.LO++;
this->subtimer = 0;
+6 -6
View File
@@ -481,10 +481,10 @@ bool32 sub_0802594C(Entity* this, u32 param_2) {
u8 bVar6;
iVar9 = xDiff + unk[0];
iVar11 = yDiff + unk[1];
bVar4 = sub_080B1B18(iVar9 - 0x00, iVar11 - 0x00, uVar1);
bVar5 = sub_080B1B18(iVar9 - 0x10, iVar11 - 0x00, uVar1);
bVar6 = sub_080B1B18(iVar9 - 0x00, iVar11 - 0x10, uVar1);
bVar7 = sub_080B1B18(iVar9 - 0x10, iVar11 - 0x10, uVar1);
bVar4 = GetCollisionDataAtWorldCoords(iVar9 - 0x00, iVar11 - 0x00, uVar1);
bVar5 = GetCollisionDataAtWorldCoords(iVar9 - 0x10, iVar11 - 0x00, uVar1);
bVar6 = GetCollisionDataAtWorldCoords(iVar9 - 0x00, iVar11 - 0x10, uVar1);
bVar7 = GetCollisionDataAtWorldCoords(iVar9 - 0x10, iVar11 - 0x10, uVar1);
if ((bVar4 | bVar5 | bVar6 | bVar7) == 0) {
this->field_0x7c.HALF.LO = gRoomControls.origin_x + iVar9;
this->field_0x7c.HALF.HI = gRoomControls.origin_y + iVar11;
@@ -510,10 +510,10 @@ void sub_08025A54(Entity* this) {
}
bool32 sub_08025AB8(u32 tile, u32 layer) {
if (GetCollisionData(tile, layer))
if (GetCollisionDataAtMetaTilePos(tile, layer))
return FALSE;
if (sub_080B1AE0(tile, layer) == 10) {
if (GetVvvAtMetaTilePos(tile, layer) == 10) {
sub_0807B7D8(0x61, tile, layer);
return TRUE;
}
+1 -1
View File
@@ -196,7 +196,7 @@ void sub_08031600(Entity* this) {
u32 sub_0803163C(Entity* this) {
u32 h;
if (GetTileUnderEntity(this) == 0x13) {
if (GetVvvAtEntity(this) == 0x13) {
h = this->field_0x7a.HWORD / 2;
} else {
h = this->field_0x7a.HWORD;
+1 -1
View File
@@ -140,7 +140,7 @@ void sub_08045178(Entity* this, Entity* child, int h, int v) {
return;
sub_0804A4E4(this, child);
if (sub_080B1AF0(child, h, v))
if (GetCollisionDataRelativeTo(child, h, v))
return;
x = child->x.HALF.HI + h;
+1 -1
View File
@@ -323,7 +323,7 @@ void sub_08033D78(SpinyBeetleEntity* this) {
case 0x1c5:
break;
default:
if (GetCollisionData(tile, super->collisionLayer) - 1 > 0x3e)
if (GetCollisionDataAtMetaTilePos(tile, super->collisionLayer) - 1 > 0x3e)
ProcessMovement0(super);
break;
}
+1 -1
View File
@@ -158,7 +158,7 @@ void sub_0802F300(Entity* this) {
return;
} else if (this->collisions != COL_NONE) {
sub_0800417E(this, this->collisions);
} else if ((GetTileUnderEntity(this) & 0xf0) == 0x50) {
} else if ((GetVvvAtEntity(this) & 0xf0) == 0x50) {
this->direction = (this->direction + 0x10) & 0x1f;
}
+1 -1
View File
@@ -134,7 +134,7 @@ void sub_08038048(Entity* this) {
return;
} else if (this->collisions != COL_NONE) {
sub_0800417E(this, this->collisions);
} else if ((GetTileUnderEntity(this) & 0xf0) == 0x50) {
} else if ((GetVvvAtEntity(this) & 0xf0) == 0x50) {
this->direction = (this->direction + 0x10) & 0x1f;
}
+1 -1
View File
@@ -230,7 +230,7 @@ void sub_0802EFB8(Entity* this) {
uVar3 = GetFacingDirection(&gPlayerEntity, this);
uVar1 = (uVar3 + 4) & 0x18;
}
iVar4 = GetCollisionData(TILE(this->x.HALF.HI, this->y.HALF.HI) + gUnk_080B4488[((uVar1) >> 3)], 1);
iVar4 = GetCollisionDataAtMetaTilePos(TILE(this->x.HALF.HI, this->y.HALF.HI) + gUnk_080B4488[((uVar1) >> 3)], 1);
if (iVar4 != 0) {
this->direction = 0xff;
} else {
+1 -1
View File
@@ -276,7 +276,7 @@ void sub_0803E4D8(Entity* this) {
u32 tile;
tile = TILE(this->x.HALF.HI, this->y.HALF.HI + 8);
if (GetCollisionData(tile, gPlayerEntity.collisionLayer) != 0xff) {
if (GetCollisionDataAtMetaTilePos(tile, gPlayerEntity.collisionLayer) != 0xff) {
SetTile(0x4074, tile, gPlayerEntity.collisionLayer);
}
}
+1 -1
View File
@@ -236,7 +236,7 @@ void sub_0802F8E4(WizzrobeEntity* this) {
iVar4 = ((s32)(rand)&0x7ff0) % (this->unk_6f << 3);
uVar7 = (uVar1 + iVar4) | 8;
uVar6 = TILE(uVar8, uVar7);
if ((GetCollisionData(uVar6, super->collisionLayer) == 0) &&
if ((GetCollisionDataAtMetaTilePos(uVar6, super->collisionLayer) == 0) &&
(GetTileIndex(uVar6, super->collisionLayer) != 0x4071)) {
super->x.HALF.HI = (s16)uVar8;
super->y.HALF.HI = (s16)uVar7;
+1 -1
View File
@@ -12,7 +12,7 @@ void ItemGustJar(ItemBehavior* this, u32 index) {
}
void sub_08076DF4(ItemBehavior* this, u32 index) {
if (GetCollisionTileInFront(&gPlayerEntity) != 0x29 && gPlayerState.floor_type != SURFACE_DOOR &&
if (GetVvvInFront(&gPlayerEntity) != 0x29 && gPlayerState.floor_type != SURFACE_DOOR &&
gPlayerState.floor_type != SURFACE_DOOR_13 && gPlayerState.jump_status == 0) {
sub_08077D38(this, index);
this->timer = 0;
+2 -2
View File
@@ -181,13 +181,13 @@ s32 sub_080774A0(void) {
uVar3 = COORD_TO_TILE_OFFSET((&gPlayerEntity), -gUnk_0811BE1E[gPlayerEntity.animationState & 6],
-gUnk_0811BE1E[(gPlayerEntity.animationState & 6) + 1]);
iVar2 = GetCollisionData(uVar3, gPlayerEntity.collisionLayer);
iVar2 = GetCollisionDataAtMetaTilePos(uVar3, gPlayerEntity.collisionLayer);
if (iVar2 > 0x16)
return 0;
if (iVar2 < 0xf)
return 0;
if (sub_080B1AE0(uVar3, gPlayerEntity.collisionLayer) != 0x56) {
if (GetVvvAtMetaTilePos(uVar3, gPlayerEntity.collisionLayer) != 0x56) {
return 1;
} else {
return 0x56;
+1 -3
View File
@@ -15,8 +15,6 @@
u32 sub_0805BFC4(u32, u32);
void sub_0805C02C(BombableWallManager*);
extern u32 sub_080B1AE0(u16, u8);
u32 getArchwayType(void);
void BombableWallManager_Init(BombableWallManager*);
void BombableWallManager_Action1(BombableWallManager*);
@@ -47,7 +45,7 @@ void BombableWallManager_Init(BombableWallManager* this) {
}
void BombableWallManager_Action1(BombableWallManager* this) {
if (sub_080B1AE0(this->tile, this->field_0x35) != 0x2e) {
if (GetVvvAtMetaTilePos(this->tile, this->field_0x35) != 0x2e) {
super->action = 2;
super->timer = 90;
sub_0805C02C(this);
+1 -3
View File
@@ -14,8 +14,6 @@
#include "room.h"
#include "sound.h"
extern u32 sub_080B1AC8(u16, u16, u8);
bool32 PortalReadyForMinish(void);
void MinishPortalManager_Main(MinishPortalManager* this) {
@@ -43,7 +41,7 @@ void MinishPortalManager_Main(MinishPortalManager* this) {
gArea.portal_mode = 3;
}
}
if (sub_080B1AC8(this->unk_38, this->unk_3a, super->timer) == 0x3d) {
if (GetVvvAtRoomCoords(this->unk_38, this->unk_3a, super->timer) == 0x3d) {
CreateMagicSparkles(this->unk_38 + gRoomControls.origin_x, this->unk_3a + gRoomControls.origin_y,
super->timer);
if (super->subtimer == 0) {
+3 -3
View File
@@ -472,7 +472,7 @@ u32 sub_080611D4(Entity* this) {
0x2b, 0x10, 0x2a, 0x0, 0x2d, 0x8, 0x2c, 0x18, 0x0,
};
u32 uVar2;
u32 vvv;
u32 x;
s32 a;
s32 b;
@@ -482,11 +482,11 @@ u32 sub_080611D4(Entity* this) {
ptr = (s8*)gUnk_0810AC4C;
a = ptr[x];
b = ptr[x + 1];
uVar2 = GetRelativeCollisionTile(this, a, b);
vvv = GetVvvRelativeToEntity(this, a, b);
ptr2 = gUnk_0810AC54;
do {
if (*ptr2 != uVar2 || this->animationState != (ptr2[1] >> 2)) {
if (*ptr2 != vvv || this->animationState != (ptr2[1] >> 2)) {
continue;
}
+5 -5
View File
@@ -1,10 +1,9 @@
#include "global.h"
#include "asm.h"
#include "entity.h"
#include "npc.h"
#include "functions.h"
#include "item.h"
#include "npc.h"
extern u32 sub_080B1AC8(u32, u32, u32);
void sub_0806ACC4(Entity*);
void sub_0806ABFC(Entity*);
void sub_0806AC3C(Entity*);
@@ -792,8 +791,9 @@ void sub_0806B0E0(Entity* this, ScriptExecutionContext* context) {
static const u16 gUnk_08112C5C[2] = { TEXT_INDEX(TEXT_TOWN_MINISH2, 0x25), TEXT_INDEX(TEXT_TOWN_MINISH2, 0x26) };
int idx = 0;
if (sub_080B1AC8(0x38, 0xb8, 1) == 0x57 && sub_080B1AC8(0x48, 0xb8, 1) == 0x57 &&
sub_080B1AC8(0x38, 200, 1) == 0x57 && sub_080B1AC8(0x48, 200, 1) == 0x57) {
// Checks if the dust is gone at these four meta tiles.
if (GetVvvAtRoomCoords(56, 184, 1) == 0x57 && GetVvvAtRoomCoords(72, 184, 1) == 0x57 &&
GetVvvAtRoomCoords(56, 200, 1) == 0x57 && GetVvvAtRoomCoords(72, 200, 1) == 0x57) {
idx = 1;
}
+82 -82
View File
@@ -129,8 +129,8 @@ void sub_08099880(BigIceBlockEntity* this) {
void sub_08099910(BigIceBlockEntity* this) {
u32 uVar2;
s32 iVar1;
u32 uVar3;
s32 vvv;
u32 tileIndex;
u32 position;
position = COORD_TO_TILE(super);
@@ -146,112 +146,112 @@ void sub_08099910(BigIceBlockEntity* this) {
SetTile(0x4022, position, super->collisionLayer);
break;
case 1:
iVar1 = sub_080B1AE0(position - 0x41, super->collisionLayer);
uVar3 = 0x4024;
if (iVar1 == 0x12) {
uVar3 = 0x4079;
vvv = GetVvvAtMetaTilePos(position - 0x41, super->collisionLayer);
tileIndex = 0x4024;
if (vvv == 0x12) {
tileIndex = 0x4079;
}
SetTile(uVar3, position - 0x41, super->collisionLayer);
SetTile(tileIndex, position - 0x41, super->collisionLayer);
SetTile(0x4022, position - 0x40, super->collisionLayer);
iVar1 = sub_080B1AE0(position - 0x3f, super->collisionLayer);
uVar3 = 0x4025;
if (iVar1 == 0x12) {
uVar3 = 0x407b;
vvv = GetVvvAtMetaTilePos(position - 0x3f, super->collisionLayer);
tileIndex = 0x4025;
if (vvv == 0x12) {
tileIndex = 0x407b;
}
SetTile(uVar3, position - 0x3f, super->collisionLayer);
iVar1 = sub_080B1AE0(position - 1, super->collisionLayer);
uVar3 = 0x4024;
if (iVar1 == 0x12) {
uVar3 = 0x4079;
SetTile(tileIndex, position - 0x3f, super->collisionLayer);
vvv = GetVvvAtMetaTilePos(position - 1, super->collisionLayer);
tileIndex = 0x4024;
if (vvv == 0x12) {
tileIndex = 0x4079;
}
SetTile(uVar3, position - 1, super->collisionLayer);
SetTile(tileIndex, position - 1, super->collisionLayer);
SetTile(0x4022, position, super->collisionLayer);
iVar1 = sub_080B1AE0(position + 1, super->collisionLayer);
uVar3 = 0x4025;
if (iVar1 == 0x12) {
uVar3 = 0x407b;
vvv = GetVvvAtMetaTilePos(position + 1, super->collisionLayer);
tileIndex = 0x4025;
if (vvv == 0x12) {
tileIndex = 0x407b;
}
SetTile(uVar3, position + 1, super->collisionLayer);
SetTile(tileIndex, position + 1, super->collisionLayer);
return;
break;
case 2:
iVar1 = sub_080B1AE0(position - 0x41, super->collisionLayer);
uVar3 = 0x4023;
if (iVar1 == 0x12) {
uVar3 = 0x4077;
vvv = GetVvvAtMetaTilePos(position - 0x41, super->collisionLayer);
tileIndex = 0x4023;
if (vvv == 0x12) {
tileIndex = 0x4077;
}
SetTile(uVar3, position - 0x41, super->collisionLayer);
iVar1 = sub_080B1AE0(position - 0x40, super->collisionLayer);
uVar3 = 0x4023;
if (iVar1 == 0x12) {
uVar3 = 0x4077;
SetTile(tileIndex, position - 0x41, super->collisionLayer);
vvv = GetVvvAtMetaTilePos(position - 0x40, super->collisionLayer);
tileIndex = 0x4023;
if (vvv == 0x12) {
tileIndex = 0x4077;
}
SetTile(uVar3, position - 0x40, super->collisionLayer);
SetTile(tileIndex, position - 0x40, super->collisionLayer);
SetTile(0x4022, position - 1, super->collisionLayer);
SetTile(0x4022, position, super->collisionLayer);
iVar1 = sub_080B1AE0(position + 0x3f, super->collisionLayer);
uVar3 = 0x4026;
if (iVar1 == 0x12) {
uVar3 = 0x407c;
vvv = GetVvvAtMetaTilePos(position + 0x3f, super->collisionLayer);
tileIndex = 0x4026;
if (vvv == 0x12) {
tileIndex = 0x407c;
}
SetTile(uVar3, position + 0x3f, super->collisionLayer);
iVar1 = sub_080B1AE0(position + 0x40, super->collisionLayer);
uVar3 = 0x4026;
if (iVar1 == 0x12) {
uVar3 = 0x407c;
SetTile(tileIndex, position + 0x3f, super->collisionLayer);
vvv = GetVvvAtMetaTilePos(position + 0x40, super->collisionLayer);
tileIndex = 0x4026;
if (vvv == 0x12) {
tileIndex = 0x407c;
}
SetTile(uVar3, position + 0x40, super->collisionLayer);
SetTile(tileIndex, position + 0x40, super->collisionLayer);
break;
case 3:
iVar1 = sub_080B1AE0(position - 0x41, super->collisionLayer);
uVar3 = 0x4027;
if (iVar1 == 0x12) {
uVar3 = 0x4075;
vvv = GetVvvAtMetaTilePos(position - 0x41, super->collisionLayer);
tileIndex = 0x4027;
if (vvv == 0x12) {
tileIndex = 0x4075;
}
SetTile(uVar3, position - 0x41, super->collisionLayer);
iVar1 = sub_080B1AE0(position - 0x40, super->collisionLayer);
uVar3 = 0x4023;
if (iVar1 == 0x12) {
uVar3 = 0x4077;
SetTile(tileIndex, position - 0x41, super->collisionLayer);
vvv = GetVvvAtMetaTilePos(position - 0x40, super->collisionLayer);
tileIndex = 0x4023;
if (vvv == 0x12) {
tileIndex = 0x4077;
}
SetTile(uVar3, position - 0x40, super->collisionLayer);
iVar1 = sub_080B1AE0(position - 0x3f, super->collisionLayer);
uVar3 = 0x4028;
if (iVar1 == 0x12) {
uVar3 = 0x4076;
SetTile(tileIndex, position - 0x40, super->collisionLayer);
vvv = GetVvvAtMetaTilePos(position - 0x3f, super->collisionLayer);
tileIndex = 0x4028;
if (vvv == 0x12) {
tileIndex = 0x4076;
}
SetTile(uVar3, position - 0x3f, super->collisionLayer);
iVar1 = sub_080B1AE0(position - 1, super->collisionLayer);
uVar3 = 0x4024;
if (iVar1 == 0x12) {
uVar3 = 0x4079;
SetTile(tileIndex, position - 0x3f, super->collisionLayer);
vvv = GetVvvAtMetaTilePos(position - 1, super->collisionLayer);
tileIndex = 0x4024;
if (vvv == 0x12) {
tileIndex = 0x4079;
}
SetTile(uVar3, position - 1, super->collisionLayer);
SetTile(tileIndex, position - 1, super->collisionLayer);
SetTile(0x4022, position, super->collisionLayer);
iVar1 = sub_080B1AE0(position + 1, super->collisionLayer);
uVar3 = 0x4025;
if (iVar1 == 0x12) {
uVar3 = 0x407b;
vvv = GetVvvAtMetaTilePos(position + 1, super->collisionLayer);
tileIndex = 0x4025;
if (vvv == 0x12) {
tileIndex = 0x407b;
}
SetTile(uVar3, position + 1, super->collisionLayer);
iVar1 = sub_080B1AE0(position + 0x3f, super->collisionLayer);
uVar3 = 0x4029;
if (iVar1 == 0x12) {
uVar3 = 0x4078;
SetTile(tileIndex, position + 1, super->collisionLayer);
vvv = GetVvvAtMetaTilePos(position + 0x3f, super->collisionLayer);
tileIndex = 0x4029;
if (vvv == 0x12) {
tileIndex = 0x4078;
}
SetTile(uVar3, position + 0x3f, super->collisionLayer);
iVar1 = sub_080B1AE0(position + 0x40, super->collisionLayer);
uVar3 = 0x4026;
if (iVar1 == 0x12) {
uVar3 = 0x407c;
SetTile(tileIndex, position + 0x3f, super->collisionLayer);
vvv = GetVvvAtMetaTilePos(position + 0x40, super->collisionLayer);
tileIndex = 0x4026;
if (vvv == 0x12) {
tileIndex = 0x407c;
}
SetTile(uVar3, position + 0x40, super->collisionLayer);
iVar1 = sub_080B1AE0(position + 0x41, super->collisionLayer);
uVar3 = 0x402a;
if (iVar1 == 0x12) {
uVar3 = 0x407a;
SetTile(tileIndex, position + 0x40, super->collisionLayer);
vvv = GetVvvAtMetaTilePos(position + 0x41, super->collisionLayer);
tileIndex = 0x402a;
if (vvv == 0x12) {
tileIndex = 0x407a;
}
SetTile(uVar3, position + 0x41, super->collisionLayer);
SetTile(tileIndex, position + 0x41, super->collisionLayer);
break;
}
}
+1 -1
View File
@@ -95,7 +95,7 @@ void sub_0808B3AC(BollardEntity* this) {
super->spritePriority.b0 = 4;
this->tile = COORD_TO_TILE(super);
this->tileIndex = GetTileIndex(this->tile, super->collisionLayer);
this->unk74 = GetCollisionData(this->tile, super->collisionLayer);
this->unk74 = GetCollisionDataAtMetaTilePos(this->tile, super->collisionLayer);
SetTile(0x400b, this->tile, super->collisionLayer);
}
+1 -1
View File
@@ -154,7 +154,7 @@ u32 sub_08081E0C(Entity*);
Entity* sub_08081D74(Entity* this) {
Entity* ent;
if (GetCollisionData(this->field_0x74.HWORD, this->collisionLayer) == 0xF) {
if (GetCollisionDataAtMetaTilePos(this->field_0x74.HWORD, this->collisionLayer) == 0xF) {
return 0;
}
ent = 0;
+3 -5
View File
@@ -6,8 +6,8 @@
*/
#define NENT_DEPRECATED
#include "asm.h"
#include "functions.h"
#include "global.h"
#include "hitbox.h"
#include "object.h"
@@ -18,8 +18,6 @@ typedef struct {
/*0x72*/ u16 unk_72;
} CrenelBeanSproutEntity;
extern u32 sub_080B1AB4(s32, s32, u32);
void sub_080969A4(CrenelBeanSproutEntity*);
void sub_08096A78(CrenelBeanSproutEntity*);
void CrenelBeanSprout_Init(CrenelBeanSproutEntity*);
@@ -171,13 +169,13 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) {
tmp = gPlayerEntity.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 (sub_080B1AB4(this->unk_70, this->unk_72, super->collisionLayer) == 0x19) {
if (GetVvvAtWorldCoords(this->unk_70, this->unk_72, super->collisionLayer) == 0x19) {
gHUD.rActionPlayerState = R_ACTION_THROW;
} else {
gHUD.rActionPlayerState = R_ACTION_NONE;
}
PositionRelative(&gPlayerEntity, super, 0, 0x10000);
if (GetTileUnderEntity(super) == 0x19) {
if (GetVvvAtEntity(super) == 0x19) {
RestorePrevTileEntity(0xdc, super->collisionLayer);
sub_08096A78(this);
}
+1 -1
View File
@@ -335,7 +335,7 @@ void sub_08094E30(CutsceneMiscObjectEntity* this) {
super->zVelocity = 0;
SetDefaultPriority(super, PRIO_PLAYER_EVENT);
InitializeAnimation(super, 0);
if (GetTileUnderEntity(super) == 13) {
if (GetVvvAtEntity(super) == 13) {
super->action = 3;
}
break;
+2 -4
View File
@@ -10,8 +10,6 @@
#include "object.h"
#include "room.h"
extern void sub_080001D0(u32, u32, u32);
enum {
FURNITURE_INIT,
FURNITURE_UPDATE,
@@ -263,7 +261,7 @@ static void FurnitureInit(FurnitureEntity* this) {
for (i = 0; i < cnt; ++i, ++tile) {
SetTile(0x4026, tile, 2);
SetTile(0x4026, tile, 1);
sub_080001D0(0, tile + 64, 1);
SetVvvAtMetaTilePos(0, tile + 64, 1);
}
break;
}
@@ -289,7 +287,7 @@ static void FurnitureInit(FurnitureEntity* this) {
super->collisionLayer = 1;
super->spriteOrientation.flipY = 2;
SetTile(0x4074, this->tile - 64, super->collisionLayer);
sub_080001D0(63, this->tile - 64, super->collisionLayer);
SetVvvAtMetaTilePos(63, this->tile - 64, super->collisionLayer);
SetTile(0x4017, this->tile, super->collisionLayer);
SetTile(0x4017, this->tile + 64, super->collisionLayer);
break;
+1 -1
View File
@@ -282,7 +282,7 @@ void sub_080812A0(Entity* this) {
}
void sub_080812A8(Entity* this) {
if (sub_080B1B0C(this) != 0xF && this->field_0x6e.HWORD != GetTileTypeByEntity(this)) {
if (GetCollisionDataAtEntity(this) != 0xF && this->field_0x6e.HWORD != GetTileTypeByEntity(this)) {
this->direction = 0;
this->speed = 0;
this->spriteSettings.draw = 1;
+4 -4
View File
@@ -176,10 +176,10 @@ void sub_0808C148(Entity* this, u32 a2) {
pos = COORD_TO_TILE(this);
if (!a2) {
SetTile(16530, pos - 1, this->collisionLayer);
SetTile(16531, pos, this->collisionLayer);
SetTile(16532, pos + 63, this->collisionLayer);
SetTile(16533, pos + 64, this->collisionLayer);
SetTile(0x4092, pos - 1, this->collisionLayer);
SetTile(0x4093, pos, this->collisionLayer);
SetTile(0x4094, pos + 63, this->collisionLayer);
SetTile(0x4095, pos + 64, this->collisionLayer);
} else {
RestorePrevTileEntity(pos - 1, this->collisionLayer);
RestorePrevTileEntity(pos, this->collisionLayer);
+8 -8
View File
@@ -344,10 +344,10 @@ void sub_08085A1C(LilypadLargeEntity* this) {
void sub_08085A44(LilypadLargeEntity* this) {
super->speed = 0x200;
if (GetRelativeCollisionTile(super, 0x10, 0x18) != 0x11) {
if (GetVvvRelativeToEntity(super, 0x10, 0x18) != 0x11) {
super->direction = 0x18;
} else {
if (GetRelativeCollisionTile(super, -0x10, 0x18) != 0x11) {
if (GetVvvRelativeToEntity(super, -0x10, 0x18) != 0x11) {
super->direction = 8;
} else {
super->direction = 0x10;
@@ -368,7 +368,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 (GetRelativeCollisionTile(super, 0, 0x18) != 0x11) {
if (GetVvvRelativeToEntity(super, 0, 0x18) != 0x11) {
super->subAction = 2;
if (gArea.locationIndex == 0x1b) {
super->y.HALF.HI += 0xd0;
@@ -401,7 +401,7 @@ void sub_08085B40(LilypadLargeEntity* this) {
}
} else {
ResetCollisionLayer(super);
if (GetTileUnderEntity(super) == 0xd) {
if (GetVvvAtEntity(super) == 0xd) {
ResetCollisionLayer(&gPlayerEntity);
sub_08085CDC(this);
super->direction = GetFacingDirection(&gPlayerEntity, super);
@@ -423,7 +423,7 @@ void sub_08085B40(LilypadLargeEntity* this) {
super->timer |= 0x80;
this->unk_70 = 0;
this->unk_6c = 0;
if (GetTileUnderEntity(super) == 0xd) {
if (GetVvvAtEntity(super) == 0xd) {
super->action = 4;
}
}
@@ -471,7 +471,7 @@ void sub_08085D10(LilypadLargeEntity* this) {
void sub_08085D28(LilypadLargeEntity* this) {
if (((gPlayerState.framestate != PL_STATE_TALKEZLO) && ((gPlayerState.flags & PL_FLAGS2) != 0)) &&
(GetRelativeCollisionTile(super, 0, 0x18) == 0x11)) {
(GetVvvRelativeToEntity(super, 0, 0x18) == 0x11)) {
super->action = 2;
super->subAction = 0;
sub_08078B48();
@@ -509,7 +509,7 @@ void sub_08085D60(LilypadLargeEntity* this) {
tmp = r4 >> 2;
tmpX = gUnk_08120638[tmp];
tmpY = gUnk_08120638[tmp + 1];
if (sub_080B1AF0(super, tmpX, tmpY) == 0xff) {
if (GetCollisionDataRelativeTo(super, tmpX, tmpY) == 0xff) {
if (sub_080806BC((super->x.HALF.HI - gRoomControls.origin_x) + tmpX,
(super->y.HALF.HI - gRoomControls.origin_y) + tmpY, r4, 5) == 0) {
@@ -528,7 +528,7 @@ void sub_08085D60(LilypadLargeEntity* this) {
tmp = r6 >> 2;
tmpX2 = gUnk_08120638[tmp];
tmpY2 = gUnk_08120638[tmp + 1];
if (sub_080B1AF0(super, tmpX2, tmpY2) == 0xff) {
if (GetCollisionDataRelativeTo(super, tmpX2, tmpY2) == 0xff) {
if (sub_0807BD14(&gPlayerEntity, r6 >> 3) != 0) {
super->direction = (u8)r6;
sub_08085E74(this);
+1 -1
View File
@@ -61,7 +61,7 @@ void Mask_Init(Entity* this) {
this->field_0x7c.HALF_U.HI = COORD_TO_TILE(this);
this->field_0x7c.HALF_U.LO = GetTileIndex(this->field_0x7c.HALF_U.HI, 1);
this->field_0x7a.HWORD = GetCollisionData((u16)this->field_0x7c.HALF.HI, 1);
this->field_0x7a.HWORD = GetCollisionDataAtMetaTilePos((u16)this->field_0x7c.HALF.HI, 1);
SetTile(0x4022, this->field_0x7c.HALF_U.HI, 1);
}
+39 -13
View File
@@ -27,7 +27,7 @@ void Minecart_Action5(MinecartEntity*);
void Minecart_Action6(MinecartEntity*);
void Minecart_Action7(MinecartEntity*);
extern const u16* const gUnk_081223D8[];
extern const KeyValuePair* const gUnk_081223D8[];
void Minecart(Entity* this) {
static void (*const Minecart_Actions[])(MinecartEntity*) = {
@@ -129,10 +129,9 @@ void Minecart_Action2(MinecartEntity* this) {
}
void Minecart_Action3(MinecartEntity* this) {
static const s8 gUnk_081223C8[] = { 0, -7, 7, 0, 0, 7, -7, 0 };
static const s8 offsetCoords[] = { 0, -7, 7, 0, 0, 7, -7, 0 };
u32 iVar2;
u32 uVar3;
u32 vvv;
gRoomControls.scrollSpeed = 7;
if ((gPlayerState.flags & PL_IN_MINECART) == 0) {
@@ -164,14 +163,13 @@ void Minecart_Action3(MinecartEntity* this) {
super->subtimer = 60;
}
uVar3 = GetRelativeCollisionTile(super, gUnk_081223C8[super->animationState * 2],
gUnk_081223C8[super->animationState * 2 + 1]);
iVar2 = sub_08007DD6(uVar3, gUnk_081223D8[super->animationState]);
if (iVar2 == 0) {
vvv = GetVvvRelativeToEntity(super, offsetCoords[super->animationState * 2],
offsetCoords[super->animationState * 2 + 1]);
if (FindValueForKey(vvv, gUnk_081223D8[super->animationState]) == 0) {
super->direction = DirectionTurnAround(super->direction);
super->animationState = AnimationStateFlip90(super->animationState);
} else {
switch (uVar3) {
switch (vvv) {
case 0x64:
super->flags &= ~ENT_PERSIST;
super->hitType = 1;
@@ -200,7 +198,7 @@ void Minecart_Action3(MinecartEntity* this) {
case 0x6d:
case 0x6e:
case 0x6f:
if (uVar3 == GetTileUnderEntity(super)) {
if (vvv == GetVvvAtEntity(super)) {
Minecart_Action4(this);
gPlayerEntity.animationState = super->animationState << 1;
return;
@@ -222,7 +220,7 @@ void Minecart_Action3(MinecartEntity* this) {
void Minecart_Action4(MinecartEntity* this) {
sub_08004168(super);
CopyPosition(super, &gPlayerEntity);
switch (GetTileUnderEntity(super)) {
switch (GetVvvAtEntity(super)) {
case 0x67:
if (super->direction == DirectionWest) {
super->direction = DirectionNorth;
@@ -312,8 +310,8 @@ void Minecart_Action7(MinecartEntity* this) {
bool32 sub_08091DDC(MinecartEntity* this) {
static const s8 gUnk_081223D0[] = { 0, -8, 8, 0, 0, 8, -8, 0 };
if ((sub_080B1AF0(super, gUnk_081223D0[super->animationState * 2], gUnk_081223D0[super->animationState * 2 + 1]) ==
0xff) &&
if ((GetCollisionDataRelativeTo(super, gUnk_081223D0[super->animationState * 2],
gUnk_081223D0[super->animationState * 2 + 1]) == 0xff) &&
(sub_0807BD14(&gPlayerEntity, super->animationState))) {
super->updatePriority = 6;
super->action = 5;
@@ -332,3 +330,31 @@ bool32 sub_08091DDC(MinecartEntity* this) {
return 0;
}
}
extern const KeyValuePair gUnk_081223E8[];
extern const KeyValuePair gUnk_08122402[];
extern const KeyValuePair gUnk_0812241C[];
extern const KeyValuePair gUnk_08122436[];
const KeyValuePair* const gUnk_081223D8[] = {
gUnk_081223E8,
gUnk_08122402,
gUnk_0812241C,
gUnk_08122436,
};
const KeyValuePair gUnk_081223E8[] = {
{ 242, 1 }, { 101, 1 }, { 104, 1 }, { 106, 1 }, { 100, 1 }, { 41, 1 },
};
const u16 gUnk_081223E8End = 0;
const KeyValuePair gUnk_08122402[] = {
{ 243, 1 }, { 102, 1 }, { 104, 1 }, { 105, 1 }, { 100, 1 }, { 41, 1 },
};
const u16 gUnk_08122402End = 0;
const KeyValuePair gUnk_0812241C[] = {
{ 242, 1 }, { 101, 1 }, { 103, 1 }, { 105, 1 }, { 100, 1 }, { 41, 1 },
};
const u16 gUnk_0812241CEnd = 0;
const KeyValuePair gUnk_08122436[] = {
{ 243, 1 }, { 102, 1 }, { 106, 1 }, { 103, 1 }, { 100, 1 }, { 41, 1 },
};
const u16 gUnk_08122436End = 0;
+1 -1
View File
@@ -83,7 +83,7 @@ void Object1F_Action1(Object1FEntity* this) {
void Object1F_Action2(Object1FEntity* this) {
u8 bVar1;
bVar1 = sub_080B1B0C(super);
bVar1 = GetCollisionDataAtEntity(super);
switch (bVar1) {
case 0x21:
CreateFx(super, FX_FALL_DOWN, 0);
+3 -7
View File
@@ -38,11 +38,6 @@ typedef struct {
/*0x86*/ u16 hitFlag;
} EntityWithHitFlag;
typedef struct {
u16 key;
u16 value;
} KeyValuePair;
void sub_080970F4(ObjectOnPillarEntity*);
void sub_080971E0(ObjectOnPillarEntity*);
bool32 sub_08097194(ObjectOnPillarEntity*);
@@ -180,8 +175,9 @@ bool32 sub_08097008(ObjectOnPillarEntity* this) {
u32 sub_08097074(u32 tileType) {
static const KeyValuePair gUnk_0812327C[] = {
{ 0x4037, 1 }, { 0x4038, 1 }, { 0x4039, 1 }, { 0x403a, 1 }, { 0x7a, 2 }, { 0x78, 2 }, { 0, 0 },
{ 0x4037, 1 }, { 0x4038, 1 }, { 0x4039, 1 }, { 0x403a, 1 }, { 0x7a, 2 }, { 0x78, 2 },
};
static const u16 gUnk_0812327CEnd = 0;
const KeyValuePair* entry = gUnk_0812327C;
for (; entry->key != 0; entry++) {
if (entry->key == tileType) {
@@ -211,7 +207,7 @@ void sub_080970F4(ObjectOnPillarEntity* this) {
bool32 sub_08097144(ObjectOnPillarEntity* this) {
LinearMoveUpdate(super);
sub_0800445C(super);
if (GetTileUnderEntity(super) == 0x19) {
if (GetVvvAtEntity(super) == 0x19) {
super->spriteOffsetY = 2;
}
if ((--this->unk_76 == 0) && sub_08097194(this) == FALSE) {
+1 -1
View File
@@ -110,7 +110,7 @@ void PlayerClone_Action2(PlayerCloneEntity* this) {
if (gPlayerEntity.iframes >= 1) {
gPlayerState.chargeState.action = 1;
} else {
GetTileUnderEntity(super);
GetVvvAtEntity(super); // TODO why is the return value not used?
sub_08084B1C(this);
super->x.HALF.HI = gPlayerEntity.x.HALF.HI + this->unk78;
super->y.HALF.HI = gPlayerEntity.y.HALF.HI + this->unk7a;
+1 -1
View File
@@ -118,7 +118,7 @@ void Pot_Action1(Entity* this) {
DeleteThisEntity();
break;
default:
if (GetTileUnderEntity(this) == 13) {
if (GetVvvAtEntity(this) == 13) {
CreateFx(this, FX_FALL_DOWN, 0);
} else if (tileType == 0x4005) {
gPlayerState.lastSwordMove = SWORD_MOVE_BREAK_POT;
+1 -1
View File
@@ -114,7 +114,7 @@ void PullableLever_HandleSubAction0(PullableLeverEntity* this) {
if (-player->animationState + super->type2 * 2 == 0) {
x = gUnk_081222B8[super->type2 * 2] + super->x.HALF_U.HI;
y = gUnk_081222B8[super->type2 * 2 + 1] + super->y.HALF_U.HI;
if (0x10 < sub_080B1B18(x, y, player->collisionLayer) - 0xf) {
if (0x10 < GetCollisionDataAtWorldCoords(x, y, player->collisionLayer) - 0xf) {
player->x.HALF.HI = x;
player->y.HALF.HI = y;
}
+6 -6
View File
@@ -223,7 +223,7 @@ bool32 sub_0808FC5C(PushableFurnitureEntity* this) {
} else {
super->spriteOffsetY = 0;
}
if (sub_080B1B0C(super)) {
if (GetCollisionDataAtEntity(super)) {
return 0;
}
if (super->subtimer == 0) {
@@ -312,27 +312,27 @@ void sub_0808FDE8(PushableFurnitureEntity* this) {
u32 uVar3;
uVar3 = (u32)this->unk_70;
uVar1 = GetCollisionData(uVar3 - 1, 1);
uVar1 = GetCollisionDataAtMetaTilePos(uVar3 - 1, 1);
iVar2 = GetTileIndex(uVar3, 1);
if (iVar2 == 0x402e) {
if ((((uVar1 & 0xf0) != 0) && ((uVar1 & 0xf0) != 0x50)) || ((uVar1 & 5) == 0)) {
SetTile(0x402c, uVar3, 1);
}
} else {
iVar2 = GetCollisionData(uVar3, 1);
iVar2 = GetCollisionDataAtMetaTilePos(uVar3, 1);
if ((iVar2 == 5) && ((((uVar1 & 0xf0) == 0 || ((uVar1 & 0xf0) == 0x50)) && ((uVar1 & 5) != 0)))) {
SetTile(0x402e, uVar3, 1);
}
}
uVar3 = (u32)this->unk_72;
uVar1 = GetCollisionData(uVar3 + 1, 1);
uVar1 = GetCollisionDataAtMetaTilePos(uVar3 + 1, 1);
iVar2 = GetTileIndex(uVar3, 1);
if (iVar2 == 0x402f) {
if ((((uVar1 & 0xf0) != 0) && ((uVar1 & 0xf0) != 0x50)) || ((uVar1 & 10) == 0)) {
SetTile(0x402d, uVar3, 1);
}
} else {
iVar2 = GetCollisionData(uVar3, 1);
iVar2 = GetCollisionDataAtMetaTilePos(uVar3, 1);
if (((iVar2 == 10) && (((uVar1 & 0xf0) == 0 || ((uVar1 & 0xf0) == 0x50)))) && ((uVar1 & 10) != 0)) {
SetTile(0x402f, uVar3, 1);
}
@@ -411,7 +411,7 @@ void sub_08090094(PushableFurnitureEntity* this, u32 param_2, u32 tilePos) {
u32 index;
u32 tmp2;
tmp1 = GetCollisionData(tilePos, 1);
tmp1 = GetCollisionDataAtMetaTilePos(tilePos, 1);
index = GetTileIndex(tilePos, 1);
if ((index & 0x4000) == 0) {
index = param_2;
+4 -4
View File
@@ -89,12 +89,12 @@ void PushableRock_Action3(PushableRockEntity* this) {
}
void sub_0808A644(PushableRockEntity* this) {
u32 tmp;
u32 vvv;
this->tilePosition = COORD_TO_TILE(super);
this->tileIndex = GetTileIndex(this->tilePosition, super->collisionLayer);
this->unk_72 = GetCollisionData(this->tilePosition, super->collisionLayer);
tmp = sub_080B1AE0(this->tilePosition, super->collisionLayer);
if ((tmp == 0x19) || (tmp == 0xf0)) {
this->unk_72 = GetCollisionDataAtMetaTilePos(this->tilePosition, super->collisionLayer);
vvv = GetVvvAtMetaTilePos(this->tilePosition, super->collisionLayer);
if ((vvv == 0x19) || (vvv == 0xf0)) {
SetTile(0x4015, this->tilePosition, super->collisionLayer);
super->action = 3;
if (!CheckFlags(this->pushedFlag)) {
+4 -4
View File
@@ -212,7 +212,7 @@ bool32 sub_080895C0(PushableStatueEntity* this) {
LinearMoveUpdate(super);
if ((--this->unk_86 == 0) && (sub_0800442E(super) == 0)) {
super->spriteOffsetY = 0;
if (!sub_080B1B0C(super)) {
if (!GetCollisionDataAtEntity(super)) {
sub_08089454(this);
return TRUE;
}
@@ -258,14 +258,14 @@ bool32 sub_080896B0(void) {
const s16* ptr;
u32 tmp1;
u32 tmp2;
u32 val;
u32 vvv;
if (((gPlayerState.heldObject & 0x1f) == 0x12) && ((gPlayerEntity.frame & 1) != 0)) {
ptr = &gUnk_080B4468[gPlayerEntity.animationState & 6];
uVar1 = gUnk_080B4488[gPlayerEntity.animationState >> 1];
uVar4 = COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], -ptr[1]) - uVar1;
val = sub_080B1AE0(uVar4, gPlayerEntity.collisionLayer);
if ((val - 0x26 > 1) && (val != 0x29)) {
vvv = GetVvvAtMetaTilePos(uVar4, gPlayerEntity.collisionLayer);
if ((vvv - 0x26 > 1) && (vvv != 0x29)) {
layer = GetLayerByIndex(gPlayerEntity.collisionLayer);
iVar2 = (uVar4 * 0x10000) >> 0x10;
tmp1 = layer->collisionData[iVar2];
+1 -1
View File
@@ -72,7 +72,7 @@ void sub_080878CC(Entity* this) {
for (itX = -0x10; itX < 0x11; itX += 0x10) {
for (itY = -0x10; itY < 0x11; itY += 0x10) {
pos = TILE((u32)x + itX, (u32)y + itY);
if (sub_080B1AE0(pos, (u8)layer) == 0x2e) {
if (GetVvvAtMetaTilePos(pos, (u8)layer) == 0x2e) {
switch (GetTileType(pos, layer)) {
case 0x368:
case 0x367:
+4 -4
View File
@@ -104,15 +104,15 @@ static void sub_0809E96C(Entity* this) {
}
static u32 sub_0809E9A0(void) {
u32 rv;
u32 vvv;
const s16* ptr;
if (gPlayerEntity.action != PLAYER_BOUNCE) {
rv = 0;
vvv = 0;
} else {
ptr = &gUnk_080B4468[gPlayerEntity.animationState & 6];
rv = sub_080B1AE0(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], -ptr[1]), 1);
vvv = GetVvvAtMetaTilePos(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], -ptr[1]), 1);
}
return rv;
return vvv;
}
+2 -2
View File
@@ -28,14 +28,14 @@ void Well_Init(Entity* this) {
this->action = 1;
tilePos = COORD_TO_TILE(this);
this->field_0x80.HWORD = tilePos;
SetTile(16509, this->field_0x80.HWORD, 1);
SetTile(0x407d, this->field_0x80.HWORD, 1);
}
void Well_Action1(Entity* this) {
s32 tileIndex;
tileIndex = GetTileType(this->field_0x80.HWORD, 1);
if (tileIndex != 0x407D) {
if (tileIndex != 0x407d) {
sub_08078B48();
gPlayerEntity.x.WORD = this->x.WORD;
gPlayerEntity.y.HALF.HI = this->y.HALF.HI + 4;
+3 -3
View File
@@ -18,7 +18,7 @@ const u8 gUnk_08114F38[];
extern u16 gExtraFrameOffsets[];
extern s8 gUnk_08126EE4[];
extern const u16 gUnk_080046A4[];
extern const KeyValuePair gUnk_080046A4[];
extern const u16 gUnk_080047F6[];
static void sub_0806FEE8(struct_gUnk_020000C0_1*, u32, u32, u32);
@@ -402,7 +402,7 @@ bool32 CheckPlayerProximity(u32 x, u32 y, u32 distX, u32 DistY) {
bool32 sub_0806FC24(u32 param_1, u32 param_2) {
register u32 rv asm("r0");
u32 val = sub_08007DD6(param_1, gUnk_080046A4);
u32 val = FindValueForKey(param_1, gUnk_080046A4);
if (val) {
rv = (*(gUnk_080047F6 + (val << 2)) >> param_2) & 0x1;
} else {
@@ -413,7 +413,7 @@ bool32 sub_0806FC24(u32 param_1, u32 param_2) {
const u16* sub_0806FC50(u32 param_1, u32 param_2) {
const u16* rv;
u32 val = sub_08007DD6(param_1, gUnk_080046A4);
u32 val = FindValueForKey(param_1, gUnk_080046A4);
if (!val || ((gUnk_080047F6[val << 2] >> param_2) & 0x1) == 0) {
rv = 0;
} else {
+23 -17
View File
@@ -1974,7 +1974,7 @@ static void PlayerRoomTransition(Entity* this) {
static void sub_080724DC(Entity* this) {
this->knockbackDuration = 0;
DeleteClones();
if (GetTileUnderEntity(this) != 0x29) {
if (GetVvvAtEntity(this) != 0x29) {
if ((gPlayerState.remainingDiveTime == 0) && (gPlayerState.swim_state != 0)) {
PlayerUpdateSwimming(this);
}
@@ -2000,7 +2000,7 @@ static void sub_080724DC(Entity* this) {
static void sub_0807258C(Entity* this) {
if (gRoomControls.reload_flags == 0) {
if (GetCollisionTileInFront(this) == 0x29) {
if (GetVvvInFront(this) == 0x29) {
UpdatePlayerMovement();
if (sub_080797C4() != 0) {
gPlayerState.startPosX = gPlayerEntity.x.HALF.HI;
@@ -2336,15 +2336,21 @@ static void sub_08072CFC(Entity* this) {
ResetActiveItems();
}
static const u16 sTiles[] = {
0x1AD, 1, 0, 0x1AE, 1, 0, 0x1AC, 1, 0, 0x1AF, 1, 0,
};
// TODO Why would this use FindValueForKey just to do a normal comparison?
static const KeyValuePair sTiles0 = { 0x1AD, 1 };
static const u16 sTiles0End = 0;
static const KeyValuePair sTiles1 = { 0x1AE, 1 };
static const u16 sTiles1End = 0;
static const KeyValuePair sTiles2 = { 0x1AC, 1 };
static const u16 sTiles2End = 0;
static const KeyValuePair sTiles3 = { 0x1AF, 1 };
static const u16 sTiles3End = 0;
static const u16* const sTileTable[] = {
sTiles,
sTiles + 3,
sTiles + 6,
sTiles + 9,
static const KeyValuePair* const sTileTable[] = {
&sTiles0,
&sTiles1,
&sTiles2,
&sTiles3,
};
static void sub_08072D54(Entity* this) {
@@ -2359,13 +2365,13 @@ static void sub_08072D54(Entity* this) {
uVar2 = GetTileType(sub_0806F730(this), this->collisionLayer);
switch (this->subtimer) {
case 0:
if (sub_08007DD6(uVar2, sTileTable[gPlayerEntity.animationState >> 1])) {
if (FindValueForKey(uVar2, sTileTable[gPlayerEntity.animationState >> 1])) {
this->timer = 1;
this->subtimer = 1;
}
break;
case 1:
if (sub_08007DD6(uVar2, sTileTable[gPlayerEntity.animationState >> 1])) {
if (FindValueForKey(uVar2, sTileTable[gPlayerEntity.animationState >> 1])) {
this->timer = 1;
} else {
this->subtimer = 2;
@@ -2373,7 +2379,7 @@ static void sub_08072D54(Entity* this) {
break;
case 2:
this->animationState ^= 4;
if (sub_08007DD6(uVar2, sTileTable[gPlayerEntity.animationState >> 1]) != 0) {
if (FindValueForKey(uVar2, sTileTable[gPlayerEntity.animationState >> 1]) != 0) {
this->timer = 1;
this->subtimer = 3;
}
@@ -2381,7 +2387,7 @@ static void sub_08072D54(Entity* this) {
break;
case 3:
this->animationState ^= 4;
if (sub_08007DD6(uVar2, sTileTable[gPlayerEntity.animationState >> 1])) {
if (FindValueForKey(uVar2, sTileTable[gPlayerEntity.animationState >> 1])) {
this->timer = 1;
} else {
this->subtimer = 4;
@@ -2616,7 +2622,7 @@ static void sub_080731D8(Entity* this) {
static void sub_080732D0(Entity* this) {
UpdateAnimationSingleFrame(this);
if (GetTileUnderEntity(this) != 40) {
if (GetVvvAtEntity(this) != 40) {
this->direction = DirectionNorth;
LinearMoveUpdate(this);
} else {
@@ -2878,7 +2884,7 @@ static void sub_080737BC(Entity* this) {
pos = this->y.HALF.HI;
tmp = 0xf;
tmp &= pos;
if (tmp == 8 && !sub_080B1B0C(this)) {
if (tmp == 8 && !GetCollisionDataAtEntity(this)) {
gPlayerState.jump_status |= 0x40;
PlayerSetNormalAndCollide();
}
@@ -4100,7 +4106,7 @@ void sub_0807529C(Entity* this) {
void sub_080752AC(Entity* this, ScriptExecutionContext* ctx) {
LinearMoveUpdate(this);
if (!ctx->unk_18) {
if (GetTileUnderEntity(this) != 41) {
if (GetVvvAtEntity(this) != 41) {
ctx->unk_18 = 1;
ctx->unk_19 = 6;
}
+1 -1
View File
@@ -272,7 +272,7 @@ void PlayerItemBottle_UseEmptyBottle(Entity* this) {
if (this->spriteSettings.flipX != 0) {
iVar2 = -iVar2;
}
if (GetRelativeCollisionTile(this, iVar2, (s8)ptr2[1]) == 0x10) {
if (GetVvvRelativeToEntity(this, iVar2, (s8)ptr2[1]) == 0x10) {
this->type2 = ITEM_BOTTLE_WATER;
}
}
+29 -5
View File
@@ -1,12 +1,36 @@
#include "asm.h"
#include "common.h"
#include "entity.h"
#include "player.h"
#include "room.h"
#include "common.h"
#include "asm.h"
extern const u8 gUnk_080B7910[];
extern const u8 gUnk_080B79A7[];
extern const u8 gUnk_080B7A3E[]; // TODO figure out type from arm_sub_080B1B84 and arm_sub_080B1BA4
// vvv for specialMetaTile
const u8 gUnk_080B7910[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 241, 0, 0, 83, 242, 243,
0, 0, 0, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 61, 61, 61, 61, 61, 61, 61, 61, 61, 0, 0, 0, 0, 0,
0, 0, 0, 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 18, 18, 0, 116, 116, 41, 0,
35, 41, 41, 41, 41, 41, 41, 16, 16, 16, 16, 41, 80, 81, 0, 15, 0, 0, 0, 0, 0,
};
const u8 gUnk_080B79A7[] = {
29, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 40, 40,
40, 15, 0, 0, 0, 0, 32, 0, 15, 3, 5, 10, 12, 1, 2, 4, 8, 15, 5, 10, 69, 68, 0, 0, 15, 0,
0, 0, 15, 0, 0, 0, 0, 15, 0, 0, 15, 0, 1, 3, 2, 5, 15, 10, 4, 12, 8, 71, 15, 0, 0, 0,
0, 0, 15, 15, 3, 5, 0, 13, 12, 11, 10, 0, 15, 15, 15, 15, 15, 15, 15, 15, 80, 7, 11, 13, 14, 15,
15, 39, 15, 15, 16, 17, 18, 19, 0, 0, 15, 15, 0, 1, 2, 3, 4, 5, 8, 10, 12, 15, 5, 12, 0, 0,
95, 39, 103, 104, 105, 106, 107, 49, 50, 58, 60, 35, 43, 43, 5, 34, 1, 2, 4, 8, 12,
};
const u16 gUnk_080B7A3E[] = {
1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 129, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 16, 0, 64, 0, 3, 3, 3, 3, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 34, 0, 0, 0, 0, 0,
}; // TODO no need to store this in an u16?
// TODO figure out type from arm_sub_080B1B84 and arm_sub_080B1BA4, also related to specialMetaTiles
void PlayerItemCellOverwriteSet(Entity* this) {
static const s8 gUnk_080B7B6C[] = { 0x0, -0x10, 0x10, 0x0, 0x0, 0x10, -0x10, 0x0 };
+10 -11
View File
@@ -1,9 +1,8 @@
#include "global.h"
#include "entity.h"
#include "player.h"
#include "functions.h"
#include "sound.h"
#include "asm.h"
#include "entity.h"
#include "functions.h"
#include "player.h"
#include "sound.h"
extern void sub_08078CD0(Entity*);
extern void sub_08018FA0(Entity*);
@@ -12,8 +11,6 @@ extern void sub_08018DE8(Entity*);
extern void sub_08018E68(Entity*);
extern void sub_08018F6C(Entity*);
extern u32 sub_08007DD6(u32, const u16*);
extern const u8 gUnk_08003E44[];
void PlayerItemGustBig(Entity* this) {
@@ -40,9 +37,11 @@ static const Hitbox* const gUnk_080B3DE8[] = {
&gUnk_080B3E20,
&gUnk_080B3E28,
};
static const u16 gUnk_080B3DF4[] = {
0x75, 0x1, 0x76, 0x1, 0x3ac, 0x1, 0x4050, 0x1, 0x377, 0x1, 0x378, 0x1, 0x71, 0x1, 0x72, 0x1, 0, 0,
static const KeyValuePair gUnk_080B3DF4[] = {
{ 0x75, 0x1 }, { 0x76, 0x1 }, { 0x3ac, 0x1 }, { 0x4050, 0x1 },
{ 0x377, 0x1 }, { 0x378, 0x1 }, { 0x71, 0x1 }, { 0x72, 0x1 },
};
static const u16 gUnk_080B3DF4End = 0;
static const Hitbox gUnk_080B3E18 = { 0, 0, { 6, 3, 3, 6 }, 6, 6 };
static const Hitbox gUnk_080B3E20 = { 0, 0, { 6, 3, 3, 6 }, 8, 8 };
@@ -161,10 +160,10 @@ void sub_08018E68(Entity* this) {
if (this->type2 == 0) {
sub_0800451C(this);
}
if (sub_08007DD6(sub_080B1A0C(this, x, y), gUnk_080B3DF4) != 0) {
if (FindValueForKey(sub_080B1A0C(this, x, y), gUnk_080B3DF4) != 0) {
return;
}
if (GetRelativeCollisionTile(this, x, y) == 0x74) {
if (GetVvvRelativeToEntity(this, x, y) == 0x74) {
return;
}
if (sub_080040D8(this, (u8*)gUnk_08003E44, this->x.HALF.HI + x, this->y.HALF.HI + y) == 0) {
+4 -4
View File
@@ -122,11 +122,11 @@ void sub_080AD040(PlayerItemHeldObjectEntity* this) {
super->direction = super->knockbackDirection;
super->knockbackDuration = 0;
}
if (GetRelativeCollisionTile(super, gUnk_081320C4[super->direction >> 2],
gUnk_081320C4[(super->direction >> 2) + 1]) == 0x74) {
if (GetVvvRelativeToEntity(super, gUnk_081320C4[super->direction >> 2],
gUnk_081320C4[(super->direction >> 2) + 1]) == 0x74) {
LinearMoveUpdate(super);
} else {
tile = sub_080B1B0C(super);
tile = GetCollisionDataAtEntity(super);
if ((tile != 0x24) && (tile != 0x26)) {
ProcessMovement10(super);
}
@@ -136,7 +136,7 @@ void sub_080AD040(PlayerItemHeldObjectEntity* this) {
(child->base).x = super->x;
(child->base).y = super->y;
(child->base).z = super->z;
tile = GetTileUnderEntity(super);
tile = GetVvvAtEntity(super);
switch (tile) {
case 0xd:
case 0x10:
@@ -109,7 +109,7 @@ void sub_080701F8(Entity* this) {
}
if (sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) == 0) {
if (sub_080040D8(this, &gUnk_08003E44, this->x.HALF.HI, this->y.HALF.HI) == 0) {
if (GetTileUnderEntity(this) == 0x19) {
if (GetVvvAtEntity(this) == 0x19) {
this->action = 4;
COLLISION_OFF(this);
this->x.HALF.HI = (this->x.HALF.HI & 0xfff0) | 8;
+13 -13
View File
@@ -340,35 +340,35 @@ void sub_080A7A54(PlayerItemSwordEntity* this) {
void sub_080A7A84(PlayerItemSwordEntity* this) {
u32 one;
Entity* effect;
s16 new_var;
s16 xOffset;
s32 uVar3;
Entity* new_var2;
Entity* entity;
const s8* ptr;
u32 tmp;
u32 tmp2;
u32 r5;
u32 yOffset;
if ((gPlayerEntity.frame & 0xf) != 0) {
uVar3 = gUnk_08129072[((gPlayerEntity.frame & 0xf) - 1)][0];
one = 1;
r5 = gUnk_08129072[(gPlayerEntity.frame & 0xf) - 1][one];
yOffset = gUnk_08129072[(gPlayerEntity.frame & 0xf) - 1][one];
if (((gPlayerState.sword_state & 0xc0) == 0) && (gPlayerEntity.spriteSettings.flipX == 1)) {
uVar3 = -uVar3;
}
if (super->type != 0) {
sub_08008796(super, 0, super->x.HALF.HI + uVar3, super->y.HALF.HI + r5);
sub_08008796(super, 0, super->x.HALF.HI + uVar3, super->y.HALF.HI + yOffset);
} else if (super->z.WORD == 0) {
if (gPlayerState.skills & SKILL_ROCK_BREAKER) {
tmp2 = 1;
} else {
tmp2 = 0;
}
new_var = uVar3;
if (((sub_08008796(super, tmp2, super->x.HALF.HI + new_var, super->y.HALF.HI + r5) == NULL) &&
xOffset = uVar3;
if (((sub_08008796(super, tmp2, super->x.HALF.HI + xOffset, super->y.HALF.HI + yOffset) == NULL) &&
(gPlayerState.sword_state != 0)) &&
((gPlayerState.sword_state & 0xc0) == 0)) {
new_var2 = super;
if (GetRelativeCollisionTile(new_var2, new_var, r5) == 0x2e) {
entity = super;
if (GetVvvRelativeToEntity(entity, xOffset, yOffset) == 0x2e) {
SoundReqClipped(&gPlayerEntity, SFX_ITEM_GLOVES_KNOCKBACK);
} else {
SoundReqClipped(&gPlayerEntity, SFX_METAL_CLINK);
@@ -376,10 +376,10 @@ void sub_080A7A84(PlayerItemSwordEntity* this) {
effect = CreateObject(SPECIAL_FX, FX_LIGHTNING, 0);
if (effect != NULL) {
ptr = gUnk_0812908E;
effect->x.HALF.HI = new_var2->x.HALF.HI + ptr[new_var2->animationState];
tmp = new_var2->animationState + 1;
effect->y.HALF.HI = new_var2->y.HALF.HI + ptr[tmp];
effect->z = new_var2->z;
effect->x.HALF.HI = entity->x.HALF.HI + ptr[entity->animationState];
tmp = entity->animationState + 1;
effect->y.HALF.HI = entity->y.HALF.HI + ptr[tmp];
effect->z = entity->z;
}
}
}
+99 -84
View File
@@ -79,7 +79,7 @@ InteractableObject* sub_080784E4(void);
u32 sub_08079778(void);
u32 GetPlayerTilePos(void);
extern const u16 gUnk_08007CAC[];
extern const KeyValuePair gMapVvvToSurfaceType[];
u32 sub_0807BEEC(u32 param_1, u32 param_2, u32 param_3);
@@ -107,7 +107,7 @@ extern const u16* sub_0806FC50(u32 param_1, u32 param_2);
bool32 sub_08079F48(u32 param_1, u32 param_2);
extern void FillUnkData3ForLayer(LayerStruct*);
extern void FillVvvForLayer(LayerStruct*);
extern void RenderTilemapToScreenblock(u16*, LayerStruct*);
extern u16 gUnk_080B77C0[];
@@ -140,7 +140,8 @@ void sub_0807C5B0(void);
extern u8 gUnk_080082DC[];
extern u32 sub_08004202(Entity*, u8*, u32);
extern u32 gUnk_02022830[];
// This just reuses the first 12 bytes of gUnk_02022830 to store a MapDataDefinition there temporarily.
extern MapDataDefinition gUnk_02022830;
extern u16* gUnk_0800823C[];
void UpdateActiveItems(PlayerEntity* this) {
@@ -733,7 +734,7 @@ void SurfaceAction_AutoLadder(Entity*);
void SurfaceAction_ClimbWall(Entity*);
void SurfaceAction_2C(Entity*);
void (*const gUnk_0811C120[])(Entity*) = {
void (*const gSurfaceActions[])(Entity*) = {
SurfaceAction_DoNothing,
SurfaceAction_Pit,
NULL,
@@ -782,37 +783,47 @@ void (*const gUnk_0811C120[])(Entity*) = {
SurfaceAction_Dust,
};
const u16 gUnk_0811C240[];
const u16 gUnk_0811C24A[];
const u16 gUnk_0811C254[];
const u16 gUnk_0811C25E[];
const u16 gUnk_0811C1F8[];
const u16 gUnk_0811C20A[];
const u16 gUnk_0811C21C[];
const u16 gUnk_0811C22E[];
const KeyValuePair gUnk_0811C240[];
const KeyValuePair gUnk_0811C24A[];
const KeyValuePair gUnk_0811C254[];
const KeyValuePair gUnk_0811C25E[];
const KeyValuePair gUnk_0811C1F8[];
const KeyValuePair gUnk_0811C20A[];
const KeyValuePair gUnk_0811C21C[];
const KeyValuePair gUnk_0811C22E[];
const u16* const gUnk_0811C1D8[] = {
const KeyValuePair* const gUnk_0811C1D8[] = {
gUnk_0811C240,
gUnk_0811C24A,
gUnk_0811C254,
gUnk_0811C25E,
};
const u16* const gUnk_0811C1E8[] = {
const KeyValuePair* const gUnk_0811C1E8[] = {
gUnk_0811C1F8,
gUnk_0811C20A,
gUnk_0811C21C,
gUnk_0811C22E,
};
const u16 gUnk_0811C1F8[] = { 43, 1, 65, 1, 78, 8, 76, 2, 0 };
const u16 gUnk_0811C20A[] = { 44, 3, 66, 3, 76, 2, 77, 4, 0 };
const u16 gUnk_0811C21C[] = { 42, 5, 64, 5, 79, 6, 77, 4, 0 };
const u16 gUnk_0811C22E[] = { 45, 7, 67, 7, 78, 8, 79, 6, 0 };
const u16 gUnk_0811C240[] = { 42, 1, 38, 1, 0 };
const u16 gUnk_0811C24A[] = { 45, 1, 39, 1, 0 };
const u16 gUnk_0811C254[] = { 43, 1, 38, 1, 0 };
const u16 gUnk_0811C25E[] = { 44, 1, 39, 1, 0 };
const u16 gUnk_0811C268[] = { 16, 1, 90, 1, 17, 1, 19, 1, 0, 0 };
const KeyValuePair gUnk_0811C1F8[] = { { 43, 1 }, { 65, 1 }, { 78, 8 }, { 76, 2 } };
const u16 gUnk_0811C1F8End = 0;
const KeyValuePair gUnk_0811C20A[] = { { 44, 3 }, { 66, 3 }, { 76, 2 }, { 77, 4 } };
const u16 gUnk_0811C20AEnd = 0;
const KeyValuePair gUnk_0811C21C[] = { { 42, 5 }, { 64, 5 }, { 79, 6 }, { 77, 4 } };
const u16 gUnk_0811C21CEnd = 0;
const KeyValuePair gUnk_0811C22E[] = { { 45, 7 }, { 67, 7 }, { 78, 8 }, { 79, 6 } };
const u16 gUnk_0811C22EEnd = 0;
const KeyValuePair gUnk_0811C240[] = { { 42, 1 }, { 38, 1 } };
const u16 gUnk_0811C240End = 0;
const KeyValuePair gUnk_0811C24A[] = { { 45, 1 }, { 39, 1 } };
const u16 gUnk_0811C24AEnd = 0;
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[] = { { 16, 1 }, { 90, 1 }, { 17, 1 }, { 19, 1 } };
const u16 gUnk_0811C268EEnd = 0;
void sub_0807B114(PlayerEntity*);
void sub_0807B128(PlayerEntity*);
void (*const gUnk_0811C27C[])(PlayerEntity*) = {
@@ -1506,7 +1517,7 @@ void ResetPlayerVelocity(void) {
bool32 sub_08078F74(Entity* this) {
if ((gArea.portal_mode == 3) && (gPlayerState.field_0x35 != 0xff)) {
gPlayerState.jump_status = 0x81;
this->action = 0x15;
this->action = PLAYER_USEPORTAL;
this->subAction = 0;
this->zVelocity = Q_16_16(2.0);
return TRUE;
@@ -1734,7 +1745,7 @@ void RespawnPlayer(void) {
index = 0;
if (gPlayerState.path_memory[0] != 0xffffffff) {
ptr1 = gPlayerState.path_memory;
while (GetCollisionData((u16)*ptr1, *ptr1 >> 0x1e) == 0xf) {
while (GetCollisionDataAtMetaTilePos((u16)*ptr1, *ptr1 >> 0x1e) == 0xf) {
ptr1++;
index++;
if ((index > 0xf) || (*ptr1 == -1)) {
@@ -1788,11 +1799,11 @@ bool32 sub_08079550(void) {
tilePos2 = COORD_TO_TILE_OFFSET(&gPlayerEntity, (gPlayerEntity.hitbox)->unk2[2], -ptr[1]);
}
uVar3 = sub_080B1AE0(tilePos1, gPlayerEntity.collisionLayer);
uVar3 = sub_08007DD6(uVar3, gUnk_0811C1E8[gPlayerEntity.animationState >> 1]);
uVar3 = GetVvvAtMetaTilePos(tilePos1, gPlayerEntity.collisionLayer);
uVar3 = FindValueForKey(uVar3, gUnk_0811C1E8[gPlayerEntity.animationState >> 1]);
if (uVar3 != 0) {
uVar3 = sub_080B1AE0(tilePos2, gPlayerEntity.collisionLayer);
uVar3 = sub_08007DD6(uVar3, gUnk_0811C1E8[gPlayerEntity.animationState >> 1]);
uVar3 = GetVvvAtMetaTilePos(tilePos2, gPlayerEntity.collisionLayer);
uVar3 = FindValueForKey(uVar3, gUnk_0811C1E8[gPlayerEntity.animationState >> 1]);
if (uVar3 != 0) {
gPlayerState.pushedObject |= 0x80;
if (gPlayerState.dash_state == 0 && (++gPlayerEntity.subtimer <= 5)) {
@@ -1800,7 +1811,7 @@ bool32 sub_08079550(void) {
}
gPlayerEntity.animationState = uVar3 - 1;
gPlayerEntity.action = 4;
gPlayerEntity.action = PLAYER_JUMP;
gPlayerEntity.subAction = 0;
COLLISION_OFF(&gPlayerEntity);
gPlayerState.jump_status = 0x81;
@@ -1817,7 +1828,7 @@ void sub_08079708(Entity* this) {
gPlayerState.framestate = PL_STATE_DIE;
gPlayerState.field_0x3c = 0xff;
this->flags &= ~ENT_COLLIDE;
this->action = 0xa;
this->action = PLAYER_MINISHDIE;
this->subAction = 0;
sub_080085B0(this);
if ((gPlayerState.flags & (PL_CAPTURED | PL_DISABLE_ITEMS)) == 0) {
@@ -1884,7 +1895,7 @@ void sub_080797EC(void) {
} else {
animation = 0x16c;
if (sub_080793E4(0)) {
if (GetCollisionData(GetPlayerTilePos(), gPlayerEntity.collisionLayer) != 0xff) {
if (GetCollisionDataAtMetaTilePos(GetPlayerTilePos(), gPlayerEntity.collisionLayer) != 0xff) {
gPlayerState.sword_state &= ~8;
animation = 0x170;
}
@@ -1918,7 +1929,8 @@ void sub_080797EC(void) {
} else if (gPlayerState.sword_state != 0) {
animation = 0x16c;
if (sub_080793E4(0)) {
if (GetCollisionData(GetPlayerTilePos(), (u32)gPlayerEntity.collisionLayer) != 0xff) {
if (GetCollisionDataAtMetaTilePos(GetPlayerTilePos(), (u32)gPlayerEntity.collisionLayer) !=
0xff) {
gPlayerState.sword_state &= ~8;
animation = 0x170;
}
@@ -2117,13 +2129,13 @@ bool32 sub_08079C30(Entity* param_1) {
return TRUE;
}
if (gPlayerState.floor_type != sub_08007DD6(GetRelativeCollisionTile(param_1, 0, -1), (u16*)gUnk_08007CAC))
if (gPlayerState.floor_type != FindValueForKey(GetVvvRelativeToEntity(param_1, 0, -1), gMapVvvToSurfaceType))
return FALSE;
if (gPlayerState.floor_type != sub_08007DD6(GetRelativeCollisionTile(param_1, 2, 0), (u16*)gUnk_08007CAC))
if (gPlayerState.floor_type != FindValueForKey(GetVvvRelativeToEntity(param_1, 2, 0), gMapVvvToSurfaceType))
return FALSE;
if (gPlayerState.floor_type == sub_08007DD6(GetRelativeCollisionTile(param_1, -2, 0), (u16*)gUnk_08007CAC)) {
if (gPlayerState.floor_type == FindValueForKey(GetVvvRelativeToEntity(param_1, -2, 0), gMapVvvToSurfaceType)) {
return TRUE;
}
}
@@ -2135,7 +2147,7 @@ bool32 sub_08079D48(void) {
return TRUE;
} else {
if (!PlayerCheckNEastTile()) {
if (!sub_08007DD6((u16)GetTileUnderEntity(&gPlayerEntity), gUnk_0811C268)) {
if (!FindValueForKey((u16)GetVvvAtEntity(&gPlayerEntity), gUnk_0811C268)) {
return TRUE;
}
}
@@ -2205,13 +2217,13 @@ bool32 sub_08079E90(u32 param_1) {
tmp1 = -gPlayerEntity.hitbox->unk2[3];
}
}
if (!sub_08079F48(param_1, sub_080B1AF0(&gPlayerEntity, tmp2, tmp1))) {
if (!sub_08079F48(param_1, GetCollisionDataRelativeTo(&gPlayerEntity, tmp2, tmp1))) {
if ((gPlayerEntity.direction & DirectionSouth) != 0) {
tmp1 = -tmp1;
} else {
tmp2 = -tmp2;
}
if (!sub_08079F48(param_1, sub_080B1AF0(&gPlayerEntity, tmp2, tmp1))) {
if (!sub_08079F48(param_1, GetCollisionDataRelativeTo(&gPlayerEntity, tmp2, tmp1))) {
return FALSE;
}
}
@@ -2351,7 +2363,7 @@ void sub_0807A180(Entity* param_1, u32 param_2, u32 param_3, u32 param_4) {
void UpdateFloorType(void) {
gPlayerState.floor_type = GetSurfaceCalcType(&gPlayerEntity, 0, 0);
gUnk_0811C120[gPlayerState.floor_type](&gPlayerEntity);
gSurfaceActions[gPlayerState.floor_type](&gPlayerEntity);
}
SurfaceType GetSurfaceCalcType(Entity* param_1, s32 x, s32 y) {
@@ -2373,8 +2385,8 @@ SurfaceType GetSurfaceCalcType(Entity* param_1, s32 x, s32 y) {
gPlayerState.surfaceTimer++;
}
gPlayerState.floor_type_last = gPlayerState.floor_type;
tileType = GetRelativeCollisionTile(param_1, x, y);
return sub_08007DD6(tileType, (u16*)gUnk_08007CAC);
tileType = GetVvvRelativeToEntity(param_1, x, y);
return FindValueForKey(tileType, gMapVvvToSurfaceType);
}
void EnablePlayerDraw(Entity* this) {
@@ -2474,7 +2486,8 @@ void sub_0807A750(u32 param_1, u32 param_2, const u8* param_3, u32 param_4) {
index = param_1 % 16;
}
if ((index != 0) && (index != 0xf)) {
uVar2 = GetCollisionData((param_1 >> 4 & 0x3f) | (param_2 >> 4 & 0x3f) << 6, gPlayerEntity.collisionLayer);
uVar2 = GetCollisionDataAtMetaTilePos((param_1 >> 4 & 0x3f) | (param_2 >> 4 & 0x3f) << 6,
gPlayerEntity.collisionLayer);
if (uVar2 > 0xf) {
if (uVar2 != 0xff) {
uVar2 = param_3[uVar2 - 0x10];
@@ -2531,7 +2544,7 @@ void sub_0807A750(u32 param_1, u32 param_2, const u8* param_3, u32 param_4) {
}
}
u32 GetCollisionTileInFront(Entity* this) {
u32 GetVvvInFront(Entity* this) {
s32 x;
s32 y;
switch (this->direction) {
@@ -2556,7 +2569,7 @@ u32 GetCollisionTileInFront(Entity* this) {
x = 0;
break;
}
return GetRelativeCollisionTile(this, x, y);
return GetVvvRelativeToEntity(this, x, y);
}
void nullsub_505(void) {
@@ -2657,7 +2670,7 @@ bool32 sub_0807AC54(Entity* this) {
this->x.HALF.HI = (this->x.HALF.HI & 0xfff0) | 8;
// fallthrough
case SURFACE_CLIMB_WALL:
this->action = 0x1d;
this->action = PLAYER_CLIMB;
this->subAction = 0;
this->y.HALF.LO = 0;
gPlayerState.animation = 0x2cf;
@@ -2666,7 +2679,7 @@ bool32 sub_0807AC54(Entity* this) {
this->x.HALF.HI = (this->x.HALF.HI & 0xfff0) | 8;
// fallthrough
case SURFACE_2C:
this->action = 0x1d;
this->action = PLAYER_CLIMB;
this->subAction = 1;
this->y.HALF.LO = 0;
return TRUE;
@@ -2733,7 +2746,8 @@ bool32 ToggleDiving(Entity* this) {
}
void PlayerUpdateSwimming(Entity* this) {
if ((((this->action != 0x17) || (gPlayerState.field_0xa == 0)) && (gRoomControls.reload_flags == 0)) &&
if ((((this->action != PLAYER_ROOMTRANSITION) || (gPlayerState.field_0xa == 0)) &&
(gRoomControls.reload_flags == 0)) &&
((gPlayerState.playerInput.newInput & PLAYER_INPUT_8) != 0)) {
if (GetInventoryValue(ITEM_SWIM_BUTTERFLY) == 1) {
this->speed = 0x1c0;
@@ -2975,7 +2989,7 @@ void SetTileType(u32 tileType, u32 position, u32 layer) {
if ((gRoomControls.scroll_flags & 2) != 0) {
gMapBottom.collisionData[position] = collisionData;
}
data->unkData3[position] = gUnk_080B37A0[tileType];
data->vvv[position] = gUnk_080B37A0[tileType];
if ((gRoomControls.scroll_flags & 1) == 0) {
u32 offset = (position & 0x3f) * 2 + (position & 0xfc0) * 4;
if (layer != 2) {
@@ -3000,18 +3014,18 @@ void SetTileType(u32 tileType, u32 position, u32 layer) {
}
}
bool32 sub_0807B434(u32 position, u32 layer) {
switch (GetTileType(position, layer)) {
bool32 sub_0807B434(u32 metaTilePos, u32 layer) {
switch (GetTileType(metaTilePos, layer)) {
case 0x36:
case 0x37:
return FALSE;
default:
return sub_080B1AE0(position, layer) != 0xd;
return GetVvvAtMetaTilePos(metaTilePos, layer) != 0xd;
}
}
bool32 sub_0807B464(u32 param_1, u32 param_2) {
return sub_080B1AE0(param_1, param_2) == 0x56;
bool32 sub_0807B464(u32 metaTilePos, u32 layer) {
return GetVvvAtMetaTilePos(metaTilePos, layer) == 0x56;
}
void sub_0807B480(u32 tilePos, u32 param_2) {
@@ -3073,7 +3087,7 @@ u32 sub_0807B600(u32 param_1) {
u32 tile;
tile = param_1 - 0x40;
if (sub_080B1AE0(param_1, 1) != 0x56) {
if (GetVvvAtMetaTilePos(param_1, 1) != 0x56) {
return FALSE;
} else {
tileType = GetTileType(param_1, 1);
@@ -3092,10 +3106,10 @@ u32 sub_0807B600(u32 param_1) {
} else {
if (GetTileType(param_1, 2) != 0) {
SetTileType(0x2f2, param_1, 1);
if (GetCollisionData(tile, 1) == 3) {
if (GetCollisionDataAtMetaTilePos(tile, 1) == 3) {
SetTileType(0x2f4, tile, 1);
}
if (GetCollisionData(param_1 + 0x40, 1) == 3) {
if (GetCollisionDataAtMetaTilePos(param_1 + 0x40, 1) == 3) {
SetTileType(0x2f4, param_1, 1);
}
} else {
@@ -3121,7 +3135,7 @@ u32 sub_0807B600(u32 param_1) {
void sub_0807B778(u32 position, u32 layer) {
u32 tmp;
if (sub_080B1AE0(position, layer) == 0xd) {
if (GetVvvAtMetaTilePos(position, layer) == 0xd) {
tmp = sub_0807B434(position - 0x40, layer);
tmp |= sub_0807B434(position + 1, layer) << 1;
tmp |= sub_0807B434(position + 0x40, layer) << 2;
@@ -3190,7 +3204,7 @@ void SetMetaTileByIndex(u32 tileIndex, u32 position, u32 layer) {
data->mapData[position] = tileIndex;
tileType = data->metatileTypes[tileIndex];
data->collisionData[position] = gUnk_080B3E80[tileType];
data->unkData3[position] = gUnk_080B37A0[tileType];
data->vvv[position] = gUnk_080B37A0[tileType];
if ((gRoomControls.scroll_flags & 1) == 0) {
u32 offset = (position & 0x3f) * 2 + (position & 0xfc0) * 4;
if (layer != 2) {
@@ -3221,7 +3235,7 @@ void RestorePrevTileEntity(u32 position, u32 layer) {
data->mapData[position] = tileIndex = data->mapDataClone[position];
tileType = data->metatileTypes[tileIndex];
data->collisionData[position] = gUnk_080B3E80[tileType];
data->unkData3[position] = gUnk_080B37A0[tileType];
data->vvv[position] = gUnk_080B37A0[tileType];
if ((gRoomControls.scroll_flags & 1) == 0) {
u32 offset = (position & 0x3f) * 2 + (position & 0xfc0) * 4;
if (layer != 2) {
@@ -3517,18 +3531,18 @@ void LoadRoomGfx(void) {
MemCopy(gMapBottom.mapData, gMapBottom.mapDataClone, sizeof(gMapBottom.mapData));
MemCopy(gMapTop.mapData, gMapTop.mapDataClone, sizeof(gMapBottom.mapData));
} else if (gRoomTransition.field_0x2c[0] == 2) {
MemCopy(gMapBottom.mapData, gMapBottom.unkData3, 0x1000);
MemCopy(gMapBottom.mapData, gMapBottom.vvv, 0x1000);
MemCopy(gMapBottom.mapDataClone, gMapBottom.mapData, 0x1000);
MemCopy(gMapBottom.unkData3, gMapBottom.mapDataClone, 0x1000);
MemCopy(gMapBottom.mapData + 0x800, gMapBottom.unkData3, 0x1000);
MemCopy(gMapBottom.vvv, gMapBottom.mapDataClone, 0x1000);
MemCopy(gMapBottom.mapData + 0x800, gMapBottom.vvv, 0x1000);
MemCopy(gMapBottom.mapDataClone + 0x800, gMapBottom.mapData + 0x800, 0x1000);
MemCopy(gMapBottom.unkData3, gMapBottom.mapDataClone + 0x800, 0x1000);
MemCopy(gMapTop.mapData, gMapTop.unkData3, 0x1000);
MemCopy(gMapBottom.vvv, gMapBottom.mapDataClone + 0x800, 0x1000);
MemCopy(gMapTop.mapData, gMapTop.vvv, 0x1000);
MemCopy(gMapTop.mapDataClone, gMapTop.mapData, 0x1000);
MemCopy(gMapTop.unkData3, gMapTop.mapDataClone, 0x1000);
MemCopy(gMapTop.mapData + 0x800, gMapTop.unkData3, 0x1000);
MemCopy(gMapTop.vvv, gMapTop.mapDataClone, 0x1000);
MemCopy(gMapTop.mapData + 0x800, gMapTop.vvv, 0x1000);
MemCopy(gMapTop.mapDataClone + 0x800, gMapTop.mapData + 0x800, 0x1000);
MemCopy(gMapTop.unkData3, gMapTop.mapDataClone + 0x800, 0x1000);
MemCopy(gMapTop.vvv, gMapTop.mapDataClone + 0x800, 0x1000);
}
if (!clearBottomMap) {
sub_0807BBE4();
@@ -3538,8 +3552,8 @@ void LoadRoomGfx(void) {
sub_0807C460();
}
CreateCollisionDataBorderAroundRoom();
FillUnkData3ForLayer(&gMapBottom);
FillUnkData3ForLayer(&gMapTop);
FillVvvForLayer(&gMapBottom);
FillVvvForLayer(&gMapTop);
if (!clearBottomMap) {
// Render the complete bottom and top metatilemaps into the tilemaps.
RenderTilemapToScreenblock((u16*)&gMapDataBottomSpecial, &gMapBottom);
@@ -3627,26 +3641,27 @@ void sub_0807C460(void) {
}
void sub_0807C4F8(void) {
// TODO convert to MapDataDefinition*
u32* puVar1;
u32* ptr;
MapDataDefinition* ptr1;
MapDataDefinition* ptr2;
if (gRoomControls.area != AREA_PALACE_OF_WINDS_BOSS) {
MemClear(gMapDataBottomSpecial, 0x8000);
MemClear(gMapDataTopSpecial, 0x8000);
ptr = gUnk_02022830;
puVar1 = (u32*)(gArea.pCurrentRoomInfo)->map;
puVar1 -= 3;
ptr1 = &gUnk_02022830;
ptr2 = (MapDataDefinition*)(gArea.pCurrentRoomInfo)->map;
ptr2 -= 1;
do {
puVar1 += 3;
if (((u16*)puVar1[1] == gMapDataBottomSpecial) || ((u16*)puVar1[1] == (u16*)&gMapDataTopSpecial)) {
// only store the map data definitions for bitmap backgrounds in gUnk_02022830?
ptr[0] = puVar1[0] & 0x7fffffff;
ptr[1] = puVar1[1];
ptr[2] = puVar1[2];
LoadMapData((MapDataDefinition*)ptr);
ptr2 += 1;
// TODO why does this not match with ptr2->dest?
if (((u16*)((u32*)ptr2)[1] == gMapDataBottomSpecial) ||
((u16*)((u32*)ptr2)[1] == (u16*)&gMapDataTopSpecial)) {
// only load the map data definitions for bitmap backgrounds?
ptr1->src = ptr2->src & 0x7fffffff;
ptr1->dest = ptr2->dest;
ptr1->size = ptr2->size;
LoadMapData(ptr1);
}
} while ((s32)*puVar1 < 0);
} while ((s32)ptr2->src < 0);
MemCopy(gMapDataBottomSpecial, gMapDataBottomSpecial + 0x2000, 0x4000);
sub_0807C5F4(gMapDataBottomSpecial, gMapDataBottomSpecial + 0x2000);
+3 -2
View File
@@ -4,7 +4,7 @@
#include "room.h"
#include "physics.h"
extern u32 GetCollisionData(u32, u32);
extern u32 GetCollisionDataAtMetaTilePos(u32, u32);
extern void (*const Projectile5_Functions[])(Entity*);
extern void (*const Projectile5_Actions[])(Entity*);
@@ -28,7 +28,8 @@ void sub_080A86F0(Entity* this) {
pbVar2 = &this->parent->field_0x82.HALF.HI;
if ((this->parent->field_0x82.HALF.HI & 0x3f) == 3) {
if (gPlayerState.hurtBlinkSpeed != 0) {
if (GetCollisionData(TILE(this->x.HALF.HI, this->y.HALF.HI), gPlayerEntity.collisionLayer) == 0) {
if (GetCollisionDataAtMetaTilePos(TILE(this->x.HALF.HI, this->y.HALF.HI),
gPlayerEntity.collisionLayer) == 0) {
if (this->contactFlags == 0x80) {
*pbVar2 = *pbVar2 & 0x7f;
DeleteThisEntity();
+3 -5
View File
@@ -5,8 +5,6 @@
#include "object.h"
#include "room.h"
extern u32 sub_080B1AE0(u16, u8);
extern void (*const RemovableDust_Functions[])(Entity*);
extern const u16 gUnk_08129FD0[];
extern const u16 gUnk_08129FE4[];
@@ -88,7 +86,7 @@ void sub_080AA534(Entity* this) {
void sub_080AA544(Entity* this) {
u8* pbVar1;
s32 iVar2;
s32 vvv;
u32 uVar3;
s32 iVar4;
const u16* puVar5;
@@ -101,8 +99,8 @@ void sub_080AA544(Entity* this) {
uVar3 = 0;
iVar4 = 0;
do {
iVar2 = sub_080B1AE0((param - tmp[uVar3]) & 0xffff, this->collisionLayer);
if (iVar2 == 0x3e) {
vvv = GetVvvAtMetaTilePos((param - tmp[uVar3]) & 0xffff, this->collisionLayer);
if (vvv == 0x3e) {
iVar4++;
}
uVar3++;
+2 -2
View File
@@ -158,7 +158,7 @@ void SpiderWeb_SubAction0(Entity* this) {
if (tmp * 2 - entity->animationState == 0) {
x = gUnk_0812A064[tmp * 2] + this->x.HALF.HI;
y = gUnk_0812A064[tmp * 2 + 1] + this->y.HALF.HI;
if (sub_080B1B18(x, y, entity->collisionLayer) == 0) {
if (GetCollisionDataAtWorldCoords(x, y, entity->collisionLayer) == 0) {
entity->x.HALF.HI = x;
entity->y.HALF.HI = y;
}
@@ -225,7 +225,7 @@ void sub_080AA9E0(Entity* this) {
}
void sub_080AAA68(Entity* this) {
static const u16 typeTiles[] = { 16419, 16421, 16422, 16420 };
static const u16 typeTiles[] = { 0x4023, 0x4025, 0x4026, 0x4024 };
SetTile(typeTiles[this->type], TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer);
}
+18 -17
View File
@@ -28,8 +28,8 @@ extern void sub_0805E248();
extern u8 gUpdateVisibleTiles;
extern u16 gUnk_0200B640;
extern MapDataDefinition** gCaveBorderMapData[];
extern u32 gUnk_02022830[];
extern u16 gUnk_020246B0[];
extern u16 gUnk_02022830[0xc00];
extern u16 gUnk_020246B0[0xc00];
extern u8 gUnk_080B7910[];
void Scroll0(RoomControls*);
@@ -54,7 +54,7 @@ u32 sub_080803D0();
u32 sub_08080278();
void sub_08080C80(MapDataDefinition*);
void sub_08080368();
void FillUnkData3ForLayer(LayerStruct*);
void FillVvvForLayer(LayerStruct*);
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);
@@ -357,8 +357,8 @@ void Scroll5Sub3(RoomControls* controls) {
sub_08080368();
gUnk_02034480.unk_00 = gUnk_0200B640;
MemCopy(gUnk_02022830, gUnk_020246B0, 0x1800);
FillUnkData3ForLayer(&gMapBottom);
FillUnkData3ForLayer(&gMapTop);
FillVvvForLayer(&gMapBottom);
FillVvvForLayer(&gMapTop);
sub_0807BBE4();
CreateCollisionDataBorderAroundRoom();
sub_0805E248();
@@ -435,7 +435,7 @@ u32 sub_08080278(void) {
u16* ptr1;
u32 tmp;
ptr1 = (u16*)gUnk_02022830;
ptr1 = gUnk_02022830;
width = gRoomControls.width >> 4;
height = (gRoomControls.height >> 4) << 6;
result = 0;
@@ -803,9 +803,10 @@ void UpdateDoorTransition() {
case 0x1d:
uVar4 = controls->camera_target->y.HALF.HI - controls->origin_y;
uVar3 = controls->camera_target->x.HALF.HI - controls->origin_x;
uVar1 = sub_080B1AE0((((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);
uVar1 = GetVvvAtMetaTilePos(
(((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(uVar3, uVar4, controls->camera_target->collisionLayer);
switch (uVar1) {
case 0x3f:
@@ -818,19 +819,19 @@ void UpdateDoorTransition() {
}
}
// fill the unkData3 for the whole layer
void FillUnkData3ForLayer(LayerStruct* layer) {
u32 index;
// fill the vvv for the whole layer
void FillVvvForLayer(LayerStruct* layer) {
u32 metaTilePos;
u16* metatileTypes = layer->metatileTypes;
const u8* ptr = gUnk_080B37A0;
u8* ptr3 = layer->unkData3;
u8* ptr3 = layer->vvv;
u16* mapData = layer->mapData;
for (index = 0; index < 0x1000; index++) {
u16 metaTileIndex = mapData[index];
for (metaTilePos = 0; metaTilePos < 0x40 * 0x40; metaTilePos++) {
u16 metaTileIndex = mapData[metaTilePos];
if (metaTileIndex < 0x4000) {
layer->unkData3[index] = ptr[metatileTypes[metaTileIndex]];
layer->vvv[metaTilePos] = ptr[metatileTypes[metaTileIndex]];
} else {
layer->unkData3[index] = gUnk_080B7910[metaTileIndex - 0x4000];
layer->vvv[metaTilePos] = gUnk_080B7910[metaTileIndex - 0x4000];
}
}
}