rand_seed document

This commit is contained in:
Banjo Kazooie
2024-07-12 17:19:27 -05:00
parent 0578499295
commit 4712748d9f
15 changed files with 156 additions and 124 deletions

View File

@@ -892,7 +892,7 @@ void baMarker_update(void){
if ((D_8037BF88 != 0)){
temp_s0 = func_8024FEEC(func_8025ADD4(COMUSIC_30_5TH_JINJO_COLLECTED) & 0xFF);
if((func_80259B8C() < 4 && temp_s0 >= 0xBB9) || !func_8025AD7C(COMUSIC_30_5TH_JINJO_COLLECTED)){
if((comusic_active_track_count() < 4 && temp_s0 >= 0xBB9) || !func_8025AD7C(COMUSIC_30_5TH_JINJO_COLLECTED)){
func_8028F918(0);
D_8037BF88 = 0;
}

View File

@@ -50,7 +50,7 @@ typedef struct{
extern void item_set(enum item_e, s32);
extern void actor_postdrawMethod(ActorMarker *);
extern void func_8024CE60(f32, f32);
extern void viewport_set_near_far(f32, f32);
Actor *chBottlesBonus_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx);
void chBottlesBonus_update(Actor *this);
@@ -123,7 +123,7 @@ void chBottlesBonus_func_802DD080(Gfx **gfx, Mtx **mtx) {
f32 vp_rotation[3];
func_8024E258();
func_8024CE60(50.0f, 2000.0f);
viewport_set_near_far(50.0f, 2000.0f);
if (getGameMode() == GAME_MODE_A_SNS_PICTURE) {
vp_rotation[0] = 0.0f;
vp_rotation[1] = 0.0f;

View File

@@ -7,7 +7,7 @@
extern void func_8024C510(f32);
extern void viewport_set_position_f3(f32, f32, f32);
extern void viewport_set_rotation_f3(f32, f32, f32);
extern void func_8024CE60(f32, f32);
extern void viewport_set_near_far(f32, f32);
extern void func_802F5374(void);
extern void func_802FA0F8(void);
extern void timedFuncQueue_update(void);
@@ -285,7 +285,7 @@ s32 func_802E3F80(void){
//game_draw
void func_802E3F8C(s32 arg0){
Gfx *sp34;
Gfx *sp30;
Gfx *gfx_start;
Gfx *sp2C;
Mtx *sp28;
Vtx *sp24;
@@ -297,12 +297,12 @@ void func_802E3F8C(s32 arg0){
if(D_8037E8E0.unkC == 1){
func_80254404(&sp34, &sp28, &sp24);
}
sp30 = sp34;
gfx_start = sp34;
func_802E39D0(&sp34, &sp28, &sp24, func_8024BDA0(), arg0);
if(D_8037E8E0.unkC == 0){
sp2C = sp34;
func_8024C1DC();
func_80253EC4(sp30, sp2C);
func_80253EC4(gfx_start, sp2C);
if(arg0){
func_80254348();
}
@@ -396,9 +396,9 @@ void func_802E4214(enum map_e map_id){
modelRender_init();
func_80253428(1);
animCache_init();
func_8024CCC4();
func_8024CE60(1.0f, 10000.0f);
func_8034A6B4();
viewport_reset();
viewport_set_near_far(1.0f, 10000.0f);
rand_reset();
func_80254348();
func_80253FE8();
func_8033DC70();
@@ -434,8 +434,8 @@ bool func_802E4424(void) {
s32 sp1C;
u8 temp_v0;
func_8024CC00();
func_8034A85C();
viewport_debug();
rand_shuffle();
if (!gctransition_8030BDC0()) {
temp_v0 = D_8037E8E0.transition;
D_8037E8E0.transition = TRANSITION_0_NONE;

View File

@@ -19,7 +19,7 @@ u32 D_803835E0;
/* public */
void func_80335110(s32);
void func_80335128(s32);
void func_8024CE60(f32, f32);
void viewport_set_near_far(f32, f32);
void func_80335140(enum map_e);
void func_8033520C(s32);
@@ -31,7 +31,7 @@ void func_80334540(Gfx** gdl, Mtx **mptr, Vtx **vptr) {
if (D_803835E0 == 0) {
func_80254084(gdl, 0, 0, framebuffer_width, framebuffer_height, 0, 0, 0);
func_802BBD2C(&sp44, &sp40);
func_8024CE60(sp44, sp40);
viewport_set_near_far(sp44, sp40);
func_8024C904(gdl, mptr);
return;
}
@@ -41,7 +41,7 @@ void func_80334540(Gfx** gdl, Mtx **mptr, Vtx **vptr) {
spawnQueue_unlock();
sky_draw(gdl, mptr, vptr);
func_802BBD2C(&sp44, &sp40);
func_8024CE60(sp44, sp40);
viewport_set_near_far(sp44, sp40);
func_8024C904(gdl, mptr);
if (mapModel_has_xlu_bin() != 0) {
mapModel_opa_draw(gdl, mptr, vptr);

View File

@@ -79,7 +79,7 @@ void func_80349FB0(DemoInput *input_ptr, u32 size, int arg2){
func_8030AFA0(map_get());
func_803204E4(0xc4, 1);
func_8024F224();
func_8034A6B4();
rand_reset();
func_8023DB68();
}//*/

View File

@@ -2,7 +2,7 @@
#include "functions.h"
#include "variables.h"
extern void func_8024CE60(f32, f32);
extern void viewport_set_near_far(f32, f32);
typedef struct {
s16 model_id;
@@ -74,7 +74,7 @@ void sky_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){
f32 rotation[3];
BKModelBin *iAsset;
func_8024CE60(5.0f, 15000.0f);
viewport_set_near_far(5.0f, 15000.0f);
if(gcSky.model_bins[0]){
func_80254084(gfx, 0, 0, (s32)(f32) framebuffer_width, (s32)(f32)framebuffer_height,0, 0, 0); //fill screen with black
func_8024C904(gfx, mtx);

View File

@@ -7,7 +7,7 @@
void animctrl_setAnimTimer(AnimCtrl*, f32);
void func_8025AC20(s32, s32, s32, f32, char*, s32);
f32 func_80257618(void);
void func_8024CE60(f32, f32);
void viewport_set_near_far(f32, f32);
typedef enum {
TRANSITION_ID_1_BLACK_IN = 1,
@@ -265,7 +265,7 @@ void gctransition_draw(Gfx **gdl, Mtx **mptr, Vtx **vptr){
vp_rotation[0] = 0.0f;
vp_rotation[1] = 0.0f;
vp_rotation[2] = 0.0f;
func_8024CE60(D_8036C440, D_8036C444);
viewport_set_near_far(D_8036C440, D_8036C444);
viewport_set_position_vec3f(vp_position); //viewport_get_position_vec3f
viewport_set_rotation_vec3f(vp_rotation); //viewport_get_rotation_vec3f
viewport_update(); //camera_updateNormal

View File

@@ -616,7 +616,7 @@ void func_8031594C(gczoombox_t * this, u8 *str, s32 arg2, s32 arg3){
f22 = (this->portrait_id == TALK_PIC_5F_TOOTY_4) ? 0.4 : 0.8;
if(getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE){
func_8034A900();
sfx_rand_sync_to_rand();
}
for(s2 = arg2; s2 <= arg3; s2++){
if(s1){
@@ -669,7 +669,7 @@ void func_8031594C(gczoombox_t * this, u8 *str, s32 arg2, s32 arg3){
this->unk189 = s1;
this->unk187 = 0;
if(getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE){
func_8034A964();
rand_sync_to_sfx_rand();
}
}
@@ -991,7 +991,7 @@ void gczoombox_draw(gczoombox_t *this, Gfx **gdl, Mtx ** mptr, void *vptr){
return;
if(getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE)
func_8034A900();
sfx_rand_sync_to_rand();
//L80316BCC
if(this->unk1A4_28 && this->state && this->model){
func_803162B4(this);
@@ -1027,7 +1027,7 @@ void gczoombox_draw(gczoombox_t *this, Gfx **gdl, Mtx ** mptr, void *vptr){
}
}//L80316DD8
if(getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE){
func_8034A964();
rand_sync_to_sfx_rand();
}

View File

@@ -17,6 +17,9 @@ s32 D_80386108;
s32 D_8038610C;
/* .code */
/**
* returns a random float in the range of [0.0, 1.0)
*/
f32 randf(void){
f32 out;
if(D_803860E4 & 3){
@@ -38,7 +41,10 @@ f32 randf(void){
return out;
}
//only used in some sfx instances;
/**
* returns a random float in the range of [0.0, 1.0).
* Is only used in some sfx instances.
*/
f32 sfx_rand(void){
f32 out;
if(D_803860F0 & 3){
@@ -67,7 +73,10 @@ f32 func_8034A668(void){
return out;
}
void func_8034A6B4(void){
/**
* @brief resets all random functions to their default seed
*/
void rand_reset(void){
D_803860E0 = 0x86D;
D_803860E4 = 0x2c060731;
D_803860E8 = 0x19f0458b;
@@ -97,7 +106,10 @@ s32 sfx_randi2(s32 min, s32 max){
return min + sfx_rand()*(max - min);
}
void func_8034A85C(void){
/**
* @brief calls randf() between 2 to 5 times
*/
void rand_shuffle(void){
int i;
int start = randf()*3.0f;
for(i = 2 + start; i != 0; i--){
@@ -105,14 +117,21 @@ void func_8034A85C(void){
}
}
void func_8034A8BC(s32 arg0){
func_8034A6B4();
for(arg0; arg0 > 0; arg0--){
/**
* @brief seeds rand methods.
*/
void rand_seed(s32 seed){
rand_reset();
for(seed; seed > 0; seed--){
randf();
}
}
void func_8034A900(void){
/**
* @brief syncronizes the internal values of sfx specific rand to those of rand.
*
*/
void sfx_rand_sync_to_rand(void){
D_803860F8 = D_803860E0;
D_803860FC = D_803860E4;
D_80386100 = D_803860E8;
@@ -121,7 +140,11 @@ void func_8034A900(void){
D_8038610C = D_803860F4;
}
void func_8034A964(void){
/**
* @brief syncronizes the internal values of rand to those of sfx specific rand.
*
*/
void rand_sync_to_sfx_rand(void){
D_803860E0 = D_803860F8;
D_803860E4 = D_803860FC;
D_803860E8 = D_80386100;