fix: crash on cs_office

visibility check is disabled on cs_office because of a crash in the parser, not my fault
This commit is contained in:
2024-01-04 18:20:27 +01:00
parent 7122df6f70
commit 21f0b0d195
2 changed files with 10 additions and 5 deletions

View File

@@ -160,7 +160,7 @@
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
<AdditionalDependencies>valve-bsp-parser.lib;%(AdditionalDependencies)</AdditionalDependencies>

View File

@@ -75,6 +75,10 @@ void Draw() {
RGBA Cyan = { 0, 231, 255, 255 };
if (crosshair) DrawCircleFilled(Process::WindowWidth/2, Process::WindowHeight/2, 3, &Cyan);
if (!Game::client || !Game::engine) {
init_modules();
}
char map_name[256];
static bool parsed_map = false;
static std::string map_name_old = "";
@@ -87,6 +91,8 @@ void Draw() {
map_name[j] = c;
}
if (map_name[0] == '\0')
return;
if (std::string(map_name) != map_name_old || !parsed_map) {
parsed_map = _bsp_parser.load_map(std::string(Game::path) + std::string("cstrike\\maps"), map_name);
map_name_old = std::string(map_name);
@@ -97,9 +103,6 @@ void Draw() {
}
RGBA White = { 255, 255, 255, 255 };
if (!Game::client || !Game::engine) {
init_modules();
}
uintptr_t entity_list = Game::client + ENTITY_LIST;
uintptr_t localplayer = RPM<uintptr_t>(Game::client + LOCALPLAYER);
@@ -134,7 +137,9 @@ void Draw() {
continue;
}
bool is_visible = _bsp_parser.is_visible(vector3{ pos.x, pos.y, pos.z + 66 }, vector3{ absOrigin.x, absOrigin.y, absOrigin.z + 66 });
bool is_visible = true;
if (parsed_map && std::string(map_name) != "cs_office.bsp")
is_visible = _bsp_parser.is_visible(vector3{pos.x, pos.y, pos.z + 66}, vector3{absOrigin.x, absOrigin.y, absOrigin.z + 66});
//getting name
DWORD list = RPM<DWORD>(Game::client + NAME_LIST) + 0x38;