mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-01-08 16:03:26 +00:00
devmode render: show a list of errored holey textures on the HUD
Holey textures (textures with transparent pixels) cannot be used on upper/lower textures or on 1-sided linedefs. If the game tries to render this, the texture name will appear on the HUD if devmode render is turned on.
This commit is contained in:
parent
da84a94362
commit
38c9c5f9a7
5 changed files with 102 additions and 1 deletions
|
|
@ -72,6 +72,7 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
|
|||
r_data.c
|
||||
r_debug.cpp
|
||||
r_debug_parser.cpp
|
||||
r_debug_printer.cpp
|
||||
r_draw.cpp
|
||||
r_fps.c
|
||||
r_main.cpp
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@
|
|||
#include "k_dialogue.h"
|
||||
#include "k_bans.h"
|
||||
#include "k_credits.h"
|
||||
#include "r_debug.hpp"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hardware/hw_main.h" // 3D View Rendering
|
||||
|
|
@ -663,6 +664,7 @@ static bool D_Display(void)
|
|||
{
|
||||
AM_Drawer();
|
||||
ST_Drawer();
|
||||
srb2::r_debug::draw_frame_list();
|
||||
F_TextPromptDrawer();
|
||||
break;
|
||||
}
|
||||
|
|
@ -858,6 +860,7 @@ void D_SRB2Loop(void)
|
|||
|
||||
g_dc = {};
|
||||
Z_Frame_Reset();
|
||||
srb2::r_debug::clear_frame_list();
|
||||
|
||||
{
|
||||
// Casting the return value of a function is bad practice (apparently)
|
||||
|
|
|
|||
24
src/r_debug.hpp
Normal file
24
src/r_debug.hpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// DR. ROBOTNIK'S RING RACERS
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2024 by James Robert Roman.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef r_debug_hpp
|
||||
#define r_debug_hpp
|
||||
|
||||
#include "doomtype.h"
|
||||
|
||||
namespace srb2::r_debug
|
||||
{
|
||||
|
||||
void add_texture_to_frame_list(INT32 texnum);
|
||||
void clear_frame_list();
|
||||
void draw_frame_list();
|
||||
|
||||
}; // namespace srb2::r_debug
|
||||
|
||||
#endif/*r_debug_hpp*/
|
||||
67
src/r_debug_printer.cpp
Normal file
67
src/r_debug_printer.cpp
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
// DR. ROBOTNIK'S RING RACERS
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2024 by James Robert Roman.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <string_view>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "r_debug.hpp"
|
||||
#include "v_draw.hpp"
|
||||
|
||||
#include "doomdef.h"
|
||||
#include "doomtype.h"
|
||||
#include "r_textures.h"
|
||||
#include "screen.h"
|
||||
|
||||
using srb2::Draw;
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
std::unordered_set<INT32> frame_list;
|
||||
|
||||
}; // namespace
|
||||
|
||||
namespace srb2::r_debug
|
||||
{
|
||||
|
||||
void add_texture_to_frame_list(INT32 texnum)
|
||||
{
|
||||
if (cht_debug & DBG_RENDER)
|
||||
{
|
||||
frame_list.insert(texnum);
|
||||
}
|
||||
}
|
||||
|
||||
void clear_frame_list()
|
||||
{
|
||||
frame_list.clear();
|
||||
}
|
||||
|
||||
void draw_frame_list()
|
||||
{
|
||||
if (!(cht_debug & DBG_RENDER))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Draw line = Draw(4, BASEVIDHEIGHT - 20)
|
||||
.font(Draw::Font::kConsole)
|
||||
.scale(0.5)
|
||||
.flags(V_ORANGEMAP | V_SNAPTOLEFT | V_SNAPTOBOTTOM);
|
||||
|
||||
line.y(-4 * static_cast<int>(frame_list.size() - 1)).size(32, 4 * frame_list.size()).fill(31);
|
||||
|
||||
for (INT32 texnum : frame_list)
|
||||
{
|
||||
line.text("{}", std::string_view {textures[texnum]->name, 8});
|
||||
line = line.y(-4);
|
||||
}
|
||||
}
|
||||
|
||||
}; // namespace srb2::r_debug
|
||||
|
|
@ -35,6 +35,7 @@
|
|||
#include "core/memory.h"
|
||||
#include "core/thread_pool.h"
|
||||
#include "k_terrain.h"
|
||||
#include "r_debug.hpp"
|
||||
|
||||
extern "C" consvar_t cv_debugfinishline;
|
||||
|
||||
|
|
@ -2064,7 +2065,12 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
|||
auto get_flat_tex = [](INT32 texnum)
|
||||
{
|
||||
texnum = R_GetTextureNum(texnum);
|
||||
return textures[texnum]->holes ? 0 : texnum; // R_DrawWallColumn cannot render holey textures
|
||||
if (textures[texnum]->holes)
|
||||
{
|
||||
srb2::r_debug::add_texture_to_frame_list(texnum);
|
||||
return 0; // R_DrawWallColumn cannot render holey textures
|
||||
}
|
||||
return texnum;
|
||||
};
|
||||
|
||||
if (!backsector)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue