Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ===============
- idPlayer::DrawHUD
- ===============
- */
- void idPlayer::DrawHUD( idUserInterface *_hud ) {
- idUserInterface * cursor = idPlayer::cursor;
- if ( !gameLocal.GetLocalPlayer() ) {
- // server netdemo
- if ( gameLocal.GetDemoState() == DEMO_PLAYING && gameLocal.IsServerDemo() && gameLocal.GetDemoFollowClient() == entityNumber ) {
- cursor = gameLocal.GetDemoCursor();
- if ( cursor ) {
- cursor->HandleNamedEvent( "showCrossCombat" );
- }
- }
- } else {
- if ( team != gameLocal.GetLocalPlayer()->hudTeam && _hud ) {
- _hud->HandleNamedEvent( (team ? "setTeam_strogg" : "setTeam_marine") );
- gameLocal.GetLocalPlayer()->hudTeam = team;
- }
- // if updating the hud of a followed client
- idPlayer *p = gameLocal.GetLocalPlayer();
- if ( p->spectating && p->spectator == entityNumber ) {
- cursor = p->GetCursorGUI();
- if ( cursor ) {
- cursor->HandleNamedEvent( "showCrossCombat" );
- }
- }
- }
- if ( disableHud || influenceActive != INFLUENCE_NONE || privateCameraView || !_hud || !g_showHud.GetBool() ) {
- return;
- }
- if ( objectiveSystemOpen ) {
- if ( !GuiActive() ) {
- // showing weapon zoom gui when objectives are open because that's the way I'z told to make it werkz
- if ( weapon && weapon->GetZoomGui( ) && zoomed ) {
- weapon->GetZoomGui( )->Redraw( gameLocal.time );
- }
- }
- return;
- }
- if ( gameLocal.isMultiplayer ) {
- _hud->SetStateBool( "mp", true );
- } else {
- _hud->SetStateBool( "mp", false );
- }
- // Draw the cinematic hud when in a cinematic
- if ( gameLocal.GetCamera( ) ) {
- if ( cinematicHud && !(gameLocal.editors & EDITOR_MODVIEW) ) {
- cinematicHud->Redraw( gameLocal.time );
- }
- return;
- }
- // Let the vehicle draw the hud instead
- if ( vehicleController.IsDriving( ) ) {
- if ( !gameDebug.IsHudActive( DBGHUD_ANY ) ) {
- vehicleController.DrawHUD( );
- if ( cursor && health > 0 ) {
- // mekberg: adjustable crosshair size.
- int crossSize = cvarSystem->GetCVarInteger( "g_crosshairSize" );
- crossSize = crossSize - crossSize % 8;
- cvarSystem->SetCVarInteger( "g_crosshairSize", crossSize );
- cursor->SetStateInt( "g_crosshairSize", crossSize );
- cursor->SetStateBool( "vehiclecursor", true );
- vehicleController.UpdateCursorGUI( cursor );
- cursor->Redraw( gameLocal.time );
- }
- }
- _hud = GetHud();
- // Boss bar
- if ( _hud && _hud->State().GetInt( "boss_health", "-1" ) != (bossEnemy ? bossEnemy->health : -1) ) {
- if ( !bossEnemy || bossEnemy->health <= 0 ) {
- bossEnemy = NULL;
- _hud->SetStateInt( "boss_health", -1 );
- _hud->HandleNamedEvent( "hideBossBar" );
- _hud->HandleNamedEvent( "hideBossShieldBar" ); // grrr, for boss buddy..but maybe other bosses will have shields?
- } else {
- _hud->SetStateInt( "boss_health", bossEnemy->health );
- _hud->HandleNamedEvent( "updateBossBar" );
- }
- }
- return;
- }
- if ( cursor ) {
- cursor->SetStateBool( "vehiclecursor", false );
- }
- // FIXME: this is temp to allow the sound meter to show up in the hud
- // it should be commented out before shipping but the code can remain
- // for mod developers to enable for the same functionality
- _hud->SetStateInt( "s_debug", cvarSystem->GetCVarInteger( "s_showLevelMeter" ) );
- // don't draw main hud in spectator (only mphud)
- if ( !spectating && !gameDebug.IsHudActive( DBGHUD_ANY ) ) {
- // weapon targeting crosshair
- if ( !GuiActive() ) {
- if ( weapon && weapon->GetZoomGui( ) && zoomed ) {
- weapon->GetZoomGui( )->Redraw( gameLocal.time );
- }
- // RAVEN BEGIN
- // mekberg: removed check for weapon->ShowCrosshair.
- // we want to show the crosshair regardless for NPC tags
- if ( cursor && health > 0 ) {
- // Pass the current weapon to the cursor gui for custom crosshairs
- // mekberg: adjustable crosshair size.
- int crossSize = cvarSystem->GetCVarInteger( "g_crosshairSize" );
- crossSize = crossSize - crossSize % 8;
- cvarSystem->SetCVarInteger( "g_crosshairSize", crossSize );
- cursor->SetStateInt( "g_crosshairSize", crossSize );
- // RAVEN END
- cursor->Redraw( gameLocal.time );
- }
- }
- UpdateHudStats( _hud );
- if ( focusBrackets ) {
- // If 2d_calc is still true then the gui didnt render so we can abandon it
- if ( focusBrackets->State().GetBool( "2d_calc" ) ) {
- focusBrackets->SetStateBool( "2d_calc", false );
- focusBrackets = NULL;
- focusBracketsTime = 0;
- _hud->HandleNamedEvent( "hideBrackets" );
- } else {
- _hud->SetStateString( "bracket_left", focusBrackets->State().GetString( "2d_min_x" ) );
- _hud->SetStateString( "bracket_top", focusBrackets->State().GetString( "2d_min_y" ) );
- _hud->SetStateFloat( "bracket_width", focusBrackets->State().GetFloat( "2d_max_x" ) - focusBrackets->State().GetFloat( "2d_min_x" ) );
- _hud->SetStateFloat( "bracket_height", focusBrackets->State().GetFloat( "2d_max_y" ) - focusBrackets->State().GetFloat( "2d_min_y" ) );
- // TODO: Find a way to get bracket text from gui to hud
- }
- }
- _hud->Redraw( gameLocal.realClientTime );
- }
- if ( gameLocal.isMultiplayer ) {
- idUserInterface* _mphud = mphud;
- // server netdemos don't have a local player, grab the right mphud
- if ( !gameLocal.GetLocalPlayer() ) {
- assert( gameLocal.GetDemoState() == DEMO_PLAYING && gameLocal.IsServerDemo() );
- assert( gameLocal.GetDemoFollowClient() >= 0 );
- assert( gameLocal.entities[ gameLocal.GetDemoFollowClient() ] && gameLocal.entities[ gameLocal.GetDemoFollowClient() ]->IsType( idPlayer::GetClassType() ) );
- _mphud = gameLocal.GetDemoMphud();
- } else if ( gameLocal.GetLocalPlayer() != this ) {
- // if we're spectating someone else, use our local hud
- _mphud = gameLocal.GetLocalPlayer()->mphud;
- }
- if ( _mphud ) {
- gameLocal.mpGame.UpdateHud( _mphud );
- _mphud->Redraw( gameLocal.time );
- }
- if ( overlayHud && overlayHudTime > gameLocal.time && overlayHudTime != 0 ) {
- overlayHud->Redraw( gameLocal.time );
- } else {
- overlayHud = NULL;
- overlayHudTime = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement