Merge pull request #256 from mateon1/blegh
Some checks failed
GithubCI / build (push) Has been cancelled

WIP
This commit is contained in:
AnonymousRandomPerson 2024-11-16 15:53:59 -05:00 committed by GitHub
commit 4e10317625
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
112 changed files with 1310 additions and 1303 deletions

1
.gitignore vendored
View File

@ -43,3 +43,4 @@ build/
*.ss[0-9]
*.pyc
__pycache__/
*.syms

View File

@ -609,7 +609,7 @@ _0800FE3C:
lsls r0, 8
str r0, [sp, 0x10]
add r0, sp, 0xC
bl sub_800A0B0
bl Atan2_4096
adds r2, r0, 0
ldr r0, [sp, 0xC]
cmp r0, 0
@ -1294,7 +1294,7 @@ _08010392:
str r0, [sp, 0xC]
str r3, [sp, 0x10]
add r0, sp, 0xC
bl sub_800A0B0
bl Atan2_4096
ldr r1, _08010474
adds r3, r0, r1
cmp r3, 0

View File

@ -442,7 +442,7 @@ _08046110:
ldrsh r0, [r5, r1]
movs r2, 0x2
ldrsh r1, [r5, r2]
bl GetTileSafe
bl GetTileMut
str r4, [r0, 0x14]
ldrh r1, [r0]
movs r0, 0x20
@ -528,7 +528,7 @@ sub_80461C8:
ldrsh r0, [r2, r1]
movs r3, 0x2
ldrsh r1, [r2, r3]
bl GetTileSafe
bl GetTileMut
adds r6, r0, 0
ldr r5, [r6, 0x14]
cmp r5, 0

View File

@ -679,7 +679,7 @@ _0804B55A:
adds r0, r5, 0
adds r1, r4, 0
str r3, [sp, 0xC]
bl GetTileSafe
bl GetTileMut
adds r2, r0, 0
ldrh r0, [r2]
ldr r6, _0804B630
@ -1196,7 +1196,7 @@ _0804B962:
ldr r2, _0804B9F0
add r2, sp
str r3, [r2]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
mov r2, r9
ands r1, r2
@ -1205,7 +1205,7 @@ _0804B962:
strh r1, [r0]
adds r0, r4, 0
adds r1, r5, 0
bl GetTileSafe
bl GetTileMut
ldr r1, _0804B9D0
add r1, sp
ldrb r1, [r1]
@ -1294,7 +1294,7 @@ _0804B9F4:
strh r0, [r7, 0x6]
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
ldr r3, _0804BBF8
adds r2, r3, 0
@ -1304,7 +1304,7 @@ _0804B9F4:
strh r1, [r0]
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0xFF
strb r1, [r0, 0x9]
_0804BA72:
@ -1805,7 +1805,7 @@ _0804BE84:
ldr r2, _0804BEFC
add r2, sp
str r3, [r2]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
mov r2, r8
ands r1, r2
@ -1814,7 +1814,7 @@ _0804BE84:
strh r1, [r0]
adds r0, r4, 0
adds r1, r5, 0
bl GetTileSafe
bl GetTileMut
ldr r1, _0804BEE0
add r1, sp
ldrb r1, [r1]
@ -1902,7 +1902,7 @@ _0804BF00:
strh r0, [r7, 0x6]
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
ldr r6, _0804C090
adds r2, r6, 0
@ -1912,7 +1912,7 @@ _0804BF00:
strh r1, [r0]
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0xFF
strb r1, [r0, 0x9]
_0804BF88:
@ -2563,7 +2563,7 @@ _0804C4C2:
_0804C4CE:
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
ands r1, r7
movs r2, 0x1
@ -3164,7 +3164,7 @@ _0804C95C:
_0804C972:
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
mov r2, r8
ands r1, r2
@ -3173,7 +3173,7 @@ _0804C972:
strh r1, [r0]
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
mov r1, r9
strb r1, [r0, 0x9]
adds r4, 0x1
@ -3373,7 +3373,7 @@ _0804CB0C:
lsls r2, 5
add r2, sp
str r3, [r2]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
mov r2, r8
ands r1, r2
@ -3382,7 +3382,7 @@ _0804CB0C:
strh r1, [r0]
adds r0, r4, 0
adds r1, r5, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0xE5
lsls r1, 5
add r1, sp
@ -3871,7 +3871,7 @@ _0804CEFA:
beq _0804CF16
adds r0, r7, 0
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
ldr r3, _0804D018
adds r2, r3, 0
@ -4544,7 +4544,7 @@ _0804D3E0:
adds r0, r4, 0
adds r1, r5, 0
str r3, [sp, 0x34]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
mov r2, r9
ands r1, r2
@ -4553,7 +4553,7 @@ _0804D3E0:
strh r1, [r0]
adds r0, r4, 0
adds r1, r5, 0
bl GetTileSafe
bl GetTileMut
mov r1, sp
ldrb r1, [r1, 0x10]
strb r1, [r0, 0x9]
@ -4680,7 +4680,7 @@ _0804D4BA:
strh r0, [r7, 0x6]
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
ldr r3, _0804D530
adds r2, r3, 0
@ -4690,7 +4690,7 @@ _0804D4BA:
strh r1, [r0]
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0xFE
strb r1, [r0, 0x9]
_0804D508:
@ -5815,7 +5815,7 @@ _0804DCF0:
adds r0, r5, 0
adds r1, r4, 0
str r3, [sp, 0x54]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
ldr r3, [sp, 0x54]
ands r1, r3
@ -5945,7 +5945,7 @@ _0804DDE0:
adds r0, r5, 0
adds r1, r4, 0
str r3, [sp, 0x54]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
ldr r3, [sp, 0x54]
ands r1, r3
@ -6076,7 +6076,7 @@ _0804DED0:
adds r0, r5, 0
adds r1, r4, 0
str r3, [sp, 0x54]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
ldr r3, [sp, 0x54]
ands r1, r3
@ -6195,7 +6195,7 @@ _0804DFB6:
adds r0, r5, 0
adds r1, r4, 0
str r3, [sp, 0x54]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
mov r2, r9
ands r1, r2
@ -6617,7 +6617,7 @@ _0804E2AA:
bne _0804E2F0
adds r0, r7, 0
mov r1, r8
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0]
ldr r4, _0804E2CC
adds r1, r4, 0
@ -6723,7 +6723,7 @@ _0804E360:
beq _0804E390
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0]
ldr r3, _0804E38C
adds r1, r3, 0
@ -6773,7 +6773,7 @@ _0804E3BC:
beq _0804E3EC
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0]
ldr r3, _0804E3E8
adds r1, r3, 0
@ -6829,7 +6829,7 @@ _0804E420:
beq _0804E450
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0]
ldr r3, _0804E44C
adds r1, r3, 0
@ -6883,7 +6883,7 @@ _0804E482:
beq _0804E4B0
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0]
ldr r3, _0804E4AC
adds r1, r3, 0
@ -6930,7 +6930,7 @@ _0804E4D0:
beq _0804E508
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0]
ldr r3, _0804E504
adds r1, r3, 0
@ -6979,7 +6979,7 @@ _0804E52C:
beq _0804E564
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0]
ldr r3, _0804E560
adds r1, r3, 0
@ -7379,7 +7379,7 @@ _0804E848:
ldrsh r0, [r6, r1]
movs r2, 0x2
ldrsh r1, [r6, r2]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
ldr r3, _0804E99C
adds r2, r3, 0
@ -7494,7 +7494,7 @@ _0804E908:
_0804E926:
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0]
ldr r3, _0804E99C
adds r1, r3, 0
@ -7628,7 +7628,7 @@ _0804EA0E:
ble _0804EA4E
subs r0, r5, 0x1
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
adds r2, r0, 0
ldrb r0, [r2, 0x9]
cmp r0, 0xFF
@ -7653,7 +7653,7 @@ _0804EA4E:
ble _0804EA82
subs r1, r4, 0x1
adds r0, r5, 0
bl GetTileSafe
bl GetTileMut
adds r2, r0, 0
ldrb r0, [r2, 0x9]
cmp r0, 0xFF
@ -7680,7 +7680,7 @@ _0804EA82:
bgt _0804EABA
adds r0, r5, 0
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
adds r2, r0, 0
ldrb r0, [r2, 0x9]
cmp r0, 0xFF
@ -7707,7 +7707,7 @@ _0804EABA:
bgt _0804EB0E
mov r0, r10
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
adds r2, r0, 0
ldrb r0, [r2, 0x9]
cmp r0, 0xFF
@ -7740,7 +7740,7 @@ _0804EAF4:
bne _0804EB0E
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0xFF
strb r1, [r0, 0x9]
_0804EB0E:
@ -8099,7 +8099,7 @@ _0804ED98:
adds r0, r5, 0
adds r1, r4, 0
str r3, [sp, 0x50]
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0]
movs r1, 0x20
orrs r1, r2
@ -8185,7 +8185,7 @@ _0804EE18:
_0804EE38:
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0, 0x4]
movs r1, 0x10
orrs r1, r2
@ -8466,7 +8466,7 @@ _0804F046:
_0804F05A:
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0]
movs r1, 0x40
orrs r1, r2
@ -8971,7 +8971,7 @@ _0804F40A:
beq _0804F438
subs r0, r6, 0x1
adds r1, r5, 0
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
ands r1, r7
movs r2, 0x2
@ -8982,7 +8982,7 @@ _0804F434: .4byte 0x0000fffc
_0804F438:
subs r0, r6, 0x1
adds r1, r5, 0
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
ands r1, r7
_0804F444:
@ -9057,7 +9057,7 @@ _0804F4BA:
movs r7, 0
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
mov r1, r9
mov r3, r8
lsrs r2, r3, 24
@ -9140,7 +9140,7 @@ _0804F550:
_0804F55A:
adds r0, r5, 0x1
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
mov r1, r9
mov r3, r8
lsrs r2, r3, 24
@ -9150,7 +9150,7 @@ _0804F55A:
_0804F570:
subs r1, r4, 0x1
adds r0, r5, 0
bl GetTileSafe
bl GetTileMut
mov r1, r9
mov r3, r8
lsrs r2, r3, 24
@ -9160,7 +9160,7 @@ _0804F570:
_0804F586:
subs r0, r5, 0x1
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
mov r1, r9
mov r3, r8
lsrs r2, r3, 24
@ -9170,7 +9170,7 @@ _0804F586:
_0804F59C:
adds r1, r4, 0x1
adds r0, r5, 0
bl GetTileSafe
bl GetTileMut
mov r1, r9
mov r3, r8
lsrs r2, r3, 24
@ -9220,7 +9220,7 @@ _0804F5E2:
_0804F5F0:
adds r0, r6, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0, 0x4]
movs r1, 0x20
orrs r1, r2
@ -9400,7 +9400,7 @@ _0804F730:
_0804F73C:
mov r0, r8
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0
bl sub_804F5C4
adds r4, 0x1
@ -9425,7 +9425,7 @@ _0804F75E:
_0804F76C:
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0]
movs r1, 0x80
orrs r1, r2
@ -9482,7 +9482,7 @@ _0804F7C8:
_0804F7D4:
adds r0, r4, 0
mov r1, r8
bl GetTileSafe
bl GetTileMut
movs r1, 0
bl sub_804F5C4
adds r4, 0x1
@ -9507,7 +9507,7 @@ _0804F7F6:
_0804F804:
adds r0, r4, 0
adds r1, r5, 0
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0]
movs r1, 0x80
orrs r1, r2
@ -9568,7 +9568,7 @@ _0804F864:
mov r10, r0
adds r0, r5, 0
mov r1, r10
bl GetTileSafe
bl GetTileMut
movs r1, 0x4
bl sub_804F5C4
ldr r1, [sp]
@ -9576,12 +9576,12 @@ _0804F864:
mov r9, r1
mov r0, r9
mov r1, r10
bl GetTileSafe
bl GetTileMut
movs r1, 0x4
bl sub_804F5C4
ldr r0, [sp]
mov r1, r10
bl GetTileSafe
bl GetTileMut
movs r1, 0x4
bl sub_804F5C4
ldr r2, [sp]
@ -9589,118 +9589,118 @@ _0804F864:
mov r8, r2
mov r0, r8
mov r1, r10
bl GetTileSafe
bl GetTileMut
movs r1, 0x4
bl sub_804F5C4
ldr r6, [sp, 0x4]
subs r6, 0x1
adds r0, r5, 0
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0x4
bl sub_804F5C4
adds r0, r5, 0
ldr r1, [sp, 0x4]
bl GetTileSafe
bl GetTileMut
movs r1, 0x4
bl sub_804F5C4
ldr r4, [sp, 0x4]
adds r4, 0x1
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0x4
bl sub_804F5C4
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0x4
bl sub_804F5C4
mov r0, r9
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0x4
bl sub_804F5C4
ldr r0, [sp]
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0x4
bl sub_804F5C4
mov r0, r8
mov r1, r10
bl GetTileSafe
bl GetTileMut
movs r1, 0x4
bl sub_804F5C4
mov r0, r8
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0x4
bl sub_804F5C4
mov r0, r8
ldr r1, [sp, 0x4]
bl GetTileSafe
bl GetTileMut
movs r1, 0x4
bl sub_804F5C4
mov r0, r8
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0x4
bl sub_804F5C4
mov r0, r9
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0, 0x4]
movs r1, 0x4
orrs r1, r2
strh r1, [r0, 0x4]
mov r0, r9
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0, 0x4]
movs r2, 0x40
orrs r1, r2
strh r1, [r0, 0x4]
ldr r0, [sp]
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0, 0x4]
movs r4, 0x2
orrs r1, r4
strh r1, [r0, 0x4]
mov r0, r9
ldr r1, [sp, 0x4]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0, 0x4]
orrs r1, r4
strh r1, [r0, 0x4]
ldr r0, [sp]
ldr r1, [sp, 0x4]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0, 0x4]
orrs r1, r4
strh r1, [r0, 0x4]
mov r0, r9
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0, 0x4]
movs r4, 0x10
orrs r1, r4
strh r1, [r0, 0x4]
ldr r0, [sp]
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0, 0x4]
orrs r1, r4
strh r1, [r0, 0x4]
mov r0, r9
ldr r1, [sp, 0x4]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0, 0x4]
orrs r1, r4
strh r1, [r0, 0x4]
ldr r0, [sp]
ldr r1, [sp, 0x4]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0, 0x4]
orrs r4, r1
strh r4, [r0, 0x4]
@ -9789,7 +9789,7 @@ _0804FA6C:
_0804FA76:
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0
bl sub_804F5C4
adds r4, 0x1
@ -9861,7 +9861,7 @@ _0804FAD4:
movs r4, 0x2
ldrsh r1, [r7, r4]
adds r1, r2
bl GetTileSafe
bl GetTileMut
movs r1, 0
bl sub_804F5C4
_0804FB14:
@ -9917,28 +9917,28 @@ _0804FB54:
ble _0804FBAE
adds r0, r5, 0x1
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0
bl sub_804F5C4
adds r1, r4, 0x1
adds r0, r5, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0
bl sub_804F5C4
subs r0, r5, 0x1
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0
bl sub_804F5C4
subs r1, r4, 0x1
adds r0, r5, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0
bl sub_804F5C4
_0804FBAE:
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0
bl sub_804F5C4
b _0804FBD2

View File

@ -106,7 +106,7 @@ _0804FFAA:
adds r4, r1, r0
ldrb r0, [r4]
ldrb r1, [r4, 0x1]
bl GetTileSafe
bl GetTileMut
adds r5, r0, 0
ldrh r1, [r5, 0x4]
movs r0, 0x1
@ -137,7 +137,7 @@ _08050002:
_08050004:
adds r0, r6, 0
adds r1, r5, 0
bl GetTileSafe
bl GetTileMut
adds r1, r0, 0
ldrh r2, [r1]
movs r0, 0x3
@ -245,7 +245,7 @@ _080500BC:
_080500D8:
ldrb r0, [r4]
ldrb r1, [r4, 0x1]
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0, 0x4]
movs r1, 0x2
orrs r1, r2
@ -320,7 +320,7 @@ _08050128:
_0805016C:
ldrb r0, [r4]
ldrb r1, [r4, 0x1]
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0, 0x4]
movs r1, 0x2
orrs r1, r2
@ -432,7 +432,7 @@ _0805024C: .4byte 0x00003a0c
_08050250: .4byte gUnknown_80F4DA0
_08050254:
ldrb r1, [r7, 0x1]
bl GetTileSafe
bl GetTileMut
adds r4, r0, 0
movs r0, 0x2
bl DungeonRandInt
@ -549,7 +549,7 @@ _08050318:
_08050334:
ldrb r0, [r4]
ldrb r1, [r4, 0x1]
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0, 0x4]
movs r1, 0x4
orrs r1, r2
@ -814,7 +814,7 @@ _0805051C:
_0805053C:
ldrb r0, [r4]
ldrb r1, [r4, 0x1]
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0, 0x4]
movs r1, 0x8
orrs r1, r2
@ -969,7 +969,7 @@ _0805064E:
_0805066A:
ldrb r0, [r4]
ldrb r1, [r4, 0x1]
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0, 0x4]
movs r1, 0x8
orrs r1, r2
@ -1137,7 +1137,7 @@ _080507A8:
bne _080507B8
mov r0, r9
mov r1, r10
bl GetTileSafe
bl GetTileMut
bl sub_80506BC
_080507B8:
ldr r2, [sp, 0x68]
@ -1278,7 +1278,7 @@ _080508CC:
cmp r1, 0
bne _080508DA
adds r1, r5, 0
bl GetTileSafe
bl GetTileMut
bl sub_80506BC
_080508DA:
ldr r1, [sp, 0x7C]
@ -1446,7 +1446,7 @@ _08050A0A:
bne _08050A1A
ldr r0, [sp, 0x90]
ldr r1, [sp, 0x94]
bl GetTileSafe
bl GetTileMut
bl sub_80506BC
_08050A1A:
adds r5, 0x1
@ -1650,7 +1650,7 @@ _08050B7C:
subs r0, r7, 0x5
adds r1, r6, 0
str r2, [sp, 0x9C]
bl GetTileSafe
bl GetTileMut
bl sub_80506BC
ldr r2, [sp, 0x9C]
_08050B92:
@ -1683,7 +1683,7 @@ _08050BB8:
_08050BC0:
mov r0, r9
mov r1, r10
bl GetTileSafe
bl GetTileMut
adds r2, r0, 0
ldrh r3, [r2]
movs r0, 0x3
@ -1777,7 +1777,7 @@ _08050C5C:
_08050C68:
adds r0, r7, 0
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
adds r2, r0, 0
ldrh r0, [r2]
movs r3, 0x3
@ -2135,7 +2135,7 @@ _08050F00:
_08050F08:
adds r0, r7, 0
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
adds r2, r0, 0
ldrb r1, [r4]
movs r0, 0x87
@ -2374,7 +2374,7 @@ _080510D6:
adds r0, r5, 0
adds r1, r4, 0
str r3, [sp, 0x38]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
mov r2, r9
ands r1, r2
@ -2383,7 +2383,7 @@ _080510D6:
strh r1, [r0]
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
mov r1, sp
ldrb r1, [r1, 0x10]
strb r1, [r0, 0x9]
@ -2469,7 +2469,7 @@ _08051162:
strh r0, [r6, 0x6]
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
ldr r3, _080511EC
adds r2, r3, 0
@ -2479,7 +2479,7 @@ _08051162:
strh r1, [r0]
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0xFF
strb r1, [r0, 0x9]
ldr r4, [sp, 0x14]
@ -2663,7 +2663,7 @@ _080512EE:
lsrs r4, 24
adds r0, r5, 0
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
movs r1, 0x1
str r1, [sp]
adds r1, r4, 0
@ -2711,7 +2711,7 @@ _08051338:
_08051350:
adds r0, r5, 0
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
adds r2, r0, 0
ldrh r1, [r2]
movs r0, 0x10
@ -2760,7 +2760,7 @@ _080513B8:
_080513BC:
adds r0, r5, 0
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0]
movs r1, 0x10
orrs r1, r2
@ -2788,7 +2788,7 @@ _080513EC:
_080513F0:
adds r0, r5, 0
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
adds r2, r0, 0
ldrh r1, [r2]
movs r0, 0x3
@ -2923,7 +2923,7 @@ _080514EE:
lsrs r5, 24
adds r0, r7, 0
mov r1, r8
bl GetTileSafe
bl GetTileMut
adds r6, r0, 0
ldr r1, [sp, 0x4]
ldr r2, _080515D0
@ -3047,7 +3047,7 @@ _080515F6:
lsrs r4, 24
adds r0, r7, 0
mov r1, r8
bl GetTileSafe
bl GetTileMut
adds r5, r0, 0
ldrb r6, [r5, 0x9]
movs r0, 0x1
@ -3154,7 +3154,7 @@ _080516CA:
ldr r0, [r5]
adds r1, r4, 0
str r2, [sp, 0xC]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
ldr r2, [sp, 0xC]
ands r1, r2
@ -3187,7 +3187,7 @@ _0805170A:
ldr r0, [r5, 0x8]
adds r1, r4, 0
str r2, [sp, 0xC]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
ldr r2, [sp, 0xC]
ands r1, r2
@ -3233,7 +3233,7 @@ _08051762:
ldr r1, [r5, 0x4]
adds r0, r4, 0
str r2, [sp, 0xC]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
ldr r2, [sp, 0xC]
ands r1, r2
@ -3266,7 +3266,7 @@ _080517A2:
ldr r1, [r5, 0xC]
adds r0, r4, 0
str r2, [sp, 0xC]
bl GetTileSafe
bl GetTileMut
ldrh r1, [r0]
ldr r2, [sp, 0xC]
ands r1, r2
@ -3306,7 +3306,7 @@ _080517EC:
adds r0, r7, 0
adds r1, r5, 0
str r3, [sp, 0x10]
bl GetTileSafe
bl GetTileMut
adds r2, r0, 0
ldrh r1, [r2]
movs r0, 0x20
@ -3370,7 +3370,7 @@ _08051864:
adds r0, r7, 0
adds r1, r5, 0
str r3, [sp, 0x10]
bl GetTileSafe
bl GetTileMut
adds r6, r0, 0
ldrh r1, [r6]
movs r0, 0x20
@ -3446,7 +3446,7 @@ sub_80518F0:
_080518F8:
adds r0, r5, 0
movs r1, 0x1
bl GetTileSafe
bl GetTileMut
adds r4, r0, 0
bl sub_804FD10
cmp r5, 0
@ -3460,7 +3460,7 @@ _0805190E:
_08051914:
adds r0, r5, 0
movs r1, 0x1E
bl GetTileSafe
bl GetTileMut
adds r4, r0, 0
bl sub_804FD10
cmp r5, 0
@ -3614,7 +3614,7 @@ sub_8051A24:
mov r8, r3
adds r0, r4, 0
adds r1, r5, 0
bl GetTileSafe
bl GetTileMut
adds r7, r0, 0
lsls r4, 16
lsls r5, 16
@ -4067,7 +4067,7 @@ _08051E42:
_08051E46:
adds r0, r4, 0
adds r1, r5, 0
bl GetTileSafe
bl GetTileMut
adds r2, r0, 0
ldrb r0, [r2, 0xE]
cmp r0, 0xF
@ -4107,7 +4107,7 @@ sub_8051E7C:
movs r3, 0x6
ldrsh r1, [r2, r3]
subs r1, 0x1
bl GetTileSafe
bl GetTileMut
str r0, [sp, 0x8]
ldrh r1, [r0]
movs r0, 0x80
@ -4207,7 +4207,7 @@ _08051F10:
bge _08051FCA
adds r0, r5, 0
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
adds r4, r0, 0
ldrh r0, [r4]
movs r3, 0x80

View File

@ -1489,7 +1489,7 @@ sub_80694C0:
mov r9, r3
adds r0, r7, 0
mov r1, r8
bl GetTileSafe
bl GetTileMut
mov r10, r0
ldr r5, [r4, 0x70]
adds r6, r5, 0
@ -1536,7 +1536,7 @@ _08069522:
blt _08069552
adds r1, r0, 0
adds r0, r2, 0
bl GetTileSafe
bl GetTileMut
adds r1, r0, 0
ldr r0, [r1, 0x10]
cmp r0, r4

View File

@ -102,7 +102,7 @@ _0806A488:
movs r2, 0x6
ldrsh r1, [r6, r2]
adds r1, r7
bl GetTileSafe
bl GetTileMut
adds r4, r0, 0
ldr r0, [r4, 0x10]
cmp r0, 0

View File

@ -86,7 +86,7 @@ _0807ABC6:
adds r0, r4, 0
adds r1, r6, 0
str r2, [sp, 0x1A4]
bl GetTileSafe
bl GetTileMut
adds r1, r0, 0
ldr r0, [r1, 0x10]
ldr r2, [sp, 0x1A4]
@ -176,7 +176,7 @@ _0807AC72:
adds r0, r4, 0
adds r1, r6, 0
str r2, [sp, 0x1A4]
bl GetTileSafe
bl GetTileMut
adds r1, r0, 0
ldr r0, [r1, 0x10]
ldr r2, [sp, 0x1A4]

View File

@ -831,7 +831,7 @@ _0807DBB6:
_0807DBB8:
adds r0, r4, 0
adds r1, r5, 0
bl GetTileSafe
bl GetTileMut
adds r2, r0, 0
ldrh r1, [r2]
movs r0, 0x3
@ -971,7 +971,7 @@ _0807DCD8:
movs r6, 0
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
adds r2, r0, 0
ldrh r1, [r2]
ldr r3, _0807DD6C
@ -1094,7 +1094,7 @@ _0807DDC8:
_0807DDCA:
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
adds r2, r0, 0
ldrh r1, [r2]
movs r3, 0x80
@ -1141,7 +1141,7 @@ _0807DE1A:
beq _0807DE30
adds r0, r5, 0
adds r1, r4, 0
bl GetTileSafe
bl GetTileMut
ldrh r2, [r0]
movs r1, 0x40
orrs r1, r2
@ -1402,7 +1402,7 @@ _0807E014:
bgt _0807E112
cmp r1, 0x1F
bgt _0807E112
bl GetTileSafe
bl GetTileMut
mov r8, r0
ldr r0, [sp, 0x18]
movs r2, 0

View File

@ -2468,7 +2468,7 @@ _0807FA1E:
_0807FA22:
adds r0, r5, 0
adds r1, r6, 0
bl GetTileSafe
bl GetTileMut
adds r4, r0, 0
ldrh r1, [r4, 0x4]
movs r0, 0x4

View File

@ -1710,85 +1710,4 @@ _080A236C:
bx r1
thumb_func_end sub_80A14E8
thumb_func_start GroundScript_Unlock
GroundScript_Unlock:
push {r4-r7,lr}
ldr r1, _080A241C
ldrb r0, [r1]
cmp r0, 0
beq _080A2414
movs r0, 0
strb r0, [r1]
movs r6, 0
_080A2390:
ldr r0, _080A2420
adds r7, r6, r0
ldrb r0, [r7]
cmp r0, 0
beq _080A240E
movs r0, 0x1
ldr r1, _080A2424
adds r2, r6, 0
bl Log
lsls r5, r6, 16
asrs r5, 16
adds r0, r5, 0
bl GroundMapNotifyAll
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
adds r0, r5, 0
bl GroundLivesNotifyAll
orrs r4, r0
lsls r4, 24
lsrs r4, 24
adds r0, r5, 0
bl GroundObjectsNotifyAll
orrs r4, r0
lsls r4, 24
lsrs r4, 24
adds r0, r5, 0
bl GroundEffectsNotifyAll
orrs r4, r0
lsls r4, 24
lsrs r4, 24
ldr r0, _080A2428
adds r5, r6, r0
ldrb r0, [r5]
cmp r0, 0
beq _080A240C
cmp r4, 0
beq _080A240E
movs r0, 0x80
adds r4, r6, 0
orrs r4, r0
lsls r4, 16
asrs r4, 16
adds r0, r4, 0
bl GroundMapNotifyAll
adds r0, r4, 0
bl GroundLivesNotifyAll
adds r0, r4, 0
bl GroundObjectsNotifyAll
adds r0, r4, 0
bl GroundEffectsNotifyAll
movs r0, 0
strb r0, [r5]
_080A240C:
strb r0, [r7]
_080A240E:
adds r6, 0x1
cmp r6, 0x80
ble _080A2390
_080A2414:
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_080A241C: .4byte gAnyScriptLocked
_080A2420: .4byte gScriptLocks
_080A2424: .4byte gUnknown_8116848
_080A2428: .4byte gScriptLockConds
thumb_func_end GroundScript_Unlock
.align 2,0

View File

@ -1,6 +1,10 @@
#!/bin/bash
OBJDUMP_BIN="arm-none-eabi-objdump"
if [[ -n "$DEVKITARM" ]]; then
OBJDUMP_BIN="$DEVKITARM/bin/arm-none-eabi-objdump"
else
OBJDUMP_BIN="arm-none-eabi-objdump"
fi
OBJDUMP="$OBJDUMP_BIN -D -bbinary -marmv4t -Mforce-thumb"

View File

@ -522,14 +522,14 @@ gUnknown_80F69A8: @ 80F69A8
.byte 0x69, 0x72, 0x30, 0x00, 0x70, 0x6b, 0x73, 0x64, 0x69, 0x72, 0x30, 0x00, 0x70, 0x6b, 0x73, 0x64
.byte 0x69, 0x72, 0x30, 0x00, 0x70, 0x6b, 0x73, 0x64, 0x69, 0x72, 0x30, 0x00
.global gUnknown_80F69D4
gUnknown_80F69D4: @ 80F69D4
.global gOtherOobTile
gOtherOobTile: @ 80F69D4
@ replacing .incbin "baserom.gba", 0xF69D4, 0x18
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.global gUnknown_80F69EC
gUnknown_80F69EC: @ 80F69EC
.global gWaterOobTile
gWaterOobTile: @ 80F69EC
@ replacing .incbin "baserom.gba", 0xF69EC, 0x18
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

View File

@ -25,7 +25,7 @@ bool8 sub_800E9A8(s32);
void sub_800DAC0(u32);
void sub_800DB7C(void);
void sub_800DBBC(void);
void sub_800E90C(Position *);
void sub_800E8AC(s32 a0, void *a1, void *a2, s32 a3, void *a4); // a2 could be Position
void sub_800E90C(DungeonPos *);
void sub_800E8AC(s32 a0, void *a1, void *a2, s32 a3, void *a4); // a2 could be DungeonPos
#endif // GUARD_CODE_800DAC0_H

View File

@ -3,6 +3,6 @@
#include "structs/str_position.h"
void AddPokemonDungeonSprite(s32 id, s16 species, Position *pos, u32);
void AddPokemonDungeonSprite(s32 id, s16 species, DungeonPos *pos, u32);
#endif // GUARD_CODE_800F958_H

View File

@ -3,6 +3,6 @@
#include "structs/str_position.h"
bool8 sub_803F428(Position *pos);
bool8 sub_803F428(DungeonPos *pos);
#endif // GUARD_CODE_803E724_H

View File

@ -3,8 +3,8 @@
#include "structs/dungeon_entity.h"
Entity *sub_8045684(u8 trapID, Position *pos, u8 c);
Entity *sub_8045708(Position *pos);
Entity *sub_8045684(u8 trapID, DungeonPos *pos, u8 c);
Entity *sub_8045708(DungeonPos *pos);
void sub_80457DC(Entity* ent);
#endif // GUARD_CODE_80227B8_H

View File

@ -14,7 +14,7 @@ struct unkStruct_8069D4C_sub
struct unkStruct_8069D4C
{
s16 id;
Position pos;
DungeonPos pos;
s16 HP;
struct unkStruct_8069D4C_sub offense;
u16 level;

View File

@ -2,7 +2,7 @@
#define CODE_807CD9C_H
void sub_807CD9C(Entity *pokemon, Entity *target, u32 direction);
void sub_807D148(Entity *pokemon, Entity *target, u32 param_3, Position *pos);
void sub_807D148(Entity *pokemon, Entity *target, u32 param_3, DungeonPos *pos);
void sub_807D3CC(Entity *param_1);
#endif /* ifndef CODE_807CD9C_H */

View File

@ -6,7 +6,7 @@
void AIDecideUseItem(Entity *pokemon);
void GetPossibleAIThrownItemDirections(Entity *pokemon, s32 thrownAIFlag, Item *item, bool8 ignoreRollChance);
void GetPossibleAIArcItemTargets(Entity *pokemon, Item *item, Position potentialTargets[], bool8 ignoreRollChance);
void GetPossibleAIArcItemTargets(Entity *pokemon, Item *item, DungeonPos potentialTargets[], bool8 ignoreRollChance);
void TargetThrownItem(Entity *pokemon, Entity *targetPokemon, Item *item, s32 targetingFlags, bool8 ignoreRollChance);
#endif

View File

@ -114,9 +114,9 @@ void sub_808AC3C(void);
void sub_808ACC0(void);
void sub_808AD48(void);
void sub_808ADCC(void);
void sub_808AE54(u8, u8, Position *pos);
void sub_808AEC8(u8, u8, Position *pos);
void sub_808AF3C(u8, u8, Position *pos);
void sub_808AE54(u8, u8, DungeonPos *pos);
void sub_808AEC8(u8, u8, DungeonPos *pos);
void sub_808AF3C(u8, u8, DungeonPos *pos);
void sub_808AFB0(u8);
void sub_808B030(u8);
void sub_808B0B0(u8);

View File

@ -3,15 +3,10 @@
#include "structs/map.h"
typedef struct unkStruct_202F190
{
Tile *unk0[6];
} unkStruct_202F190;
Tile *GetTile(s32 x, s32 y);
Tile *GetTileSafe(s32 x, s32 y);
const Tile *GetTile(s32 x, s32 y);
Tile *GetTileMut(s32 x, s32 y);
void sub_8049ED4(void);
void sub_804AC20(Position *pos);
void sub_804AC20(DungeonPos *pos);
#endif // GUARD_DUNGEON_MAP_ACCESS_H
#endif // GUARD_DUNGEON_MAP_ACCESS_H

View File

@ -28,7 +28,7 @@ void LogMessageByIdWithPopupCheckUser(Entity *pokemon, const u8 *str);
void TryDisplayDungeonLoggableMessage2(Entity *pokemon, const u8 *str);
void TryDisplayDungeonLoggableMessage3(Entity *attacker, Entity *target, const u8 *str);
void TryDisplayDungeonLoggableMessage4(Entity *attacker, Entity *target, const u8 *str);
void TryDisplayDungeonLoggableMessage5(Entity *pokemon, Position *pos, const u8 *str);
void TryDisplayDungeonLoggableMessage5(Entity *pokemon, DungeonPos *pos, const u8 *str);
// As opposed to the above - these always display the string and save it in the message log. False/True stand for an unknown argument. Not sure what the practical difference is between these.
void DisplayDungeonLoggableMessage(Entity *pokemon, const u8 *str);

View File

@ -7,13 +7,13 @@
extern u8 gWalkableTileToCrossableTerrain[8];
u8 GetCrossableTerrain(s16 species);
u8 sub_807034C(s16 id, struct Tile *tile);
u8 sub_80703A0(Entity *pokemon, Position *pos);
u8 sub_807034C(s16 id, const Tile *tile);
u8 sub_80703A0(Entity *pokemon, DungeonPos *pos);
bool8 CanCrossWalls(Entity *pokemon);
bool8 sub_807049C(Entity *pokemon, Position *pos);
bool8 sub_8070564(Entity *pokemon, Position *pos);
bool8 sub_80705F0(Entity *pokemon, Position *pos);
bool8 sub_80706A4(Entity *pokemon, Position *pos);
bool8 sub_807049C(Entity *pokemon, DungeonPos *pos);
bool8 sub_8070564(Entity *pokemon, DungeonPos *pos);
bool8 sub_80705F0(Entity *pokemon, DungeonPos *pos);
bool8 sub_80706A4(Entity *pokemon, DungeonPos *pos);
s32 CalcSpeedStage(Entity *pokemon);
#endif

View File

@ -20,8 +20,8 @@ typedef struct DungeonPokemonSprite
/* 0xC */ u32 status;
/* 0x10 */ u8 visible;
/* 0x11 */ u8 unk11;
/* 0x14 */ Position pos;
/* 0x18 */ Position statusOffsets[2];
/* 0x14 */ DungeonPos pos;
/* 0x18 */ DungeonPos statusOffsets[2];
/* 0x20 */ u32 unk20;
/* 0x24 */ u32 unk24;
/* 0x28 */ DungeonPokemonStatusSprite statusSprites[2];

View File

@ -3,8 +3,8 @@
#include "structs/str_position.h"
bool8 IsPositionActuallyInSight(Position *pos1, Position *pos2);
bool8 IsPositionInSight(Position *pos1, Position *pos2);
bool8 IsTargetTwoTilesAway(Position *pos1, Position *pos2);
bool8 IsPositionActuallyInSight(DungeonPos *pos1, DungeonPos *pos2);
bool8 IsPositionInSight(DungeonPos *pos1, DungeonPos *pos2);
bool8 IsTargetTwoTilesAway(DungeonPos *pos1, DungeonPos *pos2);
#endif

View File

@ -5,14 +5,15 @@
#include "structs/dungeon_entity.h"
#include "structs/str_position.h"
#include "structs/str_traps.h"
#include "structs/map.h"
extern const Position gAdjacentTileOffsets[NUM_DIRECTIONS];
extern const DungeonPos gAdjacentTileOffsets[NUM_DIRECTIONS];
bool8 EntityExists(Entity *pokemon);
u32 GetEntityType(Entity *entity);
u8 GetEntityRoom(Entity *entity);
struct Tile *GetTileAtEntitySafe(Entity *entity);
void sub_804535C(Entity *entity, Position32 *pos);
Tile *GetTileAtEntitySafe(Entity *entity);
void sub_804535C(Entity *entity, PixelPos *pos);
void SetEntityPixelPos(Entity *entity, s32 x, s32 y);
void IncreaseEntityPixelPos(Entity *entity, s32 x, s32 y);
@ -25,4 +26,4 @@ Item *GetItemData_1(Entity *entity);
Trap *GetTrapData(Entity *entity);
Trap* GetTrapData_1(Entity *entity);
#endif // GUARD_DUNGEON_UTIL_H
#endif // GUARD_DUNGEON_UTIL_H

View File

@ -22,7 +22,7 @@ void sub_80856E0(Entity * pokemon, s32 direction);
void sub_8085764(void);
void sub_8085860(s32 x, s32 y);
void sub_8085890(s32 x, s32 y);
void ShiftCameraToPosition(Position32 *posStruct, s32 cameraSteps);
void ShiftCameraToPosition(PixelPos *posStruct, s32 cameraSteps);
void SetFacingDirection(Entity *pokemon, s32 direction);
void sub_8085930(s32 direction);
void sub_80859F0(s32 direction);

View File

@ -6,7 +6,7 @@
bool8 CanSeeTarget(Entity *entity, Entity *targetEntity);
bool8 CanTargetEntity(Entity *entity, Entity *targetEntity);
bool8 sub_8045A70(Entity *entity, Entity *targetEntity);
bool8 sub_8045AAC(Entity *entity, Position *pos);
bool8 CanTargetPosition(Entity *entity, Position *pos);
bool8 sub_8045AAC(Entity *entity, DungeonPos *pos);
bool8 CanTargetPosition(Entity *entity, DungeonPos *pos);
#endif

View File

@ -57,8 +57,8 @@ typedef struct ScriptData
/* 0x2C */ u16 unk2C;
// padding
/* 0x30 */ s32 unk30;
/* 0x34 */ Position32 pos1;
/* 0x3C */ Position32 pos2;
/* 0x34 */ PixelPos pos1;
/* 0x3C */ PixelPos pos2;
/* 0x44 */ u8 unk44[4];
/* 0x48 */ s32 unk48;
/* 0x4C */ u8 unk4C;
@ -78,14 +78,14 @@ typedef struct CallbackData
// padding
// All callbacks take the parentObject as first parameter
/* 0x04 */ s16 (*getIndex)(void*); // id related
/* 0x08 */ void (*getSize)(void*, Position32 *out);
/* 0x0C */ void (*getHitboxCenter)(void*, Position32 *out);
/* 0x08 */ void (*getSize)(void*, PixelPos *out);
/* 0x0C */ void (*getHitboxCenter)(void*, PixelPos *out);
/* 0x10 */ void (*getPosHeightAndUnk)(void*, u32 *height, u32 *unk);
/* 0x14 */ void (*getDirection)(void*, s8 *dir);
/* 0x18 */ void (*getFlags)(void*, u32 *flags);
/* 0x1C */ void (*setHitboxPos)(void*, Position32 *posOrNull);
/* 0x20 */ void (*setPositionBounds)(void*, Position32 *from, Position32 *to);
/* 0x24 */ bool8 (*moveReal)(void*, Position32*);
/* 0x1C */ void (*setHitboxPos)(void*, PixelPos *posOrNull);
/* 0x20 */ void (*setPositionBounds)(void*, PixelPos *from, PixelPos *to);
/* 0x24 */ bool8 (*moveReal)(void*, PixelPos*);
/* 0x28 */ void (*setPosHeight)(void*, u32 height);
/* 0x2C */ void (*setDirection)(void*, s8 dir); // direction must be signed char!
/* 0x30 */ void (*setEventIndex)(void*, u16);
@ -94,7 +94,7 @@ typedef struct CallbackData
/* 0x3C */ void (*setFlags)(void*, u32 bits);
/* 0x40 */ void (*clearFlags)(void*, u32 bits);
/* 0x44 */ void (*func44_livesOnlySpriteRelated)(void*, u32);
/* 0x48 */ void (*moveRelative)(void*, Position32*);
/* 0x48 */ void (*moveRelative)(void*, PixelPos*);
/* 0x4C */ bool8 (*func4C_spriteRelatedCheck)(void*);
/* 0x50 */ bool8 (*func50_spriteRelated)(void*);
} CallbackData;
@ -135,14 +135,8 @@ typedef struct ScriptRef
extern const ScriptRef gFunctionScriptTable[];
struct CompactPos {
u8 xTiles;
u8 yTiles;
u8 xFlags;
u8 yFlags;
};
struct GroundLink {
struct CompactPos pos;
CompactPos pos;
u8 width;
u8 height;
u8 ret;
@ -153,7 +147,7 @@ typedef struct GroundLivesData {
u8 unk1;
u8 width;
u8 height;
struct CompactPos pos;
CompactPos pos;
const ScriptCommand *scripts[4];
} GroundLivesData;
typedef struct GroundObjectData {
@ -161,7 +155,7 @@ typedef struct GroundObjectData {
u8 unk1;
u8 width;
u8 height;
struct CompactPos pos;
CompactPos pos;
const ScriptCommand *scripts[4];
} GroundObjectData;
typedef struct GroundEffectData {
@ -169,7 +163,7 @@ typedef struct GroundEffectData {
u8 unk1;
u8 width;
u8 height;
struct CompactPos pos;
CompactPos pos;
const ScriptCommand *script;
} GroundEffectData;
typedef struct GroundEventData {
@ -177,7 +171,7 @@ typedef struct GroundEventData {
u8 unk1;
u8 width;
u8 height;
struct CompactPos pos;
CompactPos pos;
const ScriptRef *script;
} GroundEventData;

View File

@ -4,20 +4,6 @@
#include "gba/types.h"
#include "number_util.h"
/**
* This type represents a signed 24.8 fixed-point number, where the 24 most
* significant bits are the integer part and the 8 least significant bits are
* the fractional part.
*/
typedef s32 s24_8;
/**
* This type represents an unsigned 24.8 fixed-point number, where the 24 most
* significant bits are the integer part and the 8 least significant bits are
* the fractional part.
*/
typedef u32 u24_8;
/**
* This function computes the cosine of of `x` using a lookup table. The period of
* the function is `4096`, and the range is `[-256, 256]`.
@ -50,16 +36,50 @@ s32 sin_4096(s32 x);
*/
s24_8 s24_8_mul(s24_8 x, s24_8 y);
bool8 F48_16_IsZero(unkStruct_80943A8 *a);
void F48_16_SDiv(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_80943A8 *b);
void F48_16_SMul(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_80943A8 *b);
bool8 F48_16_IsZero(s48_16 *a);
void F48_16_SDiv(s48_16 *dst, s48_16 *a, s48_16 *b);
void F48_16_SMul(s48_16 *dst, s48_16 *a, s48_16 *b);
s32 sub_8009FB8(s32 x, s32 y);
void sub_800A020(unkStruct_80943A8 *dst, u32);
u32 sub_800A048(unkStruct_80943A8 *a);
void sub_800A088(unkStruct_80943A8 *a, s32 b);
bool8 sub_800A2F0(unkStruct_80943A8 *a, unkStruct_80943A8 *b);
void sub_800A6D0(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_80943A8 *b);
void sub_800A6F0(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_80943A8 *b);
s24_8 FP24_8_Hypot(s24_8 x, s24_8 y);
void FP48_16_FromS32(s48_16 *dst, s32 src);
u32 FP48_16_ToS32(s48_16 *a);
void FP48_16_FromF248(s48_16 *a, s24_8 b);
bool8 FP48_16_SLessThan(s48_16 *a, s48_16 *b);
void FP48_16_Add(s48_16 *dst, s48_16 *a, s48_16 *b);
void FP48_16_Subtract(s48_16 *dst, s48_16 *a, s48_16 *b);
//static inline bool8 F248Equal(s24_8 x, s24_8 y) {
// return x.raw == y.raw;
//}
#define F248LessThanInt(x, y) (x.raw < 0x100 * y)
#define F248LessThanFloat(x, y) (x.raw < (int)(y * 0x100))
#define FloatLessThanF248(x, y) ((int)(x * 0x100) < y.raw)
//static inline bool8 F248LessThanOne(s24_8 x) {
// return x.raw < 0x100;
//}
#define F248LessThan(x, y) (x.raw < y.raw)
#define F248GreaterThan(x, y) (x.raw > y.raw)
#define F248Equal(x, y) (x.raw == y.raw)
#define F248EqualsInt(x, y) (x.raw == 0x100 * y)
//static inline bool8 F248LessThan(s24_8 x, s24_8 y) {
// return x.raw < y.raw;
//}
#define F248_AddInt(x, y) ((s24_8){x.raw + 0x100 * y})
#define F248_SubInt(x, y) ((s24_8){x.raw - 0x100 * y})
static inline s24_8 F248_Add(s24_8 x, s24_8 y) {
return (s24_8){x.raw + y.raw};
}
static inline s24_8 F248_Sub(s24_8 x, s24_8 y) {
return (s24_8){x.raw - y.raw};
}
static inline s24_8 F248_MulInt(s24_8 x, s32 y) {
return (s24_8){x.raw * y};
}
#endif // GUARD_MATH_H

View File

@ -1,17 +1,44 @@
#ifndef GUARD_NUMBER_UTIL_H
#define GUARD_NUMBER_UTIL_H
/**
* This type represents a decimal, signed fixed-point number, where the first
* 16-bit field is the integer part and the second 16-bit field is the fraction,
* expressed in thousandths.
*/
typedef struct FixedPoint
{
s16 unk0;
s16 unk2;
} FixedPoint;
typedef struct unkStruct_80943A8
/**
* This type represents a signed 24.8 fixed-point number, where the 24 most
* significant bits are the integer part and the 8 least significant bits are
* the fractional part.
*/
typedef struct s24_8 {
// It's almost certainly not an actual struct, but keep it as one until we decomp all structures that include it
s32 raw;
} s24_8;
#define F248_ZERO ((s24_8){})
#define F248_ONE ((s24_8){0x100})
#define F248_MAX ((s24_8){0x7FFFFFFF})
/**
* This type represents a signed 48.16 fixed-point number, where the 48 most
* significant bits are the integer part and the 16 least significant bits are
* the fractional part.
*/
typedef struct s48_16
{
s32 s0;
u32 s4; // some math.c funcs require this to be a u32, but other funcs check if it's negative (aka >= INT32_MAX)
} unkStruct_80943A8;
s32 hi;
u32 lo; // some math.c funcs require this to be a u32, but other funcs check if it's negative (aka >= INT32_MAX)
} s48_16;
#define F4816_ZERO ((s48_16){})
#define F4816_ONE ((s48_16){0, 0x10000})
#define F4816_MAX ((s48_16){0x7FFFFFFF, 0xFFFFFFFF})
FixedPoint FixedPoint_Add(FixedPoint a, FixedPoint b);
FixedPoint FixedPoint_Subtract(FixedPoint a, FixedPoint b);
@ -19,8 +46,23 @@ FixedPoint FixedPoint_Min(FixedPoint a, FixedPoint b);
FixedPoint FixedPoint_Max(FixedPoint a, FixedPoint b);
FixedPoint sub_8094370(FixedPoint param_1, FixedPoint param_2);
FixedPoint IntToFixedPoint(s32 a);
FixedPoint FixedPoint_SetFromUnk(unkStruct_80943A8* param_1);
FixedPoint FixedPoint_SetFromUnk(s48_16* param_1);
FixedPoint FixedPoint_Div(FixedPoint a, FixedPoint b);
s32 FixedPointToInt(FixedPoint a); // Always rounded up
#endif
#define IntToF248_2(x) ((s24_8){x * 0x100})
#define FloatToF248_2(x) ((s24_8){(int)(x * 0x100)})
static inline s24_8 IntToF248(s32 x) {
return (s24_8){x * 256};
}
static inline s24_8 FloatToF248(float x) {
return (s24_8){(int)(x * 256)};
}
static inline s32 F248ToInt(s24_8 x) {
return x.raw / 256;
}
#endif

View File

@ -3,7 +3,7 @@
#include "structs/str_position.h"
s32 GetDirectionTowardsPosition(Position *originPos, Position *targetPos);
s32 GetDistance(Position *pos1, Position *pos2);
s32 GetDirectionTowardsPosition(DungeonPos *originPos, DungeonPos *targetPos);
s32 GetDistance(DungeonPos *pos1, DungeonPos *pos2);
#endif

View File

@ -34,7 +34,7 @@ void BlinkSavingIcon(void);
void CopySpritesToOam(void);
void InitSprites(void);
void ResetSprites(bool8);
void SetSavingIconCoords(Position *);
void SetSavingIconCoords(DungeonPos *);
void sub_8004E8C(unkStruct_2039DB0 *);
void sub_8005180(void);
void sub_8005304(void);

View File

@ -2,6 +2,7 @@
#define GUARD_STATUS_H
#include "structs/dungeon_entity.h"
#include "number_util.h"
#define FLASH_FIRE_STATUS_NONE 0
#define FLASH_FIRE_STATUS_MAXED 1
@ -9,8 +10,8 @@
u8 GetFlashFireStatus(Entity *pokemon);
void UpdateFlashFireBoost(Entity * pokemon, Entity *target);
void ChangeAttackMultiplierTarget(Entity *pokemon, Entity *target, u32 statStage, s32 param_4, bool8 displayMessage);
void ChangeDefenseMultiplierTarget(Entity *pokemon, Entity *target, u32 statStage, s32 param_4, bool8 displayMessage);
void ChangeAttackMultiplierTarget(Entity *pokemon, Entity *target, u32 statStage, s24_8 param_4, bool8 displayMessage);
void ChangeDefenseMultiplierTarget(Entity *pokemon, Entity *target, u32 statStage, s24_8 param_4, bool8 displayMessage);
void RaiseAccuracyStageTarget(Entity * pokemon, Entity * target, s32 statStage);
void LowerAccuracyStageTarget(Entity * pokemon, Entity * target, s32 statStage, bool8 displayMessage);
void CringeStatusTarget(Entity * pokemon,Entity * target, bool8 displayMessage);

View File

@ -33,7 +33,7 @@ struct MonPortraitMsg
{
OpenedFile *faceFile;
struct PortraitGfx *faceData;
Position pos;
DungeonPos pos;
u8 spriteId; // Which mon's sprite to use. For example Kecleon has multiple sprites depending on whether it's green or purple.
bool8 flip; // Whether the mon's sprite is flipped.
u8 unkE;

View File

@ -14,9 +14,9 @@ typedef struct UnkSpriteMem
// size: 0x20
typedef struct axdata1
{
/* 0x0 */ Position pos;
/* 0x4 */ Position offset;
/* 0x8 */ Position shadow;
/* 0x0 */ DungeonPos pos;
/* 0x4 */ DungeonPos offset;
/* 0x8 */ DungeonPos shadow;
u32 unkC;
u32 unk10;
/* 0x14 */ s16 vramTileOrMaybeAnimTimer;
@ -43,8 +43,8 @@ typedef struct ax_anim
/* 0x0 */ u8 frames;
/* 0x1 */ u8 unkFlags;
/* 0x2 */ s16 poseId;
/* 0x4 */ Position offset;
/* 0x8 */ Position shadow;
/* 0x4 */ DungeonPos offset;
/* 0x8 */ DungeonPos shadow;
} ax_anim;
// size: 0x3C

View File

@ -13,9 +13,8 @@
#include "sprite.h"
#define MAX_STAT_STAGE 20
#define STAT_MULTIPLIER_THRESHOLD 63
#define STAT_MULTIPLIER_THRESHOLD 0.249 // one tick less than 0.25
#define DEFAULT_STAT_STAGE 10
#define DEFAULT_STAT_MULTIPLIER 256
#define MAX_SPEED_STAGE 4
#define MAX_STOCKPILE_STAGE 3
#define NUM_SPEED_COUNTERS 5
@ -34,7 +33,7 @@
typedef struct unkStruct_8044CC8
{
/* 0x0 */ u8 actionUseIndex;
/* 0x4 */ Position lastItemThrowPosition;
/* 0x4 */ DungeonPos lastItemThrowPosition;
} unkStruct_8044CC8;
// size: 0x18
@ -46,7 +45,7 @@ typedef struct ActionContainer
// Additional parameter alongside actionIndex. Used for things like indicating which move a Pokémon should use from its moveset.
/* 0x4 */ unkStruct_8044CC8 unk4[2];
// Position of the target that the Pokémon wants throw an item at.
/* 0x14 */ Position itemTargetPosition;
/* 0x14 */ DungeonPos itemTargetPosition;
} ActionContainer;
// size: 0x4
@ -73,7 +72,7 @@ typedef struct AITarget
/* 0x4 */ u16 aiTargetSpawnGenID;
/* 0x8 */ struct Entity *aiTarget;
/* 0xC */ u32 unkC;
/* 0x10 */ Position aiTargetPos;
/* 0x10 */ DungeonPos aiTargetPos;
} AITarget;
// size: 0x4
@ -180,11 +179,11 @@ typedef struct Muzzled
// size: 0x1C
typedef struct Unk_Entity_x184
{
/* 0x184 - 0x0 */ Position previousTargetMovePosition1;
/* 0x188 - 0x4 */ Position32 previousTargetMovePosition2;
/* 0x184 - 0x0 */ DungeonPos previousTargetMovePosition1;
/* 0x188 - 0x4 */ PixelPos previousTargetMovePosition2;
/* 0x190 - 0xC */ s32 lastMoveDirection; // The last direction that the Pokémon moved in.
// Number of tiles that the Pokémon moved last, multiplied by 0x100.
/* 0x194 - 0x10*/ Position32 lastMoveIncrement;
/* 0x194 - 0x10*/ PixelPos lastMoveIncrement;
/* 0x19C - 0x18 */ s16 walkAnimFramesLeft; // Set when the Pokémon starts moving, and counts down until the Pokémon's walk animation stops.
/* 0x19e - 0x1a */ u8 unk1A;
} Unk_Entity_x184;
@ -242,7 +241,7 @@ typedef struct EntityInfo
/* 0x5E */ u8 abilities[2];
/* 0x60 */ Item heldItem;
/* 0x64 */ u8 unk64;
/* 0x68 */ Position prevPos[NUM_PREV_POS];
/* 0x68 */ DungeonPos prevPos[NUM_PREV_POS];
/* 0x78 */ AITarget aiTarget;
// Bitwise flags corresponding to selected IQ skills.
/* 0x8C */ u8 IQSkillMenuFlags[NUM_PICKED_IQ_SKILLS]; // IQ skills selected in the IQ skills menu.
@ -337,8 +336,8 @@ typedef struct EntityInfo
/* 0x167 */ u8 unk167;
/* 0x168 */ u8 unk168;
/* 0x169 */ u8 turnsSinceWarpScarfActivation;
/* 0x16C */ Position targetPos;
/* 0x170 */ Position pixelPos;
/* 0x16C */ DungeonPos targetPos;
/* 0x170 */ DungeonPos pixelPos;
s24_8 unk174;
u16 abilityEffectFlags; // See enum AbilityEffectFlags
/* 0x17A */ u16 mimicMoveIDs[MAX_MON_MOVES]; // All moves that Mimic has copied (not sure on size...)
@ -357,12 +356,12 @@ typedef struct EntityInfo
typedef struct Entity
{
/* 0x0 */ u32 type;
/* 0x4 */ Position pos;
/* 0x8 */ Position prevPos;
/* 0x4 */ DungeonPos pos;
/* 0x8 */ DungeonPos prevPos;
// The center of the entity acccording to pixel-space coordinates, using the same origin as posWorld.
// X = (posWorld * 24 + 16) * 256, while Y = (posWorld * 24 + 12) * 256.
/* 0xC */ Position32 pixelPos;
/* 0x14 */ Position32 prevPixelPos;
/* 0xC */ PixelPos pixelPos;
/* 0x14 */ PixelPos prevPixelPos;
s32 unk1C;
/* 0x20 */ bool8 isVisible; // Turned off when a Pokémon faints.
u8 fill21;

View File

@ -56,7 +56,7 @@ typedef struct RoomData
u8 unk0;
u8 unk1;
// All coordinates are inclusive.
// These are not aligned properly to use the Position struct.
// These are not aligned properly to use the DungeonPos struct.
/* 0x2 */ s16 bottomRightCornerX;
/* 0x4 */ s16 bottomRightCornerY;
/* 0x6 */ s16 topLeftCornerX;

View File

@ -25,11 +25,11 @@ typedef struct MenuInputStruct
s32 unk0;
u16 unk4;
s16 unk6;
Position unk8; // Maybe Position
s16 unkC; // Maybe Position
DungeonPos unk8; // Maybe DungeonPos
s16 unkC; // Maybe DungeonPos
s16 unkE;
u32 unk10;
Position unk14; // Maybe Position
DungeonPos unk14; // Maybe DungeonPos
/* 0x18 */ s16 menuIndex;
s16 unk1A;
s16 unk1C;

View File

@ -77,10 +77,10 @@ typedef struct DungeonMusicPlayer
// Size unknown?
typedef struct UnkDungeonGlobal_unk181E8_sub
{
/* 0x181E8 */ Position cameraPos; // x0
/* 0x181EC */ Position cameraPosMirror; // x4
/* 0x181F0 */ Position cameraPixelPos; // x8
/* 0x181F4 */ Position cameraPixelPosMirror; // xC
/* 0x181E8 */ DungeonPos cameraPos; // x0
/* 0x181EC */ DungeonPos cameraPosMirror; // x4
/* 0x181F0 */ DungeonPos cameraPixelPos; // x8
/* 0x181F4 */ DungeonPos cameraPixelPosMirror; // xC
/* 0x181F8 */ Entity *cameraTarget; // x10
u32 unk181FC; // x14
u32 unk18200; // x18
@ -170,7 +170,7 @@ struct unkStruct_Dungeon134_sub
u32 unk150;
u32 unk154;
u32 unk158;
u32 unk15C;
s24_8 unk15C;
u8 unk160;
u8 unk161;
u8 unk162;
@ -370,9 +370,9 @@ typedef struct Dungeon
/* 0x3A14 */ s16 bossBattleIndex;
/* 0x3A16 */ s16 unk3A16;
/* 0x3A18 */ Tile tiles[DUNGEON_MAX_SIZE_Y][DUNGEON_MAX_SIZE_X];
Position unkE218;
Position unkE21C; // stair location?
Position unkE220[8];
DungeonPos unkE218;
DungeonPos unkE21C; // stair location?
DungeonPos unkE220[8];
unkDungeonE240 unkE240;
unkDungeonE240 unkE250;
unkDungeonE260 unkE260;
@ -384,7 +384,7 @@ typedef struct Dungeon
u8 unk104C0;
/* 0x104C4 */ RoomData roomData[MAX_ROOM_COUNT];
/* 0x10844 */ s16 naturalJunctionListCounts[MAX_ROOM_COUNT];
/* 0x10884 */ Position naturalJunctionList[MAX_ROOM_COUNT][MAX_ROOM_COUNT]; // Arrays of room exits for each room.
/* 0x10884 */ DungeonPos naturalJunctionList[MAX_ROOM_COUNT][MAX_ROOM_COUNT]; // Arrays of room exits for each room.
u16 unk11884[250][9];
u16 unk12A18[20][9];
u16 unk12B80[9];
@ -398,7 +398,7 @@ typedef struct Dungeon
u8 fill1356D[0x13570 - 0x1356D];
/* 0x13570 */ u8 unk13570;
u8 fill13571[0x13574 - 0x13571];
/* 0x13574 */ Position trapPos;
/* 0x13574 */ DungeonPos trapPos;
/* 0x13578 */ u8 trapID;
/* 0x13579 */ u8 unk13579;
u8 fill1357A[0x1357C - 0x1357A];

View File

@ -2,17 +2,34 @@
#define GUARD_STR_POSITION_H
// size: 0x4
typedef struct Position
typedef struct DungeonPos
{
/* 0x0 */ s16 x;
/* 0x2 */ s16 y;
} Position;
} DungeonPos;
/**
* Precise position expressed in pixel units, as s24_8 fixpoint.
* This type has subpixel precision to 1/256th of a pixel.
*/
// size: 0x8
typedef struct Position32
typedef struct PixelPos
{
/* 0x0 */ s32 x;
/* 0x0 */ s32 x; // TODO: convert to s24_8 across the codebase
/* 0x4 */ s32 y;
} Position32;
} PixelPos;
#endif // GUARD_STR_POSITION_H
/**
* Currently only used in script data, for entities and GroundLink data.
* DungeonPos expressed in terms of *graphics* tiles, 8 pixels per unit.
* Flags allow expressing half-tile offsets and allow using a current/default coordinate.
*/
// size: 0x4
typedef struct CompactPos {
u8 xTiles;
u8 yTiles;
u8 xFlags;
u8 yFlags;
} CompactPos;
#endif // GUARD_STR_POSITION_H

View File

@ -9,7 +9,7 @@
extern const u8 gDungeonWaterType[76];
void sub_804AE84(Position *pos);
void sub_804AE84(DungeonPos *pos);
bool8 IsTileGround(Tile *tile);
bool8 IsWaterTileset();

View File

@ -5,17 +5,17 @@
#include "structs/map.h"
#include "structs/str_position.h"
bool8 CanLayTrap(Position *pos);
bool8 LayTrap(Position *pos, u8 trapID, u8 param_3);
bool8 CanLayTrap(DungeonPos *pos);
bool8 LayTrap(DungeonPos *pos, u8 trapID, u8 param_3);
bool8 sub_807FD84(Entity *entity);
bool8 sub_807FE04(Position *pos, char param_2);
bool8 sub_807FE44(Position *pos, char param_2);
bool8 sub_807FE04(DungeonPos *pos, char param_2);
bool8 sub_807FE44(DungeonPos *pos, char param_2);
void GetTrapName(u8 *buffer, u8 trapIndex);
void sub_807FE9C(Entity *pokemon, Position *pos, int param_3, char param_4);
void sub_807FE9C(Entity *pokemon, DungeonPos *pos, int param_3, char param_4);
void HandleMudTrap(Entity *pokemon, Entity *target);
void HandleStickyTrap(Entity *pokemon, Entity *target);
void HandleGrimyTrap(Entity *pokemon, Entity *target);
void HandleSummonTrap(Entity *pokemon, Position *pos);
void HandleSummonTrap(Entity *pokemon, DungeonPos *pos);
void HandlePitfallTrap(Entity *pokemon,Entity *target,Tile *tile);
void HandleWarpTrap(Entity *pokemon, Entity *target);
void HandleSpinTrap(Entity *pokemon, Entity *target);
@ -30,7 +30,7 @@ void HandleWonderTile(Entity *pokemon, Entity *target);
// code_807FCD4.s
extern void HandleSealTrap(Entity *pokemon, Entity *target);
extern void HandleWhirlwindTrap(Entity *entity, Entity *target);
extern void HandlePokemonTrap(Entity *pokemon, Position *pos);
extern void HandlePokemonTrap(Entity *pokemon, DungeonPos *pos);
// trap_1.c
void HandleTripTrap(Entity *pokemon, Entity *target);

View File

@ -84,11 +84,11 @@ const RGB *sub_8005674(struct axMapSprite *a0, s32 vramIdx)
return a0->pal;
}
void sub_800569C(Position *a0, struct axObject *a1, u8 a2)
void sub_800569C(DungeonPos *a0, struct axObject *a1, u8 a2)
{
Position *ptr;
Position *ptr2;
Position *ptr3;
DungeonPos *ptr;
DungeonPos *ptr2;
DungeonPos *ptr3;
a0->x = 0;
a0->y = 0;
@ -97,7 +97,7 @@ void sub_800569C(Position *a0, struct axObject *a1, u8 a2)
return;
if (a1->axdata.paletteData != NULL) {
ptr = &((Position*)a1->axdata.paletteData)[a1->axdata.sub1.poseId * 4];
ptr = &((DungeonPos*)a1->axdata.paletteData)[a1->axdata.sub1.poseId * 4];
ptr2 = &ptr[a2];
if (*&ptr2->x == 99 && *&ptr2->y == 99) {
a0->x = 99;
@ -115,16 +115,16 @@ void sub_800569C(Position *a0, struct axObject *a1, u8 a2)
}
}
void sub_8005700(Position *a0, struct axObject *a1)
void sub_8005700(DungeonPos *a0, struct axObject *a1)
{
s32 i;
Position *ptr;
DungeonPos *ptr;
if (!(a1->axdata.flags >> 15))
return;
if (a1->axdata.paletteData != NULL) {
ptr = &((Position*)a1->axdata.paletteData)[a1->axdata.sub1.poseId * 4];
ptr = &((DungeonPos*)a1->axdata.paletteData)[a1->axdata.sub1.poseId * 4];
for (i = 0; i < 4; i++) {
if (*&ptr[i].x == 99 && *&ptr[i].y == 99) {
a0->x = 99;
@ -159,7 +159,7 @@ void sub_8005770(s32 param_1, const RGB *color, s32 brightness, const RGB *ramp)
SetBGPaletteBufferColorRGB((param_1 + 0x10) * 0x10 + i, &color[i], brightness, ramp);
}
// Maybe Position
// Maybe DungeonPos
void nullsub_7(s16 *a0)
{}

View File

@ -6,13 +6,12 @@
extern DungeonPokemonSprite *NewDungeonPokemonSprite(void);
extern DungeonPokemonSprite* GetDungeonPokemonSprite(s32 id);
extern Position gUnknown_80D3564;
extern DungeonPos gUnknown_80D3564;
void AddPokemonDungeonSprite(s32 id, s16 species, Position *pos, u32 r3)
{
void AddPokemonDungeonSprite(s32 id, s16 species, DungeonPos *pos, u32 r3) {
DungeonPokemonSprite *dSprite;
DungeonPokemonSprite *newSprite;
Position newPos;
DungeonPos newPos;
s32 species_s32;
species_s32 = species;
@ -57,7 +56,8 @@ void DeletePokemonDungeonSprite(s32 id)
MemoryClear8((u8 *)dSprite, sizeof(DungeonPokemonSprite));
}
void sub_800F958(s32 dungeonSpriteID, Position *pos, Position *statusOffsets, u32 a3)
void sub_800F958(s32 dungeonSpriteID, DungeonPos *pos,
DungeonPos *statusOffsets, u32 a3)
{
DungeonPokemonSprite *dSprite;

View File

@ -38,7 +38,7 @@ void sub_800E90C();
void sub_8042E5C();
void sub_8040B60();
void sub_8040788();
void sub_800F7D0(Position *);
void sub_800F7D0(DungeonPos *);
void sub_803E874(s32, s32);
void sub_803EAF0(s32, s32);

View File

@ -899,7 +899,7 @@ void sub_803F38C(void)
nullsub_5(0xFF, &gFontPalette[palId].pal[15]);
}
bool8 sub_803F428(Position *pos)
bool8 sub_803F428(DungeonPos *pos)
{
UnkDungeonGlobal_unk181E8_sub *strPtr = &gDungeon->unk181e8;
Entity *cameraEntity = strPtr->cameraTarget;
@ -1081,7 +1081,7 @@ void sub_803F580(u8 a0)
void sub_803F7BC(void)
{
UnkDungeonGlobal_unk181E8_sub *strPtr = &gDungeon->unk181e8;
Tile *tile = GetTile(strPtr->cameraPos.x, strPtr->cameraPos.y);
const Tile *tile = GetTile(strPtr->cameraPos.x, strPtr->cameraPos.y);
u32 roomId = tile->room;
if (strPtr->unk1820B != 0 || strPtr->unk1820C != 0 || strPtr->unk18217 != 0) {

View File

@ -26,7 +26,7 @@ extern const char *gUnknown_80FD040; // It became brighter on the floor
// Luminous Orb???
void HandleLuminousOrbAction(Entity *pokemon)
{
struct Tile *mapTile;
Tile *mapTile;
int XCoord;
int YCoord;
@ -36,7 +36,7 @@ void HandleLuminousOrbAction(Entity *pokemon)
{
for(XCoord = 0; XCoord < DUNGEON_MAX_SIZE_X; XCoord++)
{
mapTile = GetTileSafe(XCoord, YCoord);
mapTile = GetTileMut(XCoord, YCoord);
mapTile->unk4 = mapTile->unk4 | 1;
}
}

View File

@ -1,4 +1,5 @@
#include "global.h"
#include "math.h"
#include "code_800E9A8.h"
#include "code_803E46C.h"
#include "code_803E724.h"
@ -50,18 +51,18 @@ extern void sub_800EE5C(u32);
extern void sub_800EF64(void);
u32 sub_8041764(unkStruct_80416E0 *param_1, bool8 param_2);
s32 sub_80416E0(Position32 *pos, u32 param_2, bool8 param_3);
s32 sub_80416E0(PixelPos *pos, u32 param_2, bool8 param_3);
s32 sub_80416A4(Position *pos_1, u32 param_2, bool8 param_3)
s32 sub_80416A4(DungeonPos *pos_1, u32 param_2, bool8 param_3)
{
Position32 pos;
PixelPos pos;
pos.x = pos_1->x * 0x1800 + 0xc00;
pos.y = pos_1->y * 0x1800 + 0x1000;
return sub_80416E0(&pos, param_2, param_3);
}
s32 sub_80416E0(Position32 *pos, u32 param_2, bool8 param_3)
s32 sub_80416E0(PixelPos *pos, u32 param_2, bool8 param_3)
{
int counter;
s32 ret;
@ -223,10 +224,10 @@ void EntityUpdateStatusSprites(Entity *entity)
if ((gDungeon->unk644.itemHoldersIdentified) && (entityInfo->heldItem.flags & ITEM_FLAG_EXISTS)) {
spriteStatus = spriteStatus | STATUS_SPRITE_LOWHP;
}
if ( (entityInfo->offensiveMultipliers[0] < DEFAULT_STAT_MULTIPLIER) ||
(entityInfo->offensiveMultipliers[1] < DEFAULT_STAT_MULTIPLIER) ||
(entityInfo->defensiveMultipliers[0] < DEFAULT_STAT_MULTIPLIER) ||
(entityInfo->defensiveMultipliers[1] < DEFAULT_STAT_MULTIPLIER) ||
if ((F248LessThanInt(entityInfo->offensiveMultipliers[0], 1)) ||
(F248LessThanInt(entityInfo->offensiveMultipliers[1], 1)) ||
(F248LessThanInt(entityInfo->defensiveMultipliers[0], 1)) ||
(F248LessThanInt(entityInfo->defensiveMultipliers[1], 1)) ||
(entityInfo->offensiveStages[0] < DEFAULT_STAT_STAGE) ||
(entityInfo->offensiveStages[1] < DEFAULT_STAT_STAGE) ||
(entityInfo->defensiveStages[0] < DEFAULT_STAT_STAGE) ||
@ -849,7 +850,7 @@ void sub_804218C(Entity *pokemon, Entity *target)
sub_804151C(target, 0x2A, 1);
}
void sub_804219C(Position32 *pos)
void sub_804219C(PixelPos *pos)
{
sub_80416E0(pos, 0x90, TRUE);
}
@ -867,7 +868,7 @@ void sub_80421C0(Entity *pokemon, u16 r1)
PlaySoundEffect(r1);
}
void sub_80421EC(Position *pos, u16 r1)
void sub_80421EC(DungeonPos *pos, u16 r1)
{
if(sub_803F428(pos))
PlaySoundEffect(r1);

View File

@ -23,7 +23,7 @@ extern const u8 *gPtrFeralFoundItemMessage[];
extern void sub_8040238(void);
extern void sub_804151C(Entity *pokemon, u32 r1, u8 r2);
extern void sub_804178C(u32);
extern void sub_80416A4(Position *r0, u32 r1, bool8 r2);
extern void sub_80416A4(DungeonPos *r0, u32 r1, bool8 r2);
extern void sub_80429A0(Entity *);
extern void sub_8042B34(u32, u32, u32);
extern bool8 sub_8042CC0(void);
@ -236,13 +236,13 @@ void sub_80429E8(Entity *r0)
sub_804151C(r0, 0x11d, 1);
}
void sub_80429FC(Position *r0)
void sub_80429FC(DungeonPos *r0)
{
sub_80416A4(r0, 0x19E, TRUE);
sub_80421C0(NULL, 0xD4);
}
void sub_8042A14(Position *r0)
void sub_8042A14(DungeonPos *r0)
{
sub_80416A4(r0, 0x36, TRUE);
}
@ -252,7 +252,7 @@ void sub_8042A24(Entity *r0)
sub_804151C(r0, 0x15, 1);
}
void sub_8042A34(Position *r0)
void sub_8042A34(DungeonPos *r0)
{
sub_80416A4(r0, 0x13E, FALSE);
}
@ -262,12 +262,12 @@ void sub_8042A44(Entity *r0)
sub_804151C(r0, 0xDA << 1, 1);
}
void sub_8042A54(Position *r0)
void sub_8042A54(DungeonPos *r0)
{
sub_80416A4(r0, 0x37, TRUE);
}
void sub_8042A64(Position *r0)
void sub_8042A64(DungeonPos *r0)
{
sub_80416A4(r0, 0x29, TRUE);
}

View File

@ -41,7 +41,7 @@ extern void sub_800EE5C(s32);
extern void sub_800EF64(void);
extern void sub_800F15C(s32);
struct Sub_UnkStruct_203B414 // Maybe Position?
struct Sub_UnkStruct_203B414 // Maybe DungeonPos?
{
s16 a0;
s16 a2;
@ -218,8 +218,9 @@ void sub_8042E98(void)
}
}
extern void sub_800569C(Position *, axdata *, u8);
extern void sub_800EB24(s32 param_1, Position *param_2, Position *param_3, s32 param_4, s32 param_5);
extern void sub_800569C(DungeonPos *, axdata *, u8);
extern void sub_800EB24(s32 param_1, DungeonPos *param_2, DungeonPos *param_3,
s32 param_4, s32 param_5);
void sub_8042EC8(Entity *a0, s32 a1)
{
@ -228,8 +229,8 @@ void sub_8042EC8(Entity *a0, s32 a1)
for (i = 0; i < 3; i++) {
struct unkStruct_Dungeon5C4_sub *strPtr = &gDungeon->unk5C4[i];
if (strPtr->unk0 >= 0 && strPtr->unkC == a0) {
Position sp8 = {a0->pixelPos.x / 256, a0->pixelPos.y / 256};
Position sp4 = {0};
DungeonPos sp8 = {a0->pixelPos.x / 256, a0->pixelPos.y / 256};
DungeonPos sp4 = {0};
EntityInfo *entInfo = GetEntInfo(a0);
if (strPtr->unk8 != -1) {
@ -244,7 +245,7 @@ void sub_8042EC8(Entity *a0, s32 a1)
}
extern u8 gUnknown_203B40C;
extern Position gUnknown_203B410;
extern DungeonPos gUnknown_203B410;
extern u8 *gSerializedData_203B41C;
struct Substruct_xxx_dungeon_8042F6C
@ -1054,7 +1055,7 @@ void sub_8043D60(void)
for (y = 0; y < 32; y++) {
for (x = 0; x < 56; x++) {
Entity *object = GetTileSafe(x, y)->object;
Entity *object = GetTileMut(x, y)->object;
if (EntityExists(object) && GetEntityType(object) == ENTITY_TRAP) {
Trap *trapData = GetTrapData(object);
if (trapData->id == 27) {

View File

@ -36,12 +36,12 @@ extern u8 *gUnknown_80F91EC[];
extern u8 sub_8043D10(void);
extern bool8 sub_8045888(Entity *);
void sub_80460F8(Position *, Item *, u32);
bool8 sub_80461C8(Position *, u32);
void sub_80460F8(DungeonPos *, Item *, u32);
bool8 sub_80461C8(DungeonPos *, u32);
Item * sub_8044CC8(Entity *param_1, unkStruct_8044CC8 *param_2)
{
Tile *tile;
const Tile *tile;
Item *item;
EntityInfo *info;
@ -134,7 +134,7 @@ void sub_8044E24(Entity *entity,int index,u32 unused)
{
Item *itemPtr;
EntityInfo *info;
Position *pos;
DungeonPos *pos;
Item item;
itemPtr = sub_8044D90(entity,index,unused);
@ -282,4 +282,4 @@ void sub_8045064(void)
}
}
}
}
}

View File

@ -524,7 +524,7 @@ Entity *sub_804550C(s16 a)
);
}
Entity *sub_8045684(u8 trapID, Position *pos, u8 c)
Entity *sub_8045684(u8 trapID, DungeonPos *pos, u8 c)
{
Entity *entity;
s32 i;
@ -548,13 +548,13 @@ Entity *sub_8045684(u8 trapID, Position *pos, u8 c)
return NULL;
}
Entity *sub_8045708(Position *pos)
Entity *sub_8045708(DungeonPos *pos)
{
s32 i;
Entity *ent;
if (gDungeonWaterType[gDungeon->tileset] == DUNGEON_WATER_TYPE_LAVA
&& (GetTileSafe(pos->x, pos->y)->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) == TERRAIN_TYPE_SECONDARY) {
&& (GetTileMut(pos->x, pos->y)->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) == TERRAIN_TYPE_SECONDARY) {
return NULL;
}

View File

@ -18,7 +18,7 @@ extern struct unkStruct_8090F58 gUnknown_80F6990;
void sub_8045BF8(u8 *, Item *);
extern u32 sub_803D73C(u32);
void sub_80460F8(Position *, Item *, u32);
void sub_80460F8(DungeonPos *, Item *, u32);
void sub_8045ACC(void)
{
@ -131,11 +131,11 @@ void sub_8045CB0(void)
u32 x;
int y;
int yCounter;
struct Tile *tile;
const Tile *tile;
u32 uVar5;
int xCounter;
Item item;
Position pos;
DungeonPos pos;
u32 flag;
x = DungeonRandInt(DUNGEON_MAX_SIZE_X);

View File

@ -154,7 +154,7 @@ void sub_80482FC(Entity *, Entity *, u32, u8);
extern void sub_8071DA4(Entity *);
extern void SetShopkeeperAggression(Entity *, Entity *);
extern void sub_80464C8(Entity *, Position *, Item *);
extern void sub_80464C8(Entity *, DungeonPos *, Item *);
extern void sub_806A6E8(Entity *);
extern void sub_8042390(Entity *, Item *);

View File

@ -13,7 +13,7 @@ void sub_804FBE8(void)
{
for(y = 0; y < DUNGEON_MAX_SIZE_Y; y++)
{
tile = GetTileSafe(x,y);
tile = GetTileMut(x,y);
if ((tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) != TERRAIN_TYPE_NORMAL) {
if ((tile->terrainType & (TERRAIN_TYPE_UNK_8 | TERRAIN_TYPE_IMPASSABLE_WALL)) != 0) {
tile->unk4 &= 0xfffd;
@ -42,7 +42,7 @@ void sub_804FC74(void)
for(y = 0; y < DUNGEON_MAX_SIZE_Y; y++)
{
if ((GetTile(x, y)->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) == TERRAIN_TYPE_SECONDARY) {
tile = GetTileSafe(x,y);
tile = GetTileMut(x,y);
tile->terrainType &= ~(TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
tile->terrainType |= (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
}
@ -61,7 +61,7 @@ void sub_804FCCC(void)
for(y = 0; y < DUNGEON_MAX_SIZE_Y; y++)
{
if ((GetTile(x, y)->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL) != 0) {
tile = GetTileSafe(x,y);
tile = GetTileMut(x,y);
tile->terrainType &= ~(TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
}
}
@ -100,7 +100,7 @@ void sub_804FD30(void)
{
for(y = 0; y < DUNGEON_MAX_SIZE_Y; y++)
{
sub_804FD10(GetTileSafe(x,y));
sub_804FD10(GetTileMut(x,y));
if ((boundsCheck(x, y - 1)) ||
(boundsCheck(x + 1, y - 1)) ||
@ -111,7 +111,7 @@ void sub_804FD30(void)
(boundsCheck(x - 1, y)) ||
(boundsCheck(x - 1, y - 1)))
{
GetTileSafe(x,y)->terrainType |= TERRAIN_TYPE_IMPASSABLE_WALL;
GetTileMut(x,y)->terrainType |= TERRAIN_TYPE_IMPASSABLE_WALL;
}
}
}

View File

@ -68,8 +68,9 @@ extern void sub_8083D30(void);
extern void sub_8083D08(void);
extern void sub_806A6E8(Entity *);
extern bool8 sub_8047084(s32 itemFlag);
extern void sub_807FE9C(Entity *pokemon, Position *pos, int param_3, char param_4);
extern void sub_8045DB4(Position *, u32);
extern void sub_807FE9C(Entity *pokemon, DungeonPos *pos, int param_3,
char param_4);
extern void sub_8045DB4(DungeonPos *, u32);
bool8 sub_807EF48(void);
void sub_806A2BC(Entity *a0, u8 a1);
bool8 sub_805E874(void);
@ -116,7 +117,7 @@ void sub_8063A70(ActionContainer *a0, bool8 a1);
void sub_8063CF0(ActionContainer *a0, bool8 a1);
void sub_8067768(UNUSED ActionContainer *a0);
void ShowTacticsMenu(ActionContainer *a0);
void sub_804A728(Position *pos, s32 a1, u8 a2, u8 a3);
void sub_804A728(DungeonPos *pos, s32 a1, u8 a2, u8 a3);
extern bool8 sub_8071A8C(Entity *pokemon);
extern void sub_80643AC(Entity *pokemon);
extern u8 sub_8062F90(Entity *, u32, u32, u32, u32);
@ -1346,7 +1347,7 @@ NAKED static void TryCreateModeArrows(Entity *leader)
void sub_805E738(Entity *a0)
{
Tile *tile;
const Tile *tile;
s32 i, j;
EntityInfo *entityInfo = GetEntInfo(a0);
if (entityInfo->blinkerClassStatus.status != 1 && entityInfo->blinkerClassStatus.status != 2) {
@ -1400,7 +1401,7 @@ bool8 sub_805E874(void)
s32 direction = GetEntInfo(leader)->action.direction;
s32 x = leader->pos.x;
s32 y = leader->pos.y;
Tile *leaderTile = GetTile(x, y);
const Tile *leaderTile = GetTile(x, y);
s32 xAdjacent = x + gAdjacentTileOffsets[direction].x;
s32 yAdjacent = y + gAdjacentTileOffsets[direction].y;
s32 room;
@ -1425,7 +1426,7 @@ bool8 sub_805E874(void)
}
for (j = -1; j < 2; j++) {
Tile *tile = GetTile(x + gAdjacentTileOffsets[(direction + j) & 7].x, y + gAdjacentTileOffsets[(direction + j) & 7].y);
const Tile *tile = GetTile(x + gAdjacentTileOffsets[(direction + j) & 7].x, y + gAdjacentTileOffsets[(direction + j) & 7].y);
if (tile->monster != NULL)
return FALSE;
if (tile->terrainType & TERRAIN_TYPE_STAIRS)
@ -1442,7 +1443,7 @@ bool8 sub_805E874(void)
for (i = -1; i < 2; i++) {
for (j = -1; j < 2; j++) {
Tile *tile = GetTile(x + i, y + j);
const Tile *tile = GetTile(x + i, y + j);
if (tile->object != NULL) {
for (k = 0; k < 3; k++) {
if (x + i == xArray[k] && y + j == yArray[k])
@ -1520,14 +1521,14 @@ bool8 sub_805E874(void)
bool8 sub_805EC2C(Entity *a0, s32 x, s32 y)
{
Position pos = {.x = x, .y = y};
DungeonPos pos = {.x = x, .y = y};
return sub_8070564(a0, &pos);
}
bool8 sub_805EC4C(Entity *a0, u8 a1)
{
Position pos;
Tile *tile;
DungeonPos pos;
const Tile *tile;
EntityInfo *tileMonsterInfo;
Entity *tileMonster;
EntityInfo *entityInfo = GetEntInfo(a0);
@ -2053,7 +2054,7 @@ void ShowFieldMenu(u8 a0_, bool8 a1)
}
else if (var_28 == 4) {
Entity *leader = GetLeader();
Tile *tile = GetTile(leader->pos.x, leader->pos.y);
const Tile *tile = GetTile(leader->pos.x, leader->pos.y);
Entity *tileObject = tile->object;
if (tileObject != NULL) {
if (GetEntityType(tileObject) == ENTITY_ITEM) {
@ -2378,7 +2379,7 @@ bool8 sub_805FD3C(struct UnkMenuBitsStruct *a0)
s32 sub_8060D64(s16 *a0, bool8 a1, bool8 a2, bool8 a3, Entity *a4);
void sub_8060890(Position *a0);
void sub_8060890(DungeonPos *a0);
bool8 sub_8060860(s32 a0);
void sub_8060900(Entity *a0);
s32 sub_8060800(UnkTextStruct2_sub2 *a0, s32 a1);
@ -2756,7 +2757,7 @@ static void CreateFieldItemMenu(s32 a0, Entity *a1, bool8 a2, bool8 a3, UnkTextS
}
break;
case 2: {
Tile *tile = GetTile(a1->pos.x, a1->pos.y);
const Tile *tile = GetTile(a1->pos.x, a1->pos.y);
Item *item = GetItemData(tile->object);
PrintFormattedStringOnWindow(x, 0, gFieldItemMenuGroundTextPtr, 0, 0);
if (item->flags & ITEM_FLAG_EXISTS) {
@ -2849,7 +2850,7 @@ bool8 sub_8060860(s32 a0)
return TRUE;
}
void sub_8060890(Position *a0)
void sub_8060890(DungeonPos *a0)
{
s32 var = sUnknown_202F248[gUnknown_202EE10.unk1E];
switch (var)
@ -3088,7 +3089,7 @@ void sub_8060D24(UNUSED ActionContainer *a0)
sub_803EAF0(0, NULL);
}
extern bool8 PosHasItem(Position *pos);
extern bool8 PosHasItem(DungeonPos *pos);
s32 sub_8060D64(s16 *a0, bool8 a1, bool8 a2, bool8 a3, Entity *a4)
{
@ -3281,7 +3282,7 @@ bool8 sub_8060E38(Entity *a0)
return ret;
}
bool32 sub_8069D18(Position *a0, Entity *a1);
bool32 sub_8069D18(DungeonPos *a0, Entity *a1);
extern const u8 gTeamFormat[];
extern const u8 gHeartRedTiny[];
@ -3302,7 +3303,7 @@ extern void sub_8070968(u8 *buffer, EntityInfo *entityInfo, s32 colorNum);
void DrawFieldTeamMenu(struct UnkFieldTeamMenuStruct *a0, UnkTextStruct3 *a1, bool8 a2)
{
s32 r0;
Position pos;
DungeonPos pos;
s32 i;
s32 count = 0;

View File

@ -28,12 +28,12 @@ extern u8 *gUnknown_80F8E28[];
extern Item *sub_8044D90(Entity *, s32, u32);
void sub_8045BF8(u8 *, Item *);
u8 sub_80460F8(Position *, Item *, u32);
u8 sub_80460F8(DungeonPos *, Item *, u32);
extern void sub_807AB38(Entity *, u32);
extern Entity * sub_8044DA4(Entity *param_1,int param_2);
extern void sub_806A6E8(Entity *);
extern void sub_8044DF0(Entity *, u32, u32);
extern void sub_8045DB4(Position *, u32);
extern void sub_8045DB4(DungeonPos *, u32);
void HandlePickUpPlayerAction(Entity *entity)
{
@ -282,7 +282,7 @@ void HandleUseItemAction(Entity *param_1)
void HandlePlaceItemAction(Entity *param_1)
{
Item *item;
Tile *tile;
const Tile *tile;
EntityInfo *info;
#ifndef NONMATCHING
register Entity *entity asm("r4");

View File

@ -3,7 +3,7 @@
#include "dungeon_util.h"
#include "code_8069D4C.h"
u32 sub_8069D18(Position *pos,Entity *entity)
u32 sub_8069D18(DungeonPos *pos,Entity *entity)
{
EntityInfo *info;

View File

@ -237,7 +237,7 @@ void sub_806CF60(void)
u32 sub_806CF98(Entity *entity)
{
struct Tile *mapTile;
const Tile *mapTile;
u32 shadowSize;
u16 terrainType;
EntityInfo *entityInfo;
@ -284,7 +284,7 @@ extern void sub_806F63C(Entity *r0);
extern void sub_8078084(Entity * pokemon);
extern void sub_800DBBC(void);
extern void sub_8045C28(Item *Item, u8 itemID, u32 param_3);
extern void sub_80464C8(Entity *, Position *, Item *);
extern void sub_80464C8(Entity *, DungeonPos *, Item *);
extern bool8 DoEnemiesEvolveWhenKOed(u8 dungeon);
extern bool8 sub_806FA5C(Entity *, Entity *, struct unkStruct_8069D4C *);
extern void EntityUpdateStatusSprites(Entity *);
@ -817,7 +817,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc
}
}
if (i != MAX_TEAM_MEMBERS) {
Position monPos; // r4
DungeonPos monPos; // r4
sub_8042148(target);

View File

@ -28,14 +28,14 @@ void sub_80428B0(Entity *r0);
void sub_80428C4(Entity *r0);
extern void sub_806F500(void);
extern bool8 sub_806E100(struct unkStruct_80943A8 *param_1, Entity *pokemon, Entity *target, u8 type, struct DamageStruct *dmgStruct);
extern bool8 sub_806E100(s48_16 *param_1, Entity *pokemon, Entity *target, u8 type, struct DamageStruct *dmgStruct);
extern void sub_8041B74(Entity *pokemon);
extern void sub_8041B5C(Entity *pokemon);
extern void HandleDealingDamage(Entity *attacker, Entity *target, struct DamageStruct *dmgStruct, bool32 isFalseSwipe, bool32 giveExp, s16 arg4, bool32 arg8, s32 argC);
extern const s32 gUnknown_80F54B4[NUM_EFFECTIVENESS][NUM_EFFECTIVENESS];
extern const s32 gUnknown_80F504C[];
extern const s32 gUnknown_80F50A0[];
extern const s24_8 gUnknown_80F504C[];
extern const s24_8 gUnknown_80F50A0[];
extern const s16 gUnknown_810AC60;
extern const s16 gUnknown_810AC68;
extern const s16 gUnknown_810AC64;
@ -44,10 +44,10 @@ extern const s16 gUnknown_810AC68;
extern const s16 gUnknown_810AC62;
extern const s16 gUnknown_80F4DAE;
extern const s16 gUnknown_80F4DB0;
extern struct unkStruct_80943A8 gUnknown_8106F24;
extern struct unkStruct_80943A8 gUnknown_8106F04;
extern struct unkStruct_80943A8 gUnknown_8106F1C;
extern struct unkStruct_80943A8 gUnknown_8106F14;
extern s48_16 gUnknown_8106F24;
extern s48_16 gUnknown_8106F04;
extern s48_16 gUnknown_8106F1C;
extern s48_16 gUnknown_8106F14;
extern const u8 *const gUnknown_80FAE00;
extern const u8 *const gUnknown_80FADD8;
extern const u8 *const gUnknown_80FEE04;
@ -154,7 +154,7 @@ static inline void SetDamageOne(struct DamageStruct *dmgStruct, u8 moveType)
dmgStruct->tookNoDamage = FALSE;
}
void CalcDamage(Entity *attacker, Entity *target, u8 moveType, s32 movePower, s32 critChance, struct DamageStruct *dmgStruct, s32 arg8, u16 moveId, bool8 arg_10)
void CalcDamage(Entity *attacker, Entity *target, u8 moveType, s32 movePower, s32 critChance, struct DamageStruct *dmgStruct, s24_8 arg8, u16 moveId, bool8 arg_10)
{
EntityInfo *attackerInfo = GetEntInfo(attacker);
EntityInfo *targetInfo = GetEntInfo(target);
@ -169,21 +169,21 @@ void CalcDamage(Entity *attacker, Entity *target, u8 moveType, s32 movePower, s3
}
else {
s32 atkStatStage, defStatStage;
s32 statCalc;
s24_8 statCalc;
s32 atkStat, defStat;
s32 rand;
s32 r6;
struct unkStruct_80943A8 unkSp1;
struct unkStruct_80943A8 unkSp2;
struct unkStruct_80943A8 unkSp3;
struct unkStruct_80943A8 unkSp4;
struct unkStruct_80943A8 unkSp5;
struct unkStruct_80943A8 unkSp6;
struct unkStruct_80943A8 unkSp7;
struct unkStruct_80943A8 unkSp8;
struct unkStruct_80943A8 unkSp9;
struct unkStruct_80943A8 unkSp10;
struct unkStruct_80943A8 unkSp11;
s48_16 unkSp1;
s48_16 unkSp2;
s48_16 unkSp3;
s48_16 unkSp4;
s48_16 unkSp5;
s48_16 unkSp6;
s48_16 unkSp7;
s48_16 unkSp8;
s48_16 unkSp9;
s48_16 unkSp10;
s48_16 unkSp11;
bool8 r5;
dmgStruct->type = moveType;
@ -210,9 +210,9 @@ void CalcDamage(Entity *attacker, Entity *target, u8 moveType, s32 movePower, s3
gDungeon->unk134.unk13E[0] = atkStatStage;
gDungeon->unk134.unk140[0] = attackerInfo->atk[splitIndex] + movePower;
statCalc = s24_8_mul((attackerInfo->atk[splitIndex] + movePower) * 256, gUnknown_80F504C[atkStatStage]);
statCalc = s24_8_mul(IntToF248(attackerInfo->atk[splitIndex] + movePower), gUnknown_80F504C[atkStatStage]);
statCalc = s24_8_mul(statCalc, attackerInfo->offensiveMultipliers[splitIndex]);
atkStat = statCalc / 256;
atkStat = F248ToInt(statCalc);
defStatStage = targetInfo->defensiveStages[splitIndex];
if (splitIndex == 0 && targetInfo->bideClassStatus.status == STATUS_SKULL_BASH) {
@ -234,9 +234,9 @@ void CalcDamage(Entity *attacker, Entity *target, u8 moveType, s32 movePower, s3
gDungeon->unk134.unk13E[1] = defStatStage;
gDungeon->unk134.unk140[1] = targetInfo->def[splitIndex];
statCalc = s24_8_mul((targetInfo->def[splitIndex]) * 256, gUnknown_80F50A0[defStatStage]);
statCalc = s24_8_mul(IntToF248(targetInfo->def[splitIndex]), gUnknown_80F50A0[defStatStage]);
statCalc = s24_8_mul(statCalc, targetInfo->defensiveMultipliers[splitIndex]);
defStat = statCalc / 256;
defStat = F248ToInt(statCalc);
rand = DungeonRandInt(100);
if (splitIndex == 0) {
@ -276,13 +276,13 @@ void CalcDamage(Entity *attacker, Entity *target, u8 moveType, s32 movePower, s3
attackerInfo->previousVisualFlags &= ~(0x100);
attackerInfo->visualFlags &= ~(0x100);
ApplyAtkDefStatBoosts(attacker, target, moveType, &atkStat, &defStat, rand);
sub_800A020(&unkSp1, atkStat - defStat);
sub_800A020(&unkSp2, 8);
FP48_16_FromS32(&unkSp1, atkStat - defStat);
FP48_16_FromS32(&unkSp2, 8);
F48_16_SDiv(&unkSp1, &unkSp1, &unkSp2);
if (!attackerInfo->isNotTeamMember) {
sub_800A020(&unkSp2, attackerInfo->level);
unkSp3.s0 = 0;
unkSp3.s4 = 0xAAAA;
FP48_16_FromS32(&unkSp2, attackerInfo->level);
unkSp3.hi = 0;
unkSp3.lo = 0xAAAA;
F48_16_SMul(&unkSp2, &unkSp2, &unkSp3);
r6 = (attackerInfo->level * 2) / 3;
}
@ -290,31 +290,31 @@ void CalcDamage(Entity *attacker, Entity *target, u8 moveType, s32 movePower, s3
s32 unkAtkStat2 = attackerInfo->atk[splitIndex];
s32 unkDefStat2 = 1;
ApplyAtkDefStatBoosts(attacker, target, moveType, &unkAtkStat2, &unkDefStat2, rand);
sub_800A020(&unkSp2, unkAtkStat2);
sub_800A020(&unkSp3, 3);
FP48_16_FromS32(&unkSp2, unkAtkStat2);
FP48_16_FromS32(&unkSp3, 3);
F48_16_SDiv(&unkSp2, &unkSp2, &unkSp3);
r6 = unkAtkStat2 / 3;
}
sub_800A6D0(&unkSp4, &unkSp1, &unkSp2);
FP48_16_Add(&unkSp4, &unkSp1, &unkSp2);
gDungeon->unk134.unk140[5] = r6;
gDungeon->unk134.unk140[6] = sub_800A048(&unkSp4);
gDungeon->unk134.unk140[6] = FP48_16_ToS32(&unkSp4);
unkSp5 = unkSp4;
unkSp7 = unkSp4;
F48_16_SMul(&unkSp5, &unkSp5, &unkSp5);
unkSp6.s0 = 0;
unkSp6.s4 = 0xCCC;
unkSp6.hi = 0;
unkSp6.lo = 0xCCC;
F48_16_SMul(&unkSp5, &unkSp5, &unkSp6);
sub_800A020(&unkSp6, 2);
FP48_16_FromS32(&unkSp6, 2);
F48_16_SMul(&unkSp7, &unkSp7, &unkSp6);
sub_800A020(&unkSp6, defStat);
sub_800A6F0(&unkSp7, &unkSp7, &unkSp6);
sub_800A020(&unkSp6, 10);
sub_800A6D0(&unkSp7, &unkSp7, &unkSp6);
sub_800A6D0(&unkSp8, &unkSp5, &unkSp7);
if (sub_800A2F0(&gUnknown_8106F24, &unkSp8)) {
FP48_16_FromS32(&unkSp6, defStat);
FP48_16_Subtract(&unkSp7, &unkSp7, &unkSp6);
FP48_16_FromS32(&unkSp6, 10);
FP48_16_Add(&unkSp7, &unkSp7, &unkSp6);
FP48_16_Add(&unkSp8, &unkSp5, &unkSp7);
if (FP48_16_SLessThan(&gUnknown_8106F24, &unkSp8)) {
unkSp8 = gUnknown_8106F24;
}
if (sub_800A2F0(&unkSp8, &gUnknown_8106F04)) {
if (FP48_16_SLessThan(&unkSp8, &gUnknown_8106F04)) {
unkSp8 = gUnknown_8106F04;
}
r5 = sub_806E100(&unkSp9, attacker, target, moveType, dmgStruct);
@ -380,37 +380,36 @@ void CalcDamage(Entity *attacker, Entity *target, u8 moveType, s32 movePower, s3
}
}
gDungeon->unk134.unk154 = sub_800A048(&unkSp8);
gDungeon->unk134.unk154 = FP48_16_ToS32(&unkSp8);
F48_16_SMul(&unkSp8, &unkSp8, &unkSp9);
{
// Ugly hack needed to match
#ifdef NONMATCHING
s32 arg8_Match;
s24_8 arg8_Match;
#else
register s32 arg8_Match asm("r2");
register s24_8 arg8_Match asm("r2");
#endif // NONMATCHING
gDungeon->unk134.unk15C = arg8_Match = arg8;
ASM_MATCH_TRICK(arg8);
sub_800A088(&unkSp10, arg8_Match);
FP48_16_FromF248(&unkSp10, arg8_Match);
F48_16_SMul(&unkSp8, &unkSp8, &unkSp10);
}
// ALSO needed to match. unk694 chosen randomly and it worked with matching.
ASM_MATCH_TRICK(gDungeon->unk644.unk50);
gDungeon->unk134.unk150 = sub_800A048(&unkSp8);
gDungeon->unk134.unk150 = FP48_16_ToS32(&unkSp8);
{
s32 rnd = DungeonRandInt(0x4000);
unkSp9.s0 = 0;
unkSp9.s4 = 0xE000 + rnd;
unkSp9.hi = 0;
unkSp9.lo = 0xE000 + rnd;
}
F48_16_SMul(&unkSp8, &unkSp8, &unkSp9);
sub_800A020(&unkSp11, 100);
FP48_16_FromS32(&unkSp11, 100);
F48_16_SMul(&unkSp9, &unkSp11, &unkSp9);
gDungeon->unk134.unk158 = sub_800A048(&unkSp9);
gDungeon->unk134.unk158 = FP48_16_ToS32(&unkSp9);
dmgStruct->dmg = sub_800A048(&unkSp8);
dmgStruct->dmg = FP48_16_ToS32(&unkSp8);
dmgStruct->residualDmgType = 0;
if (dmgStruct->dmg == 0) {
dmgStruct->isCrit = FALSE;
@ -420,8 +419,8 @@ void CalcDamage(Entity *attacker, Entity *target, u8 moveType, s32 movePower, s3
void sub_806F2BC(Entity *attacker, Entity *target, u8 moveType, s32 a2, struct DamageStruct *dmgStruct)
{
struct unkStruct_80943A8 unkSp1;
struct unkStruct_80943A8 unkSp2;
s48_16 unkSp1;
s48_16 unkSp2;
s32 a2New = a2;
if (a2New <= 0) a2New = 1;
@ -429,9 +428,9 @@ void sub_806F2BC(Entity *attacker, Entity *target, u8 moveType, s32 a2, struct D
dmgStruct->type = moveType;
sub_806E100(&unkSp1, attacker, target, moveType, dmgStruct);
sub_800A020(&unkSp2, a2New);
FP48_16_FromS32(&unkSp2, a2New);
F48_16_SMul(&unkSp2, &unkSp2, &unkSp1);
dmgStruct->dmg = sub_800A048(&unkSp2);
dmgStruct->dmg = FP48_16_ToS32(&unkSp2);
dmgStruct->residualDmgType = 0;
}

View File

@ -23,6 +23,7 @@
#include "text_util.h"
#include "dungeon_util_1.h"
#include "type_chart.h"
#include "math.h"
extern u8 gFormatBuffer_FriendArea[];
extern u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE];
@ -132,7 +133,7 @@ void sub_806F500(void)
temp->unk140[6] = 0;
temp->unk150 = 0;
temp->unk158 = 0;
temp->unk15C = 0;
temp->unk15C = F248_ZERO;
temp->unk160 = 0;
temp->unk161 = 0;
temp->unk162 = 0;

View File

@ -23,7 +23,7 @@ struct unkStruct_806B7F8
u32 unk4;
u16 level;
u8 fillA[2];
struct Position pos;
DungeonPos pos;
u8 unk10;
};
@ -65,12 +65,12 @@ extern void sub_8042920(struct Entity *r0);
extern s16 sub_803D970(u32);
extern s32 sub_803DA20(s32 param_1);
extern bool8 sub_806AA0C(s32, u32);
extern bool8 sub_8083660(struct Position *param_1);
extern bool8 sub_8083660(DungeonPos *param_1);
void GetPokemonLevelData(LevelData* a1, s32 _id, s32 level); // TODO: change to s32
void sub_8071B48(void)
{
struct Tile *tile;
const Tile *tile;
struct Entity *entity2;
struct Entity *entity;
int index;

View File

@ -23,7 +23,7 @@ struct unkStruct_806B7F8
u32 unk4;
u16 level;
u8 fillA[0xC - 0xA];
struct Position pos;
DungeonPos pos;
u8 unk10;
};
@ -100,7 +100,7 @@ static inline void fu(EntityInfo *entityInfo, s16 id)
void sub_8072B78(Entity *pokemon, Entity *target, s16 id)
{
OpenedFile *file;
Tile *tile;
const Tile *tile;
int index;
s32 id_s32;
EntityInfo *entityInfo;

View File

@ -41,11 +41,11 @@ extern void sub_8067110(Entity *);
extern void sub_80671A0(Entity *);
extern void sub_8073D14(Entity *);
extern void sub_8045BF8(u8 *, Item *);
extern bool8 sub_80461C8(Position *, u32);
extern bool8 sub_80461C8(DungeonPos *, u32);
extern void sub_805229C(void);
extern void sub_807E8F0(Entity *);
extern void sub_80444F4(Entity *pokemon);
extern void sub_807D148(Entity *pokemon, Entity *r1, u32 r2, Position *r3);
extern void sub_807D148(Entity *pokemon, Entity *r1, u32 r2, DungeonPos *r3);
extern void sub_80420B8(Entity *pokemon);
extern void sub_8041C4C(Entity *pokemon, u32 r1);
extern void sub_805E804(void);
@ -105,10 +105,10 @@ extern const s16 gUnknown_80F4F74;
extern const s16 gUnknown_80F4FC2;
extern const s16 gUnknown_80F4F76;
extern const s16 gUnknown_80F4F36;
extern unkStruct_80943A8 gUnknown_80F54F4[8];
extern s48_16 gUnknown_80F54F4[8];
extern const s32 gUnknown_80F60DC[];
extern const Position gUnknown_80F4D44[];
extern const DungeonPos gUnknown_80F4D44[];
bool8 UseAttack(Entity *a0);
void sub_8075050(EntityInfo *info, Unk_Entity_x184 *strPtr);
@ -309,7 +309,7 @@ void sub_8074094(Entity *entity)
}
if (entityInfo->isTeamLeader) {
unkStruct_80943A8 sp8, sp10;
s48_16 sp8, sp10;
FixedPoint var_38;
FixedPoint bellyBefore;
bool8 sound;
@ -334,11 +334,11 @@ void sub_8074094(Entity *entity)
if (r4 > 19)
r4 = 19;
sp8.s0 = 0;
sp8.s4 = 6554;
sp8.hi = 0;
sp8.lo = 6554;
F48_16_SMul(&sp10, &sp8, &gUnknown_80F54F4[r4]);
if (entityInfo->unk153 > 1)
sp10.s4 += (gUnknown_80F60DC[entityInfo->unk153] << 0x10);
sp10.lo += (gUnknown_80F60DC[entityInfo->unk153] << 0x10);
entityInfo->unk153 = 0;
bellyBefore = entityInfo->belly;
@ -797,7 +797,7 @@ void TickStatusHeal(Entity *entity)
}
}
void sub_8074FB0(Entity *entity, s32 a1, Position *pos)
void sub_8074FB0(Entity *entity, s32 a1, DungeonPos *pos)
{
Unk_Entity_x184 *strPtr;
EntityInfo *entityInfo = GetEntInfo(entity);
@ -910,7 +910,7 @@ bool8 UseAttack(Entity *a0)
}
}
else {
Position32 pos;
PixelPos pos;
monInfo->flags |= 0x2000;
pos.x = (monInfo->unk184[0].previousTargetMovePosition2.x * 0x1800) + 0xC00;
@ -948,7 +948,7 @@ bool8 UseAttack(Entity *a0)
monInfo->numMoveTiles = 0;
}
else {
Position32 pos;
PixelPos pos;
pos.x = (monInfo->unk184[monInfo->notMoving].previousTargetMovePosition2.x * 0x1800) + 0xC00;
pos.y = (monInfo->unk184[monInfo->notMoving].previousTargetMovePosition2.y * 0x1800) + 0x1000;
@ -977,7 +977,7 @@ bool8 UseAttack(Entity *a0)
sub_807AA30();
for (j = 0; j < 2; j++) {
for (loop = 0; loop < DUNGEON_MAX_POKEMON; loop++) {
Position monPosBefore;
DungeonPos monPosBefore;
EntityInfo *monInfo;
Entity *mon = gDungeon->activePokemon[loop];

View File

@ -22,7 +22,7 @@ extern void sub_8073D14(Entity *);
void sub_8075680(void)
{
u32 direction;
Position *targetPos;
DungeonPos *targetPos;
Entity *entity;
EntityInfo *info;
int index;
@ -56,7 +56,7 @@ void sub_8075708(Entity *entity)
{
bool8 bVar1;
bool8 bVar2;
Tile *tile;
const Tile *tile;
Trap *trapData;
Entity *trap;
EntityInfo *info;
@ -121,7 +121,7 @@ void sub_8075708(Entity *entity)
u32 sub_8075818(Entity *entity)
{
struct Tile *tile;
const Tile *tile;
EntityInfo *entityInfo;
Entity *subEntity;
Item *item;

View File

@ -17,6 +17,7 @@
#include "dungeon_util.h"
#include "move_effects_target.h"
#include "moves.h"
#include "math.h"
#include "pokemon.h"
#include "pokemon_mid.h"
#include "status_checks_1.h"
@ -704,7 +705,7 @@ void SetChargeStatusTarget(Entity *pokemon, Entity *target, u8 newStatus, Move *
for (index = 0, iVar8 = 0xc7ff; index < 400; index++) {
bVar2 = TRUE;
if (entityInfo->unkFF == 1)
if(iVar7 = entityInfo->unk174, bVar2 = FALSE, iVar7 > iVar8) // unk174 -> u32 to s32
if(iVar7 = entityInfo->unk174.raw, bVar2 = FALSE, iVar7 > iVar8) // unk174 -> u32 to s32
{
bVar2 = TRUE;
}
@ -1025,12 +1026,12 @@ void sub_8079E34(Entity * pokemon, Entity * target, bool8 param_3)
entityInfo->hitChanceStages[index] = DEFAULT_STAT_STAGE;
statChanged = TRUE;
}
if (entityInfo->offensiveMultipliers[index] != DEFAULT_STAT_MULTIPLIER) {
entityInfo->offensiveMultipliers[index] = DEFAULT_STAT_MULTIPLIER;
if (!F248EqualsInt(entityInfo->offensiveMultipliers[index], 1)) {
entityInfo->offensiveMultipliers[index] = F248_ONE;
statChanged = TRUE;
}
if (entityInfo->defensiveMultipliers[index] != DEFAULT_STAT_MULTIPLIER) {
entityInfo->defensiveMultipliers[index] = DEFAULT_STAT_MULTIPLIER;
if (!F248EqualsInt(entityInfo->defensiveMultipliers[index], 1)) {
entityInfo->defensiveMultipliers[index] = F248_ONE;
statChanged = TRUE;
}
}

View File

@ -42,25 +42,25 @@ void sub_806A5B8(Entity *);
u8 sub_8045888(Entity *);
void sub_807EC28(u32);
void sub_80694C0(Entity *, s32, s32, s32);
void sub_807D068(Entity *, Position *);
void sub_807D068(Entity *, DungeonPos *);
u8 sub_8044B28(void);
extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32);
void sub_80421AC(Entity * pokemon, Entity * target);
void sub_807BB78(Entity *pokemon);
extern void sub_803F580(u32);
bool8 sub_808384C(Position *, Position *);
u8 sub_8083660(Position *);
bool8 sub_808384C(DungeonPos *, DungeonPos *);
u8 sub_8083660(DungeonPos *);
void sub_807CD9C(Entity *pokemon, Entity *target, u32 direction)
{
Tile *tile;
const Tile *tile;
int iVar8;
bool8 flag;
Position sp_0x18;
DungeonPos sp_0x18;
Move move;
int sp_0x24;
Entity *sp_0x28;
Position32 sp_0x2C;
PixelPos sp_0x2C;
sp_0x24 = 10;
if (IsCurrentFixedRoomBossFight()) {
@ -162,7 +162,7 @@ void sub_807CD9C(Entity *pokemon, Entity *target, u32 direction)
}
}
void sub_807D068(Entity *pokemon, Position *pos)
void sub_807D068(Entity *pokemon, DungeonPos *pos)
{
int pixelX;
int posY;
@ -171,7 +171,7 @@ void sub_807D068(Entity *pokemon, Position *pos)
int counter;
int iVar8;
s32 diff;
Position32 local_34;
PixelPos local_34;
int incrementX;
int incrementY;
@ -215,12 +215,13 @@ _0807D11E:
sub_803E46C(0x1a);
}
void sub_807D148(Entity *pokemon, Entity *target, u32 param_3, Position *pos)
void sub_807D148(Entity *pokemon, Entity *target, u32 param_3,
DungeonPos *pos)
{
EntityInfo *info;
u32 direction;
Position local_2c;
Position pos2;
DungeonPos local_2c;
DungeonPos pos2;
bool8 flag;
info = GetEntInfo(target);
@ -369,7 +370,7 @@ void sub_807D3CC(Entity *param_1)
bool8 ExposeTrap(s32 x,s32 y)
{
Tile *tile;
const Tile *tile;
Entity *trap;
tile = GetTile(x,y);

View File

@ -19,7 +19,7 @@ extern void sub_805E804(void);
void sub_806A2BC(Entity *pokemon, u8 param_2);
extern u8 sub_8044B28(void);
extern void sub_8068FE0(Entity *, u32, Entity *r2);
extern void nullsub_93(Position *);
extern void nullsub_93(DungeonPos *);
extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32);
extern void sub_80694C0(Entity *, s32, s32, u32);
extern void sub_807EC28(bool8);
@ -69,8 +69,8 @@ void sub_807E1A0(Entity *pokemon,Entity *target,u8 moveType,s16 param_4,s32 para
void sub_807E254(Entity *pokemon,Entity *target)
{
Position pokemonPos;
Position targetPos;
DungeonPos pokemonPos;
DungeonPos targetPos;
if (HasAbility(pokemon, ABILITY_SUCTION_CUPS)) {

View File

@ -14,7 +14,7 @@ extern const unkStruct_2039DB0 gUnknown_8107374;
void sub_800EF64(void);
void sub_800EE5C(s32);
void sub_8085F44(s32);
void sub_800E90C(Position *);
void sub_800E90C(DungeonPos *);
void sub_8088EE8(void);
void sub_8088848(void);
void sub_808A718(void);
@ -30,7 +30,8 @@ void sub_8085EB0(void)
gDungeon->unk181e8.unk18215 = 1;
}
u32 sub_8085EC8(s16 param_1,u32 param_2,u32 param_3,Position *param_4,bool32 param_5)
u32 sub_8085EC8(s16 param_1,u32 param_2,u32 param_3,DungeonPos *param_4,
bool32 param_5)
{
u32 uVar1;
unkStruct_80416E0 local_40;

View File

@ -21,7 +21,7 @@ void sub_800EE5C(s32);
void sub_800EF64();
void sub_803E46C(s32);
s32 sub_800E700(s32);
void sub_800569C(Position *, axdata *, u8);
void sub_800569C(DungeonPos *, axdata *, u8);
void sub_8085F44(void);
void sub_8052FB8(const u8 *);
@ -78,7 +78,7 @@ s32 sub_80861F8(s16 param_1,Entity *param_2,bool32 param_3)
EntityInfo *info;
s32 uVar2;
s32 uStack_38;
Position pos;
DungeonPos pos;
unkStruct_80416E0 stack;
#ifdef NONMATCHING

View File

@ -44,7 +44,7 @@ void SpriteShockEffect(Entity *entity)
static void sub_80862DC(Entity *entity)
{
Position32 pos;
PixelPos pos;
pos.x = entity->pixelPos.x;
pos.y = entity->pixelPos.y + 0x3800;
@ -55,7 +55,7 @@ static void sub_80862DC(Entity *entity)
static void sub_8086310(Entity *entity)
{
Position32 pos;
PixelPos pos;
pos.x = entity->pixelPos.x;
pos.y = entity->pixelPos.y + 0x9000;
@ -67,7 +67,7 @@ static void sub_8086310(Entity *entity)
static void sub_8086348(Entity *entity)
{
Position32 pos;
PixelPos pos;
pos.x = entity->pixelPos.x + 0x7800;
pos.y = entity->pixelPos.y - 0x2000;
@ -78,7 +78,7 @@ static void sub_8086348(Entity *entity)
static void sub_8086384(Entity *entity)
{
Position32 pos;
PixelPos pos;
pos.x = entity->pixelPos.x + 0x7800;
pos.y = entity->pixelPos.y;

View File

@ -311,7 +311,7 @@ void sub_809D25C(void)
case 3:
r2 = (gUnknown_20399E8.unk1C.a0 - gUnknown_20399E8.unk14.a0) / 256;
r1 = (gUnknown_20399E8.unk1C.a4 - gUnknown_20399E8.unk14.a4) / 256;
gUnknown_20399E8.unk10 = ((sub_8009FB8(r2 << 8, r1 << 8) / 256) << 8) / gUnknown_20399E8.unkC;
gUnknown_20399E8.unk10 = (F248ToInt(FP24_8_Hypot(IntToF248(r2), IntToF248(r1))) << 8) / gUnknown_20399E8.unkC;
if (gUnknown_20399E8.unk10 <= 0)
gUnknown_20399E8.unk10 = 1;
gUnknown_20399E8.unk8 = 2;

View File

@ -1,5 +1,3 @@
// gFastMod3Lookup
const u8 gFastMod3Lookup[0x100] = {
0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0
};
@ -9,8 +7,8 @@ const u8 gFastDiv3Lookup[0x100] = {
};
// gFastSinLookup[i] = floor(256 * sin(iπ / 2048))
static const s16 gFastSinLookup[] = {
// sFastSinLookup[i] = floor(256 * sin(iπ / 2048))
static const s16 sFastSinLookup[] = {
0, 0, 0, 1, 1, 1, 2, 2,
3, 3, 3, 4, 4, 5, 5, 5,
6, 6, 7, 7, 7, 8, 8, 9,
@ -141,8 +139,8 @@ static const s16 gFastSinLookup[] = {
255, 255, 255, 255, 255, 255, 255, 255,
};
const u32 gFastUnknownFn1Lookup[] = {
// sFastAtan2Lookup256[256*y/x] = atan2(x,y) for x>y>=0, in units of 2π/256
static const u32 sFastAtan2Lookup256[] = {
0, 0, 0, 0, 0, 0, 0, 1,
1, 1, 1, 1, 1, 2, 2, 2,
2, 2, 2, 3, 3, 3, 3, 3,

View File

@ -61,7 +61,7 @@ extern bool8 TryUseChosenMove(struct Entity *, u32, u32, u32, u32, struct Move *
extern void sub_8045BF8(u8 *, struct Item *);
extern void sub_8044DF0(struct Entity *, u32, u32);
extern void sub_8071DA4(struct Entity *);
extern void sub_804AC20(struct Position *);
extern void sub_804AC20(DungeonPos *);
extern void sub_807EC28(bool8);
extern void sub_806A5B8(struct Entity *entity);
@ -399,7 +399,7 @@ s32 AIConsiderMove(struct AIPossibleMove *aiPossibleMove, Entity *pokemon, Move
{
// Double assignment to fix a regswap.
s16 rangeTargetingFlags = rangeTargetingFlags2 = targetingFlags & 0xF0;
struct Tile *adjacentTile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[i].x,
const Tile *adjacentTile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[i].x,
pokemon->pos.y + gAdjacentTileOffsets[i].y);
Entity *adjacentPokemon = adjacentTile->monster;
if (adjacentPokemon != NULL && GetEntityType(adjacentPokemon) == ENTITY_MONSTER)
@ -433,7 +433,7 @@ s32 AIConsiderMove(struct AIPossibleMove *aiPossibleMove, Entity *pokemon, Move
{
for (i = 0; i < NUM_DIRECTIONS; i++)
{
struct Tile *targetTile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[i].x,
const Tile *targetTile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[i].x,
pokemon->pos.y + gAdjacentTileOffsets[i].y);
if (CanAttackInDirection(pokemon, i))
{
@ -917,7 +917,7 @@ bool8 IsTargetInRange(Entity *pokemon, Entity *targetPokemon, s32 direction, s32
s32 i;
for (i = 0; i <= effectiveMaxRange; i++)
{
struct Tile *mapTile;
const Tile *mapTile;
currentPosX += adjacentTileOffsetX;
currentPosY += adjacentTileOffsetY;
if (currentPosX <= 0 || currentPosY <= 0 ||

View File

@ -448,7 +448,7 @@ bool8 IsAdjacentToEnemy(Entity *pokemon)
s32 direction;
for (direction = 0; direction < NUM_DIRECTIONS; direction++)
{
struct Tile *mapTile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[direction].x, pokemon->pos.y + gAdjacentTileOffsets[direction].y);
const Tile *mapTile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[direction].x, pokemon->pos.y + gAdjacentTileOffsets[direction].y);
Entity *adjacentPokemon = mapTile->monster;
if (adjacentPokemon != NULL && GetEntityType(adjacentPokemon) != ENTITY_NOTHING &&
GetTreatmentBetweenMonsters(pokemon, adjacentPokemon, FALSE, TRUE) == TREATMENT_TREAT_AS_ENEMY)

View File

@ -110,7 +110,7 @@ void AIDecideUseItem(Entity *pokemon)
}
else if (itemType == CATEGORY_THROWN_ARC)
{
Position potentialTargetPositions[NUM_POTENTIAL_ROCK_TARGETS];
DungeonPos potentialTargetPositions[NUM_POTENTIAL_ROCK_TARGETS];
GetPossibleAIArcItemTargets(pokemon, item, potentialTargetPositions, TRUE);
if (gAIThrowItemActionChoiceCount == 0)
{
@ -156,7 +156,7 @@ void AIDecideUseItem(Entity *pokemon)
else if (toolboxIndex == 0)
{
// This seems unused. toolboxIndex can never be 0.
struct Tile *mapTile = GetTile(pokemon->pos.x, pokemon->pos.y);
const Tile *mapTile = GetTile(pokemon->pos.x, pokemon->pos.y);
Entity *object = mapTile->object;
if (object != null)
{
@ -233,7 +233,7 @@ void AIDecideUseItem(Entity *pokemon)
u8 itemType = GetItemCategory(item->id);
if (itemType == CATEGORY_THROWN_ARC)
{
Position potentialTargetPositions[NUM_POTENTIAL_ROCK_TARGETS];
DungeonPos potentialTargetPositions[NUM_POTENTIAL_ROCK_TARGETS];
GetPossibleAIArcItemTargets(pokemon, item, potentialTargetPositions, FALSE);
if (gAIThrowItemActionChoiceCount != 0)
{
@ -312,7 +312,9 @@ void GetPossibleAIThrownItemDirections(Entity *pokemon, s32 thrownAIFlag, Item *
}
}
void GetPossibleAIArcItemTargets(Entity *pokemon, Item *item, Position potentialTargets[], bool8 ignoreRollChance)
void GetPossibleAIArcItemTargets(Entity *pokemon, Item *item,
DungeonPos potentialTargets[],
bool8 ignoreRollChance)
{
s32 i;
gAIThrowItemActionChoiceCount = 0;
@ -340,7 +342,7 @@ void GetPossibleAIArcItemTargets(Entity *pokemon, Item *item, Position potential
}
if (distance <= 10)
{
Position *newPotentialTarget;
DungeonPos *newPotentialTarget;
if (!ignoreRollChance)
{
u32 itemWeight = GetAIUseItemProbability(targetPokemon, item, ITEM_TARGET_OTHER);

View File

@ -50,7 +50,7 @@ void sub_8041888(u8 param_1);
void sub_8085140(void);
void sub_807360C(void);
void sub_805EFB4(Entity *, u8);
void sub_8074FB0(Entity *, u8, Position *);
void sub_8074FB0(Entity *, u8, DungeonPos *);
void HandlePlaceItemAction(Entity *);
void HandlePickUpPlayerAction(Entity *);
@ -72,7 +72,7 @@ extern u8 sub_8044B28(void);
extern u8 UseAttack(Entity *);
void sub_806A1E8(Entity *pokemon);
extern void sub_80694C0(Entity *, s32, s32, u32);
bool8 sub_804AE08(Position *pos);
bool8 sub_804AE08(DungeonPos *pos);
void HandlePickUpAIAction(Entity *pokemon);
void HandleThrowItemAIAction(Entity *pokemon);
void HandleEatAIAction(Entity *pokemon);
@ -114,8 +114,8 @@ bool8 sub_8072CF4(Entity *entity)
s32 index;
EntityInfo *info;
bool8 bVar14;
Position pos;
Position pos1;
DungeonPos pos;
DungeonPos pos1;
sub_804178C(1);
gUnknown_203B434 = 1;

View File

@ -104,7 +104,7 @@ void AIMovement(Entity *pokemon, bool8 showRunAwayEffect)
bool8 CanTakeItem(Entity *pokemon)
{
EntityInfo *pokemonInfo = GetEntInfo(pokemon);
struct Tile *mapTile;
const Tile *mapTile;
Entity *object;
if (!EntityExists(pokemon) || CheckVariousConditions(pokemon))
{
@ -310,7 +310,7 @@ bool8 ChooseTargetPosition(Entity *pokemon)
{
for (x = minX; x <= maxX; x++)
{
Entity *object = GetTileSafe(x, y)->object;
Entity *object = GetTileMut(x, y)->object;
if (object && GetEntityType(object) == ENTITY_ITEM)
{
pokemonInfo->aiTarget.aiObjective = AI_TAKE_ITEM;
@ -553,17 +553,17 @@ bool8 AvoidEnemies(Entity *pokemon)
{
if (room == closestTargetRoom && room != CORRIDOR_ROOM)
{
struct Tile *tile = GetTile(pokemon->pos.x, pokemon->pos.y);
const Tile *tile = GetTile(pokemon->pos.x, pokemon->pos.y);
if (tile->terrainType & TERRAIN_TYPE_NATURAL_JUNCTION)
{
Position aiTargetPos;
DungeonPos aiTargetPos;
s32 targetDir;
aiTargetPos.x = pokemon->pos.x;
aiTargetPos.y = pokemon->pos.y;
// Scan for a direction leading outside the room.
for (targetDir = 0; targetDir < NUM_DIRECTIONS; targetDir++)
{
struct Tile *adjacentTile;
const Tile *adjacentTile;
aiTargetPos.x = pokemon->pos.x + gAdjacentTileOffsets[targetDir].x;
aiTargetPos.y = pokemon->pos.y + gAdjacentTileOffsets[targetDir].y;
adjacentTile = GetTile(aiTargetPos.x, aiTargetPos.y);
@ -593,7 +593,7 @@ bool8 AvoidEnemies(Entity *pokemon)
// If there are any room exits that the Pokémon can head towards without moving
// closer to the target, head towards the furthest eligible exit.
s32 naturalJunctionListCounts;
Position *naturalJunctionList = gDungeon->naturalJunctionList[room];
DungeonPos *naturalJunctionList = gDungeon->naturalJunctionList[room];
s32 furthestTargetExitIndex;
s32 furthestTargetToExitDistance;
s32 distanceX;
@ -735,7 +735,7 @@ bool8 Wander(Entity *pokemon)
else
{
s32 naturalJunctionListCounts = gDungeon->naturalJunctionListCounts[room];
Position *naturalJunctionList = gDungeon->naturalJunctionList[room];
DungeonPos *naturalJunctionList = gDungeon->naturalJunctionList[room];
if (pokemonInfo->moveRandomly)
{
s32 targetFacingDir = DungeonRandInt(NUM_DIRECTIONS);

View File

@ -62,10 +62,10 @@ const u8 gTreatmentData[3][2][2][2] = {
}
};
bool8 sub_8070F3C(Entity * pokemon, Position *pos, s32 direction)
bool8 sub_8070F3C(Entity * pokemon, DungeonPos *pos, s32 direction)
{
u8 terrain;
struct Tile *tile;
const Tile *tile;
terrain = GetCrossableTerrain(GetEntInfo(pokemon)->id);
@ -109,7 +109,7 @@ bool8 sub_8070F3C(Entity * pokemon, Position *pos, s32 direction)
bool8 sub_8070F14(Entity * pokemon, s32 direction)
{
struct Tile *tile;
const Tile *tile;
tile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[direction].x, pokemon->pos.y + gAdjacentTileOffsets[direction].y);
@ -128,7 +128,7 @@ bool8 sub_8070F14(Entity * pokemon, s32 direction)
bool8 sub_8070F80(Entity * pokemon, s32 direction)
{
u8 terrain;
struct Tile *tile;
const Tile *tile;
terrain = GetCrossableTerrain(GetEntInfo(pokemon)->id);
@ -173,7 +173,7 @@ bool8 sub_8070F80(Entity * pokemon, s32 direction)
bool8 sub_8071058(Entity * pokemon, s32 direction)
{
u8 terrain;
struct Tile *tile;
const Tile *tile;
terrain = GetCrossableTerrain(GetEntInfo(pokemon)->id);
@ -218,7 +218,7 @@ bool8 sub_8071058(Entity * pokemon, s32 direction)
bool8 CanAttackInDirection(Entity *pokemon, s32 direction)
{
u8 crossableTerrain = GetCrossableTerrain(GetEntInfo(pokemon)->id);
struct Tile *tile;
const Tile *tile;
if (crossableTerrain < CROSSABLE_TERRAIN_CREVICE)
{
crossableTerrain = CROSSABLE_TERRAIN_CREVICE;
@ -265,7 +265,8 @@ bool8 CanAttackInDirection(Entity *pokemon, s32 direction)
bool8 CanAIMonsterMoveInDirection(Entity *pokemon, s32 direction, bool8 *pokemonInFront)
{
u8 crossableTerrain = GetCrossableTerrain(GetEntInfo(pokemon)->id);
struct Tile *frontTile, *currentTile;
const Tile *currentTile;
const Tile *frontTile;
*pokemonInFront = FALSE;
frontTile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[direction].x,
pokemon->pos.y + gAdjacentTileOffsets[direction].y);
@ -365,7 +366,7 @@ bool8 IsAtJunction(Entity *pokemon)
}
else
{
struct Tile *mapTile;
const Tile *mapTile;
char walkableNeighborFlags;
if (gDungeonWaterType[gDungeon->tileset] == DUNGEON_WATER_TYPE_LAVA
&& crossableTerrain == CROSSABLE_TERRAIN_LIQUID

View File

@ -132,7 +132,7 @@ bool8 CannotAttack(Entity *pokemon, bool8 skipSleep)
bool8 CanMoveInDirection(Entity *pokemon, u32 direction)
{
u8 crossableTerrain = GetCrossableTerrain(GetEntInfo(pokemon)->id);
struct Tile *currentMapTile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[direction].x,
const Tile *currentMapTile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[direction].x,
pokemon->pos.y + gAdjacentTileOffsets[direction].y);
if (currentMapTile->terrainType & TERRAIN_TYPE_IMPASSABLE_WALL || currentMapTile->monster != NULL)

View File

@ -30,6 +30,7 @@
#include "position_util.h"
#include "exclusive_pokemon.h"
#include "trap.h"
#include "math.h"
extern u32 gDungeonBrightness;
@ -386,16 +387,16 @@ extern void sub_8041888(u32);
extern u32 sub_80861F8(u32, Entity *, u32);
extern u8 sub_80860A8(u32);
extern void sub_8052D44(s16 *, Entity *, Entity *);
extern void sub_80464C8(Entity *, Position *, Item *);
extern void sub_80464C8(Entity *, DungeonPos *, Item *);
extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32);
extern u32 sub_8085EC8(u32, u32, u32, Position *, u32);
extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32);
extern void sub_807EAA0(u32, u32);
extern void sub_8072008(Entity *, Entity *, s16, u32, u32);
extern void sub_8085374(void);
extern void sub_8045C28(Item *, u8 , u8 *);
extern void sub_8046860(Entity *, Position *, Item *, u32);
extern void sub_8046860(Entity *, DungeonPos *, Item *, u32);
extern u32 sub_803D73C(u32);
extern void sub_80460F8(Position *, Item *, u8);
extern void sub_80460F8(DungeonPos *, Item *, u8);
extern u8 sub_8044B28(void);
extern bool8 sub_8085B80(struct_8085B80 *);
@ -452,7 +453,7 @@ void MoltresScreenFlash2(s32 r0, s32 r1);
void MoltresScreenFlash3(void);
void MoltresScreenDarken(void);
void EnableJirachiWishWarpTile(void);
void sub_808BB3C(Position *pos);
void sub_808BB3C(DungeonPos *pos);
void sub_8087144();
void SkarmoryEntry(Entity *);
@ -560,8 +561,8 @@ void SkarmoryPreFightDialogue(void)
Entity * diglettEntity;
Entity * skarmoryEntity;
Position32 pos1;
Position32 pos2;
PixelPos pos1;
PixelPos pos2;
leaderEntity = xxx_call_GetLeader(); // Player
partnerEntity = GetPartnerEntity(); // Partner
@ -617,7 +618,7 @@ void SkarmoryReFightDialogue(void)
{
Entity * leaderEntity;
Entity * skarmoryEntity;
Position32 pos;
PixelPos pos;
leaderEntity = xxx_call_GetLeader();
skarmoryEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SKARMORY);
@ -1013,11 +1014,11 @@ void ZapdosDropInEffect(Entity *zapdosEntity)
GetEntInfo(zapdosEntity)->unk15C = 1;
GetEntInfo(zapdosEntity)->unk15E = 0;
GetEntInfo(zapdosEntity)->unk174 = 200;
GetEntInfo(zapdosEntity)->unk174.raw = 200; // incorrect value? Overwritten immediately anyway
PlaySoundEffect(0x1ea);
for(iVar1 = 200; iVar1 >= 0; iVar1 -= 5)
{
GetEntInfo(zapdosEntity)->unk174 = iVar1 * 256;
GetEntInfo(zapdosEntity)->unk174 = IntToF248_2(iVar1);
sub_803E46C(0x46);
}
sub_803E708(0x1e,0x46);
@ -1262,11 +1263,11 @@ void MoltresDropInEffect(Entity * moltresEntity)
GetEntInfo(moltresEntity)->unk15C = 1;
GetEntInfo(moltresEntity)->unk15E = 0;
GetEntInfo(moltresEntity)->unk174 = 0xc800;
GetEntInfo(moltresEntity)->unk174 = IntToF248_2(200);
PlaySoundEffect(0x1f8);
for(iVar1 = 200; iVar1 >= 0; iVar1 -= 5)
{
GetEntInfo(moltresEntity)->unk174 = iVar1 * 256;
GetEntInfo(moltresEntity)->unk174 = IntToF248_2(iVar1);
sub_803E46C(0x46);
}
}
@ -1668,7 +1669,7 @@ void sub_8088484(Entity *param_1)
PlaySoundEffect(0x1ea);
for(iVar1 = 250; iVar1 >= 0; iVar1 -= 5)
{
GetEntInfo(param_1)->unk174 = iVar1 * 256;
GetEntInfo(param_1)->unk174 = IntToF248_2(iVar1);
SetDungeonBGColorRGB(iVar1,iVar1,iVar1 / 2,1,0);
sub_803E46C(0x46);
}
@ -2122,7 +2123,7 @@ void MagmaCavernMidDialogue(void)
Entity * groudonEntity;
Entity * alakazamEntity;
s16 IDStack [2];
Position32 pos;
PixelPos pos;
leaderEntity = xxx_call_GetLeader();
partnerEntity = GetPartnerEntity();
@ -2477,24 +2478,24 @@ void RayquazaPostStoryPreFightDialogue(void)
void RayquazaDropInEffect(Entity *rayquazaEntity)
{
s32 iVar1;
s32 iVar2;
s24_8 iVar1;
s24_8 iVar2;
GetEntInfo(rayquazaEntity)->unk15E = 0;
iVar2 = 51200;
iVar1 = 0x600;
iVar2 = IntToF248_2(200);
iVar1 = IntToF248_2(6);
PlaySoundEffect(0x1f8);
while( 1 ) {
iVar2 = iVar2 - iVar1;
iVar1 -= 0x18;
if (iVar1 < 0x14) {
iVar1 = 0x14;
iVar2.raw = iVar2.raw - iVar1.raw; // must be .raw
iVar1 = F248_Sub(iVar1, FloatToF248_2(3./32.));
if (F248LessThanFloat(iVar1, 0.08)) {
iVar1 = FloatToF248(0.08);
}
if (iVar2 < 0) break;
if (F248LessThanInt(iVar2, 0)) break;
GetEntInfo(rayquazaEntity)->unk174 = iVar2;
sub_803E46C(0x46);
}
GetEntInfo(rayquazaEntity)->unk174 = 0;
GetEntInfo(rayquazaEntity)->unk174 = IntToF248_2(0);
}
void RayquazaScreenFlash(void)
@ -2750,24 +2751,24 @@ void MewtwoReFightDialogue(void)
void MewtwoDropInEffect(Entity *mewtwoEntity)
{
s32 iVar1;
s32 iVar2;
s24_8 iVar1;
s24_8 iVar2;
GetEntInfo(mewtwoEntity)->unk15E = 0;
iVar2 = 51200;
iVar1 = 0x400;
iVar2 = IntToF248_2(200);
iVar1 = IntToF248_2(4);
PlaySoundEffect(0x1f8);
while( 1 ) {
iVar2 = iVar2 - iVar1;
iVar1 -= 11;
if (iVar1 < 0x1e) {
iVar1 = 0x1e;
iVar2.raw -= iVar1.raw;
iVar1 = F248_Sub(iVar1, FloatToF248_2(0.045));
if (F248LessThanFloat(iVar1, 0.12)) {
iVar1 = FloatToF248_2(0.12);
}
if (iVar2 < 0) break;
if (F248LessThanInt(iVar2, 0)) break;
GetEntInfo(mewtwoEntity)->unk174 = iVar2;
sub_803E46C(0x46);
}
GetEntInfo(mewtwoEntity)->unk174 = 0;
GetEntInfo(mewtwoEntity)->unk174 = IntToF248_2(0);
}
void MewtwoScreenFlash(void)
@ -3209,24 +3210,24 @@ void SuicunePostStoryPreFightDialogue(void)
void sub_808A528(Entity * param_1)
{
s32 iVar1;
s32 iVar2;
s24_8 iVar1;
s24_8 iVar2;
GetEntInfo(param_1)->unk15E = 0;
iVar2 = 51200;
iVar1 = 3072;
iVar2 = IntToF248(200);
iVar1 = IntToF248(12);
PlaySoundEffect(0x1f8);
while( 1 ) {
iVar2 = iVar2 - iVar1;
iVar1 -= 96;
if (iVar1 < 20) {
iVar1 = 20;
iVar2.raw -= iVar1.raw;
iVar1 = F248_Sub(iVar1, FloatToF248(0.375));
if (F248LessThanFloat(iVar1, 0.08)) {
iVar1 = FloatToF248_2(0.08);
}
if (iVar2 < 0) break;
if (F248LessThanInt(iVar2, 0)) break;
GetEntInfo(param_1)->unk174 = iVar2;
sub_803E46C(70);
}
GetEntInfo(param_1)->unk174 = 0;
GetEntInfo(param_1)->unk174 = IntToF248_2(0);
}
void SuicuneScreenFlash(void)
@ -3313,7 +3314,7 @@ void HoOhPreFightDialogue(void)
{
Entity * leaderEntity;
Entity * HoOhEntity;
Position32 local_14;
PixelPos local_14;
leaderEntity = xxx_call_GetLeader();
HoOhEntity = GetEntityFromMonsterBehavior(BEHAVIOR_HO_OH);
@ -3352,7 +3353,7 @@ void HoOhReFightDialogue(void)
{
Entity * leaderEntity;
Entity * HoOhEntity;
Position32 local_14;
PixelPos local_14;
leaderEntity = xxx_call_GetLeader();
HoOhEntity = GetEntityFromMonsterBehavior(BEHAVIOR_HO_OH);
@ -3387,24 +3388,24 @@ void HoOhReFightDialogue(void)
void HoOhDropInEffect(Entity * param_1)
{
s32 iVar1;
s32 iVar2;
s24_8 iVar1;
s24_8 iVar2;
GetEntInfo(param_1)->unk15E = 0;
iVar2 = 51200;
iVar1 = 3072;
iVar2 = IntToF248(200);
iVar1 = IntToF248(12);
PlaySoundEffect(0x1f8);
while( 1 ) {
iVar2 = iVar2 - iVar1;
iVar1 -= 96;
if (iVar1 < 20) {
iVar1 = 20;
iVar2.raw -= iVar1.raw;
iVar1 = F248_Sub(iVar1, FloatToF248(0.375));
if (F248LessThanFloat(iVar1, 0.08)) {
iVar1 = FloatToF248_2(0.08);
}
if (iVar2 < 0) break;
if (F248LessThanInt(iVar2, 0)) break;
GetEntInfo(param_1)->unk174 = iVar2;
sub_803E46C(70);
}
GetEntInfo(param_1)->unk174 = 0;
GetEntInfo(param_1)->unk174 = IntToF248_2(0);
}
void HoOhScreenFlash(void)
@ -3493,8 +3494,8 @@ void LatiosPreFightDialogue(void)
{
Entity * leaderEntity;
Entity * LatiosEntity;
Position32 local_18;
Position local_19;
PixelPos local_18;
DungeonPos local_19;
leaderEntity = xxx_call_GetLeader();
LatiosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_LATIOS);
@ -3651,7 +3652,7 @@ void sub_808ADCC(void)
}
}
void sub_808AE54(u8 param_1,u8 param_2,Position *param_3)
void sub_808AE54(u8 param_1,u8 param_2,DungeonPos *param_3)
{
Entity * leaderEntity;
s16 IDStack[2];
@ -3674,7 +3675,7 @@ void sub_808AE54(u8 param_1,u8 param_2,Position *param_3)
}
void sub_808AEC8(u8 param_1,u8 param_2,Position *param_3)
void sub_808AEC8(u8 param_1,u8 param_2,DungeonPos *param_3)
{
Entity * leaderEntity;
s16 IDStack[2];
@ -3696,7 +3697,7 @@ void sub_808AEC8(u8 param_1,u8 param_2,Position *param_3)
}
}
void sub_808AF3C(u8 param_1,u8 param_2,Position *param_3)
void sub_808AF3C(u8 param_1,u8 param_2,DungeonPos *param_3)
{
Entity * leaderEntity;
s16 IDStack[2];
@ -3812,7 +3813,7 @@ void sub_808B1CC(u8 itemID)
{
Entity *entity;
Tile *tile;
Position pos;
DungeonPos pos;
Item item;
pos.x = gDungeon->unk644.unk40;
@ -3827,7 +3828,7 @@ void sub_808B1CC(u8 itemID)
pos.y = entity->pos.y;
}
sub_807FE04(&pos, 0);
tile = GetTileSafe(pos.x, pos.y);
tile = GetTileMut(pos.x, pos.y);
tile->terrainType = tile->terrainType | TERRAIN_TYPE_STAIRS;
if (((itemID != ITEM_NOTHING) && (sub_80860A8(itemID) == 0)) &&
(sub_80860A8(ITEM_MUSIC_BOX) == 0)) {
@ -3991,7 +3992,7 @@ void JirachiWish(void)
{
u8 friendArea;
Entity *jirachiEntity;
Position *LeaderPos;
DungeonPos *LeaderPos;
Entity *leaderEntity;
s32 wishChoice;
s32 counter;
@ -4000,9 +4001,9 @@ void JirachiWish(void)
Item auStack152 [9];
Item itemStack [9];
Item strengthItems [9];
Position pos1;
Position pos2;
Position pos3;
DungeonPos pos1;
DungeonPos pos2;
DungeonPos pos3;
jirachiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_JIRACHI);
CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_JIRACHI);
@ -4059,7 +4060,7 @@ void JirachiWish(void)
}
pos1.x = (jirachiEntity->pos.x + DungeonRandInt(3) - 1);
pos1.y = (jirachiEntity->pos.y + DungeonRandInt(3) + -1);
if ((GetTileSafe(pos1.x, pos1.y)->terrainType & 3) != 0) {
if ((GetTileMut(pos1.x, pos1.y)->terrainType & 3) != 0) {
PlaySoundEffect(0x14c);
sub_808BB3C(&pos1);
sub_8046860(jirachiEntity,&pos1,auStack152,9);
@ -4085,7 +4086,7 @@ void JirachiWish(void)
pos2.x = (jirachiEntity->pos.x + DungeonRandInt(3) - 1);
pos2.y = (jirachiEntity->pos.y + DungeonRandInt(3) + -1);
if ((GetTileSafe(pos2.x, pos2.y)->terrainType & 3) != 0) {
if ((GetTileMut(pos2.x, pos2.y)->terrainType & 3) != 0) {
PlaySoundEffect(400);
sub_808BB3C(&pos2);
sub_8046860(jirachiEntity,&pos2,itemStack,9);
@ -4139,7 +4140,7 @@ void JirachiWish(void)
pos3.x = (jirachiEntity->pos.x + DungeonRandInt(3) - 1);
pos3.y = (jirachiEntity->pos.y + DungeonRandInt(3) + -1);
if ((GetTileSafe(pos3.x, pos3.y)->terrainType & 3) != 0) {
if ((GetTileMut(pos3.x, pos3.y)->terrainType & 3) != 0) {
PlaySoundEffect(400);
sub_808BB3C(&pos3);
sub_8046860(jirachiEntity,&pos3,strengthItems,4);
@ -4219,14 +4220,14 @@ void JirachiWishGrantFlash(void)
sub_8085EB0();
}
void sub_808BB3C(Position *pos1)
void sub_808BB3C(DungeonPos *pos1)
{
#ifndef NONMATCHING
register s32 iVar1 asm("r0");
#else
s32 iVar1;
#endif
Position newPos;
DungeonPos newPos;
iVar1 = pos1->x * 0x1800 + 0xc00;
newPos.x = iVar1 / 256;
@ -4244,25 +4245,25 @@ void sub_808BBA8(Entity *jirachiEntity)
void JirachiDropInEffect(Entity *jirachiEntity)
{
s32 iVar1;
s32 iVar2;
s24_8 iVar1;
s24_8 iVar2;
sub_80861F8(0x1b,jirachiEntity,0);
sub_8086A54(jirachiEntity);
sub_80861B8(jirachiEntity,0xe,DIRECTION_SOUTH);
iVar1 = 0xa000;
iVar2 = 0x200;
iVar1 = IntToF248(160);
iVar2 = IntToF248(2);
PlaySoundEffect(0x1f8);
while( 1 ) {
iVar1 = iVar1 - iVar2;
if (iVar1 < 0x1800) {
iVar2 = 0x100;
while (1) {
iVar1.raw = iVar1.raw - iVar2.raw; // FRAGILE! Subtraction and assignment below must use .raw
if (F248LessThanInt(iVar1, 24)) {
iVar2.raw = IntToF248_2(1).raw;
}
if (iVar1 < 0) break;
if (F248LessThanInt(iVar1, 0)) break;
GetEntInfo(jirachiEntity)->unk174 = iVar1;
sub_803E46C(0x46);
}
GetEntInfo(jirachiEntity)->unk174 = 0;
GetEntInfo(jirachiEntity)->unk174 = IntToF248_2(0);
}
void JirachiSpinEffect(Entity * jirachiEntity)
@ -4302,9 +4303,9 @@ void JirachiWishGrantDialogue(Entity *jirachiEntity)
// Warp Tile is created but not enabled until the Wish is done with EnableJirachiWishWarpTile
void CreateJirachiWishWarpTile(void)
{
struct Tile *tile;
Tile *tile;
tile = GetTileSafe(gDungeon->unkE220[7].x, gDungeon->unkE220[7].y);
tile = GetTileMut(gDungeon->unkE220[7].x, gDungeon->unkE220[7].y);
tile->terrainType &= ~(TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
tile->terrainType |= TERRAIN_TYPE_IMPASSABLE_WALL;
tile->terrainType &= ~TERRAIN_TYPE_STAIRS;
@ -4316,9 +4317,9 @@ void CreateJirachiWishWarpTile(void)
void EnableJirachiWishWarpTile(void)
{
struct Tile *tile;
Tile *tile;
tile = GetTileSafe(gDungeon->unkE220[7].x, gDungeon->unkE220[7].y);
tile = GetTileMut(gDungeon->unkE220[7].x, gDungeon->unkE220[7].y);
tile->terrainType &= ~(TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
tile->terrainType |= TERRAIN_TYPE_NORMAL;
tile->terrainType &= ~TERRAIN_TYPE_IMPASSABLE_WALL;
@ -4880,11 +4881,11 @@ void sub_808C8E0(Entity *entity)
PlaySoundEffect(0x1a5);
sub_806CDD4(entity, 0, DIRECTION_SOUTH);
for(iVar1 = 0; iVar1 < 16; iVar1++){
GetEntInfo(entity)->unk174 = iVar1 * 256;
GetEntInfo(entity)->unk174 = IntToF248_2(iVar1);
sub_803E46C(0x46);
}
for(iVar1 = 16; iVar1 < 200; iVar1 += 4){
GetEntInfo(entity)->unk174 = iVar1 * 256;
GetEntInfo(entity)->unk174 = IntToF248_2(iVar1);
sub_803E46C(0x46);
}
sub_8086A3C(entity);

View File

@ -20,7 +20,7 @@ extern u8 *gUnknown_8105360[];
extern u8 *gUnknown_81053A8[];
extern u8 *gUnknown_8105434[];
extern void sub_80416E0(Position32 *r0, u32, bool8);
extern void sub_80416E0(PixelPos *r0, u32, bool8);
extern void sub_80855E4(void *);
extern void PlaySoundEffect(u32);
extern void sub_804178C(u32);

View File

@ -16,8 +16,8 @@
#include "game_options.h"
#include "dungeon_visibility.h"
extern unkStruct_202F190 gUnknown_80F69D4;
extern unkStruct_202F190 gUnknown_80F69EC;
extern const Tile gOtherOobTile;
extern const Tile gWaterOobTile;
extern u8 gUnknown_80F6A04[];
extern u8 gUnknown_80F6A10[];
extern u8 gUnknown_80F6A28[];
@ -32,9 +32,9 @@ extern const s16 gUnknown_80F6C06[];
EWRAM_DATA OpenedFile *gDungeonPaletteFile = {0};
EWRAM_DATA unkStruct_202EE8C gUnknown_202EE8C[32] = {0};
EWRAM_DATA OpenedFile *gUnknown_202F18C = {0};
EWRAM_DATA unkStruct_202F190 gUnknown_202F190 = {0};
EWRAM_DATA Tile gOutOfBoundsTileData = {0};
EWRAM_DATA_2 unkStruct_202F190 *gUnknown_203B430 = {0};
EWRAM_DATA_2 const Tile *gCurTilesetOobTile = {0};
extern u8 sub_8043CE4(u32);
extern void sub_80402AC(s32, s32);
@ -42,21 +42,21 @@ extern int sprintf(char *, const char *, ...);
void sub_8049BB0(s32, s32);
void sub_80498A8(s32, s32);
Tile *GetTile(s32 x, s32 y)
const Tile *GetTile(s32 x, s32 y)
{
if (x >= 0 && y >= 0 && x < DUNGEON_MAX_SIZE_X && y < DUNGEON_MAX_SIZE_Y)
{
return gDungeon->tilePointers[y][x];
}
return (Tile *) gUnknown_203B430->unk0;
return gCurTilesetOobTile;
}
Tile *GetTileSafe(s32 x, s32 y)
Tile *GetTileMut(s32 x, s32 y)
{
if (x < 0 || y < 0 || x >= DUNGEON_MAX_SIZE_X || y >= DUNGEON_MAX_SIZE_Y)
{
Tile *tile = (Tile *) gUnknown_202F190.unk0;
gUnknown_202F190 = *gUnknown_203B430;
Tile *tile = &gOutOfBoundsTileData;
gOutOfBoundsTileData = *gCurTilesetOobTile;
return tile;
}
return gDungeon->tilePointers[y][x];
@ -139,10 +139,10 @@ void sub_8049820(void)
void sub_8049840(void)
{
if (sub_8043CE4(gDungeon->tileset) != 0) {
gUnknown_203B430 = &gUnknown_80F69EC;
gCurTilesetOobTile = &gWaterOobTile;
}
else {
gUnknown_203B430 = &gUnknown_80F69D4;
gCurTilesetOobTile = &gOtherOobTile;
}
}
@ -190,10 +190,10 @@ void sub_80498A8(int x,int y)
sp_0x20 = GetTile(x, y)->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
if (gDungeon->tileset >= 0x40) {
if ((0x17 >= x) && (0x17 >= y)) {
GetTileSafe(x,y)->unk8 = gDungeon->unk12C24[y * 0x18 + x];
GetTileMut(x,y)->unk8 = gDungeon->unk12C24[y * 0x18 + x];
}
else {
GetTileSafe(x,y)->unk8 = 0;
GetTileMut(x,y)->unk8 = 0;
}
}
else
@ -325,7 +325,7 @@ void sub_80498A8(int x,int y)
if (IsBossFight()) {
r4 = 0;
}
GetTileSafe(x,y)->unk8 = gDungeon->unk12C24[r4 + r7 * 3];
GetTileMut(x,y)->unk8 = gDungeon->unk12C24[r4 + r7 * 3];
}
}
@ -436,17 +436,17 @@ void sub_8049BB0(s32 x, s32 y)
if (y > 29)
flags[CROSSABLE_TERRAIN_WALL] &= ~(0x80 | 0x1 | 0x2);
GetTileSafe(x, y)->walkableNeighborFlags[CROSSABLE_TERRAIN_REGULAR] = flags[CROSSABLE_TERRAIN_REGULAR];
GetTileSafe(x, y)->walkableNeighborFlags[CROSSABLE_TERRAIN_LIQUID] = flags[CROSSABLE_TERRAIN_LIQUID];
GetTileSafe(x, y)->walkableNeighborFlags[CROSSABLE_TERRAIN_CREVICE] = flags[CROSSABLE_TERRAIN_CREVICE];
GetTileSafe(x, y)->walkableNeighborFlags[CROSSABLE_TERRAIN_WALL] = flags[CROSSABLE_TERRAIN_WALL];
GetTileMut(x, y)->walkableNeighborFlags[CROSSABLE_TERRAIN_REGULAR] = flags[CROSSABLE_TERRAIN_REGULAR];
GetTileMut(x, y)->walkableNeighborFlags[CROSSABLE_TERRAIN_LIQUID] = flags[CROSSABLE_TERRAIN_LIQUID];
GetTileMut(x, y)->walkableNeighborFlags[CROSSABLE_TERRAIN_CREVICE] = flags[CROSSABLE_TERRAIN_CREVICE];
GetTileMut(x, y)->walkableNeighborFlags[CROSSABLE_TERRAIN_WALL] = flags[CROSSABLE_TERRAIN_WALL];
}
void sub_8049ED4(void)
{
bool32 hallucinating, unk1820F;
u16 *src;
Tile *tile;
const Tile *tile;
s32 r7;
s32 i;
s32 r10;
@ -562,7 +562,7 @@ void sub_8049ED4(void)
void sub_804A1F0(s32 a0, s32 a1)
{
Tile *tile;
const Tile *tile;
u16 *src;
bool32 hallucinating, unk1820F;
s32 xTemp, yTemp;
@ -664,7 +664,7 @@ void sub_804A1F0(s32 a0, s32 a1)
void sub_804A49C(s32 a0, s32 a1)
{
Tile *tile;
const Tile *tile;
u16 *src;
bool32 hallucinating, unk1820F;
s32 xTemp, yTemp;
@ -763,9 +763,9 @@ void sub_804A49C(s32 a0, s32 a1)
sub_80098F8(3);
}
void sub_804A728(Position *pos, s32 a1, u8 a2, u8 a3)
void sub_804A728(DungeonPos *pos, s32 a1, u8 a2, u8 a3)
{
Position spArray[6];
DungeonPos spArray[6];
u16 *src;
s32 k;
Entity *leader;
@ -774,7 +774,7 @@ void sub_804A728(Position *pos, s32 a1, u8 a2, u8 a3)
s32 r5;
s32 r10;
s32 r9;
Position var_48;
DungeonPos var_48;
s32 var_38, var_34;
s32 x, x2, y;
Dungeon *dungeon = gDungeon;
@ -906,12 +906,12 @@ void sub_804AAAC(void)
{
s32 x;
s32 y;
struct Tile *tile;
Tile *tile;
for(y = 0; y < DUNGEON_MAX_SIZE_Y; y++)
{
for(x = 0; x < DUNGEON_MAX_SIZE_X; x++)
{
tile = GetTileSafe(x,y);
tile = GetTileMut(x,y);
tile->unk4 = 0;
}
}
@ -919,7 +919,7 @@ void sub_804AAAC(void)
void sub_804AAD4(void)
{
struct Tile *tile;
const Tile *tile;
struct RoomData *room1;
struct RoomData *room2;
s32 roomIndex;
@ -983,11 +983,11 @@ void sub_804AAD4(void)
gDungeon->unk104C0 = maxRooms + 1;
}
void sub_804AC20(Position *pos)
void sub_804AC20(DungeonPos *pos)
{
s32 y;
struct Tile *tile2;
struct Tile *tile;
const Tile *tile2;
Tile *tile;
s32 yMax;
u32 visibilityRange;
s32 xMin;
@ -1023,7 +1023,7 @@ void sub_804AC20(Position *pos)
}
for (y = yMin; y <= yMax; y++) {
for (x = xMin; x <= xMax; x++) {
tile = GetTileSafe(x,y);
tile = GetTileMut(x,y);
tile->unk4 = tile->unk4 | 3;
sub_80402AC(x,y);
}

View File

@ -167,7 +167,8 @@ void TryDisplayDungeonLoggableMessage4(Entity *attacker, Entity *target, const u
}
}
void TryDisplayDungeonLoggableMessage5(Entity *pokemon, Position *pos, const u8 *str)
void TryDisplayDungeonLoggableMessage5(Entity *pokemon, DungeonPos *pos,
const u8 *str)
{
u8 flag;
flag = sub_8045888(pokemon) ? TRUE : FALSE;
@ -416,7 +417,7 @@ void DisplayDungeonLoggableMessage(Entity *pokemon, const u8 *str)
struct Struct_sub_808CDB0
{
Position pos;
DungeonPos pos;
bool8 flip;
};

View File

@ -55,14 +55,14 @@ extern void sub_80428A0(Entity *r0);
extern bool8 sub_8040BB0(Entity *entity, Move *move, bool8);
extern void sub_8040DA0(Entity *entity, Move *move);
extern u16 sub_80412E0(u16 moveId, u8 weather, u8 a2);
extern void sub_800569C(Position *, axdata *, u8);
extern void sub_800569C(DungeonPos *, axdata *, u8);
extern u8 GetBodySize(s16 index);
extern void sub_800EF10(u16 r0);
extern s32 sub_800E710(s16 a0, u16 a1);
extern void sub_800E3AC(s32 a0, Position *pos, s32 a2);
extern void sub_8041168(Entity *entity, Entity *entity2, Move *,Position *);
extern void sub_800E3AC(s32 a0, DungeonPos *pos, s32 a2);
extern void sub_8041168(Entity *entity, Entity *entity2, Move *,DungeonPos *);
extern Entity *sub_80696A8(Entity *a0);
extern Entity *GetMonsterAtPos(Position *pos);
extern Entity *GetMonsterAtPos(DungeonPos *pos);
extern Entity *sub_80696FC(Entity *);
extern Entity *sub_806977C(Entity *);
extern void sub_806F2BC(Entity *attacker, Entity *target, u8 moveType, s32 a2, struct DamageStruct *dmgStruct);
@ -2265,13 +2265,13 @@ struct UnkStruct_sub_800E308_1
{
s16 unk0;
s16 unk2;
Position unk4;
Position unk8;
DungeonPos unk4;
DungeonPos unk8;
s32 unkC;
s32 unk10;
};
// Maybe Position? Maybe not, sub_800E308 is called only by sub_8056564, so :shrug:
// Maybe DungeonPos? Maybe not, sub_800E308 is called only by sub_8056564, so :shrug:
struct UnkStruct_sub_800E308_2
{
s16 u0;
@ -2281,7 +2281,7 @@ struct UnkStruct_sub_800E308_2
extern s32 sub_800E308(struct UnkStruct_sub_800E308_1 *, struct UnkStruct_sub_800E308_2 *);
#ifdef NONMATCHING // https://decomp.me/scratch/fTUsI
s32 sub_8056564(Entity *entity, Position *pos, Move *move, s32 r4)
s32 sub_8056564(Entity *entity, DungeonPos *pos, Move *move, s32 r4)
{
struct UnkStruct_sub_800E308_1 unkSp1;
struct UnkStruct_sub_800E308_2 unkSp2;
@ -2291,7 +2291,7 @@ s32 sub_8056564(Entity *entity, Position *pos, Move *move, s32 r4)
unkStruct_80BDBC4 *unkStruct = sub_800ECB8(sub_80412E0(move->id, GetApparentWeather(entity), 1));
s32 unk6 = unkStruct->unk6;
// This part with unkPos doesn't match
Position32 unkPos = {pos->x * 0x1800, pos->y * 0x1800};
PixelPos unkPos = {pos->x * 0x1800, pos->y * 0x1800};
unkPos.x += 0x1000;
unkPos.y += 0xC00;
@ -2311,7 +2311,7 @@ s32 sub_8056564(Entity *entity, Position *pos, Move *move, s32 r4)
someRetVal);
}
else {
unkSp1.unk8 = (Position) {0};
unkSp1.unk8 = (DungeonPos) {0};
}
unkSp1.unk0 = sub_80412E0(move->id, GetApparentWeather(entity), 1);
unkSp1.unk2 = entInfo->apparentID;
@ -2327,7 +2327,7 @@ s32 sub_8056564(Entity *entity, Position *pos, Move *move, s32 r4)
return -1;
}
#else
NAKED s32 sub_8056564(Entity *entity, Position *pos, Move *move, s32 r4)
NAKED s32 sub_8056564(Entity *entity, DungeonPos *pos, Move *move, s32 r4)
{
asm_unified("push {r4-r7,lr}\n"
" mov r7, r9\n"
@ -2541,8 +2541,8 @@ static const s32 gUnknown_81069D4[NUM_DIRECTIONS] =
// This function looks important, but what does it do?
void sub_80566F8(Entity *attacker, Move *move, s32 a2, bool8 a3, s32 itemId, s32 isLinkedMove)
{
Position var_68;
Position var_64;
DungeonPos var_68;
DungeonPos var_64;
Entity *targetsArray[2]; // Only 2 hmm
s32 var_4C, var_48;
s32 i, j;
@ -2577,7 +2577,7 @@ void sub_80566F8(Entity *attacker, Move *move, s32 a2, bool8 a3, s32 itemId, s32
var_48 = gAdjacentTileOffsets[attackerInfo->action.direction].y;
for (i = 0; i < a2; i++)
{
Tile *tile;
const Tile *tile;
if (var_68.x < 0 || var_68.y < 0 || var_68.x > 55 || var_68.y > 31)
break;
@ -2621,8 +2621,8 @@ void sub_80566F8(Entity *attacker, Move *move, s32 a2, bool8 a3, s32 itemId, s32
for (i = 0; i < a2; i++)
{
Position var_68Before;
Tile *tile;
DungeonPos var_68Before;
const Tile *tile;
if (var_68.x < 0 || var_68.y < 0 || var_68.x > 55 || var_68.y > 31)
break;
@ -2631,7 +2631,7 @@ void sub_80566F8(Entity *attacker, Move *move, s32 a2, bool8 a3, s32 itemId, s32
var_68.x += var_4C;
var_68.y += var_48;
if (sub_803F428(&var_68) && !gDungeon->unk181e8.blinded) {
Position32 pos32;
PixelPos pos32;
pos32.x = (var_68Before.x * 0x1800) + 0xC00;
pos32.y = (var_68Before.y * 0x1800) + 0x1000;
var_28 = var_30 * (var_4C << 8);
@ -2828,7 +2828,7 @@ static void SetTargetsForMove(Entity **targetsArray, Entity *attacker, Move *mov
}
for (i = 0; i < to; i++, direction++) {
Entity *targetEntity;
Position unkPositon;
DungeonPos unkPositon;
direction &= DIRECTION_MASK;
unkPositon.x = attacker->pos.x + gAdjacentTileOffsets[direction].x ;

View File

@ -38,7 +38,7 @@ u8 GetCrossableTerrain(s16 species)
}
}
u8 sub_807034C(s16 id, struct Tile *tile)
u8 sub_807034C(s16 id, const Tile *tile)
{
s32 crossableTerrain;
u16 tileFlags;
@ -66,9 +66,9 @@ u8 sub_807034C(s16 id, struct Tile *tile)
return TRUE;
}
u8 sub_80703A0(Entity *pokemon, Position *pos)
u8 sub_80703A0(Entity *pokemon, DungeonPos *pos)
{
struct Tile *tile;
const Tile *tile;
u8 crossableTerrain;
u16 tileFlags;
EntityInfo *entityInfo;
@ -128,10 +128,10 @@ bool8 CanCrossWalls(Entity *pokemon)
return FALSE;
}
bool8 sub_807049C(Entity *pokemon, Position *pos)
bool8 sub_807049C(Entity *pokemon, DungeonPos *pos)
{
s32 crossableTerrain;
struct Tile *tile;
const Tile *tile;
u16 tileFlags;
EntityInfo *entityInfo;
@ -170,10 +170,10 @@ bool8 sub_807049C(Entity *pokemon, Position *pos)
return TRUE;
}
bool8 sub_8070564(Entity *pokemon, Position *pos)
bool8 sub_8070564(Entity *pokemon, DungeonPos *pos)
{
u8 crossableTerrain;
struct Tile *tile;
const Tile *tile;
u16 tileFlags;
EntityInfo *entityInfo;
#ifndef NONMATCHING
@ -216,10 +216,10 @@ bool8 sub_8070564(Entity *pokemon, Position *pos)
return TRUE;
}
bool8 sub_80705F0(Entity *pokemon, Position *pos)
bool8 sub_80705F0(Entity *pokemon, DungeonPos *pos)
{
s32 crossableTerrain;
struct Tile *tile;
const Tile *tile;
u16 tileFlags;
EntityInfo *entityInfo;
@ -256,10 +256,10 @@ bool8 sub_80705F0(Entity *pokemon, Position *pos)
return TRUE;
}
bool8 sub_80706A4(Entity *pokemon, Position *pos)
bool8 sub_80706A4(Entity *pokemon, DungeonPos *pos)
{
s32 crossableTerrain;
struct Tile *tile;
const Tile *tile;
u16 tileFlags;
EntityInfo *entityInfo;

View File

@ -5,11 +5,11 @@
#include "dungeon_map_access.h"
#include "structs/map.h"
bool8 IsPositionActuallyInSight(Position *pos1, Position *pos2)
bool8 IsPositionActuallyInSight(DungeonPos *pos1, DungeonPos *pos2)
{
u8 pos1Room;
u8 visibility = gDungeon->unk181e8.visibilityRange;
struct Tile *tile1;
const Tile *tile1;
if (visibility == 0)
{
visibility = 2;
@ -47,9 +47,9 @@ bool8 IsPositionActuallyInSight(Position *pos1, Position *pos2)
}
}
bool8 IsPositionInSight(Position *pos1, Position *pos2)
bool8 IsPositionInSight(DungeonPos *pos1, DungeonPos *pos2)
{
struct Tile *tile;
const Tile *tile;
u8 pos1Room;
s32 xDiff;
s32 yDiff;
@ -97,9 +97,9 @@ returnFalse:
return TRUE;
}
void sub_80833E8(Position *param_1, s32 *param_2)
void sub_80833E8(DungeonPos *param_1, s32 *param_2)
{
struct Tile *tile;
const Tile *tile;
struct RoomData *mapRoom;
u32 visibility;
u32 room;
@ -125,10 +125,10 @@ void sub_80833E8(Position *param_1, s32 *param_2)
}
}
bool8 IsTargetTwoTilesAway(Position *pos1, Position *pos2)
bool8 IsTargetTwoTilesAway(DungeonPos *pos1, DungeonPos *pos2)
{
s32 i;
struct Tile *tile;
const Tile *tile;
s32 diff;
s32 x1;
s32 y1;

View File

@ -14,7 +14,7 @@
extern u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE];
extern u8 gUnknown_202EE76[DUNGEON_MAX_WILD_POKEMON_BODY_SIZE];
extern Position gUnknown_203B410;
extern DungeonPos gUnknown_203B410;
extern Entity *gLeaderPointer; // 203B450
#include "data/dungeon_serializer.h"
@ -66,7 +66,7 @@ static s32 ReadSpeedStage(DataSerializer *seri);
static u8 ReadTactic(DataSerializer *seri);
static u8 ReadDecoyAITracker(DataSerializer *seri);
static void ReadTile(DataSerializer *seri, Tile *dst);
static void ReadTilePos(DataSerializer *seri, Position *dst);
static void ReadTilePos(DataSerializer *seri, DungeonPos *dst);
static void ReadInvisibleClassStatus(DataSerializer *seri, InvisibleClassStatus *dst);
static u8 ReadType(DataSerializer *seri);
static u16 ReadU16(DataSerializer *seri);
@ -112,7 +112,7 @@ static void WriteSureShotClassStatus(DataSerializer *seri, SureShotClassStatus*
static void WriteMuzzled(DataSerializer *seri, Muzzled *src);
static void WriteBurnClassStatus(DataSerializer *seri, BurnClassStatus *src);
static void WriteReflectClassStatus(DataSerializer *seri, ReflectClassStatus *src);
static void WriteTilePos(DataSerializer *seri, Position *src);
static void WriteTilePos(DataSerializer *seri, DungeonPos *src);
static void WriteS16(DataSerializer *seri, s16 value);
static void WriteSleepClassStatus(DataSerializer *seri, SleepClassStatus* src);
static void WriteSpeedCounters(DataSerializer *seri, u8 *src, u32 numCounters);
@ -134,7 +134,7 @@ static Entity* sub_8082A08(s16 id, s16 apparentID, s32 index);
// These externs are from other files
extern u8 GetBodySize(s16 index);
extern void sub_80460F8(Position *, Item *, u32);
extern void sub_80460F8(DungeonPos *, Item *, u32);
void SaveDungeonState(u8 *buffer, u32 bufLen)
{
@ -868,7 +868,7 @@ static void ReadDungeonItems(DataSerializer *seri)
{
s32 i;
Item item;
Position pos;
DungeonPos pos;
ReadBlame(seri, sMisakiSan);
@ -894,7 +894,7 @@ static void ReadDungeonTraps(DataSerializer *seri)
s32 counter;
Tile *tile;
Entity *entity;
Position pos;
DungeonPos pos;
u8 isVisible;
u8 unk1;
u8 trapID;
@ -910,7 +910,7 @@ static void ReadDungeonTraps(DataSerializer *seri)
ReadTilePos(seri, &pos);
if (trapID != 0xFF) {
tile = GetTileSafe(pos.x, pos.y);
tile = GetTileMut(pos.x, pos.y);
entity = sub_8045684(trapID, &pos, unk1);
if (entity) {
tile->object = entity;
@ -952,7 +952,7 @@ static void ReadMonster(DataSerializer *seri, bool8 isTeamMember, s32 index)
s32 i;
EntityInfo *monEntInfo;
EntityInfo entInfo = {0};
Position monPos;
DungeonPos monPos;
bool8 shouldSpawnMon;
u32 monIsVisible;
u32 spawnGenID;
@ -1090,7 +1090,7 @@ static void ReadMonster(DataSerializer *seri, bool8 isTeamMember, s32 index)
if (mon != NULL) {
monEntInfo = GetEntInfo(mon);
tile = GetTileSafe(monPos.x, monPos.y);
tile = GetTileMut(monPos.x, monPos.y);
mon->prevPos = monPos;
mon->pos = monPos;
tile->monster = mon;
@ -1245,7 +1245,7 @@ void sub_8082B40(void)
EntityInfo *info;
Entity *entity;
s32 i;
Position pos;
DungeonPos pos;
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
entity = gDungeon->activePokemon[i];
@ -1255,7 +1255,7 @@ void sub_8082B40(void)
sub_806CCB4(entity, sub_806CEBC(entity));
pos = entity->pos;
AddPokemonDungeonSprite(info->unk98, info->apparentID, &pos, 3);
entity->room = GetTileSafe(entity->pos.x, entity->pos.y)->room;
entity->room = GetTileMut(entity->pos.x, entity->pos.y)->room;
}
}
}
@ -1627,7 +1627,7 @@ static void WriteBool8(DataSerializer *seri, bool8 value)
WriteBytes(seri, &local_8, 1);
}
static void WriteTilePos(DataSerializer *seri, Position *src)
static void WriteTilePos(DataSerializer *seri, DungeonPos *src)
{
WriteBytes(seri, &src->x, 1);
WriteBytes(seri, &src->y, 1);
@ -1708,7 +1708,7 @@ static bool8 ReadBool8(DataSerializer *seri)
return local_8 != 0;
}
static void ReadTilePos(DataSerializer *seri, Position *dst)
static void ReadTilePos(DataSerializer *seri, DungeonPos *dst)
{
dst->x = 0;
dst->y = 0;
@ -1739,4 +1739,4 @@ static void ReadDungeonUnkE260(DataSerializer *seri, unkDungeonE260 *dst)
static void ReadSpeedCounters(DataSerializer *seri, u8 *dst, u32 numCounters)
{
ReadBytes(seri, dst, numCounters);
}
}

View File

@ -15,7 +15,7 @@ void sub_806C51C(Entity *entity);
extern void sub_80462AC(Entity * ,u32, u32, u32, u32);
extern void sub_807FA9C();
const Position gAdjacentTileOffsets[] = {
const DungeonPos gAdjacentTileOffsets[] = {
{0, 1},
{1, 1},
{1, 0},
@ -65,14 +65,14 @@ Item* GetItemData_1(Entity *entity)
return entity->axObj.info.item;
}
Tile *GetTileAtEntity(Entity *entity)
const Tile *GetTileAtEntity(Entity *entity)
{
return GetTile(entity->pos.x, entity->pos.y);
}
Tile *GetTileAtEntitySafe(Entity *entity)
{
return GetTileSafe(entity->pos.x, entity->pos.y);
return GetTileMut(entity->pos.x, entity->pos.y);
}
void sub_804513C(void)
@ -177,7 +177,7 @@ void sub_804522C(void) {
}
}
void sub_804535C(Entity *entity, Position32 *pos)
void sub_804535C(Entity *entity, PixelPos *pos)
{
if (pos != NULL) {

View File

@ -11,6 +11,7 @@
#include "dungeon_leader.h"
#include "dungeon_util.h"
#include "random.h"
#include "math.h"
#include "structs/str_dungeon.h"
extern s32 gUnknown_202F3D8;
@ -179,7 +180,7 @@ void sub_80856E0(Entity * pokemon, s32 direction)
for(counter = 0; counter < 5; counter++)
{
entityInfo->unk174 += 0x200;
entityInfo->unk174 = F248_Add(entityInfo->unk174, IntToF248(2));
sub_803E46C(0x46);
}
entityInfo->action.direction = direction & DIRECTION_MASK;
@ -187,10 +188,10 @@ void sub_80856E0(Entity * pokemon, s32 direction)
for(counter = 0; counter < 5; counter++)
{
entityInfo->unk174 -= 0x200;
entityInfo->unk174 = F248_Sub(entityInfo->unk174, IntToF248(2));
sub_803E46C(0x46);
}
entityInfo->unk174 = 0;
entityInfo->unk174.raw = 0; // weird one that doesn't match with struct assignment
sub_803E46C(0x46);
}
@ -247,7 +248,7 @@ void sub_8085890(s32 x, s32 y)
sub_803F878(x, y);
}
void ShiftCameraToPosition(Position32 *posStruct, s32 cameraSteps)
void ShiftCameraToPosition(PixelPos *posStruct, s32 cameraSteps)
{
s32 XPos;
s32 YPos;

View File

@ -69,12 +69,12 @@ bool8 sub_8045A70(Entity *entity, Entity *targetEntity)
return FALSE;
}
bool8 sub_8045AAC(Entity *entity, Position *pos)
bool8 sub_8045AAC(Entity *entity, DungeonPos *pos)
{
return IsPositionActuallyInSight(&entity->pos, pos);
}
bool8 CanTargetPosition(Entity *entity, Position *pos)
bool8 CanTargetPosition(Entity *entity, DungeonPos *pos)
{
return IsPositionInSight(&entity->pos, pos);
}

View File

@ -177,49 +177,54 @@ void ScenarioCalc(s16 param_1,s32 param_2,s32 param_3)
}
}
bool8 ScriptVarScenarioBefore(s16 param_1,u32 param_2,s32 param_3)
bool8 ScriptVarScenarioBefore(s16 varId,u32 pMain,s32 pSub)
{
s32 uVar1;
s32 iVar2;
uVar1 = GetScriptVarArrayValue(NULL,param_1,0);
iVar2 = GetScriptVarArrayValue(NULL,param_1,1);
if ((uVar1 != 0x3a) &&
(uVar1 < param_2 || (param_3 >= 0 && (uVar1 == param_2) && (iVar2 < param_3)))) {
s32 sMain;
s32 sSub;
sMain = GetScriptVarArrayValue(NULL, varId, 0);
sSub = GetScriptVarArrayValue(NULL, varId, 1);
if (sMain == 0x3a) {
// DS: Assert(FALSE, "debug mode scenario comp %3d %3d %3d", varId, pMain, pSub)
return FALSE;
} else if (sMain < pMain) {
return TRUE;
}
else {
} else if (pSub >= 0 && sMain == pMain && sSub < pSub) {
return TRUE;
} else {
return FALSE;
}
}
bool8 ScriptVarScenarioEqual(s16 param_1,u32 param_2,s32 param_3)
bool8 ScriptVarScenarioEqual(s16 varId,u32 pMain,s32 pSub)
{
s32 uVar1;
s32 iVar2;
uVar1 = GetScriptVarArrayValue(NULL, param_1, 0);
iVar2 = GetScriptVarArrayValue(NULL, param_1, 1);
if (((uVar1 == param_2 && (((param_3 < 0) || (iVar2 == param_3)))))) {
return TRUE;
}
else {
return FALSE;
s32 sMain;
s32 sSub;
sMain = GetScriptVarArrayValue(NULL, varId, 0);
sSub = GetScriptVarArrayValue(NULL, varId, 1);
if (sMain == pMain) {
if (pSub < 0) return TRUE;
if (sSub == pSub) return TRUE;
}
return FALSE;
}
bool8 ScriptVarScenarioAfter(s16 param_1,u32 param_2,s32 param_3)
bool8 ScriptVarScenarioAfter(s16 varId,u32 pMain,s32 pSub)
{
s32 uVar1;
s32 iVar2;
uVar1 = GetScriptVarArrayValue(NULL, param_1, 0);
iVar2 = GetScriptVarArrayValue(NULL, param_1, 1);
if ((uVar1 != 0x3a) &&
((uVar1 > param_2 || (((param_3 >= 0 && (uVar1 == param_2)) && (iVar2 > param_3)))))) {
s32 sMain;
s32 sSub;
sMain = GetScriptVarArrayValue(NULL, varId, 0);
sSub = GetScriptVarArrayValue(NULL, varId, 1);
if (sMain == 0x3a) {
// DS: Assert(FALSE, "debug mode scenario comp %3d %3d %3d", varId, pMain, pSub)
return FALSE;
} else if (sMain > pMain) {
return TRUE;
}
else {
} else if (pSub >= 0 && sMain == pMain && sSub > pSub) {
return TRUE;
} else {
return FALSE;
}
}

View File

@ -12,7 +12,7 @@ static EWRAM_DATA_2 u32 sFileCacheCursorPosition = {0};
// ???
extern s32 sprintf(char *, const char *, ...);
UNUSED static void sub_800A894(UnkFileStruct *r0, s32 r1)
UNUSED static void FP48_16_Log(UnkFileStruct *r0, s32 r1)
{
s32 temp;

View File

@ -52,7 +52,7 @@ void FatalError(void* loc, char* fmt, ...) __attribute__((noreturn));
char sub_8002984(s32, u8);
u32 VecDirection8Radial();
u32 SizedDeltaDirection4();
u8 SizedDeltaDirection8(Position32*, Position32*, Position32*, Position32*);
u8 SizedDeltaDirection8(PixelPos*, PixelPos*, PixelPos*, PixelPos*);
bool8 sub_8021700(s32);
bool8 sub_802FCF0(void);
@ -93,13 +93,13 @@ s32 HasItemInInventory(u8);
u32 sub_809CC90();
void sub_809D0BC(void);
void sub_809D124(s32, s32, s32);
void sub_809D158(s32, Position32*);
void sub_809D158(s32, PixelPos*);
void sub_809D170(s32, s32);
void sub_809D190(s32, Position32*, s32);
void sub_809D190(s32, PixelPos*, s32);
void sub_809D1A8(s32, s32, s32);
void sub_809D1CC(s32, Position32*, s32);
void sub_809D1CC(s32, PixelPos*, s32);
void sub_809D1E4(s32, s32, s32);
void sub_809D208(s32, Position32*, s32);
void sub_809D208(s32, PixelPos*, s32);
void sub_809D220(s32, s32, s32);
u32 sub_809D52C();
bool8 GroundCancelAllEntities(void);
@ -111,14 +111,14 @@ void sub_80A8BD8(s16, s32*);
u32 sub_80A8C2C();
u32 sub_80A8C98();
char *sub_80A8D54(s16);
s16 sub_80A8FD8(s32, Position32*);
s16 sub_80A8F9C(s32, Position32*);
s16 sub_80A8FD8(s32, PixelPos*);
s16 sub_80A8F9C(s32, PixelPos*);
u32 sub_80A9050();
u32 sub_80A9090();
s16 sub_80AC448(s16, Position32*);
s32 sub_80AC49C(s16, Position32*);
s16 sub_80AD360(s16, Position32*);
s16 sub_80AD3B4(s16, Position32*);
s16 sub_80AC448(s16, PixelPos*);
s32 sub_80AC49C(s16, PixelPos*);
s16 sub_80AD360(s16, PixelPos*);
s16 sub_80AD3B4(s16, PixelPos*);
u32 GroundLink_GetPos();
u32 GroundLink_GetArea();
void DeleteGroundEvents(void);
@ -139,7 +139,7 @@ extern struct { const char *unk0; s32 unk4; } gChoices[9];
extern char gUnknown_2039D98[12];
extern int gNumChoices;
extern Position32 gUnknown_81164DC;
extern PixelPos gUnknown_81164DC;
extern char gUnknown_81165D4[];
extern char gUnknown_81165F4[];
extern char gUnknown_811660C[];
@ -404,7 +404,7 @@ s32 ExecuteScriptCommand(Action *action) {
case 0x19: {
s8 unk[4];
GroundObjectData *obj;
Position32 pos;
PixelPos pos;
s16 res;
s32 group;
s32 sector;
@ -431,7 +431,7 @@ s32 ExecuteScriptCommand(Action *action) {
case 0x1a: {
s8 unk;
GroundEffectData *eff;
Position32 pos;
PixelPos pos;
s16 res;
s32 group;
s32 sector;
@ -541,10 +541,10 @@ s32 ExecuteScriptCommand(Action *action) {
case 0x21: {
s32 ret;
s32 unk;
Position32 pos1;
Position32 pos2;
Position32 pos3;
Position32 pos4;
PixelPos pos1;
PixelPos pos2;
PixelPos pos3;
PixelPos pos4;
s32 tmp;
ret = (s16)sub_80A7AE8((s16)curCmd.arg1);
if (ret >= 0) {
@ -864,7 +864,7 @@ s32 ExecuteScriptCommand(Action *action) {
}
case 0x50: {
Action *ptr;
Position32 pos;
PixelPos pos;
s8 c;
{
Action *tmp = (Action*)sub_809D52C(action->unkC.arr);
@ -880,9 +880,9 @@ s32 ExecuteScriptCommand(Action *action) {
break;
}
case 0x51: {
Position32 posIn;
Position32 posOut1;
Position32 posOut2;
PixelPos posIn;
PixelPos posOut1;
PixelPos posOut2;
action->callbacks->getHitboxCenter(action->parentObject, &posIn);
GroundLink_GetArea(curCmd.argShort, &posOut1, &posOut2, &posIn);
action->callbacks->setPositionBounds(action->parentObject, &posOut1, &posOut2);
@ -920,7 +920,7 @@ s32 ExecuteScriptCommand(Action *action) {
break;
}
case 0x58: {
Position32 unk;
PixelPos unk;
unk.x = curCmd.arg1 << 8;
unk.y = curCmd.arg2 << 8;
action->callbacks->moveReal(action->parentObject, &unk);
@ -928,7 +928,7 @@ s32 ExecuteScriptCommand(Action *action) {
return 2;
}
case 0x59: {
Position32 unk;
PixelPos unk;
unk.x = curCmd.argShort << 8;
unk.y = curCmd.arg1 << 8;
action->callbacks->moveRelative(action->parentObject, &unk);
@ -939,12 +939,13 @@ s32 ExecuteScriptCommand(Action *action) {
u32 unk[2];
unk[0] = OtherRandInt(curCmd.argShort) << 8;
unk[1] = OtherRandInt(curCmd.arg1) << 8;
action->callbacks->moveRelative(action->parentObject, (Position32*)unk);
action->callbacks->moveRelative(action->parentObject,
(PixelPos*)unk);
scriptData->unk2A = (u8)curCmd.argByte;
return 2;
}
case 0x5b: {
Position32 unk;
PixelPos unk;
action->callbacks->getHitboxCenter(action->parentObject, &unk);
GroundLink_GetPos((s16)curCmd.arg1, &unk);
action->callbacks->moveReal(action->parentObject, &unk); // landing end of unwanted tailmerge
@ -952,7 +953,7 @@ s32 ExecuteScriptCommand(Action *action) {
return 2;
}
case 0x5c: {
Position32 pos, pos1, pos2;
PixelPos pos, pos1, pos2;
action->callbacks->getHitboxCenter(action->parentObject, &pos);
GroundLink_GetArea((s16)curCmd.arg1, &pos1, &pos2, &pos);
pos.x = pos1.x + OtherRandInt(pos2.x - pos1.x);
@ -962,7 +963,7 @@ s32 ExecuteScriptCommand(Action *action) {
return 2;
}
case 0x5d: {
Position32 unk;
PixelPos unk;
s16 res = sub_80A7AE8((s16)curCmd.arg1);
if (res >= 0) {
sub_80A8FD8(res, &unk);
@ -973,7 +974,7 @@ s32 ExecuteScriptCommand(Action *action) {
break;
}
case 0x5e: {
Position32 pos;
PixelPos pos;
s32 height;
s32 dir;
pos.x = GetScriptVarArrayValue(NULL, POSITION_X, (u16)curCmd.arg1);
@ -992,7 +993,7 @@ s32 ExecuteScriptCommand(Action *action) {
return 2;
}
case 0x5f: {
Position32 pos;
PixelPos pos;
u32 height;
u32 wat;
s8 dir;
@ -1018,7 +1019,7 @@ s32 ExecuteScriptCommand(Action *action) {
return 2;
}
case 0x62: case 0x6a: {
Position32 pos;
PixelPos pos;
action->callbacks->getHitboxCenter(action->parentObject, &pos);
scriptData->pos2.x = pos.x + (curCmd.arg1 << 8);
scriptData->pos2.y = pos.y + (curCmd.arg2 << 8);
@ -1058,11 +1059,12 @@ s32 ExecuteScriptCommand(Action *action) {
break;
}
case 0x71: case 0x77: case 0x7d: case 0x83: {
#define HYPOT FP24_8_Hypot((s24_8){scriptData->pos2.x - scriptData->pos1.x}, (s24_8){scriptData->pos2.y - scriptData->pos1.y}).raw / curCmd.argShort
action->callbacks->getHitboxCenter(action->parentObject, &scriptData->pos1);
scriptData->pos2.x = curCmd.arg1 << 8;
scriptData->pos2.y = curCmd.arg2 << 8;
if (curCmd.op == 0x7d || curCmd.op == 0x83) {
scriptData->unk2A = sub_8009FB8(scriptData->pos2.x - scriptData->pos1.x, scriptData->pos2.y - scriptData->pos1.y) / curCmd.argShort;
scriptData->unk2A = HYPOT;
if (scriptData->unk2A <= 0) scriptData->unk2A = 1;
} else {
scriptData->unk2A = curCmd.argShort;
@ -1074,7 +1076,7 @@ s32 ExecuteScriptCommand(Action *action) {
scriptData->pos2.x = scriptData->pos1.x + (curCmd.arg1 << 8);
scriptData->pos2.y = scriptData->pos1.y + (curCmd.arg2 << 8);
if (curCmd.op == 0x7e || curCmd.op == 0x84) {
scriptData->unk2A = sub_8009FB8(scriptData->pos2.x - scriptData->pos1.x, scriptData->pos2.y - scriptData->pos1.y) / curCmd.argShort;
scriptData->unk2A = HYPOT;
if (scriptData->unk2A <= 0) scriptData->unk2A = 1;
} else {
scriptData->unk2A = curCmd.argShort;
@ -1097,7 +1099,7 @@ s32 ExecuteScriptCommand(Action *action) {
scriptData->pos2.y = scriptData->pos1.y + ((OtherRandInt(curCmd.arg2 * 2 + 1) - curCmd.arg2) << 8);
#endif
if (curCmd.op == 0x7f || curCmd.op == 0x85) {
scriptData->unk2A = sub_8009FB8(scriptData->pos2.x - scriptData->pos1.x, scriptData->pos2.y - scriptData->pos1.y) / curCmd.argShort;
scriptData->unk2A = HYPOT;
if (scriptData->unk2A <= 0) scriptData->unk2A = 1;
} else {
scriptData->unk2A = curCmd.argShort;
@ -1109,7 +1111,7 @@ s32 ExecuteScriptCommand(Action *action) {
scriptData->pos2 = scriptData->pos1;
GroundLink_GetPos((s16)curCmd.arg1, &scriptData->pos2);
if (curCmd.op == 0x80 || curCmd.op == 0x86) {
scriptData->unk2A = sub_8009FB8(scriptData->pos2.x - scriptData->pos1.x, scriptData->pos2.y - scriptData->pos1.y) / curCmd.argShort;
scriptData->unk2A = HYPOT;
if (scriptData->unk2A <= 0) scriptData->unk2A = 1;
} else {
scriptData->unk2A = curCmd.argShort;
@ -1123,7 +1125,7 @@ s32 ExecuteScriptCommand(Action *action) {
scriptData->pos2.x = scriptData->pos2.x + ((OtherRandInt(cap) - curCmd.argShort) << 8);
scriptData->pos2.y = scriptData->pos2.y + ((OtherRandInt(cap) - curCmd.argShort) << 8);
if (curCmd.op == 0x81 || curCmd.op == 0x87) {
scriptData->unk2A = sub_8009FB8(scriptData->pos2.x - scriptData->pos1.x, scriptData->pos2.y - scriptData->pos1.y) / curCmd.argShort;
scriptData->unk2A = HYPOT;
if (scriptData->unk2A <= 0) scriptData->unk2A = 1;
} else {
scriptData->unk2A = curCmd.argShort;
@ -1136,7 +1138,7 @@ s32 ExecuteScriptCommand(Action *action) {
action->callbacks->getHitboxCenter(action->parentObject, &scriptData->pos1);
sub_80A8FD8(ret, &scriptData->pos2);
if (curCmd.op == 0x82 || curCmd.op == 0x88) {
scriptData->unk2A = sub_8009FB8(scriptData->pos2.x - scriptData->pos1.x, scriptData->pos2.y - scriptData->pos1.y) / curCmd.argShort;
scriptData->unk2A = HYPOT;
if (scriptData->unk2A <= 0) scriptData->unk2A = 1;
} else {
scriptData->unk2A = curCmd.argShort;
@ -1195,7 +1197,7 @@ s32 ExecuteScriptCommand(Action *action) {
case 0x8e: case 0x8f: case 0x90: {
bool8 flag = FALSE;
s8 dir;
Position32 pos1, pos2, pos3, pos4;
PixelPos pos1, pos2, pos3, pos4;
switch (curCmd.op) {
case 0x8e: {
s32 val = (s16)sub_80A7AE8((s16)curCmd.arg1);
@ -1281,7 +1283,7 @@ s32 ExecuteScriptCommand(Action *action) {
}
case 0x99: {
s32 id = action->callbacks->getIndex(action->parentObject);
Position32 unk;
PixelPos unk;
switch(action->unk8[0]) {
case 1:
sub_80A8FD8(id, &unk);
@ -1320,7 +1322,7 @@ s32 ExecuteScriptCommand(Action *action) {
}
case 0x9c: {
s32 id = action->callbacks->getIndex(action->parentObject);
Position32 unk;
PixelPos unk;
switch(action->unk8[0]) {
case 1:
sub_80A8FD8(id, &unk);
@ -1359,7 +1361,7 @@ s32 ExecuteScriptCommand(Action *action) {
}
case 0x9f: {
s32 id = action->callbacks->getIndex(action->parentObject);
Position32 unk;
PixelPos unk;
switch(action->unk8[0]) {
case 1:
sub_80A8FD8(id, &unk);
@ -1398,7 +1400,7 @@ s32 ExecuteScriptCommand(Action *action) {
}
case 0xa2: {
s32 id = action->callbacks->getIndex(action->parentObject);
Position32 unk;
PixelPos unk;
switch(action->unk8[0]) {
case 1:
sub_80A8FD8(id, &unk);
@ -1570,7 +1572,7 @@ s32 ExecuteScriptCommand(Action *action) {
}
case 0xc0 ... 0xcb: {
s32 val;
Position32 pos, pos2, pos3;
PixelPos pos, pos2, pos3;
switch (curCmd.op) {
case 0xc0: {
val = GetScriptVarValue(scriptData->localVars.buf, curCmd.argShort);
@ -1624,7 +1626,7 @@ s32 ExecuteScriptCommand(Action *action) {
case 0xc8: {
s16 tmp = (s16)sub_80A7AE8((s16)curCmd.arg1);
if (tmp >= 0) {
Position32 pos1, pos2, pos3, pos4;
PixelPos pos1, pos2, pos3, pos4;
action->callbacks->getHitboxCenter(action->parentObject, &pos1);
action->callbacks->getSize(action->parentObject, &pos2);
sub_80A8FD8(tmp, &pos3);
@ -1641,7 +1643,7 @@ s32 ExecuteScriptCommand(Action *action) {
case 0xc9: {
s16 tmp = (s16)sub_80A7AE8((s16)curCmd.arg1);
if (tmp >= 0) {
Position32 pos1, pos2, pos3;
PixelPos pos1, pos2, pos3;
action->callbacks->getHitboxCenter(action->parentObject, &pos1);
action->callbacks->getSize(action->parentObject, &pos2);
sub_80A8FD8(tmp, &pos3);
@ -1681,6 +1683,7 @@ s32 ExecuteScriptCommand(Action *action) {
break;
}
case 0xd2 ... 0xd8: {
// DS: Assert(TRUE, "Script command call error SWITCH MENY") [sic]
const char *out = curCmd.argPtr;
gNumChoices = 0;
scriptData->branchDiscriminant = 0;
@ -1763,21 +1766,21 @@ s32 ExecuteScriptCommand(Action *action) {
case 0xe6: {
scriptData->savedScript = scriptData->script;
} //fallthrough
case 0xe7: { // ???
case 0xe7: {
scriptData->script.ptr = FindLabel(action, curCmd.argShort);
break;
}
case 0xe8: { // SAVE_AND_TRIGGER
case 0xe8: {
scriptData->savedScript = scriptData->script;
} // fallthrough
case 0xe9: { // TRIGGER
case 0xe9: {
scriptData->script.ptr2 = scriptData->script.ptr = gFunctionScriptTable[curCmd.argShort].script;
break;
}
case 0xea: { // SAVE_AND_RUN_STATION
case 0xea: {
scriptData->savedScript = scriptData->script;
} // fallthrough
case 0xeb: { // RUN_STATION
case 0xeb: {
ScriptInfoSmall info;
u32 group, sector;
u32 tmp = gUnknown_2039A34;
@ -1802,13 +1805,15 @@ s32 ExecuteScriptCommand(Action *action) {
GroundMap_ExecuteEnter(gUnknown_2039A34);
break;
}
case 0xed: { // DELETE_SAVED
case 0xed: {
// DS: if (scriptData->savedScript.ptr == NULL) Assert(FALSE, "Script flash stack error");
scriptData->savedScript.ptr = NULL;
scriptData->savedScript.ptr2 = NULL;
break;
}
case 0xee: { // RESTORE_SAVED
case 0xee: {
if (scriptData->savedScript.ptr == NULL) {
// DS: Assert(FALSE, "Script return stack error");
return 0;
}
scriptData->script = scriptData->savedScript;
@ -1817,6 +1822,7 @@ s32 ExecuteScriptCommand(Action *action) {
break;
}
case 0xef:
// DS: if (scriptData->savedScript.ptr != NULL) Assert(FALSE, "Script end stack error");
return 0;
case 0xf0:
return 1;

View File

@ -10,51 +10,41 @@ extern u32 gUnlockBranchLabels[];
extern u8 gScriptLockConds[];
extern u8 gUnknown_8116848[];
s32 GroundLivesNotifyAll(s16);
s32 GroundObjectsNotifyAll(s16);
s32 GroundEffectsNotifyAll(s16);
bool8 GroundLivesNotifyAll(s16);
bool8 GroundObjectsNotifyAll(s16);
bool8 GroundEffectsNotifyAll(s16);
// TODO: this is still WIP
void GroundScript_Unlock(void)
{
s32 index;
bool8 cond;
// void GroundScript_Unlock(void)
// {
// s32 index;
// u8 temp;
// s16 temp_s16;
//
// if(gAnyScriptLocked != 0)
// {
// gAnyScriptLocked = 0;
// for(index = 0; index < 0x81; index++)
// {
// if(gScriptLocks[index] != 0)
// {
// Log(1, gUnknown_8116848, index);
// temp = GroundMapNotifyAll(index);
// temp |= GroundLivesNotifyAll(index);
// temp |= GroundObjectsNotifyAll(index);
// temp |= GroundEffectsNotifyAll(index);
//
// if(gScriptLockConds[index] != 0)
// {
// if (temp != 0)
// {
// temp_s16 = index;
// temp_s16 |= 0x80;
// GroundMapNotifyAll(temp_s16);
// GroundLivesNotifyAll(temp_s16);
// GroundObjectsNotifyAll(temp_s16);
// GroundEffectsNotifyAll(temp_s16);
// gScriptLockConds[index] = 0;
// }
// }
// else {
// gScriptLocks[index] = 0;
// }
// }
// }
// }
// }
if(gAnyScriptLocked == 0) return;
gAnyScriptLocked = 0;
index = 0;
for (index = 0; index <= 0x80; index++) {
if(gScriptLocks[index] != 0) {
Log(1, gUnknown_8116848, index);
cond = GroundMapNotifyAll(index);
cond |= GroundLivesNotifyAll(index);
cond |= GroundObjectsNotifyAll(index);
cond |= GroundEffectsNotifyAll(index);
if(gScriptLockConds[index] != 0) {
if (cond) {
GroundMapNotifyAll(index | 0x80);
GroundLivesNotifyAll(index | 0x80);
GroundObjectsNotifyAll(index | 0x80);
GroundEffectsNotifyAll(index | 0x80);
gScriptLocks[index] = gScriptLockConds[index] = 0;
}
} else {
gScriptLocks[index] = 0;
}
}
}
}
const ScriptCommand *FindLabel(Action *action, s32 r1)
{
@ -69,12 +59,12 @@ const ScriptCommand *FindLabel(Action *action, s32 r1)
script = *scriptPtr;
scriptPtr++;
if(script.op == 0xF4)
{
if(r1 == script.argShort)
return scriptPtr;
}
if(script.op == 0xF4 && r1 == script.argShort) break;
// DS: Assert(script.op != 0, "script search label error %d", label)
// DS: Assert(script.op != 0xF6, "script search label error %d", label)
}
return scriptPtr;
}
const ScriptCommand *ResolveJump(Action *action, s32 r1)

View File

@ -3,11 +3,12 @@
#include "math.h"
#include "data/math.h"
#include "structs/str_position.h"
static void F48_16_UDiv(unkStruct_80943A8 *, unkStruct_80943A8 *, unkStruct_80943A8 *);
static void F48_16_UMul(unkStruct_80943A8 *, unkStruct_80943A8 *, unkStruct_80943A8 *);
static u24_8 u24_8_div(u24_8, u24_8);
static u24_8 u24_8_mul(u24_8, u24_8);
static void F48_16_UDiv(s48_16 *, s48_16 *, s48_16 *);
static void F48_16_UMul(s48_16 *, s48_16 *, s48_16 *);
static s24_8 u24_8_div(s24_8, s24_8);
static s24_8 u24_8_mul(s24_8, s24_8);
/**
* This function computes a value modulo 3, using a lookup table for values less
@ -32,13 +33,13 @@ s32 sin_4096(s32 x)
{
switch (x & 0xc00) {
case 0x000:
return gFastSinLookup[x & 0x3ff];
return sFastSinLookup[x & 0x3ff];
case 0x400:
return gFastSinLookup[0x3ff - (x & 0x3ff)];
return sFastSinLookup[0x3ff - (x & 0x3ff)];
case 0x800:
return -gFastSinLookup[x & 0x3ff];
return -sFastSinLookup[x & 0x3ff];
case 0xc00:
return -gFastSinLookup[0x3ff - (x & 0x3ff)];
return -sFastSinLookup[0x3ff - (x & 0x3ff)];
}
return 0;
@ -48,13 +49,13 @@ s32 cos_4096(s32 x)
{
switch (x & 0xc00) {
case 0x000:
return gFastSinLookup[0x3ff - (x & 0x3ff)];
return sFastSinLookup[0x3ff - (x & 0x3ff)];
case 0x400:
return -gFastSinLookup[x & 0x3ff];
return -sFastSinLookup[x & 0x3ff];
case 0x800:
return -gFastSinLookup[0x3ff - (x & 0x3ff)];
return -sFastSinLookup[0x3ff - (x & 0x3ff)];
case 0xc00:
return gFastSinLookup[x & 0x3ff];
return sFastSinLookup[x & 0x3ff];
}
return 0;
@ -92,25 +93,25 @@ s24_8 s24_8_mul(s24_8 x, s24_8 y)
bool8 sgn0;
bool8 sgn1;
sgn0 = x < 0;
sgn1 = y < 0;
sgn0 = x.raw < 0;
sgn1 = y.raw < 0;
if (x == 0)
return 0;
if (x.raw == 0)
return (s24_8){0};
if (y == 0)
return 0;
if (y.raw == 0)
return (s24_8){0};
if (sgn0)
x = -x;
x.raw = -x.raw;
if (sgn1)
y = -y;
y.raw = -y.raw;
ret = u24_8_mul(x, y);
if (sgn0 != sgn1)
ret = -ret;
ret.raw = -ret.raw;
return ret;
}
@ -129,25 +130,25 @@ static s24_8 s24_8_div(s24_8 x, s24_8 y)
bool8 sgn0;
bool8 sgn1;
sgn0 = x < 0;
sgn1 = y < 0;
sgn0 = x.raw < 0;
sgn1 = y.raw < 0;
if (y == 0)
return INT32_MAX;
if (y.raw == 0)
return (s24_8){INT32_MAX};
if (x == 0)
return 0;
if (x.raw == 0)
return (s24_8){0};
if (sgn0)
x = -x;
x.raw = -x.raw;
if (sgn1)
y = -y;
y.raw = -y.raw;
ret = u24_8_div(x, y);
if (sgn0 != sgn1)
ret = -ret;
ret.raw = -ret.raw;
return ret;
}
@ -160,7 +161,7 @@ static s24_8 s24_8_div(s24_8 x, s24_8 y)
*
* @return The product `x*y` as an unsigned 24.8 fixed-point number.
*/
static u24_8 u24_8_mul(u24_8 x, u24_8 y)
static s24_8 u24_8_mul(s24_8 x, s24_8 y)
{
// We need 64 bits for intermediate steps of the multiplication.
u32 x_h, x_l;
@ -171,13 +172,13 @@ static u24_8 u24_8_mul(u24_8 x, u24_8 y)
u32 high_bit_mask;
u32 round_up;
if (x == 0 || y == 0)
return 0;
if (x.raw == 0 || y.raw == 0)
return F248_ZERO;
x_h = 0;
x_l = x;
x_l = x.raw;
y_h = 0;
y_l = y;
y_l = y.raw;
out_h = 0;
out_l = 0;
high_bit_mask = 0x80 << 24; // high bit of u32
@ -215,7 +216,7 @@ static u24_8 u24_8_mul(u24_8 x, u24_8 y)
++out_l;
}
return out_l;
return (s24_8){out_l};
}
/**
@ -226,7 +227,7 @@ static u24_8 u24_8_mul(u24_8 x, u24_8 y)
*
* @return The quotient `x/y` as an unsigned 24.8 fixed-point number.
*/
static u24_8 u24_8_div(u24_8 x, u24_8 y)
static s24_8 u24_8_div(s24_8 x, s24_8 y)
{
bool8 bVar1;
u32 r9;
@ -240,15 +241,15 @@ static u24_8 u24_8_div(u24_8 x, u24_8 y)
s32 sl;
s32 temp;
if (y == 0)
return INT32_MAX;
if (y.raw == 0)
return F248_MAX;
if (x == 0)
return 0;
if (x.raw == 0)
return F248_ZERO;
r7 = x >> 24;
r6 = x << 8;
sl = y;
r7 = (u32)x.raw >> 24;
r6 = x.raw << 8;
sl = y.raw;
r9 = 0;
r5 = 0;
r4 = 0;
@ -286,19 +287,19 @@ static u24_8 u24_8_div(u24_8 x, u24_8 y)
r9 |= r8;
}
return r9;
return (s24_8){r9};
}
UNUSED s32 sub_8009F68(s32 x, s32 y)
UNUSED s24_8 FP24_8_Pow(s24_8 x, s32 y)
{
s32 uVar1;
s32 sVar1;
s24_8 sVar1;
uVar1 = y;
if (uVar1 < 0)
uVar1 = -uVar1;
sVar1 = 0x100;
sVar1 = F248_ONE;
for (; uVar1 != 0; uVar1 >>= 1) {
if (uVar1 & 1)
@ -310,37 +311,37 @@ UNUSED s32 sub_8009F68(s32 x, s32 y)
if (y >= 0)
return sVar1;
return s24_8_div(0x100, sVar1);
return s24_8_div(F248_ONE, sVar1);
}
s32 sub_8009FB8(s32 x, s32 y)
s24_8 FP24_8_Hypot(s24_8 x, s24_8 y)
{
s32 r4;
s24_8 r4;
s32 i;
s32 r5;
s32 r6;
s24_8 r5;
s24_8 r6;
r5 = x;
r6 = y;
if (r5 < 0)
r5 = -r5;
if (r5.raw < 0)
r5.raw = -r5.raw;
if (r6 < 0)
r6 = -r6;
if (r6.raw < 0)
r6.raw = -r6.raw;
if (r5 < r6) {
if (r5.raw < r6.raw) {
r4 = r5;
r5 = r6;
r6 = r4;
}
if (r6 != 0) {
if (r6.raw != 0) {
for (i = 2; i >= 0; i--) {
r4 = s24_8_div(r6, r5);
r4 = s24_8_mul(r4, r4);
r4 = s24_8_div(r4, r4 + 0x400);
r5 += s24_8_mul(r5, r4) * 2;
r4 = s24_8_div(r4, F248_Add(r4, IntToF248(4)));
r5 = F248_Add(r5, F248_MulInt(s24_8_mul(r5, r4), 2));
r6 = s24_8_mul(r6, r4);
}
}
@ -348,262 +349,260 @@ s32 sub_8009FB8(s32 x, s32 y)
return r5;
}
void sub_800A020(unkStruct_80943A8 *param_1, u32 param_2)
void FP48_16_FromS32(s48_16 *dst, s32 src)
{
#ifndef NONMATCHING
register u32 temp asm("r4");
dst->hi = (src & ~0xFFFFu) >> 16;
dst->lo = (src & 0xFFFFu) << 16;
// BUG: Should be checking top bit of src, or using dst->hi here (see FP48_16_FromF248)
#ifdef BUGFIX
if (dst->hi & 0x8000)
#else
u32 temp;
if (src & 0x8000)
#endif
temp = 0xFFFF0000;
param_1->s0 = param_2 >> 16;
param_1->s4 = param_2 << 16;
if (param_2 & 0x8000)
param_1->s0 |= temp;
dst->hi |= ~0xFFFF;
}
u32 sub_800A048(unkStruct_80943A8 *a)
u32 FP48_16_ToS32(s48_16 *a)
{
u32 uVar1;
uVar1 = ((u16)a->s0 << 16) | (a->s4 >> 16);
if (a->s4 & 0x8000)
uVar1 = ((u16) a->hi << 16) | (a->lo >> 16);
if (a->lo & 0x8000)
uVar1++;
return uVar1;
}
UNUSED u32 sub_800A068(u32 *a)
UNUSED s24_8 FP48_16_ToF248(s48_16 *a)
{
u32 uVar1;
uVar1 = ((u8)a[0] << 24) | a[1] >> 8;
if (a[1] & 0x8000)
uVar1 = ((u8)a->hi << 24) | a->lo >> 8;
if (a->lo & 0x8000)
uVar1++;
return uVar1;
return (s24_8){uVar1};
}
void sub_800A088(unkStruct_80943A8 *a, s32 b)
void FP48_16_FromF248(s48_16 *a, s24_8 b)
{
a->s4 = b << 8;
a->s0 = b >> 24;
a->lo = b.raw << 8;
a->hi = b.raw >> 24;
if (a->s0 & 0x80)
a->s0 |= ~0x7F;
if (a->hi & 0x80)
a->hi |= ~0x7F;
else
a->s0 &= 0x7f;
a->hi &= 0x7f;
}
s32 sub_800A0B0(unkStruct_80943A8 *a)
// returns 12-bit angle
s32 Atan2_4096(PixelPos *a)
{
s32 r2;
s32 r3;
s32 y;
s32 x;
s32 idx;
s32 divi;
r2 = a->s4;
r3 = a->s0;
if (r2 == 0 && r3 == 0)
y = a->y;
x = a->x;
if (y == 0 && x == 0)
return 0;
if (r2 > 0) {
if (r3 > 0) {
if (r2 < r3) {
divi = r3 / 256;
if (y > 0) {
if (x > 0) {
if (y < x) {
divi = F248ToInt((s24_8){x});
if (divi == 0)
return 0x200;
idx = r2 / divi;
idx = y / divi;
if (idx > 0xFF)
idx = 0xFF;
return gFastUnknownFn1Lookup[idx] << 4;
return sFastAtan2Lookup256[idx] << 4;
}
else { // r2 >= r3
divi = r2 / 256;
else { // y >= x
divi = F248ToInt((s24_8){y});
if (divi == 0)
return 0x200;
idx = r3 / divi;
idx = x / divi;
if (idx > 0xFF)
idx = 0xFF;
return (0x40 - gFastUnknownFn1Lookup[idx]) << 4;
return (0x40 - sFastAtan2Lookup256[idx]) << 4;
}
}
else { // r3 <= 0
r3 = -r3;
if (r2 < r3) {
divi = r3 / 256;
else { // x <= 0
x = -x;
if (y < x) {
divi = F248ToInt((s24_8){x});
if (divi == 0)
return 0x600;
idx = r2 / divi;
idx = y / divi;
if (idx > 0xFF)
idx = 0xFF;
return (0x80 - gFastUnknownFn1Lookup[idx]) << 4;
return (0x80 - sFastAtan2Lookup256[idx]) << 4;
}
else { // r2 >= r3
divi = r2 / 256;
else { // y >= x
divi = F248ToInt((s24_8){y});
if (divi == 0)
return 0x600;
idx = r3 / divi;
idx = x / divi;
if (idx > 0xFF)
idx = 0xFF;
return (gFastUnknownFn1Lookup[idx] + 0x40) << 4;
return (sFastAtan2Lookup256[idx] + 0x40) << 4;
}
}
}
else { // r2 <= 0
r2 = -r2;
if (r3 > 0) {
if (r2 < r3) {
divi = r3 / 256;
else { // y <= 0
y = -y;
if (x > 0) {
if (y < x) {
divi = F248ToInt((s24_8){x});
if (divi == 0)
return 0xE00;
idx = r2 / divi;
idx = y / divi;
if (idx > 0xFF)
idx = 0xFF;
return (0x100 - gFastUnknownFn1Lookup[idx]) << 4;
return (0x100 - sFastAtan2Lookup256[idx]) << 4;
}
else { // r2 >= r3
divi = r2 / 256;
else { // y >= x
divi = F248ToInt((s24_8){y});
if (divi == 0)
return 0xE00;
idx = r3 / divi;
idx = x / divi;
if (idx > 0xFF)
idx = 0xFF;
return (gFastUnknownFn1Lookup[idx] + 0xC0) << 4;
return (sFastAtan2Lookup256[idx] + 0xC0) << 4;
}
}
else { // r3 <= 0
r3 = -r3;
if (r2 < r3) {
divi = r3 / 256;
else { // x <= 0
x = -x;
if (y < x) {
divi = F248ToInt((s24_8){x});
if (divi == 0)
return 0xA00;
idx = r2 / divi;
idx = y / divi;
if (idx > 0xFF)
idx = 0xFF;
return (gFastUnknownFn1Lookup[idx] + 0x80) << 4;
return (sFastAtan2Lookup256[idx] + 0x80) << 4;
}
else { // r2 >= r3
divi = r2 / 256;
else { // y >= x
divi = F248ToInt((s24_8){y});
if (divi == 0)
return 0xA00;
idx = r3 / divi;
idx = x / divi;
if (idx > 0xFF)
idx = 0xFF;
return (0xC0 - gFastUnknownFn1Lookup[idx]) << 4;
return (0xC0 - sFastAtan2Lookup256[idx]) << 4;
}
}
}
}
static void F48_16_Negate(unkStruct_80943A8 *a)
static void F48_16_Negate(s48_16 *a)
{
a->s0 = ~a->s0;
a->s4 = ~a->s4 + 1;
a->hi = ~a->hi;
a->lo = ~a->lo + 1;
if (a->s4 == 0)
a->s0++;
if (a->lo == 0)
a->hi++;
}
static void F48_16_Abs(unkStruct_80943A8 *a)
static void F48_16_Abs(s48_16 *a)
{
if (a->s0 < 0) {
a->s0 = ~a->s0;
a->s4 = ~a->s4 + 1;
if (a->hi < 0) {
a->hi = ~a->hi;
a->lo = ~a->lo + 1;
if (a->s4 == 0)
a->s0++;
if (a->lo == 0)
a->hi++;
}
}
bool8 F48_16_IsZero(unkStruct_80943A8 *a)
bool8 F48_16_IsZero(s48_16 *a)
{
if (a->s0 == 0 && a->s4 == 0)
if (a->hi == 0 && a->lo == 0)
return TRUE;
return FALSE;
}
UNUSED bool8 F48_16_IsEqual(unkStruct_80943A8 *a, unkStruct_80943A8 *b)
UNUSED bool8 F48_16_IsEqual(s48_16 *a, s48_16 *b)
{
if (a->s0 == b->s0 && a->s4 == b->s4)
if (a->hi == b->hi && a->lo == b->lo)
return TRUE;
return FALSE;
}
static bool8 F48_16_IsNegative(unkStruct_80943A8 *a)
static bool8 F48_16_IsNegative(s48_16 *a)
{
if (a->s0 < 0)
if (a->hi < 0)
return TRUE;
return FALSE;
}
bool8 sub_800A2F0(unkStruct_80943A8 *a, unkStruct_80943A8 *b)
bool8 FP48_16_SLessThan(s48_16 *a, s48_16 *b)
{
s32 r1;
u32 a0;
s32 b0;
a0 = a->s0;
a0 = a->hi;
r1 = a0 >> 31;
b0 = b->s0;
b0 = b->hi;
if (b0 < 0)
r1 |= 0x2;
switch (r1) {
case 0:
default:
return u32_pair_less_than(a0, a->s4, b0, b->s4);
return u32_pair_less_than(a0, a->lo, b0, b->lo);
case 1:
return TRUE;
case 2:
return FALSE;
case 3:
return !u32_pair_less_than(a0, a->s4, b0, b->s4);
return !u32_pair_less_than(a0, a->lo, b0, b->lo);
}
}
void F48_16_SMul(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_80943A8 *b)
void F48_16_SMul(s48_16 *dst, s48_16 *a, s48_16 *b)
{
bool8 aIsNegative;
bool8 bIsNegative;
unkStruct_80943A8 aa;
unkStruct_80943A8 bb;
unkStruct_80943A8 res;
s48_16 aa;
s48_16 bb;
s48_16 res;
aa.s0 = a->s0;
aa.s4 = a->s4;
bb.s0 = b->s0;
bb.s4 = b->s4;
aa.hi = a->hi;
aa.lo = a->lo;
bb.hi = b->hi;
bb.lo = b->lo;
aIsNegative = F48_16_IsNegative(&aa);
bIsNegative = F48_16_IsNegative(&bb);
if (F48_16_IsZero(&aa)) {
dst->s0 = 0;
dst->s4 = 0;
dst->hi = 0;
dst->lo = 0;
}
else if (F48_16_IsZero(&bb)) {
dst->s0 = 0;
dst->s4 = 0;
dst->hi = 0;
dst->lo = 0;
}
else {
if (aIsNegative)
@ -616,33 +615,33 @@ void F48_16_SMul(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_80943A8
if (aIsNegative != bIsNegative)
F48_16_Negate(&res);
dst->s0 = res.s0;
dst->s4 = res.s4;
dst->hi = res.hi;
dst->lo = res.lo;
}
}
void F48_16_SDiv(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_80943A8 *b)
void F48_16_SDiv(s48_16 *dst, s48_16 *a, s48_16 *b)
{
bool8 aIsNegative;
bool8 bIsNegative;
unkStruct_80943A8 aa;
unkStruct_80943A8 bb;
unkStruct_80943A8 res;
s48_16 aa;
s48_16 bb;
s48_16 res;
aa.s0 = a->s0;
aa.s4 = a->s4;
bb.s0 = b->s0;
bb.s4 = b->s4;
aa.hi = a->hi;
aa.lo = a->lo;
bb.hi = b->hi;
bb.lo = b->lo;
aIsNegative = F48_16_IsNegative(&aa);
bIsNegative = F48_16_IsNegative(&bb);
if (F48_16_IsZero(&bb)) {
dst->s0 = INT32_MAX;
dst->s4 = UINT32_MAX;
dst->hi = INT32_MAX;
dst->lo = UINT32_MAX;
}
else if (F48_16_IsZero(&aa)) {
dst->s0 = 0;
dst->s4 = 0;
dst->hi = 0;
dst->lo = 0;
}
else {
if (aIsNegative)
@ -655,33 +654,33 @@ void F48_16_SDiv(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_80943A8
if (aIsNegative != bIsNegative)
F48_16_Negate(&res);
dst->s0 = res.s0;
dst->s4 = res.s4;
dst->hi = res.hi;
dst->lo = res.lo;
}
}
static void F48_16_Square(unkStruct_80943A8 *a)
static void F48_16_Square(s48_16 *a)
{
unkStruct_80943A8 aa;
unkStruct_80943A8 res;
s48_16 aa;
s48_16 res;
aa.s0 = a->s0;
aa.s4 = a->s4;
aa.hi = a->hi;
aa.lo = a->lo;
if (F48_16_IsZero(&aa)) {
a->s0 = 0;
a->s4 = 0;
a->hi = 0;
a->lo = 0;
}
else {
F48_16_Abs(&aa);
F48_16_UMul(&res, &aa, &aa);
a->s0 = res.s0;
a->s4 = res.s4;
a->hi = res.hi;
a->lo = res.lo;
}
}
// Regswap https://decomp.me/scratch/HNmlz
static void F48_16_UMul(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_80943A8 *b)
static void F48_16_UMul(s48_16 *dst, s48_16 *a, s48_16 *b)
{
u32 sl;
u32 r1;
@ -697,18 +696,18 @@ static void F48_16_UMul(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_
s32 i;
if (F48_16_IsZero(a)) {
dst->s0 = 0;
dst->s4 = 0;
dst->hi = 0;
dst->lo = 0;
}
else if (F48_16_IsZero(b)) {
dst->s0 = 0;
dst->s4 = 0;
dst->hi = 0;
dst->lo = 0;
}
else {
r1 = a->s0;
r4 = a->s4;
sl = b->s0;
r2 = b->s4;
r1 = a->hi;
r4 = a->lo;
sl = b->hi;
r2 = b->lo;
r6 = 0;
r5 = 0;
@ -745,13 +744,13 @@ static void F48_16_UMul(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_
if (r1 != 0)
r5++;
dst->s0 = r6;
dst->s4 = r5;
dst->hi = r6;
dst->lo = r5;
}
}
// Similar to u24_8_div
static void F48_16_UDiv(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_80943A8 *b)
static void F48_16_UDiv(s48_16 *dst, s48_16 *a, s48_16 *b)
{
s32 temp;
bool8 r1;
@ -766,18 +765,18 @@ static void F48_16_UDiv(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_
s32 i;
if (F48_16_IsZero(b)) {
dst->s0 = INT32_MAX;
dst->s4 = UINT32_MAX;
dst->hi = INT32_MAX;
dst->lo = UINT32_MAX;
}
else if (F48_16_IsZero(a)) {
dst->s0 = 0;
dst->s4 = 0;
dst->hi = 0;
dst->lo = 0;
}
else {
r7 = (a->s0 << 16) | (a->s4 >> 16);
r6 = (a->s4 << 16) | 0x8000;
sp4 = b->s0;
sp8 = b->s4;
r7 = (a->hi << 16) | (a->lo >> 16);
r6 = (a->lo << 16) | 0x8000;
sp4 = b->hi;
sp8 = b->lo;
spC = 0; // Effectively unused
r9 = 0;
r5 = 0;
@ -819,54 +818,54 @@ static void F48_16_UDiv(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_
r9 |= 0x1;
}
dst->s0 = spC;
dst->s4 = r9;
dst->hi = spC;
dst->lo = r9;
}
}
void sub_800A6D0(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_80943A8 *b)
void FP48_16_Add(s48_16 *dst, s48_16 *a, s48_16 *b)
{
s32 s0;
u32 s4;
s0 = a->s0 + b->s0;
s4 = a->s4 + b->s4;
if (s4 < a->s4)
s0 = a->hi + b->hi;
s4 = a->lo + b->lo;
if (s4 < a->lo)
s0++;
dst->s0 = s0;
dst->s4 = s4;
dst->hi = s0;
dst->lo = s4;
}
void sub_800A6F0(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_80943A8 *b)
void FP48_16_Subtract(s48_16 *dst, s48_16 *a, s48_16 *b)
{
s32 s0;
u32 s4;
s0 = a->s0 - b->s0;
s4 = a->s4 - b->s4;
if (s4 > a->s4)
s0 = a->hi - b->hi;
s4 = a->lo - b->lo;
if (s4 > a->lo)
s0--;
dst->s0 = s0;
dst->s4 = s4;
dst->hi = s0;
dst->lo = s4;
}
// Similar to sub_8009F68
UNUSED void F48_16_Pow(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, s32 b)
// Similar to FP24_8_Pow
UNUSED void F48_16_Pow(s48_16 *dst, s48_16 *a, s32 b)
{
unkStruct_80943A8 aa;
s48_16 aa;
s32 bb;
unkStruct_80943A8 res;
s48_16 res;
aa.s0 = a->s0;
aa.s4 = a->s4;
aa.hi = a->hi;
aa.lo = a->lo;
bb = b;
if (bb < 0)
bb = -bb;
res.s0 = 0;
res.s4 = 0x10000;
res.hi = 0;
res.lo = 0x10000;
for (; bb != 0; bb >>= 1) {
if (bb & 1)
@ -876,32 +875,32 @@ UNUSED void F48_16_Pow(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, s32 b)
}
if (b < 0) {
unkStruct_80943A8 idk;
idk.s0 = 0;
idk.s4 = 0x10000;
s48_16 idk;
idk.hi = 0;
idk.lo = 0x10000;
F48_16_SDiv(&res, &idk, &res);
}
dst->s0 = res.s0;
dst->s4 = res.s4;
dst->hi = res.hi;
dst->lo = res.lo;
}
// Similar to sub_8009FB8
UNUSED void sub_800A78C(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_80943A8 *b)
// Similar to FP24_8_Hypot
UNUSED void FP48_16_Hypot(s48_16 *dst, s48_16 *a, s48_16 *b)
{
u32 temp;
s32 i;
unkStruct_80943A8 sp0;
unkStruct_80943A8 sp8;
unkStruct_80943A8 sp10;
unkStruct_80943A8 sp18;
s48_16 sp0;
s48_16 sp8;
s48_16 sp10;
s48_16 sp18;
sp0 = *a;
sp8 = *b;
F48_16_Abs(&sp0);
F48_16_Abs(&sp8);
if (sub_800A2F0(&sp0, &sp8)) {
if (FP48_16_SLessThan(&sp0, &sp8)) {
sp10 = sp0;
sp0 = sp8;
sp8 = sp10;
@ -913,24 +912,24 @@ UNUSED void sub_800A78C(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_
do {
F48_16_SDiv(&sp10, &sp8, &sp0);
F48_16_Square(&sp10);
sp18.s0 = sp10.s0;
sp18.s4 = sp10.s4 + 0x40000;
sp18.hi = sp10.hi;
sp18.lo = sp10.lo + 0x40000;
if (sp18.s4 < sp10.s4)
sp18.s0++;
if (sp18.lo < sp10.lo)
sp18.hi++;
F48_16_SDiv(&sp10, &sp10, &sp18);
F48_16_SMul(&sp18, &sp0, &sp10);
sp18.s0 <<= 1;
if ((s32)sp18.s4 < 0)
sp18.s0 |= 0x1;
sp18.hi <<= 1;
if ((s32) sp18.lo < 0)
sp18.hi |= 0x1;
sp18.s4 <<= 1;
temp = sp0.s4;
sp0.s0 += sp18.s0;
sp0.s4 = temp + sp18.s4;
if (temp > sp0.s4)
sp0.s0++;
sp18.lo <<= 1;
temp = sp0.lo;
sp0.hi += sp18.hi;
sp0.lo = temp + sp18.lo;
if (temp > sp0.lo)
sp0.hi++;
if (i == 2)
break;
@ -941,4 +940,4 @@ UNUSED void sub_800A78C(unkStruct_80943A8 *dst, unkStruct_80943A8 *a, unkStruct_
}
*dst = sp0;
}
}

View File

@ -66,7 +66,7 @@ const s32 gUnknown_80D4830[9] = {
extern s16 sub_8009614(u32, u32);
static void sub_8013134(MenuInputStruct *, u32, u32);
static void sub_801332C(Position *a0);
static void sub_801332C(DungeonPos *a0);
static void sub_8013470(MenuInputStruct *);
static bool8 sub_8013DD0(unkStructFor8013AA0 *);
@ -716,8 +716,8 @@ void nullsub_34(MenuInputStructSub *a0, s32 a1)
{
}
// Maybe Position
static void sub_801332C(Position *a0)
// Maybe DungeonPos
static void sub_801332C(DungeonPos *a0)
{
SpriteOAM sp = {};
SpriteOAM* ptr;

View File

@ -183,17 +183,18 @@ void sub_8075900(Entity *pokemon, u8 r1);
extern u8 sub_8044B28(void);
extern void sub_807EC28(bool8);
extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32);
extern void sub_804652C(Entity *, Entity *, Item *, u32, Position *);
extern void sub_804652C(Entity *, Entity *, Item *, u32, DungeonPos *);
extern void CalcDamage(Entity *, Entity *, u8, u32, u32, s32 *, u32, u16, u32);
extern void sub_8045C28(Item *, u8 , u8);
static void sub_805A7D4(Entity *, Entity *, Item *, Position *);
static void sub_805A7D4(Entity *, Entity *, Item *, DungeonPos *);
extern void MudWaterSportEffect(u32);
extern void CalcDamage(Entity *, Entity *, u8, u32, u32, s32 *, u32, u16, u32);
extern void sub_806A6E8(Entity *);
extern void sub_806ABAC(Entity *, Entity *);
extern u8 sub_806F4A4(Entity *, u32);
extern void sub_807DF38(Entity *pokemon, Entity *target, Position *pos, u32, u8 moveType, s16);
extern void sub_807DF38(Entity *pokemon, Entity *target, DungeonPos *pos, u32,
u8 moveType, s16);
extern void nullsub_92(Entity *);
extern u32 sub_8055864(Entity *pokemon, Entity *target, Move *param_3, s32 param_4, s32 param_5);
extern u8 sub_807EAA0(u32, u32);
@ -332,7 +333,7 @@ bool8 VitalThrowMoveAction(Entity * pokemon, Entity * target, Move *move, s32 pa
bool8 DigMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4)
{
struct Tile *tile;
Tile *tile;
bool8 flag;
flag = FALSE;
@ -361,7 +362,7 @@ bool32 sub_8057824(Entity *pokemon, Entity *target, Move *move, s32 param_4)
bool32 sub_805783C(Entity *pokemon, Entity *target, Move *move, s32 param_4)
{
ChangeAttackMultiplierTarget(pokemon,target,gUnknown_8106A4C,0x80,TRUE);
ChangeAttackMultiplierTarget(pokemon,target,gUnknown_8106A4C,FloatToF248(0.5),TRUE);
return TRUE;
}
@ -551,7 +552,7 @@ bool8 SnoreMoveAction(Entity *pokemon, Entity *target, Move * move, u32 param_4)
bool8 sub_8057C68(Entity *pokemon, Entity *target, Move *move, s32 param_4)
{
ChangeDefenseMultiplierTarget(pokemon, target, gUnknown_8106A4C, 0x40, 1);
ChangeDefenseMultiplierTarget(pokemon, target, gUnknown_8106A4C, FloatToF248(0.25), 1);
return TRUE;
}
@ -680,7 +681,7 @@ bool8 sub_8057ED0(Entity *pokemon, Entity *target, Move *move, u32 param_4)
flag = TRUE;
if(sub_805727C(pokemon, target, gUnknown_80F4E04))
{
ChangeAttackMultiplierTarget(pokemon, target, gUnknown_8106A4C, 0x80, FALSE);
ChangeAttackMultiplierTarget(pokemon, target, gUnknown_8106A4C, FloatToF248(0.5), FALSE);
}
}
return flag;
@ -692,8 +693,8 @@ bool8 sub_8057F24(Entity *pokemon, Entity *target, Move *move, s32 param_4)
entityInfo = GetEntInfo(pokemon);
entityInfo->HP = 1;
ChangeAttackMultiplierTarget(pokemon,target,gUnknown_8106A4C,0x40,TRUE);
ChangeAttackMultiplierTarget(pokemon,target,gUnknown_8106A50,0x40,TRUE);
ChangeAttackMultiplierTarget(pokemon,target,gUnknown_8106A4C,FloatToF248(0.25),TRUE);
ChangeAttackMultiplierTarget(pokemon,target,gUnknown_8106A50,FloatToF248(0.25),TRUE);
entityInfo->unk154 = 1;
return TRUE;
}
@ -2459,7 +2460,7 @@ bool8 sub_805A464(Entity *pokemon, Entity *target, Move *move, u32 param_4)
{
bool32 flag;
Item item;
Position pos;
DungeonPos pos;
flag = FALSE;
if (HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) {
@ -2592,7 +2593,7 @@ bool8 KnockOffMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_
EntityInfo *entityInfo;
EntityInfo *targetEntityInfo;
Item heldItem;
Position pos;
DungeonPos pos;
entityInfo = GetEntInfo(pokemon);
targetEntityInfo = GetEntInfo(target);
@ -2632,7 +2633,8 @@ bool8 KnockOffMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_
}
}
static void sub_805A7D4(Entity * pokemon, Entity * target, Item *item, Position *pos)
static void sub_805A7D4(Entity * pokemon, Entity * target, Item *item,
DungeonPos *pos)
{
Entity stackEntity;
@ -2655,11 +2657,11 @@ bool8 sub_805A85C(Entity * pokemon, Entity * target, Move *move, u32 param_4)
int x;
int y;
int counter;
Position *r9;
Position pos1;
DungeonPos *r9;
DungeonPos pos1;
Move stackMove;
Position32 pos2;
struct Tile *tile;
PixelPos pos2;
Tile *tile;
Entity *entity;
s32 temp;
s32 temp2;
@ -2702,7 +2704,7 @@ _0805A8C2:
sub_803E46C(0x2c);
}
}
tile = GetTileSafe(pos1.x,pos1.y);
tile = GetTileMut(pos1.x,pos1.y);
entity = tile->monster;
if (entity != NULL) {
if (GetEntityType(entity) == ENTITY_MONSTER) {
@ -2735,9 +2737,9 @@ _0805A9FE:
_0805AA5E:
if (EntityExists(target)) {
#ifndef NOMATCHING
register Position *pos asm("r1");
register DungeonPos *pos asm("r1");
#else
Position *pos;
DungeonPos *pos;
#endif
sub_804535C(target, NULL);
pos = r9;

Some files were not shown because too many files have changed in this diff Show More