|
@@ -73,14 +73,14 @@ int MainTimerSync::get_average_physics_steps(double &p_min, double &p_max) {
|
|
|
}
|
|
|
|
|
|
// advance physics clock by p_process_step, return appropriate number of steps to simulate
|
|
|
-MainFrameTime MainTimerSync::advance_core(double p_physics_step, int p_physics_fps, double p_process_step) {
|
|
|
+MainFrameTime MainTimerSync::advance_core(double p_physics_step, int p_physics_ticks_per_second, double p_process_step) {
|
|
|
MainFrameTime ret;
|
|
|
|
|
|
ret.process_step = p_process_step;
|
|
|
|
|
|
// simple determination of number of physics iteration
|
|
|
time_accum += ret.process_step;
|
|
|
- ret.physics_steps = floor(time_accum * p_physics_fps);
|
|
|
+ ret.physics_steps = floor(time_accum * p_physics_ticks_per_second);
|
|
|
|
|
|
int min_typical_steps = typical_physics_steps[0];
|
|
|
int max_typical_steps = min_typical_steps + 1;
|
|
@@ -107,7 +107,7 @@ MainFrameTime MainTimerSync::advance_core(double p_physics_step, int p_physics_f
|
|
|
|
|
|
// try to keep it consistent with previous iterations
|
|
|
if (ret.physics_steps < min_typical_steps) {
|
|
|
- const int max_possible_steps = floor((time_accum)*p_physics_fps + get_physics_jitter_fix());
|
|
|
+ const int max_possible_steps = floor((time_accum)*p_physics_ticks_per_second + get_physics_jitter_fix());
|
|
|
if (max_possible_steps < min_typical_steps) {
|
|
|
ret.physics_steps = max_possible_steps;
|
|
|
update_typical = true;
|
|
@@ -115,7 +115,7 @@ MainFrameTime MainTimerSync::advance_core(double p_physics_step, int p_physics_f
|
|
|
ret.physics_steps = min_typical_steps;
|
|
|
}
|
|
|
} else if (ret.physics_steps > max_typical_steps) {
|
|
|
- const int min_possible_steps = floor((time_accum)*p_physics_fps - get_physics_jitter_fix());
|
|
|
+ const int min_possible_steps = floor((time_accum)*p_physics_ticks_per_second - get_physics_jitter_fix());
|
|
|
if (min_possible_steps > max_typical_steps) {
|
|
|
ret.physics_steps = min_possible_steps;
|
|
|
update_typical = true;
|
|
@@ -146,7 +146,7 @@ MainFrameTime MainTimerSync::advance_core(double p_physics_step, int p_physics_f
|
|
|
}
|
|
|
|
|
|
// calls advance_core, keeps track of deficit it adds to animaption_step, make sure the deficit sum stays close to zero
|
|
|
-MainFrameTime MainTimerSync::advance_checked(double p_physics_step, int p_physics_fps, double p_process_step) {
|
|
|
+MainFrameTime MainTimerSync::advance_checked(double p_physics_step, int p_physics_ticks_per_second, double p_process_step) {
|
|
|
if (fixed_fps != -1) {
|
|
|
p_process_step = 1.0 / fixed_fps;
|
|
|
}
|
|
@@ -154,7 +154,7 @@ MainFrameTime MainTimerSync::advance_checked(double p_physics_step, int p_physic
|
|
|
// compensate for last deficit
|
|
|
p_process_step += time_deficit;
|
|
|
|
|
|
- MainFrameTime ret = advance_core(p_physics_step, p_physics_fps, p_process_step);
|
|
|
+ MainFrameTime ret = advance_core(p_physics_step, p_physics_ticks_per_second, p_process_step);
|
|
|
|
|
|
// we will do some clamping on ret.process_step and need to sync those changes to time_accum,
|
|
|
// that's easiest if we just remember their fixed difference now
|
|
@@ -220,8 +220,8 @@ void MainTimerSync::set_fixed_fps(int p_fixed_fps) {
|
|
|
}
|
|
|
|
|
|
// advance one physics frame, return timesteps to take
|
|
|
-MainFrameTime MainTimerSync::advance(double p_physics_step, int p_physics_fps) {
|
|
|
+MainFrameTime MainTimerSync::advance(double p_physics_step, int p_physics_ticks_per_second) {
|
|
|
double cpu_process_step = get_cpu_process_step();
|
|
|
|
|
|
- return advance_checked(p_physics_step, p_physics_fps, cpu_process_step);
|
|
|
+ return advance_checked(p_physics_step, p_physics_ticks_per_second, cpu_process_step);
|
|
|
}
|