Example #1
0
int CHud::MsgFunc_ServerName( const char *pszName, int iSize, void *pbuf )
{
	char	m_szServerName[32];

	BEGIN_READ( pszName, iSize, pbuf );
	strncpy( m_szServerName, READ_STRING(), 32 );
	END_READ();
	
 	return 1;
}
Example #2
0
int CHudRedeemer :: MsgFunc_WarHUD( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );
	m_iHudMode = READ_BYTE();
	m_iOldHudMode = -1;	// force to update
	ClearPermanentFades ();
	END_READ();

	return 1;
}
Example #3
0
int CHud :: MsgFunc_RoomType( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	CVAR_SET_FLOAT( "room_type", (float)READ_BYTE( ));

	END_READ();

	return 1;
}
Example #4
0
int CHud::MsgFunc_HUDColor(const char *pszName,  int iSize, void *pbuf)
{
	BEGIN_READ( pszName, iSize, pbuf );

	m_iHUDColor = READ_LONG();

	END_READ();
	
	return 1;
}
Example #5
0
int CHud :: MsgFunc_AddPortal( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	// AddPortalBrushEntity( READ_BYTE() );

	END_READ();
	
	return 1;
}
Example #6
0
int CHud :: MsgFunc_GameMode( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	m_Teamplay = READ_BYTE();

	END_READ();
	
	return 1;
}
Example #7
0
int CHud :: MsgFunc_TempEntity( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	HUD_ParseTempEntity();

	END_READ();
	
	return 1;
}
Example #8
0
int CHudSayText :: MsgFunc_SayText( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, pbuf, iSize );

	int client_index = READ_BYTE(); // the client who spoke the message
	SayTextPrint( READ_STRING(), iSize - 1, client_index );

	END_READ();
	
	return 1;
}
Example #9
0
int CHud :: MsgFunc_SetSkin( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	edict_t *viewmodel = GetViewModel();
	viewmodel->v.skin = READ_BYTE();

	END_READ();
	
	return 1;
}
Example #10
0
int CHudAmmo::MsgFunc_WeapPickup( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, pbuf, iSize );
	int iIndex = READ_BYTE();

	// Add the weapon to the history
	gHR.AddToHistory( HISTSLOT_WEAP, iIndex );

	END_READ();

	return 1;
}
Example #11
0
int CHudAmmo::MsgFunc_ItemPickup( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, pbuf, iSize );
	const char *szName = READ_STRING();

	// Add the weapon to the history
	gHR.AddToHistory( HISTSLOT_ITEM, szName );

	END_READ();

	return 1;
}
Example #12
0
int CHud :: MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	m_iConcussionEffect = READ_BYTE();
	if( m_iConcussionEffect )
		m_StatusIcons.EnableIcon( "dmg_concuss", 255, 160, 0 );
	else m_StatusIcons.DisableIcon( "dmg_concuss" );

	END_READ();

	return 1;
}
Example #13
0
//
// AmmoX  -- Update the count of a known type of ammo
// 
int CHudAmmo::MsgFunc_AmmoX( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, pbuf, iSize );

	int iIndex = READ_BYTE();
	int iCount = READ_BYTE();

	gWR.SetAmmo( iIndex, abs( iCount ));

	END_READ();

	return 1;
}
Example #14
0
int CHudAmmo::MsgFunc_AmmoPickup( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, pbuf, iSize );
	int iIndex = READ_BYTE();
	int iCount = READ_BYTE();

	// Add ammo to the history
	gHR.AddToHistory( HISTSLOT_AMMO, iIndex, abs( iCount ));

	END_READ();

	return 1;
}
Example #15
0
int CHud :: MsgFunc_SetSky( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	m_iSkyMode = READ_BYTE();
	m_vecSkyPos[0] = READ_COORD();
	m_vecSkyPos[1] = READ_COORD();
	m_vecSkyPos[2] = READ_COORD();

	END_READ();
	
	return 1;
}
Example #16
0
int CHud :: MsgFunc_Particle( const char *pszName,  int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	int idx = READ_SHORT();
	char *sz = READ_STRING();

	CreateAurora( idx, sz );

	END_READ();
	
	return 1;
}
Example #17
0
int CHud :: MsgFunc_WeaponAnim( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	int iAnim = READ_BYTE();
	int iBody = READ_BYTE();
	float framerate = READ_BYTE() * 0.0625;

	SendWeaponAnim( iAnim, iBody, framerate ); 

	END_READ();
	
	return 1;
}
Example #18
0
// Message handler for text messages
// displays a string, looking them up from the titles.txt file, which can be localised
// parameters:
//   byte:   message direction  ( HUD_PRINTCONSOLE, HUD_PRINTNOTIFY, HUD_PRINTCENTER, HUD_PRINTTALK )
//   string: message
// optional parameters:
//   string: message parameter 1
//   string: message parameter 2
//   string: message parameter 3
//   string: message parameter 4
// any string that starts with the character '#' is a message name, and is used to look up the real message in titles.txt
// the next (optional) one to four strings are parameters for that string (which can also be message names if they begin with '#')
int CHudTextMessage::MsgFunc_TextMsg( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	int msg_dest = READ_BYTE();

	static char szBuf[6][128];
	char *msg_text = LookupString( READ_STRING(), &msg_dest );
	msg_text = strcpy( szBuf[0], msg_text );

	// keep reading strings and using C format strings for subsituting the strings into the localised text string
	char *sstr1 = LookupString( READ_STRING() );
	sstr1 = strcpy( szBuf[1], sstr1 );
	StripEndNewlineFromString( sstr1 );  // these strings are meant for subsitution into the main strings, so cull the automatic end newlines
	char *sstr2 = LookupString( READ_STRING() );
	sstr2 = strcpy( szBuf[2], sstr2 );
	StripEndNewlineFromString( sstr2 );
	char *sstr3 = LookupString( READ_STRING() );
	sstr3 = strcpy( szBuf[3], sstr3 );
	StripEndNewlineFromString( sstr3 );
	char *sstr4 = LookupString( READ_STRING() );
	sstr4 = strcpy( szBuf[4], sstr4 );
	StripEndNewlineFromString( sstr4 );
	char *psz = szBuf[5];

	switch ( msg_dest )
	{
	case HUD_PRINTCENTER:
		sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
		CenterPrint( ConvertCRtoNL( psz ) );
		break;
	case HUD_PRINTNOTIFY:
		psz[0] = 1;  // mark this message to go into the notify buffer
		sprintf( psz+1, msg_text, sstr1, sstr2, sstr3, sstr4 );
		ConsolePrint( ConvertCRtoNL( psz ) );
		break;
	case HUD_PRINTTALK:
		sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
		gHUD.m_SayText.SayTextPrint( ConvertCRtoNL( psz ), 128 );
		break;
	case HUD_PRINTCONSOLE:
		sprintf( psz, msg_text, sstr1, sstr2, sstr3, sstr4 );
		ConsolePrint( ConvertCRtoNL( psz ) );
		break;
	}
	END_READ();

	return 1;
}
Example #19
0
int CHud :: MsgFunc_SetFog( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	m_vecFogColor.x = (float)(READ_BYTE() / 255.0f);
	m_vecFogColor.y = (float)(READ_BYTE() / 255.0f);
	m_vecFogColor.z = (float)(READ_BYTE() / 255.0f);

	m_flStartDist = READ_SHORT();
          m_flEndDist = READ_SHORT();

	END_READ();
	
	return 1;
}
Example #20
0
// Message handler for StatusText message
// accepts two values:
// byte: index into the status value array
// short: value to store
int CHudStatusBar :: MsgFunc_StatusValue( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, pbuf, iSize );

	int index = READ_BYTE();
	if( index < 1 || index >= MAX_STATUSBAR_VALUES )
		return 1; // index out of range

	m_iStatusValues[index] = READ_SHORT();

	m_bReparseString = TRUE;

	END_READ();
	
	return 1;
}
Example #21
0
int CHudTrain::MsgFunc_Train( const char *pszName,  int iSize, void *pbuf )
{
	BEGIN_READ( pszName, pbuf, iSize );

	// update Train data
	m_iPos = READ_BYTE();

	if( m_iPos )
		m_iFlags |= HUD_ACTIVE;
	else
		m_iFlags &= ~HUD_ACTIVE;

	END_READ();

	return 1;
}
Example #22
0
int CHudBattery:: MsgFunc_Battery(const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, pbuf, iSize );

	m_iFlags |= HUD_ACTIVE;
	int x = READ_SHORT();

	if( x != m_iBat )
	{
		m_fFade = FADE_TIME;
		m_iBat = x;
	}

	END_READ();

	return 1;
}
Example #23
0
int CHud :: MsgFunc_RainData( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	Rain.dripsPerSecond = READ_SHORT();
	Rain.distFromPlayer = READ_COORD();
	Rain.windX = READ_COORD();
	Rain.windY = READ_COORD();
	Rain.randX = READ_COORD();
	Rain.randY = READ_COORD();
	Rain.weatherMode = READ_SHORT();
	Rain.globalHeight= READ_COORD();	// FIXME: calc on client side ?

	END_READ();	

	return 1;
}
Example #24
0
int CHud::MsgFunc_ScreenShake( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	ShakeCommand_t eCommand = (ShakeCommand_t)READ_SHORT();
	float amplitude = (float)(unsigned short)READ_SHORT() * (1.0f / (float)(1<<12));
	float duration = (float)(unsigned short)READ_SHORT() * (1.0f / (float)(1<<12));
	float frequency = (float)(unsigned short)READ_SHORT() * (1.0f / (float)(1<<8));

	if( eCommand == SHAKE_STOP )
	{
		m_Shake.amplitude = 0;
		m_Shake.frequency = 0;
		m_Shake.duration = 0;
	}
	else
	{
		if(( eCommand == SHAKE_START) || ( eCommand == SHAKE_FREQUENCY )) 
		{
			m_Shake.frequency = frequency;
		}

		if(( eCommand == SHAKE_START) || ( eCommand == SHAKE_AMPLITUDE ))
		{
			// don't overwrite larger existing shake unless we are told to.
			if(( amplitude > m_Shake.amplitude ) || ( eCommand == SHAKE_AMPLITUDE ))
			{
				m_Shake.amplitude = amplitude;
			}
		}

		// only reset the timer for a new shake.
		if( eCommand == SHAKE_START )
		{
			m_Shake.duration = duration;
			m_Shake.nextShake = 0;
			m_Shake.time = m_flTime + duration;
		}
	}

	END_READ();

	return 1;
}
Example #25
0
int CHudHealth:: MsgFunc_Health( const char *pszName,  int iSize, void *pbuf )
{
	// TODO: update local health data
	BEGIN_READ( pszName, pbuf, iSize );

	int x = READ_BYTE();
	m_iFlags |= HUD_ACTIVE;

	// Only update the fade if we've changed health
	if( x != m_iHealth )
	{
		m_fFade = FADE_TIME;
		m_iHealth = x;
	}

	END_READ();

	return 1;
}
Example #26
0
int CHudAmmo::MsgFunc_HideWeapon( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, pbuf, iSize );
	
	gHUD.m_iHideHUDDisplay = READ_BYTE();

	if(( m_pWeapon == NULL ) || ( gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )))
	{
		gpActiveSel = NULL;
		SetCrosshair( 0, nullRc, 0, 0, 0 );
	}
	else
	{
		SetCrosshair( m_pWeapon->hCrosshair, m_pWeapon->rcCrosshair, 255, 255, 255 );
	}

	END_READ();

	return 1;
}
Example #27
0
int CHud :: MsgFunc_CamData( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	gHUD.viewEntityIndex = READ_SHORT();
	gHUD.viewFlags = READ_SHORT();

	if( gHUD.viewFlags )
		m_iCameraMode = 1;
	else m_iCameraMode = m_iLastCameraMode;

	// update pparams->viewentity too for right hearing
	if( gHUD.viewEntityIndex )
		gpViewParams->viewentity = gHUD.viewEntityIndex;
	else gpViewParams->viewentity = GetLocalPlayer()->serialnumber;

	END_READ();
	
	return 1;
}
Example #28
0
int CHud :: MsgFunc_ScreenFade( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );	

	float fadeTime = (float)(unsigned short)READ_SHORT() * (1.0f / (float)(1<<12));
	float holdTime = (float)(unsigned short)READ_SHORT() * (1.0f / (float)(1<<12));
	int fadeFlags = READ_SHORT();

	Vector m_FadeColor;
	
	m_FadeColor.x = READ_BYTE();	// fade red
	m_FadeColor.y = READ_BYTE();	// fade green
	m_FadeColor.z = READ_BYTE();	// fade blue

	float alpha = READ_BYTE();	// fade alpha

	SetScreenFade( m_FadeColor, alpha, fadeTime, holdTime, fadeFlags );

	END_READ();

	return 1;
}
Example #29
0
// Message handler for StatusIcon message
// accepts five values:
//  byte   : TRUE = ENABLE icon, FALSE = DISABLE icon
//  string : the sprite name to display
//  byte   : red
//  byte   : green
//  byte   : blue
int CHudStatusIcons::MsgFunc_StatusIcon( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, iSize, pbuf );

	int ShouldEnable = READ_BYTE();
	char *pszIconName = READ_STRING();
	if ( ShouldEnable )
	{
		int r = READ_BYTE();
		int g = READ_BYTE();
		int b = READ_BYTE();
		EnableIcon( pszIconName, r, g, b );
		m_iFlags |= HUD_ACTIVE;
	}
	else
	{
		DisableIcon( pszIconName );
	}
	END_READ();

	return 1;
}
Example #30
0
// Message handler for StatusText message
// accepts two values:
// byte: line number of status bar text 
// string: status bar text
// this string describes how the status bar should be drawn
// a semi-regular expression:
// ( slotnum ([a..z] [%pX] [%iX])*)*
// where slotnum is an index into the Value table (see below)
// if slotnum is 0, the string is always drawn
// if StatusValue[slotnum] != 0, the following string is drawn, upto the next newline - otherwise the text is skipped upto next newline
// %pX, where X is an integer, will substitute a player name here, getting the player index from StatusValue[X]
// %iX, where X is an integer, will substitute a number here, getting the number from StatusValue[X]
int CHudStatusBar :: MsgFunc_StatusText( const char *pszName, int iSize, void *pbuf )
{
	BEGIN_READ( pszName, pbuf, iSize );

	int line = READ_BYTE();

	if( line < 0 || line >= MAX_STATUSBAR_LINES )
		return 1;

	Q_strncpy( m_szStatusText[line], READ_STRING(), MAX_STATUSTEXT_LENGTH );
	m_szStatusText[line][MAX_STATUSTEXT_LENGTH-1] = 0;  // ensure it's null terminated ( strncpy() won't null terminate if read string too long)

	if( m_szStatusText[0] == 0 )
		m_iFlags &= ~HUD_ACTIVE;
	else
		m_iFlags |= HUD_ACTIVE;  // we have status text, so turn on the status bar

	m_bReparseString = TRUE;

	END_READ();

	return 1;
}