This is sad tbh

This commit is contained in:
TotallyNotElite 2018-09-11 20:06:00 +02:00
parent 603d548198
commit cc6a171f32
4 changed files with 27 additions and 7 deletions

View File

@ -21,7 +21,7 @@ DEFINE_HOOKED_METHOD(DrawModelExecute, void, IVModelRender *this_,
return original::DrawModelExecute(this_, state, info, bone);
if (!(spectator_target || no_arms || no_hats ||
(clean_screenshots && g_IEngine->IsTakingScreenshot()) ||
(*clean_screenshots && g_IEngine->IsTakingScreenshot()) ||
CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer()))
{
return original::DrawModelExecute(this_, state, info, bone);

View File

@ -74,8 +74,11 @@ void save_thread(const CCommand &args)
writer.saveTo(
std::string(DATA_PATH "/configs/") + args.Arg(1) + ".conf", false);
}
logging::Info("cat_save: Sorting configs...");
getAndSortAllConfigs();
logging::Info("cat_save: Closing dir...");
closedir(config_directory);
logging::Info("cat_save: Enabeling cathook...");
settings::RVarLock.store(false);
}
@ -142,7 +145,6 @@ static void getAndSortAllConfigs()
{
std::string s(ent->d_name);
s = s.substr(0, s.find_last_of("."));
logging::Info(s.c_str());
sortedConfigs.push_back(s);
}
std::sort(sortedConfigs.begin(), sortedConfigs.end());

View File

@ -19,9 +19,9 @@ bool settings::SettingsWriter::saveTo(std::string path, bool only_changed)
stream.open(path, std::ios::out);
if (stream.bad() || !stream.is_open() || stream.fail() || !stream)
if (!stream || stream.bad() || !stream.is_open() || stream.fail())
{
logging::Info("FATAL: cat_save FAILED!");
logging::Info("cat_save: FATAL! FAILED to create stream!");
return false;
}
@ -46,9 +46,12 @@ bool settings::SettingsWriter::saveTo(std::string path, bool only_changed)
write(v.first, v.second);
stream.flush();
}
if (stream.bad() || stream.fail() || !stream)
if (!stream || stream.bad() || stream.fail())
logging::Info("cat_save: FATAL! Stream bad!");
logging::Info("cat_save: Finished");
stream.close();
if (stream.fail())
logging::Info("cat_save: FATAL! Stream bad (2)!");
return true;
}
@ -56,8 +59,13 @@ void settings::SettingsWriter::write(std::string name, IVariable *variable)
{
writeEscaped(name);
stream << "=";
writeEscaped(variable->toString());
stream << '\n';
if (variable)
writeEscaped(variable->toString());
else
{
logging::Info("cat_save: FATAL! Variable invalid! %s", name.c_str());
}
stream << std::endl;
}
void settings::SettingsWriter::writeEscaped(std::string str)

View File

@ -88,6 +88,8 @@ Timer t{};
int prevcolor = -1;
rgba_t EffectChams::ChamsColor(IClientEntity *entity)
{
if (!isHackActive() || !*enable)
return colors::empty;;
CachedEntity *ent = ENTITY(entity->entindex());
if (disco_chams)
{
@ -188,6 +190,8 @@ rgba_t EffectChams::ChamsColor(IClientEntity *entity)
bool EffectChams::ShouldRenderChams(IClientEntity *entity)
{
if (!isHackActive() || !*enable)
return false;
if (!enable)
return false;
if (entity->entindex() < 0)
@ -245,6 +249,8 @@ bool EffectChams::ShouldRenderChams(IClientEntity *entity)
void EffectChams::RenderChamsRecursive(IClientEntity *entity)
{
if (!isHackActive() || !*enable)
return;
entity->DrawModel(1);
if (!recursive)
@ -285,6 +291,8 @@ void EffectChams::RenderChamsRecursive(IClientEntity *entity)
void EffectChams::RenderChams(IClientEntity *entity)
{
if (!isHackActive() || !*enable)
return;
CMatRenderContextPtr ptr(GET_RENDER_CONTEXT);
if (ShouldRenderChams(entity))
{
@ -315,6 +323,8 @@ void EffectChams::RenderChams(IClientEntity *entity)
void EffectChams::Render(int x, int y, int w, int h)
{
PROF_SECTION(DRAW_chams);
if (!isHackActive())
return;
if (!enable)
return;
if (!init)