Commit 4eb2754d authored by Gerhard Stein's avatar Gerhard Stein

Improved use of GsSurface

parent ea17843e
Subproject commit d958c0a0b6b29002c7c2963145ee8a20d129b91b
Subproject commit 88789013ea6e52cdfb074081254cab0e07736786
......@@ -36,6 +36,8 @@ public:
virtual void pumpEvent(const CEvent *evPtr);
virtual ~CPlayGame() {}
bool isFinished();
bool getEndGame();
bool getStartGame();
......
......@@ -49,22 +49,22 @@ public:
CPlayGameVorticon(const int startlevel = 0);
void setupPlayers();
bool init();
bool init() override;
// Game states
bool loadGameState();
bool loadGameState() override;
bool saveGameState();
bool loadXMLGameState();
bool saveXMLGameState();
bool loadXMLGameState() override;
bool saveXMLGameState() override;
void pumpEvent(const CEvent *evPtr);
void pumpEvent(const CEvent *evPtr) override;
void ponder(const float deltaT);
void ponder(const float deltaT) override;
void processOnWorldMap();
void processInLevel();
void render();
void render() override;
void showKeensLeft();
void goBacktoMap();
......@@ -110,7 +110,9 @@ public:
void readTeleportDestCoordinatesEP1(int objectID, int &destx, int &desty);
void readTeleportDestCoordinatesEP3(int objectID, int &destx, int &desty);
void cleanup();
void cleanup() override;
virtual ~CPlayGameVorticon() override {}
private:
......@@ -125,10 +127,14 @@ private:
std::unique_ptr<CFinale> mpFinale;
std::unique_ptr<CEGABitmap> mpGameoverBmp;
std::list< std::shared_ptr<CMessageBoxVort> > mMessageBoxes;
bool m_showKeensLeft;
std::vector< std::unique_ptr<CVorticonSpriteObject> > mSpriteObjectContainer;
std::vector< std::unique_ptr<CHUD> > mpHUDVec;
GsSurface mKeenLeftSfc;
SDL_Rect keenleft_rect;
// Menu-Button
......
......@@ -194,7 +194,7 @@ void CPlayGameVorticon::showKeensLeft()
const unsigned int KEENSLEFT_X = 7*scW;
const unsigned int KEENSLEFT_Y = 10*scH;
if(!mKeenLeftSfc)
if(mKeenLeftSfc.empty())
{
int x,y,i,p;
int boxY, boxH;
......@@ -209,21 +209,27 @@ void CPlayGameVorticon::showKeensLeft()
SDL_Rect rect;
rect.x = (KEENSLEFT_X+1)*8; rect.y = (boxY+2)*8;
rect.w = (KEENSLEFT_W+1)*8; rect.h = (boxH)*8;
SDL_Surface *boxsurface = SDL_CreateRGBSurface( SDL_SWSURFACE, rect.w, rect.h, RES_BPP, 0, 0, 0, 0 );
mKeenLeftSfc.createRGBSurface(rect);
rect.x = 8; rect.y = 16;
rect.w = (KEENSLEFT_W-1)*8; rect.h = (boxH-3)*8;
Uint8 r, g, b;
Font.getBGColour(&r, &g, &b, true);
Uint32 color = SDL_MapRGB( boxsurface->format, r, g, b);
const auto color = mKeenLeftSfc.mapRGB(r, g, b);
gGraphics.drawDialogBox( mKeenLeftSfc.getSDLSurface(),
0, 0,
KEENSLEFT_W, boxH,
color );
mKeenLeftSfc.fillRGB(rect, r, g, b);
gGraphics.drawDialogBox( boxsurface, 0, 0, KEENSLEFT_W, boxH, color );
SDL_FillRect(boxsurface, &rect, color );
Font.getBGColour(&r, &g, &b, false);
SDL_FillRect(boxsurface, &rect, SDL_MapRGB( boxsurface->format, r, g, b) );
Font.drawFont( boxsurface, gBehaviorEngine.getString("LIVES_LEFT"), 36, 8, true);
mKeenLeftSfc.fillRGB(rect, r, g, b);
Font.drawFont( mKeenLeftSfc, gBehaviorEngine.getString("LIVES_LEFT"), 36, 8, true);
y = 20;
for(p=0; p<numPlayers ; p++)
......@@ -235,14 +241,15 @@ void CPlayGameVorticon::showKeensLeft()
const int liveW = livesSprite.getWidth();
const int liveH = livesSprite.getHeight();
livesSprite.drawSprite(boxsurface, x, y, liveW, liveH );
livesSprite.drawSprite(mKeenLeftSfc.getSDLSurface(),
x, y,
liveW, liveH );
x+=16;
}
y += 16;
}
mKeenLeftSfc.createFromSDLSfc(boxsurface);
mKeenLeftSfc.makeBlitCompatible();
}
else
......@@ -269,10 +276,12 @@ void CPlayGameVorticon::showKeensLeft()
int CPlayGameVorticon::getTeleporterInfo(int objectID)
{
if(m_Episode == 1) {
if(m_Episode == 1)
{
if( objectID > 33 && objectID < 47 ) return objectID;
}
else if(m_Episode == 3) {
else if(m_Episode == 3)
{
if( (objectID & 0xF00) == 0xF00) return objectID;
}
return 0;
......@@ -291,9 +300,13 @@ void CPlayGameVorticon::teleportPlayer(int objectID, CPlayer &player)
teleporter->solid = false;
teleporter->direction = TELEPORTING_IN;
if(m_Episode == 1)
{
readTeleportDestCoordinatesEP1(objectID, destx, desty);
}
else if(m_Episode == 3)
{
readTeleportDestCoordinatesEP3(objectID, destx, desty);
}
teleporter->destx = destx>>TILE_S;
teleporter->desty = desty>>TILE_S;
teleporter->whichplayer = player.m_index;
......
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