added heart, fixed 2d box not visible with esp stuff turned off

This commit is contained in:
nullifiedcat 2017-04-29 10:10:28 +03:00
parent 00bcc75f04
commit 14fb0fd6ed
6 changed files with 17 additions and 13 deletions

BIN
res/bin/heart.o Normal file

Binary file not shown.

BIN
res/heart Normal file

Binary file not shown.

BIN
res/heart.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 B

View File

@ -12,12 +12,13 @@ namespace menu { namespace ncc {
Background::Background() : CBaseWidget("nc_background"), Background::Background() : CBaseWidget("nc_background"),
tx_snowflake(&_binary_snowflake_start, 16, 16), tx_snowflake(&_binary_snowflake_start, 16, 16),
tx_raindrop(&_binary_raindrop_start, 16, 16), tx_raindrop(&_binary_raindrop_start, 16, 16),
tx_flame(&_binary_flame_start, 16, 16){ tx_flame(&_binary_flame_start, 16, 16),
tx_heart(&_binary_heart_start, 16, 16) {
SetSize(draw::width, draw::height); SetSize(draw::width, draw::height);
} }
static CatVar particles(CV_SWITCH, "gui_bg_particles", "0", "Particles"); static CatVar particles(CV_SWITCH, "gui_bg_particles", "0", "Particles");
static CatEnum particle_type_enum({"Snowflake", "Raindrop", "Flame"}); static CatEnum particle_type_enum({"Snowflake", "Raindrop", "Flame", "Heart", "Random"});
static CatVar particle_type(particle_type_enum, "gui_bg_particles_type", "0", "Particles Type", "Defines particle type"); static CatVar particle_type(particle_type_enum, "gui_bg_particles_type", "0", "Particles Type", "Defines particle type");
static CatVar particle_chance(CV_INT, "gui_bg_particles_chance", "10", "Particles Spawn Rate", "Defines snowflake spawn rate (HAS TO BE NONZERO!)", 1.0f, 100.0f); static CatVar particle_chance(CV_INT, "gui_bg_particles_chance", "10", "Particles Spawn Rate", "Defines snowflake spawn rate (HAS TO BE NONZERO!)", 1.0f, 100.0f);
static CatVar particle_pack_size(CV_INT, "gui_bg_particles_pack_size", "10", "Particles Max Pack", "Defines max snowflake spawn pack size (HAS TO BE NONZERO!)", 1.0f, 100.0f); static CatVar particle_pack_size(CV_INT, "gui_bg_particles_pack_size", "10", "Particles Max Pack", "Defines max snowflake spawn pack size (HAS TO BE NONZERO!)", 1.0f, 100.0f);
@ -62,6 +63,7 @@ void Background::LoadTextures() {
tx_flame.Load(); tx_flame.Load();
tx_raindrop.Load(); tx_raindrop.Load();
tx_snowflake.Load(); tx_snowflake.Load();
tx_heart.Load();
textures_loaded = true; textures_loaded = true;
} }
@ -91,13 +93,16 @@ void Background::MakeParticle() {
flake->dead = false; flake->dead = false;
flake->next = nullptr; flake->next = nullptr;
flake->show_in = rand() % 4; flake->show_in = rand() % 4;
switch ((int)particle_type) { switch (((int)particle_type == 4) ? (rand() % 4) : (int)particle_type) {
case 1: case 1:
flake->texture = &tx_raindrop; flake->texture = &tx_raindrop;
break; break;
case 2: case 2:
flake->texture = &tx_flame; flake->texture = &tx_flame;
break; break;
case 3:
flake->texture = &tx_heart;
break;
default: default:
flake->texture = &tx_snowflake; flake->texture = &tx_snowflake;
} }

View File

@ -13,6 +13,7 @@
extern unsigned char _binary_snowflake_start; extern unsigned char _binary_snowflake_start;
extern unsigned char _binary_flame_start; extern unsigned char _binary_flame_start;
extern unsigned char _binary_raindrop_start; extern unsigned char _binary_raindrop_start;
extern unsigned char _binary_heart_start;
namespace menu { namespace ncc { namespace menu { namespace ncc {
@ -43,6 +44,7 @@ public:
Texture tx_snowflake; Texture tx_snowflake;
Texture tx_raindrop; Texture tx_raindrop;
Texture tx_flame; Texture tx_flame;
Texture tx_heart;
Particle* list { nullptr }; Particle* list { nullptr };
Particle* list_tail { nullptr }; Particle* list_tail { nullptr };
}; };

View File

@ -274,19 +274,14 @@ void DrawBox(CachedEntity* ent, int clr, float widthFactor, float addHeight, boo
draw::OutlineRect(min_x, min_y, max_x - min_x, max_y - min_y, border); draw::OutlineRect(min_x, min_y, max_x - min_x, max_y - min_y, border);
draw::OutlineRect(min_x + 1, min_y + 1, max_x - min_x - 2, max_y - min_y - 2, clr); draw::OutlineRect(min_x + 1, min_y + 1, max_x - min_x - 2, max_y - min_y - 2, clr);
draw::OutlineRect(min_x + 2, min_y + 2, max_x - min_x - 4, max_y - min_y - 4, border); draw::OutlineRect(min_x + 2, min_y + 2, max_x - min_x - 4, max_y - min_y - 4, border);
//draw::OutlineRect(so.x - width / 2 - 1, so.y - 1 - height, width + 2, height + 2, border);
//draw::OutlineRect(so.x - width / 2, so.y - height, width, height, clr);
//draw::OutlineRect(so.x - width / 2 + 1, so.y + 1 - height, width - 2, height - 2, border);
} }
if (healthbar) { if (healthbar) {
int hp = colors::Transparent(colors::Health(health, healthmax), trf); int hp = colors::Transparent(colors::Health(health, healthmax), trf);
int hbh = (max_y - min_y) * min((float)health / (float)healthmax, 1.0f); int hbh = (max_y - min_y - 2) * min((float)health / (float)healthmax, 1.0f);
draw::OutlineRect(min_x - 6, min_y, 7, max_y - min_y, border); draw::OutlineRect(min_x - 6, min_y, 7, max_y - min_y, border);
draw::DrawRect(min_x - 5, max_y - hbh - 1, 5, hbh, hp); draw::DrawRect(min_x - 5, max_y - hbh - 1, 5, hbh, hp);
} }
//draw::OutlineRect(min(smin.x, smax.x) - 1, min(smin.y, smax.y) - 1, max(smin.x, smax.x), max(smin.y, smax.y), draw::black);
//draw::OutlineRect(min(smin.x, smax.x), min(smin.y, smax.y), max(smin.x, smax.x), max(smin.y, smax.y), clr);
} }
void ProcessEntity(CachedEntity* ent) { void ProcessEntity(CachedEntity* ent) {
@ -392,7 +387,7 @@ void ProcessEntity(CachedEntity* ent) {
return; return;
}*/ }*/
} }
AddEntityString(ent, format("LV ", level, ' ', name)); if (show_name) AddEntityString(ent, format("LV ", level, ' ', name));
if (show_health) { if (show_health) {
AddEntityString(ent, format(ent->m_iHealth, '/', ent->m_iMaxHealth, " HP"), colors::Health(ent->m_iHealth, ent->m_iMaxHealth)); AddEntityString(ent, format(ent->m_iHealth, '/', ent->m_iMaxHealth, " HP"), colors::Health(ent->m_iHealth, ent->m_iMaxHealth));
} }
@ -465,7 +460,7 @@ void ProcessEntity(CachedEntity* ent) {
} }
static CatVar esp_3d_box(CV_SWITCH, "esp_3d_box", "0", "3D box"); static CatVar esp_3d_box(CV_SWITCH, "esp_3d_box", "0", "3D box");
static CatVar box_healthbar(CV_SWITCH, "esp_box_healthbar", "1", "Box Healthbar");
void ProcessEntityPT(CachedEntity* ent) { void ProcessEntityPT(CachedEntity* ent) {
if (!enabled) return; if (!enabled) return;
@ -494,11 +489,12 @@ void ProcessEntityPT(CachedEntity* ent) {
if (!ent->m_bEnemy && !teammates && playerlist::IsDefault(ent)) break; if (!ent->m_bEnemy && !teammates && playerlist::IsDefault(ent)) break;
if (!ent->m_bAlivePlayer) break; if (!ent->m_bAlivePlayer) break;
if (vischeck && !ent->IsVisible()) transparent = true; if (vischeck && !ent->IsVisible()) transparent = true;
if (!fg) fg = colors::EntityF(ent);
if (transparent) fg = colors::Transparent(fg); if (transparent) fg = colors::Transparent(fg);
if (esp_3d_box) { if (esp_3d_box) {
Draw3DBox(ent, fg, true, CE_INT(ent, netvar.iHealth), ent->m_iMaxHealth); Draw3DBox(ent, fg, true, CE_INT(ent, netvar.iHealth), ent->m_iMaxHealth);
} else { } else {
DrawBox(ent, fg, 3.0f, -15.0f, true, CE_INT(ent, netvar.iHealth), ent->m_iMaxHealth); DrawBox(ent, fg, 3.0f, -15.0f, static_cast<bool>(box_healthbar), CE_INT(ent, netvar.iHealth), ent->m_iMaxHealth);
} }
break; break;
} }
@ -510,11 +506,12 @@ void ProcessEntityPT(CachedEntity* ent) {
} }
if (CE_INT(ent, netvar.iTeamNum) == g_pLocalPlayer->team && !teammates) break; if (CE_INT(ent, netvar.iTeamNum) == g_pLocalPlayer->team && !teammates) break;
if (!transparent && vischeck && !ent->IsVisible()) transparent = true; if (!transparent && vischeck && !ent->IsVisible()) transparent = true;
if (!fg) fg = colors::EntityF(ent);
if (transparent) fg = colors::Transparent(fg); if (transparent) fg = colors::Transparent(fg);
if (esp_3d_box) { if (esp_3d_box) {
Draw3DBox(ent, fg, true, CE_INT(ent, netvar.iBuildingHealth), CE_INT(ent, netvar.iBuildingMaxHealth)); Draw3DBox(ent, fg, true, CE_INT(ent, netvar.iBuildingHealth), CE_INT(ent, netvar.iBuildingMaxHealth));
} else { } else {
DrawBox(ent, fg, 1.0f, 0.0f, true, CE_INT(ent, netvar.iBuildingHealth), CE_INT(ent, netvar.iBuildingMaxHealth)); DrawBox(ent, fg, 1.0f, 0.0f, static_cast<bool>(box_healthbar), CE_INT(ent, netvar.iBuildingHealth), CE_INT(ent, netvar.iBuildingMaxHealth));
} }
break; break;
} }