mirror of
https://github.com/zeldaret/tmc
synced 2026-09-09 12:04:01 -04:00
Fix paths
This commit is contained in:
+17
-17
@@ -4,43 +4,43 @@
|
||||
|
||||
extern void MemFill32(u32, void*, u32);
|
||||
|
||||
void sub_08049DCC(RoomMemory*);
|
||||
RoomMemory* sub_08049D88(void);
|
||||
void UpdateCurrentRoom(RoomMemory*);
|
||||
RoomMemory* AddCurrentRoom(void);
|
||||
|
||||
void ClearRoomMemory(void) {
|
||||
MemFill32(0xFFFFFFFF, gRoomMemory, 0x40);
|
||||
gUnk_020354B0 = gRoomMemory;
|
||||
gRoomMemoryPtr = gRoomMemory;
|
||||
}
|
||||
|
||||
void sub_08049CF4(GenericEntity* ent) {
|
||||
void SetRoomTrackerFlag(GenericEntity* ent) {
|
||||
u8 field_0x6c = ent->field_0x6c.HALF.LO;
|
||||
if (field_0x6c & 0x80) {
|
||||
gUnk_020354B0->unk_04 |= 1 << (field_0x6c & 0x1f);
|
||||
gRoomMemoryPtr->flags |= 1 << (field_0x6c & 0x1f);
|
||||
}
|
||||
}
|
||||
|
||||
u32 sub_08049D1C(u32 arg0) {
|
||||
u32 bitmask = gUnk_020354B0->unk_04 >> arg0;
|
||||
bool32 IsRoomTrackerFlagSet(u32 arg0) {
|
||||
u32 bitmask = gRoomMemoryPtr->flags >> arg0;
|
||||
u32 output = 1;
|
||||
output &= ~bitmask;
|
||||
return output;
|
||||
}
|
||||
|
||||
void UpdateRoomTracker(void) {
|
||||
gUnk_020354B0 = gRoomMemory;
|
||||
gRoomMemoryPtr = gRoomMemory;
|
||||
|
||||
do {
|
||||
if (gUnk_020354B0->area == gRoomControls.area && gUnk_020354B0->room == gRoomControls.room) {
|
||||
sub_08049DCC(gUnk_020354B0);
|
||||
if (gRoomMemoryPtr->area == gRoomControls.area && gRoomMemoryPtr->room == gRoomControls.room) {
|
||||
UpdateCurrentRoom(gRoomMemoryPtr);
|
||||
return;
|
||||
}
|
||||
gUnk_020354B0++;
|
||||
gRoomMemoryPtr++;
|
||||
|
||||
} while (gUnk_020354B0 < gRoomMemory + 8);
|
||||
gUnk_020354B0 = sub_08049D88();
|
||||
} while (gRoomMemoryPtr < gRoomMemory + 8);
|
||||
gRoomMemoryPtr = AddCurrentRoom();
|
||||
}
|
||||
|
||||
RoomMemory* sub_08049D88(void) {
|
||||
RoomMemory* AddCurrentRoom(void) {
|
||||
RoomMemory* rm = gRoomMemory;
|
||||
RoomMemory* r1 = rm + 1;
|
||||
|
||||
@@ -55,14 +55,14 @@ RoomMemory* sub_08049D88(void) {
|
||||
rm->room = gRoomControls.room;
|
||||
|
||||
rm->unk_02 = 0xFFFF;
|
||||
rm->unk_04 = 0;
|
||||
rm->flags = 0;
|
||||
|
||||
sub_08049DCC(rm);
|
||||
UpdateCurrentRoom(rm);
|
||||
|
||||
return rm;
|
||||
}
|
||||
|
||||
void sub_08049DCC(RoomMemory* rm) {
|
||||
void UpdateCurrentRoom(RoomMemory* rm) {
|
||||
RoomMemory* r1 = gRoomMemory;
|
||||
|
||||
do {
|
||||
|
||||
@@ -42,7 +42,7 @@ void DoorMimic_OnCollision(Entity* this) {
|
||||
void DoorMimic_OnDeath(Entity* this) {
|
||||
SetTile((u16)this->field_0x7c.HALF.LO, (u16)this->field_0x7c.HALF.HI, this->collisionLayer);
|
||||
CreateFx(this, FX_POT_SHATTER, 0);
|
||||
sub_08049CF4(this);
|
||||
SetRoomTrackerFlag(this);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -192,7 +192,7 @@ void Enemy64_Action2_SubAction0(Enemy64Entity* this) {
|
||||
}
|
||||
|
||||
void Enemy64_Action2_SubAction1(Enemy64Entity* this) {
|
||||
u32 tmp = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
u32 tmp = CalculateDirectionFromOffsets(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
if (4 < (((super->direction - tmp) + 2) & 0xff)) {
|
||||
if (((tmp - super->direction) & 0x80) != 0) {
|
||||
super->direction--;
|
||||
@@ -293,7 +293,7 @@ void Enemy64_Action3(Enemy64Entity* this) {
|
||||
}
|
||||
|
||||
void Enemy64_Action3_SubAction0(Enemy64Entity* this) {
|
||||
u32 tmp = sub_080045DA(gRoomControls.origin_x + 0xa8 - super->x.HALF.HI,
|
||||
u32 tmp = CalculateDirectionFromOffsets(gRoomControls.origin_x + 0xa8 - super->x.HALF.HI,
|
||||
gRoomControls.origin_y + 0x80 - super->y.HALF.HI);
|
||||
if (tmp != super->direction) {
|
||||
if (((tmp - super->direction) & 0x80) != 0) {
|
||||
@@ -493,7 +493,7 @@ void sub_080499F0(Enemy64Entity* this) {
|
||||
((this->unk_7c & 1) == 0)) {
|
||||
if (EntityWithinDistance(&gPlayerEntity, super->x.HALF.HI, super->y.HALF.HI, 0x24) &&
|
||||
((this->unk_7c & 2) == 0)) {
|
||||
tmp = sub_080045DA((s32)gPlayerEntity.x.HALF.HI - super->x.HALF.HI,
|
||||
tmp = CalculateDirectionFromOffsets((s32)gPlayerEntity.x.HALF.HI - super->x.HALF.HI,
|
||||
(s32)gPlayerEntity.y.HALF.HI - super->y.HALF.HI);
|
||||
gPlayerEntity.x.WORD = super->x.WORD + gSineTable[tmp] * 0x2400;
|
||||
gPlayerEntity.y.WORD = super->y.WORD + gSineTable[tmp + 0x40] * -0x2400;
|
||||
|
||||
+12
-12
@@ -263,7 +263,7 @@ void sub_08046AE8(GyorgMaleEntity* this) {
|
||||
}
|
||||
|
||||
void sub_08046B18(GyorgMaleEntity* this) {
|
||||
u32 tmp = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
u32 tmp = CalculateDirectionFromOffsets(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
if (tmp != super->direction) {
|
||||
if (((tmp - super->direction) & 0xFF) > 0x80) {
|
||||
this->unk_76 -= 0x100;
|
||||
@@ -286,13 +286,13 @@ void sub_08046B8C(GyorgMaleEntity* this) {
|
||||
this->unk_82 = gRoomControls.origin_y + 0x210;
|
||||
sub_08047D88(this);
|
||||
} else {
|
||||
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
super->direction = CalculateDirectionFromOffsets(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08046C04(GyorgMaleEntity* this) {
|
||||
u32 tmp = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
u32 tmp = CalculateDirectionFromOffsets(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
if (tmp != super->direction) {
|
||||
if (((tmp - super->direction) & 0xFF) > 0x80) {
|
||||
this->unk_76 -= 0x100;
|
||||
@@ -314,7 +314,7 @@ void sub_08046C88(GyorgMaleEntity* this) {
|
||||
sub_08048178(this, sub_08048158(this->unk_70));
|
||||
sub_08047D88(this);
|
||||
} else {
|
||||
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
super->direction = CalculateDirectionFromOffsets(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
|
||||
}
|
||||
}
|
||||
@@ -351,7 +351,7 @@ void sub_08046D44(GyorgMaleEntity* this) {
|
||||
}
|
||||
|
||||
void sub_08046D98(GyorgMaleEntity* this) {
|
||||
u32 tmp = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
u32 tmp = CalculateDirectionFromOffsets(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
if (tmp != super->direction) {
|
||||
if (((tmp - super->direction) & 0xFF) > 0x80) {
|
||||
this->unk_76 -= 0x100;
|
||||
@@ -372,7 +372,7 @@ void sub_08046E0C(GyorgMaleEntity* this) {
|
||||
this->unk_76 = super->direction << 8;
|
||||
sub_08047D88(this);
|
||||
} else {
|
||||
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
super->direction = CalculateDirectionFromOffsets(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
sub_08047DF0(this, ((0x100 - super->direction) & 0xFF) << 8);
|
||||
}
|
||||
}
|
||||
@@ -459,7 +459,7 @@ void sub_08046FE8(GyorgMaleEntity* this) {
|
||||
}
|
||||
|
||||
void sub_0804702C(GyorgMaleEntity* this) {
|
||||
u32 tmp = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
u32 tmp = CalculateDirectionFromOffsets(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
if (((super->direction - tmp + 2) & 0xFF) > 4) {
|
||||
if ((tmp - super->direction) & 0x80) {
|
||||
super->direction--;
|
||||
@@ -610,7 +610,7 @@ void sub_080473B8(GyorgMaleEntity* this) {
|
||||
}
|
||||
|
||||
void sub_080473F0(GyorgMaleEntity* this) {
|
||||
u32 tmp = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
u32 tmp = CalculateDirectionFromOffsets(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
if (((super->direction - tmp + 2) & 0xFF) > 4) {
|
||||
s32 tmp2 = tmp - super->direction;
|
||||
if (tmp2 & 0x80) {
|
||||
@@ -794,7 +794,7 @@ void sub_080477F0(GyorgMaleEntity* this) {
|
||||
if (super->speed < 0x300) {
|
||||
super->speed += 8;
|
||||
}
|
||||
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
super->direction = CalculateDirectionFromOffsets(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
sub_08047E48(this);
|
||||
if (!EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) {
|
||||
super->action = 2;
|
||||
@@ -899,7 +899,7 @@ void sub_08047978(GyorgMaleEntity* this) {
|
||||
|
||||
void sub_08047B08(GyorgMaleEntity* this) {
|
||||
sub_08047D88(this);
|
||||
super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
super->direction = CalculateDirectionFromOffsets(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI);
|
||||
super->speed = 0x200;
|
||||
sub_08047E58(this);
|
||||
if (!EntityWithinDistance(super, this->unk_80, this->unk_82, 4))
|
||||
@@ -1069,7 +1069,7 @@ void sub_08047EA4(GyorgMaleEntity* this, u32 unk1) {
|
||||
return;
|
||||
if (this->unk_7c & 1) {
|
||||
tmp2 = sub_08047F68(this) << 8;
|
||||
dir = sub_080045DA(gPlayerEntity.x.HALF.HI - super->x.HALF.HI, gPlayerEntity.y.HALF.HI - super->y.HALF.HI);
|
||||
dir = CalculateDirectionFromOffsets(gPlayerEntity.x.HALF.HI - super->x.HALF.HI, gPlayerEntity.y.HALF.HI - super->y.HALF.HI);
|
||||
tmp = dir - (tmp / 256);
|
||||
tmp &= 0xFF;
|
||||
gPlayerEntity.x.WORD += (gSineTable[tmp] - gSineTable[dir]) * tmp2;
|
||||
@@ -1151,7 +1151,7 @@ void sub_08048004(GyorgMaleEntity* this) {
|
||||
if (b != 3) {
|
||||
if (EntityWithinDistance(&gPlayerEntity, super->x.HALF.HI, super->y.HALF.HI, 0x24)) {
|
||||
if (!(this->unk_7c & 2)) {
|
||||
u32 tmp = sub_080045DA(gPlayerEntity.x.HALF.HI - super->x.HALF.HI,
|
||||
u32 tmp = CalculateDirectionFromOffsets(gPlayerEntity.x.HALF.HI - super->x.HALF.HI,
|
||||
gPlayerEntity.y.HALF.HI - super->y.HALF.HI);
|
||||
gPlayerEntity.x.WORD = super->x.WORD + (gSineTable[tmp] * 9216);
|
||||
gPlayerEntity.y.WORD = super->y.WORD - (gSineTable[tmp + 0x40] * 9216);
|
||||
|
||||
@@ -168,11 +168,11 @@ void OctorokBoss_Hit_SubAction1(OctorokBossEntity* this) {
|
||||
if (diffX > 8 || diffY > 8) {
|
||||
this->heap->field_0x2 = 1;
|
||||
#if defined(JP) || defined(DEMO_JP) || defined(EU)
|
||||
super->direction = ((s32)sub_080045DA((((gRoomControls.origin_x + 0x108) << 0x10) - super->x.WORD),
|
||||
super->direction = ((s32)CalculateDirectionFromOffsets((((gRoomControls.origin_x + 0x108) << 0x10) - super->x.WORD),
|
||||
(((gRoomControls.origin_y + 0x88) << 0x10) - super->y.WORD))) >>
|
||||
3;
|
||||
#else
|
||||
super->direction = ((s32)sub_080045DA(gRoomControls.origin_x + 0x108 - super->x.HALF.HI,
|
||||
super->direction = ((s32)CalculateDirectionFromOffsets(gRoomControls.origin_x + 0x108 - super->x.HALF.HI,
|
||||
gRoomControls.origin_y + 0x88 - super->y.HALF.HI)) >>
|
||||
3;
|
||||
#endif
|
||||
@@ -690,7 +690,7 @@ void OctorokBoss_Action1_AimTowardsPlayer(OctorokBossEntity* this) {
|
||||
s32 tmp1;
|
||||
s32 tmp2;
|
||||
|
||||
tmp1 = (u8)(sub_080045DA(gPlayerEntity.x.WORD - super->x.WORD, gPlayerEntity.y.WORD - super->y.WORD) -
|
||||
tmp1 = (u8)(CalculateDirectionFromOffsets(gPlayerEntity.x.WORD - super->x.WORD, gPlayerEntity.y.WORD - super->y.WORD) -
|
||||
(((u8)(-this->angle.HALF.HI) ^ 0x80)));
|
||||
if (IS_FROZEN(this) == FALSE) {
|
||||
tmp2 = 8;
|
||||
@@ -898,7 +898,7 @@ void OctorokBoss_ExecuteAttackVacuum(OctorokBossEntity* this) {
|
||||
s32 tmp;
|
||||
|
||||
if (this->unk_80 == 0) {
|
||||
super->direction = sub_080045DA(gPlayerEntity.x.WORD - super->x.WORD, gPlayerEntity.y.WORD - super->y.WORD);
|
||||
super->direction = CalculateDirectionFromOffsets(gPlayerEntity.x.WORD - super->x.WORD, gPlayerEntity.y.WORD - super->y.WORD);
|
||||
tmp = ((u8) - (this->angle.HALF.HI + 0x80)) - super->direction;
|
||||
if (tmp < 0) {
|
||||
tmp = -tmp;
|
||||
@@ -912,7 +912,7 @@ void OctorokBoss_ExecuteAttackVacuum(OctorokBossEntity* this) {
|
||||
this->unk_80 = 1;
|
||||
this->timer = 2;
|
||||
this->heap->targetAngle =
|
||||
sub_080045DA((gRoomControls.origin_x + 0x108) * 0x10000 - super->x.WORD,
|
||||
CalculateDirectionFromOffsets((gRoomControls.origin_x + 0x108) * 0x10000 - super->x.WORD,
|
||||
(gRoomControls.origin_y + 0x88) * 0x10000 - super->y.WORD);
|
||||
this->heap->targetAngle = (u8) - (this->heap->targetAngle + 0x80);
|
||||
SoundReq(SFX_ED);
|
||||
@@ -956,7 +956,7 @@ void OctorokBoss_ExecuteAttackVacuum(OctorokBossEntity* this) {
|
||||
} else {
|
||||
this->timer--;
|
||||
if ((gPlayerState.flags == PL_FROZEN) && (this->timer == 0x3c)) {
|
||||
tmp = sub_080045DA(gPlayerEntity.x.WORD - super->x.WORD, gPlayerEntity.y.WORD - super->y.WORD);
|
||||
tmp = CalculateDirectionFromOffsets(gPlayerEntity.x.WORD - super->x.WORD, gPlayerEntity.y.WORD - super->y.WORD);
|
||||
if ((u8)((tmp - ((u8) - this->angle.HALF.HI ^ 0x80))) > 0x80) {
|
||||
this->heap->targetAngle = this->angle.HALF.HI + 0x30;
|
||||
} else {
|
||||
@@ -1178,7 +1178,7 @@ void sub_08036AF0(OctorokBossEntity* this, s32 radius, s32 angleSpeed) {
|
||||
continue;
|
||||
} else {
|
||||
heap->tailObjects[index - 1]->angle.HALF.HI =
|
||||
sub_080045DA(heap->tailObjects[index - 1]->base.x.WORD - heap->tailObjects[index]->base.x.WORD,
|
||||
CalculateDirectionFromOffsets(heap->tailObjects[index - 1]->base.x.WORD - heap->tailObjects[index]->base.x.WORD,
|
||||
heap->tailObjects[index - 1]->base.y.WORD - heap->tailObjects[index]->base.y.WORD);
|
||||
tmp = FixedMul(gSineTable[heap->tailObjects[index - 1]->angle.HALF.HI], radius << 4);
|
||||
tmp = FixedDiv(tmp, 0x100);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
static bool32 ShouldSpawnTreeItem(Entity*);
|
||||
|
||||
extern void sub_08049CF4(Entity*);
|
||||
extern void SetRoomTrackerFlag(Entity*);
|
||||
|
||||
const u8 gTreeItemDropTables[][16] = {
|
||||
{ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
|
||||
@@ -71,7 +71,7 @@ void TreeItem(Entity* this) {
|
||||
break;
|
||||
}
|
||||
|
||||
sub_08049CF4(this);
|
||||
SetRoomTrackerFlag(this);
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@
|
||||
#include "projectile.h"
|
||||
#include "save.h"
|
||||
|
||||
extern void sub_08049CF4(Entity*);
|
||||
extern void SetRoomTrackerFlag(Entity*);
|
||||
|
||||
extern EnemyDefinition gEnemyDefinitions[];
|
||||
|
||||
@@ -191,7 +191,7 @@ void CreateDeathFx(GenericEntity* parent, u32 parentId, u32 fixedItem) {
|
||||
} else {
|
||||
int tmp = parent->base.gustJarState & 2;
|
||||
if (tmp == 0) {
|
||||
sub_08049CF4(&(parent->base));
|
||||
SetRoomTrackerFlag(&(parent->base));
|
||||
gSave.unk50++;
|
||||
parent->base.gustJarState |= 2;
|
||||
parent->base.timer = 255;
|
||||
|
||||
+2
-2
@@ -536,7 +536,7 @@ void sub_0806D7C4(Entity* this, ScriptExecutionContext* context) {
|
||||
this->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0x18;
|
||||
entity = FindEntity(NPC, BIG_GORON, 7, 2, 0);
|
||||
if (entity != NULL) {
|
||||
sub_0807DEDC(this, context, entity->x.HALF.HI, entity->y.HALF.HI);
|
||||
LookAt(this, context, entity->x.HALF.HI, entity->y.HALF.HI);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -547,7 +547,7 @@ void sub_0806D804(Entity* this, ScriptExecutionContext* context) {
|
||||
this->y.HALF.HI = entity->y.HALF.HI - 0x10;
|
||||
this->spritePriority.b1 = 0;
|
||||
}
|
||||
sub_0807DEDC(this, context, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0x10);
|
||||
LookAt(this, context, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0x10);
|
||||
}
|
||||
|
||||
void sub_0806D858(Entity* this) {
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ void sub_0806D8A0(Entity* this, ScriptExecutionContext* context) {
|
||||
context->y.HALF.HI = yOffset;
|
||||
|
||||
xOffset -= this->x.HALF.HI;
|
||||
this->direction = sub_080045DA(xOffset, yOffset - this->y.HALF.HI);
|
||||
this->direction = CalculateDirectionFromOffsets(xOffset, yOffset - this->y.HALF.HI);
|
||||
this->animationState = (this->animationState & 0x80) | gUnk_08114134[this->direction >> 4];
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -142,7 +142,7 @@ void sub_0806991C(Entity* this, ScriptExecutionContext* context) {
|
||||
context->unk_19 = 8;
|
||||
context->postScriptActions |= 2;
|
||||
context->condition = 0;
|
||||
tmp = sub_080045DA(context->x.HALF.HI - this->x.HALF.HI, context->y.HALF.HI - this->y.HALF.HI);
|
||||
tmp = CalculateDirectionFromOffsets(context->x.HALF.HI - this->x.HALF.HI, context->y.HALF.HI - this->y.HALF.HI);
|
||||
this->direction = tmp;
|
||||
this->animationState = (this->animationState & 0x80) | gUnk_08111C74[(tmp << 0x18) >> 0x1c];
|
||||
gActiveScriptInfo.flags |= 1;
|
||||
@@ -158,7 +158,7 @@ void sub_080699AC(Entity* this, ScriptExecutionContext* context) {
|
||||
context->unk_19 = 8;
|
||||
context->postScriptActions |= 2;
|
||||
context->condition = 0;
|
||||
tmp = sub_080045DA(context->x.HALF.HI - this->x.HALF.HI, context->y.HALF.HI - this->y.HALF.HI);
|
||||
tmp = CalculateDirectionFromOffsets(context->x.HALF.HI - this->x.HALF.HI, context->y.HALF.HI - this->y.HALF.HI);
|
||||
this->direction = tmp;
|
||||
this->animationState = (this->animationState & 0x80) | gUnk_08111C8C[(tmp << 0x18) >> 0x1c];
|
||||
gActiveScriptInfo.flags |= 1;
|
||||
|
||||
+1
-1
@@ -404,7 +404,7 @@ void sub_080626E0(Entity* this, ScriptExecutionContext* context) {
|
||||
}
|
||||
if (--context->unk_19 == 0) {
|
||||
context->unk_19 = 10;
|
||||
uVar4 = sub_080045DA(context->x.HALF.HI - this->x.HALF.HI, context->y.HALF.HI - this->y.HALF.HI);
|
||||
uVar4 = CalculateDirectionFromOffsets(context->x.HALF.HI - this->x.HALF.HI, context->y.HALF.HI - this->y.HALF.HI);
|
||||
this->direction = (u8)uVar4;
|
||||
uVar4 = Random();
|
||||
this->direction = (this->direction + uVar4 % 0xb) - 5;
|
||||
|
||||
+1
-1
@@ -366,7 +366,7 @@ bool32 sub_08060FD0(Entity* this, u32 a, u32 b) {
|
||||
|
||||
x = this->x.HALF.HI;
|
||||
y = this->y.HALF.HI;
|
||||
iVar3 = sub_080045DA(a - x, b - y);
|
||||
iVar3 = CalculateDirectionFromOffsets(a - x, b - y);
|
||||
x <<= 8;
|
||||
y <<= 8;
|
||||
sVar1 = gSineTable[iVar3] * 6;
|
||||
|
||||
+1
-1
@@ -312,7 +312,7 @@ void sub_08060700(Entity* entity, ScriptExecutionContext* context) {
|
||||
const Coords* coords = &gUnk_0810A66C[var0[(s8)entity->field_0x68.HALF.HI]];
|
||||
u32 x = coords->HALF.x + gRoomControls.origin_x;
|
||||
u32 y = coords->HALF.y + gRoomControls.origin_y;
|
||||
sub_0807DEDC(entity, context, x, y);
|
||||
LookAt(entity, context, x, y);
|
||||
gActiveScriptInfo.flags |= 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -714,7 +714,7 @@ void sub_0809567C(CutsceneMiscObjectEntity* this) {
|
||||
super->action = 3;
|
||||
super->subAction = 1;
|
||||
super->speed = 0x400;
|
||||
super->direction = sub_080045DA(super->x.WORD - ((s16)this->px << 16), super->y.WORD - ((s16)this->py << 16));
|
||||
super->direction = CalculateDirectionFromOffsets(super->x.WORD - ((s16)this->px << 16), super->y.WORD - ((s16)this->py << 16));
|
||||
}
|
||||
|
||||
void sub_080956B4(CutsceneMiscObjectEntity* this) {
|
||||
|
||||
@@ -545,7 +545,7 @@ static u32 sub_0808EF6C(Entity* this) {
|
||||
var7 = this->field_0x6c.HWORD;
|
||||
}
|
||||
this->speed = var7;
|
||||
this->direction = sub_080045DA(var0, var2) >> 3;
|
||||
this->direction = CalculateDirectionFromOffsets(var0, var2) >> 3;
|
||||
LinearMoveUpdate(this);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -166,6 +166,6 @@ void sub_080A0444(FourElementsEntity* this) {
|
||||
void sub_080A0464(FourElementsEntity* this, ScriptExecutionContext* context) {
|
||||
Entity* element = FindEntityByID(6, FOUR_ELEMENTS, 6);
|
||||
if (element != NULL) {
|
||||
sub_0807DEDC(super, context, element->x.HALF.HI, element->y.HALF.HI + 0x18);
|
||||
LookAt(super, context, element->x.HALF.HI, element->y.HALF.HI + 0x18);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -420,7 +420,7 @@ void sub_0809E0D4(KeyStealingTakkuriEntity* this, ScriptExecutionContext* contex
|
||||
entity = &gPlayerEntity;
|
||||
}
|
||||
context->unk_18++;
|
||||
sub_0807DEDC(super, context, entity->x.HALF.HI, entity->y.HALF.HI);
|
||||
LookAt(super, context, entity->x.HALF.HI, entity->y.HALF.HI);
|
||||
SoundReq(SFX_123);
|
||||
gActiveScriptInfo.commandSize = 0;
|
||||
} else {
|
||||
@@ -436,7 +436,7 @@ void sub_0809E0D4(KeyStealingTakkuriEntity* this, ScriptExecutionContext* contex
|
||||
varY2 = varY;
|
||||
if (--context->unk_19 == 0) {
|
||||
context->unk_19 = 8;
|
||||
super->direction = sub_080045DA(varX2 - super->x.HALF.HI, varY2 - super->y.HALF.HI);
|
||||
super->direction = CalculateDirectionFromOffsets(varX2 - super->x.HALF.HI, varY2 - super->y.HALF.HI);
|
||||
}
|
||||
varX3 = super->x.HALF.HI - varX2;
|
||||
varY3 = super->y.HALF.HI - varY2;
|
||||
|
||||
@@ -82,7 +82,7 @@ void sub_080A0AF0(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_080A0B28(Entity* this, ScriptExecutionContext* context) {
|
||||
sub_0807DEDC(this, context, this->x.HALF.HI, this->y.HALF.HI);
|
||||
LookAt(this, context, this->x.HALF.HI, this->y.HALF.HI);
|
||||
this->y.HALF.HI -= 0xb0;
|
||||
this->spriteSettings.draw = 0;
|
||||
}
|
||||
|
||||
@@ -117,5 +117,5 @@ void sub_0809F448(Entity* this) {
|
||||
break;
|
||||
}
|
||||
this->speed = (tmp > 0 ? tmp : -tmp) / (tmp2->unk_1 << 8);
|
||||
this->direction = sub_080045DA(tmp, 0) >> 3;
|
||||
this->direction = CalculateDirectionFromOffsets(tmp, 0) >> 3;
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ void OctorokBossObject_Action1(Entity* this) {
|
||||
return;
|
||||
}
|
||||
case 1:
|
||||
this->direction = sub_080045DA(GET_HELPER(this)->tailObjects[this->timer]->x.WORD - this->x.WORD,
|
||||
this->direction = CalculateDirectionFromOffsets(GET_HELPER(this)->tailObjects[this->timer]->x.WORD - this->x.WORD,
|
||||
GET_HELPER(this)->tailObjects[this->timer]->y.WORD - this->y.WORD);
|
||||
LinearMoveAngle(this, this->speed, this->direction);
|
||||
if (EntityInRectRadius(this, GET_HELPER(this)->tailObjects[this->timer], 2, 2) == 0) {
|
||||
@@ -197,7 +197,7 @@ void OctorokBossObject_Action1(Entity* this) {
|
||||
case 2:
|
||||
if (this->parent->type2 == 3) {
|
||||
Entity* object = GET_HELPER(this->parent)->mouthObject;
|
||||
this->direction = sub_080045DA(object->x.WORD - this->x.WORD, object->y.WORD - this->y.WORD);
|
||||
this->direction = CalculateDirectionFromOffsets(object->x.WORD - this->x.WORD, object->y.WORD - this->y.WORD);
|
||||
LinearMoveAngle(this, 0x280, this->direction);
|
||||
if (sub_0806FC80(this, this->parent, 0x48) == 0) {
|
||||
return;
|
||||
|
||||
@@ -201,7 +201,7 @@ void sub_080845DC(SpecialFxObject* this) {
|
||||
|
||||
void sub_080845F8(SpecialFxObject* this) {
|
||||
if (((8 - (super->x.HALF.HI & 0xF)) | (8 - (super->y.HALF.HI & 0xF))) != 0) {
|
||||
super->direction = sub_080045DA((8 - (super->x.HALF.HI & 0xF)), (8 - (super->y.HALF.HI & 0xF))) >> 3;
|
||||
super->direction = CalculateDirectionFromOffsets((8 - (super->x.HALF.HI & 0xF)), (8 - (super->y.HALF.HI & 0xF))) >> 3;
|
||||
LinearMoveUpdate(super);
|
||||
}
|
||||
sub_08084630(this);
|
||||
|
||||
@@ -2572,6 +2572,7 @@ void sub_0807AAF8(Entity* this, u32 tilePos) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO some sort of flame spreading?
|
||||
void sub_0807AB44(Entity* this, s32 xOffset, s32 yOffset) {
|
||||
Entity* object;
|
||||
const u16* ptr =
|
||||
|
||||
+8
-8
@@ -10,7 +10,7 @@
|
||||
|
||||
static void sub_0804B058(EntityData* dat);
|
||||
extern void sub_0801AC98(void);
|
||||
extern u32 sub_08049D1C(u32);
|
||||
extern bool32 IsRoomTrackerFlagSet(u32);
|
||||
|
||||
extern void** gCurrentRoomProperties;
|
||||
extern void*** gAreaTable[];
|
||||
@@ -194,10 +194,10 @@ static void sub_0804B058(EntityData* dat) {
|
||||
uVar2 = 0;
|
||||
do {
|
||||
if ((uVar2 < 0x20) && ((dat->kind & 0xF) == 3)) {
|
||||
if (sub_08049D1C(uVar2) != 0) {
|
||||
if (IsRoomTrackerFlagSet(uVar2) ) {
|
||||
ent = LoadRoomEntity(dat);
|
||||
if ((ent != NULL) && (ent->kind == ENEMY)) {
|
||||
ent->field_0x6c.HALF.LO = uVar2 | 0x80;
|
||||
ent->field_0x6c.HALF.LO = uVar2 | 0x80; // TODO Set the room tracker flag that can be set by the enemy so it does not appear next time the room is visited?
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -209,8 +209,8 @@ static void sub_0804B058(EntityData* dat) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0804B0B0(u32 arg0, u32 arg1) {
|
||||
LoadRoomEntityList(GetRoomProperty(arg0, arg1, 1));
|
||||
void sub_0804B0B0(u32 area, u32 room) {
|
||||
LoadRoomEntityList(GetRoomProperty(area, room, 1));
|
||||
}
|
||||
|
||||
void SetCurrentRoomPropertyList(u32 area, u32 room) {
|
||||
@@ -220,11 +220,11 @@ void SetCurrentRoomPropertyList(u32 area, u32 room) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0804B0E8(u32 arg0, u32 arg1) {
|
||||
void sub_0804B0E8(u32 area, u32 room) {
|
||||
void (*func)(void);
|
||||
|
||||
// init function at index 4 of room data
|
||||
func = (void (*)())GetRoomProperty(arg0, arg1, 4);
|
||||
func = (void (*)())GetRoomProperty(area, room, 4);
|
||||
if (func != NULL) {
|
||||
func();
|
||||
}
|
||||
@@ -246,7 +246,7 @@ void* GetCurrentRoomProperty(u32 idx) {
|
||||
if (gCurrentRoomProperties == NULL)
|
||||
return NULL;
|
||||
|
||||
if (idx >= 0x80) {
|
||||
if (idx >= 0x80) { // TODO different kind of room properties?
|
||||
return gRoomVars.field_0x8c[idx & 7];
|
||||
} else if (idx <= 7) {
|
||||
return gRoomVars.field_0x6c[idx];
|
||||
|
||||
+29
-26
@@ -127,11 +127,11 @@ void ScriptCommand_WalkEast(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_WalkSouth(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_WalkWest(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_0807ED24(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_0807EDD4(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_0807EE04(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_0807EE30(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_0807EEB4(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_0807EEF4(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_MoveTo(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_LookAt(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_MoveTowardsTarget(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_MoveToPlayer(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_MoveToOffset(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_0807EF3C(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_DoPostScriptAction(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_DoPostScriptAction2(Entity* entity, ScriptExecutionContext* context);
|
||||
@@ -422,7 +422,7 @@ void sub_0807DE80(Entity* entity) {
|
||||
sub_080042BA(entity, local1);
|
||||
}
|
||||
|
||||
void sub_0807DEDC(Entity* entity, ScriptExecutionContext* context, u32 x, u32 y) {
|
||||
void LookAt(Entity* entity, ScriptExecutionContext* context, u32 x, u32 y) {
|
||||
static const u8 sDirectionTable[] = { 0, 0, 2, 2, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 0, 0 };
|
||||
int direction;
|
||||
s32 xOffset, yOffset;
|
||||
@@ -434,7 +434,7 @@ void sub_0807DEDC(Entity* entity, ScriptExecutionContext* context, u32 x, u32 y)
|
||||
context->y.HALF.HI = y;
|
||||
xOffset = context->x.HALF.HI - entity->x.HALF.HI;
|
||||
yOffset = context->y.HALF.HI - entity->y.HALF.HI;
|
||||
direction = sub_080045DA(xOffset, yOffset);
|
||||
direction = CalculateDirectionFromOffsets(xOffset, yOffset);
|
||||
entity->direction = direction;
|
||||
entity->animationState = (entity->animationState & 0x80) | sDirectionTable[(u8)direction >> 4];
|
||||
}
|
||||
@@ -575,11 +575,11 @@ void ExecuteScript(Entity* entity, ScriptExecutionContext* context) {
|
||||
ScriptCommand_WalkSouth,
|
||||
ScriptCommand_WalkWest,
|
||||
ScriptCommand_0807ED24,
|
||||
ScriptCommand_0807EDD4,
|
||||
ScriptCommand_0807EE04,
|
||||
ScriptCommand_0807EE30,
|
||||
ScriptCommand_0807EEB4,
|
||||
ScriptCommand_0807EEF4,
|
||||
ScriptCommand_MoveTo,
|
||||
ScriptCommand_LookAt,
|
||||
ScriptCommand_MoveTowardsTarget,
|
||||
ScriptCommand_MoveToPlayer,
|
||||
ScriptCommand_MoveToOffset,
|
||||
ScriptCommand_0807EF3C,
|
||||
ScriptCommand_DoPostScriptAction,
|
||||
ScriptCommand_DoPostScriptAction2,
|
||||
@@ -1368,29 +1368,30 @@ void ScriptCommand_0807ED24(Entity* entity, ScriptExecutionContext* context) {
|
||||
gActiveScriptInfo.commandSize = 0;
|
||||
}
|
||||
|
||||
void ScriptCommand_0807EDD4(Entity* entity, ScriptExecutionContext* context) {
|
||||
void ScriptCommand_MoveTo(Entity* entity, ScriptExecutionContext* context) {
|
||||
if (!context->unk_18) {
|
||||
context->unk_18 = 1;
|
||||
ScriptCommand_0807EE04(entity, context);
|
||||
ScriptCommand_LookAt(entity, context);
|
||||
}
|
||||
ScriptCommand_0807EE30(entity, context);
|
||||
ScriptCommand_MoveTowardsTarget(entity, context);
|
||||
// Repeat this command until we are at the target.
|
||||
if (!context->condition) {
|
||||
gActiveScriptInfo.commandSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptCommand_0807EE04(Entity* entity, ScriptExecutionContext* context) {
|
||||
sub_0807DEDC(entity, context, context->scriptInstructionPointer[1] + gRoomControls.origin_x,
|
||||
void ScriptCommand_LookAt(Entity* entity, ScriptExecutionContext* context) {
|
||||
LookAt(entity, context, context->scriptInstructionPointer[1] + gRoomControls.origin_x,
|
||||
context->scriptInstructionPointer[2] + gRoomControls.origin_y);
|
||||
gActiveScriptInfo.flags |= 1;
|
||||
}
|
||||
|
||||
void ScriptCommand_0807EE30(Entity* entity, ScriptExecutionContext* context) {
|
||||
void ScriptCommand_MoveTowardsTarget(Entity* entity, ScriptExecutionContext* context) {
|
||||
s32 tmp, tmp2;
|
||||
if (!--context->unk_19) {
|
||||
context->unk_19 = 8;
|
||||
entity->direction =
|
||||
sub_080045DA(context->x.HALF.HI - entity->x.HALF.HI, context->y.HALF.HI - entity->y.HALF.HI);
|
||||
CalculateDirectionFromOffsets(context->x.HALF.HI - entity->x.HALF.HI, context->y.HALF.HI - entity->y.HALF.HI);
|
||||
}
|
||||
tmp = entity->x.HALF.HI - context->x.HALF.HI;
|
||||
tmp2 = entity->y.HALF.HI - context->y.HALF.HI;
|
||||
@@ -1406,24 +1407,26 @@ void ScriptCommand_0807EE30(Entity* entity, ScriptExecutionContext* context) {
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptCommand_0807EEB4(Entity* entity, ScriptExecutionContext* context) {
|
||||
void ScriptCommand_MoveToPlayer(Entity* entity, ScriptExecutionContext* context) {
|
||||
if (!context->unk_18) {
|
||||
context->unk_18 = 1;
|
||||
sub_0807DEDC(entity, context, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI);
|
||||
LookAt(entity, context, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI);
|
||||
}
|
||||
ScriptCommand_0807EE30(entity, context);
|
||||
ScriptCommand_MoveTowardsTarget(entity, context);
|
||||
// Repeat this command until we are at the target.
|
||||
if (!context->condition) {
|
||||
gActiveScriptInfo.commandSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptCommand_0807EEF4(Entity* entity, ScriptExecutionContext* context) {
|
||||
void ScriptCommand_MoveToOffset(Entity* entity, ScriptExecutionContext* context) {
|
||||
if (!context->unk_18) {
|
||||
context->unk_18 = 1;
|
||||
sub_0807DEDC(entity, context, entity->x.HALF.HI + ((s16)context->scriptInstructionPointer[1]),
|
||||
LookAt(entity, context, entity->x.HALF.HI + ((s16)context->scriptInstructionPointer[1]),
|
||||
entity->y.HALF.HI + ((s16)context->scriptInstructionPointer[2]));
|
||||
}
|
||||
ScriptCommand_0807EE30(entity, context);
|
||||
ScriptCommand_MoveTowardsTarget(entity, context);
|
||||
// Repeat this command until we are at the target.
|
||||
if (!context->condition) {
|
||||
gActiveScriptInfo.commandSize = 0;
|
||||
}
|
||||
@@ -1573,7 +1576,7 @@ void sub_0807F190(Entity* entity, ScriptExecutionContext* context) {
|
||||
}
|
||||
|
||||
void sub_0807F1A0(Entity* entity, ScriptExecutionContext* context) {
|
||||
sub_0807DEDC(entity, context, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI);
|
||||
LookAt(entity, context, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI);
|
||||
gActiveScriptInfo.flags |= 1;
|
||||
}
|
||||
|
||||
|
||||
+13
-13
@@ -295,28 +295,28 @@ void SetGFXSlotStatus(GfxSlot* slot, u32 status) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds slotCount continous free slots and returns the index of the first slot or 0 if not enough free slots could be
|
||||
* Finds slotCount continuos free slots and returns the index of the first slot or 0 if not enough free slots could be
|
||||
* found.
|
||||
*/
|
||||
u32 FindFreeGFXSlots(u32 slotCount) {
|
||||
u32 index;
|
||||
u32 continuousFreeSlots = 0;
|
||||
u32 continuosFreeSlots = 0;
|
||||
|
||||
// First search for enough continous free slots.
|
||||
// First search for enough continuos free slots.
|
||||
for (index = 4; index < MAX_GFX_SLOTS; index++) {
|
||||
if (gGFXSlots.slots[index].status == GFX_SLOT_FREE) {
|
||||
continuousFreeSlots++;
|
||||
if (slotCount <= continuousFreeSlots) {
|
||||
return (index - continuousFreeSlots) + 1;
|
||||
continuosFreeSlots++;
|
||||
if (slotCount <= continuosFreeSlots) {
|
||||
return (index - continuosFreeSlots) + 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
continuousFreeSlots = 0;
|
||||
continuosFreeSlots = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Now also search for enough continous free or unused slots.
|
||||
continuousFreeSlots = 0;
|
||||
// Now also search for enough continuos free or unused slots.
|
||||
continuosFreeSlots = 0;
|
||||
index = 4;
|
||||
for (index = 4; index < MAX_GFX_SLOTS; index++) {
|
||||
#ifdef EU
|
||||
@@ -324,12 +324,12 @@ u32 FindFreeGFXSlots(u32 slotCount) {
|
||||
#else
|
||||
if (gGFXSlots.slots[index].status == GFX_SLOT_FREE || gGFXSlots.slots[index].status == GFX_SLOT_UNLOADED) {
|
||||
#endif
|
||||
continuousFreeSlots++;
|
||||
if (slotCount <= continuousFreeSlots) {
|
||||
return (index - continuousFreeSlots) + 1;
|
||||
continuosFreeSlots++;
|
||||
if (slotCount <= continuosFreeSlots) {
|
||||
return (index - continuosFreeSlots) + 1;
|
||||
}
|
||||
} else {
|
||||
continuousFreeSlots = 0;
|
||||
continuosFreeSlots = 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user