Skip to content

Commit 54b2edd

Browse files
committed
Change timestamp integer handling again
1 parent 7a7abe1 commit 54b2edd

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

code/freespace2/freespace.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4871,7 +4871,9 @@ void game_set_frametime(int state)
48714871
Last_frame_timestamp = timestamp();
48724872

48734873
flFrametime = f2fl(Frametime);
4874-
timestamp_inc(Frametime);
4874+
4875+
auto frametime_ms = f2i(fixmul(Frametime, F1_0 * TIMESTAMP_FREQUENCY));
4876+
timestamp_inc(frametime_ms);
48754877

48764878
// wrap overall frametime if needed
48774879
if ( FrametimeOverall > (INT_MAX - F1_0) )

code/io/timer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,9 @@ void timestamp_reset()
214214
// something like 1 minute (6000).
215215
#define MAX_TIME (INT_MAX/2)
216216

217-
void timestamp_inc(fix frametime)
217+
void timestamp_inc(int frametime_ms)
218218
{
219-
auto frametime_ms = fixmul(frametime, F1_0 * TIMESTAMP_FREQUENCY);
220-
timestamp_ticker += f2i(frametime_ms);
219+
timestamp_ticker += frametime_ms;
221220

222221
if ( timestamp_ticker > MAX_TIME ) {
223222
timestamp_ticker = 2; // Roll!

code/io/timer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ extern int timestamp_ticker;
7373
extern void timestamp_reset();
7474

7575
// Call this once every frame with the frametime.
76-
extern void timestamp_inc(fix frametime);
76+
extern void timestamp_inc(int frametime_ms);
7777

7878
// To do timing, call this with the interval you
7979
// want to check. Then, pass this to timestamp_elapsed

code/menuui/credits.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ void credits_do_frame(float frametime)
803803

804804
Credits_frametime = temp_time - Credits_last_time;
805805
Credits_last_time = temp_time;
806-
timestamp_inc(Credits_frametime / 1000.0f);
806+
timestamp_inc(Credits_frametime);
807807

808808
float fl_frametime = i2fl(Credits_frametime) / 1000.f;
809809
if (keyd_pressed[KEY_LSHIFT]) {

0 commit comments

Comments
 (0)