mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-10-18 19:22:41 +00:00
Added HOOK_ON_RENDER_BEHIND, deprecated djui_hud_set_render_behind_hud()
This commit is contained in:
parent
1f54996d47
commit
081a7fd9dc
21 changed files with 97 additions and 80 deletions
|
@ -9060,7 +9060,10 @@ HOOK_ON_EXIT = 34
|
||||||
HOOK_DIALOG_SOUND = 35
|
HOOK_DIALOG_SOUND = 35
|
||||||
|
|
||||||
--- @type LuaHookedEventType
|
--- @type LuaHookedEventType
|
||||||
HOOK_MAX = 36
|
HOOK_ON_HUD_RENDER_BEHIND = 36
|
||||||
|
|
||||||
|
--- @type LuaHookedEventType
|
||||||
|
HOOK_MAX = 37
|
||||||
|
|
||||||
--- @class HudDisplayFlags
|
--- @class HudDisplayFlags
|
||||||
|
|
||||||
|
@ -12360,9 +12363,6 @@ MINOR_VERSION_NUMBER = 0
|
||||||
--- @type integer
|
--- @type integer
|
||||||
PATCH_VERSION_NUMBER = 0
|
PATCH_VERSION_NUMBER = 0
|
||||||
|
|
||||||
--- @type string
|
|
||||||
SM64COOPDX_VERSION = "v0.1"
|
|
||||||
|
|
||||||
--- @type integer
|
--- @type integer
|
||||||
VERSION_NUMBER = 36
|
VERSION_NUMBER = 36
|
||||||
|
|
||||||
|
|
|
@ -3773,12 +3773,6 @@ function djui_hud_set_mouse_locked(locked)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
--- @param enable boolean
|
|
||||||
--- @return nil
|
|
||||||
function djui_hud_set_render_behind_hud(enable)
|
|
||||||
-- ...
|
|
||||||
end
|
|
||||||
|
|
||||||
--- @param resolutionType HudUtilsResolution
|
--- @param resolutionType HudUtilsResolution
|
||||||
--- @return nil
|
--- @return nil
|
||||||
function djui_hud_set_resolution(resolutionType)
|
function djui_hud_set_resolution(resolutionType)
|
||||||
|
@ -8303,6 +8297,12 @@ function smlua_collision_util_get(name)
|
||||||
-- ...
|
-- ...
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- @param enable boolean
|
||||||
|
--- @return nil
|
||||||
|
function djui_hud_set_render_behind_hud(enable)
|
||||||
|
-- ...
|
||||||
|
end
|
||||||
|
|
||||||
--- @param localIndex integer
|
--- @param localIndex integer
|
||||||
--- @return string
|
--- @return string
|
||||||
function network_discord_id_from_local_index(localIndex)
|
function network_discord_id_from_local_index(localIndex)
|
||||||
|
|
|
@ -1050,6 +1050,7 @@
|
||||||
--- @field public isDirectory boolean
|
--- @field public isDirectory boolean
|
||||||
--- @field public name string
|
--- @field public name string
|
||||||
--- @field public relativePath string
|
--- @field public relativePath string
|
||||||
|
--- @field public renderBehindHud boolean
|
||||||
--- @field public selectable boolean
|
--- @field public selectable boolean
|
||||||
|
|
||||||
--- @class ModFile
|
--- @class ModFile
|
||||||
|
|
|
@ -3227,7 +3227,8 @@
|
||||||
| HOOK_ON_DIALOG | 33 |
|
| HOOK_ON_DIALOG | 33 |
|
||||||
| HOOK_ON_EXIT | 34 |
|
| HOOK_ON_EXIT | 34 |
|
||||||
| HOOK_DIALOG_SOUND | 35 |
|
| HOOK_DIALOG_SOUND | 35 |
|
||||||
| HOOK_MAX | 36 |
|
| HOOK_ON_HUD_RENDER_BEHIND | 36 |
|
||||||
|
| HOOK_MAX | 37 |
|
||||||
|
|
||||||
[:arrow_up_small:](#)
|
[:arrow_up_small:](#)
|
||||||
|
|
||||||
|
@ -4380,7 +4381,6 @@
|
||||||
- MAX_VERSION_LENGTH
|
- MAX_VERSION_LENGTH
|
||||||
- MINOR_VERSION_NUMBER
|
- MINOR_VERSION_NUMBER
|
||||||
- PATCH_VERSION_NUMBER
|
- PATCH_VERSION_NUMBER
|
||||||
- SM64COOPDX_VERSION
|
|
||||||
- VERSION_NUMBER
|
- VERSION_NUMBER
|
||||||
- VERSION_REGION
|
- VERSION_REGION
|
||||||
- VERSION_REGION
|
- VERSION_REGION
|
||||||
|
|
|
@ -2516,26 +2516,6 @@
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
## [djui_hud_set_render_behind_hud](#djui_hud_set_render_behind_hud)
|
|
||||||
|
|
||||||
### Lua Example
|
|
||||||
`djui_hud_set_render_behind_hud(enable)`
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
| Field | Type |
|
|
||||||
| ----- | ---- |
|
|
||||||
| enable | `boolean` |
|
|
||||||
|
|
||||||
### Returns
|
|
||||||
- None
|
|
||||||
|
|
||||||
### C Prototype
|
|
||||||
`void djui_hud_set_render_behind_hud(bool enable);`
|
|
||||||
|
|
||||||
[:arrow_up_small:](#)
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
## [djui_hud_set_resolution](#djui_hud_set_resolution)
|
## [djui_hud_set_resolution](#djui_hud_set_resolution)
|
||||||
|
|
||||||
### Lua Example
|
### Lua Example
|
||||||
|
|
|
@ -749,7 +749,6 @@
|
||||||
- [djui_hud_set_filter](functions-3.md#djui_hud_set_filter)
|
- [djui_hud_set_filter](functions-3.md#djui_hud_set_filter)
|
||||||
- [djui_hud_set_font](functions-3.md#djui_hud_set_font)
|
- [djui_hud_set_font](functions-3.md#djui_hud_set_font)
|
||||||
- [djui_hud_set_mouse_locked](functions-3.md#djui_hud_set_mouse_locked)
|
- [djui_hud_set_mouse_locked](functions-3.md#djui_hud_set_mouse_locked)
|
||||||
- [djui_hud_set_render_behind_hud](functions-3.md#djui_hud_set_render_behind_hud)
|
|
||||||
- [djui_hud_set_resolution](functions-3.md#djui_hud_set_resolution)
|
- [djui_hud_set_resolution](functions-3.md#djui_hud_set_resolution)
|
||||||
- [djui_hud_set_rotation](functions-3.md#djui_hud_set_rotation)
|
- [djui_hud_set_rotation](functions-3.md#djui_hud_set_rotation)
|
||||||
- [djui_hud_world_pos_to_screen_pos](functions-3.md#djui_hud_world_pos_to_screen_pos)
|
- [djui_hud_world_pos_to_screen_pos](functions-3.md#djui_hud_world_pos_to_screen_pos)
|
||||||
|
|
|
@ -1428,6 +1428,7 @@
|
||||||
| isDirectory | `boolean` | read-only |
|
| isDirectory | `boolean` | read-only |
|
||||||
| name | `string` | read-only |
|
| name | `string` | read-only |
|
||||||
| relativePath | `string` | read-only |
|
| relativePath | `string` | read-only |
|
||||||
|
| renderBehindHud | `boolean` | read-only |
|
||||||
| selectable | `boolean` | read-only |
|
| selectable | `boolean` | read-only |
|
||||||
|
|
||||||
[:arrow_up_small:](#)
|
[:arrow_up_small:](#)
|
||||||
|
|
|
@ -444,16 +444,14 @@ void render_game(void) {
|
||||||
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, BORDER_HEIGHT, SCREEN_WIDTH,
|
gDPSetScissor(gDisplayListHead++, G_SC_NON_INTERLACE, 0, BORDER_HEIGHT, SCREEN_WIDTH,
|
||||||
SCREEN_HEIGHT - BORDER_HEIGHT);
|
SCREEN_HEIGHT - BORDER_HEIGHT);
|
||||||
|
|
||||||
if (!gDjuiDisabled && !gDjuiInMainMenu) {
|
if (!gDjuiDisabled) {
|
||||||
|
djui_reset_hud_params();
|
||||||
create_dl_ortho_matrix();
|
create_dl_ortho_matrix();
|
||||||
djui_gfx_displaylist_begin();
|
djui_gfx_displaylist_begin();
|
||||||
if (!gCoopCompatibility && gServerSettings.nametags) {
|
if (!gCoopCompatibility && gServerSettings.nametags) {
|
||||||
nametags_render();
|
nametags_render();
|
||||||
}
|
}
|
||||||
if (gDjuiRenderBehindHud) {
|
smlua_call_event_on_hud_render_behind(djui_reset_hud_params);
|
||||||
djui_reset_hud_params();
|
|
||||||
smlua_call_event_hooks_with_reset_func(HOOK_ON_HUD_RENDER, djui_reset_hud_params);
|
|
||||||
}
|
|
||||||
djui_gfx_displaylist_end();
|
djui_gfx_displaylist_end();
|
||||||
}
|
}
|
||||||
render_hud();
|
render_hud();
|
||||||
|
|
|
@ -23,7 +23,6 @@ static struct DjuiText* sDjuiLuaError = NULL;
|
||||||
static u32 sDjuiLuaErrorTimeout = 0;
|
static u32 sDjuiLuaErrorTimeout = 0;
|
||||||
bool gDjuiInMainMenu = true;
|
bool gDjuiInMainMenu = true;
|
||||||
bool gDjuiDisabled = false;
|
bool gDjuiDisabled = false;
|
||||||
bool gDjuiRenderBehindHud = false;
|
|
||||||
static bool sDjuiInited = false;
|
static bool sDjuiInited = false;
|
||||||
|
|
||||||
bool sDjuiRendered60fps = false;
|
bool sDjuiRendered60fps = false;
|
||||||
|
@ -49,8 +48,6 @@ void patch_djui_before(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void patch_djui_interpolated(UNUSED f32 delta) {
|
void patch_djui_interpolated(UNUSED f32 delta) {
|
||||||
if (gDjuiRenderBehindHud && !gDjuiPanelPauseCreated) { return; }
|
|
||||||
|
|
||||||
// reset the head and re-render DJUI
|
// reset the head and re-render DJUI
|
||||||
if (delta >= 0.5f && !sDjuiRendered60fps && (gDjuiInMainMenu || gDjuiPanelPauseCreated)) {
|
if (delta >= 0.5f && !sDjuiRendered60fps && (gDjuiInMainMenu || gDjuiPanelPauseCreated)) {
|
||||||
sDjuiRendered60fps = true;
|
sDjuiRendered60fps = true;
|
||||||
|
@ -133,10 +130,7 @@ void djui_render(void) {
|
||||||
create_dl_ortho_matrix();
|
create_dl_ortho_matrix();
|
||||||
djui_gfx_displaylist_begin();
|
djui_gfx_displaylist_begin();
|
||||||
|
|
||||||
if (!gDjuiRenderBehindHud) {
|
smlua_call_event_on_hud_render(djui_reset_hud_params);
|
||||||
djui_reset_hud_params();
|
|
||||||
smlua_call_event_hooks_with_reset_func(HOOK_ON_HUD_RENDER, djui_reset_hud_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
djui_panel_update();
|
djui_panel_update();
|
||||||
djui_popup_update();
|
djui_popup_update();
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
extern struct DjuiRoot* gDjuiRoot;
|
extern struct DjuiRoot* gDjuiRoot;
|
||||||
extern bool gDjuiInMainMenu;
|
extern bool gDjuiInMainMenu;
|
||||||
extern bool gDjuiDisabled;
|
extern bool gDjuiDisabled;
|
||||||
extern bool gDjuiRenderBehindHud;
|
|
||||||
|
|
||||||
void djui_init(void);
|
void djui_init(void);
|
||||||
void djui_init_late(void);
|
void djui_init_late(void);
|
||||||
|
|
|
@ -592,10 +592,6 @@ bool djui_hud_world_pos_to_screen_pos(Vec3f pos, Vec3f out) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void djui_hud_set_render_behind_hud(bool enable) {
|
|
||||||
gDjuiRenderBehindHud = enable;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool djui_hud_is_pause_menu_created(void) {
|
bool djui_hud_is_pause_menu_created(void) {
|
||||||
return gDjuiPanelPauseCreated;
|
return gDjuiPanelPauseCreated;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,9 +82,6 @@ void djui_hud_render_rect(f32 x, f32 y, f32 width, f32 height);
|
||||||
void djui_hud_render_rect_interpolated(f32 prevX, f32 prevY, f32 prevWidth, f32 prevHeight, f32 x, f32 y, f32 width, f32 height);
|
void djui_hud_render_rect_interpolated(f32 prevX, f32 prevY, f32 prevWidth, f32 prevHeight, f32 x, f32 y, f32 width, f32 height);
|
||||||
|
|
||||||
bool djui_hud_world_pos_to_screen_pos(Vec3f pos, Vec3f out);
|
bool djui_hud_world_pos_to_screen_pos(Vec3f pos, Vec3f out);
|
||||||
|
|
||||||
void djui_hud_set_render_behind_hud(bool enable);
|
|
||||||
|
|
||||||
bool djui_hud_is_pause_menu_created(void);
|
bool djui_hud_is_pause_menu_created(void);
|
||||||
|
|
||||||
void djui_open_pause_menu(void);
|
void djui_open_pause_menu(void);
|
||||||
|
|
|
@ -1160,7 +1160,7 @@ static struct LuaObjectField sMarioStateFields[LUA_MARIO_STATE_FIELD_COUNT] = {
|
||||||
{ "waterLevel", LVT_S16, offsetof(struct MarioState, waterLevel), false, LOT_NONE },
|
{ "waterLevel", LVT_S16, offsetof(struct MarioState, waterLevel), false, LOT_NONE },
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LUA_MOD_FIELD_COUNT 11
|
#define LUA_MOD_FIELD_COUNT 12
|
||||||
static struct LuaObjectField sModFields[LUA_MOD_FIELD_COUNT] = {
|
static struct LuaObjectField sModFields[LUA_MOD_FIELD_COUNT] = {
|
||||||
{ "basePath", LVT_STRING, offsetof(struct Mod, basePath), true, LOT_NONE },
|
{ "basePath", LVT_STRING, offsetof(struct Mod, basePath), true, LOT_NONE },
|
||||||
{ "customBehaviorIndex", LVT_U8, offsetof(struct Mod, customBehaviorIndex), true, LOT_NONE },
|
{ "customBehaviorIndex", LVT_U8, offsetof(struct Mod, customBehaviorIndex), true, LOT_NONE },
|
||||||
|
@ -1172,6 +1172,7 @@ static struct LuaObjectField sModFields[LUA_MOD_FIELD_COUNT] = {
|
||||||
{ "isDirectory", LVT_BOOL, offsetof(struct Mod, isDirectory), true, LOT_NONE },
|
{ "isDirectory", LVT_BOOL, offsetof(struct Mod, isDirectory), true, LOT_NONE },
|
||||||
{ "name", LVT_STRING_P, offsetof(struct Mod, name), true, LOT_NONE },
|
{ "name", LVT_STRING_P, offsetof(struct Mod, name), true, LOT_NONE },
|
||||||
{ "relativePath", LVT_STRING, offsetof(struct Mod, relativePath), true, LOT_NONE },
|
{ "relativePath", LVT_STRING, offsetof(struct Mod, relativePath), true, LOT_NONE },
|
||||||
|
{ "renderBehindHud", LVT_BOOL, offsetof(struct Mod, renderBehindHud), true, LOT_NONE },
|
||||||
{ "selectable", LVT_BOOL, offsetof(struct Mod, selectable), true, LOT_NONE },
|
{ "selectable", LVT_BOOL, offsetof(struct Mod, selectable), true, LOT_NONE },
|
||||||
// { "size", LVT_???, offsetof(struct Mod, size), true, LOT_??? }, <--- UNIMPLEMENTED
|
// { "size", LVT_???, offsetof(struct Mod, size), true, LOT_??? }, <--- UNIMPLEMENTED
|
||||||
};
|
};
|
||||||
|
|
|
@ -3212,7 +3212,8 @@ char gSmluaConstants[] = ""
|
||||||
"HOOK_ON_DIALOG = 33\n"
|
"HOOK_ON_DIALOG = 33\n"
|
||||||
"HOOK_ON_EXIT = 34\n"
|
"HOOK_ON_EXIT = 34\n"
|
||||||
"HOOK_DIALOG_SOUND = 35\n"
|
"HOOK_DIALOG_SOUND = 35\n"
|
||||||
"HOOK_MAX = 36\n"
|
"HOOK_ON_HUD_RENDER_BEHIND = 36\n"
|
||||||
|
"HOOK_MAX = 37\n"
|
||||||
"ACTION_HOOK_EVERY_FRAME = 0\n"
|
"ACTION_HOOK_EVERY_FRAME = 0\n"
|
||||||
"ACTION_HOOK_GRAVITY = 1\n"
|
"ACTION_HOOK_GRAVITY = 1\n"
|
||||||
"ACTION_HOOK_MAX = 2\n"
|
"ACTION_HOOK_MAX = 2\n"
|
||||||
|
@ -4308,7 +4309,6 @@ char gSmluaConstants[] = ""
|
||||||
"COOP_OBJ_FLAG_LUA = (1 << 1)\n"
|
"COOP_OBJ_FLAG_LUA = (1 << 1)\n"
|
||||||
"COOP_OBJ_FLAG_NON_SYNC = (1 << 2)\n"
|
"COOP_OBJ_FLAG_NON_SYNC = (1 << 2)\n"
|
||||||
"COOP_OBJ_FLAG_INITIALIZED = (1 << 3)\n"
|
"COOP_OBJ_FLAG_INITIALIZED = (1 << 3)\n"
|
||||||
"SM64COOPDX_VERSION = 'v0.1'\n"
|
|
||||||
"VERSION_TEXT = 'v'\n"
|
"VERSION_TEXT = 'v'\n"
|
||||||
"VERSION_NUMBER = 36\n"
|
"VERSION_NUMBER = 36\n"
|
||||||
"MINOR_VERSION_NUMBER = 0\n"
|
"MINOR_VERSION_NUMBER = 0\n"
|
||||||
|
@ -4319,4 +4319,4 @@ char gSmluaConstants[] = ""
|
||||||
"VERSION_REGION = 'US'\n"
|
"VERSION_REGION = 'US'\n"
|
||||||
"MAX_VERSION_LENGTH = 32\n"
|
"MAX_VERSION_LENGTH = 32\n"
|
||||||
"MAX_LOCAL_VERSION_LENGTH = 36\n"
|
"MAX_LOCAL_VERSION_LENGTH = 36\n"
|
||||||
;
|
;
|
|
@ -12480,23 +12480,6 @@ int smlua_func_djui_hud_set_mouse_locked(lua_State* L) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int smlua_func_djui_hud_set_render_behind_hud(lua_State* L) {
|
|
||||||
if (L == NULL) { return 0; }
|
|
||||||
|
|
||||||
int top = lua_gettop(L);
|
|
||||||
if (top != 1) {
|
|
||||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_set_render_behind_hud", 1, top);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool enable = smlua_to_boolean(L, 1);
|
|
||||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_set_render_behind_hud"); return 0; }
|
|
||||||
|
|
||||||
djui_hud_set_render_behind_hud(enable);
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int smlua_func_djui_hud_set_resolution(lua_State* L) {
|
int smlua_func_djui_hud_set_resolution(lua_State* L) {
|
||||||
if (L == NULL) { return 0; }
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
@ -27619,6 +27602,23 @@ int smlua_func_smlua_collision_util_get(lua_State* L) {
|
||||||
// smlua_deprecated.h //
|
// smlua_deprecated.h //
|
||||||
////////////////////////
|
////////////////////////
|
||||||
|
|
||||||
|
int smlua_func_djui_hud_set_render_behind_hud(lua_State* L) {
|
||||||
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
int top = lua_gettop(L);
|
||||||
|
if (top != 1) {
|
||||||
|
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "djui_hud_set_render_behind_hud", 1, top);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool enable = smlua_to_boolean(L, 1);
|
||||||
|
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "djui_hud_set_render_behind_hud"); return 0; }
|
||||||
|
|
||||||
|
djui_hud_set_render_behind_hud(enable);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int smlua_func_network_discord_id_from_local_index(lua_State* L) {
|
int smlua_func_network_discord_id_from_local_index(lua_State* L) {
|
||||||
if (L == NULL) { return 0; }
|
if (L == NULL) { return 0; }
|
||||||
|
|
||||||
|
@ -31987,7 +31987,6 @@ void smlua_bind_functions_autogen(void) {
|
||||||
smlua_bind_function(L, "djui_hud_set_filter", smlua_func_djui_hud_set_filter);
|
smlua_bind_function(L, "djui_hud_set_filter", smlua_func_djui_hud_set_filter);
|
||||||
smlua_bind_function(L, "djui_hud_set_font", smlua_func_djui_hud_set_font);
|
smlua_bind_function(L, "djui_hud_set_font", smlua_func_djui_hud_set_font);
|
||||||
smlua_bind_function(L, "djui_hud_set_mouse_locked", smlua_func_djui_hud_set_mouse_locked);
|
smlua_bind_function(L, "djui_hud_set_mouse_locked", smlua_func_djui_hud_set_mouse_locked);
|
||||||
smlua_bind_function(L, "djui_hud_set_render_behind_hud", smlua_func_djui_hud_set_render_behind_hud);
|
|
||||||
smlua_bind_function(L, "djui_hud_set_resolution", smlua_func_djui_hud_set_resolution);
|
smlua_bind_function(L, "djui_hud_set_resolution", smlua_func_djui_hud_set_resolution);
|
||||||
smlua_bind_function(L, "djui_hud_set_rotation", smlua_func_djui_hud_set_rotation);
|
smlua_bind_function(L, "djui_hud_set_rotation", smlua_func_djui_hud_set_rotation);
|
||||||
smlua_bind_function(L, "djui_hud_world_pos_to_screen_pos", smlua_func_djui_hud_world_pos_to_screen_pos);
|
smlua_bind_function(L, "djui_hud_world_pos_to_screen_pos", smlua_func_djui_hud_world_pos_to_screen_pos);
|
||||||
|
@ -32739,6 +32738,7 @@ void smlua_bind_functions_autogen(void) {
|
||||||
smlua_bind_function(L, "smlua_collision_util_get", smlua_func_smlua_collision_util_get);
|
smlua_bind_function(L, "smlua_collision_util_get", smlua_func_smlua_collision_util_get);
|
||||||
|
|
||||||
// smlua_deprecated.h
|
// smlua_deprecated.h
|
||||||
|
smlua_bind_function(L, "djui_hud_set_render_behind_hud", smlua_func_djui_hud_set_render_behind_hud);
|
||||||
smlua_bind_function(L, "network_discord_id_from_local_index", smlua_func_network_discord_id_from_local_index);
|
smlua_bind_function(L, "network_discord_id_from_local_index", smlua_func_network_discord_id_from_local_index);
|
||||||
|
|
||||||
// smlua_level_utils.h
|
// smlua_level_utils.h
|
||||||
|
|
|
@ -168,20 +168,60 @@ void smlua_call_event_hooks(enum LuaHookedEventType hookType) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void smlua_call_event_hooks_with_reset_func(enum LuaHookedEventType hookType, void (*resetFunc)(void)) {
|
void smlua_call_event_on_hud_render(void (*resetFunc)(void)) {
|
||||||
lua_State* L = gLuaState;
|
lua_State* L = gLuaState;
|
||||||
if (L == NULL) { return; }
|
if (L == NULL) { return; }
|
||||||
struct LuaHookedEvent* hook = &sHookedEvents[hookType];
|
if (resetFunc) { resetFunc(); }
|
||||||
|
|
||||||
|
struct LuaHookedEvent* hook = &sHookedEvents[HOOK_ON_HUD_RENDER];
|
||||||
|
for (int i = 0; i < hook->count; i++) {
|
||||||
|
// support deprecated render behind hud
|
||||||
|
if (hook->mod[i]->renderBehindHud) { continue; }
|
||||||
|
|
||||||
|
// push the callback onto the stack
|
||||||
|
lua_rawgeti(L, LUA_REGISTRYINDEX, hook->reference[i]);
|
||||||
|
|
||||||
|
// call the callback
|
||||||
|
if (0 != smlua_call_hook(L, 0, 0, 0, hook->mod[i])) {
|
||||||
|
LOG_LUA("Failed to call the event_hook callback: %u", HOOK_ON_HUD_RENDER);
|
||||||
|
}
|
||||||
|
if (resetFunc) { resetFunc(); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void smlua_call_event_on_hud_render_behind(void (*resetFunc)(void)) {
|
||||||
|
lua_State* L = gLuaState;
|
||||||
|
if (L == NULL) { return; }
|
||||||
|
if (resetFunc) { resetFunc(); }
|
||||||
|
|
||||||
|
struct LuaHookedEvent* hook = &sHookedEvents[HOOK_ON_HUD_RENDER_BEHIND];
|
||||||
for (int i = 0; i < hook->count; i++) {
|
for (int i = 0; i < hook->count; i++) {
|
||||||
// push the callback onto the stack
|
// push the callback onto the stack
|
||||||
lua_rawgeti(L, LUA_REGISTRYINDEX, hook->reference[i]);
|
lua_rawgeti(L, LUA_REGISTRYINDEX, hook->reference[i]);
|
||||||
|
|
||||||
// call the callback
|
// call the callback
|
||||||
if (0 != smlua_call_hook(L, 0, 0, 0, hook->mod[i])) {
|
if (0 != smlua_call_hook(L, 0, 0, 0, hook->mod[i])) {
|
||||||
LOG_LUA("Failed to call the event_hook callback: %u", hookType);
|
LOG_LUA("Failed to call the event_hook callback: %u", HOOK_ON_HUD_RENDER_BEHIND);
|
||||||
}
|
}
|
||||||
if (resetFunc) { resetFunc(); }
|
if (resetFunc) { resetFunc(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// support deprecated render behind hud
|
||||||
|
hook = &sHookedEvents[HOOK_ON_HUD_RENDER];
|
||||||
|
for (int i = 0; i < hook->count; i++) {
|
||||||
|
// support deprecated render behind hud
|
||||||
|
if (!hook->mod[i]->renderBehindHud) { continue; }
|
||||||
|
|
||||||
|
// push the callback onto the stack
|
||||||
|
lua_rawgeti(L, LUA_REGISTRYINDEX, hook->reference[i]);
|
||||||
|
|
||||||
|
// call the callback
|
||||||
|
if (0 != smlua_call_hook(L, 0, 0, 0, hook->mod[i])) {
|
||||||
|
LOG_LUA("Failed to call the event_hook callback: %u", HOOK_ON_HUD_RENDER);
|
||||||
|
}
|
||||||
|
if (resetFunc) { resetFunc(); }
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void smlua_call_event_hooks_bool_param(enum LuaHookedEventType hookType, bool value) {
|
void smlua_call_event_hooks_bool_param(enum LuaHookedEventType hookType, bool value) {
|
||||||
|
|
|
@ -47,6 +47,7 @@ enum LuaHookedEventType {
|
||||||
HOOK_ON_DIALOG,
|
HOOK_ON_DIALOG,
|
||||||
HOOK_ON_EXIT,
|
HOOK_ON_EXIT,
|
||||||
HOOK_DIALOG_SOUND,
|
HOOK_DIALOG_SOUND,
|
||||||
|
HOOK_ON_HUD_RENDER_BEHIND,
|
||||||
HOOK_MAX,
|
HOOK_MAX,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -87,6 +88,7 @@ static const char* LuaHookedEventTypeName[] = {
|
||||||
"HOOK_ON_DIALOG",
|
"HOOK_ON_DIALOG",
|
||||||
"HOOK_ON_EXIT",
|
"HOOK_ON_EXIT",
|
||||||
"HOOK_DIALOG_SOUND",
|
"HOOK_DIALOG_SOUND",
|
||||||
|
"HOOK_ON_HUD_RENDER_BEHIND",
|
||||||
"HOOK_MAX"
|
"HOOK_MAX"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -107,7 +109,8 @@ extern u32 gLuaMarioActionIndex[];
|
||||||
int smlua_hook_custom_bhv(BehaviorScript *bhvScript, const char *bhvName);
|
int smlua_hook_custom_bhv(BehaviorScript *bhvScript, const char *bhvName);
|
||||||
|
|
||||||
void smlua_call_event_hooks(enum LuaHookedEventType hookType);
|
void smlua_call_event_hooks(enum LuaHookedEventType hookType);
|
||||||
void smlua_call_event_hooks_with_reset_func(enum LuaHookedEventType hookType, void (*resetFunc)(void));
|
void smlua_call_event_on_hud_render(void (*resetFunc)(void));
|
||||||
|
void smlua_call_event_on_hud_render_behind(void (*resetFunc)(void));
|
||||||
void smlua_call_event_hooks_bool_param(enum LuaHookedEventType hookType, bool value);
|
void smlua_call_event_hooks_bool_param(enum LuaHookedEventType hookType, bool value);
|
||||||
void smlua_call_event_hooks_bool_param_ret_bool(enum LuaHookedEventType hookType, bool value, bool* returnValue);
|
void smlua_call_event_hooks_bool_param_ret_bool(enum LuaHookedEventType hookType, bool value, bool* returnValue);
|
||||||
void smlua_call_event_hooks_mario_param(enum LuaHookedEventType hookType, struct MarioState* m);
|
void smlua_call_event_hooks_mario_param(enum LuaHookedEventType hookType, struct MarioState* m);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#ifdef DISCORD_SDK
|
#ifdef DISCORD_SDK
|
||||||
#include "pc/discord/discord.h"
|
#include "pc/discord/discord.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "pc/lua/smlua.h"
|
||||||
|
|
||||||
char* network_discord_id_from_local_index(u8 localIndex) {
|
char* network_discord_id_from_local_index(u8 localIndex) {
|
||||||
#ifdef DISCORD_SDK
|
#ifdef DISCORD_SDK
|
||||||
|
@ -14,3 +15,8 @@ char* network_discord_id_from_local_index(u8 localIndex) {
|
||||||
#endif
|
#endif
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void djui_hud_set_render_behind_hud(bool enable) {
|
||||||
|
if (!gLuaActiveMod) { return; }
|
||||||
|
gLuaActiveMod->renderBehindHud = enable;
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
char* network_discord_id_from_local_index(u8 localIndex);
|
char* network_discord_id_from_local_index(u8 localIndex);
|
||||||
|
void djui_hud_set_render_behind_hud(bool enable);
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ struct Mod {
|
||||||
bool isDirectory;
|
bool isDirectory;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
bool selectable;
|
bool selectable;
|
||||||
|
bool renderBehindHud;
|
||||||
size_t size;
|
size_t size;
|
||||||
u8 customBehaviorIndex;
|
u8 customBehaviorIndex;
|
||||||
};
|
};
|
||||||
|
|
|
@ -655,7 +655,6 @@ void network_shutdown(bool sendLeaving, bool exiting, bool popup, bool reconnect
|
||||||
gFogIntensity = 1;
|
gFogIntensity = 1;
|
||||||
gOverrideBackground = -1;
|
gOverrideBackground = -1;
|
||||||
gOverrideEnvFx = -1;
|
gOverrideEnvFx = -1;
|
||||||
gDjuiRenderBehindHud = false;
|
|
||||||
gRomhackCameraAllowCentering = TRUE;
|
gRomhackCameraAllowCentering = TRUE;
|
||||||
gOverrideAllowToxicGasCamera = FALSE;
|
gOverrideAllowToxicGasCamera = FALSE;
|
||||||
gRomhackCameraAllowDpad = FALSE;
|
gRomhackCameraAllowDpad = FALSE;
|
||||||
|
|
Loading…
Reference in a new issue