Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
1.7 KiB

9 years ago
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
//
// Train.cpp
//
// implementation of CHudAmmo class
//
#include "hud.h"
#include "cl_util.h"
#include <string.h>
#include <stdio.h>
#include "parsemsg.h"
9 years ago
DECLARE_MESSAGE( m_Train, Train )
9 years ago
9 years ago
int CHudTrain::Init( void )
9 years ago
{
HOOK_MESSAGE( Train );
m_iPos = 0;
m_iFlags = 0;
9 years ago
gHUD.AddHudElem( this );
9 years ago
return 1;
}
9 years ago
9 years ago
int CHudTrain::VidInit( void )
9 years ago
{
m_hSprite = 0;
return 1;
}
9 years ago
9 years ago
int CHudTrain::Draw( float fTime )
9 years ago
{
9 years ago
if( !m_hSprite )
m_hSprite = LoadSprite( "sprites/%d_train.spr" );
9 years ago
9 years ago
if( m_iPos )
9 years ago
{
int r, g, b, x, y;
#ifdef MOBILE_HACKS
UnpackRGB( r, g, b, g_iHudColor );
#else // MOBILE_HACKS
9 years ago
UnpackRGB( r, g, b, RGB_YELLOWISH );
#endif // MOBILE_HACKS
9 years ago
SPR_Set( m_hSprite, r, g, b );
9 years ago
// This should show up to the right and part way up the armor number
9 years ago
y = ScreenHeight - SPR_Height( m_hSprite, 0 ) - gHUD.m_iFontHeight;
x = ScreenWidth / 3 + SPR_Width( m_hSprite, 0 ) / 4;
9 years ago
9 years ago
SPR_DrawAdditive( m_iPos - 1, x, y, NULL );
9 years ago
}
return 1;
}
9 years ago
int CHudTrain::MsgFunc_Train( const char *pszName, int iSize, void *pbuf )
9 years ago
{
BEGIN_READ( pbuf, iSize );
// update Train data
m_iPos = READ_BYTE();
9 years ago
if( m_iPos )
9 years ago
m_iFlags |= HUD_ACTIVE;
else
m_iFlags &= ~HUD_ACTIVE;
return 1;
}