Ejemplo n.º 1
0
void Door::UpdateSector( bool bSectorActive )
{
	for(uint32 nCurrSector = 0; nCurrSector < knNumSectors; nCurrSector++)
	{
		// Do nothing if we don't have a sector
		if( m_sSectorName[nCurrSector].empty() )
			return;

		// Just in case we get in here before we expect to, update the sector ID..
		if( !m_nSectorID[nCurrSector] )
		{
			if( g_pLTServer->GetSectorID( m_sSectorName[nCurrSector].c_str(), &m_nSectorID[nCurrSector] ) != LT_OK )
			{
				// If we can't find the sector, dump a warning and forget...
				char aNameBuff[256];
				g_pLTServer->GetObjectName( m_hObject, aNameBuff, LTARRAYSIZE(aNameBuff) );
				g_pLTServer->CPrint( "Invalid sector specified in door %s: %s", aNameBuff, m_sSectorName[nCurrSector].c_str() );
				m_sSectorName[nCurrSector].clear();
				return;
			}
		}

		m_bSectorsActive = bSectorActive;

		// Send the dynamic sector message to all connected clients...
		// This is temporary until we get the new networking architecture in place.
		// We can't do it with an FX object because activeworldmodels already have an FX object...
		CAutoMessage cMsg;
		cMsg.Writeuint8( MID_DYNAMIC_SECTOR );
		cMsg.Writeuint32( m_nSectorID[nCurrSector] );
		cMsg.Writebool( bSectorActive );

		g_pLTServer->SendToClient( cMsg.Read(), NULL, MESSAGE_GUARANTEED);
	}
}
Ejemplo n.º 2
0
void ScatterVolume::InitialUpdate( void )
{
	CAutoMessage cMsg;
	cMsg.Writeuint8( SFX_SCATTER_ID );
	WriteScatterInfo( cMsg );
	g_pLTServer->SetObjectSFXMessage( m_hObject, cMsg.Read() );
}
Ejemplo n.º 3
0
void PlayerVehicle::CreateSFXMsg()
{
	CAutoMessage cMsg;
	cMsg.Writeuint8(SFX_PLAYERVEHICLE_ID);
    m_PlayerVehicleStruct.Write(cMsg);
	g_pLTServer->SetObjectSFXMessage(m_hObject, cMsg.Read());
}
Ejemplo n.º 4
0
// ----------------------------------------------------------------------- //
//
//	ROUTINE:	CLightCycleMgr::RemoveCyclist
//
//	PURPOSE:	Completely removes a light cycle from the manager
//
// ----------------------------------------------------------------------- //
bool CLightCycleMgr::RemoveCyclist(HOBJECT hObj)
{
	// Since we're removing from the list, we need to walk it manually
	std::vector<LIGHT_CYCLIST*>::iterator iter;
	for(iter=m_collCyclists.begin();iter!=m_collCyclists.end();iter++)
	{
		if((*iter)->hObject == hObj)
		{
			// We found him. Killlllll! KIIIILLLLLLLLL!
			LIGHT_CYCLIST* pCyclist = (*iter);
			debug_delete(pCyclist);

			// Remove from list
			m_collCyclists.erase(iter);

			// Notify the client
			CAutoMessage cMsg;
			cMsg.WriteByte(LCI_REMOVE_CYCLIST);
			cMsg.WriteObject(hObj);
			g_pLTServer->SendToClient(cMsg, MID_LIGHT_CYCLE_INFO, NULL, MESSAGE_GUARANTEED);

			return true;
		}
	}

	return false;
}
Ejemplo n.º 5
0
void DecisionObject::Show(bool bShow, bool bForceShow)
{
	if( m_bLock )
		return;

	// Send message to clients telling them about the DecisionObject...

	CAutoMessage cMsg;

	cMsg.Writeuint8(MID_DECISION);

	m_bVisible = bShow;


	if (bShow)
	{
		cMsg.Writeuint8(LTTRUE);
		cMsg.Writeuint8( (bForceShow ? LTTRUE : LTFALSE) );
		for (int i=0; i < MAX_DECISION_CHOICES; i++)
		{
			cMsg.Writeuint32(m_ChoiceData[i].nStringID);
		}
		cMsg.WriteObject(m_hObject);
		cMsg.Writefloat(m_fRadius);
	}
	else
	{
		cMsg.Writeuint8(LTFALSE);
		cMsg.WriteObject(m_hObject);
	}
	g_pLTServer->SendToClient(cMsg.Read(), LTNULL, MESSAGE_GUARANTEED);
}
Ejemplo n.º 6
0
void GearItem::PickedUp(ILTMessage_Read *pMsg)
{
	// Did we really pick it up?

	bool bPickedUp = (pMsg ? pMsg->Readbool() : true);

	// If we were touched by a player, our m_hPlayerObj data member will be
	// set.  Send a message to that player's client letting it know that an
	// item has been picked up...

	if (m_hPlayerObj)
	{
        CPlayerObj* pPlayer = (CPlayerObj*) g_pLTServer->HandleToObject(m_hPlayerObj);
		if (pPlayer && !pPlayer->IsDead())
		{
			HCLIENT hClient = pPlayer->GetClient();
			if (hClient)
			{
				CAutoMessage cMsg;
				cMsg.Writeuint8(MID_GEAR_PICKEDUP);
				cMsg.Writeuint8((uint8)m_nGearId);
				cMsg.Writebool(bPickedUp);
				g_pLTServer->SendToClient(cMsg.Read(), hClient, MESSAGE_GUARANTEED);
			}
		}
	}

	if (bPickedUp)
	{
		PickupItem::PickedUp(pMsg);
		
		if( m_bRespawn )
		{
			GEAR const *pGear = g_pWeaponMgr->GetGear( m_nGearId );
			if( !pGear )
				return;

			// Change the skins and renderstyles to the waiting to respawn files...

			ObjectCreateStruct ocs;

			pGear->blrRespawnWaitSkins.CopyList( 0, ocs.m_SkinNames[0], MAX_CS_FILENAME_LEN + 1 );
			pGear->blrRespawnWaitRenderStyles.CopyList( 0, ocs.m_RenderStyleNames[0], MAX_CS_FILENAME_LEN + 1 );

			if( pGear->blrRespawnWaitRenderStyles.GetNumItems() < 1 )
				LTStrCpy( ocs.m_RenderStyleNames[0], s_szDefaultRS, ARRAY_LEN( s_szDefaultRS ));
			
			g_pCommonLT->SetObjectFilenames( m_hObject, &ocs );

			// Stop playing PowerupFX and play RespawnWaitFX...
		
			SetClientFX( pGear->szRespawnWaitFX );

			// Set our visibility...

			g_pCommonLT->SetObjectFlags( m_hObject, OFT_Flags, pGear->bRespawnWaitVisible ? FLAG_VISIBLE : 0, FLAG_VISIBLE );
			g_pCommonLT->SetObjectFlags( m_hObject, OFT_Flags2, pGear->bRespawnWaitTranslucent ? FLAG2_FORCETRANSLUCENT : 0, FLAG2_FORCETRANSLUCENT );
		}
	}
}
Ejemplo n.º 7
0
void CMusicMgr::DoEvent(Event eEvent)
{
	if ( !m_bEnabled ) return;

	if ( m_bLockedEvent ) return;

	if ( m_acEvents[eEvent] != 0 && (m_afEventChances[eEvent] > GetRandom(0.0, 1.0f)) )
	{
		char szMusic[128];
		uint32 iEvent = GetRandom(0, m_acEvents[eEvent]-1);
		sprintf(szMusic, "MUSIC PM %s %s Beat", m_szTheme, m_aaszEvents[eEvent][iEvent]);

#ifndef _FINAL
		if ( g_ShowMusicTrack.GetFloat() > 0 )
		{
			g_pLTServer->CPrint("Server sending client Music Message: (%s)", szMusic);
		}
#endif

		HSTRING hMusic = g_pLTServer->CreateString(szMusic);
		CAutoMessage cMsg;
		cMsg.Writeuint8(MID_MUSIC);
		cMsg.WriteHString(hMusic);
		g_pLTServer->SendToClient(cMsg.Read(), LTNULL, MESSAGE_GUARANTEED);
		FREE_HSTRING(hMusic);
	}
}
Ejemplo n.º 8
0
uint32 SpecialMove::OnAllObjectsCreated()
{
	CAutoMessage cMsg;
	WriteSFXMsg(cMsg);
	g_pLTServer->SetObjectSFXMessage(m_hObject, cMsg.Read());

	return GameBase::OnAllObjectsCreated();
}
Ejemplo n.º 9
0
static void SendCancelNotEnoughPlayers( HCLIENT hTarget )
{
	// Tell the player why their vote didn't start
	CAutoMessage cMsg;
	cMsg.Writeuint8( MID_VOTE );
	cMsg.WriteBits( eVote_Cancel_Players, FNumBitsExclusive<kNumVoteActions>::k_nValue );
	g_pLTServer->SendToClient( cMsg.Read(), hTarget, MESSAGE_GUARANTEED );
}
Ejemplo n.º 10
0
// --------------------------------------------------------------------------- //
//
//	ROUTINE:	CTronPlayerObj::AcquirePrimitive
//
//	PURPOSE:	A message came telling us to acquire this
//
// --------------------------------------------------------------------------- //
bool CTronPlayerObj::AcquirePrimitive(char const* pName)
{
	// Send a message to the client
	CAutoMessage cMsg;
	cMsg.WriteString(pName);
	g_pLTServer->SendToClient(cMsg, MID_PRIMITIVE_OBTAINED, GetClient(), MESSAGE_GUARANTEED);
	return true;
}
Ejemplo n.º 11
0
void BuildLensFlareSFXMessage(LENSFLARE & lensProps, LPBASECLASS pClass)
{
	if (!pClass) return;

	CAutoMessage cMsg;
	cMsg.Writeuint8(SFX_LENSFLARE_ID);
	::AddLensFlareInfoToMessage(lensProps, cMsg);
	g_pLTServer->SetObjectSFXMessage(pClass->m_hObject, cMsg.Read());
}
Ejemplo n.º 12
0
// --------------------------------------------------------------------------- //
//
//	ROUTINE:	CTronPlayerObj::AcquireProcedural
//
//	PURPOSE:	A message came telling us to acquire this
//
// --------------------------------------------------------------------------- //
bool CTronPlayerObj::AcquireProcedural(char const* pName)
{
	// Send a message to the client
	CAutoMessage cMsg;
	cMsg.Writeuint8(MID_PROCEDURAL_OBTAINED);
	cMsg.WriteString(pName);
	g_pLTServer->SendToClient(cMsg.Read(), GetClient(), MESSAGE_GUARANTEED);
	return true;
}
Ejemplo n.º 13
0
// --------------------------------------------------------------------------- //
//
//	ROUTINE:	TeamBalancer::BalanceTeamScore
//
//	PURPOSE:	balance teams by using playground sorting based on player scores
//
// --------------------------------------------------------------------------- //
bool TeamBalancer::BalanceTeamScore()
{

	m_nRoundsSinceScoreBalance = 0;

	bool bDoSort = false;


	//figure out the score difference
	int32 nDiff = LTDIFF(m_nTeamScores[0],m_nTeamScores[1]);
	if (nDiff > 0)
	{
		ServerConnectionMgr::GameClientDataList& gameClientDataList = ServerConnectionMgr::Instance( ).GetGameClientDataList( );
		//for 2 or fewer players don't bother doing a complicated sort, just balance the team sizes if needed
//		if (gameClientDataList.size() <= 2)
//		{
//			BalanceTeamSize();
//		}
//		else
		{
			int32 nLower = LTMIN(m_nTeamScores[0],m_nTeamScores[1]);

			//if the lower score is 0, treat it as one for these calculations to avoid divide by 0 errors
			if (nLower == 0)
			{
				nLower = 1;
			}

			//how much did the winners win by? This formula 1+(diff/lower) is used instead of
			//	(high/low) in order to handle 0 and negative high score more cleanly
			float fRatio = 1.0f + (float)nDiff/ (float)LTAbs(nLower);
			
			//see if the margin was wide enough to trigger a shuffle
			bDoSort = (fRatio >= GameModeMgr::Instance().m_grfTeamScoreBalancingPercent);
		}

	}

	if (bDoSort)
	{
		PlaygroundSort();

		CAutoMessage cClientMsg;
		cClientMsg.Writeuint8(MID_PLAYER_EVENT);
		cClientMsg.Writeuint8(kPEAutobalance);
		cClientMsg.Writebool( true ); //did score balancing
		g_pLTServer->SendToClient(cClientMsg.Read(), NULL, MESSAGE_GUARANTEED);

	}

	//chear the history, whether or not we actually sorted
	m_nTeamScores[0] = 0;
	m_nTeamScores[1] = 0;
	m_vecPlayerScores.clear();

	return bDoSort;
}
Ejemplo n.º 14
0
void CCheatMgr::SendCheatMessage( CheatCode nCheatCode, uint32 nData )
{
	// Send the Message to the server
	CAutoMessage cMsg;
	cMsg.Writeuint8(MID_PLAYER_CHEAT);
	cMsg.Writeuint8((uint8)nCheatCode);
	cMsg.Writeuint32(nData);
	g_pLTClient->SendToServer(cMsg.Read(), MESSAGE_GUARANTEED);
}
Ejemplo n.º 15
0
void CCheatMgr::SendCheatMessageHRecord( CheatCode nCheatCode, HRECORD hRecord )
{
	// Send the Message to the server
	CAutoMessage cMsg;
	cMsg.Writeuint8(MID_PLAYER_CHEAT);
	cMsg.Writeuint8((uint8)nCheatCode);
	cMsg.WriteDatabaseRecord( g_pLTDatabase, hRecord );
	g_pLTClient->SendToServer(cMsg.Read(), MESSAGE_GUARANTEED);
}
Ejemplo n.º 16
0
void Sprinkles::OnInitialUpdate()
{
	CAutoMessage cMsg;

	cMsg.Writeuint8(SFX_SPRINKLES_ID);

	m_SprinkleStruct.Write(cMsg);

    g_pLTServer->SetObjectSFXMessage(m_hObject, cMsg.Read());
}
Ejemplo n.º 17
0
void Turret::CreateSpecialFX( bool bUpdateClients )
{
	CWeapon *pWeapon = m_Arsenal.GetCurWeapon( );

	TURRETCREATESTRUCT csTurret;
	csTurret.m_hTurret = m_hTurret;
	csTurret.m_hOperatingObject = m_hOperatingObject;
	csTurret.m_hTurretWeapon = (pWeapon ? pWeapon->GetModelObject( ) : NULL );
	csTurret.m_bRemoteActivation = false;
	csTurret.m_nDamageState = m_nCurDamageState;	
	
	// Give derived classes a chance at updating the client data...
	PreCreateSpecialFX( csTurret );

	{
		CAutoMessage cMsg;
		cMsg.Writeuint8( SFX_TURRET_ID );
		csTurret.Write( cMsg );
		g_pLTServer->SetObjectSFXMessage( m_hObject, cMsg.Read( ));
	}
	

	if( bUpdateClients )
	{
		CAutoMessage cMsg;
		cMsg.Writeuint8( MID_SFX_MESSAGE );
		cMsg.Writeuint8( SFX_TURRET_ID );
		cMsg.WriteObject( m_hObject );
		cMsg.Writeuint8( kTurretFXMsg_All );
		csTurret.Write( cMsg );
		g_pLTServer->SendToClient( cMsg.Read( ), NULL, MESSAGE_GUARANTEED );
	}
}
Ejemplo n.º 18
0
void Camera::HandleFOVMsg( HOBJECT hSender, const CParsedMsg &crParsedMsg )
{
	if( crParsedMsg.GetArgCount() >= 3 )
	{
		m_fFovY = (float)atof( crParsedMsg.GetArg(1) );
		m_fFovAspectScale = (float)atof( crParsedMsg.GetArg(2) );

		float fT = 0.0f;

		if( crParsedMsg.GetArgCount() >= 4 )
		{
			fT = (float)atof( crParsedMsg.GetArg(3) );
		}

		CAutoMessage cMsg;
		cMsg.Writeuint8(MID_SFX_MESSAGE);
		cMsg.Writeuint8(SFX_CAMERA_ID);
		cMsg.WriteObject(m_hObject);
		cMsg.Writeuint8(CAMFX_FOV);
		cMsg.Writefloat(m_fFovY);
		cMsg.Writefloat(m_fFovAspectScale);
		cMsg.Writefloat(fT);

		// Send the message to all connected clients
		g_pLTServer->SendToClient(cMsg.Read(), NULL, MESSAGE_GUARANTEED);

		// Update the SpecialFX Message...

		CreateSFXMsg();
	}
}
Ejemplo n.º 19
0
void SpecialMove::WriteSFXMsg(CAutoMessage& cMsg)
{
	// Set our special effect message.
	cMsg.Writeuint8(GetSFXID());
	cMsg.Writeuint32(m_eAnimation);
	cMsg.Writefloat(m_fActivateDist);
	cMsg.Writebool(m_bOn);
	cMsg.Writebool(m_bRadial);

	// Piggyback our Activate data.
	m_ActivateTypeHandler.WriteActivateTypeMsg(cMsg);
}
Ejemplo n.º 20
0
void ServerVoteMgr::HandleVoteFail( )
{
	// Tell everyone the vote failed.
	CAutoMessage cMsg;
	cMsg.Writeuint8( MID_VOTE );
	cMsg.WriteBits( eVote_Fail, FNumBitsExclusive<kNumVoteActions>::k_nValue );
	// Send the vote status info to the eligible voters.
	SendToEligibleVoters( *cMsg.Read( ));

	// Clear the current vote.
	ClearVote( );
}
Ejemplo n.º 21
0
LTRESULT SendEmptyObjectMsg(uint32 nMsgID, HOBJECT hSource, HOBJECT hDest, uint32 nFlags)
{
	LTRESULT nResult;

	CAutoMessage cMsg;

	cMsg.Writeuint32(nMsgID);

	nResult = g_pLTServer->SendToObject(cMsg.Read(), hSource, hDest, nFlags);

	return nResult;
}
Ejemplo n.º 22
0
LTRESULT SendEmptyClientMsg(uint32 nMsgID, HCLIENT hClient, uint32 nFlags)
{
	LTRESULT nResult;

	CAutoMessage cMsg;

	cMsg.Writeuint8(nMsgID);

	nResult = g_pLTServer->SendToClient(cMsg.Read(), hClient, nFlags);

	return nResult;
}
Ejemplo n.º 23
0
LTRESULT SendEmptyServerMsg(uint32 nMsgID, uint32 nFlags)
{
	LTRESULT nResult;

	CAutoMessage cMsg;

	cMsg.Writeuint8(nMsgID);

	nResult = g_pLTClient->SendToServer(cMsg.Read(), nFlags);

	return nResult;
}
// Change in focus
void    CScreenHostTDMOptions::OnFocus(LTBOOL bFocus)
{
    CUserProfile *pProfile = g_pProfileMgr->GetCurrentProfile();

    if (bFocus)
    {

        m_nMaxPlayers = (int)pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_nMaxPlayers;
        m_nRunSpeed = (int)pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_nRunSpeed;
        m_nScoreLimit = (int)pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_nScoreLimit;
        m_nTimeLimit = (int)pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_nTimeLimit;
        m_nRounds = (int)pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_nRounds;
        m_bFriendlyFire = pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_bFriendlyFire;

        m_nFragScore = (int)pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_nFragScore;
        m_nTagScore = (int)pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_nTagScore;

        m_pTeam1Name->SetString(pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_sTeamName[0].c_str());
        m_pTeam2Name->SetString(pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_sTeamName[1].c_str());

        m_pMaxPlayers->Enable(!g_pPlayerMgr->IsPlayerInWorld());

        UpdateData(LTFALSE);

    }
    else
    {
        UpdateData();

        pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_nMaxPlayers = (uint8)m_nMaxPlayers;
        pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_nRunSpeed = (uint8)m_nRunSpeed;
        pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_nScoreLimit = (uint8)m_nScoreLimit;
        pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_nTimeLimit = (uint8)m_nTimeLimit;
        pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_nRounds = (uint8)m_nRounds;
        pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_bFriendlyFire = !!m_bFriendlyFire;

        pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_nFragScore = (uint8)m_nFragScore;
        pProfile->m_ServerGameOptions.GetTeamDeathmatch().m_nTagScore = (uint8)m_nTagScore;

        pProfile->Save();

        if (g_pPlayerMgr->IsPlayerInWorld())
        {

            CAutoMessage cMsg;
            cMsg.Writeuint8( MID_MULTIPLAYER_OPTIONS );
            pProfile->m_ServerGameOptions.GetTeamDeathmatch().Write(cMsg);
            g_pLTClient->SendToServer(cMsg.Read(), MESSAGE_GUARANTEED);
        }

    }
    CBaseScreen::OnFocus(bFocus);
}
Ejemplo n.º 25
0
bool ScmdServer_Impl::SendStatusMessage( HCLIENT hClient, ScmdCommand eScmdCommand, 
										ScmdCommandStatus eScmdCommandStatus )
{
	// Tell the client it worked.
	CAutoMessage cMsg;
	cMsg.Writeuint8( MID_SCMD );
	cMsg.Writeuint8( eScmdCommand );
	cMsg.Writeuint8( eScmdCommandStatus );
	SendMessage( hClient, *cMsg );

	return true;
}
Ejemplo n.º 26
0
void CMusicMgr::Update()
{
	if ( !m_bEnabled ) return;

	if ( m_bLockedMood )
	{
		if ( m_bRestoreMusicIntensity )
		{
			char szMusic[128];
			sprintf(szMusic, "MUSIC I %d measure", m_iRestoreMusicIntensity);

#ifndef _FINAL
			if ( g_ShowMusicTrack.GetFloat() > 0 )
			{
				g_pLTServer->CPrint("Server sending client Music Message: (%s)", szMusic);
			}
#endif

			HSTRING hMusic = g_pLTServer->CreateString(szMusic);
			CAutoMessage cMsg;
			cMsg.Writeuint8(MID_MUSIC);
			cMsg.WriteHString(hMusic);
			g_pLTServer->SendToClient(cMsg.Read(), LTNULL, MESSAGE_GUARANTEED);
			FREE_HSTRING(hMusic);

			m_eLastMood = eMoodInvalid;
			m_bRestoreMusicIntensity = LTFALSE;
		}

		return;
	}

	LTBOOL bChoseMood = LTFALSE;

	for ( int32 iMood = kNumMoods-1 ; iMood >= 0 ; --iMood )
	{
		if ( !bChoseMood && (m_afMoods[iMood] != 0.0f || (iMood == eMoodNone)) )
		{
			if ( m_eLastMood == iMood )
			{
				bChoseMood = LTTRUE;
			}
			else
			{
				SetMood(( Mood )iMood );
				bChoseMood = LTTRUE;
			}
		}

		m_afMoods[iMood] = Max<LTFLOAT>(m_afMoods[iMood] - g_pLTServer->GetFrameTime(), 0.0f);
	}
}
Ejemplo n.º 27
0
// ----------------------------------------------------------------------- //
//
//	ROUTINE:	CDebugLineFX::InitialUpdate
//
//	PURPOSE:	Sets up the object's SFX message.
//
// ----------------------------------------------------------------------- //
void DebugLineSystem::InitialUpdate()
{
	//
	// Create the special fx.
	//

	// Create the message.
	CAutoMessage cMsg;
	cMsg.Writeuint8( SFX_DEBUGLINE_ID );

	// Send it.
	g_pLTServer->SetObjectSFXMessage( m_hObject, cMsg.Read() );
}
Ejemplo n.º 28
0
void TeamClientFX::CreateSpecialFX( bool bUpdateClients )
{
	TEAMCLIENTFXCREATESTRUCT cs;
	cs.m_hTeamClientFXRec = m_hTeamClientFXRec;
	cs.m_nTeamId = m_nTeamId;

	{
		CAutoMessage cMsg;
		cMsg.Writeuint8( SFX_TEAMCLIENTFX_ID );
		cs.Write( cMsg );
		g_pLTServer->SetObjectSFXMessage( m_hObject, cMsg.Read( ));
	}
}
Ejemplo n.º 29
0
bool ScmdServer_Impl::HandleListClients( HCLIENT hClient, ILTMessage_Read& msg )
{
	float fPing = 0.0f;
    uint16 nClientID = 0;
	uint8 aClientIP[4];
	uint16 nPort;
	std::string sPlayerHandle = "";

	// Write out the message header.
	CAutoMessage cMsg;
	cMsg.Writeuint8( MID_SCMD );
	cMsg.Writeuint8( kScmdCommandListClients );
	cMsg.Writeuint8( kScmdCommandStatusOk );

	// Iterate over all the clients and put their id, ping, ip and name in the message.
    HCLIENT hIterClient = g_pLTServer->GetNextClient( NULL );
    while( hIterClient )
	{
        nClientID = ( uint16 )g_pLTServer->GetClientID( hIterClient );
        g_pLTServer->GetClientPing( hIterClient, fPing );
		g_pLTServer->GetClientAddr( hIterClient, aClientIP, &nPort );

		cMsg.Writeuint16(( uint16 )nClientID );
		cMsg.Writeuint16(( uint16 )( fPing + 0.5f ));
		cMsg.Writeuint8( aClientIP[0] );
		cMsg.Writeuint8( aClientIP[1] );
		cMsg.Writeuint8( aClientIP[2] );
		cMsg.Writeuint8( aClientIP[3] );

		// Get the player for this client.  If there is none,
		// then we can't determine the name.
		CPlayerObj* pPlayerObj = ( CPlayerObj* )g_pLTServer->GetClientUserData( hIterClient );
		if( !pPlayerObj )
		{
			sPlayerHandle = "";
		}
		else
		{
			sPlayerHandle = pPlayerObj->GetNetUniqueName( );
		}
		cMsg.WriteString( sPlayerHandle.c_str( ));

	    hIterClient = g_pLTServer->GetNextClient( hIterClient );
	}

	// Write out the the list terminator.
	cMsg.Writeuint16(0xFFFF);
	SendMessage( hClient, *cMsg );

	return true;
}
Ejemplo n.º 30
0
void Turret::LoadSFXMessage( ILTMessage_Read *pMsg, uint32 dwFlags )
{
	if( !pMsg )
		return;

	CAutoMessage cSFXMsg;

	cSFXMsg.Writeuint8( pMsg->Readuint8( ) );

	TURRETCREATESTRUCT TurretCS;
	TurretCS.Read( pMsg );
	TurretCS.Write( cSFXMsg );
	g_pLTServer->SetObjectSFXMessage( m_hObject, cSFXMsg.Read( ) );
}