Skip to content

Commit

Permalink
CGE: Move several variable initializations to the constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Mar 15, 2014
1 parent 5319232 commit 1cf283b
Showing 1 changed file with 40 additions and 34 deletions.
74 changes: 40 additions & 34 deletions engines/cge/cge.cpp
Expand Up @@ -83,6 +83,37 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription)
_miniShp = nullptr;
_miniShpList = nullptr;
_console = nullptr;

_lastFrame = 0;
_lastTick = 0;
_music = true;
_maxScene = 0;
_dark = false;
_game = false;
_endGame = false;
_now = 1;
_lev = -1;
_mode = 0;
_soundOk = 1;
_sprTv = nullptr;
_gameCase2Cpt = 0;
_offUseCount = 0;
_sprK1 = nullptr;
_sprK2 = nullptr;
_sprK3 = nullptr;
_font = nullptr;
_vga = nullptr;
_sys = nullptr;

for (int i = 0; i < kPocketNX; i++)
_pocref[i] = -1;
_volume[0] = 0;
_volume[1] = 0;

for (int i = 0; i < 4; i++)
_flag[i] = false;

initSceneValues();
}

void CGEEngine::initSceneValues() {
Expand All @@ -101,14 +132,13 @@ void CGEEngine::init() {
debugC(1, kCGEDebugEngine, "CGEEngine::init()");

// Initialize fields
_lastFrame = 0;
_lastTick = 0;
_hero = NULL;
_shadow = NULL;
_miniScene = NULL;
_miniShp = NULL;
_miniShpList = NULL;
_sprite = NULL;
_hero = nullptr;
_shadow = nullptr;
_miniScene = nullptr;
_miniShp = nullptr;
_miniShpList = nullptr;
_sprite = nullptr;

_resman = new ResourceManager();

// Create debugger console
Expand All @@ -117,12 +147,12 @@ void CGEEngine::init() {
// Initialize engine objects
_font = new Font(this, "CGE");
_text = new Text(this, "CGE");
_talk = NULL;
_talk = nullptr;
_vga = new Vga(this);
_sys = new System(this);
_pocLight = new PocLight(this);
for (int i = 0; i < kPocketNX; i++)
_pocket[i] = NULL;
_pocket[i] = nullptr;
_horzLine = new HorizLine(this);
_infoLine = new InfoLine(this, kInfoW);
_sceneLight = new SceneLight(this);
Expand All @@ -137,30 +167,6 @@ void CGEEngine::init() {
_sound = new Sound(this);

_offUseCount = atoi(_text->getText(kOffUseCount));
_music = true;

for (int i = 0; i < kPocketNX; i++)
_pocref[i] = -1;
_volume[0] = 0;
_volume[1] = 0;

initSceneValues();

_maxScene = 0;
_dark = false;
_game = false;
_endGame = false;
_now = 1;
_lev = -1;
_recentStep = -2;

for (int i = 0; i < 4; i++)
_flag[i] = false;

_mode = 0;
_soundOk = 1;
_sprTv = NULL;
_gameCase2Cpt = 0;

_startGameSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
}
Expand Down

0 comments on commit 1cf283b

Please sign in to comment.