Commit 3214bd58 authored by Gerhard Stein's avatar Gerhard Stein

Lots of tidying up the code. More use of C++ modern features

parent 878e05c2
......@@ -68,7 +68,7 @@ void CInput::resetControls(int player)
if(player == 0)
{
player = 1;
gLogging.textOut("Warning when resetting controls. The function has been used incorrectly, please report that the developer!");
gLogging << "Warning when resetting controls. The function has been used incorrectly, please report that the developer!";
}
// not a good idea, beause it would write twice in one array, and forget about the last one. (for example 4)
// At least this warning will tell the people, that something is not right here!
......@@ -160,7 +160,7 @@ void CInput::resetControls(int player)
*/
bool CInput::startJoyDriver()
{
gLogging.textOut("JoyDrv_Start() : ");
gLogging << "JoyDrv_Start() : ";
if (SDL_Init( SDL_INIT_JOYSTICK ) < 0)
{
......@@ -174,7 +174,7 @@ bool CInput::startJoyDriver()
{
SDL_JoystickEventState(SDL_ENABLE);
gLogging.ftextOut("Detected %i joystick(s).<br>\n", joyNum );
gLogging.textOut("The names of the joysticks are:<br>");
gLogging << "The names of the joysticks are:<br>";
for( size_t i=0; i < joyNum; i++ )
{
......@@ -482,7 +482,7 @@ void CInput::readNewEvent()
switch ( Event.type )
{
case SDL_QUIT:
gLogging.textOut("SDL: Got quit event in readNewEvent!");
gLogging << "SDL: Got quit event in readNewEvent!";
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
// on iPhone, we just want to quit in this case
exit(0);
......@@ -677,7 +677,7 @@ void CInput::pollEvents()
switch( Event.type )
{
case SDL_QUIT:
gLogging.textOut("SDL: Got quit event!");
gLogging << "SDL: Got quit event!";
m_exit = true;
break;
......@@ -819,19 +819,19 @@ void CInput::pollEvents()
bool value;
value = gVideoDriver.getFullscreen();
value = !value;
gLogging.textOut(GREEN,"Fullscreen mode triggered by user!<br>");
gLogging.textOut(FONTCOLORS::GREEN,"Fullscreen mode triggered by user!<br>");
gVideoDriver.isFullscreen(value);
// initialize/activate all drivers
gLogging.ftextOut("Restarting graphics driver...<br>");
if ( gVideoDriver.applyMode() && gVideoDriver.start() )
{
gLogging.ftextOut(PURPLE, "Toggled Fullscreen quick shortcut...<br>");
gLogging.ftextOut(FONTCOLORS::PURPLE, "Toggled Fullscreen quick shortcut...<br>");
}
else
{
value = !value;
gLogging.ftextOut(PURPLE, "Couldn't change the resolution, Rolling back...<br>");
gLogging.ftextOut(FONTCOLORS::PURPLE, "Couldn't change the resolution, Rolling back...<br>");
gVideoDriver.applyMode();
gVideoDriver.start();
}
......@@ -842,7 +842,7 @@ void CInput::pollEvents()
// Check, if LALT+Q or LALT+F4 was pressed
if(getHoldedKey(KALT) && (getPressedKey(KF4) || getPressedKey(KQ)) )
{
gLogging.textOut("User exit request!");
gLogging << "User exit request!";
m_exit = true;
}
#endif
......
......@@ -100,10 +100,10 @@ bool GsApp::init(int argc, char *argv[])
gArgs.passArgs(argc, argv);
// Setup the Hardware using the settings we have loaded
gLogging.textOut(GREEN,"Loading hardware settings...<br>");
gLogging.textOut(FONTCOLORS::GREEN,"Loading hardware settings...<br>");
if(!loadDrivers())
{
gLogging.textOut(RED,"The program cannot start, because you do not meet the hardware requirements.<br>");
gLogging.textOut(FONTCOLORS::RED,"The program cannot start, because you do not meet the hardware requirements.<br>");
return false;
}
......
......@@ -19,7 +19,7 @@ void GsArguments::passArgs(int argc, char *argv[])
else
{
const std::string warning = "The argument \"" + arg + "\" wasn't recognized. Continuing without this parameter.\n";
gLogging.textOut(warning);
gLogging << warning;
}
}
}
......
......@@ -31,7 +31,7 @@ bool CLogFile::CreateLogfile(const std::string &logFName,
textOut("<body><font face='courier new'>");
WriteTopic("Logfile", 3);
textOut(BLUE, appName + " v" + version);
textOut(FONTCOLORS::BLUE, appName + " v" + version);
// Mark the Build and Platform
#ifdef DEBUG
......@@ -99,7 +99,7 @@ void CLogFile::WriteTopic(const char *Topic, int Size)
}
// The main textOut function
// Standard textOut (Black color)
// Standard textOut (FONTCOLORS::BLACK color)
// Now with colors
......@@ -117,15 +117,15 @@ void CLogFile::textOut(FONTCOLORS Color, bool List, const std::string& Text)
// write color tag
switch(Color)
{
case BLACK:
case FONTCOLORS::BLACK:
textOut("<font color=black>"); break;
case RED:
case FONTCOLORS::RED:
textOut("<font color=red>"); break;
case GREEN:
case FONTCOLORS::GREEN:
textOut("<font color=green>"); break;
case BLUE:
case FONTCOLORS::BLUE:
textOut("<font color=blue>"); break;
case PURPLE:
case FONTCOLORS::PURPLE:
textOut("<font color=purple>"); break;
};
......
......@@ -19,7 +19,7 @@ const std::string APP_NAME = "Commander Genius";
const int MAX_BUFFER = 1024;
enum FONTCOLORS
enum class FONTCOLORS
{
BLACK,
RED,
......
......@@ -20,7 +20,7 @@ resetLogic(false)
WIZ_ptimer_init();
#endif
setFPS(DEFAULT_LPS_VORTICON);
gLogging.textOut(GREEN, true, "Starting timer driver...\n");
gLogging.textOut(FONTCOLORS::GREEN, true, "Starting timer driver...\n");
ResetSecondsTimer();
}
......
......@@ -245,7 +245,8 @@ T from_string(const std::string& s, bool& failed) {
// Conversion functions from numbers to string
template<typename T>
std::string to_string(T val) {
std::string to_string(T val)
{
std::ostringstream oss;
oss << val;
return oss.str();
......
......@@ -52,7 +52,7 @@ bool COpenGL::resizeDisplayScreen(const GsRect<Uint16>& newDim)
if (mDisplaySfc.empty())
{
gLogging.textOut(RED,"VidDrv_Start(): Couldn't create a SDL surface: %s<br>", SDL_GetError());
gLogging.textOut(FONTCOLORS::RED,"VidDrv_Start(): Couldn't create a SDL surface: %s<br>", SDL_GetError());
return false;
}
......
......@@ -91,7 +91,7 @@ bool CSDLVideo::init()
if (mDisplaySfc.empty())
{
gLogging.textOut(RED,"VidDrv_Start(): Couldn't create a SDL surface: %s<br>", SDL_GetError());
gLogging.textOut(FONTCOLORS::RED,"VidDrv_Start(): Couldn't create a SDL surface: %s<br>", SDL_GetError());
return false;
}
......
......@@ -42,12 +42,12 @@ bool CVideoDriver::init()
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO) < 0)
{
gLogging.textOut(RED, "Could not initialize SDL: %s<br>", SDL_GetError());
gLogging.textOut(FONTCOLORS::RED, "Could not initialize SDL: %s<br>", SDL_GetError());
return false;
}
else
{
gLogging.textOut(GREEN, "SDL was successfully initialized!<br>");
gLogging.textOut(FONTCOLORS::GREEN, "SDL was successfully initialized!<br>");
}
initResolutionList();
......@@ -60,9 +60,9 @@ bool CVideoDriver::init()
const int initted=IMG_Init(flags);
if( (initted & flags) != flags)
{
gLogging.textOut(RED, "IMG_Init: Failed to init required jpg and png support!\n");
gLogging.textOut(RED, "IMG_Init: %s\n", IMG_GetError());
gLogging.textOut(RED, "IMG_Init: CG will try to continue without that support.\n", IMG_GetError());
gLogging.textOut(FONTCOLORS::RED, "IMG_Init: Failed to init required jpg and png support!\n");
gLogging.textOut(FONTCOLORS::RED, "IMG_Init: %s\n", IMG_GetError());
gLogging.textOut(FONTCOLORS::RED, "IMG_Init: CG will try to continue without that support.\n", IMG_GetError());
}
else
{
......@@ -174,7 +174,7 @@ void CVideoDriver::verifyResolution(GsRect<Uint16>& resolution,
if (i == m_Resolutionlist.end()) {
#ifdef DEBUG
gLogging.ftextOut(BLUE, "Resolution %ix%ix%i %X added\n",
gLogging.ftextOut(FONTCOLORS::BLUE, "Resolution %ix%ix%i %X added\n",
resolution.w, resolution.h, 32);
#endif
m_Resolutionlist.push_back(resolution);
......
......@@ -70,7 +70,7 @@ std::string getResourceFilename(const std::string &filename, const std::string &
text += "found!\n";
if(!text.empty())
gLogging.textOut(GREEN, text);
gLogging.textOut(FONTCOLORS::GREEN, text);
return vfs_path;
}
......@@ -64,8 +64,8 @@ bool GsTilemap::loadHiresTile( const std::string& filename, const std::string& p
}
else
{
gLogging.textOut(RED, "IMG_Load: %s\n", IMG_GetError());
gLogging.textOut(RED, "IMG_Load: CG will ignore those images\n");
gLogging.textOut(FONTCOLORS::RED, "IMG_Load: %s\n", IMG_GetError());
gLogging.textOut(FONTCOLORS::RED, "IMG_Load: CG will ignore those images\n");
}
}
......
......@@ -350,7 +350,7 @@ Before you play the game, you should take a look at the controls. Normally LAlt,
are the action keys. You can also assign joystick buttons, axes and hats to those actions or just
change the keys to your liking. The changes are global to all the Keen games.
For Mobile users, I added Sandwich button which during the gameplay can be seen at the top right corner (red color).
For Mobile users, I added Sandwich button which during the gameplay can be seen at the top right corner (FONTCOLORS::RED color).
Click or tap on it and you get opened the Main-Menu
......
......@@ -48,13 +48,13 @@
/**
* \brief This is the function where CG beings
* @brief This is the function where CG beings
*
* \param argc number of arguments
* \param argv pointer to char arrays where
* @param argc number of arguments
* @param argv pointer to char arrays where
* where the passed arguments are stored
* in the process
* \return This always returns 0. If
* @return This always returns 0. If
* some errors appear, take a look
* at the Logfile.
*
......@@ -94,39 +94,39 @@ int main(int argc, char *argv[])
SetBinaryDir( GetAbsolutePath(binary_dir) );
InitThreadPool();
InitSearchPaths(g_pSettings->getConfigFileName());
InitSearchPaths(gSettings.getConfigFileName());
if( !gLogging.CreateLogfile("CGLog.html", APP_NAME, CGVERSION) )
{
errors << "I'm not even able to create \"CGLog.html\"." << endl;
errors << "Not even able to create \"CGLog.html\"." << endl;
return 1;
}
// Init Video Driver with SDL all together
if(!gVideoDriver.init())
if( !gVideoDriver.init() )
{
return 1;
}
// Check if there are settings on the PC, otherwise use defaults.
if(!g_pSettings->loadDrvCfg())
if( !gSettings.loadDrvCfg() )
{
//m_firsttime = true;
gLogging.textOut(RED,"First time message: CG didn't find the driver config file. ");
gLogging.textOut(RED,"However, it generated some default values and will save them now.\n");
g_pSettings->saveDrvCfg();
gLogging.textOut(FONTCOLORS::RED,"First time message: CG didn't find the driver config file. ");
gLogging.textOut(FONTCOLORS::RED,"However, it generated some default values and will save them now.\n");
gSettings.saveDrvCfg();
}
gLogging.textOut(GREEN,"Loading game options...\n");
if(!g_pSettings->loadGameOptions())
gLogging.textOut(FONTCOLORS::GREEN,"Loading game options...\n");
if(!gSettings.loadGameOptions())
{
gLogging.textOut(RED,"Cannot load defaults...\n");
g_pSettings->loadDefaultGameCfg();
gLogging.textOut(FONTCOLORS::RED,"Cannot load defaults...\n");
gSettings.loadDefaultGameCfg();
}
// Init the Game sound
g_pSound->init();
gSound.init();
////////////////////////////////////////////////////
// Initialize CG and run the main cycle if worthy //
......@@ -144,7 +144,7 @@ int main(int argc, char *argv[])
gApp.runMainCycle();
}
g_pSettings->saveDispCfg();
gSettings.saveDispCfg();
UnInitThreadPool();
return 0;
......
......@@ -53,7 +53,7 @@ m_firsttime(first_time),
m_start_game_no(start_game_no),
m_start_level(start_level)
{
g_pSound->unloadSoundData();
gSound.unloadSoundData();
// The last menu has been removed. Restore back the game status
gpBehaviorEngine->setPause(false);
......@@ -412,7 +412,7 @@ void CGameLauncher::start()
{
if(!mGameLauncher.setupMenu())
{
gLogging.textOut(RED,"No game can be launched, because game data files are missing.<br>");
gLogging.textOut(FONTCOLORS::RED,"No game can be launched, because game data files are missing.<br>");
return 0;
}
......@@ -765,7 +765,7 @@ void CGameLauncher::ponderPatchDialog()
else
{
letchooseagain();
gLogging.textOut(RED,"No Suitable game was detected in this path! Please check its contents!\n");
gLogging.textOut(FONTCOLORS::RED,"No Suitable game was detected in this path! Please check its contents!\n");
}
}
}
......
......@@ -383,24 +383,24 @@ bool CMessages::extractGlobalStrings()
case 4:
{
if(!extractEp4Strings(StringMap))
gLogging.textOut(RED,"This version of the game is not supported!");
gLogging.textOut(FONTCOLORS::RED,"This version of the game is not supported!");
} break;
case 5:
{
if(!extractEp5Strings(StringMap))
gLogging.textOut(RED,"This version of the game is not supported!");
gLogging.textOut(FONTCOLORS::RED,"This version of the game is not supported!");
} break;
case 6:
{
if(!extractEp6Strings(StringMap))
gLogging.textOut(RED,"This version of the game is not supported!");
gLogging.textOut(FONTCOLORS::RED,"This version of the game is not supported!");
} break;
default:
{
gLogging.textOut(RED,"This version of the game is not supported!");
gLogging.textOut(FONTCOLORS::RED,"This version of the game is not supported!");
return false;
}
}
......
......@@ -97,27 +97,27 @@ bool CSettings::saveDrvCfg()
Configuration.WriteInt("Bound", "down", CameraBounds.down);
Configuration.WriteInt("Bound", "speed", CameraBounds.speed);
Configuration.WriteInt("Audio", "channels", (g_pSound->getAudioSpec()).channels);
Configuration.WriteInt("Audio", "format", (g_pSound->getAudioSpec()).format);
Configuration.WriteInt("Audio", "rate", (g_pSound->getAudioSpec()).freq);
Configuration.SetKeyword("Audio", "sndblaster", g_pSound->getSoundBlasterMode());
Configuration.WriteInt("Audio", "musicvol", (g_pSound->getMusicVolume()/8));
Configuration.WriteInt("Audio", "soundvol", (g_pSound->getSoundVolume()/8));
Configuration.WriteInt("Audio", "channels", (gSound.getAudioSpec()).channels);
Configuration.WriteInt("Audio", "format", (gSound.getAudioSpec()).format);
Configuration.WriteInt("Audio", "rate", (gSound.getAudioSpec()).freq);
Configuration.SetKeyword("Audio", "sndblaster", gSound.getSoundBlasterMode());
Configuration.WriteInt("Audio", "musicvol", (gSound.getMusicVolume()/8));
Configuration.WriteInt("Audio", "soundvol", (gSound.getSoundVolume()/8));
}
catch(...)
{
gLogging.textOut(RED,"General error writing the configuration file...\n");
gLogging.textOut(FONTCOLORS::RED,"General error writing the configuration file...\n");
}
bool ok = Configuration.saveCfgFile();
gLogging.textOut(GREEN,"Saving game options...");
gLogging.textOut(FONTCOLORS::GREEN,"Saving game options...");
if(ok)
gLogging.textOut(GREEN,"ok.");
gLogging.textOut(FONTCOLORS::GREEN,"ok.");
else
gLogging.textOut(RED,"error.");
gLogging.textOut(FONTCOLORS::RED,"error.");
return ok;
}
......@@ -151,7 +151,7 @@ bool CSettings::loadDrvCfg()
if(res.w*res.h <= 0)
{
gLogging.ftextOut(RED,"Error reading the configuration file!<br>");
gLogging.ftextOut(FONTCOLORS::RED,"Error reading the configuration file!<br>");
return false;
}
......@@ -211,15 +211,15 @@ bool CSettings::loadDrvCfg()
Configuration.ReadInteger("Audio", "channels", &audio_channels, 2);
Configuration.ReadInteger("Audio", "format", &audio_format, AUDIO_U8);
Configuration.ReadKeyword("Audio", "sndblaster", &audio_sndblaster, false);
g_pSound->setSettings(audio_rate, audio_channels, audio_format, audio_sndblaster);
gSound.setSettings(audio_rate, audio_channels, audio_format, audio_sndblaster);
int sound_vol, music_vol;
Configuration.ReadInteger("Audio", "musicvol", &music_vol, SDL_MIX_MAXVOLUME);
Configuration.ReadInteger("Audio", "soundvol", &sound_vol, SDL_MIX_MAXVOLUME);
g_pSound->setMusicVolume(music_vol*8);
g_pSound->setSoundVolume(sound_vol*8);
gSound.setMusicVolume(music_vol*8);
gSound.setSoundVolume(sound_vol*8);
}
return true;
}
......
......@@ -9,15 +9,14 @@
#include "options.h"
#include "fileio/CConfiguration.h"
#include <base/Singleton.h>
#ifndef CSETTINGS_H_
#define CSETTINGS_H_
#include "CSingleton.h"
#define g_pSettings CSettings::Get()
#define gSettings CSettings::get()
class CSettings : public CSingleton<CSettings>
class CSettings : public GsSingleton<CSettings>
{
public:
......
......@@ -520,7 +520,7 @@ void CSpriteObject::blink(Uint16 frametime)
void CSpriteObject::playSound( const GameSound snd,
const SoundPlayMode mode )
{
g_pSound->playStereofromCoord(snd, mode, scrx);
gSound.playStereofromCoord(snd, mode, scrx);
}
......
......@@ -148,14 +148,14 @@ int downloadFile(const std::string &filename, int &progress,
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
res = curl_easy_perform(curl);
gLogging.ftextOut( GREEN, "Finished downloading from \"%s\", destination: \"%s\"", urlString.c_str(), outputPath.c_str());
gLogging.ftextOut( FONTCOLORS::GREEN, "Finished downloading from \"%s\", destination: \"%s\"", urlString.c_str(), outputPath.c_str());
}
else
{
/* always cleanup */
curl_easy_cleanup(curl);
gLogging.ftextOut( GREEN, "Error creating path \"%s\" for writing", outputPath.c_str());
gLogging.ftextOut( FONTCOLORS::GREEN, "Error creating path \"%s\" for writing", outputPath.c_str());
return 1;
}
......@@ -164,7 +164,7 @@ int downloadFile(const std::string &filename, int &progress,
// output any error to the central CG Log
if(res != CURLE_OK)
{
gLogging.textOut(RED,"%s<br>", curl_easy_strerror(res));
gLogging.textOut(FONTCOLORS::RED,"%s<br>", curl_easy_strerror(res));
}
/* always cleanup */
......@@ -342,7 +342,7 @@ int GameDownloader::handle()
if( !IsFileAvailable(downloadGamePath) )
{
gLogging.ftextOut( GREEN, "Downloading file \"%s\"", gameFileName.c_str());
gLogging.ftextOut( FONTCOLORS::GREEN, "Downloading file \"%s\"", gameFileName.c_str());
// TODO: We also must pass the gamepath and a downloads folder we all the file packages can be set.
res = downloadFile(gameFileName, mProgress, "downloads");
......@@ -362,19 +362,19 @@ int GameDownloader::handle()
const int retVal = unzipFile(fullZipPath.c_str(), destDir.c_str());
gLogging.ftextOut( BLACK, "Extracting downloaded file \"%s\" to \"%s\".\n<br>",
gLogging.ftextOut( FONTCOLORS::BLACK, "Extracting downloaded file \"%s\" to \"%s\".\n<br>",
fullZipPath.c_str(),
destDir.c_str() );
// If unpacking files fails, we should delete it.
if(retVal != 0)
{
gLogging.ftextOut( RED, "Error: Trying to remove broken file \"%s\"", downloadGamePath.c_str());
gLogging.ftextOut( FONTCOLORS::RED, "Error: Trying to remove broken file \"%s\"", downloadGamePath.c_str());
remove( GetFullFileName(downloadGamePath).c_str() );
}
else
{
gLogging.ftextOut( GREEN, "File \"%s\" extracted successfully to \"%s\".\n<br>",
gLogging.ftextOut( FONTCOLORS::GREEN, "File \"%s\" extracted successfully to \"%s\".\n<br>",
downloadGamePath.c_str(),
destDir.c_str());
}
......@@ -382,7 +382,7 @@ int GameDownloader::handle()
else
{
const std::string errStr = "Something went wrong with downloading \"" + gameFileName + "\"!";
gLogging.ftextOut(PURPLE, errStr.c_str() );
gLogging.ftextOut(FONTCOLORS::PURPLE, errStr.c_str() );
}
if(res != CURLE_OK)
......
......@@ -42,7 +42,7 @@ void KeenEngine::start()
if( ExeFile.getHeaderData() == NULL)
{
gLogging.textOut(RED, "KeenEngine::loadResources: Could not load data from the EXE File<br>");
gLogging.textOut(FONTCOLORS::RED, "KeenEngine::loadResources: Could not load data from the EXE File<br>");
gEventManager.add(new GMSwitchToGameLauncher() );
return;
}
......
......@@ -46,7 +46,7 @@ bool setupAudio()
if(audio->loadSoundData(audioOffset))
{
g_pSound->setupSoundData(audio->sndSlotMapGalaxy[7], audio);
gSound.setupSoundData(audio->sndSlotMapGalaxy[7], audio);
return true;
}
......
......@@ -402,7 +402,7 @@ void CPlayGameGalaxy::pumpEvent(const CEvent *evPtr)
g_pMusicPlayer->stop();
m_WorldMap.setActive(false);
m_LevelPlay.loadLevel(newLevel);
g_pSound->playSound( SOUND_ENTER_LEVEL );
gSound.playSound( SOUND_ENTER_LEVEL );
m_LevelPlay.setActive(true);
}
}
......@@ -416,7 +416,7 @@ void CPlayGameGalaxy::pumpEvent(const CEvent *evPtr)
{
if( ev->playSound )
{
g_pSound->playSound( SOUND_LEVEL_DONE );
gSound.playSound( SOUND_LEVEL_DONE );
}
int newLevel = 0;
......@@ -456,7 +456,7 @@ void CPlayGameGalaxy::pumpEvent(const CEvent *evPtr)
g_pMusicPlayer->stop();
m_WorldMap.setActive(false);
m_LevelPlay.loadLevel(newLevel);
//g_pSound->playSound( SOUND_ENTER_LEVEL );
//gSound.playSound( SOUND_ENTER_LEVEL );
m_LevelPlay.setActive(true);
}
}
......@@ -499,7 +499,7 @@ void CPlayGameGalaxy::pumpEvent(const CEvent *evPtr)
*/
void CPlayGameGalaxy::ponder(const float deltaT)
{
if( g_pSound->pauseGamePlay() )
if( gSound.pauseGamePlay() )
return;
if( gMenuController.active() )
......@@ -535,7 +535,7 @@ void CPlayGameGalaxy::ponder(const float deltaT)
{
if( gInput.getPressedAnyButtonCommand(playerCount) )
{
g_pSound->playSound(SOUND_STATUS_SLIDE_OUT);
gSound.playSound(SOUND_STATUS_SLIDE_OUT);
inv.toggleStatusScreen();
}
}
......@@ -543,7 +543,7 @@ void CPlayGameGalaxy::ponder(const float deltaT)
{
if(!msgboxactive && gInput.getPressedCommand(playerCount, IC_STATUS))
{
g_pSound->playSound(SOUND_STATUS_SLIDE_IN);
gSound.playSound(SOUND_STATUS_SLIDE_IN);
inv.toggleStatusScreen();
}
}
......
......@@ -39,7 +39,7 @@ bool setupAudio()
if(audio->loadSoundData(0))
{
g_pSound->setupSoundData(audio->sndSlotMapGalaxy[ep], audio);
gSound.setupSoundData(audio->sndSlotMapGalaxy[ep], audio);
return true;
}
......
......@@ -95,7 +95,7 @@ void CFlag::process()
{
if(mPlayMapSound)
{
g_pSound->playSound( SOUND_FLAG_APPEAR );
gSound.playSound( SOUND_FLAG_APPEAR );
mPlayMapSound = false;
}
......@@ -128,7 +128,7 @@ void CFlag::processFlipping()
{
setAction(A_FLAG_WAVE);
setActionSprite();
g_pSound->playSound( SOUND_FLAG_LAND );
gSound.playSound( SOUND_FLAG_LAND );
const auto episode = gpBehaviorEngine->getEpisode();
if(episode == 6)
......
......@@ -210,7 +210,7 @@ void CPlayerBase::processExiting()
void CPlayerBase::getAnotherLife(const int lc_x, const int lc_y, const bool display, const bool alt)
{
m_Inventory.Item.m_lifes++;
g_pSound->playSound( SOUND_EXTRA_LIFE );
gSound.playSound( SOUND_EXTRA_LIFE );
if(display)
{
const int ep = gpBehaviorEngine->getEpisode();
......@@ -393,7 +393,7 @@ void CPlayerBase::processLevelMiscFlagsCheck()
getAnotherLife(lc_x, lc_y, true, true);
}
g_pSound->playSound( SOUND_GET_DROP );
gSound.playSound( SOUND_GET_DROP );
}
/// Tile Items (Sprite-Items are handled in the CSpriteItem Class)
......@@ -410,14 +410,14 @@ void CPlayerBase::processLevelMiscFlagsCheck()
spawnObj( new CItemEffect(mp_Map, 0, lc_x<<CSF, lc_y<<CSF, got_sprite_item_pics[ep-4][4+i-21], FADEOUT) );
switch(i)
{
case 21: m_Item.m_points += 100; g_pSound->playSound( SOUND_GET_BONUS ); break;
case 22: m_Item.m_points += 200; g_pSound->playSound( SOUND_GET_BONUS ); break;
case 23: m_Item.m_points += 500; g_pSound->playSound( SOUND_GET_BONUS ); break;
case 24: m_Item.m_points += 1000; g_pSound->playSound( SOUND_GET_BONUS ); break;
case 25: m_Item.m_points += 2000; g_pSound->playSound( SOUND_GET_BONUS ); break;
case 26: m_Item.m_points += 5000; g_pSound->playSound( SOUND_GET_BONUS ); break;
case 21: m_Item.m_points += 100; gSound.playSound( SOUND_GET_BONUS ); break;
case 22: m_Item.m_points += 200; gSound.playSound( SOUND_GET_BONUS ); break;
case 23: m_Item.m_points += 500; gSound.playSound( SOUND_GET_BONUS ); break;
case 24: m_Item.m_points += 1000; gSound.playSound( SOUND_GET_BONUS ); break;
case 25: m_Item.m_points += 2000; gSound.playSound( SOUND_GET_BONUS ); break;
case 26: m_Item.m_points += 5000; gSound.playSound( SOUND_GET_BONUS ); break;
case 27: getAnotherLife(lc_x, lc_y, true, false); break;
case 28: m_Item.m_bullets += 5; g_pSound->playSound( SOUND_GET_AMMO ); break;
case 28: m_Item.m_bullets += 5; gSound.playSound( SOUND_GET_AMMO ); break;
default: break;