Merge pull request #355 from octorock/mulldozer

This commit is contained in:
notyourav 2022-02-07 18:09:14 -08:00 committed by GitHub
commit e9ce049ed7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 509 additions and 1484 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,44 @@
.syntax unified
push {r4, lr}
adds r4, r0, #0
movs r0, #1
bl sub_08049DF4
adds r1, r0, #0
cmp r1, #0
beq _080333B4
ldrb r0, [r4, #0xa]
movs r3, #0x38
cmp r0, #0
beq _0803337E
movs r3, #0x48
_0803337E:
adds r0, r4, #0
adds r2, r3, #0
bl EntityInRectRadius
cmp r0, #0
beq _080333B4
ldrb r0, [r4, #0xa]
cmp r0, #0
bne _080333AA
ldr r0, _080333B0 @ =gUnk_020000B0
ldr r1, [r0]
adds r0, r4, #0
bl GetFacingDirection
adds r1, r0, #0
adds r1, #2
movs r0, #0x1c
ands r1, r0
lsrs r1, r1, #2
ldrb r0, [r4, #0x14]
cmp r0, r1
bne _080333B4
_080333AA:
movs r0, #1
b _080333B6
.align 2, 0
_080333B0: .4byte gUnk_020000B0
_080333B4:
movs r0, #0
_080333B6:
pop {r4, pc}
.syntax divided

View File

@ -1,428 +0,0 @@
.ifdef EU
.syntax unified
push {r4, r5, r6, r7, lr}
sub sp, #0x20
adds r6, r0, #0
adds r3, r1, #0
ldr r0, _08054138 @ =gRoomVars
ldrb r0, [r0, #2]
cmp r0, #1
bne _08054126
b _080542CC
_08054126:
ldr r2, _0805413C @ =gUnk_08001A1C
movs r4, #0
cmp r3, #0x18
bhi _080541BC
lsls r0, r3, #2
ldr r1, _08054140 @ =_08054144
adds r0, r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_08054138: .4byte gRoomVars
_0805413C: .4byte gUnk_08001A1C
_08054140: .4byte _08054144
_08054144: @ jump table
.4byte _080541BC @ case 0
.4byte _080541A8 @ case 1
.4byte _080541A8 @ case 2
.4byte _080541A8 @ case 3
.4byte _080541A8 @ case 4
.4byte _080541A8 @ case 5
.4byte _080541A8 @ case 6
.4byte _080541A8 @ case 7
.4byte _080541A8 @ case 8
.4byte _080541A8 @ case 9
.4byte _080541A8 @ case 10
.4byte _080541A8 @ case 11
.4byte _080541A8 @ case 12
.4byte _080541BC @ case 13
.4byte _080541BC @ case 14
.4byte _080541BA @ case 15
.4byte _080541B4 @ case 16
.4byte _080541B4 @ case 17
.4byte _080541B4 @ case 18
.4byte _080541B4 @ case 19
.4byte _080541B4 @ case 20
.4byte _080541B4 @ case 21
.4byte _080541B4 @ case 22
.4byte _080541B4 @ case 23
.4byte _080541B4 @ case 24
_080541A8:
lsls r1, r3, #5
ldr r0, _080541B0 @ =gUnk_0800137C
adds r4, r1, r0
b _080541BC
.align 2, 0
_080541B0: .4byte gUnk_0800137C
_080541B4:
lsls r1, r3, #5
ldr r0, _080541D0 @ =gUnk_0800161C
adds r2, r1, r0
_080541BA:
ldr r4, _080541D4 @ =gUnk_02034398
_080541BC:
cmp r4, #0
bne _080541C2
b _080542CC
_080541C2:
ldr r0, _080541D8 @ =gSave
adds r0, #0xb3
ldrb r1, [r0]
cmp r1, #0
bne _080541E0
ldr r3, _080541DC @ =gUnk_08001A1C
b _080541E6
.align 2, 0
_080541D0: .4byte gUnk_0800161C
_080541D4: .4byte gUnk_02034398
_080541D8: .4byte gSave
_080541DC: .4byte gUnk_08001A1C
_080541E0:
lsls r1, r1, #5
ldr r0, _080542BC @ =0x080014E4
adds r3, r1, r0
_080541E6:
mov r0, sp
adds r1, r4, #0
bl sub_08000F14
ldr r4, _080542C0 @ =gSave
adds r0, r4, #0
adds r0, #0xaa
ldrb r0, [r0]
cmp r0, #8
bhi _08054204
mov r1, sp
mov r0, sp
ldrh r0, [r0, #8]
adds r0, #5
strh r0, [r1, #8]
_08054204:
adds r0, r4, #0
adds r0, #0xac
ldrb r0, [r0]
cmp r0, #0
bne _08054218
mov r1, sp
mov r0, sp
ldrh r0, [r0, #0xc]
adds r0, #3
strh r0, [r1, #0xc]
_08054218:
adds r0, r4, #0
adds r0, #0xad
ldrb r0, [r0]
cmp r0, #0
bne _0805422C
mov r1, sp
mov r0, sp
ldrh r0, [r0, #0xe]
adds r0, #3
strh r0, [r1, #0xe]
_0805422C:
adds r0, r4, #0
adds r0, #0xc0
ldrh r0, [r0]
cmp r0, #0xa
bhi _08054240
mov r1, sp
mov r0, sp
ldrh r0, [r0, #4]
adds r0, #1
strh r0, [r1, #4]
_08054240:
ldr r2, _080542C4 @ =gUnk_08001A1C
adds r0, r4, #0
adds r0, #0xbb
ldrb r0, [r0]
adds r3, r2, #0
cmp r0, #0
beq _08054250
adds r2, #0x20
_08054250:
movs r1, #0x8b
lsls r1, r1, #1
adds r0, r4, r1
ldrb r0, [r0]
cmp r0, #0
beq _0805425E
adds r3, #0x40
_0805425E:
mov r0, sp
mov r1, sp
bl sub_08000F2C
adds r4, r0, #0
bl Random
adds r2, r0, #0
asrs r5, r2, #0x18
movs r0, #0xf
ands r5, r0
adds r0, r2, #0
adds r1, r4, #0
bl __modsi3
adds r2, r0, #0
movs r3, #0
lsls r0, r5, #1
add r0, sp
movs r4, #0
ldrsh r1, [r0, r4]
cmp r1, r2
bgt _080542A6
movs r4, #0xf
_0805428E:
adds r3, #1
adds r5, #1
ands r5, r4
cmp r3, #0xf
bhi _080542A6
lsls r0, r5, #1
add r0, sp
movs r7, #0
ldrsh r0, [r0, r7]
adds r1, r1, r0
cmp r1, r2
ble _0805428E
_080542A6:
ldr r0, _080542C8 @ =gUnk_080FE1B4
adds r0, r5, r0
ldrb r1, [r0]
cmp r1, #0
beq _080542CC
adds r0, r6, #0
movs r2, #0
bl CreateItemDrop
b _080542CE
.align 2, 0
_080542BC: .4byte 0x080014E4
_080542C0: .4byte gSave
_080542C4: .4byte gUnk_08001A1C
_080542C8: .4byte gUnk_080FE1B4
_080542CC:
movs r0, #0
_080542CE:
add sp, #0x20
pop {r4, r5, r6, r7, pc}
.align 2, 0
.syntax divided
.else
.syntax unified
push {r4, r5, r6, r7, lr}
sub sp, #0x20
adds r6, r0, #0
adds r3, r1, #0
ldr r0, _080545A4 @ =gRoomVars
ldrb r1, [r0, #2]
adds r5, r0, #0
cmp r1, #1
bne _08054590
b _0805474C
_08054590:
ldr r2, _080545A8 @ =gUnk_08001A1C
movs r4, #0
cmp r3, #0x19
bhi _0805463C
lsls r0, r3, #2
ldr r1, _080545AC @ =_080545B0
adds r0, r0, r1
ldr r0, [r0]
mov pc, r0
.align 2, 0
_080545A4: .4byte gRoomVars
_080545A8: .4byte gUnk_08001A1C
_080545AC: .4byte _080545B0
_080545B0: @ jump table
.4byte _0805463C @ case 0
.4byte _08054618 @ case 1
.4byte _08054618 @ case 2
.4byte _08054618 @ case 3
.4byte _08054618 @ case 4
.4byte _08054618 @ case 5
.4byte _08054618 @ case 6
.4byte _08054618 @ case 7
.4byte _08054618 @ case 8
.4byte _08054618 @ case 9
.4byte _08054618 @ case 10
.4byte _08054618 @ case 11
.4byte _08054618 @ case 12
.4byte _0805463C @ case 13
.4byte _0805463C @ case 14
.4byte _0805463A @ case 15
.4byte _08054634 @ case 16
.4byte _08054634 @ case 17
.4byte _08054634 @ case 18
.4byte _08054634 @ case 19
.4byte _08054634 @ case 20
.4byte _08054634 @ case 21
.4byte _08054634 @ case 22
.4byte _08054634 @ case 23
.4byte _08054624 @ case 24
.4byte _08054624 @ case 25
_08054618:
lsls r1, r3, #5
ldr r0, _08054620 @ =gUnk_0800137C
adds r4, r1, r0
b _0805463C
.align 2, 0
_08054620: .4byte gUnk_0800137C
_08054624:
ldrb r0, [r5, #0xa]
ldr r4, _08054630 @ =gUnk_0800191C
cmp r0, #0
beq _0805463C
adds r4, #0x20
b _0805463C
.align 2, 0
_08054630: .4byte gUnk_0800191C
_08054634:
lsls r1, r3, #5
ldr r0, _08054650 @ =gUnk_0800161C
adds r2, r1, r0
_0805463A:
ldr r4, _08054654 @ =gUnk_02034398
_0805463C:
cmp r4, #0
bne _08054642
b _0805474C
_08054642:
ldr r0, _08054658 @ =gSave
adds r0, #0xb3
ldrb r1, [r0]
cmp r1, #0
bne _08054660
ldr r3, _0805465C @ =gUnk_08001A1C
b _08054666
.align 2, 0
_08054650: .4byte gUnk_0800161C
_08054654: .4byte gUnk_02034398
_08054658: .4byte gSave
_0805465C: .4byte gUnk_08001A1C
_08054660:
lsls r1, r1, #5
ldr r0, _0805473C @ =gUnk_0800143C
adds r3, r1, r0
_08054666:
mov r0, sp
adds r1, r4, #0
bl sub_08000F14
ldr r4, _08054740 @ =gSave
adds r0, r4, #0
adds r0, #0xaa
ldrb r0, [r0]
cmp r0, #8
bhi _08054684
mov r1, sp
mov r0, sp
ldrh r0, [r0, #8]
adds r0, #5
strh r0, [r1, #8]
_08054684:
adds r0, r4, #0
adds r0, #0xac
ldrb r0, [r0]
cmp r0, #0
bne _08054698
mov r1, sp
mov r0, sp
ldrh r0, [r0, #0xc]
adds r0, #3
strh r0, [r1, #0xc]
_08054698:
adds r0, r4, #0
adds r0, #0xad
ldrb r0, [r0]
cmp r0, #0
bne _080546AC
mov r1, sp
mov r0, sp
ldrh r0, [r0, #0xe]
adds r0, #3
strh r0, [r1, #0xe]
_080546AC:
adds r0, r4, #0
adds r0, #0xc0
ldrh r0, [r0]
cmp r0, #0xa
bhi _080546C0
mov r1, sp
mov r0, sp
ldrh r0, [r0, #4]
adds r0, #1
strh r0, [r1, #4]
_080546C0:
ldr r2, _08054744 @ =gUnk_08001A1C
adds r0, r4, #0
adds r0, #0xbb
ldrb r0, [r0]
adds r3, r2, #0
cmp r0, #0
beq _080546D0
adds r2, #0x20
_080546D0:
movs r1, #0x8b
lsls r1, r1, #1
adds r0, r4, r1
ldrb r0, [r0]
cmp r0, #0
beq _080546DE
adds r3, #0x40
_080546DE:
mov r0, sp
mov r1, sp
bl sub_08000F2C
adds r4, r0, #0
bl Random
adds r2, r0, #0
asrs r5, r2, #0x18
movs r0, #0xf
ands r5, r0
adds r0, r2, #0
adds r1, r4, #0
bl __modsi3
adds r2, r0, #0
movs r3, #0
lsls r0, r5, #1
add r0, sp
movs r4, #0
ldrsh r1, [r0, r4]
cmp r1, r2
bgt _08054726
movs r4, #0xf
_0805470E:
adds r3, #1
adds r5, #1
ands r5, r4
cmp r3, #0xf
bhi _08054726
lsls r0, r5, #1
add r0, sp
movs r7, #0
ldrsh r0, [r0, r7]
adds r1, r1, r0
cmp r1, r2
ble _0805470E
_08054726:
ldr r0, _08054748 @ =gUnk_080FE1B4
adds r0, r5, r0
ldrb r1, [r0]
cmp r1, #0
beq _0805474C
adds r0, r6, #0
movs r2, #0
bl CreateItemDrop
b _0805474E
.align 2, 0
_0805473C: .4byte gUnk_0800143C
_08054740: .4byte gSave
_08054744: .4byte gUnk_08001A1C
_08054748: .4byte gUnk_080FE1B4
_0805474C:
movs r0, #0
_0805474E:
add sp, #0x20
pop {r4, r5, r6, r7, pc}
.align 2, 0
.syntax divided
.endif

View File

@ -25795,21 +25795,6 @@
"size": 19,
"type": "animation"
},
{
"path": "mulldozer/gUnk_080CEA50.bin",
"start": 846416,
"size": 4
},
{
"path": "mulldozer/gUnk_080CEA54.bin",
"start": 846420,
"size": 2
},
{
"path": "mulldozer/gUnk_080CEA56.bin",
"start": 846422,
"size": 16
},
{
"path": "animations/gSpriteAnimations_Bombarossa_0.bin",
"start": 846688,

View File

@ -1,31 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gUnk_080CEA1C:: @ 080CEA1C
.4byte sub_08032C94
.4byte sub_08032CAC
.4byte sub_08032D3C
.4byte sub_0804A7D4
.4byte sub_08001242
.4byte nullsub_157
gUnk_080CEA34:: @ 080CEA34
.4byte sub_08032D74
.4byte sub_08032D84
.4byte sub_08032DB4
.4byte sub_08032DD4
.4byte sub_08032E50
.4byte sub_08032E84
.4byte sub_08032ED0
gUnk_080CEA50:: @ 080CEA50
.incbin "mulldozer/gUnk_080CEA50.bin"
gUnk_080CEA54:: @ 080CEA54
.incbin "mulldozer/gUnk_080CEA54.bin"
gUnk_080CEA56:: @ 080CEA56
.incbin "mulldozer/gUnk_080CEA56.bin"

View File

@ -183,7 +183,7 @@ void AcroBandit(Entity*);
void BladeTrap(Entity*);
void Keaton(Entity*);
void Crow(Entity*);
void Mulldozer(Entity*);
void Mulldozer();
void Bombarossa(Entity*);
void Wisp(Entity*);
void SpinyBeetle(Entity*);

View File

@ -375,7 +375,7 @@ SECTIONS {
src/enemy/bladeTrap.o(.text);
src/enemy/keaton.o(.text);
src/enemy/crow.o(.text);
asm/enemy/mulldozer.o(.text);
src/enemy/mulldozer.o(.text);
src/enemy/bombarossa.o(.text);
src/enemy/wisp.o(.text);
src/enemy/spinyBeetle.o(.text);
@ -1032,7 +1032,7 @@ SECTIONS {
data/animations/enemy/keaton.o(.rodata);
src/enemy/crow.o(.rodata);
data/animations/enemy/crow.o(.rodata);
data/const/enemy/mulldozer.o(.rodata);
src/enemy/mulldozer.o(.rodata);
data/animations/enemy/mulldozer.o(.rodata);
src/enemy/bombarossa.o(.rodata);
data/animations/enemy/bombarossa.o(.rodata);

462
src/enemy/mulldozer.c Normal file
View File

@ -0,0 +1,462 @@
/**
* @file mulldozer.c
* @ingroup Enemies
*
* @brief Mulldozer enemy
*/
#define NENT_DEPRECATED
#include "global.h"
#include "enemy.h"
#include "functions.h"
typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 filler[0x18];
/*0x80*/ u8 unk_80;
/*0x81*/ u8 unk_81;
/*0x82*/ u8 unk_82;
/*0x83*/ u8 unk_83;
} MulldozerEntity;
extern Entity* gUnk_020000B0;
extern void (*const Mulldozer_Functions[])(MulldozerEntity*);
extern void (*const Mulldozer_Actions[])(MulldozerEntity*);
extern const u8 gUnk_080CEA50[];
extern const u8 gUnk_080CEA54[];
extern const s8 gUnk_080CEA56[];
void sub_08033174(MulldozerEntity*);
void sub_08032F24(MulldozerEntity*);
void sub_080331E8(MulldozerEntity*);
void sub_08033058(MulldozerEntity*);
bool32 sub_08033364(MulldozerEntity*);
void sub_080330C0(MulldozerEntity*);
void sub_08033100(MulldozerEntity*);
void sub_08032F64(MulldozerEntity*);
void sub_08032F48(MulldozerEntity*);
void sub_080331B4(MulldozerEntity*);
void sub_08032F90(MulldozerEntity*);
void sub_08033000(MulldozerEntity*);
void sub_08033320(MulldozerEntity*);
void sub_080332A8(MulldozerEntity*);
void sub_08033280(MulldozerEntity*);
void sub_080332E8(MulldozerEntity*, s32);
void Mulldozer(MulldozerEntity* this) {
EnemyFunctionHandler(super, (EntityActionArray)Mulldozer_Functions);
SetChildOffset(super, 0, 1, -0x10);
}
void Mulldozer_OnInit(MulldozerEntity* this) {
Mulldozer_Actions[super->action](this);
}
void sub_08032CAC(MulldozerEntity* this) {
if (super->field_0x43 != 0) {
sub_0804A9FC(super, 0x1c);
}
sub_0804AA30(super, Mulldozer_Functions);
if ((super->bitfield & 0x80) != 0) {
switch (super->bitfield & 0x3f) {
case 2:
case 3:
super->action = 6;
super->actionDelay = super->type != 0 ? 0x5a : 200;
super->field_0xf = 2;
this->unk_80 = 3;
super->direction = super->knockbackDirection;
super->direction = (super->direction + ((Random() & 0x40) != 0 ? 4 : 0x1c));
super->direction &= 0x1f;
super->speed = 0;
break;
default:
super->action = 5;
super->field_0xf = 4;
sub_08033174(this);
break;
}
}
}
void sub_08032D3C(MulldozerEntity* this) {
if (--super->field_0xf == 0) {
super->field_0xf = 2;
super->animationState = (super->animationState + 1) & 7;
sub_08032F24(this);
sub_080331E8(this);
}
sub_08001324(super);
}
void nullsub_157(MulldozerEntity* this) {
}
void Mulldozer_Init(MulldozerEntity* this) {
sub_0804A720(super);
sub_08033058(this);
}
void Mulldozer_Action1(MulldozerEntity* this) {
if (--super->actionDelay == 0) {
sub_080330C0(this);
} else {
if (sub_08033364(this) != 0) {
sub_08033100(this);
}
}
sub_08032F64(this);
}
void Mulldozer_Action2(MulldozerEntity* this) {
if (--super->actionDelay == 0) {
sub_08033058(this);
}
sub_08032F48(this);
}
void Mulldozer_Action3(MulldozerEntity* this) {
if (--super->actionDelay == 0) {
super->action = 4;
super->field_0xf = 8;
super->speed = 0x1e0;
sub_080331B4(this);
if ((this->unk_82 & 0x80) != 0) {
super->direction = (super->direction + 0x1c) & 0x1c;
this->unk_82 = this->unk_82 & 0x7f;
} else {
super->direction = (super->direction + 4) & 0x1c;
this->unk_82 = this->unk_82 | 0x80;
}
super->animationState = super->direction >> 2;
InitializeAnimation(super, super->animationState + 4);
} else {
sub_08032F90(this);
sub_080331E8(this);
sub_08032F64(this);
}
}
void Mulldozer_Action4(MulldozerEntity* this) {
if (--super->actionDelay == 0) {
super->action = 5;
super->field_0xf = 4;
sub_08033174(this);
} else {
sub_08033000(this);
sub_080331E8(this);
sub_08032F64(this);
}
}
void Mulldozer_Action5(MulldozerEntity* this) {
if (--super->actionDelay == 0) {
sub_08033320(this);
sub_080330C0(this);
} else if ((super->type == 0) && (--super->field_0xf == 0)) {
super->field_0xf = 4;
sub_080332A8(this);
}
sub_080331E8(this);
ProcessMovement(super);
}
void Mulldozer_Action6(MulldozerEntity* this) {
ProcessMovement(super);
sub_08032F48(this);
if (--super->field_0xf == 0) {
super->field_0xf = 2;
super->animationState = (super->animationState + 1) & 7;
sub_08032F24(this);
sub_080331E8(this);
}
if (--super->actionDelay == 0) {
super->action = 5;
super->field_0xf = 4;
sub_08033174(this);
}
}
void sub_08032F24(MulldozerEntity* this) {
u32 tmpA;
u32 tmpB;
if (this->unk_80 == 0) {
tmpA = 0;
tmpB = super->animationState >> 1;
} else {
tmpA = 4;
tmpB = super->animationState;
}
InitializeAnimation(super, tmpA + tmpB);
}
void sub_08032F48(MulldozerEntity* this) {
if (this->unk_80 == 2) {
GetNextFrame(super);
}
GetNextFrame(super);
}
void sub_08032F64(MulldozerEntity* this) {
if (super->collisions != 0) {
sub_0800417E(super, super->collisions);
super->animationState = super->direction >> 2;
sub_08032F24(this);
}
sub_08032F48(this);
ProcessMovement(super);
}
void sub_08032F90(MulldozerEntity* this) {
if (super->type == 0) {
if (super->actionDelay == 0x10) {
this->unk_80 = 2;
}
if (--super->field_0xf == 0) {
super->field_0xf = 8;
sub_08033280(this);
}
} else {
if (--super->field_0xf == 0) {
super->field_0xf = 4;
if ((this->unk_82 & 0x80) != 0) {
super->direction = (super->direction + 0x1c) & 0x1c;
} else {
super->direction = (super->direction + 4) & 0x1c;
}
super->animationState = super->direction >> 2;
InitializeAnimation(super, super->animationState + 4);
}
}
}
void sub_08033000(MulldozerEntity* this) {
if (--super->field_0xf == 0) {
super->field_0xf = 0x10;
if ((this->unk_82 & 0x80) != 0) {
super->direction = (super->direction + 0x18) & 0x1c;
this->unk_82 &= 0x7f;
} else {
super->direction = (super->direction + 8) & 0x1c;
this->unk_82 |= 0x80;
}
super->animationState = super->direction >> 2;
InitializeAnimation(super, super->animationState + 4);
}
}
void sub_08033058(MulldozerEntity* this) {
u32 uVar2;
u32 uVar3;
super->action = 1;
this->unk_80 = 1;
super->actionDelay = gUnk_080CEA50[Random() & 3];
if ((sub_08049FA0(super) == 0) && ((Random() & 3) != 0)) {
uVar2 = sub_08049EE4(super);
uVar3 = Random();
super->direction = (gUnk_080CEA54[uVar3 & 1] + uVar2) & 0x18;
} else {
super->direction = (Random()) & 0x18;
}
super->animationState = super->direction >> 2;
sub_08032F24(this);
}
void sub_080330C0(MulldozerEntity* this) {
super->action = 2;
this->unk_80 = 0;
if (super->type == 0) {
super->actionDelay = (Random() & 0x38) + 0x18;
} else {
super->actionDelay = 6;
}
super->speed = 0x60;
super->direction = (super->direction + 4) & 0x18;
super->animationState = super->direction >> 2;
sub_08032F24(this);
}
void sub_08033100(MulldozerEntity* this) {
super->action = 3;
if (super->type == 0) {
this->unk_80 = 1;
super->actionDelay = 0x30;
super->field_0xf = 8;
super->speed = 0;
super->direction = (sub_08049F84(super, 1) + 2) & 0x1c;
} else {
this->unk_80 = 2;
sub_080331B4(this);
super->actionDelay += 0x10;
super->field_0xf = 4;
super->speed = 0x160;
}
this->unk_83 = 0;
this->unk_82 = Random() & 0x80;
super->animationState = super->direction >> 2;
sub_08032F24(this);
}
void sub_08033174(MulldozerEntity* this) {
this->unk_80 = 1;
this->unk_81 = super->direction;
this->unk_82 = 0;
this->unk_83 = 0;
if (super->type == 0) {
super->actionDelay = (Random() & 0x18) + 0x18;
} else {
super->actionDelay = 0xc;
}
super->speed = 0xa0;
sub_08032F24(this);
}
void sub_080331B4(MulldozerEntity* this) {
u32 rand = Random() & 0xf0;
u8 actionDelay = 0x1e;
if ((rand & 0x80) != 0) {
actionDelay = 0x3c;
} else {
if ((rand & 0x40) != 0) {
actionDelay = 0x2d;
}
if ((rand & 0x20) != 0) {
actionDelay = 0x4b;
}
}
super->actionDelay = actionDelay;
}
void sub_080331E8(MulldozerEntity* this) {
bool32 createEffect;
u32 unaff_r6;
const s8* ptr;
createEffect = FALSE;
if (super->action != 5) {
this->unk_83 = this->unk_83 + 1U;
if (this->unk_80 != 2) {
this->unk_83 &= 0xf;
} else {
this->unk_83 &= 0x7;
}
if (this->unk_83 == 0) {
createEffect = TRUE;
unaff_r6 = super->animationState << 1;
}
} else {
this->unk_83 = (this->unk_83 + 1) & 0xf;
if (this->unk_83 == 0) {
createEffect = TRUE;
unaff_r6 = super->direction >> 1;
}
}
if (createEffect) {
Entity* effect = CreateFx(super, 2, 0x40);
if (effect != NULL) {
ptr = &gUnk_080CEA56[unaff_r6];
super->frame ^= 0x20;
effect->x.HALF.HI += ptr[0];
effect->y.HALF.HI += ptr[1];
EnqueueSFX(SFX_BUTTON_PRESS);
}
}
}
void sub_08033280(MulldozerEntity* this) {
u32 direction;
super->direction = (sub_08049F84(super, 1) + 2) & 0x1c;
direction = super->direction >> 2;
if (direction != super->animationState) {
super->animationState = direction;
InitializeAnimation(super, direction + 4);
}
}
void sub_080332A8(MulldozerEntity* this) {
s32 oldDirection = super->direction;
super->direction = this->unk_81;
sub_08004596(super, sub_08049F84(super, 1));
this->unk_81 = super->direction;
super->direction = oldDirection;
oldDirection = ((this->unk_81 + 2) & 0x1c) >> 2;
if (oldDirection != super->animationState) {
sub_080332E8(this, oldDirection);
}
}
void sub_080332E8(MulldozerEntity* this, s32 param_2) {
s32 tmp;
this->unk_82 = 0;
tmp = param_2 - super->animationState;
if (tmp >= 1) {
if (tmp < 5) {
this->unk_82 = 1;
} else {
this->unk_82 = 2;
}
} else {
if (tmp < -4) {
this->unk_82 = 1;
} else {
this->unk_82 = 2;
}
}
super->animationState = param_2;
InitializeAnimation(super, param_2 + 4);
}
void sub_08033320(MulldozerEntity* this) {
u32 bVar4;
int temp;
bVar4 = super->animationState * 4;
if ((bVar4 & 4) != 0) {
switch (this->unk_82 & 3) {
case 1:
temp = 4;
break;
case 2:
temp = 0x1c;
break;
default:
temp = ((Random() & 0x10)) ? 4 : 0x1c;
break;
}
super->direction = (temp + bVar4) & 0x18;
} else {
super->direction = bVar4;
}
}
ASM_FUNC("asm/non_matching/mulldozer/sub_08033364.inc", bool32 sub_08033364(MulldozerEntity* this))
void (*const Mulldozer_Functions[])(MulldozerEntity*) = {
Mulldozer_OnInit,
sub_08032CAC,
sub_08032D3C,
(void (*)(MulldozerEntity*))sub_0804A7D4,
(void (*)(MulldozerEntity*))sub_08001242,
nullsub_157,
};
void (*const Mulldozer_Actions[])(MulldozerEntity*) = {
Mulldozer_Init, Mulldozer_Action1, Mulldozer_Action2, Mulldozer_Action3,
Mulldozer_Action4, Mulldozer_Action5, Mulldozer_Action6,
};
const u8 gUnk_080CEA50[] = {
30,
45,
60,
90,
};
const u8 gUnk_080CEA54[] = {
252,
4,
};
const s8 gUnk_080CEA56[] = { 0, 6, -3, 3, -6, 0, -3, -3, 0, -6, 3, -3, 6, 0, 3, 3 };