mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-02-08 21:14:14 +00:00
Move coop stuff to coop.cpp
This commit is contained in:
parent
41f1b88fa6
commit
a837174564
@ -664,10 +664,6 @@ void ServerDeactivate( void )
|
||||
//
|
||||
}
|
||||
|
||||
void CoopClearData( void );
|
||||
void CoopApplyData( void );
|
||||
void CoopClearWeaponList( void );
|
||||
|
||||
void ServerActivate( edict_t *pEdictList, int edictCount, int clientMax )
|
||||
{
|
||||
int i;
|
||||
@ -704,7 +700,7 @@ void ServerActivate( edict_t *pEdictList, int edictCount, int clientMax )
|
||||
LinkUserMessages();
|
||||
if( mp_coop.value )
|
||||
{
|
||||
CoopApplyData();
|
||||
UTIL_CoopApplyData();
|
||||
for( int i = 1; i <= gpGlobals->maxClients; i++ )
|
||||
{
|
||||
CBasePlayer *plr = (CBasePlayer*)UTIL_PlayerByIndex( i );
|
||||
@ -769,13 +765,12 @@ void ParmsNewLevel( void )
|
||||
if ( pSaveData )
|
||||
{
|
||||
pSaveData->connectionCount = BuildChangeList( pSaveData->levelList, MAX_LEVEL_CONNECTIONS );
|
||||
//CoopApplyData();
|
||||
}
|
||||
else
|
||||
if( mp_coop_changelevel.value )
|
||||
{
|
||||
CoopClearData();
|
||||
CoopClearWeaponList();
|
||||
UTIL_CoopClearData();
|
||||
g_WeaponList.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -789,13 +784,12 @@ void ParmsChangeLevel( void )
|
||||
if ( pSaveData )
|
||||
{
|
||||
pSaveData->connectionCount = BuildChangeList( pSaveData->levelList, MAX_LEVEL_CONNECTIONS );
|
||||
//CoopApplyData();
|
||||
}
|
||||
else
|
||||
if( mp_coop_changelevel.value )
|
||||
{
|
||||
CoopClearData();
|
||||
CoopClearWeaponList();
|
||||
UTIL_CoopClearData();
|
||||
g_WeaponList.Clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ struct checkpoint_s
|
||||
} g_checkpoints[4];
|
||||
|
||||
|
||||
void CoopClearData( void )
|
||||
void UTIL_CoopClearData( void )
|
||||
{
|
||||
// nullify
|
||||
SavedCoords l_SavedCoords = {0};
|
||||
@ -182,7 +182,7 @@ void CoopClearData( void )
|
||||
}
|
||||
|
||||
bool g_fPause;
|
||||
void CoopApplyData( void )
|
||||
void UTIL_CoopApplyData( void )
|
||||
{
|
||||
if( s_SavedCoords.valid )
|
||||
{
|
||||
@ -627,3 +627,62 @@ CBaseEntity *UTIL_CoopGetPlayerTrain( CBaseEntity *pPlayer)
|
||||
return NULL;
|
||||
return train;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Collect all weapons tat player touchet in coop ant give to all players at spawn
|
||||
|
||||
CWeaponList g_WeaponList;
|
||||
|
||||
void CWeaponList::Clear()
|
||||
{
|
||||
m_iWeapons = 0;
|
||||
}
|
||||
void CWeaponList::GiveToPlayer(CBasePlayer *pPlayer)
|
||||
{
|
||||
for(int i = 0; i < m_iWeapons;i++)
|
||||
pPlayer->GiveNamedItem(weapons[i]);
|
||||
}
|
||||
void CWeaponList::AddWeapon( const char *classname )
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < m_iWeapons;i++)
|
||||
if(!strcmp(weapons[i], classname))
|
||||
return;
|
||||
strcpy(weapons[m_iWeapons++], classname);
|
||||
}
|
||||
extern int gmsgShowMenu;
|
||||
|
||||
void UTIL_CoopShowMenu( CBasePlayer *pPlayer, const char *title, int count, const char **slot, signed char time )
|
||||
{
|
||||
if( pPlayer->m_fTouchMenu)
|
||||
{
|
||||
char buf[256];
|
||||
#define MENU_STR(VAR) (#VAR)
|
||||
sprintf( buf, MENU_STR(slot10\ntouch_hide _coops*\ntouch_show _coops\ntouch_addbutton "_coopst" "#%s" "" 0.16 0.11 0.41 0.3 0 255 0 255 78 1.5\n), title);
|
||||
CLIENT_COMMAND( pPlayer->edict(), buf);
|
||||
for( int i = 0; i < count; i++ )
|
||||
{
|
||||
sprintf( buf, MENU_STR(touch_settexture _coops%d "#%d. %s"\ntouch_show _coops%d\n), i+1, i+1, slot[i], i + 1 );
|
||||
CLIENT_COMMAND( pPlayer->edict(), buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[128], *pbuf = buf;
|
||||
short int flags = 1<<9;
|
||||
pbuf += sprintf( pbuf, "^2%s:\n", title );
|
||||
for( int i = 0; i < count; i++ )
|
||||
{
|
||||
pbuf += sprintf( pbuf, "^3%d.^7 %s\n", i+1, slot[i]);
|
||||
flags |= 1<<i;
|
||||
}
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgShowMenu, NULL, pPlayer->pev);
|
||||
WRITE_SHORT( flags ); // slots
|
||||
WRITE_CHAR( time ); // show time
|
||||
WRITE_BYTE( 0 ); // need more
|
||||
WRITE_STRING( buf );
|
||||
MESSAGE_END();
|
||||
}
|
||||
//CLIENT_COMMAND( pPlayer->edict(), "exec touch_default/numbers.cfg\n");
|
||||
}
|
||||
|
@ -65,7 +65,8 @@ bool UTIL_CoopRestorePlayerCoords(CBaseEntity *player, Vector *origin, Vector *a
|
||||
void UTIL_CoopSaveTrain( CBaseEntity *pPlayer, SavedCoords *coords);
|
||||
Vector UTIL_FixupSpawnPoint(Vector spawn);
|
||||
void UTIL_CoopActivateChangeLevel( CBaseEntity *pTrigger );
|
||||
|
||||
void UTIL_CoopClearData( void );
|
||||
void UTIL_CoopApplyData( void );
|
||||
#ifdef PLAYER_H
|
||||
void UTIL_CoopKickPlayer(CBaseEntity *pPlayer);
|
||||
bool UTIL_CoopIsBadPlayer( CBaseEntity *plr );
|
||||
@ -101,6 +102,19 @@ public:
|
||||
};
|
||||
|
||||
extern GlobalMenu g_GlobalMenu;
|
||||
|
||||
class CWeaponList
|
||||
{
|
||||
char weapons[64][256];
|
||||
int m_iWeapons;
|
||||
public:
|
||||
void AddWeapon( const char *classname );
|
||||
void GiveToPlayer(CBasePlayer *pPlayer);
|
||||
void Clear();
|
||||
};
|
||||
|
||||
extern CWeaponList g_WeaponList;
|
||||
|
||||
#endif
|
||||
extern struct SavedCoords g_SavedCoords, s_SavedCoords;
|
||||
|
||||
|
@ -65,79 +65,6 @@ public:
|
||||
static CMultiplayGameMgrHelper g_GameMgrHelper;
|
||||
#endif
|
||||
|
||||
// Collect all weapons tat player touchet in coop ant give to all players at spawn
|
||||
class CWeaponList
|
||||
{
|
||||
char weapons[64][256];
|
||||
int m_iWeapons;
|
||||
public:
|
||||
void AddWeapon( const char *classname )
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < m_iWeapons;i++)
|
||||
if(!strcmp(weapons[i], classname))
|
||||
return;
|
||||
strcpy(weapons[m_iWeapons++], classname);
|
||||
}
|
||||
void GiveToPlayer(CBasePlayer *player)
|
||||
{
|
||||
for(int i = 0; i < m_iWeapons;i++)
|
||||
player->GiveNamedItem(weapons[i]);
|
||||
}
|
||||
void Clear()
|
||||
{
|
||||
m_iWeapons = 0;
|
||||
}
|
||||
} g_WeaponList;
|
||||
|
||||
void CoopClearWeaponList( void )
|
||||
{
|
||||
g_WeaponList.Clear();
|
||||
}
|
||||
extern int g_iMenu;
|
||||
|
||||
|
||||
|
||||
extern int gmsgShowMenu;
|
||||
|
||||
void UTIL_CoopShowMenu( CBasePlayer *pPlayer, const char *title, int count, const char **slot, signed char time )
|
||||
{
|
||||
if( pPlayer->m_fTouchMenu)
|
||||
{
|
||||
char buf[256];
|
||||
#define MENU_STR(VAR) (#VAR)
|
||||
sprintf( buf, MENU_STR(slot10\ntouch_hide _coops*\ntouch_show _coops\ntouch_addbutton "_coopst" "#%s" "" 0.16 0.11 0.41 0.3 0 255 0 255 78 1.5\n), title);
|
||||
CLIENT_COMMAND( pPlayer->edict(), buf);
|
||||
for( int i = 0; i < count; i++ )
|
||||
{
|
||||
sprintf( buf, MENU_STR(touch_settexture _coops%d "#%d. %s"\ntouch_show _coops%d\n), i+1, i+1, slot[i], i + 1 );
|
||||
CLIENT_COMMAND( pPlayer->edict(), buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[128], *pbuf = buf;
|
||||
short int flags = 1<<9;
|
||||
pbuf += sprintf( pbuf, "^2%s:\n", title );
|
||||
for( int i = 0; i < count; i++ )
|
||||
{
|
||||
pbuf += sprintf( pbuf, "^3%d.^7 %s\n", i+1, slot[i]);
|
||||
flags |= 1<<i;
|
||||
}
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsgShowMenu, NULL, pPlayer->pev);
|
||||
WRITE_SHORT( flags ); // slots
|
||||
WRITE_CHAR( time ); // show time
|
||||
WRITE_BYTE( 0 ); // need more
|
||||
WRITE_STRING( buf );
|
||||
MESSAGE_END();
|
||||
}
|
||||
//CLIENT_COMMAND( pPlayer->edict(), "exec touch_default/numbers.cfg\n");
|
||||
}
|
||||
|
||||
void UTIL_CoopMenu( CBasePlayer *pPlayer );
|
||||
|
||||
void UTIL_CoopVoteMenu( CBasePlayer *pPlayer );
|
||||
|
||||
|
||||
//*********************************************************
|
||||
// Rules for the half-life multiplayer game.
|
||||
|
Loading…
x
Reference in New Issue
Block a user