aboutsummaryrefslogtreecommitdiff
path: root/engines/cge
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2013-04-18 23:35:23 +0200
committerWillem Jan Palenstijn2013-05-08 20:40:58 +0200
commit9c2341678ef4984bf92b3878295250faf980b066 (patch)
tree2fb4805e05e16b9924e80c9947e6bad723b28c4b /engines/cge
parent8172d679df5148a4a32f46074b20cb6caf91844f (diff)
parenta5f4ff36ffc386d48f2da49387a9655ce9295a4d (diff)
downloadscummvm-rg350-9c2341678ef4984bf92b3878295250faf980b066.tar.gz
scummvm-rg350-9c2341678ef4984bf92b3878295250faf980b066.tar.bz2
scummvm-rg350-9c2341678ef4984bf92b3878295250faf980b066.zip
Merge branch 'master'
Diffstat (limited to 'engines/cge')
-rw-r--r--engines/cge/bitmap.cpp24
-rw-r--r--engines/cge/bitmap.h3
-rw-r--r--engines/cge/cge.cpp15
-rw-r--r--engines/cge/cge.h12
-rw-r--r--engines/cge/cge_main.cpp67
-rw-r--r--engines/cge/cge_main.h5
-rw-r--r--engines/cge/console.cpp14
-rw-r--r--engines/cge/console.h1
-rw-r--r--engines/cge/detection.cpp38
-rw-r--r--engines/cge/events.cpp159
-rw-r--r--engines/cge/events.h43
-rw-r--r--engines/cge/fileio.cpp1
-rw-r--r--engines/cge/snail.cpp12
-rw-r--r--engines/cge/snail.h3
-rw-r--r--engines/cge/talk.cpp75
-rw-r--r--engines/cge/talk.h4
-rw-r--r--engines/cge/text.cpp20
-rw-r--r--engines/cge/vga13h.cpp24
-rw-r--r--engines/cge/vga13h.h6
-rw-r--r--engines/cge/walk.h1
20 files changed, 220 insertions, 307 deletions
diff --git a/engines/cge/bitmap.cpp b/engines/cge/bitmap.cpp
index 39bafc5e98..37f4eb070e 100644
--- a/engines/cge/bitmap.cpp
+++ b/engines/cge/bitmap.cpp
@@ -136,7 +136,7 @@ Bitmap &Bitmap::operator=(const Bitmap &bmp) {
} else {
uint16 vsiz = (uint8 *)bmp._b - (uint8 *)v0;
uint16 siz = vsiz + _h * sizeof(HideDesc);
- uint8 *v1 = (uint8 *)malloc(sizeof(uint8) * siz);
+ uint8 *v1 = new uint8[siz];
assert(v1 != NULL);
memcpy(v1, v0, siz);
_b = (HideDesc *)((_v = v1) + vsiz);
@@ -154,20 +154,6 @@ char *Bitmap::forceExt(char *buf, const char *name, const char *ext) {
return buf;
}
-uint16 Bitmap::moveVmap(uint8 *buf) {
- debugC(1, kCGEDebugBitmap, "Bitmap::moveVmap(buf)");
-
- if (!_v)
- return 0;
-
- uint16 vsiz = (uint8 *)_b - (uint8 *)_v;
- uint16 siz = vsiz + _h * sizeof(HideDesc);
- memcpy(buf, _v, siz);
- delete[] _v;
- _b = (HideDesc *)((_v = buf) + vsiz);
- return siz;
-}
-
BitmapPtr Bitmap::code() {
debugC(1, kCGEDebugBitmap, "Bitmap::code()");
@@ -212,7 +198,7 @@ BitmapPtr Bitmap::code() {
if ((pix == kPixelTransp) != skip || cnt >= 0x3FF0) { // end of block
cnt |= (skip) ? kBmpSKP : kBmpCPY;
if (_v)
- *cp = TO_LE_16(cnt); // store block description uint16
+ WRITE_LE_UINT16(cp, cnt); // store block description uint16
cp = (uint16 *) im;
im += 2;
@@ -234,7 +220,7 @@ BitmapPtr Bitmap::code() {
} else {
cnt |= kBmpCPY;
if (_v)
- *cp = TO_LE_16(cnt);
+ WRITE_LE_UINT16(cp, cnt);
cp = (uint16 *) im;
im += 2;
@@ -246,13 +232,13 @@ BitmapPtr Bitmap::code() {
if (cnt && ! skip) {
cnt |= kBmpCPY;
if (_v)
- *cp = TO_LE_16(cnt);
+ WRITE_LE_UINT16(cp, cnt);
cp = (uint16 *) im;
im += 2;
}
if (_v)
- *cp = TO_LE_16(kBmpEOI);
+ WRITE_LE_UINT16(cp, kBmpEOI);
cp = (uint16 *) im;
im += 2;
}
diff --git a/engines/cge/bitmap.h b/engines/cge/bitmap.h
index aa6282705c..3de05ac2fd 100644
--- a/engines/cge/bitmap.h
+++ b/engines/cge/bitmap.h
@@ -49,7 +49,7 @@ enum {
struct HideDesc {
uint16 _skip;
uint16 _hide;
-};
+} PACKED_STRUCT;
#include "common/pack-end.h"
@@ -77,7 +77,6 @@ public:
void show(int16 x, int16 y);
void xShow(int16 x, int16 y);
bool solidAt(int16 x, int16 y);
- uint16 moveVmap(uint8 *buf);
};
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index 4ed2932cd9..875ac34cd0 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -28,6 +28,7 @@
#include "common/EventRecorder.h"
#include "common/file.h"
#include "common/fs.h"
+#include "engines/advancedDetector.h"
#include "engines/util.h"
#include "cge/cge.h"
#include "cge/vga13h.h"
@@ -53,9 +54,8 @@ CGEEngine::CGEEngine(OSystem *syst, const ADGameDescription *gameDescription)
_oldLev = 0;
_pocPtr = 0;
_bitmapPalette = NULL;
-
-
-
+ _quitFlag = false;
+ _showBoundariesFl = false;
}
void CGEEngine::initSceneValues() {
@@ -91,7 +91,7 @@ void CGEEngine::init() {
_font = new Font(this, "CGE");
_text = new Text(this, "CGE");
_talk = NULL;
- _vga = new Vga();
+ _vga = new Vga(this);
_sys = new System(this);
_pocLight = new PocLight(this);
for (int i = 0; i < kPocketNX; i++)
@@ -144,7 +144,6 @@ void CGEEngine::deinit() {
DebugMan.clearAllDebugChannels();
delete _console;
- _midiPlayer->killMidi();
// Delete engine objects
delete _vga;
@@ -161,8 +160,9 @@ void CGEEngine::deinit() {
delete _keyboard;
delete _mouse;
delete _eventManager;
- delete _fx;
delete _sound;
+ delete _fx;
+ delete _midiPlayer;
delete _font;
delete _commandHandler;
delete _commandHandlerTurbo;
@@ -214,7 +214,8 @@ bool CGEEngine::canLoadGameStateCurrently() {
}
bool CGEEngine::canSaveGameStateCurrently() {
- return (_startupMode == 0) && _mouse->_active;
+ return (_startupMode == 0) && _mouse->_active &&
+ _commandHandler->idle() && !_hero->_flags._hide;
}
} // End of namespace CGE
diff --git a/engines/cge/cge.h b/engines/cge/cge.h
index 2ce154a4fb..4ebc836ee0 100644
--- a/engines/cge/cge.h
+++ b/engines/cge/cge.h
@@ -31,11 +31,12 @@
#include "engines/engine.h"
#include "gui/debugger.h"
#include "graphics/surface.h"
-#include "engines/advancedDetector.h"
#include "cge/console.h"
#include "cge/bitmap.h"
#include "cge/sound.h"
+struct ADGameDescription;
+
namespace CGE {
class Console;
@@ -73,8 +74,9 @@ class Talk;
#define kPathMax 128
#define kCryptSeed 0xA5
#define kMaxFile 128
-#define kMapXCnt 40
-#define kMapZCnt 20
+#define kMapXCnt 40
+#define kMapZCnt 20
+#define kMapTop 80
// our engine debug channels
enum {
@@ -140,6 +142,8 @@ public:
virtual Common::Error saveGameState(int slot, const Common::String &desc);
static const int _maxSceneArr[5];
+ bool _quitFlag;
+ bool _showBoundariesFl;
const ADGameDescription *_gameDescription;
int _startupMode;
@@ -222,7 +226,7 @@ public:
void runGame();
bool showTitle(const char *name);
void movie(const char *ext);
- void inf(const char *text);
+ void inf(const char *text, bool wideSpace = false);
void selectSound();
void dummy() {}
void NONE();
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index 1c2759bd97..fd7dd85c57 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -185,7 +185,7 @@ void CGEEngine::syncHeader(Common::Serializer &s) {
s.syncAsUint16LE(checksum);
} else {
// Read checksum and validate it
- uint16 checksum;
+ uint16 checksum = 0;
s.syncAsUint16LE(checksum);
if (checksum != kSavegameCheckSum)
error("%s", _text->getText(kBadSVG));
@@ -200,7 +200,7 @@ bool CGEEngine::loadGame(int slotNumber, SavegameHeader *header, bool tiny) {
if (slotNumber == -1) {
// Loading the data for the initial game state
- kSavegame0File file = kSavegame0File(this, kSavegame0Name);
+ EncryptedStream file = EncryptedStream(this, kSavegame0Name);
int size = file.size();
byte *dataBuffer = (byte *)malloc(size);
file.read(dataBuffer, size);
@@ -277,7 +277,12 @@ Common::String CGEEngine::generateSaveName(int slot) {
Common::Error CGEEngine::loadGameState(int slot) {
// Clear current game activity
sceneDown();
+ _hero->park();
resetGame();
+
+ // If music is playing, kill it.
+ if (_music)
+ _midiPlayer->killMidi();
// Load the game
loadGame(slot, NULL);
@@ -291,10 +296,12 @@ Common::Error CGEEngine::loadGameState(int slot) {
void CGEEngine::resetGame() {
_vga->_spareQ->clear();
+ _commandHandler->reset();
}
Common::Error CGEEngine::saveGameState(int slot, const Common::String &desc) {
sceneDown();
+ _hero->park();
_oldLev = _lev;
// Write out the user's progress
@@ -685,6 +692,8 @@ void CGEEngine::xScene() {
debugC(6, kCGEDebugEngine, "CGEEngine::xScene()");
sceneDown();
+ if (_lev != -1)
+ _commandHandler->addCommand(kCmdLevel, -1, _lev, &_sceneLight);
sceneUp();
}
@@ -692,6 +701,7 @@ void CGEEngine::qGame() {
debugC(1, kCGEDebugEngine, "CGEEngine::qGame()");
sceneDown();
+ _hero->park();
_oldLev = _lev;
// Write out the user's progress
@@ -716,7 +726,7 @@ void CGEEngine::switchScene(int newScene) {
if (_hero) {
_hero->park();
_hero->step(0);
- _vga->_spareQ->_show = 0;
+ _vga->_spareQ->_show = false;
}
_sceneLight->gotoxy(kSceneX + ((_now - 1) % kSceneNx) * kSceneDx + kSceneSX,
kSceneY + ((_now - 1) / kSceneNx) * kSceneDy + kSceneSY);
@@ -725,6 +735,7 @@ void CGEEngine::switchScene(int newScene) {
keyClick();
_commandHandler->addCommand(kCmdLabel, -1, 0, NULL); // wait for repaint
_commandHandler->addCallback(kCmdExec, 0, 0, kXScene); // switch scene
+
}
}
@@ -753,27 +764,14 @@ void System::touch(uint16 mask, int x, int y) {
funTouch();
if (mask & kEventKeyb) {
- _vm->keyClick();
- _vm->killText();
- if (_vm->_startupMode == 1) {
- _vm->_commandHandler->addCommand(kCmdClear, -1, 0, NULL);
- return;
- }
- switch (x) {
- case 'X':
- if (_vm->_keyboard->_key[kKeyAlt])
- _vm->quit();
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- if (_vm->_keyboard->_key[kKeyAlt]) {
- _vm->_commandHandler->addCommand(kCmdLevel, -1, x - '0', NULL);
- break;
+ if (x == Common::KEYCODE_ESCAPE) {
+ // The original was calling keyClick()
+ // The sound is uselessly annoying and noisy, so it has been removed
+ _vm->killText();
+ if (_vm->_startupMode == 1) {
+ _vm->_commandHandler->addCommand(kCmdClear, -1, 0, NULL);
+ return;
}
- break;
}
} else {
if (_vm->_startupMode)
@@ -830,7 +828,7 @@ void System::tick() {
if (_vm->_commandHandler->idle()) {
if (_vm->_flag[0]) // Pain flag
_vm->heroCover(9);
- else { // CHECKME: Before, was: if (Startup::_core >= CORE_MID) {
+ else {
int n = _vm->newRandom(100);
if (n > 96)
_vm->heroCover(6 + (_vm->_hero->_x + _vm->_hero->_w / 2 < kScrWidth / 2));
@@ -920,7 +918,7 @@ void CGEEngine::optionTouch(int opt, uint16 mask) {
if (mask & kMouseLeftUp)
switchMusic();
else if (mask & kMouseRightUp)
- warning("TODO: Use ScummVM sound dialog");
+ openMainMenuDialog();
break;
case 3:
if (mask & kMouseLeftUp)
@@ -1252,12 +1250,15 @@ void CGEEngine::mainLoop() {
// Handle any pending events
_eventManager->poll();
+
+ // Check shouldQuit()
+ _quitFlag = shouldQuit();
}
void CGEEngine::handleFrame() {
// Game frame delay
uint32 millis = g_system->getMillis();
- while (!_eventManager->_quitFlag && (millis < (_lastFrame + kGameFrameDelay))) {
+ while (!_quitFlag && (millis < (_lastFrame + kGameFrameDelay))) {
// Handle any pending events
_eventManager->poll();
@@ -1306,7 +1307,7 @@ void CGEEngine::loadUser() {
}
void CGEEngine::runGame() {
- if (_eventManager->_quitFlag)
+ if (_quitFlag)
return;
loadHeroXY();
@@ -1336,9 +1337,7 @@ void CGEEngine::runGame() {
_vga->_showQ->append(_mouse);
-// ___________
loadUser();
-// ~~~~~~~~~~~
if ((_sprite = _vga->_spareQ->locate(121)) != NULL)
_commandHandlerTurbo->addCommand(kCmdSeq, -1, _vga->_mono, _sprite);
@@ -1406,7 +1405,7 @@ void CGEEngine::runGame() {
_keyboard->setClient(_sys);
// main loop
- while (!_finis && !_eventManager->_quitFlag) {
+ while (!_finis && !_quitFlag) {
if (_flag[3])
_commandHandler->addCallback(kCmdExec, -1, 0, kQGame);
mainLoop();
@@ -1429,7 +1428,7 @@ void CGEEngine::runGame() {
void CGEEngine::movie(const char *ext) {
assert(ext);
- if (_eventManager->_quitFlag)
+ if (_quitFlag)
return;
char fn[12];
@@ -1441,7 +1440,7 @@ void CGEEngine::movie(const char *ext) {
feedSnail(_vga->_showQ->locate(999), kTake);
_vga->_showQ->append(_mouse);
_keyboard->setClient(_sys);
- while (!_commandHandler->idle() && !_eventManager->_quitFlag)
+ while (!_commandHandler->idle() && !_quitFlag)
mainLoop();
_keyboard->setClient(NULL);
@@ -1453,7 +1452,7 @@ void CGEEngine::movie(const char *ext) {
}
bool CGEEngine::showTitle(const char *name) {
- if (_eventManager->_quitFlag)
+ if (_quitFlag)
return false;
_bitmapPalette = _vga->_sysPal;
@@ -1486,7 +1485,7 @@ bool CGEEngine::showTitle(const char *name) {
_mouse->on();
for (; !_commandHandler->idle() || Vmenu::_addr;) {
mainLoop();
- if (_eventManager->_quitFlag)
+ if (_quitFlag)
return false;
}
diff --git a/engines/cge/cge_main.h b/engines/cge/cge_main.h
index bdb3121d63..87199ee524 100644
--- a/engines/cge/cge_main.h
+++ b/engines/cge/cge_main.h
@@ -56,10 +56,8 @@ namespace CGE {
#define kSystemRate 6 // 12 Hz
#define kHeroFun0 (40 * 12)
#define kHeroFun1 ( 2 * 12)
-#define kGetNamePrompt 50
-#define kGetNameTitle 51
+#define kShowScummVMVersion 15
#define kTSeq 96
-#define kNoMusic 98
#define kBadSVG 99
#define kSeqHTalk (kTSeq + 4)
#define kSeqTooFar (kTSeq + 5)
@@ -82,7 +80,6 @@ namespace CGE {
#define kStackSize 2048
#define kSavegameCheckSum (1956 + _now + _oldLev + _game + _music + _demoText)
#define kSavegame0Name ("{{INIT}}" kSvgExt)
-#define kSavegame0File EncryptedStream
#define kSavegameStrSize 11
#define kGameFrameDelay (1000 / 50)
#define kGameTickDelay (1000 / 62)
diff --git a/engines/cge/console.cpp b/engines/cge/console.cpp
index 71eedf34ea..105f241944 100644
--- a/engines/cge/console.cpp
+++ b/engines/cge/console.cpp
@@ -26,9 +26,23 @@
namespace CGE {
CGEConsole::CGEConsole(CGEEngine *vm) : GUI::Debugger(), _vm(vm) {
+ DCmd_Register("Boundaries", WRAP_METHOD(CGEConsole, Cmd_boundaries));
}
CGEConsole::~CGEConsole() {
}
+/**
+ * This command shows and hides boundaries
+ */
+bool CGEConsole::Cmd_boundaries(int argc, const char **argv) {
+ if (argc != 1) {
+ DebugPrintf("Usage: %s\n", argv[0]);
+ return true;
+ }
+
+ _vm->_showBoundariesFl = !_vm->_showBoundariesFl;
+ return false;
+}
+
} // End of namespace CGE
diff --git a/engines/cge/console.h b/engines/cge/console.h
index 25a1a4fae3..ea36dfbaae 100644
--- a/engines/cge/console.h
+++ b/engines/cge/console.h
@@ -36,6 +36,7 @@ public:
private:
CGEEngine *_vm;
+ bool Cmd_boundaries(int argc, const char **argv);
};
} // End of namespace CGE
diff --git a/engines/cge/detection.cpp b/engines/cge/detection.cpp
index f2f5764e54..b3ef31f30f 100644
--- a/engines/cge/detection.cpp
+++ b/engines/cge/detection.cpp
@@ -44,7 +44,7 @@ static const ADGameDescription gameDescriptions[] = {
{"vol.dat", 0, "f9ae2e7f8f7cac91378cdafca43faf1e", 8437572},
AD_LISTEND
},
- Common::PL_POL, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO1(GUIO_NONE)
+ Common::PL_POL, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO0()
},
{
"soltys", "Soltys Freeware",
@@ -53,17 +53,7 @@ static const ADGameDescription gameDescriptions[] = {
{"vol.dat", 0, "f9ae2e7f8f7cac91378cdafca43faf1e", 8437676},
AD_LISTEND
},
- Common::PL_POL, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO1(GUIO_NONE)
- },
- // English ScummVM version
- {
- "soltys", "",
- {
- {"vol.cat", 0, "bd08969b5f1acea0f92d195f750c17d5", 50176},
- {"vol.dat", 0, "f9ae2e7f8f7cac91378cdafca43faf1e", 8428832},
- AD_LISTEND
- },
- Common::EN_ANY, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO1(GUIO_NONE)
+ Common::PL_POL, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO0()
},
{
"soltys", "Soltys Demo (not supported)",
@@ -72,7 +62,7 @@ static const ADGameDescription gameDescriptions[] = {
{"vol.dat", 0, "75d385a6074c58b69f7730481f256051", 1796710},
AD_LISTEND
},
- Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO , GUIO1(GUIO_NONE)
+ Common::EN_ANY, Common::kPlatformPC, ADGF_DEMO , GUIO0()
},
{
"soltys", "Soltys Demo (not supported)",
@@ -81,7 +71,25 @@ static const ADGameDescription gameDescriptions[] = {
{"vol.dat", 0, "c5d9b15863cab61dc125551576dece04", 1075272},
AD_LISTEND
},
- Common::PL_POL, Common::kPlatformPC, ADGF_DEMO , GUIO1(GUIO_NONE)
+ Common::PL_POL, Common::kPlatformPC, ADGF_DEMO , GUIO0()
+ },
+ {
+ "soltys", "Soltys Freeware v1.0",
+ {
+ {"vol.cat", 0, "f1675684c68ab90272f5776f8f2c3974", 50176},
+ {"vol.dat", 0, "4ffeff4abc99ac5999b55ccfc56ab1df", 8430868},
+ AD_LISTEND
+ },
+ Common::EN_ANY, Common::kPlatformPC, ADGF_NO_FLAGS , GUIO0()
+ },
+ {
+ "soltys", "Soltys Freeware v1.0",
+ {
+ {"vol.cat", 0, "20fdce799adb618100ef9ee2362be875", 50176},
+ {"vol.dat", 0, "0e43331c846094d77f5dd201827e0a3b", 8439339},
+ AD_LISTEND
+ },
+ Common::PL_POL, Common::kPlatformPC, ADGF_NO_FLAGS, GUIO0()
},
AD_TABLE_END_MARKER
};
@@ -96,7 +104,7 @@ static const ADFileBasedFallback fileBasedFallback[] = {
class CGEMetaEngine : public AdvancedMetaEngine {
public:
CGEMetaEngine() : AdvancedMetaEngine(CGE::gameDescriptions, sizeof(ADGameDescription), CGEGames) {
- _singleid = "Soltys";
+ _singleid = "soltys";
}
virtual const ADGameDescription *fallbackDetect(const FileMap &allFiles, const Common::FSList &fslist) const {
diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp
index cc22d9075a..3c561c5659 100644
--- a/engines/cge/events.cpp
+++ b/engines/cge/events.cpp
@@ -30,6 +30,7 @@
#include "gui/message.h"
#include "common/config-manager.h"
#include "common/events.h"
+#include "engines/advancedDetector.h"
#include "cge/events.h"
#include "cge/events.h"
#include "cge/text.h"
@@ -39,55 +40,8 @@ namespace CGE {
/*----------------- KEYBOARD interface -----------------*/
-const uint16 Keyboard::_code[0x60] = {
- 0, Esc, '1', '2', '3',
- '4', '5', '6', '7', '8',
- '9', '0', '-', '+', BSp,
- Tab, 'Q', 'W', 'E', 'R',
- 'T', 'Y', 'U', 'I', 'O',
- 'P', '[', ']', Enter, 0/*Ctrl*/,
- 'A', 'S', 'D', 'F', 'G',
- 'H', 'J', 'K', 'L', ';',
- '\'', '`', 0/*LShift*/, '\\', 'Z',
- 'X', 'C', 'V', 'B', 'N',
- 'M', ',', '.', '/', 0/*RShift*/,
- '*', 0/*Alt*/, ' ', 0/*Caps*/, F1,
- F2, F3, F4, F5, F6,
- F7, F8, F9, F10, 0/*NumLock*/,
- 0/*ScrollLock*/, Home, Up, PgUp, '-',
- Left, Ctr, Right, '+', End,
- Down, PgDn, Ins, Del, 0 * 0x54,
- 0 * 0x55, 0 * 0x56, F11, F12, 0 * 0x59,
- 0 * 0x5A, 0 * 0x5B, 0 * 0x5C, 0 * 0x5D, 0 * 0x5E,
- 0 * 0x5F
-};
-
-const uint16 Keyboard::_scummVmCodes[0x60] = {
- 0, Common::KEYCODE_ESCAPE, Common::KEYCODE_1, Common::KEYCODE_2, Common::KEYCODE_3,
- Common::KEYCODE_4, Common::KEYCODE_5, Common::KEYCODE_6, Common::KEYCODE_7, Common::KEYCODE_8,
- Common::KEYCODE_9, Common::KEYCODE_0, Common::KEYCODE_MINUS, Common::KEYCODE_PLUS, Common::KEYCODE_BACKSPACE,
- Common::KEYCODE_TAB, Common::KEYCODE_q, Common::KEYCODE_w, Common::KEYCODE_e, Common::KEYCODE_r,
- Common::KEYCODE_t, Common::KEYCODE_y, Common::KEYCODE_u, Common::KEYCODE_i, Common::KEYCODE_o,
- Common::KEYCODE_p, Common::KEYCODE_LEFTBRACKET, Common::KEYCODE_RIGHTBRACKET, Common::KEYCODE_RETURN, 0/*Ctrl*/,
- Common::KEYCODE_a, Common::KEYCODE_s, Common::KEYCODE_d, Common::KEYCODE_f, Common::KEYCODE_g,
- Common::KEYCODE_h, Common::KEYCODE_j, Common::KEYCODE_k, Common::KEYCODE_l, Common::KEYCODE_SEMICOLON,
- Common::KEYCODE_BACKSLASH, Common::KEYCODE_TILDE, Common::KEYCODE_LSHIFT, Common::KEYCODE_BACKSLASH, Common::KEYCODE_z,
- Common::KEYCODE_x, Common::KEYCODE_c, Common::KEYCODE_v, Common::KEYCODE_b, Common::KEYCODE_n,
- Common::KEYCODE_m, Common::KEYCODE_COMMA, Common::KEYCODE_PERIOD, Common::KEYCODE_SLASH, Common::KEYCODE_RSHIFT,
- Common::KEYCODE_KP_MULTIPLY, 0 /*Alt*/, Common::KEYCODE_SPACE, Common::KEYCODE_CAPSLOCK, Common::KEYCODE_F1,
- Common::KEYCODE_F2, Common::KEYCODE_F3, Common::KEYCODE_F4, Common::KEYCODE_F5, Common::KEYCODE_F6,
- Common::KEYCODE_F7, Common::KEYCODE_F8, Common::KEYCODE_F9, Common::KEYCODE_F10, Common::KEYCODE_NUMLOCK,
- Common::KEYCODE_SCROLLOCK, Common::KEYCODE_KP7, Common::KEYCODE_KP8, Common::KEYCODE_KP9, Common::KEYCODE_KP_MINUS,
- Common::KEYCODE_KP4, Common::KEYCODE_KP5, Common::KEYCODE_KP6, Common::KEYCODE_KP_PLUS, Common::KEYCODE_KP1,
- Common::KEYCODE_KP2, Common::KEYCODE_KP3, Common::KEYCODE_KP0, Common::KEYCODE_KP_PERIOD, 0,
- 0, 0, Common::KEYCODE_F11, Common::KEYCODE_F12, 0,
- 0, 0, 0, 0, 0,
- 0
-};
-
Keyboard::Keyboard(CGEEngine *vm) : _client(NULL), _vm(vm) {
- Common::set_to(&_key[0], &_key[0x60], false);
- _current = 0;
+ _keyAlt = false;
}
Keyboard::~Keyboard() {
@@ -98,22 +52,23 @@ Sprite *Keyboard::setClient(Sprite *spr) {
return spr;
}
-bool Keyboard::getKey(Common::Event &event, int &cgeCode) {
+bool Keyboard::getKey(Common::Event &event) {
Common::KeyCode keycode = event.kbd.keycode;
- if ((keycode == Common::KEYCODE_LCTRL) || (keycode == Common::KEYCODE_RCTRL)) {
- cgeCode = kKeyCtrl;
- return true;
- }
- if ((keycode == Common::KEYCODE_LALT) || (keycode == Common::KEYCODE_RALT)) {
- cgeCode = kKeyAlt;
- return true;
- }
- if (keycode == Common::KEYCODE_KP_ENTER) {
- cgeCode = 28;
- return true;
- }
- if (keycode == Common::KEYCODE_F5) {
- warning("keycode %d", event.kbd.ascii);
+
+ if ((keycode == Common::KEYCODE_LALT) || (keycode == Common::KEYCODE_RALT))
+ _keyAlt = true;
+ else
+ _keyAlt = false;
+
+ switch (keycode) {
+ case Common::KEYCODE_F1:
+ if (event.type == Common::EVENT_KEYUP)
+ return false;
+ // Display ScummVM version and translation strings
+ for (int i = 0; i < 5; i++)
+ _vm->_commandHandler->addCommand(kCmdInf, 1, kShowScummVMVersion + i, NULL);
+ return false;
+ case Common::KEYCODE_F5:
if (_vm->canSaveGameStateCurrently()) {
const EnginePlugin *plugin = NULL;
EngineMan.findGame(_vm->_gameDescription->gameid, &plugin);
@@ -123,10 +78,12 @@ bool Keyboard::getKey(Common::Event &event, int &cgeCode) {
int16 savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
Common::String savegameDescription = dialog->getResultString();
delete dialog;
- _vm->saveGameState(savegameId, savegameDescription);
- }
+
+ if (savegameId != -1)
+ _vm->saveGameState(savegameId, savegameDescription);
+ }
return false;
- } else if (keycode == Common::KEYCODE_F7) {
+ case Common::KEYCODE_F7:
if (_vm->canLoadGameStateCurrently()) {
const EnginePlugin *plugin = NULL;
EngineMan.findGame(_vm->_gameDescription->gameid, &plugin);
@@ -135,50 +92,53 @@ bool Keyboard::getKey(Common::Event &event, int &cgeCode) {
dialog->setSaveMode(false);
int16 savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
delete dialog;
- _vm->loadGameState(savegameId);
+
+ if (savegameId != -1)
+ _vm->loadGameState(savegameId);
}
return false;
- }
-
- // Scan through the ScummVM mapping list
- for (int idx = 0; idx < 0x60; idx++) {
- if (_scummVmCodes[idx] == event.kbd.ascii) {
- cgeCode = idx;
- return true;
+ case Common::KEYCODE_d:
+ if (event.kbd.flags & Common::KBD_CTRL) {
+ // Start the debugger
+ _vm->getDebugger()->attach();
+ _vm->getDebugger()->onFrame();
+ return false;
+ }
+ break;
+ case Common::KEYCODE_x:
+ if (event.kbd.flags & Common::KBD_ALT) {
+ _vm->quit();
+ return false;
+ }
+ break;
+ case Common::KEYCODE_0:
+ case Common::KEYCODE_1:
+ case Common::KEYCODE_2:
+ case Common::KEYCODE_3:
+ case Common::KEYCODE_4:
+ if (event.kbd.flags & Common::KBD_ALT) {
+ _vm->_commandHandler->addCommand(kCmdLevel, -1, keycode - '0', NULL);
+ return false;
}
+ default:
+ break;
}
- return false;
+ return true;
}
void Keyboard::newKeyboard(Common::Event &event) {
- int keycode;
- if (!getKey(event, keycode))
+ if (!getKey(event))
return;
- if (event.type == Common::EVENT_KEYUP) {
- // Key release
- _key[keycode] = false;
- } else if (event.type == Common::EVENT_KEYDOWN) {
- // Key press
- _key[keycode] = true;
- _current = Keyboard::_code[keycode];
-
- if (_client) {
- CGEEvent &evt = _vm->_eventManager->getNextEvent();
- evt._x = _current; // Keycode
- evt._mask = kEventKeyb; // Event mask
- evt._spritePtr = _client; // Sprite pointer
- }
+ if ((event.type == Common::EVENT_KEYDOWN) && (_client)) {
+ CGEEvent &evt = _vm->_eventManager->getNextEvent();
+ evt._x = event.kbd.keycode; // Keycode
+ evt._mask = kEventKeyb; // Event mask
+ evt._spritePtr = _client; // Sprite pointer
}
}
-uint16 Keyboard::lastKey() {
- uint16 cur = _current;
- _current = 0;
- return cur;
-}
-
/*----------------- MOUSE interface -----------------*/
Mouse::Mouse(CGEEngine *vm) : Sprite(vm, NULL), _busy(NULL), _hold(NULL), _hx(0), _vm(vm) {
@@ -272,7 +232,6 @@ void Mouse::newMouse(Common::Event &event) {
/*----------------- EventManager interface -----------------*/
EventManager::EventManager(CGEEngine *vm) : _vm(vm){
- _quitFlag = false;
_eventQueueHead = 0;
_eventQueueTail = 0;
memset(&_eventQueue, 0, kEventMax * sizeof(CGEEvent));
@@ -282,10 +241,6 @@ EventManager::EventManager(CGEEngine *vm) : _vm(vm){
void EventManager::poll() {
while (g_system->getEventManager()->pollEvent(_event)) {
switch (_event.type) {
- case Common::EVENT_QUIT:
- // Signal to quit
- _quitFlag = true;
- return;
case Common::EVENT_KEYDOWN:
case Common::EVENT_KEYUP:
// Handle keyboard events
diff --git a/engines/cge/events.h b/engines/cge/events.h
index a4cdfed793..6bbd52e4a5 100644
--- a/engines/cge/events.h
+++ b/engines/cge/events.h
@@ -37,8 +37,6 @@ namespace CGE {
/*----------------- KEYBOARD interface -----------------*/
-#define kKeyCtrl 29
-#define kKeyAlt 56
#define kEventMax 256
enum EventMask {
@@ -51,49 +49,15 @@ enum EventMask {
kEventKeyb = 1 << 7
};
-enum Keys {
- NoKey = 0, CtrlA, CtrlB, CtrlC, CtrlD, CtrlE, CtrlF, CtrlG, CtrlH,
- CtrlI, CtrlJ, CtrlK, CtrlL, CtrlM, CtrlN, CtrlO, CtrlP,
- CtrlQ, CtrlR, CtrlS, CtrlT, CtrlU, CtrlV, CtrlW, CtrlX,
- CtrlY, CtrlZ,
- BSp = 8, Tab,
- Enter = 13,
- Eof = 26, Esc,
- AltQ = 256 + 16, AltW, AltE, AltR, AltT, AltY, AltU, AltI, AltO, AltP,
- AltA = 256 + 30, AltS, AltD, AltF, AltG, AltH, AltJ, AltK, AltL,
- AltZ = 256 + 44, AltX, AltC, AltV, AltB, AltN, AltM,
- F11 = 256 + 87, F12,
- F1 = 256 + 59, F2, F3, F4, F5, F6, F7, F8, F9, F10,
- ShiftTab = 256 + 15,
- ShiftF1 = 256 + 84, ShiftF2, ShiftF3, ShiftF4, ShiftF5,
- ShiftF6, ShiftF7, ShiftF8, ShiftF9, ShiftF10,
- CtrlF1 = 256 + 94, CtrlF2, CtrlF3, CtrlF4, CtrlF5,
- CtrlF6, CtrlF7, CtrlF8, CtrlF9, CtrlF10,
- AltF1 = 256 + 104, AltF2, AltF3, AltF4, AltF5,
- AltF6, AltF7, AltF8, AltF9, AltF10,
- Home = 256 + 71, Up, PgUp,
- Left = 256 + 75, Ctr, Right,
- End = 256 + 79, Down, PgDn, Ins, Del,
- CtrlLeft = 256 + 115, CtrlRight, CtrlEnd, CtrlPgDn, CtrlHome,
- CtrlPgUp = 256 + 132,
- MouseLeft = 512 + 1, MouseRight,
- TwiceLeft = 512 + 256 + 1, TwiceRight
-};
-
class Keyboard {
private:
- bool getKey(Common::Event &event, int &cgeCode);
- uint16 _current;
+ bool getKey(Common::Event &event);
CGEEngine *_vm;
public:
- static const uint16 _code[0x60];
- static const uint16 _scummVmCodes[0x60];
-
Sprite *_client;
- bool _key[0x60];
+ bool _keyAlt;
void newKeyboard(Common::Event &event);
- uint16 lastKey();
Sprite *setClient(Sprite *spr);
Keyboard(CGEEngine *vm);
@@ -118,7 +82,6 @@ public:
bool _exist;
int _buttons;
Sprite *_busy;
- //Sprite *Touched;
Mouse(CGEEngine *vm);
~Mouse();
void on();
@@ -140,8 +103,6 @@ private:
void handleEvents();
public:
- bool _quitFlag;
-
EventManager(CGEEngine *vm);
void poll();
void clearEvent(Sprite *spr);
diff --git a/engines/cge/fileio.cpp b/engines/cge/fileio.cpp
index 6db0818287..c50db4e929 100644
--- a/engines/cge/fileio.cpp
+++ b/engines/cge/fileio.cpp
@@ -235,6 +235,7 @@ int32 EncryptedStream::pos() {
}
EncryptedStream::~EncryptedStream() {
+ delete _readStream;
}
} // End of namespace CGE
diff --git a/engines/cge/snail.cpp b/engines/cge/snail.cpp
index cbc463ced2..c26f68fa7b 100644
--- a/engines/cge/snail.cpp
+++ b/engines/cge/snail.cpp
@@ -194,7 +194,7 @@ void CommandHandler::runCommand() {
break;
case kCmdInf:
if (_talkEnable) {
- _vm->inf(_vm->_text->getText(tailCmd->_val));
+ _vm->inf(_vm->_text->getText(tailCmd->_val), true);
_vm->_sys->_funDel = kHeroFun0;
}
break;
@@ -375,6 +375,10 @@ bool CommandHandler::idle() {
return (_head == _tail);
}
+void CommandHandler::reset() {
+ _tail = _head;
+}
+
/**
* Handles mini-Games logic
* @param com Command
@@ -406,7 +410,7 @@ void CGEEngine::snGame(Sprite *spr, int num) {
Stage++;
if (hand && Stage > kDressed)
++hand;
- if (i >= 0 || (dup[i] == spr && newRandom(3) == 0)) {
+ if (i >= 0 && (dup[i] == spr && newRandom(3) == 0)) {
_commandHandler->addCommand(kCmdSeq, -1, 3, dup[0]); // Yes
_commandHandler->addCommand(kCmdSeq, -1, 3, dup[1]); // Yes
_commandHandler->addCommand(kCmdSeq, -1, 3, dup[2]); // Yes
@@ -443,7 +447,7 @@ void CGEEngine::snGame(Sprite *spr, int num) {
_commandHandler->addCommand(kCmdSeq, -1, 0, dup[2]); // Get Away (Her)
_commandHandler->addCommand(kCmdSetXY, -1, 182 + kScrWidth * 62, dup[2]);
_commandHandler->addCommand(kCmdSetZ, -1, 9, dup[2]);
- _game = 0;
+ _game = false;
return;
} else {
_commandHandler->addCommand(kCmdSeq, -1, 2, dup[0]); // reset animation sequence
@@ -489,7 +493,7 @@ void CGEEngine::snGame(Sprite *spr, int num) {
_sprK2->step(newRandom(6));
_sprK3->step(newRandom(6));
- if (spr->_ref == 1 && _keyboard->_key[kKeyAlt]) {
+ if (spr->_ref == 1 && _keyboard->_keyAlt) {
_sprK1->step(5);
_sprK2->step(5);
_sprK3->step(5);
diff --git a/engines/cge/snail.h b/engines/cge/snail.h
index 3acbbd0e5f..6a9e717441 100644
--- a/engines/cge/snail.h
+++ b/engines/cge/snail.h
@@ -45,7 +45,7 @@ enum CommandType {
kCmdSetX, kCmdSetY, kCmdSetZ, kCmdTrans, kCmdPort,
kCmdNext, kCmdNNext, kCmdTNext, kCmdRNNext, kCmdRTNext,
kCmdRMNear, kCmdRmTake, kCmdFlag, kCmdSetRef, kCmdBackPt,
- kCmdFlash, kCmdLight, kCmdSetHBarrier, kCmdSetVBarrier, kCmdWalk,
+ kCmdFlash, kCmdLight, kCmdSetVBarrier, kCmdSetHBarrier, kCmdWalk,
kCmdReach, kCmdCover, kCmdUncover, kCmdClear, kCmdTalk,
kCmdMouse, kCmdSound, kCmdCount, kCmdExec, kCmdStep,
kCmdZTrim, kCmdGhost
@@ -70,6 +70,7 @@ public:
void addCallback(CommandType com, int ref, int val, CallbackType cbType);
void insertCommand(CommandType com, int ref, int val, void *ptr);
bool idle();
+ void reset();
private:
CGEEngine *_vm;
bool _turbo;
diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp
index 467b39be40..f5d570b389 100644
--- a/engines/cge/talk.cpp
+++ b/engines/cge/talk.cpp
@@ -73,8 +73,8 @@ uint16 Font::width(const char *text) {
return w;
}
-Talk::Talk(CGEEngine *vm, const char *text, TextBoxStyle mode)
- : Sprite(vm, NULL), _mode(mode), _vm(vm) {
+Talk::Talk(CGEEngine *vm, const char *text, TextBoxStyle mode, bool wideSpace)
+ : Sprite(vm, NULL), _mode(mode), _wideSpace(wideSpace), _vm(vm) {
_ts = NULL;
_flags._syst = true;
update(text);
@@ -85,6 +85,7 @@ Talk::Talk(CGEEngine *vm)
: Sprite(vm, NULL), _mode(kTBPure), _vm(vm) {
_ts = NULL;
_flags._syst = true;
+ _wideSpace = false;
}
void Talk::update(const char *text) {
@@ -103,7 +104,9 @@ void Talk::update(const char *text) {
if (k > mw)
mw = k;
k = 2 * hmarg;
- } else
+ } else if ((*p == 0x20) && (_vm->_font->_widthArr[(unsigned char)*p] > 4) && (!_wideSpace))
+ k += _vm->_font->_widthArr[(unsigned char)*p] - 2;
+ else
k += _vm->_font->_widthArr[(unsigned char)*p];
}
if (k > mw)
@@ -122,7 +125,14 @@ void Talk::update(const char *text) {
} else {
int cw = _vm->_font->_widthArr[(unsigned char)*text];
uint8 *f = _vm->_font->_map + _vm->_font->_pos[(unsigned char)*text];
- for (int i = 0; i < cw; i++) {
+
+ // Handle properly space size, after it was enlarged to display properly
+ // 'F1' text.
+ int8 fontStart = 0;
+ if ((*text == 0x20) && (cw > 4) && (!_wideSpace))
+ fontStart = 2;
+
+ for (int i = fontStart; i < cw; i++) {
uint8 *pp = m;
uint16 n;
uint16 b = *(f++);
@@ -182,55 +192,6 @@ Bitmap *Talk::box(uint16 w, uint16 h) {
return new Bitmap(_vm, w, h, b);
}
-void Talk::putLine(int line, const char *text) {
- // Note: (_ts[0]._w % 4) must be 0
- uint16 w = _ts[0]->_w;
- uint16 h = _ts[0]->_h;
- uint8 *v = _ts[0]->_v;
- uint16 dsiz = w >> 2; // data size (1 plane line size)
- uint16 lsiz = 2 + dsiz + 2; // uint16 for line header, uint16 for gap
- uint16 psiz = h * lsiz; // - last gap, but + plane trailer
- uint16 size = 4 * psiz; // whole map size
- uint16 rsiz = kFontHigh * lsiz; // length of whole text row map
-
- // set desired line pointer
- v += (kTextVMargin + (kFontHigh + kTextLineSpace) * line) * lsiz;
- uint8 *p = v; // assume blanked line above text
-
- // clear whole rectangle
- assert((rsiz % lsiz) == 0);
- for (int planeCtr = 0; planeCtr < 4; planeCtr++, p += psiz) {
- for (byte *pDest = p; pDest < (p + (rsiz - lsiz)); pDest += lsiz)
- Common::copy(p - lsiz, p, pDest);
- }
-
- // paint text line
- if (!text)
- return;
- p = v + 2 + (kTextHMargin / 4) + (kTextHMargin % 4) * psiz;
- uint8 *q = v + size;
-
- while (*text) {
- uint16 cw = _vm->_font->_widthArr[(unsigned char)*text], i;
- uint8 *fp = _vm->_font->_map + _vm->_font->_pos[(unsigned char)*text];
-
- for (i = 0; i < cw; i++) {
- uint16 b = fp[i];
- uint16 n;
- for (n = 0; n < kFontHigh; n++) {
- if (b & 1)
- *p = kTextColFG;
- b >>= 1;
- p += lsiz;
- }
- p = p - rsiz + psiz;
- if (p >= q)
- p = p - size + 1;
- }
- text++;
- }
-}
-
InfoLine::InfoLine(CGEEngine *vm, uint16 w) : Talk(vm), _oldText(NULL), _vm(vm) {
if (!_ts) {
_ts = new BitmapPtr[2];
@@ -271,7 +232,13 @@ void InfoLine::update(const char *text) {
uint16 cw = _vm->_font->_widthArr[(unsigned char)*text];
uint8 *fp = _vm->_font->_map + _vm->_font->_pos[(unsigned char)*text];
- for (uint16 i = 0; i < cw; i++) {
+ // Handle properly space size, after it was enlarged to display properly
+ // 'F1' text.
+ int8 fontStart = 0;
+ if ((*text == 0x20) && (cw > 4) && (!_wideSpace))
+ fontStart = 2;
+
+ for (int i = fontStart; i < cw; i++) {
uint16 b = fp[i];
for (uint16 n = 0; n < kFontHigh; n++) {
if (b & 1)
diff --git a/engines/cge/talk.h b/engines/cge/talk.h
index 55c529b7ea..66e3d85214 100644
--- a/engines/cge/talk.h
+++ b/engines/cge/talk.h
@@ -52,12 +52,12 @@ protected:
TextBoxStyle _mode;
BitmapPtr *_ts;
Bitmap *box(uint16 w, uint16 h);
+ bool _wideSpace;
public:
- Talk(CGEEngine *vm, const char *text, TextBoxStyle mode);
+ Talk(CGEEngine *vm, const char *text, TextBoxStyle mode, bool wideSpace = false);
Talk(CGEEngine *vm);
virtual void update(const char *text);
- void putLine(int line, const char *text);
private:
CGEEngine *_vm;
};
diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp
index 58acb5548c..fd4120d49d 100644
--- a/engines/cge/text.cpp
+++ b/engines/cge/text.cpp
@@ -72,7 +72,7 @@ int16 Text::count() {
strcpy(tmpStr, line.c_str());
if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL)
continue;
- if (!isdigit(*s))
+ if (!Common::isDigit(*s))
continue;
counter++;
@@ -105,7 +105,7 @@ void Text::load() {
strcpy(tmpStr, line.c_str());
if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL)
continue;
- if (!isdigit(*s))
+ if (!Common::isDigit(*s))
continue;
int r = atoi(s);
@@ -135,6 +135,13 @@ char *Text::getText(int ref) {
void Text::say(const char *text, Sprite *spr) {
_vm->killText();
+
+ if (!text)
+ return;
+
+ if (*text == 0)
+ return;
+
_vm->_talk = new Talk(_vm, text, kTBRound);
if (!_vm->_talk)
return;
@@ -175,11 +182,16 @@ void Text::say(const char *text, Sprite *spr) {
_vm->_vga->_showQ->insert(speaker, _vm->_vga->_showQ->last());
}
-void CGEEngine::inf(const char *text) {
+void CGEEngine::inf(const char *text, bool wideSpace) {
debugC(1, kCGEDebugEngine, "CGEEngine::inf(%s)", text);
+ if (!text)
+ return;
+
+ if (*text == 0)
+ return;
killText();
- _talk = new Talk(this, text, kTBRect);
+ _talk = new Talk(this, text, kTBRect, wideSpace);
if (!_talk)
return;
diff --git a/engines/cge/vga13h.cpp b/engines/cge/vga13h.cpp
index 49cfcd3084..186de24036 100644
--- a/engines/cge/vga13h.cpp
+++ b/engines/cge/vga13h.cpp
@@ -115,13 +115,6 @@ BitmapPtr *Sprite::setShapeList(BitmapPtr *shpP) {
return r;
}
-void Sprite::moveShapes(uint8 *buf) {
- BitmapPtr *p;
- for (p = _ext->_shpList; *p; p++) {
- buf += (*p)->moveVmap(buf);
- }
-}
-
bool Sprite::works(Sprite *spr) {
if (!spr || !spr->_ext)
return false;
@@ -492,7 +485,7 @@ void Sprite::sync(Common::Serializer &s) {
_flags._near = flags & 0x0002 ? true : false;
_flags._drag = flags & 0x0004 ? true : false;
_flags._hold = flags & 0x0008 ? true : false;
- _flags._____ = flags & 0x0010 ? true : false;
+ _flags._dummy = flags & 0x0010 ? true : false;
_flags._slav = flags & 0x0020 ? true : false;
_flags._syst = flags & 0x0040 ? true : false;
_flags._kill = flags & 0x0080 ? true : false;
@@ -516,7 +509,7 @@ void Sprite::sync(Common::Serializer &s) {
flags = (flags << 1) | _flags._kill;
flags = (flags << 1) | _flags._syst;
flags = (flags << 1) | _flags._slav;
- flags = (flags << 1) | _flags._____;
+ flags = (flags << 1) | _flags._dummy;
flags = (flags << 1) | _flags._hold;
flags = (flags << 1) | _flags._drag;
flags = (flags << 1) | _flags._near;
@@ -632,7 +625,7 @@ Sprite *Queue::locate(int ref) {
return NULL;
}
-Vga::Vga() : _frmCnt(0), _msg(NULL), _name(NULL), _setPal(false), _mono(0) {
+Vga::Vga(CGEEngine *vm) : _frmCnt(0), _msg(NULL), _name(NULL), _setPal(false), _mono(0), _vm(vm) {
_oldColors = NULL;
_newColors = NULL;
_showQ = new Queue(true);
@@ -829,6 +822,17 @@ void Vga::update() {
updateColors();
_setPal = false;
}
+ if (_vm->_showBoundariesFl) {
+ Vga::_page[0]->hLine(0, 200 - kPanHeight, 320, 0xee);
+ if (_vm->_barriers[_vm->_now]._horz != 255) {
+ for (int i = 0; i < 8; i++)
+ Vga::_page[0]->vLine((_vm->_barriers[_vm->_now]._horz * 8) + i, 0, 200, 0xff);
+ }
+ if (_vm->_barriers[_vm->_now]._vert != 255) {
+ for (int i = 0; i < 4; i++)
+ Vga::_page[0]->hLine(0, 80 + (_vm->_barriers[_vm->_now]._vert * 4) + i, 320, 0xff);
+ }
+ }
g_system->copyRectToScreen((const byte *)Vga::_page[0]->getBasePtr(0, 0), kScrWidth, 0, 0, kScrWidth, kScrHeight);
g_system->updateScreen();
diff --git a/engines/cge/vga13h.h b/engines/cge/vga13h.h
index 0c514c4a66..beca19f667 100644
--- a/engines/cge/vga13h.h
+++ b/engines/cge/vga13h.h
@@ -91,7 +91,7 @@ public:
uint16 _near : 1; // Near action lock
uint16 _drag : 1; // sprite is moveable
uint16 _hold : 1; // sprite is held with mouse
- uint16 _____ : 1; // intrrupt driven animation
+ uint16 _dummy : 1; // intrrupt driven animation
uint16 _slav : 1; // slave object
uint16 _syst : 1; // system object
uint16 _kill : 1; // dispose memory after remove
@@ -128,7 +128,6 @@ public:
virtual ~Sprite();
BitmapPtr shp();
BitmapPtr *setShapeList(BitmapPtr *shp);
- void moveShapes(uint8 *buf);
Sprite *expand();
Sprite *contract();
Sprite *backShow(bool fast = false);
@@ -178,6 +177,7 @@ public:
};
class Vga {
+ CGEEngine *_vm;
bool _setPal;
Dac *_oldColors;
Dac *_newColors;
@@ -197,7 +197,7 @@ public:
Graphics::Surface *_page[4];
Dac *_sysPal;
- Vga();
+ Vga(CGEEngine *vm);
~Vga();
uint8 *glass(Dac *pal, const uint8 colR, const uint8 colG, const uint8 colB);
diff --git a/engines/cge/walk.h b/engines/cge/walk.h
index 99dc362eec..00ec080416 100644
--- a/engines/cge/walk.h
+++ b/engines/cge/walk.h
@@ -35,7 +35,6 @@
namespace CGE {
#define kMapArrSize (kMapZCnt * kMapXCnt)
-#define kMapTop 80
#define kMapHig 80
#define kMapGridX (kScrWidth / kMapXCnt)
#define kMapGridZ (kMapHig / kMapZCnt)