mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
title screen hud hook
This commit is contained in:
parent
f5fa67b7ad
commit
ba4275c415
3 changed files with 45 additions and 1 deletions
|
|
@ -34,6 +34,10 @@
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
#include "lua_hud.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// Stage of animation:
|
// Stage of animation:
|
||||||
// 0 = text, 1 = art screen
|
// 0 = text, 1 = art screen
|
||||||
static INT32 finalecount;
|
static INT32 finalecount;
|
||||||
|
|
@ -1524,7 +1528,11 @@ void F_TitleScreenDrawer(void)
|
||||||
|
|
||||||
// rei|miru: use title pics?
|
// rei|miru: use title pics?
|
||||||
if (hidetitlepics)
|
if (hidetitlepics)
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
goto luahook;
|
||||||
|
#else
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
|
|
||||||
V_DrawScaledPatch(30, 14, 0, ttwing);
|
V_DrawScaledPatch(30, 14, 0, ttwing);
|
||||||
|
|
||||||
|
|
@ -1562,6 +1570,11 @@ void F_TitleScreenDrawer(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
V_DrawScaledPatch(48, 142, 0,ttbanner);
|
V_DrawScaledPatch(48, 142, 0,ttbanner);
|
||||||
|
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
luahook:
|
||||||
|
LUAh_TitleHUD();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// (no longer) De-Demo'd Title Screen
|
// (no longer) De-Demo'd Title Screen
|
||||||
|
|
|
||||||
|
|
@ -42,3 +42,4 @@ boolean LUA_HudEnabled(enum hud option);
|
||||||
|
|
||||||
void LUAh_GameHUD(player_t *stplyr);
|
void LUAh_GameHUD(player_t *stplyr);
|
||||||
void LUAh_ScoresHUD(void);
|
void LUAh_ScoresHUD(void);
|
||||||
|
void LUAh_TitleHUD(void);
|
||||||
|
|
|
||||||
|
|
@ -87,11 +87,13 @@ static const char *const patch_opt[] = {
|
||||||
|
|
||||||
enum hudhook {
|
enum hudhook {
|
||||||
hudhook_game = 0,
|
hudhook_game = 0,
|
||||||
hudhook_scores
|
hudhook_scores,
|
||||||
|
hudhook_title
|
||||||
};
|
};
|
||||||
static const char *const hudhook_opt[] = {
|
static const char *const hudhook_opt[] = {
|
||||||
"game",
|
"game",
|
||||||
"scores",
|
"scores",
|
||||||
|
"title",
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
// alignment types for v.drawString
|
// alignment types for v.drawString
|
||||||
|
|
@ -650,6 +652,9 @@ int LUA_HudLib(lua_State *L)
|
||||||
|
|
||||||
lua_newtable(L);
|
lua_newtable(L);
|
||||||
lua_rawseti(L, -2, 3); // HUD[2] = scores rendering functions array
|
lua_rawseti(L, -2, 3); // HUD[2] = scores rendering functions array
|
||||||
|
|
||||||
|
lua_newtable(L);
|
||||||
|
lua_rawseti(L, -2, 4); // HUD[3] = title rendering functions array
|
||||||
lua_setfield(L, LUA_REGISTRYINDEX, "HUD");
|
lua_setfield(L, LUA_REGISTRYINDEX, "HUD");
|
||||||
|
|
||||||
luaL_newmetatable(L, META_HUDINFO);
|
luaL_newmetatable(L, META_HUDINFO);
|
||||||
|
|
@ -762,4 +767,29 @@ void LUAh_ScoresHUD(void)
|
||||||
hud_running = false;
|
hud_running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LUAh_TitleHUD(void)
|
||||||
|
{
|
||||||
|
if (!gL || !(hudAvailable & (1<<hudhook_title)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
hud_running = true;
|
||||||
|
lua_pop(gL, -1);
|
||||||
|
|
||||||
|
lua_getfield(gL, LUA_REGISTRYINDEX, "HUD");
|
||||||
|
I_Assert(lua_istable(gL, -1));
|
||||||
|
lua_rawgeti(gL, -1, 4); // HUD[4] = rendering funcs
|
||||||
|
I_Assert(lua_istable(gL, -1));
|
||||||
|
|
||||||
|
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
|
||||||
|
I_Assert(lua_istable(gL, -1));
|
||||||
|
lua_remove(gL, -3); // pop HUD
|
||||||
|
lua_pushnil(gL);
|
||||||
|
while (lua_next(gL, -3) != 0) {
|
||||||
|
lua_pushvalue(gL, -3); // graphics library (HUD[1])
|
||||||
|
LUA_Call(gL, 1);
|
||||||
|
}
|
||||||
|
lua_pop(gL, -1);
|
||||||
|
hud_running = false;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue