Use fixed point macros where possible

This commit is contained in:
Tal Hayon
2022-04-01 18:19:56 +03:00
parent 9233701a5d
commit d6d7916a46
90 changed files with 223 additions and 223 deletions
+1 -1
View File
@@ -182,7 +182,7 @@ void sub_080676E0(Entity* this, ScriptExecutionContext* context) {
break;
}
default: {
if (GravityUpdate(this, 0x1800) == 0) {
if (GravityUpdate(this, Q_8_8(24.0)) == 0) {
return;
}
break;
+3 -3
View File
@@ -51,16 +51,16 @@ void Cucco_Fly(Entity* this) {
}
this->timer = (Random() & 1) + 1;
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
InitAnimationForceUpdate(this, 1);
}
if (GravityUpdate(this, 0x2800) == 0) {
if (GravityUpdate(this, Q_8_8(40.0)) == 0) {
if (--this->timer == 0) {
this->action = 1;
this->subAction = 0;
} else {
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
}
}
+4 -4
View File
@@ -53,15 +53,15 @@ void CuccoChick_Fly(Entity* this) {
this->spriteSettings.flipX ^= 1;
}
this->timer = (Random() & 3) + 1;
this->zVelocity = 0x10000;
this->zVelocity = Q_16_16(1.0);
this->frameIndex = 1;
}
if (GravityUpdate(this, 0x3000) == 0) {
if (GravityUpdate(this, Q_8_8(48.0)) == 0) {
if (--this->timer == 0) {
this->action = 1;
this->subAction = 0;
} else {
this->zVelocity = 0x10000;
this->zVelocity = Q_16_16(1.0);
}
}
sub_0806E838(this);
@@ -100,7 +100,7 @@ void CuccoChick_Fusion(Entity* this) {
this->spriteSettings.draw = 1;
this->frameIndex = 1;
} else {
if (GravityUpdate(this, 0x3000) == 0) {
if (GravityUpdate(this, Q_8_8(48.0)) == 0) {
this->zVelocity = Q_16_16(1.0);
}
}
+1 -1
View File
@@ -286,7 +286,7 @@ void sub_08060DFC(Entity* this) {
LinearMoveUpdate(this);
sub_08060E94(this);
uVar1 = GravityUpdate(this, 0x2000);
uVar1 = GravityUpdate(this, Q_8_8(32.0));
if (uVar1 == 0) {
this->action = 7;
this->collisionLayer = 1;
+2 -2
View File
@@ -153,12 +153,12 @@ void sub_08060528(Entity* this) {
this->field_0x6a.HWORD -= 1;
}
}
GravityUpdate(this, 0x1800);
GravityUpdate(this, Q_8_8(24.0));
if (((this->field_0x6c.HALF.HI != 0) && (this->zVelocity == 0)) && this->z.WORD == 0) {
this->field_0x6c.HALF.HI = 0;
sub_080606C0(this);
}
if ((-1 < this->z.WORD) &&
if (this->z.WORD >= 0 &&
((gPlayerEntity.collisionLayer == 0 || (this->collisionLayer == gPlayerEntity.collisionLayer)))) {
sub_0806ED78(this);
}
+4 -4
View File
@@ -416,17 +416,17 @@ void sub_0806AA50(Entity* this, ScriptExecutionContext* context) {
case 0:
gRoomVars.entities[0] = this;
PrependEntityToList(this, NPC);
this->zVelocity = 0x18000;
this->zVelocity = Q_16_16(1.5);
break;
case 1:
pEnt = FindNextDuplicateID(gRoomVars.entities[0], NPC);
gRoomVars.entities[1] = pEnt;
pEnt->zVelocity = 0x18000;
pEnt->zVelocity = Q_16_16(1.5);
break;
case 2:
pEnt = FindNextDuplicateID(gRoomVars.entities[1], NPC);
gRoomVars.entities[2] = pEnt;
pEnt->zVelocity = 0x18000;
pEnt->zVelocity = Q_16_16(1.5);
break;
}
if (messageIndex == 0x441e) {
@@ -440,7 +440,7 @@ void sub_0806AA50(Entity* this, ScriptExecutionContext* context) {
if (pEnt->z.HALF.HI < 0) {
break;
}
pEnt->zVelocity = 0x18000;
pEnt->zVelocity = Q_16_16(1.5);
context->unk_18 = 2;
break;
case 2:
+3 -3
View File
@@ -168,7 +168,7 @@ void sub_0806AEA8(Entity* this) {
int old = this->field_0x82.HWORD;
this->field_0x82.HWORD &= ~0x20;
if (old & 0x20) {
GravityUpdate(this, 0x4000);
GravityUpdate(this, Q_8_8(64.0));
}
HandleEntity0x82Actions(this);
this->field_0x82.HWORD = old;
@@ -220,8 +220,8 @@ void sub_0806AF70(Entity* this, ScriptExecutionContext* context) {
}
void sub_0806AF78(Entity* this, ScriptExecutionContext* context) {
GravityUpdate(this, 0x1800);
if (0 <= this->z.WORD && this->zVelocity < 1) {
GravityUpdate(this, Q_8_8(24.0));
if (0 <= this->z.WORD && this->zVelocity <= 0) {
this->z.WORD = 0;
sub_0806AF70(this, context);
}
+2 -2
View File
@@ -134,7 +134,7 @@ void sub_08066E80(Entity* this, ScriptExecutionContext* context) {
break;
case 2:
LinearMoveAngle(this, 0x100, 0x80);
GravityUpdate(this, 0x2000);
GravityUpdate(this, Q_8_8(32.0));
if (!(this->frame & 1)) {
UpdateAnimationSingleFrame(this);
}
@@ -145,7 +145,7 @@ void sub_08066E80(Entity* this, ScriptExecutionContext* context) {
case 3:
LinearMoveAngle(this, 0x100, 0x80);
UpdateAnimationSingleFrame(this);
if (GravityUpdate(this, 0x2000) == 0) {
if (GravityUpdate(this, Q_8_8(32.0)) == 0) {
context->unk_18++;
InitAnimationForceUpdate(this, 0x1E);
}