Commit 27c9722d authored by Gerhard Stein's avatar Gerhard Stein

Small Message Bug fix in Galaxy

parent 27fdf3a6
......@@ -113,7 +113,7 @@ void CPlayGameGalaxy::process()
m_Inventory.toggleStatusScreen();
}
const bool msgboxactive = !m_MessageBoxes.empty();
const bool msgboxactive = !mMessageBoxes.empty();
// process Page if one is open. Could be one of the finale scenes
//if(m_Page.isActive())
......@@ -140,14 +140,12 @@ void CPlayGameGalaxy::process()
// Draw some Textboxes with Messages only if one of those is open and needs to be drawn
if(msgboxactive)
{
CMessageBoxGalaxy *pMB = m_MessageBoxes.front();
CMessageBoxGalaxy *pMB = mMessageBoxes.front().get();
pMB->process();
if(pMB->isFinished())
if(pMB->m_mustclose)
{
delete(pMB);
pMB = NULL;
m_MessageBoxes.pop_front();
mMessageBoxes.pop_front();
}
return;
}
......@@ -162,26 +160,26 @@ void CPlayGameGalaxy::process()
m_Cheatmode.jump = !m_Cheatmode.jump;
std::string jumpstring = "Jump-Cheat has been ";
jumpstring += ((m_Cheatmode.jump) ? "enabled" : "disabled");
m_MessageBoxes.push_back(new CMessageBoxGalaxy(jumpstring));
mMessageBoxes.push_back(new CMessageBoxGalaxy(jumpstring));
}
else if(g_pInput->getHoldedKey(KG))
{
m_Cheatmode.god = !m_Cheatmode.god;
std::string godstring = "God-Mode has been ";
godstring += ((m_Cheatmode.god) ? "enabled" : "disabled");
m_MessageBoxes.push_back(new CMessageBoxGalaxy(godstring));
mMessageBoxes.push_back(new CMessageBoxGalaxy(godstring));
}
else if(g_pInput->getHoldedKey(KI))
{
m_Cheatmode.items = true;
m_MessageBoxes.push_back(new CMessageBoxGalaxy("Get all Items!"));
mMessageBoxes.push_back(new CMessageBoxGalaxy("Get all Items!"));
m_Inventory.Item.triggerAllItemsCheat();
m_Cheatmode.items = true;
}
else if(g_pInput->getHoldedKey(KN))
{
m_Cheatmode.noclipping = true;
m_MessageBoxes.push_back(new CMessageBoxGalaxy("No clipping toggle!"));
mMessageBoxes.push_back(new CMessageBoxGalaxy("No clipping toggle!"));
}
}
}
......@@ -190,22 +188,24 @@ void CPlayGameGalaxy::process()
// Galaxy Main Engine itself. For example, load map, setup world map, show Highscore
// are some of those events.
CEventContainer& EventContainer = g_pBehaviorEngine->m_EventList;
std::list<CMessageBoxGalaxy*>& MessageBoxQueue = m_MessageBoxes;
if( EventSendBitmapDialogMsg* ev = EventContainer.occurredEvent<EventSendBitmapDialogMsg>() )
{
MessageBoxQueue.push_back( new CMessageBoxBitmapGalaxy( ev->Msg, ev->BitmapID, ev->Direction ) );
CMessageBoxBitmapGalaxy *pMsgBox = new CMessageBoxBitmapGalaxy( ev->Msg, ev->BitmapID, ev->Direction );
//CMessageBoxGalaxy *pMsgBox = new CMessageBoxGalaxy( ev->Msg );
mMessageBoxes.push_back( pMsgBox );
EventContainer.pop_Event();
}
else if( EventSendSelectionDialogMsg* ev = EventContainer.occurredEvent<EventSendSelectionDialogMsg>() )
{
g_pMusicPlayer->stop();
MessageBoxQueue.push_back( new CMessageBoxSelection( ev->Message, ev->Options ) );
mMessageBoxes.push_back( new CMessageBoxSelection( ev->Message, ev->Options ) );
EventContainer.pop_Event();
}
if(MessageBoxQueue.empty())
if(mMessageBoxes.empty())
{
if( EventEnterLevel *ev = EventContainer.occurredEvent<EventEnterLevel>() )
{
......@@ -254,7 +254,7 @@ void CPlayGameGalaxy::processInput()
if(g_pInput->getPressedCommand(IC_BACK))
{
//mp_Menu = new CMenuGalaxy(ACTIVE, m_SavedGame, m_restartVideo);
m_BackgroundBitmap = *g_pGfxEngine->getBitmap("KEENSWATCH");
//m_BackgroundBitmap = *g_pGfxEngine->getBitmap("KEENSWATCH");
g_pMusicPlayer->pause();
}
}
......
......@@ -15,7 +15,9 @@
#include "CWorldMap.h"
#include "CLevelPlay.h"
#include "CMenuGalaxy.h"
#include "SmartPointer.h"
#include <vector>
#include <list>
#include <string>
const int WORLD_MAP_LEVEL_GALAXY=0;
......@@ -48,7 +50,7 @@ private:
CLevelPlay m_LevelPlay;
CSaveGameController &m_SavedGame;
CBitmap m_BackgroundBitmap;
std::list<CMessageBoxGalaxy*> m_MessageBoxes;
std::list< SmartPointer<CMessageBoxGalaxy> > mMessageBoxes;
stCheat m_Cheatmode;
};
......
......@@ -11,9 +11,9 @@
CMessageBoxBitmapGalaxy::CMessageBoxBitmapGalaxy( const std::string& Text, const Uint16 BitmapId,
const direction_t alignment ) :
CMessageBoxGalaxy(Text),
m_Bitmap(g_pGfxEngine->getBitmap(BitmapId)),
m_alignment(alignment)
CMessageBoxGalaxy(Text)//,
//m_Bitmap(g_pGfxEngine->getBitmap(BitmapId)),
//m_alignment(alignment)
{
/*int new_height = m_boxrect.h;
......@@ -47,7 +47,7 @@ void CMessageBoxBitmapGalaxy::process()
{
CMessageBoxGalaxy::process();
int bitmap_xcoord;
//int bitmap_xcoord;
// now compute where the bitmap is to be drawn
/*if( m_alignment == RIGHT )
......
......@@ -12,7 +12,8 @@
#include "graphics/CGfxEngine.h"
#include "common/CObject.h"
class CMessageBoxBitmapGalaxy : public CMessageBoxGalaxy {
class CMessageBoxBitmapGalaxy : public CMessageBoxGalaxy
{
public:
/**
......@@ -22,15 +23,16 @@ public:
*/
CMessageBoxBitmapGalaxy( const std::string& Text, const Uint16 BitmapId,
const direction_t alignment = LEFT );
virtual ~CMessageBoxBitmapGalaxy() {};
/**
* \brief the cycle to be processed for rendering the Message-Box
*/
virtual void process();
void process();
private:
CBitmap &m_Bitmap;
const direction_t m_alignment;
//CBitmap &m_Bitmap;
//const direction_t m_alignment;
};
#endif /* CMESSAGEBOXBITMAPGALAXY_H_ */
......@@ -14,8 +14,8 @@
const int FONT_ID = 0;
CMessageBoxGalaxy::CMessageBoxGalaxy(const std::string& Text) :
CMessageBox(Text, false, false, false)
CMessageBoxGalaxy::CMessageBoxGalaxy(const std::string& Text) /*:
CMessageBox(Text, false, false, false)*/
{
// Center that dialog box
/*CFont &Font = g_pGfxEngine->getFont(FONT_ID);
......@@ -50,10 +50,11 @@ CMessageBox(Text, false, false, false)
void CMessageBoxGalaxy::process()
{
SDL_Surface *sfc = g_pVideoDriver->mp_VideoEngine->getBlitSurface();
//SDL_Surface *sfc = g_pVideoDriver->mp_VideoEngine->getBlitSurface();
// Look, if somebody pressed a button, and close this dialog!
if(g_pInput->getPressedAnyCommand()) {
if(g_pInput->getPressedAnyCommand())
{
m_mustclose = true;
return;
}
......
......@@ -11,7 +11,8 @@
#include "dialog/CMessageBox.h"
#include "CVec.h"
class CMessageBoxGalaxy : public CMessageBox {
class CMessageBoxGalaxy //: public CMessageBox
{
public:
/**
......@@ -19,11 +20,15 @@ public:
* \param Text Message to be shown
*/
CMessageBoxGalaxy(const std::string& Text);
virtual ~CMessageBoxGalaxy() {};
void process();
virtual void process();
bool m_mustclose;
protected:
SDL_Rect m_TextPos;
};
#endif /* CMESSAGEBOXGALAXY_H_ */
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