GUI update + fix callout + fix events

This commit is contained in:
nullifiedcat 2017-07-08 12:15:26 +03:00
parent c6ad7972e8
commit a6ebaf3446
4 changed files with 42 additions and 21 deletions

View File

@ -29,13 +29,17 @@ void CatVar_Integer(CatVar& var) {
ImGui::PushID(var.id);
int value = var;
ImGui::PushItemWidth(75.0f);
if (ImGui::SliderInt(label, &value, minval, maxval)) {
ImGui::PushItemWidth(120.0f);
int step = var.restricted ? (var.max - var.min) / 50 : 1;
if (ImGui::InputInt(label, &value, step, step * 20)) {
var = value;
}
/*if (ImGui::SliderInt(label, &value, minval, maxval)) {
var = value;
}*/
if (ImGui::IsItemHovered() && var.desc_long.size()) {
ImGui::BeginTooltip();
ImGui::Text(var.desc_long.c_str());
ImGui::Text("%s", var.desc_long.c_str());
ImGui::EndTooltip();
}
@ -56,13 +60,17 @@ void CatVar_Float(CatVar& var) {
ImGui::PushID(var.id);
float value = var;
ImGui::PushItemWidth(75.0f);
if (ImGui::SliderFloat(label, &value, minval, maxval)) {
ImGui::PushItemWidth(120.0f);
float step = var.restricted ? (var.max - var.min) / 50 : 1;
if (ImGui::InputFloat(label, &value, step, step * 20)) {
var = value;
}
/*if (ImGui::SliderFloat(label, &value, minval, maxval)) {
var = value;
}*/
if (ImGui::IsItemHovered() && var.desc_long.size()) {
ImGui::BeginTooltip();
ImGui::Text(var.desc_long.c_str());
ImGui::Text("%s", var.desc_long.c_str());
ImGui::EndTooltip();
}
@ -106,6 +114,12 @@ void CatVar_String(CatVar& var) {
var.SetValue(std::string(buf));
}
if (ImGui::IsItemHovered() && var.desc_long.size()) {
ImGui::BeginTooltip();
ImGui::Text("%s", var.desc_long.c_str());
ImGui::EndTooltip();
}
ImGui::PopID();
}
@ -114,7 +128,7 @@ void CatVar_Key(CatVar& var) {
if (!keys_array) {
keys_array = new const char*[ButtonCode_t::BUTTON_CODE_COUNT];
for (int i = 0; i < ButtonCode_t::BUTTON_CODE_COUNT; i++) {
keys_array[i] = g_IInputSystem->ButtonCodeToString((ButtonCode_t)i);
keys_array[i] = g_IInputSystem->ButtonCodeToString(ButtonCode_t(i));
}
}
@ -130,7 +144,7 @@ void CatVar_Key(CatVar& var) {
}
if (ImGui::IsItemHovered() && var.desc_long.size()) {
ImGui::BeginTooltip();
ImGui::Text(var.desc_long.c_str());
ImGui::Text("%s", var.desc_long.c_str());
ImGui::EndTooltip();
}
@ -150,7 +164,7 @@ void CatVar_Switch(CatVar& var) {
}
if (ImGui::IsItemHovered() && var.desc_long.size()) {
ImGui::BeginTooltip();
ImGui::Text(var.desc_long.c_str());
ImGui::Text("%s", var.desc_long.c_str());
ImGui::EndTooltip();
}
@ -255,16 +269,25 @@ void Render() {
ImGuiStyle * style = &ImGui::GetStyle();
style->WindowPadding = ImVec2(15, 15);
style->WindowRounding = 5.0f;
//style->WindowRounding = 5.0f;
style->WindowRounding = 1.0f;
style->FramePadding = ImVec2(5, 5);
style->FrameRounding = 4.0f;
//style->FrameRounding = 4.0f;
style->FrameRounding = 1.0f;
style->ItemSpacing = ImVec2(12, 8);
style->ItemInnerSpacing = ImVec2(8, 6);
//style->ItemInnerSpacing = ImVec2(8, 6);
style->ItemInnerSpacing = ImVec2(6, 6);
style->IndentSpacing = 25.0f;
style->ScrollbarSize = 15.0f;
style->ScrollbarRounding = 9.0f;
//style->ScrollbarRounding = 9.0f;
style->ScrollbarRounding = 1.0f;
style->GrabMinSize = 5.0f;
style->GrabRounding = 3.0f;
//style->GrabRounding = 3.0f;
style->GrabRounding = 1.0f;
style->Colors[ImGuiCol_Text] = ImVec4(0.80f, 0.80f, 0.83f, 1.00f);
style->Colors[ImGuiCol_TextDisabled] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);

View File

@ -106,6 +106,7 @@ std::stack<std::string>& hack::command_stack() {
class AdvancedEventListener : public IGameEventListener {
public:
virtual void FireGameEvent( KeyValues * event) {
if (!event_log) return;
const char* name = event->GetName();
if (!strcmp(name, "player_connect_client")) {
PrintChat("\x07%06X%s\x01 \x07%06X%s\x01 joining", 0xa06ba0, event->GetString("name"), 0x914e65, event->GetString("networkid"));
@ -125,7 +126,6 @@ public:
int nteam = event->GetInt("team");
const char* oteam_s = teamname(oteam);
const char* nteam_s = teamname(nteam);
logging::Info("%d -> %d", oteam, nteam);
PrintChat("\x07%06X%s\x01 changed team (\x07%06X%s\x01 -> \x07%06X%s\x01)", 0xa06ba0, event->GetString("name"), colors::chat::team(oteam), oteam_s, colors::chat::team(nteam), nteam_s);
}
}

View File

@ -46,7 +46,7 @@ static CatVar aimkey_mode(aimkey_modes_enum, "aimbot_aimkey_mode", "1", "Aimkey
static CatVar autoshoot(CV_SWITCH, "aimbot_autoshoot", "1", "Autoshoot", "Shoot automatically when the target is locked, isn't compatible with 'Enable when attacking'");
static CatEnum hitbox_mode_enum({ "AUTO-HEAD", "AUTO-CLOSEST", "STATIC" });
static CatVar hitbox_mode(hitbox_mode_enum, "aimbot_hitboxmode", "0", "Hitbox Mode", "Defines hitbox selection mode");
static CatVar fov(CV_FLOAT, "aimbot_fov", "0", "Aimbot FOV", "FOV range for aimbot to lock targets. \"Smart FOV\" coming eventually.", 360.0f);
static CatVar fov(CV_FLOAT, "aimbot_fov", "0", "Aimbot FOV", "FOV range for aimbot to lock targets. \"Smart FOV\" coming eventually.", 180.0f);
static CatEnum priority_mode_enum({ "SMART", "FOV", "DISTANCE", "HEALTH" });
static CatVar priority_mode(priority_mode_enum, "aimbot_prioritymode", "0", "Priority mode", "Priority mode.\n"
"SMART: Basically Auto-Threat. Will be tweakable eventually. "

View File

@ -37,11 +37,9 @@ public:
if (g_IEngine->GetPlayerInfo(vid, &pinfo)) {
std::string msg(healarrow_callout_message.GetString());
ReplaceString(msg, "$$", std::to_string(-damageamount));
auto v_entity = ENTITY(vid);
if (CE_GOOD(v_entity)) {
ReplaceString(msg, "##", std::to_string(CE_INT(v_entity, netvar.iHealth) - damageamount));
ReplaceString(msg, "@@", std::to_string(CE_INT(v_entity, netvar.iHealth)));
}
int health = event->GetInt("health");
ReplaceString(msg, "##", std::to_string(health));
ReplaceString(msg, "@@", std::to_string(health + damageamount));
ReplaceString(msg, "%%", pinfo.name);
chat_stack::Say(msg);
}