Split game drawlist per displayplayer

This commit is contained in:
GenericHeroGuy committed 2024-04-02 03:22:24 +02:00
1 parent 9442a463d4
commit 5f69bfcf22
3 files changed
+14 -30

No files matched your search

+1 -1
View File
@@ -44,7 +44,7 @@ extern boolean hud_running;
boolean LUA_HudEnabled(enum hud option);
void LUAh_GameHUD(player_t *stplyr, huddrawlist_h list);
void LUAh_GameHUD(huddrawlist_h list);
void LUAh_ScoresHUD(huddrawlist_h list);
void LUAh_IntermissionHUD(huddrawlist_h list);
void LUAh_VoteHUD(huddrawlist_h list);
+5 -24
View File
@@ -1413,7 +1413,7 @@ boolean LUA_HudEnabled(enum hud option)
}
// Hook for HUD rendering
void LUAh_GameHUD(player_t *stplayr, huddrawlist_h list)
void LUAh_GameHUD(huddrawlist_h list)
{
if (!gL || !(hudAvailable & (1<<hudhook_game)))
return;
@@ -1434,33 +1434,14 @@ void LUAh_GameHUD(player_t *stplayr, huddrawlist_h list)
lua_rawgeti(gL, -2, 1); // HUD[1] = lib_draw
I_Assert(lua_istable(gL, -1));
lua_remove(gL, -3); // pop HUD
LUA_PushUserdata(gL, stplayr, META_PLAYER);
if (splitscreen > 2 && stplayr == &players[displayplayers[3]])
{
LUA_PushUserdata(gL, &camera[3], META_CAMERA);
camnum = 4;
}
else if (splitscreen > 1 && stplayr == &players[displayplayers[2]])
{
LUA_PushUserdata(gL, &camera[2], META_CAMERA);
camnum = 3;
}
else if (splitscreen && stplayr == &players[displayplayers[1]])
{
LUA_PushUserdata(gL, &camera[1], META_CAMERA);
camnum = 2;
}
else
{
LUA_PushUserdata(gL, &camera[0], META_CAMERA);
camnum = 1;
}
LUA_PushUserdata(gL, stplyr, META_PLAYER);
LUA_PushUserdata(gL, &camera[stplyrnum], META_CAMERA);
camnum = stplyrnum + 1;
lua_pushnil(gL);
while (lua_next(gL, -5) != 0) {
lua_pushvalue(gL, -5); // graphics library (HUD[1])
lua_pushvalue(gL, -5); // stplayr
lua_pushvalue(gL, -5); // stplyr
lua_pushvalue(gL, -5); // camera
LUA_Call(gL, 3, 0, 1);
}
+8 -5
View File
@@ -193,7 +193,7 @@ hudinfo_t hudinfo[NUMHUDITEMS] =
{ 240, 160}, // HUD_LAP
};
static huddrawlist_h luahuddrawlist_game;
static huddrawlist_h luahuddrawlist_game[MAXSPLITSCREENPLAYERS];
// variable to stop mayonaka static from flickering
consvar_t cv_lessflicker = {"lessflicker", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
@@ -473,7 +473,8 @@ void ST_Init(void)
ST_LoadGraphics();
luahuddrawlist_game = LUA_HUD_CreateDrawList();
for (int i = 0; i < MAXSPLITSCREENPLAYERS; i++)
luahuddrawlist_game[i] = LUA_HUD_CreateDrawList();
}
// change the status bar too, when pressing F12 while viewing a demo.
@@ -846,7 +847,7 @@ static void ST_overlayDrawer(void)
{
if (renderisnewtic)
{
LUAh_GameHUD(stplyr, luahuddrawlist_game);
LUAh_GameHUD(luahuddrawlist_game[stplyrnum]);
}
}
@@ -1024,7 +1025,8 @@ void ST_Drawer(void)
{
if (renderisnewtic)
{
LUA_HUD_ClearDrawList(luahuddrawlist_game);
for (i = 0; i <= splitscreen; i++)
LUA_HUD_ClearDrawList(luahuddrawlist_game[i]);
}
// No deadview!
@@ -1035,7 +1037,8 @@ void ST_Drawer(void)
ST_overlayDrawer();
}
LUA_HUD_DrawList(luahuddrawlist_game);
for (i = 0; i <= splitscreen; i++)
LUA_HUD_DrawList(luahuddrawlist_game[i]);
// draw Midnight Channel's overlay ontop
if (mapheaderinfo[gamemap-1]->typeoflevel & TOL_TV) // Very specific Midnight Channel stuff.