amxmodx/public/resdk/cstrike/regamedll_const.h
Vincent Herbet 115916d753 Add basic ReHLDS and ReGameDLL support (#417)
* Add ReHLDS API files and its dependencies

Note: This has been stolen from ReAPI AMXX module and modified/adjusted to match AMXX existing includes and to provide as less dependencies as possible as well

* Add the necessary files to get ReHLDS interface

* Split SV_DropClient into pre/post code

* Init ReHLDS API and add SV_DropClient hook

* Add Cvar_DirectSet hook and adjust code with helpers

Note: we don't need to split code here. This is pretty much the naive and straight way, but fairly enough for our case. If it happens we got a lot more hooks, we may consider to use some class to manage better the things.

* Move platform and interface stuff in their own files in public directory

* Make sure to init cvar stuff after ReHLDS

* Add ReGameDLL API files and its dependencies in cstrike module

* Init ReHLDS in cstrike module and adjust code

Note: About cs_uset_set_model(). ReHLDS API doesn't offer a way to know directly the precached models, so instead of looping through all the ressources, the models list is saved one time at map change into a hashmap.

* Init ReGameDLL and adjust code

* Fix linux compilation

* Init ReGameDLL in fakemeta module and adjust code

* Rename /reapi directory to /resdk to avoid confusion

* Retrieve gamerules pointer through InstallGameRules in fakemeta module

* Retrieve gamerules pointer through InstallGameRules in cstrike module

Note: actually gamerules is not used if regamedll is enabled, but it could be used in future natives.

* Fix a typo when ReGameDLL is not enabled

* Fix missing interface check for ReHLDS.

I'm pretty sure I was checking at the very first since I worked first on vanilla version of engine, looks like change has been lost.
2017-03-09 19:59:38 +01:00

740 lines
13 KiB
C

/*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, the author gives permission to
* link the code of this program with the Half-Life Game Engine ("HL
* Engine") and Modified Game Libraries ("MODs") developed by Valve,
* L.L.C ("Valve"). You must obey the GNU General Public License in all
* respects for all of the code used other than the HL Engine and MODs
* from Valve. If you modify this file, you may extend this exception
* to your version of the file, but you are not obligated to do so. If
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#pragma once
// custom enum
enum ArmorType
{
ARMOR_NONE, // no armor
ARMOR_KEVLAR, // body vest only
ARMOR_VESTHELM, // vest and helmet
};
enum ArmouryItemPack
{
ARMOURY_MP5NAVY,
ARMOURY_TMP,
ARMOURY_P90,
ARMOURY_MAC10,
ARMOURY_AK47,
ARMOURY_SG552,
ARMOURY_M4A1,
ARMOURY_AUG,
ARMOURY_SCOUT,
ARMOURY_G3SG1,
ARMOURY_AWP,
ARMOURY_M3,
ARMOURY_XM1014,
ARMOURY_M249,
ARMOURY_FLASHBANG,
ARMOURY_HEGRENADE,
ARMOURY_KEVLAR,
ARMOURY_ASSAULT,
ARMOURY_SMOKEGRENADE,
ARMOURY_GLOCK18,
ARMOURY_USP,
ARMOURY_ELITE,
ARMOURY_FIVESEVEN,
ARMOURY_P228,
ARMOURY_DEAGLE,
ARMOURY_FAMAS,
ARMOURY_SG550,
ARMOURY_GALIL,
ARMOURY_UMP45,
ARMOURY_SHIELD
};
struct AmmoInfo
{
const char *pszName;
int iId;
};
struct MULTIDAMAGE
{
CBaseEntity *pEntity;
float amount;
int type;
};
enum ItemRestType
{
ITEM_TYPE_BUYING, // when a player buying items
ITEM_TYPE_TOUCHED, // when the player touches with a weaponbox or armoury_entity
ITEM_TYPE_EQUIPPED // when a entity game_player_equip gives item to player or default item's on player spawn
};
// constant items
#define ITEM_ID_ANTIDOTE 2
#define ITEM_ID_SECURITY 3
enum ItemID
{
ITEM_NONE = -1,
ITEM_SHIELDGUN,
ITEM_P228,
ITEM_GLOCK,
ITEM_SCOUT,
ITEM_HEGRENADE,
ITEM_XM1014,
ITEM_C4,
ITEM_MAC10,
ITEM_AUG,
ITEM_SMOKEGRENADE,
ITEM_ELITE,
ITEM_FIVESEVEN,
ITEM_UMP45,
ITEM_SG550,
ITEM_GALIL,
ITEM_FAMAS,
ITEM_USP,
ITEM_GLOCK18,
ITEM_AWP,
ITEM_MP5N,
ITEM_M249,
ITEM_M3,
ITEM_M4A1,
ITEM_TMP,
ITEM_G3SG1,
ITEM_FLASHBANG,
ITEM_DEAGLE,
ITEM_SG552,
ITEM_AK47,
ITEM_KNIFE,
ITEM_P90,
ITEM_NVG,
ITEM_DEFUSEKIT,
ITEM_KEVLAR,
ITEM_ASSAULT,
ITEM_LONGJUMP,
ITEM_SODACAN,
ITEM_HEALTHKIT,
ITEM_ANTIDOTE,
ITEM_BATTERY
};
// custom enum
enum RewardType
{
RT_NONE,
RT_ROUND_BONUS,
RT_PLAYER_RESET,
RT_PLAYER_JOIN,
RT_PLAYER_SPEC_JOIN,
RT_PLAYER_BOUGHT_SOMETHING,
RT_HOSTAGE_TOOK,
RT_HOSTAGE_RESCUED,
RT_HOSTAGE_DAMAGED,
RT_HOSTAGE_KILLED,
RT_TEAMMATES_KILLED,
RT_ENEMY_KILLED,
RT_INTO_GAME,
RT_VIP_KILLED,
RT_VIP_RESCUED_MYSELF
};
enum PLAYER_ANIM
{
PLAYER_IDLE,
PLAYER_WALK,
PLAYER_JUMP,
PLAYER_SUPERJUMP,
PLAYER_DIE,
PLAYER_ATTACK1,
PLAYER_ATTACK2,
PLAYER_FLINCH,
PLAYER_LARGE_FLINCH,
PLAYER_RELOAD,
PLAYER_HOLDBOMB
};
enum TeamName
{
UNASSIGNED,
TERRORIST,
CT,
SPECTATOR,
};
enum ModelName
{
MODEL_UNASSIGNED,
MODEL_URBAN,
MODEL_TERROR,
MODEL_LEET,
MODEL_ARCTIC,
MODEL_GSG9,
MODEL_GIGN,
MODEL_SAS,
MODEL_GUERILLA,
MODEL_VIP,
MODEL_MILITIA,
MODEL_SPETSNAZ,
MODEL_AUTO
};
enum JoinState
{
JOINED,
SHOWLTEXT,
READINGLTEXT,
SHOWTEAMSELECT,
PICKINGTEAM,
GETINTOGAME
};
enum TrackCommands
{
CMD_SAY = 0,
CMD_SAYTEAM,
CMD_FULLUPDATE,
CMD_VOTE,
CMD_VOTEMAP,
CMD_LISTMAPS,
CMD_LISTPLAYERS,
CMD_NIGHTVISION,
COMMANDS_TO_TRACK,
};
struct RebuyStruct
{
int m_primaryWeapon;
int m_primaryAmmo;
int m_secondaryWeapon;
int m_secondaryAmmo;
int m_heGrenade;
int m_flashbang;
int m_smokeGrenade;
int m_defuser;
int m_nightVision;
ArmorType m_armor;
};
enum ThrowDirection
{
THROW_NONE,
THROW_FORWARD,
THROW_BACKWARD,
THROW_HITVEL,
THROW_BOMB,
THROW_GRENADE,
THROW_HITVEL_MINUS_AIRVEL
};
enum sbar_data
{
SBAR_ID_TARGETTYPE = 1,
SBAR_ID_TARGETNAME,
SBAR_ID_TARGETHEALTH,
SBAR_END
};
enum
{
WINSTATUS_CTS = 1,
WINSTATUS_TERRORISTS,
WINSTATUS_DRAW,
};
// custom enum
// used for EndRoundMessage() logged messages
enum ScenarioEventEndRound
{
ROUND_NONE,
ROUND_TARGET_BOMB,
ROUND_VIP_ESCAPED,
ROUND_VIP_ASSASSINATED,
ROUND_TERRORISTS_ESCAPED,
ROUND_CTS_PREVENT_ESCAPE,
ROUND_ESCAPING_TERRORISTS_NEUTRALIZED,
ROUND_BOMB_DEFUSED,
ROUND_CTS_WIN,
ROUND_TERRORISTS_WIN,
ROUND_END_DRAW,
ROUND_ALL_HOSTAGES_RESCUED,
ROUND_TARGET_SAVED,
ROUND_HOSTAGE_NOT_RESCUED,
ROUND_TERRORISTS_NOT_ESCAPED,
ROUND_VIP_NOT_ESCAPED,
ROUND_GAME_COMMENCE,
ROUND_GAME_RESTART,
ROUND_GAME_OVER
};
enum RewardRules
{
RR_CTS_WIN,
RR_TERRORISTS_WIN,
RR_TARGET_BOMB,
RR_VIP_ESCAPED,
RR_VIP_ASSASSINATED,
RR_TERRORISTS_ESCAPED,
RR_CTS_PREVENT_ESCAPE,
RR_ESCAPING_TERRORISTS_NEUTRALIZED,
RR_BOMB_DEFUSED,
RR_BOMB_PLANTED,
RR_BOMB_EXPLODED,
RR_ALL_HOSTAGES_RESCUED,
RR_TARGET_BOMB_SAVED,
RR_HOSTAGE_NOT_RESCUED,
RR_VIP_NOT_ESCAPED,
RR_LOSER_BONUS_DEFAULT,
RR_LOSER_BONUS_MIN,
RR_LOSER_BONUS_MAX,
RR_LOSER_BONUS_ADD,
RR_RESCUED_HOSTAGE,
RR_TOOK_HOSTAGE_ACC,
RR_TOOK_HOSTAGE,
RR_END
};
// custom enum
enum RewardAccount
{
REWARD_TARGET_BOMB = 3500,
REWARD_VIP_ESCAPED = 3500,
REWARD_VIP_ASSASSINATED = 3250,
REWARD_TERRORISTS_ESCAPED = 3150,
REWARD_CTS_PREVENT_ESCAPE = 3500,
REWARD_ESCAPING_TERRORISTS_NEUTRALIZED = 3250,
REWARD_BOMB_DEFUSED = 3250,
REWARD_BOMB_PLANTED = 800,
REWARD_BOMB_EXPLODED = 3250,
REWARD_CTS_WIN = 3000,
REWARD_TERRORISTS_WIN = 3000,
REWARD_ALL_HOSTAGES_RESCUED = 2500,
// the end round was by the expiration time
REWARD_TARGET_BOMB_SAVED = 3250,
REWARD_HOSTAGE_NOT_RESCUED = 3250,
REWARD_VIP_NOT_ESCAPED = 3250,
// loser bonus
REWARD_LOSER_BONUS_DEFAULT = 1400,
REWARD_LOSER_BONUS_MIN = 1500,
REWARD_LOSER_BONUS_MAX = 3000,
REWARD_LOSER_BONUS_ADD = 500,
REWARD_RESCUED_HOSTAGE = 750,
REWARD_KILLED_ENEMY = 300,
REWARD_KILLED_VIP = 2500,
REWARD_VIP_HAVE_SELF_RESCUED = 2500,
REWARD_TAKEN_HOSTAGE = 1000,
REWARD_TOOK_HOSTAGE_ACC = 100,
REWARD_TOOK_HOSTAGE = 150,
};
// custom enum
enum PaybackForBadThing
{
PAYBACK_FOR_KILLED_TEAMMATES = -3300,
};
// custom enum
enum InfoMapBuyParam
{
BUYING_EVERYONE = 0,
BUYING_ONLY_CTS,
BUYING_ONLY_TERRORISTS,
BUYING_NO_ONE,
};
// weapon respawning return codes
enum
{
GR_NONE = 0,
GR_WEAPON_RESPAWN_YES,
GR_WEAPON_RESPAWN_NO,
GR_AMMO_RESPAWN_YES,
GR_AMMO_RESPAWN_NO,
GR_ITEM_RESPAWN_YES,
GR_ITEM_RESPAWN_NO,
GR_PLR_DROP_GUN_ALL,
GR_PLR_DROP_GUN_ACTIVE,
GR_PLR_DROP_GUN_NO,
GR_PLR_DROP_AMMO_ALL,
GR_PLR_DROP_AMMO_ACTIVE,
GR_PLR_DROP_AMMO_NO,
};
// custom enum
enum
{
SCENARIO_BLOCK_TIME_EXPRIRED = (1 << 0), // flag "a"
SCENARIO_BLOCK_NEED_PLAYERS = (1 << 1), // flag "b"
SCENARIO_BLOCK_VIP_ESCAPE = (1 << 2), // flag "c"
SCENARIO_BLOCK_PRISON_ESCAPE = (1 << 3), // flag "d"
SCENARIO_BLOCK_BOMB = (1 << 4), // flag "e"
SCENARIO_BLOCK_TEAM_EXTERMINATION = (1 << 5), // flag "f"
SCENARIO_BLOCK_HOSTAGE_RESCUE = (1 << 6), // flag "g"
};
// Player relationship return codes
enum
{
GR_NOTTEAMMATE = 0,
GR_TEAMMATE,
GR_ENEMY,
GR_ALLY,
GR_NEUTRAL,
};
enum WeaponIdType
{
WEAPON_NONE,
WEAPON_P228,
WEAPON_GLOCK,
WEAPON_SCOUT,
WEAPON_HEGRENADE,
WEAPON_XM1014,
WEAPON_C4,
WEAPON_MAC10,
WEAPON_AUG,
WEAPON_SMOKEGRENADE,
WEAPON_ELITE,
WEAPON_FIVESEVEN,
WEAPON_UMP45,
WEAPON_SG550,
WEAPON_GALIL,
WEAPON_FAMAS,
WEAPON_USP,
WEAPON_GLOCK18,
WEAPON_AWP,
WEAPON_MP5N,
WEAPON_M249,
WEAPON_M3,
WEAPON_M4A1,
WEAPON_TMP,
WEAPON_G3SG1,
WEAPON_FLASHBANG,
WEAPON_DEAGLE,
WEAPON_SG552,
WEAPON_AK47,
WEAPON_KNIFE,
WEAPON_P90,
WEAPON_SHIELDGUN = 99
};
enum AutoBuyClassType
{
AUTOBUYCLASS_NONE = 0,
AUTOBUYCLASS_PRIMARY = (1 << 0),
AUTOBUYCLASS_SECONDARY = (1 << 1),
AUTOBUYCLASS_AMMO = (1 << 2),
AUTOBUYCLASS_ARMOR = (1 << 3),
AUTOBUYCLASS_DEFUSER = (1 << 4),
AUTOBUYCLASS_PISTOL = (1 << 5),
AUTOBUYCLASS_SMG = (1 << 6),
AUTOBUYCLASS_RIFLE = (1 << 7),
AUTOBUYCLASS_SNIPERRIFLE = (1 << 8),
AUTOBUYCLASS_SHOTGUN = (1 << 9),
AUTOBUYCLASS_MACHINEGUN = (1 << 10),
AUTOBUYCLASS_GRENADE = (1 << 11),
AUTOBUYCLASS_NIGHTVISION = (1 << 12),
AUTOBUYCLASS_SHIELD = (1 << 13),
};
enum AmmoCostType
{
AMMO_338MAG_PRICE = 125,
AMMO_357SIG_PRICE = 50,
AMMO_45ACP_PRICE = 25,
AMMO_50AE_PRICE = 40,
AMMO_556MM_PRICE = 60,
AMMO_57MM_PRICE = 50,
AMMO_762MM_PRICE = 80,
AMMO_9MM_PRICE = 20,
AMMO_BUCKSHOT_PRICE = 65,
};
// custom enum
// the default amount of ammo that comes with each gun when it spawns
enum ClipGiveDefault
{
P228_DEFAULT_GIVE = 13,
GLOCK18_DEFAULT_GIVE = 20,
SCOUT_DEFAULT_GIVE = 10,
HEGRENADE_DEFAULT_GIVE = 1,
XM1014_DEFAULT_GIVE = 7,
C4_DEFAULT_GIVE = 1,
MAC10_DEFAULT_GIVE = 30,
AUG_DEFAULT_GIVE = 30,
SMOKEGRENADE_DEFAULT_GIVE = 1,
ELITE_DEFAULT_GIVE = 30,
FIVESEVEN_DEFAULT_GIVE = 20,
UMP45_DEFAULT_GIVE = 25,
SG550_DEFAULT_GIVE = 30,
GALIL_DEFAULT_GIVE = 35,
FAMAS_DEFAULT_GIVE = 25,
USP_DEFAULT_GIVE = 12,
AWP_DEFAULT_GIVE = 10,
MP5NAVY_DEFAULT_GIVE = 30,
M249_DEFAULT_GIVE = 100,
M3_DEFAULT_GIVE = 8,
M4A1_DEFAULT_GIVE = 30,
TMP_DEFAULT_GIVE = 30,
G3SG1_DEFAULT_GIVE = 20,
FLASHBANG_DEFAULT_GIVE = 1,
DEAGLE_DEFAULT_GIVE = 7,
SG552_DEFAULT_GIVE = 30,
AK47_DEFAULT_GIVE = 30,
/*KNIFE_DEFAULT_GIVE = 1,*/
P90_DEFAULT_GIVE = 50,
};
enum ClipSizeType
{
P228_MAX_CLIP = 13,
GLOCK18_MAX_CLIP = 20,
SCOUT_MAX_CLIP = 10,
XM1014_MAX_CLIP = 7,
MAC10_MAX_CLIP = 30,
AUG_MAX_CLIP = 30,
ELITE_MAX_CLIP = 30,
FIVESEVEN_MAX_CLIP = 20,
UMP45_MAX_CLIP = 25,
SG550_MAX_CLIP = 30,
GALIL_MAX_CLIP = 35,
FAMAS_MAX_CLIP = 25,
USP_MAX_CLIP = 12,
AWP_MAX_CLIP = 10,
MP5N_MAX_CLIP = 30,
M249_MAX_CLIP = 100,
M3_MAX_CLIP = 8,
M4A1_MAX_CLIP = 30,
TMP_MAX_CLIP = 30,
G3SG1_MAX_CLIP = 20,
DEAGLE_MAX_CLIP = 7,
SG552_MAX_CLIP = 30,
AK47_MAX_CLIP = 30,
P90_MAX_CLIP = 50,
};
enum WeightWeapon
{
P228_WEIGHT = 5,
GLOCK18_WEIGHT = 5,
SCOUT_WEIGHT = 30,
HEGRENADE_WEIGHT = 2,
XM1014_WEIGHT = 20,
C4_WEIGHT = 3,
MAC10_WEIGHT = 25,
AUG_WEIGHT = 25,
SMOKEGRENADE_WEIGHT = 1,
ELITE_WEIGHT = 5,
FIVESEVEN_WEIGHT = 5,
UMP45_WEIGHT = 25,
SG550_WEIGHT = 20,
GALIL_WEIGHT = 25,
FAMAS_WEIGHT = 75,
USP_WEIGHT = 5,
AWP_WEIGHT = 30,
MP5NAVY_WEIGHT = 25,
M249_WEIGHT = 25,
M3_WEIGHT = 20,
M4A1_WEIGHT = 25,
TMP_WEIGHT = 25,
G3SG1_WEIGHT = 20,
FLASHBANG_WEIGHT = 1,
DEAGLE_WEIGHT = 7,
SG552_WEIGHT = 25,
AK47_WEIGHT = 25,
P90_WEIGHT = 26,
KNIFE_WEIGHT = 0,
};
enum MaxAmmoType
{
MAX_AMMO_BUCKSHOT = 32,
MAX_AMMO_9MM = 120,
MAX_AMMO_556NATO = 90,
MAX_AMMO_556NATOBOX = 200,
MAX_AMMO_762NATO = 90,
MAX_AMMO_45ACP = 100,
MAX_AMMO_50AE = 35,
MAX_AMMO_338MAGNUM = 30,
MAX_AMMO_57MM = 100,
MAX_AMMO_357SIG = 52,
// custom
MAX_AMMO_SMOKEGRENADE = 1,
MAX_AMMO_HEGRENADE = 1,
MAX_AMMO_FLASHBANG = 2,
};
enum AmmoType
{
AMMO_NONE,
AMMO_338MAGNUM,
AMMO_762NATO,
AMMO_556NATOBOX,
AMMO_556NATO,
AMMO_BUCKSHOT,
AMMO_45ACP,
AMMO_57MM,
AMMO_50AE,
AMMO_357SIG,
AMMO_9MM,
AMMO_FLASHBANG,
AMMO_HEGRENADE,
AMMO_SMOKEGRENADE,
AMMO_C4,
AMMO_MAX_TYPES
};
enum WeaponClassType
{
WEAPONCLASS_NONE,
WEAPONCLASS_KNIFE,
WEAPONCLASS_PISTOL,
WEAPONCLASS_GRENADE,
WEAPONCLASS_SUBMACHINEGUN,
WEAPONCLASS_SHOTGUN,
WEAPONCLASS_MACHINEGUN,
WEAPONCLASS_RIFLE,
WEAPONCLASS_SNIPERRIFLE,
WEAPONCLASS_MAX,
};
enum AmmoBuyAmount
{
AMMO_338MAG_BUY = 10,
AMMO_357SIG_BUY = 13,
AMMO_45ACP_BUY = 12,
AMMO_50AE_BUY = 7,
AMMO_556NATO_BUY = 30,
AMMO_556NATOBOX_BUY = 30,
AMMO_57MM_BUY = 50,
AMMO_762NATO_BUY = 30,
AMMO_9MM_BUY = 30,
AMMO_BUCKSHOT_BUY = 8,
};
enum shieldgun_e
{
SHIELDGUN_IDLE,
SHIELDGUN_SHOOT1,
SHIELDGUN_SHOOT2,
SHIELDGUN_SHOOT_EMPTY,
SHIELDGUN_RELOAD,
SHIELDGUN_DRAW,
SHIELDGUN_DRAWN_IDLE,
SHIELDGUN_UP,
SHIELDGUN_DOWN,
};
// custom
enum shieldgren_e
{
SHIELDREN_IDLE = 4,
SHIELDREN_UP,
SHIELDREN_DOWN
};
enum InventorySlotType
{
NONE_SLOT,
PRIMARY_WEAPON_SLOT,
PISTOL_SLOT,
KNIFE_SLOT,
GRENADE_SLOT,
C4_SLOT,
};
enum Bullet
{
BULLET_NONE,
BULLET_PLAYER_9MM,
BULLET_PLAYER_MP5,
BULLET_PLAYER_357,
BULLET_PLAYER_BUCKSHOT,
BULLET_PLAYER_CROWBAR,
BULLET_MONSTER_9MM,
BULLET_MONSTER_MP5,
BULLET_MONSTER_12MM,
BULLET_PLAYER_45ACP,
BULLET_PLAYER_338MAG,
BULLET_PLAYER_762MM,
BULLET_PLAYER_556MM,
BULLET_PLAYER_50AE,
BULLET_PLAYER_57MM,
BULLET_PLAYER_357SIG,
};
struct WeaponStruct
{
int m_type;
int m_price;
int m_side;
int m_slot;
int m_ammoPrice;
};
struct AutoBuyInfoStruct
{
AutoBuyClassType m_class;
char *m_command;
char *m_classname;
};
struct WeaponAliasInfo
{
char *alias;
WeaponIdType id;
};
struct WeaponBuyAliasInfo
{
char *alias;
WeaponIdType id;
char *failName;
};
struct WeaponClassAliasInfo
{
char *alias;
WeaponClassType id;
};
struct WeaponSlotInfo
{
WeaponIdType id;
InventorySlotType slot;
const char *weaponName;
};
enum hash_types_e { CLASSNAME };