Introduce RANDOMFRAC() macro

This commit is contained in:
Ryan Dwyer 2022-04-02 12:21:25 +10:00
parent 3e93b586a2
commit 40c778872e
23 changed files with 152 additions and 154 deletions

View File

@ -556,7 +556,7 @@ glabel var7f1a8a84
//
// if (g_HeadsAndBodies[bodynum].canvaryheight && varyheight) {
// // Set height to between 95% and 115%
// f32 frac = random() * (1.0f / U32_MAX) * 0.05f;
// f32 frac = RANDOMFRAC() * 0.05f;
// scale *= 2.0f * frac - 0.05f + 1.0f;
// }
// }
@ -578,7 +578,7 @@ glabel var7f1a8a84
// } else if (bodyfiledata->type == &g_SkelSkedar) {
// if (g_HeadsAndBodies[bodynum].canvaryheight && varyheight && bodynum == BODY_SKEDAR) {
// // Set height to between 65% and 85%
// f32 frac = random() * (1.0f / U32_MAX);
// f32 frac = RANDOMFRAC();
// scale *= 2.0f * (0.1f * frac) - 0.1f + 0.75f;
// }
// }

View File

@ -11003,17 +11003,17 @@ void bgunCalculateBlend(s32 handnum)
sp58[handnum] = (player->hands[handnum].curblendpos + 1) % 4;
player->hands[handnum].curblendpos = sp58[handnum];
player->hands[handnum].blendlook[sp60[handnum]][0] = (random() * (1.0f / U32_MAX) - 0.5f) * 0.08f * mult;
player->hands[handnum].blendlook[sp60[handnum]][1] = (random() * (1.0f / U32_MAX) - 0.5f) * 0.1f * mult;
player->hands[handnum].blendlook[sp60[handnum]][0] = (RANDOMFRAC() - 0.5f) * 0.08f * mult;
player->hands[handnum].blendlook[sp60[handnum]][1] = (RANDOMFRAC() - 0.5f) * 0.1f * mult;
player->hands[handnum].blendlook[sp60[handnum]][2] = -1;
player->hands[handnum].blendup[sp60[handnum]][0] = (random() * (1.0f / U32_MAX) - 0.5f) * 0.1f * mult;
player->hands[handnum].blendup[sp60[handnum]][0] = (RANDOMFRAC() - 0.5f) * 0.1f * mult;
player->hands[handnum].blendup[sp60[handnum]][1] = 1;
player->hands[handnum].blendup[sp60[handnum]][2] = (random() * (1.0f / U32_MAX) - 0.5f) * 0.1f * mult;
player->hands[handnum].blendup[sp60[handnum]][2] = (RANDOMFRAC() - 0.5f) * 0.1f * mult;
player->hands[handnum].blendpos[sp60[handnum]][0] = (random() * (1.0f / U32_MAX) * 0.75f) + 1.5f;
player->hands[handnum].blendpos[sp60[handnum]][1] = (2 + random() * (1.0f / U32_MAX)) * player->hands[handnum].blendscale1;
player->hands[handnum].blendpos[sp60[handnum]][2] = (random() * (1.0f / U32_MAX) - 0.5f) * 2.5f;
player->hands[handnum].blendpos[sp60[handnum]][0] = (RANDOMFRAC() * 0.75f) + 1.5f;
player->hands[handnum].blendpos[sp60[handnum]][1] = (2 + RANDOMFRAC()) * player->hands[handnum].blendscale1;
player->hands[handnum].blendpos[sp60[handnum]][2] = (RANDOMFRAC() - 0.5f) * 2.5f;
if (player->hands[handnum].sideflag < 0) {
player->hands[handnum].blendpos[sp60[handnum]][0] *= -1;
@ -11583,7 +11583,7 @@ void bgun0f09d8dc(f32 breathing, f32 arg1, f32 arg2, f32 arg3, f32 arg4)
if (player->synccount > 60.0f) {
player->synccount = 0.0f;
player->syncchange = (random() * (1.0f / U32_MAX) - 0.5f) * 0.2f / 60.0f;
player->syncchange = (RANDOMFRAC() - 0.5f) * 0.2f / 60.0f;
}
if (player->syncchange + sp4c > 0.0f) {
@ -13424,7 +13424,7 @@ struct defaultobj *bgun0f09ee18(struct chrdata *chr, struct gset *gset, struct c
}
if (gset->weaponnum == WEAPON_COMBATKNIFE) {
guRotateF(mtx.m, 90.0f / (random() * (1.0f / U32_MAX) + 12.1f),
guRotateF(mtx.m, 90.0f / (RANDOMFRAC() + 12.1f),
arg4->m[1][0], arg4->m[1][1], arg4->m[1][2]);
} else {
func0f096360(&mtx);
@ -18237,7 +18237,7 @@ void bgunCalculatePlayerShotSpread(struct coord *arg0, struct coord *arg1, s32 h
scaledspread = 120.0f * spread / viGetFovY();
if (dorandom) {
randfactor = (random() * (1.0f / U32_MAX) - 0.5f) * (random() * (1.0f / U32_MAX));
randfactor = (RANDOMFRAC() - 0.5f) * RANDOMFRAC();
} else {
randfactor = 0;
}
@ -18246,7 +18246,7 @@ void bgunCalculatePlayerShotSpread(struct coord *arg0, struct coord *arg1, s32 h
/ (viGetHeight() * camGetPerspAspect());
if (dorandom) {
randfactor = (random() * (1.0f / U32_MAX) - 0.5f) * (random() * (1.0f / U32_MAX));
randfactor = (RANDOMFRAC() - 0.5f) * RANDOMFRAC();
} else {
randfactor = 0;
}
@ -18294,8 +18294,8 @@ void bgunCalculateBotShotSpread(struct coord *arg0, s32 weaponnum, s32 funcnum,
}
radius = 120.0f * spread / viGetFovY();
x = (random() * (1.0f / U32_MAX) - 0.5f) * (random() * (1.0f / U32_MAX)) * radius;
y = (random() * (1.0f / U32_MAX) - 0.5f) * (random() * (1.0f / U32_MAX)) * radius;
x = (RANDOMFRAC() - 0.5f) * RANDOMFRAC() * radius;
y = (RANDOMFRAC() - 0.5f) * RANDOMFRAC() * radius;
sp48.x = g_Vars.currentplayer->c_scalex * x;
sp48.y = g_Vars.currentplayer->c_scaley * y;
@ -24078,9 +24078,9 @@ void bgun0f0a5550(s32 handnum)
sp274.z -= player->guncloseroffset * 15.0f / -90.0f * 50.0f;
if (hand->firing && shootfunc && g_Vars.lvupdate240 != 0 && shootfunc->unk14 != NULL) {
sp274.x += (random() * (1.0f / U32_MAX) - 0.5f) * shootfunc->unk14->minradius * hand->finalmult[0];
sp274.y += (random() * (1.0f / U32_MAX) - 0.5f) * shootfunc->unk14->maxradius * hand->finalmult[0];
sp274.z += (random() * (1.0f / U32_MAX) - 0.5f) * shootfunc->unk14->incradius * hand->finalmult[0];
sp274.x += (RANDOMFRAC() - 0.5f) * shootfunc->unk14->minradius * hand->finalmult[0];
sp274.y += (RANDOMFRAC() - 0.5f) * shootfunc->unk14->maxradius * hand->finalmult[0];
sp274.z += (RANDOMFRAC() - 0.5f) * shootfunc->unk14->incradius * hand->finalmult[0];
}
hand->fspare1 = (player->crosspos2[0] - camGetScreenLeft() - camGetScreenWidth() * 0.5f) * weapondef->eptr->unk0c / (camGetScreenWidth() * 0.5f);

View File

@ -25,19 +25,17 @@ void bheadFlipAnimation(void)
void bheadUpdateIdleRoll(void)
{
f32 mult = 1.0f / U32_MAX;
g_Vars.currentplayer->standlook[g_Vars.currentplayer->standcnt].x = ((f32)random() * mult - 0.5f) * 0.02f;
g_Vars.currentplayer->standlook[g_Vars.currentplayer->standcnt].x = (RANDOMFRAC() - 0.5f) * 0.02f;
g_Vars.currentplayer->standlook[g_Vars.currentplayer->standcnt].z = 1;
g_Vars.currentplayer->standup[g_Vars.currentplayer->standcnt].x = ((f32)random() * mult - 0.5f) * 0.02f;
g_Vars.currentplayer->standup[g_Vars.currentplayer->standcnt].x = (RANDOMFRAC() - 0.5f) * 0.02f;
g_Vars.currentplayer->standup[g_Vars.currentplayer->standcnt].y = 1;
if (g_Vars.currentplayer->standcnt) {
g_Vars.currentplayer->standlook[g_Vars.currentplayer->standcnt].y = (f32)random() * mult * 0.01f;
g_Vars.currentplayer->standup[g_Vars.currentplayer->standcnt].z = (f32)random() * mult * -0.01f;
g_Vars.currentplayer->standlook[g_Vars.currentplayer->standcnt].y = RANDOMFRAC() * 0.01f;
g_Vars.currentplayer->standup[g_Vars.currentplayer->standcnt].z = RANDOMFRAC() * -0.01f;
} else {
g_Vars.currentplayer->standlook[g_Vars.currentplayer->standcnt].y = (f32)random() * mult * -0.01f;
g_Vars.currentplayer->standup[g_Vars.currentplayer->standcnt].z = (f32)random() * mult * 0.01f;
g_Vars.currentplayer->standlook[g_Vars.currentplayer->standcnt].y = RANDOMFRAC() * -0.01f;
g_Vars.currentplayer->standup[g_Vars.currentplayer->standcnt].z = RANDOMFRAC() * 0.01f;
}
g_Vars.currentplayer->standcnt = 1 - g_Vars.currentplayer->standcnt;

View File

@ -21369,7 +21369,7 @@ Gfx *bviewRenderHorizonScanner(Gfx *gdl)
gDPSetColor(gdl++, G_SETENVCOLOR, colour);
gdl = bviewRenderLensRect(gdl, fb, liney, 5, liney, random() * (1.0f / U32_MAX) * range + 1, viewleft, viewwidth);
gdl = bviewRenderLensRect(gdl, fb, liney, 5, liney, RANDOMFRAC() * range + 1, viewleft, viewwidth);
}
return gdl;

View File

@ -1092,7 +1092,7 @@ glabel botReset
// aibot->unk2c4 = 0;
//
// aibot->random2 = random();
// aibot->randomfrac = random() * (1.0f / U32_MAX);
// aibot->randomfrac = RANDOMFRAC();
// aibot->unk078 = 0;
// aibot->cheap = 0;
// aibot->unk050 = 0;
@ -13640,7 +13640,7 @@ void botTickUnpaused(struct chrdata *chr)
if (aibot->random2ttl60 < 0) {
aibot->random2ttl60 = 1800 + random() % 14400;
aibot->random2 = random();
aibot->randomfrac = random() * (1.0f / U32_MAX);
aibot->randomfrac = RANDOMFRAC();
}
// Consider reloading

View File

@ -258,7 +258,7 @@ void botmgrAllocateBot(s32 chrnum, s32 aibotnum)
aibot->random2ttl60 = 0;
aibot->random2 = random();
aibot->randomfrac = random() * (1.0f / U32_MAX);
aibot->randomfrac = RANDOMFRAC();
aibot->cheap = false;
#if VERSION >= VERSION_NTSC_1_0
aibot->unk078 = 0;

View File

@ -41,7 +41,7 @@ void casingTick(struct casing *casing)
&& i >= 0
&& g_Vars.currentplayer->hands[0].mode != HANDMODE_2
&& g_Vars.currentplayer->hands[1].mode != HANDMODE_2) {
sp58 = random() * (1.0f / U32_MAX) * 0.25f + 0.98f;
sp58 = RANDOMFRAC() * 0.25f + 0.98f;
var8009d0d8 = TICKS(20);
sndStart(var80095200, SFX_8051, &g_CasingAudioHandles[i], -1, -1, -1.0f, -1, -1);

View File

@ -6838,7 +6838,7 @@ bool chrTryRunSideways(struct chrdata *chr)
&& chrIsReadyForOrders(chr)
&& g_Vars.lvframe60 - chr->lastwalk60 > TICKS(180)) {
struct prop *prop = chr->prop;
f32 distance = 200.0f + random() * (1.0f / U32_MAX) * 200.0f;
f32 distance = 200.0f + RANDOMFRAC() * 200.0f;
struct coord vector;
struct coord dstpos;

View File

@ -583,7 +583,7 @@ f32 func0f1382e0(f32 range)
f32 value;
do {
value = random() * (1.0f / U32_MAX) * range;
value = RANDOMFRAC() * range;
value = (value + value) - range;
} while (value < 0.0001f && value > -0.0001f);
@ -767,15 +767,15 @@ void func0f13870c(void)
g_CreditsData->unk41ff = 7;
for (i = 0; i < ARRAYCOUNT(g_CreditsData->unk000c); i++) {
tmp = random() * (1.0f / U32_MAX);
tmp = RANDOMFRAC();
g_CreditsData->unk000c[i].unk00 = (tmp + tmp) * 3000.0f - 3000.0f;
tmp = random() * (1.0f / U32_MAX);
tmp = RANDOMFRAC();
g_CreditsData->unk000c[i].unk04 = (tmp + tmp) * 3000.0f - 3000.0f;
g_CreditsData->unk000c[i].unk12 = random() % 4;
g_CreditsData->unk000c[i].unk14 = random() % 4;
g_CreditsData->unk000c[i].unk0c = random() * (1.0f / U32_MAX) * M_BADTAU;
g_CreditsData->unk000c[i].unk0c = RANDOMFRAC() * M_BADTAU;
if (g_CreditsData->unk4200 < g_CreditsData->unk41ff) {
g_CreditsData->unk000c[i].unk13 = g_CreditsData->unk4200
@ -792,7 +792,7 @@ void func0f13870c(void)
g_CreditsData->unk000c[i].unk11 = g_CreditsData->unk41fe;
}
g_CreditsData->unk000c[i].unk08 = random() * (1.0f / U32_MAX) * -8000.0f;
g_CreditsData->unk000c[i].unk08 = RANDOMFRAC() * -8000.0f;
}
}
@ -1816,13 +1816,13 @@ glabel var7f1b5824
// g_CreditsData->unk41f5 = -1;
// }
// } else {
// if (random() * (1.0f / U32_MAX) < 0.007f && joyGetButtons(0, L_TRIG | R_TRIG) == 0) {
// if (RANDOMFRAC() < 0.007f && joyGetButtons(0, L_TRIG | R_TRIG) == 0) {
// g_CreditsData->unk41f5 = random() % 4;
// g_CreditsData->unk41f8 = 0;
// }
// }
//
// if (random() * (1.0f / U32_MAX) < 0.002f && joyGetButtons(0, L_TRIG | R_TRIG) == 0) {
// if (RANDOMFRAC() < 0.002f && joyGetButtons(0, L_TRIG | R_TRIG) == 0) {
// g_CreditsData->unk41fc = random() % 5;
// }
//
@ -1835,7 +1835,7 @@ glabel var7f1b5824
// }
// }
//
// if (random() * (1.0f / U32_MAX) < 0.007f) {
// if (RANDOMFRAC() < 0.007f) {
// g_CreditsData->unk41fd = random() % 2;
// g_CreditsData->unk41fe = random() % 2;
// }
@ -1852,16 +1852,16 @@ glabel var7f1b5824
// g_CreditsData->unk000c[i].unk08 += g_Vars.diffframe240f * 30.0f * 0.25f;
//
// if (g_CreditsData->unk000c[i].unk08 > 0) {
// tmp = random() * (1.0f / U32_MAX);
// tmp = RANDOMFRAC();
// g_CreditsData->unk000c[i].unk00 = (tmp + tmp) * 3000 - 3000;
//
// tmp = random() * (1.0f / U32_MAX);
// tmp = RANDOMFRAC();
// g_CreditsData->unk000c[i].unk04 = (tmp + tmp) * 3000 - 3000;
//
// g_CreditsData->unk000c[i].unk12 = random() % 4;
// g_CreditsData->unk000c[i].unk14 = random() % 4;
//
// g_CreditsData->unk000c[i].unk0c = random() * (1.0f / U32_MAX) * M_BADTAU;
// g_CreditsData->unk000c[i].unk0c = RANDOMFRAC() * M_BADTAU;
//
// if (g_CreditsData->unk4200 < g_CreditsData->unk41ff) {
// g_CreditsData->unk000c[i].unk13 = g_CreditsData->unk4200
@ -5628,7 +5628,7 @@ void creditsTick(void)
if (g_CreditsData->slidesenabled) {
creditsTickSlide();
} else if (random() * (1.0f / U32_MAX) < 0.01f && !joyGetButtons(0, L_TRIG | R_TRIG)) {
} else if (RANDOMFRAC() < 0.01f && !joyGetButtons(0, L_TRIG | R_TRIG)) {
creditsCreatePendingBgLayers(0xffffffff);
}

View File

@ -531,8 +531,8 @@ bool explosionCreate(struct prop *sourceprop, struct coord *exppos, s16 *exproom
exp->parts[0].pos.x = exppos->x;
exp->parts[0].pos.y = exppos->y;
exp->parts[0].pos.z = exppos->z;
exp->parts[0].size = g_ExplosionTypes[type].innersize * (random() * (1.0f / U32_MAX) * 0.5f + 1);
exp->parts[0].rot = random() * (1.0f / U32_MAX) * M_BADTAU;
exp->parts[0].size = g_ExplosionTypes[type].innersize * (RANDOMFRAC() * 0.5f + 1);
exp->parts[0].rot = RANDOMFRAC() * M_BADTAU;
exp->parts[0].bb = 0;
if (g_Vars.mplayerisrunning) {
@ -850,7 +850,7 @@ void explosionInflictDamage(struct prop *expprop)
// Damage the object
if ((obj->hidden & OBJHFLAG_00001000) == 0
&& (obj->flags2 & (OBJFLAG2_LINKEDTOSAFE | OBJFLAG2_00200000)) == 0) {
func0f085050(prop, (random() * (1.0f / U32_MAX) * 0.5f + 1.0f) * minfrac, &prop->pos, 0x22, exp->owner);
func0f085050(prop, (RANDOMFRAC() * 0.5f + 1.0f) * minfrac, &prop->pos, 0x22, exp->owner);
}
// Give object momentum if it's a hover obj
@ -881,7 +881,7 @@ void explosionInflictDamage(struct prop *expprop)
if ((obj->hidden & OBJHFLAG_00001000) == 0
&& (obj->flags2 & (OBJFLAG2_LINKEDTOSAFE | OBJFLAG2_00200000)) == 0) {
func0f085050(prop, (random() * (1.0f / U32_MAX) * 0.5f + 1.0f) * minfrac,
func0f085050(prop, (RANDOMFRAC() * 0.5f + 1.0f) * minfrac,
&prop->pos, 0x22, exp->owner);
}
}
@ -1150,13 +1150,13 @@ u32 explosionTick(struct prop *prop)
}
}
exp->parts[j].pos.f[0] = spfc.f[0] + random() * (1.0f / U32_MAX) * (spf0.f[0] - spfc.f[0]);
exp->parts[j].pos.f[1] = spfc.f[1] + random() * (1.0f / U32_MAX) * (spf0.f[1] - spfc.f[1]);
exp->parts[j].pos.f[2] = spfc.f[2] + random() * (1.0f / U32_MAX) * (spf0.f[2] - spfc.f[2]);
exp->parts[j].pos.f[0] = spfc.f[0] + RANDOMFRAC() * (spf0.f[0] - spfc.f[0]);
exp->parts[j].pos.f[1] = spfc.f[1] + RANDOMFRAC() * (spf0.f[1] - spfc.f[1]);
exp->parts[j].pos.f[2] = spfc.f[2] + RANDOMFRAC() * (spf0.f[2] - spfc.f[2]);
exp->parts[j].bb = bb;
exp->parts[j].frame = 1;
exp->parts[j].size = (1.0f + random() * (1.0f / U32_MAX) * 0.5f) * type->innersize;
exp->parts[j].rot = random() * (1.0f / U32_MAX) * M_BADTAU;
exp->parts[j].size = (1.0f + RANDOMFRAC() * 0.5f) * type->innersize;
exp->parts[j].rot = RANDOMFRAC() * M_BADTAU;
break;
}
}
@ -1201,7 +1201,7 @@ u32 explosionTick(struct prop *prop)
scorchsize = 100.0f;
}
scorchsize *= 0.8f + 0.2f * (random() * (1.0f / U32_MAX));
scorchsize *= 0.8f + 0.2f * RANDOMFRAC();
if (g_Vars.normmplayerisrunning) {
chr = mpGetChrFromPlayerIndex(exp->owner);

View File

@ -15,18 +15,18 @@ void func0f096360(Mtxf *mtx)
{
struct coord coord = {0, 0, 0};
coord.x = random() * (1.0f / U32_MAX) * PALUPF(M_BADTAU) * 0.0078125f - PALUPF(0.024539785459638f);
coord.y = random() * (1.0f / U32_MAX) * PALUPF(M_BADTAU) * 0.0078125f - PALUPF(0.024539785459638f);
coord.z = random() * (1.0f / U32_MAX) * PALUPF(M_BADTAU) * 0.0078125f - PALUPF(0.024539785459638f);
coord.x = RANDOMFRAC() * PALUPF(M_BADTAU) * 0.0078125f - PALUPF(0.024539785459638f);
coord.y = RANDOMFRAC() * PALUPF(M_BADTAU) * 0.0078125f - PALUPF(0.024539785459638f);
coord.z = RANDOMFRAC() * PALUPF(M_BADTAU) * 0.0078125f - PALUPF(0.024539785459638f);
mtx4LoadRotation(&coord, mtx);
}
void func0f0964b4(struct coord *coord, Mtxf *mtx)
{
coord->x = random() * (1.0f / U32_MAX) * 1.6666666269302f * 4.0f - 3.3333332538605f;
coord->y = random() * (1.0f / U32_MAX) * 1.6666666269302f * 4.0f;
coord->z = random() * (1.0f / U32_MAX) * 1.6666666269302f * 4.0f - 3.3333332538605f;
coord->x = RANDOMFRAC() * 1.6666666269302f * 4.0f - 3.3333332538605f;
coord->y = RANDOMFRAC() * 1.6666666269302f * 4.0f;
coord->z = RANDOMFRAC() * 1.6666666269302f * 4.0f - 3.3333332538605f;
func0f096360(mtx);
}

View File

@ -89,7 +89,7 @@ void beamCreate(struct beam *beam, s32 weaponnum, struct coord *from, struct coo
beam->mindist = 3000;
}
beam->dist = (-0.1f - random() * (1.0f / U32_MAX) * 0.3f) * distance;
beam->dist = (-0.1f - RANDOMFRAC() * 0.3f) * distance;
} else if (weaponnum == -2) {
beam->speed = 0;
beam->mindist = distance;
@ -108,7 +108,7 @@ void beamCreate(struct beam *beam, s32 weaponnum, struct coord *from, struct coo
beam->mindist = 3000;
}
tmp = random() * (1.0f / U32_MAX);
tmp = RANDOMFRAC();
beam->dist = (tmp + tmp - 1) * beam->speed;
}
@ -2244,7 +2244,7 @@ void beamTick(struct beam *beam)
beam->dist += beam->speed * g_Vars.lvupdate240f;
} else {
// Lagging
beam->dist += beam->speed * (2 + random() * (1.0f / U32_MAX) * 0.5f);
beam->dist += beam->speed * (2 + RANDOMFRAC() * 0.5f);
}
if (beam->dist >= beam->maxdist) {

View File

@ -3600,7 +3600,7 @@ void menuOpenDialog(struct menudialogdef *dialogdef, struct menudialog *dialog,
dialog->type = dialogdef->type;
dialog->transitionfrac = -1;
dialog->redrawtimer = 0;
dialog->unk4c = random() * (1.0f / U32_MAX) * M_TAU;
dialog->unk4c = RANDOMFRAC() * M_TAU;
g_Menus[g_MpPlayerNum].curdialog->state = MENUDIALOGSTATE_PREOPEN;
g_Menus[g_MpPlayerNum].curdialog->statefrac = 0;
@ -28902,9 +28902,9 @@ Gfx *menuRender(Gfx *gdl)
// Everyone 1 in 100 frames on average, calculate a new X/Y for the hudpiece
// Note: unintentional 64-bit float comparison done here
if (random() * (1.0f / U32_MAX) < 0.01) {
g_MenuData.unk01c.unk538 = random() * (1.0f / U32_MAX) * 80.0f + -205.5f - 40.0f;
g_MenuData.unk01c.unk53c = random() * (1.0f / U32_MAX) * 80.0f + 244.7f - 40.0f;
if (RANDOMFRAC() < 0.01) {
g_MenuData.unk01c.unk538 = RANDOMFRAC() * 80.0f + -205.5f - 40.0f;
g_MenuData.unk01c.unk53c = RANDOMFRAC() * 80.0f + 244.7f - 40.0f;
}
var8009de98 = var8009de9c = 0;

View File

@ -2944,13 +2944,13 @@ void playerTickExplode(void)
pos.z = g_Vars.currentplayer->prop->pos.z;
switch (g_Vars.currentplayer->bondcurexplode % 4) {
case 0: pos.x += 250.0f + 150.0f * (random() * (1.0f / U32_MAX)); break;
case 1: pos.x -= 250.0f + 150.0f * (random() * (1.0f / U32_MAX)); break;
case 2: pos.z += 250.0f + 150.0f * (random() * (1.0f / U32_MAX)); break;
case 3: pos.z -= 250.0f + 150.0f * (random() * (1.0f / U32_MAX)); break;
case 0: pos.x += 250.0f + 150.0f * RANDOMFRAC(); break;
case 1: pos.x -= 250.0f + 150.0f * RANDOMFRAC(); break;
case 2: pos.z += 250.0f + 150.0f * RANDOMFRAC(); break;
case 3: pos.z -= 250.0f + 150.0f * RANDOMFRAC(); break;
}
pos.y += 200.0f * (random() * (1.0f / U32_MAX)) - 100.0f;
pos.y += 200.0f * RANDOMFRAC() - 100.0f;
explosionCreateSimple(NULL, &pos, g_Vars.currentplayer->prop->rooms, EXPLOSIONTYPE_BONDEXPLODE, g_Vars.currentplayernum);

View File

@ -456,10 +456,10 @@ void weaponPlayWhooshSound(s32 weaponnum, struct prop *prop)
// empty
} else if (weaponnum == WEAPON_COMBATKNIFE) {
soundnum = random() % 2 == 1 ? SFX_8060 : SFX_8061;
speed = 1.05f - random() * (1.0f / U32_MAX) * 0.2f;
speed = 1.05f - RANDOMFRAC() * 0.2f;
} else {
soundnum = SFX_0069;
speed = 1.0f - random() * (1.0f / U32_MAX) * 0.2f;
speed = 1.0f - RANDOMFRAC() * 0.2f;
}
if (soundnum != -1) {
@ -508,14 +508,14 @@ void func0f060bac(s32 weaponnum, struct prop *prop)
soundnum = SFX_THUD_8094;
}
speed = 1.0f - random() * (1.0f / U32_MAX) * 0.1f;
speed = 1.0f - RANDOMFRAC() * 0.1f;
} else if (weaponnum == WEAPON_TRANQUILIZER) {
soundnum = SFX_RELOAD_04FB;
speed = 2.78f;
} else {
#if VERSION >= VERSION_NTSC_1_0
soundnum = SFX_HIT_METAL_8079;
speed = 1.0f - random() * (1.0f / U32_MAX) * 0.1f;
speed = 1.0f - RANDOMFRAC() * 0.1f;
#else
soundnum = SFX_HIT_METAL_8079;
@ -523,7 +523,7 @@ void func0f060bac(s32 weaponnum, struct prop *prop)
soundnum = SFX_HATHIT_807C;
}
speed = 1.0f - random() * (1.0f / U32_MAX) * 0.1f;
speed = 1.0f - RANDOMFRAC() * 0.1f;
#endif
}
@ -983,7 +983,7 @@ struct prop *func0f061d54(s32 handnum, u32 arg1, u32 arg2)
bgunCalculatePlayerShotSpread(&sp58, &sp64, handnum, arg2);
if (arg2 == 2 && bgunGetWeaponNum(HAND_RIGHT) == WEAPON_REAPER) {
sp58.y -= 15 * (random() * (1.0f / U32_MAX));
sp58.y -= 15 * RANDOMFRAC();
}
mtx4TransformVec(camGetUnk174c(), &sp58, &sp40);

View File

@ -63675,7 +63675,7 @@ s32 objTickPlayer(struct prop *prop)
if (obj->hidden & OBJHFLAG_00000100) {
obj->hidden &= ~OBJHFLAG_00000100;
objDamage(obj, random() * (1.0f / U32_MAX) * 4.0f + 2.0f, &prop->pos, WEAPON_NONE, (obj->hidden & 0xf0000000) >> 28);
objDamage(obj, RANDOMFRAC() * 4.0f + 2.0f, &prop->pos, WEAPON_NONE, (obj->hidden & 0xf0000000) >> 28);
}
if (fulltick) {
@ -69025,9 +69025,9 @@ bool objDrop(struct prop *prop, bool lazy)
mtx00016208(rootobj->realrot, &spe4);
spa4 = random() * (1.0f / U32_MAX) * 13.333333015442f;
spa4 = RANDOMFRAC() * 13.333333015442f;
spa0 = atan2f(spe4.x, spe4.z);
spa0 += random() * (1.0f / U32_MAX) * 0.7852731347084f - 0.3926365673542f;
spa0 += RANDOMFRAC() * 0.7852731347084f - 0.3926365673542f;
if (spa0 >= M_BADTAU) {
spa0 -= M_BADTAU;
@ -69053,12 +69053,12 @@ bool objDrop(struct prop *prop, bool lazy)
f32 angle = chrGetInverseTheta(chr);
projectile->speed.x = sinf(angle) * 1.6666666269302f;
projectile->speed.y = -(random() * (1.0f / U32_MAX)) * 0.83333331346512f;
projectile->speed.y = -RANDOMFRAC() * 0.83333331346512f;
projectile->speed.z = cosf(angle) * 1.6666666269302f;
rot.x = random() * (1.0f / U32_MAX) * PALUPF(0.012269892729819f) - PALUPF(0.0061349463649094f);
rot.y = random() * (1.0f / U32_MAX) * PALUPF(0.012269892729819f) - PALUPF(0.0061349463649094f);
rot.z = random() * (1.0f / U32_MAX) * PALUPF(0.012269892729819f) - PALUPF(0.0061349463649094f);
rot.x = RANDOMFRAC() * PALUPF(0.012269892729819f) - PALUPF(0.0061349463649094f);
rot.y = RANDOMFRAC() * PALUPF(0.012269892729819f) - PALUPF(0.0061349463649094f);
rot.z = RANDOMFRAC() * PALUPF(0.012269892729819f) - PALUPF(0.0061349463649094f);
mtx4LoadRotation(&rot, (Mtxf *)&projectile->unk020);
} else if (projectile->droptype == DROPTYPE_THROWGRENADE && parent->type == PROPTYPE_CHR) {
@ -69081,9 +69081,9 @@ bool objDrop(struct prop *prop, bool lazy)
projectile->speed.y = (((dist >= 1200) * ((dist - 1200) / 1200)) + 1) * 6.6666665077209f;
projectile->speed.z = cosf(angle) * 13.333333015442f * (dist / 1000);
rot.x = random() * (1.0f / U32_MAX) * PALUPF(0.012269892729819f) - PALUPF(0.0061349463649094f);
rot.y = random() * (1.0f / U32_MAX) * PALUPF(0.012269892729819f) - PALUPF(0.0061349463649094f);
rot.z = random() * (1.0f / U32_MAX) * PALUPF(0.012269892729819f) - PALUPF(0.0061349463649094f);
rot.x = RANDOMFRAC() * PALUPF(0.012269892729819f) - PALUPF(0.0061349463649094f);
rot.y = RANDOMFRAC() * PALUPF(0.012269892729819f) - PALUPF(0.0061349463649094f);
rot.z = RANDOMFRAC() * PALUPF(0.012269892729819f) - PALUPF(0.0061349463649094f);
mtx4LoadRotation(&rot, (Mtxf *)&projectile->unk020);
objSetProjectileFlag4(prop);
@ -69094,25 +69094,25 @@ bool objDrop(struct prop *prop, bool lazy)
f32 z = parent->pos.z - playerprop->pos.z;
f32 angle = atan2f(x, z);
projectile->speed.x = (random() * (1.0f / U32_MAX) * 3.3333332538605f + 3.3333332538605f) * sinf(angle);
projectile->speed.y = random() * (1.0f / U32_MAX) * 3.3333332538605f;
projectile->speed.z = (random() * (1.0f / U32_MAX) * 3.3333332538605f + 3.3333332538605f) * cosf(angle);
projectile->speed.x = (RANDOMFRAC() * 3.3333332538605f + 3.3333332538605f) * sinf(angle);
projectile->speed.y = RANDOMFRAC() * 3.3333332538605f;
projectile->speed.z = (RANDOMFRAC() * 3.3333332538605f + 3.3333332538605f) * cosf(angle);
rot.x = random() * (1.0f / U32_MAX) * PALUPF(0.049079570919275f) - PALUPF(0.024539785459638f);
rot.y = random() * (1.0f / U32_MAX) * PALUPF(0.049079570919275f) - PALUPF(0.024539785459638f);
rot.z = random() * (1.0f / U32_MAX) * PALUPF(0.049079570919275f) - PALUPF(0.024539785459638f);
rot.x = RANDOMFRAC() * PALUPF(0.049079570919275f) - PALUPF(0.024539785459638f);
rot.y = RANDOMFRAC() * PALUPF(0.049079570919275f) - PALUPF(0.024539785459638f);
rot.z = RANDOMFRAC() * PALUPF(0.049079570919275f) - PALUPF(0.024539785459638f);
mtx4LoadRotation(&rot, (Mtxf *)&projectile->unk020);
} else if (projectile->droptype == DROPTYPE_OWNERREAP) {
struct coord rot = {0, 0, 0};
projectile->speed.x = (0.5f - (random() * (1.0f / U32_MAX))) * 1.6666666269302f;
projectile->speed.x = (0.5f - RANDOMFRAC()) * 1.6666666269302f;
projectile->speed.y = 0.0f;
projectile->speed.z = (0.5f - (random() * (1.0f / U32_MAX))) * 1.6666666269302f;
projectile->speed.z = (0.5f - RANDOMFRAC()) * 1.6666666269302f;
rot.x = random() * (1.0f / U32_MAX) * PALUPF(0.049079570919275f) - PALUPF(0.024539785459638f);
rot.y = random() * (1.0f / U32_MAX) * PALUPF(0.049079570919275f) - PALUPF(0.024539785459638f);
rot.z = random() * (1.0f / U32_MAX) * PALUPF(0.049079570919275f) - PALUPF(0.024539785459638f);
rot.x = RANDOMFRAC() * PALUPF(0.049079570919275f) - PALUPF(0.024539785459638f);
rot.y = RANDOMFRAC() * PALUPF(0.049079570919275f) - PALUPF(0.024539785459638f);
rot.z = RANDOMFRAC() * PALUPF(0.049079570919275f) - PALUPF(0.024539785459638f);
mtx4LoadRotation(&rot, (Mtxf *)&projectile->unk020);
} else {

View File

@ -106,17 +106,16 @@ void shardsCreate(struct coord *pos, f32 *rotx, f32 *roty, f32 *rotz, f32 relxmi
thispos.y = basepos.f[1] + x * (f32) speci * spcc[1] + spc0[1] * f20;
thispos.z = basepos.f[2] + x * (f32) speci * spcc[2] + spc0[2] * f20;
shardCreate(prop->rooms[0], &thispos, f30,
(random() * (1.0f / U32_MAX) * 0.7f + 0.1f) * spec, type);
shardCreate(prop->rooms[0], &thispos, f30, (RANDOMFRAC() * 0.7f + 0.1f) * spec, type);
}
}
}
void shardCreate(s16 room, struct coord *pos, f32 rotx, f32 size, s32 type)
{
f32 velx = random() * (1.0f / U32_MAX) * 2.0f - 1.0f;
f32 vely = random() * (1.0f / U32_MAX) * 1.12f - 0.12f;
f32 velz = random() * (1.0f / U32_MAX) * 2.0f - 1.0f;
f32 velx = RANDOMFRAC() * 2.0f - 1.0f;
f32 vely = RANDOMFRAC() * 1.12f - 0.12f;
f32 velz = RANDOMFRAC() * 2.0f - 1.0f;
s32 i;
g_Shards[g_NextShardNum].type = type;
@ -131,12 +130,12 @@ void shardCreate(s16 room, struct coord *pos, f32 rotx, f32 size, s32 type)
g_Shards[g_NextShardNum].vel.y = vely * PALUPF(3.0f);
g_Shards[g_NextShardNum].vel.z = velz * PALUPF(1.5f);
g_Shards[g_NextShardNum].vertices[0].x = (random() * (1.0f / U32_MAX) * 0.5f + 1.0f) * size;
g_Shards[g_NextShardNum].vertices[0].y = (random() * (1.0f / U32_MAX) * 0.5f + 1.0f) * size;
g_Shards[g_NextShardNum].vertices[1].x = (random() * (1.0f / U32_MAX) * 0.5f + 1.0f) * size;
g_Shards[g_NextShardNum].vertices[1].y = (random() * (1.0f / U32_MAX) * 0.5f + 1.0f) * -size;
g_Shards[g_NextShardNum].vertices[2].x = (random() * (1.0f / U32_MAX) * 0.5f + 1.0f) * -size;
g_Shards[g_NextShardNum].vertices[2].y = (random() * (1.0f / U32_MAX) * 0.5f + 1.0f) * -size;
g_Shards[g_NextShardNum].vertices[0].x = (RANDOMFRAC() * 0.5f + 1.0f) * size;
g_Shards[g_NextShardNum].vertices[0].y = (RANDOMFRAC() * 0.5f + 1.0f) * size;
g_Shards[g_NextShardNum].vertices[1].x = (RANDOMFRAC() * 0.5f + 1.0f) * size;
g_Shards[g_NextShardNum].vertices[1].y = (RANDOMFRAC() * 0.5f + 1.0f) * -size;
g_Shards[g_NextShardNum].vertices[2].x = (RANDOMFRAC() * 0.5f + 1.0f) * -size;
g_Shards[g_NextShardNum].vertices[2].y = (RANDOMFRAC() * 0.5f + 1.0f) * -size;
for (i = 0; i < 3; i++) {
g_Shards[g_NextShardNum].vertices[i].z = 0;
@ -192,11 +191,11 @@ void shardCreate(s16 room, struct coord *pos, f32 rotx, f32 size, s32 type)
g_Shards[g_NextShardNum].rot.x = rotx;
g_Shards[g_NextShardNum].rot.y = 0;
g_Shards[g_NextShardNum].rot.z = random() * (1.0f / U32_MAX) * M_BADTAU;
g_Shards[g_NextShardNum].rot.z = RANDOMFRAC() * M_BADTAU;
g_Shards[g_NextShardNum].rotspeed.x = random() * (1.0f / U32_MAX) * PALUPF(0.1f);
g_Shards[g_NextShardNum].rotspeed.y = random() * (1.0f / U32_MAX) * PALUPF(0.1f);
g_Shards[g_NextShardNum].rotspeed.z = random() * (1.0f / U32_MAX) * PALUPF(0.1f);
g_Shards[g_NextShardNum].rotspeed.x = RANDOMFRAC() * PALUPF(0.1f);
g_Shards[g_NextShardNum].rotspeed.y = RANDOMFRAC() * PALUPF(0.1f);
g_Shards[g_NextShardNum].rotspeed.z = RANDOMFRAC() * PALUPF(0.1f);
g_NextShardNum++;

View File

@ -1430,8 +1430,8 @@ u32 smokeTick(struct prop *prop)
part->alpha -= g_SmokeTypes[smoke->type].fgrotatespeed;
part->count++;
part->rot += part->deltarot;
part->offset1 += 0.02f + random() * (1.0f / U32_MAX) * 0.01f;
part->offset2 += 0.02f + random() * (1.0f / U32_MAX) * 0.01f;
part->offset1 += 0.02f + RANDOMFRAC() * 0.01f;
part->offset2 += 0.02f + RANDOMFRAC() * 0.01f;
if (part->alpha < 4.0f) {
part->size = 0.0f;
@ -1448,15 +1448,15 @@ u32 smokeTick(struct prop *prop)
for (j = 0; j < 10; j++) {
if (smoke->parts[j].size == 0.0f) {
if (g_SmokeTypes[smoke->type].size == 0) {
part->size = (random() * (1.0f / U32_MAX) * 0.5f + 1.0f) * 0.33f;
part->size = (RANDOMFRAC() * 0.5f + 1.0f) * 0.33f;
} else {
part->size = g_SmokeTypes[smoke->type].size * (random() * (1.0f / U32_MAX) * 0.5f + 1.0f);
part->size = g_SmokeTypes[smoke->type].size * (RANDOMFRAC() * 0.5f + 1.0f);
}
part->alpha = (random() % 70) + 110.0f;
part->count = 0;
part->rot = random() * (1.0f / U32_MAX) * M_BADTAU;
part->deltarot = (0.5f - random() * (1.0f / U32_MAX)) * g_SmokeTypes[smoke->type].bgrotatespeed;
part->rot = RANDOMFRAC() * M_BADTAU;
part->deltarot = (0.5f - RANDOMFRAC()) * g_SmokeTypes[smoke->type].bgrotatespeed;
if (smoke->type >= SMOKETYPE_MUZZLE_PISTOL && smoke->type <= SMOKETYPE_MUZZLE_REAPER) {
part->pos.x = g_Vars.currentplayer->hands[smoke->srcispadeffect].muzzlepos.x;
@ -1473,15 +1473,15 @@ u32 smokeTick(struct prop *prop)
}
if (smoke->type == SMOKETYPE_WATER) {
part->pos.x += random() * (1.0f / U32_MAX) * 70.0f - 35.0f;
part->pos.y += random() * (1.0f / U32_MAX) * 40.0f - 25.0f;
part->pos.z += random() * (1.0f / U32_MAX) * 40.0f - 20.0f;
part->pos.x += RANDOMFRAC() * 70.0f - 35.0f;
part->pos.y += RANDOMFRAC() * 40.0f - 25.0f;
part->pos.z += RANDOMFRAC() * 40.0f - 20.0f;
part->alpha *= 0.23f;
part->size *= random() * (1.0f / U32_MAX) + 1.0f;
part->size *= RANDOMFRAC() + 1.0f;
}
part->offset1 = random() * (1.0f / U32_MAX) * 0.5f;
part->offset2 = random() * (1.0f / U32_MAX) * 0.5f;
part->offset1 = RANDOMFRAC() * 0.5f;
part->offset2 = RANDOMFRAC() * 0.5f;
if (smoke->age > g_SmokeTypes[smoke->type].duration - g_SmokeTypes[smoke->type].numclouds) {
part->alpha *= (g_SmokeTypes[smoke->type].duration - smoke->age) / (f32)g_SmokeTypes[smoke->type].numclouds;

View File

@ -169,7 +169,7 @@ s32 splatsCreate(s32 qty, f32 arg1, struct prop *prop, struct splat *arg3, struc
for (i = 0; i < qty; i++) {
for (j = 0; j < 3; j++) {
f32 rand = random() * (1.0f / U32_MAX);
f32 rand = RANDOMFRAC();
spe4[j] = (rand * var8007f8a8 + rand * var8007f8a8 - var8007f8a8) * 0.017453292384744f;
}

View File

@ -684,15 +684,15 @@ glabel starsReset
// stars0f135c70();
//
// for (i = 0; i < g_StarCount; i++) {
// spd4.f[0] = 2.0f * (random() * (1.0f / U32_MAX)) - 1.0f;
// spd4.f[0] = 2.0f * RANDOMFRAC() - 1.0f;
//
// if (g_StarsBelowHorizon) {
// spd4.f[1] = 2.0f * (random() * (1.0f / U32_MAX)) - 1.0f;
// spd4.f[1] = 2.0f * RANDOMFRAC() - 1.0f;
// } else {
// spd4.f[1] = random() * (1.0f / U32_MAX);
// spd4.f[1] = RANDOMFRAC();
// }
//
// spd4.f[2] = 2.0f * (random() * (1.0f / U32_MAX)) - 1.0f;
// spd4.f[2] = 2.0f * RANDOMFRAC() - 1.0f;
//
// guNormalize(&spd4.f[0], &spd4.f[1], &spd4.f[2]);
//

View File

@ -1462,7 +1462,7 @@ glabel var7f1b5d18
void wallhitCreate(struct coord *arg0, struct coord *arg1, struct coord *arg2, u32 arg3, u32 arg4, s16 arg5, s16 room, struct prop *arg7, s8 arg8, s8 arg9, struct chrdata *chr, bool arg11)
{
f32 f0 = random() * (1.0f / U32_MAX) * 0.1f + 0.6f;
f32 f0 = RANDOMFRAC() * 0.1f + 0.6f;
f32 a = var8007f75c[arg5].unk00 * f0;
f32 b = var8007f75c[arg5].unk04 * f0;

View File

@ -115,15 +115,15 @@ struct weatherparticledata *weatherAllocateParticles(void)
for (i = 0; i != (s32)ARRAYCOUNT(g_WeatherData->particledata[0]->particles); i++) {
struct weatherparticle *particle = &data->particles[i];
particle->pos.x = random() * (1.0f / U32_MAX) * 1600 - 800;
particle->pos.y = random() * (1.0f / U32_MAX) * 1600 - 800;
particle->pos.z = random() * (1.0f / U32_MAX) * 1600 - 800;
particle->pos.x = RANDOMFRAC() * 1600 - 800;
particle->pos.y = RANDOMFRAC() * 1600 - 800;
particle->pos.z = RANDOMFRAC() * 1600 - 800;
particle->inc.x = random() * (1.0f / U32_MAX) * 10 - 5;
particle->inc.y = -10 - random() * (1.0f / U32_MAX) * 40;
particle->inc.z = random() * (1.0f / U32_MAX) * 10 - 5;
particle->inc.x = RANDOMFRAC() * 10 - 5;
particle->inc.y = -10 - RANDOMFRAC() * 40;
particle->inc.z = RANDOMFRAC() * 10 - 5;
particle->unk1c = random() * (1.0f / U32_MAX) + 0.7f;
particle->unk1c = RANDOMFRAC() + 0.7f;
particle->active = false;
}
@ -363,8 +363,8 @@ void weatherTickRain(struct weatherdata *weather)
weather->windspeedx = cosf(weather->windanglerad) * weather->windspeed;
weather->windspeedz = sinf(weather->windanglerad) * weather->windspeed;
lVar6 = 1;
} else if (random() * (1.0f / U32_MAX) > 0.99f) {
rand = random() * (1.0f / U32_MAX);
} else if (RANDOMFRAC() > 0.99f) {
rand = RANDOMFRAC();
weather->unk0c = (rand + rand) * M_PI;
weather->unk10 = (weather->unk0c - weather->windanglerad) / (PAL ? 0.012f : 0.01f);
@ -387,12 +387,12 @@ void weatherTickRain(struct weatherdata *weather)
lVar6 = 2;
// Reset particle
particle->pos.x = data->boundarymin.x + (random() * (1.0f / U32_MAX)) * (ABS(data->boundarymin.x) + ABS(data->boundarymax.x));
particle->pos.z = data->boundarymin.z + (random() * (1.0f / U32_MAX)) * (ABS(data->boundarymin.z) + ABS(data->boundarymax.z));
particle->pos.x = data->boundarymin.x + RANDOMFRAC() * (ABS(data->boundarymin.x) + ABS(data->boundarymax.x));
particle->pos.z = data->boundarymin.z + RANDOMFRAC() * (ABS(data->boundarymin.z) + ABS(data->boundarymax.z));
particle->unk1c = random() * (1.0f / U32_MAX) + 0.7f;
particle->unk1c = RANDOMFRAC() + 0.7f;
particle->inc.y = -(random() * (1.0f / U32_MAX) * g_RainSpeedExtra + weather->unkc8);
particle->inc.y = -(RANDOMFRAC() * g_RainSpeedExtra + weather->unkc8);
if (ABS(relativetotal) < 2 && weather->unkd0 != weather->unkd4) {
if (weather->unkd0 < weather->unkd4) {
@ -455,8 +455,8 @@ void weatherTickSnow(struct weatherdata *weather)
weather->windspeedx = cosf(weather->windanglerad) * weather->windspeed;
weather->windspeedz = sinf(weather->windanglerad) * weather->windspeed;
lVar7 = 1;
} else if (random() * (1.0f / U32_MAX) > 0.99f) {
rand = random() * (1.0f / U32_MAX);
} else if (RANDOMFRAC() > 0.99f) {
rand = RANDOMFRAC();
weather->unk0c = (rand + rand) * M_PI;
weather->unk10 = (weather->unk0c - weather->windanglerad) / (PAL ? 0.012f : 0.01f);
@ -566,12 +566,12 @@ void weatherTickSnow(struct weatherdata *weather)
if (particle->pos.y < data->boundarymin.y) {
lVar7 = 2;
particle->pos.x = data->boundarymin.f[0] + (random() * (1.0f / U32_MAX)) * (ABS(data->boundarymin.f[0]) + ABS(data->boundarymax.f[0]));
particle->pos.z = data->boundarymin.f[2] + (random() * (1.0f / U32_MAX)) * (ABS(data->boundarymin.f[2]) + ABS(data->boundarymax.f[2]));
particle->pos.x = data->boundarymin.f[0] + RANDOMFRAC() * (ABS(data->boundarymin.f[0]) + ABS(data->boundarymax.f[0]));
particle->pos.z = data->boundarymin.f[2] + RANDOMFRAC() * (ABS(data->boundarymin.f[2]) + ABS(data->boundarymax.f[2]));
particle->unk1c = random() * (1.0f / U32_MAX) + 0.7f;
particle->unk1c = RANDOMFRAC() + 0.7f;
particle->inc.y = -(g_SnowSpeed / 10.0f) - (random() * (1.0f / U32_MAX) * g_SnowSpeedExtra) / 10.0f;
particle->inc.y = -(g_SnowSpeed / 10.0f) - (RANDOMFRAC() * g_SnowSpeedExtra) / 10.0f;
particle->inc.x = weather->windspeedx * particle->unk1c;
particle->inc.z = weather->windspeedz * particle->unk1c;
@ -2684,7 +2684,7 @@ u32 var8007f0fc = 22000;
// var800a33a4 = 0;
//
// if (weather->unk94 < 0) {
// if (random() * (1.0f / U32_MAX) < weather->unkc4) {
// if (RANDOMFRAC() < weather->unkc4) {
// func0f131610(weather);
// }
// } else {
@ -2715,8 +2715,8 @@ u32 var8007f0fc = 22000;
// // 3574
// if (weather->unka4 == weather->unk94) {
// s1_2 = 0x80ba;
// sp174 = random() * (1.0f / U32_MAX) * 1.5f + 0.4f;
// frac = random() * (1.0f / U32_MAX);
// sp174 = RANDOMFRAC() * 1.5f + 0.4f;
// frac = RANDOMFRAC();
//
// if (frac);
//

View File

@ -34,6 +34,7 @@
#define MPCHR(index) ((index) < 4 ? &g_PlayerConfigsArray[index].base : &g_BotConfigsArray[(index) - 4].base)
#define PLAYERCOUNT() ((g_Vars.players[0] ? 1 : 0) + (g_Vars.players[1] ? 1 : 0) + (g_Vars.players[2] ? 1 : 0) + (g_Vars.players[3] ? 1 : 0))
#define PLAYERCOUNT3012() ((g_Vars.players[3] ? 1 : 0) + (g_Vars.players[0] ? 1 : 0) + (g_Vars.players[1] ? 1 : 0) + (g_Vars.players[2] ? 1 : 0))
#define RANDOMFRAC() (random() * (1.0f / U32_MAX))
#define SECSTOTIME240(secs) (secs * 240)
#define SECSTOTIME60(secs) (secs * 60)
#define PFS(device) (device == SAVEDEVICE_GAMEPAK ? NULL : &g_Pfses[device])