mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-09 17:52:08 -10:00
The movie player code was missing some important functionality, in particular: 1) There was only one timing method to get real-time elapsed time, which was not suitable for pausing or time compression 2) There was an improper cast for the FPS property, causing a script error 3) The `getSeconds` method lost precision during casting This patches those deficiencies.
25 lines
686 B
C++
25 lines
686 B
C++
//
|
|
//
|
|
|
|
#include "time_lib.h"
|
|
#include "io/timer.h"
|
|
#include "scripting/api/objs/time_obj.h"
|
|
|
|
namespace scripting {
|
|
namespace api {
|
|
|
|
ADE_LIB(l_Time, "Time", "time", "Real-Time library");
|
|
|
|
ADE_FUNC(getCurrentTime, l_Time, nullptr, "Gets the current real-time timestamp.", "timestamp", "The current time")
|
|
{
|
|
return ade_set_args(L, "o", l_Timestamp.Set(timer_get_nanoseconds()));
|
|
}
|
|
|
|
ADE_FUNC(getCurrentMissionTime, l_Time, nullptr, "Gets the current mission-time timestamp.", "timestamp", "The current mission time")
|
|
{
|
|
return ade_set_args(L, "o", l_Timestamp.Set(timestamp_get_mission_time_in_microseconds() * NANOSECONDS_PER_MICROSECOND));
|
|
}
|
|
|
|
} // namespace api
|
|
} // namespace scripting
|