aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2014-05-16 01:04:01 +0200
committeruruk2014-05-16 01:04:01 +0200
commitb3cdf9ca3883072d33ca59e1e274eacc57fae4c1 (patch)
tree779937cf8d258eed335062c7be325cbce8a07361
parent45714a12f1b522f302fc06ec5c8fd1412a05e3f4 (diff)
downloadscummvm-rg350-b3cdf9ca3883072d33ca59e1e274eacc57fae4c1.tar.gz
scummvm-rg350-b3cdf9ca3883072d33ca59e1e274eacc57fae4c1.tar.bz2
scummvm-rg350-b3cdf9ca3883072d33ca59e1e274eacc57fae4c1.zip
CGE2: Implement loadTab().
-rw-r--r--engines/cge2/cge2_main.cpp31
-rw-r--r--engines/cge2/fileio.cpp8
-rw-r--r--engines/cge2/fileio.h2
3 files changed, 39 insertions, 2 deletions
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp
index 941f2b8ca4..ce84b23f2f 100644
--- a/engines/cge2/cge2_main.cpp
+++ b/engines/cge2/cge2_main.cpp
@@ -356,12 +356,39 @@ void CGE2Engine::runGame() {
}
void CGE2Engine::loadTab() {
- char *n = _text->getText(240);
setEye(_text->getText(240));
for (int i = 0; i < kCaveMax; i++)
_eyeTab[i] == _eye;
- warning("STUB: 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();
+ uint16 round = uint16((long(a) << 16) / 100);
+
+ if (round > 0x7FFF)
+ b++;
+
+ switch (j) {
+ case 0:
+ _eyeTab[i]->_x = b;
+ break;
+ case 1:
+ _eyeTab[i]->_y = b;
+ break;
+ case 2:
+ _eyeTab[i]->_z = b;
+ break;
+ }
+
+ }
+ }
+ }
+
+ warning("STUB: CGE2Engine::loadTab() - Recheck this");
}
void CGE2Engine::cge2_main() {
diff --git a/engines/cge2/fileio.cpp b/engines/cge2/fileio.cpp
index a9e9563867..5885871b29 100644
--- a/engines/cge2/fileio.cpp
+++ b/engines/cge2/fileio.cpp
@@ -216,6 +216,14 @@ uint32 EncryptedStream::read(byte *dataPtr, uint32 dataSize) {
return _readStream->read(dataPtr, dataSize);
}
+unsigned EncryptedStream::readUnsigned() {
+ return _readStream->readUint16BE();
+}
+
+signed EncryptedStream::readSigned() {
+ return _readStream->readSint16BE();
+}
+
bool EncryptedStream::err() {
return (_error & _readStream->err());
}
diff --git a/engines/cge2/fileio.h b/engines/cge2/fileio.h
index 315002268c..a35b014311 100644
--- a/engines/cge2/fileio.h
+++ b/engines/cge2/fileio.h
@@ -121,6 +121,8 @@ public:
int32 pos();
int32 size();
uint32 read(byte *dataPtr, uint32 dataSize);
+ unsigned readUnsigned();
+ signed readSigned();
Common::String readLine();
int getLineCount() { return _lineCount; }