Commit 08d9e2c6 authored by Gerhard Stein's avatar Gerhard Stein

Improved GsSurface

parent 54812577
Subproject commit c9b9eafb3809223f7039782efe5ddc0b68c408a5
Subproject commit 2718c8b05314ec3245ed5b0bf531ac00a7bfa3a9
......@@ -7,6 +7,8 @@ v2.0.0.0:
- Smoother scrolling with vsync
- GUI improvements
- Multiplayer improvements
- Sprite class now uses GsSurface in order to increase performance
and reduce crashes
v1.9.9.9:
---------
......
......@@ -63,21 +63,11 @@ void CHUD::setup(const int id)
mRenderRect.w = 80; mRenderRect.h = 30;
mHUDBox = *gGraphics.getSprite(mId,"HUDBACKGROUND");
#if SDL_VERSION_ATLEAST(2, 0, 0)
#else
mHUDBox.optimizeSurface();
#endif
mRenderRect.h = mHUDBox.getHeight();
mRenderRect.w = mHUDBox.getWidth()-7;
mRenderRect.x += (mRenderRect.w-2)*id;
auto HUDBoxSfc = mHUDBox.smartSDLSurface();
#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_SetSurfaceBlendMode(HUDBoxSfc.get(), SDL_BLENDMODE_NONE);
#else
SDL_SetAlpha(HUDBoxSfc.get(), 0, 0);
#endif
mHUDBox.Surface().setAlpha(0);
createHUDBlit();
}
......@@ -109,16 +99,16 @@ void CHUD::CreateVorticonBackground()
mKeenHeadSprite = gGraphics.getSprite(mId,PMAPDOWNFRAME);
auto keenHeadSmartSfc = mKeenHeadSprite.smartSDLSurface();
SDL_Surface *keenHeadSfc = keenHeadSmartSfc.get();
if(mKeenHeadSprite.empty())
return;
#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_SetSurfaceBlendMode( keenHeadSfc, SDL_BLENDMODE_NONE);
#else
SDL_SetAlpha(keenHeadSfc, 0, 0);
#endif
BlitSurface( keenHeadSfc, &headsrGsRect, mBackground.getSDLSurface(), &headdstrect );
auto &keenHeadSmartSfc = mKeenHeadSprite.Surface();
keenHeadSmartSfc.setAlpha(0);
keenHeadSmartSfc.blitTo(mBackground);
//BlitSurface( keenHeadSfc, &headsrGsRect, mBackground.getSDLSurface(), &headdstrect );
int sprite=0;
......@@ -134,16 +124,12 @@ void CHUD::CreateVorticonBackground()
headdstrect.x = 45-(headsrGsRect.w/2);
headdstrect.y = 19-(headsrGsRect.h/2);
auto keenGunSmartSfc = mKeenGunSprite.smartSDLSurface();
SDL_Surface *keenGunSfc = keenGunSmartSfc.get();
auto &keenGunSfc = mKeenGunSprite.Surface();
#if SDL_VERSION_ATLEAST(2, 0, 0)
SDL_SetSurfaceBlendMode(keenGunSfc, SDL_BLENDMODE_NONE);
#else
SDL_SetAlpha(keenGunSfc, 0, 0);
#endif
keenGunSfc.setAlpha(0);
BlitSurface( keenGunSfc, &headsrGsRect, mBackground.getSDLSurface(), &headdstrect );
keenGunSfc.blitTo(mBackground, headdstrect);
//BlitSurface( keenGunSfc, &headsrGsRect, mBackground.getSDLSurface(), &headdstrect );
// Draw the rounded borders
DrawCircle(0, 0, 76);
......
......@@ -85,9 +85,13 @@ void CMap::refreshStripes()
Uint16 CMap::at(int x, int y, int t)
{
if(x < m_width && y < m_height )
{
return mPlanes[t].getMapDataAt(x,y);
}
else
{
return 0;
}
}
//////////////////////////
......
......@@ -231,7 +231,9 @@ bool CSpriteObject::moveSlopedTileDown( int x, int y, const int xspeed )
const Uint32 newpos_y = y_csf - m_BBox.y2 + y_rel - (1<<STC);
if( m_Pos.y > newpos_y )
{
m_Pos.y = newpos_y;
}
onslope = true;
}
......
......@@ -544,7 +544,7 @@ void CSpriteObject::draw()
GsSprite &Sprite = gGraphics.getSprite(mSprVar, mSpriteIdx);
if(!Sprite.valid())
if(Sprite.empty())
{
return;
}
......
......@@ -1332,9 +1332,11 @@ bool CEGAGraphicsGalaxy::readSprites( const size_t numSprites,
sprite.createSurface( gVideoDriver.mpVideoEngine->getBlitSurface()->flags,
gGraphics.Palette.m_Palette );
auto smartSfc = sprite.smartSDLSurface();
SDL_Surface *sfc = smartSfc.get();
SDL_FillRect(sfc, nullptr, 0);
auto &gsSfc = sprite.Surface();
gsSfc.fillRGB(0,0,0);
SDL_Surface *sfc = gsSfc.getSDLSurface();
if(SDL_MUSTLOCK(sfc)) SDL_LockSurface(sfc);
if(!data.empty())
......
This diff is collapsed.
......@@ -29,7 +29,7 @@ public:
bool loadData(const std::string& filename, bool compresseddata);
private:
int m_numsprites;
int mNumsprites;
int m_planesize;
long m_spritestartloc;
long m_spriteloc;
......
......@@ -994,7 +994,9 @@ bool CPlayer::drawStatusScreen()
if(m_showStatusScreen)
{
if(mpStatusScr)
{
mpStatusScr->draw();
}
return false;
}
......
......@@ -144,7 +144,7 @@ void CPlayGameVorticon::setupPlayers()
bool CPlayGameVorticon::init()
{
// Required to sprites are correctly masked
// Required to get sprites correctly masked
gGraphics.optimizeSprites();
const GsRect<Uint16> gameRect = gVideoDriver.getVidConfig().mGameRect;
......
......@@ -236,7 +236,8 @@ void CPlayGameVorticon::showKeensLeft()
const int liveW = livesSprite.getWidth();
const int liveH = livesSprite.getHeight();
livesSprite.drawSprite(boxsurface, x, y, liveW, liveH );
x+=16;
x+=16;
}
y += 16;
}
......
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