ns/main/source/cl_dll/ammohistory.h
XP-Cagey b918c731aa Bugfixes for mantis #1008, #1009
Rewrote WeaponsResource code so that uninitialized slots are no longer returned as valid weapons
Removed upp_* from command constants and console commands
Removed commented out entry from hl_baseentity.cpp
Shift in map data position is now performed by the network layer instead of at the time of creation
Deleted obsolete Util.vcproj
Replaced calls to fmax with calls to max in AvHEntities.cpp (Win32 compiler wasn't finding fmax command without explicit include)
Began implementation of client-to-server tunnel for Nexus


git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@94 67975925-1194-0748-b3d5-c16f83f1a3a1
2005-05-05 15:20:23 +00:00

127 lines
3.2 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.
*
* Modified by Charles G. Cleveland
*
* $Workfile: ammohistory.h $
* $Date: 2002/06/25 17:05:31 $
*
*-------------------------------------------------------------------------------
* $Log: ammohistory.h,v $
* Revision 1.3 2002/06/25 17:05:31 Flayra
* - Weapon enabling/disabling works differently now
*
*===============================================================================
****/
//
// ammohistory.h
//
// this is the max number of items in each bucket
#define MAX_WEAPON_POSITIONS 10
class WeaponsResource
{
public:
WeaponsResource( void );
~WeaponsResource( void );
void Init( void );
void Reset( void );
void LoadWeaponSprites( WEAPON* wp );
void LoadAllWeaponSprites( void );
WEAPON* GetWeapon( int iId );
WEAPON* GetWeaponSlot( int slot, int pos );
WEAPON* GetFirstPos( int iSlot );
WEAPON* GetNextActivePos( int iSlot, int iSlotPos );
bool IsEnabled( WEAPON *p );
bool IsSelectable( WEAPON *p );
bool HasAmmo( WEAPON *p );
int CountAmmo( int iId );
int GetAmmo( int iId );
void SetAmmo( int iId, int iCount );
HSPRITE* GetAmmoPicFromWeapon( int iAmmoId, wrect_t& rect ); //TODO: fix bass-ackwards arrangement and store sprites with ammo types
void AddWeapon( WEAPON* wp );
void PickupWeapon( WEAPON* wp );
void DropWeapon( WEAPON* wp );
void DropAllWeapons( void );
//CONSIDER: Should the selection functions be in the menu with the selection variables?
void UserCmd_LastInv( void );
void SetValidWeapon( void );
void SetCurrentWeapon( WEAPON* wp );
void SelectSlot( int iSlot, int fAdvance, int iDirection );
friend CHudAmmo; //for iOldWeaponBits access
private:
WEAPON rgWeapons[MAX_WEAPONS]; // current weapon state
WEAPON* rgSlots[MAX_WEAPON_SLOTS][MAX_WEAPON_POSITIONS]; // current weapon slot map
WEAPON* lastWeapon; // client-side lastinv
int riAmmo[MAX_AMMO_TYPES]; // current ammo counts
int iOldWeaponBits;
};
extern WeaponsResource gWR;
#define MAX_HISTORY 12
enum {
HISTSLOT_EMPTY,
HISTSLOT_AMMO,
HISTSLOT_WEAP,
HISTSLOT_ITEM,
};
class HistoryResource
{
private:
struct HIST_ITEM {
int type;
float DisplayTime; // the time at which this item should be removed from the history
int iCount;
int iId;
};
HIST_ITEM rgAmmoHistory[MAX_HISTORY];
public:
void Init( void )
{
Reset();
}
void Reset( void )
{
memset( rgAmmoHistory, 0, sizeof rgAmmoHistory );
}
int iHistoryGap;
int iCurrentHistorySlot;
void AddToHistory( int iType, int iId, int iCount = 0 );
void AddToHistory( int iType, const char *szName, int iCount = 0 );
void CheckClearHistory( void );
int DrawAmmoHistory( float flTime );
};
extern HistoryResource gHR;