Fix counting freezetime

Small fixes
This commit is contained in:
s1lentq 2016-12-18 18:27:39 +07:00
parent e50cfe32c6
commit d586d65993
9 changed files with 47 additions and 157 deletions

View File

@ -2286,7 +2286,7 @@ BOOL HandleRadioAliasCommands(CBasePlayer *pPlayer, const char *pszCommand)
return FALSE;
}
bool InternalCommand(edict_t *pEntity, const char *cmd) {
bool EXT_FUNC InternalCommand(edict_t *pEntity, const char *cmd) {
return true;
}
@ -2308,131 +2308,13 @@ void EXT_FUNC ClientCommand(edict_t *pEntity)
entvars_t *pev = &pEntity->v;
CBasePlayer *player = GetClassPtr<CCSPlayer>((CBasePlayer *)pev);
if (FStrEq(pcmd, "vip"))
{
/*for (int i = 0; i < MAX_VIP_QUEUES; ++i)
{
if (CSGameRules()->m_pVIPQueue[i])
{
printf(" -> (%d) (%p)", i, CSGameRules()->m_pVIPQueue[i]);
printf(" -> (%s)", STRING(CSGameRules()->m_pVIPQueue[i]->pev->netname));
printf(" -> index: (%d)\n", ENTINDEX(CSGameRules()->m_pVIPQueue[i]->edict()));
}
}*/
auto pEdict = FIND_ENTITY_BY_CLASSNAME(nullptr, "trigger_zone");
if (pEdict)
{
printf(" -> pEdict: (%p) -> pEdict->v.solid: (%d)\n", pEdict, pEdict->v.solid);
} else {
printf(" -> pEdict: (%p)\n", pEdict);
}
} else
if (FStrEq(pcmd, "say"))
{
auto pcmd2 = CMD_ARGV_(1);
if (FStrEq(pcmd2, "q")) // nety
{
//char szMessage[190];
//Q_snprintf(szMessage, sizeof(szMessage), "\x1[\x4Tag\x1] Hey \x3%s\x1, welcome to join us on the server\x4.", STRING(pev->netname));
//MESSAGE_BEGIN(MSG_ONE, gmsgSayText, NULL, pev);
// WRITE_BYTE(player->entindex());
/// WRITE_STRING(UTIL_VarArgs("\1[\4Aim Detector\1] Hey \3%s\1, welcome to join us on the server\4.", STRING(pev->netname)));
//MESSAGE_END();
} else
if (FStrEq(pcmd2, "h")) // nety
{
//printf(" -> m_iHideHUD: (%d)", pPlayer->m_iHideHUD);
UTIL_SayText(UTIL_VarArgs(" -> m_iHideHUD: (%d)", player->m_iHideHUD), player);
} else
if (FStrEq(pcmd2, "h_weapon")) // nety
{
player->m_iHideHUD |= HIDEHUD_WEAPONS;
} else
if (FStrEq(pcmd2, "h_timer")) // ectb spec crosshair, ecli ectb npuLleJL
{
player->m_iHideHUD |= HIDEHUD_TIMER;
} else
if (FStrEq(pcmd2, "h_money")) // ectb spec crosshair, ecli ectb npuLleJL
{
player->m_iHideHUD |= HIDEHUD_MONEY;
} else
if (FStrEq(pcmd2, "h_all")) // nety
{
player->m_iHideHUD |= HIDEHUD_ALL;
} else
if (FStrEq(pcmd2, "h_flash")) // ectb spec crosshair, ecli ectb npuLleJL
{
player->m_iHideHUD |= HIDEHUD_FLASHLIGHT;
} else
if (FStrEq(pcmd2, "h_hp")) // ectb spec crosshair, ecli ectb npuLleJL
{
player->m_iHideHUD |= HIDEHUD_HEALTH;
} else
if (FStrEq(pcmd2, "h_cross"))
{
player->m_iHideHUD |= HIDEHUD_CROSSHAIR;
} else
if (FStrEq(pcmd2, "h_7"))
{
player->m_iHideHUD |= (1<<7);
} else
if (FStrEq(pcmd2, "h_8"))
{
player->m_iHideHUD |= (1<<8);
} else
if (FStrEq(pcmd2, "h_9"))
{
player->m_iHideHUD |= (1<<9);
} else
if (FStrEq(pcmd2, "h_10"))
{
player->m_iHideHUD |= (1<<10);
} else
if (FStrEq(pcmd2, "h_clear"))
{
player->m_iHideHUD = 0;
} else
{
if (gpGlobals->time >= player->m_flLastCommandTime[CMD_SAY])
{
player->m_flLastCommandTime[CMD_SAY] = gpGlobals->time + 0.3f;
Host_Say(pEntity, FALSE);
}
}
}
else if (FStrEq(pcmd, "say_team"))
{
@ -3425,6 +3307,8 @@ void EXT_FUNC ServerDeactivate()
{
g_pHostages->ServerDeactivate();
}
WeaponInfoReset();
}
void EXT_FUNC ServerActivate(edict_t *pEdictList, int edictCount, int clientMax)

View File

@ -741,7 +741,6 @@ void EXT_FUNC CHalfLifeMultiplay::__API_VHOOK(GiveC4)()
++m_iC4Guy;
bool giveToHumans = (cv_bot_defer_to_human.value > 0.0);
if (giveToHumans)
{
for (int i = 1; i <= gpGlobals->maxClients; ++i)
@ -836,8 +835,8 @@ void CHalfLifeMultiplay::QueueCareerRoundEndMenu(float tmDelay, int iWinStatus)
return;
m_fCareerRoundMenuTime = tmDelay + gpGlobals->time;
bool humansAreCTs = (Q_strcmp(humans_join_team.string, "CT") == 0);
bool humansAreCTs = (Q_strcmp(humans_join_team.string, "CT") == 0);
if (humansAreCTs)
{
CBaseEntity *hostage = NULL;
@ -855,7 +854,6 @@ void CHalfLifeMultiplay::QueueCareerRoundEndMenu(float tmDelay, int iWinStatus)
continue;
CBasePlayer *pLeader = NULL;
if (pHostage->IsFollowingSomeone())
pLeader = static_cast<CBasePlayer *>(pHostage->GetLeader());
@ -1061,8 +1059,8 @@ void CHalfLifeMultiplay::InitializePlayerCounts(int &NumAliveTerrorist, int &Num
}
}
bool CHalfLifeMultiplay::NeededPlayersCheck_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) {
bool EXT_FUNC CHalfLifeMultiplay::NeededPlayersCheck_internal(int winStatus, ScenarioEventEndRound event, float tmDelay)
{
// Start the round immediately when the first person joins
UTIL_LogPrintf("World triggered \"Game_Commencing\"\n");
@ -1082,7 +1080,7 @@ bool CHalfLifeMultiplay::NeededPlayersCheck_internal(int winStatus, ScenarioEven
return true;
}
bool CHalfLifeMultiplay::NeededPlayersCheck()
bool EXT_FUNC CHalfLifeMultiplay::NeededPlayersCheck()
{
// We needed players to start scoring
// Do we have them now?
@ -1111,8 +1109,8 @@ bool CHalfLifeMultiplay::NeededPlayersCheck()
return false;
}
bool CHalfLifeMultiplay::VIP_Escaped_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) {
bool EXT_FUNC CHalfLifeMultiplay::VIP_Escaped_internal(int winStatus, ScenarioEventEndRound event, float tmDelay)
{
Broadcast("ctwin");
m_iAccountCT += m_rgRewardAccountRules[RR_VIP_ESCAPED];
@ -1148,8 +1146,8 @@ bool CHalfLifeMultiplay::VIP_Escaped_internal(int winStatus, ScenarioEventEndRou
return true;
}
bool CHalfLifeMultiplay::VIP_Died_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) {
bool EXT_FUNC CHalfLifeMultiplay::VIP_Died_internal(int winStatus, ScenarioEventEndRound event, float tmDelay)
{
Broadcast("terwin");
m_iAccountTerrorist += m_rgRewardAccountRules[RR_VIP_ASSASSINATED];
@ -1177,7 +1175,7 @@ bool CHalfLifeMultiplay::VIP_Died_internal(int winStatus, ScenarioEventEndRound
return true;
}
bool CHalfLifeMultiplay::VIPRoundEndCheck()
bool EXT_FUNC CHalfLifeMultiplay::VIPRoundEndCheck()
{
// checks to scenario Escaped VIP on map with vip safety zones
if (m_bMapHasVIPSafetyZone && m_pVIP)
@ -1196,8 +1194,8 @@ bool CHalfLifeMultiplay::VIPRoundEndCheck()
return false;
}
bool CHalfLifeMultiplay::Prison_Escaped_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) {
bool EXT_FUNC CHalfLifeMultiplay::Prison_Escaped_internal(int winStatus, ScenarioEventEndRound event, float tmDelay)
{
Broadcast("terwin");
m_iAccountTerrorist += m_rgRewardAccountRules[RR_TERRORISTS_ESCAPED];
@ -1219,8 +1217,8 @@ bool CHalfLifeMultiplay::Prison_Escaped_internal(int winStatus, ScenarioEventEnd
return true;
}
bool CHalfLifeMultiplay::Prison_PreventEscape_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) {
bool EXT_FUNC CHalfLifeMultiplay::Prison_PreventEscape_internal(int winStatus, ScenarioEventEndRound event, float tmDelay)
{
Broadcast("ctwin");
// CTs are rewarded based on how many terrorists have escaped...
m_iAccountCT += (1 - m_flEscapeRatio) * m_rgRewardAccountRules[RR_CTS_PREVENT_ESCAPE];
@ -1243,8 +1241,8 @@ bool CHalfLifeMultiplay::Prison_PreventEscape_internal(int winStatus, ScenarioEv
return true;
}
bool CHalfLifeMultiplay::Prison_Neutralized_internal(int winStatus, ScenarioEventEndRound event, float tmDelay) {
bool EXT_FUNC CHalfLifeMultiplay::Prison_Neutralized_internal(int winStatus, ScenarioEventEndRound event, float tmDelay)
{
Broadcast("ctwin");
// CTs are rewarded based on how many terrorists have escaped...
m_iAccountCT += (1 - m_flEscapeRatio) * m_rgRewardAccountRules[RR_ESCAPING_TERRORISTS_NEUTRALIZED];
@ -1267,7 +1265,7 @@ bool CHalfLifeMultiplay::Prison_Neutralized_internal(int winStatus, ScenarioEven
return true;
}
bool CHalfLifeMultiplay::PrisonRoundEndCheck(int NumAliveTerrorist, int NumAliveCT, int NumDeadTerrorist, int NumDeadCT)
bool EXT_FUNC CHalfLifeMultiplay::PrisonRoundEndCheck(int NumAliveTerrorist, int NumAliveCT, int NumDeadTerrorist, int NumDeadCT)
{
// checks to scenario Escaped Terrorist's
if (m_bMapHasEscapeZone)
@ -2734,7 +2732,7 @@ bool CHalfLifeMultiplay::CheckFragLimit()
return false;
}
void CHalfLifeMultiplay::OnRoundFreezeEnd()
void EXT_FUNC CHalfLifeMultiplay::OnRoundFreezeEnd()
{
// Log this information
UTIL_LogPrintf("World triggered \"Round_Start\"\n");
@ -2778,7 +2776,7 @@ void CHalfLifeMultiplay::OnRoundFreezeEnd()
}
// Reset the round time
m_fRoundStartTime = gpGlobals->time;
m_fRoundStartTimeReal = m_fRoundStartTime = gpGlobals->time;
// in seconds
m_iRoundTimeSecs = m_iRoundTime;
@ -3414,7 +3412,7 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(InitHUD)(CBasePlayer *pl)
plr->SetScoreboardAttributes(pl);
if (i != pl->entindex())
if (pl->entindex() != i)
{
#ifndef REGAMEDLL_FIXES
if (plr->pev->flags == FL_DORMANT)

View File

@ -35,9 +35,6 @@ UNTESTED dynpitchvol_t rgdpvpreset[CDPVPRESETMAX] =
{ 27, 128, 90, 10, 10, 10, 1, 20, 40, 1, 5, 10, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
int gcallsentences = 0;
int fSentencesInit = FALSE;
TYPEDESCRIPTION CAmbientGeneric::m_SaveData[] =
{
DEFINE_FIELD(CAmbientGeneric, m_flAttenuation, FIELD_FLOAT),
@ -63,18 +60,24 @@ TYPEDESCRIPTION CSpeaker::m_SaveData[] =
DEFINE_FIELD(CSpeaker, m_preset, FIELD_INTEGER),
};
int gcallsentences = 0;
BOOL fSentencesInit = FALSE;
int gcTextures = 0;
BOOL fTextureTypeInit = FALSE;
#endif // HOOK_GAMEDLL
// time delay until it's ok to speak: used so that two NPCs don't talk at once
float CTalkMonster::g_talkWaitTime = 0;
char gszallsentencenames[ CVOXFILESENTENCEMAX ][ CBSENTENCENAME_MAX ];
sentenceg rgsentenceg[ CSENTENCEG_MAX ];
char gszallsentencenames[CVOXFILESENTENCEMAX][CBSENTENCENAME_MAX];
sentenceg rgsentenceg[CSENTENCEG_MAX];
char grgszTextureName[ CTEXTURESMAX ][ CBTEXTURENAMEMAX ];
char grgchTextureType[ CTEXTURESMAX ];
int fTextureTypeInit;
int gcTextures;
// Used to detect the texture the player is standing on, map the
// texture name to a material type. Play footstep sound based on material type.
char grgszTextureName[CTEXTURESMAX][CBTEXTURENAMEMAX];
char grgchTextureType[CTEXTURESMAX];
LINK_ENTITY_TO_CLASS(ambient_generic, CAmbientGeneric, CCSAmbientGeneric);
IMPLEMENT_SAVERESTORE(CAmbientGeneric, CBaseEntity);
@ -1473,6 +1476,9 @@ NOXREF void EMIT_GROUPNAME_SUIT(edict_t *entity, const char *groupname)
}
}
// open materials.txt, get size, alloc space,
// save in array. Only works first time called,
// ignored on subsequent calls.
char *memfgets(byte *pMemFile, int fileSize, int &filePos, char *pBuffer, int bufferSize)
{
// Bullet-proofing

View File

@ -352,7 +352,6 @@ void W_Precache()
Q_memset(IMPL_CLASS(CBasePlayerItem, AmmoInfoArray), 0, sizeof(IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)));
giAmmoIndex = 0;
WeaponInfoReset();
// custom items...

View File

@ -5721,6 +5721,7 @@ AddressRef g_DataRefs[] =
{ 0x01E23AA8, "TutorIdentifierList", (size_t)&pTutorIdentifierList },
{ 0x01E23678, "_ZL19g_TutorStateStrings", (size_t)&pg_TutorStateStrings },
{ 0x01E61E4C, "WorldGraph", (size_t)&pWorldGraph },
//{ 0x01E61E5C, "_ZN12CTalkMonster14g_talkWaitTimeE", mfunc_ptr_cast(&CTalkMonster::pg_talkWaitTime) },
{ 0x01E61B98, "g_pGameRules", (size_t)&pg_pGameRules },
{ 0x01E62560, "g_pMPGameRules", (size_t)&pg_pMPGameRules },
{ 0x01E61E70, "_ZL12mp_com_token", (size_t)&pmp_com_token },

View File

@ -1377,6 +1377,9 @@ int CHalfLifeRules::PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarge
BOOL CHalfLifeRules::FAllowMonsters() { return FAllowMonsters_(); }
// sound
int gcTextures;
BOOL fTextureTypeInit;
void CAmbientGeneric::Spawn() { Spawn_(); }
void CAmbientGeneric::Precache() { Precache_(); }
void CAmbientGeneric::Restart() { Restart_(); }

View File

@ -862,7 +862,7 @@ extern DLL_FUNCTIONS gFunctionTable;
extern NEW_DLL_FUNCTIONS gNewDLLFunctions;
extern char grgszTextureName[1024][17];
extern char grgchTextureType[1024];
extern int fTextureTypeInit;
extern BOOL fTextureTypeInit;
extern struct sentenceg rgsentenceg[200];
extern int fSentencesInit;
extern int gcallsentences;

View File

@ -74,7 +74,7 @@ void PM_InitTextureTypes()
char buffer[512];
int i, j;
byte *pMemFile;
int fileSize, filePos;
int fileSize, filePos = 0;
static bool bTextureTypeInit = false;
if (bTextureTypeInit)
@ -86,15 +86,12 @@ void PM_InitTextureTypes()
pm_gcTextures = 0;
Q_memset(buffer, 0, sizeof(buffer));
fileSize = pmove->COM_FileSize("sound/materials.txt");
pMemFile = pmove->COM_LoadFile("sound/materials.txt", 5, NULL);
pMemFile = pmove->COM_LoadFile("sound/materials.txt", 5, &fileSize);
if (!pMemFile)
return;
filePos = 0;
// for each line in the file...
while (pmove->memfgets(pMemFile, fileSize, &filePos, buffer, sizeof(buffer) - 1) != NULL && (pm_gcTextures < CTEXTURESMAX))
while (pmove->memfgets(pMemFile, fileSize, &filePos, buffer, sizeof(buffer) - 1) && (pm_gcTextures < CTEXTURESMAX))
{
// skip whitespace
i = 0;

View File

@ -5,4 +5,6 @@ void Regamedll_Game_Init()
g_bIsCzeroGame = UTIL_IsGame("czero");
g_bAllowedCSBot = UTIL_AreBotsAllowed(); // determine whether bots can be used or not
g_bHostageImprov = UTIL_AreHostagesImprov(); // determine whether hostage improv can be used or not
WeaponInfoReset();
}