mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-04-09 19:20:03 +03:00
Added some features to the API
This commit is contained in:
parent
d71dda542d
commit
e57371d0f4
@ -100,19 +100,6 @@ NOXREF void set_suicide_frame(entvars_t *pev)
|
|||||||
pev->nextthink = -1;
|
pev->nextthink = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TeamChangeUpdate(CBasePlayer *player, int team_id)
|
|
||||||
{
|
|
||||||
MESSAGE_BEGIN(MSG_ALL, gmsgTeamInfo);
|
|
||||||
WRITE_BYTE(player->entindex());
|
|
||||||
WRITE_STRING(GetTeamName(team_id));
|
|
||||||
MESSAGE_END();
|
|
||||||
|
|
||||||
if (team_id != UNASSIGNED)
|
|
||||||
{
|
|
||||||
player->SetScoreboardAttributes();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlinkAccount(CBasePlayer *player, int numBlinks)
|
void BlinkAccount(CBasePlayer *player, int numBlinks)
|
||||||
{
|
{
|
||||||
MESSAGE_BEGIN(MSG_ONE, gmsgBlinkAcct, NULL, player->pev);
|
MESSAGE_BEGIN(MSG_ONE, gmsgBlinkAcct, NULL, player->pev);
|
||||||
@ -1650,7 +1637,9 @@ BOOL __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
|
|||||||
player->RemoveAllItems(TRUE);
|
player->RemoveAllItems(TRUE);
|
||||||
player->m_bHasC4 = false;
|
player->m_bHasC4 = false;
|
||||||
|
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
if (player->m_iTeam != SPECTATOR)
|
if (player->m_iTeam != SPECTATOR)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// notify other clients of player joined to team spectator
|
// notify other clients of player joined to team spectator
|
||||||
UTIL_LogPrintf("\"%s<%i><%s><%s>\" joined team \"SPECTATOR\"\n", STRING(player->pev->netname),
|
UTIL_LogPrintf("\"%s<%i><%s><%s>\" joined team \"SPECTATOR\"\n", STRING(player->pev->netname),
|
||||||
@ -1684,16 +1673,18 @@ BOOL __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
|
|||||||
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, player);
|
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
TeamChangeUpdate(player, player->m_iTeam);
|
player->TeamChangeUpdate();
|
||||||
|
|
||||||
edict_t *pentSpawnSpot = g_pGameRules->GetPlayerSpawnSpot(player);
|
edict_t *pentSpawnSpot = g_pGameRules->GetPlayerSpawnSpot(player);
|
||||||
player->StartObserver(pentSpawnSpot->v.origin, pentSpawnSpot->v.angles);
|
player->StartObserver(pentSpawnSpot->v.origin, pentSpawnSpot->v.angles);
|
||||||
|
|
||||||
|
#ifndef REGAMEDLL_FIXES
|
||||||
|
// TODO: it was already sent in StartObserver
|
||||||
MESSAGE_BEGIN(MSG_ALL, gmsgSpectator);
|
MESSAGE_BEGIN(MSG_ALL, gmsgSpectator);
|
||||||
WRITE_BYTE(ENTINDEX(player->edict()));
|
WRITE_BYTE(ENTINDEX(player->edict()));
|
||||||
WRITE_BYTE(1);
|
WRITE_BYTE(1);
|
||||||
MESSAGE_END();
|
MESSAGE_END();
|
||||||
|
#endif
|
||||||
// do we have fadetoblack on? (need to fade their screen back in)
|
// do we have fadetoblack on? (need to fade their screen back in)
|
||||||
if (fadetoblack.value)
|
if (fadetoblack.value)
|
||||||
{
|
{
|
||||||
@ -1719,12 +1710,10 @@ BOOL __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
|
|||||||
// If the code gets this far, the team is not TEAM_UNASSIGNED
|
// If the code gets this far, the team is not TEAM_UNASSIGNED
|
||||||
// Player is switching to a new team (It is possible to switch to the
|
// Player is switching to a new team (It is possible to switch to the
|
||||||
// same team just to choose a new appearance)
|
// same team just to choose a new appearance)
|
||||||
|
|
||||||
if (CSGameRules()->TeamFull(team))
|
if (CSGameRules()->TeamFull(team))
|
||||||
{
|
{
|
||||||
// The specified team is full
|
// The specified team is full
|
||||||
// attempt to kick a bot to make room for this player
|
// attempt to kick a bot to make room for this player
|
||||||
|
|
||||||
bool madeRoom = false;
|
bool madeRoom = false;
|
||||||
if (cv_bot_auto_vacate.value > 0 && !player->IsBot())
|
if (cv_bot_auto_vacate.value > 0 && !player->IsBot())
|
||||||
{
|
{
|
||||||
@ -1834,7 +1823,6 @@ BOOL __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
|
|||||||
|
|
||||||
// Show the appropriate Choose Appearance menu
|
// Show the appropriate Choose Appearance menu
|
||||||
// This must come before ClientKill() for CheckWinConditions() to function properly
|
// This must come before ClientKill() for CheckWinConditions() to function properly
|
||||||
|
|
||||||
if (player->pev->deadflag == DEAD_NO)
|
if (player->pev->deadflag == DEAD_NO)
|
||||||
{
|
{
|
||||||
ClientKill(player->edict());
|
ClientKill(player->edict());
|
||||||
@ -1850,7 +1838,7 @@ BOOL __API_HOOK(HandleMenu_ChooseTeam)(CBasePlayer *player, int slot)
|
|||||||
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, player);
|
TheBots->OnEvent(EVENT_PLAYER_CHANGED_TEAM, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
TeamChangeUpdate(player, player->m_iTeam);
|
player->TeamChangeUpdate();
|
||||||
|
|
||||||
szOldTeam = GetTeam(oldTeam);
|
szOldTeam = GetTeam(oldTeam);
|
||||||
szNewTeam = GetTeam(team);
|
szNewTeam = GetTeam(team);
|
||||||
|
@ -114,7 +114,6 @@ extern unsigned short g_iShadowSprite;
|
|||||||
int CMD_ARGC_();
|
int CMD_ARGC_();
|
||||||
const char *CMD_ARGV_(int i);
|
const char *CMD_ARGV_(int i);
|
||||||
void set_suicide_frame(entvars_t *pev);
|
void set_suicide_frame(entvars_t *pev);
|
||||||
void TeamChangeUpdate(CBasePlayer *player, int team_id);
|
|
||||||
void BlinkAccount(CBasePlayer *player, int numBlinks = 2);
|
void BlinkAccount(CBasePlayer *player, int numBlinks = 2);
|
||||||
BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason);
|
BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason);
|
||||||
void ClientDisconnect(edict_t *pEntity);
|
void ClientDisconnect(edict_t *pEntity);
|
||||||
|
@ -9309,3 +9309,16 @@ void CBasePlayer::ReloadWeapons(CBasePlayerItem *pWeapon, bool bForceReload, boo
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CBasePlayer::TeamChangeUpdate()
|
||||||
|
{
|
||||||
|
MESSAGE_BEGIN(MSG_ALL, gmsgTeamInfo);
|
||||||
|
WRITE_BYTE(entindex());
|
||||||
|
WRITE_STRING(GetTeamName(m_iTeam));
|
||||||
|
MESSAGE_END();
|
||||||
|
|
||||||
|
if (m_iTeam != UNASSIGNED)
|
||||||
|
{
|
||||||
|
SetScoreboardAttributes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -594,6 +594,7 @@ public:
|
|||||||
edict_t *EntSelectSpawnPoint();
|
edict_t *EntSelectSpawnPoint();
|
||||||
void SetScoreAttrib(CBasePlayer *dest);
|
void SetScoreAttrib(CBasePlayer *dest);
|
||||||
void ReloadWeapons(CBasePlayerItem *pWeapon = nullptr, bool bForceReload = false, bool bForceRefill = false);
|
void ReloadWeapons(CBasePlayerItem *pWeapon = nullptr, bool bForceReload = false, bool bForceRefill = false);
|
||||||
|
void TeamChangeUpdate();
|
||||||
|
|
||||||
#ifdef REGAMEDLL_ADD
|
#ifdef REGAMEDLL_ADD
|
||||||
CCSPlayer *CSPlayer() const;
|
CCSPlayer *CSPlayer() const;
|
||||||
|
@ -83,6 +83,9 @@ public:
|
|||||||
virtual bool SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &pSpot);
|
virtual bool SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &pSpot);
|
||||||
virtual bool SwitchWeapon(CBasePlayerItem *pWeapon);
|
virtual bool SwitchWeapon(CBasePlayerItem *pWeapon);
|
||||||
virtual void SwitchTeam();
|
virtual void SwitchTeam();
|
||||||
|
virtual bool JoinTeam(TeamName team);
|
||||||
|
virtual void StartObserver(Vector& vecPosition, Vector& vecViewAngle);
|
||||||
|
virtual void TeamChangeUpdate();
|
||||||
|
|
||||||
CBasePlayer *BasePlayer() const;
|
CBasePlayer *BasePlayer() const;
|
||||||
public:
|
public:
|
||||||
|
@ -36,6 +36,95 @@ Vector CCSEntity::FireBullets3(Vector &vecSrc, Vector &vecDirShooting, float vec
|
|||||||
return m_pContainingEntity->FireBullets3(vecSrc, vecDirShooting, vecSpread, flDistance, iPenetration, iBulletType, iDamage, flRangeModifier, pevAttacker, bPistol, shared_rand);
|
return m_pContainingEntity->FireBullets3(vecSrc, vecDirShooting, vecSpread, flDistance, iPenetration, iBulletType, iDamage, flRangeModifier, pevAttacker, bPistol, shared_rand);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool CCSPlayer::JoinTeam(TeamName team)
|
||||||
|
{
|
||||||
|
CBasePlayer *pPlayer = BasePlayer();
|
||||||
|
switch (team)
|
||||||
|
{
|
||||||
|
case SPECTATOR:
|
||||||
|
{
|
||||||
|
// are we already a spectator?
|
||||||
|
if (pPlayer->m_iTeam == SPECTATOR)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
pPlayer->RemoveAllItems(TRUE);
|
||||||
|
pPlayer->m_bHasC4 = false;
|
||||||
|
|
||||||
|
pPlayer->m_iTeam = SPECTATOR;
|
||||||
|
pPlayer->m_iJoiningState = JOINED;
|
||||||
|
|
||||||
|
pPlayer->m_pIntroCamera = NULL;
|
||||||
|
pPlayer->m_bTeamChanged = true;
|
||||||
|
|
||||||
|
pPlayer->TeamChangeUpdate();
|
||||||
|
|
||||||
|
edict_t *pentSpawnSpot = g_pGameRules->GetPlayerSpawnSpot(pPlayer);
|
||||||
|
pPlayer->StartObserver(pentSpawnSpot->v.origin, pentSpawnSpot->v.angles);
|
||||||
|
|
||||||
|
// do we have fadetoblack on? (need to fade their screen back in)
|
||||||
|
if (fadetoblack.value)
|
||||||
|
{
|
||||||
|
UTIL_ScreenFade(pPlayer, Vector(0, 0, 0), 0.001, 0, 0, FFADE_IN);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case CT:
|
||||||
|
case TERRORIST:
|
||||||
|
{
|
||||||
|
if (pPlayer->m_iTeam == SPECTATOR)
|
||||||
|
{
|
||||||
|
// If they're switching into spectator, setup spectator properties..
|
||||||
|
pPlayer->m_bNotKilled = true;
|
||||||
|
pPlayer->m_iIgnoreGlobalChat = IGNOREMSG_NONE;
|
||||||
|
pPlayer->m_iTeamKills = 0;
|
||||||
|
|
||||||
|
pPlayer->pev->solid = SOLID_NOT;
|
||||||
|
pPlayer->pev->movetype = MOVETYPE_NOCLIP;
|
||||||
|
pPlayer->pev->effects = EF_NODRAW;
|
||||||
|
pPlayer->pev->effects |= EF_NOINTERP;
|
||||||
|
pPlayer->pev->takedamage = DAMAGE_NO;
|
||||||
|
pPlayer->pev->deadflag = DEAD_DEAD;
|
||||||
|
pPlayer->pev->velocity = g_vecZero;
|
||||||
|
pPlayer->pev->punchangle = g_vecZero;
|
||||||
|
|
||||||
|
pPlayer->m_bHasNightVision = false;
|
||||||
|
pPlayer->m_iHostagesKilled = 0;
|
||||||
|
pPlayer->m_fDeadTime = 0;
|
||||||
|
pPlayer->has_disconnected = false;
|
||||||
|
|
||||||
|
pPlayer->m_iJoiningState = GETINTOGAME;
|
||||||
|
pPlayer->SendItemStatus();
|
||||||
|
|
||||||
|
SET_CLIENT_MAXSPEED(ENT(pPlayer->pev), 1);
|
||||||
|
SET_MODEL(ENT(pPlayer->pev), "models/player.mdl");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pPlayer->pev->deadflag == DEAD_NO)
|
||||||
|
{
|
||||||
|
ClientKill(pPlayer->edict());
|
||||||
|
pPlayer->pev->frags++;
|
||||||
|
}
|
||||||
|
|
||||||
|
MESSAGE_BEGIN(MSG_BROADCAST, gmsgScoreInfo);
|
||||||
|
WRITE_BYTE(ENTINDEX(pPlayer->edict()));
|
||||||
|
WRITE_SHORT(int(pPlayer->pev->frags));
|
||||||
|
WRITE_SHORT(pPlayer->m_iDeaths);
|
||||||
|
WRITE_SHORT(0);
|
||||||
|
WRITE_SHORT(0);
|
||||||
|
MESSAGE_END();
|
||||||
|
|
||||||
|
// Switch their actual team...
|
||||||
|
pPlayer->m_bTeamChanged = true;
|
||||||
|
pPlayer->m_iTeam = team;
|
||||||
|
pPlayer->TeamChangeUpdate();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool CCSPlayer::RemovePlayerItem(const char* pszItemName)
|
bool CCSPlayer::RemovePlayerItem(const char* pszItemName)
|
||||||
{
|
{
|
||||||
CBasePlayer *pPlayer = BasePlayer();
|
CBasePlayer *pPlayer = BasePlayer();
|
||||||
@ -89,3 +178,5 @@ void CCSPlayer::Observer_SetMode(int iMode) { BasePlayer()->Observer_SetMode(iMo
|
|||||||
bool CCSPlayer::SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &pSpot) { return BasePlayer()->SelectSpawnSpot(pEntClassName, pSpot); }
|
bool CCSPlayer::SelectSpawnSpot(const char *pEntClassName, CBaseEntity* &pSpot) { return BasePlayer()->SelectSpawnSpot(pEntClassName, pSpot); }
|
||||||
bool CCSPlayer::SwitchWeapon(CBasePlayerItem *pWeapon) { return BasePlayer()->SwitchWeapon(pWeapon) != FALSE; }
|
bool CCSPlayer::SwitchWeapon(CBasePlayerItem *pWeapon) { return BasePlayer()->SwitchWeapon(pWeapon) != FALSE; }
|
||||||
void CCSPlayer::SwitchTeam() { BasePlayer()->SwitchTeam(); }
|
void CCSPlayer::SwitchTeam() { BasePlayer()->SwitchTeam(); }
|
||||||
|
void CCSPlayer::StartObserver(Vector& vecPosition, Vector& vecViewAngle) { BasePlayer()->StartObserver(vecPosition, vecViewAngle); }
|
||||||
|
void CCSPlayer::TeamChangeUpdate() { BasePlayer()->TeamChangeUpdate(); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user