Refactoring
Some small fixes and improves
Reworked mp_forcerespawn and hookchain InternalCommand
Fixed fail compilation in VisualStudio
Bump minor version in gradle.properties
Update README.md
This commit is contained in:
s1lentq 2017-01-20 21:52:37 +07:00
parent faff55df78
commit a5dac3c267
34 changed files with 400 additions and 301 deletions

View File

@ -22,25 +22,26 @@ Archive's bin directory contains 2 subdirectories, 'bugfixed' and 'pure'
| CVar | Default | Min | Max | Description |
| :---------------------------- | :-----: | :-: | :----------: | :--------------------------------------------- |
| mp_freeforall | 0 | 0 | 1 | The style of gameplay where there aren't any teams (FFA mode)<br/>`0` disabled <br/>`1` enabled |
| mp_autoteambalance | 1 | 0 | 2 | Auto balancing of teams<br/>`0` disabled <br/>`1` on after next round<br/>`2` on next round |
| mp_autoteambalance | 1 | 0 | 2 | Auto balancing of teams.<br/>`0` disabled <br/>`1` on after next round<br/>`2` on next round |
| mp_buytime | 1.5 | 0.0 | - | Designate the desired amount of buy time for each round. (in minutes)<br />`-1` means no time limit<br />`0` disable buy |
| mp_maxmoney | 16000 | 0 | `0x7FFFFFFF` | The maximum allowable amount of money in the game |
| mp_round_infinite | 0 | 0 | 1 | Flags for fine grained control (choose as many as needed)<br/>`0` disabled<br/>`1` enabled<br/><br/>or flags<br/>`a` block round time round end check<br/>`b` block needed players round end check<br/>`c` block VIP assassination/success round end check<br/>`d` block prison escape round end check<br/>`e` block bomb round end check<br/>`f` block team extermination round end check<br/>`g` block hostage rescue round end check<br/><br/>`Example setting:` "ae" blocks round time and bomb round end checks |
| mp_roundover | 0 | - | - | The round by expired time will be over, if on a map it does not have the scenario of the game.<br/>`0` disabled<br/>`1` enabled |
| mp_hegrenade_penetration | 0 | 0 | 1 | Disable grenade damage through walls<br/>`0` disabled<br/>`1` enabled |
| mp_nadedrops | 0 | 0 | 2 | Drop a grenade after player death<br/>`0` disabled<br/>`1` drop one the grenade<br/>`2` drop an everyone grenades |
| mp_hegrenade_penetration | 0 | 0 | 1 | Disable grenade damage through walls.<br/>`0` disabled<br/>`1` enabled |
| mp_nadedrops | 0 | 0 | 2 | Drop a grenade after player death.<br/>`0` disabled<br/>`1` drop one the grenade<br/>`2` drop an everyone grenades |
| mp_roundrespawn_time | 20 | 0 | - | Player cannot respawn until next round if more than N seconds has elapsed since the beginning round |
| mp_auto_reload_weapons | 0 | 0 | 1 | Automatically reload each weapon on player spawn<br/>`0` disabled<br/>`1` enabled |
| mp_refill_bpammo_weapons | 0 | 0 | 3 | Refill amount of backpack ammo up to the max<br/>`0` disabled<br/>`1` refill backpack ammo on player spawn<br/>`2` refill backpack ammo on player spawn and on the purchase of the item<br/>`3` refill backpack ammo on each weapon reload |
| mp_auto_join_team | 0 | 0 | 1 | Automatically joins the team <br/>`0` disabled<br/>`1` enable (Use in conjunction with the cvar humans_join_team any/CT/T) |
| mp_auto_reload_weapons | 0 | 0 | 1 | Automatically reload each weapon on player spawn.<br/>`0` disabled<br/>`1` enabled |
| mp_refill_bpammo_weapons | 0 | 0 | 3 | Refill amount of backpack ammo up to the max.<br/>`0` disabled<br/>`1` refill backpack ammo on player spawn<br/>`2` refill backpack ammo on player spawn and on the purchase of the item<br/>`3` refill backpack ammo on each weapon reload |
| mp_auto_join_team | 0 | 0 | 1 | Automatically joins the team.<br/>`0` disabled<br/>`1` enable (Use in conjunction with the cvar humans_join_team any/CT/T) |
| mp_max_teamkills | 3 | 0 | - | Maximum number of allowed teamkills before autokick. Used when enabled mp_autokick. |
| mp_fragsleft | - | - | - | Is the number of frags left, if you have set mp_fraglimit. You just type mp_fragsleft in server console, and it tells you the number of frags left depending of mp_fraglimit. |
| mp_fraglimit | 0 | - | - | If set to something other than 0, when anybodys scored reaches mp_fraglimit the server changes map.<br />`0` means no limit |
| mp_timeleft | - | - | - | Is the number of time left before the map changes, if you have set mp_timelimit. You just type mp_timeleft in server console, and it tells you the number of time left depending of mp_timelimit. |
| mp_timelimit | 0 | - | - | Period between map rotations.<br />`0` means no limit |
| mp_forcerespawn | 0 | 0 | - | Players will automatically respawn when killed.<br/>`0` disabled<br/>`>0` time delay to respawn |
| mp_forcerespawn | 0 | 0 | - | Players will automatically respawn when killed.<br/>`0` disabled<br/>`>0.00001` time delay to respawn |
| mp_hostage_hurtable | 1 | 0 | 1 | The hostages can take the damage.<br/>`0` disabled<br/>`1` enabled |
| showtriggers | 0 | 0 | 1 | Debug cvar shows triggers. |
| bot_deathmatch | 0 | 0 | 1 | Set's the mode for the zBot <br/>`0` disabled<br/>`1` enable mode Deathmatch and not allow to do the scenario |
| bot_deathmatch | 0 | 0 | 1 | Set's the mode for the zBot.<br/>`0` disabled<br/>`1` enable mode Deathmatch and not allow to do the scenario |
## How to install zBot for CS 1.6?
* Extract all the files from an [archive](regamedll/extra/zBot/bot_profiles.zip?raw=true)

26
dist/game.cfg vendored
View File

@ -86,16 +86,9 @@ mp_auto_reload_weapons "0"
// Default value: "0"
mp_refill_bpammo_weapons 0
// Set's the mode for the zBot
// 0 - disabled
// 1 - enable mode Deathmatch and not allow to do the scenario
//
// Default value: "0"
bot_deathmatch 0
// Automatically joins the team
// 0 - disabled
// 1 - enable (Use in conjunction with the cvar humans_join_team any/CT/T)
// 1 - enabled (Use in conjunction with the cvar humans_join_team any/CT/T)
//
// Default value: "0"
mp_auto_join_team 0
@ -122,13 +115,26 @@ mp_timelimit 20
// Players will automatically respawn when killed.
// 0 - disabled
// >0 - time delay to respawn
// >0.00001 - time delay to respawn
//
// Default value: "0"
mp_forcerespawn 0
// Debug cvar shows triggers.
// The hostages can take the damage.
// 0 - disabled
// 1 - enabled (default behaviour)
mp_hostage_hurtable 1
// Set's the mode for the zBot
// 0 - disabled
// 1 - enable mode Deathmatch and not allow to do the scenario
//
// Default value: "0"
bot_deathmatch 0
// Debug cvar shows triggers.
// 0 - disabled (default behaviour)
// 1 - enabled
//
// Default value: "0"
showtriggers 0

View File

@ -1,3 +1,3 @@
majorVersion=5
minorVersion=0
minorVersion=1
maintenanceVersion=0

View File

@ -1148,11 +1148,11 @@ void SV_StudioSetupBones(model_t *pModel, float frame, int sequence, const vec_t
{
if (!Q_strcmp(pbones[i].name, "Bip01 Spine"))
{
bCopy = 0;
bCopy = false;
}
else if (!Q_strcmp(pbones[pbones[i].parent].name, "Bip01 Pelvis"))
{
bCopy = 1;
bCopy = true;
}
if (bCopy)

View File

@ -158,7 +158,7 @@ LINK_ENTITY_TO_CLASS(func_illusionary, CFuncIllusionary, CCSFuncIllusionary);
void CFuncIllusionary::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd)
{
//skin is used for content type
// skin is used for content type
if (FStrEq(pkvd->szKeyName, "skin"))
{
pev->skin = Q_atoi(pkvd->szValue);

View File

@ -65,7 +65,7 @@ CCSBotManager::CCSBotManager()
const char *dataFile = SharedParse(dataPointer);
const char *token;
while (dataFile != NULL)
while (dataFile)
{
token = SharedGetToken();
char *clone = CloneString(token);
@ -627,7 +627,7 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd)
break;
}
if (found != NULL)
if (found)
{
isAmbiguous = true;
}
@ -669,10 +669,10 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd)
{
// tell the first bot we find to go to our marked area
CNavArea *area = GetMarkedArea();
if (area != NULL)
if (area)
{
CBaseEntity *pEntity = NULL;
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")) != NULL)
while ((pEntity = UTIL_FindEntityByClassname(pEntity, "player")))
{
if (!pEntity->IsPlayer())
continue;
@ -685,7 +685,7 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd)
if (playerOrBot->IsBot())
{
CCSBot *bot = static_cast<CCSBot *>(playerOrBot);
if (bot != NULL)
if (bot)
{
bot->MoveTo(&area->m_center, FASTEST_ROUTE);
}
@ -811,7 +811,7 @@ bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole)
{
// in career, ignore humans
bool ignoreHumans = false;
if (CSGameRules() != NULL && CSGameRules()->IsCareer())
if (CSGameRules() && CSGameRules()->IsCareer())
ignoreHumans = true;
if (UTIL_IsNameTaken(CMD_ARGV(1), ignoreHumans))
@ -940,7 +940,7 @@ void CCSBotManager::MaintainBotQuota()
}
else
{
if (CSGameRules() != NULL && !CSGameRules()->IsCareer())
if (CSGameRules() && !CSGameRules()->IsCareer())
return;
bool humansAreCTs = (Q_strcmp(humans_join_team.string, "CT") == 0);
@ -1091,7 +1091,8 @@ void CCSBotManager::ValidateMapData()
m_zone[ m_zoneCount ].m_center = (isLegacy) ? entity->pev->origin : (entity->pev->absmax + entity->pev->absmin) / 2.0f;
m_zone[ m_zoneCount ].m_isLegacy = isLegacy;
m_zone[ m_zoneCount ].m_index = m_zoneCount;
m_zone[ m_zoneCount++ ].m_entity = entity;
m_zone[ m_zoneCount ].m_entity = entity;
m_zoneCount++;
}
else
CONSOLE_ECHO("Warning: Too many zones, some will be ignored.\n");
@ -1104,8 +1105,13 @@ void CCSBotManager::ValidateMapData()
{
entity = NULL;
while ((entity = UTIL_FindEntityByClassname(entity, "info_player_start")) != NULL)
while ((entity = UTIL_FindEntityByClassname(entity, "info_player_start")))
{
#ifdef REGAMEDLL_FIXES
if (m_zoneCount >= MAX_ZONES)
break;
#endif
if (FNullEnt(entity->edict()))
break;
@ -1114,7 +1120,8 @@ void CCSBotManager::ValidateMapData()
m_zone[ m_zoneCount ].m_center = entity->pev->origin;
m_zone[ m_zoneCount ].m_isLegacy = true;
m_zone[ m_zoneCount ].m_index = m_zoneCount;
m_zone[ m_zoneCount++ ].m_entity = entity;
m_zone[ m_zoneCount ].m_entity = entity;
m_zoneCount++;
}
else
CONSOLE_ECHO("Warning: Too many zones, some will be ignored.\n");
@ -1207,9 +1214,8 @@ bool CCSBotManager::AddBot(const BotProfile *profile, BotProfileTeamType team)
if (HandleMenu_ChooseTeam(pBot, nTeamSlot))
{
int skin = profile->GetSkin();
if (!skin)
skin = 6;// MODEL_GIGN?
skin = 6;
HandleMenu_ChooseAppearance(pBot, skin);

View File

@ -48,7 +48,7 @@ void DefuseBombState::__MAKE_VHOOK(OnUpdate)(CCSBot *me)
if (!TheCSBots()->IsBombPlanted())
{
#ifdef REGAMEDLL_ADD
if (CSGameRules()->HasRoundInfinite(SCENARIO_BLOCK_BOMB)) {
if (HasRoundInfinite(SCENARIO_BLOCK_BOMB)) {
me->GetGameState()->Reset();
me->Hunt();
return;

View File

@ -26,7 +26,7 @@ DLL_FUNCTIONS gFunctionTable =
&ClientDisconnect,
&ClientKill,
&ClientPutInServer,
&ClientCommand,
&ClientCommand_,
&ClientUserInfoChanged,
&ServerActivate,
&ServerDeactivate,

View File

@ -85,8 +85,6 @@
#define CLASS_VEHICLE 14
#define CLASS_BARNACLE 99 // special because no one pays attention to it, and it eats a wide cross-section of creatures.
#define GIB_HEALTH_VALUE -30
#define ROUTE_SIZE 8
#define MAX_OLD_ENEMIES 4
@ -183,6 +181,7 @@
#define GIB_NORMAL 0 // gib if entity was overkilled
#define GIB_NEVER 1 // never gib, no matter how much death damage is done ( freezing, etc )
#define GIB_ALWAYS 2 // always gib ( Houndeye Shock, Barnacle Bite )
#define GIB_HEALTH_VALUE -30
#define SF_ITEM_USE_ONLY 256

View File

@ -152,7 +152,6 @@ void respawn(entvars_t *pev, BOOL fCopyCorpse)
CSGameRules()->MarkSpawnSkipped();
CBasePlayer *pPlayer = GetClassPtr<CCSPlayer>((CBasePlayer *)pev);
if (CSGameRules()->IsCareer() && CSGameRules()->ShouldSkipSpawn() && pPlayer->IsAlive())
g_skipCareerInitialSpawn = true;
@ -215,7 +214,7 @@ void EXT_FUNC __API_HOOK(ShowVGUIMenu)(CBasePlayer *pPlayer, int MenuType, int B
#ifdef REGAMEDLL_ADD
if (CSGameRules()->ShouldSkipShowMenu()) {
CSGameRules()->MarkShowMenuSkipped();
pPlayer->m_iMenu = Menu_OFF;
pPlayer->ResetMenu();
return;
}
@ -1453,14 +1452,20 @@ void EXT_FUNC __API_HOOK(HandleMenu_ChooseAppearance)(CBasePlayer *player, int s
appearance.model_name_index = 9;
}
#ifdef REGAMEDLL_FIXES
player->ResetMenu();
#else
player->m_iMenu = Menu_OFF;
#endif
// Reset the player's state
if (player->m_iJoiningState == JOINED)
switch (player->m_iJoiningState)
{
case JOINED:
CSGameRules()->CheckWinConditions();
}
else if (player->m_iJoiningState == PICKINGTEAM)
break;
case PICKINGTEAM:
{
player->m_iJoiningState = GETINTOGAME;
@ -1471,6 +1476,8 @@ void EXT_FUNC __API_HOOK(HandleMenu_ChooseAppearance)(CBasePlayer *player, int s
CSGameRules()->CheckWinConditions();
}
}
break;
}
}
player->pev->body = 0;
@ -1713,7 +1720,6 @@ BOOL EXT_FUNC __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
)
{
int humanTeam = UNASSIGNED;
if (!Q_stricmp(humans_join_team.string, "CT"))
{
humanTeam = CT;
@ -1763,11 +1769,9 @@ BOOL EXT_FUNC __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
player->pev->solid = SOLID_NOT;
player->pev->movetype = MOVETYPE_NOCLIP;
player->pev->effects = EF_NODRAW;
player->pev->effects |= EF_NOINTERP;
player->pev->effects = (EF_NODRAW | EF_NOINTERP);
player->pev->takedamage = DAMAGE_NO;
player->pev->deadflag = DEAD_DEAD;
player->pev->velocity = g_vecZero;
player->pev->punchangle = g_vecZero;
player->m_bHasNightVision = false;
@ -1775,10 +1779,18 @@ BOOL EXT_FUNC __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
player->m_fDeadTime = 0;
player->has_disconnected = false;
#ifdef REGAMEDLL_ADD
player->m_iJoiningState = PICKINGTEAM;
#else
player->pev->velocity = g_vecZero;
player->m_iJoiningState = GETINTOGAME;
#endif
player->SendItemStatus();
#ifndef REGAMEDLL_ADD
SET_CLIENT_MAXSPEED(ENT(player->pev), 1);
#endif
SET_MODEL(ENT(player->pev), "models/player.mdl");
}
@ -2286,25 +2298,9 @@ BOOL HandleRadioAliasCommands(CBasePlayer *pPlayer, const char *pszCommand)
return FALSE;
}
bool EXT_FUNC InternalCommand(edict_t *pEntity, const char *cmd) {
return true;
}
// Use CMD_ARGV, CMD_ARGV, and CMD_ARGC to get pointers the character string command.
void EXT_FUNC ClientCommand(edict_t *pEntity)
void EXT_FUNC InternalCommand(edict_t *pEntity, const char *pcmd, const char *parg1)
{
const char *pcmd = CMD_ARGV_(0);
const char *pstr = NULL;
// Is the client spawned yet?
if (!pEntity->pvPrivateData)
return;
#ifdef REGAMEDLL_API
if (!g_ReGameHookchains.m_InternalCommand.callChain(InternalCommand, pEntity, pcmd))
return;
#endif
entvars_t *pev = &pEntity->v;
CBasePlayer *player = GetClassPtr<CCSPlayer>((CBasePlayer *)pev);
@ -2351,15 +2347,14 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
int iVoteID;
int iVoteFail = 0;
int iNumArgs = CMD_ARGC_();
const char *pszArg1 = CMD_ARGV_(1);
int iVoteLength = Q_strlen(pszArg1);
int iVoteLength = Q_strlen(parg1);
if (iNumArgs != 2 || iVoteLength <= 0 || iVoteLength > 6)
{
iVoteFail = 1;
}
iVoteID = Q_atoi(pszArg1);
iVoteID = Q_atoi(parg1);
if (iVoteID <= 0)
{
iVoteFail = 1;
@ -2439,15 +2434,14 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
int iFailed = 0;
int iNumArgs = CMD_ARGC_();
const char *pszArg1 = CMD_ARGV_(1);
int iVoteLength = Q_strlen(pszArg1);
int iVoteLength = Q_strlen(parg1);
if (iNumArgs != 2 || iVoteLength > 5)
{
iFailed = 1;
}
int iVoteID = Q_atoi(pszArg1);
int iVoteID = Q_atoi(parg1);
if (iVoteID < 1 || iVoteID > MAX_VOTE_MAPS)
{
iFailed = 1;
@ -2560,7 +2554,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
}
else if (FStrEq(pcmd, "menuselect"))
{
int slot = Q_atoi(CMD_ARGV_(1));
int slot = Q_atoi(parg1);
if (player->m_iJoiningState == JOINED || (player->m_iMenu != Menu_ChooseAppearance && player->m_iMenu != Menu_ChooseTeam))
{
if (slot == 10)
@ -2901,8 +2895,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
else if (FStrEq(pcmd, "specmode"))
{
// new spectator mode
int mode = Q_atoi(CMD_ARGV_(1));
int mode = Q_atoi(parg1);
if (player->IsObserver() && player->CanSwitchObserverModes())
player->Observer_SetMode(mode);
else
@ -2916,14 +2909,13 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
}
else if (FStrEq(pcmd, "spec_set_ad"))
{
float val = Q_atof(CMD_ARGV_(1));
float val = Q_atof(parg1);
player->SetObserverAutoDirector(val > 0.0f);
}
else if (FStrEq(pcmd, "follownext"))
{
// follow next player
int arg = Q_atoi(CMD_ARGV_(1));
int arg = Q_atoi(parg1);
if (player->IsObserver() && player->CanSwitchObserverModes())
{
player->Observer_FindNextPlayer(arg != 0);
@ -2933,7 +2925,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
{
if (player->IsObserver() && player->CanSwitchObserverModes())
{
player->Observer_FindNextPlayer(false, CMD_ARGV_(1));
player->Observer_FindNextPlayer(false, parg1);
}
}
else
@ -2949,7 +2941,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
if (FStrEq(pcmd, "mp_debug"))
{
UTIL_SetDprintfFlags(CMD_ARGV_(1));
UTIL_SetDprintfFlags(parg1);
}
else if (FStrEq(pcmd, "jointeam"))
{
@ -2959,12 +2951,16 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
return;
}
int slot = Q_atoi(CMD_ARGV_(1));
int slot = Q_atoi(parg1);
if (HandleMenu_ChooseTeam(player, slot))
{
if (slot == MENU_SLOT_TEAM_VIP || slot == MENU_SLOT_TEAM_SPECT || player->m_bIsVIP)
{
#ifdef REGAMEDLL_FIXES
player->ResetMenu();
#else
player->m_iMenu = Menu_OFF;
#endif
}
else
player->m_iMenu = Menu_ChooseAppearance;
@ -2980,8 +2976,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
}
else if (FStrEq(pcmd, "joinclass"))
{
int slot = Q_atoi(CMD_ARGV_(1));
int slot = Q_atoi(parg1);
if (player->m_iMenu != Menu_ChooseAppearance)
{
ClientPrint(player->pev, HUD_PRINTCENTER, "#Command_Not_Available");
@ -3082,7 +3077,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
player->DropShield();
}
else
player->DropPlayerItem(CMD_ARGV_(1));
player->DropPlayerItem(parg1);
}
else if (FStrEq(pcmd, "fov"))
{
@ -3095,7 +3090,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
}
else if (FStrEq(pcmd, "use"))
{
GetClassPtr<CCSPlayer>((CBasePlayer *)pev)->SelectItem(CMD_ARGV_(1));
GetClassPtr<CCSPlayer>((CBasePlayer *)pev)->SelectItem(parg1);
}
else if (((pstr = Q_strstr(pcmd, "weapon_"))) && (pstr == pcmd))
{
@ -3184,7 +3179,7 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
{
if (CMD_ARGC_() == 2)
{
player->InitRebuyData(CMD_ARGV_(1));
player->InitRebuyData(parg1);
bool oldval = g_bClientPrintEnable;
g_bClientPrintEnable = false;
@ -3242,6 +3237,19 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
}
}
// Use CMD_ARGV, CMD_ARGV, and CMD_ARGC to get pointers the character string command.
void EXT_FUNC ClientCommand_(edict_t *pEntity)
{
const char *pcmd = CMD_ARGV_(0);
const char *parg1 = CMD_ARGV_(1);
// Is the client spawned yet?
if (!pEntity->pvPrivateData)
return;
g_ReGameHookchains.m_InternalCommand.callChain(InternalCommand, pEntity, pcmd, parg1);
}
// called after the player changes userinfo - gives dll a chance to modify it before it gets sent into the rest of the engine.
void EXT_FUNC ClientUserInfoChanged(edict_t *pEntity, char *infobuffer)
{
@ -3252,7 +3260,7 @@ void EXT_FUNC ClientUserInfoChanged(edict_t *pEntity, char *infobuffer)
CBasePlayer *pPlayer = CBasePlayer::Instance(pEntity);
char *szBufferName = GET_KEY_VALUE(infobuffer, "name");
// msg everyone if someone changes their name, and it isn't the first time (changing no name to current name)
// msg everyone if someone changes their name, and it isn't the first time (changing no name to current name)
if (pEntity->v.netname && STRING(pEntity->v.netname)[0] != '\0' && !FStrEq(STRING(pEntity->v.netname), szBufferName))
{
char szName[32];
@ -4239,7 +4247,7 @@ void Entity_Encode(struct delta_s *pFields, const unsigned char *from, const uns
t = (entity_state_t *)to;
// Never send origin to local player, it's sent with more resolution in clientdata_t structure
localplayer = (t->number - 1) == ENGINE_CURRENT_PLAYER();
localplayer = (t->number - 1) == ENGINE_CURRENT_PLAYER();
if (localplayer)
{
@ -4295,7 +4303,7 @@ void Player_Encode(struct delta_s *pFields, const unsigned char *from, const uns
t = (entity_state_t *)to;
// Never send origin to local player, it's sent with more resolution in clientdata_t structure
localplayer = (t->number - 1) == ENGINE_CURRENT_PLAYER();
localplayer = (t->number - 1) == ENGINE_CURRENT_PLAYER();
if (localplayer)
{

View File

@ -153,7 +153,7 @@ CBaseEntity *EntityFromUserID(int userID);
int CountPlayersInServer();
BOOL HandleBuyAliasCommands(CBasePlayer *pPlayer, const char *pszCommand);
BOOL HandleRadioAliasCommands(CBasePlayer *pPlayer, const char *pszCommand);
void ClientCommand(edict_t *pEntity);
void ClientCommand_(edict_t *pEntity);
void ClientUserInfoChanged(edict_t *pEntity, char *infobuffer);
void ServerDeactivate();
void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax);
@ -197,14 +197,10 @@ inline const char *GetTeamName(int team)
{
switch (team)
{
case CT:
return "CT";
case TERRORIST:
return "TERRORIST";
case SPECTATOR:
return "SPECTATOR";
default:
return "UNASSIGNED";
case CT: return "CT";
case TERRORIST: return "TERRORIST";
case SPECTATOR: return "SPECTATOR";
default: return "UNASSIGNED";
}
}

View File

@ -1973,8 +1973,14 @@ void CItemSoda::CanTouch(CBaseEntity *pOther)
return;
#endif
#ifdef REGAMEDLL_FIXES
// spoit sound here
pPlayer->TakeHealth(1, DMG_GENERIC); // a bit of health.
// if we can't take hp, go out
if (!pPlayer->TakeHealth(1, DMG_GENERIC)) // a bit of health.
return;
#else
pPlayer->TakeHealth(1, DMG_GENERIC);
#endif
if (!FNullEnt(pev->owner))
{

View File

@ -381,7 +381,7 @@ void CBreakable::__MAKE_VHOOK(Precache)()
pGibName = STRING(m_iszGibModel);
}
if (pGibName != NULL)
if (pGibName)
{
m_idShard = PRECACHE_MODEL((char *)pGibName);
}
@ -693,7 +693,7 @@ void CBreakable::Die()
}
cFlag = BREAK_GLASS;
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_BREAK_GLASS, this);
}
@ -708,7 +708,7 @@ void CBreakable::Die()
}
cFlag = BREAK_WOOD;
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_BREAK_WOOD, this);
}
@ -725,7 +725,7 @@ void CBreakable::Die()
}
cFlag = BREAK_METAL;
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_BREAK_METAL, this);
}
@ -741,7 +741,7 @@ void CBreakable::Die()
}
cFlag = BREAK_FLESH;
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_BREAK_FLESH, this);
}
@ -758,7 +758,7 @@ void CBreakable::Die()
}
cFlag = BREAK_CONCRETE;
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_BREAK_CONCRETE, this);
}

View File

@ -767,7 +767,6 @@ public:
// has a style of gameplay when aren't any teams
bool IsFreeForAll() const;
bool HasRoundInfinite(int flags = 0) const;
VFUNC bool HasRoundTimeExpired();
VFUNC bool IsBombPlanted();
@ -946,7 +945,7 @@ inline bool CHalfLifeMultiplay::IsFreeForAll() const
return false;
}
inline bool CHalfLifeMultiplay::HasRoundInfinite(int flags) const
inline bool HasRoundInfinite(int flags = 0)
{
#ifdef REGAMEDLL_ADD
if (round_infinite.string[0] == '1')
@ -967,7 +966,7 @@ void SV_Career_EndRound_f();
void SV_CareerAddTask_f();
void SV_CareerMatchLimit_f();
void Broadcast(const char *sentence);
char *GetTeam(int teamNo);
char *GetTeam(int team);
void EndRoundMessage(const char *sentence, int event);
void DestroyMapCycle(mapcycle_t *cycle);

View File

@ -580,32 +580,33 @@ void CHostage::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir
BOOL CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{
float flActualDamage;
CBasePlayer *pAttacker = NULL;
#ifdef REGAMEDLL_ADD
if (hostagehurtable.value <= 0)
return FALSE;
#endif
flActualDamage = GetModifiedDamage(flDamage, m_LastHitGroup);
float flActualDamage = GetModifiedDamage(flDamage, m_LastHitGroup);
if (flActualDamage > pev->health)
flActualDamage = pev->health;
pev->health -= flActualDamage;
if (m_improv != NULL)
if (m_improv)
{
m_improv->OnInjury(flActualDamage);
}
PlayPainSound();
if (pevAttacker != NULL)
CBasePlayer *pAttacker = NULL;
if (pevAttacker)
{
CBaseEntity *pAttackingEnt = GetClassPtr<CCSEntity>((CBaseEntity *)pevAttacker);
if (pAttackingEnt->Classify() == CLASS_VEHICLE)
{
CBaseEntity *pDriver = ((CFuncVehicle *)pAttackingEnt)->m_pDriver;
if (pDriver != NULL)
if (pDriver)
{
pevAttacker = pDriver->pev;
}
@ -622,11 +623,11 @@ BOOL CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevA
m_flFlinchTime = gpGlobals->time + 0.75f;
SetFlinchActivity();
if (pAttacker != NULL)
if (pAttacker)
{
pAttacker->AddAccount(-20 * int(flActualDamage), RT_HOSTAGE_DAMAGED);
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_HOSTAGE_DAMAGED, this, pAttacker);
}
@ -659,12 +660,12 @@ BOOL CHostage::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevA
pev->deadflag = DEAD_DEAD;
pev->solid = SOLID_NOT;
if (TheBots != NULL)
if (TheBots)
{
TheBots->OnEvent(EVENT_HOSTAGE_KILLED, this, pAttacker);
}
if (m_improv != NULL)
if (m_improv)
{
m_improv->Chatter(HOSTAGE_CHATTER_DEATH_CRY);
}

View File

@ -79,7 +79,7 @@ void CWorldItem::__MAKE_VHOOK(Spawn)()
break;
}
if (pEntity != NULL)
if (pEntity)
{
pEntity->pev->target = pev->target;
pEntity->pev->targetname = pev->targetname;
@ -369,7 +369,7 @@ BOOL CItemKevlar::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
WRITE_BYTE(0);
MESSAGE_END();
if (TheTutor != NULL)
if (TheTutor)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
@ -411,7 +411,7 @@ BOOL CItemAssaultSuit::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
WRITE_BYTE(1);
MESSAGE_END();
if (TheTutor != NULL)
if (TheTutor)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}
@ -459,7 +459,7 @@ BOOL CItemThighPack::__MAKE_VHOOK(MyTouch)(CBasePlayer *pPlayer)
pPlayer->SendItemStatus();
EMIT_SOUND(pPlayer->edict(), CHAN_VOICE, "items/kevlar.wav", VOL_NORM, ATTN_NORM);
if (TheTutor != NULL)
if (TheTutor)
{
TheTutor->OnEvent(EVENT_PLAYER_BOUGHT_SOMETHING, pPlayer);
}

View File

@ -239,78 +239,78 @@ void Broadcast(const char *sentence)
MESSAGE_END();
}
char *GetTeam(int teamNo)
char *GetTeam(int team)
{
switch (teamNo)
switch (team)
{
case TERRORIST:
return "TERRORIST";
case CT:
return "CT";
case SPECTATOR:
return "SPECTATOR";
default:
break;
case CT: return "CT";
case TERRORIST: return "TERRORIST";
case SPECTATOR: return "SPECTATOR";
default: return "";
}
return "";
}
void CHalfLifeMultiplay::EndRoundMessage(const char *sentence, int event)
{
char *team = NULL;
const char *message = &(sentence[1]);
const char *message = sentence;
bool bTeamTriggered = true;
UTIL_ClientPrintAll(HUD_PRINTCENTER, sentence);
if (sentence[0] == '#')
message = sentence + 1;
switch (event)
if (sentence[0])
{
case ROUND_TARGET_BOMB:
case ROUND_VIP_ASSASSINATED:
case ROUND_TERRORISTS_ESCAPED:
case ROUND_TERRORISTS_WIN:
case ROUND_HOSTAGE_NOT_RESCUED:
case ROUND_VIP_NOT_ESCAPED:
team = GetTeam(TERRORIST);
// tell bots the terrorists won the round
if (TheBots)
{
TheBots->OnEvent(EVENT_TERRORISTS_WIN);
}
break;
case ROUND_VIP_ESCAPED:
case ROUND_CTS_PREVENT_ESCAPE:
case ROUND_ESCAPING_TERRORISTS_NEUTRALIZED:
case ROUND_BOMB_DEFUSED:
case ROUND_CTS_WIN:
case ROUND_ALL_HOSTAGES_RESCUED:
case ROUND_TARGET_SAVED:
case ROUND_TERRORISTS_NOT_ESCAPED:
team = GetTeam(CT);
// tell bots the CTs won the round
if (TheBots)
{
TheBots->OnEvent(EVENT_CTS_WIN);
}
break;
default:
bTeamTriggered = false;
// tell bots the round was a draw
if (TheBots)
{
TheBots->OnEvent(EVENT_ROUND_DRAW);
}
break;
}
UTIL_ClientPrintAll(HUD_PRINTCENTER, sentence);
if (bTeamTriggered)
{
UTIL_LogPrintf("Team \"%s\" triggered \"%s\" (CT \"%i\") (T \"%i\")\n", team, message, m_iNumCTWins, m_iNumTerroristWins);
}
else
{
UTIL_LogPrintf("World triggered \"%s\" (CT \"%i\") (T \"%i\")\n", message, m_iNumCTWins, m_iNumTerroristWins);
switch (event)
{
case ROUND_TARGET_BOMB:
case ROUND_VIP_ASSASSINATED:
case ROUND_TERRORISTS_ESCAPED:
case ROUND_TERRORISTS_WIN:
case ROUND_HOSTAGE_NOT_RESCUED:
case ROUND_VIP_NOT_ESCAPED:
team = GetTeam(TERRORIST);
// tell bots the terrorists won the round
if (TheBots)
{
TheBots->OnEvent(EVENT_TERRORISTS_WIN);
}
break;
case ROUND_VIP_ESCAPED:
case ROUND_CTS_PREVENT_ESCAPE:
case ROUND_ESCAPING_TERRORISTS_NEUTRALIZED:
case ROUND_BOMB_DEFUSED:
case ROUND_CTS_WIN:
case ROUND_ALL_HOSTAGES_RESCUED:
case ROUND_TARGET_SAVED:
case ROUND_TERRORISTS_NOT_ESCAPED:
team = GetTeam(CT);
// tell bots the CTs won the round
if (TheBots)
{
TheBots->OnEvent(EVENT_CTS_WIN);
}
break;
default:
bTeamTriggered = false;
// tell bots the round was a draw
if (TheBots)
{
TheBots->OnEvent(EVENT_ROUND_DRAW);
}
break;
}
if (bTeamTriggered)
{
UTIL_LogPrintf("Team \"%s\" triggered \"%s\" (CT \"%i\") (T \"%i\")\n", team, message, m_iNumCTWins, m_iNumTerroristWins);
}
else
{
UTIL_LogPrintf("World triggered \"%s\" (CT \"%i\") (T \"%i\")\n", message, m_iNumCTWins, m_iNumTerroristWins);
}
}
UTIL_LogPrintf("World triggered \"Round_End\"\n");
@ -1681,9 +1681,12 @@ void EXT_FUNC CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
g_pHostages->RestartRound();
}
#ifndef REGAMEDLL_FIXES
++m_iTotalRoundsPlayed;
#ifdef REGAMEDLL_FIXES
if (!m_bCompleteReset)
#endif
{
++m_iTotalRoundsPlayed;
}
ClearBodyQue();
@ -1752,7 +1755,7 @@ void EXT_FUNC CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
UTIL_ClientPrintAll(HUD_PRINTCENTER, "#Auto_Team_Balance_Next_Round");
}
#ifdef REGAMEDLL_ADD
else if (autoteambalance.value > 1 && m_iUnBalancedRounds >= 1)
else if (autoteambalance.value >= 2 && m_iUnBalancedRounds >= 1)
{
BalanceTeams();
}
@ -1813,12 +1816,6 @@ void EXT_FUNC CHalfLifeMultiplay::__API_VHOOK(RestartRound)()
TheBots->OnEvent(EVENT_NEW_MATCH);
}
}
#ifdef REGAMEDLL_FIXES
else
{
m_iTotalRoundsPlayed++;
}
#endif
m_bFreezePeriod = TRUE;
m_bRoundTerminating = false;
@ -3638,20 +3635,19 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer)
if (pPlayer->m_iMenu != Menu_ChooseTeam && pPlayer->m_iJoiningState == SHOWTEAMSELECT)
{
int team = MENU_SLOT_TEAM_UNDEFINED;
int slot = MENU_SLOT_TEAM_UNDEFINED;
if (!Q_stricmp(humans_join_team.string, "T"))
{
team = MENU_SLOT_TEAM_TERRORIST;
slot = MENU_SLOT_TEAM_TERRORIST;
}
else if (!Q_stricmp(humans_join_team.string, "CT"))
{
team = MENU_SLOT_TEAM_CT;
slot = MENU_SLOT_TEAM_CT;
}
#ifdef REGAMEDLL_ADD
else if (!Q_stricmp(humans_join_team.string, "any") && auto_join_team.value != 0.0f)
{
team = MENU_SLOT_TEAM_RANDOM;
slot = MENU_SLOT_TEAM_RANDOM;
}
#endif
else
@ -3665,22 +3661,33 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(PlayerThink)(CBasePlayer *pPlayer)
pPlayer->m_iMenu = Menu_ChooseTeam;
pPlayer->m_iJoiningState = PICKINGTEAM;
if (team != MENU_SLOT_TEAM_UNDEFINED && !pPlayer->IsBot())
if (slot != MENU_SLOT_TEAM_UNDEFINED && !pPlayer->IsBot())
{
#ifdef REGAMEDLL_ADD
m_bSkipShowMenu = (auto_join_team.value != 0.0f);
HandleMenu_ChooseTeam(pPlayer, team);
m_bSkipShowMenu = (auto_join_team.value != 0.0f) && !(pPlayer->pev->flags & FL_FAKECLIENT);
if (team != MENU_SLOT_TEAM_SPECT && (IsCareer() || m_bSkipShowMenu))
if (HandleMenu_ChooseTeam(pPlayer, slot))
{
// slot 6 - chooses randomize the appearance to model player
HandleMenu_ChooseAppearance(pPlayer, 6);
if (slot != MENU_SLOT_TEAM_SPECT && (IsCareer() || m_bSkipShowMenu))
{
// slot 6 - chooses randomize the appearance to model player
HandleMenu_ChooseAppearance(pPlayer, 6);
}
}
else
{
m_bSkipShowMenu = false;
if (allow_spectators.value == 0.0f)
ShowVGUIMenu(pPlayer, VGUI_Menu_Team, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_5), "#Team_Select");
else
ShowVGUIMenu(pPlayer, VGUI_Menu_Team, (MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_5 | MENU_KEY_6), "#Team_Select_Spect");
}
m_bSkipShowMenu = false;
#else
HandleMenu_ChooseTeam(pPlayer, team);
HandleMenu_ChooseTeam(pPlayer, slot);
if (team != MENU_SLOT_TEAM_SPECT && IsCareer())
if (slot != MENU_SLOT_TEAM_SPECT && IsCareer())
{
// slot 6 - chooses randomize the appearance to model player
HandleMenu_ChooseAppearance(pPlayer, 6);
@ -3709,45 +3716,45 @@ LINK_HOOK_CLASS_CUSTOM_CHAIN(BOOL, CHalfLifeMultiplay, CSGameRules, FPlayerCanRe
BOOL EXT_FUNC CHalfLifeMultiplay::__API_VHOOK(FPlayerCanRespawn)(CBasePlayer *pPlayer)
{
#ifdef REGAMEDLL_ADD
if (forcerespawn.value)
return TRUE;
if (forcerespawn.value <= 0)
#endif
// Player cannot respawn twice in a round
if (pPlayer->m_iNumSpawns > 0)
{
return FALSE;
}
// Player cannot respawn until next round if more than 20 seconds in
// Tabulate the number of players on each team.
m_iNumCT = CountTeamPlayers(CT);
m_iNumTerrorist = CountTeamPlayers(TERRORIST);
if (m_iNumTerrorist > 0 && m_iNumCT > 0)
{
#ifdef REGAMEDLL_ADD
// means no time limit
if (GetRoundRespawnTime() != -1)
#endif
// Player cannot respawn twice in a round
if (pPlayer->m_iNumSpawns > 0)
{
// TODO: to be correct, need use time the real one starts of round, m_fRoundStartTimeReal instead of it.
// m_fRoundStartTime able to extend the time to 60 seconds when there is a remaining time of round.
#ifdef REGAMEDLL_FIXES
if (gpGlobals->time > m_fRoundStartTimeReal + GetRoundRespawnTime())
#else
if (gpGlobals->time > m_fRoundStartTime + GetRoundRespawnTime())
return FALSE;
}
// Player cannot respawn until next round if more than 20 seconds in
// Tabulate the number of players on each team.
m_iNumCT = CountTeamPlayers(CT);
m_iNumTerrorist = CountTeamPlayers(TERRORIST);
if (m_iNumTerrorist > 0 && m_iNumCT > 0)
{
#ifdef REGAMEDLL_ADD
// means no time limit
if (GetRoundRespawnTime() != -1)
#endif
{
// If this player just connected and fadetoblack is on, then maybe
// the server admin doesn't want him peeking around.
if (fadetoblack.value != 0.0f)
// TODO: to be correct, need use time the real one starts of round, m_fRoundStartTimeReal instead of it.
// m_fRoundStartTime able to extend the time to 60 seconds when there is a remaining time of round.
#ifdef REGAMEDLL_FIXES
if (gpGlobals->time > m_fRoundStartTimeReal + GetRoundRespawnTime())
#else
if (gpGlobals->time > m_fRoundStartTime + GetRoundRespawnTime())
#endif
{
UTIL_ScreenFade(pPlayer, Vector(0, 0, 0), 3, 3, 255, (FFADE_OUT | FFADE_STAYOUT));
}
// If this player just connected and fadetoblack is on, then maybe
// the server admin doesn't want him peeking around.
if (fadetoblack.value != 0.0f)
{
UTIL_ScreenFade(pPlayer, Vector(0, 0, 0), 3, 3, 255, (FFADE_OUT | FFADE_STAYOUT));
}
return FALSE;
return FALSE;
}
}
}
}
@ -3763,7 +3770,7 @@ BOOL EXT_FUNC CHalfLifeMultiplay::__API_VHOOK(FPlayerCanRespawn)(CBasePlayer *pP
float CHalfLifeMultiplay::__MAKE_VHOOK(FlPlayerSpawnTime)(CBasePlayer *pPlayer)
{
return gpGlobals->time;//now!
return gpGlobals->time;
}
BOOL CHalfLifeMultiplay::__MAKE_VHOOK(AllowAutoTargetCrosshair)()

View File

@ -504,3 +504,10 @@ void CBasePlayer::Observer_SetMode(int iMode)
m_iObserverLastMode = iMode;
m_bWasFollowing = false;
}
void CBasePlayer::Observer_Think()
{
Observer_HandleButtons();
Observer_CheckTarget();
Observer_CheckProperties();
}

View File

@ -1013,8 +1013,7 @@ BOOL EXT_FUNC CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entv
if (bitsDamageType & DMG_EXPLOSION)
{
CBaseEntity *temp = GetClassPtr<CCSEntity>((CBaseEntity *)pevInflictor);
if (!Q_strcmp(STRING(temp->pev->classname), "grenade"))
if (FClassnameIs(temp->pev, "grenade"))
{
CGrenade *pGrenade = GetClassPtr<CCSGrenade>((CGrenade *)pevInflictor);
@ -1161,7 +1160,7 @@ BOOL EXT_FUNC CBasePlayer::__API_VHOOK(TakeDamage)(entvars_t *pevInflictor, entv
pAttacker = CBaseEntity::Instance(pevAttacker);
if (!g_pGameRules->FPlayerCanTakeDamage(this, pAttacker) && Q_strcmp("grenade", STRING(pevInflictor->classname)) != 0)
if (!g_pGameRules->FPlayerCanTakeDamage(this, pAttacker) && !FClassnameIs(pevInflictor, "grenade"))
{
// Refuse the damage
return FALSE;
@ -2278,6 +2277,10 @@ void EXT_FUNC CBasePlayer::__API_VHOOK(Killed)(entvars_t *pevAttacker, int iGib)
m_bIsDefusing = false;
BuyZoneIcon_Clear(this);
#ifdef REGAMEDLL_ADD
CSPlayer()->m_flRespawnPending = gpGlobals->time;
#endif
SetThink(&CBasePlayer::PlayerDeathThink);
pev->nextthink = gpGlobals->time + 0.1f;
pev->solid = SOLID_NOT;
@ -2374,7 +2377,9 @@ void EXT_FUNC CBasePlayer::__API_HOOK(SetAnimation)(PLAYER_ANIM playerAnim)
case PLAYER_DIE:
{
m_IdealActivity = ACT_DIESIMPLE;
#ifndef REGAMEDLL_FIXES
DeathSound();
#endif
break;
}
case PLAYER_ATTACK1:
@ -3265,17 +3270,16 @@ void EXT_FUNC CBasePlayer::__API_HOOK(AddAccount)(int amount, RewardType type, b
void CBasePlayer::ResetMenu()
{
#ifdef REGAMEDLL_FIXES
m_iMenu = Menu_OFF;
#endif
MESSAGE_BEGIN(MSG_ONE, gmsgShowMenu, NULL, pev);
WRITE_SHORT(0);
WRITE_CHAR(0);
WRITE_BYTE(0);
WRITE_STRING("");
MESSAGE_END();
#ifdef REGAMEDLL_FIXES
m_iMenu = Menu_OFF;
#endif
}
void CBasePlayer::SyncRoundTimer()
@ -3586,7 +3590,6 @@ void CBasePlayer::PlayerDeathThink()
if (pev->flags & FL_ONGROUND)
{
float flForward = pev->velocity.Length() - 20;
if (flForward <= 0)
pev->velocity = g_vecZero;
else
@ -3632,16 +3635,13 @@ void CBasePlayer::PlayerDeathThink()
{
// if the player has been dead for one second longer than allowed by forcerespawn,
// forcerespawn isn't on. Send the player off to an intermission camera until they choose to respawn.
if (g_pGameRules->IsMultiplayer())
if (g_pGameRules->IsMultiplayer() && gpGlobals->time > m_fDeadTime + 3 && !(m_afPhysicsFlags & PFLAG_OBSERVER))
{
if (gpGlobals->time > m_fDeadTime + 3.0f && !(m_afPhysicsFlags & PFLAG_OBSERVER))
{
// Send message to everybody to spawn a corpse.
SpawnClientSideCorpse();
// Send message to everybody to spawn a corpse.
SpawnClientSideCorpse();
// go to dead camera.
StartDeathCam();
}
// go to dead camera.
StartDeathCam();
}
}
@ -3650,17 +3650,16 @@ void CBasePlayer::PlayerDeathThink()
{
#ifdef REGAMEDLL_ADD
// wait for any button down, or mp_forcerespawn is set and the respawn time is up
if (forcerespawn.value > 0 && (fAnyButtonDown || (gpGlobals->time > (m_fDeadTime + forcerespawn.value))))
if (forcerespawn.value > 0 && gpGlobals->time > (m_fDeadTime + forcerespawn.value))
{
respawn(pev, FALSE);
pev->button = 0;
pev->nextthink = -1;
return;
}
#else
#endif
if (fAnyButtonDown)
return;
#endif
if (g_pGameRules->FPlayerCanRespawn(this))
{
@ -3709,13 +3708,8 @@ void EXT_FUNC CBasePlayer::__API_VHOOK(RoundRespawn)()
pev->nextthink = -1;
}
if (m_pActiveItem)
{
if (m_pActiveItem->iItemSlot() == GRENADE_SLOT)
{
SwitchWeapon(m_pActiveItem);
}
}
if (m_pActiveItem && m_pActiveItem->iItemSlot() == GRENADE_SLOT)
SwitchWeapon(m_pActiveItem);
m_lastLocation[0] = '\0';
@ -3732,6 +3726,10 @@ void EXT_FUNC CBasePlayer::__API_VHOOK(RoundRespawn)()
// player off into observer mode
void CBasePlayer::StartDeathCam()
{
#ifdef REGAMEDLL_FXIES
m_canSwitchObserverModes = true;
#endif
if (pev->view_ofs == g_vecZero)
{
// don't accept subsequent attempts to StartDeathCam()
@ -4356,12 +4354,14 @@ void EXT_FUNC CBasePlayer::__API_VHOOK(PreThink)()
else
pev->flags &= ~FL_ONTRAIN;
#ifdef REGAMEDLL_ADD
PlayerRespawnThink();
#endif
// Observer Button Handling
if (IsObserver() && (m_afPhysicsFlags & PFLAG_OBSERVER))
{
Observer_HandleButtons();
Observer_CheckTarget();
Observer_CheckProperties();
Observer_Think();
return;
}
@ -4925,6 +4925,12 @@ void EXT_FUNC CBasePlayer::__API_VHOOK(PostThink)()
StudioFrameAdvance();
CheckPowerups();
#ifdef REGAMEDLL_ADD
if (m_flTimeStepSound) {
pev->flTimeStepSound = int(m_flTimeStepSound);
}
#endif
// NOTE: this is useless for CS 1.6 - s1lent
#ifndef REGAMEDLL_FIXES
UpdatePlayerSound();
@ -8222,6 +8228,16 @@ int GetPlayerGaitsequence(const edict_t *pEdict)
void CBasePlayer::SpawnClientSideCorpse()
{
#ifdef REGAMEDLL_FIXES
// not allow to spawn, if the player was torn to gib
if (pev->effects & EF_NODRAW)
return;
// do not make a corpse if the player goes to respawn.
if (pev->deadflag == DEAD_RESPAWNABLE)
return;
#endif
char *infobuffer = GET_INFO_BUFFER(edict());
char *pModel = GET_KEY_VALUE(infobuffer, "model");
@ -8467,14 +8483,13 @@ void CBasePlayer::ClientCommand(const char *cmd, const char *arg1, const char *a
UseBotArgs = true;
auto pEntity = ENT(pev);
auto addr = &::ClientCommand;
// NOTE: force __cdecl to allow cstrike amxx module to hook ClientCommand
#if defined _MSC_VER || defined __INTEL_COMPILER
__asm
{
push pEntity;
call addr;
push pEntity
call ClientCommand_;
add esp, 4;
}
#else
@ -8484,7 +8499,7 @@ void CBasePlayer::ClientCommand(const char *cmd, const char *arg1, const char *a
"addl %%esp, $4\n\t"
::
"g" (pEntity),
"g" (addr),
"g" (ClientCommand_),
);
#endif // _MSC_VER || defined __INTEL_COMPILER
@ -9680,3 +9695,29 @@ bool EXT_FUNC CBasePlayer::__API_HOOK(GetIntoGame)()
return true;
}
void CBasePlayer::PlayerRespawnThink()
{
#ifdef REGAMEDLL_ADD
if (IsObserver() && (m_afPhysicsFlags & PFLAG_OBSERVER) && (m_iTeam == UNASSIGNED || m_iTeam == SPECTATOR))
return;
// Player cannot respawn while in the Choose Appearance menu
if (m_iMenu == Menu_ChooseAppearance || m_iJoiningState == SHOWTEAMSELECT)
return;
if (pev->deadflag < DEAD_DYING)
return;
if (forcerespawn.value)
{
if (gpGlobals->time > (CSPlayer()->m_flRespawnPending + forcerespawn.value))
{
Spawn();
pev->button = 0;
pev->nextthink = -1;
return;
}
}
#endif
}

View File

@ -440,6 +440,7 @@ public:
CBasePlayer *Observer_IsValidTarget_(int iPlayerIndex, bool bSameTeam);
void Disconnect();
void Observer_Think();
void Observer_HandleButtons();
void Observer_SetMode(int iMode);
void Observer_CheckTarget();
@ -527,6 +528,7 @@ public:
void SendFOV(int fov);
void WaterMove();
void EXPORT PlayerDeathThink();
void PlayerRespawnThink();
void PlayerUse();
void HostageUsed();
void JoiningThink();

View File

@ -150,12 +150,10 @@ extern globalvars_t *gpGlobals;
#define PLAYBACK_EVENT_DELAY(flags, who, index, delay)\
PLAYBACK_EVENT_FULL(flags, who, index, delay, (float *)&g_vecZero, (float *)&g_vecZero, 0.0, 0.0, 0, 0, 0, 0)
#ifndef HOOK_GAMEDLL
#if !defined(HOOK_GAMEDLL)
#define __MAKE_VHOOK(fname)\
fname
#endif
#endif // !defined(HOOK_GAMEDLL) && defined(REGAMEDLL_API)
#define LINK_ENTITY_TO_CLASS(mapClassName, DLLClassName, DLLClassWrapName)\
C_DLLEXPORT void EXT_FUNC mapClassName(entvars_t *pev);\

View File

@ -105,7 +105,7 @@ public:
virtual void KeyValue(KeyValueData *pkvd) = 0;
virtual int Save(CSave &save) = 0;
virtual int Restore(CRestore &restore) = 0;
virtual int ObjectCaps() = 0
virtual int ObjectCaps() = 0;
virtual BOOL TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) = 0;
virtual void Touch(CBaseEntity *pOther) = 0;
virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) = 0;

View File

@ -325,7 +325,7 @@ void CBot::ClientCommand(const char *cmd, const char *arg1, const char *arg2, co
BotArgs[3] = arg3;
UseBotArgs = true;
::ClientCommand(ENT(pev));
::ClientCommand_(ENT(pev));
UseBotArgs = false;
}
#endif

View File

@ -69,7 +69,6 @@ Place PlaceDirectory::EntryToPlace(EntryType entry) const
return UNDEFINED_PLACE;
unsigned int i = entry - 1;
if (i > m_directory.size())
{
assert(false && "PlaceDirectory::EntryToPlace: Invalid entry");
@ -705,7 +704,7 @@ void LoadLocationFile(const char *filename)
Q_strcpy(locFilename, filename);
char *dot = Q_strchr(locFilename, '.');
if (dot != NULL)
if (dot)
{
Q_strcpy(dot, ".loc");
@ -713,7 +712,7 @@ void LoadLocationFile(const char *filename)
char *locDataFile = (char *)LOAD_FILE_FOR_ME(const_cast<char *>(locFilename), &locDataLength);
char *locData = locDataFile;
if (locData != NULL)
if (locData)
{
CONSOLE_ECHO("Loading legacy 'location file' '%s'\n", locFilename);
@ -748,7 +747,7 @@ void LoadLocationFile(const char *filename)
CNavArea *area = TheNavAreaGrid.GetNavAreaByID(areaID);
unsigned int place = (locDirIndex > 0) ? directory[locDirIndex - 1] : UNDEFINED_PLACE;
if (area != NULL)
if (area)
area->SetPlace(place);
}
}
@ -880,7 +879,6 @@ NavErrorType LoadNavigationMap()
return NAV_INVALID_FILE;
unsigned int bspSize = (unsigned int)GET_FILE_SIZE(bspFilename);
if (bspSize != saveBspSize)
{
// this nav file is out of date for this bsp file

View File

@ -90,6 +90,7 @@ typedef float FloatRef;
#define LINK_HOOK_CLASS_CUSTOM_CHAIN(...)
#define LINK_HOOK_CLASS_CUSTOM_CHAIN2(...)
#define LINK_HOOK_VOID_CHAIN(...)
#define LINK_HOOK_VOID_CHAIN2(...)
#define LINK_HOOK_CHAIN(...)
#define LINK_HOOK_CHAIN2(...)

View File

@ -127,10 +127,10 @@ IF NOT %errlvl% == "1" (
)
:: append extra string
If NOT "%commitURL%"=="%commitURL:bitbucket.org=%" (
set commitURL=!commitURL!/commit/
) ELSE (
If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" (
set commitURL=!commitURL!/commits/
) ELSE (
set commitURL=!commitURL!/commit/
)
) ELSE (
@ -142,10 +142,10 @@ IF NOT %errlvl% == "1" (
set commitURL=!commitURL::=/!
:: append extra string
If NOT "%commitURL%"=="%commitURL:bitbucket.org=%" (
set commitURL=https://!commitURL!/commit/
) ELSE (
If NOT "!commitURL!"=="!commitURL:bitbucket.org=!" (
set commitURL=https://!commitURL!/commits/
) ELSE (
set commitURL=https://!commitURL!/commit/
)
)
)

View File

@ -1417,7 +1417,7 @@
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>$(ProjectDir)../lib/libacof32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<MinimumRequiredVersion>
</MinimumRequiredVersion>
<ModuleDefinitionFile>mp.def</ModuleDefinitionFile>
@ -1459,7 +1459,7 @@
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>$(ProjectDir)../lib/libacof32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<MinimumRequiredVersion>
</MinimumRequiredVersion>
<ModuleDefinitionFile>mp.def</ModuleDefinitionFile>
@ -1619,7 +1619,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>$(ProjectDir)../lib/libacof32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<MinimumRequiredVersion />
<ModuleDefinitionFile>
</ModuleDefinitionFile>

View File

@ -488,7 +488,8 @@ void EXT_FUNC __API_HOOK(PM_UpdateStepSound)()
if ((pmove->flags & FL_DUCKING) || fLadder)
{
pmove->flTimeStepSound += 100; // slower step time if ducking
// slower step time if ducking
pmove->flTimeStepSound += 100;
// play the sound
// 35% volume if ducking

View File

@ -83,7 +83,7 @@ char PM_FindTextureType(char *name);
void PM_Init_(struct playermove_s *ppmove);
void PM_Move_(struct playermove_s *ppmove, int server);
void PM_AirMove_(int playerIndex);
void PM_AirMove_(int playerIndex = 0);
void PM_AirMove_internal();
void PM_UpdateStepSound_();

View File

@ -259,8 +259,8 @@ typedef IHookChain<class CBaseEntity *, class CBasePlayer *, WeaponIdType> IReGa
typedef IHookChainRegistry<class CBaseEntity *, class CBasePlayer *, WeaponIdType> IReGameHookRegistry_BuyWeaponByWeaponID;
// InternalCommand hook
typedef IHookChain<bool, edict_t *, const char *> IReGameHook_InternalCommand;
typedef IHookChainRegistry<bool, edict_t *, const char *> IReGameHookRegistry_InternalCommand;
typedef IHookChain<void, edict_t *, const char *, const char *> IReGameHook_InternalCommand;
typedef IHookChainRegistry<void, edict_t *, const char *, const char *> IReGameHookRegistry_InternalCommand;
// CHalfLifeMultiplay::FShouldSwitchWeapon hook
typedef IHookChain<BOOL, class CBasePlayer *, class CBasePlayerItem *> IReGameHook_CSGameRules_FShouldSwitchWeapon;

View File

@ -51,7 +51,7 @@ class CCSArmoury: public CCSEntity {};
class CCSPlayer: public CCSMonster {
public:
CCSPlayer() : m_bForceShowMenu(false)
CCSPlayer() : m_bForceShowMenu(false), m_flRespawnPending(0)
{
m_szModel[0] = '\0';
}
@ -100,6 +100,7 @@ public:
public:
char m_szModel[32];
bool m_bForceShowMenu;
float m_flRespawnPending;
};
class CAPI_Bot: public CCSPlayer {};

View File

@ -255,8 +255,8 @@ typedef IHookChainImpl<CBaseEntity *, CBasePlayer *, WeaponIdType> CReGameHook_B
typedef IHookChainRegistryImpl<CBaseEntity *, CBasePlayer *, WeaponIdType> CReGameHookRegistry_BuyWeaponByWeaponID;
// InternalCommand hook
typedef IHookChainImpl<bool, edict_t *, const char *> CReGameHook_InternalCommand;
typedef IHookChainRegistryImpl<bool, edict_t *, const char *> CReGameHookRegistry_InternalCommand;
typedef IHookChainImpl<void, edict_t *, const char *, const char *> CReGameHook_InternalCommand;
typedef IHookChainRegistryImpl<void, edict_t *, const char *, const char *> CReGameHookRegistry_InternalCommand;
// CHalfLifeMultiplay::FShouldSwitchWeapon hook
typedef IHookChainClassImpl<BOOL, class CHalfLifeMultiplay, CBasePlayer *, CBasePlayerItem *> CReGameHook_CSGameRules_FShouldSwitchWeapon;

View File

@ -73,7 +73,7 @@ bool EXT_FUNC CCSPlayer::JoinTeam(TeamName team)
case CT:
case TERRORIST:
{
if (pPlayer->m_iTeam == SPECTATOR)
if (pPlayer->m_iTeam == SPECTATOR || pPlayer->m_iTeam == UNASSIGNED)
{
// If they're switching into spectator, setup spectator properties..
pPlayer->m_bNotKilled = true;

View File

@ -30,11 +30,11 @@
#include "maintypes.h"
#include "regamedll_interfaces.h"
#if !defined(HOOK_GAMEDLL) && defined(REGAMEDLL_API)
#define __API_VHOOK(fname)\
fname##_
#ifndef HOOK_GAMEDLL
#define __API_HOOK __API_VHOOK
#define __MAKE_VHOOK(fname)\
fname
@ -94,5 +94,26 @@
ret functionName() {\
return g_ReGameHookchains.m_##functionName.callChain(functionName##_);\
}
#else
#endif
#define __API_VHOOK(fname)\
fname
#define __API_HOOK __API_VHOOK
#define __MAKE_VHOOK(fname)\
fname
#define LINK_HOOK_CLASS_VOID_CHAIN(...)
#define LINK_HOOK_CLASS_VOID_CHAIN2(...)
#define LINK_HOOK_CLASS_CHAIN(...)
#define LINK_HOOK_CLASS_CHAIN2(...)
#define LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN(...)
#define LINK_HOOK_CLASS_VOID_CUSTOM_CHAIN2(...)
#define LINK_HOOK_CLASS_CUSTOM_CHAIN(...)
#define LINK_HOOK_CLASS_CUSTOM_CHAIN2(...)
#define LINK_HOOK_VOID_CHAIN(...)
#define LINK_HOOK_VOID_CHAIN2(...)
#define LINK_HOOK_CHAIN(...)
#define LINK_HOOK_CHAIN2(...)
#endif // !defined(HOOK_GAMEDLL) && defined(REGAMEDLL_API)