Commit feb1a8aa authored by Gerhard Stein's avatar Gerhard Stein

Added new files for the gameplay on map of the galaxy engine

parent f78c0192
......@@ -9,6 +9,7 @@
#define OBJENUMS_H_
enum object_t{
// ** objects from KEEN1
OBJ_NONE,
OBJ_YORP,
......
......@@ -8,9 +8,8 @@
#include "CPlayGameGalaxy.h"
#include "CMapLoaderGalaxy.h"
#include "../../sdl/CVideoDriver.h"
#include "../../sdl/CInput.h"
#include "../../graphics/CGfxEngine.h"
#include "../../sdl/CVideoDriver.h"
#include "../../StringUtils.h"
namespace galaxy
......@@ -19,9 +18,10 @@ namespace galaxy
CPlayGameGalaxy::CPlayGameGalaxy(CExeFile &ExeFile, char level,
char numplayers, char difficulty, stOption *p_option) :
CPlayGame(ExeFile, level, numplayers, difficulty, p_option),
m_posx(0),
m_posy(0)
{}
m_WorldMap(ExeFile)
{
m_WorldMap.init();
}
bool CPlayGameGalaxy::loadGameState()
{ return false; }
......@@ -29,6 +29,7 @@ bool CPlayGameGalaxy::loadGameState()
// Setup for the ingame
bool CPlayGameGalaxy::init()
{
loadLevel();
return false;
......@@ -39,12 +40,12 @@ 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);
//CMapLoaderGalaxy MapLoader(m_ExeFile);
m_Map.setScrollSurface(g_pVideoDriver->getScrollSurface());
MapLoader.loadMap(m_Map, m_Level); // Map Level?
//m_Map.setScrollSurface(g_pVideoDriver->getScrollSurface());
//MapLoader.loadMap(m_Map,0); // Map Level?
m_Map.drawAll();
//m_Map.drawAll();
}
// The main ingame process cycle when keen galaxy is up and running
......@@ -56,8 +57,8 @@ void CPlayGameGalaxy::process()
processInput();
// process World Map if active. At the start it's enabled
//if(m_WorldMap.isActive())
//m_WorldMap.process();
if(m_WorldMap.isActive())
m_WorldMap.process();
// process World Map if active. At the start it's enabled
//if(m_LevelPlay.isActive())
......@@ -75,7 +76,7 @@ void CPlayGameGalaxy::processInput()
// TODO: wrap this into the camera class they way it can be used in the vorticons engine
// Also make it more efficient.
if(g_pInput->getPressedCommand(IC_QUIT))
/*if(g_pInput->getPressedCommand(IC_QUIT))
m_endgame = true;
if(g_pInput->getHoldedCommand(IC_LEFT))
......@@ -97,23 +98,11 @@ void CPlayGameGalaxy::processInput()
{
m_Map.scrollDown();
m_Map.scrollDown();
}
if(g_pInput->getPressedCommand(IC_STATUS))
{
if(m_Level < 20)
m_Level++;
else
m_Level = 0;
loadLevel();
}
}*/
}
void CPlayGameGalaxy::processRendering()
{
// Animate the tiles of the map
m_Map.animateAllTiles();
// Blit the background
g_pVideoDriver->blitScrollSurface();
......
......@@ -10,6 +10,8 @@
#include "../playgame/CPlayGame.h"
#include "../../common/CMap.h"
#include "CWorldMap.h"
#include <vector>
namespace galaxy
{
......@@ -35,10 +37,8 @@ public:
virtual ~CPlayGameGalaxy();
private:
CMap m_Map;
CWorldMap m_WorldMap;
Uint32 m_posx;
Uint32 m_posy;
};
}
......
/*
* CWorldMap.cpp
*
* Created on: 14.07.2010
* Author: gerstrong
*/
#include "CWorldMap.h"
#include "CMapLoaderGalaxy.h"
#include "../../sdl/CInput.h"
#include "../../sdl/CVideoDriver.h"
namespace galaxy {
CWorldMap::CWorldMap(CExeFile &ExeFile):
m_ExeFile(ExeFile)
{}
bool CWorldMap::isActive()
{ return m_active; }
void CWorldMap::setActive(bool value)
{ m_active = value; }
void CWorldMap::init()
{
// Load the World map level.
CMapLoaderGalaxy MapLoader(m_ExeFile);
m_Map.setScrollSurface(g_pVideoDriver->getScrollSurface());
MapLoader.loadMap(m_Map,0); // Map Level?
m_Map.drawAll();
}
void CWorldMap::process()
{
processInput();
// Animate the tiles of the map
m_Map.animateAllTiles();
}
void CWorldMap::processInput()
{
// TODO: wrap this into the camera class they way it can be used in the vorticons engine
// Also make it more efficient.
//if(g_pInput->getPressedCommand(IC_QUIT))
//m_endgame = true;
if(g_pInput->getHoldedCommand(IC_LEFT))
{
m_Map.scrollLeft();
m_Map.scrollLeft();
}
else if(g_pInput->getHoldedCommand(IC_RIGHT))
{
m_Map.scrollRight();
m_Map.scrollRight();
}
if(g_pInput->getHoldedCommand(IC_UP))
{
m_Map.scrollUp();
m_Map.scrollUp();
}
else if(g_pInput->getHoldedCommand(IC_DOWN))
{
m_Map.scrollDown();
m_Map.scrollDown();
}
}
CWorldMap::~CWorldMap() {
// TODO Auto-generated destructor stub
}
}
/*
* CWorldMap.h
*
* Created on: 14.07.2010
* Author: gerstrong
*/
#ifndef CWORLDMAP_H_
#define CWORLDMAP_H_
#include "../../common/CObject.h"
#include "../../fileio/CExeFile.h"
#include <vector>
namespace galaxy {
class CWorldMap {
public:
CWorldMap(CExeFile &ExeFile);
bool isActive();
void setActive(bool value);
void init();
void process();
void processInput();
virtual ~CWorldMap();
private:
std::vector<CObject*> m_ObjectPtr;
bool m_active;
CMap m_Map;
Uint32 m_posx;
Uint32 m_posy;
CExeFile &m_ExeFile;
};
}
#endif /* CWORLDMAP_H_ */
/*
* CPlayer.cpp
*
* Created on: 14.07.2010
* Author: gerstrong
*/
#include "CPlayerWM.h"
namespace galaxy {
CPlayerWM::CPlayerWM(CMap *pmap, Uint32 x, Uint32 y):
CObject(pmap, x, y, OBJ_PLAYER)
{
// TODO Auto-generated constructor stub
}
CPlayerWM::~CPlayerWM() {
// TODO Auto-generated destructor stub
}
}
/*
* CPlayer.h
*
* Created on: 14.07.2010
* Author: gerstrong
*/
#ifndef CPLAYERWM_H_
#define CPLAYERWM_H_
#include "../../../common/CObject.h"
namespace galaxy {
class CPlayerWM : public CObject {
public:
CPlayerWM(CMap *pmap, Uint32 x, Uint32 y);
virtual ~CPlayerWM();
};
}
#endif /* CPLAYERWM_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