Merge branch 'revert_commit'

This commit is contained in:
s1lentq 2016-07-14 22:59:51 +07:00
commit 4a2029194b
48 changed files with 1072 additions and 881 deletions

View File

@ -103,7 +103,7 @@ int CBaseAnimating::LookupSequence(const char *label)
LINK_HOOK_CLASS_VOID_CHAIN2(CBaseAnimating, ResetSequenceInfo)
void EXT_ALIGN CBaseAnimating::__API_HOOK(ResetSequenceInfo)()
void EXT_FUNC CBaseAnimating::__API_HOOK(ResetSequenceInfo)()
{
void *pmodel = GET_MODEL_PTR(ENT(pev));

View File

@ -826,7 +826,7 @@ void CCSBot::__MAKE_VHOOK(OnTouchingWeapon)(CWeaponBox *box)
if (prefID == pDroppedWeapon->m_iId)
{
// the gun on the ground is better than the one we have - drop our gun
DropPrimary(this);
DropPrimary();
break;
}
}

View File

@ -70,12 +70,17 @@ void CSGameState::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity
switch (event)
{
case EVENT_BOMB_PLANTED:
{
// change state - the event is announced to everyone
SetBombState(PLANTED);
if (m_owner->m_iTeam == TERRORIST && other != NULL)
// Terrorists always know where the bomb is
if (m_owner->m_iTeam == TERRORIST && other)
{
UpdatePlantedBomb(&other->pev->origin);
}
break;
}
case EVENT_BOMB_DEFUSED:
SetBombState(DEFUSED);
break;
@ -284,8 +289,8 @@ bool CSGameState::IsBombsiteClear(int zoneIndex) const
void CSGameState::InitializeHostageInfo()
{
m_hostageCount = 0;
m_allHostagesRescued = 0;
m_haveSomeHostagesBeenTaken = 0;
m_allHostagesRescued = false;
m_haveSomeHostagesBeenTaken = false;
CBaseEntity *hostage = NULL;
while ((hostage = UTIL_FindEntityByClassname(hostage, "hostage_entity")) != NULL)

View File

@ -13,7 +13,7 @@ void DefuseBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
const Vector *bombPos = me->GetGameState()->GetBombPosition();
if (bombPos == NULL)
if (!bombPos)
{
me->PrintIfWatched("In Defuse state, but don't know where the bomb is!\n");
me->Idle();
@ -29,7 +29,7 @@ void DefuseBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (gpGlobals->time - me->GetStateTimestamp() > 1.0f)
{
// if we missed starting the defuse, give up
if (TheCSBots()->GetBombDefuser() == NULL)
if (!TheCSBots()->GetBombDefuser())
{
me->PrintIfWatched("Failed to start defuse, giving up\n");
me->Idle();
@ -47,6 +47,14 @@ void DefuseBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
// if bomb has been defused, give up
if (!TheCSBots()->IsBombPlanted())
{
#ifdef REGAMEDLL_ADD
if (CSGameRules()->HasRoundInfinite(SCENARIO_BLOCK_BOMB)) {
me->GetGameState()->Reset();
me->Hunt();
return;
}
#endif
me->Idle();
return;
}

View File

@ -20,10 +20,11 @@ void IdleState::__MAKE_VHOOK(OnEnter)(CCSBot *me)
me->SetDisposition(CCSBot::ENGAGE_AND_INVESTIGATE);
}
// Determine what we should do next
void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// all other states assume GetLastKnownArea() is valid, ensure that it is
if (me->GetLastKnownArea() == NULL && me->StayOnNavMesh() == false)
if (!me->GetLastKnownArea() && me->StayOnNavMesh() == false)
return;
// zombies never leave the Idle state
@ -54,13 +55,19 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (me->GetHostageEscortCount())
{
const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(me->GetLastKnownArea(), PathCost(me, FASTEST_ROUTE));
const Vector *zonePos = TheCSBots()->GetRandomPositionInZone(zone);
#ifdef REGAMEDLL_FIXES
if (zonePos)
#endif
{
me->SetTask(CCSBot::RESCUE_HOSTAGES);
me->Run();
me->SetDisposition(CCSBot::SELF_DEFENSE);
me->MoveTo(TheCSBots()->GetRandomPositionInZone(zone), FASTEST_ROUTE);
me->MoveTo(zonePos, FASTEST_ROUTE);
me->PrintIfWatched("Trying to rescue hostages at the end of the round\n");
return;
}
}
me->Hunt();
return;
@ -81,9 +88,6 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
case CCSBotManager::SCENARIO_DEFUSE_BOMB:
{
static int inumpo = 0;
inumpo++;
// if this is a bomb game and we have the bomb, go plant it
if (me->m_iTeam == TERRORIST)
{
@ -93,6 +97,10 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// T's always know where the bomb is - go defend it
const CCSBotManager::Zone *zone = TheCSBots()->GetZone(me->GetGameState()->GetPlantedBombsite());
#ifdef REGAMEDLL_FIXES
if (zone)
#endif
{
me->SetTask(CCSBot::GUARD_TICKING_BOMB);
Place place = TheNavAreaGrid.GetPlace(&zone->m_center);
@ -100,7 +108,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// pick a random hiding spot in this place
const Vector *spot = FindRandomHidingSpot(me, place, me->IsSniper());
if (spot != NULL)
if (spot)
{
me->Hide(spot);
return;
@ -111,6 +119,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
me->Hide(TheNavAreaGrid.GetNearestNavArea(&zone->m_center));
return;
}
}
else
{
// ask our teammates where the bomb is
@ -121,7 +130,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
// move to bombsite - if we reach it, we'll update its cleared status, causing us to select another
const Vector *pos = TheCSBots()->GetRandomPositionInZone(TheCSBots()->GetZone(zoneIndex));
if (pos != NULL)
if (pos)
{
me->SetTask(CCSBot::FIND_TICKING_BOMB);
me->MoveTo(pos);
@ -147,11 +156,11 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// move to the closest bomb site
const CCSBotManager::Zone *zone = TheCSBots()->GetClosestZone(me->GetLastKnownArea(), PathCost(me));
if (zone != NULL)
if (zone)
{
// pick a random spot within the bomb zone
const Vector *pos = TheCSBots()->GetRandomPositionInZone(zone);
if (pos != NULL)
if (pos)
{
// move to bombsite
me->SetTask(CCSBot::PLANT_BOMB);
@ -186,7 +195,8 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (!me->IsRogue() && me->GetGameState()->IsBombPlanted() && me->GetGameState()->GetBombPosition() != NULL)
{
const Vector *bombPos = me->GetGameState()->GetBombPosition();
if (bombPos != NULL)
if (bombPos)
{
me->SetTask(CCSBot::GUARD_TICKING_BOMB);
me->Hide(TheNavAreaGrid.GetNavArea(bombPos));
@ -202,7 +212,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// if the bomb has been planted, attempt to defuse it
const Vector *bombPos = me->GetGameState()->GetBombPosition();
if (bombPos != NULL)
if (bombPos)
{
// if someone is defusing the bomb, guard them
if (TheCSBots()->GetBombDefuser())
@ -235,7 +245,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// we know which bombsite, but not exactly where the bomb is, go there
const CCSBotManager::Zone *zone = TheCSBots()->GetZone(me->GetGameState()->GetPlantedBombsite());
if (zone != NULL)
if (zone)
{
if (me->IsDoingScenario())
{
@ -258,7 +268,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// we dont know where the bomb is - we must search the bombsites
// find closest un-cleared bombsite
const CCSBotManager::Zone *zone = NULL;
const CCSBotManager::Zone *zone = nullptr;
float travelDistance = 9999999.9f;
for (int z = 0; z < TheCSBots()->GetZoneCount(); ++z)
@ -274,34 +284,39 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
ShortestPathCost pathCost = ShortestPathCost();
float_precision dist = NavAreaTravelDistance(me->GetLastKnownArea(), TheNavAreaGrid.GetNearestNavArea(&TheCSBots()->GetZone(z)->m_center), pathCost);
if (/*dist >= 0.0f && */dist < travelDistance)
#ifdef REGAMEDLL_FIXES
if (dist < 0.0f)
continue;
#endif
if (dist < travelDistance)
{
zone = TheCSBots()->GetZone(z);
travelDistance = dist;
}
}
if (zone != NULL)
if (zone)
{
const float farAwayRange = 2000.0f;
if (travelDistance > farAwayRange)
{
zone = NULL;
zone = nullptr;
}
}
// if closest bombsite is "far away", pick one at random
if (zone == NULL)
if (!zone)
{
int zoneIndex = me->GetGameState()->GetNextBombsiteToSearch();
zone = TheCSBots()->GetZone(zoneIndex);
}
// move to bombsite - if we reach it, we'll update its cleared status, causing us to select another
if (zone != NULL)
if (zone)
{
const Vector *pos = TheCSBots()->GetRandomPositionInZone(zone);
if (pos != NULL)
if (pos)
{
me->SetTask(CCSBot::FIND_TICKING_BOMB);
me->MoveTo(pos);
@ -330,14 +345,14 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// snipe bomb zone(s)
const CCSBotManager::Zone *zone = TheCSBots()->GetRandomZone();
if (zone != NULL)
if (zone)
{
snipingArea = TheCSBots()->GetRandomAreaInZone(zone);
me->PrintIfWatched("Sniping near bombsite\n");
}
}
if (snipingArea != NULL)
if (snipingArea)
{
me->SetTask(CCSBot::MOVE_TO_SNIPER_SPOT);
me->Hide(snipingArea, -1.0f, sniperHideRange);
@ -368,10 +383,10 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
// guard bomb zone(s)
const CCSBotManager::Zone *zone = TheCSBots()->GetRandomZone();
if (zone != NULL)
if (zone)
{
CNavArea *area = TheCSBots()->GetRandomAreaInZone(zone);
if (area != NULL)
if (area)
{
me->PrintIfWatched("I'm guarding a bombsite\n");
me->GetChatter()->AnnouncePlan("GoingToDefendBombsite", area->GetPlace());
@ -397,10 +412,10 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// snipe escape zone(s)
const CCSBotManager::Zone *zone = TheCSBots()->GetRandomZone();
if (zone != NULL)
if (zone)
{
CNavArea *area = TheCSBots()->GetRandomAreaInZone(zone);
if (area != NULL)
if (area)
{
me->SetTask(CCSBot::MOVE_TO_SNIPER_SPOT);
me->Hide(area, -1.0, sniperHideRange);
@ -424,10 +439,10 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
{
// guard escape zone(s)
const CCSBotManager::Zone *zone = TheCSBots()->GetRandomZone();
if (zone != NULL)
if (zone)
{
CNavArea *area = TheCSBots()->GetRandomAreaInZone(zone);
if (area != NULL)
if (area)
{
// guard the escape zone - stay closer if our morale is low
me->SetTask(CCSBot::GUARD_VIP_ESCAPE_ZONE);
@ -461,11 +476,11 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
zone = TheCSBots()->GetClosestZone(me->GetLastKnownArea(), PathCost(me));
}
if (zone != NULL)
if (zone)
{
// pick a random spot within the escape zone
const Vector *pos = TheCSBots()->GetRandomPositionInZone(zone);
if (pos != NULL)
if (pos)
{
// move to escape zone
me->SetTask(CCSBot::VIP_ESCAPE);
@ -523,7 +538,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (RANDOM_FLOAT(0, 100) <= defenseSniperCampChance)
{
const Vector *hostagePos = me->GetGameState()->GetRandomFreeHostagePosition();
if (hostagePos != NULL && campHostages)
if (hostagePos && campHostages)
{
me->SetTask(CCSBot::MOVE_TO_SNIPER_SPOT);
me->PrintIfWatched("Sniping near hostages\n");
@ -549,11 +564,11 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (!me->IsSafe() && !me->IsRogue())
{
CBaseEntity *hostage = me->GetGameState()->GetNearestVisibleFreeHostage();
if (hostage != NULL)
if (hostage)
{
// we see a free hostage, guard it
CNavArea *area = TheNavAreaGrid.GetNearestNavArea(&hostage->pev->origin);
if (area != NULL)
if (area)
{
me->SetTask(CCSBot::GUARD_HOSTAGES);
me->Hide(area);
@ -580,10 +595,10 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
// decide whether to camp the hostages or the escape zones
const Vector *hostagePos = me->GetGameState()->GetRandomFreeHostagePosition();
if (hostagePos != NULL && campHostages)
if (hostagePos && campHostages)
{
CNavArea *area = TheNavAreaGrid.GetNearestNavArea(hostagePos);
if (area != NULL)
if (area)
{
// guard the hostages - stay closer to hostages if our morale is low
me->SetTask(CCSBot::GUARD_HOSTAGES);
@ -645,10 +660,10 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
// if we are not allowed to do the scenario, guard the hostages to clear the area for the human(s)
if (!me->IsDoingScenario())
{
if (hostage != NULL)
if (hostage)
{
CNavArea *area = TheNavAreaGrid.GetNearestNavArea(&hostage->pev->origin);
if (area != NULL)
if (area)
{
me->SetTask(CCSBot::GUARD_HOSTAGES);
me->Hide(area);
@ -672,9 +687,9 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
// if we are escorting hostages and there are more hostages to rescue,
// determine whether it's faster to rescue the ones we have, or go get the remaining ones
if (hostage != NULL)
if (hostage)
{
if (zone != NULL)
if (zone)
{
PathCost pathCost(me, FASTEST_ROUTE);
float toZone = NavAreaTravelDistance(me->GetLastKnownArea(), zone->m_area[0], pathCost);
@ -697,7 +712,7 @@ void IdleState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
fetchHostages = true;
}
}
else if (zone != NULL)
else if (zone)
{
rescueHostages = true;
}

View File

@ -1084,9 +1084,12 @@ void OnFreeEntPrivateData(edict_t *pEnt)
RemoveEntityHashValue(pEntity->pev, STRING(pEntity->pev->classname), CLASSNAME);
#ifdef REGAMEDLL_ADD
if (pEntity->m_pEntity != nullptr) {
if (pEntity->m_pEntity) {
delete pEntity->m_pEntity;
pEntity->m_pEntity = nullptr;
}
// entities can have a own destructor
pEntity->~CBaseEntity();
#endif
}

View File

@ -275,8 +275,12 @@ public:
virtual void Blocked(CBaseEntity *pOther) { if (m_pfnBlocked) (this->*m_pfnBlocked)(pOther); }
virtual CBaseEntity *Respawn() { return NULL; }
#ifndef REGAMEDLL_FIXES
// used by monsters that are created by the MonsterMaker
virtual void UpdateOwner() {}
#else
virtual ~CBaseEntity() {}
#endif
virtual BOOL FBecomeProne() { return FALSE; }
virtual Vector Center() { return (pev->absmax + pev->absmin) * 0.5f; }

View File

@ -57,7 +57,7 @@ static entity_field_alias_t custom_entity_field_alias[] =
{ "animtime", 0 },
};
static int g_serveractive = 0;
bool g_bServerActive = false;
#endif // HOOK_GAMEDLL
@ -464,20 +464,20 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity)
pPlayer->SetThink(NULL);
CBaseEntity *Target = UTIL_FindEntityByClassname(NULL, "trigger_camera");
pPlayer->m_pIntroCamera = Target;
CBaseEntity *pTarget = UTIL_FindEntityByClassname(NULL, "trigger_camera");
pPlayer->m_pIntroCamera = pTarget;
if (CSGameRules() != NULL && CSGameRules()->m_bMapHasCameras == MAP_HAS_CAMERAS_INIT)
if (CSGameRules() && CSGameRules()->m_bMapHasCameras == MAP_HAS_CAMERAS_INIT)
{
CSGameRules()->m_bMapHasCameras = (Target != NULL);
CSGameRules()->m_bMapHasCameras = (pTarget != NULL);
}
if (pPlayer->m_pIntroCamera != NULL)
Target = UTIL_FindEntityByTargetname(NULL, STRING(pPlayer->m_pIntroCamera->pev->target));
if (pPlayer->m_pIntroCamera)
pTarget = UTIL_FindEntityByTargetname(NULL, STRING(pPlayer->m_pIntroCamera->pev->target));
if (pPlayer->m_pIntroCamera != NULL && Target != NULL)
if (pPlayer->m_pIntroCamera && pTarget)
{
Vector CamAngles = UTIL_VecToAngles((Target->pev->origin - pPlayer->m_pIntroCamera->pev->origin).Normalize());
Vector CamAngles = UTIL_VecToAngles((pTarget->pev->origin - pPlayer->m_pIntroCamera->pev->origin).Normalize());
CamAngles.x = -CamAngles.x;
UTIL_SetOrigin(pPlayer->pev, pPlayer->m_pIntroCamera->pev->origin);
@ -488,6 +488,7 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity)
pPlayer->m_fIntroCamTime = gpGlobals->time + 6;
pPlayer->pev->view_ofs = g_vecZero;
}
#ifndef REGAMEDLL_FIXES
else
{
pPlayer->m_iTeam = CT;
@ -501,6 +502,7 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity)
pPlayer->pev->v_angle = g_vecZero;
pPlayer->pev->angles = gpGlobals->v_forward;
}
#endif
if (TheBots != NULL)
{
@ -521,17 +523,17 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity)
UTIL_ClientPrintAll(HUD_PRINTNOTIFY, "#Game_connected", (sName[0] != '\0') ? sName : "<unconnected>");
}
int Q_strlen_(const char *str)
NOXREF int Q_strlen_(const char *str)
{
int count = 0;
if (str && *str)
{
if (str && *str) {
while (str[count++ + 1]);
}
return count;
}
void Host_Say(edict_t *pEntity, int teamonly)
void Host_Say(edict_t *pEntity, BOOL teamonly)
{
CBasePlayer *client;
int j;
@ -813,41 +815,6 @@ void Host_Say(edict_t *pEntity, int teamonly)
}
}
void DropSecondary(CBasePlayer *pPlayer)
{
if (pPlayer->HasShield())
{
if (pPlayer->HasShield() && pPlayer->m_bShieldDrawn && pPlayer->m_pActiveItem != NULL)
{
((CBasePlayerWeapon *)pPlayer->m_pActiveItem)->SecondaryAttack();
}
pPlayer->m_bShieldDrawn = false;
}
CBasePlayerWeapon *pWeapon = (CBasePlayerWeapon *)pPlayer->m_rgpPlayerItems[ PISTOL_SLOT ];
if (pWeapon != NULL)
{
pPlayer->DropPlayerItem(STRING(pWeapon->pev->classname));
}
}
void DropPrimary(CBasePlayer *pPlayer)
{
if (pPlayer->HasShield())
{
pPlayer->DropShield();
return;
}
if (pPlayer->m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ])
{
pPlayer->DropPlayerItem(STRING(pPlayer->m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ]->pev->classname));
}
}
bool CanBuyThis(CBasePlayer *pPlayer, int iWeapon)
{
if (pPlayer->HasShield() && iWeapon == WEAPON_ELITE)
@ -1277,9 +1244,9 @@ void BuyItem(CBasePlayer *pPlayer, int iSlot)
if (pPlayer->m_iAccount >= SHIELDGUN_PRICE)
{
bEnoughMoney = true;
DropPrimary(pPlayer);
pPlayer->GiveShield(true);
pPlayer->DropPrimary();
pPlayer->GiveShield();
pPlayer->AddAccount(-SHIELDGUN_PRICE, RT_PLAYER_BOUGHT_SOMETHING);
EMIT_SOUND(ENT(pPlayer->pev), CHAN_ITEM, "items/gunpickup2.wav", VOL_NORM, ATTN_NORM);
@ -1341,11 +1308,11 @@ void BuyWeaponByWeaponID(CBasePlayer *pPlayer, WeaponIdType weaponID)
if (IsPrimaryWeapon(weaponID))
{
DropPrimary(pPlayer);
pPlayer->DropPrimary();
}
else
{
DropSecondary(pPlayer);
pPlayer->DropSecondary();
}
pPlayer->GiveNamedItem(info->entityName);
@ -1649,7 +1616,11 @@ BOOL __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
WRITE_BYTE(0);
MESSAGE_END();
#ifndef REGAMEDLL_FIXES
MESSAGE_BEGIN(MSG_BROADCAST, gmsgScoreInfo);
#else
MESSAGE_BEGIN(MSG_ALL, gmsgScoreInfo);
#endif
WRITE_BYTE(ENTINDEX(player->edict()));
WRITE_SHORT(int(player->pev->frags));
WRITE_SHORT(player->m_iDeaths);
@ -2299,7 +2270,7 @@ BOOL HandleRadioAliasCommands(CBasePlayer *pPlayer, const char *pszCommand)
}
// Use CMD_ARGV, CMD_ARGV, and CMD_ARGC to get pointers the character string command.
void EXT_ALIGN ClientCommand(edict_t *pEntity)
void EXT_FUNC ClientCommand(edict_t *pEntity)
{
const char *pcmd = CMD_ARGV_(0);
const char *pstr = NULL;
@ -2316,7 +2287,7 @@ void EXT_ALIGN ClientCommand(edict_t *pEntity)
if (gpGlobals->time >= player->m_flLastCommandTime[CMD_SAY])
{
player->m_flLastCommandTime[CMD_SAY] = gpGlobals->time + 0.3f;
Host_Say(pEntity, 0);
Host_Say(pEntity, FALSE);
}
}
else if (FStrEq(pcmd, "say_team"))
@ -2324,7 +2295,7 @@ void EXT_ALIGN ClientCommand(edict_t *pEntity)
if (gpGlobals->time >= player->m_flLastCommandTime[CMD_SAYTEAM])
{
player->m_flLastCommandTime[CMD_SAYTEAM] = gpGlobals->time + 0.3f;
Host_Say(pEntity, 1);
Host_Say(pEntity, TRUE);
}
}
else if (FStrEq(pcmd, "fullupdate"))
@ -2565,7 +2536,6 @@ void EXT_ALIGN ClientCommand(edict_t *pEntity)
else if (FStrEq(pcmd, "menuselect"))
{
int slot = Q_atoi(CMD_ARGV_(1));
if (player->m_iJoiningState == JOINED || (player->m_iMenu != Menu_ChooseAppearance && player->m_iMenu != Menu_ChooseTeam))
{
if (slot == 10)
@ -2574,6 +2544,22 @@ void EXT_ALIGN ClientCommand(edict_t *pEntity)
}
}
#ifdef REGAMEDLL_ADD
auto canOpenOldMenu = [player]()-> bool
{
if (!player->m_bVGUIMenus || player->CSPlayer()->m_bForceShowMenu) {
player->CSPlayer()->m_bForceShowMenu = false;
return true;
}
return false;
};
#else
auto canOpenOldMenu = [player]()-> bool {
return player->m_bVGUIMenus == false;
};
#endif
switch (player->m_iMenu)
{
case Menu_OFF:
@ -2581,12 +2567,7 @@ void EXT_ALIGN ClientCommand(edict_t *pEntity)
case Menu_ChooseTeam:
{
#ifdef REGAMEDLL_ADD
if (!player->m_bVGUIMenus || player->CSPlayer()->m_bForceShowMenu)
{
player->CSPlayer()->m_bForceShowMenu = false;
if (!HandleMenu_ChooseTeam(player, slot))
if (canOpenOldMenu() && !HandleMenu_ChooseTeam(player, slot))
{
player->m_iMenu = Menu_ChooseTeam;
if (player->m_iJoiningState == JOINED)
@ -2594,38 +2575,25 @@ void EXT_ALIGN ClientCommand(edict_t *pEntity)
else
ShowVGUIMenu(player, VGUI_Menu_Team, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_5), "#Team_Select");
}
}
#else
if (!player->m_bVGUIMenus && !HandleMenu_ChooseTeam(player, slot))
{
player->m_iMenu = Menu_ChooseTeam;
if (player->m_iJoiningState == JOINED)
ShowVGUIMenu(player, VGUI_Menu_Team, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_5 | MENU_KEY_0), "#IG_Team_Select");
else
ShowVGUIMenu(player, VGUI_Menu_Team, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_5), "#Team_Select");
}
#endif
break;
}
case Menu_IGChooseTeam:
{
if (!player->m_bVGUIMenus)
{
if (canOpenOldMenu()) {
HandleMenu_ChooseTeam(player, slot);
}
break;
}
case Menu_ChooseAppearance:
{
if (!player->m_bVGUIMenus)
{
if (canOpenOldMenu()) {
HandleMenu_ChooseAppearance(player, slot);
}
break;
}
case Menu_Buy:
{
if (!player->m_bVGUIMenus)
if (canOpenOldMenu())
{
switch (slot)
{
@ -2760,48 +2728,42 @@ void EXT_ALIGN ClientCommand(edict_t *pEntity)
}
case Menu_BuyPistol:
{
if (!player->m_bVGUIMenus)
{
if (canOpenOldMenu()) {
BuyPistol(player, slot);
}
break;
}
case Menu_BuyShotgun:
{
if (!player->m_bVGUIMenus)
{
if (canOpenOldMenu()) {
BuyShotgun(player, slot);
}
break;
}
case Menu_BuySubMachineGun:
{
if (!player->m_bVGUIMenus)
{
if (canOpenOldMenu()) {
BuySubMachineGun(player, slot);
}
break;
}
case Menu_BuyRifle:
{
if (!player->m_bVGUIMenus)
{
if (canOpenOldMenu()) {
BuyRifle(player, slot);
}
break;
}
case Menu_BuyMachineGun:
{
if (!player->m_bVGUIMenus)
{
if (canOpenOldMenu()) {
BuyMachineGun(player, slot);
}
break;
}
case Menu_BuyItem:
{
if (!player->m_bVGUIMenus)
{
if (canOpenOldMenu()) {
BuyItem(player, slot);
}
break;
@ -3300,23 +3262,21 @@ void EXT_FUNC ServerDeactivate()
{
// It's possible that the engine will call this function more times than is necessary
// Therefore, only run it one time for each call to ServerActivate
if (g_serveractive != 1)
{
if (!g_bServerActive)
return;
}
g_serveractive = 0;
g_bServerActive = false;
// Peform any shutdown operations here...
g_pGameRules->ServerDeactivate();
CLocalNav::Reset();
if (TheBots != NULL)
if (TheBots)
{
TheBots->ServerDeactivate();
}
if (g_pHostages != NULL)
if (g_pHostages)
{
g_pHostages->ServerDeactivate();
}
@ -3328,7 +3288,7 @@ void EXT_FUNC ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)
CBaseEntity *pClass;
// Every call to ServerActivate should be matched by a call to ServerDeactivate
g_serveractive = 1;
g_bServerActive = true;
EmptyEntityHashTable();
// Clients have not been initialized yet
@ -3419,8 +3379,7 @@ void EXT_FUNC ParmsChangeLevel()
void EXT_FUNC StartFrame()
{
if (g_pGameRules != NULL)
{
if (g_pGameRules) {
g_pGameRules->Think();
}
@ -3443,13 +3402,11 @@ void EXT_FUNC StartFrame()
else
g_iSkillLevel = 0;
if (TheBots != NULL)
{
if (TheBots) {
TheBots->StartFrame();
}
if (TheTutor != NULL)
{
if (TheTutor) {
TheTutor->StartFrame(gpGlobals->time);
}
@ -4456,7 +4413,7 @@ int EXT_FUNC GetWeaponData(edict_t *player, struct weapon_data_s *info)
}
// Data sent to current client only engine sets cd to 0 before calling.
void EXT_ALIGN UpdateClientData(const struct edict_s *ent, int sendweapons, struct clientdata_s *cd)
void EXT_FUNC UpdateClientData(const struct edict_s *ent, int sendweapons, struct clientdata_s *cd)
{
if (!ent || !ent->pvPrivateData)
return;

View File

@ -105,6 +105,8 @@ C_DLLEXPORT float g_flTimeLimit;
C_DLLEXPORT int CountTeams();
C_DLLEXPORT int CountTeamPlayers(int iTeam);
extern bool g_bServerActive;
extern float g_flResetTime;
extern bool g_skipCareerInitialSpawn;
@ -128,7 +130,7 @@ void ProcessKickVote(CBasePlayer *pVotingPlayer, CBasePlayer *pKickPlayer);
void CheckStartMoney();
void ClientPutInServer(edict_t *pEntity);
int Q_strlen_(const char *str);
void Host_Say(edict_t *pEntity, int teamonly);
void Host_Say(edict_t *pEntity, BOOL teamonly);
void DropSecondary(CBasePlayer *pPlayer);
void DropPrimary(CBasePlayer *pPlayer);
bool CanBuyThis(CBasePlayer *pPlayer, int iWeapon);

View File

@ -1421,7 +1421,7 @@ void CBaseEntity::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDama
{
Vector vecOrigin = ptr->vecEndPos - vecDir * 4;
if (pev->takedamage == DAMAGE_YES)
if (pev->takedamage != DAMAGE_NO)
{
AddMultiDamage(pevAttacker, this, flDamage, bitsDamageType);
@ -1439,7 +1439,7 @@ void CBaseMonster::__MAKE_VHOOK(TraceAttack)(entvars_t *pevAttacker, float flDam
{
Vector vecOrigin = ptr->vecEndPos - vecDir * 4;
if (pev->takedamage == DAMAGE_YES)
if (pev->takedamage != DAMAGE_NO)
{
m_LastHitGroup = ptr->iHitgroup;

View File

@ -1974,7 +1974,7 @@ void CItemSoda::CanTouch(CBaseEntity *pOther)
#endif
// spoit sound here
pPlayer->TakeHealth(1, DMG_GENERIC);// a bit of health.
pPlayer->TakeHealth(1, DMG_GENERIC); // a bit of health.
if (!FNullEnt(pev->owner))
{

View File

@ -27,6 +27,28 @@
*/
#pragma once
#ifdef _WIN32
// Attributes to specify an "exported" function, visible from outside the
// DLL.
#undef DLLEXPORT
#define DLLEXPORT __declspec(dllexport)
// WINAPI should be provided in the windows compiler headers.
// It's usually defined to something like "__stdcall".
#else
#undef DLLEXPORT
#define DLLEXPORT __attribute__((visibility("default")))
#define WINAPI /* */
#endif // _WIN32
// Simplified macro for declaring/defining exported DLL functions. They
// need to be 'extern "C"' so that the C++ compiler enforces parameter
// type-matching, rather than considering routines with mis-matched
// arguments/types to be overloaded functions...
//
// AFAIK, this is os-independent, but it's included here in osdep.h where
// DLLEXPORT is defined, for convenience.
#define C_DLLEXPORT extern "C" DLLEXPORT
enum hash_types_e { CLASSNAME };
// Things that toggle (buttons/triggers/doors) need this

View File

@ -758,7 +758,7 @@ public:
// has a style of gameplay when aren't any teams
bool IsFreeForAll() const;
bool HasRoundInfinite(bool time_expired = false) const;
bool HasRoundInfinite(int flags = 0) const;
private:
VFUNC bool HasRoundTimeExpired();
@ -876,24 +876,6 @@ typedef struct mapcycle_s
} mapcycle_t;
class CMapInfo: public CPointEntity
{
public:
virtual void Spawn();
virtual void KeyValue(KeyValueData *pkvd);
#ifdef HOOK_GAMEDLL
void Spawn_();
void KeyValue_(KeyValueData *pkvd);
#endif
public:
int m_iBuyingStatus;
float m_flBombRadius;
};
class CCStrikeGameMgrHelper: public IVoiceGameMgrHelper
{
public:
@ -907,7 +889,7 @@ public:
};
extern CGameRules *g_pGameRules;
extern CGameRules DLLEXPORT *g_pGameRules;
CGameRules *InstallGameRules();
CGameRules *InstallGameRules_();
@ -942,11 +924,15 @@ inline bool CHalfLifeMultiplay::IsFreeForAll() const
return false;
}
inline bool CHalfLifeMultiplay::HasRoundInfinite(bool time_expired) const
inline bool CHalfLifeMultiplay::HasRoundInfinite(int flags) const
{
#ifdef REGAMEDLL_ADD
if (round_infinite.string[0] == '1' || (time_expired && (UTIL_ReadFlags(round_infinite.string) & SCENARIO_BLOCK_TIME_EXPRIRED)))
if (round_infinite.string[0] == '1')
return true;
if (flags && (UTIL_ReadFlags(round_infinite.string) & flags))
return true;
#endif
return false;
}

View File

@ -37,26 +37,20 @@ ItemInfo itemInfo[] = {
DEFINE_ITEMINFO(ITEM_KEVLAR, "item_kevlar"),
DEFINE_ITEMINFO(ITEM_ASSAULT, "item_assaultsuit"),
DEFINE_ITEMINFO(ITEM_LONGJUMP, "item_longjump"),
DEFINE_ITEMINFO(ITEM_SODACAN, "item_sodacan"),
DEFINE_ITEMINFO(ITEM_HEALTHKIT, "item_healthkit"),
DEFINE_ITEMINFO(ITEM_ANTIDOTE, "item_antidote"),
DEFINE_ITEMINFO(ITEM_SECURITY, "item_security"),
DEFINE_ITEMINFO(ITEM_BATTERY, "item_battery"),
DEFINE_ITEMINFO(ITEM_SUIT, "item_suit"),
};
// NOTE: useless thing
#ifndef REGAMEDLL_FIXES
LINK_ENTITY_TO_CLASS(world_items, CWorldItem, CCSWorldItem);
void CWorldItem::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "type"))
{
#ifdef REGAMEDLL_FIXES
// let's start with ITEM_HEALTHKIT
m_iType = (ItemID)(Q_atoi(pkvd->szValue) - 41 - ITEM_HEALTHKIT);
#else
m_iType = (ItemID)Q_atoi(pkvd->szValue);
#endif
m_iType = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else
@ -67,43 +61,23 @@ void CWorldItem::__MAKE_VHOOK(Spawn)()
{
CBaseEntity *pEntity = NULL;
#ifdef REGAMEDLL_FIXES
switch (m_iType)
{
case ITEM_HEALTHKIT:
case 41: // ITEM_HEALTHKIT
break;
case ITEM_ANTIDOTE:
case 42: // ITEM_ANTIDOTE
pEntity = CBaseEntity::Create("item_antidote", pev->origin, pev->angles);
break;
case ITEM_SECURITY:
case 43: // ITEM_SECURITY
pEntity = CBaseEntity::Create("item_security", pev->origin, pev->angles);
break;
case ITEM_BATTERY:
case 44: // ITEM_BATTERY
pEntity = CBaseEntity::Create("item_battery", pev->origin, pev->angles);
break;
case ITEM_SUIT:
case 45: // ITEM_SUIT
pEntity = CBaseEntity::Create("item_suit", pev->origin, pev->angles);
break;
}
#else
switch (m_iType)
{
case 41:
break;
case 42:
pEntity = CBaseEntity::Create("item_antidote", pev->origin, pev->angles);
break;
case 43:
pEntity = CBaseEntity::Create("item_security", pev->origin, pev->angles);
break;
case 44:
pEntity = CBaseEntity::Create("item_battery", pev->origin, pev->angles);
break;
case 45:
pEntity = CBaseEntity::Create("item_suit", pev->origin, pev->angles);
break;
}
#endif
if (pEntity != NULL)
{
@ -114,6 +88,7 @@ void CWorldItem::__MAKE_VHOOK(Spawn)()
REMOVE_ENTITY(edict());
}
#endif
void CItem::__MAKE_VHOOK(Spawn)()
{
@ -186,6 +161,8 @@ void CItem::Materialize()
SetTouch(&CItem::ItemTouch);
}
// NOTE: useless thing
#ifndef REGAMEDLL_FIXES
void CItemSuit::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -204,11 +181,6 @@ BOOL CItemSuit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
if (pPlayer->pev->weapons & (1 << WEAPON_SUIT))
return FALSE;
#ifdef REGAMEDLL_ADD
if (pPlayer->HasRestrictItem(ITEM_SUIT, ITEM_TYPE_TOUCHED))
return FALSE;
#endif
EMIT_SOUND(pPlayer->edict(), CHAN_VOICE, "items/tr_kevlar.wav", VOL_NORM, ATTN_NORM);
pPlayer->pev->weapons |= (1 << WEAPON_SUIT);
@ -218,6 +190,7 @@ BOOL CItemSuit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
}
LINK_ENTITY_TO_CLASS(item_suit, CItemSuit, CCSItemSuit);
#endif
void CItemBattery::__MAKE_VHOOK(Spawn)()
{
@ -291,13 +264,15 @@ BOOL CItemAntidote::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
#endif
pPlayer->SetSuitUpdate("!HEV_DET4", FALSE, SUIT_NEXT_IN_1MIN);
pPlayer->m_rgItems[ ITEM_ANTIDOTE ] += 1;
pPlayer->m_rgItems[ ITEM_ID_ANTIDOTE ] += 1;
return TRUE;
}
LINK_ENTITY_TO_CLASS(item_antidote, CItemAntidote, CCSItemAntidote);
// NOTE: useless thing
#ifndef REGAMEDLL_FIXES
void CItemSecurity::__MAKE_VHOOK(Spawn)()
{
Precache();
@ -312,16 +287,12 @@ void CItemSecurity::__MAKE_VHOOK(Precache)()
BOOL CItemSecurity::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
{
#ifdef REGAMEDLL_ADD
if (pPlayer->HasRestrictItem(ITEM_SECURITY, ITEM_TYPE_TOUCHED))
return FALSE;
#endif
pPlayer->m_rgItems[ ITEM_SECURITY ] += 1;
pPlayer->m_rgItems[ ITEM_ID_SECURITY ] += 1;
return TRUE;
}
LINK_ENTITY_TO_CLASS(item_security, CItemSecurity, CCSItemSecurity);
#endif
void CItemLongJump::__MAKE_VHOOK(Spawn)()
{

View File

@ -38,6 +38,9 @@ enum ItemRestType
};
// constant items
#define ITEM_ID_ANTIDOTE 2
#define ITEM_ID_SECURITY 3
enum ItemID
{
ITEM_NONE = -1,
@ -80,9 +83,7 @@ enum ItemID
ITEM_SODACAN,
ITEM_HEALTHKIT,
ITEM_ANTIDOTE,
ITEM_SECURITY,
ITEM_BATTERY,
ITEM_SUIT
ITEM_BATTERY
};
class CItem: public CBaseEntity
@ -118,7 +119,7 @@ public:
#endif
public:
ItemID m_iType;
int m_iType;
};
class CItemSuit: public CItem

View File

@ -0,0 +1,94 @@
#include "precompiled.h"
CMapInfo *g_pMapInfo = nullptr;
CMapInfo::CMapInfo()
{
m_flBombRadius = 500.0f;
m_iBuyingStatus = BUYING_EVERYONE;
#ifdef REGAMEDLL_ADD
if (g_pMapInfo)
{
// Should only be one of these.
ALERT(at_warning, "Warning: Multiple info_map_parameters entities in map!\n");
}
#endif
else
{
g_pMapInfo = this;
}
}
CMapInfo::~CMapInfo()
{
if (g_pMapInfo == this)
g_pMapInfo = nullptr;
}
void CMapInfo::CheckMapInfo()
{
bool bCTCantBuy, bTCantBuy;
switch (m_iBuyingStatus)
{
case BUYING_EVERYONE:
bCTCantBuy = false;
bTCantBuy = false;
ALERT(at_console, "EVERYONE CAN BUY!\n");
break;
case BUYING_ONLY_CTS:
bCTCantBuy = false;
bTCantBuy = true;
ALERT(at_console, "Only CT's can buy!!\n");
break;
case BUYING_ONLY_TERRORISTS:
bCTCantBuy = true;
bTCantBuy = false;
ALERT(at_console, "Only T's can buy!!\n");
break;
case BUYING_NO_ONE:
bCTCantBuy = true;
bTCantBuy = true;
ALERT(at_console, "No one can buy!!\n");
break;
default:
bCTCantBuy = false;
bTCantBuy = false;
break;
}
CSGameRules()->m_flBombRadius = m_flBombRadius;
CSGameRules()->m_bCTCantBuy = bCTCantBuy;
CSGameRules()->m_bTCantBuy = bTCantBuy;
}
void CMapInfo::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "buying"))
{
m_iBuyingStatus = (InfoMapBuyParam)Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "bombradius"))
{
m_flBombRadius = (float)Q_atoi(pkvd->szValue);
if (m_flBombRadius > MAX_BOMB_RADIUS)
m_flBombRadius = MAX_BOMB_RADIUS;
pkvd->fHandled = TRUE;
}
}
void CMapInfo::__MAKE_VHOOK(Spawn)()
{
pev->movetype = MOVETYPE_NONE;
pev->solid = SOLID_NOT;
pev->effects |= EF_NODRAW;
}
LINK_ENTITY_TO_CLASS(info_map_parameters, CMapInfo, CCSMapInfo);

53
regamedll/dlls/mapinfo.h Normal file
View File

@ -0,0 +1,53 @@
/*
*
* 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
class CMapInfo: public CPointEntity
{
public:
CMapInfo();
virtual ~CMapInfo();
virtual void Spawn();
virtual void KeyValue(KeyValueData *pkvd);
void CheckMapInfo();
#ifdef HOOK_GAMEDLL
void Spawn_();
void KeyValue_(KeyValueData *pkvd);
#endif
public:
InfoMapBuyParam m_iBuyingStatus;
float m_flBombRadius;
};
// The info_map_parameters entity in this map (only one is allowed for).
extern CMapInfo *g_pMapInfo;

View File

@ -192,33 +192,6 @@ void CHalfLifeMultiplay::__API_VHOOK(ServerDeactivate)()
UTIL_LogPrintf("Career End\n");
}
void CMapInfo::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
if (FStrEq(pkvd->szKeyName, "buying"))
{
m_iBuyingStatus = Q_atoi(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "bombradius"))
{
m_flBombRadius = Q_atoi(pkvd->szValue);
if (m_flBombRadius > MAX_BOMB_RADIUS)
m_flBombRadius = MAX_BOMB_RADIUS;
pkvd->fHandled = TRUE;
}
}
void CMapInfo::__MAKE_VHOOK(Spawn)()
{
pev->movetype = MOVETYPE_NONE;
pev->solid = SOLID_NOT;
pev->effects |= EF_NODRAW;
}
LINK_ENTITY_TO_CLASS(info_map_parameters, CMapInfo, CCSMapInfo);
bool CCStrikeGameMgrHelper::__MAKE_VHOOK(CanPlayerHearPlayer)(CBasePlayer *pListener, CBasePlayer *pSender)
{
if (!pSender->IsPlayer() || pListener->m_iTeam != pSender->m_iTeam)
@ -470,8 +443,11 @@ CHalfLifeMultiplay::CHalfLifeMultiplay()
m_bCompleteReset = false;
m_flRequiredEscapeRatio = 0.5;
m_iNumEscapers = 0;
// by default everyone can buy
m_bCTCantBuy = false;
m_bTCantBuy = false;
m_flBombRadius = 500.0;
m_iTotalGunCount = 0;
m_iTotalGrenadeCount = 0;
@ -521,8 +497,7 @@ CHalfLifeMultiplay::CHalfLifeMultiplay()
m_iIntroRoundTime += 2;
m_fMaxIdlePeriod = m_iRoundTime * 2;
float flAutoKickIdle = CVAR_GET_FLOAT("mp_autokick_timeout");
float flAutoKickIdle = autokick_timeout.value;
if (flAutoKickIdle > 0.0)
{
m_fMaxIdlePeriod = flAutoKickIdle;
@ -668,112 +643,36 @@ void CHalfLifeMultiplay::__API_VHOOK(CleanUpMap)()
{
// Recreate all the map entities from the map data (preserving their indices),
// then remove everything else except the players.
CBaseEntity *torestart = NULL;
CBaseEntity *toremove = NULL;
torestart = UTIL_FindEntityByClassname(NULL, "cycler_sprite");
while (torestart != NULL)
{
torestart->Restart();
torestart = UTIL_FindEntityByClassname(torestart, "cycler_sprite");
}
torestart = UTIL_FindEntityByClassname(NULL, "light");
while (torestart != NULL)
{
torestart->Restart();
torestart = UTIL_FindEntityByClassname(torestart, "light");
}
torestart = UTIL_FindEntityByClassname(NULL, "func_breakable");
while (torestart != NULL)
{
torestart->Restart();
torestart = UTIL_FindEntityByClassname(torestart, "func_breakable");
}
torestart = UTIL_FindEntityByClassname(NULL, "func_door");
while (torestart != NULL)
{
torestart->Restart();
torestart = UTIL_FindEntityByClassname(torestart, "func_door");
}
torestart = UTIL_FindEntityByClassname(NULL, "func_water");
while (torestart != NULL)
{
torestart->Restart();
torestart = UTIL_FindEntityByClassname(torestart, "func_water");
}
torestart = UTIL_FindEntityByClassname(NULL, "func_door_rotating");
while (torestart != NULL)
{
torestart->Restart();
torestart = UTIL_FindEntityByClassname(torestart, "func_door_rotating");
}
torestart = UTIL_FindEntityByClassname(NULL, "func_tracktrain");
while (torestart != NULL)
{
torestart->Restart();
torestart = UTIL_FindEntityByClassname(torestart, "func_tracktrain");
}
torestart = UTIL_FindEntityByClassname(NULL, "func_vehicle");
while (torestart != NULL)
{
torestart->Restart();
torestart = UTIL_FindEntityByClassname(torestart, "func_vehicle");
}
torestart = UTIL_FindEntityByClassname(NULL, "func_train");
while (torestart != NULL)
{
torestart->Restart();
torestart = UTIL_FindEntityByClassname(torestart, "func_train");
}
torestart = UTIL_FindEntityByClassname(NULL, "armoury_entity");
while (torestart != NULL)
{
torestart->Restart();
torestart = UTIL_FindEntityByClassname(torestart, "armoury_entity");
}
torestart = UTIL_FindEntityByClassname(NULL, "ambient_generic");
while (torestart != NULL)
{
torestart->Restart();
torestart = UTIL_FindEntityByClassname(torestart, "ambient_generic");
}
torestart = UTIL_FindEntityByClassname(NULL, "env_sprite");
while (torestart != NULL)
{
torestart->Restart();
torestart = UTIL_FindEntityByClassname(torestart, "env_sprite");
}
UTIL_RestartOther("cycler_sprite");
UTIL_RestartOther("light");
UTIL_RestartOther("func_breakable");
UTIL_RestartOther("func_door");
UTIL_RestartOther("func_water");
UTIL_RestartOther("func_door_rotating");
UTIL_RestartOther("func_tracktrain");
UTIL_RestartOther("func_vehicle");
UTIL_RestartOther("func_train");
UTIL_RestartOther("armoury_entity");
UTIL_RestartOther("ambient_generic");
UTIL_RestartOther("env_sprite");
// Remove grenades and C4
#ifdef REGAMEDLL_FIXES
UTIL_RemoveOther("grenade");
#else
int icount = 0;
toremove = UTIL_FindEntityByClassname(NULL, "grenade");
CBaseEntity *toremove = UTIL_FindEntityByClassname(NULL, "grenade");
while (toremove != NULL && icount < 20)
{
UTIL_Remove(toremove);
toremove = UTIL_FindEntityByClassname(toremove, "grenade");
++icount;
}
#endif
// Remove defuse kit
// Old code only removed 4 kits and stopped.
toremove = UTIL_FindEntityByClassname(NULL, "item_thighpack");
while (toremove != NULL)
{
UTIL_Remove(toremove);
toremove = UTIL_FindEntityByClassname(toremove, "item_thighpack");
}
UTIL_RemoveOther("item_thighpack");
RemoveGuns();
PLAYBACK_EVENT((FEV_GLOBAL | FEV_RELIABLE), 0, m_usResetDecals);
@ -1694,8 +1593,7 @@ void CHalfLifeMultiplay::__API_HOOK(BalanceTeams)()
}
}
if (toSwap != NULL)
{
if (toSwap) {
toSwap->SwitchTeam();
}
}
@ -1790,7 +1688,7 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
WRITE_BYTE(0); // to default FOV value
MESSAGE_END();
if (CVAR_GET_FLOAT("mp_autoteambalance") != 0.0f && m_iUnBalancedRounds >= 1)
if (autoteambalance.value != 0.0f && m_iUnBalancedRounds >= 1)
{
BalanceTeams();
}
@ -1803,7 +1701,7 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
m_iUnBalancedRounds = 0;
// Warn the players of an impending auto-balance next round...
if (CVAR_GET_FLOAT("mp_autoteambalance") != 0.0f && m_iUnBalancedRounds == 1)
if (autoteambalance.value != 0.0f && m_iUnBalancedRounds == 1)
{
UTIL_ClientPrintAll(HUD_PRINTCENTER, "#Auto_Team_Balance_Next_Round");
}
@ -1869,7 +1767,7 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
ReadMultiplayCvars();
float flAutoKickIdle = CVAR_GET_FLOAT("mp_autokick_timeout");
float flAutoKickIdle = autokick_timeout.value;
// set the idlekick max time (in seconds)
if (flAutoKickIdle > 0)
@ -1881,43 +1779,8 @@ void CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
m_iRoundTimeSecs = m_iIntroRoundTime;
// Check to see if there's a mapping info paramater entity
CMapInfo *mi = (CMapInfo *)UTIL_FindEntityByClassname(NULL, "info_map_parameters");
if (mi != NULL)
{
switch (mi->m_iBuyingStatus)
{
case BUYING_EVERYONE:
m_bCTCantBuy = false;
m_bTCantBuy = false;
ALERT(at_console, "EVERYONE CAN BUY!\n");
break;
case BUYING_ONLY_CTS:
m_bCTCantBuy = false;
m_bTCantBuy = true;
ALERT(at_console, "Only CT's can buy!!\n");
break;
case BUYING_ONLY_TERRORISTS:
m_bCTCantBuy = true;
m_bTCantBuy = false;
ALERT(at_console, "Only T's can buy!!\n");
break;
case BUYING_NO_ONE:
m_bCTCantBuy = true;
m_bTCantBuy = true;
ALERT(at_console, "No one can buy!!\n");
break;
default:
m_bCTCantBuy = false;
m_bTCantBuy = false;
break;
}
m_flBombRadius = mi->m_flBombRadius;
}
if (g_pMapInfo)
g_pMapInfo->CheckMapInfo();
CheckMapConditions();
@ -2921,7 +2784,7 @@ bool CHalfLifeMultiplay::VIP_NotEscaped_internal(int winStatus, ScenarioEventEnd
void CHalfLifeMultiplay::CheckRoundTimeExpired()
{
if (HasRoundInfinite(true))
if (HasRoundInfinite(SCENARIO_BLOCK_TIME_EXPRIRED))
return;
if (!HasRoundTimeExpired())
@ -3480,7 +3343,7 @@ BOOL CHalfLifeMultiplay::__API_VHOOK(FPlayerCanTakeDamage)(CBasePlayer *pPlayer,
return TRUE;
}
if (CVAR_GET_FLOAT("mp_friendlyfire") != 0 || pAttacker == pPlayer)
if (friendlyfire.value != 0.0f || pAttacker == pPlayer)
{
return TRUE;
}
@ -3720,7 +3583,7 @@ void CHalfLifeMultiplay::__API_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars
ClientPrint(killer->pev, HUD_PRINTCENTER, "#Killed_Teammate");
ClientPrint(killer->pev, HUD_PRINTCONSOLE, "#Game_teammate_kills", UTIL_dtos1(killer->m_iTeamKills));
if (killer->m_iTeamKills == 3 && CVAR_GET_FLOAT("mp_autokick") != 0.0f)
if (killer->m_iTeamKills == 3 && autokick.value != 0.0f)
{
ClientPrint(killer->pev, HUD_PRINTCONSOLE, "#Banned_For_Killing_Teamates");
@ -3778,7 +3641,11 @@ void CHalfLifeMultiplay::__API_VHOOK(PlayerKilled)(CBasePlayer *pVictim, entvars
// update the scores
// killed scores
#ifndef REGAMEDLL_FIXES
MESSAGE_BEGIN(MSG_BROADCAST, gmsgScoreInfo);
#else
MESSAGE_BEGIN(MSG_ALL, gmsgScoreInfo);
#endif
WRITE_BYTE(ENTINDEX(pVictim->edict()));
WRITE_SHORT(int(pVictim->pev->frags));
WRITE_SHORT(pVictim->m_iDeaths);
@ -3949,9 +3816,8 @@ float CHalfLifeMultiplay::__MAKE_VHOOK(FlWeaponRespawnTime)(CBasePlayerItem *pWe
return gpGlobals->time + WEAPON_RESPAWN_TIME;
}
// FlWeaponRespawnTime - Returns 0 if the weapon can respawn
// now, otherwise it returns the time at which it can try
// to spawn again.
// FlWeaponRespawnTime - Returns 0 if the weapon can respawn now,
// otherwise it returns the time at which it can try to spawn again.
float CHalfLifeMultiplay::__MAKE_VHOOK(FlWeaponTryRespawn)(CBasePlayerItem *pWeapon)
{
if (pWeapon && pWeapon->m_iId && (pWeapon->iFlags() & ITEM_FLAG_LIMITINWORLD))
@ -4133,7 +3999,7 @@ BOOL CHalfLifeMultiplay::__MAKE_VHOOK(FAllowFlashlight)()
BOOL CHalfLifeMultiplay::__MAKE_VHOOK(FAllowMonsters)()
{
return CVAR_GET_FLOAT("mp_allowmonsters") != 0;
return allowmonsters.value != 0.0f;
}
LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(CHalfLifeMultiplay, CSGameRules, GoToIntermission);
@ -4853,43 +4719,8 @@ void CHalfLifeMultiplay::__API_VHOOK(ClientUserInfoChanged)(CBasePlayer *pPlayer
void CHalfLifeMultiplay::ServerActivate()
{
// Check to see if there's a mapping info paramater entity
CMapInfo *mi = (CMapInfo *)UTIL_FindEntityByClassname(NULL, "info_map_parameters");
if (mi != nullptr)
{
switch (mi->m_iBuyingStatus)
{
case BUYING_EVERYONE:
m_bCTCantBuy = false;
m_bTCantBuy = false;
ALERT(at_console, "EVERYONE CAN BUY!\n");
break;
case BUYING_ONLY_CTS:
m_bCTCantBuy = false;
m_bTCantBuy = true;
ALERT(at_console, "Only CT's can buy!!\n");
break;
case BUYING_ONLY_TERRORISTS:
m_bCTCantBuy = true;
m_bTCantBuy = false;
ALERT(at_console, "Only T's can buy!!\n");
break;
case BUYING_NO_ONE:
m_bCTCantBuy = true;
m_bTCantBuy = true;
ALERT(at_console, "No one can buy!!\n");
break;
default:
m_bCTCantBuy = false;
m_bTCantBuy = false;
break;
}
m_flBombRadius = mi->m_flBombRadius;
}
if (g_pMapInfo)
g_pMapInfo->CheckMapInfo();
ReadMultiplayCvars();
CheckMapConditions();

View File

@ -87,12 +87,12 @@ void CBasePlatTrain::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
}
else if (FStrEq(pkvd->szKeyName, "movesnd"))
{
m_bMoveSnd = byte(Q_atof(pkvd->szValue));
m_bMoveSnd = (BYTE)Q_atof(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "stopsnd"))
{
m_bStopSnd = byte(Q_atof(pkvd->szValue));
m_bStopSnd = (BYTE)Q_atof(pkvd->szValue);
pkvd->fHandled = TRUE;
}
else if (FStrEq(pkvd->szKeyName, "volume"))

View File

@ -92,7 +92,7 @@ cvar_t *sv_aim = NULL;
TYPEDESCRIPTION CRevertSaved::m_SaveData[] =
{
DEFINE_FIELD(CRevertSaved, m_messageTime, FIELD_FLOAT),
DEFINE_FIELD(CRevertSaved, m_messageTime, FIELD_FLOAT), // These are not actual times, but durations, so save as floats
DEFINE_FIELD(CRevertSaved, m_loadTime, FIELD_FLOAT),
};
@ -1570,7 +1570,7 @@ void CBasePlayer::PackDeadPlayerItems()
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, GiveDefaultItems);
void EXT_ALIGN CBasePlayer::__API_HOOK(GiveDefaultItems)()
void EXT_FUNC CBasePlayer::__API_HOOK(GiveDefaultItems)()
{
RemoveAllItems(FALSE);
m_bHasPrimary = false;
@ -3657,7 +3657,7 @@ void CBasePlayer::PlayerDeathThink()
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, RoundRespawn);
void EXT_ALIGN CBasePlayer::__API_VHOOK(RoundRespawn)()
void EXT_FUNC CBasePlayer::__API_VHOOK(RoundRespawn)()
{
m_canSwitchObserverModes = true;
@ -4003,7 +4003,7 @@ void CBasePlayer::HostageUsed()
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, Jump);
void EXT_ALIGN CBasePlayer::__API_VHOOK(Jump)()
void EXT_FUNC CBasePlayer::__API_VHOOK(Jump)()
{
if (pev->flags & FL_WATERJUMP)
return;
@ -4075,7 +4075,7 @@ NOXREF void FixPlayerCrouchStuck(edict_t *pPlayer)
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, Duck);
void EXT_ALIGN CBasePlayer::__API_VHOOK(Duck)()
void EXT_FUNC CBasePlayer::__API_VHOOK(Duck)()
{
if (pev->button & IN_DUCK)
SetAnimation(PLAYER_WALK);
@ -4216,7 +4216,7 @@ bool CBasePlayer::CanPlayerBuy(bool display)
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, PreThink);
void EXT_ALIGN CBasePlayer::__API_VHOOK(PreThink)()
void EXT_FUNC CBasePlayer::__API_VHOOK(PreThink)()
{
// These buttons have changed this frame
int buttonsChanged = (m_afButtonLast ^ pev->button);
@ -4547,10 +4547,10 @@ void CBasePlayer::CheckTimeBasedDamage()
// use up an antitoxin on poison or nervegas after a few seconds of damage
if ((i == itbd_NerveGas && m_rgbTimeBasedDamage[i] < NERVEGAS_DURATION) || (i == itbd_Poison && m_rgbTimeBasedDamage[i] < POISON_DURATION))
{
if (m_rgItems[ ITEM_ANTIDOTE ])
if (m_rgItems[ ITEM_ID_ANTIDOTE ])
{
m_rgbTimeBasedDamage[i] = 0;
m_rgItems[ ITEM_ANTIDOTE ]--;
m_rgItems[ ITEM_ID_ANTIDOTE ]--;
SetSuitUpdate("!HEV_HEAL4", FALSE, SUIT_REPEAT_OK);
}
}
@ -4792,7 +4792,7 @@ void CBasePlayer::UpdatePlayerSound()
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, PostThink);
void EXT_ALIGN CBasePlayer::__API_VHOOK(PostThink)()
void EXT_FUNC CBasePlayer::__API_VHOOK(PostThink)()
{
// intermission or finale
if (g_fGameOver)
@ -5139,7 +5139,7 @@ void CBasePlayer::SetScoreAttrib(CBasePlayer *dest)
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, Spawn);
void EXT_ALIGN CBasePlayer::__API_VHOOK(Spawn)()
void EXT_FUNC CBasePlayer::__API_VHOOK(Spawn)()
{
int i;
@ -5480,7 +5480,7 @@ void EXT_ALIGN CBasePlayer::__API_VHOOK(Spawn)()
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, Precache);
void EXT_ALIGN CBasePlayer::__API_VHOOK(Precache)()
void EXT_FUNC CBasePlayer::__API_VHOOK(Precache)()
{
#ifndef REGAMEDLL_FIXES
// in the event that the player JUST spawned, and the level node graph
@ -5747,10 +5747,10 @@ void CBasePlayer::SelectLastItem()
if (!m_pLastItem || m_pLastItem == m_pActiveItem)
{
for (int i = 1; i < MAX_ITEMS; ++i)
for (int i = PRIMARY_WEAPON_SLOT; i <= KNIFE_SLOT; ++i)
{
CBasePlayerItem *pItem = m_rgpPlayerItems[i];
if (pItem != NULL && pItem != m_pActiveItem)
if (pItem && pItem != m_pActiveItem)
{
m_pLastItem = pItem;
break;
@ -5768,18 +5768,14 @@ void CBasePlayer::SelectLastItem()
if (HasShield())
{
CBasePlayerWeapon *pWeapon = (CBasePlayerWeapon *)m_pActiveItem;
if (m_pActiveItem != NULL)
CBasePlayerWeapon *pWeapon = static_cast<CBasePlayerWeapon *>(m_pActiveItem);
if (pWeapon)
pWeapon->m_iWeaponState &= ~WPNSTATE_SHIELD_DRAWN;
m_bShieldDrawn = false;
}
CBasePlayerItem *pTemp = m_pActiveItem;
m_pActiveItem = m_pLastItem;
m_pLastItem = pTemp;
SWAP(m_pActiveItem, m_pLastItem);
m_pActiveItem->Deploy();
m_pActiveItem->UpdateItemInfo();
@ -5790,15 +5786,15 @@ void CBasePlayer::SelectLastItem()
}
// HasWeapons - do I have any weapons at all?
BOOL CBasePlayer::HasWeapons()
bool CBasePlayer::HasWeapons()
{
for (int i = 0; i < MAX_ITEM_TYPES; ++i)
for (auto item : m_rgpPlayerItems)
{
if (m_rgpPlayerItems[i] != NULL)
return TRUE;
if (item)
return true;
}
return FALSE;
return false;
}
NOXREF void CBasePlayer::SelectPrevItem(int iItem)
@ -5809,7 +5805,7 @@ NOXREF void CBasePlayer::SelectPrevItem(int iItem)
const char *CBasePlayer::__MAKE_VHOOK(TeamID)()
{
// Not fully connected yet
if (pev == NULL)
if (!pev)
return "";
// return their team name
@ -6003,7 +5999,7 @@ void CBasePlayer::ForceClientDllUpdate()
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, ImpulseCommands);
void EXT_ALIGN CBasePlayer::__API_VHOOK(ImpulseCommands)()
void EXT_FUNC CBasePlayer::__API_VHOOK(ImpulseCommands)()
{
TraceResult tr;
@ -6675,7 +6671,7 @@ LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, UpdateClientData);
// Also called at start of demo recording and playback by
// ForceClientDllUpdate to ensure the demo gets messages
// reflecting all of the HUD state info.
void EXT_ALIGN CBasePlayer::__API_VHOOK(UpdateClientData)()
void EXT_FUNC CBasePlayer::__API_VHOOK(UpdateClientData)()
{
if (m_fInitHUD)
{
@ -7045,7 +7041,7 @@ void CBasePlayer::EnableControl(BOOL fControl)
LINK_HOOK_CLASS_VOID_CHAIN2(CBasePlayer, ResetMaxSpeed);
void EXT_ALIGN CBasePlayer::__API_VHOOK(ResetMaxSpeed)()
void EXT_FUNC CBasePlayer::__API_VHOOK(ResetMaxSpeed)()
{
float speed;
@ -7336,6 +7332,7 @@ void CBasePlayer::UpdateStatusBar()
LINK_HOOK_CLASS_VOID_CHAIN(CBasePlayer, DropPlayerItem, (const char *pszItemName), pszItemName);
// DropPlayerItem - drop the named item, or if no name, the active item.
void CBasePlayer::__API_HOOK(DropPlayerItem)(const char *pszItemName)
{
if (!Q_strlen(pszItemName))
@ -7360,8 +7357,7 @@ void CBasePlayer::__API_HOOK(DropPlayerItem)(const char *pszItemName)
for (int i = 0; i < MAX_ITEM_TYPES; ++i)
{
CBasePlayerItem *pWeapon = m_rgpPlayerItems[i];
while (pWeapon != NULL)
while (pWeapon)
{
if (pszItemName)
{
@ -7482,38 +7478,36 @@ void CBasePlayer::__API_HOOK(DropPlayerItem)(const char *pszItemName)
}
}
BOOL CBasePlayer::HasPlayerItem(CBasePlayerItem *pCheckItem)
// Does the player already have this item?
bool CBasePlayer::HasPlayerItem(CBasePlayerItem *pCheckItem)
{
CBasePlayerItem *pItem = m_rgpPlayerItems[ pCheckItem->iItemSlot() ];
while (pItem != NULL)
auto item = m_rgpPlayerItems[ pCheckItem->iItemSlot() ];
while (item)
{
if (FClassnameIs(pItem->pev, STRING(pCheckItem->pev->classname)))
return TRUE;
if (FClassnameIs(item->pev, STRING(pCheckItem->pev->classname)))
return true;
pItem = pItem->m_pNext;
item = item->m_pNext;
}
return FALSE;
return false;
}
BOOL CBasePlayer::HasNamedPlayerItem(const char *pszItemName)
// Does the player already have this item?
bool CBasePlayer::HasNamedPlayerItem(const char *pszItemName)
{
CBasePlayerItem *pItem;
for (int i = 0; i < MAX_ITEM_TYPES; ++i)
for (auto item : m_rgpPlayerItems)
{
pItem = m_rgpPlayerItems[ i ];
while (pItem != NULL)
while (item)
{
if (!Q_strcmp(pszItemName, STRING(pItem->pev->classname)))
return TRUE;
if (FClassnameIs(item->pev, pszItemName))
return true;
pItem = pItem->m_pNext;
item = item->m_pNext;
}
}
return FALSE;
return false;
}
void CBasePlayer::SwitchTeam()
@ -7776,6 +7770,7 @@ void CDeadHEV::__MAKE_VHOOK(Spawn)()
pev->effects = EF_BRIGHTFIELD;
}
// Corpses have less health
pev->health = 8;
MonsterInitDead();
}
@ -7864,11 +7859,12 @@ void CInfoIntermission::__MAKE_VHOOK(Spawn)()
pev->solid = SOLID_NOT;
pev->effects = EF_NODRAW;
pev->v_angle = g_vecZero;
pev->nextthink = gpGlobals->time + 2.0f;
pev->nextthink = gpGlobals->time + 2.0f; // let targets spawn!
}
void CInfoIntermission::__MAKE_VHOOK(Think)()
{
// find my target
edict_t *pTarget = FIND_ENTITY_BY_TARGETNAME(NULL, STRING(pev->target));
if (!FNullEnt(pTarget))
@ -9375,3 +9371,55 @@ LINK_HOOK_CLASS_CHAIN(bool, CBasePlayer, HasRestrictItem, (ItemID item, ItemRest
bool EXT_FUNC CBasePlayer::__API_HOOK(HasRestrictItem)(ItemID item, ItemRestType type) {
return false;
}
void CBasePlayer::DropSecondary()
{
if (HasShield())
{
if (IsProtectedByShield() && m_pActiveItem) {
((CBasePlayerWeapon *)m_pActiveItem)->SecondaryAttack();
}
m_bShieldDrawn = false;
}
auto item = m_rgpPlayerItems[ PISTOL_SLOT ];
#ifdef REGAMEDLL_ADD
while (item)
{
DropPlayerItem(STRING(item->pev->classname));
item = item->m_pNext;
}
#else
if (item)
{
DropPlayerItem(STRING(item->pev->classname));
}
#endif
}
void CBasePlayer::DropPrimary()
{
if (HasShield()) {
DropShield();
return;
}
auto item = m_rgpPlayerItems[ PRIMARY_WEAPON_SLOT ];
#ifdef REGAMEDLL_ADD
while (item)
{
DropPlayerItem(STRING(item->pev->classname));
item = item->m_pNext;
}
#else
if (item)
{
DropPlayerItem(STRING(item->pev->classname));
}
#endif
}

View File

@ -291,6 +291,7 @@ public:
};
// Multiplayer intermission spots.
class CInfoIntermission: public CPointEntity {
public:
virtual void Spawn();
@ -305,6 +306,7 @@ public:
};
// Dead HEV suit prop
class CDeadHEV: public CBaseMonster {
public:
virtual void Spawn();
@ -320,7 +322,7 @@ public:
#endif
public:
int m_iPose;
int m_iPose; // which sequence to display -- temporary, don't need to save
static char *m_szPoses[4];
};
@ -494,9 +496,9 @@ public:
void HandleSignals();
void DropPlayerItem(const char *pszItemName);
void DropPlayerItem_(const char *pszItemName);
BOOL HasPlayerItem(CBasePlayerItem *pCheckItem);
BOOL HasNamedPlayerItem(const char *pszItemName);
BOOL HasWeapons();
bool HasPlayerItem(CBasePlayerItem *pCheckItem);
bool HasNamedPlayerItem(const char *pszItemName);
bool HasWeapons();
void SelectPrevItem(int iItem);
void SelectNextItem(int iItem);
void SelectLastItem();
@ -598,6 +600,8 @@ public:
void TeamChangeUpdate();
bool HasRestrictItem(ItemID item, ItemRestType type);
bool HasRestrictItem_(ItemID item, ItemRestType type);
void DropSecondary();
void DropPrimary();
#ifdef REGAMEDLL_ADD
CCSPlayer *CSPlayer() const;

View File

@ -1235,7 +1235,6 @@ void CChangeLevel::TouchChangeLevel(CBaseEntity *pOther)
int CChangeLevel::AddTransitionToList(LEVELLIST *pLevelList, int listCount, const char *pMapName, const char *pLandmarkName, edict_t *pentLandmark)
{
int i;
if (!pLevelList || !pMapName || !pLandmarkName || !pentLandmark)
{
return 0;
@ -1260,17 +1259,13 @@ int CChangeLevel::AddTransitionToList(LEVELLIST *pLevelList, int listCount, cons
int BuildChangeList(LEVELLIST *pLevelList, int maxList)
{
CChangeLevel::ChangeList(pLevelList, maxList);
return CChangeLevel::ChangeList(pLevelList, maxList);
}
int CChangeLevel::InTransitionVolume(CBaseEntity *pEntity, char *pVolumeName)
{
edict_t *pentVolume;
if (pEntity->ObjectCaps() & FCAP_FORCE_TRANSITION)
{
return 1;
}
// If you're following another entity, follow it through the transition (weapons follow the player)
if (pEntity->pev->movetype == MOVETYPE_FOLLOW)
@ -1284,7 +1279,7 @@ int CChangeLevel::InTransitionVolume(CBaseEntity *pEntity, char *pVolumeName)
// Unless we find a trigger_transition, everything is in the volume
int inVolume = 1;
pentVolume = FIND_ENTITY_BY_TARGETNAME(NULL, pVolumeName);
edict_t *pentVolume = FIND_ENTITY_BY_TARGETNAME(NULL, pVolumeName);
while (!FNullEnt(pentVolume))
{
CBaseEntity *pVolume = CBaseEntity::Instance(pentVolume);

View File

@ -1422,12 +1422,12 @@ void UTIL_BubbleTrail(Vector from, Vector to, int count)
void UTIL_Remove(CBaseEntity *pEntity)
{
if (pEntity != NULL)
{
if (!pEntity)
return;
pEntity->UpdateOnRemove();
pEntity->pev->flags |= FL_KILLME;
pEntity->pev->targetname = 0;
}
}
NOXREF BOOL UTIL_IsValidEntity(edict_t *pent)
@ -1456,6 +1456,24 @@ void UTIL_PrecacheOther(const char *szClassname)
REMOVE_ENTITY(pent);
}
void UTIL_RestartOther(const char *szClassname)
{
CBaseEntity *pEntity = nullptr;
while ((pEntity = UTIL_FindEntityByClassname(pEntity, szClassname)) != nullptr)
{
pEntity->Restart();
}
}
void UTIL_RemoveOther(const char *szClassname)
{
CBaseEntity *pEntity = nullptr;
while ((pEntity = UTIL_FindEntityByClassname(pEntity, szClassname)) != nullptr)
{
UTIL_Remove(pEntity);
}
}
void UTIL_LogPrintf(const char *fmt, ...)
{
va_list argptr;

View File

@ -311,6 +311,8 @@ void UTIL_BubbleTrail(Vector from, Vector to, int count);
void UTIL_Remove(CBaseEntity *pEntity);
BOOL UTIL_IsValidEntity(edict_t *pent);
void UTIL_PrecacheOther(const char *szClassname);
void UTIL_RestartOther(const char *szClassname);
void UTIL_RemoveOther(const char *szClassname);
void UTIL_LogPrintf(const char *fmt, ...);
float UTIL_DotPoints(const Vector &vecSrc, const Vector &vecCheck, const Vector &vecDir);
void UTIL_StripToken(const char *pKey, char *pDest);

View File

@ -321,10 +321,14 @@ void W_Precache()
// custom items...
// common world objects
#ifndef REGAMEDLL_FIXES
UTIL_PrecacheOther("item_suit");
#endif
UTIL_PrecacheOther("item_battery");
UTIL_PrecacheOther("item_antidote");
#ifndef REGAMEDLL_FIXES
UTIL_PrecacheOther("item_security");
#endif
UTIL_PrecacheOther("item_longjump");
UTIL_PrecacheOther("item_kevlar");
UTIL_PrecacheOther("item_assaultsuit");
@ -2073,6 +2077,11 @@ void CArmoury::__MAKE_VHOOK(Spawn)()
void CArmoury::__MAKE_VHOOK(Restart)()
{
#ifdef REGAMEDLL_FIXES
// This code refers to the mode of Escape. (Because there is relationship to the team Terrorists)
if (CSGameRules()->m_bMapHasEscapeZone)
#endif
{
if (m_iItem == ARMOURY_FLASHBANG || m_iItem == ARMOURY_HEGRENADE)
{
if (!m_bAlreadyCounted)
@ -2080,7 +2089,7 @@ void CArmoury::__MAKE_VHOOK(Restart)()
m_bAlreadyCounted = true;
CSGameRules()->m_iTotalGrenadeCount += m_iInitialCount;
m_iCount = m_iInitialCount;
pev->effects &= ~EF_NODRAW;
Draw();
return;
}
@ -2094,7 +2103,7 @@ void CArmoury::__MAKE_VHOOK(Restart)()
m_bAlreadyCounted = true;
CSGameRules()->m_iTotalArmourCount += m_iInitialCount;
m_iCount = m_iInitialCount;
pev->effects &= ~EF_NODRAW;
Draw();
return;
}
@ -2108,20 +2117,26 @@ void CArmoury::__MAKE_VHOOK(Restart)()
m_bAlreadyCounted = true;
CSGameRules()->m_iTotalGunCount += m_iInitialCount;
m_iCount = m_iInitialCount;
pev->effects &= ~EF_NODRAW;
Draw();
return;
}
float flRatio = float_precision(m_iInitialCount / CSGameRules()->m_iTotalGunCount) * float_precision(CSGameRules()->m_iNumTerrorist) * 0.85;
m_iCount = int(flRatio);
}
if (m_iCount < 1)
{
m_iCount = 1;
}
pev->effects &= ~EF_NODRAW;
#ifdef REGAMEDLL_FIXES
else
{
m_iCount = m_iInitialCount;
}
#endif
if (m_iCount < 1)
m_iCount = 1;
Draw();
}
void CArmoury::__MAKE_VHOOK(Precache)()
@ -2129,6 +2144,25 @@ void CArmoury::__MAKE_VHOOK(Precache)()
PRECACHE_MODEL(armouryItemModels[m_iItem]);
}
void CArmoury::Draw()
{
pev->effects &= ~EF_NODRAW;
#ifdef REGAMEDLL_FIXES
pev->solid = SOLID_TRIGGER;
#endif
}
void CArmoury::Hide()
{
pev->effects |= EF_NODRAW;
#ifdef REGAMEDLL_FIXES
// more not to touch with the world.
pev->solid = SOLID_NOT;
#endif
}
struct ArmouryItemStruct
{
const char *entityName;
@ -2233,9 +2267,7 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther)
}
if (!m_iCount)
{
pev->effects |= EF_NODRAW;
}
Hide();
}
void CArmoury::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
@ -2261,12 +2293,15 @@ LINK_ENTITY_TO_CLASS(armoury_entity, CArmoury, CCSArmoury);
void CBasePlayerWeapon::InstantReload(bool bCanRefillBPAmmo)
{
// if you already reload
if (m_fInReload)
return;
//if (m_fInReload)
// return;
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)
return;
m_fInReload = FALSE;
m_pPlayer->m_flNextAttack = 0;
// complete the reload.
int j = Q_min(iMaxClip() - m_iClip, m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]);
if (j == 0)

View File

@ -148,6 +148,10 @@ public:
public:
void EXPORT ArmouryTouch(CBaseEntity *pOther);
private:
void Draw();
void Hide();
public:
ArmouryItemPack m_iItem;
int m_iCount;

View File

@ -256,9 +256,9 @@ WeaponInfoStruct weaponInfo_default[] =
#ifdef REGAMEDLL_ADD
{ WEAPON_C4, 0, 0, 0, 0, 0, AMMO_NONE, "weapon_c4", nullptr },
{ WEAPON_KNIFE, 0, 0, 0, 0, 0, AMMO_NONE, "weapon_knife", nullptr },
{ WEAPON_HEGRENADE, (WeaponCostType)HEGRENADE_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_hegrenade", nullptr },
{ WEAPON_SMOKEGRENADE, (WeaponCostType)SMOKEGRENADE_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_smokegrenade", nullptr },
{ WEAPON_FLASHBANG, (WeaponCostType)FLASHBANG_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_flashbang", nullptr },
{ WEAPON_HEGRENADE, (WeaponCostType)HEGRENADE_PRICE, 0, 0, 0, 1, AMMO_NONE, "weapon_hegrenade", nullptr },
{ WEAPON_SMOKEGRENADE, (WeaponCostType)SMOKEGRENADE_PRICE, 0, 0, 0, 1, AMMO_NONE, "weapon_smokegrenade", nullptr },
{ WEAPON_FLASHBANG, (WeaponCostType)FLASHBANG_PRICE, 0, 0, 0, 2, AMMO_NONE, "weapon_flashbang", nullptr },
#endif
{ WEAPON_SHIELDGUN, SHIELDGUN_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_shield", nullptr },

View File

@ -1,8 +1,30 @@
//
// Word size dependent definitions
// DAL 1/03
//
#ifndef ARCHTYPES_H
/*
*
* 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.
*
*/#ifndef ARCHTYPES_H
#define ARCHTYPES_H
#ifdef __x86_64__
@ -11,6 +33,8 @@
#if defined( _WIN32 ) && (! defined( __MINGW32__ ))
typedef __int8 int8;
typedef unsigned __int8 uint8;
typedef __int16 int16;
typedef unsigned __int16 uint16;
typedef __int32 int32;
@ -21,7 +45,8 @@ typedef __int32 intp; // intp is an integer that can accomodate a pointer
typedef unsigned __int32 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *)
#else /* _WIN32 */
typedef char int8;
typedef unsigned char uint8;
typedef short int16;
typedef unsigned short uint16;
typedef int int32;

View File

@ -25,25 +25,14 @@
* version.
*
*/
#pragma once
#ifndef _OSCONFIG_H
#define _OSCONFIG_H
#ifdef _WIN32 // WINDOWS
#pragma warning(disable : 4005)
#endif // _WIN32
// disable must return a value
#pragma warning(disable : 4716)
#ifndef _WIN32
// disable missing return statement at end of non-void function
#pragma warning(disable : 1011)
// disable offsetof applied to non-POD (Plain Old Data) types is nonstandard
#pragma warning(disable : 1875)
#endif // _WIN32
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@ -51,22 +40,26 @@
#include <string.h>
#include <time.h>
#include <math.h>
//#include <setjmp.h>
#include <setjmp.h>
#include <assert.h>
#include <algorithm>
#include <deque>
#include <functional>
#ifdef _WIN32 // WINDOWS
#include <windows.h>
//#include <winsock.h>
//#include <wsipx.h> // for support IPX
#include <winsock.h>
#include <wsipx.h> // for support IPX
#define PSAPI_VERSION 1
#include <psapi.h>
#include <nmmintrin.h>
#include <fcntl.h>
//#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <io.h>
#else // _WIN32
//#include <arpa/inet.h>
#include <arpa/inet.h>
#include <ctype.h>
//#include <dirent.h>
#include <dlfcn.h>
@ -80,10 +73,11 @@
#include <pthread.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
//#include <sys/types.h>
//#include <sys/sysinfo.h>
#include <sys/types.h>
#include <sys/sysinfo.h>
#include <unistd.h>
// Deail with stupid macro in kernel.h
@ -91,43 +85,12 @@
#endif // _WIN32
#include <string>
//#include <sstream>
//#include <fstream>
#include <sstream>
#include <fstream>
#include <iomanip>
#ifdef _WIN32 // WINDOWS
#ifndef _STDINT
typedef unsigned __int64 uint64_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int8 uint8_t;
typedef __int64 int64_t;
typedef __int32 int32_t;
typedef __int16 int16_t;
typedef __int8 int8_t;
typedef wchar_t uchar16;
typedef unsigned int uchar32;
#endif
#else // _WIN32
typedef unsigned long long uint64_t;
typedef unsigned int uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
#ifndef __int8_t_defined
typedef long long int64_t;
typedef int int32_t;
typedef short int16_t;
typedef char int8_t;
#endif
typedef unsigned char byte;
typedef unsigned char BYTE;
typedef unsigned short uchar16;
typedef wchar_t uchar32;
#endif // _WIN32
#include <smmintrin.h>
#include <xmmintrin.h>
#ifdef _WIN32 // WINDOWS
#define _CRT_SECURE_NO_WARNINGS
@ -136,20 +99,29 @@
#ifndef CDECL
#define CDECL __cdecl
#endif
#define STDCALL __stdcall
#define HIDDEN
#define NOINLINE __declspec(noinline)
#define ALIGN16 __declspec(align(16))
#define FORCE_STACK_ALIGN
// Attributes to specify an "exported" function, visible from outside the
// DLL.
#undef DLLEXPORT
#define DLLEXPORT __declspec(dllexport)
// WINAPI should be provided in the windows compiler headers.
// It's usually defined to something like "__stdcall".
//inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctlsocket(s, FIONBIO, (u_long*)&m) == 0); }
//inline int SOCKET_MSGLEN(SOCKET s, u_long& r) { return ioctlsocket(s, FIONREAD, (u_long*)&r); }
typedef int socklen_t;
#define SOCKET_FIONBIO(s, m) ioctlsocket(s, FIONBIO, (u_long*)&m)
#define SOCKET_MSGLEN(s, r) ioctlsocket(s, FIONREAD, (u_long*)&r)
#define SIN_GET_ADDR(saddr, r) r = (saddr)->S_un.S_addr
#define SIN_SET_ADDR(saddr, r) (saddr)->S_un.S_addr = (r)
#define SOCKET_CLOSE(s) closesocket(s)
#define SOCKET_AGAIN() (WSAGetLastError() == WSAEWOULDBLOCK)
inline void* sys_allocmem(unsigned int size) {
return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
}
inline void sys_freemem(void* ptr, unsigned int size) {
VirtualFree(ptr, 0, MEM_RELEASE);
}
#else // _WIN32
#ifdef __FUNCTION__
#undef __FUNCTION__
@ -178,9 +150,26 @@
#define ALIGN16 __attribute__((aligned(16)))
#define FORCE_STACK_ALIGN __attribute__((force_align_arg_pointer))
#undef DLLEXPORT
#define DLLEXPORT __attribute__((visibility("default")))
#define WINAPI /* */
//inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctl(s, FIONBIO, (int*)&m) == 0); }
//inline int SOCKET_MSGLEN(SOCKET s, u_long& r) { return ioctl(s, FIONREAD, (int*)&r); }
typedef int SOCKET;
#define INVALID_SOCKET (SOCKET)(~0)
#define SOCKET_FIONBIO(s, m) ioctl(s, FIONBIO, (char*)&m)
#define SOCKET_MSGLEN(s, r) ioctl(s, FIONREAD, (char*)&r)
#define SIN_GET_ADDR(saddr, r) r = (saddr)->s_addr
#define SIN_SET_ADDR(saddr, r) (saddr)->s_addr = (r)
#define SOCKET_CLOSE(s) close(s)
#define SOCKET_AGAIN() (errno == EAGAIN)
#define SOCKET_ERROR -1
inline void* sys_allocmem(unsigned int size) {
return mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
}
inline void sys_freemem(void* ptr, unsigned int size) {
munmap(ptr, size);
}
#define WSAENOPROTOOPT ENOPROTOOPT
#ifndef FALSE
#define FALSE 0
@ -190,14 +179,16 @@
#endif
#endif // _WIN32
// Simplified macro for declaring/defining exported DLL functions. They
// need to be 'extern "C"' so that the C++ compiler enforces parameter
// type-matching, rather than considering routines with mis-matched
// arguments/types to be overloaded functions...
//
// AFAIK, this is os-independent, but it's included here in osdep.h where
// DLLEXPORT is defined, for convenience.
#define C_DLLEXPORT extern "C" DLLEXPORT
#ifdef _WIN32
static const bool __isWindows = true;
static const bool __isLinux = false;
#else
static const bool __isWindows = false;
static const bool __isLinux = true;
#endif
#define EXT_FUNC FORCE_STACK_ALIGN
#define EXT_ALIGN FORCE_STACK_ALIGN
extern void __declspec(noreturn) rehlds_syserror(const char* fmt, ...);
#endif // _OSCONFIG_H

View File

@ -116,7 +116,7 @@ public:
virtual void Blocked(CBaseEntity *pOther) = 0;
virtual CBaseEntity *Respawn() = 0;
virtual void UpdateOwner() = 0;
virtual ~CBaseEntity() = 0; // NOTE: it was replaced on function "virtual void UpdateOwner() {}" which is not used.
virtual BOOL FBecomeProne() = 0;
virtual Vector Center() = 0; // center point of entity
@ -136,7 +136,7 @@ public:
EOFFSET eoffset() { return OFFSET(pev); }
int entindex() { return ENTINDEX(edict()); }
public:
CCSEntity *m_pEntity;
CCSEntity *m_pEntity; // NOTE: it was replaced on member "int *current_ammo" because it is useless.
// We use this variables to store each ammo count.
float currentammo;

View File

@ -665,15 +665,6 @@ typedef struct mapcycle_s
} mapcycle_t;
class CMapInfo: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
public:
int m_iBuyingStatus;
float m_flBombRadius;
};
class CCStrikeGameMgrHelper: public IVoiceGameMgrHelper {
public:
virtual bool CanPlayerHearPlayer(CBasePlayer *pListener, CBasePlayer *pSender) = 0;

View File

@ -35,6 +35,9 @@ enum ItemRestType
};
// constant items
#define ITEM_ID_ANTIDOTE 2
#define ITEM_ID_SECURITY 3
enum ItemID
{
ITEM_NONE = -1,
@ -77,9 +80,7 @@ enum ItemID
ITEM_SODACAN,
ITEM_HEALTHKIT,
ITEM_ANTIDOTE,
ITEM_SECURITY,
ITEM_BATTERY,
ITEM_SUIT
ITEM_BATTERY
};
class CItem: public CBaseEntity {
@ -94,7 +95,7 @@ public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
public:
ItemID m_iType;
int m_iType;
};
class CItemSuit: public CItem {

View File

@ -26,10 +26,16 @@
*
*/
#ifndef H_EXPORT_H
#define H_EXPORT_H
#ifdef _WIN32
#pragma once
#endif
#endif // H_EXPORT_H
class CMapInfo: public CPointEntity
{
public:
virtual ~CMapInfo() = 0;
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
public:
InfoMapBuyParam m_iBuyingStatus;
float m_flBombRadius;
};

View File

@ -274,19 +274,21 @@ public:
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;
};
// Multiplayer intermission spots.
class CInfoIntermission: public CPointEntity {
public:
virtual void Spawn() = 0;
virtual void Think() = 0;
};
// Dead HEV suit prop
class CDeadHEV: public CBaseMonster {
public:
virtual void Spawn() = 0;
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Classify() = 0;
public:
int m_iPose;
int m_iPose; // which sequence to display -- temporary, don't need to save
static char *m_szPoses[4];
};

View File

@ -24,8 +24,7 @@
* you do not wish to do so, delete this exception statement from your
* version.
*
*/
#ifndef ARCHTYPES_H
*/#ifndef ARCHTYPES_H
#define ARCHTYPES_H
#ifdef __x86_64__
@ -34,6 +33,8 @@
#if defined( _WIN32 ) && (! defined( __MINGW32__ ))
typedef __int8 int8;
typedef unsigned __int8 uint8;
typedef __int16 int16;
typedef unsigned __int16 uint16;
typedef __int32 int32;
@ -44,7 +45,8 @@ typedef __int32 intp; // intp is an integer that can accomodate a pointer
typedef unsigned __int32 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *)
#else /* _WIN32 */
typedef char int8;
typedef unsigned char uint8;
typedef short int16;
typedef unsigned short uint16;
typedef int int32;

View File

@ -25,25 +25,14 @@
* version.
*
*/
#pragma once
#ifndef _OSCONFIG_H
#define _OSCONFIG_H
#ifdef _WIN32 // WINDOWS
#pragma warning(disable : 4005)
#endif // _WIN32
// disable must return a value
#pragma warning(disable : 4716)
#ifndef _WIN32
// disable missing return statement at end of non-void function
#pragma warning(disable : 1011)
// disable offsetof applied to non-POD (Plain Old Data) types is nonstandard
#pragma warning(disable : 1875)
#endif // _WIN32
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@ -51,22 +40,26 @@
#include <string.h>
#include <time.h>
#include <math.h>
//#include <setjmp.h>
#include <setjmp.h>
#include <assert.h>
#include <algorithm>
#include <deque>
#include <functional>
#ifdef _WIN32 // WINDOWS
#include <windows.h>
//#include <winsock.h>
//#include <wsipx.h> // for support IPX
#include <winsock.h>
#include <wsipx.h> // for support IPX
#define PSAPI_VERSION 1
#include <psapi.h>
#include <nmmintrin.h>
#include <fcntl.h>
//#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <io.h>
#else // _WIN32
//#include <arpa/inet.h>
#include <arpa/inet.h>
#include <ctype.h>
//#include <dirent.h>
#include <dlfcn.h>
@ -80,10 +73,11 @@
#include <pthread.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
//#include <sys/types.h>
//#include <sys/sysinfo.h>
#include <sys/types.h>
#include <sys/sysinfo.h>
#include <unistd.h>
// Deail with stupid macro in kernel.h
@ -91,43 +85,12 @@
#endif // _WIN32
#include <string>
//#include <sstream>
//#include <fstream>
#include <sstream>
#include <fstream>
#include <iomanip>
#ifdef _WIN32 // WINDOWS
#ifndef _STDINT
typedef unsigned __int64 uint64_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int8 uint8_t;
typedef __int64 int64_t;
typedef __int32 int32_t;
typedef __int16 int16_t;
typedef __int8 int8_t;
typedef wchar_t uchar16;
typedef unsigned int uchar32;
#endif
#else // _WIN32
typedef unsigned long long uint64_t;
typedef unsigned int uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
#ifndef __int8_t_defined
typedef long long int64_t;
typedef int int32_t;
typedef short int16_t;
typedef char int8_t;
#endif
typedef unsigned char byte;
typedef unsigned char BYTE;
typedef unsigned short uchar16;
typedef wchar_t uchar32;
#endif // _WIN32
#include <smmintrin.h>
#include <xmmintrin.h>
#ifdef _WIN32 // WINDOWS
#define _CRT_SECURE_NO_WARNINGS
@ -136,20 +99,29 @@
#ifndef CDECL
#define CDECL __cdecl
#endif
#define STDCALL __stdcall
#define HIDDEN
#define NOINLINE __declspec(noinline)
#define ALIGN16 __declspec(align(16))
#define FORCE_STACK_ALIGN
// Attributes to specify an "exported" function, visible from outside the
// DLL.
#undef DLLEXPORT
#define DLLEXPORT __declspec(dllexport)
// WINAPI should be provided in the windows compiler headers.
// It's usually defined to something like "__stdcall".
//inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctlsocket(s, FIONBIO, (u_long*)&m) == 0); }
//inline int SOCKET_MSGLEN(SOCKET s, u_long& r) { return ioctlsocket(s, FIONREAD, (u_long*)&r); }
typedef int socklen_t;
#define SOCKET_FIONBIO(s, m) ioctlsocket(s, FIONBIO, (u_long*)&m)
#define SOCKET_MSGLEN(s, r) ioctlsocket(s, FIONREAD, (u_long*)&r)
#define SIN_GET_ADDR(saddr, r) r = (saddr)->S_un.S_addr
#define SIN_SET_ADDR(saddr, r) (saddr)->S_un.S_addr = (r)
#define SOCKET_CLOSE(s) closesocket(s)
#define SOCKET_AGAIN() (WSAGetLastError() == WSAEWOULDBLOCK)
inline void* sys_allocmem(unsigned int size) {
return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
}
inline void sys_freemem(void* ptr, unsigned int size) {
VirtualFree(ptr, 0, MEM_RELEASE);
}
#else // _WIN32
#ifdef __FUNCTION__
#undef __FUNCTION__
@ -178,9 +150,26 @@
#define ALIGN16 __attribute__((aligned(16)))
#define FORCE_STACK_ALIGN __attribute__((force_align_arg_pointer))
#undef DLLEXPORT
#define DLLEXPORT __attribute__((visibility("default")))
#define WINAPI /* */
//inline bool SOCKET_FIONBIO(SOCKET s, int m) { return (ioctl(s, FIONBIO, (int*)&m) == 0); }
//inline int SOCKET_MSGLEN(SOCKET s, u_long& r) { return ioctl(s, FIONREAD, (int*)&r); }
typedef int SOCKET;
#define INVALID_SOCKET (SOCKET)(~0)
#define SOCKET_FIONBIO(s, m) ioctl(s, FIONBIO, (char*)&m)
#define SOCKET_MSGLEN(s, r) ioctl(s, FIONREAD, (char*)&r)
#define SIN_GET_ADDR(saddr, r) r = (saddr)->s_addr
#define SIN_SET_ADDR(saddr, r) (saddr)->s_addr = (r)
#define SOCKET_CLOSE(s) close(s)
#define SOCKET_AGAIN() (errno == EAGAIN)
#define SOCKET_ERROR -1
inline void* sys_allocmem(unsigned int size) {
return mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
}
inline void sys_freemem(void* ptr, unsigned int size) {
munmap(ptr, size);
}
#define WSAENOPROTOOPT ENOPROTOOPT
#ifndef FALSE
#define FALSE 0
@ -190,14 +179,16 @@
#endif
#endif // _WIN32
// Simplified macro for declaring/defining exported DLL functions. They
// need to be 'extern "C"' so that the C++ compiler enforces parameter
// type-matching, rather than considering routines with mis-matched
// arguments/types to be overloaded functions...
//
// AFAIK, this is os-independent, but it's included here in osdep.h where
// DLLEXPORT is defined, for convenience.
#define C_DLLEXPORT extern "C" DLLEXPORT
#ifdef _WIN32
static const bool __isWindows = true;
static const bool __isLinux = false;
#else
static const bool __isWindows = false;
static const bool __isLinux = true;
#endif
#define EXT_FUNC /*FORCE_STACK_ALIGN*/
#define EXT_ALIGN FORCE_STACK_ALIGN
#define EXT_FUNC FORCE_STACK_ALIGN
extern void __declspec(noreturn) rehlds_syserror(const char* fmt, ...);
#endif // _OSCONFIG_H

View File

@ -35,7 +35,7 @@
#include "model.h"
#define REHLDS_API_VERSION_MAJOR 2
#define REHLDS_API_VERSION_MINOR 12
#define REHLDS_API_VERSION_MINOR 13
//Steam_NotifyClientConnect hook
typedef IHookChain<qboolean, IGameClient*, const void*, unsigned int> IRehldsHook_Steam_NotifyClientConnect;
@ -280,6 +280,7 @@ struct RehldsFuncs_t {
void(*Steam_NotifyClientDisconnect)(IGameClient* cl);
void(*SV_StartSound)(int recipients, edict_t *entity, int channel, const char *sample, int volume, float attenuation, int flags, int pitch);
bool(*SV_EmitSound2)(edict_t *entity, IGameClient *receiver, int channel, const char *sample, float volume, float attenuation, int flags, int pitch, int emitFlags, const float *pOrigin);
void (* SV_UpdateUserInfo)(IGameClient *pGameClient);
};
class IRehldsApi {

View File

@ -6,14 +6,23 @@
#ifndef HOOK_GAMEDLL
cvar_t voice_serverdebug = { "voice_serverdebug", "0", 0, 0.0f, NULL };
// Set game rules to allow all clients to talk to each other.
// Muted players still can't talk to each other.
cvar_t sv_alltalk = { "sv_alltalk", "0", FCVAR_SERVER, 0.0f, NULL };
#endif
CPlayerBitVec g_PlayerModEnable;
CBitVec< VOICE_MAX_PLAYERS > g_BanMasks[ VOICE_MAX_PLAYERS ];
CBitVec< VOICE_MAX_PLAYERS > g_SentGameRulesMasks[ VOICE_MAX_PLAYERS ];
CBitVec< VOICE_MAX_PLAYERS > g_SentBanMasks[ VOICE_MAX_PLAYERS ];
// These are stored off as CVoiceGameMgr is created and deleted.
CPlayerBitVec g_PlayerModEnable; // Set to 1 for each player if the player wants to use voice in this mod.
// (If it's zero, then the server reports that the game rules are saying the player can't hear anyone).
CBitVec< VOICE_MAX_PLAYERS > g_BanMasks[VOICE_MAX_PLAYERS]; // Tells which players don't want to hear each other.
// These are indexed as clients and each bit represents a client (so player entity is bit + 1).
CBitVec< VOICE_MAX_PLAYERS > g_SentGameRulesMasks[VOICE_MAX_PLAYERS]; // These store the masks we last sent to each client so we can determine if
CBitVec< VOICE_MAX_PLAYERS > g_SentBanMasks[VOICE_MAX_PLAYERS]; // we need to resend them.
CPlayerBitVec g_bWantModEnable;
void VoiceServerDebug(const char *pFmt, ...)
@ -200,6 +209,8 @@ void CVoiceGameMgr::UpdateMasks()
WRITE_LONG(gameRulesMask.GetDWord(dw));
WRITE_LONG(g_BanMasks[ iClient ].GetDWord(dw));
}
// ServerModEnable +1 to buffer size
// WRITE_BYTE(1);
MESSAGE_END();
}

View File

@ -710,8 +710,8 @@ FunctionHook g_FunctionHooks[] =
{ 0x01DA26D0, "_ZN11CBasePlayer13StartObserverE6VectorS0_", mfunc_ptr_cast(&CBasePlayer::StartObserver) },
{ 0x01DA7FF0, "_ZN11CBasePlayer13HandleSignalsEv", mfunc_ptr_cast(&CBasePlayer::HandleSignals) },
{ 0x01DAA850, "_ZN11CBasePlayer14DropPlayerItemEPKc", mfunc_ptr_cast(&CBasePlayer::DropPlayerItem) },
{ 0x01DAAF30, "_ZN11CBasePlayer13HasPlayerItemEP15CBasePlayerItem", mfunc_ptr_cast(&CBasePlayer::HasPlayerItem) },
{ 0x01DAAFC0, "_ZN11CBasePlayer18HasNamedPlayerItemEPKc", mfunc_ptr_cast(&CBasePlayer::HasNamedPlayerItem) },
//{ 0x01DAAF30, "_ZN11CBasePlayer13HasPlayerItemEP15CBasePlayerItem", mfunc_ptr_cast(&CBasePlayer::HasPlayerItem) },
//{ 0x01DAAFC0, "_ZN11CBasePlayer18HasNamedPlayerItemEPKc", mfunc_ptr_cast(&CBasePlayer::HasNamedPlayerItem) },
//{ 0x01DA6920, "_ZN11CBasePlayer10HasWeaponsEv", mfunc_ptr_cast(&CBasePlayer::HasWeapons) }, // NOXREF
//{ 0x01DA6940, "_ZN11CBasePlayer14SelectPrevItemEi", mfunc_ptr_cast(&CBasePlayer::SelectPrevItem) }, // NOXREF
//{ 0x01DA6470, "_ZN11CBasePlayer14SelectNextItemEi", mfunc_ptr_cast(&CBasePlayer::SelectNextItem) }, // NOXREF
@ -6107,7 +6107,7 @@ AddressRef g_DataRefs[] =
{ 0x01E14C90, "_ZL18entity_field_alias", (size_t)&pentity_field_alias },
{ 0x01E14D68, "_ZL18player_field_alias", (size_t)&pplayer_field_alias },
{ 0x01E14DD8, "custom_entity_field_alias", (size_t)&pcustom_entity_field_alias },
{ 0x01E5D718, "_ZL14g_serveractive", (size_t)&pg_serveractive },
//{ 0x01E5D718, "_ZL14g_serveractive", (size_t)&pg_serveractive },
{ 0x01E2A0A8, "_ZL17goodSizedAreaList", (size_t)&pgoodSizedAreaList },
{ 0x01E2A0D8, "TheNavAreaList", (size_t)&pTheNavAreaList },
{ 0x01E29888, "TheNavAreaGrid", (size_t)&pTheNavAreaGrid },

View File

@ -428,6 +428,7 @@
<ClCompile Include="..\dlls\h_export.cpp" />
<ClCompile Include="..\dlls\items.cpp" />
<ClCompile Include="..\dlls\lights.cpp" />
<ClCompile Include="..\dlls\mapinfo.cpp" />
<ClCompile Include="..\dlls\maprules.cpp" />
<ClCompile Include="..\dlls\mortar.cpp" />
<ClCompile Include="..\dlls\mpstubb.cpp" />
@ -991,9 +992,9 @@
<ClInclude Include="..\dlls\h_ai.h" />
<ClInclude Include="..\dlls\h_battery.h" />
<ClInclude Include="..\dlls\h_cycler.h" />
<ClInclude Include="..\dlls\h_export.h" />
<ClInclude Include="..\dlls\items.h" />
<ClInclude Include="..\dlls\lights.h" />
<ClInclude Include="..\dlls\mapinfo.h" />
<ClInclude Include="..\dlls\maprules.h" />
<ClInclude Include="..\dlls\monsterevent.h" />
<ClInclude Include="..\dlls\monsters.h" />
@ -1081,7 +1082,6 @@
<ClInclude Include="..\public\MemPool.h" />
<ClInclude Include="..\public\protected_things.h" />
<ClInclude Include="..\public\regamedll\hookchains.h" />
<ClInclude Include="..\public\regamedll\osconfig.h" />
<ClInclude Include="..\public\regamedll\regamedll_api.h" />
<ClInclude Include="..\public\regamedll\regamedll_interfaces.h" />
<ClInclude Include="..\public\steam\isteamapps.h" />

View File

@ -561,6 +561,9 @@
<ClCompile Include="..\regamedll\regamedll.cpp">
<Filter>regamedll</Filter>
</ClCompile>
<ClCompile Include="..\dlls\mapinfo.cpp">
<Filter>dlls</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\hookers\memory.h">
@ -722,9 +725,6 @@
<ClInclude Include="..\dlls\bot\cs_gamestate.h">
<Filter>dlls\bot</Filter>
</ClInclude>
<ClInclude Include="..\dlls\h_export.h">
<Filter>dlls</Filter>
</ClInclude>
<ClInclude Include="..\pm_shared\pm_debug.h">
<Filter>pm_shared</Filter>
</ClInclude>
@ -1124,8 +1124,8 @@
<ClInclude Include="..\dlls\extdef.h">
<Filter>dlls</Filter>
</ClInclude>
<ClInclude Include="..\public\regamedll\osconfig.h">
<Filter>public\regamedll</Filter>
<ClInclude Include="..\dlls\mapinfo.h">
<Filter>dlls</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>

123
regamedll/public/asmlib.h Normal file
View File

@ -0,0 +1,123 @@
/*************************** asmlib.h ***************************************
* Author: Agner Fog
* Date created: 2003-12-12
* Last modified: 2013-10-04
* Project: asmlib.zip
* Source URL: www.agner.org/optimize
*
* Description:
* Header file for the asmlib function library.
* This library is available in many versions for different platforms.
* See asmlib-instructions.pdf for details.
*
* (c) Copyright 2003 - 2013 by Agner Fog.
* GNU General Public License http://www.gnu.org/licenses/gpl.html
*****************************************************************************/
#ifndef ASMLIB_H
#define ASMLIB_H
/***********************************************************************
Define compiler-specific types and directives
***********************************************************************/
// Define type size_t
#ifndef _SIZE_T_DEFINED
#include "stddef.h"
#endif
// Define integer types with known size: int32_t, uint32_t, int64_t, uint64_t.
// If this doesn't work then insert compiler-specific definitions here:
#if defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1600)
// Compilers supporting C99 or C++0x have stdint.h defining these integer types
#include <stdint.h>
#define INT64_SUPPORTED // Remove this if the compiler doesn't support 64-bit integers
#elif defined(_MSC_VER)
// Older Microsoft compilers have their own definition
typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
#define INT64_SUPPORTED // Remove this if the compiler doesn't support 64-bit integers
#else
// This works with most compilers
typedef signed short int int16_t;
typedef unsigned short int uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
#define INT64_SUPPORTED // Remove this if the compiler doesn't support 64-bit integers
#endif
// Turn off name mangling
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************************
Function prototypes, memory and string functions
***********************************************************************/
void * A_memcpy (void * dest, const void * src, size_t count); // Copy count bytes from src to dest
void * A_memmove(void * dest, const void * src, size_t count); // Same as memcpy, allows overlap between src and dest
void * A_memset (void * dest, int c, size_t count); // Set count bytes in dest to (char)c
int A_memcmp (const void * buf1, const void * buf2, size_t num); // Compares two blocks of memory
size_t GetMemcpyCacheLimit(void); // Data blocks bigger than this will be copied uncached by memcpy and memmove
void SetMemcpyCacheLimit(size_t); // Change limit in GetMemcpyCacheLimit
size_t GetMemsetCacheLimit(void); // Data blocks bigger than this will be stored uncached by memset
void SetMemsetCacheLimit(size_t); // Change limit in GetMemsetCacheLimit
char * A_strcat (char * dest, const char * src); // Concatenate strings dest and src. Store result in dest
char * A_strcpy (char * dest, const char * src); // Copy string src to dest
size_t A_strlen (const char * str); // Get length of zero-terminated string
int A_strcmp (const char * a, const char * b); // Compare strings. Case sensitive
int A_stricmp (const char *string1, const char *string2); // Compare strings. Case insensitive for A-Z only
char * A_strstr (char * haystack, const char * needle); // Search for substring in string
void A_strtolower(char * string); // Convert string to lower case for A-Z only
void A_strtoupper(char * string); // Convert string to upper case for a-z only
size_t A_substring(char * dest, const char * source, size_t pos, size_t len); // Copy a substring for source into dest
size_t A_strspn (const char * str, const char * set); // Find span of characters that belong to set
size_t A_strcspn(const char * str, const char * set); // Find span of characters that don't belong to set
size_t strCountInSet(const char * str, const char * set); // Count characters that belong to set
size_t strcount_UTF8(const char * str); // Counts the number of characters in a UTF-8 encoded string
/***********************************************************************
Function prototypes, miscellaneous functions
***********************************************************************/
uint32_t A_popcount(uint32_t x); // Count 1-bits in 32-bit integer
int RoundD (double x); // Round to nearest or even
int RoundF (float x); // Round to nearest or even
int InstructionSet(void); // Tell which instruction set is supported
char * ProcessorName(void); // ASCIIZ text describing microprocessor
void CpuType(int * vendor, int * family, int * model); // Get CPU vendor, family and model
size_t DataCacheSize(int level); // Get size of data cache
void A_DebugBreak(void); // Makes a debug breakpoint
#ifdef INT64_SUPPORTED
uint64_t ReadTSC(void); // Read microprocessor internal clock (64 bits)
#else
uint32_t ReadTSC(void); // Read microprocessor internal clock (only 32 bits supported by compiler)
#endif
void cpuid_ex (int abcd[4], int eax, int ecx); // call CPUID instruction
static inline void cpuid_abcd (int abcd[4], int eax) {
cpuid_ex(abcd, eax, 0);}
#ifdef __cplusplus
} // end of extern "C"
// Define overloaded versions if compiling as C++
static inline int Round (double x) { // Overload name Round
return RoundD(x);}
static inline int Round (float x) { // Overload name Round
return RoundF(x);}
static inline const char * A_strstr(const char * haystack, const char * needle) {
return A_strstr((char*)haystack, needle);} // Overload A_strstr with const char * version
#endif // __cplusplus
#endif // ASMLIB_H

View File

@ -86,6 +86,10 @@ public:
virtual bool JoinTeam(TeamName team);
virtual void StartObserver(Vector& vecPosition, Vector& vecViewAngle);
virtual void TeamChangeUpdate();
virtual void DropSecondary();
virtual void DropPrimary();
virtual bool HasPlayerItem(CBasePlayerItem *pCheckItem);
virtual bool HasNamedPlayerItem(const char *pszItemName);
CBasePlayer *BasePlayer() const;
public:

View File

@ -27,28 +27,7 @@
// need this for memset
#include <string.h>
// for when we care about how many bits we use
typedef signed char int8;
typedef signed short int16;
#ifdef _WIN32
#ifdef _MSC_VER
typedef signed __int64 int64;
#endif
#elif defined __linux__
typedef long long int64;
#endif
typedef unsigned char uint8;
typedef unsigned short uint16;
#ifdef _WIN32
#ifdef _MSC_VER
typedef unsigned __int64 uint64;
#endif
#elif defined __linux__
typedef unsigned long long uint64;
#endif
#include "archtypes.h"
typedef float float32;
typedef double float64;
@ -86,7 +65,7 @@ FIXME: Enable this when we no longer fear change =)
#define UINT8_MAX ((uint8)~0)
#define UINT16_MAX ((uint16)~0)
#define UINT32_MAX ((uint32_t)~0)
#define UINT32_MAX ((uint32)~0)
#define UINT64_MAX ((uint64)~0)
#define UINT8_MIN 0
@ -259,12 +238,12 @@ inline T WordSwapC(T w)
template <typename T>
inline T DWordSwapC(T dw)
{
uint32_t temp;
uint32 temp;
temp = *((uint32_t *)&dw) >> 24;
temp |= ((*((uint32_t *)&dw) & 0x00FF0000) >> 8);
temp |= ((*((uint32_t *)&dw) & 0x0000FF00) << 8);
temp |= ((*((uint32_t *)&dw) & 0x000000FF) << 24);
temp = *((uint32 *)&dw) >> 24;
temp |= ((*((uint32 *)&dw) & 0x00FF0000) >> 8);
temp |= ((*((uint32 *)&dw) & 0x0000FF00) << 8);
temp |= ((*((uint32 *)&dw) & 0x000000FF) << 24);
return *((T*)&temp);
}
@ -363,12 +342,12 @@ inline float DWordSwapAsm<float>(float f)
inline short BigShort(short val) { int test = 1; return (*(char *)&test == 1) ? WordSwap(val) : val; }
inline uint16 BigWord(uint16 val) { int test = 1; return (*(char *)&test == 1) ? WordSwap(val) : val; }
inline long BigLong(long val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; }
inline uint32_t BigDWord(uint32_t val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; }
inline uint32 BigDWord(uint32 val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; }
inline float BigFloat(float val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; }
inline short LittleShort(short val) { int test = 1; return (*(char *)&test == 1) ? val : WordSwap(val); }
inline uint16 LittleWord(uint16 val) { int test = 1; return (*(char *)&test == 1) ? val : WordSwap(val); }
inline long LittleLong(long val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); }
inline uint32_t LittleDWord(uint32_t val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); }
inline uint32 LittleDWord(uint32 val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); }
inline float LittleFloat(float val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); }
#endif

View File

@ -37,7 +37,6 @@ typedef Vector& VectorRef;
typedef float& FloatRef;
#endif // HOOK_GAMEDLL
#include "h_export.h"
#include "schedule.h"
#include "archtypes.h"
#include "scriptevent.h"
@ -152,6 +151,7 @@ typedef float& FloatRef;
#include "doors.h"
#include "explode.h"
#include "gamerules.h"
#include "mapinfo.h"
#include "career_tasks.h"
#include "training_gamerules.h"
#include "maprules.h"

View File

@ -3,6 +3,7 @@
#include "version/appversion.h"
#include "osconfig.h"
#include "asmlib.h"
#include "sse_mathfun.h"
#include "MemPool.h"

View File

@ -28,15 +28,15 @@
#include "precompiled.h"
void CCSEntity::FireBullets(int iShots, Vector &vecSrc, Vector &vecDirShooting, Vector &vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker) {
void EXT_FUNC CCSEntity::FireBullets(int iShots, Vector &vecSrc, Vector &vecDirShooting, Vector &vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker) {
m_pContainingEntity->FireBullets(iShots, vecSrc, vecDirShooting, vecSpread, flDistance, iBulletType, iTracerFreq, iDamage, pevAttacker);
};
Vector CCSEntity::FireBullets3(Vector &vecSrc, Vector &vecDirShooting, float vecSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand) {
Vector EXT_FUNC CCSEntity::FireBullets3(Vector &vecSrc, Vector &vecDirShooting, float vecSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand) {
return m_pContainingEntity->FireBullets3(vecSrc, vecDirShooting, vecSpread, flDistance, iPenetration, iBulletType, iDamage, flRangeModifier, pevAttacker, bPistol, shared_rand);
};
bool CCSPlayer::JoinTeam(TeamName team)
bool EXT_FUNC CCSPlayer::JoinTeam(TeamName team)
{
CBasePlayer *pPlayer = BasePlayer();
switch (team)
@ -131,7 +131,7 @@ bool CCSPlayer::JoinTeam(TeamName team)
return true;
}
bool CCSPlayer::RemovePlayerItem(const char* pszItemName)
bool EXT_FUNC CCSPlayer::RemovePlayerItem(const char* pszItemName)
{
if (!pszItemName)
return false;
@ -237,15 +237,16 @@ bool CCSPlayer::RemovePlayerItem(const char* pszItemName)
return true;
}
bool bIsC4 = !!FStrEq(pszItemName, "weapon_c4");
for (auto pItem : pPlayer->m_rgpPlayerItems) {
while (pItem != nullptr)
{
if (FClassnameIs(pItem->pev, pszItemName))
{
CBasePlayerWeapon *pWeapon = static_cast<CBasePlayerWeapon *>(pItem);
if (pWeapon->IsWeapon())
{
if (FClassnameIs(pWeapon->pev, "weapon_c4"))
if (pItem->iItemSlot() == PRIMARY_WEAPON_SLOT) {
pPlayer->m_bHasPrimary = false;
}
else if (bIsC4)
{
pPlayer->m_bHasC4 = false;
pPlayer->pev->body = 0;
@ -253,19 +254,19 @@ bool CCSPlayer::RemovePlayerItem(const char* pszItemName)
pPlayer->SetProgressBarTime(0);
}
pWeapon->RetireWeapon();
}
if (pWeapon->iItemSlot() == PRIMARY_WEAPON_SLOT) {
pPlayer->m_bHasPrimary = false;
if (pItem->IsWeapon() && pItem == pPlayer->m_pActiveItem) {
((CBasePlayerWeapon *)pItem)->RetireWeapon();
}
if (pPlayer->RemovePlayerItem(pItem)) {
pPlayer->pev->weapons &= ~(1 << pItem->m_iId);
pPlayer->RemovePlayerItem(pItem);
pItem->Kill();
return true;
}
return false;
}
pItem = pItem->m_pNext;
}
}
@ -273,7 +274,7 @@ bool CCSPlayer::RemovePlayerItem(const char* pszItemName)
return false;
}
void CCSPlayer::GiveNamedItemEx(const char *pszName)
void EXT_FUNC CCSPlayer::GiveNamedItemEx(const char *pszName)
{
CBasePlayer *pPlayer = BasePlayer();
@ -285,7 +286,7 @@ void CCSPlayer::GiveNamedItemEx(const char *pszName)
pPlayer->pev->body = 1;
}
} else if (FStrEq(pszName, "weapon_shield")) {
DropPrimary(pPlayer);
pPlayer->DropPrimary();
pPlayer->GiveShield();
return;
}
@ -293,30 +294,34 @@ void CCSPlayer::GiveNamedItemEx(const char *pszName)
pPlayer->GiveNamedItemEx(pszName);
}
bool CCSPlayer::IsConnected() const { return m_pContainingEntity->has_disconnected == false; }
void CCSPlayer::SetAnimation(PLAYER_ANIM playerAnim) { BasePlayer()->SetAnimation(playerAnim); }
void CCSPlayer::AddAccount(int amount, RewardType type, bool bTrackChange) { BasePlayer()->AddAccount(amount, type, bTrackChange); }
void CCSPlayer::GiveNamedItem(const char *pszName) { BasePlayer()->GiveNamedItem(pszName); }
void CCSPlayer::GiveDefaultItems() { BasePlayer()->GiveDefaultItems(); }
void CCSPlayer::GiveShield(bool bDeploy) { BasePlayer()->GiveShield(bDeploy); }
void CCSPlayer::DropShield(bool bDeploy) { BasePlayer()->DropShield(bDeploy); }
void CCSPlayer::DropPlayerItem(const char *pszItemName) { BasePlayer()->DropPlayerItem(pszItemName); }
void CCSPlayer::RemoveShield() { BasePlayer()->RemoveShield(); }
void CCSPlayer::RemoveAllItems(bool bRemoveSuit) { BasePlayer()->RemoveAllItems(bRemoveSuit ? TRUE : FALSE); }
void CCSPlayer::SetPlayerModel(bool bHasC4) { BasePlayer()->SetPlayerModel(bHasC4 ? TRUE : FALSE); }
void CCSPlayer::SetPlayerModelEx(const char *modelName) { strncpy(m_szModel, modelName, sizeof(m_szModel) - 1); m_szModel[sizeof(m_szModel) - 1] = '\0'; };
void CCSPlayer::SetNewPlayerModel(const char *modelName) { BasePlayer()->SetNewPlayerModel(modelName); }
void CCSPlayer::ClientCommand(const char *cmd, const char *arg1, const char *arg2, const char *arg3) { BasePlayer()->ClientCommand(cmd, arg1, arg2, arg3); }
void CCSPlayer::SetProgressBarTime(int time) { BasePlayer()->SetProgressBarTime(time); }
void CCSPlayer::SetProgressBarTime2(int time, float timeElapsed) { BasePlayer()->SetProgressBarTime2(time, timeElapsed); }
edict_t *CCSPlayer::EntSelectSpawnPoint() { return BasePlayer()->EntSelectSpawnPoint(); }
void CCSPlayer::SendItemStatus() { BasePlayer()->SendItemStatus(); }
void CCSPlayer::SetBombIcon(bool bFlash) { BasePlayer()->SetBombIcon(bFlash ? TRUE : FALSE); }
void CCSPlayer::SetScoreAttrib(CBasePlayer *dest) { BasePlayer()->SetScoreAttrib(dest); }
void CCSPlayer::ReloadWeapons(CBasePlayerItem *pWeapon, bool bForceReload, bool bForceRefill) { BasePlayer()->ReloadWeapons(pWeapon, bForceReload, bForceRefill); }
void CCSPlayer::Observer_SetMode(int iMode) { BasePlayer()->Observer_SetMode(iMode); }
bool CCSPlayer::SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &pSpot) { return BasePlayer()->SelectSpawnSpot(pEntClassName, pSpot); }
bool CCSPlayer::SwitchWeapon(CBasePlayerItem *pWeapon) { return BasePlayer()->SwitchWeapon(pWeapon) != FALSE; }
void CCSPlayer::SwitchTeam() { BasePlayer()->SwitchTeam(); }
void CCSPlayer::StartObserver(Vector& vecPosition, Vector& vecViewAngle) { BasePlayer()->StartObserver(vecPosition, vecViewAngle); }
void CCSPlayer::TeamChangeUpdate() { BasePlayer()->TeamChangeUpdate(); }
bool EXT_FUNC CCSPlayer::IsConnected() const { return m_pContainingEntity->has_disconnected == false; }
void EXT_FUNC CCSPlayer::SetAnimation(PLAYER_ANIM playerAnim) { BasePlayer()->SetAnimation(playerAnim); }
void EXT_FUNC CCSPlayer::AddAccount(int amount, RewardType type, bool bTrackChange) { BasePlayer()->AddAccount(amount, type, bTrackChange); }
void EXT_FUNC CCSPlayer::GiveNamedItem(const char *pszName) { BasePlayer()->GiveNamedItem(pszName); }
void EXT_FUNC CCSPlayer::GiveDefaultItems() { BasePlayer()->GiveDefaultItems(); }
void EXT_FUNC CCSPlayer::GiveShield(bool bDeploy) { BasePlayer()->GiveShield(bDeploy); }
void EXT_FUNC CCSPlayer::DropShield(bool bDeploy) { BasePlayer()->DropShield(bDeploy); }
void EXT_FUNC CCSPlayer::DropPlayerItem(const char *pszItemName) { BasePlayer()->DropPlayerItem(pszItemName); }
void EXT_FUNC CCSPlayer::RemoveShield() { BasePlayer()->RemoveShield(); }
void EXT_FUNC CCSPlayer::RemoveAllItems(bool bRemoveSuit) { BasePlayer()->RemoveAllItems(bRemoveSuit ? TRUE : FALSE); }
void EXT_FUNC CCSPlayer::SetPlayerModel(bool bHasC4) { BasePlayer()->SetPlayerModel(bHasC4 ? TRUE : FALSE); }
void EXT_FUNC CCSPlayer::SetPlayerModelEx(const char *modelName) { strncpy(m_szModel, modelName, sizeof(m_szModel) - 1); m_szModel[sizeof(m_szModel) - 1] = '\0'; };
void EXT_FUNC CCSPlayer::SetNewPlayerModel(const char *modelName) { BasePlayer()->SetNewPlayerModel(modelName); }
void EXT_FUNC CCSPlayer::ClientCommand(const char *cmd, const char *arg1, const char *arg2, const char *arg3) { BasePlayer()->ClientCommand(cmd, arg1, arg2, arg3); }
void EXT_FUNC CCSPlayer::SetProgressBarTime(int time) { BasePlayer()->SetProgressBarTime(time); }
void EXT_FUNC CCSPlayer::SetProgressBarTime2(int time, float timeElapsed) { BasePlayer()->SetProgressBarTime2(time, timeElapsed); }
edict_t *EXT_FUNC CCSPlayer::EntSelectSpawnPoint() { return BasePlayer()->EntSelectSpawnPoint(); }
void EXT_FUNC CCSPlayer::SendItemStatus() { BasePlayer()->SendItemStatus(); }
void EXT_FUNC CCSPlayer::SetBombIcon(bool bFlash) { BasePlayer()->SetBombIcon(bFlash ? TRUE : FALSE); }
void EXT_FUNC CCSPlayer::SetScoreAttrib(CBasePlayer *dest) { BasePlayer()->SetScoreAttrib(dest); }
void EXT_FUNC CCSPlayer::ReloadWeapons(CBasePlayerItem *pWeapon, bool bForceReload, bool bForceRefill) { BasePlayer()->ReloadWeapons(pWeapon, bForceReload, bForceRefill); }
void EXT_FUNC CCSPlayer::Observer_SetMode(int iMode) { BasePlayer()->Observer_SetMode(iMode); }
bool EXT_FUNC CCSPlayer::SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &pSpot) { return BasePlayer()->SelectSpawnSpot(pEntClassName, pSpot); }
bool EXT_FUNC CCSPlayer::SwitchWeapon(CBasePlayerItem *pWeapon) { return BasePlayer()->SwitchWeapon(pWeapon) != FALSE; }
void EXT_FUNC CCSPlayer::SwitchTeam() { BasePlayer()->SwitchTeam(); }
void EXT_FUNC CCSPlayer::StartObserver(Vector& vecPosition, Vector& vecViewAngle) { BasePlayer()->StartObserver(vecPosition, vecViewAngle); }
void EXT_FUNC CCSPlayer::TeamChangeUpdate() { BasePlayer()->TeamChangeUpdate(); }
void EXT_FUNC CCSPlayer::DropSecondary() { BasePlayer()->DropSecondary(); }
void EXT_FUNC CCSPlayer::DropPrimary() { BasePlayer()->DropPrimary(); }
bool EXT_FUNC CCSPlayer::HasPlayerItem(CBasePlayerItem *pCheckItem) { return BasePlayer()->HasPlayerItem(pCheckItem); }
bool EXT_FUNC CCSPlayer::HasNamedPlayerItem(const char *pszItemName) { return BasePlayer()->HasNamedPlayerItem(pszItemName); }

View File

@ -44,7 +44,7 @@
g_ReGameHookchains.m_##className##_##functionName.callChain(&className::functionName##_, this, __VA_ARGS__);\
}
#define LINK_HOOK_CLASS_VOID_CHAIN2(className, functionName)\
void EXT_ALIGN className::functionName() {\
void EXT_FUNC className::functionName() {\
g_ReGameHookchains.m_##className##_##functionName.callChain(&className::functionName##_, this);\
}