mirror of https://github.com/zeldaret/tmc.git
Rope and RopeGolden
This commit is contained in:
parent
2ad520100d
commit
0748c59ff2
|
@ -0,0 +1,112 @@
|
|||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "sprite.h"
|
||||
#include "functions.h"
|
||||
#include "enemy.h"
|
||||
|
||||
extern void (*const gUnk_080012C8[])(Entity*);
|
||||
extern void (*const gUnk_080CF4C8[6])(Entity*);
|
||||
extern void (*const gUnk_080CF4E0[4])(Entity*);
|
||||
|
||||
extern s32 sub_080012DC(Entity*);
|
||||
extern void SetGlobalFlag(u32);
|
||||
extern u32 CheckGlobalFlag(u32);
|
||||
extern u32 sub_0804A044(Entity*, Entity*, u32);
|
||||
|
||||
void sub_080383AC(Entity*);
|
||||
void sub_080383E4(Entity*);
|
||||
|
||||
void RopeGolden(Entity* this) {
|
||||
u32 x;
|
||||
x = sub_080012DC(this);
|
||||
if (x != 0) {
|
||||
gUnk_080012C8[x](this);
|
||||
} else {
|
||||
gUnk_080CF4C8[GetNextFunction(this)](this);
|
||||
SetChildOffset(this, 0, 1, -0x10);
|
||||
}
|
||||
}
|
||||
|
||||
void RopeGolden_OnTick(Entity* this) {
|
||||
gUnk_080CF4E0[this->action](this);
|
||||
}
|
||||
|
||||
void sub_08038210(Entity* this) {
|
||||
if (this->field_0x43 != 0) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
}
|
||||
sub_0804AA30(this, gUnk_080CF4C8);
|
||||
}
|
||||
|
||||
void sub_08038234(Entity* this) {
|
||||
if ((this->field_0x3a & 2) == 0) {
|
||||
SetGlobalFlag(this->type2);
|
||||
}
|
||||
CreateDeathFx(this, 0xff, 0x58);
|
||||
}
|
||||
|
||||
void sub_08038258(Entity* this) {
|
||||
if (CheckGlobalFlag(this->type2) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
sub_0804A720(this);
|
||||
this->animationState = 0xff;
|
||||
sub_080383AC(this);
|
||||
}
|
||||
|
||||
void sub_0803827C(Entity* this) {
|
||||
if (this->field_0xf != 0) {
|
||||
this->field_0xf--;
|
||||
} else {
|
||||
if ((sub_0804A044(this, &gPlayerEntity, 0x8) != 0xff) ||
|
||||
(sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x24) != 0)) {
|
||||
sub_080383E4(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
UpdateAnimationVariableFrames(this, 0x2);
|
||||
if (ProcessMovement(this) == 0) {
|
||||
sub_080383AC(this);
|
||||
} else {
|
||||
if (!(--this->actionDelay)) {
|
||||
sub_080383AC(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080382EC(Entity* this) {
|
||||
if (!(--this->actionDelay)) {
|
||||
this->action = 3;
|
||||
}
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/ropeGolden/sub_08038304.inc", void sub_08038304(Entity* this)) {
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void sub_080383AC(Entity* this) {
|
||||
u32 v;
|
||||
this->action = 1;
|
||||
this->actionDelay = 0x8;
|
||||
this->nonPlanarMovement = 0x100;
|
||||
this->direction = DirectionRoundUp(GetFacingDirection(this, &gPlayerEntity));
|
||||
v = this->direction >> 3;
|
||||
if (v != this->animationState) {
|
||||
this->animationState = v;
|
||||
InitializeAnimation(this, v);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080383E4(Entity* this) {
|
||||
u32 v;
|
||||
this->action = 2;
|
||||
this->actionDelay = 0x8;
|
||||
this->nonPlanarMovement = 0x280;
|
||||
v = DirectionRoundUp(GetFacingDirection(this, &gPlayerEntity));
|
||||
this->direction = v;
|
||||
this->field_0x78.HALF.LO = v;
|
||||
this->animationState = this->direction >> 3;
|
||||
this->field_0x78.HALF.HI = 0xff;
|
||||
this->field_0x7a.HALF.LO = -1;
|
||||
InitializeAnimation(this, this->animationState + 4);
|
||||
}
|
|
@ -0,0 +1,180 @@
|
|||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "sprite.h"
|
||||
#include "functions.h"
|
||||
#include "enemy.h"
|
||||
|
||||
extern void (*const gRope[6])(Entity*);
|
||||
extern void (*const gUnk_080CE460[4])(Entity*);
|
||||
extern void (*const gUnk_080CE470[3])(Entity*);
|
||||
extern Entity* gUnk_020000B0;
|
||||
extern u32 sub_0804A044();
|
||||
|
||||
void sub_08031600();
|
||||
u32 sub_0803163C();
|
||||
|
||||
void Rope(Entity* this) {
|
||||
EnemyFunctionHandler(this, gRope);
|
||||
SetChildOffset(this, 0, 1, -16);
|
||||
}
|
||||
|
||||
void Rope_OnTick(Entity* this) {
|
||||
gUnk_080CE460[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080313AC(Entity* this) {
|
||||
if (this->action == 3) {
|
||||
this->field_0xf = 0x1e;
|
||||
this->field_0x78.HALF.LO = 0x3c;
|
||||
sub_08031600(this);
|
||||
}
|
||||
if (this->field_0x43) {
|
||||
sub_0804A9FC(this, 0x1c);
|
||||
}
|
||||
sub_0804AA30(this, gRope);
|
||||
}
|
||||
|
||||
void sub_080313E8(Entity* this) {
|
||||
if (sub_0806F520()) {
|
||||
gUnk_080CE470[this->previousActionFlag](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0803140C(Entity* this) {
|
||||
this->previousActionFlag = 1;
|
||||
this->field_0x1d = 0x3c;
|
||||
}
|
||||
|
||||
void sub_08031418(Entity* this) {
|
||||
sub_0806F4E8(this);
|
||||
}
|
||||
|
||||
void sub_08031420(Entity* this) {
|
||||
if (sub_0806F3E4(this)) {
|
||||
sub_0804A7D4(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031434(Entity* this) {
|
||||
|
||||
sub_0804A720(this);
|
||||
this->animationState = 0xff;
|
||||
this->field_0x1c = 1;
|
||||
this->field_0x7a.HWORD = this->nonPlanarMovement;
|
||||
if (!(this->type)) {
|
||||
sub_08031600(this);
|
||||
} else {
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 0;
|
||||
this->spriteSettings.b.draw = (this->spriteSettings.b.draw & 0xfc);
|
||||
this->height.HALF.HI = -0x80;
|
||||
this->frameIndex = 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031480(Entity* this) {
|
||||
if (this->previousActionFlag == 0) {
|
||||
if (this->actionDelay != 0) {
|
||||
this->actionDelay--;
|
||||
} else {
|
||||
sub_08031600(this);
|
||||
this->action = 1;
|
||||
this->previousActionFlag = 1;
|
||||
this->spriteSettings.b.draw = 3;
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
PlaySFX(0x12d);
|
||||
}
|
||||
} else {
|
||||
if (sub_08003FC4(this, 0x1800) == 0) {
|
||||
this->action = 2;
|
||||
this->field_0xf = 0xf;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
EnqueueSFX(0x84);
|
||||
}
|
||||
}
|
||||
}
|
||||
void sub_080314FC(Entity* this) {
|
||||
u32 u;
|
||||
|
||||
GetNextFrame(this);
|
||||
if (this->field_0xf) {
|
||||
this->field_0xf--;
|
||||
} else {
|
||||
if (this->field_0x78.HALF.LO) {
|
||||
this->field_0x78.HALF.LO--;
|
||||
}
|
||||
if (sub_08049FA0(this)) {
|
||||
if (!(this->field_0x78.HALF.LO)) {
|
||||
if (sub_08049FDC(this, 1)) {
|
||||
u = sub_0804A044(this, gUnk_020000B0, 0xc);
|
||||
if (u != 0xff) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 0x1e;
|
||||
this->field_0x7a.HWORD = this->nonPlanarMovement = 0x1a0;
|
||||
this->direction = u;
|
||||
this->animationState = this->direction >> 3;
|
||||
InitializeAnimation(this, this->animationState + 4);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ((Random() & 1)) {
|
||||
this->direction = DirectionRoundUp(sub_08049EE4(this));
|
||||
u = this->direction >> 3;
|
||||
if (u != this->animationState) {
|
||||
this->animationState = u;
|
||||
InitializeAnimation(this, u);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(--this->actionDelay)) {
|
||||
sub_08031600(this);
|
||||
}
|
||||
sub_0803163C(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080315BC(Entity* this) {
|
||||
if (this->actionDelay) {
|
||||
this->actionDelay--;
|
||||
UpdateAnimationVariableFrames(this, 2);
|
||||
} else {
|
||||
if (sub_08049FA0(this)) {
|
||||
GetNextFrame(this);
|
||||
if (sub_0803163C(this)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this->field_0x78.HALF.LO = 0x1e;
|
||||
sub_08031600(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08031600(Entity* this) {
|
||||
u32 r;
|
||||
this->action = 2;
|
||||
this->actionDelay = (Random() & 0x30) + 0x3c;
|
||||
this->nonPlanarMovement = 0x80;
|
||||
this->field_0x7a.HWORD = 0x80;
|
||||
r = Random() & 0x18;
|
||||
this->direction = r;
|
||||
r = r / 8;
|
||||
if (r != this->animationState) {
|
||||
this->animationState = r;
|
||||
InitializeAnimation(this, r);
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_0803163C(Entity* this) {
|
||||
u32 h;
|
||||
if (sub_080002B8(this) == 0x13) {
|
||||
h = this->field_0x7a.HWORD / 2;
|
||||
} else {
|
||||
h = this->field_0x7a.HWORD;
|
||||
}
|
||||
this->nonPlanarMovement = h;
|
||||
return ProcessMovement(this);
|
||||
}
|
Loading…
Reference in New Issue