Commit c44a4a10 authored by Gerhard Stein's avatar Gerhard Stein

Small changes to the Galaxy Engine. Next I will try to get an event using Alberts classes

parent 1dbd40aa
......@@ -81,9 +81,14 @@ void CPlayGameGalaxy::process()
// process World Map if active. At the start it's enabled
if(m_WorldMap.isActive())
{
Uint8 new_level;
m_WorldMap.process();
// TODO: Let's see, if Keen has selected a new level
if(m_WorldMap.PollNewLevel(new_level))
{
}
}
// process World Map if active. At the start it's enabled
......
......@@ -15,7 +15,8 @@ namespace galaxy {
CWorldMap::CWorldMap(CExeFile &ExeFile):
m_active(false),
m_ExeFile(ExeFile)
m_ExeFile(ExeFile),
m_newLevel(false)
{}
bool CWorldMap::isActive()
......@@ -58,6 +59,50 @@ void CWorldMap::process()
}
}
/**
* \brief This is called every game cycle. Here we check if the Player has chosen a new level
* \param new_level the new level that has been detected in case of
* \return return true, if player tries opening a level or false if not
*/
bool CWorldMap::PollNewLevel(Uint8 &new_level)
{
if(m_newLevel)
{
}
}
/*
* makes the player finish the level
*/
void CWorldMap::finishLevel(Uint16 object)
{
// if a door or other blocker was found remove it
int x, y;
Uint16 door = (object - 0xC000) + 0xD000;
while(mp_Map->findTile(door, &x, &y, 2))
{
// Open blocks in case there are
mp_Map->setTile( x, y, 0, true, 1);
mp_Map->setTile( x, y, 0, true, 2);
mp_Map->redrawAt( x, y);
}
Uint16 flag_dest = (object - 0xC000) + 0xF000;
if(mp_Map->findTile(flag_dest, &x, &y, 2))
{
// spawn the flag
VectorD2<Uint32> src(this->x, this->y);
VectorD2<Uint32> dst((x<<CSF), (y<<CSF));
CFlag *pFlag = new CFlag(mp_Map, src, dst);
m_ObjectPtrs.push_back(pFlag);
// Mark the tileinfo on the map as marked!!
mp_Map->setTile( x, y, 0, true, 2);
}
}
void CWorldMap::processInput()
{
......
......@@ -38,6 +38,8 @@ private:
Uint32 m_posy;
CExeFile &m_ExeFile;
bool m_newLevel;
};
}
......
......@@ -104,7 +104,7 @@ void CPlayerWM::processWalking()
Uint16 object = mp_Map->getPlaneDataAt(2, getXMidPos(), getYMidPos());
if(object)
{
finishlevel(object);
startLevel(object);
g_pInput->flushCommands();
}
}
......@@ -120,35 +120,12 @@ void CPlayerWM::processWalking()
}
/*
* makes the player finish the level
/**
* This function will help starting the level for Commander Keen
*/
void CPlayerWM::finishlevel(Uint16 object)
void CPlayerWM::startLevel(Uint16 object)
{
// if a door or other blocker was found remove it
int x, y;
Uint16 door = (object - 0xC000) + 0xD000;
while(mp_Map->findTile(door, &x, &y, 2))
{
// Open blocks in case there are
mp_Map->setTile( x, y, 0, true, 1);
mp_Map->setTile( x, y, 0, true, 2);
mp_Map->redrawAt( x, y);
}
Uint16 flag_dest = (object - 0xC000) + 0xF000;
if(mp_Map->findTile(flag_dest, &x, &y, 2))
{
// spawn the flag
VectorD2<Uint32> src(this->x, this->y);
VectorD2<Uint32> dst((x<<CSF), (y<<CSF));
CFlag *pFlag = new CFlag(mp_Map, src, dst);
m_ObjectPtrs.push_back(pFlag);
// Mark the tileinfo on the map as marked!!
mp_Map->setTile( x, y, 0, true, 2);
}
}
/**
......
......@@ -19,7 +19,7 @@ public:
void process();
void processWalking();
void finishlevel(Uint16 object);
void startLevel(Uint16 object);
void checkforSwimming();
void performWalkingAnimation(bool walking);
......
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