mirror of https://github.com/zeldaret/tmc.git
decomp vaati reborn
This commit is contained in:
parent
998fabb9b2
commit
30dc95e512
|
@ -0,0 +1,53 @@
|
|||
.syntax unified
|
||||
push {r4, r5, lr}
|
||||
adds r4, r0, #0
|
||||
movs r5, #0
|
||||
adds r0, #0x75
|
||||
ldrb r0, [r0]
|
||||
cmp r0, #2
|
||||
beq _0803E046
|
||||
bl Random
|
||||
movs r1, #1
|
||||
ands r1, r0
|
||||
cmp r1, #0
|
||||
beq _0803E046
|
||||
movs r0, #0
|
||||
b _0803E082
|
||||
_0803E046:
|
||||
adds r0, r4, #0
|
||||
adds r0, #0x77
|
||||
ldrb r0, [r0]
|
||||
cmp r0, #1
|
||||
bne _0803E080
|
||||
ldr r2, _0803E084 @ =gRoomControls
|
||||
ldrh r0, [r2, #6]
|
||||
adds r1, r0, #0
|
||||
adds r1, #0x58
|
||||
ldr r0, _0803E088 @ =gPlayerEntity
|
||||
movs r3, #0x2e
|
||||
ldrsh r0, [r0, r3]
|
||||
cmp r1, r0
|
||||
bgt _0803E080
|
||||
ldrh r2, [r2, #8]
|
||||
adds r1, r2, #0
|
||||
adds r1, #0x58
|
||||
cmp r1, r0
|
||||
bgt _0803E080
|
||||
adds r1, r2, #0
|
||||
adds r1, #0xf8
|
||||
cmp r1, r0
|
||||
blt _0803E080
|
||||
adds r1, r4, #0
|
||||
adds r1, #0x81
|
||||
ldrb r0, [r1]
|
||||
adds r0, #5
|
||||
strb r0, [r1]
|
||||
movs r5, #1
|
||||
_0803E080:
|
||||
adds r0, r5, #0
|
||||
_0803E082:
|
||||
pop {r4, r5, pc}
|
||||
.align 2, 0
|
||||
_0803E084: .4byte gRoomControls
|
||||
_0803E088: .4byte gPlayerEntity
|
||||
.syntax divided
|
File diff suppressed because it is too large
Load Diff
|
@ -1,23 +0,0 @@
|
|||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.section .rodata
|
||||
.align 2
|
||||
|
||||
gUnk_080D04A8:: @ 080D04A8
|
||||
.incbin "baserom.gba", 0x0D04A8, 0x0000004
|
||||
|
||||
gUnk_080D04AC:: @ 080D04AC
|
||||
.incbin "baserom.gba", 0x0D04AC, 0x0000014
|
||||
|
||||
gUnk_080D04C0:: @ 080D04C0
|
||||
.incbin "baserom.gba", 0x0D04C0, 0x0000008
|
||||
|
||||
gUnk_080D04C8:: @ 080D04C8
|
||||
.incbin "baserom.gba", 0x0D04C8, 0x0000008
|
||||
|
||||
gUnk_080D04D0:: @ 080D04D0
|
||||
.incbin "baserom.gba", 0x0D04D0, 0x0000003
|
||||
|
||||
gUnk_080D04D3:: @ 080D04D3
|
||||
.incbin "baserom.gba", 0x0D04D3, 0x0000004
|
|
@ -417,7 +417,6 @@ SECTIONS {
|
|||
src/enemy/lakituCloud.o(.text);
|
||||
asm/enemy49.o(.text);
|
||||
src/enemy/vaatiRebornEnemy.o(.text);
|
||||
asm/vaatiRebornEnemy.o(.text);
|
||||
src/enemy/vaatiProjectile.o(.text);
|
||||
asm/ballChainSoldier.o(.text);
|
||||
src/enemy/enemy4D.o(.text);
|
||||
|
@ -1122,7 +1121,6 @@ SECTIONS {
|
|||
src/enemy/lakituCloud.o(.rodata);
|
||||
data/const/enemy/enemy49.o(.rodata);
|
||||
src/enemy/vaatiRebornEnemy.o(.rodata);
|
||||
data/const/enemy/vaatiRebornEnemy.o(.rodata);
|
||||
data/animations/enemy/vaatiRebornEnemy.o(.rodata);
|
||||
src/enemy/vaatiProjectile.o(.rodata);
|
||||
data/animations/enemy/vaatiProjectile.o(.rodata);
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
#include "flags.h"
|
||||
#include "random.h"
|
||||
#include "audio.h"
|
||||
#include "area.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern u32 __modsi3(u32, u32);
|
||||
extern void sub_080AEFB4(Entity*);
|
||||
extern u8 gEntCount;
|
||||
|
||||
|
@ -29,6 +29,7 @@ void sub_0803DBB8(Entity*);
|
|||
void sub_0803DD78(Entity*);
|
||||
u32 sub_0803DEE0(Entity*);
|
||||
u32 sub_0803E028(Entity*);
|
||||
void sub_0803DC0C(Entity*);
|
||||
|
||||
typedef struct xy {
|
||||
s8 x;
|
||||
|
@ -51,8 +52,16 @@ void (*const gUnk_080D04A0[])(Entity*) = {
|
|||
sub_0803DBB8,
|
||||
};
|
||||
|
||||
extern const xy gUnk_080D04A8[];
|
||||
extern const Coords gUnk_080D04AC[];
|
||||
const xy gUnk_080D04A8[] = { { 16, -43 }, { -16, -43 } };
|
||||
const Coords gUnk_080D04AC[] = { { .HALF = { 0x58, 0x60 } },
|
||||
{ .HALF = { 0x58, 0x90 } },
|
||||
{ .HALF = { 0x98, 0x78 } },
|
||||
{ .HALF = { 0xd8, 0x60 } },
|
||||
{ .HALF = { 0xd8, 0x90 } } };
|
||||
const u8 gUnk_080D04C0[] = { 2, 0, 0, 2, 2, 2, 4, 4 };
|
||||
const xy gUnk_080D04C8[] = { { 10, -29 }, { -10, -29 }, { 15, -21 }, { -15, -21 } };
|
||||
const u8 gUnk_080D04D0[] = { -24, -40, -48 };
|
||||
const u8 gUnk_080D04D3[] = { 0, 1, 0, -1 };
|
||||
|
||||
void VaatiRebornEnemy(Entity* this) {
|
||||
switch (this->type) {
|
||||
|
@ -231,8 +240,10 @@ void sub_0803D408(Entity* this) {
|
|||
if (--this->actionDelay == 0) {
|
||||
this->field_0x74.HALF.LO++;
|
||||
if (sub_0803E028(this) == 0) {
|
||||
s32 tmp;
|
||||
this->field_0x80.HALF.HI += 1 + (Random() & 3);
|
||||
this->field_0x80.HALF.HI = __modsi3(this->field_0x80.HALF.HI, 5);
|
||||
tmp = this->field_0x80.HALF.HI;
|
||||
this->field_0x80.HALF.HI = tmp % 5;
|
||||
ptr = &gUnk_080D04AC[this->field_0x80.HALF.HI];
|
||||
this->x.HALF.HI = gRoomControls.roomOriginX + ptr->HALF.x + 0x10;
|
||||
this->y.HALF.HI = gRoomControls.roomOriginY + ptr->HALF.y + 0x10;
|
||||
|
@ -263,3 +274,617 @@ void sub_0803D408(Entity* this) {
|
|||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void sub_0803D560(Entity* this) {
|
||||
u8 temp;
|
||||
|
||||
switch (this->field_0x74.HALF.LO) {
|
||||
case 0xfe:
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->actionDelay = 1;
|
||||
break;
|
||||
case 0xff:
|
||||
if (this->height.HALF.HI != -4) {
|
||||
this->height.WORD -= 0x2000;
|
||||
}
|
||||
if (this->actionDelay == 2) {
|
||||
this->field_0x74.HALF.LO = 0xfe;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
if (--this->actionDelay == 0) {
|
||||
this->field_0x74.HALF.LO++;
|
||||
if ((this->field_0x74.HALF.HI & 0x80) != 0) {
|
||||
temp = 0x14;
|
||||
} else {
|
||||
temp = 0x20;
|
||||
}
|
||||
this->actionDelay = temp;
|
||||
this->field_0x80.HALF.LO = ((this->field_0x86.HALF.LO + 1) >> 1) * 2 + 2;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (--this->actionDelay == 0) {
|
||||
this->field_0x74.HALF.LO++;
|
||||
if ((this->field_0x74.HALF.HI & 0x80) == 0) {
|
||||
SoundReq(SFX_1B0);
|
||||
}
|
||||
InitAnimationForceUpdate(this, 1);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if ((this->frames.all & 0x80) != 0) {
|
||||
this->field_0x74.HALF.LO = 3;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
this->action = 1;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->actionDelay = 1;
|
||||
break;
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void sub_0803D658(Entity* this) {
|
||||
u32 index;
|
||||
Entity* entity;
|
||||
|
||||
if (--this->actionDelay == 0) {
|
||||
this->action = 1;
|
||||
this->cutsceneBeh.HALF.LO = 0xff;
|
||||
this->actionDelay = 1;
|
||||
this->direction = (this->direction + 0x10) & 0x1f;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
} else {
|
||||
if ((this->frames.all & 0x10) != 0) {
|
||||
this->frames.all &= 0xef;
|
||||
if (this->cutsceneBeh.HALF.LO == 0xff) {
|
||||
index = Direction8RoundUp(GetFacingDirection(this, &gPlayerEntity));
|
||||
this->cutsceneBeh.HALF.LO = gUnk_080D04C0[index >> 2];
|
||||
this->field_0xf = 0;
|
||||
}
|
||||
if ((this->field_0xf < 0x10) &&
|
||||
(entity = sub_0804A98C(this, 0x1a, this->cutsceneBeh.HALF.LO), entity != NULL)) {
|
||||
entity->field_0xf = this->field_0xf;
|
||||
entity->parent = this;
|
||||
entity->height.HALF.HI = this->height.HALF.HI;
|
||||
this->field_0xf = this->field_0xf + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void sub_0803D700(Entity* this) {
|
||||
u32 uVar3;
|
||||
|
||||
if (this->field_0x80.HALF.LO == 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 1;
|
||||
this->direction = 0xff;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (this->field_0x74.HALF.LO) {
|
||||
case 0:
|
||||
if (--this->field_0xf == 0) {
|
||||
this->field_0x74.HALF.LO++;
|
||||
InitAnimationForceUpdate(this, 1);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if ((this->frames.all & 0x10) != 0) {
|
||||
this->field_0x74.HALF.LO = 2;
|
||||
this->field_0xf = (Random() & 0x3f) + 0x40;
|
||||
SoundReq(SFX_SUMMON);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (--this->field_0xf == 0) {
|
||||
if (!((this->field_0x86.HALF.LO < 2) || (3 < this->field_0x86.HALF.HI)) && (Random() & 0x10) != 0) {
|
||||
this->field_0x86.HALF.HI++;
|
||||
this->field_0xf = (Random() & 0x3f) + 0x40;
|
||||
uVar3 = GetFacingDirection(this, &gPlayerEntity);
|
||||
this->direction = (uVar3 & 0x10) | 8;
|
||||
} else {
|
||||
this->field_0x74.HALF.LO++;
|
||||
this->field_0x86.HALF.HI = 0;
|
||||
this->field_0xf = 0x30;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (--this->field_0xf == 0) {
|
||||
this->action = 1;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->actionDelay = 1;
|
||||
this->direction = 0xff;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->field_0x86.HALF.HI != 0) {
|
||||
sub_080AEFB4(this);
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void sub_0803D830(Entity* this) {
|
||||
Entity* target;
|
||||
|
||||
if (this->field_0x80.HALF.LO == 0) {
|
||||
this->action = 1;
|
||||
this->actionDelay = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
switch (this->field_0x74.HALF.LO) {
|
||||
case 0:
|
||||
if (this->actionDelay != 0) {
|
||||
this->field_0x74.HALF.LO = 1;
|
||||
this->actionDelay = 0x70;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (--this->actionDelay == 0) {
|
||||
this->field_0x74.HALF.LO++;
|
||||
SoundReq(SFX_150);
|
||||
target = sub_0804A98C(this, 0x18, 0);
|
||||
if (target != NULL) {
|
||||
PositionRelative(this, target, 0, -0x100000);
|
||||
target->parent = this;
|
||||
}
|
||||
} else if (this->actionDelay == 0x40) {
|
||||
SoundReq(SFX_196);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (this->field_0xf != 0) {
|
||||
this->field_0xf = 0;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (this->field_0xf == 0) {
|
||||
this->field_0xf = 1;
|
||||
SoundReq(SFX_14F);
|
||||
}
|
||||
if (this->actionDelay) {
|
||||
this->action = 1;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->actionDelay = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void sub_0803D8FC(Entity* this) {
|
||||
Entity* fx;
|
||||
u32 tmp;
|
||||
|
||||
if (this->actionDelay != 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
SetRoomFlag(1);
|
||||
} else {
|
||||
if ((this->actionDelay & 7) == 0) {
|
||||
fx = CreateFx(this, 2, 0);
|
||||
if (fx != NULL) {
|
||||
tmp = Random() & 0x3f3f;
|
||||
fx->x.HALF.HI = ((tmp & 0xff) - 0x20) + fx->x.HALF.HI;
|
||||
fx->y.HALF.HI = ((tmp >> 8) & 0xff) - 0x20 + fx->y.HALF.HI;
|
||||
fx->spritePriority.b0 = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803D974(Entity* this) {
|
||||
Entity* enemy;
|
||||
|
||||
this->action = 1;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->field_0x74.HALF.HI = 1;
|
||||
this->actionDelay = 0;
|
||||
this->spriteOffsetY = -1;
|
||||
PositionRelative(this->parent, this, 0, 0x10000);
|
||||
enemy = CreateEnemy(VAATI_REBORN_ENEMY, 2);
|
||||
enemy->parent = this;
|
||||
enemy->attachedEntity = this->parent;
|
||||
InitAnimationForceUpdate(this, this->field_0x74.HALF.LO);
|
||||
}
|
||||
|
||||
void sub_0803D9BC(Entity* this) {
|
||||
Entity* parent;
|
||||
|
||||
parent = this->parent;
|
||||
if (this->field_0x74.HALF.LO == 0) {
|
||||
if (parent->field_0x80.HALF.LO == 0) {
|
||||
this->field_0x74.HALF.LO = 1;
|
||||
this->damageType = 0x30;
|
||||
InitAnimationForceUpdate(this, this->field_0x74.HALF.LO);
|
||||
}
|
||||
} else {
|
||||
if (parent->field_0x80.HALF.LO != 0) {
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->damageType = 0x2f;
|
||||
InitAnimationForceUpdate(this, this->field_0x74.HALF.LO);
|
||||
} else {
|
||||
if (((this->bitfield & 0x80) != 0) && (0 < this->iframes)) {
|
||||
parent->iframes = this->iframes;
|
||||
parent->bitfield = this->bitfield;
|
||||
}
|
||||
if ((this->frames.all & 0x40) != 0) {
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this->field_0x74.HALF.HI == 0) {
|
||||
if (parent->action != 2) {
|
||||
this->field_0x74.HALF.HI = 1;
|
||||
this->flags |= 0x80;
|
||||
}
|
||||
} else {
|
||||
if (parent->action == 2) {
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->flags &= 0x7f;
|
||||
}
|
||||
}
|
||||
this->spriteSettings.b.draw = parent->spriteSettings.b.draw;
|
||||
this->spriteOffsetX = parent->spriteOffsetX;
|
||||
PositionRelative(this->parent, this, 0, 0x10000);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void sub_0803DAA8(Entity* this) {
|
||||
Entity* source;
|
||||
|
||||
source = this->parent->parent;
|
||||
this->action = 1;
|
||||
this->field_0x74.HALF.LO = 1;
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->spriteOffsetY = -2;
|
||||
this->direction = 0xff;
|
||||
PositionRelative(source, this, 0, 0x20000);
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
}
|
||||
|
||||
void sub_0803DAE4(Entity* this) {
|
||||
u8 bVar1;
|
||||
Entity* parent;
|
||||
|
||||
parent = this->parent;
|
||||
if (parent->field_0x74.HALF.LO == 0) {
|
||||
if (this->field_0x74.HALF.LO != 0) {
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
}
|
||||
bVar1 = parent->parent->direction;
|
||||
if (bVar1 != 0xff) {
|
||||
if (this->field_0x74.HALF.HI == 0) {
|
||||
this->field_0x74.HALF.HI = 1;
|
||||
}
|
||||
if (bVar1 != this->direction) {
|
||||
this->direction = bVar1;
|
||||
InitAnimationForceUpdate(this, bVar1 >> 3);
|
||||
}
|
||||
} else {
|
||||
if (this->field_0x74.HALF.HI != 0) {
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (this->field_0x74.HALF.LO == 0) {
|
||||
this->field_0x74.HALF.LO = 1;
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
}
|
||||
}
|
||||
this->spriteSettings.b.draw = parent->spriteSettings.b.draw;
|
||||
this->spriteOffsetX = parent->spriteOffsetX;
|
||||
PositionRelative(parent->parent, this, 0, 0x20000);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void sub_0803DB88(Entity* this) {
|
||||
this->action = 1;
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->direction = 0xff;
|
||||
this->spriteOffsetY = -1;
|
||||
InitAnimationForceUpdate(this, this->field_0x74.HALF.LO);
|
||||
sub_0803DC0C(this);
|
||||
}
|
||||
|
||||
void sub_0803DBB8(Entity* this) {
|
||||
Entity* parent = this->parent;
|
||||
|
||||
if (this->parent->direction != 0xff) {
|
||||
if (this->field_0x74.HALF.LO == 0) {
|
||||
this->field_0x74.HALF.LO = 1;
|
||||
}
|
||||
if (parent->direction != this->direction) {
|
||||
this->direction = parent->direction;
|
||||
InitAnimationForceUpdate(this, this->direction >> 3);
|
||||
}
|
||||
} else {
|
||||
if (this->field_0x74.HALF.LO != 0) {
|
||||
this->field_0x74.HALF.LO = 0;
|
||||
this->direction = 0xff;
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
}
|
||||
}
|
||||
sub_0803DC0C(this);
|
||||
}
|
||||
|
||||
void sub_0803DC0C(Entity* this) {
|
||||
Entity* parent;
|
||||
const xy* tmp;
|
||||
|
||||
parent = this->parent;
|
||||
tmp = &gUnk_080D04C8[this->actionDelay];
|
||||
this->spriteSettings.b.draw = parent->spriteSettings.b.draw;
|
||||
this->spriteOffsetX = parent->spriteOffsetX;
|
||||
PositionRelative(parent, this, tmp->x << 0x10, (tmp->y + 1) * 0x10000);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void sub_0803DC58(Entity* this) {
|
||||
Entity* parent;
|
||||
|
||||
if (this->damageType != 0x30) {
|
||||
return;
|
||||
}
|
||||
parent = this->parent;
|
||||
this->field_0x76.HALF.HI = 0;
|
||||
if ((this->bitfield & 0x80) != 0) {
|
||||
if (gUnk_080D04D0[parent->field_0x86.HALF.LO] > this->currentHealth) {
|
||||
if (2 < ++parent->field_0x86.HALF.LO) {
|
||||
this->flags &= 0x7f;
|
||||
parent->action = 7;
|
||||
parent->flags &= 0x7f;
|
||||
parent->actionDelay = 0x80;
|
||||
parent->spriteOffsetX = 0;
|
||||
parent->direction = -1;
|
||||
this->actionDelay = 0;
|
||||
SoundReq(0x80100000);
|
||||
gArea.musicIndex = gArea.pMusicIndex;
|
||||
return;
|
||||
}
|
||||
this->actionDelay = 1;
|
||||
this->field_0x76.HALF.HI = 0xff;
|
||||
}
|
||||
if (0 < this->iframes) {
|
||||
SoundReq(0x127);
|
||||
sub_08080964(0xc, 1);
|
||||
if (this->actionDelay == 0)
|
||||
this->actionDelay = 0x48;
|
||||
}
|
||||
}
|
||||
if (this->actionDelay != 0) {
|
||||
if (--this->actionDelay == 0) {
|
||||
this->damageType = 0x2f;
|
||||
this->field_0x74.HALF.LO = 1;
|
||||
if (this->field_0x76.HALF.HI == 0) {
|
||||
parent->field_0x74.HALF.LO = 0xf0;
|
||||
} else {
|
||||
parent->field_0x74.HALF.LO = 0x70;
|
||||
this->currentHealth = 0xff;
|
||||
}
|
||||
parent->action = 1;
|
||||
parent->actionDelay = 1;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803DD78(Entity* this) {
|
||||
u32 random_number;
|
||||
|
||||
random_number = ((u32)Random() & 0x7c) >> 2;
|
||||
|
||||
switch (this->field_0x86.HALF.LO) {
|
||||
case 0:
|
||||
if (this->field_0x80.HALF.LO == 0) {
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 0x50;
|
||||
break;
|
||||
}
|
||||
switch (this->field_0x82.HALF.HI) {
|
||||
case 0:
|
||||
case 2:
|
||||
case 4:
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 0x50;
|
||||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
case 5:
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
switch (this->field_0x82.HALF.HI) {
|
||||
case 1:
|
||||
case 3:
|
||||
case 5:
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
break;
|
||||
case 2:
|
||||
if ((random_number & 8) != 0) {
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
} else {
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 0x50;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if ((random_number & 8) != 0) {
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 0x50;
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
this->field_0x74.HALF.HI = 1;
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch (this->field_0x82.HALF.HI) {
|
||||
case 2:
|
||||
if ((random_number & 0xf) < 3) {
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
} else {
|
||||
this->field_0x74.HALF.HI = 1;
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
this->field_0x74.HALF.HI = 1;
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
break;
|
||||
case 4:
|
||||
if (9 < random_number) {
|
||||
this->field_0x74.HALF.HI = 2;
|
||||
this->field_0x76.HALF.HI = (Random() & 1) + 2;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
case 3:
|
||||
case 5:
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x76.HALF.HI = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this->field_0x82.HALF.HI = (this->field_0x82.HALF.HI + 1) % 6;
|
||||
}
|
||||
|
||||
u32 sub_0803DEE0(Entity* this) {
|
||||
u32 randomValue;
|
||||
u32 ret;
|
||||
|
||||
ret = 2;
|
||||
randomValue = (Random() & 0xf8) >> 3;
|
||||
if (this->field_0x80.HALF.LO) {
|
||||
switch (this->field_0x86.HALF.LO) {
|
||||
case 0:
|
||||
ret = this->field_0x82.HALF.LO & 1;
|
||||
this->field_0x82.HALF.LO = (this->field_0x82.HALF.LO + 1) & 3;
|
||||
break;
|
||||
case 1:
|
||||
switch (this->field_0x82.HALF.LO) {
|
||||
case 0:
|
||||
case 2:
|
||||
ret = 3;
|
||||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
ret = 1;
|
||||
break;
|
||||
case 4:
|
||||
if (randomValue & 8) {
|
||||
ret = 3;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
this->field_0x82.HALF.LO = (this->field_0x82.HALF.LO + 1) % 5;
|
||||
break;
|
||||
case 2:
|
||||
switch (this->field_0x82.HALF.LO) {
|
||||
case 0:
|
||||
case 3:
|
||||
ret = 3;
|
||||
break;
|
||||
case 1:
|
||||
ret = 0;
|
||||
if (randomValue > 5) {
|
||||
ret = 3;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
ret = 0;
|
||||
if (randomValue < 10) {
|
||||
ret = 3;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
ret = 0;
|
||||
break;
|
||||
default:
|
||||
ret = 2;
|
||||
}
|
||||
this->field_0x82.HALF.LO = (this->field_0x82.HALF.LO + 1) % 5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void sub_0803DFBC(Entity* this) {
|
||||
u32 bVar1;
|
||||
int iVar3;
|
||||
|
||||
if (this->action != 0) {
|
||||
*(u32*)&this->field_0x78 = this->x.WORD;
|
||||
this->field_0x7c = this->y;
|
||||
}
|
||||
if (this->field_0x76.HALF.LO == 0) {
|
||||
if ((this->direction == 0xff) || sub_08049FA0(this)) {
|
||||
if (this->field_0x80.HALF.LO == 0) {
|
||||
this->animationState = (this->animationState + 1) & 3;
|
||||
this->spriteOffsetX = gUnk_080D04D3[this->animationState];
|
||||
}
|
||||
return;
|
||||
}
|
||||
bVar1 = sub_08049EE4(this);
|
||||
this->direction = (bVar1 & 0x10) | 8;
|
||||
this->field_0x76.HALF.LO = 0x10;
|
||||
} else {
|
||||
this->field_0x76.HALF.LO--;
|
||||
}
|
||||
if (this->field_0x80.HALF.LO == 0) {
|
||||
this->animationState = (this->animationState + 1) & 3;
|
||||
this->spriteOffsetX = gUnk_080D04D3[this->animationState];
|
||||
}
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/vaati/sub_0803E028.inc", u32 sub_0803E028(Entity* this)) {
|
||||
u32 uVar4;
|
||||
u32 rx, ry, px;
|
||||
|
||||
uVar4 = 0;
|
||||
if ((this->field_0x74.HALF.HI != 2) && ((Random() & 1) != 0)) {
|
||||
return 0;
|
||||
}
|
||||
if (this->field_0x76.HALF.HI == 1) {
|
||||
if (gRoomControls.roomOriginX + 0x58 <= gPlayerEntity.x.HALF.HI) {
|
||||
if (gRoomControls.roomOriginY + 0x58 <= gPlayerEntity.x.HALF.HI) {
|
||||
if (gRoomControls.roomOriginY + 0xf8 >= gPlayerEntity.x.HALF.HI) {
|
||||
this->field_0x80.HALF.HI += 5;
|
||||
uVar4 = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return uVar4;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
|
Loading…
Reference in New Issue