Commit 8185ff85 authored by Gerhard Stein's avatar Gerhard Stein

And more event pumping

parent c57bf385
......@@ -849,42 +849,35 @@ void CSpriteObject::processPushOutCollision()
}
}
void CSpriteObject::processEvents()
void CSpriteObject::pumpEvent(const CEvent *evPtr)
{
while(!m_EventCont.empty())
{
if( ObjMoveCouple* pObjMove = m_EventCont.occurredEvent<ObjMoveCouple>())
{
auto move = pObjMove->m_Vec;
processMove(move);
pObjMove->mSecond.processMove(move);
m_EventCont.pop_Event();
}
if( const ObjMoveCouple* pObjMove = dynamic_cast<const ObjMoveCouple*>(evPtr))
{
auto move = pObjMove->m_Vec;
processMove(move);
pObjMove->mSecond.processMove(move);
}
if( ObjMoveCouples* pObjMove = m_EventCont.occurredEvent<ObjMoveCouples>())
{
auto move = pObjMove->m_Vec;
auto playerVec = pObjMove->mCarriedObjVec;
if( const ObjMoveCouples* pObjMove = dynamic_cast<const ObjMoveCouples*>(evPtr))
{
auto move = pObjMove->m_Vec;
auto playerVec = pObjMove->mCarriedObjVec;
processMove(move);
processMove(move);
for(auto &player : playerVec)
for(auto &player : playerVec)
{
if(player)
{
if(player)
{
if(!player->m_jumpdownfromobject)
player->processMove(move);
}
if(!player->m_jumpdownfromobject)
player->processMove(move);
}
m_EventCont.pop_Event();
}
}
if( ObjMove* pObjMove = m_EventCont.occurredEvent<ObjMove>())
{
processMove(pObjMove->m_Vec);
m_EventCont.pop_Event();
}
}
if( const ObjMove* pObjMove = dynamic_cast<const ObjMove*>(evPtr))
{
processMove(pObjMove->m_Vec);
}
}
......@@ -553,13 +553,18 @@ void CPlayer::WalkingAnimation()
}
}
void CPlayer::pumpEvent(const CEvent *evPtr)
{
CSpriteObject::pumpEvent(evPtr);
mpCamera->pumpEvent(evPtr);
}
/*
* This function calls the camera object of the player
*/
void CPlayer::processCamera()
{
mpCamera->process();
mpCamera->processEvents();
}
......
......@@ -104,6 +104,7 @@ public:
bool checkMapBoundaryU(const int y1);
// Used for both situations
virtual void pumpEvent(const CEvent *evPtr);
void processCamera();
void InertiaAndFriction_X();
void Walking();
......
......@@ -75,8 +75,6 @@ void CPlayer::processInLevel()
if(!inhibitfall) Playerfalling();
}
processEvents();
if(pSupportedbyobject)
blockedd = true;
}
......
......@@ -42,7 +42,6 @@ void CPlayer::processWorldMap()
selectFrameOnWorldMap();
}
processEvents();
}
// select proper player direction
......
......@@ -113,7 +113,7 @@ public:
int scrx, scry; // x,y pixel position on screen
virtual void pumpEvent(const CEvent *evPtr) {}
virtual void pumpEvent(const CEvent *evPtr);
// Bounding Boxes
BoundingBox m_BBox;
......@@ -209,9 +209,6 @@ public:
virtual void process() { }
// The object can hold events process them here!
virtual void processEvents();
bool turnAroundOnCliff( int x1, int x2, int y2 );
......
......@@ -121,6 +121,8 @@ VectorD2<int> CPlayerWM::fetchFootDestCoord()
void CPlayerWM::pumpEvent(const CEvent *evPtr)
{
CSpriteObject::pumpEvent();
// Events for the Player are processed here.
if( const EventPlayerEndLevel* ev = dynamic_cast<const EventPlayerEndLevel*>(evPtr) )
{
......
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