Skip to content

Commit

Permalink
DIRECTOR: Whitespace fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Aug 3, 2016
1 parent 4b56951 commit 7607ba9
Show file tree
Hide file tree
Showing 8 changed files with 368 additions and 254 deletions.
6 changes: 5 additions & 1 deletion engines/director/dib.cpp
Expand Up @@ -59,10 +59,11 @@ void DIBDecoder::destroy() {
}

void DIBDecoder::loadPalette(Common::SeekableReadStream &stream) {
uint16 steps = stream.size()/6;
uint16 steps = stream.size() / 6;
uint16 index = (steps * 3) - 1;
_paletteColorCount = steps;
_palette = new byte[index];

for (uint8 i = 0; i < steps; i++) {
_palette[index - 2] = stream.readByte();
stream.readByte();
Expand Down Expand Up @@ -98,9 +99,12 @@ bool DIBDecoder::loadStream(Common::SeekableReadStream &stream) {
Common::SeekableSubReadStream subStream(&stream, 40, stream.size());

_codec = Image::createBitmapCodec(compression, width, height, bitsPerPixel);

if (!_codec)
return false;

_surface = _codec->decodeFrame(subStream);

return true;
}

Expand Down
2 changes: 0 additions & 2 deletions engines/director/director.cpp
Expand Up @@ -80,8 +80,6 @@ Common::Error DirectorEngine::run() {
-- some more\n");
#endif



//FIXME
_mainArchive = new RIFFArchive();
_mainArchive->openFile("bookshelf_example.mmm");
Expand Down
1 change: 0 additions & 1 deletion engines/director/director.h
Expand Up @@ -27,7 +27,6 @@

#include "engines/engine.h"
#include "engines/director/sound.h"
class OSystem;

namespace Common {
class MacResManager;
Expand Down
7 changes: 7 additions & 0 deletions engines/director/resource.cpp
Expand Up @@ -159,6 +159,7 @@ uint32 Archive::convertTagToUppercase(uint32 tag) {
uint32 newTag = toupper(tag >> 24) << 24;
newTag |= toupper((tag >> 16) & 0xFF) << 16;
newTag |= toupper((tag >> 8) & 0xFF) << 8;

return newTag | toupper(tag & 0xFF);
}

Expand Down Expand Up @@ -195,6 +196,7 @@ bool MacArchive::openFile(const Common::String &fileName) {

for (uint32 j = 0; j < idArray.size(); j++) {
Resource &res = resMap[idArray[j]];

res.offset = res.size = 0; // unused
res.name = _resFork->getResName(tagArray[i], idArray[j]);
}
Expand Down Expand Up @@ -235,6 +237,7 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
uint32 cftcSize = stream->readUint32LE();
uint32 startPos = stream->pos();
stream->readUint32LE(); // unknown (always 0?)

while ((uint32)stream->pos() < startPos + cftcSize) {
uint32 tag = convertTagToUppercase(stream->readUint32BE());

Expand All @@ -244,11 +247,13 @@ bool RIFFArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff

if (tag == 0)
break;

uint16 startResPos = stream->pos();
stream->seek(offset + 12);

Common::String name = "";
byte nameSize = stream->readByte();

if (nameSize) {
for (uint8 i = 0; i < nameSize; i++) {
name += stream->readByte();
Expand Down Expand Up @@ -321,6 +326,7 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
subStream.readUint32(); // size

uint32 rifxType = subStream.readUint32();

if (rifxType != MKTAG('M', 'V', '9', '3') && rifxType != MKTAG('A', 'P', 'P', 'L'))
return false;

Expand Down Expand Up @@ -393,6 +399,7 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
if (casRes) {
Common::SeekableSubReadStreamEndian casStream(stream, casRes->offset + 8, casRes->offset + 8 + casRes->size, _isBigEndian, DisposeAfterUse::NO);
casEntries.resize(casRes->size / 4);

for (uint32 i = 0; i < casEntries.size(); i++)
casEntries[i] = casStream.readUint32();
}
Expand Down

0 comments on commit 7607ba9

Please sign in to comment.