Commit 9cbcd410 authored by Gerhard Stein's avatar Gerhard Stein

changed a bit the tileloading code. It now belongs to the graphics loader

parent 99e42e6d
......@@ -213,18 +213,9 @@ bool CGameControl::loadResources(Uint8 flags)
if( (flags & LOADGFX) == LOADGFX )
{
// First, retrieve the Tile properties so the tilemap gets properly formatted
// Important especially for masks
// Load tile attributes.
CTileLoader TileLoader( m_Episode, version, p_exedata );
if( !TileLoader.load() )
{
g_pLogFile->textOut(RED, "CGameControl::loadResources: Could not load data for the tiles<br>");
return false;
}
// Decode the entire graphics for the game (EGALATCH, EGASPRIT, etc.)
if(m_EGAGraphics) delete m_EGAGraphics; // except for the first start of a game this always happens
// This will also read the Tile-Properties
SAFE_DELETE(m_EGAGraphics); // except for the first start of a game this always happens
m_EGAGraphics = new vorticon::CEGAGraphicsVort(m_Episode, m_DataDirectory);
if(!m_EGAGraphics) return false;
......
......@@ -46,7 +46,7 @@ void CPlayGameGalaxy::loadLevel()
MapLoader.loadMap(m_Map, m_Level); // Map Level?
//m_Map.drawAll();
m_Map.drawAll();
m_Map.gotoPos(0, 0); // Coordinates of star sky
}
......@@ -107,7 +107,7 @@ void CPlayGameGalaxy::processInput()
void CPlayGameGalaxy::processRendering()
{
for(size_t x=0 ; x<20 ; x++)
/*for(size_t x=0 ; x<20 ; x++)
{
for(size_t y=0 ; y<20 ; y++)
{
......@@ -117,7 +117,13 @@ void CPlayGameGalaxy::processRendering()
g_pGfxEngine->getTileMap(1).drawTile(g_pVideoDriver->getBlitSurface(),
16*x, 16*y, m_Map.at(m_posx+x,m_posy+y,1) );
}
}
}*/
// Animate the tiles of the map
m_Map.animateAllTiles();
// Blit the background
g_pVideoDriver->blitScrollSurface();
g_pGfxEngine->getFont(0).drawFont(g_pVideoDriver->BlitSurface, "Press the arrows to scroll, ESC to quit", 10, 10);
g_pGfxEngine->getFont(0).drawFont(g_pVideoDriver->BlitSurface, "Enter to switch Level", 10, 20);
......
......@@ -8,6 +8,7 @@
#include "CEGAGraphicsVort.h"
#include "../../sdl/CVideoDriver.h"
#include "../../fileio/CTileLoader.h"
#ifdef TARGET_WIN32
#include <dir.h>
......@@ -106,6 +107,13 @@ bool CEGAGraphicsVort::loadData( int version, unsigned char *p_exedata )
memcpy(&SpriteLocation,data+42,4);
memcpy(&compressed,data+46,4);
// First, retrieve the Tile properties so the tilemap gets properly formatted
// Important especially for masks, and later in the game for the behaviours
// of those objects
CTileLoader TileLoader( m_episode, version, p_exedata );
if(!TileLoader.load())
return false;
m_Latch = new CEGALatch(LatchPlaneSize,
BitmapTableStart,
FontTiles,
......
......@@ -12,14 +12,14 @@
#include <cstdlib>
#include <string>
CTileLoader::CTileLoader(int episode, int version, unsigned char *data) :
CTileLoader::CTileLoader(int episode, int version, size_t NumTiles, unsigned char *data) :
m_TileProperties(g_pBehaviorEngine->getTileProperties())
{
m_episode = episode;
m_version = version;
m_data = data;
m_offset = 0;
m_numtiles = 0;
m_numtiles = NumTiles;
}
bool CTileLoader::setProperOffset()
......@@ -29,7 +29,6 @@ bool CTileLoader::setProperOffset()
{
case 1:
{
m_numtiles = 611;
switch(m_version)
{
case 110: m_offset = 0x131F8; break;
......@@ -42,7 +41,6 @@ bool CTileLoader::setProperOffset()
}
case 2:
{
m_numtiles = 689;
switch(m_version)
{
case 100: m_offset = 0x17938; break;
......@@ -52,7 +50,6 @@ bool CTileLoader::setProperOffset()
}
case 3:
{
m_numtiles = 715;
switch(m_version)
{
case 100: m_offset = 0x199F8; break;
......
......@@ -13,7 +13,7 @@
class CTileLoader {
public:
CTileLoader(int episode, int version, unsigned char *data);
CTileLoader(int episode, int version, size_t NumTiles, unsigned char *data);
bool load();
......@@ -26,7 +26,7 @@ private:
int m_version;
long m_offset;
unsigned char *m_data;
int m_numtiles;
size_t m_numtiles;
std::vector<CTileProperties> &m_TileProperties;
......
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