Commit ebc6b48c authored by Gerhard Stein's avatar Gerhard Stein

Removed old singleton class

parent 3214bd58
/*
* CSingleton.h
* GsSingleton.h
*
* Created on: 19.04.2009
* Author: gerstrong
......@@ -10,8 +10,8 @@
* with another class you still can make it dynamic of you really want that...
*/
#ifndef SINGLETON_H_
#define SINGLETON_H_
#ifndef __SINGLETON_H_
#define __SINGLETON_H_
template <class T>
......@@ -33,4 +33,4 @@ T& GsSingleton<T>::get()
return instance;
}
#endif /* SINGLETON_H_ */
#endif /* __SINGLETON_H_ */
......@@ -197,7 +197,7 @@ void GsTilemap::drawTile(SDL_Surface *dst, int x, int y, Uint16 t)
BlitSurface(rawSDLSfc, &src_rect, dst, &dst_rect);
#ifdef DEBUG_COLLISION
//std::vector<CTileProperties> &TileProp = gpBehaviorEngine->getTileProperties(1);
//std::vector<CTileProperties> &TileProp = gBehaviorEngine.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(gpBehaviorEngine->getEngine() == ENGINE_VORTICON)
if(gBehaviorEngine.getEngine() == ENGINE_VORTICON)
{
drawVorticonStyle(lRect);
}
......
......@@ -194,7 +194,6 @@ get_property(cg_obj_libs GLOBAL PROPERTY CG_OBJ_LIBS)
add_executable (CGeniusExe CGenius.cpp
fileio.cpp misc.cpp
CRingBuffer.h
CSingleton.h
fileio.h
../changelog.txt
${cg_obj_libs})
......
/*
* CSingleton.h
*
* Created on: 19.04.2009
* Author: gerstrong
*
* Modified on: 23.01.2011
* GetNoPtrChk get. Only use that function in extreme cases.
*/
#ifndef CSINGLETON_H_
#define CSINGLETON_H_
#include <stdio.h>
template <class T>
class CSingleton {
protected:
static T *m_pSingleton; // Static Object
public:
//CSingleton();
inline static T* GetNoPtrChk()
{
return (m_pSingleton);
}
inline static T* Get()
{
if(!m_pSingleton)
m_pSingleton = new T;
return (m_pSingleton);
}
static void Del()
{
if(m_pSingleton)
{
delete (m_pSingleton);
m_pSingleton = nullptr;
}
}
virtual ~CSingleton() // Unused, because this class is never constructed!!
{}
};
template <class T>
T* CSingleton<T>::m_pSingleton = nullptr;
#endif /* CSINGLETON_H_ */
......@@ -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 = gpBehaviorEngine->getEngine();
m_theme = gBehaviorEngine.getEngine();
}
......
......@@ -55,7 +55,7 @@ m_start_level(start_level)
{
gSound.unloadSoundData();
// The last menu has been removed. Restore back the game status
gpBehaviorEngine->setPause(false);
gBehaviorEngine.setPause(false);
gMenuController.clearMenuStack();
letchooseagain();
......@@ -725,7 +725,7 @@ void CGameLauncher::ponderPatchDialog()
// We have to check which Episode will be used
const int episode = getEpisode( m_chosenGame );
gpBehaviorEngine->mPatchFname = mPatchFilename;
gBehaviorEngine.mPatchFname = mPatchFilename;
if( episode > 0 ) // The game has to have a valid episode!
{
......
......@@ -31,7 +31,7 @@
#include <base/GsEvent.h>
#include "CSingleton.h"
#include <base/Singleton.h>
#if defined (SINGLEPLAYER)
const unsigned int MAX_PLAYERS = 1;
......@@ -39,7 +39,7 @@ const unsigned int MAX_PLAYERS = 1;
const unsigned int MAX_PLAYERS = 4;
#endif
#define gpBehaviorEngine CBehaviorEngine::Get()
#define gBehaviorEngine CBehaviorEngine::get()
/*
* This enumerator will hold and tell what engine we are using.
......@@ -72,7 +72,7 @@ typedef struct
Uint16 x, y;
} stTeleporterTable;
class CBehaviorEngine : public CSingleton<CBehaviorEngine>
class CBehaviorEngine : public GsSingleton<CBehaviorEngine>
{
public:
CBehaviorEngine() : mPlayers(0),
......
......@@ -41,7 +41,7 @@ mp_AttachedObject(p_attacher)
void CCamera::cycleCamlead()
{
const int numPlayers = gpBehaviorEngine->mPlayers;
const int numPlayers = gBehaviorEngine.mPlayers;
if( numPlayers == 1 ) // For one player this doesn't make sense to change
return;
......
......@@ -56,12 +56,12 @@ void CHUD::setup(const int id)
mRenderRect.x = 8; mRenderRect.y = 4;
if(gpBehaviorEngine->mPlayers > 3)
if(gBehaviorEngine.mPlayers > 3)
{
mRenderRect.x = 0; mRenderRect.y = 0;
}
size_t Episode = gpBehaviorEngine->getEpisode();
size_t Episode = gBehaviorEngine.getEpisode();
if( Episode >= 1 && Episode <= 3 )
{
......@@ -128,7 +128,7 @@ void CHUD::CreateVorticonBackground()
int sprite=0;
const int Episode = gpBehaviorEngine->getEpisode();
const int Episode = gBehaviorEngine.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;
......@@ -243,7 +243,7 @@ void CHUD::renderGalaxy()
gGraphics.drawDigits(getRightAlignedString(itoa(charges),2),60, 20, blitsfc );
gGraphics.drawDigits(getRightAlignedString(itoa(lives),2), 20, 20, blitsfc );
if(gpBehaviorEngine->mPlayers > 1 && mId == CCamera::getLead())
if(gBehaviorEngine.mPlayers > 1 && mId == CCamera::getLead())
{
SDL_Rect rect;
rect.x = 7; rect.y = 29;
......@@ -292,7 +292,7 @@ void CHUD::renderVorticon()
void CHUD::render()
{
size_t Episode = gpBehaviorEngine->getEpisode();
size_t Episode = gBehaviorEngine.getEpisode();
timer++;
......
......@@ -130,9 +130,9 @@ void CMap::collectBlockersCoordiantes()
scrollBlockY.push_back(2<<CSF);
scrollBlockX.push_back(2<<CSF);
int ep = gpBehaviorEngine->getEpisode();
int ep = gBehaviorEngine.getEpisode();
if(gpBehaviorEngine->getEngine() == ENGINE_GALAXY)
if(gBehaviorEngine.getEngine() == ENGINE_GALAXY)
{
const word* map_ptr = m_Plane[2].getMapDataPtr();
......@@ -163,10 +163,10 @@ void CMap::collectBlockersCoordiantes()
void CMap::setupAnimationTimer()
{
auto &frontTileProperties = gpBehaviorEngine->getTileProperties(1);
auto &frontTileProperties = gBehaviorEngine.getTileProperties(1);
word *p_front_tile = m_Plane[1].getMapDataPtr();
auto &backTileProperties = gpBehaviorEngine->getTileProperties(0);
auto &backTileProperties = gBehaviorEngine.getTileProperties(0);
word *p_back_tile = m_Plane[0].getMapDataPtr();
std::vector<Uint8> &timersBack = m_Plane[0].getTimers();
......@@ -215,7 +215,7 @@ void CMap::fetchNearestVertBlockers(const int x, int &leftCoord, int &rightCoord
{
leftCoord = blockXleft;
if(leftCoord > (2<<CSF) && gpBehaviorEngine->getEngine() == ENGINE_GALAXY)
if(leftCoord > (2<<CSF) && gBehaviorEngine.getEngine() == ENGINE_GALAXY)
{
// This will hide even more level blockers in Galaxy.
// In the vorticon games not required
......@@ -263,7 +263,7 @@ void CMap::fetchNearestHorBlockers(const int y, int &upCoord, int &downCoord)
{
upCoord = blockYup;
if(gpBehaviorEngine->getEngine() == ENGINE_GALAXY)
if(gBehaviorEngine.getEngine() == ENGINE_GALAXY)
{
// This will hide even more level blockers in Galaxy. In Vorticon
// this is not needed
......@@ -829,7 +829,7 @@ void CMap::_drawForegroundTiles()
Uint16 y2 = (m_scrolly+num_h_tiles)>>TILE_S;
std::vector<CTileProperties> &TileProperties =
gpBehaviorEngine->getTileProperties(1);
gBehaviorEngine.getTileProperties(1);
const auto &visGA = gVideoDriver.mpVideoEngine->mRelativeVisGameArea;
const auto &visBlendGA = gVideoDriver.mpVideoEngine->mRelativeBlendVisGameArea;
......@@ -940,10 +940,10 @@ void CMap::animateAllTiles()
if(num_h_tiles+m_mapy >= m_height)
num_h_tiles = m_height-m_mapy;
auto &frontTileProperties = gpBehaviorEngine->getTileProperties(1);
auto &frontTileProperties = gBehaviorEngine.getTileProperties(1);
word *p_front_tile = m_Plane[1].getMapDataPtr();
auto &backTileProperties = gpBehaviorEngine->getTileProperties(0);
auto &backTileProperties = gBehaviorEngine.getTileProperties(0);
word *p_back_tile = m_Plane[0].getMapDataPtr();
std::vector<Uint8> &timersBack = m_Plane[0].getTimers();
......
......@@ -413,7 +413,7 @@ bool CMessages::extractGlobalStrings()
std::map<std::string, std::string>::iterator i;
for( i = StringMap.begin() ; i != StringMap.end() ; i++ )
{
gpBehaviorEngine->setMessage(i->first, i->second);
gBehaviorEngine.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 = gpBehaviorEngine->getEpisode();
episode = gBehaviorEngine.getEpisode();
if(episode >= 4)
{
......@@ -179,7 +179,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(gpBehaviorEngine->getEpisode() > 3)
if(gBehaviorEngine.getEpisode() > 3)
{
if(!moveSlopedTileDown(x, y2, xspeed))
moveSlopedTileUp(x, y1, xspeed);
......@@ -191,7 +191,7 @@ bool CSpriteObject::moveSlopedTileDown( int x, int y, const int xspeed )
if(yinertia!=0)
return false;
std::vector<CTileProperties> &TileProperty = gpBehaviorEngine->getTileProperties();
std::vector<CTileProperties> &TileProperty = gBehaviorEngine.getTileProperties();
const Sint8 slope = TileProperty[mp_Map->at(x>>CSF, y>>CSF)].bup;
......@@ -234,7 +234,7 @@ void CSpriteObject::moveSlopedTileUp( int x, int y, const int xspeed )
if(yinertia!=0)
return;
std::vector<CTileProperties> &TileProperty = gpBehaviorEngine->getTileProperties();
std::vector<CTileProperties> &TileProperty = gBehaviorEngine.getTileProperties();
const Sint8 slope = TileProperty[mp_Map->at(x>>CSF, y>>CSF)].bdown;
// Check first, if there is a tile on players level
......@@ -323,7 +323,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 = gpBehaviorEngine->getTileProperties(1);
std::vector<CTileProperties> &Tile = gBehaviorEngine.getTileProperties(1);
int i,j;
Sint8 behavior;
......@@ -361,7 +361,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 = gpBehaviorEngine->getTileProperties(1);
std::vector<CTileProperties> &Tile = gBehaviorEngine.getTileProperties(1);
int i,j;
Sint8 behavior;
......@@ -389,7 +389,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 = gpBehaviorEngine->getTileProperties(1);
std::vector<CTileProperties> &Tile = gBehaviorEngine.getTileProperties(1);
int i;
Sint8 behavior;
......@@ -410,7 +410,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 = gpBehaviorEngine->getTileProperties(1);
std::vector<CTileProperties> &Tile = gBehaviorEngine.getTileProperties(1);
int i;
Sint8 behavior;
......@@ -437,7 +437,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 = gpBehaviorEngine->getTileProperties(1);
std::vector<CTileProperties> &Tile = gBehaviorEngine.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
......@@ -448,7 +448,7 @@ bool CSpriteObject::hitdetectWithTileProperty(const int Property, const int x, c
bool CSpriteObject::turnAroundOnCliff( int x1, int x2, int y2 )
{
std::vector<CTileProperties> &TileProperty = gpBehaviorEngine->getTileProperties();
std::vector<CTileProperties> &TileProperty = gBehaviorEngine.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;
......@@ -546,7 +546,7 @@ bool CSpriteObject::checkMapBoundaryU(const int y1)
int CSpriteObject::checkSolidR( int x1, int x2, int y1, int y2)
{
std::vector<CTileProperties> &TileProperty = gpBehaviorEngine->getTileProperties();
std::vector<CTileProperties> &TileProperty = gBehaviorEngine.getTileProperties();
int blocker;
x2 += COLISION_RES;
......@@ -580,7 +580,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 = gpBehaviorEngine->getTileProperties();
std::vector<CTileProperties> &TileProperty = gBehaviorEngine.getTileProperties();
x1 -= COLISION_RES;
......@@ -621,7 +621,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 = gpBehaviorEngine->getTileProperties();
std::vector<CTileProperties> &TileProperty = gBehaviorEngine.getTileProperties();
y1 -= COLISION_RES;
......@@ -656,7 +656,7 @@ bool CSpriteObject::checkMapBoundaryD(const int y2)
int CSpriteObject::checkSolidD( int x1, int x2, int y2, const bool push_mode )
{
std::vector<CTileProperties> &TileProperty = gpBehaviorEngine->getTileProperties();
std::vector<CTileProperties> &TileProperty = gBehaviorEngine.getTileProperties();
y2 += COLISION_RES;
......@@ -772,7 +772,7 @@ void CSpriteObject::processMoveBitUp()
if(blockedu)
{
if(gpBehaviorEngine->getEpisode()<=3) // Galaxy only!
if(gBehaviorEngine.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
gpBehaviorEngine->setPause(false);
gBehaviorEngine.setPause(false);
gMenuController.clearMenuStack();
mEndEpisode = true;
}
......
......@@ -46,7 +46,6 @@ public:
// Getters
char getEpisode() { return m_Episode; }
char getDifficulty() { return m_Difficulty; }
CSaveGameController getSavedGameBlock() { return m_SavedGame; }
std::string getGamePath() { return m_DataDirectory; }
bool getchooseGame() { return mEndEpisode; }
......
......@@ -259,7 +259,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 = gpBehaviorEngine->m_option[opt];
stOption &option = gBehaviorEngine.m_option[opt];
option.menuname = menuname;
option.name = name;
option.value = value;
......@@ -293,7 +293,7 @@ bool CSettings::loadGameOptions()
loadDefaultGameCfg();
stOption *p_option = gpBehaviorEngine->m_option;
stOption *p_option = gBehaviorEngine.m_option;
for (i = 0; i < NUM_OPTIONS; i++)
{
bool newvalue;
......@@ -314,7 +314,7 @@ bool CSettings::saveGameOptions()
if(!Configuration.Parse()) return false;
stOption *p_option = gpBehaviorEngine->m_option;
stOption *p_option = gBehaviorEngine.m_option;
for (int i = 0; i < NUM_OPTIONS; i++)
Configuration.SetKeyword("Game", p_option[i].name, p_option[i].value);
......
......@@ -212,7 +212,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 = gpBehaviorEngine->getPhysicsSettings().misc.visibility;
int visibility = gBehaviorEngine.getPhysicsSettings().misc.visibility;
SDL_Rect gameres = gVideoDriver.getGameResolution().SDLRect();
......@@ -237,9 +237,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 = gpBehaviorEngine->getTileProperties(1)[fall1];
const CTileProperties &TileProp2 = gpBehaviorEngine->getTileProperties(1)[fall2];
const CTileProperties &TileProp3 = gpBehaviorEngine->getTileProperties(1)[fall3];
const CTileProperties &TileProp1 = gBehaviorEngine.getTileProperties(1)[fall1];
const CTileProperties &TileProp2 = gBehaviorEngine.getTileProperties(1)[fall2];
const CTileProperties &TileProp3 = gBehaviorEngine.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);
......@@ -409,7 +409,7 @@ void CSpriteObject::InertiaAndFriction_X(const int friction_rate)
void CSpriteObject::processFallPhysics(const int boost)
{
CPhysicsSettings &Physics = gpBehaviorEngine->getPhysicsSettings();
CPhysicsSettings &Physics = gBehaviorEngine.getPhysicsSettings();
// In this case foe is jumping?
// Not sure here. We should use another variable...
......@@ -436,7 +436,7 @@ void CSpriteObject::processFallPhysics(const int boost)
void CSpriteObject::processFallPhysics()
{
CPhysicsSettings &Physics = gpBehaviorEngine->getPhysicsSettings();
CPhysicsSettings &Physics = gBehaviorEngine.getPhysicsSettings();
processFallPhysics(Physics.fallspeed_increase);
}
......
......@@ -46,7 +46,7 @@ void CGamePlayMode::ponder(const float deltaT)
}
else if( mp_PlayGame->getStartGame() )
{ // Start another new game
EventContainer.add( new GMSwitchToPlayGameMode(m_Episode, gpBehaviorEngine->mPlayers, m_DataDirectory) );
EventContainer.add( new GMSwitchToPlayGameMode(m_Episode, gBehaviorEngine.mPlayers, m_DataDirectory) );
}
else if( mp_PlayGame->getExitEvent() )
{
......@@ -59,7 +59,7 @@ void CGamePlayMode::render()
{
mp_PlayGame->render();
if(gpBehaviorEngine->m_option[OPT_SHOWFPS].value)
if(gBehaviorEngine.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(gpBehaviorEngine->m_option)
mp_option(gBehaviorEngine.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
gpBehaviorEngine->setPause(false);
gBehaviorEngine.setPause(false);
gMenuController.clearMenuStack();
m_endgame = true;
}
......
......@@ -46,7 +46,6 @@ public:
char getEpisode();
char getNumPlayers();
CSaveGameController getSavedGameBlock();
protected:
bool m_endgame;
......
......@@ -16,9 +16,9 @@
void KeenEngine::switchToGamePlayMode(const int startLevel)
{
const int episode = gpBehaviorEngine->getEpisode();
const int episode = gBehaviorEngine.getEpisode();
auto &numPlayers = gpBehaviorEngine->mPlayers;
auto &numPlayers = gBehaviorEngine.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);
gpBehaviorEngine->setEpisode(mEp);
gBehaviorEngine.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) )
{
gpBehaviorEngine->mDifficulty = pStart->mDifficulty;
gBehaviorEngine.mDifficulty = pStart->mDifficulty;
switchToGamePlayMode(pStart->mStartLevel);
return;
}
......@@ -77,9 +77,9 @@ void KeenEngine::ponder(const float deltaT)
if(!mpGameMode)
return;
if(g_pMusicPlayer->active() && !g_pMusicPlayer->playing())
if(gMusicPlayer.active() && !gMusicPlayer.playing())
{
g_pMusicPlayer->play();
gMusicPlayer.play();
}
// Did the player press the quit/back button
......
......@@ -405,7 +405,7 @@ void DreamsEngine::start()
//mLoader.setPermilage(10);
// Patch the EXE-File-Data directly in the memory.
CPatcher Patcher(ExeFile, gpBehaviorEngine->mPatchFname);
CPatcher Patcher(ExeFile, gBehaviorEngine.mPatchFname);
Patcher.process();
//mLoader.setPermilage(50);
......
......@@ -35,7 +35,7 @@ void CLevelPlay::loadMap(const int level)
// Load the World map level.
std::unique_ptr<CMapLoaderGalaxy> MapLoader;
const int episode = gpBehaviorEngine->getEpisode();
const int episode = gBehaviorEngine.getEpisode();
if(episode == 4)
{
......@@ -58,11 +58,11 @@ void CLevelPlay::loadMap(const int level)
MapLoader->loadMap( mMap, level );
// Load some new background Music
g_pMusicPlayer->stop();
gMusicPlayer.stop();
if( loadLevelMusic(level) )
{
g_pMusicPlayer->play();
gMusicPlayer.play();
}
else
{
......@@ -87,7 +87,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 = gpBehaviorEngine->getString(level_text);
const std::string loading_text = gBehaviorEngine.getString(level_text);
showMsgWithBmp( loading_text, "KEENTHUMBSUP", LEFT );
......
......@@ -27,7 +27,7 @@
CMapPlayGalaxy::CMapPlayGalaxy(std::vector<CInventory> &inventoryVec) :
mActive(false),
mInventoryVec(inventoryVec),
mpOption(gpBehaviorEngine->m_option),
mpOption(gBehaviorEngine.m_option),
mMsgBoxOpen(false)
{}
......@@ -313,7 +313,7 @@ bool CMapPlayGalaxy::operator<<(CSaveGameController &savedGame)
savedGame.decodeData( level );
std::unique_ptr<galaxy::CMapLoaderGalaxy> mapLoader;
const unsigned int episode = gpBehaviorEngine->getEpisode();
const unsigned int episode = gBehaviorEngine.getEpisode();
if(episode == 4)
{
......@@ -337,7 +337,7 @@ bool CMapPlayGalaxy::operator<<(CSaveGameController &savedGame)
mapLoader->loadMap( mMap, level );
// Load the Background Music
g_pMusicPlayer->stop();
gMusicPlayer.stop();
if( !galaxy::loadLevelMusic(level) )
......@@ -346,7 +346,7 @@ bool CMapPlayGalaxy::operator<<(CSaveGameController &savedGame)
}
else
{
g_pMusicPlayer->play();
gMusicPlayer.play();
}
......@@ -503,7 +503,7 @@ 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 = gpBehaviorEngine->getEpisode();