mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-21 19:45:10 +00:00
Add gControllers
This commit is contained in:
parent
37cfd9ae04
commit
6886f248f8
3 changed files with 21 additions and 0 deletions
|
@ -23,6 +23,9 @@ gActiveMods = {}
|
|||
--- @type Character[]
|
||||
gCharacters = {}
|
||||
|
||||
--- @type Controller[]
|
||||
gControllers = {}
|
||||
|
||||
--- @type GlobalTextures
|
||||
gTextures = {}
|
||||
|
||||
|
|
|
@ -37,6 +37,13 @@ The `gCharacters[]` table is an array from `0` to `(CT_MAX - 1)` that contains a
|
|||
|
||||
<br />
|
||||
|
||||
## [gControllers](#gControllers)
|
||||
The `gControllers[]` table is an array from `0` to `(MAX_PLAYERS - 1)` that contains a [Controller](structs.md#Controller) struct for each possible player.
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [gTextures](#gTextures)
|
||||
The `gTextures` table contains references to textures. Listed in [GlobalTextures](structs.md#GlobalTextures).
|
||||
|
||||
|
|
|
@ -603,6 +603,17 @@ void smlua_cobject_init_globals(void) {
|
|||
lua_setglobal(L, "gCharacters");
|
||||
}
|
||||
|
||||
{
|
||||
lua_newtable(L);
|
||||
int t = lua_gettop(gLuaState);
|
||||
for (s32 i = 0; i < MAX_PLAYERS; i++) {
|
||||
lua_pushinteger(L, i);
|
||||
smlua_push_object(L, LOT_CONTROLLER, &gControllers[i]);
|
||||
lua_settable(L, t);
|
||||
}
|
||||
lua_setglobal(L, "gControllers");
|
||||
}
|
||||
|
||||
#define EXPOSE_GLOBAL(lot, ptr) \
|
||||
{ \
|
||||
smlua_push_object(L, lot, &ptr); \
|
||||
|
|
Loading…
Reference in a new issue