mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 20:41:46 +00:00
Merge branch 'debug-holy-textures' into 'master'
Debugging for holey textures on walls Closes #1038 See merge request KartKrew/Kart!1919
This commit is contained in:
commit
7a54b3eb3b
5 changed files with 103 additions and 1 deletions
|
|
@ -72,6 +72,7 @@ add_executable(SRB2SDL2 MACOSX_BUNDLE WIN32
|
||||||
r_data.c
|
r_data.c
|
||||||
r_debug.cpp
|
r_debug.cpp
|
||||||
r_debug_parser.cpp
|
r_debug_parser.cpp
|
||||||
|
r_debug_printer.cpp
|
||||||
r_draw.cpp
|
r_draw.cpp
|
||||||
r_fps.c
|
r_fps.c
|
||||||
r_main.cpp
|
r_main.cpp
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,7 @@
|
||||||
#include "k_dialogue.h"
|
#include "k_dialogue.h"
|
||||||
#include "k_bans.h"
|
#include "k_bans.h"
|
||||||
#include "k_credits.h"
|
#include "k_credits.h"
|
||||||
|
#include "r_debug.hpp"
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
#include "hardware/hw_main.h" // 3D View Rendering
|
#include "hardware/hw_main.h" // 3D View Rendering
|
||||||
|
|
@ -663,6 +664,7 @@ static bool D_Display(void)
|
||||||
{
|
{
|
||||||
AM_Drawer();
|
AM_Drawer();
|
||||||
ST_Drawer();
|
ST_Drawer();
|
||||||
|
srb2::r_debug::draw_frame_list();
|
||||||
F_TextPromptDrawer();
|
F_TextPromptDrawer();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -858,6 +860,7 @@ void D_SRB2Loop(void)
|
||||||
|
|
||||||
g_dc = {};
|
g_dc = {};
|
||||||
Z_Frame_Reset();
|
Z_Frame_Reset();
|
||||||
|
srb2::r_debug::clear_frame_list();
|
||||||
|
|
||||||
{
|
{
|
||||||
// Casting the return value of a function is bad practice (apparently)
|
// 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/memory.h"
|
||||||
#include "core/thread_pool.h"
|
#include "core/thread_pool.h"
|
||||||
#include "k_terrain.h"
|
#include "k_terrain.h"
|
||||||
|
#include "r_debug.hpp"
|
||||||
|
|
||||||
extern "C" consvar_t cv_debugfinishline;
|
extern "C" consvar_t cv_debugfinishline;
|
||||||
|
|
||||||
|
|
@ -2064,7 +2065,13 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||||
auto get_flat_tex = [](INT32 texnum)
|
auto get_flat_tex = [](INT32 texnum)
|
||||||
{
|
{
|
||||||
texnum = R_GetTextureNum(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);
|
||||||
|
// R_DrawWallColumn cannot render holey textures
|
||||||
|
return R_GetTextureNum(R_CheckTextureNumForName("TRANSER1"));
|
||||||
|
}
|
||||||
|
return texnum;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!backsector)
|
if (!backsector)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue