diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 34505c1c..caeffc4a 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -104,21 +104,7 @@ void TeamChangeUpdate(CBasePlayer *player, int team_id) { MESSAGE_BEGIN(MSG_ALL, gmsgTeamInfo); WRITE_BYTE(player->entindex()); - switch (team_id) - { - case CT: - WRITE_STRING("CT"); - break; - case TERRORIST: - WRITE_STRING("TERRORIST"); - break; - case SPECTATOR: - WRITE_STRING("SPECTATOR"); - break; - default: - WRITE_STRING("UNASSIGNED"); - break; - } + WRITE_STRING(GetTeamName(team_id)); MESSAGE_END(); if (team_id != UNASSIGNED) @@ -280,8 +266,7 @@ NOXREF int CountTeams() void ListPlayers(CBasePlayer *current) { - char message[120], cNumber[12]; - Q_strcpy(message, ""); + char message[120] = "", cNumber[12]; CBaseEntity *pPlayer = NULL; while ((pPlayer = UTIL_FindEntityByClassname(pPlayer, "player")) != NULL) @@ -680,11 +665,11 @@ void Host_Say(edict_t *pEntity, int teamonly) Place playerPlace = TheNavAreaGrid.GetPlace(&player->pev->origin); const BotPhraseList *placeList = TheBotPhrases->GetPlaceList(); - for (BotPhraseList::const_iterator iter = placeList->begin(); iter != placeList->end(); ++iter) + for (auto& it : *placeList) { - if ((*iter)->GetID() == playerPlace) + if (it->GetID() == playerPlace) { - placeName = (*iter)->GetName(); + placeName = it->GetName(); break; } } @@ -915,19 +900,13 @@ LINK_HOOK_CHAIN(bool, CanBuyThis, (CBasePlayer *pPlayer, int iWeapon), pPlayer, bool __API_HOOK(CanBuyThis)(CBasePlayer *pPlayer, int iWeapon) { if (pPlayer->HasShield() && iWeapon == WEAPON_ELITE) - { return false; - } if (pPlayer->HasShield() && iWeapon == WEAPON_SHIELDGUN) - { return false; - } if (pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ] != NULL && pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ]->m_iId == WEAPON_ELITE && iWeapon == WEAPON_SHIELDGUN) - { return false; - } if (pPlayer->m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ] != NULL && pPlayer->m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]->m_iId == iWeapon) { @@ -964,484 +943,115 @@ bool __API_HOOK(CanBuyThis)(CBasePlayer *pPlayer, int iWeapon) void BuyPistol(CBasePlayer *pPlayer, int iSlot) { - int iWeapon = 0; - int iWeaponPrice = 0; - const char *pszWeapon = NULL; - - if (!pPlayer->CanPlayerBuy(true)) - { - return; - } - if (iSlot < 1 || iSlot > 5) - { return; - } + WeaponIdType buyWeapon = WEAPON_NONE; switch (iSlot) { - case 1: - { - iWeapon = WEAPON_GLOCK18; - iWeaponPrice = GLOCK18_PRICE; - pszWeapon = "weapon_glock18"; - break; - } - case 2: - { - iWeapon = WEAPON_USP; - iWeaponPrice = USP_PRICE; - pszWeapon = "weapon_usp"; - break; - } - case 3: - { - iWeapon = WEAPON_P228; - iWeaponPrice = P228_PRICE; - pszWeapon = "weapon_p228"; - break; - } - case 4: - { - iWeapon = WEAPON_DEAGLE; - iWeaponPrice = DEAGLE_PRICE; - pszWeapon = "weapon_deagle"; - break; - } - case 5: - { - if (pPlayer->m_iTeam == CT) - { - iWeapon = WEAPON_FIVESEVEN; - iWeaponPrice = FIVESEVEN_PRICE; - pszWeapon = "weapon_fiveseven"; - } - else - { - iWeapon = WEAPON_ELITE; - iWeaponPrice = ELITE_PRICE; - pszWeapon = "weapon_elite"; - } - - break; - } + case 1: + buyWeapon = WEAPON_GLOCK18; + break; + case 2: + buyWeapon = WEAPON_USP; + break; + case 3: + buyWeapon = WEAPON_P228; + break; + case 4: + buyWeapon = WEAPON_DEAGLE; + break; + case 5: + buyWeapon = (pPlayer->m_iTeam == CT) ? WEAPON_FIVESEVEN : WEAPON_ELITE; + break; } - if (!CanBuyThis(pPlayer, iWeapon)) - { - return; - } - - if (pPlayer->m_iAccount < iWeaponPrice) - { - if (g_bClientPrintEnable) - { - ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Not_Enough_Money"); - BlinkAccount(pPlayer, 2); - } - - return; - } - - DropSecondary(pPlayer); - - pPlayer->GiveNamedItem(pszWeapon); - pPlayer->AddAccount(-iWeaponPrice); - - if (TheTutor != NULL) - { - TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer); - } + BuyWeaponByWeaponID(pPlayer, buyWeapon); } void BuyShotgun(CBasePlayer *pPlayer, int iSlot) { - int iWeapon = 0; - int iWeaponPrice = 0; - const char *pszWeapon = NULL; - - if (!pPlayer->CanPlayerBuy(true)) - { - return; - } - if (iSlot < 1 || iSlot > 2) - { return; - } + WeaponIdType buyWeapon = WEAPON_NONE; switch (iSlot) { - case 1: - { - iWeapon = WEAPON_M3; - iWeaponPrice = M3_PRICE; - pszWeapon = "weapon_m3"; - break; - } - case 2: - { - iWeapon = WEAPON_XM1014; - iWeaponPrice = XM1014_PRICE; - pszWeapon = "weapon_xm1014"; - break; - } + case 1: + buyWeapon = WEAPON_M3; + break; + case 2: + buyWeapon = WEAPON_XM1014; + break; } - if (!CanBuyThis(pPlayer, iWeapon)) - { - return; - } - - if (pPlayer->m_iAccount < iWeaponPrice) - { - if (g_bClientPrintEnable) - { - ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Not_Enough_Money"); - BlinkAccount(pPlayer, 2); - } - - return; - } - - DropPrimary(pPlayer); - - pPlayer->GiveNamedItem(pszWeapon); - pPlayer->AddAccount(-iWeaponPrice); - - if (TheTutor != NULL) - { - TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer); - } + BuyWeaponByWeaponID(pPlayer, buyWeapon); } void BuySubMachineGun(CBasePlayer *pPlayer, int iSlot) { - int iWeapon = 0; - int iWeaponPrice = 0; - const char *pszWeapon = NULL; - - if (!pPlayer->CanPlayerBuy(true)) - { - return; - } - if (iSlot < 1 || iSlot > 4) - { return; - } + WeaponIdType buyWeapon = WEAPON_NONE; switch (iSlot) { - case 1: - { - if (pPlayer->m_iTeam == CT) - { - iWeapon = WEAPON_TMP; - iWeaponPrice = TMP_PRICE; - pszWeapon = "weapon_tmp"; - } - else - { - iWeapon = WEAPON_MAC10; - iWeaponPrice = MAC10_PRICE; - pszWeapon = "weapon_mac10"; - } - - break; - } - case 2: - { - iWeapon = WEAPON_MP5N; - iWeaponPrice = MP5NAVY_PRICE; - pszWeapon = "weapon_mp5navy"; - break; - } - case 3: - { - iWeapon = WEAPON_UMP45; - iWeaponPrice = UMP45_PRICE; - pszWeapon = "weapon_ump45"; - break; - } - case 4: - { - iWeapon = WEAPON_P90; - iWeaponPrice = P90_PRICE; - pszWeapon = "weapon_p90"; - break; - } + case 1: + buyWeapon = (pPlayer->m_iTeam == CT) ? WEAPON_TMP : WEAPON_MAC10; + break; + case 2: + buyWeapon = WEAPON_MP5N; + break; + case 3: + buyWeapon = WEAPON_UMP45; + break; + case 4: + buyWeapon = WEAPON_P90; + break; } - if (!CanBuyThis(pPlayer, iWeapon)) - { - return; - } - - if (pPlayer->m_iAccount < iWeaponPrice) - { - if (g_bClientPrintEnable) - { - ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Not_Enough_Money"); - BlinkAccount(pPlayer, 2); - } - - return; - } - - DropPrimary(pPlayer); - - pPlayer->GiveNamedItem(pszWeapon); - pPlayer->AddAccount(-iWeaponPrice); - - if (TheTutor != NULL) - { - TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer); - } -} - -void BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID) -{ - if (!pPlayer->CanPlayerBuy(true)) - { - return; - } - - if (!CanBuyThis(pPlayer, weaponID)) - { - return; - } - - WeaponInfoStruct *info = GetWeaponInfo(weaponID); - - if (!info || !info->entityName) - { - return; - } - - if (pPlayer->m_iAccount < info->cost) - { - if (g_bClientPrintEnable) - { - ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Not_Enough_Money"); - BlinkAccount(pPlayer, 2); - } - - return; - } - - if (IsPrimaryWeapon(weaponID)) - { - DropPrimary(pPlayer); - } - else - { - DropSecondary(pPlayer); - } - - pPlayer->GiveNamedItem(info->entityName); - pPlayer->AddAccount(-info->cost); - - if (TheTutor != NULL) - { - TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer); - } + BuyWeaponByWeaponID(pPlayer, buyWeapon); } void BuyRifle(CBasePlayer *pPlayer, int iSlot) { - int iWeapon = 0; - int iWeaponPrice = 0; - bool bIsCT = false; - const char *pszWeapon = NULL; - - if (!pPlayer->CanPlayerBuy(true)) - { - return; - } - if (iSlot < 1 || iSlot > 6) - { return; - } - if (pPlayer->m_iTeam == CT) - bIsCT = true; + WeaponIdType buyWeapon = WEAPON_NONE; + bool bIsCT = (pPlayer->m_iTeam == CT) ? true : false; switch (iSlot) { - case 2: - { - if (bIsCT) - { - iWeapon = WEAPON_SCOUT; - iWeaponPrice = SCOUT_PRICE; - pszWeapon = "weapon_scout"; - } - else - { - iWeapon = WEAPON_AK47; - iWeaponPrice = AK47_PRICE; - pszWeapon = "weapon_ak47"; - } - - break; - } - case 3: - { - if (bIsCT) - { - iWeapon = WEAPON_M4A1; - iWeaponPrice = M4A1_PRICE; - pszWeapon = "weapon_m4a1"; - } - else - { - iWeapon = WEAPON_SCOUT; - iWeaponPrice = SCOUT_PRICE; - pszWeapon = "weapon_scout"; - } - - break; - } - case 4: - { - if (bIsCT) - { - iWeapon = WEAPON_AUG; - iWeaponPrice = AUG_PRICE; - pszWeapon = "weapon_aug"; - } - else - { - iWeapon = WEAPON_SG552; - iWeaponPrice = SG552_PRICE; - pszWeapon = "weapon_sg552"; - } - - break; - } - case 5: - { - if (bIsCT) - { - iWeapon = WEAPON_SG550; - iWeaponPrice = SG550_PRICE; - pszWeapon = "weapon_sg550"; - } - else - { - iWeapon = WEAPON_AWP; - iWeaponPrice = AWP_PRICE; - pszWeapon = "weapon_awp"; - } - - break; - } - case 6: - { - if (bIsCT) - { - iWeapon = WEAPON_AWP; - iWeaponPrice = AWP_PRICE; - pszWeapon = "weapon_awp"; - } - else - { - iWeapon = WEAPON_G3SG1; - iWeaponPrice = G3SG1_PRICE; - pszWeapon = "weapon_g3sg1"; - } - - break; - } - default: - { - if (bIsCT) - { - iWeapon = WEAPON_FAMAS; - iWeaponPrice = FAMAS_PRICE; - pszWeapon = "weapon_famas"; - } - else - { - iWeapon = WEAPON_GALIL; - iWeaponPrice = GALIL_PRICE; - pszWeapon = "weapon_galil"; - } - - break; - } + case 2: + buyWeapon = bIsCT ? WEAPON_SCOUT : WEAPON_AK47; + break; + case 3: + buyWeapon = bIsCT ? WEAPON_M4A1 : WEAPON_SCOUT; + break; + case 4: + buyWeapon = bIsCT ? WEAPON_AUG : WEAPON_SG552; + break; + case 5: + buyWeapon = bIsCT ? WEAPON_SG550 : WEAPON_AWP; + break; + case 6: + buyWeapon = bIsCT ? WEAPON_AWP : WEAPON_G3SG1; + break; + default: + buyWeapon = bIsCT ? WEAPON_FAMAS : WEAPON_GALIL; + break; } - if (!CanBuyThis(pPlayer, iWeapon)) - { - return; - } - - if (pPlayer->m_iAccount < iWeaponPrice) - { - if (g_bClientPrintEnable) - { - ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Not_Enough_Money"); - BlinkAccount(pPlayer, 2); - } - - return; - } - - DropPrimary(pPlayer); - - pPlayer->GiveNamedItem(pszWeapon); - pPlayer->AddAccount(-iWeaponPrice); - - if (TheTutor != NULL) - { - TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer); - } + BuyWeaponByWeaponID(pPlayer, buyWeapon); } void BuyMachineGun(CBasePlayer *pPlayer, int iSlot) { - int iWeapon = WEAPON_M249; - int iWeaponPrice = M249_PRICE; - const char *pszWeapon = "weapon_m249"; - - if (!pPlayer->CanPlayerBuy(true)) - { - return; - } - if (iSlot != 1) - { return; - } - if (!CanBuyThis(pPlayer, iWeapon)) - { - return; - } - - if (pPlayer->m_iAccount < iWeaponPrice) - { - if (g_bClientPrintEnable) - { - ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Not_Enough_Money"); - BlinkAccount(pPlayer, 2); - } - - return; - } - - DropPrimary(pPlayer); - - pPlayer->GiveNamedItem(pszWeapon); - pPlayer->AddAccount(-iWeaponPrice); - - if (TheTutor != NULL) - { - TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer); - } + BuyWeaponByWeaponID(pPlayer, WEAPON_M249); } void BuyItem(CBasePlayer *pPlayer, int iSlot) @@ -1464,8 +1074,8 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) } int fullArmor = (pPlayer->pev->armorvalue >= 100); - int helmet = (pPlayer->m_iKevlar == ARMOR_TYPE_HELMET); - int enoughMoney = 1; + bool bHasHelmet = (pPlayer->m_iKevlar == ARMOR_TYPE_HELMET); + bool bEnoughMoney = false; switch (iSlot) { @@ -1483,27 +1093,22 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) if (pPlayer->m_iAccount >= KEVLAR_PRICE) { - if (helmet) + if (bHasHelmet && g_bClientPrintEnable) { - if (g_bClientPrintEnable) - { - ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Already_Have_Helmet_Bought_Kevlar"); - } + ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Already_Have_Helmet_Bought_Kevlar"); } + bEnoughMoney = true; pszItem = "item_kevlar"; iItemPrice = KEVLAR_PRICE; } - else - enoughMoney = 0; - break; } case MENU_SLOT_ITEM_VESTHELM: { if (fullArmor) { - if (helmet) + if (bHasHelmet) { if (g_bClientPrintEnable) { @@ -1520,17 +1125,15 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Already_Have_Kevlar_Bought_Helmet"); } + bEnoughMoney = true; pszItem = "item_assaultsuit"; iItemPrice = HELMET_PRICE; } - else - enoughMoney = 0; - break; } else { - if (helmet) + if (bHasHelmet) { if (pPlayer->m_iAccount >= KEVLAR_PRICE) { @@ -1539,29 +1142,26 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Already_Have_Helmet_Bought_Kevlar"); } + bEnoughMoney = true; pszItem = "item_assaultsuit"; iItemPrice = KEVLAR_PRICE; } - else - enoughMoney = 0; } else { if (pPlayer->m_iAccount >= ASSAULTSUIT_PRICE) { + bEnoughMoney = true; pszItem = "item_assaultsuit"; iItemPrice = ASSAULTSUIT_PRICE; } - else - enoughMoney = 0; } } - break; } case MENU_SLOT_ITEM_FLASHGREN: { - if (pPlayer->AmmoInventory(pPlayer->GetAmmoIndex("Flashbang")) >= 2) + if (pPlayer->AmmoInventory(pPlayer->GetAmmoIndex("Flashbang")) >= MaxAmmoCarry("Flashbang")) { if (g_bClientPrintEnable) { @@ -1573,18 +1173,16 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) if (pPlayer->m_iAccount >= FLASHBANG_PRICE) { + bEnoughMoney = true; pszItem = "weapon_flashbang"; iItemPrice = FLASHBANG_PRICE; } - else - enoughMoney = 0; - break; } case MENU_SLOT_ITEM_HEGREN: { - if (pPlayer->AmmoInventory(pPlayer->GetAmmoIndex("HEGrenade")) >= 1) + if (pPlayer->AmmoInventory(pPlayer->GetAmmoIndex("HEGrenade")) >= MaxAmmoCarry("HEGrenade")) { if (g_bClientPrintEnable) { @@ -1596,17 +1194,15 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) if (pPlayer->m_iAccount >= HEGRENADE_PRICE) { + bEnoughMoney = true; pszItem = "weapon_hegrenade"; iItemPrice = HEGRENADE_PRICE; } - else - enoughMoney = 0; - break; } case MENU_SLOT_ITEM_SMOKEGREN: { - if (pPlayer->AmmoInventory(pPlayer->GetAmmoIndex("SmokeGrenade")) >= 1) + if (pPlayer->AmmoInventory(pPlayer->GetAmmoIndex("SmokeGrenade")) >= MaxAmmoCarry("SmokeGrenade")) { if (g_bClientPrintEnable) { @@ -1618,12 +1214,10 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) if (pPlayer->m_iAccount >= SMOKEGRENADE_PRICE) { + bEnoughMoney = true; pszItem = "weapon_smokegrenade"; iItemPrice = SMOKEGRENADE_PRICE; } - else - enoughMoney = 0; - break; } case MENU_SLOT_ITEM_NVG: @@ -1648,22 +1242,18 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "items/equip_nvg.wav", VOL_NORM, ATTN_NORM); + bEnoughMoney = true; pPlayer->m_bHasNightVision = true; pPlayer->AddAccount(-NVG_PRICE); SendItemStatus(pPlayer); } - else - enoughMoney = 0; - break; } case MENU_SLOT_ITEM_DEFUSEKIT: { if (pPlayer->m_iTeam != CT || !CSGameRules()->m_bMapHasBombTarget) - { return; - } if (pPlayer->m_bHasDefuser) { @@ -1677,6 +1267,7 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) if (pPlayer->m_iAccount >= DEFUSEKIT_PRICE) { + bEnoughMoney = true; pPlayer->m_bHasDefuser = true; MESSAGE_BEGIN(MSG_ONE, gmsgStatusIcon, NULL, pPlayer->pev); @@ -1693,20 +1284,16 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "items/kevlar.wav", VOL_NORM, ATTN_NORM); SendItemStatus(pPlayer); } - else - enoughMoney = 0; - break; } case MENU_SLOT_ITEM_SHIELD: { if (!CanBuyThis(pPlayer, WEAPON_SHIELDGUN)) - { return; - } if (pPlayer->m_iAccount >= SHIELDGUN_PRICE) { + bEnoughMoney = true; DropPrimary(pPlayer); pPlayer->GiveShield(true); @@ -1714,19 +1301,16 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM); } - else - enoughMoney = 0; - break; } } - if (!enoughMoney) + if (!bEnoughMoney) { if (g_bClientPrintEnable) { ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Not_Enough_Money"); - BlinkAccount(pPlayer, 2); + BlinkAccount(pPlayer); } return; @@ -1744,6 +1328,47 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot) } } +void BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID) +{ + if (!pPlayer->CanPlayerBuy(true)) + return; + + if (!CanBuyThis(pPlayer, weaponID)) + return; + + WeaponInfoStruct *info = GetWeaponInfo(weaponID); + if (!info || !info->entityName) + return; + + if (pPlayer->m_iAccount < info->cost) + { + if (g_bClientPrintEnable) + { + ClientPrint(pPlayer->pev, HUD_PRINTCENTER, "#Not_Enough_Money"); + BlinkAccount(pPlayer); + } + + return; + } + + if (IsPrimaryWeapon(weaponID)) + { + DropPrimary(pPlayer); + } + else + { + DropSecondary(pPlayer); + } + + pPlayer->GiveNamedItem(info->entityName); + pPlayer->AddAccount(-info->cost); + + if (TheTutor != NULL) + { + TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer); + } +} + void HandleMenu_ChooseAppearance(CBasePlayer *player, int slot) { int numSkins = g_bIsCzeroGame ? CZ_NUM_SKIN : CS_NUM_SKIN; @@ -2229,14 +1854,10 @@ BOOL HandleMenu_ChooseTeam(CBasePlayer *player, int slot) void Radio1(CBasePlayer *player, int slot) { if (player->m_flRadioTime >= gpGlobals->time) - { return; - } if (player->m_iRadioMessages <= 0) - { return; - } player->m_iRadioMessages--; player->m_flRadioTime = gpGlobals->time + 1.5f; @@ -2272,14 +1893,10 @@ void Radio1(CBasePlayer *player, int slot) void Radio2(CBasePlayer *player, int slot) { if (player->m_flRadioTime >= gpGlobals->time) - { return; - } if (player->m_iRadioMessages <= 0) - { return; - } player->m_iRadioMessages--; player->m_flRadioTime = gpGlobals->time + 1.5f; @@ -2315,14 +1932,10 @@ void Radio2(CBasePlayer *player, int slot) void Radio3(CBasePlayer *player, int slot) { if (player->m_flRadioTime >= gpGlobals->time) - { return; - } if (player->m_iRadioMessages <= 0) - { return; - } player->m_iRadioMessages--; player->m_flRadioTime = gpGlobals->time + 1.5f; @@ -2370,93 +1983,29 @@ void Radio3(CBasePlayer *player, int slot) bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney) { - int cost; - const char *classname; - if (!player->CanPlayerBuy(true)) - { return false; - } // Ensure that the weapon uses ammo int nAmmo = weapon->PrimaryAmmoIndex(); if (nAmmo == -1) - { return false; - } // Can only buy if the player does not already have full ammo if (player->m_rgAmmo[ nAmmo ] >= weapon->iMaxAmmo1()) - { return false; - } - switch (weapon->m_iId) - { - case WEAPON_AWP: - cost = AMMO_338MAG_PRICE; - classname = "ammo_338magnum"; - break; - case WEAPON_SCOUT: - case WEAPON_G3SG1: - case WEAPON_AK47: - cost = AMMO_762MM_PRICE; - classname = "ammo_762nato"; - break; - case WEAPON_XM1014: - case WEAPON_M3: - cost = AMMO_BUCKSHOT_PRICE; - classname = "ammo_buckshot"; - break; - case WEAPON_MAC10: - case WEAPON_UMP45: - case WEAPON_USP: - cost = AMMO_45ACP_PRICE; - classname = "ammo_45acp"; - break; - case WEAPON_M249: - cost = AMMO_556MM_PRICE; - classname = "ammo_556natobox"; - break; - case WEAPON_FIVESEVEN: - case WEAPON_P90: - cost = AMMO_57MM_PRICE; - classname = "ammo_57mm"; - break; - case WEAPON_ELITE: - case WEAPON_GLOCK18: - case WEAPON_MP5N: - case WEAPON_TMP: - cost = AMMO_9MM_PRICE; - classname = "ammo_9mm"; - break; - case WEAPON_DEAGLE: - cost = AMMO_50AE_PRICE; - classname = "ammo_50ae"; - break; - case WEAPON_P228: - cost = AMMO_357SIG_PRICE; - classname = "ammo_357sig"; - break; - case WEAPON_AUG: - case WEAPON_SG550: - case WEAPON_GALIL: - case WEAPON_FAMAS: - case WEAPON_M4A1: - case WEAPON_SG552: - cost = AMMO_556MM_PRICE; - classname = "ammo_556nato"; - break; - default: + WeaponInfoStruct *info = GetWeaponInfo(weapon->m_iId); + if (info == nullptr) { ALERT(at_console, "Tried to buy ammo for an unrecognized gun\n"); return false; } // Purchase the ammo if the player has enough money - if (player->m_iAccount >= cost) + if (player->m_iAccount >= info->clipCost) { - player->GiveNamedItem(classname); - player->AddAccount(-cost); + player->GiveNamedItem(info->ammoName); + player->AddAccount(-info->clipCost); return true; } @@ -2466,7 +2015,7 @@ bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney) { // Not enough money.. let the player know ClientPrint(player->pev, HUD_PRINTCENTER, "#Not_Enough_Money"); - BlinkAccount(player, 2); + BlinkAccount(player); } } @@ -2476,19 +2025,15 @@ bool BuyGunAmmo(CBasePlayer *player, CBasePlayerItem *weapon, bool bBlinkMoney) bool BuyAmmo(CBasePlayer *player, int nSlot, bool bBlinkMoney) { if (!player->CanPlayerBuy(true)) - { return false; - } if (nSlot < PRIMARY_WEAPON_SLOT || nSlot > PISTOL_SLOT) - { return false; - } // Buy one ammo clip for all weapons in the given slot // - // nSlot == 1 : Primary weapons - // nSlot == 2 : Secondary weapons + // nSlot == 1 : Primary weapons + // nSlot == 2 : Secondary weapons CBasePlayerItem *pItem = player->m_rgpPlayerItems[ nSlot ]; @@ -2701,117 +2246,50 @@ BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand) return bRetVal; } +struct RadioStruct +{ + int slot; + void (*func)(CBasePlayer *, int); + const char *alias; + +} radioInfo[] = { + { 1, Radio1, "coverme" }, + { 2, Radio1, "takepoint" }, + { 3, Radio1, "holdpos" }, + { 4, Radio1, "regroup" }, + { 5, Radio1, "followme" }, + { 6, Radio1, "takingfire" }, + + { 1, Radio2, "go" }, + { 2, Radio2, "fallback" }, + { 3, Radio2, "sticktog" }, + { 4, Radio2, "getinpos" }, + { 5, Radio2, "stormfront" }, + { 6, Radio2, "report" }, + + { 1, Radio3, "roger" }, + { 2, Radio3, "enemyspot" }, + { 3, Radio3, "needbackup" }, + { 4, Radio3, "sectorclear" }, + { 5, Radio3, "inposition" }, + { 6, Radio3, "reportingin" }, + { 7, Radio3, "getout" }, + { 8, Radio3, "negative" }, + { 9, Radio3, "enemydown" }, +}; + BOOL HandleRadioAliasCommands(CBasePlayer *pPlayer, const char *pszCommand) { - BOOL bRetVal = FALSE; - - if (FStrEq(pszCommand, "coverme")) + for (auto& radio : radioInfo) { - bRetVal = TRUE; - Radio1(pPlayer, 1); - } - else if (FStrEq(pszCommand, "takepoint")) - { - bRetVal = TRUE; - Radio1(pPlayer, 2); - } - else if (FStrEq(pszCommand, "holdpos")) - { - bRetVal = TRUE; - Radio1(pPlayer, 3); - } - else if (FStrEq(pszCommand, "regroup")) - { - bRetVal = TRUE; - Radio1(pPlayer, 4); - } - else if (FStrEq(pszCommand, "followme")) - { - bRetVal = TRUE; - Radio1(pPlayer, 5); - } - else if (FStrEq(pszCommand, "takingfire")) - { - bRetVal = TRUE; - Radio1(pPlayer, 6); - } - else if (FStrEq(pszCommand, "go")) - { - bRetVal = TRUE; - Radio2(pPlayer, 1); - } - else if (FStrEq(pszCommand, "fallback")) - { - bRetVal = TRUE; - Radio2(pPlayer, 2); - } - else if (FStrEq(pszCommand, "sticktog")) - { - bRetVal = TRUE; - Radio2(pPlayer, 3); - } - else if (FStrEq(pszCommand, "getinpos")) - { - bRetVal = TRUE; - Radio2(pPlayer, 4); - } - else if (FStrEq(pszCommand, "stormfront")) - { - bRetVal = TRUE; - Radio2(pPlayer, 5); - } - else if (FStrEq(pszCommand, "report")) - { - bRetVal = TRUE; - Radio2(pPlayer, 6); - } - else if (FStrEq(pszCommand, "roger")) - { - bRetVal = TRUE; - Radio3(pPlayer, 1); - } - else if (FStrEq(pszCommand, "enemyspot")) - { - bRetVal = TRUE; - Radio3(pPlayer, 2); - } - else if (FStrEq(pszCommand, "needbackup")) - { - bRetVal = TRUE; - Radio3(pPlayer, 3); - } - else if (FStrEq(pszCommand, "sectorclear")) - { - bRetVal = TRUE; - Radio3(pPlayer, 4); - } - else if (FStrEq(pszCommand, "inposition")) - { - bRetVal = TRUE; - Radio3(pPlayer, 5); - } - else if (FStrEq(pszCommand, "reportingin")) - { - bRetVal = TRUE; - Radio3(pPlayer, 6); - } - else if (FStrEq(pszCommand, "getout")) - { - bRetVal = TRUE; - Radio3(pPlayer, 7); - } - else if (FStrEq(pszCommand, "negative")) - { - bRetVal = TRUE; - Radio3(pPlayer, 8); - } - else if (FStrEq(pszCommand, "enemydown")) - { - bRetVal = TRUE; - Radio3(pPlayer, 9); + if (FStrEq(pszCommand, radio.alias)) + { + radio.func(pPlayer, radio.slot); + return TRUE; + } } - return bRetVal; + return FALSE; } // Use CMD_ARGV, CMD_ARGV, and CMD_ARGC to get pointers the character string command. diff --git a/regamedll/dlls/client.h b/regamedll/dlls/client.h index 77098243..9c46ad0e 100644 --- a/regamedll/dlls/client.h +++ b/regamedll/dlls/client.h @@ -115,7 +115,7 @@ int CMD_ARGC_(); const char *CMD_ARGV_(int i); void set_suicide_frame(entvars_t *pev); void TeamChangeUpdate(CBasePlayer *player, int team_id); -void BlinkAccount(CBasePlayer *player, int numBlinks); +void BlinkAccount(CBasePlayer *player, 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); @@ -191,4 +191,19 @@ void CreateInstancedBaselines(); int InconsistentFile(const edict_t *player, const char *filename, char *disconnect_message); int AllowLagCompensation(); +inline const char *GetTeamName(int team) +{ + switch (team) + { + case CT: + return "CT"; + case TERRORIST: + return "TERRORIST"; + case SPECTATOR: + return "SPECTATOR"; + default: + return "UNASSIGNED"; + } +} + #endif // CLIENT_H diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index d8f0d8bc..a55ab2ad 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -3264,21 +3264,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(InitHUD)(CBasePlayer *pl) { MESSAGE_BEGIN(MSG_ONE, gmsgTeamInfo, NULL, pl->edict()); WRITE_BYTE(plr->entindex()); - switch (plr->m_iTeam) - { - case CT: - WRITE_STRING("CT"); - break; - case TERRORIST: - WRITE_STRING("TERRORIST"); - break; - case SPECTATOR: - WRITE_STRING("SPECTATOR"); - break; - default: - WRITE_STRING("UNASSIGNED"); - break; - } + WRITE_STRING(GetTeamName(plr->m_iTeam)); MESSAGE_END(); plr->SetScoreboardAttributes(pl); diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 75700a60..4caa753d 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -3335,21 +3335,7 @@ void CBasePlayer::JoiningThink() MESSAGE_BEGIN(MSG_ALL, gmsgTeamInfo); WRITE_BYTE(entindex()); - switch (m_iTeam) - { - case CT: - WRITE_STRING("CT"); - break; - case TERRORIST: - WRITE_STRING("TERRORIST"); - break; - case SPECTATOR: - WRITE_STRING("SPECTATOR"); - break; - default: - WRITE_STRING("UNASSIGNED"); - break; - } + WRITE_STRING(GetTeamName(m_iTeam)); MESSAGE_END(); MESSAGE_BEGIN(MSG_ALL, gmsgLocation); @@ -5340,21 +5326,7 @@ void CBasePlayer::__API_VHOOK(Spawn)() MESSAGE_BEGIN(MSG_ALL, gmsgTeamInfo); WRITE_BYTE(entindex()); - switch (m_iTeam) - { - case CT: - WRITE_STRING("CT"); - break; - case TERRORIST: - WRITE_STRING("TERRORIST"); - break; - case SPECTATOR: - WRITE_STRING("SPECTATOR"); - break; - default: - WRITE_STRING("UNASSIGNED"); - break; - } + WRITE_STRING(GetTeamName(m_iTeam)); MESSAGE_END(); UpdateLocation(true); @@ -7482,21 +7454,7 @@ void CBasePlayer::SwitchTeam() MESSAGE_BEGIN(MSG_ALL, gmsgTeamInfo); WRITE_BYTE(entindex()); - switch (m_iTeam) - { - case CT: - WRITE_STRING("CT"); - break; - case TERRORIST: - WRITE_STRING("TERRORIST"); - break; - case SPECTATOR: - WRITE_STRING("SPECTATOR"); - break; - default: - WRITE_STRING("UNASSIGNED"); - break; - } + WRITE_STRING(GetTeamName(m_iTeam)); MESSAGE_END(); if (TheBots != NULL) diff --git a/regamedll/dlls/util.cpp b/regamedll/dlls/util.cpp index c96bd90c..4503fc7c 100644 --- a/regamedll/dlls/util.cpp +++ b/regamedll/dlls/util.cpp @@ -421,7 +421,7 @@ CBaseEntity *EXT_FUNC UTIL_FindEntityByString(CBaseEntity *pStartEntity, const c startEntityIndex = ENTINDEX(pentEntity); - //it best each entity list + // it best each entity list if (*szKeyword == 'c') { int hash; diff --git a/regamedll/dlls/util.h b/regamedll/dlls/util.h index 8eaed07b..0a036f97 100644 --- a/regamedll/dlls/util.h +++ b/regamedll/dlls/util.h @@ -202,7 +202,7 @@ inline BOOL FNullEnt(EOFFSET eoffset) { return (eoffset == 0); } inline BOOL FNullEnt(entvars_t *pev) { return (pev == NULL || FNullEnt(OFFSET(pev))); } inline BOOL FNullEnt(const edict_t *pent) { return (pent == NULL || FNullEnt(OFFSET(pent))); } inline BOOL FStringNull(int iString) { return (iString == iStringNull); } -inline BOOL FStrEq(const char *sz1, const char *sz2) { return (strcmp(sz1, sz2) == 0); } +inline BOOL FStrEq(const char *sz1, const char *sz2) { return (Q_strcmp(sz1, sz2) == 0); } inline BOOL FClassnameIs(entvars_t *pev, const char *szClassname) { return FStrEq(STRING(pev->classname), szClassname); } inline BOOL FClassnameIs(edict_t *pent, const char *szClassname) { return FStrEq(STRING(VARS(pent)->classname), szClassname); } inline void UTIL_MakeVectorsPrivate(Vector vecAngles, float *p_vForward, float *p_vRight, float *p_vUp) { g_engfuncs.pfnAngleVectors(vecAngles, p_vForward, p_vRight, p_vUp); } diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 00d5f2eb..d89ae482 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -63,27 +63,32 @@ MULTIDAMAGE gMultiDamage; // MaxAmmoCarry - pass in a name and this function will tell // you the maximum amount of that type of ammunition that a // player can carry. -int MaxAmmoCarry(int iszName) +int MaxAmmoCarry(const char *szName) { for (int i = 0; i < MAX_WEAPONS; ++i) { ItemInfo *info = &IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[ i ]; - if (info->pszAmmo1 && !Q_strcmp(STRING(iszName), info->pszAmmo1)) + if (info->pszAmmo1 && !Q_strcmp(szName, info->pszAmmo1)) { return info->iMaxAmmo1; } - if (info->pszAmmo2 && !Q_strcmp(STRING(iszName), info->pszAmmo2)) + if (info->pszAmmo2 && !Q_strcmp(szName, info->pszAmmo2)) { return info->iMaxAmmo2; } } - ALERT(at_console, "MaxAmmoCarry() doesn't recognize '%s'!\n", STRING(iszName)); + ALERT(at_console, "MaxAmmoCarry() doesn't recognize '%s'!\n", szName); return -1; } +int MaxAmmoCarry(int iszName) +{ + return MaxAmmoCarry(STRING(iszName)); +} + // ClearMultiDamage - resets the global multi damage accumulator void ClearMultiDamage() { @@ -309,7 +314,9 @@ 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))); + giAmmoIndex = 0; + WeaponInfoReset(); // custom items... @@ -2002,6 +2009,29 @@ void CWeaponBox::__MAKE_VHOOK(SetObjectCollisionBox)() pev->absmax = pev->origin + Vector(16, 16, 16); } +char *armouryItemModels[] = { + "models/w_mp5.mdl", + "models/w_tmp.mdl", + "models/w_p90.mdl", + "models/w_mac10.mdl", + "models/w_ak47.mdl", + "models/w_sg552.mdl", + "models/w_m4a1.mdl", + "models/w_aug.mdl", + "models/w_scout.mdl", + "models/w_g3sg1.mdl", + "models/w_awp.mdl", + "models/w_m3.mdl", + "models/w_xm1014.mdl", + "models/w_m249.mdl", + "models/w_flashbang.mdl", + "models/w_hegrenade.mdl", + "models/w_kevlar.mdl", + "models/w_assault.mdl", + "models/w_smokegrenade.mdl", + "models/w_kevlar.mdl", +}; + void CArmoury::__MAKE_VHOOK(Spawn)() { Precache(); @@ -2010,31 +2040,9 @@ void CArmoury::__MAKE_VHOOK(Spawn)() UTIL_SetSize(pev, Vector(-16, -16, 0), Vector(16, 16, 16)); UTIL_SetOrigin(pev, pev->origin); - SetTouch(&CArmoury::ArmouryTouch); - switch (m_iItem) - { - case ARMOURY_MP5NAVY: SET_MODEL(ENT(pev), "models/w_mp5.mdl"); break; - case ARMOURY_TMP: SET_MODEL(ENT(pev), "models/w_tmp.mdl"); break; - case ARMOURY_P90: SET_MODEL(ENT(pev), "models/w_p90.mdl"); break; - case ARMOURY_MAC10: SET_MODEL(ENT(pev), "models/w_mac10.mdl"); break; - case ARMOURY_AK47: SET_MODEL(ENT(pev), "models/w_ak47.mdl"); break; - case ARMOURY_SG552: SET_MODEL(ENT(pev), "models/w_sg552.mdl"); break; - case ARMOURY_M4A1: SET_MODEL(ENT(pev), "models/w_m4a1.mdl"); break; - case ARMOURY_AUG: SET_MODEL(ENT(pev), "models/w_aug.mdl"); break; - case ARMOURY_SCOUT: SET_MODEL(ENT(pev), "models/w_scout.mdl"); break; - case ARMOURY_G3SG1: SET_MODEL(ENT(pev), "models/w_g3sg1.mdl"); break; - case ARMOURY_AWP: SET_MODEL(ENT(pev), "models/w_awp.mdl"); break; - case ARMOURY_M3: SET_MODEL(ENT(pev), "models/w_m3.mdl"); break; - case ARMOURY_XM1014: SET_MODEL(ENT(pev), "models/w_xm1014.mdl"); break; - case ARMOURY_M249: SET_MODEL(ENT(pev), "models/w_m249.mdl"); break; - case ARMOURY_FLASHBANG: SET_MODEL(ENT(pev), "models/w_flashbang.mdl"); break; - case ARMOURY_HEGRENADE: SET_MODEL(ENT(pev), "models/w_hegrenade.mdl"); break; - case ARMOURY_KEVLAR: SET_MODEL(ENT(pev), "models/w_kevlar.mdl"); break; - case ARMOURY_ASSAULT: SET_MODEL(ENT(pev), "models/w_assault.mdl"); break; - case ARMOURY_SMOKEGRENADE: SET_MODEL(ENT(pev), "models/w_smokegrenade.mdl"); break; - default: SET_MODEL(ENT(pev), "models/w_kevlar.mdl"); break; - } + SetTouch(&CArmoury::ArmouryTouch); + SET_MODEL(ENT(pev), armouryItemModels[m_iItem]); if (m_iCount <= 0) { @@ -2100,31 +2108,32 @@ void CArmoury::__MAKE_VHOOK(Restart)() void CArmoury::__MAKE_VHOOK(Precache)() { - switch (m_iItem) - { - case ARMOURY_MP5NAVY: PRECACHE_MODEL("models/w_mp5.mdl"); break; - case ARMOURY_TMP: PRECACHE_MODEL("models/w_tmp.mdl"); break; - case ARMOURY_P90: PRECACHE_MODEL("models/w_p90.mdl"); break; - case ARMOURY_MAC10: PRECACHE_MODEL("models/w_mac10.mdl"); break; - case ARMOURY_AK47: PRECACHE_MODEL("models/w_ak47.mdl"); break; - case ARMOURY_SG552: PRECACHE_MODEL("models/w_sg552.mdl"); break; - case ARMOURY_M4A1: PRECACHE_MODEL("models/w_m4a1.mdl"); break; - case ARMOURY_AUG: PRECACHE_MODEL("models/w_aug.mdl"); break; - case ARMOURY_SCOUT: PRECACHE_MODEL("models/w_scout.mdl"); break; - case ARMOURY_G3SG1: PRECACHE_MODEL("models/w_g3sg1.mdl"); break; - case ARMOURY_AWP: PRECACHE_MODEL("models/w_awp.mdl"); break; - case ARMOURY_M3: PRECACHE_MODEL("models/w_m3.mdl"); break; - case ARMOURY_XM1014: PRECACHE_MODEL("models/w_xm1014.mdl"); break; - case ARMOURY_M249: PRECACHE_MODEL("models/w_m249.mdl"); break; - case ARMOURY_FLASHBANG: PRECACHE_MODEL("models/w_flashbang.mdl"); break; - case ARMOURY_HEGRENADE: PRECACHE_MODEL("models/w_hegrenade.mdl"); break; - case ARMOURY_KEVLAR: PRECACHE_MODEL("models/w_kevlar.mdl"); break; - case ARMOURY_ASSAULT: PRECACHE_MODEL("models/w_assault.mdl"); break; - case ARMOURY_SMOKEGRENADE: PRECACHE_MODEL("models/w_smokegrenade.mdl"); break; - default: PRECACHE_MODEL("models/w_kevlar.mdl"); break; - } + PRECACHE_MODEL(armouryItemModels[m_iItem]); } +struct ArmouryItemStruct +{ + const char *entityName; + char *ammoName; + int giveAmount; + MaxAmmoType maxRounds; +} armouryItemInfo[] = { + { "weapon_mp5navy", "9mm", 60, MAX_AMMO_9MM }, // ARMOURY_MP5NAVY + { "weapon_tmp", "9mm", 60, MAX_AMMO_9MM }, // ARMOURY_TMP + { "weapon_p90", "57mm", 50, MAX_AMMO_57MM }, // ARMOURY_P90 + { "weapon_mac10", "45acp", 60, MAX_AMMO_45ACP }, // ARMOURY_MAC10 + { "weapon_ak47", "762Nato", 60, MAX_AMMO_762NATO }, // ARMOURY_AK47 + { "weapon_sg552", "556Nato", 60, MAX_AMMO_556NATO }, // ARMOURY_SG552 + { "weapon_m4a1", "556Nato", 60, MAX_AMMO_556NATO }, // ARMOURY_M4A1 + { "weapon_aug", "556Nato", 60, MAX_AMMO_556NATO }, // ARMOURY_AUG + { "weapon_scout", "762Nato", 30, MAX_AMMO_762NATO }, // ARMOURY_SCOUT + { "weapon_g3sg1", "762Nato", 30, MAX_AMMO_762NATO }, // ARMOURY_G3SG1 + { "weapon_awp", "338Magnum", 20, MAX_AMMO_338MAGNUM }, // ARMOURY_AWP + { "weapon_m3", "buckshot", 24, MAX_AMMO_BUCKSHOT }, // ARMOURY_M3 + { "weapon_xm1014", "buckshot", 24, MAX_AMMO_BUCKSHOT }, // ARMOURY_XM1014 + { "weapon_m249", "556NatoBox", 60, MAX_AMMO_556NATOBOX }, // ARMOURY_M249 +}; + void CArmoury::ArmouryTouch(CBaseEntity *pOther) { if (!pOther->IsPlayer()) @@ -2135,80 +2144,26 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther) if (p->m_bIsVIP) return; + // weapons if (m_iCount > 0 && m_iItem <= ARMOURY_M249) { if (p->m_bHasPrimary) return; m_iCount--; + auto item = &armouryItemInfo[m_iItem]; - switch (m_iItem) - { - case ARMOURY_MP5NAVY: - p->GiveNamedItem("weapon_mp5navy"); - p->GiveAmmo(60, "9mm", MAX_AMMO_9MM); - break; - case ARMOURY_TMP: - p->GiveNamedItem("weapon_tmp"); - p->GiveAmmo(60, "9mm", MAX_AMMO_9MM); - break; - case ARMOURY_P90: - p->GiveNamedItem("weapon_p90"); - p->GiveAmmo(50, "57mm", MAX_AMMO_57MM); - break; - case ARMOURY_MAC10: - p->GiveNamedItem("weapon_mac10"); - p->GiveAmmo(60, "45acp", MAX_AMMO_45ACP); - break; - case ARMOURY_AK47: - p->GiveNamedItem("weapon_ak47"); - p->GiveAmmo(60, "762Nato", MAX_AMMO_762NATO); - break; - case ARMOURY_SG552: - p->GiveNamedItem("weapon_sg552"); - p->GiveAmmo(60, "556Nato", MAX_AMMO_556NATO); - break; - case ARMOURY_M4A1: - p->GiveNamedItem("weapon_m4a1"); - p->GiveAmmo(60, "556Nato", MAX_AMMO_556NATO); - break; - case ARMOURY_AUG: - p->GiveNamedItem("weapon_aug"); - p->GiveAmmo(60, "556Nato", MAX_AMMO_556NATO); - break; - case ARMOURY_SCOUT: - p->GiveNamedItem("weapon_scout"); - p->GiveAmmo(30, "762Nato", MAX_AMMO_762NATO); - break; - case ARMOURY_G3SG1: - p->GiveNamedItem("weapon_g3sg1"); - p->GiveAmmo(30, "762Nato", MAX_AMMO_762NATO); - break; - case ARMOURY_AWP: - p->GiveNamedItem("weapon_awp"); - p->GiveAmmo(20, "338Magnum", MAX_AMMO_338MAGNUM); - break; - case ARMOURY_M3: - p->GiveNamedItem("weapon_m3"); - p->GiveAmmo(24, "buckshot", MAX_AMMO_BUCKSHOT); - break; - case ARMOURY_XM1014: - p->GiveNamedItem("weapon_xm1014"); - p->GiveAmmo(24, "buckshot", MAX_AMMO_BUCKSHOT); - break; - case ARMOURY_M249: - p->GiveNamedItem("weapon_m249"); - p->GiveAmmo(60, "556NatoBox", MAX_AMMO_556NATOBOX); - break; - } + p->GiveNamedItem(item->entityName); + p->GiveAmmo(item->giveAmount, item->ammoName, item->maxRounds); } + // items & grenades else if (m_iCount > 0 && m_iItem >= ARMOURY_FLASHBANG) { switch (m_iItem) { case ARMOURY_FLASHBANG: { - if (p->AmmoInventory(p->GetAmmoIndex("Flashbang")) >= 2) + if (p->AmmoInventory(p->GetAmmoIndex("Flashbang")) >= MaxAmmoCarry("Flashbang")) return; p->GiveNamedItem("weapon_flashbang"); @@ -2217,7 +2172,7 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther) } case ARMOURY_HEGRENADE: { - if (p->AmmoInventory(p->GetAmmoIndex("HEGrenade")) >= 1) + if (p->AmmoInventory(p->GetAmmoIndex("HEGrenade")) >= MaxAmmoCarry("HEGrenade")) return; p->GiveNamedItem("weapon_hegrenade"); @@ -2244,7 +2199,7 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther) } case ARMOURY_SMOKEGRENADE: { - if (p->AmmoInventory(p->GetAmmoIndex("SmokeGrenade")) >= 1) + if (p->AmmoInventory(p->GetAmmoIndex("SmokeGrenade")) >= MaxAmmoCarry("SmokeGrenade")) return; p->GiveNamedItem("weapon_smokegrenade"); diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index 0dd74648..db737329 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -95,6 +95,7 @@ enum ArmouryItemPack ARMOURY_KEVLAR, ARMOURY_ASSAULT, ARMOURY_SMOKEGRENADE, + ARMOURY_END }; struct ItemInfo @@ -1840,6 +1841,8 @@ void FindHullIntersection(const Vector &vecSrc, TraceResult &tr, float *mins, fl void AnnounceFlashInterval(float interval, float offset = 0); int MaxAmmoCarry(int iszName); +int MaxAmmoCarry(const char *szName); + void ClearMultiDamage(); void ApplyMultiDamage(entvars_t *pevInflictor, entvars_t *pevAttacker); void AddMultiDamage(entvars_t *pevInflictor, CBaseEntity *pEntity, float flDamage, int bitsDamageType); diff --git a/regamedll/dlls/weapontype.cpp b/regamedll/dlls/weapontype.cpp index b5a286ae..8e41a274 100644 --- a/regamedll/dlls/weapontype.cpp +++ b/regamedll/dlls/weapontype.cpp @@ -224,35 +224,36 @@ WeaponClassAliasInfo weaponClassAliasInfo[] = { NULL, WEAPONCLASS_NONE } }; -WeaponInfoStruct weaponInfo[] = +WeaponInfoStruct weaponInfo[27]; +WeaponInfoStruct weaponInfo_default[] = { - { WEAPON_P228, P228_PRICE, AMMO_357SIG_PRICE, AMMO_357SIG_BUY, P228_MAX_CLIP, MAX_AMMO_357SIG, AMMO_357SIG, "weapon_p228" }, - { WEAPON_GLOCK, GLOCK18_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, GLOCK18_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_glock18" }, - { WEAPON_GLOCK18, GLOCK18_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, GLOCK18_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_glock18" }, - { WEAPON_SCOUT, SCOUT_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, SCOUT_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_scout" }, - { WEAPON_XM1014, XM1014_PRICE, AMMO_BUCKSHOT_PRICE, AMMO_BUCKSHOT_BUY, XM1014_MAX_CLIP, MAX_AMMO_BUCKSHOT, AMMO_BUCKSHOT, "weapon_xm1014" }, - { WEAPON_MAC10, MAC10_PRICE, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, MAC10_MAX_CLIP, MAX_AMMO_45ACP, AMMO_45ACP, "weapon_mac10" }, - { WEAPON_AUG, AUG_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, AUG_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_aug" }, - { WEAPON_ELITE, ELITE_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, ELITE_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_elite" }, - { WEAPON_FIVESEVEN, FIVESEVEN_PRICE, AMMO_57MM_PRICE, AMMO_57MM_BUY, FIVESEVEN_MAX_CLIP, MAX_AMMO_57MM, AMMO_57MM, "weapon_fiveseven" }, - { WEAPON_UMP45, UMP45_PRICE, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, UMP45_MAX_CLIP, MAX_AMMO_45ACP, AMMO_45ACP, "weapon_ump45" }, - { WEAPON_SG550, SG550_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, SG550_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_sg550" }, - { WEAPON_GALIL, GALIL_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, GALIL_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_galil" }, - { WEAPON_FAMAS, FAMAS_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, FAMAS_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_famas" }, - { WEAPON_USP, USP_PRICE, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, USP_MAX_CLIP, MAX_AMMO_45ACP, AMMO_45ACP, "weapon_usp" }, - { WEAPON_AWP, AWP_PRICE, AMMO_338MAG_PRICE, AMMO_338MAG_BUY, AWP_MAX_CLIP, MAX_AMMO_338MAGNUM, AMMO_338MAGNUM, "weapon_awp" }, - { WEAPON_MP5N, MP5NAVY_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, MP5N_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_mp5navy" }, - { WEAPON_M249, M249_PRICE, AMMO_556MM_PRICE, AMMO_556NATOBOX_BUY, M249_MAX_CLIP, MAX_AMMO_556NATOBOX, AMMO_556NATOBOX, "weapon_m249" }, - { WEAPON_M3, M3_PRICE, AMMO_BUCKSHOT_PRICE, AMMO_BUCKSHOT_BUY, M3_MAX_CLIP, MAX_AMMO_BUCKSHOT, AMMO_BUCKSHOT, "weapon_m3" }, - { WEAPON_M4A1, M4A1_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, M4A1_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_m4a1" }, - { WEAPON_TMP, TMP_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, TMP_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_tmp" }, - { WEAPON_G3SG1, G3SG1_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, G3SG1_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_g3sg1" }, - { WEAPON_DEAGLE, DEAGLE_PRICE, AMMO_50AE_PRICE, AMMO_50AE_BUY, DEAGLE_MAX_CLIP, MAX_AMMO_50AE, AMMO_50AE, "weapon_deagle" }, - { WEAPON_SG552, SG552_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, SG552_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_sg552" }, - { WEAPON_AK47, AK47_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, AK47_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_ak47" }, - { WEAPON_P90, P90_PRICE, AMMO_57MM_PRICE, AMMO_57MM_BUY, P90_MAX_CLIP, MAX_AMMO_57MM, AMMO_57MM, "weapon_p90" }, - { WEAPON_SHIELDGUN, SHIELDGUN_PRICE, 0, 0, 0, 0, -1, NULL }, - { 0, 0, 0, 0, 0, 0, -1, NULL } + { WEAPON_P228, P228_PRICE, AMMO_357SIG_PRICE, AMMO_357SIG_BUY, P228_MAX_CLIP, MAX_AMMO_357SIG, AMMO_357SIG, "weapon_p228", "ammo_357sig" }, + { WEAPON_GLOCK, GLOCK18_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, GLOCK18_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_glock18", "ammo_9mm" }, + { WEAPON_GLOCK18, GLOCK18_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, GLOCK18_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_glock18", "ammo_9mm" }, + { WEAPON_SCOUT, SCOUT_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, SCOUT_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_scout", "ammo_762nato" }, + { WEAPON_XM1014, XM1014_PRICE, AMMO_BUCKSHOT_PRICE, AMMO_BUCKSHOT_BUY, XM1014_MAX_CLIP, MAX_AMMO_BUCKSHOT, AMMO_BUCKSHOT, "weapon_xm1014", "ammo_buckshot" }, + { WEAPON_MAC10, MAC10_PRICE, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, MAC10_MAX_CLIP, MAX_AMMO_45ACP, AMMO_45ACP, "weapon_mac10", "ammo_45acp" }, + { WEAPON_AUG, AUG_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, AUG_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_aug", "ammo_556nato" }, + { WEAPON_ELITE, ELITE_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, ELITE_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_elite", "ammo_ammo_9mm" }, + { WEAPON_FIVESEVEN, FIVESEVEN_PRICE, AMMO_57MM_PRICE, AMMO_57MM_BUY, FIVESEVEN_MAX_CLIP, MAX_AMMO_57MM, AMMO_57MM, "weapon_fiveseven", "ammo_57mm" }, + { WEAPON_UMP45, UMP45_PRICE, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, UMP45_MAX_CLIP, MAX_AMMO_45ACP, AMMO_45ACP, "weapon_ump45", "ammo_45acp" }, + { WEAPON_SG550, SG550_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, SG550_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_sg550", "ammo_556nato" }, + { WEAPON_GALIL, GALIL_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, GALIL_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_galil", "ammo_556nato" }, + { WEAPON_FAMAS, FAMAS_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, FAMAS_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_famas", "ammo_556nato" }, + { WEAPON_USP, USP_PRICE, AMMO_45ACP_PRICE, AMMO_45ACP_BUY, USP_MAX_CLIP, MAX_AMMO_45ACP, AMMO_45ACP, "weapon_usp", "ammo_45acp" }, + { WEAPON_AWP, AWP_PRICE, AMMO_338MAG_PRICE, AMMO_338MAG_BUY, AWP_MAX_CLIP, MAX_AMMO_338MAGNUM, AMMO_338MAGNUM, "weapon_awp", "ammo_338magnum" }, + { WEAPON_MP5N, MP5NAVY_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, MP5N_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_mp5navy", "ammo_9mm" }, + { WEAPON_M249, M249_PRICE, AMMO_556MM_PRICE, AMMO_556NATOBOX_BUY, M249_MAX_CLIP, MAX_AMMO_556NATOBOX, AMMO_556NATOBOX, "weapon_m249", "ammo_556natobox" }, + { WEAPON_M3, M3_PRICE, AMMO_BUCKSHOT_PRICE, AMMO_BUCKSHOT_BUY, M3_MAX_CLIP, MAX_AMMO_BUCKSHOT, AMMO_BUCKSHOT, "weapon_m3", "ammo_buckshot" }, + { WEAPON_M4A1, M4A1_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, M4A1_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_m4a1", "ammo_556nato" }, + { WEAPON_TMP, TMP_PRICE, AMMO_9MM_PRICE, AMMO_9MM_BUY, TMP_MAX_CLIP, MAX_AMMO_9MM, AMMO_9MM, "weapon_tmp", "ammo_9mm" }, + { WEAPON_G3SG1, G3SG1_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, G3SG1_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_g3sg1", "ammo_762nato" }, + { WEAPON_DEAGLE, DEAGLE_PRICE, AMMO_50AE_PRICE, AMMO_50AE_BUY, DEAGLE_MAX_CLIP, MAX_AMMO_50AE, AMMO_50AE, "weapon_deagle", "ammo_50ae" }, + { WEAPON_SG552, SG552_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, SG552_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_sg552", "ammo_556nato" }, + { WEAPON_AK47, AK47_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, AK47_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_ak47", "ammo_762nato" }, + { WEAPON_P90, P90_PRICE, AMMO_57MM_PRICE, AMMO_57MM_BUY, P90_MAX_CLIP, MAX_AMMO_57MM, AMMO_57MM, "weapon_p90", "ammo_57mm" }, + { WEAPON_SHIELDGUN, SHIELDGUN_PRICE, 0, 0, 0, 0, AMMO_NONE, nullptr, nullptr }, + { 0, 0, 0, 0, 0, 0, AMMO_NONE, nullptr, nullptr } }; #endif // HOOK_GAMEDLL @@ -383,6 +384,13 @@ WeaponInfoStruct *EXT_FUNC GetWeaponInfo(int weaponID) return NULL; } +void WeaponInfoReset() +{ +#ifndef HOOK_GAMEDLL + Q_memcpy(weaponInfo, weaponInfo_default, sizeof(weaponInfo)); +#endif +} + bool CanBuyWeaponByMaptype(int playerTeam, WeaponIdType weaponID, bool useAssasinationRestrictions) { if (useAssasinationRestrictions) diff --git a/regamedll/dlls/weapontype.h b/regamedll/dlls/weapontype.h index b230be3b..5c591769 100644 --- a/regamedll/dlls/weapontype.h +++ b/regamedll/dlls/weapontype.h @@ -256,6 +256,7 @@ enum MaxAmmoType enum AmmoType { + AMMO_NONE = -1, AMMO_BUCKSHOT, AMMO_9MM, AMMO_556NATO, @@ -402,12 +403,17 @@ struct WeaponInfoStruct int buyClipSize; int gunClipSize; int maxRounds; - int ammoType; + AmmoType ammoType; char *entityName; + +#ifndef HOOK_GAMEDLL + const char *ammoName; +#endif }; extern AutoBuyInfoStruct g_autoBuyInfo[35]; extern WeaponStruct g_weaponStruct[MAX_WEAPONS]; +extern WeaponInfoStruct weaponInfo[27]; // WeaponType WeaponIdType AliasToWeaponID(const char *alias); @@ -419,5 +425,6 @@ bool IsPrimaryWeapon(int id); bool IsSecondaryWeapon(int id); WeaponInfoStruct *GetWeaponInfo(int weaponID); bool CanBuyWeaponByMaptype(int playerTeam, WeaponIdType weaponID, bool useAssasinationRestrictions); +void WeaponInfoReset(); #endif // WEAPONTYPE_H diff --git a/regamedll/extra/cssdk/dlls/regamedll_api.h b/regamedll/extra/cssdk/dlls/regamedll_api.h index dda1fc29..716c5f12 100644 --- a/regamedll/extra/cssdk/dlls/regamedll_api.h +++ b/regamedll/extra/cssdk/dlls/regamedll_api.h @@ -246,7 +246,6 @@ struct ReGameFuncs_t { void (*EndRoundMessage)(const char *sentence, int event); class CBaseEntity *(*UTIL_FindEntityByString)(class CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue); - struct WeaponInfoStruct *(*GetWeaponInfo)(int weaponID); }; class IReGameApi { diff --git a/regamedll/extra/cssdk/dlls/weapons.h b/regamedll/extra/cssdk/dlls/weapons.h index 0859569e..a34ae55a 100644 --- a/regamedll/extra/cssdk/dlls/weapons.h +++ b/regamedll/extra/cssdk/dlls/weapons.h @@ -90,6 +90,7 @@ enum ArmouryItemPack ARMOURY_KEVLAR, ARMOURY_ASSAULT, ARMOURY_SMOKEGRENADE, + ARMOURY_END }; struct ItemInfo diff --git a/regamedll/extra/cssdk/dlls/weapontype.h b/regamedll/extra/cssdk/dlls/weapontype.h index c185b3e4..83b10836 100644 --- a/regamedll/extra/cssdk/dlls/weapontype.h +++ b/regamedll/extra/cssdk/dlls/weapontype.h @@ -251,6 +251,7 @@ enum MaxAmmoType enum AmmoType { + AMMO_NONE = -1, AMMO_BUCKSHOT, AMMO_9MM, AMMO_556NATO, @@ -399,4 +400,5 @@ struct WeaponInfoStruct int maxRounds; int ammoType; char *entityName; + const char *ammoName; }; diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h index dda1fc29..716c5f12 100644 --- a/regamedll/public/regamedll/regamedll_api.h +++ b/regamedll/public/regamedll/regamedll_api.h @@ -246,7 +246,6 @@ struct ReGameFuncs_t { void (*EndRoundMessage)(const char *sentence, int event); class CBaseEntity *(*UTIL_FindEntityByString)(class CBaseEntity *pStartEntity, const char *szKeyword, const char *szValue); - struct WeaponInfoStruct *(*GetWeaponInfo)(int weaponID); }; class IReGameApi { diff --git a/regamedll/public/regamedll/regamedll_interfaces.h b/regamedll/public/regamedll/regamedll_interfaces.h index f0c1a71e..aced5e1b 100644 --- a/regamedll/public/regamedll/regamedll_interfaces.h +++ b/regamedll/public/regamedll/regamedll_interfaces.h @@ -2077,4 +2077,5 @@ public: virtual ~IReGameData() {} virtual class CGameRules* GetGameRules() = 0; + virtual struct WeaponInfoStruct *GetWeaponInfo(int weaponID) = 0; }; diff --git a/regamedll/regamedll/regamedll_api_impl.cpp b/regamedll/regamedll/regamedll_api_impl.cpp index b3c5271d..fbb06f42 100644 --- a/regamedll/regamedll/regamedll_api_impl.cpp +++ b/regamedll/regamedll/regamedll_api_impl.cpp @@ -47,7 +47,6 @@ ReGameFuncs_t g_ReGameApiFuncs = { &EndRoundMessage, &UTIL_FindEntityByString, - &GetWeaponInfo, }; diff --git a/regamedll/regamedll/regamedll_interfaces_impl.cpp b/regamedll/regamedll/regamedll_interfaces_impl.cpp index c0f3d316..a484f27e 100644 --- a/regamedll/regamedll/regamedll_interfaces_impl.cpp +++ b/regamedll/regamedll/regamedll_interfaces_impl.cpp @@ -138,3 +138,7 @@ ICSEntity *EXT_FUNC INDEX_TO_CSENTITY(int iEntityIndex) CGameRules* EXT_FUNC CReGameData::GetGameRules() { return g_pGameRules; } + +WeaponInfoStruct* EXT_FUNC CReGameData::GetWeaponInfo(int weaponID) { + return ::GetWeaponInfo(weaponID); +} diff --git a/regamedll/regamedll/regamedll_interfaces_impl.h b/regamedll/regamedll/regamedll_interfaces_impl.h index 395a0c5d..f83cbe4c 100644 --- a/regamedll/regamedll/regamedll_interfaces_impl.h +++ b/regamedll/regamedll/regamedll_interfaces_impl.h @@ -2523,6 +2523,7 @@ public: class CReGameData: public IReGameData { public: virtual CGameRules* GetGameRules(); + virtual WeaponInfoStruct *GetWeaponInfo(int weaponID); }; template