fix? hoovy crash + trying to improve fake name

This commit is contained in:
nullifiedcat 2017-05-02 23:31:18 +03:00
parent 641b1cfbb1
commit 3558bbb4e5
3 changed files with 13 additions and 5 deletions

View File

@ -34,7 +34,7 @@ static CatVar ammobox(CV_SWITCH, "glow_ammo", "0", "Ammoboxes", "Render glow on
static CatVar buildings(CV_SWITCH, "glow_buildings", "0", "Buildings", "Render glow on buildings");
static CatVar stickies(CV_SWITCH, "glow_stickies", "0", "Stickies", "Render glow on stickybombs");
static CatVar teammate_buildings(CV_SWITCH, "glow_teammate_buildings", "0", "Teammate Buildings", "Render glow on teammates buildings");
//static CatVar weapons_white(CV_SWITCH, "glow_weapons_white", "1", "White Weapon Glow", "Weapons will glow white");
struct ShaderStencilState_t
{

View File

@ -184,6 +184,10 @@ void FrameStageNotify_hook(void* thisptr, int stage) {
}
}
if (stage == FRAME_NET_UPDATE_START) {
static int next_name_change = 0;
if (next_name_change == 0) {
need_name_change = true;
} else next_name_change--;
if (force_name.convar->m_StringLength > 2 && need_name_change) {
INetChannel* ch = (INetChannel*)g_IEngine->GetNetChannelInfo();
if (ch) {
@ -194,10 +198,12 @@ void FrameStageNotify_hook(void* thisptr, int stage) {
ch->SendNetMsg(setname, false);
need_name_change = false;
}
next_name_change = 60 * 100;
}
static ConVar* name_cv = g_ICvar->FindVar("name");
name_cv->SetValue(force_name.GetString());
//name_cv->SetValue(force_name.GetString());
name_cv->m_pszString = (char*)strfmt("%s", force_name.GetString());
name_cv->m_StringLength = strlen(force_name.GetString()) + 1;
}
if (TF && cathook && !g_Settings.bInvalid && stage == FRAME_RENDER_START) {
if (glow_enabled) {
@ -334,8 +340,8 @@ void LevelInit_hook(void* thisptr, const char* newmap) {
//name_cv->m_pszString = strfmt("%s", force_name.GetString());
}
static ConVar* name_cv = g_ICvar->FindVar("name");
name_cv->SetValue(force_name.GetString());
name_cv->m_pszString = (char*)strfmt("%s", force_name.GetString());
name_cv->m_StringLength = strlen(force_name.GetString()) + 1;
}
}
@ -361,8 +367,8 @@ void LevelShutdown_hook(void* thisptr) {
//name_cv->m_pszString = strfmt("%s", force_name.GetString());
}
static ConVar* name_cv = g_ICvar->FindVar("name");
name_cv->SetValue(force_name.GetString());
name_cv->m_pszString = (char*)strfmt("%s", force_name.GetString());
name_cv->m_StringLength = strlen(force_name.GetString()) + 1;
}
}

View File

@ -10,7 +10,9 @@
static bool hoovy_list[32] = { 0 };
bool HasSandvichOut(CachedEntity* entity) {
CachedEntity* weapon = ENTITY(CE_INT(entity, netvar.hActiveWeapon) & 0xFFF);
int weapon_idx = CE_INT(entity, netvar.hActiveWeapon) & 0xFFF;
if (!(weapon_idx > 0 && weapon_idx < HIGHEST_ENTITY)) return false;
CachedEntity* weapon = ENTITY(weapon_idx);
if (CE_GOOD(weapon)) {
if (weapon->m_iClassID == g_pClassID->CTFLunchBox && CE_INT(entity, netvar.iClass) == tf_heavy) {
return true;