Files
source-sdk-2013/sp/src/game/shared/weapon_parse.h
Blixibon eb014cce6c Mapbase v6.0
- Fixed path_track paths saving as pointers instead of handles
- Fixed player animations not falling to base class correctly
- Fixed logic_externaldata creating garbage in trailing spaces
- Added "SetHandModelSkin" input
- Added unique colors for various types of console message, adjustable via convars
- Added the ability to use map-specific weapon scripts
- Added a way to display (placeholder) text entirely from Faceposer scenes
- Added "autobreak" keyvalue to game_text, which automatically breaks long text into different lines
- Added the ability to change a game_text's font (very limited)
- Added LightToggle input to point_spotlight
- Added Enable/DisableSprites on npc_manhack
- Added ai_goal_police behavior from metrocops to Combine soldiers and citizens
- Added func_precipitation particle rain systems from the Alien Swarm SDK
- Added new func_precipitation spawnflags for controlling behavior in particle types
- Added "mapbase_version" cvar which shows the version of Mapbase a mod might be running on
- Fixed an oversight with NPC crouch activities which was causing npc_metropolice to stop firing in standoffs
- Added toggleable patches to npc_combine AI which make soldiers less likely to stand around without shooting or rush to melee when not needed
- Added key for custom logo font on env_credits scripts
- Added SetSpeed and SetPushDir inputs for trigger_push
- Added a bunch of I/O/KV to func_fish_pool to allow for more control over the fish
- Added OnLostEnemy/Player support for npc_combine_camera
- Added enhanced save/restore for the Response System, toggleable via convar
- Added a convar which allows users to disable weapon autoswitching when picking up ammo
- Split VScript base script into its own file
- Added VScript descriptions for NPC squads and the manager class which handles them
- Moved several classes, functions, etc. to the VScript library itself for future usage in other projects, like VBSP
- Added VScript to VBSP with basic map file interfacing
- Made some VScript documentation more clear due to deprecation of online documentation
- Added VScript "hook" registration, creating a standardized system which shows up in script_help documentation
- Added VScript-driven custom weapons
- Added clientside VScript scopes
- Added a bunch of weapon-related VScript functions
- Split a bunch of cluttered VScript stuff into different files
- Added VScript functions for "following" entities/bonemerging
- Added VScript functions for grenades
- Added a few more VScript trigger functions
- Added OnDeath hook for VScript
- Fixed documentation for aliased functions in VScript
- Fixed $bumpmask not working on SDK_LightmappedGeneric
- Made vertex blend swapping in Hammer use a constant instead of a combo (makes it easier to compile the shader, especially for $bumpmask's sake)
- Fixed brush phong, etc. causing SDK_WorldVertexTransition to stop working
- Added limited support for $envmapmask in the bumpmapping shader
- Fixed more issues with parallax corrected cubemaps and instances
- Made instance variable recursion consistent with VMFII
2020-11-26 02:26:55 +00:00

172 lines
6.0 KiB
C++

//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Weapon data file parsing, shared by game & client dlls.
//
// $NoKeywords: $
//=============================================================================//
#ifndef WEAPON_PARSE_H
#define WEAPON_PARSE_H
#ifdef _WIN32
#pragma once
#endif
#include "shareddefs.h"
class IFileSystem;
typedef unsigned short WEAPON_FILE_INFO_HANDLE;
// -----------------------------------------------------------
// Weapon sound types
// Used to play sounds defined in the weapon's classname.txt file
// This needs to match pWeaponSoundCategories in weapon_parse.cpp
// ------------------------------------------------------------
typedef enum {
EMPTY,
SINGLE,
SINGLE_NPC,
WPN_DOUBLE, // Can't be "DOUBLE" because windows.h uses it.
DOUBLE_NPC,
BURST,
RELOAD,
RELOAD_NPC,
MELEE_MISS,
MELEE_HIT,
MELEE_HIT_WORLD,
SPECIAL1,
SPECIAL2,
SPECIAL3,
TAUNT,
DEPLOY,
// Add new shoot sound types here
NUM_SHOOT_SOUND_TYPES,
} WeaponSound_t;
int GetWeaponSoundFromString( const char *pszString );
#define MAX_SHOOT_SOUNDS 16 // Maximum number of shoot sounds per shoot type
#define MAX_WEAPON_STRING 80
#define MAX_WEAPON_PREFIX 16
#define MAX_WEAPON_AMMO_NAME 32
#define WEAPON_PRINTNAME_MISSING "!!! Missing printname on weapon"
class CHudTexture;
class KeyValues;
//-----------------------------------------------------------------------------
// Purpose: Contains the data read from the weapon's script file.
// It's cached so we only read each weapon's script file once.
// Each game provides a CreateWeaponInfo function so it can have game-specific
// data (like CS move speeds) in the weapon script.
//-----------------------------------------------------------------------------
class FileWeaponInfo_t
{
public:
FileWeaponInfo_t();
// Each game can override this to get whatever values it wants from the script.
virtual void Parse( KeyValues *pKeyValuesData, const char *szWeaponName );
public:
bool bParsedScript;
bool bLoadedHudElements;
#ifdef MAPBASE
// Indicates the currently loaded data is from a map-specific script and should be flushed.
bool bCustom;
#endif
// SHARED
char szClassName[MAX_WEAPON_STRING];
char szPrintName[MAX_WEAPON_STRING]; // Name for showing in HUD, etc.
char szViewModel[MAX_WEAPON_STRING]; // View model of this weapon
char szWorldModel[MAX_WEAPON_STRING]; // Model of this weapon seen carried by the player
char szAnimationPrefix[MAX_WEAPON_PREFIX]; // Prefix of the animations that should be used by the player carrying this weapon
int iSlot; // inventory slot.
int iPosition; // position in the inventory slot.
int iMaxClip1; // max primary clip size (-1 if no clip)
int iMaxClip2; // max secondary clip size (-1 if no clip)
int iDefaultClip1; // amount of primary ammo in the gun when it's created
int iDefaultClip2; // amount of secondary ammo in the gun when it's created
int iWeight; // this value used to determine this weapon's importance in autoselection.
int iRumbleEffect; // Which rumble effect to use when fired? (xbox)
bool bAutoSwitchTo; // whether this weapon should be considered for autoswitching to
bool bAutoSwitchFrom; // whether this weapon can be autoswitched away from when picking up another weapon or ammo
int iFlags; // miscellaneous weapon flags
char szAmmo1[MAX_WEAPON_AMMO_NAME]; // "primary" ammo type
char szAmmo2[MAX_WEAPON_AMMO_NAME]; // "secondary" ammo type
// Sound blocks
char aShootSounds[NUM_SHOOT_SOUND_TYPES][MAX_WEAPON_STRING];
int iAmmoType;
int iAmmo2Type;
bool m_bMeleeWeapon; // Melee weapons can always "fire" regardless of ammo.
// This tells if the weapon was built right-handed (defaults to true).
// This helps cl_righthand make the decision about whether to flip the model or not.
bool m_bBuiltRightHanded;
bool m_bAllowFlipping; // False to disallow flipping the model, regardless of whether
// it is built left or right handed.
// CLIENT DLL
// Sprite data, read from the data file
int iSpriteCount;
CHudTexture *iconActive;
CHudTexture *iconInactive;
CHudTexture *iconAmmo;
CHudTexture *iconAmmo2;
CHudTexture *iconCrosshair;
CHudTexture *iconAutoaim;
CHudTexture *iconZoomedCrosshair;
CHudTexture *iconZoomedAutoaim;
CHudTexture *iconSmall;
// TF2 specific
bool bShowUsageHint; // if true, then when you receive the weapon, show a hint about it
// SERVER DLL
};
// The weapon parse function
bool ReadWeaponDataFromFileForSlot( IFileSystem* filesystem, const char *szWeaponName,
WEAPON_FILE_INFO_HANDLE *phandle, const unsigned char *pICEKey = NULL );
#ifdef MAPBASE
// For map-specific weapon data
bool ReadCustomWeaponDataFromFileForSlot( IFileSystem* filesystem, const char *szWeaponName,
WEAPON_FILE_INFO_HANDLE *phandle, const unsigned char *pICEKey = NULL );
#endif
// If weapon info has been loaded for the specified class name, this returns it.
WEAPON_FILE_INFO_HANDLE LookupWeaponInfoSlot( const char *name );
FileWeaponInfo_t *GetFileWeaponInfoFromHandle( WEAPON_FILE_INFO_HANDLE handle );
WEAPON_FILE_INFO_HANDLE GetInvalidWeaponInfoHandle( void );
void PrecacheFileWeaponInfoDatabase( IFileSystem *filesystem, const unsigned char *pICEKey );
//
// Read a possibly-encrypted KeyValues file in.
// If pICEKey is NULL, then it appends .txt to the filename and loads it as an unencrypted file.
// If pICEKey is non-NULL, then it appends .ctx to the filename and loads it as an encrypted file.
//
// (This should be moved into a more appropriate place).
//
KeyValues* ReadEncryptedKVFile( IFileSystem *filesystem, const char *szFilenameWithoutExtension, const unsigned char *pICEKey, bool bForceReadEncryptedFile = false );
// Each game implements this. It can return a derived class and override Parse() if it wants.
extern FileWeaponInfo_t* CreateWeaponInfo();
#endif // WEAPON_PARSE_H