diff options
author | uruk | 2014-05-26 15:58:07 +0200 |
---|---|---|
committer | uruk | 2014-05-26 15:58:07 +0200 |
commit | 75546134c817a2f267c4ffff13b822ccf7e5e923 (patch) | |
tree | 4fca5f3e86fadd4e39b61d8592d76bcdaf451928 /engines/cge2/cge2_main.cpp | |
parent | 8fa31d1168ab6b361125a001fb3a38f0f7389129 (diff) | |
download | scummvm-rg350-75546134c817a2f267c4ffff13b822ccf7e5e923.tar.gz scummvm-rg350-75546134c817a2f267c4ffff13b822ccf7e5e923.tar.bz2 scummvm-rg350-75546134c817a2f267c4ffff13b822ccf7e5e923.zip |
CGE2: Implement loadUser() and loadPos().
Revise File I/O a bit to do so.
Diffstat (limited to 'engines/cge2/cge2_main.cpp')
-rw-r--r-- | engines/cge2/cge2_main.cpp | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp index a2ebc34860..83569cc98a 100644 --- a/engines/cge2/cge2_main.cpp +++ b/engines/cge2/cge2_main.cpp @@ -556,7 +556,35 @@ void CGE2Engine::runGame() { } void CGE2Engine::loadUser() { - warning("STUB: CGE2Engine::loadUser()"); + // set scene + if (_mode == 0) { // user .SVG file found + warning("STUB: CGE2Engine::loadUser()"); + // Missing loading from save file. TODO: Implement it with the saving/loading! + } else if (_mode == 1) { + loadScript("CGE.INI"); + loadPos(); + // Missing saving to save file. TODO: Implement it with the saving/loading! + } +} + +void CGE2Engine::loadPos() { + if (_resman->exist("CGE.HXY")) { + for (int cav = 0; cav < kCaveMax; cav++) + _heroTab[1]->_posTab[cav] = new V2D(this, 180, 10); + + EncryptedStream file(this, "CGE.HXY"); + + for (int cav = 0; cav < kCaveMax; cav++) { + _heroTab[0]->_posTab[cav]->x = file.readSint16LE(); + _heroTab[0]->_posTab[cav]->y = file.readSint16LE(); + } + + for (int cav = 0; cav < 41; cav++) { // (564 - 400) / 4 = 41 + _heroTab[1]->_posTab[cav]->x = file.readSint16LE(); + _heroTab[1]->_posTab[cav]->y = file.readSint16LE(); + } + } else + error("Missing file: CGE.HXY"); } void CGE2Engine::checkSaySwitch() { @@ -575,11 +603,10 @@ void CGE2Engine::loadTab() { if (_resman->exist(kTabName)) { EncryptedStream f(this, kTabName); - Common::File output; for (int i = 0; i < kCaveMax; i++) { for (int j = 0; j < 3; j++) { - signed b = f.readSigned(); - unsigned a = f.readUnsigned(); + signed b = f.readSint16BE(); + unsigned a = f.readUint16BE(); uint16 round = uint16((long(a) << 16) / 100); if (round > 0x7FFF) |