HIDEHUD not working in observer mode. Created 4 years ago2020-03-04 15:38:01 UTC by abbadon abbadon

Created 4 years ago2020-03-04 15:38:01 UTC by abbadon abbadon

Posted 4 years ago2020-03-04 15:38:01 UTC Post #343841
Hello again. Hi have found this problem with the observer mode, the startobserver function in observer.cpp has this part of code that previously deleted all the content of the screen but the spectator menu:
m_iHideHUD = (HIDEHUD_ALL);
It worked fine, until I discovered that the code I added to make run clientside functions as seen in this TWHL Thread make one of the HUD parts still appear:
User posted image
I have tried several things in the server side on client.cpp where the code for entering the spectator mode is:
	////////////////////////////////////////////////////////////////////////////////////////
	// ARM: Observer Mode                                                                 //
	////////////////////////////////////////////////////////////////////////////////////////
    else if ( FStrEq(pcmd, "zwc_cmd3" ) )
	{
		// Prevent this is the cvar is set
		if ( allow_spectators.value )
		{
			CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pev);
			pPlayer->m_iHideHUD |= HIDEHUD_ALL;

			edict_t *pentSpawnSpot = EntSelectSpawnPoint( pPlayer );
			pPlayer->StartObserver( VARS(pentSpawnSpot)->origin, VARS(pentSpawnSpot)->angles);
		}
	}
    //////////////////////////////////////////////////////////////////////////////////////////
With no luck at all. This code WORKED fine even before adding this part :(
pPlayer->m_iHideHUD |= HIDEHUD_ALL; 
In the other hand, the clientside part, responsible of the code that shows that part of the HUD, is in ammo.cpp"...
 if ( CL_IsThirdPerson ())

    {
		//Zion: Ocultar el Crosshair en Tercera persona.
		//SetCrosshair(m_pWeapon->hZoomedCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255);
		gViewPort->HideScope();//No mostrar HUD en 3ª persona NUNCA. Cuando cambias de arma te lo enseña el joputa.
	    gViewPort->ShowScope1();
		//SetCrosshair(0, nullrc, 0, 0, 0);//new
		return 0;
	}


	if ( gHUD.m_iFOV >= 90 )
	{ // normal crosshairs
		if (fOnTarget && m_pWeapon->hAutoaim)
			SetCrosshair(m_pWeapon->hAutoaim, m_pWeapon->rcAutoaim, 255, 255, 255);
		else
		SetCrosshair(m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255);
		gViewPort->ShowScope();//Mostrar HUD nada más "arrancar"
        gViewPort->HideScope1();


}
In in_camera.cpp...
void CAM_ToThirdPerson(void)
{
	vec3_t viewangles;



	gEngfuncs.GetViewAngles( (float *)viewangles );

	if( !cam_thirdperson )
	{
		cam_thirdperson = 1;

		cam_ofs[ YAW ] = viewangles[ YAW ];
		cam_ofs[ PITCH ] = viewangles[ PITCH ];
		cam_ofs[ 2 ] = CAM_MIN_DIST;
        gViewPort->ShowScope1();//Aim System Zion Antiguo sistema de puntería
        gViewPort->HideScope();//Aim System Zion
	}



//	if( cam_thirdperson )//ARM
//	{
//		CAM_ToFirstPerson();//ARM
//
//		return;
//	}

	gEngfuncs.Cvar_SetValue( "cam_command", 0 );
}

void CAM_ToFirstPerson(void)
{
	cam_thirdperson = 0;
	gViewPort->HideScope1();//Aim System Zion Antiguo sistema de puntería
	gViewPort->ShowScope();//
	gEngfuncs.Cvar_SetValue( "cam_command", 0 );

}
In input.cpp ...
//======================================
	// Mostrar-Esconder HUD HUD(c) Sluggo
	//======================================

	if ( g_bShowHudToggle )
	   	{

			gHUD.m_iHideHUDDisplay &= ~ HIDEHUD_WEAPONS;
            gHUD.m_iHideHUDDisplay &= ~ HIDEHUD_HEALTH;
			gHUD.m_iHideHUDDisplay &= ~ HIDEHUD_ALL;
			gHUD.m_iHideHUDDisplay &= ~ HIDEHUD_FLASHLIGHT;
			if (  CL_IsThirdPerson ()) { gViewPort->ShowScope1(); gViewPort->HideScope();}
			if ( !CL_IsThirdPerson ()) { gViewPort->ShowScope(); gViewPort->HideScope1();}

			PlaySound("player/hudon.wav", 5);//(c)Admer

			if (gHUD.m_Health.m_iHealth <= 0) {gViewPort->HideScope(); gViewPort->HideScope1();}//NUEVO y Funciona


		}

		if ( g_bHideHudToggle )
		{
			gHUD.m_iHideHUDDisplay |=  HIDEHUD_WEAPONS;
			gHUD.m_iHideHUDDisplay |=  HIDEHUD_HEALTH;
			gHUD.m_iHideHUDDisplay |=  HIDEHUD_FLASHLIGHT;
			gViewPort->HideScope();
			gViewPort->HideScope1();

			PlaySound("player/hudoff.wav", 5);//(c)Admer

		}


//=============================
And in vgui_TeamFortressViewport.cpp...
//------------------------------------------------------
// Zion Thirdperson Aim System
//------------------------------------------------------
void TeamFortressViewport::ShowScope()
{
   if (m_pScopePanel)
	{
      m_pScopePanel->setVisible( true );
	}
}

void TeamFortressViewport::HideScope()
{
   if (m_pScopePanel)
   {
      m_pScopePanel->setVisible( false );
   }
}

void TeamFortressViewport::CreateScope()
{
   // Create the panel
   m_pScopePanel = new CScopePanel(0, 0, ScreenWidth, ScreenHeight);
   m_pScopePanel->setParent(this);
   m_pScopePanel->setVisible( false );
   m_pScopePanel->Update();
}

void TeamFortressViewport::ShowScope1()
{
   if (m_pScopePanel1)
   {
    m_pScopePanel1->setVisible( true );
   }
}

void TeamFortressViewport::HideScope1()
{
   if (m_pScopePanel1)
   {
      m_pScopePanel1->setVisible( false );
   }
}

void TeamFortressViewport::CreateScope1()
{
   // Create the panel
   m_pScopePanel1 = new CScopePanel1 (0, 0, ScreenWidth, ScreenHeight);
   m_pScopePanel1->setParent(this);
   m_pScopePanel1->setVisible( false );
   m_pScopePanel1->Update();
}
No matter how many modifications I did trying to add the code that shows and hides that part of the HUD I cannot make it dissapear once I use the server command to hide the HUD ( zwc_cmd3 that is in the commandmenu.txt file for the in-game Help menu). The Showscope and Hidescope fucntions are not in any other place but there, of course...
E:\DevZWC20\Elementos Basicos MAYO 2017\Single-Player Source\cl_dll\ammo.cpp(634):	    gViewPort->ShowScope1();
E:\DevZWC20\Elementos Basicos MAYO 2017\Single-Player Source\cl_dll\ammo.cpp(646):		gViewPort->ShowScope();//Mostrar HUD nada más "arrancar"
E:\DevZWC20\Elementos Basicos MAYO 2017\Single-Player Source\cl_dll\in_camera.cpp(456):        gViewPort->ShowScope1();//Aim System Zion Antiguo sistema de puntería
E:\DevZWC20\Elementos Basicos MAYO 2017\Single-Player Source\cl_dll\in_camera.cpp(476):	gViewPort->ShowScope();//
E:\DevZWC20\Elementos Basicos MAYO 2017\Single-Player Source\cl_dll\input.cpp(899):			if (  CL_IsThirdPerson ()) { gViewPort->ShowScope1(); gViewPort->HideScope();}
E:\DevZWC20\Elementos Basicos MAYO 2017\Single-Player Source\cl_dll\input.cpp(900):			if ( !CL_IsThirdPerson ()) { gViewPort->ShowScope(); gViewPort->HideScope1();}
E:\DevZWC20\Elementos Basicos MAYO 2017\Single-Player Source\cl_dll\vgui_TeamFortressViewport.cpp(1913):void TeamFortressViewport::ShowScope()
E:\DevZWC20\Elementos Basicos MAYO 2017\Single-Player Source\cl_dll\vgui_TeamFortressViewport.cpp(1938):void TeamFortressViewport::ShowScope1()
E:\DevZWC20\Elementos Basicos MAYO 2017\Single-Player Source\cl_dll\vgui_TeamFortressViewport.h(578):    void ShowScope( void );
E:\DevZWC20\Elementos Basicos MAYO 2017\Single-Player Source\cl_dll\vgui_TeamFortressViewport.h(582):    void ShowScope1( void );
Please, help. :pwned: :crowbar:
Posted 4 years ago2020-03-05 21:23:49 UTC Post #343857
Nevermind. I did "almost" fixed it. Two little hidden lines of code were the culprits. :crowbar: Still a little glitch, buuuut, all is fine now. Thanks!! :) :crowbar:
You must be logged in to post a response.