Commit b5dbb3e1 authored by Gerhard Stein's avatar Gerhard Stein

Autogun and Flag bugs in Game states finally fixed and I hope it stays this way

parent c608a252
......@@ -110,6 +110,11 @@ word *CMap::getData(Uint8 PlaneNum)
return m_Plane[PlaneNum].getMapDataPtr();
}
word *CMap::getInfoData()
{
return m_Plane[2].getMapDataPtr();
}
word *CMap::getForegroundData()
{
return m_Plane[1].getMapDataPtr();
......
......@@ -97,6 +97,7 @@ public:
}
word *getData(Uint8 PlaneNum);
word *getInfoData();
word *getForegroundData();
word *getBackgroundData();
......
......@@ -42,7 +42,9 @@ void CGamePlayMode::init()
if(m_Episode >= 4)
{
if(m_startLevel == WORLD_MAP_LEVEL_VORTICON)
m_startLevel = WORLD_MAP_LEVEL_GALAXY;
{
m_startLevel = WORLD_MAP_LEVEL_GALAXY;
}
mp_PlayGame.reset( new galaxy::CPlayGameGalaxy( ExeFile, m_startLevel, m_Numplayers, m_SavedGame) );
}
else
......@@ -66,6 +68,7 @@ void CGamePlayMode::init()
}
}
void CGamePlayMode::loadGame()
{
mp_PlayGame->process();
......
......@@ -275,6 +275,7 @@ void CMapPlayGalaxy::operator>>(CSaveGameController &savedGame)
savedGame.addData( reinterpret_cast<byte*>(mMap.getBackgroundData()), mapSize );
savedGame.addData( reinterpret_cast<byte*>(mMap.getForegroundData()), mapSize );
savedGame.addData( reinterpret_cast<byte*>(mMap.getInfoData()), mapSize );
}
......@@ -380,6 +381,7 @@ bool CMapPlayGalaxy::operator<<(CSaveGameController &savedGame)
savedGame.readDataBlock( reinterpret_cast<byte*>(mMap.getBackgroundData()) );
savedGame.readDataBlock( reinterpret_cast<byte*>(mMap.getForegroundData()) );
savedGame.readDataBlock( reinterpret_cast<byte*>(mMap.getInfoData()) );
if( mMap.m_width * mMap.m_height > 0 )
{
......
......@@ -66,11 +66,11 @@ mTimer(0)
else
{
mNumAnimSprites = 2;
dontdraw = true;
}
processState = &AutoShot::waiting;
sprite = mBaseSprite;
dontdraw = true;
sprite = mBaseSprite;
origin = getPosition();
......
......@@ -26,9 +26,9 @@ const Uint16 ANIMATION_TIME = 8;
const Uint16 SPEED = 64;
CFlag::CFlag(CMap *pmap, const VectorD2<Uint32> &Location,
const VectorD2<Uint32> &Destination) :
const VectorD2<Uint32> &Destination,
bool newAction) :
CGalaxySpriteObject(pmap, FOE_ID, Location.x, Location.y),
m_location(Location),
m_destination(Destination),
m_baseframe(0)
{
......@@ -53,9 +53,10 @@ m_baseframe(0)
else
{
setupGalaxyObjectOnMap(0x15EE, A_FLAG_FLIP);
}
alignToTile();
}
if(!newAction)
moveTo(m_destination);
}
void CFlag::getTouchedBy(CSpriteObject &theObject)
......@@ -95,9 +96,9 @@ void CFlag::process()
*/
void CFlag::processFlipping()
{
if(m_destination != m_location)
if(m_Pos != m_destination)
{
VectorD2<int> dir = m_destination - m_location;
VectorD2<int> dir = m_destination - m_Pos;
float length = dir.GetLength();
VectorD2<float> base_dir( dir.x/length, dir.y/length );
......@@ -106,10 +107,9 @@ void CFlag::processFlipping()
moveTo(m_destination);
}
else
{
moveDir(base_dir*SPEED);
m_location.x = getXPosition();
m_location.y = getYPosition();
}
}
else
{
......
......@@ -21,10 +21,11 @@ namespace galaxy {
class CFlag : public CGalaxySpriteObject
{
public:
static const unsigned int FOE_ID = 100;
static const unsigned int FOE_ID = 200;
CFlag(CMap *pmap, const VectorD2<Uint32> &Location,
const VectorD2<Uint32> &Destination);
const VectorD2<Uint32> &Destination,
const bool newAction = true);
void getTouchedBy(CSpriteObject &theObject);
......@@ -38,7 +39,6 @@ public:
private:
// Where the flag/sign will pop in
VectorD2<Uint32> m_location;
VectorD2<Uint32> m_destination;
Uint16 m_baseframe;
void (CFlag::*processState)();
......
......@@ -839,12 +839,10 @@ void CPlayerWM::finishLevel(const int object)
csfY += (2<<STC);
if(g_pBehaviorEngine->getEpisode() == 5)
if(episode == 5)
{
csfX -= (14<<STC);
if(episode != 5)
csfY -= (1<<CSF);
csfY -= (1<<CSF);
}
else
{
......@@ -858,7 +856,7 @@ void CPlayerWM::finishLevel(const int object)
g_pBehaviorEngine->m_EventList.spawnObj(pFlag);
// Mark the tileinfo on the map as marked!!
// Mark the tileinfo on the map as level finished!! So player cannot just re-enter. Exception is if replayability is on.
mp_Map->setTile( x, y, 0, true, 2);
}
}
......
......@@ -363,10 +363,11 @@ CGalaxySpriteObject* CMapLoaderGalaxyEp4::addFoe(CMap &Map, word foe, size_t x,
p_newfoe = new galaxy::CDopeFish(&Map, foe, x, y);
break;
// Not sure if after that there are more sprites to load
// Not sure if after that there are more sprites to load
// This special sprite is only loaded by saved game. Normal gamemaps do not have that flag
case CFlag::FOE_ID:
p_newfoe = new galaxy::CFlag(&Map, loc, loc);
p_newfoe = new galaxy::CFlag(&Map, loc, loc, false);
break;
......
......@@ -346,7 +346,12 @@ CGalaxySpriteObject* CMapLoaderGalaxyEp5::addFoe(CMap &Map, word foe, size_t x,
break;
// Not sure if after that there are more sprites to load
// This special sprite is only loaded by saved game. Normal gamemaps do not have that flag
case CFlag::FOE_ID:
p_newfoe = new galaxy::CFlag(&Map, loc, loc, false);
break;
default:
break;
}
......
......@@ -163,6 +163,12 @@ CGalaxySpriteObject* CMapLoaderGalaxyEp6::addFoe(CMap &Map, word foe, size_t x,
case PLATFORM_DROP:
p_newfoe = new galaxy::CPlatformDrop(&Map, foe, x, y); break;*/
// Not sure if after that there are more sprites to load
// This special sprite is only loaded by saved game. Normal gamemaps do not have that flag
case CFlag::FOE_ID:
p_newfoe = new galaxy::CFlag(&Map, loc, loc, false);
break;
default:
break;
......
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