diff options
author | Kamil Zbróg | 2013-11-10 22:49:34 +0000 |
---|---|---|
committer | Kamil Zbróg | 2013-11-10 22:49:34 +0000 |
commit | bd59732ce20df7d62b74b9a88bf510e4e2305c54 (patch) | |
tree | 9c1003e9e82afc229a745578e6cc72b06e5e9877 /engines | |
parent | 416110d3e087cb18b84c8ca26b63700160d9ac0f (diff) | |
download | scummvm-rg350-bd59732ce20df7d62b74b9a88bf510e4e2305c54.tar.gz scummvm-rg350-bd59732ce20df7d62b74b9a88bf510e4e2305c54.tar.bz2 scummvm-rg350-bd59732ce20df7d62b74b9a88bf510e4e2305c54.zip |
PRINCE: code indentation cleanup
Diffstat (limited to 'engines')
-rw-r--r-- | engines/prince/archive.cpp | 42 | ||||
-rw-r--r-- | engines/prince/decompress.cpp | 2 | ||||
-rw-r--r-- | engines/prince/decompress.h | 2 | ||||
-rw-r--r-- | engines/prince/object.h | 2 | ||||
-rw-r--r-- | engines/prince/prince.cpp | 17 | ||||
-rw-r--r-- | engines/prince/prince.h | 9 |
6 files changed, 41 insertions, 33 deletions
diff --git a/engines/prince/archive.cpp b/engines/prince/archive.cpp index 2cf3126f0c..a6927baf0c 100644 --- a/engines/prince/archive.cpp +++ b/engines/prince/archive.cpp @@ -37,13 +37,13 @@ PtcArchive::~PtcArchive() { } static void decrypt(byte *buffer, uint32 size) { - uint32 key = 0xDEADF00D; - while (size--) { - *buffer++ += key & 0xFF; - key ^= 0x2E84299A; - key += 0x424C4148; - key = ((key & 1) << 31) | (key >> 1); - } + uint32 key = 0xDEADF00D; + while (size--) { + *buffer++ += key & 0xFF; + key ^= 0x2E84299A; + key += 0x424C4148; + key = ((key & 1) << 31) | (key >> 1); + } } bool PtcArchive::open(const Common::String &filename) { @@ -55,26 +55,26 @@ bool PtcArchive::open(const Common::String &filename) { uint32 fileTableOffset = _stream->readUint32LE() ^ 0x4D4F4B2D; // MOK- uint32 fileTableSize = _stream->readUint32LE() ^ 0x534F4654; // SOFT - debug("fileTableOffset : %08X", fileTableOffset); - debug("fileTableSize: %08X", fileTableSize); + debug("fileTableOffset : %08X", fileTableOffset); + debug("fileTableSize: %08X", fileTableSize); _stream->seek(fileTableOffset); - byte *fileTable = new byte[fileTableSize]; - byte *fileTableEnd = fileTable + fileTableSize; - _stream->read(fileTable, fileTableSize); - decrypt(fileTable, fileTableSize); - - for (byte *fileItem = fileTable; fileItem < fileTableEnd; fileItem += 32) { - FileEntry item; + byte *fileTable = new byte[fileTableSize]; + byte *fileTableEnd = fileTable + fileTableSize; + _stream->read(fileTable, fileTableSize); + decrypt(fileTable, fileTableSize); + + for (byte *fileItem = fileTable; fileItem < fileTableEnd; fileItem += 32) { + FileEntry item; Common::String name = (const char*)fileItem; - item._offset = READ_LE_UINT32(fileItem + 24); - item._size = READ_LE_UINT32(fileItem + 28); - debug("%12s %8X %d", name.c_str(), item._offset, item._size); + item._offset = READ_LE_UINT32(fileItem + 24); + item._size = READ_LE_UINT32(fileItem + 28); + debug("%12s %8X %d", name.c_str(), item._offset, item._size); _items[name] = item; } - - delete[] fileTable; + + delete[] fileTable; return true; } diff --git a/engines/prince/decompress.cpp b/engines/prince/decompress.cpp index 8eca653e0a..ed52aaf6f7 100644 --- a/engines/prince/decompress.cpp +++ b/engines/prince/decompress.cpp @@ -20,6 +20,8 @@ *
*/
+// John_Doe's implementation
+
#include "prince/decompress.h"
namespace Prince {
diff --git a/engines/prince/decompress.h b/engines/prince/decompress.h index 19c7906eda..88b19c6ae3 100644 --- a/engines/prince/decompress.h +++ b/engines/prince/decompress.h @@ -20,6 +20,8 @@ *
*/
+// John_Doe's implementation
+
#ifndef PRINCE_DECOMPRESS_H
#define PRINCE_DECOMPRESS_H
diff --git a/engines/prince/object.h b/engines/prince/object.h index 052b88dad6..aa55bf06a6 100644 --- a/engines/prince/object.h +++ b/engines/prince/object.h @@ -34,7 +34,7 @@ public: ~Object(); bool loadFromStream(Common::SeekableReadStream &stream); - Graphics::Surface *getSurface() const { return _surface; } + const Graphics::Surface *getSurface() const { return _surface; } private: void loadSurface(Common::SeekableReadStream &stream); diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 005a829444..53c8684a6d 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -143,8 +143,8 @@ bool loadResource(Common::Array<T> &array, const char *resourceName, bool requir if (!stream) { if (required) { error("Can't load %s", resourceName); - return false; } + return false; } typename Common::Array<T>::value_type t; @@ -235,6 +235,8 @@ Common::Error PrinceEngine::run() { } bool PrinceEngine::loadLocation(uint16 locationNr) { + _cameraX = 0; + _newCameraX = 0; _debugger->_locationNr = locationNr; debugEngine("PrinceEngine::loadLocation %d", locationNr); const Common::FSNode gameDataDir(ConfMan.get("path")); @@ -259,7 +261,7 @@ bool PrinceEngine::loadLocation(uint16 locationNr) { } _mobList.clear(); - loadResource(_mobList, "mob.lst"); + loadResource(_mobList, "mob.lst", false); const char *musName = MusicPlayer::_musTable[MusicPlayer::_musRoomTable[locationNr]]; _midiPlayer->loadMidi(musName); @@ -331,6 +333,11 @@ void PrinceEngine::stopSample(uint16 sampleId) { bool PrinceEngine::loadVoice(uint32 slot, const Common::String &streamName) { debugEngine("Loading wav %s slot %d", streamName.c_str(), slot); + if (slot > MAXTEXTS) { + error("Text slot bigger than MAXTEXTS %d", MAXTEXTS); + return false; + } + _voiceStream = SearchMan.createReadStreamForMember(streamName); if (!_voiceStream) { error("Can't open %s", streamName.c_str()); @@ -443,11 +450,15 @@ void PrinceEngine::hotspot() { if (x + textW > _graph->_frontScreen->w) x = _graph->_frontScreen->w - textW; + uint16 y = mousepos.y - _font->getFontHeight(); + if (y > _graph->_frontScreen->h) + y = _font->getFontHeight() - 2; + _font->drawString( _graph->_frontScreen, mob._name, x, - mousepos.y - _font->getFontHeight(), + y, _graph->_frontScreen->w, 216 ); diff --git a/engines/prince/prince.h b/engines/prince/prince.h index 2df8e66825..0da0bcfe71 100644 --- a/engines/prince/prince.h +++ b/engines/prince/prince.h @@ -47,14 +47,7 @@ namespace Prince { -#if 0 - bool loadFromStream(Common::SeekableReadStream &stream) { - ResourceType *resource = new ResourceType(); - while (resource->loadFromStream(stream)) - _list.push_back(resource); - return true; - } -#endif + struct PrinceGameDescription; class PrinceEngine; |