diff --git a/include/visual/drawex.hpp b/include/visual/drawex.hpp index 658c5380..c2bb45a4 100755 --- a/include/visual/drawex.hpp +++ b/include/visual/drawex.hpp @@ -51,7 +51,7 @@ void draw_line(float x, float y, float dx, float dy, const rgba_t &rgba, float thickness); void draw_rect_textured(float x, float y, float w, float h, const rgba_t &rgba, texture_handle_t texture, float u, float v, float s, - float t); + float t, float a); void draw_circle(float x, float y, float radius, const rgba_t &rgba, float thickness, int steps); void draw_string(float x, float y, const char *string, font_handle_t &font, diff --git a/libglez b/libglez index 35e0841d..e3bdf1c9 160000 --- a/libglez +++ b/libglez @@ -1 +1 @@ -Subproject commit 35e0841d5ee9d885013e47ce72e155bd22cf7a98 +Subproject commit e3bdf1c994da95544b84896efe8de0099dffe023 diff --git a/src/fidgetspinner.cpp b/src/fidgetspinner.cpp index 41a718c6..dfd89208 100755 --- a/src/fidgetspinner.cpp +++ b/src/fidgetspinner.cpp @@ -6,12 +6,14 @@ */ #include "fidgetspinner.hpp" +#include "common.hpp" -#ifndef FEATURE_FIDGET_SPINNER_DISABLED +#include + +#ifndef FEATURE_FIDGET_SPINNER_ENABLED CatVar enable_spinner(CV_SWITCH, "fidgetspinner", "0", "Fidget Spinner", "Part of Cathook Autism Awareness program"); -std::vector spinner_states{}; float spinning_speed = 0.0f; float angle = 0; @@ -44,9 +46,6 @@ SpinnerListener listener; void InitSpinner() { - for (int i = 0; i < 4; i++) - spinner_states.emplace_back(i * 64, textures::atlas_height - 64 * 4, 64, - 64); g_IGameEventManager->AddListener(&listener, false); } @@ -86,41 +85,16 @@ void DrawSpinner() (speed_cap - 10) + 10 * ((spinning_speed - 750.0f) / 250.0f); const float speed_scale(spinner_speed_scale); const float size(spinner_scale); - ftgl::vec2 positions[4] = { - { -size, -size }, { size, -size }, { size, size }, { -size, size } - }; angle += speed_scale * real_speed; - for (int i = 0; i < 4; i++) - { - float x = positions[i].x; - float y = positions[i].y; - positions[i].x = x * cos(angle) - y * sin(angle); - positions[i].y = x * sin(angle) + y * cos(angle); - positions[i].x += draw::width / 2; - positions[i].y += draw::height / 2; - } - int state = min(3, spinning_speed / 250.0f); + int state = min(3, int(spinning_speed / 250)); - // Paste from draw_api:: - using namespace drawgl; - using namespace ftgl; + const glez_rgba_t color = glez_rgba(255, 255, 255, 255); - const auto &u1v1 = spinner_states[state].tex_coords[0]; - const auto &u2v2 = spinner_states[state].tex_coords[1]; - GLuint idx = buffer_triangles_textured->vertices->size; - GLuint indices[] = { idx, idx + 1, idx + 2, idx, idx + 2, idx + 3 }; - vertex_v2t2c4_t vertices[] = { - { vec2{ positions[0].x, positions[0].y }, vec2{ u1v1.x, u2v2.y }, - *reinterpret_cast(&colors::white) }, - { vec2{ positions[1].x, positions[1].y }, vec2{ u2v2.x, u2v2.y }, - *reinterpret_cast(&colors::white) }, - { vec2{ positions[2].x, positions[2].y }, vec2{ u2v2.x, u1v1.y }, - *reinterpret_cast(&colors::white) }, - { vec2{ positions[3].x, positions[3].y }, vec2{ u1v1.x, u1v1.y }, - *reinterpret_cast(&colors::white) } - }; - vertex_buffer_push_back_indices(buffer_triangles_textured, indices, 6); - vertex_buffer_push_back_vertices(buffer_triangles_textured, vertices, 4); + + static glez_texture_t tex = glez_texture_load_png_rgba("/opt/cathook/data/res/atlas.png"); + while (!tex) + tex = glez_texture_load_png_rgba("/opt/cathook/data/res/atlas.png"); + glez_rect_textured(draw::width / 2, draw::height / 2, size, size, color, tex, 0 + 64 * state, 3 * 64, 64, 64, angle); if (angle > PI * 4) angle -= PI * 4; } diff --git a/src/hack.cpp b/src/hack.cpp index 9f7962cf..b42fece2 100755 --- a/src/hack.cpp +++ b/src/hack.cpp @@ -369,7 +369,7 @@ free(logname);*/ hacks::tf2::healarrow::Init(); #if ENABLE_VISUALS == 1 -#ifndef FEATURE_FIDGET_SPINNER_DISABLED +#ifndef FEATURE_FIDGET_SPINNER_ENABLED InitSpinner(); logging::Info("Initialized Fidget Spinner"); #endif diff --git a/src/hacks/LagExploit.cpp b/src/hacks/LagExploit.cpp index 04db7e38..96b36c86 100755 --- a/src/hacks/LagExploit.cpp +++ b/src/hacks/LagExploit.cpp @@ -395,10 +395,10 @@ void CreateMove() } if (instant_weapon_switch && not HasCondition(LOCAL_E)) { - if (lastwep != g_pLocalPlayer->weapon()->m_IDX) + if (lastwep != g_pLocalPlayer->weapon()->m_iClassID) { amount = 2 * 90; - lastwep = g_pLocalPlayer->weapon()->m_IDX; + lastwep = g_pLocalPlayer->weapon()->m_iClassID; } } // SHOUTOUTS TO BLACKFIRE @@ -408,7 +408,7 @@ void CreateMove() servertime = (float) (CE_INT(g_pLocalPlayer->entity, netvar.nTickBase)) * g_GlobalVars->interval_per_tick; - if (!nextattack || !i || g_pLocalPlayer->weapon()->m_IDX != lastwep) + if (!nextattack || !i || g_pLocalPlayer->weapon()->m_iClassID != lastwep) nextattack = CE_FLOAT(g_pLocalPlayer->weapon(), netvar.flNextPrimaryAttack); if (servertime - nextattack > 30.0f) @@ -441,7 +441,7 @@ void CreateMove() } if (i) i--; - lastwep = g_pLocalPlayer->weapon()->m_IDX; + lastwep = g_pLocalPlayer->weapon()->m_iClassID; } if (!amount) return; diff --git a/src/visual/atlas.cpp b/src/visual/atlas.cpp index 56035489..974e40ec 100755 --- a/src/visual/atlas.cpp +++ b/src/visual/atlas.cpp @@ -22,7 +22,7 @@ void sprite::draw(float scrx, float scry, float scrw, float scrh, const rgba_t &rgba) const { draw_api::draw_rect_textured(scrx, scry, scrw, scrh, rgba, atlas.texture, - nx, ny, nw, nh); + nx, ny, nw, nh, 0); } texture_atlas::texture_atlas(std::string filename, float width, float height) diff --git a/src/visual/drawmgr.cpp b/src/visual/drawmgr.cpp index d13cb93c..964086f3 100755 --- a/src/visual/drawmgr.cpp +++ b/src/visual/drawmgr.cpp @@ -150,7 +150,7 @@ void DrawCheatVisuals() { criticals::draw(); } -#ifndef FEATURE_FIDGET_SPINNER_DISABLED +#ifndef FEATURE_FIDGET_SPINNER_ENABLED DrawSpinner(); #endif Prediction_PaintTraverse();