z_kankyo Decompiled (3 non-matching) (#1451)

* z_Kankyo progress

* build OK

* progress

* more progress

* Kankyo WIP

* Add docs

* func_800FEAF4

* more docs

* func_800FEAF4

* improve Init

* Small cleanup

* kankyo data

* data cleanup

* Environment_DrawLensFlare

* Match Environment_UpdateSkybox

* Match Environment_DrawRainImpl

* Start on Environment_UpdateLights

* Match Environment_DrawSandstorm

* gRainDropDL

* Some light renamings

* Fix merge

* cleanup

* improve non-equivalents

* cleanup

* PR Review

* match Environment_UpdatePostmanEvents

* PR Review

* small improvement to Environment_UpdatePostmanEvents from anon

* more cleanup

* void

* bits

* fix comment

* improve Environment_UpdateLights

* Skybox Stars Docs

* PR Review

* fix merge

* macros

* Add comments

* PR Review

* gRandFloat

* bug

---------

Co-authored-by: Rozelette <Uberpanzermensch@gmail.com>
Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
This commit is contained in:
engineer124
2023-10-31 14:50:11 +11:00
committed by GitHub
parent 0492c8e89a
commit 83ceaf3717
26 changed files with 2702 additions and 120 deletions
+9 -9
View File
@@ -5,7 +5,7 @@ static u32 sRandInt = 1;
//! Space to store a value to be re-interpreted as a float.
//! This can't be static because it is used in z_kankyo.
u32 sRandFloat;
u32 gRandFloat;
//! These values are recommended by the algorithms book *Numerical Recipes in C. The Art of Scientific Computing*, 2nd
//! Edition, 1992, ISBN 0-521-43108-5. (p. 284):
@@ -37,8 +37,8 @@ void Rand_Seed(u32 seed) {
*/
f32 Rand_ZeroOne(void) {
sRandInt = (sRandInt * RAND_MULTIPLIER) + RAND_INCREMENT;
sRandFloat = ((sRandInt >> 9) | 0x3F800000);
return *((f32*)&sRandFloat) - 1.0f;
gRandFloat = ((sRandInt >> 9) | 0x3F800000);
return *((f32*)&gRandFloat) - 1.0f;
}
/**
@@ -46,8 +46,8 @@ f32 Rand_ZeroOne(void) {
*/
f32 Rand_Centered(void) {
sRandInt = (sRandInt * RAND_MULTIPLIER) + RAND_INCREMENT;
sRandFloat = ((sRandInt >> 9) | 0x3F800000);
return *((f32*)&sRandFloat) - 1.5f;
gRandFloat = ((sRandInt >> 9) | 0x3F800000);
return *((f32*)&gRandFloat) - 1.5f;
}
//! All functions below are unused variants of the above four, that use a provided random number variable instead of the
@@ -79,8 +79,8 @@ u32 Rand_Next_Variable(u32* rndNum) {
f32 Rand_ZeroOne_Variable(u32* rndNum) {
u32 next = (*rndNum * RAND_MULTIPLIER) + RAND_INCREMENT;
sRandFloat = ((*rndNum = next) >> 9) | 0x3F800000;
return *((f32*)&sRandFloat) - 1.0f;
gRandFloat = ((*rndNum = next) >> 9) | 0x3F800000;
return *((f32*)&gRandFloat) - 1.0f;
}
/**
@@ -91,6 +91,6 @@ f32 Rand_ZeroOne_Variable(u32* rndNum) {
f32 Rand_Centered_Variable(u32* rndNum) {
u32 next = (*rndNum * RAND_MULTIPLIER) + RAND_INCREMENT;
sRandFloat = ((*rndNum = next) >> 9) | 0x3F800000;
return *((f32*)&sRandFloat) - 1.5f;
gRandFloat = ((*rndNum = next) >> 9) | 0x3F800000;
return *((f32*)&gRandFloat) - 1.5f;
}