From e6eeeefc50d5e7e4578443ea1f976de694fdb852 Mon Sep 17 00:00:00 2001 From: theo3 Date: Sat, 6 Nov 2021 21:42:53 -0700 Subject: [PATCH 1/6] merge entity.c --- asm/code_08000108.s | 4 +- asm/code_0801967C.s | 6 +- asm/code_0804AA84.s | 2 +- asm/code_080526F8.s | 36 ++-- asm/code_0805436C.s | 6 +- asm/code_08054C04.s | 96 +++++----- asm/code_0805E3B0.s | 399 ----------------------------------------- asm/code_08078778.s | 4 +- asm/code_0807B9B8.s | 12 +- asm/code_0807F0D8.s | 50 +++--- asm/code_080A3BD0.s | 2 +- asm/code_080A5574.s | 4 +- asm/fileScreen.s | 28 +-- asm/getEmptyEntity.s | 8 +- asm/gyorgFemale.s | 4 +- asm/intr.s | 4 +- asm/sub_0805E248.s | 131 -------------- include/functions.h | 2 +- include/manager.h | 2 +- include/structures.h | 5 +- linker.ld | 9 +- src/arm_proxy.c | 6 +- src/code_0804AA84.c | 2 +- src/code_0808091C.c | 6 +- src/entity.c | 260 +++++++++++++++++++++++++-- src/fileScreen.c | 2 +- src/intro.c | 2 +- src/manager/managerC.c | 4 +- src/object/objectA.c | 4 +- src/room.c | 6 +- src/sub_08055E08.c | 4 +- src/sub_0805E374.c | 16 -- src/sub_0805E3A0.c | 9 - src/sub_080A3B84.c | 2 +- 34 files changed, 397 insertions(+), 740 deletions(-) delete mode 100644 asm/code_0805E3B0.s delete mode 100644 asm/sub_0805E248.s delete mode 100644 src/sub_0805E374.c delete mode 100644 src/sub_0805E3A0.c diff --git a/asm/code_08000108.s b/asm/code_08000108.s index 6034ba4e..34e292f2 100644 --- a/asm/code_08000108.s +++ b/asm/code_08000108.s @@ -82,7 +82,7 @@ _08000144EU: thumb_func_start sub_08000108 sub_08000108: @ 0x08000108 push {r4, lr} - ldr r0, _080001E8 @ =gUnk_02000070 + ldr r0, _080001E8 @ =gUpdateVisibleTiles ldrb r1, [r0] lsls r1, r1, #2 beq _08000136 @@ -195,7 +195,7 @@ sub_080001DA: @ 0x080001DA ldrh r0, [r1, r0] bx lr .align 2, 0 -_080001E8: .4byte gUnk_02000070 +_080001E8: .4byte gUpdateVisibleTiles _080001EC: .4byte gUnk_02025EB0 _080001F0: .4byte gUnk_02019EE0 _080001F4: .4byte gUnk_02021F70 diff --git a/asm/code_0801967C.s b/asm/code_0801967C.s index aec89e65..988693c1 100644 --- a/asm/code_0801967C.s +++ b/asm/code_0801967C.s @@ -47,7 +47,7 @@ sub_08019698: @ 0x08019698 ldrh r2, [r5, #0xc] adds r0, r0, r2 strh r0, [r5, #0xc] - ldr r1, _08019730 @ =gUnk_02000070 + ldr r1, _08019730 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] bl sub_08000108 @@ -89,7 +89,7 @@ _08019700: _08019724: .4byte gUnk_02032EC0 _08019728: .4byte gUnk_080B4410 _0801972C: .4byte gRoomControls -_08019730: .4byte gUnk_02000070 +_08019730: .4byte gUpdateVisibleTiles _08019734: .4byte gScreen _08019738: .4byte 0x0000FEFF _0801973C: .4byte gUnk_02018EB0 @@ -118,7 +118,7 @@ _08019760: .4byte gUnk_02018EB0 sub_08019764: @ 0x08019764 push {lr} bl FlushSprites - bl sub_0805E5C0 + bl UpdateEntities bl sub_080AD9B0 bl sub_080AD918 ldr r2, _08019798 @ =gUnk_02018EB0 diff --git a/asm/code_0804AA84.s b/asm/code_0804AA84.s index 3174946c..db72cf8c 100644 --- a/asm/code_0804AA84.s +++ b/asm/code_0804AA84.s @@ -81,7 +81,7 @@ _0804AC18: .4byte gUnk_080D4110 thumb_func_start sub_0804AC1C sub_0804AC1C: @ 0x0804AC1C push {r4, lr} - bl sub_0805E5C0 + bl UpdateEntities ldr r0, _0804AC98 @ =gUnk_02018EB0 ldr r2, [r0, #0x14] cmp r2, #0 diff --git a/asm/code_080526F8.s b/asm/code_080526F8.s index 3e2f6fc0..0fef9c40 100644 --- a/asm/code_080526F8.s +++ b/asm/code_080526F8.s @@ -1992,7 +1992,7 @@ sub_080535AC: @ 0x080535AC strh r0, [r2, #8] ldr r0, _080535E0 @ =gUnk_02032EC0 strb r1, [r0, #6] - ldr r0, _080535E4 @ =gUnk_02000070 + ldr r0, _080535E4 @ =gUpdateVisibleTiles strb r1, [r0] ldr r2, _080535E8 @ =gScreen ldrh r1, [r2] @@ -2008,7 +2008,7 @@ sub_080535AC: @ 0x080535AC .align 2, 0 _080535DC: .4byte gMenu _080535E0: .4byte gUnk_02032EC0 -_080535E4: .4byte gUnk_02000070 +_080535E4: .4byte gUpdateVisibleTiles _080535E8: .4byte gScreen _080535EC: .4byte 0x0000FEFF _080535F0: .4byte gUnk_080FCB94 @@ -2177,7 +2177,7 @@ sub_0805370C: @ 0x0805370C ldrb r0, [r1, #6] adds r0, #1 strb r0, [r1, #6] - ldr r1, _08053734 @ =gUnk_02000070 + ldr r1, _08053734 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] bl sub_08051FF0 @@ -2189,7 +2189,7 @@ sub_0805370C: @ 0x0805370C pop {pc} .align 2, 0 _08053730: .4byte gMenu -_08053734: .4byte gUnk_02000070 +_08053734: .4byte gUpdateVisibleTiles _08053738: .4byte gUnk_080FCC54 thumb_func_start sub_0805373C @@ -2642,7 +2642,7 @@ sub_08053ACC: @ 0x08053ACC ldrb r0, [r1, #6] adds r0, #1 strb r0, [r1, #6] - ldr r1, _08053AF8 @ =gUnk_02000070 + ldr r1, _08053AF8 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] bl sub_08051FF0 @@ -2655,7 +2655,7 @@ sub_08053ACC: @ 0x08053ACC pop {pc} .align 2, 0 _08053AF4: .4byte gMenu -_08053AF8: .4byte gUnk_02000070 +_08053AF8: .4byte gUpdateVisibleTiles _08053AFC: .4byte gUnk_080FCD84 thumb_func_start sub_08053B00 @@ -2727,7 +2727,7 @@ sub_08053B74: @ 0x08053B74 ldrb r0, [r1, #6] adds r0, #1 strb r0, [r1, #6] - ldr r1, _08053BA4 @ =gUnk_02000070 + ldr r1, _08053BA4 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] ldr r0, _08053BA8 @ =gUnk_080FCDE0 @@ -2741,7 +2741,7 @@ sub_08053B74: @ 0x08053B74 pop {pc} .align 2, 0 _08053BA0: .4byte gMenu -_08053BA4: .4byte gUnk_02000070 +_08053BA4: .4byte gUpdateVisibleTiles _08053BA8: .4byte gUnk_080FCDE0 thumb_func_start sub_08053BAC @@ -2814,7 +2814,7 @@ sub_08053C20: @ 0x08053C20 strb r2, [r1, #6] movs r0, #0x78 strh r0, [r1, #8] - ldr r0, _08053C54 @ =gUnk_02000070 + ldr r0, _08053C54 @ =gUpdateVisibleTiles strb r2, [r0] bl sub_08051FF0 movs r0, #4 @@ -2829,7 +2829,7 @@ sub_08053C20: @ 0x08053C20 pop {pc} .align 2, 0 _08053C50: .4byte gMenu -_08053C54: .4byte gUnk_02000070 +_08053C54: .4byte gUpdateVisibleTiles _08053C58: .4byte gUnk_080FCEBC thumb_func_start nullsub_483 @@ -2922,7 +2922,7 @@ sub_08053CC8: @ 0x08053CC8 ldr r0, _08053D2C @ =0x0000FEFF ands r0, r1 strh r0, [r2] - ldr r0, _08053D30 @ =gUnk_02000070 + ldr r0, _08053D30 @ =gUpdateVisibleTiles strb r5, [r0] movs r0, #4 movs r1, #0x10 @@ -2938,7 +2938,7 @@ _08053D20: .4byte gMenu _08053D24: .4byte gUnk_080FCF04 _08053D28: .4byte gScreen _08053D2C: .4byte 0x0000FEFF -_08053D30: .4byte gUnk_02000070 +_08053D30: .4byte gUpdateVisibleTiles thumb_func_start sub_08053D34 sub_08053D34: @ 0x08053D34 @@ -3020,7 +3020,7 @@ sub_08053DB4: @ 0x08053DB4 ldrb r1, [r4, #5] bl sub_08052FF4 bl sub_0807C740 - ldr r1, _08053E28 @ =gUnk_02000070 + ldr r1, _08053E28 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] ldr r1, _08053E2C @ =gRoomControls @@ -3058,7 +3058,7 @@ _08053E1C: .align 2, 0 _08053E20: .4byte gFadeControl _08053E24: .4byte gMenu -_08053E28: .4byte gUnk_02000070 +_08053E28: .4byte gUpdateVisibleTiles _08053E2C: .4byte gRoomControls thumb_func_start sub_08053E30 @@ -3119,7 +3119,7 @@ sub_08053E74: @ 0x08053E74 ldr r0, _08053EBC @ =0x0000FEFF ands r0, r1 strh r0, [r2] - ldr r1, _08053EC0 @ =gUnk_02000070 + ldr r1, _08053EC0 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #1 @@ -3133,7 +3133,7 @@ _08053EB0: .4byte gUnk_080FCFB8 _08053EB4: .4byte gMenu _08053EB8: .4byte gScreen _08053EBC: .4byte 0x0000FEFF -_08053EC0: .4byte gUnk_02000070 +_08053EC0: .4byte gUpdateVisibleTiles thumb_func_start sub_08053EC4 sub_08053EC4: @ 0x08053EC4 @@ -3198,7 +3198,7 @@ sub_08053F20: @ 0x08053F20 ldrb r1, [r4, #9] bl sub_08052FF4 bl sub_0807C740 - ldr r1, _08053F80 @ =gUnk_02000070 + ldr r1, _08053F80 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] ldr r1, _08053F84 @ =gRoomControls @@ -3228,7 +3228,7 @@ _08053F74: .align 2, 0 _08053F78: .4byte gFadeControl _08053F7C: .4byte gMenu -_08053F80: .4byte gUnk_02000070 +_08053F80: .4byte gUpdateVisibleTiles _08053F84: .4byte gRoomControls thumb_func_start sub_08053F88 diff --git a/asm/code_0805436C.s b/asm/code_0805436C.s index 39938d98..3e00265f 100644 --- a/asm/code_0805436C.s +++ b/asm/code_0805436C.s @@ -58,7 +58,7 @@ sub_080548E8: @ 0x080548E8 ldr r0, [r0] bl _call_via_r0 bl FlushSprites - bl sub_0805E5C0 + bl UpdateEntities bl sub_080AD9B0 bl sub_080AD918 bl UpdateScroll @@ -149,7 +149,7 @@ _080549BC: ldrb r1, [r6, #3] bl sub_08052FF4 bl sub_0807C740 - ldr r1, _08054A00 @ =gUnk_02000070 + ldr r1, _08054A00 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] _080549CE: @@ -177,7 +177,7 @@ _080549F4: bl sub_08018710 pop {r4, r5, r6, pc} .align 2, 0 -_08054A00: .4byte gUnk_02000070 +_08054A00: .4byte gUpdateVisibleTiles _08054A04: .4byte gScreen _08054A08: .4byte 0x00001FFF _08054A0C: .4byte gRoomControls diff --git a/asm/code_08054C04.s b/asm/code_08054C04.s index a097ffe5..56bd9e02 100644 --- a/asm/code_08054C04.s +++ b/asm/code_08054C04.s @@ -36,7 +36,7 @@ sub_08054C20: @ 0x08054C20 ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _08054C54 @ =gUnk_02000070 + ldr r1, _08054C54 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -45,7 +45,7 @@ sub_08054C20: @ 0x08054C20 pop {r4, pc} .align 2, 0 _08054C50: .4byte gMenu -_08054C54: .4byte gUnk_02000070 +_08054C54: .4byte gUpdateVisibleTiles thumb_func_start sub_08054C58 sub_08054C58: @ 0x08054C58 @@ -152,7 +152,7 @@ sub_08054D04: @ 0x08054D04 ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _08054D38 @ =gUnk_02000070 + ldr r1, _08054D38 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -161,7 +161,7 @@ sub_08054D04: @ 0x08054D04 pop {r4, pc} .align 2, 0 _08054D34: .4byte gMenu -_08054D38: .4byte gUnk_02000070 +_08054D38: .4byte gUpdateVisibleTiles thumb_func_start sub_08054D3C sub_08054D3C: @ 0x08054D3C @@ -246,7 +246,7 @@ sub_08054DAC: @ 0x08054DAC ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _08054DF8 @ =gUnk_02000070 + ldr r1, _08054DF8 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -256,7 +256,7 @@ sub_08054DAC: @ 0x08054DAC .align 2, 0 _08054DF0: .4byte gMenu _08054DF4: .4byte gUnk_080FEED4 -_08054DF8: .4byte gUnk_02000070 +_08054DF8: .4byte gUpdateVisibleTiles thumb_func_start nullsub_484 nullsub_484: @ 0x08054DFC @@ -297,7 +297,7 @@ sub_08054E1C: @ 0x08054E1C ldrb r0, [r5, #6] adds r0, #1 strb r0, [r5, #6] - ldr r1, _08054E58 @ =gUnk_02000070 + ldr r1, _08054E58 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -306,7 +306,7 @@ sub_08054E1C: @ 0x08054E1C pop {r4, r5, pc} .align 2, 0 _08054E54: .4byte gMenu -_08054E58: .4byte gUnk_02000070 +_08054E58: .4byte gUpdateVisibleTiles thumb_func_start sub_08054E5C sub_08054E5C: @ 0x08054E5C @@ -521,7 +521,7 @@ _08054FCA: adds r0, #1 movs r4, #0 strb r0, [r6, #6] - ldr r1, _08055010 @ =gUnk_02000070 + ldr r1, _08055010 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -544,7 +544,7 @@ _08055004: .align 2, 0 _08055008: .4byte gMenu _0805500C: .4byte gUnk_080FF108 -_08055010: .4byte gUnk_02000070 +_08055010: .4byte gUpdateVisibleTiles thumb_func_start sub_08055014 sub_08055014: @ 0x08055014 @@ -594,7 +594,7 @@ sub_08055054: @ 0x08055054 ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _08055088 @ =gUnk_02000070 + ldr r1, _08055088 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -604,7 +604,7 @@ sub_08055054: @ 0x08055054 .align 2, 0 _08055080: .4byte gUnk_080FF128 _08055084: .4byte gMenu -_08055088: .4byte gUnk_02000070 +_08055088: .4byte gUpdateVisibleTiles thumb_func_start sub_0805508C sub_0805508C: @ 0x0805508C @@ -649,7 +649,7 @@ sub_080550B0: @ 0x080550B0 ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _080550F0 @ =gUnk_02000070 + ldr r1, _080550F0 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -659,7 +659,7 @@ sub_080550B0: @ 0x080550B0 .align 2, 0 _080550E8: .4byte gMenu _080550EC: .4byte gUnk_080FF154 -_080550F0: .4byte gUnk_02000070 +_080550F0: .4byte gUpdateVisibleTiles thumb_func_start nullsub_487 nullsub_487: @ 0x080550F4 @@ -702,7 +702,7 @@ _0805512A: ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _08055160 @ =gUnk_02000070 + ldr r1, _08055160 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -714,7 +714,7 @@ _08055150: .4byte gUnk_080FF17C _08055154: .4byte gSave _08055158: .4byte 0x00000DB4 _0805515C: .4byte gMenu -_08055160: .4byte gUnk_02000070 +_08055160: .4byte gUpdateVisibleTiles thumb_func_start nullsub_488 nullsub_488: @ 0x08055164 @@ -793,7 +793,7 @@ sub_08055184: @ 0x08055184 strh r0, [r5, #8] mov r0, r8 strh r0, [r5, #0xa] - ldr r1, _08055220 @ =gUnk_02000070 + ldr r1, _08055220 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -808,7 +808,7 @@ _08055210: .4byte gUnk_080FF1D4 _08055214: .4byte gScreen _08055218: .4byte 0x00001E05 _0805521C: .4byte 0x00003648 -_08055220: .4byte gUnk_02000070 +_08055220: .4byte gUpdateVisibleTiles thumb_func_start sub_08055224 sub_08055224: @ 0x08055224 @@ -954,7 +954,7 @@ sub_08055318: @ 0x08055318 ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _0805534C @ =gUnk_02000070 + ldr r1, _0805534C @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -963,7 +963,7 @@ sub_08055318: @ 0x08055318 pop {r4, pc} .align 2, 0 _08055348: .4byte gMenu -_0805534C: .4byte gUnk_02000070 +_0805534C: .4byte gUpdateVisibleTiles thumb_func_start sub_08055350 sub_08055350: @ 0x08055350 @@ -1097,7 +1097,7 @@ sub_08055430: @ 0x08055430 ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _08055464 @ =gUnk_02000070 + ldr r1, _08055464 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -1106,7 +1106,7 @@ sub_08055430: @ 0x08055430 pop {r4, pc} .align 2, 0 _08055460: .4byte gMenu -_08055464: .4byte gUnk_02000070 +_08055464: .4byte gUpdateVisibleTiles thumb_func_start sub_08055468 sub_08055468: @ 0x08055468 @@ -1211,7 +1211,7 @@ sub_08055518: @ 0x08055518 ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _08055544 @ =gUnk_02000070 + ldr r1, _08055544 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -1220,7 +1220,7 @@ sub_08055518: @ 0x08055518 pop {r4, pc} .align 2, 0 _08055540: .4byte gMenu -_08055544: .4byte gUnk_02000070 +_08055544: .4byte gUpdateVisibleTiles thumb_func_start sub_08055548 sub_08055548: @ 0x08055548 @@ -1308,7 +1308,7 @@ sub_080555B8: @ 0x080555B8 ldrb r0, [r5, #6] adds r0, #1 strb r0, [r5, #6] - ldr r1, _08055608 @ =gUnk_02000070 + ldr r1, _08055608 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -1318,7 +1318,7 @@ sub_080555B8: @ 0x080555B8 .align 2, 0 _08055600: .4byte gMenu _08055604: .4byte gUnk_0811E454 -_08055608: .4byte gUnk_02000070 +_08055608: .4byte gUpdateVisibleTiles thumb_func_start sub_0805560C sub_0805560C: @ 0x0805560C @@ -1414,7 +1414,7 @@ sub_080556AC: @ 0x080556AC ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _080556E8 @ =gUnk_02000070 + ldr r1, _080556E8 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] ldr r1, [r4, #0xc] @@ -1434,7 +1434,7 @@ sub_080556AC: @ 0x080556AC pop {r4, pc} .align 2, 0 _080556E4: .4byte gMenu -_080556E8: .4byte gUnk_02000070 +_080556E8: .4byte gUpdateVisibleTiles _080556EC: .4byte gUnk_080FF264 thumb_func_start nullsub_489 @@ -1486,7 +1486,7 @@ _08055734: ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _08055768 @ =gUnk_02000070 + ldr r1, _08055768 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -1497,7 +1497,7 @@ _08055734: _0805575C: .4byte gMenu _08055760: .4byte gUnk_080FEE48 _08055764: .4byte 0x000080FF -_08055768: .4byte gUnk_02000070 +_08055768: .4byte gUpdateVisibleTiles thumb_func_start sub_0805576C sub_0805576C: @ 0x0805576C @@ -1562,7 +1562,7 @@ sub_080557D0: @ 0x080557D0 ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _0805580C @ =gUnk_02000070 + ldr r1, _0805580C @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] ldr r1, [r4, #0xc] @@ -1582,7 +1582,7 @@ sub_080557D0: @ 0x080557D0 pop {r4, pc} .align 2, 0 _08055808: .4byte gMenu -_0805580C: .4byte gUnk_02000070 +_0805580C: .4byte gUpdateVisibleTiles _08055810: .4byte gUnk_080FF298 thumb_func_start nullsub_490 @@ -1626,7 +1626,7 @@ _0805584A: ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _08055880 @ =gUnk_02000070 + ldr r1, _08055880 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -1638,7 +1638,7 @@ _08055870: .4byte gUnk_080FF2C0 _08055874: .4byte gSave _08055878: .4byte 0x00000DB4 _0805587C: .4byte gMenu -_08055880: .4byte gUnk_02000070 +_08055880: .4byte gUpdateVisibleTiles thumb_func_start nullsub_491 nullsub_491: @ 0x08055884 @@ -1678,7 +1678,7 @@ sub_080558A4: @ 0x080558A4 ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _080558E4 @ =gUnk_02000070 + ldr r1, _080558E4 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -1688,7 +1688,7 @@ sub_080558A4: @ 0x080558A4 .align 2, 0 _080558DC: .4byte gMenu _080558E0: .4byte gUnk_080FF308 -_080558E4: .4byte gUnk_02000070 +_080558E4: .4byte gUpdateVisibleTiles thumb_func_start nullsub_492 nullsub_492: @ 0x080558E8 @@ -1729,7 +1729,7 @@ sub_08055908: @ 0x08055908 ldrb r0, [r5, #6] adds r0, #1 strb r0, [r5, #6] - ldr r1, _08055944 @ =gUnk_02000070 + ldr r1, _08055944 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -1738,7 +1738,7 @@ sub_08055908: @ 0x08055908 pop {r4, r5, pc} .align 2, 0 _08055940: .4byte gMenu -_08055944: .4byte gUnk_02000070 +_08055944: .4byte gUpdateVisibleTiles thumb_func_start sub_08055948 sub_08055948: @ 0x08055948 @@ -1854,7 +1854,7 @@ _08055A0E: ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _08055A38 @ =gUnk_02000070 + ldr r1, _08055A38 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -1864,7 +1864,7 @@ _08055A0E: .align 2, 0 _08055A30: .4byte gMenu _08055A34: .4byte gUnk_080FF33C -_08055A38: .4byte gUnk_02000070 +_08055A38: .4byte gUpdateVisibleTiles thumb_func_start sub_08055A3C sub_08055A3C: @ 0x08055A3C @@ -1981,7 +1981,7 @@ _08055B14: ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _08055B34 @ =gUnk_02000070 + ldr r1, _08055B34 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -1991,7 +1991,7 @@ _08055B14: .align 2, 0 _08055B2C: .4byte gMenu _08055B30: .4byte gUnk_080FED18 -_08055B34: .4byte gUnk_02000070 +_08055B34: .4byte gUpdateVisibleTiles thumb_func_start sub_08055B38 sub_08055B38: @ 0x08055B38 @@ -2090,7 +2090,7 @@ sub_08055BCC: @ 0x08055BCC ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _08055C00 @ =gUnk_02000070 + ldr r1, _08055C00 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -2099,7 +2099,7 @@ sub_08055BCC: @ 0x08055BCC pop {r4, pc} .align 2, 0 _08055BFC: .4byte gMenu -_08055C00: .4byte gUnk_02000070 +_08055C00: .4byte gUpdateVisibleTiles thumb_func_start sub_08055C04 sub_08055C04: @ 0x08055C04 @@ -2237,7 +2237,7 @@ sub_08055CF4: @ 0x08055CF4 ldrb r0, [r4, #6] adds r0, #1 strb r0, [r4, #6] - ldr r1, _08055D28 @ =gUnk_02000070 + ldr r1, _08055D28 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -2246,7 +2246,7 @@ sub_08055CF4: @ 0x08055CF4 pop {r4, pc} .align 2, 0 _08055D24: .4byte gMenu -_08055D28: .4byte gUnk_02000070 +_08055D28: .4byte gUpdateVisibleTiles thumb_func_start sub_08055D2C sub_08055D2C: @ 0x08055D2C @@ -2316,7 +2316,7 @@ sub_08055D9C: @ 0x08055D9C ldrb r0, [r1, #6] adds r0, #1 strb r0, [r1, #6] - ldr r1, _08055DBC @ =gUnk_02000070 + ldr r1, _08055DBC @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] movs r0, #4 @@ -2325,7 +2325,7 @@ sub_08055D9C: @ 0x08055D9C pop {pc} .align 2, 0 _08055DB8: .4byte gMenu -_08055DBC: .4byte gUnk_02000070 +_08055DBC: .4byte gUpdateVisibleTiles thumb_func_start sub_08055DC0 sub_08055DC0: @ 0x08055DC0 diff --git a/asm/code_0805E3B0.s b/asm/code_0805E3B0.s deleted file mode 100644 index 4c6580c8..00000000 --- a/asm/code_0805E3B0.s +++ /dev/null @@ -1,399 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_0805E3B0 -sub_0805E3B0: @ 0x0805E3B0 - push {lr} - adds r3, r0, #0 - ldrb r1, [r3, #0x10] - movs r0, #0x10 - ands r0, r1 - cmp r0, #0 - beq _0805E3C2 - movs r0, #1 - b _0805E404 -_0805E3C2: - ldrb r0, [r3, #0xc] - cmp r0, #0 - bne _0805E3CC - movs r0, #0 - b _0805E404 -_0805E3CC: - ldr r1, _0805E3DC @ =gUnk_03003DC0 - ldrb r0, [r1] - ldrb r2, [r1, #1] - cmp r0, r2 - bls _0805E3E0 - adds r2, r0, #0 - b _0805E3E2 - .align 2, 0 -_0805E3DC: .4byte gUnk_03003DC0 -_0805E3E0: - ldrb r2, [r1, #1] -_0805E3E2: - ldr r0, _0805E408 @ =gMessage - ldrb r1, [r0] - movs r0, #0x7f - ands r0, r1 - cmp r0, #0 - beq _0805E3F4 - cmp r2, #2 - bhs _0805E3F4 - movs r2, #2 -_0805E3F4: - movs r1, #0 - ldrb r0, [r3, #0x11] - lsls r0, r0, #0x1c - lsrs r0, r0, #0x1c - cmp r2, r0 - bls _0805E402 - movs r1, #1 -_0805E402: - adds r0, r1, #0 -_0805E404: - pop {pc} - .align 2, 0 -_0805E408: .4byte gMessage - - thumb_func_start sub_0805E40C -sub_0805E40C: @ 0x0805E40C - push {lr} - ldr r1, _0805E424 @ =gUnk_03003DC0 - ldrb r0, [r1] - ldrb r2, [r1, #1] - cmp r0, r2 - bhi _0805E41A - ldrb r0, [r1, #1] -_0805E41A: - cmp r0, #0 - beq _0805E420 - movs r0, #1 -_0805E420: - pop {pc} - .align 2, 0 -_0805E424: .4byte gUnk_03003DC0 - - thumb_func_start sub_0805E428 -sub_0805E428: @ 0x0805E428 - push {lr} - bl sub_0805E524 - ldr r2, _0805E440 @ =gUnk_03003DC0 - ldrb r3, [r2, #2] - adds r1, r3, #0 - cmp r1, #0 - beq _0805E444 - movs r0, #0 - strb r3, [r2, #1] - strb r0, [r2, #2] - b _0805E44E - .align 2, 0 -_0805E440: .4byte gUnk_03003DC0 -_0805E444: - ldrb r0, [r2, #3] - cmp r0, #0 - beq _0805E44E - strb r1, [r2, #3] - strb r1, [r2, #1] -_0805E44E: - pop {pc} - - thumb_func_start sub_0805E450 -sub_0805E450: @ 0x0805E450 - push {lr} - ldr r1, _0805E464 @ =gUnk_03003DC0 - ldrb r2, [r1, #2] - cmp r0, r2 - blo _0805E460 - ldrb r2, [r1, #1] - cmp r0, r2 - bhs _0805E468 -_0805E460: - movs r0, #0 - b _0805E46C - .align 2, 0 -_0805E464: .4byte gUnk_03003DC0 -_0805E468: - strb r0, [r1, #2] - movs r0, #1 -_0805E46C: - pop {pc} - .align 2, 0 - - thumb_func_start sub_0805E470 -sub_0805E470: @ 0x0805E470 - ldr r1, _0805E478 @ =gUnk_03003DC0 - movs r0, #1 - strb r0, [r1, #3] - bx lr - .align 2, 0 -_0805E478: .4byte gUnk_03003DC0 - - thumb_func_start sub_0805E47C -sub_0805E47C: @ 0x0805E47C - push {r4, lr} - adds r4, r0, #0 - ldrb r0, [r4, #0x11] - lsls r0, r0, #0x1c - lsrs r0, r0, #0x18 - movs r1, #2 - orrs r0, r1 - strb r0, [r4, #0x11] - movs r0, #2 - bl sub_0805E450 - cmp r0, #0 - beq _0805E49A - ldr r0, _0805E49C @ =gUnk_03003DC0 - str r4, [r0, #4] -_0805E49A: - pop {r4, pc} - .align 2, 0 -_0805E49C: .4byte gUnk_03003DC0 - - thumb_func_start sub_0805E4A0 -sub_0805E4A0: @ 0x0805E4A0 - push {r4, lr} - adds r4, r0, #0 - movs r0, #1 - bl sub_08078A90 - ldrb r0, [r4, #0x11] - lsls r0, r0, #0x1c - lsrs r0, r0, #0x18 - movs r1, #3 - orrs r0, r1 - strb r0, [r4, #0x11] - movs r0, #1 - bl sub_0805E450 - cmp r0, #0 - beq _0805E4C4 - ldr r0, _0805E4C8 @ =gUnk_03003DC0 - str r4, [r0, #4] -_0805E4C4: - pop {r4, pc} - .align 2, 0 -_0805E4C8: .4byte gUnk_03003DC0 - - thumb_func_start sub_0805E4CC -sub_0805E4CC: @ 0x0805E4CC - push {r4, lr} - adds r4, r0, #0 - movs r0, #0 - bl sub_08078A90 - adds r0, r4, #0 - bl sub_0805E584 - pop {r4, pc} - .align 2, 0 - - thumb_func_start sub_0805E4E0 -sub_0805E4E0: @ 0x0805E4E0 - push {r4, r5, lr} - adds r4, r0, #0 - adds r5, r1, #0 - cmp r4, #0 - beq _0805E4F6 - ldrb r0, [r4, #0x11] - lsls r0, r0, #0x1c - lsrs r0, r0, #0x18 - movs r1, #3 - orrs r0, r1 - strb r0, [r4, #0x11] -_0805E4F6: - movs r0, #1 - bl sub_0805E450 - cmp r0, #0 - beq _0805E504 - ldr r0, _0805E50C @ =gUnk_03003DC0 - str r4, [r0, #4] -_0805E504: - adds r0, r5, #0 - bl sub_0805E510 - pop {r4, r5, pc} - .align 2, 0 -_0805E50C: .4byte gUnk_03003DC0 - - thumb_func_start sub_0805E510 -sub_0805E510: @ 0x0805E510 - push {lr} - adds r1, r0, #0 - ldr r2, _0805E520 @ =gUnk_03003DC0 - ldrh r0, [r2, #8] - cmp r0, r1 - bhs _0805E51E - strh r1, [r2, #8] -_0805E51E: - pop {pc} - .align 2, 0 -_0805E520: .4byte gUnk_03003DC0 - - thumb_func_start sub_0805E524 -sub_0805E524: @ 0x0805E524 - push {lr} - ldr r1, _0805E540 @ =gUnk_03003DC0 - ldrh r0, [r1, #8] - cmp r0, #0 - beq _0805E53C - subs r0, #1 - strh r0, [r1, #8] - lsls r0, r0, #0x10 - cmp r0, #0 - bne _0805E53C - bl sub_0805E470 -_0805E53C: - pop {pc} - .align 2, 0 -_0805E540: .4byte gUnk_03003DC0 - - thumb_func_start sub_0805E544 -sub_0805E544: @ 0x0805E544 - ldr r1, _0805E55C @ =gUnk_03003DC0 - movs r3, #6 - movs r0, #6 - strb r0, [r1] - ldr r2, _0805E560 @ =gPlayerEntity - ldrb r1, [r2, #0x11] - subs r0, #0x16 - ands r0, r1 - orrs r0, r3 - strb r0, [r2, #0x11] - bx lr - .align 2, 0 -_0805E55C: .4byte gUnk_03003DC0 -_0805E560: .4byte gPlayerEntity - - thumb_func_start UnfreezeTime -UnfreezeTime: @ 0x0805E564 - ldr r1, _0805E57C @ =gUnk_03003DC0 - movs r0, #0 - strb r0, [r1] - ldr r2, _0805E580 @ =gPlayerEntity - ldrb r1, [r2, #0x11] - subs r0, #0x10 - ands r0, r1 - movs r1, #1 - orrs r0, r1 - strb r0, [r2, #0x11] - bx lr - .align 2, 0 -_0805E57C: .4byte gUnk_03003DC0 -_0805E580: .4byte gPlayerEntity - - thumb_func_start sub_0805E584 -sub_0805E584: @ 0x0805E584 - push {lr} - ldrb r2, [r0, #0x11] - lsrs r3, r2, #4 - movs r1, #0x10 - rsbs r1, r1, #0 - ands r1, r2 - orrs r1, r3 - strb r1, [r0, #0x11] - bl sub_0805E470 - pop {pc} - .align 2, 0 - - thumb_func_start sub_0805E59C -sub_0805E59C: @ 0x0805E59C - ldr r1, _0805E5A4 @ =gUnk_03003DC0 - movs r0, #6 - strb r0, [r1] - bx lr - .align 2, 0 -_0805E5A4: .4byte gUnk_03003DC0 - - thumb_func_start sub_0805E5A8 -sub_0805E5A8: @ 0x0805E5A8 - ldr r1, _0805E5B0 @ =gUnk_03003DC0 - movs r0, #7 - strb r0, [r1] - bx lr - .align 2, 0 -_0805E5B0: .4byte gUnk_03003DC0 - - thumb_func_start sub_0805E5B4 -sub_0805E5B4: @ 0x0805E5B4 - ldr r1, _0805E5BC @ =gUnk_03003DC0 - movs r0, #0 - strb r0, [r1] - bx lr - .align 2, 0 -_0805E5BC: .4byte gUnk_03003DC0 - - thumb_func_start sub_0805E5C0 -sub_0805E5C0: @ 0x0805E5C0 - push {lr} - ldr r0, _0805E5F0 @ =gRoomVars - ldrb r1, [r0, #4] - movs r2, #0 - strb r1, [r0, #5] - strb r2, [r0, #4] - bl sub_0805ED30 - bl sub_0805E428 - bl ClearHitboxList - bl sub_0806F0A4 - ldr r1, _0805E5F4 @ =_UpdateEntities - movs r0, #0 - bl _call_via_r1 - bl ClearAllDeletedEntities - bl sub_0805EE88 - pop {pc} - .align 2, 0 -_0805E5F0: .4byte gRoomVars -_0805E5F4: .4byte _UpdateEntities - - thumb_func_start sub_0805E5F8 -sub_0805E5F8: @ 0x0805E5F8 - push {lr} - ldr r1, _0805E608 @ =_UpdateEntities - movs r0, #1 - bl _call_via_r1 - bl ClearAllDeletedEntities - pop {pc} - .align 2, 0 -_0805E608: .4byte _UpdateEntities - - thumb_func_start EraseAllEntities -EraseAllEntities: @ 0x0805E60C - push {lr} - bl DeleteAllEntities - ldr r0, _0805E654 @ =gUnk_03003DC0 - movs r1, #0xc - bl MemClear - ldr r0, _0805E658 @ =gPlayerEntity - movs r1, #0xaa - lsls r1, r1, #6 - bl MemClear - ldr r0, _0805E65C @ =gUnk_02033290 - movs r1, #0x80 - lsls r1, r1, #4 - bl MemClear - bl sub_0805E98C - ldr r0, _0805E660 @ =gEntCount - movs r1, #0 - strb r1, [r0] - ldr r0, _0805E664 @ =gManagerCount - strb r1, [r0] - ldr r1, _0805E668 @ =gUnk_03000000 - ldr r2, _0805E66C @ =0x00000427 - adds r0, r1, r2 - movs r2, #1 - strb r2, [r0] - ldr r3, _0805E670 @ =0x00000426 - adds r0, r1, r3 - strb r2, [r0] - ldr r0, _0805E674 @ =0x0000042E - adds r1, r1, r0 - strb r2, [r1] - pop {pc} - .align 2, 0 -_0805E654: .4byte gUnk_03003DC0 -_0805E658: .4byte gPlayerEntity -_0805E65C: .4byte gUnk_02033290 -_0805E660: .4byte gEntCount -_0805E664: .4byte gManagerCount -_0805E668: .4byte gUnk_03000000 -_0805E66C: .4byte 0x00000427 -_0805E670: .4byte 0x00000426 -_0805E674: .4byte 0x0000042E diff --git a/asm/code_08078778.s b/asm/code_08078778.s index c470b6d6..23d386fa 100644 --- a/asm/code_08078778.s +++ b/asm/code_08078778.s @@ -5810,7 +5810,7 @@ _0807B3C8: ldrh r0, [r0] cmp r0, #1 beq _0807B430 - ldr r1, _0807B40C @ =gUnk_02000070 + ldr r1, _0807B40C @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] b _0807B430 @@ -5818,7 +5818,7 @@ _0807B3C8: _0807B400: .4byte gMapDataTopSpecial _0807B404: .4byte 0x00007004 _0807B408: .4byte gRoomControls -_0807B40C: .4byte gUnk_02000070 +_0807B40C: .4byte gUpdateVisibleTiles _0807B410: ldr r0, _0807B424 @ =0x00003FFF cmp r5, r0 diff --git a/asm/code_0807B9B8.s b/asm/code_0807B9B8.s index 59896509..33572525 100644 --- a/asm/code_0807B9B8.s +++ b/asm/code_0807B9B8.s @@ -95,7 +95,7 @@ _0807BA44: ldrh r0, [r0] cmp r0, #1 beq _0807BA78 - ldr r1, _0807BA88 @ =gUnk_02000070 + ldr r1, _0807BA88 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] _0807BA78: @@ -104,7 +104,7 @@ _0807BA78: _0807BA7C: .4byte gMapDataTopSpecial _0807BA80: .4byte 0x00007004 _0807BA84: .4byte gRoomControls -_0807BA88: .4byte gUnk_02000070 +_0807BA88: .4byte gUpdateVisibleTiles thumb_func_start sub_0807BA8C sub_0807BA8C: @ 0x0807BA8C @@ -197,7 +197,7 @@ _0807BB20: ldrh r0, [r0] cmp r0, #1 beq _0807BB54 - ldr r1, _0807BB64 @ =gUnk_02000070 + ldr r1, _0807BB64 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] _0807BB54: @@ -206,7 +206,7 @@ _0807BB54: _0807BB58: .4byte gMapDataTopSpecial _0807BB5C: .4byte 0x00007004 _0807BB60: .4byte gRoomControls -_0807BB64: .4byte gUnk_02000070 +_0807BB64: .4byte gUpdateVisibleTiles thumb_func_start sub_0807BB68 sub_0807BB68: @ 0x0807BB68 @@ -1847,14 +1847,14 @@ sub_0807C810: @ 0x0807C810 adds r1, r1, r0 strh r1, [r6, #0x32] bl sub_080809D4 - ldr r0, _0807C85C @ =gUnk_02000070 + ldr r0, _0807C85C @ =gUpdateVisibleTiles strb r5, [r0] pop {r4, r5, r6, pc} .align 2, 0 _0807C850: .4byte gUnk_03004030 _0807C854: .4byte gPlayerEntity _0807C858: .4byte gRoomControls -_0807C85C: .4byte gUnk_02000070 +_0807C85C: .4byte gUpdateVisibleTiles thumb_func_start sub_0807C860 sub_0807C860: @ 0x0807C860 diff --git a/asm/code_0807F0D8.s b/asm/code_0807F0D8.s index 3c9a2658..df197ed3 100644 --- a/asm/code_0807F0D8.s +++ b/asm/code_0807F0D8.s @@ -79,7 +79,7 @@ _0807FCBC: subs r0, r7, r3 cmp r0, #0 bgt _0807FCCE - ldr r1, _0807FCD8 @ =gUnk_02000070 + ldr r1, _0807FCD8 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] _0807FCCE: @@ -89,7 +89,7 @@ _0807FCCE: blt _0807FD16 b _0807FD14 .align 2, 0 -_0807FCD8: .4byte gUnk_02000070 +_0807FCD8: .4byte gUpdateVisibleTiles _0807FCDC: ldrh r0, [r2, #6] ldrh r1, [r2, #0x1e] @@ -113,7 +113,7 @@ _0807FCFC: subs r0, r7, r3 cmp r0, #7 ble _0807FD0C - ldr r1, _0807FD68 @ =gUnk_02000070 + ldr r1, _0807FD68 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] _0807FD0C: @@ -158,7 +158,7 @@ _0807FD4C: subs r0, r7, r3 cmp r0, #0 bgt _0807FD5E - ldr r1, _0807FD68 @ =gUnk_02000070 + ldr r1, _0807FD68 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] _0807FD5E: @@ -168,7 +168,7 @@ _0807FD5E: blt _0807FDA6 b _0807FDA4 .align 2, 0 -_0807FD68: .4byte gUnk_02000070 +_0807FD68: .4byte gUpdateVisibleTiles _0807FD6C: ldrh r0, [r2, #8] ldrh r1, [r2, #0x20] @@ -192,7 +192,7 @@ _0807FD8C: subs r0, r7, r3 cmp r0, #7 ble _0807FD9C - ldr r1, _0807FDAC @ =gUnk_02000070 + ldr r1, _0807FDAC @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] _0807FD9C: @@ -206,7 +206,7 @@ _0807FDA6: bl sub_08080BC4 pop {r4, r5, r6, r7, pc} .align 2, 0 -_0807FDAC: .4byte gUnk_02000070 +_0807FDAC: .4byte gUpdateVisibleTiles thumb_func_start sub_0807FDB0 sub_0807FDB0: @ 0x0807FDB0 @@ -225,7 +225,7 @@ _0807FDC4: .4byte gUnk_0811E780 sub_0807FDC8: @ 0x0807FDC8 push {r4, r5, lr} adds r5, r0, #0 - ldr r4, _0807FDE0 @ =gUnk_02000070 + ldr r4, _0807FDE0 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r4] bl sub_08000108 @@ -235,7 +235,7 @@ sub_0807FDC8: @ 0x0807FDC8 strb r1, [r4] pop {r4, r5, pc} .align 2, 0 -_0807FDE0: .4byte gUnk_02000070 +_0807FDE0: .4byte gUpdateVisibleTiles thumb_func_start sub_0807FDE4 sub_0807FDE4: @ 0x0807FDE4 @@ -243,17 +243,17 @@ sub_0807FDE4: @ 0x0807FDE4 movs r1, #2 strb r1, [r0, #3] strh r2, [r0, #0x18] - ldr r0, _0807FDF4 @ =gUnk_02000070 + ldr r0, _0807FDF4 @ =gUpdateVisibleTiles strb r1, [r0] bx lr .align 2, 0 -_0807FDF4: .4byte gUnk_02000070 +_0807FDF4: .4byte gUpdateVisibleTiles thumb_func_start sub_0807FDF8 sub_0807FDF8: @ 0x0807FDF8 push {r4, lr} adds r4, r0, #0 - ldr r1, _0807FE18 @ =gUnk_02000070 + ldr r1, _0807FE18 @ =gUpdateVisibleTiles movs r0, #2 strb r0, [r1] ldrh r0, [r4, #0x18] @@ -268,7 +268,7 @@ sub_0807FDF8: @ 0x0807FDF8 beq _0807FE26 b _0807FEB6 .align 2, 0 -_0807FE18: .4byte gUnk_02000070 +_0807FE18: .4byte gUpdateVisibleTiles _0807FE1C: cmp r0, #2 beq _0807FE68 @@ -400,12 +400,12 @@ sub_0807FF08: @ 0x0807FF08 movs r1, #1 strb r1, [r0, #3] strh r2, [r0, #0x18] - ldr r1, _0807FF18 @ =gUnk_02000070 + ldr r1, _0807FF18 @ =gUpdateVisibleTiles movs r0, #3 strb r0, [r1] bx lr .align 2, 0 -_0807FF18: .4byte gUnk_02000070 +_0807FF18: .4byte gUpdateVisibleTiles thumb_func_start sub_0807FF1C sub_0807FF1C: @ 0x0807FF1C @@ -417,7 +417,7 @@ sub_0807FF1C: @ 0x0807FF1C ands r0, r1 cmp r0, #0 bne _0807FF48 - ldr r1, _0807FF50 @ =gUnk_02000070 + ldr r1, _0807FF50 @ =gUpdateVisibleTiles movs r0, #3 strb r0, [r1] ldrh r0, [r2, #0x18] @@ -434,7 +434,7 @@ _0807FF48: pop {pc} .align 2, 0 _0807FF4C: .4byte gScreenTransition -_0807FF50: .4byte gUnk_02000070 +_0807FF50: .4byte gUpdateVisibleTiles thumb_func_start sub_0807FF54 sub_0807FF54: @ 0x0807FF54 @@ -642,13 +642,13 @@ _080800F0: .4byte gScreen _080800F4: .4byte gUnk_08109194 _080800F8: .4byte gUnk_03004030 _080800FC: - ldr r1, _08080104 @ =gUnk_02000070 + ldr r1, _08080104 @ =gUpdateVisibleTiles movs r0, #4 strb r0, [r1] _08080102: pop {r4, r5, r6, r7, pc} .align 2, 0 -_08080104: .4byte gUnk_02000070 +_08080104: .4byte gUpdateVisibleTiles thumb_func_start sub_08080108 sub_08080108: @ 0x08080108 @@ -717,12 +717,12 @@ sub_08080198: @ 0x08080198 strh r1, [r0, #0x1c] bl LoadRoom bl sub_0804AFF4 - ldr r0, _080801B8 @ =gUnk_02000070 + ldr r0, _080801B8 @ =gUpdateVisibleTiles strb r4, [r0] bl sub_080805F8 pop {r4, pc} .align 2, 0 -_080801B8: .4byte gUnk_02000070 +_080801B8: .4byte gUpdateVisibleTiles thumb_func_start sub_080801BC sub_080801BC: @ 0x080801BC @@ -815,7 +815,7 @@ _08080232: _08080260: .4byte gScreen _08080264: .4byte 0x0000BFFF _08080268: - ldr r0, _08080274 @ =gUnk_02000070 + ldr r0, _08080274 @ =gUpdateVisibleTiles movs r1, #4 strb r1, [r0] movs r0, #0 @@ -823,7 +823,7 @@ _08080268: _08080272: pop {r4, r5, r6, r7, pc} .align 2, 0 -_08080274: .4byte gUnk_02000070 +_08080274: .4byte gUpdateVisibleTiles thumb_func_start sub_08080278 sub_08080278: @ 0x08080278 @@ -987,7 +987,7 @@ _080803A2: cmp r4, r6 blo _080803A2 _080803B8: - ldr r1, _080803CC @ =gUnk_02000070 + ldr r1, _080803CC @ =gUpdateVisibleTiles movs r0, #0 strb r0, [r1] _080803BE: @@ -996,7 +996,7 @@ _080803BE: _080803C0: .4byte gUnk_020246B0 _080803C4: .4byte gUnk_02034480 _080803C8: .4byte 0x00000FFF -_080803CC: .4byte gUnk_02000070 +_080803CC: .4byte gUpdateVisibleTiles thumb_func_start sub_080803D0 sub_080803D0: @ 0x080803D0 diff --git a/asm/code_080A3BD0.s b/asm/code_080A3BD0.s index 80f40961..47338cc4 100644 --- a/asm/code_080A3BD0.s +++ b/asm/code_080A3BD0.s @@ -1337,7 +1337,7 @@ _080A45D0: ldr r0, [r0] bl _call_via_r0 _080A45E0: - bl sub_0805E5C0 + bl UpdateEntities bl sub_0801C1D4 bl sub_0801C208 bl sub_080AD9B0 diff --git a/asm/code_080A5574.s b/asm/code_080A5574.s index bab14c4d..993c4fa5 100644 --- a/asm/code_080A5574.s +++ b/asm/code_080A5574.s @@ -5120,8 +5120,8 @@ sub_080A74F4: @ 0x080A74F4 movs r0, #0 strb r0, [r1, #0xb] bl FlushSprites - bl sub_0805E5C0 - bl sub_0805E5F8 + bl UpdateEntities + bl UpdateManagers bl sub_0801C344 bl sub_0801C208 bl sub_08078CB4 diff --git a/asm/fileScreen.s b/asm/fileScreen.s index 06c15115..ba9cbbfd 100755 --- a/asm/fileScreen.s +++ b/asm/fileScreen.s @@ -202,7 +202,7 @@ _08051AEC: .4byte gScreenTransition sub_08051AF0: @ 0x08051AF0 .ifdef EU push {r4, lr} - bl sub_0805E5C0 + bl UpdateEntities bl sub_0805BBBC cmp r0, #0 bne _0805173E @@ -211,7 +211,7 @@ _0805173E: bl UpdateBgAnim bl sub_08000108 bl sub_0801C344 - bl sub_0805E5F8 + bl UpdateManagers bl FlushSprites bl sub_0801C208 bl sub_08078CB4 @@ -280,7 +280,7 @@ _080517F8: .4byte gRoomVars .else push {r4, r5, lr} - bl sub_0805E5C0 + bl UpdateEntities bl sub_0805BBBC cmp r0, #0 bne _08051B02 @@ -289,7 +289,7 @@ _08051B02: bl UpdateBgAnim bl sub_08000108 bl sub_0801C344 - bl sub_0805E5F8 + bl UpdateManagers bl FlushSprites bl sub_0801C208 bl sub_08078CB4 @@ -441,7 +441,7 @@ _08051C02: bl sub_08078B48 _08051C06: bl FlushSprites - bl sub_0805E5C0 + bl UpdateEntities bl sub_08080A40 bl CollisionMain bl UpdateScroll @@ -449,7 +449,7 @@ _08051C06: bl sub_08000108 bl sub_08052C3C bl sub_0801C344 - bl sub_0805E5F8 + bl UpdateManagers bl sub_0801C208 bl sub_08078CB4 bl sub_080AD9B0 @@ -503,10 +503,10 @@ sub_08051CA8: @ 0x08051CA8 bl sub_080705AC cmp r0, #0 bne _08051CEA - bl sub_0805E5C0 + bl UpdateEntities bl CollisionMain bl sub_0801C344 - bl sub_0805E5F8 + bl UpdateManagers bl FlushSprites bl sub_0801C208 bl sub_08078CB4 @@ -586,7 +586,7 @@ InitializeEntities: @ 0x08051D40 movs r0, #0 str r0, [r1] bl sub_0807C740 - ldr r1, _08051D94 @ =gUnk_02000070 + ldr r1, _08051D94 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] bl sub_0805283C @@ -605,7 +605,7 @@ InitializeEntities: @ 0x08051D40 pop {pc} .align 2, 0 _08051D90: .4byte gUnk_03004030 -_08051D94: .4byte gUnk_02000070 +_08051D94: .4byte gUpdateVisibleTiles thumb_func_start sub_08051D98 sub_08051D98: @ 0x08051D98 @@ -788,12 +788,12 @@ sub_08051F04: @ 0x08051F04 ldr r0, [r0] bl _call_via_r0 bl FlushSprites - bl sub_0805E5C0 + bl UpdateEntities bl sub_080AD9B0 bl sub_080AD918 bl UpdateScroll bl UpdateBgAnim - bl sub_0805E5F8 + bl UpdateManagers bl sub_08000108 pop {pc} .align 2, 0 @@ -869,7 +869,7 @@ sub_08051F9C: @ 0x08051F9C add r0, r8 strh r0, [r1, #0xc] bl sub_0807C740 - ldr r1, _08051FE8 @ =gUnk_02000070 + ldr r1, _08051FE8 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] ldr r0, _08051FEC @ =gUsedPalettes @@ -883,7 +883,7 @@ sub_08051F9C: @ 0x08051F9C .align 2, 0 _08051FE0: .4byte gScreen _08051FE4: .4byte gRoomControls -_08051FE8: .4byte gUnk_02000070 +_08051FE8: .4byte gUpdateVisibleTiles _08051FEC: .4byte gUsedPalettes thumb_func_start sub_08051FF0 diff --git a/asm/getEmptyEntity.s b/asm/getEmptyEntity.s index be445c5d..3ab8e820 100644 --- a/asm/getEmptyEntity.s +++ b/asm/getEmptyEntity.s @@ -1,12 +1,5 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" .syntax unified - - .text - - thumb_func_start GetEmptyEntity -GetEmptyEntity: @ 0x0805E678 push {r4, r5, r6, r7, lr} mov r7, r8 push {r7} @@ -111,3 +104,4 @@ _0805E730: _0805E738: .4byte gUnk_03003BE0 _0805E73C: .4byte gEntityLists _0805E740: .4byte gUnk_03003DD0 + .syntax divided diff --git a/asm/gyorgFemale.s b/asm/gyorgFemale.s index cd5d79f3..42d10c34 100644 --- a/asm/gyorgFemale.s +++ b/asm/gyorgFemale.s @@ -524,7 +524,7 @@ _080464DE: movs r1, #0x80 lsls r1, r1, #4 bl MemClear - ldr r1, _08046514 @ =gUnk_02000070 + ldr r1, _08046514 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] pop {r4, r5, r6, pc} @@ -532,7 +532,7 @@ _080464DE: _08046508: .4byte gUnk_080D1A74 _0804650C: .4byte gUnk_02019EE0 _08046510: .4byte 0x00003260 -_08046514: .4byte gUnk_02000070 +_08046514: .4byte gUpdateVisibleTiles thumb_func_start sub_08046518 sub_08046518: @ 0x08046518 diff --git a/asm/intr.s b/asm/intr.s index dc497fae..fc981eb3 100644 --- a/asm/intr.s +++ b/asm/intr.s @@ -655,8 +655,6 @@ _080B21A4: .4byte 0x01010101 _080B21A8: .4byte gUnk_02000006 _080B21AC: .4byte gUnk_08000F54 - arm_func_start UpdateEntities -UpdateEntities: @ 0x080B21B0 ldr r11, _080B2270 @ =gUnk_03003DD0 ldr r1, [r11] ldm r1, {r7, r8, r9, r10} @@ -672,6 +670,8 @@ UpdateEntities: @ 0x080B21B0 @ void* restore_sp; @ } + arm_func_start UpdateEntities_arm +UpdateEntities_arm: @ 0x080B21B0 @ UpdateEntities starts here @ arg0 (r0) : 0 = entities, 1 = managers ldr r1, _080B2274 @ =gUnk_080026A4 diff --git a/asm/sub_0805E248.s b/asm/sub_0805E248.s deleted file mode 100644 index 8c771764..00000000 --- a/asm/sub_0805E248.s +++ /dev/null @@ -1,131 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_0805E248 -sub_0805E248: @ 0x0805E248 - push {r4, r5, lr} - ldr r0, _0805E2C8 @ =gUnk_03004030 - ldr r0, [r0] - ldrh r5, [r0, #6] - ldr r0, _0805E2CC @ =gRoomControls - ldrb r0, [r0, #4] - cmp r0, #0xa - beq _0805E25C - cmp r0, #0x16 - bne _0805E2E8 -_0805E25C: - movs r0, #0x9f - lsls r0, r0, #2 - adds r4, r5, #0 - subs r4, #0x41 - adds r1, r4, #0 - movs r2, #1 - bl SetTileType - ldr r0, _0805E2D0 @ =0x00000283 - adds r1, r4, #0 - movs r2, #2 - bl SetTileType - ldr r0, _0805E2D4 @ =0x0000027D - adds r4, #1 - adds r1, r4, #0 - movs r2, #1 - bl SetTileType - movs r0, #0xa1 - lsls r0, r0, #2 - adds r1, r4, #0 - movs r2, #2 - bl SetTileType - ldr r0, _0805E2D8 @ =0x0000027E - adds r4, #1 - adds r1, r4, #0 - movs r2, #1 - bl SetTileType - ldr r0, _0805E2DC @ =0x00000285 - adds r1, r4, #0 - movs r2, #2 - bl SetTileType - ldr r0, _0805E2E0 @ =0x0000027F - subs r1, r5, #1 - movs r2, #1 - bl SetTileType - movs r0, #0xa0 - lsls r0, r0, #2 - adds r1, r5, #0 - movs r2, #1 - bl SetTileType - ldr r0, _0805E2E4 @ =0x00000282 - adds r1, r5, #1 - movs r2, #1 - bl SetTileType - b _0805E350 - .align 2, 0 -_0805E2C8: .4byte gUnk_03004030 -_0805E2CC: .4byte gRoomControls -_0805E2D0: .4byte 0x00000283 -_0805E2D4: .4byte 0x0000027D -_0805E2D8: .4byte 0x0000027E -_0805E2DC: .4byte 0x00000285 -_0805E2E0: .4byte 0x0000027F -_0805E2E4: .4byte 0x00000282 -_0805E2E8: - movs r0, #0x9b - lsls r0, r0, #2 - adds r4, r5, #0 - subs r4, #0x41 - adds r1, r4, #0 - movs r2, #1 - bl SetTileType - ldr r0, _0805E358 @ =0x00000273 - adds r1, r4, #0 - movs r2, #2 - bl SetTileType - ldr r0, _0805E35C @ =0x0000026D - adds r4, #1 - adds r1, r4, #0 - movs r2, #1 - bl SetTileType - movs r0, #0x9d - lsls r0, r0, #2 - adds r1, r4, #0 - movs r2, #2 - bl SetTileType - ldr r0, _0805E360 @ =0x0000026E - adds r4, #1 - adds r1, r4, #0 - movs r2, #1 - bl SetTileType - ldr r0, _0805E364 @ =0x00000275 - adds r1, r4, #0 - movs r2, #2 - bl SetTileType - ldr r0, _0805E368 @ =0x0000026F - subs r1, r5, #1 - movs r2, #1 - bl SetTileType - movs r0, #0x9c - lsls r0, r0, #2 - adds r1, r5, #0 - movs r2, #1 - bl SetTileType - ldr r0, _0805E36C @ =0x00000272 - adds r1, r5, #1 - movs r2, #1 - bl SetTileType -_0805E350: - ldr r1, _0805E370 @ =gUnk_02000070 - movs r0, #0 - strb r0, [r1] - pop {r4, r5, pc} - .align 2, 0 -_0805E358: .4byte 0x00000273 -_0805E35C: .4byte 0x0000026D -_0805E360: .4byte 0x0000026E -_0805E364: .4byte 0x00000275 -_0805E368: .4byte 0x0000026F -_0805E36C: .4byte 0x00000272 -_0805E370: .4byte gUnk_02000070 diff --git a/include/functions.h b/include/functions.h index cc9b7d45..6b11200c 100644 --- a/include/functions.h +++ b/include/functions.h @@ -105,7 +105,7 @@ extern void sub_0807AA80(Entity*); extern s32 sub_0807887C(Entity*, u32, u32); extern s32 sub_08078904(); extern void sub_0805E5A8(void); -extern void sub_0805E5C0(void); +extern void UpdateEntities(void); extern void sub_080AD9B0(void); extern void sub_080AD918(void); extern void sub_0801E104(void); diff --git a/include/manager.h b/include/manager.h index fd094dfe..d3b34bba 100644 --- a/include/manager.h +++ b/include/manager.h @@ -12,7 +12,7 @@ union SplitSHWord { } PACKED; typedef struct Manager { - /*0x00*/ struct Manager* previous; + /*0x00*/ struct Manager* prev; /*0x00*/ struct Manager* next; /*0x08*/ u8 type; /*0x09*/ u8 subtype; diff --git a/include/structures.h b/include/structures.h index a875d89a..9f3f1276 100644 --- a/include/structures.h +++ b/include/structures.h @@ -171,10 +171,7 @@ typedef struct { u8 unk1; u8 unk2; u8 unk3; - u8 freezeTime; - u8 unk9; - u8 unk_0xa; - u8 unk_0xb; + Entity* unk4; u16 unk_0xc; } EntityHandler; diff --git a/linker.ld b/linker.ld index f59ced88..a14b7752 100644 --- a/linker.ld +++ b/linker.ld @@ -18,7 +18,7 @@ SECTIONS { . = 0x00000040; gUnk_02000040 = .; . = 0x00000050; gMessage = .; . = 0x0000005C; gUnk_0200005C = .; - . = 0x00000070; gUnk_02000070 = .; + . = 0x00000070; gUpdateVisibleTiles = .; . = 0x00000080; gMenu = .; . = 0x00000080; gIntroState = .; . = 0x00000080; gChooseFileState = .; @@ -278,7 +278,7 @@ SECTIONS { . = 0x00005E60; gUnk_03005E60 = .; . = 0x00005E98; gUnk_03005E98 = .; . = 0x00005F24; _ClearAndUpdateEntities = .; - . = 0x00005F40; _UpdateEntities = .; + . = 0x00005F40; UpdateEntities_arm = .; . = 0x00005FBC; gUnk_03005FBC = .; . = 0x00005FF0; gUnk_03005FF0 = .; . = 0x000060F0; gUnk_030060F0 = .; @@ -556,11 +556,6 @@ SECTIONS { src/manager/manager37.o(.text); src/manager/manager38.o(.text); src/manager/manager39.o(.text); - asm/sub_0805E248.o(.text); - src/sub_0805E374.o(.text); - src/sub_0805E3A0.o(.text); - asm/code_0805E3B0.o(.text); - asm/getEmptyEntity.o(.text); src/entity.o(.text); src/code_0805EC04.o(.text); asm/code_0805EC04.o(.text); diff --git a/src/arm_proxy.c b/src/arm_proxy.c index d8efb2a0..62d49afb 100644 --- a/src/arm_proxy.c +++ b/src/arm_proxy.c @@ -17,7 +17,7 @@ extern u8 gUnk_03000C30; extern u16* gUnk_02025EB0; extern u16* gUnk_0200B650; -extern u8 gUnk_02000070; +extern u8 gUpdateVisibleTiles; extern u8 gUnk_03003DF0[]; extern u8 gUnk_03003BE0; extern Entity* gUnk_03004040[3]; @@ -116,8 +116,8 @@ void PrepNextFrame(void) { UpdateDisplayControls(); LoadResources(); - if (gUnk_02000070) { - gUnk_02000070 = 0; + if (gUpdateVisibleTiles) { + gUpdateVisibleTiles = 0; if (gUnk_02025EB0 != NULL) // sizeof(BGBuffer) = 0x800, what are we omitting? DmaCopy32(3, &gBG1Buffer, VRAM + (*gUnk_02025EB0 & 0x1f00) * 8, 0x5C0); diff --git a/src/code_0804AA84.c b/src/code_0804AA84.c index ec885d7b..e3839d74 100644 --- a/src/code_0804AA84.c +++ b/src/code_0804AA84.c @@ -45,7 +45,7 @@ void sub_0804AAD4(void) { } void sub_0804AB04(void) { - sub_0805E5C0(); + UpdateEntities(); if (gArea.field_0x10 != 0) { FlushSprites(); sub_080AD9B0(); diff --git a/src/code_0808091C.c b/src/code_0808091C.c index 9fc8718f..49c654d7 100644 --- a/src/code_0808091C.c +++ b/src/code_0808091C.c @@ -8,7 +8,7 @@ extern void sub_08080BC4(void); extern u32 gUnk_0200B650; extern u32 gUnk_02025EB0; -extern u8 gUnk_02000070; +extern u8 gUpdateVisibleTiles; void sub_080808D8(void) { gScreenTransition.transitionType = 0; @@ -89,7 +89,7 @@ void sub_08080974(u32 arg0, u32 arg1) { } sub_080809D4(); - gUnk_02000070 = 1; + gUpdateVisibleTiles = 1; } void sub_080809D4(void) { @@ -128,5 +128,5 @@ void sub_080809D4(void) { } sub_08080BC4(); - gUnk_02000070 = 1; + gUpdateVisibleTiles = 1; } diff --git a/src/entity.c b/src/entity.c index cd9361f4..e05c64d1 100644 --- a/src/entity.c +++ b/src/entity.c @@ -1,15 +1,234 @@ #include "global.h" -#include "area.h" -#include "entity.h" #include "utils.h" +#include "functions.h" +#include "entity.h" +#include "area.h" +#include "room.h" #include "script.h" +#include "textbox.h" -typedef struct OtherEntity { - struct OtherEntity* prev; - struct OtherEntity* next; - Entity* field_0x8; - u8 field_0xC[0x34]; -} OtherEntity; +extern void sub_0805E3A0(void*, u32); +extern u8 gUnk_081091F8[]; +extern u8 gUnk_081091EE[]; +extern u8 gUpdateVisibleTiles; +extern u8 gEntCount; +extern u8 gManagerCount; +extern Manager gUnk_02033290; + +void sub_0805E524(void); +void sub_0805E510(u32); +void sub_0805ED30(void); +void ClearHitboxList(void); +void sub_0806F0A4(void); +void UpdateEntities_arm(u32); +void sub_0805EE88(void); +void ClearAllDeletedEntities(void); +void DeleteAllEntities(void); +void sub_0805E98C(void); + +void sub_0805E248(void) { + s32 v0; + + v0 = gUnk_03004030.unk_00->unk_06; + if (gRoomControls.areaID == 10 || gRoomControls.areaID == 22) { + SetTileType(636, v0 - 65, 1); + SetTileType(643, v0 - 65, 2); + SetTileType(637, v0 - 64, 1); + SetTileType(644, v0 - 64, 2); + SetTileType(638, v0 - 63, 1); + SetTileType(645, v0 - 63, 2); + SetTileType(639, v0 - 1, 1); + SetTileType(640, v0, 1); + SetTileType(642, v0 + 1, 1); + } else { + SetTileType(620, v0 - 65, 1); + SetTileType(627, v0 - 65, 2); + SetTileType(621, v0 - 64, 1); + SetTileType(628, v0 - 64, 2); + SetTileType(622, v0 - 63, 1); + SetTileType(629, v0 - 63, 2); + SetTileType(623, v0 - 1, 1); + SetTileType(624, v0, 1); + SetTileType(626, v0 + 1, 1); + } + gUpdateVisibleTiles = 0; +} + +void sub_0805E374(Entity* param_1) { + u8 r3 = gScreenTransition.field_0x24[8]; + u8* array = gUnk_081091F8; + + if (r3 != 2) { + array = gUnk_081091EE; + } + sub_0805E3A0(param_1, array[param_1->kind]); +} + +void sub_0805E3A0(void* ent, u32 param) { + Entity* e = (Entity*)ent; + e->scriptedScene2 = param; + e->scriptedScene = param; +} + +bool32 sub_0805E3B0(Entity* this) { + u32 value; + + if (this->flags & 0x10) + return TRUE; + if (this->action == 0) + return FALSE; + + if (gUnk_03003DC0.unk0 > gUnk_03003DC0.unk1) + value = gUnk_03003DC0.unk0; + else + value = gUnk_03003DC0.unk1; + + if (gMessage.doTextBox & 0x7F) + value = value < 2 ? 2 : value; + return value > this->scriptedScene; +} + +bool32 sub_0805E40C(void) { + u32 v0 = gUnk_03003DC0.unk0; + if (gUnk_03003DC0.unk0 <= gUnk_03003DC0.unk1) + v0 = gUnk_03003DC0.unk1; + return v0 != 0; +} + +s32 sub_0805E428() { + s32 result; + + sub_0805E524(); + if (gUnk_03003DC0.unk2) { + result = 0; + gUnk_03003DC0.unk1 = gUnk_03003DC0.unk2; + gUnk_03003DC0.unk2 = 0; + } else { + result = gUnk_03003DC0.unk3; + if (gUnk_03003DC0.unk3) { + gUnk_03003DC0.unk1 = gUnk_03003DC0.unk3 = 0; + } + } + return result; +} + +s32 sub_0805E450(u32 a1) { + if (a1 < gUnk_03003DC0.unk2 || a1 < gUnk_03003DC0.unk1) + return 0; + gUnk_03003DC0.unk2 = a1; + return 1; +} + +void sub_0805E470(void) { + gUnk_03003DC0.unk3 = 1; +} + +void sub_0805E47C(Entity* this) { + this->scriptedScene2 = this->scriptedScene; + this->scriptedScene = 2; + if (sub_0805E450(2)) + gUnk_03003DC0.unk4 = this; +} + +void sub_0805E4A0(Entity* this) { + sub_08078A90(1); + this->scriptedScene2 = this->scriptedScene; + this->scriptedScene = 3; + if (sub_0805E450(1)) + gUnk_03003DC0.unk4 = this; +} + +void sub_0805E4CC(Entity* this) { + sub_08078A90(0); + sub_0805E584(this); +} + +void sub_0805E4E0(Entity* a1, u32 a2) { + if (a1 != NULL) { + a1->scriptedScene2 = a1->scriptedScene; + a1->scriptedScene = 3; + } + if (sub_0805E450(1u)) + gUnk_03003DC0.unk4 = a1; + sub_0805E510(a2); +} + +void sub_0805E510(u32 a1) { + if (gUnk_03003DC0.unk_0xc < a1) + gUnk_03003DC0.unk_0xc = a1; +} + +void sub_0805E524(void) { + if (gUnk_03003DC0.unk_0xc != 0) { + if (--gUnk_03003DC0.unk_0xc << 16 == 0) + sub_0805E470(); + } +} + +void sub_0805E544(void) { + gUnk_03003DC0.unk0 = 6; + gPlayerEntity.scriptedScene = 6; +} + +void UnfreezeTime() { + gUnk_03003DC0.unk0 = 0; + gPlayerEntity.scriptedScene = 1; +} + +void sub_0805E584(Entity* e) { + e->scriptedScene = e->scriptedScene2; + sub_0805E470(); +} + +void sub_0805E59C() { + gUnk_03003DC0.unk0 = 6; +} + +void sub_0805E5A8() { + gUnk_03003DC0.unk0 = 7; +} + +void sub_0805E5B4() { + gUnk_03003DC0.unk0 = 0; +} + +void UpdateEntities() { + void (*f)(u32); + + gRoomVars.filler1[0] = gRoomVars.field_0x4; + gRoomVars.field_0x4 = 0; + sub_0805ED30(); + sub_0805E428(); + ClearHitboxList(); + sub_0806F0A4(); + f = UpdateEntities_arm; + f(0); + ClearAllDeletedEntities(); + sub_0805EE88(); +} + +void UpdateManagers() { + void (*f)(u32); + f = UpdateEntities_arm; + f(1); + ClearAllDeletedEntities(); +} + +void EraseAllEntities() { + extern u8 gUnk_03000000[]; + DeleteAllEntities(); + MemClear(&gUnk_03003DC0, 12); + MemClear(&gPlayerEntity, 10880); + MemClear(&gUnk_02033290, 2048); + sub_0805E98C(); + gEntCount = 0; + gManagerCount = 0; + gUnk_03000000[0x427] = 1; + gUnk_03000000[0x426] = 1; + gUnk_03000000[0x42e] = 1; +} + +ASM_FUNC("./asm/getEmptyEntity.s", Entity* GetEmptyEntity()); extern Entity gUnk_030011E8[7]; @@ -25,7 +244,7 @@ Entity* sub_0805E744(void) { return NULL; } -OtherEntity* GetEmptyManager(void); +Manager* GetEmptyManager(void); typedef void* (*Getter)(void); @@ -55,7 +274,7 @@ void DeleteThisEntity(void) { _call_via_r0((u32*)&_ClearAndUpdateEntities); } -void DeleteManager(OtherEntity*); +void DeleteManager(Manager*); typedef void (*Deleter)(void*); @@ -146,13 +365,20 @@ void DeleteAllEntities(void) { } } -extern OtherEntity gUnk_02033290; +extern Manager gUnk_02033290; -OtherEntity* GetEmptyManager(void) { - OtherEntity* it; - for (it = &gUnk_02033290; it < (&gUnk_02033290 + 32); it++) { +typedef struct Temp { + void* prev; + void* next; + u8 _0[0x38]; +} Temp; + +// fix this +Manager* GetEmptyManager(void) { + Temp* it; + for (it = (Temp*)&gUnk_02033290; it < ((Temp*)&gUnk_02033290 + 32); it++) { if (it->prev == 0) { - return it; + return (Manager*)it; } } return NULL; @@ -160,13 +386,13 @@ OtherEntity* GetEmptyManager(void) { extern u8 gManagerCount; -void DeleteManager(OtherEntity* ent) { +void DeleteManager(Manager* ent) { if (!ent->next) return; sub_0805E92C(ent); UnlinkEntity(ent); - MemClear(ent, sizeof(OtherEntity)); + MemClear(ent, sizeof(Temp)); gManagerCount--; } diff --git a/src/fileScreen.c b/src/fileScreen.c index 0c8d4e6c..46f01c41 100644 --- a/src/fileScreen.c +++ b/src/fileScreen.c @@ -175,7 +175,7 @@ void HandleChooseFileScreen(void) { sFileScreenSubHandlers[gUnk_02032EC0.lastState](); gUnk_02019EE0.isTransitioning = FALSE; - sub_0805E5C0(); + UpdateEntities(); sub_0805066C(); sub_0801C1D4(); sub_0801C208(); diff --git a/src/intro.c b/src/intro.c index 04783e12..871caa64 100644 --- a/src/intro.c +++ b/src/intro.c @@ -245,7 +245,7 @@ static void HandleTitlescreen(void) { LoadGfxGroup(3); } UpdateLightRays(); - sub_0805E5C0(); + UpdateEntities(); sub_080AD9B0(); } diff --git a/src/manager/managerC.c b/src/manager/managerC.c index 20202345..e66185f7 100644 --- a/src/manager/managerC.c +++ b/src/manager/managerC.c @@ -51,7 +51,7 @@ extern u8 gUnk_03003DE4[0xC]; extern struct BgAffineDstData gUnk_02017AA0[]; extern struct BgAffineDstData gUnk_02017BA0[]; extern u8 gUnk_02017700[]; -extern u8 gUnk_02000070; +extern u8 gUpdateVisibleTiles; extern u32 gUsedPalettes; void sub_08058894(ManagerC*); @@ -294,7 +294,7 @@ void sub_08058D34() { gScreen.controls.layerFXControl = 0x3456; gScreen.controls.alphaBlend = 0x909; gArea.musicIndex = gArea.pMusicIndex; - gUnk_02000070 = 0; + gUpdateVisibleTiles = 0; if (CheckGlobalFlag(LV1TARU_OPEN)) { LoadGfxGroup(0x4A); } diff --git a/src/object/objectA.c b/src/object/objectA.c index 0e63b26f..c6ed5309 100644 --- a/src/object/objectA.c +++ b/src/object/objectA.c @@ -7,7 +7,7 @@ extern Hitbox gUnk_080FD170; -extern u8 gUnk_02000070; +extern u8 gUpdateVisibleTiles; void ObjectA(Entity* this) { u32 uVar2; @@ -24,7 +24,7 @@ void ObjectA(Entity* this) { if (CheckFlags(this->field_0x86.HWORD) != 0) { SetTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); if ((gRoomControls.unk2 & 1) != 0) { - gUnk_02000070 = 0; + gUpdateVisibleTiles = 0; } DeleteThisEntity(); } else { diff --git a/src/room.c b/src/room.c index d136e2f4..c4fa73d2 100644 --- a/src/room.c +++ b/src/room.c @@ -2305,7 +2305,7 @@ u32 sub_0804CD44() { extern EntityData gUnk_080DF94C; -extern u8 gUnk_02000070; +extern u8 gUpdateVisibleTiles; extern u32 gUsedPalettes; void sub_0804CD48(void) { @@ -2313,7 +2313,7 @@ void sub_0804CD48(void) { if (!CheckLocalFlag(0x48)) { SetLocalFlag(0x48); MenuFadeIn(5, 0); - gUnk_02000070 = 0; + gUpdateVisibleTiles = 0; gFadeControl.active = 0; gUsedPalettes = 0; *(u16*)0x5000000 = 0x7fff; @@ -4888,7 +4888,7 @@ void sub_0804E7DC(void) { if (!CheckGlobalFlag(START) && !CheckLocalFlag(0x46)) { sub_080A71C4(5, 1, 4, 4); - gUnk_02000070 = 0; + gUpdateVisibleTiles = 0; DoFade(5, 0x100); sub_080751E8(0, 6, &script_08009B30); } diff --git a/src/sub_08055E08.c b/src/sub_08055E08.c index 1b97f26f..e564244f 100644 --- a/src/sub_08055E08.c +++ b/src/sub_08055E08.c @@ -14,7 +14,7 @@ struct { /*0x1d*/ u8 unk1D; /*0x1e*/ u8 unk1E; /*0x1f*/ u8 unk1F; -} gUnk_02000070 = {}; +} gUpdateVisibleTiles = {}; extern EntityData gUnk_080FF400; @@ -24,7 +24,7 @@ void sub_08055E08(void) { void sub_08055E24(void) { gMenu.overlayType++; - gUnk_02000070.unk0 = 1; + gUpdateVisibleTiles.unk0 = 1; sub_0804B0B0(gMenu.field_0xc[2], gMenu.field_0xc[3]); LoadRoomEntityList(&gUnk_080FF400); sub_08055B70(gMenu.field_0x4, 0, 0, 0); diff --git a/src/sub_0805E374.c b/src/sub_0805E374.c deleted file mode 100644 index 3ec3e287..00000000 --- a/src/sub_0805E374.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "entity.h" -#include "structures.h" - -extern Entity* sub_0805E3A0(Entity*, u32); -extern u8 gUnk_081091F8[]; -extern u8 gUnk_081091EE[]; - -Entity* sub_0805E374(Entity* param_1) { - u8 r3 = gScreenTransition.field_0x24[8]; - u8* array = gUnk_081091F8; - - if (r3 != 2) { - array = gUnk_081091EE; - } - return sub_0805E3A0(param_1, array[param_1->kind]); -} diff --git a/src/sub_0805E3A0.c b/src/sub_0805E3A0.c deleted file mode 100644 index 809d4b54..00000000 --- a/src/sub_0805E3A0.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "global.h" -#include "entity.h" - -Entity* sub_0805E3A0(Entity* ent, u32 param) { - // these are bitfields - ent->scriptedScene2 = param; - ent->scriptedScene = param; - return ent; -} diff --git a/src/sub_080A3B84.c b/src/sub_080A3B84.c index 2012ae1d..193dd12f 100644 --- a/src/sub_080A3B84.c +++ b/src/sub_080A3B84.c @@ -15,7 +15,7 @@ void DrawKinstoneMenu(void) { sub_080A4054(); sub_0801C1D4(); sub_0801C208(); - sub_0805E5C0(); + UpdateEntities(); sub_080AD9B0(); sub_080AD918(); gScreenTransition.field_0x24[8] = 0; From 313cc336f21fcf81e3e336b4fe45ca5053771f93 Mon Sep 17 00:00:00 2001 From: theo3 Date: Wed, 10 Nov 2021 00:35:06 -0800 Subject: [PATCH 2/6] thumb interwork finished --- Makefile | 3 +- asm/code_080011C4.s | 2 +- asm/code_08016B30.s | 226 --- asm/code_08016DF8.s | 1730 ----------------- asm/code_0806EC20.s | 4 +- asm/code_0807F0D8.s | 2 +- asm/code_080A3BD0.s | 2 +- ...ateBackgroundRegisters.s => dispCtrlSet.s} | 9 +- asm/fileScreen.s | 4 +- asm/intr.s | 22 +- asm/jarPortal.s | 8 - asm/non_matching/arm_proxy/NPCUpdate.inc | 4 +- asm/non_matching/collision/sub_08017CBC.inc | 57 + asm/non_matching/collision/sub_0801802C.inc | 75 + asm/object11.s | 2 +- asm/object1E.s | 2 +- asm/sub_08016AE4.s | 2 +- asm/sub_080A2838.s | 4 +- data/data_080B2A70.s | 26 +- data/data_080B3740.s | 6 +- data/data_080B7B74.s | 2 +- include/entity.h | 36 +- include/main.h | 2 +- include/player.h | 6 +- include/structures.h | 2 +- linker.ld | 7 +- src/collision.c | 714 +++++++ src/enemy/acroBandits.c | 14 +- src/enemy/beetle.c | 8 +- src/enemy/bobomb.c | 22 +- src/enemy/bombPeahat.c | 6 +- src/enemy/businessScrub.c | 10 +- src/enemy/chuchu.c | 36 +- src/enemy/darkNut.c | 14 +- src/enemy/doorMimic.c | 4 +- src/enemy/enemy4D.c | 2 +- src/enemy/fallingBoulder.c | 6 +- src/enemy/gibdo.c | 12 +- src/enemy/gyorgMale.c | 4 +- src/enemy/helmasaur.c | 16 +- src/enemy/keaton.c | 2 +- src/enemy/lakitu.c | 14 +- src/enemy/lakituCloud.c | 4 +- src/enemy/leever.c | 4 +- src/enemy/likeLike.c | 16 +- src/enemy/madderpillar.c | 16 +- src/enemy/mazaalBracelet.c | 40 +- src/enemy/mazaalHead.c | 2 +- src/enemy/mazaalMacro.c | 2 +- src/enemy/moldorm.c | 4 +- src/enemy/moldworm.c | 20 +- src/enemy/octorok.c | 6 +- src/enemy/peahat.c | 14 +- src/enemy/pesto.c | 12 +- src/enemy/puffstool.c | 10 +- src/enemy/rockChuchu.c | 4 +- src/enemy/rollobite.c | 20 +- src/enemy/rupeeLike.c | 14 +- src/enemy/smallPesto.c | 2 +- src/enemy/spark.c | 2 +- src/enemy/spikedBeetle.c | 4 +- src/enemy/spinyChuchu.c | 18 +- src/enemy/vaatiArm.c | 38 +- src/enemy/vaatiBall.c | 24 +- src/enemy/vaatiEyesMacro.c | 2 +- src/enemy/vaatiProjectile.c | 6 +- src/enemy/vaatiRebornEnemy.c | 14 +- src/enemy/vaatiTransfigured.c | 14 +- src/enemy/vaatiTransfiguredEye.c | 10 +- src/enemy/vaatiWrath.c | 12 +- src/enemy/vaatiWrathEye.c | 6 +- src/enemy/wallMaster.c | 12 +- src/enemy/wallMaster2.c | 2 +- src/enemy/waterDrop.c | 6 +- src/enemy/wisp.c | 6 +- src/entity.c | 34 +- src/game.c | 2 +- src/{arm_proxy.c => interrupts.c} | 323 ++- src/item/itemSword.c | 4 +- src/main.c | 2 +- src/npc/cat.c | 8 +- src/npc/npc5.c | 6 +- src/object/button.c | 8 +- src/object/heartContainer.c | 2 +- src/object/itemOnGround.c | 38 +- src/object/jarPortal.c | 6 +- src/object/lightableSwitch.c | 12 +- src/object/minecart.c | 24 +- src/object/mineralWaterSource.c | 6 +- src/object/object49.c | 6 +- src/object/object9E.c | 6 +- src/object/pot.c | 10 +- src/object/warpPoint.c | 2 +- src/player.c | 64 +- src/playerItem/playerItem10.c | 2 +- src/playerItem/playerItem11.c | 14 +- src/playerItem/playerItem12.c | 2 +- src/playerItem/playerItemBow.c | 2 +- src/playerItem/playerItemC.c | 2 +- src/playerItem/playerItemLantern.c | 2 +- src/projectile/arrowProjectile.c | 8 +- src/projectile/boneProjectile.c | 4 +- src/projectile/darkNutSwordSlash.c | 6 +- src/projectile/dekuSeedProjectile.c | 18 +- src/projectile/fireProjectile.c | 2 +- src/projectile/gleerokProjectile.c | 6 +- src/projectile/gyorgMaleEnergyProjectile.c | 4 +- src/projectile/gyorgTail.c | 10 +- src/projectile/iceProjectile.c | 2 +- src/projectile/lakituCloudProjectile.c | 2 +- src/projectile/mandiblesProjectile.c | 12 +- src/projectile/mazaalEnergyBeam.c | 2 +- src/projectile/moblinSpear.c | 8 +- src/projectile/octorokBossProjectile.c | 2 +- src/projectile/rockProjectile.c | 6 +- src/projectile/spiderWeb.c | 2 +- src/projectile/stalfosProjectile.c | 6 +- src/projectile/v1DarkMagicProjectile.c | 14 +- src/projectile/v1EyeLaser.c | 2 +- src/projectile/v1FireProjectile.c | 4 +- src/projectile/windProjectile.c | 2 +- src/script.c | 6 +- 122 files changed, 1514 insertions(+), 2696 deletions(-) delete mode 100644 asm/code_08016B30.s delete mode 100644 asm/code_08016DF8.s rename asm/{updateBackgroundRegisters.s => dispCtrlSet.s} (94%) delete mode 100644 asm/jarPortal.s create mode 100644 asm/non_matching/collision/sub_08017CBC.inc create mode 100644 asm/non_matching/collision/sub_0801802C.inc create mode 100644 src/collision.c rename src/{arm_proxy.c => interrupts.c} (61%) diff --git a/Makefile b/Makefile index d8c37941..c2f9fd4f 100644 --- a/Makefile +++ b/Makefile @@ -111,7 +111,8 @@ NODEP := 1 endif #$(C_BUILDDIR)/need_interworking_file_name.o: CFLAGS += -mthumb-interwork -$(C_BUILDDIR)/arm_proxy.o: CFLAGS += -mthumb-interwork +$(C_BUILDDIR)/interrupts.o: CFLAGS += -mthumb-interwork +$(C_BUILDDIR)/collision.o: CFLAGS += -mthumb-interwork $(C_BUILDDIR)/gba/m4a.o: CFLAGS = -O2 -mthumb-interwork -Wimplicit -Wparentheses -Werror -Wno-multichar $(C_BUILDDIR)/eeprom.o: CFLAGS = -O1 -mthumb-interwork -Wimplicit -Wparentheses -Werror -Wno-multichar diff --git a/asm/code_080011C4.s b/asm/code_080011C4.s index b3ef8bab..37c2b33c 100644 --- a/asm/code_080011C4.s +++ b/asm/code_080011C4.s @@ -18,7 +18,7 @@ EnemyUpdate: @ 0x080011C4 bne _080011EA bl DeleteThisEntity _080011DC: - bl sub_0805E3B0 + bl CheckDontUpdate cmp r0, #0 bne _0800120A adds r0, r4, #0 diff --git a/asm/code_08016B30.s b/asm/code_08016B30.s deleted file mode 100644 index 6726c90a..00000000 --- a/asm/code_08016B30.s +++ /dev/null @@ -1,226 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_08016B30 -sub_08016B30: @ 0x08016B30 - bx lr - .align 2, 0 - - thumb_func_start sub_08016B34 -sub_08016B34: @ 0x08016B34 - ldr r1, _08016B54 @ =0x03007FFC - ldr r0, _08016B58 @ =gIntrMain - str r0, [r1] - ldr r1, _08016B5C @ =0x04000004 - ldr r2, _08016B60 @ =0x00005028 - adds r0, r2, #0 - strh r0, [r1] - ldr r1, _08016B64 @ =0x04000200 - ldr r2, _08016B68 @ =0x00002005 - adds r0, r2, #0 - strh r0, [r1] - adds r1, #8 - movs r0, #1 - strh r0, [r1] - bx lr - .align 2, 0 -_08016B54: .4byte 0x03007FFC -_08016B58: .4byte gIntrMain -_08016B5C: .4byte 0x04000004 -_08016B60: .4byte 0x00005028 -_08016B64: .4byte 0x04000200 -_08016B68: .4byte 0x00002005 - - thumb_func_start sub_08016B6C -sub_08016B6C: @ 0x08016B6C - push {r4, r5, lr} - ldr r4, _08016BBC @ =0x040000B0 - ldrh r1, [r4, #0xa] - ldr r0, _08016BC0 @ =0x0000C5FF - ands r0, r1 - strh r0, [r4, #0xa] - ldrh r1, [r4, #0xa] - ldr r0, _08016BC4 @ =0x00007FFF - ands r0, r1 - strh r0, [r4, #0xa] - ldrh r0, [r4, #0xa] - bl m4aSoundVSync - ldr r5, _08016BC8 @ =gMain - ldrb r0, [r5] - cmp r0, #0 - bne _08016BA6 - bl DispCtrlSet - ldr r0, _08016BCC @ =gUnk_03000FBC - str r0, [r4] - ldr r0, _08016BD0 @ =gUnk_02022730 - str r0, [r4, #4] - ldr r0, _08016BD4 @ =0x84000004 - str r0, [r4, #8] - ldr r0, [r4, #8] - ldrb r0, [r5] - movs r0, #1 - strb r0, [r5] -_08016BA6: - bl sub_08016BF8 - ldr r0, _08016BD8 @ =0x03007FF8 - ldrh r1, [r0] - movs r2, #1 - orrs r1, r2 - strh r1, [r0] - pop {r4, r5} - pop {r0} - bx r0 - .align 2, 0 -_08016BBC: .4byte 0x040000B0 -_08016BC0: .4byte 0x0000C5FF -_08016BC4: .4byte 0x00007FFF -_08016BC8: .4byte gMain -_08016BCC: .4byte gUnk_03000FBC -_08016BD0: .4byte gUnk_02022730 -_08016BD4: .4byte 0x84000004 -_08016BD8: .4byte 0x03007FF8 - - thumb_func_start HBlankIntr -HBlankIntr: @ 0x08016BDC - push {lr} - ldr r1, _08016BF0 @ =0x04000004 - ldr r2, _08016BF4 @ =0x00005028 - adds r0, r2, #0 - strh r0, [r1] - bl m4aSoundMain - pop {r0} - bx r0 - .align 2, 0 -_08016BF0: .4byte 0x04000004 -_08016BF4: .4byte 0x00005028 - - thumb_func_start sub_08016BF8 -sub_08016BF8: @ 0x08016BF8 - push {lr} - ldr r1, _08016C30 @ =gUnk_02022730 - ldrb r0, [r1] - cmp r0, #0 - beq _08016C2C - ldr r3, [r1, #4] - ldr r2, [r1, #8] - ldr r1, [r1, #0xc] - ldr r0, _08016C34 @ =0x040000B0 - str r3, [r0] - str r2, [r0, #4] - str r1, [r0, #8] - ldr r0, [r0, #8] - ldr r0, _08016C38 @ =0x00003FFF - ands r1, r0 - cmp r1, #0 - bne _08016C1E - movs r1, #0x80 - lsls r1, r1, #7 -_08016C1E: - ldrh r0, [r3] - strh r0, [r2] - adds r3, #2 - adds r2, #2 - subs r1, #1 - cmp r1, #0 - bgt _08016C1E -_08016C2C: - pop {r0} - bx r0 - .align 2, 0 -_08016C30: .4byte gUnk_02022730 -_08016C34: .4byte 0x040000B0 -_08016C38: .4byte 0x00003FFF - - thumb_func_start UpdateDisplayControls -UpdateDisplayControls: @ 0x08016C3C - push {r4, lr} - ldr r2, _08016C94 @ =gUnk_03000000 - ldrb r0, [r2] - cmp r0, #0 - beq _08016C6C - ldr r0, _08016C98 @ =gScreen - ldrh r1, [r0] - movs r0, #0x80 - lsls r0, r0, #5 - ands r0, r1 - cmp r0, #0 - beq _08016C6C - movs r0, #0 - strb r0, [r2] - ldr r1, _08016C9C @ =0x040000D4 - adds r0, r2, #0 - adds r0, #0x20 - str r0, [r1] - movs r0, #0xe0 - lsls r0, r0, #0x13 - str r0, [r1, #4] - ldr r0, _08016CA0 @ =0x84000100 - str r0, [r1, #8] - ldr r0, [r1, #8] -_08016C6C: - ldr r4, _08016CA4 @ =gBG0Settings - adds r0, r4, #0 - bl sub_08016CA8 - adds r0, r4, #0 - adds r0, #0xc - bl sub_08016CA8 - adds r0, r4, #0 - adds r0, #0x18 - bl sub_08016CA8 - adds r4, #0x24 - adds r0, r4, #0 - bl sub_08016CA8 - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_08016C94: .4byte gUnk_03000000 -_08016C98: .4byte gScreen -_08016C9C: .4byte 0x040000D4 -_08016CA0: .4byte 0x84000100 -_08016CA4: .4byte gBG0Settings - - thumb_func_start sub_08016CA8 -sub_08016CA8: @ 0x08016CA8 - push {lr} - adds r1, r0, #0 - ldrh r0, [r1, #6] - cmp r0, #0 - beq _08016CE8 - ldr r2, [r1, #8] - cmp r2, #0 - beq _08016CE8 - movs r0, #0 - strh r0, [r1, #6] - ldrh r1, [r1] - ldr r3, _08016CEC @ =0x040000D4 - str r2, [r3] - lsls r0, r1, #3 - movs r2, #0xf8 - lsls r2, r2, #8 - ands r0, r2 - movs r2, #0xc0 - lsls r2, r2, #0x13 - adds r0, r0, r2 - str r0, [r3, #4] - ldr r0, _08016CF0 @ =gUnk_080B2CD8 - lsrs r1, r1, #0xe - lsls r1, r1, #1 - adds r1, r1, r0 - ldrh r0, [r1] - lsrs r0, r0, #2 - movs r1, #0x84 - lsls r1, r1, #0x18 - orrs r0, r1 - str r0, [r3, #8] - ldr r0, [r3, #8] -_08016CE8: - pop {r0} - bx r0 - .align 2, 0 -_08016CEC: .4byte 0x040000D4 -_08016CF0: .4byte gUnk_080B2CD8 diff --git a/asm/code_08016DF8.s b/asm/code_08016DF8.s deleted file mode 100644 index b1bbea94..00000000 --- a/asm/code_08016DF8.s +++ /dev/null @@ -1,1730 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_08017874 -sub_08017874: @ 0x08017874 - push {r4, r5, lr} - adds r4, r0, #0 - adds r2, r1, #0 - ldrb r0, [r4, #8] - cmp r0, #1 - bne _080178C6 - adds r0, r2, #0 - adds r0, #0x44 - ldrb r1, [r0] - ldr r0, _08017898 @ =gSave - adds r0, #0xb2 - ldrb r0, [r0] - cmp r0, #0x2f - beq _0801789C - cmp r0, #0x30 - beq _080178A8 - b _080178AE - .align 2, 0 -_08017898: .4byte gSave -_0801789C: - adds r0, r1, #0 - cmp r1, #0 - bge _080178A4 - adds r0, r1, #3 -_080178A4: - asrs r1, r0, #2 - b _080178AE -_080178A8: - lsrs r0, r1, #0x1f - adds r0, r1, r0 - asrs r1, r0, #1 -_080178AE: - cmp r1, #0 - bgt _080178B4 - movs r1, #1 -_080178B4: - rsbs r0, r1, #0 - bl ModHealth - adds r5, r0, #0 - adds r0, r4, #0 - movs r1, #0x7a - bl sub_0800449C - b _08017928 -_080178C6: - adds r0, r2, #0 - adds r0, #0x44 - ldrb r1, [r0] - ldrb r0, [r2, #8] - cmp r0, #8 - bne _080178F6 - ldr r0, _080178E4 @ =gSave - adds r0, #0xb2 - ldrb r0, [r0] - cmp r0, #0x30 - beq _080178E8 - cmp r0, #0x31 - beq _080178F4 - b _080178F6 - .align 2, 0 -_080178E4: .4byte gSave -_080178E8: - lsls r0, r1, #1 - adds r0, r0, r1 - lsrs r1, r0, #0x1f - adds r0, r0, r1 - asrs r1, r0, #1 - b _080178F6 -_080178F4: - lsls r1, r1, #1 -_080178F6: - adds r0, r4, #0 - adds r0, #0x45 - ldrb r0, [r0] - subs r5, r0, r1 - ldrb r0, [r4, #8] - cmp r0, #3 - bne _08017928 - adds r0, r4, #0 - adds r0, #0x6d - ldrb r1, [r0] - movs r0, #1 - ands r0, r1 - cmp r0, #0 - beq _08017920 - ldr r1, _0801791C @ =0x00000127 - adds r0, r4, #0 - bl sub_0800449C - b _08017928 - .align 2, 0 -_0801791C: .4byte 0x00000127 -_08017920: - adds r0, r4, #0 - movs r1, #0xfe - bl sub_0800449C -_08017928: - cmp r5, #0 - ble _08017930 - adds r0, r5, #0 - b _0801793A -_08017930: - ldrb r1, [r4, #0x10] - movs r0, #0x7f - ands r0, r1 - strb r0, [r4, #0x10] - movs r0, #0 -_0801793A: - pop {r4, r5} - pop {r1} - bx r1 - - thumb_func_start sub_08017940 -sub_08017940: @ 0x08017940 - push {r4, r5, lr} - adds r5, r0, #0 - adds r4, r1, #0 - adds r0, r4, #0 - movs r1, #0x2c - movs r2, #0 - bl CreateFx - adds r2, r0, #0 - cmp r2, #0 - beq _080179CC - adds r3, r2, #0 - adds r3, #0x29 - ldrb r1, [r3] - movs r0, #8 - rsbs r0, r0, #0 - ands r0, r1 - movs r1, #2 - orrs r0, r1 - strb r0, [r3] - movs r1, #0x2e - ldrsh r0, [r5, r1] - ldr r1, [r5, #0x48] - ldrb r1, [r1] - lsls r1, r1, #0x18 - asrs r1, r1, #0x18 - adds r0, r0, r1 - movs r3, #0x2e - ldrsh r1, [r4, r3] - adds r0, r0, r1 - ldr r1, [r4, #0x48] - ldrb r1, [r1] - lsls r1, r1, #0x18 - asrs r1, r1, #0x18 - adds r0, r0, r1 - asrs r0, r0, #1 - strh r0, [r2, #0x2e] - movs r1, #0x32 - ldrsh r0, [r5, r1] - ldr r1, [r5, #0x48] - ldrb r1, [r1, #1] - lsls r1, r1, #0x18 - asrs r1, r1, #0x18 - adds r0, r0, r1 - movs r3, #0x32 - ldrsh r1, [r4, r3] - adds r0, r0, r1 - ldr r1, [r4, #0x48] - ldrb r1, [r1, #1] - lsls r1, r1, #0x18 - asrs r1, r1, #0x18 - adds r0, r0, r1 - asrs r0, r0, #1 - strh r0, [r2, #0x32] - movs r1, #0x36 - ldrsh r0, [r5, r1] - movs r3, #0x36 - ldrsh r1, [r4, r3] - adds r0, r0, r1 - asrs r0, r0, #1 - strh r0, [r2, #0x36] - adds r0, r5, #0 - adds r0, #0x38 - ldrb r1, [r0] - adds r0, r2, #0 - adds r0, #0x38 - strb r1, [r0] - adds r0, r2, #0 - bl UpdateSpriteForCollisionLayer -_080179CC: - movs r1, #0 - ldr r0, _080179E8 @ =gPlayerEntity - cmp r5, r0 - beq _080179DA - cmp r4, r0 - bne _080179E0 - adds r0, r4, #0 -_080179DA: - adds r0, #0x42 - ldrb r0, [r0] - lsrs r1, r0, #3 -_080179E0: - pop {r4, r5} - pop {r0} - bx r0 - .align 2, 0 -_080179E8: .4byte gPlayerEntity - - thumb_func_start sub_080179EC -sub_080179EC: @ 0x080179EC - push {r4, r5, r6, lr} - adds r6, r0, #0 - adds r5, r1, #0 - ldr r4, _08017A8C @ =gUnk_080B3740 - bl Random - movs r1, #3 - ands r1, r0 - adds r1, r1, r4 - ldrb r1, [r1] - adds r0, r5, #0 - movs r2, #0 - bl CreateFx - adds r4, r0, #0 - cmp r4, #0 - beq _08017A84 - ldr r0, [r5, #0x48] - movs r2, #0 - ldrsb r2, [r0, r2] - lsls r2, r2, #0x10 - movs r3, #1 - ldrsb r3, [r0, r3] - lsls r3, r3, #0x10 - adds r0, r5, #0 - adds r1, r4, #0 - bl PositionRelative - adds r2, r4, #0 - adds r2, #0x29 - ldrb r1, [r2] - movs r0, #8 - rsbs r0, r0, #0 - ands r0, r1 - movs r1, #2 - orrs r0, r1 - strb r0, [r2] - movs r1, #0x2e - ldrsh r0, [r6, r1] - ldr r1, [r6, #0x48] - ldrb r1, [r1] - lsls r1, r1, #0x18 - asrs r1, r1, #0x18 - adds r0, r0, r1 - movs r2, #0x2e - ldrsh r1, [r5, r2] - ldr r2, [r5, #0x48] - ldrb r2, [r2] - lsls r2, r2, #0x18 - asrs r2, r2, #0x18 - adds r1, r1, r2 - subs r0, r0, r1 - asrs r0, r0, #1 - adds r1, r4, #0 - adds r1, #0x62 - strb r0, [r1] - movs r1, #0x32 - ldrsh r0, [r6, r1] - ldr r1, [r6, #0x48] - ldrb r1, [r1, #1] - lsls r1, r1, #0x18 - asrs r1, r1, #0x18 - adds r0, r0, r1 - movs r2, #0x32 - ldrsh r1, [r5, r2] - ldr r2, [r5, #0x48] - ldrb r2, [r2, #1] - lsls r2, r2, #0x18 - asrs r2, r2, #0x18 - adds r1, r1, r2 - subs r0, r0, r1 - asrs r0, r0, #1 - adds r1, r4, #0 - adds r1, #0x63 - strb r0, [r1] - str r5, [r4, #0x54] -_08017A84: - pop {r4, r5, r6} - pop {r0} - bx r0 - .align 2, 0 -_08017A8C: .4byte gUnk_080B3740 - - thumb_func_start sub_08017A90 -sub_08017A90: @ 0x08017A90 - push {r4, r5, lr} - adds r4, r0, #0 - adds r5, r1, #0 - movs r0, #0x99 - movs r1, #0 - movs r2, #0 - bl CreateObject - adds r2, r0, #0 - cmp r2, #0 - bne _08017AAA - movs r0, #0 - b _08017AD0 -_08017AAA: - ldrb r0, [r4, #0x15] - lsrs r0, r0, #3 - movs r1, #3 - ands r0, r1 - strb r0, [r2, #0x14] - ldrh r0, [r4, #0x2e] - ldrh r1, [r5, #0x2e] - subs r0, r0, r1 - adds r1, r2, #0 - adds r1, #0x62 - strb r0, [r1] - ldrh r0, [r4, #0x32] - ldrh r1, [r5, #0x32] - subs r0, r0, r1 - adds r1, r2, #0 - adds r1, #0x63 - strb r0, [r1] - str r5, [r2, #0x50] - adds r0, r2, #0 -_08017AD0: - pop {r4, r5} - pop {r1} - bx r1 - .align 2, 0 - - thumb_func_start sub_08017AD8 -sub_08017AD8: @ 0x08017AD8 - movs r0, #0 - bx lr - - thumb_func_start sub_08017ADC -sub_08017ADC: @ 0x08017ADC - push {r4, lr} - adds r4, r1, #0 - ldrb r2, [r4, #0x10] - movs r1, #0x7f - ands r1, r2 - strb r1, [r4, #0x10] - adds r0, #0x40 - ldrb r1, [r0] - movs r0, #0x80 - adds r2, r4, #0 - adds r2, #0x41 - orrs r0, r1 - strb r0, [r2] - ldrb r0, [r4, #0xa] - subs r0, #0x5f - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #1 - bhi _08017B14 - adds r0, r4, #0 - bl sub_08081420 - cmp r0, #0 - beq _08017B14 - adds r1, r4, #0 - adds r1, #0x45 - movs r0, #0 - strb r0, [r1] -_08017B14: - movs r0, #2 - pop {r4} - pop {r1} - bx r1 - - thumb_func_start sub_08017B1C -sub_08017B1C: @ 0x08017B1C - push {lr} - adds r2, r0, #0 - adds r3, r1, #0 - ldr r0, _08017B38 @ =gPlayerState - ldrb r1, [r0, #0x1e] - movs r0, #0x60 - ands r0, r1 - cmp r0, #0 - beq _08017B3C - ldrb r1, [r3, #0x10] - movs r0, #0x7f - ands r0, r1 - strb r0, [r3, #0x10] - b _08017B52 - .align 2, 0 -_08017B38: .4byte gPlayerState -_08017B3C: - adds r1, r2, #0 - adds r1, #0x42 - movs r0, #0x10 - strb r0, [r1] - subs r1, #5 - movs r0, #0xec - strb r0, [r1] - adds r1, #9 - movs r0, #0xa0 - lsls r0, r0, #2 - strh r0, [r1] -_08017B52: - movs r0, #1 - pop {r1} - bx r1 - - thumb_func_start sub_08017B58 -sub_08017B58: @ 0x08017B58 - push {lr} - adds r2, r1, #0 - adds r3, r2, #0 - adds r3, #0x3a - ldrb r1, [r3] - movs r0, #4 - ands r0, r1 - lsls r0, r0, #0x18 - lsrs r0, r0, #0x18 - cmp r0, #0 - beq _08017B98 - ldrb r1, [r2, #0x1d] - cmp r1, #0 - beq _08017BA2 - ldr r0, _08017B94 @ =gPlayerState - ldrb r0, [r0, #0x1d] - subs r0, r1, r0 - movs r1, #0 - strb r0, [r2, #0x1d] - lsls r0, r0, #0x18 - cmp r0, #0 - bgt _08017BA2 - strb r1, [r2, #0x1d] - movs r0, #2 - strb r0, [r2, #0xd] - adds r0, r2, #0 - adds r0, #0x46 - strh r1, [r0] - b _08017BA2 - .align 2, 0 -_08017B94: .4byte gPlayerState -_08017B98: - strb r0, [r2, #0xd] - ldrb r0, [r3] - movs r1, #4 - orrs r0, r1 - strb r0, [r3] -_08017BA2: - adds r1, r2, #0 - adds r1, #0x3d - ldrb r2, [r1] - movs r0, #0 - ldrsb r0, [r1, r0] - cmp r0, #0 - bne _08017BB4 - movs r0, #0xff - strb r0, [r1] -_08017BB4: - movs r0, #1 - pop {r1} - bx r1 - .align 2, 0 - - thumb_func_start sub_08017BBC -sub_08017BBC: @ 0x08017BBC - push {r4, r5, r6, r7, lr} - adds r4, r0, #0 - adds r6, r1, #0 - adds r7, r2, #0 - ldr r5, _08017C38 @ =gPlayerState - ldr r0, [r5, #0x30] - ldr r1, _08017C3C @ =0x00001481 - ands r0, r1 - cmp r0, #0 - bne _08017BF2 - movs r0, #0x42 - movs r1, #1 - movs r2, #0 - bl CreateObject - cmp r0, #0 - beq _08017BF2 - str r4, [r0, #0x54] - ldr r0, [r5, #0x30] - movs r1, #0x80 - lsls r1, r1, #3 - orrs r0, r1 - str r0, [r5, #0x30] - movs r0, #0x10 - eors r0, r7 - lsrs r0, r0, #2 - strb r0, [r4, #0x14] -_08017BF2: - adds r1, r6, #0 - adds r1, #0x44 - movs r0, #4 - strb r0, [r1] - adds r0, r4, #0 - adds r1, r6, #0 - bl sub_08017874 - adds r1, r4, #0 - adds r1, #0x45 - strb r0, [r1] - subs r1, #3 - movs r0, #0xc - strb r0, [r1] - subs r1, #5 - movs r0, #0x1e - strb r0, [r1] - adds r1, #9 - movs r0, #0xc0 - lsls r0, r0, #1 - strh r0, [r1] - adds r1, r6, #0 - adds r1, #0x3d - ldrb r2, [r1] - movs r0, #0 - ldrsb r0, [r1, r0] - cmp r0, #0 - bne _08017C2E - movs r0, #0xff - strb r0, [r1] -_08017C2E: - movs r0, #1 - pop {r4, r5, r6, r7} - pop {r1} - bx r1 - .align 2, 0 -_08017C38: .4byte gPlayerState -_08017C3C: .4byte 0x00001481 - - thumb_func_start sub_08017C40 -sub_08017C40: @ 0x08017C40 - push {r4, r5, r6, lr} - adds r4, r0, #0 - adds r5, r1, #0 - ldr r6, _08017CB4 @ =gPlayerState - ldr r0, [r6, #0x30] - ldr r1, _08017CB8 @ =0x00001881 - ands r0, r1 - cmp r0, #0 - bne _08017C82 - ldrb r0, [r6, #0xc] - cmp r0, #0 - bne _08017C82 - ldrb r0, [r4, #0xc] - cmp r0, #1 - beq _08017C62 - cmp r0, #0x18 - bne _08017C82 -_08017C62: - adds r1, r5, #0 - adds r1, #0x44 - movs r0, #4 - strb r0, [r1] - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_08017874 - adds r1, r4, #0 - adds r1, #0x45 - strb r0, [r1] - movs r0, #0x80 - lsls r0, r0, #4 - str r0, [r6, #0x30] - movs r0, #0xd - strb r0, [r6, #0xc] -_08017C82: - adds r1, r4, #0 - adds r1, #0x42 - movs r0, #0xc - strb r0, [r1] - subs r1, #5 - movs r0, #0x10 - strb r0, [r1] - adds r1, #9 - movs r0, #0xa0 - lsls r0, r0, #2 - strh r0, [r1] - adds r1, r5, #0 - adds r1, #0x3d - ldrb r2, [r1] - movs r0, #0 - ldrsb r0, [r1, r0] - cmp r0, #0 - bne _08017CAA - movs r0, #0xff - strb r0, [r1] -_08017CAA: - movs r0, #1 - pop {r4, r5, r6} - pop {r1} - bx r1 - .align 2, 0 -_08017CB4: .4byte gPlayerState -_08017CB8: .4byte 0x00001881 - - thumb_func_start sub_08017CBC -sub_08017CBC: @ 0x08017CBC - push {r4, r5, lr} - adds r4, r0, #0 - adds r3, r1, #0 - movs r5, #0x10 - eors r2, r5 - adds r0, r2, #0 - subs r0, #0xc - movs r2, #0x1f - ands r0, r2 - ldrb r1, [r3, #0x15] - subs r1, r1, r0 - ands r1, r2 - cmp r1, #0x18 - bhi _08017CF0 - adds r1, r4, #0 - adds r1, #0x3d - movs r0, #0xf4 - strb r0, [r1] - adds r1, r3, #0 - adds r1, #0x3d - strb r0, [r1] - adds r0, r4, #0 - adds r1, r3, #0 - bl sub_08017940 - b _08017D1E -_08017CF0: - adds r1, r3, #0 - adds r1, #0x42 - movs r0, #0xc - strb r0, [r1] - adds r0, r3, #0 - adds r0, #0x3d - strb r5, [r0] - adds r1, #1 - movs r0, #0xf0 - strb r0, [r1] - adds r1, #3 - movs r0, #0xc0 - lsls r0, r0, #2 - strh r0, [r1] - adds r1, r4, #0 - adds r1, #0x3d - ldrb r2, [r1] - movs r0, #0 - ldrsb r0, [r1, r0] - cmp r0, #0 - bne _08017D1E - movs r0, #0xff - strb r0, [r1] -_08017D1E: - movs r0, #1 - pop {r4, r5} - pop {r1} - bx r1 - .align 2, 0 - - thumb_func_start sub_08017D28 -sub_08017D28: @ 0x08017D28 - push {lr} - adds r3, r0, #0 - ldr r2, _08017D68 @ =gPlayerState - movs r0, #1 - strb r0, [r2, #0x1a] - adds r2, r3, #0 - adds r2, #0x7a - movs r0, #0x96 - lsls r0, r0, #2 - strh r0, [r2] - subs r2, #0x38 - movs r0, #0xc - strb r0, [r2] - subs r2, #5 - movs r0, #0x10 - strb r0, [r2] - adds r2, #9 - movs r0, #0xa0 - lsls r0, r0, #2 - strh r0, [r2] - adds r1, #0x3d - ldrb r2, [r1] - movs r0, #0 - ldrsb r0, [r1, r0] - cmp r0, #0 - bne _08017D60 - movs r0, #0xff - strb r0, [r1] -_08017D60: - movs r0, #1 - pop {r1} - bx r1 - .align 2, 0 -_08017D68: .4byte gPlayerState - - thumb_func_start sub_08017D6C -sub_08017D6C: @ 0x08017D6C - push {r4, r5, r6, lr} - adds r5, r0, #0 - adds r4, r1, #0 - adds r6, r2, #0 - movs r0, #0x10 - eors r0, r6 - subs r0, #5 - movs r2, #0x1f - ands r0, r2 - ldrb r1, [r4, #0x14] - lsls r1, r1, #3 - subs r1, r1, r0 - ands r1, r2 - cmp r1, #0xa - bls _08017D98 - adds r0, r5, #0 - adds r0, #0x40 - ldrb r0, [r0] - ldr r1, _08017D94 @ =0x00000AC2 - b _08017DB0 - .align 2, 0 -_08017D94: .4byte 0x00000AC2 -_08017D98: - adds r1, r4, #0 - adds r1, #0x41 - movs r0, #0xcb - strb r0, [r1] - adds r1, r5, #0 - adds r1, #0x40 - ldrb r0, [r1] - adds r2, r4, #0 - adds r2, #0x79 - strb r0, [r2] - ldrb r0, [r1] - ldr r1, _08017DCC @ =0x00000AE4 -_08017DB0: - adds r0, r0, r1 - lsls r3, r0, #1 - adds r3, r3, r0 - lsls r3, r3, #2 - ldr r0, _08017DD0 @ =gUnk_080B7B74 - adds r3, r3, r0 - adds r0, r5, #0 - adds r1, r4, #0 - adds r2, r6, #0 - bl sub_08018308 - pop {r4, r5, r6} - pop {r1} - bx r1 - .align 2, 0 -_08017DCC: .4byte 0x00000AE4 -_08017DD0: .4byte gUnk_080B7B74 - - thumb_func_start sub_08017DD4 -sub_08017DD4: @ 0x08017DD4 - push {r4, r5, r6, r7, lr} - mov r7, r8 - push {r7} - mov r8, r0 - adds r5, r1, #0 - adds r7, r2, #0 - mov r1, r8 - adds r1, #0x41 - movs r0, #0 - strb r0, [r1] - adds r1, r5, #0 - adds r1, #0x44 - ldrb r2, [r1] - movs r0, #0x80 - ands r0, r2 - cmp r0, #0 - beq _08017DFC - movs r0, #0x7f - ands r0, r2 - b _08017DFE -_08017DFC: - movs r0, #4 -_08017DFE: - strb r0, [r1] - ldr r4, _08017E34 @ =gPlayerEntity - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_08017874 - adds r1, r4, #0 - adds r1, #0x45 - strb r0, [r1] - adds r2, r5, #0 - adds r2, #0x3d - movs r0, #0xf4 - strb r0, [r2] - ldr r0, _08017E38 @ =gPlayerState - ldr r0, [r0, #0x30] - movs r1, #0x80 - ands r0, r1 - adds r6, r2, #0 - cmp r0, #0 - bne _08017E3C - bl sub_08079D84 - mov r1, r8 - adds r1, #0x3d - movs r0, #0x5a - strb r0, [r1] - b _08017E6E - .align 2, 0 -_08017E34: .4byte gPlayerEntity -_08017E38: .4byte gPlayerState -_08017E3C: - adds r0, r5, #0 - adds r0, #0x40 - ldrb r0, [r0] - movs r1, #0x80 - orrs r0, r1 - adds r1, r4, #0 - adds r1, #0x41 - strb r0, [r1] - subs r1, #4 - movs r0, #0xc - strb r0, [r1] - adds r2, r4, #0 - adds r2, #0x42 - movs r1, #0x10 - movs r0, #0x10 - strb r0, [r2] - eors r7, r1 - adds r0, r4, #0 - adds r0, #0x3e - strb r7, [r0] - adds r1, r4, #0 - adds r1, #0x46 - movs r0, #0xa0 - lsls r0, r0, #2 - strh r0, [r1] -_08017E6E: - ldrb r1, [r6] - movs r0, #0 - ldrsb r0, [r6, r0] - cmp r0, #0 - bne _08017E7C - movs r0, #0xff - strb r0, [r6] -_08017E7C: - movs r0, #1 - pop {r3} - mov r8, r3 - pop {r4, r5, r6, r7} - pop {r1} - bx r1 - - thumb_func_start sub_08017E88 -sub_08017E88: @ 0x08017E88 - push {lr} - adds r3, r0, #0 - adds r3, #0x42 - movs r2, #2 - strb r2, [r3] - adds r0, #0x46 - movs r2, #0xa0 - lsls r2, r2, #2 - strh r2, [r0] - adds r1, #0x3d - ldrb r2, [r1] - movs r0, #0 - ldrsb r0, [r1, r0] - cmp r0, #0 - bne _08017EAA - movs r0, #0xff - strb r0, [r1] -_08017EAA: - movs r0, #1 - pop {r1} - bx r1 - - thumb_func_start sub_08017EB0 -sub_08017EB0: @ 0x08017EB0 - push {r4, r5, r6, r7, lr} - adds r2, r0, #0 - adds r7, r1, #0 - adds r5, r7, #0 - adds r5, #0x44 - ldrb r0, [r5] - cmp r0, #0 - bne _08017EC4 - movs r0, #0 - b _08017F36 -_08017EC4: - ldr r6, _08017EF8 @ =gPlayerEntity - cmp r2, r6 - bne _08017EFC - ldrb r4, [r5] - movs r0, #8 - strb r0, [r5] - adds r0, r6, #0 - adds r1, r7, #0 - bl sub_08017874 - adds r1, r6, #0 - adds r1, #0x45 - strb r0, [r1] - strb r4, [r5] - subs r1, #3 - movs r0, #0xc - strb r0, [r1] - subs r1, #5 - movs r0, #0x10 - strb r0, [r1] - adds r1, #9 - movs r0, #0xc0 - lsls r0, r0, #1 - strh r0, [r1] - b _08017F22 - .align 2, 0 -_08017EF8: .4byte gPlayerEntity -_08017EFC: - ldrh r1, [r2, #8] - movs r0, #0xa1 - lsls r0, r0, #3 - cmp r1, r0 - bne _08017F22 - adds r1, r2, #0 - adds r1, #0x42 - movs r0, #8 - strb r0, [r1] - subs r1, #5 - movs r0, #0xfa - strb r0, [r1] - adds r1, #9 - adds r0, #0x86 - strh r0, [r1] - adds r1, r6, #0 - adds r1, #0x3d - movs r0, #0x80 - strb r0, [r1] -_08017F22: - adds r1, r7, #0 - adds r1, #0x3d - ldrb r2, [r1] - movs r0, #0 - ldrsb r0, [r1, r0] - cmp r0, #0 - bne _08017F34 - movs r0, #0xff - strb r0, [r1] -_08017F34: - movs r0, #1 -_08017F36: - pop {r4, r5, r6, r7} - pop {r1} - bx r1 - - thumb_func_start sub_08017F3C -sub_08017F3C: @ 0x08017F3C - movs r0, #1 - bx lr - - thumb_func_start sub_08017F40 -sub_08017F40: @ 0x08017F40 - push {r4, r5, r6, lr} - adds r4, r0, #0 - adds r5, r1, #0 - adds r0, r5, #0 - adds r0, #0x43 - ldrb r6, [r0] - cmp r6, #0 - bne _0801800A - ldr r0, _08017FAC @ =gPlayerEntity - cmp r4, r0 - bne _08018002 - bl sub_08079F8C - cmp r0, #0 - beq _0801801E - ldr r2, _08017FB0 @ =gPlayerState - ldr r3, [r2, #0x30] -.ifdef EU - movs r0, #0x81 -.else - movs r0, #0x80 -.endif - ands r0, r3 - cmp r0, #0 - bne _0801801E - adds r0, r2, #0 - adds r0, #0x26 - ldrb r0, [r0] - cmp r0, #0 - bne _0801801E - ldrb r1, [r2, #0x1a] - movs r0, #0x80 - orrs r1, r0 - strb r1, [r2, #0x1a] - ldrb r1, [r2, #0xa] - orrs r0, r1 - strb r0, [r2, #0xa] - movs r0, #0x10 - orrs r3, r0 - str r3, [r2, #0x30] - strb r6, [r2, #2] - ldrb r0, [r5, #8] - cmp r0, #3 - bne _08017FB4 - ldrb r0, [r5, #9] - cmp r0, #0x4e - beq _08017F9A - cmp r0, #0x50 - bne _08017FB4 -_08017F9A: - strh r6, [r4, #0x36] - movs r3, #0x80 - lsls r3, r3, #9 - adds r0, r4, #0 - adds r1, r5, #0 - movs r2, #0 - bl PositionRelative - b _08017FC2 - .align 2, 0 -_08017FAC: .4byte gPlayerEntity -_08017FB0: .4byte gPlayerState -_08017FB4: - movs r3, #0x80 - lsls r3, r3, #9 - adds r0, r5, #0 - adds r1, r4, #0 - movs r2, #0 - bl PositionRelative -_08017FC2: - ldrb r1, [r4, #0x10] - movs r0, #0x7f - ands r0, r1 - strb r0, [r4, #0x10] - ldrb r2, [r5, #0x19] - lsrs r2, r2, #6 - lsls r2, r2, #6 - ldrb r3, [r4, #0x19] - movs r1, #0x3f - adds r0, r1, #0 - ands r0, r3 - orrs r0, r2 - strb r0, [r4, #0x19] - ldrb r0, [r5, #0x1b] - lsrs r0, r0, #6 - lsls r0, r0, #6 - ldrb r2, [r4, #0x1b] - ands r1, r2 - orrs r1, r0 - strb r1, [r4, #0x1b] - adds r1, r4, #0 - adds r1, #0x3d - movs r0, #0xff - strb r0, [r1] - adds r1, r5, #0 - adds r1, #0x3d - movs r0, #0xf8 - strb r0, [r1] - bl ResetPlayer - movs r0, #1 - b _08018020 -_08018002: - adds r0, r4, #0 - adds r0, #0x45 - strb r6, [r0] - b _0801801E -_0801800A: - ldrb r0, [r5, #8] - cmp r0, #3 - bne _0801801E - ldr r0, _08018028 @ =gPlayerEntity - cmp r4, r0 - bne _0801801E - adds r0, r5, #0 - adds r1, r4, #0 - bl sub_08004484 -_0801801E: - movs r0, #0 -_08018020: - pop {r4, r5, r6} - pop {r1} - bx r1 - .align 2, 0 -_08018028: .4byte gPlayerEntity - - thumb_func_start sub_0801802C -sub_0801802C: @ 0x0801802C - push {r4, r5, r6, lr} - adds r4, r0, #0 - adds r5, r1, #0 - adds r6, r2, #0 - ldrb r0, [r4, #8] - cmp r0, #1 - bne _08018058 - bl sub_08079F8C - cmp r0, #0 - beq _08018090 - movs r0, #0x10 - eors r0, r6 - ldrb r1, [r5, #0x14] - lsls r1, r1, #2 - subs r0, r0, r1 - adds r0, #5 - movs r1, #0x1f - ands r0, r1 - cmp r0, #0xa - bhi _08018090 - b _0801807A -_08018058: - cmp r0, #8 - bne _08018086 - ldrb r0, [r4, #0x15] - movs r1, #0x10 - eors r1, r0 - ldrb r0, [r5, #0x14] - lsls r0, r0, #2 - subs r1, r1, r0 - adds r1, #5 - movs r0, #0x1f - ands r1, r0 - cmp r1, #0xa - bgt _08018090 - adds r1, r4, #0 - adds r1, #0x45 - movs r0, #0 - strb r0, [r1] -_0801807A: - adds r0, r4, #0 - adds r1, r5, #0 - bl sub_080180BC - movs r0, #1 - b _080180AE -_08018086: - adds r1, r4, #0 - adds r1, #0x45 - movs r0, #0 - strb r0, [r1] - b _080180AE -_08018090: - adds r0, r4, #0 - adds r0, #0x40 - ldrb r0, [r0] - ldr r1, _080180B4 @ =0x000011AA - adds r0, r0, r1 - lsls r3, r0, #1 - adds r3, r3, r0 - lsls r3, r3, #2 - ldr r0, _080180B8 @ =gUnk_080B7B74 - adds r3, r3, r0 - adds r0, r4, #0 - adds r1, r5, #0 - adds r2, r6, #0 - bl sub_08018308 -_080180AE: - pop {r4, r5, r6} - pop {r1} - bx r1 - .align 2, 0 -_080180B4: .4byte 0x000011AA -_080180B8: .4byte gUnk_080B7B74 - - thumb_func_start sub_080180BC -sub_080180BC: @ 0x080180BC - push {lr} - adds r2, r0, #0 - adds r2, #0x3d - movs r0, #0 - ldrsb r0, [r2, r0] - cmp r0, #0 - bne _080180CE - movs r0, #0xe2 - strb r0, [r2] -_080180CE: - adds r2, r1, #0 - adds r2, #0x3d - ldrb r3, [r2] - movs r0, #0 - ldrsb r0, [r2, r0] - cmp r0, #0 - bne _080180E0 - movs r0, #0xff - strb r0, [r2] -_080180E0: - movs r0, #0xff - strb r0, [r1, #0xd] - pop {r0} - bx r0 - - thumb_func_start sub_080180E8 -sub_080180E8: @ 0x080180E8 - push {r4, lr} - mov ip, r0 - adds r4, r1, #0 - movs r0, #0x10 - eors r0, r2 - adds r2, r0, #0 - subs r2, #0xc - movs r1, #0x1f - ands r2, r1 - ldrb r0, [r4, #0x15] - subs r0, r0, r2 - ands r0, r1 - cmp r0, #0x18 - bls _0801812C - mov r0, ip - adds r0, #0x40 - ldrb r0, [r0] - ldr r1, _08018124 @ =0x00000352 - adds r0, r0, r1 - lsls r3, r0, #1 - adds r3, r3, r0 - lsls r3, r3, #2 - ldr r0, _08018128 @ =gUnk_080B7B74 - adds r3, r3, r0 - mov r0, ip - adds r1, r4, #0 - bl sub_08018308 - b _08018162 - .align 2, 0 -_08018124: .4byte 0x00000352 -_08018128: .4byte gUnk_080B7B74 -_0801812C: - mov r0, ip - adds r0, #0x42 - movs r2, #0xc - strb r2, [r0] - subs r0, #5 - movs r1, #0xf0 - strb r1, [r0] - mov r3, ip - adds r3, #0x46 - movs r0, #0xa0 - lsls r0, r0, #2 - strh r0, [r3] - adds r0, r4, #0 - adds r0, #0x42 - strb r2, [r0] - subs r0, #5 - strb r1, [r0] - adds r1, r4, #0 - adds r1, #0x46 - movs r0, #0xc0 - lsls r0, r0, #2 - strh r0, [r1] - mov r0, ip - adds r1, r4, #0 - bl sub_08017940 - movs r0, #1 -_08018162: - pop {r4} - pop {r1} - bx r1 - - thumb_func_start sub_08018168 -sub_08018168: @ 0x08018168 - push {r4, r5, r6, lr} - adds r4, r0, #0 - adds r6, r1, #0 - adds r0, r6, #0 - adds r0, #0x43 - ldrb r5, [r0] - cmp r5, #0 - bne _08018208 - ldr r0, _080181F4 @ =gPlayerEntity - cmp r4, r0 - bne _08018200 - bl sub_08079F8C - cmp r0, #0 - beq _0801821C - ldr r2, _080181F8 @ =gPlayerState - ldr r3, [r2, #0x30] -.ifdef EU - movs r0, #0x81 -.else - ldr r0, _080181FC @ =0x00040080 -.endif - ands r0, r3 - cmp r0, #0 - bne _0801821C - adds r0, r2, #0 - adds r0, #0x26 - ldrb r0, [r0] - cmp r0, #0 - bne _0801821C - ldrb r1, [r2, #0x1a] - movs r0, #0x80 - orrs r1, r0 - strb r1, [r2, #0x1a] - ldrb r1, [r2, #0xa] - orrs r0, r1 - strb r0, [r2, #0xa] - movs r0, #0x80 - lsls r0, r0, #1 - orrs r3, r0 - str r3, [r2, #0x30] - strb r5, [r2, #2] - ldrb r1, [r4, #0x10] - movs r0, #0x7f - ands r0, r1 - strb r0, [r4, #0x10] - ldrb r2, [r6, #0x19] - lsrs r2, r2, #6 - lsls r2, r2, #6 - ldrb r3, [r4, #0x19] - movs r1, #0x3f - adds r0, r1, #0 - ands r0, r3 - orrs r0, r2 - strb r0, [r4, #0x19] - ldrb r0, [r6, #0x1b] - lsrs r0, r0, #6 - lsls r0, r0, #6 - ldrb r2, [r4, #0x1b] - ands r1, r2 - orrs r1, r0 - strb r1, [r4, #0x1b] - adds r1, r4, #0 - adds r1, #0x3d - movs r0, #0xff - strb r0, [r1] - adds r1, r6, #0 - adds r1, #0x3d - movs r0, #0xf8 - strb r0, [r1] - bl sub_08077B20 - movs r0, #1 - b _0801821E - .align 2, 0 -_080181F4: .4byte gPlayerEntity -_080181F8: .4byte gPlayerState -.ifndef EU -_080181FC: .4byte 0x00040080 -.endif -_08018200: - adds r0, r4, #0 - adds r0, #0x45 - strb r5, [r0] - b _0801821C -_08018208: - ldrb r0, [r6, #8] - cmp r0, #3 - bne _0801821C - ldr r0, _08018224 @ =gPlayerEntity - cmp r4, r0 - bne _0801821C - adds r0, r6, #0 - adds r1, r4, #0 - bl sub_08004484 -_0801821C: - movs r0, #0 -_0801821E: - pop {r4, r5, r6} - pop {r1} - bx r1 - .align 2, 0 -_08018224: .4byte gPlayerEntity - - thumb_func_start sub_08018228 -sub_08018228: @ 0x08018228 - push {r4, r5, lr} - adds r4, r0, #0 - adds r5, r1, #0 - ldr r0, _0801824C @ =gPlayerEntity - cmp r4, r0 - bne _08018244 - bl sub_08079F8C - cmp r0, #0 - beq _08018244 - adds r0, r5, #0 - adds r1, r4, #0 - bl sub_08004484 -_08018244: - movs r0, #0 - pop {r4, r5} - pop {r1} - bx r1 - .align 2, 0 -_0801824C: .4byte gPlayerEntity - - thumb_func_start sub_08018250 -sub_08018250: @ 0x08018250 - push {r4, lr} - adds r3, r0, #0 - adds r2, r3, #0 - adds r2, #0x3d - movs r0, #1 - rsbs r0, r0, #0 - adds r4, r0, #0 - movs r0, #0xff - strb r0, [r2] - ldrb r0, [r3, #0x15] - cmp r0, #0 - bne _08018278 - adds r2, r1, #0 - adds r2, #0x3d - movs r0, #0x10 - strb r0, [r2] - adds r0, r3, #0 - bl sub_08017A90 - b _08018280 -_08018278: - adds r1, #0x3d - ldrb r0, [r1] - orrs r0, r4 - strb r0, [r1] -_08018280: - movs r0, #1 - pop {r4} - pop {r1} - bx r1 - - thumb_func_start sub_08018288 -sub_08018288: @ 0x08018288 - push {lr} - adds r1, r0, #0 - ldr r0, _08018298 @ =gPlayerEntity - cmp r1, r0 - bne _0801829C - bl sub_0807AFE8 - b _080182A2 - .align 2, 0 -_08018298: .4byte gPlayerEntity -_0801829C: - adds r1, #0x45 - movs r0, #0 - strb r0, [r1] -_080182A2: - movs r0, #1 - pop {r1} - bx r1 - - thumb_func_start sub_080182A8 -sub_080182A8: @ 0x080182A8 - push {r4, lr} - adds r4, r0, #0 - adds r0, r1, #0 - adds r0, #0x43 - ldrb r0, [r0] - cmp r0, #0 - bne _080182DA - adds r2, r4, #0 - adds r2, #0x3d - ldrb r3, [r2] - movs r0, #0 - ldrsb r0, [r2, r0] - cmp r0, #0 - bne _080182C8 - movs r0, #0xff - strb r0, [r2] -_080182C8: - adds r1, #0x3d - ldrb r2, [r1] - movs r0, #0 - ldrsb r0, [r1, r0] - cmp r0, #0 - bne _08018300 - movs r0, #0xff - strb r0, [r1] - b _08018300 -_080182DA: - adds r0, r4, #0 - adds r0, #0x40 - ldrb r0, [r0] - ldr r3, _080182F8 @ =0x0000092A - adds r0, r0, r3 - lsls r3, r0, #1 - adds r3, r3, r0 - lsls r3, r3, #2 - ldr r0, _080182FC @ =gUnk_080B7B74 - adds r3, r3, r0 - adds r0, r4, #0 - bl sub_08018308 - b _08018302 - .align 2, 0 -_080182F8: .4byte 0x0000092A -_080182FC: .4byte gUnk_080B7B74 -_08018300: - movs r0, #1 -_08018302: - pop {r4} - pop {r1} - bx r1 - - thumb_func_start sub_08018308 -sub_08018308: @ 0x08018308 - push {r4, r5, r6, r7, lr} - mov r7, r8 - push {r7} - adds r6, r0, #0 - adds r4, r1, #0 - mov r8, r2 - adds r5, r3, #0 - movs r3, #0 - adds r0, r4, #0 - adds r0, #0x43 - ldrb r0, [r0] - cmp r0, #0 - beq _08018338 - ldrb r0, [r4, #8] - cmp r0, #3 - bne _08018338 - ldr r0, _0801835C @ =gPlayerEntity - cmp r6, r0 - bne _08018338 - adds r0, r4, #0 - adds r1, r6, #0 - bl sub_08004484 - movs r3, #1 -_08018338: - ldrh r1, [r6, #8] - movs r0, #0xa1 - lsls r0, r0, #3 - cmp r1, r0 - bne _08018360 - ldr r0, _0801835C @ =gPlayerEntity - ldrb r2, [r0, #0x14] - mov r0, r8 - adds r0, #4 - movs r1, #0x18 - ands r0, r1 - lsrs r0, r0, #2 - movs r1, #4 - eors r0, r1 - cmp r2, r0 - bne _08018360 - movs r0, #0 - b _080184F0 - .align 2, 0 -_0801835C: .4byte gPlayerEntity -_08018360: - cmp r3, #0 - bne _08018408 - ldrb r0, [r5] - lsls r0, r0, #4 - adds r1, r6, #0 - adds r1, #0x46 - strh r0, [r1] - ldrb r1, [r5, #1] - adds r2, r6, #0 - adds r2, #0x3d - strb r1, [r2] - lsls r0, r1, #0x18 - cmp r0, #0 - bne _08018382 - movs r0, #0xff - orrs r0, r1 - strb r0, [r2] -_08018382: - ldrb r0, [r5, #2] - adds r1, r6, #0 - adds r1, #0x42 - strb r0, [r1] - ldrb r1, [r5, #3] - adds r0, r4, #0 - adds r0, #0x44 - strb r1, [r0] - movs r7, #0xff - ldrb r0, [r5, #3] - cmp r0, #0 - beq _080183A8 - adds r0, r6, #0 - adds r1, r4, #0 - bl sub_08017874 - adds r1, r6, #0 - adds r1, #0x45 - strb r0, [r1] -_080183A8: - adds r1, r6, #0 - adds r1, #0x43 - ldrb r0, [r5, #4] - ldrb r2, [r1] - cmp r0, r2 - bls _080183B6 - strb r0, [r1] -_080183B6: - ldrb r0, [r5, #5] - lsls r0, r0, #4 - adds r1, r4, #0 - adds r1, #0x46 - strh r0, [r1] - ldrb r1, [r5, #6] - adds r2, r4, #0 - adds r2, #0x3d - strb r1, [r2] - movs r0, #6 - ldrsb r0, [r5, r0] - cmp r0, #0 - bne _080183D6 - movs r0, #0xff - orrs r0, r1 - strb r0, [r2] -_080183D6: - ldrb r0, [r5, #7] - adds r1, r4, #0 - adds r1, #0x42 - strb r0, [r1] - ldrb r1, [r5, #8] - adds r0, r6, #0 - adds r0, #0x44 - strb r1, [r0] - ands r7, r1 - cmp r7, #0 - beq _080183FA - adds r0, r4, #0 - adds r1, r6, #0 - bl sub_08017874 - adds r1, r4, #0 - adds r1, #0x45 - strb r0, [r1] -_080183FA: - adds r1, r4, #0 - adds r1, #0x43 - ldrb r0, [r5, #9] - ldrb r2, [r1] - cmp r0, r2 - bls _08018408 - strb r0, [r1] -_08018408: - ldrb r1, [r5, #0xa] - movs r0, #1 - ands r0, r1 - cmp r0, #0 - beq _0801841A - adds r0, r6, #0 - adds r1, r4, #0 - bl sub_08017940 -_0801841A: - ldrb r2, [r5, #0xa] - movs r0, #2 - ands r0, r2 - cmp r0, #0 - beq _0801842C - adds r1, r6, #0 - adds r1, #0x41 - movs r0, #0xca - strb r0, [r1] -_0801842C: - movs r0, #4 - ands r0, r2 - cmp r0, #0 - beq _0801847E - ldr r2, [r4, #0x50] - cmp r2, #0 - beq _0801847E - adds r1, r2, #0 - adds r1, #0x41 - movs r0, #0xcc - strb r0, [r1] - adds r0, r4, #0 - adds r0, #0x3d - ldrb r0, [r0] - subs r1, #4 - strb r0, [r1] - adds r0, r2, #0 - adds r0, #0x3e - mov r1, r8 - strb r1, [r0] - adds r0, r4, #0 - adds r0, #0x42 - ldrb r0, [r0] - adds r1, r2, #0 - adds r1, #0x42 - strb r0, [r1] - adds r1, #1 - ldrb r0, [r1] - cmp r0, #0 - bne _08018470 - adds r0, r4, #0 - adds r0, #0x43 - ldrb r0, [r0] - strb r0, [r1] -_08018470: - adds r0, r4, #0 - adds r0, #0x46 - ldrh r0, [r0] - adds r1, r2, #0 - adds r1, #0x46 - strh r0, [r1] - str r6, [r2, #0x4c] -_0801847E: - ldrb r1, [r6, #8] - cmp r1, #8 - bne _080184DA - ldrb r0, [r6, #9] - cmp r0, #1 - bne _0801849A - ldrb r0, [r5, #8] - cmp r0, #0 - beq _080184DA - adds r0, r6, #0 - adds r1, r4, #0 - bl sub_080179EC - b _080184DA -_0801849A: - cmp r0, #4 - bne _080184BA - adds r0, r6, #0 - adds r0, #0x44 - ldrb r0, [r0] - cmp r0, #0 - bne _080184B0 - ldrb r0, [r5, #0xa] - ands r1, r0 - cmp r1, #0 - beq _080184DA -_080184B0: - adds r0, r6, #0 - adds r1, r4, #0 - bl sub_08017A90 - b _080184DA -_080184BA: - cmp r0, #3 - bne _080184CE - ldrb r0, [r5, #9] - cmp r0, #0 - beq _080184DA - adds r0, r4, #0 - movs r1, #0xfe - bl sub_0800449C - b _080184DA -_080184CE: - cmp r0, #5 - bne _080184DA - ldr r0, _080184FC @ =gPlayerEntity - adds r0, #0x3d - movs r1, #0x80 - strb r1, [r0] -_080184DA: - ldrb r0, [r4, #8] - cmp r0, #8 - bne _080184EE - ldrb r0, [r6, #9] - cmp r0, #5 - bne _080184EE - ldr r0, _080184FC @ =gPlayerEntity - adds r0, #0x3d - movs r1, #0x80 - strb r1, [r0] -_080184EE: - movs r0, #1 -_080184F0: - pop {r3} - mov r8, r3 - pop {r4, r5, r6, r7} - pop {r1} - bx r1 - .align 2, 0 -_080184FC: .4byte gPlayerEntity diff --git a/asm/code_0806EC20.s b/asm/code_0806EC20.s index ff7f71a1..447e31be 100644 --- a/asm/code_0806EC20.s +++ b/asm/code_0806EC20.s @@ -58,8 +58,8 @@ _0806EC6E: .align 2, 0 _0806EC74: .4byte gUnk_08114AE4 - thumb_func_start sub_0806EC78 -sub_0806EC78: @ 0x0806EC78 + thumb_func_start InitNPC +InitNPC: @ 0x0806EC78 push {r4, r5, lr} adds r4, r0, #0 ldrb r1, [r4, #0x10] diff --git a/asm/code_0807F0D8.s b/asm/code_0807F0D8.s index df197ed3..6eaef89b 100644 --- a/asm/code_0807F0D8.s +++ b/asm/code_0807F0D8.s @@ -625,7 +625,7 @@ _080800C6: bne _080800FC movs r0, #3 strb r0, [r5, #3] - bl sub_0805E9F4 + bl DeleteSleepingEntities bl sub_0807C810 ldr r1, _080800F4 @ =gUnk_08109194 ldr r0, _080800F8 @ =gUnk_03004030 diff --git a/asm/code_080A3BD0.s b/asm/code_080A3BD0.s index 47338cc4..ac544ed9 100644 --- a/asm/code_080A3BD0.s +++ b/asm/code_080A3BD0.s @@ -1263,7 +1263,7 @@ _080A4550: cmp r0, #7 bne _080A456A adds r0, r4, #0 - bl sub_0806EC78 + bl InitNPC ldrb r0, [r4, #9] strb r0, [r4, #0xf] movs r0, #0x56 diff --git a/asm/updateBackgroundRegisters.s b/asm/dispCtrlSet.s similarity index 94% rename from asm/updateBackgroundRegisters.s rename to asm/dispCtrlSet.s index 94c37ab2..7f170352 100644 --- a/asm/updateBackgroundRegisters.s +++ b/asm/dispCtrlSet.s @@ -1,12 +1,4 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - .syntax unified - - .text - - thumb_func_start DispCtrlSet -DispCtrlSet: @ 0x08016CF4 ldr r3, _08016DF0 @ =gScreen ldrh r1, [r3] ldrh r0, [r3, #6] @@ -136,3 +128,4 @@ DispCtrlSet: @ 0x08016CF4 .align 2, 0 _08016DF0: .4byte gScreen _08016DF4: .4byte 0x04000020 + .syntax divided \ No newline at end of file diff --git a/asm/fileScreen.s b/asm/fileScreen.s index ba9cbbfd..0b431a67 100755 --- a/asm/fileScreen.s +++ b/asm/fileScreen.s @@ -242,7 +242,7 @@ _0805173E: adds r0, r2, #0 bl SoundReq _08051796: - bl sub_0805E9F4 + bl DeleteSleepingEntities bl sub_0805BC04 adds r4, r0, #0 cmp r4, #0 @@ -324,7 +324,7 @@ _08051B02: adds r0, r2, #0 bl SoundReq _08051B5A: - bl sub_0805E9F4 + bl DeleteSleepingEntities bl sub_0805BC04 adds r4, r0, #0 cmp r4, #0 diff --git a/asm/intr.s b/asm/intr.s index fc981eb3..735f7115 100644 --- a/asm/intr.s +++ b/asm/intr.s @@ -268,8 +268,8 @@ UpdateCollision: @ 0x080B1C54 strb r1, [r3] bx lr - arm_func_start sub_080B1C7C -sub_080B1C7C: @ 0x080B1C7C + arm_func_start CollideAll +CollideAll: @ 0x080B1C7C push {r4, r5, r6, r7, r8, sb, sl, lr} add r0, pc, #0x104 @ =_080B1D8C ldm r0, {r8, sb, sl} @@ -314,7 +314,7 @@ _080B1CC8: orrs r0, r0, r2 bne _080B1CC8 _080B1D20: - bl sub_080B1D98 + bl CalcCollision cmp r0, #0 beq _080B1CC8 ldrb r3, [r4, #0x3c] @@ -348,8 +348,10 @@ _080B1D8C: .4byte gUnk_02018EA0 _080B1D90: .4byte gCollidableList _080B1D94: .4byte gCollidableCount - arm_func_start sub_080B1D98 -sub_080B1D98: @ 0x080B1D98 + arm_func_start CalcCollision +CalcCollision: @ 0x080B1D98 + @ r6 = this, r7 = other + push {r2, r3, r6, r7, r8, sb, ip, lr} ldr r6, [r4, #0x48] ldr r7, [r5, #0x48] @@ -408,7 +410,7 @@ sub_080B1D98: @ 0x080B1D98 _080B1E74: mov r2, #0 mov ip, #0 - bl sub_080B237C + bl CalcCollisionDirection mov r6, r0 ldrb r1, [r5, #0x3f] mov r0, #0x22 @@ -417,7 +419,7 @@ _080B1E74: add r0, r0, r1 mov r1, #0xc mul r2, r0, r1 - ldr r1, _080B2014 @ =gUnk_080B7B74 + ldr r1, _080B2014 @ =gCollisionMtx add r3, r2, r1 mov r1, #0 ldrb r0, [r3] @@ -532,7 +534,7 @@ _080B2004: .4byte gUnk_03005D18 _080B2008: .4byte gUnk_03005D58 _080B200C: .4byte gCollidableList _080B2010: .4byte gCollidableCount -_080B2014: .4byte gUnk_080B7B74 +_080B2014: .4byte gCollisionMtx _080B2018: .4byte gUnk_080B3744 arm_func_start IntrMain @@ -796,8 +798,8 @@ _080B236C: .align 2, 0 _080B2378: .4byte sub_080044AE - arm_func_start sub_080B237C -sub_080B237C: @ 0x080B237C + arm_func_start CalcCollisionDirection +CalcCollisionDirection: @ 0x080B237C subs r2, r2, r0 movpl r0, #0 movmi r0, #0x20 diff --git a/asm/jarPortal.s b/asm/jarPortal.s deleted file mode 100644 index a42aa8ad..00000000 --- a/asm/jarPortal.s +++ /dev/null @@ -1,8 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - diff --git a/asm/non_matching/arm_proxy/NPCUpdate.inc b/asm/non_matching/arm_proxy/NPCUpdate.inc index 278daa48..bb62b469 100644 --- a/asm/non_matching/arm_proxy/NPCUpdate.inc +++ b/asm/non_matching/arm_proxy/NPCUpdate.inc @@ -23,10 +23,10 @@ _08017550: cmp r0, #0 bne _08017566 adds r0, r4, #0 - bl sub_0806EC78 + bl InitNPC _08017566: adds r0, r4, #0 - bl sub_0805E3B0 + bl CheckDontUpdate cmp r0, #0 bne _08017584 ldr r2, _080175DC @ =gNPCFunctions diff --git a/asm/non_matching/collision/sub_08017CBC.inc b/asm/non_matching/collision/sub_08017CBC.inc new file mode 100644 index 00000000..470a013e --- /dev/null +++ b/asm/non_matching/collision/sub_08017CBC.inc @@ -0,0 +1,57 @@ + .syntax unified + push {r4, r5, lr} + adds r4, r0, #0 + adds r3, r1, #0 + movs r5, #0x10 + eors r2, r5 + adds r0, r2, #0 + subs r0, #0xc + movs r2, #0x1f + ands r0, r2 + ldrb r1, [r3, #0x15] + subs r1, r1, r0 + ands r1, r2 + cmp r1, #0x18 + bhi _08017CF0 + adds r1, r4, #0 + adds r1, #0x3d + movs r0, #0xf4 + strb r0, [r1] + adds r1, r3, #0 + adds r1, #0x3d + strb r0, [r1] + adds r0, r4, #0 + adds r1, r3, #0 + bl sub_08017940 + b _08017D1E +_08017CF0: + adds r1, r3, #0 + adds r1, #0x42 + movs r0, #0xc + strb r0, [r1] + adds r0, r3, #0 + adds r0, #0x3d + strb r5, [r0] + adds r1, #1 + movs r0, #0xf0 + strb r0, [r1] + adds r1, #3 + movs r0, #0xc0 + lsls r0, r0, #2 + strh r0, [r1] + adds r1, r4, #0 + adds r1, #0x3d + ldrb r2, [r1] + movs r0, #0 + ldrsb r0, [r1, r0] + cmp r0, #0 + bne _08017D1E + movs r0, #0xff + strb r0, [r1] +_08017D1E: + movs r0, #1 + pop {r4, r5} + pop {r1} + bx r1 + .align 2, 0 + .syntax divided diff --git a/asm/non_matching/collision/sub_0801802C.inc b/asm/non_matching/collision/sub_0801802C.inc new file mode 100644 index 00000000..66be3cf4 --- /dev/null +++ b/asm/non_matching/collision/sub_0801802C.inc @@ -0,0 +1,75 @@ + .syntax unified + push {r4, r5, r6, lr} + adds r4, r0, #0 + adds r5, r1, #0 + adds r6, r2, #0 + ldrb r0, [r4, #8] + cmp r0, #1 + bne _08018058 + bl sub_08079F8C + cmp r0, #0 + beq _08018090 + movs r0, #0x10 + eors r0, r6 + ldrb r1, [r5, #0x14] + lsls r1, r1, #2 + subs r0, r0, r1 + adds r0, #5 + movs r1, #0x1f + ands r0, r1 + cmp r0, #0xa + bhi _08018090 + b _0801807A +_08018058: + cmp r0, #8 + bne _08018086 + ldrb r0, [r4, #0x15] + movs r1, #0x10 + eors r1, r0 + ldrb r0, [r5, #0x14] + lsls r0, r0, #2 + subs r1, r1, r0 + adds r1, #5 + movs r0, #0x1f + ands r1, r0 + cmp r1, #0xa + bgt _08018090 + adds r1, r4, #0 + adds r1, #0x45 + movs r0, #0 + strb r0, [r1] +_0801807A: + adds r0, r4, #0 + adds r1, r5, #0 + bl sub_080180BC + movs r0, #1 + b _080180AE +_08018086: + adds r1, r4, #0 + adds r1, #0x45 + movs r0, #0 + strb r0, [r1] + b _080180AE +_08018090: + adds r0, r4, #0 + adds r0, #0x40 + ldrb r0, [r0] + ldr r1, _080180B4 @ =0x000011AA + adds r0, r0, r1 + lsls r3, r0, #1 + adds r3, r3, r0 + lsls r3, r3, #2 + ldr r0, _080180B8 @ =gCollisionMtx + adds r3, r3, r0 + adds r0, r4, #0 + adds r1, r5, #0 + adds r2, r6, #0 + bl sub_08018308 +_080180AE: + pop {r4, r5, r6} + pop {r1} + bx r1 + .align 2, 0 +_080180B4: .4byte 0x000011AA +_080180B8: .4byte gCollisionMtx + .syntax divided \ No newline at end of file diff --git a/asm/object11.s b/asm/object11.s index 165dd5ab..2c8211d8 100644 --- a/asm/object11.s +++ b/asm/object11.s @@ -11,7 +11,7 @@ Object11: @ 0x08084D34 push {r4, lr} adds r4, r0, #0 - bl sub_0805E3B0 + bl CheckDontUpdate cmp r0, #0 bne _08084D50 ldr r0, _08084D54 @ =gUnk_0812057C diff --git a/asm/object1E.s b/asm/object1E.s index e3168e6a..5191f789 100644 --- a/asm/object1E.s +++ b/asm/object1E.s @@ -11,7 +11,7 @@ Object1E: @ 0x08087504 push {r4, lr} adds r4, r0, #0 - bl sub_0805E3B0 + bl CheckDontUpdate cmp r0, #0 bne _08087520 ldr r0, _08087524 @ =gUnk_081208B8 diff --git a/asm/sub_08016AE4.s b/asm/sub_08016AE4.s index c5b75bef..5de15a92 100644 --- a/asm/sub_08016AE4.s +++ b/asm/sub_08016AE4.s @@ -18,7 +18,7 @@ ProjectileUpdate: @ 0x08016AE4 bne _08016B0A bl DeleteThisEntity _08016AFC: - bl sub_0805E3B0 + bl CheckDontUpdate cmp r0, #0 bne _08016B22 adds r0, r4, #0 diff --git a/asm/sub_080A2838.s b/asm/sub_080A2838.s index 57383f72..643d1ae1 100644 --- a/asm/sub_080A2838.s +++ b/asm/sub_080A2838.s @@ -6,8 +6,8 @@ .text - thumb_func_start sub_080A2838 -sub_080A2838: @ 0x080A2838 + thumb_func_start InitObject +InitObject: @ 0x080A2838 push {r4, lr} adds r4, r0, #0 ldrb r2, [r4, #9] diff --git a/data/data_080B2A70.s b/data/data_080B2A70.s index 80681df3..f25effdf 100644 --- a/data/data_080B2A70.s +++ b/data/data_080B2A70.s @@ -5,20 +5,20 @@ .align 2 gUnk_080B2A70:: @ 080B2A70 - .4byte sub_08016B30 - .4byte sub_08016B30 - .4byte sub_08016B30 + .4byte DummyIntr + .4byte DummyIntr + .4byte DummyIntr .4byte HBlankIntr - .4byte sub_08016B6C - .4byte sub_08016B30 - .4byte sub_08016B30 - .4byte sub_08016B30 - .4byte sub_08016B30 - .4byte sub_08016B30 - .4byte sub_08016B30 - .4byte sub_08016B30 - .4byte sub_08016B30 - .4byte sub_08016B30 + .4byte VBlankIntr + .4byte DummyIntr + .4byte DummyIntr + .4byte DummyIntr + .4byte DummyIntr + .4byte DummyIntr + .4byte DummyIntr + .4byte DummyIntr + .4byte DummyIntr + .4byte DummyIntr @ TODO contains some pointers to iwram diff --git a/data/data_080B3740.s b/data/data_080B3740.s index 393f1e17..7eadfad5 100644 --- a/data/data_080B3740.s +++ b/data/data_080B3740.s @@ -9,9 +9,9 @@ gUnk_080B3740:: @ 080B3740 gUnk_080B3744:: @ 080B3744 .4byte sub_08018308 - .4byte sub_08017AD8 - .4byte sub_08017AD8 - .4byte sub_08017ADC + .4byte CollisionNoOp + .4byte CollisionNoOp + .4byte CollisionGroundItem .4byte sub_08017B58 .4byte sub_08017EB0 .4byte sub_08017F3C diff --git a/data/data_080B7B74.s b/data/data_080B7B74.s index 32ea1744..9f7e39d3 100644 --- a/data/data_080B7B74.s +++ b/data/data_080B7B74.s @@ -4,7 +4,7 @@ .section .rodata .align 2 -gUnk_080B7B74:: @ 080B7B74 +gCollisionMtx:: @ 080B7B74 .incbin "baserom.gba", 0x0B7B74, 0x00004BA gUnk_080B802E:: @ 080B802E diff --git a/include/entity.h b/include/entity.h index 1873138f..b6793df1 100644 --- a/include/entity.h +++ b/include/entity.h @@ -42,17 +42,17 @@ typedef struct { typedef struct Entity { /*0x00*/ struct Entity* prev; /*0x04*/ struct Entity* next; - /*0x08*/ u8 kind; // was: type - /*0x09*/ u8 id; // was: subtype - /*0x0a*/ u8 type; // was: form - /*0x0b*/ u8 type2; // was: parameter + /*0x08*/ u8 kind; + /*0x09*/ u8 id; + /*0x0a*/ u8 type; + /*0x0b*/ u8 type2; /*0x0c*/ u8 action; /*0x0d*/ u8 subAction; /*0x0e*/ u8 actionDelay; /*0x0f*/ u8 field_0xf; /*0x10*/ u8 flags; - /*0x11*/ u8 scriptedScene : 4; - /* */ u8 scriptedScene2 : 4; + /*0x11*/ u8 updateConditions : 4; // should we update this sprite during pause + /* */ u8 updateConditions2 : 4; /*0x12*/ s16 spriteIndex; /*0x14*/ u8 animationState; /*0x15*/ u8 direction; @@ -110,12 +110,12 @@ typedef struct Entity { /*0x3c*/ u8 field_0x3c; /*0x3d*/ s8 iframes; /*0x3e*/ u8 knockbackDirection; - /*0x3f*/ u8 damageType; - /*0x40*/ u8 field_0x40; + /*0x3f*/ u8 hitType; // behavior as a collision sender + /*0x40*/ u8 hurtType; // behavior as a collision reciever /*0x41*/ u8 bitfield; /*0x42*/ u8 knockbackDuration; /*0x43*/ u8 field_0x43; - /*0x44*/ u8 field_0x44; + /*0x44*/ u8 damage; /*0x45*/ u8 currentHealth; /*0x46*/ u16 field_0x46; /*0x48*/ Hitbox* hitbox; @@ -165,9 +165,20 @@ extern LinkedList gUnk_03003D90; extern LinkedList gUnk_03003DA0; +enum { + ENT_DID_INIT = 0x1, + ENT_SCRIPTED = 0x2, + ENT_ASLEEP = 0x10, + ENT_20 = 0x20, + ENT_COLLIDE = 0x80, +}; + +#define COLLISION_OFF(entity) ((entity)->flags &= ~ENT_COLLIDE) +#define COLLISION_ON(entity) ((entity)->flags |= ENT_COLLIDE) + #define TILE(x, y) \ - (((((x) - gRoomControls.roomOriginX) >> 4) & 0x3fU) | \ - ((((y) - gRoomControls.roomOriginY) >> 4) & 0x3fU) << 6) + (((((x) - gRoomControls.roomOriginX) >> 4) & 0x3F) | \ + ((((y) - gRoomControls.roomOriginY) >> 4) & 0x3F) << 6) #define COORD_TO_TILE(entity) \ TILE((entity)->x.HALF.HI, (entity)->y.HALF.HI) @@ -186,9 +197,10 @@ enum { #define DirectionRoundUp(expr) DirectionRound((expr) + 4) #define DirectionIsHorizontal(expr) ((expr) & 0x08) #define DirectionIsVertical(expr) ((expr) & 0x10) -#define DirectionTurnAround(expr) (DirectionRoundUp(expr) ^ 0x10) +#define DirectionTurnAround(expr) ((expr) ^ 0x10) #define DirectionToAnimationState(expr) (DirectionRoundUp(expr) >> 3) #define DirectionFromAnimationState(expr) ((expr) << 3) +#define DirectionNormalize(expr) ((expr) & 0x1f) #define Direction8Round(expr) ((expr) & 0x1c) #define Direction8RoundUp(expr) Direction8Round((expr) + 2) diff --git a/include/main.h b/include/main.h index b358ba49..99007163 100644 --- a/include/main.h +++ b/include/main.h @@ -96,7 +96,7 @@ extern void sub_0804FF84(u32); extern u16 gPaletteBuffer[]; extern void VBlankInterruptWait(void); extern void DisableInterruptsAndDMA(void); -extern void sub_08016B34(void); +extern void EnableVBlankIntr(void); static void sub_08055F70(void); static bool32 SoftResetKeysPressed(void); diff --git a/include/player.h b/include/player.h index 11d91234..b33a2b8f 100644 --- a/include/player.h +++ b/include/player.h @@ -92,7 +92,7 @@ typedef struct { /* */ u8 swordBlueParticle : 1; /* */ u8 filler14 : 6; /*0x3f*/ u8 field_0x3f; - /*0x40*/ u8 field_0x40[64]; + /*0x40*/ u8 hurtType[64]; /*0x80*/ u16 field_0x80; /*0x82*/ u8 field_0x82[9]; /*0x8b*/ u8 field_0x8b; @@ -161,6 +161,10 @@ extern Entity gPlayerEntity; extern u32 GetInventoryValue(u32); extern s32 ModHealth(s32); extern void ModRupees(s32); + +#define COPY_FLAG_FROM_TO(base, src, dest) (base) = ((base) & ~(dest)) | (((dest) * ((base) & (src))) / src) + + #endif // clang-format on diff --git a/include/structures.h b/include/structures.h index 9f3f1276..bc5f13ea 100644 --- a/include/structures.h +++ b/include/structures.h @@ -61,7 +61,7 @@ typedef struct { u8 field_0x3c; u8 field_0x3d; u16 field_0x3e; - u16 field_0x40; + u16 hurtType; u16 field_0x42; u16 field_0x44; u16 field_0x46; diff --git a/linker.ld b/linker.ld index a14b7752..284ad05c 100644 --- a/linker.ld +++ b/linker.ld @@ -331,10 +331,8 @@ SECTIONS { /* C source compiled with interworking */ - asm/code_08016B30.o(.text); - asm/updateBackgroundRegisters.o(.text); - src/arm_proxy.o(.text); - asm/code_08016DF8.o(.text); + src/interrupts.o(.text); + src/collision.o(.text); /* C source compiled without interworking */ asm/code_08018500.o(.text); src/code_08018C58.o(.text); @@ -757,7 +755,6 @@ SECTIONS { asm/object36.o(.text); asm/object37.o(.text); src/object/jarPortal.o(.text); - asm/jarPortal.o(.text); asm/bossDoor.o(.text); asm/object3A.o(.text); asm/macroMushroomStalks.o(.text); diff --git a/src/collision.c b/src/collision.c new file mode 100644 index 00000000..9c0309c7 --- /dev/null +++ b/src/collision.c @@ -0,0 +1,714 @@ +#include "global.h" +#include "entity.h" +#include "player.h" +#include "save.h" +#include "random.h" +#include "utils.h" +#include "functions.h" +#include "enemy.h" +#include "effects.h" + +extern u8 gCollidableCount; +extern u8 gUnk_080B3740[]; + +typedef struct { + u8 _0; + u8 _1; + u8 _2; + u8 _3; + u8 _4; + u8 _5; + s8 _6; + u8 _7; + u8 _8; + u8 _9; + u8 _a; + u8 _b; +} ColSettings; + +extern ColSettings gCollisionMtx[173 * 34]; + +extern void gDoCollision(void); +u32 sub_08081420(Entity*); +extern void sub_0800449C(Entity*, u32); +s32 sub_08018308(Entity*, Entity*, u32, ColSettings*); +void sub_08079D84(void); +void sub_080180BC(Entity*, Entity*); +void sub_0807AFE8(void); + +typedef struct { + void* last; + void* first; + void* node; + u8 flags; +} LinkedList2; + +extern LinkedList2 gUnk_03003C70[16]; +extern LinkedList2* gUnk_02018EA0; + +void ClearHitboxList(void) { + gCollidableCount = 0; +} + +void CollisionMain(void) { + void (*doCollision)(void); + u32 temp; + + temp = gUnk_03003DC0.unk0; + if (gUnk_03003DC0.unk0 <= gUnk_03003DC0.unk1) + temp = gUnk_03003DC0.unk1; + if (temp != 0) + return; + + doCollision = &gDoCollision; + // Check to see if we should disable collision this frame + if (gPlayerState.field_0x8b != 0) { + u32 flags = gPlayerEntity.flags; + COLLISION_OFF(&gPlayerEntity); + doCollision(); + gPlayerEntity.flags = flags; // reset collision to before + } else { + doCollision(); + } +} + +void RegisterPlayerHitbox(void) { + MemClear(&gUnk_03003C70, sizeof(gUnk_03003C70)); + gUnk_02018EA0 = (LinkedList2*)&gUnk_03003C70[0].last; + gUnk_03003C70[0].last = &gUnk_03003C70[0].last; + gUnk_03003C70[0].first = &gUnk_03003C70[0].last; + gUnk_03003C70[0].node = &gPlayerEntity; +} + +// Loop declaration seems wrong +NONMATCH("asm/non_matching/arm_proxy/sub_0801766C.inc", u32 sub_0801766C(Entity* this)) { + u32 uVar1; + LinkedList2* puVar3; + LinkedList2* puVar2; + LinkedList2* pLVar2; + LinkedList2* i; + u8* pbVar4; + + if (this->spritePriority.b2 != 0) { + return 1; + } else { + for (i = &gUnk_03003C70[0]; i < &gUnk_03003C70[16]; ++i) { + if (i->node == NULL) { + i->node = this; + i->flags = 0; + this->spritePriority.b2 = 1; + pLVar2 = gUnk_02018EA0; + if (gUnk_02018EA0->flags != 0) { + do { + pLVar2 = pLVar2->first; + } while (pLVar2->flags != 0); + i->first = pLVar2; + puVar3 = pLVar2->last; + i->last = puVar3; + puVar3->first = i; + pLVar2->last = i; + } else { + i->first = gUnk_02018EA0; + puVar2 = gUnk_02018EA0->last; + i->last = puVar2; + puVar2->first = i; + gUnk_02018EA0->last = i; + gUnk_02018EA0 = i; + } + return 1; + } + } + return 0; + } +} +END_NONMATCH + +// same loop issue +NONMATCH("asm/non_matching/arm_proxy/sub_080176E4.inc", u32 sub_080176E4(Entity* this)) { + u32 uVar1; + LinkedList2* j; + LinkedList2* i; + u8* pbVar4; + + if (this->spritePriority.b2 != 0) { + return 1; + } else { + for (i = &gUnk_03003C70[0]; i < &gUnk_03003C70[16]; ++i) { + if (i->node == NULL) { + i->node = this; + i->flags = 1; + this->spritePriority.b2 = 1; + i->first = gUnk_02018EA0; + j = gUnk_02018EA0->last; + i->last = j; + j->first = i; + gUnk_02018EA0->last = i; + gUnk_02018EA0 = i; + return 1; + } + } + return 0; + } +} +END_NONMATCH + +// you guessed it +NONMATCH("asm/non_matching/arm_proxy/sub_08017744.inc", void sub_08017744(Entity* this)) { + LinkedList2* i; + for (i = &gUnk_03003C70[0]; i < &gUnk_03003C70[16]; ++i) { + if (i->node == this) { + if (this->spritePriority.b2 != 0) { + this->spritePriority.b2 = 0; + i->node = NULL; + ((LinkedList2*)i->last)->first = i->first; + ((LinkedList2*)i->first)->last = i->last; + if (i != gUnk_02018EA0) + return; + gUnk_02018EA0 = i->first; + } + } + } +} +END_NONMATCH + +// regalloc +NONMATCH("asm/non_matching/arm_proxy/sub_080177A0.inc", bool32 sub_080177A0(Entity* this, Entity* that)) { + u32 this_d; + u32 depth; + + if ((that->collisionLayer & this->collisionLayer) != 0) { + Hitbox* bb_this = this->hitbox; + Hitbox* bb_that = that->hitbox; + u32 this_w = bb_this->width; + u32 that_w = bb_that->width; + if ((((this->x.HALF.HI - that->x.HALF.HI) + bb_this->offset_x) - bb_that->offset_x) + this_w + that_w <= + (this_w + that_w) * 2) { + u32 this_h = bb_this->height; + u32 that_h = bb_that->height; + if ((((this->y.HALF.HI - that->y.HALF.HI) + bb_this->offset_y) - bb_that->offset_y) + this_h + that_h <= + (this_h + that_h) * 2) { + if ((this->field_0x3c & 0x10) != 0) + this_d = ((Hitbox3D*)bb_this)->depth; + else + this_d = 5; + if ((that->field_0x3c & 0x10) != 0) + depth = this_d + ((Hitbox3D*)bb_that)->depth; + else + depth = this_d + 5; + if ((this->height.HALF.HI - that->height.HALF.HI) + depth <= depth * 2) + return TRUE; + } + } + } + return FALSE; +} +END_NONMATCH + +bool32 sub_08017850(Entity* this) { + if (sub_08079F8C()) + return sub_080177A0(this, &gPlayerEntity); + return FALSE; +} + +s32 sub_08017874(Entity* a, Entity* b) { + s32 newDmg; + s32 v5; + s32 v6; + + asm("" ::: "r1"); + if (a->kind == 1) { + newDmg = b->damage; + switch (gSave.stats.charm) { + case 47: + newDmg /= 4; + break; + case 48: + newDmg /= 2; + break; + } + if (newDmg <= 0) + newDmg = 1; + v5 = ModHealth(-newDmg); + sub_0800449C(a, 122); + } else { + v6 = b->damage; + if (b->kind == 8) { + switch (gSave.stats.charm) { + case 48: + v6 = 3 * v6 / 2; + break; + case 49: + v6 *= 2; + break; + } + } + v5 = a->currentHealth - v6; + if (a->kind == 3) { + if ((a->field_0x6c.HALF.HI & 1) != 0) + sub_0800449C(a, 295); + else + sub_0800449C(a, 254); + } + } + if (v5 <= 0) { + COLLISION_OFF(a); + return 0; + } + return v5; +} + +void sub_08017940(Entity* org, Entity* tgt) { + Entity* e; + u32 r1; + + e = CreateFx(tgt, FX_REFECT3, 0); + if (e != NULL) { + e->spritePriority.b0 = 2; + e->x.HALF.HI = (org->x.HALF.HI + org->hitbox->offset_x + tgt->x.HALF.HI + tgt->hitbox->offset_x) >> 1; + e->y.HALF.HI = (org->y.HALF.HI + org->hitbox->offset_y + tgt->y.HALF.HI + tgt->hitbox->offset_y) >> 1; + e->height.HALF.HI = (org->height.HALF.HI + tgt->height.HALF.HI) >> 1; + e->collisionLayer = org->collisionLayer; + UpdateSpriteForCollisionLayer(e); + } + + r1 = 0; + + r1 = (u32)(org == &gPlayerEntity ? gPlayerEntity.knockbackDuration + : (tgt == &gPlayerEntity ? tgt->knockbackDuration : 0)) >> + 3; + + // Anything requiring the evaluation of r1 could be written here. + // The compiler is not smart enough to know that r1 has no side effects, + // so the above code will still generate. + r1 = !r1 ? !!r1 : !!!r1; +} + +void sub_080179EC(Entity* a1, Entity* a2) { + u8* p = gUnk_080B3740; + u32 rand = Random(); + Entity* e = CreateFx(a2, p[rand & 3], 0); + if (e != NULL) { + PositionRelative(a2, e, a2->hitbox->offset_x << 16, a2->hitbox->offset_y << 16); + e->spritePriority.b0 = 2; + e->spriteOffsetX = (a1->x.HALF.HI + a1->hitbox->offset_x - (a2->x.HALF.HI + a2->hitbox->offset_x)) >> 1; + e->spriteOffsetY = (a1->y.HALF.HI + a1->hitbox->offset_y - (a2->y.HALF.HI + a2->hitbox->offset_y)) >> 1; + e->attachedEntity = a2; + } +} + +Entity* sub_08017A90(Entity* a1, Entity* parent) { + Entity* e; + + e = (Entity*)CreateObject(153, 0, 0); + if (e != NULL) { + e->animationState = (a1->direction >> 3) & 3; + e->spriteOffsetX = a1->x.HALF.HI - parent->x.HALF.HI; + e->spriteOffsetY = a1->y.HALF.HI - parent->y.HALF.HI; + e->parent = parent; + return e; + } + return NULL; +} + +u32 CollisionNoOp(Entity* org, Entity* tgt, u32 direction) { + return 0; +} + +// origin: player or sword +// target: item +s32 CollisionGroundItem(Entity* org, Entity* tgt, u32 direction) { + COLLISION_OFF(tgt); + tgt->bitfield = org->hurtType | 0x80; + if ((tgt->type == 0x5F || tgt->type == 0x60) && sub_08081420(tgt)) + tgt->currentHealth = 0; + return 2; +} + +s32 sub_08017B1C(Entity* org, Entity* tgt, u32 direction) { + if ((gPlayerState.field_0x1d[1] & 0x60) != 0) { + COLLISION_OFF(tgt); + } else { + org->knockbackDuration = 0x10; + org->iframes = -20; + org->field_0x46 = 640; + } + return 1; +} + +s32 sub_08017B58(Entity* org, Entity* tgt, u32 direction) { + if ((tgt->field_0x3a & 4) != 0) { + if (tgt->field_0x1d) { + s32 x = tgt->field_0x1d = tgt->field_0x1d - gPlayerState.field_0x1d[0]; + if (x << 24 <= 0) { + tgt->field_0x1d = 0; + tgt->subAction = 2; + tgt->field_0x46 = 0; + } + } + } else { + tgt->subAction = 0; + tgt->field_0x3a |= 4u; + } + if (tgt->iframes == 0) + tgt->iframes = -1; + return 1; +} + +s32 sub_08017BBC(Entity* org, Entity* tgt, u32 direction) { + if ((gPlayerState.flags & (0x1 | 0x80 | 0x400 | 0x1000)) == 0) { + Entity* e = CreateObject(66, 1, 0); + if (e != NULL) { + e->attachedEntity = org; + gPlayerState.flags |= 0x400; + org->animationState = (direction ^ 0x10) >> 2; + } + } + tgt->damage = 4; + org->currentHealth = sub_08017874(org, tgt); + org->knockbackDuration = 12; + org->iframes = 30; + org->field_0x46 = 384; + if (tgt->iframes == 0) + tgt->iframes = -1; + return 1; +} + +s32 sub_08017C40(Entity* org, Entity* tgt, u32 direction) { + if ((gPlayerState.flags & (0x1 | 0x80 | 0x800 | 0x1000)) == 0 && gPlayerState.playerAction == 0) { + if (org->action == 1 || org->action == 24) { + tgt->damage = 4; + org->currentHealth = sub_08017874(org, tgt); + gPlayerState.flags = 0x800; + gPlayerState.playerAction = 13; + } + } + org->knockbackDuration = 12; + org->iframes = 16; + org->field_0x46 = 640; + if (tgt->iframes == 0) + tgt->iframes = -1; + return 1; +} + +NONMATCH("asm/non_matching/collision/sub_08017CBC.inc", s32 sub_08017CBC(Entity* org, Entity* tgt, u32 direction)) { + if (((-(((direction ^ 0x10) - 0xc) & 0x1f) + tgt->direction) & 0x1f) < 0x19) { + org->iframes = -12; + tgt->iframes = -12; + sub_08017940(org, tgt); + } else { + tgt->knockbackDuration = 12; + tgt->iframes = 16; + tgt->field_0x43 = -16; + tgt->field_0x46 = 768; + if (org->iframes == 0) + org->iframes = -1; + } + return 1; +} +END_NONMATCH + +s32 sub_08017D28(Entity* org, Entity* tgt, u32 direction) { + gPlayerState.field_0x1a[0] = 1; + org->field_0x7a.HWORD = 600; + org->knockbackDuration = 12; + org->iframes = 16; + org->field_0x46 = 640; + if (tgt->iframes == 0) + tgt->iframes = -1; + return 1; +} + +s32 sub_08017D6C(Entity* org, Entity* tgt, u32 direction) { + u32 x; + u32 y; + ColSettings* p; + + if (((-(((direction ^ 0x10) - 5) & 0x1f) + (tgt->animationState << 3)) & 0x1f) >= 0xb) { + x = org->hurtType; + y = 0xac2; + } else { + tgt->bitfield = 0xcb; + tgt->field_0x78.HALF.HI = org->hurtType; + x = org->hurtType; + y = 0xae4; + } + p = &gCollisionMtx[x + y]; + return sub_08018308(org, tgt, direction, p); +} + +int sub_08017DD4(Entity* org, Entity* tgt, u32 direction) { + org->bitfield = 0; + if (tgt->damage & 0x80) + tgt->damage &= ~0x80; + else + tgt->damage = 4; + gPlayerEntity.currentHealth = sub_08017874(&gPlayerEntity, tgt); + tgt->iframes = -12; + if ((gPlayerState.flags & 0x80) == 0) { + sub_08079D84(); + org->iframes = 90; + } else { + gPlayerEntity.bitfield = tgt->hurtType | 0x80; + gPlayerEntity.iframes = 12; + gPlayerEntity.knockbackDuration = 16; + gPlayerEntity.knockbackDirection = DirectionTurnAround(direction); + gPlayerEntity.field_0x46 = 640; + } + if (tgt->iframes == 0) + tgt->iframes = -1; + return 1; +} + +s32 sub_08017E88(Entity* org, Entity* tgt, u32 direction) { + org->knockbackDuration = 2; + org->field_0x46 = 640; + if (tgt->iframes == 0) + tgt->iframes = -1; + return 1; +} + +s32 sub_08017EB0(Entity* org, Entity* tgt, u32 direction) { + if (tgt->damage == 0) + return 0; + if (org == &gPlayerEntity) { + u32 temp = tgt->damage; + tgt->damage = 8; + gPlayerEntity.currentHealth = sub_08017874(&gPlayerEntity, tgt); + tgt->damage = temp; + gPlayerEntity.knockbackDuration = 12; + gPlayerEntity.iframes = 16; + gPlayerEntity.field_0x46 = 384; + } else if (org->kind == 8 && org->id == 5) { + org->knockbackDuration = 8; + org->iframes = -6; + org->field_0x46 = 384; + gPlayerEntity.iframes = 0x80; + } + if (tgt->iframes == 0) + tgt->iframes = -1; + return 1; +} + +s32 sub_08017F3C(Entity* org, Entity* tgt, u32 direction) { + return 1; +} + +s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction) { + if (tgt->field_0x43 == 0) { + if (org == &gPlayerEntity) { + if (sub_08079F8C() && (gPlayerState.flags & 0x80) == 0 && !gPlayerState.swimState) { + gPlayerState.field_0x1a[0] |= 0x80u; + gPlayerState.field_0xa |= 0x80u; + gPlayerState.flags |= 0x10u; + gPlayerState.jumpStatus = 0; + if (tgt->kind == ENEMY && (tgt->id == GHINI || tgt->id == ENEMY_50)) { + org->height.HALF.HI = 0; + PositionRelative(org, tgt, 0, 0x10000); + } else { + PositionRelative(tgt, org, 0, 0x10000); + } + COLLISION_OFF(org); + org->spriteRendering.b3 = tgt->spriteRendering.b3; + org->spriteOrientation.flipY = tgt->spriteOrientation.flipY; + org->iframes = -1; + tgt->iframes = -8; + ResetPlayer(); + return 1; + } + } else { + org->currentHealth = 0; + } + } else if (tgt->kind == 3 && org == &gPlayerEntity) { + sub_08004484(tgt, org); + } + return 0; +} + +// inverted branch +NONMATCH("asm/non_matching/collision/sub_0801802C.inc", s32 sub_0801802C(Entity* org, Entity* tgt, u32 direction)) { + int kind; + ColSettings* p; + u32 x; + + kind = org->kind; + if (kind == 1) { + if (sub_08079F8C() && (((direction ^ 0x10) - 4 * tgt->animationState + 5) & 0x1Fu) <= 0xA) + goto _0801807A; + } else if (kind == 8) { + if ((((org->direction ^ 0x10) - 4 * tgt->animationState + 5) & 0x1Fu) <= 0xA) { + org->currentHealth = 0; + _0801807A: + sub_080180BC(org, tgt); + return 1; + } + } else { + org->currentHealth = 0; + return 0; + } + x = 0x11aa; + return sub_08018308(org, tgt, direction, &gCollisionMtx[x + org->hurtType]); +} +END_NONMATCH + +void sub_080180BC(Entity* org, Entity* tgt) { + if (org->iframes == 0) + org->iframes = -30; + if (tgt->iframes == 0) + tgt->iframes = -1; + tgt->subAction = -1; +} + +s32 sub_080180E8(Entity* org, Entity* tgt, u32 direction) { + u32 v3; + u32 x; + + v3 = DirectionNormalize(DirectionTurnAround(direction) - 0xc); + if (DirectionNormalize(tgt->direction - v3) <= 0x18) { + org->knockbackDuration = 12; + org->iframes = -16; + org->field_0x46 = 640; + tgt->knockbackDuration = 12; + tgt->iframes = -16; + tgt->field_0x46 = 768; + sub_08017940(org, tgt); + return 1; + } + x = 0x352; + return sub_08018308(org, tgt, v3, &gCollisionMtx[org->hurtType + x]); +} + +s32 sub_08018168(Entity* org, Entity* tgt, u32 direction) { + if (tgt->field_0x43 == 0) { + if (org == &gPlayerEntity) { + if (((sub_08079F8C() != 0) && ((gPlayerState.flags & 0x40080) == 0)) && (gPlayerState.swimState == 0)) { + gPlayerState.field_0x1a[0] |= 0x80; + gPlayerState.field_0xa |= 0x80; + gPlayerState.flags |= 0x100; + gPlayerState.jumpStatus = 0; + gPlayerEntity.flags &= ~0x80; + gPlayerEntity.spriteRendering.b3 = tgt->spriteRendering.b3; + gPlayerEntity.spriteOrientation.flipY = tgt->spriteOrientation.flipY; + gPlayerEntity.iframes = 0xff; + tgt->iframes = -8; + sub_08077B20(); + return 1; + } + } else { + org->currentHealth = 0; + } + } else if ((tgt->kind == 3) && (org == &gPlayerEntity)) { + sub_08004484(tgt, &gPlayerEntity); + } + return 0; +} + +s32 sub_08018228(Entity* org, Entity* tgt, u32 direction) { + if (org == &gPlayerEntity && sub_08079F8C()) + sub_08004484(tgt, org); + return 0; +} + +s32 sub_08018250(Entity* org, Entity* tgt, u32 direction) { + org->iframes = -1; + if (org->direction == 0) { + tgt->iframes = 16; + sub_08017A90(org, tgt); + } else { + tgt->iframes = -1; + } + return 1; +} + +s32 sub_08018288(Entity* org, Entity* tgt, u32 direction) { + if (org == &gPlayerEntity) + sub_0807AFE8(); + else + org->currentHealth = 0; + return 1; +} + +s32 sub_080182A8(Entity* org, Entity* tgt, u32 direction) { + if (tgt->field_0x43 == 0) { + if (org->iframes == 0) + org->iframes = -1; + if (tgt->iframes == 0) + tgt->iframes = -1; + } else { + u32 x = 0x92a; + return sub_08018308(org, tgt, direction, &gCollisionMtx[org->hurtType + x]); + } + return 1; +} + +s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { + u32 temp = 0; + if (tgt->field_0x43 && tgt->kind == 3 && org == &gPlayerEntity) { + sub_08004484(tgt, org); + temp = 1; + } + if ((org->kind == 8 && org->id == 0x5) && gPlayerEntity.animationState == ((((direction + 4) & 0x18) >> 2) ^ 4)) { + return 0; + } + if (!temp) { + u32 tmp2; + org->field_0x46 = 16 * settings->_0; + org->iframes = settings->_1; + if (org->iframes == 0) + org->iframes = -1; + org->knockbackDuration = settings->_2; + tgt->damage = settings->_3; + tmp2 = 0xFF; + if (settings->_3 != 0) + org->currentHealth = sub_08017874(org, tgt); + if (settings->_4 > org->field_0x43) + org->field_0x43 = settings->_4; + tgt->field_0x46 = 16 * settings->_5; + tgt->iframes = settings->_6; + if (settings->_6 == 0) + tgt->iframes = -1; + tgt->knockbackDuration = settings->_7; + tmp2 &= org->damage = settings->_8; + if (tmp2 != 0) + tgt->currentHealth = sub_08017874(tgt, org); + if (settings->_9 > tgt->field_0x43) + tgt->field_0x43 = settings->_9; + } + if (settings->_a & 1) + sub_08017940(org, tgt); + if (settings->_a & 2) + org->bitfield = 0xca; + if (settings->_a & 4) { + Entity* parent = tgt->parent; + if (parent != NULL) { + parent->bitfield = 0xcc; + parent->iframes = tgt->iframes; + parent->knockbackDirection = direction; + parent->knockbackDuration = tgt->knockbackDuration; + if (parent->field_0x43 == 0) + parent->field_0x43 = tgt->field_0x43; + parent->field_0x46 = tgt->field_0x46; + parent->field_0x4c = org; + } + } + if (org->kind == 8) { + if (org->id == 1) { + if (settings->_8) { + sub_080179EC(org, tgt); + } + } else if (org->id == 4) { + if (org->damage || (settings->_a & 8)) { + sub_08017A90(org, tgt); + } + } else if (org->id == 3) { + if (settings->_9) { + sub_0800449C(tgt, 254); + } + } else if (org->id == 5) { + gPlayerEntity.iframes = 0x80; + } + } + if (tgt->kind == 8 && org->id == 5) { + gPlayerEntity.iframes = 0x80; + } + return 1; +} diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index 4644e620..dc8fdf95 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -160,7 +160,7 @@ void sub_08031B48(Entity* this) { GetNextFrame(this); if (this->frames.b.f0) { this->frames.all = 0; - this->flags |= 0x80; + COLLISION_ON(this); } else { if (this->frames.b.f3) { this->action = 0x3; @@ -188,7 +188,7 @@ void sub_08031B98(Entity* this) { GetNextFrame(this); if (this->actionDelay == 0) { this->action = 4; - this->flags &= 0x7f; + COLLISION_OFF(this); InitializeAnimation(this, 2); } } @@ -255,7 +255,7 @@ void sub_08031C58(Entity* this) { } else { if (this->frames.b.f0) { this->frames.all = 0; - this->flags &= 0x7f; + COLLISION_OFF(this); } } } @@ -264,7 +264,7 @@ void sub_08031D70(Entity* this) { GetNextFrame(this); if (--this->actionDelay == '\0') { this->action = 7; - this->flags &= 0x7f; + COLLISION_OFF(this); this->actionDelay = 5; this->spriteSettings.b.draw = 0; } @@ -289,7 +289,7 @@ void sub_08031DC4(Entity* this) { } else { GetNextFrame(this); if ((this->frames.all & 0xf) == 2) { - this->flags &= 0x7f; + COLLISION_OFF(this); } } } @@ -349,7 +349,7 @@ void sub_08031EE8(Entity* this) { if (this->hVelocity < 1) { this->action = 2; - this->flags |= 0x80; + COLLISION_ON(this); InitializeAnimation(this, 5); } } @@ -494,7 +494,7 @@ void sub_08032248(Entity* this) { GetNextFrame(this); if ((this->frames.all & 0xf) == 2) - this->flags &= 0x7f; + COLLISION_OFF(this); } } } diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index 15535172..4b1d8429 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -34,7 +34,7 @@ void sub_08021780(Entity* this) { this->action = 5; this->actionDelay = 0xb4; this->field_0xf = 0; - this->flags &= ~0x80; + COLLISION_OFF(this); this->spritePriority.b0 = 3; CopyPositionAndSpriteOffset(&gPlayerEntity, this); this->height.HALF.HI = -1; @@ -119,7 +119,7 @@ void sub_080218CC(Entity* this) { this->action = 2; this->actionDelay = (Random() & 0x38) + 8; this->field_0xf = 1; - this->flags |= 0x80; + COLLISION_ON(this); this->speed = 0x180; InitializeAnimation(this, 0); } @@ -128,7 +128,7 @@ void sub_080218CC(Entity* this) { void sub_08021984(Entity* this) { if (this->subAction == 0) { this->subAction = 1; - this->flags |= 0x80; + COLLISION_ON(this); this->spriteSettings.b.draw = 3; this->height.HALF.HI = -0x80; this->spriteRendering.b3 = 1; @@ -270,7 +270,7 @@ void sub_08021C58(Entity* this) { this->action = 2; this->actionDelay = 60; this->field_0xf = 1; - this->flags |= 0x80; + COLLISION_ON(this); this->spritePriority.b0 = 4; ((u8*)&this->field_0x86)[0] = 60; InitializeAnimation(this, 0); diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index 67bb138b..579a5c4c 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -52,7 +52,7 @@ void sub_0802C688(Entity* this) { break; case 2: this->action = 3; - this->damageType = 0x6e; + this->hitType = 0x6e; this->field_0xf = 1; this->hVelocity = 0x18000; this->speed = 0; @@ -112,15 +112,15 @@ void sub_0802C83C(Entity* this) { sub_0802CBC4(this); } else { sub_0802CC18(this); - this->flags &= ~0x80; - this->damageType = 0x6e; + COLLISION_OFF(this); + this->hitType = 0x6e; } } else { this->field_0x82.HALF.LO = 2; this->actionDelay = 120; InitializeAnimation(this, (this->direction >> 4) | 6); - this->flags &= ~0x80; - this->damageType = 0x6e; + COLLISION_OFF(this); + this->hitType = 0x6e; } } @@ -187,7 +187,7 @@ void sub_0802C9B8(Entity* this) { void sub_0802C9D0(Entity* this) { this->subAction = 1; - this->flags &= ~0x80; + COLLISION_OFF(this); this->spritePriority.b1 = 0; this->field_0x82.HALF.HI = 1; sub_0802CC18(this); @@ -222,7 +222,7 @@ void sub_0802CA6C(Entity* this) { void sub_0802CA94(Entity* this) { this->action = 3; - this->flags &= ~0x80; + COLLISION_OFF(this); this->field_0xf = 1; this->spritePriority.b1 = 1; this->hVelocity = 0x18000; @@ -244,8 +244,8 @@ void sub_0802CAF8(Entity* this) { sub_08078930(this); if (this->field_0xf && this->height.HALF.HI == 0) { this->field_0xf = 0; - this->flags = this->flags | 0x80; - this->damageType = 0x6e; + COLLISION_ON(this); + this->hitType = 0x6e; } GetNextFrame(this); } @@ -260,7 +260,7 @@ void sub_0802CB68(Entity* this) { this->subAction = 0; this->direction = Random() & 0x18; this->direction |= 4; - this->flags |= 0x80; + COLLISION_ON(this); if (this->field_0x82.HALF.LO) { this->actionDelay = 200; this->speed = 0x200; @@ -277,7 +277,7 @@ void sub_0802CBC4(Entity* this) { this->action = 4; this->spriteSettings.b.draw = 0; - this->flags &= ~0x80; + COLLISION_OFF(this); this->currentHealth = 0; if (this->field_0x82.HALF.HI) { sub_08079184(); diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index d5220c6d..9b2b5547 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -507,9 +507,9 @@ void sub_0802B048(Entity* this) { if (this->field_0x7a.HALF.HI) { if (gRoomControls.roomOriginY > this->y.HALF.HI || (gRoomControls.roomOriginY + gRoomControls.height + 0x20) < this->y.HALF.HI) { - this->flags &= ~0x80; + COLLISION_OFF(this); } else { - this->flags |= 0x80; + COLLISION_ON(this); } } @@ -540,7 +540,7 @@ void sub_0802B048(Entity* this) { this->hitbox = (Hitbox*)&gUnk_080CD17C; this->actionDelay = 0xf; this->spriteSettings.b.draw = 0; - this->flags |= 0x80; + COLLISION_ON(this); this->field_0x7a.HALF.HI = 0; sub_08078954(this); if (this->parent->next) { diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index 989c6bea..275b1775 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -55,11 +55,11 @@ void sub_0802891C(Entity* this) { void sub_08028934(Entity* this) { Entity* pEVar1; - if (this->damageType == 1 && (this->bitfield & 0x7f) == 0x42) { + if (this->hitType == 1 && (this->bitfield & 0x7f) == 0x42) { this->action = 3; this->subAction = 0; this->actionDelay = 0x28; - this->flags &= ~0x80; + COLLISION_OFF(this); sub_080290E0(this, 4); pEVar1 = CreateFx(this, FX_BUSH, 0); if (pEVar1 != NULL) { @@ -90,7 +90,7 @@ void sub_08028994(Entity* this) { this->actionDelay = 0; this->field_0x76.HWORD = COORD_TO_TILE(this); this->field_0x74.HWORD = sub_080001DA(this->field_0x76.HWORD, this->collisionLayer); - this->field_0x40 = 0x41; + this->hurtType = 0x41; sub_08028FFC(this); } } @@ -417,7 +417,7 @@ bool32 sub_08028FDC(Entity* this) { void sub_08028FFC(Entity* this) { this->action = 1; - this->flags &= ~0x80; + COLLISION_OFF(this); this->spritePriority.b1 = 0; sub_080AE068(this); UnloadOBJPalette(this); @@ -433,7 +433,7 @@ void sub_08028FFC(Entity* this) { void sub_08029078(Entity* this) { this->action = 2; - this->flags = this->flags | 0x80; + COLLISION_ON(this); this->spritePriority.b1 = 1; if (LoadFixedGFX(this, 0x72) == 0) { DeleteEntity(this); diff --git a/src/enemy/chuchu.c b/src/enemy/chuchu.c index 56e23b75..32f1a1b1 100644 --- a/src/enemy/chuchu.c +++ b/src/enemy/chuchu.c @@ -52,11 +52,11 @@ void Chuchu(Entity* this) { if (index != this->field_0x80.HALF.HI) { switch (this->type) { case 0: - if (this->flags & 0x80) { + if (this->flags & ENT_COLLIDE) { this->action = 6; - this->flags &= ~0x80; + COLLISION_OFF(this); this->speed = 0x20; - this->damageType = 0x5c; + this->hitType = 0x5c; InitializeAnimation(this, 5); } break; @@ -100,7 +100,7 @@ void sub_0801EF40(Entity* this) { if (this->type == 2) { if (this->bitfield == 0x8e || this->bitfield == 0x95) { - this->flags &= ~0x80; + COLLISION_OFF(this); this->currentHealth = 0; } } @@ -180,7 +180,7 @@ void sub_0801F0C8(Entity* this) { this->actionDelay = (Random() & 3) + 0xc; this->field_0xf = Random(); this->direction = sub_08049F84(this, 1); - this->flags |= 0x80; + COLLISION_ON(this); this->spritePriority.b0 = 4; this->spritePriority.b1 = 3; InitializeAnimation(this, 2); @@ -213,7 +213,7 @@ void sub_0801F1B0(Entity* this) { if (this->frames.all & 0x10) { if (this->frames.all & 1) { this->frames.all ^= 1; - this->damageType = 90; + this->hitType = 90; EnqueueSFX(299); } sub_080AEFE0(this); @@ -287,7 +287,7 @@ void sub_0801F2F8(Entity* this) { void sub_0801F328(Entity* this) { this->action = 6; - this->flags &= ~0x80; + COLLISION_OFF(this); InitializeAnimation(this, 5); } @@ -295,7 +295,7 @@ void sub_0801F340(Entity* this) { this->action = 5; this->actionDelay = 60; this->speed = 0x20; - this->damageType = 92; + this->hitType = 92; InitializeAnimation(this, 2); } @@ -346,7 +346,7 @@ void sub_0801F428(Entity* this) { this->action = 3; this->field_0xf = 30; - this->flags |= 0x80; + COLLISION_ON(this); this->spritePriority.b1 = 3; this->spriteSettings.b.draw = 1; InitializeAnimation(this, 2); @@ -363,7 +363,7 @@ void sub_0801F494(Entity* this) { this->action = 3; this->field_0xf = 30; this->direction = sub_08049F84(this, 1); - this->flags |= 0x80; + COLLISION_ON(this); this->spritePriority.b0 = 4; this->spritePriority.b1 = 3; InitializeAnimation(this, 2); @@ -404,7 +404,7 @@ void sub_0801F584(Entity* this) { if (this->frames.all & 0x10) { if (this->frames.all & 0x1) { this->frames.all ^= 1; - this->damageType = 91; + this->hitType = 91; EnqueueSFX(299); } sub_080AEFE0(this); @@ -423,7 +423,7 @@ void sub_0801F584(Entity* this) { this->action = 6; this->field_0xf = 60; this->speed = 0x20; - this->damageType = 92; + this->hitType = 92; InitializeAnimation(this, 2); } } @@ -482,7 +482,7 @@ void sub_0801F6F8(Entity* this) { void sub_0801F730(Entity* this) { this->action = 7; - this->flags &= ~0x80; + COLLISION_OFF(this); InitializeAnimation(this, 5); } @@ -537,7 +537,7 @@ void sub_0801F840(Entity* this) { GetNextFrame(this); if (this->frames.all & 0x80) { sub_0801FB14(this); - this->flags |= 0x80; + COLLISION_ON(this); this->spritePriority.b0 = 4; this->spritePriority.b1 = 3; } @@ -552,7 +552,7 @@ void sub_0801F884(Entity* this) { if (ent) { ent->type2 = 64; this->action = 4; - this->damageType = 165; + this->hitType = 165; EnqueueSFX(0x193); } } @@ -656,7 +656,7 @@ void sub_0801FAAC(Entity* this) { void sub_0801FAE0(Entity* this) { this->action = 7; - this->flags &= ~0x80; + COLLISION_OFF(this); InitializeAnimation(this, 5); } @@ -687,13 +687,13 @@ void sub_0801FB68(Entity* this) { break; case 1: this->action = 10; - this->flags |= 0x80; + COLLISION_ON(this); this->spriteSettings.b.draw = 1; this->spritePriority.b1 = 3; break; case 2: this->action = 10; - this->damageType = 92; + this->hitType = 92; sub_0804AA1C(this); break; } diff --git a/src/enemy/darkNut.c b/src/enemy/darkNut.c index d28e3b15..09648a8f 100644 --- a/src/enemy/darkNut.c +++ b/src/enemy/darkNut.c @@ -63,7 +63,7 @@ void sub_08020BB8(Entity* this) { case 0x1c: this->action = 11; this->actionDelay = gUnk_080CAB0C[this->type]; - this->damageType = 81; + this->hitType = 81; sub_08021218(this, 8, DirectionToAnimationState(this->knockbackDirection ^ 0x10)); sub_08021588(this); sub_0804A9FC(this, 0x1c); @@ -71,7 +71,7 @@ void sub_08020BB8(Entity* this) { case 0x16: this->action = 11; this->actionDelay = gUnk_080CAB10[this->type]; - this->damageType = 81; + this->hitType = 81; sub_08021218(this, 8, DirectionToAnimationState(this->knockbackDirection ^ 0x10)); sub_08021588(this); sub_0804A9FC(this, 0x1c); @@ -263,7 +263,7 @@ void sub_08020FE4(Entity* this) { void sub_08021010(Entity* this) { UpdateAnimationSingleFrame(this); if (this->frames.all & 0x80) { - this->damageType = 0x56; + this->hitType = 0x56; sub_080213F0(this); } } @@ -288,7 +288,7 @@ void sub_08021038(Entity* this) { } else { UpdateAnimationSingleFrame(this); if (this->frames.all == 4) - this->damageType = 81; + this->hitType = 81; } } @@ -445,7 +445,7 @@ void sub_08021380(Entity* this) { void sub_08021390(Entity* this) { this->action = 7; this->speed = 0x200; - this->damageType = 0x56; + this->hitType = 0x56; sub_08021218(this, 6, this->animationState); } @@ -568,7 +568,7 @@ void sub_0802159C(Entity* this) { Entity* ent; this->frames.all = 0; - this->damageType = 0x51; + this->hitType = 0x51; ent = CreateProjectileWithParent(this, 0, 3); if (ent) { ent->parent = this; @@ -589,7 +589,7 @@ void sub_08021600(Entity* this) { Entity* ent; this->frames.all = 0; - this->damageType = 0x51; + this->hitType = 0x51; ent = CreateProjectileWithParent(this, 0, 4); if (ent) { ent->parent = this; diff --git a/src/enemy/doorMimic.c b/src/enemy/doorMimic.c index c3fd44ee..301efced 100644 --- a/src/enemy/doorMimic.c +++ b/src/enemy/doorMimic.c @@ -77,7 +77,7 @@ void sub_080220F0(Entity* this) { this->action = 4; this->actionDelay = 0x78; - this->field_0x44 = 0; + this->damage = 0; off = gUnk_080CB76C[this->type2]; for (i = 0; i < 6; i++, off++) { Entity* fx = CreateFx(this, FX_DASH, 0); @@ -88,7 +88,7 @@ void sub_080220F0(Entity* this) { } EnqueueSFX(260); } else if (this->frames.all & 1) { - this->field_0x44 = 4; + this->damage = 4; } } diff --git a/src/enemy/enemy4D.c b/src/enemy/enemy4D.c index 0049a853..f1b16cc7 100644 --- a/src/enemy/enemy4D.c +++ b/src/enemy/enemy4D.c @@ -40,7 +40,7 @@ void sub_0803EB44(Entity* this) { if (pEVar1 != NULL) { pEVar1->parent = this; this->attachedEntity = pEVar1; - this->flags |= 0x80; + COLLISION_ON(this); this->spriteSettings.b.draw = TRUE; this->animationState = 2; *((u8*)&this->field_0x7a + 1) = 0; diff --git a/src/enemy/fallingBoulder.c b/src/enemy/fallingBoulder.c index 29446667..039c817f 100644 --- a/src/enemy/fallingBoulder.c +++ b/src/enemy/fallingBoulder.c @@ -76,7 +76,7 @@ NONMATCH("asm/non_matching/fallingBoulder/sub_0802C334.inc", void sub_0802C334(E this->field_0x7c.HALF.HI = COORD_TO_TILE(this); if (sub_080044EC(this, *(u32*)&this->cutsceneBeh) == 1) { EnqueueSFX(0x14c); - this->flags = this->flags | 0x80; + COLLISION_ON(this); this->field_0x7a.HWORD = 0xc; sub_0802C4B0(this); } else { @@ -86,7 +86,7 @@ NONMATCH("asm/non_matching/fallingBoulder/sub_0802C334.inc", void sub_0802C334(E u16 tmp = --this->field_0x7a.HWORD; switch (tmp) { case 0: - this->flags &= ~0x80; + COLLISION_OFF(this); break; case 8: if (this->type2 != 0 && !sub_08049FA0(this)) { @@ -211,7 +211,7 @@ void sub_0802C62C(Entity* this) { this->y.HALF.HI = this->field_0x82.HWORD; this->x.HALF.HI = this->field_0x80.HWORD; this->spriteSettings.b.draw = 0; - this->flags &= ~0x80; + COLLISION_OFF(this); this->field_0x7c.HALF.LO = 0; } diff --git a/src/enemy/gibdo.c b/src/enemy/gibdo.c index d1773a7d..6fc3a27f 100644 --- a/src/enemy/gibdo.c +++ b/src/enemy/gibdo.c @@ -47,18 +47,18 @@ NONMATCH("asm/non_matching/gibdo/sub_080374A4.inc", void sub_080374A4(Entity* th } this->action = 0x8; this->actionDelay = 0x3c; - this->flags &= 0x7F; + COLLISION_OFF(this); sub_08037B48(this); } else { if (this->action != 0x6) { - if (this->damageType == 0x27) { + if (this->hitType == 0x27) { if (this->bitfield == 0x80) { sub_08037A14(this); } } else { if ((u8)(this->action - 1) < 2) { this->action = 1; - x = DirectionTurnAround(this->knockbackDirection); + x = DirectionTurnAround(DirectionRoundUp(this->knockbackDirection)); this->direction = x; this->animationState = x >> 3; InitAnimationForceUpdate(this, this->animationState); @@ -153,7 +153,7 @@ void sub_08037690(Entity* this) { sub_08037794(this); } else { if ((this->frames.all & 1) != 0) { - this->damageType = 0x27; + this->hitType = 0x27; ProcessMovement(this); } } @@ -202,7 +202,7 @@ void sub_0803775C(Entity* this) { void sub_08037794(Entity* this) { this->action = 1; this->field_0x74.HWORD = 0x1e; - this->damageType = 0x26; + this->hitType = 0x26; InitAnimationForceUpdate(this, this->animationState); } @@ -339,7 +339,7 @@ void sub_08037A58(Entity* this) { if (this->iframes == 0) { this->iframes = 0xec; } - this->damageType = 0x26; + this->hitType = 0x26; this->flags2 |= 1; this->iframes = 0xf4; this->knockbackDirection = DirectionFromAnimationState(this->animationState) ^ 0x10; diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index 7aaa2153..6c0fb567 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -1113,7 +1113,7 @@ void sub_08048004(Entity* this) { if (this->action == 0) return; if (this->animIndex == 0) { - this->flags &= ~0x80; + COLLISION_OFF(this); if (gPlayerEntity.height.HALF.HI != 0) return; if (!sub_08079F8C()) @@ -1151,7 +1151,7 @@ void sub_08048004(Entity* this) { this->field_0x7c.BYTES.byte0 = 0; } } else { - this->flags |= 0x80; + COLLISION_ON(this); } } diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index 41f0ed85..870831bc 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -42,7 +42,7 @@ void sub_0802BBAC(Entity* this) { } void sub_0802BBC4(Entity* this) { - if (this->damageType != 0x19) { + if (this->hitType != 0x19) { switch (this->bitfield & 0x7f) { case 0: case 2: @@ -62,7 +62,7 @@ void sub_0802BBC4(Entity* this) { } void sub_0802BC20(Entity* this) { - if (this->damageType != 0x19) { + if (this->hitType != 0x19) { if (sub_0806F520(this)) { gUnk_080CD42C[this->subAction](this); } @@ -84,13 +84,13 @@ void sub_0802BCA0(Entity* this) { } void sub_0802BCA8(Entity* this) { - if (this->damageType != 0x19) { + if (this->hitType != 0x19) { Entity* ent; this->action = 7; this->actionDelay = 0x5a; this->hVelocity = 0x18000; - this->damageType = 0x19; + this->hitType = 0x19; this->field_0x3a = this->field_0x3a & 0xfb; this->field_0x1c = 0x12; ent = CreateEnemy(HELMASAUR, 1); @@ -112,7 +112,7 @@ void sub_0802BD08(Entity* this) { } void sub_0802BD10(Entity* this) { - this->flags &= ~0x80; + COLLISION_OFF(this); UpdateAnimationVariableFrames(this, 2); } @@ -121,8 +121,8 @@ void nullsub_145(Entity* this) { } void sub_0802BD28(Entity* this) { - if (this->flags & 0x80) { - this->flags |= 0x80; + if (this->flags & ENT_COLLIDE) { + COLLISION_ON(this); this->field_0x3a &= ~0x4; } else { this->currentHealth = 0; @@ -265,7 +265,7 @@ void sub_0802BF98(Entity* this) { } else { this->action = 2; this->actionDelay = 30; - this->flags &= ~0x80; + COLLISION_OFF(this); } } diff --git a/src/enemy/keaton.c b/src/enemy/keaton.c index 1b4f20c0..d1a41424 100644 --- a/src/enemy/keaton.c +++ b/src/enemy/keaton.c @@ -40,7 +40,7 @@ void sub_080323F4(Entity* this) { if (this->action != 3 && this->action != 4) { this->action = 3; this->actionDelay = 0xC; - this->direction = DirectionTurnAround(this->knockbackDirection); + this->direction = DirectionTurnAround(DirectionRoundUp(this->knockbackDirection)); InitAnimationForceUpdate(this, this->direction >> 3); } else if (this->bitfield == 0xCC) { if (this->field_0x43 == 0) { diff --git a/src/enemy/lakitu.c b/src/enemy/lakitu.c index 1353d489..91798d2e 100644 --- a/src/enemy/lakitu.c +++ b/src/enemy/lakitu.c @@ -61,7 +61,7 @@ void sub_0803C784(Entity* this) { sub_0803CBAC(this); } else { - if (this->damageType == 0x43) { + if (this->hitType == 0x43) { Entity* fx = CreateFx(this, FX_DEATH, 0); if (fx != NULL) { @@ -154,7 +154,7 @@ void Lakitu_EndHide(Entity* this) { this->action = IDLE; this->actionDelay = 0x3c; - this->damageType = 0x42; + this->hitType = 0x42; InitAnimationForceUpdate(this, this->animationState + 4); } @@ -168,7 +168,7 @@ void Lakitu_Idle(Entity* this) { if (!sub_0803CA4C(this)) { this->action = BEGIN_HIDE; - this->damageType = 0x43; + this->hitType = 0x43; InitAnimationForceUpdate(this, this->animationState + 0xc); } else { sub_0803CA84(this, 4); @@ -196,7 +196,7 @@ void Lakitu_Lightning(Entity* this) { Lakitu_SpawnLightning(this); this->action = LIGHTNING_DELAY; - this->damageType = 0x42; + this->hitType = 0x42; if ((Random() & 1) && !this->field_0x78.HALF.HI) { this->actionDelay = 0xf; @@ -293,7 +293,7 @@ bool32 sub_0803CB04(Entity* this) { void sub_0803CB34(Entity* this) { this->action = LIGHTNING_THROW; - this->damageType = 0xa6; + this->hitType = 0xa6; this->field_0x78.HALF.LO = GetFacingDirection(this, &gPlayerEntity); @@ -325,7 +325,7 @@ void sub_0803CBAC(Entity* this) { cloud = this->attachedEntity; if (cloud != NULL) { cloud->flags |= 0x80; - cloud->damageType = 0x43; + cloud->hitType = 0x43; } this->action = CLOUDLESS; @@ -335,7 +335,7 @@ void sub_0803CBAC(Entity* this) { this->flags2 &= 0x7b; - this->damageType = 0x42; + this->hitType = 0x42; InitAnimationForceUpdate(this, this->animationState + 16); } diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c index b7301df7..4ace44e2 100644 --- a/src/enemy/lakituCloud.c +++ b/src/enemy/lakituCloud.c @@ -105,7 +105,7 @@ void sub_0803CDD8(Entity* this) { if (this->actionDelay == 0) { this->action = 1; - this->flags |= 0x80; + COLLISION_ON(this); this->spriteSettings.b.draw = one; } @@ -132,7 +132,7 @@ void sub_0803CE3C(Entity* this) { this->action = 2; this->actionDelay = 60; - this->flags &= 0x7f; + COLLISION_OFF(this); this->field_0x3a &= 0xfb; diff --git a/src/enemy/leever.c b/src/enemy/leever.c index d92e1d26..4bdb53c8 100644 --- a/src/enemy/leever.c +++ b/src/enemy/leever.c @@ -92,7 +92,7 @@ void Leever_DigUp(Entity* this) { InitializeAnimation(this, LeeverAnimation_Attack); } else if (this->frames.b.f0 != 0) { this->frames.all &= 0xfe; - this->flags |= 0x80; + COLLISION_ON(this); } } @@ -102,7 +102,7 @@ void Leever_Attack(Entity* this) { if (--this->field_0x74.HWORD == 0) { this->action = 4; - this->flags &= 0x7f; + COLLISION_OFF(this); InitializeAnimation(this, LeeverAnimation_DigDown); } } diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index 70f5ea3f..54d0852f 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -26,10 +26,10 @@ void sub_08027D8C(Entity* this) { } void sub_08027DA4(Entity* this) { - if (this->damageType == 1) { + if (this->hitType == 1) { this->action = 3; - this->flags &= ~0x80; - this->damageType = 0x8c; + COLLISION_OFF(this); + this->hitType = 0x8c; } else { if (this->action == 7) { sub_0802810C(this); @@ -75,7 +75,7 @@ void sub_08027E70(Entity* this) { case 0: this->action = 3; this->spriteSettings.b.draw = 0; - this->flags = this->flags & 0x7f; + COLLISION_OFF(this); this->actionDelay = 0; break; case 1: @@ -88,7 +88,7 @@ void sub_08027E70(Entity* this) { this->action = 1; this->spriteSettings.b.draw = 0; this->actionDelay = 0; - this->damageType = 1; + this->hitType = 1; InitializeAnimation(this, 0); break; } @@ -101,7 +101,7 @@ void sub_08027E70(Entity* this) { } void sub_08027EFC(Entity* this) { - if (this->damageType == 1) + if (this->hitType == 1) return; if (sub_08049FDC(this, 1)) { @@ -120,7 +120,7 @@ void sub_08027EFC(Entity* this) { GetNextFrame(this); } else { this->action = 6; - this->flags &= ~0x80; + COLLISION_OFF(this); InitializeAnimation(this, 2); } } @@ -151,7 +151,7 @@ void sub_08027FE0(Entity* this) { GetNextFrame(this); if (this->frames.all & 1) { this->action = 1; - this->flags |= 0x80; + COLLISION_ON(this); this->direction = sub_08049F84(this, 1); this->actionDelay = 8; this->spritePriority.b1 = 1; diff --git a/src/enemy/madderpillar.c b/src/enemy/madderpillar.c index 513848d9..314b28fc 100644 --- a/src/enemy/madderpillar.c +++ b/src/enemy/madderpillar.c @@ -55,7 +55,7 @@ void sub_080298A4(Entity* this) { default: this->action = 2; this->actionDelay = 0; - this->damageType = 0x6b; + this->hitType = 0x6b; this->field_0x76.HALF.HI = 0; sub_0801D2B4(this, 0x7f); EnqueueSFX(0xfe); @@ -115,7 +115,7 @@ void sub_0802999C(Entity* this) { ent5->attachedEntity = ent6; this->action = 1; - this->flags |= 0x80; + COLLISION_ON(this); this->direction = DirectionRound(Random()); this->speed = 0xa0; this->animationState = 0xff; @@ -138,7 +138,7 @@ void sub_08029AA4(Entity* this) { if (this->field_0x76.HALF.HI != 0) { this->action = 3; this->speed = 0x108; - this->damageType = 0x6a; + this->hitType = 0x6a; this->field_0x7a.HWORD = 0x168; this->field_0x74.HALF.HI = 4; sub_08029EEC(this); @@ -168,7 +168,7 @@ void sub_08029B2C(Entity* this) { DeleteEntity(this); } } else { - this->flags &= ~0x80; + COLLISION_OFF(this); this->actionDelay = -(this->type * 15 - 90); this->field_0x86.HALF.LO = 1; } @@ -210,7 +210,7 @@ void sub_08029BC4(Entity* this) { void sub_08029C08(Entity* this) { this->action = 3; this->actionDelay = gUnk_080CCDA0[this->type]; - this->damageType = 0x6b; + this->hitType = 0x6b; this->attachedEntity->action = 2; } @@ -225,7 +225,7 @@ void sub_08029C2C(Entity* this) { void sub_08029C50(Entity* this) { if (this->parent->field_0x76.HALF.HI != 0) { this->action = 5; - this->damageType = 0x6a; + this->hitType = 0x6a; } } @@ -279,7 +279,7 @@ void sub_08029D14(Entity* this) { if (this->frames.all & 0x80) { this->action = 4; this->actionDelay = 0x78; - this->damageType = 0x6c; + this->hitType = 0x6c; this->hitbox = &gUnk_080FD298; EnqueueSFX(0x6b); } @@ -290,7 +290,7 @@ void sub_08029D78(Entity* this) { sub_0802A0F8(this); if (--this->actionDelay == 0) { this->action = 5; - this->damageType = 0x6a; + this->hitType = 0x6a; this->hitbox = (Hitbox*)&gUnk_080FD2A0; InitializeAnimation(this, this->animationState + 0x10); } diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index 96ded54d..0437d6f2 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -143,7 +143,7 @@ NONMATCH("asm/non_matching/mazaal/sub_0803A188.inc", void sub_0803A188(Entity* t if (this->action != 0x2b) { if ((0 < this->iframes) && ((this->bitfield == 0x95 || (this->bitfield == 0x8e)))) { this->action = 0x28; - this->flags = this->flags & 0x7f; + COLLISION_OFF(this); pEVar3 = this->parent; pEVar3->field_0x7c.BYTES.byte1 = pEVar3->field_0x7c.BYTES.byte1 | (this->type == 0 ? 1 : 2); pEVar3->field_0x80.HALF.LO = (this->type == 0 ? 1 : 2) | pEVar3->field_0x80.HALF.LO; @@ -203,7 +203,7 @@ void sub_0803A274(Entity* this) { } if (gScreenTransition.field_0x38 != 0) { this->action = 3; - this->flags |= 0x80; + COLLISION_ON(this); this->spriteSettings.b.draw = 1; this->attachedEntity->spriteSettings.b.draw = 1; InitializeAnimation(this, 0x10); @@ -312,7 +312,7 @@ void sub_0803A364(Entity* this) { default: this->actionDelay--; if (this->actionDelay == 0) { - this->flags = this->flags | 0x80; + COLLISION_ON(this); sub_0803B4D4(this); } break; @@ -352,7 +352,7 @@ void sub_0803A5D0(Entity* this) { s8* ptr; this->action = 5; - this->flags = this->flags & 0x7f; + COLLISION_OFF(this); ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; @@ -500,7 +500,7 @@ void sub_0803A86C(Entity* this) { this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; GetNextFrame(this); if ((this->frames.all & 0x80) != 0) { - this->flags = this->flags | 0x80; + COLLISION_ON(this); sub_0803B59C(this); } } @@ -558,7 +558,7 @@ void sub_0803A978(Entity* this) { if (this->direction == 0x10) { this->action = 0x12; this->actionDelay = 3; - this->flags = this->flags & 0x7f; + COLLISION_OFF(this); *(u8*)(*(int*)&this->field_0x74 + 0x10) &= 0x7f; InitializeAnimation(this, 8); InitAnimationForceUpdate(this->attachedEntity, 3); @@ -605,7 +605,7 @@ NONMATCH("asm/non_matching/mazaal/sub_0803AA98.inc", void sub_0803AA98(Entity* t InitializeAnimation(this, 10); (*(Entity**)&this->field_0x74)->flags |= 0x80; temp = this->attachedEntity; - temp->damageType = 0x13; + temp->hitType = 0x13; InitAnimationForceUpdate(temp, 5); SoundReq(SFX_16E); } @@ -654,7 +654,7 @@ void sub_0803ABB4(Entity* this) { sub_0803B55C(this); if ((this->attachedEntity->frames.all & 0x80) != 0) { this->action = 0x17; - this->flags = this->flags | 0x80; + COLLISION_ON(this); this->speed = 0x180; InitializeAnimation(this, 0x10); InitAnimationForceUpdate(this->attachedEntity, 0); @@ -807,14 +807,14 @@ void sub_0803AEC4(Entity* this) { UpdateAnimationSingleFrame(this); GetNextFrame(this); if ((this->frames.all & 0x80) != 0) { - this->flags |= 0x80; + COLLISION_ON(this); sub_0803B59C(this); } } void sub_0803AF18(Entity* this) { this->action = 0x1f; - this->flags = this->flags & 0x7f; + COLLISION_OFF(this); InitializeAnimation(this, 5); this->height.HALF.HI = gUnk_080CED6C[(this->parent->field_0xf >> 4) & 7] + 4; } @@ -907,7 +907,7 @@ void sub_0803B0D4(Entity* this) { UpdateAnimationSingleFrame(this); GetNextFrame(this); if ((this->frames.all & 0x80) != 0) { - this->flags |= 0x80; + COLLISION_ON(this); sub_0803B59C(this); } } @@ -943,8 +943,8 @@ void sub_0803B17C(Entity* this) { GetNextFrame(this); if ((this->frames.all & 0x80) != 0) { this->action = 0x2b; - this->flags |= 0x80; - this->damageType = 0x18; + COLLISION_ON(this); + this->hitType = 0x18; this->currentHealth = 0xff; this->field_0x7c.HALF.HI = 600; } @@ -962,7 +962,7 @@ void sub_0803B1B8(Entity* this) { this->action = 0x32; this->field_0x7c.HALF.HI = 0x5dc; this->spriteSettings.b.draw = 0; - this->damageType = 0x14; + this->hitType = 0x14; temp = CreateFx(this, FX_GIANT_EXPLOSION4, 0); if (temp != (Entity*)0x0) { temp->x.HALF.HI += this->hitbox->offset_x; @@ -1068,7 +1068,7 @@ void sub_0803B3F4(Entity* this) { this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; GetNextFrame(this); if ((this->frames.all & 0x80) != 0) { - this->damageType = 0x17; + this->hitType = 0x17; if (this->type == 0) { this->hitbox = (Hitbox*)&gUnk_080FD35C; } else { @@ -1185,7 +1185,7 @@ void sub_0803B6A4(Entity* this) { Entity* temp; this->action = 0x2c; - this->damageType = 0x14; + this->hitType = 0x14; temp = this->parent; temp->field_0x80.HALF.LO |= (this->type == 0) ? 0x10 : 0x20; temp->field_0x80.HALF.LO &= (this->type == 0) ? -5 : -9; @@ -1264,12 +1264,12 @@ u32 sub_0803B870(Entity* this) { gPlayerEntity.flags = gPlayerEntity.flags & 0x7f; gPlayerEntity.iframes = -0x10; sub_0803B824(this); - entity->damageType = 0x13; + entity->hitType = 0x13; InitAnimationForceUpdate(entity, 7); SoundReq(SFX_16E); return 1; } else { - entity->damageType = 0x15; + entity->hitType = 0x15; return 0; } } @@ -1277,9 +1277,9 @@ u32 sub_0803B870(Entity* this) { void sub_0803B8E8(Entity* this, u32 unk) { Entity* entity; entity = this->attachedEntity; - entity->damageType = unk; + entity->hitType = unk; entity = (*(Entity**)&this->field_0x74); - entity->damageType = unk; + entity->hitType = unk; } void sub_0803B8F8(Entity* this) { diff --git a/src/enemy/mazaalHead.c b/src/enemy/mazaalHead.c index a4b000e8..55199ec2 100644 --- a/src/enemy/mazaalHead.c +++ b/src/enemy/mazaalHead.c @@ -144,7 +144,7 @@ void sub_08033F3C(Entity* this) { this->action = 0xd; this->subAction = 0; this->actionDelay = 0xfc; - this->flags = this->flags & 0x7f; + COLLISION_OFF(this); } else { pEVar2 = CreateEnemy(MAZAAL_BRACELET, 0); pEVar2->parent = this; diff --git a/src/enemy/mazaalMacro.c b/src/enemy/mazaalMacro.c index e9cf7191..2edf3d96 100644 --- a/src/enemy/mazaalMacro.c +++ b/src/enemy/mazaalMacro.c @@ -229,7 +229,7 @@ void sub_08034FA0(Entity* this) { void sub_08035050(Entity* this) { Entity* entity; - this->flags = this->flags & 0x7f; + COLLISION_OFF(this); this->currentHealth = 0; entity = CreateEnemy(VAATI_PROJECTILE, 0); if (entity != NULL) { diff --git a/src/enemy/moldorm.c b/src/enemy/moldorm.c index 1ee92567..909f3792 100644 --- a/src/enemy/moldorm.c +++ b/src/enemy/moldorm.c @@ -50,7 +50,7 @@ void sub_08022BEC(Entity* this) { void sub_08022C58(Entity* this) { Entity *tail0, *tail1, *tail2; - this->flags &= ~0x80; + COLLISION_OFF(this); if (gEntCount >= 0x45) return; @@ -77,7 +77,7 @@ void sub_08022C58(Entity* this) { this->action = 1; this->actionDelay = 1; this->field_0xf = 1; - this->flags = this->flags | 0x80; + COLLISION_ON(this); this->parent = this; this->attachedEntity = tail0; *(Entity**)&this->field_0x7c = tail1; diff --git a/src/enemy/moldworm.c b/src/enemy/moldworm.c index 88ad48bf..9b53911f 100644 --- a/src/enemy/moldworm.c +++ b/src/enemy/moldworm.c @@ -67,7 +67,7 @@ void sub_080230E4(Entity* this) { this->action = 7; this->actionDelay = 1; this->subAction = 0; - this->damageType = 0x85; + this->hitType = 0x85; this->iframes = -8; this->field_0x7c.BYTES.byte3 = 0; this->field_0x7a.HALF.HI = 0; @@ -170,7 +170,7 @@ void sub_08023330(Entity* this) { if (this->frames.all & 0x80) { this->action = 4; this->actionDelay = 0x19; - this->flags |= 0x80; + COLLISION_ON(this); this->field_0x78.HWORD = 600; this->direction = Random() & 0x1c; this->animationState = this->direction >> 2; @@ -196,8 +196,8 @@ void sub_08023398(Entity* this) { if (sub_08023A38(GetTileTypeByEntity(this))) { this->action = 5; this->field_0x7c.BYTES.byte3 = 0; - this->flags = this->flags & 0x7f; - this->damageType = 0x85; + COLLISION_OFF(this); + this->hitType = 0x85; this->attachedEntity->actionDelay = 1; sub_08023A68(this); CreateFx(this, FX_ROCK, 0); @@ -299,7 +299,7 @@ void sub_08023604(Entity* this) { if (((u8*)&this->field_0x78)[this->parent->field_0x7c.BYTES.byte0 & 0xf] != 0x88) { this->action = 2; this->actionDelay = 0; - this->flags |= 0x80; + COLLISION_ON(this); this->spriteSettings.b.draw = 1; sub_08023644(this); } @@ -311,7 +311,7 @@ void sub_08023644(Entity* this) { if (parent->animIndex == 0x17 && this->actionDelay != 0 && this->x.HALF.HI == parent->x.HALF.HI && this->y.HALF.HI == parent->y.HALF.HI) { this->action = 1; - this->flags &= ~0x80; + COLLISION_OFF(this); this->spriteSettings.b.draw = 0; this->attachedEntity->actionDelay = 1; sub_080239F0(this); @@ -364,7 +364,7 @@ void sub_0802376C(Entity* this) { if (((u8*)&this->field_0x78)[parent->field_0x7c.BYTES.byte0 & 0xf] != 0x88) { this->action = 2; this->actionDelay = 0; - this->flags |= 0x80; + COLLISION_ON(this); this->parent->field_0x7c.BYTES.byte3 = 1; sub_08023A88(this, 20); sub_080237D8(this); @@ -377,7 +377,7 @@ void sub_080237D8(Entity* this) { if (parent->animIndex == 0x17 && this->actionDelay != 0 && this->x.HALF.HI == parent->x.HALF.HI && this->y.HALF.HI == parent->y.HALF.HI) { this->action = 1; - this->flags &= ~0x80; + COLLISION_OFF(this); this->spriteSettings.b.draw = 0; parent->field_0x7c.BYTES.byte3 = 1; sub_080239F0(this); @@ -499,7 +499,7 @@ void sub_08023AB0(Entity* this) { if (this->field_0x7c.BYTES.byte2) { this->field_0x7c.BYTES.byte2--; } else if (!sub_08023B38(this) || 0x1d >= this->field_0x78.HWORD) { - this->damageType = 0x85; + this->hitType = 0x85; this->field_0x7a.HALF.HI = 0; this->field_0x7c.BYTES.byte2 = 30; InitializeAnimation(this, this->animationState); @@ -507,7 +507,7 @@ void sub_08023AB0(Entity* this) { } else if (this->field_0x7c.BYTES.byte2) { this->field_0x7c.BYTES.byte2--; } else if (this->field_0x78.HWORD >= 90 && sub_08023B38(this)) { - this->damageType = 0x87; + this->hitType = 0x87; this->field_0x7a.HALF.HI = 8; this->field_0x7c.BYTES.byte2 = 10; InitializeAnimation(this, this->animationState + 8); diff --git a/src/enemy/octorok.c b/src/enemy/octorok.c index 525ad1bf..53794388 100644 --- a/src/enemy/octorok.c +++ b/src/enemy/octorok.c @@ -71,7 +71,7 @@ void sub_0801EB7C(Entity* this) { } void sub_0801EB84(Entity* this) { - this->flags &= 0x7f; + COLLISION_OFF(this); UpdateAnimationVariableFrames(this, 2); } @@ -80,8 +80,8 @@ void nullsub_3(Entity* this) { } void sub_0801EB9C(Entity* this) { - if (this->flags & 0x80) { - this->flags |= 0x80; + if (this->flags & ENT_COLLIDE) { + COLLISION_ON(this); this->field_0x3a &= 0xfb; } else { this->currentHealth = 0; diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c index 9a96a72d..6ac631b5 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -101,7 +101,7 @@ void sub_080200B4(Entity* this) { if (this->animationState == PeahatAnimation_Flying) { this->animationState = PeahatAnimation_BrokenPropeller; this->action = 5; - this->damageType = 0x71; + this->hitType = 0x71; this->field_0x80.HALF.HI = 0; InitializeAnimation(this, this->animationState); } @@ -116,15 +116,15 @@ void sub_080200EC(Entity* this) { } void sub_080200F4(Entity* this) { - this->flags &= ~0x80; + COLLISION_OFF(this); } void nullsub_5(Entity* this) { } void sub_08020104(Entity* this) { - if (this->flags & 0x80) { - this->flags |= 0x80; + if (this->flags & ENT_COLLIDE) { + COLLISION_ON(this); this->field_0x3a &= 0xfb; } else { this->currentHealth = 0; @@ -230,7 +230,7 @@ void Peahat_Stunned(Entity* this) { this->action = 6; this->actionDelay = 240; this->field_0xf = 10; - this->damageType = 0x71; + this->hitType = 0x71; } if (this->direction == 0xff) @@ -245,7 +245,7 @@ void Peahat_Stunned(Entity* this) { this->action = 7; this->actionDelay = 150; this->field_0xf = 10; - this->damageType = 0x71; + this->hitType = 0x71; } break; }; @@ -310,7 +310,7 @@ void Peahat_Takeoff(Entity* this) { GetNextFrame(this); if (this->frames.all & 0x80) { this->action = 1; - this->damageType = 0x70; + this->hitType = 0x70; this->field_0x82.HALF.LO = 1; this->field_0x80.HALF.HI = 1; this->animationState = PeahatAnimation_Flying; diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index b8247e34..6ee4a4da 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -49,7 +49,7 @@ void sub_08023F44(Entity* this) { } void sub_08023F5C(Entity* this) { - if (this->damageType != 0x6e) { + if (this->hitType != 0x6e) { if (this->bitfield == 0x80) { this->field_0x86.HALF.LO = 0x30; @@ -83,8 +83,8 @@ void sub_08023FF0(Entity* this) { if (this->subAction < 3 && !sub_0806F520(this)) { this->action = 1; this->subAction = 0; - this->flags |= 0x80; - this->damageType = 0x77; + COLLISION_ON(this); + this->hitType = 0x77; this->actionDelay = 1; this->speed = 0x40; } else { @@ -108,9 +108,9 @@ void sub_08024058(Entity* this) { } void sub_08024060(Entity* this) { - if (this->damageType != 0x6e) { - this->flags = this->flags & 0x7f; - this->damageType = 0x6e; + if (this->hitType != 0x6e) { + COLLISION_OFF(this); + this->hitType = 0x6e; this->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; } diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c index 4225a61f..4688d174 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -66,7 +66,7 @@ void sub_08025020(Entity* this) { this->field_0x82.HALF.LO -= gUnk_080CBFE8[(*(Entity**)&this->field_0x4c)->type]; } else { this->cutsceneBeh.HWORD = 0x294; - this->damageType = 0x83; + this->hitType = 0x83; this->field_0x82.HALF.LO = 0; sub_0801D2B4(this, 0x7c); } @@ -85,7 +85,7 @@ void sub_08025020(Entity* this) { } break; default: - if (this->damageType == 0x82 && this->iframes < 0) { + if (this->hitType == 0x82 && this->iframes < 0) { Entity* ent = CreateObject(OBJECT_21, 2, 0); if (ent != NULL) { ent->spritePriority.b0 = 3; @@ -131,7 +131,7 @@ void sub_080251AC(Entity* this) { } } else { this->cutsceneBeh.HWORD = 0x294; - this->damageType = 0x83; + this->hitType = 0x83; this->field_0x82.HALF.LO = 0; sub_0801D2B4(this, 0x7c); } @@ -275,7 +275,7 @@ void sub_080254B4(Entity* this) { if (this->frames.all & 0x80) { if (this->height.HALF.HI == 0) { if (this->cutsceneBeh.HWORD == 0) { - this->damageType = 0x82; + this->hitType = 0x82; this->field_0x82.HALF.LO = -0x10; sub_080256B4(this); } else { @@ -361,7 +361,7 @@ void sub_0802563C(Entity* this) { if (--this->cutsceneBeh.HWORD == 0) { sub_0801D2B4(this, 0x28); - this->damageType = 0x82; + this->hitType = 0x82; this->field_0x82.HALF.LO = 240; sub_080256B4(this); sub_0804AA1C(this); diff --git a/src/enemy/rockChuchu.c b/src/enemy/rockChuchu.c index e4f2bf30..3248714f 100644 --- a/src/enemy/rockChuchu.c +++ b/src/enemy/rockChuchu.c @@ -50,14 +50,14 @@ void sub_08022254(Entity* this) { #endif sub_0804A4E4(this, ent); this->action = 2; - this->flags &= ~0x80; + COLLISION_OFF(this); this->spriteSettings.b.draw = 0; this->direction = this->knockbackDirection; this->attachedEntity = ent; } } } else { - if (this->damageType != 0x94) + if (this->hitType != 0x94) InitializeAnimation(this, 2); } diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c index cafa618d..3316e6e5 100644 --- a/src/enemy/rollobite.c +++ b/src/enemy/rollobite.c @@ -30,12 +30,12 @@ void Rollobite_OnTick(Entity* this) { } void sub_08020668(Entity* this) { - if (this->damageType == 34 && this->currentHealth != 0xff) { + if (this->hitType == 34 && this->currentHealth != 0xff) { this->action = 4; this->hVelocity = 0x20000; this->direction = 0xff; this->currentHealth = 0xff; - this->damageType = 35; + this->hitType = 35; InitializeAnimation(this, this->animationState + 8); } @@ -67,7 +67,7 @@ void sub_080206E0(Entity* this) { void sub_08020734(Entity* this) { if (this->subAction < 3 && !sub_0806F520(this)) { this->action = 4; - this->flags |= 0x80; + COLLISION_ON(this); this->direction = 0xff; InitializeAnimation(this, this->animationState + 0x10); } else { @@ -89,7 +89,7 @@ void sub_08020790(Entity* this) { } void sub_08020798(Entity* this) { - this->flags &= ~0x80; + COLLISION_OFF(this); } void nullsub_6(Entity* this) { @@ -98,7 +98,7 @@ void nullsub_6(Entity* this) { void sub_080207A8(Entity* this) { this->action = 4; - this->flags |= 0x80; + COLLISION_ON(this); this->spritePriority.b0 = 4; this->field_0x3a &= 0xfb; this->direction ^= 0x10; @@ -139,7 +139,7 @@ void sub_08020874(Entity* this) { void sub_0802088C(Entity* this) { this->subAction = 1; - this->flags &= ~0x80; + COLLISION_OFF(this); this->cutsceneBeh.HALF.HI = gPlayerEntity.animationState; this->spritePriority.b1 = 0; } @@ -159,7 +159,7 @@ void sub_080208F0(Entity* this) { void sub_08020904(Entity* this) { this->action = 4; - this->flags |= 0x80; + COLLISION_ON(this); this->direction = -1; InitializeAnimation(this, this->animationState + 0x10); } @@ -195,9 +195,9 @@ void Rollobite_RolledUp(Entity* this) { void Rollobite_Unroll(Entity* this) { GetNextFrame(this); if (this->frames.all & 0x80) { - this->flags |= 0x80; + COLLISION_ON(this); this->speed = 0x100; - this->damageType = 34; + this->hitType = 34; sub_08020A30(this); this->direction = DirectionFromAnimationState(this->animationState); InitializeAnimation(this, this->animationState); @@ -257,7 +257,7 @@ bool32 Rollobite_TryToHoleUp(Entity* this) { int iVar1 = GetTileType(tile, this->collisionLayer); if ((iVar1 * 0x10000 - 0x710000U) >> 0x10 < 2) { this->action = 6; - this->flags &= ~0x80; + COLLISION_OFF(this); this->x.HALF.HI &= 0xfff0; this->x.HALF.HI += 8; this->y.HALF.HI &= 0xfff0; diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index fd72c272..04c87bba 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -47,7 +47,7 @@ void sub_08029300(Entity* this) { } void sub_08029318(Entity* this) { - if (this->damageType == 0x8e) { + if (this->hitType == 0x8e) { sub_08029770(this); } else { if (this->action == 4) { @@ -126,7 +126,7 @@ void sub_08029474(Entity* this) { } else { if (this->frames.all == 1) { this->frames.all = 0; - this->flags |= 0x80; + COLLISION_ON(this); } } } @@ -142,7 +142,7 @@ void sub_080294D4(Entity* this) { sub_080296C8(this); } else { this->action = 6; - this->flags &= 0x7f; + COLLISION_OFF(this); InitializeAnimation(this, 3); InitializeAnimation(this->attachedEntity, 7); } @@ -252,12 +252,12 @@ void sub_08029770(Entity* this) { u32 temp; if (LoadFixedGFX(this, 0x73) != 0) { this->action = 2; - this->flags = this->flags & 0x7f; + COLLISION_OFF(this); this->spriteIndex = 0xd1; this->spritePriority.b1 = 3; temp = this->field_0x82.HALF.LO; this->palette.b.b0 = temp; - this->damageType = 0x8d; + this->hitType = 0x8d; this->hitbox = &gUnk_080FD260; InitializeAnimation(this, 2); this->attachedEntity->spriteSettings.b.draw = TRUE; @@ -270,9 +270,9 @@ void sub_080297F0(Entity* this) { u32 temp; this->action = 1; this->actionDelay = 0x78; - this->flags = this->flags | 0x80; + COLLISION_ON(this); this->spriteSettings.b.draw = TRUE; - this->damageType = 0x8e; + this->hitType = 0x8e; sub_080AE068(this); #ifdef EU this->spriteIndex = 0x142; diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c index 1d09e3c1..660a3110 100644 --- a/src/enemy/smallPesto.c +++ b/src/enemy/smallPesto.c @@ -36,7 +36,7 @@ void sub_0803169C(Entity* this) { if (iVar1 == 0) { this->action = 1; this->subAction = 0; - this->flags = this->flags | 0x80; + COLLISION_ON(this); this->speed = 0x40; this->field_0xf = 1; } else { diff --git a/src/enemy/spark.c b/src/enemy/spark.c index 71e913c5..811bea88 100644 --- a/src/enemy/spark.c +++ b/src/enemy/spark.c @@ -20,7 +20,7 @@ void sub_0802B2E0(Entity* this) { if (this->bitfield & 0x80) { if ((this->bitfield & 0x7f) == 0x14) { - this->flags &= ~0x80; + COLLISION_OFF(this); this->iframes = 0; this->spriteSettings.b.draw = 0; this->action = 2; diff --git a/src/enemy/spikedBeetle.c b/src/enemy/spikedBeetle.c index 4884f873..9f3aa75f 100644 --- a/src/enemy/spikedBeetle.c +++ b/src/enemy/spikedBeetle.c @@ -54,7 +54,7 @@ void sub_0802B628(Entity* this) { this->direction = this->knockbackDirection; this->knockbackDuration = 0; this->iframes = -8; - this->damageType = 100; + this->hitType = 100; InitializeAnimation(this, 9); } } @@ -168,7 +168,7 @@ void sub_0802B8E0(Entity* this) { this->action = 8; this->hVelocity = 0x10000; this->speed = 0x60; - this->damageType = 99; + this->hitType = 99; InitializeAnimation(this, this->animationState); EnqueueSFX(299); } diff --git a/src/enemy/spinyChuchu.c b/src/enemy/spinyChuchu.c index 5f928636..56872a16 100644 --- a/src/enemy/spinyChuchu.c +++ b/src/enemy/spinyChuchu.c @@ -33,13 +33,13 @@ void sub_08022434(Entity* this) { void sub_0802244C(Entity* this) { if (this->currentHealth) { - if (this->damageType == 0x65) { + if (this->hitType == 0x65) { switch (this->bitfield & 0x7f) { case 2: case 3: this->action = 2; this->field_0xf = 0x3c; - this->damageType = 0x5c; + this->hitType = 0x5c; this->hitbox = &gUnk_080FD468; InitializeAnimation(this, 0); break; @@ -54,7 +54,7 @@ void sub_0802244C(Entity* this) { case 0x1a: sub_0804A9FC(this, 0x1c); this->action = 5; - this->damageType = 0x5c; + this->hitType = 0x5c; InitializeAnimation(this, 1); } } else if (this->bitfield == 0x94) { @@ -65,7 +65,7 @@ void sub_0802244C(Entity* this) { if (this->field_0x80.HALF.LO != this->currentHealth) { this->action = 5; - this->damageType = 0x5c; + this->hitType = 0x5c; InitializeAnimation(this, 1); } else { if (this->action == 3) { @@ -141,7 +141,7 @@ void sub_08022654(Entity* this) { GetNextFrame(this); if (--this->actionDelay == 0) { this->action = 3; - this->damageType = 0x65; + this->hitType = 0x65; InitializeAnimation(this, 2); } break; @@ -152,7 +152,7 @@ void sub_080226EC(Entity* this) { if (sub_08049FDC(this, 1)) { if (sub_080228CC(this)) { this->action = 3; - this->damageType = 0x65; + this->hitType = 0x65; InitializeAnimation(this, 2); return; } @@ -162,7 +162,7 @@ void sub_080226EC(Entity* this) { this->hVelocity = 0x12000; this->speed = 0x140; this->direction = GetFacingDirection(this, gUnk_020000B0); - this->damageType = 0x5a; + this->hitType = 0x5a; InitializeAnimation(this, 4); return; } @@ -196,7 +196,7 @@ void sub_080227AC(Entity* this) { if (this->frames.all & 2) { this->frames.all &= ~2; - this->damageType = 0x5c; + this->hitType = 0x5c; } if (this->frames.all & 0x80) { @@ -223,7 +223,7 @@ void sub_08022854(Entity* this) { sub_080AEFE0(this); if (sub_08003FC4(this, 0x1800) == 0) { this->action = 7; - this->damageType = 0x5c; + this->hitType = 0x5c; InitializeAnimation(this, 5); EnqueueSFX(0x7d); } diff --git a/src/enemy/vaatiArm.c b/src/enemy/vaatiArm.c index bd5d18f8..d001699a 100644 --- a/src/enemy/vaatiArm.c +++ b/src/enemy/vaatiArm.c @@ -355,7 +355,7 @@ void sub_080428FC(Entity* this) { SoundReq(SFX_153); uVar2 = 0; do { - ((VaatiArm_HeapStruct*)this->myHeap)->entities[uVar2]->damageType = 0x3b; + ((VaatiArm_HeapStruct*)this->myHeap)->entities[uVar2]->hitType = 0x3b; uVar2 = uVar2 + 1; } while (uVar2 < 5); } @@ -387,7 +387,7 @@ void sub_08042970(Entity* this) { this->actionDelay = 0x3c; uVar2 = 0; do { - ((VaatiArm_HeapStruct*)this->myHeap)->entities[uVar2]->damageType = 0x39; + ((VaatiArm_HeapStruct*)this->myHeap)->entities[uVar2]->hitType = 0x39; uVar2 = uVar2 + 1; } while (uVar2 < 5); } @@ -460,9 +460,9 @@ void sub_08042AEC(Entity* this) { if (--this->actionDelay == 0) { this->subAction = 3; this->actionDelay = 4; - this->damageType = 0x3d; + this->hitType = 0x3d; InitAnimationForceUpdate(this, 0xe); - ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->damageType = 0x3d; + ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->hitType = 0x3d; } } @@ -508,8 +508,8 @@ void sub_08042B20(Entity* this) { this->action = 5; this->subAction = 0; this->actionDelay = 0x1e; - this->damageType = 0x39; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->damageType = 0x39; + this->hitType = 0x39; + ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->hitType = 0x39; } } } @@ -565,7 +565,7 @@ void sub_08042C34(Entity* this) { entity->x.HALF.HI = x; entity->y.HALF.HI = y; entity->height.HALF.HI = 0x32; - entity->damageType = 0x39; + entity->hitType = 0x39; ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[i]; ptr->unk00.HWORD = 0x80; ptr->unk04.HWORD = 0; @@ -582,8 +582,8 @@ void sub_08042D24(Entity* this) { if (--this->actionDelay == 0) { this->subAction = 2; - this->damageType = 0x3d; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->damageType = 0x3d; + this->hitType = 0x3d; + ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->hitType = 0x3d; entity = CreateObject(OBJECT_AF, 1, 0); if (entity != NULL) { entity->parent = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; @@ -618,10 +618,10 @@ void sub_08042D6C(Entity* this) { ((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk0a = 0xc0; this->subAction = 3; this->actionDelay = 0x1e; - this->damageType = 0x39; + this->hitType = 0x39; this->field_0x7c.BYTES.byte3 = 0x2d; InitAnimationForceUpdate(this, 0); - ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->damageType = 0x39; + ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->hitType = 0x39; } else { entity->height.HALF.HI -= 2; } @@ -742,7 +742,7 @@ void sub_08043048(Entity* this) { ptr[0].unk04.HWORD += 0x200; if (0x4f < ptr[0].unk04.HALF.HI) { for (i = 0; i < 5; i++) { - ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]->damageType = 0x3b; + ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]->hitType = 0x3b; } SoundReq(SFX_153); } @@ -751,7 +751,7 @@ void sub_08043048(Entity* this) { if (--this->actionDelay == 0) { this->subAction = 7; for (i = 0; i < 5; i++) { - ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]->damageType = 0x39; + ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]->hitType = 0x39; } } } @@ -962,7 +962,7 @@ NONMATCH("asm/non_matching/vaati/sub_08043490.inc", void sub_08043490(Entity* th entity->flags = entity->flags | 0x80; entity->spriteSettings.b.draw = 1; entity->field_0x3c = entity->field_0x3c & 0xef; - entity->damageType = 0x3a; + entity->hitType = 0x3a; entity->hitbox = (Hitbox*)&gUnk_080FD450; entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[2]; entity->flags = entity->flags | 0x80; @@ -1011,7 +1011,7 @@ void sub_08043580(Entity* this) { this->actionDelay = 0x3c; entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; entity->field_0x3c = entity->field_0x3c | 0x10; - entity->damageType = 0x39; + entity->hitType = 0x39; entity->hitbox = (Hitbox*)&gUnk_080FD538; sub_0804AA1C(this); } @@ -1341,7 +1341,7 @@ void sub_08043D08(Entity* this) { CopyPosition(((VaatiArm_HeapStruct*)this->myHeap)->entities[3], entity); entity->height.HALF.HI += ((VaatiArm_HeapStruct*)this->myHeap)->s1[3].unk0c; for (i = 0; i < 5; i++) { - ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]->damageType = 0x39; + ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]->hitType = 0x39; } EnqueueSFX(SFX_HIT); } @@ -1364,7 +1364,7 @@ void sub_08043DB0(Entity* this) { gScreenTransition.field_0x3d = 0x1e - (cVar1 / 0x3c); gScreenTransition.field_0x3c = this->type2; pEVar2 = ((VaatiArm_HeapStruct*)this->myHeap)->parent; - gScreenTransition.field_0x40 = pEVar2->x.HALF.HI; + gScreenTransition.hurtType = pEVar2->x.HALF.HI; gScreenTransition.field_0x42 = pEVar2->y.HALF.HI; pEVar4 = ((VaatiArm_HeapStruct*)pEVar2->myHeap)->parent; if (pEVar4 != NULL) { @@ -1391,7 +1391,7 @@ void sub_08043EB8(Entity* this) { Entity* pEVar4; VaatiArm_HeapStruct1* ptr; - this->flags = this->flags | 0x80; + COLLISION_ON(this); this->spritePriority.b0 = 4; InitAnimationForceUpdate(this, 0xd); pEVar4 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]; @@ -1412,7 +1412,7 @@ void sub_08043EB8(Entity* this) { pEVar4->y.HALF.HI = (this->type2 == 0) ? gScreenTransition.field_0x46 : gScreenTransition.field_0x4a; pEVar4->height.HALF.HI = 0; pEVar4->field_0x3c = pEVar4->field_0x3c & 0xef; - pEVar4->damageType = 0x3a; + pEVar4->hitType = 0x3a; pEVar4->hitbox = (Hitbox*)&gUnk_080FD450; pEVar4 = CreateObject(OBJECT_AF, 0, 0); if (pEVar4 != NULL) { diff --git a/src/enemy/vaatiBall.c b/src/enemy/vaatiBall.c index 00c3f24c..dca843d9 100644 --- a/src/enemy/vaatiBall.c +++ b/src/enemy/vaatiBall.c @@ -40,7 +40,7 @@ void VaatiBall(Entity* this) { if (this->currentHealth < 0xfd) { #endif this->spriteSettings.b.draw = 0; - this->flags &= 0x7f; + COLLISION_OFF(this); this->currentHealth = -1; parent->field_0x80.HALF.LO--; CreateDust(this); @@ -99,7 +99,7 @@ void sub_0804474C(Entity* this) { case 2: this->action = 2; this->field_0x74.HALF.LO = 0; - this->damageType = 0; + this->hitType = 0; break; } @@ -121,14 +121,14 @@ void sub_080447E0(Entity* this) { if (vaati->action == 1) { this->action = 1; - this->damageType = 43; + this->hitType = 43; sub_08044E74(this, 0); - if (this->flags & 0x80) + if (this->flags & ENT_COLLIDE) this->spriteSettings.b.draw = 1; } else { this->field_0x76.HALF.HI++; this->field_0x76.HALF.HI &= 7; - if (this->flags & 0x80) { + if (this->flags & ENT_COLLIDE) { if (this->field_0x76.HALF.HI & 1) { this->spriteSettings.b.draw = 1; } else { @@ -190,7 +190,7 @@ void sub_08044868(Entity* this) { vaati->type2 = 1; vaati->parent = this; this->cutsceneBeh.HALF.LO = 1; - this->damageType = 0; + this->hitType = 0; } } } @@ -207,9 +207,9 @@ void sub_08044868(Entity* this) { sub_08044E74(this, 1); draw = this->spriteSettings.b.draw; if (draw == 1) { - this->flags |= 0x80; + COLLISION_ON(this); } else { - this->flags &= 0x7f; + COLLISION_OFF(this); } break; } @@ -390,7 +390,7 @@ void sub_08044B04(Entity* this) { case 3: this->field_0x74.HALF.LO = 1; this->actionDelay = 80; - this->flags &= 0x7f; + COLLISION_OFF(this); PositionRelative(vaati, this, 0, -0x100000); if (this->field_0xf) this->spriteSettings.b.draw = 0; @@ -429,9 +429,9 @@ void sub_08044B04(Entity* this) { sub_08044E74(this, 1); draw = this->spriteSettings.b.draw; if (draw == 1) { - this->flags |= 0x80; + COLLISION_ON(this); } else { - this->flags &= 0x7f; + COLLISION_OFF(this); } vaati->actionDelay++; break; @@ -452,7 +452,7 @@ void sub_08044DEC(Entity* this) { } else { this->spriteSettings.b.draw = 0; } - this->flags &= 0x7f; + COLLISION_OFF(this); this->field_0x78.HALF.LO = 0; this->speed = 0x300; off = this->parent->field_0x80.HALF.LO - 1; diff --git a/src/enemy/vaatiEyesMacro.c b/src/enemy/vaatiEyesMacro.c index f2d3041d..86b5a739 100644 --- a/src/enemy/vaatiEyesMacro.c +++ b/src/enemy/vaatiEyesMacro.c @@ -146,7 +146,7 @@ void VaatiEyesMacroFunction0Type1Action0(Entity* this) { void VaatiEyesMacroFunction0Type1Action1(Entity* this) { if (this->parent->next == NULL) { - this->flags &= 0x7f; + COLLISION_OFF(this); this->currentHealth = 0; } else { sub_0802F04C(this); diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c index a74de388..f86fb5ab 100644 --- a/src/enemy/vaatiProjectile.c +++ b/src/enemy/vaatiProjectile.c @@ -42,7 +42,7 @@ void (*const vaatiProjectileFunction0Actions[])(Entity*) = { void VaatiProjectile(Entity* this) { if (sub_0803E4A0(this)) { - this->flags &= 0x7f; + COLLISION_OFF(this); this->currentHealth = 0; this->parent = NULL; } @@ -61,7 +61,7 @@ void VaatiProjectileFunction1(Entity* this) { if (this->currentHealth != 0) { #endif this->action = 5; - this->flags = this->flags & 0x7f; + COLLISION_OFF(this); this->spritePriority.b1 = 0; gPlayerEntity.flags &= 0x7f; gPlayerEntity.spriteOrientation.flipY = this->spriteOrientation.flipY; @@ -114,7 +114,7 @@ void VaatiProjectileFunction0Action0(Entity* this) { } } else { this->action = 8; - this->flags = this->flags & 0x7f; + COLLISION_OFF(this); this->spriteOffsetY = 1; this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY; this->spriteRendering.b3 = this->parent->spriteRendering.b3; diff --git a/src/enemy/vaatiRebornEnemy.c b/src/enemy/vaatiRebornEnemy.c index f96527e9..85c39122 100644 --- a/src/enemy/vaatiRebornEnemy.c +++ b/src/enemy/vaatiRebornEnemy.c @@ -514,13 +514,13 @@ void VaatiRebornEnemyType1Action1(Entity* this) { if (this->field_0x74.HALF.LO == 0) { if (parent->field_0x80.HALF.LO == 0) { this->field_0x74.HALF.LO = 1; - this->damageType = 0x30; + this->hitType = 0x30; InitAnimationForceUpdate(this, this->field_0x74.HALF.LO); } } else { if (parent->field_0x80.HALF.LO != 0) { this->field_0x74.HALF.LO = 0; - this->damageType = 0x2f; + this->hitType = 0x2f; InitAnimationForceUpdate(this, this->field_0x74.HALF.LO); } else { if (((this->bitfield & 0x80) != 0) && (0 < this->iframes)) { @@ -536,12 +536,12 @@ void VaatiRebornEnemyType1Action1(Entity* this) { if (this->field_0x74.HALF.HI == 0) { if (parent->action != 2) { this->field_0x74.HALF.HI = 1; - this->flags |= 0x80; + COLLISION_ON(this); } } else { if (parent->action == 2) { this->field_0x74.HALF.HI = 0; - this->flags &= 0x7f; + COLLISION_OFF(this); } } this->spriteSettings.b.draw = parent->spriteSettings.b.draw; @@ -644,7 +644,7 @@ void sub_0803DC0C(Entity* this) { void VaatiRebornEnemyType1PreAction(Entity* this) { Entity* parent; - if (this->damageType != 0x30) { + if (this->hitType != 0x30) { return; } parent = this->parent; @@ -652,7 +652,7 @@ void VaatiRebornEnemyType1PreAction(Entity* this) { if ((this->bitfield & 0x80) != 0) { if (gUnk_080D04D0[parent->field_0x86.HALF.LO] > this->currentHealth) { if (2 < ++parent->field_0x86.HALF.LO) { - this->flags &= 0x7f; + COLLISION_OFF(this); parent->action = 7; parent->flags &= 0x7f; parent->actionDelay = 0x80; @@ -675,7 +675,7 @@ void VaatiRebornEnemyType1PreAction(Entity* this) { } if (this->actionDelay != 0) { if (--this->actionDelay == 0) { - this->damageType = 0x2f; + this->hitType = 0x2f; this->field_0x74.HALF.LO = 1; if (this->field_0x76.HALF.HI == 0) { parent->field_0x74.HALF.LO = 0xf0; diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index 757d6544..0933b1eb 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -269,14 +269,14 @@ void VaatiTransfiguredType0Action3(Entity* this) { break; this->field_0x80.HALF.LO = 1; this->actionDelay = 0xc0; - this->flags |= 0x80; + COLLISION_ON(this); SoundReq(SFX_14C); sub_08080964(0x14, 4); break; case 1: if (--this->actionDelay == 0) { this->field_0x80.HALF.LO = 2; - this->damageType = 0x35; + this->hitType = 0x35; this->spriteOffsetX = 0; } if (this->currentHealth < gUnk_080D0ABC[this->animationState]) { @@ -287,7 +287,7 @@ void VaatiTransfiguredType0Action3(Entity* this) { } if (tmp) { this->field_0x80.HALF.LO = 2; - this->damageType = 0x35; + this->hitType = 0x35; this->spriteOffsetX = 0; this->animationState++; if (this->animationState > 2) { @@ -312,7 +312,7 @@ void VaatiTransfiguredType0Action3(Entity* this) { case 3: if (this->actionDelay != 0) { if (--this->actionDelay == 0) { - this->flags &= 0x7f; + COLLISION_OFF(this); this->hVelocity = 0x38000; this->field_0xf = 0x10; } @@ -321,7 +321,7 @@ void VaatiTransfiguredType0Action3(Entity* this) { if (sub_08003FC4(this, 0x2800) == 0) { this->field_0x80.HALF.LO = 5; this->actionDelay = 0x10; - this->flags |= 0x80; + COLLISION_ON(this); this->currentHealth = 0xff; this->field_0x86.HALF.LO = 0; sub_080408EC(this); @@ -1059,8 +1059,8 @@ void sub_080409B0(Entity* this) { this->action = 3; this->field_0x80.HALF.LO = 0; this->field_0x80.HALF.HI = 3; - this->flags &= 0x7f; - this->damageType = 0x36; + COLLISION_OFF(this); + this->hitType = 0x36; this->hVelocity = 0x18000; SoundReq(SFX_164); } diff --git a/src/enemy/vaatiTransfiguredEye.c b/src/enemy/vaatiTransfiguredEye.c index a4cf8999..a6777666 100644 --- a/src/enemy/vaatiTransfiguredEye.c +++ b/src/enemy/vaatiTransfiguredEye.c @@ -125,7 +125,7 @@ void VaatiTransfiguredEyeFunction0Action1(Entity* this) { if (this->field_0x82.HALF.LO == 0) { if ((this->frames.all & 0x80) != 0) { if (this->type != 0) { - this->flags |= 0x80; + COLLISION_ON(this); } this->action = 2; InitializeAnimation(this, this->type << 3); @@ -149,7 +149,7 @@ void VaatiTransfiguredEyeFunction0Action2(Entity* this) { this->action = 4; this->field_0xf = 0; if (this->type != 0) { - this->flags &= 0x7f; + COLLISION_OFF(this); if (this->actionDelay != 0) { InitializeAnimation(this, this->type << 3 | 5); InitializeAnimation(this->parent, this->parent->type << 3 | 5); @@ -167,10 +167,10 @@ void VaatiTransfiguredEyeFunction0Action3(Entity* this) { this->action = 2; if (this->type != 0) { if (this->actionDelay == 0) { - this->damageType = 0x32; + this->hitType = 0x32; } else { this->parent->parent->field_0x76.HALF.LO |= (1 << this->type2); - this->damageType = 0x31; + this->hitType = 0x31; } } } @@ -195,7 +195,7 @@ void VaatiTransfiguredEyeFunction0Action4(Entity* this) { this->field_0x80.HALF.HI = 0; this->cutsceneBeh.HALF.HI = 0; if (this->type != 0) { - this->damageType = 0x33; + this->hitType = 0x33; } if ((parent->field_0x74.HALF.HI >> this->type2 & 1U) != 0) { this->actionDelay = 1; diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index 08b5cb85..23063fc3 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -104,7 +104,7 @@ const s8 gUnk_080D0EB0[] = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x0 void VaatiWrath(Entity* this) { if (((this->type == 0) && ((this->bitfield & 0x80) != 0)) && (this->currentHealth == 0)) { - this->flags |= 0x80; + COLLISION_ON(this); this->currentHealth = 0xff; if (--this->cutsceneBeh.HALF.LO == 0) { this->action = 0xd; @@ -138,7 +138,7 @@ void VaatiWrathType0Action0(Entity* this) { this->action = 2; this->actionDelay = 0x3c; } - this->x.HALF.HI = gScreenTransition.field_0x40; + this->x.HALF.HI = gScreenTransition.hurtType; this->y.HALF.HI = gScreenTransition.field_0x42; sub_08042004(this); } else { @@ -480,7 +480,7 @@ void VaatiWrathType0ActionB(Entity* this) { this->subAction = 1; this->actionDelay = 0xf0; this->currentHealth = 8; - this->damageType = 0x38; + this->hitType = 0x38; sub_08080964(0x14, 0); InitAnimationForceUpdate(this, 6); InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type2, 0x16); @@ -492,7 +492,7 @@ void VaatiWrathType0ActionB(Entity* this) { if (--this->actionDelay == 0) { this->subAction = 2; this->actionDelay = 0x3c; - this->damageType = 0x39; + this->hitType = 0x39; this->currentHealth = 0xff; } break; @@ -567,7 +567,7 @@ void sub_08041BE8(Entity* this) { if (sub_08079F8C() != 0) { this->subAction = 1; this->actionDelay = 120; - this->scriptedScene = 3; + this->updateConditions = 3; InitAnimationForceUpdate(this, 10); entity = ((VaatiWrathHeapStruct*)this->myHeap)->type1; @@ -576,7 +576,7 @@ void sub_08041BE8(Entity* this) { ((VaatiWrathHeapStruct*)this->myHeap)->type1 = NULL; entity = ((VaatiWrathHeapStruct*)this->myHeap)->type2; - entity->scriptedScene = 3; + entity->updateConditions = 3; sub_080AE068(entity); LoadFixedGFX(entity, 0x1f5); sub_0801D2B4(entity, 0x16b); diff --git a/src/enemy/vaatiWrathEye.c b/src/enemy/vaatiWrathEye.c index 2fd855f5..f33e4009 100644 --- a/src/enemy/vaatiWrathEye.c +++ b/src/enemy/vaatiWrathEye.c @@ -62,7 +62,7 @@ void VaatiWrathEyeAction2(Entity* this) { sub_080485D8(this); if ((gScreenTransition.field_0x39 & 3) == 0) { this->action = 3; - this->flags |= 0x80; + COLLISION_ON(this); this->speed = 0x80; } } @@ -157,7 +157,7 @@ void VaatiWrathEyeAction7(Entity* this) { if (this->field_0xf != 0) { this->action = 8; this->actionDelay = 0x3c; - this->flags &= 0x7f; + COLLISION_OFF(this); this->spriteSettings.b.draw = 0; CreateFx(this, FX_REFLECT2, 0x40); this->parent->field_0x7a.HALF.HI |= 0x10 << this->type; @@ -177,7 +177,7 @@ void VaatiWrathEyeAction8(Entity* this) { } else { if (--this->actionDelay == 0) { this->action = 9; - this->flags |= 0x80; + COLLISION_ON(this); this->spriteSettings.b.draw = 1; InitializeAnimation(this, 0); sub_080485FC(this); diff --git a/src/enemy/wallMaster.c b/src/enemy/wallMaster.c index 9a3ae8d2..7107cf9c 100644 --- a/src/enemy/wallMaster.c +++ b/src/enemy/wallMaster.c @@ -26,9 +26,9 @@ void sub_0802A434(Entity* this) { } void sub_0802A454(Entity* this) { - if (this->damageType != 0x75 && ((this->bitfield & 0x7f) == 0 || (this->bitfield & 0x7f) == 0x1e)) { + if (this->hitType != 0x75 && ((this->bitfield & 0x7f) == 0 || (this->bitfield & 0x7f) == 0x1e)) { this->action = 5; - this->flags &= ~0x80; + COLLISION_OFF(this); this->field_0x7c.HALF.HI = gPlayerEntity.x.HALF.HI; this->field_0x80.HWORD = gPlayerEntity.y.HALF.HI; this->field_0x82.HWORD = gPlayerEntity.height.HALF.HI; @@ -72,7 +72,7 @@ void sub_0802A534(Entity* this) { if (ent != NULL) { this->action = 2; this->actionDelay = 0x5a; - this->flags |= 0x80; + COLLISION_ON(this); this->spriteSettings.b.draw = 3; this->x.HALF.HI = ent->x.HALF.HI; this->y.HALF.HI = ent->y.HALF.HI; @@ -115,7 +115,7 @@ void sub_0802A610(Entity* this) { this->actionDelay = 0x1e; } else if (this->frames.all & 1) { this->frames.all = flags; - this->damageType = 0x75; + this->hitType = 0x75; } } @@ -124,9 +124,9 @@ void sub_0802A650(Entity* this) { this->height.HALF.HI -= 2; if (-0xa0 > this->height.HALF.HI) { this->action = 1; - this->flags &= ~0x80; + COLLISION_OFF(this); this->spriteSettings.b.draw = 0; - this->damageType = 0x74; + this->hitType = 0x74; this->field_0x78.HWORD = this->field_0x7c.BYTES.byte0 * 0x3c; } } diff --git a/src/enemy/wallMaster2.c b/src/enemy/wallMaster2.c index 26074c7d..d21ca8a2 100644 --- a/src/enemy/wallMaster2.c +++ b/src/enemy/wallMaster2.c @@ -33,7 +33,7 @@ void sub_0802CC80(Entity* this) { case 0 ... 1: case 0x1e: this->action = 3; - this->flags &= ~0x80; + COLLISION_OFF(this); InitializeAnimation(this, 1); gPlayerEntity.flags &= ~0x80; break; diff --git a/src/enemy/waterDrop.c b/src/enemy/waterDrop.c index 73fc59eb..0625569c 100644 --- a/src/enemy/waterDrop.c +++ b/src/enemy/waterDrop.c @@ -55,7 +55,7 @@ void sub_0802A2FC(Entity* this) { if (this->frames.all & 0x80) { DeleteEntity(this); } else if (this->frames.all & 1) { - this->flags &= ~0x80; + COLLISION_OFF(this); } else { sub_0802A39C(this); } @@ -76,9 +76,9 @@ void sub_0802A39C(Entity* this) { u32 x = (gPlayerEntity.x.HALF.HI - gRoomControls.roomScrollX + gScreen.bg.bg1xOffset) >> 3; u32 y = (gPlayerEntity.y.HALF.HI - gRoomControls.roomScrollY + gScreen.bg.bg1yOffset - 10) >> 3; if (gBG3Buffer[(x & 0x1fU) + (y & 0x1fU) * 0x20 + 0x400]) { - this->flags &= ~0x80; + COLLISION_OFF(this); } else { - this->flags |= 0x80; + COLLISION_ON(this); } } diff --git a/src/enemy/wisp.c b/src/enemy/wisp.c index 05fdc4e0..734b47df 100644 --- a/src/enemy/wisp.c +++ b/src/enemy/wisp.c @@ -35,7 +35,7 @@ void sub_08033564(Entity* this) { case 0: this->action = 2; this->spriteSettings.b.draw = FALSE; - this->flags &= 0x7f; + COLLISION_OFF(this); this->field_0x7c.HALF.LO = 0x27c; gPlayerState.flags |= 0x4000; gSave.stats.effect = this->type + 1; @@ -50,7 +50,7 @@ void sub_08033564(Entity* this) { this->currentHealth = 0; break; case 0x14: - this->flags &= 0x7f; + COLLISION_OFF(this); this->iframes = 0; this->spriteSettings.b.draw = FALSE; ent = CreateFx(this, FX_DEATH, 0); @@ -119,7 +119,7 @@ void sub_080336DC(Entity* this) { break; case 0x0: this->action = 1; - this->flags |= 0x80; + COLLISION_ON(this); sub_08033744(this); break; } diff --git a/src/entity.c b/src/entity.c index e05c64d1..ba3aa31b 100644 --- a/src/entity.c +++ b/src/entity.c @@ -66,14 +66,14 @@ void sub_0805E374(Entity* param_1) { void sub_0805E3A0(void* ent, u32 param) { Entity* e = (Entity*)ent; - e->scriptedScene2 = param; - e->scriptedScene = param; + e->updateConditions2 = param; + e->updateConditions = param; } -bool32 sub_0805E3B0(Entity* this) { +bool32 CheckDontUpdate(Entity* this) { u32 value; - if (this->flags & 0x10) + if (this->flags & ENT_ASLEEP) return TRUE; if (this->action == 0) return FALSE; @@ -85,7 +85,7 @@ bool32 sub_0805E3B0(Entity* this) { if (gMessage.doTextBox & 0x7F) value = value < 2 ? 2 : value; - return value > this->scriptedScene; + return value > this->updateConditions; } bool32 sub_0805E40C(void) { @@ -124,16 +124,16 @@ void sub_0805E470(void) { } void sub_0805E47C(Entity* this) { - this->scriptedScene2 = this->scriptedScene; - this->scriptedScene = 2; + this->updateConditions2 = this->updateConditions; + this->updateConditions = 2; if (sub_0805E450(2)) gUnk_03003DC0.unk4 = this; } void sub_0805E4A0(Entity* this) { sub_08078A90(1); - this->scriptedScene2 = this->scriptedScene; - this->scriptedScene = 3; + this->updateConditions2 = this->updateConditions; + this->updateConditions = 3; if (sub_0805E450(1)) gUnk_03003DC0.unk4 = this; } @@ -145,8 +145,8 @@ void sub_0805E4CC(Entity* this) { void sub_0805E4E0(Entity* a1, u32 a2) { if (a1 != NULL) { - a1->scriptedScene2 = a1->scriptedScene; - a1->scriptedScene = 3; + a1->updateConditions2 = a1->updateConditions; + a1->updateConditions = 3; } if (sub_0805E450(1u)) gUnk_03003DC0.unk4 = a1; @@ -167,16 +167,16 @@ void sub_0805E524(void) { void sub_0805E544(void) { gUnk_03003DC0.unk0 = 6; - gPlayerEntity.scriptedScene = 6; + gPlayerEntity.updateConditions = 6; } void UnfreezeTime() { gUnk_03003DC0.unk0 = 0; - gPlayerEntity.scriptedScene = 1; + gPlayerEntity.updateConditions = 1; } void sub_0805E584(Entity* e) { - e->scriptedScene = e->scriptedScene2; + e->updateConditions = e->updateConditions2; sub_0805E470(); } @@ -317,7 +317,7 @@ void DeleteEntity(Entity* ent) { if (ent->kind == ENEMY) { sub_0804AA1C(ent); } - ent->flags = ent->flags & 0x7f; + COLLISION_OFF(ent); ent->spriteSettings.b.draw = 0; ent->field_0x3c = 0; ent->bitfield = 0; @@ -440,7 +440,7 @@ void sub_0805E9A8(void) { } while (++list < &gEntityLists[9]); } -void sub_0805E9F4(void) { +void DeleteSleepingEntities(void) { Entity* ent; Entity* next; LinkedList* list; @@ -449,7 +449,7 @@ void sub_0805E9F4(void) { do { for (ent = list->first; (u32)ent != (u32)list; ent = next) { next = ent->next; - if (ent->flags & 0x10) + if (ent->flags & ENT_ASLEEP) DeleteEntityAny(ent); } } while (++list < &gEntityLists[9]); diff --git a/src/game.c b/src/game.c index 408f3e73..0d33c6ca 100644 --- a/src/game.c +++ b/src/game.c @@ -259,7 +259,7 @@ void InitializePlayer(void) { MemClear((void*)&gUnk_03000B80, sizeof(gUnk_03000B80)); MemClear((void*)&gPlayerState, 0xb0); - MemFill32(0xffffffff, &gPlayerState.field_0x40, 0x40); + MemFill32(0xffffffff, &gPlayerState.hurtType, 0x40); pl = &gPlayerEntity; MemClear((void*)pl, 0x88); gRoomControls.cameraTarget = pl; diff --git a/src/arm_proxy.c b/src/interrupts.c similarity index 61% rename from src/arm_proxy.c rename to src/interrupts.c index 62d49afb..da810ec6 100644 --- a/src/arm_proxy.c +++ b/src/interrupts.c @@ -11,6 +11,7 @@ #include "utils.h" #include "npc.h" #include "effects.h" +#include "screen.h" extern u8 gUnk_03003DE0; extern u8 gUnk_03000C30; @@ -22,15 +23,13 @@ extern u8 gUnk_03003DF0[]; extern u8 gUnk_03003BE0; extern Entity* gUnk_03004040[3]; extern u8 gUnk_020342F8; -extern u8 gCollidableCount; -extern void gDoCollision(void); extern void sub_080ADD70(); extern void sub_0801C25C(); extern void UpdateDisplayControls(); extern void LoadResources(); extern void FadeMain(); -extern u32 sub_0805E3B0(); +extern u32 CheckDontUpdate(); extern void HandlePlayerLife(); extern void DoPlayerAction(); extern void sub_080171F0(); @@ -46,9 +45,11 @@ extern void sub_0807B0C8(void); extern void sub_0807A8D8(Entity*); extern void sub_08077FEC(u32); extern void ItemInit(Entity*); -extern void sub_080A2838(Entity*); +extern void InitObject(Entity*); extern u32 ReadBit(void*, u32); -extern void sub_0806EC78(Entity*); +extern void InitNPC(Entity*); +extern void m4aSoundMain(); +extern void m4aSoundVSync(); typedef struct { u8 unk0; @@ -70,15 +71,108 @@ typedef struct { } NPCStruct; extern NPCStruct gUnk_02031EC0[100]; +// todo: merge with screen.h typedef struct { - void* last; - void* first; - void* node; - u8 flags; -} LinkedList2; + u16 dest; + u16 _2; + u16 _4; + u16 _6; + u8* src; +} DmaSettings; -extern LinkedList2 gUnk_03003C70[16]; -extern LinkedList2* gUnk_02018EA0; +extern u16 gDmaPresets[]; + +struct { + u8 update; + u8 _0[0x1c]; + struct OamData oam[0x80]; +} extern gUnk_03000000; + +struct { + u8 ready; + u16* src; + u16* dest; + u32 size; +} extern gUnk_02022730; + +void sub_08016CA8(DmaSettings* s); +void sub_08016BF8(void); +void DispCtrlSet(void); + +extern u16 gUnk_080B2CD8[]; + +extern u32 gUnk_03000FBC; + +void gIntrMain(void); + +typedef void (*fp)(void); + +void DummyIntr(void) { + /* .. */ +} + +void EnableVBlankIntr(void) { + INTR_VECTOR = gIntrMain; + REG_DISPSTAT = 0x5028; + REG_IE = 0x2005; + REG_IME = 1; +} + +void VBlankIntr(void) { + DmaStop(0); + m4aSoundVSync(); + if (gMain.interruptFlag == 0) { + DispCtrlSet(); + DmaCopy32(0, &gUnk_03000FBC, &gUnk_02022730, 16); + gMain.interruptFlag = 1; + } + sub_08016BF8(); + INTR_CHECK |= 1; +} + +void HBlankIntr(void) { + REG_DISPSTAT = 0x5028; + m4aSoundMain(); +} + +void sub_08016BF8(void) { + if (gUnk_02022730.ready) { + const u16* src = gUnk_02022730.src; + u16* dest = gUnk_02022730.dest; + s32 size, i = size = gUnk_02022730.size; + DmaSet(0, src, dest, size); + + i = size & 0x3fff; + if (i == 0) { + i = 0x4000; + } + do { + *dest++ = *src++; + } while (--i > 0); + } +} + +void UpdateDisplayControls(void) { + if (gUnk_03000000.update && ((gScreen.lcd.displayControl & 0x1000) != 0)) { + gUnk_03000000.update = 0; + DmaCopy32(3, &gUnk_03000000.oam, 0x07000000, 0x400); + } + sub_08016CA8((DmaSettings*)&gScreen.bg.bg0Control); + sub_08016CA8((DmaSettings*)&gScreen.bg.bg1Control); + sub_08016CA8((DmaSettings*)&gScreen.affine.bg2Control); + sub_08016CA8((DmaSettings*)&gScreen.affine.bg3Control); +} + +void sub_08016CA8(DmaSettings* s) { + if (s->_6 && s->src != 0) { + u32 dest; + s->_6 = 0; + dest = s->dest; + DmaCopy32(3, s->src, ((dest << 3) & 0xF800) + 0x06000000, gUnk_080B2CD8[dest >> 14]); + } +} + +ASM_FUNC("asm/dispCtrlSet.s", void DispCtrlSet(void)); // Load any resources that were requested with LoadResourceAsync void LoadResources(void) { @@ -133,16 +227,16 @@ void PlayerUpdate(Entity* this) { else gPlayerState.flags &= ~0x4000; - if (sub_0805E3B0(this) == 0) { + if (CheckDontUpdate(this) == 0) { if ((gPlayerState.flags & 0x80000) != 0) { sub_08077B20(); if ((gPlayerState.flags & 0x200000) != 0) { gPlayerState.playerAction = 0x18; gPlayerState.flags &= ~0x80000; gPlayerState.hurtBlinkSpeed = 0xf0; - this->flags |= 0x80; + COLLISION_ON(this); } else { - this->flags &= ~0x80; + COLLISION_OFF(this); gPlayerState.field_0xa8 = 0xf; } } @@ -185,8 +279,8 @@ void HandlePlayerLife(Entity* this) { gPlayerState.field_0xa9 = gPlayerState.field_0xa8; gPlayerState.field_0xa8 = 0; - if (gPlayerState.field_0x40[0x4a] != 0) { - gPlayerState.field_0x40[0x4a]--; + if (gPlayerState.hurtType[0x4a] != 0) { + gPlayerState.hurtType[0x4a]--; return; } @@ -243,7 +337,7 @@ void sub_080171F0(void) { gPlayerEntity.bitfield &= ~0x80; if (gPlayerEntity.action != 0x14) - gPlayerState.flags = (gPlayerState.flags & ~0x10000) | (0x10000 * (gPlayerState.flags & 2) / 2); + COPY_FLAG_FROM_TO(gPlayerState.flags, 0x2, 0x10000); gPlayerState.flags &= ~2; sub_080028E0(&gPlayerEntity); @@ -281,10 +375,10 @@ void sub_080171F0(void) { } void ItemUpdate(Entity* this) { - if ((this->flags & 1) == 0 && this->action == 0 && this->subAction == 0) + if ((this->flags & ENT_DID_INIT) == 0 && this->action == 0 && this->subAction == 0) ItemInit(this); - if (!sub_0805E3B0(this)) { + if (!CheckDontUpdate(this)) { gPlayerItemFunctions[this->id](this); this->bitfield &= ~0x80; if (this->iframes != 0) { @@ -309,9 +403,9 @@ NONMATCH("asm/non_matching/arm_proxy/ItemInit.inc", void ItemInit(Entity* this)) } this->palette.raw = ((entry->unk0 & 0xf) << 4) | entry->unk0; - this->field_0x44 = entry->unk1; - this->field_0x40 = entry->unk3; - this->damageType = entry->unk4; + this->damage = entry->unk1; + this->hurtType = entry->unk3; + this->hitType = entry->unk4; this->spriteIndex = entry->unk5; if (entry->unk6 == 0) this->spriteVramOffset = gPlayerEntity.spriteVramOffset; @@ -326,18 +420,16 @@ NONMATCH("asm/non_matching/arm_proxy/ItemInit.inc", void ItemInit(Entity* this)) this->spritePriority.b0 = gPlayerEntity.spritePriority.b0; this->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; this->currentHealth = 1; - this->flags |= 1; + this->flags |= ENT_DID_INIT; } END_NONMATCH void ObjectUpdate(Entity* this) { - int iVar1; - - if (((this->flags & 1) == 0) && (this->action == 0)) - sub_080A2838(this); + if ((this->flags & ENT_DID_INIT) == 0 && this->action == 0) + InitObject(this); if (this->iframes != 0) this->iframes++; - if (!sub_0805E3B0(this)) { + if (!CheckDontUpdate(this)) { gObjectFunctions[this->id](this); this->bitfield &= ~0x80; } @@ -345,7 +437,7 @@ void ObjectUpdate(Entity* this) { } void ManagerUpdate(Entity* this) { - if (!sub_0805E3B0(this)) + if (!CheckDontUpdate(this)) gManagerFunctions[this->id](this); } @@ -353,9 +445,9 @@ void ManagerUpdate(Entity* this) { NONMATCH("asm/non_matching/arm_proxy/NPCUpdate.inc", void NPCUpdate(Entity* this)) { if ((this->currentHealth & 0x7f) && !ReadBit(&gUnk_020342F8, this->currentHealth - 1)) DeleteThisEntity(); - if ((this->action == 0) && ((this->flags & 1) == 0)) - sub_0806EC78(this); - if (!sub_0805E3B0(this)) + if (this->action == 0 && (this->flags & ENT_DID_INIT) == 0) + InitNPC(this); + if (!CheckDontUpdate(this)) gNPCFunctions[this->id][0](this); if (this->next != NULL) { if (gNPCFunctions[this->id][1] != NULL) @@ -369,168 +461,3 @@ NONMATCH("asm/non_matching/arm_proxy/NPCUpdate.inc", void NPCUpdate(Entity* this } } END_NONMATCH - -void ClearHitboxList(void) { - gCollidableCount = 0; -} - -void CollisionMain(void) { - void (*doCollision)(void); - u32 flags; - u32 temp; - - temp = gUnk_03003DC0.unk0; - if (gUnk_03003DC0.unk0 <= gUnk_03003DC0.unk1) - temp = gUnk_03003DC0.unk1; - if (temp != 0) - return; - - doCollision = &gDoCollision; - // Check to see if we should disable collision this frame - if (gPlayerState.field_0x8b != 0) { - u32 temp = gPlayerEntity.flags; - gPlayerEntity.flags &= ~0x80; - doCollision(); - gPlayerEntity.flags = temp; // reset collision to before - } else { - doCollision(); - } -} - -void RegisterPlayerHitbox(void) { - MemClear(&gUnk_03003C70, sizeof(gUnk_03003C70)); - gUnk_02018EA0 = (LinkedList2*)&gUnk_03003C70[0].last; - gUnk_03003C70[0].last = &gUnk_03003C70[0].last; - gUnk_03003C70[0].first = &gUnk_03003C70[0].last; - gUnk_03003C70[0].node = &gPlayerEntity; -} - -// Loop declaration seems wrong -NONMATCH("asm/non_matching/arm_proxy/sub_0801766C.inc", u32 sub_0801766C(Entity* this)) { - u32 uVar1; - LinkedList2* puVar3; - LinkedList2* puVar2; - LinkedList2* pLVar2; - LinkedList2* i; - u8* pbVar4; - - if (this->spritePriority.b2 != 0) { - return 1; - } else { - for (i = &gUnk_03003C70[0]; i < &gUnk_03003C70[16]; ++i) { - if (i->node == NULL) { - i->node = this; - i->flags = 0; - this->spritePriority.b2 = 1; - pLVar2 = gUnk_02018EA0; - if (gUnk_02018EA0->flags != 0) { - do { - pLVar2 = pLVar2->first; - } while (pLVar2->flags != 0); - i->first = pLVar2; - puVar3 = pLVar2->last; - i->last = puVar3; - puVar3->first = i; - pLVar2->last = i; - } else { - i->first = gUnk_02018EA0; - puVar2 = gUnk_02018EA0->last; - i->last = puVar2; - puVar2->first = i; - gUnk_02018EA0->last = i; - gUnk_02018EA0 = i; - } - return 1; - } - } - return 0; - } -} -END_NONMATCH - -// same loop issue -NONMATCH("asm/non_matching/arm_proxy/sub_080176E4.inc", u32 sub_080176E4(Entity* this)) { - u32 uVar1; - LinkedList2* j; - LinkedList2* i; - u8* pbVar4; - - if (this->spritePriority.b2 != 0) { - return 1; - } else { - for (i = &gUnk_03003C70[0]; i < &gUnk_03003C70[16]; ++i) { - if (i->node == NULL) { - i->node = this; - i->flags = 1; - this->spritePriority.b2 = 1; - i->first = gUnk_02018EA0; - j = gUnk_02018EA0->last; - i->last = j; - j->first = i; - gUnk_02018EA0->last = i; - gUnk_02018EA0 = i; - return 1; - } - } - return 0; - } -} -END_NONMATCH - -// you guessed it -NONMATCH("asm/non_matching/arm_proxy/sub_08017744.inc", void sub_08017744(Entity* this)) { - LinkedList2* i; - for (i = &gUnk_03003C70[0]; i < &gUnk_03003C70[16]; ++i) { - if (i->node == this) { - if (this->spritePriority.b2 != 0) { - this->spritePriority.b2 = 0; - i->node = NULL; - ((LinkedList2*)i->last)->first = i->first; - ((LinkedList2*)i->first)->last = i->last; - if (i != gUnk_02018EA0) - return; - gUnk_02018EA0 = i->first; - } - } - } -} -END_NONMATCH - -// regalloc -NONMATCH("asm/non_matching/arm_proxy/sub_080177A0.inc", bool32 sub_080177A0(Entity* this, Entity* that)) { - u32 this_d; - u32 depth; - - if ((that->collisionLayer & this->collisionLayer) != 0) { - Hitbox* bb_this = this->hitbox; - Hitbox* bb_that = that->hitbox; - u32 this_w = bb_this->width; - u32 that_w = bb_that->width; - if ((((this->x.HALF.HI - that->x.HALF.HI) + bb_this->offset_x) - bb_that->offset_x) + this_w + that_w <= - (this_w + that_w) * 2) { - u32 this_h = bb_this->height; - u32 that_h = bb_that->height; - if ((((this->y.HALF.HI - that->y.HALF.HI) + bb_this->offset_y) - bb_that->offset_y) + this_h + that_h <= - (this_h + that_h) * 2) { - if ((this->field_0x3c & 0x10) != 0) - this_d = ((Hitbox3D*)bb_this)->depth; - else - this_d = 5; - if ((that->field_0x3c & 0x10) != 0) - depth = this_d + ((Hitbox3D*)bb_that)->depth; - else - depth = this_d + 5; - if ((this->height.HALF.HI - that->height.HALF.HI) + depth <= depth * 2) - return TRUE; - } - } - } - return FALSE; -} -END_NONMATCH - -bool32 sub_08017850(Entity* this) { - if (sub_08079F8C()) - return sub_080177A0(this, &gPlayerEntity); - return FALSE; -} diff --git a/src/item/itemSword.c b/src/item/itemSword.c index c18178f2..7835fcc0 100644 --- a/src/item/itemSword.c +++ b/src/item/itemSword.c @@ -83,7 +83,7 @@ void sub_08075694(ItemBehavior* this, u32 arg1) { gPlayerState.field_0xa = (8 >> arg1) | gPlayerState.field_0xa; this->stateID = 4; this->field_0xf = 6; - gPlayerEntity.field_0x40 = 0x1e; + gPlayerEntity.hurtType = 0x1e; gPlayerState.field_0x1a[1] |= 0x40; gPlayerState.field_0x1a[1] &= 0xdf; if ((gPlayerState.field_0xa0[0] == 0x04) && ((gPlayerState.flags & 0x400000) == 0)) { @@ -122,7 +122,7 @@ ASM_FUNC("asm/non_matching/itemSword/sub_08075900.inc", void sub_08075900(ItemBe void sub_080759B8(ItemBehavior* this, u32 arg1) { if ((gPlayerState.flags & 0x80) == 0) { - gPlayerEntity.field_0x40 = 0; + gPlayerEntity.hurtType = 0; } gPlayerState.flags &= 0xf7ffffff; gPlayerState.field_0x1a[1] = 0; diff --git a/src/main.c b/src/main.c index bff9997b..c69d07fa 100644 --- a/src/main.c +++ b/src/main.c @@ -118,7 +118,7 @@ static void sub_08055F70(void) { } DispReset(0); - sub_08016B34(); + EnableVBlankIntr(); } #define SOFT_RESET_KEYS (A_BUTTON | B_BUTTON | SELECT_BUTTON | START_BUTTON) diff --git a/src/npc/cat.c b/src/npc/cat.c index 30160f98..7a49b5ce 100644 --- a/src/npc/cat.c +++ b/src/npc/cat.c @@ -66,8 +66,8 @@ void sub_080677EC(Entity* this) { this->direction = 8; this->speed = 0x80; this->field_0x3c = 7; - this->field_0x40 = 0x48; - this->damageType = -0x58; + this->hurtType = 0x48; + this->hitType = -0x58; this->flags2 = 1; this->field_0x68.HALF.HI = 0xff; if (this->x.HALF.HI < gPlayerEntity.x.HALF.HI) { @@ -183,7 +183,7 @@ void sub_08067A0C(Entity* this) { } else { tmp = (this->frames.all & 7); if (tmp != 0) { - this->flags = this->flags | 0x80; + COLLISION_ON(this); this->hitbox = gUnk_08111154[tmp - 1 + ((this->spriteSettings.b.flipX << 2))]; } else { sub_08067DDC(this); @@ -381,7 +381,7 @@ void sub_08067DCC(Entity* this, u32 param) { } void sub_08067DDC(Entity* this) { - this->flags = this->flags & 0x7f; + COLLISION_OFF(this); this->bitfield = 0; this->iframes = 0; this->hitbox = &gUnk_08110EF0; diff --git a/src/npc/npc5.c b/src/npc/npc5.c index f90e709b..8cffdf49 100644 --- a/src/npc/npc5.c +++ b/src/npc/npc5.c @@ -134,11 +134,11 @@ void sub_08060AE0(Entity* this) { this->myHeap = (u32*)heapObj; heapObj->unk_0b = 0x20; this->action = 1; - this->flags |= 0x80; + COLLISION_ON(this); this->animationState &= 3; this->field_0x3c = 7; - this->field_0x40 = 0x48; - this->damageType = 0x49; + this->hurtType = 0x48; + this->hitType = 0x49; this->flags2 = 3; this->hitbox = &gUnk_080FD150; this->field_0x17 &= 0xfe; diff --git a/src/object/button.c b/src/object/button.c index 8bbd7bca..0a1c7fbb 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -15,8 +15,8 @@ void Button(Entity* this) { extern u32 sub_08081E3C(Entity*); void sub_08081AE0(Entity* this) { - this->flags &= 0x7F; - this->scriptedScene = 3; + COLLISION_OFF(this); + this->updateConditions = 3; this->y.HALF.HI++; if (this->cutsceneBeh.HWORD != 0) { this->collisionLayer = this->cutsceneBeh.HWORD; @@ -234,13 +234,13 @@ u32 sub_08081F00(u32* unk1, u32* unk2) { void sub_08081F24(Entity* this) { Entity* fx = CreateFx(this, FX_DASH, 0x40); if (fx) { - fx->scriptedScene = 3; + fx->updateConditions = 3; fx->x.HALF.HI += 7; fx->y.HALF.HI += 5; } fx = CreateFx(this, FX_DASH, 0x40); if (fx) { - fx->scriptedScene = 3; + fx->updateConditions = 3; fx->x.HALF.HI -= 7; fx->y.HALF.HI += 5; } diff --git a/src/object/heartContainer.c b/src/object/heartContainer.c index 1821a27b..71d109f4 100644 --- a/src/object/heartContainer.c +++ b/src/object/heartContainer.c @@ -31,7 +31,7 @@ static void sub_0808E6A0(Entity* this) { this->spriteSettings.b.draw = 0; this->hitbox = &gUnk_08121C58; this->collisionLayer = 3; - this->scriptedScene = 3; + this->updateConditions = 3; } static void sub_0808E6E4(Entity* this) { diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c index 2e4f555a..f9ac58f6 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -50,7 +50,7 @@ void ItemOnGround(Entity* this) { switch (this->bitfield & 0x7F) { case 20: this->action = 3; - this->flags &= 0x7F; + COLLISION_OFF(this); this->spriteSettings.b.draw = 1; this->field_0x3c |= 0x10; this->attachedEntity = this->field_0x4c; @@ -93,22 +93,22 @@ void sub_08080F20(Entity* this) { this->spriteSettings.b.draw = 1; this->spritePriority.b1 = 3; this->spriteSettings.b.shadow = 0; - this->damageType = 7; + this->hitType = 7; this->field_0x3c = 0x47; - this->field_0x40 = 0x44; + this->hurtType = 0x44; this->currentHealth = 0xFF; this->hitbox = &gUnk_080FD1A8; - switch (this->type - 0x3F) { - case 0: - case 21: - case 22: - case 23: - case 24: - case 25: - case 29: - case 30: - case 31: - case 32: + switch (this->type) { + case 0x3f: + case 0x54: + case 0x55: + case 0x56: + case 0x57: + case 0x58: + case 0x5c: + case 0x5d: + case 0x5e: + case 0x5f: this->flags2 = 0x17; break; default: @@ -165,7 +165,7 @@ void sub_080810FC(Entity* this) { } else { this->action = 2; this->subAction = 0; - this->flags |= 0x80; + COLLISION_ON(this); this->flags2 = 0x11; CopyPosition(&gPlayerEntity, this); } @@ -179,7 +179,7 @@ void sub_08081134(Entity* this) { void sub_08081150(Entity* this) { this->action = 2; - this->flags |= 0x80; + COLLISION_ON(this); this->height.HALF.HI = -0x80; this->spriteOrientation.flipY = 1; this->spriteRendering.b3 = 1; @@ -188,7 +188,7 @@ void sub_08081150(Entity* this) { void sub_08081188(Entity* this) { this->action = 2; - this->flags |= 0x80; + COLLISION_ON(this); if (this->collisionLayer == 2) { sub_08016A30(this); } @@ -220,7 +220,7 @@ void sub_080811EC(Entity* this) { sub_08003FC4(this, 0x2800); if (this->hVelocity <= 0) { this->action = 2; - this->flags |= 0x80; + COLLISION_ON(this); sub_080814A4(this); } } @@ -430,7 +430,7 @@ void sub_08081598(Entity* this) { sub_08081404(this, 1); } - this->flags &= 0x7F; + COLLISION_OFF(this); this->action = 4; this->actionDelay = 14; this->hVelocity = 0x20000; diff --git a/src/object/jarPortal.c b/src/object/jarPortal.c index a3f2541d..8262fa0a 100644 --- a/src/object/jarPortal.c +++ b/src/object/jarPortal.c @@ -20,10 +20,10 @@ void JarPortal(Entity* this) { } void sub_0808BE9C(Entity* this) { - this->flags |= 0x80; - this->damageType = 1; + COLLISION_ON(this); + this->hitType = 1; this->field_0x3c = 0x47; - this->field_0x40 = 0x44; + this->hurtType = 0x44; this->flags2 = 0x80; this->field_0x68.HALF.LO = 0; if (CheckLocalFlag(this->type)) { diff --git a/src/object/lightableSwitch.c b/src/object/lightableSwitch.c index cbeafdd7..1b8d651a 100644 --- a/src/object/lightableSwitch.c +++ b/src/object/lightableSwitch.c @@ -26,11 +26,11 @@ void sub_0809EA1C(Entity* this) { void sub_0809EA34(Entity* this) { this->action = 1; - this->flags = this->flags | 0x80; + COLLISION_ON(this); this->frameIndex = 0; this->field_0x3c = 7; - this->field_0x40 = 0x48; - this->damageType = 0x28; + this->hurtType = 0x48; + this->hitType = 0x28; this->flags2 = 10; this->hitbox = &gUnk_080FD150; sub_0809EAD8(this); @@ -98,11 +98,11 @@ void sub_0809EB68(Entity* this) { void sub_0809EB80(Entity* this) { this->action = 1; - this->flags = this->flags | 0x80; + COLLISION_ON(this); this->frameIndex = 3; this->field_0x3c = 7; - this->field_0x40 = 0x48; - this->damageType = 0x28; + this->hurtType = 0x48; + this->hitType = 0x28; this->flags2 = 10; this->hitbox = &gUnk_080FD150; sub_0809EAD8(this); diff --git a/src/object/minecart.c b/src/object/minecart.c index 01d7d1ac..a1c79b41 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -45,10 +45,10 @@ void sub_080916EC(Entity* this) { this->type2 = unk->field_0x6; this->action = 1; this->hitbox = &gUnk_080FD310; - this->flags |= 0x80; - this->damageType = 1; + COLLISION_ON(this); + this->hitType = 1; this->field_0x3c = 0x47; - this->field_0x40 = 0x44; + this->hurtType = 0x44; this->flags2 = 0x80; this->direction = DirectionFromAnimationState(this->animationState); this->speed = 0x700; @@ -105,12 +105,12 @@ void sub_080918A4(Entity* this) { gPlayerState.flags = (gPlayerState.flags ^ 0x4000000) | 0x1000; this->action++; this->field_0xf = 1; - this->flags |= 0x20; - this->damageType = 0x97; + this->flags |= ENT_20; + this->hitType = 0x97; this->field_0x3c = (gPlayerEntity.field_0x3c + 1) | 0x20; this->flags2 = gPlayerEntity.flags2; - this->field_0x40 = 0x18; - this->field_0x44 = 8; + this->hurtType = 0x18; + this->damage = 8; sub_0801766C(this); sub_0807BA8C(COORD_TO_TILE(this), this->collisionLayer); SoundReq(SFX_137); @@ -134,7 +134,7 @@ void sub_080919AC(Entity* this) { } if ((gPlayerEntity.frames.all & 0xf) == 0) { - this->flags = this->flags & 0x7f; + COLLISION_OFF(this); CopyPosition(this, &gPlayerEntity); if ((gPlayerEntity.frames.all & 0xf0) == 0x10) { this->spriteOffsetY = 1; @@ -142,7 +142,7 @@ void sub_080919AC(Entity* this) { this->spriteOffsetY = 0; } } else { - this->flags = this->flags | 0x80; + COLLISION_ON(this); gPlayerEntity.speed = 0; sub_0806F69C(this); CopyPosition(this, &gPlayerEntity); @@ -166,10 +166,10 @@ void sub_080919AC(Entity* this) { } else { switch (uVar3) { case 0x64: - this->flags = this->flags & 0xdf; - this->damageType = 1; + this->flags &= ~ENT_20; + this->hitType = 1; this->field_0x3c = 0x47; - this->field_0x40 = 0x44; + this->hurtType = 0x44; this->flags2 = 0x80; this->action = 6; sub_08017744(this); diff --git a/src/object/mineralWaterSource.c b/src/object/mineralWaterSource.c index 50212f44..1ffcd585 100644 --- a/src/object/mineralWaterSource.c +++ b/src/object/mineralWaterSource.c @@ -28,15 +28,15 @@ void MineralWaterSource_Init(Entity* this) { unknownParameters = &MineralWaterSourceParameters[this->type]; this->type2 = unknownParameters->field_0x00; - this->field_0x40 = unknownParameters->field_0x03; + this->hurtType = unknownParameters->field_0x03; this->hitbox->width = unknownParameters->field_0x01; this->hitbox->height = unknownParameters->field_0x02; - this->flags |= 0x80; + COLLISION_ON(this); this->field_0x3c = 7; - this->damageType = 145; + this->hitType = 145; this->flags2 = 2; this->action = 1; diff --git a/src/object/object49.c b/src/object/object49.c index 0be4c477..02aac844 100644 --- a/src/object/object49.c +++ b/src/object/object49.c @@ -188,14 +188,14 @@ void sub_0808F3DC(Entity* this) { return; } } else { - this->damageType = this->attachedEntity->damageType; - this->attachedEntity->damageType = 0x7E; + this->hitType = this->attachedEntity->hitType; + this->attachedEntity->hitType = 0x7E; } ResolveEntityOnTop(this->attachedEntity, this); } else { if (*(u32*)&this->parent->field_0x74 == 0) { if (this->type == 8) { - this->attachedEntity->damageType = this->damageType; + this->attachedEntity->hitType = this->hitType; } DeleteThisEntity(); } diff --git a/src/object/object9E.c b/src/object/object9E.c index 771f7e80..ea6b1787 100644 --- a/src/object/object9E.c +++ b/src/object/object9E.c @@ -16,13 +16,13 @@ void Object9E(Entity* this) { this->action = 1; this->spritePriority.b0 = 6; if (this->type == 0) { - this->flags = this->flags | 0x80; + COLLISION_ON(this); this->frameIndex = 1; layer = &this->collisionLayer; *layer = 1; this->field_0x3c = 7; - this->field_0x40 = 0x48; - this->damageType = 0x7a; + this->hurtType = 0x48; + this->hitType = 0x7a; this->flags2 = 1; this->hitbox = &gUnk_080FD168; tilePos = COORD_TO_TILE(this); diff --git a/src/object/pot.c b/src/object/pot.c index 79d0a38f..ce0fa0bf 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -37,10 +37,10 @@ void sub_0808222C(Entity* this) { this->speed = 0x80; this->y.HALF.HI += 3; this->field_0x16 = 0; - this->flags |= 0x80; + COLLISION_ON(this); this->currentHealth = 1; this->field_0x3c = 7; - this->damageType = 0x6E; + this->hitType = 0x6E; this->flags2 = 0x84; this->field_0x1c = 0x12; if (this->collisionLayer == 0) { @@ -71,7 +71,7 @@ void sub_08082310(Entity* this) { this->spriteOffsetY = 0; this->spriteSettings.b.shadow = 1; this->spritePriority.b1 = 3; - this->flags &= 0x7F; + COLLISION_OFF(this); sub_08082824(this); break; default: @@ -118,10 +118,10 @@ void sub_080824F8(Entity* this) { } void sub_08082510(Entity* this) { - this->flags |= 0x80; + COLLISION_ON(this); this->hitbox = &gUnk_080FD340; this->field_0x3c = 7; - this->damageType = 1; + this->hitType = 1; this->flags2 = gPlayerEntity.flags2; this->spriteOffsetY = 0; SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); diff --git a/src/object/warpPoint.c b/src/object/warpPoint.c index 69ed1fdc..fc6239d1 100644 --- a/src/object/warpPoint.c +++ b/src/object/warpPoint.c @@ -41,7 +41,7 @@ void sub_0808B474(Entity* this) { this->palette.b.b0 = tmp; this->spritePriority.b0 = 6; this->hitbox = &gUnk_080FD168; - this->scriptedScene = 3; + this->updateConditions = 3; InitializeAnimation(this, 0); if (CheckFlags(this->field_0x86.HWORD)) { sub_0808B830(this); diff --git a/src/player.c b/src/player.c index 0f68f9e3..ad3107fe 100644 --- a/src/player.c +++ b/src/player.c @@ -90,13 +90,13 @@ void PlayerInit(Entity* this) { gPlayerState.field_0x0[0] = 0xff; gPlayerState.startPosX = gPlayerEntity.x.HALF.HI; gPlayerState.startPosY = gPlayerEntity.y.HALF.HI; - this->flags |= 0x80; + COLLISION_ON(this); this->spritePriority.b0 = 0xc; this->spritePriority.b1 = 1; this->spriteSettings.b.shadow = 1; this->field_0x16 = 0x20; this->flags2 = 8; - this->damageType = 0x79; + this->hitType = 0x79; this->hitbox = &gUnk_08114F88; this->spriteIndex = 1; #ifndef EU @@ -168,7 +168,7 @@ void sub_08070C3C(Entity* this) { gPlayerState.field_0x8 = 0x1b8; this->subAction++; - this->flags &= ~0x80; + COLLISION_OFF(this); this->spritePriority.b1 = 0; ResetPlayer(); sub_0807A108(); @@ -197,7 +197,7 @@ void PlayerBounce(Entity* this) { } void sub_08070D38(Entity* this) { - this->flags &= ~0x80; + COLLISION_OFF(this); this->direction = ((this->animationState & 0xe) << 2) ^ 0x10; this->speed = 0x100; this->knockbackDuration = 0; @@ -246,7 +246,7 @@ NONMATCH("asm/non_matching/player/sub_08070DC4.inc", void sub_08070DC4(Entity* t return; } - this->flags |= 0x80; + COLLISION_ON(this); if ((gPlayerState.field_0x14 == 0) && sub_08008B22()) { gPlayerState.field_0x10[1] = 7; @@ -285,7 +285,7 @@ void sub_08070E9C(Entity* this) { } void sub_08070EDC(Entity* this) { - this->scriptedScene = 2; + this->updateConditions = 2; if ((gMessage.doTextBox & 0x7f) != 0) this->subAction = 1; @@ -299,7 +299,7 @@ void sub_08070EDC(Entity* this) { void sub_08070f24(Entity* this) { UpdateAnimationSingleFrame(this); if ((gMessage.doTextBox & 0x7f) == 0) { - this->scriptedScene = this->scriptedScene2; + this->updateConditions = this->updateConditions2; sub_080791D0(); } } @@ -309,7 +309,7 @@ void PlayerItemGet(Entity* this) { u8* temp; // todo: retype gPlayerState.field_0xa8 = 0x15; - this->flags &= ~(0x80); + COLLISION_OFF(this); gUnk_0811BA7C[this->subAction](this); child = this->attachedEntity; @@ -486,7 +486,7 @@ void sub_08071208(Entity* this) { void PlayerDrown(Entity* this) { gPlayerState.field_0xa8 = 0x16; gPlayerState.flags |= 4; - this->flags &= ~0x80; + COLLISION_OFF(this); gUnk_0811BA94[this->subAction](this); } @@ -568,7 +568,7 @@ void PortalJumpOnUpdate(Entity* this) { u16 x; u16 y; - this->flags &= ~0x80; + COLLISION_OFF(this); this->knockbackDuration = 0; x = gArea.curPortalX; @@ -735,7 +735,7 @@ void PlayerTalkEzlo(Entity* this) { sub_08071A6C(); } else { gPlayerState.field_0xa8 = 0x13; - this->flags &= ~0x80; + COLLISION_OFF(this); gUnk_0811BAD4[this->subAction](this); } } @@ -745,7 +745,7 @@ void sub_080718A0(Entity* this) { gUnk_03000B80.filler[0x63] = 0; this->iframes = 0; gUnk_03003DC0.unk0 = 6; - this->scriptedScene = 6; + this->updateConditions = 6; if (gPlayerState.flags & 0x80) { this->subAction = 2; @@ -838,7 +838,7 @@ void sub_08071A4C(Entity* this) { void sub_08071A6C(void) { gUnk_03003DC0.unk0 = 0; - gPlayerEntity.scriptedScene = gPlayerEntity.scriptedScene2; + gPlayerEntity.updateConditions = gPlayerEntity.updateConditions2; } void PlayerPush(Entity* this) { @@ -901,7 +901,7 @@ void sub_08071B60(Entity* this) { extern void (*const gUnk_0811BB2C[])(Entity*); void PlayerMinishDie(Entity* this) { - this->flags &= ~0x80; + COLLISION_OFF(this); gUnk_0811BB2C[this->subAction](this); gPlayerState.field_0xa8 = 0x12; } @@ -1101,7 +1101,7 @@ void PlayerFrozen(Entity* this) { } void sub_08071F50(Entity* this) { - this->flags &= ~0x80; + COLLISION_OFF(this); this->actionDelay = 0x78; this->subAction++; gPlayerState.field_0x8 = 0x294; @@ -1141,7 +1141,7 @@ void sub_08071F80(Entity* this) { void sub_08072008(Entity* this) { this->iframes = 160; this->knockbackDuration = 0; - this->flags |= 0x80; + COLLISION_ON(this); this->spriteOffsetX = 0; gPlayerState.flags &= ~(0x800 | 0x1); CreateFx(this, FX_ICE, 0); @@ -1156,7 +1156,7 @@ void sub_0807204C(Entity* this) { void sub_08072064(Entity* this) { this->subAction = 1; - this->flags &= ~0x80; + COLLISION_OFF(this); this->actionDelay = gPlayerState.field_0x3a; gPlayerState.field_0x8 = gPlayerState.field_0x38 | (gPlayerState.field_0x39 << 8); ResetPlayer(); @@ -1173,7 +1173,7 @@ void sub_08072098(Entity* this) { return; if (this->currentHealth != 0) - this->flags |= 0x80; + COLLISION_ON(this); sub_080791BC(); } @@ -1190,7 +1190,7 @@ void sub_08072100(Entity* this) { this->hitbox = &gUnk_08114F88; this->actionDelay = gPlayerState.field_0x38; this->subAction = 1; - this->flags &= ~0x80; + COLLISION_OFF(this); if (gPlayerState.field_0x39) this->direction = 0xff; @@ -1218,7 +1218,7 @@ void sub_08072168(Entity* this) { sub_08019840(); if (--this->actionDelay == 0xff) { this->knockbackDuration = 0; - this->flags |= 0x80; + COLLISION_ON(this); UpdateSpriteForCollisionLayer(this); sub_080791BC(); } @@ -1272,7 +1272,7 @@ void PlayerLava(Entity* this) { void sub_080722DC(Entity* this) { Entity* ent; - this->flags &= ~0x80; + COLLISION_OFF(this); if (!(gPlayerState.flags & 0x80)) { this->subAction = 1; this->hVelocity = 0x28000; @@ -1368,7 +1368,7 @@ void sub_080724DC(Entity* this) { sub_0807AE20(this); } if (gRoomControls.unk2 == 0) { - this->scriptedScene = this->scriptedScene2; + this->updateConditions = this->updateConditions2; sub_080728AC(this); } else if (gPlayerState.field_0x1c == 0) { UpdateAnimationSingleFrame(this); @@ -1394,7 +1394,7 @@ void sub_0807258C(Entity* this) { if (sub_080797C4() != 0) { gPlayerState.startPosX = gPlayerEntity.x.HALF.HI; gPlayerState.startPosY = gPlayerEntity.y.HALF.HI; - this->scriptedScene = this->scriptedScene2; + this->updateConditions = this->updateConditions2; sub_080728AC(this); } else { UpdateAnimationSingleFrame(this); @@ -1402,7 +1402,7 @@ void sub_0807258C(Entity* this) { } else { gPlayerState.startPosX = gPlayerEntity.x.HALF.HI; gPlayerState.startPosY = gPlayerEntity.y.HALF.HI; - this->scriptedScene = this->scriptedScene2; + this->updateConditions = this->updateConditions2; sub_080728AC(this); } } @@ -1433,7 +1433,7 @@ void sub_08072650(Entity* this) { this->spritePriority.b1 = 0; gPlayerState.field_0x8 = 0xc08; } else { - *(u8*)&this->field_0x40 = 0x1e; + *(u8*)&this->hurtType = 0x1e; if (temp & 8) { gPlayerState.field_0x8 = 0x438; } else { @@ -1509,7 +1509,7 @@ void sub_080726F4(Entity* this) { sub_08079E08(); } if (((this->frames.all & 0x10) == 0) && ((gPlayerState.flags & 0x80) == 0)) { - *(u8*)&this->field_0x40 = 0; + *(u8*)&this->hurtType = 0; } if ((this->frames.all & 0x40) != 0) { sub_08077698(this); @@ -1539,7 +1539,7 @@ void sub_080728AC(Entity* this) { if (!(gRoomControls.unk6 & 4)) { if ((gPlayerState.flags & 0x40)) - this->flags |= 0x80; + COLLISION_ON(this); sub_080791D0(); } if (!(gPlayerState.flags & 2)) { @@ -1559,7 +1559,7 @@ void sub_08072970(Entity* this) { this->subAction = 1; this->x.HALF.HI = (this->x.HALF.HI & ~0xF) | 8; this->y.HALF.HI = (this->y.HALF.HI & ~0XF) | 10; - this->flags &= ~0x80; + COLLISION_OFF(this); this->spritePriority.b0 = 7; this->spritePriority.b1 = 0; this->actionDelay = 0; @@ -1604,7 +1604,7 @@ void sub_08072ACC(Entity* this) { if (gPlayerState.field_0xd == 0xff) { this->field_0xf = 0; } else if (this->field_0xf > 7) { - this->flags |= 0x80; + COLLISION_ON(this); this->direction = gPlayerState.field_0xd; this->hVelocity = 0x1a000; this->speed = 0x78; @@ -1633,7 +1633,7 @@ void sub_08072B5C(Entity* this) { this->direction = this->animationState << 2; temp = sub_0807A2F8(1); if (!temp) { - this->flags |= 0x80; + COLLISION_ON(this); this->spritePriority.b0 = 4; this->speed = 0x40; this->hVelocity = 0x39000; @@ -1685,7 +1685,7 @@ void sub_08072C9C(Entity* this) { void sub_08072CC0(Entity* this) { this->subAction = 1; - this->flags &= ~0x80; + COLLISION_OFF(this); this->field_0xf = (gPlayerState.field_0x3a >> 2) + 1; this->direction = gPlayerState.field_0x39; this->speed = 0x400; @@ -1773,7 +1773,7 @@ NONMATCH("asm/non_matching/player/sub_08072D54.inc", void sub_08072D54(Entity* t this->actionDelay = bVar1; if (!sub_08003FC4(this, 0x2000)) { - this->flags |= 0x80; + COLLISION_ON(this); if (this->collisionLayer == 1) { sub_0800455E(this); } else { diff --git a/src/playerItem/playerItem10.c b/src/playerItem/playerItem10.c index 9ffc8e2c..bb4e5202 100644 --- a/src/playerItem/playerItem10.c +++ b/src/playerItem/playerItem10.c @@ -86,7 +86,7 @@ void sub_080ACC04(Entity* this) { this->flags2 = gPlayerEntity.flags2; this->direction = this->animationState << 2; this->speed = 0x200; - this->flags |= 0xa0; + this->flags |= ENT_COLLIDE | ENT_20; this->field_0x3c = 2; this->hitbox = (Hitbox*)gUnk_0812AAD8[this->type]; this->field_0x70.WORD = 0x10; diff --git a/src/playerItem/playerItem11.c b/src/playerItem/playerItem11.c index a2512e11..046a5ab0 100644 --- a/src/playerItem/playerItem11.c +++ b/src/playerItem/playerItem11.c @@ -33,16 +33,16 @@ void sub_08018CBC(Entity* this) { uVar2 = this->animationState = gPlayerEntity.animationState & 0xe; this->direction = (u8)(uVar2 << 2); this->speed = 0x400; - this->damageType = 0x96; + this->hitType = 0x96; this->field_0x3c = (gPlayerEntity.field_0x3c + 1) | 0x80; this->flags2 = gPlayerEntity.flags2; pEVar3 = this->attachedEntity; if (pEVar3 != NULL) { this->action = 1; - this->flags = this->flags & 0x7f; + COLLISION_OFF(this); this->actionDelay = 0x56; - this->field_0x40 = 0x1c; - this->field_0x44 = 6; + this->hurtType = 0x1c; + this->damage = 6; this->hitbox = &gUnk_080B3E18; this->attachedEntity->spriteOffsetX = 0; this->attachedEntity->spriteSettings.b.draw = 0; @@ -57,8 +57,8 @@ void sub_08018CBC(Entity* this) { this->spriteVramOffset = 0; this->type = gPlayerState.field_0x1d[0] - 1; this->actionDelay = gUnk_080B3DE0[this->type * 2]; - this->field_0x44 = gUnk_080B3DE0[this->type * 2 + 1]; - this->field_0x40 = 0x1b; + this->damage = gUnk_080B3DE0[this->type * 2 + 1]; + this->hurtType = 0x1b; this->hitbox = gUnk_080B3DE8[this->type]; (u32*)gPlayerEntity.field_0x70.WORD = this; sub_08078CD0(&gPlayerEntity); @@ -83,7 +83,7 @@ void sub_08018DE8(Entity* this) { break; case 5: this->attachedEntity->subAction = 4; - this->flags = this->flags | 0x80; + COLLISION_ON(this); this->action = 2; this->spritePriority.b0 = 2; this->attachedEntity->spriteSettings.b.draw = 1; diff --git a/src/playerItem/playerItem12.c b/src/playerItem/playerItem12.c index f75a8e4a..f29eb37c 100644 --- a/src/playerItem/playerItem12.c +++ b/src/playerItem/playerItem12.c @@ -33,7 +33,7 @@ ASM_FUNC("asm/non_matching/playerItem12/sub_080703BC.inc", void sub_080703BC(Ent void sub_08070458(Entity* this) { this->action = 2; - this->flags &= 0x7f; + COLLISION_OFF(this); this->speed = 0; if (this->field_0x7c.WORD != 0) { SetTile(this->field_0x7c.WORD, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); diff --git a/src/playerItem/playerItemBow.c b/src/playerItem/playerItemBow.c index 7f6aaf22..6c2b8206 100644 --- a/src/playerItem/playerItemBow.c +++ b/src/playerItem/playerItemBow.c @@ -33,7 +33,7 @@ void sub_08019444(Entity* this) { } void sub_08019468(Entity* this) { - if (this->field_0x40 == 0x0e) { + if (this->hurtType == 0x0e) { CreateFx(this, FX_REFLECT5, 0); } } diff --git a/src/playerItem/playerItemC.c b/src/playerItem/playerItemC.c index 8298a66a..2c2ed212 100644 --- a/src/playerItem/playerItemC.c +++ b/src/playerItem/playerItemC.c @@ -55,6 +55,6 @@ END_NONMATCH ASM_FUNC("asm/non_matching/playerItemC/sub_0801B938.inc", void sub_0801B938(Entity* this)) void sub_0801B9F0(Entity* this) { - this->flags &= 0x7f; + COLLISION_OFF(this); sub_08017744(this); } diff --git a/src/playerItem/playerItemLantern.c b/src/playerItem/playerItemLantern.c index e2f0587f..6741823f 100644 --- a/src/playerItem/playerItemLantern.c +++ b/src/playerItem/playerItemLantern.c @@ -18,7 +18,7 @@ NONMATCH("asm/non_matching/playerItemLantern/sub_08054A60.inc", void sub_08054A6 this->actionDelay = 0x04; this->frameIndex = -1; // TODO regalloc and mov 6 too early - this->scriptedScene = (this->scriptedScene & 0xf0) | 6; + this->updateConditions = (this->updateConditions & 0xf0) | 6; this->field_0x3c = 7; this->flags2 = -0x80; this->animationState = gPlayerEntity.animationState & 0xe; diff --git a/src/projectile/arrowProjectile.c b/src/projectile/arrowProjectile.c index fc6d3305..eb9296a4 100644 --- a/src/projectile/arrowProjectile.c +++ b/src/projectile/arrowProjectile.c @@ -45,7 +45,7 @@ void sub_080A9334(Entity* this) { void ArrowProjectile_Init(Entity* this) { this->action = 1; this->spriteSettings.b.draw = 1; - this->flags &= 0x7f; + COLLISION_OFF(this); this->actionDelay = 0x6a; this->field_0xf = 0; this->hVelocity = 0xa00; @@ -62,7 +62,7 @@ void ArrowProjectile_Action1(Entity* this) { } if (parent->field_0xf != 0) { this->action = 2; - this->flags = this->flags | 0x80; + COLLISION_ON(this); parent->attachedEntity = NULL; SoundReq(SFX_FC); } @@ -71,7 +71,7 @@ void ArrowProjectile_Action1(Entity* this) { void ArrowProjectile_Action2(Entity* this) { if (this->collisions != 0) { this->action = 3; - this->flags &= 0x7f; + COLLISION_OFF(this); this->actionDelay = 0x20; InitializeAnimation(this, this->animIndex + 2); EnqueueSFX(0x18a); @@ -104,7 +104,7 @@ void ArrowProjectile_Action4(Entity* this) { void sub_080A9488(Entity* this) { this->action = 4; - this->flags &= 0x7f; + COLLISION_OFF(this); this->actionDelay = 2; this->hVelocity = 0x18000; this->animationState = (this->knockbackDirection & 0x18) >> 3; diff --git a/src/projectile/boneProjectile.c b/src/projectile/boneProjectile.c index cfa5f3ed..29361923 100644 --- a/src/projectile/boneProjectile.c +++ b/src/projectile/boneProjectile.c @@ -57,7 +57,7 @@ void BoneProjectile_Action2(Entity* this) { sub_080AF090(this); if (sub_08003FC4(this, 0x1800) == 0) { this->action = 3; - this->flags = this->flags & 0x7f; + COLLISION_OFF(this); this->speed = 0xe0; this->hVelocity = 0xe000; } @@ -82,7 +82,7 @@ void BoneProjectile_Action4(Entity* this) { void sub_080A82D8(Entity* this) { this->action = 4; - this->flags &= 0x7f; + COLLISION_OFF(this); this->hVelocity = 0x10000; this->direction ^= 0x10; this->speed = 0x80; diff --git a/src/projectile/darkNutSwordSlash.c b/src/projectile/darkNutSwordSlash.c index 51123fc7..5875a9d6 100644 --- a/src/projectile/darkNutSwordSlash.c +++ b/src/projectile/darkNutSwordSlash.c @@ -2,7 +2,7 @@ #include "player.h" #include "coord.h" -extern const u8 DarkNutSwordSlash_DamageTypes[]; +extern const u8 DarkNutSwordSlash_hitTypes[]; extern void (*const DarkNutSwordSlash_UpdatesForType[])(Entity*); extern Hitbox const* const* const gUnk_081293E0[]; extern const Hitbox* const gUnk_081293F0[]; @@ -37,7 +37,7 @@ void DarkNutSwordSlash(Entity* this) { } void DarkNutSwordSlash_Init(Entity* this) { - this->damageType = DarkNutSwordSlash_DamageTypes[this->parent->type + this->type * 4]; + this->hitType = DarkNutSwordSlash_hitTypes[this->parent->type + this->type * 4]; } void DarkNutSwordSlash_OnTick(Entity* this) { @@ -67,7 +67,7 @@ void DarkNutSwordSlash_UpdateType1(Entity* this) { this->hitbox = (Hitbox*)gUnk_08129420[parent->animationState]; } -const u8 DarkNutSwordSlash_DamageTypes[] = { +const u8 DarkNutSwordSlash_hitTypes[] = { 76, 76, 78, 77, 83, 83, 83, 83, 79, 79, 76, 80, 84, 84, 84, 85, 79, 79, 76, 80, }; void (*const DarkNutSwordSlash_UpdatesForType[])(Entity*) = { diff --git a/src/projectile/dekuSeedProjectile.c b/src/projectile/dekuSeedProjectile.c index 40c51e69..63716065 100644 --- a/src/projectile/dekuSeedProjectile.c +++ b/src/projectile/dekuSeedProjectile.c @@ -25,7 +25,7 @@ void DekuSeedProjectile_OnTick(Entity* this) { void sub_080A8470(Entity* this) { if (this->bitfield == 0x80) { - if (this->damageType == 0x68) { + if (this->hitType == 0x68) { EnqueueSFX(SFX_86); } DeleteEntity(this); @@ -46,7 +46,7 @@ void DekuSeedProjectile_Init(Entity* this) { this->field_0xf = 0; this->height.HALF.HI -= 4; if (CheckGlobalFlag(TABIDACHI) == 0) { - this->damageType = 0x68; + this->hitType = 0x68; } EnqueueSFX(SFX_18D); InitializeAnimation(this, 0x18); @@ -75,12 +75,12 @@ void DekuSeedProjectile_Action1(Entity* this) { if ((parent->next != NULL) && (sub_080177A0(this, parent) != 0)) { this->iframes = 0x10; this->knockbackDirection = -this->direction; - this->bitfield = -0x80; + this->bitfield = 0x80; this->knockbackDuration = 0xc; this->field_0x46 = 0; parent->iframes = 0x10; parent->knockbackDirection = this->direction; - parent->bitfield = -0x3e; + parent->bitfield = 0xc2; parent->knockbackDuration = 0xc; parent->field_0x46 = 0; } @@ -95,7 +95,7 @@ void DekuSeedProjectile_Action2(Entity* this) { } if (--this->actionDelay == 0) { this->action = 1; - this->flags |= 0x80; + COLLISION_ON(this); } } else { sub_0800417E(this, (u32)this->collisions); @@ -120,19 +120,19 @@ void DekuSeedProjectile_Action4(Entity* this) { DeleteThisEntity(); return; case 1: - this->flags &= 0x7f; + COLLISION_OFF(this); this->speed = 0x120; break; } - if ((this->flags & 0x80) == 0) { + if ((this->flags & ENT_COLLIDE) == 0) { this->spriteSettings.b.draw ^= 1; } } void sub_080A8680(Entity* this) { this->action = 2; - this->flags &= 0x7f; + COLLISION_OFF(this); this->actionDelay = 3; this->field_0xf = 1; EnqueueSFX(SFX_ITEM_SHIELD_BOUNCE); @@ -140,7 +140,7 @@ void sub_080A8680(Entity* this) { void sub_080A86A0(Entity* this) { this->action = 3; - this->flags &= 0x7f; + COLLISION_OFF(this); this->speed = 0; EnqueueSFX(SFX_18E); } diff --git a/src/projectile/fireProjectile.c b/src/projectile/fireProjectile.c index 0e32bede..4419b527 100644 --- a/src/projectile/fireProjectile.c +++ b/src/projectile/fireProjectile.c @@ -61,7 +61,7 @@ void FireProjectile_Action2(Entity* this) { } } else { this->action = 3; - this->flags &= 0x7f; + COLLISION_OFF(this); this->speed = 0; } } diff --git a/src/projectile/gleerokProjectile.c b/src/projectile/gleerokProjectile.c index d48820b0..957667ea 100644 --- a/src/projectile/gleerokProjectile.c +++ b/src/projectile/gleerokProjectile.c @@ -25,7 +25,7 @@ void GleerokProjectile(Entity* this) { void GleerokProjectile_OnTick(Entity* this) { if (((this->type != 3) && ((this->bitfield & 0x80) != 0)) && ((this->bitfield & 0x7f) != 0x1e)) { this->action = 3; - this->flags &= 0x7f; + COLLISION_OFF(this); InitializeAnimation(this, 0x53); } GleerokProjectile_Actions[this->action](this); @@ -118,7 +118,7 @@ void GleerokProjectile_Action2(Entity* this) { GetNextFrame(this); if (this->type == 2) { if (--this->actionDelay == 0xff) { - this->flags &= 0x7f; + COLLISION_OFF(this); this->action = 3; InitializeAnimation(this, 0x55); } else { @@ -128,7 +128,7 @@ void GleerokProjectile_Action2(Entity* this) { } else { if ((this->frames.all & 0x80) != 0) { this->action = 3; - this->flags &= 0x7f; + COLLISION_OFF(this); InitializeAnimation(this, 0x53); } } diff --git a/src/projectile/gyorgMaleEnergyProjectile.c b/src/projectile/gyorgMaleEnergyProjectile.c index 56ff4307..33b34439 100644 --- a/src/projectile/gyorgMaleEnergyProjectile.c +++ b/src/projectile/gyorgMaleEnergyProjectile.c @@ -43,7 +43,7 @@ void GyorgMaleEnergyProjectile_Action1(Entity* this) { GetNextFrame(this); if (--this->actionDelay == 0) { this->action = 2; - this->flags |= 0x80; + COLLISION_ON(this); this->direction = GetFacingDirection(this, &gPlayerEntity); SoundReq(SFX_12E); } @@ -57,7 +57,7 @@ void GyorgMaleEnergyProjectile_Action2(Entity* this) { } if (--this->actionDelay == 0) { this->action = 3; - this->flags &= 0x7f; + COLLISION_OFF(this); this->speed = this->speed >> 1; InitializeAnimation(this, 1); } diff --git a/src/projectile/gyorgTail.c b/src/projectile/gyorgTail.c index d75a8123..acf81cc7 100644 --- a/src/projectile/gyorgTail.c +++ b/src/projectile/gyorgTail.c @@ -40,9 +40,9 @@ void GyorgTail(Entity* this) { this->spritePriority.b0 = parent->spritePriority.b0 - 2; if ((parent->spriteRendering.b3 == 3) && (parent->field_0x7c.BYTES.byte0 == 0)) { - this->flags &= 0x7f; + COLLISION_OFF(this); } else { - this->flags |= 0x80; + COLLISION_ON(this); } } } @@ -68,17 +68,17 @@ void sub_080AC480(Entity* this) { if (this->actionDelay != 0) { if (this->parent->currentHealth == 0) { this->action = 1; - this->damageType = 0x1d; + this->hitType = 0x1d; } else { if (--this->actionDelay == 0) { - this->damageType = 0x1c; + this->hitType = 0x1c; SoundReq(SFX_116); } } } else { if (--this->field_0xf == 0) { this->action = 1; - this->damageType = 0x1d; + this->hitType = 0x1d; } this->field_0x7c.HALF_U.LO += ((s16)this->field_0x7a.HWORD >= 1) ? 0x300 : -0x300; this->direction = this->field_0x7c.HALF.LO >> 8; diff --git a/src/projectile/iceProjectile.c b/src/projectile/iceProjectile.c index 0cd93e21..96e83a42 100644 --- a/src/projectile/iceProjectile.c +++ b/src/projectile/iceProjectile.c @@ -63,7 +63,7 @@ void IceProjectile_Action2(Entity* this) { } } else { this->action = 3; - this->flags &= 0x7f; + COLLISION_OFF(this); this->speed = 0; } } diff --git a/src/projectile/lakituCloudProjectile.c b/src/projectile/lakituCloudProjectile.c index 25599826..1971177d 100644 --- a/src/projectile/lakituCloudProjectile.c +++ b/src/projectile/lakituCloudProjectile.c @@ -42,7 +42,7 @@ void LakituCloudProjectile_SubAction1(Entity* this) { void LakituCloudProjectile_SubAction2(Entity* this) { if (sub_0806F3E4(this) != 0) { - if (this->damageType == 0xa6) { + if (this->hitType == 0xa6) { ModHealth(-2); sub_0800449C(&gPlayerEntity, 0x7a); sub_08079D84(); diff --git a/src/projectile/mandiblesProjectile.c b/src/projectile/mandiblesProjectile.c index 1bcfd7cf..1095b9a4 100644 --- a/src/projectile/mandiblesProjectile.c +++ b/src/projectile/mandiblesProjectile.c @@ -31,8 +31,8 @@ void MandiblesProjectile(Entity* this) { if (entity == NULL) { entity = this->parent; } - if ((entity->field_0x43 == 0) && ((this->flags & 0x80) == 0)) { - this->flags |= 0x80; + if ((entity->field_0x43 == 0) && ((this->flags & ENT_COLLIDE) == 0)) { + COLLISION_ON(this); } MandiblesProjectile_Functions[GetNextFunction(this)](this); } @@ -223,12 +223,12 @@ void sub_080AA1D8(Entity* this) { PositionRelative(parent, this, tmp[0] << 0x10, tmp[1] << 0x10); } if (parent->field_0x43 != 0) { - if ((this->flags & 0x80) != 0) { - this->flags &= 0x7f; + if ((this->flags & ENT_COLLIDE) != 0) { + COLLISION_OFF(this); } } else { - if ((this->flags & 0x80) == 0) { - this->flags |= 0x80; + if ((this->flags & ENT_COLLIDE) == 0) { + COLLISION_ON(this); } } } diff --git a/src/projectile/mazaalEnergyBeam.c b/src/projectile/mazaalEnergyBeam.c index 4fe557b0..20b73213 100644 --- a/src/projectile/mazaalEnergyBeam.c +++ b/src/projectile/mazaalEnergyBeam.c @@ -22,7 +22,7 @@ void MazaalEnergyBeam_Action1(Entity* this) { if (--this->actionDelay == 0) { this->action = 2; - this->flags &= 0x7f; + COLLISION_OFF(this); this->spritePriority.b0 = 7; this->y.HALF.HI += 6; InitializeAnimation(this, 1); diff --git a/src/projectile/moblinSpear.c b/src/projectile/moblinSpear.c index c24e3480..e4870a1f 100644 --- a/src/projectile/moblinSpear.c +++ b/src/projectile/moblinSpear.c @@ -73,12 +73,12 @@ NONMATCH("asm/non_matching/moblinSpear/MoblinSpear_Action1.inc", void MoblinSpea this->hitbox->width = a->width; this->hitbox->height = a->height; if (parent->field_0x43 != 0) { - if ((this->flags & 0x80) != 0) { - this->flags &= 0x7f; + if ((this->flags & ENT_COLLIDE) != 0) { + COLLISION_OFF(this); } } else { - if ((this->flags & 0x80) == 0) { - this->flags |= 0x80; + if ((this->flags & ENT_COLLIDE) == 0) { + COLLISION_ON(this); } } } diff --git a/src/projectile/octorokBossProjectile.c b/src/projectile/octorokBossProjectile.c index 5b1f8e44..63bd13ae 100644 --- a/src/projectile/octorokBossProjectile.c +++ b/src/projectile/octorokBossProjectile.c @@ -89,7 +89,7 @@ void OctorokBossProjectile_Action1(Entity* this) { this->speed = 0x400; this->type2 = 1; this->actionDelay = 0; - this->flags &= 0x7f; + COLLISION_OFF(this); } if (sub_0806FC80(this, this->parent, 0x40) != 0) { if (this->type2 == 0) { diff --git a/src/projectile/rockProjectile.c b/src/projectile/rockProjectile.c index 72d34a73..0f02c6fe 100644 --- a/src/projectile/rockProjectile.c +++ b/src/projectile/rockProjectile.c @@ -69,7 +69,7 @@ void RockProjectile_Action3(Entity* this) { DeleteEntity(this); return; case 1: - this->flags &= 0x7f; + COLLISION_OFF(this); this->speed = 0x120; if (sub_0800442E(this) != 0) { return; @@ -77,14 +77,14 @@ void RockProjectile_Action3(Entity* this) { break; } - if ((this->flags & 0x80) == 0) { + if ((this->flags & ENT_COLLIDE) == 0) { this->spriteSettings.b.draw ^= 1; } } void sub_080A8178(Entity* this) { this->action = 2; - this->flags &= 0x7f; + COLLISION_OFF(this); this->speed = 0x40; this->hVelocity = 0x14000; } diff --git a/src/projectile/spiderWeb.c b/src/projectile/spiderWeb.c index 68d6e868..d3ec343a 100644 --- a/src/projectile/spiderWeb.c +++ b/src/projectile/spiderWeb.c @@ -37,7 +37,7 @@ void sub_080AA6C0(Entity* this) { if (this->bitfield == 0x87) { this->action = 3; this->actionDelay = 0x5a; - this->flags &= 0x7f; + COLLISION_OFF(this); InitAnimationForceUpdate(this, this->type + 0x10); object = CreateObject(OBJECT_2A, 3, 0); if (object != NULL) { diff --git a/src/projectile/stalfosProjectile.c b/src/projectile/stalfosProjectile.c index fb75691e..39c58075 100644 --- a/src/projectile/stalfosProjectile.c +++ b/src/projectile/stalfosProjectile.c @@ -32,7 +32,7 @@ void StalfosProjectile_OnTick(Entity* this) { void sub_080A9A34(Entity* this) { if (this->bitfield == 0x9d) { this->action = 3; - this->flags &= 0x7f; + COLLISION_OFF(this); this->hVelocity = 0x2a000; this->spritePriority.b1 = 1; } @@ -59,7 +59,7 @@ void StalfosProjectile_SubAction2(Entity* this) { } void StalfosProjectile_SubAction3(Entity* this) { - this->flags &= 0x7f; + COLLISION_OFF(this); } void StalfosProjectile_SubAction4(Entity* this) { @@ -73,7 +73,7 @@ void StalfosProjectile_Init(Entity* this) { switch (this->type2) { case 1: this->action = 2; - this->flags |= 0x80; + COLLISION_ON(this); break; case 2: this->action = 3; diff --git a/src/projectile/v1DarkMagicProjectile.c b/src/projectile/v1DarkMagicProjectile.c index dc9c97c3..4568d0bc 100644 --- a/src/projectile/v1DarkMagicProjectile.c +++ b/src/projectile/v1DarkMagicProjectile.c @@ -31,7 +31,7 @@ void sub_080AAC44(Entity* this) { if (this->type2 == 0) { if ((this->bitfield & 0x3f) == 0) { this->action = 2; - this->flags &= 0x7f; + COLLISION_OFF(this); if (this->type == 0) { ResolveEntityOnTop(&gPlayerEntity, this); } else { @@ -83,7 +83,7 @@ void V1DarkMagicProjectile_Init(Entity* this) { this->action = 1; } else { this->action = 3; - this->damageType = 0x2c; + this->hitType = 0x2c; ResolveEntityOnTop(this->parent, this); } if (this->type == 0) { @@ -107,7 +107,7 @@ void V1DarkMagicProjectile_Init(Entity* this) { } } else { ResolveEntityOnTop(this->parent, this); - this->flags &= 0x7f; + COLLISION_OFF(this); CopyPosition(this->parent, this); } InitializeAnimation(this, this->type); @@ -154,12 +154,12 @@ void V1DarkMagicProjectile_Action3(Entity* this) { } #ifndef EU if (this->parent->action == 2) { - if ((this->flags & 0x80) != 0) { - this->flags &= 0x7f; + if ((this->flags & ENT_COLLIDE) != 0) { + COLLISION_OFF(this); } } else { - if ((this->flags & 0x80) == 0) { - this->flags |= 0x80; + if ((this->flags & ENT_COLLIDE) == 0) { + COLLISION_ON(this); } } #endif diff --git a/src/projectile/v1EyeLaser.c b/src/projectile/v1EyeLaser.c index 2af3ae08..38be21bc 100644 --- a/src/projectile/v1EyeLaser.c +++ b/src/projectile/v1EyeLaser.c @@ -20,7 +20,7 @@ void V1EyeLaser_Init(Entity* this) { *(u32*)&this->field_0x74 = this->parent->x.WORD; if (this->type == 0) { this->action = 1; - this->flags &= 0x7f; + COLLISION_OFF(this); this->hitbox = (Hitbox*)&gUnk_0812A614; InitializeAnimation(this, 0); } else { diff --git a/src/projectile/v1FireProjectile.c b/src/projectile/v1FireProjectile.c index 00dff22b..c627ee36 100644 --- a/src/projectile/v1FireProjectile.c +++ b/src/projectile/v1FireProjectile.c @@ -26,7 +26,7 @@ void V1FireProjectile_OnTick(Entity* this) { void sub_080AB2DC(Entity* this) { if ((this->bitfield & 0x80) != 0) { this->action = 3; - this->flags &= 0x7f; + COLLISION_OFF(this); InitializeAnimation(this, 0x53); if ((this->bitfield & 0x7f) == 0) { ModHealth(-4); @@ -92,7 +92,7 @@ void V1FireProjectile_Action2(Entity* this) { GetNextFrame(this); if ((this->frames.all & 0x80) != 0) { this->action = 3; - this->flags &= 0x7f; + COLLISION_OFF(this); InitializeAnimation(this, 0x53); } } diff --git a/src/projectile/windProjectile.c b/src/projectile/windProjectile.c index 92308f75..d607486a 100644 --- a/src/projectile/windProjectile.c +++ b/src/projectile/windProjectile.c @@ -67,7 +67,7 @@ void WindProjectile_Action2(Entity* this) { } } else { this->action = 3; - this->flags &= 0x7f; + COLLISION_OFF(this); this->speed = 0; } } diff --git a/src/script.c b/src/script.c index e38dee61..c38343ae 100644 --- a/src/script.c +++ b/src/script.c @@ -347,14 +347,14 @@ ScriptExecutionContext* StartCutscene(Entity* entity, u16* script) { } void InitScriptForEntity(Entity* entity, ScriptExecutionContext* context, u16* script) { - entity->flags = entity->flags | 2; + entity->flags |= ENT_SCRIPTED; *(ScriptExecutionContext**)&entity->cutsceneBeh = context; InitScriptExecutionContext(context, script); } void UnloadCutsceneData(Entity* entity) { - if ((entity->flags & 2)) { - entity->flags = entity->flags & 0xfd; + if (entity->flags & ENT_SCRIPTED) { + entity->flags &= ~ENT_SCRIPTED; DestroyScriptExecutionContext(*(ScriptExecutionContext**)&entity->cutsceneBeh); *(ScriptExecutionContext**)&entity->cutsceneBeh = NULL; } From fddb4abd534ef1ef623cb044bc97c45713fbcfd1 Mon Sep 17 00:00:00 2001 From: theo3 Date: Thu, 11 Nov 2021 21:18:48 -0800 Subject: [PATCH 3/6] move entity update functions --- Makefile | 11 ++- data/data_080B3740.s | 28 ------- include/entity.h | 36 +++++---- include/gba/m4a.h | 2 + include/screen.h | 36 ++++----- linker.ld | 6 ++ src/collision.c | 95 ++++++++++++++++------- src/debugScreen.c | 22 +++--- src/demoScreen.c | 12 +-- src/enemy/waterDrop.c | 8 +- src/fade.c | 6 +- src/fileScreen.c | 28 +++---- src/game.c | 2 +- src/interrupts.c | 162 ++++------------------------------------ src/intro.c | 24 +++--- src/manager.c | 5 ++ src/manager/manager1.c | 4 +- src/manager/manager10.c | 6 +- src/manager/manager15.c | 28 +++---- src/manager/manager18.c | 10 +-- src/manager/manager19.c | 10 +-- src/manager/manager1A.c | 10 +-- src/manager/manager1B.c | 14 ++-- src/manager/manager1D.c | 14 ++-- src/manager/manager2.c | 48 ++++++------ src/manager/manager2F.c | 10 +-- src/manager/manager32.c | 8 +- src/manager/manager39.c | 4 +- src/manager/manager8.c | 40 +++++----- src/manager/manager9.c | 14 ++-- src/manager/managerC.c | 8 +- src/npc.c | 34 +++++++++ src/npc/bigGoron.c | 6 +- src/npc/phonograph.c | 2 +- src/object.c | 15 ++++ src/playerItem.c | 65 +++++++++++++++- src/sub_080A3B84.c | 12 +-- 37 files changed, 430 insertions(+), 415 deletions(-) diff --git a/Makefile b/Makefile index c2f9fd4f..c7e9c767 100644 --- a/Makefile +++ b/Makefile @@ -110,9 +110,14 @@ else NODEP := 1 endif -#$(C_BUILDDIR)/need_interworking_file_name.o: CFLAGS += -mthumb-interwork -$(C_BUILDDIR)/interrupts.o: CFLAGS += -mthumb-interwork -$(C_BUILDDIR)/collision.o: CFLAGS += -mthumb-interwork +interwork := $(C_BUILDDIR)/interrupts.o \ +$(C_BUILDDIR)/collision.o \ +$(C_BUILDDIR)/playerItem.o \ +$(C_BUILDDIR)/object.o \ +$(C_BUILDDIR)/manager.o \ +$(C_BUILDDIR)/npc.o + +$(interwork): CFLAGS += -mthumb-interwork $(C_BUILDDIR)/gba/m4a.o: CFLAGS = -O2 -mthumb-interwork -Wimplicit -Wparentheses -Werror -Wno-multichar $(C_BUILDDIR)/eeprom.o: CFLAGS = -O1 -mthumb-interwork -Wimplicit -Wparentheses -Werror -Wno-multichar diff --git a/data/data_080B3740.s b/data/data_080B3740.s index 7eadfad5..02a11b4e 100644 --- a/data/data_080B3740.s +++ b/data/data_080B3740.s @@ -4,34 +4,6 @@ .section .rodata .align 2 -gUnk_080B3740:: @ 080B3740 - .incbin "baserom.gba", 0x0B3740, 0x0000004 - -gUnk_080B3744:: @ 080B3744 - .4byte sub_08018308 - .4byte CollisionNoOp - .4byte CollisionNoOp - .4byte CollisionGroundItem - .4byte sub_08017B58 - .4byte sub_08017EB0 - .4byte sub_08017F3C - .4byte sub_08017F40 - .4byte sub_0801802C - .4byte sub_08017DD4 - .4byte sub_080180E8 - .4byte sub_08017BBC - .4byte sub_08017C40 - .4byte sub_08017D6C - .4byte sub_08017D28 - .4byte sub_08018168 - .4byte sub_08018228 - .4byte sub_08018250 - .4byte sub_08018288 - .4byte sub_080182A8 - .4byte sub_08017B1C - .4byte sub_08017CBC - .4byte sub_08017E88 - gUnk_080B37A0:: @ 080B37A0 .ifdef EU @ TODO only small differences diff --git a/include/entity.h b/include/entity.h index b6793df1..96735a0d 100644 --- a/include/entity.h +++ b/include/entity.h @@ -209,23 +209,29 @@ enum { #define Direction8FromAnimationState(expr) (((expr) << 2) Entity* GetEmptyEntity(void); -extern Entity* CreateEnemy(u32 id, u32 type); -extern Entity* CreateNPC(u32 id, u32 type, u32 type2); -extern Entity* CreateObject(u32 id, u32 type, u32 type2); -extern Entity* CreateObjectWithParent(Entity* parent, u32 id, u32 type, u32 type2); -extern Entity* CreateFx(Entity* parent, u32 type, u32 type2); +void DrawEntity(Entity*); +Entity* CreateEnemy(u32 id, u32 type); +Entity* CreateNPC(u32 id, u32 type, u32 type2); +Entity* CreateObject(u32 id, u32 type, u32 type2); +Entity* CreateObjectWithParent(Entity* parent, u32 id, u32 type, u32 type2); +Entity* CreateFx(Entity* parent, u32 type, u32 type2); -extern void InitializeAnimation(Entity*, u32); -extern void InitAnimationForceUpdate(Entity*, u32); -extern void UpdateAnimationSingleFrame(Entity*); -extern void UpdateSpriteForCollisionLayer(Entity*); -extern void GetNextFrame(Entity*); -extern u32 LoadExtraSpriteData(Entity*, SpriteLoadData*); -extern void SetExtraSpriteFrame(Entity*, u32, u32); -extern void SetSpriteSubEntryOffsetData1(Entity*, u32, u32); -extern void SetSpriteSubEntryOffsetData2(Entity*, u32, u32); +void InitializeAnimation(Entity*, u32); +void InitAnimationForceUpdate(Entity*, u32); +void UpdateAnimationSingleFrame(Entity*); +void UpdateSpriteForCollisionLayer(Entity*); +void GetNextFrame(Entity*); +u32 LoadExtraSpriteData(Entity*, SpriteLoadData*); +void SetExtraSpriteFrame(Entity*, u32, u32); +void SetSpriteSubEntryOffsetData1(Entity*, u32, u32); +void SetSpriteSubEntryOffsetData2(Entity*, u32, u32); -extern u32 GetFacingDirection(Entity*, Entity*); +u32 GetFacingDirection(Entity*, Entity*); + +/** + * @brief Check if entity should sleep this frame. + */ +bool32 CheckDontUpdate(Entity* this); /** * @brief Delete the entity currently in execution. diff --git a/include/gba/m4a.h b/include/gba/m4a.h index 0dcbd822..7b6a345e 100644 --- a/include/gba/m4a.h +++ b/include/gba/m4a.h @@ -173,6 +173,8 @@ typedef struct MusicPlayer { extern const MusicPlayer gMusicPlayers[]; extern const Song gSongTable[]; +void m4aSoundMain(void); +void m4aSoundVSync(void); void m4aSoundInit(void); void m4aSongNumStart(u16 n); void m4aSongNumStartOrContinue(u16 n); diff --git a/include/screen.h b/include/screen.h index e6462de1..12c30c57 100644 --- a/include/screen.h +++ b/include/screen.h @@ -11,29 +11,19 @@ typedef struct { } LcdControls; typedef struct { - u16 bg0Control; - u16 bg0xOffset; - u16 bg0yOffset; - u16 bg0Updated; - void* bg0Tilemap; - u16 bg1Control; - u16 bg1xOffset; - u16 bg1yOffset; - u16 bg1Updated; - void* bg1Tilemap; + u16 control; + u16 xOffset; + u16 yOffset; + u16 updated; + void* tilemap; } BgSettings; typedef struct { - u16 bg2Control; - u16 bg2xOffset; - u16 bg2yOffset; - u16 bg2Updated; - void* bg2Tilemap; - u16 bg3Control; - s16 bg3xOffset; - s16 bg3yOffset; - u16 bg3Updated; - void* bg3Tilemap; + u16 control; + s16 xOffset; + s16 yOffset; + u16 updated; + void* tilemap; } BgAffSettings; typedef struct { @@ -67,8 +57,10 @@ typedef struct { typedef struct { /*0x00*/ LcdControls lcd; - /*0x08*/ BgSettings bg; - /*0x20*/ BgAffSettings affine; + /*0x08*/ BgSettings bg0; + /*0x14*/ BgSettings bg1; + /*0x20*/ BgAffSettings bg2; + /*0x2c*/ BgAffSettings bg3; /*0x38*/ BgControls controls; /*0x6c*/ u8 _6c; /*0x6d*/ u8 _6d; diff --git a/linker.ld b/linker.ld index 284ad05c..03bde6bf 100644 --- a/linker.ld +++ b/linker.ld @@ -332,6 +332,10 @@ SECTIONS { /* C source compiled with interworking */ src/interrupts.o(.text); + src/playerItem.o(.text); + src/object.o(.text); + src/manager.o(.text); + src/npc.o(.text); src/collision.o(.text); /* C source compiled without interworking */ asm/code_08018500.o(.text); @@ -972,10 +976,12 @@ SECTIONS { asm/intr.o(.text); /* data */ data/data_080B2A70.o(.rodata); + src/interrupts.o(.rodata); src/playerItem.o(.rodata); src/object.o(.rodata); src/manager.o(.rodata); src/npc.o(.rodata); + src/collision.o(.rodata); data/data_080B3740.o(.rodata); data/const/playerItem/playerItem11.o(.rodata); data/const/playerItem/playerItemBow.o(.rodata); diff --git a/src/collision.c b/src/collision.c index 9c0309c7..3a023bda 100644 --- a/src/collision.c +++ b/src/collision.c @@ -274,7 +274,7 @@ void sub_08017940(Entity* org, Entity* tgt) { r1 = 0; r1 = (u32)(org == &gPlayerEntity ? gPlayerEntity.knockbackDuration - : (tgt == &gPlayerEntity ? tgt->knockbackDuration : 0)) >> + : (tgt == &gPlayerEntity ? tgt->knockbackDuration : 0)) >> 3; // Anything requiring the evaluation of r1 could be written here. @@ -284,7 +284,7 @@ void sub_08017940(Entity* org, Entity* tgt) { } void sub_080179EC(Entity* a1, Entity* a2) { - u8* p = gUnk_080B3740; + const u8* p = (const u8[]){ FX_27, FX_32, FX_33, FX_34 }; u32 rand = Random(); Entity* e = CreateFx(a2, p[rand & 3], 0); if (e != NULL) { @@ -310,13 +310,44 @@ Entity* sub_08017A90(Entity* a1, Entity* parent) { return NULL; } -u32 CollisionNoOp(Entity* org, Entity* tgt, u32 direction) { +typedef s32 (*CollisionHandler)(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 CollisionNoOp(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 CollisionGroundItem(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08017B58(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08017EB0(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08017F3C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_0801802C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08017DD4(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_080180E8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08017BBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08017C40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08017D6C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08017D28(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08018228(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08018250(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08018288(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_080182A8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08017B1C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08017CBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); +s32 sub_08017E88(Entity* org, Entity* tgt, u32 direction, ColSettings* settings); + +const CollisionHandler gUnk_080B3744[] = { + sub_08018308, CollisionNoOp, CollisionNoOp, CollisionGroundItem, sub_08017B58, sub_08017EB0, + sub_08017F3C, sub_08017F40, sub_0801802C, sub_08017DD4, sub_080180E8, sub_08017BBC, + sub_08017C40, sub_08017D6C, sub_08017D28, sub_08018168, sub_08018228, sub_08018250, + sub_08018288, sub_080182A8, sub_08017B1C, sub_08017CBC, sub_08017E88, +}; + +s32 CollisionNoOp(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { return 0; } // origin: player or sword // target: item -s32 CollisionGroundItem(Entity* org, Entity* tgt, u32 direction) { +s32 CollisionGroundItem(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { COLLISION_OFF(tgt); tgt->bitfield = org->hurtType | 0x80; if ((tgt->type == 0x5F || tgt->type == 0x60) && sub_08081420(tgt)) @@ -324,7 +355,7 @@ s32 CollisionGroundItem(Entity* org, Entity* tgt, u32 direction) { return 2; } -s32 sub_08017B1C(Entity* org, Entity* tgt, u32 direction) { +s32 sub_08017B1C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if ((gPlayerState.field_0x1d[1] & 0x60) != 0) { COLLISION_OFF(tgt); } else { @@ -335,7 +366,7 @@ s32 sub_08017B1C(Entity* org, Entity* tgt, u32 direction) { return 1; } -s32 sub_08017B58(Entity* org, Entity* tgt, u32 direction) { +s32 sub_08017B58(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if ((tgt->field_0x3a & 4) != 0) { if (tgt->field_0x1d) { s32 x = tgt->field_0x1d = tgt->field_0x1d - gPlayerState.field_0x1d[0]; @@ -354,7 +385,7 @@ s32 sub_08017B58(Entity* org, Entity* tgt, u32 direction) { return 1; } -s32 sub_08017BBC(Entity* org, Entity* tgt, u32 direction) { +s32 sub_08017BBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if ((gPlayerState.flags & (0x1 | 0x80 | 0x400 | 0x1000)) == 0) { Entity* e = CreateObject(66, 1, 0); if (e != NULL) { @@ -373,7 +404,7 @@ s32 sub_08017BBC(Entity* org, Entity* tgt, u32 direction) { return 1; } -s32 sub_08017C40(Entity* org, Entity* tgt, u32 direction) { +s32 sub_08017C40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if ((gPlayerState.flags & (0x1 | 0x80 | 0x800 | 0x1000)) == 0 && gPlayerState.playerAction == 0) { if (org->action == 1 || org->action == 24) { tgt->damage = 4; @@ -390,7 +421,8 @@ s32 sub_08017C40(Entity* org, Entity* tgt, u32 direction) { return 1; } -NONMATCH("asm/non_matching/collision/sub_08017CBC.inc", s32 sub_08017CBC(Entity* org, Entity* tgt, u32 direction)) { +NONMATCH("asm/non_matching/collision/sub_08017CBC.inc", + s32 sub_08017CBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)) { if (((-(((direction ^ 0x10) - 0xc) & 0x1f) + tgt->direction) & 0x1f) < 0x19) { org->iframes = -12; tgt->iframes = -12; @@ -407,7 +439,7 @@ NONMATCH("asm/non_matching/collision/sub_08017CBC.inc", s32 sub_08017CBC(Entity* } END_NONMATCH -s32 sub_08017D28(Entity* org, Entity* tgt, u32 direction) { +s32 sub_08017D28(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { gPlayerState.field_0x1a[0] = 1; org->field_0x7a.HWORD = 600; org->knockbackDuration = 12; @@ -418,7 +450,7 @@ s32 sub_08017D28(Entity* org, Entity* tgt, u32 direction) { return 1; } -s32 sub_08017D6C(Entity* org, Entity* tgt, u32 direction) { +s32 sub_08017D6C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { u32 x; u32 y; ColSettings* p; @@ -436,7 +468,7 @@ s32 sub_08017D6C(Entity* org, Entity* tgt, u32 direction) { return sub_08018308(org, tgt, direction, p); } -int sub_08017DD4(Entity* org, Entity* tgt, u32 direction) { +int sub_08017DD4(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { org->bitfield = 0; if (tgt->damage & 0x80) tgt->damage &= ~0x80; @@ -459,7 +491,7 @@ int sub_08017DD4(Entity* org, Entity* tgt, u32 direction) { return 1; } -s32 sub_08017E88(Entity* org, Entity* tgt, u32 direction) { +s32 sub_08017E88(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { org->knockbackDuration = 2; org->field_0x46 = 640; if (tgt->iframes == 0) @@ -467,7 +499,7 @@ s32 sub_08017E88(Entity* org, Entity* tgt, u32 direction) { return 1; } -s32 sub_08017EB0(Entity* org, Entity* tgt, u32 direction) { +s32 sub_08017EB0(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if (tgt->damage == 0) return 0; if (org == &gPlayerEntity) { @@ -489,14 +521,20 @@ s32 sub_08017EB0(Entity* org, Entity* tgt, u32 direction) { return 1; } -s32 sub_08017F3C(Entity* org, Entity* tgt, u32 direction) { +s32 sub_08017F3C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { return 1; } -s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction) { +s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if (tgt->field_0x43 == 0) { if (org == &gPlayerEntity) { - if (sub_08079F8C() && (gPlayerState.flags & 0x80) == 0 && !gPlayerState.swimState) { + if (sub_08079F8C() && +#ifdef EU + (gPlayerState.flags & 0x81) == 0 && +#else + (gPlayerState.flags & 0x80) == 0 && +#endif + !gPlayerState.swimState) { gPlayerState.field_0x1a[0] |= 0x80u; gPlayerState.field_0xa |= 0x80u; gPlayerState.flags |= 0x10u; @@ -525,7 +563,8 @@ s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction) { } // inverted branch -NONMATCH("asm/non_matching/collision/sub_0801802C.inc", s32 sub_0801802C(Entity* org, Entity* tgt, u32 direction)) { +NONMATCH("asm/non_matching/collision/sub_0801802C.inc", + s32 sub_0801802C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)) { int kind; ColSettings* p; u32 x; @@ -558,7 +597,7 @@ void sub_080180BC(Entity* org, Entity* tgt) { tgt->subAction = -1; } -s32 sub_080180E8(Entity* org, Entity* tgt, u32 direction) { +s32 sub_080180E8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { u32 v3; u32 x; @@ -577,10 +616,16 @@ s32 sub_080180E8(Entity* org, Entity* tgt, u32 direction) { return sub_08018308(org, tgt, v3, &gCollisionMtx[org->hurtType + x]); } -s32 sub_08018168(Entity* org, Entity* tgt, u32 direction) { +s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if (tgt->field_0x43 == 0) { if (org == &gPlayerEntity) { - if (((sub_08079F8C() != 0) && ((gPlayerState.flags & 0x40080) == 0)) && (gPlayerState.swimState == 0)) { + if (((sub_08079F8C() != 0) && +#ifdef EU + ((gPlayerState.flags & 0x81) == 0)) && +#else + ((gPlayerState.flags & 0x40080) == 0)) && +#endif + (gPlayerState.swimState == 0)) { gPlayerState.field_0x1a[0] |= 0x80; gPlayerState.field_0xa |= 0x80; gPlayerState.flags |= 0x100; @@ -602,13 +647,13 @@ s32 sub_08018168(Entity* org, Entity* tgt, u32 direction) { return 0; } -s32 sub_08018228(Entity* org, Entity* tgt, u32 direction) { +s32 sub_08018228(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if (org == &gPlayerEntity && sub_08079F8C()) sub_08004484(tgt, org); return 0; } -s32 sub_08018250(Entity* org, Entity* tgt, u32 direction) { +s32 sub_08018250(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { org->iframes = -1; if (org->direction == 0) { tgt->iframes = 16; @@ -619,7 +664,7 @@ s32 sub_08018250(Entity* org, Entity* tgt, u32 direction) { return 1; } -s32 sub_08018288(Entity* org, Entity* tgt, u32 direction) { +s32 sub_08018288(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if (org == &gPlayerEntity) sub_0807AFE8(); else @@ -627,7 +672,7 @@ s32 sub_08018288(Entity* org, Entity* tgt, u32 direction) { return 1; } -s32 sub_080182A8(Entity* org, Entity* tgt, u32 direction) { +s32 sub_080182A8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if (tgt->field_0x43 == 0) { if (org->iframes == 0) org->iframes = -1; diff --git a/src/debugScreen.c b/src/debugScreen.c index 9e290ae2..c34abe12 100644 --- a/src/debugScreen.c +++ b/src/debugScreen.c @@ -18,12 +18,12 @@ void sub_0805FA04(void) { MemClear(&gBG0Buffer, sizeof(gBG0Buffer)); MemClear(&gBG3Buffer, sizeof(gBG3Buffer)); gScreen.lcd.displayControl = 0x940; - gScreen.bg.bg0xOffset = 0; - gScreen.bg.bg0yOffset = 0; - gScreen.affine.bg3xOffset = 0; - gScreen.affine.bg3yOffset = 0; - gScreen.affine.bg3Control = 0x1e0f; - gScreen.affine.bg3Updated = 1; + gScreen.bg0.xOffset = 0; + gScreen.bg0.yOffset = 0; + gScreen.bg3.xOffset = 0; + gScreen.bg3.yOffset = 0; + gScreen.bg3.control = 0x1e0f; + gScreen.bg3.updated = 1; MessageInitialize(); MemClear((void*)&gUnk_02032EC0, sizeof(UI)); MemClear((void*)&gMenu, sizeof(Menu)); @@ -48,11 +48,11 @@ void sub_0805FA98(void) { case 0x200: gMenu.focusCoords[0] ^= 1; if (gMenu.focusCoords[0] == 0) { - gScreen.bg.bg0Control = 0x1f0c; - gScreen.affine.bg3Control = 0x1e0f; + gScreen.bg0.control = 0x1f0c; + gScreen.bg3.control = 0x1e0f; } else { - gScreen.bg.bg0Control = 0x1f0f; - gScreen.affine.bg3Control = 0x1e0c; + gScreen.bg0.control = 0x1f0f; + gScreen.bg3.control = 0x1e0c; } break; case 0x100: @@ -87,7 +87,7 @@ void sub_0805FA98(void) { } } gMenu.focusCoords[1] = (gMenu.focusCoords[1] + 3) % 3; - gScreen.affine.bg3Updated = 1; + gScreen.bg3.updated = 1; } void sub_0805FBC4() { diff --git a/src/demoScreen.c b/src/demoScreen.c index 50ded088..b2620204 100644 --- a/src/demoScreen.c +++ b/src/demoScreen.c @@ -49,12 +49,12 @@ void sub_080A2E40(void) { MemCopy(&gUnk_08A05751, &gBG1Buffer, 0x800); MemCopy(&gUnk_08A05751[0x800], &gBG2Buffer, 0x800); gScreen.lcd.displayControl = 0x1f00; - gScreen.bg.bg1Control = 0x1c81; - gScreen.affine.bg2Control = 0x1d82; - gScreen.affine.bg3Control = 0x1e0b; - gScreen.bg.bg1Updated = 1; - gScreen.affine.bg2Updated = 1; - gScreen.affine.bg3Updated = 1; + gScreen.bg1.control = 0x1c81; + gScreen.bg2.control = 0x1d82; + gScreen.bg3.control = 0x1e0b; + gScreen.bg1.updated = 1; + gScreen.bg2.updated = 1; + gScreen.bg3.updated = 1; gScreen.controls.layerFXControl = 0x1044; gScreen.controls.alphaBlend = 0xb04; { diff --git a/src/enemy/waterDrop.c b/src/enemy/waterDrop.c index 0625569c..d32ae94e 100644 --- a/src/enemy/waterDrop.c +++ b/src/enemy/waterDrop.c @@ -62,8 +62,8 @@ void sub_0802A2FC(Entity* this) { } void sub_0802A334(Entity* this) { - u32 x = (this->x.HALF.HI - gRoomControls.roomScrollX + gScreen.bg.bg1xOffset) >> 3; - u32 y = (this->y.HALF.HI - gRoomControls.roomScrollY + gScreen.bg.bg1yOffset) >> 3; + u32 x = (this->x.HALF.HI - gRoomControls.roomScrollX + gScreen.bg1.xOffset) >> 3; + u32 y = (this->y.HALF.HI - gRoomControls.roomScrollY + gScreen.bg1.yOffset) >> 3; if (gBG3Buffer[(x & 0x1fU) + (y & 0x1fU) * 0x20 + 0x400]) { this->collisionLayer = 2; } else { @@ -73,8 +73,8 @@ void sub_0802A334(Entity* this) { } void sub_0802A39C(Entity* this) { - u32 x = (gPlayerEntity.x.HALF.HI - gRoomControls.roomScrollX + gScreen.bg.bg1xOffset) >> 3; - u32 y = (gPlayerEntity.y.HALF.HI - gRoomControls.roomScrollY + gScreen.bg.bg1yOffset - 10) >> 3; + u32 x = (gPlayerEntity.x.HALF.HI - gRoomControls.roomScrollX + gScreen.bg1.xOffset) >> 3; + u32 y = (gPlayerEntity.y.HALF.HI - gRoomControls.roomScrollY + gScreen.bg1.yOffset - 10) >> 3; if (gBG3Buffer[(x & 0x1fU) + (y & 0x1fU) * 0x20 + 0x400]) { COLLISION_OFF(this); } else { diff --git a/src/fade.c b/src/fade.c index fe77e3d0..1ed6ffd0 100644 --- a/src/fade.c +++ b/src/fade.c @@ -38,9 +38,9 @@ void DoFade(u32 fadeType, u32 fadeSpeed) { } if ((fadeType & 8) != 0) { gUnk_03000000.spritesOffset = 1; - gScreen.bg.bg1Control |= 0x40; - gScreen.affine.bg2Control |= 0x40; - gScreen.affine.bg3Control |= 0x40; + gScreen.bg1.control |= 0x40; + gScreen.bg2.control |= 0x40; + gScreen.bg3.control |= 0x40; } if ((fadeType & 0x10) != 0) { sub_0801E1B8(gFadeControl.field_0x16, gFadeControl.field_0x18); diff --git a/src/fileScreen.c b/src/fileScreen.c index 46f01c41..cfc85b6b 100644 --- a/src/fileScreen.c +++ b/src/fileScreen.c @@ -109,19 +109,19 @@ void CreateDialogBox(u32 arg0, u32 arg1) { if (sfx) { SoundReq(sfx); } - gScreen.bg.bg0Updated = 1; + gScreen.bg0.updated = 1; } void sub_08050384(void) { RecoverUI(0, 0); MemClear(&gBG0Buffer, sizeof(gBG0Buffer)); - gScreen.bg.bg0Updated = 1; + gScreen.bg0.updated = 1; } void sub_080503A8(u32 gfxGroup) { LoadGfxGroup(gfxGroup); - gScreen.bg.bg1Updated = 1; - gScreen.affine.bg2Updated = 1; + gScreen.bg1.updated = 1; + gScreen.bg2.updated = 1; } void SetFileSelectState(FileSelectState mode) { @@ -162,12 +162,12 @@ void HandleChooseFileScreen(void) { sScreenHandlers[gMain.funcIndex](); if (gUnk_02032EC0.lastState != gUnk_02032EC0.state) { gUnk_02032EC0.lastState = gUnk_02032EC0.state; - gScreen.bg.bg0xOffset = 0; - gScreen.bg.bg0yOffset = 0; - gScreen.bg.bg1xOffset = 0; - gScreen.bg.bg1yOffset = 0; - gScreen.affine.bg2xOffset = 0; - gScreen.affine.bg2yOffset = 0; + gScreen.bg0.xOffset = 0; + gScreen.bg0.yOffset = 0; + gScreen.bg1.xOffset = 0; + gScreen.bg1.yOffset = 0; + gScreen.bg2.xOffset = 0; + gScreen.bg2.yOffset = 0; MemClear(&gChooseFileState, sizeof(gChooseFileState)); } @@ -220,7 +220,7 @@ static void HandleFileScreenEnter(void) { sub_080A70AC(&gUnk_080FC8D0); HideButtonR(); gScreen.lcd.displayControl |= DISPCNT_BG_ALL_ON | DISPCNT_OBJ_ON; - gScreen.affine.bg3Control = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(2) | BGCNT_SCREENBASE(30); + gScreen.bg3.control = BGCNT_PRIORITY(3) | BGCNT_CHARBASE(2) | BGCNT_SCREENBASE(30); gScreen.controls.layerFXControl = BLDCNT_TGT1_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_EFFECT_BLEND; gScreen.controls.alphaBlend = BLDALPHA_BLEND(15, 10); gUnk_02024490.unk0 = 1; @@ -525,7 +525,7 @@ void sub_08050AFC(u32 idx) { if (gUnk_02019EE0.saveStatus[idx] == SAVE_VALID) { sub_08050B3C(&gBG1Buffer[0x14E]); } - gScreen.bg.bg1Updated = 1; + gScreen.bg1.updated = 1; } typedef struct { @@ -859,8 +859,8 @@ void sub_08051090(void) { sub_08050790(); sub_0805070C(); sub_08051458(); - gScreen.bg.bg1yOffset = 0xff; - gScreen.affine.bg2yOffset = 0xff; + gScreen.bg1.yOffset = 0xff; + gScreen.bg2.yOffset = 0xff; sub_080A7114(1); } diff --git a/src/game.c b/src/game.c index 0d33c6ca..aade535d 100644 --- a/src/game.c +++ b/src/game.c @@ -248,7 +248,7 @@ NONMATCH("asm/non_matching/game/sub_08052418.inc", void sub_08052418(int param_1 // temp._0 = gBG1Buffer[gUnk_080FCAA4._8[param_1]][gUnk_080FCAA4._0[gSaveHeader->gameLanguage + i]] * 2; temp._13 = ((temp._13 & 0xfe) | gUnk_080FCAA4._8[i + 1]) & 1; sub_0805F46C(gUnk_080FCAA4._a[param_1], &temp); - gScreen.bg.bg1xOffset = 1; + gScreen.bg1.xOffset = 1; } END_NONMATCH diff --git a/src/interrupts.c b/src/interrupts.c index da810ec6..680944e2 100644 --- a/src/interrupts.c +++ b/src/interrupts.c @@ -7,11 +7,11 @@ #include "textbox.h" #include "functions.h" #include "object.h" -#include "manager.h" #include "utils.h" #include "npc.h" #include "effects.h" #include "screen.h" +#include "gba/m4a.h" extern u8 gUnk_03003DE0; extern u8 gUnk_03000C30; @@ -22,18 +22,19 @@ extern u8 gUpdateVisibleTiles; extern u8 gUnk_03003DF0[]; extern u8 gUnk_03003BE0; extern Entity* gUnk_03004040[3]; -extern u8 gUnk_020342F8; +extern u16 gUnk_080B2CD8[]; +extern u32 gUnk_03000FBC; extern void sub_080ADD70(); extern void sub_0801C25C(); extern void UpdateDisplayControls(); extern void LoadResources(); extern void FadeMain(); -extern u32 CheckDontUpdate(); extern void HandlePlayerLife(); extern void DoPlayerAction(); extern void sub_080171F0(); extern void sub_08078FB0(); +extern u32 CheckDontUpdate(); extern void DrawEntity(); extern void sub_0807A050(); extern u32 sub_08079B24(); @@ -44,43 +45,8 @@ extern void sub_08078180(void); extern void sub_0807B0C8(void); extern void sub_0807A8D8(Entity*); extern void sub_08077FEC(u32); -extern void ItemInit(Entity*); -extern void InitObject(Entity*); -extern u32 ReadBit(void*, u32); -extern void InitNPC(Entity*); -extern void m4aSoundMain(); -extern void m4aSoundVSync(); -typedef struct { - u8 unk0; - u8 unk1; - u8 unk2; - u8 unk3; - u8 unk4; - u8 unk5; - u16 unk6; -} ItemFrame; -extern ItemFrame gUnk_08126DA8[]; -extern ItemFrame* gUnk_08126ED8[3]; - -typedef struct { - u16 unk0; - u16 unk1; - u16 x; - u16 y; -} NPCStruct; -extern NPCStruct gUnk_02031EC0[100]; - -// todo: merge with screen.h -typedef struct { - u16 dest; - u16 _2; - u16 _4; - u16 _6; - u8* src; -} DmaSettings; - -extern u16 gDmaPresets[]; +void gIntrMain(void); struct { u8 update; @@ -95,18 +61,10 @@ struct { u32 size; } extern gUnk_02022730; -void sub_08016CA8(DmaSettings* s); +void sub_08016CA8(BgSettings* bg); void sub_08016BF8(void); void DispCtrlSet(void); -extern u16 gUnk_080B2CD8[]; - -extern u32 gUnk_03000FBC; - -void gIntrMain(void); - -typedef void (*fp)(void); - void DummyIntr(void) { /* .. */ } @@ -157,18 +115,18 @@ void UpdateDisplayControls(void) { gUnk_03000000.update = 0; DmaCopy32(3, &gUnk_03000000.oam, 0x07000000, 0x400); } - sub_08016CA8((DmaSettings*)&gScreen.bg.bg0Control); - sub_08016CA8((DmaSettings*)&gScreen.bg.bg1Control); - sub_08016CA8((DmaSettings*)&gScreen.affine.bg2Control); - sub_08016CA8((DmaSettings*)&gScreen.affine.bg3Control); + sub_08016CA8(&gScreen.bg0); + sub_08016CA8(&gScreen.bg1); + sub_08016CA8((BgSettings*)&gScreen.bg2); + sub_08016CA8((BgSettings*)&gScreen.bg3); } -void sub_08016CA8(DmaSettings* s) { - if (s->_6 && s->src != 0) { +void sub_08016CA8(BgSettings* bg) { + if (bg->updated && bg->tilemap != NULL) { u32 dest; - s->_6 = 0; - dest = s->dest; - DmaCopy32(3, s->src, ((dest << 3) & 0xF800) + 0x06000000, gUnk_080B2CD8[dest >> 14]); + bg->updated = 0; + dest = bg->control; + DmaCopy32(3, bg->tilemap, ((dest << 3) & 0xF800) + 0x06000000, gUnk_080B2CD8[dest >> 14]); } } @@ -322,7 +280,7 @@ void HandlePlayerLife(Entity* this) { } else if ((gSave.stats.effectTimer == 0) || --gSave.stats.effectTimer == 0) { gSave.stats.effect = 0; } else if ((gSave.stats.effectTimer & 0x3f) == 0) { - CreateFx(this, FX_AURA_BASE + gSave.stats.effect, 0); + CreateFx(this, (FX_RED_AURA - 1) + gSave.stats.effect, 0); } } #endif @@ -373,91 +331,3 @@ void sub_080171F0(void) { sub_08077FEC(gPlayerEntity.action); } } - -void ItemUpdate(Entity* this) { - if ((this->flags & ENT_DID_INIT) == 0 && this->action == 0 && this->subAction == 0) - ItemInit(this); - - if (!CheckDontUpdate(this)) { - gPlayerItemFunctions[this->id](this); - this->bitfield &= ~0x80; - if (this->iframes != 0) { - if (this->iframes > 0) - this->iframes--; - else - this->iframes++; - } - } - DrawEntity(this); -} - -// tiny regalloc -NONMATCH("asm/non_matching/arm_proxy/ItemInit.inc", void ItemInit(Entity* this)) { - ItemFrame* entry; - - entry = &gUnk_08126DA8[this->id]; - if (entry->unk0 == 0xff) { - u32 temp = entry->unk2; - ItemFrame* temp2 = gUnk_08126ED8[entry->unk1]; - entry = &temp2[this->field_0x68.HALF.LO - temp]; - } - - this->palette.raw = ((entry->unk0 & 0xf) << 4) | entry->unk0; - this->damage = entry->unk1; - this->hurtType = entry->unk3; - this->hitType = entry->unk4; - this->spriteIndex = entry->unk5; - if (entry->unk6 == 0) - this->spriteVramOffset = gPlayerEntity.spriteVramOffset; - else - this->spriteVramOffset = entry->unk6 & 0x3ff; - - if (this->animationState == 0) - this->animationState = gPlayerEntity.animationState & 6; - - this->collisionLayer = gPlayerEntity.collisionLayer; - this->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; - this->spritePriority.b0 = gPlayerEntity.spritePriority.b0; - this->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; - this->currentHealth = 1; - this->flags |= ENT_DID_INIT; -} -END_NONMATCH - -void ObjectUpdate(Entity* this) { - if ((this->flags & ENT_DID_INIT) == 0 && this->action == 0) - InitObject(this); - if (this->iframes != 0) - this->iframes++; - if (!CheckDontUpdate(this)) { - gObjectFunctions[this->id](this); - this->bitfield &= ~0x80; - } - DrawEntity(this); -} - -void ManagerUpdate(Entity* this) { - if (!CheckDontUpdate(this)) - gManagerFunctions[this->id](this); -} - -// regalloc -NONMATCH("asm/non_matching/arm_proxy/NPCUpdate.inc", void NPCUpdate(Entity* this)) { - if ((this->currentHealth & 0x7f) && !ReadBit(&gUnk_020342F8, this->currentHealth - 1)) - DeleteThisEntity(); - if (this->action == 0 && (this->flags & ENT_DID_INIT) == 0) - InitNPC(this); - if (!CheckDontUpdate(this)) - gNPCFunctions[this->id][0](this); - if (this->next != NULL) { - if (gNPCFunctions[this->id][1] != NULL) - gNPCFunctions[this->id][1](this); - if ((this->currentHealth & 0x7f) != 0) { - u32 temp = this->currentHealth & 0x7f; - gUnk_02031EC0[temp * 2 - 2].x = this->x.HALF.HI - gRoomControls.roomOriginX; - gUnk_02031EC0[temp * 2 - 2].y = this->y.HALF.HI - gRoomControls.roomOriginY; - } - DrawEntity(this); - } -} -END_NONMATCH diff --git a/src/intro.c b/src/intro.c index 871caa64..fc28094e 100644 --- a/src/intro.c +++ b/src/intro.c @@ -101,7 +101,7 @@ static void HandleNintendoCapcomLogos(void) { } LoadPaletteGroup(paletteGroup); gScreen.lcd.displayControl |= DISPCNT_BG2_ON; - gScreen.bg.bg1Updated = 1; + gScreen.bg1.updated = 1; DoFade(6, 8); advance = ADVANCE_NONE; #if defined(DEMO_USA) @@ -158,17 +158,17 @@ static void HandleTitlescreen(void) { // Blend first and second layer gScreen.controls.layerFXControl = BLDCNT_TGT1_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_EFFECT_BLEND; gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 9); - gScreen.bg.bg1Control = 0x1c09; - gScreen.affine.bg2Control = BGCNT_SCREENBASE(29) | BGCNT_PRIORITY(2); - gScreen.affine.bg3Control = BGCNT_SCREENBASE(30) | BGCNT_PRIORITY(3); + gScreen.bg1.control = 0x1c09; + gScreen.bg2.control = BGCNT_SCREENBASE(29) | BGCNT_PRIORITY(2); + gScreen.bg3.control = BGCNT_SCREENBASE(30) | BGCNT_PRIORITY(3); gScreen.lcd.displayControl |= DISPCNT_BG1_ON | DISPCNT_BG2_ON | DISPCNT_BG3_ON | DISPCNT_OBJ_ON; - gScreen.bg.bg1yOffset = 0xff60; + gScreen.bg1.yOffset = 0xff60; } else { gScreen.controls.layerFXControl = BLDCNT_TGT1_BG0 | BLDCNT_TGT2_BG1 | BLDCNT_EFFECT_BLEND; gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 9); - gScreen.bg.bg0Control = BGCNT_SCREENBASE(29) | BGCNT_PRIORITY(2); - gScreen.bg.bg1Control = 0x1E03; - gScreen.affine.bg2Control = BGCNT_PRIORITY(1) | BGCNT_CHARBASE(2) | BGCNT_256COLOR | + gScreen.bg0.control = BGCNT_SCREENBASE(29) | BGCNT_PRIORITY(2); + gScreen.bg1.control = 0x1E03; + gScreen.bg2.control = BGCNT_PRIORITY(1) | BGCNT_CHARBASE(2) | BGCNT_256COLOR | BGCNT_SCREENBASE(28) | BGCNT_WRAP | BGCNT_TXT512x256; gScreen.lcd.displayControl |= DISPCNT_MODE_1; gScreen.lcd.displayControl |= DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_ON; @@ -278,13 +278,13 @@ static void HandleJapaneseTitlescreenAnimationIntro(void) { case 0: if (!gFadeControl.active) { if ((gIntroState.counter & 1) == 0) { - gScreen.bg.bg1yOffset++; + gScreen.bg1.yOffset++; } - if (GetAdvanceState() == ADVANCE_KEY_PRESSED || gScreen.bg.bg1yOffset == 0) { + if (GetAdvanceState() == ADVANCE_KEY_PRESSED || gScreen.bg1.yOffset == 0) { gIntroState.subState++; - gScreen.bg.bg1yOffset = 0; - gScreen.bg.bg1Control = 0xc09; + gScreen.bg1.yOffset = 0; + gScreen.bg1.control = 0xc09; gFadeControl.mask = 0x00000040; DoFade(6, 0x10); SoundReq(SFX_F8); diff --git a/src/manager.c b/src/manager.c index 1d8974cf..eda605a0 100644 --- a/src/manager.c +++ b/src/manager.c @@ -12,3 +12,8 @@ void (*const gManagerFunctions[])() = { Manager31_Main, Manager32_Main, Manager33_Main, Manager34_Main, Manager35_Main, Manager36_Main, Manager37_Main, Manager38_Main, Manager39_Main }; + +void ManagerUpdate(Entity* this) { + if (!CheckDontUpdate(this)) + gManagerFunctions[this->id](this); +} diff --git a/src/manager/manager1.c b/src/manager/manager1.c index 59a9373f..f0fb5e49 100644 --- a/src/manager/manager1.c +++ b/src/manager/manager1.c @@ -32,7 +32,7 @@ void sub_080570B8(Entity* this) { this->height.WORD = 0; pbVar1 = ((u8*)&this->hVelocity + 1); if (*pbVar1 == 3) { - gScreen.affine.bg3Updated = 1; + gScreen.bg3.updated = 1; } else { gUnk_08107C48[*pbVar1](this); } @@ -50,7 +50,7 @@ void sub_08057118(Entity* this) { ((u8*)&this->hVelocity)[1] = 0; ((u8*)&this->hVelocity)[2] = 0; this->action = 1; - gScreen.affine.bg3Control = 0x1e04; + gScreen.bg3.control = 0x1e04; gScreen.lcd.displayControl |= 0x800; gScreen.controls.layerFXControl = 0x3648; gScreen.controls.alphaBlend = 0x1000; diff --git a/src/manager/manager10.c b/src/manager/manager10.c index 658bf297..d010ed06 100644 --- a/src/manager/manager10.c +++ b/src/manager/manager10.c @@ -97,8 +97,8 @@ void sub_08059690(Manager10* this) { void sub_080596E0(Manager10* this) { if ((gScreenTransition.frameCount & 7) == 0) { - gScreen.bg.bg1xOffset += 8; - gScreen.bg.bg1xOffset &= 0x1F; + gScreen.bg1.xOffset += 8; + gScreen.bg1.xOffset &= 0x1F; } if (sub_0805986C()) { if (this->unk_21 == 0 && this->unk_22 != 2) { @@ -142,7 +142,7 @@ void sub_080596E0(Manager10* this) { LoadResourceAsync(gBG3Buffer, 0x600e800, 0x800); break; case 5: - gUnk_0200B650 = &gScreen.bg.bg1Control; + gUnk_0200B650 = &gScreen.bg1.control; gScreen.lcd.displayControl |= 0x200; break; } diff --git a/src/manager/manager15.c b/src/manager/manager15.c index b0ce0828..02cf723f 100644 --- a/src/manager/manager15.c +++ b/src/manager/manager15.c @@ -397,9 +397,9 @@ void sub_0805A8EC(Manager15* this) { void sub_0805A94C(Manager15* this) { int tmp1, tmp2; - gScreen.affine.bg3xOffset = gRoomControls.roomScrollX - this->unk_24 + this->unk_34; - gScreen.affine.bg3yOffset = gRoomControls.roomScrollY - this->unk_26 + this->unk_36; - tmp1 = -gScreen.affine.bg3xOffset; + gScreen.bg3.xOffset = gRoomControls.roomScrollX - this->unk_24 + this->unk_34; + gScreen.bg3.yOffset = gRoomControls.roomScrollY - this->unk_26 + this->unk_36; + tmp1 = -gScreen.bg3.xOffset; tmp2 = tmp1 + 0x100; if (tmp1 < 0) tmp1 = 0; @@ -410,7 +410,7 @@ void sub_0805A94C(Manager15* this) { if (tmp2 > 0xF0) tmp2 = 0xF0; gScreen.controls.window1HorizontalDimensions = (tmp1 << 8 | tmp2); - tmp1 = -gScreen.affine.bg3yOffset; + tmp1 = -gScreen.bg3.yOffset; tmp2 = tmp1 + 0x100; if (tmp1 < 0) tmp1 = 0; @@ -426,8 +426,8 @@ void sub_0805A94C(Manager15* this) { void sub_0805A9CC(Manager15* this) { int tmp1, tmp2; void* tmp3; - gScreen.affine.bg3xOffset = gRoomControls.roomScrollX - this->unk_24 + this->unk_34; - tmp1 = -gScreen.affine.bg3xOffset; + gScreen.bg3.xOffset = gRoomControls.roomScrollX - this->unk_24 + this->unk_34; + tmp1 = -gScreen.bg3.xOffset; tmp2 = tmp1 + 0x100; if (tmp1 < 0) tmp1 = 0; @@ -439,14 +439,14 @@ void sub_0805A9CC(Manager15* this) { tmp2 = 0xF0; gScreen.controls.window1HorizontalDimensions = tmp1 << 8 | tmp2; tmp1 = gRoomControls.roomScrollY - this->unk_26 + this->unk_36; - gScreen.affine.bg3yOffset = tmp1 & 0x3F; + gScreen.bg3.yOffset = tmp1 & 0x3F; tmp3 = (&gBG3Buffer[((tmp1 / 0x40) << 8)]); - gScreen.affine.bg3Tilemap = (u32*)tmp3; + gScreen.bg3.tilemap = (u32*)tmp3; gScreen.controls.window1VerticalDimensions = 0xa0; if (this->unk_28 == tmp3) return; this->unk_28 = tmp3; - gScreen.affine.bg3Updated = 1; + gScreen.bg3.updated = 1; } extern struct { u8 unk_00[0x20]; } gUnk_085A97A0[]; @@ -483,11 +483,11 @@ void sub_0805AAF0(u32 unk0) { sub_0805AADC(unk0); gScreen.controls.layerFXControl = 0x3E48; gScreen.controls.alphaBlend = 0x1008; - gScreen.affine.bg3Control = 0x1E04; - gScreen.affine.bg3Tilemap = &gBG3Buffer; - gScreen.affine.bg3xOffset = 0; - gScreen.affine.bg3yOffset = 0; - gScreen.affine.bg3Updated = 1; + gScreen.bg3.control = 0x1E04; + gScreen.bg3.tilemap = &gBG3Buffer; + gScreen.bg3.xOffset = 0; + gScreen.bg3.yOffset = 0; + gScreen.bg3.updated = 1; gScreen.controls.windowInsideControl = 0x3F3F; gScreen.controls.windowOutsideControl = 0x37; gScreen.controls.window1HorizontalDimensions = 0xF0; diff --git a/src/manager/manager18.c b/src/manager/manager18.c index cadd8885..dd7d553e 100644 --- a/src/manager/manager18.c +++ b/src/manager/manager18.c @@ -40,19 +40,19 @@ void Manager18_Main(Manager18* this) { } gRoomControls.bg3OffsetX.WORD -= 0x2000; gRoomControls.bg3OffsetY.WORD -= 0x1000; - gScreen.affine.bg3xOffset = gRoomControls.roomScrollX + gRoomControls.bg3OffsetX.HALF.HI; - gScreen.affine.bg3yOffset = gRoomControls.roomScrollY + gRoomControls.bg3OffsetY.HALF.HI; + gScreen.bg3.xOffset = gRoomControls.roomScrollX + gRoomControls.bg3OffsetX.HALF.HI; + gScreen.bg3.yOffset = gRoomControls.roomScrollY + gRoomControls.bg3OffsetY.HALF.HI; } } } void sub_0805AEDC(Manager18* this) { - gScreen.affine.bg3Control = 0x1e05; + gScreen.bg3.control = 0x1e05; gScreen.lcd.displayControl |= 0x800; gScreen.controls.layerFXControl = 0x3648; gScreen.controls.alphaBlend = (this != NULL) ? this->field_0x20 : 0x1000; - gScreen.affine.bg3xOffset = gRoomControls.roomScrollX + gRoomControls.bg3OffsetX.HALF.HI; - gScreen.affine.bg3yOffset = gRoomControls.roomScrollY + gRoomControls.bg3OffsetY.HALF.HI; + gScreen.bg3.xOffset = gRoomControls.roomScrollX + gRoomControls.bg3OffsetX.HALF.HI; + gScreen.bg3.yOffset = gRoomControls.roomScrollY + gRoomControls.bg3OffsetY.HALF.HI; if (this != NULL) { Manager18_Main(this); } diff --git a/src/manager/manager19.c b/src/manager/manager19.c index fa0f1912..6c03287a 100644 --- a/src/manager/manager19.c +++ b/src/manager/manager19.c @@ -23,15 +23,15 @@ void Manager19_Main(Manager* this) { } } else { gRoomControls.bg3OffsetX.WORD = gRoomControls.bg3OffsetX.WORD - 0x2000; - gScreen.affine.bg3xOffset = gRoomControls.roomScrollX + gRoomControls.bg3OffsetX.HALF.HI; - gScreen.affine.bg3yOffset = gRoomControls.roomScrollY + gRoomControls.bg3OffsetY.HALF.HI; + gScreen.bg3.xOffset = gRoomControls.roomScrollX + gRoomControls.bg3OffsetX.HALF.HI; + gScreen.bg3.yOffset = gRoomControls.roomScrollY + gRoomControls.bg3OffsetY.HALF.HI; } } } void sub_0805AFFC(Manager* this) { - gScreen.affine.bg3Control = 0x1e03; + gScreen.bg3.control = 0x1e03; gScreen.lcd.displayControl |= 0x800; - gScreen.affine.bg3xOffset = gRoomControls.roomScrollX + gRoomControls.bg3OffsetX.HALF.HI; - gScreen.affine.bg3yOffset = gRoomControls.roomScrollY + gRoomControls.bg3OffsetY.HALF.HI; + gScreen.bg3.xOffset = gRoomControls.roomScrollX + gRoomControls.bg3OffsetX.HALF.HI; + gScreen.bg3.yOffset = gRoomControls.roomScrollY + gRoomControls.bg3OffsetY.HALF.HI; } diff --git a/src/manager/manager1A.c b/src/manager/manager1A.c index 838fd898..632a25b7 100644 --- a/src/manager/manager1A.c +++ b/src/manager/manager1A.c @@ -199,9 +199,9 @@ void sub_0805B2B0(Manager1A* this) { } gScreen.lcd.displayControl |= 0x800; gRoomControls.bg3OffsetX.HALF.HI = gRoomControls.roomScrollX + this->unk_34 + tmp; - gScreen.affine.bg3xOffset = gRoomControls.roomScrollX + this->unk_34 + tmp; + gScreen.bg3.xOffset = gRoomControls.roomScrollX + this->unk_34 + tmp; gRoomControls.bg3OffsetY.HALF.HI = gRoomControls.roomScrollY + this->unk_36 + tmp2; - gScreen.affine.bg3yOffset = gRoomControls.roomScrollY + this->unk_36 + tmp2; + gScreen.bg3.yOffset = gRoomControls.roomScrollY + this->unk_36 + tmp2; } void sub_0805B328(Manager1A* this) { @@ -210,10 +210,10 @@ void sub_0805B328(Manager1A* this) { return; tmp = &gUnk_08108764[this->manager.unk_0a]; LoadResourceAsync(&gGlobalGfxAndPalettes[tmp->unk_0c->unk_00], 0x0600F000, 0x800); - gScreen.affine.bg3Control = 0x1E07; + gScreen.bg3.control = 0x1E07; gScreen.lcd.displayControl |= 0x800; - gScreen.affine.bg3xOffset = gRoomControls.bg3OffsetX.HALF.HI; - gScreen.affine.bg3yOffset = gRoomControls.bg3OffsetY.HALF.HI; + gScreen.bg3.xOffset = gRoomControls.bg3OffsetX.HALF.HI; + gScreen.bg3.yOffset = gRoomControls.bg3OffsetY.HALF.HI; gScreen.controls.layerFXControl &= ~0x8; } diff --git a/src/manager/manager1B.c b/src/manager/manager1B.c index 3dd4f36f..47fd8714 100644 --- a/src/manager/manager1B.c +++ b/src/manager/manager1B.c @@ -46,14 +46,14 @@ void Manager1B_Main(Manager1B* this) { } void sub_0805B448(Manager1B* this) { - gScreen.affine.bg3xOffset = (gRoomControls.roomScrollX - gRoomControls.roomOriginX) >> 2; - gScreen.affine.bg3yOffset = ((gRoomControls.roomScrollY - gRoomControls.roomOriginY) >> 1) + this->field_0x20; + gScreen.bg3.xOffset = (gRoomControls.roomScrollX - gRoomControls.roomOriginX) >> 2; + gScreen.bg3.yOffset = ((gRoomControls.roomScrollY - gRoomControls.roomOriginY) >> 1) + this->field_0x20; } void sub_0805B474(Manager1B* this) { s32 tmp = ((gRoomControls.roomScrollY - gRoomControls.roomOriginY) * 0x60) / (gRoomControls.height - 0xa0); - gScreen.affine.bg3yOffset = gRoomControls.roomOriginY + tmp; - gScreen.affine.bg3xOffset = gRoomControls.roomScrollX - ((gRoomControls.width - 0x100) / 2); + gScreen.bg3.yOffset = gRoomControls.roomOriginY + tmp; + gScreen.bg3.xOffset = gRoomControls.roomScrollX - ((gRoomControls.width - 0x100) / 2); } void sub_0805B4B4(Manager1B* this) { @@ -69,14 +69,14 @@ void sub_0805B4D0(u32 param_1) { u32 uVar2; LoadGfxGroup(gUnk_08108C5C[param_1]); - gScreen.affine.bg3Control = 0x1e07; + gScreen.bg3.control = 0x1e07; gScreen.lcd.displayControl |= 0x800; - gScreen.affine.bg3xOffset = (gRoomControls.roomScrollX - gRoomControls.roomOriginX) >> 2; + gScreen.bg3.xOffset = (gRoomControls.roomScrollX - gRoomControls.roomOriginX) >> 2; uVar2 = (gRoomControls.roomScrollY - gRoomControls.roomOriginY) >> 1; iVar1 = 0x100 - gRoomControls.height; if (iVar1 < 0) { iVar1 = 0; } - gScreen.affine.bg3yOffset = uVar2 + iVar1 + gUnk_08108C44[param_1]; + gScreen.bg3.yOffset = uVar2 + iVar1 + gUnk_08108C44[param_1]; } diff --git a/src/manager/manager1D.c b/src/manager/manager1D.c index 6d1a850b..63ffcf8c 100644 --- a/src/manager/manager1D.c +++ b/src/manager/manager1D.c @@ -14,19 +14,19 @@ void sub_0805B5E0(Manager* this) { this->action = 1; gScreen.lcd.displayControl |= 0x800; - gScreen.affine.bg3Control = gUnk_08108C88[this->unk_0a]; + gScreen.bg3.control = gUnk_08108C88[this->unk_0a]; gRoomControls.bg3OffsetY.WORD = 0; gRoomControls.bg3OffsetX.WORD = 0; switch (this->unk_0a) { case 0: default: - gScreen.affine.bg3yOffset = 0; - gScreen.affine.bg3xOffset = 0; + gScreen.bg3.yOffset = 0; + gScreen.bg3.xOffset = 0; break; case 1: - gScreen.affine.bg3xOffset = gRoomControls.roomScrollX + gRoomControls.bg3OffsetX.HALF.HI; - gScreen.affine.bg3yOffset = gRoomControls.roomScrollY + gRoomControls.bg3OffsetY.HALF.HI; + gScreen.bg3.xOffset = gRoomControls.roomScrollX + gRoomControls.bg3OffsetX.HALF.HI; + gScreen.bg3.yOffset = gRoomControls.roomScrollY + gRoomControls.bg3OffsetY.HALF.HI; break; } } @@ -34,7 +34,7 @@ void sub_0805B5E0(Manager* this) { void sub_0805B638(Manager* this) { if (this->unk_0a == 1) { gRoomControls.bg3OffsetX.WORD = gRoomControls.bg3OffsetX.WORD + 0x2000; - gScreen.affine.bg3xOffset = gRoomControls.roomScrollX + gRoomControls.bg3OffsetX.HALF.HI; - gScreen.affine.bg3yOffset = gRoomControls.roomScrollY + gRoomControls.bg3OffsetY.HALF.HI; + gScreen.bg3.xOffset = gRoomControls.roomScrollX + gRoomControls.bg3OffsetX.HALF.HI; + gScreen.bg3.yOffset = gRoomControls.roomScrollY + gRoomControls.bg3OffsetY.HALF.HI; } } diff --git a/src/manager/manager2.c b/src/manager/manager2.c index 6f020f25..05fe08f7 100644 --- a/src/manager/manager2.c +++ b/src/manager/manager2.c @@ -21,8 +21,8 @@ extern u32 gUnk_0200B650; void Manager2_Main(Manager2* this) { if (this->manager.action == 0) { this->manager.action = 1; - gScreen.affine.bg3Updated = 0; - gScreen.bg.bg1Updated = 0; + gScreen.bg3.updated = 0; + gScreen.bg1.updated = 0; sub_08052D74(this, sub_080576A0, 0); } sub_0805754C(this); @@ -33,19 +33,19 @@ void sub_0805754C(Manager2* this) { bgOffset = (gRoomControls.roomScrollY - gRoomControls.roomOriginY); bgOffset += bgOffset >> 3; - gScreen.affine.bg3yOffset = bgOffset & 0x3f; - gScreen.affine.bg3Tilemap = gMapDataTopSpecial + (bgOffset / 0x40) * 0x200; - if (this->field_0x38 != gScreen.affine.bg3Tilemap) { - this->field_0x38 = gScreen.affine.bg3Tilemap; - gScreen.affine.bg3Updated = 1; + gScreen.bg3.yOffset = bgOffset & 0x3f; + gScreen.bg3.tilemap = gMapDataTopSpecial + (bgOffset / 0x40) * 0x200; + if (this->field_0x38 != gScreen.bg3.tilemap) { + this->field_0x38 = gScreen.bg3.tilemap; + gScreen.bg3.updated = 1; } bgOffset = (gRoomControls.roomScrollY - gRoomControls.roomOriginY); bgOffset += bgOffset >> 2; - gScreen.bg.bg1yOffset = bgOffset & 0x3f; - gScreen.bg.bg1Tilemap = gMapDataTopSpecial + 0x2000 + (bgOffset / 0x40) * 0x200; - if (this->field_0x3c != gScreen.bg.bg1Tilemap) { - this->field_0x3c = gScreen.bg.bg1Tilemap; - gScreen.bg.bg1Updated = 1; + gScreen.bg1.yOffset = bgOffset & 0x3f; + gScreen.bg1.tilemap = gMapDataTopSpecial + 0x2000 + (bgOffset / 0x40) * 0x200; + if (this->field_0x3c != gScreen.bg1.tilemap) { + this->field_0x3c = gScreen.bg1.tilemap; + gScreen.bg1.updated = 1; } } @@ -59,27 +59,27 @@ void sub_080575C8(u32 param) { bgOffset = (gRoomControls.roomScrollY - gRoomControls.roomOriginY); bgOffset += bgOffset >> 3; - gScreen.affine.bg3yOffset = bgOffset & 0x3f; - gScreen.affine.bg3xOffset = 0; - gScreen.affine.bg3Tilemap = &gMapDataTopSpecial[(bgOffset / 0x40) * 0x200]; - gScreen.affine.bg3Control = 0x1d49; - gScreen.affine.bg3Updated = 1; + gScreen.bg3.yOffset = bgOffset & 0x3f; + gScreen.bg3.xOffset = 0; + gScreen.bg3.tilemap = &gMapDataTopSpecial[(bgOffset / 0x40) * 0x200]; + gScreen.bg3.control = 0x1d49; + gScreen.bg3.updated = 1; bgOffset = (gRoomControls.roomScrollY - gRoomControls.roomOriginY); bgOffset += bgOffset >> 2; - gScreen.bg.bg1yOffset = bgOffset & 0x3f; - gScreen.bg.bg1xOffset = 0; - gScreen.bg.bg1Tilemap = &gMapDataTopSpecial[0x2000 + (bgOffset / 0x40) * 0x200]; - gScreen.bg.bg1Control = 0x1e49; - gScreen.bg.bg1Updated = 1; + gScreen.bg1.yOffset = bgOffset & 0x3f; + gScreen.bg1.xOffset = 0; + gScreen.bg1.tilemap = &gMapDataTopSpecial[0x2000 + (bgOffset / 0x40) * 0x200]; + gScreen.bg1.control = 0x1e49; + gScreen.bg1.updated = 1; gScreen.controls.layerFXControl = 0x3c48; gScreen.controls.alphaBlend = 0x609; gScreen.lcd.displayControl |= 0xa00; } void sub_08057688(void) { - gScreen.affine.bg3Control = 0x1d48; - gScreen.bg.bg1Control = 0x1e48; + gScreen.bg3.control = 0x1d48; + gScreen.bg1.control = 0x1e48; } void sub_080576A0(Manager2* this) { diff --git a/src/manager/manager2F.c b/src/manager/manager2F.c index 68e41338..a86073ae 100644 --- a/src/manager/manager2F.c +++ b/src/manager/manager2F.c @@ -25,16 +25,16 @@ void Manager2F_Main(Manager* this) { } else { gRoomControls.bg3OffsetX.WORD -= 0x4000; gRoomControls.bg3OffsetY.WORD -= 0x2000; - gScreen.affine.bg3xOffset = gRoomControls.roomScrollX + gRoomControls.bg3OffsetX.HALF.HI; - gScreen.affine.bg3yOffset = gRoomControls.roomScrollY + gRoomControls.bg3OffsetY.HALF.HI; + gScreen.bg3.xOffset = gRoomControls.roomScrollX + gRoomControls.bg3OffsetX.HALF.HI; + gScreen.bg3.yOffset = gRoomControls.roomScrollY + gRoomControls.bg3OffsetY.HALF.HI; } } } void sub_0805D470(Manager* this) { LoadGfxGroup(0x4c); - gScreen.affine.bg3Control = 0x1e07; + gScreen.bg3.control = 0x1e07; gScreen.lcd.displayControl |= 0x800; - gScreen.affine.bg3xOffset = gRoomControls.roomScrollX + gRoomControls.bg3OffsetX.HALF.HI; - gScreen.affine.bg3yOffset = gRoomControls.roomScrollY + gRoomControls.bg3OffsetY.HALF.HI; + gScreen.bg3.xOffset = gRoomControls.roomScrollX + gRoomControls.bg3OffsetX.HALF.HI; + gScreen.bg3.yOffset = gRoomControls.roomScrollY + gRoomControls.bg3OffsetY.HALF.HI; } diff --git a/src/manager/manager32.c b/src/manager/manager32.c index 514aedf6..8360492e 100644 --- a/src/manager/manager32.c +++ b/src/manager/manager32.c @@ -65,7 +65,7 @@ void sub_0805D7DC(Manager32* this) { } LoadGfxGroup(gUnk_08108D74[index]); - gScreen.affine.bg3Control = 0x1e04; + gScreen.bg3.control = 0x1e04; } void sub_0805D860(Manager32* this) { @@ -152,8 +152,8 @@ void sub_0805D9D8(Manager32* this) { // TODO find out the actual type of the parent of this manager. Manager* pMVar1 = this->manager.parent; if (pMVar1 != NULL) { - gScreen.affine.bg3xOffset = 0x80 - (*(s16*)&pMVar1[1].unk_0e - gRoomControls.roomScrollX); - gScreen.affine.bg3yOffset = 0x8c - (*(s16*)(pMVar1[1].unk_11 + 1) - gRoomControls.roomScrollY); + gScreen.bg3.xOffset = 0x80 - (*(s16*)&pMVar1[1].unk_0e - gRoomControls.roomScrollX); + gScreen.bg3.yOffset = 0x8c - (*(s16*)(pMVar1[1].unk_11 + 1) - gRoomControls.roomScrollY); } } @@ -161,7 +161,7 @@ void sub_0805DA08(u32 x, u32 y, u32 param_3) { u32 i; struct BgAffineDstData* affineDstData = &gUnk_02017AA0[gUnk_03003DE4[0] * 0xa0]; for (i = 0; i < 0xa0; ++i, y += 0x17) { - affineDstData->pa = ((gSineTable[(param_3 + i + y) & 0xff] * x) >> 8) + gScreen.affine.bg3xOffset; + affineDstData->pa = ((gSineTable[(param_3 + i + y) & 0xff] * x) >> 8) + gScreen.bg3.xOffset; affineDstData = (struct BgAffineDstData*)&affineDstData->pb; } sub_0805622C(&gUnk_02017AA0[gUnk_03003DE4[0] * 0xa0], 0x400001c, 0xa2600001); diff --git a/src/manager/manager39.c b/src/manager/manager39.c index d607b3c2..567a38dd 100644 --- a/src/manager/manager39.c +++ b/src/manager/manager39.c @@ -69,7 +69,7 @@ void sub_0805E18C(Manager39* this) { void sub_0805E1D8(Manager39* this) { MemClear(&gUnk_02034DF0, 0x80); - gScreen.bg.bg0Updated = 1; + gScreen.bg0.updated = 1; DeleteThisEntity(); } @@ -89,5 +89,5 @@ void sub_0805E1F8(u32 unk0, u32 unk1) { if (!unk1) tmp2 = gUnk_08108E30; sub_0805F46C(&tmp, tmp2); - gScreen.bg.bg0Updated = 1; + gScreen.bg0.updated = 1; } diff --git a/src/manager/manager8.c b/src/manager/manager8.c index 198cb0e3..4debcb08 100644 --- a/src/manager/manager8.c +++ b/src/manager/manager8.c @@ -23,8 +23,8 @@ void Manager8_Main(Manager8* this) { sub_08057F20(this); if (!this->manager.action) { this->manager.action = 1; - gScreen.bg.bg1Updated = 0; - gScreen.affine.bg3Updated = 0; + gScreen.bg1.updated = 0; + gScreen.bg3.updated = 0; sub_08052D74(this, sub_08057EFC, 0); } } @@ -45,25 +45,25 @@ void sub_08057F20(Manager8* this) { u32 tmp; tmp = gRoomControls.roomScrollX - gRoomControls.roomOriginX; tmp = tmp + (tmp >> 3) + ((0x400 - gRoomControls.width) / 2); - gScreen.affine.bg3xOffset = tmp & 0xF; - gScreen.affine.bg3yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 2); - gScreen.affine.bg3Tilemap = gBG3Buffer; + gScreen.bg3.xOffset = tmp & 0xF; + gScreen.bg3.yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 2); + gScreen.bg3.tilemap = gBG3Buffer; sub_08058004(tmp, gUnk_02006F00, gBG3Buffer); tmp = ((tmp >> 4) << 1); if (this->unk_38 != tmp) { this->unk_38 = tmp; - gScreen.affine.bg3Updated = 1; + gScreen.bg3.updated = 1; } tmp = (gRoomControls.roomScrollX - gRoomControls.roomOriginX); tmp = tmp + (tmp >> 2) + ((0x400 - gRoomControls.width) / 2); - gScreen.bg.bg1xOffset = tmp & 0xF; - gScreen.bg.bg1yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1); - gScreen.bg.bg1Tilemap = gBG3Buffer + 0x400; + gScreen.bg1.xOffset = tmp & 0xF; + gScreen.bg1.yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1); + gScreen.bg1.tilemap = gBG3Buffer + 0x400; sub_08058004(tmp, gUnk_02006F00 + 0x2000, gBG3Buffer + 0x400); tmp = ((tmp >> 4) << 1); if (this->unk_3c != tmp) { this->unk_3c = tmp; - gScreen.bg.bg1Updated = 1; + gScreen.bg1.updated = 1; } } @@ -115,19 +115,19 @@ void sub_080580B0(u32 unk1) { tmp = gRoomControls.roomScrollX - gRoomControls.roomOriginX; // r7 tmp = tmp + (tmp >> 3) + (0x400 - gRoomControls.width) / 2; sub_08058004(tmp, gUnk_02006F00, gBG3Buffer); - gScreen.affine.bg3xOffset = tmp & 0xF; - gScreen.affine.bg3yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1); //? - gScreen.affine.bg3Control = 0x1D09; - gScreen.affine.bg3Tilemap = gBG3Buffer; - gScreen.affine.bg3Updated = 1; + gScreen.bg3.xOffset = tmp & 0xF; + gScreen.bg3.yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1); //? + gScreen.bg3.control = 0x1D09; + gScreen.bg3.tilemap = gBG3Buffer; + gScreen.bg3.updated = 1; tmp = gRoomControls.roomScrollX - gRoomControls.roomOriginX; // r7 tmp = tmp + (tmp >> 2) + (0x400 - gRoomControls.width) / 2; sub_08058004(tmp, gUnk_02006F00 + 0x2000, gBG3Buffer + 0x400); - gScreen.bg.bg1xOffset = tmp & 0xF; - gScreen.bg.bg1yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1); //? - gScreen.bg.bg1Control = 0x1E09; - gScreen.bg.bg1Tilemap = gBG3Buffer + 0x400; - gScreen.bg.bg1Updated = 1; + gScreen.bg1.xOffset = tmp & 0xF; + gScreen.bg1.yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1); //? + gScreen.bg1.control = 0x1E09; + gScreen.bg1.tilemap = gBG3Buffer + 0x400; + gScreen.bg1.updated = 1; gScreen.controls.layerFXControl = 0x3C48; gScreen.controls.alphaBlend = 0x609; gScreen.lcd.displayControl |= 0xa00; diff --git a/src/manager/manager9.c b/src/manager/manager9.c index 0cce35fe..7cc81df0 100644 --- a/src/manager/manager9.c +++ b/src/manager/manager9.c @@ -24,7 +24,7 @@ void Manager9_Main(Manager9* this) { sub_08058210(this); if (!this->manager.action) { this->manager.action = 1; - gScreen.bg.bg1Updated = 0; + gScreen.bg1.updated = 0; sub_08052D74(this, sub_08058204, NULL); } } @@ -39,7 +39,7 @@ void sub_08058210(Manager9* this) { return; this->unk_3c = tmp; sub_080582A0(tmp, gUnk_02006F00, gBG3Buffer); - gScreen.bg.bg1Updated = 1; + gScreen.bg1.updated = 1; } u32 sub_08058244(int i) { @@ -48,9 +48,9 @@ u32 sub_08058244(int i) { u32 tmp3; s32 tmp4; tmp = ((gRoomControls.roomScrollY - gRoomControls.roomOriginY) * 0x20) / (gRoomControls.height - 0xa0); - gScreen.bg.bg1yOffset = gRoomControls.roomOriginY + tmp; + gScreen.bg1.yOffset = gRoomControls.roomOriginY + tmp; tmp = (((gRoomControls.roomScrollX - gRoomControls.roomOriginX) * gUnk_081081EC[i]) / (gRoomControls.width - 0xf0)); - gScreen.bg.bg1xOffset = tmp & 0xf; + gScreen.bg1.xOffset = tmp & 0xf; return tmp; } @@ -90,8 +90,8 @@ void sub_08058324(u32 unk) { LoadGfxGroup(unk + 0x36); sub_080582D0(); sub_080582A0(sub_08058244(unk), gUnk_02006F00, gBG3Buffer); - gScreen.bg.bg1Control = 0x1D47; - gScreen.bg.bg1Tilemap = gBG3Buffer; - gScreen.bg.bg1Updated = 1; + gScreen.bg1.control = 0x1D47; + gScreen.bg1.tilemap = gBG3Buffer; + gScreen.bg1.updated = 1; gScreen.lcd.displayControl |= 0x200; } diff --git a/src/manager/managerC.c b/src/manager/managerC.c index e66185f7..abcb9914 100644 --- a/src/manager/managerC.c +++ b/src/manager/managerC.c @@ -287,10 +287,10 @@ void sub_08058D34() { tmp = gScreen.lcd.displayControl; tmp2 = 0; gScreen.lcd.displayControl |= 1; - gScreen.affine.bg2Control = 0xBC82; - gScreen.bg.bg1Control = 0x5E86; - gScreen.bg.bg1xOffset = 0; - gScreen.bg.bg1yOffset = tmp2; + gScreen.bg2.control = 0xBC82; + gScreen.bg1.control = 0x5E86; + gScreen.bg1.xOffset = 0; + gScreen.bg1.yOffset = tmp2; gScreen.controls.layerFXControl = 0x3456; gScreen.controls.alphaBlend = 0x909; gArea.musicIndex = gArea.pMusicIndex; diff --git a/src/npc.c b/src/npc.c index 50e4c7ff..10edf4ce 100644 --- a/src/npc.c +++ b/src/npc.c @@ -1,5 +1,6 @@ #include "global.h" #include "entity.h" +#include "room.h" #include "npc.h" //clang-format off @@ -135,3 +136,36 @@ void (*const gNPCFunctions[][3])(Entity* ent) = { }; //clang-format on const u8 npc_unk[] = { 0x04, 0x05, 0x06, 0x06 }; + +extern u8 gUnk_020342F8; +typedef struct { + u16 unk0; + u16 unk1; + u16 x; + u16 y; +} NPCStruct; +extern NPCStruct gUnk_02031EC0[100]; + +void InitNPC(Entity*); +u32 ReadBit(void*, u32); + +// regalloc +NONMATCH("asm/non_matching/arm_proxy/NPCUpdate.inc", void NPCUpdate(Entity* this)) { + if ((this->currentHealth & 0x7f) && !ReadBit(&gUnk_020342F8, this->currentHealth - 1)) + DeleteThisEntity(); + if (this->action == 0 && (this->flags & ENT_DID_INIT) == 0) + InitNPC(this); + if (!CheckDontUpdate(this)) + gNPCFunctions[this->id][0](this); + if (this->next != NULL) { + if (gNPCFunctions[this->id][1] != NULL) + gNPCFunctions[this->id][1](this); + if ((this->currentHealth & 0x7f) != 0) { + u32 temp = this->currentHealth & 0x7f; + gUnk_02031EC0[temp * 2 - 2].x = this->x.HALF.HI - gRoomControls.roomOriginX; + gUnk_02031EC0[temp * 2 - 2].y = this->y.HALF.HI - gRoomControls.roomOriginY; + } + DrawEntity(this); + } +} +END_NONMATCH diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index d5320463..234a3f7c 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -96,9 +96,9 @@ void sub_0806D0B0(Entity* this) { if (this != NULL) { sub_0806D164(this); } - gScreen.bg.bg1Control = 0x1d47; - gScreen.bg.bg1Tilemap = &gMapDataTopSpecial; - gScreen.bg.bg1Updated = 1; + gScreen.bg1.control = 0x1d47; + gScreen.bg1.tilemap = &gMapDataTopSpecial; + gScreen.bg1.updated = 1; } void sub_0806D0F8(void) { diff --git a/src/npc/phonograph.c b/src/npc/phonograph.c index 38604490..da7478a2 100644 --- a/src/npc/phonograph.c +++ b/src/npc/phonograph.c @@ -32,6 +32,6 @@ void sub_0806EABC(Entity* this, u32 param) { sub_08050384(); sub_08057044(param, &gUnk_020227E8, 0x202020); sub_0805F46C(0x3302, &gUnk_081146B8); - gScreen.bg.bg0Updated = 1; + gScreen.bg0.updated = 1; } #endif diff --git a/src/object.c b/src/object.c index 768c8d12..497c3c37 100644 --- a/src/object.c +++ b/src/object.c @@ -1,5 +1,6 @@ #include "global.h" #include "entity.h" +#include "manager.h" #include "object.h" void (*const gObjectFunctions[])(Entity*) = { @@ -198,3 +199,17 @@ void (*const gObjectFunctions[])(Entity*) = { [ENEMY_ITEM] = EnemyItem, [OBJECT_C1] = ObjectC1, }; + +void InitObject(Entity*); + +void ObjectUpdate(Entity* this) { + if ((this->flags & ENT_DID_INIT) == 0 && this->action == 0) + InitObject(this); + if (this->iframes != 0) + this->iframes++; + if (!CheckDontUpdate(this)) { + gObjectFunctions[this->id](this); + this->bitfield &= ~0x80; + } + DrawEntity(this); +} diff --git a/src/playerItem.c b/src/playerItem.c index 5a373712..c837a29a 100644 --- a/src/playerItem.c +++ b/src/playerItem.c @@ -23,7 +23,6 @@ extern void PlayerItem15(); extern void PlayerItemNulled2(); void (*const gPlayerItemFunctions[])() = { - DeleteEntity, PlayerItemSword, PlayerItemBomb, @@ -50,3 +49,67 @@ void (*const gPlayerItemFunctions[])() = { PlayerItemNulled2, PlayerItemCellOverwriteSet }; + +typedef struct { + u8 unk0; + u8 unk1; + u8 unk2; + u8 unk3; + u8 unk4; + u8 unk5; + u16 unk6; +} ItemFrame; +extern ItemFrame gUnk_08126DA8[]; +extern ItemFrame* gUnk_08126ED8[3]; + +void ItemInit(Entity*); + +void ItemUpdate(Entity* this) { + if ((this->flags & ENT_DID_INIT) == 0 && this->action == 0 && this->subAction == 0) + ItemInit(this); + + if (!CheckDontUpdate(this)) { + gPlayerItemFunctions[this->id](this); + this->bitfield &= ~0x80; + if (this->iframes != 0) { + if (this->iframes > 0) + this->iframes--; + else + this->iframes++; + } + } + DrawEntity(this); +} + +// tiny regalloc +NONMATCH("asm/non_matching/arm_proxy/ItemInit.inc", void ItemInit(Entity* this)) { + ItemFrame* entry; + + entry = &gUnk_08126DA8[this->id]; + if (entry->unk0 == 0xff) { + u32 temp = entry->unk2; + ItemFrame* temp2 = gUnk_08126ED8[entry->unk1]; + entry = &temp2[this->field_0x68.HALF.LO - temp]; + } + + this->palette.raw = ((entry->unk0 & 0xf) << 4) | entry->unk0; + this->damage = entry->unk1; + this->hurtType = entry->unk3; + this->hitType = entry->unk4; + this->spriteIndex = entry->unk5; + if (entry->unk6 == 0) + this->spriteVramOffset = gPlayerEntity.spriteVramOffset; + else + this->spriteVramOffset = entry->unk6 & 0x3ff; + + if (this->animationState == 0) + this->animationState = gPlayerEntity.animationState & 6; + + this->collisionLayer = gPlayerEntity.collisionLayer; + this->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; + this->spritePriority.b0 = gPlayerEntity.spritePriority.b0; + this->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; + this->currentHealth = 1; + this->flags |= ENT_DID_INIT; +} +END_NONMATCH diff --git a/src/sub_080A3B84.c b/src/sub_080A3B84.c index 193dd12f..d3bf3363 100644 --- a/src/sub_080A3B84.c +++ b/src/sub_080A3B84.c @@ -46,12 +46,12 @@ void sub_080A3BD0(void) { LoadGfxGroup(iVar1 + 0x76); gScreen.lcd.displayControl |= 0x1e00; - gScreen.bg.bg1Control = 0x1c01; - gScreen.affine.bg2Control = 0x1d02; - gScreen.affine.bg3Control = 0x1e0b; - gScreen.bg.bg1Updated = 1; - gScreen.affine.bg2Updated = 1; - gScreen.affine.bg3Updated = 1; + gScreen.bg1.control = 0x1c01; + gScreen.bg2.control = 0x1d02; + gScreen.bg3.control = 0x1e0b; + gScreen.bg1.updated = 1; + gScreen.bg2.updated = 1; + gScreen.bg3.updated = 1; sub_080A4528(); sub_080A4398(); sub_0801E738(0); From f70c95f0373d659683840682d327da3db774659c Mon Sep 17 00:00:00 2001 From: theo3 Date: Fri, 12 Nov 2021 00:45:13 -0800 Subject: [PATCH 4/6] loadRoom merge --- asm/code_0804AEB0.s | 179 ------------------------------ asm/code_0804B058.s | 4 +- asm/code_080A5574.s | 8 +- asm/loadRoomEntity.s | 9 +- asm/non_matching/sub_0804DE00.inc | 4 +- include/area.h | 4 +- include/room.h | 13 +-- linker.ld | 5 +- src/loadRoom.c | 163 +++++++++++++++++++++++---- src/loadRoomEntityList.c | 12 -- src/manager/manager28.c | 4 +- src/room.c | 90 +++++++-------- 12 files changed, 202 insertions(+), 293 deletions(-) delete mode 100644 asm/code_0804AEB0.s delete mode 100644 src/loadRoomEntityList.c diff --git a/asm/code_0804AEB0.s b/asm/code_0804AEB0.s deleted file mode 100644 index f81da7cb..00000000 --- a/asm/code_0804AEB0.s +++ /dev/null @@ -1,179 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start RegisterRoomEntity -RegisterRoomEntity: @ 0x0804AEB0 - push {r4, r5, r6, lr} - adds r5, r0, #0 - adds r6, r1, #0 - ldrb r0, [r6, #1] - movs r1, #0xf - adds r2, r1, #0 - ands r2, r0 - ldrb r0, [r6] - adds r4, r1, #0 - ands r4, r0 - ldr r0, [r5] - cmp r0, #0 - bne _0804AEF6 - cmp r2, #0xf - bne _0804AEE0 - ldr r0, _0804AEDC @ =gUnk_081091E4 - adds r0, r4, r0 - ldrb r1, [r0] - adds r0, r5, #0 - bl AppendEntityToList - b _0804AEF6 - .align 2, 0 -_0804AEDC: .4byte gUnk_081091E4 -_0804AEE0: - cmp r2, #8 - bne _0804AEEE - adds r0, r5, #0 - movs r1, #8 - bl AppendEntityToList - b _0804AEF6 -_0804AEEE: - adds r0, r5, #0 - adds r1, r2, #0 - bl AppendEntityToList -_0804AEF6: - adds r1, r5, #0 - adds r1, #0x78 - cmp r4, #9 - bne _0804AF00 - subs r1, #0x48 -_0804AF00: - adds r0, r6, #0 - movs r2, #0x10 - bl MemCopy - pop {r4, r5, r6, pc} - .align 2, 0 - - thumb_func_start sub_0804AF0C -sub_0804AF0C: @ 0x0804AF0C - push {r4, lr} - adds r4, r0, #0 - adds r2, r1, #0 - ldrb r0, [r2, #1] - movs r1, #0xf0 - ands r1, r0 - cmp r1, #0x20 - beq _0804AF40 - cmp r1, #0x20 - bgt _0804AF26 - cmp r1, #0 - beq _0804AF2C - b _0804AF88 -_0804AF26: - cmp r1, #0x40 - beq _0804AF64 - b _0804AF88 -_0804AF2C: - ldr r0, _0804AF3C @ =gRoomControls - ldrh r1, [r0, #6] - ldrh r3, [r2, #8] - adds r1, r1, r3 - strh r1, [r4, #0x2e] - ldrh r0, [r0, #8] - b _0804AF58 - .align 2, 0 -_0804AF3C: .4byte gRoomControls -_0804AF40: - adds r3, r4, #0 - adds r3, #0x6d - ldrb r1, [r3] - movs r0, #0x20 - orrs r0, r1 - strb r0, [r3] - ldr r1, _0804AF60 @ =gRoomControls - ldrh r0, [r1, #6] - ldrh r3, [r2, #8] - adds r0, r0, r3 - strh r0, [r4, #0x2e] - ldrh r0, [r1, #8] -_0804AF58: - ldrh r2, [r2, #0xa] - adds r0, r0, r2 - strh r0, [r4, #0x32] - b _0804AF88 - .align 2, 0 -_0804AF60: .4byte gRoomControls -_0804AF64: - ldr r1, _0804AF8C @ =gRoomControls - ldrh r0, [r1, #6] - ldrh r3, [r2, #8] - adds r0, r0, r3 - strh r0, [r4, #0x2e] - ldrh r0, [r1, #8] - ldrh r1, [r2, #0xa] - adds r0, r0, r1 - strh r0, [r4, #0x32] - ldr r1, [r2, #0xc] - adds r0, r4, #0 - bl StartCutscene - cmp r0, #0 - bne _0804AF88 - adds r0, r4, #0 - bl DeleteEntity -_0804AF88: - pop {r4, pc} - .align 2, 0 -_0804AF8C: .4byte gRoomControls - - thumb_func_start sub_0804AF90 -sub_0804AF90: @ 0x0804AF90 - push {lr} - ldr r0, _0804AFA8 @ =gArea - ldr r1, _0804AFAC @ =0x0000085C - adds r0, r0, r1 - ldr r0, [r0] - ldr r0, [r0, #0x1c] - bl sub_0804AFB0 - bl sub_080A7C7C - pop {pc} - .align 2, 0 -_0804AFA8: .4byte gArea -_0804AFAC: .4byte 0x0000085C - - thumb_func_start sub_0804AFB0 -sub_0804AFB0: @ 0x0804AFB0 - push {r4, lr} - ldr r1, _0804AFD4 @ =gUnk_02017654 - str r0, [r1] - movs r2, #0 - ldr r0, _0804AFD8 @ =gRoomVars - adds r3, r1, #0 - adds r4, r0, #0 - adds r4, #0x6c -_0804AFC0: - lsls r0, r2, #2 - ldr r1, [r3] - adds r0, r0, r1 - ldr r0, [r0] - stm r4!, {r0} - adds r2, #1 - cmp r2, #7 - bls _0804AFC0 - pop {r4, pc} - .align 2, 0 -_0804AFD4: .4byte gUnk_02017654 -_0804AFD8: .4byte gRoomVars - - thumb_func_start sub_0804AFDC -sub_0804AFDC: @ 0x0804AFDC - push {r4, lr} - movs r4, #1 - movs r0, #6 - bl GetCurrentRoomProperty - cmp r0, #0 - beq _0804AFF0 - bl _call_via_r0 - adds r4, r0, #0 -_0804AFF0: - adds r0, r4, #0 - pop {r4, pc} diff --git a/asm/code_0804B058.s b/asm/code_0804B058.s index cd7d2ea9..d8682f83 100644 --- a/asm/code_0804B058.s +++ b/asm/code_0804B058.s @@ -6,14 +6,14 @@ GetCurrentRoomProperty: @ 0x0804B128 push {lr} adds r2, r0, #0 - ldr r0, _0804B138 @ =gUnk_02017654 + ldr r0, _0804B138 @ =gCurrentRoomProperties ldr r1, [r0] cmp r1, #0 bne _0804B13C movs r0, #0 b _0804B166 .align 2, 0 -_0804B138: .4byte gUnk_02017654 +_0804B138: .4byte gCurrentRoomProperties _0804B13C: cmp r2, #0x7f bls _0804B150 diff --git a/asm/code_080A5574.s b/asm/code_080A5574.s index 993c4fa5..663d2755 100644 --- a/asm/code_080A5574.s +++ b/asm/code_080A5574.s @@ -4890,7 +4890,7 @@ sub_080A7250: @ 0x080A7250 adds r0, #0x8b ldrb r0, [r0] strb r0, [r1, #0xc] - ldr r0, _080A731C @ =gUnk_02017654 + ldr r0, _080A731C @ =gCurrentRoomProperties ldr r0, [r0] str r0, [r1, #0x10] ldr r0, _080A7320 @ =gUnk_02025EB0 @@ -4917,7 +4917,7 @@ _080A730C: .4byte gUnk_03000420 _080A7310: .4byte gActiveScriptInfo _080A7314: .4byte gScreenTransition _080A7318: .4byte gPlayerState -_080A731C: .4byte gUnk_02017654 +_080A731C: .4byte gCurrentRoomProperties _080A7320: .4byte gUnk_02025EB0 _080A7324: .4byte gUnk_0200B650 @@ -4983,7 +4983,7 @@ sub_080A73A8: @ 0x080A73A8 _080A73B4: bl DeleteAllEntities bl sub_0805E974 - ldr r1, _080A746C @ =gUnk_02017654 + ldr r1, _080A746C @ =gCurrentRoomProperties ldr r5, _080A7470 @ =gUnk_02032EC0 ldr r0, [r5, #0x10] str r0, [r1] @@ -5058,7 +5058,7 @@ _080A73B4: b _080A74AE .align 2, 0 _080A7468: .4byte gFadeControl -_080A746C: .4byte gUnk_02017654 +_080A746C: .4byte gCurrentRoomProperties _080A7470: .4byte gUnk_02032EC0 _080A7474: .4byte gPlayerState _080A7478: .4byte gUnk_02025EB0 diff --git a/asm/loadRoomEntity.s b/asm/loadRoomEntity.s index 50933176..ebb5bc7f 100644 --- a/asm/loadRoomEntity.s +++ b/asm/loadRoomEntity.s @@ -1,12 +1,4 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - .syntax unified - - .text - - thumb_func_start LoadRoomEntity -LoadRoomEntity: @ 0x0804ADF8 push {r4, r5, r6, r7, lr} adds r4, r0, #0 ldrb r0, [r4] @@ -99,3 +91,4 @@ _0804AEAA: _0804AEAC: pop {r4, r5, r6, r7, pc} .align 2, 0 + .syntax divided diff --git a/asm/non_matching/sub_0804DE00.inc b/asm/non_matching/sub_0804DE00.inc index 9908da61..508dae20 100644 --- a/asm/non_matching/sub_0804DE00.inc +++ b/asm/non_matching/sub_0804DE00.inc @@ -30,14 +30,14 @@ _0804DE32: ldrb r0, [r4, #8] cmp r0, #1 beq _0804DE5C - ldr r1, _0804DE58 @ =gUnk_02017654 + ldr r1, _0804DE58 @ =gCurrentRoomProperties ldr r0, [r5] str r0, [r1] b _0804DECC .align 2, 0 _0804DE50: .4byte Area_HyruleTown _0804DE54: .4byte gSave -_0804DE58: .4byte gUnk_02017654 +_0804DE58: .4byte gCurrentRoomProperties _0804DE5C: movs r0, #0x1c bl SetGlobalFlag diff --git a/include/area.h b/include/area.h index f8e6078e..1b2e0d53 100644 --- a/include/area.h +++ b/include/area.h @@ -23,7 +23,8 @@ typedef struct { u8 unk1A; u8 filler2[13]; u8 field_0x28; - u8 filler4[0x834]; + u8 filler4[0x833]; + void*** field_0x85c; u32 musicIndex; u32 pMusicIndex; u8 filler5[0x20]; @@ -31,6 +32,7 @@ typedef struct { u32 unk3; u32 unk4; } Area; +static_assert(sizeof(Area) == 0x894); extern Area gArea; diff --git a/include/room.h b/include/room.h index b030d8e0..04cc36e0 100644 --- a/include/room.h +++ b/include/room.h @@ -60,20 +60,13 @@ typedef struct { u8 filler4[48]; u8 filler5[28]; u32 greatFairyState; - u32* field_0x6c; - u32* field_0x70; - u32* field_0x74; - u32 field_0x78; - u8 field_0x79[10]; - void* field_0x88; + void* field_0x6c[8]; } RoomVars; // Packets used to store which entities to load in a room typedef struct { - u8 kind : 4; - u8 layer : 4; - u8 flags : 4; - u8 unk : 4; + u8 kind; + u8 flags; u8 id; u8 type; u32 type2; diff --git a/linker.ld b/linker.ld index 03bde6bf..0c415391 100644 --- a/linker.ld +++ b/linker.ld @@ -64,7 +64,7 @@ SECTIONS { . = 0x00011654; gUnk_02011654 = .; . = 0x00012654; gMetatilesTop = .; . = 0x00016654; gUnk_02016654 = .; - . = 0x00017654; gUnk_02017654 = .; + . = 0x00017654; gCurrentRoomProperties = .; . = 0x00017660; gUnk_02017660 = .; . = 0x000176A0; gPaletteBuffer = .; . = 0x000176E0; gUnk_020176E0 = .; @@ -477,9 +477,6 @@ SECTIONS { src/createEnemy.o(.text); src/code_0804AA84.o(.text); asm/code_0804AA84.o(.text); - src/loadRoomEntityList.o(.text); - asm/loadRoomEntity.o(.text); - asm/code_0804AEB0.o(.text); src/loadRoom.o(.text); asm/code_0804B058.o(.text); src/room.o(.text); diff --git a/src/loadRoom.c b/src/loadRoom.c index d60fd088..b7bccd3a 100644 --- a/src/loadRoom.c +++ b/src/loadRoom.c @@ -1,7 +1,9 @@ #include "global.h" +#include "area.h" #include "room.h" #include "flags.h" #include "functions.h" +#include "utils.h" extern void sub_0804B058(EntityData* dat); extern void sub_0801AC98(); @@ -9,11 +11,132 @@ extern u32 sub_08049D1C(u32); extern Entity* LoadRoomEntity(EntityData*); extern void* GetRoomProperty(u32, u32, u32); -extern u32 gUnk_02017654; -extern u32* gAreaTable; +extern void** gCurrentRoomProperties; +extern void*** gAreaTable[]; +extern u8 gUnk_081091E4[]; extern void sub_080186EC(); extern void sub_0804B16C(); +extern void sub_080A7C7C(void); +extern Entity* GetEmptyEntityByKind(u32 kind); + +void RegisterRoomEntity(Entity*, EntityData*); +void sub_0804AF0C(Entity*, EntityData*); +void sub_0804AFB0(void** properties); + +void LoadRoomEntityList(EntityData* listPtr) { + if (listPtr != NULL) { + while (listPtr->kind != 0xFF) { + LoadRoomEntity(listPtr++); + } + } +} + +NONMATCH("asm/loadRoomEntity.s", Entity* LoadRoomEntity(EntityData* dat)) { + int kind; + Entity* v4; + Entity* v5; + + kind = dat->kind & 0xF; + if ((dat->flags & 0xF0) == 0x50 && DeepFindEntityByID(kind, dat->id)) + return NULL; + v4 = GetEmptyEntityByKind(kind); + v5 = v4; + if (v4 != NULL) { + v4->kind = kind; + v4->id = dat->id; + v4->type = dat->type; + RegisterRoomEntity(v4, dat); + if ((dat->flags & 0xF0) != 16) { + v5->type2 = dat->type2; + v5->actionDelay = (dat->type2 & 0xFF00) >> 8; + if (kind == 9) + return v5; + sub_0804AF0C(v5, dat); + if (!v5->next) + return v5; + if ((dat->kind & 0x10) == 0) { + if ((dat->kind & 0x20) != 0) { + v5->collisionLayer = 2; + return v5; + } + if ((gRoomControls.unk6 & 2) == 0) { + sub_08016A30(v5); + } + } + v5->collisionLayer = 1; + } + } + return v5; +} +END_NONMATCH + +void RegisterRoomEntity(Entity* ent, EntityData* dat) { + u32 list; + u32 kind; + void* offset; + + list = dat->flags & 0xF; + kind = dat->kind & 0xF; + if (ent->prev == NULL) { + if (list == 0xF) { + AppendEntityToList(ent, gUnk_081091E4[kind]); + } else if (list == 8) { + AppendEntityToList(ent, 8); + } else { + AppendEntityToList(ent, list); + } + } + offset = &ent->field_0x78; + if (kind == MANAGER) + offset = &ent->y; + MemCopy(dat, offset, sizeof(EntityData)); +} + +void sub_0804AF0C(Entity* ent, EntityData* dat) { + switch (dat->flags & 0xf0) { + case 0x0: + ent->x.HALF.HI = dat->xPos + gRoomControls.roomOriginX; + ent->y.HALF.HI = dat->yPos + gRoomControls.roomOriginY; + break; + case 0x20: + ent->field_0x6c.HALF.HI |= 0x20; + ent->x.HALF.HI = dat->xPos + gRoomControls.roomOriginX; + ent->y.HALF.HI = dat->yPos + gRoomControls.roomOriginY; + break; + case 0x40: + ent->x.HALF.HI = dat->xPos + gRoomControls.roomOriginX; + ent->y.HALF.HI = dat->yPos + gRoomControls.roomOriginY; + if (!StartCutscene(ent, (u16*)dat->spritePtr)) + DeleteEntity(ent); + break; + } +} + +void sub_0804AF90(void) { + sub_0804AFB0(gArea.field_0x85c[7]); + sub_080A7C7C(); +} + +void sub_0804AFB0(void** properties) { + u32 i; + + gCurrentRoomProperties = properties; + for (i = 0; i < 8; ++i) { + gRoomVars.field_0x6c[i] = gCurrentRoomProperties[i]; + } +} + +u32 sub_0804AFDC() { + u32 result; + u32 (*func)(); + + result = 1; + func = (u32(*)())GetCurrentRoomProperty(6); + if (func != NULL) + result = func(); + return result; +} void sub_0804AFF4(void) { void (*func)(); @@ -31,9 +154,6 @@ void sub_0804AFF4(void) { } void LoadRoom(void) { - s32 iVar1; - s32* dat; - LoadRoomEntityList(GetCurrentRoomProperty(1)); LoadRoomEntityList(GetCurrentRoomProperty(0)); @@ -48,10 +168,10 @@ void sub_0804B058(EntityData* dat) { Entity* ent; u32 uVar2; - if ((dat != NULL) && *(u8*)dat != 0xff) { + if ((dat != NULL) && dat->kind != 0xff) { uVar2 = 0; do { - if ((uVar2 < 0x20) && ((dat->kind) == 3)) { + if ((uVar2 < 0x20) && ((dat->kind & 0xF) == 3)) { if (sub_08049D1C(uVar2) != 0) { ent = LoadRoomEntity(dat); if ((ent != NULL) && (ent->kind == 3)) { @@ -63,7 +183,7 @@ void sub_0804B058(EntityData* dat) { } uVar2++; dat++; - } while (*(u8*)dat != 0xff); + } while (dat->kind != 0xff); } } @@ -72,11 +192,9 @@ void sub_0804B0B0(u32 arg0, u32 arg1) { } void SetCurrentRoomPropertyList(u32 area, u32 room) { - u32** arr; - gUnk_02017654 = 0; - arr = &gAreaTable; - if (arr[area] != 0) { - gUnk_02017654 = arr[area][room]; + gCurrentRoomProperties = NULL; + if (gAreaTable[area] != NULL) { + gCurrentRoomProperties = gAreaTable[area][room]; } } @@ -91,17 +209,14 @@ void sub_0804B0E8(u32 arg0, u32 arg1) { } } -// returns multiple types of data? -void* GetRoomProperty(u32 area, u32 room, u32 arg2) { - u32 temp; - u32** arr; - temp = 0; - arr = &gAreaTable; - if (arr[area] != NULL) { - temp = arr[area][room]; - if (temp != 0) { - temp = *(u32*)(arg2 * 4 + temp); +void* GetRoomProperty(u32 area, u32 room, u32 property) { + void** temp; + temp = NULL; + if (gAreaTable[area] != NULL) { + temp = gAreaTable[area][room]; + if (temp != NULL) { + temp = temp[property]; } } - return (void*)temp; + return temp; } diff --git a/src/loadRoomEntityList.c b/src/loadRoomEntityList.c deleted file mode 100644 index f74cc9a6..00000000 --- a/src/loadRoomEntityList.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "global.h" -#include "room.h" - -void extern LoadRoomEntity(EntityData*); - -void LoadRoomEntityList(EntityData* listPtr) { - if (listPtr != NULL) { - while (*(u8*)listPtr != 0xFF) { - LoadRoomEntity(listPtr++); - } - } -} diff --git a/src/manager/manager28.c b/src/manager/manager28.c index b753d038..94ad456a 100644 --- a/src/manager/manager28.c +++ b/src/manager/manager28.c @@ -85,10 +85,10 @@ u32 Manager28_FindMatchingEntities(Manager28* this) { EntityData* tmp = GetCurrentRoomProperty(this->manager.unk_0b); if (!tmp) return 0; - for (; *((u8*)tmp) != 0xFF && !(tmp->kind == 9 && tmp->id == 0x28); tmp++) { + for (; *((u8*)tmp) != 0xFF && !((tmp->kind & 0xf) == 9 && tmp->id == 0x28); tmp++) { Entity* tmp2; u32 i; - if (tmp->kind != 3) + if ((tmp->kind & 0xf) != 3) continue; tmp2 = Manager28_FindMatchingEntity(tmp); if (!tmp2) diff --git a/src/room.c b/src/room.c index c4fa73d2..5590cf8f 100644 --- a/src/room.c +++ b/src/room.c @@ -374,7 +374,7 @@ void sub_0804B78C(void) { } } -extern u32 gUnk_080D6A74[]; +extern u32* gUnk_080D6A74[]; u32 sub_0804B7A8(void) { u32 index; @@ -386,7 +386,7 @@ u32 sub_0804B7A8(void) { index = 0; SetLocalFlag(1); } - gRoomVars.field_0x78 = gUnk_080D6A74[index]; + gRoomVars.field_0x6c[3] = gUnk_080D6A74[index]; return 1; } @@ -402,7 +402,7 @@ void sub_0804B7E8(void) { } } -extern u32 gUnk_080D6B18[]; +extern u32* gUnk_080D6B18[]; u32 sub_0804B82C(void) { u32 index; @@ -414,7 +414,7 @@ u32 sub_0804B82C(void) { index = 0; SetLocalFlag(2); } - gRoomVars.field_0x78 = gUnk_080D6B18[index]; + gRoomVars.field_0x6c[3] = gUnk_080D6B18[index]; return 1; } @@ -428,7 +428,7 @@ void sub_0804B86C(void) { } } -extern u32 gUnk_080D6BB8[]; +extern u32* gUnk_080D6BB8[]; u32 sub_0804B8B0(void) { s32 index; @@ -440,7 +440,7 @@ u32 sub_0804B8B0(void) { index = 0; SetLocalFlag(3); } - gRoomVars.field_0x78 = gUnk_080D6BB8[index]; + gRoomVars.field_0x6c[3] = gUnk_080D6BB8[index]; return 1; } @@ -555,8 +555,8 @@ extern u32 gUnk_080D7348; u32 sub_0804BA9C(void) { if (CheckGlobalFlag(ENDING)) { - gRoomVars.field_0x6c = &gUnk_080D7348; - gRoomVars.field_0x74 = 0; + gRoomVars.field_0x6c[0] = &gUnk_080D7348; + gRoomVars.field_0x6c[2] = 0; } return 1; } @@ -587,8 +587,8 @@ extern u32 gUnk_080D7410; u32 sub_0804BB18(void) { if (CheckGlobalFlag(ENDING)) { - gRoomVars.field_0x6c = &gUnk_080D7410; - gRoomVars.field_0x74 = 0; + gRoomVars.field_0x6c[0] = &gUnk_080D7410; + gRoomVars.field_0x6c[2] = 0; } return 1; } @@ -1221,7 +1221,7 @@ extern u32 gUnk_080DA230; u32 sub_0804C3CC(void) { if (!CheckLocalFlag(0x39)) - gRoomVars.field_0x6c = &gUnk_080DA230; + gRoomVars.field_0x6c[0] = &gUnk_080DA230; return 1; } @@ -1594,7 +1594,7 @@ extern u32 gUnk_080DB910; u32 sub_0804C730(void) { if (CheckGlobalFlag(MIZUKAKI_START) && !CheckLocalFlag(0x73)) { - gRoomVars.field_0x70 = &gUnk_080DB910; + gRoomVars.field_0x6c[1] = &gUnk_080DB910; } return 1; } @@ -2454,7 +2454,7 @@ extern u32 gUnk_080E103C; u32 sub_0804CE80(void) { if (CheckGlobalFlag(LV2_CLEAR)) { - gRoomVars.field_0x70 = &gUnk_080E103C; + gRoomVars.field_0x6c[1] = &gUnk_080E103C; } return 1; } @@ -2516,7 +2516,7 @@ void sub_0804CED8(void) { if (CheckGlobalFlag(LV2_CLEAR)) { gUnk_0200B650 = 0; - gScreen.lcd.displayControl &= 0xfdff; + gScreen.lcd.displayControl &= ~DISPCNT_BG1_ON; sub_0807AABC(&gPlayerEntity); LoadRoomEntityList(&gUnk_080E1814); } else { @@ -3769,16 +3769,16 @@ extern u32 gUnk_080EB5D4; u32 sub_0804D904(void) { if (CheckGlobalFlag(ENDING)) { - gRoomVars.field_0x6c = &gUnk_080EB604; - gRoomVars.field_0x74 = 0; + gRoomVars.field_0x6c[0] = &gUnk_080EB604; + gRoomVars.field_0x6c[2] = 0; gArea.musicIndex = gArea.pMusicIndex = 0x11; } else if (CheckLocalFlag(0x79)) { - gRoomVars.field_0x6c = NULL; + gRoomVars.field_0x6c[0] = NULL; if (!CheckLocalFlag(0x7a)) { SetGlobalFlag(ZELDA_CHASE); - gRoomVars.field_0x6c = &gUnk_080EB5D4; - gRoomVars.field_0x88 = sub_0804D9B0; - gRoomVars.field_0x74 = 0; + gRoomVars.field_0x6c[0] = &gUnk_080EB5D4; + gRoomVars.field_0x6c[7] = sub_0804D9B0; + gRoomVars.field_0x6c[2] = 0; } } return 1; @@ -3841,8 +3841,8 @@ void nullsub_331() { u32 sub_0804DA2C(void) { if (!CheckLocalFlag(0x77)) { - gRoomVars.field_0x6c = 0; - gRoomVars.field_0x74 = 0; + gRoomVars.field_0x6c[0] = 0; + gRoomVars.field_0x6c[2] = 0; } return 1; } @@ -4034,7 +4034,7 @@ void nullsub_348() { u32 sub_0804DBC0(void) { if (CheckLocalFlag(0x79)) { - gRoomVars.field_0x74 = 0; + gRoomVars.field_0x6c[2] = 0; } return 1; } @@ -4067,8 +4067,8 @@ extern u32 gUnk_080ED1E4; u32 sub_0804DC28(void) { if (CheckGlobalFlag(ENDING)) { - gRoomVars.field_0x6c = &gUnk_080ED1E4; - gRoomVars.field_0x74 = 0; + gRoomVars.field_0x6c[0] = &gUnk_080ED1E4; + gRoomVars.field_0x6c[2] = 0; } return 1; } @@ -4228,8 +4228,8 @@ void nullsub_371() { u32 sub_0804DD18(void) { if (CheckLocalFlag(0x79)) { - gRoomVars.field_0x74 = 0; - gRoomVars.field_0x6c = 0; + gRoomVars.field_0x6c[2] = 0; + gRoomVars.field_0x6c[0] = 0; } return 1; } @@ -4253,7 +4253,7 @@ void nullsub_372() { u32 sub_0804DD78(void) { if (CheckLocalFlag(0x79)) { - gRoomVars.field_0x74 = 0; + gRoomVars.field_0x6c[2] = 0; } return 1; } @@ -4506,7 +4506,7 @@ u32 sub_0804E25C(void) { // four sword if (GetInventoryValue(0x6)) { - gRoomVars.field_0x70 = &gUnk_080F09A0; + gRoomVars.field_0x6c[1] = &gUnk_080F09A0; } return 1; } @@ -4989,9 +4989,9 @@ extern u32 gUnk_080F3EA4; u32 sub_0804E998(void) { if (CheckGlobalFlag(LV4_CLEAR) && !CheckLocalFlag(4)) { - gRoomVars.field_0x74 = &gUnk_080F3EA4; + gRoomVars.field_0x6c[2] = &gUnk_080F3EA4; } else { - gRoomVars.field_0x74 = &gUnk_080F3D44; + gRoomVars.field_0x6c[2] = &gUnk_080F3D44; } return 1; } @@ -5144,8 +5144,8 @@ extern u32 gUnk_080F4EB0; u32 sub_0804EBDC(void) { if (CheckGlobalFlag(ENDING)) { - gRoomVars.field_0x6c = &gUnk_080F4EB0; - gRoomVars.field_0x74 = NULL; + gRoomVars.field_0x6c[0] = &gUnk_080F4EB0; + gRoomVars.field_0x6c[2] = NULL; } return 1; } @@ -5206,9 +5206,9 @@ extern u32 gUnk_080F5348; u32 sub_0804ECBC(void) { if (CheckGlobalFlag(ENDING)) { - gRoomVars.field_0x6c = &gUnk_080F5348; - gRoomVars.field_0x88 = sub_0804ED18; - gRoomVars.field_0x74 = NULL; + gRoomVars.field_0x6c[0] = &gUnk_080F5348; + gRoomVars.field_0x6c[7] = sub_0804ED18; + gRoomVars.field_0x6c[2] = NULL; } return 1; } @@ -5685,7 +5685,7 @@ extern u32 gUnk_080F7680; u32 sub_0804f308(void) { if (GetInventoryValue(0x11) && !GetInventoryValue(0x12)) { - gRoomVars.field_0x74 = &gUnk_080F7680; + gRoomVars.field_0x6c[2] = &gUnk_080F7680; } return 1; } @@ -5747,17 +5747,17 @@ extern void sub_0804F4E4(); u32 Vars_HyruleField_OutsideCastle(void) { if (CheckGlobalFlag(TABIDACHI) && !GetInventoryValue(0x11)) { - gRoomVars.field_0x6c = &gUnk_080F7CD0; - gRoomVars.field_0x88 = sub_0804F5E8; + gRoomVars.field_0x6c[0] = &gUnk_080F7CD0; + gRoomVars.field_0x6c[7] = sub_0804F5E8; } #if defined(JP) || defined(EU) || defined(DEMO_JP) if (CheckGlobalFlag(LV2_CLEAR) && GetInventoryValue(0x3) && !CheckLocalFlag(0x8a)) { #else if (CheckGlobalFlag(LV2_CLEAR) && GetInventoryValue(0x3) && !CheckLocalFlag(0x8c)) { #endif - gRoomVars.field_0x6c = &gUnk_080F7C80; - gRoomVars.field_0x88 = sub_0804F4E4; - gRoomVars.field_0x74 = NULL; + gRoomVars.field_0x6c[0] = &gUnk_080F7C80; + gRoomVars.field_0x6c[7] = sub_0804F4E4; + gRoomVars.field_0x6c[2] = NULL; } #ifndef EU if (CheckGlobalFlag(TABIDACHI)) { @@ -6273,7 +6273,7 @@ extern u32 gUnk_080F9BF8; u32 sub_0804FC4C(void) { if (!CheckKinstoneFused(0xe)) { - gRoomVars.field_0x6c = &gUnk_080F9BF8; + gRoomVars.field_0x6c[0] = &gUnk_080F9BF8; } return 1; } @@ -6559,8 +6559,8 @@ extern u32 gUnk_080FAD48; u32 sub_0804FDE0(void) { if (CheckGlobalFlag(ENDING)) { - gRoomVars.field_0x6c = &gUnk_080FAD48; - gRoomVars.field_0x74 = NULL; + gRoomVars.field_0x6c[0] = &gUnk_080FAD48; + gRoomVars.field_0x6c[2] = NULL; } return 1; } From ecc8a1439ddeedd458af5427711e07e146ed4612 Mon Sep 17 00:00:00 2001 From: theo3 Date: Fri, 12 Nov 2021 01:34:34 -0800 Subject: [PATCH 5/6] remove redundant unions --- asm/non_matching/collision/sub_0801802C.inc | 2 +- include/entity.h | 35 +-- src/code_0805436C.c | 4 +- src/code_08077DF4.c | 2 +- src/collision.c | 36 +-- src/coord.c | 2 +- src/enemy/acroBandits.c | 135 +++++----- src/enemy/beetle.c | 38 +-- src/enemy/bladeTrap.c | 6 +- src/enemy/bobomb.c | 18 +- src/enemy/bombPeahat.c | 50 ++-- src/enemy/bowMoblin.c | 2 +- src/enemy/businessScrub.c | 18 +- src/enemy/chaser.c | 2 +- src/enemy/chuchu.c | 90 +++---- src/enemy/cuccoChickAggr.c | 12 +- src/enemy/darkNut.c | 95 ++++--- src/enemy/doorMimic.c | 6 +- src/enemy/enemy4D.c | 4 +- src/enemy/enemyE.c | 2 +- src/enemy/fallingBoulder.c | 12 +- src/enemy/fireballGuy.c | 12 +- src/enemy/gibdo.c | 12 +- src/enemy/gyorgMale.c | 44 ++-- src/enemy/hangingSeed.c | 2 +- src/enemy/helmasaur.c | 8 +- src/enemy/keaton.c | 16 +- src/enemy/keese.c | 6 +- src/enemy/lakitu.c | 38 +-- src/enemy/lakituCloud.c | 14 +- src/enemy/leever.c | 14 +- src/enemy/likeLike.c | 20 +- src/enemy/madderpillar.c | 36 +-- src/enemy/mazaalBracelet.c | 272 ++++++++++---------- src/enemy/mazaalHand.c | 2 +- src/enemy/mazaalHead.c | 24 +- src/enemy/mazaalMacro.c | 20 +- src/enemy/miniFireballGuy.c | 8 +- src/enemy/miniSlime.c | 6 +- src/enemy/moldorm.c | 16 +- src/enemy/moldworm.c | 90 +++---- src/enemy/octorok.c | 10 +- src/enemy/peahat.c | 32 +-- src/enemy/pesto.c | 82 +++--- src/enemy/puffstool.c | 28 +- src/enemy/rockChuchu.c | 8 +- src/enemy/rollobite.c | 28 +- src/enemy/rope.c | 8 +- src/enemy/rupeeLike.c | 34 +-- src/enemy/slime.c | 10 +- src/enemy/sluggula.c | 22 +- src/enemy/smallPesto.c | 12 +- src/enemy/spark.c | 4 +- src/enemy/spearMoblin.c | 16 +- src/enemy/spikedBeetle.c | 4 +- src/enemy/spinyChuchu.c | 34 +-- src/enemy/tektite.c | 24 +- src/enemy/tektiteGolden.c | 22 +- src/enemy/treeItem.c | 2 +- src/enemy/vaatiArm.c | 82 +++--- src/enemy/vaatiBall.c | 44 ++-- src/enemy/vaatiEyesMacro.c | 24 +- src/enemy/vaatiProjectile.c | 30 +-- src/enemy/vaatiRebornEnemy.c | 52 ++-- src/enemy/vaatiTransfigured.c | 68 ++--- src/enemy/vaatiTransfiguredEye.c | 26 +- src/enemy/vaatiWrath.c | 64 ++--- src/enemy/vaatiWrathEye.c | 26 +- src/enemy/wallMaster.c | 48 ++-- src/enemy/wallMaster2.c | 18 +- src/enemy/waterDrop.c | 8 +- src/enemy/wisp.c | 10 +- src/entity.c | 4 +- src/game.c | 6 +- src/interrupts.c | 2 +- src/intro.c | 4 +- src/item/itemJarEmpty.c | 2 +- src/item/itemMoleMitts.c | 2 +- src/item/itemOcarina.c | 2 +- src/item/itemRocsCape.c | 16 +- src/manager/manager1.c | 20 +- src/manager/manager15.c | 2 +- src/manager/manager1C.c | 2 +- src/manager/manager2C.c | 2 +- src/manager/manager33.c | 4 +- src/manager/manager37.c | 2 +- src/manager/manager6.c | 3 +- src/manager/managerA.c | 2 +- src/manager/managerC.c | 2 +- src/npc.c | 6 +- src/npc/anju.c | 4 +- src/npc/beedle.c | 6 +- src/npc/bigGoron.c | 18 +- src/npc/bladeBrothers.c | 14 +- src/npc/brocco.c | 6 +- src/npc/carlov.c | 8 +- src/npc/carpenter.c | 6 +- src/npc/castleMaid.c | 6 +- src/npc/castorWildsStatue.c | 2 +- src/npc/cat.c | 59 ++--- src/npc/cow.c | 10 +- src/npc/cucco.c | 2 +- src/npc/cuccoChick.c | 4 +- src/npc/dampe.c | 4 +- src/npc/din.c | 4 +- src/npc/dog.c | 8 +- src/npc/drLeft.c | 2 +- src/npc/epona.c | 4 +- src/npc/ezloCap.c | 10 +- src/npc/farmers.c | 8 +- src/npc/farore.c | 4 +- src/npc/festari.c | 6 +- src/npc/forestMinish.c | 10 +- src/npc/gentari.c | 4 +- src/npc/ghostBrothers.c | 8 +- src/npc/gina.c | 4 +- src/npc/gorman.c | 2 +- src/npc/goron.c | 10 +- src/npc/goronMerchant.c | 2 +- src/npc/gregal.c | 14 +- src/npc/guard.c | 2 +- src/npc/hurdyGurdyMan.c | 4 +- src/npc/kid.c | 6 +- src/npc/kingDaltus.c | 6 +- src/npc/kingGustaf.c | 4 +- src/npc/librari.c | 4 +- src/npc/mailbox.c | 6 +- src/npc/malon.c | 6 +- src/npc/mama.c | 8 +- src/npc/mayorHagen.c | 2 +- src/npc/melari.c | 12 +- src/npc/milkCart.c | 2 +- src/npc/ministerPotho.c | 6 +- src/npc/mountainMinish.c | 2 +- src/npc/mutoh.c | 6 +- src/npc/nayru.c | 4 +- src/npc/npc23.c | 2 +- src/npc/npc26.c | 4 +- src/npc/npc4E.c | 2 +- src/npc/npc5.c | 26 +- src/npc/npc58.c | 2 +- src/npc/npc9.c | 4 +- src/npc/percy.c | 6 +- src/npc/phonograph.c | 2 +- src/npc/picolyteBottle.c | 8 +- src/npc/pina.c | 6 +- src/npc/pita.c | 2 +- src/npc/postman.c | 18 +- src/npc/rem.c | 30 +-- src/npc/sittingPerson.c | 10 +- src/npc/smallTownMinish.c | 4 +- src/npc/smith.c | 12 +- src/npc/stamp.c | 4 +- src/npc/stockwell.c | 6 +- src/npc/sturgeon.c | 6 +- src/npc/talon.c | 6 +- src/npc/teachers.c | 6 +- src/npc/tingleSiblings.c | 8 +- src/npc/townMinish.c | 12 +- src/npc/townsperson.c | 22 +- src/npc/vaati.c | 8 +- src/npc/vaatiReborn.c | 12 +- src/npc/windTribespeople.c | 8 +- src/npc/zelda.c | 20 +- src/npc/zeldaFollower.c | 8 +- src/object/archway.c | 2 +- src/object/backgroundCloud.c | 2 +- src/object/bakerOven.c | 8 +- src/object/bell.c | 2 +- src/object/bigVortex.c | 8 +- src/object/bird.c | 18 +- src/object/book.c | 12 +- src/object/button.c | 14 +- src/object/chestSpawner.c | 2 +- src/object/cloud.c | 4 +- src/object/fan.c | 2 +- src/object/fileScreenObjects.c | 34 +-- src/object/giantLeaf.c | 2 +- src/object/greatFairy.c | 40 +-- src/object/heartContainer.c | 4 +- src/object/hiddenLadderDown.c | 4 +- src/object/houseDoorExterior.c | 4 +- src/object/itemOnGround.c | 48 ++-- src/object/jailBars.c | 4 +- src/object/jarPortal.c | 18 +- src/object/lightableSwitch.c | 6 +- src/object/lilypadSmall.c | 10 +- src/object/lockedDoor.c | 8 +- src/object/mask.c | 6 +- src/object/metalDoor.c | 8 +- src/object/minecart.c | 16 +- src/object/minishLight.c | 2 +- src/object/minishSizedEntrance.c | 6 +- src/object/object1A.c | 12 +- src/object/object1C.c | 2 +- src/object/object2A.c | 4 +- src/object/object49.c | 58 ++--- src/object/object7E.c | 10 +- src/object/object86.c | 10 +- src/object/object9E.c | 2 +- src/object/objectA2.c | 12 +- src/object/objectA8.c | 2 +- src/object/objectAF.c | 6 +- src/object/objectB2.c | 6 +- src/object/pinwheel.c | 2 +- src/object/pot.c | 10 +- src/object/railtrack.c | 2 +- src/object/smoke.c | 4 +- src/object/thoughtBubble.c | 4 +- src/object/treeHidingPortal.c | 2 +- src/object/warpPoint.c | 16 +- src/object/windTribeFlag.c | 4 +- src/player.c | 118 ++++----- src/playerItem.c | 54 ++-- src/playerItem/playerItem10.c | 8 +- src/playerItem/playerItem11.c | 24 +- src/playerItem/playerItem12.c | 2 +- src/playerItem/playerItem14.c | 2 +- src/playerItem/playerItem15.c | 2 +- src/playerItem/playerItemBomb.c | 2 +- src/playerItem/playerItemGustJar.c | 8 +- src/playerItem/playerItemSwordBeam.c | 6 +- src/projectile/arrowProjectile.c | 12 +- src/projectile/ballAndChain.c | 2 +- src/projectile/boneProjectile.c | 8 +- src/projectile/cannonballProjectile.c | 6 +- src/projectile/darkNutSwordSlash.c | 6 +- src/projectile/dekuSeedProjectile.c | 6 +- src/projectile/dirtBallProjectile.c | 28 +- src/projectile/fireProjectile.c | 4 +- src/projectile/gleerokProjectile.c | 16 +- src/projectile/guardLineOfSight.c | 4 +- src/projectile/gyorgMaleEnergyProjectile.c | 2 +- src/projectile/gyorgTail.c | 32 +-- src/projectile/iceProjectile.c | 4 +- src/projectile/keatonDagger.c | 2 +- src/projectile/lakituCloudProjectile.c | 2 +- src/projectile/lakituLightning.c | 4 +- src/projectile/mandiblesProjectile.c | 31 ++- src/projectile/mazaalEnergyBeam.c | 8 +- src/projectile/moblinSpear.c | 2 +- src/projectile/octorokBossProjectile.c | 24 +- src/projectile/projectile5.c | 2 +- src/projectile/rockProjectile.c | 6 +- src/projectile/spiderWeb.c | 15 +- src/projectile/stalfosProjectile.c | 12 +- src/projectile/v1DarkMagicProjectile.c | 28 +- src/projectile/v1EyeLaser.c | 4 +- src/projectile/v1FireProjectile.c | 10 +- src/projectile/v2Projectile.c | 6 +- src/projectile/v3ElectricProjectile.c | 10 +- src/projectile/v3HandProjectile.c | 4 +- src/projectile/v3TennisBallProjectile.c | 4 +- src/projectile/windProjectile.c | 4 +- src/projectile/winder.c | 4 +- src/script.c | 28 +- src/textbox.c | 2 +- 257 files changed, 1894 insertions(+), 1923 deletions(-) diff --git a/asm/non_matching/collision/sub_0801802C.inc b/asm/non_matching/collision/sub_0801802C.inc index 66be3cf4..2e766839 100644 --- a/asm/non_matching/collision/sub_0801802C.inc +++ b/asm/non_matching/collision/sub_0801802C.inc @@ -72,4 +72,4 @@ _080180AE: .align 2, 0 _080180B4: .4byte 0x000011AA _080180B8: .4byte gCollisionMtx - .syntax divided \ No newline at end of file + .syntax divided diff --git a/include/entity.h b/include/entity.h index 96735a0d..432cea17 100644 --- a/include/entity.h +++ b/include/entity.h @@ -58,16 +58,13 @@ typedef struct Entity { /*0x15*/ u8 direction; /*0x16*/ u8 field_0x16; /*0x17*/ u8 field_0x17; - /*0x18*/ union { - /* */ u8 raw; - /* */ struct { - /* */ u32 draw : 2; // 1-2 - /* */ u32 ss2 : 1; // 4 - /* */ u32 ss3 : 1; // 8 - /* */ u32 shadow : 2; //0x10-0x20 - /* */ u32 flipX : 1; //0x40 - /* */ u32 flipY : 1; //0x80 - /* */ } PACKED b; + /*0x18*/ struct { + /* */ u32 draw : 2; // 1-2 + /* */ u32 ss2 : 1; // 4 + /* */ u32 ss3 : 1; // 8 + /* */ u32 shadow : 2; //0x10-0x20 + /* */ u32 flipX : 1; //0x40 + /* */ u32 flipY : 1; //0x80 /* */ } PACKED spriteSettings; /*0x19*/ struct { /* */ u32 b0 : 2; // 1-2 @@ -91,7 +88,7 @@ typedef struct Entity { /*0x1d*/ u8 field_0x1d; /*0x1e*/ u8 frameIndex; /*0x1f*/ u8 lastFrameIndex; - /*0x20*/ s32 hVelocity; + /*0x20*/ s32 zVelocity; /*0x24*/ s16 speed; /*0x26*/ u8 spriteAnimation[3]; /*0x29*/ struct { @@ -102,7 +99,7 @@ typedef struct Entity { /*0x2a*/ u16 collisions; /*0x2c*/ union SplitWord x; /*0x30*/ union SplitWord y; - /*0x34*/ union SplitWord height; // todo + /*0x34*/ union SplitWord z; /*0x38*/ u8 collisionLayer; /*0x39*/ s8 interactType; /*0x3a*/ u8 field_0x3a; @@ -116,23 +113,15 @@ typedef struct Entity { /*0x42*/ u8 knockbackDuration; /*0x43*/ u8 field_0x43; /*0x44*/ u8 damage; - /*0x45*/ u8 currentHealth; + /*0x45*/ u8 health; /*0x46*/ u16 field_0x46; /*0x48*/ Hitbox* hitbox; /*0x4c*/ struct Entity* field_0x4c; /*0x50*/ struct Entity* parent; - /*0x54*/ struct Entity* attachedEntity; + /*0x54*/ struct Entity* child; /*0x58*/ u8 animIndex; /*0x59*/ u8 frameDuration; - /*0x5a*/ union { - /* */ u8 all; - /* */ struct { - /* */ u8 f0 : 1; - /* */ u8 f1 : 5; - /* */ u8 f2 : 1; //0x40 - /* */ u8 f3 : 1; //0x80 - /* */ } PACKED b; - /* */ } PACKED frames; + /*0x5a*/ u8 frame; /*0x5b*/ u8 frameSpriteSettings; /*0x5c*/ Frame* animPtr; /*0x60*/ u16 spriteVramOffset; diff --git a/src/code_0805436C.c b/src/code_0805436C.c index 7ec445b3..8eb7df11 100644 --- a/src/code_0805436C.c +++ b/src/code_0805436C.c @@ -251,11 +251,11 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) { } if (arg0->kind == 6) { if (arg0->id == 99) { - arg0->attachedEntity = itemEntity; + arg0->child = itemEntity; } else if (arg0->id == 0x1e) { itemEntity->direction = arg0->animationState << 3 | 0x80; itemEntity->speed = 0xc0; - itementity->hVelocity = 0x18000; + itementity->zVelocity = 0x18000; } } CopyPosition(arg0, itemEntity); diff --git a/src/code_08077DF4.c b/src/code_08077DF4.c index ac1d61e5..89246080 100644 --- a/src/code_08077DF4.c +++ b/src/code_08077DF4.c @@ -40,7 +40,7 @@ void sub_08077E54(ItemBehavior* beh) { ent->action = gPlayerEntity.animIndex; *(u8*)&ent->spriteIndex = gPlayerEntity.frameIndex; ent->subAction = gPlayerEntity.frameDuration; - ent->actionDelay = gPlayerEntity.frames.all; + ent->actionDelay = gPlayerEntity.frame; } void sub_08077E78(ItemBehavior* arg0, u32 bits) { diff --git a/src/collision.c b/src/collision.c index 3a023bda..f43aa72d 100644 --- a/src/collision.c +++ b/src/collision.c @@ -195,7 +195,7 @@ NONMATCH("asm/non_matching/arm_proxy/sub_080177A0.inc", bool32 sub_080177A0(Enti depth = this_d + ((Hitbox3D*)bb_that)->depth; else depth = this_d + 5; - if ((this->height.HALF.HI - that->height.HALF.HI) + depth <= depth * 2) + if ((this->z.HALF.HI - that->z.HALF.HI) + depth <= depth * 2) return TRUE; } } @@ -242,7 +242,7 @@ s32 sub_08017874(Entity* a, Entity* b) { break; } } - v5 = a->currentHealth - v6; + v5 = a->health - v6; if (a->kind == 3) { if ((a->field_0x6c.HALF.HI & 1) != 0) sub_0800449C(a, 295); @@ -266,7 +266,7 @@ void sub_08017940(Entity* org, Entity* tgt) { e->spritePriority.b0 = 2; e->x.HALF.HI = (org->x.HALF.HI + org->hitbox->offset_x + tgt->x.HALF.HI + tgt->hitbox->offset_x) >> 1; e->y.HALF.HI = (org->y.HALF.HI + org->hitbox->offset_y + tgt->y.HALF.HI + tgt->hitbox->offset_y) >> 1; - e->height.HALF.HI = (org->height.HALF.HI + tgt->height.HALF.HI) >> 1; + e->z.HALF.HI = (org->z.HALF.HI + tgt->z.HALF.HI) >> 1; e->collisionLayer = org->collisionLayer; UpdateSpriteForCollisionLayer(e); } @@ -292,7 +292,7 @@ void sub_080179EC(Entity* a1, Entity* a2) { e->spritePriority.b0 = 2; e->spriteOffsetX = (a1->x.HALF.HI + a1->hitbox->offset_x - (a2->x.HALF.HI + a2->hitbox->offset_x)) >> 1; e->spriteOffsetY = (a1->y.HALF.HI + a1->hitbox->offset_y - (a2->y.HALF.HI + a2->hitbox->offset_y)) >> 1; - e->attachedEntity = a2; + e->child = a2; } } @@ -351,7 +351,7 @@ s32 CollisionGroundItem(Entity* org, Entity* tgt, u32 direction, ColSettings* se COLLISION_OFF(tgt); tgt->bitfield = org->hurtType | 0x80; if ((tgt->type == 0x5F || tgt->type == 0x60) && sub_08081420(tgt)) - tgt->currentHealth = 0; + tgt->health = 0; return 2; } @@ -389,13 +389,13 @@ s32 sub_08017BBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) if ((gPlayerState.flags & (0x1 | 0x80 | 0x400 | 0x1000)) == 0) { Entity* e = CreateObject(66, 1, 0); if (e != NULL) { - e->attachedEntity = org; + e->child = org; gPlayerState.flags |= 0x400; org->animationState = (direction ^ 0x10) >> 2; } } tgt->damage = 4; - org->currentHealth = sub_08017874(org, tgt); + org->health = sub_08017874(org, tgt); org->knockbackDuration = 12; org->iframes = 30; org->field_0x46 = 384; @@ -408,7 +408,7 @@ s32 sub_08017C40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) if ((gPlayerState.flags & (0x1 | 0x80 | 0x800 | 0x1000)) == 0 && gPlayerState.playerAction == 0) { if (org->action == 1 || org->action == 24) { tgt->damage = 4; - org->currentHealth = sub_08017874(org, tgt); + org->health = sub_08017874(org, tgt); gPlayerState.flags = 0x800; gPlayerState.playerAction = 13; } @@ -474,7 +474,7 @@ int sub_08017DD4(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) tgt->damage &= ~0x80; else tgt->damage = 4; - gPlayerEntity.currentHealth = sub_08017874(&gPlayerEntity, tgt); + gPlayerEntity.health = sub_08017874(&gPlayerEntity, tgt); tgt->iframes = -12; if ((gPlayerState.flags & 0x80) == 0) { sub_08079D84(); @@ -505,7 +505,7 @@ s32 sub_08017EB0(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) if (org == &gPlayerEntity) { u32 temp = tgt->damage; tgt->damage = 8; - gPlayerEntity.currentHealth = sub_08017874(&gPlayerEntity, tgt); + gPlayerEntity.health = sub_08017874(&gPlayerEntity, tgt); tgt->damage = temp; gPlayerEntity.knockbackDuration = 12; gPlayerEntity.iframes = 16; @@ -540,7 +540,7 @@ s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) gPlayerState.flags |= 0x10u; gPlayerState.jumpStatus = 0; if (tgt->kind == ENEMY && (tgt->id == GHINI || tgt->id == ENEMY_50)) { - org->height.HALF.HI = 0; + org->z.HALF.HI = 0; PositionRelative(org, tgt, 0, 0x10000); } else { PositionRelative(tgt, org, 0, 0x10000); @@ -554,7 +554,7 @@ s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) return 1; } } else { - org->currentHealth = 0; + org->health = 0; } } else if (tgt->kind == 3 && org == &gPlayerEntity) { sub_08004484(tgt, org); @@ -575,13 +575,13 @@ NONMATCH("asm/non_matching/collision/sub_0801802C.inc", goto _0801807A; } else if (kind == 8) { if ((((org->direction ^ 0x10) - 4 * tgt->animationState + 5) & 0x1Fu) <= 0xA) { - org->currentHealth = 0; + org->health = 0; _0801807A: sub_080180BC(org, tgt); return 1; } } else { - org->currentHealth = 0; + org->health = 0; return 0; } x = 0x11aa; @@ -639,7 +639,7 @@ s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) return 1; } } else { - org->currentHealth = 0; + org->health = 0; } } else if ((tgt->kind == 3) && (org == &gPlayerEntity)) { sub_08004484(tgt, &gPlayerEntity); @@ -668,7 +668,7 @@ s32 sub_08018288(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) if (org == &gPlayerEntity) sub_0807AFE8(); else - org->currentHealth = 0; + org->health = 0; return 1; } @@ -704,7 +704,7 @@ s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) tgt->damage = settings->_3; tmp2 = 0xFF; if (settings->_3 != 0) - org->currentHealth = sub_08017874(org, tgt); + org->health = sub_08017874(org, tgt); if (settings->_4 > org->field_0x43) org->field_0x43 = settings->_4; tgt->field_0x46 = 16 * settings->_5; @@ -714,7 +714,7 @@ s32 sub_08018308(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) tgt->knockbackDuration = settings->_7; tmp2 &= org->damage = settings->_8; if (tmp2 != 0) - tgt->currentHealth = sub_08017874(tgt, org); + tgt->health = sub_08017874(tgt, org); if (settings->_9 > tgt->field_0x43) tgt->field_0x43 = settings->_9; } diff --git a/src/coord.c b/src/coord.c index 28dda7c6..82d994ea 100644 --- a/src/coord.c +++ b/src/coord.c @@ -39,7 +39,7 @@ void PositionRelative(Entity* source, Entity* target, s32 offsetX, s32 offsetY) y = source->y.WORD; target->y.WORD = y + offsetY; - target->height = source->height; // ldr + target->z = source->z; // ldr target->collisionLayer = source->collisionLayer; UpdateSpriteForCollisionLayer(target); } diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index dc8fdf95..368606f2 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -53,7 +53,7 @@ void sub_080318DC(Entity* this) { if (this->bitfield != 0x80 && this->bitfield != 0x81) { if (this->type == 1) { if (this->action < 7 && this->knockbackDuration != 0) { - brother = this->attachedEntity; + brother = this->child; if (brother) { brother->parent = this->parent; do { @@ -61,42 +61,42 @@ void sub_080318DC(Entity* this) { brother->spritePriority.b1 = 1; if (brother->iframes == 0) brother->iframes = -12; - } while (brother = brother->attachedEntity, brother != NULL); + } while (brother = brother->child, brother != NULL); } if (this->parent) { - this->parent->attachedEntity = this->attachedEntity; + this->parent->child = this->child; } else { - if (this->attachedEntity) + if (this->child) this->parent = this; } this->action = 9; this->spritePriority.b1 = 1; if (this->knockbackDirection < 0x10) { - this->spriteSettings.b.flipX = 0; + this->spriteSettings.flipX = 0; } else { - this->spriteSettings.b.flipX = 1; + this->spriteSettings.flipX = 1; } InitializeAnimation(this, 14); } - if (this->currentHealth == 0) { + if (this->health == 0) { this->knockbackDirection = ((this->knockbackDirection + (7 & Random())) - 4) & 0x1f; this->knockbackDuration += this->type2 * 3; sub_08032338(this); } } - if (this->knockbackDuration != 0 && this->frames.all & 0x10) { + if (this->knockbackDuration != 0 && this->frame & 0x10) { if (this->type == 0) { this->action = 8; } else { this->action = 9; } if (this->knockbackDirection < 0x10) { - this->spriteSettings.b.flipX = 0; + this->spriteSettings.flipX = 0; } else { - this->spriteSettings.b.flipX = 1; + this->spriteSettings.flipX = 1; } this->spritePriority.b1 = 1; InitializeAnimation(this, 14); @@ -147,7 +147,7 @@ void sub_08031AC8(Entity* this) y = this->field_0x76.HWORD + ((s32)(rand >> 4) % 5) * 0x10 - 0x20; if (sub_080002D4(x, y, this->collisionLayer) == 0) { this->action = 2; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->x.HALF.HI = x; this->y.HALF.HI = y; InitializeAnimation(this, 0); @@ -158,11 +158,11 @@ void sub_08031AC8(Entity* this) void sub_08031B48(Entity* this) { GetNextFrame(this); - if (this->frames.b.f0) { - this->frames.all = 0; + if (this->frame & 1) { + this->frame = 0; COLLISION_ON(this); } else { - if (this->frames.b.f3) { + if (this->frame & 0x80) { this->action = 0x3; this->actionDelay = gUnk_080CE5B0[Random() & 7]; InitializeAnimation(this, 1); @@ -174,15 +174,14 @@ void sub_08031B98(Entity* this) { if (sub_08031E04(this)) { this->action = 5; if (this->x.HALF.HI > gUnk_020000B0->x.HALF.HI) { - this->spriteSettings.b.flipX = 0; + this->spriteSettings.flipX = 0; } else { - this->spriteSettings.b.flipX = 1; + this->spriteSettings.flipX = 1; } InitializeAnimation(this, 3); } else { - if (this->frames.b.f0 && this->actionDelay) { - // this->frames.b.f0 = 0; - this->frames.all &= 0xfe; + if ((this->frame & 1) && this->actionDelay) { + this->frame &= 0xfe; this->actionDelay--; } GetNextFrame(this); @@ -196,10 +195,10 @@ void sub_08031B98(Entity* this) { void sub_08031C1C(Entity* this) { GetNextFrame(this); - if (this->frames.b.f3) { + if (this->frame & 0x80) { this->action = '\x01'; this->actionDelay = gUnk_080CE5B8[Random() & 7]; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } } @@ -207,7 +206,7 @@ void sub_08031C58(Entity* this) { Entity *a, *b; GetNextFrame(this); - if (this->frames.b.f3) { + if (this->frame & 0x80) { if (gEntCount < 0x43) { u32 tmp = Random(); tmp &= 3; @@ -217,33 +216,33 @@ void sub_08031C58(Entity* this) { a->parent = NULL; a->field_0x74.HALF.LO = tmp; sub_08031E48(this, a); - a->attachedEntity = CreateEnemy(ACRO_BANDIT, 1); + a->child = CreateEnemy(ACRO_BANDIT, 1); - b = a->attachedEntity; + b = a->child; b->type2 = 1; b->parent = a; b->field_0x74.HALF.LO = tmp; sub_08031E48(this, b); - b->attachedEntity = CreateEnemy(ACRO_BANDIT, 1); + b->child = CreateEnemy(ACRO_BANDIT, 1); - a = b->attachedEntity; + a = b->child; a->type2 = 2; a->parent = b; a->field_0x74.HALF.LO = tmp; sub_08031E48(this, a); - a->attachedEntity = CreateEnemy(ACRO_BANDIT, 1); + a->child = CreateEnemy(ACRO_BANDIT, 1); - b = a->attachedEntity; + b = a->child; b->type2 = 3; b->parent = a; b->field_0x74.HALF.LO = tmp; sub_08031E48(this, b); - b->attachedEntity = CreateEnemy(ACRO_BANDIT, 1); + b->child = CreateEnemy(ACRO_BANDIT, 1); - a = b->attachedEntity; + a = b->child; a->type2 = 4; a->parent = b; - a->attachedEntity = NULL; + a->child = NULL; a->field_0x74.HALF.LO = tmp; sub_08031E48(this, a); @@ -253,8 +252,8 @@ void sub_08031C58(Entity* this) { InitializeAnimation(this, 7); } } else { - if (this->frames.b.f0) { - this->frames.all = 0; + if (this->frame & 1) { + this->frame = 0; COLLISION_OFF(this); } } @@ -266,7 +265,7 @@ void sub_08031D70(Entity* this) { this->action = 7; COLLISION_OFF(this); this->actionDelay = 5; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } } @@ -282,13 +281,13 @@ void sub_08031DA0(Entity* this) { } void sub_08031DC4(Entity* this) { - if (this->frames.b.f3) { + if (this->frame & 0x80) { this->action = 1; this->actionDelay = 0xb4; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } else { GetNextFrame(this); - if ((this->frames.all & 0xf) == 2) { + if ((this->frame & 0xf) == 2) { COLLISION_OFF(this); } } @@ -302,7 +301,7 @@ u32 sub_08031E04(Entity* this) { if (ent == NULL) return 0; - tmp = &gUnk_080CE5C0[this->frames.all & 6]; + tmp = &gUnk_080CE5C0[this->frame & 6]; return sub_0806FCB8(this, ent->x.HALF.HI + tmp[0], ent->y.HALF.HI + tmp[1], 0x50); } @@ -323,8 +322,8 @@ void sub_08031E90(Entity* this) { void sub_08031EA8(Entity* this) { this->action = 1; this->spritePriority.b1 = 1; - this->hVelocity = 0x40000; - this->height.HALF.HI = (4 - this->type2) * 0xe; + this->zVelocity = 0x40000; + this->z.HALF.HI = (4 - this->type2) * 0xe; this->field_0x78.HALF.HI = Random(); InitializeAnimation(this, 4); } @@ -332,22 +331,22 @@ void sub_08031EA8(Entity* this) { void sub_08031EE8(Entity* this) { int draw; - this->height.WORD -= this->hVelocity; - this->hVelocity -= 0x1800; + this->z.WORD -= this->zVelocity; + this->zVelocity -= 0x1800; - if (this->height.HALF.HI < 1) { - draw = this->spriteSettings.b.draw; + if (this->z.HALF.HI < 1) { + draw = this->spriteSettings.draw; if (!draw) EnqueueSFX(299); - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } - draw = this->spriteSettings.b.draw; + draw = this->spriteSettings.draw; if (draw == 1) GetNextFrame(this); - if (this->hVelocity < 1) { + if (this->zVelocity < 1) { this->action = 2; COLLISION_ON(this); InitializeAnimation(this, 5); @@ -356,10 +355,10 @@ void sub_08031EE8(Entity* this) { void sub_08031F54(Entity* this) { sub_08003FC4(this, gUnk_080CE5F0[this->type2]); - if (this->type2 * -0xe <= this->height.HALF.HI) { + if (this->type2 * -0xe <= this->z.HALF.HI) { this->action = 3; this->actionDelay = 20; - this->height.HALF.HI = this->type2 * -0xe; + this->z.HALF.HI = this->type2 * -0xe; if (this->parent != NULL) this->spritePriority.b1 = 0; InitializeAnimation(this, 6); @@ -368,11 +367,11 @@ void sub_08031F54(Entity* this) { void sub_08031FB0(Entity* this) { GetNextFrame(this); - if (this->frames.b.f3 && (this->parent || --this->actionDelay == 0)) { + if ((this->frame & 0x80) && (this->parent || --this->actionDelay == 0)) { this->action = 4; this->direction = sub_08049F84(this, 1); *(u8*)&this->field_0x76 = 0; - if (this->attachedEntity) { + if (this->child) { InitializeAnimation(this, 9); } else { InitializeAnimation(this, 8); @@ -406,7 +405,7 @@ void sub_08032008(Entity* this) { } if (this->direction & 0xf) - this->spriteSettings.b.flipX = (this->direction >> 4 ^ 1); + this->spriteSettings.flipX = (this->direction >> 4 ^ 1); ProcessMovement(this); } else { @@ -445,19 +444,19 @@ void sub_08032160(Entity* this) { dir = gUnk_080CE5FA[this->field_0x74.HALF.LO * 5 + this->type2]; this->direction = dir; if (dir >= 0x10) { - this->spriteSettings.b.flipX = 1; + this->spriteSettings.flipX = 1; } else { - this->spriteSettings.b.flipX = 0; + this->spriteSettings.flipX = 0; } this->speed = 0xf0; - this->hVelocity = 0x12000; + this->zVelocity = 0x12000; this->spritePriority.b1 = 1; InitializeAnimation(this, 12); } - if (this->attachedEntity == NULL) { + if (this->child == NULL) { for (tmp = this->parent; tmp != NULL; tmp = tmp->parent) { - if (tmp->currentHealth != 0) + if (tmp->health != 0) tmp->actionDelay = 0; } this->actionDelay = 0; @@ -473,11 +472,11 @@ void sub_080321E8(Entity* this) { void sub_08032204(Entity* this) { GetNextFrame(this); - if (this->frames.all & 1) { - this->frames.all = 0; + if (this->frame & 1) { + this->frame = 0; this->frameDuration = (Random() & 0x30) + 30; } else { - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 9; InitializeAnimation(this, 13); } @@ -486,14 +485,14 @@ void sub_08032204(Entity* this) { void sub_08032248(Entity* this) { if (sub_08003FC4(this, 0x1800) == 0) { - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { ((Entity*)this->field_0x7c.WORD)->actionDelay--; DeleteEntity(this); } else { GetNextFrame(this); - if ((this->frames.all & 0xf) == 2) + if ((this->frame & 0xf) == 2) COLLISION_OFF(this); } } @@ -506,10 +505,10 @@ void sub_08032290(Entity* this) { } u32 sub_080322A4(Entity* this) { - if (this->attachedEntity != NULL && (this->attachedEntity->height.HALF.HI + 8) >= this->height.HALF.HI) { - if (this->height.HALF.HI) { + if (this->child != NULL && (this->child->z.HALF.HI + 8) >= this->z.HALF.HI) { + if (this->z.HALF.HI) { this->action = 5; - this->height.HALF.HI = this->attachedEntity->height.HALF.HI + 8; + this->z.HALF.HI = this->child->z.HALF.HI + 8; InitializeAnimation(this, 11); return 1; } else { @@ -524,15 +523,15 @@ void sub_080322E8(Entity* this) { u8 tmp; if (this->field_0x78.HALF.LO) { if (--this->field_0x78.HALF.LO == 0) { - u32 flipX = this->spriteSettings.b.flipX; - this->spriteSettings.b.flipX = flipX ^ 1; + u32 flipX = this->spriteSettings.flipX; + this->spriteSettings.flipX = flipX ^ 1; } } else { tmp = this->direction; if (tmp & 0xF) { tmp >>= 4; tmp ^= 1; - if (tmp != this->spriteSettings.b.flipX) { + if (tmp != this->spriteSettings.flipX) { this->field_0x78.HALF.LO = 6; } } diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index 4b1d8429..c1b560d1 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -37,7 +37,7 @@ void sub_08021780(Entity* this) { COLLISION_OFF(this); this->spritePriority.b0 = 3; CopyPositionAndSpriteOffset(&gPlayerEntity, this); - this->height.HALF.HI = -1; + this->z.HALF.HI = -1; ((u8*)&this->field_0x86)[1] = 1; InitializeAnimation(this, 6); } @@ -47,7 +47,7 @@ void sub_08021780(Entity* this) { break; } - if (this->currentHealth == 0) + if (this->health == 0) this->knockbackDuration = 0; sub_0804AA30(this, gUnk_080CB590); @@ -71,7 +71,7 @@ void sub_08021848(Entity* this) { gUnk_080CB5C8[this->subAction](this); } else { this->action = 3; - this->height.HALF.HI = 0; + this->z.HALF.HI = 0; InitializeAnimation(this, 2); } } @@ -102,20 +102,20 @@ void sub_080218B4(Entity* this) { void sub_080218CC(Entity* this) { if (this->subAction == 0) { this->subAction = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f; this->speed = 0x100; - this->hVelocity = 0x12000; + this->zVelocity = 0x12000; } GetNextFrame(this); - if (this->frames.all & 1) { + if (this->frame & 1) { sub_080AEFE0(this); if (sub_080044EC(this, 0x1c00) == 0) this->frameDuration = 1; } - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 2; this->actionDelay = (Random() & 0x38) + 8; this->field_0xf = 1; @@ -129,8 +129,8 @@ void sub_08021984(Entity* this) { if (this->subAction == 0) { this->subAction = 1; COLLISION_ON(this); - this->spriteSettings.b.draw = 3; - this->height.HALF.HI = -0x80; + this->spriteSettings.draw = 3; + this->z.HALF.HI = -0x80; this->spriteRendering.b3 = 1; this->spriteOrientation.flipY = 1; EnqueueSFX(0x12d); @@ -140,7 +140,7 @@ void sub_08021984(Entity* this) { this->action = 2; this->actionDelay = 16; this->field_0xf = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->speed = 0x180; ((u8*)&this->field_0x86)[0] = 60; InitializeAnimation(this, 0); @@ -187,7 +187,7 @@ void sub_08021A64(Entity* this) { void sub_08021AD8(Entity* this) { GetNextFrame(this); - if (this->frames.all & 1) { + if (this->frame & 1) { if (this->actionDelay) { u32 tmp; @@ -207,7 +207,7 @@ void sub_08021AD8(Entity* this) { this->frameDuration = 1; } - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 2; this->actionDelay = 20; ((u8*)&this->field_0x86)[0] = 60; @@ -218,7 +218,7 @@ void sub_08021AD8(Entity* this) { void sub_08021B64(Entity* this) { if (gPlayerState.flags & 4) { this->action = 3; - this->height.WORD = 0; + this->z.WORD = 0; InitializeAnimation(this, 2); } else { int iVar4 = 1; @@ -238,7 +238,7 @@ void sub_08021B64(Entity* this) { if (iVar4 == 0) { this->action = 6; - this->hVelocity = 0x10000; + this->zVelocity = 0x10000; ((u8*)&this->field_0x86)[1] = 0; if (gPlayerEntity.direction != 0xff) { this->direction = 0x10 ^ gPlayerEntity.direction; @@ -252,7 +252,7 @@ void sub_08021B64(Entity* this) { gPlayerState.field_0xaa++; CopyPositionAndSpriteOffset(&gPlayerEntity, this); this->x.HALF.HI += gUnk_080CB5E4[(this->field_0xf++ & 0xe) >> 1]; - this->height.HALF.HI--; + this->z.HALF.HI--; GetNextFrame(this); } } @@ -260,13 +260,13 @@ void sub_08021B64(Entity* this) { void sub_08021C58(Entity* this) { GetNextFrame(this); - if (this->frames.all & 1) { + if (this->frame & 1) { sub_080AEFE0(this); if (sub_08003FC4(this, 0x1800) == 0) this->frameDuration = 1; } - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 2; this->actionDelay = 60; this->field_0xf = 1; @@ -278,7 +278,7 @@ void sub_08021C58(Entity* this) { } void sub_08021CD0(Entity* this) { - if ((this->frames.all & 0x80) == 0) + if ((this->frame & 0x80) == 0) GetNextFrame(this); if (sub_08049F84(this, 1) == 0xff) @@ -299,7 +299,7 @@ u32 sub_08021D00(Entity* this) { } else { this->action = 4; this->actionDelay = 1; - this->hVelocity = 0x18000; + this->zVelocity = 0x18000; InitializeAnimation(this, 4); ret = 1; } diff --git a/src/enemy/bladeTrap.c b/src/enemy/bladeTrap.c index 9f89f8f0..66729fce 100644 --- a/src/enemy/bladeTrap.c +++ b/src/enemy/bladeTrap.c @@ -8,8 +8,8 @@ extern void sub_080A2CC0(); void BladeTrap(Entity* this) { if (this->action == 0) { this->action = 1; - this->attachedEntity = GetCurrentRoomProperty(this->type); - sub_080A2CC0(this, &this->attachedEntity, &this->field_0x74); + this->child = GetCurrentRoomProperty(this->type); + sub_080A2CC0(this, &this->child, &this->field_0x74); } if (!(this->direction & 0x80)) { sub_0806F69C(this); @@ -19,6 +19,6 @@ void BladeTrap(Entity* this) { if (!(this->direction & 0x80)) { EnqueueSFX(0x74); } - sub_080A2CC0(this, &this->attachedEntity, &this->field_0x74.HWORD); + sub_080A2CC0(this, &this->child, &this->field_0x74.HWORD); } } diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index 579a5c4c..b9976950 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -54,7 +54,7 @@ void sub_0802C688(Entity* this) { this->action = 3; this->hitType = 0x6e; this->field_0xf = 1; - this->hVelocity = 0x18000; + this->zVelocity = 0x18000; this->speed = 0; this->field_0x80.HALF.HI = 1; InitializeAnimation(this, this->direction >> 4 | 6); @@ -68,15 +68,15 @@ void sub_0802C7AC(Entity* this) { if (this->subAction < 3 && !sub_0806F520(this)) { this->subAction = 0; this->field_0xf = 1; - this->height.HALF.HI = 0; + this->z.HALF.HI = 0; if (this->field_0x82.HALF.LO != 2) { this->speed = this->field_0x82.HALF.LO ? 0x200 : 0x80; } - this->hVelocity = 0x18000; + this->zVelocity = 0x18000; this->field_0x82.HALF.HI = 0; this->field_0x80.HALF.HI = 0; } else { - this->height.HALF.HI = -1; + this->z.HALF.HI = -1; gUnk_080CD600[this->subAction](this); if (this->actionDelay != 0) { GetNextFrame(this); @@ -135,7 +135,7 @@ void sub_0802C8B8(Entity* this) { void sub_0802C8C4(Entity* this) { sub_0804A7D4(this); - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } void sub_0802C8D8(Entity* this) { @@ -225,7 +225,7 @@ void sub_0802CA94(Entity* this) { COLLISION_OFF(this); this->field_0xf = 1; this->spritePriority.b1 = 1; - this->hVelocity = 0x18000; + this->zVelocity = 0x18000; this->speed = 0; this->field_0x82.HALF.HI = 0; this->field_0x80.HALF.HI = 0; @@ -242,7 +242,7 @@ void sub_0802CAF8(Entity* this) { } sub_0802CC18(this); sub_08078930(this); - if (this->field_0xf && this->height.HALF.HI == 0) { + if (this->field_0xf && this->z.HALF.HI == 0) { this->field_0xf = 0; COLLISION_ON(this); this->hitType = 0x6e; @@ -276,9 +276,9 @@ void sub_0802CBC4(Entity* this) { Entity* ent; this->action = 4; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; COLLISION_OFF(this); - this->currentHealth = 0; + this->health = 0; if (this->field_0x82.HALF.HI) { sub_08079184(); } diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index 9b2b5547..187670e9 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -87,7 +87,7 @@ void sub_0802A8F4(Entity* this) { void sub_0802A8FC(Entity* this) { if ((gPlayerState.field_0x1c & 0xf) == 0) { - this->currentHealth = gPlayerState.field_0x1c & 0xf; + this->health = gPlayerState.field_0x1c & 0xf; } } @@ -96,7 +96,7 @@ void nullsub_143(Entity* this) { } void sub_0802A91C(Entity* this) { - this->currentHealth = 0; + this->health = 0; } void sub_0802A924(Entity* this) { @@ -108,7 +108,7 @@ void sub_0802A924(Entity* this) { #ifdef EU this->field_0x3c |= 0x10; #endif - this->height.HALF.HI = -0x30; + this->z.HALF.HI = -0x30; this->field_0x80.HALF.LO = Random() & 1; this->field_0x82.HWORD = 0; this->field_0x7a.HALF.HI = 0; @@ -140,7 +140,7 @@ void sub_0802A9A8(Entity* this) { if (gRoomControls.unk2 != 0) { return; } - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x82.HWORD = 1; if (this->field_0x80.HALF.LO) { this->x.HALF.HI = gRoomControls.roomScrollX - 0x10; @@ -166,10 +166,10 @@ void sub_0802AA40(Entity* this) { if (this->actionDelay) { this->actionDelay--; } else { - Entity* ent = this->attachedEntity; + Entity* ent = this->child; if (ent) { if (ent->next == NULL) { - this->attachedEntity = NULL; + this->child = NULL; } else { u32 direction = DirectionRound(this->field_0x80.HALF.LO * 0x10 + 0x18); @@ -198,12 +198,12 @@ void sub_0802AAC0(Entity* this) { } if (this->field_0x80.HALF.HI) { - Entity* ent = this->attachedEntity; + Entity* ent = this->child; if (ent == NULL) { this->field_0x80.HALF.HI = 0; } else if (ent->next == NULL) { this->field_0x80.HALF.HI = 0; - this->attachedEntity = NULL; + this->child = NULL; } else if (ent->actionDelay == 0 && ent->field_0xf < 0x51) { this->field_0x80.HALF.HI = 0; } @@ -227,10 +227,10 @@ void sub_0802AB40(Entity* this) { sub_0802AC40(this); switch (this->field_0x78.HALF.LO) { case 0: - if (this->height.HALF.HI) { + if (this->z.HALF.HI) { if (--this->field_0x78.HALF.HI == 0) { this->field_0x78.HALF.HI = 4; - this->height.HALF.HI++; + this->z.HALF.HI++; } } else { this->field_0x78.HALF.LO = 1; @@ -247,10 +247,10 @@ void sub_0802AB40(Entity* this) { } break; case 2: - if (-0x30 < this->height.HALF.HI) { + if (-0x30 < this->z.HALF.HI) { if (--this->field_0x78.HALF.HI == 0) { this->field_0x78.HALF.HI = 4; - this->height.HALF.HI--; + this->z.HALF.HI--; sub_0802ACDC(this, 4); } } else { @@ -264,7 +264,7 @@ void sub_0802AB40(Entity* this) { #endif void sub_0802AC08(Entity* this) { - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 2; this->subAction = 0; this->actionDelay = 0x40; @@ -286,7 +286,7 @@ void sub_0802AC40(Entity* this) { this->field_0x7a.HALF.LO = 0; this->spritePriority.b1 = 0; } else { - if (this->height.HALF.HI == 0) { + if (this->z.HALF.HI == 0) { if (this->spritePriority.b1 != 1) { this->spritePriority.b1 = 1; } @@ -299,7 +299,7 @@ void sub_0802AC40(Entity* this) { } else { if (sub_0802B234(this)) { this->field_0x7a.HALF.LO = 1; - if (this->height.HALF.HI == 0) { + if (this->z.HALF.HI == 0) { this->spritePriority.b1 = 1; } else { this->spritePriority.b1 = 3; @@ -335,19 +335,19 @@ void sub_0802AD1C(Entity* this, u32 param_2) { void sub_0802AD54(Entity* this) { if (this->field_0x82.HWORD != 0) { if (gRoomControls.unk2 != 0) { - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; DeleteEntity(this); return; } if (gRoomControls.roomOriginY > this->y.HALF.HI || (gRoomControls.roomOriginY + gRoomControls.height + 0x20) < this->y.HALF.HI) { - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } else { - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } } if (this->field_0x80.HALF.HI) { - if (this->attachedEntity == NULL || this->attachedEntity->next == NULL) { + if (this->child == NULL || this->child->next == NULL) { this->action = 4; this->actionDelay = 0xc0; this->field_0xf = 4; @@ -365,10 +365,10 @@ void sub_0802ADDC(Entity* this) { if (ent != NULL) { ent->type2 = !!sub_0802B234(this); ent->parent = this; - this->attachedEntity = ent; + this->child = ent; CopyPosition(this, ent); /*#ifdef EU - this->height.HALF.HI += 8; + this->z.HALF.HI += 8; #endif*/ this->field_0x80.HALF.HI = 1; if (this->type == 0) { @@ -381,7 +381,7 @@ void sub_0802ADDC(Entity* this) { void sub_0802AE24(Entity* this) { this->action = 1; this->actionDelay = 0xf0; - this->hVelocity = 0x8000; + this->zVelocity = 0x8000; this->hitbox = (Hitbox*)&gUnk_080CD174; this->field_0x3c = 3; this->field_0x16 = 0; @@ -403,7 +403,7 @@ void sub_0802AE68(Entity* this) { } else { if (ent->field_0x80.HALF.HI) { CopyPosition(ent, this); - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } else { this->action = 3; this->field_0x80.HALF.LO = 1; @@ -539,7 +539,7 @@ void sub_0802B048(Entity* this) { this->action = 4; this->hitbox = (Hitbox*)&gUnk_080CD17C; this->actionDelay = 0xf; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; COLLISION_ON(this); this->field_0x7a.HALF.HI = 0; sub_08078954(this); @@ -621,7 +621,7 @@ Entity* sub_0802B250(Entity* this) { } void sub_0802B264(Entity* this) { - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; if (sub_0802B234(this)) { this->spritePriority.b1 = 3; } else { diff --git a/src/enemy/bowMoblin.c b/src/enemy/bowMoblin.c index 893d7618..c9605ce2 100644 --- a/src/enemy/bowMoblin.c +++ b/src/enemy/bowMoblin.c @@ -26,7 +26,7 @@ void sub_0803C198(Entity* this) { sub_0804AA30(this, gUnk_080CFF78); if ((this->bitfield & 0x80) != 0) { sub_0803C5F0(this); - pEVar1 = this->attachedEntity; + pEVar1 = this->child; if (pEVar1 != NULL) { pEVar1->field_0xf++; } diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index 275b1775..8ade7efb 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -63,7 +63,7 @@ void sub_08028934(Entity* this) { sub_080290E0(this, 4); pEVar1 = CreateFx(this, FX_BUSH, 0); if (pEVar1 != NULL) { - pEVar1->height.HALF.HI -= 8; + pEVar1->z.HALF.HI -= 8; } EnqueueSFX(0x1bb); } @@ -112,7 +112,7 @@ void sub_08028A74(Entity* this) { switch (this->subAction) { case 0: unk = 1; - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->subAction = 1; this->actionDelay = 0x3c; this->field_0xf = 0x10; @@ -138,19 +138,19 @@ void sub_08028A74(Entity* this) { case 2: unk = 1; sub_080290FC(this); - if (this->frames.all & 1) { + if (this->frame & 1) { Entity* ent = CreateProjectileWithParent(this, 4, 0); if (ent != NULL) { ent->parent = this; ent->direction = this->direction; - this->frames.all &= ~1; + this->frame &= ~1; this->subAction = 3; } } break; case 3: unk = 2; - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->subAction = 4; this->actionDelay = 0x50; sub_080290E0(this, 1); @@ -189,7 +189,7 @@ void sub_08028BC4(Entity* this) { switch (this->subAction) { case 0: if (this->actionDelay == 0) { - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->subAction = 1; sub_08028FDC(this); sub_080290E0(this, 5); @@ -200,7 +200,7 @@ void sub_08028BC4(Entity* this) { } break; case 1: - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 4; this->subAction = 0; this->actionDelay = 0x1e; @@ -209,7 +209,7 @@ void sub_08028BC4(Entity* this) { iVar1 = sub_0804A9FC(this, 0x1c); if (iVar1 != NULL) { iVar1->spritePriority.b0 = 3; - iVar1->height.HALF.HI -= 12; + iVar1->z.HALF.HI -= 12; sub_0805E3A0(iVar1, 2); } SetFlag(this->field_0x86.HWORD); @@ -549,7 +549,7 @@ void sub_0802925C(Entity* this) { void sub_08029270(Entity* this) { if (this->action == 0) { this->action++; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 0xe); } else { GetNextFrame(this); diff --git a/src/enemy/chaser.c b/src/enemy/chaser.c index 7e0ac960..869fbfc0 100644 --- a/src/enemy/chaser.c +++ b/src/enemy/chaser.c @@ -63,7 +63,7 @@ void sub_0802B56C(Entity* this) { void sub_0802B5C8(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 1; this->actionDelay = 30; InitializeAnimation(this, 0); diff --git a/src/enemy/chuchu.c b/src/enemy/chuchu.c index 32f1a1b1..c6c83615 100644 --- a/src/enemy/chuchu.c +++ b/src/enemy/chuchu.c @@ -101,11 +101,11 @@ void sub_0801EF40(Entity* this) { if (this->type == 2) { if (this->bitfield == 0x8e || this->bitfield == 0x95) { COLLISION_OFF(this); - this->currentHealth = 0; + this->health = 0; } } - health = this->currentHealth; + health = this->health; if (health) { if (this->bitfield == 0x94) { sub_0801FB68(this); @@ -117,10 +117,10 @@ void sub_0801EF40(Entity* this) { } } else { sub_0804AA1C(this); - this->hVelocity = 0; + this->zVelocity = 0; InitializeAnimation(this, 9); } - this->field_0x80.HALF.LO = this->currentHealth; + this->field_0x80.HALF.LO = this->health; sub_0804AA30(this, gUnk_080CA21C); } @@ -157,7 +157,7 @@ void sub_0801F048(Entity* this) { } void sub_0801F084(Entity* this) { - if ((this->frames.all & 0x80) == 0) + if ((this->frame & 0x80) == 0) GetNextFrame(this); sub_08001242(this); } @@ -165,7 +165,7 @@ void sub_0801F084(Entity* this) { void sub_0801F0A4(Entity* this) { sub_0804A720(this); this->action = 1; - this->field_0x80.HALF.LO = this->currentHealth; + this->field_0x80.HALF.LO = this->health; this->field_0x82.HALF.LO = 0; } @@ -175,7 +175,7 @@ void nullsub_4(Entity* this) { void sub_0801F0C8(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 3; this->actionDelay = (Random() & 3) + 0xc; this->field_0xf = Random(); @@ -210,9 +210,9 @@ void sub_0801F12C(Entity* this) { } void sub_0801F1B0(Entity* this) { - if (this->frames.all & 0x10) { - if (this->frames.all & 1) { - this->frames.all ^= 1; + if (this->frame & 0x10) { + if (this->frame & 1) { + this->frame ^= 1; this->hitType = 90; EnqueueSFX(299); } @@ -223,7 +223,7 @@ void sub_0801F1B0(Entity* this) { GetNextFrame(this); } - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { if (sub_0801FBD0(this)) { sub_0801F328(this); } else { @@ -242,7 +242,7 @@ void sub_0801F228(Entity* this) { void sub_0801F250(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) + if (this->frame & 0x80) sub_0801F360(this); } @@ -269,9 +269,9 @@ void sub_0801F270(Entity* this) { void sub_0801F2CC(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 1; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; InitializeAnimation(this, 4); } } @@ -279,7 +279,7 @@ void sub_0801F2CC(Entity* this) { void sub_0801F2F8(Entity* this) { sub_08003FC4(this, 0x1800); GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { sub_0801F340(this); sub_0804AA1C(this); } @@ -317,7 +317,7 @@ void sub_0801F3AC(Entity* this) { if (this->field_0x82.HALF.LO || PlayerInRange(this, 1, 0x48)) { if (this->action == 1) { this->action = 2; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x82.HALF.LO = 1; InitializeAnimation(this, 0); } @@ -339,7 +339,7 @@ void sub_0801F428(Entity* this) { sub_0804A720(this); this->action = 1; this->actionDelay = Random(); - this->field_0x80.HALF.LO = this->currentHealth; + this->field_0x80.HALF.LO = this->health; this->field_0x82.HALF.LO = 0; if (this->type2 == 0) return; @@ -348,7 +348,7 @@ void sub_0801F428(Entity* this) { this->field_0xf = 30; COLLISION_ON(this); this->spritePriority.b1 = 3; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 2); } #endif @@ -359,7 +359,7 @@ void sub_0801F48C(Entity* this) { void sub_0801F494(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 3; this->field_0xf = 30; this->direction = sub_08049F84(this, 1); @@ -401,9 +401,9 @@ void sub_0801F508(Entity* this) { } void sub_0801F584(Entity* this) { - if (this->frames.all & 0x10) { - if (this->frames.all & 0x1) { - this->frames.all ^= 1; + if (this->frame & 0x10) { + if (this->frame & 0x1) { + this->frame ^= 1; this->hitType = 91; EnqueueSFX(299); } @@ -415,7 +415,7 @@ void sub_0801F584(Entity* this) { GetNextFrame(this); } - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { if (sub_0801FBD0(this)) { this->field_0x82.HALF.HI = 0; sub_0801F730(this); @@ -437,7 +437,7 @@ void sub_0801F61C(Entity* this) { void sub_0801F638(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 8; this->field_0xf = 30; this->direction = sub_08049F84(this, 1); @@ -462,9 +462,9 @@ void sub_0801F688(Entity* this) { void sub_0801F6CC(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 1; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; InitializeAnimation(this, 4); } } @@ -472,7 +472,7 @@ void sub_0801F6CC(Entity* this) { void sub_0801F6F8(Entity* this) { sub_08003FC4(this, 0x1800); GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 4; this->speed = 0x20; sub_0804AA1C(this); @@ -488,7 +488,7 @@ void sub_0801F730(Entity* this) { void sub_0801F748(Entity* this) { this->action = 2; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 4); } @@ -500,7 +500,7 @@ void sub_0801F764(Entity* this) { if (this->action == 1) { if (this->field_0x82.HALF.LO || PlayerInRange(this, 1, 0x48)) { this->action = 2; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x82.HALF.LO = 1; InitializeAnimation(this, 0); } @@ -517,7 +517,7 @@ void sub_0801F7D8(Entity* this) { sub_0804A720(this); this->action = 1; this->actionDelay = Random(); - this->field_0x80.HALF.LO = this->currentHealth; + this->field_0x80.HALF.LO = this->health; this->field_0x82.HALF.LO = 0; } @@ -527,7 +527,7 @@ void sub_0801F7FC(Entity* this) { if (this->field_0x82.HALF.LO || PlayerInRange(this, 1, 0x48)) { this->action = 2; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x82.HALF.LO = 1; InitializeAnimation(this, 0); } @@ -535,7 +535,7 @@ void sub_0801F7FC(Entity* this) { void sub_0801F840(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { sub_0801FB14(this); COLLISION_ON(this); this->spritePriority.b0 = 4; @@ -579,9 +579,9 @@ void sub_0801F8C0(Entity* this) { } void sub_0801F940(Entity* this) { - if (this->frames.all & 0x10) { - if (this->frames.all & 1) { - this->frames.all ^= 1; + if (this->frame & 0x10) { + if (this->frame & 1) { + this->frame ^= 1; EnqueueSFX(299); } sub_080AEFE0(this); @@ -591,7 +591,7 @@ void sub_0801F940(Entity* this) { GetNextFrame(this); } - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { if (sub_0801FBD0(this)) { sub_0801FAE0(this); } else { @@ -611,7 +611,7 @@ void sub_0801F9C4(Entity* this) { void sub_0801F9E0(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 8; this->field_0xf = 30; this->direction = sub_08049F84(this, 1); @@ -636,9 +636,9 @@ void sub_0801FA30(Entity* this) { void sub_0801FA78(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 1; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; InitializeAnimation(this, 4); sub_0804AA1C(this); } @@ -647,7 +647,7 @@ void sub_0801FA78(Entity* this) { void sub_0801FAAC(Entity* this) { sub_08003FC4(this, 0x1800); GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { sub_0801FB14(this); this->speed = 0x20; sub_0804AA1C(this); @@ -662,7 +662,7 @@ void sub_0801FAE0(Entity* this) { void sub_0801FAF8(Entity* this) { this->action = 2; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 4); } @@ -675,7 +675,7 @@ void sub_0801FB14(Entity* this) { void sub_0801FB34(Entity* this) { if (*(Entity**)&this->field_0x68) { - sub_0806FA90(this, *(Entity**)&this->field_0x68, gUnk_080CA2B4[this->frames.all & 0xf], 1); + sub_0806FA90(this, *(Entity**)&this->field_0x68, gUnk_080CA2B4[this->frame & 0xf], 1); (*(Entity**)&this->field_0x68)->spriteOffsetY--; } } @@ -688,7 +688,7 @@ void sub_0801FB68(Entity* this) { case 1: this->action = 10; COLLISION_ON(this); - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spritePriority.b1 = 3; break; case 2: @@ -698,7 +698,7 @@ void sub_0801FB68(Entity* this) { break; } - this->hVelocity = 0; + this->zVelocity = 0; } u32 sub_0801FBD0(Entity* this) { @@ -711,7 +711,7 @@ u32 sub_0801FBD0(Entity* this) { void Chuchu_JumpAtPlayer(Entity* this) { this->speed = 0x180; - this->hVelocity = 0x20000; + this->zVelocity = 0x20000; this->direction = sub_08049F84(this, 1); InitializeAnimation(this, 3); } diff --git a/src/enemy/cuccoChickAggr.c b/src/enemy/cuccoChickAggr.c index 2ae41b08..fa2fb63a 100644 --- a/src/enemy/cuccoChickAggr.c +++ b/src/enemy/cuccoChickAggr.c @@ -41,7 +41,7 @@ void sub_08022970(Entity* this) { } void sub_08022988(Entity* this) { - if (this->height.HALF.HI == 0 && sub_08022B20(this)) { + if (this->z.HALF.HI == 0 && sub_08022B20(this)) { sub_08022B0C(this); } else { if (this->field_0xf) { @@ -49,7 +49,7 @@ void sub_08022988(Entity* this) { return; this->frameIndex = 1; - this->hVelocity = 0x10000; + this->zVelocity = 0x10000; EnqueueSFX(0xd6); } @@ -75,7 +75,7 @@ void sub_080229F8(Entity* this) { this->speed = 0xc0; sub_08022B44(this); } else { - this->hVelocity = 0x10000; + this->zVelocity = 0x10000; EnqueueSFX(0xd6); } } @@ -120,7 +120,7 @@ void sub_08022AA4(Entity* this) { } if (this->direction & 0xf) - this->spriteSettings.b.flipX = (this->direction >> 4) ^ 1; + this->spriteSettings.flipX = (this->direction >> 4) ^ 1; } void sub_08022B0C(Entity* this) { @@ -138,11 +138,11 @@ u32 sub_08022B20(Entity* this) { } void sub_08022B44(Entity* this) { - this->hVelocity = 0xc000; + this->zVelocity = 0xc000; this->direction = GetFacingDirection(this, &gPlayerEntity); if (this->direction & 0xf) - this->spriteSettings.b.flipX = (this->direction >> 4) ^ 1; + this->spriteSettings.flipX = (this->direction >> 4) ^ 1; EnqueueSFX(0xd6); } diff --git a/src/enemy/darkNut.c b/src/enemy/darkNut.c index 09648a8f..aa7d5993 100644 --- a/src/enemy/darkNut.c +++ b/src/enemy/darkNut.c @@ -98,8 +98,8 @@ void sub_08020BB8(Entity* this) { case 0x4c: if (this->action == 15) { u8 bVar3 = 0xff; - if (this->attachedEntity != NULL) { - bVar3 = this->attachedEntity->bitfield & 0x7f; + if (this->child != NULL) { + bVar3 = this->child->bitfield & 0x7f; } if (bVar3 == 2) { sub_080213D0(this, gUnk_080CAB08[this->type]); @@ -109,14 +109,14 @@ void sub_08020BB8(Entity* this) { } break; default: - if (this->currentHealth != this->field_0x78.HALF.LO) { + if (this->health != this->field_0x78.HALF.LO) { sub_08021588(this); sub_08021390(this); sub_0804AA1C(this); } break; } - this->field_0x78.HALF.LO = this->currentHealth; + this->field_0x78.HALF.LO = this->health; sub_0804AA30(this, gUnk_080CAA98); } @@ -127,7 +127,7 @@ void sub_08020D70(Entity* this) { sub_0804A720(this); this->action = 1; this->field_0x74.HALF.HI = 0; - this->field_0x78.HALF.LO = this->currentHealth; + this->field_0x78.HALF.LO = this->health; this->animationState = -1; sub_08021218(this, 0, 2); } @@ -139,7 +139,7 @@ void sub_08020D9C(Entity* this) { void sub_08020DB4(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frames.all & 0x80) + if (this->frame & 0x80) sub_08021390(this); } @@ -159,7 +159,7 @@ void sub_08020DD4(Entity* this) { void sub_08020E28(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frames.all & 0x80) + if (this->frame & 0x80) sub_080213B0(this); } @@ -168,14 +168,14 @@ void sub_08020E48(Entity* this) { sub_080213F0(this); } else { UpdateAnimationSingleFrame(this); - if (this->frames.all & 0x80) + if (this->frame & 0x80) sub_080213B0(this); } } void sub_08020E78(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frames.all & 0x80) + if (this->frame & 0x80) sub_08021390(this); } @@ -209,7 +209,7 @@ void sub_08020E98(Entity* this) { void sub_08020F28(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frames.all & 0x80) + if (this->frame & 0x80) sub_08021400(this); } @@ -227,7 +227,7 @@ void sub_08020F48(Entity* this) { pEVar3 = CreateProjectileWithParent(this, 0, 1); if (pEVar3) { pEVar3->parent = this; - this->attachedEntity = pEVar3; + this->child = pEVar3; } } } else { @@ -239,7 +239,7 @@ void sub_08020F48(Entity* this) { } void sub_08020FAC(Entity* this) { - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { if (this->field_0x7a.HALF.LO) { this->field_0x7a.HALF.LO--; } else { @@ -262,23 +262,23 @@ void sub_08020FE4(Entity* this) { void sub_08021010(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->hitType = 0x56; sub_080213F0(this); } } void sub_08021038(Entity* this) { - if (this->attachedEntity == NULL && this->frames.all) { + if (this->child == NULL && this->frame) { Entity* pEVar2 = (Entity*)CreateProjectileWithParent(this, 0, 0); if (pEVar2) { pEVar2->parent = this; - this->attachedEntity = pEVar2; + this->child = pEVar2; } EnqueueSFX(270); } - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { sub_08021588(this); if (this->field_0x7c.BYTES.byte0) { this->field_0x7c.BYTES.byte0--; @@ -287,40 +287,39 @@ void sub_08021038(Entity* this) { } } else { UpdateAnimationSingleFrame(this); - if (this->frames.all == 4) + if (this->frame == 4) this->hitType = 81; } } void sub_080210A8(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frames.all & 1) { - this->frames.all = 0; + if (this->frame & 1) { + this->frame = 0; sub_08021588(this); EnqueueSFX(349); - } else if (this->frames.all & 0x80) { + } else if (this->frame & 0x80) { sub_08021390(this); } } void sub_080210E4(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frames.all & 1) { + if (this->frame & 1) { Entity* ent; - this->frames.all &= ~1; + this->frame &= ~1; ent = CreateProjectileWithParent(this, 0, 2); if (ent) { ent->parent = this; - this->attachedEntity = ent; + this->child = ent; } EnqueueSFX(270); } sub_08021644(this); - if ((this->frames.all & 0x10) && - (!ProcessMovement(this) || (this->attachedEntity && (this->attachedEntity->bitfield & 0x80)))) { + if ((this->frame & 0x10) && (!ProcessMovement(this) || (this->child && (this->child->bitfield & 0x80)))) { sub_080213D0(this, 0); } else { if (--this->field_0x76.HWORD == 0) @@ -329,7 +328,7 @@ void sub_080210E4(Entity* this) { } void sub_08021170(Entity* this) { - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { if (this->field_0x7a.HALF.HI) { this->field_0x7a.HALF.HI--; } else { @@ -345,7 +344,7 @@ void sub_080211A0(Entity* this) { sub_08021390(this); } else { UpdateAnimationSingleFrame(this); - if (this->frames.all & 0x80) + if (this->frame & 0x80) sub_080213B0(this); } } @@ -356,7 +355,7 @@ void sub_080211D0(Entity* this) UpdateAnimationSingleFrame(this); sub_0802159C(this); - if (this->frames.all & 0x80) + if (this->frame & 0x80) sub_08021390(this); } @@ -364,7 +363,7 @@ void sub_080211F4(Entity* this) { UpdateAnimationSingleFrame(this); sub_08021600(this); - if (this->frames.all & 0x80) + if (this->frame & 0x80) sub_08021390(this); } @@ -414,7 +413,7 @@ void sub_080212B0(Entity* this) { if (this->type < 2 && tmp == 2) tmp = gUnk_080CAB52[Random() & 3]; - this->attachedEntity = NULL; + this->child = NULL; gUnk_080CAB58[tmp](this); } @@ -530,7 +529,7 @@ u32 sub_080214FC(Entity* this) { return 0; direction = GetFacingDirection(this, gUnk_020000B0); - if (4 < (direction - (this->frames.all & 0x1f)) - 2) + if (4 < (direction - (this->frame & 0x1f)) - 2) return 0; this->animationState = DirectionToAnimationState(direction); @@ -557,54 +556,54 @@ void sub_08021540(Entity* this) { } void sub_08021588(Entity* this) { - if (this->attachedEntity) { - this->attachedEntity->parent = NULL; - this->attachedEntity = NULL; + if (this->child) { + this->child->parent = NULL; + this->child = NULL; } } void sub_0802159C(Entity* this) { - if (this->frames.all == 1) { + if (this->frame == 1) { Entity* ent; - this->frames.all = 0; + this->frame = 0; this->hitType = 0x51; ent = CreateProjectileWithParent(this, 0, 3); if (ent) { ent->parent = this; - this->attachedEntity = ent; + this->child = ent; } EnqueueSFX(0x116); - } else if (this->frames.all == 2) { - this->frames.all = 0; + } else if (this->frame == 2) { + this->frame = 0; sub_08021588(this); - } else if (this->frames.all & 0x20) { - this->frames.all &= ~0x20; + } else if (this->frame & 0x20) { + this->frame &= ~0x20; EnqueueSFX(0x115); } } void sub_08021600(Entity* this) { - if (this->frames.all == 1) { + if (this->frame == 1) { Entity* ent; - this->frames.all = 0; + this->frame = 0; this->hitType = 0x51; ent = CreateProjectileWithParent(this, 0, 4); if (ent) { ent->parent = this; - this->attachedEntity = ent; + this->child = ent; } EnqueueSFX(0x10e); - } else if (this->frames.all == 2) { - this->frames.all = 0; + } else if (this->frame == 2) { + this->frame = 0; sub_08021588(this); } } void sub_08021644(Entity* this) { - if (this->frames.all & 0x20) { - this->frames.all &= ~0x20; + if (this->frame & 0x20) { + this->frame &= ~0x20; EnqueueSFX(0x7d); } } diff --git a/src/enemy/doorMimic.c b/src/enemy/doorMimic.c index 301efced..713ace16 100644 --- a/src/enemy/doorMimic.c +++ b/src/enemy/doorMimic.c @@ -71,7 +71,7 @@ void sub_080220D8(Entity* this) { void sub_080220F0(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { const PosOffset* off; u32 i; @@ -87,7 +87,7 @@ void sub_080220F0(Entity* this) { } } EnqueueSFX(260); - } else if (this->frames.all & 1) { + } else if (this->frame & 1) { this->damage = 4; } } @@ -103,7 +103,7 @@ void sub_08022174(Entity* this) { void sub_08022198(Entity* this) { sub_0800445C(this); GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 1; this->actionDelay = 0x5a; } diff --git a/src/enemy/enemy4D.c b/src/enemy/enemy4D.c index f1b16cc7..75c28eb1 100644 --- a/src/enemy/enemy4D.c +++ b/src/enemy/enemy4D.c @@ -39,9 +39,9 @@ void sub_0803EB44(Entity* this) { pEVar1 = CreateProjectileWithParent(this, 0x19, 0); if (pEVar1 != NULL) { pEVar1->parent = this; - this->attachedEntity = pEVar1; + this->child = pEVar1; COLLISION_ON(this); - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; this->animationState = 2; *((u8*)&this->field_0x7a + 1) = 0; *(u8*)&this->field_0x7c = 0; diff --git a/src/enemy/enemyE.c b/src/enemy/enemyE.c index 9f6a0b6d..6835be88 100644 --- a/src/enemy/enemyE.c +++ b/src/enemy/enemyE.c @@ -20,7 +20,7 @@ void nullsub_133(Entity* this) { void sub_08022FD0(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_08023000(this, 0); } diff --git a/src/enemy/fallingBoulder.c b/src/enemy/fallingBoulder.c index 039c817f..6084d868 100644 --- a/src/enemy/fallingBoulder.c +++ b/src/enemy/fallingBoulder.c @@ -32,7 +32,7 @@ void sub_0802C254(Entity* this) { void sub_0802C258(Entity* this) { sub_0804A720(this); - this->hVelocity = 0x20000; + this->zVelocity = 0x20000; this->actionDelay = 2; this->field_0x7a.HWORD = Random() & 0x70; switch (this->type) { @@ -45,7 +45,7 @@ void sub_0802C258(Entity* this) { } this->field_0x80.HWORD = this->x.HALF.HI; this->field_0x82.HWORD = this->y.HALF.HI; - this->height.HALF.HI = -0x10; + this->z.HALF.HI = -0x10; this->collisionLayer = 3; this->spriteRendering.b3 = 1; this->spritePriority.b0 = 2; @@ -70,7 +70,7 @@ NONMATCH("asm/non_matching/fallingBoulder/sub_0802C334.inc", void sub_0802C334(E return; } this->field_0x7c.HALF.LO = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } GetNextFrame(this); this->field_0x7c.HALF.HI = COORD_TO_TILE(this); @@ -113,7 +113,7 @@ NONMATCH("asm/non_matching/fallingBoulder/sub_0802C334.inc", void sub_0802C334(E sub_080AEFB4(this); } else { sub_0806F69C(this); - if (this->height.HALF.HI - y > 0x38) { + if (this->z.HALF.HI - y > 0x38) { sub_0802C62C(this); this->field_0x7a.HWORD = (Random() & 0x7f) | 0x80; if (this->type == 3) { @@ -190,7 +190,7 @@ void sub_0802C4B0(Entity* this) { } rand = Random() & 7; - this->hVelocity = 0x20000; + this->zVelocity = 0x20000; if (rand & 4) { if (rand & 3) { *(u32*)&this->cutsceneBeh = gUnk_080CD58C[offset | 1]; @@ -210,7 +210,7 @@ void sub_0802C62C(Entity* this) { this->action = 1; this->y.HALF.HI = this->field_0x82.HWORD; this->x.HALF.HI = this->field_0x80.HWORD; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; COLLISION_OFF(this); this->field_0x7c.HALF.LO = 0; } diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c index 2103e19f..3ec57bc7 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -28,7 +28,7 @@ void sub_080453A4(Entity* this) { } void sub_080453BC(Entity* this) { - if (this->currentHealth && this->cutsceneBeh.HALF.LO != this->currentHealth) { + if (this->health && this->cutsceneBeh.HALF.LO != this->health) { this->action = 2; } else { sub_0804AA30(this, gUnk_080D17E8); @@ -41,9 +41,9 @@ void nullsub_172(void) { void sub_080453E8(Entity* this) { this->action = 1; this->actionDelay = 0; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->speed = 0x80; - this->cutsceneBeh.HALF.LO = this->currentHealth; + this->cutsceneBeh.HALF.LO = this->health; this->field_0x3c |= 0x10; sub_0804A720(this); InitializeAnimation(this, 0); @@ -77,11 +77,11 @@ void sub_08045454(Entity* this) { off = gUnk_080D1810; for (i = 0; i < count; i++) { ent = entities[i]; - ent->attachedEntity = entities[(i + 1) % count]; + ent->child = entities[(i + 1) % count]; ent->parent = entities[(i + count - 1) % count]; tmp = 0; ent->type2 = 1; - ent->height.HALF.HI = tmp; + ent->z.HALF.HI = tmp; ent->iframes = -0x10; /* Set MiniFireballGuy offset relative to killed slime. */ @@ -101,7 +101,7 @@ u32 sub_0804A024(Entity*, u32, u32); void sub_08045524(Entity* this) { u32 tmp, tmp1, tmp2; - this->hVelocity = 0x1c000; + this->zVelocity = 0x1c000; tmp = sub_0804A024(this, 1, 8); if (tmp != 0xff && (Random() & 3) == 0) { this->actionDelay = Random() & 3; diff --git a/src/enemy/gibdo.c b/src/enemy/gibdo.c index 6fc3a27f..59e03862 100644 --- a/src/enemy/gibdo.c +++ b/src/enemy/gibdo.c @@ -148,11 +148,11 @@ void sub_08037624(Entity* this) { void sub_08037690(Entity* this) { UpdateAnimationSingleFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->field_0x76.HALF.HI = 0x14; sub_08037794(this); } else { - if ((this->frames.all & 1) != 0) { + if ((this->frame & 1) != 0) { this->hitType = 0x27; ProcessMovement(this); } @@ -167,7 +167,7 @@ NONMATCH("asm/non_matching/gibdo/sub_080376D0.inc", void sub_080376D0(Entity* th gPlayerState.field_0xa = gPlayerState.field_0xa | 0x80; CopyPositionAndSpriteOffset(&gPlayerEntity, this); UpdateAnimationSingleFrame(this); - x = &this->frames.all; + x = &this->frame; if ((*x & 0x1) != 0) { if (!(--this->field_0x7c.BYTES.byte0)) { sub_08037A58(this); @@ -182,7 +182,7 @@ END_NONMATCH void sub_0803773C(Entity* this) { UpdateAnimationSingleFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { sub_08037794(this); } } @@ -396,7 +396,7 @@ NONMATCH("asm/non_matching/gibdo/sub_08037B48.inc", void sub_08037B48(Entity* th E->spriteOffsetY = 0xf5; E->parent = this; } - this->attachedEntity = E; + this->child = E; } END_NONMATCH @@ -409,7 +409,7 @@ NONMATCH("asm/non_matching/gibdo/sub_08037C0C.inc", void sub_08037C0C(Entity* th this->actionDelay = 0xf; this->parent = that; } - if (this->attachedEntity != 0) { + if (this->child != 0) { this->actionDelay = 0xf; this->parent = that; } diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index 6c0fb567..855a66dc 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -93,7 +93,7 @@ void (*const gUnk_080D1AFC[8])(Entity*) = { sub_08046898, sub_08046910, sub_0804 void GyorgMale(Entity* this) { if (this->action) { - this->spriteSettings.b.draw = this->field_0x7c.BYTES.byte1; + this->spriteSettings.draw = this->field_0x7c.BYTES.byte1; } gUnk_080D1AFC[this->action](this); if (this->action != 7) { @@ -101,9 +101,9 @@ void GyorgMale(Entity* this) { } this->animationState = -(this->field_0x78.HWORD >> 8); sub_08048004(this); - this->field_0x7c.BYTES.byte1 = this->spriteSettings.b.draw; - if (this->spriteSettings.b.draw == 1 && (this->y.HALF.HI - gRoomControls.roomScrollY + 0x30) > 0x100u) { - this->spriteSettings.b.draw = 0; + this->field_0x7c.BYTES.byte1 = this->spriteSettings.draw; + if (this->spriteSettings.draw == 1 && (this->y.HALF.HI - gRoomControls.roomScrollY + 0x30) > 0x100u) { + this->spriteSettings.draw = 0; } this->cutsceneBeh.HWORD = gPlayerEntity.x.HALF.HI; this->field_0x86.HWORD = gPlayerEntity.y.HALF.HI; @@ -116,11 +116,11 @@ void sub_08046898(Entity* this) { return; tmp->type = 1; tmp->parent = this; - this->attachedEntity = tmp; + this->child = tmp; this->action = 1; this->subAction = 0; this->spriteRendering.b0 = 3; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spriteOrientation.flipY = 2; this->spriteRendering.b3 = 2; this->field_0x3c |= 0x10; @@ -232,7 +232,7 @@ void (*const gUnk_080D1B38[5])(Entity*) = { sub_08046AE8, sub_08046B18, sub_0804 void sub_08046A9C(Entity* this) { if (this->animIndex == 1) { - if (this->frames.all == 1) { + if (this->frame == 1) { InitAnimationForceUpdate(this, 0); } } @@ -315,7 +315,7 @@ void (*const gUnk_080D1B4C[5])(Entity*) = { sub_08046D44, sub_08046D98, sub_0804 void sub_08046CEC(Entity* this) { if (this->animIndex == 0) { - if (this->frames.all == 1) { + if (this->frame == 1) { InitAnimationForceUpdate(this, 1); } } @@ -418,7 +418,7 @@ void (*const gUnk_080D1B94[0xA])(Entity*) = { sub_08046FE8, sub_0804702C, sub_08 void sub_08046F64(Entity* this) { if (this->animIndex == 0) { - if (this->frames.all == 1) { + if (this->frame == 1) { InitAnimationForceUpdate(this, 1); } } @@ -580,13 +580,13 @@ void (*const gUnk_080D1BC0[7])(Entity*) = { sub_080473B8, sub_080473F0, sub_0804 void sub_0804736C(Entity* this) { if (this->animIndex == 1) { - if (this->frames.all == 1) { + if (this->frame == 1) { InitAnimationForceUpdate(this, 0); } } gUnk_080D1BC0[this->subAction](this); UpdateAnimationSingleFrame(this); - if (this->currentHealth == 0) { + if (this->health == 0) { this->action = 7; this->subAction = 0; } @@ -827,7 +827,7 @@ void sub_08047914(Entity* this) { void sub_08047978(Entity* this) { sub_08047D88(this); - if (this->currentHealth != 0) { + if (this->health != 0) { if (--this->field_0x70.HALF_U.LO == 0) { this->field_0x70.HALF.HI = 1; if (this->type == 0) { @@ -858,9 +858,9 @@ void sub_08047978(Entity* this) { this->spriteRendering.b3 = 2; this->direction = this->animationState; } - if (this->currentHealth != 0) + if (this->health != 0) return; - if (this->attachedEntity->action != 1) + if (this->child->action != 1) return; this->subAction = 4; if (this->type == 0) { @@ -959,18 +959,18 @@ void sub_08047BF0(Entity* this) { } else { this->actionDelay--; if (this->actionDelay == 0x5A) { - tmp = this->attachedEntity; - tmp->spriteSettings.b.draw = 0; + tmp = this->child; + tmp->spriteSettings.draw = 0; CreateFx(tmp, FX_GIANT_EXPLOSION4, 0); } else { if (this->actionDelay == 0x3C) { - tmp = this->attachedEntity->attachedEntity; - tmp->spriteSettings.b.draw = 0; + tmp = this->child->child; + tmp->spriteSettings.draw = 0; CreateFx(tmp, FX_GIANT_EXPLOSION4, 0); } else { if (this->actionDelay == 0x1E) { - tmp = this->attachedEntity->attachedEntity->attachedEntity; - tmp->spriteSettings.b.draw = 0; + tmp = this->child->child->child; + tmp->spriteSettings.draw = 0; CreateFx(tmp, FX_GIANT_EXPLOSION4, 0); } } @@ -1012,7 +1012,7 @@ void sub_08047D88(Entity* this) { if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x20)) return; gPlayerState.field_0x14 = 1; - if (gPlayerEntity.height.HALF.HI != 0) + if (gPlayerEntity.z.HALF.HI != 0) return; this->field_0x7c.BYTES.byte0 |= 1; } @@ -1114,7 +1114,7 @@ void sub_08048004(Entity* this) { return; if (this->animIndex == 0) { COLLISION_OFF(this); - if (gPlayerEntity.height.HALF.HI != 0) + if (gPlayerEntity.z.HALF.HI != 0) return; if (!sub_08079F8C()) return; diff --git a/src/enemy/hangingSeed.c b/src/enemy/hangingSeed.c index 95593f7b..2b582b57 100644 --- a/src/enemy/hangingSeed.c +++ b/src/enemy/hangingSeed.c @@ -27,7 +27,7 @@ void nullsub_7(Entity* this) { void HangingSeed_Initialize(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->frameIndex = this->type; this->spriteRendering.b3 = 1; this->spritePriority.b0 = 3; diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index 870831bc..0bb1c1c4 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -89,7 +89,7 @@ void sub_0802BCA8(Entity* this) { this->action = 7; this->actionDelay = 0x5a; - this->hVelocity = 0x18000; + this->zVelocity = 0x18000; this->hitType = 0x19; this->field_0x3a = this->field_0x3a & 0xfb; this->field_0x1c = 0x12; @@ -125,7 +125,7 @@ void sub_0802BD28(Entity* this) { COLLISION_ON(this); this->field_0x3a &= ~0x4; } else { - this->currentHealth = 0; + this->health = 0; } } @@ -284,7 +284,7 @@ void sub_0802BFE0(Entity* this) { } void sub_0802BFF4(Entity* this) { - this->spriteSettings.b.draw ^= 1; + this->spriteSettings.draw ^= 1; if (--this->actionDelay == 0) { DeleteEntity(this); } @@ -369,7 +369,7 @@ void sub_0802C1CC(Entity* this) { void sub_0802C218(Entity* this) { this->action = 6; this->speed = 0xe0; - this->hVelocity = 0x18000; + this->zVelocity = 0x18000; } // clang-format off diff --git a/src/enemy/keaton.c b/src/enemy/keaton.c index d1a41424..0c9adb33 100644 --- a/src/enemy/keaton.c +++ b/src/enemy/keaton.c @@ -82,7 +82,7 @@ void sub_0803248C(Entity* this) { void sub_080324CC(Entity* this) { if (sub_080325E8(this) == 0) { UpdateAnimationSingleFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { sub_080326FC(this); sub_08032740(this); } @@ -118,7 +118,7 @@ void sub_080324FC(Entity* this) { } void sub_08032574(Entity* this) { - if (this->attachedEntity && (this->attachedEntity->bitfield & 0x80)) { + if (this->child && (this->child->bitfield & 0x80)) { sub_0803275C(this); return; } @@ -144,10 +144,10 @@ void sub_080325C4(Entity* this) { u32 sub_080325E8(Entity* this) { if (((sub_08049FA0(this) != 0) && (sub_08049FDC(this, 1) != 0)) && (sub_080041A0(this, gUnk_020000B0, 0x68, 0x40) != 0)) { - if (((GetFacingDirection(this, gUnk_020000B0) - (DirectionRound(this->frames.all)) + 2) & 0x1F) < 5) { + if (((GetFacingDirection(this, gUnk_020000B0) - (DirectionRound(this->frame)) + 2) & 0x1F) < 5) { this->action = 3; this->actionDelay = 0xC; - this->direction = DirectionRound(this->frames.all); + this->direction = DirectionRound(this->frame); return 1; } } @@ -236,13 +236,13 @@ void sub_080327C8(Entity* this) { child = CreateProjectileWithParent(this, 11, 0); if (child != NULL) { child->parent = this; - this->attachedEntity = child; + this->child = child; } } void sub_080327E0(Entity* this) { - if (this->attachedEntity != NULL) { - this->attachedEntity->parent = NULL; - this->attachedEntity = NULL; + if (this->child != NULL) { + this->child->parent = NULL; + this->child = NULL; } } diff --git a/src/enemy/keese.c b/src/enemy/keese.c index 26c1a938..92d3ff86 100644 --- a/src/enemy/keese.c +++ b/src/enemy/keese.c @@ -59,7 +59,7 @@ void Keese_Initialize(Entity* this) { sub_0804A720(this); if (this->type != 0) { this->spritePriority.b1 = 1; - this->height.HALF.HI = -0x10; + this->z.HALF.HI = -0x10; } this->direction = Random() & 0x1f; this->field_0x1c = 1; @@ -77,12 +77,12 @@ void Keese_Fly(Entity* this) { this->field_0x7a.HWORD--; } GetNextFrame(this); - if ((this->frames.b.f3) != 0) { + if (this->frame & 0x80) { sub_08021F24(this); } else { sub_080AEFB4(this); } - this->spriteOffsetY = gKeeseSpriteOffsets[this->frames.all]; + this->spriteOffsetY = gKeeseSpriteOffsets[this->frame]; } void Keese_Rest(Entity* this) { diff --git a/src/enemy/lakitu.c b/src/enemy/lakitu.c index 91798d2e..d96950d7 100644 --- a/src/enemy/lakitu.c +++ b/src/enemy/lakitu.c @@ -57,7 +57,7 @@ void Lakitu_DoAction(Entity* this) { void sub_0803C784(Entity* this) { if ((this->bitfield & 0x7f) == 0x1d) { - this->hVelocity = 0x20000; + this->zVelocity = 0x20000; sub_0803CBAC(this); } else { @@ -104,7 +104,7 @@ void sub_0803C844(Entity* this) { } void sub_0803C850(Entity* this) { - Entity* cloud = this->attachedEntity; + Entity* cloud = this->child; if (cloud != NULL) { cloud->spriteOffsetX = this->spriteOffsetX; } @@ -114,7 +114,7 @@ void sub_0803C850(Entity* this) { void sub_0803C86C(Entity* this) { sub_0803CBAC(this); - this->attachedEntity = NULL; + this->child = NULL; } void Lakitu_Initialize(Entity* this) { @@ -124,13 +124,13 @@ void Lakitu_Initialize(Entity* this) { } cloud->parent = this; - this->attachedEntity = cloud; + this->child = cloud; sub_0804A720(this); this->action = HIDDEN; - this->height.HALF.HI = -2; + this->z.HALF.HI = -2; this->spriteOffsetY = 0xff; @@ -143,14 +143,14 @@ void Lakitu_Hide(Entity* this) { if (sub_0803CA4C(this)) { this->action = 2; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } } void Lakitu_EndHide(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frames.b.f3) { + if (this->frame & 0x80) { this->action = IDLE; this->actionDelay = 0x3c; @@ -178,9 +178,9 @@ void Lakitu_Idle(Entity* this) { void Lakitu_BeginHide(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frames.b.f3 != 0) { + if (this->frame & 0x80) { this->action = 1; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; InitAnimationForceUpdate(this, this->animationState); } @@ -189,7 +189,7 @@ void Lakitu_BeginHide(Entity* this) { void Lakitu_Lightning(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frames.b.f3 == 0) { + if (!(this->frame & 0x80)) { return; } @@ -207,7 +207,7 @@ void Lakitu_Lightning(Entity* this) { this->field_0x78.HALF.HI = FALSE; - InitAnimationForceUpdate(this->attachedEntity, this->animationState); + InitAnimationForceUpdate(this->child, this->animationState); } } @@ -259,7 +259,7 @@ void sub_0803CA84(Entity* this, u32 unkParameter) { this->animationState = altAnimState; InitAnimationForceUpdate(this, altAnimState + unkParameter); - InitAnimationForceUpdate(this->attachedEntity, altAnimState); + InitAnimationForceUpdate(this->child, altAnimState); } } } @@ -284,7 +284,7 @@ bool32 sub_0803CB04(Entity* this) { sub_0803CB34(this); this->field_0x78.HALF.HI = delay; - InitAnimationForceUpdate(this->attachedEntity, this->animationState + 4); + InitAnimationForceUpdate(this->child, this->animationState + 4); returnValue = 1; } @@ -322,14 +322,14 @@ void Lakitu_SpawnLightning(Entity* this) { void sub_0803CBAC(Entity* this) { Entity* cloud; - cloud = this->attachedEntity; + cloud = this->child; if (cloud != NULL) { cloud->flags |= 0x80; cloud->hitType = 0x43; } this->action = CLOUDLESS; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spritePriority.b1 = 1; @@ -344,16 +344,16 @@ void sub_0803CC08(Entity* this) { Entity* cloud; Entity* fx; - cloud = this->attachedEntity; + cloud = this->child; if (cloud == NULL) { return; } - if ((u32)(cloud->height.HALF.HI - this->height.HALF.HI) > 2) { + if ((u32)(cloud->z.HALF.HI - this->z.HALF.HI) > 2) { return; } - if (this->hVelocity >= 0) { + if (this->zVelocity >= 0) { return; } @@ -385,7 +385,7 @@ void sub_0803CC08(Entity* this) { fx->y.HALF.HI -= 6; } - this->attachedEntity = NULL; + this->child = NULL; DeleteEntity(cloud); } diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c index 4ace44e2..f847b0bd 100644 --- a/src/enemy/lakituCloud.c +++ b/src/enemy/lakituCloud.c @@ -65,11 +65,11 @@ void sub_0803CD6C(Entity* this) { Entity* lakitu; this->action = 1; - this->height.HALF.HI = -2; + this->z.HALF.HI = -2; // Set parent to lakitu lakitu = GetCurrentRoomProperty(this->type); - this->attachedEntity = lakitu; + this->child = lakitu; this->parent = lakitu; this->field_0x78.HWORD = this->x.HALF.HI; @@ -96,9 +96,9 @@ void sub_0803CDD8(Entity* this) { u8 one; u8 draw; - draw = this->spriteSettings.b.draw; + draw = this->spriteSettings.draw; one = 1; - this->spriteSettings.b.draw = draw ^ one; + this->spriteSettings.draw = draw ^ one; this->actionDelay--; @@ -107,14 +107,14 @@ void sub_0803CDD8(Entity* this) { COLLISION_ON(this); - this->spriteSettings.b.draw = one; + this->spriteSettings.draw = one; } } void sub_0803CE14(Entity* this) { u8 direction; - sub_080A2CC0(this, &this->attachedEntity, &this->field_0x74.HWORD); + sub_080A2CC0(this, &this->child, &this->field_0x74.HWORD); direction = this->direction; if (direction & 0x80) { @@ -139,7 +139,7 @@ void sub_0803CE3C(Entity* this) { this->x.HALF.HI = this->field_0x78.HWORD; this->y.HALF.HI = this->field_0x7a.HWORD; - this->attachedEntity = this->parent; + this->child = this->parent; sub_0803CE14(this); } diff --git a/src/enemy/leever.c b/src/enemy/leever.c index 4bdb53c8..d5b8e3de 100644 --- a/src/enemy/leever.c +++ b/src/enemy/leever.c @@ -69,7 +69,7 @@ void Leever_Idle(Entity* this) { if (--this->actionDelay == 0) { if (Leever_PlayerInRange(this, Random() & 0x1f)) { this->action = 2; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; this->direction = (GetFacingDirection(this, gUnk_020000B0) + gLeeverDrift[Random() & 1]) & 0x1f; InitializeAnimation(this, LeeverAnimation_DigUp); UpdateSpriteForCollisionLayer(this); @@ -82,7 +82,7 @@ void Leever_Idle(Entity* this) { void Leever_DigUp(Entity* this) { GetNextFrame(this); - if (this->frames.b.f3 != 0) { + if (this->frame & 0x80) { this->action = 3; if (this->type == LeeverForm_Red) { this->field_0x74.HWORD = 180; @@ -90,8 +90,8 @@ void Leever_DigUp(Entity* this) { this->field_0x74.HWORD = 110; } InitializeAnimation(this, LeeverAnimation_Attack); - } else if (this->frames.b.f0 != 0) { - this->frames.all &= 0xfe; + } else if ((this->frame & 1) != 0) { + this->frame &= 0xfe; COLLISION_ON(this); } } @@ -110,10 +110,10 @@ void Leever_Attack(Entity* this) { void Leever_DigDown(Entity* this) { Leever_Move(this); GetNextFrame(this); - if ((this->frames.b.f3) != 0) { + if (this->frame & 0x80) { this->action = 1; this->actionDelay = 0xf0; - this->spriteSettings.b.draw = FALSE; + this->spriteSettings.draw = FALSE; } } @@ -167,7 +167,7 @@ void Leever_Move(Entity* this) { this->field_0x74.HWORD = 1; } - this->speed = (this->frames.all & 0xf) * 0x20; + this->speed = (this->frame & 0xf) * 0x20; if (this->type == LeeverForm_Red) { if ((this->field_0xf++ & 0xf) == 0) { sub_08004596(this, sub_0800132C(this, gUnk_020000B0)); diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index 54d0852f..0eadf657 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -45,7 +45,7 @@ void sub_08027DA4(Entity* this) { } } - if (this->currentHealth == 0) { + if (this->health == 0) { this->actionDelay = 0x20; } @@ -74,19 +74,19 @@ void sub_08027E70(Entity* this) { switch (this->type) { case 0: this->action = 3; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; COLLISION_OFF(this); this->actionDelay = 0; break; case 1: this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->actionDelay = 8; InitializeAnimation(this, 1); break; case 2: this->action = 1; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->actionDelay = 0; this->hitType = 1; InitializeAnimation(this, 0); @@ -132,7 +132,7 @@ void nullsub_12(Entity* this) { void sub_08027F84(Entity* this) { if (sub_08049FDC(this, 1)) { this->action = 5; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 0); CreateDust(this); } @@ -149,7 +149,7 @@ void sub_08027FB4(Entity* this) { void sub_08027FE0(Entity* this) { GetNextFrame(this); - if (this->frames.all & 1) { + if (this->frame & 1) { this->action = 1; COLLISION_ON(this); this->direction = sub_08049F84(this, 1); @@ -161,9 +161,9 @@ void sub_08027FE0(Entity* this) { void sub_0802802C(Entity* this) { GetNextFrame(this); - if (this->frames.all & 1) { + if (this->frame & 1) { this->action = 3; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->direction = 0; this->actionDelay = 0; CreateDust(this); @@ -209,11 +209,11 @@ NONMATCH("asm/non_matching/likeLike/sub_0802810C.inc", void sub_0802810C(Entity* gPlayerState.field_0xa = 0; gPlayerState.flags &= 0xffffffef; gPlayerEntity.flags |= 0x80; - gPlayerEntity.hVelocity = 0x18000; + gPlayerEntity.zVelocity = 0x18000; gPlayerEntity.iframes = -60; gPlayerEntity.direction = gPlayerEntity.animationState << 2; gPlayerEntity.spritePriority.b1 = this->field_0x82.HALF.HI; - gPlayerEntity.height.HALF.HI = gPlayerEntity.spriteOffsetY; + gPlayerEntity.z.HALF.HI = gPlayerEntity.spriteOffsetY; gPlayerEntity.spriteOffsetY = 0; this->action = 4; this->actionDelay = 0x50; diff --git a/src/enemy/madderpillar.c b/src/enemy/madderpillar.c index 314b28fc..fd8d170a 100644 --- a/src/enemy/madderpillar.c +++ b/src/enemy/madderpillar.c @@ -59,7 +59,7 @@ void sub_080298A4(Entity* this) { this->field_0x76.HALF.HI = 0; sub_0801D2B4(this, 0x7f); EnqueueSFX(0xfe); - this->attachedEntity->action = 2; + this->child->action = 2; break; } } @@ -86,33 +86,33 @@ void sub_0802999C(Entity* this) { ent1 = CreateEnemy(MADDERPILLAR, 1); ent1->parent = this; PositionRelative(this, ent1, 0, 5); - this->attachedEntity = ent1; + this->child = ent1; ent2 = CreateEnemy(MADDERPILLAR, 2); ent2->parent = this; PositionRelative(this, ent2, 0, 4); - ent1->attachedEntity = ent2; + ent1->child = ent2; ent3 = CreateEnemy(MADDERPILLAR, 3); ent3->parent = this; PositionRelative(this, ent3, 0, 3); - ent2->attachedEntity = ent3; + ent2->child = ent3; ent4 = CreateEnemy(MADDERPILLAR, 4); ent4->parent = this; PositionRelative(this, ent4, 0, 2); - ent3->attachedEntity = ent4; + ent3->child = ent4; ent5 = CreateEnemy(MADDERPILLAR, 5); ent5->parent = this; PositionRelative(this, ent5, 0, 1); - ent4->attachedEntity = ent5; + ent4->child = ent5; ent6 = CreateEnemy(MADDERPILLAR, 6); - ent6->attachedEntity = this; + ent6->child = this; ent6->parent = this; PositionRelative(this, ent6, 0, 0); - ent5->attachedEntity = ent6; + ent5->child = ent6; this->action = 1; COLLISION_ON(this); @@ -179,7 +179,7 @@ void sub_08029B2C(Entity* this) { void sub_08029B90(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_0802A058(this); if (this->type < 2) { InitializeAnimation(this, 0); @@ -211,7 +211,7 @@ void sub_08029C08(Entity* this) { this->action = 3; this->actionDelay = gUnk_080CCDA0[this->type]; this->hitType = 0x6b; - this->attachedEntity->action = 2; + this->child->action = 2; } void sub_08029C2C(Entity* this) { @@ -251,7 +251,7 @@ void sub_08029C98(Entity* this) { void sub_08029CCC(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_0802A058(this); InitializeAnimation(this, 8); } @@ -276,7 +276,7 @@ void sub_08029D14(Entity* this) { } } else { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 4; this->actionDelay = 0x78; this->hitType = 0x6c; @@ -298,7 +298,7 @@ void sub_08029D78(Entity* this) { void sub_08029DAC(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 6; this->parent->field_0x76.HALF.HI = 1; InitializeAnimation(this, this->animationState + 8); @@ -378,7 +378,7 @@ bool32 sub_08029F48(Entity* this) { } void sub_08029FB4(Entity* this, u32 x, u32 y) { - u8* dst = (u8*)&this->attachedEntity->field_0x78; + u8* dst = (u8*)&this->child->field_0x78; s32 unk = this->parent->field_0x7c.BYTES.byte2; u8 idx = unk % 0xe; dst[idx] = ((x + 8) & 0xf) | (((y + 8) & 0xf) << 4); @@ -458,18 +458,18 @@ void sub_0802A098(Entity* this) { } void sub_0802A0F8(Entity* this) { - if (this->currentHealth != 0) { + if (this->health != 0) { if ((this->bitfield & 0x80) && this->iframes != 0) { Entity* ent = this; u32 i; for (i = 0; i < 6; i++) { - ent = ent->attachedEntity; + ent = ent->child; ent->iframes = this->iframes; } } } else { this->parent->flags &= ~0x80; - this->parent->currentHealth = 0; + this->parent->health = 0; this->parent->field_0xf = 0x69; } } @@ -477,7 +477,7 @@ void sub_0802A0F8(Entity* this) { bool32 sub_0802A14C(Entity* this) { u32 ret = FALSE; - if (this->parent->currentHealth == 0 || this->field_0x86.HALF.LO) { + if (this->parent->health == 0 || this->field_0x86.HALF.LO) { ret = TRUE; } else { ret = FALSE; diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index 0437d6f2..acccbab0 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -147,17 +147,17 @@ NONMATCH("asm/non_matching/mazaal/sub_0803A188.inc", void sub_0803A188(Entity* t pEVar3 = this->parent; pEVar3->field_0x7c.BYTES.byte1 = pEVar3->field_0x7c.BYTES.byte1 | (this->type == 0 ? 1 : 2); pEVar3->field_0x80.HALF.LO = (this->type == 0 ? 1 : 2) | pEVar3->field_0x80.HALF.LO; - this->attachedEntity->iframes = this->iframes; + this->child->iframes = this->iframes; entity74 = *(Entity**)&this->field_0x74; entity74->iframes = this->iframes; SoundReq(SFX_BOSS_HIT); } } else { - this->attachedEntity->iframes = this->iframes; + this->child->iframes = this->iframes; entity74 = *(Entity**)&this->field_0x74; entity74->iframes = this->iframes; InitializeAnimation(this, 0x18); - InitAnimationForceUpdate(this->attachedEntity, 9); + InitAnimationForceUpdate(this->child, 9); SoundReq(SFX_BOSS_HIT); } } @@ -180,32 +180,32 @@ void sub_0803A274(Entity* this) { if (this->type == 0) { pEVar1 = CreateEnemy(MAZAAL_HAND, 0); pEVar1->parent = this; - this->attachedEntity = pEVar1; + this->child = pEVar1; pEVar1 = CreateEnemy(MAZAAL_BRACELET, 2); pEVar1->parent = this; *(Entity**)&this->field_0x74 = pEVar1; pEVar1 = CreateObject(OBJECT_7E, 1, 0); pEVar1->parent = this; - pEVar1->attachedEntity = this->attachedEntity; + pEVar1->child = this->child; PositionRelative(this->parent, this, 0x100000, 0x200000); } else { pEVar1 = CreateEnemy(MAZAAL_HAND, 1); pEVar1->parent = this; - this->attachedEntity = pEVar1; + this->child = pEVar1; pEVar1 = CreateEnemy(MAZAAL_BRACELET, 3); pEVar1->parent = this; *(Entity**)&this->field_0x74 = pEVar1; pEVar1 = CreateObject(OBJECT_7E, 2, 0); pEVar1->parent = this; - pEVar1->attachedEntity = this->attachedEntity; - this->spriteSettings.b.flipX = 1; + pEVar1->child = this->child; + this->spriteSettings.flipX = 1; PositionRelative(this->parent, this, -0x100000, 0x200000); } if (gScreenTransition.field_0x38 != 0) { this->action = 3; COLLISION_ON(this); - this->spriteSettings.b.draw = 1; - this->attachedEntity->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; + this->child->spriteSettings.draw = 1; InitializeAnimation(this, 0x10); } else { this->action = 1; @@ -222,25 +222,25 @@ void sub_0803A364(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; switch (this->subAction & 0x7f) { case 0: case 2: break; case 1: this->subAction = 2; - pEVar3 = this->attachedEntity; - pEVar3->spriteSettings.b.draw = 1; + pEVar3 = this->child; + pEVar3->spriteSettings.draw = 1; pEVar3->spriteRendering.alphaBlend = 1; break; case 3: this->subAction = 4; - this->spriteSettings.b.draw = 1; - this->attachedEntity->spriteRendering.alphaBlend = 0; + this->spriteSettings.draw = 1; + this->child->spriteRendering.alphaBlend = 0; break; case 4: GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->subAction = 5; } break; @@ -263,16 +263,16 @@ void sub_0803A364(Entity* this) { break; case 7: GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->subAction = 8; - this->spriteSettings.b.draw = 0; - InitAnimationForceUpdate(this->attachedEntity, 8); + this->spriteSettings.draw = 0; + InitAnimationForceUpdate(this->child, 8); SoundReq(SFX_16E); } break; case 8: sub_0803B55C(this); - if ((this->attachedEntity->frames.all & 0x80) == 0) { + if ((this->child->frame & 0x80) == 0) { return; } uVar1 = 9; @@ -283,20 +283,20 @@ void sub_0803A364(Entity* this) { this->actionDelay--; if (this->actionDelay == 0) { this->subAction = 10; - InitAnimationForceUpdate(this->attachedEntity, 6); + InitAnimationForceUpdate(this->child, 6); } break; case 10: sub_0803B55C(this); - if ((this->attachedEntity->frames.all & 0x80) != 0) { + if ((this->child->frame & 0x80) != 0) { this->subAction = 0xb; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 4); } break; case 0xb: GetNextFrame(this); - if ((this->frames.all & 0x80) == 0) { + if ((this->frame & 0x80) == 0) { return; } if (this->type2 != 0) { @@ -327,7 +327,7 @@ void sub_0803A548(Entity* this) { UpdateAnimationSingleFrame(this); ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; if (sub_0803B4E4(this) == 0) { sub_0806F69C(this); } @@ -339,7 +339,7 @@ void sub_0803A58C(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; if (sub_0803B4E4(this) != 0) { sub_0803B59C(this); } else { @@ -355,7 +355,7 @@ void sub_0803A5D0(Entity* this) { COLLISION_OFF(this); ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; InitializeAnimation(this, 5); } @@ -365,12 +365,12 @@ void sub_0803A60C(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 6; - this->spriteSettings.b.draw = 0; - InitAnimationForceUpdate(this->attachedEntity, 8); + this->spriteSettings.draw = 0; + InitAnimationForceUpdate(this->child, 8); } } @@ -381,10 +381,10 @@ void sub_0803A660(Entity* this) { s8* ptr; u32 index; - pbVar3 = &this->attachedEntity->frames.all; + pbVar3 = &this->child->frame; if ((*pbVar3 & 0x80) != 0) { - if (this->height.HALF.HI > -0x50) { - this->height.HALF.HI = this->height.HALF.HI - 2; + if (this->z.HALF.HI > -0x50) { + this->z.HALF.HI = this->z.HALF.HI - 2; } else { this->action = 7; this->actionDelay = 0; @@ -400,7 +400,7 @@ void sub_0803A660(Entity* this) { } ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; } } @@ -430,10 +430,10 @@ void sub_0803A720(Entity* this) { void sub_0803A740(Entity* this) { u16 height; - height = this->height.HALF.HI + 4; - this->height.HALF.HI += 4; + height = this->z.HALF.HI + 4; + this->z.HALF.HI += 4; if (-1 < height * 0x10000) { - this->height.HALF.HI = 0; + this->z.HALF.HI = 0; this->action = 10; this->actionDelay = 10; this->parent->field_0x7c.BYTES.byte1 |= 0x40; @@ -454,8 +454,8 @@ void sub_0803A780(Entity* this) { } void sub_0803A7AC(Entity* this) { - if (this->height.HALF.HI > -6) { - this->height.HALF.HI--; + if (this->z.HALF.HI > -6) { + this->z.HALF.HI--; } else { this->action = 0xc; } @@ -467,10 +467,10 @@ void sub_0803A7CC(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; if (sub_0803B4E4(this)) { this->action = 0xd; - InitAnimationForceUpdate(this->attachedEntity, 6); + InitAnimationForceUpdate(this->child, 6); } else { sub_0806F69C(this); } @@ -482,11 +482,11 @@ void sub_0803A814(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; sub_0803B55C(this); - if ((this->attachedEntity->frames.all & 0x80) != 0) { + if ((this->child->frame & 0x80) != 0) { this->action = 0xe; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 4); } } @@ -497,9 +497,9 @@ void sub_0803A86C(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { COLLISION_ON(this); sub_0803B59C(this); } @@ -516,9 +516,9 @@ void sub_0803A8B8(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; InitializeAnimation(this, 6); - InitAnimationForceUpdate(this->attachedEntity, 1); + InitAnimationForceUpdate(this->child, 1); SoundReq(SFX_153); } @@ -528,7 +528,7 @@ void sub_0803A90C(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; GetNextFrame(this); sub_0803B55C(this); sub_0806F69C(this); @@ -538,7 +538,7 @@ void sub_0803A90C(Entity* this) { this->direction = this->type * 0x10 + 8; this->speed = 0x200; InitializeAnimation(this, 7); - InitAnimationForceUpdate(this->attachedEntity, 2); + InitAnimationForceUpdate(this->child, 2); } } @@ -548,7 +548,7 @@ void sub_0803A978(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; GetNextFrame(this); sub_0803B55C(this); if ((++this->actionDelay & 3) == 0) { @@ -561,7 +561,7 @@ void sub_0803A978(Entity* this) { COLLISION_OFF(this); *(u8*)(*(int*)&this->field_0x74 + 0x10) &= 0x7f; InitializeAnimation(this, 8); - InitAnimationForceUpdate(this->attachedEntity, 3); + InitAnimationForceUpdate(this->child, 3); } } @@ -572,7 +572,7 @@ void sub_0803AA00(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; if (sub_0803B870(this) == 0) { direction = (this->type ^ 1) * 0x10 + 8; if ((++this->actionDelay & 3) == 0) { @@ -581,10 +581,10 @@ void sub_0803AA00(Entity* this) { sub_0806F69C(this); if ((this->direction == direction) || (this->y.HALF.HI >= gPlayerEntity.y.HALF.HI)) { this->action = 0x13; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->direction = direction; this->field_0x80.HWORD = gPlayerEntity.x.HALF.HI; - InitAnimationForceUpdate(this->attachedEntity, 4); + InitAnimationForceUpdate(this->child, 4); } } } @@ -596,7 +596,7 @@ NONMATCH("asm/non_matching/mazaal/sub_0803AA98.inc", void sub_0803AA98(Entity* t ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; if (sub_0803B870(this) == 0) { sub_0806F69C(this); if (sub_0803B6F4(this) != 0) { @@ -604,7 +604,7 @@ NONMATCH("asm/non_matching/mazaal/sub_0803AA98.inc", void sub_0803AA98(Entity* t this->speed = 0x40; InitializeAnimation(this, 10); (*(Entity**)&this->field_0x74)->flags |= 0x80; - temp = this->attachedEntity; + temp = this->child; temp->hitType = 0x13; InitAnimationForceUpdate(temp, 5); SoundReq(SFX_16E); @@ -619,10 +619,10 @@ void sub_0803AB10(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; sub_0806F69C(this); sub_0803B55C(this); - if ((this->attachedEntity->frames.all & 0x80) != 0) { + if ((this->child->frame & 0x80) != 0) { this->action = 0x15; this->actionDelay = 0xf; } @@ -634,12 +634,12 @@ void sub_0803AB5C(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; if (--this->actionDelay == 0) { this->action = 0x16; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 0xb); - InitAnimationForceUpdate(this->attachedEntity, 6); + InitAnimationForceUpdate(this->child, 6); } } @@ -649,15 +649,15 @@ void sub_0803ABB4(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; GetNextFrame(this); sub_0803B55C(this); - if ((this->attachedEntity->frames.all & 0x80) != 0) { + if ((this->child->frame & 0x80) != 0) { this->action = 0x17; COLLISION_ON(this); this->speed = 0x180; InitializeAnimation(this, 0x10); - InitAnimationForceUpdate(this->attachedEntity, 0); + InitAnimationForceUpdate(this->child, 0); } } @@ -667,7 +667,7 @@ void sub_0803AC1C(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; if (sub_0803B4E4(this)) { sub_0803B59C(this); } else { @@ -681,7 +681,7 @@ void sub_0803AC60(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; GetNextFrame(this); if (!this->actionDelay) { if (sub_0803B4E4(this) != 0) { @@ -707,14 +707,14 @@ void sub_0803ACC0(Entity* this) { } break; case 1: - if (--this->height.HALF.HI * 0x10000 >> 0x10 < -0x20) { + if (--this->z.HALF.HI * 0x10000 >> 0x10 < -0x20) { this->subAction = 2; } break; case 2: - uVar2 = this->height.HALF.HI += 4; + uVar2 = this->z.HALF.HI += 4; if (-1 < (uVar2 * 0x10000)) { - this->height.HALF.HI = 0; + this->z.HALF.HI = 0; this->actionDelay = 0xc; this->subAction = 3; sub_08080964(8, 0); @@ -728,15 +728,15 @@ void sub_0803ACC0(Entity* this) { } break; case 4: - uVar2 = this->height.HALF.HI -= 2; + uVar2 = this->z.HALF.HI -= 2; if (uVar2 * 0x10000 >> 0x10 < -0x28) { this->subAction = 5; } break; case 5: - uVar2 = this->height.HALF.HI += 4; + uVar2 = this->z.HALF.HI += 4; if (-1 < (uVar2 * 0x10000)) { - this->height.HALF.HI = 0; + this->z.HALF.HI = 0; this->action = 0x1a; this->actionDelay = 0x3c; sub_08080964(0x1e, 0); @@ -752,10 +752,10 @@ void sub_0803ACC0(Entity* this) { void sub_0803ADAC(Entity* this) { if (--this->actionDelay == 0) { this->action = 0x16; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; (*(Entity**)&this->field_0x74)->flags |= 0x80; InitializeAnimation(this, 0xb); - InitAnimationForceUpdate(this->attachedEntity, 6); + InitAnimationForceUpdate(this->child, 6); sub_0803B798(); } else { sub_0803B824(this); @@ -768,13 +768,13 @@ void sub_0803ADF4(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; UpdateAnimationSingleFrame(this); GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 0x1c; this->actionDelay = 0x1e; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } } @@ -784,11 +784,11 @@ void sub_0803AE48(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; UpdateAnimationSingleFrame(this); if (((this->actionDelay == 0) || (--this->actionDelay == 0)) && ((this->parent->field_0x7c.BYTES.byte1 & 3) != 0)) { this->action = 0x1d; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 4); } else { if (sub_0803B4E4(this) == 0) { @@ -803,10 +803,10 @@ void sub_0803AEC4(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; UpdateAnimationSingleFrame(this); GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { COLLISION_ON(this); sub_0803B59C(this); } @@ -816,21 +816,21 @@ void sub_0803AF18(Entity* this) { this->action = 0x1f; COLLISION_OFF(this); InitializeAnimation(this, 5); - this->height.HALF.HI = gUnk_080CED6C[(this->parent->field_0xf >> 4) & 7] + 4; + this->z.HALF.HI = gUnk_080CED6C[(this->parent->field_0xf >> 4) & 7] + 4; } void sub_0803AF50(Entity* this) { GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 0x20; - this->spriteSettings.b.draw = 0; - InitAnimationForceUpdate(this->attachedEntity, 8); + this->spriteSettings.draw = 0; + InitAnimationForceUpdate(this->child, 8); } } void sub_0803AF7C(Entity* this) { sub_0803B55C(this); - if ((this->attachedEntity->frames.all & 0x80) != 0) { + if ((this->child->frame & 0x80) != 0) { this->action = 0x21; this->actionDelay = 0xf; } @@ -840,8 +840,8 @@ void sub_0803AF9C(Entity* this) { if (this->actionDelay != 0) { this->actionDelay--; } else { - if (-0x20 < this->height.HALF.HI) { - this->height.HALF.HI -= 2; + if (-0x20 < this->z.HALF.HI) { + this->z.HALF.HI -= 2; } else { this->action = 0x22; this->actionDelay = 10; @@ -856,13 +856,13 @@ void sub_0803AFC8(Entity* this) { } void sub_0803AFE0(Entity* this) { - if (this->height.HALF.HI < 0) { - this->height.HALF.HI += 4; + if (this->z.HALF.HI < 0) { + this->z.HALF.HI += 4; } else { this->action = 0x24; this->actionDelay = 0xf0; *(u8*)&this->cutsceneBeh = 3; - this->height.HALF.HI = 0; + this->z.HALF.HI = 0; sub_08080964(0xa0, 0); SoundReq(SFX_158); } @@ -879,11 +879,11 @@ void sub_0803B01C(Entity* this) { } void sub_0803B04C(Entity* this) { - if (this->height.HALF.HI > -6) { - this->height.HALF.HI--; + if (this->z.HALF.HI > -6) { + this->z.HALF.HI--; } else { this->action = 0x26; - InitAnimationForceUpdate(this->attachedEntity, 6); + InitAnimationForceUpdate(this->child, 6); } } @@ -893,20 +893,20 @@ void sub_0803B074(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; sub_0803B55C(this); - if ((this->attachedEntity->frames.all & 0x80) != 0) { + if ((this->child->frame & 0x80) != 0) { this->action = 0x27; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 4); - InitAnimationForceUpdate(this->attachedEntity, 0); + InitAnimationForceUpdate(this->child, 0); } } void sub_0803B0D4(Entity* this) { UpdateAnimationSingleFrame(this); GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { COLLISION_ON(this); sub_0803B59C(this); } @@ -916,7 +916,7 @@ void sub_0803B100(Entity* this) { Entity* temp; this->action = 0x29; - this->hVelocity = 0x14000; + this->zVelocity = 0x14000; if (this->type == 0) { this->hitbox = &gUnk_080FD364; } else { @@ -925,12 +925,12 @@ void sub_0803B100(Entity* this) { temp = *(Entity**)&this->field_0x74; temp->action = 3; temp->field_0x74.HALF.LO = 0x20; - InitAnimationForceUpdate(this->attachedEntity, 9); + InitAnimationForceUpdate(this->child, 9); SoundReq(SFX_14F); } void sub_0803B144(Entity* this) { - UpdateAnimationSingleFrame(this->attachedEntity); + UpdateAnimationSingleFrame(this->child); if (sub_08003FC4(this, 0x2000) == 0) { this->action = 0x2a; InitializeAnimation(this, 0x16); @@ -941,11 +941,11 @@ void sub_0803B144(Entity* this) { void sub_0803B17C(Entity* this) { GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 0x2b; COLLISION_ON(this); this->hitType = 0x18; - this->currentHealth = 0xff; + this->health = 0xff; this->field_0x7c.HALF.HI = 600; } } @@ -954,14 +954,14 @@ void sub_0803B1B8(Entity* this) { Entity* temp; u16 val; - if ((this->frames.all & 0x80) == 0) { + if ((this->frame & 0x80) == 0) { GetNextFrame(this); - UpdateAnimationSingleFrame(this->attachedEntity); + UpdateAnimationSingleFrame(this->child); } - if (this->currentHealth < 0xf5) { + if (this->health < 0xf5) { this->action = 0x32; this->field_0x7c.HALF.HI = 0x5dc; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->hitType = 0x14; temp = CreateFx(this, FX_GIANT_EXPLOSION4, 0); if (temp != (Entity*)0x0) { @@ -982,7 +982,7 @@ void sub_0803B1B8(Entity* this) { if ((temp->field_0x80.HALF.LO & 0xc) == 0xc) { temp->action = 0xb; temp->actionDelay = 0x78; - temp->hVelocity = 0; + temp->zVelocity = 0; (*(Entity**)&temp->field_0x74)->field_0x7c.HALF_U.HI = 0x708; (*(Entity**)&temp->field_0x78)->field_0x7c.HALF_U.HI = 0x708; } @@ -997,9 +997,9 @@ void sub_0803B2D0(Entity* this) { Entity* entity; GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 0x2d; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; entity = *(Entity**)&this->field_0x74; entity->action = 2; entity->field_0x74.HALF.LO = 0; @@ -1012,7 +1012,7 @@ void sub_0803B30C(Entity* this) { Entity* entity; entity = *(Entity**)&this->field_0x74; - if ((entity->frames.all & 0x80) != 0) { + if ((entity->frame & 0x80) != 0) { this->action = 0x2e; sub_0803B8E8(this, 0x13); InitializeAnimation(entity, 0); @@ -1020,8 +1020,8 @@ void sub_0803B30C(Entity* this) { } void sub_0803B338(Entity* this) { - if (this->height.HALF.HI > -10) { - this->height.HALF.HI--; + if (this->z.HALF.HI > -10) { + this->z.HALF.HI--; } else { this->action = 0x2f; this->actionDelay = 0xf; @@ -1034,7 +1034,7 @@ void sub_0803B35C(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; if (--this->actionDelay == 0) { this->action = 0x30; } @@ -1046,12 +1046,12 @@ void sub_0803B398(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; if (sub_0803B4E4(this) != 0) { this->action = 0x31; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 4); - InitAnimationForceUpdate(this->attachedEntity, 0); + InitAnimationForceUpdate(this->child, 0); } else { sub_0806F69C(this); } @@ -1065,9 +1065,9 @@ void sub_0803B3F4(Entity* this) { ptr = gUnk_080CED6C; index = ((this->parent->field_0xf >> 4) + 3); - this->height.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->hitType = 0x17; if (this->type == 0) { this->hitbox = (Hitbox*)&gUnk_080FD35C; @@ -1114,7 +1114,7 @@ u32 sub_0803B4E4(Entity* this) { } void sub_0803B538(Entity* this) { - PositionRelative(this, this->attachedEntity, 0, -0x10000); + PositionRelative(this, this->child, 0, -0x10000); PositionRelative(this, *(Entity**)&this->field_0x74, 0, -0x20000); } @@ -1123,9 +1123,9 @@ void sub_0803B55C(Entity* this) { Entity* pEVar1; pEVar1 = *(Entity**)&this->field_0x74; - entity = this->attachedEntity; + entity = this->child; UpdateAnimationSingleFrame(entity); - if ((entity->frames.all & 0x10) != 0) { + if ((entity->frame & 0x10) != 0) { if (pEVar1->animIndex != 1) { InitializeAnimation(pEVar1, 1); } @@ -1157,7 +1157,7 @@ void sub_0803B5C0(Entity* this) { } else { temp = gUnk_080CFD0C[0x16 - direction]; } - if (this->frames.all != temp) { + if (this->frame != temp) { InitializeAnimation(this, temp); } } @@ -1229,8 +1229,8 @@ void sub_0803B798(void) { gPlayerState.field_0xa = 0; gPlayerState.flags &= 0xffef; gPlayerEntity.flags |= 0x80; - gPlayerEntity.hVelocity = 0x18000; - gPlayerEntity.height.HALF.HI = -10; + gPlayerEntity.zVelocity = 0x18000; + gPlayerEntity.z.HALF.HI = -10; gPlayerEntity.direction = 0x10; gPlayerEntity.animationState = 4; gPlayerEntity.spritePriority.b1 = 1; @@ -1256,11 +1256,11 @@ void sub_0803B824(Entity* this) { u32 sub_0803B870(Entity* this) { Entity* entity; - entity = this->attachedEntity; + entity = this->child; if ((entity->bitfield & 0x80) != 0 && (gPlayerState.flags & 0x10) != 0) { this->action = 0x18; this->actionDelay = 0x44; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; gPlayerEntity.flags = gPlayerEntity.flags & 0x7f; gPlayerEntity.iframes = -0x10; sub_0803B824(this); @@ -1276,7 +1276,7 @@ u32 sub_0803B870(Entity* this) { void sub_0803B8E8(Entity* this, u32 unk) { Entity* entity; - entity = this->attachedEntity; + entity = this->child; entity->hitType = unk; entity = (*(Entity**)&this->field_0x74); entity->hitType = unk; @@ -1289,14 +1289,14 @@ void sub_0803B8F8(Entity* this) { void sub_0803B910(Entity* this) { if (gScreenTransition.field_0x38 != 0) { this->action = 2; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; *(u8*)&this->field_0x74 = 0; sub_0803BA8C(this, 10); } else { this->action = 1; *(u8*)&this->field_0x74 = 0x80; } - this->spriteSettings.b.flipX = (this->type - 2); + this->spriteSettings.flipX = (this->type - 2); InitializeAnimation(this, 0); CopyPositionAndSpriteOffset(this->parent, this); } @@ -1334,7 +1334,7 @@ void sub_0803B978(Entity* this) { break; case 4: this->subAction = 5; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spriteRendering.alphaBlend = 1; break; default: @@ -1393,7 +1393,7 @@ void sub_0803BA8C(Entity* this, u32 unk) { sub_0801D2B4(this, sVar2); (*(Entity**)&this->parent->field_0x78)->palette.b.b0 = this->palette.raw << 0x1c >> 0x1c; (*(Entity**)&this->parent->field_0x78)->palette.b.b4 = this->palette.b.b0; - this->parent->attachedEntity->palette.b.b0 = this->palette.raw << 0x1c >> 0x1c; - this->parent->attachedEntity->palette.b.b4 = this->palette.b.b0; + this->parent->child->palette.b.b0 = this->palette.raw << 0x1c >> 0x1c; + this->parent->child->palette.b.b4 = this->palette.b.b0; } } diff --git a/src/enemy/mazaalHand.c b/src/enemy/mazaalHand.c index 49c19820..c429e428 100644 --- a/src/enemy/mazaalHand.c +++ b/src/enemy/mazaalHand.c @@ -23,7 +23,7 @@ const Hitbox* const gUnk_080CEF58[] = { void MazaalHand(Entity* this) { if (this->action == 0) { this->action = 1; - this->spriteSettings.b.flipX = this->type; + this->spriteSettings.flipX = this->type; InitAnimationForceUpdate(this, 0); } sub_08035194(this); diff --git a/src/enemy/mazaalHead.c b/src/enemy/mazaalHead.c index 55199ec2..5de9aa38 100644 --- a/src/enemy/mazaalHead.c +++ b/src/enemy/mazaalHead.c @@ -132,7 +132,7 @@ void sub_08033F3C(Entity* this) { } else { this->action = 1; } - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x6c.HALF.HI |= 1; this->field_0x80.HALF.LO = 0; InitializeAnimation(this, 0); @@ -183,8 +183,8 @@ void sub_08033FFC(Entity* this) { } break; case 4: - this->height.WORD += -0x8000; - if (this->height.HALF.HI == -10) { + this->z.WORD += -0x8000; + if (this->z.HALF.HI == -10) { this->subAction = 5; this->field_0x80.HALF.HI = 1; } @@ -335,8 +335,8 @@ void sub_08034348(Entity* this) { if (this->field_0x7c.HALF_U.HI != 0) { this->field_0x7c.HALF.HI--; } else { - if (this->height.HALF.HI > -10) { - this->height.HALF.HI--; + if (this->z.HALF.HI > -10) { + this->z.HALF.HI--; } else { if (sub_080349D8(this) != 0) { this->field_0x80.HALF.HI = 1; @@ -351,7 +351,7 @@ void sub_0803438C(Entity* this) { const s8* pVar; if (this->actionDelay == 0) { - this->currentHealth = 0; + this->health = 0; } else { this->actionDelay--; if (this->actionDelay > 0xc0) { @@ -686,7 +686,7 @@ END_NONMATCH void sub_0803499C(Entity* this) { if (((this->field_0x80.HALF.LO & 0xc) != 0xc) && (this->field_0x80.HALF.HI != 0)) { - this->height.HALF.HI = gUnk_080CED6C[(++this->field_0xf >> 4) & 7]; + this->z.HALF.HI = gUnk_080CED6C[(++this->field_0xf >> 4) & 7]; } } @@ -739,8 +739,8 @@ void sub_08034A84(Entity* this) { } else { if (this->action == 0) { this->action = 1; - this->spriteSettings.b.draw = 1; - this->spriteSettings.b.flipX = 1; + this->spriteSettings.draw = 1; + this->spriteSettings.flipX = 1; InitializeAnimation(this, 0); } CopyPositionAndSpriteOffset(this->parent, this); @@ -764,7 +764,7 @@ void sub_08034B0C(Entity* this) { this->actionDelay--; } else { GetNextFrame(this); - if ((this->frames.all & 0x80) == 0) { + if ((this->frame & 0x80) == 0) { return; } this->action = 2; @@ -797,7 +797,7 @@ END_NONMATCH void sub_08034BA0(Entity* this) { GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->parent->field_0x7c.HALF.HI = 0xff; DeleteEntity(this); } @@ -810,7 +810,7 @@ void sub_08034BC8(Entity* this) { } sub_0806FA90(this->parent, this, 0, 1); sub_0800445C(this); - if (this->height.HALF.HI == 0) { + if (this->z.HALF.HI == 0) { sub_08034C00(this); } } diff --git a/src/enemy/mazaalMacro.c b/src/enemy/mazaalMacro.c index 2edf3d96..fbb030b8 100644 --- a/src/enemy/mazaalMacro.c +++ b/src/enemy/mazaalMacro.c @@ -85,7 +85,7 @@ void sub_08034CC4(Entity* this) { SetTile(0x4022, COORD_TO_TILE(this), this->collisionLayer); entity = CreateEnemy(MAZAAL_MACRO, 2); if (entity != NULL) { - this->attachedEntity = entity; + this->child = entity; entity->parent = this; CopyPosition(this, entity); } @@ -137,8 +137,8 @@ void sub_08034E68(Entity* this) { ScriptExecutionContext* scriptExecutionContext; if (this->parent->next == NULL) { - if (this->spriteSettings.b.draw != 0) { - this->spriteSettings.b.draw = 0; + if (this->spriteSettings.draw != 0) { + this->spriteSettings.draw = 0; sub_08035120(this); } if (gScreenTransition.field_0x39 == 0) { @@ -187,7 +187,7 @@ void sub_08034F58(Entity* this) { } void sub_08034F70(Entity* this) { - this->currentHealth = gScreenTransition.field_0x39; + this->health = gScreenTransition.field_0x39; if (gScreenTransition.field_0x39 >= 0x3d) { this->type2 = 0; } else if (gScreenTransition.field_0x39 >= 0x1f) { @@ -199,38 +199,38 @@ void sub_08034F70(Entity* this) { void sub_08034FA0(Entity* this) { if (0 < this->iframes) { - this->attachedEntity->iframes = this->iframes; + this->child->iframes = this->iframes; sub_08080964(0xc, 1); } switch (this->type2) { case 0: - if (this->currentHealth < 0x3c) { + if (this->health < 0x3c) { gScreenTransition.field_0x39 = 0x3c; sub_08035050(this); return; } break; case 1: - if (this->currentHealth < 0x1e) { + if (this->health < 0x1e) { gScreenTransition.field_0x39 = 0x1e; sub_08035050(this); return; } break; default: - if (this->currentHealth == 0) { + if (this->health == 0) { sub_0807BA8C(COORD_TO_TILE(this), this->collisionLayer); } break; } - gScreenTransition.field_0x39 = this->currentHealth; + gScreenTransition.field_0x39 = this->health; } void sub_08035050(Entity* this) { Entity* entity; COLLISION_OFF(this); - this->currentHealth = 0; + this->health = 0; entity = CreateEnemy(VAATI_PROJECTILE, 0); if (entity != NULL) { entity->type2 = 1; diff --git a/src/enemy/miniFireballGuy.c b/src/enemy/miniFireballGuy.c index 930ed8f0..7f538b1b 100644 --- a/src/enemy/miniFireballGuy.c +++ b/src/enemy/miniFireballGuy.c @@ -24,8 +24,8 @@ void sub_080455D4(Entity* this) { void sub_080455E4(Entity* this) { if ((this != this->parent) && (this->parent != NULL)) { this->field_0x6c.HALF.LO &= 0x7f; - this->parent->attachedEntity = this->attachedEntity; - this->attachedEntity->parent = this->parent; + this->parent->child = this->child; + this->child->parent = this->parent; } sub_0804A7D4(this); } @@ -35,7 +35,7 @@ void nullsub_23(Entity* this) { void sub_08045618(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->speed = 0x80; this->field_0x3c = this->field_0x3c | 0x10; sub_0804A720(this); @@ -53,7 +53,7 @@ void sub_08045654(Entity* this) { void sub_08045678(Entity* this) { - this->hVelocity = 0x1c000; + this->zVelocity = 0x1c000; if (this->actionDelay != 0) { this->actionDelay--; } else { diff --git a/src/enemy/miniSlime.c b/src/enemy/miniSlime.c index 68c1303a..521b52a8 100644 --- a/src/enemy/miniSlime.c +++ b/src/enemy/miniSlime.c @@ -32,8 +32,8 @@ void sub_0804525C(Entity* this) { Entity* parent = this->parent; if (this != parent && parent) { this->field_0x6c.HALF.LO &= 0x7f; - this->parent->attachedEntity = this->attachedEntity; - this->attachedEntity->parent = this->parent; + this->parent->child = this->child; + this->child->parent = this->parent; if (this->field_0x6c.HALF.HI & 0x40) ReplaceMonitoredEntity(this, parent); } @@ -45,7 +45,7 @@ void nullsub_22(void) { void sub_080452A4(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->speed = 0x100; sub_0804A720(this); InitializeAnimation(this, 6); diff --git a/src/enemy/moldorm.c b/src/enemy/moldorm.c index 909f3792..25ae0111 100644 --- a/src/enemy/moldorm.c +++ b/src/enemy/moldorm.c @@ -31,17 +31,17 @@ void sub_08022BD4(Entity* this) { } void sub_08022BEC(Entity* this) { - if (this->field_0x7a.HALF.LO != this->currentHealth) + if (this->field_0x7a.HALF.LO != this->health) this->field_0x7a.HALF.HI = 30; - this->field_0x7a.HALF.LO = this->currentHealth; + this->field_0x7a.HALF.LO = this->health; this->actionDelay = 1; this->direction = this->knockbackDirection; this->animationState = ((this->direction + 2) & 0x1c) >> 2; this->frameIndex = this->animationState; - this->attachedEntity->iframes = this->iframes; + this->child->iframes = this->iframes; (*(Entity**)&this->field_0x7c)->iframes = this->iframes; (*(Entity**)&this->field_0x80)->iframes = this->iframes; sub_0804AA30(this, gUnk_080CBBA0); @@ -56,19 +56,19 @@ void sub_08022C58(Entity* this) { return; tail0 = CreateEnemy(MOLDORM, 1); - this->attachedEntity = tail0; + this->child = tail0; tail0->spritePriority.b0 = 5; tail0->parent = this; CopyPosition(this, tail0); tail1 = CreateEnemy(MOLDORM, 2); - tail0->attachedEntity = tail1; + tail0->child = tail1; tail1->spritePriority.b0 = 5; tail1->parent = this; CopyPosition(this, tail1); tail2 = CreateEnemy(MOLDORM, 3); - tail1->attachedEntity = tail2; + tail1->child = tail2; tail2->spritePriority.b0 = 5; tail2->parent = this; CopyPosition(this, tail2); @@ -79,14 +79,14 @@ void sub_08022C58(Entity* this) { this->field_0xf = 1; COLLISION_ON(this); this->parent = this; - this->attachedEntity = tail0; + this->child = tail0; *(Entity**)&this->field_0x7c = tail1; *(Entity**)&this->field_0x80 = tail2; this->direction = Random() & 0x1f; this->animationState = ((this->direction + 2) & 0x1c) >> 2; this->frameIndex = this->animationState; - this->field_0x7a.HALF.LO = this->currentHealth; + this->field_0x7a.HALF.LO = this->health; } void sub_08022D40(Entity* this) { diff --git a/src/enemy/moldworm.c b/src/enemy/moldworm.c index 9b53911f..7fb15f46 100644 --- a/src/enemy/moldworm.c +++ b/src/enemy/moldworm.c @@ -51,8 +51,8 @@ NONMATCH("asm/non_matching/moldworm/Moldworm.inc", void Moldworm(Entity* this)) } } - if (this->parent->field_0x7c.BYTES.byte0 != this->parent->field_0x7c.BYTES.byte1 && this->attachedEntity) { - ((u8*)&this->attachedEntity->field_0x78)[(this->parent->field_0x7c.BYTES.byte0 - 1) & 0xf] = + if (this->parent->field_0x7c.BYTES.byte0 != this->parent->field_0x7c.BYTES.byte1 && this->child) { + ((u8*)&this->child->field_0x78)[(this->parent->field_0x7c.BYTES.byte0 - 1) & 0xf] = (((this->x.HALF.HI - prevX + 8) & 0xf) << 4) | ((this->y.HALF.HI - prevY + 8U) & 0xf); } } @@ -80,11 +80,11 @@ void sub_080230E4(Entity* this) { } } - if (this->currentHealth == 0 && this->field_0x7c.BYTES.byte3 == 0 && this->action == 7) { + if (this->health == 0 && this->field_0x7c.BYTES.byte3 == 0 && this->action == 7) { CopyPosition(this, &gPlayerEntity); gPlayerEntity.flags = gPlayerEntity.flags | 0x80; - gPlayerEntity.spriteSettings.b.draw = 1; - gPlayerEntity.hVelocity = 0x18000; + gPlayerEntity.spriteSettings.draw = 1; + gPlayerEntity.zVelocity = 0x18000; gPlayerEntity.direction = 0xff; gPlayerEntity.iframes = -0x14; gPlayerState.jumpStatus = 0x41; @@ -106,32 +106,32 @@ void sub_080231BC(Entity* this) { if (gEntCount < 0x40) { Entity* ent; - ent = this->attachedEntity = CreateEnemy(MOLDWORM, 1); + ent = this->child = CreateEnemy(MOLDWORM, 1); ent->parent = this; - ent = ent->attachedEntity = CreateEnemy(MOLDWORM, 2); + ent = ent->child = CreateEnemy(MOLDWORM, 2); ent->parent = this; - ent = ent->attachedEntity = CreateEnemy(MOLDWORM, 3); + ent = ent->child = CreateEnemy(MOLDWORM, 3); ent->parent = this; - ent = ent->attachedEntity = CreateEnemy(MOLDWORM, 4); + ent = ent->child = CreateEnemy(MOLDWORM, 4); ent->parent = this; - ent = ent->attachedEntity = CreateEnemy(MOLDWORM, 5); + ent = ent->child = CreateEnemy(MOLDWORM, 5); ent->parent = this; - ent = ent->attachedEntity = CreateEnemy(MOLDWORM, 6); + ent = ent->child = CreateEnemy(MOLDWORM, 6); ent->parent = this; - ent = ent->attachedEntity = CreateEnemy(MOLDWORM, 7); + ent = ent->child = CreateEnemy(MOLDWORM, 7); ent->parent = this; - ent->attachedEntity = CreateEnemy(MOLDWORM, 8); - *(Entity**)&ent->attachedEntity->field_0x74 = ent; - ent = ent->attachedEntity; + ent->child = CreateEnemy(MOLDWORM, 8); + *(Entity**)&ent->child->field_0x74 = ent; + ent = ent->child; ent->parent = this; - ent->attachedEntity = NULL; + ent->child = NULL; sub_0804A720(this); this->action = 6; this->actionDelay = 0x1e; @@ -167,7 +167,7 @@ void sub_08023288(Entity* this) { void sub_08023330(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 4; this->actionDelay = 0x19; COLLISION_ON(this); @@ -177,7 +177,7 @@ void sub_08023330(Entity* this) { this->field_0x7a.HALF.HI = 0; this->field_0x7c.BYTES.byte3 = 0; sub_08023A88(this, this->animationState); - CopyPosition(this, this->attachedEntity); + CopyPosition(this, this->child); CreateFx(this, FX_ROCK, 0); } } @@ -198,7 +198,7 @@ void sub_08023398(Entity* this) { this->field_0x7c.BYTES.byte3 = 0; COLLISION_OFF(this); this->hitType = 0x85; - this->attachedEntity->actionDelay = 1; + this->child->actionDelay = 1; sub_08023A68(this); CreateFx(this, FX_ROCK, 0); return; @@ -239,7 +239,7 @@ void sub_080234A4(Entity* this) { GetNextFrame(this); if (this->field_0x7c.BYTES.byte3) { this->action = 6; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->field_0x78.HWORD = 300; } } @@ -257,9 +257,9 @@ void sub_080234D8(Entity* this) { void sub_0802351C(Entity* this) { if (this->actionDelay != 0 && (this->type2 == 1 || gPlayerEntity.frameIndex == 0xff)) { this->actionDelay = 0; - this->attachedEntity->action = 3; - this->attachedEntity->field_0xf = this->field_0x80.HALF.LO; - InitializeAnimation(this->attachedEntity, this->attachedEntity->animationState + 1); + this->child->action = 3; + this->child->field_0xf = this->field_0x80.HALF.LO; + InitializeAnimation(this->child, this->child->animationState + 1); InitializeAnimation(this, this->animationState); } @@ -300,7 +300,7 @@ void sub_08023604(Entity* this) { this->action = 2; this->actionDelay = 0; COLLISION_ON(this); - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_08023644(this); } } @@ -312,8 +312,8 @@ void sub_08023644(Entity* this) { this->y.HALF.HI == parent->y.HALF.HI) { this->action = 1; COLLISION_OFF(this); - this->spriteSettings.b.draw = 0; - this->attachedEntity->actionDelay = 1; + this->spriteSettings.draw = 0; + this->child->actionDelay = 1; sub_080239F0(this); } @@ -330,9 +330,9 @@ void sub_08023644(Entity* this) { void sub_080236F8(Entity* parent) { if (--parent->field_0xf == 0) { parent->action = 2; - parent->attachedEntity->action = 3; - parent->attachedEntity->field_0xf = parent->parent->field_0x80.HALF.LO; - InitializeAnimation(parent->attachedEntity, parent->attachedEntity->animationState + 1); + parent->child->action = 3; + parent->child->field_0xf = parent->parent->field_0x80.HALF.LO; + InitializeAnimation(parent->child, parent->child->animationState + 1); InitializeAnimation(parent, parent->animationState); } } @@ -356,8 +356,8 @@ void sub_08023748(Entity* this) { void sub_0802376C(Entity* this) { Entity* parent = this->parent; - if (parent->spriteSettings.b.draw == 1 && parent->animIndex < 0x10) { - this->spriteSettings.b.draw = 1; + if (parent->spriteSettings.draw == 1 && parent->animIndex < 0x10) { + this->spriteSettings.draw = 1; GetNextFrame(this); } @@ -378,7 +378,7 @@ void sub_080237D8(Entity* this) { this->y.HALF.HI == parent->y.HALF.HI) { this->action = 1; COLLISION_OFF(this); - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; parent->field_0x7c.BYTES.byte3 = 1; sub_080239F0(this); sub_08023A68(this); @@ -415,33 +415,33 @@ void sub_08023894(Entity* this) { void sub_0802390C(Entity* this) { if (this->bitfield & 0x80) { - Entity* ent = this->attachedEntity; + Entity* ent = this->child; do { ent->iframes = this->iframes; - } while (ent = ent->attachedEntity, ent != NULL); + } while (ent = ent->child, ent != NULL); } else { - Entity* ent = this->attachedEntity; + Entity* ent = this->child; do { if (ent->bitfield & 0x80) { - u8 bVar2 = 0xff - ent->currentHealth; + u8 bVar2 = 0xff - ent->health; if (bVar2 != 0) { u32 tmp; - ent->currentHealth = 0xff; + ent->health = 0xff; tmp = (u8)ent->iframes; - if (this->currentHealth >= bVar2) { - this->currentHealth -= bVar2; + if (this->health >= bVar2) { + this->health -= bVar2; } else { - this->currentHealth = 0; + this->health = 0; } ent = this; do { ent->iframes = tmp; - } while (ent = ent->attachedEntity, ent != NULL); + } while (ent = ent->child, ent != NULL); break; } } - } while (ent = ent->attachedEntity, ent != NULL); + } while (ent = ent->child, ent != NULL); } } @@ -449,7 +449,7 @@ void sub_08023990(Entity* this, u32 param_2, u32 param_3) { Entity* ent; this->action = 3; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->palette.b.b0 = 0x5; this->palette.b.b4 = 0x5; this->spritePriority.b0 = 7; @@ -459,11 +459,11 @@ void sub_08023990(Entity* this, u32 param_2, u32 param_3) { UpdateSpriteForCollisionLayer(this); InitializeAnimation(this, 0x16); - ent = this->attachedEntity; + ent = this->child; do { sub_080239F0(ent); CopyPosition(this, ent); - } while (ent = ent->attachedEntity, ent != NULL); + } while (ent = ent->child, ent != NULL); } /* TODO: fix struct */ diff --git a/src/enemy/octorok.c b/src/enemy/octorok.c index 53794388..9ca40e32 100644 --- a/src/enemy/octorok.c +++ b/src/enemy/octorok.c @@ -84,7 +84,7 @@ void sub_0801EB9C(Entity* this) { COLLISION_ON(this); this->field_0x3a &= 0xfb; } else { - this->currentHealth = 0; + this->health = 0; } } @@ -125,7 +125,7 @@ void Octorok_Move(Entity* this) { void Octorok_ShootNut(Entity* this) { GetNextFrame(this); - if (this->frames.all & 1) { + if (this->frame & 1) { Entity* ent = CreateProjectileWithParent(this, 1, 0); if (ent) { const s8* off; @@ -133,13 +133,13 @@ void Octorok_ShootNut(Entity* this) { off = &gOctorokNutOffset[this->direction / 4]; ent->x.HALF.HI += off[0]; ent->y.HALF.HI += off[1]; - ent->height.HALF.HI = -3; - this->frames.all &= 0xfe; + ent->z.HALF.HI = -3; + this->frame &= 0xfe; EnqueueSFX(0x18d); } } - if (this->frames.all & 0x80) + if (this->frame & 0x80) Octorok_Pause(this); } diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c index 6ac631b5..de45a52a 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -45,7 +45,7 @@ void Peahat(Entity* this) { void Peahat_OnTick(Entity* this) { gPeahatActions[this->action](this); if (this->field_0x80.HALF.HI) - this->height.HALF.HI = gPeahatFlightHeights[(this->field_0xf++ & 0x30) >> 4]; + this->z.HALF.HI = gPeahatFlightHeights[(this->field_0xf++ & 0x30) >> 4]; } void sub_0801FFDC(Entity* this) { @@ -54,7 +54,7 @@ void sub_0801FFDC(Entity* this) { Entity* ent = CreateEnemy(PEAHAT, PeahatForm_Propeller); if (ent) { CopyPosition(this, ent); - ent->height.HALF.HI -= 8; + ent->z.HALF.HI -= 8; } this->field_0x82.HALF.LO = 0; this->animationState = PeahatAnimation_SlicedPropeller; @@ -127,7 +127,7 @@ void sub_08020104(Entity* this) { COLLISION_ON(this); this->field_0x3a &= 0xfb; } else { - this->currentHealth = 0; + this->health = 0; } } @@ -241,7 +241,7 @@ void Peahat_Stunned(Entity* this) { break; case PeahatAnimation_SlicedPropeller: sub_08003FC4(this, 0x1c00); - if (this->height.HALF.HI == 0) { + if (this->z.HALF.HI == 0) { this->action = 7; this->actionDelay = 150; this->field_0xf = 10; @@ -260,7 +260,7 @@ void Peahat_RepairPropeller(Entity* this) { return; this->action = 9; - this->hVelocity = 0x18000; + this->zVelocity = 0x18000; this->direction = Random() & 0x1f; sub_0804AA1C(this); this->animationState = PeahatAnimation_RepairPropeller; @@ -284,9 +284,9 @@ void Peahat_Recover(Entity* this) { void Peahat_Hop(Entity* this) { GetNextFrame(this); if (--this->actionDelay == 0) { - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 9; - this->hVelocity = 0x18000; + this->zVelocity = 0x18000; this->animationState = PeahatAnimation_NewPropeller; InitializeAnimation(this, this->animationState); } else { @@ -294,12 +294,12 @@ void Peahat_Hop(Entity* this) { } } - if (this->frames.all & 2) { - this->frames.all &= ~2; + if (this->frame & 2) { + this->frame &= ~2; this->direction = Random() & 0x1f; } - if (this->frames.all & 1) { + if (this->frame & 1) { sub_0800442E(this); } else { ProcessMovement(this); @@ -308,14 +308,14 @@ void Peahat_Hop(Entity* this) { void Peahat_Takeoff(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 1; this->hitType = 0x70; this->field_0x82.HALF.LO = 1; this->field_0x80.HALF.HI = 1; this->animationState = PeahatAnimation_Flying; InitializeAnimation(this, this->animationState); - } else if (this->frames.all & 1) { + } else if (this->frame & 1) { sub_0800442E(this); } else { sub_08003FC4(this, 0x1c00); @@ -327,10 +327,10 @@ void PeahatPropeller_Initialize(Entity* this) { this->action = 1; this->actionDelay = 240; this->field_0xf = 40; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spriteRendering.b3 = 1; this->spriteOrientation.flipY = 1; - this->spriteSettings.b.shadow = 0; + this->spriteSettings.shadow = 0; this->speed = 0x20; this->direction = (Random() & 0x10) + 8; InitializeAnimation(this, PeahatAnimation_Propeller); @@ -342,9 +342,9 @@ void PeahatPropeller_Fly(Entity* this) { DeleteEntity(this); } else { if (this->actionDelay < 60) - this->spriteSettings.b.draw ^= 1; + this->spriteSettings.draw ^= 1; - this->height.WORD -= 0xc000; + this->z.WORD -= 0xc000; sub_0806F69C(this); if (--this->field_0xf == 0) { this->field_0xf = 40; diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index 6ee4a4da..3f0e0c51 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -56,7 +56,7 @@ void sub_08023F5C(Entity* this) { if ((this->field_0x82.HALF.HI & 0xf) == 3 && this->action == 6) { switch (this->field_0x80.HALF.LO) { case 1: - this->height.HALF.HI = -0x10; + this->z.HALF.HI = -0x10; this->field_0x82.HALF.LO = 0; this->field_0x78.HWORD = -0x10; this->field_0x80.HALF.LO += 1; @@ -68,7 +68,7 @@ void sub_08023F5C(Entity* this) { } } } else { - this->currentHealth = 0; + this->health = 0; } sub_0804AA30(this, gUnk_080CBEC4); @@ -122,7 +122,7 @@ void nullsub_138(Entity* this) { } void sub_0802409C(Entity* this) { - this->currentHealth = 0; + this->health = 0; InitializeAnimation(this, this->animationState); CreateDust(this); } @@ -142,11 +142,11 @@ void sub_080240B8(Entity* this) { switch (this->type) { case 0: this->field_0x78.HWORD = -0x10; - this->height.HALF.HI = -0x10; + this->z.HALF.HI = -0x10; break; case 1: this->field_0x78.HWORD = -0x30; - this->height.HALF.HI = -0x30; + this->z.HALF.HI = -0x30; break; } @@ -172,7 +172,7 @@ void sub_080240B8(Entity* this) { this->field_0x82.HALF.HI = 0; ent = CreateProjectileWithParent(this, 6, this->field_0x82.HALF.HI); if (ent) { - this->attachedEntity = ent; + this->child = ent; ent->parent = this; ent->y.HALF.HI += 0x10; } @@ -274,7 +274,7 @@ void sub_080243B8(Entity* this) { switch (this->field_0x80.HALF.LO) { case 0: if (sub_08024C48(this, TRUE)) { - if (this->attachedEntity == NULL || this->attachedEntity->next == NULL) { + if (this->child == NULL || this->child->next == NULL) { this->field_0x80.HALF.LO = 2; this->actionDelay = 0x20; this->speed = 0x80; @@ -284,7 +284,7 @@ void sub_080243B8(Entity* this) { this->actionDelay = 0x1e; this->speed = 0x100; this->field_0x82.HALF.HI = 0x80; - this->attachedEntity->action = 2; + this->child->action = 2; } else if (--this->actionDelay) { if (--this->field_0xf == 0) { sub_08024A14(this, 2, (this->actionDelay >> 6) + 1); @@ -354,7 +354,7 @@ void sub_080244E8(Entity* this) { } break; case 1: - if (++this->height.HALF.HI >= -0x10) { + if (++this->z.HALF.HI >= -0x10) { this->field_0x82.HALF.LO = 0; this->field_0x78.HWORD = 0xfff0; if (sub_08024AD8(this)) { @@ -375,7 +375,7 @@ void sub_080244E8(Entity* this) { } else { sub_08024E1C(this); } - this->direction = GetFacingDirection(this, this->attachedEntity); + this->direction = GetFacingDirection(this, this->child); sub_08024E00(this, 0); sub_080249DC(this); } else if (--this->field_0xf == 0) { @@ -403,44 +403,44 @@ void sub_080244E8(Entity* this) { } break; case 1: - if (sub_080041A0(this, this->attachedEntity, 6, 6)) { + if (sub_080041A0(this, this->child, 6, 6)) { Entity* ent; this->field_0x80.HALF.LO += 1; this->actionDelay = 0xc; this->field_0x82.HALF.HI &= ~0x80; - CopyPosition(this->attachedEntity, this); - this->height.HALF.HI -= 0xe; + CopyPosition(this->child, this); + this->z.HALF.HI -= 0xe; this->field_0x78.HWORD -= 0xe; ent = CreateProjectileWithParent(this, 6, this->field_0x82.HALF.HI); if (ent) { ent->parent = this; - ent->height.HALF.HI += 0xe; - ent->attachedEntity = this->attachedEntity; - CopyPosition(ent, ent->attachedEntity); - this->attachedEntity = ent; + ent->z.HALF.HI += 0xe; + ent->child = this->child; + CopyPosition(ent, ent->child); + this->child = ent; } } break; case 2: - if (sub_080041A0(this, this->attachedEntity, 6, 6)) { + if (sub_080041A0(this, this->child, 6, 6)) { Entity* ent; this->field_0x80.HALF.LO += 1; this->actionDelay = 0xc; this->field_0x82.HALF.HI &= ~0x80; - ent = this->attachedEntity; + ent = this->child; SetTile((u16)ent->field_0x70.HALF.LO, COORD_TO_TILE(ent), ent->collisionLayer); DeleteEntity(ent); - this->height.HALF.HI -= 0xe; + this->z.HALF.HI -= 0xe; this->field_0x78.HWORD -= 0xe; ent = CreateProjectileWithParent(this, 6, this->field_0x82.HALF.HI); if (ent) { ent->parent = this; - ent->height.HALF.HI += 0xe; - this->attachedEntity = ent; + ent->z.HALF.HI += 0xe; + this->child = ent; } } break; @@ -460,14 +460,14 @@ void sub_080244E8(Entity* this) { } break; case 4: - this->height.HALF.HI -= 2; - if (-60 > this->height.HALF.HI) { + this->z.HALF.HI -= 2; + if (-60 > this->z.HALF.HI) { this->field_0x80.HALF.LO++; } break; case 5: - if (this->height.HALF.HI < -0x30) { - this->height.HALF.HI++; + if (this->z.HALF.HI < -0x30) { + this->z.HALF.HI++; } else { if (this->field_0x82.HALF.LO != 0) { this->field_0x82.HALF.LO = 0; @@ -511,7 +511,7 @@ void sub_080244E8(Entity* this) { } break; case 7: - if (gPlayerEntity.height.HALF.HI == 0) { + if (gPlayerEntity.z.HALF.HI == 0) { this->field_0x80.HALF.LO = 0; this->speed = 0x80; sub_08024B38(this); @@ -532,9 +532,9 @@ void sub_08024940(Entity* this) { } if (this->field_0x82.HALF.LO == 0) { - this->height.HALF.HI = this->field_0x78.HWORD; + this->z.HALF.HI = this->field_0x78.HWORD; if (random) - this->height.HALF.HI += 2; + this->z.HALF.HI += 2; } if (this->type2 != 0 || CheckIsDungeon()) { @@ -543,7 +543,7 @@ void sub_08024940(Entity* this) { sub_080249F4(this); } - if (this->height.HALF.HI < -0x20) { + if (this->z.HALF.HI < -0x20) { this->spritePriority.b0 = 0; } else { this->spritePriority.b0 = 1; @@ -579,7 +579,7 @@ void sub_08024A14(Entity* this, u32 param_2, u32 param_3) { break; case 1: if (sub_08024C48(this, FALSE)) { - sub_08004596(this, GetFacingDirection(this, this->attachedEntity)); + sub_08004596(this, GetFacingDirection(this, this->child)); unk = TRUE; } break; @@ -614,8 +614,8 @@ bool32 sub_08024AD8(Entity* this) { u8 unk = FALSE; if ((this->field_0x82.HALF.HI & 0x3f) == 3) { if (gPlayerState.hurtBlinkSpeed == 0) { - this->attachedEntity->parent = NULL; - this->attachedEntity = NULL; + this->child->parent = NULL; + this->child = NULL; this->field_0x82.HALF.HI = 0xc0; return FALSE; } @@ -623,7 +623,7 @@ bool32 sub_08024AD8(Entity* this) { } if (sub_08024C48(this, unk) == 0) { - this->attachedEntity = NULL; + this->child = NULL; this->field_0x82.HALF.HI = 0xc0; return FALSE; } @@ -649,13 +649,13 @@ bool32 sub_08024B38(Entity* this) { if (gPlayerState.hurtBlinkSpeed != 0) { if (sub_08024C48(this, 1) && sub_08049F1C(this, gUnk_020000B0, 0xa0)) { iVar4 = 1; - this->attachedEntity = gUnk_020000B0; + this->child = gUnk_020000B0; this->field_0x82.HALF.HI |= 3; this->field_0x82.HALF.HI &= ~0x40; } if (iVar4 == 0) { - this->attachedEntity = NULL; + this->child = NULL; } return iVar4; } @@ -664,9 +664,9 @@ bool32 sub_08024B38(Entity* this) { ent = FindEntityByID(8, 2, 2); if (ent) { do { - if (ent->action != 2 && ent->height.HALF.HI == 0 && sub_08049F1C(this, ent, 0xa0)) { + if (ent->action != 2 && ent->z.HALF.HI == 0 && sub_08049F1C(this, ent, 0xa0)) { iVar4 = 1; - this->attachedEntity = ent; + this->child = ent; this->field_0x82.HALF.HI |= 1; this->field_0x82.HALF.HI &= ~0x40; break; @@ -683,7 +683,7 @@ bool32 sub_08024B38(Entity* this) { do { if (ent->action == 1 && sub_08049F1C(this, ent, 0xa0)) { iVar4 = 1; - this->attachedEntity = ent; + this->child = ent; this->field_0x82.HALF.HI |= 2; this->field_0x82.HALF.HI &= ~0x40; break; @@ -692,7 +692,7 @@ bool32 sub_08024B38(Entity* this) { } if (iVar4 == 0) { - this->attachedEntity = NULL; + this->child = NULL; } return iVar4; @@ -840,7 +840,7 @@ void sub_08024F50(Entity* this) { gPlayerEntity.direction = gPlayerEntity.animationState << 2; gPlayerEntity.speed = 0; gPlayerEntity.spritePriority.b1 = this->cutsceneBeh.HALF.HI; - gPlayerEntity.height.HALF.HI = gPlayerEntity.spriteOffsetY; + gPlayerEntity.z.HALF.HI = gPlayerEntity.spriteOffsetY; gPlayerEntity.spriteOffsetY = 0; this->flags2 |= 3; this->field_0x82.HALF.HI = 0xc0; diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c index 4688d174..1d326ef1 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -72,8 +72,8 @@ void sub_08025020(Entity* this) { } this->action = 7; this->actionDelay = 0x3c; - if (0 < this->hVelocity) { - this->hVelocity = 0; + if (0 < this->zVelocity) { + this->zVelocity = 0; } this->iframes = -0xc; this->knockbackDuration = 0; @@ -200,7 +200,7 @@ void sub_080252E0(Entity* this) { this->action = 3; this->actionDelay = 0x1e; this->field_0xf = 0; - this->hVelocity = 0x18000; + this->zVelocity = 0x18000; InitializeAnimation(this, 1); } } @@ -209,11 +209,11 @@ void sub_0802538C(Entity* this) { if (this->actionDelay) { this->actionDelay--; } else { - if (this->frames.all == 0) { + if (this->frame == 0) { GetNextFrame(this); } else { sub_08003FC4(this, 0x2000); - if (this->hVelocity < 0x2000) { + if (this->zVelocity < 0x2000) { this->action = 4; InitializeAnimation(this, 2); } @@ -239,16 +239,16 @@ void sub_080253D4(Entity* this) { void sub_0802541C(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 3; this->field_0xf = 1; - this->hVelocity = 0x20000; + this->zVelocity = 0x20000; InitializeAnimation(this, 1); } } void sub_0802544C(Entity* this) { - if (this->frames.all == 0) { + if (this->frame == 0) { GetNextFrame(this); } else { if (--this->actionDelay == 0) { @@ -272,8 +272,8 @@ void sub_0802547C(Entity* this) { void sub_080254B4(Entity* this) { sub_08003FC4(this, 0x2000); - if (this->frames.all & 0x80) { - if (this->height.HALF.HI == 0) { + if (this->frame & 0x80) { + if (this->z.HALF.HI == 0) { if (this->cutsceneBeh.HWORD == 0) { this->hitType = 0x82; this->field_0x82.HALF.LO = -0x10; @@ -552,18 +552,18 @@ void sub_08025B18(Entity* this) { ent->x.HALF.HI += 8; ent->y.HALF.HI &= -0x10; ent->y.HALF.HI += 8; - ent->height.HALF.HI = -1; + ent->z.HALF.HI = -1; } } } void sub_08025BD4(Entity* this) { - if (this->field_0x82.HALF.LO && (this->frames.all & 1) == 0) { + if (this->field_0x82.HALF.LO && (this->frame & 1) == 0) { Entity* ent = CreateObject(OBJECT_21, 0, 0); if (ent) { PositionRelative(this, ent, gUnk_080CC0BA[this->animationState * 2 + 0] * 0x10000, gUnk_080CC0BA[this->animationState * 2 + 1] * 0x10000); - ent->height.HALF.HI = -10; + ent->z.HALF.HI = -10; } } } @@ -575,7 +575,7 @@ void sub_08025C2C(Entity* this) { } bool32 sub_08025C44(Entity* this) { - if ((this->frames.all & 1) == 0) { + if ((this->frame & 1) == 0) { return ProcessMovement(this); } else { return FALSE; diff --git a/src/enemy/rockChuchu.c b/src/enemy/rockChuchu.c index 3248714f..95e0a9c1 100644 --- a/src/enemy/rockChuchu.c +++ b/src/enemy/rockChuchu.c @@ -20,7 +20,7 @@ void sub_0802223C(Entity* this) { void sub_08022254(Entity* this) { Entity* ent; - if (this->currentHealth) { + if (this->health) { switch (this->bitfield & 0x7f) { case 4: case 5: @@ -51,9 +51,9 @@ void sub_08022254(Entity* this) { sub_0804A4E4(this, ent); this->action = 2; COLLISION_OFF(this); - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->direction = this->knockbackDirection; - this->attachedEntity = ent; + this->child = ent; } } } else { @@ -97,7 +97,7 @@ void sub_08022390(Entity* this) { void sub_080223E4(Entity* this) { Entity* ent; - ent = this->attachedEntity; + ent = this->child; if (ent) { ent->bitfield = 0x94; ent->iframes = 0x10; diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c index 3316e6e5..9815510f 100644 --- a/src/enemy/rollobite.c +++ b/src/enemy/rollobite.c @@ -30,11 +30,11 @@ void Rollobite_OnTick(Entity* this) { } void sub_08020668(Entity* this) { - if (this->hitType == 34 && this->currentHealth != 0xff) { + if (this->hitType == 34 && this->health != 0xff) { this->action = 4; - this->hVelocity = 0x20000; + this->zVelocity = 0x20000; this->direction = 0xff; - this->currentHealth = 0xff; + this->health = 0xff; this->hitType = 35; InitializeAnimation(this, this->animationState + 8); } @@ -102,7 +102,7 @@ void sub_080207A8(Entity* this) { this->spritePriority.b0 = 4; this->field_0x3a &= 0xfb; this->direction ^= 0x10; - this->hVelocity = 0x18000; + this->zVelocity = 0x18000; this->speed = 0x80; InitializeAnimation(this, this->animationState + 0x10); } @@ -118,14 +118,14 @@ void Rollobite_Initialize(Entity* this) { void Rollobite_Walk(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x1) { - this->frames.all &= ~0x1; + if (this->frame & 0x1) { + this->frame &= ~0x1; if (!ProcessMovement(this)) this->actionDelay = 1; } - if (this->frames.all & 0x10) { - this->frames.all &= ~0x10; + if (this->frame & 0x10) { + this->frame &= ~0x10; if (--this->actionDelay == 0) { this->action = 3; this->actionDelay = 60; @@ -172,7 +172,7 @@ void Rollobite_Turn(Entity* this) { void Rollobite_RolledUp(Entity* this) { u32 unk; - if ((this->frames.all & 0x80) == 0) + if ((this->frame & 0x80) == 0) GetNextFrame(this); unk = sub_080044EC(this, 0x2800); @@ -194,7 +194,7 @@ void Rollobite_RolledUp(Entity* this) { void Rollobite_Unroll(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { COLLISION_ON(this); this->speed = 0x100; this->hitType = 34; @@ -202,7 +202,7 @@ void Rollobite_Unroll(Entity* this) { this->direction = DirectionFromAnimationState(this->animationState); InitializeAnimation(this, this->animationState); } else { - if ((this->frames.all & 1) == 0) + if ((this->frame & 1) == 0) sub_08078930(this); } } @@ -213,7 +213,7 @@ void Rollobite_LinedUp(Entity* this) { this->spritePriority.b0 = 7; } - if (this->frames.all == 0) + if (this->frame == 0) GetNextFrame(this); } @@ -252,7 +252,7 @@ void sub_08020A7C(Entity* this) { } bool32 Rollobite_TryToHoleUp(Entity* this) { - if (Rollobite_IsRolledUp(this) && this->height.HALF.HI == 0) { + if (Rollobite_IsRolledUp(this) && this->z.HALF.HI == 0) { int tile = COORD_TO_TILE(this); int iVar1 = GetTileType(tile, this->collisionLayer); if ((iVar1 * 0x10000 - 0x710000U) >> 0x10 < 2) { @@ -262,7 +262,7 @@ bool32 Rollobite_TryToHoleUp(Entity* this) { this->x.HALF.HI += 8; this->y.HALF.HI &= 0xfff0; this->y.HALF.HI += 13; - this->hVelocity = 0x20000; + this->zVelocity = 0x20000; InitializeAnimation(this, this->animationState + 0x14); SetTile(0x4034, tile, this->collisionLayer); return TRUE; diff --git a/src/enemy/rope.c b/src/enemy/rope.c index 1b196527..2c61fb03 100644 --- a/src/enemy/rope.c +++ b/src/enemy/rope.c @@ -67,8 +67,8 @@ void sub_08031434(Entity* this) { } else { this->action = 1; this->subAction = 0; - this->spriteSettings.b.draw = (this->spriteSettings.b.draw & 0xfc); - this->height.HALF.HI = -0x80; + this->spriteSettings.draw = (this->spriteSettings.draw & 0xfc); + this->z.HALF.HI = -0x80; this->frameIndex = 0xff; } } @@ -81,7 +81,7 @@ void sub_08031480(Entity* this) { sub_08031600(this); this->action = 1; this->subAction = 1; - this->spriteSettings.b.draw = 3; + this->spriteSettings.draw = 3; this->spriteRendering.b3 = 1; this->spriteOrientation.flipY = 1; SoundReq(SFX_12D); @@ -90,7 +90,7 @@ void sub_08031480(Entity* this) { if (sub_08003FC4(this, 0x1800) == 0) { this->action = 2; this->field_0xf = 0xf; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; UpdateSpriteForCollisionLayer(this); EnqueueSFX(0x84); } diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index 04c87bba..05334d65 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -56,7 +56,7 @@ void sub_08029318(Entity* this) { if (*(u8*)(*(u32*)&this->field_0x4c + 8) == 1) { if (this->action == 2) { InitializeAnimation(this, 0); - InitializeAnimation(this->attachedEntity, 4); + InitializeAnimation(this->child, 4); } this->action = 4; this->actionDelay = 0x3c; @@ -84,7 +84,7 @@ void nullsub_141() { void sub_080293DC(Entity* this) { CopyPositionAndSpriteOffset(this->parent, this); this->y.HALF.HI++; - this->height.HALF.HI--; + this->z.HALF.HI--; gUnk_080CCC3C[this->action](this); } @@ -96,7 +96,7 @@ void sub_0802940C(Entity* this) { sub_0804A720(this); ent->parent = this; ent->type2 = 1; - this->attachedEntity = ent; + this->child = ent; this->field_0x80.HALF.HI = 0; this->cutsceneBeh.HALF.LO = 0; this->field_0x82.HALF.LO = this->palette.b.b0; @@ -115,17 +115,17 @@ void sub_08029474(Entity* this) { u32 bVar1; sub_080296C8(this); - if (this->frames.b.f3) { + if (this->frame & 0x80) { this->action = 3; this->actionDelay = 8; bVar1 = GetFacingDirection(this, &gPlayerEntity); this->direction = bVar1; this->animationState = (bVar1 << 0x18) >> 0x1c; InitializeAnimation(this, this->animationState); - InitializeAnimation(this->attachedEntity, this->animationState + 4); + InitializeAnimation(this->child, this->animationState + 4); } else { - if (this->frames.all == 1) { - this->frames.all = 0; + if (this->frame == 1) { + this->frame = 0; COLLISION_ON(this); } } @@ -144,7 +144,7 @@ void sub_080294D4(Entity* this) { this->action = 6; COLLISION_OFF(this); InitializeAnimation(this, 3); - InitializeAnimation(this->attachedEntity, 7); + InitializeAnimation(this->child, 7); } } @@ -189,9 +189,9 @@ void sub_08029610(Entity* this) { void sub_08029630(Entity* this) { sub_080296C8(this); - if ((this->frames.b.f3) != 0) { + if (this->frame & 0x80) { this->field_0x80.HALF.HI = 1; - this->attachedEntity->spriteSettings.b.draw = FALSE; + this->child->spriteSettings.draw = FALSE; sub_080297F0(this); } } @@ -219,23 +219,23 @@ void sub_0802969C(Entity* this) { if (bVar1 != this->animationState) { this->animationState = bVar1; InitializeAnimation(this, bVar1); - InitializeAnimation(this->attachedEntity, bVar1 + 4); + InitializeAnimation(this->child, bVar1 + 4); } } } void sub_080296C8(Entity* this) { GetNextFrame(this); - GetNextFrame(this->attachedEntity); + GetNextFrame(this->child); } void sub_080296D8(Entity* this) { gPlayerState.jumpStatus = 0x41; gPlayerState.flags &= 0xffffffef; gPlayerEntity.flags |= 0x80; - gPlayerEntity.hVelocity = 0x18000; + gPlayerEntity.zVelocity = 0x18000; gPlayerEntity.iframes = 0xa6; - gPlayerEntity.height.HALF.HI = -2; + gPlayerEntity.z.HALF.HI = -2; gPlayerEntity.direction = gPlayerEntity.animationState << 2; gPlayerEntity.spritePriority.b1 = this->field_0x80.HALF.LO; gPlayerEntity.spriteOffsetY = 0; @@ -260,8 +260,8 @@ void sub_08029770(Entity* this) { this->hitType = 0x8d; this->hitbox = &gUnk_080FD260; InitializeAnimation(this, 2); - this->attachedEntity->spriteSettings.b.draw = TRUE; - InitializeAnimation(this->attachedEntity, 6); + this->child->spriteSettings.draw = TRUE; + InitializeAnimation(this->child, 6); CreateDust(this); } } @@ -271,7 +271,7 @@ void sub_080297F0(Entity* this) { this->action = 1; this->actionDelay = 0x78; COLLISION_ON(this); - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; this->hitType = 0x8e; sub_080AE068(this); #ifdef EU diff --git a/src/enemy/slime.c b/src/enemy/slime.c index 34f9cb55..92de7a7f 100644 --- a/src/enemy/slime.c +++ b/src/enemy/slime.c @@ -33,7 +33,7 @@ void sub_08044F70(Entity* this) { } void sub_08044F88(Entity* this) { - if ((this->currentHealth != 0) && (this->cutsceneBeh.HALF.LO != this->currentHealth)) { + if ((this->health != 0) && (this->cutsceneBeh.HALF.LO != this->health)) { this->action = 4; } else { sub_0804AA30(this, gUnk_080D16A4); @@ -49,7 +49,7 @@ void nullsub_171() { void sub_08044FC8(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->speed = 128; sub_0804A720(this); InitializeAnimation(this, 0); @@ -59,7 +59,7 @@ void sub_08044FC8(Entity* this) { void sub_08044FF8(Entity* this) { this->action = 2; this->actionDelay = (Random() & 31) + 30; - this->cutsceneBeh.HALF.LO = this->currentHealth; + this->cutsceneBeh.HALF.LO = this->health; } void sub_08045018(Entity* this) { @@ -105,10 +105,10 @@ void sub_080450A8(Entity* this) { off = gUnk_080D16D4; for (i = 0; i < count; i++) { ent = entities[i]; - ent->attachedEntity = entities[(i + 1) % count]; + ent->child = entities[(i + 1) % count]; ent->parent = entities[(i + count - 1) % count]; ent->type2 = 1; - ent->height.HALF.HI = 0; + ent->z.HALF.HI = 0; ent->iframes = -0x10; /* Set MiniSlime offset relative to killed slime. */ diff --git a/src/enemy/sluggula.c b/src/enemy/sluggula.c index 21a9b985..d6361507 100644 --- a/src/enemy/sluggula.c +++ b/src/enemy/sluggula.c @@ -27,7 +27,7 @@ void Sluggula(Entity* this) { SetChildOffset(this, 0, 1, -0x10); } else if (this->type == 0) { - if (this->height.HALF.HI == 0) { + if (this->z.HALF.HI == 0) { u32 idx = sub_080012DC(this); if (idx != 0) { gUnk_080012C8[idx](this); @@ -75,7 +75,7 @@ void sub_08023C8C(Entity* this) { GetNextFrame(this); sub_08023E54(this); if (--this->actionDelay == 0) { - if (this->frames.all != 1) { + if (this->frame != 1) { this->actionDelay = 8; } else { this->actionDelay = (Random() & 0x30) + 0xb4; @@ -95,11 +95,11 @@ void sub_08023CE0(Entity* this) { if (this->actionDelay == 0) { this->actionDelay = 1; } - this->spriteSettings.b.draw = 3; + this->spriteSettings.draw = 3; } else { this->action = 1; } - this->height.HALF.HI = -0x80; + this->z.HALF.HI = -0x80; this->spriteRendering.b3 = 1; this->spriteOrientation.flipY = 1; InitializeAnimation(this, 6); @@ -110,7 +110,7 @@ void sub_08023CE0(Entity* this) { if (this->actionDelay == 0) { this->actionDelay = 8; } - this->spriteSettings.b.draw = 3; + this->spriteSettings.draw = 3; } break; case 2: @@ -121,23 +121,23 @@ void sub_08023CE0(Entity* this) { } } else if (!sub_08003FC4(this, 0x1800)) { this->action = 3; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; EnqueueSFX(0x84); UpdateSpriteForCollisionLayer(this); } break; default: GetNextFrame(this); - if (this->frames.all) { - if (this->frames.all & 0x80) { + if (this->frame) { + if (this->frame & 0x80) { Entity* ent = CreateEnemy(SLUGGULA, 1); if (ent) { sub_0804A4E4(this, ent); DeleteThisEntity(); } } else { - this->y.HALF.HI += gUnk_080CBDF4[this->frames.all - 1]; - this->frames.all = 0; + this->y.HALF.HI += gUnk_080CBDF4[this->frame - 1]; + this->frame = 0; } } break; @@ -152,7 +152,7 @@ void sub_08023E10(Entity* this) { } GetNextFrame(this); - if (this->frames.all & 0x80) + if (this->frame & 0x80) DeleteEntity(this); } diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c index 660a3110..3be1f047 100644 --- a/src/enemy/smallPesto.c +++ b/src/enemy/smallPesto.c @@ -87,17 +87,17 @@ void sub_08031770(Entity* this) { if (--this->field_0x80.HWORD == 0) { sub_08031840(this); } - } else if (this->attachedEntity == NULL) { + } else if (this->child == NULL) { this->field_0x80.HWORD = (Random() & 0x7f) | (0x80 << 2); } else { - if (this->attachedEntity->next == NULL) { - this->attachedEntity = NULL; + if (this->child->next == NULL) { + this->child = NULL; } } } void sub_080317B4(Entity* this) { - this->height.HALF.HI = ((Random() & 0x30) != 0) ? -0xc : -0xd; + this->z.HALF.HI = ((Random() & 0x30) != 0) ? -0xc : -0xd; sub_0806F69C(this); GetNextFrame(this); } @@ -110,7 +110,7 @@ void sub_080317E0(Entity* this) { void sub_080317F8(Entity* this) { u8 newDirection = Random() & 0x18; this->action = 1; - this->height.HALF.HI = 0x0000FFF4; + this->z.HALF.HI = 0x0000FFF4; this->collisionLayer = 1; this->field_0x3c |= 0x10; this->field_0x1c = 1; @@ -126,7 +126,7 @@ void sub_08031840(Entity* this) { if (enemy != NULL) { CopyPosition(this, enemy); enemy->parent = this; - this->attachedEntity = enemy; + this->child = enemy; enemy->type2 = 1; } } diff --git a/src/enemy/spark.c b/src/enemy/spark.c index 811bea88..cbbdb587 100644 --- a/src/enemy/spark.c +++ b/src/enemy/spark.c @@ -22,11 +22,11 @@ void sub_0802B2E0(Entity* this) { if ((this->bitfield & 0x7f) == 0x14) { COLLISION_OFF(this); this->iframes = 0; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->action = 2; ent = CreateFx(this, FX_DEATH, 0); if (ent) { - this->attachedEntity = ent; + this->child = ent; this->actionDelay = 14; CopyPosition(this, ent); } diff --git a/src/enemy/spearMoblin.c b/src/enemy/spearMoblin.c index 34beba3a..fa90d4f8 100644 --- a/src/enemy/spearMoblin.c +++ b/src/enemy/spearMoblin.c @@ -31,8 +31,8 @@ extern const Hitbox* const gUnk_080CC944[]; void SpearMoblin(Entity* this) { EnemyFunctionHandler(this, gUnk_080CC790); SetChildOffset(this, 0, 1, -0x20); - if (this->attachedEntity && this->attachedEntity->next) { - CopyPosition(this, this->attachedEntity); + if (this->child && this->child->next) { + CopyPosition(this, this->child); } } @@ -57,13 +57,13 @@ void sub_08028284(Entity* this) { } } - this->attachedEntity->iframes = this->iframes; - if (this->currentHealth == 0) { + this->child->iframes = this->iframes; + if (this->health == 0) { this->speed = 0; this->field_0x82.HALF.LO = 0; sub_080287E0(this); - DeleteEntity(this->attachedEntity); - this->attachedEntity = NULL; + DeleteEntity(this->child); + this->child = NULL; } } @@ -98,7 +98,7 @@ void sub_08028314(Entity* this) { pEVar2 = CreateProjectile(3); if (pEVar2 != NULL) { pEVar2->parent = this; - this->attachedEntity = pEVar2; + this->child = pEVar2; } } @@ -378,7 +378,7 @@ bool32 sub_080288A4(Entity* this) { } void sub_080288C0(Entity* this) { - Entity* ent = this->attachedEntity; + Entity* ent = this->child; if (ent && (ent->bitfield & 0x80)) { this->knockbackDirection = ent->knockbackDirection; this->iframes = -ent->iframes; diff --git a/src/enemy/spikedBeetle.c b/src/enemy/spikedBeetle.c index 9f3aa75f..89d9e031 100644 --- a/src/enemy/spikedBeetle.c +++ b/src/enemy/spikedBeetle.c @@ -49,7 +49,7 @@ void sub_0802B628(Entity* this) { case 0x1d: if (this->action < 6) { this->action = 6; - this->hVelocity = 0x18000; + this->zVelocity = 0x18000; this->speed = 0xc0; this->direction = this->knockbackDirection; this->knockbackDuration = 0; @@ -166,7 +166,7 @@ void sub_0802B8E0(Entity* this) { } } else { this->action = 8; - this->hVelocity = 0x10000; + this->zVelocity = 0x10000; this->speed = 0x60; this->hitType = 99; InitializeAnimation(this, this->animationState); diff --git a/src/enemy/spinyChuchu.c b/src/enemy/spinyChuchu.c index 56872a16..53ad12b3 100644 --- a/src/enemy/spinyChuchu.c +++ b/src/enemy/spinyChuchu.c @@ -32,7 +32,7 @@ void sub_08022434(Entity* this) { } void sub_0802244C(Entity* this) { - if (this->currentHealth) { + if (this->health) { if (this->hitType == 0x65) { switch (this->bitfield & 0x7f) { case 2: @@ -63,7 +63,7 @@ void sub_0802244C(Entity* this) { InitializeAnimation(this, 1); } - if (this->field_0x80.HALF.LO != this->currentHealth) { + if (this->field_0x80.HALF.LO != this->health) { this->action = 5; this->hitType = 0x5c; InitializeAnimation(this, 1); @@ -78,7 +78,7 @@ void sub_0802244C(Entity* this) { InitializeAnimation(this, 1); } - this->field_0x80.HALF.LO = this->currentHealth; + this->field_0x80.HALF.LO = this->health; sub_0804AA30(this, gUnk_080CBA28); } @@ -90,7 +90,7 @@ void sub_080225A0(Entity* this) { void sub_080225BC(Entity* this) { sub_08003FC4(this, 0x1800); - if (this->frames.all & 1) { + if (this->frame & 1) { sub_0804A7D4(this); } else { GetNextFrame(this); @@ -102,7 +102,7 @@ void nullsub_9(Entity* this) { void sub_080225EC(Entity* this) { sub_0804A720(this); - this->field_0x80.HALF.LO = this->currentHealth; + this->field_0x80.HALF.LO = this->health; this->field_0x80.HALF.HI = 0x5a; if (this->actionDelay == 0) { this->action = 2; @@ -110,10 +110,10 @@ void sub_080225EC(Entity* this) { } else { this->action = 1; this->field_0xf = 0x3c; - this->spriteSettings.b.draw = 3; + this->spriteSettings.draw = 3; this->spriteRendering.b3 = 1; this->spriteOrientation.flipY = 1; - this->height.HALF.HI = -0x80; + this->z.HALF.HI = -0x80; InitializeAnimation(this, 6); } } @@ -132,7 +132,7 @@ void sub_08022654(Entity* this) { return; this->subAction = 2; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 5); EnqueueSFX(0x7d); UpdateSpriteForCollisionLayer(this); @@ -159,7 +159,7 @@ void sub_080226EC(Entity* this) { if (sub_080228F0(this)) { this->action = 6; - this->hVelocity = 0x12000; + this->zVelocity = 0x12000; this->speed = 0x140; this->direction = GetFacingDirection(this, gUnk_020000B0); this->hitType = 0x5a; @@ -179,7 +179,7 @@ void sub_080226EC(Entity* this) { void sub_08022780(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 4; InitializeAnimation(this, 3); EnqueueSFX(0x194); @@ -188,18 +188,18 @@ void sub_08022780(Entity* this) { void sub_080227AC(Entity* this) { GetNextFrame(this); - if (this->frames.all & 1) { + if (this->frame & 1) { this->hitbox = &gUnk_080FD470; } else { this->hitbox = &gUnk_080FD468; } - if (this->frames.all & 2) { - this->frames.all &= ~2; + if (this->frame & 2) { + this->frame &= ~2; this->hitType = 0x5c; } - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 2; this->field_0xf = gUnk_080CBA60[Random() & 3]; InitializeAnimation(this, 0); @@ -209,7 +209,7 @@ void sub_080227AC(Entity* this) { void sub_0802281C(Entity* this) { sub_08003FC4(this, 0x1800); GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 2; this->speed = 0x20; InitializeAnimation(this, 0); @@ -219,7 +219,7 @@ void sub_0802281C(Entity* this) { void sub_08022854(Entity* this) { GetNextFrame(this); - if (this->frames.all & 1) { + if (this->frame & 1) { sub_080AEFE0(this); if (sub_08003FC4(this, 0x1800) == 0) { this->action = 7; @@ -232,7 +232,7 @@ void sub_08022854(Entity* this) { void sub_0802289C(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->action = 2; this->speed = 0x20; this->field_0x80.HALF.HI = 0x78; diff --git a/src/enemy/tektite.c b/src/enemy/tektite.c index 0a2367bd..a4f78704 100644 --- a/src/enemy/tektite.c +++ b/src/enemy/tektite.c @@ -38,16 +38,16 @@ void sub_0802F150(Entity* this) { } this->field_0xf = 0; *(u8*)&this->field_0x7c = 0; - if (this->height.HALF.HI != 0) { - this->hVelocity >>= 2; + if (this->z.HALF.HI != 0) { + this->zVelocity >>= 2; } else { - this->hVelocity = 0; + this->zVelocity = 0; } InitializeAnimation(this, 0); break; case 0xe: case 0x15: - this->currentHealth = 0; + this->health = 0; break; } } @@ -58,7 +58,7 @@ void nullsub_16(Entity* this) { void sub_0802F1F0(Entity* this) { sub_08001242(this); - if (this->height.HALF.HI != 0) { + if (this->z.HALF.HI != 0) { sub_08003FC4(this, this->field_0x80.HWORD); } } @@ -91,15 +91,15 @@ void sub_0802F284(Entity* this) { if (this->actionDelay != 0) { this->actionDelay--; } else if (this->field_0xf != 0) { - if ((this->frames.b.f3) != 0) { + if (this->frame & 0x80) { this->action = 2; this->actionDelay = 0x10; this->field_0xf = this->type; - this->hVelocity = this->field_0x82.HWORD << 4; + this->zVelocity = this->field_0x82.HWORD << 4; sub_0802F45C(this); InitializeAnimation(this, 2); } - } else if ((this->frames.b.f3) != 0) { + } else if (this->frame & 0x80) { this->field_0xf = 0x40; InitializeAnimation(this, 1); } @@ -111,7 +111,7 @@ void sub_0802F300(Entity* this) { GetNextFrame(this); ProcessMovement(this); - temp = this->height.HALF.HI; + temp = this->z.HALF.HI; rand = Random() & 0xf; if (sub_080044EC(this, this->field_0x80.HWORD) == 1) { @@ -143,7 +143,7 @@ void sub_0802F300(Entity* this) { } } - if ((this->subAction == 0) && (temp < this->height.HALF.HI)) { + if ((this->subAction == 0) && (temp < this->z.HALF.HI)) { InitializeAnimation(this, 4); this->subAction = 1; } @@ -161,12 +161,12 @@ void sub_0802F3F4(Entity* this) { GetNextFrame(this); - if ((this->frames.b.f3) != 0) { + if (this->frame & 0x80) { if ((*(u8*)&this->field_0x7c.HALF.LO < 2) && ((this->type % 2) != 0)) { this->action = 2; this->actionDelay = 0x10; this->field_0xf = this->type; - this->hVelocity = this->field_0x82.HWORD << 4; + this->zVelocity = this->field_0x82.HWORD << 4; (*(u8*)&this->field_0x7c.HALF.LO)++; sub_0802F45C(this); InitializeAnimation(this, 2); diff --git a/src/enemy/tektiteGolden.c b/src/enemy/tektiteGolden.c index f5b7103a..12287902 100644 --- a/src/enemy/tektiteGolden.c +++ b/src/enemy/tektiteGolden.c @@ -32,10 +32,10 @@ void sub_08037F00(Entity* this) { this->actionDelay = 0x14; this->field_0xf = 0; this->field_0x80.HALF.LO = 0; - if (this->height.HALF.HI != 0) { - this->hVelocity >>= 2; + if (this->z.HALF.HI != 0) { + this->zVelocity >>= 2; } else { - this->hVelocity = 0; + this->zVelocity = 0; } InitializeAnimation(this, 0); @@ -58,7 +58,7 @@ void sub_08037F58(Entity* this) { void sub_08037F84(Entity* this) { sub_08001242(this); - if (this->height.HALF.HI != 0) { + if (this->z.HALF.HI != 0) { sub_08003FC4(this, 0x3000); } } @@ -82,15 +82,15 @@ void sub_08037Fe0(Entity* this) { if (this->actionDelay != 0) { this->actionDelay--; } else if (this->field_0xf != 0) { - if ((this->frames.b.f3) != 0) { + if (this->frame & 0x80) { this->action = 2; this->actionDelay = 6; this->field_0xf = 0; - this->hVelocity = 0x38000; + this->zVelocity = 0x38000; sub_08038168(this); InitializeAnimation(this, 2); } - } else if ((this->frames.b.f3) != 0) { + } else if (this->frame & 0x80) { this->field_0xf = 0x40; InitializeAnimation(this, 1); } @@ -102,7 +102,7 @@ void sub_08038048(Entity* this) { UpdateAnimationVariableFrames(this, 2); ProcessMovement(this); - temp = this->height.HALF.HI; + temp = this->z.HALF.HI; rand = Random() & 0xf; if (sub_080044EC(this, 0x3000) == 1) { @@ -122,7 +122,7 @@ void sub_08038048(Entity* this) { sub_08038168(this); } - if ((this->subAction == 0) && (temp < this->height.HALF.HI)) { + if ((this->subAction == 0) && (temp < this->z.HALF.HI)) { InitializeAnimation(this, 4); this->subAction = 1; } @@ -138,11 +138,11 @@ void sub_08038048(Entity* this) { void sub_08038110(Entity* this) { UpdateAnimationVariableFrames(this, 2); - if ((this->frames.b.f3) != 0) { + if (this->frame & 0x80) { if (this->field_0x80.HALF.LO < 5) { this->action = 2; this->actionDelay = 8; - this->hVelocity = 0x38000; + this->zVelocity = 0x38000; sub_08038168(this); InitializeAnimation(this, 2); } else { diff --git a/src/enemy/treeItem.c b/src/enemy/treeItem.c index 0b2103fd..acacb7a3 100644 --- a/src/enemy/treeItem.c +++ b/src/enemy/treeItem.c @@ -47,7 +47,7 @@ void TreeItem(Entity* this) { if (itemEntity) { CopyPosition(this, itemEntity); itemEntity->y.HALF.HI += 16; - itemEntity->height.HALF.HI = -32; + itemEntity->z.HALF.HI = -32; } } } diff --git a/src/enemy/vaatiArm.c b/src/enemy/vaatiArm.c index d001699a..6dbacb7f 100644 --- a/src/enemy/vaatiArm.c +++ b/src/enemy/vaatiArm.c @@ -425,7 +425,7 @@ void sub_08042A3C(Entity* this) { gUnk_080D12B8[this->subAction](this); sub_08043A10(this); entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; - entity->height.HALF.HI += this->field_0x78.HALF.LO; + entity->z.HALF.HI += this->field_0x78.HALF.LO; } void sub_08042A6C(Entity* this) { @@ -481,11 +481,11 @@ void sub_08042B20(Entity* this) { if (0x30 < ptr->unk04.HALF.HI) { ptr->unk00.HWORD += ptr->unk08; } - if (((VaatiArm_HeapStruct*)this->myHeap)->entities[3]->spriteSettings.b.draw) { + if (((VaatiArm_HeapStruct*)this->myHeap)->entities[3]->spriteSettings.draw) { sub_08043C40(this, ptr); for (i = 0; i < 4; i++) { entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; - if ((-0xa <= entity->height.HALF.HI) && ((entity->spriteSettings.b.draw) == 1)) { + if ((-0xa <= entity->z.HALF.HI) && ((entity->spriteSettings.draw) == 1)) { if (i == 0) { object = CreateObject(OBJECT_AF, 0, 0); if (object != NULL) { @@ -498,7 +498,7 @@ void sub_08042B20(Entity* this) { } } entity->flags &= 0x7f; - entity->spriteSettings.b.draw = 0; + entity->spriteSettings.draw = 0; SoundReq(SFX_161); } } @@ -564,7 +564,7 @@ void sub_08042C34(Entity* this) { entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; entity->x.HALF.HI = x; entity->y.HALF.HI = y; - entity->height.HALF.HI = 0x32; + entity->z.HALF.HI = 0x32; entity->hitType = 0x39; ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[i]; ptr->unk00.HWORD = 0x80; @@ -600,20 +600,20 @@ void sub_08042D6C(Entity* this) { for (i = 0; i < 4; i++) { entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; - if (entity->height.HALF.HI < 4) { + if (entity->z.HALF.HI < 4) { if (i != 2) { entity->flags = entity->flags | 0x80; } - if ((entity->spriteSettings.b.draw == 0u) && (object = CreateObject(OBJECT_AF, 2, 0), object != NULL)) { + if ((entity->spriteSettings.draw == 0u) && (object = CreateObject(OBJECT_AF, 2, 0), object != NULL)) { CopyPosition(entity, object); SoundReq(SFX_166); } - entity->spriteSettings.b.draw = 1; + entity->spriteSettings.draw = 1; } } entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; - if (entity->height.HALF.HI <= -3) { - entity->height.HALF.HI = -5; + if (entity->z.HALF.HI <= -3) { + entity->z.HALF.HI = -5; ((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk08 = gUnk_080D1300[this->type2]; ((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk0a = 0xc0; this->subAction = 3; @@ -623,7 +623,7 @@ void sub_08042D6C(Entity* this) { InitAnimationForceUpdate(this, 0); ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->hitType = 0x39; } else { - entity->height.HALF.HI -= 2; + entity->z.HALF.HI -= 2; } } @@ -710,15 +710,15 @@ void sub_08042FD8(Entity* this) { UpdateAnimationSingleFrame(this); if (!sub_08043C98(this)) { - if ((this->frames.all & 1) != 0) { + if ((this->frame & 1) != 0) { entity = CreateProjectile(0x20); if (entity != NULL) { CopyPosition(this, entity); - entity->height.HALF.HI -= 0x18; - this->frames.all = 0; + entity->z.HALF.HI -= 0x18; + this->frame = 0; } } else { - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { if (--this->field_0xf == 0) { this->subAction = 8; this->actionDelay = 0x3c; @@ -802,18 +802,18 @@ void sub_08043130(Entity* this) { } } } else { - ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]->height.HALF.HI += 3; + ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]->z.HALF.HI += 3; for (i = 0; i < 4; i++) { entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; - if (entity->height.HALF.HI > -4) { + if (entity->z.HALF.HI > -4) { entity->flags = entity->flags & 0x7f; - if (entity->spriteSettings.b.draw == 1) { + if (entity->spriteSettings.draw == 1) { SoundReq(SFX_161); } - entity->spriteSettings.b.draw = 0; + entity->spriteSettings.draw = 0; } } - if (this->spriteSettings.b.draw == 0) { + if (this->spriteSettings.draw == 0) { this->subAction = 9; this->actionDelay = 0x3c; sub_0804AA1C(this); @@ -853,7 +853,7 @@ void sub_0804325C(Entity* this) { if (this->field_0x78.HALF.LO >= 3) { this->field_0x78.HALF.LO -= 2; entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; - entity->height.HALF.HI += this->field_0x78.HALF.LO; + entity->z.HALF.HI += this->field_0x78.HALF.LO; } else { this->field_0x78.HALF.LO = 0; } @@ -876,7 +876,7 @@ NONMATCH("asm/non_matching/vaati/sub_0804334C.inc", void sub_0804334C(Entity* th for (i = 0; i < 5; i++) { entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; entity->flags = entity->flags | 0x80; - entity->spriteSettings.b.draw = 1; + entity->spriteSettings.draw = 1; } } s = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; @@ -951,16 +951,16 @@ NONMATCH("asm/non_matching/vaati/sub_08043490.inc", void sub_08043490(Entity* th Entity* entity; entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; - if (entity->height.HALF.HI < -4) { - entity->hVelocity = 0x18000; + if (entity->z.HALF.HI < -4) { + entity->zVelocity = 0x18000; this->subAction = 2; this->field_0x7c.BYTES.byte2 = 0; ((VaatiArm_HeapStruct*)this->myHeap)->parent->subAction = 2; } else { - entity->height.HALF.HI -= 2; - if (entity->height.HALF.HI < 0) { + entity->z.HALF.HI -= 2; + if (entity->z.HALF.HI < 0) { entity->flags = entity->flags | 0x80; - entity->spriteSettings.b.draw = 1; + entity->spriteSettings.draw = 1; entity->field_0x3c = entity->field_0x3c & 0xef; entity->hitType = 0x3a; entity->hitbox = (Hitbox*)&gUnk_080FD450; @@ -979,8 +979,8 @@ void sub_08043520(Entity* this) { entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; sub_08003FC4(entity, 0x1a00); - if ((entity->hVelocity < 0) && (-6 < entity->height.HALF.HI)) { - entity->height.HALF.HI = -6; + if ((entity->zVelocity < 0) && (-6 < entity->z.HALF.HI)) { + entity->z.HALF.HI = -6; this->subAction = 3; this->field_0x7a.HWORD = 900; } @@ -998,15 +998,15 @@ void sub_08043580(Entity* this) { Entity* entity; u32 i; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->height.HALF.HI += 3; + ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->z.HALF.HI += 3; for (i = 0; i < 5; i++) { entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; - if (-4 < entity->height.HALF.HI) { + if (-4 < entity->z.HALF.HI) { entity->flags = entity->flags & 0x7f; - entity->spriteSettings.b.draw = 0; + entity->spriteSettings.draw = 0; } } - if ((this->spriteSettings.b.draw & 3) == 0) { + if ((this->spriteSettings.draw & 3) == 0) { this->subAction = 5; this->actionDelay = 0x3c; entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; @@ -1063,7 +1063,7 @@ static inline void deleteThing(Entity* this, const u32 index) { this->actionDelay = 0x14; this->subAction = index + 1; if (index == 1) { - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } CreateFx(((VaatiArm_HeapStruct*)this->myHeap)->entities[index], FX_GIANT_EXPLOSION4, 0); ((VaatiArm_HeapStruct*)this->myHeap)->entities[index]->myHeap = NULL; @@ -1099,7 +1099,7 @@ NONMATCH("asm/non_matching/vaati/sub_08043770.inc", void sub_08043770(Entity* th gScreenTransition.field_0x39 &= 0xfd; } ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->myHeap = NULL; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->currentHealth = 0; + ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->health = 0; (*(Entity**)&this->field_0x68)->parent = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; DeleteThisEntity(); } @@ -1170,7 +1170,7 @@ void sub_08043A10(Entity* this) { sub_08043B7C(this); sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[4]); ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->y.HALF.HI -= 8; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->height.HALF.HI -= 8; + ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->z.HALF.HI -= 8; sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[3]); sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[2]); sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[1]); @@ -1329,7 +1329,7 @@ void sub_08043D08(Entity* this) { InitAnimationForceUpdate(this, 0xd); entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; entity->flags &= 0x7f; - entity->spriteSettings.b.draw = 0; + entity->spriteSettings.draw = 0; InitializeAnimation(entity, 0x13); sub_0804AA1C(entity); fx = CreateFx(entity, FX_GIANT_EXPLOSION4, 0); @@ -1339,7 +1339,7 @@ void sub_08043D08(Entity* this) { fx->spritePriority.b0 = 3; } CopyPosition(((VaatiArm_HeapStruct*)this->myHeap)->entities[3], entity); - entity->height.HALF.HI += ((VaatiArm_HeapStruct*)this->myHeap)->s1[3].unk0c; + entity->z.HALF.HI += ((VaatiArm_HeapStruct*)this->myHeap)->s1[3].unk0c; for (i = 0; i < 5; i++) { ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]->hitType = 0x39; } @@ -1402,15 +1402,15 @@ void sub_08043EB8(Entity* this) { pEVar4->spritePriority.b0 = 4; pEVar4 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; pEVar4->flags = pEVar4->flags & 0x7f; - pEVar4->spriteSettings.b.draw = 1; + pEVar4->spriteSettings.draw = 1; pEVar4->spritePriority.b0 = 4; pEVar4 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; pEVar4->flags = pEVar4->flags | 0x80; - pEVar4->spriteSettings.b.draw = 1; + pEVar4->spriteSettings.draw = 1; pEVar4->spritePriority.b0 = 4; pEVar4->x.HALF.HI = (this->type2 == 0) ? gScreenTransition.field_0x44 : gScreenTransition.field_0x48; pEVar4->y.HALF.HI = (this->type2 == 0) ? gScreenTransition.field_0x46 : gScreenTransition.field_0x4a; - pEVar4->height.HALF.HI = 0; + pEVar4->z.HALF.HI = 0; pEVar4->field_0x3c = pEVar4->field_0x3c & 0xef; pEVar4->hitType = 0x3a; pEVar4->hitbox = (Hitbox*)&gUnk_080FD450; diff --git a/src/enemy/vaatiBall.c b/src/enemy/vaatiBall.c index dca843d9..778af1a7 100644 --- a/src/enemy/vaatiBall.c +++ b/src/enemy/vaatiBall.c @@ -26,7 +26,7 @@ void VaatiBall(Entity* this) { gUnk_080D1604[this->action](this); if (this->cutsceneBeh.HALF.LO) { - this->currentHealth = -1; + this->health = -1; } if (this->bitfield & 0x80) { @@ -35,13 +35,13 @@ void VaatiBall(Entity* this) { } #ifdef EU - if (this->currentHealth < 0xfa) { + if (this->health < 0xfa) { #else - if (this->currentHealth < 0xfd) { + if (this->health < 0xfd) { #endif - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; COLLISION_OFF(this); - this->currentHealth = -1; + this->health = -1; parent->field_0x80.HALF.LO--; CreateDust(this); SoundReq(SFX_1C3); @@ -63,17 +63,17 @@ void sub_0804468C(Entity* this) { this->direction = (this->field_0x78.HALF.HI * 8) & 0x1f; this->field_0x78.HALF.LO = 0; this->field_0x82.HALF.HI = 0; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; off = &gUnk_080D1620[this->field_0x78.HALF.HI & 3]; PositionRelative(this->parent, this, off->h << 0x10, (off->v - 0x10) * 0x10000); - this->height.HALF.HI = this->parent->height.HALF.HI; + this->z.HALF.HI = this->parent->z.HALF.HI; InitAnimationForceUpdate(this, 0); break; case 1: this->action = 3; this->field_0x74.HALF.LO = 0; this->field_0x82.HALF.HI = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 1); break; } @@ -124,15 +124,15 @@ void sub_080447E0(Entity* this) { this->hitType = 43; sub_08044E74(this, 0); if (this->flags & ENT_COLLIDE) - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } else { this->field_0x76.HALF.HI++; this->field_0x76.HALF.HI &= 7; if (this->flags & ENT_COLLIDE) { if (this->field_0x76.HALF.HI & 1) { - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } else { - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } } @@ -156,7 +156,7 @@ void sub_08044868(Entity* this) { if (this->field_0x82.HALF.HI) { switch (this->field_0x74.HALF.LO) { case 0: - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->field_0x74.HALF.LO = 1; this->direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10); this->speed = 0x180; @@ -179,11 +179,11 @@ void sub_08044868(Entity* this) { case 1: if (this->field_0x82.HALF.HI == 0) { this->field_0x82.HALF.HI++; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } sub_08044DEC(this); if (*(u8*)&vaati->field_0x86 > 1) { - u8 draw = this->spriteSettings.b.draw; + u8 draw = this->spriteSettings.draw; if (draw == 1 && this->cutsceneBeh.HALF.LO == 0) { vaati = CreateProjectileWithParent(this, 0x18, 0); if (vaati) { @@ -205,7 +205,7 @@ void sub_08044868(Entity* this) { u8 draw; sub_08044E74(this, 1); - draw = this->spriteSettings.b.draw; + draw = this->spriteSettings.draw; if (draw == 1) { COLLISION_ON(this); } else { @@ -273,13 +273,13 @@ void sub_080449F8(Entity* this) { u8 draw; this->field_0x74.HALF.LO++; - draw = this->spriteSettings.b.draw; + draw = this->spriteSettings.draw; if (draw) { vaati = CreateProjectileWithParent(this, 0x1c, 0); if (vaati) { vaati->y.HALF.HI += 4; vaati->parent = this; - this->attachedEntity = vaati; + this->child = vaati; } } } @@ -393,7 +393,7 @@ void sub_08044B04(Entity* this) { COLLISION_OFF(this); PositionRelative(vaati, this, 0, -0x100000); if (this->field_0xf) - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; break; case 1: if (--this->actionDelay == 0) { @@ -427,7 +427,7 @@ void sub_08044B04(Entity* this) { u8 draw; sub_08044E74(this, 1); - draw = this->spriteSettings.b.draw; + draw = this->spriteSettings.draw; if (draw == 1) { COLLISION_ON(this); } else { @@ -447,10 +447,10 @@ void sub_08044DEC(Entity* this) { u32 off; if (this->parent->field_0x80.HALF.LO > this->field_0x78.HALF.HI) { - this->spriteSettings.b.draw = 1; - this->currentHealth = -1; + this->spriteSettings.draw = 1; + this->health = -1; } else { - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } COLLISION_OFF(this); this->field_0x78.HALF.LO = 0; diff --git a/src/enemy/vaatiEyesMacro.c b/src/enemy/vaatiEyesMacro.c index 86b5a739..5bc955dc 100644 --- a/src/enemy/vaatiEyesMacro.c +++ b/src/enemy/vaatiEyesMacro.c @@ -62,27 +62,27 @@ void VaatiEyesMacroFunction0(Entity* this) { void VaatiEyesMacroFunction1(Entity* this) { if (this->type == 0) { - if (this->currentHealth == 0) { + if (this->health == 0) { gScreenTransition.field_0x39 &= ~(1 << (gScreenTransition.field_0x3c + 2)); } if (gRoomControls.roomID == 0) { - gScreenTransition.field_0x3a = this->currentHealth; + gScreenTransition.field_0x3a = this->health; } else { - gScreenTransition.field_0x3b = this->currentHealth; + gScreenTransition.field_0x3b = this->health; } - if (this->field_0x78.HALF.HI != this->currentHealth) { + if (this->field_0x78.HALF.HI != this->health) { EnqueueSFX(SFX_17A); } - this->field_0x78.HALF.HI = this->currentHealth; + this->field_0x78.HALF.HI = this->health; } else { if (this->type == 1) { if (0 < this->iframes) { this->iframes *= -1; } - if (this->currentHealth != 0xff) { + if (this->health != 0xff) { EnqueueSFX(SFX_BUTTON_DEPRESS); } - this->currentHealth = 0xff; + this->health = 0xff; } } if (this->field_0x43 != 0) { @@ -108,9 +108,9 @@ void VaatiEyesMacroFunction0Type0Action0(Entity* this) { enemy->parent = this; this->action = 1; if (gRoomControls.roomID == 0) { - this->field_0x78.HALF.HI = this->currentHealth = gScreenTransition.field_0x3a; + this->field_0x78.HALF.HI = this->health = gScreenTransition.field_0x3a; } else { - this->field_0x78.HALF.HI = this->currentHealth = gScreenTransition.field_0x3b; + this->field_0x78.HALF.HI = this->health = gScreenTransition.field_0x3b; } this->field_0x78.HALF.LO = Random(); sub_0802EFB8(this); @@ -147,7 +147,7 @@ void VaatiEyesMacroFunction0Type1Action0(Entity* this) { void VaatiEyesMacroFunction0Type1Action1(Entity* this) { if (this->parent->next == NULL) { COLLISION_OFF(this); - this->currentHealth = 0; + this->health = 0; } else { sub_0802F04C(this); GetNextFrame(this); @@ -192,7 +192,7 @@ void VaatiEyesMacroFunction0Type3(Entity* this) { this->spritePriority.b0 = 6; } CopyPositionAndSpriteOffset(this->parent, this); - this->height.HALF.HI = 0; + this->z.HALF.HI = 0; } void sub_0802EF58(Entity* this) { @@ -212,7 +212,7 @@ void sub_0802EF58(Entity* this) { } void sub_0802EF90(Entity* this) { - this->height.HALF.HI = gUnk_080CDE90[this->field_0x78.HALF.LO++ >> 3 & 7]; + this->z.HALF.HI = gUnk_080CDE90[this->field_0x78.HALF.LO++ >> 3 & 7]; } void sub_0802EFB8(Entity* this) { diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c index f86fb5ab..c1cf9435 100644 --- a/src/enemy/vaatiProjectile.c +++ b/src/enemy/vaatiProjectile.c @@ -43,7 +43,7 @@ void (*const vaatiProjectileFunction0Actions[])(Entity*) = { void VaatiProjectile(Entity* this) { if (sub_0803E4A0(this)) { COLLISION_OFF(this); - this->currentHealth = 0; + this->health = 0; this->parent = NULL; } vaatiProjectileFunctions[GetNextFunction(this)](this); @@ -58,7 +58,7 @@ void VaatiProjectileFunction1(Entity* this) { if (this->bitfield == 0x80) { #ifndef EU - if (this->currentHealth != 0) { + if (this->health != 0) { #endif this->action = 5; COLLISION_OFF(this); @@ -101,13 +101,13 @@ void VaatiProjectileFunction0Action0(Entity* this) { entity = CreateEnemy(VAATI_PROJECTILE, 1); if (entity != NULL) { entity->parent = this; - this->attachedEntity = entity; + this->child = entity; if (this->type2 == 0) { this->action = 1; - this->height.HALF.HI = -0x18; + this->z.HALF.HI = -0x18; } else { this->action = 9; - this->height.HALF.HI = -0x80; + this->z.HALF.HI = -0x80; this->flags2 = 1; } InitializeAnimation(this, 0); @@ -129,7 +129,7 @@ void VaatiProjectileFunction0Action1(Entity* this) { if (PlayerInRange(this, 0, 8) != 0) { this->action = 2; this->actionDelay = 10; - InitializeAnimation(this->attachedEntity, 2); + InitializeAnimation(this->child, 2); } else { if (gUnk_020000B0 != NULL) { sub_08004596(this, GetFacingDirection(this, gUnk_020000B0)); @@ -143,7 +143,7 @@ void VaatiProjectileFunction0Action2(Entity* this) { if (this->actionDelay != 0) { this->actionDelay--; } else { - if (++this->height.HALF.HI == 0) { + if (++this->z.HALF.HI == 0) { this->action = 3; } } @@ -151,11 +151,11 @@ void VaatiProjectileFunction0Action2(Entity* this) { } void VaatiProjectileFunction0Action3(Entity* this) { - if ((this->attachedEntity->frames.b.f3) != 0) { - if (--this->height.HALF.HI <= -0x18) { + if (this->child->frame & 0x80) { + if (--this->z.HALF.HI <= -0x18) { this->action = 4; this->actionDelay = (Random() & 0xf) + 0xf; - InitializeAnimation(this->attachedEntity, 1); + InitializeAnimation(this->child, 1); } GetNextFrame(this); } @@ -174,7 +174,7 @@ void VaatiProjectileFunction0Action5(Entity* this) { if (this->actionDelay != 0) { this->actionDelay--; } else { - if (-0x18 < --this->height.HALF.HI) { + if (-0x18 < --this->z.HALF.HI) { return; } this->action = 6; @@ -212,14 +212,14 @@ void VaatiProjectileFunction0Action8(Entity* this) { void VaatiProjectileFunction0Action9(Entity* this) { this->x.HALF.HI = gPlayerEntity.x.HALF.HI; this->y.HALF.HI = gPlayerEntity.y.HALF.HI; - if (this->height.HALF.HI < -8) { + if (this->z.HALF.HI < -8) { if (this->animIndex != 2) { this->actionDelay = 0; - InitializeAnimation(this->attachedEntity, 2); + InitializeAnimation(this->child, 2); } VaatiProjectileFunction0Action2(this); } else { - this->height.HALF.HI += 8; + this->z.HALF.HI += 8; } } @@ -257,7 +257,7 @@ bool32 sub_0803E4A0(Entity* this) { if (this->parent == NULL) { return FALSE; } - if (this->parent->currentHealth == 0) { + if (this->parent->health == 0) { return TRUE; } else { ret = this->parent->next == NULL; diff --git a/src/enemy/vaatiRebornEnemy.c b/src/enemy/vaatiRebornEnemy.c index 85c39122..d1a2e4c8 100644 --- a/src/enemy/vaatiRebornEnemy.c +++ b/src/enemy/vaatiRebornEnemy.c @@ -104,10 +104,10 @@ void VaatiRebornEnemyType0Action0(Entity* this) { this->field_0x74.HALF.LO = -1; this->actionDelay = 0; this->field_0x76.HALF.LO = 0; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->direction = 0xff; this->spritePriority.b0 = 4; - this->height.WORD = 0; + this->z.WORD = 0; this->field_0x80.HALF.LO = 2; this->field_0x86.HALF.LO = 0; this->cutsceneBeh.HALF.HI = 0x30; @@ -119,7 +119,7 @@ void VaatiRebornEnemyType0Action0(Entity* this) { this->field_0x7c = this->y; entity = CreateEnemy(VAATI_REBORN_ENEMY, 1); entity->parent = this; - this->attachedEntity = entity; + this->child = entity; for (i = 0; i < 6; i++) { entity = CreateEnemy(VAATI_BALL, 0); entity->parent = this; @@ -133,7 +133,7 @@ void VaatiRebornEnemyType0Action0(Entity* this) { for (i = 0; i < 2; i++) { entity = CreateEnemy(VAATI_BALL, 1); entity->parent = this; - entity->spriteSettings.b.flipX = i; + entity->spriteSettings.flipX = i; ptr = &gUnk_080D04A8[i]; PositionRelative(this, entity, ptr->x << 0x10, ptr->y << 0x10); } @@ -145,7 +145,7 @@ void VaatiRebornEnemyType0Action1(Entity* this) { if (this->actionDelay != 0) { if (--this->actionDelay == 0) { if ((this->field_0x74.HALF.LO & 0x70) == 0) { - if (this->attachedEntity->actionDelay == 0) { + if (this->child->actionDelay == 0) { sub_0803DD78(this); if (this->field_0x74.HALF.HI != 0) { this->action = 2; @@ -168,7 +168,7 @@ void VaatiRebornEnemyType0Action1(Entity* this) { this->field_0x74.HALF.LO = 0; this->actionDelay = 0xc0; this->direction = 0xff; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 0); } } @@ -205,7 +205,7 @@ void VaatiRebornEnemyType0Action1(Entity* this) { break; } } - if (this->attachedEntity->actionDelay == 0) { + if (this->child->actionDelay == 0) { this->cutsceneBeh.HALF.HI++; if ((this->cutsceneBeh.HALF.HI & 3) == 0) { switch (this->cutsceneBeh.HALF.HI & 0x30) { @@ -237,9 +237,9 @@ void VaatiRebornEnemyType0Action2(Entity* this) { } break; case 1: - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->field_0x74.HALF.LO = 2; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->actionDelay = 0x10; } break; @@ -255,15 +255,15 @@ void VaatiRebornEnemyType0Action2(Entity* this) { this->x.HALF.HI = gRoomControls.roomOriginX + ptr->HALF.x + 0x10; this->y.HALF.HI = gRoomControls.roomOriginY + ptr->HALF.y + 0x10; } - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->actionDelay = 0x20; InitAnimationForceUpdate(this, 4); SoundReq(SFX_F5); } break; case 3: - if ((this->frames.all & 0x80) != 0) { - this->spriteSettings.b.draw = 1; + if ((this->frame & 0x80) != 0) { + this->spriteSettings.draw = 1; if (4 < this->field_0x80.HALF.HI) { this->x.HALF.HI = gPlayerEntity.x.HALF.HI; this->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0x18; @@ -291,8 +291,8 @@ void VaatiRebornEnemyType0Action3(Entity* this) { this->actionDelay = 1; break; case 0xff: - if (this->height.HALF.HI != -4) { - this->height.WORD -= 0x2000; + if (this->z.HALF.HI != -4) { + this->z.WORD -= 0x2000; } if (this->actionDelay == 2) { this->field_0x74.HALF.LO = 0xfe; @@ -320,7 +320,7 @@ void VaatiRebornEnemyType0Action3(Entity* this) { } break; case 2: - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->field_0x74.HALF.LO = 3; InitAnimationForceUpdate(this, 0); } @@ -345,8 +345,8 @@ void VaatiRebornEnemyType0Action4(Entity* this) { this->direction = (this->direction + 0x10) & 0x1f; InitAnimationForceUpdate(this, 0); } else { - if ((this->frames.all & 0x10) != 0) { - this->frames.all &= 0xef; + if ((this->frame & 0x10) != 0) { + this->frame &= 0xef; if (this->cutsceneBeh.HALF.LO == 0xff) { index = Direction8RoundUp(GetFacingDirection(this, &gPlayerEntity)); this->cutsceneBeh.HALF.LO = gUnk_080D04C0[index >> 2]; @@ -356,7 +356,7 @@ void VaatiRebornEnemyType0Action4(Entity* this) { (entity = CreateProjectileWithParent(this, 0x1a, this->cutsceneBeh.HALF.LO), entity != NULL)) { entity->field_0xf = this->field_0xf; entity->parent = this; - entity->height.HALF.HI = this->height.HALF.HI; + entity->z.HALF.HI = this->z.HALF.HI; this->field_0xf = this->field_0xf + 1; } } @@ -383,7 +383,7 @@ void VaatiRebornEnemyType0Action5(Entity* this) { } break; case 1: - if ((this->frames.all & 0x10) != 0) { + if ((this->frame & 0x10) != 0) { this->field_0x74.HALF.LO = 2; this->field_0xf = (Random() & 0x3f) + 0x40; SoundReq(SFX_SUMMON); @@ -503,7 +503,7 @@ void VaatiRebornEnemyType1Action0(Entity* this) { PositionRelative(this->parent, this, 0, 0x10000); enemy = CreateEnemy(VAATI_REBORN_ENEMY, 2); enemy->parent = this; - enemy->attachedEntity = this->parent; + enemy->child = this->parent; InitAnimationForceUpdate(this, this->field_0x74.HALF.LO); } @@ -527,7 +527,7 @@ void VaatiRebornEnemyType1Action1(Entity* this) { parent->iframes = this->iframes; parent->bitfield = this->bitfield; } - if ((this->frames.all & 0x40) != 0) { + if ((this->frame & 0x40) != 0) { InitAnimationForceUpdate(this, 2); } } @@ -544,7 +544,7 @@ void VaatiRebornEnemyType1Action1(Entity* this) { COLLISION_OFF(this); } } - this->spriteSettings.b.draw = parent->spriteSettings.b.draw; + this->spriteSettings.draw = parent->spriteSettings.draw; this->spriteOffsetX = parent->spriteOffsetX; PositionRelative(this->parent, this, 0, 0x10000); UpdateAnimationSingleFrame(this); @@ -593,7 +593,7 @@ void VaatiRebornEnemyType2Action1(Entity* this) { InitAnimationForceUpdate(this, 2); } } - this->spriteSettings.b.draw = parent->spriteSettings.b.draw; + this->spriteSettings.draw = parent->spriteSettings.draw; this->spriteOffsetX = parent->spriteOffsetX; PositionRelative(parent->parent, this, 0, 0x20000); UpdateAnimationSingleFrame(this); @@ -635,7 +635,7 @@ void sub_0803DC0C(Entity* this) { parent = this->parent; tmp = &gUnk_080D04C8[this->actionDelay]; - this->spriteSettings.b.draw = parent->spriteSettings.b.draw; + this->spriteSettings.draw = parent->spriteSettings.draw; this->spriteOffsetX = parent->spriteOffsetX; PositionRelative(parent, this, tmp->x << 0x10, (tmp->y + 1) * 0x10000); UpdateAnimationSingleFrame(this); @@ -650,7 +650,7 @@ void VaatiRebornEnemyType1PreAction(Entity* this) { parent = this->parent; this->field_0x76.HALF.HI = 0; if ((this->bitfield & 0x80) != 0) { - if (gUnk_080D04D0[parent->field_0x86.HALF.LO] > this->currentHealth) { + if (gUnk_080D04D0[parent->field_0x86.HALF.LO] > this->health) { if (2 < ++parent->field_0x86.HALF.LO) { COLLISION_OFF(this); parent->action = 7; @@ -681,7 +681,7 @@ void VaatiRebornEnemyType1PreAction(Entity* this) { parent->field_0x74.HALF.LO = 0xf0; } else { parent->field_0x74.HALF.LO = 0x70; - this->currentHealth = 0xff; + this->health = 0xff; } parent->action = 1; parent->actionDelay = 1; diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index 0933b1eb..c00649a5 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -136,7 +136,7 @@ void VaatiTransfiguredType0Action0(Entity* this) { sub_0804A720(this); if ((CheckRoomFlag(0) != 0) && (gEntCount < 0x51)) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spritePriority.b0 = 5; this->field_0x6c.HALF.HI |= 1; this->direction = (Random() & 0x17) + 4; @@ -210,7 +210,7 @@ void VaatiTransfiguredType0Action1(Entity* this) { break; case 3: if (--this->actionDelay == 0) { - this->height.HALF.HI = 0; + this->z.HALF.HI = 0; this->field_0x80.HALF.LO = 0; this->actionDelay = gUnk_080D0ABF[(u32)this->animationState * 2]; switch (sub_08040934(this)) { @@ -279,7 +279,7 @@ void VaatiTransfiguredType0Action3(Entity* this) { this->hitType = 0x35; this->spriteOffsetX = 0; } - if (this->currentHealth < gUnk_080D0ABC[this->animationState]) { + if (this->health < gUnk_080D0ABC[this->animationState]) { tmp = 1; this->actionDelay = 1; } else { @@ -300,7 +300,7 @@ void VaatiTransfiguredType0Action3(Entity* this) { } break; case 2: - this->attachedEntity->field_0x74.HALF.LO = 0x10; + this->child->field_0x74.HALF.LO = 0x10; if (this->actionDelay) { this->field_0x80.HALF.LO = 3; this->actionDelay = 0x40; @@ -313,7 +313,7 @@ void VaatiTransfiguredType0Action3(Entity* this) { if (this->actionDelay != 0) { if (--this->actionDelay == 0) { COLLISION_OFF(this); - this->hVelocity = 0x38000; + this->zVelocity = 0x38000; this->field_0xf = 0x10; } break; @@ -322,7 +322,7 @@ void VaatiTransfiguredType0Action3(Entity* this) { this->field_0x80.HALF.LO = 5; this->actionDelay = 0x10; COLLISION_ON(this); - this->currentHealth = 0xff; + this->health = 0xff; this->field_0x86.HALF.LO = 0; sub_080408EC(this); SoundReq(SFX_14C); @@ -379,7 +379,7 @@ void VaatiTransfiguredType0Action4(Entity* this) { this->field_0x74.HALF.LO = 0; this->actionDelay = 0x80; this->field_0xf = 0; - this->hVelocity = 0x24000; + this->zVelocity = 0x24000; SoundReq(SFX_12B); } break; @@ -424,7 +424,7 @@ void VaatiTransfiguredType0Action4(Entity* this) { if (--this->actionDelay == 0) { this->action = 1; this->field_0x80.HALF.LO = 0; - this->height.HALF.HI = 0; + this->z.HALF.HI = 0; sub_08040670(this); } else { sub_08040AD4(this); @@ -557,8 +557,8 @@ void VaatiTransfiguredType0Action7(Entity* this) { } else { if (this->field_0xf != 0) { if (--this->field_0xf == 0) { - this->currentHealth = 0; - this->spriteSettings.b.draw = 0; + this->health = 0; + this->spriteSettings.draw = 0; } } else { sub_0804A7D4(this); @@ -594,7 +594,7 @@ void VaatiTransfiguredType1Action1(Entity* this) { Entity* parent; parent = this->parent; - if (parent->currentHealth == 0) { + if (parent->health == 0) { this->field_0x6c.HALF.HI |= 2; DeleteThisEntity(); } @@ -617,7 +617,7 @@ void VaatiTransfiguredType1Action1(Entity* this) { } } if (parent->action != 3) { - this->height.HALF.HI = parent->height.HALF.HI; + this->z.HALF.HI = parent->z.HALF.HI; } } @@ -645,7 +645,7 @@ void VaatiTransfiguredType2Action1(Entity* this) { const xy* t; - if (this->parent->currentHealth == 0) { + if (this->parent->health == 0) { this->field_0x6c.HALF.HI |= 2; DeleteThisEntity(); } @@ -659,7 +659,7 @@ void VaatiTransfiguredType2Action1(Entity* this) { case 1: if (this->parent->frameIndex != 2) { this->action = 2; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } break; case 0: @@ -674,7 +674,7 @@ void VaatiTransfiguredType2Action1(Entity* this) { } break; case 1: - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->field_0x74.HALF.LO = 0; this->field_0xf = (Random() & 0x7f) + 0x17; InitAnimationForceUpdate(this, 0); @@ -698,14 +698,14 @@ void VaatiTransfiguredType2Action1(Entity* this) { } void VaatiTransfiguredType2Action2(Entity* this) { - if (this->parent->currentHealth == 0) { + if (this->parent->health == 0) { this->field_0x6c.HALF.HI |= 2; DeleteThisEntity(); } CopyPosition(this->parent, this); if (this->parent->frameIndex == 2) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } } @@ -716,7 +716,7 @@ void VaatiTransfiguredType3Action0(Entity* this) { } void VaatiTransfiguredType3Action1(Entity* this) { - if (this->parent->currentHealth == 0) { + if (this->parent->health == 0) { this->field_0x6c.HALF.HI |= 2; DeleteThisEntity(); } @@ -728,25 +728,25 @@ void VaatiTransfiguredType4Action0(Entity* this) { this->action = 1; this->field_0x80.HALF.LO = 0; this->actionDelay = 10; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->spritePriority.b0 = 7; InitializeAnimation(this, 0); } void VaatiTransfiguredType4Action1(Entity* this) { - if (this->parent->currentHealth == 0) { + if (this->parent->health == 0) { this->field_0x6c.HALF.HI |= 2; DeleteThisEntity(); } if (this->parent->action != 5) { if (this->field_0x80.HALF.LO != 0) { this->field_0x80.HALF.LO = 0; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } } else { if (this->field_0x80.HALF.LO == 0) { this->field_0x80.HALF.LO += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } if (--this->actionDelay == 0) { this->actionDelay = 10; @@ -765,13 +765,13 @@ void VaatiTransfiguredType5Action0(Entity* this) { InitializeAnimation(this, 2); } else { this->action = 1; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->spritePriority.b0 = 4; } } void VaatiTransfiguredType5Action1(Entity* this) { - if (this->parent->currentHealth == 0) { + if (this->parent->health == 0) { this->field_0x6c.HALF.HI |= 2; DeleteThisEntity(); } @@ -781,16 +781,16 @@ void VaatiTransfiguredType5Action1(Entity* this) { return; } this->field_0x80.HALF.LO += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 1); break; case 1: if (this->parent->action != 6) { this->field_0x80.HALF.LO = 0; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } else { - if (this->frames.b.f3 != 0) { - this->frames.b.f3 = 0; + if (this->frame & 0x80) { + this->frame &= ~0x80; if (gEntCount < 0x47) { sub_08040648(this, this->type, 1); } @@ -807,19 +807,19 @@ void VaatiTransfiguredType5Action1(Entity* this) { } void VaatiTransfiguredType5Action2(Entity* this) { - if (this->parent->currentHealth == 0) { + if (this->parent->health == 0) { this->field_0x6c.HALF.HI |= 2; DeleteThisEntity(); } if (this->field_0x80.HALF.LO == 0) { if (this->parent->parent->action != 6) { - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->field_0x80.HALF.LO += 1; InitializeAnimation(this, 3); } } } else { - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { DeleteThisEntity(); } } @@ -835,7 +835,7 @@ void sub_08040648(Entity* this, u32 type, u32 type2) { enemy->parent = this; CopyPosition(this, enemy); if ((type == 2) && (type2 == 0)) { - this->attachedEntity = enemy; + this->child = enemy; } } @@ -1061,7 +1061,7 @@ void sub_080409B0(Entity* this) { this->field_0x80.HALF.HI = 3; COLLISION_OFF(this); this->hitType = 0x36; - this->hVelocity = 0x18000; + this->zVelocity = 0x18000; SoundReq(SFX_164); } } @@ -1078,7 +1078,7 @@ void sub_080409B0(Entity* this) { SoundReq(SFX_BOSS_HIT); } if ((this->bitfield == 0x8a) && (gPlayerState.field_0xa0[0] == 5)) { - this->currentHealth = 0xc0; + this->health = 0xc0; } } } diff --git a/src/enemy/vaatiTransfiguredEye.c b/src/enemy/vaatiTransfiguredEye.c index a6777666..05132764 100644 --- a/src/enemy/vaatiTransfiguredEye.c +++ b/src/enemy/vaatiTransfiguredEye.c @@ -69,8 +69,8 @@ void VaatiTransfiguredEyeFunction1(Entity* this) { SoundReq(SFX_ITEM_GLOVES_KNOCKBACK); } } else { - if (this->currentHealth != 0xff) { - this->currentHealth = 0xff; + if (this->health != 0xff) { + this->health = 0xff; if (this->actionDelay != 0 && (pEVar4->field_0x80.HALF.HI != 0)) { pEVar4->field_0x76.HALF.LO |= (1 << this->type2); if (this->cutsceneBeh.HALF.HI == 0) { @@ -96,7 +96,7 @@ void VaatiTransfiguredEyeFunction0Action0(Entity* this) { bVar2 = gMessage.doTextBox & 0x7f; if ((gMessage.doTextBox & 0x7f) == 0) { this->action = 1; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->field_0x80.HALF.LO = bVar2; this->field_0x80.HALF.HI = bVar2; this->cutsceneBeh.HALF.HI = bVar2; @@ -108,7 +108,7 @@ void VaatiTransfiguredEyeFunction0Action0(Entity* this) { child = CreateEnemy(VAATI_TRANSFIGURED_EYE, 1); if (child != NULL) { child->parent = this; - this->attachedEntity = child; + this->child = child; child->actionDelay = this->actionDelay; child->type2 = this->type2; CopyPosition(this, child); @@ -123,7 +123,7 @@ void VaatiTransfiguredEyeFunction0Action0(Entity* this) { void VaatiTransfiguredEyeFunction0Action1(Entity* this) { sub_08045A28(this); if (this->field_0x82.HALF.LO == 0) { - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { if (this->type != 0) { COLLISION_ON(this); } @@ -132,7 +132,7 @@ void VaatiTransfiguredEyeFunction0Action1(Entity* this) { } } else { if (--this->field_0x82.HALF.LO == 0) { - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } } } @@ -163,7 +163,7 @@ void VaatiTransfiguredEyeFunction0Action2(Entity* this) { void VaatiTransfiguredEyeFunction0Action3(Entity* this) { sub_08045A28(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 2; if (this->type != 0) { if (this->actionDelay == 0) { @@ -181,7 +181,7 @@ void VaatiTransfiguredEyeFunction0Action4(Entity* this) { sub_08045A28(this); if (this->field_0xf == 0) { - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->field_0xf = 0x20; } } else { @@ -219,7 +219,7 @@ void sub_08045A28(Entity* this) { if (this->field_0x82.HALF.LO == 0) { GetNextFrame(this); } - frames = this->frames.all & 0x70; + frames = this->frame & 0x70; type = this->type; if (type == 0) { sub_08045A00(this); @@ -288,7 +288,7 @@ void sub_08045A28(Entity* this) { PositionRelative(this->parent, this, 0, -0x10000); switch (this->field_0x82.HALF.HI) { case 0: - switch (this->frames.all & 0x70) { + switch (this->frame & 0x70) { case 0x10: this->field_0x82.HALF.HI = 2; sub_0801D2B4(this, 0x13b); @@ -302,7 +302,7 @@ void sub_08045A28(Entity* this) { } break; case 1: { - u32 temp = this->frames.all & 0x70; + u32 temp = this->frame & 0x70; switch (temp) { case 0: this->field_0x82.HALF.HI = temp; @@ -317,9 +317,9 @@ void sub_08045A28(Entity* this) { } } break; case 2: - switch (this->frames.all & 0x70) { + switch (this->frame & 0x70) { case 0: - this->field_0x82.HALF.HI = this->frames.all & 0x70; + this->field_0x82.HALF.HI = this->frame & 0x70; sub_0801D2B4(this, 0x13f); break; default: diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index 23063fc3..87acecc2 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -103,9 +103,9 @@ const s8 gUnk_080D0EB0[] = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x0 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd }; void VaatiWrath(Entity* this) { - if (((this->type == 0) && ((this->bitfield & 0x80) != 0)) && (this->currentHealth == 0)) { + if (((this->type == 0) && ((this->bitfield & 0x80) != 0)) && (this->health == 0)) { COLLISION_ON(this); - this->currentHealth = 0xff; + this->health = 0xff; if (--this->cutsceneBeh.HALF.LO == 0) { this->action = 0xd; this->subAction = 0; @@ -149,11 +149,11 @@ void VaatiWrathType0Action0(Entity* this) { this->subAction = bVar1; this->actionDelay = 120; this->spritePriority.b1 = 0; - this->height.HALF.HI = 0xffb0; + this->z.HALF.HI = 0xffb0; gRoomControls.cameraTarget = this; sub_080809D4(); } - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x6c.HALF.HI |= 1; this->field_0x78.HALF.HI = 0; this->field_0x7c.HALF.LO = 0x3c; @@ -169,11 +169,11 @@ void VaatiWrathType0Action1(Entity* this) { break; case 1: this->spritePriority.b1 = 1; - this->height.WORD += 0x8000; - if ((this->height.HALF.HI & 0x3f) == 0) { + this->z.WORD += 0x8000; + if ((this->z.HALF.HI & 0x3f) == 0) { SoundReq(SFX_1A9); } - if (-6 < this->height.HALF.HI) { + if (-6 < this->z.HALF.HI) { this->subAction = 2; SoundReq(SFX_1A9); } @@ -354,20 +354,20 @@ void VaatiWrathType0Action6(Entity* this) { if (this->actionDelay == 0) { type1 = ((VaatiWrathHeapStruct*)this->myHeap)->type1; GetNextFrame(type1); - if (type1->frames.all == 1) { - type1->frames.all &= 0xfe; + if (type1->frame == 1) { + type1->frame &= 0xfe; InitAnimationForceUpdate(this, 4); } else { - if (type1->frames.all == 2) { + if (type1->frame == 2) { Entity* type3 = CreateEnemy(VAATI_WRATH, 3); if (type3 != NULL) { type3->myHeap = this->myHeap; ((VaatiWrathHeapStruct*)this->myHeap)->type3 = type3; InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type2, 0x14); - type1->frames.all &= 0xfd; + type1->frame &= 0xfd; } } else { - if ((type1->frames.all & 0x80) != 0) { + if ((type1->frame & 0x80) != 0) { sub_0804235C(this); } } @@ -456,7 +456,7 @@ void VaatiWrathType0ActionA(Entity* this) { this->subAction = 0; this->direction = 0; this->speed = 0x100; - this->hVelocity = 0x12000; + this->zVelocity = 0x12000; sub_0801D2B4(this, 0x16b); InitAnimationForceUpdate(this, 5); type1 = ((VaatiWrathHeapStruct*)this->myHeap)->type1; @@ -479,7 +479,7 @@ void VaatiWrathType0ActionB(Entity* this) { if (sub_08003FC4(this, 0x2000) == 0) { this->subAction = 1; this->actionDelay = 0xf0; - this->currentHealth = 8; + this->health = 8; this->hitType = 0x38; sub_08080964(0x14, 0); InitAnimationForceUpdate(this, 6); @@ -493,7 +493,7 @@ void VaatiWrathType0ActionB(Entity* this) { this->subAction = 2; this->actionDelay = 0x3c; this->hitType = 0x39; - this->currentHealth = 0xff; + this->health = 0xff; } break; default: @@ -520,8 +520,8 @@ void VaatiWrathType0ActionC(Entity* this) { } switch (this->subAction) { case 0: - this->height.WORD -= 0x8000; - if (this->height.HALF.HI < -4) { + this->z.WORD -= 0x8000; + if (this->z.HALF.HI < -4) { this->subAction = 1; this->actionDelay = 120; this->direction = 0x10; @@ -545,11 +545,11 @@ void VaatiWrathType0ActionC(Entity* this) { default: sub_08042004(this); entity = ((VaatiWrathHeapStruct*)this->myHeap)->type1; - if (entity->frames.b.f0) { - entity->frames.all &= 0xfe; + if (entity->frame & 1) { + entity->frame &= 0xfe; InitAnimationForceUpdate(this, 9); } else { - if (entity->frames.b.f3 != 0) { + if (entity->frame & 0x80) { sub_0804235C(this); } } @@ -620,7 +620,7 @@ void sub_08041BE8(Entity* this) { void sub_08041CD0(Entity* this) { GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2); - if (this->frames.b.f3) { + if (this->frame & 0x80) { if (this->actionDelay != 0) { this->actionDelay--; } else { @@ -644,13 +644,13 @@ void sub_08041D14(Entity* this) { if (gEntCount < 0x46) { pEVar1 = CreateObject(OBJECT_B6, 0, 0); pEVar1->parent = this; - this->attachedEntity = pEVar1; + this->child = pEVar1; pEVar1 = CreateObject(OBJECT_B6, 1, 0); pEVar1->parent = this; this->subAction = 3; this->actionDelay = 0x96; this->field_0xf = 0; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; SoundReq(SFX_1C4); } } @@ -666,14 +666,14 @@ void sub_08041D84(Entity* this) { if ((0xb7 < this->field_0xf) && ((this->field_0xf & 7) == 0)) { sub_0801D2B4(((VaatiWrathHeapStruct*)this->myHeap)->type2, gUnk_080D0E80[(this->field_0xf - 0xb8) >> 3]); - sub_0801D2B4(this->attachedEntity, gUnk_080D0E80[(this->field_0xf - 0xb8) >> 3]); + sub_0801D2B4(this->child, gUnk_080D0E80[(this->field_0xf - 0xb8) >> 3]); } if (this->field_0xf == 0xe6) { DoFade(7, 4); } } else { this->subAction = 4; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_0801D2B4(this, 0x173); InitAnimationForceUpdate(this, 0xb); } @@ -802,7 +802,7 @@ u32 sub_08041FCC(Entity* this) { } void sub_08042004(Entity* this) { - this->height.HALF.HI = gUnk_080D0EA0[(++this->field_0x78.HALF.LO >> 4) & 7]; + this->z.HALF.HI = gUnk_080D0EA0[(++this->field_0x78.HALF.LO >> 4) & 7]; } void sub_08042028(Entity* this) { @@ -955,19 +955,19 @@ u32 sub_080422C0(Entity* this, u32 unk1) { GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2); type1 = ((VaatiWrathHeapStruct*)this->myHeap)->type1; GetNextFrame(type1); - if (unk1 + 1 == (tmp = type1->frames.all)) { + if (unk1 + 1 == (tmp = type1->frame)) { child = CreateProjectile(0x21); if (child != NULL) { child->type = unk1; child->parent = this; - type1->frames.all &= ~tmp; + type1->frame &= ~tmp; } } else { - if (type1->frames.all == 4) { - type1->frames.all &= 0xfb; + if (type1->frame == 4) { + type1->frame &= 0xfb; InitAnimationForceUpdate(this, 3); } else { - if ((type1->frames.b.f3) != 0) { + if (type1->frame & 0x80) { InitAnimationForceUpdate(this, 0); type1->subAction = 0; InitializeAnimation(type1, 0xc); @@ -1009,7 +1009,7 @@ void VaatiWrathType0PreAction(Entity* this) { if (temp >= 0) { if (gPlayerState.field_0x2c == NULL) { if (gPlayerEntity.field_0x7a.HWORD == 0) { - if ((gPlayerEntity.height.HALF.HI & 0x8000U) == 0 || (gPlayerState.field_0xa != 0)) { + if ((gPlayerEntity.z.HALF.HI & 0x8000U) == 0 || (gPlayerState.field_0xa != 0)) { sub_08078AA8(0xb70, 0); gScreenTransition.field_0x38 |= 2; } diff --git a/src/enemy/vaatiWrathEye.c b/src/enemy/vaatiWrathEye.c index f33e4009..d476ca6c 100644 --- a/src/enemy/vaatiWrathEye.c +++ b/src/enemy/vaatiWrathEye.c @@ -52,7 +52,7 @@ void VaatiWrathEyeAction0(Entity* this) { void VaatiWrathEyeAction1(Entity* this) { sub_080485D8(this); GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 2; InitializeAnimation(this, 1); } @@ -85,7 +85,7 @@ void VaatiWrathEyeAction3(Entity* this) { direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, x, y); this->direction = direction; sub_0806F69C(this); - this->height.HALF.HI = this->parent->height.HALF.HI; + this->z.HALF.HI = this->parent->z.HALF.HI; if ((this->x.HALF.HI == x) && (this->y.HALF.HI == y)) { this->action = 4; this->actionDelay = 0x3c; @@ -101,7 +101,7 @@ void VaatiWrathEyeAction4(Entity* this) { } } else { GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 5; this->actionDelay = 0; } @@ -111,12 +111,12 @@ void VaatiWrathEyeAction4(Entity* this) { void VaatiWrathEyeAction5(Entity* this) { if (this->actionDelay != 0) { this->action = 6; - if (this->parent->currentHealth >= 0x15) { + if (this->parent->health >= 0x15) { this->actionDelay = 120; } else { this->actionDelay = 0x3c; } - this->attachedEntity = NULL; + this->child = NULL; InitializeAnimation(this, 5); SoundReq(SFX_19B); } @@ -133,17 +133,17 @@ void VaatiWrathEyeAction6(Entity* this) { InitializeAnimation(this, 6); } } else { - if (this->frames.b.f3) { + if (this->frame & 0x80) { this->action = 7; this->actionDelay = 120; this->field_0xf = 0; } else { - if (this->frames.b.f0 != 0) { - this->frames.all &= 0xfe; + if (this->frame & 1) { + this->frame &= 0xfe; pEVar3 = CreateProjectile(0x24); if (pEVar3 != NULL) { pEVar3->parent = this; - this->attachedEntity = pEVar3; + this->child = pEVar3; PositionRelative(this, pEVar3, 0, 0xc0000); } } @@ -158,7 +158,7 @@ void VaatiWrathEyeAction7(Entity* this) { this->action = 8; this->actionDelay = 0x3c; COLLISION_OFF(this); - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; CreateFx(this, FX_REFLECT2, 0x40); this->parent->field_0x7a.HALF.HI |= 0x10 << this->type; } else { @@ -178,7 +178,7 @@ void VaatiWrathEyeAction8(Entity* this) { if (--this->actionDelay == 0) { this->action = 9; COLLISION_ON(this); - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 0); sub_080485FC(this); SoundReq(SFX_166); @@ -189,7 +189,7 @@ void VaatiWrathEyeAction8(Entity* this) { void VaatiWrathEyeAction9(Entity* this) { sub_080485FC(this); GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 4; this->actionDelay = 1; this->parent->field_0x7a.HALF.HI = (this->parent->field_0x7a.HALF.HI & 0xf) | (1 << this->type); @@ -208,5 +208,5 @@ void sub_080485FC(Entity* this) { ptr = &gUnk_080D1D98[this->type * 2]; sub_0806FA90(this->parent, this, ptr[0], ptr[1]); - this->height.HALF.HI = gUnk_080D1D78[this->type * 8 + (this->parent->field_0x78.HALF.LO >> 4 & 7)]; + this->z.HALF.HI = gUnk_080D1D78[this->type * 8 + (this->parent->field_0x78.HALF.LO >> 4 & 7)]; } diff --git a/src/enemy/wallMaster.c b/src/enemy/wallMaster.c index 7107cf9c..fdc73c5b 100644 --- a/src/enemy/wallMaster.c +++ b/src/enemy/wallMaster.c @@ -31,7 +31,7 @@ void sub_0802A454(Entity* this) { COLLISION_OFF(this); this->field_0x7c.HALF.HI = gPlayerEntity.x.HALF.HI; this->field_0x80.HWORD = gPlayerEntity.y.HALF.HI; - this->field_0x82.HWORD = gPlayerEntity.height.HALF.HI; + this->field_0x82.HWORD = gPlayerEntity.z.HALF.HI; if (this->action != 3) { InitializeAnimation(this, 1); } @@ -73,12 +73,12 @@ void sub_0802A534(Entity* this) { this->action = 2; this->actionDelay = 0x5a; COLLISION_ON(this); - this->spriteSettings.b.draw = 3; + this->spriteSettings.draw = 3; this->x.HALF.HI = ent->x.HALF.HI; this->y.HALF.HI = ent->y.HALF.HI; - this->height.HALF.HI = -0x80; + this->z.HALF.HI = -0x80; this->spritePriority.b1 = 1; - this->spriteSettings.b.shadow = 2; + this->spriteSettings.shadow = 2; InitializeAnimation(this, 2); sub_0802A7D0(this); } @@ -93,11 +93,11 @@ void sub_0802A5B8(Entity* this) { InitializeAnimation(this, 0); } } else { - this->height.HALF.HI += 3; - if (-1 < this->height.HALF.HI) { + this->z.HALF.HI += 3; + if (-1 < this->z.HALF.HI) { this->action = 3; - this->spriteSettings.b.draw = 1; - this->height.HALF.HI = 0; + this->spriteSettings.draw = 1; + this->z.HALF.HI = 0; InitializeAnimation(this, 1); } } @@ -109,23 +109,23 @@ void sub_0802A610(Entity* this) { GetNextFrame(this); sub_0802A7D0(this); - flags = this->frames.all & 0x80; + flags = this->frame & 0x80; if (flags) { this->action = 4; this->actionDelay = 0x1e; - } else if (this->frames.all & 1) { - this->frames.all = flags; + } else if (this->frame & 1) { + this->frame = flags; this->hitType = 0x75; } } void sub_0802A650(Entity* this) { sub_0802A7D0(this); - this->height.HALF.HI -= 2; - if (-0xa0 > this->height.HALF.HI) { + this->z.HALF.HI -= 2; + if (-0xa0 > this->z.HALF.HI) { this->action = 1; COLLISION_OFF(this); - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->hitType = 0x74; this->field_0x78.HWORD = this->field_0x7c.BYTES.byte0 * 0x3c; } @@ -139,26 +139,26 @@ void sub_0802A69C(Entity* this) { gPlayerState.field_0x1a[0] |= 0x80; gPlayerEntity.x.HALF.HI = this->field_0x7c.HALF.HI; gPlayerEntity.y.HALF.HI = this->field_0x80.HWORD; - gPlayerEntity.height.HALF.HI = this->field_0x82.HWORD; + gPlayerEntity.z.HALF.HI = this->field_0x82.HWORD; - if (gPlayerEntity.height.HALF.HI != this->height.HALF.HI) { - if (gPlayerEntity.height.HALF.HI < this->height.HALF.HI) { - this->height.HALF.HI--; + if (gPlayerEntity.z.HALF.HI != this->z.HALF.HI) { + if (gPlayerEntity.z.HALF.HI < this->z.HALF.HI) { + this->z.HALF.HI--; } else { - this->height.HALF.HI++; + this->z.HALF.HI++; } } /* sigh... */ GetNextFrame(this); - flags = this->frames.all & 0x80; + flags = this->frame & 0x80; if (flags) { this->action = 6; this->actionDelay = 0x1e; - } else if (this->frames.all & 0x1) { - this->frames.all = flags; + } else if (this->frame & 0x1) { + this->frame = flags; this->spriteOffsetY = 3; - gPlayerEntity.spriteSettings.b.draw = 0; + gPlayerEntity.spriteSettings.draw = 0; } } @@ -168,7 +168,7 @@ void sub_0802A734(Entity* this) { sub_0805E5A8(); DoExitTransition(gUnk_0813AB1C[gArea.regret]); } else { - this->height.WORD -= 0x20000; + this->z.WORD -= 0x20000; gPlayerState.field_0xa |= 0x80; gPlayerState.field_0x1a[0] |= 0x80; } diff --git a/src/enemy/wallMaster2.c b/src/enemy/wallMaster2.c index d21ca8a2..cde62fa1 100644 --- a/src/enemy/wallMaster2.c +++ b/src/enemy/wallMaster2.c @@ -55,9 +55,9 @@ void sub_0802CCE0(Entity* this) { this->action = 1; this->actionDelay = 60; this->field_0xf = Random(); - this->spriteSettings.b.shadow = 2; + this->spriteSettings.shadow = 2; this->animationState = 0xff; - this->height.HALF.HI = -2; + this->z.HALF.HI = -2; this->collisionLayer = 3; tmp = Random(); this->field_0x7a.HALF.LO = tmp; @@ -125,13 +125,13 @@ void sub_0802CE68(Entity* this) { } sub_0802CFD8(this); GetNextFrame(this); - frames = this->frames.all & 0x80; + frames = this->frame & 0x80; if (frames) { this->action = 4; this->actionDelay = 30; - } else if (this->frames.all & 1) { - this->frames.all = frames; - gPlayerEntity.spriteSettings.b.draw = 0; + } else if (this->frame & 1) { + this->frame = frames; + gPlayerEntity.spriteSettings.draw = 0; } } @@ -141,9 +141,9 @@ void sub_0802CEF4(Entity* this) { sub_0805E5A8(); DoExitTransition(gUnk_0813AB1C[gArea.regret]); } else { - this->height.WORD -= 0x20000; - if (this->height.HALF.HI < -0x30) { - this->spriteSettings.b.shadow = 1; + this->z.WORD -= 0x20000; + if (this->z.HALF.HI < -0x30) { + this->spriteSettings.shadow = 1; } gPlayerState.field_0xa |= 0x80; gPlayerState.field_0x1a[0] |= 0x80; diff --git a/src/enemy/waterDrop.c b/src/enemy/waterDrop.c index d32ae94e..96ff44c2 100644 --- a/src/enemy/waterDrop.c +++ b/src/enemy/waterDrop.c @@ -22,7 +22,7 @@ void sub_0802A250(Entity* this) { this->action = 1; this->actionDelay = 0; - this->hVelocity = -0x30000; + this->zVelocity = -0x30000; this->speed = gUnk_080CD03C[Random() & 3]; this->direction = gUnk_080CD040[Random() & 3] + 0x18; this->collisionLayer = 2; @@ -45,16 +45,16 @@ void sub_0802A2B4(Entity* this) { } sub_0802A39C(this); - if (-8 < this->height.HALF.HI) { + if (-8 < this->z.HALF.HI) { sub_0802A334(this); } } void sub_0802A2FC(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { DeleteEntity(this); - } else if (this->frames.all & 1) { + } else if (this->frame & 1) { COLLISION_OFF(this); } else { sub_0802A39C(this); diff --git a/src/enemy/wisp.c b/src/enemy/wisp.c index 734b47df..beb1ec43 100644 --- a/src/enemy/wisp.c +++ b/src/enemy/wisp.c @@ -34,7 +34,7 @@ void sub_08033564(Entity* this) { switch ((s32)bits & 0x3f) { case 0: this->action = 2; - this->spriteSettings.b.draw = FALSE; + this->spriteSettings.draw = FALSE; COLLISION_OFF(this); this->field_0x7c.HALF.LO = 0x27c; gPlayerState.flags |= 0x4000; @@ -47,15 +47,15 @@ void sub_08033564(Entity* this) { break; case 0xe: case 0x15: - this->currentHealth = 0; + this->health = 0; break; case 0x14: COLLISION_OFF(this); this->iframes = 0; - this->spriteSettings.b.draw = FALSE; + this->spriteSettings.draw = FALSE; ent = CreateFx(this, FX_DEATH, 0); if (ent != NULL) { - this->attachedEntity = ent; + this->child = ent; this->actionDelay = 0xe; CopyPosition(this, ent); } @@ -115,7 +115,7 @@ void sub_080336DC(Entity* this) { CreateDust(this); break; case 0xc: - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; break; case 0x0: this->action = 1; diff --git a/src/entity.c b/src/entity.c index ba3aa31b..9549a9e4 100644 --- a/src/entity.c +++ b/src/entity.c @@ -318,11 +318,11 @@ void DeleteEntity(Entity* ent) { sub_0804AA1C(ent); } COLLISION_OFF(ent); - ent->spriteSettings.b.draw = 0; + ent->spriteSettings.draw = 0; ent->field_0x3c = 0; ent->bitfield = 0; ent->knockbackDuration = 0; - ent->currentHealth = 0; + ent->health = 0; UnlinkEntity(ent); ent->next = NULL; ent->prev = (Entity*)0xffffffff; diff --git a/src/game.c b/src/game.c index aade535d..d6935aaa 100644 --- a/src/game.c +++ b/src/game.c @@ -270,7 +270,7 @@ void InitializePlayer(void) { switch (gScreenTransition.field_0xf) { case 0x2: case 0x6: - pl->height.HALF.HI = -0xc0; + pl->z.HALF.HI = -0xc0; break; case 0x4: gPlayerState.field_0x34[4] = 0x10; @@ -295,7 +295,7 @@ void InitializePlayer(void) { pl->kind = 1; pl->flags |= 0xa0; pl->spritePriority.b0 = 4; - pl->currentHealth = gSave.stats.health; + pl->health = gSave.stats.health; pl->x.HALF.HI = gScreenTransition.playerStartPos.HALF.x; pl->y.HALF.HI = gScreenTransition.playerStartPos.HALF.y; pl->animationState = gScreenTransition.playerState; @@ -354,7 +354,7 @@ s32 ModHealth(s32 deltaHealth) { newHealth = (u32)gStats.maxHealth; } gStats.health = newHealth; - gPlayerEntity.currentHealth = newHealth; + gPlayerEntity.health = newHealth; return newHealth; } diff --git a/src/interrupts.c b/src/interrupts.c index 680944e2..a7431d95 100644 --- a/src/interrupts.c +++ b/src/interrupts.c @@ -200,7 +200,7 @@ void PlayerUpdate(Entity* this) { } HandlePlayerLife(this); DoPlayerAction(this); - if ((this->height.WORD == 0) && (this->action == 1 || this->action == 9)) + if ((this->z.WORD == 0) && (this->action == 1 || this->action == 9)) sub_08008790(this, 8); sub_080171F0(); } diff --git a/src/intro.c b/src/intro.c index fc28094e..3404c931 100644 --- a/src/intro.c +++ b/src/intro.c @@ -168,8 +168,8 @@ static void HandleTitlescreen(void) { gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 9); gScreen.bg0.control = BGCNT_SCREENBASE(29) | BGCNT_PRIORITY(2); gScreen.bg1.control = 0x1E03; - gScreen.bg2.control = BGCNT_PRIORITY(1) | BGCNT_CHARBASE(2) | BGCNT_256COLOR | - BGCNT_SCREENBASE(28) | BGCNT_WRAP | BGCNT_TXT512x256; + gScreen.bg2.control = BGCNT_PRIORITY(1) | BGCNT_CHARBASE(2) | BGCNT_256COLOR | BGCNT_SCREENBASE(28) | + BGCNT_WRAP | BGCNT_TXT512x256; gScreen.lcd.displayControl |= DISPCNT_MODE_1; gScreen.lcd.displayControl |= DISPCNT_BG0_ON | DISPCNT_BG1_ON | DISPCNT_OBJ_ON; gIntroState.swordBgScaleRatio = 0x10; diff --git a/src/item/itemJarEmpty.c b/src/item/itemJarEmpty.c index 2b94db7c..a3658dab 100644 --- a/src/item/itemJarEmpty.c +++ b/src/item/itemJarEmpty.c @@ -36,7 +36,7 @@ void sub_08077534(ItemBehavior* this, u32 arg1) { case 0x2e: this->stateID = 3; gPlayerEntity.animationState = 4; - gPlayerEntity.spriteSettings.b.flipX = 0; + gPlayerEntity.spriteSettings.flipX = 0; sub_08077DF4(this, 0x2df); break; case 0x2f: diff --git a/src/item/itemMoleMitts.c b/src/item/itemMoleMitts.c index a30ef93a..4e528ce0 100644 --- a/src/item/itemMoleMitts.c +++ b/src/item/itemMoleMitts.c @@ -69,7 +69,7 @@ void sub_080771C8(ItemBehavior* this, u32 arg1) { object->actionDelay = this->field_0x5[2]; object->field_0xf = this->field_0x5[3]; object->animationState = gPlayerEntity.animationState & 6; - gPlayerEntity.frames.all = 0; + gPlayerEntity.frame = 0; gPlayerEntity.frameDuration = gUnk_0811BE14[this->field_0x5[3]]; } } else { diff --git a/src/item/itemOcarina.c b/src/item/itemOcarina.c index c84ac6b9..04dd84ea 100644 --- a/src/item/itemOcarina.c +++ b/src/item/itemOcarina.c @@ -21,7 +21,7 @@ void OcarinaUse(ItemBehavior* this, u32 arg1) { } else { this->field_0x5[4] |= 0xf; gPlayerEntity.animationState = 0x04; - gPlayerEntity.spriteSettings.b.flipX = 0; + gPlayerEntity.spriteSettings.flipX = 0; gPlayerEntity.flags &= 0x7f; gPlayerEntity.field_0x7a.HWORD = 2; gPlayerState.flags |= 0x10000000; diff --git a/src/item/itemRocsCape.c b/src/item/itemRocsCape.c index d718e610..56aa2947 100644 --- a/src/item/itemRocsCape.c +++ b/src/item/itemRocsCape.c @@ -17,12 +17,12 @@ extern bool32 sub_08077EFC(ItemBehavior*); if (((u8)(gPlayerState.field_0x1a[1] | gPlayerState.field_0xa | gPlayerState.field_0x3[1] | gPlayerState.heldObject | gPlayerState.field_0x1c | gPlayerState.field_0x3c[1]) == 0) && ((((1 < (u8)(gPlayerState.field_0x10[2] - 0x12) && (gPlayerState.field_0x10[2] != 1)) || - (gPlayerEntity.height.WORD != 0)) || + (gPlayerEntity.z.WORD != 0)) || (gPlayerState.field_0x14 != 0)))) { if ((gPlayerState.jumpStatus != 0) && ((gPlayerState.jumpStatus & 7) != 3)) goto _08076710; - if (-1 < gPlayerEntity.height.WORD) { - gPlayerEntity.hVelocity = 0x20000; + if (-1 < gPlayerEntity.z.WORD) { + gPlayerEntity.zVelocity = 0x20000; gPlayerState.jumpStatus = 1; gPlayerState.field_0x2c = NULL; this->stateID += 1; @@ -32,20 +32,20 @@ extern bool32 sub_08077EFC(ItemBehavior*); } else { if (((gPlayerState.heldObject | gPlayerState.field_0x3[1]) == 0) && (((gPlayerState.field_0x10[2] != 0x12 && (gPlayerState.field_0x10[2] != 1)) || - ((gPlayerEntity.height.WORD != 0 || (gPlayerState.field_0x14 != 0)))))) { + ((gPlayerEntity.z.WORD != 0 || (gPlayerState.field_0x14 != 0)))))) { if ((gPlayerState.jumpStatus != 0) && ((gPlayerState.jumpStatus & 7) != 3)) { _08076710: sub_08076758(this, arg1); return; } - if (-1 < gPlayerEntity.height.WORD) { + if (-1 < gPlayerEntity.z.WORD) { gPlayerState.field_0x0[1] = 0; this->stateID += 1; gPlayerState.keepFacing = 0; gPlayerState.jumpStatus = 1; gPlayerState.field_0xe = -1; gPlayerState.field_0x2c = NULL; - gPlayerEntity.hVelocity = 0x20000; + gPlayerEntity.zVelocity = 0x20000; _0807673C: sub_08077F84(); SoundReq(SFX_PLY_VO4); @@ -67,10 +67,10 @@ void sub_08076758(ItemBehavior* this, u32 arg1) { ((gPlayerState.jumpStatus & 7) != 3)) { if (sub_08077EFC(this)) { if (this->stateID < 2) { - if ((gPlayerEntity.hVelocity < 1) && ((gPlayerState.jumpStatus & 0x10) == 0)) { + if ((gPlayerEntity.zVelocity < 1) && ((gPlayerState.jumpStatus & 0x10) == 0)) { this->stateID = 2; gPlayerEntity.field_0x7a.HWORD = 2; - gPlayerEntity.hVelocity = 0x20000; + gPlayerEntity.zVelocity = 0x20000; gPlayerState.jumpStatus |= 0x10; gPlayerState.field_0x8 = 0x288; SoundReq(SFX_172); diff --git a/src/manager/manager1.c b/src/manager/manager1.c index f0fb5e49..037d5182 100644 --- a/src/manager/manager1.c +++ b/src/manager/manager1.c @@ -17,10 +17,10 @@ void Manager1_Main(Entity* this) { u8* pbVar2; gUnk_08107C5C[this->action](this); - gUnk_08107C48[((u8*)&this->hVelocity)[1]](this); - bVar1 = gUnk_08107C40[((u8*)&this->hVelocity)[1]]; - if ((bVar1 != 0) && (*(u8*)&this->hVelocity != bVar1)) { - ((u8*)&this->hVelocity)[0] = bVar1; + gUnk_08107C48[((u8*)&this->zVelocity)[1]](this); + bVar1 = gUnk_08107C40[((u8*)&this->zVelocity)[1]]; + if ((bVar1 != 0) && (*(u8*)&this->zVelocity != bVar1)) { + ((u8*)&this->zVelocity)[0] = bVar1; LoadGfxGroup(bVar1); } } @@ -28,9 +28,9 @@ void Manager1_Main(Entity* this) { void sub_080570B8(Entity* this) { u8* pbVar1; - LoadGfxGroup(((u8*)&this->hVelocity)[0]); - this->height.WORD = 0; - pbVar1 = ((u8*)&this->hVelocity + 1); + LoadGfxGroup(((u8*)&this->zVelocity)[0]); + this->z.WORD = 0; + pbVar1 = ((u8*)&this->zVelocity + 1); if (*pbVar1 == 3) { gScreen.bg3.updated = 1; } else { @@ -46,9 +46,9 @@ void sub_080570F8(void) { void sub_08057118(Entity* this) { this->actionDelay = 0; - *(u8*)&this->hVelocity = 0; - ((u8*)&this->hVelocity)[1] = 0; - ((u8*)&this->hVelocity)[2] = 0; + *(u8*)&this->zVelocity = 0; + ((u8*)&this->zVelocity)[1] = 0; + ((u8*)&this->zVelocity)[2] = 0; this->action = 1; gScreen.bg3.control = 0x1e04; gScreen.lcd.displayControl |= 0x800; diff --git a/src/manager/manager15.c b/src/manager/manager15.c index 02cf723f..92585bc4 100644 --- a/src/manager/manager15.c +++ b/src/manager/manager15.c @@ -295,7 +295,7 @@ void sub_0805A758(Manager15* this) { } void sub_0805A76C(Manager15* this) { - if ((gPlayerEntity.currentHealth != 0) && (gPlayerEntity.height.HALF.HI == 0) && (!gPlayerState.field_0x2c)) { + if ((gPlayerEntity.health != 0) && (gPlayerEntity.z.HALF.HI == 0) && (!gPlayerState.field_0x2c)) { switch (gPlayerState.field_0xa9) { case 1: case 0: diff --git a/src/manager/manager1C.c b/src/manager/manager1C.c index bb151f8f..cadaec86 100644 --- a/src/manager/manager1C.c +++ b/src/manager/manager1C.c @@ -27,7 +27,7 @@ void sub_0805B55C(Manager* manager) { if (waterDrop != NULL) { waterDrop->x.HALF.HI = gRoomControls.roomScrollX + 0x78 + gUnk_08108C6C[Random() & 7]; waterDrop->y.HALF.HI = gRoomControls.roomScrollY + 0x50 + gUnk_08108C7C[Random() & 3]; - waterDrop->height.HALF.HI = 0xff38; + waterDrop->z.HALF.HI = 0xff38; } } } diff --git a/src/manager/manager2C.c b/src/manager/manager2C.c index 3c578661..08865658 100644 --- a/src/manager/manager2C.c +++ b/src/manager/manager2C.c @@ -19,7 +19,7 @@ void Manager2C_Main(Manager2C* manager) { manager->field_0x3a = 0; } if (((CheckPlayerInRegion(manager->field_0x38, manager->field_0x3a, 0x14, 0x40) != 0) && - (((gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY) + gPlayerEntity.height.HALF.HI) < 0)) && + (((gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY) + gPlayerEntity.z.HALF.HI) < 0)) && (gRoomControls.roomScrollY == gRoomControls.roomOriginY)) { MemClear(&gScreenTransition.areaID, 0x20); gScreenTransition.transitioningOut = 1; diff --git a/src/manager/manager33.c b/src/manager/manager33.c index 3ed92fc2..7dbf75b4 100644 --- a/src/manager/manager33.c +++ b/src/manager/manager33.c @@ -11,7 +11,7 @@ void Manager33_Main(Manager* this) { u32 b = roomControls->roomOriginY + 0x140; u32 y = (b - gPlayerEntity.y.HALF.HI) + 0x10; if (this->action == 0) { - if (x < 0x20 && y < 0x20 && gPlayerEntity.height.HALF.HI < -0x18 && gPlayerState.field_0xa8 == 0x14) { + if (x < 0x20 && y < 0x20 && gPlayerEntity.z.HALF.HI < -0x18 && gPlayerState.field_0xa8 == 0x14) { this->action += 1; this->unk_0e = 0x5a; SoundReq(SFX_10A); @@ -22,7 +22,7 @@ void Manager33_Main(Manager* this) { if (object != NULL) { object->x.HALF.HI = roomControls->roomOriginX + 0x1f8; object->y.HALF.HI = roomControls->roomOriginY + 0x140; - object->height.HALF.HI = 0xffe8; + object->z.HALF.HI = 0xffe8; } DeleteThisEntity(); } diff --git a/src/manager/manager37.c b/src/manager/manager37.c index c05425b0..270b8162 100644 --- a/src/manager/manager37.c +++ b/src/manager/manager37.c @@ -71,7 +71,7 @@ void sub_0805DEB8(Manager* this) { void sub_0805DF4C(Manager* this) { gPlayerEntity.animationState = 0; - if (gPlayerEntity.height.HALF.HI != 0) { + if (gPlayerEntity.z.HALF.HI != 0) { if (gPlayerEntity.y.HALF.HI < (gRoomControls.roomOriginY + 0x48)) { gPlayerEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x48; } diff --git a/src/manager/manager6.c b/src/manager/manager6.c index d2a8fc66..3840dca5 100644 --- a/src/manager/manager6.c +++ b/src/manager/manager6.c @@ -19,8 +19,7 @@ void Manager6_Main(Manager6* this) { tmp = (i->unk_07.all & 0x3); if (((tmp & (gPlayerEntity.collisionLayer)) != 0) && (((gPlayerState.flags & 0x80) != 0) || ((i->unk_07.b.unk2) != 0)) && - (CheckPlayerInRegion(i->posX, i->posY, i->width, i->height) != 0) && - (gPlayerEntity.height.HALF.HI == 0)) { + (CheckPlayerInRegion(i->posX, i->posY, i->width, i->height) != 0) && (gPlayerEntity.z.HALF.HI == 0)) { DoExitTransition(GetCurrentRoomProperty(i->unk_06)); } } diff --git a/src/manager/managerA.c b/src/manager/managerA.c index 6003f891..e2469dc8 100644 --- a/src/manager/managerA.c +++ b/src/manager/managerA.c @@ -120,7 +120,7 @@ void sub_08058514(ManagerA* this) { case 1: if ((gPlayerState.flags & 0x1235) != 0) return; - if (gPlayerEntity.height.HALF.HI != 0) + if (gPlayerEntity.z.HALF.HI != 0) return; gPlayerState.jumpStatus = 0; sub_08078AA8(this->unk_36, this->unk_35); diff --git a/src/manager/managerC.c b/src/manager/managerC.c index abcb9914..126186e3 100644 --- a/src/manager/managerC.c +++ b/src/manager/managerC.c @@ -155,7 +155,7 @@ void sub_08058A04(ManagerC* this) { s32 tmp = gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX; s32 tmp2 = gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY; if ((this->unk_20 - 0x118 < 0xDu) && CheckGlobalFlag(LV1TARU_OPEN) && (tmp - 0x6d < 0x17u) && - (tmp2 - 0x45 < 0x17u) && (gPlayerEntity.height.HALF.HI == 0)) { + (tmp2 - 0x45 < 0x17u) && (gPlayerEntity.z.HALF.HI == 0)) { gPlayerState.playerAction = 3; gPlayerState.field_0x38 = 0; gPlayerEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x78; diff --git a/src/npc.c b/src/npc.c index 10edf4ce..328ce1af 100644 --- a/src/npc.c +++ b/src/npc.c @@ -151,7 +151,7 @@ u32 ReadBit(void*, u32); // regalloc NONMATCH("asm/non_matching/arm_proxy/NPCUpdate.inc", void NPCUpdate(Entity* this)) { - if ((this->currentHealth & 0x7f) && !ReadBit(&gUnk_020342F8, this->currentHealth - 1)) + if ((this->health & 0x7f) && !ReadBit(&gUnk_020342F8, this->health - 1)) DeleteThisEntity(); if (this->action == 0 && (this->flags & ENT_DID_INIT) == 0) InitNPC(this); @@ -160,8 +160,8 @@ NONMATCH("asm/non_matching/arm_proxy/NPCUpdate.inc", void NPCUpdate(Entity* this if (this->next != NULL) { if (gNPCFunctions[this->id][1] != NULL) gNPCFunctions[this->id][1](this); - if ((this->currentHealth & 0x7f) != 0) { - u32 temp = this->currentHealth & 0x7f; + if ((this->health & 0x7f) != 0) { + u32 temp = this->health & 0x7f; gUnk_02031EC0[temp * 2 - 2].x = this->x.HALF.HI - gRoomControls.roomOriginX; gUnk_02031EC0[temp * 2 - 2].y = this->y.HALF.HI - gRoomControls.roomOriginY; } diff --git a/src/npc/anju.c b/src/npc/anju.c index e0fb08c8..b7262d24 100644 --- a/src/npc/anju.c +++ b/src/npc/anju.c @@ -9,7 +9,7 @@ void Anju(Entity* this) { switch (this->action) { case 0: this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->animationState = this->actionDelay; sub_0807DD50(this); return; @@ -39,7 +39,7 @@ void sub_0806C354(Entity* this) { void Anju_Fusion(Entity* this) { if (this->action == 0) { this->action++; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 6); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/beedle.c b/src/npc/beedle.c index 55d54a01..73f14f41 100644 --- a/src/npc/beedle.c +++ b/src/npc/beedle.c @@ -41,7 +41,7 @@ void sub_080632E0(Entity* this) { if (LoadExtraSpriteData(this, &gUnk_0810C8D4) != 0) { InitializeAnimation(this, 0); sub_08078778(this); - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->action = 1; } } @@ -68,7 +68,7 @@ void sub_0806336C(Entity* this) { void sub_08063390(Entity* this) { GetNextFrame(this); - if (this->frames.b.f3 != 0) { + if (this->frame & 0x80) { this->action = 1; InitializeAnimation(this, GetAnimationState(this)); sub_08078778(this); @@ -87,7 +87,7 @@ s32 sub_080633C8(Entity* this) { } void Beedle_Head(Entity* this) { - SetExtraSpriteFrame(this, 0, this->frames.all & 0x3F); + SetExtraSpriteFrame(this, 0, this->frame & 0x3F); SetExtraSpriteFrame(this, 1, this->frameIndex); SetSpriteSubEntryOffsetData1(this, 1, 0); sub_0807000C(this); diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index 234a3f7c..cae552e7 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -130,7 +130,7 @@ void sub_0806D1D0(Entity* this) { this->spriteOrientation.flipY = 3; this->spriteRendering.b3 = 3; this->spritePriority.b0 = 7; - this->spriteSettings.b.draw = 3; + this->spriteSettings.draw = 3; this->frameIndex = 0; this->actionDelay = 0x1e; sub_0805E3A0(this, 2); @@ -154,7 +154,7 @@ void sub_0806D1D0(Entity* this) { this->frameIndex = this->subAction; break; case 2: - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; break; } this->x.HALF.HI = this->parent->x.HALF.HI; @@ -177,7 +177,7 @@ void sub_0806D274(Entity* this) { sub_0805E3A0(this, 2); npc = CreateNPC(0x4c, 3, 0); if (npc != NULL) { - npc->attachedEntity = this; + npc->child = this; } } switch (this->subAction) { @@ -219,14 +219,14 @@ void sub_0806D348(Entity* this) { this->spriteOrientation.flipY = 3; this->spriteRendering.b3 = 3; this->spritePriority.b0 = 6; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->frameIndex = 5; sub_0805E3A0(this, 2); } - if (this->attachedEntity->frameIndex == 4) { - this->spriteSettings.b.draw = 3; + if (this->child->frameIndex == 4) { + this->spriteSettings.draw = 3; } else { - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } this->x.HALF.HI = this->parent->x.HALF.HI; this->y.HALF.HI = this->parent->y.HALF.HI; @@ -249,7 +249,7 @@ void sub_0806D3C0(Entity* this) { } void sub_0806D40C(Entity* this) { - this->spriteSettings.b.flipX = 1; + this->spriteSettings.flipX = 1; sub_0806D41C(this); } @@ -376,7 +376,7 @@ void sub_0806D70C(void) { entity = FindEntity(7, 0x4c, 7, 1, 0); if (entity != NULL) { entity->subAction = 0; - entity->spriteSettings.b.draw = 3; + entity->spriteSettings.draw = 3; } } diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c index d6069c99..c4e2b4ab 100644 --- a/src/npc/bladeBrothers.c +++ b/src/npc/bladeBrothers.c @@ -41,8 +41,8 @@ void BladeBrothers(Entity* this) { gUnk_081115C0[this->action](this); sub_0806ED78(this); } - if ((this->frames.all & 1) != 0) { - this->frames.all &= 0xfe; + if ((this->frame & 1) != 0) { + this->frame &= 0xfe; sub_08068BEC(this, 0); } } @@ -114,7 +114,7 @@ void sub_08068ADC(Entity* this) { void sub_08068AFC(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x68.HALF.LO = sub_0801E99C(this); sub_08078784(this, this->field_0x68.HALF.LO); sub_0807DD50(this); @@ -388,14 +388,14 @@ void sub_08068F3C(Entity* this) { void BladeBrothers_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 0; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 0; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 4); } else { UpdateAnimationSingleFrame(this); } - if ((this->frames.all & 1) != 0) { - this->frames.all &= 0xfe; + if ((this->frame & 1) != 0) { + this->frame &= 0xfe; sub_08068BEC(this, 0); } } diff --git a/src/npc/brocco.c b/src/npc/brocco.c index e38053fa..bf00088d 100644 --- a/src/npc/brocco.c +++ b/src/npc/brocco.c @@ -26,7 +26,7 @@ void sub_08063544(Entity* this) { void sub_0806355C(Entity* this) { this->action = this->action + 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 4); sub_08078778(this); } @@ -46,7 +46,7 @@ void sub_0806362C(Entity* this) { switch (this->action) { case 0: this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x68.HALF.HI = 0; sub_0807DD64(this); case 1: @@ -84,7 +84,7 @@ void sub_080636F4(Entity* this) { void Brocco_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->y.HALF.HI -= 4; InitAnimationForceUpdate(this, 2); } else { diff --git a/src/npc/carlov.c b/src/npc/carlov.c index 92d632ed..f095fe1e 100644 --- a/src/npc/carlov.c +++ b/src/npc/carlov.c @@ -12,13 +12,13 @@ void Carlov(Entity* this) { } else { sub_0807DD94(this, 0); } - if ((this->frames.all & 0x10) != 0) { - this->frames.all = this->frames.all & 0xef; + if ((this->frame & 0x10) != 0) { + this->frame = this->frame & 0xef; EnqueueSFX(0x104); sub_08080964(0x10, 0); } - if ((this->frames.all & 0x20) != 0) { - this->frames.all = this->frames.all & 0xdf; + if ((this->frame & 0x20) != 0) { + this->frame = this->frame & 0xdf; EnqueueSFX(0x7c); } } diff --git a/src/npc/carpenter.c b/src/npc/carpenter.c index aa070e14..5369ca96 100644 --- a/src/npc/carpenter.c +++ b/src/npc/carpenter.c @@ -52,14 +52,14 @@ void Carpenter(Entity* this) { void Carpenter_Head(Entity* this) { if (this->type < 2) { - SetExtraSpriteFrame(this, 0, this->frames.all & 0xffffff7f); + SetExtraSpriteFrame(this, 0, this->frame & 0xffffff7f); SetExtraSpriteFrame(this, 1, this->frameIndex); SetExtraSpriteFrame(this, 2, this->frameSpriteSettings & 0x3f); SetSpriteSubEntryOffsetData1(this, 1, 0); SetSpriteSubEntryOffsetData2(this, 1, 2); sub_0807000C(this); } else { - SetExtraSpriteFrame(this, 0, this->frames.all & 0xffffff7f); + SetExtraSpriteFrame(this, 0, this->frame & 0xffffff7f); SetExtraSpriteFrame(this, 1, this->frameIndex); SetSpriteSubEntryOffsetData1(this, 1, 0); sub_0807000C(this); @@ -93,7 +93,7 @@ void Carpenter_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_08110CA8[this->type * 4]) != 0) { this->action = this->action + 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_0805E3A0(this, 2); InitializeAnimation(this, (u32)this->type * 8 + 2); } diff --git a/src/npc/castleMaid.c b/src/npc/castleMaid.c index bf2289c8..e334450d 100644 --- a/src/npc/castleMaid.c +++ b/src/npc/castleMaid.c @@ -26,14 +26,14 @@ void Maid_Head(Entity* this) { u32 uVar2; u32 uVar3; - uVar2 = this->frames.all & 0x7f; + uVar2 = this->frame & 0x7f; uVar3 = this->frameIndex; if (this->id == 0x16) { - if ((this->frames.all & 0x7f) != 0) { + if ((this->frame & 0x7f) != 0) { uVar2 += 10; } } else { - if ((this->frames.all & 0x7f) != 0) { + if ((this->frame & 0x7f) != 0) { uVar2 += 0x1a; } uVar3 += 0x10; diff --git a/src/npc/castorWildsStatue.c b/src/npc/castorWildsStatue.c index 390e86a1..5bbeb15b 100644 --- a/src/npc/castorWildsStatue.c +++ b/src/npc/castorWildsStatue.c @@ -123,7 +123,7 @@ ASM_FUNC("asm/non_matching/castorWildsStatue/sub_080676E0.inc", void CastorWildsStatue_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->y.HALF.HI -= 0x18; InitializeAnimation(this, 1); sub_0801D2B4(this, 0x17b); diff --git a/src/npc/cat.c b/src/npc/cat.c index 7a49b5ce..d68129e2 100644 --- a/src/npc/cat.c +++ b/src/npc/cat.c @@ -62,7 +62,7 @@ void sub_080677EC(Entity* this) { u8 bVar1; u32 uVar2; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->direction = 8; this->speed = 0x80; this->field_0x3c = 7; @@ -71,9 +71,9 @@ void sub_080677EC(Entity* this) { this->flags2 = 1; this->field_0x68.HALF.HI = 0xff; if (this->x.HALF.HI < gPlayerEntity.x.HALF.HI) { - this->spriteSettings.b.flipX = 1; + this->spriteSettings.flipX = 1; } else { - this->spriteSettings.b.flipX = 0; + this->spriteSettings.flipX = 0; } this->field_0x68.HALF.LO = sub_0801E99C(this); @@ -105,11 +105,11 @@ void sub_080678AC(Entity* this) { if (*psVar2 != 0) { *psVar2 = *psVar2 - 1; } - if ((this->frames.all == 1) && (*psVar2 == 0)) { + if ((this->frame == 1) && (*psVar2 == 0)) { sub_08067AAC(this); } else { UpdateAnimationSingleFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { sub_08067B34(this); } } @@ -130,12 +130,12 @@ void sub_08067904(Entity* this) { if (this->direction == 8) { if (this->x.HALF.HI > this->field_0x6e.HWORD) { this->direction = 0x18; - this->spriteSettings.b.flipX = 0; + this->spriteSettings.flipX = 0; } } else { if (this->x.HALF.HI < this->field_0x6c.HWORD) { this->direction = 8; - this->spriteSettings.b.flipX = 1; + this->spriteSettings.flipX = 1; } } sub_0806F69C(this); @@ -144,7 +144,7 @@ void sub_08067904(Entity* this) { void sub_0806797C(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frames.b.f3 != 0) { + if (this->frame & 0x80) { sub_08067B08(this); } } @@ -173,7 +173,7 @@ void sub_08067A0C(Entity* this) { u8 tmp; UpdateAnimationSingleFrame(this); - if (this->frames.b.f3 != 0) { + if (this->frame & 0x80) { if (sub_08067D20(this) != 0) { sub_08067B80(this, 5); this->actionDelay = this->actionDelay + 0x14; @@ -181,10 +181,10 @@ void sub_08067A0C(Entity* this) { sub_08067C24(this); } } else { - tmp = (this->frames.all & 7); + tmp = (this->frame & 7); if (tmp != 0) { COLLISION_ON(this); - this->hitbox = gUnk_08111154[tmp - 1 + ((this->spriteSettings.b.flipX << 2))]; + this->hitbox = gUnk_08111154[tmp - 1 + ((this->spriteSettings.flipX << 2))]; } else { sub_08067DDC(this); } @@ -193,7 +193,7 @@ void sub_08067A0C(Entity* this) { void sub_08067A78(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frames.b.f3 != 0) { + if (this->frame & 0x80) { sub_08067AAC(this); } } @@ -208,7 +208,7 @@ void sub_08067AAC(Entity* this) { this->action = 2; this->field_0x70.HALF.HI = gUnk_081110FC[(Random() & 3)]; - this->spriteSettings.b.flipX = this->direction >> 4 ^ 1; + this->spriteSettings.flipX = this->direction >> 4 ^ 1; sub_08067DCC(this, 3); sub_08078850(this, 0, gUnk_0811110C[2], &gUnk_0811110F); @@ -223,7 +223,7 @@ void sub_08067B08(Entity* this) { void sub_08067B34(Entity* this) { sub_08067DCC(this, 0); this->frameDuration = (Random() & 0x30) + 0xb4; - sub_08078850(this, 0, gUnk_0811110C[this->spriteSettings.b.flipX], &gUnk_0811110F); + sub_08078850(this, 0, gUnk_0811110C[this->spriteSettings.flipX], &gUnk_0811110F); } void sub_08067B70(Entity* this) { @@ -238,20 +238,20 @@ void sub_08067B80(Entity* this, u32 param) { InitAnimationForceUpdate(this, param); sub_08067DDC(this); if (this->x.HALF.HI < gPlayerEntity.x.HALF.HI) { - this->spriteSettings.b.flipX = 1; + this->spriteSettings.flipX = 1; } else { - this->spriteSettings.b.flipX = 0; + this->spriteSettings.flipX = 0; } } void sub_08067BD4(Entity* this) { - if (this->spriteSettings.b.flipX > 0) { + if (this->spriteSettings.flipX > 0) { if (this->x.HALF.HI - 4 > gPlayerEntity.x.HALF.HI) { - this->spriteSettings.b.flipX = 0; + this->spriteSettings.flipX = 0; } } else { if (this->x.HALF.HI + 4 < gPlayerEntity.x.HALF.HI) { - this->spriteSettings.b.flipX = 1; + this->spriteSettings.flipX = 1; } } } @@ -299,10 +299,10 @@ void sub_08067C44(Entity* this) { break; case 3: if (iVar4 == 1) { - this->spriteSettings.b.flipX = 1; + this->spriteSettings.flipX = 1; } else { - if (this->spriteSettings.b.flipX == 3) { // TODO 3 ??? - this->spriteSettings.b.flipX = 0; + if (this->spriteSettings.flipX == 3) { // TODO 3 ??? + this->spriteSettings.flipX = 0; } } if (iVar4 != 2) { @@ -334,12 +334,7 @@ u32 sub_08067D20(Entity* this) { } else { entity = sub_08049DF4(2); if (entity != NULL) { - tmp = this->spriteSettings.raw * 0x2000000; // TODO maybe convert to ternary? - iVar4 = 0x28; - if (tmp < 0) { - iVar4 = 0x10; - } - + iVar4 = this->spriteSettings.flipX ? 0x10 : 0x28; if (((u32)(entity->x.HALF.HI - (this->x.HALF.HI - iVar4)) < 0x31) && ((((u32)entity->y.HALF.HI) - (this->y.HALF.HI - 4)) < 0x39)) { return 1; @@ -360,11 +355,7 @@ u32 sub_08067D74(Entity* this) { } entity = sub_08049DF4(2); if (entity != NULL) { - tmp = (this->spriteSettings.raw * 0x2000000); // TODO convert to ternary? - iVar2 = 0x18; - if (tmp < 0) { - iVar2 = 8; - } + iVar2 = this->spriteSettings.flipX ? 0x8 : 0x18; if ((((u32)(entity->x.HALF.HI - (this->x.HALF.HI - iVar2)) < 0x1f) && ((u32)(entity->y.HALF.HI - this->y.HALF.HI) < 0x17)) && (this->actionDelay == 0)) { @@ -390,7 +381,7 @@ void sub_08067DDC(Entity* this) { void Cat_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 5); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/cow.c b/src/npc/cow.c index 0a1ec389..c1f2c319 100644 --- a/src/npc/cow.c +++ b/src/npc/cow.c @@ -142,16 +142,16 @@ void sub_08069148(Entity* ent) { } void sub_08069168(Entity* ent) { - if ((s8)ent->frames.all < 0) { + if ((s8)ent->frame < 0) { ent->subAction = 2; InitAnimationForceUpdate(ent, ent->animationState + 12); } } void sub_08069188(Entity* ent) { - if (ent->frames.b.f0 == 0) + if ((ent->frame & 1) == 0) return; - ent->frames.all = 0; + ent->frame = 0; if (((s8)--ent->field_0xf) != 0) return; @@ -160,7 +160,7 @@ void sub_08069188(Entity* ent) { } void sub_080691BC(Entity* ent) { - if ((s8)ent->frames.all < 0) { + if ((s8)ent->frame < 0) { ent->action = 1; ent->subAction = 0; InitAnimationForceUpdate(ent, ent->animationState + 4); @@ -219,7 +219,7 @@ void sub_0806924C(Entity* ent) { void Cow_Fusion(Entity* ent) { if (ent->action == 0) { ent->action++; - ent->spriteSettings.b.draw = 1; + ent->spriteSettings.draw = 1; InitAnimationForceUpdate(ent, 15); } else { UpdateAnimationSingleFrame(ent); diff --git a/src/npc/cucco.c b/src/npc/cucco.c index 37d3efb4..5e24aa88 100644 --- a/src/npc/cucco.c +++ b/src/npc/cucco.c @@ -79,7 +79,7 @@ ASM_FUNC("asm/non_matching/cucco/sub_0806E6A8.inc", void sub_0806E6A8(Entity* th void Cucco_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 1); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/cuccoChick.c b/src/npc/cuccoChick.c index faf90f6e..c8ba2951 100644 --- a/src/npc/cuccoChick.c +++ b/src/npc/cuccoChick.c @@ -75,11 +75,11 @@ void sub_0806E884(Entity* this) { void CuccoChick_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->frameIndex = 1; } else { if (sub_08003FC4(this, 0x3000) == 0) { - this->hVelocity = 0x10000; + this->zVelocity = 0x10000; } } } diff --git a/src/npc/dampe.c b/src/npc/dampe.c index f42e3cce..a69f9efa 100644 --- a/src/npc/dampe.c +++ b/src/npc/dampe.c @@ -15,7 +15,7 @@ void Dampe(Entity* this) { switch (this->action) { case 0: this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_0805E3A0(this, 2); sub_0807DD50(this); return; @@ -45,7 +45,7 @@ void sub_0806BE3C(Entity* this) { void Dampe_Fusion(Entity* this) { if (this->action == 0) { this->action++; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 2); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/din.c b/src/npc/din.c index d17d1dea..4a2d5e5f 100644 --- a/src/npc/din.c +++ b/src/npc/din.c @@ -9,7 +9,7 @@ void Din(Entity* this) { switch (this->action) { case 0: this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_0807DD50(this); break; case 1: @@ -43,7 +43,7 @@ void sub_08064828(Entity* this) { void Din_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 6); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/dog.c b/src/npc/dog.c index 7f312ff4..58245d8d 100644 --- a/src/npc/dog.c +++ b/src/npc/dog.c @@ -123,7 +123,7 @@ void sub_08069D00(Entity* this) { this->field_0x6a.HALF.HI = 8; sub_0806A028(this); if (0x1f < this->animIndex) { - if ((this->frames.all & 0x80) == 0) { + if ((this->frame & 0x80) == 0) { return; } this->field_0x6a.HALF.HI = 8; @@ -201,7 +201,7 @@ void sub_08069E50(Entity* this) { sub_0806A028(this); UpdateAnimationSingleFrame(this); if (this->animIndex > 0x1f) { - if ((this->frames.all & 0x80) == 0) { + if ((this->frame & 0x80) == 0) { return; } this->field_0x6a.HALF.HI = 8; @@ -252,7 +252,7 @@ u32 sub_08069EF0(Entity* this) { void Dog_Head(Entity* this) { u32 frame; - frame = this->frames.all & 0xffffff7f; + frame = this->frame & 0xffffff7f; if (frame != 0) { frame = frame + this->field_0x68.HWORD; } @@ -386,7 +386,7 @@ void Dog_Fusion(Entity* this) { if (this->action == 0) { if (sub_08069EF0(this) != 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_0805E3A0(this, 2); InitializeAnimation(this, 0x23); } diff --git a/src/npc/drLeft.c b/src/npc/drLeft.c index 9a99a651..d10d99b1 100644 --- a/src/npc/drLeft.c +++ b/src/npc/drLeft.c @@ -45,7 +45,7 @@ void sub_0806BFD8(Entity* this) { } void sub_0806C00C(Entity* this, ScriptExecutionContext* context) { - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { context->condition = 1; } else { context->condition = 0; diff --git a/src/npc/epona.c b/src/npc/epona.c index 4c0abc0f..d7bd6820 100644 --- a/src/npc/epona.c +++ b/src/npc/epona.c @@ -20,7 +20,7 @@ void Epona(Entity* this) { void sub_080659B8(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->animationState = 6; this->field_0x68.HALF.HI = -1; this->field_0x68.HALF.LO = sub_0801E99C(this); @@ -93,7 +93,7 @@ void sub_08065AA4(Entity* this) { void Epona_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 7); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/ezloCap.c b/src/npc/ezloCap.c index 3133fc00..4eca8f35 100644 --- a/src/npc/ezloCap.c +++ b/src/npc/ezloCap.c @@ -28,7 +28,7 @@ void sub_0806D8A0(Entity* this, ScriptExecutionContext* context) { context->postScriptActions |= 2; context->condition = 0; xOffset = 16; - if (this->spriteSettings.b.flipX) { + if (this->spriteSettings.flipX) { xOffset = -xOffset; } xOffset += gPlayerEntity.x.HALF.HI; @@ -48,9 +48,9 @@ void sub_0806D908(Entity* this) { // called when talk to ezlo, also when ezlo moves after you void sub_0806D944(Entity* this) { - this->spriteSettings.b.flipX = 0; + this->spriteSettings.flipX = 0; if (this->x.WORD <= gPlayerEntity.x.WORD) { - this->spriteSettings.b.flipX = 1; + this->spriteSettings.flipX = 1; } } @@ -65,9 +65,9 @@ void sub_0806D96C(Entity* this) { void sub_0806D9A4(Entity* this) { if (this->x.WORD <= gPlayerEntity.x.WORD) { - gPlayerEntity.spriteSettings.b.flipX = 0; + gPlayerEntity.spriteSettings.flipX = 0; } else { - gPlayerEntity.spriteSettings.b.flipX = 1; + gPlayerEntity.spriteSettings.flipX = 1; } gPlayerEntity.animationState = 4; } diff --git a/src/npc/farmers.c b/src/npc/farmers.c index 434f494f..88ea6005 100644 --- a/src/npc/farmers.c +++ b/src/npc/farmers.c @@ -16,14 +16,14 @@ void sub_0806BC58(Entity* this) { } void Farmers_Head(Entity* this) { - SetExtraSpriteFrame(this, 0, this->frames.all & 0x7f); + SetExtraSpriteFrame(this, 0, this->frame & 0x7f); SetExtraSpriteFrame(this, 1, this->frameIndex); SetSpriteSubEntryOffsetData1(this, 1, 0); sub_0807000C(this); } void sub_0806BC94(Entity* this, ScriptExecutionContext* context) { - InitializeAnimation(this, context->intVariable + (BOOLCAST(this->spriteSettings.b.flipX) & 8U) + + InitializeAnimation(this, context->intVariable + (BOOLCAST(this->spriteSettings.flipX) & 8U) + (this->animationState >> 1)); } @@ -50,8 +50,8 @@ void Farmers_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_08113140[this->type * 3]) != 0) { this->action = this->action + 1; - this->spriteSettings.b.draw = 1; - this->spriteSettings.b.flipX = 0; + this->spriteSettings.draw = 1; + this->spriteSettings.flipX = 0; sub_0806BC58(this); InitAnimationForceUpdate(this, 3); } diff --git a/src/npc/farore.c b/src/npc/farore.c index 8629827a..a19d1599 100644 --- a/src/npc/farore.c +++ b/src/npc/farore.c @@ -11,7 +11,7 @@ void Farore(Entity* this) { switch (this->action) { case 0: this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_0807DD50(this); break; case 1: @@ -45,7 +45,7 @@ void sub_08064A28(Entity* this) { void Farore_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 6); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/festari.c b/src/npc/festari.c index 4d63805f..4a1a6492 100644 --- a/src/npc/festari.c +++ b/src/npc/festari.c @@ -17,7 +17,7 @@ void Festari(Entity* this) { void sub_0805FE10(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; sub_0805E3A0(this, 2); this->field_0x68.HALF.LO = sub_0801E99C(this); sub_08078784(this, this->field_0x68.HALF.LO); @@ -52,7 +52,7 @@ void sub_0805FE48(Entity* this) { } UpdateAnimationSingleFrame(this); - if (this->frames.b.f3) { + if (this->frame & 0x80) { switch (this->animIndex) { case 8: case 10: @@ -112,7 +112,7 @@ void sub_0805FF2C(Entity* this, ScriptExecutionContext* context) { void Festari_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_0805E3A0(this, 2); InitAnimationForceUpdate(this, 8); } else { diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c index 48c5f42d..366132c5 100644 --- a/src/npc/forestMinish.c +++ b/src/npc/forestMinish.c @@ -29,7 +29,7 @@ void ForestMinish(Entity* this) { case 0: if (LoadExtraSpriteData(this, &gUnk_0810A348)) { this->action = 1; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; this->field_0x68.HALF.HI = this->animationState = this->actionDelay << 1; this->actionDelay = 0; sub_0805E3A0(this, 2); @@ -65,8 +65,8 @@ void sub_08060090(Entity* this) { void ForestMinish_Head(Entity* this) { u32 pbVar1; - pbVar1 = this->frames.all; - if (this->frames.all != 0xff) { + pbVar1 = this->frame; + if (this->frame != 0xff) { pbVar1 &= -0x81; } if ((this->frameSpriteSettings & 1) == 0) { @@ -131,7 +131,7 @@ void sub_08060158(Entity* this) { this->animationState = sub_0806F5B0(index); } tmp2 &= 0x7f; - this->frames.all = tmp1; + this->frame = tmp1; this->frameIndex = tmp2; this->frameSpriteSettings = 1; this->animIndex = 0; @@ -266,7 +266,7 @@ void ForestMinish_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_0810A348)) { this->action++; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; sub_0805E3A0(this, 2); InitializeAnimation(this, 6); } diff --git a/src/npc/gentari.c b/src/npc/gentari.c index cc086d8a..ed79f153 100644 --- a/src/npc/gentari.c +++ b/src/npc/gentari.c @@ -9,7 +9,7 @@ void Gentari(Entity* this) { switch (this->action) { case 0: this->action = 1; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; sub_0805E3A0(this, 2); this->field_0x68.HALF.LO = sub_0801E99C(this); sub_08078784(this, this->field_0x68.HALF.LO); @@ -35,7 +35,7 @@ void Gentari(Entity* this) { void Gentari_Fusion(Entity* this) { if (this->action == 0) { this->action++; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; sub_0805E3A0(this, 2); InitAnimationForceUpdate(this, 10); } else { diff --git a/src/npc/ghostBrothers.c b/src/npc/ghostBrothers.c index e3ca2a68..ceee1a75 100644 --- a/src/npc/ghostBrothers.c +++ b/src/npc/ghostBrothers.c @@ -32,7 +32,7 @@ NONMATCH("asm/non_matching/ghostBrothers/sub_08065C0C.inc", void sub_08065C0C(En switch (this->action) { case 0: this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_0807DD50(this); break; case 1: @@ -65,7 +65,7 @@ NONMATCH("asm/non_matching/ghostBrothers/sub_08065C0C.inc", void sub_08065C0C(En return; } - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->action = 1; break; @@ -91,7 +91,7 @@ void sub_08065D18(Entity* this) { this->action = 1; this->actionDelay = 0x1e; this->field_0xf = 0; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spriteRendering.alphaBlend = 1; *(u32**)&this->field_0x6c = &gUnk_08110188; sub_0805E3A0(this, 2); @@ -135,7 +135,7 @@ void sub_08065F64(Entity* this) { void GhostBrothers_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 2); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/gina.c b/src/npc/gina.c index b7470173..66af2485 100644 --- a/src/npc/gina.c +++ b/src/npc/gina.c @@ -10,7 +10,7 @@ void Gina(Entity* this) { switch (this->action) { case 0: this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x68.HALF.LO = sub_0801E99C(this); sub_08078784(this, this->field_0x68.HALF.LO); @@ -40,7 +40,7 @@ void Gina(Entity* this) { void Gina_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 2); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/gorman.c b/src/npc/gorman.c index 8c45efdc..c118eeb5 100644 --- a/src/npc/gorman.c +++ b/src/npc/gorman.c @@ -131,7 +131,7 @@ void sub_08069ACC(Entity* this, ScriptExecutionContext* context) { } void Gorman_Head(Entity* this) { - SetExtraSpriteFrame(this, 0, (this->frames.all & 7) + 0xf); + SetExtraSpriteFrame(this, 0, (this->frame & 7) + 0xf); SetExtraSpriteFrame(this, 1, this->frameIndex); SetSpriteSubEntryOffsetData1(this, 1, 0); sub_0807000C(this); diff --git a/src/npc/goron.c b/src/npc/goron.c index a2498d86..2cdc3051 100644 --- a/src/npc/goron.c +++ b/src/npc/goron.c @@ -68,12 +68,12 @@ void sub_080693D0(Entity* this) { u32 var0 = this->field_0x82.HWORD & 0xF; bool32 createFx65 = BOOLCAST(var0); // = !var0 - if (this->frames.all == 1) { - this->frames.all = 0; + if (this->frame == 1) { + this->frame = 0; sub_08069428(this, 0xFFF80000, createFx65); } - if (this->frames.all == 2) { - this->frames.all = 0; + if (this->frame == 2) { + this->frame = 0; sub_08069428(this, 0x80 << 12, createFx65); } } @@ -129,7 +129,7 @@ void sub_080694EC(Entity* this) { void Goron_Fusion(Entity* this) { if (this->action == 0) { this->action++; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 2); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/goronMerchant.c b/src/npc/goronMerchant.c index f081cead..1c1dbf6f 100644 --- a/src/npc/goronMerchant.c +++ b/src/npc/goronMerchant.c @@ -69,7 +69,7 @@ void sub_0806961C(Entity* this) { void sub_0806963C(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; sub_0807DD50(this); } diff --git a/src/npc/gregal.c b/src/npc/gregal.c index 790385bb..8f7ce5ed 100644 --- a/src/npc/gregal.c +++ b/src/npc/gregal.c @@ -49,7 +49,7 @@ void sub_0806CB80(Entity* this) { sub_0805E3A0(this, 2); } if (this->parent != NULL) { - this->frameIndex = (this->parent->frames.all & 3) + 0x21; + this->frameIndex = (this->parent->frame & 3) + 0x21; } } @@ -62,9 +62,9 @@ void sub_0806CBB4(Entity* this) { } GetNextFrame(this); if (this->parent != NULL) { - this->spriteSettings.b.draw = 0; - if ((this->parent->frames.all & 4) != 0) { - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 0; + if ((this->parent->frame & 4) != 0) { + this->spriteSettings.draw = 1; } } } @@ -73,7 +73,7 @@ void sub_0806CC08(Entity* this) { switch (this->action) { case 0: this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_0805E3A0(this, 2); sub_0807DD64(this); case 1: @@ -100,7 +100,7 @@ void sub_0806CC08(Entity* this) { } void sub_0806CCB4(Entity* this, ScriptExecutionContext* context) { - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { context->condition = 1; } else { context->condition = 0; @@ -153,7 +153,7 @@ void sub_0806CD58(Entity* this) { void Gregal_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_0805E3A0(this, 2); InitAnimationForceUpdate(this, 6); } else { diff --git a/src/npc/guard.c b/src/npc/guard.c index 736625cd..843219fa 100644 --- a/src/npc/guard.c +++ b/src/npc/guard.c @@ -173,7 +173,7 @@ void Guard_Head(Entity* this) { u32 uVar4; u32 pbVar5; - uVar2 = this->frames.all & 0x3f; + uVar2 = this->frame & 0x3f; pbVar5 = (this->frameIndex & 0x3f); uVar4 = this->frameSpriteSettings & 0x3f; if (this->id == 0x15) { diff --git a/src/npc/hurdyGurdyMan.c b/src/npc/hurdyGurdyMan.c index fd0dd3d5..6bc1e0a2 100644 --- a/src/npc/hurdyGurdyMan.c +++ b/src/npc/hurdyGurdyMan.c @@ -52,7 +52,7 @@ void HurdyGurdyMan(Entity* this) { } void HurdyGurdyMan_Head(Entity* this) { - SetExtraSpriteFrame(this, 0, (this->frames.all & 0xffffff7f) + 8); + SetExtraSpriteFrame(this, 0, (this->frame & 0xffffff7f) + 8); SetExtraSpriteFrame(this, 1, this->frameIndex); SetSpriteSubEntryOffsetData1(this, 1, 0); sub_0807000C(this); @@ -78,7 +78,7 @@ void HurdyGurdyMan_Fusion(Entity* this) { uVar1 = LoadExtraSpriteData(this, &gUnk_081144F0); if (uVar1 != 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_0805E3A0(this, 2); InitializeAnimation(this, 10); } diff --git a/src/npc/kid.c b/src/npc/kid.c index 459e545d..b98341f1 100644 --- a/src/npc/kid.c +++ b/src/npc/kid.c @@ -174,7 +174,7 @@ NONMATCH("asm/non_matching/kid/sub_0806252C.inc", void sub_0806252C(Entity* this s32 iVar11; uVar4 = gPlayerState.field_0xa8; - uVar3 = gPlayerEntity.height.HALF.HI; + uVar3 = gPlayerEntity.z.HALF.HI; sVar2 = gPlayerEntity.y.HALF.HI; sVar1 = gPlayerEntity.x.HALF.HI; r0 = gPlayerEntity.y.HALF.HI - this->y.HALF.HI; @@ -291,7 +291,7 @@ NONMATCH("asm/non_matching/kid/Kid_Head.inc", void Kid_Head(Entity* this)) { u32 uVar4; iVar1 = (u32)this->type * 4; - uVar3 = ((u8)this->frames.all & 0x1f) + (u32)gUnk_0810C0A0[iVar1]; + uVar3 = ((u8)this->frame & 0x1f) + (u32)gUnk_0810C0A0[iVar1]; uVar4 = (this->frameIndex & 0x1f) + (u32)gUnk_0810C0A0[iVar1 + 1]; switch (this->type) { case 0: @@ -416,7 +416,7 @@ void Kid_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, gUnk_0810BDC4[this->type]) != 0) { this->action = this->action + 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->y.HALF.HI = this->y.HALF.HI + -8; tmp = 6; if (this->type == 6) { diff --git a/src/npc/kingDaltus.c b/src/npc/kingDaltus.c index f296cd4b..4bc618b3 100644 --- a/src/npc/kingDaltus.c +++ b/src/npc/kingDaltus.c @@ -27,7 +27,7 @@ void KingDaltus(Entity* this) { void sub_08066654(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x68.HALF.LO = sub_0801E99C(this); sub_08078784(this, this->field_0x68.HALF.LO); InitAnimationForceUpdate(this, 2); @@ -60,7 +60,7 @@ void sub_080666DC(Entity* this) { void sub_080666E4(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x68.HALF.LO = sub_0801E99C(this); sub_0807DD50(this); } @@ -96,7 +96,7 @@ void sub_0806673C(Entity* this) { void KingDaltus_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 6); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/kingGustaf.c b/src/npc/kingGustaf.c index 97388682..ef5b7971 100644 --- a/src/npc/kingGustaf.c +++ b/src/npc/kingGustaf.c @@ -16,12 +16,12 @@ void KingGustaf(Entity* this) { gScreen.controls.layerFXControl = 0x3f40; gScreen.controls.alphaBlend = 0x1000; this->speed = 0x1000; - this->hVelocity = 0; + this->zVelocity = 0; } else { sub_0807DD94(this, 0); speed = 0x100; speed *= this->speed; - speed += this->hVelocity; + speed += this->zVelocity; speed >>= 0x10; if (speed > 0x10) { speed = 0x10; diff --git a/src/npc/librari.c b/src/npc/librari.c index f5e1b629..3e961f65 100644 --- a/src/npc/librari.c +++ b/src/npc/librari.c @@ -12,7 +12,7 @@ void Librari(Entity* this) { switch (this->action) { case 0: this->action = 1; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; this->animationState = this->actionDelay; this->field_0x68.HALF.LO = sub_0801E99C(this); sub_08078784(this, this->field_0x68.HALF.LO); @@ -88,7 +88,7 @@ void sub_0806B2B4(Entity* this) { void Librari_Fusion(Entity* this) { if (this->action == 0) { this->action++; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; InitAnimationForceUpdate(this, 9); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/mailbox.c b/src/npc/mailbox.c index 43b87eb8..8c7dc813 100644 --- a/src/npc/mailbox.c +++ b/src/npc/mailbox.c @@ -40,7 +40,7 @@ void sub_08063220(Entity* this) { void sub_08063254(Entity* this, u32 unused) { sub_08063280(this, unused); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 3; MessageFromTarget(0); } @@ -56,8 +56,8 @@ void sub_08063280(Entity* this, u32 unused) { e = this; UpdateAnimationSingleFrame(e); - var = e->frames.all & 0x7F; - e->frames.all ^= var; + var = e->frame & 0x7F; + e->frame ^= var; if (var == 2) CreateFx(e, FX_MAILBOX_UNUSED, 0); } diff --git a/src/npc/malon.c b/src/npc/malon.c index 64febefe..85ba2cd1 100644 --- a/src/npc/malon.c +++ b/src/npc/malon.c @@ -20,7 +20,7 @@ void Malon(Entity* this) { void sub_08065864(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 0xC); } @@ -30,7 +30,7 @@ void sub_08065880(Entity* this) { void sub_08065888(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->animationState = 4; this->field_0x68.HALF.LO = sub_0801E99C(this); sub_08078784(this, this->field_0x68.HALF.LO); @@ -72,7 +72,7 @@ void sub_08065914(Entity* this) { void Malon_Fusion(Entity* this) { if (this->action == 0) { this->action++; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 0xC); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/mama.c b/src/npc/mama.c index 661684a7..50bd99fe 100644 --- a/src/npc/mama.c +++ b/src/npc/mama.c @@ -15,7 +15,7 @@ void Mama(Entity* this) { case 0: if (sub_0806C454(this) != 0) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->animationState = this->actionDelay; this->field_0x68.HALF.HI = 0; sub_0807DD50(this); @@ -54,7 +54,7 @@ bool32 sub_0806C454(Entity* this) { } void Mama_Head(Entity* this) { - SetExtraSpriteFrame(this, 0, this->frames.all & 0x7f); + SetExtraSpriteFrame(this, 0, this->frame & 0x7f); SetExtraSpriteFrame(this, 1, this->frameIndex); SetSpriteSubEntryOffsetData1(this, 1, 0); sub_0807000C(this); @@ -62,7 +62,7 @@ void Mama_Head(Entity* this) { void sub_0806C4A8(Entity* this, ScriptExecutionContext* context) { s32 tmp; - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { tmp = GetAnimationState(this); if (tmp < 0) { tmp = 3; @@ -88,7 +88,7 @@ void Mama_Fusion(Entity* this) { if (this->action == 0) { if (sub_0806C454(this) != 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->y.HALF.HI -= 4; InitializeAnimation(this, 2); } diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c index ae5f1e0e..9c92c976 100644 --- a/src/npc/mayorHagen.c +++ b/src/npc/mayorHagen.c @@ -83,7 +83,7 @@ void sub_0806CE80(Entity* this) { void MayorHagen_Fusion(Entity* this) { if (this->action == 0) { this->action++; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 8); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/melari.c b/src/npc/melari.c index 9f1df856..91f803b5 100644 --- a/src/npc/melari.c +++ b/src/npc/melari.c @@ -63,7 +63,7 @@ void sub_08068780(Entity* this) { return; } this->action = 1; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; this->animationState = this->type; sub_0805E3A0(this, 2); sub_0807DD50(this); @@ -85,8 +85,8 @@ void sub_08068780(Entity* this) { } } - if ((this->frames.b.f2) != 0) { - this->frames.all &= 0xbf; + if (this->frame & 0x40) { + this->frame &= 0xbf; if (sub_080040A8(this) == 0) { SoundReq(gUnk_0811153E[(s32)Random() % 3]); } else { @@ -107,7 +107,7 @@ void sub_08068884(Entity* this) { void Melari_Head(Entity* this) { u32 bVar1; - bVar1 = this->frames.all; + bVar1 = this->frame; bVar1 &= -0xc1; SetExtraSpriteFrame(this, 1, this->frameIndex); if ((bVar1 & 0x20) != 0) { @@ -129,7 +129,7 @@ void sub_08068910(Entity* this) { this->actionDelay--; } else { this->actionDelay = 0x10; - if ((this->frames.all & 0x20) != 0) { + if ((this->frame & 0x20) != 0) { iVar1 = sub_0806EDD8(this, 0x30, 0x30); if (iVar1 < 0) { iVar1 = 0x10; @@ -150,7 +150,7 @@ void Melari_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_08111520)) { this->action++; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; InitializeAnimation(this, 6); } } else { diff --git a/src/npc/milkCart.c b/src/npc/milkCart.c index 29481848..8ce2eb74 100644 --- a/src/npc/milkCart.c +++ b/src/npc/milkCart.c @@ -11,7 +11,7 @@ void MilkCart(Entity* ent) { void sub_08065B6C(Entity* ent) { ent->action++; - ent->spriteSettings.b.draw = 1; + ent->spriteSettings.draw = 1; ent->y.HALF.LO += -0x8000; ent->animationState = 6; InitAnimationForceUpdate(ent, 3); diff --git a/src/npc/ministerPotho.c b/src/npc/ministerPotho.c index 6c3bfb29..5ee2e07d 100644 --- a/src/npc/ministerPotho.c +++ b/src/npc/ministerPotho.c @@ -21,7 +21,7 @@ void MinisterPotho(Entity* this) { void sub_080667E4(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 2); sub_08078778(this); } @@ -55,7 +55,7 @@ void sub_08066864(Entity* this) { switch (this->action) { case 0: this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x68.HALF.LO = sub_0801E99C(this); sub_0807DD50(this); break; @@ -98,7 +98,7 @@ void sub_08066904(Entity* this) { void MinisterPotho_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 6); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/mountainMinish.c b/src/npc/mountainMinish.c index fa4ab4c8..14c4d6a1 100644 --- a/src/npc/mountainMinish.c +++ b/src/npc/mountainMinish.c @@ -100,7 +100,7 @@ void MountainMinish_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_08111358) != 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 6); } } else { diff --git a/src/npc/mutoh.c b/src/npc/mutoh.c index 3f66dd26..8cae57cd 100644 --- a/src/npc/mutoh.c +++ b/src/npc/mutoh.c @@ -22,7 +22,7 @@ void Mutoh(Entity* this) { case 0: if (LoadExtraSpriteData(this, &gUnk_08110C00)) { this->action = 1; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; sub_0805E3A0(this, 2); sub_0807DD50(this); } @@ -45,7 +45,7 @@ void Mutoh(Entity* this) { } void Mutoh_Head(Entity* this) { - SetExtraSpriteFrame(this, 0, (this->frames.all & -0x81)); + SetExtraSpriteFrame(this, 0, (this->frame & -0x81)); SetExtraSpriteFrame(this, 1, this->frameIndex); SetSpriteSubEntryOffsetData1(this, 1, 0); sub_0807000C(this); @@ -76,7 +76,7 @@ void Mutoh_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_08110C00) != 0) { this->action++; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; InitializeAnimation(this, 2); } } else { diff --git a/src/npc/nayru.c b/src/npc/nayru.c index 7bfd89ba..f6e799d8 100644 --- a/src/npc/nayru.c +++ b/src/npc/nayru.c @@ -11,7 +11,7 @@ void Nayru(Entity* this) { switch (this->action) { case 0: this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_0807DD50(this); break; case 1: @@ -45,7 +45,7 @@ void sub_08064928(Entity* this) { void Nayru_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 6); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/npc23.c b/src/npc/npc23.c index fbb6e943..e90d084c 100644 --- a/src/npc/npc23.c +++ b/src/npc/npc23.c @@ -23,7 +23,7 @@ void NPC23(Entity* this) { void sub_080662F8(Entity* this) { this->action = 1; this->subAction = 0; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->animationState = this->type << 1; InitializeAnimation(this, this->type); this->field_0x7c.HALF.HI = this->x.HALF.HI; diff --git a/src/npc/npc26.c b/src/npc/npc26.c index e3517992..ca0b17a4 100644 --- a/src/npc/npc26.c +++ b/src/npc/npc26.c @@ -17,7 +17,7 @@ void NPC26(Entity* this) { static void sub_080669B8(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 2); sub_08078778(this); } @@ -53,7 +53,7 @@ static void sub_08066A30(Entity* this) { static void sub_08066A38(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_0807DD50(this); } diff --git a/src/npc/npc4E.c b/src/npc/npc4E.c index 804c013a..3a49e4b3 100644 --- a/src/npc/npc4E.c +++ b/src/npc/npc4E.c @@ -34,7 +34,7 @@ extern void sub_08096260(Entity*); void NPC4E(Entity* this) { if (this->action == 0) { this->action = 1; - this->spriteSettings.b.draw = 4; + this->spriteSettings.draw = 4; this->hitbox = &gUnk_080FD170; sub_0807DD50(this); } else { diff --git a/src/npc/npc5.c b/src/npc/npc5.c index 8cffdf49..bc958f76 100644 --- a/src/npc/npc5.c +++ b/src/npc/npc5.c @@ -103,7 +103,7 @@ void sub_08060A00(Entity* this) { } } - if ((this->action == 0) || (this->spriteSettings.b.draw != 0)) { + if ((this->action == 0) || (this->spriteSettings.draw != 0)) { gUnk_0810AC2C[this->action](this); } @@ -115,7 +115,7 @@ void sub_08060A00(Entity* this) { this->field_0x74.HWORD = gRoomControls.roomID; CopyPosition(&gPlayerEntity, this); this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->speed = 0x120; tmp = gRoomControls.unk_10; this->animationState = tmp * 2; @@ -241,11 +241,11 @@ void sub_08060D78(Entity* this) { sub_08061358(this); if (sub_08060F80(this) != 0) { if ((u32)this->animIndex - 0x20 < 0x10) { - if ((this->frames.all & 7) != 0) { + if ((this->frame & 7) != 0) { this->frameDuration = 1; UpdateAnimationSingleFrame(this); } - this->animationState = this->frames.all & 0x18; + this->animationState = this->frame & 0x18; this->field_0x6c.HALF.LO = 0xff; } this->action = 1; @@ -255,7 +255,7 @@ void sub_08060D78(Entity* this) { void sub_08060DD0(Entity* this) { UpdateAnimationSingleFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 1; sub_08060E70(this, 0); } @@ -281,7 +281,7 @@ void sub_08060DFC(Entity* this) { void sub_08060E34(Entity* this) { UpdateAnimationSingleFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 2; this->animationState = DirectionToAnimationState(GetFacingDirection(this, &gPlayerEntity)) * 2; sub_08060E70(this, 8); @@ -308,7 +308,7 @@ void sub_08060E94(Entity* this) { void sub_08060EDC(Entity* this) { s32 tmp; - if (((u32)this->animIndex - 0x20 < 0x10) && ((this->frames.all & 0x80) == 0)) { + if (((u32)this->animIndex - 0x20 < 0x10) && ((this->frame & 0x80) == 0)) { UpdateAnimationSingleFrame(this); } else { tmp = GetFacingDirection(this, &gPlayerEntity) + this->animationState * -4; @@ -322,7 +322,7 @@ void sub_08060EDC(Entity* this) { } } else { if ((this->animationState & 1) == 0) { - if (((this->frames.all & 0x80) != 0) && (0xf >= (u32)this->animIndex - 0x20)) { + if (((this->frame & 0x80) != 0) && (0xf >= (u32)this->animIndex - 0x20)) { sub_08060E70(this, 0); } else { sub_08060E94(this); @@ -392,7 +392,7 @@ NONMATCH("asm/non_matching/npc5/sub_08061170.inc", bool32 sub_08061170(Entity* t this->action = 6; tmp = (sub_08079FD4(this, 1) * 0x10 - 4); // tmp <<= 0xc; - this->hVelocity = tmp; + this->zVelocity = tmp; this->speed = 0x100; this->direction = direction; this->animationState = direction >> 2; @@ -464,7 +464,7 @@ u32 sub_08061230(Entity* this) { } } else { UpdateAnimationSingleFrame(this); - if ((this->frames.all & 0x80) == 0) { + if ((this->frame & 0x80) == 0) { return 1; } ((UnkHeap*)this->myHeap)->unk_0 &= 0xfe; @@ -489,7 +489,7 @@ NONMATCH("asm/non_matching/npc5/sub_08061358.inc", void sub_08061358(Entity* thi switch (this->subAction) { case 0: UpdateAnimationSingleFrame(this); - if ((this->frames.all & 0x80) == 0) { + if ((this->frame & 0x80) == 0) { return; } this->subAction = 1; @@ -512,10 +512,10 @@ NONMATCH("asm/non_matching/npc5/sub_08061358.inc", void sub_08061358(Entity* thi break; case 2: UpdateAnimationSingleFrame(this); - if ((this->frames.all & 0x80) == 0) { + if ((this->frame & 0x80) == 0) { return; } - this->animationState = (u8)(((u8)this->frames.all & 0x18) >> 2); + this->animationState = (u8)(((u8)this->frame & 0x18) >> 2); uVar2 = Random(); if ((uVar2 & 1) == 0) { this->subAction = 0; diff --git a/src/npc/npc58.c b/src/npc/npc58.c index c6558930..b21de320 100644 --- a/src/npc/npc58.c +++ b/src/npc/npc58.c @@ -16,7 +16,7 @@ void NPC58(Entity* this) { return; } this->action += 1; - this->spriteSettings.b.draw = 2; + this->spriteSettings.draw = 2; this->spriteRendering.b3 = 0; this->spritePriority.b0 = 0; this->spriteOrientation.flipY = 1; diff --git a/src/npc/npc9.c b/src/npc/npc9.c index f0924a9b..deab57c0 100644 --- a/src/npc/npc9.c +++ b/src/npc/npc9.c @@ -11,7 +11,7 @@ void NPC9(Entity* this) { void sub_08062AF0(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; InitializeAnimation(this, 0); sub_08078778(this); } @@ -29,7 +29,7 @@ void sub_08062B14(Entity* this) { void sub_08062B48(Entity* this) { GetNextFrame(this); - if ((this->frames.b.f3) != 0) { + if (this->frame & 0x80) { MessageFromTarget(0xa01); this->action++; } diff --git a/src/npc/percy.c b/src/npc/percy.c index 16578b58..67500479 100644 --- a/src/npc/percy.c +++ b/src/npc/percy.c @@ -22,7 +22,7 @@ extern SpriteLoadData gUnk_08112E1C; void Percy_Head(Entity* this) { SetExtraSpriteFrame(this, 0, (this->frameSpriteSettings & 0x3f) + 0x13); - SetExtraSpriteFrame(this, 1, (this->frames.all & 0x7f) + 0xb); + SetExtraSpriteFrame(this, 1, (this->frame & 0x7f) + 0xb); SetExtraSpriteFrame(this, 2, this->frameIndex); SetSpriteSubEntryOffsetData1(this, 2, 1); SetSpriteSubEntryOffsetData2(this, 2, 0); @@ -62,7 +62,7 @@ void sub_0806B41C(Entity* this) { case 0: if (LoadExtraSpriteData(this, &gUnk_08112E1C)) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; if (this->type2 == 2) { CreateFx(this, FX_SWEAT, 0); } @@ -160,7 +160,7 @@ void Percy_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_08112E1C) != 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 2); } } else { diff --git a/src/npc/phonograph.c b/src/npc/phonograph.c index da7478a2..2e047f35 100644 --- a/src/npc/phonograph.c +++ b/src/npc/phonograph.c @@ -12,7 +12,7 @@ extern u16 gBG0Settings[]; void Phonograph(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x68.HWORD = 1; this->field_0x6a.HWORD = 0xffff; sub_0807DD64(this); diff --git a/src/npc/picolyteBottle.c b/src/npc/picolyteBottle.c index f95ef7d3..8ae55fc9 100644 --- a/src/npc/picolyteBottle.c +++ b/src/npc/picolyteBottle.c @@ -63,7 +63,7 @@ void sub_0806DFB4(Entity* this) { obj = CreateObject(0x35, 2, this->field_0xf); if (obj != NULL) { obj->parent = this; - this->attachedEntity = obj; + this->child = obj; CopyPosition(this, obj); } sub_080788E0(this); @@ -82,9 +82,9 @@ void sub_0806E0DC(Entity* this) { if (this->field_0xf != 0xff) { this->action = 2; this->field_0x76.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI); - if (this->attachedEntity != NULL) { - DeleteEntity(this->attachedEntity); - this->attachedEntity = NULL; + if (this->child != NULL) { + DeleteEntity(this->child); + this->child = NULL; } sub_08078828(this); sub_0807B7D8(0x73, this->field_0x76.HWORD, 2); diff --git a/src/npc/pina.c b/src/npc/pina.c index 53c31486..0d286049 100644 --- a/src/npc/pina.c +++ b/src/npc/pina.c @@ -28,7 +28,7 @@ void sub_08063A80(Entity* this) { void sub_08063A98(Entity* this) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 4); sub_08078778(this); } @@ -48,7 +48,7 @@ void sub_08063B68(Entity* this) { switch (this->action) { case 0: this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x68.HALF.HI = 0; sub_0807DD64(this); case 1: @@ -121,7 +121,7 @@ void sub_08063CAC(Entity* this) { void Pina_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->y.HALF.HI -= 4; InitAnimationForceUpdate(this, 2); } else { diff --git a/src/npc/pita.c b/src/npc/pita.c index 90c28687..17cc620a 100644 --- a/src/npc/pita.c +++ b/src/npc/pita.c @@ -21,7 +21,7 @@ void Pita(Entity* this) { sub_0807DD64(this); } sub_0807DD94(this, NULL); - if ((this->frames.all & 1) != 0) { + if ((this->frame & 1) != 0) { InitAnimationForceUpdate(this, (u32)(this->animationState >> 1)); this->field_0x80.HWORD = this->animIndex; } diff --git a/src/npc/postman.c b/src/npc/postman.c index 8a378f79..2a78d066 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -97,10 +97,10 @@ void sub_080604DC(Entity* this) { int iVar2; Entity* ent; - if (((u32)(this->spriteSettings.raw << 0x1e) >> 0x1e == 1) && sub_080040A8(this)) { - if ((this->frames.all & 1) != 0) { - this->frames.all &= 0xfe; - ent = CreateFx(this, FX_DASH, 0x40); + if (this->spriteSettings.draw == 1 && sub_080040A8(this)) { + if ((this->frame & 1) != 0) { + this->frame &= 0xfe; + ent = CreateFx(this, 17, 0x40); if (ent != NULL) { ent->y.HALF.HI++; sub_0805E3A0(ent, 3); @@ -113,7 +113,7 @@ void sub_08060528(Entity* this) { switch (this->action) { case 0: this->action = 1; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; this->field_0x68.HALF.LO = 0; this->field_0x68.HALF.HI = 0; this->field_0x6a.HWORD = 0; @@ -156,7 +156,7 @@ void sub_08060528(Entity* this) { if (0 < (s16)this->field_0x6a.HWORD) { if ((s16)this->field_0x6a.HWORD > 0x12b) { this->field_0x6a.HWORD = 0; - this->hVelocity = 0x20000; + this->zVelocity = 0x20000; this->field_0x6c.HALF.HI = 1; sub_080788E0(this); EnqueueSFX(0x7c); @@ -165,11 +165,11 @@ void sub_08060528(Entity* this) { } } sub_08003FC4(this, 0x1800); - if (((this->field_0x6c.HALF.HI != 0) && (this->hVelocity == 0)) && this->height.WORD == 0) { + if (((this->field_0x6c.HALF.HI != 0) && (this->zVelocity == 0)) && this->z.WORD == 0) { this->field_0x6c.HALF.HI = 0; sub_080606C0(this); } - if ((-1 < this->height.WORD) && + if ((-1 < this->z.WORD) && ((gPlayerEntity.collisionLayer == 0 || (this->collisionLayer == gPlayerEntity.collisionLayer)))) { sub_0806ED78(this); } @@ -212,7 +212,7 @@ ASM_FUNC("asm/non_matching/postman/sub_080608E4.inc", void sub_080608E4(Entity* void Postman_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 2); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/rem.c b/src/npc/rem.c index cc172a52..48e32e98 100644 --- a/src/npc/rem.c +++ b/src/npc/rem.c @@ -38,7 +38,7 @@ void sub_0806a370(Entity* this) { UpdateAnimationSingleFrame(this); sub_0806ED78(this); if (this->animIndex == 0xf) { - pbVar1 = &this->frames.all; + pbVar1 = &this->frame; if (*pbVar1 == 1) { *pbVar1 = 0; SoundReq(SFX_218); @@ -71,7 +71,7 @@ void sub_0806A410(Entity* this) { } break; case 1: - if (((this->frames.all & 0x80) != 0)) { + if (((this->frame & 0x80) != 0)) { sub_0806A9B0(this, *(ScriptExecutionContext**)&this->cutsceneBeh); } break; @@ -86,14 +86,14 @@ void sub_0806A458(Entity* this) { } break; case 1: - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->subAction = 2; InitializeAnimation(this, 10); ClearLocalFlag(0x62); } break; case 2: - if (((this->frames.all & 0x80) != 0)) { + if (((this->frame & 0x80) != 0)) { this->action = 1; this->subAction = 0; this->actionDelay = 0x3c; @@ -106,7 +106,7 @@ void sub_0806A458(Entity* this) { void sub_0806A4CC(Entity* this) { switch (this->subAction) { case 0: - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { if ((u8)(this->animIndex - 8) < 2) { this->subAction = 1; this->field_0x6a.HWORD = 1; @@ -118,7 +118,7 @@ void sub_0806A4CC(Entity* this) { } break; case 1: - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->subAction = 2; InitializeAnimation(this, GetAnimationState(this)); } @@ -135,13 +135,13 @@ void sub_0806A550(Entity* this) { this->subAction = 1; InitializeAnimation(this, 0xc); } else { - if (this->frames.all == 1) { - this->frames.all = 0; + if (this->frame == 1) { + this->frame = 0; sub_08080964(8, 2); gActiveScriptInfo.unk_00 |= 0x100; SoundReq(SFX_11B); } - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 5; this->subAction = 0; InitializeAnimation(this, 0xd); @@ -155,7 +155,7 @@ void nullsub_503(void) { void sub_0806A5C0(Entity* this) { GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { InitializeAnimation(this, (Random() & 3) + 4); } } @@ -182,8 +182,8 @@ void sub_0806A630(Entity* this) { if ((gActiveScriptInfo.unk_00 & 0x100) != 0) { GetNextFrame(this); } - if (this->frames.all == 1) { - this->frames.all = 0; + if (this->frame == 1) { + this->frame = 0; SoundReq(SFX_SECRET); } } @@ -202,8 +202,8 @@ void sub_0806A830(Entity* this) { DeleteThisEntity(); } GetNextFrame(this); - if (this->frames.all == 1) { - this->frames.all = 0; + if (this->frame == 1) { + this->frame = 0; npc = CreateNPC(0x37, 5, 0); if (npc != NULL) { PositionEntityOnTop(this, npc); @@ -218,7 +218,7 @@ void sub_0806A890(Entity* this) { sub_0805E3A0(this, 2); } GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { DeleteThisEntity(); } } diff --git a/src/npc/sittingPerson.c b/src/npc/sittingPerson.c index eebf8251..5a7d7d7a 100644 --- a/src/npc/sittingPerson.c +++ b/src/npc/sittingPerson.c @@ -26,9 +26,7 @@ void sub_080637B8(Entity* this) { this->interactType = 0; this->field_0x68.HALF.HI = this->animIndex; tmp = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)); - if ((this->spriteSettings.raw * 0x2000000) < 0) { - tmp += 4; - } + tmp += this->spriteSettings.flipX ? 4 : 0; InitializeAnimation(this, tmp); sub_0806F118(this); } else { @@ -49,7 +47,7 @@ void sub_08063830(Entity* this) { } void sub_08063850(Entity* this, ScriptExecutionContext* context) { - InitializeAnimation(this, context->intVariable + (BOOLCAST(this->spriteSettings.b.flipX) & 4U) + + InitializeAnimation(this, context->intVariable + (BOOLCAST(this->spriteSettings.flipX) & 4U) + (this->animationState >> 1)); } @@ -83,8 +81,8 @@ void SittingPerson_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_0810CB78[this->type * 3]) != 0) { this->action += 1; - this->spriteSettings.b.draw = 1; - this->spriteSettings.b.flipX = 0; + this->spriteSettings.draw = 1; + this->spriteSettings.flipX = 0; this->y.HALF.HI -= 4; InitializeAnimation(this, 2); sub_08096208(this, this->type); diff --git a/src/npc/smallTownMinish.c b/src/npc/smallTownMinish.c index eee7d9e8..7a6b8d7b 100644 --- a/src/npc/smallTownMinish.c +++ b/src/npc/smallTownMinish.c @@ -21,9 +21,9 @@ void SmallTownMinish(Entity* this) { sub_0807DD94(this, NULL); } if ((gPlayerState.flags & 0x80) != 0) { - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } else { - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } } diff --git a/src/npc/smith.c b/src/npc/smith.c index cdeff498..4bbe2f84 100644 --- a/src/npc/smith.c +++ b/src/npc/smith.c @@ -42,8 +42,8 @@ void Smith(Entity* this) { } else { this->spritePriority.b1 = 1; } - if ((this->frames.all & 1) != 0) { - this->frames.all &= 0xfe; + if ((this->frame & 1) != 0) { + this->frame &= 0xfe; CreateFx(this, FX_STARS2, 0x20); SoundReq(gUnk_08110380[(Random() & 7)]); } @@ -52,7 +52,7 @@ void Smith(Entity* this) { void Smith_Head(Entity* this) { u8 bVar1; - bVar1 = this->frames.all; + bVar1 = this->frame; SetExtraSpriteFrame(this, 0, this->frameIndex); if ((bVar1 & 0x40) != 0) { SetExtraSpriteFrame(this, 1, 0x16); @@ -102,7 +102,7 @@ void sub_08066170(Entity* this) { void sub_08066178(Entity* this) { if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x68.HALF.LO = sub_0801E99C(this); sub_0807DD50(this); } @@ -117,7 +117,7 @@ void sub_080661BC(Entity* this) { if (this->animIndex == 0xc) { UpdateAnimationSingleFrame(this); - if ((this->frames.b.f3) != 0) { + if (this->frame & 0x80) { this->field_0x80.HWORD = GetAnimationState(this) + 8; InitAnimationForceUpdate(this, this->field_0x80.HWORD); } @@ -168,7 +168,7 @@ void Smith_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) { this->action++; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 6); } } else { diff --git a/src/npc/stamp.c b/src/npc/stamp.c index b983f9c5..293e16b1 100644 --- a/src/npc/stamp.c +++ b/src/npc/stamp.c @@ -22,7 +22,7 @@ void Stamp(Entity* ent) { void sub_08062BD4(Entity* ent) { ent->action = 1; - ent->spriteSettings.b.draw = 1; + ent->spriteSettings.draw = 1; InitializeAnimation(ent, 0); sub_08078778(ent); } @@ -39,7 +39,7 @@ void sub_08062BF8(Entity* ent) { void sub_08062C24(Entity* ent) { GetNextFrame(ent); - if ((ent->frames.all & 128) != 0) { + if ((ent->frame & 128) != 0) { InitializeAnimation(ent, 4); MessageFromTarget(2561); ent->action++; diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c index 91e4a53c..c324c681 100644 --- a/src/npc/stockwell.c +++ b/src/npc/stockwell.c @@ -27,7 +27,7 @@ void sub_08065080(Entity* this) { ScriptExecutionContext* context; this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; sub_0805E3A0(this, 2); InitializeAnimation(this, 4); sub_08078778(this); @@ -55,7 +55,7 @@ void sub_080651D8(Entity* this) { } void sub_080651F8(Entity* this) { - if ((this->frames.all & 0x20) == 0) { + if ((this->frame & 0x20) == 0) { this->subAction = 1; this->actionDelay = 0x3c; InitializeAnimation(this, 1); @@ -146,7 +146,7 @@ void sub_080654EC(Entity* this) { } void sub_080654FC(Entity* this) { - if ((this->frames.all & 0x20) != 0) { + if ((this->frame & 0x20) != 0) { gActiveScriptInfo.commandSize = 0; } else { gActiveScriptInfo.flags |= 1; diff --git a/src/npc/sturgeon.c b/src/npc/sturgeon.c index 0e317696..749e0732 100644 --- a/src/npc/sturgeon.c +++ b/src/npc/sturgeon.c @@ -59,7 +59,7 @@ void sub_08064B44(Entity* this) { sub_08064CC0(this); this->action = 1; this->subAction = 0; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } } @@ -80,7 +80,7 @@ void sub_08064C50(Entity* this) { } void Sturgeon_Head(Entity* this) { - SetExtraSpriteFrame(this, 0, (u8)this->frames.all & 0x3f); + SetExtraSpriteFrame(this, 0, (u8)this->frame & 0x3f); SetExtraSpriteFrame(this, 1, (u32)this->frameIndex); SetSpriteSubEntryOffsetData1(this, 1, 0); sub_0807000C(this); @@ -119,7 +119,7 @@ void Sturgeon_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_0810FA38) != 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 6); } } else { diff --git a/src/npc/talon.c b/src/npc/talon.c index 841d9467..4629119e 100644 --- a/src/npc/talon.c +++ b/src/npc/talon.c @@ -66,7 +66,7 @@ void sub_0806559C(Entity* this) { void sub_08065608(Entity* this) { if (LoadExtraSpriteData(this, &gUnk_0810FEB0) != 0) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x68.HALF.LO = sub_0801E99C(this); sub_08078784(this, this->field_0x68.HALF.LO); sub_0807DD50(this); @@ -145,7 +145,7 @@ void sub_08065780(Entity* this, ScriptExecutionContext* context) { } void Talon_Head(Entity* this) { - SetExtraSpriteFrame(this, 0, ((this->frames.all & 7) + 0xB)); + SetExtraSpriteFrame(this, 0, ((this->frame & 7) + 0xB)); SetExtraSpriteFrame(this, 1, this->frameIndex); SetSpriteSubEntryOffsetData1(this, 1, 0); sub_0807000C(this); @@ -155,7 +155,7 @@ void Talon_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_0810FEB0) != 0) { this->action++; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 6); } } else { diff --git a/src/npc/teachers.c b/src/npc/teachers.c index bf7e6983..9e411a7a 100644 --- a/src/npc/teachers.c +++ b/src/npc/teachers.c @@ -15,7 +15,7 @@ void Teachers(Entity* this) { case 0: if (LoadExtraSpriteData(this, &gUnk_08113910[this->type * 4])) { this->action = 1; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; this->animationState = this->actionDelay; this->field_0x68.HALF.HI = 0; sub_0805E3A0(this, 2); @@ -52,7 +52,7 @@ void Teachers_Head(Entity* this) { u8 bVar2; u32 uVar3; - uVar3 = this->frames.all & -0x81; + uVar3 = this->frame & -0x81; bVar1 = this->frameIndex; bVar2 = this->frameSpriteSettings & 0x3f; if (this->type == 0) { @@ -84,7 +84,7 @@ void Teachers_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_08113910[this->type * 4])) { this->action++; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; InitializeAnimation(this, 2); } } else { diff --git a/src/npc/tingleSiblings.c b/src/npc/tingleSiblings.c index f4111b05..18587c36 100644 --- a/src/npc/tingleSiblings.c +++ b/src/npc/tingleSiblings.c @@ -70,13 +70,13 @@ void sub_08064DE4(Entity* this) { break; } { - u8 bVar1 = this->frames.all; + u8 bVar1 = this->frame; u8 bVar5 = bVar1 & 0xf; - this->frames.all = bVar5 ^ bVar1; + this->frame = bVar5 ^ bVar1; if (bVar1 & 0xf) { Entity* fx = CreateFx(this, bVar5 == 3 ? 0x2a : 0x29, 0); if (fx && bVar5 == 2) { - fx->spriteSettings.b.flipX = 1; + fx->spriteSettings.flipX = 1; } } } @@ -111,7 +111,7 @@ void TingleSiblings_Fusion(Entity* this) { u32 tmp; if (this->action == 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; tmp = 6; if (this->type == 0) { tmp = 10; diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c index b5103040..4aa9bcfd 100644 --- a/src/npc/townMinish.c +++ b/src/npc/townMinish.c @@ -157,7 +157,7 @@ void TownMinish_Head(Entity* this) { SetSpriteSubEntryOffsetData1(this, 1, 0); sub_0807000C(this); } else { - frames = this->frames.all; + frames = this->frame; if (frames != 0xff) { frames &= ~0x80; } @@ -210,7 +210,7 @@ void sub_0806AEE4(Entity* this) { this->animationState = sub_0806F5B0(index); } tmp2 &= 0x7f; - this->frames.all = tmp1; + this->frame = tmp1; this->frameIndex = tmp2; this->frameSpriteSettings = 1; this->animIndex = 0; @@ -223,13 +223,13 @@ void sub_0806AF60(Entity* this, ScriptExecutionContext* context) { } void sub_0806AF70(Entity* this, ScriptExecutionContext* context) { - this->hVelocity = 0x24000; + this->zVelocity = 0x24000; } void sub_0806AF78(Entity* this, ScriptExecutionContext* context) { sub_08003FC4(this, 0x1800); - if (0 <= this->height.WORD && this->hVelocity < 1) { - this->height.WORD = 0; + if (0 <= this->z.WORD && this->zVelocity < 1) { + this->z.WORD = 0; sub_0806AF70(this, context); } } @@ -336,7 +336,7 @@ void TownMinish_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_08112674[this->type * 4])) { this->action++; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 6); } } else { diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c index eb86baed..ae082b16 100644 --- a/src/npc/townsperson.c +++ b/src/npc/townsperson.c @@ -98,7 +98,7 @@ void sub_08061CEC(Entity* this) { if (LoadExtraSpriteData(this, gUnk_0810B6EC[this->type])) { this->action = 1; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; this->animationState = this->actionDelay; this->field_0x68.HALF.HI = 0xff; uVar2 = sub_0805ACC0(this); @@ -164,13 +164,13 @@ void sub_08061E70(Entity* this) { } // FIXME this is actually (Entity* this, ScriptExecutionContext* context) -void sub_08061E90(Entity* this, Entity* arg1) { +void sub_08061E90(Entity* this, ScriptExecutionContext* arg1) { u32 animIndex; s32 iVar4; - if (arg1->spriteSettings.raw == 0) { - arg1->spriteSettings.raw++; - arg1->spriteIndex = (Random() & 0x3f) + 0x20; + if (arg1->unk_18 == 0) { + arg1->unk_18++; + arg1->unk_12 = (Random() & 0x3f) + 0x20; animIndex = DirectionRound(Random()); switch (this->direction) { case 0x0: @@ -205,23 +205,23 @@ void sub_08061E90(Entity* this, Entity* arg1) { iVar4 = this->x.HALF.HI - *(s16*)&this->field_0x6a.HWORD; if (0x10 < iVar4) { this->x.HALF.HI = this->field_0x6a.HWORD + 0x10; - arg1->spriteIndex = 1; + arg1->unk_12 = 1; } if (iVar4 < -0x10) { this->x.HALF.HI = *(s16*)&this->field_0x6a.HWORD - 0x10; - arg1->spriteIndex = 1; + arg1->unk_12 = 1; } iVar4 = this->y.HALF.HI - *(s16*)&this->field_0x6c; if (0x10 < iVar4) { this->y.HALF.HI = *(s16*)&this->field_0x6c + 0x10; - arg1->spriteIndex = 1; + arg1->unk_12 = 1; } if (iVar4 < -0x10) { this->y.HALF.HI = *(s16*)&this->field_0x6c - 0x10; - arg1->spriteIndex = 1; + arg1->unk_12 = 1; } - if (--arg1->spriteIndex != 0) { + if (--arg1->unk_12 != 0) { gActiveScriptInfo.commandSize = 0; } } @@ -293,7 +293,7 @@ void Townsperson_Fusion(Entity* this) { return; } this->action++; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; } sub_08061CB4(this, 6); } diff --git a/src/npc/vaati.c b/src/npc/vaati.c index c5b8a757..065b81ff 100644 --- a/src/npc/vaati.c +++ b/src/npc/vaati.c @@ -24,7 +24,7 @@ void Vaati(Entity* this) { void VaatiAction0(Entity* this) { this->action = 1; this->subAction = 0; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x68.HALF.LO = 0; this->field_0x68.HALF.HI = 0; sub_0805E3A0(this, 2); @@ -39,8 +39,8 @@ void VaatiAction1(Entity* this) { sub_08095CB0(this); } - if ((this->frames.all & ~0x80) != 0) { - switch (this->frames.all & ~0x80u) { + if ((this->frame & ~0x80) != 0) { + switch (this->frame & ~0x80u) { case 1: EnqueueSFX(SFX_21C); break; @@ -59,7 +59,7 @@ void VaatiAction1(Entity* this) { EnqueueSFX(SFX_21D); break; } - this->frames.b.f3 = 0; + this->frame &= ~0x80; } } diff --git a/src/npc/vaatiReborn.c b/src/npc/vaatiReborn.c index 61c88c55..bc593edf 100644 --- a/src/npc/vaatiReborn.c +++ b/src/npc/vaatiReborn.c @@ -57,7 +57,7 @@ void VaatiRebornAction0(Entity* this) { break; case 2: if ((this->type2 & 2) != 0) { - this->spriteSettings.b.flipX = 1; + this->spriteSettings.flipX = 1; } sub_0806B96C(this); InitAnimationForceUpdate(this, 0); @@ -134,15 +134,15 @@ void VaatiRebornAction1(Entity* this) { } break; case 1: - if (this->frames.b.f3 != 0) { + if (this->frame & 0x80) { this->subAction = 2; sub_0801D2B4(this, 0x13f); InitAnimationForceUpdate(this, this->subAction - 1); } break; case 2: - if ((this->frames.all & 0x10) != 0) { - this->frames.all &= 0xef; + if ((this->frame & 0x10) != 0) { + this->frame &= 0xef; switch (++this->actionDelay) { case 1: @@ -157,7 +157,7 @@ void VaatiRebornAction1(Entity* this) { } break; case 3: - if (this->frames.b.f3 != 0) { + if (this->frame & 0x80) { SetRoomFlag(0); DeleteThisEntity(); } @@ -197,7 +197,7 @@ void sub_0806B96C(Entity* this) { DeleteThisEntity(); } ptr = &gUnk_08112F80[this->type2]; - this->spriteSettings.b.draw = entity->spriteSettings.b.draw; + this->spriteSettings.draw = entity->spriteSettings.draw; PositionRelative(entity, this, ptr->x << 0x10, (ptr->y + 0x21) << 0x10); UpdateAnimationSingleFrame(this); } diff --git a/src/npc/windTribespeople.c b/src/npc/windTribespeople.c index 789e5b2c..c88c32f5 100644 --- a/src/npc/windTribespeople.c +++ b/src/npc/windTribespeople.c @@ -44,7 +44,7 @@ void sub_0806C798(Entity* this) { iVar1 = LoadExtraSpriteData(this, gUnk_08113A1C + (this->type * 4)); if (iVar1 != 0) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->animationState = this->actionDelay; sub_0807DD50(this); sub_0806C7D4(this); @@ -94,7 +94,7 @@ void WindTribespeople_Head(Entity* this) { u32 uVar2; u8 pbVar3; - pbVar3 = (this->frames.all & 0x3F); + pbVar3 = (this->frame & 0x3F); if (this->type == 4) { SetExtraSpriteFrame(this, 0, 9); SetExtraSpriteFrame(this, 1, pbVar3); @@ -103,7 +103,7 @@ void WindTribespeople_Head(Entity* this) { SetSpriteSubEntryOffsetData1(this, 2, 1); sub_0807000C(this); } else { - if (this->frames.b.f2 != 0) { + if (this->frame & 0x40) { uVar2 = 1; uVar1 = 0; } else { @@ -209,7 +209,7 @@ void WindTribespeople_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_08113A1C[this->type * 4]) != 0) { this->action += 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; InitializeAnimation(this, 6); } } else { diff --git a/src/npc/zelda.c b/src/npc/zelda.c index 13045c51..e9e16171 100644 --- a/src/npc/zelda.c +++ b/src/npc/zelda.c @@ -21,7 +21,7 @@ void Zelda(Entity* this) { void sub_08066CCC(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; PrependEntityToList(this, 7); sub_0805E3A0(this, 2); sub_0807DD50(this); @@ -41,7 +41,7 @@ void sub_08066D14(Entity* this, ScriptExecutionContext* context) { parent = this->parent; if (parent != NULL) { this->animationState = parent->animationState; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; CopyPosition(parent, this); sub_08068680(this, this->parent); context->condition = 1; @@ -56,9 +56,9 @@ void sub_08066D4C(Entity* this, ScriptExecutionContext* context) { parent = this->parent; if (this->parent != NULL) { CopyPosition(this, parent); - this->parent->spriteSettings.b.draw = 1; + this->parent->spriteSettings.draw = 1; this->parent->animationState = this->animationState; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->field_0x17 &= 0xFE; sub_08068694(this, this->parent); context->condition = 1; @@ -127,20 +127,20 @@ void sub_08066E80(Entity* this, ScriptExecutionContext* context) { break; case 1: UpdateAnimationSingleFrame(this); - if (this->frames.all & 1) { + if (this->frame & 1) { context->unk_18++; - this->hVelocity = 0x20000; - this->frames.all &= 0xFE; + this->zVelocity = 0x20000; + this->frame &= 0xFE; SoundReq(SFX_PLY_JUMP); } break; case 2: sub_0806F62C(this, 0x100, 0x80); sub_08003FC4(this, 0x2000); - if (!(this->frames.all & 1)) { + if (!(this->frame & 1)) { UpdateAnimationSingleFrame(this); } - if (this->hVelocity < 0) { + if (this->zVelocity < 0) { context->unk_18++; } break; @@ -154,7 +154,7 @@ void sub_08066E80(Entity* this, ScriptExecutionContext* context) { break; case 4: UpdateAnimationSingleFrame(this); - if (this->frames.b.f3) { + if (this->frame & 0x80) { gActiveScriptInfo.flags |= 1; return; } diff --git a/src/npc/zeldaFollower.c b/src/npc/zeldaFollower.c index 649abd41..be6d633c 100644 --- a/src/npc/zeldaFollower.c +++ b/src/npc/zeldaFollower.c @@ -12,7 +12,7 @@ void sub_08068578(Entity* this); void ZeldaFollower(Entity* this) { if (this->action == 0) { this->action++; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; this->animationState = 4; this->field_0x68.HALF.LO = 0; this->field_0x68.HALF.HI = 0; @@ -23,7 +23,7 @@ void ZeldaFollower(Entity* this) { if ((s8)this->field_0x68.HALF.LO != 0) { sub_08068318(this); } else { - this->spriteSettings.b.draw = FALSE; + this->spriteSettings.draw = FALSE; } } @@ -43,12 +43,12 @@ ASM_FUNC("asm/non_matching/zeldaFollower/sub_08068578.inc", void sub_08068578(En void sub_08068680(Entity* this, Entity* entity) { entity->field_0x68.HALF.LO = 0; - entity->spriteSettings.b.draw = 0; + entity->spriteSettings.draw = 0; } void sub_08068694(Entity* this, Entity* entity) { entity->field_0x68.HALF.LO = 1; - entity->spriteSettings.b.draw = 1; + entity->spriteSettings.draw = 1; entity->animationState = this->animationState; sub_08068578(entity); InitAnimationForceUpdate(entity, entity->animationState / 2); diff --git a/src/object/archway.c b/src/object/archway.c index 49f3f497..823fa485 100644 --- a/src/object/archway.c +++ b/src/object/archway.c @@ -5,7 +5,7 @@ void Archway(Entity* this) { if (this->action == 0) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->frameIndex = this->type2; this->collisionLayer = 2; UpdateSpriteForCollisionLayer(this); diff --git a/src/object/backgroundCloud.c b/src/object/backgroundCloud.c index aaee8cf2..2ab9051a 100644 --- a/src/object/backgroundCloud.c +++ b/src/object/backgroundCloud.c @@ -13,7 +13,7 @@ void BackgroundCloud(Entity* this) { void sub_0808F658(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spriteOrientation.flipY = 3; this->spriteRendering.b3 = 3; this->spritePriority.b0 = this->type; diff --git a/src/object/bakerOven.c b/src/object/bakerOven.c index 13cb6627..b1c3a1db 100644 --- a/src/object/bakerOven.c +++ b/src/object/bakerOven.c @@ -33,7 +33,7 @@ void sub_0809CC74(Entity* this) { sub_0809CDF0(this); } else { if (this->type2 & 1) { - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->actionDelay = 20; } else { this->action = 2; @@ -48,7 +48,7 @@ void sub_0809CD0C(Entity* this) { if (this->type) { GetNextFrame(this); - frames = &this->frames.all; + frames = &this->frame; if (*frames & 1) { *frames &= 0xfe; this->y.HALF.HI++; @@ -56,7 +56,7 @@ void sub_0809CD0C(Entity* this) { if ((*frames & 0x80) && this->frameDuration == 1) { this->action = 2; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } /* Damage minish link if he touches a steam cloud */ @@ -79,7 +79,7 @@ void sub_0809CDB4(Entity* this) { this->action = 1; this->actionDelay = 30; this->field_0xf = 0; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->y.HALF.HI = this->parent->y.HALF.HI - 0xe; InitializeAnimation(this, 0); } diff --git a/src/object/bell.c b/src/object/bell.c index 3a1e7d41..a3e7ce3c 100644 --- a/src/object/bell.c +++ b/src/object/bell.c @@ -9,7 +9,7 @@ void Bell(Entity* ent) { void sub_08097D90(Entity* ent) { ent->action = 1; - ent->spriteSettings.b.draw = 1; + ent->spriteSettings.draw = 1; ent->collisionLayer = 1; ent->spritePriority.b0 = 0; UpdateSpriteForCollisionLayer(ent); diff --git a/src/object/bigVortex.c b/src/object/bigVortex.c index 9a06d4ff..a34d7e59 100644 --- a/src/object/bigVortex.c +++ b/src/object/bigVortex.c @@ -23,7 +23,7 @@ void BigVortex(Entity* this) { void sub_08098D1C(Entity* this) { u32 temp; this->action = 1; - this->height.HALF.HI = -0x10; + this->z.HALF.HI = -0x10; temp = this->field_0x86.HWORD; @@ -31,7 +31,7 @@ void sub_08098D1C(Entity* this) { this->action = 1; } else { this->action = 3; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; sub_08098E88(this); } sub_0805E3A0(this, 6); @@ -54,7 +54,7 @@ void sub_08098D6C(Entity* this) { void sub_08098D9C(Entity* this) { if (--this->actionDelay == 0) { this->action = 3; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; sub_08098E88(this); } } @@ -88,7 +88,7 @@ void sub_08098E3C(Entity* this) { if (this->action == 0) { this->action = 1; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; InitAnimationForceUpdate(this, this->type); } temp = &gUnk_08123690[this->type & 2]; diff --git a/src/object/bird.c b/src/object/bird.c index 758a3564..da47a078 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -26,11 +26,11 @@ void sub_0809CF54(Entity* this) { Entity* target; this->action++; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; this->actionDelay = 0x31; this->field_0xf = 1; - this->hVelocity = -0x18000; - this->height.WORD = -0x38C000; + this->zVelocity = -0x18000; + this->z.WORD = -0x38C000; this->field_0x68.HWORD = -0x800; this->speed = 0x280; this->direction = 8; @@ -85,7 +85,7 @@ void sub_0809D084(Entity* this) { PositionRelative(this->parent, this, 0, 0x80000); } else { this->subAction++; - this->hVelocity = temp; + this->zVelocity = temp; } } } @@ -96,7 +96,7 @@ void sub_0809D0AC(Entity* this) { if (sub_080044EC(this, 0x1800) < 2) { this->type = 2; this->action = 1; - this->height.WORD = 0; + this->z.WORD = 0; this->collisionLayer = 1; SetLocalFlag(0x45); SoundReq(SFX_SECRET); @@ -134,14 +134,14 @@ void sub_0809D178(Entity* this) { this->action++; this->collisionLayer = 2; UpdateSpriteForCollisionLayer(this); - this->frames.all = 0x80; + this->frame = 0x80; } - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { InitializeAnimation(this, Random() & 3); this->frameDuration = (Random() & 0xf) + 0x10; - this->spriteSettings.b.flipX = FALSE; + this->spriteSettings.flipX = FALSE; if ((Random() & 1) != 0) { - this->spriteSettings.b.flipX = TRUE; + this->spriteSettings.flipX = TRUE; } } else { GetNextFrame(this); diff --git a/src/object/book.c b/src/object/book.c index 3c60630c..4b20cf8e 100644 --- a/src/object/book.c +++ b/src/object/book.c @@ -31,7 +31,7 @@ void sub_0809B3C4(Entity* this) { } if (obtained != 2) { - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } } @@ -61,7 +61,7 @@ void sub_0809B3C4(Entity* this) { this->action = 3; scroll = (u16)gRoomControls.roomScrollY - 0x10; height = (u16)this->y.HALF.HI - scroll; - this->height.HALF.HI -= height; + this->z.HALF.HI -= height; return; } case 2: @@ -113,7 +113,7 @@ void sub_0809B524(Entity* this) { if (--this->field_0xf == 0) { this->action = 3; this->y.HALF.HI += 32; - this->height.HALF.HI -= 32; + this->z.HALF.HI -= 32; } else { this->action = 1; this->actionDelay = 22; @@ -152,7 +152,7 @@ void sub_0809B5B4(Entity* this) { } void sub_0809B5EC(Entity* this) { - if (this->spriteSettings.b.draw == 1) { + if (this->spriteSettings.draw == 1) { switch (this->subAction) { case 0: { Entity* parent; @@ -199,7 +199,7 @@ void sub_0809B5EC(Entity* this) { case 1: { u8 doTextBox = gMessage.doTextBox & 0x7f; if (!doTextBox) { - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->subAction = doTextBox; } break; @@ -225,7 +225,7 @@ void sub_0809B6B0(Entity* parent, Entity* this) { PositionRelative(parent, this, 0, offset); - this->height.HALF.HI = -(this->type << 2); + this->z.HALF.HI = -(this->type << 2); this->spritePriority.b0 = 3 - this->type; } diff --git a/src/object/button.c b/src/object/button.c index 0a1c7fbb..16b1896f 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -167,13 +167,13 @@ Entity* sub_08081D74(Entity* this) { } } } - this->attachedEntity = ent; + this->child = ent; return ent; } u32 sub_08081E0C(Entity* this) { Entity* tmp = &gPlayerEntity; - if (tmp->height.HALF.HI != 0 || !sub_08079F8C()) { + if (tmp->z.HALF.HI != 0 || !sub_08079F8C()) { return 0; } else { return sub_080041A0(this, tmp, 5, 6); @@ -251,8 +251,8 @@ u32 sub_08081F7C(Entity* this, u32 r7) { if (this->actionDelay == 0) return 1; if (--this->actionDelay > 6) { - if (this->attachedEntity) - this->attachedEntity->spriteOffsetY = 0xfc; + if (this->child) + this->child->spriteOffsetY = 0xfc; } else { if (this->actionDelay == 6) { SetFlag(this->field_0x86.HWORD); @@ -272,10 +272,10 @@ extern void sub_080044AE(Entity*, u32, u32); void sub_08081FF8(Entity* this) { u32 direction; u32 i; - if (this->attachedEntity != &gPlayerEntity) + if (this->child != &gPlayerEntity) return; - direction = GetFacingDirection(this->attachedEntity, this); - sub_080044AE(this->attachedEntity, 0x200, direction); + direction = GetFacingDirection(this->child, this); + sub_080044AE(this->child, 0x200, direction); for (i = 0; i < 3; i++) { if (gUnk_03004040[i]) { sub_080044AE(gUnk_03004040[i], 0x200, direction); diff --git a/src/object/chestSpawner.c b/src/object/chestSpawner.c index 3f7e6006..811817d7 100644 --- a/src/object/chestSpawner.c +++ b/src/object/chestSpawner.c @@ -24,7 +24,7 @@ void sub_08083E08(Entity* this) { void sub_08083E20(Entity* this) { this->action = 3; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spriteRendering.alphaBlend = 0; sub_080842D8(this); sub_08078828(this); diff --git a/src/object/cloud.c b/src/object/cloud.c index a2c20ff6..75fc7be6 100644 --- a/src/object/cloud.c +++ b/src/object/cloud.c @@ -35,7 +35,7 @@ void sub_0809F4DC(Entity* this) { void sub_0809F514(Entity* this) { this->action = 1; this->actionDelay = 120; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->field_0x68.HALF.LO = 12; gRoomControls.cameraTarget = this; gUnk_02034490[0] = 255; @@ -69,7 +69,7 @@ void sub_0809F5B0(Entity* this) { void sub_0809F5DC(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->field_0x68.HALF.LO = 12; } diff --git a/src/object/fan.c b/src/object/fan.c index 5d800011..0642a17e 100644 --- a/src/object/fan.c +++ b/src/object/fan.c @@ -52,7 +52,7 @@ void sub_0809ED88(Entity* this) { void sub_0809EDE4(Entity* this) { sub_0809F08C(); sub_0809EE44(this); - if (this->frames.b.f3) { + if (this->frame & 0x80) { sub_0809EE34(this); } } diff --git a/src/object/fileScreenObjects.c b/src/object/fileScreenObjects.c index 5c5e419e..9c18f83c 100644 --- a/src/object/fileScreenObjects.c +++ b/src/object/fileScreenObjects.c @@ -46,7 +46,7 @@ extern const u8 gUnk_08121D48[]; extern const struct_08121D54 gUnk_08121D54[]; void FileScreenObjects(Entity* this) { - if (this->currentHealth == 0) { + if (this->health == 0) { sub_0808EFF0(this); } gUnk_08121C64[this->type](this); @@ -62,7 +62,7 @@ void sub_0808E7D8(Entity* this) { void sub_0808E7F0(Entity* this) { sub_080AE008(this, 1, 2); this->palette.b.b0 = 0xF; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->type2 = 0xFF; this->action = 1; } @@ -76,7 +76,7 @@ void sub_0808E818(Entity* this) { this->type2 = var2; this->field_0x68.HWORD = var2; this->field_0x6a.HWORD = var2; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; return; } @@ -111,7 +111,7 @@ void sub_0808E818(Entity* this) { } } - this->spriteSettings.b.flipX = this->animationState == 3; + this->spriteSettings.flipX = this->animationState == 3; var0 = this->field_0x68.HWORD + this->field_0x70.BYTES.byte0 + this->animationState; if (this->field_0x6a.HWORD != var0) { this->field_0x6a.HWORD = var0; @@ -119,7 +119,7 @@ void sub_0808E818(Entity* this) { InitAnimationForceUpdate(this, (u8)var0); } - this->spriteSettings.b.draw = 2; + this->spriteSettings.draw = 2; } static bool32 sub_0808E950(void) { @@ -160,19 +160,19 @@ void sub_0808E988(Entity* this) { if (this->type2 != i) { InitAnimationForceUpdate(this, i); } - this->spriteSettings.b.draw = 2; + this->spriteSettings.draw = 2; return; } } - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } void sub_0808E9F4(Entity* this) { if (sub_0808E950() && gSave.unk6) { - this->spriteSettings.b.draw = 2; + this->spriteSettings.draw = 2; } else { - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } } @@ -182,9 +182,9 @@ void sub_0808EA28(Entity* this) { if (this->type == 3) { if (gSaveHeader->gameLanguage > LANGUAGE_EN) { - this->spriteSettings.b.draw = 2; + this->spriteSettings.draw = 2; } else { - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } } @@ -443,9 +443,9 @@ void sub_0808EE98(Entity* this) { void sub_0808EED8(Entity* this) { int var0; if (gUnk_02032EC0.lastState != 3) { - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } else { - this->spriteSettings.b.draw = 2; + this->spriteSettings.draw = 2; var0 = this->type - 19; this->palette.b.b0 = gMenu.column_idx == var0 ? 4 : 3; } @@ -454,9 +454,9 @@ void sub_0808EED8(Entity* this) { void sub_0808EF24(Entity* this) { int var0; if (gUnk_02032EC0.lastState != 3) { - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } else { - this->spriteSettings.b.draw = 2; + this->spriteSettings.draw = 2; if (this->type == 21) { var0 = ((struct_02000000*)0x2000000)->messageSpeed; } else { @@ -518,9 +518,9 @@ static void sub_0808EFF0(Entity* this) { const struct_08121D54* var0; u8 var1; - this->spriteSettings.b.draw = 2; + this->spriteSettings.draw = 2; this->speed = 0x400; - this->currentHealth = 1; + this->health = 1; this->frameIndex = 0xFF; this->animIndex = 0xFF; var0 = &gUnk_08121D54[this->type]; diff --git a/src/object/giantLeaf.c b/src/object/giantLeaf.c index 9badc65b..a61b267a 100644 --- a/src/object/giantLeaf.c +++ b/src/object/giantLeaf.c @@ -11,7 +11,7 @@ extern s16 gUnk_0812176A[]; void GiantLeaf(Entity* ent) { if (ent->action == 0) { ent->action = 1; - ent->spriteSettings.b.draw = 1; + ent->spriteSettings.draw = 1; ent->spriteRendering.b3 = 3; ent->spritePriority.b0 = 7; ent->frameIndex = ent->type; diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c index 2a2cacf0..8eb5513f 100644 --- a/src/object/greatFairy.c +++ b/src/object/greatFairy.c @@ -109,7 +109,7 @@ void GreatFairy_SpawningUpdate(Entity* this) { SoundReq(SFX_145); this->action = 4; this->actionDelay = 60; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } } } @@ -154,7 +154,7 @@ void GreatFairy_WingsCallBehavior(Entity* this) { void GreatFairy_WingsInit(Entity* this) { GreatFairy_InitializeAnimation(this); this->spritePriority.b0 = 5; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spriteRendering.alphaBlend = 1; gScreen.controls.layerFXControl = 0xF40; gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 8); @@ -184,7 +184,7 @@ void GreatFairy_WakeCallBehavior(Entity* this) { void GreatFairy_WakeInit(Entity* this) { GreatFairy_InitializeAnimation(this); - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spritePriority.b0 = 6; } @@ -205,7 +205,7 @@ void GreatFairy_MiniInit(Entity* this) { CopyPosition(this, aff); aff->parent = this; GreatFairy_InitializeAnimation(this); - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0xf = 0; } } @@ -215,12 +215,12 @@ void GreatFairy_MiniRisingUpdate(Entity* this) { Entity* target; GetNextFrame(this); - this->height.WORD -= 0x8000; - if (this->height.HALF.HI == -20) { + this->z.WORD -= 0x8000; + if (this->z.HALF.HI == -20) { this->action = 2; SoundReq(SFX_HEART_CONTAINER_SPAWN); } else { - if (((this->height.HALF.HI == -10) && (this->field_0xf == 0)) && + if (((this->z.HALF.HI == -10) && (this->field_0xf == 0)) && (target = GreatFairy_CreateForm(this, DROPLET, 0), target != NULL)) { PositionRelative(this, target, 0, 0x40000); this->field_0xf = 1; @@ -245,7 +245,7 @@ void GreatFairy_MiniAffineCallBehavior(Entity* this) { void GreatFairy_MiniAffineInit(Entity* this) { GreatFairy_InitializeAnimation(this); this->spritePriority.b0 = 6; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } // Getting ready for affine transformation @@ -254,7 +254,7 @@ void GreatFairy_MiniAffineInit2(Entity* this) { CopyPosition(parent, this); - if (this->height.HALF.HI == -20) { + if (this->z.HALF.HI == -20) { this->action = 2; this->actionDelay = 90; this->speed = 4096; @@ -282,15 +282,15 @@ void GreatFairy_DropletCallBehavior(Entity* this) { void GreatFairy_DropletInit(Entity* this) { GreatFairy_InitializeAnimation(this); - this->spriteSettings.b.draw = 1; - this->height.HALF.HI = 0; + this->spriteSettings.draw = 1; + this->z.HALF.HI = 0; this->spritePriority.b0 = 5; SoundReq(SFX_140); } void GreatFairy_DropletUpdate(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { DeleteEntity(this); } } @@ -302,7 +302,7 @@ void GreatFairy_RippleCallBehavior(Entity* this) { void GreatFairy_RippleInit(Entity* this) { GreatFairy_InitializeAnimation(this); - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spritePriority.b0 = 6; } @@ -322,7 +322,7 @@ void GreatFairy_BigRippleCallBehavior(Entity* this) { void GreatFairy_BigRippleInit(Entity* this) { GreatFairy_InitializeAnimation(this); this->actionDelay = 120; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spritePriority.b0 = 5; SoundReq(SFX_TELEPORTER); } @@ -350,13 +350,13 @@ void GreatFairy_EnergyCallBehavior(Entity* this) { void GreatFairy_EnergyInit(Entity* this) { GreatFairy_InitializeAnimation(this); - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spritePriority.b0 = 5; } void GreatFairy_EnergyUpdate(Entity* this) { GetNextFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { DeleteEntity(this); } } @@ -372,7 +372,7 @@ void sub_08087114(Entity* this) { void sub_08087150(Entity* this) { GreatFairy_InitializeAnimation(this); - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spriteOrientation.flipY = 0; this->spriteRendering.b3 = 0; this->spritePriority.b0 = 3; @@ -401,7 +401,7 @@ void sub_080871D0(Entity* this) { } void sub_080871F8(Entity* this) { - Entity* temp = this->attachedEntity; + Entity* temp = this->child; if ((temp->x.HALF.HI == this->x.HALF.HI) && (temp->y.HALF.HI - 32 == this->y.HALF.HI)) { this->action = 2; @@ -437,7 +437,7 @@ void sub_08087294(Entity* this) { } void sub_080872AC(Entity* this) { - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spriteOrientation.flipY = 1; this->spriteRendering.b3 = 0; this->field_0x68.HWORD = this->x.HALF.HI; @@ -458,7 +458,7 @@ void sub_080872F8(Entity* this) { this->direction = (this->direction + gUnk_081207AC[Random() & 3]) & 0x1f; } temp = gSineTable[this->actionDelay + 64]; - this->height.HALF.HI = (temp >> 6) - 8; + this->z.HALF.HI = (temp >> 6) - 8; this->actionDelay++; } diff --git a/src/object/heartContainer.c b/src/object/heartContainer.c index 71d109f4..a2abfbda 100644 --- a/src/object/heartContainer.c +++ b/src/object/heartContainer.c @@ -28,7 +28,7 @@ static void sub_0808E6A0(Entity* this) { } this->action = 1; this->type = 0x62; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->hitbox = &gUnk_08121C58; this->collisionLayer = 3; this->updateConditions = 3; @@ -37,7 +37,7 @@ static void sub_0808E6A0(Entity* this) { static void sub_0808E6E4(Entity* this) { if (CheckFlags(this->field_0x86.HWORD)) { this->action = 2; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spriteRendering.b0 = 3; sub_0808E714(this); } diff --git a/src/object/hiddenLadderDown.c b/src/object/hiddenLadderDown.c index 5a176b07..7d1c7abd 100644 --- a/src/object/hiddenLadderDown.c +++ b/src/object/hiddenLadderDown.c @@ -22,7 +22,7 @@ void sub_08091F14(Entity* this) { puVar3 = &this->field_0x70.HALF.LO; if (CheckFlags(this->field_0x86.HWORD) != 0) { this->action = 2; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; SetTileType(0x1a2, *puVar3 - 0x41, this->collisionLayer); SetTileType(0x1a3, *puVar3 - 0x40, this->collisionLayer); SetTileType(0x1a4, *puVar3 - 0x3f, this->collisionLayer); @@ -38,7 +38,7 @@ void sub_08091F14(Entity* this) { void sub_08092000(Entity* this) { if (GetTileType(*(u16*)&this->field_0x70.HALF.LO, this->collisionLayer) == 0x1a6) { this->action = 2; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; SetFlag(this->field_0x86.HWORD); } } diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c index 876fdc6a..41a3ee77 100644 --- a/src/object/houseDoorExterior.c +++ b/src/object/houseDoorExterior.c @@ -97,7 +97,7 @@ void sub_0808681C(Entity* this) { case 0: this->action = 1; this->actionDelay = 8; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->frameIndex = 0; this->hitbox = &gUnk_081206AC; if (this->subAction == 1) { @@ -127,7 +127,7 @@ void sub_0808681C(Entity* this) { void sub_080868B0(Entity* this) { if (this->action == 0) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->hitbox = &gUnk_081206AC; this->actionDelay = 8; } diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c index f9ac58f6..a5c1770b 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -51,9 +51,9 @@ void ItemOnGround(Entity* this) { case 20: this->action = 3; COLLISION_OFF(this); - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x3c |= 0x10; - this->attachedEntity = this->field_0x4c; + this->child = this->field_0x4c; break; case 0: case 1: @@ -90,13 +90,13 @@ void sub_08080F20(Entity* this) { } if (this->type != 0x60) { - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spritePriority.b1 = 3; - this->spriteSettings.b.shadow = 0; + this->spriteSettings.shadow = 0; this->hitType = 7; this->field_0x3c = 0x47; this->hurtType = 0x44; - this->currentHealth = 0xFF; + this->health = 0xFF; this->hitbox = &gUnk_080FD1A8; switch (this->type) { case 0x3f: @@ -150,8 +150,8 @@ void sub_080810A8(Entity* this) { this->direction |= 0xFF; } - if (this->hVelocity == 0) { - this->hVelocity = 0x1E000; + if (this->zVelocity == 0) { + this->zVelocity = 0x1E000; } if (this->collisionLayer == 2) { @@ -180,7 +180,7 @@ void sub_08081134(Entity* this) { void sub_08081150(Entity* this) { this->action = 2; COLLISION_ON(this); - this->height.HALF.HI = -0x80; + this->z.HALF.HI = -0x80; this->spriteOrientation.flipY = 1; this->spriteRendering.b3 = 1; SoundReq(SFX_12D); @@ -196,13 +196,13 @@ void sub_08081188(Entity* this) { void sub_080811AC(Entity* this) { this->action = 2; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->field_0x6e.HWORD = GetTileTypeByEntity(this); } void sub_080811C8(Entity* this) { this->action = 2; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } void sub_080811D8(Entity* this) { @@ -218,7 +218,7 @@ void sub_080811EC(Entity* this) { } sub_08003FC4(this, 0x2800); - if (this->hVelocity <= 0) { + if (this->zVelocity <= 0) { this->action = 2; COLLISION_ON(this); sub_080814A4(this); @@ -262,7 +262,7 @@ void sub_080812A8(Entity* this) { if (sub_080002D0(this) != 0xF && this->field_0x6e.HWORD != GetTileTypeByEntity(this)) { this->direction = 0; this->speed = 0; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x68.HALF.HI = 0; sub_080810A8(this); } @@ -283,12 +283,12 @@ void nullsub_510(Entity* this) { } void sub_08081328(Entity* this) { - Entity* other = this->attachedEntity; + Entity* other = this->child; if (!(other->kind == 8 && other->id == 3)) { sub_08081404(this, 0); } else { CopyPosition(other, this); - this->height.HALF.HI--; + this->z.HALF.HI--; other = &gPlayerEntity; if (sub_080177A0(this, other)) { sub_080810FC(this); @@ -298,7 +298,7 @@ void sub_08081328(Entity* this) { void sub_0808136C(Entity* this) { if (--this->actionDelay) { - Entity* other = this->attachedEntity; + Entity* other = this->child; this->x.WORD = other->x.WORD; this->y.WORD = other->y.WORD; this->spriteOrientation.flipY = other->spriteOrientation.flipY; @@ -316,7 +316,7 @@ void sub_080813BC(Entity* this) { void sub_080813D4(Entity* this) { this->subAction = 1; this->field_0x1d = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } void sub_080813E8(Entity* this) { @@ -383,7 +383,7 @@ u32 sub_080814C0(Entity* this) { } if (this->field_0x6c.HWORD < 90) { - this->spriteSettings.b.draw ^= 1; + this->spriteSettings.draw ^= 1; } } @@ -413,7 +413,7 @@ void sub_0808153C(Entity* this) { if (this->field_0x68.HALF.LO == 0) { if (!sub_08003FC4(this, 0x1000) && !sub_0800442E(this)) { this->field_0x68.HALF.LO = 1; - this->hVelocity = 0x1E000; + this->zVelocity = 0x1E000; sub_0808148C(this->type); UpdateSpriteForCollisionLayer(this); } @@ -426,20 +426,20 @@ void sub_0808153C(Entity* this) { } void sub_08081598(Entity* this) { - if (this->currentHealth == 0) { + if (this->health == 0) { sub_08081404(this, 1); } COLLISION_OFF(this); this->action = 4; this->actionDelay = 14; - this->hVelocity = 0x20000; - this->spriteSettings.b.draw = 1; + this->zVelocity = 0x20000; + this->spriteSettings.draw = 1; this->spritePriority.b1 = 2; this->spritePriority.b0 = 3; - this->attachedEntity = &gPlayerEntity; - CopyPosition(this->attachedEntity, this); - this->height.HALF.HI -= 4; + this->child = &gPlayerEntity; + CopyPosition(this->child, this); + this->z.HALF.HI -= 4; if (this->type != 0x5F && sub_08081420(this)) { sub_08081404(this, 1); } diff --git a/src/object/jailBars.c b/src/object/jailBars.c index fd534907..da5844e5 100644 --- a/src/object/jailBars.c +++ b/src/object/jailBars.c @@ -24,7 +24,7 @@ void sub_080A08C4(Entity* this) { InitializeAnimation(this, 1); sub_080A0960(this, 1); } - this->spriteSettings.b.draw = 3; // ??? + this->spriteSettings.draw = 3; // ??? this->collisionLayer = 1; UpdateSpriteForCollisionLayer(this); } @@ -39,7 +39,7 @@ void sub_080A0910(Entity* this) { void sub_080A0938(Entity* this) { GetNextFrame(this); - if ((this->frames.b.f3) != 0) { + if (this->frame & 0x80) { this->action = 3; InitializeAnimation(this, 1); } diff --git a/src/object/jarPortal.c b/src/object/jarPortal.c index 8262fa0a..b5eddce6 100644 --- a/src/object/jarPortal.c +++ b/src/object/jarPortal.c @@ -63,21 +63,21 @@ void sub_0808BF58(Entity* this) { sub_08003FC4(this, 0x2000); switch (this->subAction) { case 0: - if (this->hVelocity <= 98303) { + if (this->zVelocity <= 98303) { ++this->subAction; InitAnimationForceUpdate(this, 2); } break; case 1: UpdateAnimationSingleFrame(this); - if (!this->height.HALF.HI) { + if (!this->z.HALF.HI) { ++this->subAction; - this->hVelocity = 0x8000; + this->zVelocity = 0x8000; } break; case 2: UpdateAnimationSingleFrame(this); - if (!this->height.HALF.HI) { + if (!this->z.HALF.HI) { ++this->action; this->field_0xf = 0; InitAnimationForceUpdate(this, 1); @@ -131,21 +131,21 @@ void sub_0808C0AC(Entity* this) { sub_08003FC4(this, 0x2000); switch (this->subAction) { case 0: - if (this->hVelocity <= 98303) { + if (this->zVelocity <= 98303) { this->subAction = 1; InitAnimationForceUpdate(this, 3); } break; case 1: UpdateAnimationSingleFrame(this); - if (!this->height.HALF.HI) { + if (!this->z.HALF.HI) { ++this->subAction; - this->hVelocity = 0x8000; + this->zVelocity = 0x8000; } break; case 2: UpdateAnimationSingleFrame(this); - if (!this->height.HALF.HI) { + if (!this->z.HALF.HI) { this->action = 1; InitAnimationForceUpdate(this, 0); sub_0808C148(this, 1); @@ -160,7 +160,7 @@ u32 sub_0808C128(Entity* this) { void sub_0808C13C(Entity* this) { this->subAction = 0; - this->hVelocity = 163840; + this->zVelocity = 163840; } void sub_0808C148(Entity* this, u32 a2) { diff --git a/src/object/lightableSwitch.c b/src/object/lightableSwitch.c index 1b8d651a..35496766 100644 --- a/src/object/lightableSwitch.c +++ b/src/object/lightableSwitch.c @@ -68,8 +68,8 @@ void sub_0809EAD8(Entity* this) { if (this->type2 != 0) { - this->attachedEntity = GetCurrentRoomProperty(this->type2); - sub_080A2CC0(this, &this->attachedEntity, &this->field_0x74.HWORD); + this->child = GetCurrentRoomProperty(this->type2); + sub_080A2CC0(this, &this->child, &this->field_0x74.HWORD); } else { SetTile(0x4050, COORD_TO_TILE(this), this->collisionLayer); @@ -86,7 +86,7 @@ void sub_0809EB30(Entity* this) { } puVar2 = &this->field_0x74.HWORD; if (!--*puVar2) { - sub_080A2CC0(this, &this->attachedEntity, puVar2); + sub_080A2CC0(this, &this->child, puVar2); } } } diff --git a/src/object/lilypadSmall.c b/src/object/lilypadSmall.c index 37f78580..94aec1f7 100644 --- a/src/object/lilypadSmall.c +++ b/src/object/lilypadSmall.c @@ -18,16 +18,16 @@ void LilypadSmall(Entity* this) { rand = Random(); this->field_0xf = rand; this->frameIndex = (rand >> 0x10) & 3; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; this->spritePriority.b0 = 7; - this->attachedEntity = GetCurrentRoomProperty(this->type2); - sub_080A2CC0(this, &this->attachedEntity, &this->field_0x70.HALF.LO); + this->child = GetCurrentRoomProperty(this->type2); + sub_080A2CC0(this, &this->child, &this->field_0x70.HALF.LO); } sub_080A2BE4(this, sub_08097ADC(this)); sub_08097B24(this); psVar4 = (u16*)&this->field_0x70; if (--*psVar4 == 0) { - sub_080A2CC0(this, &this->attachedEntity, psVar4); + sub_080A2CC0(this, &this->child, psVar4); } } @@ -40,7 +40,7 @@ u32 sub_08097ADC(Entity* this) { return 0; } else { gPlayerState.field_0x14 = 1; - if (gPlayerEntity.height.HALF.HI != 0) { + if (gPlayerEntity.z.HALF.HI != 0) { return 0; } else { return 1; diff --git a/src/object/lockedDoor.c b/src/object/lockedDoor.c index d82a3e3d..db9404dd 100644 --- a/src/object/lockedDoor.c +++ b/src/object/lockedDoor.c @@ -99,7 +99,7 @@ void sub_08083338(Entity* this) { this->field_0x7c.BYTES.byte2 = this->type & 3; this->hitbox = &gUnk_080FD170; this->spritePriority.b0 = 5; - this->frames.all = this->type & 0xF; + this->frame = this->type & 0xF; this->field_0x76.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI); this->field_0x74.HWORD = sub_080001DA(this->field_0x76.HWORD, this->collisionLayer); switch (this->type2) { @@ -225,7 +225,7 @@ void sub_080835F8(Entity* this) { void sub_08083638(Entity* this) { this->action = 7; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->x.HALF.HI = this->field_0x70.HALF.LO; this->y.HALF.HI = this->field_0x70.HALF.HI; } @@ -244,7 +244,7 @@ void sub_08083658(Entity* this) { void sub_080836A0(Entity* this) { this->action = 6; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->x.HALF.HI = this->field_0x70.HALF.LO; this->y.HALF.HI = this->field_0x70.HALF.HI; SetTile(0x4022, this->field_0x76.HWORD, this->collisionLayer); @@ -254,7 +254,7 @@ void sub_080836DC(Entity* this, u32 unk_0, u32 unk_1) { const struct_0811F680* tmp; SetTile(0x4022, unk_1, this->collisionLayer); this->actionDelay = 7; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->direction = (unk_0 << 3) ^ 0x10; tmp = &gUnk_0811F688[unk_0]; if (this->type2 != 2) { diff --git a/src/object/mask.c b/src/object/mask.c index cd94a1b5..c5e0c12d 100644 --- a/src/object/mask.c +++ b/src/object/mask.c @@ -47,7 +47,7 @@ void sub_080929A4(Entity* this) { } this->action = 1; - this->hVelocity = 0x18000; + this->zVelocity = 0x18000; this->field_0x78.HWORD = ((Random() & 7) << 10) | 0x2000; @@ -92,7 +92,7 @@ void sub_08092A94(Entity* this) { this->action = 2; - this->height.HALF.HI -= 0x20; + this->z.HALF.HI -= 0x20; this->y.HALF.HI += 0x20; this->spriteRendering.b3 = 2; @@ -118,7 +118,7 @@ void sub_08092B0C(Entity* this) { } else { sub_080044EC(this, this->field_0x78.HWORD); - if (this->height.HALF.HI == 0) { + if (this->z.HALF.HI == 0) { this->actionDelay++; } } diff --git a/src/object/metalDoor.c b/src/object/metalDoor.c index a65cf709..13ac3763 100644 --- a/src/object/metalDoor.c +++ b/src/object/metalDoor.c @@ -25,9 +25,9 @@ void sub_080A0684(Entity* this) { } this->action = 1; this->speed = 0x300; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->frameIndex = 0; - this->spriteSettings.b.flipY = 1; + this->spriteSettings.flipY = 1; this->hitbox = &gUnk_080FD180; this->spritePriority.b0 = 5; this->field_0x70.HALF.LO = this->x.HALF.HI; @@ -39,7 +39,7 @@ void sub_080A0718(Entity* this) { if (sub_08083734(this, 2) != 0) { this->action = 2; this->actionDelay = 0xc; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; this->direction = 0; this->y.HALF.HI += 0x24; sub_080A080C(this); @@ -54,7 +54,7 @@ void sub_080A074C(Entity* this) { if (--this->actionDelay == 0) { this->action = 3; - this->height.HALF.HI = 0; + this->z.HALF.HI = 0; this->x.HALF.HI = this->field_0x70.HALF.LO; this->y.HALF.HI = this->field_0x70.HALF.HI; ent = CreateFx(this, FX_DASH, 0x40); diff --git a/src/object/minecart.c b/src/object/minecart.c index a1c79b41..002c4946 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -60,7 +60,7 @@ void sub_080916EC(Entity* this) { void sub_080917DC(Entity* this) { if ((this->bitfield & 0x7f) == 0x1d) { - this->hVelocity = 0x2a000; + this->zVelocity = 0x2a000; this->action = 7; InitAnimationForceUpdate(this, this->type2 + 4 + this->animationState); SoundReq(SFX_13B); @@ -80,7 +80,7 @@ void sub_080917DC(Entity* this) { this->action = this->action + 1; gPlayerState.jumpStatus = 0x81; gPlayerState.flags |= 0x4000000; - gPlayerEntity.hVelocity = 0x20000; + gPlayerEntity.zVelocity = 0x20000; gPlayerEntity.speed = 0x100; gPlayerEntity.flags &= 0x7f; ResetPlayer(); @@ -97,8 +97,8 @@ void sub_080918A4(Entity* this) { if (sub_080041A0(this, &gPlayerEntity, 2, 2) != 0) { gPlayerEntity.x.HALF.HI = this->x.HALF.HI; gPlayerEntity.y.HALF.HI = this->y.HALF.HI; - if (gPlayerEntity.height.HALF.HI > -0x10) { - if ((s32)gPlayerEntity.hVelocity > -1) { + if (gPlayerEntity.z.HALF.HI > -0x10) { + if ((s32)gPlayerEntity.zVelocity > -1) { return; } gPlayerEntity.animationState = this->animationState << 1; @@ -118,7 +118,7 @@ void sub_080918A4(Entity* this) { } else { gPlayerEntity.direction = GetFacingDirection(&gPlayerEntity, this); } - if (gPlayerEntity.hVelocity < 0) { + if (gPlayerEntity.zVelocity < 0) { gPlayerEntity.spritePriority.b0 = this->spritePriority.b0 - 1; } } @@ -133,10 +133,10 @@ void sub_080919AC(Entity* this) { return; } - if ((gPlayerEntity.frames.all & 0xf) == 0) { + if ((gPlayerEntity.frame & 0xf) == 0) { COLLISION_OFF(this); CopyPosition(this, &gPlayerEntity); - if ((gPlayerEntity.frames.all & 0xf0) == 0x10) { + if ((gPlayerEntity.frame & 0xf0) == 0x10) { this->spriteOffsetY = 1; } else { this->spriteOffsetY = 0; @@ -175,7 +175,7 @@ void sub_080919AC(Entity* this) { sub_08017744(this); gPlayerState.jumpStatus = 0x41; gPlayerState.flags = (gPlayerState.flags ^ 0x1000) | 0x4000000; - gPlayerEntity.hVelocity = 0x20000; + gPlayerEntity.zVelocity = 0x20000; gPlayerEntity.speed = 0x200; gPlayerEntity.animationState = this->animationState << 1; gPlayerEntity.direction = this->direction; diff --git a/src/object/minishLight.c b/src/object/minishLight.c index 458a0864..d7fc7bb4 100644 --- a/src/object/minishLight.c +++ b/src/object/minishLight.c @@ -14,7 +14,7 @@ void sub_0809F840(Entity* this) { this->field_0xf = 0; if (this->type2 != 0) { - this->spriteSettings.b.flipX = 1; + this->spriteSettings.flipX = 1; } UpdateSpriteForCollisionLayer(this); diff --git a/src/object/minishSizedEntrance.c b/src/object/minishSizedEntrance.c index ddd776ae..cff1f9ed 100644 --- a/src/object/minishSizedEntrance.c +++ b/src/object/minishSizedEntrance.c @@ -27,12 +27,12 @@ void sub_08090F00(Entity* this) { if (this->type == 1) { Entity* parent = this->parent; u32 mask = 1 << this->field_0xf; - if (!(parent->hVelocity & mask)) { + if (!(parent->zVelocity & mask)) { DeleteThisEntity(); } } - if ((gPlayerState.flags & 0x80) && sub_080041A0(this, &gPlayerEntity, 4, 4) && - (gPlayerEntity.height.HALF.HI == 0) && (((u16)gPlayerState.field_0x90.HALF.LO) & gUnk_0812225C[this->type2])) { + if ((gPlayerState.flags & 0x80) && sub_080041A0(this, &gPlayerEntity, 4, 4) && (gPlayerEntity.z.HALF.HI == 0) && + (((u16)gPlayerState.field_0x90.HALF.LO) & gUnk_0812225C[this->type2])) { DoExitTransition(GetCurrentRoomProperty(this->actionDelay)); } } diff --git a/src/object/object1A.c b/src/object/object1A.c index 494ba821..e515a30b 100644 --- a/src/object/object1A.c +++ b/src/object/object1A.c @@ -19,21 +19,21 @@ void sub_080869DC(Entity* ent) { Entity* itemEntity; ent->action = 1; - ent->spriteSettings.b.draw = 0; + ent->spriteSettings.draw = 0; ent->hitbox = &gUnk_080FD1A8; ent->field_0x3c |= 16; itemEntity = CreateObject(GROUND_ITEM, ent->type, 0); if (itemEntity != NULL) { itemEntity->actionDelay = 10; itemEntity->parent = ent; - ent->attachedEntity = itemEntity; + ent->child = itemEntity; CopyPosition(ent, itemEntity); sub_08086A6C(ent); } } void sub_08086A28(Entity* ent) { - if (ent->attachedEntity->next == NULL) { + if (ent->child->next == NULL) { ent->action = 2; } else { u32 iVar1 = sub_080044EC(ent, 10240); @@ -41,12 +41,12 @@ void sub_08086A28(Entity* ent) { ent->action = 2; } ProcessMovement(ent); - CopyPosition(ent, ent->attachedEntity); + CopyPosition(ent, ent->child); } } void sub_08086A5C(Entity* ent) { - ent->attachedEntity->parent = NULL; + ent->child->parent = NULL; DeleteThisEntity(); } @@ -54,7 +54,7 @@ void sub_08086A6C(Entity* ent) { u32 uVar1; uVar1 = Random(); - ent->hVelocity = 163840; + ent->zVelocity = 163840; ent->direction = (uVar1 >> 16) & 31; ent->speed = uVar1 & 480; } diff --git a/src/object/object1C.c b/src/object/object1C.c index 3bd9af76..be2289cb 100644 --- a/src/object/object1C.c +++ b/src/object/object1C.c @@ -13,7 +13,7 @@ void Object1C(Entity* this) { this->action = 1; } if (CheckRectOnScreen(this->field_0x80.HWORD, this->field_0x82.HWORD, 0x10, 0x10) == 0) { - this->parent->hVelocity &= ~(1 << this->type2); + this->parent->zVelocity &= ~(1 << this->type2); DeleteThisEntity(); } } diff --git a/src/object/object2A.c b/src/object/object2A.c index dca66978..edc742c0 100644 --- a/src/object/object2A.c +++ b/src/object/object2A.c @@ -11,7 +11,7 @@ void Object2A(Entity* this) { void sub_08089B18(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; if (this->type2 != 0) { this->actionDelay = this->type2; } @@ -30,7 +30,7 @@ void sub_08089B18(Entity* this) { break; case 4: if (!CheckFlags(this->field_0x86.HWORD)) { - this->spriteSettings.b.draw = FALSE; + this->spriteSettings.draw = FALSE; this->subAction = 1; return; } diff --git a/src/object/object49.c b/src/object/object49.c index 02aac844..8b7c1bf3 100644 --- a/src/object/object49.c +++ b/src/object/object49.c @@ -34,12 +34,12 @@ void sub_0808F0D0(Entity* this) { u32 uVar3; ent = CreateObjectWithParent(this, OBJECT_49, 2, 0); - this->attachedEntity = ent; + this->child = ent; if (ent == NULL) { DeleteThisEntity(); } this->action = 1; - this->height.HALF.HI = -0xc0; + this->z.HALF.HI = -0xc0; offsetX = Random() % 64; if ((Random() & 1) != 0) { offsetX = -offsetX; @@ -79,7 +79,7 @@ void sub_0808F1A4(Entity* this) { *(u32*)&this->field_0x74 += 0x10; sub_0806FCF4(this, *(u32*)&this->field_0x78, 8, 2); if (*(u32*)&this->field_0x78 > 0x3ff) { - this->attachedEntity->action = 0xff; + this->child->action = 0xff; DeleteThisEntity(); } else { sub_0808F2B0(this); @@ -104,12 +104,12 @@ void sub_0808F1F8(Entity* this) { void sub_0808F244(Entity* this) { - this->spriteSettings.b.draw = this->parent->spriteSettings.b.draw; + this->spriteSettings.draw = this->parent->spriteSettings.draw; this->y.HALF.HI = this->parent->y.HALF.HI + 3; - this->x.HALF.HI = (*(s8*)&this->attachedEntity->spriteOffsetX + this->attachedEntity->x.HALF.HI); - this->height.WORD = 0; - *(u32*)&this->field_0x74 = 0x80 - this->parent->height.HALF.HI; - *(u32*)&this->field_0x78 = 0x100 - this->parent->height.HALF.HI; + this->x.HALF.HI = (*(s8*)&this->child->spriteOffsetX + this->child->x.HALF.HI); + this->z.WORD = 0; + *(u32*)&this->field_0x74 = 0x80 - this->parent->z.HALF.HI; + *(u32*)&this->field_0x78 = 0x100 - this->parent->z.HALF.HI; *(u32*)&this->field_0x70.WORD = *((u8*)&this->parent->field_0x7c + 3); sub_0808F2B0(this); if ((this->parent->field_0x6c.HALF.HI & 2) != 0) { @@ -126,20 +126,20 @@ void sub_0808F2C0(Entity* this) { this->action++; this->spriteRendering.b3 = this->parent->spriteRendering.b3; this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spritePriority.b0 = 7; - this->height.WORD = 0; + this->z.WORD = 0; this->y.HALF.HI = this->parent->y.HALF.HI + 3; this->x.HALF.HI = this->parent->x.HALF.HI; InitializeAnimation(this, 3); } - if (this->parent->height.HALF.HI == 0) { + if (this->parent->z.HALF.HI == 0) { *(u32*)&this->field_0x74 = *(u32*)&this->parent->field_0x74; *(u32*)&this->field_0x78 = *(u32*)&this->parent->field_0x78; } else { - *(u32*)&this->field_0x74 = 0x200 - this->parent->height.HALF.HI; - *(u32*)&this->field_0x78 = this->parent->height.HALF.HI * -2 + 0x300; + *(u32*)&this->field_0x74 = 0x200 - this->parent->z.HALF.HI; + *(u32*)&this->field_0x78 = this->parent->z.HALF.HI * -2 + 0x300; } *(u32*)&this->field_0x70 = 0; sub_0808F2B0(this); @@ -177,39 +177,39 @@ void sub_0808F370(Entity* this) { void sub_0808F3DC(Entity* this) { if (this->action == 0) { - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->action = 1; this->actionDelay = 120; InitializeAnimation(this, this->type + 1); // TODO: This block of code might supposed to be a switch statement. if (this->type != 8) { if (this->type == 7) { - sub_0806FAD8(this->attachedEntity, this); + sub_0806FAD8(this->child, this); return; } } else { - this->hitType = this->attachedEntity->hitType; - this->attachedEntity->hitType = 0x7E; + this->hitType = this->child->hitType; + this->child->hitType = 0x7E; } - ResolveEntityOnTop(this->attachedEntity, this); + ResolveEntityOnTop(this->child, this); } else { if (*(u32*)&this->parent->field_0x74 == 0) { if (this->type == 8) { - this->attachedEntity->hitType = this->hitType; + this->child->hitType = this->hitType; } DeleteThisEntity(); } - if (this->type == 5 && this->frames.b.f0) { - Entity* entity = CreateObjectWithParent(this->attachedEntity, 0x49, 8, 0); + if (this->type == 5 && (this->frame & 1)) { + Entity* entity = CreateObjectWithParent(this->child, 0x49, 8, 0); if (entity) { entity->parent = this->parent; - entity->attachedEntity = this->parent->parent; + entity->child = this->parent->parent; } } GetNextFrame(this); - CopyPositionAndSpriteOffset(this->attachedEntity, this); + CopyPositionAndSpriteOffset(this->child, this); } } @@ -268,22 +268,22 @@ void sub_0808F554(Entity* this) { } void sub_0808F5EC(Entity* this) { - Entity* entity = CreateObjectWithParent(this->attachedEntity, 0x49, 5, 0); + Entity* entity = CreateObjectWithParent(this->child, 0x49, 5, 0); if (entity) { entity->parent = this; - entity->attachedEntity = this->attachedEntity; + entity->child = this->child; } - entity = CreateObjectWithParent(this->attachedEntity, 0x49, 6, 0); + entity = CreateObjectWithParent(this->child, 0x49, 6, 0); if (entity) { entity->parent = this; - entity->attachedEntity = this->attachedEntity; + entity->child = this->child; } - entity = CreateObjectWithParent(this->attachedEntity, 0x49, 7, 0); + entity = CreateObjectWithParent(this->child, 0x49, 7, 0); if (entity) { entity->parent = this; - entity->attachedEntity = this->attachedEntity; + entity->child = this->child; } *(u32*)&this->field_0x74 = 600; diff --git a/src/object/object7E.c b/src/object/object7E.c index c456a841..15785d8f 100644 --- a/src/object/object7E.c +++ b/src/object/object7E.c @@ -12,15 +12,15 @@ void Object7E(Entity* this) { this->spritePriority.b0 = 7; this->frameIndex = 0x28; if (this->type == 0) { - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; } else if (this->type == 2) { - this->spriteSettings.b.flipX = TRUE; + this->spriteSettings.flipX = TRUE; } } PositionRelative(this->parent, this, 0, 0x80000); - this->height.HALF.HI = 0; + this->z.HALF.HI = 0; if (this->type != 0) { - this->spriteSettings.b.draw = this->attachedEntity->spriteSettings.b.draw; - this->frameIndex = this->attachedEntity->frameIndex + 0x1f; + this->spriteSettings.draw = this->child->spriteSettings.draw; + this->frameIndex = this->child->frameIndex + 0x1f; } } diff --git a/src/object/object86.c b/src/object/object86.c index 717e3ad0..a9bf512d 100644 --- a/src/object/object86.c +++ b/src/object/object86.c @@ -32,11 +32,11 @@ void sub_08099DD0(Entity* this) { void sub_08099E10(Entity* this) { if (CheckLocalFlag(0x74)) { GetNextFrame(this); - if ((this->frames.all == 1) && (this->subAction == 0)) { - this->frames.all = 0; + if ((this->frame == 1) && (this->subAction == 0)) { + this->frame = 0; sub_08099ECC(this); } - if (this->frames.b.f3) { + if (this->frame & 0x80) { this->action = 2; InitializeAnimation(this, 1); } @@ -45,8 +45,8 @@ void sub_08099E10(Entity* this) { void sub_08099E58(Entity* this) { GetNextFrame(this); - if (this->frames.b.f3) { - this->frames.b.f3 = 0; + if (this->frame & 0x80) { + this->frame &= ~0x80; this->actionDelay++; if (this->actionDelay == 3) { this->action = 3; diff --git a/src/object/object9E.c b/src/object/object9E.c index ea6b1787..6fdbdd29 100644 --- a/src/object/object9E.c +++ b/src/object/object9E.c @@ -31,7 +31,7 @@ void Object9E(Entity* this) { UpdateSpriteForCollisionLayer(this); ent = CreateObject(OBJECT_9E, 1, 0); if (ent != NULL) { - this->attachedEntity = ent; + this->child = ent; CopyPosition(this, ent); } } else { diff --git a/src/object/objectA2.c b/src/object/objectA2.c index a2092bb7..09a698a9 100644 --- a/src/object/objectA2.c +++ b/src/object/objectA2.c @@ -32,11 +32,11 @@ void ObjectA2(Entity* this) { void sub_0809F318(Entity* this) { InitializeAnimation(this, 0); if (Random() & 0x10) { - this->spriteSettings.b.flipX = 1; + this->spriteSettings.flipX = 1; } this->x.HALF.HI = 0x28; this->y.HALF.HI = 0x48; - this->height.HALF.HI = 0xFFB0; + this->z.HALF.HI = 0xFFB0; this->spriteOrientation.flipY = 2; this->action = 1; sub_0801D2B4(this, gUnk_08124704[this->type]); @@ -48,7 +48,7 @@ void sub_0809F374(Entity* this) { #ifndef EU if (gSaveHeader->gameLanguage < 2) { if (sub_080044EC(this, 0x2000) < 2) { - this->height.WORD = 0; + this->z.WORD = 0; this->action = 2; InitializeAnimation(this, 1); SoundReq(SFX_186); @@ -76,16 +76,16 @@ void sub_0809F374(Entity* this) { } void sub_0809F3E8(Entity* this) { - if (this->frames.b.f3) { + if (this->frame & 0x80) { this->action = 3; InitializeAnimation(this, 2); } } void sub_0809F408(Entity* this) { - switch (this->frames.all) { + switch (this->frame) { case 9: - this->frames.all = 0; + this->frame = 0; CreateFx(this, FX_BIG_EXPLOSION2, 0); gMenu.field_0x0 = 1; break; diff --git a/src/object/objectA8.c b/src/object/objectA8.c index c1a5193a..fbba13c3 100644 --- a/src/object/objectA8.c +++ b/src/object/objectA8.c @@ -21,7 +21,7 @@ void ObjectA8(Entity* this) { case 0x1e: case 0x1f: this->action = 5; - this->attachedEntity = &gPlayerEntity; + this->child = &gPlayerEntity; CreateItemEntity(this->type, 0, 0); DeleteThisEntity(); } diff --git a/src/object/objectAF.c b/src/object/objectAF.c index b678d81b..0aff1ed3 100644 --- a/src/object/objectAF.c +++ b/src/object/objectAF.c @@ -19,7 +19,7 @@ void sub_080A05A4(Entity* this) { } else { this->action = 2; this->y.HALF.HI++; - this->height.HALF.HI = 0; + this->z.HALF.HI = 0; this->spriteOffsetY--; InitializeAnimation(this, 3); } @@ -40,7 +40,7 @@ void sub_080A05F4(Entity* this) { void sub_080A0624(Entity* this) { GetNextFrame(this); - if ((this->frames.b.f3) != 0) { + if (this->frame & 0x80) { DeleteThisEntity(); } } @@ -51,5 +51,5 @@ void sub_080A0640(Entity* this) { } else { CopyPosition(this->parent, this); } - this->height.HALF.HI = 0; + this->z.HALF.HI = 0; } diff --git a/src/object/objectB2.c b/src/object/objectB2.c index 0888ed38..75150bab 100644 --- a/src/object/objectB2.c +++ b/src/object/objectB2.c @@ -19,16 +19,16 @@ void ObjectB2(Entity* this) { } else { pEVar3 = &gUnk_02027EB4; } - this->attachedEntity = pEVar3; + this->child = pEVar3; InitializeAnimation(this, this->type); } this->speed = this->parent->speed; sub_0806F69C(this); - if (sub_080AE4CC(this->attachedEntity, this->x.HALF.HI, this->y.HALF.HI, 9) != 0) { + if (sub_080AE4CC(this->child, this->x.HALF.HI, this->y.HALF.HI, 9) != 0) { DeleteThisEntity(); } if (this->speed < 0x41) { - this->spriteSettings.b.draw ^= 1; + this->spriteSettings.draw ^= 1; if (--this->actionDelay == 0) { DeleteThisEntity(); diff --git a/src/object/pinwheel.c b/src/object/pinwheel.c index 7de61338..37234dc5 100644 --- a/src/object/pinwheel.c +++ b/src/object/pinwheel.c @@ -10,7 +10,7 @@ extern u16 gUnk_08125050[]; extern void (*gUnk_0812505C[])(Entity*); void Pinwheel(Entity* this) { - u16 x = this->currentHealth; + u16 x = this->health; if ((x & 0x7f) != 0) { if (ReadBit(&gUnk_020342F8, x - 1) == 0) { DeleteThisEntity(); diff --git a/src/object/pot.c b/src/object/pot.c index ce0fa0bf..58989f44 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -38,7 +38,7 @@ void sub_0808222C(Entity* this) { this->y.HALF.HI += 3; this->field_0x16 = 0; COLLISION_ON(this); - this->currentHealth = 1; + this->health = 1; this->field_0x3c = 7; this->hitType = 0x6E; this->flags2 = 0x84; @@ -67,9 +67,9 @@ void sub_08082310(Entity* this) { case 0x1D: SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); this->action = 5; - this->hVelocity = 0x2A000; + this->zVelocity = 0x2A000; this->spriteOffsetY = 0; - this->spriteSettings.b.shadow = 1; + this->spriteSettings.shadow = 1; this->spritePriority.b1 = 3; COLLISION_OFF(this); sub_08082824(this); @@ -251,8 +251,8 @@ void sub_08082818(Entity* this) { } void sub_08082824(Entity* this) { - if (this->hVelocity < 0) { - this->spriteSettings.b.flipY = 1; + if (this->zVelocity < 0) { + this->spriteSettings.flipY = 1; } if (sub_08003FC4(this, 0x2000) == 0) { diff --git a/src/object/railtrack.c b/src/object/railtrack.c index 52a74bc3..00fbb4ec 100644 --- a/src/object/railtrack.c +++ b/src/object/railtrack.c @@ -22,7 +22,7 @@ void sub_080851AC(Entity* this) { u32 uVar1; this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spritePriority.b0 = 7; if ((this->type2 & 1) != 0) { this->field_0x7c.HALF.LO = -1; diff --git a/src/object/smoke.c b/src/object/smoke.c index 565daa79..17ec7ad0 100644 --- a/src/object/smoke.c +++ b/src/object/smoke.c @@ -36,7 +36,7 @@ void sub_0808A46C(Entity* this) { void sub_0808A484(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; this->speed = 0x40; this->direction = 6; this->spriteRendering.b3 = 1; @@ -48,7 +48,7 @@ void sub_0808A484(Entity* this) { void sub_0808A4D0(Entity* this) { GetNextFrame(this); sub_0806F69C(this); - if (this->frames.b.f3) { + if (this->frame & 0x80) { DeleteEntity(this); } } diff --git a/src/object/thoughtBubble.c b/src/object/thoughtBubble.c index 70ad3c73..1789195b 100644 --- a/src/object/thoughtBubble.c +++ b/src/object/thoughtBubble.c @@ -13,7 +13,7 @@ void ThoughtBubble(Entity* this) { void ThoughtBubble_Init(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; if (this->actionDelay == 0) { this->actionDelay = 0x2d; } @@ -26,7 +26,7 @@ void ThoughtBubble_Update(Entity* this) { if (this->parent != NULL) { this->x.HALF.HI = this->parent->x.HALF.HI; this->y.HALF.HI = this->parent->y.HALF.HI; - this->height.HALF.HI = this->parent->height.HALF.HI; + this->z.HALF.HI = this->parent->z.HALF.HI; } if (this->type2 != 2) { if (--this->actionDelay == 0) { diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c index dcaf3ebc..94ba273a 100644 --- a/src/object/treeHidingPortal.c +++ b/src/object/treeHidingPortal.c @@ -52,7 +52,7 @@ void sub_0809E8BC(Entity* this) { if (--this->actionDelay == 0) { this->action = 3; this->actionDelay = 0x3c; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; sub_0809E96C(this); sub_0809E918(this); } diff --git a/src/object/warpPoint.c b/src/object/warpPoint.c index fc6239d1..d20ceadf 100644 --- a/src/object/warpPoint.c +++ b/src/object/warpPoint.c @@ -77,7 +77,7 @@ void sub_0808B564(Entity* this) { if (!--this->field_0xf) { this->action = 3; } else { - this->spriteSettings.b.draw = this->field_0xf & 2 ? 0 : 1; + this->spriteSettings.draw = this->field_0xf & 2 ? 0 : 1; } } @@ -177,7 +177,7 @@ void sub_0808B684(Entity* this) { tmp = 1; } } else { - gPlayerEntity.spriteSettings.b.draw = 0; + gPlayerEntity.spriteSettings.draw = 0; } break; } @@ -194,20 +194,20 @@ void sub_0808B73C(Entity* this) { InitializeAnimation(this, 1); } if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28)) { - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } else { if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x2e)) { - this->spriteSettings.b.draw ^= 1; + this->spriteSettings.draw ^= 1; } else { - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } } GetNextFrame(this); } u32 sub_0808B7C8(Entity* this) { - if (!(gPlayerState.flags & 0x80) && gPlayerState.field_0xa8 != 0x12 && gPlayerEntity.currentHealth != 0 && - sub_08079F8C() && sub_080041A0(this, &gPlayerEntity, 5, 5) && gPlayerEntity.height.HALF.HI == 0) { + if (!(gPlayerState.flags & 0x80) && gPlayerState.field_0xa8 != 0x12 && gPlayerEntity.health != 0 && + sub_08079F8C() && sub_080041A0(this, &gPlayerEntity, 5, 5) && gPlayerEntity.z.HALF.HI == 0) { if (this->actionDelay == 0 && gPlayerEntity.action == 0x1b) { sub_080791D0(); } @@ -220,7 +220,7 @@ void sub_0808B830(Entity* this) { Entity* tmp; this->action = 3; this->actionDelay = 0; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; tmp = CreateObject(0x34, 0, 0); if (tmp) { tmp->field_0x70.BYTES.byte0 = 1; diff --git a/src/object/windTribeFlag.c b/src/object/windTribeFlag.c index bc9d0fa3..1fcfea7d 100644 --- a/src/object/windTribeFlag.c +++ b/src/object/windTribeFlag.c @@ -7,9 +7,9 @@ void WindTribeFlag(Entity* this) { this->action++; this->collisionLayer = 2; if (this->type == 0) { - this->spriteSettings.b.flipX = 0; + this->spriteSettings.flipX = 0; } else { - this->spriteSettings.b.flipX = 1; + this->spriteSettings.flipX = 1; } UpdateSpriteForCollisionLayer(this); InitializeAnimation(this, 0); diff --git a/src/player.c b/src/player.c index ad3107fe..b89a9fde 100644 --- a/src/player.c +++ b/src/player.c @@ -93,7 +93,7 @@ void PlayerInit(Entity* this) { COLLISION_ON(this); this->spritePriority.b0 = 0xc; this->spritePriority.b1 = 1; - this->spriteSettings.b.shadow = 1; + this->spriteSettings.shadow = 1; this->field_0x16 = 0x20; this->flags2 = 8; this->hitType = 0x79; @@ -178,10 +178,10 @@ void sub_08070C3C(Entity* this) { void sub_08070CB4(Entity* this) { UpdateAnimationSingleFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { if ((gSave.stats.health != 0) && ((gPlayerState.flags & 0x8000) != 0)) { gPlayerState.flags &= ~(0x1 | 0x4); - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } else { gPlayerState.flags &= ~(0x4 | 0x8000); RespawnPlayer(); @@ -206,12 +206,12 @@ void sub_08070D38(Entity* this) { this->spriteIndex = 1; if ((gPlayerState.flags & 0x80) == 0) { - this->hVelocity = 0x20000; + this->zVelocity = 0x20000; gPlayerState.field_0x8 = 0x114; sub_08080964(16, 0); } else { gPlayerState.field_0x8 = 0xc18; - this->hVelocity = 0x18000; + this->zVelocity = 0x18000; } gPlayerState.jumpStatus = 0x80; @@ -242,7 +242,7 @@ NONMATCH("asm/non_matching/player/sub_08070DC4.inc", void sub_08070DC4(Entity* t } if (--this->actionDelay != 0xFF) { - this->hVelocity = 0x10000; + this->zVelocity = 0x10000; return; } @@ -312,7 +312,7 @@ void PlayerItemGet(Entity* this) { COLLISION_OFF(this); gUnk_0811BA7C[this->subAction](this); - child = this->attachedEntity; + child = this->child; if (child != NULL) { PositionEntityOnTop(this, child); temp = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex); @@ -324,7 +324,7 @@ void PlayerItemGet(Entity* this) { void sub_08070FA4(Entity* this) { u16 temp; - this->spriteSettings.b.flipX = FALSE; + this->spriteSettings.flipX = FALSE; this->animationState = 4; gPlayerState.flags |= 1; @@ -354,7 +354,7 @@ void sub_08070FA4(Entity* this) { void sub_08071020(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frames.all != 0) + if (this->frame != 0) this->subAction = 2; } @@ -365,8 +365,8 @@ void sub_08071038(Entity* this) { if (sub_08078EFC() || (gMessage.doTextBox & 0x7f)) return; - if (this->frames.all & 0x80) { - this->attachedEntity = 0; + if (this->frame & 0x80) { + this->child = 0; this->knockbackDuration = 0; this->iframes = 248; gPlayerState.jumpStatus = 0; @@ -406,7 +406,7 @@ void sub_080710A8(Entity* this) { temp = sub_08079FC4(1); asm("lsl r0, r0, #0x4"); - this->hVelocity = (temp - 4) * 64 * 64; + this->zVelocity = (temp - 4) * 64 * 64; this->speed = 256; sub_0807A108(); @@ -422,7 +422,7 @@ void sub_08071130(Entity* this) { if (gPlayerState.field_0x1a[1] == 0) { UpdateAnimationSingleFrame(this); - if (this->frames.all & 1) + if (this->frame & 1) return; } @@ -522,7 +522,7 @@ void sub_080712F0(Entity* this) { if ((gPlayerState.flags & 0x80) != 0) { if (--this->actionDelay == 0) temp = TRUE; - } else if ((this->frames.all & 0x80) != 0) { + } else if ((this->frame & 0x80) != 0) { if (this->animIndex != 0xce) gPlayerState.field_0x8 = 0x2ce; else @@ -535,7 +535,7 @@ void sub_080712F0(Entity* this) { this->knockbackDuration = 0; this->iframes = 32; this->spritePriority.b1 = 1; - this->spriteSettings.b.draw = FALSE; + this->spriteSettings.draw = FALSE; gPlayerState.flags &= ~0x4; RespawnPlayer(); } @@ -587,7 +587,7 @@ void PortalJumpOnUpdate(Entity* this) { gPlayerState.flags |= 0x20; this->subAction = 1; this->animationState = 4; - this->spriteSettings.b.flipX = FALSE; + this->spriteSettings.flipX = FALSE; if (gArea.curPortalType == 4) { gPlayerState.field_0x8 = 0x52c; } @@ -615,7 +615,7 @@ void PortalStandUpdate(Entity* this) { if (--this->actionDelay == 0xff) { this->direction = gPlayerState.field_0xd; this->animationState = this->direction >> 2; - this->hVelocity = 0x20000; + this->zVelocity = 0x20000; this->speed = 256; this->action = 9; this->subAction = 7; @@ -630,7 +630,7 @@ void PortalStandUpdate(Entity* this) { } if (gArea.curPortalType == 4) { - if (this->frames.all == 0) { + if (this->frame == 0) { UpdateAnimationSingleFrame(this); return; } @@ -682,7 +682,7 @@ void PortalEnterUpdate(Entity* this) { if (sub_08003FC4(this, 0x2000)) return; - this->spriteSettings.b.draw = FALSE; + this->spriteSettings.draw = FALSE; if (gArea.curPortalType == 3) { if (--this->field_0xf == 0) @@ -762,7 +762,7 @@ void sub_080718A0(Entity* this) { else gPlayerState.field_0x8 = 0x3c6; - this->spriteSettings.b.flipX = 0; + this->spriteSettings.flipX = 0; return; } @@ -774,10 +774,10 @@ void sub_0807193C(Entity* this) { Entity* child; UpdateAnimationSingleFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { this->subAction++; child = CreateObjectWithParent(this, OBJECT_6, 0, 0); - this->attachedEntity = child; + this->child = child; if (child != NULL) { if (this->animationState == 2) gPlayerState.field_0x8 = 0x3cc; @@ -814,7 +814,7 @@ void sub_08071990(Entity* this) { else temp = 0; - if (this->attachedEntity->actionDelay != 0) { + if (this->child->actionDelay != 0) { if ((u8)(temp + 200) != this->animIndex) { gPlayerState.field_0x8 = temp + 0x3c8; return; @@ -830,7 +830,7 @@ void sub_08071990(Entity* this) { void sub_08071A4C(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { sub_08071A6C(); sub_0807921C(); } @@ -937,7 +937,7 @@ void sub_08071BDC(Entity* this) { this->subAction = 1; this->animationState = 4; this->spritePriority.b1 = 1; - this->spriteSettings.b.draw = 3; + this->spriteSettings.draw = 3; gPlayerState.jumpStatus = 0; gPlayerState.pushedObject = 0; sub_0800451C(this); @@ -947,7 +947,7 @@ void sub_08071BDC(Entity* this) { void sub_08071CAC(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { u32 temp; if ((gPlayerState.flags & 0x80) == 0) temp = (gPlayerState.flags & 8) ? 0x45a : 0x2bd; @@ -966,7 +966,7 @@ void sub_08071D04(Entity* this) { int deltaHealth; UpdateAnimationSingleFrame(this); - if (this->frames.all == 0) + if (this->frame == 0) return; deltaHealth = 0; @@ -983,7 +983,7 @@ void sub_08071D04(Entity* this) { gPlayerState.field_0x3c[0] = 0; this->direction = 0xff; this->speed = 0; - this->hVelocity = 0x18000; + this->zVelocity = 0x18000; gPlayerState.jumpStatus = 1; gPlayerState.swimState = 0; return; @@ -1021,7 +1021,7 @@ void sub_08071DD0(Entity* this) { } void sub_08071E04(Entity* this) { - if ((this->height.WORD != 0) && (gPlayerState.field_0x14 == '\0')) { + if ((this->z.WORD != 0) && (gPlayerState.field_0x14 == '\0')) { sub_0807A1B8(); if (gPlayerState.field_0x10[2] == 1) { gPlayerState.field_0x10[1] = 7; @@ -1088,7 +1088,7 @@ void sub_08071EB0(Entity* this) { void sub_08071F14(Entity* this) { UpdateAnimationSingleFrame(this); - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { gPlayerState.field_0x2c = NULL; sub_0807921C(); } @@ -1169,10 +1169,10 @@ void sub_08072098(Entity* this) { return; else ; - else if ((this->frames.all & 0x80) == 0) + else if ((this->frame & 0x80) == 0) return; - if (this->currentHealth != 0) + if (this->health != 0) COLLISION_ON(this); sub_080791BC(); } @@ -1185,7 +1185,7 @@ void sub_080720DC(Entity* this) { } void sub_08072100(Entity* this) { - this->spriteSettings.b.draw = 3; + this->spriteSettings.draw = 3; this->speed = 0x140; this->hitbox = &gUnk_08114F88; this->actionDelay = gPlayerState.field_0x38; @@ -1275,14 +1275,14 @@ void sub_080722DC(Entity* this) { COLLISION_OFF(this); if (!(gPlayerState.flags & 0x80)) { this->subAction = 1; - this->hVelocity = 0x28000; + this->zVelocity = 0x28000; ent = CreateObject(OBJECT_42, 0x80, 0); if (ent != NULL) { - ent->attachedEntity = this; + ent->child = this; } gPlayerState.field_0x8 = 0x114; } else { - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->subAction = 3; this->knockbackDuration = 10; } @@ -1322,7 +1322,7 @@ void sub_080723D0(Entity* this) { void sub_0807240C(Entity* this) { if (--this->knockbackDuration == 0xff) { - this->spriteSettings.b.draw = 3; + this->spriteSettings.draw = 3; this->iframes = 0x14; gPlayerState.flags &= ~0x400; ModHealth(-2); @@ -1374,7 +1374,7 @@ void sub_080724DC(Entity* this) { UpdateAnimationSingleFrame(this); } } else { - this->spriteSettings.b.draw = 3; + this->spriteSettings.draw = 3; this->subAction = 1; if (gRoomVars.field_0x0 == 0) { if (gPlayerState.flags & 0x80) { @@ -1489,9 +1489,9 @@ void sub_080726F4(Entity* this) { if (gPlayerState.field_0x10[2] == 0x17) { sub_0800892E(this); } else { - switch (this->frames.all & 0xf) { + switch (this->frame & 0xf) { case 0: - if ((this->frames.all & 0xf) == 0) { + if ((this->frame & 0xf) == 0) { this->speed = 0x200; } break; @@ -1508,16 +1508,16 @@ void sub_080726F4(Entity* this) { sub_08078F24(); sub_08079E08(); } - if (((this->frames.all & 0x10) == 0) && ((gPlayerState.flags & 0x80) == 0)) { + if (((this->frame & 0x10) == 0) && ((gPlayerState.flags & 0x80) == 0)) { *(u8*)&this->hurtType = 0; } - if ((this->frames.all & 0x40) != 0) { + if ((this->frame & 0x40) != 0) { sub_08077698(this); } - if (((this->frames.all & 0x80) != 0) || (gPlayerState.field_0x3[1] != 0)) { + if (((this->frame & 0x80) != 0) || (gPlayerState.field_0x3[1] != 0)) { sub_080791D0(); } - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { gPlayerState.flags &= ~(0x200000 | 0x40000); } UpdateAnimationSingleFrame(this); @@ -1533,7 +1533,7 @@ void sub_080728AC(Entity* this) { if (gPlayerState.swimState != 0) this->speed = 0; if (!(gPlayerState.flags & 0x40)) - gPlayerEntity.spriteSettings.b.draw = 3; + gPlayerEntity.spriteSettings.draw = 3; if (!(gPlayerState.flags & 0x80)) gPlayerEntity.spritePriority.b1 = 1; @@ -1555,7 +1555,7 @@ void PlayerInHole(Entity* this) { } void sub_08072970(Entity* this) { - if (this->currentHealth != 0) { + if (this->health != 0) { this->subAction = 1; this->x.HALF.HI = (this->x.HALF.HI & ~0xF) | 8; this->y.HALF.HI = (this->y.HALF.HI & ~0XF) | 10; @@ -1580,7 +1580,7 @@ void sub_08072970(Entity* this) { } void sub_08072A60(Entity* this) { - if (this->frames.all & 0x80) { + if (this->frame & 0x80) { if (this->actionDelay == 1) { this->subAction = 3; this->actionDelay = 0x28; @@ -1606,7 +1606,7 @@ void sub_08072ACC(Entity* this) { } else if (this->field_0xf > 7) { COLLISION_ON(this); this->direction = gPlayerState.field_0xd; - this->hVelocity = 0x1a000; + this->zVelocity = 0x1a000; this->speed = 0x78; this->spritePriority.b0 = 4; this->spritePriority.b1 = 1; @@ -1636,8 +1636,8 @@ void sub_08072B5C(Entity* this) { COLLISION_ON(this); this->spritePriority.b0 = 4; this->speed = 0x40; - this->hVelocity = 0x39000; - this->height.WORD--; + this->zVelocity = 0x39000; + this->z.WORD--; gPlayerState.jumpStatus = 0x41; sub_0806F854(this, 0, -12); sub_0807921C(); @@ -1651,7 +1651,7 @@ void sub_08072B5C(Entity* this) { temp <<= 4; temp -= 4; temp <<= 12; - this->hVelocity = temp; + this->zVelocity = temp; this->speed = 0x100; gPlayerState.field_0x8 = 0x810; SoundReq(0x7c); @@ -1704,7 +1704,7 @@ void sub_08072CFC(Entity* this) { if (gPlayerState.field_0x38 < 8) { gPlayerState.field_0x38 = 8; } - this->hVelocity = gPlayerState.field_0x38 << 0xc; + this->zVelocity = gPlayerState.field_0x38 << 0xc; this->speed = 0x200; gPlayerState.field_0x8 = 0x810; this->actionDelay = 5; @@ -1846,7 +1846,7 @@ void sub_08072F94(Entity* this) { if (gPlayerState.field_0x10[2] == 0x1e) { return; } - if ((this->frames.all & 0x10)) { + if ((this->frame & 0x10)) { gPlayerState.field_0x8 = 0x2d4; } else { gPlayerState.field_0x8 = 0x2d5; @@ -1857,13 +1857,13 @@ void sub_08072F94(Entity* this) { this->direction = (bVar1 + 8) & 0x10; } if (this->direction & 0x10) { - if (this->frames.all & 0x10) { + if (this->frame & 0x10) { gPlayerState.field_0x8 = 0x2d1; } else { gPlayerState.field_0x8 = 0x2d2; } } else { - if (this->frames.all & 0x10) { + if (this->frame & 0x10) { gPlayerState.field_0x8 = 0x2cf; } else { gPlayerState.field_0x8 = 0x2d0; @@ -1872,7 +1872,7 @@ void sub_08072F94(Entity* this) { } this->subAction++; } else { - if (this->frames.all & 0x10) { + if (this->frame & 0x10) { gPlayerState.field_0x8 = 0x2d4; } else { gPlayerState.field_0x8 = 0x2d5; @@ -1886,7 +1886,7 @@ extern const u16 gUnk_0811BBEC[]; void sub_08073094(Entity* this) { this->spritePriority.b1 = 0; - this->speed = gUnk_0811BBEC[this->frames.all & 0xf]; + this->speed = gUnk_0811BBEC[this->frame & 0xf]; sub_08079E08(); if (!sub_08019840()) { gPlayerState.pushedObject = gPlayerState.pushedObject ^ 0x80; @@ -1901,7 +1901,7 @@ void sub_08073094(Entity* this) { this->knockbackDuration = 0; gPlayerState.flags |= 0x20000000; UpdateAnimationSingleFrame(this); - if ((this->frames.all & 0x40) != 0) { + if ((this->frame & 0x40) != 0) { sub_0807A1B8(); if (!sub_08078EFC()) { this->subAction--; @@ -1918,7 +1918,7 @@ void sub_08073094(Entity* this) { case 0x1e: case 0x2b: UpdateAnimationSingleFrame(this); - if ((this->frames.all & 0x40) != 0) { + if ((this->frame & 0x40) != 0) { sub_0807A1B8(); if (!sub_08078EFC()) { this->subAction--; diff --git a/src/playerItem.c b/src/playerItem.c index c837a29a..f3acc3e8 100644 --- a/src/playerItem.c +++ b/src/playerItem.c @@ -22,33 +22,31 @@ extern void PlayerItem14(); extern void PlayerItem15(); extern void PlayerItemNulled2(); -void (*const gPlayerItemFunctions[])() = { - DeleteEntity, - PlayerItemSword, - PlayerItemBomb, - PlayerItem3, - PlayerItemBow, - PlayerItemShield, - PlayerItemLantern, - PlayerItemNulled, - PlayerItemGustJar, - PlayerItemPacciCane, - DeleteEntity, - DeleteEntity, - PlayerItemC, - PlayerItemCellOverwriteSet, - PlayerItemSwordSpin, - PlayerItemSwordBeam, - PlayerItem10, - PlayerItem11, - PlayerItem12, - PlayerItem13, - PlayerItem14, - PlayerItem15, - PlayerItemSwordBeam, - PlayerItemNulled2, - PlayerItemCellOverwriteSet -}; +void (*const gPlayerItemFunctions[])() = { DeleteEntity, + PlayerItemSword, + PlayerItemBomb, + PlayerItem3, + PlayerItemBow, + PlayerItemShield, + PlayerItemLantern, + PlayerItemNulled, + PlayerItemGustJar, + PlayerItemPacciCane, + DeleteEntity, + DeleteEntity, + PlayerItemC, + PlayerItemCellOverwriteSet, + PlayerItemSwordSpin, + PlayerItemSwordBeam, + PlayerItem10, + PlayerItem11, + PlayerItem12, + PlayerItem13, + PlayerItem14, + PlayerItem15, + PlayerItemSwordBeam, + PlayerItemNulled2, + PlayerItemCellOverwriteSet }; typedef struct { u8 unk0; @@ -109,7 +107,7 @@ NONMATCH("asm/non_matching/arm_proxy/ItemInit.inc", void ItemInit(Entity* this)) this->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; this->spritePriority.b0 = gPlayerEntity.spritePriority.b0; this->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; - this->currentHealth = 1; + this->health = 1; this->flags |= ENT_DID_INIT; } END_NONMATCH diff --git a/src/playerItem/playerItem10.c b/src/playerItem/playerItem10.c index bb4e5202..d733570d 100644 --- a/src/playerItem/playerItem10.c +++ b/src/playerItem/playerItem10.c @@ -124,14 +124,14 @@ void sub_080ACC78(Entity* this) { } *(u32*)&this->field_0x74 += 2; } - if (this->attachedEntity == NULL && (u32)this->field_0x70.WORD > 2) { + if (this->child == NULL && (u32)this->field_0x70.WORD > 2) { this->field_0x70.WORD = 1; } if (--this->field_0x70.WORD != -1) { return; } - if (this->attachedEntity == NULL) { + if (this->child == NULL) { this->field_0x70.WORD = 2; } else { this->field_0x70.WORD = gUnk_0812AABC[this->type]; @@ -173,12 +173,12 @@ ASM_FUNC("asm/non_matching/playerItem10/sub_080ACDB0.inc", bool32 sub_080ACDB0(E void sub_080ACECC(Entity* this) { Entity* entity; - if (this->type < 3 && this->attachedEntity == NULL && (s32) * (u32*)&this->field_0x78 >= 0 && + if (this->type < 3 && this->child == NULL && (s32) * (u32*)&this->field_0x78 >= 0 && gUnk_0812AAE8[this->type] <= *(u32*)&this->field_0x78) { entity = CreatePlayerItem(0x10, this->type + 1, 0, 0); if (entity != NULL) { entity->parent = this; - this->attachedEntity = entity; + this->child = entity; entity->x.HALF.HI = this->x.HALF.HI; entity->y.HALF.HI = this->y.HALF.HI; } diff --git a/src/playerItem/playerItem11.c b/src/playerItem/playerItem11.c index 046a5ab0..7b0aaac2 100644 --- a/src/playerItem/playerItem11.c +++ b/src/playerItem/playerItem11.c @@ -15,7 +15,7 @@ extern u8 gUnk_080B3DE0[]; extern Hitbox* gUnk_080B3DE8[]; void PlayerItem11(Entity* this) { - if (this->currentHealth) { + if (this->health) { this->iframes = 0; gUnk_080B3DD0[this->action](this); } else { @@ -36,7 +36,7 @@ void sub_08018CBC(Entity* this) { this->hitType = 0x96; this->field_0x3c = (gPlayerEntity.field_0x3c + 1) | 0x80; this->flags2 = gPlayerEntity.flags2; - pEVar3 = this->attachedEntity; + pEVar3 = this->child; if (pEVar3 != NULL) { this->action = 1; COLLISION_OFF(this); @@ -44,14 +44,14 @@ void sub_08018CBC(Entity* this) { this->hurtType = 0x1c; this->damage = 6; this->hitbox = &gUnk_080B3E18; - this->attachedEntity->spriteOffsetX = 0; - this->attachedEntity->spriteSettings.b.draw = 0; + this->child->spriteOffsetX = 0; + this->child->spriteSettings.draw = 0; } else { if (gPlayerState.field_0x1c == 0) { DeleteThisEntity(); } this->action = 2; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->spriteIndex = 0xa6; this->palette.raw = 0x33; this->spriteVramOffset = 0; @@ -72,7 +72,7 @@ void sub_08018CBC(Entity* this) { void sub_08018DE8(Entity* this) { u8 bVar1; - bVar1 = this->attachedEntity->field_0x3a & 4; + bVar1 = this->child->field_0x3a & 4; if (bVar1 == 0) { gPlayerState.field_0x1c = bVar1; DeleteThisEntity(); @@ -82,11 +82,11 @@ void sub_08018DE8(Entity* this) { sub_08018F6C(this); break; case 5: - this->attachedEntity->subAction = 4; + this->child->subAction = 4; COLLISION_ON(this); this->action = 2; this->spritePriority.b0 = 2; - this->attachedEntity->spriteSettings.b.draw = 1; + this->child->spriteSettings.draw = 1; sub_08018FA0(this); break; } @@ -96,12 +96,12 @@ void sub_08018DE8(Entity* this) { ASM_FUNC("asm/non_matching/playerItem11/sub_08018E68.inc", void sub_08018E68(Entity* this)) void sub_08018F6C(Entity* this) { - if (this->attachedEntity != NULL) { - this->attachedEntity->subAction = 5; - this->attachedEntity->spriteSettings.b.draw = 1; + if (this->child != NULL) { + this->child->subAction = 5; + this->child->spriteSettings.draw = 1; } else { GetNextFrame(this); - if (this->frames.all == 0) { + if (this->frame == 0) { return; } } diff --git a/src/playerItem/playerItem12.c b/src/playerItem/playerItem12.c index f29eb37c..1c14e0ed 100644 --- a/src/playerItem/playerItem12.c +++ b/src/playerItem/playerItem12.c @@ -16,7 +16,7 @@ ASM_FUNC("asm/non_matching/playerItem12/sub_080701F8.inc", void sub_080701F8(Ent void sub_0807037C(Entity* this) { GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { DeleteThisEntity(); } } diff --git a/src/playerItem/playerItem14.c b/src/playerItem/playerItem14.c index dca41640..0d241609 100644 --- a/src/playerItem/playerItem14.c +++ b/src/playerItem/playerItem14.c @@ -18,7 +18,7 @@ void PlayerItem14(Entity* this) { void sub_0805FBE8(Entity* this) { CopyPosition(&gPlayerEntity, this); this->action++; - this->spriteSettings.b.draw = TRUE; + this->spriteSettings.draw = TRUE; this->field_0x3c = gPlayerEntity.field_0x3c + 1; this->hitbox = &gUnk_08109AD0; this->speed = 0x380; diff --git a/src/playerItem/playerItem15.c b/src/playerItem/playerItem15.c index 4f0a2782..e90cf433 100644 --- a/src/playerItem/playerItem15.c +++ b/src/playerItem/playerItem15.c @@ -13,7 +13,7 @@ void PlayerItem15(Entity* this) { } void sub_080A3084(Entity* this) { - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->action = 0x01; CopyPosition(this->parent, this); if (this->type == 0) { diff --git a/src/playerItem/playerItemBomb.c b/src/playerItem/playerItemBomb.c index c47cd7c6..2ccf4643 100644 --- a/src/playerItem/playerItemBomb.c +++ b/src/playerItem/playerItemBomb.c @@ -40,7 +40,7 @@ NONMATCH("asm/non_matching/playerItemBomb/PlayerItemBomb.inc", void PlayerItemBo this->action = 0x03; this->spritePriority.b1 = 2; this->actionDelay = 0x0f; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; sub_0805EC60(this); sub_08078954(this); CreateObjectWithParent(this, 0x20, 0, 0); diff --git a/src/playerItem/playerItemGustJar.c b/src/playerItem/playerItemGustJar.c index 3b1433a0..041172ae 100644 --- a/src/playerItem/playerItemGustJar.c +++ b/src/playerItem/playerItemGustJar.c @@ -32,7 +32,7 @@ void sub_080ADA6C(Entity* this) { void sub_080ADAA8(Entity* this) { sub_080ADC84(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 2; sub_080ADCA0(this, 0); } else { @@ -59,15 +59,15 @@ void sub_080ADC14(Entity* this) { } void sub_080ADC60(Entity* this) { - if ((this->frames.all & 0x80) != 0) { - this->spriteSettings.b.draw = 0; + if ((this->frame & 0x80) != 0) { + this->spriteSettings.draw = 0; } else { UpdateAnimationSingleFrame(this); } } void sub_080ADC84(Entity* this) { - this->spriteSettings.b.flipX = gPlayerEntity.spriteSettings.b.flipX; + this->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX; } ASM_FUNC("asm/non_matching/playerItemGustJar/sub_080ADCA0.inc", void sub_080ADCA0(Entity* this, u32 param_1)) diff --git a/src/playerItem/playerItemSwordBeam.c b/src/playerItem/playerItemSwordBeam.c index 8fb41232..ff4fab24 100644 --- a/src/playerItem/playerItemSwordBeam.c +++ b/src/playerItem/playerItemSwordBeam.c @@ -23,7 +23,7 @@ void PlayerItemSwordBeam(Entity* this) { void sub_08019498(Entity* this) { CopyPosition(&gPlayerEntity, this); this->action += 0x01; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x3c = gPlayerEntity.field_0x3c + 1; this->hitbox = &gUnk_080B4408; this->speed = 0x380; @@ -38,13 +38,13 @@ void sub_08019498(Entity* this) { case 0: this->x.HALF.HI += -3; this->y.HALF.HI += -8; - this->spriteSettings.raw |= 0x80; + this->spriteSettings.flipY = 1; break; case 4: this->x.HALF.HI += 2; break; case 2: - this->spriteSettings.b.flipX = 1; + this->spriteSettings.flipX = 1; this->x.HALF.HI += 1; this->y.HALF.HI += -4; break; diff --git a/src/projectile/arrowProjectile.c b/src/projectile/arrowProjectile.c index eb9296a4..51a49e34 100644 --- a/src/projectile/arrowProjectile.c +++ b/src/projectile/arrowProjectile.c @@ -44,11 +44,11 @@ void sub_080A9334(Entity* this) { void ArrowProjectile_Init(Entity* this) { this->action = 1; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; COLLISION_OFF(this); this->actionDelay = 0x6a; this->field_0xf = 0; - this->hVelocity = 0xa00; + this->zVelocity = 0xa00; sub_080A94C0(this, this->type); } @@ -63,7 +63,7 @@ void ArrowProjectile_Action1(Entity* this) { if (parent->field_0xf != 0) { this->action = 2; COLLISION_ON(this); - parent->attachedEntity = NULL; + parent->child = NULL; SoundReq(SFX_FC); } } @@ -106,7 +106,7 @@ void sub_080A9488(Entity* this) { this->action = 4; COLLISION_OFF(this); this->actionDelay = 2; - this->hVelocity = 0x18000; + this->zVelocity = 0x18000; this->animationState = (this->knockbackDirection & 0x18) >> 3; EnqueueSFX(SFX_METAL_CLINK); sub_080A94C0(this, this->animationState); @@ -114,8 +114,8 @@ void sub_080A9488(Entity* this) { void sub_080A94C0(Entity* this, u32 animationState) { const struct_081299F8* entry = &gUnk_081299F8[animationState]; - this->spriteSettings.b.flipX = entry->flipX; - this->spriteSettings.b.flipY = entry->flipY; + this->spriteSettings.flipX = entry->flipX; + this->spriteSettings.flipY = entry->flipY; this->animIndex = entry->animIndex; this->hitbox = (Hitbox*)entry->hitbox; InitializeAnimation(this, this->animIndex); diff --git a/src/projectile/ballAndChain.c b/src/projectile/ballAndChain.c index 065c9e8a..bee0f066 100644 --- a/src/projectile/ballAndChain.c +++ b/src/projectile/ballAndChain.c @@ -33,7 +33,7 @@ void sub_080AB074(Entity* this) { this->x.WORD += gSineTable[parent->field_0x7c.BYTES.byte0] * (parent->field_0x7c.BYTES.byte2 << 8); this->y.WORD -= gSineTable[parent->field_0x7c.BYTES.byte0 + 0x40] * (parent->field_0x7c.BYTES.byte2 << 8); - this->height.HALF.HI += (s8)parent->field_0x7c.BYTES.byte3; + this->z.HALF.HI += (s8)parent->field_0x7c.BYTES.byte3; if (parent->field_0x7a.HALF.HI != 0) { parent = CreateProjectile(0x19); if (parent != NULL) { diff --git a/src/projectile/boneProjectile.c b/src/projectile/boneProjectile.c index 29361923..9844fae1 100644 --- a/src/projectile/boneProjectile.c +++ b/src/projectile/boneProjectile.c @@ -30,7 +30,7 @@ void sub_080A81C4(Entity* this) { void BoneProjectile_Init(Entity* this) { this->action = 1; this->actionDelay = 0x3c; - this->height.HALF.HI = 0xfffe; + this->z.HALF.HI = 0xfffe; InitializeAnimation(this, 0); } @@ -59,12 +59,12 @@ void BoneProjectile_Action2(Entity* this) { this->action = 3; COLLISION_OFF(this); this->speed = 0xe0; - this->hVelocity = 0xe000; + this->zVelocity = 0xe000; } } void BoneProjectile_Action3(Entity* this) { - this->spriteSettings.b.draw ^= 1; + this->spriteSettings.draw ^= 1; sub_0806F69C(this); GetNextFrame(this); if (sub_080044EC(this, 0x1800) == 0) { @@ -83,7 +83,7 @@ void BoneProjectile_Action4(Entity* this) { void sub_080A82D8(Entity* this) { this->action = 4; COLLISION_OFF(this); - this->hVelocity = 0x10000; + this->zVelocity = 0x10000; this->direction ^= 0x10; this->speed = 0x80; } diff --git a/src/projectile/cannonballProjectile.c b/src/projectile/cannonballProjectile.c index 2f4c8339..25d79adf 100644 --- a/src/projectile/cannonballProjectile.c +++ b/src/projectile/cannonballProjectile.c @@ -40,7 +40,7 @@ void sub_080AB544(Entity* this) { void CannonballProjectile_Init(Entity* this) { this->action = 1; this->direction = this->type << 3; - this->height.HALF.HI = 0xfffc; + this->z.HALF.HI = 0xfffc; InitializeAnimation(this, this->type); } @@ -78,14 +78,14 @@ bool32 sub_080AB5F4(Entity* this) { } bool32 sub_080AB634(Entity* this) { - Entity** entities = ((Entity**)&this->parent->hVelocity); + Entity** entities = ((Entity**)&this->parent->zVelocity); u32 i; for (i = 0; i <= 3; ++i) { if (entities[i] != NULL && (sub_080177A0(this, entities[i]) != 0)) { if (entities[i]->action < 3) { entities[i]->action = 3; entities[i]->actionDelay = 0x1e; - entities[i]->spriteSettings.b.draw = 0; + entities[i]->spriteSettings.draw = 0; CreateFx(entities[i], FX_WHITE_ROCK, 0); } DeleteEntity(this); diff --git a/src/projectile/darkNutSwordSlash.c b/src/projectile/darkNutSwordSlash.c index 5875a9d6..20b968db 100644 --- a/src/projectile/darkNutSwordSlash.c +++ b/src/projectile/darkNutSwordSlash.c @@ -21,7 +21,7 @@ void DarkNutSwordSlash(Entity* this) { InitAnimationForceUpdate(this, this->parent->animationState + 0x18); } } - if ((this->parent == NULL) || (this->parent->currentHealth == 0)) { + if ((this->parent == NULL) || (this->parent->health == 0)) { DeleteThisEntity(); } if (((this->bitfield & 0x80) != 0) && (this->field_0x4c == &gPlayerEntity)) { @@ -46,7 +46,7 @@ void DarkNutSwordSlash_OnTick(Entity* this) { void DarkNutSwordSlash_UpdateType0(Entity* this) { Entity* parent = this->parent; - this->hitbox = (Hitbox*)gUnk_081293E0[parent->animationState][(parent->frames.all & 0xf) - 1]; + this->hitbox = (Hitbox*)gUnk_081293E0[parent->animationState][(parent->frame & 0xf) - 1]; } void DarkNutSwordSlash_UpdateType2(Entity* this) { @@ -55,7 +55,7 @@ void DarkNutSwordSlash_UpdateType2(Entity* this) { } void DarkNutSwordSlash_UpdateType34(Entity* this) { - if ((this->parent->frames.all & 0x10) != 0) { + if ((this->parent->frame & 0x10) != 0) { this->hitbox = (Hitbox*)gUnk_08129410[this->parent->animationState]; } else { this->hitbox = (Hitbox*)gUnk_08129400[this->parent->animationState]; diff --git a/src/projectile/dekuSeedProjectile.c b/src/projectile/dekuSeedProjectile.c index 63716065..9de363e2 100644 --- a/src/projectile/dekuSeedProjectile.c +++ b/src/projectile/dekuSeedProjectile.c @@ -44,7 +44,7 @@ void DekuSeedProjectile_Init(Entity* this) { this->action = 1; this->actionDelay = 0x30; this->field_0xf = 0; - this->height.HALF.HI -= 4; + this->z.HALF.HI -= 4; if (CheckGlobalFlag(TABIDACHI) == 0) { this->hitType = 0x68; } @@ -107,7 +107,7 @@ void DekuSeedProjectile_Action2(Entity* this) { void DekuSeedProjectile_Action3(Entity* this) { GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { DeleteThisEntity(); } } @@ -126,7 +126,7 @@ void DekuSeedProjectile_Action4(Entity* this) { break; } if ((this->flags & ENT_COLLIDE) == 0) { - this->spriteSettings.b.draw ^= 1; + this->spriteSettings.draw ^= 1; } } diff --git a/src/projectile/dirtBallProjectile.c b/src/projectile/dirtBallProjectile.c index fd5909b8..9d4d7187 100644 --- a/src/projectile/dirtBallProjectile.c +++ b/src/projectile/dirtBallProjectile.c @@ -17,10 +17,10 @@ void DirtBallProjectile(Entity* this) { void DirtBallProjectile_OnTick(Entity* this) { if (this->type == 1) { - if (this->attachedEntity == NULL) { + if (this->child == NULL) { DeleteThisEntity(); } - if (this->attachedEntity->next == NULL) { + if (this->child->next == NULL) { DeleteThisEntity(); } } @@ -30,7 +30,7 @@ void DirtBallProjectile_OnTick(Entity* this) { void sub_080A881C(Entity* this) { this->field_0x46 = 0; if (this->type == 0) { - this->parent->attachedEntity = NULL; + this->parent->child = NULL; if (this->bitfield == 0x80) { gPlayerState.hurtBlinkSpeed = 0xf0; ModHealth(-2); @@ -47,8 +47,8 @@ void sub_080A881C(Entity* this) { void DirtBallProjectile_Init(Entity* this) { this->action = 1; this->subAction = 0; - this->spriteSettings.b.shadow = 1; - this->hVelocity = 0x8000; + this->spriteSettings.shadow = 1; + this->zVelocity = 0x8000; this->hitbox = (Hitbox*)&gUnk_08129764; this->field_0x3c |= 0x10; switch (this->type) { @@ -79,24 +79,24 @@ void DirtBallProjectile_Action1(Entity* this) { PositionRelative(parent, this, 0, -0x10000); switch (this->type) { case 0: - this->height.HALF.HI += 0x10; + this->z.HALF.HI += 0x10; break; case 1: - this->height.HALF.HI += 0xe; - sub_08078954(this->attachedEntity); - CopyPosition(this, this->attachedEntity); - if ((0xf < (u8)(this->actionDelay++ + 1)) && (entity = this->attachedEntity, entity->actionDelay == 0)) { + this->z.HALF.HI += 0xe; + sub_08078954(this->child); + CopyPosition(this, this->child); + if ((0xf < (u8)(this->actionDelay++ + 1)) && (entity = this->child, entity->actionDelay == 0)) { if ((this->actionDelay & 2) != 0) { entity->field_0xf += 1; } - if ((this->attachedEntity->field_0xf < 0x20) && ((this->attachedEntity->field_0xf & 3) == 3)) { + if ((this->child->field_0xf < 0x20) && ((this->child->field_0xf & 3) == 3)) { parent->field_0x82.HALF.HI = 0xc0; this->action = 2; } } break; case 2: - this->height.HALF.HI += 0xe; + this->z.HALF.HI += 0xe; if (sub_080041A0(this, &gPlayerEntity, 0xe, 0xe) != 0) { this->action = 2; parent->field_0x82.HALF.HI = 0xc0; @@ -112,7 +112,7 @@ void DirtBallProjectile_Action2(Entity* this) { Entity* entity; if (this->type == 1) { - entity = this->attachedEntity; + entity = this->child; if (entity == NULL) { DeleteThisEntity(); } @@ -161,7 +161,7 @@ void DirtBallProjectile_Action2(Entity* this) { void DirtBallProjectile_Action3(Entity* this) { GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { DeleteEntity(this); } } diff --git a/src/projectile/fireProjectile.c b/src/projectile/fireProjectile.c index 4419b527..e3ecceb4 100644 --- a/src/projectile/fireProjectile.c +++ b/src/projectile/fireProjectile.c @@ -37,7 +37,7 @@ void FireProjectile_Action1(Entity* this) { if (parent->next == NULL) { DeleteEntity(this); } else { - if (this->spriteSettings.b.draw == 1) { + if (this->spriteSettings.draw == 1) { CopyPosition(parent, this); if (this->actionDelay != 0) { direction = parent->direction & 0x18; @@ -68,7 +68,7 @@ void FireProjectile_Action2(Entity* this) { void FireProjectile_Action3(Entity* this) { GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { DeleteEntity(this); } } diff --git a/src/projectile/gleerokProjectile.c b/src/projectile/gleerokProjectile.c index 957667ea..3c59c8f2 100644 --- a/src/projectile/gleerokProjectile.c +++ b/src/projectile/gleerokProjectile.c @@ -36,12 +36,12 @@ void GleerokProjectile_Init(Entity* this) { s32 iVar2; this->action = 1; - this->hVelocity = -0x10000; + this->zVelocity = -0x10000; if (this->type != 3) { CopyPosition(this->parent, this); sub_0806F5BC(this, 0x1000, this->direction); - this->height.WORD = this->parent->y.WORD - this->attachedEntity->y.WORD; - this->y.WORD -= this->height.WORD; + this->z.WORD = this->parent->y.WORD - this->child->y.WORD; + this->y.WORD -= this->z.WORD; InitializeAnimation(this, 0x51); SoundReq(SFX_1B5); } @@ -63,14 +63,14 @@ void GleerokProjectile_Init(Entity* this) { } else if (0x400 < iVar2) { iVar2 = 0x400; } - this->hVelocity = this->height.WORD / (iVar2 << 8) << 0xd; + this->zVelocity = this->z.WORD / (iVar2 << 8) << 0xd; this->field_0xf = 0x1e; break; case 2: - this->hVelocity = (this->height.WORD / 0x18000) << 0xc; + this->zVelocity = (this->z.WORD / 0x18000) << 0xc; break; case 3: - this->height.WORD = 0xff600000; + this->z.WORD = 0xff600000; uVar1 = (Random() & 3) * 2; this->x.HALF.HI = gUnk_08129978[uVar1] + this->x.HALF.HI; this->y.HALF.HI = gUnk_08129978[uVar1 + 1] + this->y.HALF.HI; @@ -126,7 +126,7 @@ void GleerokProjectile_Action2(Entity* this) { sub_080A90D8(this); } } else { - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 3; COLLISION_OFF(this); InitializeAnimation(this, 0x53); @@ -136,7 +136,7 @@ void GleerokProjectile_Action2(Entity* this) { void GleerokProjectile_Action3(Entity* this) { GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { DeleteThisEntity(); } } diff --git a/src/projectile/guardLineOfSight.c b/src/projectile/guardLineOfSight.c index 2fff5c06..cf0510e4 100644 --- a/src/projectile/guardLineOfSight.c +++ b/src/projectile/guardLineOfSight.c @@ -18,7 +18,7 @@ void GuardLineOfSight(Entity* this) { if (this->action == 0) { this->action = 1; this->actionDelay = Random(); - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } if (this->bitfield == 0x80) { if (this->parent != NULL) { @@ -47,7 +47,7 @@ void GuardLineOfSight(Entity* this) { if (this->action == 0) { this->action = 1; this->actionDelay = 0x12; - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; this->speed = 0x800; this->hitbox = (Hitbox*)&gUnk_080FD1E4; InitializeAnimation(this, 0); diff --git a/src/projectile/gyorgMaleEnergyProjectile.c b/src/projectile/gyorgMaleEnergyProjectile.c index 33b34439..115fc9fb 100644 --- a/src/projectile/gyorgMaleEnergyProjectile.c +++ b/src/projectile/gyorgMaleEnergyProjectile.c @@ -66,7 +66,7 @@ void GyorgMaleEnergyProjectile_Action2(Entity* this) { void GyorgMaleEnergyProjectile_Action3(Entity* this) { sub_080AF090(this); GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { DeleteThisEntity(); } } diff --git a/src/projectile/gyorgTail.c b/src/projectile/gyorgTail.c index acf81cc7..767a775d 100644 --- a/src/projectile/gyorgTail.c +++ b/src/projectile/gyorgTail.c @@ -55,7 +55,7 @@ void GyorgTail_Init(Entity* this) { if (sub_080AC5E4(this) != 0) { this->action = 1; this->frameIndex = 0xc; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->field_0x7a.HWORD = gUnk_0812A9B4[Random() & 1]; this->collisionLayer = 2; sub_080AC388(this); @@ -66,7 +66,7 @@ ASM_FUNC("asm/non_matching/gyorgTail/sub_080AC388.inc", void sub_080AC388(Entity void sub_080AC480(Entity* this) { if (this->actionDelay != 0) { - if (this->parent->currentHealth == 0) { + if (this->parent->health == 0) { this->action = 1; this->hitType = 0x1d; } else { @@ -92,7 +92,7 @@ void sub_080AC510(Entity* this) { if (this->action == 0) { this->action = 1; this->frameIndex = gUnk_0812A9BA[this->type * 3 + this->type2 - 1]; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; this->collisionLayer = 2; if (*(u16*)&this->type == 0x300) { this->hitbox = &gUnk_080FD458; @@ -104,7 +104,7 @@ void sub_080AC560(Entity* this) { s32 factor; Entity* entity; - entity = this->attachedEntity; + entity = this->child; if (entity->next == NULL) { DeleteThisEntity(); } @@ -117,7 +117,7 @@ void sub_080AC560(Entity* this) { this->hitbox = &gUnk_080FD448; } this->frameIndex = 0xff; - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } factor = this->field_0x78.HALF.HI << 8; this->x.WORD = entity->x.WORD + gSineTable[entity->direction] * factor; @@ -142,21 +142,21 @@ NONMATCH("asm/non_matching/gyorgTail/sub_080AC5E4.inc", bool32 sub_080AC5E4(Enti entity->type2 = 1; entity->parent = this->parent; entity->field_0x78.HALF.HI = 0x12; - this->attachedEntity = entity; + this->child = entity; entity2 = CreateProjectile(0x22); entity2->type = this->type; entity2->type2 = 2; entity2->parent = this->parent; entity2->field_0x78.HALF.HI = 0x14; uVar3 = entity2->field_0x78.HALF.HI; - entity->attachedEntity = entity2; + entity->child = entity2; entity3 = CreateProjectile(0x22); entity3->type = this->type; entity3->type2 = 3; entity3->parent = this->parent; - entity3->attachedEntity = NULL; + entity3->child = NULL; entity3->field_0x78.HALF.HI = 0; - entity2->attachedEntity = entity3; + entity2->child = entity3; } else { if (0x44 < gEntCount) { return 0; @@ -168,20 +168,20 @@ NONMATCH("asm/non_matching/gyorgTail/sub_080AC5E4.inc", bool32 sub_080AC5E4(Enti entity->parent = this->parent; entity->field_0x78.HALF.HI = 0x10; uVar3 = entity->field_0x78.HALF.HI; - this->attachedEntity = entity; + this->child = entity; entity2 = CreateProjectile(0x22); entity2->type = this->type; entity2->type2 = 2; entity2->parent = this->parent; - entity2->attachedEntity = NULL; + entity2->child = NULL; entity2->field_0x78.HALF.HI = 0x20; - entity->attachedEntity = entity2; + entity->child = entity2; } entity4 = CreateProjectile(0x22); entity4->type = this->type; entity4->type2 = 4; entity4->parent = this->parent; - entity4->attachedEntity = this; + entity4->child = this; entity4->field_0x78.HALF.HI = uVar3; return 1; } @@ -200,9 +200,9 @@ NONMATCH("asm/non_matching/gyorgTail/sub_080AC7C4.inc", void sub_080AC7C4(Entity s32 iVar2; s32 iVar3; - entity1 = this->attachedEntity; - entity2 = entity1->attachedEntity; - entity3 = entity2->attachedEntity; + entity1 = this->child; + entity2 = entity1->child; + entity3 = entity2->child; if (entity3 != NULL) { CopyPosition(this->parent, entity3); } else { diff --git a/src/projectile/iceProjectile.c b/src/projectile/iceProjectile.c index 96e83a42..3ff1031b 100644 --- a/src/projectile/iceProjectile.c +++ b/src/projectile/iceProjectile.c @@ -39,7 +39,7 @@ void IceProjectile_Action1(Entity* this) { if (parent->next == NULL) { DeleteEntity(this); } else { - if (this->spriteSettings.b.draw == 1) { + if (this->spriteSettings.draw == 1) { CopyPosition(parent, this); if (this->actionDelay != 0) { direction = parent->direction & 0x18; @@ -70,7 +70,7 @@ void IceProjectile_Action2(Entity* this) { void IceProjectile_Action3(Entity* this) { GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { DeleteEntity(this); } } diff --git a/src/projectile/keatonDagger.c b/src/projectile/keatonDagger.c index b7a876e0..8c9bc2f1 100644 --- a/src/projectile/keatonDagger.c +++ b/src/projectile/keatonDagger.c @@ -13,7 +13,7 @@ void KeatonDagger(Entity* this) { this->action = 1; } parent = this->parent; - if (((parent == NULL) || (parent->currentHealth == 0)) || (parent->next == NULL)) { + if (((parent == NULL) || (parent->health == 0)) || (parent->next == NULL)) { if (((this->bitfield & 0x80) != 0) && (this->field_0x4c == &gPlayerEntity)) { sub_0803C0AC(this); } diff --git a/src/projectile/lakituCloudProjectile.c b/src/projectile/lakituCloudProjectile.c index 1971177d..39c6f65f 100644 --- a/src/projectile/lakituCloudProjectile.c +++ b/src/projectile/lakituCloudProjectile.c @@ -60,7 +60,7 @@ void LakituCloudProjectile_Init(Entity* this) { void LakituCloudProjectile_Action1(Entity* this) { PositionRelative(this->parent, this, 0, -0x10000); - this->height.HALF.HI = 0xfffe; + this->z.HALF.HI = 0xfffe; UpdateAnimationSingleFrame(this); } diff --git a/src/projectile/lakituLightning.c b/src/projectile/lakituLightning.c index 975491c2..a2f843cf 100644 --- a/src/projectile/lakituLightning.c +++ b/src/projectile/lakituLightning.c @@ -19,7 +19,7 @@ void LakituLightning_OnTick(Entity* this) { } void sub_080A9DD8(Entity* this) { - if ((this->currentHealth == 0) || (this->bitfield == 0x80)) { + if ((this->health == 0) || (this->bitfield == 0x80)) { DeleteThisEntity(); } LakituLightning_OnTick(this); @@ -28,7 +28,7 @@ void sub_080A9DD8(Entity* this) { void LakituLightning_Init(Entity* this) { this->action = 1; this->actionDelay = 0xb4; - this->currentHealth = 1; + this->health = 1; InitializeAnimation(this, 0); } diff --git a/src/projectile/mandiblesProjectile.c b/src/projectile/mandiblesProjectile.c index 1095b9a4..ce1f3097 100644 --- a/src/projectile/mandiblesProjectile.c +++ b/src/projectile/mandiblesProjectile.c @@ -27,7 +27,7 @@ void sub_080AA3E0(Entity*, u32); bool32 sub_080AA374(Entity*); void MandiblesProjectile(Entity* this) { - Entity* entity = this->attachedEntity; + Entity* entity = this->child; if (entity == NULL) { entity = this->parent; } @@ -104,8 +104,8 @@ void MandiblesProjectile_Action1(Entity* this) { void MandiblesProjectile_Action2(Entity* this) { UpdateAnimationSingleFrame(this); - if ((this->frames.all & 0x40) != 0) { - this->frames.all &= 0xbf; + if ((this->frame & 0x40) != 0) { + this->frame &= 0xbf; EnqueueSFX(SFX_15D); } this->field_0x78.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI); @@ -122,7 +122,7 @@ void MandiblesProjectile_Action3(Entity* this) { s8* tmp; Entity* entity; - entity = this->attachedEntity; + entity = this->child; if (entity == NULL) { DeleteThisEntity(); } @@ -141,7 +141,7 @@ void MandiblesProjectile_Action3(Entity* this) { this->field_0xf -= 1; } else { UpdateAnimationSingleFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 4; this->field_0x82.HALF.LO = 3; this->field_0xf = 0x40; @@ -164,16 +164,16 @@ void MandiblesProjectile_Action4(Entity* this) { u32 uVar2; Entity* entity; - entity = this->attachedEntity; + entity = this->child; if (entity != NULL) { if (entity->next == NULL) { - this->attachedEntity = NULL; + this->child = NULL; } if (this->field_0xf != 0) { this->field_0xf -= 1; } else { if (sub_080AA374(this) != 0) { - if (entity->currentHealth == 0) { + if (entity->health == 0) { DeleteThisEntity(); } EnqueueSFX(0xf2); @@ -183,8 +183,8 @@ void MandiblesProjectile_Action4(Entity* this) { this->actionDelay = 0; this->field_0x80.HWORD = 0x20; this->spriteOrientation.flipY = 2; - this->parent = this->attachedEntity; - this->attachedEntity = NULL; + this->parent = this->child; + this->child = NULL; sub_080AA270(this); entity = this->parent; entity->action = 1; @@ -306,13 +306,12 @@ NONMATCH("asm/non_matching/mandiblesProjectile/sub_080AA374.inc", bool32 sub_080 bool32 result; result = FALSE; - if ((this->attachedEntity != NULL) && (this->attachedEntity->next != NULL)) { + if ((this->child != NULL) && (this->child->next != NULL)) { // TODO regalloc - animationState = this->attachedEntity->animationState; - uVar1 = - sub_0806F824(this, this->attachedEntity, gUnk_08129D14[animationState], gUnk_08129D14[animationState + 1]); - if (sub_0806FCB8(this, this->attachedEntity->x.HALF.HI + gUnk_08129D14[animationState], - this->attachedEntity->y.HALF.HI + gUnk_08129D14[animationState + 1], 8) != 0) { + animationState = this->child->animationState; + uVar1 = sub_0806F824(this, this->child, gUnk_08129D14[animationState], gUnk_08129D14[animationState + 1]); + if (sub_0806FCB8(this, this->child->x.HALF.HI + gUnk_08129D14[animationState], + this->child->y.HALF.HI + gUnk_08129D14[animationState + 1], 8) != 0) { result = TRUE; } else { sub_08004596(this, uVar1); diff --git a/src/projectile/mazaalEnergyBeam.c b/src/projectile/mazaalEnergyBeam.c index 20b73213..8d617ba3 100644 --- a/src/projectile/mazaalEnergyBeam.c +++ b/src/projectile/mazaalEnergyBeam.c @@ -11,7 +11,7 @@ void MazaalEnergyBeam(Entity* this) { void MazaalEnergyBeam_Init(Entity* this) { this->action = 1; this->actionDelay = 10; - this->height.HALF.HI -= 2; + this->z.HALF.HI -= 2; this->y.HALF.HI += 2; InitializeAnimation(this, 0); SoundReq(SFX_149); @@ -27,8 +27,8 @@ void MazaalEnergyBeam_Action1(Entity* this) { this->y.HALF.HI += 6; InitializeAnimation(this, 1); } else { - if (this->height.HALF.HI != 0) { - this->height.HALF.HI += 1; + if (this->z.HALF.HI != 0) { + this->z.HALF.HI += 1; } tmp = &gSineTable[this->direction]; @@ -40,7 +40,7 @@ void MazaalEnergyBeam_Action1(Entity* this) { void MazaalEnergyBeam_Action2(Entity* this) { GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { DeleteEntity(this); } } diff --git a/src/projectile/moblinSpear.c b/src/projectile/moblinSpear.c index e4870a1f..f31459cc 100644 --- a/src/projectile/moblinSpear.c +++ b/src/projectile/moblinSpear.c @@ -62,7 +62,7 @@ NONMATCH("asm/non_matching/moblinSpear/MoblinSpear_Action1.inc", void MoblinSpea if (parent->next == NULL) { DeleteThisEntity(); } - frames = parent->frames.all * 4; + frames = parent->frame * 4; a = &gUnk_0812966C[frames / 4]; this->hitbox->offset_x = a->offsetX; // TODO offset used to increase a pointer is already increated here? diff --git a/src/projectile/octorokBossProjectile.c b/src/projectile/octorokBossProjectile.c index 63bd13ae..048b9661 100644 --- a/src/projectile/octorokBossProjectile.c +++ b/src/projectile/octorokBossProjectile.c @@ -40,7 +40,7 @@ void OctorokBossProjectile_Init(Entity* this) { this->spriteRendering.b3 = 3; this->spritePriority.b0 = 6; this->speed = (Random() & 0x1ff) + 0x200; - this->hVelocity = (Random() & 0x1fff) + 0x18000; + this->zVelocity = (Random() & 0x1fff) + 0x18000; uVar1 = (((u8)Random() & 7) - 4); this->direction -= uVar1; *(u32*)&this->field_0x78 = 600; @@ -60,7 +60,7 @@ void OctorokBossProjectile_Init(Entity* this) { break; case 3: CopyPosition(&gPlayerEntity, this); - this->height.WORD = 0xff600000; + this->z.WORD = 0xff600000; this->x.HALF.HI += 0x60; this->y.HALF.HI += 0x40; this->x.HALF.HI -= (s32)Random() % 0xc0; @@ -96,7 +96,7 @@ void OctorokBossProjectile_Action1(Entity* this) { this->direction ^= 0x80; this->speed = 0x400; } else { - this->parent->currentHealth -= 1; + this->parent->health -= 1; this->parent->iframes = 0x1e; if (this->parent->field_0x7c.BYTES.byte0 != 0) { this->parent->knockbackDuration = 0x18; @@ -132,11 +132,11 @@ void OctorokBossProjectile_Action1(Entity* this) { return; } for (index = 0; index < 3; ++index) { - this->attachedEntity = CreateProjectileWithParent(this, 0xf, 1); - if (this->attachedEntity != NULL) { - this->attachedEntity->parent = this->parent; - this->attachedEntity->direction = this->direction + gUnk_08129ADC[index]; - CopyPosition(this, this->attachedEntity); + this->child = CreateProjectileWithParent(this, 0xf, 1); + if (this->child != NULL) { + this->child->parent = this->parent; + this->child->direction = this->direction + gUnk_08129ADC[index]; + CopyPosition(this, this->child); } } OctorokBossProjectile_Action2(this); @@ -156,9 +156,9 @@ void OctorokBossProjectile_Action1(Entity* this) { } if (*(u32*)&this->field_0x78 < 0x1e) { if ((*(u32*)&this->field_0x78 & 7) != 0) { - this->spriteSettings.b.draw = 1; + this->spriteSettings.draw = 1; } else { - this->spriteSettings.b.draw = 0; + this->spriteSettings.draw = 0; } } if (--*(u32*)&this->field_0x78 == -1) { @@ -175,8 +175,8 @@ void OctorokBossProjectile_Action1(Entity* this) { sub_0806F62C(this, this->speed, this->direction); return; } - if (this->attachedEntity != NULL) { - this->attachedEntity->actionDelay = 1; + if (this->child != NULL) { + this->child->actionDelay = 1; } DeleteThisEntity(); break; diff --git a/src/projectile/projectile5.c b/src/projectile/projectile5.c index 1010eb45..5d99e015 100644 --- a/src/projectile/projectile5.c +++ b/src/projectile/projectile5.c @@ -59,7 +59,7 @@ void Projectile5_Action1(Entity* this) { DeleteThisEntity(); } CopyPosition(parent, this); - this->height.HALF.HI += 2; + this->z.HALF.HI += 2; } void (*const Projectile5_Functions[])(Entity*) = { diff --git a/src/projectile/rockProjectile.c b/src/projectile/rockProjectile.c index 0f02c6fe..fbbf3620 100644 --- a/src/projectile/rockProjectile.c +++ b/src/projectile/rockProjectile.c @@ -31,7 +31,7 @@ void sub_080A8064(Entity* this) { void RockProjectile_Init(Entity* this) { this->action = 1; this->actionDelay = 0x30; - this->hVelocity = 0xa000; + this->zVelocity = 0xa000; InitializeAnimation(this, 0); } @@ -78,7 +78,7 @@ void RockProjectile_Action3(Entity* this) { break; } if ((this->flags & ENT_COLLIDE) == 0) { - this->spriteSettings.b.draw ^= 1; + this->spriteSettings.draw ^= 1; } } @@ -86,7 +86,7 @@ void sub_080A8178(Entity* this) { this->action = 2; COLLISION_OFF(this); this->speed = 0x40; - this->hVelocity = 0x14000; + this->zVelocity = 0x14000; } void (*const RockProjectile_Functions[])(Entity*) = { diff --git a/src/projectile/spiderWeb.c b/src/projectile/spiderWeb.c index d3ec343a..fe98e9fb 100644 --- a/src/projectile/spiderWeb.c +++ b/src/projectile/spiderWeb.c @@ -80,15 +80,15 @@ void sub_080AA78C(Entity* this) { } if (sub_0806F520(this) != 0) { UpdateAnimationSingleFrame(this); - if ((this->frames.all & 0x10) != 0) { - this->frames.all &= 0xef; + if ((this->frame & 0x10) != 0) { + this->frame &= 0xef; EnqueueSFX(SFX_100); } - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { sub_080AAAA8(this); } } else { - if ((this->frames.all & 1) != 0) { + if ((this->frame & 1) != 0) { sub_080AAAA8(this); } else { InitAnimationForceUpdate(this, this->type + 0x10); @@ -110,7 +110,7 @@ void SpiderWeb_Init(Entity* this) { } void SpiderWeb_Action1(Entity* this) { - if ((this->frames.all & 0x80) == 0) { + if ((this->frame & 0x80) == 0) { UpdateAnimationSingleFrame(this); } sub_080AA9E0(this); @@ -144,10 +144,9 @@ void SpiderWeb_SubAction0(Entity* this) { InitAnimationForceUpdate(this, this->type + 4); } if ((entity->animationState >> 1 == this->type) && (gPlayerState.field_0xa8 == 0x1a) && - ((gPlayerState.heldObject & 2) != 0) && ((gPlayerEntity.frames.all & 2) != 0) && - ((this->frames.all & 0x80) == 0)) { + ((gPlayerState.heldObject & 2) != 0) && ((gPlayerEntity.frame & 2) != 0) && ((this->frame & 0x80) == 0)) { UpdateAnimationSingleFrame(this); - if ((this->frames.all & 1) != 0) { + if ((this->frame & 1) != 0) { entity->x.HALF.HI = gUnk_0812A06C[entity->animationState] + entity->x.HALF.HI; entity->y.HALF.HI = gUnk_0812A06C[entity->animationState + 1] + entity->y.HALF.HI; EnqueueSFX(0x100); diff --git a/src/projectile/stalfosProjectile.c b/src/projectile/stalfosProjectile.c index 39c58075..0f3bfec5 100644 --- a/src/projectile/stalfosProjectile.c +++ b/src/projectile/stalfosProjectile.c @@ -33,7 +33,7 @@ void sub_080A9A34(Entity* this) { if (this->bitfield == 0x9d) { this->action = 3; COLLISION_OFF(this); - this->hVelocity = 0x2a000; + this->zVelocity = 0x2a000; this->spritePriority.b1 = 1; } } @@ -47,7 +47,7 @@ void sub_080A9A64(Entity* this) { void StalfosProjectile_SubAction0(Entity* this) { this->subAction = 2; - this->height.HALF.HI = 0xfffe; + this->z.HALF.HI = 0xfffe; } void StalfosProjectile_SubAction1(Entity* this) { @@ -77,7 +77,7 @@ void StalfosProjectile_Init(Entity* this) { break; case 2: this->action = 3; - this->hVelocity = 0x2a000; + this->zVelocity = 0x2a000; this->spritePriority.b1 = 1; break; default: @@ -117,8 +117,8 @@ void StalfosProjectile_Action2(Entity* this) { } void StalfosProjectile_Action3(Entity* this) { - if (this->hVelocity < 0) { - this->spriteSettings.b.flipY = 1; + if (this->zVelocity < 0) { + this->spriteSettings.flipY = 1; } if (sub_08003FC4(this, 0x2000) == 0) { sub_080A9BA8(this); @@ -155,7 +155,7 @@ void sub_080A9BD0(Entity* this) { } entry = &gUnk_08129B20[tmp + parent->animationState * 4]; sub_0806FA90(parent, this, entry->unk_0, entry->unk_1); - this->height.HALF.HI = entry->unk_2 + this->height.HALF.HI; + this->z.HALF.HI = entry->unk_2 + this->z.HALF.HI; } void sub_080A9C34(Entity* this) { diff --git a/src/projectile/v1DarkMagicProjectile.c b/src/projectile/v1DarkMagicProjectile.c index 4568d0bc..dbce3794 100644 --- a/src/projectile/v1DarkMagicProjectile.c +++ b/src/projectile/v1DarkMagicProjectile.c @@ -22,7 +22,7 @@ void V1DarkMagicProjectile(Entity* this) { void V1DarkMagicProjectile_OnTick(Entity* this) { V1DarkMagicProjectile_Actions[this->action](this); if ((this->type2 == 0) && (--this->cutsceneBeh.HWORD == 0)) { - this->currentHealth = 0; + this->health = 0; } } @@ -41,8 +41,8 @@ void sub_080AAC44(Entity* this) { gPlayerState.field_0x1a[0] |= 0x80; gPlayerState.field_0xa |= 0x80; } - if (gPlayerEntity.currentHealth == 0) { - this->currentHealth = 0; + if (gPlayerEntity.health == 0) { + this->health = 0; } } else { SoundReq(SFX_ITEM_GLOVES_KNOCKBACK); @@ -58,7 +58,7 @@ ASM_FUNC("asm/non_matching/v1DarkMagicProjectile/sub_080AACE0.inc", void sub_080 void sub_080AAD70(Entity* this) { if (sub_0806F520() == 0) { - this->currentHealth = 0; + this->health = 0; } V1DarkMagicProjectile_SubActions[this->subAction](this); } @@ -72,7 +72,7 @@ void V1DarkMagicProjectile_SubAction1(Entity* this) { void V1DarkMagicProjectile_SubAction2(Entity* this) { if (sub_0806F3E4(this) != 0) { - this->currentHealth = 0; + this->health = 0; } } @@ -91,8 +91,8 @@ void V1DarkMagicProjectile_Init(Entity* this) { this->field_0xf = 4; this->field_0x80.HALF.LO = 0; this->field_0x80.HALF.HI = 0; - this->currentHealth = 0x10; - this->height.HALF.HI += 4; + this->health = 0x10; + this->z.HALF.HI += 4; this->spriteOrientation.flipY = 1; this->spriteRendering.b3 = 1; this->spritePriority.b0 = 4; @@ -131,7 +131,7 @@ void V1DarkMagicProjectile_Action1(Entity* this) { DeleteThisEntity(); } case 2: - if (this->parent->spriteSettings.b.draw == 0) { + if (this->parent->spriteSettings.draw == 0) { DeleteThisEntity(); } CopyPosition(this->parent, this); @@ -148,9 +148,9 @@ void V1DarkMagicProjectile_Action2(Entity* this) { void V1DarkMagicProjectile_Action3(Entity* this) { CopyPosition(this->parent, this); sub_080AB034(this); - this->spriteSettings.b.draw = this->parent->spriteSettings.b.draw; + this->spriteSettings.draw = this->parent->spriteSettings.draw; if (this->type != 0) { - this->currentHealth = this->parent->currentHealth; + this->health = this->parent->health; } #ifndef EU if (this->parent->action == 2) { @@ -174,8 +174,8 @@ void sub_080AAF74(Entity* this) { gPlayerEntity.iframes = 8; ModHealth(-4); sub_0800449C(&gPlayerEntity, 0x7a); - if (gPlayerEntity.currentHealth == 0) { - this->currentHealth = 0; + if (gPlayerEntity.health == 0) { + this->health = 0; } } if (!((this->field_0x80.HALF.LO < 0x31) && (this->field_0x80.HALF.HI != 0x10))) { @@ -183,13 +183,13 @@ void sub_080AAF74(Entity* this) { this->field_0x80.HALF.LO = 0; gPlayerEntity.iframes = 0xf0; gPlayerState.field_0x1a[0] = 0; - this->currentHealth = 0; + this->health = 0; } else { ResetPlayer(); gPlayerState.field_0x1a[0] |= 0x80; gPlayerState.field_0xa |= 0x80; CopyPosition(&gPlayerEntity, this); - this->height.HALF.HI = gPlayerEntity.height.HALF.HI - 4; + this->z.HALF.HI = gPlayerEntity.z.HALF.HI - 4; } } diff --git a/src/projectile/v1EyeLaser.c b/src/projectile/v1EyeLaser.c index 38be21bc..500cee96 100644 --- a/src/projectile/v1EyeLaser.c +++ b/src/projectile/v1EyeLaser.c @@ -10,7 +10,7 @@ void sub_080AB758(Entity*); void sub_080AB888(Entity*); void V1EyeLaser(Entity* this) { - if (this->parent->spriteSettings.b.draw == 0) { + if (this->parent->spriteSettings.draw == 0) { DeleteThisEntity(); } V1EyeLaser_Actions[this->action](this); @@ -32,7 +32,7 @@ void V1EyeLaser_Init(Entity* this) { void V1EyeLaser_Action1(Entity* this) { GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 2; InitializeAnimation(this, 1); sub_080AB758(this); diff --git a/src/projectile/v1FireProjectile.c b/src/projectile/v1FireProjectile.c index c627ee36..3379c344 100644 --- a/src/projectile/v1FireProjectile.c +++ b/src/projectile/v1FireProjectile.c @@ -42,12 +42,12 @@ void V1FireProjectile_Init(Entity* this) { s8* data; this->action = 1; - this->hVelocity = -0x10000; + this->zVelocity = -0x10000; this->field_0x76.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI); CopyPosition(this->parent, this); sub_0806F5BC(this, 0x1000, this->direction); this->spritePriority.b0 = 1; - this->height = this->parent->height; + this->z = this->parent->z; InitializeAnimation(this, 0x51); SoundReq(SFX_1B5); data = sub_080AB4F8(this); @@ -68,7 +68,7 @@ void V1FireProjectile_Init(Entity* this) { iVar2 = 0x20; } } - this->hVelocity = (this->height.WORD / (iVar2 << 8)) << 0xd; + this->zVelocity = (this->z.WORD / (iVar2 << 8)) << 0xd; this->direction = sub_080045B4(this, x, y); } @@ -90,7 +90,7 @@ void V1FireProjectile_Action1(Entity* this) { void V1FireProjectile_Action2(Entity* this) { GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { this->action = 3; COLLISION_OFF(this); InitializeAnimation(this, 0x53); @@ -99,7 +99,7 @@ void V1FireProjectile_Action2(Entity* this) { void V1FireProjectile_Action3(Entity* this) { GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { DeleteThisEntity(); } } diff --git a/src/projectile/v2Projectile.c b/src/projectile/v2Projectile.c index ffb558a1..d15834af 100644 --- a/src/projectile/v2Projectile.c +++ b/src/projectile/v2Projectile.c @@ -74,8 +74,8 @@ void sub_080ABD44(Entity* this) { void sub_080ABD70(Entity* this) { u32 tmp; GetNextFrame(this); - if ((this->frames.all & 0x10) != 0) { - this->frames.all &= 0xef; + if ((this->frame & 0x10) != 0) { + this->frame &= 0xef; this->speed = 0; this->field_0x74.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI); this->field_0x76.HWORD = GetTileType(this->field_0x74.HWORD, 2); @@ -88,7 +88,7 @@ void sub_080ABD70(Entity* this) { SetTileType(0x6d, this->field_0x74.HWORD, 2); } } - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { DeleteThisEntity(); } } diff --git a/src/projectile/v3ElectricProjectile.c b/src/projectile/v3ElectricProjectile.c index 4d18a8ba..589e245c 100644 --- a/src/projectile/v3ElectricProjectile.c +++ b/src/projectile/v3ElectricProjectile.c @@ -33,14 +33,14 @@ void V3ElectricProjectile_Action1(Entity* this) { DeleteThisEntity(); } CopyPositionAndSpriteOffset(this->parent, this); - this->height.HALF.HI -= 0x14; + this->z.HALF.HI -= 0x14; if (this->cutsceneBeh.HALF.HI != 0) { if (((--this->cutsceneBeh.HALF.HI) & 7) == 0) { SoundReq(SFX_149); } } GetNextFrame(this); - if ((this->frames.all & 1) != 0) { + if ((this->frame & 1) != 0) { if (this->type == 0) { this->action = 2; this->direction = GetFacingDirection(this, &gPlayerEntity); @@ -50,7 +50,7 @@ void V3ElectricProjectile_Action1(Entity* this) { this->action = 3; this->actionDelay = 0x10; } - this->height.HALF.HI -= 0x28; + this->z.HALF.HI -= 0x28; } } @@ -59,8 +59,8 @@ void V3ElectricProjectile_Action2(Entity* this) { s32 iVar2; u32 uVar3; - if (this->height.HALF.HI < -6) { - this->height.HALF.HI += 3; + if (this->z.HALF.HI < -6) { + this->z.HALF.HI += 3; } sub_080AF090(this); if (this->collisions != 0) { diff --git a/src/projectile/v3HandProjectile.c b/src/projectile/v3HandProjectile.c index 2c4ff6d2..03f84cd7 100644 --- a/src/projectile/v3HandProjectile.c +++ b/src/projectile/v3HandProjectile.c @@ -19,8 +19,8 @@ void V3HandProjectile_OnTick(Entity* this) { InitializeAnimation(this, 0); SoundReq(SFX_199); } - if (this->height.HALF.HI < -6) { - this->height.HALF.HI += 2; + if (this->z.HALF.HI < -6) { + this->z.HALF.HI += 2; } sub_080AF090(this); if (this->collisions != 0) { diff --git a/src/projectile/v3TennisBallProjectile.c b/src/projectile/v3TennisBallProjectile.c index d2c4ef74..bcbc8daf 100644 --- a/src/projectile/v3TennisBallProjectile.c +++ b/src/projectile/v3TennisBallProjectile.c @@ -25,8 +25,8 @@ ASM_FUNC("asm/non_matching/v3TennisBallProjectile/sub_080ACA68.inc", void sub_08 void V3TennisBallProjectile_Init(Entity* this) { this->action = 1; this->direction = 0x10; - this->height.HALF.HI = 0xfffc; - this->attachedEntity = NULL; + this->z.HALF.HI = 0xfffc; + this->child = NULL; InitializeAnimation(this, 7); SoundReq(SFX_199); } diff --git a/src/projectile/windProjectile.c b/src/projectile/windProjectile.c index d607486a..f315bfe5 100644 --- a/src/projectile/windProjectile.c +++ b/src/projectile/windProjectile.c @@ -36,7 +36,7 @@ void WindProjectile_Action1(Entity* this) { if (parent->next == NULL) { DeleteEntity(this); } else { - if (this->spriteSettings.b.draw == 1) { + if (this->spriteSettings.draw == 1) { CopyPosition(parent, this); direction = (parent->direction + 4) & 0x18; if (this->actionDelay != 0) { @@ -74,7 +74,7 @@ void WindProjectile_Action2(Entity* this) { void WindProjectile_Action3(Entity* this) { GetNextFrame(this); - if ((this->frames.all & 0x80) != 0) { + if ((this->frame & 0x80) != 0) { DeleteEntity(this); } } diff --git a/src/projectile/winder.c b/src/projectile/winder.c index 19e35248..640038e2 100644 --- a/src/projectile/winder.c +++ b/src/projectile/winder.c @@ -21,7 +21,7 @@ void Winder_Init(Entity* this) { this->action += 1; this->speed = 0x140; - this->height.WORD = 0; + this->z.WORD = 0; if (this->type == 0) { this->direction = Random() & 0x18; this->parent = this; @@ -31,7 +31,7 @@ void Winder_Init(Entity* this) { entity = CreateProjectile(0x1d); entity->type = this->type + 1; entity->parent = this->parent; - entity->attachedEntity = this; + entity->child = this; CopyPosition(this, entity); } diff --git a/src/script.c b/src/script.c index c38343ae..fbb0be33 100644 --- a/src/script.c +++ b/src/script.c @@ -406,7 +406,7 @@ void HandlePostScriptActions(Entity* entity, ScriptExecutionContext* context) { case 1 << 0x02: break; case 1 << 0x03: - entity->hVelocity = 0x18000; + entity->zVelocity = 0x18000; break; case 1 << 0x04: CreateSpeechBubbleExclamationMark(entity, 8, -0x18); @@ -418,10 +418,10 @@ void HandlePostScriptActions(Entity* entity, ScriptExecutionContext* context) { DestroyScriptExecutionContext(context); DeleteThisEntity(); case 1 << 0x07: - entity->spriteSettings.b.draw = 1; + entity->spriteSettings.draw = 1; break; case 1 << 0x08: - entity->spriteSettings.b.draw = 0; + entity->spriteSettings.draw = 0; break; case 1 << 0x09: entity->spriteOffsetY = 0; @@ -450,7 +450,7 @@ void HandlePostScriptActions(Entity* entity, ScriptExecutionContext* context) { entity->field_0x82.HWORD ^= 0x10; break; case 1 << 0x11: - entity->spriteSettings.b.flipX ^= 1; + entity->spriteSettings.flipX ^= 1; break; case 1 << 0x12: entity->field_0x82.HWORD |= 0x20; @@ -900,7 +900,7 @@ void ScriptCommand_0807E564(Entity* entity, ScriptExecutionContext* context) { } void ScriptCommand_EntityHasHeight(Entity* entity, ScriptExecutionContext* context) { - context->condition = entity->height.WORD != 0; + context->condition = entity->z.WORD != 0; gActiveScriptInfo.flags |= 1; } @@ -1102,8 +1102,8 @@ void ScriptCommand_SetIntVariable(Entity* entity, ScriptExecutionContext* contex } void ScriptCommand_0807E924(Entity* entity, ScriptExecutionContext* context) { - context->intVariable = entity->frames.all; - entity->frames.all = 0; + context->intVariable = entity->frame; + entity->frame = 0; } void ScriptCommand_0807E930(Entity* entity, ScriptExecutionContext* context) { @@ -1267,7 +1267,7 @@ void ScriptCommand_SetEntitySpeed(Entity* entity, ScriptExecutionContext* contex } void ScriptCommand_SetEntity0x20(Entity* entity, ScriptExecutionContext* context) { - entity->hVelocity = GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer); + entity->zVelocity = GetNextScriptCommandWordAfterCommandMetadata(context->scriptInstructionPointer); } void ScriptCommand_SetEntityPositionRelative(Entity* entity, ScriptExecutionContext* context) { @@ -1438,7 +1438,7 @@ void ScriptCommand_0807EEF4(Entity* entity, ScriptExecutionContext* context) { void ScriptCommand_0807EF3C(Entity* entity, ScriptExecutionContext* context) { if (!context->unk_18) { context->unk_18 = 1; - entity->hVelocity = ((s16)context->scriptInstructionPointer[1]) << 8; + entity->zVelocity = ((s16)context->scriptInstructionPointer[1]) << 8; context->x.HALF.LO = context->scriptInstructionPointer[2] << 8; sub_08003FC4(entity, (u16)context->x.HALF.LO); } else { @@ -1651,7 +1651,7 @@ void sub_0807F2A8(Entity* entity, ScriptExecutionContext* context) { } void sub_0807F2D4(Entity* entity, ScriptExecutionContext* context) { - if ((entity->frames.all & 0x80) != 0) { + if ((entity->frame & 0x80) != 0) { gActiveScriptInfo.flags |= 1; } else { gActiveScriptInfo.commandSize = 0; @@ -1659,7 +1659,7 @@ void sub_0807F2D4(Entity* entity, ScriptExecutionContext* context) { } void sub_0807F304(Entity* entity, ScriptExecutionContext* context) { - if ((gPlayerEntity.frames.all & 0x80) != 0) { + if ((gPlayerEntity.frame & 0x80) != 0) { gActiveScriptInfo.flags |= 1; } else { gActiveScriptInfo.commandSize = 0; @@ -1690,9 +1690,9 @@ void sub_0807F36C(Entity* entity, ScriptExecutionContext* context) { fx->spritePriority.b0 = 1; PositionRelative(entity, fx, 0, -524288); if (Random() & 1) - fx->spriteSettings.b.flipX = 1; + fx->spriteSettings.flipX = 1; if (Random() & 1) - fx->spriteSettings.b.flipY = 1; + fx->spriteSettings.flipY = 1; } } @@ -2001,7 +2001,7 @@ void sub_0807F970(Entity* entity, ScriptExecutionContext* context) { } void sub_0807F98C(Entity* entity, ScriptExecutionContext* context) { - entity->height.WORD = context->intVariable; + entity->z.WORD = context->intVariable; } void sub_0807F994(Entity* entity, ScriptExecutionContext* context) { diff --git a/src/textbox.c b/src/textbox.c index 71da7228..208f0f7c 100644 --- a/src/textbox.c +++ b/src/textbox.c @@ -150,7 +150,7 @@ void MessageNoOverlap(u32 index, Entity* entity) { MessageRequest(index); y = entity->y.HALF.HI; - height = entity->height.HALF.HI; + height = entity->z.HALF.HI; if (((y + height) - gRoomControls.roomScrollY) > 0x58) { gMessage.textWindowPosY = 1; From 9f360a0b729e87864f0556ad707189e8370f8de0 Mon Sep 17 00:00:00 2001 From: theo3 Date: Sat, 13 Nov 2021 21:14:17 -0800 Subject: [PATCH 6/6] fix flag enum --- include/flags.h | 53 +++++++++++++++++++++++++-- include/player.h | 4 +++ src/collision.c | 4 +-- src/enemy/businessScrub.c | 4 +-- src/enemy/mazaalHead.c | 2 +- src/enemy/vaatiArm.c | 2 +- src/item/itemLantern.c | 2 +- src/item/itemPegasusBoots.c | 4 +-- src/item/itemSword.c | 2 +- src/manager/manager15.c | 5 +-- src/manager/manager1A.c | 2 +- src/manager/manager26.c | 2 +- src/manager/manager3.c | 2 +- src/manager/manager6.c | 2 +- src/manager/managerA.c | 2 +- src/manager/managerF.c | 2 +- src/npc/castleMaid.c | 14 ++------ src/npc/cat.c | 2 +- src/npc/cow.c | 4 +-- src/npc/cucco.c | 2 +- src/npc/cuccoChick.c | 2 +- src/npc/dampe.c | 4 +-- src/npc/dog.c | 53 ++++++++------------------- src/npc/drLeft.c | 4 +-- src/npc/epona.c | 4 +-- src/npc/gina.c | 2 +- src/npc/mayorHagen.c | 8 ++--- src/npc/npc4E.c | 61 +++++++++----------------------- src/npc/percy.c | 4 +-- src/npc/pita.c | 4 +-- src/npc/rem.c | 4 +-- src/npc/smallTownMinish.c | 2 +- src/npc/townMinish.c | 12 +++---- src/object/bigVortex.c | 2 +- src/object/bird.c | 4 +-- src/object/book.c | 4 +-- src/object/button.c | 2 +- src/object/heartContainer.c | 2 +- src/object/lilypadSmall.c | 2 +- src/object/minishSizedEntrance.c | 4 +-- src/object/pot.c | 4 +-- src/object/warpPoint.c | 2 +- src/player.c | 54 ++++++++++++++-------------- src/room.c | 2 +- src/script.c | 2 +- 45 files changed, 179 insertions(+), 185 deletions(-) diff --git a/include/flags.h b/include/flags.h index 2a7b4f21..8e0a5809 100644 --- a/include/flags.h +++ b/include/flags.h @@ -145,7 +145,12 @@ typedef enum { MIZUUMI_00_H00, MIZUUMI_00_H01, MIZUUMI_00_H02, +#if !defined(EU) && !defined(JP) && !defined(DEMO_JP) MIZUUMI_00_CAP_0, +#else + HIKYOU_00_T0, + HIKYOU_00_T1, +#endif MAENIWA_00_00, MAENIWA_00_01, MAENIWA_00_02, @@ -166,10 +171,15 @@ typedef enum { HIKYOU_00_SEKIZOU, HIKYOU_00_14, HIKYOU_00_BOSEKI, +#if defined(EU) || defined(JP) || defined(DEMO_JP) + HIKYOU_00_H00, +#endif HIKYOU_00_M0, HIKYOU_00_M1, HIKYOU_00_M2, +#if !defined(EU) && !defined(JP) && !defined(DEMO_JP) HIKYOU_00_T1, +#endif LOST_00_ENTER, LOST_00_00, LOST_00_01, @@ -184,8 +194,10 @@ typedef enum { LOST_04_SIBA4, LOST_05_00, LOST_05_01, +#if !defined(JP) && !defined(EU) && !defined(DEMO_JP) LOST_05_02, LOST_05_03, +#endif LOST_05_T0, LOST_05_T1, MORI_00_HIBI_0, @@ -208,7 +220,9 @@ typedef enum { YAMA_03_DOKU_1, YAMA_03_DOKU_2, YAMA_04_CAP_0, +#if !defined(JP) && !defined(EU) && !defined(DEMO_JP) YAMA_04_CAP_1, +#endif YAMA_04_R00, YAMA_04_HIBI_0, YAMA_04_HIBI_1, @@ -281,6 +295,9 @@ typedef enum { SOUGEN_07_00, SOUGEN_07_01, SOUGEN_07_02, +#if defined(JP) || defined(EU) || defined(DEMO_JP) + SOUGEN_07_H00, +#endif SOUGEN_08_00, SOUGEN_08_01, SOUGEN_08_02, @@ -304,7 +321,9 @@ typedef enum { SUIGEN_00_CAP_1, SUIGEN_00_R0, SUIGEN_00_R1, +#if !defined(JP) && !defined(EU) && !defined(DEMO_JP) SUIGEN_00_R2, +#endif SUIGEN_00_h1, SUIGENGORON_00_CAP_0, DAIGORON_SHIELD, @@ -316,7 +335,9 @@ typedef enum { BEANDEMO_04, KAKERA_TAKARA_A, KAKERA_TAKARA_E, +#if !defined(JP) && !defined(EU) && !defined(DEMO_JP) KAKERA_TAKARA_J, +#endif KAKERA_TAKARA_K, KAKERA_TAKARA_L, KAKERA_TAKARA_M, @@ -341,7 +362,7 @@ typedef enum { MACHI_00_T01, MACHI_01_DEMO, MACHI_02_HEISHI, - MACHI_02_DOG, + MACHI_02_DOG, /* Talk to dog as minish */ MACHI_07_BELL, SHOP05_OPEN, MACHI_MES_20, @@ -353,7 +374,7 @@ typedef enum { MACHI_MES_40, MACHI_MES_60, MACHI_MES_50, - MACHI_DOG_C, + MACHI_DOG_C, /* Seen all dog dialogue */ KUMOUE_00_CAP_0, KUMOUE_01_CAP_0, KUMOUE_01_T0, @@ -383,10 +404,22 @@ typedef enum { KUMOUE_02_03, KUMOUE_UNCLE_TALK, KUMOUE_GIRL_TALK, +#if !defined(JP) && !defined(EU) && !defined(DEMO_JP) KS_A06, KS_B18, KS_C21, KS_C25, +#else + MIZUUMI_00_CAP_0, + SUIGEN_00_R2, + YAMA_04_CAP_1, + LOST_05_02, + LOST_05_03, + KAKERA_TAKARA_J, +#endif +#ifdef DEMO_JP + KS_WARPUSE, +#endif END_1, } LocalFlags1; @@ -596,13 +629,21 @@ typedef enum { MHOUSE_15_CAP_1, SHOP_03_CAP_0, MHOUSE_07_CAP_2, +#ifndef EU SHOP00_BOMBBAG, CAFE_01_CAP_1, +#endif +#if !defined(EU) && !defined(JP) && !defined(DEMO_JP) KS_A02, KS_A09, KS_A18, KS_B07, KS_B16, +#endif +#ifdef DEMO_JP + MH01_KS_KUSURI, + MH09_KS_KUSURI, +#endif END_2, } LocalFlags2; @@ -806,8 +847,12 @@ typedef enum { LV4_HAKA_08_B0, LV4_HAKA_08_K0, MAROYA_1ST, +#ifndef EU MACHI_CHIKA2_10_CAP_0, +#endif +#if !defined(EU) && !defined(JP) && !defined(DEMO_JP) KS_C02, +#endif END_3, } LocalFlags3; @@ -947,12 +992,14 @@ typedef enum { KOBITO_DOUKUTU_02_H00, KOBITO_DOUKUTU_01_T0, YAMADOUKUTU_04_CAP_0, +#if !defined(EU) && !defined(JP) && !defined(DEMO_JP) KS_B06, KS_B15, KS_B01, KS_B12, KS_C12, KS_C37, +#endif END_4, } LocalFlags4; @@ -1043,7 +1090,9 @@ typedef enum { LV1_08_01, LV1_01_05, LV1_10_CAP_0, +#if !defined(EU) && !defined(JP) LV1_12_CAP_0, +#endif END_5, } LocalFlags5; diff --git a/include/player.h b/include/player.h index b33a2b8f..816cea1f 100644 --- a/include/player.h +++ b/include/player.h @@ -41,6 +41,10 @@ enum { PLAYER_PARACHUTE, }; +enum { + PL_IS_MINISH = (1 << 7), +}; + typedef struct { /*0x00*/ u8 field_0x0[2]; /*0x02*/ u8 jumpStatus; diff --git a/src/collision.c b/src/collision.c index f43aa72d..4e0995e2 100644 --- a/src/collision.c +++ b/src/collision.c @@ -476,7 +476,7 @@ int sub_08017DD4(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) tgt->damage = 4; gPlayerEntity.health = sub_08017874(&gPlayerEntity, tgt); tgt->iframes = -12; - if ((gPlayerState.flags & 0x80) == 0) { + if ((gPlayerState.flags & PL_IS_MINISH) == 0) { sub_08079D84(); org->iframes = 90; } else { @@ -532,7 +532,7 @@ s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) #ifdef EU (gPlayerState.flags & 0x81) == 0 && #else - (gPlayerState.flags & 0x80) == 0 && + (gPlayerState.flags & PL_IS_MINISH) == 0 && #endif !gPlayerState.swimState) { gPlayerState.field_0x1a[0] |= 0x80u; diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index 8ade7efb..2bb7e1a5 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -268,7 +268,7 @@ void sub_08028CE8(Entity* this) { this->field_0x80.HALF.HI = 0; sub_080290E0(this, 3); #if defined(USA) || defined(DEMO_USA) - SetLocalFlag(0x87); + SetLocalFlag(KS_B06); #endif return; case 1: @@ -534,7 +534,7 @@ NONMATCH("asm/non_matching/businessScrub/sub_0802925C.inc", void sub_0802922C(En switch (offer->field_0x8) { case 0x1c: - SetGlobalFlag(0x5a); + SetGlobalFlag(AKINDO_BOTTLE_SELL); break; } diff --git a/src/enemy/mazaalHead.c b/src/enemy/mazaalHead.c index 5de9aa38..c450170f 100644 --- a/src/enemy/mazaalHead.c +++ b/src/enemy/mazaalHead.c @@ -816,7 +816,7 @@ void sub_08034BC8(Entity* this) { } void sub_08034C00(Entity* this) { - if (((gPlayerState.flags & 0x80) != 0) && + if (((gPlayerState.flags & PL_IS_MINISH) != 0) && CheckPlayerInRegion(this->x.HALF.HI - gRoomControls.roomOriginX, this->y.HALF.HI - gRoomControls.roomOriginY + 0xd, 3, 3) != 0) { if (gScreenTransition.field_0x39 >= 0x3d) { diff --git a/src/enemy/vaatiArm.c b/src/enemy/vaatiArm.c index 6dbacb7f..c660bda9 100644 --- a/src/enemy/vaatiArm.c +++ b/src/enemy/vaatiArm.c @@ -1352,7 +1352,7 @@ void sub_08043DB0(Entity* this) { Entity* pEVar3; Entity* pEVar4; - if (((gPlayerState.flags & 0x80) != 0)) { + if (((gPlayerState.flags & PL_IS_MINISH) != 0)) { pEVar3 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; if (CheckPlayerInRegion(pEVar3->x.HALF.HI - gRoomControls.roomOriginX, pEVar3->y.HALF.HI - gRoomControls.roomOriginY + 2, 3, 3)) { diff --git a/src/item/itemLantern.c b/src/item/itemLantern.c index 652dd5e0..0f49cec6 100644 --- a/src/item/itemLantern.c +++ b/src/item/itemLantern.c @@ -21,7 +21,7 @@ void sub_08075A0C(ItemBehavior* this, u32 arg1) { s8* tmp; itemSlot = IsItemEquipped(this->behaviorID); if (gPlayerState.heldObject != 0 || gPlayerState.playerAction == 0x18 || gPlayerState.jumpStatus != 0 || - gPlayerState.field_0x2c != NULL || (gPlayerState.flags & 0x80) != 0) { + gPlayerState.field_0x2c != NULL || (gPlayerState.flags & PL_IS_MINISH) != 0) { ForceEquipItem(0xf, itemSlot); gPlayerState.flags &= 0xff7fffff; ForceEquipItem(0xf, itemSlot); diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c index b572d2f6..07b78a94 100644 --- a/src/item/itemPegasusBoots.c +++ b/src/item/itemPegasusBoots.c @@ -23,7 +23,7 @@ void ItemPegasusBoots(ItemBehavior* this, u32 arg1) { if ((bVar1 & 7) == 0) { SoundReq(SFX_PLY_LAND); } - if (((gPlayerState.flags & 0x80) == 0) && ((this->field_0x5[2] & 7) == 0)) { + if (((gPlayerState.flags & PL_IS_MINISH) == 0) && ((this->field_0x5[2] & 7) == 0)) { if (gPlayerState.field_0x10[2] == 0x11) { if (gPlayerEntity.spriteOffsetY == 0) { CreateFx(&gPlayerEntity, FX_GREEN_SPLASH, 0); @@ -58,7 +58,7 @@ void sub_080768F8(ItemBehavior* this, u32 arg1) { if (bVar1 == 0) { gPlayerState.field_0x1d[1] = 1; gPlayerState.field_0x1d[4] = bVar1; - if ((gPlayerState.flags & 0x80) == 0) { + if ((gPlayerState.flags & PL_IS_MINISH) == 0) { this->field_0x5[2] = 0x10; } else { gPlayerState.field_0x8 = 0xc14; diff --git a/src/item/itemSword.c b/src/item/itemSword.c index 7835fcc0..ea6789bb 100644 --- a/src/item/itemSword.c +++ b/src/item/itemSword.c @@ -121,7 +121,7 @@ void sub_080758B0(ItemBehavior* this, u32 arg1) { ASM_FUNC("asm/non_matching/itemSword/sub_08075900.inc", void sub_08075900(ItemBehavior* this, u32 arg1)) void sub_080759B8(ItemBehavior* this, u32 arg1) { - if ((gPlayerState.flags & 0x80) == 0) { + if ((gPlayerState.flags & PL_IS_MINISH) == 0) { gPlayerEntity.hurtType = 0; } gPlayerState.flags &= 0xf7ffffff; diff --git a/src/manager/manager15.c b/src/manager/manager15.c index 92585bc4..a326116b 100644 --- a/src/manager/manager15.c +++ b/src/manager/manager15.c @@ -6,6 +6,7 @@ #include "object.h" #include "structures.h" #include "functions.h" +#include "enemy.h" typedef struct { Manager manager; @@ -88,12 +89,12 @@ void sub_0805A370(Manager15* this) { void sub_0805A394(Manager15* this) { Entity* ent; - if ((ent = FindEntityByID(0x3, 0x13, 0x4))) { + if ((ent = FindEntityByID(ENEMY, CHUCHU_BOSS, 0x4))) { if (ent->type != 4) { return; } } - SetLocalFlag(0x48); + SetLocalFlag(LV1_16_1STEND); ClearRoomFlag(0); gScreen.lcd.displayControl &= 0xB7FF; DeleteThisEntity(); diff --git a/src/manager/manager1A.c b/src/manager/manager1A.c index 632a25b7..b0401f28 100644 --- a/src/manager/manager1A.c +++ b/src/manager/manager1A.c @@ -157,7 +157,7 @@ void sub_0805B210(Manager1A* this) { gScreenTransition.areaID = tmp->unk_01; gScreenTransition.roomID = tmp->unk_02; gScreenTransition.playerLayer = tmp->unk_03; - if (gPlayerState.flags & 0x80) { + if (gPlayerState.flags & PL_IS_MINISH) { gScreenTransition.field_0xf = 6; } else { gScreenTransition.field_0xf = 2; diff --git a/src/manager/manager26.c b/src/manager/manager26.c index 96d0d270..3eb4329e 100644 --- a/src/manager/manager26.c +++ b/src/manager/manager26.c @@ -76,7 +76,7 @@ void sub_0805C7C4(Manager26* this) { } void sub_0805C7CC(Manager26* this) { - if (gPlayerState.flags & 0x80) { + if (gPlayerState.flags & PL_IS_MINISH) { if (gPlayerEntity.y.HALF.HI < this->unk_2a + 0x10) { this->manager.unk_0d = 1; } else { diff --git a/src/manager/manager3.c b/src/manager/manager3.c index 99884daa..42b20e75 100644 --- a/src/manager/manager3.c +++ b/src/manager/manager3.c @@ -94,7 +94,7 @@ void CreateMagicSparkles(u32 baseX, u32 baseY, u32 layer) { } u32 sub_08057810(void) { - if ((gPlayerState.flags & 0x80) && !gPlayerState.field_0xaa && (gArea.curPortalType != 0x6) && + if ((gPlayerState.flags & PL_IS_MINISH) && !gPlayerState.field_0xaa && (gArea.curPortalType != 0x6) && (gPlayerState.heldObject == 0)) { switch (gPlayerState.field_0xa8) { case 0: diff --git a/src/manager/manager6.c b/src/manager/manager6.c index 3840dca5..79d0a0bf 100644 --- a/src/manager/manager6.c +++ b/src/manager/manager6.c @@ -18,7 +18,7 @@ void Manager6_Main(Manager6* this) { for (i = this->warpList; i->posX != 0xFFFF; i++) { tmp = (i->unk_07.all & 0x3); if (((tmp & (gPlayerEntity.collisionLayer)) != 0) && - (((gPlayerState.flags & 0x80) != 0) || ((i->unk_07.b.unk2) != 0)) && + (((gPlayerState.flags & PL_IS_MINISH) != 0) || ((i->unk_07.b.unk2) != 0)) && (CheckPlayerInRegion(i->posX, i->posY, i->width, i->height) != 0) && (gPlayerEntity.z.HALF.HI == 0)) { DoExitTransition(GetCurrentRoomProperty(i->unk_06)); } diff --git a/src/manager/managerA.c b/src/manager/managerA.c index e2469dc8..11864028 100644 --- a/src/manager/managerA.c +++ b/src/manager/managerA.c @@ -59,7 +59,7 @@ void sub_08058408(ManagerA* this) { return; case 2: sub_080585DC(this); - if ((gPlayerState.flags & 0x80) == 0) + if ((gPlayerState.flags & PL_IS_MINISH) == 0) return; case 0: default: diff --git a/src/manager/managerF.c b/src/manager/managerF.c index 69f8c369..a736bfa4 100644 --- a/src/manager/managerF.c +++ b/src/manager/managerF.c @@ -360,7 +360,7 @@ void sub_0805938C(ManagerF* this) { } u32 sub_080593CC(ManagerF* this) { - if (!(gPlayerState.flags & 0x80) && gPlayerState.swimState != 0 && gPlayerEntity.animationState == 0 && + if (!(gPlayerState.flags & PL_IS_MINISH) && gPlayerState.swimState != 0 && gPlayerEntity.animationState == 0 && (gPlayerState.field_0x90.HALF.LO & 0xF00) == 0x400) { return sub_0806FCB8(&gPlayerEntity, this->unk_38, this->unk_3a + 0xC, 6); } diff --git a/src/npc/castleMaid.c b/src/npc/castleMaid.c index e334450d..f9cc2c81 100644 --- a/src/npc/castleMaid.c +++ b/src/npc/castleMaid.c @@ -95,19 +95,11 @@ void sub_08064644(Entity* this, ScriptExecutionContext* context) { void sub_0806464C(Entity* this) { s32 tmp; - if (CheckGlobalFlag(0x15) != 0) { + if (CheckGlobalFlag(TABIDACHI) != 0) { tmp = 2; -#if defined(JP) || defined(EU) || defined(DEMO_JP) - } else if (CheckLocalFlag(0x9f) == 0) { -#else - } else if (CheckLocalFlag(0xa0) == 0) { -#endif + } else if (CheckLocalFlag(CASTLE_04_MAID_TALK) == 0) { tmp = 0; -#if defined(JP) || defined(EU) || defined(DEMO_JP) - SetLocalFlag(0x9f); -#else - SetLocalFlag(0xa0); -#endif + SetLocalFlag(CASTLE_04_MAID_TALK); } else { tmp = 1; } diff --git a/src/npc/cat.c b/src/npc/cat.c index d68129e2..f7cb833f 100644 --- a/src/npc/cat.c +++ b/src/npc/cat.c @@ -272,7 +272,7 @@ void sub_08067C44(Entity* this) { s32 iVar4; u32 uVar5; - uVar5 = -((s32) - (gPlayerState.flags & 0x80) >> 0x1f); + uVar5 = -((s32) - (gPlayerState.flags & PL_IS_MINISH) >> 0x1f); if (uVar5 != this->field_0x68.HALF.HI) { if (uVar5 == 0) { sub_08078778(this); diff --git a/src/npc/cow.c b/src/npc/cow.c index c1f2c319..1f7ca1c0 100644 --- a/src/npc/cow.c +++ b/src/npc/cow.c @@ -181,7 +181,7 @@ void Cow_ShowDialogue(Entity* ent) { void sub_0806920C(Entity* ent) { // TODO: figure out what bitfield flag this is - u32 var0 = gPlayerState.flags & 0x80; + u32 var0 = gPlayerState.flags & PL_IS_MINISH; u32 var1 = -var0 >> 0x1F; if (var1 != ent->field_0x6c.HALF.HI) { @@ -200,7 +200,7 @@ void sub_0806924C(Entity* ent) { s8 itype = ent->interactType; if (itype != 0) { // TODO: figure out what bitfield flag this is - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_IS_MINISH) != 0) { if (itype == 2) { ent->action = 4; sub_0806F118(ent); diff --git a/src/npc/cucco.c b/src/npc/cucco.c index 5e24aa88..f2e608b8 100644 --- a/src/npc/cucco.c +++ b/src/npc/cucco.c @@ -59,7 +59,7 @@ void sub_0806E648(Entity* this) { void sub_0806E65C(Entity* this) { if (this->interactType != 0) { - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_IS_MINISH) != 0) { if (this->interactType == 2) { this->action = 4; sub_0806F118(this); diff --git a/src/npc/cuccoChick.c b/src/npc/cuccoChick.c index c8ba2951..34c00503 100644 --- a/src/npc/cuccoChick.c +++ b/src/npc/cuccoChick.c @@ -53,7 +53,7 @@ void sub_0806E824(Entity* this) { void sub_0806E838(Entity* this) { if (this->interactType != 0) { - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_IS_MINISH) != 0) { if (this->interactType == 2) { this->action = 3; sub_0806F118(this); diff --git a/src/npc/dampe.c b/src/npc/dampe.c index a69f9efa..1a62e10a 100644 --- a/src/npc/dampe.c +++ b/src/npc/dampe.c @@ -57,9 +57,9 @@ void sub_0806BE84(Entity* this, ScriptExecutionContext* context) { context->condition = 0; msgIndex = 1; - if (!CheckLocalFlag(0x69)) { + if (!CheckLocalFlag(DANPEI_TALK1ST)) { msgIndex = 0; - SetLocalFlag(0x69); + SetLocalFlag(DANPEI_TALK1ST); context->condition = 1; } // Graveyard key diff --git a/src/npc/dog.c b/src/npc/dog.c index 58245d8d..f17adad8 100644 --- a/src/npc/dog.c +++ b/src/npc/dog.c @@ -71,7 +71,7 @@ void sub_08069B44(Entity* this) { if ((this->flags & 2) != 0) { sub_0807DD50(this); } - if (((this->type == 0) && ((gPlayerState.flags & 0x80) == 0)) && (GetInventoryValue(0x36) != 2)) { + if (((this->type == 0) && ((gPlayerState.flags & PL_IS_MINISH) == 0)) && (GetInventoryValue(0x36) != 2)) { this->action = 4; } #if defined(JP) || defined(EU) || defined(DEMO_JP) @@ -87,7 +87,7 @@ void sub_08069B44(Entity* this) { void sub_08069C40(Entity* this) { UpdateAnimationSingleFrame(this); if (sub_08069F90(this) != 0) { - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_IS_MINISH) != 0) { sub_08069CB8(this); } else { this->animationState = GetAnimationState(this); @@ -270,11 +270,7 @@ void sub_08069F6C(Entity* this) { } u32 sub_08069F90(Entity* this) { -#if defined(JP) || defined(EU) || defined(DEMO_JP) - if ((this->type == 2) && (CheckLocalFlag(0xcc) == 0)) { -#else - if ((this->type == 2) && (CheckLocalFlag(0xcf) == 0)) { -#endif + if ((this->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) { return 1; } else { return sub_080041A0(this, &gPlayerEntity, 0x14, 0x14); @@ -282,14 +278,14 @@ u32 sub_08069F90(Entity* this) { } void sub_08069FBC(Entity* this) { - u32 tmp = (gPlayerState.flags & 0x80) != 0 ? 0x24 : 0x20; + u32 tmp = (gPlayerState.flags & PL_IS_MINISH) != 0 ? 0x24 : 0x20; if ((this->animationState == 1) || (this->animationState == 3)) { this->field_0x6a.HALF.HI = tmp; } } void sub_08069FE8(Entity* this) { - u32 tmp = -((s32) - (gPlayerState.flags & 0x80) >> 0x1f); + u32 tmp = -((s32) - (gPlayerState.flags & PL_IS_MINISH) >> 0x1f); if (tmp != this->field_0x6a.HALF.LO) { if (tmp == 0) { sub_08078778(this); @@ -302,7 +298,7 @@ void sub_08069FE8(Entity* this) { void sub_0806A028(Entity* this) { if (this->interactType != 0) { - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_IS_MINISH) != 0) { if (this->interactType == 2) { this->action = 6; sub_0806F118(this); @@ -326,41 +322,20 @@ void sub_0806A080(Entity* this) { void sub_0806A0A4(Entity* this) { s32 dialog; - if ((gPlayerState.flags & 0x80) != 0) { + if (gPlayerState.flags & PL_IS_MINISH) { dialog = 4; -#if defined(JP) || defined(EU) || defined(DEMO_JP) - if (CheckLocalFlag(0xcc) == 0) { -#else - if (CheckLocalFlag(0xcf) == 0) { -#endif + if (CheckLocalFlag(MACHI_02_DOG) == 0) { dialog = 3; -#if defined(JP) || defined(EU) || defined(DEMO_JP) - SetLocalFlag(0xcc); -#else - SetLocalFlag(0xcf); -#endif + SetLocalFlag(MACHI_02_DOG); sub_0807BA8C(TILE(this->x.HALF.HI, this->y.HALF.HI - 8), (u32)this->collisionLayer); } } else { - dialog = 2; -#if defined(JP) || defined(EU) || defined(DEMO_JP) - if (CheckLocalFlag(0xcc) == 0) { -#else - if (CheckLocalFlag(0xcf) == 0) { -#endif + if (CheckLocalFlag(MACHI_02_DOG) == 0) { dialog = 1; -#if defined(JP) || defined(EU) || defined(DEMO_JP) - if (CheckLocalFlag(0xd8) == 0) { -#else - if (CheckLocalFlag(0xdb) == 0) { -#endif + if (CheckLocalFlag(MACHI_DOG_C) == 0) { dialog = 0; -#if defined(JP) || defined(EU) || defined(DEMO_JP) - SetLocalFlag(0xd8); -#else - SetLocalFlag(0xdb); -#endif + SetLocalFlag(MACHI_DOG_C); } } } @@ -369,9 +344,9 @@ void sub_0806A0A4(Entity* this) { void sub_0806A144(Entity* this) { s32 dialog = 4; - if ((gPlayerState.flags & 0x80) != 0) { + if (gPlayerState.flags & PL_IS_MINISH) { dialog = 3; - if ((GetInventoryValue(0x46) == 0) && (CheckGlobalFlag(0x29) != 0)) { + if (GetInventoryValue(0x46) == 0 && CheckGlobalFlag(MIZUKAKI_START)) { if (CheckLocalFlag(0x85) == 0) { dialog = 1; } else { diff --git a/src/npc/drLeft.c b/src/npc/drLeft.c index d10d99b1..1ee1b863 100644 --- a/src/npc/drLeft.c +++ b/src/npc/drLeft.c @@ -66,9 +66,9 @@ void sub_0806C038(Entity* this) { if (GetInventoryValue(0x46) == 0) { if (GetInventoryValue(0x3a) == 0) { index = 6; - if (CheckLocalFlag(0xaf) == 0) { + if (CheckLocalFlag(LEFT_TALK) == 0) { index = 5; - SetLocalFlag(0xaf); + SetLocalFlag(LEFT_TALK); } } else { index = 7; diff --git a/src/npc/epona.c b/src/npc/epona.c index d7bd6820..4648f004 100644 --- a/src/npc/epona.c +++ b/src/npc/epona.c @@ -58,7 +58,7 @@ void sub_08065A50(Entity* this) { void sub_08065A64(Entity* this) { u32 uVar2; - uVar2 = -(gPlayerState.flags & 0x80) >> 0x1f; + uVar2 = -(gPlayerState.flags & PL_IS_MINISH) >> 0x1f; if (uVar2 != this->field_0x68.HALF.HI) { if (uVar2 == 0) { sub_08078778(this); @@ -71,7 +71,7 @@ void sub_08065A64(Entity* this) { void sub_08065AA4(Entity* this) { if (this->interactType != 0) { - if (gPlayerState.flags & 0x80) { + if (gPlayerState.flags & PL_IS_MINISH) { if (this->interactType == 2) { this->action = 4; sub_0806F118(this); diff --git a/src/npc/gina.c b/src/npc/gina.c index 66af2485..f12537b5 100644 --- a/src/npc/gina.c +++ b/src/npc/gina.c @@ -30,7 +30,7 @@ void Gina(Entity* this) { if (UpdateFuseInteraction(this) != 0) { this->action = 1; #if defined(USA) || defined(DEMO_USA) - SetLocalFlag(0x88); + SetLocalFlag(KS_B15); #endif } break; diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c index 9c92c976..d5fffd9a 100644 --- a/src/npc/mayorHagen.c +++ b/src/npc/mayorHagen.c @@ -57,10 +57,10 @@ void sub_0806CE80(Entity* this) { // flippers if (GetInventoryValue(0x46) == 0) { if (CheckLocalFlag(0x70) != 0) { - v2 = CheckLocalFlag(0x71); + v2 = CheckLocalFlag(MIZUKAKI_HINT3_MAYOR); if (v2 == 0) { v = 0xb; - SetLocalFlag(0x71); + SetLocalFlag(MIZUKAKI_HINT3_MAYOR); } else { v = 0xc; } @@ -68,10 +68,10 @@ void sub_0806CE80(Entity* this) { v = 0xa; } } else { - v2 = CheckLocalFlag(0x89); + v2 = CheckLocalFlag(MAYOR_2_TALK1ST); if (v2 == 0) { v = 0xd; - SetLocalFlag(0x89); + SetLocalFlag(MAYOR_2_TALK1ST); } else { v = 0xe; } diff --git a/src/npc/npc4E.c b/src/npc/npc4E.c index 3a49e4b3..819d1f89 100644 --- a/src/npc/npc4E.c +++ b/src/npc/npc4E.c @@ -105,39 +105,19 @@ void sub_0806DAD0(Entity* this) { void sub_0806DAE8(Entity* this) { switch (this->type - 1) { case 0: -#if defined(JP) || defined(EU) || defined(DEMO_JP) - SetLocalFlag(0xeb); -#else - SetLocalFlag(0xee); -#endif + SetLocalFlag(KUMOUE_02_AWASE_01); break; case 1: -#if defined(JP) || defined(EU) || defined(DEMO_JP) - SetLocalFlag(0xec); -#else - SetLocalFlag(0xef); -#endif + SetLocalFlag(KUMOUE_02_AWASE_02); break; case 2: -#if defined(JP) || defined(EU) || defined(DEMO_JP) - SetLocalFlag(0xed); -#else - SetLocalFlag(0xf0); -#endif + SetLocalFlag(KUMOUE_02_AWASE_03); break; case 3: -#if defined(JP) || defined(EU) || defined(DEMO_JP) - SetLocalFlag(0xee); -#else - SetLocalFlag(0xf1); -#endif + SetLocalFlag(KUMOUE_02_AWASE_04); break; case 4: -#if defined(JP) || defined(EU) || defined(DEMO_JP) - SetLocalFlag(0xef); -#else - SetLocalFlag(0xf2); -#endif + SetLocalFlag(KUMOUE_02_AWASE_05); break; } @@ -147,13 +127,9 @@ void sub_0806DAE8(Entity* this) { void sub_0806DB44(Entity* this, ScriptExecutionContext* context) { context->condition = 0; -#if defined(JP) || defined(EU) || defined(DEMO_JP) - if (CheckLocalFlag(0xeb) != 0 && CheckLocalFlag(0xec) != 0 && CheckLocalFlag(0xed) != 0 && - CheckLocalFlag(0xee) != 0 && CheckLocalFlag(0xef) != 0) { -#else - if (CheckLocalFlag(0xee) != 0 && CheckLocalFlag(0xef) != 0 && CheckLocalFlag(0xf0) != 0 && - CheckLocalFlag(0xf1) != 0 && CheckLocalFlag(0xf2) != 0) { -#endif + if (CheckLocalFlag(KUMOUE_02_AWASE_01) && CheckLocalFlag(KUMOUE_02_AWASE_02) && + CheckLocalFlag(KUMOUE_02_AWASE_03) && CheckLocalFlag(KUMOUE_02_AWASE_04) && + CheckLocalFlag(KUMOUE_02_AWASE_05)) { context->condition = 1; } @@ -262,13 +238,12 @@ void NPC4E_Fusion(Entity* this) { const Hitbox gUnk_08114154 = { 0, -8, 0, 0, 0, 0, 24, 8 }; const u8 gUnk_0811415C[] = { // - 0x00, 0x00, 0x08, 0x08, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x0e, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x04, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x06, 0x04, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x04, - 0x0e, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x08, 0x0e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x08, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x08, 0x0e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x04, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x04, 0x0e, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x10, 0x04, 0x0e, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x08, 0x0e, 0x00, 0x00, 0x00, #ifndef EU - 0x00, 0x00, 0x58, 0x08, 0x0e, 0x00, 0x00, 0x00 + 0x00, 0x00, 0x58, 0x08, 0x0e, 0x00, 0x00, 0x00 #endif }; extern ScreenTransitionData gUnk_0813AB6C; @@ -289,16 +264,14 @@ extern ScreenTransitionData gUnk_0813ACFC; // Array of pointers to ScreenTransitionData const ScreenTransitionData* const gUnk_081141A4[] = { // - &gUnk_0813AB6C, &gUnk_0813ABBC, &gUnk_0813ABE4, &gUnk_0813ABF8, - &gUnk_0813AC0C, &gUnk_0813AC20, &gUnk_0813AC5C, &gUnk_0813AC70, - &gUnk_0813AC84, &gUnk_0813AC98, &gUnk_0813ACAC, &gUnk_0813ACC0, - &gUnk_0813ACD4, &gUnk_0813ACE8, &gUnk_0813AC5C, &gUnk_0813ACFC + &gUnk_0813AB6C, &gUnk_0813ABBC, &gUnk_0813ABE4, &gUnk_0813ABF8, &gUnk_0813AC0C, &gUnk_0813AC20, + &gUnk_0813AC5C, &gUnk_0813AC70, &gUnk_0813AC84, &gUnk_0813AC98, &gUnk_0813ACAC, &gUnk_0813ACC0, + &gUnk_0813ACD4, &gUnk_0813ACE8, &gUnk_0813AC5C, &gUnk_0813ACFC }; // param_2 for the call to sub_0808091C, same indices as gUnk_081141A4 const u8 gUnk_081141E4[] = { // - 0x02, 0x02, 0x04, 0x04, 0x02, 0x02, 0x09, 0x02, - 0x02, 0x04, 0x02, 0x04, 0x04, 0x04, 0x04, 0x02 + 0x02, 0x02, 0x04, 0x04, 0x02, 0x02, 0x09, 0x02, 0x02, 0x04, 0x02, 0x04, 0x04, 0x04, 0x04, 0x02 }; // tiles that are changed? diff --git a/src/npc/percy.c b/src/npc/percy.c index 67500479..85eb80fc 100644 --- a/src/npc/percy.c +++ b/src/npc/percy.c @@ -102,9 +102,9 @@ void sub_0806B504(Entity* this) { idx = 1; if (CheckKinstoneFused(0x21)) { idx = 3; - } else if (!CheckLocalFlag(0x86)) { + } else if (!CheckLocalFlag(URO_POEMN_TALK)) { idx = 0; - SetLocalFlag(0x86); + SetLocalFlag(URO_POEMN_TALK); } MessageNoOverlap(gUnk_08112E54[idx], this); diff --git a/src/npc/pita.c b/src/npc/pita.c index 17cc620a..37090104 100644 --- a/src/npc/pita.c +++ b/src/npc/pita.c @@ -50,8 +50,8 @@ bool32 sub_08062EDC(Entity* this, ScriptExecutionContext* context) { if (GetInventoryValue(0x6b) != 0) { tmp = 3; } - if (CheckLocalFlag(0x5b) == 0) { - SetLocalFlag(0x5b); + if (CheckLocalFlag(SHOP03_PAN_1ST) == 0) { + SetLocalFlag(SHOP03_PAN_1ST); tmp = 4; } if ((Random() & 0xff) > gUnk_0810C430[tmp]) { diff --git a/src/npc/rem.c b/src/npc/rem.c index 48e32e98..27aec22b 100644 --- a/src/npc/rem.c +++ b/src/npc/rem.c @@ -225,7 +225,7 @@ void sub_0806A890(Entity* this) { void sub_0806A8C8(Entity* this) { Entity* entity; - if ((CheckLocalFlag(0x60) == 0) && (entity = CreateNPC(0x37, 2, 0), entity != NULL)) { + if ((CheckLocalFlag(SHOP02_KUTSU_00) == 0) && (entity = CreateNPC(0x37, 2, 0), entity != NULL)) { CopyPosition(this, entity); entity->parent = this; } @@ -278,7 +278,7 @@ void sub_0806A9B0(Entity* this, ScriptExecutionContext* context) { this->actionDelay = gUnk_081122A0[Random() & 7]; this->field_0x80.HWORD = 9; InitializeAnimation(this, 9); - SetLocalFlag(0x62); + SetLocalFlag(NPC37_REM_SLEEP); } void sub_0806A9E8(Entity* this) { diff --git a/src/npc/smallTownMinish.c b/src/npc/smallTownMinish.c index 7a6b8d7b..ead7605f 100644 --- a/src/npc/smallTownMinish.c +++ b/src/npc/smallTownMinish.c @@ -20,7 +20,7 @@ void SmallTownMinish(Entity* this) { } else { sub_0807DD94(this, NULL); } - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_IS_MINISH) != 0) { this->spriteSettings.draw = 1; } else { this->spriteSettings.draw = 0; diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c index 4aa9bcfd..97304d65 100644 --- a/src/npc/townMinish.c +++ b/src/npc/townMinish.c @@ -260,17 +260,17 @@ void sub_0806B004(Entity* this, ScriptExecutionContext* context) { if (CheckLocalFlag(0x73)) { if (GetInventoryValue(0x46) == 0) { idx = 3; - if (CheckLocalFlag(0x78) == 0) { + if (CheckLocalFlag(KHOUSE51_00) == 0) { idx = 2; context->condition = 1; - SetLocalFlag(0x78); + SetLocalFlag(KHOUSE51_00); } } else { idx = 4; } } else { idx = 1; - SetLocalFlag(0x6a); + SetLocalFlag(MIZUKAKI_KOBITO); } } MessageNoOverlap(gUnk_08112C40[idx], this); @@ -318,13 +318,13 @@ void sub_0806B134(Entity* this) { if (GetInventoryValue(0x45)) { idx = 2; - if (CheckLocalFlag(0x7b) == 0) { + if (CheckLocalFlag(KHOUSE42_00) == 0) { idx = 1; - SetLocalFlag(0x7b); + SetLocalFlag(KHOUSE42_00); } } else { idx = 0; - SetGlobalFlag(0x4a); + SetGlobalFlag(POWERGLOVE_HINT); } if (5 < gSave.unk8) { idx = 3; diff --git a/src/object/bigVortex.c b/src/object/bigVortex.c index a34d7e59..f6864d37 100644 --- a/src/object/bigVortex.c +++ b/src/object/bigVortex.c @@ -72,7 +72,7 @@ void sub_08098DC4(Entity* this) { gPlayerState.field_0x34[5] = this->type2; this->action = 4; if (this->type2 == 1) { - SetGlobalFlag(0x23); + SetGlobalFlag(TATSUMAKI); } sub_08077B20(); } diff --git a/src/object/bird.c b/src/object/bird.c index da47a078..bf0a0f14 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -98,7 +98,7 @@ void sub_0809D0AC(Entity* this) { this->action = 1; this->z.WORD = 0; this->collisionLayer = 1; - SetLocalFlag(0x45); + SetLocalFlag(LV3_OCARINA_FALL); SoundReq(SFX_SECRET); fx = CreateFx(this, FX_DASH, 0); if (fx != NULL) { @@ -119,7 +119,7 @@ void sub_0809D10C(Entity* this) { } void sub_0809D130(Entity* this) { - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_IS_MINISH) != 0) { sub_0800445C(this); } else if (sub_08017850(this) != 0) { CreateItemEntity(0x17, 0, 0); diff --git a/src/object/book.c b/src/object/book.c index 4b20cf8e..d2ce8c6e 100644 --- a/src/object/book.c +++ b/src/object/book.c @@ -26,7 +26,7 @@ void sub_0809B3C4(Entity* this) { DeleteThisEntity(); } } else { - if (CheckLocalFlag(0x73)) { + if (CheckLocalFlag(MIZUKAKI_BOOK_ALLBACK)) { DeleteThisEntity(); } @@ -143,7 +143,7 @@ void sub_0809B56C(Entity* this) { } void sub_0809B5B4(Entity* this) { - if (gPlayerState.flags & 0x80) { + if (gPlayerState.flags & PL_IS_MINISH) { sub_0800445C(this); } else if (sub_08017850(this)) { CreateItemEntity(this->type + 0x39, 0, 0); diff --git a/src/object/button.c b/src/object/button.c index 16b1896f..7a00b5bb 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -153,7 +153,7 @@ Entity* sub_08081D74(Entity* this) { } ent = 0; if (sub_08081E0C(this)) { - if (!(gPlayerState.flags & 0x10) && !(gPlayerState.flags & 0x80)) { + if (!(gPlayerState.flags & 0x10) && !(gPlayerState.flags & PL_IS_MINISH)) { ent = &gPlayerEntity; } } else { diff --git a/src/object/heartContainer.c b/src/object/heartContainer.c index a2abfbda..cbaff954 100644 --- a/src/object/heartContainer.c +++ b/src/object/heartContainer.c @@ -59,7 +59,7 @@ static void sub_0808E714(Entity* this) { static void sub_0808E764(Entity* this) { sub_08080CB4(this); - if (!(gPlayerState.flags & 0x80) && sub_08017850(this)) { + if (!(gPlayerState.flags & PL_IS_MINISH) && sub_08017850(this)) { SetFlag(this->cutsceneBeh.HWORD); CreateItemEntity(0x62, 0, 0); DeleteThisEntity(); diff --git a/src/object/lilypadSmall.c b/src/object/lilypadSmall.c index 94aec1f7..8df6197f 100644 --- a/src/object/lilypadSmall.c +++ b/src/object/lilypadSmall.c @@ -32,7 +32,7 @@ void LilypadSmall(Entity* this) { } u32 sub_08097ADC(Entity* this) { - if ((gPlayerState.flags & 0x80) == 0) { + if ((gPlayerState.flags & PL_IS_MINISH) == 0) { return 0; } else if (sub_080041A0(this, &gPlayerEntity, 8, 8) == 0) { return 0; diff --git a/src/object/minishSizedEntrance.c b/src/object/minishSizedEntrance.c index cff1f9ed..9d409f39 100644 --- a/src/object/minishSizedEntrance.c +++ b/src/object/minishSizedEntrance.c @@ -31,8 +31,8 @@ void sub_08090F00(Entity* this) { DeleteThisEntity(); } } - if ((gPlayerState.flags & 0x80) && sub_080041A0(this, &gPlayerEntity, 4, 4) && (gPlayerEntity.z.HALF.HI == 0) && - (((u16)gPlayerState.field_0x90.HALF.LO) & gUnk_0812225C[this->type2])) { + if ((gPlayerState.flags & PL_IS_MINISH) && sub_080041A0(this, &gPlayerEntity, 4, 4) && + (gPlayerEntity.z.HALF.HI == 0) && (((u16)gPlayerState.field_0x90.HALF.LO) & gUnk_0812225C[this->type2])) { DoExitTransition(GetCurrentRoomProperty(this->actionDelay)); } } diff --git a/src/object/pot.c b/src/object/pot.c index 58989f44..3ac8f0f0 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -85,7 +85,7 @@ void sub_08082310(Entity* this) { this->direction = (tileType - 0x4001) * 8; this->actionDelay = 32; this->action = 4; - if (gPlayerState.flags & 0x80) { + if (gPlayerState.flags & PL_IS_MINISH) { this->speed >>= 1; this->actionDelay = 64; } @@ -184,7 +184,7 @@ void sub_08082614(Entity* this) { } this->action = 1; - if (gPlayerState.flags & 0x80) { + if (gPlayerState.flags & PL_IS_MINISH) { this->speed <<= 1; } diff --git a/src/object/warpPoint.c b/src/object/warpPoint.c index d20ceadf..a83de152 100644 --- a/src/object/warpPoint.c +++ b/src/object/warpPoint.c @@ -206,7 +206,7 @@ void sub_0808B73C(Entity* this) { } u32 sub_0808B7C8(Entity* this) { - if (!(gPlayerState.flags & 0x80) && gPlayerState.field_0xa8 != 0x12 && gPlayerEntity.health != 0 && + if (!(gPlayerState.flags & PL_IS_MINISH) && gPlayerState.field_0xa8 != 0x12 && gPlayerEntity.health != 0 && sub_08079F8C() && sub_080041A0(this, &gPlayerEntity, 5, 5) && gPlayerEntity.z.HALF.HI == 0) { if (this->actionDelay == 0 && gPlayerEntity.action == 0x1b) { sub_080791D0(); diff --git a/src/player.c b/src/player.c index b89a9fde..92924b68 100644 --- a/src/player.c +++ b/src/player.c @@ -160,7 +160,7 @@ void sub_08070C3C(Entity* this) { gPlayerState.jumpStatus = 0; - if ((gPlayerState.flags & 0x80) != 0) + if ((gPlayerState.flags & PL_IS_MINISH) != 0) gPlayerState.field_0x8 = 0x1ba; else if ((gPlayerState.flags & 8) != 0) gPlayerState.field_0x8 = 0x458; @@ -205,7 +205,7 @@ void sub_08070D38(Entity* this) { this->actionDelay = gPlayerState.field_0x38; this->spriteIndex = 1; - if ((gPlayerState.flags & 0x80) == 0) { + if ((gPlayerState.flags & PL_IS_MINISH) == 0) { this->zVelocity = 0x20000; gPlayerState.field_0x8 = 0x114; sub_08080964(16, 0); @@ -259,7 +259,7 @@ NONMATCH("asm/non_matching/player/sub_08070DC4.inc", void sub_08070DC4(Entity* t this->actionDelay = 8; this->subAction++; - if ((gPlayerState.flags & 0x80) == 0) + if ((gPlayerState.flags & PL_IS_MINISH) == 0) gPlayerState.field_0x8 = 0x100; } END_NONMATCH @@ -290,7 +290,7 @@ void sub_08070EDC(Entity* this) { if ((gMessage.doTextBox & 0x7f) != 0) this->subAction = 1; - if ((gPlayerState.flags & 0x80) == 0) + if ((gPlayerState.flags & PL_IS_MINISH) == 0) sub_08079938(); else gPlayerState.field_0x8 = 0xc18; @@ -330,7 +330,7 @@ void sub_08070FA4(Entity* this) { gPlayerState.flags |= 1; gPlayerState.jumpStatus = 0; - if ((gPlayerState.flags & 0x80) == 0) { + if ((gPlayerState.flags & PL_IS_MINISH) == 0) { if (gPlayerState.flags & 0x8) { if (sub_080542AC(gPlayerState.field_0x38)) { temp = 0x45e; @@ -390,7 +390,7 @@ void sub_080710A8(Entity* this) { gPlayerState.playerAction = 0; if ((gPlayerState.heldObject | gPlayerState.field_0x1a[1]) == 0) { - if ((gPlayerState.flags & 0x80) == 0) { + if ((gPlayerState.flags & PL_IS_MINISH) == 0) { ResetPlayer(); if ((gPlayerState.flags & 0x8) != 0) { @@ -455,7 +455,7 @@ void sub_08071130(Entity* this) { this->actionDelay = 6; - if (((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) && ((gPlayerState.flags & 0x80) == 0)) { + if (((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) && ((gPlayerState.flags & PL_IS_MINISH) == 0)) { if (gPlayerState.flags & 0x8) { gPlayerState.field_0x8 = 0x424; } else { @@ -472,7 +472,7 @@ void sub_08071130(Entity* this) { void sub_08071208(Entity* this) { if ((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) { - if ((gPlayerState.flags & 0x80) == 0) { + if ((gPlayerState.flags & PL_IS_MINISH) == 0) { UpdateAnimationSingleFrame(this); } } @@ -494,7 +494,7 @@ void sub_0807127C(Entity* this) { this->subAction = 1; this->spritePriority.b1 = 0; - if (gPlayerState.flags & 0x80) { + if (gPlayerState.flags & PL_IS_MINISH) { this->actionDelay = 0x3c; gPlayerState.field_0x8 = 0xc19; SoundReq(SFX_WATER_SPLASH); @@ -519,7 +519,7 @@ void sub_080712F0(Entity* this) { temp = FALSE; - if ((gPlayerState.flags & 0x80) != 0) { + if ((gPlayerState.flags & PL_IS_MINISH) != 0) { if (--this->actionDelay == 0) temp = TRUE; } else if ((this->frame & 0x80) != 0) { @@ -657,7 +657,7 @@ void PortalActivateUpdate(Entity* this) { UpdateAnimationSingleFrame(this); - if (gPlayerState.flags & 0x80) + if (gPlayerState.flags & PL_IS_MINISH) this->subAction = 4; } @@ -747,7 +747,7 @@ void sub_080718A0(Entity* this) { gUnk_03003DC0.unk0 = 6; this->updateConditions = 6; - if (gPlayerState.flags & 0x80) { + if (gPlayerState.flags & PL_IS_MINISH) { this->subAction = 2; this->spritePriority.b1 = 0; sub_08052BB8(); @@ -794,7 +794,7 @@ void sub_08071990(Entity* this) { if ((gMessage.doTextBox & 0x7f) == 0) { this->subAction++; - if ((gPlayerState.flags & 0x80) == 0) { + if ((gPlayerState.flags & PL_IS_MINISH) == 0) { if (this->animationState == 2) gPlayerState.field_0x8 = 0x3cd; else @@ -806,7 +806,7 @@ void sub_08071990(Entity* this) { return; } - if (gPlayerState.flags & 0x80) + if (gPlayerState.flags & PL_IS_MINISH) return; if (this->animationState == 2) @@ -856,7 +856,7 @@ void sub_08071AB0(Entity* this) { this->actionDelay = 0; this->field_0xf = 1; } else { - this->speed = (gPlayerState.flags & 0x80) ? 64 : 128; + this->speed = (gPlayerState.flags & PL_IS_MINISH) ? 64 : 128; } sub_08071AF0(this); } @@ -891,7 +891,7 @@ void sub_08071B60(Entity* this) { this->knockbackDuration = 0; sub_080728AC(this); this->field_0xf = 6; - if ((gPlayerState.flags & 0x80) == 0) { + if ((gPlayerState.flags & PL_IS_MINISH) == 0) { gPlayerState.field_0x8 = 0x104; this->spriteIndex = 3; InitAnimationForceUpdate(this, (this->animationState >> 1) + 0x3c); @@ -921,7 +921,7 @@ void sub_08071BDC(Entity* this) { } gPlayerState.playerAction = 0; - if (gPlayerState.flags & 0x80) { + if (gPlayerState.flags & PL_IS_MINISH) { if ((u8)(gPlayerState.field_0x10[2] - 8) < 3) { sub_0807A298(this); RespawnPlayer(); @@ -949,7 +949,7 @@ void sub_08071CAC(Entity* this) { UpdateAnimationSingleFrame(this); if (this->frame & 0x80) { u32 temp; - if ((gPlayerState.flags & 0x80) == 0) + if ((gPlayerState.flags & PL_IS_MINISH) == 0) temp = (gPlayerState.flags & 8) ? 0x45a : 0x2bd; else temp = 0xc1b; @@ -1273,7 +1273,7 @@ void sub_080722DC(Entity* this) { Entity* ent; COLLISION_OFF(this); - if (!(gPlayerState.flags & 0x80)) { + if (!(gPlayerState.flags & PL_IS_MINISH)) { this->subAction = 1; this->zVelocity = 0x28000; ent = CreateObject(OBJECT_42, 0x80, 0); @@ -1377,7 +1377,7 @@ void sub_080724DC(Entity* this) { this->spriteSettings.draw = 3; this->subAction = 1; if (gRoomVars.field_0x0 == 0) { - if (gPlayerState.flags & 0x80) { + if (gPlayerState.flags & PL_IS_MINISH) { gPlayerState.field_0x8 = 0xc18; } else { gPlayerState.field_0x8 = 0x104; @@ -1429,7 +1429,7 @@ void sub_08072650(Entity* this) { this->actionDelay = 0; ResetPlayer(); temp = gPlayerState.flags; - if (gPlayerState.flags & 0x80) { + if (gPlayerState.flags & PL_IS_MINISH) { this->spritePriority.b1 = 0; gPlayerState.field_0x8 = 0xc08; } else { @@ -1459,7 +1459,7 @@ void sub_080726F4(Entity* this) { } this->direction = (this->animationState & 6) << 2; - if (((gPlayerState.flags & 0x80) == 0) && (--this->actionDelay == 0xff)) { + if (((gPlayerState.flags & PL_IS_MINISH) == 0) && (--this->actionDelay == 0xff)) { CreateFx(&gPlayerEntity, FX_DASH, 0x40); this->actionDelay = 4; } @@ -1508,7 +1508,7 @@ void sub_080726F4(Entity* this) { sub_08078F24(); sub_08079E08(); } - if (((this->frame & 0x10) == 0) && ((gPlayerState.flags & 0x80) == 0)) { + if (((this->frame & 0x10) == 0) && ((gPlayerState.flags & PL_IS_MINISH) == 0)) { *(u8*)&this->hurtType = 0; } if ((this->frame & 0x40) != 0) { @@ -1525,7 +1525,7 @@ void sub_080726F4(Entity* this) { void sub_080728AC(Entity* this) { sub_08079938(); - if (gPlayerState.flags & 0x80) + if (gPlayerState.flags & PL_IS_MINISH) sub_0807B068(this); else sub_08078F60(); @@ -1534,7 +1534,7 @@ void sub_080728AC(Entity* this) { this->speed = 0; if (!(gPlayerState.flags & 0x40)) gPlayerEntity.spriteSettings.draw = 3; - if (!(gPlayerState.flags & 0x80)) + if (!(gPlayerState.flags & PL_IS_MINISH)) gPlayerEntity.spritePriority.b1 = 1; if (!(gRoomControls.unk6 & 4)) { @@ -1667,7 +1667,7 @@ void sub_08072C48(Entity* this) { if (gPlayerState.field_0x14) { if (sub_08008B22()) { gPlayerState.field_0x10[1] = 7; - if (!(gPlayerState.flags & 0x80)) { + if (!(gPlayerState.flags & PL_IS_MINISH)) { sub_080791BC(); } } @@ -1783,7 +1783,7 @@ NONMATCH("asm/non_matching/player/sub_08072D54.inc", void sub_08072D54(Entity* t if (gPlayerState.field_0x14 != 0) { if (sub_08008B22() == 0) { gPlayerState.field_0x10[1] = 7; - if (!(gPlayerState.flags & 0x80)) { + if (!(gPlayerState.flags & PL_IS_MINISH)) { sub_080791BC(); } } diff --git a/src/room.c b/src/room.c index 5590cf8f..beb831f3 100644 --- a/src/room.c +++ b/src/room.c @@ -4872,7 +4872,7 @@ extern EntityData gUnk_080F30CC; void sub_0804E7A4(void) { // dog food - if ((GetInventoryValue(0x36) == 1) && !CheckGlobalFlag(BIN_DOGFOOD) && (gPlayerState.flags & 0x80) == 0) { + if ((GetInventoryValue(0x36) == 1) && !CheckGlobalFlag(BIN_DOGFOOD) && (gPlayerState.flags & PL_IS_MINISH) == 0) { LoadRoomEntityList(&gUnk_080F30CC); } } diff --git a/src/script.c b/src/script.c index fbb0be33..50ab0bc5 100644 --- a/src/script.c +++ b/src/script.c @@ -806,7 +806,7 @@ void ScriptCommand_CheckEntityInteractType(Entity* entity, ScriptExecutionContex } void ScriptCommand_0807E30C(Entity* entity, ScriptExecutionContext* context) { - if ((context->unk_1A & 0xF) == 0 && (gPlayerState.flags & 0x80) == 0 && + if ((context->unk_1A & 0xF) == 0 && (gPlayerState.flags & PL_IS_MINISH) == 0 && sub_080041A0(entity, &gPlayerEntity, 0x28, 0x28)) { entity->animationState = sub_0806F5B0(GetFacingDirection(entity, &gPlayerEntity)); }