Merge pull request #450 from EllipticEllipsis/FlyingPot

This commit is contained in:
notyourav 2022-03-18 10:12:28 -07:00 committed by GitHub
commit 2c9a5be002
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 262 additions and 596 deletions

View File

@ -1,560 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start FlyingPot
FlyingPot: @ 0x0803704C
push {r4, r5, lr}
adds r5, r0, #0
bl sub_080012DC
adds r1, r0, #0
cmp r1, #0
beq _08037070
ldr r0, _0803706C @ =gUnk_080012C8
lsls r1, r1, #2
adds r1, r1, r0
ldr r1, [r1]
adds r0, r5, #0
bl _call_via_r1
b _08037084
.align 2, 0
_0803706C: .4byte gUnk_080012C8
_08037070:
ldr r4, _08037088 @ =gUnk_080CF244
adds r0, r5, #0
bl GetNextFunction
lsls r0, r0, #2
adds r0, r0, r4
ldr r1, [r0]
adds r0, r5, #0
bl _call_via_r1
_08037084:
pop {r4, r5, pc}
.align 2, 0
_08037088: .4byte gUnk_080CF244
thumb_func_start sub_0803708C
sub_0803708C: @ 0x0803708C
push {lr}
ldr r2, _080370A0 @ =gUnk_080CF25C
ldrb r1, [r0, #0xc]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_080370A0: .4byte gUnk_080CF25C
thumb_func_start sub_080370A4
sub_080370A4: @ 0x080370A4
push {r4, r5, r6, lr}
adds r5, r0, #0
bl sub_08037418
adds r0, r5, #0
adds r0, #0x41
ldrb r0, [r0]
cmp r0, #0x9d
bne _08037110
movs r0, #6
strb r0, [r5, #0xc]
ldrb r1, [r5, #0x10]
movs r0, #0x7f
ands r0, r1
strb r0, [r5, #0x10]
movs r0, #0xa8
lsls r0, r0, #0xa
str r0, [r5, #0x20]
adds r2, r5, #0
adds r2, #0x29
ldrb r1, [r2]
movs r0, #0x39
rsbs r0, r0, #0
ands r0, r1
movs r1, #8
orrs r0, r1
strb r0, [r2]
adds r0, r5, #0
adds r0, #0x74
ldrh r0, [r0]
movs r2, #0x2e
ldrsh r1, [r5, r2]
ldr r3, _0803710C @ =gRoomControls
ldrh r2, [r3, #6]
subs r1, r1, r2
asrs r1, r1, #4
movs r4, #0x3f
ands r1, r4
movs r6, #0x32
ldrsh r2, [r5, r6]
ldrh r3, [r3, #8]
subs r2, r2, r3
asrs r2, r2, #4
ands r2, r4
lsls r2, r2, #6
orrs r1, r2
adds r2, r5, #0
adds r2, #0x38
ldrb r2, [r2]
bl SetTile
b _0803711E
.align 2, 0
_0803710C: .4byte gRoomControls
_08037110:
movs r1, #0x36
ldrsh r0, [r5, r1]
cmp r0, #0
beq _0803711E
adds r0, r5, #0
bl sub_08037408
_0803711E:
ldr r1, _08037128 @ =gUnk_080CF244
adds r0, r5, #0
bl EnemyFunctionHandlerAfterCollision
pop {r4, r5, r6, pc}
.align 2, 0
_08037128: .4byte gUnk_080CF244
thumb_func_start sub_0803712C
sub_0803712C: @ 0x0803712C
push {lr}
ldr r2, _08037140 @ =gUnk_080CF278
ldrb r1, [r0, #0xd]
lsls r1, r1, #2
adds r1, r1, r2
ldr r1, [r1]
bl _call_via_r1
pop {pc}
.align 2, 0
_08037140: .4byte gUnk_080CF278
thumb_func_start sub_08037144
sub_08037144: @ 0x08037144
push {r4, lr}
adds r4, r0, #0
bl sub_08037418
movs r1, #0
movs r0, #1
strb r0, [r4, #0xd]
strb r1, [r4, #0xe]
movs r0, #0x30
strb r0, [r4, #0x1d]
pop {r4, pc}
.align 2, 0
thumb_func_start sub_0803715C
sub_0803715C: @ 0x0803715C
push {r4, lr}
adds r4, r0, #0
bl sub_08037418
adds r0, r4, #0
bl sub_0806F520
cmp r0, #0
beq _08037176
adds r0, r4, #0
bl sub_0806F4E8
b _0803718A
_08037176:
adds r1, r4, #0
adds r1, #0x62
strb r0, [r1]
movs r1, #0x36
ldrsh r0, [r4, r1]
cmp r0, #0
beq _0803718A
adds r0, r4, #0
bl sub_08037408
_0803718A:
pop {r4, pc}
thumb_func_start sub_0803718C
sub_0803718C: @ 0x0803718C
push {r4, r5, r6, lr}
adds r5, r0, #0
ldrb r4, [r5, #0xe]
cmp r4, #0
bne _080371DA
bl sub_08037418
movs r0, #1
strb r0, [r5, #0xe]
ldrb r1, [r5, #0x10]
movs r0, #0x7f
ands r0, r1
strb r0, [r5, #0x10]
adds r0, r5, #0
adds r0, #0x62
strb r4, [r0]
adds r0, #0x12
ldrh r0, [r0]
movs r2, #0x2e
ldrsh r1, [r5, r2]
ldr r3, _080371EC @ =gRoomControls
ldrh r2, [r3, #6]
subs r1, r1, r2
asrs r1, r1, #4
movs r4, #0x3f
ands r1, r4
movs r6, #0x32
ldrsh r2, [r5, r6]
ldrh r3, [r3, #8]
subs r2, r2, r3
asrs r2, r2, #4
ands r2, r4
lsls r2, r2, #6
orrs r1, r2
adds r2, r5, #0
adds r2, #0x38
ldrb r2, [r2]
bl SetTile
_080371DA:
adds r0, r5, #0
bl sub_0806F520
cmp r0, #0
beq _080371F0
adds r0, r5, #0
bl sub_0806F3E4
b _080371F6
.align 2, 0
_080371EC: .4byte gRoomControls
_080371F0:
adds r0, r5, #0
bl sub_08037408
_080371F6:
pop {r4, r5, r6, pc}
thumb_func_start sub_080371F8
sub_080371F8: @ 0x080371F8
push {lr}
adds r2, r0, #0
ldr r0, _08037210 @ =gPlayerState
ldrb r1, [r0, #0x1c]
movs r0, #0xf
ands r0, r1
cmp r0, #0
bne _0803720E
adds r0, r2, #0
bl sub_08037408
_0803720E:
pop {pc}
.align 2, 0
_08037210: .4byte gPlayerState
thumb_func_start nullsub_161
nullsub_161: @ 0x08037214
bx lr
.align 2, 0
thumb_func_start sub_08037218
sub_08037218: @ 0x08037218
push {lr}
bl sub_08037408
pop {pc}
thumb_func_start sub_08037220
sub_08037220: @ 0x08037220
push {r4, r5, r6, lr}
adds r5, r0, #0
movs r0, #1
strb r0, [r5, #0xc]
movs r0, #2
strb r0, [r5, #0x1c]
ldrh r0, [r5, #0x32]
adds r0, #3
strh r0, [r5, #0x32]
movs r0, #0x2e
ldrsh r4, [r5, r0]
ldr r1, _0803727C @ =gRoomControls
ldrh r0, [r1, #6]
subs r4, r4, r0
asrs r4, r4, #4
movs r2, #0x3f
ands r4, r2
movs r3, #0x32
ldrsh r0, [r5, r3]
ldrh r1, [r1, #8]
subs r0, r0, r1
asrs r0, r0, #4
ands r0, r2
lsls r0, r0, #6
orrs r4, r0
adds r6, r5, #0
adds r6, #0x38
ldrb r1, [r6]
adds r0, r4, #0
bl GetTileIndex
adds r1, r5, #0
adds r1, #0x74
strh r0, [r1]
movs r0, #0x80
lsls r0, r0, #7
ldrb r2, [r6]
adds r1, r4, #0
bl SetTile
adds r0, r5, #0
movs r1, #5
bl InitializeAnimation
pop {r4, r5, r6, pc}
.align 2, 0
_0803727C: .4byte gRoomControls
thumb_func_start sub_08037280
sub_08037280: @ 0x08037280
push {r4, r5, r6, lr}
adds r5, r0, #0
bl sub_08037418
adds r0, r5, #0
bl GetTileTypeByEntity
movs r1, #0x80
lsls r1, r1, #7
cmp r0, r1
beq _080372CC
adds r0, r5, #0
adds r0, #0x74
ldrh r0, [r0]
movs r2, #0x2e
ldrsh r1, [r5, r2]
ldr r3, _080372E4 @ =gRoomControls
ldrh r2, [r3, #6]
subs r1, r1, r2
asrs r1, r1, #4
movs r4, #0x3f
ands r1, r4
movs r6, #0x32
ldrsh r2, [r5, r6]
ldrh r3, [r3, #8]
subs r2, r2, r3
asrs r2, r2, #4
ands r2, r4
lsls r2, r2, #6
orrs r1, r2
adds r2, r5, #0
adds r2, #0x38
ldrb r2, [r2]
bl SetTile
adds r0, r5, #0
bl sub_08037408
_080372CC:
adds r0, r5, #0
movs r1, #1
movs r2, #0x40
bl PlayerInRange
cmp r0, #0
beq _080372E2
movs r0, #2
strb r0, [r5, #0xc]
movs r0, #0x1e
strb r0, [r5, #0xe]
_080372E2:
pop {r4, r5, r6, pc}
.align 2, 0
_080372E4: .4byte gRoomControls
thumb_func_start sub_080372E8
sub_080372E8: @ 0x080372E8
push {r4, r5, r6, lr}
adds r5, r0, #0
bl sub_08037418
adds r3, r5, #0
adds r3, #0x62
ldr r2, _08037370 @ =gUnk_080CF290
ldrb r1, [r5, #0xe]
movs r6, #3
adds r0, r6, #0
ands r0, r1
adds r0, r0, r2
ldrb r0, [r0]
ldrb r1, [r3]
adds r0, r0, r1
strb r0, [r3]
ldrb r0, [r5, #0xe]
subs r0, #1
strb r0, [r5, #0xe]
lsls r0, r0, #0x18
lsrs r4, r0, #0x18
cmp r4, #0
bne _0803736E
strb r6, [r5, #0xc]
adds r2, r5, #0
adds r2, #0x29
ldrb r1, [r2]
movs r0, #0x39
rsbs r0, r0, #0
ands r0, r1
movs r1, #8
orrs r0, r1
strb r0, [r2]
strb r4, [r3]
adds r1, r5, #0
adds r1, #0x3f
movs r0, #0xa0
strb r0, [r1]
subs r1, #4
movs r0, #0xf
strb r0, [r1]
ldr r0, _08037374 @ =gUnk_080FD34C
str r0, [r5, #0x48]
adds r0, r5, #0
adds r0, #0x74
ldrh r0, [r0]
movs r2, #0x2e
ldrsh r1, [r5, r2]
ldr r3, _08037378 @ =gRoomControls
ldrh r2, [r3, #6]
subs r1, r1, r2
asrs r1, r1, #4
movs r4, #0x3f
ands r1, r4
movs r6, #0x32
ldrsh r2, [r5, r6]
ldrh r3, [r3, #8]
subs r2, r2, r3
asrs r2, r2, #4
ands r2, r4
lsls r2, r2, #6
orrs r1, r2
adds r2, r5, #0
adds r2, #0x38
ldrb r2, [r2]
bl SetTile
_0803736E:
pop {r4, r5, r6, pc}
.align 2, 0
_08037370: .4byte gUnk_080CF290
_08037374: .4byte gUnk_080FD34C
_08037378: .4byte gRoomControls
thumb_func_start sub_0803737C
sub_0803737C: @ 0x0803737C
push {r4, lr}
adds r4, r0, #0
ldr r0, [r4, #0x34]
ldr r1, _080373A8 @ =0xFFFF0000
adds r0, r0, r1
str r0, [r4, #0x34]
movs r0, #0x36
ldrsh r1, [r4, r0]
movs r0, #6
rsbs r0, r0, #0
cmp r1, r0
bgt _080373A6
movs r0, #4
strb r0, [r4, #0xc]
movs r0, #0xa
strb r0, [r4, #0xe]
ldr r1, _080373AC @ =gPlayerEntity
adds r0, r4, #0
bl GetFacingDirection
strb r0, [r4, #0x15]
_080373A6:
pop {r4, pc}
.align 2, 0
_080373A8: .4byte 0xFFFF0000
_080373AC: .4byte gPlayerEntity
thumb_func_start sub_080373B0
sub_080373B0: @ 0x080373B0
push {lr}
adds r1, r0, #0
ldrb r0, [r1, #0xe]
subs r0, #1
strb r0, [r1, #0xe]
lsls r0, r0, #0x18
cmp r0, #0
bne _080373C4
movs r0, #5
strb r0, [r1, #0xc]
_080373C4:
pop {pc}
.align 2, 0
thumb_func_start sub_080373C8
sub_080373C8: @ 0x080373C8
push {r4, lr}
adds r4, r0, #0
bl ProcessMovement2
ldrh r0, [r4, #0x2a]
cmp r0, #0
beq _080373DC
adds r0, r4, #0
bl sub_08037408
_080373DC:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_080373E0
sub_080373E0: @ 0x080373E0
push {r4, lr}
adds r4, r0, #0
ldr r0, [r4, #0x20]
cmp r0, #0
bge _080373F2
ldrb r0, [r4, #0x18]
movs r1, #0x80
orrs r0, r1
strb r0, [r4, #0x18]
_080373F2:
movs r1, #0x80
lsls r1, r1, #6
adds r0, r4, #0
bl GravityUpdate
cmp r0, #0
bne _08037406
adds r0, r4, #0
bl sub_08037408
_08037406:
pop {r4, pc}
thumb_func_start sub_08037408
sub_08037408: @ 0x08037408
push {lr}
movs r1, #5
movs r2, #0
bl CreateFx
bl DeleteThisEntity
pop {pc}
thumb_func_start sub_08037418
sub_08037418: @ 0x08037418
push {r4, r5, r6, lr}
adds r5, r0, #0
movs r1, #0x2e
ldrsh r0, [r5, r1]
ldr r3, _08037464 @ =gRoomControls
ldrh r1, [r3, #6]
subs r0, r0, r1
asrs r4, r0, #4
movs r2, #0x3f
ands r4, r2
movs r1, #0x32
ldrsh r0, [r5, r1]
ldrh r1, [r3, #8]
subs r0, r0, r1
asrs r0, r0, #4
ands r0, r2
lsls r0, r0, #6
orrs r4, r0
adds r6, r5, #0
adds r6, #0x38
ldrb r1, [r6]
adds r0, r4, #0
bl GetTileIndex
ldr r1, _08037468 @ =0x00004067
cmp r0, r1
bne _08037460
adds r0, r5, #0
adds r0, #0x74
ldrh r0, [r0]
ldrb r2, [r6]
adds r1, r4, #0
bl SetTile
bl DeleteThisEntity
_08037460:
pop {r4, r5, r6, pc}
.align 2, 0
_08037464: .4byte gRoomControls
_08037468: .4byte 0x00004067

View File

@ -1,34 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_080CF244:: @ 080CF244
.4byte sub_0803708C
.4byte sub_080370A4
.4byte GenericKnockback
.4byte GenericDeath
.4byte GenericConfused
.4byte sub_0803712C
gUnk_080CF25C:: @ 080CF25C
.4byte sub_08037220
.4byte sub_08037280
.4byte sub_080372E8
.4byte sub_0803737C
.4byte sub_080373B0
.4byte sub_080373C8
.4byte sub_080373E0
gUnk_080CF278:: @ 080CF278
.4byte sub_08037144
.4byte sub_0803715C
.4byte sub_0803718C
.4byte sub_080371F8
.4byte nullsub_161
.4byte sub_08037218
gUnk_080CF290:: @ 080CF290
.incbin "flyingPot/gUnk_080CF290.bin"

View File

@ -381,7 +381,7 @@ SECTIONS {
src/enemy/mazaalMacro.o(.text); src/enemy/mazaalMacro.o(.text);
src/enemy/mazaalHand.o(.text); src/enemy/mazaalHand.o(.text);
src/enemy/octorokBoss.o(.text); src/enemy/octorokBoss.o(.text);
asm/enemy/flyingPot.o(.text); src/enemy/flyingPot.o(.text);
src/enemy/gibdo.o(.text); src/enemy/gibdo.o(.text);
src/enemy/octorokGolden.o(.text); src/enemy/octorokGolden.o(.text);
src/enemy/tektiteGolden.o(.text); src/enemy/tektiteGolden.o(.text);
@ -1020,7 +1020,7 @@ SECTIONS {
data/animations/enemy/mazaalHand.o(.rodata); data/animations/enemy/mazaalHand.o(.rodata);
src/enemy/octorokBoss.o(.rodata); src/enemy/octorokBoss.o(.rodata);
data/animations/enemy/octorokBoss.o(.rodata); data/animations/enemy/octorokBoss.o(.rodata);
data/const/enemy/flyingPot.o(.rodata); src/enemy/flyingPot.o(.rodata);
src/enemy/gibdo.o(.rodata); src/enemy/gibdo.o(.rodata);
data/animations/enemy/gibdo.o(.rodata); data/animations/enemy/gibdo.o(.rodata);
src/enemy/octorokGolden.o(.rodata); src/enemy/octorokGolden.o(.rodata);

260
src/enemy/flyingPot.c Normal file
View File

@ -0,0 +1,260 @@
/**
* @file flyingPot.c
* @ingroup Enemies
*
* @brief Flying pot enemy
*/
#define NENT_DEPRECATED
#include "functions.h"
#include "enemy.h"
#include "player.h"
#include "room.h"
extern void (*const gUnk_080012C8[])(Entity*);
extern Hitbox gUnk_080FD34C;
typedef struct {
/* 0x00 */ Entity base;
/* 0x68 */ u8 filler[0xC];
/* 0x74 */ u16 tileIndex;
} FlyingPotEntity;
enum FlyingPotActions {
/* 0 */ FLYING_POT_ACTION_0,
/* 1 */ FLYING_POT_ACTION_1,
/* 2 */ FLYING_POT_ACTION_2,
/* 3 */ FLYING_POT_ACTION_3,
/* 4 */ FLYING_POT_ACTION_4,
/* 5 */ FLYING_POT_ACTION_5,
/* 6 */ FLYING_POT_ACTION_6,
};
enum FlyingPotSubActions {
/* 0 */ FLYING_POT_SUBACTION_0,
/* 1 */ FLYING_POT_SUBACTION_1,
/* 2 */ FLYING_POT_SUBACTION_2,
/* 3 */ FLYING_POT_SUBACTION_3,
/* 4 */ FLYING_POT_SUBACTION_4,
/* 5 */ FLYING_POT_SUBACTION_5,
};
// Functions
void FlyingPot_OnTick(FlyingPotEntity*); // 0803708C
void sub_080370A4(FlyingPotEntity*); // 080370A4
void sub_0803712C(FlyingPotEntity*); // 0803712C
// Subactions
void FlyingPot_SubAction0(FlyingPotEntity*); // 08037144
void FlyingPot_SubAction1(FlyingPotEntity*); // 0803715C
void FlyingPot_SubAction2(FlyingPotEntity*); // 0803718C
void FlyingPot_SubAction3(FlyingPotEntity*); // 080371F8
void FlyingPot_SubActionDoNothing(FlyingPotEntity*);
void FlyingPot_SubAction5(FlyingPotEntity*); // 08037218
// Actions
void FlyingPot_Init(FlyingPotEntity*); // ? // 08037220
void FlyingPot_Action1(FlyingPotEntity*); // 08037280
void FlyingPot_Action2(FlyingPotEntity*); // 080372E8
void FlyingPot_Action3(FlyingPotEntity*); // 0803737C
void FlyingPot_Action4(FlyingPotEntity*); // 080373B0
void FlyingPot_Action5(FlyingPotEntity*); // 080373C8
void FlyingPot_Action6(FlyingPotEntity*); // 080373E0
void sub_08037408(FlyingPotEntity*);
void sub_08037418(FlyingPotEntity*);
void (*const FlyingPot_Functions[])(Entity*) = {
(EntityActionPtr)FlyingPot_OnTick, (EntityActionPtr)sub_080370A4, GenericKnockback, GenericDeath, GenericConfused,
(EntityActionPtr)sub_0803712C,
};
void FlyingPot(Entity* thisx) {
s32 index = sub_080012DC(thisx);
if (index != 0) {
gUnk_080012C8[index](thisx);
} else {
FlyingPot_Functions[GetNextFunction(thisx)](thisx);
}
}
void FlyingPot_OnTick(FlyingPotEntity* this) {
static void (*const FlyingPot_Actions[])(FlyingPotEntity*) = {
FlyingPot_Init, FlyingPot_Action1, FlyingPot_Action2, FlyingPot_Action3,
FlyingPot_Action4, FlyingPot_Action5, FlyingPot_Action6,
};
FlyingPot_Actions[super->action](this);
}
void sub_080370A4(FlyingPotEntity* this) {
sub_08037418(this);
if (super->bitfield == 0x9D) {
super->action = FLYING_POT_ACTION_6;
super->flags &= ~0x80;
super->zVelocity = 0x2A000;
super->spritePriority.b1 = 1;
SetTile(this->tileIndex, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
} else if (super->z.HALF.HI != 0) {
sub_08037408(this);
}
EnemyFunctionHandlerAfterCollision(super, FlyingPot_Functions);
}
void sub_0803712C(FlyingPotEntity* this) {
static void (*const FlyingPot_SubActions[])(FlyingPotEntity*) = {
FlyingPot_SubAction0, FlyingPot_SubAction1, FlyingPot_SubAction2,
FlyingPot_SubAction3, FlyingPot_SubActionDoNothing, FlyingPot_SubAction5,
};
FlyingPot_SubActions[super->subAction](this);
}
void FlyingPot_SubAction0(FlyingPotEntity* this) {
sub_08037418(this);
super->subAction = FLYING_POT_SUBACTION_1;
super->actionDelay = 0;
super->field_0x1d = 0x30;
}
void FlyingPot_SubAction1(FlyingPotEntity* this) {
sub_08037418(this);
if (sub_0806F520(super)) {
sub_0806F4E8(super);
} else {
super->spriteOffsetX = 0;
if (super->z.HALF.HI != 0) {
sub_08037408(this);
}
}
}
void FlyingPot_SubAction2(FlyingPotEntity* this) {
if (super->actionDelay == 0) {
sub_08037418(this);
super->actionDelay = 1;
super->flags &= ~0x80;
super->spriteOffsetX = 0;
SetTile(this->tileIndex, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
}
if (sub_0806F520(super)) {
sub_0806F3E4(super);
} else {
sub_08037408(this);
}
}
void FlyingPot_SubAction3(FlyingPotEntity* this) {
if (!(gPlayerState.field_0x1c & 0xF)) {
sub_08037408(this);
}
}
void FlyingPot_SubActionDoNothing(FlyingPotEntity* this) {
}
void FlyingPot_SubAction5(FlyingPotEntity* this) {
sub_08037408(this);
}
void FlyingPot_Init(FlyingPotEntity* this) {
u32 tile;
super->action = FLYING_POT_ACTION_1;
super->field_0x1c = 2;
super->y.HALF.HI += 3;
tile = TILE(super->x.HALF.HI, super->y.HALF.HI);
this->tileIndex = GetTileIndex(tile, super->collisionLayer);
SetTile(0x4000, tile, super->collisionLayer);
InitializeAnimation(super, 5);
}
void FlyingPot_Action1(FlyingPotEntity* this) {
sub_08037418(this);
if (GetTileTypeByEntity(super) != 0x4000) {
SetTile(this->tileIndex, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
sub_08037408(this);
}
if (PlayerInRange(super, 1, 0x40)) {
super->action = FLYING_POT_ACTION_2;
super->actionDelay = 30;
}
}
void FlyingPot_Action2(FlyingPotEntity* this) {
static const u8 offsets[] = { -1, 1, 1, -1 };
sub_08037418(this);
super->spriteOffsetX += offsets[super->actionDelay & 3];
if (--super->actionDelay == 0) {
super->action = FLYING_POT_ACTION_3;
super->spritePriority.b1 = 1;
super->spriteOffsetX = 0;
super->hitType = 0xA0;
super->flags2 = 0xF;
super->hitbox = &gUnk_080FD34C;
SetTile(this->tileIndex, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer);
}
}
void FlyingPot_Action3(FlyingPotEntity* this) {
super->z.WORD -= 0x10000;
if (super->z.HALF.HI <= -6) {
super->action = FLYING_POT_ACTION_4;
super->actionDelay = 10;
super->direction = GetFacingDirection(super, &gPlayerEntity);
}
}
void FlyingPot_Action4(FlyingPotEntity* this) {
if (--super->actionDelay == 0) {
super->action = FLYING_POT_ACTION_5;
}
}
void FlyingPot_Action5(FlyingPotEntity* this) {
ProcessMovement2(super);
if (super->collisions != 0) {
sub_08037408(this);
}
}
void FlyingPot_Action6(FlyingPotEntity* this) {
if (super->zVelocity < 0) {
super->spriteSettings.flipY = 1;
}
if (!GravityUpdate(super, 0x2000)) {
sub_08037408(this);
}
}
void sub_08037408(FlyingPotEntity* this) {
CreateFx(super, FX_POT_SHATTER, 0);
DeleteThisEntity();
}
void sub_08037418(FlyingPotEntity* this) {
u32 tile = COORD_TO_TILE(super);
if (GetTileIndex(tile, super->collisionLayer) == 0x4067) {
SetTile(this->tileIndex, tile, super->collisionLayer);
DeleteThisEntity();
}
}