//------------------------------------------------------------------------
void CGameRulesHoldObjectiveBase::OnActionEvent( const SActionEvent& event )
{
	switch(event.m_event)
	{
	case eAE_resetBegin:
		ClearEntities(0);
		break;
	}
}
Esempio n. 2
0
void NewGame(Game *game)
{
  game->level = 0;
  game->score = 0;
  game->NumZombies = 0;
  game->NumGraves = 0;
  game->NumVillagers = 0;  
  ClearEntities();
  InitEntityList();
  ResetAllParticles();
}
Esempio n. 3
0
void ECEditorWindow::AddEntities(const QList<entity_id_t> &entities, bool select_all)
{
    // SetEntitySelected() will block entity list's signals, no need to do it here.

    ClearEntities();
    foreach(entity_id_t id, entities)
    {
        EntityListWidgetItem *item = AddEntity(id, false);
        if (select_all)
            SetEntitySelected(item, true);
    }
Esempio n. 4
0
void ECEditorWindow::AddEntities(const EntityList &entities, bool selectAll)
{
    // SetEntitySelected() will block entity list's signals, no need to do it here.
    ClearEntities();

    foreach(const EntityPtr &entity, entities)
    {
        EntityListWidgetItem *item = AddEntity(entity, false);
        if (selectAll)
            SetEntitySelected(item, true, false);
    }
Esempio n. 5
0
///////////////////
// Initialize the entities
bool InitializeEntities(void)
{
    psEntities = new entity_t[MAX_ENTITIES];
    if( !psEntities )
        return false;

    // Clear the entities
    ClearEntities();

    // Load some textures
    psSpark = Cache_LoadTexture("data/textures/spark.png");
    Tex_Upload(psSpark);

    return true;
}
Esempio n. 6
0
void NewLevel(Game *game, int graves,int villagers)  /*sets up a new level*/
{
  int i;
  int j;
  int width;
  int height;
  int sx,sy;
  if(BgMusic != NULL)
  {
    Mix_HaltMusic();
    Mix_FreeMusic(BgMusic);
  }
  BgMusic = Mix_LoadMUS("sounds/ambiant02.ogg");
  if(BgMusic == NULL)
  {
    fprintf(stderr, "Unable to Load Background Music: %s\n", SDL_GetError());
    exit(1);
  }
  Mix_VolumeMusic(MIX_MAX_VOLUME);
  Mix_PlayMusic(BgMusic,-1);/*play my background music infinitely*/
  game->level++;
  width = (int)sqrt(graves);
  if(width == 0)width = 1;
  height = graves / width;
  sx = 14 - (width/2);
  sy = 12 - (height/2);
  game->NumGraves =0;
  game->NumVillagers = villagers;  
  game->NumZombies = 0;
  ClearEntities();  /*lets get rid of what we ain't usin*/
  InitEntityList();
  ResetAllParticles();
  for(i = 0;i < 16;i++)
    SpawnTree((((rand()>>8) % 15)*2),(((rand()>>8) % 10)*2)+2, 200);
  for(j = 0;j < height;j++)
  {
    for(i = 0;i < width;i++)
    {
      SpawnCenter((i*2) + sx,(j*2)+ sy, 1,(rand()>>8)%2);
      game->NumGraves++;
    }
  }
  UpdateEntities();
}
Esempio n. 7
0
void GameView::OnUpdate()
{
    if (m_gameover)
    {
        if (!m_fadeQuad->GetColorAnim().isPlaying())
        {
            // we are done
            SendCommand(seed::eAppCommand::SWITCH_VIEW, "GameOverView");
            return;
        }
        UpdateCamera();
        UpdateUIs();
        return;
    }
    else
    {
        if (!m_fadeQuad->GetColorAnim().isPlaying())
        {
            m_fadeQuad->SetVisible(false);
        }
    }

    UpdateTime();
    UpdateDanceSequence();
    UpdateMonsterSpawning();
    UpdateEntities();
    UpdateCamera();
    UpdateUIs();

    // check if we are game over
    if (AllPlayersAreDead())
    {
        OnGameOver();
    }

    ClearEntities();
}
Esempio n. 8
0
void DMap::LoadAll( bool bLoadPatches ){
	ClearEntities();

	GlobalSelectionSystem().setSelectedAll( false );

	class load_entities_t : public scene::Traversable::Walker
	{
	DMap* m_map;
	bool m_bLoadPatches;
public:
	load_entities_t( DMap* map, bool bLoadPatches )
		: m_map( map ), m_bLoadPatches( bLoadPatches ){
	}
	bool pre( scene::Node& node ) const {
		if ( Node_isEntity( node ) ) {
			DEntity* loadEntity = m_map->AddEntity( "", 0 );
			loadEntity->LoadFromEntity( node, m_bLoadPatches );
		}
		return false;
	}
	} load_entities( this, bLoadPatches );

	Node_getTraversable( GlobalSceneGraph().root() )->traverse( load_entities );
}
Esempio n. 9
0
void DMap::LoadAll( bool bLoadPatches ){
	ClearEntities();

	g_FuncTable.m_pfnDeselectAllBrushes();

	int count = g_FuncTable.m_pfnGetEntityCount();

	for ( int i = 0; i < count; i++ )
	{
		DEntity* loadEntity;

		if ( i == 0 ) {
			loadEntity = GetWorldSpawn();
		}
		else{
			loadEntity = AddEntity( "", m_nNextEntity++ );
		}

		if ( !loadEntity->LoadFromEntity( i, bLoadPatches ) ) {
			delete loadEntity;
			entityList.pop_back();
		}
	}
}
Esempio n. 10
0
void GameView::KillAllEntities()
{
    m_entitiesToKill = m_entities;
    ClearEntities();
}
Esempio n. 11
0
DMap::~DMap(){
	ClearEntities();
}
Esempio n. 12
0
void GamePlayingState::Exit(Game* a_game)
{
	ClearEntities();
	delete a_game->player;
	delete a_game->m_pWorld;
}