//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
tStartLineTacticalWidget::tStartLineTacticalWidget( tRacePanelSettings* pRacePanelSettings, QWidget* pParent )
    : QWidget( pParent )
    , m_pLayout( 0 )
    , m_pBiasGauge( 0 )
    , m_pBiasAdvGauge( 0 )
    , m_pBiasAdvBLGauge( 0 )
    , m_pRaceTimerGauge( 0 )
    , m_pDistPGauge( 0 )
    , m_pDistSGauge( 0 )
    , m_pDistBehindLineGauge( 0 )
    , m_pDistBehindLineBLGauge( 0 )
    , m_pMapWidget( 0 )
    , m_pTideArrow( 0 )
    , m_TackGybeInfo()
    , m_TargetSpeed( 0.0f )
    , m_pRacePanelSettings( pRacePanelSettings )
{
    m_pLayout = new QGridLayout( this );
    m_pLayout->setSpacing( 0 );
    m_pLayout->setContentsMargins( 0, 0, 0, 0 );

    m_pMapWidget = new tStartLineMapWidget( this );
    m_pLayout->addWidget( m_pMapWidget, 0, 0, 3, 3 );

    CreateGauges();
    if( m_pRacePanelSettings )
    {
        m_pMapWidget->SetDrawGrid( m_pRacePanelSettings->DrawGrid() );
        Connect( m_pRacePanelSettings, SIGNAL( DrawGridChanged( bool ) ), m_pMapWidget, SLOT( SetDrawGrid( bool ) ) );
        Connect( m_pRacePanelSettings, SIGNAL( UseBoatLengthsChanged( bool ) ), this, SLOT( OnUseBoatLengthsChanged( bool ) ) );
        OnUseBoatLengthsChanged( m_pRacePanelSettings->UseBoatLengths() );
    }

    m_pTideArrow = new tTideArrowWidget( 0, this );
    m_pTideArrow->SetColor( QColor( 0, 127, 255 ) );
    m_pTideArrow->hide();

    QTimer* pTackGybeUpdateTimer = new QTimer( this );
    Connect( pTackGybeUpdateTimer, SIGNAL( timeout() ), this, SLOT( UpdateTackGybeAngles() ) );
    pTackGybeUpdateTimer->start( 2000 );
    UpdateTackGybeAngles();

    QTimer* pUpdateTimer = new QTimer( this );
    Connect( pUpdateTimer, SIGNAL( timeout() ), this, SLOT( UpdateMap() ) );
    Connect( pUpdateTimer, SIGNAL( timeout() ), this, SLOT( UpdateTideArrow() ) );
    pUpdateTimer->start( 200 );
    UpdateMap();
}
Exemple #2
0
BOOL CxpGbaDlg::OnInitDialog() 
{
	ASSERT(mpDib);
	
	int nclrs= dib_get_nclrs(mpDib);
	if(nclrs > 0 && mPalStart+mPalCount>nclrs)
	{
		mPalStart= 0;
		mPalCount= nclrs;
	}
	if(moAreaSize != 0)
	{
		mAreaLeft= 0;	mAreaWidth= dib_get_width(mpDib);
		mAreaTop=0;		mAreaHeight= dib_get_height(mpDib);
	}
	if(mbSymChk == FALSE)
		mSymName= mDstTitle;

	CDialog::OnInitDialog();
	OnPalChk();
	OnGfxChk();
	OnMapChk();
	UpdateObj();
	UpdateMap();
	UpdateArea();

	GetDlgItem(IDC_VAR_NAME)->EnableWindow(mbSymChk);

	//UpdateSummary();

	return TRUE;
}
Exemple #3
0
void CxpGbaDlg::OnSelendokGfxMode() 
{
	UpdateData(TRUE);
	UpdateGfx();
	UpdateObj();
	UpdateMap();
}
void ProjectPowers(vec_zz_p& x, const vec_zz_p& a, long k,
                   const zz_pXArgument& H, const zz_pXModulus& F)

{
   long n = F.n;

   if (a.length() > n || k < 0 || NTL_OVERFLOW(k, 1, 0))
      Error("ProjectPowers: bad args");

   long m = H.H.length()-1;
   long l = (k+m-1)/m - 1;

   zz_pXMultiplier M;
   build(M, H.H[m], F);

   vec_zz_p s(INIT_SIZE, n);
   s = a;
   StripZeroes(s);

   x.SetLength(k);

   for (long i = 0; i <= l; i++) {
      long m1 = min(m, k-i*m);
      zz_p* w = &x[i*m];
      for (long j = 0; j < m1; j++)
         InnerProduct(w[j], H.H[j].rep, s);
      if (i < l)
         UpdateMap(s, s, M, F);
   }
}
void Selector::Update(ISelectable *p)
{
	ScopedLock lock = ScopedLock(&m_mutex);
	m_modified = true;
	UpdateMap(p->GetFD(this));
	WakeUp();
}
void MinPolyMod(zz_pX& hh, const zz_pX& g, const zz_pXModulus& F, long m)
{
   zz_pX h, h1;
   long n = F.n;
   if (m < 1 || m > n) Error("MinPoly: bad args");

   /* probabilistically compute min-poly */

   ProbMinPolyMod(h, g, F, m);
   if (deg(h) == m) { hh = h; return; }
   CompMod(h1, h, g, F);
   if (IsZero(h1)) { hh = h; return; }

   /* not completely successful...must iterate */

   long i;

   zz_pX h2, h3;
   zz_pXMultiplier H1;
   vec_zz_p R(INIT_SIZE, n);

   for (;;) {
      R.SetLength(n);
      for (i = 0; i < n; i++) random(R[i]);
      build(H1, h1, F);
      UpdateMap(R, R, H1, F);
      DoMinPolyMod(h2, g, F, m-deg(h), R);

      mul(h, h, h2);
      if (deg(h) == m) { hh = h; return; }
      CompMod(h3, h2, g, F);
      MulMod(h1, h3, H1, F);
      if (IsZero(h1)) { hh = h; return; }
   }
}
Exemple #7
0
//---------------------------------------------------------------------------
void __fastcall TMapAreaDialog::ScaleYUpDownChangingEx(TObject *Sender,
      bool &AllowChange, short NewValue, TUpDownDirection Direction)
{
	AnsiString s;
	double scale=str2dbl(ScaleY->Text);
	if (Direction==updUp) scale+=0.0005; else scale-=0.0005;
	ScaleY->Text=s.sprintf("%.5f",scale);
	UpdateMap();
}
Exemple #8
0
//---------------------------------------------------------------------------
void __fastcall TMapAreaDialog::LonUpDownChangingEx(TObject *Sender,
      bool &AllowChange, short NewValue, TUpDownDirection Direction)
{
	AnsiString s;
	double lon=str2dbl(Lon->Text);
	if (Direction==updUp) lon+=0.000005; else lon-=0.000005;
	Lon->Text=s.sprintf("%.7f",lon);
	UpdateMap();
}
Exemple #9
0
void ACityMapMeshHolder::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
  Super::PostEditChangeProperty(PropertyChangedEvent);
  if (PropertyChangedEvent.Property) {
    ResetInstantiators();
    UpdateMapScale();
    UpdateMap();
  }
}
Exemple #10
0
void CGameDlg::OnClickedBtnRearrange()
{
	if(!mute)
	m_nSound.ButtonClick();
	if(m_bPause == true || Score < 10) return;
	Score -= 10;
	ShowScore();
	m_GameC.ResetMap();
	UpdateMap();
}
Exemple #11
0
//---------------------------------------------------------------------------
void __fastcall TMapAreaDialog::BtnCenterClick(TObject *Sender)
{
	AnsiString s;
	double rr[3],pos[3];
	if (!Plot->GetCenterPos(rr)) return;
	ecef2pos(rr,pos);
	Lat->Text=s.sprintf("%.7f",pos[0]*R2D);
	Lon->Text=s.sprintf("%.7f",pos[1]*R2D);
	UpdateMap();
}
Exemple #12
0
void ACityMapMeshHolder::OnConstruction(const FTransform &Transform)
{
  Super::OnConstruction(Transform);

  if (MeshInstatiators.Num() == 0) {
    ResetInstantiators();
    UpdateMapScale();
    UpdateMap();
  }
}
void Selector::Add(ISelectable *p)
{
	int fd = p->GetFD(this);
	if (fd < 0 || fd >= FD_SETSIZE)
		abort(); //Invalid FD this is a bug
	if (m_map.find(fd) != m_map.end())
		abort(); //Duplicate FD?

	ScopedLock lock = ScopedLock(&m_mutex);

	m_modified = true;
	m_map[fd] = p;
	UpdateMap(fd);
	FindHighestFD();
	WakeUp();
}
Exemple #14
0
void CGameDlg::OnBnClickedBtnStart()
{
	if(!mute)
	m_nSound.ButtonClick();
	m_nSound.InGameBGM();
	m_GameProgress.SetRange(0,SetTime);
	m_GameProgress.SetStep(-1);
	m_GameProgress.SetPos(300);
	SetTimer(PLAY_TIMER_ID, 1000,NULL);
	ShowScore();
	DrawGameTime();
	GetDlgItem(IDC_BTN_START)->EnableWindow(m_bPlaying);
	m_bPlaying = true;
	m_bPause = false;
	m_GameC.StartGame();
	UpdateMap();
}
Exemple #15
0
void LevelEditor::UpdateItemList()
{
	ItemList.Clear();

	int row = LayerList.GetCurrentRow();
	if (row < 0) return;

	Layer& lay = _level->GetLayers()[row];

	for (int i = 0; i < lay.GetRooms().GetCount(); ++i)
	{
		ItemList.Add(i, lay.GetRooms()[i].GetName());
	}

	if (ItemList.GetRowCount())
		ItemList.SetCursor(0);

	OnItemSelect();
	UpdateMap(ItemList.GetRowCount() > 0);
}
Exemple #16
0
void CGameDlg::OnBnClickedBtnPrompt()
{
	if(!mute)
	m_nSound.ButtonClick();
	if(m_bPlaying == false || m_bPause == true || Score < 5) return;

	Score -= 5;
	ShowScore();
	Vertex avsPath[MAX_SAVED_VERTEX_NUM];
	int n_vex;
	bool bSuc = m_GameC.Help(avsPath,n_vex);
	if(bSuc)
	{
		DrawTipFrame(avsPath[0].row,avsPath[0].col);
		DrawTipFrame(avsPath[n_vex-1].row,avsPath[n_vex-1].col);
		DrawTipLine(avsPath,n_vex);
	}
		UpdateMap();
		Sleep(200);
		InvalidateRect(m_rtGameRect,FALSE);

}
Exemple #17
0
/**
*@brief Draws the main game
*/
int StateGame()
{
		SDL_RenderClear(GetRenderer());	
		SDL_SetRenderTarget(GetRenderer(),game->mainSceneTexture);
		SDL_RenderClear(GetRenderer());
		SDL_SetRenderTarget(GetRenderer(),NULL);
		DrawMap(1,game->camera->x,game->camera->y,game->mainSceneTexture);
		DrawMap(2,game->camera->x,game->camera->y,game->mainSceneTexture);
		DrawMap(3,game->camera->x,game->camera->y,game->mainSceneTexture);
		DrawMap(0,0,0,game->mainSceneTexture);
		ThinkEntities();
		UpdateMap();
		UpdateEntities();
		DrawEntities();
		DrawMainScene();
		DrawSpecialLayer(map);
		UpdateGUI();
		SetCamera(*game->camera,hotBox);
		if(playerEnt->room->script != NULL)
			RunScript(playerEnt->room->script);
		NextFrame();
	return 0;
}
Exemple #18
0
void CGameDlg::OnBnClickedBtnPause()
{
	if(!mute)
	m_nSound.ButtonClick();
	if (!m_bPlaying)
		return;
	if (m_bPause)
	{
		m_bPause = false;
		UpdateMap();
		CWnd* pButton = GetDlgItem(IDC_BTN_PAUSE);
		pButton->SetWindowTextW(TEXT("Pause"));
	}
	else
	{
		m_bPause = true;
		m_dcMem.BitBlt(MAP_LEFT,MAP_TOP,m_ptGameEnd.x,m_ptGameEnd.y, &m_dcPauseMask, 0, 0 , SRCPAINT);
		m_dcMem.BitBlt(MAP_LEFT,MAP_TOP,m_ptGameEnd.x,m_ptGameEnd.y, &m_dcPause, 0,0, SRCAND);
		
		InvalidateRect(m_rtGameRect, FALSE);
		CWnd* pButton = GetDlgItem(IDC_BTN_PAUSE);
		pButton->SetWindowTextW(TEXT("Continue"));
	}
}
Exemple #19
0
//---------------------------------------------------------------------------
void __fastcall TMapAreaDialog::BtnUpdateClick(TObject *Sender)
{
	UpdateMap();
}
Exemple #20
0
void CGameDlg::OnLButtonUp(UINT nFlags, CPoint point)
{
	if(point.y<m_ptGameTop.y || point.x<m_ptGameTop.x || !m_bPlaying || m_bPause)
	{
		CDialogEx::OnLButtonUp(nFlags, point);
	}
	else{
	if(!m_GameC.IsWin())
	{
	int nRow = (point.y-m_ptGameTop.y)/m_sizeElem.cy;
	int nCol = (point.x-m_ptGameTop.x)/m_sizeElem.cx;
	
	if( m_GameC.GetElement(nRow,nCol)!=BLANK && nRow < SetRow && nCol < SetCol)
	{
		if(m_bFirstPoint) //the First Point
		{
			m_bFirstPoint = false;
			DrawTipFrame(nRow,nCol);
			m_GameC.SetFirstPoint(nRow,nCol);
			if(!mute)
			m_nSound.Select();
		}
		else              //the Second Point
		{
			m_bFirstPoint = true;
			DrawTipFrame(nRow,nCol);
			m_GameC.SetSecPoint(nRow,nCol);
			Vertex avPath[MAX_SAVED_VERTEX_NUM];
			if(!mute)
			m_nSound.Select();
			if(m_GameC.Link(avPath,vex))
			{
				DrawTipLine(avPath,vex);
				if(!mute)
				m_nSound.Erase();
				Score+=10;

				ShowScore();
				if(!m_combo)
				{
					m_combo_check1 = m_GameProgress.GetPos();
					m_combo = true;
				}
				else if(m_combo)
				{
					m_combo_check2 = m_GameProgress.GetPos();
					m_combo = false;
				}
				int firsttime,lasttime;
				(m_combo_check1 > m_combo_check2)?  (firsttime = m_combo_check1, lasttime = m_combo_check2) : (firsttime = m_combo_check2, lasttime = m_combo_check1);
				if(firsttime - lasttime < 3)
				{
					Output_combo = true;
					TotalCombo += 1;
					ComboScore += 5;
					Score +=ComboScore;
					ShowScore();	
				}
				else
				{
					ComboScore = 0;	
				}
							
			}
		
		UpdateMap();
		if(Output_combo)
		{
			Combo();
			Output_combo = false;
		}
		Sleep(200);
		InvalidateRect(m_rtGameRect,FALSE);
		
		}
	}
	}
	else
	{
		if(!mute){
		m_nSound.Stop();
		m_nSound.Win();
		}
		m_bPlaying = false;
		int Lefttime = m_GameProgress.GetPos() ;
		TimeBonus =  (double)Score*((double)Lefttime/300);
		CGameResult result;
		result.TotalScore = Score+TimeBonus;
		result.TotalCombo = TotalCombo;
		result.TimeBonus = TimeBonus;
		result.DoModal();


	}
	}
	
}
Exemple #21
0
void CxpGbaDlg::OnMapChk() 
{
	UpdateData(TRUE);
	UpdateMap();
}
Exemple #22
0
void CxpGbaDlg::OnTilesetChk() 
{
	UpdateData(TRUE);
	UpdateMap();
}
void Selector::Run()
{
	while(m_loop)
	{
		struct timespec timeout;
		fd_set freads = m_freads;
		fd_set fwrites = m_fwrites;
		fd_set fexcept = m_fexcept;
		CalcTimeout(&timeout);
		int ret = pselect(m_maxfd + 1, &freads, &fwrites, &fexcept, &timeout, NULL);
		if (ret < 0)
		{
			switch(errno)
			{
				case EINTR:
					continue;
					break;
				case EBADF: /* It is possible to have a bad fd inside the set because it just changed after read took a copy of the set */
					m_err_ebadf++;
					continue;
					break;
				default:
					abort();
					break;
			}
		}

		do {
			ScopedLock lock = ScopedLock(&m_mutex);
			m_modified = false;
			//Check fd_set's
			for(std::map<int, ISelectable *>::iterator it = m_map.begin(); it != m_map.end(); it++)
			{
				int fd = it->first;
				bool work = false;
				if (FD_ISSET(fd, &freads))
				{
					it->second->DoRead(this);
					if (m_modified)
						goto skip_to_end;
					work = true;
				}
				if (FD_ISSET(fd, &fwrites))
				{
					it->second->DoWrite(this);
					if (m_modified)
						goto skip_to_end;
					work = true;
				}
				if (FD_ISSET(fd, &fexcept))
				{
					it->second->DoExcept(this);
					if (m_modified)
						goto skip_to_end;
					work = true;
				}

				if (work)
					UpdateMap(fd);
			}
					
			struct timespec now;
			if (clock_gettime(CLOCK_MONOTONIC, &now) < 0)
				abort();

			for(std::map<int, struct timespec>::iterator it = m_timeout.begin(); it != m_timeout.end(); it++)
			{
				if (Time::IsLess(&it->second, &now))
				{
					m_map[it->first]->DoTimeout(this);
					if (m_modified)
						goto skip_to_end;
					UpdateMap(it->first);
				}
			}

		} while(0);
skip_to_end:
		ReadControl();
	}
}
Exemple #24
0
//---------------------------------------------------------------------------
void __fastcall TMapAreaDialog::ScaleEqClick(TObject *Sender)
{
	UpdateMap();
	UpdateEnable();
}
Exemple #25
0
void World::Update() {
	//create and zero the buffer
	SerialPacket* packetBuffer = reinterpret_cast<SerialPacket*>(new char[MAX_PACKET_SIZE]);
	memset(packetBuffer, 0, MAX_PACKET_SIZE);

	try {
		//suck in and process all waiting packets
		while(network.Receive(packetBuffer)) {
			HandlePacket(packetBuffer);
		}
	}
	catch(fatal_error& e) {
		throw(e);
	}
	catch(std::exception& e) {
		std::cerr << "HandlePacket Error (" << (int)(reinterpret_cast<SerialPacket*>(packetBuffer)->type) << "): " << e.what() << std::endl;
	}

	//free the buffer
	delete reinterpret_cast<char*>(packetBuffer);

	//heartbeat system
	if (heartbeatUtility.CheckHeartBeat()) {
		//escape to the disconnect screen
		SendDisconnectRequest();
		SetSceneSignal(SceneSignal::DISCONNECTEDSCREEN);
		ConfigUtility::GetSingleton()["client.disconnectMessage"] = "Error: Lost connection to the server";
	}

	//update all entities
	for (auto& it : characterMap) {
		it.second.Update();
	}
	for (auto& it : creatureMap) {
		it.second.Update();
	}

	try {
		//update the map
		UpdateMap();
	}
	catch(fatal_error& e) {
		throw(e);
	}
	catch(std::exception& e) {
		std::cerr << "UpdateMap Error: " << e.what() << std::endl;
	}

	//skip the rest without a local character
	if (!localCharacter) {
		return;
	}

	//TODO: (0) regular query interval
	if (Clock::now() - queryTime > std::chrono::seconds(3)) {
		queryTime = Clock::now();
		//query the world state (room)
		CharacterPacket characterPacket;
		memset(&characterPacket, 0, MAX_PACKET_SIZE);
		characterPacket.type = SerialPacketType::QUERY_CHARACTER_EXISTS;
		characterPacket.roomIndex = roomIndex;
		network.SendTo(Channels::SERVER, &characterPacket);

		CreaturePacket creaturePacket;
		creaturePacket.type = SerialPacketType::QUERY_CREATURE_EXISTS;
		creaturePacket.roomIndex = roomIndex;
		network.SendTo(Channels::SERVER, &creaturePacket);

		BarrierPacket barrierPacket;
		barrierPacket.type = SerialPacketType::QUERY_BARRIER_EXISTS;
		barrierPacket.roomIndex = roomIndex;
		network.SendTo(Channels::SERVER, &barrierPacket);
	}

	//cull creatures
	for (std::map<int, BaseCreature>::iterator it = creatureMap.begin(); it != creatureMap.end(); /* */) {
		if ( (localCharacter->GetOrigin() - it->second.GetOrigin()).Length() > INFLUENCE_RADIUS) {
			creatureMap.erase(it++);
		}
		else {
			it++;
		}
	}

	//cull barriers
	barrierMgr.UnloadIf([&](std::pair<const int, BaseBarrier const&> barrierIt) -> bool {
		return (localCharacter->GetOrigin() - barrierIt.second.GetOrigin()).Length() > INFLUENCE_RADIUS;
	});

	//get the collidable boxes
	std::list<BoundingBox> boxList = GenerateCollisionGrid(localCharacter, tileSheet.GetTileW(), tileSheet.GetTileH());

	//process the collisions
	//BUG: Collisions not working
	if (localCharacter->ProcessCollisionGrid(boxList)) {
		localCharacter->CorrectSprite();
		SendLocalCharacterMovement();
	}

	//update the camera
	camera.x = localCharacter->GetOrigin().x - camera.marginX;
	camera.y = localCharacter->GetOrigin().y - camera.marginY;
}
Exemple #26
0
bool PlayGame(Map &map, ResourceManager &resourceManager, const unsigned int livesIn)
{
    bool nextMap(true), menu(true);

    SoundPlayer soundPlayer(alcGetCurrentContext());

    unsigned int lives(livesIn);
    unsigned int specialItemScoreRequired(1000);
    unsigned int score(0), changedScore(score);
    TextRenderer textRender(resourceManager.GetTexture("text.png"));

    std::vector<std::string> stringVec{"Score:", "0"};
    std::vector<std::string> livesVec{"Lives: ", std::to_string(lives)};

    textRender.AddTextVerticalAlign(stringVec, TextRenderer::Alignment::Right, TextRenderer::Alignment::Top, 20.0f);
    textRender.AddTextHorizontalAlign(livesVec, TextRenderer::Alignment::Right, TextRenderer::Alignment::Bottom, 20.0f);

    glm::mat4 view(glm::ortho(0.0f, 40.0f, 0.0f, 30.0f, 1.0f, -1.0f));
    std::vector<std::shared_ptr<VisibleObject>> objectVec;
    std::vector<Movement> movementVec;
    std::vector<std::shared_ptr<AI>> aiVec;
    std::vector<float> aiStateSwitchTimes;
    std::vector<DeadPlayers> deadPlayerVec;

    int level(0);
    int timesToChange(7);

    while(nextMap && !glfwWindowShouldClose(glfwGetCurrentContext()))
    {
        ++level;
        timesToChange = UpdateAiSwitchVec(aiStateSwitchTimes, timesToChange, level);
        bool playing = true;
        map.LoadNextMap();

        GetVecFullOfObjects(objectVec, map, resourceManager, aiVec);
        textRender.AddTextHorizontalAlign(livesVec, TextRenderer::Alignment::Right, TextRenderer::Alignment::Bottom, 20.0f);

        CollisionDetection collisionDetect;
        collisionDetect.AddPlayersAndEnemys(objectVec);
        map.HideSpecialObj();

        double currTime = glfwGetTime(), prevTime = glfwGetTime(),
                mapStartTime = glfwGetTime(), enemyKillFinish(0.0);

        while(playing && !glfwWindowShouldClose(glfwGetCurrentContext()))
        {

            glClear(GL_COLOR_BUFFER_BIT);

            if(AISwitchModes(aiVec, currTime - mapStartTime, aiStateSwitchTimes.back()))
            {
                soundPlayer.AddToPlay(*(resourceManager.GetSound("wolfhowl.ogg")));
                aiStateSwitchTimes.erase(aiStateSwitchTimes.end() - 1);
            }
            if(score >= specialItemScoreRequired)
                specialItemScoreRequired = UpdateSpecialItem(objectVec, map, specialItemScoreRequired, resourceManager);
            if(enemyKillFinish != 0.0)
            {
                if(currTime >= enemyKillFinish)
                {
                    UpdateEnemysDieStatus(objectVec, resourceManager);
                    enemyKillFinish = 0.0;
                }
            }
            if(!deadPlayerVec.empty())
            {
                for(auto player(deadPlayerVec.begin()); player != deadPlayerVec.end();)
                {
                    if((*player).timeEnemyShouldLive <= currTime)
                    {
                        (*player).player->SwitchDeathVao();
                        (*player).player->ResetToOriginalSquare();
                        player = deadPlayerVec.erase(player);
                    }
                    else
                        ++player;
                }
            }

            if(GetInput(movementVec, aiVec, map))
            {
                if(PauseMenu(resourceManager, menu))
                {
                    playing = false;
                    nextMap = false;
                    break;
                }
                glfwSetTime(currTime);
            }

            for(auto & obj : objectVec)
            {
                if(obj->GetPlayer() > 0)
                {
                    UpdatePlayerMovement(obj, movementVec, map, currTime - prevTime);
                    if(obj->GetPlayer() == 1)
                    {
                        if(UpdateMap(obj, objectVec, map, changedScore, soundPlayer, resourceManager))
                        {
                            if(enemyKillFinish == 0.0f)
                            {
                                enemyKillFinish = currTime;
                                UpdateEnemysDieStatus(objectVec, resourceManager);
                            }
                            currTime -= 5.0;
                            glfwSetTime(currTime);
                        }
                        if(score != changedScore)
                        {
                            UpdateScore(changedScore, textRender, stringVec);
                            score = changedScore;

                            if(map.HasFinished())
                            {
                                playing = false;
                                nextMap = true;
                            }
                        }
                    }
                }
                obj->Draw(view);
            }
            textRender.DrawAll();

            if(collisionDetect.DetectCollisions(lives, changedScore, deadPlayerVec, resourceManager, soundPlayer))
            {
                soundPlayer.AddToPlay(*(resourceManager.GetSound("death.ogg")));
                if(UpdateLives(lives, textRender, livesVec))
                {
                    playing = false;
                    nextMap = false;
                    UpdateHighscore(score, resourceManager);
                }
            }

            glfwSwapBuffers(glfwGetCurrentContext());
            glfwPollEvents();

            prevTime = currTime;
            currTime = glfwGetTime();
        }
    }
    if(glfwWindowShouldClose(glfwGetCurrentContext()))
        nextMap = false;

    return menu;
}
Exemple #27
0
//---------------------------------------------------------------------------
void __fastcall TMainForm::ShowTable(void)
{
	const char *ti[][18]={
		{"Mountpoint","ID","Format","Format-Details","Carrier","Nav-System",
		 "Network","Country","Latitude","Longitude","NMEA","Solution",
		 "Generator","Compr-Encrp","Authentication","Fee","Bitrate",""},
		{"Host","Port","ID","Operator","NMEA","Country","Latitude","Longitude",
		 "Fallback_Host","Fallback_Port","","","","","","","",""},
		{"ID","Operator","Authentication","Fee","Web-Net","Web-Str","Web-Reg",
		 "","","","","","","","","","",""}
	};
	TStringGrid *table[]={Table0,Table1,Table2};
	TMenuItem *menu[]={MenuViewStr,MenuViewCas,MenuViewNet,MenuViewSrc};
	char buff[MAXLINE],*p,*q,*r,*s;
	int i,j,n,ns,type;

	Table3->Visible=false; for (i=0;i<3;i++) table[i]->Visible=false;
	
	type=TypeStr->Down?0:(TypeCas->Down?1:(TypeNet->Down?2:3));
	for (i=0;i<4;i++) menu[i]->Checked=i==type;
	
	if (type==3) {
		Table3->Visible=true;
		Table3->Text="";
	}
	else {
		table[type]->Visible=true;
		table[type]->RowCount=2;
		for (i=0;i<18;i++) {
			table[type]->Cells[i][0]=ti[type][i];
			table[type]->Cells[i][1]="";
		}
	}
	if (AddrCaster!=Address->Text) return;
	if (type==3) {
		Table3->Text=SrcTable;
		return;
	}
	for (p=SrcTable.c_str(),ns=0;*p;p=q+1) {
		if (!(q=strchr(p,'\n'))) break;
		switch (type) {
			case 0: if (!strncmp(p,"STR",3)) ns++; break;
			case 1: if (!strncmp(p,"CAS",3)) ns++; break;
			case 2: if (!strncmp(p,"NET",3)) ns++; break;
		}
	}
	if (ns<=0) return;
	table[type]->RowCount=ns+1;
	for (p=SrcTable.c_str(),j=1;*p;p=q+1) {
		if (!(q=strchr(p,'\n'))) break;
		n=q-p<MAXLINE-1?q-p:MAXLINE-1;
		strncpy(buff,p,n); buff[n]='\0';
		switch (type) {
			case 0: if (!strncmp(buff,"STR",3)) break; else continue;
			case 1: if (!strncmp(buff,"CAS",3)) break; else continue;
			case 2: if (!strncmp(buff,"NET",3)) break; else continue;
		}
		for (i=0,r=buff;i<18&&*r;i++) {
			if ((s=strchr(r,';'))) {
				*s='\0'; if (i>0) table[type]->Cells[i-1][j]=r; r=s+1;
			}
			else {
				if (i>0) table[type]->Cells[i-1][j]=r;
				break;
			}
		}
		j++;
	}
	UpdateMap();
}
Exemple #28
0
//---------------------------------------------------------------------------
void __fastcall TMainForm::TimerTimer(TObject *Sender)
{
	if (!GoogleMapView->GetState()) return;
	UpdateMap();
	Timer->Enabled=false;
}
void LevelEditor::OnChangePoint()
{
	OnItemSelect();
	UpdateMap(true);
}