Use G_GamestateUsesLevel everywhere (and actually use levelloaded)

This commit is contained in:
GenericHeroGuy 2025-08-27 21:59:37 +02:00
parent 219acbb9cc
commit aa1ccafaea
6 changed files with 9 additions and 15 deletions

View file

@ -477,8 +477,7 @@ static void D_Display(void)
wipetypepre = wipedefs[wipedefindex];
// Fade to black first
if ((wipegamestate == FORCEWIPE ||
!(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction))) // fades to black on its own timing, always
if ((wipegamestate == FORCEWIPE || !G_GamestateUsesLevel()) // fades to black on its own timing, always
&& wipetypepre != UINT8_MAX)
{
if (rendermode != render_none)
@ -627,7 +626,7 @@ static void D_Display(void)
// change gamma if needed
// (GS_LEVEL handles this already due to level-specific palettes)
if (forcerefresh && !(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction)))
if (forcerefresh && !G_GamestateUsesLevel())
V_SetPalette(0);
// draw pause pic

View file

@ -6238,7 +6238,7 @@ void HWR_Switch(void)
HWR_LoadMapTextures(numtextures);
// Create plane polygons
if (!gl_maploaded && (gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction)))
if (!gl_maploaded && levelloaded)
{
HWR_ClearAllTextures();
HWR_LoadLevel();

View file

@ -3279,7 +3279,7 @@ static int lib_gAddGametype(lua_State *L)
static int Lcheckmapnumber (lua_State *L, int idx, const char *fun)
{
if (ISINLEVEL)
if (G_GamestateUsesLevel())
return luaL_optinteger(L, idx, lua_compatmode ? G_NativeMapToKart(gamemap) : gamemap);
else
{

View file

@ -253,7 +253,7 @@ static int mobj_get(lua_State *L)
enum mobj_e field = Lua_optoption(L, 2, NULL, mobj_opt);
lua_settop(L, 2);
if (!mo || !ISINLEVEL) {
if (!mo || !G_GamestateUsesLevel()) {
if (field == mobj_valid) {
lua_pushboolean(L, 0);
return 1;

View file

@ -18,6 +18,7 @@
#include "d_player.h"
#include "g_state.h"
#include "taglist.h"
#include "g_game.h" // G_GamestateUsesLevel
#include "blua/lua.h"
#include "blua/lualib.h"
@ -137,10 +138,7 @@ void COM_Lua_f(void);
// uncomment if you want seg_t/node_t in Lua
// #define HAVE_LUA_SEGS
#define ISINLEVEL \
(gamestate == GS_LEVEL || titlemapinaction)
#define INLEVEL if (! ISINLEVEL)\
#define INLEVEL if (!G_GamestateUsesLevel())\
return luaL_error(L, "This can only be used in a level!");
#ifdef __cplusplus

View file

@ -255,10 +255,7 @@ static void M_DrawRenderStats(void)
perfstatcol_t batchcalls_col = {220, 200, V_PURPLEMAP, batchcalls_row};
boolean rendering = (
gamestate == GS_LEVEL ||
(gamestate == GS_TITLESCREEN && titlemapinaction)
);
boolean rendering = G_GamestateUsesLevel();
draw_row = 10;
M_DrawPerfTiming(&frametime_col);
@ -618,7 +615,7 @@ void M_DrawPerfStats(void)
}
else if (cv_perfstats.value == PS_THINKFRAME) // lua thinkframe
{
if (!(gamestate == GS_LEVEL || (gamestate == GS_TITLESCREEN && titlemapinaction)))
if (!G_GamestateUsesLevel())
return;
if (vid.width < 640 || vid.height < 400) // low resolution
{