예제 #1
0
	//初期化
	void GameStage::Create(){
		try{
			//リソースの作成
			CreateResourses();
			//ビュー類を作成する
			CreateViews();
			//プレートを作成する
			CreatePlate();
			//追いかけるオブジェクトの作成
			CreateSeekObject();
			//プレーヤーの作成
			CreatePlayer();


		}
		catch (...){
			throw;
		}
	}
예제 #2
0
	//初期化
	void GameStage::OnCreate(){
		try{
			//リソースの作成
			CreateResourses();
			//ビュー類を作成する
			CreateViews();
			//プレートを作成する
			CreatePlate();
			//固定のボックスの作成
			CreateFixedBox();
			//プレーヤーの作成
			CreatePlayer();
			//Eggの作成
			CreateEgg();
		}
		catch (...){
			throw;
		}
	}
예제 #3
0
void EntityManager::HandleWorld( MsgEntry* me, Client *client )
{
    if (!client->GetActor() && !CreatePlayer (client))
    {
        Error1("Error while creating player in world!");
        return;
    }

    // Client needs to know the starting position of the player when the world loads.
    csVector3 pos;
    float     yrot;
    iSector *isector;
    client->GetActor()->GetPosition(pos,yrot,isector);
  
    psPersistWorld mesg(me->clientnum, pos, isector->QueryObject()->GetName());
    mesg.SendMessage();

    // Send the world time and weather here too
    psserver->GetWeatherManager()->UpdateClient(client->GetClientNum());
}
Stage_001::Stage_001()
{
    m_pView->SetAlpha(1.0f);
    m_pView->SetSize(APPSCREEN_SIZE);
    
    m_drawSize = APPSCREEN_SIZE;
    
    m_pWorld = new CWorld(CVector(0.0f, 1.0f, 0.0f));
    
    InitializeWorld();
    
    CreatePlayer(CPoint(300.0f, 100.0f));
    
    for (int i = 0; i < MAX_MULTI_PLAYER; i++) {
        m_pOtherPlayers[i] = 0;
    }
    
    m_pConnection = new Connection(this);
    
    m_frame = 0;
}
예제 #5
0
	void GameStage::OnCreate() {
		try {
			wstring DataDir;
			App::GetApp()->GetDataDirectory(DataDir);
			//XMLの読み込み
			m_XmlDocReader.reset(new XmlDocReader(DataDir + L"GameStage.xml"));
			//ビューとライトの作成
			CreateViewLight();
			//プレートの作成
			CreatePlate();
			//ボックスの作成
			CreateFixedBox();
			//プレーヤーの作成
			CreatePlayer();
			//敵の作成
			CreateEnemy();
		}
		catch (...) {
			throw;
		}
	}
예제 #6
0
    void PlayerEntityHandler::Init()
    {
        m_connection.Attach();

        // Register as game entity handler.
        m_HandlerId = Safir::Dob::Typesystem::HandlerId(L"Consoden::TankRandomPlayer(" + mPlayerName + L")"); //::GenerateRandom();

        m_connection.RegisterEntityHandlerInjection(
            Consoden::TankGame::Player::ClassTypeId, 
            m_HandlerId,
            Safir::Dob::InstanceIdPolicy::HandlerDecidesInstanceId,
            this);

        m_connection.RegisterEntityHandlerInjection(
            Consoden::TankGame::Joystick::ClassTypeId, 
            m_HandlerId,
            Safir::Dob::InstanceIdPolicy::HandlerDecidesInstanceId,
            this);

        CreatePlayer();
        InitGameStateHandler();
    }
예제 #7
0
Game::Game(const SystemPath &path) :
	m_time(0),
	m_state(STATE_NORMAL),
	m_wantHyperspace(false),
	m_timeAccel(TIMEACCEL_1X),
	m_requestedTimeAccel(TIMEACCEL_1X),
	m_forceTimeAccel(false)
{
	m_space.Reset(new Space(this, path));
	SpaceStation *station = static_cast<SpaceStation*>(m_space->FindBodyForPath(&path));
	assert(station);

	CreatePlayer();

	m_space->AddBody(m_player.Get());

	m_player->Enable();
	m_player->SetFrame(station->GetFrame());
	m_player->SetDockedWith(station, 0);

	CreateViews();
}
예제 #8
0
// Loads the player, updates the world, notifies clients
void _Server::HandleCharacterPlay(_Buffer &Data, _Peer *Peer) {

	// Read packet
	uint32_t Slot = Data.Read<uint8_t>();
	NetworkIDType MapID = 0;
	std::string Name;

	// Get character info
	Save->Database->PrepareQuery("SELECT id, map_id, name FROM character WHERE account_id = @account_id and slot = @slot");
	Save->Database->BindInt(1, Peer->AccountID);
	Save->Database->BindInt(2, Slot);
	if(Save->Database->FetchRow()) {
		Peer->CharacterID = Save->Database->GetInt<uint32_t>("id");
		MapID = (NetworkIDType)Save->Database->GetInt<uint32_t>("map_id");
		Name = Save->Database->GetString("name");
	}
	Save->Database->CloseQuery();

	// Check for valid map
	if(MapID == 0)
		MapID = 1;

	// Check for valid character id
	if(!Peer->CharacterID) {
		Log << "Character slot " << Slot << " empty!" << std::endl;
		return;
	}

	// Send map and players to new player
	Peer->Object = CreatePlayer(Peer);
	SpawnPlayer(Peer->Object, MapID, _Map::EVENT_SPAWN);

	// Broadcast message
	for(auto &ReceivePeer : Network->GetPeers()) {
		if(ReceivePeer != Peer)
			SendMessage(ReceivePeer, Name + " has joined the server", COLOR_GRAY);
	}
}
예제 #9
0
	//初期化
	void GameStage::OnCreate(){
		try{
			//リソースの作成
			CreateResourses();
			//ビュー類を作成する
			CreateViews();
			//プレートを作成する
			CreatePlate();
			//固定のボックスの作成
			CreateFixedBox();
			//上下移動しているボックスの作成
			CreateMoveBox();
			//透過するボックスの作成
			CreateTraceBox();
			//透過する球体の作成
			CreateTraceSphere();
			//プレーヤーの作成
			CreatePlayer();
		}
		catch (...){
			throw;
		}
	}
예제 #10
0
	void GameStage::OnCreate() {
		try {
			//ビューとライトの作成
			CreateViewLight();
			//プレートの作成
			CreatePlate();
			//固定の法線マップ処理ボックスの作成
			CreateFixedNormalBox();
			//上下移動しているボックスの作成
			CreateMoveBox();
			//球体作成
			CreateSphere();
			//でこぼこ床の作成
			CreateUnevenGround();
			//追いかけるオブジェクトの作成
			CreateSeekObject();
			//プレーヤーの作成
			CreatePlayer();
		}
		catch (...) {
			throw;
		}
	}
예제 #11
0
Game::Game(const SystemPath &path, const vector3d &pos) :
	m_time(0),
	m_state(STATE_NORMAL),
	m_wantHyperspace(false),
	m_timeAccel(TIMEACCEL_1X),
	m_requestedTimeAccel(TIMEACCEL_1X),
	m_forceTimeAccel(false)
{
	m_space.Reset(new Space(this, path));
	Body *b = m_space->FindBodyForPath(&path);
	assert(b);

	CreatePlayer();

	m_space->AddBody(m_player.Get());

	m_player->Enable();
	m_player->SetFrame(b->GetFrame());

	m_player->SetPosition(pos);
	m_player->SetVelocity(vector3d(0,0,0));

	CreateViews();
}
예제 #12
0
IPlayer* CPlayerCoreFactory::CreatePlayer(const std::string& strCore, IPlayerCallback& callback) const
{
  return CreatePlayer(GetPlayerCore(strCore), callback );
}
		void Update()
		{
			// Check if we are tagging enemy
			{
				if (m_ConnectedPlayers != NULL)
				{
					float length = (m_ConnectedPlayers->m_position - Graphics::GetPlayerPosition()).GetLength();
					Audio::SetVolume(length, 400.0f, 100.0f);
					if (length < 100.0f)
					{
						eae6320::Graphics::ResetFlag();
						eae6320::Graphics::ResetEnemyFlag();
						eae6320::Networking::TagBitch();
					}
				}
			}

			RakNet::Packet *packet;
			for (packet = m_Peer->Receive(); packet; m_Peer->DeallocatePacket(packet), packet = m_Peer->Receive())
			{
				switch (packet->data[0])
				{
				case ID_ENEMY_SCORE:
				{
					RakNet::BitStream bsIn(packet->data, packet->length, false);
					bsIn.IgnoreBytes(sizeof(RakNet::MessageID));
					int Score;
					bsIn.Read(Score);

					eae6320::Graphics::SetEnemyScore(Score);
					Audio::PlayAudio(7);
				}
					break;
				case ID_ENEMY_FLAG_LOCATION:
				{
					RakNet::BitStream bsIn(packet->data, packet->length, false);
					bsIn.IgnoreBytes(sizeof(RakNet::MessageID));
					bsIn.Read(m_EnemyFlagLocation.x);
					bsIn.Read(m_EnemyFlagLocation.y);
					bsIn.Read(m_EnemyFlagLocation.z);

					eae6320::Graphics::SetEnemyFlagLocation(m_EnemyFlagLocation);
				}
					break;
				case ID_REMOTE_DISCONNECTION_NOTIFICATION:
					UserOutput::Print("Another client has disconnected.\n");
					break;
				case ID_REMOTE_CONNECTION_LOST:
					UserOutput::Print("Another client has lost the connection.\n");
					break;
				case ID_REMOTE_NEW_INCOMING_CONNECTION:
					UserOutput::Print("Another client has connected.\n");
					break;
				case ID_CONNECTION_REQUEST_ACCEPTED:
				{
					printf("Our connection request has been accepted.\n");
					m_ServerAddress = packet->systemAddress;
					// Use a BitStream to write a custom user message
					// Bitstreams are easier to use than sending casted structures, and handle endian swapping automatically
					SendPlayerPosition();
				}
					break;
				case ID_NEW_INCOMING_CONNECTION:
					UserOutput::Print("A connection is incoming.\n");
					m_Clients[m_totalClients] = packet->systemAddress;
					m_totalClients++;
					SendPlayerPosition();
					break;
				case ID_NO_FREE_INCOMING_CONNECTIONS:
					UserOutput::Print("The server is full.\n");
					break;
				case ID_DISCONNECTION_NOTIFICATION:
					if (m_IsServer) {
						UserOutput::Print("A client has disconnected.\n");
					}
					else {
						UserOutput::Print("We have been disconnected.\n");
					}
					break;
				case ID_PLAYER_LOCATION:
				{
					CreatePlayer();
					RakNet::BitStream bsIn(packet->data, packet->length, false);
					bsIn.IgnoreBytes(sizeof(RakNet::MessageID));
					float x, y, z;
					bsIn.Read(x);
					bsIn.Read(y);
					bsIn.Read(z);
					for (int i = 0; i < 10; i++)
					{
						m_ConnectedPlayers[i].m_position.x = x;
						m_ConnectedPlayers[i].m_position.y = y;
						m_ConnectedPlayers[i].m_position.z = z;
					}
				}
				break;
				case ID_TAG_BITCH:
				{
					m_ResetFlag = true;
				}
				break;
				case ID_CONNECTION_LOST:
					if (m_IsServer) {
						UserOutput::Print("A client lost the connection.\n");
					}
					else {
						UserOutput::Print("Connection lost.\n");
					}
					break;
				default:
					char buf[100];
					sprintf_s(buf, "Message with identifier %i has arrived.\n", packet->data[0]);
					UserOutput::Print(buf);
					break;
				}
			}
		}
예제 #14
0
//---------------------------------------------------------------------------- 
// Nome: ChangeState(CLevel::GameState NewState)
// Desc: Muda o estado da máquina de estados da CLevel
// Pams: novo estado
//---------------------------------------------------------------------------- 
void CLevel::ChangeState(CLevel::GameState NewState)
{
	//somente muda o estado se o novo for diferente do atual
	if(State != NewState)
	{
		switch(NewState)
		{
			case GS_GAME:
			{
				if(State == GS_MENU)
				{
					if(!Menu.bInGame)
					{
						Menu.bInGame = true; //indica para o menu que o jogo está rodando
						CreateItems();		//cria os itens
						CreateEnemies();	//cria os inimigos
						CreatePlayer();		//cria o jogador						
						if(p_SprSwitch)
						{
							//ajusta animação da alavanca da fase para 0 (levantada)
							p_SprSwitch->SetCurrentAnimation(0);
						}
						//faz aparecer layer de interface (com pontos e vidas)
						p_LayInterface->bVisible = true;
					}					
					//esconde menu
					Menu.Show(false);

					State = NewState; //estado atual recebe novo estado
					break;
				}
				if(State == GS_PAUSE)
				{
					//17.5.3. Esconder mensagem de pausa
					p_MsgPaused->bVisible = false;

					State = NewState; //estado atual recebe novo estado
					break;
				}
				break;
			}
			case GS_PAUSE:
			{
				if(State == GS_GAME)
				{
					//17.5.3. Exibir mensagem de pausa
					if(p_MsgPaused)
					{
						p_MsgPaused->bVisible = true;
					}

					State = NewState; //estado atual recebe novo estado
					break;
				}
				break;
			}
			case GS_MENU:
			{
				if(State == GS_GAME)
				{	
					Menu.bInGame = true; //mostrará botão "Continuar"
					Menu.Show(true); //mostra o menu principal
					State = NewState; //estado atual recebe novo estado
					break;
				}
				if((State == GS_CONGRATULATIONS)||(State == GS_GAMEOVER))
				{
					if(p_MsgCongrats)
					{
						//esconde mensagem de congratulação
						p_MsgCongrats->bVisible = false;
					}
					if(p_MsgGameOver)
					{
						//esconde mensagem de game over
						p_MsgGameOver->bVisible = false;
					}
					ReleaseCharacters();	//desalocando os inimigos
					ReleaseItems();				//desalocando os itens
					Menu.bInGame = false; //mostrará botão "Novo Jogo"
					Menu.Show(true);			//mostra o menu principal
					Scroll(CNGLVector(0,0)); //desloca a as layers para o início da fase
					
					State = NewState; //estado atual recebe novo estado
					break;
				}
				break;
			}
			case GS_GAMEOVER:
			{
				if(State == GS_GAME)
				{
					if(p_MsgGameOver)
					{
						//mostra mensagem de game over
						p_MsgGameOver->bVisible = true;
					}
					State = NewState; //estado atual recebe novo estado
					break;
				}
				break;
			}
			case GS_CONGRATULATIONS:
			{
				if(State == GS_GAME)
				{
					//21.1.4.
					//1. mostrar mensagem de congratulação

					//2. reproduz o som de congratulação

					//3. troca a animação do jogador para a 2


					State = NewState; //estado atual recebe novo estado
					break;
				}
				break;
			}
		}
	}
}
예제 #15
0
/**
 * Initializes a source with a given wave instance and prepares it for playback.
 *
 * @param	WaveInstance	wave instace being primed for playback
 * @return	TRUE if initialization was successful, FALSE otherwise
 */
bool FSLESSoundSource::Init( FWaveInstance* InWaveInstance )
{
	// don't do anything if no volume! THIS APPEARS TO HAVE THE VOLUME IN TIME, CHECK HERE THOUGH IF ISSUES
	if( InWaveInstance && ( InWaveInstance->Volume * InWaveInstance->VolumeMultiplier ) <= 0 )
	{
		return false;
	}

	if (Buffer && Buffer->ResourceID == 0)
	{
		UE_LOG( LogAndroidAudio, Warning, TEXT(" InitSoundSouce with Buffer already allocated"));
		delete Buffer;
		Buffer = 0;
	}

	if (SL_PlayerObject)
	{
		UE_LOG( LogAndroidAudio, Warning, TEXT(" InitSoundSouce with PlayerObject not NULL, possible leak"));
	}
	
	WaveInstance = InWaveInstance;

	// Find matching buffer.
	Buffer = FSLESSoundBuffer::Init( (FSLESAudioDevice *)AudioDevice, InWaveInstance->WaveData );

	if( Buffer && InWaveInstance->WaveData->NumChannels <= 2 && InWaveInstance->WaveData->SampleRate <= 48000 )
	{
		SCOPE_CYCLE_COUNTER( STAT_AudioSourceInitTime );
		
		bool bFailedSetup = false;

		if (CreatePlayer())
		{
			switch( Buffer->Format)
			{
				case SoundFormat_PCM:
					bFailedSetup |= !EnqueuePCMBuffer( InWaveInstance->LoopingMode != LOOP_Never );
					break;
				case SoundFormat_PCMRT:
					bFailedSetup |= !EnqueuePCMRTBuffer( InWaveInstance->LoopingMode != LOOP_Never );
					break;
				default:
					bFailedSetup = true;
			}
		}
		else
		{
			bFailedSetup = true;
		}
		
		// clean up the madness if anything we need failed
		if( bFailedSetup )
		{
			UE_LOG( LogAndroidAudio, Warning, TEXT(" Setup failed %s"), *InWaveInstance->WaveData->GetName());
			DestroyPlayer();
			return false;
		}
		
		Update();
		
		// Initialization was successful.
		return true;
	}
	else
	{
		// Failed to initialize source.
		// These occurences appear to potentially lead to leaks
		UE_LOG( LogAndroidAudio, Warning, TEXT("Init SoundSource failed on %s"), *InWaveInstance->WaveData->GetName());
		UE_LOG( LogAndroidAudio, Warning, TEXT("  SampleRate %d"), InWaveInstance->WaveData->SampleRate);
		UE_LOG( LogAndroidAudio, Warning, TEXT("  Channels %d"), InWaveInstance->WaveData->NumChannels);

		if (Buffer && Buffer->ResourceID == 0)
		{
			delete Buffer;
			Buffer = 0;
		} 
	}
	return false;
}
예제 #16
0
void TitleScreenModel::CreatePlayers() {
  player1_top = CreatePlayer(GetPlayer1TopLeft(EnumValue(CourtPosition::POSITION_1)));
  player1_bottom = CreatePlayer(GetPlayer1BottomLeft(EnumValue(CourtPosition::POSITION_1)));
  player2_top = CreatePlayer(GetPlayer2TopLeft(EnumValue(CourtPosition::POSITION_1)));
  player2_bottom = CreatePlayer(GetPlayer2BottomLeft(EnumValue(CourtPosition::POSITION_1)));
}
예제 #17
0
bool CApplicationPlayer::OpenFile(const CFileItem& item, const CPlayerOptions& options,
                                  const CPlayerCoreFactory &factory,
                                  const std::string &playerName, IPlayerCallback& callback)
{
  // get player type
  std::string newPlayer;
  if (!playerName.empty())
    newPlayer = playerName;
  else
    newPlayer = factory.GetDefaultPlayer(item);

  // check if we need to close current player
  // VideoPlayer can open a new file while playing
  std::shared_ptr<IPlayer> player = GetInternal();
  if (player && player->IsPlaying())
  {
    bool needToClose = false;

    if (item.IsDiscImage() || item.IsDVDFile())
      needToClose = true;

    if (player->m_name != newPlayer)
      needToClose = true;

    if (player->m_type != "video")
      needToClose = true;

    if (needToClose)
    {
      m_nextItem.pItem = std::make_shared<CFileItem>(item);
      m_nextItem.options = options;
      m_nextItem.playerName = newPlayer;
      m_nextItem.callback = &callback;

      CloseFile();
      if (player->m_name != newPlayer)
      {
        CSingleLock lock(m_playerLock);
        m_pPlayer.reset();
      }
      return true;
    }
  }

  if (!player)
  {
    CreatePlayer(factory, newPlayer, callback);
    player = GetInternal();
    if (!player)
      return false;
  }

  bool ret = player->OpenFile(item, options);

  m_nextItem.pItem.reset();

  // reset caching timers
  m_audioStreamUpdate.SetExpired();
  m_videoStreamUpdate.SetExpired();
  m_subtitleStreamUpdate.SetExpired();

  return ret;
}
예제 #18
0
파일: game.cpp 프로젝트: k1643/StratagusAI
/**
**  CreateGame.
**
**  Load map, graphics, sounds, etc
**
**  @param filename  map filename
**  @param map       map loaded
**
**  @todo FIXME: use in this function InitModules / LoadModules!!!
*/
void CreateGame(const char *filename, CMap *map)
{
	int i;

	if (SaveGameLoading) {
		SaveGameLoading = 0;
		// Load game, already created game with Init/LoadModules
		CommandLog(NULL, NoUnitP, FlushCommands, -1, -1, NoUnitP, NULL, -1);
		return;
	}

	InitVisionTable(); // build vision table for fog of war
	InitPlayers();
	
	if (Map.Info.Filename.empty() && filename) {
		char path[PATH_MAX];
		
		Assert(filename);
		LibraryFileName(filename, path, sizeof(path));
		if(strcasestr(filename, ".smp")) {
			LuaLoadFile(path);
		}
	}

	for (i = 0; i < PlayerMax; ++i) {
		int playertype = Map.Info.PlayerType[i];
		// Network games only:
		if (GameSettings.Presets[i].Type != SettingsPresetMapDefault) {
			playertype = GameSettings.Presets[i].Type;
		}
		CreatePlayer(playertype);
	}

	if (filename) {
		if (CurrentMapPath != filename) {
			strcpy_s(CurrentMapPath, sizeof(CurrentMapPath), filename);
		}

		//
		// Load the map.
		//
		InitUnitTypes(1);
		LoadMap(filename, map);
		
		// HARDCODING FOG OF WAR TRUE.  It doesn't currently use preferences on a game restart - Should be changed 
		map->NoFogOfWar = true;
		Map.Reveal();
	}

	GameCycle = 0;
	FastForwardCycle = 0;
	SyncHash = 0;
	InitSyncRand();

	if (IsNetworkGame()) { // Prepare network play
		DebugPrint("Client setup: Calling InitNetwork2\n");
		InitNetwork2();
	} else {
		if (LocalPlayerName && strcmp(LocalPlayerName, "Anonymous")) {
		  ThisPlayer->SetName(LocalPlayerName);
		}
	}

	CallbackMusicOn();

#if 0
	GamePaused = true;
#endif

	if (FlagRevealMap) {
		Map.Reveal();
	}

	//
	// Setup game types
	//
	// FIXME: implement more game types
	if (GameSettings.GameType != SettingsGameTypeMapDefault) {
		switch (GameSettings.GameType) {
			case SettingsGameTypeMelee:
				break;
			case SettingsGameTypeFreeForAll:
				GameTypeFreeForAll();
				break;
			case SettingsGameTypeTopVsBottom:
				GameTypeTopVsBottom();
				break;
			case SettingsGameTypeLeftVsRight:
				GameTypeLeftVsRight();
				break;
			case SettingsGameTypeManVsMachine:
				GameTypeManVsMachine();
				break;
			case SettingsGameTypeManTeamVsMachine:
				GameTypeManTeamVsMachine();

			// Future game type ideas
#if 0
			case SettingsGameTypeOneOnOne:
				break;
			case SettingsGameTypeCaptureTheFlag:
				break;
			case SettingsGameTypeGreed:
				break;
			case SettingsGameTypeSlaughter:
				break;
			case SettingsGameTypeSuddenDeath:
				break;
			case SettingsGameTypeTeamMelee:
				break;
			case SettingsGameTypeTeamCaptureTheFlag:
				break;
#endif
		}
	}

	//
	// Graphic part
	//
	SetPlayersPalette();
	InitIcons();
	LoadIcons();

	LoadCursors(PlayerRaces.Name[ThisPlayer->Race]);
	UnitUnderCursor = NoUnitP;

	InitMissileTypes();
#ifndef DYNAMIC_LOAD
	LoadMissileSprites();
#endif
	InitConstructions();
	LoadConstructions();
	LoadUnitTypes();
	LoadDecorations();

	InitSelections();

	InitUserInterface();
	UI.Load();

	UI.Minimap.Create();
	Map.Init();
	PreprocessMap();

	//
	// Sound part
	//
	LoadUnitSounds();
	MapUnitSounds();
	if (SoundEnabled()) {
		InitSoundClient();
	}

	//
	// Spells
	//
	InitSpells();

	//
	// Init units' groups
	//
	InitGroups();

	//
	// Init players?
	//
	DebugPlayers();
	PlayersInitAi();

	//
	// Upgrades
	//
	InitUpgrades();

	//
	// Dependencies
	//
	InitDependencies();

	//
	// Buttons (botpanel)
	//
	InitButtons();

	//
	// Triggers
	//
	InitTriggers();

	SetDefaultTextColors(UI.NormalFontColor, UI.ReverseFontColor);

#if 0
	if (!UI.SelectedViewport) {
		UI.SelectedViewport = UI.Viewports;
	}
#endif
	UI.SelectedViewport->Center(
		ThisPlayer->StartX, ThisPlayer->StartY, TileSizeX / 2, TileSizeY / 2);

	//
	// Various hacks wich must be done after the map is loaded.
	//
	// FIXME: must be done after map is loaded
	InitAStar();
	//
	// FIXME: The palette is loaded after the units are created.
	// FIXME: This loops fixes the colors of the units.
	//
	for (i = 0; i < NumUnits; ++i) {
		// I don't really think that there can be any rescued
		// units at this point.
		if (Units[i]->RescuedFrom) {
			Units[i]->Colors = &Units[i]->RescuedFrom->UnitColors;
		} else {
			Units[i]->Colors = &Units[i]->Player->UnitColors;
		}
	}

	GameResult = GameNoResult;

	CommandLog(NULL, NoUnitP, FlushCommands, -1, -1, NoUnitP, NULL, -1);
	Video.ClearScreen();
}
예제 #19
0
	virtual TSharedPtr<IMediaPlayer> CreatePlayer() override
	{
		auto VlcMediaModule = FModuleManager::LoadModulePtr<IVlcMediaModule>("VlcMedia");
		return (VlcMediaModule != nullptr) ? VlcMediaModule->CreatePlayer() : nullptr;
	}
void CGameManager::LoadSave(int nSlot)
{
	Reset();

	wchar_t path[MAX_PATH];
	HRESULT hr = SHGetFolderPathW(0, CSIDL_APPDATA, 0, SHGFP_TYPE_CURRENT, path);

	std::wstring pathtowrite(path, path+ wcslen(path));
	
	pathtowrite += L"\\LeagueOfChampionCraft";
	CreateDirectory(pathtowrite.c_str(), 0);

	std::wostringstream woss;
	woss << "\\saveslot" << nSlot << ".xml";
	pathtowrite += woss.str();
	std::string stringpath(pathtowrite.begin(), pathtowrite.end());

	TiXmlDocument doc;
	if (doc.LoadFile(stringpath.c_str()))
	{
		TiXmlElement* pRoot = doc.RootElement();


		if (pRoot == nullptr)
			return;

		int nMapID, nCurrPlayer, nPhaseCount, nCurrPhase;
		pRoot->QueryIntAttribute("mapID", &nMapID);
		pRoot->QueryIntAttribute("currPlayer", &nCurrPlayer);
		pRoot->QueryIntAttribute("phaseNumber", &nPhaseCount);
		pRoot->QueryIntAttribute("phase", &nCurrPhase);


		LoadMap(nMapID);

		// Map modifcations! Weeeeeeeee
		int nNumMapModifications;
		TiXmlElement* pMapMods = pRoot->FirstChildElement("MapModifications");
		pMapMods->QueryIntAttribute("numModifications", &nNumMapModifications);
		TiXmlElement* pMapModification = pMapMods->FirstChildElement("MapModification");
		for (int i = 0; i < nNumMapModifications; ++i)
		{
			MapModification mod;
			int nType;
			pMapModification->QueryIntAttribute("modType", &nType);
			mod.modType = (SPELL_TYPE)nType;
			pMapModification->QueryIntAttribute("modPosX", &mod.posX);
			pMapModification->QueryIntAttribute("modPosY", &mod.posY);
			pMapModification->QueryIntAttribute("modOtherData", &mod.otherData);
			switch (mod.modType)
			{
			case SP_FAKEMAPMOD:
				{
					CTile* selectedTile = CTileManager::GetInstance()->GetTile(mod.posX, mod.posY);
					if (selectedTile != nullptr)
					{
						selectedTile->SetPlayerID(mod.otherData);
						selectedTile->SetIfCaptured(true);
					}
				}
				break;
			case SP_RAISEMOUNTAIN:
				{
					CTile* selectedTile = CTileManager::GetInstance()->GetTile(mod.posX, mod.posY);
					if( selectedTile != nullptr )
					{	
						if (selectedTile->GetTileType() != TT_FARM && selectedTile->GetTileType() != TT_MILL &&
							selectedTile->GetTileType() != TT_MINE)
						{
							selectedTile->SetTileType(TT_MOUNTAINS);
							selectedTile->SetIfImpassable(false);
							CGameManager::GetInstance()->AddModification(mod);
						}
					}
				}
				break;
			case SP_DESTROYFOREST:
				{
					CTile* selectedTile = CTileManager::GetInstance()->GetTile(mod.posX, mod.posY);
					if( selectedTile != nullptr )
					{	
						if (selectedTile->GetTileType() == TT_FOREST)
						{
							selectedTile->SetTileType(TT_PLAINS);
							CGameManager::GetInstance()->AddModification(mod);
						}
					}
				}
				break;

			case SP_ICEAGE:
				{
					CTile* selectedTile = CTileManager::GetInstance()->GetTile(mod.posX, mod.posY);
					if( selectedTile != nullptr )
					{	
						selectedTile->SetIfFrozen(true);
						CGameManager::GetInstance()->AddModification(mod);
					}
				}
				break;
			}

			pMapModification = pMapModification->NextSiblingElement("MapModification");

		}


		TiXmlElement* pPlayers = pRoot->FirstChildElement("Players");
		TiXmlElement* pPlayer = pPlayers->FirstChildElement("Player");

		for (decltype(m_vPlayers.size()) i = 0; i < m_vPlayers.size(); ++i)
		{
	
			delete m_vPlayers[i];
		}
		m_vPlayers.clear();
		m_nNewPlayerID = 0;
		for (int np = 0; np < 2; ++np)
		{
			int nAIControlled;
			int nPlayerID;
			int nAP, nWood, nMetal;
			pPlayer->QueryIntAttribute("id", &nPlayerID);
			pPlayer->QueryIntAttribute("ai", &nAIControlled);
			pPlayer->QueryIntAttribute("wood", &nWood);
			pPlayer->QueryIntAttribute("AP", &nAP);
			pPlayer->QueryIntAttribute("metal", &nMetal);
			CPlayer* pplay = CreatePlayer(IntToBool(nAIControlled));

			pplay->SetWood(nWood);
			pplay->SetAP(nAP);
			pplay->SetMetal(nMetal);


			// Load stats!
			TiXmlElement* pStats = pPlayer->FirstChildElement("Stats");

			TiXmlElement* pStat = pStats->FirstChildElement("ChampionDamageDone");
			pStat->QueryIntAttribute("value", &pplay->GetStats()->nChampionDamageDone);
			pStat = pStats->FirstChildElement("ChampionHealingDone");
			pStat->QueryIntAttribute("value", &pplay->GetStats()->nChampionHealingDone);
			pStat = pStats->FirstChildElement("SwordsmanCreated");
			pStat->QueryIntAttribute("value", &pplay->GetStats()->nSwordsmanCreated);
			pStat = pStats->FirstChildElement("ArcherCreated");
			pStat->QueryIntAttribute("value", &pplay->GetStats()->nArcherCreated);
			pStat = pStats->FirstChildElement("CalvaryCreated");
			pStat->QueryIntAttribute("value", &pplay->GetStats()->nCalvaryCreated);
			pStat = pStats->FirstChildElement("SwordsmanDamageDone");
			pStat->QueryIntAttribute("value", &pplay->GetStats()->nSwordsmanDamageDone);
			pStat = pStats->FirstChildElement("ArcherDamageDone");
			pStat->QueryIntAttribute("value", &pplay->GetStats()->nArcherDamageDone);
			pStat = pStats->FirstChildElement("CalvaryDamageDone");
			pStat->QueryIntAttribute("value", &pplay->GetStats()->nCalvaryDamageDone);
			pStat = pStats->FirstChildElement("SwordsmanKilled");
			pStat->QueryIntAttribute("value", &pplay->GetStats()->nSwordsmanKilled);
			pStat = pStats->FirstChildElement("ArcherKilled");
			pStat->QueryIntAttribute("value", &pplay->GetStats()->nArcherKilled);
			pStat = pStats->FirstChildElement("CalvaryKilled");
			pStat->QueryIntAttribute("value", &pplay->GetStats()->nCavalryKilled);
			pStat = pStats->FirstChildElement("WoodEarned");
			pStat->QueryIntAttribute("value", &pplay->GetStats()->nPlayerWoodEarned);
			pStat = pStats->FirstChildElement("WoodSpent");
			pStat->QueryIntAttribute("value", &pplay->GetStats()->nPlayerWoodSpent);
			pStat = pStats->FirstChildElement("MetalEarned");
			pStat->QueryIntAttribute("value", &pplay->GetStats()->nPlayerMetalEarned);
			pStat = pStats->FirstChildElement("MetalSpent");
			pStat->QueryIntAttribute("value", &pplay->GetStats()->nPlayerMetalSpent);
			pStat = pStats->FirstChildElement("APSpent");
			pStat->QueryIntAttribute("value", &pplay->GetStats()->nPlayerAPSpent);



			TiXmlElement* pChampion = pPlayer->FirstChildElement("Champion");

			int nPosX, nPosY, nHealth, nXP, nFacing, nTilesMoved, nHasAttacked;
			// TODO: load in spells here from ability manager
			pChampion->QueryIntAttribute("posX", &nPosX);
			pChampion->QueryIntAttribute("posY", &nPosY);
			pChampion->QueryIntAttribute("health", &nHealth);
			pChampion->QueryIntAttribute("xp", &nXP);
			pChampion->QueryIntAttribute("facing", &nFacing);
			pChampion->QueryIntAttribute("tilesMoved", &nTilesMoved);
			pChampion->QueryIntAttribute("hasAttacked", &nHasAttacked);

			pplay->SetExp(nXP);

			int nNumSpells;
			TiXmlElement* pSpells = pChampion->FirstChildElement("Spells");
			pSpells->QueryIntAttribute("numSpells", &nNumSpells);
			std::vector< std::pair<SPELL_TYPE, int> > spells;
			TiXmlElement* pSpell = pSpells->FirstChildElement("Spell");

			for (int i = 0; i < nNumSpells; ++i)
			{
				int nType;
				int cooldown;
				pSpell->QueryIntAttribute("sType", &nType);
				pSpell->QueryIntAttribute("Cooldown", &cooldown);
				std::pair<SPELL_TYPE, int> tmp((SPELL_TYPE)nType, cooldown);
				spells.push_back(tmp);
				pSpell = pSpell->NextSiblingElement("Spell");
			}

			int nNumBought;
			TiXmlElement* pBoughtSpells = pChampion->FirstChildElement("BoughtSpells");
			pBoughtSpells->QueryIntAttribute("numBought", &nNumBought);
			std::vector<SPELL_TYPE> bought;
			TiXmlElement* pBought = pBoughtSpells->FirstChildElement("Bought");
			
			for( int i = 0; i < nNumBought; i++)
			{
				int type;
				pBought->QueryIntAttribute("Type", &type);
				bought.push_back((SPELL_TYPE)type);
				pBought = pBought->NextSiblingElement("Bought");
			}

			int nNumEffects;
			TiXmlElement* pEffects = pChampion->FirstChildElement("Effects");
			pEffects->QueryIntAttribute("numEffects", &nNumEffects);
			std::vector<SPELL_TYPE> effects;
			TiXmlElement* pEffect = pEffects->FirstChildElement("Effect");
			for (int i = 0; i < nNumEffects; ++i)
			{
				int nType;
				pEffect->QueryIntAttribute("ability", &nType);
				effects.push_back((SPELL_TYPE)nType);
				pEffect = pEffect->NextSiblingElement("Effect");
			}

			CSpawnUnitMessage* pMsg = new CSpawnUnitMessage(spells, effects, bought, Vec2D(nPosX, nPosY), nPlayerID, UT_HERO, nFacing, true, 
				nHealth, nTilesMoved, IntToBool(nHasAttacked));
			CMessageSystem::GetInstance()->SendMessageW(pMsg);


			int nNumUnits;
			TiXmlElement* pUnits = pPlayer->FirstChildElement("Units");
			pUnits->QueryIntAttribute("numUnits", &nNumUnits);

			TiXmlElement* pUnit = pUnits->FirstChildElement("Unit");
			for (int i = 0; i < nNumUnits; ++i)
			{
				int nUnitPosX, nUnitPosY, nUnitType, nUnitHealth, nUnitFacing, nUnitTilesMoved, nUnitHasAttacked;
				pUnit->QueryIntAttribute("posX", &nUnitPosX);
				pUnit->QueryIntAttribute("posY", &nUnitPosY);
				pUnit->QueryIntAttribute("unitType", &nUnitType);
				pUnit->QueryIntAttribute("health", &nUnitHealth);
				pUnit->QueryIntAttribute("facing", &nUnitFacing);
				pUnit->QueryIntAttribute("tilesMoved", &nUnitTilesMoved);
				pUnit->QueryIntAttribute("hasAttacked", &nUnitHasAttacked);
				std::vector<std::pair<SPELL_TYPE, int>> spells;
				int nNumEffects;
				TiXmlElement* pEffects = pUnit->FirstChildElement("Effects");
				pEffects->QueryIntAttribute("numEffects", &nNumEffects);
				std::vector<SPELL_TYPE> effects;
				TiXmlElement* pEffect = pEffects->FirstChildElement("Effect");
				for (int i = 0; i < nNumEffects; ++i)
				{
					int nType;
					pEffect->QueryIntAttribute("ability", &nType);
					effects.push_back((SPELL_TYPE)nType);
					pEffect = pEffect->NextSiblingElement("Effect");
				}
				CSpawnUnitMessage* pUnitMsg = 
					new CSpawnUnitMessage(spells, effects, Vec2D(nUnitPosX, nUnitPosY), nPlayerID, (UNIT_TYPE)nUnitType, nUnitFacing, true, nUnitHealth,
						nUnitTilesMoved,IntToBool(nUnitHasAttacked) );
				CMessageSystem::GetInstance()->SendMessageW(pUnitMsg);

				pUnit = pUnit->NextSiblingElement("Unit");
			}
			pPlayer = pPlayer->NextSiblingElement("Player");
		}


		SetCurrentPlayer(nCurrPlayer);
		if (nCurrPlayer == 0)
			SetNextPlayer(1);
		else
			SetNextPlayer(0);
		SetPhaseCount(nPhaseCount);
		SetCurrentPhase((GAME_PHASE)nCurrPhase);
		CMessageSystem::GetInstance()->ProcessMessages();

		m_bLoadingFromSave = true;
	}
}
예제 #21
0
int main()
{
    PlayerList players;
    if (!Read(players))
        Save(players); // creates an empty file

    while (true)
    {
        std::cout << "*** Euromilhoes - Gestao de Jogadores ***" << std::endl << std::endl;

        std::cout << "Introduza a letra respectiva:" << std::endl;
        std::cout << "R - Registar um jogador." << std::endl;
        std::cout << "C - Consultar o saldo de um jogador." << std::endl;
        std::cout << "A - Carregar saldo de um jogador." << std::endl;
        std::cout << "E - Eliminar um jogador." << std::endl;
        std::cout << "L - Listar jogadores." << std::endl;
        std::cout << "S - Sair." << std::endl;

        char task = ReadVal<char>("");

        std::cout << std::endl;

        switch(ToUpper(task))
        {
            case RegisterPlayer:
            {
                std::cout << "* Registar jogador" << std::endl;

                std::string name = ReadString("Nome: ", NAME_WIDTH - 1);
                double amount = ReadVal<double>("Saldo inicial: ");

                int id = CreatePlayer(players, name, amount);
                std::cout << "Sucesso, atribuido numero " << id << "." << std::endl;
                std::cout << std::endl;

                break;
            }
            case CheckBalance:
            {
                std::cout << "* Consultar saldo" << std::endl;

                int id = ReadVal<int>("Numero do jogador: ");

                if (Player* player = SearchPlayerById(players, id))
                    std::cout << "Saldo de " << player->Name << ": " << std::fixed << std::setprecision(2) << player->Balance << "E." << std::endl;
                else
                    std::cout << "Jogador " << id << " nao encontrado." << std::endl;
                std::cout << std::endl;

                break;
            }
            case IncreaseBalance:
            {
                std::cout << "* Aumentar saldo" << std::endl;

                int id = ReadVal<int>("Numero do jogador: ");

                if (Player* player = SearchPlayerById(players, id))
                {
                    double amount = ReadVal<double>("Quantidade: ");

                    double oldAmount = player->Balance;

                    if (IncreasePlayerBalance(player, amount))
                    {
                        std::cout << player->Name << ": anterior: " << oldAmount << "E, aumento: ";
                        std::cout << amount << "E, actual: " << player->Balance << "E." << std::endl;
                    }
                    else
                        std::cout << "Valor invalido." << std::endl;
                }
                else
                    std::cout << "Jogador " << id << " nao encontrado." << std::endl;
                std::cout << std::endl;

                break;
            }
            case RemovePlayer:
            {
                std::cout << "* Remove jogador" << std::endl;

                int id = ReadVal<int>("Numero do jogador: ");
                if (Player* player = SearchPlayerById(players, id))
                {
                    std::string name = player->Name;
                    DeletePlayer(players, id);
                    std::cout << "Jogador " << name << " eliminado." << std::endl;
                }
                else
                    std::cout << "Jogador " << id << " nao encontrado." << std::endl;
                std::cout << std::endl;

                break;
            }
            case ListPlayers:
            {
                std::cout << "* Lista de jogadores" << std::endl;

                if (players.first.size() == 0)
                    std::cout << "Lista de jogadores vazia." << std::endl;
                else
                    for (size_t i = 0; i < players.first.size(); ++i)
                    {
                        std::cout << "|";

                        char prevFill = std::cout.fill(ID_FILL_CHAR);
                        std::streamsize prevWidth = std::cout.width(ID_WIDTH);
                        std::cout << std::right << players.first[i].Id;
                        std::cout.fill(prevFill);
                        std::cout.width(prevWidth);

                        prevWidth = std::cout.width(NAME_WIDTH);
                        std::cout << std::left << "| " << players.first[i].Name << " |" << std::endl;
                        std::cout.width(prevWidth);
                    }

                std::cout << std::endl;

                break;
            }
            case Exit:
            {
                char answer = ReadVal<char>("Tem a certeza que deseja sair (S/N)? ");

                if (ToUpper(answer) == 'S')
                    ExitAndSave(players);
                else if (ToUpper(answer) == 'N')
                    break;
                else
                    std::cout << std::endl; // Fall to default
            }
            default:
            {
                std::cout << "Opcao invalida. Por favor, tente outra vez." << std::endl;
                break;
            }
        }

        PauseScreen();
        ClearScreen();
    }

    PauseScreen();
}
void Player::RespawnPlayer()
{
    agk::DeleteSprite(1);
    agk::Print("YOU LOST!");
    CreatePlayer(playerID);
}
예제 #23
0
	virtual TSharedPtr<IMediaPlayer, ESPMode::ThreadSafe> CreatePlayer(IMediaEventSink& EventSink) override
	{
		auto NdiMediaModule = FModuleManager::LoadModulePtr<INdiMediaModule>("NdiMedia");
		return (NdiMediaModule != nullptr) ? NdiMediaModule->CreatePlayer(EventSink) : nullptr;
	}
예제 #24
0
inline void LevelManager::InitLevel() {
	CreatePlayer();
	CreateBall();
	CreateBricks();
}
	virtual TSharedPtr<IMediaPlayer> CreatePlayer() override
	{
		auto AndroidMediaModule = FModuleManager::LoadModulePtr<IAndroidMediaModule>("AndroidMedia");
		return (AndroidMediaModule != nullptr) ? AndroidMediaModule->CreatePlayer() : nullptr;
	}
예제 #26
0
string osl_ExecuteSystemFunction(vector<OSL_LEXEM>* list)
{
	string _result;
	_result.resize(0);

	#ifdef _DEBUG_OSL
	WriteToLog(DEFAULT_OSL_LOG_NAME, "Executing system function...");
	#endif

	unsigned int param_count = 1;

	for(vector<OSL_LEXEM>::iterator it = list->begin();
		it != list->end();
		it++)
	{
		OSL_LEXEM lx = *it;

		if(osl_IsComma(lx.token))
			param_count++;
	}

	vector<OSL_LEXEM>::iterator i_first = list->begin();
	OSL_LEXEM first = *i_first;

	if(first.token == "echo")
	{
		vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
		OSL_LEXEM second = *i_second;

		char* message = new char[second.token.length()+1];
		strcpy(message, (char*)second.token.data());

		message = osl_RemoveQuotesChr(message);
		DoEcho(message);
	}
	else if(first.token == "load")
	{
		vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
		OSL_LEXEM second = *i_second;

		bool ok = DoLoad(osl_RemoveQuotesStr(second.token));

		ok == true ? _result = OSL_EXEC_OK : _result = OSL_EXEC_FAIL;
	}
	else if(first.token == "exit")
	{
		DoExit();
	}
	else if(first.token == "init")
	{
					vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
					OSL_LEXEM second = *i_second;

					if(second.token == "gui")
					{
						if(!gui)
						{
							gui = new GUI();
							_result = OSL_EXEC_OK;
						}
						else
						{
							osl_Error("GUI already initialized");
							_result = OSL_EXEC_FAIL;
						}
					}
					else
					{
						osl_Error("init(): unknown parameter");
						_result = OSL_EXEC_FAIL;
					}
	}
	else if(first.token == "loadconfig")
	{
		vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
		OSL_LEXEM second = *i_second;

		if(osl_IsStrConstant(second.token))
		{
			char* file = new char[second.token.length()+1];
			strcpy(file, (char*)second.token.data());
			file = osl_RemoveQuotesChr(file);

			bool ok = LoadConfig(file, &cfg);

			if(ok)
			{
				ApplyConfig(&cfg);
				_result = OSL_EXEC_OK;
			}
			else
				_result = OSL_EXEC_FAIL;
		}
		else
			osl_Error("LoadConfig(): Invalid argument");
	}
	else if(first.token == "loadfontfromfile")
	{
		WriteToLog(DEFAULT_OSL_LOG_NAME, "Trying to load font from file...");

		if(param_count == 3)
		{
			vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
			OSL_LEXEM second = *i_second;
			vector<OSL_LEXEM>::iterator i_third = list->begin()+4;
			OSL_LEXEM third = *i_third;
			vector<OSL_LEXEM>::iterator i_fourth = list->begin()+6;
			OSL_LEXEM fourth = *i_fourth;

			if(osl_IsIntConstant(third.token) &&
				osl_IsIntConstant(fourth.token))
			{
				try
				{
					if(LoadFontFromFile((char*)osl_RemoveQuotesStr(second.token).c_str(),
						osl_StrToInt(third.token),
						osl_StrToInt(fourth.token)))
					{
						WriteToLog(DEFAULT_OSL_LOG_NAME, "LoadFontFromFile OK");
						_result = OSL_EXEC_OK;
					}
					else
					{
						WriteToLog(DEFAULT_OSL_LOG_NAME, "LoadFontFromFile FAILED");
						_result = OSL_EXEC_FAIL;
					}
				}
				catch(...)
				{
					osl_Error("Exception in try block: LoadFontFromFile");
					_result = OSL_EXEC_FAIL;
				}			
			}
			else
			{
				osl_Error("LoadFontFromFile() error: incompatible types");
				_result = OSL_EXEC_FAIL;
			}
		}
		else
		{
			osl_Error("LoadFontFromFile() error: function require one parameter");
			_result = OSL_EXEC_FAIL;
		}
	}
	else if(first.token == "loadfont")
	{
		WriteToLog(DEFAULT_OSL_LOG_NAME, "Trying to load font...");
		if(param_count == 4)
		{
			vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
			OSL_LEXEM second = *i_second;
			vector<OSL_LEXEM>::iterator i_third = list->begin()+4;
			OSL_LEXEM third = *i_third;
			vector<OSL_LEXEM>::iterator i_fourth = list->begin()+6;
			OSL_LEXEM fourth = *i_fourth;
			vector<OSL_LEXEM>::iterator i_fifth = list->begin()+8;
			OSL_LEXEM fifth = *i_fifth;

			try
			{
				bool ok =
					LoadFont((char*)osl_RemoveQuotesStr(second.token).c_str(),
						osl_StrToInt(third.token),
						osl_StrToInt(fourth.token),
						(char*)osl_RemoveQuotesStr(fifth.token).c_str());

				ok == true ? _result = OSL_EXEC_OK : _result = OSL_EXEC_FAIL;
			}
			catch(...)
			{
				osl_Error("Exception in try block: LoadFont");
				_result = OSL_EXEC_FAIL;
			}
			WriteToLog(DEFAULT_OSL_LOG_NAME, "LoadFont OK");

		}
		else
		{
			osl_Error("LoadFont() error: function requires two parametres");
			_result = OSL_EXEC_FAIL;
		}
	}
	else if(first.token == "loadtexture")
	{
		WriteToLog(DEFAULT_OSL_LOG_NAME, "Trying to load texture...");
		if(param_count == 1)
		{
			vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
			OSL_LEXEM second = *i_second;

			try
			{
				string s = osl_RemoveQuotesStr(second.token);
				char* n = new char[strlen(s.data())+1];
				sprintf(n, "%s\0", s.data());

				if(!LoadTexture(n))
				{
					osl_Error("LoadTexture() failed");
					_result = OSL_EXEC_FAIL;
				}
				else
					_result = OSL_EXEC_OK;
				delete[] n;
			}
			catch(...)
			{
				osl_Error("Exception in try block: LoadTexture");
				_result = OSL_EXEC_FAIL;
			}
			WriteToLog(DEFAULT_OSL_LOG_NAME, "LoadTexture OK");
		}
		else
		{
			osl_Error("LoadTexture() error: function requires one parameter");
			_result = OSL_EXEC_FAIL;
		}
	}
	else if(first.token == "newguielem")
	{
		if(param_count == 2)
		{
			vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
			OSL_LEXEM second = *i_second;
			vector<OSL_LEXEM>::iterator i_third = list->begin()+4;
			OSL_LEXEM third = *i_third;

			NewGUIElem(osl_RemoveQuotesStr(second.token),
				osl_RemoveQuotesStr(third.token));
		}
		else
			osl_Error("NewGUIElem() error: function requires two parametres");
	}
	else if(first.token == "setguielem")
	{
		if(param_count == 3)
		{
			vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
			OSL_LEXEM second = *i_second;
			vector<OSL_LEXEM>::iterator i_third = list->begin()+4;
			OSL_LEXEM third = *i_third;
			vector<OSL_LEXEM>::iterator i_fourth = list->begin()+6;
			OSL_LEXEM fourth = *i_fourth;

			SetGUIElem(osl_RemoveQuotesStr(second.token),
				osl_RemoveQuotesStr(third.token),
				osl_RemoveQuotesStr(fourth.token));
		}
		else if(param_count == 5)
		{
			vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
			OSL_LEXEM second = *i_second;
			vector<OSL_LEXEM>::iterator i_third = list->begin()+4;
			OSL_LEXEM third = *i_third;
			vector<OSL_LEXEM>::iterator i_fourth = list->begin()+6;
			OSL_LEXEM fourth = *i_fourth;
			vector<OSL_LEXEM>::iterator i_fifth = list->begin()+8;
			OSL_LEXEM fifth = *i_fifth;
			vector<OSL_LEXEM>::iterator i_sixth = list->begin()+10;
			OSL_LEXEM sixth = *i_sixth;

			SetGUIElem(osl_RemoveQuotesStr(second.token),
				osl_RemoveQuotesStr(third.token),
				osl_RemoveQuotesStr(fourth.token),
				osl_RemoveQuotesStr(fifth.token),
				osl_RemoveQuotesStr(sixth.token));
		}
		else if(param_count == 6)
		{
			vector<OSL_LEXEM>::iterator i_second = list->begin()+2;
			OSL_LEXEM second = *i_second;
			vector<OSL_LEXEM>::iterator i_third = list->begin()+4;
			OSL_LEXEM third = *i_third;
			vector<OSL_LEXEM>::iterator i_fourth = list->begin()+6;
			OSL_LEXEM fourth = *i_fourth;
			vector<OSL_LEXEM>::iterator i_fifth = list->begin()+8;
			OSL_LEXEM fifth = *i_fifth;
			vector<OSL_LEXEM>::iterator i_sixth = list->begin()+10;
			OSL_LEXEM sixth = *i_sixth;
			vector<OSL_LEXEM>::iterator i_seventh = list->begin()+12;
			OSL_LEXEM seventh = *i_seventh;

			SetGUIElem(osl_RemoveQuotesStr(second.token),
				osl_RemoveQuotesStr(third.token),
				osl_RemoveQuotesStr(fourth.token),
				osl_RemoveQuotesStr(fifth.token),
				osl_RemoveQuotesStr(sixth.token),
				osl_RemoveQuotesStr(seventh.token));
		}
		else
			osl_Error("NewGUIElem() error: incorrect number of parametres");
	}
	else if(first.token == "createplayer")
	{
		if(param_count == 28)
		{
			vector<OSL_LEXEM>::iterator p1 = list->begin()+2;
			vector<OSL_LEXEM>::iterator p2 = list->begin()+4;
			vector<OSL_LEXEM>::iterator p3 = list->begin()+6;
			vector<OSL_LEXEM>::iterator p4 = list->begin()+8;
			vector<OSL_LEXEM>::iterator p5 = list->begin()+10;
			vector<OSL_LEXEM>::iterator p6 = list->begin()+12;
			vector<OSL_LEXEM>::iterator p7 = list->begin()+14;
			vector<OSL_LEXEM>::iterator p8 = list->begin()+16;
			vector<OSL_LEXEM>::iterator p9 = list->begin()+18;
			vector<OSL_LEXEM>::iterator p10 = list->begin()+20;
			vector<OSL_LEXEM>::iterator p11 = list->begin()+22;
			vector<OSL_LEXEM>::iterator p12 = list->begin()+24;
			vector<OSL_LEXEM>::iterator p13 = list->begin()+26;
			vector<OSL_LEXEM>::iterator p14 = list->begin()+28;
			vector<OSL_LEXEM>::iterator p15 = list->begin()+30;
			vector<OSL_LEXEM>::iterator p16 = list->begin()+32;
			vector<OSL_LEXEM>::iterator p17 = list->begin()+34;
			vector<OSL_LEXEM>::iterator p18 = list->begin()+36;
			vector<OSL_LEXEM>::iterator p19 = list->begin()+38;
			vector<OSL_LEXEM>::iterator p20 = list->begin()+40;
			vector<OSL_LEXEM>::iterator p21 = list->begin()+42;
			vector<OSL_LEXEM>::iterator p22 = list->begin()+44;
			vector<OSL_LEXEM>::iterator p23 = list->begin()+46;
			vector<OSL_LEXEM>::iterator p24 = list->begin()+48;
			vector<OSL_LEXEM>::iterator p25 = list->begin()+50;
			vector<OSL_LEXEM>::iterator p26 = list->begin()+52;
			vector<OSL_LEXEM>::iterator p27 = list->begin()+54;
			vector<OSL_LEXEM>::iterator p28 = list->begin()+56;

			CreatePlayer((*p1).token, (*p2).token, (*p3).token, (*p4).token,
				(*p5).token, (*p6).token, (*p7).token, (*p8).token, (*p9).token,
				(*p10).token, (*p11).token, (*p12).token, (*p13).token, (*p14).token,
				(*p15).token, (*p16).token, (*p17).token, (*p18).token, (*p19).token,
				(*p20).token, (*p21).token, (*p22).token, (*p23).token, (*p24).token,
				(*p25).token, (*p26).token, (*p27).token, (*p28).token);


		}
		else
			osl_Error("CreatePlayer() error: incorrect number of parametres");
	}
	else if(first.token == "createpowerup")
	{
		if(param_count == 4)
		{
			vector<OSL_LEXEM>::iterator p1 = list->begin()+2;
			vector<OSL_LEXEM>::iterator p2 = list->begin()+4;
			vector<OSL_LEXEM>::iterator p3 = list->begin()+6;
			vector<OSL_LEXEM>::iterator p4 = list->begin()+8;

			CreatePowerup((*p1).token, (*p2).token, (*p3).token, (*p4).token);

		}
		else
			osl_Error("CreatePowerup() error: incorrect number of parametres");
	}
	else if(first.token == "createenemy")
	{
		if(param_count == 3)
		{
			vector<OSL_LEXEM>::iterator p1 = list->begin()+2;
			vector<OSL_LEXEM>::iterator p2 = list->begin()+4;
			vector<OSL_LEXEM>::iterator p3 = list->begin()+6;

			CreateEnemy((*p1).token, (*p2).token, (*p3).token);
		}
		else
			osl_Error("CreateEnemy() error: incorrect number of parametres");
	}
	else
		osl_Error("Command is not implemented yet");

	return _result;

}