diff options
| author | notyourav <65437533+notyourav@users.noreply.github.com> | 2022-01-21 21:31:20 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-21 21:31:20 -0800 |
| commit | 93e745e9638bb4f48e27908eebe2bb4eb349812e (patch) | |
| tree | a6524652b6c265e285c6ea7c0b6d96ac54168b58 /src/projectile | |
| parent | aa5150f36037c187cddf0a3196dd55a96ecfadc8 (diff) | |
| parent | b4b7e9a28b38510a49d750128d23dd57a19979ae (diff) | |
Merge pull request #309 from notyourav/fp
fixed point stuff
Diffstat (limited to 'src/projectile')
| -rw-r--r-- | src/projectile/boneProjectile.c | 4 | ||||
| -rw-r--r-- | src/projectile/dirtBallProjectile.c | 10 | ||||
| -rw-r--r-- | src/projectile/gleerokProjectile.c | 4 | ||||
| -rw-r--r-- | src/projectile/gyorgMaleEnergyProjectile.c | 4 | ||||
| -rw-r--r-- | src/projectile/lakituCloudProjectile.c | 4 | ||||
| -rw-r--r-- | src/projectile/mandiblesProjectile.c | 10 | ||||
| -rw-r--r-- | src/projectile/octorokBossProjectile.c | 14 | ||||
| -rw-r--r-- | src/projectile/rockProjectile.c | 4 | ||||
| -rw-r--r-- | src/projectile/stalfosProjectile.c | 4 | ||||
| -rw-r--r-- | src/projectile/v1DarkMagicProjectile.c | 8 | ||||
| -rw-r--r-- | src/projectile/v1EyeLaser.c | 2 | ||||
| -rw-r--r-- | src/projectile/v1FireProjectile.c | 4 | ||||
| -rw-r--r-- | src/projectile/v2Projectile.c | 2 |
13 files changed, 37 insertions, 37 deletions
diff --git a/src/projectile/boneProjectile.c b/src/projectile/boneProjectile.c index 20c6e090..33677de2 100644 --- a/src/projectile/boneProjectile.c +++ b/src/projectile/boneProjectile.c @@ -75,7 +75,7 @@ void BoneProjectile_Action3(Entity* this) { void BoneProjectile_Action4(Entity* this) { GetNextFrame(this); LinearMoveUpdate(this); - if (GravityUpdate(this, 0x1800) == 0) { + if (GravityUpdate(this, Q_8_8(24.0)) == 0) { DeleteEntity(this); } } @@ -83,7 +83,7 @@ void BoneProjectile_Action4(Entity* this) { void sub_080A82D8(Entity* this) { this->action = 4; COLLISION_OFF(this); - this->zVelocity = 0x10000; + this->zVelocity = Q_16_16(1.0); this->direction ^= 0x10; this->speed = 0x80; } diff --git a/src/projectile/dirtBallProjectile.c b/src/projectile/dirtBallProjectile.c index a4a0d8e1..df383b15 100644 --- a/src/projectile/dirtBallProjectile.c +++ b/src/projectile/dirtBallProjectile.c @@ -48,7 +48,7 @@ void DirtBallProjectile_Init(Entity* this) { this->action = 1; this->subAction = 0; this->spriteSettings.shadow = 1; - this->zVelocity = 0x8000; + this->zVelocity = Q_16_16(0.5); this->hitbox = (Hitbox*)&gUnk_08129764; this->field_0x3c |= 0x10; switch (this->type) { @@ -76,13 +76,13 @@ void DirtBallProjectile_Action1(Entity* this) { if (parent->next == NULL) { this->action = 2; } - PositionRelative(parent, this, 0, -0x10000); + PositionRelative(parent, this, 0, Q_16_16(-1.0)); switch (this->type) { case 0: - this->z.HALF.HI += 0x10; + this->z.HALF.HI += Q_8_8(1.0 / 16.0); break; case 1: - this->z.HALF.HI += 0xe; + this->z.HALF.HI += Q_8_8(1.0 / 16.0 - 1.0 / 128.0); sub_08078954(this->child); CopyPosition(this, this->child); if ((0xf < (u8)(this->actionDelay++ + 1)) && (entity = this->child, entity->actionDelay == 0)) { @@ -96,7 +96,7 @@ void DirtBallProjectile_Action1(Entity* this) { } break; case 2: - this->z.HALF.HI += 0xe; + this->z.HALF.HI += Q_8_8(1.0 / 16.0 - 1.0 / 128.0); if (EntityInRectRadius(this, &gPlayerEntity, 0xe, 0xe) != 0) { this->action = 2; parent->field_0x82.HALF.HI = 0xc0; diff --git a/src/projectile/gleerokProjectile.c b/src/projectile/gleerokProjectile.c index 5b63e25f..128e32f7 100644 --- a/src/projectile/gleerokProjectile.c +++ b/src/projectile/gleerokProjectile.c @@ -32,10 +32,10 @@ void GleerokProjectile_Init(Entity* this) { s32 iVar2; this->action = 1; - this->zVelocity = -0x10000; + this->zVelocity = Q_16_16(-1.0); if (this->type != 3) { CopyPosition(this->parent, this); - sub_0806F5BC(this, 0x1000, this->direction); + LinearMoveDirection(this, 0x1000, this->direction); this->z.WORD = this->parent->y.WORD - this->child->y.WORD; this->y.WORD -= this->z.WORD; InitializeAnimation(this, 0x51); diff --git a/src/projectile/gyorgMaleEnergyProjectile.c b/src/projectile/gyorgMaleEnergyProjectile.c index 8e9983cc..cfcfed29 100644 --- a/src/projectile/gyorgMaleEnergyProjectile.c +++ b/src/projectile/gyorgMaleEnergyProjectile.c @@ -60,8 +60,8 @@ void GyorgMaleEnergyProjectile_Action1(Entity* this) { DeleteThisEntity(); } animationState = this->parent->animationState; - PositionRelative(this->parent, this, gSineTable[animationState] * 0x2800, - gSineTable[animationState + 0x40] * -0x2800); + PositionRelative(this->parent, this, gSineTable[animationState] * Q_16_16(5.0 / 32.0), + gSineTable[animationState + 0x40] * Q_16_16(-5.0 / 32.0)); GetNextFrame(this); if (--this->actionDelay == 0) { this->action = 2; diff --git a/src/projectile/lakituCloudProjectile.c b/src/projectile/lakituCloudProjectile.c index ce7d2d21..0175653f 100644 --- a/src/projectile/lakituCloudProjectile.c +++ b/src/projectile/lakituCloudProjectile.c @@ -57,8 +57,8 @@ void LakituCloudProjectile_Init(Entity* this) { } void LakituCloudProjectile_Action1(Entity* this) { - PositionRelative(this->parent, this, 0, -0x10000); - this->z.HALF.HI = 0xfffe; + PositionRelative(this->parent, this, 0, Q_16_16(-1.0)); + this->z.HALF.HI = -2; UpdateAnimationSingleFrame(this); } diff --git a/src/projectile/mandiblesProjectile.c b/src/projectile/mandiblesProjectile.c index 6e261021..a69c493b 100644 --- a/src/projectile/mandiblesProjectile.c +++ b/src/projectile/mandiblesProjectile.c @@ -77,7 +77,7 @@ void MandiblesProjectile_Init(Entity* this) { this->animationState = 0xff; this->field_0x82.HALF.LO = 0; this->spritePriority.b0 = 4; - ResolveEntityBelow(this, this->parent); + SortEntityBelow(this, this->parent); sub_080AA270(this); } @@ -125,9 +125,9 @@ void MandiblesProjectile_Action3(Entity* this) { } else { tmp = GetSpriteSubEntryOffsetDataPointer((u16)entity->spriteIndex, entity->frameIndex); if ((entity->animationState & 4) != 0) { - PositionRelative(entity, this, -tmp[0] * 0x10000, tmp[1] << 0x10); + PositionRelative(entity, this, Q_16_16(-tmp[0]), Q_16_16(tmp[1])); } else { - PositionRelative(entity, this, tmp[0] << 0x10, tmp[1] << 0x10); + PositionRelative(entity, this, Q_16_16(tmp[0]), Q_16_16(tmp[1])); } } if (entity->field_0x43 == 0) { @@ -212,9 +212,9 @@ void sub_080AA1D8(Entity* this) { if ((parent->frameIndex & 0x20) == 0) { tmp = GetSpriteSubEntryOffsetDataPointer((u16)parent->spriteIndex, parent->frameIndex); if ((parent->animationState & 4) != 0) { - PositionRelative(parent, this, -tmp[0] * 0x10000, tmp[1] << 0x10); + PositionRelative(parent, this, Q_16_16(-tmp[0]), Q_16_16(tmp[1])); } else { - PositionRelative(parent, this, tmp[0] << 0x10, tmp[1] << 0x10); + PositionRelative(parent, this, Q_16_16(tmp[0]), Q_16_16(tmp[1])); } if (parent->field_0x43 != 0) { if ((this->flags & ENT_COLLIDE) != 0) { diff --git a/src/projectile/octorokBossProjectile.c b/src/projectile/octorokBossProjectile.c index 1ca08f9d..1f5c8ddd 100644 --- a/src/projectile/octorokBossProjectile.c +++ b/src/projectile/octorokBossProjectile.c @@ -33,7 +33,7 @@ void OctorokBossProjectile_Init(Entity* this) { switch (this->type) { case 0: - sub_0806F62C(this, 0x4800, this->direction); + LinearMoveAngle(this, 0x4800, this->direction); this->speed = 0x200; this->actionDelay = 0; this->field_0xf = this->direction; @@ -44,11 +44,11 @@ void OctorokBossProjectile_Init(Entity* this) { this->spriteRendering.b3 = 3; this->spritePriority.b0 = 6; this->speed = (Random() & 0x1ff) + 0x200; - this->zVelocity = (Random() & 0x1fff) + 0x18000; + this->zVelocity = (Random() & 0x1fff) + Q_16_16(1.5); uVar1 = (((u8)Random() & 7) - 4); this->direction -= uVar1; *(u32*)&this->field_0x78 = 600; - sub_0806F62C(this, this->speed, this->direction); + LinearMoveAngle(this, this->speed, this->direction); InitializeAnimation(this, 4); break; case 2: @@ -59,7 +59,7 @@ void OctorokBossProjectile_Init(Entity* this) { } this->speed = 0x200; this->actionDelay = 0x30; - sub_0806F62C(this, 0x5000, this->direction); + LinearMoveAngle(this, 0x5000, this->direction); InitializeAnimation(this, 5); break; case 3: @@ -113,7 +113,7 @@ void OctorokBossProjectile_Action1(Entity* this) { } UpdateAnimationSingleFrame(this); this->field_0x78.HWORD--; - sub_0806F62C(this, this->speed, this->direction); + LinearMoveAngle(this, this->speed, this->direction); sub_080AE58C(this, this->direction >> 3, 0); if ((this->collisions & 0xee00) != 0) { this->direction = -this->direction; @@ -153,7 +153,7 @@ void OctorokBossProjectile_Action1(Entity* this) { if (GravityUpdate(this, 0x1800) != 0) { sub_080AE58C(this, this->direction >> 3, 0); if (this->collisions == 0) { - sub_0806F62C(this, (s32)this->speed, (u32)this->direction); + LinearMoveAngle(this, (s32)this->speed, (u32)this->direction); } else { OctorokBossProjectile_Action2(this); } @@ -176,7 +176,7 @@ void OctorokBossProjectile_Action1(Entity* this) { case 2: GetNextFrame(this); if (--this->actionDelay != 0xff) { - sub_0806F62C(this, this->speed, this->direction); + LinearMoveAngle(this, this->speed, this->direction); return; } if (this->child != NULL) { diff --git a/src/projectile/rockProjectile.c b/src/projectile/rockProjectile.c index 7254631b..66e8388f 100644 --- a/src/projectile/rockProjectile.c +++ b/src/projectile/rockProjectile.c @@ -31,7 +31,7 @@ void sub_080A8064(Entity* this) { void RockProjectile_Init(Entity* this) { this->action = 1; this->actionDelay = 0x30; - this->zVelocity = 0xa000; + this->zVelocity = Q_16_16(0.625); InitializeAnimation(this, 0); } @@ -86,7 +86,7 @@ void sub_080A8178(Entity* this) { this->action = 2; COLLISION_OFF(this); this->speed = 0x40; - this->zVelocity = 0x14000; + this->zVelocity = Q_16_16(1.25); } void (*const RockProjectile_Functions[])(Entity*) = { diff --git a/src/projectile/stalfosProjectile.c b/src/projectile/stalfosProjectile.c index 709907e0..841a68e3 100644 --- a/src/projectile/stalfosProjectile.c +++ b/src/projectile/stalfosProjectile.c @@ -32,7 +32,7 @@ void sub_080A9A34(Entity* this) { if (this->bitfield == 0x9d) { this->action = 3; COLLISION_OFF(this); - this->zVelocity = 0x2a000; + this->zVelocity = Q_16_16(2.625); this->spritePriority.b1 = 1; } } @@ -76,7 +76,7 @@ void StalfosProjectile_Init(Entity* this) { break; case 2: this->action = 3; - this->zVelocity = 0x2a000; + this->zVelocity = Q_16_16(2.625); this->spritePriority.b1 = 1; break; default: diff --git a/src/projectile/v1DarkMagicProjectile.c b/src/projectile/v1DarkMagicProjectile.c index c9a3d281..dbc770a1 100644 --- a/src/projectile/v1DarkMagicProjectile.c +++ b/src/projectile/v1DarkMagicProjectile.c @@ -31,9 +31,9 @@ void sub_080AAC44(Entity* this) { this->action = 2; COLLISION_OFF(this); if (this->type == 0) { - ResolveEntityOnTop(&gPlayerEntity, this); + SortEntityAbove(&gPlayerEntity, this); } else { - ResolveEntityOnTop(this->parent, this); + SortEntityAbove(this->parent, this); } ResetPlayer(); gPlayerState.mobility |= 0x80; @@ -114,7 +114,7 @@ void V1DarkMagicProjectile_Init(Entity* this) { } else { this->action = 3; this->hitType = 0x2c; - ResolveEntityOnTop(this->parent, this); + SortEntityAbove(this->parent, this); } if (this->type == 0) { this->actionDelay = 0; @@ -136,7 +136,7 @@ void V1DarkMagicProjectile_Init(Entity* this) { entity->parent = this; } } else { - ResolveEntityOnTop(this->parent, this); + SortEntityAbove(this->parent, this); COLLISION_OFF(this); CopyPosition(this->parent, this); } diff --git a/src/projectile/v1EyeLaser.c b/src/projectile/v1EyeLaser.c index 8bdb0652..de642d5d 100644 --- a/src/projectile/v1EyeLaser.c +++ b/src/projectile/v1EyeLaser.c @@ -99,7 +99,7 @@ void sub_080AB844(Entity* this, s32 param_1, s32 param_2) { entity->type = 1; entity->actionDelay = param_1; entity->parent = this->parent; - PositionRelative(this, entity, 0, param_2 << 0x10); + PositionRelative(this, entity, 0, Q_16_16(param_2)); if (param_1 != 1) { entity->hitbox = (Hitbox*)&gUnk_0812A61C; } else { diff --git a/src/projectile/v1FireProjectile.c b/src/projectile/v1FireProjectile.c index 90bdc5fd..2823d563 100644 --- a/src/projectile/v1FireProjectile.c +++ b/src/projectile/v1FireProjectile.c @@ -39,10 +39,10 @@ void V1FireProjectile_Init(Entity* this) { s8* data; this->action = 1; - this->zVelocity = -0x10000; + this->zVelocity = Q_16_16(-1.0); this->field_0x76.HWORD = TILE(this->x.HALF.HI, this->y.HALF.HI); CopyPosition(this->parent, this); - sub_0806F5BC(this, 0x1000, this->direction); + LinearMoveDirection(this, 0x1000, this->direction); this->spritePriority.b0 = 1; this->z = this->parent->z; InitializeAnimation(this, 0x51); diff --git a/src/projectile/v2Projectile.c b/src/projectile/v2Projectile.c index 5d9f6eb2..fc7f09d2 100644 --- a/src/projectile/v2Projectile.c +++ b/src/projectile/v2Projectile.c @@ -138,7 +138,7 @@ void sub_080ABE04(Entity* this) { u32 rand = Random() & 0xff; u32 newX; this->action = 1; - this->zVelocity = 0xffff0000; + this->zVelocity = Q_16_16(-1.0); this->z.HALF.HI -= 0xa0; this->x.HALF.HI = (gRoomControls.origin_x & 0x7ff0) | 0x8; this->y.HALF.HI = (gRoomControls.origin_y & 0x7ff0) | 0x8; |
