Commit b8935cfb authored by Gerhard Stein's avatar Gerhard Stein

fixe coordinate problem that made galaxy level crash when changing them

parent b2373f76
......@@ -32,8 +32,6 @@ m_Background(false)
////////////////////////////
// Initialization Routine //
////////////////////////////
void CMap::setScrollSurface( SDL_Surface *surface )
{ mp_scrollsurface = surface; }
......@@ -575,6 +573,12 @@ void CMap::registerAnimation(Uint32 x, Uint32 y, size_t bg, size_t fg)
}
}
void CMap::cleanup()
{
if(!m_AnimationSlots.empty())
m_AnimationSlots.clear();
}
CMap::~CMap() {
}
......
......@@ -63,6 +63,7 @@ public:
word *getForegroundData();
word *getBackgroundData();
void cleanup();
virtual ~CMap();
......
......@@ -124,6 +124,9 @@ void CMapLoaderGalaxy::unpackPlaneData(std::ifstream &MapFile,
bool CMapLoaderGalaxy::loadMap(CMap &Map, Uint8 level)
{
// Get the MAPHEAD Location from within the Exe File
Map.gotoPos(0,0);
size_t offset = getMapheadOffset();
byte *Maphead = m_ExeFile.getRawData() + offset;
word magic_word;
......
......@@ -41,12 +41,11 @@ void CPlayGameGalaxy::loadLevel()
// TODO: Lets load the main map for now and create process for this
CMapLoaderGalaxy MapLoader(m_ExeFile);
m_Map.cleanup();
m_Map.setScrollSurface(g_pVideoDriver->getScrollSurface());
MapLoader.loadMap(m_Map, m_Level); // Map Level?
m_Map.drawAll();
m_Map.gotoPos(0, 0); // Coordinates of star sky
}
// The main ingame process cycle when keen galaxy is up and running
......@@ -66,14 +65,25 @@ void CPlayGameGalaxy::processInput()
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();
}
if(g_pInput->getPressedCommand(IC_STATUS))
{
......
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