Пример #1
0
// This function is used in your Ship need those parts.
// This special Messagebox can hold up to 4 images
void CMessageBoxVort::addTileAt(Uint16 tile, Uint16 x, Uint16 y)
{
	CTilemap &tilemap = g_pGfxEngine->getTileMap(1);

	const int tileDim = tilemap.getDimension();

	// now we'll create a new surface on which the Tile will be printed.
	SDL_Rect rect;
	rect.x = rect.y = 0;
	rect.w = rect.h = tileDim;
	SmartPointer<SDL_Surface> bmpSfc = CG_CreateRGBSurface(rect);

	SDL_FillRect(bmpSfc.get(), NULL, 0xFFFFFFFF);
	tilemap.drawTile(bmpSfc.get(), 0, 0, tile);

	rect.x = x;	rect.y = y;

	CRect<float> fRect( x, y, 16.0f, 16.0f);

	CRect<float> gameRect = g_pVideoDriver->getGameResolution();
	fRect.transformInverse(gameRect);
	fRect.transform(mRect);

	SmartPointer<CBitmap> pBitmap = new CBitmap(bmpSfc);

	addControl( new CGUIBitmap(pBitmap), fRect );
}
Пример #2
0
void CGUIDialog::initVorticonBackground()
{
    const SDL_Rect Rect = g_pVideoDriver->toBlitRect(mRect);
    mpBackgroundSfc.reset( CG_CreateRGBSurface( Rect ), &SDL_FreeSurface );
//#if SDL_VERSION_ATLEAST(2, 0, 0)
    //mpBackgroundSfc = mpBackgroundSfc;
//#else
    mpBackgroundSfc.reset( g_pVideoDriver->convertThroughBlitSfc( mpBackgroundSfc.get() ), &SDL_FreeSurface );
//#endif

	// Now lets draw the text of the list control
	CFont &Font = g_pGfxEngine->getFont(1);

	SDL_Surface *backSfc = mpBackgroundSfc.get();


	// Draw the character so the classical vorticon menu is drawn

	// Start with the blank space (normally it's white. Might be different in some mods)
	for( int x=8 ; x<Rect.w-8 ; x+=8 )
	{
		for( int y=8 ; y<Rect.h-8 ; y+=8 )
		{
			Font.drawCharacter( backSfc, 32, x, y );
		}
	}            

	// Now draw the borders
    drawBorderRect(backSfc, Rect);

    mpTempSfc.reset( g_pVideoDriver->convertThroughBlitSfc( backSfc ), &SDL_FreeSurface );
}
Пример #3
0
void CGUIDialog::initEmptyBackround()
{
    const SDL_Rect lRect = g_pVideoDriver->toBlitRect(mRect);
    mpBackgroundSfc.reset( CG_CreateRGBSurface( lRect ), &SDL_FreeSurface );

    mpBackgroundSfc.reset( g_pVideoDriver->convertThroughBlitSfc( mpBackgroundSfc.get() ), &SDL_FreeSurface );

	SDL_Surface *sfc = mpBackgroundSfc.get();    
    SDL_FillRect( sfc, NULL, SDL_MapRGB( sfc->format, 230, 230, 230) );        
}
// This function is used in your Ship need those parts.
// This special Messagebox can hold up to 4 images
void CMessageBoxVort::addTileAt(Uint16 tile, Uint16 x, Uint16 y)
{
	GsTilemap &tilemap = gGraphics.getTileMap(1);

	const int tileDim = tilemap.getDimension();

	// now we'll create a new surface on which the Tile will be printed.
	SDL_Rect rect;
	rect.x = rect.y = 0;
	rect.w = rect.h = tileDim;

#if SDL_VERSION_ATLEAST(2, 0, 0)
    std::shared_ptr<SDL_Surface> bmpSfc( CG_CreateRGBSurface( rect ), &SDL_FreeSurface );
    bmpSfc.reset(gVideoDriver.convertThroughBlitSfc(bmpSfc.get()), &SDL_FreeSurface);

#else
    std::shared_ptr<SDL_Surface> bmpSfc( CG_CreateRGBSurface(rect), &SDL_FreeSurface );
#endif

    SDL_FillRect(bmpSfc.get(), NULL, 0xFF00FFFF);
	tilemap.drawTile(bmpSfc.get(), 0, 0, tile);

	rect.x = x;	rect.y = y;

	GsRect<float> fRect( x, y, 16.0f, 16.0f);

	GsRect<float> gameRect = gVideoDriver.getGameResolution();
    fRect.transformInverse(gameRect);

    GsRect<float> scaleRect = mRect;

    scaleRect.x = 0;
    scaleRect.y = 0;

    fRect.transformInverse(scaleRect);

    std::shared_ptr<GsBitmap> pBitmap(new GsBitmap(bmpSfc));
    addControl( new CGUIBitmap(pBitmap), fRect );
}
Пример #5
0
void CGUIDialog::initBackground()
{
	if( g_pBehaviorEngine->getEngine() == ENGINE_VORTICON )
	{
		const SDL_Rect lRect = g_pVideoDriver->toBlitRect(mRect);
		mpBackgroundSfc.reset( CG_CreateRGBSurface( lRect ), &SDL_FreeSurface );
		mpBackgroundSfc.reset( SDL_DisplayFormat( mpBackgroundSfc.get() ), &SDL_FreeSurface );
		initVorticonBackground( lRect );
	}
	else if( g_pBehaviorEngine->getEngine() == ENGINE_GALAXY )
	{
		const SDL_Rect lRect = g_pVideoDriver->getGameResolution().SDLRect();
		mpBackgroundSfc.reset( CG_CreateRGBSurface( lRect ), &SDL_FreeSurface );
		mpBackgroundSfc.reset( SDL_DisplayFormat( mpBackgroundSfc.get() ), &SDL_FreeSurface );
		initGalaxyBackround( lRect );
	}
	else
	{
		const SDL_Rect lRect = g_pVideoDriver->toBlitRect(mRect);
		mpBackgroundSfc.reset( CG_CreateRGBSurface( lRect ), &SDL_FreeSurface );
		mpBackgroundSfc.reset( SDL_DisplayFormat( mpBackgroundSfc.get() ), &SDL_FreeSurface );
		initEmptyBackround();
	}
}
CTextViewer::CTextViewer(int x, int y, int w, int h) :
m_timer(0)
{
	m_x = x;	m_y = y;
	m_w = w;	m_h = h;
	
	m_scrollpos = m_linepos = 0;
	m_8x8tilewidth = m_8x8tileheight = 8;
	m_mustclose = false;

	SDL_Surface *temp = CG_CreateRGBSurface( gVideoDriver.getGameResolution().SDLRect() );

    mpTextVSfc.reset(gVideoDriver.convertThroughBlitSfc(temp), &SDL_FreeSurface);

    SDL_FreeSurface(temp);
}
Пример #7
0
CTextViewer::CTextViewer(int x, int y, int w, int h) :
m_timer(0)
{
	m_x = x;	m_y = y;
	m_w = w;	m_h = h;
	
	m_scrollpos = m_linepos = 0;
	m_8x8tilewidth = m_8x8tileheight = 8;
	m_mustclose = false;

	SDL_Surface *temp = CG_CreateRGBSurface( g_pVideoDriver->getGameResolution().SDLRect() );

#if SDL_VERSION_ATLEAST(2, 0, 0)
    
#else
    mpTextVSfc.reset(SDL_DisplayFormatAlpha(temp), &SDL_FreeSurface);
#endif
	SDL_FreeSurface(temp);
}
CMessageBoxBitmapGalaxy::CMessageBoxBitmapGalaxy( const std::string& Text,
														 const CBitmap &BitmapRef,
														 const direction_t alignment ) :
CMessageBoxGalaxy(Text),
mBitmap(BitmapRef),
mAlignment(alignment)
{

	// Looking if the Bitmap is too big for the Message box. In that case enlarge it!
	if( (mBitmap.getHeight()+26) > mMBRect.h )
	{
		mMBRect.h = mBitmap.getHeight()+26;
	}

	mMBRect.w += (mBitmap.getWidth()+32);

	mMBRect.x = (320-mMBRect.w)/2;
	mMBRect.y = (200-mMBRect.h)/2;

	mpMBSurface	= CG_CreateRGBSurface( mMBRect );
	mpMBSurface = SDL_DisplayFormatAlpha( mpMBSurface.get() );

}
Пример #9
0
void CGamePlayMode::render()
{
    mp_PlayGame->render();

    if(g_pBehaviorEngine->m_option[OPT_SHOWFPS].value)
    {
        SDL_Rect rect;
        rect.x = 5;
        rect.y = 5;
        rect.w = 150;
        rect.h = 10;

        if(!mpFPSSurface)
        {
            mpFPSSurface.reset(CG_CreateRGBSurface(rect), &SDL_FreeSurface);
        }

        std::string tempbuf = "FPS: " + ftoa(g_pTimer->LastFPS());
        SDL_FillRect(mpFPSSurface.get(),NULL,0x88888888);
        g_pGfxEngine->getFont(1).drawFont(mpFPSSurface.get(), tempbuf, 1, 1, false);

        SDL_BlitSurface(mpFPSSurface.get(), NULL, g_pVideoDriver->getBlitSurface(), &rect);
    }
}
Пример #10
0
void CAbout::init()
{
    CInfoScene::init();
	CExeFile &ExeFile = g_pBehaviorEngine->m_ExeFile;
	mpMap.reset(new CMap);
	CVorticonMapLoaderBase Maploader(mpMap);
	
	Maploader.load(ExeFile.getEpisode(), 90, ExeFile.getDataDirectory());
	mpMap->gotoPos( 1008, 28 );
	
	// Load the SDL_Bitmap
	if(m_type == "ID")
	{
		mp_bmp = g_pGfxEngine->getBitmap("IDLOGO");
		
		// Get the offset where in the data the info is...
		size_t offset = 0;
		//m_numberoflines = 11;
		switch(ExeFile.getEpisode())
		{
			case 1:
				if(ExeFile.getEXEVersion() == 131)
					offset = 0x16180-512;
				break;
			case 2:
				if(ExeFile.getEXEVersion() == 131)
					offset = 0x1A954-512;
				break;
			case 3:
				if(ExeFile.getEXEVersion() == 131)
					offset = 0x1CA70-512;
				break;
		}
		mpMap->drawAll();
		
		// Read the strings and save them the string array of the class
		if(offset)
		{
			char *startdata;
			startdata = (char*)ExeFile.getRawData() + offset;
			std::string buf;
			for(int i=0 ; i<m_numberoflines ; i++)
			{
				char *data = startdata;

				for(short offset = 0 ; offset<0x28 ; offset++)
				{
					if(data[offset] == 0x0A && data[offset+1] == 0x00)
						break;

					buf.push_back(data[offset]);
				}
				startdata += 0x28;

				// now check how many new lines we have in buf
				size_t num_newlines = 0;
				bool endoftext = false;

				size_t  pos;
				if((pos = buf.find(0xFE)) != std::string::npos)
				{
					buf.erase(pos), endoftext = true;
				}

				while((pos = buf.find(0x0A)) != std::string::npos)
					buf.erase(pos,1), num_newlines++;

				while((pos = buf.find('\0')) != std::string::npos)
					buf.erase(pos,1);

				m_lines.push_back(buf);
				
				if(endoftext) break;

				while(num_newlines > 0)
					m_lines.push_back(""), num_newlines--;

				buf.clear();
			}
		}
	}
	else if(m_type == "CG")
	{
		std::string path = getResourceFilename("gfx/CGLogo.bmp", ExeFile.getDataDirectory(), true, true);
		mpLogoBMP.reset( SDL_LoadBMP(GetFullFileName(path).c_str()), &SDL_FreeSurface );
		
		m_lines.push_back("Commander Genius is an interpreter");
		m_lines.push_back("made with the goal of recreating");
		m_lines.push_back("the engine that was used to power");
		m_lines.push_back("the Commander Keen series.");
		m_lines.push_back("");
		m_lines.push_back("However, we are also trying to add");
		m_lines.push_back("better support for modern systems");
		m_lines.push_back("to the games, so they can run more");
		m_lines.push_back("smoothly than they did under DOS.");
		m_lines.push_back("");
		m_lines.push_back("Thank you for supporting us by");
		m_lines.push_back("downloading Commander Genius and");
		m_lines.push_back("we hope you will report any bugs.");
	}
	
	switch(ExeFile.getEpisode())
	{
		case 1:
			// Change the ugly lower Tiles which are seen, when using 320x240 base resolution
			for(int i=0; i<30 ; i++)
			{
				mpMap->changeTile(22+i, 15, 14*13);
				mpMap->changeTile(22+i, 16, 14*13+3);
			}
			break;
	}
	
	m_logo_rect.x = m_logo_rect.y = 0;
	m_logo_rect.h = m_logo_rect.w = 0;
	
	if(mpLogoBMP)
	{
		m_logo_rect.w = mpLogoBMP->w;
		m_logo_rect.h = mpLogoBMP->h;
		m_logo_rect.x = 160-m_logo_rect.w/2;
		m_logo_rect.y = 22;
	}

	SDL_Surface *temp = CG_CreateRGBSurface( g_pVideoDriver->getGameResolution().SDLRect() );
#if SDL_VERSION_ATLEAST(2, 0, 0)
    
#else
    mpDrawSfc.reset(SDL_DisplayFormatAlpha(temp), &SDL_FreeSurface);
#endif
	SDL_FreeSurface(temp);
}
void CStatusScreenGalaxy::drawBase(SDL_Rect &EditRect)
{
	// Create a surface for that
	std::unique_ptr<SDL_Surface,SDL_Surface_Deleter> temp;

   	const SDL_Rect DestRect = g_pVideoDriver->getGameResolution().SDLRect();
   	mpStatusSurface.reset(CG_CreateRGBSurface(DestRect), &SDL_FreeSurface);


	/// Draw the required bitmaps and backgrounds
	// Draw the support Bitmap and see where the gray rectangle starts...
	// Prepare the drawrect for positions
	SDL_Rect Dest;

	// Create upper stomp support
	CBitmap &SupportBmp = g_pGfxEngine->getMaskedBitmap(2);
	SDL_Rect SupportRect;

	SupportRect.w = SupportBmp.getSDLSurface()->w;
	SupportRect.h = SupportBmp.getSDLSurface()->h;
	Dest.x = (DestRect.w-SupportRect.w)/2;	Dest.y = 0;
	temp.reset(SDL_DisplayFormat( SupportBmp.getSDLSurface() ));
	SDL_BlitSurface( temp.get(), NULL, mpStatusSurface.get(), &Dest );

	// Draw the gray surface
	SDL_Rect BackRect;
	BackRect.w = 192; // Standard sizes in Keen 4
	BackRect.h = 152;
	BackRect.x = (DestRect.w-BackRect.w)/2;
	BackRect.y = SupportRect.h;
	SDL_FillRect( mpStatusSurface.get(), &BackRect, 0xFFAAAAAA); //gray

	// Draw the cables Bitmap
	CBitmap &Cables_Bitmap = g_pGfxEngine->getMaskedBitmap(1);
	SDL_Rect CableRect;
	CableRect.w = Cables_Bitmap.getSDLSurface()->w;
	CableRect.h = Cables_Bitmap.getSDLSurface()->h;
	Dest.x = BackRect.x - CableRect.w;	Dest.y = 0;
	temp.reset(SDL_DisplayFormat( Cables_Bitmap.getSDLSurface() ));
	SDL_BlitSurface( temp.get(), NULL, mpStatusSurface.get(), &Dest );

	// Now draw the borders
	CTilemap &Tilemap = g_pGfxEngine->getTileMap(2);

	// Upper Left corner
	Tilemap.drawTile(mpStatusSurface.get(), BackRect.x, BackRect.y, 54);

	// Upper Part
	for(int c=1 ; c<(BackRect.w/8)-1 ; c++)
		Tilemap.drawTile(mpStatusSurface.get(), BackRect.x+c*8, BackRect.y, 55);

	// Upper Right Part
	Tilemap.drawTile(mpStatusSurface.get(), BackRect.x+BackRect.w-8, BackRect.y, 56);

	// Left Part
	for(int c=1 ; c<(BackRect.h/8)-1 ; c++)
		Tilemap.drawTile(mpStatusSurface.get(), BackRect.x, BackRect.y+c*8, 57);

	// Right Part
	for(int c=1 ; c<(BackRect.h/8)-1 ; c++)
		Tilemap.drawTile(mpStatusSurface.get(), BackRect.x+BackRect.w-8, BackRect.y+c*8, 59);

	// Lower Left Part
	Tilemap.drawTile(mpStatusSurface.get(), BackRect.x, BackRect.y+BackRect.h-8, 60);

	// Lower Part
	for(int c=1 ; c<(BackRect.w/8)-1 ; c++)
		Tilemap.drawTile(mpStatusSurface.get(), BackRect.x+c*8, BackRect.y+BackRect.h-8, 61);

	// Lower Right Part
	Tilemap.drawTile(mpStatusSurface.get(), BackRect.x+BackRect.w-8, BackRect.y+BackRect.h-8, 62);

	EditRect.x = BackRect.x+16;
	EditRect.y = BackRect.y+12;
	EditRect.w = BackRect.w-32;
	EditRect.h = BackRect.h-32;
}
Пример #12
0
SDL_Surface* CStatusScreen::CreateStatusSfc()
{
	return CG_CreateRGBSurface( m_StatusRect );
}
void CStatusScreenGalaxy::drawBase(SDL_Rect &EditRect)
{
    SDL_Rect DestRect;
    DestRect.w = 320;    DestRect.h = 200;
   	mpStatusSurface.reset(CG_CreateRGBSurface(DestRect), &SDL_FreeSurface);

    /// Draw the required bitmaps and backgrounds for Statusscreen
	// Draw the support Bitmap and see where the gray rectangle starts...
	// Prepare the drawrect for positions
	SDL_Rect Dest;

	// Create upper stomp support
	GsBitmap &SupportBmp = gGraphics.getMaskedBitmap(2);
	SDL_Rect SupportRect;

	SupportRect.w = SupportBmp.getSDLSurface()->w;
	SupportRect.h = SupportBmp.getSDLSurface()->h;
	Dest.x = (DestRect.w-SupportRect.w)/2;	Dest.y = 0; 

    BlitSurface( SupportBmp.getSDLSurface(), NULL, mpStatusSurface.get(), &Dest );

	// Draw the gray surface
	SDL_Rect BackRect;
	BackRect.w = 192; // Standard sizes in Keen 4
	BackRect.h = 152;
	BackRect.x = (DestRect.w-BackRect.w)/2;
	BackRect.y = SupportRect.h;
	SDL_FillRect( mpStatusSurface.get(), &BackRect, 0xFFAAAAAA); //gray

	// Draw the cables Bitmap
	GsBitmap &Cables_Bitmap = gGraphics.getMaskedBitmap(1);
	SDL_Rect CableRect;
	CableRect.w = Cables_Bitmap.getSDLSurface()->w;
	CableRect.h = Cables_Bitmap.getSDLSurface()->h;
	Dest.x = BackRect.x - CableRect.w;	Dest.y = 0;

    BlitSurface( Cables_Bitmap.getSDLSurface(), NULL, mpStatusSurface.get(), &Dest );

	// Now draw the borders
	GsTilemap &Tilemap = gGraphics.getTileMap(2);

	// Upper Left corner
	Tilemap.drawTile(mpStatusSurface.get(), BackRect.x, BackRect.y, 54);

	// Upper Part
	for(int c=1 ; c<(BackRect.w/8)-1 ; c++)
		Tilemap.drawTile(mpStatusSurface.get(), BackRect.x+c*8, BackRect.y, 55);

	// Upper Right Part
	Tilemap.drawTile(mpStatusSurface.get(), BackRect.x+BackRect.w-8, BackRect.y, 56);

	// Left Part
	for(int c=1 ; c<(BackRect.h/8)-1 ; c++)
		Tilemap.drawTile(mpStatusSurface.get(), BackRect.x, BackRect.y+c*8, 57);

	// Right Part
	for(int c=1 ; c<(BackRect.h/8)-1 ; c++)
		Tilemap.drawTile(mpStatusSurface.get(), BackRect.x+BackRect.w-8, BackRect.y+c*8, 59);

	// Lower Left Part
	Tilemap.drawTile(mpStatusSurface.get(), BackRect.x, BackRect.y+BackRect.h-8, 60);

	// Lower Part
	for(int c=1 ; c<(BackRect.w/8)-1 ; c++)
		Tilemap.drawTile(mpStatusSurface.get(), BackRect.x+c*8, BackRect.y+BackRect.h-8, 61);

	// Lower Right Part
	Tilemap.drawTile(mpStatusSurface.get(), BackRect.x+BackRect.w-8, BackRect.y+BackRect.h-8, 62);

	EditRect.x = BackRect.x+16;
	EditRect.y = BackRect.y+12;
	EditRect.w = BackRect.w-32;
	EditRect.h = BackRect.h-32;
}
Пример #14
0
void CMessageBoxSelection::init()
{
    mpMBSurface.reset(CG_CreateRGBSurface( mMBRect ), &SDL_FreeSurface);
    mpMBSurface.reset(gVideoDriver.convertThroughBlitSfc( mpMBSurface.get() ), &SDL_FreeSurface);

	initGalaxyFrame();

	SDL_Rect rect = mMBRect;
	rect.x = 8;
	rect.y = 10;
	rect.w -= 16;
	rect.h -= 16;
    
	GsFont &Font = gGraphics.getFont(FONT_ID);

	SDL_PixelFormat *format = gVideoDriver.getBlitSurface()->format;
	
	SDL_Surface *pColoredTextSurface = CG_CreateRGBSurface(rect);

	const Uint32 oldColor = Font.getFGColor();

	Font.setupColor( SDL_MapRGB( format, 0, 0, 0 ) );

	auto textList = explode(mText, "\n");
	
	int yoff = 0;
	for( auto &it : textList  )
	{	    
	    int xmid = (rect.w-Font.getPixelTextWidth(it))/2+rect.x;
	    Font.drawFont( pColoredTextSurface, it, xmid, yoff);
	    yoff += 12;
	}	

	// Adapt the newly created surface to the running screen.
	SDL_Surface *temp;


    if(RES_BPP == 32) // Only if there is an Alpha Channel (32 BPP)
        temp = gVideoDriver.convertThroughBlitSfc(pColoredTextSurface);
	else // or
        temp = gVideoDriver.convertThroughBlitSfc(pColoredTextSurface);

	SDL_FreeSurface(pColoredTextSurface);
	pColoredTextSurface = temp;

	Font.setupColor( oldColor );

	std::unique_ptr<SDL_Surface,SDL_Surface_Deleter> pTextSfc(pColoredTextSurface);			
	SDL_BlitSurface(pTextSfc.get(), NULL, mpMBSurface.get(), const_cast<SDL_Rect*>(&rect));
	
	
	// Create the Border and with two Surfaces of different colors create the rectangle
	SDL_Rect selRect;
	SDL_Rect cutRect;
	selRect.x = selRect.y = 0;
	selRect.w = rect.w-rect.x;
	selRect.h = 14;
	cutRect = selRect;
	cutRect.x += 2;
	cutRect.y += 2;
	cutRect.w -= 4;
	cutRect.h -= 4;
		
    mpSelSurface1.reset( SDL_CreateRGBSurface( SDL_SWSURFACE,
                                               selRect.w,
                                               selRect.h,
                                               RES_BPP,
                                               format->Rmask,
                                               format->Gmask,
                                               format->Bmask,
                                               0 ),
                         &SDL_FreeSurface);

    mpSelSurface2.reset( SDL_CreateRGBSurface( SDL_SWSURFACE,
                                               selRect.w,
                                               selRect.h,
                                               RES_BPP,
                                               format->Rmask,
                                               format->Gmask,
                                               format->Bmask,
                                               0 ),
                         &SDL_FreeSurface);

	SDL_FillRect( mpSelSurface1.get(), &selRect, SDL_MapRGB( format, 255, 0, 0 ) );
	SDL_FillRect( mpSelSurface2.get(), &selRect, SDL_MapRGB( format, 0, 0, 255 ) );
#if SDL_VERSION_ATLEAST(2, 0, 0)
    SDL_SetColorKey(mpSelSurface1.get(), SDL_TRUE, SDL_MapRGB( format, 0, 0, 0 ));
    SDL_SetColorKey(mpSelSurface2.get(), SDL_TRUE, SDL_MapRGB( format, 0, 0, 0 ));    
    SDL_SetSurfaceBlendMode(mpSelSurface1.get(), SDL_BLENDMODE_BLEND);
    SDL_SetSurfaceBlendMode(mpSelSurface2.get(), SDL_BLENDMODE_BLEND);
#else
    SDL_SetColorKey( mpSelSurface1.get(), SDL_SRCCOLORKEY, SDL_MapRGB( format, 0, 0, 0 ) );
    SDL_SetColorKey( mpSelSurface2.get(), SDL_SRCCOLORKEY, SDL_MapRGB( format, 0, 0, 0 ) );
#endif
	SDL_FillRect( mpSelSurface1.get(), &cutRect, SDL_MapRGB( format, 0, 0, 0 ) );
	SDL_FillRect( mpSelSurface2.get(), &cutRect, SDL_MapRGB( format, 0, 0, 0 ) );
}
void COrderingInfo::init()
{
    CInfoScene::init();
    CExeFile &ExeFile = gKeenFiles.exeFile;
    std::string datadirectory = gKeenFiles.gameDir;
	char episode = ExeFile.getEpisode();

	mpMap.reset(new CMap);

	CVorticonMapLoaderBase Maploader(mpMap);
	
	Maploader.load(episode, 90, datadirectory);
	mpMap->gotoPos( 22<<4, 32 );
	
	// Get the offset where in the data the info is...
	size_t offset = 0;
	switch(episode)
	{
		case 1:
			m_starty = 4; // start of y-coordinate in textheights
			m_numberoflines = 21; // numberof lines to print
			if(ExeFile.getEXEVersion() == 131)
				offset = 0x1632B;

			// Change the ugly lower Tiles which are seen, when using 320x240 base resolution
			for(int i=0; i<20 ; i++)
			{
				mpMap->changeTile(22+i, 15, 14*13);
				mpMap->changeTile(22+i, 16, 14*13+3);
			}

			break;
		case 2:
			m_starty = 3; // start of y-coordinate in textheights
			m_numberoflines = 19; // numberof lines to print
			mpMap->gotoPos( 22<<4, 28 );
			if(ExeFile.getEXEVersion() == 131)
				offset = 0x1AAD9;
			break;
		case 3:
			m_starty = 4; // start of y-coordinate in textheights
			m_numberoflines = 17; // numberof lines to print
			if(ExeFile.getEXEVersion() == 131)
				offset = 0x1CBED;
			break;
	}
	mpMap->drawAll();

	// Read the strings and save them the string array of the class
	if(offset)
	{
		char *data;
		data = (char*)ExeFile.getRawData() + offset;
		std::string buf;
		for(int i=0 ; i<m_numberoflines ; i++)
		{
			if(*data == '\0')
			{
				data++;
				while(*data == '\0')
					data++;
			}
			while(*data != '\n' and *data != '\0') // For the next line
			{
				buf.push_back(*data);
				data++;
			}
			data++;
			m_Textline.push_back(buf);
			
			buf.clear();
		}
	}
	
	// This just makes them all line up exactly like in the original games.
	switch(episode)
	{
		case 1:
			m_Textline[1] = " " + m_Textline[1];
			m_Textline[2] = m_Textline[2] + "  ";
			m_Textline[3] = m_Textline[3] + " ";
			m_Textline[4] = " " + m_Textline[4];
			m_Textline[5] = " " + m_Textline[5];
			m_Textline[6] = " " + m_Textline[6];
			m_Textline[8] = m_Textline[8] + "   ";
			m_Textline[9] = m_Textline[9] + "   ";
			m_Textline[10] = m_Textline[10] + "     ";
			m_Textline[11] = m_Textline[11] + "           ";
			m_Textline[13] = m_Textline[13] + "  ";
			m_Textline[14] = m_Textline[14] + "  ";
			m_Textline[15] = m_Textline[15] + "  ";
			m_Textline[20] = m_Textline[20] + "   ";
			break;
		case 2:
			m_Textline[2] = m_Textline[2] + "     ";
			m_Textline[4] = m_Textline[4] + " ";
			m_Textline[5] = m_Textline[5] + " ";
			m_Textline[6] = m_Textline[6] + " ";
			m_Textline[7] = m_Textline[7] + "   ";
			m_Textline[8] = m_Textline[8] + "         ";
			m_Textline[10] = m_Textline[10] + "           ";
			m_Textline[11] = m_Textline[11] + "           ";
			m_Textline[12] = m_Textline[12] + "           ";
			m_Textline[13] = m_Textline[13] + "         ";
			m_Textline[15] = m_Textline[15] + "  ";
			m_Textline[16] = m_Textline[16] + "    ";
			break;
		case 3:
			m_Textline[0] = m_Textline[0] + "     ";
			m_Textline[1] = m_Textline[1] + "   ";
			m_Textline[2] = m_Textline[2] + "       ";
			m_Textline[4] = m_Textline[4] + "   ";
			m_Textline[5] = m_Textline[5] + "   ";
			m_Textline[6] = m_Textline[6] + "   ";
			m_Textline[7] = m_Textline[7] + "     ";
			m_Textline[8] = m_Textline[8] + "           ";
			m_Textline[10] = m_Textline[10] + "    ";
			m_Textline[11] = m_Textline[11] + "   ";
			m_Textline[12] = m_Textline[12] + " ";
			m_Textline[13] = m_Textline[13] + "      ";
			m_Textline[16] = m_Textline[16] + "  ";
			break;
	}

	SDL_Surface *temp = CG_CreateRGBSurface( gVideoDriver.getGameResolution().SDLRect() );
//#if SDL_VERSION_ATLEAST(2, 0, 0)
    
//#else
    mpTextSfc.reset(gVideoDriver.convertThroughBlitSfc(temp), &SDL_FreeSurface);
//#endif
	SDL_FreeSurface(temp);
}