|
|
|
@ -78,7 +78,7 @@ called when a player connects to a server
@@ -78,7 +78,7 @@ called when a player connects to a server
|
|
|
|
|
*/ |
|
|
|
|
BOOL ClientConnect( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[ 128 ] ) |
|
|
|
|
{ |
|
|
|
|
if( pEntity ) |
|
|
|
|
if( mp_coop.value && pEntity ) |
|
|
|
|
{ |
|
|
|
|
CBasePlayer *pl = (CBasePlayer *)CBaseEntity::Instance( pEntity ) ; |
|
|
|
|
if( pl ) |
|
|
|
@ -86,12 +86,9 @@ BOOL ClientConnect( edict_t *pEntity, const char *pszName, const char *pszAddres
@@ -86,12 +86,9 @@ BOOL ClientConnect( edict_t *pEntity, const char *pszName, const char *pszAddres
|
|
|
|
|
pl->m_state = STATE_UNINITIALIZED; |
|
|
|
|
pl->RemoveAllItems( TRUE ); |
|
|
|
|
BecomeSpectator( pl ); |
|
|
|
|
//ClientPutInServer( pl->edict() );
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//g_engfuncs.pfnQueryClientCvarValue2( pEntity, "touch_enable", 111 );
|
|
|
|
|
|
|
|
|
|
return g_pGameRules->ClientConnected( pEntity, pszName, pszAddress, szRejectReason ); |
|
|
|
|
|
|
|
|
|
// a client connecting during an intermission can cause problems
|
|
|
|
@ -139,9 +136,12 @@ void ClientDisconnect( edict_t *pEntity )
@@ -139,9 +136,12 @@ void ClientDisconnect( edict_t *pEntity )
|
|
|
|
|
UTIL_SetOrigin ( &pEntity->v, pEntity->v.origin ); |
|
|
|
|
|
|
|
|
|
g_pGameRules->ClientDisconnected( pEntity ); |
|
|
|
|
CBasePlayer *pPlayer = (CBasePlayer*)CBaseEntity::Instance( pEntity ); |
|
|
|
|
if( pPlayer ) |
|
|
|
|
pPlayer->m_state = STATE_UNINITIALIZED; |
|
|
|
|
if( mp_coop.value ) |
|
|
|
|
{ |
|
|
|
|
CBasePlayer *pPlayer = (CBasePlayer*)CBaseEntity::Instance( pEntity ); |
|
|
|
|
if( pPlayer ) |
|
|
|
|
pPlayer->m_state = STATE_UNINITIALIZED; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -216,7 +216,7 @@ void ClientPutInServer( edict_t *pEntity )
@@ -216,7 +216,7 @@ void ClientPutInServer( edict_t *pEntity )
|
|
|
|
|
|
|
|
|
|
pPlayer = GetClassPtr((CBasePlayer *)pev); |
|
|
|
|
pPlayer->SetCustomDecalFrames(-1); // Assume none;
|
|
|
|
|
if( pPlayer->m_state == STATE_UNINITIALIZED ) |
|
|
|
|
if( mp_coop.value && pPlayer->m_state == STATE_UNINITIALIZED ) |
|
|
|
|
g_engfuncs.pfnQueryClientCvarValue2( pEntity, "touch_enable", 111 ); |
|
|
|
|
|
|
|
|
|
pPlayer->m_state = STATE_CONNECTED; |
|
|
|
@ -224,8 +224,12 @@ void ClientPutInServer( edict_t *pEntity )
@@ -224,8 +224,12 @@ void ClientPutInServer( edict_t *pEntity )
|
|
|
|
|
// Allocate a CBasePlayer for pev, and call spawn
|
|
|
|
|
pPlayer->Spawn(); |
|
|
|
|
|
|
|
|
|
pPlayer->RemoveAllItems( TRUE ); |
|
|
|
|
BecomeSpectator( pPlayer ); |
|
|
|
|
// AGHL-like spectator
|
|
|
|
|
if( mp_spectator.value ) |
|
|
|
|
{ |
|
|
|
|
pPlayer->RemoveAllItems( TRUE ); |
|
|
|
|
BecomeSpectator( pPlayer ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Reset interpolation during first frame
|
|
|
|
|
pPlayer->pev->effects |= EF_NOINTERP; |
|
|
|
@ -530,27 +534,31 @@ void ClientCommand( edict_t *pEntity )
@@ -530,27 +534,31 @@ void ClientCommand( edict_t *pEntity )
|
|
|
|
|
else if( FStrEq(pcmd, "m1")) |
|
|
|
|
{ |
|
|
|
|
#define MENU_STR(VAR) (#VAR) |
|
|
|
|
CLIENT_COMMAND( pEntity, |
|
|
|
|
MENU_STR(touch_addbutton "_coops" "*black" "" 0.15 0.1 0.4 0.72 0 0 0 128 334\ntouch_addbutton "_coopst" "#COOP MENU" "" 0.16 0.11 0.41 0.3 0 255 0 255 78 1.5\nm2\n) |
|
|
|
|
); |
|
|
|
|
if( mp_coop.value ) |
|
|
|
|
CLIENT_COMMAND( pEntity, |
|
|
|
|
MENU_STR(touch_addbutton "_coops" "*black" "" 0.15 0.1 0.4 0.72 0 0 0 128 334\ntouch_addbutton "_coopst" "#COOP MENU" "" 0.16 0.11 0.41 0.3 0 255 0 255 78 1.5\nm2\n) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
else if( FStrEq(pcmd, "m2")) |
|
|
|
|
{ |
|
|
|
|
CLIENT_COMMAND( pEntity, |
|
|
|
|
MENU_STR(touch_addbutton "_coops1" "#1. Join coop" "menuselect 1;touch_hide _coops*" 0.16 0.21 0.39 0.3 255 255 255 255 334 1.5\ntouch_addbutton "_coops2" "#2. Become spectator" "menuselect 2;touch_hide _coops*" 0.16 0.31 0.39 0.4 255 255 255 255 334 1.5\nm3\n) |
|
|
|
|
); |
|
|
|
|
if( mp_coop.value ) |
|
|
|
|
CLIENT_COMMAND( pEntity, |
|
|
|
|
MENU_STR(touch_addbutton "_coops1" "#1. Join coop" "menuselect 1;touch_hide _coops*" 0.16 0.21 0.39 0.3 255 255 255 255 334 1.5\ntouch_addbutton "_coops2" "#2. Become spectator" "menuselect 2;touch_hide _coops*" 0.16 0.31 0.39 0.4 255 255 255 255 334 1.5\nm3\n) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
else if( FStrEq(pcmd, "m3")) |
|
|
|
|
{ |
|
|
|
|
CLIENT_COMMAND( pEntity, |
|
|
|
|
MENU_STR(touch_addbutton "_coops3" "#" "menuselect 3;touch_hide _coops*" 0.16 0.41 0.39 0.5 255 255 255 255 335 1.5\ntouch_addbutton "_coops4" "#" "menuselect 4;touch_hide _coops*" 0.16 0.51 0.39 0.6 255 255 255 255 335 1.5\nm4\n) |
|
|
|
|
); |
|
|
|
|
if( mp_coop.value ) |
|
|
|
|
CLIENT_COMMAND( pEntity, |
|
|
|
|
MENU_STR(touch_addbutton "_coops3" "#" "menuselect 3;touch_hide _coops*" 0.16 0.41 0.39 0.5 255 255 255 255 335 1.5\ntouch_addbutton "_coops4" "#" "menuselect 4;touch_hide _coops*" 0.16 0.51 0.39 0.6 255 255 255 255 335 1.5\nm4\n) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
else if( FStrEq(pcmd, "m4")) |
|
|
|
|
{ |
|
|
|
|
CLIENT_COMMAND( pEntity, |
|
|
|
|
MENU_STR(touch_addbutton "_coops5" "#" "menuselect 5;touch_hide _coops*" 0.16 0.61 0.39 0.7 255 255 255 255 335 1.5;wait;slot10\n) |
|
|
|
|
); |
|
|
|
|
if( mp_coop.value ) |
|
|
|
|
CLIENT_COMMAND( pEntity, |
|
|
|
|
MENU_STR(touch_addbutton "_coops5" "#" "menuselect 5;touch_hide _coops*" 0.16 0.61 0.39 0.7 255 255 255 255 335 1.5;wait;slot10\n) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -1891,7 +1899,7 @@ void CreateInstancedBaselines ( void )
@@ -1891,7 +1899,7 @@ void CreateInstancedBaselines ( void )
|
|
|
|
|
|
|
|
|
|
void CvarValue2( const edict_t *pEnt, int requestID, const char *cvarName, const char *value ) |
|
|
|
|
{ |
|
|
|
|
if( pEnt && requestID == 111 && FStrEq( cvarName , "touch_enable" ) && atoi( value) ) |
|
|
|
|
if( mp_coop.value && pEnt && requestID == 111 && FStrEq( cvarName , "touch_enable" ) && atoi( value) ) |
|
|
|
|
{ |
|
|
|
|
CBasePlayer *player = (CBasePlayer * ) CBaseEntity::Instance( (edict_t*)pEnt ); |
|
|
|
|
player->m_fTouchMenu = !!atof( value ); |
|
|
|
|