From 9bfa67b54d2595be612134590d8443eac6210f6d Mon Sep 17 00:00:00 2001 From: s1lentq Date: Mon, 26 Sep 2016 01:05:55 +0700 Subject: [PATCH] Ignore by default fireonce flag for trigger_auto (Related #55) Fix: does not reset the clones of multi_manager. Added: Do not allow to do spawn, if player chooses a team or appearance (Related #61) Update FGD --- regamedll/dlls/buttons.cpp | 20 +++++++++++++++---- regamedll/dlls/player.cpp | 7 +++++++ regamedll/dlls/triggers.cpp | 10 ++++++++++ .../GameDefinitionFile/regamedll-cs.fgd | 1 - 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/regamedll/dlls/buttons.cpp b/regamedll/dlls/buttons.cpp index e246787a..07155791 100644 --- a/regamedll/dlls/buttons.cpp +++ b/regamedll/dlls/buttons.cpp @@ -243,15 +243,27 @@ BOOL CMultiSource::__MAKE_VHOOK(IsTriggered)(CBaseEntity *) void CMultiSource::Register() { - edict_t *pentTarget = NULL; - m_iTotal = 0; Q_memset(m_rgEntities, 0, MS_MAX_TARGETS * sizeof(EHANDLE)); SetThink(&CMultiSource::SUB_DoNothing); // search for all entities which target this multisource (pev->targetname) - pentTarget = FIND_ENTITY_BY_STRING(NULL, "target", STRING(pev->targetname)); +#ifdef REGAMEDLL_FIXES + CBaseEntity *pTarget = nullptr; + while (m_iTotal < MS_MAX_TARGETS && (pTarget = UTIL_FindEntityByTargetname(pTarget, "multi_manager"))) { + m_rgEntities[m_iTotal++] = pTarget; + } + + pTarget = nullptr; + while (m_iTotal < MS_MAX_TARGETS && (pTarget = UTIL_FindEntityByClassname(pTarget, "multi_manager"))) + { + if (pTarget->HasTarget(pev->targetname)) { + m_rgEntities[m_iTotal++] = pTarget; + } + } +#else + edict_t *pentTarget = FIND_ENTITY_BY_STRING(NULL, "target", STRING(pev->targetname)); while (!FNullEnt(pentTarget) && m_iTotal < MS_MAX_TARGETS) { @@ -277,7 +289,7 @@ void CMultiSource::Register() pentTarget = FIND_ENTITY_BY_STRING(pentTarget, "classname", "multi_manager"); } - +#endif pev->spawnflags &= ~SF_MULTI_INIT; } diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 7980a73c..ecee6ad9 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -5150,6 +5150,13 @@ void EXT_FUNC CBasePlayer::__API_VHOOK(Spawn)() { int i; +#ifdef REGAMEDLL_FIXES + // Do not allow to do spawn, if player chooses a team or appearance. + if (m_bJustConnected && m_iJoiningState == PICKINGTEAM) { + return; + } +#endif + m_iGaitsequence = 0; m_flGaitframe = 0; diff --git a/regamedll/dlls/triggers.cpp b/regamedll/dlls/triggers.cpp index 7d3b40b0..f0baa840 100644 --- a/regamedll/dlls/triggers.cpp +++ b/regamedll/dlls/triggers.cpp @@ -150,7 +150,11 @@ void CAutoTrigger::__MAKE_VHOOK(Think)() { SUB_UseTargets(this, triggerType, 0); +#ifdef REGAMEDLL_FIXES + if (pev->spawnflags & SF_AUTO_NO_RESET) +#else if (pev->spawnflags & SF_AUTO_FIREONCE) +#endif { UTIL_Remove(this); } @@ -360,6 +364,12 @@ CMultiManager *CMultiManager::Clone() Q_memcpy(pMulti->m_iTargetName, m_iTargetName, sizeof(m_iTargetName)); Q_memcpy(pMulti->m_flTargetDelay, m_flTargetDelay, sizeof(m_flTargetDelay)); +#ifdef REGAMEDLL_FIXES + // Add entity in hash table, otherwise, + // it will not be reset for the entity via UTIL_RestartRound + MAKE_STRING_CLASS("multi_manager", pMulti->pev); +#endif + return pMulti; } diff --git a/regamedll/extra/Toolkit/GameDefinitionFile/regamedll-cs.fgd b/regamedll/extra/Toolkit/GameDefinitionFile/regamedll-cs.fgd index 26a39d3a..f458d9b3 100644 --- a/regamedll/extra/Toolkit/GameDefinitionFile/regamedll-cs.fgd +++ b/regamedll/extra/Toolkit/GameDefinitionFile/regamedll-cs.fgd @@ -2066,7 +2066,6 @@ [ spawnflags(Flags) = [ - 1 : "Remove On fire" : 1 2 : "No reset on New Round" : 0 ] globalstate(string) : "Global State to Read"