diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 988e263a..4b345b5b 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -439,8 +439,7 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity) pPlayer->pev->flags |= FL_SPECTATOR; pPlayer->pev->solid = SOLID_NOT; pPlayer->pev->movetype = MOVETYPE_NOCLIP; - pPlayer->pev->effects = EF_NODRAW; - pPlayer->pev->effects |= EF_NOINTERP; + pPlayer->pev->effects = (EF_NODRAW | EF_NOINTERP); pPlayer->pev->takedamage = DAMAGE_NO; pPlayer->pev->deadflag = DEAD_DEAD; pPlayer->pev->velocity = g_vecZero; diff --git a/regamedll/dlls/hostage/hostage.cpp b/regamedll/dlls/hostage/hostage.cpp index f878f45d..31783774 100644 --- a/regamedll/dlls/hostage/hostage.cpp +++ b/regamedll/dlls/hostage/hostage.cpp @@ -1090,7 +1090,7 @@ void CHostage::MoveToward(const Vector &vecLoc) pFollowing = GetClassPtr((CBaseEntity *)m_hTargetEnt->pev); vecMove = vecLoc - pev->origin; - Vector vecAng(0, UTIL_VecToAngles(vecMove).y, 0); + Vector vecAng(0, UTIL_VecToAngles(vecMove).y, 0); UTIL_MakeVectorsPrivate(vecAng, vecFwd, NULL, NULL); if ((vecFwd * s_flStepSize_LocalNav).Length2D() <= (vecLoc - pev->origin).Length2D()) diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index fd457007..d8209b13 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -4054,6 +4054,8 @@ void EXT_FUNC CHalfLifeMultiplay::__API_VHOOK(DeathNotice)(CBasePlayer *pVictim, GETPLAYERAUTHID(pVictim->edict()), team, killer_weapon_name); } + // TODO: It is called in CBasePlayer::Killed too, most likely, + // an unnecessary call. (Need investigate) CheckWinConditions(); MESSAGE_BEGIN(MSG_SPEC, SVC_DIRECTOR); diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 6466f88b..3d580afd 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -3662,10 +3662,10 @@ void CBasePlayer::PlayerDeathThink() #endif { pev->deadflag = DEAD_RESPAWNABLE; - } - if (CSGameRules()->IsMultiplayer()) - CSGameRules()->CheckWinConditions(); + if (CSGameRules()->IsMultiplayer()) + CSGameRules()->CheckWinConditions(); + } } pev->nextthink = gpGlobals->time + 0.1f; @@ -8276,6 +8276,11 @@ void CBasePlayer::SpawnClientSideCorpse() return; #endif +#ifdef REGAMEDLL_ADD + if (forcerespawn.value > 0.0f) + return; +#endif + char *infobuffer = GET_INFO_BUFFER(edict()); char *pModel = GET_KEY_VALUE(infobuffer, "model"); diff --git a/regamedll/dlls/triggers.cpp b/regamedll/dlls/triggers.cpp index a3d89931..0b03da61 100644 --- a/regamedll/dlls/triggers.cpp +++ b/regamedll/dlls/triggers.cpp @@ -544,7 +544,7 @@ void CTriggerCDAudio::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) return; } - PlayTrack(); + PlayTrack(pOther->edict()); } void CTriggerCDAudio::__MAKE_VHOOK(Spawn)() @@ -554,7 +554,7 @@ void CTriggerCDAudio::__MAKE_VHOOK(Spawn)() void CTriggerCDAudio::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { - PlayTrack(); + PlayTrack(pCaller->edict()); } #ifdef REGAMEDLL_FIXES @@ -591,11 +591,8 @@ const char *g_szMP3trackFileMap[] = }; #endif -void PlayCDTrack(int iTrack) +void PlayCDTrack(edict_t *pClient, int iTrack) { - // manually find the single player. - edict_t *pClient = INDEXENT(1); - // Can't play if the client is not connected! if (!pClient) return; @@ -627,9 +624,9 @@ void PlayCDTrack(int iTrack) } // only plays for ONE client, so only use in single play! -void CTriggerCDAudio::PlayTrack() +void CTriggerCDAudio::PlayTrack(edict_t *pEdict) { - PlayCDTrack(int(pev->health)); + PlayCDTrack(pEdict, int(pev->health)); SetTouch(NULL); UTIL_Remove(this); @@ -661,7 +658,7 @@ void CTargetCDAudio::__MAKE_VHOOK(Spawn)() void CTargetCDAudio::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) { - Play(); + Play(pCaller->edict()); } // only plays for ONE client, so only use in single play! @@ -678,13 +675,13 @@ void CTargetCDAudio::__MAKE_VHOOK(Think)() if ((pClient->v.origin - pev->origin).Length() <= pev->scale) { - Play(); + Play(pClient); } } -void CTargetCDAudio::Play() +void CTargetCDAudio::Play(edict_t *pEdict) { - PlayCDTrack(int(pev->health)); + PlayCDTrack(pEdict, int(pev->health)); UTIL_Remove(this); } diff --git a/regamedll/dlls/triggers.h b/regamedll/dlls/triggers.h index 63635649..27a3c72a 100644 --- a/regamedll/dlls/triggers.h +++ b/regamedll/dlls/triggers.h @@ -323,7 +323,7 @@ public: #endif public: - void PlayTrack(); + void PlayTrack(edict_t *pEdict); }; // This plays a CD track when fired or when the player enters it's radius @@ -345,7 +345,7 @@ public: #endif public: - void Play(); + void Play(edict_t *pEdict); }; // QUAKED trigger_multiple (.5 .5 .5) ? notouch @@ -761,7 +761,7 @@ public: float m_fDensity; }; -void PlayCDTrack(int iTrack); +void PlayCDTrack(edict_t *pClient, int iTrack); int BuildChangeList(LEVELLIST *pLevelList, int maxList); void NextLevel(); diff --git a/regamedll/regamedll/regamedll_interfaces_impl.cpp b/regamedll/regamedll/regamedll_interfaces_impl.cpp index 3c413003..02d169c4 100644 --- a/regamedll/regamedll/regamedll_interfaces_impl.cpp +++ b/regamedll/regamedll/regamedll_interfaces_impl.cpp @@ -90,8 +90,7 @@ bool EXT_FUNC CCSPlayer::JoinTeam(TeamName team) pPlayer->pev->solid = SOLID_NOT; pPlayer->pev->movetype = MOVETYPE_NOCLIP; - pPlayer->pev->effects = EF_NODRAW; - pPlayer->pev->effects |= EF_NOINTERP; + pPlayer->pev->effects = (EF_NODRAW | EF_NOINTERP); pPlayer->pev->takedamage = DAMAGE_NO; pPlayer->pev->deadflag = DEAD_DEAD; pPlayer->pev->velocity = g_vecZero; @@ -102,6 +101,13 @@ bool EXT_FUNC CCSPlayer::JoinTeam(TeamName team) pPlayer->m_fDeadTime = 0; pPlayer->has_disconnected = false; + if (pPlayer->m_bJustConnected) { + pPlayer->m_iObserverLastMode = OBS_ROAMING; + pPlayer->m_iObserverC4State = 0; + pPlayer->m_bObserverHasDefuser = false; + pPlayer->SetObserverAutoDirector(false); + } + pPlayer->m_iJoiningState = GETINTOGAME; pPlayer->SendItemStatus(); @@ -131,7 +137,6 @@ bool EXT_FUNC CCSPlayer::JoinTeam(TeamName team) pPlayer->m_iTeam = team; pPlayer->TeamChangeUpdate(); - CSGameRules()->CheckWinConditions(); return true; }