NS/releases/3.1.3/source/cl_dll/train.cpp
puzl 860617f419 made a copy
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@376 67975925-1194-0748-b3d5-c16f83f1a3a1
2006-01-15 21:48:23 +00:00

83 lines
1.6 KiB
C++

/***
*
* Copyright (c) 1999, 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 "mod/AvHNetworkMessages.h"
DECLARE_MESSAGE(m_Train, Train )
int CHudTrain::Init(void)
{
HOOK_MESSAGE( Train );
m_iPos = 0;
m_iFlags = 0;
//gHUD.AddHudElem(this);
return 1;
};
int CHudTrain::VidInit(void)
{
m_hSprite = 0;
return 1;
};
int CHudTrain::Draw(float fTime)
{
if ( !m_hSprite )
m_hSprite = LoadSprite("sprites/%d_train.spr");
if (m_iPos)
{
int r, g, b, x, y;
gHUD.GetPrimaryHudColor(r, g, b);
SPR_Set(m_hSprite, r, g, b );
// This should show up to the right and part way up the armor number
y = ScreenHeight() - SPR_Height(m_hSprite,0) - gHUD.m_iFontHeight;
x = ScreenWidth()/3 + SPR_Width(m_hSprite,0)/4;
SPR_DrawAdditive( m_iPos - 1, x, y, NULL);
}
return 1;
}
int CHudTrain::MsgFunc_Train(const char *pszName, int iSize, void *pbuf)
{
int state;
NetMsg_Train( pbuf, iSize, state );
if (state)
m_iFlags |= HUD_ACTIVE;
else
m_iFlags &= ~HUD_ACTIVE;
return 1;
}