Commit e285d5bd authored by Gerhard Stein's avatar Gerhard Stein

Simplifications, cleanups

parent 4cf8e3b9
Subproject commit 6e4923af4f76550504356e4ad31709633459ed06
Subproject commit 85eb8971f07c2c74bfe124ae555004ff8b27bb18
......@@ -25,8 +25,8 @@ m_style(PROGRESS_STYLE_TEXT)
rect.x = 0; rect.y = 0;
rect.w = gameRes.w; rect.h = gameRes.h;
mpProgressSfc.reset( CG_CreateRGBSurface( rect ), &SDL_FreeSurface );
mpProgressSfc.reset( gVideoDriver.convertThroughBlitSfc(mpProgressSfc.get()), &SDL_FreeSurface );
mProgressSfc.createRGBSurface(rect);
mProgressSfc.makeBlitCompatible();
}
/**
......@@ -210,8 +210,7 @@ void CResourceLoader::setPermilage(int permil)
*/
void CResourceLoader::renderLoadingGraphic()
{
SDL_Surface *sfc = mpProgressSfc.get();
SDL_FillRect(sfc, nullptr, 0x0);
mProgressSfc.fillRGB(0, 0, 0);
GsRect<Uint16> gameRes = gVideoDriver.getGameResolution();
......@@ -233,16 +232,16 @@ void CResourceLoader::renderLoadingGraphic()
const float scaleUpH = float(gameRes.h)/200.0f;
textRect.x = (int)(80.0*scaleUpW); textRect.y = (int)(100.0*scaleUpH);
textRect.w = 200; textRect.h = 10;
SDL_FillRect(sfc, &textRect, SDL_MapRGB(sfc->format, 0, 0, 0));
Font.drawFont(sfc, text , textRect.x, textRect.y, true);
mProgressSfc.fillRGB(0,0,0);
Font.drawFont(mProgressSfc, text , textRect.x, textRect.y, true);
}
else if(m_style == PROGRESS_STYLE_BITMAP)
{
GsBitmap &Bitmap = *gGraphics.getBitmapFromStr("ONEMOMEN");
SDL_Rect rect;
GsRect<Uint16> rect;
int width = Bitmap.width();
int height = Bitmap.height();
Bitmap._draw( (gameWidth-width)/2, (gameHeight-height)/2, sfc);
Bitmap._draw( (gameWidth-width)/2, (gameHeight-height)/2, mProgressSfc.getSDLSurface());
rect.x = (gameWidth-width)/2;
rect.y = (gameHeight+height)/2;
......@@ -251,14 +250,12 @@ void CResourceLoader::renderLoadingGraphic()
rect.h = 4;
// Fade from yellow to green with this formula
Uint32 color = SDL_MapRGB(sfc->format, 200-(200*m_permil)/1000, 200, 0 );
SDL_FillRect(sfc, &rect, color);
mProgressSfc.fillRGB(rect, 200-(200*m_permil)/1000, 200, 0);
}
else if(m_style == PROGRESS_STYLE_BAR)
{
SDL_Rect rect;
SDL_Rect bgRect;
GsRect<Uint16> rect;
GsRect<Uint16> bgRect;
rect.x = (gameWidth-halfWidth)/2;
rect.y = gameHeight/2;
......@@ -276,18 +273,14 @@ void CResourceLoader::renderLoadingGraphic()
const Uint8 g = gameHeight;
const Uint8 b = 0;
Uint32 color = SDL_MapRGB(sfc->format, r, g, b );
SDL_FillRect(sfc, &bgRect, SDL_MapRGB(sfc->format, 128, 128, 128));
SDL_FillRect(sfc, &rect, color);
mProgressSfc.fillRGB(bgRect, 128, 128, 128);
mProgressSfc.fillRGB(rect, r, g, b);
}
// In there is garbage of other drawn stuff clean it up.
auto blit = gVideoDriver.getBlitSurface();
SDL_FillRect( blit, nullptr, SDL_MapRGB(blit->format, 0,0,0) );
BlitSurface( mpProgressSfc.get(), nullptr, blit, nullptr );
auto &gameSfc = gVideoDriver.gameSfc();
gameSfc.fillRGB(0, 0, 0);
mProgressSfc.blitTo(gameSfc);
}
......
......@@ -56,7 +56,7 @@ private:
ProgressStyle m_style;
ThreadPoolItem *mp_Thread;
std::shared_ptr<SDL_Surface> mpProgressSfc;
GsSurface mProgressSfc;
};
......
......@@ -64,11 +64,6 @@ void CStatusScreen::draw()
}
}
SDL_Surface* CStatusScreen::CreateStatusSfc()
{
return CG_CreateRGBSurface( m_StatusRect );
}
std::string CStatusScreen::fetchDifficultyText()
{
std::string out;
......@@ -104,7 +99,10 @@ void CStatusScreen::createInventorySfcEp1(const int varSpr)
m_StatusRect.w = (dlgW+1)*8;
m_StatusRect.h = dlgH*8;
SDL_Surface *p_surface = CreateStatusSfc();
GsSurface sfc;
sfc.createRGBSurface(m_StatusRect);
SDL_Surface *p_surface = sfc.getSDLSurface();
GsTilemap &Tilemap = gGraphics.getTileMap(1);
gGraphics.drawDialogBox( p_surface, 0, 0, dlgW,dlgH, Font.getBGColour(p_surface->format, true));
......@@ -221,8 +219,6 @@ void CStatusScreen::createInventorySfcEp1(const int varSpr)
//#else
mpStatusSfc.reset(gVideoDriver.convertThroughBlitSfc(p_surface), &SDL_FreeSurface);
//#endif
SDL_FreeSurface(p_surface);
}
void CStatusScreen::createInventorySfcEp2(const int varSpr)
......@@ -237,7 +233,9 @@ void CStatusScreen::createInventorySfcEp2(const int varSpr)
m_StatusRect.w = (dlgW+1)*8;
m_StatusRect.h = dlgH*8;
SDL_Surface *p_surface = CreateStatusSfc();
GsSurface sfc;
sfc.createRGBSurface(m_StatusRect);
SDL_Surface *p_surface = sfc.getSDLSurface();
GsTilemap &Tilemap = gGraphics.getTileMap(1);
tempbuf = gBehaviorEngine.getString("EP2_StatusBox");
......@@ -361,7 +359,10 @@ void CStatusScreen::createInventorySfcEp3(const int varSpr)
m_StatusRect.w = (dlgW+1)*8;
m_StatusRect.h = dlgH*8;
SDL_Surface *p_surface = CreateStatusSfc();
GsSurface sfc;
sfc.createRGBSurface(m_StatusRect);
SDL_Surface *p_surface = sfc.getSDLSurface();
GsTilemap &Tilemap = gGraphics.getTileMap(1);
tempbuf = gBehaviorEngine.getString("EP3_StatusBox");
......
......@@ -28,7 +28,6 @@ public:
private:
SDL_Surface* CreateStatusSfc();
char m_episode;
int m_baseframe;
......
......@@ -125,7 +125,7 @@ bool CVorticonElite::isNearby(CVorticonSpriteObject &theObject)
const auto diff = gBehaviorEngine.mDifficulty;
if(!mpMap->m_Dark || diff > HARD)
if(!mpMap->m_Dark || diff > EASY)
{
if (getProbability(VORTELITE_JUMP_PROB) && !blockedu)
{ // let's jump.
......
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