Commit de9abb18 authored by Gerhard Stein's avatar Gerhard Stein

Removed some Statusscreen bugs

parent f50221d6
......@@ -10,6 +10,7 @@
#include "sdl/CVideoDriver.h"
#include "sdl/video/colourconvert.h"
#include "common/CBehaviorEngine.h"
#include "sdl/extensions.h"
CStatusScreenGalaxy::CStatusScreenGalaxy(const stItemGalaxy& Item, const std::string &LevelName) :
m_showstatus(false),
......@@ -20,24 +21,10 @@ m_LevelName(LevelName)
void CStatusScreenGalaxy::drawBase(SDL_Rect &EditRect)
{
// Create a surface for that
SDL_Surface *temp;
const Uint32 flags = 0;
// For some reason the Alpha mask doesn't work, if blitsurface == screensurface. Not sure if every system is affected of that.
// Maybe I write a function for the proper masks...
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
const Uint32 rmask = 0xFF000000;
const Uint32 gmask = 0x00FF0000;
const Uint32 bmask = 0x0000FF00;
const Uint32 amask = 0x000000FF;
#else
const Uint32 rmask = 0x000000FF;
const Uint32 gmask = 0x0000FF00;
const Uint32 bmask = 0x00FF0000;
const Uint32 amask = 0xFF000000;
#endif
SmartPointer<SDL_Surface> temp;
const SDL_Rect DestRect = g_pVideoDriver->getGameResolution().SDLRect();
mpStatusSurface = SDL_CreateRGBSurface( flags, DestRect.w, DestRect.h, 32, rmask, gmask, bmask, amask);
mpStatusSurface = CG_CreateRGBSurface(DestRect);
/// Draw the required bitmaps and backgrounds
......@@ -48,12 +35,12 @@ void CStatusScreenGalaxy::drawBase(SDL_Rect &EditRect)
// 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 = SDL_ConvertSurface( SupportBmp.getSDLSurface(), mpStatusSurface->format, flags );
BlitSurfaceMerge( temp, &SupportRect, mpStatusSurface.get(), &Dest );
SDL_FreeSurface(temp);
temp = SDL_DisplayFormat( SupportBmp.getSDLSurface() );
SDL_BlitSurface( temp.get(), NULL, mpStatusSurface.get(), &Dest );
// Draw the gray surface
SDL_Rect BackRect;
......@@ -69,9 +56,8 @@ void CStatusScreenGalaxy::drawBase(SDL_Rect &EditRect)
CableRect.w = Cables_Bitmap.getSDLSurface()->w;
CableRect.h = Cables_Bitmap.getSDLSurface()->h;
Dest.x = BackRect.x - CableRect.w; Dest.y = 0;
temp = SDL_ConvertSurface( Cables_Bitmap.getSDLSurface(), mpStatusSurface->format, flags );
BlitSurfaceMerge( temp, &CableRect, mpStatusSurface.get(), &Dest );
SDL_FreeSurface(temp);
temp = SDL_DisplayFormat( Cables_Bitmap.getSDLSurface() );
SDL_BlitSurface( temp.get(), NULL, mpStatusSurface.get(), &Dest );
// Now draw the borders
CTilemap &Tilemap = g_pGfxEngine->getTileMap(2);
......
......@@ -34,7 +34,7 @@ public:
void draw();
bool m_showstatus;
SmartPointer <SDL_Surface> mpStatusSurface;
SmartPointer<SDL_Surface> mpStatusSurface;
const stItemGalaxy& m_Item;
const std::string &m_LevelName;
};
......
......@@ -18,7 +18,6 @@ CStatusScreenGalaxy(Item, LevelName)
void CStatusScreenGalaxyEp4::GenerateStatus()
{
SDL_Rect EditRect;
SmartPointer<SDL_Surface> pTextSfc; // temperorary
drawBase(EditRect);
CFont &Font = g_pGfxEngine->getFont(0);
......
......@@ -65,7 +65,7 @@ struct BlitSurfaceTask : CEvent
SmartPointer<SDL_Surface> mSfcToBlit;
SmartPointer<SDL_Rect> mSrcRect;
SmartPointer<SDL_Rect> mDstRect;
BlitSurfaceTask( SmartPointer<SDL_Surface> sfcToBlit,
BlitSurfaceTask( SmartPointer<SDL_Surface> &sfcToBlit,
SDL_Rect *srcRect,
SDL_Rect *dstRect ) :
mSfcToBlit(sfcToBlit)
......
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