mirror of https://github.com/zeldaret/tmc.git
				
				
				
			
						commit
						3f1160c249
					
				
							
								
								
									
										2487
									
								
								asm/code_08070698.s
								
								
								
								
							
							
						
						
									
										2487
									
								
								asm/code_08070698.s
								
								
								
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| 
						 | 
				
			
			@ -0,0 +1,222 @@
 | 
			
		|||
    .syntax unified
 | 
			
		||||
	push {r4, r5, lr}
 | 
			
		||||
	adds r4, r0, #0
 | 
			
		||||
	bl UpdateAnimationSingleFrame
 | 
			
		||||
	movs r2, #0xc
 | 
			
		||||
	rsbs r2, r2, #0
 | 
			
		||||
	adds r0, r4, #0
 | 
			
		||||
	movs r1, #0
 | 
			
		||||
	bl sub_0806F854
 | 
			
		||||
	ldrb r0, [r4, #0xe]
 | 
			
		||||
	cmp r0, #0
 | 
			
		||||
	beq _08072D7A
 | 
			
		||||
	adds r0, r4, #0
 | 
			
		||||
	bl sub_0806F69C
 | 
			
		||||
	ldrb r0, [r4, #0xe]
 | 
			
		||||
	subs r0, #1
 | 
			
		||||
	b _08072E80
 | 
			
		||||
_08072D7A:
 | 
			
		||||
	adds r0, r4, #0
 | 
			
		||||
	bl sub_0806F730
 | 
			
		||||
	adds r1, r4, #0
 | 
			
		||||
	adds r1, #0x38
 | 
			
		||||
	ldrb r1, [r1]
 | 
			
		||||
	bl GetTileType
 | 
			
		||||
	adds r2, r0, #0
 | 
			
		||||
	ldrb r5, [r4, #0xf]
 | 
			
		||||
	cmp r5, #1
 | 
			
		||||
	beq _08072DD0
 | 
			
		||||
	cmp r5, #1
 | 
			
		||||
	bgt _08072D9C
 | 
			
		||||
	cmp r5, #0
 | 
			
		||||
	beq _08072DA6
 | 
			
		||||
	b _08072E6C
 | 
			
		||||
_08072D9C:
 | 
			
		||||
	cmp r5, #2
 | 
			
		||||
	beq _08072DFA
 | 
			
		||||
	cmp r5, #3
 | 
			
		||||
	beq _08072E30
 | 
			
		||||
	b _08072E6C
 | 
			
		||||
_08072DA6:
 | 
			
		||||
	ldr r1, _08072DC8 @ =gUnk_0811BBD4
 | 
			
		||||
	ldr r0, _08072DCC @ =gPlayerEntity
 | 
			
		||||
	ldrb r0, [r0, #0x14]
 | 
			
		||||
	lsrs r0, r0, #1
 | 
			
		||||
	lsls r0, r0, #2
 | 
			
		||||
	adds r0, r0, r1
 | 
			
		||||
	ldr r1, [r0]
 | 
			
		||||
	adds r0, r2, #0
 | 
			
		||||
	bl sub_08007DD6
 | 
			
		||||
	cmp r0, #0
 | 
			
		||||
	beq _08072E6C
 | 
			
		||||
	movs r0, #1
 | 
			
		||||
	strb r0, [r4, #0xe]
 | 
			
		||||
	strb r0, [r4, #0xf]
 | 
			
		||||
	b _08072E6C
 | 
			
		||||
	.align 2, 0
 | 
			
		||||
_08072DC8: .4byte gUnk_0811BBD4
 | 
			
		||||
_08072DCC: .4byte gPlayerEntity
 | 
			
		||||
_08072DD0:
 | 
			
		||||
	ldr r1, _08072DEC @ =gUnk_0811BBD4
 | 
			
		||||
	ldr r0, _08072DF0 @ =gPlayerEntity
 | 
			
		||||
	ldrb r0, [r0, #0x14]
 | 
			
		||||
	lsrs r0, r0, #1
 | 
			
		||||
	lsls r0, r0, #2
 | 
			
		||||
	adds r0, r0, r1
 | 
			
		||||
	ldr r1, [r0]
 | 
			
		||||
	adds r0, r2, #0
 | 
			
		||||
	bl sub_08007DD6
 | 
			
		||||
	cmp r0, #0
 | 
			
		||||
	beq _08072DF4
 | 
			
		||||
	strb r5, [r4, #0xe]
 | 
			
		||||
	b _08072E6C
 | 
			
		||||
	.align 2, 0
 | 
			
		||||
_08072DEC: .4byte gUnk_0811BBD4
 | 
			
		||||
_08072DF0: .4byte gPlayerEntity
 | 
			
		||||
_08072DF4:
 | 
			
		||||
	movs r0, #2
 | 
			
		||||
	strb r0, [r4, #0xf]
 | 
			
		||||
	b _08072E6C
 | 
			
		||||
_08072DFA:
 | 
			
		||||
	ldrb r0, [r4, #0x14]
 | 
			
		||||
	movs r5, #4
 | 
			
		||||
	eors r0, r5
 | 
			
		||||
	strb r0, [r4, #0x14]
 | 
			
		||||
	ldr r1, _08072E28 @ =gUnk_0811BBD4
 | 
			
		||||
	ldr r0, _08072E2C @ =gPlayerEntity
 | 
			
		||||
	ldrb r0, [r0, #0x14]
 | 
			
		||||
	lsrs r0, r0, #1
 | 
			
		||||
	lsls r0, r0, #2
 | 
			
		||||
	adds r0, r0, r1
 | 
			
		||||
	ldr r1, [r0]
 | 
			
		||||
	adds r0, r2, #0
 | 
			
		||||
	bl sub_08007DD6
 | 
			
		||||
	cmp r0, #0
 | 
			
		||||
	beq _08072E22
 | 
			
		||||
	movs r0, #1
 | 
			
		||||
	strb r0, [r4, #0xe]
 | 
			
		||||
	movs r0, #3
 | 
			
		||||
	strb r0, [r4, #0xf]
 | 
			
		||||
_08072E22:
 | 
			
		||||
	ldrb r0, [r4, #0x14]
 | 
			
		||||
	eors r0, r5
 | 
			
		||||
	b _08072E6A
 | 
			
		||||
	.align 2, 0
 | 
			
		||||
_08072E28: .4byte gUnk_0811BBD4
 | 
			
		||||
_08072E2C: .4byte gPlayerEntity
 | 
			
		||||
_08072E30:
 | 
			
		||||
	ldrb r0, [r4, #0x14]
 | 
			
		||||
	movs r1, #4
 | 
			
		||||
	eors r0, r1
 | 
			
		||||
	strb r0, [r4, #0x14]
 | 
			
		||||
	ldr r1, _08072E58 @ =gUnk_0811BBD4
 | 
			
		||||
	ldr r0, _08072E5C @ =gPlayerEntity
 | 
			
		||||
	ldrb r0, [r0, #0x14]
 | 
			
		||||
	lsrs r0, r0, #1
 | 
			
		||||
	lsls r0, r0, #2
 | 
			
		||||
	adds r0, r0, r1
 | 
			
		||||
	ldr r1, [r0]
 | 
			
		||||
	adds r0, r2, #0
 | 
			
		||||
	bl sub_08007DD6
 | 
			
		||||
	cmp r0, #0
 | 
			
		||||
	beq _08072E60
 | 
			
		||||
	movs r0, #1
 | 
			
		||||
	strb r0, [r4, #0xe]
 | 
			
		||||
	b _08072E64
 | 
			
		||||
	.align 2, 0
 | 
			
		||||
_08072E58: .4byte gUnk_0811BBD4
 | 
			
		||||
_08072E5C: .4byte gPlayerEntity
 | 
			
		||||
_08072E60:
 | 
			
		||||
	movs r0, #4
 | 
			
		||||
	strb r0, [r4, #0xf]
 | 
			
		||||
_08072E64:
 | 
			
		||||
	ldrb r0, [r4, #0x14]
 | 
			
		||||
	movs r1, #4
 | 
			
		||||
	eors r0, r1
 | 
			
		||||
_08072E6A:
 | 
			
		||||
	strb r0, [r4, #0x14]
 | 
			
		||||
_08072E6C:
 | 
			
		||||
	ldrb r0, [r4, #0xe]
 | 
			
		||||
	cmp r0, #0
 | 
			
		||||
	beq _08072E7A
 | 
			
		||||
	adds r0, r4, #0
 | 
			
		||||
	bl sub_0806F69C
 | 
			
		||||
	b _08072E7E
 | 
			
		||||
_08072E7A:
 | 
			
		||||
	bl sub_08079E08
 | 
			
		||||
_08072E7E:
 | 
			
		||||
	movs r0, #0
 | 
			
		||||
_08072E80:
 | 
			
		||||
	strb r0, [r4, #0xe]
 | 
			
		||||
	movs r1, #0x80
 | 
			
		||||
	lsls r1, r1, #6
 | 
			
		||||
	adds r0, r4, #0
 | 
			
		||||
	bl sub_08003FC4
 | 
			
		||||
	cmp r0, #0
 | 
			
		||||
	bne _08072F10
 | 
			
		||||
	ldrb r1, [r4, #0x10]
 | 
			
		||||
	movs r0, #0x80
 | 
			
		||||
	orrs r0, r1
 | 
			
		||||
	strb r0, [r4, #0x10]
 | 
			
		||||
	adds r0, r4, #0
 | 
			
		||||
	adds r0, #0x38
 | 
			
		||||
	ldrb r0, [r0]
 | 
			
		||||
	cmp r0, #1
 | 
			
		||||
	bne _08072EAA
 | 
			
		||||
	adds r0, r4, #0
 | 
			
		||||
	bl sub_0800455E
 | 
			
		||||
	b _08072EB0
 | 
			
		||||
_08072EAA:
 | 
			
		||||
	adds r0, r4, #0
 | 
			
		||||
	bl sub_08004542
 | 
			
		||||
_08072EB0:
 | 
			
		||||
	adds r0, r4, #0
 | 
			
		||||
	movs r1, #7
 | 
			
		||||
	bl sub_08008790
 | 
			
		||||
	ldr r5, _08072EDC @ =gPlayerState
 | 
			
		||||
	ldrb r0, [r5, #0x14]
 | 
			
		||||
	cmp r0, #0
 | 
			
		||||
	beq _08072EE0
 | 
			
		||||
	bl sub_08008B22
 | 
			
		||||
	cmp r0, #0
 | 
			
		||||
	beq _08072F10
 | 
			
		||||
	movs r0, #7
 | 
			
		||||
	strb r0, [r5, #0x11]
 | 
			
		||||
	ldr r0, [r5, #0x30]
 | 
			
		||||
	movs r1, #0x80
 | 
			
		||||
	ands r0, r1
 | 
			
		||||
	cmp r0, #0
 | 
			
		||||
	bne _08072F10
 | 
			
		||||
	bl sub_080791BC
 | 
			
		||||
	b _08072F10
 | 
			
		||||
	.align 2, 0
 | 
			
		||||
_08072EDC: .4byte gPlayerState
 | 
			
		||||
_08072EE0:
 | 
			
		||||
	ldr r0, [r5, #0x30]
 | 
			
		||||
	movs r1, #8
 | 
			
		||||
	ands r0, r1
 | 
			
		||||
	cmp r0, #0
 | 
			
		||||
	beq _08072EF4
 | 
			
		||||
	ldr r0, _08072EF0 @ =0x00000424
 | 
			
		||||
	b _08072EF8
 | 
			
		||||
	.align 2, 0
 | 
			
		||||
_08072EF0: .4byte 0x00000424
 | 
			
		||||
_08072EF4:
 | 
			
		||||
	movs r0, #0x82
 | 
			
		||||
	lsls r0, r0, #4
 | 
			
		||||
_08072EF8:
 | 
			
		||||
	strh r0, [r5, #8]
 | 
			
		||||
	movs r1, #0
 | 
			
		||||
	movs r0, #6
 | 
			
		||||
	strb r0, [r4, #0xe]
 | 
			
		||||
	movs r0, #3
 | 
			
		||||
	strb r0, [r4, #0xd]
 | 
			
		||||
	adds r0, r4, #0
 | 
			
		||||
	adds r0, #0x42
 | 
			
		||||
	strb r1, [r0]
 | 
			
		||||
	movs r0, #0x7d
 | 
			
		||||
	bl SoundReq
 | 
			
		||||
_08072F10:
 | 
			
		||||
	pop {r4, r5, pc}
 | 
			
		||||
	.align 2, 0
 | 
			
		||||
    .syntax divided
 | 
			
		||||
| 
						 | 
				
			
			@ -659,7 +659,6 @@ SECTIONS {
 | 
			
		|||
        asm/playerItem/playerItemPacciCane.o(.text);
 | 
			
		||||
        asm/code_0807059C.o(.text);
 | 
			
		||||
        src/player.o(.text);
 | 
			
		||||
        asm/code_08070698.o(.text);
 | 
			
		||||
        asm/stairsInteract.o(.text);
 | 
			
		||||
        asm/code_080732D0.o(.text);
 | 
			
		||||
        asm/item/itemDebug.o(.text);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										910
									
								
								src/player.c
								
								
								
								
							
							
						
						
									
										910
									
								
								src/player.c
								
								
								
								
							| 
						 | 
				
			
			@ -8,6 +8,7 @@
 | 
			
		|||
#include "save.h"
 | 
			
		||||
#include "game.h"
 | 
			
		||||
#include "functions.h"
 | 
			
		||||
#include "object.h"
 | 
			
		||||
 | 
			
		||||
static void (*const sPlayerActions[])(Entity*);
 | 
			
		||||
extern void (*const gUnk_0811BA60[])(Entity*);
 | 
			
		||||
| 
						 | 
				
			
			@ -40,6 +41,32 @@ extern void sub_0807A298();
 | 
			
		|||
extern u32 sub_08079B24();
 | 
			
		||||
extern void sub_08079708();
 | 
			
		||||
extern void sub_080792D8();
 | 
			
		||||
extern Entity* CreatePlayerBomb();
 | 
			
		||||
extern void sub_08072008();
 | 
			
		||||
extern void sub_080791BC();
 | 
			
		||||
extern void sub_08072168();
 | 
			
		||||
extern u32 sub_0806F854();
 | 
			
		||||
extern u32 sub_08019840();
 | 
			
		||||
extern void sub_08072260();
 | 
			
		||||
extern void sub_08079744();
 | 
			
		||||
extern void sub_0807AE20();
 | 
			
		||||
extern u32 sub_0807A894();
 | 
			
		||||
extern u32 sub_080797C4();
 | 
			
		||||
extern u32 Random();
 | 
			
		||||
extern u32 sub_0807AC54();
 | 
			
		||||
extern void sub_0800892E();
 | 
			
		||||
extern void sub_08078F24();
 | 
			
		||||
extern void sub_0807B068();
 | 
			
		||||
extern u32 sub_080001DA();
 | 
			
		||||
extern void sub_08072A60();
 | 
			
		||||
extern u32 sub_0807A2F8();
 | 
			
		||||
extern u32 sub_08052620();
 | 
			
		||||
extern u32 sub_0806F730();
 | 
			
		||||
extern u32 sub_08007DD6();
 | 
			
		||||
extern u32 sub_0807A1E8();
 | 
			
		||||
extern void sub_08073094();
 | 
			
		||||
extern void sub_08074808();
 | 
			
		||||
extern void sub_0805E4E0();
 | 
			
		||||
 | 
			
		||||
typedef struct {
 | 
			
		||||
    u8 frame;
 | 
			
		||||
| 
						 | 
				
			
			@ -746,7 +773,7 @@ void sub_0807193C(Entity* this) {
 | 
			
		|||
    UpdateAnimationSingleFrame(this);
 | 
			
		||||
    if (this->frames.all & 0x80) {
 | 
			
		||||
        this->subAction++;
 | 
			
		||||
        child = CreateObjectWithParent(this, 6, 0, 0);
 | 
			
		||||
        child = CreateObjectWithParent(this, OBJECT_6, 0, 0);
 | 
			
		||||
        this->attachedEntity = child;
 | 
			
		||||
        if (child != NULL) {
 | 
			
		||||
            if (this->animationState == 2)
 | 
			
		||||
| 
						 | 
				
			
			@ -1027,6 +1054,887 @@ void sub_08071E74(Entity* this) {
 | 
			
		|||
        sub_080791BC();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern void (*const gUnk_0811BB48[])(Entity*);
 | 
			
		||||
 | 
			
		||||
void PlayerEmptyBottle(Entity* this) {
 | 
			
		||||
    gUnk_0811BB48[this->subAction](this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08071EB0(Entity* this) {
 | 
			
		||||
    Entity* ent;
 | 
			
		||||
 | 
			
		||||
    ResetPlayer();
 | 
			
		||||
    ent = CreatePlayerBomb(this, 0xe);
 | 
			
		||||
    if (ent != NULL) {
 | 
			
		||||
        ent->field_0x68.HALF.LO = gPlayerState.field_0x38;
 | 
			
		||||
        this->subAction++;
 | 
			
		||||
        switch (gPlayerState.field_0x38) {
 | 
			
		||||
            case 0x20:
 | 
			
		||||
                gPlayerState.field_0x8 = 0x614;
 | 
			
		||||
                break;
 | 
			
		||||
            case 0x21 ... 0x25:
 | 
			
		||||
                gPlayerState.field_0x8 = 0x2df;
 | 
			
		||||
                break;
 | 
			
		||||
            default:
 | 
			
		||||
                gPlayerState.field_0x8 = 0x610;
 | 
			
		||||
                sub_0807CAA0(gPlayerState.field_0x38, 2);
 | 
			
		||||
                break;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08071F14(Entity* this) {
 | 
			
		||||
    UpdateAnimationSingleFrame(this);
 | 
			
		||||
    if (this->frames.all & 0x80) {
 | 
			
		||||
        gPlayerState.field_0x2c = NULL;
 | 
			
		||||
        sub_0807921C();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern void (*const gUnk_0811BB50[])(Entity*);
 | 
			
		||||
 | 
			
		||||
void PlayerFrozen(Entity* this) {
 | 
			
		||||
    gUnk_0811BB50[this->subAction](this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08071F50(Entity* this) {
 | 
			
		||||
    this->flags &= ~0x80;
 | 
			
		||||
    this->actionDelay = 0x78;
 | 
			
		||||
    this->subAction++;
 | 
			
		||||
    gPlayerState.field_0x8 = 0x294;
 | 
			
		||||
    sub_08077B20();
 | 
			
		||||
    SoundReq(SFX_195);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08071F80(Entity* this) {
 | 
			
		||||
    if (sub_08003FC4(this, 0x2000) == 0) {
 | 
			
		||||
        UpdateSpriteForCollisionLayer(this);
 | 
			
		||||
        gPlayerState.jumpStatus = 0;
 | 
			
		||||
        if (gPlayerState.field_0x14 == 0) {
 | 
			
		||||
            if (sub_08079D48() == 0) {
 | 
			
		||||
                sub_08072008(this);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    if (sub_08079B24() == 0) {
 | 
			
		||||
        sub_08079708(this);
 | 
			
		||||
    } else {
 | 
			
		||||
        if (gPlayerState.flags.all & 0x800) {
 | 
			
		||||
            if (sub_0807953C() != 0) {
 | 
			
		||||
                this->actionDelay -= 3;
 | 
			
		||||
                this->spriteOffsetX = 2;
 | 
			
		||||
            } else {
 | 
			
		||||
                this->spriteOffsetX = 0;
 | 
			
		||||
            }
 | 
			
		||||
            if ((s8)this->actionDelay > 0) {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    sub_08072008(this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072008(Entity* this) {
 | 
			
		||||
    this->iframes = 160;
 | 
			
		||||
    this->field_0x42 = 0;
 | 
			
		||||
    this->flags |= 0x80;
 | 
			
		||||
    this->spriteOffsetX = 0;
 | 
			
		||||
    gPlayerState.flags.all &= ~(0x800 | 0x1);
 | 
			
		||||
    CreateFx(this, 0xd, 0);
 | 
			
		||||
    sub_080791BC();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern void (*const gUnk_0811BB58[])(Entity*);
 | 
			
		||||
 | 
			
		||||
void sub_0807204C(Entity* this) {
 | 
			
		||||
    gUnk_0811BB58[this->subAction](this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072064(Entity* this) {
 | 
			
		||||
    this->subAction = 1;
 | 
			
		||||
    this->flags &= ~0x80;
 | 
			
		||||
    this->actionDelay = gPlayerState.field_0x3a;
 | 
			
		||||
    gPlayerState.field_0x8 = gPlayerState.field_0x38 | (gPlayerState.field_0x39 << 8);
 | 
			
		||||
    ResetPlayer();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072098(Entity* this) {
 | 
			
		||||
    UpdateAnimationSingleFrame(this);
 | 
			
		||||
    if (this->actionDelay != 0)
 | 
			
		||||
        if (--this->actionDelay != 0xFF)
 | 
			
		||||
            return;
 | 
			
		||||
        else
 | 
			
		||||
            ;
 | 
			
		||||
    else if ((this->frames.all & 0x80) == 0)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    if (this->currentHealth != 0)
 | 
			
		||||
        this->flags |= 0x80;
 | 
			
		||||
    sub_080791BC();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern void (*const gUnk_0811BB60[])(Entity*);
 | 
			
		||||
 | 
			
		||||
void sub_080720DC(Entity* this) {
 | 
			
		||||
    if (sub_08078EFC() == 0)
 | 
			
		||||
        gUnk_0811BB60[this->subAction](this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072100(Entity* this) {
 | 
			
		||||
    this->spriteSettings.b.draw = 3;
 | 
			
		||||
    this->speed = 0x140;
 | 
			
		||||
    this->hitbox = &gUnk_08114F88;
 | 
			
		||||
    this->actionDelay = gPlayerState.field_0x38;
 | 
			
		||||
    this->subAction = 1;
 | 
			
		||||
    this->flags &= ~0x80;
 | 
			
		||||
    if (gPlayerState.field_0x39)
 | 
			
		||||
        this->direction = 0xff;
 | 
			
		||||
 | 
			
		||||
    if ((gPlayerState.flags.all & 8)) {
 | 
			
		||||
        gPlayerState.field_0x8 = 0x404;
 | 
			
		||||
    } else {
 | 
			
		||||
        gPlayerState.field_0x8 = 0x104;
 | 
			
		||||
    }
 | 
			
		||||
    ResetPlayer();
 | 
			
		||||
    sub_08072168(this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072168(Entity* this) {
 | 
			
		||||
    u32 i;
 | 
			
		||||
 | 
			
		||||
    UpdateAnimationSingleFrame(this);
 | 
			
		||||
    i = (u16)sub_0806F854(this, 0, -12) ? 0x4000 : 0x2000;
 | 
			
		||||
    sub_08003FC4(this, i);
 | 
			
		||||
    if (gPlayerState.field_0x3a) {
 | 
			
		||||
        sub_0806F69C(this);
 | 
			
		||||
    } else {
 | 
			
		||||
        sub_08079E08();
 | 
			
		||||
    }
 | 
			
		||||
    gPlayerState.field_0xd = this->direction;
 | 
			
		||||
    sub_08019840();
 | 
			
		||||
    if (--this->actionDelay == 0xff) {
 | 
			
		||||
        this->field_0x42 = 0;
 | 
			
		||||
        this->flags |= 0x80;
 | 
			
		||||
        UpdateSpriteForCollisionLayer(this);
 | 
			
		||||
        sub_080791BC();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern void (*const gUnk_0811BB68[])(Entity*);
 | 
			
		||||
 | 
			
		||||
void PlayerPull(Entity* this) {
 | 
			
		||||
    gPlayerState.field_0xa8 = 0x1a;
 | 
			
		||||
    gUnk_0811BB68[this->subAction](this);
 | 
			
		||||
    gUnk_0200AF00.filler25[9] = 8;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072214(Entity* this) {
 | 
			
		||||
    this->subAction = 1;
 | 
			
		||||
    this->speed = 128;
 | 
			
		||||
    this->actionDelay = gPlayerState.field_0x38;
 | 
			
		||||
    this->direction = (this->animationState ^ 4) << 2;
 | 
			
		||||
    if (!(gPlayerState.flags.all & 8)) {
 | 
			
		||||
        gPlayerState.field_0x8 = 0x34c;
 | 
			
		||||
    } else {
 | 
			
		||||
        gPlayerState.field_0x8 = 0x944;
 | 
			
		||||
    }
 | 
			
		||||
    gPlayerState.flags.all |= 1;
 | 
			
		||||
    sub_08072260(this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072260(Entity* this) {
 | 
			
		||||
    gPlayerState.field_0x80 = 0;
 | 
			
		||||
    sub_08079E08();
 | 
			
		||||
    UpdateAnimationSingleFrame(this);
 | 
			
		||||
    if (--this->actionDelay == 0) {
 | 
			
		||||
        gPlayerState.flags.all &= ~0x1;
 | 
			
		||||
        if (!(gPlayerState.flags.all & 8)) {
 | 
			
		||||
            gPlayerState.field_0x8 = 0x34c;
 | 
			
		||||
        } else {
 | 
			
		||||
            gPlayerState.field_0x8 = 0x944;
 | 
			
		||||
        }
 | 
			
		||||
        this->field_0x42 = 0;
 | 
			
		||||
        sub_080791BC();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern void (*const gUnk_0811BB70[])(Entity*);
 | 
			
		||||
 | 
			
		||||
void PlayerLava(Entity* this) {
 | 
			
		||||
    gPlayerState.field_0xa8 = 10;
 | 
			
		||||
    gUnk_0811BB70[this->subAction](this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_080722DC(Entity* this) {
 | 
			
		||||
    Entity* ent;
 | 
			
		||||
 | 
			
		||||
    this->flags &= ~0x80;
 | 
			
		||||
    if (!(gPlayerState.flags.all & 0x80)) {
 | 
			
		||||
        this->subAction = 1;
 | 
			
		||||
        this->field_0x20 = 0x28000;
 | 
			
		||||
        ent = CreateObject(OBJECT_42, 0x80, 0);
 | 
			
		||||
        if (ent != NULL) {
 | 
			
		||||
            ent->attachedEntity = this;
 | 
			
		||||
        }
 | 
			
		||||
        gPlayerState.field_0x8 = 0x114;
 | 
			
		||||
    } else {
 | 
			
		||||
        this->spriteSettings.b.draw = 0;
 | 
			
		||||
        this->subAction = 3;
 | 
			
		||||
        this->field_0x42 = 10;
 | 
			
		||||
    }
 | 
			
		||||
    gPlayerState.flags.all |= (0x400 | 0x1);
 | 
			
		||||
    ResetPlayer();
 | 
			
		||||
    SoundReq(SFX_124);
 | 
			
		||||
    SoundReq(SFX_PLY_VO6);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072354(Entity* this) {
 | 
			
		||||
    sub_0806F854(this, 0, -12);
 | 
			
		||||
    UpdateAnimationSingleFrame(this);
 | 
			
		||||
    sub_08079744(this);
 | 
			
		||||
    if (sub_08003FC4(this, 0x2000))
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    this->spritePriority.b1 = 0;
 | 
			
		||||
    this->field_0x42 = 0;
 | 
			
		||||
    this->subAction = 2;
 | 
			
		||||
    this->actionDelay = 0x3c;
 | 
			
		||||
    gPlayerState.field_0x8 = 0x2c1;
 | 
			
		||||
    gPlayerState.flags.all &= ~0x400;
 | 
			
		||||
    UpdateSpriteForCollisionLayer(this);
 | 
			
		||||
    CreateFx(this, 0xc, 0);
 | 
			
		||||
    SoundReq(SFX_1A6);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_080723D0(Entity* this) {
 | 
			
		||||
    UpdateAnimationSingleFrame(this);
 | 
			
		||||
    if (--this->actionDelay == 0xff) {
 | 
			
		||||
        this->spritePriority.b1 = 1;
 | 
			
		||||
        this->iframes = 0x14;
 | 
			
		||||
        ModHealth(-2);
 | 
			
		||||
        RespawnPlayer();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_0807240C(Entity* this) {
 | 
			
		||||
    if (--this->field_0x42 == 0xff) {
 | 
			
		||||
        this->spriteSettings.b.draw = 3;
 | 
			
		||||
        this->iframes = 0x14;
 | 
			
		||||
        gPlayerState.flags.all &= ~0x400;
 | 
			
		||||
        ModHealth(-2);
 | 
			
		||||
        RespawnPlayer();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern void (*const gUnk_0811BB80[])(Entity*);
 | 
			
		||||
 | 
			
		||||
void sub_08072454(Entity* this) {
 | 
			
		||||
    gUnk_0811BB80[this->subAction](this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_0807246C(Entity* this) {
 | 
			
		||||
    this->subAction = 1;
 | 
			
		||||
    this->actionDelay = gPlayerState.field_0x38;
 | 
			
		||||
    gPlayerState.field_0x8 = 0x3c0;
 | 
			
		||||
    SoundReq(0x7b);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072490(Entity* this) {
 | 
			
		||||
    if (--this->actionDelay != 0xff) {
 | 
			
		||||
        UpdateAnimationSingleFrame(this);
 | 
			
		||||
        sub_08079E08();
 | 
			
		||||
    } else {
 | 
			
		||||
        this->iframes = 60;
 | 
			
		||||
        ModHealth(-8);
 | 
			
		||||
        sub_080791D0();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern void (*const gUnk_0811BB88[])(Entity*);
 | 
			
		||||
 | 
			
		||||
void PlayerRoomTransition(Entity* this) {
 | 
			
		||||
    gUnk_0811BB88[this->subAction](this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_080724DC(Entity* this) {
 | 
			
		||||
    this->field_0x42 = 0;
 | 
			
		||||
    sub_0807A108();
 | 
			
		||||
    if (sub_080002B8(this) != 0x29) {
 | 
			
		||||
        if ((gPlayerState.field_0x82[7] == 0) && (gPlayerState.swimState != 0)) {
 | 
			
		||||
            sub_0807AE20(this);
 | 
			
		||||
        }
 | 
			
		||||
        if (gRoomControls.unk2 == 0) {
 | 
			
		||||
            this->scriptedScene = this->scriptedScene2;
 | 
			
		||||
            sub_080728AC(this);
 | 
			
		||||
        } else if (gPlayerState.field_0x1c == 0) {
 | 
			
		||||
            UpdateAnimationSingleFrame(this);
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        this->spriteSettings.b.draw = 3;
 | 
			
		||||
        this->subAction = 1;
 | 
			
		||||
        if (gRoomVars.filler[0] == 0) {
 | 
			
		||||
            if (gPlayerState.flags.all & 0x80) {
 | 
			
		||||
                gPlayerState.field_0x8 = 0xc18;
 | 
			
		||||
            } else {
 | 
			
		||||
                gPlayerState.field_0x8 = 0x104;
 | 
			
		||||
            }
 | 
			
		||||
            this->direction = this->animationState << 2;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_0807258C(Entity* this) {
 | 
			
		||||
    if (gRoomControls.unk2 == 0) {
 | 
			
		||||
        if (sub_0807A894(this) == 0x29) {
 | 
			
		||||
            sub_08079E08();
 | 
			
		||||
            if (sub_080797C4() != 0) {
 | 
			
		||||
                gPlayerState.startPosX = gPlayerEntity.x.HALF.HI;
 | 
			
		||||
                gPlayerState.startPosY = gPlayerEntity.y.HALF.HI;
 | 
			
		||||
                this->scriptedScene = this->scriptedScene2;
 | 
			
		||||
                sub_080728AC(this);
 | 
			
		||||
            } else {
 | 
			
		||||
                UpdateAnimationSingleFrame(this);
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            gPlayerState.startPosX = gPlayerEntity.x.HALF.HI;
 | 
			
		||||
            gPlayerState.startPosY = gPlayerEntity.y.HALF.HI;
 | 
			
		||||
            this->scriptedScene = this->scriptedScene2;
 | 
			
		||||
            sub_080728AC(this);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    if ((gPlayerState.field_0x82[7] == 0) && (gPlayerState.swimState != 0)) {
 | 
			
		||||
        sub_0807AE20(this);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern void (*const gUnk_0811BB90[])(Entity*);
 | 
			
		||||
 | 
			
		||||
void PlayerRoll(Entity* this) {
 | 
			
		||||
    gPlayerState.field_0xa8 = 9;
 | 
			
		||||
    gUnk_0811BB90[this->subAction](this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072650(Entity* this) {
 | 
			
		||||
    u32 temp;
 | 
			
		||||
 | 
			
		||||
    if ((gPlayerState.flags.all & 0x200000) == 0) {
 | 
			
		||||
        sub_0806F948(&gPlayerEntity);
 | 
			
		||||
        this->direction = this->animationState << 2;
 | 
			
		||||
    }
 | 
			
		||||
    this->subAction = 1;
 | 
			
		||||
    this->actionDelay = 0;
 | 
			
		||||
    ResetPlayer();
 | 
			
		||||
    temp = gPlayerState.flags.all;
 | 
			
		||||
    if (gPlayerState.flags.all & 0x80) {
 | 
			
		||||
        this->spritePriority.b1 = 0;
 | 
			
		||||
        gPlayerState.field_0x8 = 0xc08;
 | 
			
		||||
    } else {
 | 
			
		||||
        *(u8*)&this->field_0x40 = 0x1e;
 | 
			
		||||
        if (temp & 8) {
 | 
			
		||||
            gPlayerState.field_0x8 = 0x438;
 | 
			
		||||
        } else {
 | 
			
		||||
            gPlayerState.field_0x8 = 0x2ac;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    gPlayerState.flags.all |= 0x40000;
 | 
			
		||||
    if (Random() & 1) {
 | 
			
		||||
        SoundReq(SFX_PLY_VO5);
 | 
			
		||||
    } else {
 | 
			
		||||
        SoundReq(SFX_PLY_VO4);
 | 
			
		||||
    }
 | 
			
		||||
    SoundReq(SFX_7E);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_080726F4(Entity* this) {
 | 
			
		||||
    if (((gPlayerState.flags.all & (0x40000 | 0x80000)) != 0x40000) ||
 | 
			
		||||
        (!(gPlayerState.flags.all & 0x200000) && (this->iframes != 0) && (this->bitfield & 0x80))) {
 | 
			
		||||
        gPlayerState.flags.all &= ~0x40000;
 | 
			
		||||
        if (!sub_08078EFC())
 | 
			
		||||
            sub_080728AC(this);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this->direction = (this->animationState & 6) << 2;
 | 
			
		||||
    if (((gPlayerState.flags.all & 0x80) == 0) && (--this->actionDelay == 0xff)) {
 | 
			
		||||
        CreateFx(&gPlayerEntity, 0x11, 0x40);
 | 
			
		||||
        this->actionDelay = 4;
 | 
			
		||||
    }
 | 
			
		||||
    if ((gPlayerState.flags.all & 2) == 0) {
 | 
			
		||||
        sub_0807A1B8();
 | 
			
		||||
    }
 | 
			
		||||
    if (sub_08078EFC()) {
 | 
			
		||||
        gPlayerState.flags.all &= ~0x40000;
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if ((gPlayerState.flags.all & 0x80000) != 0) {
 | 
			
		||||
        gPlayerState.flags.all &= ~0x40000;
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (sub_0807AC54(this)) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (gPlayerState.flags.all & 0x250) {
 | 
			
		||||
        gPlayerState.flags.all &= ~0x40000;
 | 
			
		||||
        sub_080728AC(this);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (gPlayerState.field_0x10[2] == 0x17) {
 | 
			
		||||
        sub_0800892E(this);
 | 
			
		||||
    } else {
 | 
			
		||||
        switch (this->frames.all & 0xf) {
 | 
			
		||||
            case 0:
 | 
			
		||||
                if ((this->frames.all & 0xf) == 0) {
 | 
			
		||||
                    this->speed = 0x200;
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            case 1:
 | 
			
		||||
                this->speed += 0x20;
 | 
			
		||||
                break;
 | 
			
		||||
            case 2:
 | 
			
		||||
                this->speed = 0x300;
 | 
			
		||||
                break;
 | 
			
		||||
            case 3:
 | 
			
		||||
                this->speed = 0;
 | 
			
		||||
                break;
 | 
			
		||||
        }
 | 
			
		||||
        sub_08078F24();
 | 
			
		||||
        sub_08079E08();
 | 
			
		||||
    }
 | 
			
		||||
    if (((this->frames.all & 0x10) == 0) && ((gPlayerState.flags.all & 0x80) == 0)) {
 | 
			
		||||
        *(u8*)&this->field_0x40 = 0;
 | 
			
		||||
    }
 | 
			
		||||
    if ((this->frames.all & 0x40) != 0) {
 | 
			
		||||
        sub_08077698(this);
 | 
			
		||||
    }
 | 
			
		||||
    if (((this->frames.all & 0x80) != 0) || (gPlayerState.field_0x3[1] != 0)) {
 | 
			
		||||
        sub_080791D0();
 | 
			
		||||
    }
 | 
			
		||||
    if ((this->frames.all & 0x80) != 0) {
 | 
			
		||||
        gPlayerState.flags.all &= ~(0x200000 | 0x40000);
 | 
			
		||||
    }
 | 
			
		||||
    UpdateAnimationSingleFrame(this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_080728AC(Entity* this) {
 | 
			
		||||
    sub_08079938();
 | 
			
		||||
    if (gPlayerState.flags.all & 0x80)
 | 
			
		||||
        sub_0807B068(this);
 | 
			
		||||
    else
 | 
			
		||||
        sub_08078F60();
 | 
			
		||||
 | 
			
		||||
    if (gPlayerState.swimState != 0)
 | 
			
		||||
        this->speed = 0;
 | 
			
		||||
    if (!(gPlayerState.flags.all & 0x40))
 | 
			
		||||
        gPlayerEntity.spriteSettings.b.draw = 3;
 | 
			
		||||
    if (!(gPlayerState.flags.all & 0x80))
 | 
			
		||||
        gPlayerEntity.spritePriority.b1 = 1;
 | 
			
		||||
 | 
			
		||||
    if (!(gRoomControls.unk6 & 4)) {
 | 
			
		||||
        if ((gPlayerState.flags.all & 0x40))
 | 
			
		||||
            this->flags |= 0x80;
 | 
			
		||||
        sub_080791D0();
 | 
			
		||||
    }
 | 
			
		||||
    if (!(gPlayerState.flags.all & 2)) {
 | 
			
		||||
        sub_0807A1B8();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern void (*const gUnk_0811BB98[])(Entity*);
 | 
			
		||||
 | 
			
		||||
void PlayerInHole(Entity* this) {
 | 
			
		||||
    gPlayerState.field_0xa8 = 0x17;
 | 
			
		||||
    gUnk_0811BB98[this->subAction](this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072970(Entity* this) {
 | 
			
		||||
    if (this->currentHealth != 0) {
 | 
			
		||||
        this->subAction = 1;
 | 
			
		||||
        this->x.HALF.HI = (this->x.HALF.HI & ~0xF) | 8;
 | 
			
		||||
        this->y.HALF.HI = (this->y.HALF.HI & ~0XF) | 10;
 | 
			
		||||
        this->flags &= ~0x80;
 | 
			
		||||
        this->spritePriority.b0 = 7;
 | 
			
		||||
        this->spritePriority.b1 = 0;
 | 
			
		||||
        this->actionDelay = 0;
 | 
			
		||||
        gPlayerState.flags.all |= 0x100000;
 | 
			
		||||
        if (gPlayerState.flags.all & 8) {
 | 
			
		||||
            gPlayerState.field_0x8 = 0x950;
 | 
			
		||||
        } else {
 | 
			
		||||
            gPlayerState.field_0x8 = 0x61c;
 | 
			
		||||
            if (sub_080001DA(COORD_TO_TILE(this), this->collisionLayer) == 0x4020) {
 | 
			
		||||
                this->actionDelay = 1;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        SetTile(0x4070, COORD_TO_TILE(this), this->collisionLayer);
 | 
			
		||||
        ResetPlayer();
 | 
			
		||||
        sub_08072A60(this);
 | 
			
		||||
        SoundReq(0x81);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072A60(Entity* this) {
 | 
			
		||||
    if (this->frames.all & 0x80) {
 | 
			
		||||
        if (this->actionDelay == 1) {
 | 
			
		||||
            this->subAction = 3;
 | 
			
		||||
            this->actionDelay = 0x28;
 | 
			
		||||
            this->spritePriority.b1 = 1;
 | 
			
		||||
            gPlayerState.field_0x8 = 0x624;
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this->subAction = 2;
 | 
			
		||||
        if (gPlayerState.flags.all & 8) {
 | 
			
		||||
            gPlayerState.field_0x8 = 0x954;
 | 
			
		||||
        } else {
 | 
			
		||||
            gPlayerState.field_0x8 = 0x620;
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        UpdateAnimationSingleFrame(this);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072ACC(Entity* this) {
 | 
			
		||||
    if (gPlayerState.field_0xd == 0xff) {
 | 
			
		||||
        this->field_0xf = 0;
 | 
			
		||||
    } else if (this->field_0xf > 7) {
 | 
			
		||||
        this->flags |= 0x80;
 | 
			
		||||
        this->direction = gPlayerState.field_0xd;
 | 
			
		||||
        this->field_0x20 = 0x1a000;
 | 
			
		||||
        this->speed = 0x78;
 | 
			
		||||
        this->spritePriority.b0 = 4;
 | 
			
		||||
        this->spritePriority.b1 = 1;
 | 
			
		||||
        gPlayerState.jumpStatus = 0x41;
 | 
			
		||||
        sub_0807921C();
 | 
			
		||||
        sub_0807BA8C(COORD_TO_TILE(this), this->collisionLayer);
 | 
			
		||||
    } else {
 | 
			
		||||
        this->animationState = gPlayerState.field_0xd >> 2;
 | 
			
		||||
        this->field_0xf++;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072B5C(Entity* this) {
 | 
			
		||||
    u32 temp;
 | 
			
		||||
 | 
			
		||||
    sub_080042BA(this, ((0x28 - this->actionDelay) >> 4) + 1);
 | 
			
		||||
    sub_0806F948(this);
 | 
			
		||||
    if (this->actionDelay != 0) {
 | 
			
		||||
        this->actionDelay--;
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    SetTile(0x4021, COORD_TO_TILE(this), this->collisionLayer);
 | 
			
		||||
    this->direction = this->animationState << 2;
 | 
			
		||||
    temp = sub_0807A2F8(1);
 | 
			
		||||
    if (!temp) {
 | 
			
		||||
        this->flags |= 0x80;
 | 
			
		||||
        this->spritePriority.b0 = 4;
 | 
			
		||||
        this->speed = 0x40;
 | 
			
		||||
        this->field_0x20 = 0x39000;
 | 
			
		||||
        this->height.WORD--;
 | 
			
		||||
        gPlayerState.jumpStatus = 0x41;
 | 
			
		||||
        sub_0806F854(this, 0, -12);
 | 
			
		||||
        sub_0807921C();
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!sub_08052620()) {
 | 
			
		||||
        sub_08004542(this);
 | 
			
		||||
    }
 | 
			
		||||
    this->subAction++;
 | 
			
		||||
    temp <<= 4;
 | 
			
		||||
    temp -= 4;
 | 
			
		||||
    temp <<= 12;
 | 
			
		||||
    this->field_0x20 = temp;
 | 
			
		||||
    this->speed = 0x100;
 | 
			
		||||
    gPlayerState.field_0x8 = 0x810;
 | 
			
		||||
    SoundReq(0x7c);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072C48(Entity* this) {
 | 
			
		||||
    UpdateAnimationSingleFrame(this);
 | 
			
		||||
    sub_0806F69C(this);
 | 
			
		||||
    if (sub_08003FC4(this, 0x2000))
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    sub_08008790(this, 7);
 | 
			
		||||
    if (gPlayerState.field_0x14) {
 | 
			
		||||
        if (sub_08008B22()) {
 | 
			
		||||
            gPlayerState.field_0x10[1] = 7;
 | 
			
		||||
            if (!(gPlayerState.flags.all & 0x80)) {
 | 
			
		||||
                sub_080791BC();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        sub_0807921C();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern void (*const gUnk_0811BBAC[])(Entity*);
 | 
			
		||||
 | 
			
		||||
void sub_08072C9C(Entity* this) {
 | 
			
		||||
    gPlayerState.field_0xa8 = 0x11;
 | 
			
		||||
    gUnk_0811BBAC[this->subAction](this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072CC0(Entity* this) {
 | 
			
		||||
    this->subAction = 1;
 | 
			
		||||
    this->flags &= ~0x80;
 | 
			
		||||
    this->field_0xf = (gPlayerState.field_0x3a >> 2) + 1;
 | 
			
		||||
    this->direction = gPlayerState.field_0x39;
 | 
			
		||||
    this->speed = 0x400;
 | 
			
		||||
    gPlayerState.field_0x8 = 0x524;
 | 
			
		||||
    gPlayerState.heldObject = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072CFC(Entity* this) {
 | 
			
		||||
    sub_080042BA(this, 2);
 | 
			
		||||
    if (--this->field_0xf != 0xff) {
 | 
			
		||||
        sub_0806F69C(this);
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this->subAction = 2;
 | 
			
		||||
    if (gPlayerState.field_0x38 < 8) {
 | 
			
		||||
        gPlayerState.field_0x38 = 8;
 | 
			
		||||
    }
 | 
			
		||||
    this->field_0x20 = gPlayerState.field_0x38 << 0xc;
 | 
			
		||||
    this->speed = 0x200;
 | 
			
		||||
    gPlayerState.field_0x8 = 0x810;
 | 
			
		||||
    this->actionDelay = 5;
 | 
			
		||||
    this->field_0xf = 0;
 | 
			
		||||
    ResetPlayer();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern const u16* gUnk_0811BBD4[];
 | 
			
		||||
 | 
			
		||||
NONMATCH("asm/non_matching/player/sub_08072D54.s", void sub_08072D54(Entity* this)) {
 | 
			
		||||
    u32 bVar1;
 | 
			
		||||
    u32 uVar2;
 | 
			
		||||
    u32 iVar3;
 | 
			
		||||
 | 
			
		||||
    UpdateAnimationSingleFrame(this);
 | 
			
		||||
    sub_0806F854(this, 0, -12);
 | 
			
		||||
    if (this->actionDelay != 0) {
 | 
			
		||||
        sub_0806F69C(this);
 | 
			
		||||
    } else {
 | 
			
		||||
        uVar2 = sub_0806F730(this);
 | 
			
		||||
        uVar2 = GetTileType(uVar2, this->collisionLayer);
 | 
			
		||||
        switch (this->field_0xf) {
 | 
			
		||||
            case 0:
 | 
			
		||||
                if (sub_08007DD6(uVar2, gUnk_0811BBD4[gPlayerEntity.animationState >> 1])) {
 | 
			
		||||
                    this->actionDelay = 1;
 | 
			
		||||
                    this->field_0xf = 1;
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            case 1:
 | 
			
		||||
                if (sub_08007DD6(uVar2, gUnk_0811BBD4[gPlayerEntity.animationState >> 1])) {
 | 
			
		||||
                    this->actionDelay = 1;
 | 
			
		||||
                    this->field_0xf = 1;
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            case 3:
 | 
			
		||||
                if (this->actionDelay == 0) {
 | 
			
		||||
                    sub_08079E08();
 | 
			
		||||
                } else {
 | 
			
		||||
                    sub_0806F69C(this);
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            case 2:
 | 
			
		||||
                this->animationState ^= 4;
 | 
			
		||||
                if (sub_08007DD6(uVar2, gUnk_0811BBD4[gPlayerEntity.animationState >> 1]) != 0) {
 | 
			
		||||
                    this->actionDelay = 1;
 | 
			
		||||
                    this->field_0xf = 3;
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            default:
 | 
			
		||||
                this->animationState ^= 4;
 | 
			
		||||
                if (sub_08007DD6(uVar2, gUnk_0811BBD4[gPlayerEntity.animationState >> 1])) {
 | 
			
		||||
                    this->field_0xf = 4;
 | 
			
		||||
                } else {
 | 
			
		||||
                    this->actionDelay = 1;
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (this->actionDelay != 0) {
 | 
			
		||||
            sub_0806F69C(this);
 | 
			
		||||
        } else {
 | 
			
		||||
            sub_08079E08();
 | 
			
		||||
        }
 | 
			
		||||
        this->actionDelay = 0;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this->actionDelay = bVar1;
 | 
			
		||||
    if (!sub_08003FC4(this, 0x2000)) {
 | 
			
		||||
        this->flags |= 0x80;
 | 
			
		||||
        if (this->collisionLayer == 1) {
 | 
			
		||||
            sub_0800455E(this);
 | 
			
		||||
        } else {
 | 
			
		||||
            sub_08004542(this);
 | 
			
		||||
        }
 | 
			
		||||
        sub_08008790(this, 7);
 | 
			
		||||
        if (gPlayerState.field_0x14 != 0) {
 | 
			
		||||
            if (!sub_08008B22() != 0) {
 | 
			
		||||
                gPlayerState.field_0x10[1] = 7;
 | 
			
		||||
                if (!(gPlayerState.flags.all & 0x80)) {
 | 
			
		||||
                    sub_080791BC();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
            if ((gPlayerState.flags.all & 8)) {
 | 
			
		||||
                gPlayerState.field_0x8 = 0x424;
 | 
			
		||||
            } else {
 | 
			
		||||
                gPlayerState.field_0x8 = 0x820;
 | 
			
		||||
            }
 | 
			
		||||
            this->actionDelay = 6;
 | 
			
		||||
            this->subAction = 3;
 | 
			
		||||
            this->field_0x42 = 0;
 | 
			
		||||
            SoundReq(0x7d);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
END_NONMATCH
 | 
			
		||||
 | 
			
		||||
void sub_08072F14(Entity* this) {
 | 
			
		||||
    if (--this->actionDelay != 0xff) {
 | 
			
		||||
        sub_0807921C();
 | 
			
		||||
    } else {
 | 
			
		||||
        UpdateAnimationSingleFrame(this);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern void (*const gUnk_0811BBE4[])(Entity*);
 | 
			
		||||
 | 
			
		||||
void sub_08072F34(Entity* this) {
 | 
			
		||||
    if (!sub_08078EFC()) {
 | 
			
		||||
        gPlayerState.field_0xa8 = 0x18;
 | 
			
		||||
        gPlayerState.field_0x10[2] = sub_0807A1E8(this, 0, 0);
 | 
			
		||||
        gUnk_0811BBE4[this->subAction](this);
 | 
			
		||||
        if (this->field_0x42 != 0) {
 | 
			
		||||
            sub_080792D8();
 | 
			
		||||
            if (this->field_0x42 == 0) {
 | 
			
		||||
                this->action = 0x1d;
 | 
			
		||||
                this->subAction = 0;
 | 
			
		||||
                this->y.HALF.LO = 0;
 | 
			
		||||
                gPlayerState.field_0x8 = 0x2cf;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void sub_08072F94(Entity* this) {
 | 
			
		||||
    u32 bVar1;
 | 
			
		||||
 | 
			
		||||
    switch (gPlayerState.field_0x10[2]) {
 | 
			
		||||
        default:
 | 
			
		||||
            sub_0807921C();
 | 
			
		||||
            break;
 | 
			
		||||
        case 0x1E:
 | 
			
		||||
        case 0x2A ... 0x2C:
 | 
			
		||||
            this->spritePriority.b1 = 0;
 | 
			
		||||
            bVar1 = gPlayerState.field_0xd;
 | 
			
		||||
            if ((gPlayerState.field_0xd & 0x80) == 0) {
 | 
			
		||||
                this->direction = gPlayerState.field_0xd;
 | 
			
		||||
                if ((gPlayerState.field_0xd == 8) || (gPlayerState.field_0xd == 0x18)) {
 | 
			
		||||
                    if (gPlayerState.field_0x10[2] == 0x1e) {
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
                    if ((this->frames.all & 0x10)) {
 | 
			
		||||
                        gPlayerState.field_0x8 = 0x2d4;
 | 
			
		||||
                    } else {
 | 
			
		||||
                        gPlayerState.field_0x8 = 0x2d5;
 | 
			
		||||
                    }
 | 
			
		||||
                    sub_08073094(this);
 | 
			
		||||
                } else {
 | 
			
		||||
                    if ((gPlayerState.field_0x10[2] == 0x1e) && ((bVar1 & 7) != 0)) {
 | 
			
		||||
                        this->direction = (bVar1 + 8) & 0x10;
 | 
			
		||||
                    }
 | 
			
		||||
                    if (this->direction & 0x10) {
 | 
			
		||||
                        if (this->frames.all & 0x10) {
 | 
			
		||||
                            gPlayerState.field_0x8 = 0x2d1;
 | 
			
		||||
                        } else {
 | 
			
		||||
                            gPlayerState.field_0x8 = 0x2d2;
 | 
			
		||||
                        }
 | 
			
		||||
                    } else {
 | 
			
		||||
                        if (this->frames.all & 0x10) {
 | 
			
		||||
                            gPlayerState.field_0x8 = 0x2cf;
 | 
			
		||||
                        } else {
 | 
			
		||||
                            gPlayerState.field_0x8 = 0x2d0;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                this->subAction++;
 | 
			
		||||
            } else {
 | 
			
		||||
                if (this->frames.all & 0x10) {
 | 
			
		||||
                    gPlayerState.field_0x8 = 0x2d4;
 | 
			
		||||
                } else {
 | 
			
		||||
                    gPlayerState.field_0x8 = 0x2d5;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern const u16 gUnk_0811BBEC[];
 | 
			
		||||
 | 
			
		||||
void sub_08073094(Entity* this) {
 | 
			
		||||
    this->spritePriority.b1 = 0;
 | 
			
		||||
    this->speed = gUnk_0811BBEC[this->frames.all & 0xf];
 | 
			
		||||
    sub_08079E08();
 | 
			
		||||
    if (!sub_08019840()) {
 | 
			
		||||
        gPlayerState.pushedObject = gPlayerState.pushedObject ^ 0x80;
 | 
			
		||||
        if ((gPlayerState.field_0x10[2] != 0x2a) && (gPlayerState.field_0x10[2] != 0x2c)) {
 | 
			
		||||
            sub_0807A1B8();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (sub_08078EFC() == 0) {
 | 
			
		||||
            switch (gPlayerState.field_0x10[2]) {
 | 
			
		||||
                case 0x2a:
 | 
			
		||||
                case 0x2c:
 | 
			
		||||
                    this->field_0x42 = 0;
 | 
			
		||||
                    gPlayerState.flags.all |= 0x20000000;
 | 
			
		||||
                    UpdateAnimationSingleFrame(this);
 | 
			
		||||
                    if ((this->frames.all & 0x40) != 0) {
 | 
			
		||||
                        sub_0807A1B8();
 | 
			
		||||
                        if (!sub_08078EFC()) {
 | 
			
		||||
                            this->subAction--;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    break;
 | 
			
		||||
                case 0x19:
 | 
			
		||||
                    sub_08074808(this);
 | 
			
		||||
                    sub_080791D0();
 | 
			
		||||
                    break;
 | 
			
		||||
                default:
 | 
			
		||||
                    sub_0807921C();
 | 
			
		||||
                    break;
 | 
			
		||||
                case 0x1e:
 | 
			
		||||
                case 0x2b:
 | 
			
		||||
                    UpdateAnimationSingleFrame(this);
 | 
			
		||||
                    if ((this->frames.all & 0x40) != 0) {
 | 
			
		||||
                        sub_0807A1B8();
 | 
			
		||||
                        if (!sub_08078EFC()) {
 | 
			
		||||
                            this->subAction--;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern void (*const gUnk_0811BBF8[])(Entity*);
 | 
			
		||||
 | 
			
		||||
void PlayerUseEntrance(Entity* this) {
 | 
			
		||||
    gPlayerState.field_0xa8 = 0x1c;
 | 
			
		||||
    sub_0805E4E0(NULL, 8);
 | 
			
		||||
    gUnk_0811BBF8[this->subAction](this);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void PlayerInit(Entity*);
 | 
			
		||||
void PlayerNormal(Entity*);
 | 
			
		||||
void PlayerInit(Entity*);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue