Decompile coord.s

This commit is contained in:
Tal Hayon 2022-01-23 17:21:08 +02:00
parent 1726303213
commit a1ae3b229b
39 changed files with 849 additions and 1287 deletions

View File

@ -1,845 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_0806FB00
sub_0806FB00: @ 0x0806FB00
push {r4, lr}
mov ip, r0
adds r4, r1, #0
cmp r3, #0
bne _0806FB0C
movs r3, #1
_0806FB0C:
mov r1, ip
adds r1, #0x7e
movs r0, #0
strb r0, [r1]
mov r0, ip
adds r0, #0x7f
strb r3, [r0]
mov r0, ip
ldrh r1, [r0, #0x2e]
adds r0, #0x80
strh r1, [r0]
mov r1, ip
ldrh r0, [r1, #0x32]
adds r1, #0x82
strh r0, [r1]
mov r0, ip
adds r0, #0x84
strh r4, [r0]
adds r0, #2
strh r2, [r0]
pop {r4, pc}
.align 2, 0
thumb_func_start sub_0806FB38
sub_0806FB38: @ 0x0806FB38
push {r4, r5, r6, r7, lr}
adds r5, r0, #0
adds r6, r5, #0
adds r6, #0x7e
adds r7, r5, #0
adds r7, #0x7f
ldrb r0, [r6]
ldrb r1, [r7]
cmp r0, r1
bhs _0806FBA0
adds r0, #1
strb r0, [r6]
adds r0, r5, #0
adds r0, #0x84
movs r2, #0
ldrsh r1, [r0, r2]
adds r4, r5, #0
adds r4, #0x80
movs r2, #0
ldrsh r0, [r4, r2]
subs r1, r1, r0
ldrb r0, [r6]
muls r0, r1, r0
lsls r0, r0, #8
ldrb r1, [r7]
bl __divsi3
asrs r0, r0, #8
ldrh r4, [r4]
adds r0, r0, r4
strh r0, [r5, #0x2e]
adds r0, r5, #0
adds r0, #0x86
movs r2, #0
ldrsh r1, [r0, r2]
adds r4, r5, #0
adds r4, #0x82
movs r2, #0
ldrsh r0, [r4, r2]
subs r1, r1, r0
ldrb r0, [r6]
muls r0, r1, r0
lsls r0, r0, #8
ldrb r1, [r7]
bl __divsi3
asrs r0, r0, #8
ldrh r4, [r4]
adds r0, r0, r4
strh r0, [r5, #0x32]
movs r0, #0
b _0806FBB2
_0806FBA0:
adds r0, r5, #0
adds r0, #0x84
ldrh r0, [r0]
strh r0, [r5, #0x2e]
adds r0, r5, #0
adds r0, #0x86
ldrh r0, [r0]
strh r0, [r5, #0x32]
movs r0, #1
_0806FBB2:
pop {r4, r5, r6, r7, pc}
thumb_func_start sub_0806FBB4
sub_0806FBB4: @ 0x0806FBB4
push {lr}
adds r1, r0, #0
ldr r0, _0806FBD0 @ =gRoomTransition
ldrb r0, [r0, #5]
cmp r0, #0
bne _0806FBC8
ldr r0, _0806FBD4 @ =gPlayerState
ldrb r0, [r0, #5]
cmp r0, #0
bne _0806FBCC
_0806FBC8:
movs r0, #6
strb r0, [r1, #0xd]
_0806FBCC:
pop {pc}
.align 2, 0
_0806FBD0: .4byte gRoomTransition
_0806FBD4: .4byte gPlayerState
thumb_func_start AllocMutableHitbox
AllocMutableHitbox: @ 0x0806FBD8
push {r4, lr}
adds r4, r0, #0
bl UnloadHitbox
movs r0, #0xc
bl zMalloc
str r0, [r4, #0x48]
pop {r4, pc}
.align 2, 0
thumb_func_start UnloadHitbox
UnloadHitbox: @ 0x0806FBEC
push {r4, lr}
adds r4, r0, #0
ldr r0, [r4, #0x48]
bl zFree
movs r0, #0
str r0, [r4, #0x48]
pop {r4, pc}
thumb_func_start CheckPlayerProximity
CheckPlayerProximity: @ 0x0806FBFC
push {r4, r5, r6, lr}
adds r5, r3, #0
ldr r4, _0806FC20 @ =gPlayerEntity
movs r6, #0x2e
ldrsh r3, [r4, r6]
subs r3, r3, r0
movs r6, #0x32
ldrsh r0, [r4, r6]
subs r0, r0, r1
movs r1, #0
cmp r3, r2
bhs _0806FC1A
cmp r0, r5
bhs _0806FC1A
movs r1, #1
_0806FC1A:
adds r0, r1, #0
pop {r4, r5, r6, pc}
.align 2, 0
_0806FC20: .4byte gPlayerEntity
thumb_func_start sub_0806FC24
sub_0806FC24: @ 0x0806FC24
push {r4, lr}
adds r4, r1, #0
ldr r1, _0806FC44 @ =gUnk_080046A4
bl sub_08007DD6
cmp r0, #0
beq _0806FC4C
lsls r0, r0, #3
ldr r1, _0806FC48 @ =gUnk_080047F6
adds r0, r0, r1
ldrh r0, [r0]
asrs r0, r4
movs r1, #1
ands r0, r1
b _0806FC4E
.align 2, 0
_0806FC44: .4byte gUnk_080046A4
_0806FC48: .4byte gUnk_080047F6
_0806FC4C:
movs r0, #0
_0806FC4E:
pop {r4, pc}
thumb_func_start sub_0806FC50
sub_0806FC50: @ 0x0806FC50
push {r4, lr}
adds r4, r1, #0
ldr r1, _0806FC74 @ =gUnk_080046A4
bl sub_08007DD6
cmp r0, #0
beq _0806FC70
ldr r1, _0806FC78 @ =gUnk_080047F6
lsls r0, r0, #3
adds r2, r0, r1
ldrh r0, [r2]
asrs r0, r4
movs r1, #1
ands r0, r1
cmp r0, #0
bne _0806FC7C
_0806FC70:
movs r0, #0
b _0806FC7E
.align 2, 0
_0806FC74: .4byte gUnk_080046A4
_0806FC78: .4byte gUnk_080047F6
_0806FC7C:
adds r0, r2, #0
_0806FC7E:
pop {r4, pc}
thumb_func_start sub_0806FC80
sub_0806FC80: @ 0x0806FC80
push {r4, r5, lr}
lsls r4, r2, #4
movs r2, #0x2e
ldrsh r3, [r1, r2]
movs r5, #0x32
ldrsh r2, [r1, r5]
adds r1, r3, #0
bl sub_080041DC
cmp r4, r0
bhs _0806FC9A
movs r0, #0
b _0806FC9C
_0806FC9A:
movs r0, #1
_0806FC9C:
pop {r4, r5, pc}
.align 2, 0
thumb_func_start sub_0806FCA0
sub_0806FCA0: @ 0x0806FCA0
push {lr}
bl GetFacingDirection
bl sub_0806F5A4
pop {pc}
thumb_func_start sub_0806FCAC
sub_0806FCAC: @ 0x0806FCAC
push {lr}
bl GetFacingDirection
bl sub_0806F5B0
pop {pc}
thumb_func_start sub_0806FCB8
sub_0806FCB8: @ 0x0806FCB8
push {r4, r5, lr}
adds r4, r0, #0
movs r5, #0x2e
ldrsh r0, [r4, r5]
subs r0, r0, r1
movs r5, #0x32
ldrsh r1, [r4, r5]
subs r1, r1, r2
adds r2, r3, #0
bl sub_0806FCD0
pop {r4, r5, pc}
thumb_func_start sub_0806FCD0
sub_0806FCD0: @ 0x0806FCD0
push {r4, lr}
movs r3, #0
adds r4, r2, #0
muls r4, r2, r4
adds r2, r4, #0
adds r4, r0, #0
muls r4, r0, r4
adds r0, r4, #0
adds r4, r1, #0
muls r4, r1, r4
adds r1, r4, #0
adds r0, r0, r1
cmp r2, r0
blt _0806FCEE
movs r3, #1
_0806FCEE:
adds r0, r3, #0
pop {r4, pc}
.align 2, 0
thumb_func_start sub_0806FCF4
sub_0806FCF4: @ 0x0806FCF4
push {r4, r5, r6, lr}
adds r6, r0, #0
adds r4, r2, #0
adds r5, r3, #0
movs r2, #0
cmp r1, #0
bge _0806FD04
rsbs r1, r1, #0
_0806FD04:
cmp r4, #0
beq _0806FD1A
movs r0, #0x80
lsls r0, r0, #9
bl __divsi3
adds r1, r0, #0
adds r0, r4, #0
muls r0, r1, r0
lsrs r1, r0, #8
subs r2, r4, r1
_0806FD1A:
cmp r5, #0
beq _0806FD22
cmp r5, #3
bne _0806FD24
_0806FD22:
rsbs r2, r2, #0
_0806FD24:
cmp r5, #0
beq _0806FD2C
cmp r5, #2
bne _0806FD32
_0806FD2C:
adds r0, r6, #0
adds r0, #0x63
b _0806FD36
_0806FD32:
adds r0, r6, #0
adds r0, #0x62
_0806FD36:
strb r2, [r0]
pop {r4, r5, r6, pc}
.align 2, 0
thumb_func_start sub_0806FD3C
sub_0806FD3C: @ 0x0806FD3C
ldrb r2, [r0, #0x18]
movs r1, #0x31
rsbs r1, r1, #0
ands r1, r2
strb r1, [r0, #0x18]
adds r0, #0x29
ldrb r2, [r0]
movs r1, #0x39
rsbs r1, r1, #0
ands r1, r2
strb r1, [r0]
bx lr
thumb_func_start sub_0806FD54
sub_0806FD54: @ 0x0806FD54
push {r4, lr}
adds r3, r0, #0
ldr r0, _0806FD6C @ =gPlayerState
ldr r0, [r0, #0x30]
movs r1, #0x80
lsls r1, r1, #0x10
ands r0, r1
cmp r0, #0
bne _0806FD70
movs r0, #0
b _0806FD84
.align 2, 0
_0806FD6C: .4byte gPlayerState
_0806FD70:
ldr r0, _0806FD88 @ =gPlayerEntity
movs r2, #0x2e
ldrsh r1, [r0, r2]
movs r4, #0x32
ldrsh r2, [r0, r4]
subs r2, #9
adds r0, r3, #0
movs r3, #0x48
bl sub_0806FCB8
_0806FD84:
pop {r4, pc}
.align 2, 0
_0806FD88: .4byte gPlayerEntity
thumb_func_start sub_0806FD8C
sub_0806FD8C: @ 0x0806FD8C
push {lr}
ldr r0, _0806FD9C @ =gUnk_020000C0
movs r1, #0xc0
lsls r1, r1, #4
bl MemClear
pop {pc}
.align 2, 0
_0806FD9C: .4byte gUnk_020000C0
thumb_func_start sub_0806FDA0
sub_0806FDA0: @ 0x0806FDA0
push {r4, lr}
movs r3, #1
ldr r1, _0806FDD8 @ =gUnk_020000C0
movs r4, #0xff
movs r2, #0x61
adds r2, r2, r1
mov ip, r2
adds r2, r1, #0
adds r2, #0x40
adds r1, r0, #0
adds r1, #0x28
_0806FDB6:
ldrb r0, [r2]
lsls r0, r0, #0x1f
cmp r0, #0
bne _0806FDDC
strb r3, [r1]
ldrb r0, [r2]
movs r1, #1
orrs r0, r1
strb r0, [r2]
strb r4, [r2, #1]
strb r4, [r2, #0x11]
mov r0, ip
strb r4, [r0]
strb r4, [r0, #0x10]
movs r0, #1
b _0806FDEA
.align 2, 0
_0806FDD8: .4byte gUnk_020000C0
_0806FDDC:
movs r0, #0x40
add ip, r0
adds r2, #0x40
adds r3, #1
cmp r3, #0x2f
bls _0806FDB6
movs r0, #0
_0806FDEA:
pop {r4, pc}
thumb_func_start LoadExtraSpriteData
LoadExtraSpriteData: @ 0x0806FDEC
push {r4, r5, r6, r7, lr}
mov r7, r8
push {r7}
adds r6, r0, #0
adds r4, r1, #0
bl sub_0806FDA0
cmp r0, #0
bne _0806FE02
movs r0, #0
b _0806FE74
_0806FE02:
adds r0, r6, #0
bl UnloadOBJPalette
adds r0, r6, #0
adds r0, #0x28
ldrb r0, [r0]
lsls r0, r0, #6
ldr r1, _0806FE7C @ =gUnk_020000C0
adds r5, r0, r1
movs r7, #0
ldrh r1, [r4, #2]
ldr r0, _0806FE80 @ =0x000003FF
ands r0, r1
movs r1, #0x27
adds r1, r1, r6
mov r8, r1
cmp r0, #0
beq _0806FE6C
_0806FE26:
ldr r1, [r4]
lsls r1, r1, #0x16
lsrs r1, r1, #0x16
adds r0, r6, #0
bl LoadObjPalette
adds r2, r0, #0
ldr r3, [r4]
lsls r1, r3, #6
lsrs r1, r1, #0x16
lsls r3, r3, #0x10
lsrs r3, r3, #0x1a
adds r0, r5, #0
bl sub_0806FEE8
ldrb r1, [r4, #3]
movs r0, #4
ands r0, r1
cmp r0, #0
beq _0806FE56
adds r0, r5, #0
adds r1, r6, #0
bl sub_0806FEFC
_0806FE56:
adds r5, #0x10
adds r4, #4
adds r7, #1
cmp r7, #3
bhi _0806FE6C
ldrh r1, [r4, #2]
ldr r2, _0806FE80 @ =0x000003FF
adds r0, r2, #0
ands r0, r1
cmp r0, #0
bne _0806FE26
_0806FE6C:
movs r0, #0
mov r1, r8
strb r0, [r1]
movs r0, #1
_0806FE74:
pop {r3}
mov r8, r3
pop {r4, r5, r6, r7, pc}
.align 2, 0
_0806FE7C: .4byte gUnk_020000C0
_0806FE80: .4byte 0x000003FF
thumb_func_start sub_0806FE84
sub_0806FE84: @ 0x0806FE84
push {r4, r5, r6, lr}
adds r0, #0x28
ldrb r2, [r0]
movs r1, #0
strb r1, [r0]
subs r0, r2, #1
cmp r0, #0x7e
bhi _0806FEB4
lsls r1, r2, #6
ldr r0, _0806FEB8 @ =gUnk_020000C0
adds r6, r1, r0
movs r5, #0
adds r4, r6, #0
_0806FE9E:
ldrb r0, [r4, #5]
bl sub_0801D244
adds r4, #0x10
adds r5, #1
cmp r5, #3
bls _0806FE9E
adds r0, r6, #0
movs r1, #0x40
bl MemClear
_0806FEB4:
pop {r4, r5, r6, pc}
.align 2, 0
_0806FEB8: .4byte gUnk_020000C0
thumb_func_start sub_0806FEBC
sub_0806FEBC: @ 0x0806FEBC
adds r0, #0x28
ldrb r3, [r0]
lsls r3, r3, #6
lsls r1, r1, #4
ldr r0, _0806FEE4 @ =gUnk_020000C0
adds r1, r1, r0
adds r3, r3, r1
movs r0, #0
str r0, [r3]
str r0, [r3, #4]
str r0, [r3, #8]
str r2, [r3, #0xc]
ldrb r0, [r3]
movs r1, #1
orrs r0, r1
movs r1, #2
orrs r0, r1
strb r0, [r3]
bx lr
.align 2, 0
_0806FEE4: .4byte gUnk_020000C0
thumb_func_start sub_0806FEE8
sub_0806FEE8: @ 0x0806FEE8
strb r3, [r0, #8]
strh r1, [r0, #2]
strb r2, [r0, #5]
ldrb r1, [r0]
movs r2, #8
orrs r1, r2
movs r2, #1
orrs r1, r2
strb r1, [r0]
bx lr
thumb_func_start sub_0806FEFC
sub_0806FEFC: @ 0x0806FEFC
adds r1, #0x60
ldrh r1, [r1]
ldrb r2, [r0, #8]
adds r1, r1, r2
strh r1, [r0, #0xa]
ldrb r1, [r0]
movs r2, #4
orrs r1, r2
strb r1, [r0]
bx lr
thumb_func_start sub_0806FF10
sub_0806FF10: @ 0x0806FF10
push {r4, r5, r6, lr}
adds r6, r0, #0
adds r5, r2, #0
adds r0, #0x28
ldrb r2, [r0]
lsls r2, r2, #6
lsls r1, r1, #4
ldr r0, _0806FF44 @ =gUnk_020000C0
adds r1, r1, r0
adds r4, r2, r1
adds r0, r5, #0
bl FindPalette
ldrb r1, [r4, #5]
cmp r1, r0
beq _0806FF40
adds r0, r1, #0
bl sub_0801D244
adds r0, r6, #0
adds r1, r5, #0
bl LoadObjPalette
strb r0, [r4, #5]
_0806FF40:
pop {r4, r5, r6, pc}
.align 2, 0
_0806FF44: .4byte gUnk_020000C0
thumb_func_start sub_0806FF48
sub_0806FF48: @ 0x0806FF48
adds r0, #0x28
ldrb r0, [r0]
lsls r0, r0, #6
lsls r1, r1, #4
ldr r3, _0806FF5C @ =gUnk_020000C0
adds r1, r1, r3
adds r0, r0, r1
strb r2, [r0, #4]
bx lr
.align 2, 0
_0806FF5C: .4byte gUnk_020000C0
thumb_func_start SetExtraSpriteFrame
SetExtraSpriteFrame: @ 0x0806FF60
push {lr}
adds r3, r2, #0
adds r0, #0x28
ldrb r0, [r0]
lsls r0, r0, #6
ldr r2, _0806FF84 @ =gUnk_020000C0
adds r0, r0, r2
lsls r1, r1, #4
adds r2, r0, r1
ldrb r0, [r2, #1]
cmp r0, r3
beq _0806FF82
strb r3, [r2, #1]
ldrb r0, [r2]
movs r1, #8
orrs r0, r1
strb r0, [r2]
_0806FF82:
pop {pc}
.align 2, 0
_0806FF84: .4byte gUnk_020000C0
thumb_func_start SetSpriteSubEntryOffsetData1
SetSpriteSubEntryOffsetData1: @ 0x0806FF88
push {r4, r5, lr}
adds r5, r1, #0
adds r0, #0x28
ldrb r4, [r0]
lsls r4, r4, #6
ldr r0, _0806FFB8 @ =gUnk_020000C0
adds r4, r4, r0
lsls r5, r5, #4
adds r5, r4, r5
lsls r2, r2, #4
adds r4, r4, r2
ldrh r0, [r5, #2]
ldrb r1, [r5, #1]
bl GetSpriteSubEntryOffsetDataPointer
ldrb r1, [r5, #6]
ldrb r2, [r0]
adds r1, r1, r2
strb r1, [r4, #6]
ldrb r1, [r5, #7]
ldrb r0, [r0, #1]
adds r1, r1, r0
strb r1, [r4, #7]
pop {r4, r5, pc}
.align 2, 0
_0806FFB8: .4byte gUnk_020000C0
thumb_func_start sub_0806FFBC
sub_0806FFBC: @ 0x0806FFBC
push {r4, lr}
adds r0, #0x28
ldrb r0, [r0]
lsls r0, r0, #6
lsls r1, r1, #4
ldr r4, _0806FFD4 @ =gUnk_020000C0
adds r1, r1, r4
adds r0, r0, r1
strb r2, [r0, #6]
strb r3, [r0, #7]
pop {r4, pc}
.align 2, 0
_0806FFD4: .4byte gUnk_020000C0
thumb_func_start SetSpriteSubEntryOffsetData2
SetSpriteSubEntryOffsetData2: @ 0x0806FFD8
push {r4, r5, lr}
adds r5, r1, #0
adds r0, #0x28
ldrb r4, [r0]
lsls r4, r4, #6
ldr r0, _08070008 @ =gUnk_020000C0
adds r4, r4, r0
lsls r5, r5, #4
adds r5, r4, r5
lsls r2, r2, #4
adds r4, r4, r2
ldrh r0, [r5, #2]
ldrb r1, [r5, #1]
bl GetSpriteSubEntryOffsetDataPointer
ldrb r1, [r5, #6]
ldrb r2, [r0, #2]
adds r1, r1, r2
strb r1, [r4, #6]
ldrb r1, [r5, #7]
ldrb r0, [r0, #3]
adds r1, r1, r0
strb r1, [r4, #7]
pop {r4, r5, pc}
.align 2, 0
_08070008: .4byte gUnk_020000C0
thumb_func_start sub_0807000C
sub_0807000C: @ 0x0807000C
push {r4, r5, r6, r7, lr}
adds r6, r0, #0
adds r7, r6, #0
adds r7, #0x28
ldrb r4, [r7]
lsls r4, r4, #6
ldr r0, _08070074 @ =gUnk_020000C0
adds r4, r4, r0
adds r0, r4, #0
movs r1, #0
bl sub_0807007C
adds r5, r0, #0
adds r0, r4, #0
movs r1, #1
bl sub_0807007C
orrs r5, r0
adds r0, r4, #0
movs r1, #2
bl sub_0807007C
orrs r5, r0
adds r0, r4, #0
movs r1, #3
bl sub_0807007C
orrs r5, r0
cmp r5, #0
beq _08070072
ldr r3, _08070078 @ =gGFXSlots
adds r2, r6, #0
adds r2, #0x26
ldrb r1, [r2]
lsls r0, r1, #1
adds r0, r0, r1
lsls r0, r0, #2
adds r0, r0, r3
ldrb r1, [r7]
strb r1, [r0, #7]
ldrb r1, [r2]
lsls r0, r1, #1
adds r0, r0, r1
lsls r0, r0, #2
adds r0, r0, r3
ldrb r2, [r0, #4]
movs r1, #0xf
ands r1, r2
movs r2, #0x30
orrs r1, r2
strb r1, [r0, #4]
_08070072:
pop {r4, r5, r6, r7, pc}
.align 2, 0
_08070074: .4byte gUnk_020000C0
_08070078: .4byte gGFXSlots
thumb_func_start sub_0807007C
sub_0807007C: @ 0x0807007C
push {lr}
lsls r1, r1, #4
adds r2, r0, r1
ldrb r1, [r2]
movs r0, #8
ands r0, r1
cmp r0, #0
beq _080700C4
movs r0, #4
ands r0, r1
cmp r0, #0
beq _080700C4
ldrb r0, [r2, #1]
cmp r0, #0xff
beq _080700C4
ldrh r0, [r2, #2]
lsls r0, r0, #4
ldr r1, _080700C0 @ =gSpritePtrs
adds r3, r0, r1
ldr r1, [r3, #4]
cmp r1, #0
beq _080700C4
ldrb r0, [r2, #1]
lsls r0, r0, #2
adds r0, r1, r0
ldrb r1, [r0]
strb r1, [r2, #9]
ldrh r1, [r0, #2]
lsls r1, r1, #5
ldr r0, [r3, #8]
adds r0, r0, r1
str r0, [r2, #0xc]
movs r0, #1
b _080700C6
.align 2, 0
_080700C0: .4byte gSpritePtrs
_080700C4:
movs r0, #0
_080700C6:
pop {pc}
thumb_func_start GetSpriteSubEntryOffsetDataPointer
GetSpriteSubEntryOffsetDataPointer: @ 0x080700C8
lsls r0, r0, #1
ldr r2, _080700E4 @ =gUnk_089FB780
adds r0, r0, r2
ldrh r0, [r0]
subs r2, #0x10
adds r0, r0, r2
adds r1, r0, r1
ldrb r0, [r1]
lsls r0, r0, #2
adds r0, r0, r2
ldr r1, [r2]
adds r0, r1, r0
bx lr
.align 2, 0
_080700E4: .4byte gExtraFrameOffsets+0x10

View File

@ -791,7 +791,7 @@ sub_0803EAD0: @ 0x0803EAD0
movs r4, #0x32
ldrsh r2, [r2, r4]
subs r2, #4
bl sub_0806FCB8
bl isEntityWithinDistance
pop {r4, pc}
.align 2, 0
_0803EAE8: .4byte gUnk_020000B0

View File

@ -39,7 +39,7 @@ _0803EBE4:
ldrh r2, [r0]
adds r0, r4, #0
movs r3, #2
bl sub_0806FCB8
bl isEntityWithinDistance
cmp r0, #0
bne _0803EC14
movs r0, #4
@ -141,7 +141,7 @@ sub_0803EC94: @ 0x0803EC94
ldrh r2, [r6]
adds r0, r4, #0
movs r3, #1
bl sub_0806FCB8
bl isEntityWithinDistance
cmp r0, #0
beq _0803ECD8
ldrh r0, [r5]
@ -465,7 +465,7 @@ sub_0803EF04: @ 0x0803EF04
movs r4, #0x32
ldrsh r2, [r2, r4]
subs r2, #4
bl sub_0806FCB8
bl isEntityWithinDistance
pop {r4, pc}
.align 2, 0
_0803EF1C: .4byte gUnk_020000B0
@ -531,7 +531,7 @@ sub_0803EF74: @ 0x0803EF74
ldrsh r2, [r4, r0]
adds r0, r5, #0
movs r3, #0x50
bl sub_0806FCB8
bl isEntityWithinDistance
cmp r0, #0
beq _0803EFA8
adds r0, r4, #0

View File

@ -449,7 +449,7 @@ _08049398:
asrs r3, r3, #0x10
adds r3, #0x10
adds r0, r4, #0
bl sub_0806FCB8
bl isEntityWithinDistance
cmp r0, #0
beq _080493E0
movs r0, #2
@ -661,7 +661,7 @@ sub_08049538: @ 0x08049538
adds r2, #0x80
adds r0, r4, #0
movs r3, #0x70
bl sub_0806FCB8
bl isEntityWithinDistance
adds r1, r0, #0
cmp r1, #0
bne _0804956E
@ -754,7 +754,7 @@ sub_080495F8: @ 0x080495F8
adds r2, #0x80
adds r0, r4, #0
movs r3, #0x28
bl sub_0806FCB8
bl isEntityWithinDistance
cmp r0, #0
beq _0804963C
movs r0, #2
@ -1195,7 +1195,7 @@ sub_08049944: @ 0x08049944
movs r3, #0x32
ldrsh r2, [r5, r3]
movs r3, #0x20
bl sub_0806FCB8
bl isEntityWithinDistance
cmp r0, #0
beq _0804998C
ldr r2, _08049994 @ =gPlayerState
@ -1292,7 +1292,7 @@ sub_080499F0: @ 0x080499F0
ldrsh r2, [r4, r3]
adds r0, r5, #0
movs r3, #0x24
bl sub_0806FCB8
bl isEntityWithinDistance
cmp r0, #0
beq _08049A7E
ldrb r1, [r6]

View File

@ -671,7 +671,7 @@ _0803976A:
ldrsh r2, [r0, r3]
adds r0, r4, #0
movs r3, #0x24
bl sub_0806FCB8
bl isEntityWithinDistance
cmp r0, #0
beq _08039818
movs r0, #5
@ -713,7 +713,7 @@ _080397DC:
ldrsh r2, [r0, r3]
adds r0, r4, #0
movs r3, #0x48
bl sub_0806FCB8
bl isEntityWithinDistance
cmp r0, #0
beq _08039818
movs r0, #8
@ -844,7 +844,7 @@ sub_080398C0: @ 0x080398C0
ldrsh r2, [r0, r3]
adds r0, r4, #0
movs r3, #0x58
bl sub_0806FCB8
bl isEntityWithinDistance
cmp r0, #0
beq _08039908
ldr r1, _08039904 @ =gPlayerEntity

View File

@ -789,7 +789,7 @@ sub_0802FA88: @ 0x0802FA88
adds r6, #0x7a
ldrh r2, [r6]
movs r3, #2
bl sub_0806FCB8
bl isEntityWithinDistance
cmp r0, #0
beq _0802FAF6
adds r1, r4, #0

View File

@ -0,0 +1,17 @@
.syntax unified
lsls r0, r0, #1
ldr r2, _080700E4 @ =gUnk_089FB780
adds r0, r0, r2
ldrh r0, [r0]
subs r2, #0x10
adds r0, r0, r2
adds r1, r0, r1
ldrb r0, [r1]
lsls r0, r0, #2
adds r0, r0, r2
ldr r1, [r2]
adds r0, r1, r0
bx lr
.align 2, 0
_080700E4: .4byte gExtraFrameOffsets+0x10
.syntax divided

View File

@ -0,0 +1,23 @@
.syntax unified
push {r4, lr}
adds r4, r1, #0
ldr r1, _0806FC44 @ =gUnk_080046A4
bl sub_08007DD6
cmp r0, #0
beq _0806FC4C
lsls r0, r0, #3
ldr r1, _0806FC48 @ =gUnk_080047F6
adds r0, r0, r1
ldrh r0, [r0]
asrs r0, r4
movs r1, #1
ands r0, r1
b _0806FC4E
.align 2, 0
_0806FC44: .4byte gUnk_080046A4
_0806FC48: .4byte gUnk_080047F6
_0806FC4C:
movs r0, #0
_0806FC4E:
pop {r4, pc}
.syntax divided

View File

@ -34,7 +34,7 @@
adds r2, r2, r0
adds r0, r6, #0
movs r3, #8
bl sub_0806FCB8
bl isEntityWithinDistance
cmp r0, #0
beq _080AA3D0
movs r0, #1

View File

@ -555,7 +555,7 @@ _0808663A:
adds r0, r7, #0
adds r1, r4, #0
movs r3, #2
bl sub_0806FCB8
bl isEntityWithinDistance
cmp r0, #0
beq _080866B8
movs r0, #1

View File

@ -297,7 +297,7 @@ _0808BD34:
subs r2, #6
adds r0, r5, #0
movs r3, #0x1c
bl sub_0806FCB8
bl isEntityWithinDistance
cmp r0, #0
beq _0808BDAE
adds r0, r5, #0

View File

@ -41324,31 +41324,6 @@
"start": 1134388,
"size": 4
},
{
"path": "data_081146D0/gUnk_08114F38.bin",
"start": 1134392,
"size": 32
},
{
"path": "data_081146D0/gUnk_08114F58.bin",
"start": 1134424,
"size": 32
},
{
"path": "data_081146D0/gUnk_08114F78.bin",
"start": 1134456,
"size": 8
},
{
"path": "data_081146D0/gUnk_08114F80.bin",
"start": 1134464,
"size": 8
},
{
"path": "data_081146D0/gPlayerHitbox.bin",
"start": 1134472,
"size": 16
},
{
"path": "sprites/gSpriteFrames_1.bin",
"start": 1134488,

View File

@ -36,18 +36,3 @@ gUnk_08114F30:: @ 08114F30
gUnk_08114F34:: @ 08114F34
.incbin "data_081146D0/gUnk_08114F34.bin"
gUnk_08114F38:: @ 08114F38
.incbin "data_081146D0/gUnk_08114F38.bin"
gUnk_08114F58:: @ 08114F58
.incbin "data_081146D0/gUnk_08114F58.bin"
gUnk_08114F78:: @ 08114F78
.incbin "data_081146D0/gUnk_08114F78.bin"
gUnk_08114F80:: @ 08114F80
.incbin "data_081146D0/gUnk_08114F80.bin"
gPlayerHitbox:: @ 08114F88
.incbin "data_081146D0/gPlayerHitbox.bin"

View File

@ -12,10 +12,11 @@ extern Palette gPaletteList[];
void ResetPaletteTable(u32 a1);
void sub_0801D000(u32 a1);
void LoadObjPalette(struct Entity_*, u32);
u32 LoadObjPalette(struct Entity_*, u32);
void UnloadOBJPalette(struct Entity_* entity);
void sub_0801D244(u32);
void sub_0801D28C(struct Entity_* entity, u32 palette);
void ChangeObjPalette(struct Entity_* entity, u32 palette);
s32 FindPalette(u32 a1);
#endif // COLOR_H

View File

@ -75,7 +75,7 @@ extern u32 sub_0806F520();
extern void sub_0806F4E8(Entity*);
extern void sub_080784C8();
extern u32 sub_0808288C(Entity*, u32, u32, u32);
extern void sub_0806FDA0(Entity*);
extern bool32 sub_0806FDA0(Entity*);
extern bool32 LoadSwapGFX(Entity*, u16, u32);
extern void sub_0807921C();
extern void sub_0807ACCC(Entity*);
@ -95,7 +95,7 @@ extern u32 sub_080040D8(Entity*, u8*, s32, s32);
extern u32 sub_0805F8F8(u32);
extern u32 sub_0805F7A0(u32);
extern u32* sub_0805F25C(u32);
u32 sub_0806FCB8(Entity*, u32, u32, u32);
u32 isEntityWithinDistance(Entity*, s32, s32, s32);
extern void sub_0806F62C(Entity*, u32, u32);
extern void sub_080A1ED0(u32, u32, u32);
extern u32 sub_0806F5B0(u32);

View File

@ -604,7 +604,6 @@ SECTIONS {
/* END npcs */
src/npcUtils.o(.text);
src/coord.o(.text); /* physics? */
asm/coord.o(.text);
src/playerItem/playerItem12.o(.text);
src/playerItem/playerItemPacciCane.o(.text);
src/player.o(.text);
@ -936,7 +935,7 @@ SECTIONS {
data/data_080B7910.o(.rodata);
data/const/playerItem/playerItemCellOverwriteSet.o(.rodata);
data/data_080B7B74.o(.rodata);
src/coord.o(.rodata);
src/sineTable.o(.rodata);
data/data_080C93E0.o(.rodata);
src/enemy/octorok.o(.rodata);
data/animations/enemy/octorok.o(.rodata);
@ -1328,6 +1327,8 @@ SECTIONS {
data/const/npc/npc58.o(.rodata);
src/npcDefinitions.o(.rodata);
data/data_081146D0.o(.rodata);
src/coord.o(.rodata);
src/playerHitbox.o(.rodata);
data/gfx/sprite_frames.o(.rodata);
data/const/playerItem/playerItem12.o(.rodata);
data/const/playerItem/playerItemPacciCane.o(.rodata);

View File

@ -27,7 +27,7 @@ void sub_0801CFD0(u32 a1) {
ASM_FUNC("asm/non_matching/color/sub_0801D000.inc", void sub_0801D000(u32 a1));
ASM_FUNC("asm/non_matching/color/LoadObjPalette.inc", void LoadObjPalette(Entity* entity, u32 a2));
ASM_FUNC("asm/non_matching/color/LoadObjPalette.inc", u32 LoadObjPalette(Entity* entity, u32 a2));
ASM_FUNC("asm/non_matching/color/FindPalette.inc", s32 FindPalette(u32 a1));

View File

@ -7,8 +7,33 @@
#include "room.h"
#include "functions.h"
extern u8 gUnk_08114F78[];
extern u8 gUnk_08114F80[];
const u8 gEntityOnTopArray[];
const u8 gEntityBelowArray[];
const u8 gUnk_08114F58[];
const u8 gUnk_08114F38[];
typedef struct {
struct {
u8 unk0 : 1;
u8 unk1 : 1;
u8 unk2 : 1;
u8 unk3 : 1;
u8 unk4 : 4;
} PACKED unk_00;
u8 unk_01;
u16 unk_02;
union SplitWord unk_04;
union SplitWord unk_08;
union SplitWord unk_0C;
} struct_gUnk_020000C0_1;
typedef struct {
struct_gUnk_020000C0_1 unk_00[4];
} struct_gUnk_020000C0;
static_assert(sizeof(struct_gUnk_020000C0) == 0x40);
extern struct_gUnk_020000C0 gUnk_020000C0[0x30];
extern u32 gSpritePtrs[];
typedef struct {
u32 _0;
@ -17,13 +42,21 @@ typedef struct {
} struct_02025EB0;
extern struct_02025EB0 gUnk_02025EB0;
extern u16 gExtraFrameOffsets[];
extern s8 gUnk_08126EE4[];
extern u8 gUnk_08114F38[];
extern u8 gUnk_08114F58[];
extern const u16 gUnk_080046A4[];
extern const u16 gUnk_080047F6[];
void sub_080027EA(Entity*, u32, u32);
u32 sub_0806F58C(Entity*, Entity*);
u32 sub_0806FCA0(Entity*, Entity*);
void UnloadHitbox(Entity*);
extern u32 sub_08007DD6(u32, const u16*);
extern u32 sub_080041DC(Entity*, u32, u32);
u32 PointInsideRadius(s32 x, s32 y, s32 radius);
extern void sub_0806FEE8(struct_gUnk_020000C0_1*, u32, u32, u32);
void sub_0806FEFC(struct_gUnk_020000C0_1*, Entity*);
bool32 sub_0807007C(struct_gUnk_020000C0*, u32);
void sub_0806F364(void) {
gArea.filler[2] ^= 0x80;
@ -327,336 +360,367 @@ void sub_0806FA90(Entity* param_1, Entity* param_2, s32 offsetX, s32 offsetY) {
}
void ResolveEntityOnTop(Entity* param_1, Entity* param_2) {
param_2->spritePriority.b0 = gUnk_08114F78[param_1->spritePriority.b0];
param_2->spritePriority.b0 = gEntityOnTopArray[param_1->spritePriority.b0];
}
void ResolveEntityBelow(Entity* param_1, Entity* param_2) {
param_2->spritePriority.b0 = gUnk_08114F80[param_1->spritePriority.b0];
param_2->spritePriority.b0 = gEntityBelowArray[param_1->spritePriority.b0];
}
// Values of sin(x*(π/128)) as Q8.8 fixed-point numbers from x = 0 to x = 319
const s16 gSineTable[64] = {
Q_8_8(0), // sin(0*(π/128))
Q_8_8(0.0234375), // sin(1*(π/128))
Q_8_8(0.046875), // sin(2*(π/128))
Q_8_8(0.0703125), // sin(3*(π/128))
Q_8_8(0.09765625), // sin(4*(π/128))
Q_8_8(0.12109375), // sin(5*(π/128))
Q_8_8(0.14453125), // sin(6*(π/128))
Q_8_8(0.16796875), // sin(7*(π/128))
Q_8_8(0.19140625), // sin(8*(π/128))
Q_8_8(0.21875), // sin(9*(π/128))
Q_8_8(0.2421875), // sin(10*(π/128))
Q_8_8(0.265625), // sin(11*(π/128))
Q_8_8(0.2890625), // sin(12*(π/128))
Q_8_8(0.3125), // sin(13*(π/128))
Q_8_8(0.3359375), // sin(14*(π/128))
Q_8_8(0.359375), // sin(15*(π/128))
Q_8_8(0.37890625), // sin(16*(π/128))
Q_8_8(0.40234375), // sin(17*(π/128))
Q_8_8(0.42578125), // sin(18*(π/128))
Q_8_8(0.44921875), // sin(19*(π/128))
Q_8_8(0.46875), // sin(20*(π/128))
Q_8_8(0.4921875), // sin(21*(π/128))
Q_8_8(0.51171875), // sin(22*(π/128))
Q_8_8(0.53125), // sin(23*(π/128))
Q_8_8(0.5546875), // sin(24*(π/128))
Q_8_8(0.57421875), // sin(25*(π/128))
Q_8_8(0.59375), // sin(26*(π/128))
Q_8_8(0.61328125), // sin(27*(π/128))
Q_8_8(0.6328125), // sin(28*(π/128))
Q_8_8(0.65234375), // sin(29*(π/128))
Q_8_8(0.66796875), // sin(30*(π/128))
Q_8_8(0.6875), // sin(31*(π/128))
Q_8_8(0.70703125), // sin(32*(π/128))
Q_8_8(0.72265625), // sin(33*(π/128))
Q_8_8(0.73828125), // sin(34*(π/128))
Q_8_8(0.75390625), // sin(35*(π/128))
Q_8_8(0.76953125), // sin(36*(π/128))
Q_8_8(0.78515625), // sin(37*(π/128))
Q_8_8(0.80078125), // sin(38*(π/128))
Q_8_8(0.81640625), // sin(39*(π/128))
Q_8_8(0.828125), // sin(40*(π/128))
Q_8_8(0.84375), // sin(41*(π/128))
Q_8_8(0.85546875), // sin(42*(π/128))
Q_8_8(0.8671875), // sin(43*(π/128))
Q_8_8(0.87890625), // sin(44*(π/128))
Q_8_8(0.890625), // sin(45*(π/128))
Q_8_8(0.90234375), // sin(46*(π/128))
Q_8_8(0.9140625), // sin(47*(π/128))
Q_8_8(0.921875), // sin(48*(π/128))
Q_8_8(0.9296875), // sin(49*(π/128))
Q_8_8(0.94140625), // sin(50*(π/128))
Q_8_8(0.94921875), // sin(51*(π/128))
Q_8_8(0.953125), // sin(52*(π/128))
Q_8_8(0.9609375), // sin(53*(π/128))
Q_8_8(0.96875), // sin(54*(π/128))
Q_8_8(0.97265625), // sin(55*(π/128))
Q_8_8(0.98046875), // sin(56*(π/128))
Q_8_8(0.984375), // sin(57*(π/128))
Q_8_8(0.98828125), // sin(58*(π/128))
Q_8_8(0.9921875), // sin(59*(π/128))
Q_8_8(0.9921875), // sin(60*(π/128))
Q_8_8(0.99609375), // sin(61*(π/128))
Q_8_8(0.99609375), // sin(62*(π/128))
Q_8_8(0.99609375), // sin(63*(π/128))
void sub_0806FB00(Entity* ent, u32 param_1, u32 param_2, u32 param_3) {
if (param_3 == 0) {
param_3 = 1;
}
ent->field_0x7c.BYTES.byte2 = 0;
ent->field_0x7c.BYTES.byte3 = param_3;
ent->field_0x80.HWORD = ent->x.HALF.HI;
ent->field_0x82.HWORD = ent->y.HALF.HI;
ent->cutsceneBeh.HWORD = param_1;
ent->field_0x86.HWORD = param_2;
}
bool32 sub_0806FB38(Entity* ent, u32 param_1, u32 param_2, u32 param_3) {
s32 val;
u32 rv;
if (ent->field_0x7c.BYTES.byte2 < ent->field_0x7c.BYTES.byte3) {
ent->field_0x7c.BYTES.byte2++;
ent->x.HALF.HI =
((((((s16)ent->cutsceneBeh.HWORD - (s16)ent->field_0x80.HWORD) * ent->field_0x7c.BYTES.byte2) << 8) /
ent->field_0x7c.BYTES.byte3) >>
8) +
ent->field_0x80.HWORD;
ent->y.HALF.HI =
(((((((s16)ent->field_0x86.HWORD - (s16)ent->field_0x82.HWORD) * ent->field_0x7c.BYTES.byte2) << 8) /
ent->field_0x7c.BYTES.byte3) >>
8)) +
ent->field_0x82.HWORD;
rv = 0;
} else {
ent->x.HALF.HI = ent->cutsceneBeh.HWORD;
ent->y.HALF.HI = ent->field_0x86.HWORD;
rv = 1;
}
return rv;
}
void sub_0806FBB4(Entity* ent) {
if (gRoomTransition.field_0x4[1] != 0 || gPlayerState.heldObject == 0) {
ent->subAction = 6;
}
}
void AllocMutableHitbox(Entity* ent) {
UnloadHitbox(ent);
ent->hitbox = zMalloc(sizeof(Hitbox3D));
}
void UnloadHitbox(Entity* ent) {
zFree(ent->hitbox);
ent->hitbox = NULL;
}
bool32 CheckPlayerProximity(u32 x, u32 y, u32 distX, u32 DistY) {
s32 diffx = gPlayerEntity.x.HALF.HI - x;
s32 diffy = gPlayerEntity.y.HALF.HI - y;
u32 rv = 0;
if (diffx < distX && diffy < DistY) {
rv = 1;
}
return rv;
}
NONMATCH("asm/non_matching/coord/sub_0806FC24.inc", bool32 sub_0806FC24(u32 param_1, u32 param_2)) {
u32 rv;
u32 val = sub_08007DD6(param_1, gUnk_080046A4);
if (val) {
rv = (*(gUnk_080047F6 + (val << 2)) >> param_2) & 0x1;
} else {
rv = 0;
}
return rv;
}
END_NONMATCH
const u16* sub_0806FC50(u32 param_1, u32 param_2) {
const u16* rv;
u32 val = sub_08007DD6(param_1, gUnk_080046A4);
if (!val || ((gUnk_080047F6[val << 2] >> param_2) & 0x1) == 0) {
rv = 0;
} else {
rv = gUnk_080047F6 + (val << 2);
}
return rv;
}
bool32 sub_0806FC80(Entity* ent, Entity* ent2, s32 param_3) {
u32 rv;
s16 x, y;
param_3 <<= 4;
if (param_3 >= sub_080041DC(ent, ent2->x.HALF.HI, ent2->y.HALF.HI)) {
return 1;
} else {
return 0;
}
}
u32 sub_0806FCA0(Entity* this, Entity* other) {
return sub_0806F5A4(GetFacingDirection(this, other));
}
u32 sub_0806FCAC(Entity* this, Entity* other) {
return sub_0806F5B0(GetFacingDirection(this, other));
}
u32 isEntityWithinDistance(Entity* ent, s32 x, s32 y, s32 distance) {
return PointInsideRadius(ent->x.HALF.HI - x, ent->y.HALF.HI - y, distance);
}
bool32 PointInsideRadius(s32 x, s32 y, s32 distance) {
return distance * distance >= (x * x + y * y);
}
void sub_0806FCF4(Entity* ent, s32 param_2, s32 param_3, s32 param_4) {
u32 r2 = 0;
if (param_2 < 0) {
param_2 = -param_2;
}
if (param_3) {
param_2 = (0x10000 / param_2);
param_2 = ((u32)(param_3 * param_2) >> 8);
r2 = param_3 - param_2;
}
if (param_4 == 0 || param_4 == 3) {
r2 = -r2;
}
if (param_4 == 0 || param_4 == 2) {
ent->spriteOffsetY = r2;
} else {
ent->spriteOffsetX = r2;
}
}
void sub_0806FD3C(Entity* this) {
this->spriteSettings.shadow = 0;
this->spritePriority.b1 = 0;
}
bool32 sub_0806FD54(Entity* this) {
u32 rv;
if ((gPlayerState.flags & 0x800000) == 0) {
rv = 0;
} else {
rv = isEntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 9, 0x48);
}
return rv;
}
void sub_0806FD8C() {
MemClear(&gUnk_020000C0, sizeof(gUnk_020000C0));
}
bool32 sub_0806FDA0(Entity* this) {
u32 index;
for (index = 1; index < ARRAY_COUNT(gUnk_020000C0); index++) {
if ((gUnk_020000C0[index].unk_00[0].unk_00.unk0) == 0) {
u32 tmp = 0xFF;
this->spriteAnimation[2] = index;
gUnk_020000C0[index].unk_00[0].unk_00.unk0 = 1;
gUnk_020000C0[index].unk_00[0].unk_01 = tmp;
gUnk_020000C0[index].unk_00[1].unk_01 = tmp;
gUnk_020000C0[index].unk_00[2].unk_01 = tmp;
gUnk_020000C0[index].unk_00[3].unk_01 = tmp;
return 1;
}
}
return 0;
}
u32 LoadExtraSpriteData(Entity* ent, SpriteLoadData* data) {
SpriteLoadData* ptr;
u32 index;
struct_gUnk_020000C0_1* ptr2;
if (sub_0806FDA0(ent) == 0)
return 0;
UnloadOBJPalette(ent);
ptr2 = gUnk_020000C0[ent->spriteAnimation[2]].unk_00;
ptr = data;
for (index = 0; index < 4 && (((u16*)ptr)[1] & 0x3ff); index++) {
u32 pal = LoadObjPalette(ent, ((*(u32*)ptr) << 0x16) >> 0x16);
sub_0806FEE8(ptr2, (*(u32*)ptr << 6) >> 0x16, pal, (*(u32*)ptr << 0x10) >> 0x1a);
if (((u8*)ptr)[3] & 4) {
sub_0806FEFC(ptr2, ent);
}
ptr2++;
ptr++;
}
ent->spriteAnimation[1] = 0;
return 1;
}
void sub_0806FE84(Entity* ent) {
u32 index;
u32 spriteAnimation = ent->spriteAnimation[2];
ent->spriteAnimation[2] = 0;
if (spriteAnimation > 0 && spriteAnimation < 0x80) {
struct_gUnk_020000C0_1* startptr = gUnk_020000C0[spriteAnimation].unk_00;
for (index = 0; index <= 3; index++) {
sub_0801D244(startptr[index].unk_04.BYTES.byte1);
}
MemClear(startptr, sizeof(struct_gUnk_020000C0));
}
}
void sub_0806FEBC(Entity* ent, u32 param_2, u32 param_3) {
struct_gUnk_020000C0_1* ptr = &gUnk_020000C0[ent->spriteAnimation[2]].unk_00[param_2];
*((u32*)ptr) = 0;
ptr->unk_04.WORD = 0;
ptr->unk_08.WORD = 0;
ptr->unk_0C.WORD = param_3;
ptr->unk_00.unk0 = 1;
ptr->unk_00.unk1 = 1;
}
void sub_0806FEE8(struct_gUnk_020000C0_1* this, u32 param_2, u32 param_3, u32 param_4) {
this->unk_08.BYTES.byte0 = param_4;
this->unk_02 = param_2;
this->unk_04.BYTES.byte1 = param_3;
this->unk_00.unk3 = 1;
this->unk_00.unk0 = 1;
}
void sub_0806FEFC(struct_gUnk_020000C0_1* this, Entity* ent) {
this->unk_08.HALF.HI = ent->spriteVramOffset + this->unk_08.BYTES.byte0;
this->unk_00.unk2 = 1;
}
void sub_0806FF10(Entity* this, u32 param_2, u32 param_3) {
struct_gUnk_020000C0_1* ptr = &gUnk_020000C0[this->spriteAnimation[2]].unk_00[param_2];
s32 pallete = FindPalette(param_3);
if (ptr->unk_04.BYTES.byte1 != pallete) {
sub_0801D244(ptr->unk_04.BYTES.byte1);
ptr->unk_04.BYTES.byte1 = LoadObjPalette(this, param_3);
}
}
void sub_0806FF48(Entity* this, u32 param_2, u32 param_3) {
struct_gUnk_020000C0_1* ptr = &gUnk_020000C0[this->spriteAnimation[2]].unk_00[param_2];
ptr->unk_04.BYTES.byte0 = param_3;
}
void SetExtraSpriteFrame(Entity* this, u32 param_2, u32 param_3) {
struct_gUnk_020000C0* ptr1 = &gUnk_020000C0[this->spriteAnimation[2]];
struct_gUnk_020000C0_1* ptr2 = &ptr1->unk_00[param_2];
if (ptr2->unk_01 != param_3) {
ptr2->unk_01 = param_3;
ptr2->unk_00.unk3 = 1;
}
}
void SetSpriteSubEntryOffsetData1(Entity* this, u32 param_2, u32 param_3) {
struct_gUnk_020000C0* ptr1 = &gUnk_020000C0[this->spriteAnimation[2]];
struct_gUnk_020000C0_1* ptr2 = &ptr1->unk_00[param_2];
struct_gUnk_020000C0_1* ptr3 = &ptr1->unk_00[param_3];
u8* ptr4 = GetSpriteSubEntryOffsetDataPointer(ptr2->unk_02, ptr2->unk_01);
u8 val1 = ptr2->unk_04.BYTES.byte2;
u8 val2 = ptr4[0];
ptr3->unk_04.BYTES.byte2 = val1 + val2;
val1 = ptr2->unk_04.BYTES.byte3;
val2 = ptr4[1];
ptr3->unk_04.BYTES.byte3 = val1 + val2;
}
void sub_0806FFBC(Entity* this, u32 param_2, u32 param_3, u32 param_4) {
struct_gUnk_020000C0_1* ptr = &gUnk_020000C0[this->spriteAnimation[2]].unk_00[param_2];
ptr->unk_04.BYTES.byte2 = param_3;
ptr->unk_04.BYTES.byte3 = param_4;
}
void SetSpriteSubEntryOffsetData2(Entity* this, u32 param_2, u32 param_3) {
struct_gUnk_020000C0* ptr1 = &gUnk_020000C0[this->spriteAnimation[2]];
struct_gUnk_020000C0_1* ptr2 = &ptr1->unk_00[param_2];
struct_gUnk_020000C0_1* ptr3 = &ptr1->unk_00[param_3];
u8* ptr4 = GetSpriteSubEntryOffsetDataPointer(ptr2->unk_02, ptr2->unk_01);
u8 val1 = ptr2->unk_04.BYTES.byte2;
u8 val2 = ptr4[2];
ptr3->unk_04.BYTES.byte2 = val1 + val2;
val1 = ptr2->unk_04.BYTES.byte3;
val2 = ptr4[3];
ptr3->unk_04.BYTES.byte3 = val1 + val2;
}
void sub_0807000C(Entity* this) {
struct_gUnk_020000C0* ptr = &gUnk_020000C0[this->spriteAnimation[2]];
u32 val = sub_0807007C(ptr, 0);
val |= sub_0807007C(ptr, 1);
val |= sub_0807007C(ptr, 2);
val |= sub_0807007C(ptr, 3);
if (val) {
u8* ptr2 = (u8*)&gGFXSlots;
ptr2[this->spriteAnimation[0] * 12 + 7] = this->spriteAnimation[2];
ptr2[this->spriteAnimation[0] * 12 + 4] = (ptr2[this->spriteAnimation[0] * 12 + 4] & 0xf) | 0x30;
}
}
bool32 sub_0807007C(struct_gUnk_020000C0* this, u32 param_2) {
u8* ptr2;
u8* ptr3;
u32* spritePtr;
struct_gUnk_020000C0_1* ptr1 = &this->unk_00[param_2];
if ((ptr1->unk_00.unk3) == 0)
return 0;
if ((ptr1->unk_00.unk2) == 0)
return 0;
if (ptr1->unk_01 == 0xff)
return 0;
spritePtr = &gSpritePtrs[ptr1->unk_02 * 4];
ptr2 = (u8*)(spritePtr[1]);
if (ptr2 == 0)
return 0;
ptr3 = &ptr2[ptr1->unk_01 * 4];
ptr1->unk_08.BYTES.byte1 = *ptr3;
ptr1->unk_0C.WORD = spritePtr[2] + ((*(u16*)&ptr3[2]) << 5);
return 1;
}
NONMATCH("asm/non_matching/coord/GetSpriteSubEntryOffsetDataPointer.inc",
u8* GetSpriteSubEntryOffsetDataPointer(u32 param_1, u32 param_2)) {
u8* rv;
u32 val;
u32 val2;
val = ((u16*)(((u8*)gExtraFrameOffsets) + 0x10))[param_1];
val2 = ((u8*)gExtraFrameOffsets)[val + param_2] * 4;
rv = val2 + ((u8*)gExtraFrameOffsets);
rv = rv + *((u32*)((u8*)gExtraFrameOffsets));
return rv;
}
END_NONMATCH
const u8 gUnk_08114F38[] = {
0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0,
};
const s16 gCosineTable[256] = {
Q_8_8(1), // sin(64*(π/128))
Q_8_8(0.99609375), // sin(65*(π/128))
Q_8_8(0.99609375), // sin(66*(π/128))
Q_8_8(0.99609375), // sin(67*(π/128))
Q_8_8(0.9921875), // sin(68*(π/128))
Q_8_8(0.9921875), // sin(69*(π/128))
Q_8_8(0.98828125), // sin(70*(π/128))
Q_8_8(0.984375), // sin(71*(π/128))
Q_8_8(0.98046875), // sin(72*(π/128))
Q_8_8(0.97265625), // sin(73*(π/128))
Q_8_8(0.96875), // sin(74*(π/128))
Q_8_8(0.9609375), // sin(75*(π/128))
Q_8_8(0.953125), // sin(76*(π/128))
Q_8_8(0.94921875), // sin(77*(π/128))
Q_8_8(0.94140625), // sin(78*(π/128))
Q_8_8(0.9296875), // sin(79*(π/128))
Q_8_8(0.921875), // sin(80*(π/128))
Q_8_8(0.9140625), // sin(81*(π/128))
Q_8_8(0.90234375), // sin(82*(π/128))
Q_8_8(0.890625), // sin(83*(π/128))
Q_8_8(0.87890625), // sin(84*(π/128))
Q_8_8(0.8671875), // sin(85*(π/128))
Q_8_8(0.85546875), // sin(86*(π/128))
Q_8_8(0.84375), // sin(87*(π/128))
Q_8_8(0.828125), // sin(88*(π/128))
Q_8_8(0.81640625), // sin(89*(π/128))
Q_8_8(0.80078125), // sin(90*(π/128))
Q_8_8(0.78515625), // sin(91*(π/128))
Q_8_8(0.76953125), // sin(92*(π/128))
Q_8_8(0.75390625), // sin(93*(π/128))
Q_8_8(0.73828125), // sin(94*(π/128))
Q_8_8(0.72265625), // sin(95*(π/128))
Q_8_8(0.70703125), // sin(96*(π/128))
Q_8_8(0.6875), // sin(97*(π/128))
Q_8_8(0.66796875), // sin(98*(π/128))
Q_8_8(0.65234375), // sin(99*(π/128))
Q_8_8(0.6328125), // sin(100*(π/128))
Q_8_8(0.61328125), // sin(101*(π/128))
Q_8_8(0.59375), // sin(102*(π/128))
Q_8_8(0.57421875), // sin(103*(π/128))
Q_8_8(0.5546875), // sin(104*(π/128))
Q_8_8(0.53125), // sin(105*(π/128))
Q_8_8(0.51171875), // sin(106*(π/128))
Q_8_8(0.4921875), // sin(107*(π/128))
Q_8_8(0.46875), // sin(108*(π/128))
Q_8_8(0.44921875), // sin(109*(π/128))
Q_8_8(0.42578125), // sin(110*(π/128))
Q_8_8(0.40234375), // sin(111*(π/128))
Q_8_8(0.37890625), // sin(112*(π/128))
Q_8_8(0.359375), // sin(113*(π/128))
Q_8_8(0.3359375), // sin(114*(π/128))
Q_8_8(0.3125), // sin(115*(π/128))
Q_8_8(0.2890625), // sin(116*(π/128))
Q_8_8(0.265625), // sin(117*(π/128))
Q_8_8(0.2421875), // sin(118*(π/128))
Q_8_8(0.21875), // sin(119*(π/128))
Q_8_8(0.19140625), // sin(120*(π/128))
Q_8_8(0.16796875), // sin(121*(π/128))
Q_8_8(0.14453125), // sin(122*(π/128))
Q_8_8(0.12109375), // sin(123*(π/128))
Q_8_8(0.09765625), // sin(124*(π/128))
Q_8_8(0.0703125), // sin(125*(π/128))
Q_8_8(0.046875), // sin(126*(π/128))
Q_8_8(0.0234375), // sin(127*(π/128))
Q_8_8(0), // sin(128*(π/128))
Q_8_8(-0.0234375), // sin(129*(π/128))
Q_8_8(-0.046875), // sin(130*(π/128))
Q_8_8(-0.0703125), // sin(131*(π/128))
Q_8_8(-0.09765625), // sin(132*(π/128))
Q_8_8(-0.12109375), // sin(133*(π/128))
Q_8_8(-0.14453125), // sin(134*(π/128))
Q_8_8(-0.16796875), // sin(135*(π/128))
Q_8_8(-0.19140625), // sin(136*(π/128))
Q_8_8(-0.21875), // sin(137*(π/128))
Q_8_8(-0.2421875), // sin(138*(π/128))
Q_8_8(-0.265625), // sin(139*(π/128))
Q_8_8(-0.2890625), // sin(140*(π/128))
Q_8_8(-0.3125), // sin(141*(π/128))
Q_8_8(-0.3359375), // sin(142*(π/128))
Q_8_8(-0.359375), // sin(143*(π/128))
Q_8_8(-0.37890625), // sin(144*(π/128))
Q_8_8(-0.40234375), // sin(145*(π/128))
Q_8_8(-0.42578125), // sin(146*(π/128))
Q_8_8(-0.44921875), // sin(147*(π/128))
Q_8_8(-0.46875), // sin(148*(π/128))
Q_8_8(-0.4921875), // sin(149*(π/128))
Q_8_8(-0.51171875), // sin(150*(π/128))
Q_8_8(-0.53125), // sin(151*(π/128))
Q_8_8(-0.5546875), // sin(152*(π/128))
Q_8_8(-0.57421875), // sin(153*(π/128))
Q_8_8(-0.59375), // sin(154*(π/128))
Q_8_8(-0.61328125), // sin(155*(π/128))
Q_8_8(-0.6328125), // sin(156*(π/128))
Q_8_8(-0.65234375), // sin(157*(π/128))
Q_8_8(-0.66796875), // sin(158*(π/128))
Q_8_8(-0.6875), // sin(159*(π/128))
Q_8_8(-0.70703125), // sin(160*(π/128))
Q_8_8(-0.72265625), // sin(161*(π/128))
Q_8_8(-0.73828125), // sin(162*(π/128))
Q_8_8(-0.75390625), // sin(163*(π/128))
Q_8_8(-0.76953125), // sin(164*(π/128))
Q_8_8(-0.78515625), // sin(165*(π/128))
Q_8_8(-0.80078125), // sin(166*(π/128))
Q_8_8(-0.81640625), // sin(167*(π/128))
Q_8_8(-0.828125), // sin(168*(π/128))
Q_8_8(-0.84375), // sin(169*(π/128))
Q_8_8(-0.85546875), // sin(170*(π/128))
Q_8_8(-0.8671875), // sin(171*(π/128))
Q_8_8(-0.87890625), // sin(172*(π/128))
Q_8_8(-0.890625), // sin(173*(π/128))
Q_8_8(-0.90234375), // sin(174*(π/128))
Q_8_8(-0.9140625), // sin(175*(π/128))
Q_8_8(-0.921875), // sin(176*(π/128))
Q_8_8(-0.9296875), // sin(177*(π/128))
Q_8_8(-0.94140625), // sin(178*(π/128))
Q_8_8(-0.94921875), // sin(179*(π/128))
Q_8_8(-0.953125), // sin(180*(π/128))
Q_8_8(-0.9609375), // sin(181*(π/128))
Q_8_8(-0.96875), // sin(182*(π/128))
Q_8_8(-0.97265625), // sin(183*(π/128))
Q_8_8(-0.98046875), // sin(184*(π/128))
Q_8_8(-0.984375), // sin(185*(π/128))
Q_8_8(-0.98828125), // sin(186*(π/128))
Q_8_8(-0.9921875), // sin(187*(π/128))
Q_8_8(-0.9921875), // sin(188*(π/128))
Q_8_8(-0.99609375), // sin(189*(π/128))
Q_8_8(-0.99609375), // sin(190*(π/128))
Q_8_8(-0.99609375), // sin(191*(π/128))
Q_8_8(-1), // sin(192*(π/128))
Q_8_8(-0.99609375), // sin(193*(π/128))
Q_8_8(-0.99609375), // sin(194*(π/128))
Q_8_8(-0.99609375), // sin(195*(π/128))
Q_8_8(-0.9921875), // sin(196*(π/128))
Q_8_8(-0.9921875), // sin(197*(π/128))
Q_8_8(-0.98828125), // sin(198*(π/128))
Q_8_8(-0.984375), // sin(199*(π/128))
Q_8_8(-0.98046875), // sin(200*(π/128))
Q_8_8(-0.97265625), // sin(201*(π/128))
Q_8_8(-0.96875), // sin(202*(π/128))
Q_8_8(-0.9609375), // sin(203*(π/128))
Q_8_8(-0.953125), // sin(204*(π/128))
Q_8_8(-0.94921875), // sin(205*(π/128))
Q_8_8(-0.94140625), // sin(206*(π/128))
Q_8_8(-0.9296875), // sin(207*(π/128))
Q_8_8(-0.921875), // sin(208*(π/128))
Q_8_8(-0.9140625), // sin(209*(π/128))
Q_8_8(-0.90234375), // sin(210*(π/128))
Q_8_8(-0.890625), // sin(211*(π/128))
Q_8_8(-0.87890625), // sin(212*(π/128))
Q_8_8(-0.8671875), // sin(213*(π/128))
Q_8_8(-0.85546875), // sin(214*(π/128))
Q_8_8(-0.84375), // sin(215*(π/128))
Q_8_8(-0.828125), // sin(216*(π/128))
Q_8_8(-0.81640625), // sin(217*(π/128))
Q_8_8(-0.80078125), // sin(218*(π/128))
Q_8_8(-0.78515625), // sin(219*(π/128))
Q_8_8(-0.76953125), // sin(220*(π/128))
Q_8_8(-0.75390625), // sin(221*(π/128))
Q_8_8(-0.73828125), // sin(222*(π/128))
Q_8_8(-0.72265625), // sin(223*(π/128))
Q_8_8(-0.70703125), // sin(224*(π/128))
Q_8_8(-0.6875), // sin(225*(π/128))
Q_8_8(-0.66796875), // sin(226*(π/128))
Q_8_8(-0.65234375), // sin(227*(π/128))
Q_8_8(-0.6328125), // sin(228*(π/128))
Q_8_8(-0.61328125), // sin(229*(π/128))
Q_8_8(-0.59375), // sin(230*(π/128))
Q_8_8(-0.57421875), // sin(231*(π/128))
Q_8_8(-0.5546875), // sin(232*(π/128))
Q_8_8(-0.53125), // sin(233*(π/128))
Q_8_8(-0.51171875), // sin(234*(π/128))
Q_8_8(-0.4921875), // sin(235*(π/128))
Q_8_8(-0.46875), // sin(236*(π/128))
Q_8_8(-0.44921875), // sin(237*(π/128))
Q_8_8(-0.42578125), // sin(238*(π/128))
Q_8_8(-0.40234375), // sin(239*(π/128))
Q_8_8(-0.37890625), // sin(240*(π/128))
Q_8_8(-0.359375), // sin(241*(π/128))
Q_8_8(-0.3359375), // sin(242*(π/128))
Q_8_8(-0.3125), // sin(243*(π/128))
Q_8_8(-0.2890625), // sin(244*(π/128))
Q_8_8(-0.265625), // sin(245*(π/128))
Q_8_8(-0.2421875), // sin(246*(π/128))
Q_8_8(-0.21875), // sin(247*(π/128))
Q_8_8(-0.19140625), // sin(248*(π/128))
Q_8_8(-0.16796875), // sin(249*(π/128))
Q_8_8(-0.14453125), // sin(250*(π/128))
Q_8_8(-0.12109375), // sin(251*(π/128))
Q_8_8(-0.09765625), // sin(252*(π/128))
Q_8_8(-0.0703125), // sin(253*(π/128))
Q_8_8(-0.046875), // sin(254*(π/128))
Q_8_8(-0.0234375), // sin(255*(π/128))
Q_8_8(0), // sin(256*(π/128))
Q_8_8(0.0234375), // sin(257*(π/128))
Q_8_8(0.046875), // sin(258*(π/128))
Q_8_8(0.0703125), // sin(259*(π/128))
Q_8_8(0.09765625), // sin(260*(π/128))
Q_8_8(0.12109375), // sin(261*(π/128))
Q_8_8(0.14453125), // sin(262*(π/128))
Q_8_8(0.16796875), // sin(263*(π/128))
Q_8_8(0.19140625), // sin(264*(π/128))
Q_8_8(0.21875), // sin(265*(π/128))
Q_8_8(0.2421875), // sin(266*(π/128))
Q_8_8(0.265625), // sin(267*(π/128))
Q_8_8(0.2890625), // sin(268*(π/128))
Q_8_8(0.3125), // sin(269*(π/128))
Q_8_8(0.3359375), // sin(270*(π/128))
Q_8_8(0.359375), // sin(271*(π/128))
Q_8_8(0.37890625), // sin(272*(π/128))
Q_8_8(0.40234375), // sin(273*(π/128))
Q_8_8(0.42578125), // sin(274*(π/128))
Q_8_8(0.44921875), // sin(275*(π/128))
Q_8_8(0.46875), // sin(276*(π/128))
Q_8_8(0.4921875), // sin(277*(π/128))
Q_8_8(0.51171875), // sin(278*(π/128))
Q_8_8(0.53125), // sin(279*(π/128))
Q_8_8(0.5546875), // sin(280*(π/128))
Q_8_8(0.57421875), // sin(281*(π/128))
Q_8_8(0.59375), // sin(282*(π/128))
Q_8_8(0.61328125), // sin(283*(π/128))
Q_8_8(0.6328125), // sin(284*(π/128))
Q_8_8(0.65234375), // sin(285*(π/128))
Q_8_8(0.66796875), // sin(286*(π/128))
Q_8_8(0.6875), // sin(287*(π/128))
Q_8_8(0.70703125), // sin(288*(π/128))
Q_8_8(0.72265625), // sin(289*(π/128))
Q_8_8(0.73828125), // sin(290*(π/128))
Q_8_8(0.75390625), // sin(291*(π/128))
Q_8_8(0.76953125), // sin(292*(π/128))
Q_8_8(0.78515625), // sin(293*(π/128))
Q_8_8(0.80078125), // sin(294*(π/128))
Q_8_8(0.81640625), // sin(295*(π/128))
Q_8_8(0.828125), // sin(296*(π/128))
Q_8_8(0.84375), // sin(297*(π/128))
Q_8_8(0.85546875), // sin(298*(π/128))
Q_8_8(0.8671875), // sin(299*(π/128))
Q_8_8(0.87890625), // sin(300*(π/128))
Q_8_8(0.890625), // sin(301*(π/128))
Q_8_8(0.90234375), // sin(302*(π/128))
Q_8_8(0.9140625), // sin(303*(π/128))
Q_8_8(0.921875), // sin(304*(π/128))
Q_8_8(0.9296875), // sin(305*(π/128))
Q_8_8(0.94140625), // sin(306*(π/128))
Q_8_8(0.94921875), // sin(307*(π/128))
Q_8_8(0.953125), // sin(308*(π/128))
Q_8_8(0.9609375), // sin(309*(π/128))
Q_8_8(0.96875), // sin(310*(π/128))
Q_8_8(0.97265625), // sin(311*(π/128))
Q_8_8(0.98046875), // sin(312*(π/128))
Q_8_8(0.984375), // sin(313*(π/128))
Q_8_8(0.98828125), // sin(314*(π/128))
Q_8_8(0.9921875), // sin(315*(π/128))
Q_8_8(0.9921875), // sin(316*(π/128))
Q_8_8(0.99609375), // sin(317*(π/128))
Q_8_8(0.99609375), // sin(318*(π/128))
Q_8_8(0.99609375), // sin(319*(π/128))
const u8 gUnk_08114F58[] = {
0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 0, 0,
};
const u8 gEntityOnTopArray[] = { 0, 0, 1, 2, 3, 4, 5, 6 };
const u8 gEntityBelowArray[] = { 1, 2, 3, 4, 5, 6, 7, 7 };

View File

@ -295,7 +295,7 @@ u32 sub_08031E04(Entity* this) {
return 0;
tmp = &gUnk_080CE5C0[this->frame & 6];
return sub_0806FCB8(this, ent->x.HALF.HI + tmp[0], ent->y.HALF.HI + tmp[1], 0x50);
return isEntityWithinDistance(this, ent->x.HALF.HI + tmp[0], ent->y.HALF.HI + tmp[1], 0x50);
}
void sub_08031E48(Entity* this, Entity* child) {
@ -403,7 +403,7 @@ void sub_08032008(Entity* this) {
ProcessMovement(this);
} else {
if (this->field_0x76.HALF.HI == 0) {
if (sub_0806FCB8(this, parent->x.HALF.HI, parent->y.HALF.HI, 1) == 0) {
if (isEntityWithinDistance(this, parent->x.HALF.HI, parent->y.HALF.HI, 1) == 0) {
this->field_0x76.HALF.HI = 1;
this->direction = GetFacingDirection(this, parent);
sub_080322E8(this);

View File

@ -136,7 +136,7 @@ void sub_08039DD8(FlyingSkullEntity* this) {
} else {
if ((gPlayerState.flags & 0x80) == 0) {
Entity* ent = &gPlayerEntity;
if (sub_0806FCB8(super, ent->x.HALF.HI, ent->y.HALF.HI, 0x30)) {
if (isEntityWithinDistance(super, ent->x.HALF.HI, ent->y.HALF.HI, 0x30)) {
if (super->type == 1) {
super->action = 3;
super->actionDelay = 0x1e;

View File

@ -230,7 +230,7 @@ u32 sub_08037810(Entity* this) {
u32 y;
if (this->field_0x76.HALF.LO == 0) {
if (sub_08049FDC(this, 1) != 0) {
if (sub_0806FCB8(this, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x40) != 0) {
if (isEntityWithinDistance(this, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x40) != 0) {
x = GetFacingDirection(this, gUnk_020000B0);
if (((x - this->direction + 6) & 0x1f) <= 0xc) {
this->action = 3;
@ -257,7 +257,7 @@ u32 sub_080378B0(Entity* this) {
if (this->field_0x76.HALF.HI == 0) {
if (sub_08049DF4(1) != 0) {
if (sub_0804A044(this, gUnk_020000B0, 0xa) == this->direction)
if (sub_0806FCB8(this, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x18) != 0) {
if (isEntityWithinDistance(this, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x18) != 0) {
this->action = 5;
this->speed = 0x100;
InitAnimationForceUpdate(this, this->animationState + 8);
@ -272,13 +272,13 @@ u32 sub_080378B0(Entity* this) {
u32 sub_08037914(Entity* this) {
if (sub_08049FDC(this, 1) != 0) {
if (sub_0806FCB8(gUnk_020000B0, this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x28) == 0) {
if (isEntityWithinDistance(gUnk_020000B0, this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x28) == 0) {
this->field_0x78.HWORD = gUnk_020000B0->x.HALF_U.HI;
this->field_0x7a.HWORD = gUnk_020000B0->y.HALF_U.HI;
sub_0803797C(this);
return 0;
}
if (sub_0806FCB8(this, this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x8) == 0) {
if (isEntityWithinDistance(this, this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x8) == 0) {
return 0;
}
this->field_0x76.HALF.LO = 0x3c;

View File

@ -279,7 +279,7 @@ void sub_08046B18(GyorgMaleEntity* this) {
}
void sub_08046B8C(GyorgMaleEntity* this) {
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 4)) {
if (isEntityWithinDistance(super, this->unk_80, this->unk_82, 4)) {
super->subAction = 3;
this->unk_76 = super->direction << 8;
this->unk_80 = gRoomControls.origin_x + 0x200;
@ -309,7 +309,7 @@ void sub_08046C04(GyorgMaleEntity* this) {
}
void sub_08046C88(GyorgMaleEntity* this) {
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 4)) {
if (isEntityWithinDistance(super, this->unk_80, this->unk_82, 4)) {
super->subAction = 1;
sub_08048178(this, sub_08048158(this->unk_70));
sub_08047D88(this);
@ -367,7 +367,7 @@ void sub_08046D98(GyorgMaleEntity* this) {
}
void sub_08046E0C(GyorgMaleEntity* this) {
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 4)) {
if (isEntityWithinDistance(super, this->unk_80, this->unk_82, 4)) {
super->subAction = 3;
this->unk_76 = super->direction << 8;
sub_08047D88(this);
@ -468,7 +468,7 @@ void sub_0804702C(GyorgMaleEntity* this) {
}
}
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
if (sub_0806FCB8(super, this->unk_80, this->unk_82, (super->speed >> 0x10) + 0x10)) {
if (isEntityWithinDistance(super, this->unk_80, this->unk_82, (super->speed >> 0x10) + 0x10)) {
super->subAction = 2;
this->unk_76 = super->direction << 8;
super->speed = 0x280;
@ -628,7 +628,7 @@ void sub_080473F0(GyorgMaleEntity* this) {
}
}
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 8)) {
if (isEntityWithinDistance(super, this->unk_80, this->unk_82, 8)) {
super->subAction = 2;
this->unk_76 = super->direction << 8;
super->speed = 0x180;
@ -796,7 +796,7 @@ void sub_080477F0(GyorgMaleEntity* this) {
}
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
sub_08047E48(this);
if (!sub_0806FCB8(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
if (!isEntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
super->action = 2;
super->subAction = 0;
super->spriteOrientation.flipY = 2;
@ -804,11 +804,11 @@ void sub_080477F0(GyorgMaleEntity* this) {
super->direction = super->animationState;
return;
}
if (!sub_0806FCB8(super, gRoomControls.origin_x + 0x200, gRoomControls.origin_y + 0x210, 0x100)) {
if (!isEntityWithinDistance(super, gRoomControls.origin_x + 0x200, gRoomControls.origin_y + 0x210, 0x100)) {
super->spriteOrientation.flipY = 3;
super->spriteRendering.b3 = 3;
}
if (sub_0806FCB8(super, this->unk_80, this->unk_82, 4)) {
if (isEntityWithinDistance(super, this->unk_80, this->unk_82, 4)) {
super->subAction = 2;
this->unk_76 = super->animationState << 8;
this->unk_74 = gUnk_080D1BF0[Random() & 1];
@ -861,7 +861,7 @@ void sub_08047978(GyorgMaleEntity* this) {
tmp->parent = super;
}
}
if (!sub_0806FCB8(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
if (!isEntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
super->action = 2;
super->subAction = 0;
super->spriteOrientation.flipY = 2;
@ -902,7 +902,7 @@ void sub_08047B08(GyorgMaleEntity* this) {
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
super->speed = 0x200;
sub_08047E58(this);
if (!sub_0806FCB8(super, this->unk_80, this->unk_82, 4))
if (!isEntityWithinDistance(super, this->unk_80, this->unk_82, 4))
return;
if (super->type == 0) {
super->action = 7;
@ -1019,7 +1019,7 @@ void sub_08047D88(GyorgMaleEntity* this) {
return;
if (super->animIndex == 1)
return;
if (!sub_0806FCB8(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x20))
if (!isEntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x20))
return;
gPlayerState.field_0x14 = 1;
if (gPlayerEntity.z.HALF.HI != 0)
@ -1149,7 +1149,7 @@ void sub_08048004(GyorgMaleEntity* this) {
} else {
u32 b = super->spriteRendering.b3;
if (b != 3) {
if (sub_0806FCB8(&gPlayerEntity, super->x.HALF.HI, super->y.HALF.HI, 0x24)) {
if (isEntityWithinDistance(&gPlayerEntity, super->x.HALF.HI, super->y.HALF.HI, 0x24)) {
if (!(this->unk_7c & 2)) {
u32 tmp = sub_080045DA(gPlayerEntity.x.HALF.HI - super->x.HALF.HI,
gPlayerEntity.y.HALF.HI - super->y.HALF.HI);

View File

@ -98,7 +98,7 @@ void Keese_Sleep(Entity* this) {
if (this->actionDelay != 0) {
this->actionDelay--;
} else {
if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))
if (isEntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))
Keese_StartFly(this);
}
}
@ -116,7 +116,7 @@ void sub_08021F24(Entity* this) {
this->actionDelay = gKeeseRestDurations[Random() & 0xf];
InitializeAnimation(this, KeeseAnimation_Rest);
} else if (!this->field_0x7a.HWORD &&
!(sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))) {
!(isEntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))) {
this->action = 3;
this->actionDelay = 30;
InitializeAnimation(this, KeeseAnimation_Rest);

View File

@ -242,7 +242,7 @@ void Lakitu_Cloudless(Entity* this) {
}
bool32 sub_0803CA4C(Entity* this) {
if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28) == 0) {
if (isEntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28) == 0) {
if (EntityInRectRadius(this, &gPlayerEntity, 0x70, 0x50)) {
return 1;
}
@ -267,7 +267,7 @@ void sub_0803CA84(Entity* this, u32 unkParameter) {
}
void sub_0803CAD0(Entity* this) {
if (sub_0806FCB8(this, this->field_0x74.HWORD, this->field_0x76.HWORD, 1) == 0) {
if (isEntityWithinDistance(this, this->field_0x74.HWORD, this->field_0x76.HWORD, 1) == 0) {
this->direction =
sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, this->field_0x74.HWORD, this->field_0x76.HWORD);
@ -359,7 +359,7 @@ void sub_0803CC08(Entity* this) {
return;
}
if (!sub_0806FCB8(this, cloud->x.HALF.HI, cloud->y.HALF.HI, 6)) {
if (!isEntityWithinDistance(this, cloud->x.HALF.HI, cloud->y.HALF.HI, 6)) {
return;
}

View File

@ -1104,7 +1104,7 @@ u32 sub_0803B4E4(Entity* this) {
xoff = this->parent->x.HALF.HI + gUnk_080CFD0A[this->type];
yoff = this->parent->y.HALF.HI + 0x10;
if (sub_0806FCB8(this, xoff, yoff, 2)) {
if (isEntityWithinDistance(this, xoff, yoff, 2)) {
this->x.HALF.HI = xoff;
this->y.HALF.HI = yoff;
return 1;
@ -1164,7 +1164,8 @@ void sub_0803B5C0(Entity* this) {
}
u32 sub_0803B610(Entity* this) {
return sub_0806FCB8(this, gPlayerEntity.x.HALF.HI + gUnk_080CFD19[this->type], gPlayerEntity.y.HALF.HI - 0xc, 8);
return isEntityWithinDistance(this, gPlayerEntity.x.HALF.HI + gUnk_080CFD19[this->type],
gPlayerEntity.y.HALF.HI - 0xc, 8);
}
// sub_0803B698 was the tail of this function

View File

@ -63,7 +63,7 @@ void sub_0803827C(Entity* this) {
this->field_0xf--;
} else {
if ((sub_0804A044(this, &gPlayerEntity, 0x8) != 0xff) ||
(sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x24) != 0)) {
(isEntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x24) != 0)) {
sub_080383E4(this);
return;
}

View File

@ -58,7 +58,7 @@ void sub_0803CF38(TorchTrapEntity* this) {
if (sub_0803CFF0(this)) {
sub_0803D0B0(this);
} else if (sub_08049FDC(super, 0)) {
if (sub_0806FCB8(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x20) == 0) {
if (isEntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x20) == 0) {
if (--this->projectileTimer == 0) {
TorchTrap_CreateProjectile(this);
TorchTrap_Reset(this);

View File

@ -671,7 +671,7 @@ void sub_08042EF4(Entity* this) {
UpdateAnimationSingleFrame(this);
if (sub_08043C98(this) == 0) {
if (--this->actionDelay == 0) {
if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x50)) {
if (isEntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x50)) {
this->subAction = 6;
this->actionDelay = 0x28;
} else {
@ -686,7 +686,7 @@ void sub_08042EF4(Entity* this) {
}
x = this->parent->x.HALF.HI;
y = this->parent->y.HALF.HI - 0x10;
if (sub_0806FCB8(this, x, y, 0x30)) {
if (isEntityWithinDistance(this, x, y, 0x30)) {
temp = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, x, y);
if ((this->field_0x78.HALF.HI - temp) + 4 < 9) {
this->field_0x78.HALF.HI = temp ^ 0x10;

View File

@ -170,7 +170,7 @@ void sub_08044868(Entity* this) {
break;
case 1:
LinearMoveUpdate(this);
if (sub_0806FCB8(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc)) {
if (isEntityWithinDistance(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc)) {
this->field_0x74.HALF.LO++;
this->x.HALF.HI = vaati->x.HALF.HI;
this->y.HALF.HI = vaati->y.HALF.HI - 0x10;
@ -383,7 +383,7 @@ void sub_08044B04(Entity* this) {
}
}
if (this->field_0x78.HALF.HI == 3)
if (sub_0806FCB8(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc))
if (isEntityWithinDistance(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc))
vaati->actionDelay++;
this->direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10);
return;

View File

@ -866,7 +866,7 @@ void sub_080406A0(Entity* this) {
uVar6 = gRoomControls.origin_x + gUnk_080D0B58[tmp = uVar5 * 2];
uVar4 = gRoomControls.origin_y + gUnk_080D0B58[tmp + 1];
}
if (sub_0806FCB8(this, uVar6, uVar4, 0x1c)) {
if (isEntityWithinDistance(this, uVar6, uVar4, 0x1c)) {
if (uVar5 != 0) {
uVar5 = 0;
} else {
@ -901,7 +901,7 @@ void sub_08040770(Entity* this) {
tmp5 = gRoomControls.origin_x + gUnk_080D0B64[index = tmp2 * 2];
tmp6 = gRoomControls.origin_y + gUnk_080D0B64[index + 1];
}
if (sub_0806FCB8(this, tmp5, tmp6, 0x1c)) {
if (isEntityWithinDistance(this, tmp5, tmp6, 0x1c)) {
if (this->animationState != 2) {
if (tmp & 8) {
tmp2 += 1;

View File

@ -828,11 +828,11 @@ u32 sub_0804207C(Entity* this) {
x = this->x.HALF.HI;
y = this->y.HALF.HI - 0x10;
arm = ((VaatiWrathHeapStruct*)this->myHeap)->arms[0];
if ((arm != NULL) && (arm->action >= 5) && sub_0806FCB8(arm, x, y, 0x30)) {
if ((arm != NULL) && (arm->action >= 5) && isEntityWithinDistance(arm, x, y, 0x30)) {
return sub_080045D4(arm->x.HALF.HI, arm->y.HALF.HI, x, y);
} else {
arm = ((VaatiWrathHeapStruct*)this->myHeap)->arms[1];
if (((arm != NULL) && (arm->action >= 5)) && sub_0806FCB8(arm, x, y, 0x30)) {
if (((arm != NULL) && (arm->action >= 5)) && isEntityWithinDistance(arm, x, y, 0x30)) {
return sub_080045D4(arm->x.HALF.HI, arm->y.HALF.HI, x, y);
} else {
if (gPlayerEntity.y.HALF.HI < 0x40) {

View File

@ -125,7 +125,7 @@ void sub_0802CE68(Entity* this) {
gPlayerState.field_0xa |= 0x80;
gPlayerState.mobility |= 0x80;
gPlayerState.flags |= PL_DISABLE_ITEMS;
if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 4)) {
if (!isEntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 4)) {
this->direction = GetFacingDirection(this, &gPlayerEntity);
LinearMoveUpdate(this);
}

View File

@ -361,7 +361,7 @@ void sub_0805938C(ManagerF* this) {
u32 sub_080593CC(ManagerF* this) {
if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.swim_state != 0 && gPlayerEntity.animationState == 0 &&
(gPlayerState.field_0x90 & 0xF00) == 0x400) {
return sub_0806FCB8(&gPlayerEntity, this->unk_38, this->unk_3a + 0xC, 6);
return isEntityWithinDistance(&gPlayerEntity, this->unk_38, this->unk_3a + 0xC, 6);
}
return 0;
}

View File

@ -37,7 +37,7 @@ void sub_08061358(Entity*);
void sub_08060E94(Entity*);
u32 sub_0806FCD0(u32, u32, u32);
u32 PointInsideRadius(s32, s32, s32);
extern Entity gUnk_0200D654;
extern Entity gUnk_02027EB4;
@ -182,12 +182,14 @@ void sub_08060BA0(Entity* this) {
this->speed = 0x1e0;
sub_08061120(this, ((UnkHeap*)this->myHeap)->unk_7, ((UnkHeap*)this->myHeap)->unk_8, 0xc);
sub_08061170(this);
if (sub_0806FCB8(this, ((UnkHeap*)this->myHeap)->unk_7, ((UnkHeap*)this->myHeap)->unk_8, 4) != 0) {
if (isEntityWithinDistance(this, ((UnkHeap*)this->myHeap)->unk_7, ((UnkHeap*)this->myHeap)->unk_8, 4) !=
0) {
((UnkHeap*)this->myHeap)->unk_0 &= 0xf7;
}
} else {
if (sub_08060FD0(this, ((UnkHeap*)this->myHeap)->unk_5, ((UnkHeap*)this->myHeap)->unk_6) != 0) {
if (sub_0806FCB8(this, ((UnkHeap*)this->myHeap)->unk_5, ((UnkHeap*)this->myHeap)->unk_6, 4) != 0) {
if (isEntityWithinDistance(this, ((UnkHeap*)this->myHeap)->unk_5, ((UnkHeap*)this->myHeap)->unk_6, 4) !=
0) {
((UnkHeap*)this->myHeap)->unk_0 &= 0xfb;
this->action = 5;
this->direction = r5->direction;
@ -214,7 +216,8 @@ void sub_08060BA0(Entity* this) {
this->speed = 0x1e0;
sub_08061120(this, ((UnkHeap*)this->myHeap)->unk_7, ((UnkHeap*)this->myHeap)->unk_8, 0xc);
sub_08061170(this);
if (sub_0806FCB8(this, ((UnkHeap*)this->myHeap)->unk_7, ((UnkHeap*)this->myHeap)->unk_8, 4) != 0) {
if (isEntityWithinDistance(this, ((UnkHeap*)this->myHeap)->unk_7, ((UnkHeap*)this->myHeap)->unk_8, 4) !=
0) {
((UnkHeap*)this->myHeap)->unk_0 &= 0xf7;
}
} else {
@ -227,7 +230,8 @@ void sub_08060BA0(Entity* this) {
this->speed = 0x1e0;
sub_08061120(this, ((UnkHeap*)this->myHeap)->unk_3, ((UnkHeap*)this->myHeap)->unk_4, 0xc);
sub_08061170(this);
if (sub_0806FCB8(this, ((UnkHeap*)this->myHeap)->unk_3, ((UnkHeap*)this->myHeap)->unk_4, 4) != 0) {
if (isEntityWithinDistance(this, ((UnkHeap*)this->myHeap)->unk_3, ((UnkHeap*)this->myHeap)->unk_4,
4) != 0) {
((UnkHeap*)this->myHeap)->unk_0 &= 0xfd;
}
} else {
@ -343,8 +347,8 @@ u32 sub_08060F80(Entity* this) {
return 0;
}
((UnkHeap*)this->myHeap)->unk_0 &= 0xfb;
if (sub_0806FCD0(gPlayerEntity.x.HALF.HI - this->x.HALF.HI, gPlayerEntity.y.HALF.HI - this->y.HALF.HI,
((UnkHeap*)this->myHeap)->unk_0b) != 0) {
if (PointInsideRadius(gPlayerEntity.x.HALF.HI - this->x.HALF.HI, gPlayerEntity.y.HALF.HI - this->y.HALF.HI,
((UnkHeap*)this->myHeap)->unk_0b) != 0) {
return 1;
}
return 0;

View File

@ -418,7 +418,8 @@ void sub_080A1FF0(GyorgBossObjectEntity* this) {
}
}
if (this->unk_7b) {
if (sub_0806FCB8(&gPlayerEntity, gRoomControls.origin_x + 0x200, gRoomControls.origin_y + 0x210, 0x100)) {
if (isEntityWithinDistance(&gPlayerEntity, gRoomControls.origin_x + 0x200, gRoomControls.origin_y + 0x210,
0x100)) {
if (super->actionDelay == 0) {
super->actionDelay = 0x78;
} else {

View File

@ -192,10 +192,10 @@ void sub_0808B73C(Entity* this) {
this->palette.b.b0 = this->parent->palette.b.b0;
InitializeAnimation(this, 1);
}
if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28)) {
if (isEntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28)) {
this->spriteSettings.draw = 1;
} else {
if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x2e)) {
if (isEntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x2e)) {
this->spriteSettings.draw ^= 1;
} else {
this->spriteSettings.draw = 0;

7
src/playerHitbox.c Normal file
View File

@ -0,0 +1,7 @@
#include "entity.h"
const Hitbox gPlayerHitbox = {
0, -3, { 5, 3, 3, 5 }, 6, 6,
};
const u8 gUnk_08114F90[8] = { 0 };

View File

@ -303,8 +303,8 @@ NONMATCH("asm/non_matching/mandiblesProjectile/sub_080AA374.inc", bool32 sub_080
// TODO regalloc
animationState = this->child->animationState;
uVar1 = sub_0806F824(this, this->child, gUnk_08129D14[animationState], gUnk_08129D14[animationState + 1]);
if (sub_0806FCB8(this, this->child->x.HALF.HI + gUnk_08129D14[animationState],
this->child->y.HALF.HI + gUnk_08129D14[animationState + 1], 8) != 0) {
if (isEntityWithinDistance(this, this->child->x.HALF.HI + gUnk_08129D14[animationState],
this->child->y.HALF.HI + gUnk_08129D14[animationState + 1], 8) != 0) {
result = TRUE;
} else {
sub_08004596(this, uVar1);

328
src/sineTable.c Normal file
View File

@ -0,0 +1,328 @@
#include "global.h"
// Values of sin(x*(π/128)) as Q8.8 fixed-point numbers from x = 0 to x = 319
const s16 gSineTable[64] = {
Q_8_8(0), // sin(0*(π/128))
Q_8_8(0.0234375), // sin(1*(π/128))
Q_8_8(0.046875), // sin(2*(π/128))
Q_8_8(0.0703125), // sin(3*(π/128))
Q_8_8(0.09765625), // sin(4*(π/128))
Q_8_8(0.12109375), // sin(5*(π/128))
Q_8_8(0.14453125), // sin(6*(π/128))
Q_8_8(0.16796875), // sin(7*(π/128))
Q_8_8(0.19140625), // sin(8*(π/128))
Q_8_8(0.21875), // sin(9*(π/128))
Q_8_8(0.2421875), // sin(10*(π/128))
Q_8_8(0.265625), // sin(11*(π/128))
Q_8_8(0.2890625), // sin(12*(π/128))
Q_8_8(0.3125), // sin(13*(π/128))
Q_8_8(0.3359375), // sin(14*(π/128))
Q_8_8(0.359375), // sin(15*(π/128))
Q_8_8(0.37890625), // sin(16*(π/128))
Q_8_8(0.40234375), // sin(17*(π/128))
Q_8_8(0.42578125), // sin(18*(π/128))
Q_8_8(0.44921875), // sin(19*(π/128))
Q_8_8(0.46875), // sin(20*(π/128))
Q_8_8(0.4921875), // sin(21*(π/128))
Q_8_8(0.51171875), // sin(22*(π/128))
Q_8_8(0.53125), // sin(23*(π/128))
Q_8_8(0.5546875), // sin(24*(π/128))
Q_8_8(0.57421875), // sin(25*(π/128))
Q_8_8(0.59375), // sin(26*(π/128))
Q_8_8(0.61328125), // sin(27*(π/128))
Q_8_8(0.6328125), // sin(28*(π/128))
Q_8_8(0.65234375), // sin(29*(π/128))
Q_8_8(0.66796875), // sin(30*(π/128))
Q_8_8(0.6875), // sin(31*(π/128))
Q_8_8(0.70703125), // sin(32*(π/128))
Q_8_8(0.72265625), // sin(33*(π/128))
Q_8_8(0.73828125), // sin(34*(π/128))
Q_8_8(0.75390625), // sin(35*(π/128))
Q_8_8(0.76953125), // sin(36*(π/128))
Q_8_8(0.78515625), // sin(37*(π/128))
Q_8_8(0.80078125), // sin(38*(π/128))
Q_8_8(0.81640625), // sin(39*(π/128))
Q_8_8(0.828125), // sin(40*(π/128))
Q_8_8(0.84375), // sin(41*(π/128))
Q_8_8(0.85546875), // sin(42*(π/128))
Q_8_8(0.8671875), // sin(43*(π/128))
Q_8_8(0.87890625), // sin(44*(π/128))
Q_8_8(0.890625), // sin(45*(π/128))
Q_8_8(0.90234375), // sin(46*(π/128))
Q_8_8(0.9140625), // sin(47*(π/128))
Q_8_8(0.921875), // sin(48*(π/128))
Q_8_8(0.9296875), // sin(49*(π/128))
Q_8_8(0.94140625), // sin(50*(π/128))
Q_8_8(0.94921875), // sin(51*(π/128))
Q_8_8(0.953125), // sin(52*(π/128))
Q_8_8(0.9609375), // sin(53*(π/128))
Q_8_8(0.96875), // sin(54*(π/128))
Q_8_8(0.97265625), // sin(55*(π/128))
Q_8_8(0.98046875), // sin(56*(π/128))
Q_8_8(0.984375), // sin(57*(π/128))
Q_8_8(0.98828125), // sin(58*(π/128))
Q_8_8(0.9921875), // sin(59*(π/128))
Q_8_8(0.9921875), // sin(60*(π/128))
Q_8_8(0.99609375), // sin(61*(π/128))
Q_8_8(0.99609375), // sin(62*(π/128))
Q_8_8(0.99609375), // sin(63*(π/128))
};
const s16 gCosineTable[256] = {
Q_8_8(1), // sin(64*(π/128))
Q_8_8(0.99609375), // sin(65*(π/128))
Q_8_8(0.99609375), // sin(66*(π/128))
Q_8_8(0.99609375), // sin(67*(π/128))
Q_8_8(0.9921875), // sin(68*(π/128))
Q_8_8(0.9921875), // sin(69*(π/128))
Q_8_8(0.98828125), // sin(70*(π/128))
Q_8_8(0.984375), // sin(71*(π/128))
Q_8_8(0.98046875), // sin(72*(π/128))
Q_8_8(0.97265625), // sin(73*(π/128))
Q_8_8(0.96875), // sin(74*(π/128))
Q_8_8(0.9609375), // sin(75*(π/128))
Q_8_8(0.953125), // sin(76*(π/128))
Q_8_8(0.94921875), // sin(77*(π/128))
Q_8_8(0.94140625), // sin(78*(π/128))
Q_8_8(0.9296875), // sin(79*(π/128))
Q_8_8(0.921875), // sin(80*(π/128))
Q_8_8(0.9140625), // sin(81*(π/128))
Q_8_8(0.90234375), // sin(82*(π/128))
Q_8_8(0.890625), // sin(83*(π/128))
Q_8_8(0.87890625), // sin(84*(π/128))
Q_8_8(0.8671875), // sin(85*(π/128))
Q_8_8(0.85546875), // sin(86*(π/128))
Q_8_8(0.84375), // sin(87*(π/128))
Q_8_8(0.828125), // sin(88*(π/128))
Q_8_8(0.81640625), // sin(89*(π/128))
Q_8_8(0.80078125), // sin(90*(π/128))
Q_8_8(0.78515625), // sin(91*(π/128))
Q_8_8(0.76953125), // sin(92*(π/128))
Q_8_8(0.75390625), // sin(93*(π/128))
Q_8_8(0.73828125), // sin(94*(π/128))
Q_8_8(0.72265625), // sin(95*(π/128))
Q_8_8(0.70703125), // sin(96*(π/128))
Q_8_8(0.6875), // sin(97*(π/128))
Q_8_8(0.66796875), // sin(98*(π/128))
Q_8_8(0.65234375), // sin(99*(π/128))
Q_8_8(0.6328125), // sin(100*(π/128))
Q_8_8(0.61328125), // sin(101*(π/128))
Q_8_8(0.59375), // sin(102*(π/128))
Q_8_8(0.57421875), // sin(103*(π/128))
Q_8_8(0.5546875), // sin(104*(π/128))
Q_8_8(0.53125), // sin(105*(π/128))
Q_8_8(0.51171875), // sin(106*(π/128))
Q_8_8(0.4921875), // sin(107*(π/128))
Q_8_8(0.46875), // sin(108*(π/128))
Q_8_8(0.44921875), // sin(109*(π/128))
Q_8_8(0.42578125), // sin(110*(π/128))
Q_8_8(0.40234375), // sin(111*(π/128))
Q_8_8(0.37890625), // sin(112*(π/128))
Q_8_8(0.359375), // sin(113*(π/128))
Q_8_8(0.3359375), // sin(114*(π/128))
Q_8_8(0.3125), // sin(115*(π/128))
Q_8_8(0.2890625), // sin(116*(π/128))
Q_8_8(0.265625), // sin(117*(π/128))
Q_8_8(0.2421875), // sin(118*(π/128))
Q_8_8(0.21875), // sin(119*(π/128))
Q_8_8(0.19140625), // sin(120*(π/128))
Q_8_8(0.16796875), // sin(121*(π/128))
Q_8_8(0.14453125), // sin(122*(π/128))
Q_8_8(0.12109375), // sin(123*(π/128))
Q_8_8(0.09765625), // sin(124*(π/128))
Q_8_8(0.0703125), // sin(125*(π/128))
Q_8_8(0.046875), // sin(126*(π/128))
Q_8_8(0.0234375), // sin(127*(π/128))
Q_8_8(0), // sin(128*(π/128))
Q_8_8(-0.0234375), // sin(129*(π/128))
Q_8_8(-0.046875), // sin(130*(π/128))
Q_8_8(-0.0703125), // sin(131*(π/128))
Q_8_8(-0.09765625), // sin(132*(π/128))
Q_8_8(-0.12109375), // sin(133*(π/128))
Q_8_8(-0.14453125), // sin(134*(π/128))
Q_8_8(-0.16796875), // sin(135*(π/128))
Q_8_8(-0.19140625), // sin(136*(π/128))
Q_8_8(-0.21875), // sin(137*(π/128))
Q_8_8(-0.2421875), // sin(138*(π/128))
Q_8_8(-0.265625), // sin(139*(π/128))
Q_8_8(-0.2890625), // sin(140*(π/128))
Q_8_8(-0.3125), // sin(141*(π/128))
Q_8_8(-0.3359375), // sin(142*(π/128))
Q_8_8(-0.359375), // sin(143*(π/128))
Q_8_8(-0.37890625), // sin(144*(π/128))
Q_8_8(-0.40234375), // sin(145*(π/128))
Q_8_8(-0.42578125), // sin(146*(π/128))
Q_8_8(-0.44921875), // sin(147*(π/128))
Q_8_8(-0.46875), // sin(148*(π/128))
Q_8_8(-0.4921875), // sin(149*(π/128))
Q_8_8(-0.51171875), // sin(150*(π/128))
Q_8_8(-0.53125), // sin(151*(π/128))
Q_8_8(-0.5546875), // sin(152*(π/128))
Q_8_8(-0.57421875), // sin(153*(π/128))
Q_8_8(-0.59375), // sin(154*(π/128))
Q_8_8(-0.61328125), // sin(155*(π/128))
Q_8_8(-0.6328125), // sin(156*(π/128))
Q_8_8(-0.65234375), // sin(157*(π/128))
Q_8_8(-0.66796875), // sin(158*(π/128))
Q_8_8(-0.6875), // sin(159*(π/128))
Q_8_8(-0.70703125), // sin(160*(π/128))
Q_8_8(-0.72265625), // sin(161*(π/128))
Q_8_8(-0.73828125), // sin(162*(π/128))
Q_8_8(-0.75390625), // sin(163*(π/128))
Q_8_8(-0.76953125), // sin(164*(π/128))
Q_8_8(-0.78515625), // sin(165*(π/128))
Q_8_8(-0.80078125), // sin(166*(π/128))
Q_8_8(-0.81640625), // sin(167*(π/128))
Q_8_8(-0.828125), // sin(168*(π/128))
Q_8_8(-0.84375), // sin(169*(π/128))
Q_8_8(-0.85546875), // sin(170*(π/128))
Q_8_8(-0.8671875), // sin(171*(π/128))
Q_8_8(-0.87890625), // sin(172*(π/128))
Q_8_8(-0.890625), // sin(173*(π/128))
Q_8_8(-0.90234375), // sin(174*(π/128))
Q_8_8(-0.9140625), // sin(175*(π/128))
Q_8_8(-0.921875), // sin(176*(π/128))
Q_8_8(-0.9296875), // sin(177*(π/128))
Q_8_8(-0.94140625), // sin(178*(π/128))
Q_8_8(-0.94921875), // sin(179*(π/128))
Q_8_8(-0.953125), // sin(180*(π/128))
Q_8_8(-0.9609375), // sin(181*(π/128))
Q_8_8(-0.96875), // sin(182*(π/128))
Q_8_8(-0.97265625), // sin(183*(π/128))
Q_8_8(-0.98046875), // sin(184*(π/128))
Q_8_8(-0.984375), // sin(185*(π/128))
Q_8_8(-0.98828125), // sin(186*(π/128))
Q_8_8(-0.9921875), // sin(187*(π/128))
Q_8_8(-0.9921875), // sin(188*(π/128))
Q_8_8(-0.99609375), // sin(189*(π/128))
Q_8_8(-0.99609375), // sin(190*(π/128))
Q_8_8(-0.99609375), // sin(191*(π/128))
Q_8_8(-1), // sin(192*(π/128))
Q_8_8(-0.99609375), // sin(193*(π/128))
Q_8_8(-0.99609375), // sin(194*(π/128))
Q_8_8(-0.99609375), // sin(195*(π/128))
Q_8_8(-0.9921875), // sin(196*(π/128))
Q_8_8(-0.9921875), // sin(197*(π/128))
Q_8_8(-0.98828125), // sin(198*(π/128))
Q_8_8(-0.984375), // sin(199*(π/128))
Q_8_8(-0.98046875), // sin(200*(π/128))
Q_8_8(-0.97265625), // sin(201*(π/128))
Q_8_8(-0.96875), // sin(202*(π/128))
Q_8_8(-0.9609375), // sin(203*(π/128))
Q_8_8(-0.953125), // sin(204*(π/128))
Q_8_8(-0.94921875), // sin(205*(π/128))
Q_8_8(-0.94140625), // sin(206*(π/128))
Q_8_8(-0.9296875), // sin(207*(π/128))
Q_8_8(-0.921875), // sin(208*(π/128))
Q_8_8(-0.9140625), // sin(209*(π/128))
Q_8_8(-0.90234375), // sin(210*(π/128))
Q_8_8(-0.890625), // sin(211*(π/128))
Q_8_8(-0.87890625), // sin(212*(π/128))
Q_8_8(-0.8671875), // sin(213*(π/128))
Q_8_8(-0.85546875), // sin(214*(π/128))
Q_8_8(-0.84375), // sin(215*(π/128))
Q_8_8(-0.828125), // sin(216*(π/128))
Q_8_8(-0.81640625), // sin(217*(π/128))
Q_8_8(-0.80078125), // sin(218*(π/128))
Q_8_8(-0.78515625), // sin(219*(π/128))
Q_8_8(-0.76953125), // sin(220*(π/128))
Q_8_8(-0.75390625), // sin(221*(π/128))
Q_8_8(-0.73828125), // sin(222*(π/128))
Q_8_8(-0.72265625), // sin(223*(π/128))
Q_8_8(-0.70703125), // sin(224*(π/128))
Q_8_8(-0.6875), // sin(225*(π/128))
Q_8_8(-0.66796875), // sin(226*(π/128))
Q_8_8(-0.65234375), // sin(227*(π/128))
Q_8_8(-0.6328125), // sin(228*(π/128))
Q_8_8(-0.61328125), // sin(229*(π/128))
Q_8_8(-0.59375), // sin(230*(π/128))
Q_8_8(-0.57421875), // sin(231*(π/128))
Q_8_8(-0.5546875), // sin(232*(π/128))
Q_8_8(-0.53125), // sin(233*(π/128))
Q_8_8(-0.51171875), // sin(234*(π/128))
Q_8_8(-0.4921875), // sin(235*(π/128))
Q_8_8(-0.46875), // sin(236*(π/128))
Q_8_8(-0.44921875), // sin(237*(π/128))
Q_8_8(-0.42578125), // sin(238*(π/128))
Q_8_8(-0.40234375), // sin(239*(π/128))
Q_8_8(-0.37890625), // sin(240*(π/128))
Q_8_8(-0.359375), // sin(241*(π/128))
Q_8_8(-0.3359375), // sin(242*(π/128))
Q_8_8(-0.3125), // sin(243*(π/128))
Q_8_8(-0.2890625), // sin(244*(π/128))
Q_8_8(-0.265625), // sin(245*(π/128))
Q_8_8(-0.2421875), // sin(246*(π/128))
Q_8_8(-0.21875), // sin(247*(π/128))
Q_8_8(-0.19140625), // sin(248*(π/128))
Q_8_8(-0.16796875), // sin(249*(π/128))
Q_8_8(-0.14453125), // sin(250*(π/128))
Q_8_8(-0.12109375), // sin(251*(π/128))
Q_8_8(-0.09765625), // sin(252*(π/128))
Q_8_8(-0.0703125), // sin(253*(π/128))
Q_8_8(-0.046875), // sin(254*(π/128))
Q_8_8(-0.0234375), // sin(255*(π/128))
Q_8_8(0), // sin(256*(π/128))
Q_8_8(0.0234375), // sin(257*(π/128))
Q_8_8(0.046875), // sin(258*(π/128))
Q_8_8(0.0703125), // sin(259*(π/128))
Q_8_8(0.09765625), // sin(260*(π/128))
Q_8_8(0.12109375), // sin(261*(π/128))
Q_8_8(0.14453125), // sin(262*(π/128))
Q_8_8(0.16796875), // sin(263*(π/128))
Q_8_8(0.19140625), // sin(264*(π/128))
Q_8_8(0.21875), // sin(265*(π/128))
Q_8_8(0.2421875), // sin(266*(π/128))
Q_8_8(0.265625), // sin(267*(π/128))
Q_8_8(0.2890625), // sin(268*(π/128))
Q_8_8(0.3125), // sin(269*(π/128))
Q_8_8(0.3359375), // sin(270*(π/128))
Q_8_8(0.359375), // sin(271*(π/128))
Q_8_8(0.37890625), // sin(272*(π/128))
Q_8_8(0.40234375), // sin(273*(π/128))
Q_8_8(0.42578125), // sin(274*(π/128))
Q_8_8(0.44921875), // sin(275*(π/128))
Q_8_8(0.46875), // sin(276*(π/128))
Q_8_8(0.4921875), // sin(277*(π/128))
Q_8_8(0.51171875), // sin(278*(π/128))
Q_8_8(0.53125), // sin(279*(π/128))
Q_8_8(0.5546875), // sin(280*(π/128))
Q_8_8(0.57421875), // sin(281*(π/128))
Q_8_8(0.59375), // sin(282*(π/128))
Q_8_8(0.61328125), // sin(283*(π/128))
Q_8_8(0.6328125), // sin(284*(π/128))
Q_8_8(0.65234375), // sin(285*(π/128))
Q_8_8(0.66796875), // sin(286*(π/128))
Q_8_8(0.6875), // sin(287*(π/128))
Q_8_8(0.70703125), // sin(288*(π/128))
Q_8_8(0.72265625), // sin(289*(π/128))
Q_8_8(0.73828125), // sin(290*(π/128))
Q_8_8(0.75390625), // sin(291*(π/128))
Q_8_8(0.76953125), // sin(292*(π/128))
Q_8_8(0.78515625), // sin(293*(π/128))
Q_8_8(0.80078125), // sin(294*(π/128))
Q_8_8(0.81640625), // sin(295*(π/128))
Q_8_8(0.828125), // sin(296*(π/128))
Q_8_8(0.84375), // sin(297*(π/128))
Q_8_8(0.85546875), // sin(298*(π/128))
Q_8_8(0.8671875), // sin(299*(π/128))
Q_8_8(0.87890625), // sin(300*(π/128))
Q_8_8(0.890625), // sin(301*(π/128))
Q_8_8(0.90234375), // sin(302*(π/128))
Q_8_8(0.9140625), // sin(303*(π/128))
Q_8_8(0.921875), // sin(304*(π/128))
Q_8_8(0.9296875), // sin(305*(π/128))
Q_8_8(0.94140625), // sin(306*(π/128))
Q_8_8(0.94921875), // sin(307*(π/128))
Q_8_8(0.953125), // sin(308*(π/128))
Q_8_8(0.9609375), // sin(309*(π/128))
Q_8_8(0.96875), // sin(310*(π/128))
Q_8_8(0.97265625), // sin(311*(π/128))
Q_8_8(0.98046875), // sin(312*(π/128))
Q_8_8(0.984375), // sin(313*(π/128))
Q_8_8(0.98828125), // sin(314*(π/128))
Q_8_8(0.9921875), // sin(315*(π/128))
Q_8_8(0.9921875), // sin(316*(π/128))
Q_8_8(0.99609375), // sin(317*(π/128))
Q_8_8(0.99609375), // sin(318*(π/128))
Q_8_8(0.99609375), // sin(319*(π/128))
};