From 89abab97e3124fa25eb4c7d3e8b38501747a8d17 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Wed, 26 Sep 2012 04:17:31 +0200 Subject: JANITORIAL: Remove trailing whitespaces. Powered by: git ls-files "*.cpp" "*.h" "*.m" "*.mm" | xargs sed -i -e 's/[ \t]*$//' --- engines/toltecs/animation.cpp | 14 +++++++------- engines/toltecs/animation.h | 2 +- engines/toltecs/menu.cpp | 12 ++++++------ engines/toltecs/menu.h | 10 +++++----- engines/toltecs/microtiles.cpp | 2 +- engines/toltecs/movie.cpp | 8 ++++---- engines/toltecs/movie.h | 8 ++++---- engines/toltecs/music.cpp | 2 +- engines/toltecs/palette.cpp | 18 +++++++++--------- engines/toltecs/palette.h | 2 +- engines/toltecs/render.cpp | 14 +++++++------- engines/toltecs/render.h | 4 ++-- engines/toltecs/resource.cpp | 8 ++++---- engines/toltecs/saveload.cpp | 8 ++++---- engines/toltecs/screen.cpp | 28 ++++++++++++++-------------- engines/toltecs/screen.h | 16 ++++++++-------- engines/toltecs/script.cpp | 16 ++++++++-------- engines/toltecs/script.h | 4 ++-- engines/toltecs/segmap.cpp | 20 ++++++++++---------- engines/toltecs/segmap.h | 8 ++++---- engines/toltecs/sound.cpp | 14 +++++++------- engines/toltecs/sprite.cpp | 20 ++++++++++---------- engines/toltecs/toltecs.cpp | 28 ++++++++++++++-------------- engines/toltecs/toltecs.h | 8 ++++---- 24 files changed, 137 insertions(+), 137 deletions(-) (limited to 'engines/toltecs') diff --git a/engines/toltecs/animation.cpp b/engines/toltecs/animation.cpp index eef9cef9ed..084332cf83 100644 --- a/engines/toltecs/animation.cpp +++ b/engines/toltecs/animation.cpp @@ -53,7 +53,7 @@ void AnimationPlayer::start(uint resIndex) { _vm->_arc->closeResource(); debug(1, "AnimationPlayer::start() width = %d; height = %d; frameCount = %d", _width, _height, _frameCount); - + _vm->_sceneWidth = _width; _vm->_sceneHeight = _height; @@ -63,7 +63,7 @@ void AnimationPlayer::start(uint resIndex) { _frameNumber = 0; // TODO mov screenFlag01, 0FFFFh // TODO mov animDrawFrameFlag, 0FFFFh - + _firstNextFrameOffset = _nextFrameOffset; _firstCurFrameSize = _curFrameSize; _firstNextFrameSize = _nextFrameSize; @@ -81,25 +81,25 @@ void AnimationPlayer::nextFrame() { } else { _frameNumber++; } - + debug(1, "AnimationPlayer::nextFrame() frameNumber = %d", _frameNumber); if (_keepFrameCounter > 0) { _keepFrameCounter--; return; } - + _vm->_arc->openResource(_resIndex); _vm->_arc->seek(_nextFrameOffset, SEEK_CUR); _curFrameSize = _nextFrameSize; - + if (_curFrameSize == 0) _curFrameSize = 1; - + _vm->_arc->read(_animBuffer, _curFrameSize); _nextFrameSize = _vm->_arc->readUint32LE(); _nextFrameOffset += _curFrameSize + 4; - + if (_curFrameSize > 1) { unpackFrame(); // TODO mov animDrawFrameFlag, 0FFFFh diff --git a/engines/toltecs/animation.h b/engines/toltecs/animation.h index 22576d7535..54ec5d8afa 100644 --- a/engines/toltecs/animation.h +++ b/engines/toltecs/animation.h @@ -54,7 +54,7 @@ public: uint16 _width, _height; uint16 _frameNumber, _frameCount; uint32 _keepFrameCounter; - + uint32 _curFrameSize; uint32 _nextFrameSize, _nextFrameOffset; diff --git a/engines/toltecs/menu.cpp b/engines/toltecs/menu.cpp index dfdad74839..c214205624 100644 --- a/engines/toltecs/menu.cpp +++ b/engines/toltecs/menu.cpp @@ -75,7 +75,7 @@ int MenuSystem::run(MenuID menuId) { update(); _vm->_system->updateScreen(); } - + // Restore original background memcpy(_vm->_screen->_frontScreen, backgroundOrig.getBasePtr(0,0), 640 * 400); _vm->_system->copyRectToScreen(_vm->_screen->_frontScreen, 640, 0, 0, 640, 400); @@ -86,7 +86,7 @@ int MenuSystem::run(MenuID menuId) { _background->free(); delete _background; - return 0; + return 0; } void MenuSystem::update() { @@ -539,7 +539,7 @@ void MenuSystem::setCfgVoices(bool value, bool active) { void MenuSystem::drawVolumeBar(ItemID itemID) { int w = 440, y, volume; char text[21]; - + switch (itemID) { case kItemIdMaster: // unused in ScummVM, always 20 y = 130 + 25 * 0; @@ -567,13 +567,13 @@ void MenuSystem::drawVolumeBar(ItemID itemID) { Font font(_vm->_res->load(_vm->_screen->getFontResIndex(1))->data); restoreRect(390, y - font.getHeight(), 100, 25); - + for (int i = 0; i < volume; i++) text[i] = '|'; text[volume] = 0; - + drawString(0, y, w, 0, 246, text); - + } void MenuSystem::changeVolumeBar(ItemID itemID, int delta) { diff --git a/engines/toltecs/menu.h b/engines/toltecs/menu.h index 9234a56398..a72205c2e5 100644 --- a/engines/toltecs/menu.h +++ b/engines/toltecs/menu.h @@ -80,7 +80,7 @@ public: int run(MenuID menuId); void update(); void handleEvents(); - + protected: struct Item { @@ -91,7 +91,7 @@ protected: int x, y, w; uint fontNum; }; - + struct SavegameItem { int _slotNum; Common::String _description; @@ -116,20 +116,20 @@ protected: Common::Array _items; Common::Array _savegames; - + void addClickTextItem(ItemID id, int x, int y, int w, uint fontNum, const char *caption, byte defaultColor, byte activeColor); void drawItem(ItemID itemID, bool active); void handleMouseMove(int x, int y); void handleMouseClick(int x, int y); void handleKeyDown(const Common::KeyState& kbd); - + ItemID findItemAt(int x, int y); Item *getItem(ItemID id); void setItemCaption(Item *item, const char *caption); void initMenu(MenuID menuID); - + void enterItem(ItemID id); void leaveItem(ItemID id); void clickItem(ItemID id); diff --git a/engines/toltecs/microtiles.cpp b/engines/toltecs/microtiles.cpp index 0b61ac38a5..60e65bdaf3 100644 --- a/engines/toltecs/microtiles.cpp +++ b/engines/toltecs/microtiles.cpp @@ -138,7 +138,7 @@ Common::Rect * MicroTileArray::getRectangles(int *num_rects, int min_x, int min_ x0 = CLIP (x0, min_x, max_x); y0 = CLIP (y0, min_y, max_y); y1 = CLIP (y1, min_y, max_y); - + // FIXME: Why is the following code in an #if block? #if 1 start = i; diff --git a/engines/toltecs/movie.cpp b/engines/toltecs/movie.cpp index 74364630f5..75127d7159 100644 --- a/engines/toltecs/movie.cpp +++ b/engines/toltecs/movie.cpp @@ -61,7 +61,7 @@ void MoviePlayer::playMovie(uint resIndex) { int16 savedCameraY = _vm->_cameraY; int16 savedGuiHeight = _vm->_guiHeight; byte moviePalette[768]; - + _vm->_isSaveAllowed = false; memset(moviePalette, 0, sizeof(moviePalette)); @@ -105,7 +105,7 @@ void MoviePlayer::playMovie(uint resIndex) { uint32 chunkSize = _vm->_arc->readUint32LE(); debug(0, "chunkType = %d; chunkSize = %d", chunkType, chunkSize); - + // Skip audio chunks - we've already queued them in // fetchAudioChunks() above if (chunkType == kChunkAudio) { @@ -178,7 +178,7 @@ void MoviePlayer::playMovie(uint resIndex) { default: error("MoviePlayer::playMovie(%04X) Unknown chunk type %d at %08X", resIndex, chunkType, _vm->_arc->pos() - 5 - chunkSize); } - + if (!handleInput()) break; } @@ -189,7 +189,7 @@ void MoviePlayer::playMovie(uint resIndex) { _vm->_mixer->stopHandle(_audioStreamHandle); _vm->_arc->closeResource(); - + debug(0, "playMovie() done"); _vm->_sceneWidth = savedSceneWidth; diff --git a/engines/toltecs/movie.h b/engines/toltecs/movie.h index aecfac240f..8fa48975d7 100644 --- a/engines/toltecs/movie.h +++ b/engines/toltecs/movie.h @@ -36,7 +36,7 @@ public: ~MoviePlayer(); void playMovie(uint resIndex); - + protected: ToltecsEngine *_vm; Audio::QueuingAudioStream *_audioStream; @@ -47,11 +47,11 @@ protected: void unpackPalette(byte *source, byte *dest, int elemCount, int elemSize); void unpackRle(byte *source, byte *dest); - + void fetchAudioChunks(); - + bool handleInput(); - + }; } // End of namespace Toltecs diff --git a/engines/toltecs/music.cpp b/engines/toltecs/music.cpp index 2cd36cad9f..830e4a97da 100644 --- a/engines/toltecs/music.cpp +++ b/engines/toltecs/music.cpp @@ -60,7 +60,7 @@ void MusicPlayer::playMIDI(const byte *data, uint32 size, bool loop) { memcpy(_buffer, data, size); MidiParser *parser; - + if (!memcmp(data, "FORM", 4)) parser = MidiParser::createParser_XMIDI(NULL); else diff --git a/engines/toltecs/palette.cpp b/engines/toltecs/palette.cpp index 706218e0ba..74683c6d7a 100644 --- a/engines/toltecs/palette.cpp +++ b/engines/toltecs/palette.cpp @@ -31,7 +31,7 @@ namespace Toltecs { Palette::Palette(ToltecsEngine *vm) : _vm(vm) { clearFragments(); - + memset(_colorTransTable, 0, sizeof(_colorTransTable)); } @@ -81,7 +81,7 @@ void Palette::setDeltaPalette(byte *palette, byte mask, int8 deltaValue, int16 c if (mask & 4) colors[index * 3 + 2] = CLIP(rgb + deltaValue, 0, 63) << 2; index++; } - + debug(0, "startIndex = %d; colorCount = %d", startIndex, colorCount); _vm->_system->getPaletteManager()->setPalette((const byte *)colors, 0, 256); @@ -101,9 +101,9 @@ void Palette::addFragment(uint resIndex, int16 id) { Resource *fragmentResource = _vm->_res->load(resIndex); byte count = fragmentResource->size / 3; - + memcpy(&_mainPalette[_fragmentIndex * 3], fragmentResource->data, count * 3); - + PaletteFragment fragment; fragment.id = id; fragment.index = _fragmentIndex; @@ -126,7 +126,7 @@ uint16 Palette::findFragment(int16 id) { break; } } - + debug(0, "Palette::findFragment() result = %04X", result); return result; @@ -140,9 +140,9 @@ void Palette::clearFragments() { void Palette::buildColorTransTable(byte limit, int8 deltaValue, byte mask) { byte r = 0, g = 0, b = 0; - + mask &= 7; - + for (int i = 0; i < 256; i++) { if (deltaValue < 0) { @@ -161,7 +161,7 @@ void Palette::buildColorTransTable(byte limit, int8 deltaValue, byte mask) { b -= deltaValue; } } - + int bestIndex = 0; uint16 bestMatch = 0xFFFF; @@ -174,7 +174,7 @@ void Palette::buildColorTransTable(byte limit, int8 deltaValue, byte mask) { bestIndex = j; } } - + _colorTransTable[i] = bestIndex; } diff --git a/engines/toltecs/palette.h b/engines/toltecs/palette.h index 7bcf06e027..570f51777e 100644 --- a/engines/toltecs/palette.h +++ b/engines/toltecs/palette.h @@ -66,7 +66,7 @@ protected: int16 id; byte index, count; }; - + typedef Common::Array PaletteFragmentArray; ToltecsEngine *_vm; diff --git a/engines/toltecs/render.cpp b/engines/toltecs/render.cpp index 3f5356493e..4c41e6ce00 100644 --- a/engines/toltecs/render.cpp +++ b/engines/toltecs/render.cpp @@ -114,7 +114,7 @@ void RenderQueue::addMask(SegmapMaskRect &mask) { void RenderQueue::update() { bool doFullRefresh = _vm->_screen->_fullRefresh; - + _updateUta->clear(); if (!doFullRefresh) { @@ -166,7 +166,7 @@ void RenderQueue::update() { for (RenderQueueArray::iterator iter = _currQueue->begin(); iter != _currQueue->end(); iter++) { const RenderQueueItem *item = &(*iter); - + if (item->flags == kRefresh || doFullRefresh) { switch (item->type) { @@ -200,7 +200,7 @@ void RenderQueue::update() { SWAP(_currQueue, _prevQueue); _currQueue->clear(); - + } void RenderQueue::clear() { @@ -249,16 +249,16 @@ bool RenderQueue::hasItemChanged(const RenderQueueItem &item1, const RenderQueue if (item1.type != item2.type) return true; - + if (item1.rect.left != item2.rect.left || item1.rect.top != item2.rect.top || item1.rect.right != item2.rect.right || item1.rect.bottom != item2.rect.bottom) return true; - + if (item1.type == kText && item1.text.color != item2.text.color) return true; - + return false; } @@ -268,7 +268,7 @@ void RenderQueue::invalidateItemsByRect(const Common::Rect &rect, const RenderQu if (item != subItem && subItem->flags == kUnchanged && rect.intersects(subItem->rect)) { - + subItem->flags = kRefresh; invalidateItemsByRect(subItem->rect, subItem); } diff --git a/engines/toltecs/render.h b/engines/toltecs/render.h index bb9ec29959..59d7a3ddb9 100644 --- a/engines/toltecs/render.h +++ b/engines/toltecs/render.h @@ -75,7 +75,7 @@ public: void addMask(SegmapMaskRect &mask); void update(); void clear(); - + protected: typedef Common::List RenderQueueArray; @@ -87,7 +87,7 @@ protected: RenderQueueItem *findItemInQueue(RenderQueueArray *queue, const RenderQueueItem &item); bool hasItemChanged(const RenderQueueItem &item1, const RenderQueueItem &item2); void invalidateItemsByRect(const Common::Rect &rect, const RenderQueueItem *item); - + void addDirtyRect(const Common::Rect &rect); void restoreDirtyBackground(); void updateDirtyRects(); diff --git a/engines/toltecs/resource.cpp b/engines/toltecs/resource.cpp index b95e0444b1..0b9f7c8fcd 100644 --- a/engines/toltecs/resource.cpp +++ b/engines/toltecs/resource.cpp @@ -66,7 +66,7 @@ void ArchiveReader::dump(uint resIndex, const char *prefix) { byte *data = new byte[resourceSize]; Common::String fn; - + if (prefix) fn = Common::String::format("%s_%04X.0", prefix, resIndex); else @@ -117,11 +117,11 @@ Resource *ResourceCache::load(uint resIndex) { resItem->data = new byte[resItem->size]; _vm->_arc->read(resItem->data, resItem->size); _vm->_arc->closeResource(); - + _cache[resIndex] = resItem; - + return resItem; - + } } diff --git a/engines/toltecs/saveload.cpp b/engines/toltecs/saveload.cpp index 4de25101d2..6c195a34c2 100644 --- a/engines/toltecs/saveload.cpp +++ b/engines/toltecs/saveload.cpp @@ -92,7 +92,7 @@ void ToltecsEngine::savegame(const char *filename, const char *description) { byte descriptionLen = strlen(description); out->writeByte(descriptionLen); out->write(description, descriptionLen); - + Graphics::saveThumbnail(*out); // Not used yet, reserved for future usage @@ -149,13 +149,13 @@ void ToltecsEngine::loadgame(const char *filename) { SaveHeader header; kReadSaveHeaderError errorCode = readSaveHeader(in, false, header); - + if (errorCode != kRSHENoError) { warning("Error loading savegame '%s'", filename); delete in; return; } - + _sound->stopAll(); _music->stopSequence(); g_engine->setTotalPlayTime(header.playTime * 1000); @@ -181,7 +181,7 @@ void ToltecsEngine::loadgame(const char *filename) { _mouseX = in->readUint16LE(); _mouseY = in->readUint16LE(); _mouseDisabled = in->readUint16LE(); - + _system->warpMouse(_mouseX, _mouseY); _system->showMouse(_mouseDisabled == 0); diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp index 7ec6e940dd..32202ad13e 100644 --- a/engines/toltecs/screen.cpp +++ b/engines/toltecs/screen.cpp @@ -73,7 +73,7 @@ Screen::~Screen() { delete[] _frontScreen; delete[] _backScreen; - + delete _renderQueue; } @@ -129,7 +129,7 @@ void Screen::drawGuiImage(int16 x, int16 y, uint resIndex) { byte *dest = _frontScreen + x + (y + _vm->_cameraHeight) * 640; //debug(0, "Screen::drawGuiImage() x = %d; y = %d; w = %d; h = %d; resIndex = %d", x, y, width, height, resIndex); - + while (workHeight > 0) { int count = 1; byte pixel = *imageData++; @@ -247,7 +247,7 @@ void Screen::addAnimatedSprite(int16 x, int16 y, int16 fragmentId, byte *data, i } else { loopNum |= 0x8000; } - + WRITE_LE_UINT16(spriteItem + 0, loopNum); WRITE_LE_UINT16(spriteItem + 4, frameNum); @@ -308,9 +308,9 @@ void Screen::updateVerbLine(int16 slotIndex, int16 slotOffset) { wrapState.len2 = 0; y = _verbLineY; - + memset(wrapState.textBuffer, 0, sizeof(wrapState.textBuffer)); - + for (int16 i = 0; i <= _verbLineNum; i++) { wrapState.sourceString = _vm->_script->getSlotData(_verbLineItems[i].slotIndex) + _verbLineItems[i].slotOffset; len = wrapGuiText(_fontResIndexArray[0], _verbLineWidth, wrapState); @@ -331,19 +331,19 @@ void Screen::updateVerbLine(int16 slotIndex, int16 slotOffset) { wrapState.sourceString++; wrapState.len1 -= len; wrapState.len2 = len + 1; - + drawGuiText(_verbLineX - 1 - (wrapState.width / 2), y, 0xF9, 0xFF, _fontResIndexArray[0], wrapState); wrapState.destString = wrapState.textBuffer; wrapState.width = 0; len = wrapGuiText(_fontResIndexArray[0], _verbLineWidth, wrapState); wrapState.len1 += len; - + y += 9; } y += 9; } - + wrapState.len1 -= len; wrapState.len2 = len; @@ -463,7 +463,7 @@ void Screen::addTalkTextRect(Font &font, int16 x, int16 &y, int16 length, int16 textRect->x = CLIP(x - width / 2, 0, 640); item->lineCount++; } - + y += font.getHeight() - 1; } @@ -559,7 +559,7 @@ int16 Screen::wrapGuiText(uint fontResIndex, int maxWidth, GuiTextWrapState &wra Font font(_vm->_res->load(fontResIndex)->data); int16 len = 0; - + while (*wrapState.sourceString >= 0x20 && *wrapState.sourceString < 0xF0) { byte ch = *wrapState.sourceString; byte charWidth; @@ -573,9 +573,9 @@ int16 Screen::wrapGuiText(uint fontResIndex, int maxWidth, GuiTextWrapState &wra wrapState.width += charWidth; *wrapState.destString++ = *wrapState.sourceString++; } - + return len; - + } void Screen::drawGuiText(int16 x, int16 y, byte fontColor1, byte fontColor2, uint fontResIndex, GuiTextWrapState &wrapState) { @@ -765,7 +765,7 @@ void Screen::loadState(Common::ReadStream *in) { _verbLineItems[i].slotIndex = in->readUint16LE(); _verbLineItems[i].slotOffset = in->readUint16LE(); } - + // Load talk text items _talkTextX = in->readUint16LE(); _talkTextY = in->readUint16LE(); @@ -786,7 +786,7 @@ void Screen::loadState(Common::ReadStream *in) { _talkTextItems[i].lines[j].length = in->readUint16LE(); } } - + // Load GUI bitmap { byte *gui = _frontScreen + _vm->_cameraHeight * 640; diff --git a/engines/toltecs/screen.h b/engines/toltecs/screen.h index 988f59c840..315e9a45c3 100644 --- a/engines/toltecs/screen.h +++ b/engines/toltecs/screen.h @@ -154,15 +154,15 @@ public: ~Screen(); void unpackRle(byte *source, byte *dest, uint16 width, uint16 height); - + void loadMouseCursor(uint resIndex); - + void drawGuiImage(int16 x, int16 y, uint resIndex); - + void startShakeScreen(int16 shakeCounter); void stopShakeScreen(); void updateShakeScreen(); - + // Sprite list void addStaticSprite(byte *spriteItem); void addAnimatedSprite(int16 x, int16 y, int16 fragmentId, byte *data, int16 *spriteArray, bool loop, int mode); @@ -175,7 +175,7 @@ public: // Verb line void updateVerbLine(int16 slotIndex, int16 slotOffset); - + // Talk text void updateTalkText(int16 slotIndex, int16 slotOffset); void addTalkTextRect(Font &font, int16 x, int16 &y, int16 length, int16 width, TalkTextItem *item); @@ -207,7 +207,7 @@ public: int16 slotIndex; int16 slotOffset; }; - + struct Rect { int16 x, y, width, height; }; @@ -215,7 +215,7 @@ public: ToltecsEngine *_vm; byte *_frontScreen, *_backScreen; - + uint _fontResIndexArray[10]; byte _fontColor1, _fontColor2; @@ -229,7 +229,7 @@ public: VerbLineItem _verbLineItems[8]; int16 _verbLineX, _verbLineY, _verbLineWidth; int16 _verbLineCount; - + // Talk text int16 _talkTextX, _talkTextY; int16 _talkTextMaxWidth; diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp index 40b13526cf..03a2b66088 100644 --- a/engines/toltecs/script.cpp +++ b/engines/toltecs/script.cpp @@ -197,7 +197,7 @@ void ScriptInterpreter::runScript() { _vm->saveGameState(_vm->_saveLoadSlot, _vm->_saveLoadDescription); _vm->_saveLoadRequested = 0; } - + if (_switchLocalDataNear) { _switchLocalDataNear = false; _localData = getSlotData(_regs.reg4); @@ -214,7 +214,7 @@ void ScriptInterpreter::runScript() { _localData = _stack + 2; _switchLocalDataNear = true; } - + byte opcode = readByte(); execOpcode(opcode); @@ -547,7 +547,7 @@ const char *getVarName(uint variable) { int16 ScriptInterpreter::getGameVar(uint variable) { debug(0, "ScriptInterpreter::getGameVar(%d{%s})", variable, getVarName(variable)); - + switch (variable) { case 0: return _vm->_mouseDisabled; case 1: return _vm->_mouseY; @@ -579,7 +579,7 @@ int16 ScriptInterpreter::getGameVar(uint variable) { void ScriptInterpreter::setGameVar(uint variable, int16 value) { debug(0, "ScriptInterpreter::setGameVar(%d{%s}, %d)", variable, getVarName(variable), value); - + switch (variable) { case 0: _vm->_mouseDisabled = value; @@ -718,7 +718,7 @@ void ScriptInterpreter::saveState(Common::WriteStream *out) { // Save stack out->write(_stack, kScriptStackSize); out->writeUint16LE(_savedSp); - + // Save IP out->writeUint16LE((int16)(_code - getSlotData(_regs.reg4))); @@ -1046,14 +1046,14 @@ void ScriptInterpreter::sfHandleInput() { Only scancodes known to be used (so far) are converted */ switch (_vm->_keyState.keycode) { - case Common::KEYCODE_ESCAPE: + case Common::KEYCODE_ESCAPE: keyCode = 1; break; case Common::KEYCODE_F10: keyCode = 68; break; default: - break; + break; } } localWrite16(varOfs, keyCode); @@ -1068,7 +1068,7 @@ void ScriptInterpreter::sfRunOptionsScreen() { of data so the game doesn't stall while playing (due to the slow speed of CD-Drives back then). This is not needed in ScummVM since all supported systems are fast enough to load data in-game. */ - + void ScriptInterpreter::sfPrecacheSprites() { // See note above } diff --git a/engines/toltecs/script.h b/engines/toltecs/script.h index 7a50d22ff2..89dca4598f 100644 --- a/engines/toltecs/script.h +++ b/engines/toltecs/script.h @@ -90,13 +90,13 @@ protected: bool _cmpBitTest; ScriptSlot _slots[kMaxScriptSlots]; - + ScriptRegs _regs; int16 _savedSp; byte readByte(); int16 readInt16(); - + void execOpcode(byte opcode); void setupScriptFunctions(); diff --git a/engines/toltecs/segmap.cpp b/engines/toltecs/segmap.cpp index f7d806c67b..b06c0af675 100644 --- a/engines/toltecs/segmap.cpp +++ b/engines/toltecs/segmap.cpp @@ -48,7 +48,7 @@ void SegmentMap::load(byte *source) { uint16 maskRectCount = READ_LE_UINT16(source); source += 2; uint16 maskRectDataSize = maskRectCount * 12 + 2; - + debug(0, "SegmentMap::load() maskRectCount = %d", maskRectCount); for (uint16 i = 0; i < maskRectCount; i++) { @@ -74,25 +74,25 @@ void SegmentMap::load(byte *source) { // Load path rects source += 2; // skip rects array size - + uint16 pathRectCount = READ_LE_UINT16(source); source += 2; - + debug(0, "SegmentMap::load() pathRectCount = %d", pathRectCount); - + for (uint16 i = 0; i < pathRectCount; i++) { SegmapPathRect pathRect; pathRect.y1 = READ_LE_UINT16(source); pathRect.x1 = READ_LE_UINT16(source + 2); pathRect.y2 = pathRect.y1 + READ_LE_UINT16(source + 4); pathRect.x2 = pathRect.x1 + READ_LE_UINT16(source + 6); - + debug(0, "SegmentMap::load() (%d, %d, %d, %d)", pathRect.x1, pathRect.y1, pathRect.x2, pathRect.y2); source += 8; _pathRects.push_back(pathRect); } - + // Load info rects source += 2; // skip rects array size @@ -141,7 +141,7 @@ void SegmentMap::adjustPathPoint(int16 &x, int16 &y) { uint32 minDistance = 0xFFFFFFFF, distance; int16 adjustedX = 0, adjustedY = 0, x2, y2; - + for (int16 rectIndex = 0; rectIndex < (int16)_pathRects.size(); rectIndex++) { if (x >= _pathRects[rectIndex].x1 && x < _pathRects[rectIndex].x2) { @@ -174,7 +174,7 @@ void SegmentMap::adjustPathPoint(int16 &x, int16 &y) { } } - + x = adjustedX; y = adjustedY; @@ -318,7 +318,7 @@ void SegmentMap::findPath(int16 *pointsArray, int16 destX, int16 destY, int16 so pointsArray[0] = 0; pointsArray[1] = TO_LE_16(_pathNodesCount + 1); } - + debug(0, "SegmentMap::findPath() count = %d", FROM_LE_16(pointsArray[1])); #if 0 // DEBUG: Draw the path we found @@ -335,7 +335,7 @@ void SegmentMap::findPath(int16 *pointsArray, int16 destX, int16 destY, int16 so sy = y; } #endif - + } int8 SegmentMap::getScalingAtPoint(int16 x, int16 y) { diff --git a/engines/toltecs/segmap.h b/engines/toltecs/segmap.h index 30182a6b71..dda0edeb88 100644 --- a/engines/toltecs/segmap.h +++ b/engines/toltecs/segmap.h @@ -61,14 +61,14 @@ public: void getRgbModifiertAtPoint(int16 x, int16 y, int16 id, byte &r, byte &g, byte &b); void addMasksToRenderQueue(); - + //protected: public: // for debugging purposes struct SegmapPathRect { int16 x1, y1, x2, y2; }; - + struct SegmapInfoRect { int16 y, x; int16 height, width; @@ -78,11 +78,11 @@ public: // for debugging purposes return py >= y && py <= y + height && px >= x && px <= x + width; } }; - + struct PathPoint { int16 y, x; }; - + typedef Common::Array SegmapMaskRectArray; typedef Common::Array SegmapPathRectArray; typedef Common::Array SegmapInfoRectArray; diff --git a/engines/toltecs/sound.cpp b/engines/toltecs/sound.cpp index 2705efe5f0..4b281392e5 100644 --- a/engines/toltecs/sound.cpp +++ b/engines/toltecs/sound.cpp @@ -57,7 +57,7 @@ void Sound::playSpeech(int16 resIndex) { void Sound::playSound(int16 resIndex, int16 type, int16 volume) { debug(0, "playSound(%d, %d, %d)", resIndex, type, volume); - + internalPlaySound(resIndex, type, volume, 0); } @@ -66,7 +66,7 @@ void Sound::playSoundAtPos(int16 resIndex, int16 x, int16 y) { int16 volume = 50 + ABS(_vm->_segmap->getScalingAtPoint(x, y)) / 2; int16 panning = 0, deltaX = 0; - + if (_vm->_cameraX > x) deltaX = _vm->_cameraX - x; else if (_vm->_cameraX + 640 < x) @@ -75,7 +75,7 @@ void Sound::playSoundAtPos(int16 resIndex, int16 x, int16 y) { deltaX = 600; volume = ((100 - deltaX / 6) * volume) / 100; - + if (_vm->_cameraX + 320 != x) { panning = CLIP(x - (_vm->_cameraX + 320), -381, 381) / 3; } @@ -86,7 +86,7 @@ void Sound::playSoundAtPos(int16 resIndex, int16 x, int16 y) { void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 panning) { // Change the game's sound volume (0 - 100) to Scummvm's scale (0 - 255) volume = (volume == -1) ? 255 : volume * 255 / 100; - + if (resIndex == -1) { // Stop all sounds _vm->_mixer->stopAll(); @@ -108,7 +108,7 @@ void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 pa // Stop speech and play new sound stopSpeech(); } - + // Play new sound in empty channel int freeChannel = -1; for (int i = 0; i < kMaxChannels; i++) { @@ -117,7 +117,7 @@ void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 pa break; } } - + // If all channels are in use no new sound will be played if (freeChannel >= 0) { Resource *soundResource = _vm->_res->load(resIndex); @@ -140,7 +140,7 @@ void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 pa } } - + } void Sound::updateSpeech() { diff --git a/engines/toltecs/sprite.cpp b/engines/toltecs/sprite.cpp index 7a02663793..6101eb7d85 100644 --- a/engines/toltecs/sprite.cpp +++ b/engines/toltecs/sprite.cpp @@ -199,7 +199,7 @@ bool Screen::createSpriteDrawItem(const DrawRequest &drawRequest, SpriteDrawItem sprite.frameNum = frameNum; spriteData = _vm->_res->load(drawRequest.resIndex)->data; - + if (drawRequest.flags & 0x1000) { sprite.flags |= 4; } @@ -207,7 +207,7 @@ bool Screen::createSpriteDrawItem(const DrawRequest &drawRequest, SpriteDrawItem if (drawRequest.flags & 0x2000) { sprite.flags |= 0x10; } - + if (drawRequest.flags & 0x4000) { sprite.flags |= 0x40; } @@ -218,7 +218,7 @@ bool Screen::createSpriteDrawItem(const DrawRequest &drawRequest, SpriteDrawItem if (spriteFrameEntry.w == 0 || spriteFrameEntry.h == 0) return false; - + sprite.offset = spriteFrameEntry.offset; sprite.width = spriteFrameEntry.w; @@ -263,12 +263,12 @@ bool Screen::createSpriteDrawItem(const DrawRequest &drawRequest, SpriteDrawItem xoffs -= (xoffs * scaleValue) / 100; yoffs -= (yoffs * scaleValue) / 100; } - + } - + sprite.x -= xoffs; sprite.y -= yoffs; - + sprite.yerror = sprite.ydelta; // Now we check if the sprite needs to be clipped @@ -283,7 +283,7 @@ bool Screen::createSpriteDrawItem(const DrawRequest &drawRequest, SpriteDrawItem sprite.height -= clipHeight; if (sprite.height <= 0) return false; - + sprite.y = _vm->_cameraY; // If the sprite is scaled @@ -311,7 +311,7 @@ bool Screen::createSpriteDrawItem(const DrawRequest &drawRequest, SpriteDrawItem } sprite.yerror = chopHeight; } - + spriteFrameData = spriteData + sprite.offset; // Now the sprite's offset is adjusted to point to the starting line if ((sprite.flags & 0x10) == 0) { @@ -439,7 +439,7 @@ void Screen::drawSpriteCore(byte *dest, SpriteFilter &reader, const SpriteDrawIt SpriteReaderStatus status; PixelPacket packet; - + byte *destp = dest; int16 skipX = sprite.skipX; @@ -459,7 +459,7 @@ void Screen::drawSpriteCore(byte *dest, SpriteFilter &reader, const SpriteDrawIt status = reader.readPacket(packet); } } - + if (w - packet.count < 0) packet.count = w; diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp index b1f60c5cc7..71264a69cc 100644 --- a/engines/toltecs/toltecs.cpp +++ b/engines/toltecs/toltecs.cpp @@ -80,7 +80,7 @@ Common::Error ToltecsEngine::run() { _flag01 = 0; _saveLoadRequested = 0; - + _cameraX = 0; _cameraY = 0; _newCameraX = 0; @@ -91,7 +91,7 @@ Common::Error ToltecsEngine::run() { _sceneWidth = 0; _sceneHeight = 0; - + _doSpeech = true; _doText = true; @@ -121,7 +121,7 @@ Common::Error ToltecsEngine::run() { _moviePlayer = new MoviePlayer(this); _music = new Music(_arc); _menuSystem = new MenuSystem(this); - + _sound = new Sound(this); _cfgText = ConfMan.getBool("subtitles"); @@ -186,7 +186,7 @@ Common::Error ToltecsEngine::run() { delete _music; delete _moviePlayer; delete _menuSystem; - + delete _sound; return Common::kNoError; @@ -250,7 +250,7 @@ void ToltecsEngine::loadScene(uint resIndex) { _screen->_fullRefresh = true; _screen->_renderQueue->clear(); - + } void ToltecsEngine::updateScreen() { @@ -426,7 +426,7 @@ void ToltecsEngine::setCamera(int16 x, int16 y) { _screen->finishTalkTextItems(); _screen->clearSprites(); - + _cameraX = x; _newCameraX = x; @@ -495,9 +495,9 @@ void ToltecsEngine::updateCamera() { } void ToltecsEngine::talk(int16 slotIndex, int16 slotOffset) { - + byte *scanData = _script->getSlotData(slotIndex) + slotOffset; - + while (*scanData < 0xF0) { if (*scanData == 0x19) { scanData++; @@ -510,7 +510,7 @@ void ToltecsEngine::talk(int16 slotIndex, int16 slotOffset) { } scanData++; } - + if (*scanData == 0xFE) { if (_doSpeech) { int16 resIndex = READ_LE_UINT16(scanData + 1); @@ -544,7 +544,7 @@ void ToltecsEngine::walk(byte *walkData) { walkInfo.xerror = READ_LE_UINT16(walkData + 14); walkInfo.mulValue = READ_LE_UINT16(walkData + 16); walkInfo.scaling = READ_LE_UINT16(walkData + 18); - + walkInfo.scaling = -_segmap->getScalingAtPoint(walkInfo.x, walkInfo.y); if (walkInfo.y1 < walkInfo.y2) @@ -552,7 +552,7 @@ void ToltecsEngine::walk(byte *walkData) { else ystep = 1; ydelta = ABS(walkInfo.y1 - walkInfo.y2) * _walkSpeedY; - + if (walkInfo.x1 < walkInfo.x2) xstep = -1; else @@ -615,11 +615,11 @@ void ToltecsEngine::walk(byte *walkData) { } -int16 ToltecsEngine::findRectAtPoint(byte *rectData, int16 x, int16 y, int16 index, int16 itemSize, +int16 ToltecsEngine::findRectAtPoint(byte *rectData, int16 x, int16 y, int16 index, int16 itemSize, byte *rectDataEnd) { rectData += index * itemSize; - + while (rectData < rectDataEnd) { int16 rectY = READ_LE_UINT16(rectData); if (rectY == -10) @@ -637,7 +637,7 @@ int16 ToltecsEngine::findRectAtPoint(byte *rectData, int16 x, int16 y, int16 ind index++; rectData += itemSize; } - + return -1; } diff --git a/engines/toltecs/toltecs.h b/engines/toltecs/toltecs.h index e82a88bcfc..b95a4f77cb 100644 --- a/engines/toltecs/toltecs.h +++ b/engines/toltecs/toltecs.h @@ -134,8 +134,8 @@ public: void talk(int16 slotIndex, int16 slotOffset); void walk(byte *walkData); - - int16 findRectAtPoint(byte *rectData, int16 x, int16 y, int16 index, int16 itemSize, + + int16 findRectAtPoint(byte *rectData, int16 x, int16 y, int16 index, int16 itemSize, byte *rectDataEnd); int _cfgVoicesVolume, _cfgMusicVolume, _cfgSoundFXVolume; @@ -163,7 +163,7 @@ public: uint _sceneResIndex; int16 _sceneWidth, _sceneHeight; - + int _counter01, _counter02; bool _movieSceneFlag; byte _flag01; @@ -174,7 +174,7 @@ public: int16 _guiHeight; bool _doSpeech, _doText; - + int16 _walkSpeedY, _walkSpeedX; Common::KeyState _keyState; -- cgit v1.2.3