All pastes #834000 Raw Edit

Unbenannt

public cpp v1 · immutable
#834000 ·published 2007-12-27 20:57 UTC
rendered paste body
void Qw::drawPlayersEsp() {        sdWorldToScreenConverter converter(gLocal->playerView.GetCurrentView());        idWStr localplname = va(L"%s", (gLocal->GetLocalPlayer()->userInfo.rawName).c_str()); // RETRIEVE TO LOCAL PLAYER NAME AND STOR IT IN A idWStr (since we will need that later on)        for (int count = 0; count < gLocal->numClients; count++) {                idPlayer *player = gLocal->GetClient(count);                if (!player || player->fl.hidden)                        continue;                idVec3 enemy = player->GetPlayerPhysics().GetOrigin();                idVec3 enemy2 = enemy - (enemy * gLocal->GetLocalPlayer()->GetPlayerPhysics().GetGravityNormal ( )) * gLocal->GetLocalPlayer()->GetPlayerPhysics().GetGravityNormal ( );                idVec3 pos2 = gLocal->GetLocalPlayer()->GetPlayerPhysics().GetOrigin();                pos2 = pos2 - (pos2 * gLocal->GetLocalPlayer()->GetPlayerPhysics().GetGravityNormal ( )) * gLocal->GetLocalPlayer()->GetPlayerPhysics().GetGravityNormal ( );                float fdist = (enemy2 - pos2).LengthFast ( );                int fdist2 = static_cast<int>(fdist);                int size = (fdist2/1500)*6;                if(size <= 8)                        size = 8;                if(size > 26)                        return;                deviceContext->SetFontSize(size);//              LOG_DEBUG("float: " << fdist2);                LOG_DEBUG("t " << gLocal);                idVec2 position;                converter.Transform(player->firstPersonViewOrigin, position);                LOG_DEBUG("end");                //if ((position.z <= 0) || (position.z >= 1))                //      continue;                //LOG_DEBUG("drawPlayersEsp(): player: " << count << " x:" << position.x << " y:" << position.y);                //float aspectRatio = deviceContext->GetAspectRatioCorrection();                deviceContext->SetColor(1, 1, 1, 1);//              idWStr test = va(L"%f", fdist);                idWStr s = va(L"%s", (player->userInfo.rawName).c_str()); // Get the other Player's name and store it in an idWStr since we will need it for DrawText(...);                if(s.Cmp(localplname.c_str())){ // COMPARE the local playername and the other one... if they match, don't draw the name                deviceContext->DrawText(s.c_str(), sdBounds2D(position.x,( position.y - 10 ), 0, 0), DTF_CENTER);                //deviceContext->DrawText(L"someone", sdBounds2D(position.x, position.y, 0, 0), DTF_CENTER);                }        }}