Merge pull request #139 from notyourav/ply

several more player functions done
This commit is contained in:
notyourav
2021-03-17 20:28:11 -07:00
committed by GitHub
79 changed files with 1368 additions and 1919 deletions
+2 -2
View File
@@ -182,7 +182,7 @@ typedef struct Entity
u32 * field_0x4;
EntityType entityType;
u8 action;
u8 previousActionFlag;
u8 subAction;
u8 actionDelay;
u8 field_0xf;
u8 flags;
@@ -199,7 +199,7 @@ What's the 12th byte in this struct?
u32 * field_0x4; //4-7
EntityType entityType; //8-11
u8 action; //12
u8 previousActionFlag; //13
u8 subAction; //13
```
---
+2 -2
View File
@@ -176,7 +176,7 @@ _08088B82:
subs r1, #0x50
movs r2, #0xa0
movs r3, #0x30
bl sub_0806FBFC
bl CheckPlayerProximity
cmp r0, #0
beq _08088BBA
ldrb r0, [r5]
@@ -194,7 +194,7 @@ _08088BBA:
adds r1, #0x30
movs r2, #0xa0
movs r3, #0x30
bl sub_0806FBFC
bl CheckPlayerProximity
cmp r0, #0
beq _08088BDE
ldrb r0, [r5]
+2 -2
View File
@@ -583,7 +583,7 @@ _0806D46C:
ldrsh r1, [r4, r2]
movs r2, #0x40
movs r3, #0x40
bl sub_0806FBFC
bl CheckPlayerProximity
cmp r0, #0
beq _0806D4AC
adds r2, r4, #0
@@ -724,7 +724,7 @@ _0806D540:
ldrsh r1, [r4, r2]
movs r2, #0x18
movs r3, #0x40
bl sub_0806FBFC
bl CheckPlayerProximity
cmp r0, #0
beq _0806D5B4
_0806D590:
+1 -1
View File
@@ -719,7 +719,7 @@ sub_08008AC6: @ 0x08008AC6
movs r3, #0xe2
movs r2, #0x3d
strb r3, [r0, r2]
bl sub_08079458
bl RespawnPlayer
_08008AEC:
pop {r0, pc}
+2 -2
View File
@@ -144,8 +144,8 @@ UnloadHitbox: @ 0x0806FBEC
str r0, [r4, #0x48]
pop {r4, pc}
thumb_func_start sub_0806FBFC
sub_0806FBFC: @ 0x0806FBFC
thumb_func_start CheckPlayerProximity
CheckPlayerProximity: @ 0x0806FBFC
push {r4, r5, r6, lr}
adds r5, r3, #0
ldr r4, _0806FC20 @ =gPlayerEntity
+18 -1331
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -175,8 +175,8 @@ _08073418:
.align 2, 0
_0807341C: .4byte gRoomControls
thumb_func_start sub_08073420
sub_08073420: @ 0x08073420
thumb_func_start PlayerParachute
PlayerParachute: @ 0x08073420
push {r4, lr}
adds r4, r0, #0
bl sub_08078EFC
@@ -1280,8 +1280,8 @@ _08073C58:
_08073C66:
pop {pc}
thumb_func_start sub_08073C68
sub_08073C68: @ 0x08073C68
thumb_func_start PlayerMinish
PlayerMinish: @ 0x08073C68
push {lr}
ldr r2, _08073C7C @ =gUnk_0811BC60
ldrb r1, [r0, #0xd]
@@ -2760,7 +2760,7 @@ _0807476C:
strb r0, [r1]
subs r0, #0x24
bl ModHealth
bl sub_08079458
bl RespawnPlayer
_08074792:
pop {r4, pc}
.align 2, 0
+7 -7
View File
@@ -866,7 +866,7 @@ sub_08078EFC: @ 0x08078EFC
strb r2, [r0, #0xc]
strb r1, [r0, #0xd]
strb r1, [r3, #0xc]
bl sub_08070680
bl DoPlayerAction
movs r0, #1
b _08078F22
.align 2, 0
@@ -1583,8 +1583,8 @@ _08079454:
_08079456:
pop {r4, r5, pc}
thumb_func_start sub_08079458
sub_08079458: @ 0x08079458
thumb_func_start RespawnPlayer
RespawnPlayer: @ 0x08079458
push {r4, r5, lr}
ldr r4, _08079498 @ =gPlayerEntity
movs r1, #0
@@ -1915,7 +1915,7 @@ _080796C8:
strb r1, [r0, #0x10]
movs r1, #0x81
strb r1, [r4, #2]
bl sub_08070680
bl DoPlayerAction
movs r0, #1
b _080796FE
.align 2, 0
@@ -2537,7 +2537,7 @@ sub_08079B24: @ 0x08079B24
ldrb r0, [r0]
cmp r0, #0
beq _08079B6C
bl sub_08079458
bl RespawnPlayer
b _08079BC0
.align 2, 0
_08079B60: .4byte gPlayerEntity
@@ -5401,8 +5401,8 @@ sub_0807B0C8: @ 0x0807B0C8
.align 2, 0
_0807B0F8: .4byte gPlayerEntity
thumb_func_start sub_0807B0FC
sub_0807B0FC: @ 0x0807B0FC
thumb_func_start PlayerWarp
PlayerWarp: @ 0x0807B0FC
push {lr}
ldr r2, _0807B110 @ =gUnk_0811C27C
ldrb r1, [r0, #0xd]
+1 -1
View File
@@ -230,7 +230,7 @@ sub_0808C01C: @ 0x0808C01C
subs r1, #0x18
movs r2, #0x30
movs r3, #0x30
bl sub_0806FBFC
bl CheckPlayerProximity
cmp r0, #0
beq _0808C0A6
ldr r2, _0808C06C @ =gArea
+172
View File
@@ -0,0 +1,172 @@
.syntax unified
push {r4, r5, r6, r7, lr}
mov r7, r8
push {r7}
adds r5, r0, #0
adds r0, #0x81
ldrb r0, [r0]
cmp r0, #0
beq _08071654
adds r1, r5, #0
adds r1, #0x80
ldr r0, [r1]
adds r0, #0x80
lsls r0, r0, #0x14
lsrs r7, r0, #0x17
adds r4, r1, #0
b _0807166A
_08071654:
adds r4, r5, #0
adds r4, #0x80
ldrb r1, [r4]
lsrs r1, r1, #6
movs r0, #3
eors r1, r0
adds r1, #1
movs r0, #0x10
bl __divsi3
asrs r7, r0, #1
_0807166A:
adds r0, r5, #0
adds r0, #0x84
ldr r3, [r0]
movs r1, #0x80
lsls r1, r1, #1
adds r2, r0, #0
cmp r3, r1
bls _08071684
adds r0, r3, #0
adds r0, #0x80
lsls r0, r0, #0x14
lsrs r3, r0, #0x17
b _08071694
_08071684:
cmp r3, r1
bne _0807168C
movs r3, #0x10
b _08071694
_0807168C:
ldr r1, _080716B0 @ =gUnk_0811BABC
lsrs r0, r3, #5
adds r0, r0, r1
ldrb r3, [r0]
_08071694:
movs r0, #0x80
lsls r0, r0, #9
mov r8, r0
adds r0, r5, #0
adds r0, #0x5a
ldrb r0, [r0]
cmp r0, #2
beq _080716EA
cmp r0, #2
bgt _080716B4
cmp r0, #1
beq _080716BA
b _08071754
.align 2, 0
_080716B0: .4byte gUnk_0811BABC
_080716B4:
cmp r0, #3
beq _0807171E
b _08071754
_080716BA:
movs r1, #0x29
adds r1, r1, r5
mov ip, r1
ldrb r1, [r1]
movs r0, #0x39
rsbs r0, r0, #0
ands r0, r1
mov r1, ip
strb r0, [r1]
ldr r0, [r4]
cmp r0, #0x80
bls _080716D6
subs r0, r0, r7
str r0, [r4]
_080716D6:
lsls r1, r3, #1
ldr r0, [r2]
adds r0, r0, r1
str r0, [r2]
mov r0, r8
lsls r1, r0, #1
ldr r0, [r5, #0x30]
adds r0, r0, r1
str r0, [r5, #0x30]
b _08071754
_080716EA:
ldr r0, [r4]
adds r0, r0, r7
str r0, [r4]
ldr r1, [r2]
movs r6, #0x80
lsls r6, r6, #1
cmp r1, r6
bls _08071710
ldr r0, _0807170C @ =0x0000017F
cmp r1, r0
bhi _08071702
lsrs r3, r3, #1
_08071702:
subs r0, r1, r3
cmp r0, #0xff
bhi _08071716
str r6, [r2]
b _08071718
.align 2, 0
_0807170C: .4byte 0x0000017F
_08071710:
cmp r1, #0x80
bls _08071718
subs r0, r1, r3
_08071716:
str r0, [r2]
_08071718:
ldr r0, [r5, #0x34]
mov r1, r8
b _08071750
_0807171E:
ldr r0, [r4]
ldr r6, _08071740 @ =0x0000033F
cmp r0, r6
bhi _0807172A
adds r0, r0, r7
str r0, [r4]
_0807172A:
ldr r1, [r2]
cmp r1, r6
bls _08071744
movs r0, #8
strb r0, [r5, #0xe]
movs r0, #0x1e
strb r0, [r5, #0xf]
movs r0, #6
strb r0, [r5, #0xd]
b _0807174A
.align 2, 0
_08071740: .4byte 0x0000033F
_08071744:
lsls r0, r3, #1
adds r0, r1, r0
str r0, [r2]
_0807174A:
mov r0, r8
lsls r1, r0, #1
ldr r0, [r5, #0x34]
_08071750:
subs r0, r0, r1
str r0, [r5, #0x34]
_08071754:
ldr r1, [r4]
ldr r2, [r2]
adds r0, r5, #0
movs r3, #0
bl sub_0805EC9C
adds r0, r5, #0
bl UpdateAnimationSingleFrame
pop {r3}
mov r8, r3
pop {r4, r5, r6, r7, pc}
.syntax divided
+1 -1
View File
@@ -281,7 +281,7 @@ _08083DA0:
_08083DA8: .4byte gSave
_08083DAC:
ldrb r0, [r4, #0xa]
bl sub_080544DC
bl GetBottleContaining
adds r1, r0, #0
cmp r1, #0
beq _08083DC8
-138
View File
@@ -708,141 +708,3 @@ gUnk_0811B9D0:: @ 0811B9D0
gUnk_0811B9D8:: @ 0811B9D8
.incbin "baserom.gba", 0x11B9D8, 0x0000008
gUnk_0811B9E0:: @ 0811B9E0
.incbin "baserom.gba", 0x11B9E0, 0x0000080
gUnk_0811BA60:: @ 0811BA60
.incbin "baserom.gba", 0x11BA60, 0x0000008
gUnk_0811BA68:: @ 0811BA68
.incbin "baserom.gba", 0x11BA68, 0x000000C
gUnk_0811BA74:: @ 0811BA74
.incbin "baserom.gba", 0x11BA74, 0x0000008
gUnk_0811BA7C:: @ 0811BA7C
.incbin "baserom.gba", 0x11BA7C, 0x000000C
gUnk_0811BA88:: @ 0811BA88
.incbin "baserom.gba", 0x11BA88, 0x000000C
gUnk_0811BA94:: @ 0811BA94
.incbin "baserom.gba", 0x11BA94, 0x0000008
gUnk_0811BA9C:: @ 0811BA9C
.incbin "baserom.gba", 0x11BA9C, 0x0000020
gUnk_0811BABC:: @ 0811BABC
.incbin "baserom.gba", 0x11BABC, 0x0000008
gUnk_0811BAC4:: @ 0811BAC4
.incbin "baserom.gba", 0x11BAC4, 0x0000010
gUnk_0811BAD4:: @ 0811BAD4
.incbin "baserom.gba", 0x11BAD4, 0x0000010
gUnk_0811BAE4:: @ 0811BAE4
.incbin "baserom.gba", 0x11BAE4, 0x000000C
gUnk_0811BAF0:: @ 0811BAF0
.incbin "baserom.gba", 0x11BAF0, 0x000003C
gUnk_0811BB2C:: @ 0811BB2C
.incbin "baserom.gba", 0x11BB2C, 0x000000C
gUnk_0811BB38:: @ 0811BB38
.incbin "baserom.gba", 0x11BB38, 0x0000004
gUnk_0811BB3C:: @ 0811BB3C
.incbin "baserom.gba", 0x11BB3C, 0x000000C
gUnk_0811BB48:: @ 0811BB48
.incbin "baserom.gba", 0x11BB48, 0x0000008
gUnk_0811BB50:: @ 0811BB50
.incbin "baserom.gba", 0x11BB50, 0x0000008
gUnk_0811BB58:: @ 0811BB58
.incbin "baserom.gba", 0x11BB58, 0x0000008
gUnk_0811BB60:: @ 0811BB60
.incbin "baserom.gba", 0x11BB60, 0x0000008
gUnk_0811BB68:: @ 0811BB68
.incbin "baserom.gba", 0x11BB68, 0x0000008
gUnk_0811BB70:: @ 0811BB70
.incbin "baserom.gba", 0x11BB70, 0x0000010
gUnk_0811BB80:: @ 0811BB80
.incbin "baserom.gba", 0x11BB80, 0x0000008
gUnk_0811BB88:: @ 0811BB88
.incbin "baserom.gba", 0x11BB88, 0x0000008
gUnk_0811BB90:: @ 0811BB90
.incbin "baserom.gba", 0x11BB90, 0x0000008
gUnk_0811BB98:: @ 0811BB98
.incbin "baserom.gba", 0x11BB98, 0x0000014
gUnk_0811BBAC:: @ 0811BBAC
.incbin "baserom.gba", 0x11BBAC, 0x0000010
gUnk_0811BBBC:: @ 0811BBBC
.incbin "baserom.gba", 0x11BBBC, 0x0000006
gUnk_0811BBC2:: @ 0811BBC2
.incbin "baserom.gba", 0x11BBC2, 0x0000006
gUnk_0811BBC8:: @ 0811BBC8
.incbin "baserom.gba", 0x11BBC8, 0x0000006
gUnk_0811BBCE:: @ 0811BBCE
.incbin "baserom.gba", 0x11BBCE, 0x0000006
gUnk_0811BBD4:: @ 0811BBD4
.incbin "baserom.gba", 0x11BBD4, 0x0000010
gUnk_0811BBE4:: @ 0811BBE4
.incbin "baserom.gba", 0x11BBE4, 0x0000008
gUnk_0811BBEC:: @ 0811BBEC
.incbin "baserom.gba", 0x11BBEC, 0x000000C
gUnk_0811BBF8:: @ 0811BBF8
.incbin "baserom.gba", 0x11BBF8, 0x0000010
gUnk_0811BC08:: @ 0811BC08
.incbin "baserom.gba", 0x11BC08, 0x0000020
gUnk_0811BC28:: @ 0811BC28
.incbin "baserom.gba", 0x11BC28, 0x0000008
gUnk_0811BC30:: @ 0811BC30
.incbin "baserom.gba", 0x11BC30, 0x0000008
gUnk_0811BC38:: @ 0811BC38
.incbin "baserom.gba", 0x11BC38, 0x0000008
gUnk_0811BC40:: @ 0811BC40
.incbin "baserom.gba", 0x11BC40, 0x0000008
gUnk_0811BC48:: @ 0811BC48
.incbin "baserom.gba", 0x11BC48, 0x0000018
gUnk_0811BC60:: @ 0811BC60
.incbin "baserom.gba", 0x11BC60, 0x0000020
gUnk_0811BC80:: @ 0811BC80
.incbin "baserom.gba", 0x11BC80, 0x0000008
gUnk_0811BC88:: @ 0811BC88
.incbin "baserom.gba", 0x11BC88, 0x0000010
gUnk_0811BC98:: @ 0811BC98
.incbin "baserom.gba", 0x11BC98, 0x000001C
gUnk_0811BCB4:: @ 0811BCB4
.incbin "baserom.gba", 0x11BCB4, 0x0000010
+140
View File
@@ -0,0 +1,140 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_0811BA60:: @ 0811BA60
.incbin "baserom.gba", 0x11BA60, 0x0000008
gUnk_0811BA68:: @ 0811BA68
.incbin "baserom.gba", 0x11BA68, 0x000000C
gUnk_0811BA74:: @ 0811BA74
.incbin "baserom.gba", 0x11BA74, 0x0000008
gUnk_0811BA7C:: @ 0811BA7C
.incbin "baserom.gba", 0x11BA7C, 0x000000C
gUnk_0811BA88:: @ 0811BA88
.incbin "baserom.gba", 0x11BA88, 0x000000C
gUnk_0811BA94:: @ 0811BA94
.incbin "baserom.gba", 0x11BA94, 0x0000008
gUnk_0811BA9C:: @ 0811BA9C
.incbin "baserom.gba", 0x11BA9C, 0x0000020
gUnk_0811BABC:: @ 0811BABC
.incbin "baserom.gba", 0x11BABC, 0x0000008
gUnk_0811BAC4:: @ 0811BAC4
.incbin "baserom.gba", 0x11BAC4, 0x0000010
gUnk_0811BAD4:: @ 0811BAD4
.incbin "baserom.gba", 0x11BAD4, 0x0000010
gUnk_0811BAE4:: @ 0811BAE4
.incbin "baserom.gba", 0x11BAE4, 0x000000C
gUnk_0811BAF0:: @ 0811BAF0
.incbin "baserom.gba", 0x11BAF0, 0x000003C
gUnk_0811BB2C:: @ 0811BB2C
.incbin "baserom.gba", 0x11BB2C, 0x000000C
gUnk_0811BB38:: @ 0811BB38
.incbin "baserom.gba", 0x11BB38, 0x0000004
gUnk_0811BB3C:: @ 0811BB3C
.incbin "baserom.gba", 0x11BB3C, 0x000000C
gUnk_0811BB48:: @ 0811BB48
.incbin "baserom.gba", 0x11BB48, 0x0000008
gUnk_0811BB50:: @ 0811BB50
.incbin "baserom.gba", 0x11BB50, 0x0000008
gUnk_0811BB58:: @ 0811BB58
.incbin "baserom.gba", 0x11BB58, 0x0000008
gUnk_0811BB60:: @ 0811BB60
.incbin "baserom.gba", 0x11BB60, 0x0000008
gUnk_0811BB68:: @ 0811BB68
.incbin "baserom.gba", 0x11BB68, 0x0000008
gUnk_0811BB70:: @ 0811BB70
.incbin "baserom.gba", 0x11BB70, 0x0000010
gUnk_0811BB80:: @ 0811BB80
.incbin "baserom.gba", 0x11BB80, 0x0000008
gUnk_0811BB88:: @ 0811BB88
.incbin "baserom.gba", 0x11BB88, 0x0000008
gUnk_0811BB90:: @ 0811BB90
.incbin "baserom.gba", 0x11BB90, 0x0000008
gUnk_0811BB98:: @ 0811BB98
.incbin "baserom.gba", 0x11BB98, 0x0000014
gUnk_0811BBAC:: @ 0811BBAC
.incbin "baserom.gba", 0x11BBAC, 0x0000010
gUnk_0811BBBC:: @ 0811BBBC
.incbin "baserom.gba", 0x11BBBC, 0x0000006
gUnk_0811BBC2:: @ 0811BBC2
.incbin "baserom.gba", 0x11BBC2, 0x0000006
gUnk_0811BBC8:: @ 0811BBC8
.incbin "baserom.gba", 0x11BBC8, 0x0000006
gUnk_0811BBCE:: @ 0811BBCE
.incbin "baserom.gba", 0x11BBCE, 0x0000006
gUnk_0811BBD4:: @ 0811BBD4
.incbin "baserom.gba", 0x11BBD4, 0x0000010
gUnk_0811BBE4:: @ 0811BBE4
.incbin "baserom.gba", 0x11BBE4, 0x0000008
gUnk_0811BBEC:: @ 0811BBEC
.incbin "baserom.gba", 0x11BBEC, 0x000000C
gUnk_0811BBF8:: @ 0811BBF8
.incbin "baserom.gba", 0x11BBF8, 0x0000010
gUnk_0811BC08:: @ 0811BC08
.incbin "baserom.gba", 0x11BC08, 0x0000020
gUnk_0811BC28:: @ 0811BC28
.incbin "baserom.gba", 0x11BC28, 0x0000008
gUnk_0811BC30:: @ 0811BC30
.incbin "baserom.gba", 0x11BC30, 0x0000008
gUnk_0811BC38:: @ 0811BC38
.incbin "baserom.gba", 0x11BC38, 0x0000008
gUnk_0811BC40:: @ 0811BC40
.incbin "baserom.gba", 0x11BC40, 0x0000008
gUnk_0811BC48:: @ 0811BC48
.incbin "baserom.gba", 0x11BC48, 0x0000018
gUnk_0811BC60:: @ 0811BC60
.incbin "baserom.gba", 0x11BC60, 0x0000020
gUnk_0811BC80:: @ 0811BC80
.incbin "baserom.gba", 0x11BC80, 0x0000008
gUnk_0811BC88:: @ 0811BC88
.incbin "baserom.gba", 0x11BC88, 0x0000010
gUnk_0811BC98:: @ 0811BC98
.incbin "baserom.gba", 0x11BC98, 0x000001C
gUnk_0811BCB4:: @ 0811BCB4
.incbin "baserom.gba", 0x11BCB4, 0x0000010
+7 -6
View File
@@ -11,14 +11,15 @@ typedef struct {
u16 localFlagOffset;
u8 filler[10];
u16 field_0x10;
u16 field_0x12;
u16 field_0x14;
u8 field_0x16;
u8 field_0x17;
u16 curPortalX;
u16 curPortalY;
u8 curPortalExitDirection;
u8 curPortalType;
u8 field_0x18;
// u8 filler3[7];
u8 fadeOut;
u8 filler2[14];
bool8 playShrinkSeq;
u8 unk1A;
u8 filler2[13];
u8 filler4[0x835];
u32 musicIndex;
u32 pMusicIndex;
+2 -2
View File
@@ -47,7 +47,7 @@ typedef struct Entity {
/*0x0a*/ u8 type; // was: form
/*0x0b*/ u8 type2; // was: parameter
/*0x0c*/ u8 action;
/*0x0d*/ u8 previousActionFlag;
/*0x0d*/ u8 subAction;
/*0x0e*/ u8 actionDelay;
/*0x0f*/ u8 field_0xf;
/*0x10*/ u8 flags;
@@ -108,7 +108,7 @@ typedef struct Entity {
/*0x3a*/ u8 field_0x3a;
/*0x3b*/ u8 flags2;
/*0x3c*/ u8 field_0x3c;
/*0x3d*/ s8 hurtBlinkTime;
/*0x3d*/ s8 iframes;
/*0x3e*/ u8 field_0x3e;
/*0x3f*/ u8 damageType;
/*0x40*/ u8 field_0x40;
+1 -1
View File
@@ -83,7 +83,7 @@ extern u32 sub_08049FDC(Entity*, u32);
extern u32 sub_080041A0(Entity*, Entity*, u32, u32);
extern u32 sub_08049EE4(Entity*);
extern Entity* sub_0804A98C(Entity*, u8, u8);
extern u32 sub_080544DC(u32);
extern u32 GetBottleContaining(u32);
extern void sub_08077E54(Entity*);
extern void sub_080042BA(Entity*, u32);
extern void sub_08077F24(ItemBehavior*, u32);
+7 -7
View File
@@ -51,21 +51,21 @@
#define static_assert(cond) extern char assertion[(cond) ? 1 : -1]
#if NON_MATCHING
#define asmfunc(prologue, path)
#define ASM_FUNC(path, decl)
#else
#define asmfunc(prologue, path) \
NAKED prologue { \
#define ASM_FUNC(path, decl) \
NAKED decl { \
asm(".include " #path); \
}
#endif
#if NON_MATCHING
#define NONMATCH(prologue, path) prologue
#define NONMATCH(path, decl) decl
#define END_NONMATCH
#else
#define NONMATCH(path, prologue) \
NAKED prologue { \
asm(".include " #path); \
#define NONMATCH(path, decl) \
NAKED decl { \
asm(".include " #path); \
if (0)
#define END_NONMATCH }
#endif
+39 -2
View File
@@ -6,6 +6,41 @@
#include "global.h"
#include "entity.h"
enum {
PLAYER_INIT,
PLAYER_NORMAL,
PLAYER_DUMMY,
PLAYER_FALL,
PLAYER_JUMP,
PLAYER_PUSH,
PLAYER_BOUNCE,
PLAYER_08070E9C,
PLAYER_ITEMGET,
PLAYER_MINISH,
PLAYER_MINISHDIE,
PLAYER_08071DB8,
PLAYER_EMPTYBOTTLE,
PLAYER_FROZEN,
PLAYER_0807204C,
PLAYER_080720DC,
PLAYER_PULL,
PLAYER_LAVA,
PLAYER_WARP,
PLAYER_08072454,
PLAYER_DROWN,
PLAYER_USEPORTAL,
PLAYER_TALKEZLO,
PLAYER_ROOMTRANSITION,
PLAYER_ROLL,
PLAYER_080728AC,
PLAYER_INHOLE,
PLAYER_08072C9C,
PLAYER_08074C44,
PLAYER_08072F34,
PLAYER_USEENTRANCE,
PLAYER_PARACHUTE,
};
typedef struct {
/*0x00*/ u8 field_0x0[2];
/*0x02*/ u8 jumpStatus;
@@ -17,12 +52,14 @@ typedef struct {
/*0x0a*/ u8 field_0xa;
/*0x0b*/ u8 keepFacing;
/*0x0c*/ u8 playerAction;
/*0x0d*/ u8 field_0xd[2];
/*0x0d*/ u8 field_0xd;
/*0x0e*/ u8 field_0xe;
/*0x0f*/ u8 hurtBlinkSpeed;
/*0x10*/ u8 field_0x10[4];
/*0x11*/ u8 field_0x14;
/*0x11*/ u8 field_0x15;
/*0x14*/ u16 field_0x16[2];
/*0x14*/ u16 startPosX;
/*0x16*/ u16 startPosY;
/*0x1a*/ u8 field_0x1a[2];
/*0x1c*/ u8 field_0x1c;
/*0x1d*/ u8 field_0x1d[5];
+16
View File
@@ -166,6 +166,22 @@ extern BG3Buffer gBG3Buffer;
static_assert(sizeof(BG3Buffer) == 0x1000);
*/
struct {
u8 filler[0x70];
} extern gUnk_03000B80;
static_assert(sizeof(gUnk_03000B80) == 0x70);
typedef struct {
u8 unk0;
u8 unk1;
u8 unk2;
u8 unk3;
u8 freezeTime;
u8 unk9;
} EntityHandler;
extern EntityHandler gUnk_03003DC0;
extern u8 gUnk_02022740[];
extern u8 gUnk_02034490[];
+2
View File
@@ -1019,6 +1019,8 @@ SECTIONS {
data/data_08108D30.o(.rodata);
src/npc/ezloCap.o(.rodata);
data/data_08114208.o(.rodata);
src/player.o(.rodata);
data/data_0811B9E0.o(.rodata);
src/item.o(.rodata);
data/data_0811BD44.o(.rodata);
data/room_headers.o(.rodata);
+11 -22
View File
@@ -31,7 +31,7 @@ extern void LoadResources();
extern void FadeMain();
extern u32 sub_0805E3B0();
extern void HandlePlayerLife();
extern void sub_08070680();
extern void DoPlayerAction();
extern void sub_080171F0();
extern void sub_08078FB0();
extern void DrawEntity();
@@ -69,17 +69,6 @@ typedef struct {
} NPCStruct;
extern NPCStruct gUnk_02031EC0[100];
typedef struct {
u8 unk0;
u8 unk1;
u8 unk2;
u8 unk3;
u8 freezeTime;
u8 unk9;
} EntityHandler;
extern EntityHandler gUnk_03003DC0;
typedef struct {
void* last;
void* first;
@@ -157,7 +146,7 @@ void PlayerUpdate(Entity* this) {
}
}
HandlePlayerLife(this);
sub_08070680(this);
DoPlayerAction(this);
if ((this->height.WORD == 0) && (this->action == 1 || this->action == 9))
sub_08008790(this, 8);
sub_080171F0();
@@ -175,7 +164,7 @@ void HandlePlayerLife(Entity* this) {
gUnk_0200AF00.filler25[8] = 0;
gUnk_0200AF00.filler25[9] = 0;
if ((gPlayerEntity.bitfield & 0x80) && (gPlayerEntity.hurtBlinkTime > 0))
if ((gPlayerEntity.bitfield & 0x80) && (gPlayerEntity.iframes > 0))
SoundReq(SFX_86);
gPlayerState.flags.all &= ~(0x2000000 | 0x200);
@@ -279,7 +268,7 @@ void sub_080171F0(void) {
sub_0807A8D8(&gPlayerEntity);
if (gPlayerState.jumpStatus & 0xc0)
gPlayerEntity.hurtBlinkTime = 0xfe;
gPlayerEntity.iframes = 0xfe;
if (gPlayerEntity.action != 0x17) {
sub_08077FEC(gPlayerEntity.action);
@@ -287,17 +276,17 @@ void sub_080171F0(void) {
}
void ItemUpdate(Entity* this) {
if ((this->flags & 1) == 0 && this->action == 0 && this->previousActionFlag == 0)
if ((this->flags & 1) == 0 && this->action == 0 && this->subAction == 0)
ItemInit(this);
if (!sub_0805E3B0(this)) {
gPlayerItemFunctions[this->id](this);
this->bitfield &= ~0x80;
if (this->hurtBlinkTime != 0) {
if (this->hurtBlinkTime > 0)
this->hurtBlinkTime--;
if (this->iframes != 0) {
if (this->iframes > 0)
this->iframes--;
else
this->hurtBlinkTime++;
this->iframes++;
}
}
DrawEntity(this);
@@ -341,8 +330,8 @@ void ObjectUpdate(Entity* this) {
if (((this->flags & 1) == 0) && (this->action == 0))
sub_080A2838(this);
if (this->hurtBlinkTime != 0)
this->hurtBlinkTime++;
if (this->iframes != 0)
this->iframes++;
if (!sub_0805E3B0(this)) {
gObjectFunctions[this->id](this);
this->bitfield &= ~0x80;
+4 -4
View File
@@ -17,7 +17,7 @@ extern void (*const gUnk_080D412C[])();
extern struct_02018EB0 gUnk_02018EB0;
u32 sub_0804AA84(void) {
if (gArea.fadeOut != 0) {
if (gArea.playShrinkSeq) {
gMain.transition = 4;
gArea.filler[8] = 0;
gArea.filler[9] = 0;
@@ -25,8 +25,8 @@ u32 sub_0804AA84(void) {
sub_0805E5A8();
return 1;
} else {
gArea.filler[18] = gArea.fadeOut;
*(vu8*)&gArea.fadeOut = gArea.fadeOut;
gArea.filler[18] = gArea.playShrinkSeq;
*(vu8*)&gArea.playShrinkSeq = gArea.playShrinkSeq;
return 0;
}
}
@@ -39,7 +39,7 @@ void sub_0804AAD4(void) {
MemClear(&gUnk_02018EB0, 0x28);
gUnk_02018EB0.unk = 0;
EraseAllEntities();
CreateObject(0x3d, gArea.field_0x17, 0);
CreateObject(0x3d, gArea.curPortalType, 0);
gArea.filler[8]++;
}
+1 -1
View File
@@ -132,7 +132,7 @@ u32 sub_080544C8(u32 arg0) {
}
}
u32 sub_080544DC(u32 arg0) {
u32 GetBottleContaining(u32 arg0) {
if (arg0 == gSave.stats.bottles[0]) {
return 1;
} else if (arg0 == gSave.stats.bottles[1]) {
+1 -1
View File
@@ -36,7 +36,7 @@ void sub_08077E3C(Entity* ent, u32 idx) {
void sub_08077E54(Entity* ent) {
ent->action = gPlayerEntity.animIndex;
*(u8*)&ent->spriteIndex = gPlayerEntity.frameIndex;
ent->previousActionFlag = gPlayerEntity.frameDuration;
ent->subAction = gPlayerEntity.frameDuration;
ent->actionDelay = gPlayerEntity.frames.all;
}
+3 -3
View File
@@ -59,8 +59,8 @@ void sub_080318DC(Entity* this) {
do {
brother->action = 5;
brother->spritePriority.b1 = 1;
if (brother->hurtBlinkTime == 0)
brother->hurtBlinkTime = -12;
if (brother->iframes == 0)
brother->iframes = -12;
} while (brother = brother->attachedEntity, brother != NULL);
}
if (this->parent) {
@@ -110,7 +110,7 @@ void sub_080318DC(Entity* this) {
}
void sub_08031A60(Entity* this) {
if (this->hurtBlinkTime > 0)
if (this->iframes > 0)
sub_08003FC4(this, 0x1800);
sub_08001324(this);
+6 -6
View File
@@ -68,7 +68,7 @@ void sub_08021818(Entity* this) {
void sub_08021848(Entity* this) {
if (sub_0806F520(this)) {
gUnk_080CB5C8[this->previousActionFlag](this);
gUnk_080CB5C8[this->subAction](this);
} else {
this->action = 3;
this->height.HALF.HI = 0;
@@ -77,7 +77,7 @@ void sub_08021848(Entity* this) {
}
void sub_0802187C(Entity* this) {
this->previousActionFlag = 2;
this->subAction = 2;
}
void nullsub_130(Entity* this) {
@@ -100,8 +100,8 @@ void sub_080218B4(Entity* this) {
}
void sub_080218CC(Entity* this) {
if (this->previousActionFlag == 0) {
this->previousActionFlag = 1;
if (this->subAction == 0) {
this->subAction = 1;
this->spriteSettings.b.draw = 1;
this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f;
this->speed = 0x100;
@@ -126,8 +126,8 @@ void sub_080218CC(Entity* this) {
}
void sub_08021984(Entity* this) {
if (this->previousActionFlag == 0) {
this->previousActionFlag = 1;
if (this->subAction == 0) {
this->subAction = 1;
this->flags |= 0x80;
this->spriteSettings.b.draw = 3;
this->height.HALF.HI = -0x80;
+7 -7
View File
@@ -64,8 +64,8 @@ void sub_0802C688(Entity* this) {
}
void sub_0802C7AC(Entity* this) {
if (this->previousActionFlag < 3 && !sub_0806F520(this)) {
this->previousActionFlag = 0;
if (this->subAction < 3 && !sub_0806F520(this)) {
this->subAction = 0;
this->field_0xf = 1;
this->height.HALF.HI = 0;
if (this->field_0x82.HALF.LO != 2) {
@@ -76,7 +76,7 @@ void sub_0802C7AC(Entity* this) {
this->field_0x80.HALF.HI = 0;
} else {
this->height.HALF.HI = -1;
gUnk_080CD600[this->previousActionFlag](this);
gUnk_080CD600[this->subAction](this);
if (this->actionDelay != 0) {
GetNextFrame(this);
}
@@ -84,7 +84,7 @@ void sub_0802C7AC(Entity* this) {
}
void sub_0802C820(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 60;
}
@@ -181,11 +181,11 @@ void sub_0802C91C(Entity* this) {
}
void sub_0802C9B8(Entity* this) {
gUnk_080CD618[this->previousActionFlag](this);
gUnk_080CD618[this->subAction](this);
}
void sub_0802C9D0(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->flags &= ~0x80;
this->spritePriority.b1 = 0;
this->field_0x82.HALF.HI = 1;
@@ -256,7 +256,7 @@ void nullsub_150(Entity* this) {
void sub_0802CB68(Entity* this) {
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->direction = Random() & 0x18;
this->direction |= 4;
this->flags |= 0x80;
+9 -9
View File
@@ -68,11 +68,11 @@ void sub_0802A8AC(Entity* this) {
}
void sub_0802A8C8(Entity* this) {
gUnk_080CD140[this->previousActionFlag](this);
gUnk_080CD140[this->subAction](this);
}
void sub_0802A8E0(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 60;
}
@@ -100,7 +100,7 @@ void sub_0802A91C(Entity* this) {
void sub_0802A924(Entity* this) {
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0;
this->field_0xf = 0;
this->hitbox = (Hitbox*)&gUnk_080CD16C;
@@ -126,7 +126,7 @@ void sub_0802A9A8(Entity* this) {
if (this->actionDelay) {
if (--this->actionDelay == 0) {
this->action = 2;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0x40;
sub_0802ACDC(this, 8);
}
@@ -252,7 +252,7 @@ void sub_0802AB40(Entity* this) {
void sub_0802AC08(Entity* this) {
if (this->frames.all & 0x80) {
this->action = 2;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0x40;
this->speed = 0xc0;
sub_0802ACDC(this, 8);
@@ -384,7 +384,7 @@ void sub_0802AE68(Entity* this) {
}
void sub_0802AEBC(Entity* this) {
gUnk_080CD158[this->previousActionFlag](this);
gUnk_080CD158[this->subAction](this);
}
void sub_0802AED4(Entity* this) {
@@ -405,7 +405,7 @@ void sub_0802AED4(Entity* this) {
}
void sub_0802AF28(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
sub_08079BD8(this);
this->spritePriority.b1 = 2;
GetNextFrame(this);
@@ -422,7 +422,7 @@ void sub_0802AF58(Entity* this) {
void sub_0802AF74(Entity* this) {
this->action = 3;
this->previousActionFlag = 0;
this->subAction = 0;
if (this->actionDelay > 60) {
this->actionDelay = 60;
}
@@ -508,7 +508,7 @@ void sub_0802B048(Entity* this) {
} else {
if (this->field_0xf) {
if (--this->field_0xf == 0) {
if (action == 2 && this->previousActionFlag == 1) {
if (action == 2 && this->subAction == 1) {
gPlayerState.heldObject = 0;
}
sub_0805EC60(this);
+14 -14
View File
@@ -56,7 +56,7 @@ void sub_08028934(Entity* this) {
if (this->damageType == 1 && (this->bitfield & 0x7f) == 0x42) {
this->action = 3;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0x28;
this->flags &= ~0x80;
sub_080290E0(this, 4);
@@ -99,7 +99,7 @@ void sub_08028A48(Entity* this) {
this->actionDelay--;
} else if (sub_08028F98(this, 0)) {
sub_08029078(this);
this->previousActionFlag = 0;
this->subAction = 0;
this->field_0xf = 1;
}
}
@@ -108,11 +108,11 @@ void sub_08028A74(Entity* this) {
u32 unk;
GetNextFrame(this);
switch (this->previousActionFlag) {
switch (this->subAction) {
case 0:
unk = 1;
if (this->frames.all & 0x80) {
this->previousActionFlag = 1;
this->subAction = 1;
this->actionDelay = 0x3c;
this->field_0xf = 0x10;
sub_08028FDC(this);
@@ -122,7 +122,7 @@ void sub_08028A74(Entity* this) {
case 1:
unk = 1;
if (--this->actionDelay == 0) {
this->previousActionFlag = 2;
this->subAction = 2;
this->actionDelay = 0x20;
this->field_0xf = 0;
sub_08028FDC(this);
@@ -143,14 +143,14 @@ void sub_08028A74(Entity* this) {
ent->parent = this;
ent->direction = this->direction;
this->frames.all &= ~1;
this->previousActionFlag = 3;
this->subAction = 3;
}
}
break;
case 3:
unk = 2;
if (this->frames.all & 0x80) {
this->previousActionFlag = 4;
this->subAction = 4;
this->actionDelay = 0x50;
sub_080290E0(this, 1);
}
@@ -159,13 +159,13 @@ void sub_08028A74(Entity* this) {
unk = 2;
if (--this->actionDelay == 0) {
if (sub_08028F98(this, 0)) {
this->previousActionFlag = 1;
this->subAction = 1;
this->actionDelay = 0x3c;
this->field_0xf = 0x10;
sub_08028FDC(this);
} else {
sub_08028FFC(this);
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0x50;
this->field_0xf = 0;
}
@@ -176,7 +176,7 @@ void sub_08028A74(Entity* this) {
if (!sub_08028F98(this, unk)) {
sub_08028FFC(this);
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0x50;
this->field_0xf = 0;
}
@@ -185,11 +185,11 @@ void sub_08028A74(Entity* this) {
void sub_08028BC4(Entity* this) {
Entity* iVar1;
switch (this->previousActionFlag) {
switch (this->subAction) {
case 0:
if (this->actionDelay == 0) {
if (this->frames.all & 0x80) {
this->previousActionFlag = 1;
this->subAction = 1;
sub_08028FDC(this);
sub_080290E0(this, 5);
this->spritePriority.b1 = 1;
@@ -201,7 +201,7 @@ void sub_08028BC4(Entity* this) {
case 1:
if (this->frames.all & 0x80) {
this->action = 4;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0x1e;
this->field_0xf = 5;
sub_080290E0(this, 0);
@@ -316,7 +316,7 @@ void sub_08028E40(Entity* this) {
struct SalesOffering* offer = (struct SalesOffering*)this->field_0x7c.WORD;
this->action = 4;
this->previousActionFlag = gTextBox.doTextBox & 0x7f;
this->subAction = gTextBox.doTextBox & 0x7f;
this->actionDelay = 1;
if (CheckLocalFlag(offer->field_0xa) == 0) {
SetLocalFlag(offer->field_0xa);
+1 -1
View File
@@ -243,7 +243,7 @@ void sub_08020FAC(Entity* this) {
if (this->field_0x7a.HALF.LO) {
this->field_0x7a.HALF.LO--;
} else {
this->hurtBlinkTime = -8;
this->iframes = -8;
sub_08021390(this);
}
} else {
+2 -2
View File
@@ -4,7 +4,7 @@
extern s16 sub_080001DA(u32, u32); // ?
extern void sub_08049CF4();
extern u32 sub_0806FBFC(u32, u32, u32, u32);
extern u32 CheckPlayerProximity(u32, u32, u32, u32);
void sub_080221C0();
typedef struct {
@@ -54,7 +54,7 @@ void sub_08022034(Entity* this) {
void sub_0802209C(Entity* this) {
if (this->actionDelay == 0) {
if (sub_0806FBFC(this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x10, 0x10)) {
if (CheckPlayerProximity(this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x10, 0x10)) {
this->action = 2;
this->actionDelay = 0x12;
InitializeAnimation(this, this->type2 + 4);
+1 -1
View File
@@ -81,7 +81,7 @@ void sub_08045454(Entity* this) {
tmp = 0;
ent->type2 = 1;
ent->height.HALF.HI = tmp;
ent->hurtBlinkTime = -0x10;
ent->iframes = -0x10;
/* Set MiniFireballGuy offset relative to killed slime. */
sub_08045178(this, ent, off->h, off->v);
+5 -5
View File
@@ -338,12 +338,12 @@ NONMATCH("asm/non_matching/gibdo/sub_08037A58.inc", void sub_08037A58(Entity* th
sub_08037ACC(this);
this->action = 7;
this->spritePriority.b0 = (this->spritePriority.b0 & 0xf8) | 4;
if (this->hurtBlinkTime == 0) {
this->hurtBlinkTime = 0xec;
if (this->iframes == 0) {
this->iframes = 0xec;
}
this->damageType = 0x26;
this->flags2 |= 1;
this->hurtBlinkTime = 0xf4;
this->iframes = 0xf4;
this->field_0x3e = (this->animationState << 3) ^ 0x10;
this->field_0x42 = 8;
this->field_0x46 = 0x180;
@@ -355,7 +355,7 @@ END_NONMATCH
void sub_08037ACC(Entity* this) {
gPlayerState.flags.all &= 0xFFFFFEFF;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.hurtBlinkTime = 0x1e;
gPlayerEntity.iframes = 0x1e;
gPlayerEntity.field_0x3e = DirectionFromAnimationState(this->animationState);
gPlayerEntity.field_0x42 = 4;
gPlayerEntity.field_0x46 = 0x180;
@@ -363,7 +363,7 @@ void sub_08037ACC(Entity* this) {
// Damage player maybe?
void sub_08037B10(Entity* this) {
u32 h;
gPlayerEntity.hurtBlinkTime = 0xc;
gPlayerEntity.iframes = 0xc;
h = ModHealth(-8);
sub_0800449C(&gPlayerEntity, 0x7a);
if (h == 0) {
+100 -100
View File
@@ -28,54 +28,54 @@ const u16 gUnk_080D1C60[8];
void sub_08046898(Entity*); // action 0
void sub_08046910(Entity*); // action 1
void sub_08046930(Entity*); // action 1 previousActionFlag 0
void sub_0804696C(Entity*); // action 1 previousActionFlag 1
void sub_080469CC(Entity*); // action 1 previousActionFlag 2
void sub_080469F4(Entity*); // action 1 previousActionFlag 3
void sub_08046A30(Entity*); // action 1 previousActionFlag 4
void sub_08046A54(Entity*); // action 1 previousActionFlag 5
void sub_08046A78(Entity*); // action 1 previousActionFlag 6
void sub_08046930(Entity*); // action 1 subAction 0
void sub_0804696C(Entity*); // action 1 subAction 1
void sub_080469CC(Entity*); // action 1 subAction 2
void sub_080469F4(Entity*); // action 1 subAction 3
void sub_08046A30(Entity*); // action 1 subAction 4
void sub_08046A54(Entity*); // action 1 subAction 5
void sub_08046A78(Entity*); // action 1 subAction 6
void sub_08046A9C(Entity*); // action 2
void sub_08046AE8(Entity*); // action 2 previousActionFlag 0
void sub_08046B18(Entity*); // action 2 previousActionFlag 1
void sub_08046B8C(Entity*); // action 2 previousActionFlag 2
void sub_08046C04(Entity*); // action 2 previousActionFlag 3
void sub_08046C88(Entity*); // action 2 previousActionFlag 4
void sub_08046AE8(Entity*); // action 2 subAction 0
void sub_08046B18(Entity*); // action 2 subAction 1
void sub_08046B8C(Entity*); // action 2 subAction 2
void sub_08046C04(Entity*); // action 2 subAction 3
void sub_08046C88(Entity*); // action 2 subAction 4
void sub_08046CEC(Entity*); // action 3
void sub_08046D44(Entity*); // action 3 previousActionFlag 0
void sub_08046D98(Entity*); // action 3 previousActionFlag 1
void sub_08046E0C(Entity*); // action 3 previousActionFlag 2
void sub_08046E68(Entity*); // action 3 previousActionFlag 3
void sub_08046EF4(Entity*); // action 3 previousActionFlag 4
void sub_08046D44(Entity*); // action 3 subAction 0
void sub_08046D98(Entity*); // action 3 subAction 1
void sub_08046E0C(Entity*); // action 3 subAction 2
void sub_08046E68(Entity*); // action 3 subAction 3
void sub_08046EF4(Entity*); // action 3 subAction 4
void sub_08046F64(Entity*); // action 4
void sub_08046FE8(Entity*); // action 4 previousActionFlag 0
void sub_0804702C(Entity*); // action 4 previousActionFlag 1
void sub_080470B4(Entity*); // action 4 previousActionFlag 2
void sub_08047140(Entity*); // action 4 previousActionFlag 3
void sub_0804717C(Entity*); // action 4 previousActionFlag 4
void sub_080471C8(Entity*); // action 4 previousActionFlag 5
void sub_0804723C(Entity*); // action 4 previousActionFlag 6
void sub_08047284(Entity*); // action 4 previousActionFlag 7
void sub_080472BC(Entity*); // action 4 previousActionFlag 8
void sub_08047310(Entity*); // action 4 previousActionFlag 9
void sub_08046FE8(Entity*); // action 4 subAction 0
void sub_0804702C(Entity*); // action 4 subAction 1
void sub_080470B4(Entity*); // action 4 subAction 2
void sub_08047140(Entity*); // action 4 subAction 3
void sub_0804717C(Entity*); // action 4 subAction 4
void sub_080471C8(Entity*); // action 4 subAction 5
void sub_0804723C(Entity*); // action 4 subAction 6
void sub_08047284(Entity*); // action 4 subAction 7
void sub_080472BC(Entity*); // action 4 subAction 8
void sub_08047310(Entity*); // action 4 subAction 9
void sub_0804736C(Entity*); // action 5
void sub_080473B8(Entity*); // action 5 previousActionFlag 0
void sub_080473F0(Entity*); // action 5 previousActionFlag 1
void sub_08047484(Entity*); // action 5 previousActionFlag 2
void sub_08047508(Entity*); // action 5 previousActionFlag 3
void sub_080475F4(Entity*); // action 5 previousActionFlag 4
void sub_0804763C(Entity*); // action 5 previousActionFlag 5
void sub_0804772C(Entity*); // action 5 previousActionFlag 6
void sub_080473B8(Entity*); // action 5 subAction 0
void sub_080473F0(Entity*); // action 5 subAction 1
void sub_08047484(Entity*); // action 5 subAction 2
void sub_08047508(Entity*); // action 5 subAction 3
void sub_080475F4(Entity*); // action 5 subAction 4
void sub_0804763C(Entity*); // action 5 subAction 5
void sub_0804772C(Entity*); // action 5 subAction 6
void sub_08047778(Entity*); // action 6
void sub_08047798(Entity*); // action 6 previousActionFlag 0
void sub_080477F0(Entity*); // action 6 previousActionFlag 1
void sub_08047914(Entity*); // action 6 previousActionFlag 2
void sub_08047978(Entity*); // action 6 previousActionFlag 3
void sub_08047B08(Entity*); // action 6 previousActionFlag 4
void sub_08047798(Entity*); // action 6 subAction 0
void sub_080477F0(Entity*); // action 6 subAction 1
void sub_08047914(Entity*); // action 6 subAction 2
void sub_08047978(Entity*); // action 6 subAction 3
void sub_08047B08(Entity*); // action 6 subAction 4
void sub_08047B84(Entity*); // action 7
void sub_08047BA4(Entity*); // action 7 previousActionFlag 0
void sub_08047BF0(Entity*); // action 7 previousActionFlag 1, also called elsewhere
void sub_08047D24(Entity*); // action 7 previousActionFlag 2
void sub_08047BA4(Entity*); // action 7 subAction 0
void sub_08047BF0(Entity*); // action 7 subAction 1, also called elsewhere
void sub_08047D24(Entity*); // action 7 subAction 2
void sub_08047D88(Entity*); //
void sub_08047DF0(Entity*, u32);
void sub_08047E48(Entity*); //
@@ -117,7 +117,7 @@ void sub_08046898(Entity* this) {
tmp->parent = this;
this->attachedEntity = tmp;
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->spriteRendering.b0 = 3;
this->spriteSettings.b.draw = 1;
this->spriteOrientation.flipY = 2;
@@ -135,20 +135,20 @@ void (*const gUnk_080D1B1C[7])(Entity*) = { sub_08046930, sub_0804696C, sub_0804
sub_08046A30, sub_08046A54, sub_08046A78 };
void sub_08046910(Entity* this) {
gUnk_080D1B1C[this->previousActionFlag](this);
gUnk_080D1B1C[this->subAction](this);
UpdateAnimationSingleFrame(this);
}
void sub_08046930(Entity* this) {
if (this->type) {
this->previousActionFlag = 5;
this->subAction = 5;
this->direction = 0x20;
this->speed = 0x280;
}
sub_08047D88(this);
if (this->field_0x7c.BYTES.byte0 == 0)
return;
this->previousActionFlag = 1;
this->subAction = 1;
this->actionDelay = 1;
this->animationState = 0;
this->direction = 0;
@@ -158,7 +158,7 @@ void sub_08046930(Entity* this) {
void sub_0804696C(Entity* this) {
sub_08047E48(this);
if (gRoomControls.roomOriginY + 0x130 > this->y.HALF.HI) {
this->previousActionFlag = 2;
this->subAction = 2;
this->direction = 0x80;
this->speed = 0x100;
this->spriteOrientation.flipY = 3;
@@ -176,7 +176,7 @@ void sub_0804696C(Entity* this) {
void sub_080469CC(Entity* this) {
sub_08047E48(this);
if (gRoomControls.roomOriginY + 0x210 < this->y.HALF.HI) {
this->previousActionFlag = 3;
this->subAction = 3;
this->direction = 0x90;
}
}
@@ -184,7 +184,7 @@ void sub_080469CC(Entity* this) {
void sub_080469F4(Entity* this) {
sub_08047E48(this);
if (gRoomControls.roomOriginY + 0x290 < this->y.HALF.HI) {
this->previousActionFlag = 4;
this->subAction = 4;
this->spriteOrientation.flipY = 2;
this->spriteRendering.b3 = 2;
}
@@ -194,14 +194,14 @@ void sub_08046A30(Entity* this) {
sub_08047D88(this);
if (((Entity*)this->myHeap)->prev->field_0x6c.HWORD & 1) {
this->action = 2;
this->previousActionFlag = 0;
this->subAction = 0;
}
}
void sub_08046A54(Entity* this) {
sub_08047E48(this);
if (gRoomControls.roomOriginX + 0x380 < this->x.HALF.HI) {
this->previousActionFlag = 6;
this->subAction = 6;
}
}
@@ -209,7 +209,7 @@ void sub_08046A78(Entity* this) {
sub_08047D88(this);
if (((Entity*)this->myHeap)->prev->field_0x6c.HWORD & 0x10) {
this->action = 3;
this->previousActionFlag = 0;
this->subAction = 0;
}
}
@@ -221,16 +221,16 @@ void sub_08046A9C(Entity* this) {
InitAnimationForceUpdate(this, 0);
}
}
gUnk_080D1B38[this->previousActionFlag](this);
gUnk_080D1B38[this->subAction](this);
UpdateAnimationSingleFrame(this);
if (this->field_0x7c.BYTES.byte0) {
this->action = 6;
this->previousActionFlag = 0;
this->subAction = 0;
}
}
void sub_08046AE8(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->speed = 0x180;
sub_08048178(this, ((Entity*)this->myHeap)->next->animationState >> 5);
this->field_0x76.HWORD = this->direction << 8;
@@ -247,7 +247,7 @@ void sub_08046B18(Entity* this) {
}
this->direction = this->field_0x76.HWORD >> 8;
} else {
this->previousActionFlag = 2;
this->subAction = 2;
}
sub_08047D88(this);
sub_08047EA4(this, ((0x100 - this->direction) & 0xFF) << 8);
@@ -255,7 +255,7 @@ void sub_08046B18(Entity* this) {
void sub_08046B8C(Entity* this) {
if (sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 4)) {
this->previousActionFlag = 3;
this->subAction = 3;
this->field_0x76.HWORD = this->direction << 8;
this->field_0x80.HWORD = gRoomControls.roomOriginX + 0x200;
this->field_0x82.HWORD = gRoomControls.roomOriginY + 0x210;
@@ -277,7 +277,7 @@ void sub_08046C04(Entity* this) {
}
this->direction = this->field_0x76.HWORD >> 8;
} else {
this->previousActionFlag = 4;
this->subAction = 4;
this->field_0x70.HALF.LO = ((tmp + 0x20) & 0xC0) >> 6;
}
sub_08047D88(this);
@@ -286,7 +286,7 @@ void sub_08046C04(Entity* this) {
void sub_08046C88(Entity* this) {
if (sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 4)) {
this->previousActionFlag = 1;
this->subAction = 1;
sub_08048178(this, sub_08048158(this->field_0x70.HALF_U.LO));
sub_08047D88(this);
} else {
@@ -304,11 +304,11 @@ void sub_08046CEC(Entity* this) {
InitAnimationForceUpdate(this, 1);
}
}
gUnk_080D1B4C[this->previousActionFlag](this);
gUnk_080D1B4C[this->subAction](this);
UpdateAnimationSingleFrame(this);
if (((Entity*)this->myHeap)->prev->field_0x6c.HWORD & 2) {
this->action = 2;
this->previousActionFlag = 0;
this->subAction = 0;
this->animationState = this->speed;
}
}
@@ -317,7 +317,7 @@ const u16 gUnk_080D1B60[8] = { 0x200, 0x184, 0x28C, 0x210, 0x200, 0x29C, 0x174,
void sub_08046D44(Entity* this) {
const u16* tmp;
this->previousActionFlag = 1;
this->subAction = 1;
this->speed = 0x200;
tmp = gUnk_080D1B60 + (((Entity*)this->myHeap)->next->animationState >> 5);
this->field_0x80.HWORD = tmp[0] + gRoomControls.roomOriginX;
@@ -336,7 +336,7 @@ void sub_08046D98(Entity* this) {
}
this->direction = this->field_0x76.HWORD >> 8;
} else {
this->previousActionFlag = 2;
this->subAction = 2;
}
sub_08047D88(this);
sub_08047EA4(this, ((0x100 - this->direction) & 0xFF) << 8);
@@ -344,7 +344,7 @@ void sub_08046D98(Entity* this) {
void sub_08046E0C(Entity* this) {
if (sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 4)) {
this->previousActionFlag = 3;
this->subAction = 3;
this->field_0x76.HWORD = this->direction << 8;
sub_08047D88(this);
} else {
@@ -368,7 +368,7 @@ void sub_08046E68(Entity* this) {
sub_08047D88(this);
sub_08047EA4(this, ((0x100 - this->direction) & 0xFF) << 8);
} else {
this->previousActionFlag = 4;
this->subAction = 4;
this->actionDelay = 0x3F;
this->field_0xf = 1;
this->direction = (gUnk_080D1B70[Random() & 1] + tmp) & 0xC0;
@@ -407,7 +407,7 @@ void sub_08046F64(Entity* this) {
InitAnimationForceUpdate(this, 1);
}
}
gUnk_080D1B94[this->previousActionFlag](this);
gUnk_080D1B94[this->subAction](this);
UpdateAnimationSingleFrame(this);
if (--this->field_0x7c.HALF.HI == 0) {
Entity* tmp;
@@ -421,12 +421,12 @@ void sub_08046F64(Entity* this) {
}
if (((Entity*)this->myHeap)->prev->field_0x6c.HWORD & 4) {
this->action = 5;
this->previousActionFlag = 0;
this->subAction = 0;
}
}
void sub_08046FE8(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->speed = 0x1c0;
this->field_0x7c.HALF.HI = 0x1e;
this->field_0x80.HWORD = gRoomControls.roomOriginX + 0x290;
@@ -445,7 +445,7 @@ void sub_0804702C(Entity* this) {
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
if (sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, (this->speed >> 0x10) + 0x10)) {
this->previousActionFlag = 2;
this->subAction = 2;
this->field_0x76.HWORD = this->direction << 8;
this->speed = 0x280;
}
@@ -465,7 +465,7 @@ void sub_080470B4(Entity* this) {
sub_08047D88(this);
sub_08047EA4(this, ((0x100 - this->direction) & 0xFF) << 8);
} else {
this->previousActionFlag = 3;
this->subAction = 3;
this->speed = 0x200;
this->field_0x76.HWORD = this->direction << 8;
this->field_0x74.HWORD = gUnk_080D1BBC[Random() & 1];
@@ -478,7 +478,7 @@ void sub_08047140(Entity* this) {
this->direction = this->field_0x76.HWORD >> 8;
if (this->direction > 0xbf) {
this->direction = 0xC0;
this->previousActionFlag = 4;
this->subAction = 4;
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
}
@@ -489,7 +489,7 @@ void sub_0804717C(Entity* this) {
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
if (gRoomControls.roomOriginX + 0x200 > this->x.HALF.HI) {
this->previousActionFlag = 5;
this->subAction = 5;
}
}
@@ -505,19 +505,19 @@ void sub_080471C8(Entity* this) {
return;
if (this->field_0x74.HWORD > 0x100) {
if (Random() & 1) {
this->previousActionFlag = 6;
this->subAction = 6;
} else {
this->previousActionFlag = 0;
this->subAction = 0;
}
} else {
this->previousActionFlag = 0;
this->subAction = 0;
}
}
void sub_0804723C(Entity* this) {
this->direction -= 2;
if (this->direction < 0xc0) {
this->previousActionFlag = 7;
this->subAction = 7;
this->speed = 0x200;
this->direction = 0xc0;
this->field_0x76.HWORD = 0xc000;
@@ -531,7 +531,7 @@ void sub_08047284(Entity* this) {
this->direction = this->field_0x76.HWORD >> 8;
if (this->direction < 0x40) {
this->direction = 0x40;
this->previousActionFlag = 8;
this->subAction = 8;
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
}
@@ -543,7 +543,7 @@ void sub_080472BC(Entity* this) {
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
if (gRoomControls.roomOriginX + 0x2B0 >= this->x.HALF.HI)
return;
this->previousActionFlag = 9;
this->subAction = 9;
this->field_0x76.HWORD = this->direction << 8;
}
@@ -555,7 +555,7 @@ void sub_08047310(Entity* this) {
this->direction = this->field_0x76.HWORD >> 8;
if ((u8)(this->direction + 0x7F) < 0x40) {
this->direction = 0xC0;
this->previousActionFlag = 4;
this->subAction = 4;
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
}
@@ -569,16 +569,16 @@ void sub_0804736C(Entity* this) {
InitAnimationForceUpdate(this, 0);
}
}
gUnk_080D1BC0[this->previousActionFlag](this);
gUnk_080D1BC0[this->subAction](this);
UpdateAnimationSingleFrame(this);
if (this->currentHealth == 0) {
this->action = 7;
this->previousActionFlag = 0;
this->subAction = 0;
}
}
void sub_080473B8(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->speed = 0x120;
this->field_0x80.HWORD = gRoomControls.roomOriginX + 0x200;
this->field_0x82.HWORD = gRoomControls.roomOriginY + 0x1D0;
@@ -605,7 +605,7 @@ void sub_080473F0(Entity* this) {
}
sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8);
if (sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 8)) {
this->previousActionFlag = 2;
this->subAction = 2;
this->field_0x76.HWORD = this->direction << 8;
this->speed = 0x180;
}
@@ -623,7 +623,7 @@ void sub_08047484(Entity* this) {
sub_08047D88(this);
sub_08047EA4(this, ((0x100 - this->direction) & 0xFF) << 8);
} else {
this->previousActionFlag = 3;
this->subAction = 3;
this->speed = 0x200;
this->direction = 0x40;
this->field_0x76.HWORD = 0x4000;
@@ -663,7 +663,7 @@ void sub_08047508(Entity* this) {
}
sub_08047E48(this);
if (gRoomControls.roomOriginX + 0x280 < this->x.HALF.HI) {
this->previousActionFlag = 4;
this->subAction = 4;
this->speed = 0x200;
this->animationState = this->direction;
this->field_0x76.HWORD = this->direction << 8;
@@ -681,7 +681,7 @@ void sub_080475F4(Entity* this) {
this->direction = this->field_0x76.HWORD >> 8;
if (this->direction >= 0xc0) {
this->direction = 0xc0;
this->previousActionFlag = 5;
this->subAction = 5;
this->speed = 0x200;
this->field_0x7c.HALF.HI = 0x3c;
}
@@ -718,7 +718,7 @@ void sub_0804763C(Entity* this) {
}
sub_08047E48(this);
if (gRoomControls.roomOriginX + 0x180 > this->x.HALF.HI) {
this->previousActionFlag = 6;
this->subAction = 6;
this->speed = 0x200;
this->animationState = this->direction;
this->field_0x76.HWORD = this->direction << 8;
@@ -736,7 +736,7 @@ void sub_0804772C(Entity* this) {
this->direction = this->field_0x76.HWORD >> 8;
if (this->direction <= 0x40) {
this->direction = 0x40;
this->previousActionFlag = 3;
this->subAction = 3;
this->speed = 0x200;
this->field_0x7c.HALF.HI = 0x1e;
}
@@ -746,12 +746,12 @@ void sub_0804772C(Entity* this) {
void (*const gUnk_080D1BDC[5])(Entity*) = { sub_08047798, sub_080477F0, sub_08047914, sub_08047978, sub_08047B08 };
void sub_08047778(Entity* this) {
gUnk_080D1BDC[this->previousActionFlag](this);
gUnk_080D1BDC[this->subAction](this);
UpdateAnimationSingleFrame(this);
}
void sub_08047798(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->speed = 0x80;
if (this->x.HALF.HI - gRoomControls.roomOriginX < 0x1F8) {
this->field_0x80.HWORD = 0xa8;
@@ -773,7 +773,7 @@ void sub_080477F0(Entity* this) {
sub_08047E48(this);
if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
this->action = 2;
this->previousActionFlag = 0;
this->subAction = 0;
this->spriteOrientation.flipY = 2;
this->spriteRendering.b3 = 2;
this->direction = this->animationState;
@@ -784,7 +784,7 @@ void sub_080477F0(Entity* this) {
this->spriteRendering.b3 = 3;
}
if (sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 4)) {
this->previousActionFlag = 2;
this->subAction = 2;
this->field_0x76.HWORD = this->animationState << 8;
this->field_0x74.HWORD = gUnk_080D1BF0[Random() & 1];
if (((Entity*)this->myHeap)->prev->field_0x6c.HWORD & 1) {
@@ -803,7 +803,7 @@ void sub_08047914(Entity* this) {
this->animationState = this->field_0x76.HWORD >> 8;
sub_08047EA4(this, ((0x100 - this->animationState) & 0xFF) << 8);
} else {
this->previousActionFlag = 3;
this->subAction = 3;
this->field_0x70.HALF.LO = 0x3C;
this->field_0x7c.HALF.HI = ((this->type * 0xF) << 2) + 0x78;
sub_080A1D70(((Entity*)this->myHeap)->prev, this->animationState);
@@ -838,7 +838,7 @@ void sub_08047978(Entity* this) {
}
if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
this->action = 2;
this->previousActionFlag = 0;
this->subAction = 0;
this->spriteOrientation.flipY = 2;
this->spriteRendering.b3 = 2;
this->direction = this->animationState;
@@ -847,7 +847,7 @@ void sub_08047978(Entity* this) {
return;
if (this->attachedEntity->action != 1)
return;
this->previousActionFlag = 4;
this->subAction = 4;
if (this->type == 0) {
if ((((Entity*)this->myHeap)->next->animationState >> 6) == 1) {
this->field_0x80.HWORD = gRoomControls.roomOriginX + 0x1C0;
@@ -881,11 +881,11 @@ void sub_08047B08(Entity* this) {
return;
if (this->type == 0) {
this->action = 7;
this->previousActionFlag = 0;
this->subAction = 0;
this->direction ^= 0x80;
} else {
this->action = 4;
this->previousActionFlag = 0;
this->subAction = 0;
this->spriteOrientation.flipY = 2;
this->spriteRendering.b3 = 2;
this->direction = this->animationState;
@@ -895,12 +895,12 @@ void sub_08047B08(Entity* this) {
void (*const gUnk_080D1BF4[3])(Entity*) = { sub_08047BA4, sub_08047BF0, sub_08047D24 };
void sub_08047B84(Entity* this) {
gUnk_080D1BF4[this->previousActionFlag](this);
gUnk_080D1BF4[this->subAction](this);
UpdateAnimationSingleFrame(this);
}
void sub_08047BA4(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->actionDelay = 0x78;
this->field_0xf = 0;
if (gRoomControls.roomOriginX + 0x200 < this->x.HALF.HI) {
@@ -936,7 +936,7 @@ void sub_08047BF0(Entity* this) {
this->speed = 0x140;
sub_08047E48(this);
if (this->y.HALF.HI > gRoomControls.roomOriginY + 0x270) {
this->previousActionFlag = 2;
this->subAction = 2;
this->field_0x7c.HALF.HI = 0xAA;
SoundReq(0x12D);
InitAnimationForceUpdate(this, 1);
+7 -7
View File
@@ -63,16 +63,16 @@ void sub_0802BBC4(Entity* this) {
void sub_0802BC20(Entity* this) {
if (this->damageType != 0x19) {
if (sub_0806F520(this)) {
gUnk_080CD42C[this->previousActionFlag](this);
gUnk_080CD42C[this->subAction](this);
}
} else if (2 < this->previousActionFlag || sub_0806F520(this)) {
gUnk_080CD438[this->previousActionFlag](this);
} else if (2 < this->subAction || sub_0806F520(this)) {
gUnk_080CD438[this->subAction](this);
}
}
void sub_0802BC74(Entity* this) {
sub_0802C1C0(this);
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 60;
this->animationState = (gPlayerEntity.animationState >> 1) ^ 2;
InitializeAnimation(this, this->animationState);
@@ -102,7 +102,7 @@ void sub_0802BCA8(Entity* this) {
}
void sub_0802BCFC(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 60;
}
@@ -260,7 +260,7 @@ void sub_0802BF78(Entity* this) {
void sub_0802BF98(Entity* this) {
if (sub_0806F520(this)) {
gUnk_080CD450[this->previousActionFlag](this);
gUnk_080CD450[this->subAction](this);
} else {
this->action = 2;
this->actionDelay = 30;
@@ -269,7 +269,7 @@ void sub_0802BF98(Entity* this) {
}
void sub_0802BFD0(Entity* this) {
this->previousActionFlag = 2;
this->subAction = 2;
}
void sub_0802BFD8(Entity* this) {
+2 -2
View File
@@ -37,12 +37,12 @@ void sub_08021d98(Entity* this) {
void sub_08021DA8(Entity* this) {
if (sub_0806F520(this)) {
gUnk_080CB6C4[this->previousActionFlag](this);
gUnk_080CB6C4[this->subAction](this);
}
}
void sub_08021DCC(Entity* this) {
this->previousActionFlag = 2;
this->subAction = 2;
}
void sub_08021DD4(Entity* this) {
+2 -2
View File
@@ -93,12 +93,12 @@ void sub_0803C784(Entity* this) {
void sub_0803C820(Entity* this) {
if (sub_0806F520(this)) {
gUnk_080D0148[this->previousActionFlag](this);
gUnk_080D0148[this->subAction](this);
}
}
void sub_0803C844(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 0x3c;
}
+3 -3
View File
@@ -30,16 +30,16 @@ void sub_0803CCEC(Entity* this) {
void sub_0803CCFC(Entity* this) {
if (sub_0806F520(this) == 0) {
if (this->previousActionFlag == 2) {
if (this->subAction == 2) {
sub_0803CE3C(this);
}
} else {
gUnk_080D043C[this->previousActionFlag](this);
gUnk_080D043C[this->subAction](this);
}
}
void sub_0803CD2C(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 0x3c;
}
+3 -3
View File
@@ -211,7 +211,7 @@ void sub_0802810C(Entity* this) {
gPlayerState.flags.all &= 0xffffffef;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.field_0x20 = 0x18000;
gPlayerEntity.hurtBlinkTime = -60;
gPlayerEntity.iframes = -60;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
gPlayerEntity.spritePriority.b1 = this->field_0x82.HALF.HI;
gPlayerEntity.height.HALF.HI = gPlayerEntity.spriteOffsetY;
@@ -220,8 +220,8 @@ void sub_0802810C(Entity* this) {
this->actionDelay = 0x50;
this->field_0xf = 0;
this->flags2 |= 2;
if (this->hurtBlinkTime == 0) {
this->hurtBlinkTime = -18;
if (this->iframes == 0) {
this->iframes = -18;
}
}
#else
+2 -2
View File
@@ -461,12 +461,12 @@ void sub_0802A098(Entity* this) {
void sub_0802A0F8(Entity* this) {
if (this->currentHealth != 0) {
if ((this->bitfield & 0x80) && this->hurtBlinkTime != 0) {
if ((this->bitfield & 0x80) && this->iframes != 0) {
Entity* ent = this;
u32 i;
for (i = 0; i < 6; i++) {
ent = ent->attachedEntity;
ent->hurtBlinkTime = this->hurtBlinkTime;
ent->iframes = this->iframes;
}
}
} else {
+3 -3
View File
@@ -41,9 +41,9 @@ void sub_08022BEC(Entity* this) {
this->animationState = ((this->direction + 2) & 0x1c) >> 2;
this->frameIndex = this->animationState;
this->attachedEntity->hurtBlinkTime = this->hurtBlinkTime;
(*(Entity**)&this->field_0x7c)->hurtBlinkTime = this->hurtBlinkTime;
(*(Entity**)&this->field_0x80)->hurtBlinkTime = this->hurtBlinkTime;
this->attachedEntity->iframes = this->iframes;
(*(Entity**)&this->field_0x7c)->iframes = this->iframes;
(*(Entity**)&this->field_0x80)->iframes = this->iframes;
sub_0804AA30(this, gUnk_080CBBA0);
}
+8 -8
View File
@@ -68,12 +68,12 @@ void sub_080230CC(Entity* this) {
}
void sub_080230E4(Entity* this) {
if (this->previousActionFlag == 0xff) {
if (this->subAction == 0xff) {
this->action = 7;
this->actionDelay = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->damageType = 0x85;
this->hurtBlinkTime = -8;
this->iframes = -8;
this->field_0x7c.BYTES.byte3 = 0;
this->field_0x7a.HALF.HI = 0;
if (this->bitfield == 0x80 || this->bitfield == 0x9e) {
@@ -91,7 +91,7 @@ void sub_080230E4(Entity* this) {
gPlayerEntity.spriteSettings.b.draw = 1;
gPlayerEntity.field_0x20 = 0x18000;
gPlayerEntity.direction = 0xff;
gPlayerEntity.hurtBlinkTime = -0x14;
gPlayerEntity.iframes = -0x14;
gPlayerState.jumpStatus = 0x41;
gPlayerState.flags.all &= 0xfff7ffff;
}
@@ -411,7 +411,7 @@ void sub_08023894(Entity* this) {
gPlayerEntity.y.HALF.HI = this->y.HALF.HI;
gPlayerEntity.direction = DirectionRoundUp(GetFacingDirection(*(Entity**)&this->field_0x74, this));
gPlayerEntity.animationState = gPlayerEntity.direction >> 2;
gPlayerEntity.hurtBlinkTime = 12;
gPlayerEntity.iframes = 12;
ModHealth(-0x10);
sub_0800449C(&gPlayerEntity, 0x7a);
}
@@ -422,7 +422,7 @@ void sub_0802390C(Entity* this) {
if (this->bitfield & 0x80) {
Entity* ent = this->attachedEntity;
do {
ent->hurtBlinkTime = this->hurtBlinkTime;
ent->iframes = this->iframes;
} while (ent = ent->attachedEntity, ent != NULL);
} else {
Entity* ent = this->attachedEntity;
@@ -432,7 +432,7 @@ void sub_0802390C(Entity* this) {
if (bVar2 != 0) {
u32 tmp;
ent->currentHealth = 0xff;
tmp = (u8)ent->hurtBlinkTime;
tmp = (u8)ent->iframes;
if (this->currentHealth >= bVar2) {
this->currentHealth -= bVar2;
} else {
@@ -441,7 +441,7 @@ void sub_0802390C(Entity* this) {
ent = this;
do {
ent->hurtBlinkTime = tmp;
ent->iframes = tmp;
} while (ent = ent->attachedEntity, ent != NULL);
break;
}
+3 -3
View File
@@ -49,16 +49,16 @@ void sub_0801EB0C(Entity* this) {
}
void sub_0801EB2C(Entity* this) {
if (this->previousActionFlag < 3 && !sub_0806F520(this)) {
if (this->subAction < 3 && !sub_0806F520(this)) {
Octorok_Pause(this);
InitializeAnimation(this, this->animationState);
} else {
gUnk_080CA158[this->previousActionFlag](this);
gUnk_080CA158[this->subAction](this);
}
}
void sub_0801EB68(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 60;
}
+6 -6
View File
@@ -60,14 +60,14 @@ void sub_0801FFDC(Entity* this) {
this->animationState = PeahatAnimation_SlicedPropeller;
this->action = 5;
this->speed = 0x80;
this->hurtBlinkTime = -30;
this->iframes = -30;
this->field_0x80.HALF.HI = 0;
InitializeAnimation(this, this->animationState);
} else if (this->bitfield == 0x9b) {
this->animationState = PeahatAnimation_BrokenPropeller;
this->action = 5;
this->speed = 0x80;
this->hurtBlinkTime = -30;
this->iframes = -30;
this->field_0x80.HALF.HI = 0;
InitializeAnimation(this, this->animationState);
} else if (this->bitfield == 0x80) {
@@ -89,14 +89,14 @@ void sub_0801FFDC(Entity* this) {
}
void sub_08020088(Entity* this) {
if (2 >= this->previousActionFlag && !sub_0806F520(this))
if (2 >= this->subAction && !sub_0806F520(this))
return;
gUnk_080CA5BC[this->previousActionFlag](this);
gUnk_080CA5BC[this->subAction](this);
}
void sub_080200B4(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 60;
if (this->animationState == PeahatAnimation_Flying) {
this->animationState = PeahatAnimation_BrokenPropeller;
@@ -152,7 +152,7 @@ void Peahat_Fly(Entity* this) {
if (sub_08049FDC(this, 1)) {
if (this->field_0x82.HALF.HI == 0 && (this->field_0xf & 0xf) == 0 && sub_08049F1C(this, gUnk_020000B0, 0x30)) {
this->action = 2;
this->previousActionFlag = Random() & 3;
this->subAction = Random() & 3;
this->actionDelay = 60;
this->speed = 160;
}
+7 -7
View File
@@ -79,20 +79,20 @@ void sub_08023FE0(Entity* this) {
}
void sub_08023FF0(Entity* this) {
if (this->previousActionFlag < 3 && !sub_0806F520(this)) {
if (this->subAction < 3 && !sub_0806F520(this)) {
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->flags |= 0x80;
this->damageType = 0x77;
this->actionDelay = 1;
this->speed = 0x40;
} else {
gUnk_080CBEF8[this->previousActionFlag](this);
gUnk_080CBEF8[this->subAction](this);
}
}
void sub_08024038(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 60;
GetNextFrame(this);
}
@@ -130,7 +130,7 @@ void sub_080240B8(Entity* this) {
u32 direction = (Random() & 0xc0) >> 3;
sub_0804A720(this);
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->field_0x80.HALF.LO = 0;
if (direction & 8) {
this->y.HALF.HI += (direction & 0x10) ? -0x20 : 0x20;
@@ -830,7 +830,7 @@ void sub_08024E4C(Entity* this) {
player->spritePriority.b1 = 0;
if (this->field_0xf == 0) {
(this->field_0x86.HALF.HI++;
player->hurtBlinkTime = 8;
player->iframes = 8;
ModHealth(-2);
sub_0800449C(player, 0x7a);
}
@@ -850,7 +850,7 @@ void sub_08024F50(Entity* this) {
CopyPosition(this, &gPlayerEntity);
gPlayerEntity.action = 1;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.hurtBlinkTime = -0x3c;
gPlayerEntity.iframes = -0x3c;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
gPlayerEntity.speed = 0;
gPlayerEntity.spritePriority.b1 = this->cutsceneBeh.HALF.HI;
+4 -4
View File
@@ -74,7 +74,7 @@ void sub_08025020(Entity* this) {
if (0 < this->field_0x20) {
this->field_0x20 = 0;
}
this->hurtBlinkTime = -0xc;
this->iframes = -0xc;
this->field_0x42 = 0;
if (this->field_0x80.HALF.LO == 0) {
this->animationState = (*(Entity**)&this->field_0x4c)->direction >> 3;
@@ -84,7 +84,7 @@ void sub_08025020(Entity* this) {
}
break;
default:
if (this->damageType == 0x82 && this->hurtBlinkTime < 0) {
if (this->damageType == 0x82 && this->iframes < 0) {
Entity* ent = CreateObject(0x21, 2, 0);
if (ent != NULL) {
ent->spritePriority.b0 = 3;
@@ -108,14 +108,14 @@ void sub_0802511C(Entity* this) {
void sub_0802514C(Entity* this) {
sub_08003FC4(this, 0x2000);
if (sub_0806F520(this)) {
gUnk_080CBFEC[this->previousActionFlag](this);
gUnk_080CBFEC[this->subAction](this);
} else {
sub_08025C2C(this);
}
}
void sub_08025180(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->actionDelay = Random();
this->animationState = (((*(Entity**)&this->field_0x4c)->direction ^ 0x10) >> 3);
InitializeAnimation(this, this->animationState + 4);
+2 -2
View File
@@ -44,7 +44,7 @@ void sub_08022254(Entity* this) {
ent = CreateEnemy(1, 1);
if (ent) {
ent->type2 = 1;
ent->hurtBlinkTime = -8;
ent->iframes = -8;
sub_0804A4E4(this, ent);
this->action = 2;
this->flags &= ~0x80;
@@ -97,7 +97,7 @@ void sub_080223E4(Entity* this) {
ent = this->attachedEntity;
if (ent) {
ent->bitfield = 0x94;
ent->hurtBlinkTime = 0x10;
ent->iframes = 0x10;
ent->field_0x42 = 0xc;
ent->field_0x3e = this->direction;
}
+5 -5
View File
@@ -65,18 +65,18 @@ void sub_080206E0(Entity* this) {
}
void sub_08020734(Entity* this) {
if (this->previousActionFlag < 3 && !sub_0806F520(this)) {
if (this->subAction < 3 && !sub_0806F520(this)) {
this->action = 4;
this->flags |= 0x80;
this->direction = 0xff;
InitializeAnimation(this, this->animationState + 0x10);
} else {
gUnk_080CA6A4[this->previousActionFlag](this);
gUnk_080CA6A4[this->subAction](this);
}
}
void sub_0802077C(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 60;
}
@@ -134,11 +134,11 @@ void Rollobite_Walk(Entity* this) {
}
void sub_08020874(Entity* this) {
gUnk_080CA6BC[this->previousActionFlag](this);
gUnk_080CA6BC[this->subAction](this);
}
void sub_0802088C(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->flags &= ~0x80;
this->cutsceneBeh.HALF.HI = gPlayerEntity.animationState;
this->spritePriority.b1 = 0;
+5 -5
View File
@@ -36,12 +36,12 @@ void sub_080313AC(Entity* this) {
void sub_080313E8(Entity* this) {
if (sub_0806F520()) {
gUnk_080CE470[this->previousActionFlag](this);
gUnk_080CE470[this->subAction](this);
}
}
void sub_0803140C(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 0x3c;
}
@@ -65,7 +65,7 @@ void sub_08031434(Entity* this) {
sub_08031600(this);
} else {
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->spriteSettings.b.draw = (this->spriteSettings.b.draw & 0xfc);
this->height.HALF.HI = -0x80;
this->frameIndex = 0xff;
@@ -73,13 +73,13 @@ void sub_08031434(Entity* this) {
}
void sub_08031480(Entity* this) {
if (this->previousActionFlag == 0) {
if (this->subAction == 0) {
if (this->actionDelay != 0) {
this->actionDelay--;
} else {
sub_08031600(this);
this->action = 1;
this->previousActionFlag = 1;
this->subAction = 1;
this->spriteSettings.b.draw = 3;
this->spriteRendering.b3 = 1;
this->spriteOrientation.flipY = 1;
+3 -3
View File
@@ -234,7 +234,7 @@ void sub_080296D8(Entity* this) {
gPlayerState.flags.all &= 0xffffffef;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.field_0x20 = 0x18000;
gPlayerEntity.hurtBlinkTime = 0xa6;
gPlayerEntity.iframes = 0xa6;
gPlayerEntity.height.HALF.HI = -2;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
gPlayerEntity.spritePriority.b1 = this->field_0x80.HALF.LO;
@@ -243,8 +243,8 @@ void sub_080296D8(Entity* this) {
this->action = 5;
this->field_0xf = 0x3c;
this->flags2 |= 3;
if ((s8)this->hurtBlinkTime == 0) {
this->hurtBlinkTime = 0xf4;
if ((s8)this->iframes == 0) {
this->iframes = 0xf4;
}
}
+1 -8
View File
@@ -5,12 +5,6 @@
#include "random.h"
#include "functions.h"
typedef struct {
void* field_0x0;
void* entityCount;
u8 freezeTime;
} EntityHandler;
typedef struct {
s8 h, v;
} PACKED PosOffset;
@@ -28,7 +22,6 @@ extern u8 gUnk_080D16D0[4]; // Entity count per form
extern PosOffset gUnk_080D16D4[4];
extern u8 gEntCount;
extern EntityHandler gHitboxCount;
void Slime(Entity* this) {
EnemyFunctionHandler(this, gUnk_080D16A4);
@@ -116,7 +109,7 @@ void sub_080450A8(Entity* this) {
ent->parent = entities[(i + count - 1) % count];
ent->type2 = 1;
ent->height.HALF.HI = 0;
ent->hurtBlinkTime = -0x10;
ent->iframes = -0x10;
/* Set MiniSlime offset relative to killed slime. */
sub_08045178(this, ent, off->h, off->v);
+3 -3
View File
@@ -35,17 +35,17 @@ void sub_0803169C(Entity* this) {
iVar1 = sub_0806F520(this);
if (iVar1 == 0) {
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->flags = this->flags | 0x80;
this->speed = 0x40;
this->field_0xf = 1;
} else {
gUnk_080CE554[this->previousActionFlag](this);
gUnk_080CE554[this->subAction](this);
}
}
void sub_080316DC(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 0x3c;
}
+1 -1
View File
@@ -19,7 +19,7 @@ void sub_0802B2E0(Entity* this) {
if (this->bitfield & 0x80) {
if ((this->bitfield & 0x7f) == 0x14) {
this->flags &= ~0x80;
this->hurtBlinkTime = 0;
this->iframes = 0;
this->spriteSettings.b.draw = 0;
this->action = 2;
ent = CreateFx(this, 2, 0);
+2 -2
View File
@@ -56,7 +56,7 @@ void sub_08028284(Entity* this) {
}
}
this->attachedEntity->hurtBlinkTime = this->hurtBlinkTime;
this->attachedEntity->iframes = this->iframes;
if (this->currentHealth == 0) {
this->speed = 0;
this->field_0x82.HALF.LO = 0;
@@ -386,7 +386,7 @@ void sub_080288C0(Entity* this) {
Entity* ent = this->attachedEntity;
if (ent && (ent->bitfield & 0x80)) {
this->field_0x3e = ent->field_0x3e;
this->hurtBlinkTime = -ent->hurtBlinkTime;
this->iframes = -ent->iframes;
this->field_0x46 = ent->field_0x46;
this->field_0x42 = ent->field_0x42;
ent->field_0x42 = 0;
+1 -1
View File
@@ -53,7 +53,7 @@ void sub_0802B628(Entity* this) {
this->speed = 0xc0;
this->direction = this->field_0x3e;
this->field_0x42 = 0;
this->hurtBlinkTime = -8;
this->iframes = -8;
this->damageType = 100;
InitializeAnimation(this, 9);
}
+3 -3
View File
@@ -118,11 +118,11 @@ void sub_080225EC(Entity* this) {
}
void sub_08022654(Entity* this) {
switch (this->previousActionFlag) {
switch (this->subAction) {
case 0:
if (--this->field_0xf)
return;
this->previousActionFlag = 1;
this->subAction = 1;
SoundReq(0x12d);
InitializeAnimation(this, 0);
/* fallthrough */
@@ -130,7 +130,7 @@ void sub_08022654(Entity* this) {
if (sub_08003FC4(this, 0x1800))
return;
this->previousActionFlag = 2;
this->subAction = 2;
this->spriteSettings.b.draw = 1;
InitializeAnimation(this, 5);
EnqueueSFX(0x7d);
+5 -5
View File
@@ -30,7 +30,7 @@ void sub_0802F150(Entity* this) {
switch (this->bitfield & 0x3f) {
case 0x14:
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
if (this->type != 0) {
this->actionDelay = 0xc0;
} else {
@@ -69,7 +69,7 @@ void sub_0802F210(Entity* this) {
sub_0804A720(this);
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = gUnk_080CDEF8[Random() & 3];
this->actionDelay = (Random() & 0x1f) + this->actionDelay;
this->field_0xf = 0;
@@ -116,7 +116,7 @@ void sub_0802F300(Entity* this) {
if (sub_080044EC(this, this->field_0x80.HWORD) == 1) {
this->action = 3;
this->previousActionFlag = 0;
this->subAction = 0;
if (this->type != 0) {
rand = 0;
}
@@ -143,9 +143,9 @@ void sub_0802F300(Entity* this) {
}
}
if ((this->previousActionFlag == 0) && (temp < this->height.HALF.HI)) {
if ((this->subAction == 0) && (temp < this->height.HALF.HI)) {
InitializeAnimation(this, 4);
this->previousActionFlag = 1;
this->subAction = 1;
}
if (temp < -0xc) {
+5 -5
View File
@@ -28,7 +28,7 @@ void sub_08037F00(Entity* this) {
sub_0804AA30(this, &gUnk_080CF4A0);
if (this->bitfield == 0x94) {
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0x14;
this->field_0xf = 0;
this->field_0x80.HALF.LO = 0;
@@ -70,7 +70,7 @@ void sub_08037FA0(Entity* this) {
}
sub_0804A720(this);
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = (Random() & 0x1f) + 0x20;
this->field_0xf = 0;
this->field_0x80.HALF.LO = 0;
@@ -107,7 +107,7 @@ void sub_08038048(Entity* this) {
if (sub_080044EC(this, 0x3000) == 1) {
this->action = 3;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0x14;
InitializeAnimation(this, 3);
return;
@@ -122,9 +122,9 @@ void sub_08038048(Entity* this) {
sub_08038168(this);
}
if ((this->previousActionFlag == 0) && (temp < this->height.HALF.HI)) {
if ((this->subAction == 0) && (temp < this->height.HALF.HI)) {
InitializeAnimation(this, 4);
this->previousActionFlag = 1;
this->subAction = 1;
}
if (temp < -0xc) {
+3 -3
View File
@@ -50,7 +50,7 @@ void sub_08033564(Entity* this) {
break;
case 0x14:
this->flags &= 0x7f;
this->hurtBlinkTime = 0;
this->iframes = 0;
this->spriteSettings.b.draw = FALSE;
ent = CreateFx(this, 2, 0);
if (ent != NULL) {
@@ -65,12 +65,12 @@ void sub_08033564(Entity* this) {
void sub_0803362C(Entity* this) {
if (sub_0806F520() != 0) {
gUnk_080CEB98[this->previousActionFlag](this);
gUnk_080CEB98[this->subAction](this);
}
}
void sub_08033650(Entity* this) {
this->previousActionFlag = 2;
this->subAction = 2;
}
void sub_08033658(Entity* this) {
+2 -2
View File
@@ -14,7 +14,7 @@
#include "functions.h"
extern u8 gArea;
extern u32 gUnk_03000B80;
extern Entity gPlayerEntity;
extern u32 gUnk_03003FC0;
extern u16 gWalletSizes[4];
@@ -239,7 +239,7 @@ void InitializePlayer(void) {
Entity* pl;
sub_080784C8();
MemClear((void*)&gUnk_03000B80, 0x70);
MemClear((void*)&gUnk_03000B80, sizeof(gUnk_03000B80));
MemClear((void*)&gPlayerState, 0xb0);
MemFill32(0xffffffff, &gPlayerState.field_0x40, 0x40);
+2 -2
View File
@@ -15,7 +15,7 @@ extern Hitbox* gUnk_080B3DE8[];
void Item11(Entity* this) {
if (this->currentHealth) {
this->hurtBlinkTime = 0;
this->iframes = 0;
gUnk_080B3DD0[this->action](this);
} else {
DeleteThisEntity();
@@ -81,7 +81,7 @@ void sub_08018DE8(Entity* this) {
sub_08018F6C(this);
break;
case 5:
this->attachedEntity->previousActionFlag = 4;
this->attachedEntity->subAction = 4;
this->flags = this->flags | 0x80;
this->action = 2;
this->spritePriority.b0 = 2;
+3 -3
View File
@@ -251,10 +251,10 @@ void sub_0805A664(Manager15* this) {
sub_0805A68C(this);
}
extern u32 sub_0806FBFC(u32, u32, u32, u32);
extern u32 CheckPlayerProximity(u32, u32, u32, u32);
void sub_0805A68C(Manager15* this) {
if (sub_0806FBFC(this->unk_38 - 0x18, this->unk_3a - 0x18, 0x30, 0x30)) {
if (CheckPlayerProximity(this->unk_38 - 0x18, this->unk_3a - 0x18, 0x30, 0x30)) {
if (this->unk_2c <= 0x1007) {
gScreen.controls.alphaBlend = ++this->unk_2c;
this->unk_22 = 0;
@@ -285,7 +285,7 @@ void sub_0805A6E8(Manager15* this) {
}
u32 sub_0805A73C(Manager15* this) {
return sub_0806FBFC(this->unk_38 - 0x6, this->unk_3a - 0x6, 0xC, 0xC);
return CheckPlayerProximity(this->unk_38 - 0x6, this->unk_3a - 0x6, 0xC, 0xC);
}
void sub_0805A758(Manager15* this) {
+3 -2
View File
@@ -30,7 +30,8 @@ void sub_0805B030(Manager1A* this) {
gUnk_08108668[this->manager.action](this);
}
extern u32 sub_0806FBFC(u32, u32, u32, u32);
extern void sub_08052D74(void*, void*, void*);
extern u32 CheckPlayerProximity(u32, u32, u32, u32);
typedef struct struct_08108764 {
u8 unk_00;
@@ -137,7 +138,7 @@ void sub_0805B168(Manager1A* this) {
u32 sub_0805B1CC(Manager1A* this) {
u32 re = 0;
if (sub_0806FBFC(this->unk_20, this->unk_22, this->unk_24, this->unk_26)) {
if (CheckPlayerProximity(this->unk_20, this->unk_22, this->unk_24, this->unk_26)) {
if ((gPlayerState.flags.all & 0x4) && (gPlayerState.flags.all & 0x1)) {
gPlayerState.flags.all |= 0x8000;
} else if (gPlayerState.flags.all & 0x8000) {
+10 -8
View File
@@ -7,6 +7,8 @@
#include "random.h"
#include "functions.h"
// Facilitates the usage of minish portals.
typedef struct {
Manager manager;
u32 unk_20;
@@ -22,7 +24,7 @@ typedef struct {
} Manager3;
extern s8 gUnk_08107C6C[];
extern u32 sub_0806FBFC(u32, u32, u32, u32);
extern u32 CheckPlayerProximity(u32, u32, u32, u32);
extern u32 sub_08057810(void);
extern u32 sub_080002C0(u16, u16, u8);
extern void sub_080577AC(u32, u32, u32);
@@ -35,14 +37,14 @@ void sub_080576C0(Manager3* this) {
this->unk_24 = this->unk_3a + gRoomControls.roomOriginY - 0x20;
return;
}
if (sub_0806FBFC(this->unk_20, this->unk_24, 0x40, 0x40)) {
gArea.field_0x12 = this->unk_20 + 0x20;
gArea.field_0x14 = this->unk_24 + 0x20 + gUnk_08107C6C[this->manager.unk_0a];
gArea.field_0x16 = this->unk_34;
gArea.field_0x17 = this->manager.unk_0a;
if (CheckPlayerProximity(this->unk_20, this->unk_24, 0x40, 0x40)) {
gArea.curPortalX = this->unk_20 + 0x20;
gArea.curPortalY = this->unk_24 + 0x20 + gUnk_08107C6C[this->manager.unk_0a];
gArea.curPortalExitDirection = this->unk_34;
gArea.curPortalType = this->manager.unk_0a;
if (!CheckGlobalFlag(EZERO_1ST)) {
gArea.field_0x18 = 1;
gArea.field_0x17 = 5;
gArea.curPortalType = 5;
} else {
if ((gPlayerState.flags.all & 0x20) && gPlayerState.jumpStatus == 0) {
gArea.field_0x18 = 2;
@@ -91,7 +93,7 @@ void sub_080577AC(u32 baseX, u32 baseY, u32 layer) {
}
u32 sub_08057810(void) {
if ((gPlayerState.flags.all & 0x80) && !gPlayerState.field_0xaa && (gArea.field_0x17 != 0x6) &&
if ((gPlayerState.flags.all & 0x80) && !gPlayerState.field_0xaa && (gArea.curPortalType != 0x6) &&
(gPlayerState.heldObject == 0)) {
switch (gPlayerState.field_0xa8) {
case 0:
+1 -1
View File
@@ -159,6 +159,6 @@ void sub_080634EC(Entity* this) {
void sub_08063504(Entity* this, ScriptExecutionContext* context) {
u32 uVar1;
uVar1 = sub_080544DC(gUnk_0810C88C[this->type2]);
uVar1 = GetBottleContaining(gUnk_0810C88C[this->type2]);
context->condition = BOOLCAST(uVar1);
}
+2 -2
View File
@@ -17,7 +17,7 @@ void BigGoron(Entity* this) {
void sub_0806CF30(Entity* this) {
if (this->action == 0) {
this->action = 1;
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x68.HWORD = this->x.HALF.HI;
sub_0805E3A0(this, 2);
sub_0806D0B0(this);
@@ -27,7 +27,7 @@ void sub_0806CF30(Entity* this) {
HandleEntity0x82Actions(this);
}
switch (this->previousActionFlag) {
switch (this->subAction) {
case 0:
case 1:
if (gScreenTransition.frameCount % 4 == 0) {
+12 -12
View File
@@ -50,8 +50,8 @@ void sub_08068FC0(Entity* ent) {
void sub_08069018(Entity* ent) {
s32 var0;
if (ent->previousActionFlag == 0) {
ent->previousActionFlag++;
if (ent->subAction == 0) {
ent->subAction++;
ent->field_0xf = (Random() & 0x3F) + 0x3C;
InitAnimationForceUpdate(ent, ent->animationState);
}
@@ -64,7 +64,7 @@ void sub_08069018(Entity* ent) {
} else {
ent->action = 3;
}
ent->previousActionFlag = var0;
ent->subAction = var0;
}
sub_0806924C(ent);
@@ -73,10 +73,10 @@ void sub_08069018(Entity* ent) {
void sub_08069068(Entity* ent) {
s32 var0;
if (ent->previousActionFlag == 0) {
if (ent->subAction == 0) {
u32 anim;
ent->previousActionFlag++;
ent->subAction++;
anim = (Random() & 2) - 1;
anim = (anim + ent->animationState) & 3;
@@ -120,7 +120,7 @@ void sub_08069068(Entity* ent) {
var0 = --ent->field_0xf;
if (var0 == 0) {
ent->action = 3;
ent->previousActionFlag = var0;
ent->subAction = var0;
}
sub_0806924C(ent);
@@ -128,7 +128,7 @@ void sub_08069068(Entity* ent) {
void sub_08069124(Entity* ent) {
UpdateAnimationSingleFrame(ent);
gUnk_08111928[ent->previousActionFlag](ent);
gUnk_08111928[ent->subAction](ent);
sub_0806924C(ent);
}
@@ -136,13 +136,13 @@ void sub_08069148(Entity* ent) {
u32 var0 = Random() & 3;
var0 += 3;
ent->field_0xf = var0;
ent->previousActionFlag = 1;
ent->subAction = 1;
InitAnimationForceUpdate(ent, ent->animationState + 8);
}
void sub_08069168(Entity* ent) {
if ((s8)ent->frames.all < 0) {
ent->previousActionFlag = 2;
ent->subAction = 2;
InitAnimationForceUpdate(ent, ent->animationState + 12);
}
}
@@ -154,14 +154,14 @@ void sub_08069188(Entity* ent) {
if (((s8)--ent->field_0xf) != 0)
return;
ent->previousActionFlag = 3;
ent->subAction = 3;
InitAnimationForceUpdate(ent, ent->animationState + 16);
}
void sub_080691BC(Entity* ent) {
if ((s8)ent->frames.all < 0) {
ent->action = 1;
ent->previousActionFlag = 0;
ent->subAction = 0;
InitAnimationForceUpdate(ent, ent->animationState + 4);
}
}
@@ -169,7 +169,7 @@ void sub_080691BC(Entity* ent) {
void sub_080691E0(Entity* ent) {
if (UpdateFuseInteraction(ent) != 0) {
ent->action = 1;
ent->previousActionFlag = 0;
ent->subAction = 0;
}
}
+5 -5
View File
@@ -25,7 +25,7 @@ void sub_0808F658(Entity* this) {
this->animationState = 0;
this->x.HALF.HI += (Random() & 0xf) << 4;
this->actionDelay = 0;
this->previousActionFlag = 0;
this->subAction = 0;
}
void sub_0808F6E0(Entity* this) {
@@ -36,8 +36,8 @@ void sub_0808F6E0(Entity* this) {
}
void sub_0808F70C(Entity* this) {
if (this->previousActionFlag == 0) {
this->previousActionFlag = 1;
if (this->subAction == 0) {
this->subAction = 1;
this->actionDelay = ((Random() & 7) << 3) + 31;
if ((this->direction & 0x10)) {
@@ -50,10 +50,10 @@ void sub_0808F70C(Entity* this) {
this->y.HALF.HI = gUnk_08121EB3[this->type2 * 2 + (Random() & 1)];
}
if (this->previousActionFlag == 1) {
if (this->subAction == 1) {
if (--this->actionDelay == 0) {
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
}
}
}
+2 -2
View File
@@ -59,12 +59,12 @@ void sub_0809CD0C(Entity* this) {
}
/* Damage minish link if he touches a steam cloud */
if (this->field_0xf == 0 && gPlayerEntity.hurtBlinkTime == 0 && this->frameIndex &&
if (this->field_0xf == 0 && gPlayerEntity.iframes == 0 && this->frameIndex &&
sub_0806FC80(this, &gPlayerEntity, 4)) {
this->field_0xf++;
ModHealth(-2);
sub_0800449C(&gPlayerEntity, 0x7a);
gPlayerEntity.hurtBlinkTime = 16;
gPlayerEntity.iframes = 16;
gPlayerEntity.field_0x3e = 16;
gPlayerEntity.field_0x42 = 12;
gPlayerEntity.field_0x46 = 16;
+2 -2
View File
@@ -70,7 +70,7 @@ void sub_0809D048(Entity* this) {
}
void sub_0809D06C(Entity* this) {
gUnk_08123EFC[this->previousActionFlag](this);
gUnk_08123EFC[this->subAction](this);
}
void sub_0809D084(Entity* this) {
@@ -81,7 +81,7 @@ void sub_0809D084(Entity* this) {
if (temp != 0) {
PositionRelative(this->parent, this, 0, 0x80000);
} else {
this->previousActionFlag++;
this->subAction++;
this->field_0x20 = temp;
}
}
+1 -1
View File
@@ -47,7 +47,7 @@ void sub_08081FF8(Entity*);
void sub_08081BAC(Entity* this) {
if (sub_08081CB0(this)) {
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 0xA;
sub_0805E4E0(this, 0xA);
sub_08081FF8(this);
+3 -3
View File
@@ -61,7 +61,7 @@ void sub_080866D8(Entity* this) {
entity->field_0x68.HWORD = prop->unk0;
entity->field_0x6a.HWORD = prop->unk2;
entity->collisionLayer = prop->unk4;
entity->previousActionFlag = prop->unk5;
entity->subAction = prop->unk5;
UpdateSpriteForCollisionLayer(entity);
*((u32*)(&this->field_0x68)) |= mask;
if (prop->unk8) {
@@ -98,7 +98,7 @@ static void sub_0808681C(Entity* this) {
this->spriteSettings.b.draw = 1;
this->frameIndex = 0;
this->hitbox = &gUnk_081206AC;
if (this->previousActionFlag == 1) {
if (this->subAction == 1) {
this->action = 2;
this->frameIndex = 1;
}
@@ -158,7 +158,7 @@ void sub_0808692C(Entity* this) {
this->flags &= 0xFD;
this->type2 = 2;
this->action = this->frameIndex == 0 ? 1 : 2;
this->previousActionFlag = 0;
this->subAction = 0;
this->actionDelay = 8;
}
+3 -3
View File
@@ -162,7 +162,7 @@ static void sub_080810FC(Entity* this) {
sub_08081598(this);
} else {
this->action = 2;
this->previousActionFlag = 0;
this->subAction = 0;
this->flags |= 0x80;
this->flags2 = 0x11;
CopyPosition(&gPlayerEntity, this);
@@ -304,11 +304,11 @@ void sub_0808136C(Entity* this) {
}
static void sub_080813BC(Entity* this) {
gUnk_0811E840[this->previousActionFlag](this);
gUnk_0811E840[this->subAction](this);
}
void sub_080813D4(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 1;
this->spriteSettings.b.draw = 1;
}
+1 -1
View File
@@ -31,7 +31,7 @@ void sub_08089B18(Entity* this) {
case 4:
if (!CheckFlags(this->field_0x86.HWORD)) {
this->spriteSettings.b.draw = FALSE;
this->previousActionFlag = 1;
this->subAction = 1;
return;
}
}
+2 -2
View File
@@ -149,13 +149,13 @@ void sub_0808F2C0(Entity* this) {
void sub_0808F370(Entity* this) {
if (this->action == 0) {
if (this->parent->previousActionFlag == 1) {
if (this->parent->subAction == 1) {
this->action = 1;
this->field_0x70.WORD = 0;
sub_0808F5EC(this);
}
} else {
u8 flag = this->parent->previousActionFlag - 1;
u8 flag = this->parent->subAction - 1;
if (flag < 5) {
if (this->field_0x70.WORD == 0) {
if (--(*(u32*)&this->field_0x74) == -1) {
+4 -4
View File
@@ -19,7 +19,7 @@ void sub_08099DD0(Entity* this) {
this->collisionLayer = 1;
this->spriteRendering.b3 = 3;
this->spritePriority.b0 = 7;
this->previousActionFlag = 0;
this->subAction = 0;
if (GetInventoryValue(0x46)) {
this->action = 4;
this->frameIndex = 0;
@@ -32,7 +32,7 @@ void sub_08099DD0(Entity* this) {
void sub_08099E10(Entity* this) {
if (CheckLocalFlag(0x74)) {
GetNextFrame(this);
if ((this->frames.all == 1) && (this->previousActionFlag == 0)) {
if ((this->frames.all == 1) && (this->subAction == 0)) {
this->frames.all = 0;
sub_08099ECC(this);
}
@@ -57,7 +57,7 @@ void sub_08099E58(Entity* this) {
void sub_08099E8C(Entity* this) {
if (sub_080041A0(this, &gPlayerEntity, 0xc, 0xc)) {
if (this->previousActionFlag == 0) {
if (this->subAction == 0) {
sub_08099ECC(this);
sub_0805E4E0(this, 0x1e);
}
@@ -71,7 +71,7 @@ void nullsub_534(Entity* this) {
}
void sub_08099ECC(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
CopyPosition(this, &gPlayerEntity);
gPlayerState.playerAction = 3;
gPlayerState.field_0x34[4] = 0;
+6 -6
View File
@@ -60,7 +60,7 @@ void sub_08082310(Entity* this) {
switch (var0) {
case 0x13:
this->action = 3;
this->previousActionFlag = 0;
this->subAction = 0;
break;
case 0x1D:
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
@@ -112,7 +112,7 @@ void sub_08082310(Entity* this) {
}
void sub_080824F8(Entity* this) {
gUnk_0811F0A8[this->previousActionFlag](this);
gUnk_0811F0A8[this->subAction](this);
}
void sub_08082510(Entity* this) {
@@ -123,7 +123,7 @@ void sub_08082510(Entity* this) {
this->flags2 = gPlayerEntity.flags2;
this->spriteOffsetY = 0;
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
this->previousActionFlag++;
this->subAction++;
}
void nullsub_511(Entity* this) {
@@ -164,7 +164,7 @@ void sub_080825F0(Entity* this) {
static void sub_08082608(Entity* this) {
this->action = 1;
this->previousActionFlag = 0;
this->subAction = 0;
}
void sub_08082614(Entity* this) {
@@ -201,11 +201,11 @@ void sub_08082614(Entity* this) {
}
void sub_080826E4(Entity* this) {
gUnk_0811F0C4[this->previousActionFlag](this);
gUnk_0811F0C4[this->subAction](this);
}
void sub_080826FC(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->field_0x1d = 48;
this->actionDelay = 0;
}
+621 -74
View File
@@ -8,34 +8,60 @@
#include "game.h"
#include "functions.h"
extern const void (*const gUnk_0811B9E0[])(Entity*);
extern const void (*const gUnk_0811BA60[])(Entity*);
extern const void (*const gUnk_0811BA68[])(Entity*);
extern const void (*const gUnk_0811BA74[])(Entity*);
extern const void (*const gUnk_0811BA7C[])(Entity*);
extern const void (*const gUnk_0811BA88[])(Entity*);
extern const void (*const gUnk_0811BA94[])(Entity*);
extern const void (*const gUnk_0811BA9C[])(Entity*);
static void (*const sPlayerActions[])(Entity*);
extern void (*const gUnk_0811BA60[])(Entity*);
extern void (*const gUnk_0811BA68[])(Entity*);
extern void (*const gUnk_0811BA74[])(Entity*);
extern void (*const gUnk_0811BA7C[])(Entity*);
extern void (*const gUnk_0811BA88[])(Entity*);
extern void (*const gUnk_0811BA94[])(Entity*);
extern void (*const gUnk_0811BA9C[])(Entity*);
extern void (*const gUnk_0811BAD4[])(Entity*);
extern void (*const gUnk_0811BAE4[])(Entity*);
extern void (*const gUnk_0811BB3C[])(Entity*);
extern void sub_08079458();
extern void RespawnPlayer();
extern void sub_080797EC();
extern void sub_08079E08();
extern void sub_08078F60();
extern void sub_0806F948();
extern void sub_08077698();
extern void sub_0805E544();
extern void sub_080717F8();
extern void DoExitTransition();
extern void UnfreezeTime();
extern void sub_08071A6C();
extern void sub_08052BB8();
extern void sub_08079258();
extern void sub_08071AF0();
extern void sub_080728AC();
extern void sub_0807A298();
extern u32 sub_08079B24();
extern void sub_08079708();
extern void sub_080792D8();
typedef struct {
u8 frame;
u8 dummy;
u16 speed;
} PushFrames;
extern PushFrames gUnk_0811BAF0[];
extern Hitbox gUnk_08114F88;
extern ScreenTransitionData gUnk_0813AB58;
// inject
void sub_08070680(Entity* this) {
gUnk_0811B9E0[this->action](this);
void DoPlayerAction(Entity* this) {
sPlayerActions[this->action](this);
}
void sub_08070698(Entity* this) {
void PlayerInit(Entity* this) {
Entity* ent;
gPlayerState.field_0x0[0] = 0xff;
gPlayerState.field_0x16[0] = gPlayerEntity.x.HALF.HI;
gPlayerState.field_0x16[1] = gPlayerEntity.y.HALF.HI;
this->flags = this->flags | 0x80;
gPlayerState.startPosX = gPlayerEntity.x.HALF.HI;
gPlayerState.startPosY = gPlayerEntity.y.HALF.HI;
this->flags |= 0x80;
this->spritePriority.b0 = 0xc;
this->spritePriority.b1 = 1;
this->spriteSettings.b.shadow = 1;
@@ -75,9 +101,7 @@ void sub_08070698(Entity* this) {
}
// PlayerState.flags need to be 100% before this one can reasonably be done
NONMATCH("asm/non_matching/player/sub_08070794.s", void sub_08070794(Entity* this)) {
}
END_NONMATCH
ASM_FUNC("asm/non_matching/player/sub_08070794.s", void PlayerNormal(Entity* this))
void sub_08070BEC(Entity* this, u32 r0) {
if (r0 & 1)
@@ -89,12 +113,12 @@ void sub_08070BEC(Entity* this, u32 r0) {
sub_08079E08();
}
void sub_08070C10(Entity* this) {
gPlayerState.field_0xd[0] = 0xFF;
void PlayerFall(Entity* this) {
gPlayerState.field_0xd = 0xFF;
gPlayerState.pushedObject = 0x80;
gPlayerState.field_0xa8 = 10;
gUnk_0811BA60[this->previousActionFlag](this);
gUnk_0811BA60[this->subAction](this);
}
void sub_08070C3C(Entity* this) {
@@ -112,7 +136,7 @@ void sub_08070C3C(Entity* this) {
else
gPlayerState.field_0x8 = 0x1b8;
this->previousActionFlag++;
this->subAction++;
this->flags &= ~0x80;
this->spritePriority.b1 = 0;
ResetPlayer();
@@ -129,16 +153,16 @@ void sub_08070CB4(Entity* this) {
this->spriteSettings.b.draw = 0;
} else {
gPlayerState.flags.all &= ~(0x4 | 0x8000);
sub_08079458();
RespawnPlayer();
gPlayerState.field_0xa = 0;
this->hurtBlinkTime = 0x20;
this->iframes = 32;
ModHealth(-2);
}
}
}
void sub_08070D20(Entity* this) {
gUnk_0811BA68[this->previousActionFlag](this);
void PlayerBounce(Entity* this) {
gUnk_0811BA68[this->subAction](this);
}
void sub_08070D38(Entity* this) {
@@ -146,7 +170,7 @@ void sub_08070D38(Entity* this) {
this->direction = ((this->animationState & 0xe) << 2) ^ 0x10;
this->speed = 0x100;
this->field_0x42 = 0;
this->previousActionFlag++;
this->subAction++;
this->actionDelay = gPlayerState.field_0x38;
this->spriteIndex = 1;
@@ -202,7 +226,7 @@ NONMATCH("asm/non_matching/player/sub_08070DC4.s", void sub_08070DC4(Entity* thi
this->spriteIndex = 1;
this->actionDelay = 8;
this->previousActionFlag++;
this->subAction++;
if ((gPlayerState.flags.all & 0x80) == 0)
gPlayerState.field_0x8 = 0x100;
@@ -225,7 +249,7 @@ void sub_08070E9C(Entity* this) {
gPlayerState.field_0x27[0] = 4;
gPlayerState.field_0xa8 = 0x13;
sub_0807A1B8();
gUnk_0811BA74[this->previousActionFlag](this);
gUnk_0811BA74[this->subAction](this);
}
}
@@ -233,7 +257,7 @@ void sub_08070EDC(Entity* this) {
this->scriptedScene = 2;
if ((gTextBox.doTextBox & 0x7f) != 0)
this->previousActionFlag = 1;
this->subAction = 1;
if ((gPlayerState.flags.all & 0x80) == 0)
sub_08079938();
@@ -249,13 +273,13 @@ void sub_08070f24(Entity* this) {
}
}
void sub_08070F50(Entity* this) {
void PlayerItemGet(Entity* this) {
Entity* child;
u8* temp; // todo: retype
gPlayerState.field_0xa8 = 0x15;
this->flags &= ~(0x80);
gUnk_0811BA7C[this->previousActionFlag](this);
gUnk_0811BA7C[this->subAction](this);
child = this->attachedEntity;
if (child != NULL) {
@@ -276,7 +300,7 @@ void sub_08070FA4(Entity* this) {
gPlayerState.jumpStatus = 0;
if ((gPlayerState.flags.all & 0x80) == 0) {
if ((gPlayerState.flags.all & 0x8) != 0) {
if (gPlayerState.flags.all & 0x8) {
if (sub_080542AC(gPlayerState.field_0x38)) {
temp = 0x45e;
} else {
@@ -292,16 +316,15 @@ void sub_08070FA4(Entity* this) {
gPlayerState.field_0x8 = temp;
}
this->previousActionFlag = 1;
this->subAction = 1;
ResetPlayer();
sub_08078F60();
}
void sub_08071020(Entity* this) {
UpdateAnimationSingleFrame(this);
if (this->frames.all != 0) {
this->previousActionFlag = 2;
}
if (this->frames.all != 0)
this->subAction = 2;
}
void sub_08071038(Entity* this) {
@@ -311,24 +334,24 @@ void sub_08071038(Entity* this) {
if (sub_08078EFC() || (gTextBox.doTextBox & 0x7f))
return;
if ((this->frames.all & 0x80) != 0) {
if (this->frames.all & 0x80) {
this->attachedEntity = 0;
this->field_0x42 = 0;
this->hurtBlinkTime = 0xf8;
this->iframes = 248;
gPlayerState.jumpStatus = 0;
sub_080791D0();
}
}
void sub_08071084(Entity* this) {
void PlayerJump(Entity* this) {
gPlayerState.field_0xa8 = 0xb;
gUnk_0811BA88[this->previousActionFlag](this);
gUnk_0811BA88[this->subAction](this);
}
void sub_080710A8(Entity* this) {
u32 temp;
this->previousActionFlag++;
this->subAction++;
gPlayerState.flags.all |= 1;
gPlayerState.flags.all &= ~(0x400 | 0x800);
@@ -354,7 +377,7 @@ void sub_080710A8(Entity* this) {
asm("lsl r0, r0, #0x4");
this->field_0x20 = (temp - 4) * 64 * 64;
this->speed = 0x100;
this->speed = 256;
sub_0807A108();
SoundReq(0x7c);
SoundReq(0x78);
@@ -368,7 +391,7 @@ void sub_08071130(Entity* this) {
if (gPlayerState.field_0x1a[1] == 0) {
UpdateAnimationSingleFrame(this);
if ((this->frames.all & 1))
if (this->frames.all & 1)
return;
}
@@ -402,7 +425,7 @@ void sub_08071130(Entity* this) {
this->actionDelay = 6;
if (((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) && ((gPlayerState.flags.all & 0x80) == 0)) {
if ((gPlayerState.flags.all & 0x8) != 0) {
if (gPlayerState.flags.all & 0x8) {
gPlayerState.field_0x8 = 0x424;
} else {
gPlayerState.field_0x8 = 0x820;
@@ -410,7 +433,7 @@ void sub_08071130(Entity* this) {
this->animIndex = 0xff;
}
this->previousActionFlag++;
this->subAction++;
sub_08078F60();
this->field_0x42 = 0;
SoundReq(0x7d);
@@ -429,33 +452,31 @@ void sub_08071208(Entity* this) {
}
}
void sub_08071248(Entity* this) {
void PlayerDrown(Entity* this) {
gPlayerState.field_0xa8 = 0x16;
gPlayerState.flags.all |= 4;
this->flags &= ~0x80;
gUnk_0811BA94[this->previousActionFlag](this);
gUnk_0811BA94[this->subAction](this);
}
void sub_0807127C(Entity* this) {
this->previousActionFlag = 1;
this->subAction = 1;
this->spritePriority.b1 = 0;
if ((gPlayerState.flags.all & 0x80) != 0) {
if (gPlayerState.flags.all & 0x80) {
this->actionDelay = 0x3c;
gPlayerState.field_0x8 = 0xc19;
SoundReq(0x84);
} else {
if ((gPlayerState.flags.all & 0x10000) == 0) {
if ((gPlayerState.flags.all & 0x10000) == 0)
sub_08004168(this);
}
CreateFx(this, 11, 0);
if ((gPlayerState.flags.all & 8) == 0) {
if ((gPlayerState.flags.all & 8) == 0)
gPlayerState.field_0x8 = 0x72c;
} else {
else
gPlayerState.field_0x8 = 0x44c;
}
}
ResetPlayer();
}
@@ -481,28 +502,29 @@ void sub_080712F0(Entity* this) {
return;
this->field_0x42 = 0;
this->hurtBlinkTime = 0x20;
this->iframes = 32;
this->spritePriority.b1 = 1;
this->spriteSettings.b.draw = FALSE;
gPlayerState.flags.all &= ~(0x4);
sub_08079458();
gPlayerState.flags.all &= ~0x4;
RespawnPlayer();
}
void sub_08071380(Entity* this) {
static void PlayerUsePortal(Entity* this) {
gPlayerState.field_0xa8 = 0xe;
gUnk_0811BA9C[this->previousActionFlag](this);
gUnk_0811BA9C[this->subAction](this);
if ((this->previousActionFlag == 7) || (this->previousActionFlag < 3))
// probably a switch
if ((this->subAction == 7) || (this->subAction < 3))
return;
if ((gPlayerState.flags.all & 0x20) == 0)
return;
if ((gInput.newKeys & 0x102) == 0)
if ((gInput.newKeys & (0x100 | 0x2)) == 0)
return;
if (CheckIsDungeon() || gArea.field_0x17 == 3) {
this->previousActionFlag = 7;
if (CheckIsDungeon() || gArea.curPortalType == 3) {
this->subAction = 7;
this->actionDelay = 30;
DoFade(7, 16);
SoundReq(0xf8);
@@ -511,19 +533,19 @@ void sub_08071380(Entity* this) {
}
}
void sub_08071400(Entity* this) {
static void PortalJumpOnUpdate(Entity* this) {
u16 x;
u16 y;
this->flags &= ~(0x80);
this->flags &= ~0x80;
this->field_0x42 = 0;
x = gArea.field_0x12;
y = gArea.field_0x14;
x = gArea.curPortalX;
y = gArea.curPortalY;
if ((this->x.HALF.HI != x) || (this->y.HALF.HI != y)) {
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, gArea.field_0x12, gArea.field_0x14);
this->speed = 0x100;
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, gArea.curPortalX, gArea.curPortalY);
this->speed = 256;
sub_08079E08();
}
@@ -532,17 +554,542 @@ void sub_08071400(Entity* this) {
if (gPlayerState.jumpStatus == 0) {
gPlayerState.flags.all |= 0x20;
this->previousActionFlag = 1;
this->subAction = 1;
this->animationState = 4;
this->spriteSettings.b.flipX = FALSE;
if (gArea.field_0x17 == 4) {
if (gArea.curPortalType == 4) {
gPlayerState.field_0x8 = 0x52c;
}
}
this->actionDelay = 8;
if (gArea.field_0x17 != 3) {
if (gArea.curPortalType != 3) {
this->spritePriority.b0 = 3;
}
}
static void PortalStandUpdate(Entity* this) {
switch (gArea.curPortalType) {
case 4:
case 5:
sub_0806F948(&gPlayerEntity);
break;
}
if ((gPlayerState.field_0xd & 0x84) == 0) {
if (this->direction != gPlayerState.field_0xd) {
this->actionDelay = 8;
}
if (--this->actionDelay == 0xff) {
this->direction = gPlayerState.field_0xd;
this->animationState = this->direction >> 2;
this->field_0x20 = 0x20000;
this->speed = 256;
this->action = 9;
this->subAction = 7;
this->field_0xf = 0;
gPlayerState.field_0x8 = (gPlayerState.flags.all & 8) ? 0x41C : 0x80C;
gPlayerState.flags.all &= ~0x20;
return;
}
this->direction = gPlayerState.field_0xd;
} else {
this->actionDelay = 8;
}
if (gArea.curPortalType == 4) {
if (this->frames.all == 0) {
UpdateAnimationSingleFrame(this);
return;
}
} else {
sub_08077698(this);
}
sub_08079938();
}
static void PortalActivateInit(Entity* this) {
gRoomControls.cameraTarget = NULL;
gUnk_02034490[0] = 1;
this->subAction = 3;
this->field_0xf = 0x1e;
gPlayerState.field_0x8 = 0x738;
CreateObjectWithParent(this, 6, 1, 0);
sub_08077B20();
sub_0805E544();
}
static void PortalActivateUpdate(Entity* this) {
if (this->field_0xf)
return;
UpdateAnimationSingleFrame(this);
if (gPlayerState.flags.all & 0x80)
this->subAction = 4;
}
static void PortalShrinkInit(Entity* this) {
this->subAction = 5;
this->spritePriority.b1 = 0;
this->field_0xf = 0;
this->spriteRendering.b0 = 3;
*(u32*)&this->field_0x80.HWORD = 0x100;
*(u32*)&this->cutsceneBeh = 0x100;
sub_0805EC9C(this, 0x100, 0x100, 0);
gPlayerState.field_0x8 = 0x2c3;
gPlayerState.flags.all |= 0x80;
SoundReq(0x16f);
}
// horrible
ASM_FUNC("asm/non_matching/player/sub_08071634.s", static void PortalShrinkUpdate(Entity* this))
static void PortalEnterUpdate(Entity* this) {
if (this->actionDelay == 0) {
if (sub_08003FC4(this, 0x2000))
return;
this->spriteSettings.b.draw = FALSE;
if (gArea.curPortalType == 3) {
if (--this->field_0xf == 0)
sub_080717F8(this);
return;
}
if (gArea.curPortalType == 6)
DoExitTransition(&gUnk_0813AB58);
else
gArea.playShrinkSeq = 1;
return;
}
this->actionDelay--;
}
static void PortalUnknownUpdate(Entity* this) {
if (gFadeControl.active)
return;
if (this->actionDelay != 0) {
this->actionDelay--;
return;
}
sub_080717F8(this);
sub_080500F4(0x10);
}
extern s16 gUnk_0811BAC4[];
void sub_080717F8(Entity* this) {
u32 x;
u32 y;
this->animationState = gArea.curPortalExitDirection << 1;
this->x.HALF.HI = gArea.curPortalX + gUnk_0811BAC4[gArea.curPortalExitDirection * 2];
this->y.HALF.HI = gArea.curPortalY + gUnk_0811BAC4[gArea.curPortalExitDirection * 2 + 1];
gArea.unk1A = 0xb4;
gUnk_02034490[0] = 0;
this->action = 9;
this->subAction = 0;
gPlayerState.flags.all = (gPlayerState.flags.all & ~0x20) | 0x80;
sub_0805EC60(this);
UnfreezeTime();
}
void PlayerTalkEzlo(Entity* this) {
if (sub_08078EFC()) {
sub_08056360();
sub_08071A6C();
} else {
gPlayerState.field_0xa8 = 0x13;
this->flags &= ~0x80;
gUnk_0811BAD4[this->subAction](this);
}
}
void sub_080718A0(Entity* this) {
ResetPlayer();
gUnk_03000B80.filler[0x63] = 0;
this->iframes = 0;
gUnk_03003DC0.unk0 = 6;
this->scriptedScene = 6;
if (gPlayerState.flags.all & 0x80) {
this->subAction = 2;
this->spritePriority.b1 = 0;
sub_08052BB8();
return;
}
if (gPlayerState.jumpStatus == 0) {
this->subAction++;
if (this->animationState == 2)
gPlayerState.field_0x8 = 0x3ca;
else
gPlayerState.field_0x8 = 0x3c6;
this->spriteSettings.b.flipX = 0;
return;
}
if (!sub_08003FC4(this, 0x2000))
gPlayerState.jumpStatus = 0;
}
void sub_0807193C(Entity* this) {
Entity* child;
UpdateAnimationSingleFrame(this);
if (this->frames.all & 0x80) {
this->subAction++;
child = CreateObjectWithParent(this, 6, 0, 0);
this->attachedEntity = child;
if (child != NULL) {
if (this->animationState == 2)
gPlayerState.field_0x8 = 0x3cc;
else
gPlayerState.field_0x8 = 0x3c7;
sub_08052BB8();
}
}
}
void sub_08071990(Entity* this) {
u32 temp;
if ((gTextBox.doTextBox & 0x7f) == 0) {
this->subAction++;
if ((gPlayerState.flags.all & 0x80) == 0) {
if (this->animationState == 2)
gPlayerState.field_0x8 = 0x3cd;
else
gPlayerState.field_0x8 = 0x3c9;
} else {
sub_08071A6C();
sub_08079258();
}
return;
}
if (gPlayerState.flags.all & 0x80)
return;
if (this->animationState == 2)
temp = 4;
else
temp = 0;
if (this->attachedEntity->actionDelay != 0) {
if ((u8)(temp + 200) != this->animIndex) {
gPlayerState.field_0x8 = temp + 0x3c8;
return;
}
} else {
if ((u8)(temp + 199) != this->animIndex) {
gPlayerState.field_0x8 = temp + 0x3c7;
return;
}
}
UpdateAnimationSingleFrame(this);
}
void sub_08071A4C(Entity* this) {
UpdateAnimationSingleFrame(this);
if (this->frames.all & 0x80) {
sub_08071A6C();
sub_0807921C();
}
}
void sub_08071A6C(void) {
gUnk_03003DC0.unk0 = 0;
gPlayerEntity.scriptedScene = gPlayerEntity.scriptedScene2;
}
void PlayerPush(Entity* this) {
gPlayerState.field_0xa8 = 0x19;
gUnk_0811BAE4[this->subAction](this);
}
void sub_08071AB0(Entity* this) {
u32 speed;
this->subAction++;
gPlayerState.flags.all |= 1;
if (this->type == 1) {
this->speed = 0;
this->actionDelay = 0;
this->field_0xf = 1;
} else {
this->speed = (gPlayerState.flags.all & 0x80) ? 64 : 128;
}
sub_08071AF0(this);
}
void sub_08071AF0(Entity* this) {
gPlayerState.field_0x80 = 0;
UpdateAnimationSingleFrame(this);
if (this->type == 1) {
if (--this->field_0xf == 0) {
if (gUnk_0811BAF0[this->actionDelay].frame != 0xff) {
this->field_0xf = gUnk_0811BAF0[this->actionDelay].frame;
this->speed = gUnk_0811BAF0[this->actionDelay].speed;
this->actionDelay++;
} else {
this->subAction++;
return;
}
}
} else {
gPlayerState.pushedObject--;
if ((gPlayerState.pushedObject & 0x7f) == 0) {
this->subAction++;
}
}
sub_08079E08();
}
void sub_08071B60(Entity* this) {
gPlayerState.pushedObject = 2;
gPlayerState.flags.all &= ~0x1;
this->type = 0;
this->field_0x42 = 0;
sub_080728AC(this);
this->field_0xf = 6;
if ((gPlayerState.flags.all & 0x80) == 0) {
gPlayerState.field_0x8 = 0x104;
this->spriteIndex = 3;
InitAnimationForceUpdate(this, (this->animationState >> 1) + 0x3c);
}
}
extern void (*const gUnk_0811BB2C[])(Entity*);
void PlayerMinishDie(Entity* this) {
this->flags &= ~0x80;
gUnk_0811BB2C[this->subAction](this);
gPlayerState.field_0xa8 = 0x12;
}
void sub_08071BDC(Entity* this) {
u32 temp;
if (gPlayerState.flags.all & (0x10 | 0x100))
return;
if (sub_08003FC4(this, 0x2000)) {
if ((gPlayerState.flags.all & 8) != 0)
gPlayerState.field_0x8 = 0x420;
else
gPlayerState.field_0x8 = 0x810;
return;
}
gPlayerState.playerAction = 0;
if (gPlayerState.flags.all & 0x80) {
if ((u8)(gPlayerState.field_0x10[2] - 8) < 3) {
sub_0807A298(this);
RespawnPlayer();
this->action = 10;
}
temp = 0xc1a;
} else {
temp = (gPlayerState.flags.all & 8) ? 0x459 : 0x1bc;
}
gPlayerState.field_0x8 = temp;
gPlayerState.flags.all &= ~(0x1000000 | 0x200000 | 0x40000 | 0x800 | 0x400 | 0x100 | 0x1);
this->subAction = 1;
this->animationState = 4;
this->spritePriority.b1 = 1;
this->spriteSettings.b.draw = 3;
gPlayerState.jumpStatus = 0;
gPlayerState.pushedObject = 0;
sub_0800451C(this);
ResetPlayer();
SoundReq(0x87);
}
void sub_08071CAC(Entity* this) {
UpdateAnimationSingleFrame(this);
if (this->frames.all & 0x80) {
u32 temp;
if ((gPlayerState.flags.all & 0x80) == 0)
temp = (gPlayerState.flags.all & 8) ? 0x45a : 0x2bd;
else
temp = 0xc1b;
gPlayerState.field_0x8 = temp;
this->subAction = 2;
this->actionDelay = 0xf0;
SoundReq(0x7b);
}
}
void sub_08071D04(Entity* this) {
int idx;
int deltaHealth;
UpdateAnimationSingleFrame(this);
if (this->frames.all == 0)
return;
deltaHealth = 0;
idx = GetBottleContaining(0x28);
if (idx != 0) {
gSave.stats.bottles[idx - 1] = 0x20;
CreateObject(0x40, 0x60, 2);
deltaHealth = 32;
}
if (deltaHealth != 0) {
ModHealth(deltaHealth);
this->subAction = 3;
gPlayerState.field_0x3c[0] = 0;
this->direction = 0xff;
this->speed = 0;
this->field_0x20 = 0x18000;
gPlayerState.jumpStatus = 1;
gPlayerState.swimState = 0;
return;
}
gScreenTransition.field_0x4[1] = 1;
}
void sub_08071D80(Entity* this) {
UpdateAnimationSingleFrame(this);
gPlayerState.field_0x14 = 1;
sub_08073904(this);
if ((gPlayerState.jumpStatus & 7) == 3) {
gPlayerState.jumpStatus = 0;
this->iframes = 226;
UnfreezeTime();
sub_080791D0();
}
}
void sub_08071DB8(Entity* this) {
gUnk_0811BB3C[this->subAction](this);
}
void sub_08071DD0(Entity* this) {
this->actionDelay = gPlayerState.field_0x38;
if (gPlayerState.field_0x39 != 0) {
gPlayerState.field_0x39 = 0;
this->subAction = 2;
gPlayerState.field_0x8 = 0x100;
} else {
this->subAction = 1;
gPlayerState.field_0x8 = 0x114;
}
}
void sub_08071E04(Entity* this) {
if ((this->height.WORD != 0) && (gPlayerState.field_0x14 == '\0')) {
sub_0807A1B8();
if (gPlayerState.field_0x10[2] == 1) {
gPlayerState.field_0x10[1] = 7;
gPlayerState.flags.all |= 0x200;
sub_080791BC();
return;
}
}
UpdateAnimationSingleFrame(this);
if (sub_08079B24() == 0) {
sub_08079708(this);
return;
}
sub_080792D8();
if (sub_0807953C())
this->actionDelay -= 2;
else
this->actionDelay -= 1;
if ((s8)this->actionDelay < 1)
sub_080791BC();
}
void sub_08071E74(Entity* this) {
u32 temp;
sub_08003FC4(this, 0x2000);
sub_08079E08();
temp = this->actionDelay--;
if (temp == 0)
sub_080791BC();
}
void PlayerInit(Entity*);
void PlayerNormal(Entity*);
void PlayerInit(Entity*);
void PlayerFall(Entity*);
void PlayerJump(Entity*);
void PlayerPush(Entity*);
void PlayerBounce(Entity*);
void sub_08070E9C(Entity*);
void PlayerItemGet(Entity*);
void PlayerMinish(Entity*);
void PlayerMinishDie(Entity*);
void sub_08071DB8(Entity*);
void PlayerEmptyBottle(Entity*);
void PlayerFrozen(Entity*);
void sub_0807204C(Entity*);
void sub_080720DC(Entity*);
void PlayerPull(Entity*);
void PlayerLava(Entity*);
void PlayerWarp(Entity*);
void sub_08072454(Entity*);
void PlayerDrown(Entity*);
void PlayerUsePortal(Entity*);
void PlayerTalkEzlo(Entity*);
void PlayerRoomTransition(Entity*);
void PlayerRoll(Entity*);
void sub_080728AC(Entity*);
void PlayerInHole(Entity*);
void sub_08072C9C(Entity*);
void sub_08074C44(Entity*);
void sub_08072F34(Entity*);
void PlayerUseEntrance(Entity*);
void PlayerParachute(Entity*);
static void (*const sPlayerActions[])(Entity*) = {
[PLAYER_INIT] = PlayerInit,
[PLAYER_NORMAL] = PlayerNormal,
[PLAYER_DUMMY] = PlayerInit,
[PLAYER_FALL] = PlayerFall,
[PLAYER_JUMP] = PlayerJump,
[PLAYER_PUSH] = PlayerPush,
[PLAYER_BOUNCE] = PlayerBounce,
[PLAYER_08070E9C] = sub_08070E9C,
[PLAYER_ITEMGET] = PlayerItemGet,
[PLAYER_MINISH] = PlayerMinish,
[PLAYER_MINISHDIE] = PlayerMinishDie,
[PLAYER_08071DB8] = sub_08071DB8,
[PLAYER_EMPTYBOTTLE] = PlayerEmptyBottle,
[PLAYER_FROZEN] = PlayerFrozen,
[PLAYER_0807204C] = sub_0807204C,
[PLAYER_080720DC] = sub_080720DC,
[PLAYER_PULL] = PlayerPull,
[PLAYER_LAVA] = PlayerLava,
[PLAYER_WARP] = PlayerWarp,
[PLAYER_08072454] = sub_08072454,
[PLAYER_DROWN] = PlayerDrown,
[PLAYER_USEPORTAL] = PlayerUsePortal,
[PLAYER_TALKEZLO] = PlayerTalkEzlo,
[PLAYER_ROOMTRANSITION] = PlayerRoomTransition,
[PLAYER_ROLL] = PlayerRoll,
[PLAYER_080728AC] = sub_080728AC,
[PLAYER_INHOLE] = PlayerInHole,
[PLAYER_08072C9C] = sub_08072C9C,
[PLAYER_08074C44] = sub_08074C44,
[PLAYER_08072F34] = sub_08072F34,
[PLAYER_USEENTRANCE] = PlayerUseEntrance,
[PLAYER_PARACHUTE] = PlayerParachute,
};
+2 -2
View File
@@ -855,7 +855,7 @@ void ScriptCommand_BuyItem(Entity* entity, ScriptExecutionContext* context) {
}
void ScriptCommand_0807E48C(Entity* entity, ScriptExecutionContext* context) {
context->condition = sub_080544DC(context->scriptInstructionPointer[1]);
context->condition = GetBottleContaining(context->scriptInstructionPointer[1]);
gActiveScriptInfo.flags |= 1;
}
@@ -1087,7 +1087,7 @@ void ScriptCommand_0807E8E4(Entity* entity, ScriptExecutionContext* context) {
void ScriptCommand_0807E908(Entity* entity, ScriptExecutionContext* context) {
entity->action = context->scriptInstructionPointer[1];
entity->previousActionFlag = 0;
entity->subAction = 0;
}
void ScriptCommand_SetIntVariable(Entity* entity, ScriptExecutionContext* context) {