Commit 15bbb80d authored by Gerhard Stein's avatar Gerhard Stein

Fixed some Dialogs. All cheats work again

parent 5c64debb
......@@ -39,8 +39,8 @@ m_mustclose(false)
// Those formulas work well with our constellation but I don't think they are perfect.
// They transform the Message Box the way the text fits perfectly in.
mRect.w = (mpTextCtrl->mTextDim.w+2)*0.028f;
mRect.h = (mpTextCtrl->mTextDim.h+2)*0.05f;
mRect.w = (mpTextCtrl->mTextDim.w)*0.028f + 0.056f;
mRect.h = (mpTextCtrl->mTextDim.h)*0.045f + 0.13f;
mRect.x = (1.0f - mRect.w)/2.0f;
mRect.y = (1.0f - mRect.h)/2.0f;
......@@ -53,6 +53,7 @@ m_mustclose(false)
addControl( mpTextCtrl, TextRect );
CRect<float> closeRect = pButton->mRect;
closeRect.x = mRect.x;
closeRect.y = mRect.y;
......
......@@ -67,19 +67,27 @@ struct EventPlayTrack : CEvent {
* Event designated for a Bitmap Message like those when Keen talks
* to the council Members or Princess Lindsey
*/
struct EventSendBitmapDialogMsg : CEvent {
const uint16_t BitmapID;
struct EventSendDialog : CEvent
{
const std::string Msg;
EventSendDialog(const std::string& lMsg) :
Msg(lMsg) {}
};
struct EventSendBitmapDialogMsg : EventSendDialog
{
const uint16_t BitmapID;
const direction_t Direction;
EventSendBitmapDialogMsg(const uint16_t &lBitmapID,
const std::string& lMsg,
const direction_t& lDirection = LEFT) :
EventSendDialog(lMsg),
BitmapID(lBitmapID),
Msg(lMsg),
Direction(lDirection)
{}
};
/**
* \description small structure which holds a matching selection text to an event.
* It is used
......
......@@ -66,6 +66,8 @@ void CPlayGameGalaxy::process()
if(g_pSound->pauseGamePlay())
return;
CEventContainer &eventContainer = g_pBehaviorEngine->m_EventList;
/*if(mp_Menu) // In case the menu is open
{
// draw the title bitmap here!
......@@ -144,13 +146,12 @@ void CPlayGameGalaxy::process()
if(pMB->isFinished())
{
mMessageBoxes.pop_front();
mMessageBoxes.pop_front();
}
return;
}
//// Special Keyboard Input
/// Cheat Codes
if( g_pInput->getHoldedKey(KF10) )
{
......@@ -159,43 +160,50 @@ void CPlayGameGalaxy::process()
m_Cheatmode.jump = !m_Cheatmode.jump;
std::string jumpstring = "Jump-Cheat has been ";
jumpstring += ((m_Cheatmode.jump) ? "enabled" : "disabled");
mMessageBoxes.push_back(new CMessageBoxGalaxy(jumpstring));
eventContainer.add( new EventSendDialog(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");
mMessageBoxes.push_back(new CMessageBoxGalaxy(godstring));
eventContainer.add( new EventSendDialog(godstring) );
}
else if(g_pInput->getHoldedKey(KI))
{
m_Cheatmode.items = true;
mMessageBoxes.push_back(new CMessageBoxGalaxy("Get all Items!"));
eventContainer.add( new EventSendDialog("Get all Items!") );
m_Inventory.Item.triggerAllItemsCheat();
m_Cheatmode.items = true;
}
else if(g_pInput->getHoldedKey(KN))
{
m_Cheatmode.noclipping = true;
mMessageBoxes.push_back(new CMessageBoxGalaxy("No clipping toggle!"));
eventContainer.add( new EventSendDialog("No clipping toggle!") );
}
}
}
// In this part we will poll all the relevant Events that are important for the
// Galaxy Main Engine itself. For example, load map, setup world map, show Highscore
// are some of those events.
CEventContainer& EventContainer = g_pBehaviorEngine->m_EventList;
if( EventSendBitmapDialogMsg* ev = EventContainer.occurredEvent<EventSendBitmapDialogMsg>() )
if( EventSendBitmapDialogMsg *ev = eventContainer.occurredEvent<EventSendBitmapDialogMsg>() )
{
CMessageBoxBitmapGalaxy *pMsgBox = new CMessageBoxBitmapGalaxy( ev->Msg, ev->BitmapID, ev->Direction );
pMsgBox->init();
//CMessageBoxGalaxy *pMsgBox = new CMessageBoxGalaxy( ev->Msg );
mMessageBoxes.push_back( pMsgBox );
EventContainer.pop_Event();
eventContainer.pop_Event();
}
else if( EventSendDialog *ev = eventContainer.occurredEvent<EventSendDialog>() )
{
CMessageBoxGalaxy *pMsgBox = new CMessageBoxGalaxy( ev->Msg );
pMsgBox->init();
mMessageBoxes.push_back( pMsgBox );
eventContainer.pop_Event();
}
/*else if( EventSendSelectionDialogMsg* ev = EventContainer.occurredEvent<EventSendSelectionDialogMsg>() )
{
......@@ -207,7 +215,7 @@ void CPlayGameGalaxy::process()
if(mMessageBoxes.empty())
{
if( EventEnterLevel *ev = EventContainer.occurredEvent<EventEnterLevel>() )
if( EventEnterLevel *ev = eventContainer.occurredEvent<EventEnterLevel>() )
{
// Start a new level!
if(ev->data > 0xC000)
......@@ -220,30 +228,30 @@ void CPlayGameGalaxy::process()
g_pSound->playSound( SOUND_ENTER_LEVEL );
m_LevelPlay.setActive(true);
}
EventContainer.pop_Event();
eventContainer.pop_Event();
}
else if( EventContainer.occurredEvent<EventRestartLevel>() )
else if( eventContainer.occurredEvent<EventRestartLevel>() )
{
g_pMusicPlayer->stop();
m_LevelPlay.reloadLevel();
EventContainer.pop_Event();
eventContainer.pop_Event();
}
else if( EventExitLevel *ev = EventContainer.occurredEvent<EventExitLevel>() )
else if( EventExitLevel *ev = eventContainer.occurredEvent<EventExitLevel>() )
{
g_pMusicPlayer->stop();
m_LevelPlay.setActive(false);
m_WorldMap.setActive(true);
m_LevelName = m_WorldMap.getLevelName();
m_WorldMap.loadAndPlayMusic();
EventContainer.add( new EventPlayerEndLevel(*ev) );
EventContainer.pop_Event();
eventContainer.add( new EventPlayerEndLevel(*ev) );
eventContainer.pop_Event();
}
else if( EventPlayTrack *ev = EventContainer.occurredEvent<EventPlayTrack>() )
else if( EventPlayTrack *ev = eventContainer.occurredEvent<EventPlayTrack>() )
{
g_pMusicPlayer->stop();
if( g_pMusicPlayer->loadTrack(m_ExeFile, ev->track) )
g_pMusicPlayer->play();
EventContainer.pop_Event();
eventContainer.pop_Event();
}
}
}
......
......@@ -53,5 +53,8 @@ void CMessageBoxBitmapGalaxy::init()
initText(rect);
mBitmap._draw( mpMBSurface.get(), 10, 10 );
const Uint16 bmpX = ( mAlignment == LEFT ) ? 10 : mMBRect.w-(mBitmap.getWidth()+32);
mBitmap._draw( mpMBSurface.get(), bmpX, 10 );
}
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