Example #1
0
void GameLoad()
{
	// Initialize the pools
	CGame::GetPools()->Initialize();
	CLogFile::Printf("Initialized pools");

	// Reset the game
	InternalResetGame(true);
}
Example #2
0
// jenksta: NOTE: Can only be called with bResetNow = true from the game script thread
void CClient::ResetGame(bool bResetNow, bool bAutoConnect)
{
	// If requested reset the game now
	if(bResetNow)
		InternalResetGame(bAutoConnect);
	else
	{
		m_bResetGame = true;
		m_bAutoConnect = bAutoConnect;
	}
}
Example #3
0
void GameScriptProcess()
{
	// Do we need to reset the game?
	if(g_bResetGame)
	{
		// Reset the game
		InternalResetGame(true);

		// Flag the game as no longer needed to reset
		g_bResetGame = false;
	}

	// If our network manager exists process it
	if(g_pNetworkManager)
		g_pNetworkManager->Process();

	// HACKY!
	// TEMP! TODO: Anywhere in GTA there's a function which checks if the engine is turned on or off...
	//		       ...If the player is in the vehicle, it will turn it automatic on -.-
	if(g_pLocalPlayer)
	{
		if(g_pLocalPlayer->GetVehicle() != NULL)
		{
			// TEMP! TODO: Anywhere in GTA there's a function which checks if the engine is turned on or off...
			//		 ...If the player is in the vehicle, it will turn it automatic on -.-
			if(!g_pLocalPlayer->GetVehicle()->GetEngineState())
				g_pLocalPlayer->GetVehicle()->SetEngineState(false);
		}
	}
	for(EntityId playerId = 0; playerId < MAX_PLAYERS; playerId++)
	{
		if(g_pPlayerManager->DoesExist(playerId))
		{
			if(g_pPlayerManager->GetAt(playerId)->GetVehicle() != NULL)
			{
				if(!g_pPlayerManager->GetAt(playerId)->GetVehicle()->GetEngineState() != NULL)
					g_pPlayerManager->GetAt(playerId)->GetVehicle()->SetEngineState(false);
			}
		}
	}

	// Hide the loading screens
	g_pMainMenu->HideLoadingScreen();

	// If we have text to draw draw it
	if(iTextTime > 0)
	{
		if((int)(SharedUtility::GetTime() - dwTextStartTick) < iTextTime)
			Scripting::DisplayTextWithLiteralString(fTextPos[0], fTextPos[1], "STRING", strTextText);
		else
			iTextTime = 0;
	}
}
Example #4
0
void CClient::OnGameLoad()
{
	// Initialize the pools
	CGame::GetPools()->Initialize();
	CLogFile::Printf("Initialized pools");

	// Reset the game
	InternalResetGame(m_bAutoConnect);

	// Flag as no longer needed to auto connect
	m_bAutoConnect = false;
}
Example #5
0
void CClient::OnGameProcess()
{
	// Do we need to reset the game?
	if(m_bResetGame)
	{
		// Reset the game
		InternalResetGame(m_bAutoConnect);

		// Flag as no longer needed to auto connect
		m_bAutoConnect = false;

		// Flag the game as no longer needed to reset
		m_bResetGame = false;
	}

	// If our network manager exists process it
	if(m_pNetworkManager)
		m_pNetworkManager->Process();

	// HACKY! FIXME, for real
	// TEMP! TODO: Anywhere in GTA there's a function which checks if the engine is turned on or off...
	//		       ...If the player is in the vehicle, it will turn it automatic on -.-
	if(m_pLocalPlayer)
	{
		if(m_pLocalPlayer->GetVehicle())
		{
			// jenksta: Then find all references to CVehicle::TurnEngineOn and find which call is for when 
			// the player enters the vehicle?
			if(m_pLocalPlayer->GetVehicle()->GetEngineState() == false)
				m_pLocalPlayer->GetVehicle()->SetEngineState(false);
		}
	}

	// If we have text to draw draw it
	if(iTextTime > 0)
	{
		if((int)(SharedUtility::GetTime() - dwTextStartTick) < iTextTime)
			Scripting::DisplayTextWithLiteralString(fTextPos[0], fTextPos[1], "STRING", strTextText);
		else
			iTextTime = 0;
	}
}