mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-12-16 21:12:23 +00:00
Change get_game_tick_counter() to use gGlobalTimer (#853)
The old version was incrementing at the start of the code iteration, but it makes more sense to increment after the frame is built. That way every event within one visible game tick will get the same tick identifier Co-authored-by: MysterD <myster@d>
This commit is contained in:
parent
f42e4ad55b
commit
2f573d17f9
6 changed files with 4 additions and 8 deletions
|
|
@ -11105,7 +11105,7 @@ function texture_to_lua_table(tex)
|
|||
end
|
||||
|
||||
--- @return integer
|
||||
--- Gets the total number of game ticks since the game was launched. Wraps around at U64_MAX.
|
||||
--- Gets the total number of game ticks since the game was launched. Wraps around at U32_MAX.
|
||||
function get_game_tick_counter()
|
||||
-- ...
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5131,7 +5131,7 @@ Converts a texture's pixels to a Lua table. Returns nil if failed. Otherwise, re
|
|||
## [get_game_tick_counter](#get_game_tick_counter)
|
||||
|
||||
### Description
|
||||
Gets the total number of game ticks since the game was launched. Wraps around at U64_MAX.
|
||||
Gets the total number of game ticks since the game was launched. Wraps around at U32_MAX.
|
||||
|
||||
### Lua Example
|
||||
`local integerValue = get_game_tick_counter()`
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ struct Controller *gPlayer3Controller = &gControllers[2];
|
|||
struct DemoInput *gCurrDemoInput = NULL; // demo input sequence
|
||||
u16 gDemoInputListID = 0;
|
||||
struct DemoInput gRecordedDemoInput = { 0 }; // possibly removed in EU. TODO: Check
|
||||
u64 gGameTickCounter = 0;
|
||||
|
||||
/**
|
||||
* Initializes the Reality Display Processor (RDP).
|
||||
|
|
@ -603,8 +602,6 @@ void thread5_game_loop(UNUSED void *arg) {
|
|||
void game_loop_one_iteration(void) {
|
||||
profiler_log_thread5_time(THREAD5_START);
|
||||
|
||||
gGameTickCounter++;
|
||||
|
||||
// if any controllers are plugged in, start read the data for when
|
||||
// read_controller_inputs is called later.
|
||||
if (gControllerBits) {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ extern u8 gDemoInputs[];
|
|||
|
||||
extern u16 frameBufferIndex;
|
||||
extern u32 gGlobalTimer;
|
||||
extern u64 gGameTickCounter;
|
||||
|
||||
void setup_game_memory(void);
|
||||
void thread5_game_loop(UNUSED void *arg);
|
||||
|
|
|
|||
|
|
@ -627,5 +627,5 @@ void texture_to_lua_table(const u8 *tex) {
|
|||
}
|
||||
|
||||
u64 get_game_tick_counter(void) {
|
||||
return gGameTickCounter;
|
||||
return gGlobalTimer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ struct GraphNodeHeldObject* geo_get_current_held_object(void);
|
|||
/* |description|Converts a texture's pixels to a Lua table. Returns nil if failed. Otherwise, returns a table as a pure memory buffer. Supports rgba16 and rgba32 textures.|descriptionEnd|*/
|
||||
void texture_to_lua_table(const u8 *tex);
|
||||
|
||||
/* |description|Gets the total number of game ticks since the game was launched. Wraps around at U64_MAX.|descriptionEnd|*/
|
||||
/* |description|Gets the total number of game ticks since the game was launched. Wraps around at U32_MAX.|descriptionEnd|*/
|
||||
u64 get_game_tick_counter(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue