Commit f49082df authored by Gerstrong's avatar Gerstrong

Added Princess Lindsey AI and fixed some Lick Bugs

parent 6a5f40b4
......@@ -38,6 +38,7 @@
#include "engine/galaxy/ai/ep4/CDevilSprite.h"
#include "engine/galaxy/ai/ep4/CSchoolFish.h"
#include "engine/galaxy/ai/ep4/CLick.h"
#include "engine/galaxy/ai/ep4/CLindsey.h"
// General stuff
#include "engine/galaxy/ai/CSpriteItem.h"
......@@ -409,6 +410,11 @@ void CMapLoaderGalaxy::addFoe(CMap &Map, word foe, size_t x, size_t y)
p_newfoe = new galaxy::CCouncilMember(&Map, x, y-750);
break;
case 6:
//This is pincess Lindsey.
p_newfoe = new galaxy::CLindsey(&Map, x, y-750);
break;
case 12:
//This is a Bounder.
// TODO: Those relative coordinates are not a good sign. Try to remove them and make the Sprite substract them
......
......@@ -44,6 +44,7 @@ void CBounder::getTouchedBy(CObject &theObject)
mp_processState = &CStunnable::processGettingStunned;
setAction( A_BOUNDER_STUNNED );
dead = true;
theObject.dead = true;
}
}
......
......@@ -28,7 +28,7 @@ CStunnable(pmap, x, y, OBJ_NONE),
m_timer(0)
{
setupGalaxyObjectOnMap(0x2FC6, A_LICK_HOP);
mp_processState = &CLick::processHop;
mp_processState = (void (CStunnable::*)()) (&CLick::processHop);
}
void CLick::process()
......@@ -52,6 +52,7 @@ void CLick::getTouchedBy(CObject &theObject)
{
mp_processState = &CStunnable::processGettingStunned;
setAction( A_LICK_STUNNED );
theObject.dead = true;
dead = true;
}
......@@ -83,7 +84,7 @@ bool CLick::isNearby(CObject &theObject)
if( absdx < CSF_MIN_DISTANCE_TO_BREATHE )
{
setAction(A_LICK_BREATHE);
mp_processState = &CLick::processBreathe;
mp_processState = (void (CStunnable::*)()) (&CLick::processBreathe);
m_timer = LICK_BREATHE_TIMER;
}
}
......@@ -103,7 +104,7 @@ void CLick::processHop()
if(blockedd)
{
mp_processState = &CLick::processLand;
mp_processState = (void (CStunnable::*)()) (&CLick::processLand);
setAction( A_LICK_LAND );
}
}
......@@ -111,7 +112,7 @@ void CLick::processHop()
void CLick::processLand()
{
// After a moment he might hop again
mp_processState = &CLick::processHop;
mp_processState = (void (CStunnable::*)()) (&CLick::processHop);
setAction( A_LICK_HOP );
yinertia = -100;
......@@ -124,7 +125,7 @@ void CLick::processBreathe()
m_timer--;
if(getActionStatus(A_LICK_HOP+2))
{
mp_processState = &CLick::processHop;
mp_processState = (void (CStunnable::*)()) (&CLick::processHop);
setAction( A_LICK_HOP );
}
}
......
......@@ -32,8 +32,6 @@ private:
void processBreathe();
void processStunned();
void (CLick::*mp_processState)();
int m_timer;
};
......
/*
* CLindsey.cpp
*
* Created on: 14.08.2011
* Author: gerstrong
*/
#include "CLindsey.h"
namespace galaxy {
const int LINDSEY_MOVE_SPEED = 20;
const int LINDSEY_MOVE_TIME = 60;
CLindsey::CLindsey(CMap *pmap, Uint32 x, Uint32 y) :
CObject(pmap, x, y, OBJ_NONE),
m_timer(0)
{
setupGalaxyObjectOnMap(0x38EA, 0);
answermap[0] = "LINDSEY_START_TEXT";
answermap[1] = "LINDSEY_END_TEXT1";
answermap[2] = "LINDSEY_END_TEXT2";
}
void CLindsey::process()
{
if(m_timer <= 0)
{
m_timer = LINDSEY_MOVE_SPEED;
m_vDir = (m_vDir==UP) ? DOWN : UP;
}
if(m_vDir == UP)
moveUp(LINDSEY_MOVE_SPEED);
else
moveDown(LINDSEY_MOVE_SPEED);
m_timer--;
processActionRoutine();
}
void CLindsey::getTouchedBy(CObject &theObject)
{
// When Keen touches the pincess give that hint
if(theObject.m_type == OBJ_PLAYER)
{
CEventContainer& EventContainer = g_pBehaviorEngine->m_EventList;
g_pSound->playSound(SOUND_GET_WETSUIT, PLAY_PAUSEALL);
EventContainer.add( new EventPlayTrack(5) );
std::string lindsey_text[3];
//lindsey_text[0] = g_pBehaviorEngine->getString(answermap[0]);
//lindsey_text[1] = g_pBehaviorEngine->getString(answermap[1]);
//lindsey_text[2] = g_pBehaviorEngine->getString(answermap[2]);
lindsey_text[0] = "Princess Lindsey has to say the folling (Fake Message):";
lindsey_text[1] = "Blah Blah (Message)";
lindsey_text[2] = "Thanks Highness! (Fake Message)";
EventContainer.add( new EventSendBitmapDialogMsg(108, lindsey_text[0], LEFT) );
EventContainer.add( new EventSendBitmapDialogMsg(108, lindsey_text[1], LEFT) );
EventContainer.add( new EventSendBitmapDialogMsg(106, lindsey_text[2], RIGHT) );
exists = false;
}
}
} /* namespace galaxy */
/*
* CLindsey.h
*
* Created on: 14.08.2011
* Author: gerstrong
*
* The princess that is able to give a hint to Billy Blaze
*/
#ifndef CLINDSEY_H_
#define CLINDSEY_H_
#include "common/CObject.h"
namespace galaxy {
class CLindsey : public CObject {
public:
CLindsey(CMap *pmap, Uint32 x, Uint32 y);
void process();
void getTouchedBy(CObject &theObject);
private:
int m_timer;
std::map<int, std::string> answermap;
};
} /* namespace galaxy */
#endif /* CLINDSEY_H_ */
......@@ -100,6 +100,7 @@ void CPoisonSlug::getTouchedBy(CObject &theObject)
mp_processState = &CStunnable::processGettingStunned;
setAction( rand()%2 ? A_SLUG_STUNNED : A_SLUG_STUNNED_ALT );
dead = true;
theObject.dead = true;
}
if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) )
......
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