Bug fixes and other minor improvements

This commit is contained in:
s1lent 2017-05-24 23:07:37 +07:00
parent 02ef683824
commit 2f599d21b8
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
7 changed files with 32 additions and 24 deletions

View File

@ -439,8 +439,7 @@ void EXT_FUNC ClientPutInServer(edict_t *pEntity)
pPlayer->pev->flags |= FL_SPECTATOR; pPlayer->pev->flags |= FL_SPECTATOR;
pPlayer->pev->solid = SOLID_NOT; pPlayer->pev->solid = SOLID_NOT;
pPlayer->pev->movetype = MOVETYPE_NOCLIP; pPlayer->pev->movetype = MOVETYPE_NOCLIP;
pPlayer->pev->effects = EF_NODRAW; pPlayer->pev->effects = (EF_NODRAW | EF_NOINTERP);
pPlayer->pev->effects |= EF_NOINTERP;
pPlayer->pev->takedamage = DAMAGE_NO; pPlayer->pev->takedamage = DAMAGE_NO;
pPlayer->pev->deadflag = DEAD_DEAD; pPlayer->pev->deadflag = DEAD_DEAD;
pPlayer->pev->velocity = g_vecZero; pPlayer->pev->velocity = g_vecZero;

View File

@ -1090,7 +1090,7 @@ void CHostage::MoveToward(const Vector &vecLoc)
pFollowing = GetClassPtr<CCSEntity>((CBaseEntity *)m_hTargetEnt->pev); pFollowing = GetClassPtr<CCSEntity>((CBaseEntity *)m_hTargetEnt->pev);
vecMove = vecLoc - pev->origin; 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); UTIL_MakeVectorsPrivate(vecAng, vecFwd, NULL, NULL);
if ((vecFwd * s_flStepSize_LocalNav).Length2D() <= (vecLoc - pev->origin).Length2D()) if ((vecFwd * s_flStepSize_LocalNav).Length2D() <= (vecLoc - pev->origin).Length2D())

View File

@ -4054,6 +4054,8 @@ void EXT_FUNC CHalfLifeMultiplay::__API_VHOOK(DeathNotice)(CBasePlayer *pVictim,
GETPLAYERAUTHID(pVictim->edict()), team, killer_weapon_name); GETPLAYERAUTHID(pVictim->edict()), team, killer_weapon_name);
} }
// TODO: It is called in CBasePlayer::Killed too, most likely,
// an unnecessary call. (Need investigate)
CheckWinConditions(); CheckWinConditions();
MESSAGE_BEGIN(MSG_SPEC, SVC_DIRECTOR); MESSAGE_BEGIN(MSG_SPEC, SVC_DIRECTOR);

View File

@ -3662,10 +3662,10 @@ void CBasePlayer::PlayerDeathThink()
#endif #endif
{ {
pev->deadflag = DEAD_RESPAWNABLE; pev->deadflag = DEAD_RESPAWNABLE;
}
if (CSGameRules()->IsMultiplayer()) if (CSGameRules()->IsMultiplayer())
CSGameRules()->CheckWinConditions(); CSGameRules()->CheckWinConditions();
}
} }
pev->nextthink = gpGlobals->time + 0.1f; pev->nextthink = gpGlobals->time + 0.1f;
@ -8276,6 +8276,11 @@ void CBasePlayer::SpawnClientSideCorpse()
return; return;
#endif #endif
#ifdef REGAMEDLL_ADD
if (forcerespawn.value > 0.0f)
return;
#endif
char *infobuffer = GET_INFO_BUFFER(edict()); char *infobuffer = GET_INFO_BUFFER(edict());
char *pModel = GET_KEY_VALUE(infobuffer, "model"); char *pModel = GET_KEY_VALUE(infobuffer, "model");

View File

@ -544,7 +544,7 @@ void CTriggerCDAudio::__MAKE_VHOOK(Touch)(CBaseEntity *pOther)
return; return;
} }
PlayTrack(); PlayTrack(pOther->edict());
} }
void CTriggerCDAudio::__MAKE_VHOOK(Spawn)() 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) void CTriggerCDAudio::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
{ {
PlayTrack(); PlayTrack(pCaller->edict());
} }
#ifdef REGAMEDLL_FIXES #ifdef REGAMEDLL_FIXES
@ -591,11 +591,8 @@ const char *g_szMP3trackFileMap[] =
}; };
#endif #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! // Can't play if the client is not connected!
if (!pClient) if (!pClient)
return; return;
@ -627,9 +624,9 @@ void PlayCDTrack(int iTrack)
} }
// only plays for ONE client, so only use in single play! // 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); SetTouch(NULL);
UTIL_Remove(this); 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) 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! // 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) 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); UTIL_Remove(this);
} }

View File

@ -323,7 +323,7 @@ public:
#endif #endif
public: public:
void PlayTrack(); void PlayTrack(edict_t *pEdict);
}; };
// This plays a CD track when fired or when the player enters it's radius // This plays a CD track when fired or when the player enters it's radius
@ -345,7 +345,7 @@ public:
#endif #endif
public: public:
void Play(); void Play(edict_t *pEdict);
}; };
// QUAKED trigger_multiple (.5 .5 .5) ? notouch // QUAKED trigger_multiple (.5 .5 .5) ? notouch
@ -761,7 +761,7 @@ public:
float m_fDensity; float m_fDensity;
}; };
void PlayCDTrack(int iTrack); void PlayCDTrack(edict_t *pClient, int iTrack);
int BuildChangeList(LEVELLIST *pLevelList, int maxList); int BuildChangeList(LEVELLIST *pLevelList, int maxList);
void NextLevel(); void NextLevel();

View File

@ -90,8 +90,7 @@ bool EXT_FUNC CCSPlayer::JoinTeam(TeamName team)
pPlayer->pev->solid = SOLID_NOT; pPlayer->pev->solid = SOLID_NOT;
pPlayer->pev->movetype = MOVETYPE_NOCLIP; pPlayer->pev->movetype = MOVETYPE_NOCLIP;
pPlayer->pev->effects = EF_NODRAW; pPlayer->pev->effects = (EF_NODRAW | EF_NOINTERP);
pPlayer->pev->effects |= EF_NOINTERP;
pPlayer->pev->takedamage = DAMAGE_NO; pPlayer->pev->takedamage = DAMAGE_NO;
pPlayer->pev->deadflag = DEAD_DEAD; pPlayer->pev->deadflag = DEAD_DEAD;
pPlayer->pev->velocity = g_vecZero; pPlayer->pev->velocity = g_vecZero;
@ -102,6 +101,13 @@ bool EXT_FUNC CCSPlayer::JoinTeam(TeamName team)
pPlayer->m_fDeadTime = 0; pPlayer->m_fDeadTime = 0;
pPlayer->has_disconnected = false; 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->m_iJoiningState = GETINTOGAME;
pPlayer->SendItemStatus(); pPlayer->SendItemStatus();
@ -131,7 +137,6 @@ bool EXT_FUNC CCSPlayer::JoinTeam(TeamName team)
pPlayer->m_iTeam = team; pPlayer->m_iTeam = team;
pPlayer->TeamChangeUpdate(); pPlayer->TeamChangeUpdate();
CSGameRules()->CheckWinConditions();
return true; return true;
} }