@@ -746,6 +746,14 @@ void Game_SetTextReadingSpeed(int newTextSpeed)
746746 play.text_speed = newTextSpeed;
747747}
748748
749+ int Game_GetTickCounter ()
750+ {
751+ // Loop counter is uint32, but the script values are int32;
752+ // convert uint32 value into a int32 wrapped in the range of 0 - INT32_MAX.
753+ uint32_t loopcounter = get_loop_counter ();
754+ return loopcounter <= INT32_MAX ? static_cast <int32_t >(loopcounter) : static_cast <int32_t >(loopcounter - INT32_MAX);
755+ }
756+
749757int Game_GetMinimumTextDisplayTimeMs ()
750758{
751759 return play.text_min_display_time_ms ;
@@ -2047,6 +2055,11 @@ RuntimeScriptValue Sc_Game_SetTextReadingSpeed(const RuntimeScriptValue *params,
20472055 API_SCALL_VOID_PINT (Game_SetTextReadingSpeed);
20482056}
20492057
2058+ RuntimeScriptValue Sc_Game_GetTickCounter (const RuntimeScriptValue *params, int32_t param_count)
2059+ {
2060+ API_SCALL_INT (Game_GetTickCounter);
2061+ }
2062+
20502063// const char* ()
20512064RuntimeScriptValue Sc_Game_GetTranslationFilename (const RuntimeScriptValue *params, int32_t param_count)
20522065{
@@ -2242,6 +2255,7 @@ void RegisterGameAPI()
22422255 { " Game::geti_SpriteHeight" , API_FN_PAIR (Game_GetSpriteHeight) },
22432256 { " Game::get_TextReadingSpeed" , API_FN_PAIR (Game_GetTextReadingSpeed) },
22442257 { " Game::set_TextReadingSpeed" , API_FN_PAIR (Game_SetTextReadingSpeed) },
2258+ { " Game::get_TickCounter" , API_FN_PAIR (Game_GetTickCounter) },
22452259 { " Game::get_TranslationFilename" , API_FN_PAIR (Game_GetTranslationFilename) },
22462260 { " Game::get_UseNativeCoordinates" , API_FN_PAIR (Game_GetUseNativeCoordinates) },
22472261 { " Game::get_ViewCount" , API_FN_PAIR (Game_GetViewCount) },
0 commit comments