Commit 06bc5eb4 authored by Gerhard Stein's avatar Gerhard Stein

So, now BG and FG are drawn

parent 38bdbc93
......@@ -98,7 +98,7 @@ word *CMap::getData(Uint8 PlaneNum)
word *CMap::getForegroundData()
{
return m_Plane[0].getMapDataPtr();
return m_Plane[1].getMapDataPtr();
}
word *CMap::getBackgroundData()
......
......@@ -88,8 +88,7 @@ void CMapLoaderGalaxy::unpackPlaneData(std::ifstream &MapFile,
// Now use the RLE Decompression
CRLE RLE;
size_t derlesize = (RLE_Plane[0]<<8)+RLE_Plane[1]; // Bytes already swapped
//RLE.expand(Plane, RLE_Plane, magic_word);
RLE.expandSwapped(Plane, RLE_Plane, magic_word);
RLE.expand(Plane, RLE_Plane, magic_word);
RLE_Plane.clear();
word *ptr = Map.getData(PlaneNumber);
......@@ -207,18 +206,6 @@ bool CMapLoaderGalaxy::loadMap(CMap &Map, Uint8 level)
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);
FILE *fp = fopen("bumpplane1.bin","wb");
fwrite(Map.getData(0), 2, 8052/2, fp);
fclose(fp);
fp = fopen("bumpplane2.bin","wb");
fwrite(Map.getData(1), 2, 8052/2, fp);
fclose(fp);
fp = fopen("bumpplane3.bin","wb");
fwrite(Map.getData(2), 2, 8052/2, fp);
fclose(fp);
}
MapFile.close();
return true;
......
......@@ -11,6 +11,7 @@
#include "../../sdl/CVideoDriver.h"
#include "../../sdl/CInput.h"
#include "../../graphics/CGfxEngine.h"
#include "../../StringUtils.h"
namespace galaxy
{
......@@ -38,11 +39,8 @@ bool CPlayGameGalaxy::init()
MapLoader.loadMap(m_Map, 0); // Map Level?
m_Map.gotoPos(0, 0); // Coordinates of star sky
//m_Map.drawAll();
// We should create this as base and two more classes. One will be for ingame and the other for
// the map processes
m_Map.gotoPos(0, 0); // Coordinates of star sky
return false;
}
......@@ -91,7 +89,6 @@ void CPlayGameGalaxy::processInput()
if(m_posy<m_Map.m_height)
m_posy++;
}
}
void CPlayGameGalaxy::processRendering()
......@@ -102,12 +99,13 @@ void CPlayGameGalaxy::processRendering()
{
g_pGfxEngine->getTileMap(0).drawTile(g_pVideoDriver->getBlitSurface(),
16*x, 16*y, m_Map.at(m_posx+x,m_posy+y,0) );
g_pGfxEngine->getTileMap(1).drawTile(g_pVideoDriver->getBlitSurface(),
16*x, 16*y, m_Map.at(m_posx+x,m_posy+y,0) );
if(m_Map.at(m_posx+x,m_posy+y,1) != 0)
g_pGfxEngine->getTileMap(1).drawTile(g_pVideoDriver->getBlitSurface(),
16*x, 16*y, m_Map.at(m_posx+x,m_posy+y,1) );
}
}
g_pGfxEngine->getFont(0).drawFont(g_pVideoDriver->getBlitSurface(),"Press Esc to end", 10, 10);
g_pGfxEngine->getFont(0).drawFont(g_pVideoDriver->BlitSurface, "Press the arrows to scroll, ESC to quit", 10, 10);
}
......
......@@ -49,9 +49,10 @@ void CRLE::expandSwapped( std::vector<word>& dst, std::vector<byte>& src, word k
word value;
size_t inc;
finsize = (src.at(1)<<8) + src.at(0);
finsize = (src.at(1)<<8) | src.at(0);
finsize /= 2;
for(size_t i=WORDSIZE ; dst.size() < finsize ; i+=inc)
{
// Read datum (word)
......
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