Commit 0b1ff59f authored by Gerhard Stein's avatar Gerhard Stein

Cheating structure improved and finally we have a cheat menu for android

users. Yay!
parent 7a471443
......@@ -206,7 +206,7 @@ void GsTilemap::drawTile(SDL_Surface *dst, int x, int y, Uint16 t)
BlitSurface(m_Tilesurface, &src_rect, dst, &dst_rect);
#ifdef DEBUG_COLLISION
//std::vector<CTileProperties> &TileProp = g_pBehaviorEngine->getTileProperties(1);
//std::vector<CTileProperties> &TileProp = gpBehaviorEngine->getTileProperties(1);
//FillSlopeRect(dst, dst_rect, 0xFFFFFFFF, TileProp[t].bup);
#endif
......
......@@ -54,7 +54,7 @@ void CGUISwitch::processRender(const GsRect<float> &RectDispCoordFloat)
displayRect.transform(RectDispCoordFloat);
/* SDL_Rect lRect = displayRect.SDLRect();
if(g_pBehaviorEngine->getEngine() == ENGINE_VORTICON)
if(gpBehaviorEngine->getEngine() == ENGINE_VORTICON)
{
drawVorticonStyle(lRect);
}
......
......@@ -18,7 +18,7 @@ CDlgFrame::CDlgFrame(int x, int y, int w, int h, int tilewidth, int tileheight)
m_y = y;
resize(w, h);
m_theme = g_pBehaviorEngine->getEngine();
m_theme = gpBehaviorEngine->getEngine();
}
......
......@@ -57,7 +57,7 @@ m_start_level(start_level)
{
g_pSound->unloadSoundData();
// The last menu has been removed. Restore back the game status
g_pBehaviorEngine->setPause(false);
gpBehaviorEngine->setPause(false);
gMenuController.clearMenuStack();
letchooseagain();
......@@ -758,7 +758,7 @@ void CGameLauncher::ponderPatchDialog()
// We have to check which Episode will be used
const int episode = getEpisode( m_chosenGame );
g_pBehaviorEngine->mPatchFname = mPatchFilename;
gpBehaviorEngine->mPatchFname = mPatchFilename;
if( episode > 0 ) // The game has to have a valid episode!
{
......
......@@ -27,6 +27,7 @@
#include <base/TypeDefinitions.h>
#include <base/GsEvent.h>
#include "engine/core/options.h"
#include "Cheat.h"
#include <base/GsEvent.h>
......@@ -38,7 +39,7 @@ const unsigned int MAX_PLAYERS = 1;
const unsigned int MAX_PLAYERS = 4;
#endif
#define g_pBehaviorEngine CBehaviorEngine::Get()
#define gpBehaviorEngine CBehaviorEngine::Get()
/*
* This enumerator will hold and tell what engine we are using.
......@@ -125,6 +126,8 @@ public:
std::string mapLevelName;
stCheat mCheatmode;
private:
std::vector<CTileProperties> m_TileProperties[2];
CPhysicsSettings m_PhysicsSettings;
......@@ -137,8 +140,7 @@ private:
bool mPausedGamePlay;
EpisodeInfoStruct *pEpisodeInfo;
EpisodeInfoStruct *pEpisodeInfo;
};
#endif /* CBEHAVIORENGINE_H_ */
......@@ -41,7 +41,7 @@ mp_AttachedObject(p_attacher)
void CCamera::cycleCamlead()
{
const int numPlayers = g_pBehaviorEngine->mPlayers;
const int numPlayers = gpBehaviorEngine->mPlayers;
if( numPlayers == 1 ) // For one player this doesn't make sense to change
return;
......
......@@ -58,12 +58,12 @@ void CHUD::setup(const int id)
m_Rect.x = 8; m_Rect.y = 4;
if(g_pBehaviorEngine->mPlayers > 3)
if(gpBehaviorEngine->mPlayers > 3)
{
m_Rect.x = 0; m_Rect.y = 0;
}
size_t Episode = g_pBehaviorEngine->getEpisode();
size_t Episode = gpBehaviorEngine->getEpisode();
if( Episode >= 1 && Episode <= 3 )
{
......@@ -131,7 +131,7 @@ void CHUD::CreateVorticonBackground()
int sprite=0;
const int Episode = g_pBehaviorEngine->getEpisode();
const int Episode = gpBehaviorEngine->getEpisode();
if(Episode == 1) sprite = OBJ_RAY_DEFSPRITE_EP1;
else if(Episode == 2) sprite = OBJ_RAY_DEFSPRITE_EP2;
else if(Episode == 3) sprite = OBJ_RAY_DEFSPRITE_EP3;
......@@ -231,7 +231,7 @@ void CHUD::renderGalaxy()
gGraphics.drawDigits(getRightAlignedString(itoa(charges),2),60, 20, blitsfc );
gGraphics.drawDigits(getRightAlignedString(itoa(lives),2), 20, 20, blitsfc );
if(g_pBehaviorEngine->mPlayers > 1 && mId == CCamera::getLead())
if(gpBehaviorEngine->mPlayers > 1 && mId == CCamera::getLead())
{
SDL_Rect rect;
rect.x = 7; rect.y = 29;
......@@ -275,7 +275,7 @@ void CHUD::renderVorticon()
void CHUD::render()
{
size_t Episode = g_pBehaviorEngine->getEpisode();
size_t Episode = gpBehaviorEngine->getEpisode();
timer++;
......
......@@ -147,9 +147,9 @@ void CMap::collectBlockersCoordiantes()
scrollBlockY.push_back(2<<CSF);
scrollBlockX.push_back(2<<CSF);
int ep = g_pBehaviorEngine->getEpisode();
int ep = gpBehaviorEngine->getEpisode();
if(g_pBehaviorEngine->getEngine() == ENGINE_GALAXY)
if(gpBehaviorEngine->getEngine() == ENGINE_GALAXY)
{
const word* map_ptr = m_Plane[2].getMapDataPtr();
......@@ -203,7 +203,7 @@ void CMap::fetchNearestVertBlockers(const int x, int &leftCoord, int &rightCoord
{
leftCoord = blockXleft;
if(leftCoord > (2<<CSF) && g_pBehaviorEngine->getEngine() == ENGINE_GALAXY)
if(leftCoord > (2<<CSF) && gpBehaviorEngine->getEngine() == ENGINE_GALAXY)
{
// This will hide even more level blockers in Galaxy. In Vorticon
// this is not needed
......@@ -251,7 +251,7 @@ void CMap::fetchNearestHorBlockers(const int y, int &upCoord, int &downCoord)
{
upCoord = blockYup;
if(g_pBehaviorEngine->getEngine() == ENGINE_GALAXY)
if(gpBehaviorEngine->getEngine() == ENGINE_GALAXY)
{
// This will hide even more level blockers in Galaxy. In Vorticon
// this is not needed
......@@ -803,7 +803,7 @@ void CMap::_drawForegroundTiles()
Uint16 y2 = (m_scrolly+num_h_tiles)>>TILE_S;
std::vector<CTileProperties> &TileProperties =
g_pBehaviorEngine->getTileProperties(1);
gpBehaviorEngine->getTileProperties(1);
auto visGA = gVideoDriver.mpVideoEngine->mRelativeVisGameArea;
......@@ -900,11 +900,11 @@ void CMap::animateAllTiles()
num_h_tiles = m_height-m_mapy;
std::vector<CTileProperties> &frontTileProperties =
g_pBehaviorEngine->getTileProperties(1);
gpBehaviorEngine->getTileProperties(1);
word *p_front_tile = m_Plane[1].getMapDataPtr();
std::vector<CTileProperties> &backTileProperties =
g_pBehaviorEngine->getTileProperties(0);
gpBehaviorEngine->getTileProperties(0);
word *p_back_tile = m_Plane[0].getMapDataPtr();
std::vector<Uint8> &timersBack = m_Plane[0].getTimers();
......
......@@ -382,7 +382,7 @@ bool CMessages::extractGlobalStrings()
std::map<std::string, std::string>::iterator i;
for( i = StringMap.begin() ; i != StringMap.end() ; i++ )
{
g_pBehaviorEngine->setMessage(i->first, i->second);
gpBehaviorEngine->setMessage(i->first, i->second);
}
gLogging.ftextOut("Loaded %d strings from the exe-file.<br>", StringMap.size());
return true;
......
......@@ -25,7 +25,7 @@ const int BLOCK_TOLERANCE_VORTICON = (2<<STC);
void CSpriteObject::setupCollisionModel()
{
// In future we might more stuff here. For now only the episode number so certain are considered or ignored.
episode = g_pBehaviorEngine->getEpisode();
episode = gpBehaviorEngine->getEpisode();
if(episode >= 4)
{
......@@ -177,7 +177,7 @@ void CSpriteObject::adjustSlopedTiles( int x, int y1, int y2, const int xspeed )
return;
// process the sloped tiles here. Galaxy only or special patch!!
if(g_pBehaviorEngine->getEpisode() > 3)
if(gpBehaviorEngine->getEpisode() > 3)
{
if(!moveSlopedTileDown(x, y2, xspeed))
moveSlopedTileUp(x, y1, xspeed);
......@@ -189,7 +189,7 @@ bool CSpriteObject::moveSlopedTileDown( int x, int y, const int xspeed )
if(yinertia!=0)
return false;
std::vector<CTileProperties> &TileProperty = g_pBehaviorEngine->getTileProperties();
std::vector<CTileProperties> &TileProperty = gpBehaviorEngine->getTileProperties();
const Sint8 slope = TileProperty[mp_Map->at(x>>CSF, y>>CSF)].bup;
......@@ -230,7 +230,7 @@ void CSpriteObject::moveSlopedTileUp( int x, int y, const int xspeed )
if(yinertia!=0)
return;
std::vector<CTileProperties> &TileProperty = g_pBehaviorEngine->getTileProperties();
std::vector<CTileProperties> &TileProperty = gpBehaviorEngine->getTileProperties();
const Sint8 slope = TileProperty[mp_Map->at(x>>CSF, y>>CSF)].bdown;
// Check first, if there is a tile on players level
......@@ -317,7 +317,7 @@ bool CSpriteObject::hitdetectWithTile(const int num, const int lx, const int ly,
*/
bool CSpriteObject::hitdetectWithTilePropertyRect(const Uint16 Property, int &lx, int &ly, const int lw, const int lh, const int res)
{
std::vector<CTileProperties> &Tile = g_pBehaviorEngine->getTileProperties(1);
std::vector<CTileProperties> &Tile = gpBehaviorEngine->getTileProperties(1);
int i,j;
Sint8 behavior;
......@@ -355,7 +355,7 @@ bool CSpriteObject::hitdetectWithTilePropertyRect(const Uint16 Property, int &lx
// Read only version. The detected position is not read. Just returns true and false. That's it!
bool CSpriteObject::hitdetectWithTilePropertyRectRO(const Uint16 Property, const int lx, const int ly, const int lw, const int lh, const int res)
{
std::vector<CTileProperties> &Tile = g_pBehaviorEngine->getTileProperties(1);
std::vector<CTileProperties> &Tile = gpBehaviorEngine->getTileProperties(1);
int i,j;
Sint8 behavior;
......@@ -383,7 +383,7 @@ bool CSpriteObject::hitdetectWithTilePropertyRectRO(const Uint16 Property, const
bool CSpriteObject::hitdetectWithTilePropertyHor(const Uint16 Property, const int lxl, const int lxr, const int ly, const int res)
{
std::vector<CTileProperties> &Tile = g_pBehaviorEngine->getTileProperties(1);
std::vector<CTileProperties> &Tile = gpBehaviorEngine->getTileProperties(1);
int i;
Sint8 behavior;
......@@ -404,7 +404,7 @@ bool CSpriteObject::hitdetectWithTilePropertyHor(const Uint16 Property, const in
bool CSpriteObject::hitdetectWithTilePropertyVert(const Uint16 Property, const int lx, const int lyu, const int lyd, const int res)
{
std::vector<CTileProperties> &Tile = g_pBehaviorEngine->getTileProperties(1);
std::vector<CTileProperties> &Tile = gpBehaviorEngine->getTileProperties(1);
int i;
Sint8 behavior;
......@@ -431,7 +431,7 @@ bool CSpriteObject::hitdetectWithTilePropertyVert(const Uint16 Property, const i
*/
bool CSpriteObject::hitdetectWithTileProperty(const int Property, const int x, const int y)
{
std::vector<CTileProperties> &Tile = g_pBehaviorEngine->getTileProperties(1);
std::vector<CTileProperties> &Tile = gpBehaviorEngine->getTileProperties(1);
const int tileID = mp_Map->getPlaneDataAt(1, x, y);
const Sint8 behavior = Tile[tileID].behaviour;
if( (behavior&0x7F) == Property ) // 0x7F is the mask which covers for foreground properties
......@@ -442,7 +442,7 @@ bool CSpriteObject::hitdetectWithTileProperty(const int Property, const int x, c
bool CSpriteObject::turnAroundOnCliff( int x1, int x2, int y2 )
{
std::vector<CTileProperties> &TileProperty = g_pBehaviorEngine->getTileProperties();
std::vector<CTileProperties> &TileProperty = gpBehaviorEngine->getTileProperties();
const int x_left = (x1-(1<<STC))>>CSF;
const int x_right = (x2+(1<<STC))>>CSF;
const int y_bottom = (y2+(1<<STC))>>CSF;
......@@ -541,7 +541,7 @@ bool CSpriteObject::checkMapBoundaryU(const int y1)
int CSpriteObject::checkSolidR( int x1, int x2, int y1, int y2)
{
std::vector<CTileProperties> &TileProperty = g_pBehaviorEngine->getTileProperties();
std::vector<CTileProperties> &TileProperty = gpBehaviorEngine->getTileProperties();
int blocker;
x2 += COLISION_RES;
......@@ -575,7 +575,7 @@ int CSpriteObject::checkSolidR( int x1, int x2, int y1, int y2)
int CSpriteObject::checkSolidL( int x1, int x2, int y1, int y2)
{
int blocker;
std::vector<CTileProperties> &TileProperty = g_pBehaviorEngine->getTileProperties();
std::vector<CTileProperties> &TileProperty = gpBehaviorEngine->getTileProperties();
x1 -= COLISION_RES;
......@@ -612,7 +612,7 @@ int CSpriteObject::checkSolidL( int x1, int x2, int y1, int y2)
int CSpriteObject::checkSolidU(int x1, int x2, int y1, const bool push_mode )
{
std::vector<CTileProperties> &TileProperty = g_pBehaviorEngine->getTileProperties();
std::vector<CTileProperties> &TileProperty = gpBehaviorEngine->getTileProperties();
y1 -= COLISION_RES;
......@@ -636,7 +636,7 @@ int CSpriteObject::checkSolidU(int x1, int x2, int y1, const bool push_mode )
int CSpriteObject::checkSolidD( int x1, int x2, int y2, const bool push_mode )
{
std::vector<CTileProperties> &TileProperty = g_pBehaviorEngine->getTileProperties();
std::vector<CTileProperties> &TileProperty = gpBehaviorEngine->getTileProperties();
y2 += COLISION_RES;
......@@ -750,7 +750,7 @@ void CSpriteObject::processMoveBitUp()
if( (blockedu = checkSolidU(x1, x2, y1)) == true)
{
if(g_pBehaviorEngine->getEpisode()<=3) // Galaxy only!
if(gpBehaviorEngine->getEpisode()<=3) // Galaxy only!
return;
// additionally if there is a narrow space and the object might fit in, try to move it into that space
......
......@@ -38,7 +38,7 @@ void CPassive::pumpEvent(const CEvent *evPtr)
if( dynamic_cast<const EventEndGamePlay*>(evPtr) )
{
// The last menu has been removed. Restore back the game status
g_pBehaviorEngine->setPause(false);
gpBehaviorEngine->setPause(false);
gMenuController.clearMenuStack();
mEndEpisode = true;
}
......
......@@ -255,7 +255,7 @@ void CSettings::loadDefaultGraphicsCfg() //Loads default graphics
*/
void CSettings::setOption( e_OptionKeyword opt, const std::string &menuname, const std::string &name, char value)
{
stOption &option = g_pBehaviorEngine->m_option[opt];
stOption &option = gpBehaviorEngine->m_option[opt];
option.menuname = menuname;
option.name = name;
option.value = value;
......@@ -289,7 +289,7 @@ bool CSettings::loadGameOptions()
loadDefaultGameCfg();
stOption *p_option = g_pBehaviorEngine->m_option;
stOption *p_option = gpBehaviorEngine->m_option;
for (i = 0; i < NUM_OPTIONS; i++)
{
bool newvalue;
......@@ -310,7 +310,7 @@ bool CSettings::saveGameOptions()
if(!Configuration.Parse()) return false;
stOption *p_option = g_pBehaviorEngine->m_option;
stOption *p_option = gpBehaviorEngine->m_option;
for (int i = 0; i < NUM_OPTIONS; i++)
Configuration.SetKeyword("Game", p_option[i].name, p_option[i].value);
......
......@@ -78,7 +78,7 @@ bool CSpriteObject::PoleCollision()
// This used for objects that only can trigger, when it's really worth to do so.
bool CSpriteObject::calcVisibility()
{
int visibility = g_pBehaviorEngine->getPhysicsSettings().misc.visibility;
int visibility = gpBehaviorEngine->getPhysicsSettings().misc.visibility;
SDL_Rect gameres = gVideoDriver.getGameResolution().SDLRect();
......@@ -103,9 +103,9 @@ bool CSpriteObject::verifyForFalling()
const auto fall1 = mp_Map->getPlaneDataAt(1, getXMidPos(), getYDownPos());
const auto fall2 = mp_Map->getPlaneDataAt(1, getXMidPos(), getYDownPos()+(1<<(CSF)));
const auto fall3 = mp_Map->getPlaneDataAt(1, getXMidPos(), getYDownPos()+(2<<(CSF)));
const CTileProperties &TileProp1 = g_pBehaviorEngine->getTileProperties(1)[fall1];
const CTileProperties &TileProp2 = g_pBehaviorEngine->getTileProperties(1)[fall2];
const CTileProperties &TileProp3 = g_pBehaviorEngine->getTileProperties(1)[fall3];
const CTileProperties &TileProp1 = gpBehaviorEngine->getTileProperties(1)[fall1];
const CTileProperties &TileProp2 = gpBehaviorEngine->getTileProperties(1)[fall2];
const CTileProperties &TileProp3 = gpBehaviorEngine->getTileProperties(1)[fall3];
const bool nothing_on_feet = (TileProp1.bup == 0);
const bool nothing_below_feet = (TileProp2.bup == 0) && (TileProp3.bup == 0);
const bool can_fall = (nothing_on_feet && nothing_below_feet);
......@@ -275,7 +275,7 @@ void CSpriteObject::InertiaAndFriction_X(const int friction_rate)
void CSpriteObject::processFallPhysics(const int boost)
{
CPhysicsSettings &Physics = g_pBehaviorEngine->getPhysicsSettings();
CPhysicsSettings &Physics = gpBehaviorEngine->getPhysicsSettings();
// In this case foe is jumping?
// Not sure here. We should use another variable...
......@@ -302,7 +302,7 @@ void CSpriteObject::processFallPhysics(const int boost)
void CSpriteObject::processFallPhysics()
{
CPhysicsSettings &Physics = g_pBehaviorEngine->getPhysicsSettings();
CPhysicsSettings &Physics = gpBehaviorEngine->getPhysicsSettings();
processFallPhysics(Physics.fallspeed_increase);
}
......
......@@ -47,7 +47,7 @@ void CGamePlayMode::ponder(const float deltaT)
}
else if( mp_PlayGame->getStartGame() )
{ // Start another new game
EventContainer.add( new GMSwitchToPlayGameMode(m_Episode, g_pBehaviorEngine->mPlayers, m_DataDirectory) );
EventContainer.add( new GMSwitchToPlayGameMode(m_Episode, gpBehaviorEngine->mPlayers, m_DataDirectory) );
}
else if( mp_PlayGame->getExitEvent() )
{
......@@ -60,7 +60,7 @@ void CGamePlayMode::render()
{
mp_PlayGame->render();
if(g_pBehaviorEngine->m_option[OPT_SHOWFPS].value)
if(gpBehaviorEngine->m_option[OPT_SHOWFPS].value)
{
SDL_Rect rect;
rect.x = 5;
......
......@@ -21,7 +21,7 @@ m_startgame(false),
m_exitgame(false),
m_gameover(false),
m_restartVideo(false),
mp_option(g_pBehaviorEngine->m_option)
mp_option(gpBehaviorEngine->m_option)
{
m_NumSprites = gGraphics.getNumSprites(0);
m_Gamepath = gKeenFiles.gameDir;
......@@ -37,7 +37,7 @@ void CPlayGame::pumpEvent(const CEvent *evPtr)
if( dynamic_cast<const EventEndGamePlay*>(evPtr) )
{
// The last menu has been removed. Restore back the game status
g_pBehaviorEngine->setPause(false);
gpBehaviorEngine->setPause(false);
gMenuController.clearMenuStack();
m_endgame = true;
}
......
......@@ -16,9 +16,9 @@
void KeenEngine::switchToGamePlayMode()
{
const int episode = g_pBehaviorEngine->getEpisode();
const int episode = gpBehaviorEngine->getEpisode();
auto &numPlayers = g_pBehaviorEngine->mPlayers;
auto &numPlayers = gpBehaviorEngine->mPlayers;
// If you get here, you always have at least one player
if(numPlayers <= 0)
......@@ -49,7 +49,7 @@ void KeenEngine::start()
gKeenFiles.setupFilenames(mEp);
g_pBehaviorEngine->setEpisode(mEp);
gpBehaviorEngine->setEpisode(mEp);
// Load the Resources
loadResources( LOADALL );
......@@ -61,7 +61,7 @@ void KeenEngine::pumpEvent(const CEvent *evPtr)
if( const StartNewGameEvent* pStart = dynamic_cast<const StartNewGameEvent*>(evPtr) )
{
g_pBehaviorEngine->mDifficulty = pStart->mDifficulty;
gpBehaviorEngine->mDifficulty = pStart->mDifficulty;
switchToGamePlayMode();
return;
}
......
......@@ -335,7 +335,7 @@ bool DreamsEngine::loadResources()
mLoader.setPermilage(10);
// Patch the EXE-File-Data directly in the memory.
CPatcher Patcher(ExeFile, g_pBehaviorEngine->mPatchFname);
CPatcher Patcher(ExeFile, gpBehaviorEngine->mPatchFname);
Patcher.process();
mLoader.setPermilage(50);
......
......@@ -24,9 +24,8 @@
namespace galaxy {
CLevelPlay::CLevelPlay(std::vector<CInventory> &inventory,
stCheat &Cheatmode) :
CMapPlayGalaxy(inventory, Cheatmode)
CLevelPlay::CLevelPlay(std::vector<CInventory> &inventory) :
CMapPlayGalaxy(inventory)
{ }
......@@ -35,14 +34,14 @@ void CLevelPlay::loadMap(const int level)
// Load the World map level.
std::unique_ptr<CMapLoaderGalaxy> MapLoader;
const int episode = g_pBehaviorEngine->getEpisode();
const int episode = gpBehaviorEngine->getEpisode();
if(episode == 4)
MapLoader.reset(new CMapLoaderGalaxyEp4(mObjectPtr, mInventoryVec, mCheatmode));
MapLoader.reset(new CMapLoaderGalaxyEp4(mObjectPtr, mInventoryVec));
else if(episode == 5)
MapLoader.reset(new CMapLoaderGalaxyEp5(mObjectPtr, mInventoryVec, mCheatmode));
MapLoader.reset(new CMapLoaderGalaxyEp5(mObjectPtr, mInventoryVec));
else if(episode == 6)
MapLoader.reset(new CMapLoaderGalaxyEp6(mObjectPtr, mInventoryVec, mCheatmode));
MapLoader.reset(new CMapLoaderGalaxyEp6(mObjectPtr, mInventoryVec));
MapLoader->loadMap( mMap, level );
......@@ -70,7 +69,7 @@ bool CLevelPlay::loadLevel(const Uint16 level)
// Add the load message
const std::string level_text = "LEVEL" + itoa(level) + "_LOAD_TEXT";
const std::string loading_text = g_pBehaviorEngine->getString(level_text);
const std::string loading_text = gpBehaviorEngine->getString(level_text);
showMsgWithBmp( loading_text, "KEENTHUMBSUP", LEFT );
......
......@@ -17,7 +17,7 @@ namespace galaxy {
class CLevelPlay : public CMapPlayGalaxy
{
public:
CLevelPlay(std::vector<CInventory> &inventory, stCheat &Cheatmode);
CLevelPlay(std::vector<CInventory> &inventory);
/**
* @brief loadLevel Makes this class load the map of the given level and the loading message. calls loadMap
......
......@@ -24,11 +24,10 @@
#include "GalaxyEngine.h"
CMapPlayGalaxy::CMapPlayGalaxy(std::vector<CInventory> &inventoryVec, stCheat &Cheatmode) :
CMapPlayGalaxy::CMapPlayGalaxy(std::vector<CInventory> &inventoryVec) :
mActive(false),
mInventoryVec(inventoryVec),
mpOption(g_pBehaviorEngine->m_option),
mCheatmode(Cheatmode),
mpOption(gpBehaviorEngine->m_option),
mMsgBoxOpen(false)
{}
......@@ -311,19 +310,19 @@ bool CMapPlayGalaxy::operator<<(CSaveGameController &savedGame)
savedGame.decodeData( level );
std::unique_ptr<galaxy::CMapLoaderGalaxy> mapLoader;
const unsigned int episode = g_pBehaviorEngine->getEpisode();
const unsigned int episode = gpBehaviorEngine->getEpisode();
if(episode == 4)
{
mapLoader.reset( new galaxy::CMapLoaderGalaxyEp4( mObjectPtr, mInventoryVec, mCheatmode) );
mapLoader.reset( new galaxy::CMapLoaderGalaxyEp4( mObjectPtr, mInventoryVec) );
}
else if(episode == 5)
{
mapLoader.reset( new galaxy::CMapLoaderGalaxyEp5( mObjectPtr, mInventoryVec, mCheatmode) );
mapLoader.reset( new galaxy::CMapLoaderGalaxyEp5( mObjectPtr, mInventoryVec) );
}
else if(episode == 6)
{
mapLoader.reset( new galaxy::CMapLoaderGalaxyEp6( mObjectPtr, mInventoryVec, mCheatmode) );
mapLoader.reset( new galaxy::CMapLoaderGalaxyEp6( mObjectPtr, mInventoryVec) );
}
else
{
......@@ -497,19 +496,19 @@ void CMapPlayGalaxy::operator<<(boost::property_tree::ptree &levelNode)
int level = levelNode.get<int>("level", 0);
std::unique_ptr<galaxy::CMapLoaderGalaxy> mapLoader;
const unsigned int episode = g_pBehaviorEngine->getEpisode();
const unsigned int episode = gpBehaviorEngine->getEpisode();
if(episode == 4)
{
mapLoader.reset( new galaxy::CMapLoaderGalaxyEp4( mObjectPtr, mInventoryVec, mCheatmode) );
mapLoader.reset( new galaxy::CMapLoaderGalaxyEp4( mObjectPtr, mInventoryVec) );
}
else if(episode == 5)
{
mapLoader.reset( new galaxy::CMapLoaderGalaxyEp5( mObjectPtr, mInventoryVec, mCheatmode) );
mapLoader.reset( new galaxy::CMapLoaderGalaxyEp5( mObjectPtr, mInventoryVec) );
}
else if(episode == 6)
{
mapLoader.reset( new galaxy::CMapLoaderGalaxyEp6( mObjectPtr, mInventoryVec, mCheatmode) );
mapLoader.reset( new galaxy::CMapLoaderGalaxyEp6( mObjectPtr, mInventoryVec) );
}
else
{
......
......@@ -30,7 +30,7 @@
class CMapPlayGalaxy
{
public:
CMapPlayGalaxy(std::vector<CInventory> &inventoryVec, stCheat &Cheatmode);
CMapPlayGalaxy(std::vector<CInventory> &inventoryVec);
bool isActive();
void setActive(const bool value);
......@@ -77,7 +77,6 @@ protected:
CMap mMap;
std::vector<CInventory> &mInventoryVec;
stOption *mpOption;
stCheat &mCheatmode;
bool mMsgBoxOpen;
};
......
......@@ -39,7 +39,7 @@ mSkipSection(false)
const GsRect<Uint16> gameRect = gVideoDriver.getVidConfig().m_GameRect;
gVideoDriver.setNativeResolution(gameRect);
const int episode = g_pBehaviorEngine->getEpisode();
const int episode = gpBehaviorEngine->getEpisode();
if(episode == 4)
mCreditsBmpID = 98;
......
......@@ -36,11 +36,11 @@ namespace galaxy
CPlayGameGalaxy::CPlayGameGalaxy(const int startlevel) :
CPlayGame(startlevel),
m_WorldMap( mInventoryVec, m_Cheatmode),
m_LevelPlay( mInventoryVec, m_Cheatmode),
m_WorldMap( mInventoryVec),
m_LevelPlay( mInventoryVec),
m_SavedGame(*gpSaveGameController)
{
const int numPlayers = g_pBehaviorEngine->mPlayers;
const int numPlayers = gpBehaviorEngine->mPlayers;
mDead.assign(numPlayers, false);
mGameOver.assign(numPlayers, false);
......@@ -80,10 +80,10 @@ bool CPlayGameGalaxy::loadGameState()
/// Save the Game in the CSavedGame object
// store the episode, level and difficulty
savedGame.decodeData(m_Episode);
savedGame.decodeData(g_pBehaviorEngine->mDifficulty);
savedGame.decodeData(gpBehaviorEngine->mDifficulty);
// Load number of Players
savedGame.decodeData(g_pBehaviorEngine->mPlayers);
savedGame.decodeData(gpBehaviorEngine->mPlayers);
// We need to load both Levels first, before we do the writing from the saved state.
......@@ -124,11 +124,11 @@ bool CPlayGameGalaxy::loadXMLGameState()
/// Load the Game in the CSavedGame object
// Get the episode, and difficulty
m_Episode = stateNode.get<int>("episode");
g_pBehaviorEngine->mDifficulty = static_cast<Difficulty>(stateNode.get<int>("difficulty", 1));
gpBehaviorEngine->mDifficulty = static_cast<Difficulty>(stateNode.get<int>("difficulty", 1));
// Get number of Players
const unsigned int numPlayers = stateNode.get<int>("NumPlayer");
g_pBehaviorEngine->mPlayers = numPlayers;
gpBehaviorEngine->mPlayers = numPlayers;
if(!mInventoryVec.empty())
mInventoryVec.clear();
......@@ -193,10 +193,10 @@ bool CPlayGameGalaxy::saveXMLGameState()
/// Save the Game in the CSavedGame object
// store the episode, level and difficulty
stateNode.put("difficulty", g_pBehaviorEngine->mDifficulty);
stateNode.put("difficulty", gpBehaviorEngine->mDifficulty);