Commit d1958b4f authored by Gerstrong's avatar Gerstrong

Now the dead Keen dialog is shown correctly. It's not the same as in galaxy, I...

Now the dead Keen dialog is shown correctly. It's not the same as in galaxy, I was lazy, but it works.
parent 45bd6a77
......@@ -23,6 +23,10 @@ CDlgFrame::CDlgFrame(int x, int y, int w, int h, Uint8 theme, int tilewidth, int
}
int CDlgFrame::TileWidth()
{
return m_8x8tilewidth;
}
void CDlgFrame::draw(SDL_Surface *dst)
......
......@@ -37,6 +37,11 @@ public:
*/
void setPos(const Uint32 x, const Uint32 y);
/**
* Getter for Tile width
*/
int TileWidth();
int m_x;
int m_y;
int m_w;
......
......@@ -32,8 +32,7 @@ struct EventExitLevel : CEvent {
};
struct EventRestartLevel : CEvent {
const uint16_t levelObject;
EventRestartLevel(const uint16_t l) : levelObject(l) {}
};
......
......@@ -94,8 +94,8 @@ bool CMessages::extractEp4Strings(std::map<std::string, std::string>& StringMap)
StringMap.insert( extractString( "SWIM_SUIT_TEXT", 0x30A4C, 0x30A72 ) );
StringMap.insert( extractString( "KEEN_NOSWEAT_TEXT", 0x30A71, 0x30A92 ) );
StringMap.insert( extractString( "KEEN_BEARDED_ONE_TEXT", 0x30A93, 0x30AB2 ) );
StringMap.insert( extractString( "KEEN_NOSWEAT_TEXT", 0x30A71, 0x30A91 ) );
StringMap.insert( extractString( "KEEN_BEARDED_ONE_TEXT", 0x30A92, 0x30AB2 ) );
StringMap.insert( extractString( "KEEN_NO_PROBLEMO_TEXT", 0x30AB3, 0x30ABF ) );
StringMap.insert( extractString( "KEEN_GREAT_TEXT", 0x30AC0, 0x30AC7 ) );
StringMap.insert( extractString( "KEEN_LOOKS_LIKE_SAME_GUY_TEXT", 0x30AC8, 0x30AFF ) );
......
......@@ -23,12 +23,12 @@ CMapPlayGalaxy(ExeFile, Inventory)
{ }
bool CLevelPlay::loadLevel(const Uint16 level)
void CLevelPlay::loadMap(const int level)
{
// Load the World map level.
CMapLoaderGalaxy MapLoader(m_ExeFile, m_ObjectPtr, m_Inventory, m_Cheatmode);
MapLoader.loadMap(m_Map, level);
MapLoader.loadMap( m_Map, level );
// Load the Background Music
g_pMusicPlayer->stop();
......@@ -37,6 +37,17 @@ bool CLevelPlay::loadLevel(const Uint16 level)
g_pLogFile->textOut("Warning: The music cannot be played. Check that all the files have been correctly copied!");
else
g_pMusicPlayer->play();
}
void CLevelPlay::reloadLevel()
{
loadMap( m_Map.getLevel() );
}
bool CLevelPlay::loadLevel(const Uint16 level)
{
loadMap( level );
// Add the load message
const std::string level_text = "LEVEL" + itoa(level) + "_LOAD_TEXT";
......
......@@ -18,6 +18,9 @@ class CLevelPlay : public CMapPlayGalaxy {
public:
CLevelPlay(CExeFile &ExeFile, CInventory &Inventory);
void loadMap(const int level);
void reloadLevel();
bool loadLevel(const Uint16 level);
};
......
......@@ -131,8 +131,6 @@ void CPlayGameGalaxy::process()
{
m_Inventory.drawStatus();
}
processRendering();
}
// In this part we will poll all the relevant Events that are important for the
......@@ -148,6 +146,7 @@ void CPlayGameGalaxy::process()
}
else if( EventSendSelectionDialogMsg* ev = EventContainer.occurredEvent<EventSendSelectionDialogMsg>() )
{
g_pMusicPlayer->stop();
MessageBoxQueue.push_back( new CMessageBoxSelection( ev->Message, ev->Options ) );
EventContainer.pop_Event();
}
......@@ -170,15 +169,10 @@ void CPlayGameGalaxy::process()
}
EventContainer.pop_Event();
}
else if( EventRestartLevel *ev = EventContainer.occurredEvent<EventEnterLevel>() )
else if( EventContainer.occurredEvent<EventRestartLevel>() )
{
// Start a new level!
if(ev->data > 0xC000)
{
const Uint16 NewLevel = ev->data - 0xC000;
g_pMusicPlayer->stop();
m_LevelPlay.loadLevel(NewLevel);
}
g_pMusicPlayer->stop();
m_LevelPlay.reloadLevel();
EventContainer.pop_Event();
}
else if( EventExitLevel *ev = EventContainer.occurredEvent<EventExitLevel>() )
......
......@@ -38,7 +38,7 @@ public:
void processInput();
void processRendering();
void cleanup();
void cleanup() {};
virtual ~CPlayGameGalaxy();
......
......@@ -989,9 +989,11 @@ void CPlayerLevel::processDead()
// Create the Event Selection screen
CEventContainer& EventContainer = g_pBehaviorEngine->m_EventList;
EventSendSelectionDialogMsg *pdialogevent = new EventSendSelectionDialogMsg("Loser!");
pdialogevent->addOption("Exit Level", new EventExitLevel(mp_Map->getLevel(), false) );
pdialogevent->addOption("Restart Level", new EventRestartLevel(mp_Map->getLevel()) );
std::string loosemsg = "You didn't make it past\n";
loosemsg += mp_Map->getLevelName();
EventSendSelectionDialogMsg *pdialogevent = new EventSendSelectionDialogMsg(loosemsg);
pdialogevent->addOption("Try Again", new EventRestartLevel() );
pdialogevent->addOption("Exit to World Map", new EventExitLevel(mp_Map->getLevel(), false) );
EventContainer.add( pdialogevent );
m_dying = false;
......
......@@ -32,6 +32,8 @@ CMessageBox(Text, false, false, false)
width = newwidth;
}
width += 16;
m_text_height = Font.getPixelTextHeight();
m_boxrect.h = (m_text_height+2)*m_Lines.size()+16;
m_boxrect.w = width;
......
......@@ -25,6 +25,8 @@ m_selection(0)
m_boxrect.y = m_boxrect.h/2;
int width = 0;
// Get the max width of all the written lines
for( size_t i=0 ; i<m_Lines.size() ; i++)
{
const int newwidth = Font.getPixelTextWidth(m_Lines[i]);
......@@ -32,8 +34,18 @@ m_selection(0)
width = newwidth;
}
std::list<TextEventMatchOption>::iterator it = m_Options.begin();
for( ; it != m_Options.end() ; it++)
{
const int newwidth = Font.getPixelTextWidth(it->text);
if( width < newwidth )
width = newwidth;
}
width += 16;
m_text_height = Font.getPixelTextHeight();
m_boxrect.h = (m_text_height+2)*m_Lines.size()+16;
m_boxrect.h = (m_text_height+2)*(m_Lines.size()+m_Options.size()+ 1) + 16;
m_boxrect.w = width;
m_boxrect.x -= m_boxrect.w/2;
......@@ -62,6 +74,7 @@ void CMessageBoxSelection::process()
EventContainer.add( m_Options.front().event );
m_mustclose = true;
g_pInput->flushCommands();
return;
}
else if(g_pInput->getPressedCommand(IC_DOWN))
......@@ -91,8 +104,16 @@ void CMessageBoxSelection::process()
for( size_t i=0 ; i<m_Lines.size() ; i++)
g_pGfxEngine->getFont(FONT_ID).drawFont(sfc, m_Lines[i], m_boxrect.x+m_TextPos.x, m_boxrect.y+(i*m_text_height+m_TextPos.y) );
for( size_t i=0 ; i<m_Options.size() ; i++)
g_pGfxEngine->getFont(FONT_ID).drawFont(sfc, m_Options.back().text, m_boxrect.x+m_TextPos.x, m_boxrect.y+((m_Lines.size()+i+1)*m_text_height+m_TextPos.y) );
std::list<TextEventMatchOption>::iterator it = m_Options.begin();
for( int i=0 ; it != m_Options.end() ; it++, i++)
{
if(i == m_selection)
g_pGfxEngine->getFont(FONT_ID).setFGColour(sfc->format, 0xFF0000FF);
else
g_pGfxEngine->getFont(FONT_ID).setFGColour(sfc->format, 0xFF000000);
g_pGfxEngine->getFont(FONT_ID).drawFont(sfc, it->text, m_boxrect.x+m_TextPos.x, m_boxrect.y+((m_Lines.size()+i+1)*m_text_height+m_TextPos.y) );
}
}
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