aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2014-08-01 19:36:24 +0200
committerStrangerke2014-08-01 19:36:24 +0200
commit1a49887855d4b0075fa87203f3403250b308429b (patch)
tree124af03ee47be43587f1a7f7fbba5c596b59a3b5 /engines
parentc012c762d014c4c77ab5165b0c45b3c51ec34149 (diff)
downloadscummvm-rg350-1a49887855d4b0075fa87203f3403250b308429b.tar.gz
scummvm-rg350-1a49887855d4b0075fa87203f3403250b308429b.tar.bz2
scummvm-rg350-1a49887855d4b0075fa87203f3403250b308429b.zip
CGE2: Some cosmetic changes
Diffstat (limited to 'engines')
-rw-r--r--engines/cge2/cge2.cpp26
-rw-r--r--engines/cge2/cge2.h2
-rw-r--r--engines/cge2/cge2_main.cpp28
3 files changed, 33 insertions, 23 deletions
diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp
index f175fceced..f938b8b87f 100644
--- a/engines/cge2/cge2.cpp
+++ b/engines/cge2/cge2.cpp
@@ -115,18 +115,20 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription)
void CGE2Engine::init() {
// Create debugger console
_console = new CGE2Console(this);
-
_resman = new ResourceManager();
_vga = new Vga(this);
_fx = new Fx(this, 16);
_sound = new Sound(this);
_midiPlayer = new MusicPlayer(this);
_text = new Text(this, "CGE");
+
for (int i = 0; i < 2; i++)
_heroTab[i] = new HeroTab(this);
+
_eye = new V3D();
for (int i = 0; i < kSceneMax; i++)
_eyeTab[i] = new V3D();
+
_spare = new Spare(this);
_commandHandler = new CommandHandler(this, false);
_commandHandlerTurbo = new CommandHandler(this, true);
@@ -134,12 +136,13 @@ void CGE2Engine::init() {
_infoLine = new InfoLine(this, kInfoW);
_mouse = new Mouse(this);
_keyboard = new Keyboard(this);
+
for (int i = 0; i < kMaxPoint; i++)
_point[i] = new V3D();
+
_sys = new System(this);
_eventManager = new EventManager(this);
_map = new Map(this);
-
_startGameSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
}
@@ -156,11 +159,13 @@ void CGE2Engine::deinit() {
delete _sound;
delete _midiPlayer;
delete _text;
+
for (int i = 0; i < 2; i++)
delete _heroTab[i];
- for (int i = 0; i < kSceneMax; i++) {
+
+ for (int i = 0; i < kSceneMax; i++)
delete _eyeTab[i];
- }
+
delete _eye;
delete _commandHandler;
delete _commandHandlerTurbo;
@@ -168,20 +173,20 @@ void CGE2Engine::deinit() {
delete _infoLine;
delete _mouse;
delete _keyboard;
+
if (_talk != nullptr)
delete _talk;
- for (int i = 0; i < kMaxPoint; i++) {
+
+ for (int i = 0; i < kMaxPoint; i++)
delete _point[i];
- }
+
delete _sys;
delete _eventManager;
delete _map;
}
bool CGE2Engine::hasFeature(EngineFeature f) const {
- return
- (f == kSupportsLoadingDuringRuntime) ||
- (f == kSupportsSavingDuringRuntime);
+ return (f == kSupportsLoadingDuringRuntime) || (f == kSupportsSavingDuringRuntime);
}
Common::Error CGE2Engine::run() {
@@ -190,10 +195,9 @@ Common::Error CGE2Engine::run() {
initGraphics(kScrWidth, kScrHeight, false);
init();
-
cge2_main();
-
deinit();
+
return Common::kNoError;
}
diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h
index 38b48aaa23..4043f15b16 100644
--- a/engines/cge2/cge2.h
+++ b/engines/cge2/cge2.h
@@ -282,10 +282,12 @@ public:
bool _dark;
int _waitSeq;
int _waitRef;
+
struct {
int *_wait;
int _ref[2];
} _soundStat;
+
bool _taken;
bool _endGame;
int _req;
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp
index 127405a89d..f3dad8bdec 100644
--- a/engines/cge2/cge2_main.cpp
+++ b/engines/cge2/cge2_main.cpp
@@ -134,9 +134,8 @@ char *CGE2Engine::tail(char *s) {
int CGE2Engine::takeEnum(const char **tab, const char *text) {
if (text) {
for (const char **e = tab; *e; e++) {
- if (scumm_stricmp(text, *e) == 0) {
+ if (scumm_stricmp(text, *e) == 0)
return e - tab;
- }
}
}
return -1;
@@ -158,8 +157,10 @@ Sprite *CGE2Engine::loadSprite(const char *fname, int ref, int scene, V3D &pos)
int shpcnt = 0;
int seqcnt = 0;
int cnt[kActions];
+
for (int i = 0; i < kActions; i++)
cnt[i] = 0;
+
ID section = kIdPhase;
bool frnt = true;
bool east = false;
@@ -184,8 +185,7 @@ Sprite *CGE2Engine::loadSprite(const char *fname, int ref, int scene, V3D &pos)
continue;
Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
- char *p;
- p = token(tmpStr);
+ char *p = token(tmpStr);
if (*p == '@') {
if (label != kNoByte)
badLab(fname);
@@ -272,7 +272,7 @@ Sprite *CGE2Engine::loadSprite(const char *fname, int ref, int scene, V3D &pos)
} else // No sprite description: mono-shaped sprite with only .BMP file.
++shpcnt;
- // Make sprite of choosen type:
+ // Make sprite of chosen type:
Sprite *sprite = nullptr;
char c = *fname | 0x20;
if (c >= 'a' && c <= 'z' && fname[1] == '0' && fname[2] == '\0') {
@@ -374,8 +374,9 @@ void CGE2Engine::loadScript(const char *fname, bool onlyToolbar) {
_spare->dispose(sprite);
else
delete sprite;
+
if (_spare->count() == n)
- error("Durplicated reference! %s", SpN);
+ error("Duplicate reference! %s", SpN);
}
}
@@ -397,12 +398,12 @@ void CGE2Engine::movie(const char *ext) {
_now = atoi(ext + 2);
loadScript(fn);
sceneUp(_now);
-
_keyboard->setClient(_sys);
+
while (!_commandHandler->idle() && !_quitFlag)
mainLoop();
- _keyboard->setClient(nullptr);
+ _keyboard->setClient(nullptr);
_commandHandler->addCommand(kCmdClear, -1, 0, nullptr);
_commandHandlerTurbo->addCommand(kCmdClear, -1, 0, nullptr);
_spare->clear();
@@ -445,10 +446,10 @@ void CGE2Engine::sceneUp(int cav) {
if (!_dark)
_vga->sunset();
+
_vga->show();
_vga->copyPage(1, 0);
_vga->show();
-
_vga->sunrise(_vga->_sysPal);
_dark = false;
@@ -463,12 +464,15 @@ void CGE2Engine::sceneDown() {
busy(true);
_soundStat._wait = nullptr; // unlock snail
Sprite *spr = _vga->_showQ->locate((_now << 8) | 254);
+
if (spr)
feedSnail(spr, kNear, _heroTab[_sex]->_ptr);
+
while (!(_commandHandler->idle() && _commandHandlerTurbo->idle())) {
_commandHandlerTurbo->runCommand();
_commandHandler->runCommand();
}
+
closePocket();
for (int i = 0; i < 2; i++)
_spare->update(_vga->_showQ->remove(_heroTab[i]->_ptr));
@@ -480,10 +484,9 @@ void CGE2Engine::switchScene(int scene) {
return;
_req = scene;
-
storeHeroPos();
-
*(_eyeTab[_now]) = *_eye;
+
if (scene < 0)
_commandHandler->addCallback(kCmdExec, -1, 0, kQGame); // quit game
else {
@@ -630,7 +633,6 @@ void CGE2Engine::runGame() {
return;
loadUser();
-
sceneUp(_now);
initToolbar();
@@ -837,6 +839,7 @@ void CGE2Engine::switchHero(int sex) {
_sys->_blinkSprite->_flags._hide = false;
_sys->_blinkSprite = nullptr;
}
+
if (scene >= 0) {
_commandHandler->addCommand(kCmdSeq, -1, 2, _heroTab[_sex]->_face);
_sex ^= 1;
@@ -875,6 +878,7 @@ void Sprite::touch(uint16 mask, V2D pos, Common::KeyCode keyCode) {
if (_vm->_sex == sex) {
if (_vm->_sys->_blinkSprite)
_vm->_sys->_blinkSprite->_flags._hide = false;
+
if (_vm->_sys->_blinkSprite == this)
_vm->_sys->_blinkSprite = nullptr;
else