Refactoring

Reworked ammo stuff
This commit is contained in:
s1lentq 2017-10-17 16:38:40 +04:00 committed by s1lent
parent 2218a84cb1
commit 7de20bf316
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
13 changed files with 660 additions and 598 deletions

File diff suppressed because it is too large Load Diff

View File

@ -108,9 +108,9 @@ extern unsigned short m_usResetDecals;
extern unsigned short g_iShadowSprite;
#ifdef REGAMEDLL_API
void HandleMenu_ChooseAppearance_OrigFunc(CBasePlayer *player, int slot);
BOOL HandleMenu_ChooseTeam_OrigFunc(CBasePlayer *player, int slot);
bool BuyGunAmmo_OrigFunc(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney);
void HandleMenu_ChooseAppearance_OrigFunc(CBasePlayer *pPlayer, int slot);
BOOL HandleMenu_ChooseTeam_OrigFunc(CBasePlayer *pPlayer, int slot);
bool BuyGunAmmo_OrigFunc(CBasePlayer *pPlayer, CBasePlayerItem *weapon, bool bBlinkMoney);
CBaseEntity *BuyWeaponByWeaponID_OrigFunc(CBasePlayer *pPlayer, WeaponIdType weaponID);
void ShowMenu_OrigFunc(CBasePlayer *pPlayer, int bitsValidSlots, int nDisplayTime, BOOL fNeedMore, char *pszText);
void ShowVGUIMenu_OrigFunc(CBasePlayer *pPlayer, int MenuType, int BitMask, char *szOldMenu);
@ -122,7 +122,7 @@ void WriteSigonMessages();
int CMD_ARGC_();
const char *CMD_ARGV_(int i);
void set_suicide_frame(entvars_t *pev);
void BlinkAccount(CBasePlayer *player, int numBlinks = 2);
void BlinkAccount(CBasePlayer *pPlayer, int numBlinks = 2);
BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason);
void ClientDisconnect(edict_t *pEntity);
void respawn(entvars_t *pev, BOOL fCopyCorpse = FALSE);
@ -144,13 +144,13 @@ CBaseEntity *BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID);
void BuyRifle(CBasePlayer *pPlayer, int iSlot);
void BuyMachineGun(CBasePlayer *pPlayer, int iSlot);
void BuyItem(CBasePlayer *pPlayer, int iSlot);
void HandleMenu_ChooseAppearance(CBasePlayer *player, int slot);
BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot);
void Radio1(CBasePlayer *player, int slot);
void Radio2(CBasePlayer *player, int slot);
void Radio3(CBasePlayer *player, int slot);
bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney);
bool BuyAmmo(CBasePlayer *player, int nSlot, bool bBlinkMoney);
void HandleMenu_ChooseAppearance(CBasePlayer *pPlayer, int slot);
BOOL HandleMenu_ChooseTeam(CBasePlayer *pPlayer, int slot);
void Radio1(CBasePlayer *pPlayer, int slot);
void Radio2(CBasePlayer *pPlayer, int slot);
void Radio3(CBasePlayer *pPlayer, int slot);
bool BuyGunAmmo(CBasePlayer *pPlayer, CBasePlayerItem *weapon, bool bBlinkMoney);
bool BuyAmmo(CBasePlayer *pPlayer, int nSlot, bool bBlinkMoney);
CBaseEntity *EntityFromUserID(int userID);
int CountPlayersInServer();
BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand);
@ -178,7 +178,7 @@ bool CheckPlayerPVSLeafChanged(edict_t *client, int clientnum);
void MarkEntityInPVS(int clientnum, int entitynum, float time, bool inpvs);
bool CheckEntityRecentlyInPVS(int clientnum, int entitynum, float currenttime);
int AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet);
void CreateBaseline(int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, Vector player_mins, Vector player_maxs);
void CreateBaseline(int player, int eindex, struct entity_state_s *baseline, edict_t *entity, int playermodelindex, Vector player_mins, Vector player_maxs);
void Entity_FieldInit(struct delta_s *pFields);
void Entity_Encode(struct delta_s *pFields, const unsigned char *from, const unsigned char *to);
void Player_FieldInit(struct delta_s *pFields);
@ -186,14 +186,14 @@ void Player_Encode(struct delta_s *pFields, const unsigned char *from, const uns
void Custom_Entity_FieldInit(delta_s *pFields);
void Custom_Encode(struct delta_s *pFields, const unsigned char *from, const unsigned char *to);
void RegisterEncoders();
int GetWeaponData(edict_s *player, struct weapon_data_s *info);
void UpdateClientData(const edict_s *ent, int sendweapons, struct clientdata_s *cd);
void CmdStart(const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed);
void CmdEnd(const edict_t *player);
int GetWeaponData(edict_t *pEdict, struct weapon_data_s *info);
void UpdateClientData(const edict_t *ent, int sendweapons, struct clientdata_s *cd);
void CmdStart(const edict_t *pEdict, const struct usercmd_s *cmd, unsigned int random_seed);
void CmdEnd(const edict_t *pEdict);
int ConnectionlessPacket(const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size);
int GetHullBounds(int hullnumber, float *mins, float *maxs);
void CreateInstancedBaselines();
int InconsistentFile(const edict_t *player, const char *filename, char *disconnect_message);
int InconsistentFile(const edict_t *pEdict, const char *filename, char *disconnect_message);
int AllowLagCompensation();
inline const char *GetTeamName(int team)

View File

@ -1238,7 +1238,7 @@ void packPlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo)
// pack the ammo
if (packAmmo)
{
pWeaponBox->PackAmmo(MAKE_STRING(IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[pItem->m_iId].pszAmmo1), pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()]);
pWeaponBox->PackAmmo(MAKE_STRING(IMPL_CLASS(CBasePlayerItem, m_ItemInfoArray)[pItem->m_iId].pszAmmo1), pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()]);
}
SET_MODEL(ENT(pWeaponBox->pev), modelName);
@ -1301,7 +1301,7 @@ void packPlayerNade(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo)
// pack the ammo
if (packAmmo)
{
pWeaponBox->PackAmmo(MAKE_STRING(IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[pItem->m_iId].pszAmmo1), pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()]);
pWeaponBox->PackAmmo(MAKE_STRING(IMPL_CLASS(CBasePlayerItem, m_ItemInfoArray)[pItem->m_iId].pszAmmo1), pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()]);
}
SET_MODEL(ENT(pWeaponBox->pev), modelName);
@ -6439,10 +6439,10 @@ int CBasePlayer::GetAmmoIndex(const char *psz)
for (int i = 1; i < MAX_AMMO_SLOTS; i++)
{
if (!IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[ i ].pszName)
if (!IMPL_CLASS(CBasePlayerItem, m_AmmoInfoArray)[i].pszName)
continue;
if (!Q_stricmp(psz, IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[ i ].pszName))
if (!Q_stricmp(psz, IMPL_CLASS(CBasePlayerItem, m_AmmoInfoArray)[i].pszName))
return i;
}

View File

@ -5,8 +5,8 @@
*/
#ifndef HOOK_GAMEDLL
ItemInfo CBasePlayerItem::ItemInfoArray[MAX_WEAPONS];
AmmoInfo CBasePlayerItem::AmmoInfoArray[MAX_AMMO_SLOTS];
ItemInfo CBasePlayerItem::m_ItemInfoArray[MAX_WEAPONS];
AmmoInfo CBasePlayerItem::m_AmmoInfoArray[MAX_AMMO_SLOTS];
TYPEDESCRIPTION CBasePlayerItem::m_SaveData[] =
{
@ -67,7 +67,7 @@ int MaxAmmoCarry(const char *szName)
{
for (int i = 0; i < MAX_WEAPONS; i++)
{
ItemInfo *info = &IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[i];
ItemInfo *info = &IMPL_CLASS(CBasePlayerItem, m_ItemInfoArray)[i];
if (info->pszAmmo1 && !Q_stricmp(szName, info->pszAmmo1))
{
return info->iMaxAmmo1;
@ -85,7 +85,7 @@ int MaxAmmoCarry(const char *szName)
int MaxAmmoCarry(WeaponIdType weaponId)
{
return IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[weaponId].iMaxAmmo1;
return IMPL_CLASS(CBasePlayerItem, m_ItemInfoArray)[weaponId].iMaxAmmo1;
}
// ClearMultiDamage - resets the global multi damage accumulator
@ -229,12 +229,12 @@ struct {
void AddAmmoNameToAmmoRegistry(const char *szAmmoname)
{
// make sure it's not already in the registry
for (int i = 0; i < MAX_AMMO_SLOTS; ++i)
for (int i = 0; i < MAX_AMMO_SLOTS; i++)
{
if (!IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[ i ].pszName)
if (!IMPL_CLASS(CBasePlayerItem, m_AmmoInfoArray)[i].pszName)
continue;
if (!Q_stricmp(IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[ i ].pszName, szAmmoname))
if (!Q_stricmp(IMPL_CLASS(CBasePlayerItem, m_AmmoInfoArray)[i].pszName, szAmmoname))
{
// ammo already in registry, just quite
return;
@ -260,10 +260,10 @@ void AddAmmoNameToAmmoRegistry(const char *szAmmoname)
}
#endif
IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[ giAmmoIndex ].pszName = szAmmoname;
IMPL_CLASS(CBasePlayerItem, m_AmmoInfoArray)[giAmmoIndex].pszName = szAmmoname;
// yes, this info is redundant
IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[ giAmmoIndex ].iId = giAmmoIndex;
IMPL_CLASS(CBasePlayerItem, m_AmmoInfoArray)[giAmmoIndex].iId = giAmmoIndex;
}
// Precaches the weapon and queues the weapon info for sending to clients
@ -286,7 +286,7 @@ void UTIL_PrecacheOtherWeapon(const char *szClassname)
pEntity->Precache();
if (((CBasePlayerItem *)pEntity)->GetItemInfo(&II))
{
IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[ II.iId ] = II;
IMPL_CLASS(CBasePlayerItem, m_ItemInfoArray)[ II.iId ] = II;
if (II.pszAmmo1 != NULL && *II.pszAmmo1 != '\0')
{
@ -323,7 +323,7 @@ NOXREF void UTIL_PrecacheOtherWeapon2(const char *szClassname)
pEntity->Precache();
if (((CBasePlayerItem *)pEntity)->GetItemInfo(&II))
{
IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[ II.iId ] = II;
IMPL_CLASS(CBasePlayerItem, m_ItemInfoArray)[ II.iId ] = II;
if (II.pszAmmo1 != NULL && *II.pszAmmo1 != '\0')
{
@ -343,8 +343,8 @@ NOXREF void UTIL_PrecacheOtherWeapon2(const char *szClassname)
// called by worldspawn
void W_Precache()
{
Q_memset(IMPL_CLASS(CBasePlayerItem, ItemInfoArray), 0, sizeof(IMPL_CLASS(CBasePlayerItem, ItemInfoArray)));
Q_memset(IMPL_CLASS(CBasePlayerItem, AmmoInfoArray), 0, sizeof(IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)));
Q_memset(IMPL_CLASS(CBasePlayerItem, m_ItemInfoArray), 0, sizeof(IMPL_CLASS(CBasePlayerItem, m_ItemInfoArray)));
Q_memset(IMPL_CLASS(CBasePlayerItem, m_AmmoInfoArray), 0, sizeof(IMPL_CLASS(CBasePlayerItem, m_AmmoInfoArray)));
giAmmoIndex = 0;

View File

@ -285,20 +285,20 @@ public:
void CheckRespawn();
public:
inline int iItemPosition() const { return IMPL(ItemInfoArray)[ m_iId ].iPosition; }
inline const char *pszAmmo1() const { return IMPL(ItemInfoArray)[ m_iId ].pszAmmo1; }
inline int iMaxAmmo1() const { return IMPL(ItemInfoArray)[ m_iId ].iMaxAmmo1; }
inline const char *pszAmmo2() const { return IMPL(ItemInfoArray)[ m_iId ].pszAmmo2; }
inline int iMaxAmmo2() const { return IMPL(ItemInfoArray)[ m_iId ].iMaxAmmo2; }
inline const char *pszName() const { return IMPL(ItemInfoArray)[ m_iId ].pszName; }
inline int iMaxClip() const { return IMPL(ItemInfoArray)[ m_iId ].iMaxClip; }
inline int iWeight() const { return IMPL(ItemInfoArray)[ m_iId ].iWeight; }
inline int iFlags() const { return IMPL(ItemInfoArray)[ m_iId ].iFlags; }
inline int iItemPosition() const { return IMPL(m_ItemInfoArray)[m_iId].iPosition; }
inline const char *pszAmmo1() const { return IMPL(m_ItemInfoArray)[m_iId].pszAmmo1; }
inline int iMaxAmmo1() const { return IMPL(m_ItemInfoArray)[m_iId].iMaxAmmo1; }
inline const char *pszAmmo2() const { return IMPL(m_ItemInfoArray)[m_iId].pszAmmo2; }
inline int iMaxAmmo2() const { return IMPL(m_ItemInfoArray)[m_iId].iMaxAmmo2; }
inline const char *pszName() const { return IMPL(m_ItemInfoArray)[m_iId].pszName; }
inline int iMaxClip() const { return IMPL(m_ItemInfoArray)[m_iId].iMaxClip; }
inline int iWeight() const { return IMPL(m_ItemInfoArray)[m_iId].iWeight; }
inline int iFlags() const { return IMPL(m_ItemInfoArray)[m_iId].iFlags; }
public:
static TYPEDESCRIPTION IMPL(m_SaveData)[3];
static ItemInfo IMPL(ItemInfoArray)[MAX_WEAPONS];
static AmmoInfo IMPL(AmmoInfoArray)[MAX_AMMO_SLOTS];
static ItemInfo IMPL(m_ItemInfoArray)[MAX_WEAPONS];
static AmmoInfo IMPL(m_AmmoInfoArray)[MAX_AMMO_SLOTS];
CBasePlayer *m_pPlayer;
CBasePlayerItem *m_pNext;

View File

@ -5,7 +5,7 @@
*/
#ifndef HOOK_GAMEDLL
WeaponStruct g_weaponStruct[ MAX_WEAPONS ] =
WeaponStruct g_weaponStruct[MAX_WEAPONS] =
{
{ 0, 0, 0, 0, 0 },
@ -84,7 +84,7 @@ AutoBuyInfoStruct g_autoBuyInfo[] =
{ AUTOBUYCLASS_NONE, nullptr, nullptr },
};
WeaponAliasInfo weaponAliasInfo[] =
WeaponAliasInfo g_weaponAliasInfo[] =
{
{ "p228", WEAPON_P228 },
{ "???", WEAPON_GLOCK },
@ -127,7 +127,7 @@ WeaponAliasInfo weaponAliasInfo[] =
{ nullptr, WEAPON_NONE },
};
WeaponBuyAliasInfo weaponBuyAliasInfo[] =
WeaponBuyAliasInfo g_weaponBuyAliasInfo[] =
{
{ "galil", WEAPON_GALIL, "#Galil" },
{ "defender", WEAPON_GALIL, "#Galil" },
@ -174,7 +174,7 @@ WeaponBuyAliasInfo weaponBuyAliasInfo[] =
{ nullptr, WEAPON_NONE, nullptr },
};
WeaponClassAliasInfo weaponClassAliasInfo[] =
WeaponClassAliasInfo g_weaponClassAliasInfo[] =
{
{ "p228", WEAPONCLASS_PISTOL },
{ "???", WEAPONCLASS_PISTOL },
@ -224,59 +224,78 @@ WeaponClassAliasInfo weaponClassAliasInfo[] =
{ nullptr, WEAPONCLASS_NONE },
};
WeaponInfoStruct weaponInfo[31];
WeaponInfoStruct weaponInfo_default[] =
WeaponInfoStruct g_weaponInfo[31];
WeaponInfoStruct g_weaponInfo_default[] =
{
{ WEAPON_P228, P228_PRICE, AMMO_357SIG_PRICE, AMMO_357SIG_BUY, P228_MAX_CLIP, MAX_AMMO_357SIG, AMMO_357SIG, "weapon_p228", "ammo_357sig", "357SIG" },
{ WEAPON_P228, P228_PRICE, AMMO_357SIG_PRICE, AMMO_357SIG_BUY, P228_MAX_CLIP, MAX_AMMO_357SIG, AMMO_357SIG, "weapon_p228", "ammo_357sig", "357SIG" },
// fix collision with glock18
#ifdef REGAMEDLL_FIXES
{ WEAPON_GLOCK, GLOCK18_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, GLOCK18_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_glock", "ammo_9mm", "9mm" },
{ WEAPON_GLOCK, GLOCK18_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, GLOCK18_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_glock", "ammo_9mm", "9mm" },
#else
{ WEAPON_GLOCK, GLOCK18_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, GLOCK18_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_glock18", "ammo_9mm", "9mm" },
{ WEAPON_GLOCK, GLOCK18_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, GLOCK18_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_glock18", "ammo_9mm", "9mm" },
#endif
{ WEAPON_GLOCK18, GLOCK18_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, GLOCK18_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_glock18", "ammo_9mm", "9mm" },
{ WEAPON_SCOUT, SCOUT_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, SCOUT_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_scout", "ammo_762nato", "762Nato" },
{ WEAPON_XM1014, XM1014_PRICE, AMMO_BUCKSHOT_PRICE, AMMO_BUCKSHOT_BUY, XM1014_MAX_CLIP, MAX_AMMO_BUCKSHOT, AMMO_BUCKSHOT, "weapon_xm1014", "ammo_buckshot", "buckshot" },
{ WEAPON_MAC10, MAC10_PRICE, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, MAC10_MAX_CLIP, MAX_AMMO_45ACP, AMMO_45ACP, "weapon_mac10", "ammo_45acp", "45acp" },
{ WEAPON_AUG, AUG_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, AUG_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_aug", "ammo_556nato", "556Nato" },
{ WEAPON_ELITE, ELITE_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, ELITE_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_elite", "ammo_9mm", "9mm" },
{ WEAPON_FIVESEVEN, FIVESEVEN_PRICE, AMMO_57MM_PRICE, AMMO_57MM_BUY, FIVESEVEN_MAX_CLIP, MAX_AMMO_57MM, AMMO_57MM, "weapon_fiveseven", "ammo_57mm", "57mm" },
{ WEAPON_UMP45, UMP45_PRICE, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, UMP45_MAX_CLIP, MAX_AMMO_45ACP, AMMO_45ACP, "weapon_ump45", "ammo_45acp", "45acp" },
{ WEAPON_SG550, SG550_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, SG550_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_sg550", "ammo_556nato", "556Nato" },
{ WEAPON_GALIL, GALIL_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, GALIL_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_galil", "ammo_556nato", "556Nato" },
{ WEAPON_FAMAS, FAMAS_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, FAMAS_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_famas", "ammo_556nato", "556Nato" },
{ WEAPON_USP, USP_PRICE, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, USP_MAX_CLIP, MAX_AMMO_45ACP, AMMO_45ACP, "weapon_usp", "ammo_45acp", "45acp" },
{ WEAPON_AWP, AWP_PRICE, AMMO_338MAG_PRICE, AMMO_338MAG_BUY, AWP_MAX_CLIP, MAX_AMMO_338MAGNUM, AMMO_338MAGNUM, "weapon_awp", "ammo_338magnum", "338Magnum" },
{ WEAPON_MP5N, MP5NAVY_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, MP5N_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_mp5navy", "ammo_9mm", "9mm" },
{ WEAPON_M249, M249_PRICE, AMMO_556MM_PRICE, AMMO_556NATOBOX_BUY, M249_MAX_CLIP, MAX_AMMO_556NATOBOX, AMMO_556NATOBOX, "weapon_m249", "ammo_556natobox", "556NatoBox" },
{ WEAPON_M3, M3_PRICE, AMMO_BUCKSHOT_PRICE, AMMO_BUCKSHOT_BUY, M3_MAX_CLIP, MAX_AMMO_BUCKSHOT, AMMO_BUCKSHOT, "weapon_m3", "ammo_buckshot", "buckshot" },
{ WEAPON_M4A1, M4A1_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, M4A1_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_m4a1", "ammo_556nato", "556Nato" },
{ WEAPON_TMP, TMP_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, TMP_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_tmp", "ammo_9mm", "9mm" },
{ WEAPON_G3SG1, G3SG1_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, G3SG1_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_g3sg1", "ammo_762nato", "762Nato" },
{ WEAPON_DEAGLE, DEAGLE_PRICE, AMMO_50AE_PRICE, AMMO_50AE_BUY, DEAGLE_MAX_CLIP, MAX_AMMO_50AE, AMMO_50AE, "weapon_deagle", "ammo_50ae", "50AE" },
{ WEAPON_SG552, SG552_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, SG552_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_sg552", "ammo_556nato", "556Nato" },
{ WEAPON_AK47, AK47_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, AK47_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_ak47", "ammo_762nato", "762Nato" },
{ WEAPON_P90, P90_PRICE, AMMO_57MM_PRICE, AMMO_57MM_BUY, P90_MAX_CLIP, MAX_AMMO_57MM, AMMO_57MM, "weapon_p90", "ammo_57mm", "57mm" },
{ WEAPON_GLOCK18, GLOCK18_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, GLOCK18_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_glock18", "ammo_9mm", "9mm" },
{ WEAPON_SCOUT, SCOUT_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, SCOUT_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_scout", "ammo_762nato", "762Nato" },
{ WEAPON_XM1014, XM1014_PRICE, AMMO_BUCKSHOT_PRICE, AMMO_BUCKSHOT_BUY, XM1014_MAX_CLIP, MAX_AMMO_BUCKSHOT, AMMO_BUCKSHOT, "weapon_xm1014", "ammo_buckshot", "buckshot" },
{ WEAPON_MAC10, MAC10_PRICE, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, MAC10_MAX_CLIP, MAX_AMMO_45ACP, AMMO_45ACP, "weapon_mac10", "ammo_45acp", "45acp" },
{ WEAPON_AUG, AUG_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, AUG_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_aug", "ammo_556nato", "556Nato" },
{ WEAPON_ELITE, ELITE_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, ELITE_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_elite", "ammo_9mm", "9mm" },
{ WEAPON_FIVESEVEN, FIVESEVEN_PRICE, AMMO_57MM_PRICE, AMMO_57MM_BUY, FIVESEVEN_MAX_CLIP, MAX_AMMO_57MM, AMMO_57MM, "weapon_fiveseven", "ammo_57mm", "57mm" },
{ WEAPON_UMP45, UMP45_PRICE, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, UMP45_MAX_CLIP, MAX_AMMO_45ACP, AMMO_45ACP, "weapon_ump45", "ammo_45acp", "45acp" },
{ WEAPON_SG550, SG550_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, SG550_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_sg550", "ammo_556nato", "556Nato" },
{ WEAPON_GALIL, GALIL_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, GALIL_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_galil", "ammo_556nato", "556Nato" },
{ WEAPON_FAMAS, FAMAS_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, FAMAS_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_famas", "ammo_556nato", "556Nato" },
{ WEAPON_USP, USP_PRICE, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, USP_MAX_CLIP, MAX_AMMO_45ACP, AMMO_45ACP, "weapon_usp", "ammo_45acp", "45acp" },
{ WEAPON_AWP, AWP_PRICE, AMMO_338MAG_PRICE, AMMO_338MAG_BUY, AWP_MAX_CLIP, MAX_AMMO_338MAGNUM, AMMO_338MAGNUM, "weapon_awp", "ammo_338magnum", "338Magnum" },
{ WEAPON_MP5N, MP5NAVY_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, MP5N_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_mp5navy", "ammo_9mm", "9mm" },
{ WEAPON_M249, M249_PRICE, AMMO_556MM_PRICE, AMMO_556NATOBOX_BUY, M249_MAX_CLIP, MAX_AMMO_556NATOBOX, AMMO_556NATOBOX, "weapon_m249", "ammo_556natobox", "556NatoBox" },
{ WEAPON_M3, M3_PRICE, AMMO_BUCKSHOT_PRICE, AMMO_BUCKSHOT_BUY, M3_MAX_CLIP, MAX_AMMO_BUCKSHOT, AMMO_BUCKSHOT, "weapon_m3", "ammo_buckshot", "buckshot" },
{ WEAPON_M4A1, M4A1_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, M4A1_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_m4a1", "ammo_556nato", "556Nato" },
{ WEAPON_TMP, TMP_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, TMP_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_tmp", "ammo_9mm", "9mm" },
{ WEAPON_G3SG1, G3SG1_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, G3SG1_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_g3sg1", "ammo_762nato", "762Nato" },
{ WEAPON_DEAGLE, DEAGLE_PRICE, AMMO_50AE_PRICE, AMMO_50AE_BUY, DEAGLE_MAX_CLIP, MAX_AMMO_50AE, AMMO_50AE, "weapon_deagle", "ammo_50ae", "50AE" },
{ WEAPON_SG552, SG552_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, SG552_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_sg552", "ammo_556nato", "556Nato" },
{ WEAPON_AK47, AK47_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, AK47_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_ak47", "ammo_762nato", "762Nato" },
{ WEAPON_P90, P90_PRICE, AMMO_57MM_PRICE, AMMO_57MM_BUY, P90_MAX_CLIP, MAX_AMMO_57MM, AMMO_57MM, "weapon_p90", "ammo_57mm", "57mm" },
#ifdef REGAMEDLL_FIXES
{ WEAPON_C4, 0, 0, 0, 0, 0, AMMO_C4, "weapon_c4", nullptr, "C4" },
{ WEAPON_KNIFE, 0, 0, 0, 0, 0, AMMO_NONE, "weapon_knife", nullptr, nullptr },
{ WEAPON_HEGRENADE, (WeaponCostType)HEGRENADE_PRICE, 0, 0, 0, MAX_AMMO_HEGRENADE, AMMO_HEGRENADE, "weapon_hegrenade", nullptr, "HEGrenade" },
{ WEAPON_SMOKEGRENADE, (WeaponCostType)SMOKEGRENADE_PRICE, 0, 0, 0, MAX_AMMO_SMOKEGRENADE, AMMO_SMOKEGRENADE, "weapon_smokegrenade", nullptr, "SmokeGrenade" },
{ WEAPON_FLASHBANG, (WeaponCostType)FLASHBANG_PRICE, 0, 0, 0, MAX_AMMO_FLASHBANG, AMMO_FLASHBANG, "weapon_flashbang", nullptr, "Flashbang" },
{ WEAPON_C4, 0, 0, 0, 0, 0, AMMO_C4, "weapon_c4", nullptr, "C4" },
{ WEAPON_KNIFE, 0, 0, 0, 0, 0, AMMO_NONE, "weapon_knife", nullptr, nullptr },
{ WEAPON_HEGRENADE, (WeaponCostType)HEGRENADE_PRICE, AMMO_HEGRENADE_PRICE, AMMO_HEGRENADE_BUY, 0, MAX_AMMO_HEGRENADE, AMMO_HEGRENADE, "weapon_hegrenade", nullptr, "HEGrenade" },
{ WEAPON_SMOKEGRENADE, (WeaponCostType)SMOKEGRENADE_PRICE, AMMO_SMOKEGRENADE_PRICE, AMMO_SMOKEGRENADE_BUY, 0, MAX_AMMO_SMOKEGRENADE, AMMO_SMOKEGRENADE, "weapon_smokegrenade", nullptr, "SmokeGrenade" },
{ WEAPON_FLASHBANG, (WeaponCostType)FLASHBANG_PRICE, AMMO_FLASHBANG_PRICE, AMMO_FLASHBANG_BUY, 0, MAX_AMMO_FLASHBANG, AMMO_FLASHBANG, "weapon_flashbang", nullptr, "Flashbang" },
#endif
{ WEAPON_SHIELDGUN, SHIELDGUN_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_shield", nullptr, nullptr },
{ WEAPON_SHIELDGUN, SHIELDGUN_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_shield", nullptr, nullptr },
#ifndef REGAMEDLL_FIXES
{ 0, 0, 0, 0, 0, 0, AMMO_NONE, nullptr, nullptr, nullptr },
{ 0, 0, 0, 0, 0, 0, AMMO_NONE, nullptr, nullptr, nullptr },
#endif
};
#endif // HOOK_GAMEDLL
WeaponSlotInfo weaponSlotInfo[] = {
AmmoInfoStruct g_ammoInfo[14];
AmmoInfoStruct g_ammoInfo_default[] =
{
{ AMMO_338MAGNUM, AMMO_338MAG_PRICE, AMMO_338MAG_BUY, MAX_AMMO_338MAGNUM, "ammo_338magnum", "338Magnum" },
{ AMMO_762NATO, AMMO_762MM_PRICE, AMMO_762NATO_BUY, MAX_AMMO_762NATO, "ammo_762nato", "762Nato" },
{ AMMO_556NATOBOX, AMMO_556MM_PRICE, AMMO_556NATOBOX_BUY, MAX_AMMO_556NATOBOX, "ammo_556natobox", "556NatoBox" },
{ AMMO_556NATO, AMMO_556MM_PRICE, AMMO_556NATO_BUY, MAX_AMMO_556NATO, "ammo_556nato", "556Nato" },
{ AMMO_BUCKSHOT, AMMO_BUCKSHOT_PRICE, AMMO_BUCKSHOT_BUY, MAX_AMMO_BUCKSHOT, "ammo_buckshot", "buckshot" },
{ AMMO_45ACP, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, MAX_AMMO_45ACP, "ammo_45acp", "45acp" },
{ AMMO_57MM, AMMO_57MM_PRICE, AMMO_57MM_BUY, MAX_AMMO_57MM, "ammo_57mm", "57mm" },
{ AMMO_50AE, AMMO_50AE_PRICE, AMMO_50AE_BUY, MAX_AMMO_50AE, "ammo_50ae", "50AE" },
{ AMMO_357SIG, AMMO_357SIG_PRICE, AMMO_357SIG_BUY, MAX_AMMO_357SIG, "ammo_357sig", "357SIG" },
{ AMMO_9MM, AMMO_9MM_PRICE, AMMO_9MM_BUY, MAX_AMMO_9MM, "ammo_9mm", "9mm" },
{ AMMO_FLASHBANG, AMMO_FLASHBANG_PRICE, AMMO_FLASHBANG_BUY, MAX_AMMO_FLASHBANG, nullptr, "Flashbang" },
{ AMMO_HEGRENADE, AMMO_HEGRENADE_PRICE, AMMO_HEGRENADE_BUY, MAX_AMMO_HEGRENADE, nullptr, "HEGrenade" },
{ AMMO_SMOKEGRENADE, AMMO_SMOKEGRENADE_PRICE, AMMO_SMOKEGRENADE_BUY, MAX_AMMO_SMOKEGRENADE, nullptr, "SmokeGrenade" },
{ AMMO_C4, 0, 0, 0, nullptr, "C4" },
};
WeaponSlotInfo g_weaponSlotInfo[] = {
{ WEAPON_C4, C4_SLOT, "weapon_c4" },
{ WEAPON_KNIFE, KNIFE_SLOT, "weapon_knife" },
{ WEAPON_P228, PISTOL_SLOT, "weapon_p228" },
@ -315,10 +334,10 @@ WeaponIdType AliasToWeaponID(const char *alias)
{
if (alias)
{
for (int i = 0; weaponAliasInfo[i].alias; ++i)
for (int i = 0; g_weaponAliasInfo[i].alias; i++)
{
if (!Q_stricmp(weaponAliasInfo[i].alias, alias))
return weaponAliasInfo[i].id;
if (!Q_stricmp(g_weaponAliasInfo[i].alias, alias))
return g_weaponAliasInfo[i].id;
}
}
@ -329,12 +348,12 @@ const char *BuyAliasToWeaponID(const char *alias, WeaponIdType &id)
{
if (alias)
{
for (int i = 0; weaponBuyAliasInfo[i].alias; ++i)
for (int i = 0; g_weaponBuyAliasInfo[i].alias; i++)
{
if (!Q_stricmp(weaponBuyAliasInfo[i].alias, alias))
if (!Q_stricmp(g_weaponBuyAliasInfo[i].alias, alias))
{
id = weaponBuyAliasInfo[i].id;
return weaponBuyAliasInfo[i].failName;
id = g_weaponBuyAliasInfo[i].id;
return g_weaponBuyAliasInfo[i].failName;
}
}
}
@ -346,10 +365,10 @@ const char *BuyAliasToWeaponID(const char *alias, WeaponIdType &id)
// Given a weapon ID, return its alias
const char *WeaponIDToAlias(int id)
{
for (int i = 0; weaponAliasInfo[i].alias; ++i)
for (int i = 0; g_weaponAliasInfo[i].alias; i++)
{
if (weaponAliasInfo[i].id == id)
return weaponAliasInfo[i].alias;
if (g_weaponAliasInfo[i].id == id)
return g_weaponAliasInfo[i].alias;
}
return nullptr;
@ -359,10 +378,10 @@ WeaponClassType AliasToWeaponClass(const char *alias)
{
if (alias)
{
for (int i = 0; weaponClassAliasInfo[i].alias; ++i)
for (int i = 0; g_weaponClassAliasInfo[i].alias; i++)
{
if (!Q_stricmp(weaponClassAliasInfo[i].alias, alias))
return weaponClassAliasInfo[i].id;
if (!Q_stricmp(g_weaponClassAliasInfo[i].alias, alias))
return g_weaponClassAliasInfo[i].id;
}
}
@ -427,7 +446,7 @@ bool IsSecondaryWeapon(int id)
WeaponInfoStruct *GetWeaponInfo(int weaponID)
{
for (auto& info : weaponInfo) {
for (auto& info : g_weaponInfo) {
if (info.id == weaponID) {
return &info;
}
@ -438,7 +457,7 @@ WeaponInfoStruct *GetWeaponInfo(int weaponID)
WeaponInfoStruct *GetWeaponInfo(const char *weaponName)
{
for (auto& info : weaponInfo) {
for (auto& info : g_weaponInfo) {
if (!Q_stricmp(info.entityName, weaponName)) {
return &info;
}
@ -447,9 +466,9 @@ WeaponInfoStruct *GetWeaponInfo(const char *weaponName)
return nullptr;
}
WeaponInfoStruct *GetAmmoInfo(const char *ammoName)
AmmoInfoStruct *GetAmmoInfo(const char *ammoName)
{
for (auto& info : weaponInfo) {
for (auto& info : g_ammoInfo) {
if (!Q_stricmp(info.ammoName1, ammoName)) {
return &info;
}
@ -458,16 +477,28 @@ WeaponInfoStruct *GetAmmoInfo(const char *ammoName)
return nullptr;
}
AmmoInfoStruct *GetAmmoInfo(AmmoType ammoID)
{
for (auto& info : g_ammoInfo) {
if (info.ammoType == ammoID) {
return &info;
}
}
return nullptr;
}
void WeaponInfoReset()
{
#ifndef HOOK_GAMEDLL
Q_memcpy(weaponInfo, weaponInfo_default, sizeof(weaponInfo));
Q_memcpy(g_weaponInfo, g_weaponInfo_default, sizeof(g_weaponInfo));
Q_memcpy(g_ammoInfo, g_ammoInfo_default, sizeof(g_ammoInfo));
#endif
}
WeaponSlotInfo *GetWeaponSlot(WeaponIdType weaponID)
{
for (auto& infoSlot : weaponSlotInfo) {
for (auto& infoSlot : g_weaponSlotInfo) {
if (infoSlot.id == weaponID) {
return &infoSlot;
}
@ -478,7 +509,7 @@ WeaponSlotInfo *GetWeaponSlot(WeaponIdType weaponID)
WeaponSlotInfo *GetWeaponSlot(const char *weaponName)
{
for (auto& infoSlot : weaponSlotInfo) {
for (auto& infoSlot : g_weaponSlotInfo) {
if (!Q_stricmp(infoSlot.weaponName, weaponName)) {
return &infoSlot;
}

View File

@ -83,17 +83,32 @@ enum AutoBuyClassType
AUTOBUYCLASS_SHIELD = BIT(13),
};
enum ItemCostType
{
ASSAULTSUIT_PRICE = 1000,
FLASHBANG_PRICE = 200,
HEGRENADE_PRICE = 300,
SMOKEGRENADE_PRICE = 300,
KEVLAR_PRICE = 650,
HELMET_PRICE = 350,
NVG_PRICE = 1250,
DEFUSEKIT_PRICE = 200,
};
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,
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,
AMMO_FLASHBANG_PRICE = FLASHBANG_PRICE,
AMMO_HEGRENADE_PRICE = HEGRENADE_PRICE,
AMMO_SMOKEGRENADE_PRICE = SMOKEGRENADE_PRICE,
};
enum WeaponCostType
@ -287,28 +302,19 @@ enum WeaponClassType
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 ItemCostType
{
ASSAULTSUIT_PRICE = 1000,
FLASHBANG_PRICE = 200,
HEGRENADE_PRICE = 300,
SMOKEGRENADE_PRICE = 300,
KEVLAR_PRICE = 650,
HELMET_PRICE = 350,
NVG_PRICE = 1250,
DEFUSEKIT_PRICE = 200,
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,
AMMO_FLASHBANG_BUY = 1,
AMMO_HEGRENADE_BUY = 1,
AMMO_SMOKEGRENADE_BUY = 1,
};
enum shieldgun_e
@ -413,6 +419,18 @@ struct WeaponInfoStruct
const char *ammoName2;
};
struct AmmoInfoStruct
{
AmmoType ammoType;
int clipCost;
int buyClipSize;
int maxRounds;
const char *ammoName1;
const char *ammoName2;
};
struct WeaponSlotInfo
{
WeaponIdType id;
@ -436,7 +454,9 @@ void WeaponInfoReset();
WeaponInfoStruct *GetWeaponInfo(int weaponID);
WeaponInfoStruct *GetWeaponInfo(const char *weaponName);
WeaponInfoStruct *GetAmmoInfo(const char *ammoName);
AmmoInfoStruct *GetAmmoInfo(AmmoType ammoID);
AmmoInfoStruct *GetAmmoInfo(const char *ammoName);
WeaponSlotInfo *GetWeaponSlot(WeaponIdType weaponID);
WeaponSlotInfo *GetWeaponSlot(const char *weaponName);

View File

@ -125,14 +125,14 @@ CSoundEnt *pSoundEnt;
// globals weapons
const char *g_pModelNameLaser;
ItemInfo IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[32];
AmmoInfo IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[32];
ItemInfo IMPL_CLASS(CBasePlayerItem, m_ItemInfoArray)[32];
AmmoInfo IMPL_CLASS(CBasePlayerItem, m_AmmoInfoArray)[32];
AutoBuyInfoStruct g_autoBuyInfo[35];
WeaponAliasInfo weaponAliasInfo[39];
WeaponBuyAliasInfo weaponBuyAliasInfo[43];
WeaponClassAliasInfo weaponClassAliasInfo[46];
WeaponInfoStruct weaponInfo[27];
WeaponAliasInfo g_weaponAliasInfo[39];
WeaponBuyAliasInfo g_weaponBuyAliasInfo[43];
WeaponClassAliasInfo g_weaponClassAliasInfo[46];
WeaponInfoStruct g_weaponInfo[27];
// globals utils
TYPEDESCRIPTION gEntvarsDescription[86];

View File

@ -386,10 +386,10 @@ extern void (*pCCSBot__UpdateLookAngles)();
// globals weapontype
#define g_autoBuyInfo (*pg_autoBuyInfo)
#define weaponAliasInfo (*pweaponAliasInfo)
#define weaponBuyAliasInfo (*pweaponBuyAliasInfo)
#define weaponClassAliasInfo (*pweaponClassAliasInfo)
#define weaponInfo (*pweaponInfo)
#define g_weaponAliasInfo (*pg_weaponAliasInfo)
#define g_weaponBuyAliasInfo (*pg_weaponBuyAliasInfo)
#define g_weaponClassAliasInfo (*pg_weaponClassAliasInfo)
#define g_weaponInfo (*pg_weaponInfo)
// globals wolrd
#define g_pBodyQueueHead (*pg_pBodyQueueHead)
@ -765,10 +765,10 @@ C_DLLEXPORT void grenade(entvars_t *pev);
C_DLLEXPORT void world_items(entvars_t *pev);
// externs
extern struct WeaponAliasInfo weaponAliasInfo[39];
extern struct WeaponBuyAliasInfo weaponBuyAliasInfo[43];
extern struct WeaponClassAliasInfo weaponClassAliasInfo[46];
extern struct WeaponInfoStruct weaponInfo[27];
extern struct WeaponAliasInfo g_weaponAliasInfo[39];
extern struct WeaponBuyAliasInfo g_weaponBuyAliasInfo[43];
extern struct WeaponClassAliasInfo g_weaponClassAliasInfo[46];
extern struct WeaponInfoStruct g_weaponInfo[27];
extern edict_t *g_pBodyQueueHead;
extern TYPEDESCRIPTION gGlobalEntitySaveData[3];
extern TYPEDESCRIPTION gEntvarsDescription[86];

View File

@ -5734,11 +5734,11 @@ AddressRef g_DataRefs[] =
//GLOBALVAR_LINK(0x01E61E70, "_ZL12mp_com_token", pmp_com_token),
GLOBALVAR_LINK(0x01E636F0, "vec3_origin", pvec3_origin),
GLOBALVAR_LINK(0x01E1F420, "nanmask", pnanmask),
GLOBALVAR_LINK(0x01E0B0B0, "_ZL15weaponAliasInfo", pweaponAliasInfo),
GLOBALVAR_LINK(0x01E0B1E8, "_ZL18weaponBuyAliasInfo", pweaponBuyAliasInfo),
GLOBALVAR_LINK(0x01E0B3F0, "_ZL20weaponClassAliasInfo", pweaponClassAliasInfo),
GLOBALVAR_LINK(0x01E0B0B0, "_ZL15weaponAliasInfo", pg_weaponAliasInfo),
GLOBALVAR_LINK(0x01E0B1E8, "_ZL18weaponBuyAliasInfo", pg_weaponBuyAliasInfo),
GLOBALVAR_LINK(0x01E0B3F0, "_ZL20weaponClassAliasInfo", pg_weaponClassAliasInfo),
GLOBALVAR_LINK(0x01E0B560, "g_autoBuyInfo", pg_autoBuyInfo),
GLOBALVAR_LINK(0x01E0B708, "_ZL10weaponInfo", pweaponInfo),
GLOBALVAR_LINK(0x01E0B708, "_ZL10weaponInfo", pg_weaponInfo),
GLOBALVAR_LINK(0x01E6AC80, "gszallsentencenames", pgszallsentencenames),
GLOBALVAR_LINK(0x01E683E0, "rgsentenceg", prgsentenceg),
GLOBALVAR_LINK(0x01E75480, "fSentencesInit", pfSentencesInit),
@ -6082,8 +6082,8 @@ AddressRef g_DataRefs[] =
GLOBALVAR_LINK(0x01E1D4A0, "_ZN15CFuncTrackTrain10m_SaveDataE", CFuncTrackTrain::pm_SaveData),
GLOBALVAR_LINK(0x01E1D560, "_ZN16CFuncTrackChange10m_SaveDataE", CFuncTrackChange::pm_SaveData),
GLOBALVAR_LINK(0x01E1D5F0, "_ZN10CGunTarget10m_SaveDataE", CGunTarget::pm_SaveData),
GLOBALVAR_LINK(0x01E75FE0, "_ZN15CBasePlayerItem13ItemInfoArrayE", CBasePlayerItem::pItemInfoArray),
GLOBALVAR_LINK(0x01E75ED8, "_ZN15CBasePlayerItem13AmmoInfoArrayE", CBasePlayerItem::pAmmoInfoArray),
GLOBALVAR_LINK(0x01E75FE0, "_ZN15CBasePlayerItem13ItemInfoArrayE", CBasePlayerItem::pm_ItemInfoArray),
GLOBALVAR_LINK(0x01E75ED8, "_ZN15CBasePlayerItem13AmmoInfoArrayE", CBasePlayerItem::pm_AmmoInfoArray),
GLOBALVAR_LINK(0x01E28816, "_ZN13CCSBotManager17m_isMapDataLoadedE", CCSBotManager::pm_isMapDataLoaded),
GLOBALVAR_LINK(0x01E28818, "_ZN13CCSBotManager9m_editCmdE", CCSBotManager::pm_editCmd),
GLOBALVAR_LINK(0x01E2881C, "_ZN13CCSBotManager17m_flNextCVarCheckE", CCSBotManager::pm_flNextCVarCheck),

View File

@ -37,7 +37,7 @@
#include "client.h"
#define REGAMEDLL_API_VERSION_MAJOR 5
#define REGAMEDLL_API_VERSION_MINOR 3
#define REGAMEDLL_API_VERSION_MINOR 4
// CBasePlayer::Spawn hook
typedef IHookChainClass<void, class CBasePlayer> IReGameHook_CBasePlayer_Spawn;
@ -486,6 +486,8 @@ public:
virtual struct WeaponSlotInfo *GetWeaponSlot(const char *weaponName) = 0;
virtual struct ItemInfo *GetItemInfo(WeaponIdType weaponID) = 0;
virtual struct AmmoInfo *GetAmmoInfo(AmmoType ammoID) = 0;
virtual struct AmmoInfoStruct *GetAmmoInfoEx(AmmoType ammoID) = 0;
virtual struct AmmoInfoStruct *GetAmmoInfoEx(const char *ammoName) = 0;
};
#define VRE_GAMEDLL_API_VERSION "VRE_GAMEDLL_API_VERSION001"

View File

@ -178,8 +178,11 @@ playermove_t *EXT_FUNC CReGameApi::GetPlayerMove() {
WeaponSlotInfo *EXT_FUNC CReGameApi::GetWeaponSlot(WeaponIdType weaponID) { return ::GetWeaponSlot(weaponID); }
WeaponSlotInfo *EXT_FUNC CReGameApi::GetWeaponSlot(const char *weaponName) { return ::GetWeaponSlot(weaponName); }
ItemInfo *EXT_FUNC CReGameApi::GetItemInfo(WeaponIdType weaponID) { return &IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[ weaponID ]; }
AmmoInfo *EXT_FUNC CReGameApi::GetAmmoInfo(AmmoType ammoID) { return &IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[ ammoID ]; }
ItemInfo *EXT_FUNC CReGameApi::GetItemInfo(WeaponIdType weaponID) { return &IMPL_CLASS(CBasePlayerItem, m_ItemInfoArray)[weaponID]; }
AmmoInfo *EXT_FUNC CReGameApi::GetAmmoInfo(AmmoType ammoID) { return &IMPL_CLASS(CBasePlayerItem, m_AmmoInfoArray)[ammoID]; }
AmmoInfoStruct *EXT_FUNC CReGameApi::GetAmmoInfoEx(AmmoType ammoID) { return ::GetAmmoInfo(ammoID); }
AmmoInfoStruct *EXT_FUNC CReGameApi::GetAmmoInfoEx(const char *ammoName) { return ::GetAmmoInfo(ammoName); }
void EXT_FUNC Regamedll_ChangeString_api(char *&dest, const char *source)
{

View File

@ -555,6 +555,8 @@ public:
virtual WeaponSlotInfo *GetWeaponSlot(const char *weaponName);
virtual ItemInfo *GetItemInfo(WeaponIdType weaponID);
virtual AmmoInfo *GetAmmoInfo(AmmoType ammoID);
virtual AmmoInfoStruct *GetAmmoInfoEx(AmmoType ammoID);
virtual AmmoInfoStruct *GetAmmoInfoEx(const char *ammoName);
};
void Regamedll_ChangeString_api(char *&dest, const char *source);