Commit e0fd8b04 authored by Gerstrong's avatar Gerstrong

Council Members talk now have variations...

parent 16d2f967
......@@ -19,13 +19,26 @@ struct CEvent { virtual ~CEvent() {} };
struct EventEnterLevel : CEvent {
uint16_t data;
EventEnterLevel(uint16_t d) : data(d) {}
EventEnterLevel(const uint16_t d) : data(d) {}
};
struct EventExitLevel : CEvent {
uint16_t levelObject;
bool sucess;
EventExitLevel(uint16_t l, const bool s) : levelObject(l), sucess(s){}
const uint16_t levelObject;
const bool sucess;
EventExitLevel(const uint16_t l, const bool s) : levelObject(l), sucess(s){}
};
struct EventPlayerEndLevel : CEvent {
const uint16_t levelObject;
const bool sucess;
EventPlayerEndLevel(const EventExitLevel &ev) :
levelObject(ev.levelObject), sucess(ev.sucess) {}
};
struct EventPlayTrack : CEvent {
const uint32_t track;
EventPlayTrack(const uint16_t t) : track(t) {}
};
......
......@@ -96,7 +96,7 @@ bool CMessages::extractEp4Strings(std::map<std::string, std::string>& StringMap)
StringMap.insert( extractString( "KEEN_NOSWEAT_TEXT", 0x30A71, 0x30A92 ) );
StringMap.insert( extractString( "KEEN_BEARDED_ONE_TEXT", 0x30A93, 0x30AB2 ) );
StringMap.insert( extractString( "KEEN_NO_PROBLEMO_TEXT3", 0x30AB3, 0x30ABF ) );
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 ) );
StringMap.insert( extractString( "KEEN_GOOD_IDEA_GRAMPS", 0x30B00, 0x30B12 ) );
......
......@@ -148,7 +148,7 @@ void CPlayGameGalaxy::process()
if(MessageBoxQueue.empty())
{
if( EventEnterLevel* ev = EventContainer.occurredEvent<EventEnterLevel>() )
if( EventEnterLevel *ev = EventContainer.occurredEvent<EventEnterLevel>() )
{
// Start a new level!
if(ev->data > 0xC000)
......@@ -163,13 +163,22 @@ void CPlayGameGalaxy::process()
}
EventContainer.pop_Event();
}
else if( 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.pop_Event();
EventContainer.add( new EventPlayerEndLevel(*ev) );
}
else if( EventPlayTrack *ev = EventContainer.occurredEvent<EventPlayTrack>() )
{
g_pMusicPlayer->stop();
if(g_pMusicPlayer->loadTrack(m_ExeFile, ev->track));
g_pMusicPlayer->play();
EventContainer.pop_Event();
}
}
}
......
......@@ -27,6 +27,16 @@ m_timer(0)
mp_processState = &CCouncilMember::processWalking;
setActionSprite();
calcBouncingBoxes();
answermap[0] = "KEEN_NOSWEAT_TEXT";
answermap[1] = "KEEN_BEARDED_ONE_TEXT";
answermap[2] = "KEEN_NO_PROBLEMO_TEXT";
answermap[3] = "KEEN_GREAT_TEXT";
answermap[4] = "KEEN_LOOKS_LIKE_SAME_GUY_TEXT";
answermap[5] = "KEEN_GOOD_IDEA_GRAMPS";
answermap[6] = "KEEN_ROAD_RISE_FEET_TEXT";
answermap[7] = "KEEN_WISE_PLAN_TEXT";
answermap[8] = "KEEN_LAST_ELDER_TEXT";
}
......@@ -109,26 +119,28 @@ void CCouncilMember::getTouchedBy(CObject &theObject)
if(theObject.m_type == OBJ_PLAYER)
{
CPlayerLevel &Player = static_cast<CPlayerLevel&>(theObject);
int &rescuedelders = Player.m_Inventory.Item.m_special.ep4.elders;
CEventContainer& EventContainer = g_pBehaviorEngine->m_EventList;
// TODO: Also we need to play the elder sound and the proper Music to it!
// TODO: In this part we have to check which level we are and send the proper messages
g_pSound->playSound(SOUND_RESCUE_COUNCIL_MEMBER, PLAY_PAUSEALL);
//g_pMusicPlayer->LoadfromMusicTable();
EventContainer.add( new EventPlayTrack(5) );
std::string elder_text[2];
elder_text[0] = g_pBehaviorEngine->getString("ELDERS_TEXT");
elder_text[1] = g_pBehaviorEngine->getString("KEEN_NOSWEAT_TEXT");
elder_text[1] = g_pBehaviorEngine->getString(answermap[rescuedelders]);
EventContainer.add( new EventSendBitmapDialogMsg(104, elder_text[0], LEFT) );
EventContainer.add( new EventSendBitmapDialogMsg(106, elder_text[1], RIGHT) );
if(rescuedelders == 7)
EventContainer.add( new EventSendBitmapDialogMsg(106, g_pBehaviorEngine->getString(answermap[8]), RIGHT) );
EventContainer.add( new EventExitLevel(mp_Map->getLevel(), true) );
Player.m_Inventory.Item.m_special.ep4.elders++;
rescuedelders++;
rescued = true;
}
......
......@@ -11,6 +11,8 @@
#define CCOUNCIL_MEMBER_H_
#include "common/CObject.h"
#include <map>
#include <string>
namespace galaxy {
......@@ -36,6 +38,7 @@ private:
bool rescued;
int m_timer;
void (CCouncilMember::*mp_processState)();
std::map<int, std::string> answermap;
};
}
......
......@@ -55,10 +55,12 @@ void CPlayerWM::process()
// Events for the Player are processed here.
CEventContainer& EventContainer = g_pBehaviorEngine->m_EventList;
if( EventExitLevel* ev = EventContainer.occurredEvent<EventExitLevel>() )
if( EventPlayerEndLevel* ev = EventContainer.occurredEvent<EventPlayerEndLevel>() )
{
if(ev->sucess)
{
finishLevel(ev->levelObject);
}
EventContainer.pop_Event();
}
......
......@@ -20,6 +20,23 @@ CMusic::CMusic() :
mp_player(NULL)
{}
bool CMusic::loadTrack(const CExeFile& ExeFile, const int track)
{
m_AudioSpec = g_pSound->getAudioSpec();
CIMFPlayer *imf_player = new CIMFPlayer(m_AudioSpec);
imf_player->loadMusicTrack(ExeFile, track);
mp_player = imf_player;
if(!mp_player->open())
{
delete mp_player;
mp_player = NULL;
return false;
}
return true;
}
bool CMusic::load(const CExeFile& ExeFile, const int level)
{
m_AudioSpec = g_pSound->getAudioSpec();
......
......@@ -27,6 +27,10 @@ public:
CMusic();
virtual ~CMusic();
/**
* Loads certain track of the Keen Music
*/
bool loadTrack(const CExeFile& ExeFile, const int track);
bool load(const CExeFile& ExeFile, const int level);
bool load(const std::string &musicfile);
void reload();
......
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