Merge pull request #309 from notyourav/fp

fixed point stuff
This commit is contained in:
notyourav 2022-01-21 21:31:20 -08:00 committed by GitHub
commit 93e745e963
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
120 changed files with 392 additions and 387 deletions

View File

@ -446,7 +446,7 @@ sub_08054EFC: @ 0x08054EFC
subs r0, #0x10
strh r0, [r1, #0x32]
adds r0, r4, #0
bl ResolveEntityBelow
bl SortEntityBelow
_08054F54:
movs r0, #0xfd
bl SoundReq

View File

@ -724,7 +724,7 @@ _08078DE0:
strh r0, [r4, #0x32]
adds r0, r5, #0
adds r1, r4, #0
bl ResolveEntityOnTop
bl SortEntityAbove
ldr r0, _08078E34 @ =gPlayerState
ldrb r0, [r0, #5]
cmp r0, #4

View File

@ -419,7 +419,7 @@ _08080DB4:
adds r2, #1
strb r0, [r2]
adds r0, r4, #0
bl ResolveEntityOnTop
bl SortEntityAbove
b _08080E00
_08080DEE:
ldr r0, _08080E04 @ =gRoomTransition

View File

@ -3676,7 +3676,7 @@ _08027676:
mov r0, sl
ldrb r2, [r0]
adds r0, r5, #0
bl sub_0806F62C
bl LinearMoveAngle
ldrb r0, [r5, #0xa]
cmp r0, #1
beq _080276D2
@ -3692,7 +3692,7 @@ _08027676:
adds r2, r0, #0
adds r2, #0x83
ldrb r2, [r2]
bl sub_0806F62C
bl LinearMoveAngle
ldr r0, [r5, #0x68]
ldr r1, [r5, #0x54]
ldrb r2, [r1, #0xa]
@ -4033,7 +4033,7 @@ _08027934:
adds r0, #0x83
ldrb r2, [r0]
adds r0, r5, #0
bl sub_0806F62C
bl LinearMoveAngle
ldr r0, [r5, #0x2c]
str r0, [r6, #0x2c]
ldr r0, [r5, #0x30]
@ -4044,7 +4044,7 @@ _08027934:
adds r0, #0x83
ldrb r2, [r0]
adds r0, r6, #0
bl sub_0806F62C
bl LinearMoveAngle
ldr r0, [r6, #0x2c]
str r0, [r4, #0x2c]
ldr r0, [r6, #0x30]
@ -4055,7 +4055,7 @@ _08027934:
adds r0, #0x83
ldrb r2, [r0]
adds r0, r4, #0
bl sub_0806F62C
bl LinearMoveAngle
adds r0, r7, #0
bl sub_08027984
pop {r4, r5, r6, r7, pc}

View File

@ -396,7 +396,7 @@ sub_080386B8: @ 0x080386B8
cmp r1, #0
beq _08038720
adds r0, r4, #0
bl ResolveEntityOnTop
bl SortEntityAbove
_08038720:
pop {r4, pc}
.align 2, 0
@ -507,7 +507,7 @@ _080387D8:
cmp r1, #0
beq _080387EE
adds r0, r4, #0
bl ResolveEntityOnTop
bl SortEntityAbove
_080387EE:
pop {r4, pc}

View File

@ -1236,7 +1236,7 @@ sub_08049998: @ 0x08049998
ldrsh r1, [r5, r0]
ldrb r2, [r5, #0x15]
adds r0, r5, #0
bl sub_0806F62C
bl LinearMoveAngle
adds r0, r5, #0
adds r0, #0x7c
ldrb r1, [r0]
@ -1433,7 +1433,7 @@ sub_08049B20: @ 0x08049B20
ldrsh r1, [r4, r0]
ldrb r2, [r4, #0x15]
adds r0, r4, #0
bl sub_0806F62C
bl LinearMoveAngle
adds r0, r4, #0
adds r0, #0x7c
ldrb r1, [r0]

View File

@ -54,7 +54,7 @@ _080675EC:
strb r0, [r3, #0x19]
adds r0, r4, #0
adds r1, r3, #0
bl ResolveEntityOnTop
bl SortEntityAbove
_08067646:
subs r6, #1
adds r5, #2
@ -107,7 +107,7 @@ _08067656:
strb r0, [r3, #0x19]
adds r0, r4, #0
adds r1, r3, #0
bl ResolveEntityOnTop
bl SortEntityAbove
_080676B0:
subs r6, #1
adds r5, #2

View File

@ -95,7 +95,7 @@ _0809A25C:
ldrsh r1, [r7, r2]
ldrb r2, [r7, #0x15]
adds r0, r7, #0
bl sub_0806F62C
bl LinearMoveAngle
ldr r1, [r4]
ldrb r0, [r7, #0xe]
lsls r0, r0, #2
@ -206,7 +206,7 @@ _0809A33E:
lsls r1, r1, #2
ldrb r2, [r7, #0x15]
adds r0, r7, #0
bl sub_0806F62C
bl LinearMoveAngle
ldr r1, [r7, #0x50]
adds r0, r7, #0
movs r2, #0x48
@ -216,7 +216,7 @@ _0809A378:
ldrb r2, [r7, #0x15]
adds r0, r7, #0
movs r1, #0x80
bl sub_0806F62C
bl LinearMoveAngle
adds r0, r7, #0
adds r0, #0x5a
ldrb r0, [r0]
@ -335,7 +335,7 @@ _0809A436:
ldrh r3, [r3]
adds r2, r2, r3
adds r0, r7, #0
bl sub_0806F62C
bl LinearMoveAngle
b _0809A632
.align 2, 0
_0809A468: .4byte gUnk_0812388C

View File

@ -235,7 +235,7 @@ _08086428:
ldrsh r1, [r6, r0]
ldrb r2, [r6, #0x15]
adds r0, r6, #0
bl sub_0806F62C
bl LinearMoveAngle
b _0808654A
_08086440:
adds r0, r6, #0
@ -507,7 +507,7 @@ _0808663A:
ldrsh r1, [r7, r0]
ldrb r2, [r7, #0x15]
adds r0, r7, #0
bl sub_0806F62C
bl LinearMoveAngle
ldrb r0, [r7, #0x15]
movs r1, #0x80
eors r0, r1

View File

@ -919,7 +919,7 @@ _08085BB4:
lsls r1, r1, #1
ldrb r2, [r5, #0x15]
adds r0, r4, #0
bl sub_0806F5BC
bl LinearMoveDirection
_08085BE8:
adds r1, r5, #0
adds r1, #0x82

View File

@ -90,7 +90,7 @@ _0808CB70:
movs r5, #0
str r5, [r4, #0x34]
adds r1, r4, #0
bl ResolveEntityBelow
bl SortEntityBelow
ldrb r0, [r4, #0xd]
cmp r0, #0
beq _0808CB98

View File

@ -291,7 +291,7 @@ _0809C5E0: @ jump table
_0809C600:
ldr r0, [r5, #0x50]
adds r1, r5, #0
bl ResolveEntityBelow
bl SortEntityBelow
ldr r0, [r5, #0x50]
ldrb r0, [r0, #0xd]
adds r6, r5, #0
@ -382,7 +382,7 @@ _0809C6B4: .4byte gUnk_08123E1C
_0809C6B8:
ldr r0, [r5, #0x50]
adds r1, r5, #0
bl ResolveEntityBelow
bl SortEntityBelow
ldr r0, [r5, #0x50]
ldrb r0, [r0, #0xd]
adds r6, r5, #0
@ -864,7 +864,7 @@ _0809CA30:
adds r2, #2
ldrb r2, [r2]
rsbs r2, r2, #0
bl sub_0806F62C
bl LinearMoveAngle
ldr r1, [r4, #0x54]
adds r0, r4, #0
movs r2, #0x48

View File

@ -223,7 +223,7 @@ sub_0809D91C: @ 0x0809D91C
cmp r1, #0
beq _0809D934
adds r0, r4, #0
bl ResolveEntityBelow
bl SortEntityBelow
_0809D934:
movs r0, #0x72
bl SoundReq

View File

@ -1024,7 +1024,7 @@ _0809E170:
ldrsh r1, [r5, r0]
ldrb r2, [r5, #0x15]
adds r0, r5, #0
bl sub_0806F62C
bl LinearMoveAngle
movs r1, #0x2e
ldrsh r0, [r5, r1]
mov r2, r8

View File

@ -95,7 +95,7 @@ _080A0C08:
strh r0, [r4, #0x32]
adds r0, r5, #0
adds r1, r4, #0
bl ResolveEntityBelow
bl SortEntityBelow
_080A0C40:
ldrb r0, [r5, #0xf]
adds r0, #1
@ -136,7 +136,7 @@ _080A0C6E:
strh r0, [r4, #0x32]
adds r0, r5, #0
adds r1, r4, #0
bl ResolveEntityBelow
bl SortEntityBelow
_080A0C92:
ldrb r0, [r5, #0xf]
adds r0, #1
@ -159,7 +159,7 @@ _080A0CA0:
strh r0, [r4, #0x32]
adds r0, r5, #0
adds r1, r4, #0
bl ResolveEntityOnTop
bl SortEntityAbove
_080A0CC0:
movs r0, #0xb4
movs r1, #3
@ -174,7 +174,7 @@ _080A0CC0:
strh r0, [r4, #0x32]
adds r0, r5, #0
adds r1, r4, #0
bl ResolveEntityOnTop
bl SortEntityAbove
_080A0CE0:
pop {r4, r5, pc}
.align 2, 0

View File

@ -67,7 +67,7 @@ _080985AC:
_080985AE:
ldr r1, [r4, #0x50]
adds r0, r4, #0
bl ResolveEntityBelow
bl SortEntityBelow
adds r0, r4, #0
bl sub_08098918
pop {r4, r5, pc}
@ -569,7 +569,7 @@ _0809892E:
strb r0, [r2]
ldr r1, [r4, #0x50]
adds r0, r4, #0
bl ResolveEntityBelow
bl SortEntityBelow
_08098968:
ldr r2, _0809898C @ =gUnk_08123558
adds r0, r6, #0
@ -606,7 +606,7 @@ _08098990:
strb r0, [r2]
ldr r1, [r4, #0x50]
adds r0, r4, #0
bl ResolveEntityBelow
bl SortEntityBelow
_080989B2:
strh r5, [r4, #0x36]
adds r1, r4, #0

View File

@ -459,7 +459,7 @@ _080847F0:
strh r0, [r5, #0x36]
adds r0, r4, #0
adds r1, r5, #0
bl ResolveEntityOnTop
bl SortEntityAbove
adds r0, r5, #0
bl sub_080845DC
pop {r4, r5, pc}

View File

@ -167,7 +167,7 @@ _080A2BB4:
bl PositionRelative
adds r0, r5, #0
adds r1, r4, #0
bl ResolveEntityOnTop
bl SortEntityAbove
adds r0, r5, #0
adds r0, #0x62
ldrb r0, [r0]
@ -380,7 +380,7 @@ CreateSpeechBubble: @ 0x080A2D2C
bl CopyPosition
adds r0, r5, #0
adds r1, r4, #0
bl ResolveEntityOnTop
bl SortEntityAbove
str r5, [r4, #0x50]
adds r0, r4, #0
adds r0, #0x62

View File

@ -12,8 +12,8 @@ void PositionEntityOnTop(Entity*, Entity*);
void PositionRelative(Entity*, Entity*, s32, s32);
void CopyPositionAndSpriteOffset(Entity* param_1, Entity* param_2);
void sub_0806FA90(Entity*, Entity*, s32, s32);
void ResolveEntityOnTop(Entity*, Entity*);
void ResolveEntityBelow(Entity*, Entity*);
void SortEntityAbove(Entity*, Entity*);
void SortEntityBelow(Entity*, Entity*);
u32 sub_0806F5A4(u32 idx);
u32 sub_0806F3E4(Entity*);

View File

@ -160,14 +160,14 @@ typedef struct Entity_ {
/*0x1d*/ u8 field_0x1d;
/*0x1e*/ u8 frameIndex;
/*0x1f*/ u8 lastFrameIndex;
/*0x20*/ s32 zVelocity; /**< Z axis speed. */
/*0x20*/ s32 zVelocity; /**< Z axis speed, measured in px/frame */
/*0x24*/ s16 speed; /**< Magnitude of speed. */
/*0x26*/ u8 spriteAnimation[3];
/*0x29*/ SpritePriority spritePriority;
/*0x2a*/ u16 collisions;
/*0x2c*/ union SplitWord x; /**< X position, fixed point. */
/*0x30*/ union SplitWord y; /**< Y position, fixed point. */
/*0x34*/ union SplitWord z; /**< Z position, fixed point. */
/*0x2c*/ union SplitWord x; /**< X position, fixed point Q16.16. */
/*0x30*/ union SplitWord y; /**< Y position, fixed point Q16.16. */
/*0x34*/ union SplitWord z; /**< Z position, fixed point Q16.16. */
/*0x38*/ u8 collisionLayer; /**< Collision layer. */
/*0x39*/ s8 interactType;
/*0x3a*/ u8 field_0x3a;

View File

@ -96,7 +96,7 @@ extern u32 sub_0805F8F8(u32);
extern u32 sub_0805F7A0(u32);
extern u32* sub_0805F25C(u32);
u32 sub_0806FCB8(Entity*, u32, u32, u32);
extern void sub_0806F62C(Entity*, u32, u32);
extern void LinearMoveAngle(Entity*, u32, u32);
extern void sub_080A1ED0(u32, u32, u32);
extern u32 sub_0806F5B0(u32);
extern void sub_08078790(Entity*, u32);
@ -125,7 +125,7 @@ extern bool32 sub_080806BC(u32, u32, u32, u32);
extern bool32 sub_0806FC80(Entity*, Entity*, s32);
extern u32 sub_080002B4(Entity*, u32, u32);
extern u32 sub_080AF134(Entity*);
extern void sub_0806F5BC(Entity*, u32, u32);
extern void LinearMoveDirection(Entity*, u32, u32);
extern void sub_080A2AF4(Entity*, u32, u32);
extern u32 sub_080002CC(Entity*, s32, s32);
extern bool32 sub_0807BD14(Entity*, u32);

View File

@ -59,8 +59,8 @@
// Converts a number to Q8.8 fixed-point format
#define Q_8_8(n) ((s16)((n)*256))
// Converts a number to Q4.12 fixed-point format
#define Q_4_12(n) ((s16)((n)*4096))
// Converts a number to Q16.16 fixed-point format
#define Q_16_16(n) ((s32)((n) * (1 << 16)))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) >= (b) ? (a) : (b))

View File

@ -250,7 +250,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
} else if (arg0->id == 0x1e) {
itemEntity->direction = arg0->animationState << 3 | 0x80;
itemEntity->speed = 0xc0;
itemEntity->zVelocity = 0x18000;
itemEntity->zVelocity = Q_16_16(1.5);
}
}
CopyPosition(arg0, itemEntity);

View File

@ -290,7 +290,7 @@ void sub_080179EC(Entity* a1, Entity* a2) {
u32 rand = Random();
Entity* e = CreateFx(a2, p[rand & 3], 0);
if (e != NULL) {
PositionRelative(a2, e, a2->hitbox->offset_x << 16, a2->hitbox->offset_y << 16);
PositionRelative(a2, e, Q_16_16(a2->hitbox->offset_x), Q_16_16(a2->hitbox->offset_y));
e->spritePriority.b0 = 2;
e->spriteOffsetX = (a1->x.HALF.HI + a1->hitbox->offset_x - (a2->x.HALF.HI + a2->hitbox->offset_x)) >> 1;
e->spriteOffsetY = (a1->y.HALF.HI + a1->hitbox->offset_y - (a2->y.HALF.HI + a2->hitbox->offset_y)) >> 1;
@ -541,9 +541,9 @@ s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings)
gPlayerState.jump_status = 0;
if (tgt->kind == ENEMY && (tgt->id == GHINI || tgt->id == ENEMY_50)) {
org->z.HALF.HI = 0;
PositionRelative(org, tgt, 0, 0x10000);
PositionRelative(org, tgt, 0, Q_16_16(1.0));
} else {
PositionRelative(tgt, org, 0, 0x10000);
PositionRelative(tgt, org, 0, Q_16_16(1.0));
}
COLLISION_OFF(org);
org->spriteRendering.b3 = tgt->spriteRendering.b3;

View File

@ -75,7 +75,7 @@ u32 sub_0806F3E4(Entity* ent) {
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;
sub_0806F5BC(ent, ent->field_0x46, GetFacingDirection(ent, &tmp_ent));
LinearMoveDirection(ent, ent->field_0x46, GetFacingDirection(ent, &tmp_ent));
if (sub_0800419C(&tmp_ent, ent, 4, 4)) {
u32 state = ent->field_0x1c & 0xF;
if (state == 2) {
@ -146,7 +146,7 @@ u32 sub_0806F5B0(u32 idx) {
return gUnk_08114F58[idx];
}
void sub_0806F5BC(Entity* ent, u32 a, u32 b) {
void LinearMoveDirection(Entity* ent, u32 a, u32 b) {
if ((b & 0x80) == 0) {
u32 m1 = b;
@ -155,15 +155,15 @@ void sub_0806F5BC(Entity* ent, u32 a, u32 b) {
}
}
void sub_0806F62C(Entity* ent, u32 a, u32 b) {
void LinearMoveAngle(Entity* ent, u32 a, u32 b) {
ent->x.WORD += FixedDiv(FixedMul(gSineTable[(u8)b], a), 256) << 8;
ent->y.WORD -= FixedDiv(FixedMul(gSineTable[(u8)b + 64], a), 256) << 8;
}
void LinearMoveUpdate(Entity* ent) {
if ((ent->direction & 0x80) == 0) {
ent->x.WORD += FixedDiv(FixedMul(gSineTable[ent->direction * 8], ent->speed), 256) << 8;
ent->y.WORD -= FixedDiv(FixedMul(gSineTable[ent->direction * 8 + 64], ent->speed), 256) << 8;
ent->x.WORD += FixedDiv(FixedMul(gSineTable[ent->direction * 8], ent->speed), (1 << 8)) << 8;
ent->y.WORD -= FixedDiv(FixedMul(gSineTable[ent->direction * 8 + 64], ent->speed), (1 << 8)) << 8;
}
}
@ -290,13 +290,13 @@ s16 FixedDiv(s16 r0, s16 r1) {
return (r0 * 256) / r1;
}
void CopyPosition(Entity* param_1, Entity* param_2) {
PositionRelative(param_1, param_2, 0, 0);
void CopyPosition(Entity* source, Entity* target) {
PositionRelative(source, target, 0, 0);
}
void PositionEntityOnTop(Entity* ent, Entity* ent2) {
PositionRelative(ent, ent2, 0, 0);
ResolveEntityOnTop(ent, ent2);
void PositionEntityOnTop(Entity* source, Entity* target) {
PositionRelative(source, target, 0, 0);
SortEntityAbove(source, target);
}
void PositionRelative(Entity* source, Entity* target, s32 offsetX, s32 offsetY) {
@ -314,24 +314,24 @@ void PositionRelative(Entity* source, Entity* target, s32 offsetX, s32 offsetY)
UpdateSpriteForCollisionLayer(target);
}
void CopyPositionAndSpriteOffset(Entity* param_1, Entity* param_2) {
param_2->spriteOffsetX = param_1->spriteOffsetX;
param_2->spriteOffsetY = param_1->spriteOffsetY;
PositionRelative(param_1, param_2, 0, 0);
void CopyPositionAndSpriteOffset(Entity* source, Entity* target) {
target->spriteOffsetX = source->spriteOffsetX;
target->spriteOffsetY = source->spriteOffsetY;
PositionRelative(source, target, 0, 0);
}
void sub_0806FA90(Entity* param_1, Entity* param_2, s32 offsetX, s32 offsetY) {
param_2->spriteOffsetX = param_1->spriteOffsetX;
param_2->spriteOffsetY = param_1->spriteOffsetY;
PositionRelative(param_1, param_2, offsetX * 64 * 32 * 32, offsetY * 64 * 32 * 32);
void sub_0806FA90(Entity* source, Entity* target, s32 offsetX, s32 offsetY) {
target->spriteOffsetX = source->spriteOffsetX;
target->spriteOffsetY = source->spriteOffsetY;
PositionRelative(source, target, Q_16_16(offsetX), Q_16_16(offsetY));
}
void ResolveEntityOnTop(Entity* param_1, Entity* param_2) {
param_2->spritePriority.b0 = gUnk_08114F78[param_1->spritePriority.b0];
void SortEntityAbove(Entity* relativeTo, Entity* above) {
above->spritePriority.b0 = gUnk_08114F78[relativeTo->spritePriority.b0];
}
void ResolveEntityBelow(Entity* param_1, Entity* param_2) {
param_2->spritePriority.b0 = gUnk_08114F80[param_1->spritePriority.b0];
void SortEntityBelow(Entity* relativeTo, Entity* below) {
below->spritePriority.b0 = gUnk_08114F80[relativeTo->spritePriority.b0];
}
// Values of sin(x*(π/128)) as Q8.8 fixed-point numbers from x = 0 to x = 319

View File

@ -104,7 +104,7 @@ void sub_080318DC(Entity* this) {
void sub_08031A60(Entity* this) {
if (this->iframes > 0)
GravityUpdate(this, 0x1800);
GravityUpdate(this, Q_8_8(24.0));
sub_08001324(this);
}
@ -315,7 +315,7 @@ void sub_08031E90(Entity* this) {
void sub_08031EA8(Entity* this) {
this->action = 1;
this->spritePriority.b1 = 1;
this->zVelocity = 0x40000;
this->zVelocity = Q_16_16(4.0);
this->z.HALF.HI = (4 - this->type2) * 0xe;
this->field_0x78.HALF.HI = Random();
InitializeAnimation(this, 4);
@ -325,7 +325,7 @@ void sub_08031EE8(Entity* this) {
int draw;
this->z.WORD -= this->zVelocity;
this->zVelocity -= 0x1800;
this->zVelocity -= Q_16_16(3.0 / 32.0);
if (this->z.HALF.HI < 1) {
draw = this->spriteSettings.draw;
@ -442,7 +442,7 @@ void sub_08032160(Entity* this) {
this->spriteSettings.flipX = 0;
}
this->speed = 0xf0;
this->zVelocity = 0x12000;
this->zVelocity = Q_16_16(1.125);
this->spritePriority.b1 = 1;
InitializeAnimation(this, 12);
}
@ -477,7 +477,7 @@ void sub_08032204(Entity* this) {
}
void sub_08032248(Entity* this) {
if (GravityUpdate(this, 0x1800) == 0) {
if (GravityUpdate(this, Q_8_8(24.0)) == 0) {
if (this->frame & 0x80) {
((Entity*)this->field_0x7c.WORD)->actionDelay--;

View File

@ -109,7 +109,7 @@ void sub_080218CC(Entity* this) {
this->spriteSettings.draw = 1;
this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f;
this->speed = 0x100;
this->zVelocity = 0x12000;
this->zVelocity = Q_16_16(1.125);
}
GetNextFrame(this);
@ -242,7 +242,7 @@ void sub_08021B64(Entity* this) {
if (iVar4 == 0) {
this->action = 6;
this->zVelocity = 0x10000;
this->zVelocity = Q_16_16(1.0);
((u8*)&this->field_0x86)[1] = 0;
if (gPlayerEntity.direction != 0xff) {
this->direction = 0x10 ^ gPlayerEntity.direction;
@ -303,7 +303,7 @@ u32 sub_08021D00(Entity* this) {
} else {
this->action = 4;
this->actionDelay = 1;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
InitializeAnimation(this, 4);
ret = 1;
}

View File

@ -61,7 +61,7 @@ void sub_0802C688(Entity* this) {
this->action = 3;
this->hitType = 0x6e;
this->field_0xf = 1;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->speed = 0;
this->field_0x80.HALF.HI = 1;
InitializeAnimation(this, this->direction >> 4 | 6);
@ -79,7 +79,7 @@ void sub_0802C7AC(Entity* this) {
if (this->field_0x82.HALF.LO != 2) {
this->speed = this->field_0x82.HALF.LO ? 0x200 : 0x80;
}
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->field_0x82.HALF.HI = 0;
this->field_0x80.HALF.HI = 0;
} else {
@ -232,7 +232,7 @@ void sub_0802CA94(Entity* this) {
COLLISION_OFF(this);
this->field_0xf = 1;
this->spritePriority.b1 = 1;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->speed = 0;
this->field_0x82.HALF.HI = 0;
this->field_0x80.HALF.HI = 0;

View File

@ -381,7 +381,7 @@ void sub_0802ADDC(Entity* this) {
void sub_0802AE24(Entity* this) {
this->action = 1;
this->actionDelay = 0xf0;
this->zVelocity = 0x8000;
this->zVelocity = Q_16_16(0.5);
this->hitbox = (Hitbox*)&gUnk_080CD174;
this->field_0x3c = 3;
this->field_0x16 = 0;

View File

@ -722,7 +722,7 @@ u32 sub_0801FBD0(Entity* this) {
void Chuchu_JumpAtPlayer(Entity* this) {
this->speed = 0x180;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
this->direction = sub_08049F84(this, 1);
InitializeAnimation(this, 3);
}

View File

@ -52,7 +52,7 @@ void sub_08022988(Entity* this) {
return;
this->frameIndex = 1;
this->zVelocity = 0x10000;
this->zVelocity = Q_16_16(1.0);
EnqueueSFX(0xd6);
}
@ -78,7 +78,7 @@ void sub_080229F8(Entity* this) {
this->speed = 0xc0;
sub_08022B44(this);
} else {
this->zVelocity = 0x10000;
this->zVelocity = Q_16_16(1.0);
EnqueueSFX(0xd6);
}
}
@ -141,7 +141,7 @@ u32 sub_08022B20(Entity* this) {
}
void sub_08022B44(Entity* this) {
this->zVelocity = 0xc000;
this->zVelocity = Q_16_16(0.75);
this->direction = GetFacingDirection(this, &gPlayerEntity);
if (this->direction & 0xf)

View File

@ -37,7 +37,7 @@ void sub_0802C254(Entity* this) {
void sub_0802C258(Entity* this) {
sub_0804A720(this);
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
this->actionDelay = 2;
this->field_0x7a.HWORD = Random() & 0x70;
switch (this->type) {
@ -195,7 +195,7 @@ void sub_0802C4B0(Entity* this) {
}
rand = Random() & 7;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
if (rand & 4) {
if (rand & 3) {
*(u32*)&this->cutsceneBeh = gUnk_080CD58C[offset | 1];

View File

@ -102,7 +102,7 @@ u32 sub_0804A024(Entity*, u32, u32);
void sub_08045524(Entity* this) {
u32 tmp, tmp1, tmp2;
this->zVelocity = 0x1c000;
this->zVelocity = Q_16_16(1.75);
tmp = sub_0804A024(this, 1, 8);
if (tmp != 0xff && (Random() & 3) == 0) {
this->actionDelay = Random() & 3;

View File

@ -46,7 +46,7 @@ void sub_08039BF8(FlyingSkullEntity* this) {
if (super->bitfield == 0x9d) {
super->action = 7;
COLLISION_OFF(super);
super->zVelocity = 0x2A000;
super->zVelocity = Q_16_16(2.625);
super->spritePriority.b1 = 1;
SetTile(this->unk_0x74, COORD_TO_TILE(super), super->collisionLayer);
} else if (super->z.HALF.HI) {

View File

@ -1033,7 +1033,7 @@ void sub_08047DF0(GyorgMaleEntity* this, u32 unk1) {
sub_08047EA4(this, unk1);
oldX = super->x.HALF.HI;
oldY = super->y.HALF.HI;
sub_0806F62C(super, super->speed, super->direction);
LinearMoveAngle(super, super->speed, super->direction);
if (this->unk_7c & 1) {
if (sub_08079F8C()) {
gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX;
@ -1051,7 +1051,7 @@ void sub_08047E58(GyorgMaleEntity* this) {
u32 oldX, oldY;
oldX = super->x.HALF.HI;
oldY = super->y.HALF.HI;
sub_0806F62C(super, super->speed, super->direction);
LinearMoveAngle(super, super->speed, super->direction);
if (this->unk_7c & 1) {
if (sub_08079F8C()) {
gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX;

View File

@ -95,7 +95,7 @@ void sub_0802BCA8(Entity* this) {
this->action = 7;
this->actionDelay = 0x5a;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->hitType = 0x19;
this->field_0x3a = this->field_0x3a & 0xfb;
this->field_0x1c = 0x12;
@ -222,7 +222,7 @@ void sub_0802BEBC(Entity* this) {
this->direction ^= 0x10;
sub_080AEFE0(this);
this->direction ^= 0x10;
if (!sub_080044EC(this, 0x2000)) {
if (!sub_080044EC(this, Q_16_16(0.125))) {
sub_0802C1C0(this);
}
}
@ -234,7 +234,7 @@ void sub_0802BEEC(Entity* this) {
this->direction = this->animationState << 3;
InitializeAnimation(this, this->animationState + 4);
}
} else if (!GravityUpdate(this, 0x1c00)) {
} else if (!GravityUpdate(this, Q_16_16(0.109375))) {
this->action = 8;
this->actionDelay = 30;
this->speed = 0x120;
@ -356,7 +356,7 @@ void sub_0802C18C(Entity* this) {
if ((this->field_0x78.HALF.LO & 7) == 0) {
Entity* ent = CreateObject(SPECIAL_FX, 0x11, 0x40);
if (ent) {
PositionRelative(this, ent, 0, 0x10000);
PositionRelative(this, ent, 0, Q_16_16(1.0));
}
}
}
@ -374,8 +374,8 @@ void sub_0802C1CC(Entity* this) {
void sub_0802C218(Entity* this) {
this->action = 6;
this->speed = 0xe0;
this->zVelocity = 0x18000;
this->speed = Q_8_8(0.875);
this->zVelocity = Q_16_16(1.5);
}
// clang-format off

View File

@ -229,7 +229,7 @@ void sub_08032794(Entity* this) {
target = CreateFx(this, FX_DASH, 0x40);
if (target != NULL) {
temp = &gUnk_080CE810[this->animationState * 2];
PositionRelative(this, target, temp[0] << 0x10, temp[1] << 0x10);
PositionRelative(this, target, Q_16_16(temp[0]), Q_16_16(temp[1]));
}
}

View File

@ -59,7 +59,7 @@ void Lakitu_DoAction(Entity* this) {
void sub_0803C784(Entity* this) {
if ((this->bitfield & 0x7f) == 0x1d) {
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
sub_0803CBAC(this);
} else {
@ -316,7 +316,7 @@ void Lakitu_SpawnLightning(Entity* this) {
lightning->direction = this->field_0x78.HALF.LO;
PositionRelative(this, lightning, offset->x << 16, offset->y << 16);
PositionRelative(this, lightning, Q_16_16(offset->x), Q_16_16(offset->y));
EnqueueSFX(0x193);
}
@ -346,6 +346,8 @@ void sub_0803CC08(Entity* this) {
Entity* cloud;
Entity* fx;
const s32 diff = Q_8_8(3.0 / 128.0);
cloud = this->child;
if (cloud == NULL) {
return;
@ -365,26 +367,26 @@ void sub_0803CC08(Entity* this) {
fx = CreateFx(this, FX_DEATH, 0);
if (fx != NULL) {
fx->x.HALF.HI += 6;
fx->y.HALF.HI += 6;
fx->x.HALF.HI += diff;
fx->y.HALF.HI += diff;
}
fx = CreateFx(this, FX_DEATH, 0);
if (fx != NULL) {
fx->x.HALF.HI -= 6;
fx->y.HALF.HI += 6;
fx->x.HALF.HI -= diff;
fx->y.HALF.HI += diff;
}
fx = CreateFx(this, FX_DEATH, 0);
if (fx != NULL) {
fx->x.HALF.HI += 6;
fx->y.HALF.HI -= 6;
fx->x.HALF.HI += diff;
fx->y.HALF.HI -= diff;
}
fx = CreateFx(this, FX_DEATH, 0);
if (fx != NULL) {
fx->x.HALF.HI -= 6;
fx->y.HALF.HI -= 6;
fx->x.HALF.HI -= diff;
fx->y.HALF.HI -= diff;
}
this->child = NULL;

View File

@ -193,7 +193,7 @@ void sub_0802805C(Entity* this) {
} else {
ResetPlayer();
gPlayerState.mobility |= 0x80;
PositionRelative(this, &gPlayerEntity, 0, 0x10000);
PositionRelative(this, &gPlayerEntity, 0, Q_16_16(1.0));
tmp = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
gPlayerEntity.spriteOffsetX = tmp[0];
@ -215,7 +215,7 @@ NONMATCH("asm/non_matching/likeLike/sub_0802810C.inc", void sub_0802810C(Entity*
gPlayerState.field_0xa = 0;
gPlayerState.flags &= 0xffffffef;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.iframes = -60;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
gPlayerEntity.spritePriority.b1 = this->field_0x82.HALF.HI;

View File

@ -189,7 +189,7 @@ void sub_0803A274(Entity* this) {
pEVar1 = CreateObject(OBJECT_7E, 1, 0);
pEVar1->parent = this;
pEVar1->child = this->child;
PositionRelative(this->parent, this, 0x100000, 0x200000);
PositionRelative(this->parent, this, Q_16_16(16.0), Q_16_16(32.0));
} else {
pEVar1 = CreateEnemy(MAZAAL_HAND, 1);
pEVar1->parent = this;
@ -201,7 +201,7 @@ void sub_0803A274(Entity* this) {
pEVar1->parent = this;
pEVar1->child = this->child;
this->spriteSettings.flipX = 1;
PositionRelative(this->parent, this, -0x100000, 0x200000);
PositionRelative(this->parent, this, Q_16_16(-16.0), Q_16_16(32.0));
}
if (gRoomTransition.field_0x38 != 0) {
this->action = 3;
@ -917,7 +917,7 @@ void sub_0803B100(Entity* this) {
Entity* temp;
this->action = 0x29;
this->zVelocity = 0x14000;
this->zVelocity = Q_16_16(1.25);
if (this->type == 0) {
this->hitbox = &gUnk_080FD364;
} else {
@ -974,7 +974,7 @@ void sub_0803B1B8(Entity* this) {
if (temp != (Entity*)0x0) {
temp->actionDelay = 0;
temp->direction = 0x90;
PositionRelative(this, temp, this->hitbox->offset_x << 0x10, this->hitbox->offset_y << 0x10);
PositionRelative(this, temp, Q_16_16(this->hitbox->offset_x), Q_16_16(this->hitbox->offset_y));
}
temp = *(Entity**)&this->field_0x74;
temp->field_0x74.HALF.LO = 0x40;
@ -1086,7 +1086,7 @@ void sub_0803B480(Entity* this) {
Entity* target;
if (((this->field_0x7c.HALF.HI & 0x1f) == 0) && (target = CreateObject(SMOKE, 1, 0), target != (Entity*)0x0)) {
PositionRelative(this, target, gUnk_080CFD08[this->type] << 0x10, 0);
PositionRelative(this, target, Q_16_16(gUnk_080CFD08[this->type]), 0);
}
if (--this->field_0x7c.HALF.HI == 0) {
sub_0803B6A4(this);
@ -1115,8 +1115,8 @@ u32 sub_0803B4E4(Entity* this) {
}
void sub_0803B538(Entity* this) {
PositionRelative(this, this->child, 0, -0x10000);
PositionRelative(this, *(Entity**)&this->field_0x74, 0, -0x20000);
PositionRelative(this, this->child, 0, Q_16_16(-1.0));
PositionRelative(this, *(Entity**)&this->field_0x74, 0, Q_16_16(-2.0));
}
void sub_0803B55C(Entity* this) {
@ -1230,7 +1230,7 @@ void sub_0803B798(void) {
gPlayerState.field_0xa = 0;
gPlayerState.flags &= ~(0xffff0000 | PL_CAPTURED);
gPlayerEntity.flags |= 0x80;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.z.HALF.HI = -10;
gPlayerEntity.direction = 0x10;
gPlayerEntity.animationState = 4;

View File

@ -741,7 +741,7 @@ void sub_08034A84(Entity* this) {
}
void sub_08034AC4(Entity* this) {
PositionRelative(this->parent, this, 0, 0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(1.0));
gUnk_080CED74[this->action](this);
}
@ -782,7 +782,7 @@ void sub_08034B38(Entity* this) {
target->direction = this->actionDelay + 0x58;
}
ptr = &gUnk_080CED84[target->type * 2];
PositionRelative(this, target, *(ptr++) << 0x10, *ptr << 0x10);
PositionRelative(this, target, Q_16_16(*(ptr++)), Q_16_16(*ptr));
}
}
}

View File

@ -57,7 +57,7 @@ void sub_08045654(Entity* this) {
void sub_08045678(Entity* this) {
this->zVelocity = 0x1c000;
this->zVelocity = Q_16_16(1.75);
if (this->actionDelay != 0) {
this->actionDelay--;
} else {

View File

@ -87,7 +87,7 @@ void sub_080230E4(Entity* this) {
CopyPosition(this, &gPlayerEntity);
gPlayerEntity.flags = gPlayerEntity.flags | 0x80;
gPlayerEntity.spriteSettings.draw = 1;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.direction = 0xff;
gPlayerEntity.iframes = -0x14;
gPlayerState.jump_status = 0x41;
@ -270,7 +270,7 @@ void sub_0802351C(Entity* this) {
if (this->type2 == 0) {
gPlayerEntity.animationState = this->animationState & 7;
gPlayerState.flags |= PL_MOLDWORM_CAPTURED;
PositionRelative(this, &gPlayerEntity, 0, gUnk_080CBC90[this->animationState & 7] << 0x10);
PositionRelative(this, &gPlayerEntity, 0, Q_16_16(gUnk_080CBC90[this->animationState & 7]));
gPlayerEntity.spriteOffsetY = -gUnk_080CBC90[this->animationState & 7];
}
} else {

View File

@ -617,7 +617,7 @@ void OctorokBoss_Action1(Entity* this) {
this->field_0x74.HWORD += 4;
}
}
ResolveEntityBelow(this->parent, this);
SortEntityBelow(this->parent, this);
if (((GET_HELPER(this)->field_0x2 != 0) || (this->parent->action == INTRO)) ||
(1 < (u8)(this->parent->subAction - 3))) {
if ((s8)this->field_0xf < 0) {
@ -649,9 +649,9 @@ void OctorokBoss_Action1(Entity* this) {
if ((GET_HELPER(this)->tailCount - 2) < this->type2) {
DeleteThisEntity();
}
ResolveEntityOnTop(this->parent, this);
SortEntityAbove(this->parent, this);
if (GET_HELPER(this)->tailCount - 2 == this->type2) {
ResolveEntityOnTop(this->parent, this);
SortEntityAbove(this->parent, this);
radius = 0x10000 / this->parent->field_0x74.HWORD;
radius = radius << 0xd >> 0x8;
angle = -this->parent->field_0x7a.HALF.HI;
@ -693,7 +693,7 @@ void OctorokBoss_Action1(Entity* this) {
if (this->health == 1) {
this->health = 0;
} else {
ResolveEntityBelow(this->parent, this);
SortEntityBelow(this->parent, this);
if ((this->parent->subAction != 4) && (this->health != 1)) {
if (GET_TIMER(this) > 0x1c) {
GET_TIMER(this)--;
@ -939,7 +939,7 @@ void OctorokBoss_ExecuteAttackVacuum(Entity* this) {
if (sub_0806FC80(this, &gPlayerEntity, 0xf0) != 0) {
if ((gPlayerState.flags & PL_FROZEN) == 0) {
if ((gPlayerEntity.flags & PL_MINISH) != 0) {
sub_0806F62C(&gPlayerEntity, 0x280, -GET_ANGLE_HI(this));
LinearMoveAngle(&gPlayerEntity, 0x280, -GET_ANGLE_HI(this));
if (sub_0806FC80(this, &gPlayerEntity, 0x48) != 0) {
this->field_0x80.HALF.LO = 1;
GET_TIMER(this) = 2;

View File

@ -265,7 +265,7 @@ void Peahat_RepairPropeller(Entity* this) {
return;
this->action = 9;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->direction = Random() & 0x1f;
sub_0804AA1C(this);
this->animationState = PeahatAnimation_RepairPropeller;
@ -291,7 +291,7 @@ void Peahat_Hop(Entity* this) {
if (--this->actionDelay == 0) {
if (this->frame & 0x80) {
this->action = 9;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->animationState = PeahatAnimation_NewPropeller;
InitializeAnimation(this, this->animationState);
} else {

View File

@ -811,7 +811,7 @@ void sub_08024E4C(Entity* this) {
gPlayerState.field_0x38 = 0x14;
gPlayerState.field_0x39 = 1;
*(u8*)&gPlayerState.field_0x3a = 0;
PositionRelative(this, player, 0, 0x10000);
PositionRelative(this, player, 0, Q_16_16(1.0));
player->spriteOffsetY = 0x1a;
player->animationState = 4;
player->spritePriority.b1 = 0;

View File

@ -198,7 +198,7 @@ void sub_080252E0(Entity* this) {
this->action = 3;
this->actionDelay = 0x1e;
this->field_0xf = 0;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
InitializeAnimation(this, 1);
}
}
@ -210,8 +210,8 @@ void sub_0802538C(Entity* this) {
if (this->frame == 0) {
GetNextFrame(this);
} else {
GravityUpdate(this, 0x2000);
if (this->zVelocity < 0x2000) {
GravityUpdate(this, Q_16_16(0.125));
if (this->zVelocity < Q_16_16(0.125)) {
this->action = 4;
InitializeAnimation(this, 2);
}
@ -240,7 +240,7 @@ void sub_0802541C(Entity* this) {
if (this->frame & 0x80) {
this->action = 3;
this->field_0xf = 1;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2);
InitializeAnimation(this, 1);
}
}
@ -257,7 +257,7 @@ void sub_0802544C(Entity* this) {
}
void sub_0802547C(Entity* this) {
GravityUpdate(this, 0x2000);
GravityUpdate(this, Q_16_16(0.125));
GetNextFrame(this);
if ((this->actionDelay & 7) == 0) {
sub_08025BD4(this);
@ -269,7 +269,7 @@ void sub_0802547C(Entity* this) {
}
void sub_080254B4(Entity* this) {
GravityUpdate(this, 0x2000);
GravityUpdate(this, Q_16_16(0.125));
if (this->frame & 0x80) {
if (this->z.HALF.HI == 0) {
if (this->cutsceneBeh.HWORD == 0) {
@ -553,7 +553,7 @@ void sub_08025B18(Entity* this) {
ent = CreateObject(OBJECT_21, 2, 0);
if (ent) {
PositionRelative(this, ent, offset[0] * 0x10000, offset[1] * 0x10000);
PositionRelative(this, ent, Q_16_16(offset[0]), Q_16_16(offset[1]));
ent->x.HALF.HI &= -0x10;
ent->x.HALF.HI += 8;
ent->y.HALF.HI &= -0x10;
@ -567,8 +567,8 @@ void sub_08025BD4(Entity* this) {
if (this->field_0x82.HALF.LO && (this->frame & 1) == 0) {
Entity* ent = CreateObject(OBJECT_21, 0, 0);
if (ent) {
PositionRelative(this, ent, gUnk_080CC0BA[this->animationState * 2 + 0] * 0x10000,
gUnk_080CC0BA[this->animationState * 2 + 1] * 0x10000);
PositionRelative(this, ent, Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 0]),
Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 1]));
ent->z.HALF.HI = -10;
}
}

View File

@ -37,7 +37,7 @@ void Rollobite_OnTick(Entity* this) {
void sub_08020668(Entity* this) {
if (this->hitType == 34 && this->health != 0xff) {
this->action = 4;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
this->direction = 0xff;
this->health = 0xff;
this->hitType = 35;
@ -107,7 +107,7 @@ void sub_080207A8(Entity* this) {
this->spritePriority.b0 = 4;
this->field_0x3a &= 0xfb;
this->direction ^= 0x10;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->speed = 0x80;
InitializeAnimation(this, this->animationState + 0x10);
}
@ -267,7 +267,7 @@ bool32 Rollobite_TryToHoleUp(Entity* this) {
this->x.HALF.HI += 8;
this->y.HALF.HI &= 0xfff0;
this->y.HALF.HI += 13;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
InitializeAnimation(this, this->animationState + 0x14);
SetTile(0x4034, tile, this->collisionLayer);
return TRUE;

View File

@ -171,7 +171,7 @@ void sub_0802953C(Entity* this) {
} else {
ResetPlayer();
gPlayerState.mobility |= 0x80;
PositionRelative(this, &gPlayerEntity, 0, 0x10000);
PositionRelative(this, &gPlayerEntity, 0, Q_16_16(1.0));
pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex);
gPlayerEntity.spriteOffsetX = pbVar3[0];
gPlayerEntity.spriteOffsetY = pbVar3[1] - 1;
@ -240,7 +240,7 @@ void sub_080296D8(Entity* this) {
gPlayerState.jump_status = 0x41;
gPlayerState.flags &= ~PL_CAPTURED;
gPlayerEntity.flags |= 0x80;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.iframes = 0xa6;
gPlayerEntity.z.HALF.HI = -2;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;

View File

@ -124,7 +124,7 @@ void sub_08023CE0(Entity* this) {
EnqueueSFX(0x12d);
InitializeAnimation(this, 4);
}
} else if (!GravityUpdate(this, 0x1800)) {
} else if (!GravityUpdate(this, Q_8_8(24))) {
this->action = 3;
this->spriteSettings.draw = 1;
EnqueueSFX(0x84);
@ -169,7 +169,7 @@ void sub_08023E54(Entity* this) {
ent = CreateEnemy(SLUGGULA, 2);
if (ent) {
const s8* ptr = &gUnk_080CBDF7[this->animationState * 2];
PositionRelative(this, ent, ptr[0] << 0x10, ptr[1] << 0x10);
PositionRelative(this, ent, Q_16_16(ptr[0]), Q_16_16(ptr[1]));
}
}
}

View File

@ -54,7 +54,7 @@ void sub_0802B628(Entity* this) {
case 0x1d:
if (this->action < 6) {
this->action = 6;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
this->speed = 0xc0;
this->direction = this->knockbackDirection;
this->knockbackDuration = 0;
@ -171,7 +171,7 @@ void sub_0802B8E0(Entity* this) {
}
} else {
this->action = 8;
this->zVelocity = 0x10000;
this->zVelocity = Q_16_16(1.0);
this->speed = 0x60;
this->hitType = 99;
InitializeAnimation(this, this->animationState);

View File

@ -93,7 +93,7 @@ void sub_080225A0(Entity* this) {
}
void sub_080225BC(Entity* this) {
GravityUpdate(this, 0x1800);
GravityUpdate(this, Q_8_8(24.0));
if (this->frame & 1) {
sub_0804A7D4(this);
} else {
@ -132,7 +132,7 @@ void sub_08022654(Entity* this) {
InitializeAnimation(this, 0);
/* fallthrough */
case 1:
if (GravityUpdate(this, 0x1800))
if (GravityUpdate(this, Q_8_8(24.0)))
return;
this->subAction = 2;
@ -163,7 +163,7 @@ void sub_080226EC(Entity* this) {
if (sub_080228F0(this)) {
this->action = 6;
this->zVelocity = 0x12000;
this->zVelocity = Q_16_16(1.125);
this->speed = 0x140;
this->direction = GetFacingDirection(this, gUnk_020000B0);
this->hitType = 0x5a;
@ -211,7 +211,7 @@ void sub_080227AC(Entity* this) {
}
void sub_0802281C(Entity* this) {
GravityUpdate(this, 0x1800);
GravityUpdate(this, Q_8_8(24.0));
GetNextFrame(this);
if (this->frame & 0x80) {
this->action = 2;
@ -225,7 +225,7 @@ void sub_08022854(Entity* this) {
GetNextFrame(this);
if (this->frame & 1) {
sub_080AEFE0(this);
if (GravityUpdate(this, 0x1800) == 0) {
if (GravityUpdate(this, Q_8_8(24.0)) == 0) {
this->action = 7;
this->hitType = 0x5c;
InitializeAnimation(this, 5);

View File

@ -89,7 +89,7 @@ void sub_08037Fe0(Entity* this) {
this->action = 2;
this->actionDelay = 6;
this->field_0xf = 0;
this->zVelocity = 0x38000;
this->zVelocity = Q_16_16(3.5);
sub_08038168(this);
InitializeAnimation(this, 2);
}
@ -145,7 +145,7 @@ void sub_08038110(Entity* this) {
if (this->field_0x80.HALF.LO < 5) {
this->action = 2;
this->actionDelay = 8;
this->zVelocity = 0x38000;
this->zVelocity = Q_16_16(3.5);
sub_08038168(this);
InitializeAnimation(this, 2);
} else {

View File

@ -951,7 +951,7 @@ void sub_08043490(Entity* this) {
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4];
if (entity->z.HALF.HI < -4) {
entity->zVelocity = 0x18000;
entity->zVelocity = Q_16_16(1.5);
this->subAction = 2;
this->field_0x7c.BYTES.byte2 = 0;
((VaatiArm_HeapStruct*)this->myHeap)->parent->subAction = 2;
@ -976,7 +976,7 @@ void sub_08043520(Entity* this) {
Entity* entity;
entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4];
GravityUpdate(entity, 0x1a00);
GravityUpdate(entity, Q_8_8(26.0));
if ((entity->zVelocity < 0) && (-6 < entity->z.HALF.HI)) {
entity->z.HALF.HI = -6;
this->subAction = 3;

View File

@ -71,7 +71,7 @@ void sub_0804468C(Entity* this) {
this->field_0x82.HALF.HI = 0;
this->spriteSettings.draw = 0;
off = &gUnk_080D1620[this->field_0x78.HALF.HI & 3];
PositionRelative(this->parent, this, off->h << 0x10, (off->v - 0x10) * 0x10000);
PositionRelative(this->parent, this, Q_16_16(off->h), Q_16_16(off->v - 0x10));
this->z.HALF.HI = this->parent->z.HALF.HI;
InitAnimationForceUpdate(this, 0);
break;
@ -397,7 +397,7 @@ void sub_08044B04(Entity* this) {
this->field_0x74.HALF.LO = 1;
this->actionDelay = 80;
COLLISION_OFF(this);
PositionRelative(vaati, this, 0, -0x100000);
PositionRelative(vaati, this, 0, Q_16_16(-16.0));
if (this->field_0xf)
this->spriteSettings.draw = 0;
break;
@ -463,7 +463,7 @@ void sub_08044DEC(Entity* this) {
this->speed = 0x300;
off = this->parent->field_0x80.HALF.LO - 1;
this->direction = gUnk_080D1628[off][this->field_0x78.HALF.HI];
PositionRelative(this->parent, this, 0, -0x100000);
PositionRelative(this->parent, this, 0, Q_16_16(-16.0));
}
void sub_08044E74(Entity* this, u32 state) {
@ -475,7 +475,7 @@ void sub_08044E74(Entity* this, u32 state) {
this->action = 2;
this->direction += 0x18;
this->direction &= 0x1f;
PositionRelative(this->parent, this, 0, -0x100000);
PositionRelative(this->parent, this, 0, Q_16_16(-16.0));
this->speed = 12288;
LinearMoveUpdate(this);
this->direction += 0x8;
@ -509,5 +509,5 @@ void sub_08044E74(Entity* this, u32 state) {
}
this->actionDelay = 1;
this->field_0x78.HALF.LO = 0;
this->speed = 1280;
this->speed = Q_8_8(5);
}

View File

@ -121,7 +121,7 @@ void VaatiProjectileFunction0Action0(Entity* this) {
this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY;
this->spriteRendering.b3 = this->parent->spriteRendering.b3;
this->spritePriority.b1 = 0;
PositionRelative(this->parent, this, 0, -0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(-1.0));
InitializeAnimation(this, 1);
}
}
@ -207,7 +207,7 @@ void VaatiProjectileFunction0Action8(Entity* this) {
if (this->parent->next == NULL) {
DeleteThisEntity();
}
PositionRelative(this->parent, this, 0, -0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(-1.0));
GetNextFrame(this);
}

View File

@ -135,7 +135,7 @@ void VaatiRebornEnemyType0Action0(Entity* this) {
entity->parent = this;
entity->spriteSettings.flipX = i;
ptr = &gUnk_080D04A8[i];
PositionRelative(this, entity, ptr->x << 0x10, ptr->y << 0x10);
PositionRelative(this, entity, Q_16_16(ptr->x), Q_16_16(ptr->y));
}
InitAnimationForceUpdate(this, 0);
}
@ -292,7 +292,7 @@ void VaatiRebornEnemyType0Action3(Entity* this) {
break;
case 0xff:
if (this->z.HALF.HI != -4) {
this->z.WORD -= 0x2000;
this->z.WORD -= Q_16_16(0.125);
}
if (this->actionDelay == 2) {
this->field_0x74.HALF.LO = 0xfe;
@ -442,7 +442,7 @@ void VaatiRebornEnemyType0Action6(Entity* this) {
SoundReq(SFX_150);
target = CreateProjectileWithParent(this, 0x18, 0);
if (target != NULL) {
PositionRelative(this, target, 0, -0x100000);
PositionRelative(this, target, 0, Q_16_16(-16.0));
target->parent = this;
}
} else if (this->actionDelay == 0x40) {
@ -500,7 +500,7 @@ void VaatiRebornEnemyType1Action0(Entity* this) {
this->field_0x74.HALF.HI = 1;
this->actionDelay = 0;
this->spriteOffsetY = -1;
PositionRelative(this->parent, this, 0, 0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(1.0));
enemy = CreateEnemy(VAATI_REBORN_ENEMY, 2);
enemy->parent = this;
enemy->child = this->parent;
@ -546,7 +546,7 @@ void VaatiRebornEnemyType1Action1(Entity* this) {
}
this->spriteSettings.draw = parent->spriteSettings.draw;
this->spriteOffsetX = parent->spriteOffsetX;
PositionRelative(this->parent, this, 0, 0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(1.0));
UpdateAnimationSingleFrame(this);
}
@ -559,7 +559,7 @@ void VaatiRebornEnemyType2Action0(Entity* this) {
this->field_0x74.HALF.HI = 0;
this->spriteOffsetY = -2;
this->direction = 0xff;
PositionRelative(source, this, 0, 0x20000);
PositionRelative(source, this, 0, Q_16_16(2.0));
InitAnimationForceUpdate(this, 2);
}
@ -595,7 +595,7 @@ void VaatiRebornEnemyType2Action1(Entity* this) {
}
this->spriteSettings.draw = parent->spriteSettings.draw;
this->spriteOffsetX = parent->spriteOffsetX;
PositionRelative(parent->parent, this, 0, 0x20000);
PositionRelative(parent->parent, this, 0, Q_16_16(2.0));
UpdateAnimationSingleFrame(this);
}
@ -637,7 +637,7 @@ void sub_0803DC0C(Entity* this) {
tmp = &gUnk_080D04C8[this->actionDelay];
this->spriteSettings.draw = parent->spriteSettings.draw;
this->spriteOffsetX = parent->spriteOffsetX;
PositionRelative(parent, this, tmp->x << 0x10, (tmp->y + 1) * 0x10000);
PositionRelative(parent, this, Q_16_16(tmp->x), Q_16_16(tmp->y + 1));
UpdateAnimationSingleFrame(this);
}

View File

@ -314,7 +314,7 @@ void VaatiTransfiguredType0Action3(Entity* this) {
if (this->actionDelay != 0) {
if (--this->actionDelay == 0) {
COLLISION_OFF(this);
this->zVelocity = 0x38000;
this->zVelocity = Q_16_16(3.5);
this->field_0xf = 0x10;
}
break;
@ -380,12 +380,12 @@ void VaatiTransfiguredType0Action4(Entity* this) {
this->field_0x74.HALF.LO = 0;
this->actionDelay = 0x80;
this->field_0xf = 0;
this->zVelocity = 0x24000;
this->zVelocity = Q_16_16(2.25);
SoundReq(SFX_12B);
}
break;
case 1:
if (GravityUpdate(this, 0x2800) != 0)
if (GravityUpdate(this, Q_8_8(40)) != 0)
break;
this->field_0x80.HALF.LO += 1;
switch (this->cutsceneBeh.HALF.LO) {
@ -1062,7 +1062,7 @@ void sub_080409B0(Entity* this) {
this->field_0x80.HALF.HI = 3;
COLLISION_OFF(this);
this->hitType = 0x36;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
SoundReq(SFX_164);
}
}

View File

@ -215,7 +215,7 @@ void VaatiTransfiguredEyeFunction0Action4(Entity* this) {
void sub_08045A00(Entity* this) {
const struct xy* t = &gUnk_080D18B4[this->type2];
PositionRelative(this->parent, this, t->x << 0x10, (t->y + 3) * 0x10000);
PositionRelative(this->parent, this, Q_16_16(t->x), Q_16_16(t->y + 3));
}
void sub_08045A28(Entity* this) {
@ -291,7 +291,7 @@ void sub_08045A28(Entity* this) {
break;
}
} else {
PositionRelative(this->parent, this, 0, -0x10000);
PositionRelative(this->parent, this, 0, Q_16_16(-1.0));
switch (this->field_0x82.HALF.HI) {
case 0:
switch (this->frame & 0x70) {

View File

@ -453,7 +453,7 @@ void VaatiWrathType0ActionA(Entity* this) {
this->subAction = 0;
this->direction = 0;
this->speed = 0x100;
this->zVelocity = 0x12000;
this->zVelocity = Q_16_16(1.125);
ChangeObjPalette(this, 0x16b);
InitAnimationForceUpdate(this, 5);
type1 = ((VaatiWrathHeapStruct*)this->myHeap)->type1;

View File

@ -148,7 +148,7 @@ void VaatiWrathEyeAction6(Entity* this) {
if (pEVar3 != NULL) {
pEVar3->parent = this;
this->child = pEVar3;
PositionRelative(this, pEVar3, 0, 0xc0000);
PositionRelative(this, pEVar3, 0, Q_16_16(12.0));
}
}
}

View File

@ -26,7 +26,7 @@ void sub_0802A250(Entity* this) {
this->action = 1;
this->actionDelay = 0;
this->zVelocity = -0x30000;
this->zVelocity = Q_16_16(-3.0);
this->speed = gUnk_080CD03C[Random() & 3];
this->direction = gUnk_080CD040[Random() & 3] + 0x18;
this->collisionLayer = 2;

View File

@ -68,7 +68,7 @@ void sub_08076758(ItemBehavior* this, u32 arg1) {
if ((gPlayerEntity.zVelocity < 1) && ((gPlayerState.jump_status & 0x10) == 0)) {
this->stateID = 2;
gPlayerEntity.field_0x7a.HWORD = 2;
gPlayerEntity.zVelocity = 0x20000;
gPlayerEntity.zVelocity = Q_16_16(2.0);
gPlayerState.jump_status |= 0x10;
gPlayerState.animation = 0x288;
SoundReq(SFX_172);

View File

@ -275,7 +275,7 @@ void sub_0806D4C0(Entity* this, u32 param) {
if (npc != NULL) {
npc->parent = this;
CopyPosition(this, npc);
ResolveEntityOnTop(this, npc);
SortEntityAbove(this, npc);
SetDefaultPriority(npc, PRIO_MESSAGE);
}
}

View File

@ -167,7 +167,7 @@ static void sub_08068BEC(Entity* this, u32 unused) {
target = CreateFx(this, FX_WHITE_SPLASH, 0);
if (target) {
target->spritePriority.b0 = 1;
PositionRelative(this, target, 0, -0x100000);
PositionRelative(this, target, 0, Q_16_16(-16.0));
SoundReq(SFX_FA);
}
}

View File

@ -134,7 +134,7 @@ void sub_080675D4(Entity* this) {
ent->collisionLayer = this->collisionLayer;
ent->spriteOrientation.flipY = this->spriteOrientation.flipY;
ent->spriteRendering.b3 = this->spriteRendering.b3;
ResolveEntityOnTop(this, ent);
SortEntityAbove(this, ent);
}
};
gUnk = gUnk_08110E8A;
@ -147,7 +147,7 @@ void sub_080675D4(Entity* this) {
ent->collisionLayer = this->collisionLayer;
ent->spriteOrientation.flipY = this->spriteOrientation.flipY;
ent->spriteRendering.b3 = this->spriteRendering.b3;
ResolveEntityOnTop(this, ent);
SortEntityAbove(this, ent);
}
};
if (this->subAction > 2) {

View File

@ -75,7 +75,7 @@ void CuccoChick_Fusion(Entity* this) {
this->frameIndex = 1;
} else {
if (GravityUpdate(this, 0x3000) == 0) {
this->zVelocity = 0x10000;
this->zVelocity = Q_16_16(1.0);
}
}
}

View File

@ -22,7 +22,7 @@ void DrLeft(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->frameIndex = 0;
ResolveEntityBelow(this, this);
SortEntityBelow(this, this);
}
}
}

View File

@ -54,7 +54,7 @@ void sub_0806D96C(Entity* this) {
Entity* fx = CreateFx(this, FX_STEAM_EFC, 0);
if (fx != NULL) {
fx->spritePriority.b0 = 1;
PositionRelative(this, fx, 0, 0xFFE80000);
PositionRelative(this, fx, 0, Q_16_16(-24.0));
}
}

View File

@ -70,11 +70,11 @@ void sub_080693D0(Entity* this) {
if (this->frame == 1) {
this->frame = 0;
sub_08069428(this, 0xFFF80000, createFx65);
sub_08069428(this, Q_16_16(-8.0), createFx65);
}
if (this->frame == 2) {
this->frame = 0;
sub_08069428(this, 0x80 << 12, createFx65);
sub_08069428(this, Q_16_16(8.0), createFx65);
}
}
}
@ -82,14 +82,14 @@ void sub_080693D0(Entity* this) {
void sub_08069428(Entity* this, s32 offsetX, bool32 createFx65) {
Entity* fx = CreateFx(this, FX_ROCK, 0);
if (fx) {
PositionRelative(this, fx, offsetX, 0xFFF00000);
ResolveEntityOnTop(this, fx);
PositionRelative(this, fx, offsetX, Q_16_16(-16.0));
SortEntityAbove(this, fx);
}
if (createFx65 != 0) {
fx = CreateFx(this, FX_REFLECT4, 0);
if (fx) {
PositionRelative(this, fx, offsetX, 0xFFF00000);
ResolveEntityOnTop(this, fx);
PositionRelative(this, fx, offsetX, Q_16_16(-16.0));
SortEntityAbove(this, fx);
}
}
}

View File

@ -22,13 +22,13 @@ void sub_0806CAF4(Entity* this) {
if (npc != NULL) {
npc->parent = this;
CopyPosition(this, npc);
ResolveEntityBelow(this, npc);
SortEntityBelow(this, npc);
}
npc = CreateNPC(0x4a, 2, 0);
if (npc != NULL) {
npc->parent = this;
CopyPosition(this, npc);
ResolveEntityOnTop(this, npc);
SortEntityAbove(this, npc);
}
sub_0807DD64(this);
sub_08078778(this);

View File

@ -243,7 +243,7 @@ void sub_080626E0(Entity* this, ScriptExecutionContext* context) {
uVar4 = Random();
this->direction = (this->direction + uVar4 % 0xb) - 5;
}
sub_0806F62C(this, (s32)this->speed, (u32)this->direction);
LinearMoveAngle(this, (s32)this->speed, (u32)this->direction);
if ((u32)((this->x.HALF.HI - context->x.HALF.HI) * 0x100 + ((s32)((u32)(u16)this->speed << 0x10) >> 0x11)) <=
(u32)(s32)this->speed) {
this->x.HALF.HI = context->x.HALF.HI;

View File

@ -58,12 +58,12 @@ void sub_08065914(Entity* this) {
target = FindEntityByID(7, 0x1F, 7);
if (target != NULL) {
PositionRelative(this, target, 0x180000, -0x10000);
PositionRelative(this, target, Q_16_16(24.0), Q_16_16(-1.0));
target->parent = this;
}
target = FindEntityByID(7, 0x20, 7);
if (target != NULL) {
PositionRelative(this, target, 0x280000, 0);
PositionRelative(this, target, Q_16_16(40.0), 0);
target->parent = this;
}
}

View File

@ -86,7 +86,7 @@ void sub_08068780(Entity* this) {
}
ent = CreateFx(this, FX_STARS2, 0x20);
if (ent != NULL) {
PositionRelative(this, ent, 0x180000, -0xa0000);
PositionRelative(this, ent, Q_16_16(24.0), Q_16_16(-10.0));
}
}
}

View File

@ -140,12 +140,12 @@ void sub_0806DB84(Entity* this, ScriptExecutionContext* context) {
this->hitbox = (Hitbox*)&gUnk_08114154;
ent = CreateObject(OBJECT_3E, 4, 0);
if (ent != NULL) {
PositionRelative(this, ent, -0x80000, 0);
PositionRelative(this, ent, Q_16_16(-8.0), 0);
*(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_Object3ELeftStoneOpening);
}
ent = CreateObject(OBJECT_3E, 5, 0);
if (ent != NULL) {
PositionRelative(this, ent, 0x80000, 0);
PositionRelative(this, ent, Q_16_16(8.0), 0);
*(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_Object3ERightStoneOpening);
}
}

View File

@ -12,7 +12,7 @@ void Pita(Entity* this) {
if (this->action == 0) {
this->action += 1;
SetDefaultPriority(this, PRIO_MESSAGE);
ResolveEntityOnTop(this, this);
SortEntityAbove(this, this);
this->hitbox = &gUnk_0810C428;
sub_0807DD64(this);
}

View File

@ -143,7 +143,7 @@ void sub_08060528(Entity* this) {
if (0 < (s16)this->field_0x6a.HWORD) {
if ((s16)this->field_0x6a.HWORD > 0x12b) {
this->field_0x6a.HWORD = 0;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
this->field_0x6c.HALF.HI = 1;
sub_080788E0(this);
EnqueueSFX(0x7c);

View File

@ -235,7 +235,7 @@ void sub_0806A914(Entity* this) {
Entity* npc = CreateNPC(0x37, 1, 0);
if (npc != NULL) {
CopyPosition(this, npc);
ResolveEntityOnTop(this, npc);
SortEntityAbove(this, npc);
}
}
@ -279,7 +279,7 @@ void sub_0806A9E8(Entity* this) {
Entity* npc = CreateNPC(0x37, 4, 0);
if (npc != NULL) {
CopyPosition(this, npc);
ResolveEntityBelow(this, npc);
SortEntityBelow(this, npc);
}
}

View File

@ -216,7 +216,7 @@ void sub_0806AF60(Entity* this, ScriptExecutionContext* context) {
}
void sub_0806AF70(Entity* this, ScriptExecutionContext* context) {
this->zVelocity = 0x24000;
this->zVelocity = Q_16_16(2.25);
}
void sub_0806AF78(Entity* this, ScriptExecutionContext* context) {
@ -229,7 +229,7 @@ void sub_0806AF78(Entity* this, ScriptExecutionContext* context) {
void sub_0806AFA0(Entity* this) {
if (sub_0806ED78(this)) {
sub_0806F62C(this, -this->speed, this->direction);
LinearMoveAngle(this, -this->speed, this->direction);
}
}

View File

@ -220,7 +220,7 @@ void sub_08061F94(Entity* this) {
ent = CreateFx(this, FX_BIG_EXPLOSION, 0);
if (ent != NULL) {
ResolveEntityOnTop(this, ent);
SortEntityAbove(this, ent);
}
}

View File

@ -44,7 +44,7 @@ void VaatiRebornAction0(Entity* this) {
entity = CreateNPC(VAATI_REBORN, 1, 0);
entity->parent = this;
entity->spriteOffsetY = -1;
PositionRelative(this, entity, 0, 0x10000);
PositionRelative(this, entity, 0, Q_16_16(1.0));
InitAnimationForceUpdate(this, 0);
break;
case 1:
@ -115,7 +115,7 @@ void VaatiRebornAction1(Entity* this) {
if (entity == NULL) {
DeleteThisEntity();
}
PositionRelative(entity, this, 0, 0x210000);
PositionRelative(entity, this, 0, Q_16_16(33.0));
UpdateAnimationSingleFrame(this);
break;
case 2:
@ -194,7 +194,7 @@ void sub_0806B96C(Entity* this) {
}
ptr = &gUnk_08112F80[this->type2];
this->spriteSettings.draw = entity->spriteSettings.draw;
PositionRelative(entity, this, ptr->x << 0x10, (ptr->y + 0x21) << 0x10);
PositionRelative(entity, this, Q_16_16(ptr->x), Q_16_16(ptr->y + 0x21));
UpdateAnimationSingleFrame(this);
}

View File

@ -7,7 +7,7 @@ void Wheaton(Entity* this) {
this->action++;
SetDefaultPriority(this, PRIO_MESSAGE);
ResolveEntityOnTop(this, this);
SortEntityAbove(this, this);
this->hitbox = &gUnk_0810C3C0;
this->spriteOffsetY = 0xfe;
sub_0807DD64(this);

View File

@ -127,13 +127,13 @@ void sub_08066E80(Entity* this, ScriptExecutionContext* context) {
UpdateAnimationSingleFrame(this);
if (this->frame & 1) {
context->unk_18++;
this->zVelocity = 0x20000;
this->zVelocity = Q_16_16(2.0);
this->frame &= 0xFE;
SoundReq(SFX_PLY_JUMP);
}
break;
case 2:
sub_0806F62C(this, 0x100, 0x80);
LinearMoveAngle(this, 0x100, 0x80);
GravityUpdate(this, 0x2000);
if (!(this->frame & 1)) {
UpdateAnimationSingleFrame(this);
@ -143,7 +143,7 @@ void sub_08066E80(Entity* this, ScriptExecutionContext* context) {
}
break;
case 3:
sub_0806F62C(this, 0x100, 0x80);
LinearMoveAngle(this, 0x100, 0x80);
UpdateAnimationSingleFrame(this);
if (GravityUpdate(this, 0x2000) == 0) {
context->unk_18++;

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);

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;
}
}

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);
}
}
}

View File

@ -134,7 +134,7 @@ void sub_0809B56C(Entity* this) {
fx = CreateFx(this, FX_DEATH, 0);
if (fx) {
ResolveEntityOnTop(this, fx);
SortEntityAbove(this, fx);
}
}

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;

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);

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);
}

View File

@ -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) {
@ -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;

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) {

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);
}
}

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;

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;

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) {

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));
}
}

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;

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]);

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);
}

Some files were not shown because too many files have changed in this diff Show More