mirror of
https://github.com/unknownworlds/NS.git
synced 2024-12-22 18:31:11 +00:00
84 lines
1.6 KiB
C++
84 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;
|
||
|
}
|