label TTC actors
This commit is contained in:
@@ -3,68 +3,68 @@
|
||||
#include "variables.h"
|
||||
|
||||
/* .bss */
|
||||
f32 D_8037C540; //pitch degrees
|
||||
f32 D_8037C544; //idealPitch degrees
|
||||
f32 D_8037C548; //pitchAngularVelocityLimit
|
||||
f32 D_8037C54C; //PitchAngularVelocity
|
||||
static f32 pitch_degree;
|
||||
static f32 idealPitch_degree;
|
||||
static f32 pitchVelocityLimit_degreePerSec;
|
||||
static f32 pitchVelocity_degreePerSec;
|
||||
|
||||
/* .code */
|
||||
static void __pitch_update(f32 limit, f32 angVel){
|
||||
f32 diff;
|
||||
f32 val;
|
||||
f32 tick = time_getDelta();
|
||||
f32 dt = time_getDelta();
|
||||
f32 max;
|
||||
|
||||
max = limit*tick;
|
||||
diff = D_8037C544 - D_8037C540;
|
||||
max = limit*dt;
|
||||
diff = idealPitch_degree - pitch_degree;
|
||||
if(180.0f < mlAbsF(diff)){
|
||||
diff += (diff < 0.0f)? 360.0: -360.0;
|
||||
}
|
||||
|
||||
val = diff * angVel * tick;
|
||||
val = diff * angVel * dt;
|
||||
val = (val < 0) ? ml_clamp_f(val, -max, -0.1f) : ml_clamp_f(val, 0.1f, max);
|
||||
|
||||
D_8037C540 =( mlAbsF(val) <= mlAbsF(diff)) ? D_8037C540 + val : D_8037C544;
|
||||
pitch_degree =( mlAbsF(val) <= mlAbsF(diff)) ? pitch_degree + val : idealPitch_degree;
|
||||
|
||||
if(D_8037C540 < 360.0){
|
||||
if(D_8037C540 < 0.0)
|
||||
D_8037C540 += 360.0;
|
||||
if(pitch_degree < 360.0){
|
||||
if(pitch_degree < 0.0)
|
||||
pitch_degree += 360.0;
|
||||
}
|
||||
else
|
||||
D_8037C540 -= 360.0;
|
||||
pitch_degree -= 360.0;
|
||||
}
|
||||
|
||||
void pitch_reset(void){
|
||||
D_8037C540 = 0.0f;
|
||||
D_8037C544 = 0.0f;
|
||||
pitch_degree = 0.0f;
|
||||
idealPitch_degree = 0.0f;
|
||||
pitch_setAngVel(500.0f, 0.8f);
|
||||
}
|
||||
|
||||
void pitch_update(void){
|
||||
__pitch_update(D_8037C548, D_8037C54C);
|
||||
__pitch_update(pitchVelocityLimit_degreePerSec, pitchVelocity_degreePerSec);
|
||||
}
|
||||
|
||||
void pitch_setIdeal(f32 ideal_pitch_deg){
|
||||
D_8037C544 = mlNormalizeAngle(ideal_pitch_deg);
|
||||
idealPitch_degree = mlNormalizeAngle(ideal_pitch_deg);
|
||||
}
|
||||
|
||||
void pitch_set(f32 pitch_deg){
|
||||
D_8037C540 = mlNormalizeAngle(pitch_deg);
|
||||
pitch_degree = mlNormalizeAngle(pitch_deg);
|
||||
}
|
||||
|
||||
void pitch_applyIdeal(void){
|
||||
D_8037C540 = D_8037C544;
|
||||
pitch_degree = idealPitch_degree;
|
||||
}
|
||||
|
||||
f32 pitch_get(void){
|
||||
return D_8037C540;
|
||||
return pitch_degree;
|
||||
}
|
||||
|
||||
f32 pitch_getIdeal(void){
|
||||
return D_8037C544;
|
||||
return idealPitch_degree;
|
||||
}
|
||||
|
||||
void pitch_setAngVel(f32 limit, f32 angVel){
|
||||
D_8037C548 = limit;
|
||||
D_8037C54C = angVel;
|
||||
pitchVelocityLimit_degreePerSec = limit;
|
||||
pitchVelocity_degreePerSec = angVel;
|
||||
}
|
||||
|
Reference in New Issue
Block a user