mirror of
https://github.com/blawar/ooot.git
synced 2024-06-25 22:09:34 +00:00
more framerate stuff
This commit is contained in:
parent
48a5ad5bfa
commit
be5d6d9f85
|
@ -21,6 +21,7 @@ s32 Math_ScaledStepToS(Rotation* pValue, s16 target, const Step& step);
|
|||
f32 Math_SinS(s16 angle);
|
||||
f32 Math_SmoothStepToDegF(f32* pValue, f32 target, f32 fraction, const Step& step, const Step& minStep);
|
||||
f32 Math_SmoothStepToF(f32* pValue, f32 target, f32 fraction, const Step& step, const Step& minStep);
|
||||
f32 Math_SmoothStepToF(Rotation* pValue, f32 target, f32 fraction, const Step& step, const Step& minStep);
|
||||
s16 Math_SmoothStepToS(s16* pValue, s16 target, s16 scale, const Step& step, const Step& minStep);
|
||||
s16 Math_SmoothStepToS(Rotation* pValue, s16 target, s16 scale, const Step& step, const Step& minStep);
|
||||
s32 Math_StepToAngleS(s16* pValue, s16 target, const Step& step);
|
||||
|
|
|
@ -314,7 +314,8 @@ Step::Step(const Step& t)
|
|||
|
||||
Step::Step(float n)
|
||||
{
|
||||
m_value = n; // * FRAMERATE_SCALER;
|
||||
//m_value = n; // * FRAMERATE_SCALER;
|
||||
m_value = n * FRAMERATE_SCALER;
|
||||
}
|
||||
|
||||
Step::Step(const Rotation& r)
|
||||
|
|
|
@ -576,7 +576,7 @@ void func_8001DFC8(EnItem00* pthis, GlobalContext* globalCtx)
|
|||
{
|
||||
if((pthis->actor.params <= ITEM00_RUPEE_RED) || ((pthis->actor.params == ITEM00_HEART) && (pthis->unk_15A < 0)) || (pthis->actor.params == ITEM00_HEART_PIECE))
|
||||
{
|
||||
pthis->actor.shape.rot.y += 960 * FRAMERATE_SCALER;
|
||||
pthis->actor.shape.rot.y += 960;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -395,13 +395,13 @@ s32 Math_AsymStepToF(f32* pValue, f32 target, const Step& incrStep, const Step&
|
|||
return 0;
|
||||
}
|
||||
|
||||
void func_80077D10(f32* arg0, s16* arg1, Input* input)
|
||||
void func_80077D10(f32* magnitude, s16* arg1, Input* input)
|
||||
{
|
||||
f32 relX = input->rel.stick_x;
|
||||
f32 relY = input->rel.stick_y;
|
||||
|
||||
*arg0 = sqrtf(SQ(relX) + SQ(relY));
|
||||
*arg0 = (60.0f < *arg0) ? 60.0f : *arg0;
|
||||
*magnitude = sqrtf(SQ(relX) + SQ(relY));
|
||||
*magnitude = (60.0f < *magnitude) ? 60.0f : *magnitude;
|
||||
|
||||
*arg1 = Math_Atan2S(relY, -relX);
|
||||
}
|
||||
|
@ -603,7 +603,8 @@ void IChain_Apply_Vec3s(u8* ptr, InitChainEntry* ichain)
|
|||
* Changes pValue by step towards target. If this step is more than fraction of the remaining distance, step by that
|
||||
* instead, with a minimum step of minStep. Returns remaining distance to target.
|
||||
*/
|
||||
f32 Math_SmoothStepToF(f32* pValue, f32 target, f32 fraction, const Step& _step, const Step& _minStep)
|
||||
template<class T>
|
||||
static inline f32 _Math_SmoothStepToF(T* pValue, f32 target, f32 fraction, const Step& _step, const Step& _minStep)
|
||||
{
|
||||
float step = _step.value();
|
||||
float minStep = _minStep.value();
|
||||
|
@ -652,6 +653,16 @@ f32 Math_SmoothStepToF(f32* pValue, f32 target, f32 fraction, const Step& _step,
|
|||
return fabsf(target - *pValue);
|
||||
}
|
||||
|
||||
f32 Math_SmoothStepToF(f32* pValue, f32 target, f32 fraction, const Step& _step, const Step& _minStep)
|
||||
{
|
||||
return _Math_SmoothStepToF(pValue, target, fraction, _step, _minStep);
|
||||
}
|
||||
|
||||
f32 Math_SmoothStepToF(Rotation* pValue, f32 target, f32 fraction, const Step& _step, const Step& _minStep)
|
||||
{
|
||||
return _Math_SmoothStepToF(pValue, target, fraction, _step, _minStep);
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes pValue by step towards target. If step is more than fraction of the remaining distance, step by that instead.
|
||||
*/
|
||||
|
|
|
@ -858,7 +858,7 @@ void ObjectKankyo_DrawLightning(ObjectKankyo* pthis, GlobalContext* globalCtx)
|
|||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 128);
|
||||
gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 255, 128);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 1213), G_MTX_LOAD);
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEffLightningTextures[pthis->effects[0].timer]));
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEffLightningTextures[pthis->effects[0].timer.whole()]));
|
||||
func_80094C50(globalCtx->state.gfxCtx);
|
||||
gSPMatrix(POLY_XLU_DISP++, SEGMENT_ADDRESS(0x01000000), G_MTX_MODELVIEW | G_MTX_NOPUSH | G_MTX_MUL);
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
|
@ -973,7 +973,7 @@ void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* pthis2, GlobalContext* globalC
|
|||
Matrix_Mult(&globalCtx->billboardMtxF, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 1416), G_MTX_LOAD);
|
||||
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80BA5900[pthis->effects[0].timer]));
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80BA5900[pthis->effects[0].timer.whole()]));
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
|
||||
gSPDisplayList(POLY_XLU_DISP++, object_spot02_objects_DL_009620);
|
||||
|
|
|
@ -11,20 +11,20 @@ typedef void (*ObjectKankyoActionFunc)(struct ObjectKankyo*, GlobalContext*);
|
|||
struct ObjectKankyoEffect
|
||||
{
|
||||
/* 0x00 */ u8 state;
|
||||
/* 0x04 */ Vec3f pos; // relative to base
|
||||
/* 0x04 */ VecPos pos; // relative to base
|
||||
/* 0x10 */ Vec3f prevPos;
|
||||
/* 0x1C */ Vec3f base;
|
||||
/* 0x28 */ Vec3f dirPhase; // input to sin/cos for movement direction
|
||||
/* 0x34 */ f32 speed;
|
||||
/* 0x38 */ f32 targetSpeed;
|
||||
/* 0x3C */ u16 alphaTimer;
|
||||
/* 0x3C */ Timer alphaTimer;
|
||||
/* 0x3E */ u16 angle;
|
||||
/* 0x40 */ u8 alpha;
|
||||
/* 0x44 */ f32 size;
|
||||
/* 0x48 */ u16 angleVel;
|
||||
/* 0x4A */ u16 flightRadius;
|
||||
/* 0x4C */ f32 amplitude;
|
||||
/* 0x50 */ u16 timer;
|
||||
/* 0x50 */ Timer timer;
|
||||
};
|
||||
|
||||
struct ObjectKankyo
|
||||
|
|
|
@ -436,12 +436,12 @@ static const PlayerAgeProperties sAgeProperties[] = {
|
|||
};
|
||||
|
||||
static u32 D_808535D0 = false;
|
||||
static f32 D_808535D4 = 0.0f;
|
||||
static f32 gJoystickMagnitude = 0.0f;
|
||||
static s16 D_808535D8 = 0;
|
||||
static s16 D_808535DC = 0;
|
||||
static s16 gInputCameraYaw = 0;
|
||||
static s32 D_808535E0 = 0;
|
||||
static s32 D_808535E4 = 0;
|
||||
static f32 D_808535E8 = 1.0f;
|
||||
static f32 gMovementScaler = 1.0f;
|
||||
static f32 D_808535EC = 1.0f;
|
||||
static u32 D_808535F0 = 0;
|
||||
static u32 D_808535F4 = 0;
|
||||
|
@ -1220,7 +1220,7 @@ s32 func_80832594(Player* pthis, s32 arg1, s32 arg2)
|
|||
{
|
||||
s16 temp = pthis->unk_A80 - D_808535D8;
|
||||
|
||||
pthis->unk_850 += arg1 + (s16)(ABS(temp) * fabsf(D_808535D4) * 2.5415802156203426e-06f);
|
||||
pthis->unk_850 += arg1 + (s16)(ABS(temp) * fabsf(gJoystickMagnitude) * 2.5415802156203426e-06f);
|
||||
|
||||
if(CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B))
|
||||
{
|
||||
|
@ -1578,16 +1578,16 @@ void func_8083315C(GlobalContext* globalCtx, Player* pthis)
|
|||
s8 phi_v1;
|
||||
s8 phi_v0;
|
||||
|
||||
pthis->unk_A7C = D_808535D4;
|
||||
pthis->unk_A7C = gJoystickMagnitude;
|
||||
pthis->unk_A80 = D_808535D8;
|
||||
|
||||
func_80077D10(&D_808535D4, &D_808535D8, sControlInput);
|
||||
func_80077D10(&gJoystickMagnitude, &D_808535D8, sControlInput);
|
||||
|
||||
D_808535DC = Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)) + D_808535D8;
|
||||
gInputCameraYaw = Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)) + D_808535D8;
|
||||
|
||||
pthis->unk_846 = (pthis->unk_846 + 1) % 4;
|
||||
|
||||
if(D_808535D4 < 55.0f)
|
||||
if(gJoystickMagnitude < 55.0f)
|
||||
{
|
||||
phi_v0 = -1;
|
||||
phi_v1 = -1;
|
||||
|
@ -1595,7 +1595,7 @@ void func_8083315C(GlobalContext* globalCtx, Player* pthis)
|
|||
else
|
||||
{
|
||||
phi_v1 = (u16)(D_808535D8 + 0x2000) >> 9;
|
||||
phi_v0 = (u16)((s16)(D_808535DC - pthis->actor.shape.rot.y) + 0x2000) >> 14;
|
||||
phi_v0 = (u16)((s16)(gInputCameraYaw - pthis->actor.shape.rot.y) + 0x2000) >> 14;
|
||||
}
|
||||
|
||||
pthis->unk_847[pthis->unk_846] = phi_v1;
|
||||
|
@ -1604,7 +1604,7 @@ void func_8083315C(GlobalContext* globalCtx, Player* pthis)
|
|||
|
||||
void func_8083328C(GlobalContext* globalCtx, Player* pthis, LinkAnimationHeader* linkAnim)
|
||||
{
|
||||
LinkAnimation_PlayOnceSetSpeed(globalCtx, &pthis->skelAnime, linkAnim, D_808535E8);
|
||||
LinkAnimation_PlayOnceSetSpeed(globalCtx, &pthis->skelAnime, linkAnim, gMovementScaler);
|
||||
}
|
||||
|
||||
s32 Player_IsSwimmingWithoutIronBoots(Player* pthis)
|
||||
|
@ -3591,7 +3591,7 @@ s32 func_80836FAC(GlobalContext* globalCtx, Player* pthis, f32* arg2, s16* arg3,
|
|||
}
|
||||
else
|
||||
{
|
||||
*arg2 = D_808535D4;
|
||||
*arg2 = gJoystickMagnitude;
|
||||
*arg3 = D_808535D8;
|
||||
|
||||
if(arg4 != 0.0f)
|
||||
|
@ -3612,7 +3612,7 @@ s32 func_80836FAC(GlobalContext* globalCtx, Player* pthis, f32* arg2, s16* arg3,
|
|||
*arg2 *= 0.8f;
|
||||
}
|
||||
|
||||
if(D_808535D4 != 0.0f)
|
||||
if(gJoystickMagnitude != 0.0f)
|
||||
{
|
||||
temp_f0 = Math_SinS(pthis->unk_898);
|
||||
temp_f12 = pthis->unk_880;
|
||||
|
@ -4457,7 +4457,7 @@ void func_80838940(Player* pthis, LinkAnimationHeader* anim, f32 arg2, GlobalCon
|
|||
func_808322D0(globalCtx, pthis, anim);
|
||||
}
|
||||
|
||||
pthis->actor.velocity.y = arg2 * D_808535E8;
|
||||
pthis->actor.velocity.y = arg2 * gMovementScaler;
|
||||
pthis->hoverBootsTimer = 0;
|
||||
pthis->actor.bgCheckFlags &= ~1;
|
||||
|
||||
|
@ -5896,7 +5896,7 @@ s32 func_8083BBA0(Player* pthis, GlobalContext* globalCtx)
|
|||
void Player_StartRolling(Player* pthis, GlobalContext* globalCtx)
|
||||
{
|
||||
Player_SetUpdateFunct(globalCtx, pthis, Player_UpdateWhenRolling, 0);
|
||||
LinkAnimation_PlayOnceSetSpeed(globalCtx, &pthis->skelAnime, D_80853A94[pthis->modelAnimType], 1.25f * D_808535E8);
|
||||
LinkAnimation_PlayOnceSetSpeed(globalCtx, &pthis->skelAnime, D_80853A94[pthis->modelAnimType], 1.25f * gMovementScaler);
|
||||
}
|
||||
|
||||
s32 func_8083BC7C(Player* pthis, GlobalContext* globalCtx)
|
||||
|
@ -6367,7 +6367,7 @@ void func_8083CD54(GlobalContext* globalCtx, Player* pthis, s16 yaw)
|
|||
pthis->currentYaw = yaw;
|
||||
Player_SetUpdateFunct(globalCtx, pthis, func_80841BA8, 1);
|
||||
pthis->unk_87E = 1200;
|
||||
pthis->unk_87E *= D_808535E8;
|
||||
pthis->unk_87E *= gMovementScaler;
|
||||
LinkAnimation_Change(globalCtx, &pthis->skelAnime, D_80853B84[pthis->modelAnimType], 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f);
|
||||
}
|
||||
|
||||
|
@ -8020,7 +8020,7 @@ void func_808409CC(GlobalContext* globalCtx, Player* pthis)
|
|||
}
|
||||
}
|
||||
|
||||
LinkAnimation_Change(globalCtx, &pthis->skelAnime, anim, (2.0f / 3.0f) * D_808535E8, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, -6.0f);
|
||||
LinkAnimation_Change(globalCtx, &pthis->skelAnime, anim, (2.0f / 3.0f) * gMovementScaler, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, -6.0f);
|
||||
}
|
||||
|
||||
void func_80840BC8(Player* pthis, GlobalContext* globalCtx)
|
||||
|
@ -10298,7 +10298,7 @@ void func_80845CA4(Player* pthis, GlobalContext* globalCtx)
|
|||
}
|
||||
else if(pthis->unk_84F == 0)
|
||||
{
|
||||
sp3C = 5.0f * D_808535E8;
|
||||
sp3C = 5.0f * gMovementScaler;
|
||||
|
||||
if(func_80845BA0(globalCtx, pthis, &sp3C, -1) < 30)
|
||||
{
|
||||
|
@ -12226,14 +12226,14 @@ void Player_UpdateCommon(Player* pthis, GlobalContext* globalCtx, Input* input)
|
|||
|
||||
if(pthis->stateFlags1 & PLAYER_STATE_SWIMMING)
|
||||
{
|
||||
D_808535E8 = 0.5f;
|
||||
gMovementScaler = 0.5f;
|
||||
}
|
||||
else
|
||||
{
|
||||
D_808535E8 = 1.0f;
|
||||
gMovementScaler = 1.0f;
|
||||
}
|
||||
|
||||
D_808535EC = 1.0f / D_808535E8;
|
||||
D_808535EC = 1.0f / gMovementScaler;
|
||||
D_80853614 = D_80853618 = 0;
|
||||
D_80858AA4 = pthis->currentMask;
|
||||
|
||||
|
@ -17084,12 +17084,12 @@ void Player_Reset()
|
|||
sControlInput = nullptr;
|
||||
|
||||
D_808535D0 = false;
|
||||
D_808535D4 = 0.0f;
|
||||
gJoystickMagnitude = 0.0f;
|
||||
D_808535D8 = 0;
|
||||
D_808535DC = 0;
|
||||
gInputCameraYaw = 0;
|
||||
D_808535E0 = 0;
|
||||
D_808535E4 = 0;
|
||||
D_808535E8 = 1.0f;
|
||||
gMovementScaler = 1.0f;
|
||||
D_808535EC = 1.0f;
|
||||
D_808535F0 = 0;
|
||||
D_808535F4 = 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user