mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-27 21:01:04 +00:00
Merge branch 'lua-hudlib' into 'master'
Small Lua hud library improvements See merge request KartKrew/Kart!73
This commit is contained in:
commit
c32d0df6c2
4 changed files with 75 additions and 114 deletions
|
@ -108,8 +108,6 @@ static patch_t *crosshair[HU_CROSSHAIRS]; // 3 precached crosshair graphics
|
||||||
// protos.
|
// protos.
|
||||||
// -------
|
// -------
|
||||||
static void HU_DrawRankings(void);
|
static void HU_DrawRankings(void);
|
||||||
//static void HU_DrawCoopOverlay(void);
|
|
||||||
//static void HU_DrawNetplayCoopOverlay(void);
|
|
||||||
|
|
||||||
//======================================================================
|
//======================================================================
|
||||||
// KEYBOARD LAYOUTS FOR ENTERING TEXT
|
// KEYBOARD LAYOUTS FOR ENTERING TEXT
|
||||||
|
@ -2111,16 +2109,12 @@ void HU_Drawer(void)
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
if (LUA_HudEnabled(hud_rankings))
|
if (LUA_HudEnabled(hud_rankings))
|
||||||
#endif
|
#endif
|
||||||
HU_DrawRankings();
|
HU_DrawRankings();
|
||||||
//if (gametype == GT_COOP)
|
|
||||||
//HU_DrawNetplayCoopOverlay();
|
|
||||||
}
|
|
||||||
//else
|
|
||||||
//HU_DrawCoopOverlay();
|
|
||||||
#ifdef HAVE_BLUA
|
#ifdef HAVE_BLUA
|
||||||
LUAh_ScoresHUD();
|
LUAh_ScoresHUD();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (gamestate != GS_LEVEL)
|
if (gamestate != GS_LEVEL)
|
||||||
return;
|
return;
|
||||||
|
@ -2706,65 +2700,6 @@ static void HU_DrawRankings(void)
|
||||||
HU_DrawSpectatorTicker();
|
HU_DrawSpectatorTicker();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static void HU_DrawCoopOverlay(void)
|
|
||||||
{
|
|
||||||
if (token
|
|
||||||
#ifdef HAVE_BLUA
|
|
||||||
&& LUA_HudEnabled(hud_tokens)
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
|
||||||
V_DrawString(168, 176, 0, va("- %d", token));
|
|
||||||
V_DrawSmallScaledPatch(148, 172, 0, tokenicon);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_BLUA
|
|
||||||
if (LUA_HudEnabled(hud_tabemblems))
|
|
||||||
#endif
|
|
||||||
if (!modifiedgame || savemoddata)
|
|
||||||
{
|
|
||||||
V_DrawString(160, 144, 0, va("- %d/%d", M_CountEmblems(), numemblems+numextraemblems));
|
|
||||||
V_DrawScaledPatch(128, 144 - SHORT(emblemicon->height)/4, 0, emblemicon);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAVE_BLUA
|
|
||||||
if (!LUA_HudEnabled(hud_coopemeralds))
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (emeralds & EMERALD1)
|
|
||||||
V_DrawScaledPatch((BASEVIDWIDTH/2)-8 , (BASEVIDHEIGHT/3)-32, 0, emeraldpics[0]);
|
|
||||||
if (emeralds & EMERALD2)
|
|
||||||
V_DrawScaledPatch((BASEVIDWIDTH/2)-8+24, (BASEVIDHEIGHT/3)-16, 0, emeraldpics[1]);
|
|
||||||
if (emeralds & EMERALD3)
|
|
||||||
V_DrawScaledPatch((BASEVIDWIDTH/2)-8+24, (BASEVIDHEIGHT/3)+16, 0, emeraldpics[2]);
|
|
||||||
if (emeralds & EMERALD4)
|
|
||||||
V_DrawScaledPatch((BASEVIDWIDTH/2)-8 , (BASEVIDHEIGHT/3)+32, 0, emeraldpics[3]);
|
|
||||||
if (emeralds & EMERALD5)
|
|
||||||
V_DrawScaledPatch((BASEVIDWIDTH/2)-8-24, (BASEVIDHEIGHT/3)+16, 0, emeraldpics[4]);
|
|
||||||
if (emeralds & EMERALD6)
|
|
||||||
V_DrawScaledPatch((BASEVIDWIDTH/2)-8-24, (BASEVIDHEIGHT/3)-16, 0, emeraldpics[5]);
|
|
||||||
if (emeralds & EMERALD7)
|
|
||||||
V_DrawScaledPatch((BASEVIDWIDTH/2)-8 , (BASEVIDHEIGHT/3) , 0, emeraldpics[6]);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void HU_DrawNetplayCoopOverlay(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
#ifdef HAVE_BLUA
|
|
||||||
if (!LUA_HudEnabled(hud_coopemeralds))
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (i = 0; i < 7; ++i)
|
|
||||||
{
|
|
||||||
if (emeralds & (1 << i))
|
|
||||||
V_DrawScaledPatch(20 + (i * 20), 6, 0, emeraldpics[i]);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
// Interface to CECHO settings for the outside world, avoiding the
|
// Interface to CECHO settings for the outside world, avoiding the
|
||||||
// expense (and security problems) of going via the console buffer.
|
// expense (and security problems) of going via the console buffer.
|
||||||
void HU_ClearCEcho(void)
|
void HU_ClearCEcho(void)
|
||||||
|
|
64
src/k_kart.c
64
src/k_kart.c
|
@ -20,6 +20,7 @@
|
||||||
#include "m_cond.h"
|
#include "m_cond.h"
|
||||||
#include "k_kart.h"
|
#include "k_kart.h"
|
||||||
#include "f_finale.h"
|
#include "f_finale.h"
|
||||||
|
#include "lua_hud.h" // For Lua hud checks
|
||||||
|
|
||||||
// SOME IMPORTANT VARIABLES DEFINED IN DOOMDEF.H:
|
// SOME IMPORTANT VARIABLES DEFINED IN DOOMDEF.H:
|
||||||
// gamespeed is cc (0 for easy, 1 for normal, 2 for hard)
|
// gamespeed is cc (0 for easy, 1 for normal, 2 for hard)
|
||||||
|
@ -6507,6 +6508,11 @@ static boolean K_drawKartPositionFaces(void)
|
||||||
|
|
||||||
if (numplayersingame <= 1)
|
if (numplayersingame <= 1)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
if (!LUA_HudEnabled(hud_minirankings))
|
||||||
|
return false; // Don't proceed but still return true for free play above if HUD is disabled.
|
||||||
|
#endif
|
||||||
|
|
||||||
for (j = 0; j < numplayersingame; j++)
|
for (j = 0; j < numplayersingame; j++)
|
||||||
{
|
{
|
||||||
|
@ -7732,7 +7738,12 @@ void K_drawKartHUD(void)
|
||||||
K_drawKartFirstPerson();
|
K_drawKartFirstPerson();
|
||||||
|
|
||||||
if (splitscreen == 2) // Player 4 in 3P is the minimap :p
|
if (splitscreen == 2) // Player 4 in 3P is the minimap :p
|
||||||
|
{
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
if (LUA_HudEnabled(hud_minimap))
|
||||||
|
#endif
|
||||||
K_drawKartMinimap();
|
K_drawKartMinimap();
|
||||||
|
}
|
||||||
|
|
||||||
// Draw full screen stuff that turns off the rest of the HUD
|
// Draw full screen stuff that turns off the rest of the HUD
|
||||||
if (mapreset && stplyr == &players[displayplayer])
|
if (mapreset && stplyr == &players[displayplayer])
|
||||||
|
@ -7757,25 +7768,45 @@ void K_drawKartHUD(void)
|
||||||
K_drawKartPlayerCheck();
|
K_drawKartPlayerCheck();
|
||||||
|
|
||||||
if (splitscreen == 0 && cv_kartminimap.value)
|
if (splitscreen == 0 && cv_kartminimap.value)
|
||||||
K_drawKartMinimap(); // 3P splitscreen is handled above
|
{
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
if (LUA_HudEnabled(hud_minimap))
|
||||||
|
#endif
|
||||||
|
K_drawKartMinimap(); // 3P splitscreen is handled above
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Draw the item window
|
// Draw the item window
|
||||||
K_drawKartItem();
|
#ifdef HAVE_BLUA
|
||||||
|
if (LUA_HudEnabled(hud_item))
|
||||||
|
#endif
|
||||||
|
K_drawKartItem();
|
||||||
|
|
||||||
// Draw WANTED status
|
// Draw WANTED status
|
||||||
if (G_BattleGametype())
|
if (G_BattleGametype())
|
||||||
K_drawKartWanted();
|
{
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
if (LUA_HudEnabled(hud_wanted))
|
||||||
|
#endif
|
||||||
|
K_drawKartWanted();
|
||||||
|
}
|
||||||
|
|
||||||
// If not splitscreen, draw...
|
// If not splitscreen, draw...
|
||||||
if (!splitscreen)
|
if (!splitscreen)
|
||||||
{
|
{
|
||||||
// Draw the timestamp
|
// Draw the timestamp
|
||||||
K_drawKartTimestamp(stplyr->realtime, TIME_X, TIME_Y, gamemap, true);
|
#ifdef HAVE_BLUA
|
||||||
|
if (LUA_HudEnabled(hud_time))
|
||||||
|
#endif
|
||||||
|
K_drawKartTimestamp(stplyr->realtime, TIME_X, TIME_Y, gamemap, true);
|
||||||
|
|
||||||
if (!modeattacking)
|
if (!modeattacking)
|
||||||
{
|
{
|
||||||
// The top-four faces on the left
|
// The top-four faces on the left
|
||||||
isfreeplay = K_drawKartPositionFaces();
|
/*#ifdef HAVE_BLUA
|
||||||
|
if (LUA_HudEnabled(hud_minirankings))
|
||||||
|
#endif*/
|
||||||
|
isfreeplay = K_drawKartPositionFaces();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7784,12 +7815,18 @@ void K_drawKartHUD(void)
|
||||||
if (G_RaceGametype()) // Race-only elements
|
if (G_RaceGametype()) // Race-only elements
|
||||||
{
|
{
|
||||||
// Draw the lap counter
|
// Draw the lap counter
|
||||||
K_drawKartLaps();
|
#ifdef HAVE_BLUA
|
||||||
|
if (LUA_HudEnabled(hud_gametypeinfo))
|
||||||
|
#endif
|
||||||
|
K_drawKartLaps();
|
||||||
|
|
||||||
if (!splitscreen)
|
if (!splitscreen)
|
||||||
{
|
{
|
||||||
// Draw the speedometer
|
// Draw the speedometer
|
||||||
// TODO: Make a better speedometer.
|
// TODO: Make a better speedometer.
|
||||||
|
#ifdef HAVE_BLUA
|
||||||
|
if (LUA_HudEnabled(hud_speedometer))
|
||||||
|
#endif
|
||||||
K_drawKartSpeedometer();
|
K_drawKartSpeedometer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7798,18 +7835,27 @@ void K_drawKartHUD(void)
|
||||||
else if (!modeattacking)
|
else if (!modeattacking)
|
||||||
{
|
{
|
||||||
// Draw the numerical position
|
// Draw the numerical position
|
||||||
K_DrawKartPositionNum(stplyr->kartstuff[k_position]);
|
#ifdef HAVE_BLUA
|
||||||
|
if (LUA_HudEnabled(hud_position))
|
||||||
|
#endif
|
||||||
|
K_DrawKartPositionNum(stplyr->kartstuff[k_position]);
|
||||||
}
|
}
|
||||||
else //if (!(demoplayback && hu_showscores))
|
else //if (!(demoplayback && hu_showscores))
|
||||||
{
|
{
|
||||||
// Draw the input UI
|
// Draw the input UI
|
||||||
K_drawInput();
|
#ifdef HAVE_BLUA
|
||||||
|
if (LUA_HudEnabled(hud_position))
|
||||||
|
#endif
|
||||||
|
K_drawInput();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (G_BattleGametype()) // Battle-only
|
else if (G_BattleGametype()) // Battle-only
|
||||||
{
|
{
|
||||||
// Draw the hits left!
|
// Draw the hits left!
|
||||||
K_drawKartBumpersOrKarma();
|
#ifdef HAVE_BLUA
|
||||||
|
if (LUA_HudEnabled(hud_gametypeinfo))
|
||||||
|
#endif
|
||||||
|
K_drawKartBumpersOrKarma();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,26 +13,17 @@
|
||||||
enum hud {
|
enum hud {
|
||||||
hud_stagetitle = 0,
|
hud_stagetitle = 0,
|
||||||
hud_textspectator,
|
hud_textspectator,
|
||||||
// Singleplayer / Co-op
|
|
||||||
hud_score,
|
|
||||||
hud_time,
|
hud_time,
|
||||||
hud_rings,
|
hud_gametypeinfo,
|
||||||
hud_lives,
|
hud_minimap,
|
||||||
// Match / CTF / Tag / Ringslinger
|
hud_item,
|
||||||
hud_weaponrings,
|
hud_position,
|
||||||
hud_powerstones,
|
hud_minirankings, // Rankings to the left
|
||||||
// NiGHTS mode
|
hud_wanted,
|
||||||
hud_nightslink,
|
hud_speedometer,
|
||||||
hud_nightsdrill,
|
hud_rankings, // Tab rankings
|
||||||
hud_nightsrings,
|
|
||||||
hud_nightsscore,
|
|
||||||
hud_nightstime,
|
|
||||||
hud_nightsrecords,
|
|
||||||
// TAB scores overlays
|
|
||||||
hud_rankings,
|
|
||||||
hud_coopemeralds,
|
|
||||||
hud_tokens,
|
|
||||||
hud_tabemblems,
|
|
||||||
hud_MAX
|
hud_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -39,25 +39,15 @@ static const char *const hud_disable_options[] = {
|
||||||
"stagetitle",
|
"stagetitle",
|
||||||
"textspectator",
|
"textspectator",
|
||||||
|
|
||||||
"score",
|
|
||||||
"time",
|
"time",
|
||||||
"rings",
|
"gametypeinfo", // Bumpers / Karma / Laps depending on gametype
|
||||||
"lives",
|
"minimap",
|
||||||
|
"item",
|
||||||
"weaponrings",
|
"position",
|
||||||
"powerstones",
|
"minirankings", // Gametype rankings to the left
|
||||||
|
"wanted",
|
||||||
"nightslink",
|
"speedometer",
|
||||||
"nightsdrill",
|
|
||||||
"nightsrings",
|
|
||||||
"nightsscore",
|
|
||||||
"nightstime",
|
|
||||||
"nightsrecords",
|
|
||||||
|
|
||||||
"rankings",
|
"rankings",
|
||||||
"coopemeralds",
|
|
||||||
"tokens",
|
|
||||||
"tabemblems",
|
|
||||||
NULL};
|
NULL};
|
||||||
|
|
||||||
enum hudinfo {
|
enum hudinfo {
|
||||||
|
@ -646,7 +636,6 @@ static int lib_hudenabled(lua_State *L)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// add a HUD element for rendering
|
// add a HUD element for rendering
|
||||||
static int lib_hudadd(lua_State *L)
|
static int lib_hudadd(lua_State *L)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue