void CASWHudCrosshair::PaintTurretTextures() { // draw border in centre of screen //int h = ScreenHeight(); //int w = h * 1.333333f; //int x = (ScreenWidth() * 0.5f) - (w * 0.5f); //int y = 0; surface()->DrawSetColor(Color(255,255,255,255)); /* int tx = YRES( 5 ); int ty = YRES( 5 ); vgui::surface()->DrawSetTextFont( m_hTurretFont ); vgui::surface()->DrawSetTextColor( 255, 255, 255, 200 ); vgui::surface()->DrawSetTextPos( tx, ty ); int nFontTall = vgui::surface()->GetFontTall( m_hTurretFont ); wchar_t szconverted[ 1024 ]; g_pVGuiLocalize->ConvertANSIToUnicode( "#asw_turret_text_top_left", szconverted, sizeof( szconverted ) ); vgui::surface()->DrawPrintText( szconverted, wcslen( szconverted ) ); ty = ScreenHeight() - nFontTall * 8 - YRES( 100 ); vgui::surface()->DrawSetTextPos( tx, ty ); g_pVGuiLocalize->ConvertANSIToUnicode( "#asw_turret_text_lower_left", szconverted, sizeof( szconverted ) ); vgui::surface()->DrawPrintText( szconverted, wcslen( szconverted ) ); */ // draw black boxes either side //if (m_nBlackBarTexture != -1) //{ //surface()->DrawSetTexture(m_nBlackBarTexture); //surface()->DrawTexturedRect(0, y, x, y + h); //surface()->DrawTexturedRect(x + w, y, x, y + h); //} // draw fancy brackets over all turret targets float fScale = (ScreenHeight() / 768.0f); int iBSize = fScale * 32.0f; for (int i=0;i<ASW_MAX_TURRET_TARGETS;i++) { C_BaseEntity *pEnt = m_TurretTarget[i]; if (!pEnt) continue; // distance of each bracket part from the ent float fDist = fScale * 200.0f * (1.0f - m_fTurretTargetLock[i]); Vector pos = (pEnt->WorldSpaceCenter() - pEnt->GetAbsOrigin()) + pEnt->GetRenderOrigin(); Vector screenPos; debugoverlay->ScreenPosition( pos, screenPos ); surface()->DrawSetColor(Color(255,255,255,255.0f * m_fTurretTargetLock[i] )); surface()->DrawSetTexture(m_nLeftBracketTexture); int bx = screenPos[0] - fDist; int by = screenPos[1] - fDist; surface()->DrawTexturedRect(bx - iBSize, by - iBSize, bx + iBSize, by + iBSize); surface()->DrawSetTexture(m_nRightBracketTexture); bx = screenPos[0] + fDist; by = screenPos[1] - fDist; surface()->DrawTexturedRect(bx - iBSize, by - iBSize, bx + iBSize, by + iBSize); surface()->DrawSetTexture(m_nLowerBracketTexture); bx = screenPos[0]; by = screenPos[1] + fDist; surface()->DrawTexturedRect(bx - iBSize, by - iBSize, bx + iBSize, by + iBSize); } // draw crosshair C_ASW_Player* pPlayer = C_ASW_Player::GetLocalASWPlayer(); if ( pPlayer ) { C_ASW_Marine *pMarine = pPlayer->GetViewMarine(); bool bControllingTurret = (pMarine && pMarine->IsControllingTurret()); if (bControllingTurret) { C_ASW_Remote_Turret *pTurret = pMarine->GetRemoteTurret(); if (pTurret) { Vector vecWeaponSrc = pTurret->GetTurretMuzzlePosition(); QAngle angFacing = pTurret->EyeAngles(); Vector vecWeaponDir; AngleVectors(angFacing, &vecWeaponDir); // trace along until we hit something trace_t tr; UTIL_TraceLine(vecWeaponSrc, vecWeaponSrc + vecWeaponDir * 1200, // fog range of the turret MASK_SHOT, pTurret, COLLISION_GROUP_NONE, &tr); //Msg("Tracing from %s ", VecToString(vecWeaponSrc)); //Msg("at angle %s\n", VecToString(angFacing)); Vector pos = tr.DidHit() ? tr.endpos : vecWeaponSrc + vecWeaponDir * 1200; Vector screenPos; debugoverlay->ScreenPosition( pos, screenPos ); // paint a crosshair at that spot surface()->DrawSetColor(Color(255,255,255,255)); surface()->DrawSetTexture(m_nTurretCrosshair); surface()->DrawTexturedRect(screenPos[0] - iBSize, screenPos[1] - iBSize, // shift it up a bit to match where the gun actually fires (not sure why it's not matched already!) screenPos[0] + iBSize, screenPos[1] + iBSize); } } } // draw interlace/noise overlay if (m_nTurretTexture!=-1) { surface()->DrawSetColor(Color(255,255,255,255)); surface()->DrawSetTexture(m_nTurretTexture); surface()->DrawTexturedRect(0, 0, ScreenWidth(), ScreenHeight()); } }