Merge remote-tracking branch 'upstream/master' into coord

This commit is contained in:
Tal Hayon
2022-01-23 17:24:55 +02:00
149 changed files with 693 additions and 827 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ void sub_0809CC74(Entity* this) {
ent = CreateObject(BAKER_OVEN, 1, i);
if (ent) {
ent->parent = this;
PositionRelative(this, ent, (((i + 1) / 2) * 0x100000) - 0x80000, -0xe0000);
PositionRelative(this, ent, 16 * Q_16_16((i + 1) / 2) - Q_16_16(8.0), Q_16_16(-14.0));
}
}
sub_0809CDF0(this);
+3 -3
View File
@@ -65,7 +65,7 @@ void sub_08098DC4(Entity* this) {
sub_08004542(this);
sub_08004542(&gPlayerEntity);
gPlayerEntity.collisionLayer = 1;
ResolveEntityOnTop(this, &gPlayerEntity);
SortEntityAbove(this, &gPlayerEntity);
gPlayerState.queued_action = PLAYER_PARACHUTE;
gPlayerState.field_0x34[4] = 1;
gPlayerState.field_0x34[5] = this->type2;
@@ -101,12 +101,12 @@ void sub_08098E88(Entity* this) {
ent1 = CreateObject(BIG_VORTEX, 1, 0);
if (ent1 != NULL) {
PositionRelative(this, ent1, 0, -0x10000);
PositionRelative(this, ent1, 0, Q_16_16(-1.0));
ent1->spriteOffsetY = 8;
}
ent2 = CreateObject(BIG_VORTEX, 2, 0);
if (ent2 != NULL) {
PositionRelative(this, ent2, 0, -0x20000);
PositionRelative(this, ent2, 0, Q_16_16(-2.0));
ent2->spriteOffsetY = 0x10;
}
}
+8 -8
View File
@@ -24,9 +24,9 @@ void sub_0809CF54(Entity* this) {
this->spriteSettings.draw = TRUE;
this->actionDelay = 0x31;
this->field_0xf = 1;
this->zVelocity = -0x18000;
this->z.WORD = -0x38C000;
this->field_0x68.HWORD = -0x800;
this->zVelocity = Q_16_16(-1.5);
this->z.WORD = Q_16_16(-56.75);
this->field_0x68.HWORD = Q_16_16(-0.03125);
this->speed = 0x280;
this->direction = 8;
this->collisionLayer = 2;
@@ -37,8 +37,8 @@ void sub_0809CF54(Entity* this) {
target = CreateObject(BIRD, 1, 0);
if (target != NULL) {
target->parent = this;
PositionRelative(this, target, 0, 0x80000);
ResolveEntityOnTop(this, target);
PositionRelative(this, target, 0, Q_16_16(8.0));
SortEntityAbove(this, target);
}
}
@@ -77,7 +77,7 @@ void sub_0809D084(Entity* this) {
if (this->parent != NULL) {
temp = this->parent->field_0xf;
if (temp != 0) {
PositionRelative(this->parent, this, 0, 0x80000);
PositionRelative(this->parent, this, 0, Q_16_16(8.0));
} else {
this->subAction++;
this->zVelocity = temp;
@@ -97,7 +97,7 @@ void sub_0809D0AC(Entity* this) {
SoundReq(SFX_SECRET);
fx = CreateFx(this, FX_DASH, 0);
if (fx != NULL) {
ResolveEntityBelow(this, fx);
SortEntityBelow(this, fx);
}
}
}
@@ -116,7 +116,7 @@ void sub_0809D10C(Entity* this) {
void sub_0809D130(Entity* this) {
if ((gPlayerState.flags & PL_MINISH) != 0) {
sub_0800445C(this);
} else if (sub_08017850(this) != 0) {
} else if (IsCollidingPlayer(this) != 0) {
CreateItemEntity(0x17, 0, 0);
gSave.windcrests |= 0x10000000;
DeleteThisEntity();
+2 -2
View File
@@ -134,14 +134,14 @@ void sub_0809B56C(Entity* this) {
fx = CreateFx(this, FX_DEATH, 0);
if (fx) {
ResolveEntityOnTop(this, fx);
SortEntityAbove(this, fx);
}
}
void sub_0809B5B4(Entity* this) {
if (gPlayerState.flags & PL_MINISH) {
sub_0800445C(this);
} else if (sub_08017850(this)) {
} else if (IsCollidingPlayer(this)) {
CreateItemEntity(this->type + 0x39, 0, 0);
DeleteThisEntity();
}
+2 -2
View File
@@ -90,7 +90,7 @@ void sub_08081C30(Entity* this) {
this->action = 2;
ClearFlag(this->field_0x86.HWORD);
SetTileType(0x77, this->field_0x74.HWORD, this->collisionLayer);
SoundReq(SFX_10C);
SoundReq(SFX_BUTTON_PRESS);
}
}
@@ -251,7 +251,7 @@ u32 sub_08081F7C(Entity* this, u32 r7) {
SetFlag(this->field_0x86.HWORD);
SetTileType(r7, this->field_0x74.HWORD, this->collisionLayer);
sub_08081F24(this);
SoundReq(SFX_10C);
SoundReq(SFX_BUTTON_PRESS);
if (this->field_0x70.HALF_U.LO != 0xFFFF)
SetTile(this->field_0x70.HALF_U.LO, this->field_0x74.HWORD, this->collisionLayer);
return 0;
+2 -2
View File
@@ -256,7 +256,7 @@ void sub_0808EB74(Entity* this) {
this->x.WORD = entity->x.WORD;
this->y.WORD = entity->y.WORD;
this->spriteRendering.b3 = entity->spriteRendering.b3;
ResolveEntityBelow(entity, this);
SortEntityBelow(entity, this);
} else {
this->x.HALF.HI = 0xF000;
this->y.HALF.HI = 0xF000;
@@ -306,7 +306,7 @@ void sub_0808EBB8(Entity* this) {
default:
entity = sub_0808EC80(var0);
if (entity) {
ResolveEntityBelow(entity, this);
SortEntityBelow(entity, this);
this->spriteRendering.b3 = entity->spriteRendering.b3;
x = entity->x.HALF.HI;
y = entity->y.HALF.HI;
+2 -2
View File
@@ -220,7 +220,7 @@ static void FurnitureInit(FurnitureEntity* this) {
case SMITH_FORGE:
e = CreateObject(FURNITURE, FORGE_HELPER, 0);
if (e != NULL) {
PositionRelative(super, e, 0x100000, 0x100000);
PositionRelative(super, e, Q_16_16(16.0), Q_16_16(16.0));
e->frameIndex = 1;
e->updatePriority = PRIO_MESSAGE;
}
@@ -451,7 +451,7 @@ static void sub_08090E4C(FurnitureEntity* this) {
void sub_08090E64(FurnitureEntity* this) {
Entity* e = CreateObject(OBJECT_2A, 0, 0);
if (e != NULL) {
PositionRelative(super, e, (s16)((u16)-2 + super->type2) * 0x10000, 0);
PositionRelative(super, e, Q_16_16((s16)((u16)-2 + super->type2)), 0);
e->z.HALF.HI -= 16;
e->collisionLayer = 2;
UpdateSpriteForCollisionLayer(e);
+7 -7
View File
@@ -92,8 +92,8 @@ void GreatFairy_DormantUpdate(Entity* this) {
case 289:
ripple = GreatFairy_CreateForm(this, RIPPLE, 0);
if (ripple) {
PositionRelative(this, ripple, (s32)GreatFairy_RippleOffsets[this->actionDelay] * 65536,
(s32)GreatFairy_RippleOffsets[this->actionDelay + 1] * 65536);
PositionRelative(this, ripple, Q_16_16(GreatFairy_RippleOffsets[this->actionDelay]),
Q_16_16(GreatFairy_RippleOffsets[this->actionDelay + 1]));
this->actionDelay += 2;
break;
}
@@ -105,7 +105,7 @@ void GreatFairy_CreateBigRipple(Entity* this) {
ripple = GreatFairy_CreateForm(this, BIGRIPPLE, 0);
if (ripple != NULL) {
PositionRelative(this, ripple, 0, 0x80000);
PositionRelative(this, ripple, 0, Q_16_16(8.0));
this->action = 3;
}
}
@@ -137,7 +137,7 @@ void GreatFairy_MiniUpdate(Entity* this) {
} else {
target = GreatFairy_CreateForm(this, WINGS, 0);
if (target != NULL) {
PositionRelative(this, target, 0, -0x140000);
PositionRelative(this, target, 0, Q_16_16(-20.0));
this->action = 5;
this->actionDelay = 120;
this->field_0xf = 0;
@@ -153,7 +153,7 @@ void GreatFairy_FinalUpdate(Entity* this) {
--this->actionDelay;
} else {
if ((this->field_0xf == 0) && (target = GreatFairy_CreateForm(this, FORM9, 0), target != NULL)) {
PositionRelative(this, target, 0, -0x4C0000);
PositionRelative(this, target, 0, Q_16_16(-76.0));
target->parent = this;
this->field_0xf = 1;
}
@@ -236,7 +236,7 @@ void GreatFairy_MiniRisingUpdate(Entity* this) {
} else {
if (((this->z.HALF.HI == -10) && (this->field_0xf == 0)) &&
(target = GreatFairy_CreateForm(this, DROPLET, 0), target != NULL)) {
PositionRelative(this, target, 0, 0x40000);
PositionRelative(this, target, 0, Q_16_16(4.0));
this->field_0xf = 1;
}
}
@@ -350,7 +350,7 @@ void GreatFairy_BigRippleUpdate(Entity* this) {
} else {
target = GreatFairy_CreateForm(this, MINI, 0);
if (target != NULL) {
PositionRelative(this, target, 0, -0x80000);
PositionRelative(this, target, 0, Q_16_16(-8.0));
gRoomVars.animFlags |= 2;
DeleteEntity(this);
}
+1 -1
View File
@@ -59,7 +59,7 @@ static void sub_0808E714(Entity* this) {
static void sub_0808E764(Entity* this) {
sub_08080CB4(this);
if (!(gPlayerState.flags & PL_MINISH) && sub_08017850(this)) {
if (!(gPlayerState.flags & PL_MINISH) && IsCollidingPlayer(this)) {
SetFlag(this->cutsceneBeh.HWORD);
CreateItemEntity(0x62, 0, 0);
DeleteThisEntity();
+7 -7
View File
@@ -18,7 +18,7 @@ void sub_080813BC(Entity*);
void sub_080810FC(Entity*);
bool32 CheckShouldPlayItemGetCutscene(Entity*);
extern u32 sub_080177A0(Entity*, Entity*);
extern u32 IsColliding(Entity*, Entity*);
extern void GiveItem(u32, u32);
extern void (*const gUnk_0811E7D4[])(Entity*);
@@ -149,7 +149,7 @@ void sub_080810A8(Entity* this) {
}
if (this->zVelocity == 0) {
this->zVelocity = 0x1E000;
this->zVelocity = Q_16_16(1.875);
}
if (this->collisionLayer == 2) {
@@ -269,10 +269,10 @@ void sub_080812A8(Entity* this) {
void sub_080812E8(Entity* this) {
PlayerState* playerState = &gPlayerState;
#ifdef EU
if ((playerState->swim_state & 0x80) && sub_080177A0(this, &gPlayerEntity)) {
if ((playerState->swim_state & 0x80) && IsColliding(this, &gPlayerEntity)) {
#else
if ((playerState->swim_state & 0x80) && (playerState->flags & PL_MINISH) == 0 &&
sub_080177A0(this, &gPlayerEntity)) {
IsColliding(this, &gPlayerEntity)) {
#endif
sub_080810FC(this);
}
@@ -289,7 +289,7 @@ void sub_08081328(Entity* this) {
CopyPosition(other, this);
this->z.HALF.HI--;
other = &gPlayerEntity;
if (sub_080177A0(this, other)) {
if (IsColliding(this, other)) {
sub_080810FC(this);
}
}
@@ -412,7 +412,7 @@ void sub_0808153C(Entity* this) {
if (this->field_0x68.HALF.LO == 0) {
if (!GravityUpdate(this, 0x1000) && !sub_0800442E(this)) {
this->field_0x68.HALF.LO = 1;
this->zVelocity = 0x1E000;
this->zVelocity = Q_16_16(1.875);
sub_0808148C(this->type);
UpdateSpriteForCollisionLayer(this);
}
@@ -432,7 +432,7 @@ void sub_08081598(Entity* this) {
COLLISION_OFF(this);
this->action = 4;
this->actionDelay = 14;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
this->spriteSettings.draw = 1;
this->spritePriority.b1 = 2;
this->spritePriority.b0 = 3;
+5 -5
View File
@@ -60,7 +60,7 @@ void sub_0808BF58(Entity* this) {
GravityUpdate(this, 0x2000);
switch (this->subAction) {
case 0:
if (this->zVelocity <= 98303) {
if (this->zVelocity < Q_16_16(1.5)) {
++this->subAction;
InitAnimationForceUpdate(this, 2);
}
@@ -69,7 +69,7 @@ void sub_0808BF58(Entity* this) {
UpdateAnimationSingleFrame(this);
if (!this->z.HALF.HI) {
++this->subAction;
this->zVelocity = 0x8000;
this->zVelocity = Q_16_16(0.5);
}
break;
case 2:
@@ -128,7 +128,7 @@ void sub_0808C0AC(Entity* this) {
GravityUpdate(this, 0x2000);
switch (this->subAction) {
case 0:
if (this->zVelocity <= 98303) {
if (this->zVelocity < Q_16_16(1.5)) {
this->subAction = 1;
InitAnimationForceUpdate(this, 3);
}
@@ -137,7 +137,7 @@ void sub_0808C0AC(Entity* this) {
UpdateAnimationSingleFrame(this);
if (!this->z.HALF.HI) {
++this->subAction;
this->zVelocity = 0x8000;
this->zVelocity = Q_16_16(0.5);
}
break;
case 2:
@@ -157,7 +157,7 @@ u32 sub_0808C128(Entity* this) {
void sub_0808C13C(Entity* this) {
this->subAction = 0;
this->zVelocity = 163840;
this->zVelocity = Q_16_16(2.5);
}
void sub_0808C148(Entity* this, u32 a2) {
+1 -1
View File
@@ -163,7 +163,7 @@ void sub_08085B40(LilypadLargeEntity* this) {
ResetCollisionLayer(&gPlayerEntity);
sub_08085CDC(this);
super->direction = GetFacingDirection(&gPlayerEntity, super);
sub_0806F5BC(&gPlayerEntity, 0x100, super->direction);
LinearMoveDirection(&gPlayerEntity, 0x100, super->direction);
}
}
+1 -1
View File
@@ -39,7 +39,7 @@ void sub_080929A4(Entity* this) {
}
this->action = 1;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->field_0x78.HWORD = ((Random() & 7) << 10) | 0x2000;
+3 -3
View File
@@ -45,7 +45,7 @@ void sub_080916EC(Entity* this) {
void sub_080917DC(Entity* this) {
if ((this->bitfield & 0x7f) == 0x1d) {
this->zVelocity = 0x2a000;
this->zVelocity = Q_16_16(2.625);
this->action = 7;
InitAnimationForceUpdate(this, this->type2 + 4 + this->animationState);
SoundReq(SFX_13B);
@@ -65,7 +65,7 @@ void sub_080917DC(Entity* this) {
this->action++;
gPlayerState.jump_status = 0x81;
gPlayerState.flags |= PL_ENTER_MINECART;
gPlayerEntity.zVelocity = 0x20000;
gPlayerEntity.zVelocity = Q_16_16(2.0);
gPlayerEntity.speed = 0x100;
gPlayerEntity.flags &= ~PL_MINISH;
ResetPlayer();
@@ -160,7 +160,7 @@ void sub_080919AC(Entity* this) {
sub_08017744(this);
gPlayerState.jump_status = 0x41;
gPlayerState.flags = (gPlayerState.flags ^ PL_IN_MINECART) | PL_ENTER_MINECART;
gPlayerEntity.zVelocity = 0x20000;
gPlayerEntity.zVelocity = Q_16_16(2.0);
gPlayerEntity.speed = 0x200;
gPlayerEntity.animationState = this->animationState << 1;
gPlayerEntity.direction = this->direction;
+2 -2
View File
@@ -178,14 +178,14 @@ void sub_0808F3DC(Entity* this) {
// TODO: This block of code might supposed to be a switch statement.
if (this->type != 8) {
if (this->type == 7) {
ResolveEntityBelow(this->child, this);
SortEntityBelow(this->child, this);
return;
}
} else {
this->hitType = this->child->hitType;
this->child->hitType = 0x7E;
}
ResolveEntityOnTop(this->child, this);
SortEntityAbove(this->child, this);
} else {
if (*(u32*)&this->parent->field_0x74 == 0) {
if (this->type == 8) {
+31 -31
View File
@@ -237,7 +237,7 @@ void sub_08094C88(Object6AEntity* this) {
case 0x41:
case 0x42:
case 0x43:
ResolveEntityBelow(super, super);
SortEntityBelow(super, super);
}
}
@@ -250,8 +250,8 @@ void sub_08094C88(Object6AEntity* this) {
void sub_08094CDC(Object6AEntity* this) {
Entity* e = CreateObject(0x6a, 3, 0x62);
if (e != NULL) {
e->x.HALF.HI = gRoomControls.origin_x + 224;
e->y.HALF.HI = gRoomControls.origin_y + 600;
e->x.HALF.HI = gRoomControls.origin_x + Q_8_8(7.0 / 8.0);
e->y.HALF.HI = gRoomControls.origin_y + Q_8_8(2.345);
SoundReq(324);
}
}
@@ -266,8 +266,8 @@ void sub_08094D10(Object6AEntity* this) {
void sub_08094D34(Object6AEntity* this) {
Entity* e = CreateObject(0x6a, 0x15, 0xd);
if (e != NULL) {
e->x.HALF.HI = gRoomControls.origin_x + 256;
e->y.HALF.HI = gRoomControls.origin_y + 600;
e->x.HALF.HI = gRoomControls.origin_x + Q_8_8(1.0);
e->y.HALF.HI = gRoomControls.origin_y + Q_8_8(2.345);
SoundReq(324);
}
}
@@ -299,8 +299,8 @@ void sub_08094D94(Object6AEntity* this) {
void sub_08094DD8(Object6AEntity* this) {
Entity* e = CreateObject(0x6a, 0x4, 0);
if (e != NULL) {
e->x.HALF.HI = gRoomControls.origin_x + 240;
e->y.HALF.HI = gRoomControls.origin_y + 600;
e->x.HALF.HI = gRoomControls.origin_x + Q_8_8(15.0 / 16.0);
e->y.HALF.HI = gRoomControls.origin_y + Q_8_8(2.345);
SoundReq(324);
}
}
@@ -338,7 +338,7 @@ void sub_08094E30(Object6AEntity* this) {
break;
case 1:
super->z.WORD -= super->zVelocity;
super->zVelocity -= 0x2000;
super->zVelocity -= Q_8_8(32.0);
if (super->z.WORD > 0) {
super->action++;
super->z.WORD = 0;
@@ -355,7 +355,7 @@ void sub_08094E30(Object6AEntity* this) {
break;
case 3:
super->z.WORD -= super->zVelocity;
super->zVelocity -= 0x2000;
super->zVelocity -= Q_8_8(32.0);
if (!CheckOnScreen(super)) {
DeleteThisEntity();
}
@@ -473,7 +473,7 @@ void sub_08095120(Object6AEntity* this) {
if (super->action == 0) {
super->action = 1;
SetDefaultPriority(super, 3);
ResolveEntityBelow(super, super);
SortEntityBelow(super, super);
sub_0807DD64(super);
InitAnimationForceUpdate(super, 2);
}
@@ -493,7 +493,7 @@ void sub_08095188(Object6AEntity* this) {
if (super->action == 0) {
super->action = 1;
SetDefaultPriority(super, 3);
ResolveEntityBelow(super, super);
SortEntityBelow(super, super);
sub_0807DD64(super);
InitAnimationForceUpdate(super, 0);
}
@@ -535,7 +535,7 @@ void sub_08095244(Object6AEntity* this) {
Entity* e = CreateObject(OBJECT_6A, 0xA, 0);
if (e != NULL) {
e->parent = super;
PositionRelative(super, e, 0x100000, -0x100000);
PositionRelative(super, e, Q_16_16(16.0), -Q_16_16(16.0));
((Object6AEntity*)e)->ctx = StartCutscene(e, &script_Object6ASwordInChest);
}
}
@@ -583,7 +583,7 @@ void sub_08095330(Object6AEntity* this) {
e->parent = super;
CopyPosition(super, e);
e->z.HALF.HI = -16;
ResolveEntityOnTop(e, e);
SortEntityAbove(e, e);
}
}
@@ -597,7 +597,7 @@ void sub_08095364(Object6AEntity* this) {
e->subAction = 1;
e->z.HALF.HI = -16;
e->direction = 7;
e->zVelocity = 0x30000;
e->zVelocity = Q_16_16(3.0);
e->speed = 128;
InitAnimationForceUpdate(e, 1);
}
@@ -609,7 +609,7 @@ void sub_080953A4(Object6AEntity* this) {
super->z.HALF.HI = -16;
SetDefaultPriority(super, 2);
super->spriteRendering.b3 = gUnk_08114F30[super->spriteRendering.b3];
ResolveEntityOnTop(super, super);
SortEntityAbove(super, super);
sub_0807DD64(super);
}
ExecuteScriptForEntity(super, 0);
@@ -625,7 +625,7 @@ void sub_080953A4(Object6AEntity* this) {
void sub_08095420(Object6AEntity* this, ScriptExecutionContext* ctx) {
Entity* e = CreateObject(OBJECT_6A, 0xC, 0);
if (e != NULL) {
PositionRelative(super, e, 0, -0x100000);
PositionRelative(super, e, 0, Q_16_16(-16));
((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable);
}
}
@@ -637,7 +637,7 @@ void sub_0809545C(Object6AEntity* this, ScriptExecutionContext* ctx) {
Entity* p = CreateObject(OBJECT_6A, 0xD, 0);
Entity* e;
if (p != NULL) {
PositionRelative(super, p, 0, -0x100000);
PositionRelative(super, p, 0, Q_16_16(-16));
((Object6AEntity*)p)->ctx = StartCutscene(p, (u16*)ctx->intVariable);
e = CreateObject(OBJECT_6A, 2, 0);
if (e != NULL) {
@@ -692,7 +692,7 @@ void sub_080954DC(Object6AEntity* this) {
super->y.HALF.HI += this->py;
break;
case 3:
sub_0806F62C(super, super->speed, super->direction);
LinearMoveAngle(super, super->speed, super->direction);
break;
}
this->off += 4;
@@ -764,7 +764,7 @@ void sub_08095754(Object6AEntity* this) {
if (e != NULL) {
e->parent = super;
CopyPosition(super, e);
ResolveEntityBelow(super, e);
SortEntityBelow(super, e);
}
}
@@ -784,7 +784,7 @@ void sub_080957B4(Object6AEntity* this) {
if (e != NULL) {
e->parent = super;
CopyPosition(super, e);
ResolveEntityBelow(super, e);
SortEntityBelow(super, e);
}
}
@@ -804,7 +804,7 @@ void sub_08095810(Object6AEntity* this) {
if (e != NULL) {
e->parent = super;
CopyPosition(super, e);
ResolveEntityOnTop(super, e);
SortEntityAbove(super, e);
((Object6AEntity*)e)->ctx = StartCutscene(e, &script_ZeldaMagic);
}
}
@@ -1084,12 +1084,12 @@ void sub_08095DBC(Object6AEntity* this) {
super->spriteSettings.draw = 1;
InitializeAnimation(super, 75);
super->spriteRendering.b3 = gUnk_08114F30[super->spriteRendering.b3];
ResolveEntityOnTop(super, super);
SortEntityAbove(super, super);
}
if ((super->type2 & 0x80) == 0 && gActiveScriptInfo.syncFlags & 0x20000) {
super->type2 = -1;
super->zVelocity = 0x40000;
super->speed = 0xC000;
super->zVelocity = Q_16_16(4.0);
super->speed = Q_8_8(192);
}
GravityUpdate(super, super->speed);
GetNextFrame(super);
@@ -1128,7 +1128,7 @@ NONMATCH("asm/non_matching/object6A/sub_08095EAC.inc",
x = a - (Random() & b);
y = a - (Random() & b);
PositionRelative(super, e, x << 16, y << 16);
PositionRelative(super, e, Q_16_16(x), Q_16_16(y));
super->zVelocity = vel;
super->speed = speed;
}
@@ -1220,7 +1220,7 @@ void sub_080960C4(Object6AEntity* this, ScriptExecutionContext* ctx) {
e->parent = super;
CopyPosition(super, e);
e->spriteRendering.b3 = gUnk_08114F34[super->spriteRendering.b3];
ResolveEntityBelow(super, e);
SortEntityBelow(super, e);
((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable);
}
e = CreateObject(OBJECT_6A, 0x24, 0x4A);
@@ -1228,7 +1228,7 @@ void sub_080960C4(Object6AEntity* this, ScriptExecutionContext* ctx) {
e->parent = super;
CopyPosition(super, e);
e->spriteRendering.b3 = gUnk_08114F30[super->spriteRendering.b3];
ResolveEntityOnTop(super, e);
SortEntityAbove(super, e);
e->collisionLayer = 2;
((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable);
}
@@ -1241,7 +1241,7 @@ void sub_08096168(Object6AEntity* this) {
InitializeAnimation(super, 75);
}
GetNextFrame(super);
sub_0806F62C(super, super->speed, super->direction);
LinearMoveAngle(super, super->speed, super->direction);
if (!CheckOnScreen(super))
DeleteThisEntity();
}
@@ -1267,21 +1267,21 @@ void sub_08096208(Object6AEntity* this, u32 x) {
s8* p = &gUnk_08122B2E[x * 2];
Entity* e = CreateObject(OBJECT_6A, 0x26, 0);
if (e != NULL) {
PositionRelative(super, e, p[0] << 16, p[1] << 16);
PositionRelative(super, e, Q_16_16(p[0]), Q_16_16(p[1]));
}
}
void sub_0809623C(Object6AEntity* this) {
Entity* e = CreateObject(OBJECT_6A, 0x27, 0);
if (e != NULL) {
PositionRelative(super, e, 0, -0x100000);
PositionRelative(super, e, 0, Q_16_16(-16.0));
}
}
void sub_08096260(Object6AEntity* this) {
Entity* e = CreateObject(OBJECT_6A, 0x28, 0);
if (e != NULL) {
PositionRelative(super, e, 0, -0x100000);
PositionRelative(super, e, 0, Q_16_16(-16.0));
}
}
+1 -1
View File
@@ -17,7 +17,7 @@ void Object7E(Entity* this) {
this->spriteSettings.flipX = TRUE;
}
}
PositionRelative(this->parent, this, 0, 0x80000);
PositionRelative(this->parent, this, 0, Q_16_16(8.0));
this->z.HALF.HI = 0;
if (this->type != 0) {
this->spriteSettings.draw = this->child->spriteSettings.draw;
+5 -3
View File
@@ -25,14 +25,16 @@ void ObjectA2(Entity* this) {
GetNextFrame(this);
}
#define fp(n) ((n) << 8)
void sub_0809F318(Entity* this) {
InitializeAnimation(this, 0);
if (Random() & 0x10) {
this->spriteSettings.flipX = 1;
}
this->x.HALF.HI = 0x28;
this->y.HALF.HI = 0x48;
this->z.HALF.HI = 0xFFB0;
this->x.HALF.HI = Q_8_8(0.16);
this->y.HALF.HI = Q_8_8(0.285);
this->z.HALF.HI = Q_8_8(-0.315);
this->spriteOrientation.flipY = 2;
this->action = 1;
ChangeObjPalette(this, gUnk_08124704[this->type]);
+1 -1
View File
@@ -47,7 +47,7 @@ void sub_080A0624(Entity* this) {
void sub_080A0640(Entity* this) {
if (this->type == 0) {
PositionRelative(*(((Entity**)this->parent->myHeap) + 4), this, 0, 0x80000);
PositionRelative(*(((Entity**)this->parent->myHeap) + 4), this, 0, Q_16_16(8.0));
} else {
CopyPosition(this->parent, this);
}
+1 -1
View File
@@ -10,5 +10,5 @@ void ObjectB5(Entity* this) {
#ifndef EU
gRoomControls.camera_target = this;
#endif
PositionRelative(&gPlayerEntity, this, 0, -0x280000);
PositionRelative(&gPlayerEntity, this, 0, Q_16_16(-40.0));
}
+14 -13
View File
@@ -76,14 +76,14 @@ void OctorokBossObject_Init(Entity* this) {
}
this->speed = 0xf0 - (Random() & 0x3f);
sub_0806F62C(this, ((s16)this->speed >> 1) << 8, (u32)this->direction);
sub_0806F62C(this, ((s16)this->speed >> 1) << 8, (u32)this->direction);
LinearMoveAngle(this, ((s16)this->speed >> 1) << 8, (u32)this->direction);
LinearMoveAngle(this, ((s16)this->speed >> 1) << 8, (u32)this->direction);
InitializeAnimation(this, 5);
SoundReq(SFX_14C);
break;
case 3:
this->direction = -(this->parent->field_0x7a.HALF.HI + -0x80);
sub_0806F62C(this, 0x4800, (u32)this->direction);
LinearMoveAngle(this, 0x4800, (u32)this->direction);
if ((Random() & 1) != 0) {
this->direction = (Random() & 0x3f) + this->direction;
} else {
@@ -92,7 +92,7 @@ void OctorokBossObject_Init(Entity* this) {
InitializeAnimation(this, 6);
break;
case 6:
sub_0806F62C(this, (0x30 - (Random() & 0x2f)) * 0x100, Random() & 0xff);
LinearMoveAngle(this, (0x30 - (Random() & 0x2f)) * 0x100, Random() & 0xff);
if ((Random() & 1) != 0) {
this->direction = (Random() & 0x3f) + this->direction;
} else {
@@ -109,10 +109,10 @@ void OctorokBossObject_Init(Entity* this) {
this->field_0x76.HWORD = 0x400;
this->field_0x74.HWORD = 0x400;
this->field_0x7a.HWORD = 0;
sub_0806F62C(this,
((-(u32)this->parent->field_0x7a.HALF.HI << 0x18) >> 0x18) +
(u32)gUnk_0812388C[(u32)this->type2 * 2 + 1],
(u32)gUnk_0812388C[(u32)this->type2 * 2]);
LinearMoveAngle(this,
((-(u32)this->parent->field_0x7a.HALF.HI << 0x18) >> 0x18) +
(u32)gUnk_0812388C[(u32)this->type2 * 2 + 1],
(u32)gUnk_0812388C[(u32)this->type2 * 2]);
sub_0805EC9C(this, this->field_0x76.HWORD, this->field_0x74.HWORD, this->field_0x7a.HWORD);
InitializeAnimation(this, 7);
break;
@@ -170,7 +170,7 @@ NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc",
case 1:
this->direction = sub_080045DA(GET_HELPER(this)->tailObjects[this->actionDelay]->x.WORD - this->x.WORD,
GET_HELPER(this)->tailObjects[this->actionDelay]->y.WORD - this->y.WORD);
sub_0806F62C(this, this->speed, this->direction);
LinearMoveAngle(this, this->speed, this->direction);
if (EntityInRectRadius(this, GET_HELPER(this)->tailObjects[this->actionDelay], 2, 2) == 0) {
return;
}
@@ -195,7 +195,7 @@ NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc",
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);
sub_0806F62C(this, 0x280, this->direction);
LinearMoveAngle(this, 0x280, this->direction);
if (sub_0806FC80(this, this->parent, 0x48) == 0) {
return;
}
@@ -204,7 +204,7 @@ NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc",
break;
case 3:
case 6:
sub_0806F62C(this, 0x80, this->direction);
LinearMoveAngle(this, 0x80, this->direction);
if (this->frame != 0) {
DeleteThisEntity();
}
@@ -247,8 +247,9 @@ NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc",
*(int*)&this->field_0x78 -= 1;
}
CopyPosition(this->parent, this);
sub_0806F62C(this, (u32)gUnk_0812388C[(u32)this->type2 * 2 + 1],
((u8) - this->parent->field_0x7a.HALF.HI & 0xff) + (u32)gUnk_0812388C[(u32)this->type2 * 2]);
LinearMoveAngle(this, (u32)gUnk_0812388C[(u32)this->type2 * 2 + 1],
((u8) - this->parent->field_0x7a.HALF.HI & 0xff) +
(u32)gUnk_0812388C[(u32)this->type2 * 2]);
return;
case 7:
if (this->actionDelay == 0) {
+1 -1
View File
@@ -67,7 +67,7 @@ void sub_08082310(Entity* this) {
case 0x1D:
SetTile((u16)this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer);
this->action = 5;
this->zVelocity = 0x2A000;
this->zVelocity = Q_16_16(2.625);
this->spriteOffsetY = 0;
this->spriteSettings.shadow = 1;
this->spritePriority.b1 = 3;
+185
View File
@@ -0,0 +1,185 @@
#define NENT_DEPRECATED
#include "object.h"
#include "functions.h"
u32 IsColliding(Entity*, Entity*);
typedef struct {
Entity base;
/*0x68*/ union SplitHWord field_0x68;
/*0x6a*/ union SplitHWord field_0x6a;
/*0x6c*/ union SplitHWord field_0x6c;
/*0x6e*/ union SplitHWord field_0x6e;
/*0x70*/ u16 canToggle;
/*0x72*/ u8 dir;
/*0x73*/ u8 filler73[0x86 - 0x73];
/*0x86*/ u16 flag;
} PressurePlateEntity;
typedef void(PressurePlateAction)(PressurePlateEntity*);
PressurePlateAction sub_08088840;
PressurePlateAction sub_0808886C;
PressurePlateAction sub_080888F4;
extern Hitbox gUnk_080FD1D4;
static u32 sub_08088938(PressurePlateEntity*);
static u32 get_standing_count(PressurePlateEntity*);
static const u8 sSpriteOffsets[];
void PressurePlate(PressurePlateEntity* this) {
static PressurePlateAction* const sActions[] = {
sub_08088840,
sub_0808886C,
sub_080888F4,
};
if (super->field_0xf) {
if (--super->field_0xf == 0) {
this->dir = super->animationState;
InitializeAnimation(super, super->animationState);
}
}
sActions[super->action](this);
}
void sub_08088840(PressurePlateEntity* this) {
super->action = 1;
super->spriteSettings.draw = 1;
super->spritePriority.b0 = 7;
super->hitbox = &gUnk_080FD1D4;
this->dir = super->animationState;
}
void sub_0808886C(PressurePlateEntity* this) {
u8 weight;
weight = sub_08088938(this) + get_standing_count(this);
if (super->type + 2 <= weight) {
super->action = 2;
super->field_0xf = 0;
super->animationState = 4;
super->z.HALF.HI = 0;
InitializeAnimation(super, 4);
SetFlag(this->flag);
EnqueueSFX(SFX_PRESSURE_PLATE);
} else {
if (weight > super->animationState) {
if (super->type + 1 == weight) {
super->field_0xf = 4;
InitializeAnimation(super, weight + 1);
} else {
InitializeAnimation(super, weight);
}
EnqueueSFX(SFX_BUTTON_PRESS);
} else if (weight < super->animationState) {
InitializeAnimation(super, weight);
}
super->animationState = weight;
}
}
void sub_080888F4(PressurePlateEntity* this) {
u8 weight;
if (this->canToggle) {
weight = sub_08088938(this) + get_standing_count(this);
if (super->type + 2 > weight) {
super->action = 1;
super->animationState = weight;
ClearFlag(this->flag);
InitializeAnimation(super, weight);
}
}
}
static u32 NONMATCH("asm/non_matching/pressurePlate/sub_08088938.inc", sub_08088938(PressurePlateEntity* this)) {
u16 x, y;
s32 num;
u8* tmp;
u32 i;
num = 0;
x = super->x.HALF.HI - 8;
y = super->y.HALF.HI - 8;
tmp = &this->dir;
for (i = 0; i < 8; ++i) {
Entity* e = gRoomVars.field_0x8c[8 + i];
if (e != NULL) {
if ((u16)(e->x.HALF.HI - x) < 0x11 && ((u16)(e->y.HALF_U.HI - y) < 0x11)) {
e->spriteOffsetY = sSpriteOffsets[*tmp];
num++;
}
}
}
return num;
}
END_NONMATCH
static u32 get_standing_count(PressurePlateEntity* this) {
u32 num;
num = 0;
if (IsCollidingPlayer(super) != 0) {
gPlayerEntity.spriteOffsetY = sSpriteOffsets[this->dir];
num = 1;
}
if ((gPlayerState.flags & PL_CLONING) != 0) {
if (IsColliding(super, gPlayerClones[0]) != 0) {
gPlayerClones[0]->spriteOffsetY = sSpriteOffsets[this->dir];
num++;
}
if (IsColliding(super, gPlayerClones[1]) != 0) {
gPlayerClones[1]->spriteOffsetY = sSpriteOffsets[this->dir];
num++;
}
if (IsColliding(super, gPlayerClones[2]) != 0) {
gPlayerClones[2]->spriteOffsetY = sSpriteOffsets[this->dir];
num++;
}
}
return num;
}
static const u8 sSpriteOffsets[] = {
-4, -3, -2, -1, 0,
};
static const Frame gSpriteAnimations_PressurePlate_0 = {
.index = 0,
.duration = 0xFF,
.frameSettings = { .b = { .endOfAnimation = 1 } },
};
static const Frame gSpriteAnimations_PressurePlate_1 = {
.index = 1,
.duration = 0xFF,
.frameSettings = { .b = { .endOfAnimation = 1 } },
};
static const Frame gSpriteAnimations_PressurePlate_2 = {
.index = 2,
.duration = 0xFF,
.frameSettings = { .b = { .endOfAnimation = 1 } },
};
static const Frame gSpriteAnimations_PressurePlate_3 = {
.index = 3,
.duration = 0xFF,
.frameSettings = { .b = { .endOfAnimation = 1 } },
};
static const Frame gSpriteAnimations_PressurePlate_4 = {
.index = 4,
.duration = 0xFF,
.frameSettings = { .b = { .endOfAnimation = 1 } },
};
const Frame* const gSpriteAnimations_PressurePlate[] = {
&gSpriteAnimations_PressurePlate_0, &gSpriteAnimations_PressurePlate_1, &gSpriteAnimations_PressurePlate_2,
&gSpriteAnimations_PressurePlate_3, &gSpriteAnimations_PressurePlate_4,
};
+1 -1
View File
@@ -51,7 +51,7 @@ void sub_08086A6C(Entity* ent) {
u32 uVar1;
uVar1 = Random();
ent->zVelocity = 163840;
ent->zVelocity = Q_16_16(2.5);
ent->direction = DirectionNormalize(uVar1 >> 16);
ent->speed = uVar1 & 480;
}