mirror of https://github.com/zeldaret/tmc.git
Merge branch 'master' into tilemap-docs
This commit is contained in:
commit
c3b771a209
|
@ -1,6 +1,21 @@
|
|||
.ifndef GUARD_ASM_MACROS_MAP_INC
|
||||
.set GUARD_ASM_MACROS_MAP_INC, 1
|
||||
|
||||
.set TOP_TILEDATA, gMapTop+0x4
|
||||
.set TOP_COLLISIONDATA, gMapTop+0x2004
|
||||
.set TOP_TILEDATACLONE, gMapTop+0x3004
|
||||
.set TOP_METATILETYPES, gMapTop+0x5004
|
||||
.set TOP_UNKDATA2, gMapTop+0x6004
|
||||
.set TOP_METATILES, gMapTop+0x7004
|
||||
.set TOP_UNKDATA3, gMapTop+0xb004
|
||||
.set BOTTOM_TILEDATA, gMapBottom+0x4
|
||||
.set BOTTOM_COLLISIONDATA, gMapBottom+0x2004
|
||||
.set BOTTOM_TILEDATACLONE, gMapBottom+0x3004
|
||||
.set BOTTOM_METATILETYPES, gMapBottom+0x5004
|
||||
.set BOTTOM_UNKDATA2, gMapBottom+0x6004
|
||||
.set BOTTOM_METATILES, gMapBottom+0x7004
|
||||
.set BOTTOM_UNKDATA3, gMapBottom+0xb004
|
||||
|
||||
.macro room_header map_x, map_y, pixel_width, pixel_height, tileset_id
|
||||
.2byte (\map_x) << 4
|
||||
.2byte (\map_y) << 4
|
||||
|
|
|
@ -931,8 +931,8 @@ _0800271A:
|
|||
bne _0800270A
|
||||
pop {r4, r5, r6, pc}
|
||||
|
||||
thumb_func_start sub_08002724
|
||||
sub_08002724: @ 0x08002724
|
||||
thumb_func_start UnpackTextNibbles
|
||||
UnpackTextNibbles: @ 0x08002724
|
||||
push {r4, r5, lr}
|
||||
movs r2, #0x10
|
||||
movs r3, #0xf
|
||||
|
@ -1019,24 +1019,25 @@ _080027E6:
|
|||
movs r0, #4
|
||||
bx lr
|
||||
|
||||
// almost identical to LinearMoveDirection
|
||||
// r0 = Entity*
|
||||
// r1 = speed
|
||||
// r2 = direction
|
||||
non_word_aligned_thumb_func_start sub_080027EA
|
||||
sub_080027EA: @ 0x080027EA
|
||||
non_word_aligned_thumb_func_start LinearMoveDirectionOLD
|
||||
LinearMoveDirectionOLD: @ 0x080027EA
|
||||
push {r4, r5, r6, r7, lr}
|
||||
movs r3, #0x80
|
||||
tst r2, r3
|
||||
bne _08002860
|
||||
movs r4, #0x2a
|
||||
ldrh r3, [r0, r4]
|
||||
ldrh r3, [r0, r4] // collisions
|
||||
movs r4, #7
|
||||
tst r2, r4
|
||||
bne _08002812
|
||||
push {r0, r1, r2, r3}
|
||||
adds r0, r2, #0
|
||||
adds r1, r3, #0
|
||||
bl sub_08002864
|
||||
bl CalcCollisionDirectionOLD
|
||||
adds r4, r0, #0
|
||||
pop {r0, r1, r2, r3}
|
||||
cmp r2, r4
|
||||
|
@ -1063,7 +1064,7 @@ _08002812:
|
|||
_08002834:
|
||||
adds r4, r0, #0
|
||||
pop {r0, r1, r2, r3}
|
||||
ldr r5, [r0, #0x2c]
|
||||
ldr r5, [r0, #0x2c] // x
|
||||
adds r5, r5, r4
|
||||
str r5, [r0, #0x2c]
|
||||
_0800283E:
|
||||
|
@ -1081,15 +1082,16 @@ _0800283E:
|
|||
_08002856:
|
||||
adds r4, r0, #0
|
||||
pop {r0, r1, r2, r3}
|
||||
ldr r5, [r0, #0x30]
|
||||
ldr r5, [r0, #0x30] // y
|
||||
subs r5, r5, r4
|
||||
str r5, [r0, #0x30]
|
||||
_08002860:
|
||||
adds r1, r6, #0
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
|
||||
thumb_func_start sub_08002864
|
||||
sub_08002864: @ 0x08002864
|
||||
// collision related, probably leftover from FS
|
||||
thumb_func_start CalcCollisionDirectionOLD
|
||||
CalcCollisionDirectionOLD: @ 0x08002864
|
||||
adds r2, r0, #0
|
||||
lsrs r2, r2, #3
|
||||
cmp r2, #0
|
||||
|
|
|
@ -258,17 +258,17 @@ _08004162:
|
|||
ands r2, r4
|
||||
pop {r4, pc}
|
||||
|
||||
thumb_func_start sub_08004168
|
||||
sub_08004168: @ 0x08004168
|
||||
thumb_func_start SnapToTile
|
||||
SnapToTile: @ 0x08004168
|
||||
ldr r3, _08004384 @ =0x000FFFFF
|
||||
ldr r1, _08004388 @ =0x00080000
|
||||
ldr r2, [r0, #0x2c]
|
||||
bics r2, r3
|
||||
adds r2, r2, r1
|
||||
ldr r2, [r0, #0x2c] // x
|
||||
bics r2, r3 // align to grid
|
||||
adds r2, r1 // add half of a tile
|
||||
str r2, [r0, #0x2c]
|
||||
ldr r2, [r0, #0x30]
|
||||
ldr r2, [r0, #0x30] // y
|
||||
bics r2, r3
|
||||
adds r2, r2, r1
|
||||
adds r2, r1
|
||||
str r2, [r0, #0x30]
|
||||
bx lr
|
||||
|
||||
|
@ -348,8 +348,8 @@ sub_080041E8: @ 0x080041E8
|
|||
subs r0, r0, r2
|
||||
subs r1, r1, r3
|
||||
|
||||
thumb_func_start sub_080041EC
|
||||
sub_080041EC: @ 0x080041EC
|
||||
thumb_func_start CalcDistance
|
||||
CalcDistance: @ 0x080041EC
|
||||
adds r2, r0, #0
|
||||
muls r0, r2, r0
|
||||
adds r3, r1, #0
|
||||
|
@ -621,26 +621,26 @@ _0800439C: .4byte gSpritePtrs
|
|||
_080043A0: .4byte gSpritePtrs
|
||||
_080043A4: .4byte gGFXSlots+4
|
||||
|
||||
thumb_func_start sub_080043A8
|
||||
sub_080043A8: @ 0x080043A8
|
||||
movs r1, #0xb
|
||||
b _080043B6
|
||||
thumb_func_start CreateDrownFX
|
||||
CreateDrownFX: @ 0x080043A8
|
||||
movs r1, #0xb // FX_WATER_SPLASH
|
||||
b create_fx
|
||||
|
||||
thumb_func_start CreateChestSpawner
|
||||
CreateChestSpawner: @ 0x080043AC
|
||||
movs r1, #0xc
|
||||
b _080043B6
|
||||
thumb_func_start CreateLavaDrownFX
|
||||
CreateLavaDrownFX: @ 0x080043AC
|
||||
movs r1, #0xc // FX_LAVA_SPLASH
|
||||
b create_fx
|
||||
|
||||
thumb_func_start sub_080043B0
|
||||
sub_080043B0: @ 0x080043AC
|
||||
movs r1, #0x52
|
||||
b _080043B6
|
||||
thumb_func_start CreateSwampDrownFX
|
||||
CreateSwampDrownFX: @ 0x080043AC
|
||||
movs r1, #0x52 // FX_GREEN_SPLASH
|
||||
b create_fx
|
||||
|
||||
thumb_func_start CreateItemOnGround
|
||||
CreateItemOnGround: @ 0x080043B4
|
||||
movs r1, #0
|
||||
thumb_func_start CreatePitFallFX
|
||||
CreatePitFallFX: @ 0x080043B4
|
||||
movs r1, #0 // FX_FALL_DOWN
|
||||
|
||||
_080043B6:
|
||||
create_fx:
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
movs r0, #0xf
|
||||
|
@ -648,10 +648,10 @@ _080043B6:
|
|||
bl CreateObject
|
||||
|
||||
cmp r0, #0
|
||||
beq _080043E0 @ Branch if entity could not be created
|
||||
beq _080043E0
|
||||
|
||||
movs r1, #0x48
|
||||
ldr r1, [r4, r1] @ Unused?
|
||||
ldr r1, [r4, r1] // load hitbox (unused)
|
||||
|
||||
ldrh r3, [r4, #0x2e]
|
||||
strh r3, [r0, #0x2e]
|
||||
|
@ -664,11 +664,11 @@ _080043B6:
|
|||
|
||||
ldrb r3, [r4, #8]
|
||||
|
||||
cmp r3, #3 @ Is the spawner an enemy?
|
||||
cmp r3, #3 // is parent entity an enemy?
|
||||
bne _080043E0
|
||||
|
||||
movs r1, #1
|
||||
strb r1, [r0, #0xb] @ Set base parameter
|
||||
strb r1, [r0, #0xb] // copy entity.type2
|
||||
|
||||
_080043E0:
|
||||
adds r0, r4, #0
|
||||
|
|
|
@ -5,57 +5,67 @@
|
|||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_080043E8
|
||||
sub_080043E8: @ 0x080043E8
|
||||
.macro hazard_tile tile:req, hazard_type:req
|
||||
.short \tile
|
||||
.short \hazard_type
|
||||
.endm
|
||||
|
||||
thumb_func_start GetTileHazardType
|
||||
GetTileHazardType: @ 0x080043E8
|
||||
push {r4, lr}
|
||||
ldrb r1, [r0, #0xc]
|
||||
cmp r1, #0
|
||||
beq _08004414
|
||||
beq no_hazard // action == 0
|
||||
adds r4, r0, #0
|
||||
bl sub_08016AD2
|
||||
bl UpdateCollisionLayer
|
||||
movs r3, #0x36
|
||||
ldrsh r2, [r4, r3]
|
||||
cmp r2, #0
|
||||
bmi _08004414
|
||||
cmp r0, #0
|
||||
beq _08004414
|
||||
add r3, pc, #0x10
|
||||
_08004404:
|
||||
bmi no_hazard // collisionLayer is negative
|
||||
cmp r0, #0 // are we on a tile?
|
||||
beq no_hazard
|
||||
adr r3, hazard_list-4
|
||||
loop:
|
||||
adds r3, #4
|
||||
ldrh r1, [r3]
|
||||
cmp r1, #0
|
||||
beq _08004414
|
||||
beq no_hazard
|
||||
cmp r0, r1
|
||||
bne _08004404
|
||||
bne loop
|
||||
ldrh r0, [r3, #2]
|
||||
pop {r4, pc}
|
||||
_08004414:
|
||||
no_hazard:
|
||||
movs r0, #0
|
||||
pop {r4, pc}
|
||||
_08004418:
|
||||
.byte 0x0D, 0x00, 0x01, 0x00, 0x10, 0x00, 0x02, 0x00
|
||||
.byte 0x11, 0x00, 0x02, 0x00, 0x5A, 0x00, 0x03, 0x00, 0x13, 0x00, 0x04, 0x00, 0x00, 0x00
|
||||
|
||||
hazard_list:
|
||||
hazard_tile 0xD, 0x1
|
||||
hazard_tile 0x10, 0x2
|
||||
hazard_tile 0x11, 0x2
|
||||
hazard_tile 0x5A, 0x3
|
||||
hazard_tile 0x13, 0x4
|
||||
.short 0x0000
|
||||
|
||||
non_word_aligned_thumb_func_start sub_0800442E
|
||||
sub_0800442E: @ 0x0800442E
|
||||
push {r0, lr}
|
||||
bl sub_080043E8
|
||||
bl GetTileHazardType
|
||||
cmp r0, #0
|
||||
beq _08004448
|
||||
lsls r0, r0, #2
|
||||
add r1, pc, #0xC
|
||||
beq not_hazard
|
||||
lsls r0, #2
|
||||
adr r1, _0800444C - 4
|
||||
ldr r1, [r1, r0]
|
||||
pop {r0}
|
||||
bl _call_via_r1
|
||||
movs r0, #1
|
||||
pop {pc}
|
||||
_08004448:
|
||||
not_hazard:
|
||||
movs r0, #0
|
||||
pop {r1, pc}
|
||||
_0800444C: .4byte CreateItemOnGround
|
||||
_08004450: .4byte sub_080043A8
|
||||
_08004454: .4byte CreateChestSpawner
|
||||
_08004458: .4byte sub_080043B0
|
||||
_0800444C: .4byte CreatePitFallFX
|
||||
_08004450: .4byte CreateDrownFX
|
||||
_08004454: .4byte CreateLavaDrownFX
|
||||
_08004458: .4byte CreateSwampDrownFX
|
||||
|
||||
thumb_func_start sub_0800445C
|
||||
sub_0800445C: @ 0x0800445C
|
||||
|
@ -67,7 +77,7 @@ sub_0800445C: @ 0x0800445C
|
|||
ldr r5, _080044D8 @ =gPlayerEntity
|
||||
adds r0, r4, #0
|
||||
adds r1, r5, #0
|
||||
bl sub_08004484
|
||||
bl CalcCollisionStaticEntity
|
||||
cmp r0, #0
|
||||
beq _08004482
|
||||
ldrb r0, [r5, #0xc]
|
||||
|
@ -80,8 +90,8 @@ _08004480:
|
|||
_08004482:
|
||||
pop {r4, r5, pc}
|
||||
|
||||
thumb_func_start sub_08004484
|
||||
sub_08004484: @ 0x08004484
|
||||
thumb_func_start CalcCollisionStaticEntity
|
||||
CalcCollisionStaticEntity: @ 0x08004484
|
||||
ldr r2, _080044DC @ =ram_sub_080B227C
|
||||
bx r2
|
||||
|
||||
|
@ -138,35 +148,40 @@ _080044E0: .4byte gUnk_02024048
|
|||
_080044E4: .4byte gUnk_02021F20
|
||||
_080044E8: .4byte gPlayerEntity
|
||||
|
||||
thumb_func_start sub_080044EC
|
||||
sub_080044EC: @ 0x080044EC
|
||||
// BounceUpdate
|
||||
// assumes initial velocity is set
|
||||
// r0: entity*
|
||||
// r1: acceleration
|
||||
thumb_func_start BounceUpdate
|
||||
BounceUpdate: @ 0x080044EC
|
||||
ldr r2, [r0, #0x34]
|
||||
ldr r3, [r0, #0x20]
|
||||
subs r2, r2, r3
|
||||
bpl _080044FE
|
||||
str r2, [r0, #0x34]
|
||||
subs r3, r3, r1
|
||||
str r3, [r0, #0x20]
|
||||
movs r0, #2
|
||||
subs r2, r3
|
||||
bpl grounded // if z is positive, entity is grounded
|
||||
str r2, [r0, #0x34] // entity.z = entity.z - entity.zVelocity
|
||||
subs r3, r1
|
||||
str r3, [r0, #0x20] // entity.zVelocity = entity.zVelocity - acceleration
|
||||
movs r0, #2 // return 2
|
||||
bx lr
|
||||
_080044FE:
|
||||
grounded:
|
||||
movs r2, #1
|
||||
str r2, [r0, #0x34]
|
||||
subs r3, r3, r1
|
||||
rsbs r3, r3, #0
|
||||
lsrs r3, r3, #1
|
||||
str r2, [r0, #0x34] // entity.z = 1 (note: player cant do certain actions at z!=0)
|
||||
subs r3, r1
|
||||
negs r3, r3
|
||||
lsrs r3, #1
|
||||
lsrs r1, r3, #2
|
||||
adds r3, r3, r1
|
||||
adds r3, r1 // calc next bounce velocity
|
||||
lsrs r1, r3, #0xc
|
||||
cmp r1, #0xc
|
||||
bhs _08004516
|
||||
movs r2, #0
|
||||
movs r3, #0
|
||||
bhs _08004516 // return 1 if bouncing
|
||||
movs r2, #0 // return 0 if not bouncing
|
||||
movs r3, #0 // set velocity to 0
|
||||
_08004516:
|
||||
str r3, [r0, #0x20]
|
||||
adds r0, r2, #0
|
||||
bx lr
|
||||
|
||||
// r0 = Entity*
|
||||
thumb_func_start sub_0800451C
|
||||
sub_0800451C: @ 0x0800451C
|
||||
push {r0, lr}
|
||||
|
@ -192,17 +207,17 @@ sub_0800451C: @ 0x0800451C
|
|||
sub_08004542: @ 0x08004542
|
||||
movs r1, #0x38
|
||||
movs r2, #2
|
||||
strb r2, [r0, r1]
|
||||
strb r2, [r0, r1] // entity->collisionLayer = 2
|
||||
movs r2, #0xc0
|
||||
ldrb r1, [r0, #0x1b]
|
||||
bics r1, r2
|
||||
adds r1, #0x40
|
||||
strb r1, [r0, #0x1b]
|
||||
strb r1, [r0, #0x1b] // update spriteOrientation
|
||||
movs r2, #0xc0
|
||||
ldrb r1, [r0, #0x19]
|
||||
bics r1, r2
|
||||
adds r1, #0x40
|
||||
strb r1, [r0, #0x19]
|
||||
strb r1, [r0, #0x19] // update spriteRendering
|
||||
bx lr
|
||||
|
||||
non_word_aligned_thumb_func_start ResetCollisionLayer
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
|
||||
.text
|
||||
|
||||
@ TODO cannot add this at the end of mapVvvToSurfaceType.c due to alignment?
|
||||
// TODO cannot add this at the end of mapVvvToSurfaceType.c due to alignment?
|
||||
.2byte 0
|
||||
|
||||
@ TODO unused?
|
||||
// TODO unused?
|
||||
gUnk_08007DBE:: @ 08007DBE
|
||||
.byte 0x42, 0x7b, 0x01, 0x32, 0x42, 0x73, 0x70, 0x47, 0x02, 0x73, 0x00, 0x23, 0x43, 0x73, 0x0b, 0x73
|
||||
|
||||
@ seems unused?
|
||||
// seems unused?
|
||||
non_word_aligned_thumb_func_start sub_08007DCE
|
||||
sub_08007DCE:
|
||||
push {lr}
|
||||
|
@ -20,26 +20,27 @@ sub_08007DCE:
|
|||
pop {pc}
|
||||
|
||||
|
||||
@ Find the key in the map of u16 to u16
|
||||
@ r0: value, r1: array of u16*
|
||||
// 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 @ move the found value into r0
|
||||
bl ActTileConv
|
||||
adds r0, r3, #0 // move the found value into r0
|
||||
pop {pc}
|
||||
|
||||
thumb_func_start sub_08007DE0
|
||||
sub_08007DE0: @ 0x08007DE0
|
||||
thumb_func_start ActTileConv // TODO rename
|
||||
ActTileConv: @ 0x08007DE0
|
||||
subs r1, #4
|
||||
_08007DE2:
|
||||
adds r1, #4 @ add +4 to r1 at the end of loop
|
||||
ldrh r3, [r1] @ r3: key
|
||||
adds r1, #4 // add +4 to r1 at the end of loop
|
||||
ldrh r3, [r1] // r3: key
|
||||
cmp r3, #0
|
||||
beq _08007DF2 @ key == 0 -> end of map
|
||||
beq _08007DF2 // key == 0 -> end of map
|
||||
cmp r0, r3
|
||||
bne _08007DE2 @ r3 == r0 -> found
|
||||
ldrh r3, [r1, #2] @ r3: value
|
||||
movs r2, #1 @ r2 = 1
|
||||
bne _08007DE2 // r3 == r0 -> found
|
||||
ldrh r3, [r1, #2] // r3: value
|
||||
movs r2, #1 // r2 = 1
|
||||
_08007DF2:
|
||||
bx lr
|
||||
|
|
|
@ -71,7 +71,7 @@ _08001230:
|
|||
ldr r3, _0800135C @ =UpdateAnimationVariableFrames
|
||||
bx r3
|
||||
_0800123E:
|
||||
ldr r3, _08001360 @ =CreateItemOnGround
|
||||
ldr r3, _08001360 @ =CreatePitFallFX
|
||||
bx r3
|
||||
|
||||
non_word_aligned_thumb_func_start GenericConfused
|
||||
|
@ -105,7 +105,7 @@ GenericConfused: @ 0x08001242
|
|||
cmp r2, #0x1c
|
||||
bne _08001282
|
||||
push {r0}
|
||||
bl sub_0804AA1C
|
||||
bl EnemyDetachFX
|
||||
pop {r0}
|
||||
_08001282:
|
||||
ldr r1, _08001364 @ =0x00001800
|
||||
|
@ -155,19 +155,19 @@ _080012BA:
|
|||
gUnk_080012C8::
|
||||
.4byte 0x00000000
|
||||
_080012CC: .4byte sub_08001214
|
||||
_080012D0: .4byte sub_080043A8
|
||||
_080012D4: .4byte CreateChestSpawner
|
||||
_080012D8: .4byte sub_080043B0
|
||||
_080012D0: .4byte CreateDrownFX
|
||||
_080012D4: .4byte CreateLavaDrownFX
|
||||
_080012D8: .4byte CreateSwampDrownFX
|
||||
|
||||
thumb_func_start sub_080012DC
|
||||
sub_080012DC: @ 0x080012DC
|
||||
push {r4, r5, lr}
|
||||
adds r4, r0, #0
|
||||
movs r5, #0x3a
|
||||
ldrb r1, [r4, r5]
|
||||
ldrb r1, [r4, r5] // gust jar state
|
||||
lsrs r1, r1, #3
|
||||
bhs _08001302
|
||||
bl sub_080043E8
|
||||
bl GetTileHazardType
|
||||
cmp r0, #4
|
||||
beq _08001302
|
||||
cmp r0, #0
|
||||
|
@ -241,7 +241,7 @@ _08001352:
|
|||
.align 2, 0
|
||||
_08001358: .4byte gEnemyFunctions
|
||||
_0800135C: .4byte UpdateAnimationVariableFrames
|
||||
_08001360: .4byte CreateItemOnGround
|
||||
_08001360: .4byte CreatePitFallFX
|
||||
_08001364: .4byte 0x00001800
|
||||
_08001368: .4byte gUnk_080012C8
|
||||
_0800136C: .4byte gUnk_080012C8
|
||||
|
|
315
asm/src/intr.s
315
asm/src/intr.s
|
@ -87,7 +87,7 @@ arm_sub_080B1A0C: @ 0x080B1A0C
|
|||
ldrb r2, [r0, #0x38]
|
||||
mov r0, r3
|
||||
b arm_GetMetaTileTypeByPos
|
||||
arm_GetMetaTileTypeByEntity:
|
||||
arm_GetMetaTileTypeByEntity: // GetCell
|
||||
ldrb r2, [r0, #0x38]
|
||||
ldrh r1, [r0, #0x32]
|
||||
ldrh r0, [r0, #0x2e]
|
||||
|
@ -121,8 +121,9 @@ _080B1A64:
|
|||
ldrh r0, [r1, r0]
|
||||
bx lr
|
||||
|
||||
// entity plus offset to world pixel coordinates and layer
|
||||
arm_func_start arm_GetVvvRelativeToEntity
|
||||
arm_GetVvvRelativeToEntity: @ 0x080B1A8C @ entity plus offset to world pixel coordinates and layer
|
||||
arm_GetVvvRelativeToEntity: @ 0x080B1A8C
|
||||
ldrh r3, [r0, #0x2e]
|
||||
add r3, r3, r1
|
||||
ldrh r1, [r0, #0x32]
|
||||
|
@ -130,7 +131,8 @@ arm_GetVvvRelativeToEntity: @ 0x080B1A8C @ entity plus offset to world pixel coo
|
|||
ldrb r2, [r0, #0x38]
|
||||
mov r0, r3
|
||||
b arm_GetVvvAtWorldCoords
|
||||
arm_GetVvvAtEntity: @ entity to world pixel coordinates and layer
|
||||
// entity to world pixel coordinates and layer
|
||||
arm_GetVvvAtEntity: // GetCellAct
|
||||
ldrb r2, [r0, #0x38]
|
||||
ldrh r1, [r0, #0x32]
|
||||
ldrh r0, [r0, #0x2e]
|
||||
|
@ -156,35 +158,39 @@ arm_GetVvvAtMetaTilePos:
|
|||
|
||||
arm_func_start arm_GetCollisionDataRelativeTo
|
||||
arm_GetCollisionDataRelativeTo: @ 0x080B1AF0
|
||||
ldrh r3, [r0, #0x2e]
|
||||
@ r0 = entity*
|
||||
@ r1 = x
|
||||
@ r2 = y
|
||||
|
||||
ldrh r3, [r0, #0x2e] @ ent.x + x
|
||||
add r3, r3, r1
|
||||
ldrh r1, [r0, #0x32]
|
||||
ldrh r1, [r0, #0x32] @ ent.y + y
|
||||
add r1, r1, r2
|
||||
ldrb r2, [r0, #0x38]
|
||||
ldrb r2, [r0, #0x38] @ ent.layer
|
||||
mov r0, r3
|
||||
b arm_GetCollisionDataAtWorldCoords
|
||||
arm_GetCollisionDataAtEntity:
|
||||
ldrb r2, [r0, #0x38]
|
||||
ldrh r1, [r0, #0x32]
|
||||
ldrh r0, [r0, #0x2e]
|
||||
arm_GetCollisionDataAtEntity: // GetCellAtt
|
||||
ldrb r2, [r0, #0x38] @ ent.layer
|
||||
ldrh r1, [r0, #0x32] @ ent.y
|
||||
ldrh r0, [r0, #0x2e] @ ent.x
|
||||
arm_GetCollisionDataAtWorldCoords:
|
||||
ldr ip, _080B1C28 @ =gRoomControls
|
||||
ldrh r3, [ip, #6]
|
||||
sub r0, r0, r3
|
||||
sub r0, r0, r3 @ ent.x - gRoomControls.origin_x
|
||||
ldrh r3, [ip, #8]
|
||||
sub r1, r1, r3
|
||||
sub r1, r1, r3 @ ent.y - gRoomControls.origin_y
|
||||
arm_GetCollisionDataAtRoomCoords:
|
||||
lsl r0, r0, #0x16
|
||||
lsr r0, r0, #0x1a
|
||||
lsr r0, r0, #0x1a @ /= 16
|
||||
lsl r1, r1, #0x16
|
||||
lsr r1, r1, #0x1a
|
||||
lsr r1, r1, #0x1a @ /= 16
|
||||
arm_GetCollisionDataAtRoomTile:
|
||||
add r0, r0, r1, lsl #6
|
||||
add r0, r0, r1, lsl #6 @ convert coords to tile index
|
||||
mov r1, r2
|
||||
arm_GetCollisionDataAtMetaTilePos:
|
||||
ldr r2, _080B1C2C @ =gCollisionDataPtrs
|
||||
ldr r1, [r2, r1, lsl #2]
|
||||
ldrb r0, [r1, r0]
|
||||
ldrb r0, [r1, r0] @ load collision tile at my location
|
||||
bx lr
|
||||
|
||||
arm_func_start arm_GetVvvForMetaTileType
|
||||
|
@ -283,77 +289,80 @@ UpdateCollision: @ 0x080B1C54
|
|||
|
||||
arm_func_start arm_CollideAll
|
||||
arm_CollideAll: @ 0x080B1C7C
|
||||
THIS .req r4
|
||||
OTHER .req r5
|
||||
|
||||
push {r4, r5, r6, r7, r8, sb, sl, lr}
|
||||
add r0, pc, #0x104 @ =_080B1D8C
|
||||
ldm r0, {r8, sb, sl}
|
||||
ldrb sl, [sl]
|
||||
cmp sl, #0
|
||||
beq _080B1D84
|
||||
ldr r8, [r8]
|
||||
ldr r8, [r8] // load entity
|
||||
mov r7, r8
|
||||
_080B1C9C:
|
||||
ldr r4, [r8, #8]
|
||||
ldrb r0, [r4, #0x10]
|
||||
ands r0, r0, #0x80
|
||||
beq _080B1D78
|
||||
ldrb r0, [r4, #0x3c]
|
||||
and r0, r0, #7
|
||||
next_this:
|
||||
ldr THIS, [r8, #8]
|
||||
ldrb r0, [THIS, #0x10]
|
||||
ands r0, r0, #0x80 // disable collision flag
|
||||
beq end_check_this
|
||||
ldrb r0, [THIS, #0x3c] // collisionFlags
|
||||
and r0, r0, #7 // first 3 bits
|
||||
mov r1, #1
|
||||
lsl r6, r1, r0
|
||||
ldrb r3, [r4, #0x3c]
|
||||
ldrb r2, [r4, #0x3d]
|
||||
lsl r6, r1, r0 // 1 << (collisionFlags & 7)
|
||||
ldrb r3, [THIS, #0x3c]
|
||||
ldrb r2, [THIS, #0x3d] // iframes
|
||||
mov ip, sl
|
||||
_080B1CC8:
|
||||
next_other: // r4 = this, r5 = other
|
||||
subs ip, ip, #1
|
||||
bmi _080B1D78
|
||||
ldr r5, [sb, ip, lsl #2]
|
||||
cmp r4, r5
|
||||
beq _080B1CC8
|
||||
ldr r0, [r5, #0x3b]
|
||||
ands r0, r0, r6
|
||||
beq _080B1CC8
|
||||
ldrb r0, [r5, #0x10]
|
||||
bmi end_check_this
|
||||
ldr OTHER, [sb, ip, lsl #2]
|
||||
cmp THIS, OTHER
|
||||
beq next_other
|
||||
ldr r0, [OTHER, #0x3b] // collisionMask
|
||||
ands r0, r0, r6 // other.collisionMask & (1 << m)
|
||||
beq next_other
|
||||
ldrb r0, [OTHER, #0x10] // disable collision flag
|
||||
ands r0, r0, #0x80
|
||||
beq _080B1CC8
|
||||
ldrb r0, [r4, #0x38]
|
||||
ldrb r1, [r5, #0x38]
|
||||
beq next_other
|
||||
ldrb r0, [THIS, #0x38] // collisionLayer
|
||||
ldrb r1, [OTHER, #0x38]
|
||||
ands r0, r0, r1
|
||||
beq _080B1CC8
|
||||
ldrb r0, [r5, #0x3c]
|
||||
beq next_other
|
||||
ldrb r0, [OTHER, #0x3c] // collisionFlags
|
||||
orr r0, r0, r3
|
||||
lsrs r0, r0, #7
|
||||
lsrs r0, r0, #7 // top
|
||||
bhs _080B1D20
|
||||
ldrb r0, [r5, #0x3d]
|
||||
ldrb r0, [OTHER, #0x3d] // iframes
|
||||
orrs r0, r0, r2
|
||||
bne _080B1CC8
|
||||
bne next_other
|
||||
_080B1D20:
|
||||
bl arm_CalcCollision
|
||||
cmp r0, #0
|
||||
beq _080B1CC8
|
||||
ldrb r3, [r4, #0x3c]
|
||||
ldrb r0, [r4, #0x3d]
|
||||
ldrb r1, [r4, #0x43]
|
||||
beq next_other
|
||||
ldrb r3, [THIS, #0x3c]
|
||||
ldrb r0, [THIS, #0x3d] // iframes
|
||||
ldrb r1, [THIS, #0x43] // hitType
|
||||
orr r2, r0, r1
|
||||
ldrb r0, [r5, #0x41]
|
||||
ldrb r0, [OTHER, #0x41] // OTHER processing a collision already?
|
||||
ands r0, r0, #0x80
|
||||
bne _080B1D58
|
||||
str r4, [r5, #0x4c]
|
||||
ldrb r0, [r4, #0x40]
|
||||
bne _080B1D58 // branch if set
|
||||
str THIS, [OTHER, #0x4c] // contactedEntity
|
||||
ldrb r0, [THIS, #0x40]
|
||||
orr r0, r0, #0x80
|
||||
strb r0, [r5, #0x41]
|
||||
strb r0, [OTHER, #0x41] // contactFlags |= 0x80
|
||||
_080B1D58:
|
||||
ldrb r0, [r4, #0x41]
|
||||
ldrb r0, [THIS, #0x41] // THIS processing a collision already?
|
||||
ands r0, r0, #0x80
|
||||
bne _080B1CC8
|
||||
str r5, [r4, #0x4c]
|
||||
ldrb r0, [r5, #0x40]
|
||||
bne next_other
|
||||
str OTHER, [THIS, #0x4c]
|
||||
ldrb r0, [OTHER, #0x40]
|
||||
orr r0, r0, #0x80
|
||||
strb r0, [r4, #0x41]
|
||||
b _080B1CC8
|
||||
_080B1D78:
|
||||
strb r0, [THIS, #0x41]
|
||||
b next_other
|
||||
end_check_this:
|
||||
ldr r8, [r8, #4]
|
||||
cmp r8, r7
|
||||
bne _080B1C9C
|
||||
bne next_this
|
||||
_080B1D84:
|
||||
pop {r4, r5, r6, r7, r8, sb, sl, lr}
|
||||
bx lr
|
||||
|
@ -363,56 +372,59 @@ _080B1D94: .4byte gCollidableCount
|
|||
|
||||
arm_func_start arm_CalcCollision
|
||||
arm_CalcCollision: @ 0x080B1D98
|
||||
@ r6 = this, r7 = other
|
||||
THIS .req r4
|
||||
OTHER .req r5
|
||||
BB_THIS .req r6
|
||||
BB_OTHER .req r7
|
||||
|
||||
push {r2, r3, r6, r7, r8, sb, ip, lr}
|
||||
ldr r6, [r4, #0x48]
|
||||
ldr r7, [r5, #0x48]
|
||||
ldrh r0, [r4, #0x2e]
|
||||
ldrh r1, [r5, #0x2e]
|
||||
ldr BB_THIS, [THIS, #0x48]
|
||||
ldr BB_OTHER, [OTHER, #0x48]
|
||||
ldrh r0, [THIS, #0x2e]
|
||||
ldrh r1, [OTHER, #0x2e]
|
||||
sub r0, r0, r1
|
||||
ldrsb r1, [r6]
|
||||
ldrsb r1, [BB_THIS]
|
||||
add r0, r0, r1
|
||||
ldrsb r1, [r7]
|
||||
ldrsb r1, [BB_OTHER]
|
||||
sub r0, r0, r1
|
||||
ldrb r1, [r6, #6]
|
||||
ldrb r2, [r7, #6]
|
||||
ldrb r1, [BB_THIS, #6]
|
||||
ldrb r2, [BB_OTHER, #6]
|
||||
add r1, r1, r2
|
||||
add r2, r0, r1
|
||||
cmp r2, r1, lsl #1
|
||||
bhi _080B1F28
|
||||
ldrh r1, [r4, #0x32]
|
||||
ldrh r2, [r5, #0x32]
|
||||
bhi not_overlapping
|
||||
ldrh r1, [THIS, #0x32]
|
||||
ldrh r2, [OTHER, #0x32]
|
||||
sub r1, r1, r2
|
||||
ldrsb r2, [r6, #1]
|
||||
ldrsb r2, [BB_THIS, #1]
|
||||
add r1, r1, r2
|
||||
ldrsb r2, [r7, #1]
|
||||
ldrsb r2, [BB_OTHER, #1]
|
||||
sub r1, r1, r2
|
||||
ldrb r2, [r6, #7]
|
||||
ldrb r3, [r7, #7]
|
||||
ldrb r2, [BB_THIS, #7]
|
||||
ldrb r3, [BB_OTHER, #7]
|
||||
add r2, r2, r3
|
||||
add r3, r1, r2
|
||||
cmp r3, r2, lsl #1
|
||||
bhi _080B1F28
|
||||
bhi not_overlapping
|
||||
mov r2, #5
|
||||
mov r3, #5
|
||||
ldr r8, [r4, #0x3c]
|
||||
ldr r8, [THIS, #0x3c] // collisionFlags & 0x10
|
||||
ands r8, r8, #0x10
|
||||
ldrbne r2, [r6, #8]
|
||||
ldr r8, [r5, #0x3c]
|
||||
ldrbne r2, [BB_THIS, #8] // 3d hitbox
|
||||
ldr r8, [OTHER, #0x3c]
|
||||
ands r8, r8, #0x10
|
||||
ldrbne r3, [r7, #8]
|
||||
ldrbne r3, [BB_OTHER, #8]
|
||||
add r2, r2, r3
|
||||
ldrsh r8, [r4, #0x36]
|
||||
ldrsh sb, [r5, #0x36]
|
||||
ldrsh r8, [THIS, #0x36] // Z
|
||||
ldrsh sb, [OTHER, #0x36]
|
||||
sub r8, r8, sb
|
||||
add r8, r2, r8
|
||||
cmp r8, r2, lsl #1
|
||||
bhi _080B1F28
|
||||
ldrb r2, [r4, #0x3c]
|
||||
bhi not_overlapping
|
||||
ldrb r2, [THIS, #0x3c] // collisionFlags & BBOX_SOLID
|
||||
and r2, r2, #0x20
|
||||
lsr r2, r2, #3
|
||||
ldrb r3, [r5, #0x3c]
|
||||
ldrb r3, [OTHER, #0x3c]
|
||||
and r3, r3, #0x20
|
||||
adds r2, r2, r3, lsr #2
|
||||
beq _080B1E74
|
||||
|
@ -425,15 +437,15 @@ _080B1E74:
|
|||
mov ip, #0
|
||||
bl arm_CalcCollisionDirection
|
||||
mov r6, r0
|
||||
ldrb r1, [r5, #0x3f]
|
||||
ldrb r1, [OTHER, #0x3f] // hitType
|
||||
mov r0, #0x22
|
||||
mul r1, r0, r1
|
||||
ldrb r0, [r4, #0x40]
|
||||
ldrb r0, [THIS, #0x40] // hurtType
|
||||
add r0, r0, r1
|
||||
mov r1, #0xc
|
||||
mul r2, r0, r1
|
||||
ldr r1, _080B2014 @ =gCollisionMtx
|
||||
add r3, r2, r1
|
||||
add r3, r2, r1 // gCollisionMtx + 12 * (34 * hurtType + hurtType)
|
||||
mov r1, #0
|
||||
ldrb r0, [r3]
|
||||
cmp r0, #0xff
|
||||
|
@ -446,106 +458,120 @@ _080B1E74:
|
|||
mov lr, pc
|
||||
bx r7
|
||||
_080B1ED4:
|
||||
cmp r0, #0
|
||||
beq _080B1F20
|
||||
cmp r0, #2
|
||||
beq _080B1F1C
|
||||
ldrb r0, [r4, #0x3c]
|
||||
cmp r0, #0 // RESULT_NO_COLLISION
|
||||
beq no_col
|
||||
cmp r0, #2 // RESULT_COLLISION_WITHOUT_SET
|
||||
beq col_no_set
|
||||
// RESULT_COLLISION
|
||||
ldrb r0, [THIS, #0x3c] // collisionFlags
|
||||
and r0, r0, #0x80
|
||||
lsr r0, r0, #5
|
||||
ldrb r1, [r5, #0x3c]
|
||||
ldrb r1, [OTHER, #0x3c] // collisionFlags
|
||||
and r1, r1, #0x80
|
||||
lsr r1, r1, #4
|
||||
add r0, r0, r1
|
||||
add r1, pc, #0xF4 @ =_080B1FFC
|
||||
ldr r0, [r1, r0]
|
||||
mov lr, pc
|
||||
bx r0
|
||||
bx r0 // jumptable 0 1 2
|
||||
_080B1F10:
|
||||
strb r6, [r5, #0x3e]
|
||||
strb r6, [OTHER, #0x3e]
|
||||
eor r6, r6, #0x10
|
||||
strb r6, [r4, #0x3e]
|
||||
_080B1F1C:
|
||||
strb r6, [THIS, #0x3e]
|
||||
col_no_set:
|
||||
mov r0, #1
|
||||
_080B1F20:
|
||||
no_col:
|
||||
pop {r2, r3, r6, r7, r8, sb, ip, lr}
|
||||
bx lr
|
||||
_080B1F28:
|
||||
not_overlapping:
|
||||
mov r0, #0
|
||||
b _080B1F20
|
||||
b no_col
|
||||
|
||||
// BBOX_SOLID THIS
|
||||
arm_func_start arm_sub_080B1F30
|
||||
arm_sub_080B1F30: @ 0x080B1F30
|
||||
ldrh r0, [r4, #0x2e]
|
||||
ldrh r1, [r5, #0x2e]
|
||||
ldrh r0, [THIS, #0x2e]
|
||||
ldrh r1, [OTHER, #0x2e]
|
||||
sub r0, r0, r1
|
||||
ldrsb r1, [r7]
|
||||
ldrsb r1, [BB_OTHER]
|
||||
sub r0, r0, r1
|
||||
ldrh r1, [r4, #0x32]
|
||||
ldrh r2, [r5, #0x32]
|
||||
ldrh r1, [THIS, #0x32]
|
||||
ldrh r2, [OTHER, #0x32]
|
||||
sub r1, r1, r2
|
||||
ldrsb r2, [r7, #1]
|
||||
ldrsb r2, [BB_OTHER, #1]
|
||||
sub r1, r1, r2
|
||||
bx lr
|
||||
|
||||
// BBOX_SOLID OTHER
|
||||
arm_func_start arm_sub_080B1F5C
|
||||
arm_sub_080B1F5C: @ 0x080B1F5C
|
||||
ldrh r0, [r4, #0x2e]
|
||||
ldrh r1, [r5, #0x2e]
|
||||
ldrh r0, [THIS, #0x2e]
|
||||
ldrh r1, [OTHER, #0x2e]
|
||||
sub r0, r0, r1
|
||||
ldrsb r1, [r6]
|
||||
ldrsb r1, [BB_THIS]
|
||||
add r0, r0, r1
|
||||
ldrh r1, [r4, #0x32]
|
||||
ldrh r2, [r5, #0x32]
|
||||
ldrh r1, [THIS, #0x32]
|
||||
ldrh r2, [OTHER, #0x32]
|
||||
sub r1, r1, r2
|
||||
ldrsb r2, [r6, #1]
|
||||
ldrsb r2, [BB_THIS, #1]
|
||||
add r1, r1, r2
|
||||
bx lr
|
||||
|
||||
// BBOX_SOLID BOTH
|
||||
arm_func_start arm_sub_080B1F88
|
||||
arm_sub_080B1F88: @ 0x080B1F88
|
||||
ldrh r0, [r4, #0x2e]
|
||||
ldrh r1, [r5, #0x2e]
|
||||
ldrh r0, [THIS, #0x2e]
|
||||
ldrh r1, [OTHER, #0x2e]
|
||||
sub r0, r0, r1
|
||||
ldrh r1, [r4, #0x32]
|
||||
ldrh r2, [r5, #0x32]
|
||||
ldrh r1, [THIS, #0x32]
|
||||
ldrh r2, [OTHER, #0x32]
|
||||
sub r1, r1, r2
|
||||
bx lr
|
||||
|
||||
// BBOX_REFLECT OTHER
|
||||
arm_func_start arm_sub_080B1FA4
|
||||
arm_sub_080B1FA4: @ 0x080B1FA4
|
||||
ldrb r0, [r5, #0x15]
|
||||
ldrb r0, [r5, #0x15] // invert direction
|
||||
eor r0, r0, #0x10
|
||||
b _080B1FB4
|
||||
|
||||
// BBOX_REFLECT THIS
|
||||
_080B1FB0:
|
||||
ldrb r0, [r4, #0x15]
|
||||
ldrb r0, [THIS, #0x15] // direction
|
||||
_080B1FB4:
|
||||
sub r1, r0, #8
|
||||
and r1, r1, #0x1f
|
||||
sub r1, r6, r1
|
||||
and r1, r1, #0x1f
|
||||
sub r1, r0, #8 // turn counterclockwise
|
||||
and r1, r1, #0x1f // normalize
|
||||
sub r1, r6, r1 // sub calcDir
|
||||
and r1, r1, #0x1f // normalize
|
||||
cmp r1, #0x11
|
||||
bxlo lr
|
||||
sub r0, r6, r0
|
||||
sub r0, r0, #8
|
||||
and r0, r0, #0x1f
|
||||
sub r6, r6, r0, lsl #1
|
||||
bxlo lr // branch if facing to the right
|
||||
sub r0, r6, r0 // sub calcDir
|
||||
sub r0, r0, #8 // turn counterclockwise
|
||||
and r0, r0, #0x1f // normalize
|
||||
sub r6, r6, r0, lsl #1 // calcDir -= 2 * temp
|
||||
and r6, r6, #0x1f
|
||||
bx lr
|
||||
|
||||
// BBOX_REFLECT BOTH
|
||||
arm_func_start arm_sub_080B1FE4
|
||||
arm_sub_080B1FE4: @ 0x080B1FE4
|
||||
ldrb r6, [r4, #0x15]
|
||||
ldrb r6, [THIS, #0x15] // direction
|
||||
|
||||
// BBOX_REFLECT NONE, BBOX_SOLID NONE
|
||||
_080B1FE8:
|
||||
bx lr
|
||||
|
||||
|
||||
_080B1FEC: .4byte ram_sub_080B1FE8
|
||||
_080B1FF0: .4byte ram_sub_080B1F30
|
||||
_080B1FF4: .4byte ram_sub_080B1F5C
|
||||
_080B1FF8: .4byte ram_sub_080B1F88
|
||||
|
||||
_080B1FFC: .4byte ram_sub_080B1FE8
|
||||
_080B2000: .4byte ram_sub_080B1FB0
|
||||
_080B2004: .4byte ram_sub_080B1FA4
|
||||
_080B2008: .4byte ram_sub_080B1FE4
|
||||
|
||||
_080B200C: .4byte gCollidableList
|
||||
_080B2010: .4byte gCollidableCount
|
||||
_080B2014: .4byte gCollisionMtx
|
||||
|
@ -743,29 +769,30 @@ _080B2270: .4byte gUpdateContext
|
|||
_080B2274: .4byte gUnk_080026A4
|
||||
_080B2278: .4byte gUpdateContext
|
||||
|
||||
// calculating knockback?
|
||||
arm_func_start arm_sub_080B227C
|
||||
arm_sub_080B227C: @ 0x080B227C
|
||||
push {r4, r5, r6, r7, r8, lr}
|
||||
ldr r2, [r0, #0x48]
|
||||
push {r4-r8, lr}
|
||||
ldr r2, [r0, #0x48] // tgt.hitbox
|
||||
cmp r2, #0
|
||||
beq _080B236C
|
||||
ldr r3, [r1, #0x48]
|
||||
beq ret_false
|
||||
ldr r3, [r1, #0x48] // org.hitbox
|
||||
cmp r3, #0
|
||||
beq _080B236C
|
||||
beq ret_false
|
||||
ldrh r4, [r1, #0x2e]
|
||||
ldrsb r5, [r3]
|
||||
add r4, r4, r5
|
||||
ldrh r5, [r0, #0x2e]
|
||||
sub r4, r4, r5
|
||||
ldrsb r5, [r2]
|
||||
sub r4, r4, r5
|
||||
sub r4, r4, r5 // temp = (tgt.x + tgt.hitbox.x) - (org.x + org.hitbox.x)
|
||||
ldrb r5, [r2, #6]
|
||||
ldrb r6, [r3, #6]
|
||||
add r5, r5, r6
|
||||
add r6, r4, r5
|
||||
add r6, r4, r5 // temp = temp + (tgt.hitbox.width + org.hitbox.width)
|
||||
lsl r7, r5, #1
|
||||
cmp r7, r6
|
||||
blo _080B236C
|
||||
blo ret_false // not colliding
|
||||
cmp r4, #0
|
||||
movpl ip, #8
|
||||
movmi ip, #0x18
|
||||
|
@ -784,7 +811,7 @@ arm_sub_080B227C: @ 0x080B227C
|
|||
add r5, r4, r3
|
||||
lsl r6, r3, #1
|
||||
cmp r6, r5
|
||||
blo _080B236C
|
||||
blo ret_false
|
||||
cmp r4, #0
|
||||
movpl r2, #0x10
|
||||
movmi r2, #0
|
||||
|
@ -794,7 +821,7 @@ arm_sub_080B227C: @ 0x080B227C
|
|||
movhs r7, r8
|
||||
movhs r2, ip
|
||||
cmp r7, #0
|
||||
beq _080B236C
|
||||
beq ret_false
|
||||
cmp r7, #5
|
||||
movhs r7, #4
|
||||
mov r0, r1
|
||||
|
@ -803,11 +830,11 @@ arm_sub_080B227C: @ 0x080B227C
|
|||
mov lr, pc
|
||||
bx r3
|
||||
_080B2360:
|
||||
pop {r4, r5, r6, r7, r8, lr}
|
||||
pop {r4-r8, lr}
|
||||
mov r0, #1
|
||||
bx lr
|
||||
_080B236C:
|
||||
pop {r4, r5, r6, r7, r8, lr}
|
||||
ret_false:
|
||||
pop {r4-r8, lr}
|
||||
mov r0, #0
|
||||
bx lr
|
||||
.align 2, 0
|
||||
|
|
160
asm/src/player.s
160
asm/src/player.s
|
@ -26,7 +26,7 @@ sub_0800857C: @ 0x0800857C
|
|||
_0800859C:
|
||||
ldrh r1, [r0, #0x24]
|
||||
ldrb r2, [r0, #0x15]
|
||||
bl sub_080027EA
|
||||
bl LinearMoveDirectionOLD
|
||||
|
||||
pop {r4 - r7}
|
||||
mov r8, r4
|
||||
|
@ -57,11 +57,11 @@ sub_080085CC: @ 0x080085CC
|
|||
ldr r2, _0800888C @ =gPlayerState
|
||||
ldr r1, _08008890 @ =gUnk_080083FC
|
||||
movs r3, #0x26
|
||||
ldrb r3, [r2, r3]
|
||||
ldrb r3, [r2, r3] // swim_state
|
||||
orrs r3, r3
|
||||
beq _080085E6
|
||||
ldr r2, [r2, #0x30]
|
||||
movs r3, #0x80
|
||||
movs r3, #0x80 // flags & PL_MINISH
|
||||
ands r2, r3
|
||||
beq _0800861A
|
||||
ldr r1, _08008894 @ =gUnk_0800839C
|
||||
|
@ -70,12 +70,12 @@ _080085E6:
|
|||
ldr r1, _08008898 @ =gUnk_0800845C
|
||||
ldrb r3, [r2, #2]
|
||||
orrs r3, r3
|
||||
bne _0800861A
|
||||
ldr r2, [r2, #0x30]
|
||||
bne _0800861A // jump_status != 0
|
||||
ldr r2, [r2, #0x30] // flags & PL_PARACHUTE
|
||||
ldr r3, _0800889C @ =0x01000000
|
||||
tst r2, r3
|
||||
bne _0800861A
|
||||
movs r3, #0x80
|
||||
movs r3, #0x80 // // flags & PL_MINISH
|
||||
ldr r1, _080088A0 @ =gUnk_0800833C
|
||||
ands r2, r3
|
||||
bne _0800861A
|
||||
|
@ -83,15 +83,15 @@ _080085E6:
|
|||
ldr r3, _080088A8 @ =gPlayerState
|
||||
ldrb r2, [r3, #0x1c]
|
||||
orrs r2, r2
|
||||
bne _0800861A
|
||||
bne _0800861A // gustJarState != 0
|
||||
ldrb r2, [r3, #5]
|
||||
orrs r2, r2
|
||||
bne _0800861A
|
||||
bne _0800861A // heldObject != 0
|
||||
ldr r1, _080088AC @ =gUnk_0800851C
|
||||
movs r2, #0xaa
|
||||
ldrb r2, [r3, r2]
|
||||
orrs r2, r2
|
||||
bne _0800861A
|
||||
bne _0800861A // attachedBeetleCount != 0
|
||||
ldr r1, _080088B0 @ =gUnk_080082DC
|
||||
_0800861A:
|
||||
mov r11, r1
|
||||
|
@ -169,7 +169,7 @@ _08008684:
|
|||
_080086AC:
|
||||
mov r0, r8
|
||||
movs r2, #0x2a
|
||||
strh r7, [r0, r2]
|
||||
strh r7, [r0, r2] // collisions
|
||||
pop {pc}
|
||||
|
||||
thumb_func_start sub_080086B4
|
||||
|
@ -265,17 +265,17 @@ _08008754:
|
|||
ands r2, r3
|
||||
pop {pc}
|
||||
|
||||
non_word_aligned_thumb_func_start sub_0800875A
|
||||
sub_0800875A: @ 0x0800875A
|
||||
non_word_aligned_thumb_func_start DoItemTileInteraction
|
||||
DoItemTileInteraction: @ 0x0800875A
|
||||
push {r2, r4, lr}
|
||||
ldrb r3, [r0, #0x14]
|
||||
ldrb r3, [r0, #0x14] // item.animationState
|
||||
movs r2, #6
|
||||
ands r3, r2
|
||||
ldr r4, _080088D0 @ =gUnk_08007DF4
|
||||
ldrsb r2, [r4, r3]
|
||||
adds r3, #1
|
||||
ldrsb r3, [r4, r3]
|
||||
bl sub_08008782
|
||||
bl DoTileInteractionOffset
|
||||
pop {r2, r4}
|
||||
cmp r0, #0
|
||||
beq _08008780
|
||||
|
@ -288,21 +288,21 @@ sub_0800875A: @ 0x0800875A
|
|||
_08008780:
|
||||
pop {pc}
|
||||
|
||||
non_word_aligned_thumb_func_start sub_08008782
|
||||
sub_08008782: @ 0x08008782
|
||||
non_word_aligned_thumb_func_start DoTileInteractionOffset
|
||||
DoTileInteractionOffset: @ 0x08008782
|
||||
push {r4}
|
||||
ldrh r4, [r0, #0x2e]
|
||||
adds r2, r2, r4
|
||||
ldrh r4, [r0, #0x32]
|
||||
adds r3, r3, r4
|
||||
pop {r4}
|
||||
b sub_08008796
|
||||
b DoTileInteraction
|
||||
|
||||
thumb_func_start sub_08008790
|
||||
sub_08008790: @ 0x08008790
|
||||
thumb_func_start DoTileInteractionHere
|
||||
DoTileInteractionHere: @ 0x08008790
|
||||
ldrh r2, [r0, #0x2e]
|
||||
ldrh r3, [r0, #0x32]
|
||||
b sub_08008796
|
||||
b DoTileInteraction
|
||||
|
||||
// r0: Entity*
|
||||
// r1: tile filter?
|
||||
|
@ -310,8 +310,8 @@ sub_08008790: @ 0x08008790
|
|||
// r3: y
|
||||
|
||||
// Somehow involved in trampling tiles, digging with claws, picking up tiles..
|
||||
non_word_aligned_thumb_func_start sub_08008796
|
||||
sub_08008796: @ 0x08008796
|
||||
non_word_aligned_thumb_func_start DoTileInteraction
|
||||
DoTileInteraction: @ 0x08008796
|
||||
push {r4, r5, r6, r7, lr}
|
||||
push {r2, r3}
|
||||
ldr r2, _080088D4 @ =gRoomControls
|
||||
|
@ -319,17 +319,17 @@ sub_08008796: @ 0x08008796
|
|||
movs r2, #1
|
||||
cmp r2, r3
|
||||
pop {r2, r3}
|
||||
beq _080087CE
|
||||
beq _080087CE_return0
|
||||
push {r0, r1, r2, r3}
|
||||
pop {r4, r5, r6, r7}
|
||||
adds r0, r6, #0
|
||||
adds r1, r7, #0
|
||||
movs r2, #0x38
|
||||
ldrb r2, [r4, r2]
|
||||
ldrb r2, [r4, r2] // collision layer
|
||||
bl GetMetaTileTypeByPos
|
||||
ldr r1, _080088D8 @ =gUnk_080046A4
|
||||
bl sub_08007DE0
|
||||
beq _080087CE
|
||||
bl ActTileConv
|
||||
beq _080087CE_return0
|
||||
lsls r1, r3, #3
|
||||
adds r3, r5, #0
|
||||
ldr r0, _080088DC @ =gUnk_080047F6
|
||||
|
@ -338,51 +338,51 @@ sub_08008796: @ 0x08008796
|
|||
lsrs r0, r3
|
||||
lsrs r0, r0, #1
|
||||
bhs _080087D2
|
||||
_080087CE:
|
||||
_080087CE_return0:
|
||||
movs r0, #0
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
_080087D2:
|
||||
ldrb r0, [r5, #2]
|
||||
ldrb r1, [r5, #3]
|
||||
ldrb r0, [r5, #2] // object id
|
||||
ldrb r1, [r5, #3] // object type
|
||||
cmp r0, #0xff
|
||||
beq _0800883A
|
||||
beq after_create_obj
|
||||
cmp r3, #6
|
||||
beq _0800883A
|
||||
beq after_create_obj
|
||||
cmp r3, #0xe
|
||||
beq _0800883A
|
||||
beq after_create_obj
|
||||
cmp r3, #0xa
|
||||
beq _0800883A
|
||||
beq after_create_obj
|
||||
cmp r3, #0xb
|
||||
beq _0800883A
|
||||
beq after_create_obj
|
||||
cmp r3, #0xd
|
||||
bne _080087F6
|
||||
cmp r0, #0xf
|
||||
bne _0800883A
|
||||
cmp r1, #0x17
|
||||
bne _0800883A
|
||||
cmp r0, #0xf // SPECIAL_FX
|
||||
bne after_create_obj
|
||||
cmp r1, #0x17 // FX_GRASS_CUT
|
||||
bne after_create_obj
|
||||
_080087F6:
|
||||
movs r2, #0
|
||||
cmp r0, #0xf
|
||||
cmp r0, #0xf // SPECIAL_FX
|
||||
bne _080087FE
|
||||
movs r2, #0x80
|
||||
_080087FE:
|
||||
bl CreateObject
|
||||
bl CreateObject // r0 = id, r1 = type, r2 = type2
|
||||
cmp r0, #0
|
||||
beq _0800883A
|
||||
ldrb r1, [r5, #2]
|
||||
beq after_create_obj
|
||||
ldrb r1, [r5, #2] // object id
|
||||
cmp r1, #0
|
||||
beq _08008820
|
||||
beq no_offset
|
||||
movs r2, #0xf
|
||||
adds r1, r6, #0
|
||||
bics r1, r2
|
||||
adds r1, #8
|
||||
strh r1, [r0, #0x2e]
|
||||
strh r1, [r0, #0x2e] // x
|
||||
adds r1, r7, #0
|
||||
bics r1, r2
|
||||
adds r1, #8
|
||||
strh r1, [r0, #0x32]
|
||||
strh r1, [r0, #0x32] // y
|
||||
b _0800882C
|
||||
_08008820:
|
||||
no_offset:
|
||||
ldrh r1, [r4, #0x2e]
|
||||
strh r1, [r0, #0x2e]
|
||||
ldrh r1, [r4, #0x32]
|
||||
|
@ -391,12 +391,12 @@ _08008820:
|
|||
strh r1, [r1, #0x36]
|
||||
_0800882C:
|
||||
movs r3, #0x50
|
||||
str r4, [r1, r3]
|
||||
str r4, [r1, r3] // set parent to r4
|
||||
movs r3, #0x38
|
||||
ldrb r1, [r4, r3]
|
||||
ldrb r1, [r4, r3] // copy collision layer from parent
|
||||
strb r1, [r0, r3]
|
||||
bl UpdateSpriteForCollisionLayer
|
||||
_0800883A:
|
||||
after_create_obj:
|
||||
ldr r1, _080088E0 @ =gRoomControls
|
||||
ldrh r0, [r1, #6]
|
||||
subs r2, r6, r0
|
||||
|
@ -461,22 +461,22 @@ _080088DC: .4byte gUnk_080047F6
|
|||
_080088E0: .4byte gRoomControls
|
||||
_080088E4: .4byte 0x00004000
|
||||
_080088E8: .4byte 0x0000FFFF
|
||||
_080088EC:
|
||||
velocities1:
|
||||
.byte 0, -3, 3, -3
|
||||
.byte 3, 0, 3, 3
|
||||
.byte 0, 3, -3, 3
|
||||
.byte -3, 0, -3, -3
|
||||
_080088FC:
|
||||
ice_velocities:
|
||||
.byte 0, -10, 10, -10
|
||||
.byte 10, 0, 10, 10
|
||||
.byte 0, 10, -10, 10
|
||||
.byte -10, 0, -10, -10
|
||||
_0800890C:
|
||||
velocities3:
|
||||
.byte 0, 6, -6, 0
|
||||
.byte 0, -6, 6, 0
|
||||
.byte 19, 18, 18, 16
|
||||
.byte 16, 17, 17, 19
|
||||
_0800891C:
|
||||
reset_vel:
|
||||
push {r0}
|
||||
bl ResetPlayerVelocity
|
||||
pop {r0}
|
||||
|
@ -497,7 +497,7 @@ UpdateIcePlayerVelocity: @ 0x0800892E
|
|||
|
||||
_UpdateIcePlayerVelocity:
|
||||
push {lr}
|
||||
ldrb r2, [r0, #0x14]
|
||||
ldrb r2, [r0, #0x14] // animationState
|
||||
lsrs r2, r2, #1
|
||||
lsls r2, r2, #3
|
||||
ldr r1, _08008A68 @ =gPlayerState
|
||||
|
@ -522,20 +522,20 @@ _08008956:
|
|||
movs r3, #0x80
|
||||
tst r2, r3
|
||||
bne _080089C0
|
||||
_08008960:
|
||||
ldrb r3, [r1, #5]
|
||||
_08008960: // r1 = gPlayerState
|
||||
ldrb r3, [r1, #5] // heldObject
|
||||
cmp r3, #2
|
||||
beq _0800891C
|
||||
beq reset_vel
|
||||
cmp r3, #1
|
||||
beq _0800891C
|
||||
ldr r4, _08008A74 @ =_080088FC
|
||||
beq reset_vel
|
||||
ldr r4, _08008A74 @ =ice_velocities
|
||||
ldrb r3, [r1, #2]
|
||||
adds r1, r2, #0
|
||||
orrs r3, r3
|
||||
orrs r3, r3 // jump_status != 0
|
||||
beq _08008992
|
||||
push {r2}
|
||||
movs r3, #0x14
|
||||
ldrb r1, [r0, r3]
|
||||
ldrb r1, [r0, r3] // field_0x14
|
||||
lsrs r1, r1, #1
|
||||
lsls r1, r1, #1
|
||||
lsrs r2, r2, #2
|
||||
|
@ -544,7 +544,7 @@ _08008960:
|
|||
adds r2, #2
|
||||
movs r4, #7
|
||||
ands r2, r4
|
||||
ldr r4, _08008A78 @ =_080088EC
|
||||
ldr r4, _08008A78 @ =velocities1
|
||||
cmp r2, #4
|
||||
beq _08008992
|
||||
bhs _080089A8
|
||||
|
@ -557,25 +557,25 @@ _08008992:
|
|||
ldrsb r2, [r4, r3]
|
||||
adds r3, #1
|
||||
ldrsb r3, [r4, r3]
|
||||
bl sub_08008A46
|
||||
bl AddPlayerVelocity
|
||||
b _080089C0
|
||||
_080089A8:
|
||||
movs r3, #0x14
|
||||
ldrb r3, [r0, r3]
|
||||
lsrs r3, r3, #1
|
||||
lsls r3, r3, #1
|
||||
ldr r4, _08008A7C @ =_0800890C
|
||||
ldr r4, _08008A7C @ =velocities3
|
||||
adds r4, r4, r3
|
||||
movs r3, #0
|
||||
ldrsb r2, [r4, r3]
|
||||
adds r3, #1
|
||||
ldrsb r3, [r4, r3]
|
||||
bl sub_08008A46
|
||||
bl AddPlayerVelocity
|
||||
_080089C0:
|
||||
ldr r1, _08008A80 @ =gPlayerState
|
||||
movs r4, #0x8c
|
||||
movs r2, #8
|
||||
ldrsh r3, [r1, r4]
|
||||
ldrsh r3, [r1, r4] // vel_x
|
||||
orrs r3, r3
|
||||
beq _080089E4
|
||||
bpl _080089D2
|
||||
|
@ -585,7 +585,7 @@ _080089D2:
|
|||
push {r0, r1}
|
||||
adds r1, r3, #0
|
||||
push {r2}
|
||||
bl sub_080027EA
|
||||
bl LinearMoveDirectionOLD
|
||||
pop {r0}
|
||||
bl sub_0807A5B8
|
||||
pop {r0, r1}
|
||||
|
@ -602,7 +602,7 @@ _080089F4:
|
|||
push {r0, r1}
|
||||
adds r1, r3, #0
|
||||
push {r2}
|
||||
bl sub_080027EA
|
||||
bl LinearMoveDirectionOLD
|
||||
pop {r0}
|
||||
bl sub_0807A5B8
|
||||
pop {r0, r1}
|
||||
|
@ -646,18 +646,18 @@ _08008A3E:
|
|||
beq _08008A3A
|
||||
b _08008A38
|
||||
|
||||
non_word_aligned_thumb_func_start sub_08008A46
|
||||
sub_08008A46: @ 0x08008A46
|
||||
non_word_aligned_thumb_func_start AddPlayerVelocity
|
||||
AddPlayerVelocity: @ 0x08008A46
|
||||
push {lr}
|
||||
ldr r1, _08008A84 @ =gPlayerState
|
||||
movs r4, #0x8c
|
||||
ldrsh r5, [r1, r4]
|
||||
ldrsh r5, [r1, r4] // vel_x
|
||||
adds r5, r5, r2
|
||||
bl sub_08008A88
|
||||
movs r4, #0x8e
|
||||
bl ClampPlayerVelocity
|
||||
movs r4, #0x8e // vel_y
|
||||
ldrsh r5, [r1, r4]
|
||||
adds r5, r5, r3
|
||||
bl sub_08008A88
|
||||
bl ClampPlayerVelocity
|
||||
pop {pc}
|
||||
_08008A60:
|
||||
eors r3, r3
|
||||
|
@ -667,14 +667,14 @@ _08008A60:
|
|||
_08008A68: .4byte gPlayerState
|
||||
_08008A6C: .4byte gPlayerState
|
||||
_08008A70: .4byte gPlayerState
|
||||
_08008A74: .4byte _080088FC
|
||||
_08008A78: .4byte _080088EC
|
||||
_08008A7C: .4byte _0800890C
|
||||
_08008A74: .4byte ice_velocities
|
||||
_08008A78: .4byte velocities1
|
||||
_08008A7C: .4byte velocities3
|
||||
_08008A80: .4byte gPlayerState
|
||||
_08008A84: .4byte gPlayerState
|
||||
|
||||
thumb_func_start sub_08008A88
|
||||
sub_08008A88: @ 0x08008A88
|
||||
thumb_func_start ClampPlayerVelocity
|
||||
ClampPlayerVelocity: @ 0x08008A88
|
||||
orrs r5, r5
|
||||
bmi _08008A94
|
||||
ldr r6, _08008B38 @ =0x00000180
|
||||
|
@ -764,7 +764,7 @@ CheckNEastTile: @ 0x08008B02
|
|||
tst r0, r1
|
||||
bne _08008B1E
|
||||
ldr r1, =gMapVvvToSurfaceType
|
||||
bl sub_08007DE0
|
||||
bl ActTileConv
|
||||
movs r2, #1
|
||||
cmp r3, #1
|
||||
beq _08008B20
|
||||
|
|
102
asm/src/script.s
102
asm/src/script.s
|
@ -4,32 +4,33 @@
|
|||
.syntax unified
|
||||
|
||||
.text
|
||||
.thumb
|
||||
|
||||
.macro transition_tile tile:req, src_layer:req dest_layer:req
|
||||
.short \tile
|
||||
.byte \src_layer, \dest_layer
|
||||
.endm
|
||||
|
||||
|
||||
gUnk_08016984:: @ 08016984
|
||||
.incbin "code_08016984/gUnk_08016984.bin"
|
||||
|
||||
.text
|
||||
|
||||
non_word_aligned_thumb_func_start GetNextScriptCommandHalfword
|
||||
GetNextScriptCommandHalfword: @ 0x08016986
|
||||
GetNextScriptCommandHalfword::
|
||||
ldrh r0, [r0]
|
||||
bx lr
|
||||
|
||||
non_word_aligned_thumb_func_start GetNextScriptCommandHalfwordAfterCommandMetadata
|
||||
GetNextScriptCommandHalfwordAfterCommandMetadata: @ 0x0801698A
|
||||
GetNextScriptCommandHalfwordAfterCommandMetadata::
|
||||
ldrh r0, [r0, #2]
|
||||
bx lr
|
||||
|
||||
non_word_aligned_thumb_func_start GetNextScriptCommandWord
|
||||
GetNextScriptCommandWord: @ 0x0801698E
|
||||
GetNextScriptCommandWord::
|
||||
ldrh r1, [r0]
|
||||
ldrh r0, [r0, #2]
|
||||
lsls r0, r0, #0x10
|
||||
orrs r0, r1
|
||||
bx lr
|
||||
|
||||
thumb_func_start GetNextScriptCommandWordAfterCommandMetadata
|
||||
GetNextScriptCommandWordAfterCommandMetadata: @ 0x08016998
|
||||
GetNextScriptCommandWordAfterCommandMetadata::
|
||||
ldrh r1, [r0, #2]
|
||||
ldrh r0, [r0, #4]
|
||||
lsls r0, r0, #0x10
|
||||
|
@ -37,17 +38,15 @@ GetNextScriptCommandWordAfterCommandMetadata: @ 0x08016998
|
|||
bx lr
|
||||
.align 2, 0
|
||||
|
||||
gScreenShakeOffsets::
|
||||
.byte 0x01, 0xFF, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0x01, 0x00
|
||||
.byte 0xFF, 0x01, 0x00, 0x00, 0x02, 0xFF, 0x01, 0xFE, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0x01, 0xFF, 0x02
|
||||
.byte 0x00, 0x00, 0x01, 0x01, 0x02, 0xFF, 0x02, 0xFE, 0xFE, 0x02, 0xFF, 0x03, 0xFD, 0xFF, 0xFE, 0x01
|
||||
.byte 0x01, 0xFD, 0xFF, 0xFF, 0x03, 0xFE, 0x02, 0x00, 0x00, 0xFF, 0xFE, 0x03, 0xFD, 0x02, 0xFF, 0x00
|
||||
.byte 0x00, 0xFD, 0x02, 0x00, 0x00, 0xFF, 0x00, 0xFE, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02
|
||||
.byte 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00
|
||||
.byte 0x00, 0x00, 0x01, 0x00
|
||||
gShakeOffsets::
|
||||
.byte 1, -1, 0, 1, 1, 0, 0, 1, -1, -1, 1, 0, -1, 1, 0, 0
|
||||
.byte 2, -1, 1, -2, 0, -1, -1, 0, -1, 1, -1, 2, 0, 0, 1, 1
|
||||
.byte 2, -1, 2, -2, -2, 2, -1, 3, -3, -1, -2, 1, 1, -3, -1, -1
|
||||
.byte 3, -2, 2, 0, 0, -1, -2, 3, -3, 2, -1, 0, 0, -3, 2, 0
|
||||
.byte 0, -1, 0, -2, 0, -1, 0, 0, 0, 1, 0, 2, 0, 0, 0, 1
|
||||
.byte 2, 0, 1, 0, 0, 0, -1, 0, -1, 0, -1, 0, 0, 0, 1, 0
|
||||
|
||||
thumb_func_start UpdateSpriteForCollisionLayer
|
||||
UpdateSpriteForCollisionLayer: @ 0x08016A04
|
||||
UpdateSpriteForCollisionLayer:: @ 0x08016A04
|
||||
movs r1, #0x38
|
||||
ldrb r1, [r0, r1]
|
||||
lsls r1, r1, #1
|
||||
|
@ -69,8 +68,7 @@ UpdateSpriteForCollisionLayer: @ 0x08016A04
|
|||
_08016A28:
|
||||
.byte 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x40, 0x40
|
||||
|
||||
thumb_func_start ResolveCollisionLayer
|
||||
ResolveCollisionLayer: @ 0x08016A30
|
||||
ResolveCollisionLayer::
|
||||
push {r4, r5, lr}
|
||||
adds r4, r0, #0
|
||||
movs r5, #0x38
|
||||
|
@ -102,41 +100,51 @@ _08016A64:
|
|||
bl UpdateSpriteForCollisionLayer
|
||||
pop {r4, r5, pc}
|
||||
|
||||
thumb_func_start sub_08016A6C
|
||||
sub_08016A6C: @ 0x08016A6C
|
||||
CheckOnLayerTransition::
|
||||
push {r4, r5, lr}
|
||||
adds r4, r0, #0
|
||||
bl GetVvvAtEntity
|
||||
add r1, pc, #0x38
|
||||
_08016A76:
|
||||
adds r1, #4
|
||||
ldrh r2, [r1]
|
||||
bl GetVvvAtEntity // tile under me
|
||||
adr r1, gTransitionTiles-4
|
||||
loop:
|
||||
adds r1, #4 // p += 4
|
||||
ldrh r2, [r1] // *(u16*)(p)
|
||||
cmp r2, #0
|
||||
beq _08016A90
|
||||
beq not_found
|
||||
cmp r2, r0
|
||||
bne _08016A76
|
||||
bne loop // found the tile under me?
|
||||
movs r2, #0x38
|
||||
ldrb r3, [r4, r2]
|
||||
ldrb r5, [r1, #2]
|
||||
cmp r3, r5
|
||||
beq _08016A90
|
||||
ldrb r5, [r1, #3]
|
||||
strb r5, [r4, r2]
|
||||
_08016A90:
|
||||
ldrb r3, [r4, r2] // collision layer
|
||||
ldrb r5, [r1, #2] // *(u8*)(p + 2)
|
||||
cmp r3, r5 // am i on the right later?
|
||||
beq not_found
|
||||
ldrb r5, [r1, #3] // *(u8*)(p + 3)
|
||||
strb r5, [r4, r2] // move to a new layer
|
||||
not_found:
|
||||
pop {r4, r5, pc}
|
||||
.align 2, 0
|
||||
_08016A94:
|
||||
.byte 0x2A, 0x00, 0x03, 0x03, 0x2D, 0x00, 0x03, 0x03, 0x2B, 0x00, 0x03, 0x03
|
||||
.byte 0x2C, 0x00, 0x03, 0x03, 0x4C, 0x00, 0x03, 0x03, 0x4E, 0x00, 0x03, 0x03, 0x4D, 0x00, 0x03, 0x03
|
||||
.byte 0x4F, 0x00, 0x03, 0x03, 0x0A, 0x00, 0x02, 0x01, 0x09, 0x00, 0x02, 0x01, 0x0C, 0x00, 0x01, 0x02
|
||||
.byte 0x0B, 0x00, 0x01, 0x02, 0x52, 0x00, 0x03, 0x03, 0x27, 0x00, 0x03, 0x03, 0x26, 0x00, 0x03, 0x03
|
||||
.byte 0x00, 0x00
|
||||
|
||||
non_word_aligned_thumb_func_start sub_08016AD2
|
||||
sub_08016AD2: @ 0x08016AD2
|
||||
transition_tile 0x2A, 3, 3
|
||||
transition_tile 0x2D, 3, 3
|
||||
transition_tile 0x2B, 3, 3
|
||||
transition_tile 0x2C, 3, 3
|
||||
transition_tile 0x4C, 3, 3
|
||||
transition_tile 0x4E, 3, 3
|
||||
transition_tile 0x4D, 3, 3
|
||||
transition_tile 0x4F, 3, 3
|
||||
gTransitionTiles:
|
||||
transition_tile 0x0A, 2, 1
|
||||
transition_tile 0x09, 2, 1
|
||||
transition_tile 0x0C, 1, 2
|
||||
transition_tile 0x0B, 1, 2
|
||||
transition_tile 0x52, 3, 3
|
||||
transition_tile 0x27, 3, 3
|
||||
transition_tile 0x26, 3, 3
|
||||
.short 0x0000
|
||||
|
||||
UpdateCollisionLayer::
|
||||
push {r4, lr}
|
||||
adds r4, r0, #0
|
||||
bl sub_08016A6C
|
||||
bl CheckOnLayerTransition
|
||||
push {r0}
|
||||
adds r0, r4, #0
|
||||
bl UpdateSpriteForCollisionLayer
|
||||
|
|
|
@ -66,7 +66,7 @@ SetMetaTile: @ r0 = tile type, r1, = tile position, r2 = layer
|
|||
strh r0, [r5, r6] @ gMapBottom.mapData[metaTilePos] = metaTile
|
||||
ldr r6, _0800020C @ =0x00004000
|
||||
cmp r0, r6
|
||||
blo _0800019A @ jump if metaTile < 0x4000
|
||||
blo tile_wrong_type @ jump if metaTile < 0x4000
|
||||
push {r1, r2}
|
||||
subs r4, r0, r6 @ r4 = metaTile - 0x4000
|
||||
ldr r3, _08000210 @ =gMapSpecialMetaTileToVvv
|
||||
|
@ -78,12 +78,12 @@ SetMetaTile: @ r0 = tile type, r1, = tile position, r2 = layer
|
|||
bl SetCollisionData
|
||||
pop {r0, r1} @ tilepos, layer
|
||||
push {r0, r1}
|
||||
bl DeleteLoadedTileEntity @ DeleteLoadedTileEntity(metaTilePos, layer)
|
||||
bl UnregisterInteractTile @ DeleteLoadedTileEntity(metaTilePos, layer)
|
||||
adds r0, r7, #0 @ r0 = oldMetaTile
|
||||
pop {r1, r2}
|
||||
bl StoreMetaTileForSpecialTile @ StoreMetaTileForSpecialTile(oldMetaTile, metaTilePos, layer)
|
||||
bl RegisterInteractTile @ StoreMetaTileForSpecialTile(oldMetaTile, metaTilePos, layer)
|
||||
pop {r4, r5, r6, r7, pc} @ pop pc results in returning to the calling function
|
||||
_0800019A:
|
||||
tile_wrong_type:
|
||||
adds r3, #4 @ r3 = layer * 8 + 4
|
||||
ldr r4, [r4, r3]
|
||||
lsls r0, r0, #1 @ r0 = metaTile * 2
|
||||
|
@ -97,7 +97,7 @@ _0800019A:
|
|||
lsrs r2, r2, #2 @ r2 = layer
|
||||
bl SetCollisionData
|
||||
pop {r0, r1}
|
||||
bl DeleteLoadedTileEntity
|
||||
bl UnregisterInteractTile
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
.align 2, 0
|
||||
_080001C0: .4byte gMapBottom+0x6004
|
||||
|
@ -141,34 +141,34 @@ _08000220: .4byte gVvvPtrs
|
|||
_08000224: .4byte gMapDataPtrs
|
||||
|
||||
gMapDataPtrs::
|
||||
.4byte gMapBottom+0x0004 @ layer 0
|
||||
.4byte BOTTOM_TILEDATA @ layer 0
|
||||
gMetatileTypesPtrs::
|
||||
.4byte gMapBottom+0x5004
|
||||
.4byte gMapBottom+0x0004 @ layer 1
|
||||
.4byte gMapBottom+0x5004
|
||||
.4byte gMapTop+0x0004 @ layer 2
|
||||
.4byte gMapTop+0x5004
|
||||
.4byte gMapBottom+0x0004 @ layer 3
|
||||
.4byte gMapBottom+0x5004
|
||||
.4byte BOTTOM_METATILETYPES
|
||||
.4byte BOTTOM_TILEDATA @ layer 1
|
||||
.4byte BOTTOM_METATILETYPES
|
||||
.4byte TOP_TILEDATA @ layer 2
|
||||
.4byte TOP_METATILETYPES
|
||||
.4byte BOTTOM_TILEDATA @ layer 3
|
||||
.4byte BOTTOM_METATILETYPES
|
||||
gCollisionDataPtrs::
|
||||
.4byte gMapBottom+0x2004 @ layer 0
|
||||
.4byte gMapBottom+0x2004 @ layer 1
|
||||
.4byte gMapTop+0x2004 @ layer 2
|
||||
.4byte gMapBottom+0x2004 @ layer 3
|
||||
.4byte BOTTOM_COLLISIONDATA @ layer 0
|
||||
.4byte BOTTOM_COLLISIONDATA @ layer 1
|
||||
.4byte TOP_COLLISIONDATA @ layer 2
|
||||
.4byte BOTTOM_COLLISIONDATA @ layer 3
|
||||
gUnk_08000258:: @ mapDataClone and metatileTypes
|
||||
.4byte gMapBottom+0x3004 @ layer 0
|
||||
.4byte gMapBottom+0x5004
|
||||
.4byte gMapBottom+0x3004 @ layer 1
|
||||
.4byte gMapBottom+0x5004
|
||||
.4byte gMapTop+0x3004 @ layer 2
|
||||
.4byte gMapTop+0x5004
|
||||
.4byte gMapBottom+0x3004 @ layer 3
|
||||
.4byte gMapBottom+0x5004
|
||||
.4byte BOTTOM_TILEDATACLONE @ layer 0
|
||||
.4byte BOTTOM_METATILETYPES
|
||||
.4byte BOTTOM_TILEDATACLONE @ layer 1
|
||||
.4byte BOTTOM_METATILETYPES
|
||||
.4byte TOP_TILEDATACLONE @ layer 2
|
||||
.4byte TOP_METATILETYPES
|
||||
.4byte BOTTOM_TILEDATACLONE @ layer 3
|
||||
.4byte BOTTOM_METATILETYPES
|
||||
gVvvPtrs:: @ vvv for layers
|
||||
.4byte gMapBottom+0xb004 @ layer 0
|
||||
.4byte gMapBottom+0xb004 @ layer 1
|
||||
.4byte gMapTop+0xb004 @ layer 2
|
||||
.4byte gMapBottom+0xb004 @ layer 3
|
||||
.4byte BOTTOM_UNKDATA3 @ layer 0
|
||||
.4byte BOTTOM_UNKDATA3 @ layer 1
|
||||
.4byte TOP_UNKDATA3 @ layer 2
|
||||
.4byte BOTTOM_UNKDATA3 @ layer 3
|
||||
|
||||
@ call 0x80B19CC
|
||||
@ ========
|
||||
|
@ -365,8 +365,6 @@ GetCollisionDataAtRoomTile: @ 0x080002DC
|
|||
bx r3
|
||||
|
||||
@ call 0x080B1B44
|
||||
@ ========
|
||||
@ Unused? Doesn't seem to be called by anything in Ghidra.
|
||||
thumb_func_start GetCollisionDataAtMetaTilePos
|
||||
GetCollisionDataAtMetaTilePos: @ 0x080002E0
|
||||
ldr r3, _0800034C @ =ram_GetCollisionDataAtMetaTilePos
|
||||
|
|
|
@ -339,7 +339,7 @@ gUnk_0810B65C:: @ 0810B65C
|
|||
gUnk_0810B65E:: @ 0810B65E
|
||||
.incbin "npc5/gUnk_0810B65E.bin"
|
||||
|
||||
gUnk_0810B660:: @ 0810B660
|
||||
gZeldaFollowerText:: @ 0810B660
|
||||
.4byte gUnk_0810B650
|
||||
.4byte gUnk_0810B652
|
||||
.4byte gUnk_0810B654
|
||||
|
|
|
@ -21,11 +21,21 @@ extern void GenericKnockback(struct Entity_*);
|
|||
extern u32 GetFuserId(struct Entity_*);
|
||||
extern u32 CheckPlayerInRegion(u32 centerX, u32 centerY, u32 radiusX, u32 radiusY);
|
||||
extern u32 GravityUpdate(struct Entity_* entity, u32 gravity);
|
||||
enum {
|
||||
BOUNCE_DONE_ALL,
|
||||
BOUNCE_INIT_NEXT,
|
||||
BOUNCE_AIRBORNE,
|
||||
};
|
||||
u32 BounceUpdate(struct Entity_*, u32 acceleration);
|
||||
extern u32 CheckOnScreen(struct Entity_*);
|
||||
extern bool32 EntityInRectRadius(struct Entity_*, struct Entity_*, u32, u32);
|
||||
extern void UpdateAnimationVariableFrames(struct Entity_*, u32);
|
||||
extern u32 sub_080043E8(struct Entity_*);
|
||||
extern void sub_08004484(struct Entity_*, struct Entity_*);
|
||||
extern u32 GetTileHazardType(struct Entity_*);
|
||||
/**
|
||||
* Basic collision, only used between player and dazed enemies.
|
||||
* (Probablity leftover from Four Swords)
|
||||
*/
|
||||
extern void CalcCollisionStaticEntity(struct Entity_*, struct Entity_*);
|
||||
extern void ResetCollisionLayer(struct Entity_*);
|
||||
extern void sub_08004596(struct Entity_*, u32);
|
||||
extern u32 sub_080045B4(struct Entity_*, u32, u32);
|
||||
|
|
|
@ -6,6 +6,16 @@
|
|||
|
||||
/** Collisions. */
|
||||
|
||||
enum {
|
||||
COL_LANTERN = 0x7,
|
||||
COL_SMALL_GUST = 0x13,
|
||||
COL_BOOMERANG = 0x14,
|
||||
COL_ARROW = 0x15,
|
||||
COL_BIG_GUST = 0x1b,
|
||||
COL_PACCI = 0x1d,
|
||||
COL_SWORD_BEAM = 0x21,
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
COL_NONE = 0x0,
|
||||
COL_NORTH_WEST = 0x2,
|
||||
|
|
|
@ -11,9 +11,9 @@ struct Entity_;
|
|||
typedef struct {
|
||||
u16 heldKeys; /**< Keys held since last frame. */
|
||||
u16 newKeys; /** Keys newly pressed this frame. */
|
||||
u16 unk4;
|
||||
u16 menuScrollKeys;
|
||||
u8 unk6;
|
||||
u8 unk7;
|
||||
u8 menuScrollTimer;
|
||||
} Input;
|
||||
extern Input gInput; /**< Input instance. */
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ typedef struct EnemyDefinition {
|
|||
u8 health;
|
||||
s16 speed;
|
||||
u8 damageType;
|
||||
u8 flags2;
|
||||
u8 collisionMask;
|
||||
} EnemyDefinition;
|
||||
|
||||
typedef struct ProjectileDefinition {
|
||||
|
@ -43,7 +43,7 @@ typedef struct ProjectileDefinition {
|
|||
u8 field0x40;
|
||||
s16 speed;
|
||||
u8 damageType;
|
||||
u8 flags2;
|
||||
u8 collisionMask;
|
||||
} ProjectileDefinition;
|
||||
|
||||
// Sprite data definition for objects and npcs
|
||||
|
|
|
@ -12,7 +12,35 @@
|
|||
#include "entity.h"
|
||||
#include "projectile.h"
|
||||
|
||||
bool32 EnemyInit(Entity* this);
|
||||
#define EM_FLAG_BOSS (1 << 0)
|
||||
#define EM_FLAG_BOSS_KILLED (1 << 1)
|
||||
#define EM_FLAG_HAS_HOME (1 << 2)
|
||||
#define EM_FLAG_NO_DEATH_FX (1 << 3)
|
||||
#define EM_FLAG_SUPPORT (1 << 4)
|
||||
#define EM_FLAG_CAPTAIN (1 << 5)
|
||||
#define EM_FLAG_MONITORED (1 << 6)
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
Entity* child;
|
||||
u8 idx;
|
||||
u8 enemyFlags;
|
||||
u8 rangeX;
|
||||
u8 rangeY;
|
||||
s16 homeX;
|
||||
s16 homeY;
|
||||
/*0x74*/ union SplitHWord field_0x74;
|
||||
/*0x76*/ union SplitHWord field_0x76;
|
||||
/*0x78*/ union SplitHWord field_0x78;
|
||||
/*0x7a*/ union SplitHWord field_0x7a;
|
||||
/*0x7c*/ union SplitWord field_0x7c;
|
||||
/*0x80*/ union SplitHWord field_0x80;
|
||||
/*0x82*/ union SplitHWord field_0x82;
|
||||
/*0x84*/ union SplitHWord cutsceneBeh;
|
||||
/*0x86*/ union SplitHWord field_0x86;
|
||||
} Enemy;
|
||||
|
||||
bool32 EnemyInit(Enemy* this);
|
||||
/**
|
||||
* 0: _OnTick
|
||||
* 1: _OnCollision
|
||||
|
@ -25,16 +53,15 @@ u32 GetNextFunction(Entity*);
|
|||
void EnemyFunctionHandler(Entity*, EntityActionArray);
|
||||
void EnemyFunctionHandlerAfterCollision(Entity*, void (*const[])());
|
||||
void GenericKnockback(Entity*);
|
||||
Entity* CreateDeathFx(Entity*, u32, u32);
|
||||
void EnemyCreateDeathFX(Enemy*, u32, u32);
|
||||
void sub_0804A720(Entity*);
|
||||
bool32 sub_08049FDC(Entity*, u32);
|
||||
|
||||
Entity* Create0x68FX(Entity*, u32);
|
||||
void SetChildOffset(Entity*, s32, s32, s32);
|
||||
Entity* CreateProjectileWithParent(Entity*, u8, u8);
|
||||
Entity* EnemyCreateFX(Entity*, u32);
|
||||
void EnemySetFXOffset(Entity*, s32, s32, s32);
|
||||
Entity* EnemyCreateProjectile(Entity*, u32, u32);
|
||||
|
||||
void GenericDeath(Entity*);
|
||||
void sub_08002724(void*, u8*);
|
||||
void sub_080026C4(u8*, u8*, u8*, u32);
|
||||
void sub_080026F2(u8*, void*, u8*, u32);
|
||||
bool32 sub_08049FA0(Entity*);
|
||||
|
@ -43,14 +70,14 @@ bool32 sub_08049F84(Entity*, s32);
|
|||
Entity* sub_08049DF4(u32);
|
||||
u32 sub_0804A044(Entity*, Entity*, u32);
|
||||
s32 sub_080012DC(Entity*);
|
||||
u32 sub_080044EC(Entity*, u32);
|
||||
void sub_0804AA1C(Entity*);
|
||||
|
||||
void EnemyDetachFX(Entity*);
|
||||
bool32 sub_08049F1C(Entity*, Entity*, s32);
|
||||
bool32 PlayerInRange(Entity*, u32, s32);
|
||||
void sub_0804A4E4(Entity*, Entity*);
|
||||
void EnemyCopyParams(Entity*, Entity*);
|
||||
void GenericKnockback2(Entity*);
|
||||
|
||||
typedef enum {
|
||||
enum {
|
||||
/*0x00*/ OCTOROK,
|
||||
/*0x01*/ CHUCHU,
|
||||
/*0x02*/ LEEVER,
|
||||
|
@ -154,7 +181,7 @@ typedef enum {
|
|||
/*0x64*/ ENEMY_64,
|
||||
/*0x65*/ TREE_ITEM,
|
||||
/*0x66*/ ENEMY_66
|
||||
} Enemy;
|
||||
};
|
||||
|
||||
void Octorok();
|
||||
void Chuchu();
|
||||
|
|
|
@ -79,6 +79,40 @@ typedef enum {
|
|||
DirectionNorthWest = 0x1c, /**< North West. */
|
||||
} Direction;
|
||||
|
||||
/** Collision layer flags. */
|
||||
typedef enum {
|
||||
COL_LAYER_NONE = 0x0,
|
||||
COL_LAYER_BOTTOM = 0x1,
|
||||
COL_LAYER_TOP = 0x2,
|
||||
COL_LAYER_BOTH = 0x3
|
||||
} CollisionLayer;
|
||||
|
||||
/**
|
||||
* Collision class flags.
|
||||
* An Entity's collision class is determined by the first 3 bits of #Entity::collisionFlags.
|
||||
* What classes an Entity collides with is determined by the bitfield #Entity::collisionMask.
|
||||
*/
|
||||
typedef enum {
|
||||
COL_CLASS_NONE = 0x0,
|
||||
COL_CLASS_PLAYER = 0x1,
|
||||
COL_CLASS_ITEM = 0x2,
|
||||
COL_CLASS_FLAMMABLE = 0x3,
|
||||
COL_CLASS_4 = 0x4,
|
||||
COL_CLASS_5 = 0x5,
|
||||
COL_CLASS_6 = 0x6,
|
||||
COL_CLASS_PACCI_OBJ = 0x7,
|
||||
} CollisionClass;
|
||||
|
||||
/** Collision flags. */
|
||||
typedef enum {
|
||||
COL_FLAG_3D = 0x10,
|
||||
COL_FLAG_SOLID = 0x20,
|
||||
COL_FLAG_REFLECT = 0x80,
|
||||
} CollisionFlags;
|
||||
|
||||
#define COLLISION_MASK(layer) (1 << (layer))
|
||||
#define CONTACT_NOW 0x80
|
||||
|
||||
typedef struct {
|
||||
void* entity1;
|
||||
void* entity2;
|
||||
|
@ -192,11 +226,11 @@ typedef struct Entity_ {
|
|||
/*0x2c*/ union SplitWord x; /**< X position, fixed point Q16.16. */
|
||||
/*0x30*/ union SplitWord y; /**< Y position, fixed point Q16.16. */
|
||||
/*0x34*/ union SplitWord z; /**< Z position, fixed point Q16.16. */
|
||||
/*0x38*/ u8 collisionLayer; /**< Collision layer. */
|
||||
/*0x38*/ u8 collisionLayer; /**< @see CollisionLayer. */
|
||||
/*0x39*/ s8 interactType;
|
||||
/*0x3a*/ u8 gustJarState; /**< 4: grabbed by GustJar */
|
||||
/*0x3b*/ u8 flags2; /**< Debug visualization related? */
|
||||
/*0x3c*/ u8 collisionFlags; /**< Controls collision modes. */
|
||||
/*0x3b*/ u8 collisionMask; /**< Bitfield. @see CollisionClass */
|
||||
/*0x3c*/ u8 collisionFlags; /**< @see CollisionFlags, @see CollisionClass */
|
||||
/*0x3d*/ s8 iframes; /**< Invulnerability frames. */
|
||||
/*0x3e*/ u8 knockbackDirection; /**< Direction of knockback. */
|
||||
/*0x3f*/ u8 hitType; /**< Behavior as a collision sender. */
|
||||
|
|
|
@ -14,10 +14,10 @@
|
|||
// Identified - to be sorted into header files
|
||||
extern u32 CheckRegionOnScreen(u32, u32, u32, u32);
|
||||
extern void CopyOAM(void);
|
||||
extern void CreateChestSpawner(Entity*);
|
||||
extern void CreateLavaDrownFX(Entity*);
|
||||
extern Entity* CreateGroundItem(Entity*, u32, u32);
|
||||
extern Entity* CreateGroundItemWithFlags(Entity*, u32, u32, u32);
|
||||
extern void CreateItemOnGround(Entity*);
|
||||
extern void CreatePitFallFX(Entity*);
|
||||
extern void CreateMagicSparkles(u32, u32, u32);
|
||||
extern void CreateMinishEntrance(u32 tile);
|
||||
extern u32 CreateRandomItemDrop(Entity*, u32);
|
||||
|
@ -50,31 +50,31 @@ extern void SetBGDefaults(void);
|
|||
extern u32 sub_080B1A0C(Entity*, s32, s32);
|
||||
extern s32 sub_080012DC(Entity*);
|
||||
extern void sub_08001318(Entity*);
|
||||
extern void sub_080027EA(Entity*, u32, u32);
|
||||
extern void LinearMoveDirectionOLD(Entity*, u32, u32);
|
||||
extern void sub_080028E0(Entity*);
|
||||
extern u32 sub_080040A2(Entity*);
|
||||
extern u32 sub_080040D8(Entity*, u8*, s32, s32);
|
||||
extern void sub_08004168(Entity*);
|
||||
extern void SnapToTile(Entity*);
|
||||
extern u32 sub_0800419C(Entity*, Entity*, u32, u32);
|
||||
extern u32 sub_080041DC(Entity*, u32, u32);
|
||||
extern void sub_080042BA(Entity*, u32);
|
||||
extern void sub_080042D0(Entity*, u32, u16);
|
||||
extern void sub_080043A8(Entity*);
|
||||
extern void CreateDrownFX(Entity*);
|
||||
extern u32 sub_0800445C(Entity*);
|
||||
extern void sub_080044AE(Entity*, u32, u32);
|
||||
extern u32 sub_080044EC(Entity*, u32);
|
||||
extern u32 BounceUpdate(Entity*, u32);
|
||||
extern void sub_0800451C(Entity*);
|
||||
extern void sub_08004542(Entity*);
|
||||
extern void sub_080085B0(Entity*);
|
||||
extern u16* sub_08008796(Entity*, u32, u32, u32);
|
||||
extern void sub_08016AD2(Entity*);
|
||||
extern u16* DoTileInteraction(Entity*, u32, u32, u32);
|
||||
extern void UpdateCollisionLayer(Entity*);
|
||||
extern u32 sub_0801766C(Entity*);
|
||||
extern void sub_0801AFE4(void);
|
||||
extern void UpdateUIElements(void);
|
||||
extern void sub_0801E104(void);
|
||||
extern void sub_08030118(u32);
|
||||
extern void sub_0803C0AC(Entity*);
|
||||
extern void SetRoomTrackerFlag(Entity*);
|
||||
extern void EnemyDisableRespawn(Entity*);
|
||||
extern u32 sub_0804A024(Entity*, u32, u32);
|
||||
extern u32 IsMinishItem(u32);
|
||||
extern void DisableRandomDrops();
|
||||
|
|
|
@ -19,7 +19,7 @@ typedef struct {
|
|||
/*0x0004*/ u16 mapData[0x40 * 0x40];
|
||||
/**< MetaTileIndex for each tile on the current layer. */ // tilemap data? <-- gMapDataTop / gMapDataBottom
|
||||
/*0x2004*/ u8 collisionData[0x40 * 0x40]; // more tilemap data? <-- gUnk_0200D654 / gUnk_02027EB4
|
||||
/*0x3004*/ u16 mapDataClone[0x40 * 0x40]; // more tilemap data? <-- gUnk_0200E654 / gUnk_02028EB4
|
||||
/*0x3004*/ u16 mapDataOriginal[0x40 * 0x40]; // more tilemap data? <-- gUnk_0200E654 / gUnk_02028EB4
|
||||
// Tileset
|
||||
/*0x5004*/ u16 metatileTypes[0x800];
|
||||
/**< Maps from the MetaTileIndex to the MetaTileType. */ // gMetatileTypesTop, gMetatileTypesBottom
|
||||
|
|
|
@ -18,11 +18,11 @@ typedef struct {
|
|||
u8 textWindowPosY;
|
||||
u16 textIndex;
|
||||
u16 unk2; // HI?
|
||||
u32 field_0xc;
|
||||
u32 rupees;
|
||||
u32 field_0x14;
|
||||
u32 field_0x18;
|
||||
u32 field_0x1c;
|
||||
u32 flags;
|
||||
u32 rupees; // item price, shells, minigame timer
|
||||
u32 field_0x14; // number of cuccos
|
||||
u32 field_0x18; // unused
|
||||
u32 field_0x1c; // unused
|
||||
} Message;
|
||||
extern Message gMessage;
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ typedef struct {
|
|||
/*0x6d*/ u8 unk_6d;
|
||||
/*0x6e*/ u8 unk_6e;
|
||||
/*0x6f*/ u8 unk_6f;
|
||||
/*0x70*/ Entity* unk_70;
|
||||
/*0x74*/ Entity* unk_74;
|
||||
/*0x70*/ Entity* pulledJarEntity;
|
||||
/*0x74*/ Entity* carriedEntity;
|
||||
/*0x78*/ u8 unk_78;
|
||||
/*0x79*/ u8 unk_79;
|
||||
/*0x7a*/ u16 unk_7a;
|
||||
|
@ -299,6 +299,24 @@ typedef enum {
|
|||
SWORD_MOVE_LOW_BEAM,
|
||||
} SwordMove;
|
||||
|
||||
typedef enum {
|
||||
PL_JAR_NONE = 0x0,
|
||||
PL_JAR_SUCK = 0x1,
|
||||
PL_JAR_2 = 0x2,
|
||||
PL_JAR_3 = 0x3,
|
||||
PL_JAR_BLAST_INIT = 0x4,
|
||||
PL_JAR_BLAST_UPDATE = 0x5,
|
||||
PL_JAR_BLAST_DONE = 0x6,
|
||||
PL_JAR_ENT_ATTACHED = 0x7,
|
||||
} GustJarState;
|
||||
|
||||
typedef enum {
|
||||
JAR_CHARGE_NONE = 0,
|
||||
JAR_CHARGE_SMALL = 1,
|
||||
JAR_CHARGE_MID = 2,
|
||||
JAR_CHARGE_BIG = 3,
|
||||
} GustJarCharge;
|
||||
|
||||
typedef enum {
|
||||
ANIM_DEFAULT = 0x100,
|
||||
ANIM_WALK = 0x104,
|
||||
|
@ -493,8 +511,8 @@ typedef struct {
|
|||
/*0x18*/ u16 startPosY;
|
||||
/*0x1a*/ u8 mobility;
|
||||
/*0x1b*/ u8 sword_state;
|
||||
/*0x1c*/ u8 field_0x1c;
|
||||
/*0x1d*/ u8 gustJarSpeed;
|
||||
/*0x1c*/ u8 gustJarState;
|
||||
/*0x1d*/ u8 gustJarCharge;
|
||||
/*0x1e*/ u8 dash_state;
|
||||
/*0x1f*/ u8 field_0x1f[2];
|
||||
/*0x21*/ u8 bow_state;
|
||||
|
@ -512,7 +530,7 @@ typedef struct {
|
|||
/*0x39*/ u8 field_0x39;
|
||||
/*0x3a*/ u8 field_0x3a;
|
||||
/*0x3b*/ u8 field_0x3b;
|
||||
/*0x3c*/ u8 field_0x3c;
|
||||
/*0x3c*/ u8 killed; /**< Non-zero if player is dead */
|
||||
/*0x3d*/ u8 moleMittsState;
|
||||
/*0x3e*/ u8 swordDamage : 2;
|
||||
/* */ u8 filler14 : 6;
|
||||
|
@ -762,7 +780,7 @@ void PlayerShrinkByRay(void);
|
|||
|
||||
// player.s
|
||||
extern u32 PlayerCheckNEastTile();
|
||||
extern u32* sub_08008790(Entity*, u32);
|
||||
extern u32* DoTileInteractionHere(Entity*, u32);
|
||||
extern void UpdateIcePlayerVelocity(Entity*);
|
||||
extern void sub_08008AC6(Entity*);
|
||||
extern void sub_08008926(Entity*);
|
||||
|
|
|
@ -89,11 +89,11 @@ typedef struct {
|
|||
u8 area;
|
||||
u8 room;
|
||||
u16 unk_02;
|
||||
u32 flags; /**< Flags that can be set on the tracked rooms. Used e.g. by the door mimic. (TODO probably to start in
|
||||
u32 enemyBits; /**< Flags that can be set on the tracked rooms. Used e.g. by the door mimic. (TODO probably to start in
|
||||
the discovered state?)*/
|
||||
} RoomMemory;
|
||||
|
||||
extern RoomMemory* gRoomMemoryPtr;
|
||||
extern RoomMemory* gCurrentRoomMemory;
|
||||
extern RoomMemory gRoomMemory[];
|
||||
|
||||
// Packets used to store which entities to load in a room
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef TILES_H
|
||||
#define TILES_H
|
||||
|
||||
|
||||
typedef enum {
|
||||
META_TILE_TYPE_0, // 0x0
|
||||
META_TILE_TYPE_1, // 0x1
|
||||
|
@ -1558,22 +1559,22 @@ typedef enum {
|
|||
} SpecialMetaTile;
|
||||
|
||||
typedef enum {
|
||||
VVV_0 = 0,
|
||||
VVV_1 = 1,
|
||||
VVV_2 = 2,
|
||||
VVV_3 = 3,
|
||||
VVV_4 = 4,
|
||||
VVV_5 = 5,
|
||||
VVV_6 = 6,
|
||||
VVV_7 = 7,
|
||||
VVV_8 = 8, // -> SURFACE_7
|
||||
VVV_9 = 9, // sub_0801FDE4(leever)
|
||||
VVV_10 = 10, // sub_0801FDE4(leever), sub_08025AB8(puffstool)
|
||||
VVV_0 = 0, // TILE_ACT_CUT
|
||||
VVV_1 = 1, // TILE_ACT_ROCKBREAKER
|
||||
VVV_2 = 2, // TILE_ACT_BOOMERANG
|
||||
VVV_3 = 3, // TILE_ACT_BOMB
|
||||
VVV_4 = 4, // TILE_ACT_ARROW
|
||||
VVV_5 = 5, // TILE_ACT_GUST
|
||||
VVV_6 = 6, // TILE_ACT_LIFT
|
||||
VVV_7 = 7, // TILE_ACT_FIRE
|
||||
VVV_8 = 8, // TILE_ACT_PLAYER_WALK -> SURFACE_7
|
||||
VVV_9 = 9, // TILE_ACT_ENEMY_WALK sub_0801FDE4(leever)
|
||||
VVV_10 = 10, // TILE_ACT_PACCI sub_0801FDE4(leever), sub_08025AB8(puffstool)
|
||||
VVV_11 = 11, // sub_0801FDE4(leever)
|
||||
VVV_12 = 12, // sub_0801FDE4(leever)
|
||||
VVV_13 = 13, // -> SURFACE_PIT, sub_08094E30(cutsceneMiscObject), sub_08085B40(lilypadLarge), Pot_Action1,
|
||||
VVV_12 = 12, // TILE_ACT_SWORDBEAM sub_0801FDE4(leever)
|
||||
VVV_13 = 13, // TILE_ACT_DIG -> SURFACE_PIT, sub_08094E30(cutsceneMiscObject), sub_08085B40(lilypadLarge), Pot_Action1,
|
||||
// sub_080AD040(playerItemHeldObject), UpdatePlayerCollision, sub_0807B434(playerUtils), FX_FALL_DOWN
|
||||
VVV_14 = 14, // -> SURFACE_SLOPE_GNDWATER
|
||||
VVV_14 = 14, // TILE_ACT_MINIGUST -> SURFACE_SLOPE_GNDWATER
|
||||
VVV_15 = 15, // -> SURFACE_SHALLOW_WATER, SPECIAL_META_TILE_145
|
||||
VVV_16 = 16, // -> SURFACE_WATER, sub_0801FBD0(chuchu), PlayerItemBottle_UseEmptyBottle, SPECIAL_META_TILE_137 -
|
||||
// 140, sub_080AD040(playerItemHeldObject), FX_WATER_SPLASH
|
||||
|
|
|
@ -84,7 +84,7 @@ SECTIONS {
|
|||
. = 0x000344A0; gUnk_020344A0 = .;
|
||||
. = 0x000344B0; gBG2Buffer = .;
|
||||
. = 0x00034CB0; gBG0Buffer = .;
|
||||
. = 0x000354B0; gRoomMemoryPtr = .;
|
||||
. = 0x000354B0; gCurrentRoomMemory = .;
|
||||
. = 0x000354B4; gManagerCount = .;
|
||||
. = 0x000354C0; gUnk_020354C0 = .;
|
||||
. = 0x00035540; gzHeap = .;
|
||||
|
@ -384,7 +384,6 @@ SECTIONS {
|
|||
src/code_08049CD4.o(.text); /* enemyUtils.c */
|
||||
src/code_08049DF4.o(.text);
|
||||
src/enemyUtils.o(.text);
|
||||
src/createEnemy.o(.text);
|
||||
src/enterPortalSubtask.o(.text);
|
||||
src/room.o(.text);
|
||||
src/roomInit.o(.text);
|
||||
|
|
|
@ -208,7 +208,7 @@ u32 UpdatePlayerCollision(void) {
|
|||
((gPlayerState.sword_state & 0x10) != 0)) ||
|
||||
((sub_080806BC(gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x,
|
||||
gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y, index, 5) == 0 &&
|
||||
(((gPlayerState.heldObject != 0 || ((gPlayerState.field_0x1c & 0xf) != 0)) ||
|
||||
(((gPlayerState.heldObject != 0 || ((gPlayerState.gustJarState & 0xf) != 0)) ||
|
||||
(sub_0807BD14(&gPlayerEntity.base, index) == 0)))))) {
|
||||
return 3;
|
||||
}
|
||||
|
@ -640,7 +640,7 @@ bool32 sub_0801A370(MapLayer* mapLayer, u32 position) {
|
|||
if (!sub_0801A4F8()) {
|
||||
return FALSE;
|
||||
}
|
||||
topLayer = GetLayerByIndex(2);
|
||||
topLayer = GetLayerByIndex(LAYER_TOP);
|
||||
offset = gUnk_080B4488[gPlayerEntity.base.animationState >> 1];
|
||||
pos = position + offset;
|
||||
tileType = GetMetaTileType(pos, gPlayerEntity.base.collisionLayer);
|
||||
|
@ -932,7 +932,7 @@ u32 sub_0801A8D0(Entity* this, u32 param_2) {
|
|||
bool32 sub_0801A980(void) {
|
||||
u16 tileType;
|
||||
const s16* ptr;
|
||||
GetLayerByIndex(gPlayerEntity.base.collisionLayer);
|
||||
GetLayerByIndex(gPlayerEntity.base.collisionLayer); // TODO result unused?
|
||||
ptr = &gUnk_080B44A8[gPlayerEntity.base.animationState & 6];
|
||||
tileType =
|
||||
GetMetaTileType(COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr[0], -ptr[1]), gPlayerEntity.base.collisionLayer);
|
||||
|
@ -1009,7 +1009,7 @@ bool32 sub_0801AA58(Entity* this, u32 param_2, u32 param_3) {
|
|||
void RenderMapLayerToTileMap(u16* tileMap, MapLayer* mapLayer) {
|
||||
u16* tiles;
|
||||
u16* mapData;
|
||||
u16* mapDataClone;
|
||||
u16* mapDataOriginal;
|
||||
u16 metaTileY;
|
||||
u16 metaTileX;
|
||||
u32 metaTilePositionAndLayer;
|
||||
|
@ -1023,7 +1023,7 @@ void RenderMapLayerToTileMap(u16* tileMap, MapLayer* mapLayer) {
|
|||
layerIndex = 2;
|
||||
}
|
||||
metaTilePositionAndLayer = layerIndex << 0xc;
|
||||
mapDataClone = mapLayer->mapDataClone;
|
||||
mapDataOriginal = mapLayer->mapDataOriginal;
|
||||
mapData = mapLayer->mapData;
|
||||
|
||||
for (metaTileY = 0; metaTileY < 0x40; metaTileY++) {
|
||||
|
@ -1033,7 +1033,7 @@ void RenderMapLayerToTileMap(u16* tileMap, MapLayer* mapLayer) {
|
|||
if (mapData[0] < 0x4000) {
|
||||
metaTileSetIndex = mapData[0] * 4;
|
||||
} else {
|
||||
metaTileSetIndex = GetMetaTileSetIndexForSpecialTile(metaTilePositionAndLayer, mapDataClone[0]);
|
||||
metaTileSetIndex = GetMetaTileSetIndexForSpecialTile(metaTilePositionAndLayer, mapDataOriginal[0]);
|
||||
}
|
||||
tiles = mapLayer->metatiles + metaTileSetIndex;
|
||||
tileMap[0] = tiles[0];
|
||||
|
@ -1045,7 +1045,7 @@ void RenderMapLayerToTileMap(u16* tileMap, MapLayer* mapLayer) {
|
|||
if (mapData[1] < 0x4000) {
|
||||
metaTileSetIndex = mapData[1] * 4;
|
||||
} else {
|
||||
metaTileSetIndex = GetMetaTileSetIndexForSpecialTile(metaTilePositionAndLayer + 1, mapDataClone[1]);
|
||||
metaTileSetIndex = GetMetaTileSetIndexForSpecialTile(metaTilePositionAndLayer + 1, mapDataOriginal[1]);
|
||||
}
|
||||
tiles = mapLayer->metatiles + metaTileSetIndex;
|
||||
tileMap[0] = tiles[0];
|
||||
|
@ -1057,7 +1057,7 @@ void RenderMapLayerToTileMap(u16* tileMap, MapLayer* mapLayer) {
|
|||
if (mapData[2] < 0x4000) {
|
||||
metaTileSetIndex = mapData[2] * 4;
|
||||
} else {
|
||||
metaTileSetIndex = GetMetaTileSetIndexForSpecialTile(metaTilePositionAndLayer + 2, mapDataClone[2]);
|
||||
metaTileSetIndex = GetMetaTileSetIndexForSpecialTile(metaTilePositionAndLayer + 2, mapDataOriginal[2]);
|
||||
}
|
||||
tiles = mapLayer->metatiles + metaTileSetIndex;
|
||||
tileMap[0] = tiles[0];
|
||||
|
@ -1069,7 +1069,7 @@ void RenderMapLayerToTileMap(u16* tileMap, MapLayer* mapLayer) {
|
|||
if (mapData[3] < 0x4000) {
|
||||
metaTileSetIndex = mapData[3] * 4;
|
||||
} else {
|
||||
metaTileSetIndex = GetMetaTileSetIndexForSpecialTile(metaTilePositionAndLayer + 3, mapDataClone[3]);
|
||||
metaTileSetIndex = GetMetaTileSetIndexForSpecialTile(metaTilePositionAndLayer + 3, mapDataOriginal[3]);
|
||||
}
|
||||
tiles = mapLayer->metatiles + metaTileSetIndex;
|
||||
tileMap[0] = tiles[0];
|
||||
|
@ -1079,7 +1079,7 @@ void RenderMapLayerToTileMap(u16* tileMap, MapLayer* mapLayer) {
|
|||
tileMap += 2;
|
||||
|
||||
mapData += 4;
|
||||
mapDataClone += 4;
|
||||
mapDataOriginal += 4;
|
||||
metaTilePositionAndLayer = (u16)(metaTilePositionAndLayer + 4);
|
||||
}
|
||||
tileMap = tileMap + 0x80;
|
||||
|
@ -1229,7 +1229,7 @@ void SetMultipleTiles(const TileData* tileData, u32 basePosition, u32 layer) {
|
|||
}
|
||||
|
||||
// Add a new entry at the end of gMetaTilesForSpecialTiles
|
||||
void StoreMetaTileForSpecialTile(u32 metaTileIndex, u32 metaTilePos, u32 layer) {
|
||||
void RegisterInteractTile(u32 metaTileIndex, u32 metaTilePos, u32 layer) {
|
||||
u32 index;
|
||||
if ((metaTileIndex < 0x4000) && (gRoomTransition.field30 == 0)) {
|
||||
index = gRoomVars.tileEntityCount;
|
||||
|
@ -1241,7 +1241,7 @@ void StoreMetaTileForSpecialTile(u32 metaTileIndex, u32 metaTilePos, u32 layer)
|
|||
}
|
||||
}
|
||||
|
||||
void DeleteLoadedTileEntity(u32 metaTilePos, s32 layer) {
|
||||
void UnregisterInteractTile(u32 metaTilePos, s32 layer) {
|
||||
u32 count;
|
||||
SpecialTileEntry* ptr;
|
||||
u32 metaTilePosAndLayer;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "global.h"
|
||||
#include "room.h"
|
||||
#include "enemy.h"
|
||||
|
||||
extern void MemFill32(u32, void*, u32);
|
||||
|
||||
|
@ -8,35 +9,35 @@ RoomMemory* AddCurrentRoom(void);
|
|||
|
||||
void ClearRoomMemory(void) {
|
||||
MemFill32(0xFFFFFFFF, gRoomMemory, 0x40);
|
||||
gRoomMemoryPtr = gRoomMemory;
|
||||
gCurrentRoomMemory = gRoomMemory;
|
||||
}
|
||||
|
||||
void SetRoomTrackerFlag(GenericEntity* ent) {
|
||||
u8 field_0x6c = ent->field_0x6c.HALF.LO;
|
||||
if (field_0x6c & 0x80) {
|
||||
gRoomMemoryPtr->flags |= 1 << (field_0x6c & 0x1f);
|
||||
void EnemyDisableRespawn(Enemy* ent) {
|
||||
u8 idx = ent->idx;
|
||||
if (idx & 0x80) {
|
||||
gCurrentRoomMemory->enemyBits |= 1 << (idx & 0x1f);
|
||||
}
|
||||
}
|
||||
|
||||
bool32 IsRoomTrackerFlagSet(u32 arg0) {
|
||||
u32 bitmask = gRoomMemoryPtr->flags >> arg0;
|
||||
u32 EnemyEnableRespawn(u32 enemyIdx) {
|
||||
u32 bitmask = gCurrentRoomMemory->enemyBits >> enemyIdx;
|
||||
u32 output = 1;
|
||||
output &= ~bitmask;
|
||||
return output;
|
||||
}
|
||||
|
||||
void UpdateRoomTracker(void) {
|
||||
gRoomMemoryPtr = gRoomMemory;
|
||||
gCurrentRoomMemory = gRoomMemory;
|
||||
|
||||
do {
|
||||
if (gRoomMemoryPtr->area == gRoomControls.area && gRoomMemoryPtr->room == gRoomControls.room) {
|
||||
UpdateCurrentRoom(gRoomMemoryPtr);
|
||||
if (gCurrentRoomMemory->area == gRoomControls.area && gCurrentRoomMemory->room == gRoomControls.room) {
|
||||
UpdateCurrentRoom(gCurrentRoomMemory);
|
||||
return;
|
||||
}
|
||||
gRoomMemoryPtr++;
|
||||
gCurrentRoomMemory++;
|
||||
|
||||
} while (gRoomMemoryPtr < gRoomMemory + 8);
|
||||
gRoomMemoryPtr = AddCurrentRoom();
|
||||
} while (gCurrentRoomMemory < gRoomMemory + 8);
|
||||
gCurrentRoomMemory = AddCurrentRoom();
|
||||
}
|
||||
|
||||
RoomMemory* AddCurrentRoom(void) {
|
||||
|
@ -54,7 +55,7 @@ RoomMemory* AddCurrentRoom(void) {
|
|||
rm->room = gRoomControls.room;
|
||||
|
||||
rm->unk_02 = 0xFFFF;
|
||||
rm->flags = 0;
|
||||
rm->enemyBits = 0;
|
||||
|
||||
UpdateCurrentRoom(rm);
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
extern Entity* gUnk_020000B0;
|
||||
extern Entity* (*const gUnk_080D3BE8[])(void);
|
||||
|
||||
extern void ReplaceMonitoredEntity(Entity*, Entity*);
|
||||
|
||||
Entity* sub_08049DF4(u32 arg0) {
|
||||
if (gUnk_020000B0 != NULL) {
|
||||
return gUnk_020000B0;
|
||||
|
@ -20,7 +18,7 @@ Entity* sub_08049DF4(u32 arg0) {
|
|||
}
|
||||
|
||||
Entity* sub_08049E18(void) {
|
||||
if ((gPlayerState.field_0x3c == 0) &&
|
||||
if ((gPlayerState.killed == 0) &&
|
||||
!(gPlayerState.flags &
|
||||
(PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_DISABLE_ITEMS | PL_FALLING | PL_FROZEN |
|
||||
PL_IN_MINECART | PL_PIT_IS_EXIT | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_CONVEYOR_PUSHED | PL_CLIMBING))) {
|
||||
|
@ -31,7 +29,7 @@ Entity* sub_08049E18(void) {
|
|||
}
|
||||
|
||||
Entity* sub_08049E4C(void) {
|
||||
if ((gPlayerState.field_0x3c == 0) &&
|
||||
if ((gPlayerState.killed == 0) &&
|
||||
!(gPlayerState.flags & (PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_MINISH |
|
||||
PL_DISABLE_ITEMS | PL_FALLING | PL_FROZEN | PL_IN_MINECART | PL_PIT_IS_EXIT |
|
||||
PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_CONVEYOR_PUSHED | PL_CLIMBING))) {
|
||||
|
@ -42,7 +40,7 @@ Entity* sub_08049E4C(void) {
|
|||
}
|
||||
|
||||
Entity* sub_08049E80(void) {
|
||||
if ((gPlayerState.field_0x3c != 0) || !(gPlayerState.flags & PL_MINISH)) {
|
||||
if ((gPlayerState.killed != 0) || !(gPlayerState.flags & PL_MINISH)) {
|
||||
return NULL;
|
||||
}
|
||||
gUnk_020000B0 = &gPlayerEntity.base;
|
||||
|
@ -50,7 +48,7 @@ Entity* sub_08049E80(void) {
|
|||
}
|
||||
|
||||
Entity* sub_08049EB0(void) {
|
||||
if ((gPlayerState.field_0x3c == 0) &&
|
||||
if ((gPlayerState.killed == 0) &&
|
||||
!(gPlayerState.flags & (PL_MOLDWORM_CAPTURED | PL_DISABLE_ITEMS | PL_MINISH | PL_CAPTURED))) {
|
||||
gUnk_020000B0 = &gPlayerEntity.base;
|
||||
return &gPlayerEntity.base;
|
||||
|
@ -311,21 +309,3 @@ bool32 sub_0804A4BC(u8* from, u8* to, s32 step, u32 bitmask) {
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_0804A4E4(Entity* entA, Entity* entB) {
|
||||
GenericEntity* r5 = (GenericEntity*)entA;
|
||||
GenericEntity* r6 = (GenericEntity*)entB;
|
||||
|
||||
r6->field_0x6c.HALF.HI = (r5->field_0x6c.HALF.HI & 0x40) | 4;
|
||||
r6->field_0x6c.HALF.LO = r5->field_0x6c.HALF.LO;
|
||||
r6->field_0x70.HALF.LO = r5->field_0x70.HALF.LO;
|
||||
r6->field_0x70.HALF.HI = r5->field_0x70.HALF.HI;
|
||||
r6->field_0x6e.HALF.LO = r5->field_0x6e.HALF.LO;
|
||||
r6->field_0x6e.HALF.HI = r5->field_0x6e.HALF.HI;
|
||||
|
||||
CopyPositionAndSpriteOffset(&r5->base, &r6->base);
|
||||
|
||||
if (r5->field_0x6c.HALF.HI & 0x40) {
|
||||
ReplaceMonitoredEntity(&r5->base, &r6->base);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -248,7 +248,7 @@ s32 CalculateDamage(Entity* org, Entity* tgt) {
|
|||
}
|
||||
health = org->health - damage;
|
||||
if (org->kind == ENEMY) {
|
||||
if ((((GenericEntity*)org)->field_0x6c.HALF.HI & 1) != 0)
|
||||
if (((Enemy*)org)->enemyFlags & EM_FLAG_BOSS)
|
||||
SoundReqClipped(org, SFX_BOSS_HIT);
|
||||
else
|
||||
SoundReqClipped(org, SFX_HIT);
|
||||
|
@ -372,7 +372,7 @@ CollisionResult CollisionNoOp(Entity* org, Entity* tgt, u32 direction, ColSettin
|
|||
// target: item
|
||||
CollisionResult CollisionGroundItem(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
|
||||
COLLISION_OFF(tgt);
|
||||
tgt->contactFlags = org->hurtType | 0x80;
|
||||
tgt->contactFlags = org->hurtType | CONTACT_NOW;
|
||||
if ((tgt->type == 0x5F || tgt->type == 0x60) && sub_08081420(tgt))
|
||||
tgt->health = 0;
|
||||
return RESULT_COLLISION_WITHOUT_SET;
|
||||
|
@ -392,7 +392,7 @@ CollisionResult sub_08017B1C(Entity* org, Entity* tgt, u32 direction, ColSetting
|
|||
CollisionResult sub_08017B58(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
|
||||
if ((tgt->gustJarState & 4) != 0) {
|
||||
if (tgt->gustJarTolerance) {
|
||||
tgt->gustJarTolerance = tgt->gustJarTolerance - gPlayerState.gustJarSpeed;
|
||||
tgt->gustJarTolerance = tgt->gustJarTolerance - gPlayerState.gustJarCharge;
|
||||
if ((s8)tgt->gustJarTolerance <= 0) {
|
||||
tgt->gustJarTolerance = 0;
|
||||
tgt->subAction = 2;
|
||||
|
@ -504,7 +504,7 @@ CollisionResult sub_08017DD4(Entity* org, Entity* tgt, u32 direction, ColSetting
|
|||
sub_08079D84();
|
||||
org->iframes = 90;
|
||||
} else {
|
||||
gPlayerEntity.base.contactFlags = tgt->hurtType | 0x80;
|
||||
gPlayerEntity.base.contactFlags = tgt->hurtType | CONTACT_NOW;
|
||||
gPlayerEntity.base.iframes = 12;
|
||||
gPlayerEntity.base.knockbackDuration = 16;
|
||||
gPlayerEntity.base.knockbackDirection = DirectionTurnAround(direction);
|
||||
|
@ -581,7 +581,7 @@ CollisionResult sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSetting
|
|||
org->health = 0;
|
||||
}
|
||||
} else if (tgt->kind == ENEMY && org == &gPlayerEntity.base) {
|
||||
sub_08004484(tgt, org);
|
||||
CalcCollisionStaticEntity(tgt, org);
|
||||
}
|
||||
return RESULT_NO_COLLISION;
|
||||
}
|
||||
|
@ -671,14 +671,14 @@ CollisionResult sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSetting
|
|||
org->health = 0;
|
||||
}
|
||||
} else if ((tgt->kind == ENEMY) && (org == &gPlayerEntity.base)) {
|
||||
sub_08004484(tgt, &gPlayerEntity.base);
|
||||
CalcCollisionStaticEntity(tgt, &gPlayerEntity.base);
|
||||
}
|
||||
return RESULT_NO_COLLISION;
|
||||
}
|
||||
|
||||
CollisionResult sub_08018228(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
|
||||
if (org == &gPlayerEntity.base && PlayerCanBeMoved())
|
||||
sub_08004484(tgt, org);
|
||||
CalcCollisionStaticEntity(tgt, org);
|
||||
return RESULT_NO_COLLISION;
|
||||
}
|
||||
|
||||
|
@ -717,7 +717,7 @@ CollisionResult sub_080182A8(Entity* org, Entity* tgt, u32 direction, ColSetting
|
|||
CollisionResult CollisionDefault(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) {
|
||||
u32 confused = 0;
|
||||
if (tgt->confusedTime && tgt->kind == ENEMY && org == &gPlayerEntity.base) {
|
||||
sub_08004484(tgt, org);
|
||||
CalcCollisionStaticEntity(tgt, org);
|
||||
confused = 1;
|
||||
}
|
||||
if ((org->kind == PLAYER_ITEM && org->id == PL_ITEM_SHIELD) &&
|
||||
|
|
12
src/common.c
12
src/common.c
|
@ -210,15 +210,15 @@ static void StoreKeyInput(Input* input, u32 keyInput) {
|
|||
u32 difference = keyInput & ~heldKeys;
|
||||
input->newKeys = difference;
|
||||
if (keyInput == heldKeys) {
|
||||
if (--input->unk7 == 0) {
|
||||
input->unk7 = 4;
|
||||
input->unk4 = keyInput;
|
||||
if (--input->menuScrollTimer == 0) {
|
||||
input->menuScrollTimer = 4;
|
||||
input->menuScrollKeys = keyInput;
|
||||
} else {
|
||||
input->unk4 = 0;
|
||||
input->menuScrollKeys = 0;
|
||||
}
|
||||
} else {
|
||||
input->unk7 = 20;
|
||||
input->unk4 = difference;
|
||||
input->menuScrollTimer = 20;
|
||||
input->menuScrollKeys = difference;
|
||||
}
|
||||
input->heldKeys = keyInput;
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
#include "enemy.h"
|
||||
|
||||
/** Unsets bitfield 0x80 before calling GetNextFunction, so that the enemyFunction 1 is not called. */
|
||||
void EnemyFunctionHandlerAfterCollision(Entity* entity, void (*const fntable[])()) {
|
||||
u32 idx;
|
||||
entity->contactFlags &= ~0x80;
|
||||
idx = GetNextFunction(entity);
|
||||
entity->contactFlags |= 0x80;
|
||||
fntable[idx](entity);
|
||||
}
|
||||
|
||||
Entity* CreateEnemy(u32 subtype, u32 form) {
|
||||
Entity* enemy;
|
||||
|
||||
enemy = GetEmptyEntity();
|
||||
if (enemy != NULL) {
|
||||
enemy->kind = ENEMY;
|
||||
enemy->id = subtype;
|
||||
enemy->type = form;
|
||||
AppendEntityToList(enemy, 4);
|
||||
}
|
||||
return enemy;
|
||||
}
|
|
@ -73,7 +73,7 @@ void sub_0805FA98(void) {
|
|||
MessageInitialize();
|
||||
break;
|
||||
default:
|
||||
switch (gInput.unk4) {
|
||||
switch (gInput.menuScrollKeys) {
|
||||
case DPAD_LEFT:
|
||||
iVar1 = -1;
|
||||
break;
|
||||
|
|
|
@ -81,7 +81,7 @@ void AcroBandit(AcroBanditEntity* this) {
|
|||
gUnk_080012C8[index](super);
|
||||
} else {
|
||||
AcroBandit_Functions[GetNextFunction(super)](this);
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ void AcroBandit_OnTick(AcroBanditEntity* this) {
|
|||
void AcroBandit_OnCollision(AcroBanditEntity* this) {
|
||||
Entity* brother;
|
||||
|
||||
if (super->contactFlags != 0x80 && super->contactFlags != 0x81) {
|
||||
if (super->contactFlags != CONTACT_NOW && super->contactFlags != (CONTACT_NOW | 0x1)) {
|
||||
if (super->type == 1) {
|
||||
if (super->action < 7 && super->knockbackDuration != 0) {
|
||||
brother = super->child;
|
||||
|
@ -150,7 +150,7 @@ void AcroBandit_OnCollision(AcroBanditEntity* this) {
|
|||
}
|
||||
|
||||
if (super->confusedTime)
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
|
||||
EnemyFunctionHandlerAfterCollision(super, AcroBandit_Functions);
|
||||
}
|
||||
|
@ -528,7 +528,7 @@ void AcroBandit_Type1Action6(AcroBanditEntity* this) {
|
|||
void AcroBandit_Type1Action7(AcroBanditEntity* this) {
|
||||
ProcessMovement2(super);
|
||||
|
||||
if (sub_080044EC(super, 0x2000) == 0)
|
||||
if (BounceUpdate(super, Q_8_8(32.0)) == BOUNCE_DONE_ALL)
|
||||
super->action = 8;
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ void sub_08030150(ArmosEntity* this) {
|
|||
|
||||
void Armos(ArmosEntity* this) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)&gUnk_080CE124);
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
sub_08030150(this);
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ void sub_080301D4(ArmosEntity* this) {
|
|||
sub_080309E8(this);
|
||||
}
|
||||
if (super->confusedTime != 0) {
|
||||
Create0x68FX(super, 0x1c);
|
||||
EnemyCreateFX(super, 0x1c);
|
||||
}
|
||||
this->unk_81 = super->health;
|
||||
EnemyFunctionHandlerAfterCollision(super, gUnk_080CE124);
|
||||
|
@ -178,7 +178,7 @@ void sub_08030338(ArmosEntity* this) {
|
|||
if (super->frame == 2) {
|
||||
super->frame = 0;
|
||||
if (this->unk_80 != 2) {
|
||||
super->flags2 = 0xb;
|
||||
super->collisionMask = 0xb;
|
||||
super->hitType = 8;
|
||||
super->hitbox = (Hitbox*)&gUnk_080FD2F0;
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ void sub_08030580(ArmosEntity* this) {
|
|||
|
||||
void sub_08030590(ArmosEntity* this) {
|
||||
super->action = 5;
|
||||
super->flags2 = 1;
|
||||
super->collisionMask = 1;
|
||||
super->hitType = 1;
|
||||
super->hitbox = (Hitbox*)&gHitbox_15;
|
||||
sub_080309C8(this, 5);
|
||||
|
@ -339,7 +339,7 @@ bool32 sub_080305BC(ArmosEntity* this) {
|
|||
|
||||
bool32 sub_08030650(ArmosEntity* this) {
|
||||
if (super->type == 0) {
|
||||
if (super->contactFlags == 0x80) {
|
||||
if (super->contactFlags == CONTACT_NOW) {
|
||||
return 1;
|
||||
}
|
||||
} else if (this->unk_80 != 2) {
|
||||
|
|
|
@ -55,7 +55,7 @@ void BallChainSoldier_OnKnockback(BallChainSoldierEntity* this) {
|
|||
}
|
||||
|
||||
void BallChainSoldier_OnDeath(BallChainSoldierEntity* this) {
|
||||
CreateDeathFx(super, 0xff, 0x57);
|
||||
EnemyCreateDeathFX((Enemy*)super, 0xff, 0x57);
|
||||
}
|
||||
|
||||
void BallChainSoldier_OnGrabbed(BallChainSoldierEntity* this) {
|
||||
|
@ -64,7 +64,7 @@ void BallChainSoldier_OnGrabbed(BallChainSoldierEntity* this) {
|
|||
void BallChainSoldier_Init(BallChainSoldierEntity* this) {
|
||||
Entity* entity;
|
||||
sub_0804A720(super);
|
||||
entity = CreateProjectileWithParent(super, BALL_AND_CHAIN, 0);
|
||||
entity = EnemyCreateProjectile(super, BALL_AND_CHAIN, 0);
|
||||
if (entity == NULL)
|
||||
return;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ void Beetle_OnTick(BeetleEntity* this) {
|
|||
|
||||
void Beetle_OnCollision(BeetleEntity* this) {
|
||||
switch (super->contactFlags) {
|
||||
case 0x80:
|
||||
case CONTACT_NOW:
|
||||
if (gPlayerState.framestate == PL_STATE_CLIMB) {
|
||||
Beetle_OnTick(this);
|
||||
} else {
|
||||
|
@ -50,7 +50,7 @@ void Beetle_OnCollision(BeetleEntity* this) {
|
|||
InitializeAnimation(super, 6);
|
||||
}
|
||||
break;
|
||||
case 0x93:
|
||||
case CONTACT_NOW | 0x13:
|
||||
Beetle_OnTick(this);
|
||||
break;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ void Beetle_OnDeath(BeetleEntity* this) {
|
|||
entity->subtimer--;
|
||||
super->parent = NULL;
|
||||
}
|
||||
CreateDeathFx(super, 0xf0, 0);
|
||||
EnemyCreateDeathFX((Enemy*)super, 0xf0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ void sub_080218CC(BeetleEntity* this) {
|
|||
GetNextFrame(super);
|
||||
if (super->frame & 1) {
|
||||
ProcessMovement2(super);
|
||||
if (sub_080044EC(super, 0x1c00) == 0)
|
||||
if (BounceUpdate(super, Q_8_8(28.0)) == BOUNCE_DONE_ALL)
|
||||
super->frameDuration = 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ void Bobomb_OnTick(BobombEntity* this) {
|
|||
}
|
||||
|
||||
void Bobomb_OnCollision(BobombEntity* this) {
|
||||
if (super->contactFlags & 0x80) {
|
||||
if (super->contactFlags & CONTACT_NOW) {
|
||||
switch (super->contactFlags & 0x7f) {
|
||||
case 0:
|
||||
case 1:
|
||||
|
@ -250,7 +250,7 @@ void sub_0802CAF8(BobombEntity* this) {
|
|||
if (--super->timer == 0) {
|
||||
sub_0802CBC4(this);
|
||||
} else {
|
||||
if (this->unk_81 && sub_080044EC(super, 0x2800) == 1) {
|
||||
if (this->unk_81 && BounceUpdate(super, Q_8_8(40.0)) == BOUNCE_INIT_NEXT) {
|
||||
EnqueueSFX(SFX_PLACE_OBJ);
|
||||
}
|
||||
sub_0802CC18(this);
|
||||
|
|
|
@ -96,8 +96,8 @@ void sub_0802A8F4(BombPeahatEntity* this) {
|
|||
}
|
||||
|
||||
void sub_0802A8FC(BombPeahatEntity* this) {
|
||||
if ((gPlayerState.field_0x1c & 0xf) == 0) {
|
||||
super->health = gPlayerState.field_0x1c & 0xf;
|
||||
if ((gPlayerState.gustJarState & 0xf) == 0) {
|
||||
super->health = gPlayerState.gustJarState & 0xf;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -474,7 +474,7 @@ void sub_0802AEBC(BombPeahatEntity* this) {
|
|||
void sub_0802AED4(BombPeahatEntity* this) {
|
||||
GetNextFrame(super);
|
||||
if (this->unk_81 < 2) {
|
||||
if (sub_080044EC(super, 0x2800) == 1) {
|
||||
if (BounceUpdate(super, Q_8_8(40.0)) == BOUNCE_INIT_NEXT) {
|
||||
this->unk_81++;
|
||||
}
|
||||
} else {
|
||||
|
@ -673,7 +673,7 @@ void sub_0802B1BC(BombPeahatEntity* this) {
|
|||
#endif
|
||||
|
||||
void sub_0802B204(BombPeahatEntity* this) {
|
||||
if (sub_080044EC(super, 0x2800) == 1) {
|
||||
if (BounceUpdate(super, Q_8_8(40.0)) == BOUNCE_INIT_NEXT) {
|
||||
Entity* entity = CreateEnemy(BOBOMB, 1);
|
||||
if (entity != NULL) {
|
||||
CopyPosition(super, entity);
|
||||
|
|
|
@ -42,7 +42,7 @@ const s8 gUnk_080CFFC4[8];
|
|||
|
||||
void BowMoblin(Entity* this) {
|
||||
EnemyFunctionHandler(this, BowMoblin_Functions);
|
||||
SetChildOffset(this, 0, 1, -0x18);
|
||||
EnemySetFXOffset(this, 0, 1, -0x18);
|
||||
}
|
||||
|
||||
void BowMoblin_OnTick(BowMoblinEntity* this) {
|
||||
|
@ -53,10 +53,10 @@ void BowMoblin_OnCollision(BowMoblinEntity* this) {
|
|||
Entity* pEVar1;
|
||||
|
||||
if (super->confusedTime != 0) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
EnemyFunctionHandlerAfterCollision(super, (EntityActionArray)BowMoblin_Functions);
|
||||
if ((super->contactFlags & 0x80) != 0) {
|
||||
if (super->contactFlags & CONTACT_NOW) {
|
||||
sub_0803C5F0(this);
|
||||
pEVar1 = super->child;
|
||||
if (pEVar1 != NULL) {
|
||||
|
@ -213,7 +213,7 @@ void sub_0803C400(BowMoblinEntity* this) {
|
|||
switch (++super->timer) {
|
||||
case 1:
|
||||
super->direction = super->animationState << 2;
|
||||
projectile = CreateProjectileWithParent(super, ARROW_PROJECTILE, super->animationState >> 1);
|
||||
projectile = EnemyCreateProjectile(super, ARROW_PROJECTILE, super->animationState >> 1);
|
||||
if (projectile) {
|
||||
super->child = projectile;
|
||||
projectile->direction = (super->direction + 4) & 0x18;
|
||||
|
|
|
@ -155,7 +155,7 @@ void BusinessScrub_Action2(BusinessScrubEntity* this) {
|
|||
unk = 1;
|
||||
sub_080290FC(this);
|
||||
if (super->frame & 1) {
|
||||
Entity* entity = CreateProjectileWithParent(super, DEKU_SEED_PROJECTILE, 0);
|
||||
Entity* entity = EnemyCreateProjectile(super, DEKU_SEED_PROJECTILE, 0);
|
||||
if (entity != NULL) {
|
||||
entity->parent = super;
|
||||
entity->direction = super->direction;
|
||||
|
@ -222,7 +222,7 @@ void BusinessScrub_Action3(BusinessScrubEntity* this) {
|
|||
super->timer = 30;
|
||||
super->subtimer = 5;
|
||||
sub_080290E0(this, 0);
|
||||
iVar1 = Create0x68FX(super, FX_STARS);
|
||||
iVar1 = EnemyCreateFX(super, FX_STARS);
|
||||
if (iVar1 != NULL) {
|
||||
iVar1->spritePriority.b0 = 3;
|
||||
iVar1->z.HALF.HI -= 12;
|
||||
|
@ -238,7 +238,7 @@ void BusinessScrub_Action3(BusinessScrubEntity* this) {
|
|||
sub_0800445C(super);
|
||||
}
|
||||
|
||||
extern void sub_0804AA1C(Entity*);
|
||||
extern void EnemyDetachFX(Entity*);
|
||||
void sub_08028F0C(BusinessScrubEntity*);
|
||||
|
||||
void BusinessScrub_Action4(BusinessScrubEntity* this) {
|
||||
|
@ -246,7 +246,7 @@ void BusinessScrub_Action4(BusinessScrubEntity* this) {
|
|||
super->timer = 48;
|
||||
if (super->subtimer) {
|
||||
if (--super->subtimer == 0) {
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
}
|
||||
} else if (sub_08028FDC(this) || this->unk_80) {
|
||||
this->unk_80 = 0;
|
||||
|
@ -382,7 +382,7 @@ void sub_08028F0C(BusinessScrubEntity* this) {
|
|||
const struct SalesOffering* offer = (const struct SalesOffering*)this->unk_7c;
|
||||
|
||||
super->interactType = INTERACTION_NONE;
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
super->direction = (GetAnimationState(super) << 3);
|
||||
sub_080290E0(this, 3);
|
||||
this->unk_80 = 1;
|
||||
|
|
|
@ -127,7 +127,7 @@ void sub_08045CE0(BusinessScrubPrologueEntity* this) {
|
|||
r6 = 1;
|
||||
sub_0804604C(this);
|
||||
if (super->frame & 1) {
|
||||
entity = CreateProjectileWithParent(super, DEKU_SEED_PROJECTILE, 0);
|
||||
entity = EnemyCreateProjectile(super, DEKU_SEED_PROJECTILE, 0);
|
||||
if (entity != NULL) {
|
||||
entity->parent = super;
|
||||
entity->direction = super->direction;
|
||||
|
@ -190,7 +190,7 @@ void sub_08045E14(BusinessScrubPrologueEntity* this) {
|
|||
super->action = 5;
|
||||
super->subAction = 0;
|
||||
sub_08046030(this, 0);
|
||||
entity = Create0x68FX(super, FX_STARS);
|
||||
entity = EnemyCreateFX(super, FX_STARS);
|
||||
if (entity != NULL) {
|
||||
entity->spritePriority.b0 = 3;
|
||||
entity->z.HALF.HI -= 0xc;
|
||||
|
@ -329,7 +329,7 @@ void sub_08046078(BusinessScrubPrologueEntity* this) {
|
|||
super->child->action = 0xff;
|
||||
}
|
||||
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
}
|
||||
|
||||
void (*const BusinessScrubPrologue_Functions[])(Entity*) = {
|
||||
|
|
|
@ -43,7 +43,7 @@ void sub_0802B540(Entity* this) {
|
|||
|
||||
void sub_0802B56C(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->contactFlags & 0x80) {
|
||||
if (this->contactFlags & CONTACT_NOW) {
|
||||
this->speed = 0x40;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ void sub_0801FAF8(ChuchuEntity* this);
|
|||
void sub_0801FB14(ChuchuEntity* this);
|
||||
void sub_0801FB34(ChuchuEntity* this);
|
||||
void sub_0801FB68(ChuchuEntity* this);
|
||||
u32 sub_0801FBD0(ChuchuEntity* this);
|
||||
u32 CheckWaterTile(ChuchuEntity* this);
|
||||
void Chuchu_JumpAtPlayer(ChuchuEntity* this);
|
||||
|
||||
extern void (*const Chuchu_Functions[])(ChuchuEntity*);
|
||||
|
@ -73,7 +73,7 @@ void Chuchu(ChuchuEntity* this) {
|
|||
/* ... */
|
||||
break;
|
||||
case 2:
|
||||
sub_080043A8(super);
|
||||
CreateDrownFX(super);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ void Chuchu(ChuchuEntity* this) {
|
|||
this->unk_81 = index;
|
||||
Chuchu_Functions[GetNextFunction(super)](this);
|
||||
if (this->unk_68->type == 0x1c) {
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
} else if (super->type == 2) {
|
||||
sub_0801FB34(this);
|
||||
}
|
||||
|
@ -118,14 +118,14 @@ void Chuchu_OnCollision(ChuchuEntity* this) {
|
|||
if (health) {
|
||||
if (super->contactFlags == 0x94) {
|
||||
sub_0801FB68(this);
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
InitializeAnimation(super, 6);
|
||||
} else if (this->unk_80 != health) {
|
||||
sub_0801FB68(this);
|
||||
InitializeAnimation(super, 6);
|
||||
}
|
||||
} else {
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
super->zVelocity = 0;
|
||||
InitializeAnimation(super, 9);
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ void Chuchu_OnCollision(ChuchuEntity* this) {
|
|||
|
||||
void Chuchu_OnGrabbed(ChuchuEntity* this) {
|
||||
if (!sub_0806F520(super) && super->confusedTime) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
InitializeAnimation(super, 6);
|
||||
} else {
|
||||
if (super->animIndex != 8) {
|
||||
|
@ -159,9 +159,9 @@ void Chuchu_OnDeath(ChuchuEntity* this) {
|
|||
if (super->type == 0) {
|
||||
GenericDeath(super);
|
||||
} else if (super->type == 1) {
|
||||
CreateDeathFx(super, 0xf2, 0);
|
||||
EnemyCreateDeathFX((Enemy*)super, 0xf2, 0);
|
||||
} else {
|
||||
CreateDeathFx(super, 0xf1, 0);
|
||||
EnemyCreateDeathFX((Enemy*)super, 0xf1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ void sub_0801F0C8(ChuchuEntity* this) {
|
|||
}
|
||||
|
||||
void sub_0801F12C(ChuchuEntity* this) {
|
||||
if (sub_0801FBD0(this)) {
|
||||
if (CheckWaterTile(this)) {
|
||||
sub_0801F328(this);
|
||||
} else {
|
||||
if ((super->subtimer++ & 7) == 0) {
|
||||
|
@ -233,7 +233,7 @@ void sub_0801F1B0(ChuchuEntity* this) {
|
|||
}
|
||||
|
||||
if (super->frame & ANIM_DONE) {
|
||||
if (sub_0801FBD0(this)) {
|
||||
if (CheckWaterTile(this)) {
|
||||
sub_0801F328(this);
|
||||
} else {
|
||||
sub_0801F340(this);
|
||||
|
@ -262,7 +262,7 @@ void sub_0801F270(ChuchuEntity* this) {
|
|||
|
||||
ProcessMovement5(super);
|
||||
GetNextFrame(super);
|
||||
if (sub_0801FBD0(this))
|
||||
if (CheckWaterTile(this))
|
||||
return;
|
||||
|
||||
if (--super->timer != 0)
|
||||
|
@ -290,7 +290,7 @@ void sub_0801F2F8(ChuchuEntity* this) {
|
|||
GetNextFrame(super);
|
||||
if (super->frame & ANIM_DONE) {
|
||||
sub_0801F340(this);
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -391,7 +391,7 @@ void sub_0801F4EC(ChuchuEntity* this) {
|
|||
}
|
||||
|
||||
void sub_0801F508(ChuchuEntity* this) {
|
||||
if (sub_0801FBD0(this)) {
|
||||
if (CheckWaterTile(this)) {
|
||||
this->unk_83 = 0;
|
||||
sub_0801F730(this);
|
||||
} else {
|
||||
|
@ -430,7 +430,7 @@ void sub_0801F584(ChuchuEntity* this) {
|
|||
}
|
||||
|
||||
if (super->frame & ANIM_DONE) {
|
||||
if (sub_0801FBD0(this)) {
|
||||
if (CheckWaterTile(this)) {
|
||||
this->unk_83 = 0;
|
||||
sub_0801F730(this);
|
||||
} else {
|
||||
|
@ -465,7 +465,7 @@ void sub_0801F688(ChuchuEntity* this) {
|
|||
if (this->unk_83)
|
||||
this->unk_83--;
|
||||
|
||||
if (sub_0801FBD0(this) || this->unk_83) {
|
||||
if (CheckWaterTile(this) || this->unk_83) {
|
||||
super->direction = sub_08049F84(super, 1);
|
||||
ProcessMovement5(super);
|
||||
GetNextFrame(super);
|
||||
|
@ -489,7 +489,7 @@ void sub_0801F6F8(ChuchuEntity* this) {
|
|||
if (super->frame & ANIM_DONE) {
|
||||
super->action = 4;
|
||||
super->speed = 0x20;
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
InitializeAnimation(super, 2);
|
||||
}
|
||||
}
|
||||
|
@ -562,7 +562,7 @@ void sub_0801F884(ChuchuEntity* this) {
|
|||
if (super->subtimer) {
|
||||
super->subtimer--;
|
||||
} else {
|
||||
Entity* entity = Create0x68FX(super, FX_LIGHTNING_STRIKE);
|
||||
Entity* entity = EnemyCreateFX(super, FX_LIGHTNING_STRIKE);
|
||||
if (entity != NULL) {
|
||||
entity->type2 = 64;
|
||||
super->action = 4;
|
||||
|
@ -573,7 +573,7 @@ void sub_0801F884(ChuchuEntity* this) {
|
|||
}
|
||||
|
||||
void sub_0801F8C0(ChuchuEntity* this) {
|
||||
if (sub_0801FBD0(this)) {
|
||||
if (CheckWaterTile(this)) {
|
||||
sub_0801FAE0(this);
|
||||
} else if (sub_08049FDC(super, 1) == 0) {
|
||||
sub_0801F730(this);
|
||||
|
@ -606,7 +606,7 @@ void sub_0801F940(ChuchuEntity* this) {
|
|||
}
|
||||
|
||||
if (super->frame & ANIM_DONE) {
|
||||
if (sub_0801FBD0(this)) {
|
||||
if (CheckWaterTile(this)) {
|
||||
sub_0801FAE0(this);
|
||||
} else {
|
||||
super->action = 6;
|
||||
|
@ -636,7 +636,7 @@ void sub_0801F9E0(ChuchuEntity* this) {
|
|||
}
|
||||
|
||||
void sub_0801FA30(ChuchuEntity* this) {
|
||||
if (sub_0801FBD0(this)) {
|
||||
if (CheckWaterTile(this)) {
|
||||
super->direction = sub_08049F84(super, 1);
|
||||
ProcessMovement5(super);
|
||||
GetNextFrame(super);
|
||||
|
@ -654,7 +654,7 @@ void sub_0801FA78(ChuchuEntity* this) {
|
|||
super->action = 1;
|
||||
super->spriteSettings.draw = 0;
|
||||
InitializeAnimation(super, 4);
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -664,7 +664,7 @@ void sub_0801FAAC(ChuchuEntity* this) {
|
|||
if (super->frame & ANIM_DONE) {
|
||||
sub_0801FB14(this);
|
||||
super->speed = 0x20;
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -708,14 +708,14 @@ void sub_0801FB68(ChuchuEntity* this) {
|
|||
case 2:
|
||||
super->action = 10;
|
||||
super->hitType = 92;
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
break;
|
||||
}
|
||||
|
||||
super->zVelocity = 0;
|
||||
}
|
||||
|
||||
bool32 sub_0801FBD0(ChuchuEntity* this) {
|
||||
bool32 CheckWaterTile(ChuchuEntity* this) {
|
||||
if (GetVvvAtEntity(super) == VVV_16) {
|
||||
return TRUE;
|
||||
} else {
|
||||
|
|
|
@ -284,9 +284,9 @@ void ChuchuBoss_OnDeath(ChuchuBossEntity* this) {
|
|||
break;
|
||||
case 1:
|
||||
if (this->unk_7d-- == 0) {
|
||||
((GenericEntity*)super->child)->field_0x6c.HALF.HI |= 2;
|
||||
((Enemy*)super->child)->enemyFlags |= EM_FLAG_BOSS_KILLED;
|
||||
this->unk_68->unk_6d.unk1 = 1;
|
||||
((GenericEntity*)super->parent)->field_0x6c.HALF.HI |= 2;
|
||||
((Enemy*)super->parent)->enemyFlags |= EM_FLAG_BOSS_KILLED;
|
||||
parent = super->child;
|
||||
child = super->parent;
|
||||
this->unk_68->base.health = 0;
|
||||
|
@ -979,13 +979,13 @@ void sub_08026BE8(ChuchuBossEntity* this) {
|
|||
Entity* child;
|
||||
|
||||
child = super->child;
|
||||
child->flags2 &= ~1;
|
||||
child->collisionMask &= ~1;
|
||||
if (this->unk_7c == 0) {
|
||||
super->subAction = 7;
|
||||
this->unk_84->unk_03 = 0;
|
||||
this->unk_7d = 0x2d;
|
||||
child->flags &= ~0x80;
|
||||
child->flags2 |= 1;
|
||||
child->collisionMask |= 1;
|
||||
SoundReq(SFX_155);
|
||||
} else {
|
||||
this->unk_7c--;
|
||||
|
@ -1347,7 +1347,7 @@ void sub_080272D4(ChuchuBossEntity* this) {
|
|||
super->hitbox->height = (u32)((0x10000 / this->unk_74.HALF_U.HI) * 5) >> 6;
|
||||
if (*(char*)&this->unk_84 == 0)
|
||||
break;
|
||||
if ((super->contactFlags & 0x80) != 0) {
|
||||
if (super->contactFlags & CONTACT_NOW) {
|
||||
if (super->iframes != 0) {
|
||||
((ChuchuBossEntity*)super->child)->unk_68->base.iframes = super->iframes;
|
||||
super->child->parent->iframes = super->iframes;
|
||||
|
@ -1698,7 +1698,7 @@ bool32 sub_08027AA4(ChuchuBossEntity* this) {
|
|||
s32 iVar4;
|
||||
Helper* pHelper;
|
||||
|
||||
if ((super->contactFlags & 0x80) == 0) {
|
||||
if ((super->contactFlags & CONTACT_NOW) == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
switch (super->contactFlags & 0x7f) {
|
||||
|
|
|
@ -42,7 +42,7 @@ void (*const gUnk_080CF4F0[])(CloudPiranhaEntity*) = {
|
|||
|
||||
void CloudPiranha(CloudPiranhaEntity* this) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)&gUnk_080CF4F0);
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void CloudPiranha_OnTick(CloudPiranhaEntity* this) {
|
||||
|
@ -56,10 +56,10 @@ void CloudPiranha_OnTick(CloudPiranhaEntity* this) {
|
|||
|
||||
void CloudPiranha_OnCollision(CloudPiranhaEntity* this) {
|
||||
if (super->confusedTime != 0) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
EnemyFunctionHandlerAfterCollision(super, gUnk_080CF4F0);
|
||||
if ((super->contactFlags & 0x80) != 0) {
|
||||
if (super->contactFlags & CONTACT_NOW) {
|
||||
if (super->hitType == 0x5a) {
|
||||
switch (super->contactFlags & 0x3f) {
|
||||
case 0x14:
|
||||
|
@ -176,7 +176,7 @@ void CloudPiranha_Action3(CloudPiranhaEntity* this) {
|
|||
void CloudPiranha_Action4(CloudPiranhaEntity* this) {
|
||||
Entity* effect;
|
||||
sub_080387F0(this);
|
||||
if (sub_080044EC(super, 0x1800) == 1) {
|
||||
if (BounceUpdate(super, Q_8_8(24.0)) == BOUNCE_INIT_NEXT) {
|
||||
super->action = 1;
|
||||
super->hitType = 0x72;
|
||||
super->timer = 1;
|
||||
|
|
|
@ -44,7 +44,7 @@ void Crow_OnTick(CrowEntity* this) {
|
|||
}
|
||||
|
||||
void Crow_OnCollision(CrowEntity* this) {
|
||||
if (super->contactFlags & 0x80) {
|
||||
if (super->contactFlags & CONTACT_NOW) {
|
||||
if ((super->contactFlags & 0x3f) == 0) {
|
||||
COLLISION_OFF(super);
|
||||
super->subtimer = 16;
|
||||
|
|
|
@ -50,7 +50,7 @@ void CuccoAggr(Entity* this) {
|
|||
gUnk_080012C8[index](this);
|
||||
} else {
|
||||
CuccoAggr_Functions[GetNextFunction(this)](this);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
EnemySetFXOffset(this, 0, 1, -0x10);
|
||||
sub_080391B4((CuccoAggrEntity*)this);
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ void CuccoAggr_OnCollision(CuccoAggrEntity* this) {
|
|||
}
|
||||
|
||||
if (super->confusedTime) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
|
||||
EnemyFunctionHandlerAfterCollision(super, CuccoAggr_Functions);
|
||||
|
@ -176,7 +176,7 @@ void sub_08038F44(CuccoAggrEntity* this) {
|
|||
super->direction = GetFacingDirection(&gPlayerEntity.base, super);
|
||||
sub_080390F8(this);
|
||||
ProcessMovement0(super);
|
||||
sub_080044EC(super, 0x1800);
|
||||
BounceUpdate(super, Q_8_8(24.0));
|
||||
GetNextFrame(super);
|
||||
sub_08039298(this);
|
||||
if (--this->unk_78 == 0) {
|
||||
|
|
|
@ -67,7 +67,7 @@ extern void (*const gUnk_080CAB58[])(DarkNutEntity*);
|
|||
|
||||
void DarkNut(DarkNutEntity* this) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)DarkNut_Functions);
|
||||
SetChildOffset(super, 0, 1, -22);
|
||||
EnemySetFXOffset(super, 0, 1, -22);
|
||||
}
|
||||
|
||||
void DarkNut_OnTick(DarkNutEntity* this) {
|
||||
|
@ -82,7 +82,7 @@ void DarkNut_OnCollision(DarkNutEntity* this) {
|
|||
super->hitType = 81;
|
||||
sub_08021218(this, 8, DirectionToAnimationState(super->knockbackDirection ^ 0x10));
|
||||
sub_08021588(this);
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
break;
|
||||
case 0x16:
|
||||
super->action = 11;
|
||||
|
@ -90,7 +90,7 @@ void DarkNut_OnCollision(DarkNutEntity* this) {
|
|||
super->hitType = 81;
|
||||
sub_08021218(this, 8, DirectionToAnimationState(super->knockbackDirection ^ 0x10));
|
||||
sub_08021588(this);
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
break;
|
||||
case 0x4b:
|
||||
if (super->action == 13 || super->action == 15 || super->action == 19 || super->action == 18)
|
||||
|
@ -128,7 +128,7 @@ void DarkNut_OnCollision(DarkNutEntity* this) {
|
|||
if (super->health != this->unk_78) {
|
||||
sub_08021588(this);
|
||||
sub_08021390(this);
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ void sub_08020F48(DarkNutEntity* this) {
|
|||
|
||||
super->action = 14;
|
||||
sub_08021218(this, 13, uVar2 >> 3);
|
||||
pEVar3 = CreateProjectileWithParent(super, DARK_NUT_SWORD_SLASH, 1);
|
||||
pEVar3 = EnemyCreateProjectile(super, DARK_NUT_SWORD_SLASH, 1);
|
||||
if (pEVar3) {
|
||||
pEVar3->parent = super;
|
||||
super->child = pEVar3;
|
||||
|
@ -272,7 +272,7 @@ void sub_08020FE4(DarkNutEntity* this) {
|
|||
if (--super->timer == 0) {
|
||||
super->action = 12;
|
||||
sub_08021218(this, 9, super->animationState);
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ void sub_08021010(DarkNutEntity* this) {
|
|||
|
||||
void sub_08021038(DarkNutEntity* this) {
|
||||
if (super->child == NULL && super->frame) {
|
||||
Entity* pEVar2 = (Entity*)CreateProjectileWithParent(super, DARK_NUT_SWORD_SLASH, 0);
|
||||
Entity* pEVar2 = (Entity*)EnemyCreateProjectile(super, DARK_NUT_SWORD_SLASH, 0);
|
||||
if (pEVar2) {
|
||||
pEVar2->parent = super;
|
||||
super->child = pEVar2;
|
||||
|
@ -325,7 +325,7 @@ void sub_080210E4(DarkNutEntity* this) {
|
|||
Entity* entity;
|
||||
|
||||
super->frame &= ~1;
|
||||
entity = CreateProjectileWithParent(super, DARK_NUT_SWORD_SLASH, 2);
|
||||
entity = EnemyCreateProjectile(super, DARK_NUT_SWORD_SLASH, 2);
|
||||
if (entity != NULL) {
|
||||
entity->parent = super;
|
||||
super->child = entity;
|
||||
|
@ -335,7 +335,8 @@ void sub_080210E4(DarkNutEntity* this) {
|
|||
}
|
||||
|
||||
sub_08021644(this);
|
||||
if ((super->frame & 0x10) && (!ProcessMovement0(super) || (super->child && (super->child->contactFlags & 0x80)))) {
|
||||
if ((super->frame & 0x10) &&
|
||||
(!ProcessMovement0(super) || (super->child && (super->child->contactFlags & CONTACT_NOW)))) {
|
||||
sub_080213D0(this, 0);
|
||||
} else {
|
||||
if (--this->unk_76 == 0)
|
||||
|
@ -594,7 +595,7 @@ void sub_0802159C(DarkNutEntity* this) {
|
|||
|
||||
super->frame = 0;
|
||||
super->hitType = 0x51;
|
||||
entity = CreateProjectileWithParent(super, DARK_NUT_SWORD_SLASH, 3);
|
||||
entity = EnemyCreateProjectile(super, DARK_NUT_SWORD_SLASH, 3);
|
||||
if (entity != NULL) {
|
||||
entity->parent = super;
|
||||
super->child = entity;
|
||||
|
@ -615,7 +616,7 @@ void sub_08021600(DarkNutEntity* this) {
|
|||
|
||||
super->frame = 0;
|
||||
super->hitType = 0x51;
|
||||
entity = CreateProjectileWithParent(super, DARK_NUT_SWORD_SLASH, 4);
|
||||
entity = EnemyCreateProjectile(super, DARK_NUT_SWORD_SLASH, 4);
|
||||
if (entity != NULL) {
|
||||
entity->parent = super;
|
||||
super->child = entity;
|
||||
|
|
|
@ -51,7 +51,7 @@ void DoorMimic_OnCollision(DoorMimicEntity* this) {
|
|||
void DoorMimic_OnDeath(DoorMimicEntity* this) {
|
||||
SetMetaTile(this->unk_7c, this->unk_7e, super->collisionLayer);
|
||||
CreateFx(super, FX_POT_SHATTER, 0);
|
||||
SetRoomTrackerFlag(super);
|
||||
EnemyDisableRespawn(super);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
|
|
|
@ -303,7 +303,7 @@ void sub_08044550(DustEntity* this) {
|
|||
u8 uVar1;
|
||||
const s8* ptr;
|
||||
|
||||
if ((gPlayerState.field_0x1c & 0xf) == 1) {
|
||||
if ((gPlayerState.gustJarState & 0xf) == 1) {
|
||||
if (super->speed < 0x100) {
|
||||
super->speed += 0x10;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ void Enemy4D_OnKnockback(Enemy4DEntity* this) {
|
|||
}
|
||||
|
||||
void Enemy4D_OnDeath(Enemy4DEntity* this) {
|
||||
CreateDeathFx(super, 0xff, 0x57);
|
||||
EnemyCreateDeathFX((Enemy*)super, 0xff, 0x57);
|
||||
}
|
||||
|
||||
void Enemy4D_OnGrabbed(Enemy4DEntity* this) {
|
||||
|
@ -100,7 +100,7 @@ void Enemy4D_Init(Enemy4DEntity* this) {
|
|||
Entity* projectile;
|
||||
|
||||
sub_0804A720(super);
|
||||
projectile = CreateProjectileWithParent(super, BALL_AND_CHAIN, 0);
|
||||
projectile = EnemyCreateProjectile(super, BALL_AND_CHAIN, 0);
|
||||
if (projectile != NULL) {
|
||||
projectile->parent = super;
|
||||
super->child = projectile;
|
||||
|
|
|
@ -65,7 +65,7 @@ void Enemy50(Enemy50Entity* this) {
|
|||
DeleteThisEntity();
|
||||
}
|
||||
Enemy50_Functions[GetNextFunction(super)](this);
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void Enemy50_OnTick(Enemy50Entity* this) {
|
||||
|
@ -79,21 +79,21 @@ void Enemy50_OnCollision(Enemy50Entity* this) {
|
|||
sub_08041134(this);
|
||||
sub_0803F6EC(this);
|
||||
}
|
||||
if (super->hitType == 0x25 && super->contactFlags == 0x80) {
|
||||
if (super->hitType == 0x25 && super->contactFlags == CONTACT_NOW) {
|
||||
super->action = 8;
|
||||
InitializeAnimation(super, 3);
|
||||
} else {
|
||||
if (super->contactFlags == 0x80) {
|
||||
if (super->contactFlags == CONTACT_NOW) {
|
||||
this->unk_7c = 0x78;
|
||||
sub_08041128(this);
|
||||
}
|
||||
if (super->contactFlags == 0x9d) {
|
||||
if (super->contactFlags == (CONTACT_NOW | 0x1d)) {
|
||||
super->zVelocity = Q_16_16(1.5);
|
||||
}
|
||||
if (super->confusedTime != 0) {
|
||||
super->animationState = super->knockbackDirection >> 4;
|
||||
InitializeAnimation(super, super->animationState + 7);
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
if (super->health != this->unk_7a) {
|
||||
if (super->type == 0) {
|
||||
|
@ -422,7 +422,7 @@ void sub_0804122C(Enemy50Entity* this) {
|
|||
|
||||
#ifndef EU
|
||||
bool32 sub_08041300(Enemy50Entity* this) {
|
||||
if ((super->hitType == 0x25) && (super->contactFlags == 0x80)) {
|
||||
if ((super->hitType == 0x25) && (super->contactFlags == CONTACT_NOW)) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return super->action == 8 || super->action == 9;
|
||||
|
|
|
@ -83,14 +83,14 @@ void Eyegore_OnTick(EyegoreEntity* this) {
|
|||
void Eyegore_OnCollision(EyegoreEntity* this) {
|
||||
u32 tmp;
|
||||
|
||||
if ((super->contactFlags == 0x95) || (super->contactFlags == 0x8e)) {
|
||||
if ((super->contactFlags == (CONTACT_NOW | 0x15)) || (super->contactFlags == (CONTACT_NOW | 0xe))) {
|
||||
Entity* entity = super->contactedEntity;
|
||||
tmp = (((entity->direction + 4) & 0x18) ^ 0x10) >> 3;
|
||||
if (tmp == super->animationState) {
|
||||
if ((tmp & 1) != 0) {
|
||||
if (0x10 < ((entity->y.HALF.HI + entity->z.HALF.HI) - (super->y.HALF.HI + super->z.HALF.HI)) + 0x14U) {
|
||||
} else {
|
||||
if (super->contactFlags == 0x8e) {
|
||||
if (super->contactFlags == (CONTACT_NOW | 0xe)) {
|
||||
super->health = 0;
|
||||
} else {
|
||||
super->health--;
|
||||
|
@ -106,7 +106,7 @@ void Eyegore_OnCollision(EyegoreEntity* this) {
|
|||
EnqueueSFX(SFX_BUTTON_PRESS);
|
||||
sub_08031344(this);
|
||||
} else {
|
||||
if (super->contactFlags == 0x8e) {
|
||||
if (super->contactFlags == (CONTACT_NOW | 0xe)) {
|
||||
super->health = 0;
|
||||
} else {
|
||||
super->health--;
|
||||
|
@ -441,8 +441,8 @@ void sub_08031024(EyegoreEntity* this) {
|
|||
void sub_08031250(EyegoreEntity* this) {
|
||||
u32 tmp2;
|
||||
u32 tmp = (u32)super->animationState * 4;
|
||||
sub_08008796(super, 9, super->x.HALF.HI + gUnk_080CE2C0[tmp], super->y.HALF.HI + gUnk_080CE2C0[tmp + 1]);
|
||||
sub_08008796(super, 9, super->x.HALF.HI + gUnk_080CE2C0[tmp + 2], super->y.HALF.HI + gUnk_080CE2C0[tmp + 3]);
|
||||
DoTileInteraction(super, 9, super->x.HALF.HI + gUnk_080CE2C0[tmp], super->y.HALF.HI + gUnk_080CE2C0[tmp + 1]);
|
||||
DoTileInteraction(super, 9, super->x.HALF.HI + gUnk_080CE2C0[tmp + 2], super->y.HALF.HI + gUnk_080CE2C0[tmp + 3]);
|
||||
if (this->unk_79 != 0) {
|
||||
tmp2 = 0;
|
||||
if ((super->x.HALF.HI - (u32)this->unk_74) + 2 < 5) {
|
||||
|
|
|
@ -93,7 +93,7 @@ void sub_0802C334(FallingBoulderEntity* this) {
|
|||
GetNextFrame(super);
|
||||
this->unk_7e = COORD_TO_TILE(super);
|
||||
|
||||
if (sub_080044EC(super, this->unk_84) == 1) {
|
||||
if (BounceUpdate(super, this->unk_84) == BOUNCE_INIT_NEXT) {
|
||||
EnqueueSFX(0x14c);
|
||||
COLLISION_ON(super);
|
||||
this->unk_7a = 12;
|
||||
|
|
|
@ -94,7 +94,7 @@ void FlyingPot_OnTick(FlyingPotEntity* this) {
|
|||
void FlyingPot_OnCollision(FlyingPotEntity* this) {
|
||||
sub_08037418(this);
|
||||
|
||||
if (super->contactFlags == 0x9D) {
|
||||
if (super->contactFlags == (CONTACT_NOW | 0x1d)) {
|
||||
super->action = FLYING_POT_ACTION_6;
|
||||
COLLISION_OFF(super);
|
||||
super->zVelocity = Q_16_16(2.625);
|
||||
|
@ -157,7 +157,7 @@ void FlyingPot_SubAction2(FlyingPotEntity* this) {
|
|||
}
|
||||
|
||||
void FlyingPot_SubAction3(FlyingPotEntity* this) {
|
||||
if (!(gPlayerState.field_0x1c & 0xF)) {
|
||||
if (!(gPlayerState.gustJarState & 0xF)) {
|
||||
sub_08037408(this);
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ void FlyingPot_Action2(FlyingPotEntity* this) {
|
|||
super->spritePriority.b1 = 1;
|
||||
super->spriteOffsetX = 0;
|
||||
super->hitType = 0xA0;
|
||||
super->flags2 = 0xF;
|
||||
super->collisionMask = 0xF;
|
||||
super->hitbox = &gUnk_080FD34C;
|
||||
|
||||
SetMetaTile(this->tileIndex, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
|
||||
|
|
|
@ -46,7 +46,7 @@ void FlyingSkull_OnTick(FlyingSkullEntity* this) {
|
|||
void FlyingSkull_OnCollision(FlyingSkullEntity* this) {
|
||||
sub_0803A100(this);
|
||||
|
||||
if (super->contactFlags == 0x9d) {
|
||||
if (super->contactFlags == (CONTACT_NOW | 0x1d)) {
|
||||
super->action = 7;
|
||||
COLLISION_OFF(super);
|
||||
super->zVelocity = Q_16_16(2.625);
|
||||
|
@ -101,7 +101,7 @@ void sub_08039CE0(FlyingSkullEntity* this) {
|
|||
}
|
||||
|
||||
void sub_08039D4C(FlyingSkullEntity* this) {
|
||||
if ((gPlayerState.field_0x1c & 0xf) == 0) {
|
||||
if ((gPlayerState.gustJarState & 0xf) == 0) {
|
||||
sub_0803A0E0(this);
|
||||
}
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ void sub_08039FAC(FlyingSkullEntity* this) {
|
|||
super->spritePriority.b1 = 1;
|
||||
super->spriteOffsetX = 0;
|
||||
super->hitType = 0xa0;
|
||||
super->flags2 = 0xf;
|
||||
super->collisionMask = 0xf;
|
||||
super->hitbox = (Hitbox*)&gUnk_080FD34C;
|
||||
SetMetaTile(this->metaTileIndex, COORD_TO_TILE(super), super->collisionLayer);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ void sub_0803F528(GhiniEntity*);
|
|||
|
||||
void Ghini(GhiniEntity* this) {
|
||||
Ghini_Functions[GetNextFunction(super)](this);
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void Ghini_OnTick(GhiniEntity* this) {
|
||||
|
@ -59,17 +59,17 @@ void Ghini_OnCollision(GhiniEntity* this) {
|
|||
sub_0803F630(this);
|
||||
sub_0803F6EC(this);
|
||||
}
|
||||
if ((super->hitType == 0x25) && (super->contactFlags == 0x80)) {
|
||||
if ((super->hitType == 0x25) && (super->contactFlags == CONTACT_NOW)) {
|
||||
super->action = 8;
|
||||
InitializeAnimation(super, 3);
|
||||
} else {
|
||||
if (super->contactFlags == 0x9d) {
|
||||
if (super->contactFlags == (CONTACT_NOW | 0x1d)) {
|
||||
super->zVelocity = 0x18000;
|
||||
}
|
||||
if (super->confusedTime != 0) {
|
||||
super->animationState = super->knockbackDirection >> 4;
|
||||
InitializeAnimation(super, super->animationState + 7);
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
if (super->health != this->unk_7a) {
|
||||
this->unk_7a = super->health;
|
||||
|
|
|
@ -44,7 +44,7 @@ extern Entity* gUnk_020000B0;
|
|||
|
||||
void Gibdo(Entity* this) {
|
||||
EnemyFunctionHandler(this, Gibdo_Functions);
|
||||
SetChildOffset(this, 0, 1, -0x15);
|
||||
EnemySetFXOffset(this, 0, 1, -0x15);
|
||||
}
|
||||
|
||||
void Gibdo_OnTick(GibdoEntity* this) {
|
||||
|
@ -52,7 +52,7 @@ void Gibdo_OnTick(GibdoEntity* this) {
|
|||
}
|
||||
|
||||
void Gibdo_OnCollision(GibdoEntity* this) {
|
||||
if (super->contactFlags == 0x87) {
|
||||
if (super->contactFlags == (CONTACT_NOW | 0x7)) {
|
||||
if (super->action == 0x6) {
|
||||
sub_08037ACC(this);
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ void Gibdo_OnCollision(GibdoEntity* this) {
|
|||
Gibdo_CreateObjects(this);
|
||||
} else {
|
||||
if (super->action != 0x6) {
|
||||
if (super->hitType == 0x27 && super->contactFlags == 0x80) {
|
||||
if (super->hitType == 0x27 && super->contactFlags == CONTACT_NOW) {
|
||||
sub_08037A14(this);
|
||||
} else {
|
||||
if ((u8)(super->action - 1) < 2) {
|
||||
|
@ -83,7 +83,7 @@ void Gibdo_OnCollision(GibdoEntity* this) {
|
|||
}
|
||||
}
|
||||
if (super->confusedTime != 0) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
EnemyFunctionHandlerAfterCollision(super, Gibdo_Functions);
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ void sub_0803775C(GibdoEntity* this) {
|
|||
if (--super->timer == 0) {
|
||||
stalfos = CreateEnemy(STALFOS, 0);
|
||||
if (stalfos != NULL) {
|
||||
sub_0804A4E4(super, stalfos);
|
||||
EnemyCopyParams(super, stalfos);
|
||||
Gibdo_MoveObjectsToStalfos(this, stalfos);
|
||||
}
|
||||
DeleteEntity(super);
|
||||
|
@ -326,7 +326,7 @@ void sub_08037A14(GibdoEntity* this) {
|
|||
super->timer = 24;
|
||||
super->spritePriority.b0 &= super->timer - 32;
|
||||
super->spritePriority.b0 |= 3;
|
||||
super->flags2 &= 0xfe;
|
||||
super->collisionMask &= 0xfe;
|
||||
this->field_0x7c = 5;
|
||||
CopyPosition(super, super->contactedEntity);
|
||||
InitAnimationForceUpdate(super, super->animationState + 0xc);
|
||||
|
@ -341,7 +341,7 @@ void sub_08037A58(GibdoEntity* this) {
|
|||
super->iframes = 0xec;
|
||||
}
|
||||
super->hitType = 0x26;
|
||||
super->flags2 |= 1;
|
||||
super->collisionMask |= 1;
|
||||
super->iframes = 0xf4;
|
||||
super->knockbackDirection = DirectionFromAnimationState(super->animationState) ^ 0x10;
|
||||
super->knockbackDuration = 8;
|
||||
|
|
|
@ -300,7 +300,7 @@ void sub_0802D33C(GleerokEntity* this) {
|
|||
}
|
||||
|
||||
unk_84->entities[i]->health = 0;
|
||||
((GenericEntity*)unk_84->entities[i])->field_0x6c.HALF.HI |= 1;
|
||||
((Enemy*)(unk_84->entities[i]))->enemyFlags |= EM_FLAG_BOSS;
|
||||
unk_84->ent2->health = 0;
|
||||
unk_84->ent2->type2 = 0;
|
||||
unk_84->ent2->spriteSettings.draw &= ~1;
|
||||
|
@ -383,7 +383,7 @@ void sub_0802D3B8(GleerokEntity* this) {
|
|||
case 1:
|
||||
if (super->type2 == 1) {
|
||||
COLLISION_ON(super);
|
||||
super->flags2 |= 0x80;
|
||||
super->collisionMask |= 0x80;
|
||||
}
|
||||
|
||||
super->spritePriority.b0 = gUnk_080CD7C4[super->type2].unk0.HALF.HI;
|
||||
|
@ -399,7 +399,7 @@ void sub_0802D3B8(GleerokEntity* this) {
|
|||
this->unk_74 = gUnk_080CD884[0];
|
||||
this->unk_75 = 0;
|
||||
super->spritePriority.b0 = 6;
|
||||
super->flags2 |= 0x80;
|
||||
super->collisionMask |= 0x80;
|
||||
CopyPosition(super->parent, super);
|
||||
InitializeAnimation(super, 0x4f);
|
||||
break;
|
||||
|
@ -659,7 +659,7 @@ void sub_0802D86C(GleerokEntity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((super->contactFlags & 0x80) && this->unk_74 == 0) {
|
||||
if ((super->contactFlags & CONTACT_NOW) && this->unk_74 == 0) {
|
||||
if ((super->contactFlags & 0x7f) == 0x1d) {
|
||||
super->zVelocity = Q_16_16(3.0);
|
||||
super->parent->subAction = 4;
|
||||
|
@ -815,7 +815,7 @@ void sub_0802DCE0(GleerokEntity* this) {
|
|||
}
|
||||
} else {
|
||||
if (this->unk_84->ent2->subtimer == 0) {
|
||||
super->child = CreateProjectileWithParent(super, GLEEROK_PROJECTILE, 0);
|
||||
super->child = EnemyCreateProjectile(super, GLEEROK_PROJECTILE, 0);
|
||||
|
||||
if (super->child != NULL) {
|
||||
super->child->direction = this->unk_84->filler[5].unk0.HALF.HI;
|
||||
|
@ -883,7 +883,7 @@ void sub_0802DDD8(GleerokEntity* this) {
|
|||
}
|
||||
|
||||
if (this->unk_84->ent2->subtimer == 1) {
|
||||
super->child = CreateProjectileWithParent(super, GLEEROK_PROJECTILE, r2);
|
||||
super->child = EnemyCreateProjectile(super, GLEEROK_PROJECTILE, r2);
|
||||
if (super->child != NULL) {
|
||||
super->child->direction = this->unk_84->filler[5].unk0.HALF.HI;
|
||||
super->child->type2 = this->unk_84->ent2->frame & 0xf;
|
||||
|
@ -1039,7 +1039,7 @@ void sub_0802E0B8(GleerokEntity* this) {
|
|||
super->type2 = 4;
|
||||
InitializeAnimation(super, 0x4e);
|
||||
} else {
|
||||
if (super->contactFlags & 0x80) {
|
||||
if (super->contactFlags & CONTACT_NOW) {
|
||||
if (super->iframes > 0) {
|
||||
SoundReq(SFX_BOSS_HIT);
|
||||
}
|
||||
|
@ -1160,7 +1160,7 @@ void sub_0802E300(GleerokEntity* this) {
|
|||
heap->ent2->timer = 24;
|
||||
} else {
|
||||
if ((gRoomTransition.frameCount & 0xf) == 0) {
|
||||
CreateProjectileWithParent(super, GLEEROK_PROJECTILE, 0x3);
|
||||
EnemyCreateProjectile(super, GLEEROK_PROJECTILE, 0x3);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ void sub_080464C0(GyorgFemaleEntity* this) {
|
|||
void sub_08046518(void) {
|
||||
u16* ptr = gMapTop.metatileTypes;
|
||||
u16* sl = &gMapTop.mapData[sub_08046518_offset];
|
||||
u16* stack1 = &gMapTop.mapDataClone[sub_08046518_offset];
|
||||
u16* stack1 = &gMapTop.mapDataOriginal[sub_08046518_offset];
|
||||
u8* stack2 = &gMapTop.vvv[sub_08046518_offset];
|
||||
u8* r6 = &gMapTop.collisionData[sub_08046518_offset];
|
||||
u32 i;
|
||||
|
|
|
@ -20,7 +20,7 @@ void HangingSeed_OnTick(Entity* this) {
|
|||
}
|
||||
|
||||
void HangingSeed_OnCollision(Entity* this) {
|
||||
if (this->contactFlags & 0x80) {
|
||||
if (this->contactFlags & CONTACT_NOW) {
|
||||
CreateFx(this, FX_BUSH, 0x80);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ extern const s8 gUnk_080CD464[];
|
|||
void Helmasaur(HelmasaurEntity* this) {
|
||||
if (super->type == 0) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)Helmasaur_Functions);
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
} else {
|
||||
gUnk_080CD3FC[super->action](this);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ void Helmasaur_OnCollision(HelmasaurEntity* this) {
|
|||
}
|
||||
}
|
||||
if (super->confusedTime != 0) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
|
||||
EnemyFunctionHandlerAfterCollision(super, Helmasaur_Functions);
|
||||
|
@ -224,7 +224,7 @@ void sub_0802BEBC(HelmasaurEntity* this) {
|
|||
super->direction ^= DirectionSouth;
|
||||
ProcessMovement2(super);
|
||||
super->direction ^= DirectionSouth;
|
||||
if (!sub_080044EC(super, Q_16_16(0.125))) {
|
||||
if (BounceUpdate(super, Q_16_16(0.125)) == BOUNCE_DONE_ALL) {
|
||||
sub_0802C1C0(this);
|
||||
}
|
||||
}
|
||||
|
@ -261,7 +261,7 @@ void sub_0802BF3C(HelmasaurEntity* this) {
|
|||
|
||||
void sub_0802BF78(HelmasaurEntity* this) {
|
||||
super->action = 1;
|
||||
super->flags2 = 4;
|
||||
super->collisionMask = 4;
|
||||
super->gustJarFlags = 1;
|
||||
super->direction = super->animationState << 3;
|
||||
InitializeAnimation(super, super->animationState + 8);
|
||||
|
@ -373,8 +373,8 @@ void sub_0802C1C0(HelmasaurEntity* this) {
|
|||
|
||||
void sub_0802C1CC(HelmasaurEntity* this) {
|
||||
const s8* ptr = &gUnk_080CD464[super->animationState << 2];
|
||||
sub_08008796(super, 9, super->x.HALF.HI + ptr[0], super->y.HALF.HI + ptr[1]);
|
||||
sub_08008796(super, 9, super->x.HALF.HI + ptr[2], super->y.HALF.HI + ptr[3]);
|
||||
DoTileInteraction(super, 9, super->x.HALF.HI + ptr[0], super->y.HALF.HI + ptr[1]);
|
||||
DoTileInteraction(super, 9, super->x.HALF.HI + ptr[2], super->y.HALF.HI + ptr[3]);
|
||||
}
|
||||
|
||||
void sub_0802C218(HelmasaurEntity* this) {
|
||||
|
|
|
@ -51,7 +51,7 @@ void sub_080327E0(KeatonEntity* this);
|
|||
|
||||
void Keaton(KeatonEntity* this) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)Keaton_Functions);
|
||||
SetChildOffset(super, 0, 1, -18);
|
||||
EnemySetFXOffset(super, 0, 1, -18);
|
||||
}
|
||||
|
||||
void Keaton_OnTick(KeatonEntity* this) {
|
||||
|
@ -75,7 +75,7 @@ void Keaton_OnCollision(KeatonEntity* this) {
|
|||
}
|
||||
}
|
||||
if (super->confusedTime != 0) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
EnemyFunctionHandlerAfterCollision(super, Keaton_Functions);
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ void Keaton_Action3(KeatonEntity* this) {
|
|||
}
|
||||
|
||||
void Keaton_Action4(KeatonEntity* this) {
|
||||
if (super->child && (super->child->contactFlags & 0x80)) {
|
||||
if (super->child && (super->child->contactFlags & CONTACT_NOW)) {
|
||||
sub_0803275C(this);
|
||||
return;
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ void sub_08032794(KeatonEntity* this) {
|
|||
void sub_080327C8(KeatonEntity* this) {
|
||||
Entity* child;
|
||||
|
||||
child = CreateProjectileWithParent(super, KEATON_DAGGER, 0);
|
||||
child = EnemyCreateProjectile(super, KEATON_DAGGER, 0);
|
||||
if (child != NULL) {
|
||||
child->parent = super;
|
||||
super->child = child;
|
||||
|
|
|
@ -54,7 +54,7 @@ extern const OffsetCoords gUnk_080D0154[];
|
|||
void Lakitu(LakituEntity* this) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)Lakitu_Functions);
|
||||
|
||||
SetChildOffset(super, 0, 1, -16);
|
||||
EnemySetFXOffset(super, 0, 1, -16);
|
||||
}
|
||||
|
||||
void Lakitu_OnTick(LakituEntity* this) {
|
||||
|
@ -96,7 +96,7 @@ void Lakitu_OnCollision(LakituEntity* this) {
|
|||
}
|
||||
|
||||
if (super->confusedTime) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
|
||||
EnemyFunctionHandlerAfterCollision(super, Lakitu_Functions);
|
||||
|
@ -128,7 +128,7 @@ void sub_0803C86C(LakituEntity* this) {
|
|||
}
|
||||
|
||||
void Lakitu_Initialize(LakituEntity* this) {
|
||||
Entity* cloud = CreateProjectileWithParent(super, 17, 0);
|
||||
Entity* cloud = EnemyCreateProjectile(super, 17, 0);
|
||||
if (cloud == NULL) {
|
||||
return;
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ void Lakitu_SpawnLightning(LakituEntity* this) {
|
|||
Entity* lightning;
|
||||
const OffsetCoords* offset;
|
||||
|
||||
lightning = CreateProjectileWithParent(super, LAKITU_LIGHTNING, 0);
|
||||
lightning = EnemyCreateProjectile(super, LAKITU_LIGHTNING, 0);
|
||||
|
||||
if (lightning == NULL) {
|
||||
return;
|
||||
|
@ -342,7 +342,7 @@ void sub_0803CBAC(LakituEntity* this) {
|
|||
|
||||
super->spritePriority.b1 = 1;
|
||||
|
||||
super->flags2 &= 0x7b;
|
||||
super->collisionMask &= 0x7b;
|
||||
|
||||
super->hitType = 0x42;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ enum {
|
|||
|
||||
void Leever(LeeverEntity* this) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)Leever_Functions);
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void Leever_OnTick(LeeverEntity* this) {
|
||||
|
@ -46,13 +46,13 @@ void Leever_OnTick(LeeverEntity* this) {
|
|||
}
|
||||
|
||||
void Leever_OnCollision(LeeverEntity* this) {
|
||||
if (super->contactFlags == 0x80) {
|
||||
if (super->contactFlags == CONTACT_NOW) {
|
||||
if (super->action == 3) {
|
||||
this->unk_74 = 1;
|
||||
}
|
||||
} else {
|
||||
if (super->confusedTime != 0) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
}
|
||||
EnemyFunctionHandlerAfterCollision(super, Leever_Functions);
|
||||
|
@ -62,7 +62,7 @@ void Leever_OnDeath(LeeverEntity* this) {
|
|||
if (super->type == LeeverForm_Red) {
|
||||
GenericDeath(super);
|
||||
} else {
|
||||
CreateDeathFx(super, 0xf1, 0);
|
||||
EnemyCreateDeathFX((Enemy*)super, 0xf1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ extern void (*const gUnk_080CC714[])(LikeLikeEntity*);
|
|||
|
||||
void LikeLike(Entity* this) {
|
||||
EnemyFunctionHandler(this, LikeLike_Functions);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
EnemySetFXOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void LikeLike_OnTick(LikeLikeEntity* this) {
|
||||
|
@ -46,13 +46,13 @@ void LikeLike_OnCollision(LikeLikeEntity* this) {
|
|||
} else {
|
||||
if (super->action == 7) {
|
||||
LikeLike_ReleasePlayer(this);
|
||||
} else if (super->contactFlags & 0x80) {
|
||||
u8 tmp = super->contactFlags & ~0x80;
|
||||
} else if (super->contactFlags & CONTACT_NOW) {
|
||||
u8 tmp = super->contactFlags & ~CONTACT_NOW;
|
||||
if (tmp == 0) {
|
||||
super->action = 7;
|
||||
super->timer = 95;
|
||||
super->subtimer = tmp;
|
||||
super->flags2 &= 0xfc;
|
||||
super->collisionMask &= 0xfc;
|
||||
this->prevSpritePriority = gPlayerEntity.base.spritePriority.b1;
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ void LikeLike_OnCollision(LikeLikeEntity* this) {
|
|||
}
|
||||
|
||||
if (super->confusedTime) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
|
||||
EnemyFunctionHandlerAfterCollision(super, LikeLike_Functions);
|
||||
|
@ -153,7 +153,7 @@ void sub_08027FB4(LikeLikeEntity* this) {
|
|||
if (--super->timer == 0) {
|
||||
super->action = 1;
|
||||
super->timer = 1;
|
||||
super->flags2 |= 1;
|
||||
super->collisionMask |= 1;
|
||||
}
|
||||
GetNextFrame(super);
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ void LikeLike_ReleasePlayer(LikeLikeEntity* this) {
|
|||
super->action = 4;
|
||||
super->timer = 80;
|
||||
super->subtimer = tmp;
|
||||
super->flags2 |= 2;
|
||||
super->collisionMask |= 2;
|
||||
if (super->iframes == 0) {
|
||||
super->iframes = -18;
|
||||
}
|
||||
|
|
|
@ -518,7 +518,7 @@ void sub_0802A098(MadderpillarEntity* this) {
|
|||
|
||||
void sub_0802A0F8(MadderpillarEntity* this) {
|
||||
if (super->health != 0) {
|
||||
if ((super->contactFlags & 0x80) && super->iframes != 0) {
|
||||
if ((super->contactFlags & CONTACT_NOW) && super->iframes != 0) {
|
||||
Entity* entity = super;
|
||||
u32 i;
|
||||
for (i = 0; i < 6; i++) {
|
||||
|
@ -549,7 +549,7 @@ void sub_0802A16C(MadderpillarEntity* this) {
|
|||
}
|
||||
|
||||
void sub_0802A18C(MadderpillarEntity* this) {
|
||||
if (super->contactFlags & 0x80) {
|
||||
if (super->contactFlags & CONTACT_NOW) {
|
||||
switch (super->contactFlags & 0x7f) {
|
||||
case 0:
|
||||
case 1:
|
||||
|
|
|
@ -167,7 +167,8 @@ void MazaalBracelet_OnCollision(MazaalBraceletEntity* this) {
|
|||
|
||||
if (super->type < 2) {
|
||||
if (super->action != 0x2b) {
|
||||
if ((0 < super->iframes) && ((super->contactFlags == 0x95 || (super->contactFlags == 0x8e)))) {
|
||||
if ((0 < super->iframes) &&
|
||||
((super->contactFlags == (CONTACT_NOW | 0x15) || (super->contactFlags == (CONTACT_NOW | 0xe))))) {
|
||||
super->action = 0x28;
|
||||
COLLISION_OFF(super);
|
||||
entity = (MazaalBraceletEntity*)super->parent;
|
||||
|
@ -1299,7 +1300,7 @@ u32 sub_0803B870(MazaalBraceletEntity* this) {
|
|||
Entity* entity;
|
||||
|
||||
entity = super->child;
|
||||
if ((entity->contactFlags & 0x80) != 0 && (gPlayerState.flags & PL_CAPTURED)) {
|
||||
if ((entity->contactFlags & CONTACT_NOW) != 0 && (gPlayerState.flags & PL_CAPTURED)) {
|
||||
super->action = 0x18;
|
||||
super->timer = 68;
|
||||
super->spriteSettings.draw = 0;
|
||||
|
|
|
@ -36,7 +36,7 @@ static void (*const MiniSlime_Functions[])(MiniSlimeEntity*) = {
|
|||
|
||||
void MiniSlime(MiniSlimeEntity* this) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)MiniSlime_Functions);
|
||||
SetChildOffset(super, 0, 1, -8);
|
||||
EnemySetFXOffset(super, 0, 1, -8);
|
||||
}
|
||||
|
||||
void MiniSlime_OnTick(MiniSlimeEntity* this) {
|
||||
|
@ -51,7 +51,7 @@ void MiniSlime_OnTick(MiniSlimeEntity* this) {
|
|||
|
||||
void MiniSlime_OnCollision(MiniSlimeEntity* this) {
|
||||
if (super->confusedTime)
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
|
||||
EnemyFunctionHandlerAfterCollision(super, MiniSlime_Functions);
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ void Moldworm_OnCollision(MoldwormEntity* this) {
|
|||
super->iframes = -8;
|
||||
this->unk_7f = 0;
|
||||
this->unk_7b = 0;
|
||||
if (super->contactFlags == 0x80 || super->contactFlags == 0x9e) {
|
||||
if (super->contactFlags == CONTACT_NOW || super->contactFlags == (CONTACT_NOW | 0x1e)) {
|
||||
super->type2 = 0;
|
||||
this->unk_80 = 0x14;
|
||||
} else {
|
||||
|
@ -442,7 +442,7 @@ void sub_08023894(MoldwormEntity* this) {
|
|||
}
|
||||
|
||||
void sub_0802390C(MoldwormEntity* this) {
|
||||
if (super->contactFlags & 0x80) {
|
||||
if (super->contactFlags & CONTACT_NOW) {
|
||||
Entity* ent = super->child;
|
||||
do {
|
||||
ent->iframes = super->iframes;
|
||||
|
@ -450,7 +450,7 @@ void sub_0802390C(MoldwormEntity* this) {
|
|||
} else {
|
||||
Entity* ent = super->child;
|
||||
do {
|
||||
if (ent->contactFlags & 0x80) {
|
||||
if (ent->contactFlags & CONTACT_NOW) {
|
||||
u8 bVar2 = 0xff - ent->health;
|
||||
if (bVar2 != 0) {
|
||||
u32 tmp;
|
||||
|
|
|
@ -43,7 +43,7 @@ void sub_080332E8(MulldozerEntity*, s32);
|
|||
|
||||
void Mulldozer(MulldozerEntity* this) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)Mulldozer_Functions);
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void Mulldozer_OnInit(MulldozerEntity* this) {
|
||||
|
@ -52,10 +52,10 @@ void Mulldozer_OnInit(MulldozerEntity* this) {
|
|||
|
||||
void Mulldozer_OnCollision(MulldozerEntity* this) {
|
||||
if (super->confusedTime != 0) {
|
||||
Create0x68FX(super, 0x1c);
|
||||
EnemyCreateFX(super, 0x1c);
|
||||
}
|
||||
EnemyFunctionHandlerAfterCollision(super, Mulldozer_Functions);
|
||||
if ((super->contactFlags & 0x80) != 0) {
|
||||
if ((super->contactFlags & CONTACT_NOW) != 0) {
|
||||
switch (super->contactFlags & 0x3f) {
|
||||
case 2:
|
||||
case 3:
|
||||
|
|
|
@ -24,7 +24,7 @@ extern const s8 gUnk_080CA17E[2];
|
|||
// Main
|
||||
void Octorok(Entity* this) {
|
||||
EnemyFunctionHandler(this, Octorok_Functions);
|
||||
SetChildOffset(this, 0, 1, -16);
|
||||
EnemySetFXOffset(this, 0, 1, -16);
|
||||
}
|
||||
|
||||
// Idle
|
||||
|
@ -35,7 +35,7 @@ void Octorok_OnTick(Entity* this) {
|
|||
// Touch player
|
||||
void Octorok_OnCollision(Entity* this) {
|
||||
if (this->confusedTime != 0) {
|
||||
Create0x68FX(this, FX_STARS);
|
||||
EnemyCreateFX(this, FX_STARS);
|
||||
}
|
||||
EnemyFunctionHandlerAfterCollision(this, Octorok_Functions);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ void Octorok_OnDeath(Entity* this) {
|
|||
if (this->type == 0) {
|
||||
GenericDeath(this);
|
||||
} else {
|
||||
CreateDeathFx(this, 241, 0);
|
||||
EnemyCreateDeathFX((Enemy*)this, 241, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ void Octorok_Move(Entity* this) {
|
|||
void Octorok_ShootNut(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frame & 1) {
|
||||
Entity* entity = CreateProjectileWithParent(this, ROCK_PROJECTILE, 0);
|
||||
Entity* entity = EnemyCreateProjectile(this, ROCK_PROJECTILE, 0);
|
||||
if (entity != NULL) {
|
||||
const s8* off;
|
||||
entity->direction = this->direction;
|
||||
|
|
|
@ -343,7 +343,7 @@ void OctorokBoss_Init(OctorokBossEntity* this) {
|
|||
(this->heap)->field_0x2 = 0;
|
||||
(this->heap)->tailCount = 5;
|
||||
super->spriteRendering.b0 = 3;
|
||||
this->field_0x6c.HALF.HI |= 1;
|
||||
((Enemy*)this)->enemyFlags |= EM_FLAG_BOSS;
|
||||
this->unk_76 = 0xa0;
|
||||
this->unk_74 = 0xa0;
|
||||
this->angle.HWORD = 0;
|
||||
|
@ -557,7 +557,7 @@ void OctorokBoss_Action1(OctorokBossEntity* this) {
|
|||
case LEG_FR:
|
||||
case LEG_FL:
|
||||
case LEG_BL:
|
||||
if ((((OctorokBossEntity*)super->parent)->field_0x6c.HALF.HI & 2) != 0) {
|
||||
if (((Enemy*)super->parent)->enemyFlags & EM_FLAG_BOSS_KILLED) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
if (this->heap->mouthObject->base.health == 1) {
|
||||
|
@ -677,7 +677,7 @@ void OctorokBoss_Action1(OctorokBossEntity* this) {
|
|||
this->heap->fallingStonesTimer--;
|
||||
if ((gRoomTransition.frameCount & 3) == 0) {
|
||||
// Falling stones
|
||||
CreateProjectileWithParent(super, OCTOROK_BOSS_PROJECTILE, 3);
|
||||
EnemyCreateProjectile(super, OCTOROK_BOSS_PROJECTILE, 3);
|
||||
}
|
||||
}
|
||||
OctorokBoss_Action1_SubActions[super->subAction](this);
|
||||
|
@ -885,7 +885,7 @@ void OctorokBoss_Action1_Attack_Type2_3(OctorokBossEntity* this) {
|
|||
}
|
||||
|
||||
void OctorokBoss_ExecuteAttackSpitRock(OctorokBossEntity* this) {
|
||||
super->child = CreateProjectileWithParent(super, OCTOROK_BOSS_PROJECTILE, 0);
|
||||
super->child = EnemyCreateProjectile(super, OCTOROK_BOSS_PROJECTILE, 0);
|
||||
if (super->child != NULL) {
|
||||
super->child->parent = super;
|
||||
super->child->direction = ((u8) - this->angle.HALF.HI ^ 0x80);
|
||||
|
@ -1006,7 +1006,7 @@ void OctorokBoss_ExecuteAttackFreeze(OctorokBossEntity* this) {
|
|||
} else {
|
||||
this->timer--;
|
||||
if ((gRoomTransition.frameCount & 3) == 0) {
|
||||
super->child = CreateProjectileWithParent(super, OCTOROK_BOSS_PROJECTILE, 2);
|
||||
super->child = EnemyCreateProjectile(super, OCTOROK_BOSS_PROJECTILE, 2);
|
||||
if (super->child != NULL) {
|
||||
super->child->parent = super;
|
||||
super->child->direction = (u8) - this->angle.HALF.HI ^ 0x80;
|
||||
|
@ -1026,7 +1026,7 @@ void OctorokBoss_Burning(OctorokBossEntity* this) {
|
|||
this->heap->fallingStonesTimer--;
|
||||
if ((gRoomTransition.frameCount & 7) == 0) {
|
||||
// Falling stones
|
||||
CreateProjectileWithParent(super, OCTOROK_BOSS_PROJECTILE, 3);
|
||||
EnemyCreateProjectile(super, OCTOROK_BOSS_PROJECTILE, 3);
|
||||
}
|
||||
}
|
||||
SetAffineInfo(super, this->unk_76, this->unk_74, this->angle.HWORD);
|
||||
|
|
|
@ -26,7 +26,7 @@ void OctorokGolden(Entity* this) {
|
|||
gUnk_080012C8[index](this);
|
||||
} else {
|
||||
OctorokGolden_Functions[GetNextFunction(this)](this);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
EnemySetFXOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ void OctorokGolden_OnTick(Entity* this) {
|
|||
|
||||
void OctorokGolden_OnCollision(Entity* this) {
|
||||
if (this->confusedTime != 0) {
|
||||
Create0x68FX(this, FX_STARS);
|
||||
EnemyCreateFX(this, FX_STARS);
|
||||
}
|
||||
|
||||
EnemyFunctionHandlerAfterCollision(this, OctorokGolden_Functions);
|
||||
|
@ -47,7 +47,7 @@ void OctorokGolden_OnDeath(Entity* this) {
|
|||
SetGlobalFlag(this->type2);
|
||||
}
|
||||
|
||||
CreateDeathFx(this, 0xff, ITEM_RUPEE100);
|
||||
EnemyCreateDeathFX((Enemy*)this, 0xff, ITEM_RUPEE100);
|
||||
}
|
||||
|
||||
void sub_08037CE4(Entity* this) {
|
||||
|
@ -83,7 +83,7 @@ static void sub_08037D54(Entity* this) {
|
|||
this->frame ^= 2;
|
||||
|
||||
if (this->frame & 0x2) {
|
||||
Entity* proj = CreateProjectileWithParent(this, ROCK_PROJECTILE, 0);
|
||||
Entity* proj = EnemyCreateProjectile(this, ROCK_PROJECTILE, 0);
|
||||
if (proj) {
|
||||
const s8* ptr;
|
||||
s32 dir;
|
||||
|
@ -112,16 +112,16 @@ static void sub_08037D54(Entity* this) {
|
|||
|
||||
void sub_08037E14(Entity* this) {
|
||||
u32 dir;
|
||||
u8* layer;
|
||||
u8* collisionData;
|
||||
const s8* ptr;
|
||||
s32 x, y;
|
||||
this->timer = 8;
|
||||
dir = (GetFacingDirection(this, &gPlayerEntity.base) + 4) & 0x18;
|
||||
layer = (u8*)GetLayerByIndex(this->collisionLayer)->collisionData;
|
||||
collisionData = GetLayerByIndex(this->collisionLayer)->collisionData;
|
||||
ptr = gUnk_080CF498 + (dir >> 2);
|
||||
x = this->x.HALF.HI + *ptr;
|
||||
y = this->y.HALF.HI + *(ptr + 1);
|
||||
if (IsTileCollision(layer, x, y, 0)) {
|
||||
if (IsTileCollision(collisionData, x, y, 0)) {
|
||||
this->direction = Random() & 0x18;
|
||||
} else {
|
||||
this->direction = dir;
|
||||
|
|
|
@ -47,7 +47,7 @@ enum {
|
|||
void Peahat(PeahatEntity* this) {
|
||||
if (super->type == PeahatForm_Torso) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)Peahat_Functions);
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
} else {
|
||||
gPeahatPropellerFunctions[super->action](this);
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ void Peahat_OnTick(PeahatEntity* this) {
|
|||
|
||||
void Peahat_OnCollision(PeahatEntity* this) {
|
||||
if (this->unk_82) {
|
||||
if (super->contactFlags == 0x94) {
|
||||
if (super->contactFlags == (CONTACT_NOW | 0x14)) {
|
||||
Entity* entity = CreateEnemy(PEAHAT, PeahatForm_Propeller);
|
||||
if (entity != NULL) {
|
||||
CopyPosition(super, entity);
|
||||
|
@ -74,14 +74,14 @@ void Peahat_OnCollision(PeahatEntity* this) {
|
|||
super->iframes = -30;
|
||||
this->unk_81 = 0;
|
||||
InitializeAnimation(super, super->animationState);
|
||||
} else if (super->contactFlags == 0x9b) {
|
||||
} else if (super->contactFlags == (CONTACT_NOW | 0x1b)) {
|
||||
super->animationState = PeahatAnimation_BrokenPropeller;
|
||||
super->action = 5;
|
||||
super->speed = 0x80;
|
||||
super->iframes = -30;
|
||||
this->unk_81 = 0;
|
||||
InitializeAnimation(super, super->animationState);
|
||||
} else if (super->contactFlags == 0x80) {
|
||||
} else if (super->contactFlags == CONTACT_NOW) {
|
||||
if (super->animationState == PeahatAnimation_Flying) {
|
||||
super->action = 1;
|
||||
super->timer = 30;
|
||||
|
@ -94,7 +94,7 @@ void Peahat_OnCollision(PeahatEntity* this) {
|
|||
}
|
||||
|
||||
if (super->confusedTime)
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
|
||||
EnemyFunctionHandlerAfterCollision(super, Peahat_Functions);
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ void Peahat_ChargeEnd(PeahatEntity* this) {
|
|||
void Peahat_Stunned(PeahatEntity* this) {
|
||||
switch (super->animationState) {
|
||||
default:
|
||||
if (sub_080044EC(super, 0x1800) == 0) {
|
||||
if (BounceUpdate(super, Q_8_8(24.0)) == BOUNCE_DONE_ALL) {
|
||||
super->action = 6;
|
||||
super->timer = 240;
|
||||
super->subtimer = 10;
|
||||
|
@ -267,14 +267,14 @@ void Peahat_Stunned(PeahatEntity* this) {
|
|||
|
||||
void Peahat_RepairPropeller(PeahatEntity* this) {
|
||||
if ((super->subtimer != 0) && (--super->subtimer == 0)) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
|
||||
if (sub_0800442E(super) || (--super->timer == 0)) {
|
||||
super->action = 9;
|
||||
super->zVelocity = Q_16_16(1.5);
|
||||
super->direction = Random() & 0x1f;
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
super->animationState = PeahatAnimation_RepairPropeller;
|
||||
InitializeAnimation(super, super->animationState);
|
||||
}
|
||||
|
@ -282,14 +282,14 @@ void Peahat_RepairPropeller(PeahatEntity* this) {
|
|||
|
||||
void Peahat_Recover(PeahatEntity* this) {
|
||||
if ((super->subtimer != 0) && (--super->subtimer == 0)) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
|
||||
if (sub_0800442E(super) || (--super->timer == 0)) {
|
||||
super->action = 8;
|
||||
super->timer = 240;
|
||||
super->direction = Random() & 0x1f;
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ void Pesto_OnTick(PestoEntity* this) {
|
|||
|
||||
void Pesto_OnCollision(PestoEntity* this) {
|
||||
if (super->hitType != 0x6e) {
|
||||
if (super->contactFlags == 0x80) {
|
||||
if (super->contactFlags == CONTACT_NOW) {
|
||||
this->unk_86 = 0x30;
|
||||
|
||||
if ((this->unk_83 & 0xf) == 3 && super->action == 6) {
|
||||
|
@ -185,7 +185,7 @@ void sub_080240B8(PestoEntity* this) {
|
|||
Entity* entity;
|
||||
|
||||
this->unk_83 = 0;
|
||||
entity = CreateProjectileWithParent(super, DIRT_BALL_PROJECTILE, this->unk_83);
|
||||
entity = EnemyCreateProjectile(super, DIRT_BALL_PROJECTILE, this->unk_83);
|
||||
if (entity != NULL) {
|
||||
super->child = entity;
|
||||
entity->parent = super;
|
||||
|
@ -406,7 +406,7 @@ void sub_080244E8(PestoEntity* this) {
|
|||
super->direction = DirectionSouth;
|
||||
super->speed = tmp;
|
||||
this->unk_84 = 0;
|
||||
super->flags2 &= 0xfc;
|
||||
super->collisionMask &= 0xfc;
|
||||
sub_080249DC(this);
|
||||
this->unk_85 = gPlayerEntity.base.spritePriority.b1;
|
||||
gPlayerEntity.base.flags &= ~ENT_COLLIDE;
|
||||
|
@ -428,7 +428,7 @@ void sub_080244E8(PestoEntity* this) {
|
|||
super->z.HALF.HI -= 0xe;
|
||||
this->unk_78 -= 0xe;
|
||||
|
||||
entity = CreateProjectileWithParent(super, DIRT_BALL_PROJECTILE, this->unk_83);
|
||||
entity = EnemyCreateProjectile(super, DIRT_BALL_PROJECTILE, this->unk_83);
|
||||
if (entity != NULL) {
|
||||
entity->parent = super;
|
||||
entity->z.HALF.HI += 0xe;
|
||||
|
@ -451,7 +451,7 @@ void sub_080244E8(PestoEntity* this) {
|
|||
super->z.HALF.HI -= 0xe;
|
||||
this->unk_78 -= 0xe;
|
||||
|
||||
entity = CreateProjectileWithParent(super, DIRT_BALL_PROJECTILE, this->unk_83);
|
||||
entity = EnemyCreateProjectile(super, DIRT_BALL_PROJECTILE, this->unk_83);
|
||||
if (entity != NULL) {
|
||||
entity->parent = super;
|
||||
entity->z.HALF.HI += 0xe;
|
||||
|
@ -877,7 +877,7 @@ void sub_08024F50(PestoEntity* this) {
|
|||
gPlayerEntity.base.spritePriority.b1 = this->unk_85;
|
||||
gPlayerEntity.base.z.HALF.HI = gPlayerEntity.base.spriteOffsetY;
|
||||
gPlayerEntity.base.spriteOffsetY = 0;
|
||||
super->flags2 |= 3;
|
||||
super->collisionMask |= 3;
|
||||
this->unk_83 = 0xc0;
|
||||
this->unk_80 += 2;
|
||||
this->unk_84 = 0;
|
||||
|
|
|
@ -57,7 +57,7 @@ extern const s8 gUnk_080CC0C2[];
|
|||
|
||||
void Puffstool(PuffstoolEntity* this) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)Puffstool_Functions);
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void Puffstool_OnTick(PuffstoolEntity* this) {
|
||||
|
@ -72,7 +72,7 @@ void Puffstool_OnCollide(PuffstoolEntity* this) {
|
|||
/* ... */
|
||||
break;
|
||||
case 0x1b:
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
|
||||
tmp = gUnk_080CBFE8[(*(Entity**)&super->contactedEntity)->type];
|
||||
if (tmp < this->unk_82) {
|
||||
|
@ -133,7 +133,7 @@ void sub_08025180(PuffstoolEntity* this) {
|
|||
super->timer = Random();
|
||||
super->animationState = (((*(Entity**)&super->contactedEntity)->direction ^ 0x10) >> 3);
|
||||
InitializeAnimation(super, super->animationState + 4);
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
}
|
||||
|
||||
void sub_080251AC(PuffstoolEntity* this) {
|
||||
|
@ -292,7 +292,7 @@ void sub_080254B4(PuffstoolEntity* this) {
|
|||
sub_080256B4(this);
|
||||
} else {
|
||||
super->action = 0xc;
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
InitializeAnimation(super, 0);
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ void sub_0802563C(PuffstoolEntity* this) {
|
|||
super->hitType = 0x82;
|
||||
this->unk_82 = 240;
|
||||
sub_080256B4(this);
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
} else if (this->unk_84 < 120) {
|
||||
u32 tmp3 = gUnk_080CBFF8[this->unk_84 >> 4];
|
||||
if ((this->unk_84 & tmp3) == 0) {
|
||||
|
|
|
@ -49,7 +49,7 @@ void RockChuchu_OnCollision(Entity* this) {
|
|||
#ifndef EU
|
||||
entity->iframes = -8;
|
||||
#endif
|
||||
sub_0804A4E4(this, entity);
|
||||
EnemyCopyParams(this, entity);
|
||||
this->action = 2;
|
||||
COLLISION_OFF(this);
|
||||
this->spriteSettings.draw = 0;
|
||||
|
@ -100,7 +100,7 @@ void sub_080223E4(Entity* this) {
|
|||
|
||||
entity = this->child;
|
||||
if (entity != NULL) {
|
||||
entity->contactFlags = 0x94;
|
||||
entity->contactFlags = (CONTACT_NOW | 0x14);
|
||||
entity->iframes = 0x10;
|
||||
#ifndef EU
|
||||
entity->knockbackDuration = 0xc;
|
||||
|
|
|
@ -52,7 +52,7 @@ void Rollobite_OnCollision(RollobiteEntity* this) {
|
|||
InitializeAnimation(super, super->animationState + 8);
|
||||
}
|
||||
|
||||
if (super->contactFlags != 0x80) {
|
||||
if (super->contactFlags != CONTACT_NOW) {
|
||||
if (super->action == 4 || super->action == 5) {
|
||||
super->action = 4;
|
||||
super->timer = 180;
|
||||
|
@ -61,7 +61,7 @@ void Rollobite_OnCollision(RollobiteEntity* this) {
|
|||
}
|
||||
}
|
||||
|
||||
if (super->contactFlags == 0x93)
|
||||
if (super->contactFlags == (CONTACT_NOW | 0x13))
|
||||
Rollobite_OnTick(this);
|
||||
}
|
||||
|
||||
|
@ -188,16 +188,16 @@ void Rollobite_RolledUp(RollobiteEntity* this) {
|
|||
if ((super->frame & ANIM_DONE) == 0)
|
||||
GetNextFrame(super);
|
||||
|
||||
unk = sub_080044EC(super, 0x2800);
|
||||
unk = BounceUpdate(super, Q_8_8(40.0));
|
||||
|
||||
if (unk == 0) {
|
||||
if (unk == BOUNCE_DONE_ALL) {
|
||||
if (--super->timer == 0) {
|
||||
super->action = 5;
|
||||
InitializeAnimation(super, super->animationState + 12);
|
||||
}
|
||||
RegisterCarryEntity(super);
|
||||
} else {
|
||||
if (unk == 1)
|
||||
if (unk == BOUNCE_INIT_NEXT)
|
||||
EnqueueSFX(SFX_PLACE_OBJ);
|
||||
|
||||
if (!(super->direction & DIR_NOT_MOVING_CHECK))
|
||||
|
|
|
@ -43,7 +43,7 @@ u32 sub_0803163C(RopeEntity* this);
|
|||
|
||||
void Rope(RopeEntity* this) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)Rope_Functions);
|
||||
SetChildOffset(super, 0, 1, -16);
|
||||
EnemySetFXOffset(super, 0, 1, -16);
|
||||
}
|
||||
|
||||
void Rope_OnTick(RopeEntity* this) {
|
||||
|
@ -63,7 +63,7 @@ void Rope_OnCollision(RopeEntity* this) {
|
|||
sub_08031600(this);
|
||||
}
|
||||
if (super->confusedTime) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
EnemyFunctionHandlerAfterCollision(super, Rope_Functions);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ void RopeGolden(RopeGoldenEntity* this) {
|
|||
gUnk_080012C8[x](super);
|
||||
} else {
|
||||
RopeGolden_Functions[GetNextFunction(super)](this);
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ void RopeGolden_OnTick(RopeGoldenEntity* this) {
|
|||
|
||||
void RopeGolden_OnCollision(RopeGoldenEntity* this) {
|
||||
if (super->confusedTime != 0) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
EnemyFunctionHandlerAfterCollision(super, RopeGolden_Functions);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ void RopeGolden_OnDeath(RopeGoldenEntity* this) {
|
|||
if ((super->gustJarState & 2) == 0) {
|
||||
SetGlobalFlag(super->type2);
|
||||
}
|
||||
CreateDeathFx(super, 0xff, ITEM_RUPEE100);
|
||||
EnemyCreateDeathFX((Enemy*)super, 0xff, ITEM_RUPEE100);
|
||||
}
|
||||
|
||||
void sub_08038258(RopeGoldenEntity* this) {
|
||||
|
|
|
@ -40,7 +40,7 @@ void RupeeLike(RupeeLikeEntity* this) {
|
|||
u32 uVar1;
|
||||
|
||||
if (super->type2 == 0) {
|
||||
uVar1 = (u8)sub_080043E8(super);
|
||||
uVar1 = (u8)GetTileHazardType(super);
|
||||
if (uVar1 != 0) {
|
||||
if (super->action == 4) {
|
||||
sub_080296D8(this);
|
||||
|
@ -48,7 +48,7 @@ void RupeeLike(RupeeLikeEntity* this) {
|
|||
sub_08001290(super, uVar1);
|
||||
} else {
|
||||
RupeeLike_Functions[GetNextFunction(super)](this);
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
}
|
||||
} else {
|
||||
sub_080293DC(this);
|
||||
|
@ -75,12 +75,12 @@ void RupeeLike_OnCollision(RupeeLikeEntity* this) {
|
|||
super->timer = 60;
|
||||
super->subtimer = 0;
|
||||
this->unk_83 = 0x41;
|
||||
super->flags2 &= 0xfc;
|
||||
super->collisionMask &= 0xfc;
|
||||
this->unk_80 = gPlayerEntity.base.spritePriority.b1;
|
||||
EnqueueSFX(SFX_PLACE_OBJ);
|
||||
} else {
|
||||
if (super->confusedTime != 0) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ void RupeeLike_OnCollision(RupeeLikeEntity* this) {
|
|||
}
|
||||
|
||||
void RupeeLike_OnDeath(RupeeLikeEntity* this) {
|
||||
CreateDeathFx(super, 0xff, gUnk_080CCC34[this->unk_84 * 3 + super->type]);
|
||||
EnemyCreateDeathFX((Enemy*)super, 0xff, gUnk_080CCC34[this->unk_84 * 3 + super->type]);
|
||||
}
|
||||
|
||||
void RupeeLike_OnGrabbed(RupeeLikeEntity* this) {
|
||||
|
@ -255,7 +255,7 @@ void sub_080296D8(RupeeLikeEntity* this) {
|
|||
gPlayerEntity.base.speed = 0x140;
|
||||
super->action = 5;
|
||||
super->subtimer = 60;
|
||||
super->flags2 |= 3;
|
||||
super->collisionMask |= 3;
|
||||
if ((s8)super->iframes == 0) {
|
||||
super->iframes = 0xf4;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ void sub_08038B90(ScissorsBeetleEntity*);
|
|||
|
||||
void ScissorsBeetle(Entity* this) {
|
||||
EnemyFunctionHandler(this, ScissorsBeetle_Functions);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
EnemySetFXOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void ScissorsBeetle_OnTick(ScissorsBeetleEntity* this) {
|
||||
|
@ -40,11 +40,11 @@ void ScissorsBeetle_OnTick(ScissorsBeetleEntity* this) {
|
|||
void ScissorsBeetle_OnCollision(ScissorsBeetleEntity* this) {
|
||||
Entity* child;
|
||||
if (super->confusedTime) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
|
||||
EnemyFunctionHandlerAfterCollision(super, ScissorsBeetle_Functions);
|
||||
if ((super->contactFlags & 0x80) && super->action != 4) {
|
||||
if ((super->contactFlags & CONTACT_NOW) && super->action != 4) {
|
||||
u32 knockbackDir;
|
||||
child = super->child;
|
||||
child->iframes = super->iframes;
|
||||
|
|
|
@ -40,7 +40,7 @@ static void (*const Slime_Functions[])(SlimeEntity*) = {
|
|||
|
||||
void Slime(SlimeEntity* this) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)Slime_Functions);
|
||||
SetChildOffset(super, 0, 1, -12);
|
||||
EnemySetFXOffset(super, 0, 1, -12);
|
||||
}
|
||||
|
||||
void Slime_OnTick(SlimeEntity* this) {
|
||||
|
@ -58,7 +58,7 @@ void Slime_OnCollision(SlimeEntity* this) {
|
|||
}
|
||||
|
||||
if (super->confusedTime != 0) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ void sub_08045178(SlimeEntity* this, Entity* child, int offsetX, int offsetY) {
|
|||
if (child == NULL)
|
||||
return;
|
||||
|
||||
sub_0804A4E4(super, child);
|
||||
EnemyCopyParams(super, child);
|
||||
if (GetCollisionDataRelativeTo(child, offsetX, offsetY))
|
||||
return;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ void Sluggula(Entity* this) {
|
|||
if (this->type == 1) {
|
||||
EnemyFunctionHandler(this, Sluggula_Functions);
|
||||
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
EnemySetFXOffset(this, 0, 1, -0x10);
|
||||
} else if (this->type == 0) {
|
||||
if (this->z.HALF.HI == 0) {
|
||||
u32 idx = sub_080012DC(this);
|
||||
|
@ -34,7 +34,7 @@ void Sluggula(Entity* this) {
|
|||
}
|
||||
gUnk_080CBDD4[GetNextFunction(this)](this);
|
||||
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
EnemySetFXOffset(this, 0, 1, -0x10);
|
||||
} else {
|
||||
sub_08023E10(this);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ void Sluggula_OnTick(Entity* this) {
|
|||
|
||||
void Sluggula_OnCollision(Entity* this) {
|
||||
if (this->confusedTime)
|
||||
Create0x68FX(this, FX_STARS);
|
||||
EnemyCreateFX(this, FX_STARS);
|
||||
|
||||
if (this->type == 1) {
|
||||
EnemyFunctionHandlerAfterCollision(this, Sluggula_Functions);
|
||||
|
@ -130,7 +130,7 @@ void sub_08023CE0(Entity* this) {
|
|||
if (this->frame & ANIM_DONE) {
|
||||
Entity* entity = CreateEnemy(SLUGGULA, 1);
|
||||
if (entity != NULL) {
|
||||
sub_0804A4E4(this, entity);
|
||||
EnemyCopyParams(this, entity);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -22,7 +22,7 @@ void Spark_OnTick(Entity* this) {
|
|||
void Spark_OnCollision(Entity* this) {
|
||||
Entity* entity;
|
||||
|
||||
if (this->contactFlags & 0x80) {
|
||||
if (this->contactFlags & CONTACT_NOW) {
|
||||
if ((this->contactFlags & 0x7f) == 0x14) {
|
||||
COLLISION_OFF(this);
|
||||
this->iframes = 0;
|
||||
|
|
|
@ -42,7 +42,7 @@ extern const Hitbox* const gUnk_080CC944[];
|
|||
|
||||
void SpearMoblin(SpearMoblinEntity* this) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)SpearMoblin_Functions);
|
||||
SetChildOffset(super, 0, 1, -0x20);
|
||||
EnemySetFXOffset(super, 0, 1, -0x20);
|
||||
if (super->child && super->child->next) {
|
||||
CopyPosition(super, super->child);
|
||||
}
|
||||
|
@ -54,10 +54,10 @@ void SpearMoblin_OnTick(SpearMoblinEntity* this) {
|
|||
|
||||
void SpearMoblin_OnCollision(SpearMoblinEntity* this) {
|
||||
if (super->confusedTime != 0)
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
|
||||
EnemyFunctionHandlerAfterCollision(super, SpearMoblin_Functions);
|
||||
if (super->contactFlags & 0x80) {
|
||||
if (super->contactFlags & CONTACT_NOW) {
|
||||
if (super->action != 4) {
|
||||
sub_08028754(this);
|
||||
} else {
|
||||
|
@ -398,7 +398,7 @@ bool32 sub_080288A4(SpearMoblinEntity* this) {
|
|||
|
||||
void sub_080288C0(SpearMoblinEntity* this) {
|
||||
Entity* entity = super->child;
|
||||
if ((entity != NULL) && (entity->contactFlags & 0x80)) {
|
||||
if ((entity != NULL) && (entity->contactFlags & CONTACT_NOW)) {
|
||||
super->knockbackDirection = entity->knockbackDirection;
|
||||
super->iframes = -entity->iframes;
|
||||
super->knockbackSpeed = entity->knockbackSpeed;
|
||||
|
|
|
@ -22,7 +22,7 @@ extern const s8 gUnk_080CD318[];
|
|||
|
||||
void SpikedBeetle(Entity* this) {
|
||||
EnemyFunctionHandler(this, SpikedBeetle_Functions);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
EnemySetFXOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void SpikedBeetle_OnTick(Entity* this) {
|
||||
|
@ -63,7 +63,7 @@ void SpikedBeetle_OnCollision(Entity* this) {
|
|||
}
|
||||
}
|
||||
if (this->confusedTime) {
|
||||
Create0x68FX(this, FX_STARS);
|
||||
EnemyCreateFX(this, FX_STARS);
|
||||
}
|
||||
EnemyFunctionHandlerAfterCollision(this, SpikedBeetle_Functions);
|
||||
}
|
||||
|
@ -152,12 +152,12 @@ void sub_0802B880(Entity* this) {
|
|||
|
||||
void sub_0802B8B0(Entity* this) {
|
||||
ProcessMovement2(this);
|
||||
switch (sub_080044EC(this, 0x1800)) {
|
||||
case 0:
|
||||
switch (BounceUpdate(this, Q_8_8(24.0))) {
|
||||
case BOUNCE_DONE_ALL:
|
||||
this->action = 7;
|
||||
this->timer = 150;
|
||||
/* fallthrough */
|
||||
case 1:
|
||||
case BOUNCE_INIT_NEXT:
|
||||
EnqueueSFX(SFX_12B);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ extern u32 sub_0804A024(Entity*, u32, u32);
|
|||
|
||||
void SpinyBeetle(Entity* this) {
|
||||
EnemyFunctionHandler(this, SpinyBeetle_Functions);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
EnemySetFXOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void SpinyBeetle_OnTick(SpinyBeetleEntity* this) {
|
||||
|
@ -46,11 +46,11 @@ void SpinyBeetle_OnTick(SpinyBeetleEntity* this) {
|
|||
|
||||
void SpinyBeetle_OnCollision(SpinyBeetleEntity* this) {
|
||||
if (super->confusedTime) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
|
||||
EnemyFunctionHandlerAfterCollision(super, SpinyBeetle_Functions);
|
||||
if (super->contactFlags & 0x80) {
|
||||
if (super->contactFlags & CONTACT_NOW) {
|
||||
if (super->iframes > 0 && super->child) {
|
||||
sub_08033E1C(this);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ extern Entity* gUnk_020000B0;
|
|||
|
||||
void SpinyChuchu(SpinyChuchuEntity* this) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)SpinyChuchu_Functions);
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void SpinyChuchu_OnTick(SpinyChuchuEntity* this) {
|
||||
|
@ -55,13 +55,13 @@ void SpinyChuchu_OnCollision(SpinyChuchuEntity* this) {
|
|||
case 0x18:
|
||||
case 0x19:
|
||||
case 0x1a:
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
super->action = 5;
|
||||
super->hitType = 0x5c;
|
||||
InitializeAnimation(super, 1);
|
||||
}
|
||||
} else if (super->contactFlags == 0x94) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
} else if (super->contactFlags == (CONTACT_NOW | 0x14)) {
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
super->action = 5;
|
||||
InitializeAnimation(super, 1);
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ void sub_0802281C(SpinyChuchuEntity* this) {
|
|||
super->action = 2;
|
||||
super->speed = 0x20;
|
||||
InitializeAnimation(super, 0);
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ u32 sub_08039B28(StalfosEntity*);
|
|||
|
||||
void Stalfos(StalfosEntity* this) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)&Stalfos_Functions);
|
||||
SetChildOffset(super, 0, 1, -0x12);
|
||||
EnemySetFXOffset(super, 0, 1, -0x12);
|
||||
}
|
||||
|
||||
void Stalfos_OnTick(StalfosEntity* this) {
|
||||
|
@ -93,7 +93,7 @@ void Stalfos_OnCollision(StalfosEntity* this) {
|
|||
r1 = super->child;
|
||||
if (r1 == NULL) {
|
||||
if (super->action < 9) {
|
||||
r1 = CreateProjectileWithParent(super, STALFOS_PROJECTILE, 1);
|
||||
r1 = EnemyCreateProjectile(super, STALFOS_PROJECTILE, 1);
|
||||
if (r1 != NULL) {
|
||||
r1->frameIndex = super->animationState << 1;
|
||||
r1->type2 = 2;
|
||||
|
@ -110,17 +110,17 @@ void Stalfos_OnCollision(StalfosEntity* this) {
|
|||
sub_08039A48(this);
|
||||
this->unk_78 += 0x5a;
|
||||
}
|
||||
super->flags2 &= 0xfb;
|
||||
super->collisionMask &= 0xfb;
|
||||
}
|
||||
if (super->confusedTime != 0) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
EnemyFunctionHandlerAfterCollision(super, Stalfos_Functions);
|
||||
}
|
||||
|
||||
void Stalfos_OnDeath(StalfosEntity* this) {
|
||||
if (super->type == 0) {
|
||||
CreateDeathFx(super, 0xf3, 0);
|
||||
EnemyCreateDeathFX((Enemy*)super, 0xf3, 0);
|
||||
} else {
|
||||
GenericDeath(super);
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ void Stalfos_SubAction1(StalfosEntity* this) {
|
|||
void Stalfos_SubAction2(StalfosEntity* this) {
|
||||
Entity* projectile = super->child;
|
||||
if (projectile == NULL) {
|
||||
projectile = CreateProjectileWithParent(super, STALFOS_PROJECTILE, 1);
|
||||
projectile = EnemyCreateProjectile(super, STALFOS_PROJECTILE, 1);
|
||||
if (projectile != NULL) {
|
||||
projectile->frameIndex = super->animationState << 1;
|
||||
projectile->type2 = 1;
|
||||
|
@ -154,7 +154,7 @@ void Stalfos_SubAction2(StalfosEntity* this) {
|
|||
}
|
||||
super->child = NULL;
|
||||
super->gustJarState &= 0xfb;
|
||||
super->flags2 &= 0xfb;
|
||||
super->collisionMask &= 0xfb;
|
||||
sub_08039A48(this);
|
||||
this->unk_78 += 0x5a;
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ void Stalfos_Action12(StalfosEntity* this) {
|
|||
} else {
|
||||
sub_08039A48(this);
|
||||
}
|
||||
super->flags2 |= 4;
|
||||
super->collisionMask |= 4;
|
||||
this->unk_78 += 0x3c;
|
||||
}
|
||||
}
|
||||
|
@ -397,7 +397,7 @@ void sub_08039A00(StalfosEntity* this, u32 param_2) {
|
|||
}
|
||||
|
||||
void sub_08039A20(StalfosEntity* this) {
|
||||
Entity* projectile = CreateProjectileWithParent(super, BONE_PROJECTILE, 0);
|
||||
Entity* projectile = EnemyCreateProjectile(super, BONE_PROJECTILE, 0);
|
||||
if (projectile != NULL) {
|
||||
projectile->direction = super->direction;
|
||||
this->unk_7c = 0x3c;
|
||||
|
@ -432,7 +432,7 @@ void sub_08039A70(StalfosEntity* this) {
|
|||
void sub_08039AD4(StalfosEntity* this) {
|
||||
u32 position = sub_08039B28(this);
|
||||
if (position != 0xffff) {
|
||||
Entity* projectile = CreateProjectileWithParent(super, STALFOS_PROJECTILE, super->type2);
|
||||
Entity* projectile = EnemyCreateProjectile(super, STALFOS_PROJECTILE, super->type2);
|
||||
if (projectile != NULL) {
|
||||
projectile->parent = super;
|
||||
super->action = 0xb;
|
||||
|
|
|
@ -46,7 +46,7 @@ void Takkuri_OnTick(TakkuriEntity* this) {
|
|||
}
|
||||
|
||||
void Takkuri_OnCollision(TakkuriEntity* this) {
|
||||
if (super->contactFlags & 0x80) {
|
||||
if (super->contactFlags & CONTACT_NOW) {
|
||||
if ((super->contactFlags & 0x7f) == 0) {
|
||||
u32 direction;
|
||||
sub_0803C0AC(super);
|
||||
|
|
|
@ -38,7 +38,7 @@ static void (*const Tektite_Functions[])(TektiteEntity*) = {
|
|||
|
||||
void Tektite(TektiteEntity* this) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)Tektite_Functions);
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void Tektite_OnTick(TektiteEntity* this) {
|
||||
|
@ -60,10 +60,10 @@ static const u8 gUnk_080CDEF8[] = {
|
|||
|
||||
void Tektite_OnCollision(TektiteEntity* this) {
|
||||
if (super->confusedTime != 0) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
EnemyFunctionHandlerAfterCollision(super, Tektite_Functions);
|
||||
if ((super->contactFlags & 0x80) != 0) {
|
||||
if ((super->contactFlags & CONTACT_NOW) != 0) {
|
||||
switch (super->contactFlags & 0x3f) {
|
||||
case 0x14:
|
||||
super->action = 1;
|
||||
|
@ -147,7 +147,7 @@ void sub_0802F300(TektiteEntity* this) {
|
|||
temp = super->z.HALF.HI;
|
||||
rand = Random() & 0xf;
|
||||
|
||||
if (sub_080044EC(super, this->unk_80) == 1) {
|
||||
if (BounceUpdate(super, this->unk_80) == BOUNCE_INIT_NEXT) {
|
||||
super->action = 3;
|
||||
super->subAction = 0;
|
||||
if (super->type != 0) {
|
||||
|
|
|
@ -33,7 +33,7 @@ static void (*const TektiteGolden_Functions[])(TektiteGoldenEntity*) = {
|
|||
|
||||
void TektiteGolden(TektiteGoldenEntity* this) {
|
||||
EnemyFunctionHandler(super, (EntityActionArray)TektiteGolden_Functions);
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void TektiteGolden_OnTick(TektiteGoldenEntity* this) {
|
||||
|
@ -48,10 +48,10 @@ void TektiteGolden_OnTick(TektiteGoldenEntity* this) {
|
|||
|
||||
void TektiteGolden_OnCollision(TektiteGoldenEntity* this) {
|
||||
if (super->confusedTime != 0) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
EnemyFunctionHandlerAfterCollision(super, TektiteGolden_Functions);
|
||||
if (super->contactFlags == 0x94) {
|
||||
if (super->contactFlags == (CONTACT_NOW | 0x14)) {
|
||||
super->action = 1;
|
||||
super->subAction = 0;
|
||||
super->timer = 20;
|
||||
|
@ -78,7 +78,7 @@ void TektiteGolden_OnDeath(TektiteGoldenEntity* this) {
|
|||
} else {
|
||||
uVar1 = ITEM_RUPEE100;
|
||||
}
|
||||
CreateDeathFx(super, 0xff, uVar1);
|
||||
EnemyCreateDeathFX((Enemy*)super, 0xff, uVar1);
|
||||
}
|
||||
|
||||
void TektiteGolden_OnConfused(TektiteGoldenEntity* this) {
|
||||
|
@ -129,7 +129,7 @@ void sub_08038048(TektiteGoldenEntity* this) {
|
|||
temp = super->z.HALF.HI;
|
||||
rand = Random() & 0xf;
|
||||
|
||||
if (sub_080044EC(super, 0x3000) == 1) {
|
||||
if (BounceUpdate(super, Q_8_8(48.0)) == BOUNCE_INIT_NEXT) {
|
||||
super->action = 3;
|
||||
super->subAction = 0;
|
||||
super->timer = 20;
|
||||
|
|
|
@ -122,7 +122,7 @@ void TorchTrap_Reset(TorchTrapEntity* this) {
|
|||
}
|
||||
|
||||
void TorchTrap_CreateProjectile(TorchTrapEntity* this) {
|
||||
Entity* proj = CreateProjectileWithParent(super, TORCH_TRAP_PROJECTILE, 0);
|
||||
Entity* proj = EnemyCreateProjectile(super, TORCH_TRAP_PROJECTILE, 0);
|
||||
if (proj) {
|
||||
u16 speed = super->speed;
|
||||
if (super->speed) {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* @brief Tree Item enemy
|
||||
*/
|
||||
#include "enemy.h"
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "object.h"
|
||||
|
||||
|
@ -15,8 +16,6 @@ typedef struct {
|
|||
|
||||
static bool32 ShouldSpawnTreeItem(TreeItemEntity*);
|
||||
|
||||
extern void SetRoomTrackerFlag(Entity*);
|
||||
|
||||
const u8 gTreeItemDropTables[][16] = {
|
||||
{ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
|
||||
{ 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
|
||||
|
@ -74,7 +73,7 @@ void TreeItem(TreeItemEntity* this) {
|
|||
break;
|
||||
}
|
||||
|
||||
SetRoomTrackerFlag(super);
|
||||
EnemyDisableRespawn(super);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ typedef struct VaatiArm_HeapStruct {
|
|||
VaatiArm_HeapStruct1 s1[5];
|
||||
} VaatiArm_HeapStruct;
|
||||
|
||||
extern void sub_0804AA1C(Entity*);
|
||||
extern void EnemyDetachFX(Entity*);
|
||||
|
||||
static u32 sub_080437DC(VaatiArmEntity*);
|
||||
static bool32 sub_08043C98(VaatiArmEntity*);
|
||||
|
@ -835,7 +835,7 @@ static void sub_08043130(VaatiArmEntity* this) {
|
|||
if (super->spriteSettings.draw == 0) {
|
||||
super->subAction = 9;
|
||||
super->timer = 60;
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -913,7 +913,7 @@ void sub_080432A8(VaatiArmEntity* this) {
|
|||
super->subAction = 1;
|
||||
super->timer = 0x1e;
|
||||
((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk04.HWORD = 0x4000;
|
||||
sub_0804AA1C(&((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base);
|
||||
EnemyDetachFX(&((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1066,7 +1066,7 @@ static void sub_08043580(VaatiArmEntity* this) {
|
|||
entity->collisionFlags = entity->collisionFlags | 0x10;
|
||||
entity->hitType = 0x39;
|
||||
entity->hitbox = (Hitbox*)&gUnk_080FD538;
|
||||
sub_0804AA1C(super);
|
||||
EnemyDetachFX(super);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1401,7 +1401,7 @@ static void sub_08043C40(VaatiArmEntity* this, VaatiArm_HeapStruct1* heapStruct)
|
|||
static bool32 sub_08043C98(VaatiArmEntity* this) {
|
||||
#if defined EU || defined JP
|
||||
Entity* e1 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base;
|
||||
if ((e1->contactFlags == 0x9d)) {
|
||||
if ((e1->contactFlags == (CONTACT_NOW | 0x1d))) {
|
||||
sub_08043D08(this);
|
||||
return TRUE;
|
||||
} else {
|
||||
|
@ -1410,7 +1410,7 @@ static bool32 sub_08043C98(VaatiArmEntity* this) {
|
|||
#else
|
||||
Entity* e1 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[2]->base;
|
||||
Entity* e2 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base;
|
||||
if ((e1->contactFlags == 0x9d) || (e2->contactFlags == 0x9d)) {
|
||||
if ((e1->contactFlags == (CONTACT_NOW | 0x1d)) || (e2->contactFlags == (CONTACT_NOW | 0x1d))) {
|
||||
sub_08043D08(this);
|
||||
gRoomTransition.field_0x38 |= 2;
|
||||
return TRUE;
|
||||
|
@ -1423,7 +1423,7 @@ static bool32 sub_08043C98(VaatiArmEntity* this) {
|
|||
static void sub_08043CD4(VaatiArmEntity* this) {
|
||||
u32 i;
|
||||
for (i = 0; i < 5; i++) {
|
||||
if (((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base.contactFlags == 0x9d) {
|
||||
if (((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base.contactFlags == (CONTACT_NOW | 0x1d)) {
|
||||
this->unk_7c = 0x78;
|
||||
this->unk_7d = i;
|
||||
return;
|
||||
|
@ -1443,7 +1443,7 @@ static void sub_08043D08(VaatiArmEntity* this) {
|
|||
entity->flags &= ~ENT_COLLIDE;
|
||||
entity->spriteSettings.draw = 0;
|
||||
InitializeAnimation(entity, 0x13);
|
||||
sub_0804AA1C(entity);
|
||||
EnemyDetachFX(entity);
|
||||
fx = CreateFx(entity, FX_GIANT_EXPLOSION4, 0);
|
||||
if (fx != NULL) {
|
||||
fx->x.HALF.HI += gUnk_080D13E9[super->type2];
|
||||
|
|
|
@ -58,7 +58,7 @@ void VaatiBall(VaatiBallEntity* this) {
|
|||
super->health = -1;
|
||||
}
|
||||
|
||||
if (super->contactFlags & 0x80) {
|
||||
if (super->contactFlags & CONTACT_NOW) {
|
||||
if ((super->contactFlags & 0x3f) == 0 && super->action == 6) {
|
||||
ModHealth(-2);
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ void sub_08044868(VaatiBallEntity* this) {
|
|||
if (vaati->unk_86 > 1) {
|
||||
u8 draw = super->spriteSettings.draw;
|
||||
if (draw == 1 && this->unk_84 == 0) {
|
||||
vaati = (VaatiBallEntity*)CreateProjectileWithParent(super, V1_DARK_MAGIC_PROJECTILE, 0);
|
||||
vaati = (VaatiBallEntity*)EnemyCreateProjectile(super, V1_DARK_MAGIC_PROJECTILE, 0);
|
||||
if (vaati) {
|
||||
vaati->base.type2 = 1;
|
||||
vaati->base.parent = super;
|
||||
|
@ -303,7 +303,7 @@ void sub_080449F8(VaatiBallEntity* this) {
|
|||
this->unk_74++;
|
||||
draw = super->spriteSettings.draw;
|
||||
if (draw) {
|
||||
vaati = (VaatiBallEntity*)CreateProjectileWithParent(super, V1_EYE_LASER, 0);
|
||||
vaati = (VaatiBallEntity*)EnemyCreateProjectile(super, V1_EYE_LASER, 0);
|
||||
if (vaati) {
|
||||
vaati->base.y.HALF.HI += 4;
|
||||
vaati->base.parent = super;
|
||||
|
|
|
@ -62,7 +62,7 @@ const u16 gUnk_080CDE98[] = { 0xc0, 0x100, 0x140, 0x180 };
|
|||
|
||||
void VaatiEyesMacro(VaatiEyesMacroEntity* this) {
|
||||
VaatiEyesMacro_Functions[GetNextFunction(super)](this);
|
||||
SetChildOffset(super, 0, 1, -0x10);
|
||||
EnemySetFXOffset(super, 0, 1, -0x10);
|
||||
}
|
||||
|
||||
void VaatiEyesMacro_OnTick(VaatiEyesMacroEntity* this) {
|
||||
|
@ -98,7 +98,7 @@ void VaatiEyesMacro_OnCollision(VaatiEyesMacroEntity* this) {
|
|||
}
|
||||
}
|
||||
if (super->confusedTime != 0) {
|
||||
Create0x68FX(super, FX_STARS);
|
||||
EnemyCreateFX(super, FX_STARS);
|
||||
}
|
||||
EnemyFunctionHandlerAfterCollision(super, (EntityActionArray)VaatiEyesMacro_Functions);
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ void VaatiProjectile_OnTick(VaatiProjectileEntity* this) {
|
|||
void VaatiProjectile_OnCollision(VaatiProjectileEntity* this) {
|
||||
Entity* entity;
|
||||
|
||||
if (super->contactFlags == 0x80) {
|
||||
if (super->contactFlags == CONTACT_NOW) {
|
||||
#ifndef EU
|
||||
if (super->health != 0) {
|
||||
#endif
|
||||
|
@ -119,7 +119,7 @@ void VaatiProjectileFunction0Action0(VaatiProjectileEntity* this) {
|
|||
} else {
|
||||
super->action = 9;
|
||||
super->z.HALF.HI = -0x80;
|
||||
super->flags2 = 1;
|
||||
super->collisionMask = 1;
|
||||
}
|
||||
InitializeAnimation(super, 0);
|
||||
}
|
||||
|
|
|
@ -369,7 +369,7 @@ void VaatiRebornEnemyType0Action4(VaatiRebornEnemyEntity* this) {
|
|||
super->subtimer = 0;
|
||||
}
|
||||
if ((super->subtimer < 0x10) &&
|
||||
(entity = CreateProjectileWithParent(super, V1_FIRE_PROJECTILE, this->unk_84), entity != NULL)) {
|
||||
(entity = EnemyCreateProjectile(super, V1_FIRE_PROJECTILE, this->unk_84), entity != NULL)) {
|
||||
entity->subtimer = super->subtimer;
|
||||
entity->parent = super;
|
||||
entity->z.HALF.HI = super->z.HALF.HI;
|
||||
|
@ -456,7 +456,7 @@ void VaatiRebornEnemyType0Action6(VaatiRebornEnemyEntity* this) {
|
|||
if (--super->timer == 0) {
|
||||
this->unk_74++;
|
||||
SoundReq(SFX_150);
|
||||
target = CreateProjectileWithParent(super, V1_DARK_MAGIC_PROJECTILE, 0);
|
||||
target = EnemyCreateProjectile(super, V1_DARK_MAGIC_PROJECTILE, 0);
|
||||
if (target != NULL) {
|
||||
PositionRelative(super, target, 0, Q_16_16(-16.0));
|
||||
target->parent = super;
|
||||
|
@ -539,7 +539,7 @@ void VaatiRebornEnemyType1Action1(VaatiRebornEnemyEntity* this) {
|
|||
super->hitType = 0x2f;
|
||||
InitAnimationForceUpdate(super, this->unk_74);
|
||||
} else {
|
||||
if (((super->contactFlags & 0x80) != 0) && (0 < super->iframes)) {
|
||||
if (((super->contactFlags & CONTACT_NOW) != 0) && (0 < super->iframes)) {
|
||||
parent->iframes = super->iframes;
|
||||
parent->contactFlags = super->contactFlags;
|
||||
}
|
||||
|
@ -665,7 +665,7 @@ void VaatiRebornEnemyType1PreAction(VaatiRebornEnemyEntity* this) {
|
|||
}
|
||||
parent = super->parent;
|
||||
this->unk_77 = 0;
|
||||
if ((super->contactFlags & 0x80) != 0) {
|
||||
if ((super->contactFlags & CONTACT_NOW) != 0) {
|
||||
if (gUnk_080D04D0[((VaatiRebornEnemyEntity*)parent)->unk_86] > super->health) {
|
||||
if (2 < ++((VaatiRebornEnemyEntity*)parent)->unk_86) {
|
||||
COLLISION_OFF(super);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue