mirror of
https://github.com/zeldaret/tmc
synced 2026-05-24 23:22:08 -04:00
Merge pull request #176 from Ibot02/warpPoint
This commit is contained in:
@@ -296,8 +296,6 @@ void sub_0805A758(Manager15* this) {
|
||||
}
|
||||
}
|
||||
|
||||
extern void sub_0805E4E0(Manager*, u32);
|
||||
|
||||
void sub_0805A76C(Manager15* this) {
|
||||
if ((gPlayerEntity.currentHealth != 0) && (gPlayerEntity.height.HALF.HI == 0) && (!gPlayerState.field_0x2c)) {
|
||||
switch (gPlayerState.field_0xa9) {
|
||||
@@ -307,7 +305,7 @@ void sub_0805A76C(Manager15* this) {
|
||||
this->manager.action++;
|
||||
sub_08004168(&gPlayerEntity);
|
||||
gPlayerEntity.animationState = 4;
|
||||
sub_0805E4E0(&this->manager, 0x258);
|
||||
sub_0805E4E0((Entity*)this, 0x258);
|
||||
sub_08078A90(0xFF);
|
||||
gUnk_02034490[0] = 1;
|
||||
gRoomControls.cameraTarget = 0;
|
||||
|
||||
@@ -19,7 +19,6 @@ extern void (*const gUnk_08108D3C[])(Manager2E*);
|
||||
extern void (*const gUnk_08108D44[])(Manager2E*);
|
||||
|
||||
void sub_0805D2F4(Manager2E*);
|
||||
extern void sub_0805E4E0(void*, u32);
|
||||
|
||||
extern void (*const gUnk_08108D50[])(Manager2E*);
|
||||
|
||||
@@ -52,7 +51,7 @@ void sub_0805D2C0(Manager2E* this) {
|
||||
if (this->manager.unk_0e == 1) {
|
||||
sub_0805D2F4(this);
|
||||
}
|
||||
sub_0805E4E0(this, this->manager.unk_0e);
|
||||
sub_0805E4E0((Entity*)this, this->manager.unk_0e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,6 @@ void sub_08059064(ManagerF*);
|
||||
void sub_080592EC(ManagerF*);
|
||||
void sub_0805930C(ManagerF*);
|
||||
u32 sub_080593CC(ManagerF*);
|
||||
void sub_0805E4E0(ManagerF*, u32);
|
||||
|
||||
// to be moved to headers
|
||||
extern EntityData gUnk_080F4B88[];
|
||||
@@ -151,7 +150,7 @@ void sub_08058FB0(ManagerF* this) {
|
||||
if (CheckFlags(this->unk_3e)) {
|
||||
this->manager.action = 2;
|
||||
this->manager.unk_0e = 120;
|
||||
sub_0805E4E0(this, 0xF0);
|
||||
sub_0805E4E0((Entity*)this, 0xF0);
|
||||
sub_08059064(this);
|
||||
}
|
||||
break;
|
||||
@@ -241,7 +240,7 @@ void sub_08059124(ManagerF* this) {
|
||||
break;
|
||||
case 1:
|
||||
if (CheckFlags(this->unk_3e)) {
|
||||
sub_0805E4E0(this, 0x4b);
|
||||
sub_0805E4E0((Entity*)this, 0x4b);
|
||||
this->manager.unk_0e = 0x2d;
|
||||
this->manager.action++;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ void sub_0806DF00(Entity* this) {
|
||||
npc->parent = this;
|
||||
this->field_0x74.HWORD = 0;
|
||||
this->field_0x76.HWORD = 10;
|
||||
gScreenTransition.field_0x8 = 10;
|
||||
gScreenTransition.field_0x6 = 10;
|
||||
sub_0806E014(this);
|
||||
sub_0807DD50(this);
|
||||
} else {
|
||||
@@ -108,17 +108,17 @@ void sub_0806E1FC(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0806E20C(void) {
|
||||
if (gScreenTransition.field_0x8 != 0) {
|
||||
if (gScreenTransition.field_0x6 != 0) {
|
||||
TextboxNoOverlapFollow(0x421f);
|
||||
gTextBox.field_0x10 = gScreenTransition.field_0x8;
|
||||
gTextBox.field_0x10 = gScreenTransition.field_0x6;
|
||||
} else {
|
||||
TextboxNoOverlapFollow(0x4220);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806E23C(void) {
|
||||
if (gScreenTransition.field_0x8 != 0) {
|
||||
ModRupees(gScreenTransition.field_0x8);
|
||||
if (gScreenTransition.field_0x6 != 0) {
|
||||
ModRupees(gScreenTransition.field_0x6);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
#include "global.h"
|
||||
#include "object.h"
|
||||
#include "player.h"
|
||||
#include "flags.h"
|
||||
#include "game.h"
|
||||
#include "audio.h"
|
||||
#include "functions.h"
|
||||
|
||||
extern Hitbox gUnk_080FD168;
|
||||
|
||||
void WarpPoint(Entity*);
|
||||
void sub_0808B474(Entity*);
|
||||
void sub_0808B530(Entity*);
|
||||
void sub_0808B564(Entity*);
|
||||
void sub_0808B590(Entity*);
|
||||
void sub_0808B5E8(Entity*);
|
||||
void sub_0808B684(Entity*);
|
||||
void sub_0808B73C(Entity*);
|
||||
u32 sub_0808B7C8(Entity*);
|
||||
void sub_0808B830(Entity*);
|
||||
|
||||
void (*const gUnk_08121368[])(Entity*) = {
|
||||
sub_0808B474, sub_0808B530, sub_0808B564, sub_0808B590, sub_0808B5E8, sub_0808B684,
|
||||
};
|
||||
|
||||
const u8 gUnk_08121380[3] = { 1, 0, 2 };
|
||||
|
||||
void WarpPoint(Entity* this) {
|
||||
if (!this->field_0x70.BYTES.byte0) {
|
||||
gUnk_08121368[this->action](this);
|
||||
} else {
|
||||
sub_0808B73C(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808B474(Entity* this) {
|
||||
u32 tmp;
|
||||
this->action = 1;
|
||||
this->field_0xf = 0;
|
||||
tmp = gUnk_08121380[this->type];
|
||||
this->palette.b.b0 = tmp;
|
||||
this->spritePriority.b0 = 6;
|
||||
this->hitbox = &gUnk_080FD168;
|
||||
this->scriptedScene = 3;
|
||||
InitializeAnimation(this, 0);
|
||||
if (CheckFlags(this->field_0x86.HWORD)) {
|
||||
sub_0808B830(this);
|
||||
} else {
|
||||
if (CheckIsDungeon() && sub_0807CAEC(this->type)) {
|
||||
sub_0808B830(this);
|
||||
}
|
||||
}
|
||||
if (!sub_0808B7C8(this))
|
||||
return;
|
||||
this->action = 4;
|
||||
this->field_0xf = 0x60;
|
||||
gPlayerEntity.x.HALF.HI = this->x.HALF.HI;
|
||||
gPlayerEntity.y.HALF.HI = this->y.HALF.HI;
|
||||
gPlayerEntity.animationState = 4;
|
||||
EnqueueSFX(0x112);
|
||||
sub_0805E4E0(this, this->field_0xf + 0x10);
|
||||
}
|
||||
|
||||
void sub_0808B530(Entity* this) {
|
||||
if (CheckFlags(this->field_0x86.HWORD)) {
|
||||
sub_0808B830(this);
|
||||
if (CheckIsDungeon()) {
|
||||
sub_0807CAC8(this->type);
|
||||
}
|
||||
this->action = 2;
|
||||
this->field_0xf = 60;
|
||||
EnqueueSFX(0x112);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808B564(Entity* this) {
|
||||
if (!--this->field_0xf) {
|
||||
this->action = 3;
|
||||
} else {
|
||||
this->spriteSettings.b.draw = this->field_0xf & 2 ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808B590(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (sub_0808B7C8(this)) {
|
||||
if (this->actionDelay)
|
||||
return;
|
||||
this->action = 5;
|
||||
this->field_0xf = 0x60;
|
||||
sub_08077B20();
|
||||
gPlayerEntity.x.HALF.HI = this->x.HALF.HI;
|
||||
gPlayerEntity.y.HALF.HI = this->y.HALF.HI;
|
||||
gPlayerEntity.animationState = 4;
|
||||
gPlayerEntity.flags &= ~0x80;
|
||||
sub_0805E4E0(this, this->field_0xf + 0x10);
|
||||
SoundReq(0x113);
|
||||
} else {
|
||||
this->actionDelay = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808B5E8(Entity* this) {
|
||||
u32 tmp;
|
||||
if (!--this->field_0xf) {
|
||||
this->action = 3;
|
||||
this->actionDelay = 1;
|
||||
gPlayerEntity.animationState = 4;
|
||||
gPlayerEntity.direction = DirectionSouth;
|
||||
return;
|
||||
}
|
||||
tmp = 0;
|
||||
switch (this->field_0xf & 0x60) {
|
||||
case 0x40:
|
||||
if (this->field_0xf == 0x58) {
|
||||
SoundReq(0x114);
|
||||
}
|
||||
if (!(this->field_0xf & 1)) {
|
||||
tmp = 1;
|
||||
}
|
||||
break;
|
||||
case 0x20:
|
||||
if (!(this->field_0xf & 3)) {
|
||||
tmp = 1;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
if (!(this->field_0xf & 7)) {
|
||||
if (gPlayerEntity.animationState == 4) {
|
||||
if (this->field_0xf > 0x18) {
|
||||
tmp = 1;
|
||||
}
|
||||
} else {
|
||||
tmp = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (tmp) {
|
||||
gPlayerEntity.animationState += 2;
|
||||
gPlayerEntity.animationState &= 6;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808B684(Entity* this) {
|
||||
u32 tmp;
|
||||
if (!--this->field_0xf) {
|
||||
gScreenTransition.transitioningOut = 1;
|
||||
gScreenTransition.transitionType = 0;
|
||||
gScreenTransition.areaID = this->field_0x7c.BYTES.byte0;
|
||||
gScreenTransition.roomID = this->field_0x7c.BYTES.byte1;
|
||||
gScreenTransition.playerStartPos.HALF.x = ((this->cutsceneBeh.HWORD & 0x3f) << 4) + 8;
|
||||
gScreenTransition.playerStartPos.HALF.y = ((this->cutsceneBeh.HWORD & 0xfc0) >> 2) + 8;
|
||||
gScreenTransition.playerLayer = 0;
|
||||
gScreenTransition.playerState = 4;
|
||||
gScreenTransition.field_0xf = 0;
|
||||
if (this->type == 2) {
|
||||
gScreenTransition.transitionType = 2;
|
||||
}
|
||||
return;
|
||||
}
|
||||
tmp = 0;
|
||||
switch (this->field_0xf & 0x60) {
|
||||
case 0x40:
|
||||
if (!(this->field_0xf & 7)) {
|
||||
tmp = 1;
|
||||
}
|
||||
break;
|
||||
case 0x20:
|
||||
if (!(this->field_0xf & 3)) {
|
||||
tmp = 1;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
if (this->field_0xf > 0x10) {
|
||||
if (!(this->field_0xf & 1)) {
|
||||
tmp = 1;
|
||||
}
|
||||
} else {
|
||||
gPlayerEntity.spriteSettings.b.draw = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (tmp) {
|
||||
gPlayerEntity.animationState += 2;
|
||||
gPlayerEntity.animationState &= 6;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0808B73C(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->palette.b.b0 = this->parent->palette.b.b0;
|
||||
InitializeAnimation(this, 1);
|
||||
}
|
||||
if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28)) {
|
||||
this->spriteSettings.b.draw = 1;
|
||||
} else {
|
||||
if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x2e)) {
|
||||
this->spriteSettings.b.draw ^= 1;
|
||||
} else {
|
||||
this->spriteSettings.b.draw = 0;
|
||||
}
|
||||
}
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
u32 sub_0808B7C8(Entity* this) {
|
||||
if (!(gPlayerState.flags.all & 0x80) && gPlayerState.field_0xa8 != 0x12 && gPlayerEntity.currentHealth != 0 &&
|
||||
sub_08079F8C() && sub_080041A0(this, &gPlayerEntity, 5, 5) && gPlayerEntity.height.HALF.HI == 0) {
|
||||
if (this->actionDelay == 0 && gPlayerEntity.action == 0x1b) {
|
||||
sub_080791D0();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sub_0808B830(Entity* this) {
|
||||
Entity* tmp;
|
||||
this->action = 3;
|
||||
this->actionDelay = 0;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
tmp = CreateObject(0x34, 0, 0);
|
||||
if (tmp) {
|
||||
tmp->field_0x70.BYTES.byte0 = 1;
|
||||
tmp->parent = this;
|
||||
CopyPosition(this, tmp);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user