mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Expose more lag compensation things to Lua
This commit is contained in:
parent
c65a67ccf1
commit
eac580e04a
11 changed files with 146 additions and 3 deletions
|
|
@ -45,7 +45,8 @@ in_files = [
|
||||||
"src/pc/mods/mod_storage.h",
|
"src/pc/mods/mod_storage.h",
|
||||||
"src/game/first_person_cam.h",
|
"src/game/first_person_cam.h",
|
||||||
"src/pc/djui/djui_console.h",
|
"src/pc/djui/djui_console.h",
|
||||||
"src/game/player_palette.h"
|
"src/game/player_palette.h",
|
||||||
|
"src/pc/network/lag_compensation.h"
|
||||||
]
|
]
|
||||||
|
|
||||||
exclude_constants = {
|
exclude_constants = {
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ override_disallowed_functions = {
|
||||||
"src/pc/lua/utils/smlua_level_utils.h": [ "smlua_level_util_reset" ],
|
"src/pc/lua/utils/smlua_level_utils.h": [ "smlua_level_util_reset" ],
|
||||||
"src/pc/lua/utils/smlua_text_utils.h": [ "smlua_text_utils_init", "smlua_text_utils_shutdown", "smlua_text_utils_reset_all" ],
|
"src/pc/lua/utils/smlua_text_utils.h": [ "smlua_text_utils_init", "smlua_text_utils_shutdown", "smlua_text_utils_reset_all" ],
|
||||||
"src/pc/lua/utils/smlua_anim_utils.h": [ "smlua_anim_util_reset", "smlua_anim_util_register_animation" ],
|
"src/pc/lua/utils/smlua_anim_utils.h": [ "smlua_anim_util_reset", "smlua_anim_util_register_animation" ],
|
||||||
"src/pc/network/lag_compensation.h": [ "lag_compensation_clear", "lag_compensation_store" ],
|
"src/pc/network/lag_compensation.h": [ "lag_compensation_clear" ],
|
||||||
"src/game/first_person_cam.h": [ "first_person_update" ],
|
"src/game/first_person_cam.h": [ "first_person_update" ],
|
||||||
"src/pc/lua/utils/smlua_collision_utils.h": [ "collision_find_surface_on_ray" ],
|
"src/pc/lua/utils/smlua_collision_utils.h": [ "collision_find_surface_on_ray" ],
|
||||||
"src/engine/behavior_script.h": [ "stub_behavior_script_2", "cur_obj_update" ]
|
"src/engine/behavior_script.h": [ "stub_behavior_script_2", "cur_obj_update" ]
|
||||||
|
|
|
||||||
|
|
@ -3817,6 +3817,9 @@ INTERACT_IGLOO_BARRIER = (1 << 30)
|
||||||
--- @type InteractionType
|
--- @type InteractionType
|
||||||
INTERACT_PLAYER = (1 << 31)
|
INTERACT_PLAYER = (1 << 31)
|
||||||
|
|
||||||
|
--- @type integer
|
||||||
|
MAX_LOCAL_STATE_HISTORY = 30
|
||||||
|
|
||||||
--- @type integer
|
--- @type integer
|
||||||
WARP_CHECKPOINT = 0x80
|
WARP_CHECKPOINT = 0x80
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3850,6 +3850,20 @@ function lag_compensation_get_local_state(otherNp)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @return integer
|
||||||
|
function lag_compensation_get_local_state_index()
|
||||||
|
-- ...
|
||||||
|
end
|
||||||
|
|
||||||
|
--- @return boolean
|
||||||
|
function lag_compensation_get_local_state_ready()
|
||||||
|
-- ...
|
||||||
|
end
|
||||||
|
|
||||||
|
function lag_compensation_store()
|
||||||
|
-- ...
|
||||||
|
end
|
||||||
|
|
||||||
--- @param courseNum integer
|
--- @param courseNum integer
|
||||||
--- @param levelNum integer
|
--- @param levelNum integer
|
||||||
--- @param areaIndex integer
|
--- @param areaIndex integer
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
- [interaction.h](#interactionh)
|
- [interaction.h](#interactionh)
|
||||||
- [enum InteractionFlag](#enum-InteractionFlag)
|
- [enum InteractionFlag](#enum-InteractionFlag)
|
||||||
- [enum InteractionType](#enum-InteractionType)
|
- [enum InteractionType](#enum-InteractionType)
|
||||||
|
- [lag_compensation.h](#lag_compensationh)
|
||||||
- [level_commands.h](#level_commandsh)
|
- [level_commands.h](#level_commandsh)
|
||||||
- [level_defines.h](#level_definesh)
|
- [level_defines.h](#level_definesh)
|
||||||
- [enum LevelNum](#enum-LevelNum)
|
- [enum LevelNum](#enum-LevelNum)
|
||||||
|
|
@ -1355,6 +1356,13 @@
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
## [lag_compensation.h](#lag_compensation.h)
|
||||||
|
- MAX_LOCAL_STATE_HISTORY
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
## [level_commands.h](#level_commands.h)
|
## [level_commands.h](#level_commands.h)
|
||||||
- WARP_CHECKPOINT
|
- WARP_CHECKPOINT
|
||||||
- WARP_NO_CHECKPOINT
|
- WARP_NO_CHECKPOINT
|
||||||
|
|
|
||||||
|
|
@ -4757,6 +4757,60 @@
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
## [lag_compensation_get_local_state_index](#lag_compensation_get_local_state_index)
|
||||||
|
|
||||||
|
### Lua Example
|
||||||
|
`local integerValue = lag_compensation_get_local_state_index()`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
- None
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
- `integer`
|
||||||
|
|
||||||
|
### C Prototype
|
||||||
|
`u32 lag_compensation_get_local_state_index(void);`
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
## [lag_compensation_get_local_state_ready](#lag_compensation_get_local_state_ready)
|
||||||
|
|
||||||
|
### Lua Example
|
||||||
|
`local booleanValue = lag_compensation_get_local_state_ready()`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
- None
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
- `boolean`
|
||||||
|
|
||||||
|
### C Prototype
|
||||||
|
`bool lag_compensation_get_local_state_ready(void);`
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
## [lag_compensation_store](#lag_compensation_store)
|
||||||
|
|
||||||
|
### Lua Example
|
||||||
|
`lag_compensation_store()`
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
- None
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
- None
|
||||||
|
|
||||||
|
### C Prototype
|
||||||
|
`void lag_compensation_store(void);`
|
||||||
|
|
||||||
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
---
|
---
|
||||||
# functions from level_info.h
|
# functions from level_info.h
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -900,6 +900,9 @@
|
||||||
|
|
||||||
- lag_compensation.h
|
- lag_compensation.h
|
||||||
- [lag_compensation_get_local_state](functions-3.md#lag_compensation_get_local_state)
|
- [lag_compensation_get_local_state](functions-3.md#lag_compensation_get_local_state)
|
||||||
|
- [lag_compensation_get_local_state_index](functions-3.md#lag_compensation_get_local_state_index)
|
||||||
|
- [lag_compensation_get_local_state_ready](functions-3.md#lag_compensation_get_local_state_ready)
|
||||||
|
- [lag_compensation_store](functions-3.md#lag_compensation_store)
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1465,6 +1465,7 @@ char gSmluaConstants[] = ""
|
||||||
"INT_STATUS_HIT_MINE = (1 << 21)\n"
|
"INT_STATUS_HIT_MINE = (1 << 21)\n"
|
||||||
"INT_STATUS_STOP_RIDING = (1 << 22)\n"
|
"INT_STATUS_STOP_RIDING = (1 << 22)\n"
|
||||||
"INT_STATUS_TOUCHED_BOB_OMB = (1 << 23)\n"
|
"INT_STATUS_TOUCHED_BOB_OMB = (1 << 23)\n"
|
||||||
|
"MAX_LOCAL_STATE_HISTORY = 30\n"
|
||||||
"WARP_CHECKPOINT = 0x80\n"
|
"WARP_CHECKPOINT = 0x80\n"
|
||||||
"WARP_NO_CHECKPOINT = 0x00\n"
|
"WARP_NO_CHECKPOINT = 0x00\n"
|
||||||
"LEVEL_NONE = 0\n"
|
"LEVEL_NONE = 0\n"
|
||||||
|
|
|
||||||
|
|
@ -14642,6 +14642,51 @@ int smlua_func_lag_compensation_get_local_state(lua_State* L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int smlua_func_lag_compensation_get_local_state_index(UNUSED lua_State* L) {
|
||||||
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
int top = lua_gettop(L);
|
||||||
|
if (top != 0) {
|
||||||
|
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "lag_compensation_get_local_state_index", 0, top);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
lua_pushinteger(L, lag_compensation_get_local_state_index());
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int smlua_func_lag_compensation_get_local_state_ready(UNUSED lua_State* L) {
|
||||||
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
int top = lua_gettop(L);
|
||||||
|
if (top != 0) {
|
||||||
|
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "lag_compensation_get_local_state_ready", 0, top);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
lua_pushboolean(L, lag_compensation_get_local_state_ready());
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int smlua_func_lag_compensation_store(UNUSED lua_State* L) {
|
||||||
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
int top = lua_gettop(L);
|
||||||
|
if (top != 0) {
|
||||||
|
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "lag_compensation_store", 0, top);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
lag_compensation_store();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////
|
//////////////////
|
||||||
// level_info.h //
|
// level_info.h //
|
||||||
//////////////////
|
//////////////////
|
||||||
|
|
@ -34254,6 +34299,9 @@ void smlua_bind_functions_autogen(void) {
|
||||||
|
|
||||||
// lag_compensation.h
|
// lag_compensation.h
|
||||||
smlua_bind_function(L, "lag_compensation_get_local_state", smlua_func_lag_compensation_get_local_state);
|
smlua_bind_function(L, "lag_compensation_get_local_state", smlua_func_lag_compensation_get_local_state);
|
||||||
|
smlua_bind_function(L, "lag_compensation_get_local_state_index", smlua_func_lag_compensation_get_local_state_index);
|
||||||
|
smlua_bind_function(L, "lag_compensation_get_local_state_ready", smlua_func_lag_compensation_get_local_state_ready);
|
||||||
|
smlua_bind_function(L, "lag_compensation_store", smlua_func_lag_compensation_store);
|
||||||
|
|
||||||
// level_info.h
|
// level_info.h
|
||||||
smlua_bind_function(L, "get_level_name", smlua_func_get_level_name);
|
smlua_bind_function(L, "get_level_name", smlua_func_get_level_name);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
#include "behavior_table.h"
|
#include "behavior_table.h"
|
||||||
#include "model_ids.h"
|
#include "model_ids.h"
|
||||||
|
|
||||||
#define MAX_LOCAL_STATE_HISTORY 30
|
|
||||||
struct StateHistory {
|
struct StateHistory {
|
||||||
struct MarioState m;
|
struct MarioState m;
|
||||||
struct Object marioObj;
|
struct Object marioObj;
|
||||||
|
|
@ -57,3 +56,11 @@ struct MarioState* lag_compensation_get_local_state(struct NetworkPlayer* otherN
|
||||||
|
|
||||||
return &sLocalStateHistory[index].m;
|
return &sLocalStateHistory[index].m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool lag_compensation_get_local_state_ready(void) {
|
||||||
|
return sLocalStateHistoryReady;
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 lag_compensation_get_local_state_index(void) {
|
||||||
|
return sLocalStateHistoryIndex;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
#ifndef NETWORK_LAG_COMPENSATION_H
|
#ifndef NETWORK_LAG_COMPENSATION_H
|
||||||
#define NETWORK_LAG_COMPENSATION_H
|
#define NETWORK_LAG_COMPENSATION_H
|
||||||
|
|
||||||
|
#define MAX_LOCAL_STATE_HISTORY 30
|
||||||
|
|
||||||
void lag_compensation_clear(void);
|
void lag_compensation_clear(void);
|
||||||
void lag_compensation_store(void);
|
void lag_compensation_store(void);
|
||||||
struct MarioState* lag_compensation_get_local_state(struct NetworkPlayer* otherNp);
|
struct MarioState* lag_compensation_get_local_state(struct NetworkPlayer* otherNp);
|
||||||
|
bool lag_compensation_get_local_state_ready(void);
|
||||||
|
u32 lag_compensation_get_local_state_index(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Loading…
Add table
Reference in a new issue