diff options
author | Matthew Hoops | 2009-12-21 14:32:54 +0000 |
---|---|---|
committer | Matthew Hoops | 2009-12-21 14:32:54 +0000 |
commit | ef79d7f017610e15df5ea6b4c6d6a3b218d4d39f (patch) | |
tree | 72c129cb6b65f4286166d265edc88537ad9fb8cf /engines/sci/engine/segment.cpp | |
parent | 2a3cbcbc57bbb960e678b40692cffce69c88149b (diff) | |
download | scummvm-rg350-ef79d7f017610e15df5ea6b4c6d6a3b218d4d39f.tar.gz scummvm-rg350-ef79d7f017610e15df5ea6b4c6d6a3b218d4d39f.tar.bz2 scummvm-rg350-ef79d7f017610e15df5ea6b4c6d6a3b218d4d39f.zip |
SCI32:
- Fully implement kArray and kIsHiRes and mostly implement kString (printf and atoi subfunctions still missing).
- Add a dummy SciGui class for SCI32 to bypass the views. Gabriel Knight 1 will now play the Sierra logo music and the main menu music.
- Some other minor SCI32 changes.
svn-id: r46462
Diffstat (limited to 'engines/sci/engine/segment.cpp')
-rw-r--r-- | engines/sci/engine/segment.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp index fee8a9f4a7..e8b47727ba 100644 --- a/engines/sci/engine/segment.cpp +++ b/engines/sci/engine/segment.cpp @@ -66,6 +66,14 @@ SegmentObj *SegmentObj::createSegmentObj(SegmentType type) { case SEG_TYPE_DYNMEM: mem = new DynMem(); break; +#ifdef ENABLE_SCI32 + case SEG_TYPE_ARRAY: + mem = new ArrayTable(); + break; + case SEG_TYPE_STRING: + mem = new StringTable(); + break; +#endif default: error("Unknown SegmentObj type %d", type); break; @@ -478,5 +486,38 @@ void DynMem::listAllDeallocatable(SegmentId segId, void *param, NoteCallback not (*note)(param, make_reg(segId, 0)); } +#ifdef ENABLE_SCI32 + +Common::String SciString::toString() { + if (_type != 3) + error("SciString::toString(): Array is not a string"); + + Common::String string; + for (uint32 i = 0; i < _size && _data[i] != 0; i++) + string += _data[i]; + + return string; +} + +void SciString::fromString(Common::String string) { + if (_type != 3) + error("SciString::fromString(): Array is not a string"); + + if (string.size() > _size) + setSize(string.size()); + + for (uint32 i = 0; i < string.size(); i++) + _data[i] = string[i]; +} + +SegmentRef StringTable::dereference(reg_t pointer) { + SegmentRef ret; + ret.isRaw = false; + ret.maxSize = _table[pointer.offset].getSize(); + ret.raw = (byte*)_table[pointer.offset].getRawData(); + return ret; +} + +#endif } // End of namespace Sci |