Fix two bugs

- Make a Warp Menu entry name and description being be less vague and ambiguous
- Fix Arm/Weapon chams breaking normal chams and making them flat
This commit is contained in:
BenCat07 2020-12-28 15:28:30 +01:00
parent 962dc06492
commit 8caa3e1bd1
2 changed files with 17 additions and 4 deletions

View File

@ -28,7 +28,7 @@
<Box padding="12 6 6 6" width="content" height="content" name="Rapidfire" x="210">
<List width="185">
<AutoVariable width="fill" target="warp.rapidfire" label="Enable Rapidfire" tooltip="Allows you to shoot multiple shots at once or reduce time between shots."/>
<AutoVariable width="fill" target="warp.rapidfire.distance" label="Minimum distance" tooltip="How close an enemy has to be to be able to rapidfire. 0 is off."/>
<AutoVariable width="fill" target="warp.rapidfire.distance" label="Maximum distance" tooltip="How close an enemy has to be for rapidfire to trigger. 0 = unlimited range."/>
<AutoVariable width="fill" target="warp.rapidfire.zoom" label="Enable Rapid zoom" tooltip="Allows you to instantly zoom in."/>
<AutoVariable width="fill" target="warp.rapidfire.no-movement" label="Prevent movement in rapidfire" tooltip="Attempt to not move when Rapidfiring."/>
<AutoVariable width="fill" target="warp.rapidfire.key" label="Rapidfire key" tooltip="Optional. If set you can use this key to control when to rapidfire."/>

View File

@ -133,6 +133,11 @@ static settings::Boolean local_weapon_chams_overlay_chams{ "chams.overlay.local-
static settings::Rgba local_weapon_overlaychams_color{ "chams.local-weapon.overlaycolor", "000000ff" };
static settings::Rgba local_weapon_basechams_color{ "chams.local-weapon.basecolor", "000000ff" };
// Can we render arms/weapon chams right now? We need to draw on some player atleast once before it works without flat
// chams.
static bool should_draw_fp_chams = false;
static Timer should_draw_fp_chams_timer;
class Materials
{
public:
@ -241,7 +246,15 @@ static InitRoutine init_dme([]() {
// Purpose => Returns true if we should render provided internal entity
bool ShouldRenderChams(IClientEntity *entity)
{
if (!enable || CE_BAD(LOCAL_E))
if (CE_BAD(LOCAL_E))
return false;
if ((arms_chams || local_weapon_chams) && !should_draw_fp_chams)
{
should_draw_fp_chams = true;
should_draw_fp_chams_timer.update();
return true;
}
if (!enable)
return false;
if (entity->entindex() < 0)
return false;
@ -628,7 +641,7 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_, const DrawMod
if (name)
{
std::string sname = name;
if ((sname.find("arms") != std::string::npos && sname.find("yeti") == std::string::npos) || sname.find("c_engineer_gunslinger") != std::string::npos)
if (should_draw_fp_chams && should_draw_fp_chams_timer.check(500) && ((sname.find("arms") != std::string::npos && sname.find("yeti") == std::string::npos) || sname.find("c_engineer_gunslinger") != std::string::npos))
{
if (no_arms)
return;
@ -681,7 +694,7 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_, const DrawMod
if (!do_draw)
return;
if (local_weapon_chams && info.entity_index == -1 && sname.find("arms") == std::string::npos && (sname.find("models/weapons") != std::string::npos || sname.find("models/workshop/weapons") != std::string::npos || sname.find("models/workshop_partner/weapons") != std::string::npos))
if (should_draw_fp_chams && should_draw_fp_chams_timer.check(500) && local_weapon_chams && info.entity_index == -1 && sname.find("arms") == std::string::npos && (sname.find("models/weapons") != std::string::npos || sname.find("models/workshop/weapons") != std::string::npos || sname.find("models/workshop_partner/weapons") != std::string::npos))
{
// Backup original colors
rgba_t original_color;