code_B6CE0.c => time.c

This commit is contained in:
Banjo Kazooie
2024-11-03 13:03:26 -06:00
parent dcdc2ff9d3
commit 23b8510eb4
21 changed files with 110 additions and 97 deletions

View File

@@ -98,7 +98,7 @@ static bool __chClam_rotateTowardTarget(Actor *this, s32 arg1) {
anctrl_setDuration(this->anctrl, 1.0f);
sp2C = (s32) ((f64) (60.0f / (f32) func_8033DD90()) * 0.5);
sp2C = (s32) ((f64) (60.0f / (f32) time_getDeltaReal_frames()) * 0.5);
if ((this->unk1C[0] != 0.0f) || !__chClam_updateFuncTarget(this, sp2C)) {
if (((f64) anctrl_getAnimTimer(this->anctrl) < 0.1) && ((f64) randf() < 0.5)) {
if (this->unk1C[0] != 0.0f) {

View File

@@ -176,9 +176,9 @@ void pfsManager_update(void) {
volatileFlag_set(VOLATILE_FLAG_63, 1);
}
}
func_8033DD04(sp5C);
time_setDeltaReal_frames(sp5C);
}
sp5C = func_8033DD90();
sp5C = time_getDeltaReal_frames();
randf();
for (i = 0; i < 4; i++) {
if ((pfsManagerContPadData[i].button & 0x20) && (pfsManagerContPadData[i].button & 0x10)) {

View File

@@ -8,7 +8,7 @@ extern void chBottlesBonusCursor_func_802DF99C(void);
extern f32 *chBottlesBonusCursor_func_802E05AC(s32);
extern f32 func_802E4B38(void);
extern void func_8033A8F0(s32, s32, f32[4]);
extern f32 func_8033DDB8(void);
extern f32 time_func_8033DDB8(void);
BKAnimationList *model_getAnimationList(BKModelBin *arg0);
extern void func_8034BB08(s32);
extern void func_803458E4(f32[4], f32[4], f32[4], f32);
@@ -288,7 +288,7 @@ void chBottlesBonus_func_802DD8AC(BoneTransformList *arg0, s32 arg1) {
actor = marker_getActor(chBottlesBonusMarker);
spD4 = func_802E4B38();
spD0 = func_8033DDB8();
spD0 = time_func_8033DDB8();
if (D_8037DEB0 == 0) {
D_8037DEB0 = 1;
for(i = 0; i < CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT; i++){
@@ -452,7 +452,7 @@ void chBottlesBonus_update(Actor *this) {
s32 phi_s0_2;
local = (ActorLocal_core2_560F0 *) &this->local;
sp50 = func_8033DDB8();
sp50 = time_func_8033DDB8();
if (!this->volatile_initialized) {
this->volatile_initialized = TRUE;
actor_collisionOff(this);

View File

@@ -3,6 +3,7 @@
#include "functions.h"
#include "variables.h"
#include "time.h"
#ifndef ABS
#define ABS(d) ((d) >= 0) ? (d) : -(d)
@@ -13,7 +14,6 @@ extern u8 D_8037DCC8; //bottles bonus flags???
extern void func_8025AABC(enum comusic_e);
extern f32 func_8024E420(s32, s32, s32);
extern f32 func_8033DDB8(void);
extern void chBottlesBonus_func_802DEA50(s32);
extern void actor_postdrawMethod(ActorMarker *);
extern void chBottlesBonus_completedPuzzle(void);
@@ -209,7 +209,7 @@ void chBottlesBonusCursor_update(Actor *this) {
s32 sp44;
sp5C = func_8024F3F4();
sp58 = func_8033DDB8();
sp58 = time_func_8033DDB8();
held_piece = &D_8037E248[D_8037E5C0.unk0];
if (!this->initialized) {
this->initialized = TRUE;

View File

@@ -3,13 +3,14 @@
#include "functions.h"
#include "variables.h"
#include "time.h"
extern void func_8023DFF0(s32);
extern void comusicPlayer_update(void);
extern void func_802F1A10(void *, f32);
extern void func_8033DC10(void);
extern void func_8033DC18(void);
extern f32 func_8033DC20(void);
extern void func_8033DC9C(f32);
/* .bss */
struct {
@@ -115,10 +116,10 @@ void func_802E35D8(void ) {
s32 sp38;
if (D_8037E8C0.unk18 == 0.0f) {
func_8033DC9C(0.0f);
time_setDeltaReal_sec(0.0f);
} else {
func_8033DC18();
func_8033DC9C(func_8033DC20());
time_setDeltaReal_sec(func_8033DC20());
}
func_8033DC10();
D_8037E8C0.unk18 += time_getDelta();

View File

@@ -4,6 +4,7 @@
#include "variables.h"
#include "gc/gctransition.h"
#include "time.h"
extern void func_802F5374(void);
extern void func_802FA0F8(void);
@@ -30,7 +31,6 @@ void func_802E40E8(s32 transition);
int func_802E4A08(void);
f32 func_8033DC20(void);
void func_8033DC9C(f32);
extern void func_80324C58(void);
/* .data */
@@ -402,13 +402,13 @@ void func_802E4214(enum map_e map_id){
rand_reset();
scissorBox_setDefault();
func_80253FE8();
func_8033DC70();
time_reset();
func_8033DC04();
func_8031FBA0();
D_8037E8E0.game_mode = GAME_MODE_2_UNKNOWN;
D_8037E8E0.unk8 = 0.0f;
func_8033DC9C(0.0f);
func_8033DD04(0);
time_setDeltaReal_sec(0.0f);
time_setDeltaReal_frames(0);
func_803216D0(map_id);
func_8030AFA0(map_id);
func_802E3854();
@@ -419,12 +419,12 @@ void func_802E4214(enum map_e map_id){
void func_802E4384(void){
if(D_8037E8E0.unk8 == 0.0f){
func_8033DC9C(0.0f);
time_setDeltaReal_sec(0.0f);
}
else{
func_8033DC18();
;
func_8033DD04((s32)(func_8033DC20()*60.0f + 0.5));
time_setDeltaReal_frames((s32)(func_8033DC20()*60.0f + 0.5));
}
func_8033DC10();

View File

@@ -2,6 +2,8 @@
#include "functions.h"
#include "variables.h"
#include "time.h"
#define _73640_MAX(s,t) ((s < t)? t: s)
#define _73640_MIN(s,t) ((s > t)? t: s)
@@ -16,11 +18,6 @@ typedef struct item_print_s{
s32 func_802FAD9C(enum item_e item_id);
f32 time_getDelta(void);
f32 time_getDelta(void);
/* .data */
s16 D_803692E0[6] = {

View File

@@ -1,51 +0,0 @@
#include <ultra64.h>
#include "functions.h"
#include "variables.h"
/*.data*/
f32 D_80371E20 = 1.0f;
/* .bss */
f32 D_80384480;
s32 D_80384484;
/* .code */
void func_8033DC70(void){
D_80384480 = 0.01f;
D_80371E20 = 1.0f;
D_80384484 = 0;
}
void func_8033DC9C(f32 arg0){
if(arg0 != 0.0f){
D_80384480 = MIN(arg0, 0.05);
}
else{
D_80384480 = 0.01f;
}
}
void func_8033DD04(s32 arg0){
D_80384484 = MAX(MIN(0xf, arg0) , 1);
func_8033DC9C(D_80384484*(1/60.0));
}
s32 func_8033DD90(void){
return D_80384484;
}
f32 time_getDelta(void){
return D_80384480*D_80371E20;
}
f32 func_8033DDB8(void){
return viMgr_func_8024BD94()*(1/60.0);
}
f32 func_8033DDEC(void){
return time_getDelta()*30.0;
}
void func_8033DE20(f32 arg0){
D_80371E20 = arg0;
}

View File

@@ -3,8 +3,8 @@
#include "functions.h"
#include "variables.h"
#include "time.h"
f32 time_getDelta(void);
void func_80346DB4(s32);
s32 item_adjustByDiffWithHud(enum item_e item, s32 diff);

View File

@@ -6,7 +6,7 @@
#include "core2/anim/sprite.h"
#include "code_B6EA0.h"
extern f32 func_8033DDEC(void);
extern f32 time_getDelta_frames(void);
extern u8 func_8033E8D0(void);
extern void func_8033FFE4(u8, s32, s32);
extern void func_8033FC34(u8, s32);
@@ -111,7 +111,7 @@ void func_80352F58(void){
f32 *sp2C = func_8033E960();
AnimSprite *sp28 = func_8033E8F4();
u8 sp27 = func_8033E8D0();
f32 sp20 = func_8033DDEC();
f32 sp20 = time_getDelta_frames();
if(animsprite_is_stopped(sp28)){
func_8033E984();
}

View File

@@ -3,8 +3,8 @@
#include "functions.h"
#include "variables.h"
#include "time.h"
f32 time_getDelta(void);
f32 func_802FB0DC(struct8s *);
f32 func_802FB0E4(struct8s *);

View File

@@ -3,11 +3,11 @@
#include "functions.h"
#include "variables.h"
#include "time.h"
#define _76D90_MAX(s,t) ((s < t)? t : s)
#define _76D90_MIN(s,t) ((s > t)? t : s)
f32 time_getDelta(void);
f32 func_802FDE60(f32);
void timedFunc_set_1(f32, void (*)(s32), s32);
void timedFunc_set_2(f32, void (*)(s32,s32), s32, s32);

View File

@@ -5,8 +5,8 @@
#include "variables.h"
#include "zoombox.h"
#include "time.h"
extern f32 func_8033DDB8(void);
extern void func_80344090(BKSpriteDisplayData *self, s32 frame, Gfx **gfx);
BKSprite *func_8033B6C4(enum asset_e sprite_id, BKSpriteDisplayData **arg1);
@@ -883,7 +883,7 @@ void func_80316764(GcZoombox *this, s32 arg1) {
} else {
pfsManager_getFirstControllerFaceButtonState(0, sp38);
func_8024E640(0, sp2C);
phi_f0 = func_8033DDB8();
phi_f0 = time_func_8033DDB8();
}
if (this->unkFC == NULL)
@@ -1058,7 +1058,7 @@ void gczoombox_update(GcZoombox *this){
s32 sp48;
f32 sp44;
f32 tmp_f0;
sp48 = func_8033DD90();
sp48 = time_getDeltaReal_frames();
if(this == NULL)
return;
@@ -1070,7 +1070,7 @@ void gczoombox_update(GcZoombox *this){
else{
pfsManager_getFirstControllerFaceButtonState(0, sp58);
func_8024E640(0, sp4C);
tmp_f0 = func_8033DDB8();
tmp_f0 = time_func_8033DDB8();
}
switch(this->state){

View File

@@ -598,7 +598,7 @@ void func_802BD780(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3, f32 arg4, f32 a
s32 temp_s1;
s32 i;
temp_s1 = func_8033DD90() * 5;
temp_s1 = time_getDeltaReal_frames() * 5;
for(i = 0; i < temp_s1; i++){
func_802BD610(arg0, arg1, arg2, arg3, arg4, arg5);
}
@@ -758,7 +758,7 @@ void func_802BDE88(f32 *arg0, f32 *arg1, f32 arg2, f32 arg3, f32 arg4) {
s32 end;
s32 i;
end = func_8033DD90()*5;
end = time_getDeltaReal_frames()*5;
for(i = 0; i < end; i++){
temp_f14 = arg2 - *arg1;
temp_f2 = temp_f14*arg3 - *arg0;
@@ -823,7 +823,7 @@ void func_802BE190(f32 arg0[3]){
return;
}
end = func_8033DD90()*5;
end = time_getDeltaReal_frames()*5;
ncDynamicCamera_getPosition(sp34);
for(i = 0; i < end; i++){
func_802BDF5C(arg0, sp34);

View File

@@ -1,5 +1,5 @@
#include "core2/statetimer.h"
extern f32 time_getDelta(void);
#include "time.h"
typedef struct{
f32 now;

51
src/core2/time.c Normal file
View File

@@ -0,0 +1,51 @@
#include "time.h"
#include "core1/vimgr.h"
/*.data*/
static f32 s_timeMultiplier = 1.0f;
/* .bss */
static f32 s_dTimeReal_sec;
static s32 s_dTimeReal_frames;
/* .code */
void time_reset(void){
s_dTimeReal_sec = 0.01f;
s_timeMultiplier = 1.0f;
s_dTimeReal_frames = 0;
}
void time_setDeltaReal_sec(f32 d_seconds){
if(d_seconds != 0.0f){
s_dTimeReal_sec = MIN(d_seconds, 0.05);
}
else{
s_dTimeReal_sec = 0.01f;
}
}
void time_setDeltaReal_frames(s32 d_frames){
s_dTimeReal_frames = MAX(MIN(0xf, d_frames) , 1);
time_setDeltaReal_sec(s_dTimeReal_frames*(1/60.0));
}
s32 time_getDeltaReal_frames(void){
return s_dTimeReal_frames;
}
f32 time_getDelta(void){
return s_dTimeReal_sec*s_timeMultiplier;
}
f32 time_func_8033DDB8(void){
return viMgr_func_8024BD94()*(1/60.0);
}
f32 time_getDelta_frames(void){
return time_getDelta()*30.0;
}
void time_setMultiplier(f32 multiplier){
s_timeMultiplier = multiplier;
}