mirror of
https://github.com/zeldaret/mm.git
synced 2026-07-08 21:34:48 -04:00
Change Rand_Next to u32, document rand.c a bit more (#819)
* Change Rand_Next to u32, document rand.c a bit more * Clean up the quotes a bit, add another note * Format * — -> - * Review * Remove unnecessary casts * Remove quote, reformat the comments * Fix new files * Make docs a bit more consistent and specific * Format
This commit is contained in:
+24
-24
@@ -77,57 +77,57 @@ u16 sATan2Tbl[] = {
|
||||
0x1FF6, 0x1FFB, 0x2000,
|
||||
};
|
||||
|
||||
u16 Math_GetAtan2Tbl(f32 opposite, f32 adjacent) {
|
||||
return sATan2Tbl[(s32)((opposite / adjacent) * 0x400)];
|
||||
u16 Math_GetAtan2Tbl(f32 y, f32 x) {
|
||||
return sATan2Tbl[(s32)((y / x) * 0x400)];
|
||||
}
|
||||
|
||||
s16 Math_Atan2S(f32 opposite, f32 adjacent) {
|
||||
s16 Math_Atan2S(f32 y, f32 x) {
|
||||
s32 angle;
|
||||
|
||||
if (opposite == 0.0f) {
|
||||
if (adjacent >= 0.0f) {
|
||||
if (y == 0.0f) {
|
||||
if (x >= 0.0f) {
|
||||
angle = 0;
|
||||
} else {
|
||||
angle = 0x8000;
|
||||
}
|
||||
} else if (adjacent == 0.0f) {
|
||||
if (opposite >= 0.0f) {
|
||||
} else if (x == 0.0f) {
|
||||
if (y >= 0.0f) {
|
||||
angle = 0x4000;
|
||||
} else {
|
||||
angle = 0xC000;
|
||||
}
|
||||
} else if (opposite >= 0.0f) {
|
||||
if (adjacent >= 0.0f) {
|
||||
if (opposite <= adjacent) {
|
||||
angle = Math_GetAtan2Tbl(opposite, adjacent);
|
||||
} else if (y >= 0.0f) {
|
||||
if (x >= 0.0f) {
|
||||
if (y <= x) {
|
||||
angle = Math_GetAtan2Tbl(y, x);
|
||||
} else {
|
||||
angle = 0x4000 - Math_GetAtan2Tbl(adjacent, opposite);
|
||||
angle = 0x4000 - Math_GetAtan2Tbl(x, y);
|
||||
}
|
||||
} else {
|
||||
if (-adjacent < opposite) {
|
||||
angle = Math_GetAtan2Tbl(-adjacent, opposite) + 0x4000;
|
||||
if (-x < y) {
|
||||
angle = Math_GetAtan2Tbl(-x, y) + 0x4000;
|
||||
} else {
|
||||
angle = 0x8000 - Math_GetAtan2Tbl(opposite, -adjacent);
|
||||
angle = 0x8000 - Math_GetAtan2Tbl(y, -x);
|
||||
}
|
||||
}
|
||||
} else if (adjacent < 0.0f) {
|
||||
if (-opposite <= -adjacent) {
|
||||
angle = Math_GetAtan2Tbl(-opposite, -adjacent) + 0x8000;
|
||||
} else if (x < 0.0f) {
|
||||
if (-y <= -x) {
|
||||
angle = Math_GetAtan2Tbl(-y, -x) + 0x8000;
|
||||
} else {
|
||||
angle = 0xC000 - Math_GetAtan2Tbl(-adjacent, -opposite);
|
||||
angle = 0xC000 - Math_GetAtan2Tbl(-x, -y);
|
||||
}
|
||||
} else {
|
||||
if (adjacent < -opposite) {
|
||||
angle = Math_GetAtan2Tbl(adjacent, -opposite) + 0xC000;
|
||||
if (x < -y) {
|
||||
angle = Math_GetAtan2Tbl(x, -y) + 0xC000;
|
||||
} else {
|
||||
angle = -Math_GetAtan2Tbl(-opposite, adjacent);
|
||||
angle = -Math_GetAtan2Tbl(-y, x);
|
||||
}
|
||||
}
|
||||
return angle;
|
||||
}
|
||||
|
||||
f32 Math_Atan2F(f32 opposite, f32 adjacent) {
|
||||
return Math_Atan2S(opposite, adjacent) * (M_PI / 0x8000);
|
||||
f32 Math_Atan2F(f32 y, f32 x) {
|
||||
return Math_Atan2S(y, x) * (M_PI / 0x8000);
|
||||
}
|
||||
|
||||
s16 Math_FAtan2F(f32 adjacent, f32 opposite) {
|
||||
|
||||
+1
-1
@@ -4782,7 +4782,7 @@ void Actor_SpawnIceEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbPos
|
||||
yaw = Actor_YawToPoint(actor, limbPos);
|
||||
|
||||
for (j = 0; j < effectsPerLimb; j++) {
|
||||
randomYaw = (Rand_Next() >> 0x13) + yaw;
|
||||
randomYaw = ((s32)Rand_Next() >> 0x13) + yaw;
|
||||
|
||||
velocity.z = Rand_ZeroFloat(5.0f);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user