summaryrefslogtreecommitdiff
path: root/src/projectile
diff options
context:
space:
mode:
authorTal Hayon <talhayon1@gmail.com>2022-01-23 17:24:55 +0200
committerTal Hayon <talhayon1@gmail.com>2022-01-23 17:24:55 +0200
commit70e2ef587740bfa159528bc0b160bb89869ad925 (patch)
tree766b21f8ce110a96d673e52e8cd7ac05072e5495 /src/projectile
parenta1ae3b229bf3767349849e3da29fe4fd2043eda3 (diff)
parent85aaada18f7eace3284937c4da8db05f047d316b (diff)
Merge remote-tracking branch 'upstream/master' into coord
Diffstat (limited to 'src/projectile')
-rw-r--r--src/projectile/boneProjectile.c4
-rw-r--r--src/projectile/cannonballProjectile.c4
-rw-r--r--src/projectile/dekuSeedProjectile.c4
-rw-r--r--src/projectile/dirtBallProjectile.c10
-rw-r--r--src/projectile/gleerokProjectile.c4
-rw-r--r--src/projectile/gyorgMaleEnergyProjectile.c4
-rw-r--r--src/projectile/lakituCloudProjectile.c4
-rw-r--r--src/projectile/mandiblesProjectile.c10
-rw-r--r--src/projectile/octorokBossProjectile.c14
-rw-r--r--src/projectile/rockProjectile.c4
-rw-r--r--src/projectile/stalfosProjectile.c4
-rw-r--r--src/projectile/v1DarkMagicProjectile.c8
-rw-r--r--src/projectile/v1EyeLaser.c2
-rw-r--r--src/projectile/v1FireProjectile.c4
-rw-r--r--src/projectile/v2Projectile.c2
15 files changed, 41 insertions, 41 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/cannonballProjectile.c b/src/projectile/cannonballProjectile.c
index 449240e1..5e07dfc4 100644
--- a/src/projectile/cannonballProjectile.c
+++ b/src/projectile/cannonballProjectile.c
@@ -5,7 +5,7 @@ extern void CreateItemOnGround(Entity*);
extern s32 sub_080AF090(Entity*);
extern void sub_080043A8(Entity*);
extern void CreateChestSpawner(Entity*);
-extern u32 sub_080177A0(Entity*, Entity*);
+extern u32 IsColliding(Entity*, Entity*);
extern void (*const CannonballProjectile_Functions[])(Entity*);
extern void (*const CannonballProjectile_Actions[])(Entity*);
@@ -79,7 +79,7 @@ bool32 sub_080AB634(Entity* this) {
Entity** entities = ((Entity**)&this->parent->zVelocity);
u32 i;
for (i = 0; i <= 3; ++i) {
- if (entities[i] != NULL && (sub_080177A0(this, entities[i]) != 0)) {
+ if (entities[i] != NULL && (IsColliding(this, entities[i]) != 0)) {
if (entities[i]->action < 3) {
entities[i]->action = 3;
entities[i]->actionDelay = 0x1e;
diff --git a/src/projectile/dekuSeedProjectile.c b/src/projectile/dekuSeedProjectile.c
index d84d0409..3afad118 100644
--- a/src/projectile/dekuSeedProjectile.c
+++ b/src/projectile/dekuSeedProjectile.c
@@ -5,7 +5,7 @@
extern s32 sub_080AF090(Entity*);
extern s32 IsProjectileOffScreen(Entity*);
extern void sub_08016AD2(Entity*);
-extern u32 sub_080177A0(Entity*, Entity*);
+extern u32 IsColliding(Entity*, Entity*);
extern void (*const DekuSeedProjectile_Functions[])(Entity*);
extern void (*const DekuSeedProjectile_Actions[])(Entity*);
@@ -70,7 +70,7 @@ void DekuSeedProjectile_Action1(Entity* this) {
}
if (this->field_0xf != 0) {
parent = this->parent;
- if ((parent->next != NULL) && (sub_080177A0(this, parent) != 0)) {
+ if ((parent->next != NULL) && (IsColliding(this, parent) != 0)) {
this->iframes = 0x10;
this->knockbackDirection = -this->direction;
this->bitfield = 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 5ef24656..4b47889b 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;