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.

76 lines
1.5 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.
*
****/
//
// battery.cpp
//
// implementation of CHudBattery class
//
#include "hud.h"
#include "cl_util.h"
#include "parsemsg.h"
#include <string.h>
#include <stdio.h>
9 years ago
DECLARE_MESSAGE( m_Battery, Battery )
9 years ago
9 years ago
int CHudBattery::Init( void )
9 years ago
{
m_iBat = 0;
m_fFade = 0;
m_iFlags = 0;
9 years ago
HOOK_MESSAGE( Battery );
9 years ago
9 years ago
gHUD.AddHudElem( this );
9 years ago
return 1;
}
9 years ago
9 years ago
int CHudBattery::VidInit( void )
9 years ago
{
int HUD_suit_empty = gHUD.GetSpriteIndex( "suit_empty" );
int HUD_suit_full = gHUD.GetSpriteIndex( "suit_full" );
m_hSprite1 = m_hSprite2 = 0; // delaying get sprite handles until we know the sprites are loaded
m_prc1 = &gHUD.GetSpriteRect( HUD_suit_empty );
m_prc2 = &gHUD.GetSpriteRect( HUD_suit_full );
m_iHeight = m_prc2->bottom - m_prc1->top;
m_fFade = 0;
return 1;
}
9 years ago
9 years ago
int CHudBattery::MsgFunc_Battery( const char *pszName, int iSize, void *pbuf )
9 years ago
{
m_iFlags |= HUD_ACTIVE;
BEGIN_READ( pbuf, iSize );
int x = READ_SHORT();
9 years ago
if( x != m_iBat )
9 years ago
{
m_fFade = FADE_TIME;
m_iBat = x;
}
return 1;
}
9 years ago
int CHudBattery::Draw( float flTime )
9 years ago
{
return 1;
}