All pastes #835430 Raw Edit

Miscellany

public cpp v1 · immutable
#835430 ·published 2007-12-28 21:33 UTC
rendered paste body
void Qw::drawPlayersEsp() {	for ( int i = 0; i < MAX_CLIENTS; i++ ) {		if(i == gLocal->localClientNum)			continue;					idPlayer* player = gLocal->GetClient(i);				if(player == NULL || player->IsInLimbo() || (gLocal->GetLocalPlayer()->GetGameTeam() == player->GetGameTeam()))			continue;		// Box ESP		idVec3 org = player->GetPhysics()->GetOrigin();		idMat3 axes = player->GetAxis();		idBounds bounds = player->GetPhysics()->GetBounds();		sdWorldToScreenConverter converter(gLocal->playerView.GetCurrentView());		sdBounds2D bracketBounds;		converter.Transform(bounds, axes, org, bracketBounds);		DrawBounds2D(bracketBounds, idVec4(0.0f, 1.0f, 1.0f, 1.0f), 0.5f);				idVec4 v = bracketBounds.ToVec4();		idVec2 tc = idVec2(v.x+(v.z/2), v.y); // center of top of 2D bounds                // Name ESP        deviceContext->SetFontSize(10);		deviceContext->DrawText(va( L"%s", player->userInfo.name.c_str()), sdBounds2D(tc.x, tc.y-24.0f, 0, 0), DTF_CENTER | DTF_NOCLIPPING);				// Health ESP		//idEntity *ent = gLocal->entities[i];		idVec4 hColor;		float healthPercent;		if(player->GetHealth() > 100){			hColor = idVec4(0.0f, 1.0f, 0.0f, 1.0f);		} else if(player->GetHealth() > 50) {			hColor = idVec4((1.0f-((float)player->GetHealth()/100.0f)), 1.0f, 0.0f, 1.0f);		} else if(player->GetHealth() <= 50) {			hColor = idVec4(1.0f, ((float)player->GetHealth()/100.0f), 0.0f, 1.0f);		}				if(player->GetHealth() >= 100) {			healthPercent = 1.0f;		}else if(player->GetHealth() <= 0) {			healthPercent = 0.0f;		}else{			healthPercent = ((float)player->GetHealth() / 100.0f);		}				deviceContext->DrawClippedRect(tc.x-27.0f, tc.y-12.0f, 54.0f, 9.0f, idVec4(0.0f, 0.0f, 0.0f, 0.5f)); //matte		deviceContext->DrawClippedRect(tc.x-25.0f, tc.y-10.0f, (50.0f * healthPercent), 5.0f, hColor);		 //bar	}}