Add r_fullbright dvar
This commit is contained in:
parent
d48cadac89
commit
1f7ff35773
72
src/component/renderer.cpp
Normal file
72
src/component/renderer.cpp
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
#include <stdinc.hpp>
|
||||||
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
|
#include "game/game.hpp"
|
||||||
|
#include "game/dvars.hpp"
|
||||||
|
|
||||||
|
#include "component/command.hpp"
|
||||||
|
#include "component/scheduler.hpp"
|
||||||
|
|
||||||
|
#include <utils/hook.hpp>
|
||||||
|
|
||||||
|
namespace renderer
|
||||||
|
{
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
utils::hook::detour r_init_draw_method_hook;
|
||||||
|
utils::hook::detour r_update_front_end_dvar_options_hook;
|
||||||
|
|
||||||
|
int get_fullbright_technique()
|
||||||
|
{
|
||||||
|
switch (dvars::r_fullbright->current.integer)
|
||||||
|
{
|
||||||
|
case 3:
|
||||||
|
return 3;
|
||||||
|
case 2:
|
||||||
|
return 13;
|
||||||
|
default:
|
||||||
|
return game::TECHNIQUE_UNLIT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gfxdrawmethod()
|
||||||
|
{
|
||||||
|
game::gfxDrawMethod->drawScene = game::GFX_DRAW_SCENE_STANDARD;
|
||||||
|
game::gfxDrawMethod->baseTechType = dvars::r_fullbright->current.enabled ? get_fullbright_technique() : game::TECHNIQUE_LIT;
|
||||||
|
game::gfxDrawMethod->emissiveTechType = dvars::r_fullbright->current.enabled ? get_fullbright_technique() : game::TECHNIQUE_EMISSIVE;
|
||||||
|
game::gfxDrawMethod->forceTechType = dvars::r_fullbright->current.enabled ? get_fullbright_technique() : 254;
|
||||||
|
}
|
||||||
|
|
||||||
|
void r_init_draw_method_stub()
|
||||||
|
{
|
||||||
|
gfxdrawmethod();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool r_update_front_end_dvar_options_stub()
|
||||||
|
{
|
||||||
|
if (dvars::r_fullbright->modified)
|
||||||
|
{
|
||||||
|
dvars::r_fullbright->modified = false;
|
||||||
|
game::R_SyncRenderThread();
|
||||||
|
|
||||||
|
gfxdrawmethod();
|
||||||
|
}
|
||||||
|
|
||||||
|
return r_update_front_end_dvar_options_hook.invoke<bool>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class component final : public component_interface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void post_unpack() override
|
||||||
|
{
|
||||||
|
dvars::r_fullbright = dvars::register_int("r_fullbright", 0, 0, 3, game::DVAR_FLAG_SAVED);
|
||||||
|
|
||||||
|
r_init_draw_method_hook.create(game::base_address + 0x72F950, &r_init_draw_method_stub);
|
||||||
|
r_update_front_end_dvar_options_hook.create(game::base_address + 0x76EE70, &r_update_front_end_dvar_options_stub);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
REGISTER_COMPONENT(renderer::component)
|
@ -17,6 +17,8 @@ namespace dvars
|
|||||||
|
|
||||||
game::dvar_t* jump_enableFallDamage;
|
game::dvar_t* jump_enableFallDamage;
|
||||||
|
|
||||||
|
game::dvar_t* r_fullbright;
|
||||||
|
|
||||||
std::string dvar_get_vector_domain(const int components, const game::dvar_limits& domain)
|
std::string dvar_get_vector_domain(const int components, const game::dvar_limits& domain)
|
||||||
{
|
{
|
||||||
if (domain.vector.min == -FLT_MAX)
|
if (domain.vector.min == -FLT_MAX)
|
||||||
|
@ -18,6 +18,8 @@ namespace dvars
|
|||||||
|
|
||||||
extern game::dvar_t* jump_enableFallDamage;
|
extern game::dvar_t* jump_enableFallDamage;
|
||||||
|
|
||||||
|
extern game::dvar_t* r_fullbright;
|
||||||
|
|
||||||
extern std::vector<std::string> dvar_list;
|
extern std::vector<std::string> dvar_list;
|
||||||
|
|
||||||
std::string dvar_get_vector_domain(const int components, const game::dvar_limits& domain);
|
std::string dvar_get_vector_domain(const int components, const game::dvar_limits& domain);
|
||||||
|
@ -340,19 +340,19 @@ namespace scripting
|
|||||||
{"sub_7ff7de27d2f0", 402},
|
{"sub_7ff7de27d2f0", 402},
|
||||||
{"getnumparts", 403},
|
{"getnumparts", 403},
|
||||||
{"sub_7ff7de29eea0", 404},
|
{"sub_7ff7de29eea0", 404},
|
||||||
{"sub_7ff7de294120", 414},
|
{"iprintln", 414},
|
||||||
{"sub_7ff7de2941a0", 415},
|
{"iprintlnbold", 415},
|
||||||
{"nullsub_475", 416},
|
{"logstring", 416},
|
||||||
{"sub_7ff7de2a1680", 417},
|
{"getent", 417},
|
||||||
{"getentarray", 418},
|
{"getentarray", 418},
|
||||||
{"addstruct", 421},
|
{"spawnstruct", 421},
|
||||||
{"sub_7ff7de2942f0", 423},
|
{"isalive", 423},
|
||||||
{"isagent", 424},
|
{"isspawner", 424},
|
||||||
{"sub_7ff7de2673e0", 425},
|
{"missile_createattractororigin", 425},
|
||||||
{"sub_7ff7de2673f0", 426},
|
{"missile_createrepulsorent", 426},
|
||||||
{"sub_7ff7de267710", 427},
|
{"missile_createrepulsororigin", 427},
|
||||||
{"missiledeleteattractor", 429},
|
{"missile_deleteattractor", 429},
|
||||||
{"addagent", 431},
|
{"newhudelem", 431},
|
||||||
{"newclienthudelem", 432},
|
{"newclienthudelem", 432},
|
||||||
{"sub_7ff7de358350", 434},
|
{"sub_7ff7de358350", 434},
|
||||||
{"isvalidmissile", 435},
|
{"isvalidmissile", 435},
|
||||||
|
@ -733,4 +733,24 @@ namespace game
|
|||||||
unsigned __int16 childVariableBucket[65536];
|
unsigned __int16 childVariableBucket[65536];
|
||||||
ChildVariableValue childVariableValue[384000];
|
ChildVariableValue childVariableValue[384000];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum GfxDrawSceneMethod
|
||||||
|
{
|
||||||
|
GFX_DRAW_SCENE_STANDARD = 0x0,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum MaterialTechniqueType
|
||||||
|
{
|
||||||
|
TECHNIQUE_UNLIT = 8,
|
||||||
|
TECHNIQUE_EMISSIVE = 9,
|
||||||
|
TECHNIQUE_LIT = 13,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct GfxDrawMethod_s
|
||||||
|
{
|
||||||
|
int drawScene;
|
||||||
|
int baseTechType;
|
||||||
|
int emissiveTechType;
|
||||||
|
int forceTechType;
|
||||||
|
};
|
||||||
}
|
}
|
@ -59,6 +59,7 @@ namespace game
|
|||||||
const float* color, int style, int cursorPos, char cursor)> R_AddCmdDrawTextWithCursor{0x76CAF0};
|
const float* color, int style, int cursorPos, char cursor)> R_AddCmdDrawTextWithCursor{0x76CAF0};
|
||||||
WEAK symbol<Font_s*(const char* font, int size)> R_RegisterFont{0x746FE0};
|
WEAK symbol<Font_s*(const char* font, int size)> R_RegisterFont{0x746FE0};
|
||||||
WEAK symbol<int(const char* text, int maxChars, Font_s* font)> R_TextWidth{0x7472A0};
|
WEAK symbol<int(const char* text, int maxChars, Font_s* font)> R_TextWidth{0x7472A0};
|
||||||
|
WEAK symbol<void()> R_SyncRenderThread{0x76E7D0};
|
||||||
|
|
||||||
WEAK symbol<ScreenPlacement* ()> ScrPlace_GetViewPlacement{0x3E16A0};
|
WEAK symbol<ScreenPlacement* ()> ScrPlace_GetViewPlacement{0x3E16A0};
|
||||||
|
|
||||||
@ -82,6 +83,8 @@ namespace game
|
|||||||
|
|
||||||
WEAK symbol<gentity_s> g_entities{0x52DDDA0};
|
WEAK symbol<gentity_s> g_entities{0x52DDDA0};
|
||||||
|
|
||||||
|
WEAK symbol<GfxDrawMethod_s> gfxDrawMethod{0xEDF9E00};
|
||||||
|
|
||||||
WEAK symbol<int> keyCatchers{0x203F3C0};
|
WEAK symbol<int> keyCatchers{0x203F3C0};
|
||||||
|
|
||||||
WEAK symbol<PlayerKeyState> playerKeys{0x1E8767C};
|
WEAK symbol<PlayerKeyState> playerKeys{0x1E8767C};
|
||||||
|
Loading…
Reference in New Issue
Block a user