예제 #1
0
void CLeanMgr::BeginLean( eLeanDirection kDir )
{
	m_kLeanDir = kDir;

	m_fMaxLeanAngle = DEG2RAD( g_vtLeanAngle.GetFloat() );
	m_fLeanFromAngle = m_fLastLeanAngle;

	m_fStartTime = 0.0f;
	m_fEndTime = g_vtLeanOutTime.GetFloat();

	if( m_bLeanedOut )
	{
		// Send a message to the server to remove the original stimulus.

		CAutoMessage cMsg;
		cMsg.Writeuint8( MID_PLAYER_CLIENTMSG );
		cMsg.Writeuint8( CP_PLAYER_LEAN );
		cMsg.Writeuint8( PL_CENTER );
		cMsg.WriteLTVector( LTVector( 0, 0, 0) );
		g_pLTClient->SendToServer( cMsg.Read(), MESSAGE_GUARANTEED );
	}

	// If we are just begining to lean then we are not leaned out...

	m_bLeanedOut = false;
}
예제 #2
0
파일: Turret.cpp 프로젝트: Arc0re/lithtech
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 );
	}
}
예제 #3
0
void CTronPlayerObj::HandleDamage(const DamageStruct& damage)
{
	if ( WMGR_INVALID_ID != damage.nAmmoId )
	{
		// hit by a weapon of some sort
		if ( IsDefending() )
		{
			// send a message to the player detailing a successful block
			CAutoMessage cMsg;
			LTRESULT ltResult;

			cMsg.Writeuint8( MID_PROJECTILE );

			// write the projectile message subtype
			cMsg.Writeuint8( MPROJ_BLOCKED );

			// write the defense type
			cMsg.Writeuint8( m_cDefendType );

			// write the defense percentage
			cMsg.Writefloat( GetDefensePercentage( &damage.vDir ) );

			ltResult = g_pLTServer->SendToClient( cMsg.Read(), m_hClient, MESSAGE_GUARANTEED );
			ASSERT( LT_OK == ltResult );
		}
	}

	CPlayerObj::HandleDamage( damage );
}
예제 #4
0
void LightGroup::UpdateClients()
{
	// Calculate our current color
	LTVector vColor = (m_bOn) ? m_vColor : LTVector(0.0f, 0.0f, 0.0f);

	{
		// Set up the update message
		CAutoMessage cMsg;
		cMsg.Writeuint8(MID_SFX_MESSAGE);
		cMsg.Writeuint8(SFX_LIGHTGROUP_ID);
		cMsg.WriteObject(m_hObject);
		cMsg.Writeuint32(m_nID);
		cMsg.WriteLTVector(vColor);

		// Send the message to all connected clients
		g_pLTServer->SendToClient(cMsg.Read(), LTNULL, MESSAGE_GUARANTEED);
	}
	
	{
		CAutoMessage cMsg;
		cMsg.Writeuint8(SFX_LIGHTGROUP_ID);

		cMsg.Writeuint32(m_nID);
		cMsg.WriteLTVector(vColor);

		// Make sure new clients will get the message
		g_pLTServer->SetObjectSFXMessage(m_hObject, cMsg.Read());
	}

	m_bClientNeedsUpdate = false;
}
예제 #5
0
파일: Camera.cpp 프로젝트: Arc0re/lithtech
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();
	}
}
예제 #6
0
void TextureFX::UpdateClients()
{
	{
		// Set up the update message
		CAutoMessage cMsg;
		cMsg.Writeuint8(MID_SFX_MESSAGE);
		cMsg.Writeuint8(SFX_TEXTUREFX_ID);
		cMsg.WriteObject(m_hObject);
		WriteStageInfo(cMsg);

		// Send the message to all connected clients
		g_pLTServer->SendToClient(cMsg.Read(), LTNULL, MESSAGE_GUARANTEED);
	}
	
	{
		CAutoMessage cMsg;
		cMsg.Writeuint8(SFX_TEXTUREFX_ID);
		WriteStageInfo(cMsg);

		// Make sure new clients will get the message
		g_pLTServer->SetObjectSFXMessage(m_hObject, cMsg.Read());
	}

	m_bClientNeedsUpdate = false;
}
예제 #7
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);
}
예제 #8
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 );
		}
	}
}
예제 #9
0
void ServerVoteMgr::CheckVoteStatus( )
{
	//check to see if this requires a unanimous vote
	bool bUnanimous = m_CurrentVote.m_nVotesNeeded >= m_lstEligibleVoter.size();

	if (m_CurrentVote.m_nYesVotes >= m_CurrentVote.m_nVotesNeeded)
	{
		HandleVotePass();
	}
	else if (m_CurrentVote.m_nNoVotes >= m_CurrentVote.m_nVotesNeeded )
	{
		HandleVoteFail();
	}
	else if (bUnanimous && m_CurrentVote.m_nNoVotes > 0)
	{
		HandleVoteFail();
	}
	else
	{
		//Update clients
		CAutoMessage cMsg;
		cMsg.Writeuint8( MID_VOTE );
		cMsg.WriteBits( eVote_Cast, FNumBitsExclusive<kNumVoteActions>::k_nValue );
		cMsg.Writeuint8( m_CurrentVote.m_nVoteID );
		cMsg.Writeuint8( m_CurrentVote.m_nYesVotes );
		cMsg.Writeuint8( m_CurrentVote.m_nNoVotes );
		cMsg.Writeuint8( m_CurrentVote.m_nVotesNeeded );
		// Send the vote status info to the eligible voters.
		SendToEligibleVoters( *cMsg.Read( ));
	}
}
예제 #10
0
void SpecialMove::SetEnabled(bool bOn)
{
	CAutoMessage cMsg;
	cMsg.Writeuint8( MID_SFX_MESSAGE );
	cMsg.Writeuint8( GetSFXID() );
	cMsg.WriteObject( m_hObject );
	cMsg.Writeuint8( bOn ? SPECIALMOVEFX_ON : SPECIALMOVEFX_OFF );
	g_pLTServer->SendToClient( cMsg.Read(), NULL, MESSAGE_GUARANTEED );
}
예제 #11
0
void SpecialMove::HandleActivateMsg( HOBJECT hSender, const CParsedMsg &crParsedMsg  )
{
	CAutoMessage cMsg;
	cMsg.Writeuint8( MID_SFX_MESSAGE );
	cMsg.Writeuint8( GetSFXID() );
	cMsg.WriteObject( m_hObject );
	cMsg.Writeuint8( SPECIALMOVEFX_ACTIVATE );
	g_pLTServer->SendToClient( cMsg.Read(), NULL, MESSAGE_GUARANTEED );
}
예제 #12
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);
}
예제 #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;
}
예제 #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);
}
예제 #15
0
파일: Camera.cpp 프로젝트: Arc0re/lithtech
void Camera::CreateSFXMsg()
{
	CAutoMessage cMsg;
	cMsg.Writeuint8(SFX_CAMERA_ID);
	cMsg.Writeuint8((uint8)m_bAllowPlayerMovement);
	cMsg.Writeuint8((uint8)m_nCameraType);
	cMsg.Writeuint8((uint8)m_bIsListener);
	cMsg.Writefloat(m_fFovY);
	cMsg.Writefloat(m_fFovAspectScale);
	g_pLTServer->SetObjectSFXMessage(m_hObject, cMsg.Read());
}
예제 #16
0
void PickupItem::CreateSpecialFX( bool bUpdateClients /* = false  */ )
{
	{
		CAutoMessage cMsg;
		cMsg.Writeuint8(SFX_PICKUPITEM_ID);
		cMsg.Writebool(!!m_bRotate);
		cMsg.Writebool(!!m_bBounce);
		cMsg.WriteString( m_sClientFX.c_str() );
		cMsg.Writeuint8(m_nTeamId);
		g_pLTServer->SetObjectSFXMessage(m_hObject, cMsg.Read());
	}
}
예제 #17
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;
}
예제 #18
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;
}
예제 #19
0
void PickupItem::SetTeamId( uint8 nTeamId )
{
	m_nTeamId = nTeamId;

	CAutoMessage cMsg;
	cMsg.Writeuint8( MID_SFX_MESSAGE );
	cMsg.Writeuint8( SFX_PICKUPITEM_ID );
	cMsg.WriteObject( m_hObject );
	cMsg.Writeuint8( PUFX_TEAMID );
	cMsg.Writeuint8( m_nTeamId );
	g_pLTServer->SendToClient( cMsg.Read(), LTNULL, MESSAGE_GUARANTEED );

	CreateSpecialFX( );
}
예제 #20
0
void PickupItem::SetClientFX( const char *pszFX )
{
	m_sClientFX = pszFX;

	CAutoMessage cMsg;
	cMsg.Writeuint8( MID_SFX_MESSAGE );
	cMsg.Writeuint8( SFX_PICKUPITEM_ID );
	cMsg.WriteObject( m_hObject );
	cMsg.Writeuint8( PUFX_CLIENTFX );
	cMsg.WriteString( m_sClientFX.c_str() );
	g_pLTServer->SendToClient( cMsg.Read(), LTNULL, MESSAGE_GUARANTEED );

	CreateSpecialFX( );
}
예제 #21
0
void SoundNonPoint::SendToggleMsg()
{
	//if( !m_bSendTriggerFXMsg )
	//	return;

	CAutoMessage cMsg;
	cMsg.Writeuint8( MID_SFX_MESSAGE );
	cMsg.Writeuint8( SFX_SOUND_NONPOINT_ID );
	cMsg.WriteObject( m_hObject );
	cMsg.Writeuint8( SNPFX_TOGGLE_MSG );
	cMsg.Writeuint8( m_SCS.m_bSoundOn );
	g_pLTServer->SendToClient( cMsg.Read(), NULL, MESSAGE_GUARANTEED );

	CreateSpecialFX();
}
예제 #22
0
void SpecialFX::TurnON()
{
	if (!m_bLoop)
	{
		// We can turn on (create) non-looping fx as often as we want...
		::PlayClientFX(m_sFxName, m_hObject, m_hTargetObj, LTNULL, LTNULL, LTNULL, m_dwFxFlags);

		if (m_bOneTime)
		{
			g_pLTServer->RemoveObject(m_hObject);
		}

		if( m_bRemoveTarget )
		{
			g_pLTServer->RemoveObject( m_hTargetObj );
		}
	}
	else if (!m_bIsOn)
	{
		CAutoMessage cMsg;
		cMsg.Writeuint8( SFX_CLIENTFXGROUP );
		cMsg.WriteString( m_sFxName );
		cMsg.Writeuint32( m_dwFxFlags );

		if( m_hTargetObj )
		{
			cMsg.Writeuint8( true );
			cMsg.WriteObject( m_hTargetObj );

			LTVector vPos;
			g_pLTServer->GetObjectPos( m_hTargetObj, &vPos );

			cMsg.WriteCompPos( vPos );
		}
		else
		{
			cMsg.Writeuint8( false );
		}
	
		g_pLTServer->SetObjectSFXMessage( m_hObject, cMsg.Read() );

		// Set flags so the client knows we are on...
		g_pCommonLT->SetObjectFlags( m_hObject, OFT_Flags, FLAG_FORCECLIENTUPDATE, FLAG_FORCECLIENTUPDATE );
		g_pCommonLT->SetObjectFlags( m_hObject, OFT_User, USRFLG_SFX_ON, USRFLG_SFX_ON );
	}

	m_bIsOn = true;
}	
예제 #23
0
void Water::HandleAllowSwimmingMsg( HOBJECT hSender, const CParsedMsg &crParsedMsg )
{
	static CParsedMsg::CToken s_cTok_0( "0" );

	m_bAllowSwimming = !(crParsedMsg.GetArg( 1 ) == s_cTok_0);

	CAutoMessage cMsg;
	cMsg.Writeuint8( MID_SFX_MESSAGE );
	cMsg.Writeuint8( m_nSfxMsgId );
	cMsg.WriteObject( m_hObject );
	cMsg.WriteBits( kVolumeBrush_AllowSwimming, FNumBitsExclusive<kVolumeBrush_NumMsgs>::k_nValue );
	cMsg.Writebool( m_bAllowSwimming );
	g_pLTServer->SendToClient( cMsg.Read( ), NULL, MESSAGE_GUARANTEED );

	CreateSpecialFXMsg( );
}
예제 #24
0
void ScatterVolume::InitialUpdate( void )
{
	CAutoMessage cMsg;
	cMsg.Writeuint8( SFX_SCATTER_ID );
	WriteScatterInfo( cMsg );
	g_pLTServer->SetObjectSFXMessage( m_hObject, cMsg.Read() );
}
예제 #25
0
void PlayerVehicle::CreateSFXMsg()
{
	CAutoMessage cMsg;
	cMsg.Writeuint8(SFX_PLAYERVEHICLE_ID);
    m_PlayerVehicleStruct.Write(cMsg);
	g_pLTServer->SetObjectSFXMessage(m_hObject, cMsg.Read());
}
예제 #26
0
bool CServerMissionMgr::SendExitLevelMessage( )
{
	// Tell the players to prepare to exit a level.
	CPlayerObj::PlayerObjList::const_iterator iter = CPlayerObj::GetPlayerObjList( ).begin( );
	while( iter != CPlayerObj::GetPlayerObjList( ).end( ))
	{
		CPlayerObj* pPlayerObj = *iter;
		pPlayerObj->HandlePreExit();
		g_pGameServerShell->SendPlayerInfoMsgToClients(NULL,pPlayerObj,MID_PI_UPDATE);
		iter++;
	}

	CTeamMgr::Instance().UpdateClient();

	// See if we have already visited the level we are going to.
	CString sLoadGameFile = g_pServerSaveLoadMgr->GetWorldSaveFile( m_sCurrentWorldName );
	bool bRestoringLevel = !!CWinUtil::FileExist( sLoadGameFile );

	// Tell client's we're exiting.  Wait for their response.
	CAutoMessage cMsg;
	cMsg.Writeuint8( MID_EXIT_LEVEL );
	cMsg.WriteString( m_sCurrentWorldName );
	cMsg.Writebool( m_bNewMission );
	cMsg.Writebool( bRestoringLevel );
	cMsg.Writebool( true );
	g_pLTServer->SendToClient(cMsg.Read(), LTNULL, MESSAGE_GUARANTEED);

	return true;
}
void CClientMeleeCollisionController::HandleBlocked(HOBJECT hTarget, const LTVector& vPos, const LTVector& vDir)
{
	// Get the proper weapon record...
	CClientWeapon* pClientWeapon = g_pClientWeaponMgr->GetCurrentClientWeapon();
	HWEAPON hWeapon = pClientWeapon ? pClientWeapon->GetWeaponRecord() : NULL;	//!!ARL: Use Attacker's weapon instead?  (will need to be sent from server - probably along with block info)
	HWEAPONDATA hWeaponData = g_pWeaponDB->GetWeaponData(hWeapon, !USE_AI_DATA);

	// Spawn a block effect for it...
	const char* pszBlockFX = g_pWeaponDB->GetString(hWeaponData, "BlockFX");
	CLIENTFX_CREATESTRUCT fxcs(pszBlockFX, 0, LTRigidTransform(vPos, LTRotation(vDir, LTVector(0,1,0))));
	g_pGameClientShell->GetSimulationTimeClientFXMgr().CreateClientFX(NULL, fxcs, true);

	// Let the server objects know they've blocked / been blocked.
	CAutoMessage cMsg;
	cMsg.Writeuint8(MID_OBJECT_MESSAGE);
	cMsg.WriteObject(m_hObject);
	cMsg.Writeuint32(MID_MELEEBLOCK);
	cMsg.WriteObject(hTarget);
	g_pLTClient->SendToServer(cMsg.Read(), MESSAGE_GUARANTEED);

	// Disable attacker's collision (i.e. stop attacking).
	DisableCollisions();

	// For local player attackers, send a BlockRecoil stimulus so a proper animation can be played.
	if (m_hObject == g_pPlayerMgr->GetMoveMgr()->GetObject())
	{
		CPlayerBodyMgr::Instance().HandleAnimationStimulus("CS_RecoilFromBlock");
	}
}
예제 #28
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);
	}
}
예제 #29
0
파일: Door.cpp 프로젝트: Arc0re/lithtech
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);
	}
}
예제 #30
0
void SetObjectClientFXMsg( HOBJECT hObj, char *sName, uint32 dwFlags )
{
// [KLS 5/19/02] This really should be depricated, the only place that is 
// currently using it is the KeyItem and that object really shouldn't be
// turning itself into a half-prop/half-special fx mutant.

	CAutoMessage cMsg;
	cMsg.Writeuint8( SFX_CLIENTFXGROUP );
	cMsg.WriteString( sName );
	cMsg.Writeuint32( dwFlags );

	// Do not use any target information...
	cMsg.Writeuint8( false );
	
	g_pLTServer->SetObjectSFXMessage( hObj, cMsg.Read() );
}