void CDrawManager::DrawPlayerHealthBox(CBaseEntity *pEnt, DWORD dwColor, int iHealth, int iMaxHealth) { CEntity<> local{ me }; if (pEnt == NULL) return; Vector mon, nom; nom = pEnt->GetAbsOrigin(); if (!(local.get<int>(gEntVars.iFlags) & FL_DUCKING)) { mon = nom + Vector(0, 0, 50.f); } else { mon = nom + Vector(0, 0, 70.f); } Vector bot, top; if (WorldToScreen(nom, bot) && WorldToScreen(mon, top)) { float h = floor(bot.y - top.y); float w = h / 4.f; DWORD dwHealth; dwHealth = COLORCODE(255, 255, 255, 255); //white int first = floor(255 - (iHealth / iMaxHealth * 255 * 2.)); int second = floor(iHealth / iMaxHealth * 255 * 2.); if (iMaxHealth*.5<iHealth) { dwHealth = COLORCODE(first, 255, 25, 255); } else { dwHealth = COLORCODE(255, second, 25, 255); } top.x -= floor(w + 6); DrawRect(floor(top.x), floor(top.y), 4, h, COLORCODE(0, 0, 0, 255)); // Border if (iMaxHealth<iHealth) { dwHealth = COLORCODE(0, 0, 255, 255); iHealth = iMaxHealth; } int hw = floor((((h)* iHealth) / iMaxHealth)); // Percentage I think? DrawRect(floor(top.x) + 1, floor(top.y + (h - hw)) + 1, 2, hw - 2, dwHealth); } }
//=================================================================================== void CDrawManager::DrawBox(Vector vOrigin, int r, int g, int b, int alpha, int box_width, int radius) { Vector vScreen; if(!WorldToScreen(vOrigin, vScreen)) return; int radius2 = radius << 1; //outlines OutlineRect(vScreen.x - radius + box_width, vScreen.y - radius + box_width, radius2 - box_width, radius2 - box_width, COLORCODE(0, 255, 0, 255)); OutlineRect(vScreen.x - radius - 1, vScreen.y - radius - 1, radius2 + (box_width + 2), radius2 + (box_width + 2), COLORCODE(0, 255, 0, 255)); //actual lines DrawRect(vScreen.x - radius + box_width, vScreen.y - radius, radius2 - box_width, box_width, COLORCODE(r, g, b, alpha)); DrawRect(vScreen.x - radius, vScreen.y + radius, radius2, box_width, COLORCODE(r, g, b, alpha)); DrawRect(vScreen.x - radius, vScreen.y - radius, box_width, radius2, COLORCODE(r, g, b, alpha)); DrawRect(vScreen.x + radius, vScreen.y - radius, box_width, radius2 + box_width, COLORCODE(r, g, b, alpha)); }
void CNeeded::DrawString( int x, int y, int r, int g,int b, int a, bool bCenter, const char *pszText, ... ) { if( pszText == NULL ) return; va_list va_alist; char szBuffer[1024] = { '\0' }; wchar_t szString[1024] = { '\0' }; va_start( va_alist, pszText ); vsprintf( szBuffer, pszText, va_alist ); va_end( va_alist ); DWORD color = COLORCODE(r,g,b,a); wsprintfW( szString, L"%S", szBuffer ); int iWidth, iHeight; g_pMatySystemSurface->GetTextSize( font, szString , iWidth, iHeight ); g_pSurface->DrawSetTextFont(font); g_pMatySystemSurface->DrawSetTextPos( x - ( bCenter ? iWidth / 2 : 0 ), y ); g_pSurface->DrawSetTextColor( Color(RED(color),GREEN(color),BLUE(color),ALPHA(color)) ); g_pSurface->DrawPrintText( szString, wcslen( szString ) ); }
void CDrawManager::DrawCrosshair(int iValue) //Crosshair loop { int m_iScreenWidth = gScreenSize.iScreenWidth; int m_iScreenHeight = gScreenSize.iScreenHeight; DWORD dwRed = COLORCODE(255, 50, 0, 255); DWORD dwWhite = COLORCODE(255, 255, 255, 255); int x = m_iScreenWidth / 2; int y = m_iScreenHeight / 2; switch (iValue) { case 1: DrawRect(x - 25, y, 50, 1, dwWhite); DrawRect(x, y - 25, 1, 50, dwWhite); DrawRect(x - 7, y, 14, 1, dwRed); DrawRect(x, y - 7, 1, 14, dwRed); break; case 2: DrawRect(x - 14, y, 9, 1, dwWhite); DrawRect(x + 5, y, 9, 1, dwWhite); DrawRect(x, y - 14, 1, 9, dwWhite); DrawRect(x, y + 5, 1, 9, dwWhite); DrawRect(x, y, 1, 1, dwWhite); break; case 3: DrawRect(x - 14, y, 9, 2, dwWhite); DrawRect(x + 6, y, 9, 2, dwWhite); DrawRect(x, y - 14, 2, 9, dwWhite); DrawRect(x, y + 7, 2, 9, dwWhite); DrawRect(x, y, 2, 2, dwWhite); break; case 4: DrawRect(x - 2, y - 2, 4, 4, dwWhite); break; case 5: //Right DrawRect(x, y, 15, 2, dwWhite); //Bottom DrawRect(x, y, 2, 15, dwWhite); //Left DrawRect(x - 15, y, 15, 2, dwWhite); //Top DrawRect(x, y - 15, 2, 15, dwWhite); break; case 6: // Left top to right bottom DrawRect(x + 1, y + 1, 1, 1, dwRed); DrawRect(x + 2, y + 2, 1, 1, dwRed); DrawRect(x + 3, y + 3, 1, 1, dwRed); DrawRect(x + 4, y + 4, 1, 1, dwRed); DrawRect(x + 5, y + 5, 1, 1, dwRed); DrawRect(x + 6, y + 6, 1, 1, dwRed); DrawRect(x + 7, y + 7, 1, 1, dwRed); DrawRect(x + 8, y + 8, 1, 1, dwRed); DrawRect(x + 9, y + 9, 1, 1, dwRed); DrawRect(x + 10, y + 10, 1, 1, dwRed); DrawRect(x + 11, y + 11, 1, 1, dwRed); DrawRect(x + 12, y + 12, 1, 1, dwRed); // right top to left bottom DrawRect(x + 12, y + 1, 1, 1, dwRed); DrawRect(x + 11, y + 2, 1, 1, dwRed); DrawRect(x + 10, y + 3, 1, 1, dwRed); DrawRect(x + 9, y + 4, 1, 1, dwRed); DrawRect(x + 8, y + 5, 1, 1, dwRed); DrawRect(x + 7, y + 6, 1, 1, dwRed); DrawRect(x + 6, y + 7, 1, 1, dwRed); DrawRect(x + 5, y + 8, 1, 1, dwRed); DrawRect(x + 4, y + 9, 1, 1, dwRed); DrawRect(x + 3, y + 10, 1, 1, dwRed); DrawRect(x + 2, y + 11, 1, 1, dwRed); DrawRect(x + 1, y + 12, 1, 1, dwRed); break; } }
bool CESP::inEntityLoop(int index) { if (!variables[0].get<bool>()) return false; if (index == me) // we have no reason to perform esp on ourselves return false; // get the player CEntity<> player(index); // no nulls if (player.isNull()) return false; // no dormants if (player->IsDormant()) return false; Vector vecWorld, vecScreen; Vector min, max, origin, localOrigin; Vector bot, top; player->GetRenderBounds(min, max); origin = player->GetAbsOrigin(); player->GetWorldSpaceCenter(vecWorld); if (!gDrawManager.WorldToScreen(vecWorld, vecScreen)) return false; if (!gDrawManager.WorldToScreen(Vector(origin.x, origin.y, origin.z + min.z), bot) || !gDrawManager.WorldToScreen(Vector(origin.x, origin.y, origin.z + max.z), top)) return false; float flHeight = bot.y - top.y; float flWidth = flHeight / 4.0f; DWORD teamColor; DWORD dwWhite = COLORCODE(255, 255, 255, 255); DWORD dwRed = COLORCODE(255, 0, 0, 255); DWORD dwGreen = COLORCODE(0, 255, 0, 255); if (variables[4].bGet()) { if (isPlayerOnFriendsList(index)) { teamColor = dwGreen; } else { teamColor = gDrawManager.dwGetTeamColor(player.get<int>(gEntVars.iTeam)); } } else { teamColor = gDrawManager.dwGetTeamColor(player.get<int>(gEntVars.iTeam)); } //Draw on the player. classId id = player->GetClientClass()->iClassID; if (id == classId::CTFPlayer) { // no deads if (player.get<BYTE>(gEntVars.iLifeState) != LIFE_ALIVE) return false; player_info_t info; if (!gInts.Engine->GetPlayerInfo(index, &info)) return false; if (variables[1].bGet()) { gDrawManager.OutlineRect(top.x - flWidth, top.y, flWidth * 2, flHeight, teamColor); // player box. } if (variables[2].bGet()) //name esp { gDrawManager.DrawString("esp", vecScreen.x, vecScreen.y, teamColor, XorString("%s"), info.name); vecScreen.y += gDrawManager.GetESPHeight(); } if (variables[3].bGet()) //health esp { gDrawManager.DrawString("esp", vecScreen.x, vecScreen.y, teamColor, XorString("%i HP"), player.get<int>(gEntVars.iHealth) /*gInts.GameResource->getHealth(index)*/); //Draw on the player. vecScreen.y += gDrawManager.GetESPHeight(); } if (variables[4].bGet()) //index esp { gDrawManager.DrawString("esp", vecScreen.x, vecScreen.y, teamColor, XorString("%i"), player.index()); //Draw on the player. vecScreen.y += gDrawManager.GetESPHeight(); } if (variables[6].bGet()) //kaikki muu paska esp { } } else if (id == classId::CObjectDispenser || id == classId::CObjectSapper || id == classId::CObjectSentrygun || id == classId::CObjectTeleporter || id == classId::CTFProjectile_Arrow || id == classId::CCaptureFlag || id == classId::CMerasmus || id == classId::CTFDroppedWeapon || id == classId::CTFAmmoPack || id == classId::CCurrencyPack || id == classId::CHalloweenGiftPickup || id == classId::CLaserDot || id == classId::CBaseDoor) { // just draw the name now if (variables[7].bGet()) { gDrawManager.DrawString("esp", vecScreen.x, vecScreen.y, teamColor, XorString("%s"), player->GetClientClass()->chName); gDrawManager.OutlineRect(top.x - flWidth, top.y, flWidth * 2, flHeight, teamColor); vecScreen.y += gDrawManager.GetESPHeight(); } } }