This commit is contained in:
Pinsplash 2024-05-07 13:32:26 -05:00
parent b819b6579a
commit 306a5d565b
9 changed files with 51 additions and 54 deletions

View File

@ -69,6 +69,7 @@ public:
C_VGuiScreen();
~C_VGuiScreen();
CPanelWrapper m_PanelWrapper;
virtual void PreDataUpdate( DataUpdateType_t updateType );
virtual void OnDataChanged( DataUpdateType_t type );
virtual int DrawModel( int flags );
@ -154,7 +155,6 @@ private:
VMatrix m_PanelToWorld;
CPanelWrapper m_PanelWrapper;
CHandle<C_BasePlayer> m_hPlayerOwner;
};

View File

@ -3,7 +3,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommand>C:\Program Files (x86)\Steam\steamapps\common\Source SDK Base 2013 Singleplayer\hl2.exe</LocalDebuggerCommand>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>-allowdebug -novid -game "C:\Program Files (x86)\Steam\steamapps\sourcemods\ep1chaos"</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>-allowdebug -novid -game "C:\Program Files (x86)\Steam\steamapps\sourcemods\ep2chaos"</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommand>C:\Program Files (x86)\Steam\steamapps\common\Source SDK Base 2013 Singleplayer\hl2.exe</LocalDebuggerCommand>

View File

@ -41,13 +41,17 @@ public:
int m_iNumRadarContacts;
Vector m_vecRadarContactPos[ RADAR_MAX_CONTACTS ];
int m_iRadarContactType[ RADAR_MAX_CONTACTS ];
EHANDLE m_hRadarScreen;
CHudRadar* m_Radar;
void UpdateJalopyRadar();
};
C_PropJeepEpisodic *g_pJalopy = NULL;
//C_PropJeepEpisodic *g_pJalopy = NULL;
IMPLEMENT_CLIENTCLASS_DT( C_PropJeepEpisodic, DT_CPropJeepEpisodic, CPropJeepEpisodic )
//CNetworkVar( int, m_iNumRadarContacts );
RecvPropInt( RECVINFO(m_iNumRadarContacts) ),
RecvPropEHandle(RECVINFO(m_hRadarScreen)),
//CNetworkArray( Vector, m_vecRadarContactPos, RADAR_MAX_CONTACTS );
RecvPropArray( RecvPropVector(RECVINFO(m_vecRadarContactPos[0])), m_vecRadarContactPos ),
@ -59,28 +63,28 @@ END_RECV_TABLE()
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void __MsgFunc_UpdateJalopyRadar(bf_read &msg)
void C_PropJeepEpisodic::UpdateJalopyRadar()
{
// Radar code here!
if( !GetHudRadar() )
if (!m_Radar)
return;
m_Radar->Paint();
// Sometimes we update more quickly when we need to track something in high resolution.
// Usually we do not, so default to false.
GetHudRadar()->m_bUseFastUpdate = false;
m_Radar->m_bUseFastUpdate = false;
for( int i = 0 ; i < g_pJalopy->m_iNumRadarContacts ; i++ )
for( int i = 0 ; i < m_iNumRadarContacts ; i++ )
{
if( g_pJalopy->m_iRadarContactType[i] == RADAR_CONTACT_DOG )
if( m_iRadarContactType[i] == RADAR_CONTACT_DOG )
{
GetHudRadar()->m_bUseFastUpdate = true;
m_Radar->m_bUseFastUpdate = true;
break;
}
}
float flContactTimeToLive;
if( GetHudRadar()->m_bUseFastUpdate )
if (m_Radar->m_bUseFastUpdate)
{
flContactTimeToLive = RADAR_UPDATE_FREQUENCY_FAST;
}
@ -89,9 +93,9 @@ void __MsgFunc_UpdateJalopyRadar(bf_read &msg)
flContactTimeToLive = RADAR_UPDATE_FREQUENCY;
}
for( int i = 0 ; i < g_pJalopy->m_iNumRadarContacts ; i++ )
for( int i = 0 ; i < m_iNumRadarContacts ; i++ )
{
GetHudRadar()->AddRadarContact( g_pJalopy->m_vecRadarContactPos[i], g_pJalopy->m_iRadarContactType[i], flContactTimeToLive );
m_Radar->AddRadarContact(m_vecRadarContactPos[i], m_iRadarContactType[i], flContactTimeToLive);
}
}
@ -99,12 +103,7 @@ void __MsgFunc_UpdateJalopyRadar(bf_read &msg)
//-----------------------------------------------------------------------------
C_PropJeepEpisodic::C_PropJeepEpisodic()
{
if( g_pJalopy == NULL )
{
usermessages->HookMessage( "UpdateJalopyRadar", __MsgFunc_UpdateJalopyRadar );
}
g_pJalopy = this;
UpdateJalopyRadar();
}
//-----------------------------------------------------------------------------
@ -112,15 +111,23 @@ C_PropJeepEpisodic::C_PropJeepEpisodic()
//-----------------------------------------------------------------------------
void C_PropJeepEpisodic::Simulate( void )
{
if (m_hRadarScreen != NULL && m_Radar == NULL)
{
C_VGuiScreen *pScreen = dynamic_cast<C_VGuiScreen *>(m_hRadarScreen.Get());
if (pScreen)
m_Radar = dynamic_cast<CHudRadar *>(pScreen->m_PanelWrapper.GetPanel());
}
// Keep trying to hook to the radar.
if( GetHudRadar() != NULL )
if (m_Radar != NULL)
{
// This is not our ideal long-term solution. This will only work if you only have
// one jalopy in a given level. The Jalopy and the Radar Screen are currently both
// assumed to be singletons. This is appropriate for EP2, however. (sjb)
GetHudRadar()->SetVehicle( this );
m_Radar->SetVehicle(this);
}
UpdateJalopyRadar();
BaseClass::Simulate();
}

View File

@ -29,13 +29,13 @@ DECLARE_VGUI_SCREEN_FACTORY( CHudRadar, "jalopy_radar_panel" );
#define RADAR_CONTACT_DOG_MATERIAL "vgui/icons/icon_dog" // Dog
#define RADAR_CONTACT_BASE_MATERIAL "vgui/icons/icon_base" // Ally base
static CHudRadar *s_Radar = NULL;
//static CHudRadar *s_Radar = NULL;
/*
CHudRadar *GetHudRadar()
{
return s_Radar;
}
*/
DECLARE_HUDELEMENT( CMapOverview );
//---------------------------------------------------------
@ -55,7 +55,7 @@ CHudRadar::CHudRadar( vgui::Panel *parent, const char *panelName ) : BaseClass(
//---------------------------------------------------------
CHudRadar::~CHudRadar()
{
s_Radar = NULL;
//s_Radar = NULL;
#if defined(_X360)
if( m_iImageID != -1 )
@ -102,7 +102,7 @@ bool CHudRadar::Init( KeyValues* pKeyValues, VGuiScreenInitData_t* pInitData )
{
bool result = BaseClass::Init( pKeyValues, pInitData );
ClearAllRadarContacts();
s_Radar = this;
//s_Radar = this;
m_ghostAlpha = 0;
m_flTimeStartGhosting = gpGlobals->curtime + 1.0f;

View File

@ -74,5 +74,5 @@ private:
int m_textureID_IconBase;
};
extern CHudRadar *GetHudRadar();
//extern CHudRadar *GetHudRadar();
#endif // HUD_RADAR_H

View File

@ -370,6 +370,7 @@ IMPLEMENT_SERVERCLASS_ST(CPropJeepEpisodic, DT_CPropJeepEpisodic)
//CNetworkVar( int, m_iNumRadarContacts );
SendPropInt( SENDINFO(m_iNumRadarContacts), 8 ),
SendPropEHandle(SENDINFO(m_hRadarScreen)),
//CNetworkArray( Vector, m_vecRadarContactPos, RADAR_MAX_CONTACTS );
SendPropArray( SendPropVector( SENDINFO_ARRAY(m_vecRadarContactPos), -1, SPROP_COORD), m_vecRadarContactPos ),
@ -966,12 +967,13 @@ void CPropJeepEpisodic::UpdateRadar( bool forceUpdate )
}
//Msg("Server detected %d objects\n", m_iNumRadarContacts );
/*
CBasePlayer *pPlayer = AI_GetSinglePlayer();
CSingleUserRecipientFilter filter(pPlayer);
UserMessageBegin( filter, "UpdateJalopyRadar" );
WRITE_BYTE( 0 ); // end marker
MessageEnd(); // send message
*/
}
ConVar jalopy_cargo_anim_time( "jalopy_cargo_anim_time", "1.0" );

View File

@ -144,7 +144,7 @@ private:
bool m_bRadarEnabled;
bool m_bRadarDetectsEnemies;
float m_flNextRadarUpdateTime;
EHANDLE m_hRadarScreen;
CNetworkHandle(CBaseEntity, m_hRadarScreen);
EHANDLE m_hLinkControllerFront;
EHANDLE m_hLinkControllerRear;

View File

@ -7261,31 +7261,19 @@ void CERandomVehicle::StartEffect()
nRandom = chaos_rng1.GetInt() == -1 ? RandomInt(0, 5) : chaos_rng1.GetInt();
if (nRandom == 5)
{
if (gEntList.FindEntityByClassname(NULL, "prop_vehicle_jeep"))//avoid radar issues that come up when there is more than one jalopy in the map at a time
{
nRandom = chaos_rng1.GetInt() == -1 ? RandomInt(0, 4) : chaos_rng1.GetInt();
}
CBaseEntity *pJalopy;
if (UTIL_GetLocalPlayer()->GetModelScale() == 2)
pJalopy = ChaosSpawnVehicle("prop_vehicle_jeep", MAKE_STRING("Spawn Jalopy"), SPAWNTYPE_VEHICLE, "models/vehicle_2.mdl", "jalopy", "scripts/vehicles/jalopy_2.txt");
else if (UTIL_GetLocalPlayer()->GetModelScale() == 0.5)
pJalopy = ChaosSpawnVehicle("prop_vehicle_jeep", MAKE_STRING("Spawn Jalopy"), SPAWNTYPE_VEHICLE, "models/vehicle_0_5.mdl", "jalopy", "scripts/vehicles/jalopy_0_5.txt");
else
{
CBaseEntity *pJalopy;
if (UTIL_GetLocalPlayer()->GetModelScale() == 2)
pJalopy = ChaosSpawnVehicle("prop_vehicle_jeep", MAKE_STRING("Spawn Jalopy"), SPAWNTYPE_VEHICLE, "models/vehicle_2.mdl", "jalopy", "scripts/vehicles/jalopy_2.txt");
else if (UTIL_GetLocalPlayer()->GetModelScale() == 0.5)
pJalopy = ChaosSpawnVehicle("prop_vehicle_jeep", MAKE_STRING("Spawn Jalopy"), SPAWNTYPE_VEHICLE, "models/vehicle_0_5.mdl", "jalopy", "scripts/vehicles/jalopy_0_5.txt");
else
pJalopy = ChaosSpawnVehicle("prop_vehicle_jeep", MAKE_STRING("Spawn Jalopy"), SPAWNTYPE_VEHICLE, "models/vehicle.mdl", "jalopy", "scripts/vehicles/jalopy.txt");
if (pJalopy == NULL)
{
Msg("Did not spawn jalopy\n");
return;
}
pJalopy->AcceptInput("EnableRadar", pJalopy, pJalopy, sVariant, 0);
pJalopy->AcceptInput("EnableRadarDetectEnemies", pJalopy, pJalopy, sVariant, 0);
pJalopy->AcceptInput("AddBusterToCargo", pJalopy, pJalopy, sVariant, 0);
CBasePlayer* pPlayer = UTIL_GetLocalPlayer();
CHL2_Player *pHL2Player = static_cast<CHL2_Player*>(pPlayer);
pHL2Player->SetLocatorTargetEntity(pJalopy);
}
pJalopy = ChaosSpawnVehicle("prop_vehicle_jeep", MAKE_STRING("Spawn Jalopy"), SPAWNTYPE_VEHICLE, "models/vehicle.mdl", "jalopy", "scripts/vehicles/jalopy.txt");
pJalopy->AcceptInput("EnableRadar", pJalopy, pJalopy, sVariant, 0);
pJalopy->AcceptInput("EnableRadarDetectEnemies", pJalopy, pJalopy, sVariant, 0);
pJalopy->AcceptInput("AddBusterToCargo", pJalopy, pJalopy, sVariant, 0);
CBasePlayer* pPlayer = UTIL_GetLocalPlayer();
CHL2_Player *pHL2Player = static_cast<CHL2_Player*>(pPlayer);
pHL2Player->SetLocatorTargetEntity(pJalopy);
}
if (nRandom == 4)
{

View File

@ -44,7 +44,7 @@ void RegisterUserMessages( void )
usermessages->Register( "CreditsMsg", 1 );
usermessages->Register( "LogoTimeMsg", 4 );
usermessages->Register("AchievementEvent", -1);
usermessages->Register("UpdateJalopyRadar", -1);
//usermessages->Register("UpdateJalopyRadar", -1);
usermessages->Register("Go", -1);
#ifndef _X360