Commit 99d95931 authored by Gerhard Stein's avatar Gerhard Stein

added level play files to the galaxy engine

parent 6b4b16d5
/*
* CLevelPlay.cpp
*
* Created on: 06.08.2010
* Author: gerstrong
*/
#include "CLevelPlay.h"
#include "CMapLoaderGalaxy.h"
#include "sdl/CInput.h"
#include "sdl/CVideoDriver.h"
namespace galaxy {
CLevelPlay::CLevelPlay(CExeFile &ExeFile) :
m_active(false),
m_ExeFile(ExeFile)
{ }
bool CLevelPlay::isActive()
{ return m_active; }
void CLevelPlay::setActive(bool value)
{ m_active = value; }
bool CLevelPlay::loadLevel(Uint16 level)
{
// Load the World map level.
CMapLoaderGalaxy MapLoader(m_ExeFile, m_ObjectPtr);
m_Map.setScrollSurface(g_pVideoDriver->getScrollSurface());
MapLoader.loadMap(m_Map, level);
m_Map.drawAll();
return true;
}
void CLevelPlay::process()
{
// Animate the tiles of the map
m_Map.animateAllTiles();
for(size_t i=0 ; i<m_ObjectPtr.size() ; i++)
{
CObject* p_Object = m_ObjectPtr[i];
p_Object->process();
}
g_pVideoDriver->blitScrollSurface();
for( std::vector<CObject*>::iterator obj=m_ObjectPtr.begin() ;
obj!=m_ObjectPtr.end() ; obj++ )
{
(*obj)->draw();
}
}
CLevelPlay::~CLevelPlay() {
// TODO Auto-generated destructor stub
}
}
/*
* CLevelPlay.h
*
* Created on: 06.08.2010
* Author: gerstrong
*
* This class will manage the entire gameplay in one level
*/
#ifndef CLEVELPLAY_H_
#define CLEVELPLAY_H_
#include "common/CObject.h"
#include "fileio/CExeFile.h"
#include <vector>
namespace galaxy {
class CLevelPlay {
public:
CLevelPlay(CExeFile &ExeFile);
bool isActive();
void setActive(bool value);
bool loadLevel(Uint16 level);
void process();
virtual ~CLevelPlay();
private:
std::vector<CObject*> m_ObjectPtr;
bool m_active;
CMap m_Map;
CExeFile &m_ExeFile;
};
}
#endif /* CLEVELPLAY_H_ */
......@@ -21,6 +21,7 @@ CPlayGameGalaxy::CPlayGameGalaxy(CExeFile &ExeFile, char level,
stOption *p_option, CSavedGame &SavedGame) :
CPlayGame(ExeFile, level, numplayers, difficulty, p_option),
m_WorldMap(ExeFile),
m_LevelPlay(ExeFile),
mp_Menu(NULL),
m_SavedGame(SavedGame)
{
......@@ -33,25 +34,11 @@ bool CPlayGameGalaxy::loadGameState()
// Setup for the ingame
bool CPlayGameGalaxy::init()
{
loadLevel();
m_WorldMap.setActive(true);
return false;
}
void CPlayGameGalaxy::loadLevel()
{
// Load the Level map. We have two modes. Inlevel and game map
// TODO: Lets load the main map for now and create a process for this
//CMapLoaderGalaxy MapLoader(m_ExeFile);
//m_Map.setScrollSurface(g_pVideoDriver->getScrollSurface());
//MapLoader.loadMap(m_Map,0); // Map Level?
//m_Map.drawAll();
}
/**
* The main ingame process cycle when keen galaxy is up and running
*/
......@@ -81,13 +68,14 @@ void CPlayGameGalaxy::process()
// process World Map if active. At the start it's enabled
if(m_WorldMap.isActive())
{
Uint8 new_level;
m_WorldMap.process();
}
// process World Map if active. At the start it's enabled
//if(m_LevelPlay.isActive())
//m_LevelPlay.process();
if(m_LevelPlay.isActive())
{
m_LevelPlay.process();
}
// process Page if one is open. Could be one of the finale scenes
//if(m_Page.isActive())
......@@ -104,12 +92,14 @@ void CPlayGameGalaxy::process()
{
Uint16 Data;
EventContainer.ReadData(Data);
//m_WorldMap.setActive(false);
//m_WorldMap.finishLevel(object);
// Start a new level!
EventContainer.pop_Event();
m_WorldMap.setActive(false);
// Start a new level!
m_LevelPlay.loadLevel(Data-0xC000);
m_LevelPlay.setActive(true);
EventContainer.add(EXIT_LEVEL, Data);
//EventContainer.add(EXIT_LEVEL, Data);
}
}
......
......@@ -8,9 +8,10 @@
#ifndef CPLAYGAMEGALAXY_H_
#define CPLAYGAMEGALAXY_H_
#include "../playgame/CPlayGame.h"
#include "../../common/CMap.h"
#include "engine/playgame/CPlayGame.h"
#include "common/CMap.h"
#include "CWorldMap.h"
#include "CLevelPlay.h"
#include "CMenuGalaxy.h"
#include <vector>
......@@ -25,7 +26,6 @@ public:
stOption *p_option, CSavedGame &SavedGame);
bool loadGameState();
void loadLevel();
bool init();
void process();
......@@ -39,6 +39,7 @@ public:
private:
CWorldMap m_WorldMap;
CLevelPlay m_LevelPlay;
CMenuGalaxy *mp_Menu;
CSavedGame &m_SavedGame;
CBitmap m_BackgroundBitmap;
......
......@@ -15,8 +15,7 @@ namespace galaxy {
CWorldMap::CWorldMap(CExeFile &ExeFile):
m_active(false),
m_ExeFile(ExeFile),
m_newLevel(false)
m_ExeFile(ExeFile)
{}
bool CWorldMap::isActive()
......
......@@ -10,8 +10,8 @@
#ifndef CWORLDMAP_H_
#define CWORLDMAP_H_
#include "../../common/CObject.h"
#include "../../fileio/CExeFile.h"
#include "common/CObject.h"
#include "fileio/CExeFile.h"
#include <vector>
namespace galaxy {
......@@ -32,13 +32,7 @@ private:
bool m_active;
CMap m_Map;
Uint32 m_posx;
Uint32 m_posy;
CExeFile &m_ExeFile;
bool m_newLevel;
};
}
......
/*
* CPlayerLevel.cpp
*
* Created on: 06.08.2010
* Author: gerstrong
*/
#include "CPlayerLevel.h"
namespace galaxy {
CPlayerLevel::CPlayerLevel() {
// TODO Auto-generated constructor stub
}
CPlayerLevel::~CPlayerLevel() {
// TODO Auto-generated destructor stub
}
}
/*
* CPlayerLevel.h
*
* Created on: 06.08.2010
* Author: gerstrong
*/
#ifndef CPLAYERLEVEL_H_
#define CPLAYERLEVEL_H_
namespace galaxy {
class CPlayerLevel {
public:
CPlayerLevel();
virtual ~CPlayerLevel();
};
}
#endif /* CPLAYERLEVEL_H_ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment