mirror of https://github.com/zeldaret/tmc.git
Merge pull request #451 from EllipticEllipsis/fixes
Correct type of sub_0806F520 and use it as a bool, use new entity struct in coord.c
This commit is contained in:
commit
f4c932dc09
|
|
@ -163,7 +163,7 @@ extern void sub_08060158(Entity*);
|
|||
extern void sub_0806D02C(Entity*);
|
||||
extern void sub_0806D0B0(Entity*);
|
||||
extern void sub_0806F4E8(Entity*);
|
||||
extern u32 sub_0806F520();
|
||||
extern bool32 sub_0806F520(Entity*);
|
||||
extern u32 sub_0806F5B0(u32);
|
||||
extern u32 sub_0806F824(Entity*, Entity*, s32, s32);
|
||||
extern u32 sub_0806F948(Entity*);
|
||||
|
|
|
|||
34
src/coord.c
34
src/coord.c
|
|
@ -1,6 +1,8 @@
|
|||
#define NENT_DEPRECATED
|
||||
#include "asm.h"
|
||||
#include "area.h"
|
||||
#include "player.h"
|
||||
#include "new_player.h"
|
||||
#include "coord.h"
|
||||
#include "common.h"
|
||||
#include "sound.h"
|
||||
|
|
@ -38,7 +40,7 @@ void sub_0806F38C(void) {
|
|||
u32 sub_0806F39C(Entity* ent) {
|
||||
s32 dist;
|
||||
|
||||
if (gPlayerEntity.animationState & 2) {
|
||||
if (gNewPlayerEntity.base.animationState & 2) {
|
||||
dist = ent->x.HALF.HI - gPlayerEntity.x.HALF.HI;
|
||||
} else {
|
||||
dist = ent->y.HALF.HI - gPlayerEntity.y.HALF.HI;
|
||||
|
|
@ -55,7 +57,7 @@ u32 sub_0806F39C(Entity* ent) {
|
|||
}
|
||||
|
||||
bool32 sub_0806F3E4(Entity* ent) {
|
||||
Entity tmp_ent;
|
||||
GenericEntity tmp_ent;
|
||||
s8* p;
|
||||
|
||||
if ((gPlayerState.field_0x1c & 0x7F) != 1)
|
||||
|
|
@ -74,15 +76,15 @@ bool32 sub_0806F3E4(Entity* ent) {
|
|||
if (ent->knockbackSpeed > 0x500)
|
||||
ent->knockbackSpeed = 0x500;
|
||||
p = &gUnk_08126EE4[gPlayerEntity.animationState & 0xE];
|
||||
tmp_ent.x.HALF.HI = p[0] + gPlayerEntity.x.HALF.HI;
|
||||
tmp_ent.y.HALF.HI = p[1] + gPlayerEntity.y.HALF.HI;
|
||||
LinearMoveDirection(ent, ent->knockbackSpeed, GetFacingDirection(ent, &tmp_ent));
|
||||
if (sub_0800419C(&tmp_ent, ent, 4, 4)) {
|
||||
tmp_ent.base.x.HALF.HI = p[0] + gPlayerEntity.x.HALF.HI;
|
||||
tmp_ent.base.y.HALF.HI = p[1] + gPlayerEntity.y.HALF.HI;
|
||||
LinearMoveDirection(ent, ent->knockbackSpeed, GetFacingDirection(ent, &tmp_ent.base));
|
||||
if (sub_0800419C(&tmp_ent.base, ent, 4, 4)) {
|
||||
u32 state = ent->field_0x1c & 0xF;
|
||||
if (state == 2) {
|
||||
Entity* item;
|
||||
ent->subAction = 3;
|
||||
(Entity*)gPlayerEntity.field_0x70.WORD = ent;
|
||||
gNewPlayerEntity.unk_70 = ent;
|
||||
gPlayerState.field_0x1c = 7;
|
||||
item = CreatePlayerItem(0x11, 0, 0, 0);
|
||||
if (item != NULL) {
|
||||
|
|
@ -116,7 +118,7 @@ void sub_0806F4E8(Entity* ent) {
|
|||
}
|
||||
}
|
||||
|
||||
u32 sub_0806F520(Entity* ent) {
|
||||
bool32 sub_0806F520(Entity* ent) {
|
||||
if (ent->bitfield == 0x93)
|
||||
return 1;
|
||||
ent->field_0x3a &= ~4;
|
||||
|
|
@ -336,38 +338,38 @@ void SortEntityBelow(Entity* above_ent, Entity* below_ent) {
|
|||
below_ent->spritePriority.b0 = gSpriteSortBelowTable[above_ent->spritePriority.b0];
|
||||
}
|
||||
|
||||
void sub_0806FB00(Entity* ent, u32 param_1, u32 param_2, u32 param_3) {
|
||||
void sub_0806FB00(GenericEntity* ent, u32 param_1, u32 param_2, u32 param_3) {
|
||||
if (param_3 == 0) {
|
||||
param_3 = 1;
|
||||
}
|
||||
|
||||
ent->field_0x7c.BYTES.byte2 = 0;
|
||||
ent->field_0x7c.BYTES.byte3 = param_3;
|
||||
ent->field_0x80.HWORD = ent->x.HALF.HI;
|
||||
ent->field_0x82.HWORD = ent->y.HALF.HI;
|
||||
ent->field_0x80.HWORD = ent->base.x.HALF.HI;
|
||||
ent->field_0x82.HWORD = ent->base.y.HALF.HI;
|
||||
ent->cutsceneBeh.HWORD = param_1;
|
||||
ent->field_0x86.HWORD = param_2;
|
||||
}
|
||||
|
||||
bool32 sub_0806FB38(Entity* ent) {
|
||||
bool32 sub_0806FB38(GenericEntity* ent) {
|
||||
s32 val;
|
||||
u32 rv;
|
||||
if (ent->field_0x7c.BYTES.byte2 < ent->field_0x7c.BYTES.byte3) {
|
||||
ent->field_0x7c.BYTES.byte2++;
|
||||
ent->x.HALF.HI =
|
||||
ent->base.x.HALF.HI =
|
||||
((((((s16)ent->cutsceneBeh.HWORD - (s16)ent->field_0x80.HWORD) * ent->field_0x7c.BYTES.byte2) << 8) /
|
||||
ent->field_0x7c.BYTES.byte3) >>
|
||||
8) +
|
||||
ent->field_0x80.HWORD;
|
||||
ent->y.HALF.HI =
|
||||
ent->base.y.HALF.HI =
|
||||
(((((((s16)ent->field_0x86.HWORD - (s16)ent->field_0x82.HWORD) * ent->field_0x7c.BYTES.byte2) << 8) /
|
||||
ent->field_0x7c.BYTES.byte3) >>
|
||||
8)) +
|
||||
ent->field_0x82.HWORD;
|
||||
rv = 0;
|
||||
} else {
|
||||
ent->x.HALF.HI = ent->cutsceneBeh.HWORD;
|
||||
ent->y.HALF.HI = ent->field_0x86.HWORD;
|
||||
ent->base.x.HALF.HI = ent->cutsceneBeh.HWORD;
|
||||
ent->base.y.HALF.HI = ent->field_0x86.HWORD;
|
||||
rv = 1;
|
||||
}
|
||||
return rv;
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ void Chuchu_OnCollision(Entity* this) {
|
|||
}
|
||||
|
||||
void Chuchu_OnGrabbed(Entity* this) {
|
||||
if (sub_0806F520(this) == 0 && this->confusedTime) {
|
||||
if (!sub_0806F520(this) && this->confusedTime) {
|
||||
Create0x68FX(this, FX_STARS);
|
||||
InitializeAnimation(this, 6);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ void sub_08040D30(Enemy50Entity* this) {
|
|||
}
|
||||
|
||||
void sub_08040D90(Enemy50Entity* this) {
|
||||
if (sub_0806F520()) {
|
||||
if (sub_0806F520(super)) {
|
||||
Enemy50_SubActions[super->subAction](this);
|
||||
} else {
|
||||
sub_08041128(this);
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ void Ghini_OnConfused(GhiniEntity* this) {
|
|||
}
|
||||
|
||||
void Ghini_OnGrabbed(GhiniEntity* this) {
|
||||
if (sub_0806F520()) {
|
||||
if (sub_0806F520(super)) {
|
||||
Ghini_SubActions[super->subAction](this);
|
||||
} else {
|
||||
sub_0803F51C(this);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ void GyorgChild_OnGrabbed(GyorgChildEntity* this) {
|
|||
GyorgChild_OnGrabbed_Action1,
|
||||
GyorgChild_OnGrabbed_Action3,
|
||||
};
|
||||
if (sub_0806F520()) {
|
||||
if (sub_0806F520(super)) {
|
||||
GyorgChild_OnGrabbed_Actions[super->subAction](this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ void LakituCloud_OnKnockback(Entity* this) {
|
|||
}
|
||||
|
||||
void LakituCloud_OnGrabbed(Entity* this) {
|
||||
if (sub_0806F520(this) == 0) {
|
||||
if (!sub_0806F520(this)) {
|
||||
if (this->subAction == 2) {
|
||||
sub_0803CE3C(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ void Rope_OnCollision(Entity* this) {
|
|||
}
|
||||
|
||||
void Rope_OnGrabbed(Entity* this) {
|
||||
if (sub_0806F520()) {
|
||||
if (sub_0806F520(this)) {
|
||||
gUnk_080CE470[this->subAction](this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ void sub_08039418(StalfosEntity* this) {
|
|||
}
|
||||
|
||||
void sub_08039438(StalfosEntity* this) {
|
||||
if (sub_0806F520()) {
|
||||
if (sub_0806F520(super)) {
|
||||
Stalfos_SubActions[super->subAction](this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ void Takkuri_OnCollision(TakkuriEntity* this) {
|
|||
void Takkuri_OnGrabbed(TakkuriEntity* this) {
|
||||
gUnk_080CFF6C[super->subAction](this);
|
||||
GetNextFrame(super);
|
||||
if (sub_0806F520(super) == 0) {
|
||||
if (!sub_0806F520(super)) {
|
||||
super->action = 2;
|
||||
super->subAction = 0;
|
||||
this->unk_0x84 = 2;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ void Wisp_OnCollision(Entity* this) {
|
|||
}
|
||||
|
||||
void Wisp_OnGrabbed(Entity* this) {
|
||||
if (sub_0806F520() != 0) {
|
||||
if (sub_0806F520(this)) {
|
||||
gUnk_080CEB98[this->subAction](this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ void nullsub_539(Entity* this) {
|
|||
}
|
||||
|
||||
void sub_080A9CF0(Entity* this) {
|
||||
if (sub_0806F520() == 0) {
|
||||
if (!sub_0806F520(this)) {
|
||||
CreateFx(this, FX_DEATH, 0);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ void sub_080AA78C(Entity* this) {
|
|||
this->subAction = 1;
|
||||
InitAnimationForceUpdate(this, animationState + 8);
|
||||
}
|
||||
if (sub_0806F520(this) != 0) {
|
||||
if (sub_0806F520(this)) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if ((this->frame & 0x10) != 0) {
|
||||
this->frame &= 0xef;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ void sub_080A9A34(Entity* this) {
|
|||
}
|
||||
|
||||
void sub_080A9A64(Entity* this) {
|
||||
if ((this->subAction < 3) && (sub_0806F520(this) == 0)) {
|
||||
if ((this->subAction < 3) && !sub_0806F520(this)) {
|
||||
sub_080A9BA8(this);
|
||||
}
|
||||
StalfosProjectile_SubActions[this->subAction](this);
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ void sub_080AACE0(Entity* this) {
|
|||
}
|
||||
|
||||
void sub_080AAD70(Entity* this) {
|
||||
if (sub_0806F520() == 0) {
|
||||
if (!sub_0806F520(this)) {
|
||||
this->health = 0;
|
||||
}
|
||||
V1DarkMagicProjectile_SubActions[this->subAction](this);
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ void sub_080ABBF4(Entity* this) {
|
|||
}
|
||||
|
||||
void sub_080ABC54(Entity* this) {
|
||||
if (sub_0806F520() == 0) {
|
||||
if (!sub_0806F520(this)) {
|
||||
CreateFx(this, FX_DEATH, 0);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue