small update

This commit is contained in:
nullifiedcat 2017-12-16 15:16:37 +03:00
parent 7253a877c3
commit 12066e377c
7 changed files with 42 additions and 17 deletions

View File

@ -45,6 +45,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <string.h> #include <string.h>
#include <pwd.h>
#include <assert.h> #include <assert.h>
#include "timer.hpp" #include "timer.hpp"

View File

@ -13,7 +13,7 @@ if ! command -v gksu; then
fi fi
pushd ../libxoverlay pushd ../libxoverlay
if ! make -e ARCH=32 >/tmp/buildxoverlay.log; then if ! make -e ARCH=32 >/tmp/buildxoverlay.log 2>&1; then
$DIALOG --title "Build failed" --msgbox "Failed to build libxoverlay. See /tmp/buildxoverlay.log for more info." 9 78 $DIALOG --title "Build failed" --msgbox "Failed to build libxoverlay. See /tmp/buildxoverlay.log for more info." 9 78
exit exit
fi fi
@ -21,7 +21,7 @@ $SU make install
popd popd
pushd ../libglez pushd ../libglez
if ! make -e ARCH=32 >/tmp/buildglez.log; then if ! make -e ARCH=32 >/tmp/buildglez.log 2>&1; then
$DIALOG --title "Build failed" --msgbox "Failed to build libglez. See /tmp/buildglez.log for more info." 9 78 $DIALOG --title "Build failed" --msgbox "Failed to build libglez. See /tmp/buildglez.log for more info." 9 78
exit exit
fi fi

View File

@ -155,7 +155,14 @@ void hack::Initialize()
{ {
signal(SIGPIPE, SIG_IGN); signal(SIGPIPE, SIG_IGN);
time_injected = time(nullptr); time_injected = time(nullptr);
// Essential files must always exist, except when the game is running in text passwd *pwd = getpwuid(getuid());
char *logname = strfmt("/tmp/cathook-game-stdout-%s-%u.log", pwd->pw_name, time_injected);
freopen(logname, "w", stdout);
free(logname);
logname = strfmt("/tmp/cathook-game-stderr-%s-%u.log", pwd->pw_name, time_injected);
freopen(logname, "w", stderr);
free(logname);
// Essential files must always exist, except when the game is running in text
// mode. // mode.
#if ENABLE_VISUALS == 1 #if ENABLE_VISUALS == 1

View File

@ -186,9 +186,9 @@ void CreateMove()
projectile_mode = (GetProjectileData(g_pLocalPlayer->weapon(), projectile_mode = (GetProjectileData(g_pLocalPlayer->weapon(),
cur_proj_speed, cur_proj_grav)); cur_proj_speed, cur_proj_grav));
if (proj_speed) if (proj_speed)
cur_proj_speed = (float) proj_speed; cur_proj_speed = float(proj_speed);
if (proj_gravity) if (proj_gravity)
cur_proj_grav = (float) proj_gravity; cur_proj_grav = float(proj_gravity);
// We do this as we need to pass whether the aimkey allows aiming to both // We do this as we need to pass whether the aimkey allows aiming to both
// the find target and aiming system. If we just call the func than toggle // the find target and aiming system. If we just call the func than toggle
@ -196,8 +196,8 @@ void CreateMove()
bool aimkey_status = UpdateAimkey(); bool aimkey_status = UpdateAimkey();
// Refresh our best target // Refresh our best target
CachedEntity *target = RetrieveBestTarget(aimkey_status); CachedEntity *target_entity = RetrieveBestTarget(aimkey_status);
if (CE_BAD(target) || !foundTarget) if (CE_BAD(target_entity) || !foundTarget)
return; return;
// Auto-zoom // Auto-zoom
@ -216,7 +216,7 @@ void CreateMove()
} }
#if ENABLE_VISUALS == 1 #if ENABLE_VISUALS == 1
hacks::shared::esp::SetEntityColor(target, colors::pink); hacks::shared::esp::SetEntityColor(target_entity, colors::pink);
#endif #endif
// Local player check + Aimkey // Local player check + Aimkey
@ -245,7 +245,7 @@ void CreateMove()
currently_charging_huntsman) currently_charging_huntsman)
{ {
currently_charging_huntsman = false; currently_charging_huntsman = false;
Aim(target); Aim(target_entity);
} }
else else
return; return;
@ -254,10 +254,10 @@ void CreateMove()
} }
else if (CanShoot() && (g_pUserCmd->buttons & IN_ATTACK) && else if (CanShoot() && (g_pUserCmd->buttons & IN_ATTACK) &&
CE_INT(g_pLocalPlayer->weapon(), netvar.m_iClip1) != 0) CE_INT(g_pLocalPlayer->weapon(), netvar.m_iClip1) != 0)
Aim(target); Aim(target_entity);
} }
else else
Aim(target); Aim(target_entity);
return; return;
} }
@ -416,6 +416,8 @@ CachedEntity *RetrieveBestTarget(bool aimkey_state)
case 3: // Health Priority case 3: // Health Priority
scr = 450.0f - ent->m_iHealth; scr = 450.0f - ent->m_iHealth;
break; break;
default:
break;
} }
} }
// Compare the top score to our current ents score // Compare the top score to our current ents score
@ -962,6 +964,8 @@ int BestHitbox(CachedEntity *target)
return (int) hitbox; return (int) hitbox;
} }
break; break;
default:
break;
} }
// Hitbox machine :b:roke // Hitbox machine :b:roke
return -1; return -1;
@ -1098,6 +1102,9 @@ bool UpdateAimkey()
aimkey_flip = !aimkey_flip; aimkey_flip = !aimkey_flip;
if (!aimkey_flip) if (!aimkey_flip)
allow_aimkey = false; allow_aimkey = false;
break;
default:
break;
} }
pressed_last_tick = key_down; pressed_last_tick = key_down;
} }

View File

@ -66,6 +66,8 @@ float GetAAAAPitch()
return aaaa_stage ? -271 : -89; return aaaa_stage ? -271 : -89;
case 1: case 1:
return aaaa_stage ? 271 : 89; return aaaa_stage ? 271 : 89;
default:
break;
} }
return 0; return 0;
} }
@ -174,6 +176,8 @@ void FuckPitch(float &io_pitch)
{ {
case k_EFuckMode::FM_RANDOMVARS: case k_EFuckMode::FM_RANDOMVARS:
io_pitch = RandFloatRange(min_pitch, max_pitch); io_pitch = RandFloatRange(min_pitch, max_pitch);
default:
break;
} }
if (io_pitch < min_pitch) if (io_pitch < min_pitch)
@ -195,6 +199,8 @@ void FuckYaw(float &io_yaw)
{ {
case k_EFuckMode::FM_RANDOMVARS: case k_EFuckMode::FM_RANDOMVARS:
io_yaw = RandFloatRange(min_yaw, max_yaw); io_yaw = RandFloatRange(min_yaw, max_yaw);
default:
break;
} }
if (io_yaw < min_yaw) if (io_yaw < min_yaw)
@ -246,6 +252,9 @@ bool ShouldAA(CUserCmd *cmd)
SetSafeSpace(8); SetSafeSpace(8);
return false; return false;
} }
break;
default:
break;
} }
if (safe_space) if (safe_space)
{ {
@ -414,12 +423,14 @@ void ProcessUserCmd(CUserCmd *cmd)
case 8: case 8:
FuckYaw(y); FuckYaw(y);
clamp = false; clamp = false;
default:
break;
} }
switch ((int) pitch_mode) switch (int(pitch_mode))
{ {
case 1: case 1:
p = (float) pitch; p = float(pitch);
break; break;
case 2: case 2:
if (flip) if (flip)
@ -463,7 +474,7 @@ void ProcessUserCmd(CUserCmd *cmd)
if (clamp) if (clamp)
fClampAngle(cmd->viewangles); fClampAngle(cmd->viewangles);
if (roll) if (roll)
cmd->viewangles.z = (float) roll; cmd->viewangles.z = float(roll);
if (aaaa_enabled) if (aaaa_enabled)
{ {
UpdateAAAAKey(); UpdateAAAAKey();

View File

@ -240,7 +240,7 @@ CUserCmd *GetUserCmd_hook(IInput *_this, int sequence_number)
// command_number_mod[def->command_number]); // command_number_mod[def->command_number]);
oldcmd = def->command_number; oldcmd = def->command_number;
def->command_number = command_number_mod[def->command_number]; def->command_number = command_number_mod[def->command_number];
def->random_seed = MD5_PseudoRandom(def->command_number) & 0x7fffffff; def->random_seed = MD5_PseudoRandom(unsigned(def->command_number)) & 0x7fffffff;
command_number_mod.erase(command_number_mod.find(oldcmd)); command_number_mod.erase(command_number_mod.find(oldcmd));
*(int *) ((unsigned) g_IBaseClientState + *(int *) ((unsigned) g_IBaseClientState +
offsets::lastoutgoingcommand()) = def->command_number - 1; offsets::lastoutgoingcommand()) = def->command_number - 1;
@ -811,7 +811,7 @@ void LevelInit_hook(void *_this, const char *newmap)
void LevelShutdown_hook(void *_this) void LevelShutdown_hook(void *_this)
{ {
static const LevelShutdown_t original = static const LevelShutdown_t original =
(LevelShutdown_t) hooks::clientmode.GetMethod(offsets::LevelShutdown()); LevelShutdown_t(hooks::clientmode.GetMethod(offsets::LevelShutdown()));
need_name_change = true; need_name_change = true;
playerlist::Save(); playerlist::Save();
g_Settings.bInvalid = true; g_Settings.bInvalid = true;

View File

@ -59,7 +59,6 @@ void SDL_GL_SwapWindow_hook(SDL_Window *window)
static bool init{ false }; static bool init{ false };
static GLXContext tf2 = glXGetCurrentContext();
static SDL_GLContext tf2_sdl = SDL_GL_GetCurrentContext(); static SDL_GLContext tf2_sdl = SDL_GL_GetCurrentContext();
if (cathook && !disable_visuals) if (cathook && !disable_visuals)