Commit f78c0192 authored by Gerhard Stein's avatar Gerhard Stein

prepared a bit of good and frame for the gameplay of galaxy maps

parent ca9b1b3e
......@@ -489,7 +489,6 @@ void CMap::animateAllTiles()
}
p_front_tile++;
if( draw && x >= m_mapx && y >= m_mapy &&
x < m_mapx + num_v_tiles && y < m_mapy + num_h_tiles )
{
......
......@@ -107,7 +107,7 @@ private:
Uint8 m_animtiletimer;
CPlane m_Plane[2];
CPlane m_Plane[3];
bool m_Background; // This variable holds, whether we have a background to draw or not.
};
......
......@@ -102,12 +102,7 @@ void CMapLoaderGalaxy::unpackPlaneData(std::ifstream &MapFile,
}
}
if( derlesize/2 == Plane.size() )
{
}
else
if( derlesize/2 != Plane.size() )
{
g_pLogFile->textOut( "\nERROR Plane Uncompress RLE Size Failed: Actual "+ itoa(2*Plane.size()) +" bytes Expected " + itoa(derlesize) + " bytes<br>");
}
......@@ -207,12 +202,18 @@ bool CMapLoaderGalaxy::loadMap(CMap &Map, Uint8 level)
Map.m_height = Height;
Map.createEmptyDataPlane(0, Width*Height);
Map.createEmptyDataPlane(1, Width*Height);
Map.createEmptyDataPlane(2, Width*Height);
unpackPlaneData(MapFile, Map, 0, Plane_Offset[0], Plane_Length[0], magic_word);
unpackPlaneData(MapFile, Map, 1, Plane_Offset[1], Plane_Length[1], magic_word);
//unpackPlaneData(MapFile, Map, 2, Plane_Offset[2], Plane_Length[2], magic_word);
unpackPlaneData(MapFile, Map, 2, Plane_Offset[2], Plane_Length[2], magic_word);
}
MapFile.close();
// Now that we have all the 3 planes (Background, Foreground, Foes) unpacked...
// We only will show the first two of them in the screen, because the Foes one
// is the one which will be used for spawning the foes (Keen, platforms, enemies, etc.)
spawnFoes(Map);
}
else
{
......@@ -238,6 +239,63 @@ bool CMapLoaderGalaxy::loadMap(CMap &Map, Uint8 level)
return true;
}
/**
* @brief This will setup the enemies on the map. They are pushed in a objects vector,
* so they can interact all the time
*/
void CMapLoaderGalaxy::spawnFoes(CMap &Map)
{
word *start_data = Map.getData(2);
word *data_ptr;
word width = Map.m_width;
word height = Map.m_height;
/*std::ofstream file("foe.txt");
data_ptr = start_data;
for(size_t y=0 ; y<height ; y++)
{
for(size_t x=0 ; x<width ; x++)
{
file << (*data_ptr);
file << " ";
data_ptr++;
}
file << std::endl;
}
file.close();*/
// he we go to the adding objects
data_ptr = start_data;
for(size_t y=0 ; y<height ; y++)
{
for(size_t x=0 ; x<width ; x++)
{
addFoe(*data_ptr, x, y);
data_ptr++;
}
}
}
/**
* @brief Loads a foe given by the coordiantes
*/
void CMapLoaderGalaxy::addFoe(word foe, size_t x, size_t y)
{
//x <<= CSF;
//y <<= CSF;
switch(foe)
{
case 3:
// This is the player on map
// Spawn this player.
break;
default:
break;
}
}
CMapLoaderGalaxy::~CMapLoaderGalaxy()
{
// TODO Auto-generated destructor stub
......
......@@ -22,6 +22,8 @@ public:
size_t getMapheadOffset();
bool gotoSignature(std::ifstream &MapFile);
bool loadMap(CMap &Map, Uint8 level);
void spawnFoes(CMap &Map);
void addFoe(word foe, size_t x, size_t y);
virtual ~CMapLoaderGalaxy();
private:
......
......@@ -24,7 +24,7 @@ m_posy(0)
{}
bool CPlayGameGalaxy::loadGameState()
{return false;}
{ return false; }
// Setup for the ingame
bool CPlayGameGalaxy::init()
......@@ -38,7 +38,7 @@ 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 process for this
// TODO: Lets load the main map for now and create a process for this
CMapLoaderGalaxy MapLoader(m_ExeFile);
m_Map.setScrollSurface(g_pVideoDriver->getScrollSurface());
......
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