Пример #1
0
void CDiscwarPowerup::Activate(void)
{
	// If Arena mode is on, spawn another powerup for every arena
	if(InArenaMode())
	{
		// If our groupinfo is set, we're not the first powerup
		if(pev->groupinfo == 0)
		{
			// Put this powerup in the first arena
			pev->groupinfo = g_pArenaList[0]->pev->groupinfo;

			// Create a powerup for each of the other arenas
			for(int i = 1; i < MAX_ARENAS; i++)
			{
				CBaseEntity *pPowerup;

				pPowerup                 = CBaseEntity::Create("item_powerup", pev->origin, pev->angles);
				pPowerup->pev->groupinfo = g_pArenaList[i]->pev->groupinfo;
			}
		}
	}
	else
	{
		// Make the powerup start thinking
		Enable();
	}
}
Пример #2
0
/*
===========
ClientPutInServer

called when the player is first put in the server
============
*/
void ClientPutInServer( edict_t *pEntity )
{
	CBasePlayer *pPlayer;

	entvars_t *pev = &pEntity->v;

	pPlayer = GetClassPtr((CBasePlayer *)pev);
	pPlayer->SetCustomDecalFrames(-1); // Assume none;

	// Allocate a CBasePlayer for pev, and call spawn
	pPlayer->Spawn();

	pPlayer->m_bHasDisconnected = FALSE;

	// Reset interpolation during first frame
	pPlayer->pev->effects |= EF_NOINTERP;
	pPlayer->m_pCurrentArena = NULL;
	pPlayer->m_flKnownItemTime = gpGlobals->time + 0.3;
	pPlayer->m_iLastGameResult = GAME_DIDNTPLAY;	

	// Add to an Arena (1 maxplayer allows mapmakers to run around their map)
	if ( InArenaMode() )
	{
		AddClientToArena( pPlayer );
	}
	else
	{
		// Put everyone on different teams
		pPlayer->pev->team = ENTINDEX( pEntity );
		pPlayer->pev->iuser4 = pPlayer->pev->team;

		// Set colors
		int iHue = GetHueFromRGB( g_iaDiscColors[ pPlayer->pev->team][0] / 255, g_iaDiscColors[pPlayer->pev->team][1] / 255, g_iaDiscColors[pPlayer->pev->team][2] / 255 );
		g_engfuncs.pfnSetClientKeyValue( ENTINDEX( pEntity ), g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "topcolor", UTIL_VarArgs("%d", iHue) );
		g_engfuncs.pfnSetClientKeyValue( ENTINDEX( pEntity ), g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "bottomcolor", UTIL_VarArgs("%d", iHue - 10) );
	}

	static char sName[128];
	strcpy(sName,STRING(pPlayer->pev->netname));
	
	// First parse the name and remove any %'s
	for ( char *pApersand = sName; pApersand != NULL && *pApersand != 0; pApersand++ )
	{
		// Replace it with a space
		if ( *pApersand == '%' )
				*pApersand = ' ';
	}

	// notify other clients of player joining the game
	UTIL_ClientPrintAll( HUD_PRINTNOTIFY, "#Game_connected", sName[0] != 0 ? sName : "<unconnected>" );
}
Пример #3
0
	virtual bool CanPlayerHearPlayer(CBasePlayer *pListener, CBasePlayer *pTalker)
	{
		//FFA
		if ( InArenaMode() == FALSE )
			 return true;
		
		if ( pListener->m_pCurrentArena == NULL && pTalker->m_pCurrentArena == NULL )
			 return true; //Both spectating

		if ( pListener->m_pCurrentArena == pTalker->m_pCurrentArena )
			 return true; //Same arena

		return false;
	}
Пример #4
0
void CHalfLifeMultiplay :: UpdateGameMode( CBasePlayer *pPlayer )
{
	MESSAGE_BEGIN( MSG_ONE, gmsgGameMode, NULL, pPlayer->edict() );
		WRITE_BYTE( InArenaMode() );  // game mode none
	MESSAGE_END();
}