mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-07-11 21:21:59 -04:00
just using random_f macro instead of fqrand
This commit is contained in:
@@ -11,192 +11,6 @@
|
||||
#include "m_rcp.h"
|
||||
#include "ac_gyoei.h"
|
||||
|
||||
/*
|
||||
just some shorthand; D(v) == double, F(v) == float
|
||||
NOTE: sometimes something is used as a double, but has
|
||||
the truncated precision of a float. you'll see `D(0.71f)`
|
||||
|
||||
@467 F(2.0f);
|
||||
@468 F(0.0f);
|
||||
@469 D(0.5); // sqrtf
|
||||
@470 D(3.0); // sqrtf
|
||||
@471 F(0.5f);
|
||||
@472 F(1.0f);
|
||||
@526 F(0.025f);
|
||||
@527 F(0.1f);
|
||||
@528 F(0.005f);
|
||||
@529 F(110.0f);
|
||||
@530 F(60.0f);
|
||||
@555 F(45.0f);
|
||||
@556 F(180.0f);
|
||||
@557 F(5.0f);
|
||||
@568 D(4294967296.0); // 0x1_00_00_00_00, number of ints?
|
||||
@570 D(4503601774854144.0);
|
||||
@587 F(0.8f);
|
||||
@588 F(0x10000 / 360.f); // deg2short
|
||||
@603 F(1.2f);
|
||||
@665 D(0.8f); // double cut at float precision
|
||||
@666 F(0.05f);
|
||||
@697 F(10.0f);
|
||||
@698 F(20.0f);
|
||||
@699 F(40.0f);
|
||||
@791 F(0.04f);
|
||||
@792 F(0.75f);
|
||||
@793 F(0.01f);
|
||||
@836 F(75.0f);
|
||||
@837 F(7.5f);
|
||||
@838 F(0.7f);
|
||||
@839 F(0.2f);
|
||||
@840 F(3.0f);
|
||||
@920 D(0.9f); // double cut at float precision
|
||||
@921 D(0.6f); // double cut at float precision
|
||||
@974 F(0.125f);
|
||||
@975 F(2.5f);
|
||||
@976 F(-10.0f);
|
||||
@1066 D(0.75);
|
||||
@1067 F(0.4f);
|
||||
@1068 F(0.25f);
|
||||
@1069 F(0.9f);
|
||||
@1070 F(-0.3f);
|
||||
@1071 F(0.3f);
|
||||
@1072 F(-0.5f);
|
||||
@1099 F(65.0f);
|
||||
@1100 F(0.15f);
|
||||
@1101 F(15.0f);
|
||||
@1145 F(4.0f);
|
||||
@1146 F(0.6f);
|
||||
@1147 F(-0.2f);
|
||||
@1315 F(1.5f);
|
||||
@1344 F(1.25f);
|
||||
@1475 F(-12.0f);
|
||||
@1556 F(0.03f);
|
||||
@1557 F(0.003f);
|
||||
@1558 F(0.02f);
|
||||
@1559 F(6.0f);
|
||||
@1598 F(0.0054931640625f);
|
||||
@1599 F(120.0f);
|
||||
@1680 D(0.7f); // double cut at float precision
|
||||
@1711 F(0.08f);
|
||||
@1712 F(0.001f);
|
||||
@1957 F(0.002f);
|
||||
@1958 D(0.95f); // double cut at float precision
|
||||
@1997 F(55.0f);
|
||||
@2301 F(6.5f);
|
||||
@2377 F(0.0025f);
|
||||
@2593 F(0.0035f);
|
||||
@2594 F(0.35f);
|
||||
@2850 F(-0.05f);
|
||||
@2851 F(-0.1f);
|
||||
@2906 D(0.85f); // double cut at float precision
|
||||
@2937 F(0.0005f);
|
||||
@2938 F(0.0001f);
|
||||
@3066 F(1400.0f);
|
||||
@3228 F(32749.0f);
|
||||
@3229 F(25.0f);
|
||||
@3230 D(10.0);
|
||||
@3391 F(0.045f);
|
||||
@3475 F(0.008f);
|
||||
@3476 D(0.97f); // double cut at float precision
|
||||
@3706 F(9.0f);
|
||||
@3707 F(7.0f);
|
||||
@3708 F(8.0f);
|
||||
@3752 F(1.75f);
|
||||
@4106 F(5461.0f);
|
||||
@4261 F(0.035f);
|
||||
@4262 F(0.07f);
|
||||
@4470 F(80.0f);
|
||||
@4626 F(0.16f);
|
||||
@4774 F(35.0f);
|
||||
@4775 F(90.0f);
|
||||
@4929 F(115.0f);
|
||||
@5269 F(85.0f);
|
||||
@5270 F(114.5f);
|
||||
@5325 F(-1.3f);
|
||||
@5573 F(70.0f);
|
||||
@5574 F(100.0f);
|
||||
@5655 F(130.0f);
|
||||
@6315 F(50.0f);
|
||||
@6403 F(450.0f);
|
||||
@6505 F(31.25f);
|
||||
@6506 F(22.5f);
|
||||
@6507 F(0.95f);
|
||||
@6583 F(430.0f);
|
||||
@6584 F(530.0f);
|
||||
@6800 F(-0.025f);
|
||||
@6801 F(-0.01f);
|
||||
@6874 F(0.015f);
|
||||
@6875 F(0.06f);
|
||||
@6876 F(-90.0f);
|
||||
@6877 F(-180.0f);
|
||||
@7119 F(225.0f);
|
||||
@7120 F(185.0f);
|
||||
@7531 F(91.0f);
|
||||
@7611 F(1.1f);
|
||||
@7612 F(1.3f);
|
||||
@7652 F(1500.0f);
|
||||
@7653 F(1700.0f);
|
||||
@7768 D(0.925f); // double cut at float precision
|
||||
@7769 D(0.895f); // double cut at float precision
|
||||
@7841 D(0.945f); // double cut at float precision
|
||||
@7929 F(0.0625f);
|
||||
@7930 D(0.7100000381469727);
|
||||
@7931 D(0.965f); // double cut at float precision
|
||||
@7932 D(0.975f); // double cut at float precision
|
||||
@8130 F(300.0f);
|
||||
@8131 F(-0.15f);
|
||||
@8234 F(53.0f);
|
||||
@8327 F(-3.0f);
|
||||
@8410 F(-45.0f);
|
||||
@8411 D(0.99f); // double cut at float precision
|
||||
@8418 F(-1.2f);
|
||||
@8451 F(0.99f);
|
||||
@8478 F(58.0f);
|
||||
@8726 F(12.0f);
|
||||
@8727 F(13.0f);
|
||||
@8807 F(453.9f);
|
||||
@8808 F(116.0f);
|
||||
@8809 F(250.4f);
|
||||
@8810 F(-1.5f);
|
||||
@8811 F(-2.0f);
|
||||
@8883 F(-32.6f);
|
||||
@8884 F(-26.6f);
|
||||
@8885 F(-1.0f);
|
||||
@8886 F(-4.0f);
|
||||
@8887 F(-2.3f);
|
||||
@8888 F(-13.7f);
|
||||
@8889 F(-7.7f);
|
||||
@8890 F(-32.3f);
|
||||
@8949 float arr[2] = { 430.0f, 530.f };
|
||||
@9156 F(-20.0f);
|
||||
@9157 F(1000.0f);
|
||||
@9158 F(-25.0f);
|
||||
@9159 F(-1000.0f);
|
||||
@9160 F(-5.0f);
|
||||
@9247 F(-17.5f);
|
||||
@9248 F(76.0f);
|
||||
@9352 F(54.0f);
|
||||
@9353 F(189.0f);
|
||||
@9354 F(14.0f);
|
||||
@9355 F(32768.0f);
|
||||
@9356 F(21.0f);
|
||||
@9567 F(3.4028234663852886e+38f);
|
||||
@9693 F(320.0f);
|
||||
@9694 F(360.0f);
|
||||
@9695 F(560.0f);
|
||||
@9785 F(720.0f);
|
||||
@10190 F(0.9800000190734863f);
|
||||
@10191 F(160.0f);
|
||||
@10226 F(350.0f);
|
||||
@10227 F(650.0f);
|
||||
@10228 F(215.0f);
|
||||
@10240 F(1274.0f);
|
||||
@10241 F(4369.0f);
|
||||
@10353 F(240.0f);
|
||||
@10417 F(340.0f);
|
||||
@10418 F(580.0f);
|
||||
@10419 F(200.0f);
|
||||
*/
|
||||
|
||||
// found useful macros
|
||||
#define MY_MAX(a, b) (((a) >= (b)) ? (a) : (b))
|
||||
#define MY_CLAMP(v, l, h) MIN(MY_MAX((l), (v)), (h))
|
||||
|
||||
@@ -85,7 +85,7 @@ void mfish_aroana_normal_process(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* game) {
|
||||
DEG2SHORT_ANGLE(0.25f));
|
||||
|
||||
if (actor->_5E8 < 0.01f && actor->_632 < DEG2SHORT_ANGLE(1)) {
|
||||
if (fqrand() < 0.8f) {
|
||||
if (RANDOM_F(1.0f) < 0.8f) {
|
||||
mfish_aroana_long_move_process_init(actor);
|
||||
} else {
|
||||
mfish_aroana_dummy_process_init(actor);
|
||||
|
||||
@@ -260,8 +260,8 @@ void mfish_turn_process_init(MUSEUM_FISH_PRIVATE_DATA* actor) {
|
||||
|
||||
actor->_5F0 = actor->init_data._10 + actor->init_data._14 * 0.7f;
|
||||
|
||||
if (fqrand() < 0.2f) {
|
||||
actor->_63E = fqrand() * 3.0f + 1.0f;
|
||||
if (RANDOM_F(1.0f) < 0.2f) {
|
||||
actor->_63E = RANDOM_F(3.0f) + 1.0f;
|
||||
} else {
|
||||
actor->_63E = 0;
|
||||
}
|
||||
@@ -325,11 +325,11 @@ void mfish_peck_process_init(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* game) {
|
||||
}
|
||||
|
||||
if (atany < 0) {
|
||||
actor->_5F4 = actor->_5F4 + fqrand() * 2.5f;
|
||||
actor->_5F4 = actor->_5F4 + RANDOM_F(2.5f);
|
||||
actor->_5F4 = MAX(MIN(10, actor->_5F4), -10);
|
||||
|
||||
} else {
|
||||
actor->_5F4 = actor->_5F4 - fqrand() * 2.5f;
|
||||
actor->_5F4 = actor->_5F4 - RANDOM_F(2.5f);
|
||||
actor->_5F4 = MAX(MIN(10, actor->_5F4), -10);
|
||||
}
|
||||
|
||||
@@ -369,12 +369,12 @@ void mfish_peck_process(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex) {
|
||||
DEG2SHORT_ANGLE(0.25f));
|
||||
|
||||
if (mfish_peck_wall_check(actor, gamex)) {
|
||||
if (fqrand() < 0.9f) {
|
||||
actor->_5E8 = -0.3f - fqrand() * 0.3f;
|
||||
if (RANDOM_F(1.0f) < 0.9f) {
|
||||
actor->_5E8 = -0.3f - RANDOM_F(0.3f);
|
||||
actor->_626 = 10;
|
||||
} else {
|
||||
actor->_5E8 = -0.5f;
|
||||
actor->_626 = actor->init_data._2C + (s16)(fqrand() * actor->init_data._2E);
|
||||
actor->_626 = actor->init_data._2C + (s16)RANDOM_F(actor->init_data._2E);
|
||||
actor->_626 >>= 3;
|
||||
}
|
||||
actor->_628 = actor->_626;
|
||||
@@ -391,7 +391,7 @@ void mfish_ground_peck_process_init(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex
|
||||
actor->_626 = (int)(Rnd_EX_f(30.0f) + 15.0f) << 1;
|
||||
|
||||
if (actor->_34 != mfish_ground_peck_process) {
|
||||
actor->_63E = fqrand() * 2.0f + 3.0f;
|
||||
actor->_63E = RANDOM_F(2.0f) + 3.0f;
|
||||
} else {
|
||||
actor->_63E--;
|
||||
}
|
||||
@@ -433,7 +433,7 @@ void mfish_ground_peck_process(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex) {
|
||||
|
||||
void mfish_base_ct(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex) {
|
||||
GAME_PLAY* play = (GAME_PLAY*)gamex;
|
||||
f32 f = fqrand() * 2;
|
||||
f32 f = RANDOM_F(2.0f);
|
||||
f32 s;
|
||||
s16 q = qrand();
|
||||
actor->_5E8 = f;
|
||||
@@ -444,9 +444,9 @@ void mfish_base_ct(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex) {
|
||||
if (actor->_59C == 4 || actor->_59C == 9) {
|
||||
actor->_5F4 = 0.0f;
|
||||
} else if (actor->_59C == 0x1b) {
|
||||
actor->_5F4 = fqrand() * 5.0f;
|
||||
actor->_5F4 = RANDOM_F(5.0f);
|
||||
} else {
|
||||
actor->_5F4 = fqrand2() * 10.0f;
|
||||
actor->_5F4 = RANDOM_F(10.0f);
|
||||
}
|
||||
actor->_5D0.y = 0.0;
|
||||
actor->_5AC = ZeroVec;
|
||||
@@ -463,7 +463,7 @@ void mfish_base_mv(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex) {
|
||||
}
|
||||
|
||||
if (actor->_626-- <= 0) {
|
||||
actor->_626 = actor->init_data._2C + (s16)(fqrand() * actor->init_data._2E);
|
||||
actor->_626 = actor->init_data._2C + (s16)RANDOM_F(actor->init_data._2E);
|
||||
actor->_628 = actor->_626;
|
||||
if (mfish_peck_check(actor, gamex)) {
|
||||
actor->_626 >>= 2;
|
||||
@@ -480,7 +480,7 @@ void mfish_base_mv(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex) {
|
||||
if ((actor->_62E & 0x1E && ABS((s16)(actor->_62C - actor->_60C.y)) < DEG2SHORT_ANGLE(30)) ||
|
||||
(actor->_62E & 0x20 &&
|
||||
ABS((s16)(actor->_62A + DEG2SHORT_ANGLE(180) - actor->_60C.y)) < DEG2SHORT_ANGLE(30))) {
|
||||
actor->_626 = actor->init_data._2C + (s16)(fqrand() * actor->init_data._2E);
|
||||
actor->_626 = actor->init_data._2C + (s16)RANDOM_F(actor->init_data._2E);
|
||||
actor->_628 = actor->_626;
|
||||
mfish_turn_process_init(actor);
|
||||
}
|
||||
@@ -512,7 +512,7 @@ void mfish_onefish_ct(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex) {
|
||||
YET_SKELETON* s = &actor->_38;
|
||||
cKF_SkeletonInfo_R_ct(&s->_00, s->_54C, s->_550[0], &s->_4F0, &s->_514);
|
||||
cKF_SkeletonInfo_R_init_standard_repeat_speedsetandmorph(&s->_00, s->_550[0], NULL, 1.0f, 0.0f);
|
||||
actor->_626 = actor->init_data._2C + (s16)(actor->init_data._2E * fqrand());
|
||||
actor->_626 = actor->init_data._2C + (s16)RANDOM_F(actor->init_data._2E);
|
||||
actor->_628 = actor->_626;
|
||||
actor->_60C.x = DEG2SHORT_ANGLE(0);
|
||||
actor->_60C.y = DEG2SHORT_ANGLE(-90);
|
||||
@@ -1257,7 +1257,7 @@ BOOL mfish_ground_peck_before_check(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex
|
||||
if (actor->_34 == mfish_ground_peck_process) {
|
||||
return actor->_63E > 0;
|
||||
} else if ((actor->_630 == 2) && (actor->_5A0.x < p.x + 20.0f) && (actor->_5A0.z > p.z - 10.0f) &&
|
||||
(actor->_5A0.y < (actor->init_data._08 * 0.5f + 75.0f) - (v * 0.15f)) && (fqrand() > 0.2f)) {
|
||||
(actor->_5A0.y < (actor->init_data._08 * 0.5f + 75.0f) - (v * 0.15f)) && (RANDOM_F(1.0f) > 0.2f)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ void mfish_bass_mv(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex) {
|
||||
if (((actor->_62E & 0x1e) && ABS((s16)(actor->_62C - actor->_60C.y)) < DEG2SHORT_ANGLE(30)) ||
|
||||
((actor->_62E & 0x20) &&
|
||||
ABS((s16)((actor->_62A - DEG2SHORT_ANGLE(-180)) - actor->_60C.y)) < DEG2SHORT_ANGLE(30))) {
|
||||
actor->_626 = actor->init_data._2C + (s16)(actor->init_data._2E * fqrand());
|
||||
actor->_626 = actor->init_data._2C + (s16)RANDOM_F(actor->init_data._2E);
|
||||
actor->_628 = actor->_626;
|
||||
mfish_bass_tail_anim_set(actor, 1);
|
||||
mfish_bass_turn_process_init(actor);
|
||||
|
||||
@@ -59,7 +59,7 @@ void mfish_gupi_normal(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex) {
|
||||
} else if (actor->_5F8 > actor->init_data._08 * 30.f) {
|
||||
s16 s;
|
||||
//! BUG: unused?
|
||||
fqrand();
|
||||
RANDOM_F(1.0f);
|
||||
s = search_position_angleY(&suisou_pos[actor->_630], &actor->_5A0);
|
||||
actor->_5F8 = 0.0f;
|
||||
actor->_612.y = s + DEG2SHORT_ANGLE(RANDOM2_F(90.0));
|
||||
|
||||
@@ -178,7 +178,7 @@ void mfish_koi_normal_process(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* game) {
|
||||
DEG2SHORT_ANGLE(0.125f));
|
||||
|
||||
if (actor->_5E8 < 0.01f && actor->_632 < DEG2SHORT_ANGLE(1)) {
|
||||
if (fqrand() < 0.8f) {
|
||||
if (RANDOM_F(1.0f) < 0.8f) {
|
||||
mfish_koi_long_move_process_init(actor);
|
||||
} else {
|
||||
mfish_koi_dummy_process_init(actor);
|
||||
@@ -293,11 +293,11 @@ void mfish_koi_peck_process_init(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* game) {
|
||||
}
|
||||
|
||||
if (atany < 0) {
|
||||
actor->_5F4 = actor->_5F4 + fqrand() * 2.5f;
|
||||
actor->_5F4 = actor->_5F4 + RANDOM_F(2.5f);
|
||||
actor->_5F4 = MAX(MIN(10, actor->_5F4), -10);
|
||||
|
||||
} else {
|
||||
actor->_5F4 = actor->_5F4 - fqrand() * 2.5f;
|
||||
actor->_5F4 = actor->_5F4 - RANDOM_F(2.5f);
|
||||
actor->_5F4 = MAX(MIN(10, actor->_5F4), -10);
|
||||
}
|
||||
|
||||
@@ -334,14 +334,14 @@ void mfish_koi_peck_process(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex) {
|
||||
add_calc_short_angle2(&actor->_618.z, actor->_622, CALC_EASE2(0.2f), DEG2SHORT_ANGLE(2.f), DEG2SHORT_ANGLE(0.125f));
|
||||
|
||||
if (mfish_peck_wall_check(actor, gamex)) {
|
||||
if (fqrand() < 0.8f) {
|
||||
actor->_5E8 = -0.05f - fqrand() * 0.1f;
|
||||
if (RANDOM_F(1.0f) < 0.8f) {
|
||||
actor->_5E8 = -0.05f - RANDOM_F(0.1f);
|
||||
actor->_5F0 = 0.05f;
|
||||
actor->_626 = DEG2SHORT_ANGLE(0.33f);
|
||||
} else {
|
||||
actor->_5E8 = -0.1f - RANDOM_F(0.05f);
|
||||
actor->_5F0 = 0.05f;
|
||||
actor->_626 = actor->init_data._2C + (s16)(fqrand() * actor->init_data._2E);
|
||||
actor->_626 = actor->init_data._2C + (s16)RANDOM_F(actor->init_data._2E);
|
||||
// actor->_626 >>= 3;
|
||||
}
|
||||
actor->_628 = actor->_626;
|
||||
|
||||
@@ -124,7 +124,7 @@ void mfish_seafish_normal(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex) {
|
||||
}
|
||||
} else if (actor->_626 < 0) {
|
||||
// r in wrong register here
|
||||
r = fqrand();
|
||||
r = RANDOM_F(1.0f);
|
||||
actor->_612.y = actor->_60C.y;
|
||||
if ((actor->_608 - actor->_604) * cos_s(actor->_60C.y) < 0.0f) {
|
||||
actor->_612.y += (s16)(r * actor->init_data._30);
|
||||
|
||||
@@ -63,7 +63,7 @@ void mfish_sfish_normal(MUSEUM_FISH_PRIVATE_DATA* actor, GAME* gamex) {
|
||||
} else if (actor->_5F8 > actor->init_data._08 * 30.f) {
|
||||
s16 s;
|
||||
//! BUG: unused?
|
||||
fqrand();
|
||||
RANDOM_F(1.0f);
|
||||
s = search_position_angleY(&suisou_pos[actor->_630], &actor->_5A0);
|
||||
actor->_5F8 = 0.0f;
|
||||
actor->_612.y = s + DEG2SHORT_ANGLE(RANDOM2_F(90.0));
|
||||
|
||||
Reference in New Issue
Block a user